本文整理匯總了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']);
}
}
}