public function actionIndex() { $uid = Ibos::app()->user->uid; if (EnvUtil::getRequest("param") == "search") { $this->search(); } $this->_condition = AssignmentUtil::joinCondition($this->_condition, "(`status` = 2 OR `status` = 3) AND (`designeeuid` = {$uid} OR `chargeuid` = {$uid} OR FIND_IN_SET({$uid}, `participantuid`))"); $data = Assignment::model()->fetchAllAndPage($this->_condition); $data["datas"] = AssignmentUtil::handleListData($data["datas"]); $data["datas"] = $this->groupByFinishtime($data["datas"]); $this->setPageTitle(Ibos::lang("Assignment")); $this->setPageState("breadCrumbs", array(array("name" => Ibos::lang("Assignment"), "url" => $this->createUrl("unfinished/index")), array("name" => Ibos::lang("Unfinished list")))); $this->render("list", $data); }
/** * Returns options for the related model multiple select * @param string $model * @return string options for relate model multiple select * @since 1.0 */ public function related_opts($model) { $relatedPKs = Assignment::extractPkValue($model->assignments); $options = ''; $categories = GxHtml::listDataEx(Assignment::model()->findAllAttributes(null, true)); foreach ($categories as $value => $text) { if (!$model->isNewRecord) { in_array($value, $relatedPKs) ? $options .= '<option selected="selected" value=' . $value . '>' . $text . '</option>\\n' : ($options .= '<option value=' . $value . '>' . $text . '</option>\\n'); } else { $options .= '<option value=' . $value . '>' . $text . '</option>\\n'; } } echo $options; }
private function handleCancel($assignmentId) { Assignment::model()->modify($assignmentId, array("status" => 4)); AssignmentApply::model()->deleteAll("assignmentid = {$assignmentId}"); $this->addStepComment($assignmentId, Ibos::lang("Cancel the assignment")); AssignmentLog::model()->addLog($assignmentId, "cancel", Ibos::lang("Cancel the assignment")); return true; }
class="client-val-form button"> </div> <!--The tree will be rendered in this div--> <div id="<?php echo Assignment::ADMIN_TREE_CONTAINER_ID; ?> " class="admintree" > </div> <div id='category_info'> <div id='pic'></div> <div id='title'> <h3><?php echo Assignment::model()->findByPK($category_id)->name; ?> </h3> </div> </div> <div id="listview-wrapper" class="left"> <?php $this->widget('zii.widgets.CListView', array('dataProvider' => $prod_dataProvider, 'itemView' => 'application.views.student._frontend_view', 'id' => 'student-listview', 'afterAjaxUpdate' => 'js:function(id,data){$.bind_crud()}', 'pagerCssClass' => 'pager_wrapper clearfix')); ?> </div> </div> <!-- Content-->
/** * 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 the ID of the model to be loaded */ public function loadModel($id) { $model = Assignment::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
public function loadNew() { $uid = Ibos::app()->user->uid; return Assignment::model()->getUnfinishCountByUid($uid); }
public function loadStudentsFromAssignment($id) { $this->assignment = Assignment::model()->findByPk($id); if ($this->assignment === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $this->assignment->getStudents(); }
echo $form->textField($model, 'name', array('maxlength' => 50)); ?> <?php echo $form->error($model, 'name'); ?> </div><!-- row --> <div class="row"> <?php echo $form->labelEx($model, 'description'); ?> <?php echo $form->textField($model, 'description', array('maxlength' => 200)); ?> <?php echo $form->error($model, 'description'); ?> </div><!-- row --> <label><?php echo GxHtml::encode($model->getRelationLabel('assignments')); ?> </label> <?php echo $form->checkBoxList($model, 'assignments', GxHtml::encodeEx(GxHtml::listDataEx(Assignment::model()->findAllAttributes(null, true)), false, true)); ?> <?php echo GxHtml::submitButton(Yii::t('app', 'Save')); $this->endWidget(); ?> </div><!-- form -->
/** * 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 Assignment the loaded model * @throws CHttpException */ public function loadModel($id) { $model = Assignment::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } Yii::app()->getUser()->setState('assignment', $model->id); Yii::app()->getUser()->setState('assignment-title', $model->title); return $model; }
protected function addStepComment($assignmentId, $content) { $assignment = Assignment::model()->fetchByPk($assignmentId); $data = array("module" => $this->getModule()->getId(), "table" => "assignment", "rowid" => $assignmentId, "moduleuid" => $assignment["designeeuid"], "uid" => Ibos::app()->user->uid, "content" => $content, "touid" => 0, "ctime" => TIMESTAMP); Comment::model()->add($data); Assignment::model()->updateCounters(array("commentcount" => 1), "`assignmentid` = {$assignmentId}"); }
public function actionShow() { $op = EnvUtil::getRequest("op"); if (empty($op)) { $assignmentId = intval(EnvUtil::getRequest("assignmentId")); $checkRes = $this->checkAvailableById($assignmentId); if (!$checkRes["isSuccess"]) { $this->error($checkRes["msg"], $this->createUrl("unfinished/index")); } $assignment = Assignment::model()->fetchByPk($assignmentId); if (!$this->checkShowPermissions($assignment) && !$this->checkIsSup($assignment)) { $this->error(Ibos::lang("You donot have permission to view"), $this->createUrl("unfinished/index")); } if (!empty($assignment["attachmentid"])) { $assignment["attach"] = AttachUtil::getAttach($assignment["attachmentid"]); } if (!empty($assignment["stamp"])) { $assignment["stampUrl"] = Stamp::model()->fetchStampById($assignment["stamp"]); } $apply = AssignmentApply::model()->fetchByAttributes(array("assignmentid" => $assignmentId)); $applyData = $this->handleApplyData($assignmentId, $apply); $isDesigneeuid = $this->checkIsDesigneeuid($assignment["designeeuid"]); $isChargeuid = $this->checkIsChargeuid($assignment["chargeuid"]); if ($isChargeuid && $assignment["status"] == 0) { Assignment::model()->modify($assignmentId, array("status" => 1)); $assignment["status"] = 1; } AssignmentLog::model()->addLog($assignmentId, "view", Ibos::lang("View the assignment")); $participantuidArr = explode(",", $assignment["participantuid"]); $participantuid = array_filter($participantuidArr, create_function("\$v", "return !empty(\$v);")); $reminds = AssignmentRemind::model()->fetchAllByUid(Ibos::app()->user->uid); $assignment["remindtime"] = in_array($assignmentId, array_keys($reminds)) ? $reminds[$assignmentId] : 0; $params = array("isDesigneeuid" => $isDesigneeuid, "isChargeuid" => $isChargeuid, "designee" => User::model()->fetchByUid($assignment["designeeuid"]), "charge" => User::model()->fetchByUid($assignment["chargeuid"]), "participantCount" => count($participantuid), "participant" => User::model()->fetchRealnamesByUids($participantuid, "、"), "assignment" => AssignmentUtil::handleShowData($assignment), "applyData" => CJSON::encode($applyData)); $this->setPageTitle(Ibos::lang("See the assignment details")); $this->setPageState("breadCrumbs", array(array("name" => Ibos::lang("Assignment"), "url" => $this->createUrl("unfinished/index")), array("name" => Ibos::lang("Assignment details")))); $this->render("show", $params); } else { $this->{$op}(); } }