Ejemplo n.º 1
0
Archivo: item.php Proyecto: trk/ionize
 /**
  * Edit one Item
  *
  */
 public function edit()
 {
     $id_item = $this->input->post('id_item');
     // Item
     $item = $this->item_model->get(array('id_item' => $id_item));
     // Element definition
     $item_definition = $this->item_definition_model->get(array('id_item_definition' => $item['id_item_definition']), Settings::get_lang('default'));
     // Element's fields instances
     $item_fields = $this->item_model->get_item_fields($id_item);
     $this->template['item'] = $item;
     $this->template['item_definition'] = $item_definition;
     $this->template['fields'] = $item_fields;
     $lang_fields = array_values(array_filter($item_fields, create_function('$row', 'return $row["translated"] == 1;')));
     $this->template['lang_fields'] = $lang_fields;
     // Check for langs fields different from
     $has_lang_fields = FALSE;
     foreach ($lang_fields as $lf) {
         if ($lf['type'] != 8) {
             $has_lang_fields = TRUE;
         }
     }
     $this->template['has_lang_fields'] = $has_lang_fields;
     // Check for Media type
     $has_media_fields = FALSE;
     foreach ($item_fields as $f) {
         if ($f['type'] == 8) {
             $has_media_fields = TRUE;
         }
     }
     $this->template['has_media_fields'] = $has_media_fields;
     $this->template['ordering'] = $item['ordering'];
     $this->template['id_item'] = $id_item;
     $this->output('item/instance/edit');
 }
Ejemplo n.º 2
0
 /**
  * Must be called by XHR
  * Called by definition Edition form Validation
  *
  * Returns 1 if true, 0 if false
  *
  */
 function check_exists()
 {
     $name = url_title($this->input->post('name'));
     $exists = $this->item_definition_model->check_exists('name', $name, $this->input->post('id_item_definition'));
     $this->xhr_output($exists);
 }