本文整理汇总了PHP中Report::model方法的典型用法代码示例。如果您正苦于以下问题:PHP Report::model方法的具体用法?PHP Report::model怎么用?PHP Report::model使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Report
的用法示例。
在下文中一共展示了Report::model方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderReview
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);
}
示例2: actionDel
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);
}
}
示例3: actionIndex
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));
}
}
}
示例4: actionDelete
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'));
}
}
示例5: getReportName
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;
}
示例6: run
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));
}
示例7: fetchAllRecordByRep
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;
}
示例8: loadNew
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;
}
}
示例9: ReplenishingScore
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;
}
示例10: actionIndex
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;
}
示例11: afterAdd
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);
}
}
}
示例12: delete
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();
}
示例13: loadTrans
/**
* 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));
//.........这里部分代码省略.........
示例14: actionShow
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);
}
示例15: loadModel
/**
* 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;
}