コード例 #1
0
ファイル: Show.class.php プロジェクト: evilgeny/bob
 /**
  * Returns diagram prefix name
  *
  * @return		string
  */
 public function getDiagramPrefix()
 {
     return 'report-' . $this->_object->id() . '-' . $this->_object->report_type;
 }
コード例 #2
0
ファイル: Mapper.class.php プロジェクト: evilgeny/bob
 public function getCollectionNamesList(RM_Report_Object $obReport, $collection)
 {
     $data = array();
     $tables = $obReport->detail()->getPrototypeCollection();
     $oldConn = M('Db')->setCurrentConnection('category_base');
     $fieldsToConcat = array();
     for ($i = 0; $i < count($tables); $i++) {
         if (!$i) {
             $query = M('Db')->createQuery($tables[$i]['table'] . " tb{$i}");
         } else {
             $query->join('tb' . ($i - 1), 'left join ' . $tables[$i]['table'] . " tb{$i} on tb{$i}." . $tables[$i]['id'] . '=?');
         }
         $fieldsToConcat[] = "tb{$i}." . $tables[$i]['name'];
     }
     $query->what("CONCAT_WS('" . C('report.caption-sequence-separtor') . "', " . join(', ', $fieldsToConcat) . ") AS name");
     $query->what('? AS id');
     $query->limit(1);
     M('Db')->setCurrentConnection($oldConn);
     foreach ($collection as $idSequence => $toGroup) {
         if ($idSequence == -1) {
             continue;
         }
         // Категория с нулями - "другое"
         if (!preg_match('/[1-9]+/', $idSequence)) {
             $data[] = M('Report')->createFactory('group')->create(array('id' => $idSequence, 'name' => L('client.group_other')));
             continue;
         }
         // Скрыли группу
         if (preg_match('/-\\d+/', $idSequence, $q)) {
             if (!isNull($tmp = M('ReportGroup')->loadById(-$q[0]))) {
                 $data[] = M('Report')->createFactory('group')->create(array('id' => $idSequence, 'name' => $tmp->name));
             }
             continue;
         }
         $query->where()->reset();
         $parts = explode(',', $idSequence);
         $idBinds = array();
         for ($i = 1; $i < count($parts); $i++) {
             $idBinds[] = $parts[$i];
         }
         $idBinds[] = $parts[0];
         $args = array_merge(array('tb0.' . $tables[0]['id'] . '=?', $idSequence), $idBinds);
         call_user_func_array(array($query, 'where'), $args);
         if (!isNull($obj = iterFirst($query->execute(), M('Report')->createFactory('group')))) {
             $data[] = $obj;
         }
     }
     return $data;
 }