protected function renderReview($time, $typeid) { $uid = $this->getUid(); $data = array("title" => $this->handleTitleByTypeid($typeid), "total" => Report::model()->countReportTotalByUid($uid, $time["start"], $time["end"], $typeid), "unreviews" => Report::model()->countUnReviewByUids($uid, $time["start"], $time["end"], $typeid)); $data["reviewrate"] = $this->calcReviewRate($data["unreviews"], $data["total"]); $this->render(self::REVIEW, $data); }
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); } }
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 actionDelete() { $id = $this->_get('id'); $user_id = $this->_get('user_id'); $obj = User::model()->findByPk($user_id); if ($id && Report::model()->deleteByPk($id)) { $mobile = $obj->mobile; if (isset($mobile) && $mobile) { // $type =='register','forget', $sms = new Sms(); $result = $sms->sendSMS($mobile, '您好,你的反馈我们已近收到,我们将尽快处理,Urtime谢谢你的宝贵意见', 'true'); $result = $sms->execResult($result); if ($result[1] == 0) { // echo '发送成功'; Yii::app()->user->setFlash('send', 1); $this->redirect(array('report/index')); } else { //echo "发送失败{$result[1]}"; Yii::app()->user->setFlash('send', 0); $this->redirect(array('report/index')); } } else { Yii::app()->user->setFlash('report', 0); $this->redirect(array('report/index')); } } else { Yii::app()->user->setFlash('report', 0); $this->redirect(array('report/index')); } }
public function getReportName($id) { if (empty($id)) { return NULL; } $dept_id = Report::model()->getScaler('name', '`id`=:t1', array(':t1' => $id)); return !empty($dept_id) ? $dept_id : NULL; }
public function run() { $id = Yii::app()->user->id; $criteria = new CDbCriteria(); $criteria->compare('id_user', $id); $criteria->compare('status', '0'); $criteria->order = 'id desc'; $list = Report::model()->findAll($criteria); $this->render('traodoi', array('list' => $list)); }
public function fetchAllRecordByRep($report) { $lastRep = Report::model()->fetchLastRepByRepid($report["repid"], $report["uid"], $report["typeid"]); $orgPlanList = array(); if (!empty($lastRep)) { $orgPlanList = $this->fetchRecordByRepidAndPlanflag($lastRep["repid"], 2); } $outSidePlanList = $this->fetchRecordByRepidAndPlanflag($report["repid"], 1); $nextPlanList = $this->fetchRecordByRepidAndPlanflag($report["repid"], 2); $record = array("orgPlanList" => $orgPlanList, "outSidePlanList" => $outSidePlanList, "nextPlanList" => $nextPlanList); return $record; }
public function loadNew() { $uid = Yii::app()->user->uid; $uidArr = User::model()->fetchSubUidByUid($uid); if (!empty($uidArr)) { $uidStr = implode(",", $uidArr); $sql = "SELECT COUNT(repid) AS number FROM {{report}} WHERE FIND_IN_SET( `uid`, '{$uidStr}' ) AND isreview = 0"; $record = Report::model()->getDbConnection()->createCommand($sql)->queryAll(); return intval($record[0]["number"]); } else { return 0; } }
protected function ReplenishingScore($list) { if (empty($list)) { return $list; } $dateScopeTmp = $this->getDateScope(); $dateScope = array_flip($dateScopeTmp); $repIds = ConvertUtil::getSubByKey($list, "repid"); $timeList = Report::model()->fetchAddTimeByRepId($repIds); $new = array(); foreach ($timeList as $time) { $dayTime = date("Y-m-d", $time["addtime"]); $new[$dayTime] = $time["repid"]; } $ret = $this->getLegalScore($dateScope, $new, $list); return $ret; }
public function actionIndex($isForced = false, $isDebug = false) { $console = Console::getInstance($isForced, $isDebug); $console->writeLine('Searching for tasks'); $report = Report::model()->findAll(); if (count($report) <= 0) { $console->writeLine('No tasks'); return; } $console->progressStart('Sending reports', count($report)); foreach ($report as $r) { $console->progressStep(); if ($r->isTimeToUpdate()) { try { $r->send(); } catch (Exception $ex) { $console->error($ex->getMessage()); } } } $console->progressEnd(); return; }
protected function afterAdd($data, $sourceInfo) { if (isset($data["type"])) { if ($data["type"] == "reply") { $this->setParseView("comment", self::REPLY_PARSE_VIEW, "parse"); } else { $this->setParseView("comment", self::COMMENT_PARSE_VIEW, "parse"); } } if (isset($data["stamp"])) { $repid = $sourceInfo["repid"]; $allStamp = Stamp::model()->fetchAll(array("select" => "id")); $stampArr = ConvertUtil::getSubByKey($allStamp, "id"); $stamp = in_array($data["stamp"], $stampArr) ? intval($data["stamp"]) : 0; if ($stamp == 0) { Report::model()->modify($repid, array("isreview" => 1)); } else { Report::model()->modify($repid, array("isreview" => 1, "stamp" => $stamp)); $uid = Report::model()->fetchUidByRepId($repid); ReportStats::model()->scoreReport($repid, $uid, $stamp); } } }
public function delete() { parent::delete(); yii::app()->onDeletePost(new Lazy8Event('Company', $this->id)); $this->dbConnection->createCommand("DELETE FROM Customer WHERE companyId={$this->id}")->execute(); $this->dbConnection->createCommand("DELETE FROM Period WHERE companyId={$this->id}")->execute(); $this->dbConnection->createCommand("DELETE FROM Account WHERE companyId={$this->id}")->execute(); $this->dbConnection->createCommand("DELETE FROM AccountType WHERE companyId={$this->id}")->execute(); //Trans::model()->deleteAll('companyId=:companyId', array(':companyId'=> $this->id)); $criteria = new CDbCriteria(); $criteria->limit = 100; $criteria->condition = 'companyId=:companyId'; $criteria->params = array(':companyId' => $this->id); do { $transList = Trans::model()->findAll($criteria); if ($transList != null) { foreach ($transList as $model) { $model->delete(); } } } while ($transList != null); /*$transList=Trans::model()->findAll('companyId=:companyId', array(':companyId'=> $this->id)); if($transList!=null){ foreach($transList as $model){ $model->delete(); } }*/ $this->dbConnection->createCommand("DELETE FROM Options WHERE companyId={$this->id}")->execute(); $this->dbConnection->createCommand("DELETE FROM ChangeLog WHERE companyId={$this->id}")->execute(); $reportList = Report::model()->findAll('companyId=:companyId', array(':companyId' => $this->id)); if ($reportList != null) { foreach ($reportList as $model) { $model->delete(); } } $this->dbConnection->createCommand("DELETE FROM CompanyUser WHERE companyId={$this->id}")->execute(); }
/** * 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 primary key value. Defaults to null, meaning using the 'id' GET variable */ private function loadTrans($restore = false) { $cLoc = CLocale::getInstance('en'); $numberFormatter = $cLoc->getNumberFormatter(); $numberFormat = User::getNumberFormat(); $dateformatter = new CDateFormatter($cLoc); $models = null; if ($restore) { $models = $this->getFromTempTrans(); } elseif (isset($_POST['AddRow'])) { $models = $this->getFromTempTrans(); $models[] = $this->getBlankTempTrans(count($models)); } elseif (isset($_POST['Update'])) { //same as restore $models = $this->getFromTempTrans(); } elseif (isset($_POST['Save'])) { if ($this->isValidTempTrans(false, $models)) { if (Yii::app()->user->getState('allowReEditingOfTransactions')) { $trans = Trans::model()->findbyPk($_GET['id']); $modelBeforeChange = $trans->toString(); //delete the old trans $trans->delete(); //must delete first to be able to use the transnums //copy temp trans to a new Trans/TransRow $tmpDate = date_create_from_format('d M Y', $models[0]->invDate); $tempdate = date_format($tmpDate, 'Y-m-d'); // $tempdate=User::parseDate($models[0]->invDate); $changedTrans = $this->copyTempTransToNewTrans($trans->periodNum, $trans->companyNum); if ($changedTrans == NULL) { $models[0]->addError('[0]amountcredit', Yii::t('lazy8', 'You are not allowed to process this transaction as it makes the balance of the selected account to be negative.')); } else { //clear temptrans Trans::model()->dbConnection->createCommand("DELETE FROM TempTrans WHERE userId=" . Yii::app()->user->id)->execute(); $models = array(); $models[] = $this->getBlankTempTrans(count($models), $tempdate); $models[] = $this->getBlankTempTrans(count($models), $tempdate); $models[] = $this->getBlankTempTrans(count($models), $tempdate); $models[] = $this->getBlankTempTrans(count($models), $tempdate); if (Yii::app()->user->getState('showPeriodTransactionNumber')) { $transnum = $trans->periodNum; } else { $transnum = $trans->companyNum; } $stringModel = $changedTrans->toString(); if ($modelBeforeChange != $stringModel) { ChangeLog::addLog('UPDATE', 'Trans', 'BEFORE<br />' . $modelBeforeChange . '<br />AFTER<br />' . $stringModel); } $this->redirect(array('create', 'saved' => $transnum)); } } else { $models[0]->addError('[0]amountcredit', Yii::t('lazy8', 'You are not allowed to change any transactions. See company options.')); } } else { //there are errors. Restore the old } } elseif (isset($_POST['Add'])) { if ($this->isValidTempTrans(true, $models)) { $comp = Company::model()->findbyPk(Yii::app()->user->getState('selectedCompanyId')); $per = Period::model()->findbyPk(Yii::app()->user->getState('selectedPeriodId')); $comp->lastAbsTransNum++; $per->lastPeriodTransNum++; //save the new transnums $comp->save(); $per->save(); //copy temp trans to a new Trans/TransRow $tmpDate = date_create_from_format('d M Y', $models[0]->invDate); $tempdate = date_format($tmpDate, 'Y-m-d'); // $tempdate=User::parseDate($models[0]->invDate); $addedTrans = $this->copyTempTransToNewTrans($per->lastPeriodTransNum, $comp->lastAbsTransNum, true); if ($addedTrans == NULL) { $models[0]->addError('[0]amountcredit', Yii::t('lazy8', 'You are not allowed to process this transaction as it makes the balance of the selected account to be negative.')); } else { ChangeLog::addLog('ADD', 'Trans', $addedTrans->toString()); //clear temptrans Trans::model()->dbConnection->createCommand("DELETE FROM TempTrans WHERE userId=" . Yii::app()->user->id)->execute(); $models = array(); $models[] = $this->getBlankTempTrans(count($models), $tempdate); $models[] = $this->getBlankTempTrans(count($models), $tempdate); $models[] = $this->getBlankTempTrans(count($models), $tempdate); $models[] = $this->getBlankTempTrans(count($models), $tempdate); if (Yii::app()->user->getState('showPeriodTransactionNumber')) { $transnum = $per->lastPeriodTransNum; } else { $transnum = $per->lastPeriodTransNum; } $this->redirect(array('create', 'added' => $transnum)); } } else { //there are errors. Restore the old } } elseif (isset($_POST['Clear'])) { Trans::model()->dbConnection->createCommand("DELETE FROM TempTrans WHERE userId=" . Yii::app()->user->id)->execute(); $models = array(); $models[] = $this->getBlankTempTrans(count($models)); $models[] = $this->getBlankTempTrans(count($models)); $models[] = $this->getBlankTempTrans(count($models)); $models[] = $this->getBlankTempTrans(count($models)); $this->redirect(array('create')); } elseif (isset($_POST['deleterow'])) { $models = $this->getFromTempTrans(); if (count($models) > 1) { $deletes = $_POST['deleterow']; //there is only one item in this array, but I don't know //any other way to get at it without doing this.. foreach ($deletes as $key => $transrow) { $models[$key]->delete(); unset($models[$key]); break; } //must remove the hole in the array $newmodels = array(); foreach ($models as $transrow) { $newmodels[] = $transrow; } $models = $newmodels; } } elseif (isset($_POST['balancerow'])) { $models = $this->getFromTempTrans(); if (count($models) > 1) { $balancerow = $_POST['balancerow']; //there is only one item in this array, but I don't know //any other way to get at it without doing this.. foreach ($balancerow as $key => $transrow) { $balancerow = $key; break; } //Need to get the current balance on all but the $balancerow row $credit = 0.0; $debit = 0.0; foreach ($models as $key => $model) { if ($key != $balancerow) { $amountdebit = $this->parseNumber($model->amountdebit, $cLoc); $amountcredit = $this->parseNumber($model->amountcredit, $cLoc); $debit += $amountdebit; $credit += $amountcredit; } } if ($debit > $credit) { $models[$balancerow]->amountcredit = round($debit - $credit, 6); $models[$balancerow]->amountdebit = ''; } else { $models[$balancerow]->amountdebit = round($credit - $debit, 6); $models[$balancerow]->amountcredit = ''; } $models[$balancerow]->save(); $models[$balancerow]->amountdebit = $this->formatNumber($models[$balancerow]->amountdebit, $numberFormatter, $numberFormat); $models[$balancerow]->amountcredit = $this->formatNumber($models[$balancerow]->amountcredit, $numberFormatter, $numberFormat); } } elseif (isset($_GET['id'])) { //copy from the Trans table to the TempTrans the selected transaction $models = array(); //first clear the TempTrans table. Trans::model()->dbConnection->createCommand("DELETE FROM TempTrans WHERE userId=" . Yii::app()->user->id)->execute(); $trans = Trans::model()->findbyPk($_GET['id']); // I dont want to just get the relation amounts because I want the amounts to be in the order of // account code and that is impossible with the amounts relation //$transRows=$trans->amounts; $command = Report::model()->dbConnection->createCommand("SELECT TransRow.* FROM TransRow JOIN Account on TransRow.accountId=Account.id WHERE TransRow.transId=" . $_GET['id'] . " ORDER BY Account.code"); $transRows = $command->query(); $rownum = 0; $cLoc = CLocale::getInstance('en'); $numberFormatter = $cLoc->getNumberFormatter(); $numberFormat = User::getNumberFormat(); $dateformatter = new CDateFormatter($cLoc); foreach ($transRows as $transrow) { $model = new TempTrans(); $model->rownum = $rownum; $rownum++; $model->invDate = $trans->invDate; $model->regDate = $trans->regDate; $model->periodNum = $trans->periodNum; $model->companyNum = $trans->companyNum; $model->notesheader = $trans->notes; $model->fileInfo = $trans->fileInfo; $model->reconciled = $trans->reconciled; $model->changedBy = $trans->changedBy; $model->dateChanged = $trans->dateChanged; $model->accountId = $transrow['accountId']; $model->customerId = $transrow['customerId']; $model->donorId = $transrow['donorId']; $model->notes = $transrow['notes']; $model->amountdebit = $transrow['amount'] > 0 ? $transrow['amount'] : ''; $model->amountcredit = $transrow['amount'] < 0 ? -$transrow['amount'] : ''; $model->userId = Yii::app()->user->id; $model->save(); $model->amountdebit = $this->formatNumber($model->amountdebit, $numberFormatter, $numberFormat); $model->amountcredit = $this->formatNumber($model->amountcredit, $numberFormatter, $numberFormat); $model->invDate = User::getDateFormatted($trans->invDate, $cLoc, $dateformatter); $model->regDate = User::getDateFormatted($trans->regDate, $cLoc, $dateformatter); $model->dateChanged = User::getDateFormatted($trans->dateChanged, $cLoc, $dateformatter); $models[] = $model; } if ($rownum == 0) { $models[] = $this->getBlankTempTrans(0, $trans->invDate); } } else { //same thing as Clear $models = $this->getFromTempTrans(); $tempdate = date('Y-m-d'); if ($models != null && count($models) > 0) { $tmpDate = date_create_from_format('d M Y', $models[0]->invDate); if ($tmpDate) { $tempdate = date_format($tmpDate, 'Y-m-d'); } else { $tempdate = date('Y-m-d'); } } //echo $tempdate;die(); Trans::model()->dbConnection->createCommand("DELETE FROM TempTrans WHERE userId=" . Yii::app()->user->id)->execute(); $models = array(); $models[] = $this->getBlankTempTrans(count($models), $tempdate); $models[] = $this->getBlankTempTrans(count($models), $tempdate); $models[] = $this->getBlankTempTrans(count($models), $tempdate); $models[] = $this->getBlankTempTrans(count($models), $tempdate); } return $models; }
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); }
/** * 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 Report the loaded model * @throws CHttpException */ public function loadModel($id) { $model = Report::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
<td style="width: 100px; padding: 5px 0px 5px 0px; "> <br /> <?php echo $form->labelEx($model, 'report_name'); ?> </td> <td style="margin-top: 20px; " colspan="3"> <br /> <?php //echo $form->ListBox($model,'skillid',array('id'=>'Select a Skill')); ?> <?php echo $form->dropDownList($model, 'report_name', CHtml::listData(Report::model()->findAll(array('order' => 'name')), 'id', 'name'), array('style' => 'width: 200px;')); ?> <?php echo $form->error($model, 'report_name'); ?> </td> <td> <?php echo $form->label($model, 'c_status'); ?> </td> </td> <td> <?php echo $form->dropDownList($model, 'c_status', array(1 => 'Subscription', 2 => "Un-Subscription"));
/** * Import a report * */ public static function importFile($filename, $showMessage = true, $removeExistingReport = false) { $localErrors = array(); $allAccounts = array(); $dom = new domDocument(); if (!$dom->load($filename)) { if ($showMessage) { throw new CException(Yii::t('lazy8', 'input file could not be xml parsed')); } else { throw new CException('input file could not be xml parsed'); } } $root = $dom->documentElement; if ($root->nodeName != "lazy8webportreport") { if ($showMessage) { $localErrors = array(array(Yii::t('lazy8', 'Upload failed. This is not a valid file.'), Yii::t('lazy8', 'Select a file and try again'))); } return $localErrors; } if ($root->getAttribute('version') > 1.0) { if ($showMessage) { $localErrors = array(array(Yii::t('lazy8', 'There maybe problems because this is a file version greater then this programs version'), Yii::t('lazy8', 'Select a file and try again'))); } } $nodeReports = $root->getElementsByTagName('report'); unset($root); unset($dom); foreach ($nodeReports as $nodeReport) { if ($removeExistingReport) { $deleteReports = Report::model()->findAll(array('condition' => 'name=\'' . $nodeReport->getAttribute('name') . '\'')); if ($deleteReports != null) { foreach ($deleteReports as $deleteReport) { $deleteReport->delete(); } } } $report = new Report(); $report->name = $nodeReport->getAttribute('name'); $report->desc = ReportController::getNodeText($nodeReport, "desc"); $report->selectSql = ReportController::getNodeText($nodeReport, "selectsql"); $report->sortOrder = ReportController::getNodeText($nodeReport, "sortOrder"); $report->cssColorFileName = ReportController::getNodeText($nodeReport, "csscolorfilename"); $report->cssBwFileName = ReportController::getNodeText($nodeReport, "cssbwfilename"); $nodeParams = $nodeReport->getElementsByTagName('parameter'); if (!$report->save()) { if ($showMessage) { $localErrors = $report->getErrors(); } return $localErrors; } foreach ($nodeParams as $nodeParam) { $reportParam = new ReportParameters(); $reportParam->reportId = $report->id; $reportParam->sortOrder = $nodeParam->getAttribute('sortorder'); $reportParam->name = $nodeParam->getAttribute('name'); $reportParam->alias = $nodeParam->getAttribute('alias'); $reportParam->dataType = $nodeParam->getAttribute('datatype'); $reportParam->isDefaultPhp = $nodeParam->getAttribute('isdefaultphp') == 'true' ? 1 : 0; $reportParam->isDate = $nodeParam->getAttribute('isdate') == 'true' ? 1 : 0; $reportParam->isDecimal = $nodeParam->getAttribute('isdecimal') == 'true' ? 1 : 0; $reportParam->desc = ReportController::getNodeText($nodeParam, "desc"); $reportParam->phpSecondaryInfo = ReportController::getNodeText($nodeParam, "phpsecondaryinfo"); $reportParam->defaultValue = ReportController::getNodeText($nodeParam, "defaultvalue"); if (!$reportParam->save()) { if ($showMessage) { $localErrors = $reportParam->getErrors(); } } } unset($nodeParams); $nodeGroups = $nodeReport->getElementsByTagName('group'); foreach ($nodeGroups as $nodeGroup) { $reportGroup = new ReportGroups(); $reportGroup->reportId = $report->id; $reportGroup->sortOrder = $nodeGroup->getAttribute('sortorder'); $reportGroup->breakingField = $nodeGroup->getAttribute('breakingfield'); $reportGroup->pageBreak = $nodeGroup->getAttribute('pagebreak') == 'true' ? 1 : 0; $reportGroup->showGrid = $nodeGroup->getAttribute('showgrid') == 'true' ? 1 : 0; $reportGroup->showHeader = $nodeGroup->getAttribute('showheader') == 'true' ? 1 : 0; $reportGroup->continueSumsOverGroup = $nodeGroup->getAttribute('continuesumsovergroup') == 'true' ? 1 : 0; if (!$reportGroup->save()) { if ($showMessage) { $localErrors = $reportGroup->getErrors(); } } $nodeGroupFields = $nodeGroup->getElementsByTagName('field'); foreach ($nodeGroupFields as $nodeGroupField) { $reportGroupField = new ReportGroupFields(); $reportGroupField->reportGroupId = $reportGroup->id; $reportGroupField->sortOrder = $nodeGroupField->getAttribute('sortorder'); $reportGroupField->fieldName = $nodeGroupField->getAttribute('fieldname'); $reportGroupField->fieldWidth = $nodeGroupField->getAttribute('fieldwidth'); $reportGroupField->row = $nodeGroupField->getAttribute('row'); $reportGroupField->isDate = $nodeGroupField->getAttribute('isdate') == 'true' ? 1 : 0; $reportGroupField->isDecimal = $nodeGroupField->getAttribute('isdecimal') == 'true' ? 1 : 0; $reportGroupField->fieldCalc = ReportController::getNodeText($nodeGroupField, "fieldcalc"); if (!$reportGroupField->save()) { if ($showMessage) { $localErrors = $reportGroupField->getErrors(); } } } unset($nodeGroupFields); } unset($nodeGroups); $nodeReportRows = $nodeReport->getElementsByTagName('rows'); foreach ($nodeReportRows as $nodeReportRow) { $reportRow = new ReportRows(); $reportRow->reportId = $report->id; $reportRow->sortOrder = $nodeReportRow->getAttribute('sortorder'); $reportRow->fieldName = $nodeReportRow->getAttribute('fieldname'); $reportRow->fieldWidth = $nodeReportRow->getAttribute('fieldwidth'); $reportRow->row = $nodeReportRow->getAttribute('row'); $reportRow->isSummed = $nodeReportRow->getAttribute('issummed') == 'true' ? 1 : 0; $reportRow->isAlignRight = $nodeReportRow->getAttribute('isalignright') == 'true' ? 1 : 0; $reportRow->isDate = $nodeReportRow->getAttribute('isdate') == 'true' ? 1 : 0; $reportRow->isDecimal = $nodeReportRow->getAttribute('isdecimal') == 'true' ? 1 : 0; $reportRow->fieldCalc = ReportController::getNodeText($nodeReportRow, "fieldcalc"); if (!$reportRow->save()) { if ($showMessage) { $localErrors = $reportRow->getErrors(); } } } } return $localErrors; }
protected function getReaderList() { if (Ibos::app()->request->isAjaxRequest) { $repid = EnvUtil::getRequest("repid"); $record = Report::model()->fetchByPk($repid); $readerUids = $record["readeruid"]; $htmlStr = "<table class=\"pop-table\">"; if (!empty($readerUids)) { $htmlStr .= "<div class=\"rp-reviews-avatar\">"; $readerUidArr = explode(",", trim($readerUids, ",")); $users = User::model()->fetchAllByUids($readerUidArr); foreach ($users as $user) { $htmlStr .= "<a href=\"" . Ibos::app()->createUrl("user/home/index", array("uid" => $user["uid"])) . "\">\r\n\t\t\t\t\t\t\t\t<img class=\"img-rounded\" src=\"" . $user["avatar_small"] . "\" title=\"" . $user["realname"] . "\" />\r\n\t\t\t\t\t\t\t</a>"; } } else { $htmlStr .= "<div><li align=\"middle\">" . Ibos::lang("Has not reader") . "</li>"; } $htmlStr .= "</div></table>"; echo $htmlStr; } }
private function getStampIcon() { if (Ibos::app()->request->isAjaxRequest) { $repid = $_GET["repid"]; $report = Report::model()->fetchByPk($repid); if ($report["stamp"] != 0) { $icon = Stamp::model()->fetchIconById($report["stamp"]); $this->ajaxReturn(array("isSuccess" => true, "icon" => $icon)); } } }
public function actionReportsDelete($reportId) { Report::model()->deleteByPk($reportId); $this->redirect(Yii::app()->createUrl('site/reports')); }