예제 #1
0
 /**
  * searchTopicsMessages-funktio hakee hakusanan perusteella topics-mallista ja messages-mallista löytyykö niistä hakusanaa vastaavia keskusteluja ja viestejä
  */
 public static function searchTopicsMessages()
 {
     $searchword = $_POST['searchword'];
     $topics = Topic::search($searchword);
     $messages = Message::search($searchword);
     $users = User::all();
     $categories = Category::all();
     $user = self::get_user_logged_in();
     View::make('hallinto.html', array('searchword' => $searchword, 'user' => $user, 'users' => $users, 'topics' => $topics, 'messages' => $messages, 'categories' => $categories));
 }
예제 #2
0
 /**
  * 全部话题
  */
 public function actionALltopic()
 {
     $criteria = new CDbCriteria();
     $criteria->addCondition("parent_id=0");
     $topicModel = Topic::model()->findAll($criteria);
     $criteria = new CDbCriteria();
     $criteria->order = "create_time asc";
     $model = Topic::model()->find($criteria);
     $newModel = new Topic();
     $id = isset($_GET["id"]) ? $_GET["id"] : ($model ? $model->id : 0);
     $topicDataProvider = $newModel->search($id);
     $hotDataProvider = $newModel->search($id);
     $this->render('alltopic', array('topicModel' => $topicModel, "model" => $model, 'topicDataProvider' => $topicDataProvider, 'hotDataProvider' => $hotDataProvider));
 }