Exemplo n.º 1
0
 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));
         }
     }
 }
Exemplo n.º 2
0
 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);
     }
 }
Exemplo n.º 3
0
?>
</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>        
Exemplo n.º 4
0
 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);
 }
Exemplo n.º 5
0
 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);
 }
Exemplo n.º 6
0
 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));
 }
Exemplo n.º 7
0
 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;
 }
Exemplo n.º 9
0
    
    .panel {background-color: #fff;  border: 1px solid transparent;}
    
</style>
<?php 
$form = $this->beginWidget('CActiveForm', array('action' => Yii::app()->createUrl($this->route), 'method' => 'post', 'id' => 'dashboarForm'));
?>


<table class="dashItem">
    <td style="vertical-align:top; width:225px;">
        <div id="filterRegion" style="overflow:auto; padding-right:30px">
			<div>
				 <?php 
echo $form->labelEx($filter, 'reportTypeId');
echo CHtml::activeDropDownList($filter, 'reportTypeId', ReportType::getReportTypes());
?>
			</div>
			<div>
				<?php 
echo $form->labelEx($filter, 'dim2ID');
echo CHtml::activeDropDownList($filter, 'dim2ID', array(0 => " "));
?>
 
				
			</div>
			<div>
			    <?php 
echo $form->labelEx($filter, 'reportFormatId');
echo CHtml::activeDropDownList($filter, 'reportFormatId', ReportFormat::getReportFormats());
?>
Exemplo n.º 10
0
 public function _new()
 {
     //		if (!$this->loadData())
     //		{
     //			$this->dataError();
     //			sendBack();
     //		}
     parent::_new();
     // an array of legacy search fields
     $search_fields = array();
     $flash = Flash::Instance();
     // get the report model, lets not envoke it again... that's not cool
     $report = $this->_uses[$this->modeltype];
     if (!empty($this->_data['tablename'])) {
         $report_options[$this->_data['tablename']] = $this->_data['tablename'];
     } else {
         $report_options = $report::getTables();
     }
     if (!$report->isLoaded()) {
         $report->tablename = current($report_options);
         $this->view->set('update', false);
     } else {
         $this->view->set('update', true);
     }
     $this->view->set('report_options', $report_options);
     // get the fields for the tablename and sort them
     $available_fields = $this->getColumns($report->tablename);
     ksort($available_fields);
     // unserialise the options from the db
     $options = unserialize($report->options);
     if ($options !== FALSE) {
         // overlay the defaults so we've got a full set of options
         $options = $this->expand_options($options, $report->tablename);
         // sort options by position
         $options = $this->sort_options($options);
         // loop through used fields and remove them from the available fields array
         foreach ($options as $field => $field_options) {
             // remove the field from the available fields array
             unset($available_fields[$field]);
             // we need to check against legacy search options
             if ($field_options['field_type'] === 'search') {
                 // build an array of broken search options
                 $search_fields[] = $field;
                 // update the legacy options
                 $options[$field] = array_merge($this->default_options, $options[$field]);
                 // ATTN: boolean values didn't work here... but that's what the defaults are set as
                 // set other specific search settings
                 $options[$field]['field_type'] = 'normal';
                 $options[$field]['normal_enable_search'] = 'true';
                 $options[$field]['normal_display_field'] = 'false';
                 // if a default value exists
                 if (isset($options[$field]['default_value'])) {
                     // set it to the new option name
                     $options[$field]['search_default_value'] = $options[$field]['default_value'];
                     // unset the old version
                     unset($options[$field]['default_value']);
                 }
             }
         }
         unset($available_fields['filter']);
     } else {
         $options = array();
     }
     if (!empty($search_fields)) {
         $flash->addError('Legacy search fields found, click save <strong>immediately</strong> to update');
     }
     $description = $report->description;
     // set smarty vars
     $this->view->set('description', $description);
     $this->view->set('available_fields', $available_fields);
     $this->view->set('selected_tablename', $report->tablename);
     $this->view->set('options', $options);
     $this->view->set('report', $report);
     //Set report defintion list
     $report_type_id = ReportType::getReportTypeID('Reports');
     $definition_list = ReportDefinition::getReportsByType($report_type_id);
     array_unshift($definition_list, "Default");
     $this->view->set('report_definitions', $definition_list);
     //Set currently selected report definition
     $selected_def = ReportDefinition::getDefinitionByID($report->report_definition);
     if ($selected_def->_data['name'] == 'PrintCollection') {
         $this->view->set('selected_reportdef', 'Default');
     } else {
         $this->view->set('selected_reportdef', $selected_def->_data['name']);
     }
 }
 public static function getReportTypes()
 {
     return array(ReportType::None => " ", ReportType::TicketsCreated => ReportType::getReportTypeDescription(ReportType::TicketsCreated), ReportType::TicketsClosed => ReportType::getReportTypeDescription(ReportType::TicketsClosed), ReportType::TicketsAVGDuration => ReportType::getReportTypeDescription(ReportType::TicketsAVGDuration), ReportType::TicketsAVGTimeMentorAnswer => ReportType::getReportTypeDescription(ReportType::TicketsAVGTimeMentorAnswer), ReportType::TicketsCurrentlyOpen => ReportType::getReportTypeDescription(ReportType::TicketsCurrentlyOpen), ReportType::TicketsUnanswered => ReportType::getReportTypeDescription(ReportType::TicketsUnanswered));
 }
Exemplo n.º 12
0
 public function reportOptions()
 {
     $report = ReportDefinition::getDefinition('PrintCollection');
     // set options
     return array('type' => array('pdf' => '', 'xml' => '', 'csv' => ''), 'report_type' => ReportType::getReportTypes(), 'default_report_type' => $report->report_type_id, 'report_name' => $this->getReportsByType($report->report_type_id), 'output' => array('print' => '', 'save' => '', 'email' => '', 'view' => ''), 'report' => $report->name, 'filename' => $this->generate_collection_name(TRUE));
 }
Exemplo n.º 13
0
<?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}&nbsp;&nbsp;{delete}', 'headerHtmlOptions' => array('style' => 'width:40px;'), 'htmlOptions' => array('style' => 'width:40px; text-align:center')))));
Exemplo n.º 14
0
 /**
  * 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'));
     }
 }