Exemplo n.º 1
0
 /**
  * (non-PHPdoc)
  * @see Backend_Controller_Crud::loaddataAction()
  */
 public function loaddataAction()
 {
     $id = Request::post('id', 'integer', false);
     if (!$id) {
         Response::jsonSuccess(array());
     }
     try {
         $obj = new Db_Object($this->_objectName, $id);
     } catch (Exception $e) {
         Response::jsonError($this->_lang->CANT_EXEC);
     }
     $data = $obj->getData();
     /*
      * Prepare  mltilink properties
      */
     $fields = $obj->getFields();
     foreach ($fields as $field) {
         if ($field == 'id' || empty($data[$field])) {
             continue;
         }
         $linkObject = $obj->getLinkedObject($field);
         if ($linkObject !== false) {
             $data[$field] = array_values($this->_collectLinksData($data[$field], $linkObject));
         }
     }
     $data['id'] = $obj->getId();
     $menuItemModel = Model::factory('menu_item');
     $data['data'] = $menuItemModel->getTreeList($data['id']);
     /*
      * Send response
      */
     Response::jsonSuccess($data);
 }