コード例 #1
0
ファイル: wTop_tacgia.php プロジェクト: hongha/web
	public function run()
	{
		/*Top nxb*/
		$criteria = new CDbCriteria ();
		$criteria->limit = 3;
		$criteria->order = 'frequency desc';
		$list = Tacgia::model()->findAll($criteria);		
		$this->render('top_tacgia', array(
			'list'=>$list,			
		));
	}
コード例 #2
0
 public function actionSuggestTags()
 {
     if (isset($_GET['q']) && ($keyword = trim($_GET['q'])) !== '') {
         $tags = Tacgia::model()->suggestTags($keyword);
         if ($tags !== array()) {
             echo implode("\n", $tags);
         }
     }
 }
コード例 #3
0
 protected function afterSave()
 {
     parent::afterSave();
     Tacgia::model()->updateFrequency($this->_oldTags, $this->author);
 }
コード例 #4
0
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer $id the ID of the model to be loaded
  * @return Tacgia the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = Tacgia::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
コード例 #5
0
 public function addTags($tags)
 {
     $criteria = new CDbCriteria();
     $criteria->addInCondition('name', $tags);
     $this->updateCounters(array('frequency' => 1), $criteria);
     foreach ($tags as $name) {
         if (!$this->exists('name=:name', array(':name' => $name))) {
             $tag = new Tacgia();
             $tag->name = $name;
             $tag->profile = 'chua co';
             $tag->frequency = 1;
             $tag->save();
         }
     }
 }