public function search() { $criteria = new CDbCriteria(); if ($this->comment_id) { if ($this->comment_id) { $criteria->addColumnCondition(array('t.id' => $this->comment_id)); } } else { if ($this->post_id) { $criteria->addColumnCondition(array('t.post_id' => $this->post_id)); } if ($this->user_id) { $criteria->addColumnCondition(array('t.user_id' => $this->user_id)); } if ($this->user_name) { $criteria->addColumnCondition(array('t.user_name' => $this->user_name)); } if ($this->keyword) { $criteria->addSearchCondition('t.content', $this->keyword); } if ($this->start_create_time || $this->end_create_time) { $criteria->addCondition(array('and', 't.create_time > :starttime', 't.create_time < :endtime')); $starttime = (int) $this->start_create_time ? strtotime($this->start_create_time) : 0; $endtime = (int) $this->end_create_time ? strtotime($this->end_create_time) : $_SERVER['REQUEST_TIME']; $params = array(':starttime' => $starttime, ':endtime' => $endtime); $criteria->params = array_merge($criteria->params, $params); } } $data = $criteria->condition ? AdminComment::fetchList($criteria) : null; return $data; }
$url = new moodle_url('/local/bookingrooms/bookinghistory.php'); $context = context_system::instance(); //context_system::instance(); $PAGE->set_context($context); $PAGE->set_url($url); $PAGE->set_pagelayout('standard'); if (!has_capability('local/bookingrooms:bockinginfo', $context)) { // TODO: Log unsuccessful attempts for security print_error(get_string('INVALID_ACCESS', 'booking_room')); } $action = optional_param('action', 'see', PARAM_TEXT); //action commentary implementation // allows the administrator to add a comment on a reservation if ($action == "comment") { $bookingid = required_param('booking', PARAM_INT); $commentform = new AdminComment(null, array('bookingid' => $reservaid)); if ($commentform->is_cancelled()) { $action = "see"; } else { if ($fromform = $commentform->get_data()) { $booking = $DB->get_record('bookingrooms_bookings', array('id' => bookingid)); $booking->comment_admin = $fromform->comment; $DB->update_record('bookingrooms_bookings', $bookings); $action = "see"; } } } // 'See' action implementation // Shows a table per page of all the room reservations that are active in decreasing order by date // with a link that allows you to add a comment or see, if exist, a comment if ($action == "see") {
/** * 批量设置推荐评论 * @param array $ids 评论ID数组 * @param string $callback jsonp回调函数,自动赋值 */ public function actionMultiHottest($callback) { $ids = (array) request()->getPost('ids'); $successIds = $failedIds = array(); foreach ($ids as $id) { $model = AdminComment::model()->findByPk($id); if ($model === null) { continue; } $model->state = COMMENT_STATE_ENABLED; $model->up_nums += param('upNumsOfCommentIsHot'); $result = $model->save(true, array('state', 'up_nums')); if ($result) { $successIds[] = $id; } else { $failedIds[] = $id; } } $data = array('success' => $successIds, 'failed' => $failedIds); echo $callback . '(' . CJSON::encode($data) . ')'; exit(0); }