Ejemplo n.º 1
0
 /**
  *	Description...
  *
  *	@return void
  **/
 public function total()
 {
     if (!$this->_total) {
         $this->_total = $this->_mapper->storage('total')->loadObjectById($this->total_id);
     }
     return $this->_total;
 }
Ejemplo n.º 2
0
 public function _updateAccessInfo()
 {
     if (!$this->_existsInDb()) {
         return;
     }
     M('Db')->exec("UPDATE " . $this->_mapper->table() . " SET access_id = ?, access_inherit = ? WHERE id = ?", $this->_accessId(), $this->_accessInherit(), $this->id());
     $this->_mapper->storage()->cacheClear($this);
 }
Ejemplo n.º 3
0
 /**
  *	@see RM_Permissionable_iPermissionable::_updateAccessInfo
  */
 public function _updateAccessInfo()
 {
     if (!$this->_existsInDb()) {
         return;
     }
     $this->_mapper->updateAccessInfo($this);
 }
Ejemplo n.º 4
0
 /**
  *	Description...
  *
  *	@return void
  **/
 public function sweeper()
 {
     $begin = microtime(true);
     $images = $reports = 0;
     $this->_mapper->_usePermissions(FALSE);
     M('ObjectFs')->srvUsePermissions(0);
     foreach ($this->_mapper->storage('total')->getObjectList() as $object) {
         $result = $object->sweeper();
         if ($result > 0) {
             $images += $result;
         } else {
             $reports -= $result;
         }
     }
     $end = microtime(true);
     M('Trace')->trace('total_report_sweeper', "Report sweeper execution time: " . round($end - $begin, 2) . " sec. Deleted: reports - {$reports}, images - {$images}");
     // так как sweeper запускается ночью, то отправим емейл с уведомлением (в логах трудно отследить, запускался sweeper ночью или нет).
     M("MailSend")->sendAdminMail(array("subject" => "Report sweeper", "body" => "Deleted: reports - {$reports}, images - {$images}\n" . 'execution time: ' . round($end - $begin, 2) . ' sec')) or die("Cannot send mail!");
 }
Ejemplo n.º 5
0
 protected function _collectRows(array $showParams = NULL)
 {
     $result = array();
     foreach ($this->reportRequest() as $item) {
         $name = $this->getRowCaption($item);
         $q = $this->_mapper->_dataQuery($this->_object);
         $q->where($this->_object->detailLevel()->getFieldNameWithId() . '=?', $item->{$this->_object->detailLevel()->getFieldNameWithId()});
         $data = array();
         $headers = $this->columnHeaders();
         foreach ($this->reportRequest($q) as $row) {
             for ($item2 = array_shift($headers); !isNull($item2) && $item2->value() != $row->period; $item2 = array_shift($headers)) {
                 $data[] = 0;
             }
             if (!isNull($item2)) {
                 $data[] = $this->_param->show($row, $showParams);
             }
         }
         for ($item2 = array_shift($headers); !isNull($item2) && $item2->value() != $row->period; $item2 = array_shift($headers)) {
             $data[] = 0;
         }
         $result[] = array('data' => $data, 'name' => $name, 'format' => $this->_param->excelFormat());
     }
     return $result;
 }