am_bpProjectController code>是用于显示Betterplace.org数据的主要对象。To use it in custom template files just create a new instance, add a betterplace.org ID and use the get methods.
要在自定义模板文件中使用它,只需创建一个新实例,添加一个Betterplace.org ID并使用get方法。 p>
Example:
示例:
$bp_projectObject = new am_bpProjectController();
$ bp_projectObject = new am_bpProjectController();
$bp_projectObject->addProject(7910);
$ bp_projectObject-> addProject(7910);
echo $bp_projectObject->getProjectTitle();
echo $ bp_projectObject-> getProjectTitle(); p>
This will display the Title of the project that has the ID 7910.
这将显示ID为7910的项目的标题。 p>
You are able to display project needs in the same way.
您可以用相同的方式显示项目需求。 p>
Example:
示例:
$bp_projectObject = new am_bpProjectController();
$ bp_projectObject = new am_bpProjectController();
$bp_projectObject->addProject(7910);
$ bp_projectObject-> addProject(7910);
echo $bp_projectObject->getNeedTitle();
echo $ bp_projectObject-> getNeedTitle(); p>
This will display the title of the first need of the project that have the ID 7910.
这将显示ID为7910的项目的第一个需求的标题。 p>
In order to display more than one need you can use the nextProject()
method to switch needs.
要显示多个需求,可以使用 nextProject() code>方法切换需求。It returns false
when no more needs are left:
当没有更多需求时,它将返回 false code>: p>Example:
示例:
$bp_projectObject = new am_bpProjectController();
$ bp_projectObject = new am_bpProjectController();
$bp_projectObject->addProject(7910);
$ bp_projectObject-> addProject(7910);
echo ‘
回显 p>
‘.$bp_projectObject->getNeedTitle().’
‘。$ bp_projectObject-> getNeedTitle()。’ h3>
‘;
’;
do{
做{
echo ‘
回显 p>
‘.$bp_projectObject->getNeedTitle().’
‘。$ bp_projectObject-> getNeedTitle()。’ h4>
‘;
’;
}while($bp_projectObject->nextProject());
} while($ bp_projectObject-> nextProject()); p>
This will display all titles of needs of the project that have the ID 7910.
这将显示ID为7910的项目需求的所有标题。 p>
In order to display more than one project use the method nextProject()
in the same way.
要显示多个项目,请以相同的方式使用方法 nextProject() code>。First you have to add all projects and after that you are able to switch projects:
首先,您必须添加所有项目,然后才能切换项目: p>
Example:
示例:
$bp_projectObject = new am_bpProjectController();
$ bp_projectObject = new am_bpProjectController();
$bp_projectObject->addProject(7910);
$ bp_projectObject-> addProject(7910);
$bp_projectObject->addProject(932);
$ bp_projectObject-> addProject(932);
$bp_projectObject->addProject(1032);
$ bp_projectObject-> addProject(1032);
do{
做{
echo ‘
回显 p>
<
<< / p>
h3>’.$bp_projectObject->getProjectTitle().’
h3>”。$ bp_projectObject-> getProjectTitle()。 p>
<
<< / p>
h3>’;
h3>”;
}while($bp_projectObject->nextProject());
} while($ bp_projectObject-> nextProject()); p>
This will display the titles of the Projects that got the ID 768, 932, 1032.
这将显示ID为768、932、1032的项目的标题。 p>
All methods of am_bpProjectController
am_bpProjectController的所有方法 h3>
addProject($id)
addProject($ id) h4>
Add a betterplace.org project to the stack.
将一个Betterplace.org项目添加到堆栈中。 p>
nextProject()
nextProject() h4>
Moves the project pointer to the next project.
将项目指针移动到下一个项目。
Returns false if no more projects are on stack.
如果堆栈上没有更多项目,则返回 false em>。 p>nextNeed()
nextNeed() h4>
Moves the need pointer of the pointed project to the next need.
将指向项目的需求指针移动到下一个需求。
Returns false if no more projects are on stack.
如果堆栈上没有更多项目,则返回 false em>。 p>firstProject()
firstProject() h4>
Moves the pointer to the first project on the stack.
将指针移到堆栈上的第一个项目。 p>
getProjectID()
getProjectID() h4>
Returns the betterplace.org ID of the project that is pointed.
返回所指向项目的Betterplace.org ID。 p>
getProjectTitle()
getProjectTitle() h4>
Returns the title of the pointed project.
返回所指向项目的标题。 p>
getProjectDescription($maxnumber, $option)
getProjectDescription($ maxnumber,$ option) h4>
Returns the description of the project that is pointed.
返回所指向项目的描述。
It acepts two arguments to limitade the description.
它接受两个论点来限制描述。
$option = 0
will limit count of letters that is specified in $maxnumber
, $option = 1
limits $maxnumber
$ option = 0 code>将限制在 $ maxnumber code>中指定的字母数, $ option = 1 code>限制 $ maxnumber code > words.
>单词。 p>
getProjectAmount($option, $format)
getProjectAmount($ option,$ format) h4>
Returns money amounts of the project.
返回项目的金额。
If $option = 0
it returns the amount of money that is still needed to fulfil the project.
如果 $ option = 0 code>,它将返回完成项目所需的金额。 $option = 1
returns the monay that is already donated and $option = 2
is the complete amount that has been requested.
$ option = 1 code>返回已经捐赠的货币,而 $ option = 2 code>是已请求的完整金额。The argument $format
specified the display of the amount.
参数 $ format code>指定了金额的显示。 $format = 1
returns the amount in Euro formated as usual in Europe.
$ format = 1 code>返回欧洲惯用的欧元格式金额。If $format = 0
the method returns the complete amount unformated in Cents.
如果 $ format = 0 code>,该方法将返回未格式化的全部金额(以美分计)。 $format = 2
returns only the amount of Euros without cent amounts.
$ format = 2 code>仅返回欧元金额,不含分金额。 $format = 3
returns only the amount of Cents like if you would cut the full Euro amounts away.
$ format = 3 code>仅返回美分金额,就像您要减少全部欧元金额一样。 p>getProjectProgress()
getProjectProgress() h4>
Returns the progress of the project in per cent.
以百分比形式返回项目进度。 p>
getProjectLink($option)
getProjectLink($ option) h4>
Returns links belonging to the project that is pointed.
返回属于所指向项目的链接。
$option = 0
will return the link to the project page.
$ option = 0 code>将链接返回到项目页面。 $option = 1
will the link that leds directly to the donation page of the project.
$ option = 1 code>将直接链接到项目的捐赠页面。 p>getProjectOpinions($option)
getProjectOpinions($ option) h4>
Returns the number of opinions about the project on betterplace.org.
在Betterplace.org上返回有关该项目的意见数量。
If the argument is set to $option = 0
you will get the total number of opinions.
如果参数设置为 $ option = 0 code>,您将获得意见总数。If $option
is set to 1
you'll get the number of positive opions, if it is set to 2
you'll get the count
如果将 $ option code>设置为 1 code>,您将获得阳性鸦片的数量;如果将其设置为 2 code>,您将获得计数of negative opinions.
负面意见。 p>
getProjectDonors()
getProjectDonors() h4>
Returns the total number of donors which have already donated the pointed project.
返回已经捐赠了指定项目的捐赠者总数。 p>
getProjectNeedCount()
getProjectNeedCount() h4>
Returns the number of needs of the project that is pointed.
返回所指向项目的需求数量。 p>
getNeedID()
getNeedID() h4>
Returns the ID of the need that is pointed.
返回所指出的需求的ID。 p>
getNeedDate($option)
getNeedDate($ option) h4>
If $option = 0
this method will return the date of creation of the need.
如果 $ option = 0 code>,此方法将返回需要的创建日期。If $option = 1
it will return the date of the last update of the need.
如果 $ option = 1 code>,它将返回需求的最后更新日期。 p>getNeedTitle()
getNeedTitle() h4>
This method returns the title of the pointed need.
此方法返回所需需求的标题。 p>
getNeedDescription($maxnumber, $option)
getNeedDescription($ maxnumber,$ option) h4>
Returns the description of the need that is pointed.
返回所指出的需求的描述。
It acepts two arguments to limitade the description.
它接受两个论点来限制描述。
$option = 0
will limit count of letters that is specified in $maxnumber
, $option = 1
limits $maxnumber
$ option = 0 code>将限制在 $ maxnumber code>中指定的字母数, $ option = 1 code>限制 $ maxnumber code > words of the need.
>需要的话。 p>
getNeedProgress()
getNeedProgress() h4>
Returns the progress of the pointed need in per cent.
以百分比返回有针对性的需求的进度。 p>
getNeedAmount($option, $format)
getNeedAmount($ option,$ format) h4>
Returns money amounts of the need.
返回需要的金额。
If $option = 0
it returns the amount of money that is still needed to fulfil the need.
如果 $ option = 0 code>,它将返回满足需求所需的金额。 $option = 1
returns the monay that is already donated and $option = 2
is the complete amount that has been requested.
$ option = 1 code>返回已经捐赠的货币,而 $ option = 2 code>是已请求的完整金额。The argument $format
specified the display of the amount.
参数 $ format code>指定了金额的显示。 $format = 1
returns the amount in Euro formated as usual in Europe.
$ format = 1 code>返回欧洲惯用的欧元格式金额。If $format = 0
the method returns the complete amount unformated in Cents.
如果 $ format = 0 code>,该方法将返回未格式化的全部金额(以美分计)。 $format = 2
returns only the amount of Euros without cent amounts.
$ format = 2 code>仅返回欧元金额,不含分金额。 $format = 3
returns only the amount of Cents like if you would cut the full Euro amounts away.
$ format = 3 code>仅返回美分金额,就像您要减少全部欧元金额一样。 p>iscompletedNeed()
iscompletedNeed() h4>
This method returns true, if the need is already completed.
如果需要已经完成,此方法将返回true。 p>