本文整理汇总了PHP中ArticleModel::loadByParentId方法的典型用法代码示例。如果您正苦于以下问题:PHP ArticleModel::loadByParentId方法的具体用法?PHP ArticleModel::loadByParentId怎么用?PHP ArticleModel::loadByParentId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ArticleModel
的用法示例。
在下文中一共展示了ArticleModel::loadByParentId方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: SaveSubjectAction
public function SaveSubjectAction()
{
$request = Project::getRequest();
$article_model = new ArticleModel();
if (count($article_model->loadByParentId(0, array(ARTICLE_COMPETITION_STATUS::NEW_ARTICLE), Project::getUser()->getDbUser()->id)) < 5) {
$article_model->title = $request->title;
$article_model->articles_tree_id = $request->parent_id;
$article_model->user_id = Project::getUser()->getDbUser()->id;
$article_model->rate_status = ARTICLE_COMPETITION_STATUS::NEW_ARTICLE;
$article_model->creation_date = date("Y-m-d H:i:s");
$article_model->save();
}
Project::getResponse()->redirect($request->createUrl('Article', 'CompetitionCatalog'));
}
示例2: VerifyCompetitionAction
public function VerifyCompetitionAction()
{
$article_competition_model = new ArticleCompetitionModel();
$endCompetition = $article_competition_model->selectEndCompetition();
$article_model = new ArticleModel();
$article_vote_model = new ArticleVoteModel();
$winnerArticleId = 0;
if (count($endCompetition) > 0) {
foreach ($endCompetition as $comp) {
$articles = $article_model->loadByParentId($comp['article_tree_id']);
$max = 0;
foreach ($articles as $article) {
$r = $article_vote_model->rateByArticleId($article['id']);
if ($max < $r['rate']) {
$max = $r['rate'];
$winnerArticleId = $article['id'];
}
}
$article_model->load($winnerArticleId);
$article_model->rate_status = ARTICLE_RATE_STATUS::WINNER;
$article_model->save();
$article_competition_model->delete($comp['id']);
}
}
}