Exemple #1
0
 function showadd()
 {
     $module = Module::getOne($_GET['module']);
     $model = new Work();
     $fields = $model->getFields();
     $row = $model->getStandartFields();
     View::render('work/add', array('fields' => $fields, 'row' => $row, 'path' => 'add', 'module' => $module));
 }
Exemple #2
0
 public function getEditFields($treeId, $moduleId)
 {
     $return = array();
     $data = array();
     $temp = array();
     $sql = 'SELECT *, ' . $moduleId . ' AS module FROM {{data}} WHERE tree=' . $treeId . ' AND type NOT IN(\'' . implode('\',\'', Fields::$featuresField) . '\') ORDER BY num';
     $additional = DB::getAll($sql);
     foreach ($additional as $item) {
         $temp[] = $item['path'];
     }
     $data = Work::getFields($moduleId);
     $sql = 'SELECT *, ' . $moduleId . ' AS module FROM {{catalog}} WHERE tree=' . $treeId . '';
     $catalog = DB::getRow($sql);
     foreach ($data as $key => $item) {
         if (in_array($item['path'], OneSSA::$catalogStandart)) {
             $data[$key][Fields::$types[$item['type']]['type']] = $catalog[$item['path']];
         } else {
             if (in_array($data[$key]['path'], $temp)) {
                 unset($data[$key]);
             }
         }
     }
     $data = array_merge($data, $additional);
     if (Funcs::$prop['fieldsort'] == 0) {
         return $data;
     } else {
         $fields = Fields::getFieldsByModule($moduleId);
         foreach ($fields as $field) {
             foreach ($data as $item) {
                 if ($field['path'] == $item['path']) {
                     $return[] = $item;
                 }
             }
         }
         return $return;
     }
 }
Exemple #3
0
 public function getEditFields($treeId, $moduleId)
 {
     $return = array();
     $data = array();
     $temp = array();
     $sql = 'SELECT *, ' . $moduleId . ' AS module FROM {{data}} WHERE tree=' . $treeId . ' ORDER BY num';
     $additional = DB::getAll($sql);
     foreach ($additional as $item) {
         $temp[] = $item['path'];
     }
     $data = Work::getFields($moduleId);
     $sql = 'SELECT * FROM {{fields}} WHERE module=' . $moduleId . ' AND innerf=1 ORDER BY num';
     $fields = DB::getRow($sql);
     foreach ($data as $key => $item) {
         /*if(in_array($item['path'],Fields::$catalogStandart)){
         			$data[$key][Fields::$types[$item['type']]['type']]=$fields[$item['path']];
         		}else{*/
         if (in_array($data[$key]['path'], $temp)) {
             unset($data[$key]);
         }
         //}
     }
     $data = array_merge($data, $additional);
     if (Funcs::$prop['fieldsort'] == 0) {
         return $data;
     } else {
         $fields = Fields::getFieldsByModule($moduleId);
         foreach ($fields as $field) {
             foreach ($data as $item) {
                 if ($field['path'] == $item['path']) {
                     $return[] = $item;
                 }
             }
         }
         return $return;
     }
 }