public function actionIndex() { if (isset($_GET['type_id'])) { $criteria = new CDbCriteria(); $criteria->select = '*'; $criteria->condition = 'status = 1 AND report_type_id =' . $_GET['type_id']; $criteria->order = 'sort_order'; $total = Report::model()->count($criteria); $pages = new CPagination($total); $pages->setPageSize(20); $pages->applyLimit($criteria); $model = Report::model()->findAll($criteria); $type = ReportType::model()->findByPK($_GET['type_id']); $this->render('index', array('model' => $model, 'type' => $type, 'pages' => $pages)); } else { if (isset($_GET['id'])) { $model = Report::model()->findByPk($_GET['id']); $this->render('detail', array('model' => $model)); } else { $criteria = new CDbCriteria(); $criteria->select = '*'; $criteria->condition = 'status = 1'; $criteria->order = 'sort_order'; $total = Report::model()->count($criteria); $pages = new CPagination($total); $pages->setPageSize(20); $pages->applyLimit($criteria); $model = Report::model()->findAll($criteria); $this->render('index', array('model' => $model, 'pages' => $pages)); } } }
public function actionDel() { if (Ibos::app()->request->isAjaxRequest) { $typeid = intval(EnvUtil::getRequest("typeid")); if (empty($typeid)) { $this->ajaxReturn(array("isSuccess" => false, "msg" => Ibos::lang("Parameters error", "error"))); } $removeSuccess = ReportType::model()->remove($typeid); if ($removeSuccess) { $reports = Report::model()->fetchRepidAndAidByTypeids($typeid); if (!empty($reports)) { if ($reports["aids"]) { AttachUtil::delAttach($reports["aids"]); } ReportRecord::model()->deleteAll("repid IN('{$reports["repids"]}')"); Report::model()->deleteAll("repid IN('{$reports["repids"]}')"); } $return["isSuccess"] = true; $return["msg"] = Ibos::lang("Del succeed", "message"); } else { $return["isSuccess"] = false; $return["msg"] = Ibos::lang("Del failed", "message"); } $this->ajaxReturn($return); } }
?> </a></li> </ul> </article>--> <!-- <article class="fcol-3"> <h3 class="color-1"><?php echo $report; ?> </h3> <ul class="list-3"> <?php $criteria = new CDbCriteria(); $criteria->condition = 'status=:status'; $criteria->params = array(':status' => 1); $criteria->order = 'sort_order'; $report = ReportType::model()->findAll($criteria); $count = -1; foreach ($report as $key => $type) { if ($lang == 'en' || $lang == 'EN' || $lang == 'En') { $name = $type->name_en; } else { $name = $type->name_th; } ?> <li><a href="<?php echo Yii::app()->createUrl('report', array('type_id' => $type->report_type_id)); ?> "><?php echo $name; ?> </a></li>
public function actionShow() { $repid = EnvUtil::getRequest("repid"); $uid = Ibos::app()->user->uid; if (empty($repid)) { $this->error(Ibos::lang("Parameters error", "error"), $this->createUrl("default/index")); } $report = Report::model()->fetchByPk($repid); if (empty($report)) { $this->error(Ibos::lang("File does not exists", "error"), $this->createUrl("default/index")); } if ($report["uid"] != $uid) { $this->error(Ibos::lang("Request tainting", "error"), $this->createUrl("default/index")); } $record = ReportRecord::model()->fetchAllRecordByRep($report); $attachs = $readers = array(); if (!empty($report["attachmentid"])) { $attachments = AttachUtil::getAttach($report["attachmentid"], true, true, false, false, true); $attachs = array_values($attachments); } if (!empty($report["readeruid"])) { $readerArr = explode(",", $report["readeruid"]); $readers = User::model()->fetchAllByPk($readerArr); } $stampUrl = ""; if (!empty($report["stamp"])) { $stampUrl = Stamp::model()->fetchStampById($report["stamp"]); } $params = array("report" => $report, "preAndNextRep" => Report::model()->fetchPreAndNextRep($report), "orgPlanList" => $record["orgPlanList"], "outSidePlanList" => $record["outSidePlanList"], "nextPlanList" => $record["nextPlanList"], "attachs" => $attachs, "readers" => $readers, "stampUrl" => $stampUrl, "realname" => User::model()->fetchRealnameByUid($report["uid"]), "departmentName" => Department::model()->fetchDeptNameByUid($report["uid"]), "isInstallCalendar" => ModuleUtil::getIsEnabled("calendar")); if (!empty($params["nextPlanList"])) { $reportType = ReportType::model()->fetchByPk($report["typeid"]); $firstPlan = $params["nextPlanList"][0]; $params["nextSubject"] = ICReport::handleShowSubject($reportType, $firstPlan["begindate"], $firstPlan["enddate"], 1); } $this->setPageTitle(Ibos::lang("Show report")); $this->setPageState("breadCrumbs", array(array("name" => Ibos::lang("Personal Office")), array("name" => Ibos::lang("Work report"), "url" => $this->createUrl("default/index")), array("name" => Ibos::lang("Show report")))); $this->render("show", $params); }
public function run() { $module = $this->getController()->getModule()->getId(); $data = array("type" => $this->getType(), "uid" => implode(",", $this->getUid()), "lang" => Ibos::getLangSource("report.default"), "reportTypes" => ReportType::model()->fetchSysType()); $this->render(self::VIEW, $data); }
public function actionSitemap() { $condition = new CDbCriteria(); $condition->condition = "news_type_id =2 AND status = 1"; $condition->order = "create_date desc,news_id desc"; $condition->offset = 0; $condition->limit = 6; $student_news = News::model()->findAll($condition); $news_criteria = new CDbCriteria(); $news_criteria->condition = "news_type_id =1 AND status = 1"; $news_criteria->order = "create_date desc,news_id desc"; $news_criteria->offset = 0; $news_criteria->limit = 3; $news = News::model()->findAll($news_criteria); $job_criteria = new CDbCriteria(); $job_criteria->condition = "news_type_id =3 AND status = 1"; $job_criteria->order = "create_date desc,news_id desc"; $job_criteria->offset = 0; $job_criteria->limit = 6; $job_news = News::model()->findAll($job_criteria); $pr_criteria = new CDbCriteria(); $pr_criteria->condition = "news_type_id =5 AND status = 1"; $pr_criteria->order = "create_date desc,news_id desc"; $pr_criteria->offset = 0; $pr_criteria->limit = 3; $newsInSide = News::model()->findAll($pr_criteria); $link_criteria = new CDbCriteria(); $link_criteria->condition = "status = 1"; $link_criteria->order = "sort_order"; $links = Link::model()->findAll($link_criteria); $criteria = new CDbCriteria(); $criteria->condition = "status = 1 AND doc_group ='download'"; $criteria->order = "sort_order"; $doc = DocumentType::model()->findAll($criteria); $criteria = new CDbCriteria(); $criteria->condition = "status = 1"; $criteria->order = "sort_order"; $org = Organization::model()->findAll($criteria); $criteria = new CDbCriteria(); $criteria->condition = "status = 1"; $criteria->order = "sort_order"; $report = ReportType::model()->findAll($criteria); $vdo_criteria = new CDbCriteria(); $vdo_criteria->condition = "page_id = 3 AND status = 1"; $vdo = Page::model()->find($vdo_criteria); // echo "<br> ===> "; // echo "<pre>"; // print_r($vdo); // echo "</pre>"; // exit; $this->render('sitemap', array('news' => $news, 'newsInSide' => $newsInSide, 'job' => $job_news, 'student_news' => $student_news, 'doc' => $doc, 'org' => $org, 'links' => $links, 'report' => $report, 'vdo' => $vdo)); }
public function actionShow() { $repid = intval(EnvUtil::getRequest("repid")); $uid = Ibos::app()->user->uid; if (empty($repid)) { $this->error(Ibos::lang("Parameters error", "error"), $this->createUrl("review/index")); } $report = Report::model()->fetchByPk($repid); if (empty($report)) { $this->error(Ibos::lang("No data found", "error"), $this->createUrl("review/index")); } if ($report["uid"] == $uid) { $this->redirect($this->createUrl("default/show", array("repid" => $repid))); } $permission = ICReport::checkPermission($report, $uid); if (!$permission) { $this->error(Ibos::lang("You do not have permission to view the report"), $this->createUrl("review/index")); } $record = ReportRecord::model()->fetchAllRecordByRep($report); $attachs = $readers = array(); if (!empty($report["attachmentid"])) { $attachments = AttachUtil::getAttach($report["attachmentid"], true, true, false, false, true); $attachs = array_values($attachments); } if (!empty($report["readeruid"])) { $readerArr = explode(",", $report["readeruid"]); $readers = User::model()->fetchAllByPk($readerArr); } $stampUrl = ""; if (!empty($report["stamp"])) { $stampUrl = Stamp::model()->fetchStampById($report["stamp"]); } $params = array("report" => $report, "preAndNextRep" => Report::model()->fetchPreAndNextRep($report), "orgPlanList" => $record["orgPlanList"], "outSidePlanList" => $record["outSidePlanList"], "nextPlanList" => $record["nextPlanList"], "attachs" => $attachs, "readers" => $readers, "stampUrl" => $stampUrl, "realname" => User::model()->fetchRealnameByUid($report["uid"]), "departmentName" => Department::model()->fetchDeptNameByUid($report["uid"])); if (!empty($params["nextPlanList"])) { $reportType = ReportType::model()->fetchByPk($report["typeid"]); $firstPlan = $params["nextPlanList"][0]; $params["nextSubject"] = ICReport::handleShowSubject($reportType, $firstPlan["begindate"], $firstPlan["enddate"], 1); } $dashboardConfig = $this->getReportConfig(); if ($dashboardConfig["stampenable"] && $dashboardConfig["autoreview"]) { $this->changeIsreview($repid); } $this->setPageTitle(Ibos::lang("Show subordinate report")); $this->setPageState("breadCrumbs", array(array("name" => Ibos::lang("Personal Office")), array("name" => Ibos::lang("Work report"), "url" => $this->createUrl("default/index")), array("name" => Ibos::lang("Show subordinate report")))); $this->render("show", $params); }
/** * 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 ReportType the loaded model * @throws CHttpException */ public function loadModel($id) { $model = ReportType::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
<?php /* @var $this ReportController */ /* @var $model Report */ $this->breadcrumbs = array('การประกันคุณภาพการศึกษา' => array('index'), 'จัดการข้อมูล'); $this->menu = array(array('label' => 'เพิ่มข้อมูล', 'url' => array('create')), array('label' => 'เรียงลำดับข้อมูล', 'url' => array('order'))); Yii::app()->clientScript->registerScript('search', "\n\$('.search-button').click(function(){\n\t\$('.search-form').toggle();\n\treturn false;\n});\n\$('.search-form form').submit(function(){\n\t\$('#report-grid').yiiGridView('update', {\n\t\tdata: \$(this).serialize()\n\t});\n\treturn false;\n});\n"); ?> <h1>จัดการข้อมูลรายงาน</h1> <?php echo CHtml::link('ค้นหาแบบละเอียด', '#', array('class' => 'search-button')); ?> <div class="search-form" style="display:none"> <?php $this->renderPartial('_search', array('model' => $model, 'report_type_list' => $report_type_list)); ?> </div><!-- search-form --> <?php $this->widget('zii.widgets.grid.CGridView', array('id' => 'report-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'columns' => array(array('name' => 'report_id', 'htmlOptions' => array('style' => 'text-align: center;width: 30px;')), array('name' => 'name_th', 'header' => 'ชื่อรายงาน'), array('name' => 'report_type_id', 'header' => 'ประเภทรายงาน', 'value' => '$data->reportType->name_th', 'htmlOptions' => array('style' => 'text-align: left;width: 150px;'), 'filter' => CHtml::listData(ReportType::model()->findAll('status=1'), 'report_type_id', 'name_th')), array('name' => 'status', 'value' => '($data->status)? \'แสดง\' : \'ไม่แสดง\'', 'htmlOptions' => array('style' => 'text-align: center;width: 60px;'), 'filter' => array('1' => 'แสดง', '0' => 'ไม่แสดง')), array('class' => 'CButtonColumn', 'template' => '{update} {delete}', 'headerHtmlOptions' => array('style' => 'width:40px;'), 'htmlOptions' => array('style' => 'width:40px; text-align:center')))));
/** * Manages all models. */ public function actionAdmin() { if ($this->menu_use[7]) { $report_type_list = array(); $criteria = new CDbCriteria(); $criteria->condition = 'status=:status'; $criteria->params = array(':status' => 1); $criteria->order = 'name_th'; $report_type = ReportType::model()->findAll($criteria); foreach ($report_type as $type) { $report_type_list[$type->report_type_id] = $type->name_th; } $model = new Report('search'); $model->unsetAttributes(); // clear any default values if (isset($_GET['Report'])) { $model->attributes = $_GET['Report']; } $this->render('admin', array('model' => $model, 'report_type_list' => $report_type_list)); } else { $this->redirect(array('site/index')); } }