Example #1
0
 /**
  * Delete object
  * Sends JSON reply in the result and
  * closes the application
  */
 public function deleteAction()
 {
     $this->_checkCanDelete();
     $id = Request::post('id', 'integer', false);
     if (!$id) {
         Response::jsonError($this->_lang->WRONG_REQUEST);
     }
     try {
         $object = new Db_Object($this->_objectName, $id);
     } catch (Exception $e) {
         Response::jsonError($this->_lang->WRONG_REQUEST);
     }
     $childCount = Model::factory('Mediacategory')->getCount(array('parent_id' => $id));
     if ($childCount) {
         Response::jsonError($this->_lang->REMOVE_CHILDREN);
     }
     if ($this->_configMain->get('vc_clear_on_delete')) {
         Model::factory('Vc')->removeItemVc($this->_objectName, $id);
     }
     $medialib = Model::factory('Medialib');
     $medialib->categoryRemoved($id);
     if (!$object->delete()) {
         Response::jsonError($this->_lang->CANT_EXEC);
     }
     Response::jsonSuccess();
 }
Example #2
0
 /**
  * Get object history
  */
 public function listAction()
 {
     $object = Request::post('object', 'string', false);
     if (!$object) {
         Response::jsonSuccess(array());
     }
     $pager = Request::post('pager', 'array', array());
     $filter = Request::post('filter', 'array', array());
     if (!isset($filter['record_id']) || empty($filter['record_id'])) {
         Response::jsonSuccess(array());
     }
     try {
         $o = new Db_Object($object);
     } catch (Exception $e) {
         Response::jsonSuccess(array());
     }
     $filter['table_name'] = $o->getTable();
     $history = Model::factory('Historylog');
     $data = $history->getListVc($pager, $filter, false, array('date', 'type', 'id'), 'user_name');
     if (!empty($data)) {
         foreach ($data as $k => &$v) {
             if (isset(Model_Historylog::$actions[$v['type']])) {
                 $v['type'] = Model_Historylog::$actions[$v['type']];
             }
         }
         unset($v);
     }
     Response::jsonSuccess($data, array('count' => $history->getCount($filter)));
 }
Example #3
0
 /**
  * Log action. Fill history table
  * @param integer $user_id
  * @param integer $record_id
  * @param integer $type
  * @param string $table_name
  * @throws Exception
  * @return boolean
  */
 public function log($user_id, $record_id, $type, $table_name)
 {
     if (!is_integer($type)) {
         throw new Exception('History::log Invalid type');
     }
     $obj = new Db_Object($this->_name);
     $obj->setValues(array('user_id' => intval($user_id), 'record_id' => intval($record_id), 'type' => intval($type), 'date' => date('Y-m-d H:i:s'), 'table_name' => $table_name));
     return $obj->save(false, false);
 }
Example #4
0
 public function clearBlockCache(Db_Object $object)
 {
     if (!$this->_cache) {
         return;
     }
     $menuModel = Model::factory('Menu');
     $this->_cache->remove($menuModel->resetCachedMenuLinks($object->getId()));
     $blockManager = new Blockmanager();
     $blockManager->invalidateCacheBlockMenu($object->getId());
 }
Example #5
0
 /**
  * Update pages order_no
  * @param array $data
  */
 public function updateSortOrder(array $sortedIds)
 {
     $i = 0;
     foreach ($sortedIds as $v) {
         $obj = new Db_Object($this->_name, intval($v));
         $obj->set('order_no', $i);
         $obj->save();
         $i++;
     }
 }
Example #6
0
File: Vc.php Project: vgrish/dvelum
 /**
  * Create new  version
  * @property Db_Object $object
  * @return boolean
  */
 public function newVersion(Db_Object $object)
 {
     $object->commitChanges();
     $newVersion = $this->getLastVersion($object->getName(), $object->getId()) + 1;
     $newData = $object->getData();
     if ($object->getConfig()->hasEncrypted()) {
         $ivField = $object->getConfig()->getIvField();
         $ivKey = $object->get($ivField);
         if (empty($ivKey)) {
             $ivKey = Utils_String::createEncryptIv();
             $newData[$ivField] = $ivKey;
         }
         $newData = $this->getStore()->encryptData($object, $newData);
     }
     $newData['id'] = $object->getId();
     try {
         $vObject = new Db_Object('vc');
         $vObject->set('date', date('Y-m-d'));
         $vObject->set('data', base64_encode(serialize($newData)));
         $vObject->set('user_id', User::getInstance()->id);
         $vObject->set('version', $newVersion);
         $vObject->set('record_id', $object->getId());
         $vObject->set('object_name', $object->getName());
         $vObject->set('date', date('Y-m-d H:i:s'));
         if ($vObject->save()) {
             return $newVersion;
         }
         return false;
     } catch (Exception $e) {
         $this->logError('Cannot create new version for ' . $object->getName() . '::' . $object->getId() . ' ' . $e->getMessage());
         return false;
     }
 }
Example #7
0
 /**
  * Update object
  * @param Db_Object $object
  * @return void
  */
 public function updateObject(Db_Object $object)
 {
     $changeVal = Request::post('changeVal', 'bool', false);
     if ($changeVal) {
         $object->set('hash', Utils::hash($object->get('hash')));
     }
     if (!$object->save()) {
         Response::jsonError($this->_lang->CANT_EXEC);
     }
     Response::jsonSuccess(array('id' => $object->getId()));
 }
Example #8
0
 /**
  * Remove users Group
  * @param integer $id
  * @return boolean
  */
 public function removeGroup($id)
 {
     $obj = new Db_Object($this->_name, $id);
     if (!$obj->delete()) {
         return false;
     }
     $cache = self::$_dataCache;
     /**
      * Invalidate cache
      */
     if ($cache) {
         $cache->remove('groups_list');
     }
     return true;
 }
Example #9
0
 /**
  * Load user info action
  */
 public function userloadAction()
 {
     $id = Request::post('id', 'integer', false);
     if (!$id) {
         Response::jsonError($this->_lang->get('INVALID_VALUE'));
     }
     try {
         $user = new Db_Object('user', $id);
         $userData = $user->getData();
         unset($userData['pass']);
         Response::jsonSuccess($userData);
     } catch (Exception $e) {
         Response::jsonError($this->_lang->get('WRONG_REQUEST'));
     }
 }
Example #10
0
 /**
  *
  * @param string $objectName            
  * @param array $fields
  *            - fields to check
  * @return array or false on error
  */
 public static function checkImportORMFields($objectName, array $fields)
 {
     if (!$objectName || empty($fields)) {
         return false;
     }
     $data = array();
     $config = Db_Object::factory($objectName)->getConfig();
     foreach ($fields as $field) {
         if (!$config->fieldExists($field)) {
             continue;
         }
         $fieldConfig = $config->getFieldConfig($field);
         $o = Ext_Factory::object('Data_Field', array('name' => $field, 'type' => self::convetDBFieldTypeToJS($fieldConfig['db_type'])));
         switch ($fieldConfig['db_type']) {
             case 'date':
                 $o->dateFormat = 'Y-m-d';
                 break;
             case 'datetime':
                 $o->dateFormat = 'Y-m-d H:i:s';
                 break;
             case 'time':
                 $o->dateFormat = 'H:i:s';
                 break;
         }
         $data[] = $o;
     }
     return $data;
 }
Example #11
0
 /**
  * Update menu links
  * @param integer $objectId
  * @param array $links
  * @return boolean
  */
 public function updateLinks($objectId, $links)
 {
     $this->_db->delete($this->table(), 'menu_id = ' . intval($objectId));
     if (!empty($links)) {
         foreach ($links as $k => $item) {
             $obj = new Db_Object('Menu_Item');
             try {
                 $obj->tree_id = $item['id'];
                 $obj->page_id = $item['page_id'];
                 $obj->title = $item['title'];
                 $obj->published = $item['published'];
                 $obj->menu_id = $objectId;
                 $obj->parent_id = $item['parent_id'];
                 $obj->order = $item['order'];
                 $obj->link_type = $item['link_type'];
                 $obj->url = $item['url'];
                 $obj->resource_id = $item['resource_id'];
                 if (!$obj->save(false)) {
                     throw new Exception(Lang::lang()->CANT_CREATE);
                 }
             } catch (Exception $e) {
                 return false;
             }
         }
     }
     return true;
 }
Example #12
0
 /**
  * (non-PHPdoc)
  * @see Db_Object_Event_Manager::fireEvent()
  */
 public function fireEvent($code, Db_Object $object)
 {
     $objectName = ucfirst($object->getName());
     $triggerClass = Utils_String::classFromString('Trigger_' . $objectName);
     if (class_exists($triggerClass) && method_exists($triggerClass, $code)) {
         $trigger = new $triggerClass();
         if ($this->_cache) {
             $trigger->setCache($this->_cache);
         }
         $trigger->{$code}($object);
     } elseif (method_exists('Trigger', $code)) {
         $trigger = new Trigger();
         if ($this->_cache) {
             $trigger->setCache($this->_cache);
         }
         $trigger->{$code}($object);
     }
 }
Example #13
0
 function update()
 {
     $user = new Users();
     $user->select(array('id' => $this->id));
     // Because passwords are stored hashed, we don't want to hash a hash
     if ($user->password !== $this->password) {
         $this->password = Auth::get_instance()->create_hashed_password($this->password);
     }
     parent::update();
 }
Example #14
0
 /**
  * (non-PHPdoc)
  * @see Bgtask_Abstract::run()
  */
 public function run()
 {
     $object = $this->_config['object'];
     $container = $this->_config['session_container'];
     /*
      * Save task ID into session for UI
      */
     $session = Store_Session::getInstance();
     $session->set($container, $this->_pid);
     $this->goBackground();
     $objectConfig = Db_Object_Config::getInstance($object);
     $ivField = $objectConfig->getIvField();
     $primaryKey = $objectConfig->getPrimaryKey();
     if (!$objectConfig->hasEncrypted()) {
         $this->finish();
     }
     $filter = array($ivField => new Db_Select_Filter($ivField, false, Db_Select_Filter::NOT_NULL));
     $model = Model::factory($object);
     $count = Model::factory($object)->getCount($filter);
     $this->setTotalCount($count);
     if (!$count) {
         $this->finish();
     }
     $data = $model->getList(array('limit' => $this->buckedSize), $filter, array($primaryKey));
     $encryptedFields = $objectConfig->getEncryptedFields();
     while (!empty($data)) {
         $ids = Utils::fetchCol($primaryKey, $data);
         $objectList = Db_Object::factory($object, $ids);
         $count = 0;
         foreach ($objectList as $dataObject) {
             $data = array();
             foreach ($encryptedFields as $name) {
                 $data[$name] = $dataObject->get($name);
                 $model->logError($dataObject->getId() . ' ' . $name . ': ' . $data[$name]);
             }
             $data[$ivField] = null;
             try {
                 $model->getDbConnection()->update($model->table(), $data, $primaryKey . ' = ' . $dataObject->getId());
                 $count++;
             } catch (Exception $e) {
                 $errorText = 'Cannot decrypt ' . $dataObject->getName() . ' ' . $dataObject->getId() . ' ' . $e->getMessage();
                 $model->logError($errorText);
                 $this->error($errorText);
             }
         }
         /*
          * Update task status and check for signals
          */
         $this->incrementCompleted($count);
         $this->updateState();
         $this->processSignals();
         $data = $model->getList(array('limit' => $this->buckedSize), $filter, array($primaryKey));
     }
     $this->finish();
 }
Example #15
0
 protected function createPage()
 {
     $group = new Db_Object('Group');
     $group->setValues(array('title' => date('YmdHis'), 'system' => false));
     $group->save();
     $user = new Db_Object('User');
     try {
         $user->setValues(array('login' => uniqid() . date('YmdHis'), 'pass' => '111', 'email' => uniqid() . date('YmdHis') . '@mail.com', 'enabled' => 1, 'admin' => 1, 'name' => 'Test User', 'group_id' => $group->getId()));
     } catch (Exception $e) {
         echo $e->getMessage();
     }
     $saved = $user->save();
     $this->assertTrue(!empty($saved));
     $u = User::getInstance();
     $u->setId($user->getId());
     $u->setAuthorized();
     $page = new Db_Object('Page');
     $page->setValues(array('code' => uniqid() . date('YmdHis'), 'is_fixed' => 1, 'html_title' => 'Index', 'menu_title' => 'Index', 'page_title' => 'Index', 'meta_keywords' => '', 'meta_description' => '', 'parent_id' => null, 'text' => '[Index page content]', 'func_code' => '', 'order_no' => 1, 'show_blocks' => true, 'published' => true, 'published_version' => 0, 'editor_id' => $user->getId(), 'author_id' => $user->getId(), 'date_created' => date('Y-m-d H:i:s'), 'date_updated' => date('Y-m-d H:i:s'), 'author_id' => $user->getId(), 'blocks' => '', 'theme' => 'default', 'date_published' => date('Y-m-d H:i:s'), 'in_site_map' => true, 'default_blocks' => true));
     $page->save();
     return $page;
 }
Example #16
0
 /**
  * Get Associated objects
  * @param Db_Object $object
  * @return array   like
  * array(
  * 	  'single' => array(
  * 			'objectName'=>array(id1,id2,id3),
  * 			...
  * 			'objectNameN'=>array(id1,id2,id3),
  * 	   ),
  * 	   'multy' =>array(
  * 			'objectName'=>array(id1,id2,id3),
  * 			...
  * 			'objectNameN'=>array(id1,id2,id3),
  * 	   )
  * )
  */
 public static function getAssociatedObjects(Db_Object $object)
 {
     $linkedObjects = array('single' => array(), 'multy' => array());
     self::_buildAssociations();
     $objectName = $object->getName();
     $objectId = $object->getId();
     if (!isset(self::$_objectAssociations[$objectName])) {
         return array();
     }
     foreach (self::$_objectAssociations as $testObject => $links) {
         if (!isset($links[$objectName])) {
             continue;
         }
         $sLinks = self::_getSingleLinks($objectId, $testObject, $links[$objectName]);
         if (!empty($sLinks)) {
             $linkedObjects['single'][$testObject] = $sLinks;
         }
     }
     $linkedObjects['multy'] = self::_getMultyLinks($objectName, $objectId);
     return $linkedObjects;
 }
Example #17
0
 /**
  * (non-PHPdoc)
  * @see Bgtask_Abstract::run()
  */
 public function run()
 {
     $object = $this->_config['object'];
     $container = $this->_config['session_container'];
     /*
      * Save task ID into session for UI
      */
     $session = Store_Session::getInstance();
     $session->set($container, $this->_pid);
     $this->goBackground();
     $objectConfig = Db_Object_Config::getInstance($object);
     $ivField = $objectConfig->getIvField();
     $primaryKey = $objectConfig->getPrimaryKey();
     $model = Model::factory($object);
     $count = Model::factory($object)->getCount(array($ivField => null));
     $this->setTotalCount($count);
     if (!$count) {
         $this->finish();
     }
     $ignore = array();
     $data = $model->getList(array('limit' => $this->buckedSize), array($ivField => null), array($primaryKey));
     while (!empty($data)) {
         $ids = Utils::fetchCol($primaryKey, $data);
         $objectList = Db_Object::factory($object, $ids);
         $count = 0;
         foreach ($objectList as $dataObject) {
             if (!$dataObject->save()) {
                 $ignore[] = $dataObject->getId();
                 $this->log('Cannot encrypt ' . $dataObject->getName() . ' ' . $dataObject->getId());
             } else {
                 $count++;
             }
         }
         /*
          * Update task status and check for signals
          */
         $this->incrementCompleted($count);
         $this->updateState();
         $this->processSignals();
         if (!empty($ignore)) {
             $filters = array($ivField => null, $primaryKey => new Db_Select_Filter($primaryKey, $ignore, Db_Select_Filter::NOT_IN));
         } else {
             $filters = array($ivField => null);
         }
         $data = $model->getList(array('limit' => $this->buckedSize), $filters, array($primaryKey));
     }
     $this->finish();
 }
Example #18
0
 /**
  * Add block map for page
  * @param integer $pageId
  * @param string $code
  * @param array $blockIds
  */
 public function addBlocks($pageId, $code, array $blockIds)
 {
     if (empty($blockIds)) {
         return true;
     }
     $order = 0;
     foreach ($blockIds as $id) {
         $blockmapItem = new Db_Object('blockmapping');
         $blockmapItem->set('block_id', $id);
         if ($pageId) {
             $blockmapItem->set('page_id', $pageId);
         }
         $blockmapItem->set('place', $code);
         $blockmapItem->set('order_no', $order);
         $blockmapItem->save(false);
         $order++;
     }
     return true;
 }
Example #19
0
 /**
  * Update group permissions
  * @param integer $groupId
  * @param array $data - permissions like array(
  * array(
  * 			'object'=>'object',
  * 			'view'=>true,
  *             'create'=>false,
  * 			'edit'=>false,
  * 			'delete'=>false,
  * 			'publish'=>false
  * 	),
  * 	...
  * )
  * @return boolean
  */
 public function updateGroupPermissions($groupId, array $data)
 {
     $groupPermissions = $this->getList(false, array('group_id' => $groupId, 'user_id' => null));
     $sorted = Utils::rekey('object', $groupPermissions);
     $modulesToRemove = array();
     if (!empty($sorted)) {
         $modulesToRemove = array_diff(array_keys($sorted), Utils::fetchCol('object', $data));
     }
     if (!empty($modulesToRemove)) {
         $this->_db->delete($this->table(), '`object` IN (\'' . implode("','", $modulesToRemove) . '\') AND `group_id`=' . intval($groupId));
     }
     $errors = false;
     foreach ($data as $values) {
         if (empty($values)) {
             return false;
         }
         /**
          * Check if all needed fields are present
          */
         $diff = array_diff(self::$_fields, array_keys($values));
         if (!empty($diff)) {
             continue;
         }
         try {
             if (isset($sorted[$values['object']])) {
                 $obj = new Db_Object($this->_name, $sorted[$values['object']][$this->_objectConfig->getPrimaryKey()]);
                 $obj->setValues(array('view' => (bool) $values['view'], 'create' => (bool) $values['create'], 'edit' => (bool) $values['edit'], 'delete' => (bool) $values['delete'], 'publish' => (bool) $values['publish']));
             } else {
                 $obj = new Db_Object($this->_name);
                 $obj->setValues(array('view' => (bool) $values['view'], 'create' => (bool) $values['create'], 'edit' => (bool) $values['edit'], 'delete' => (bool) $values['delete'], 'publish' => (bool) $values['publish'], 'object' => $values['object'], 'group_id' => $groupId, 'user_id' => null));
             }
             if (!$obj->save()) {
                 $errors = true;
             }
         } catch (Exception $e) {
             $this->logError($e->getMessage());
             $errors = true;
         }
     }
     if ($errors) {
         return false;
     } else {
         return true;
     }
 }
Example #20
0
File: Vc.php Project: vgrish/dvelum
 /**
  * Unpublish object
  * Sends JSON reply in the result
  * and closes the application.
  * @param Db_Object $object
  */
 public function unpublishObject(Db_Object $object)
 {
     if (!$object->get('published')) {
         Response::jsonError($this->_lang->NOT_PUBLISHED);
     }
     if (!$object->unpublish()) {
         Response::jsonError($this->_lang->CANT_EXEC);
     }
     Response::jsonSuccess();
 }
Example #21
0
 /**
  * (non-PHPdoc)
  * @see Backend_Controller_Crud::deleteAction()
  */
 public function deleteAction()
 {
     $this->_checkCanDelete();
     $id = Request::post('id', 'integer', false);
     if (!$id) {
         Response::jsonError($this->_lang->WRONG_REQUEST);
     }
     try {
         $object = new Db_Object($this->_objectName, $id);
     } catch (Exception $e) {
         Response::jsonError($this->_lang->WRONG_REQUEST);
     }
     $acl = $object->getAcl();
     if ($acl && !$acl->canDelete($object)) {
         Response::jsonError($this->_lang->CANT_DELETE);
     }
     $childIds = Model::factory('Page')->getList(false, array('parent_id' => $id), array('id'));
     if (!empty($childIds)) {
         Response::jsonError($this->_lang->REMOVE_CHILDREN);
     }
     if ($this->_configMain->get('vc_clear_on_delete')) {
         Model::factory('Vc')->removeItemVc($this->_objectName, $id);
     }
     if (!$object->delete()) {
         Response::jsonError($this->_lang->CANT_EXEC);
     }
     Model::factory('Blockmapping')->clearMap($id);
     Response::jsonSuccess();
 }
Example #22
0
 /**
  * Enable error log. Set log adapter
  * @param Log $log
  */
 public static function setLog(Log $log)
 {
     self::$_log = $log;
 }
Example #23
0
 /**
  * Reset childs elements set parent 0
  * @param page $id
  */
 public function resetChilds($id)
 {
     $obj = new Db_Object($this->_name, intval($id));
     $obj->set('parent_id', 0);
     $obj->save();
 }
Example #24
0
 /**
  * Get object title
  */
 public function otitleAction()
 {
     $object = Request::post('object', 'string', false);
     $id = Request::post('id', 'string', false);
     if (!$object || !Db_Object_Config::configExists($object)) {
         Response::jsonError($this->_lang->WRONG_REQUEST);
     }
     if (!in_array(strtolower($object), $this->_canViewObjects, true)) {
         Response::jsonError($this->_lang->CANT_VIEW);
     }
     $objectConfig = Db_Object_Config::getInstance($object);
     // Check ACL permissions
     $acl = $objectConfig->getAcl();
     if ($acl) {
         if (!$acl->can(Db_Object_Acl::ACCESS_VIEW, $object)) {
             Response::jsonError($this->_lang->get('ACL_ACCESS_DENIED'));
         }
     }
     try {
         $o = Db_Object::factory($object, $id);
         Response::jsonSuccess(array('title' => $o->getTitle()));
     } catch (Exception $e) {
         Model::factory($object)->logError('Cannot get title for ' . $object . ':' . $id);
         Response::jsonError($this->_lang->get('CANT_EXEC'));
     }
 }
Example #25
0
 /**
  * Validate object action
  */
 public function validateAction()
 {
     $engineUpdate = false;
     $name = Request::post('name', 'string', false);
     if (!$name) {
         Response::jsonError($this->_lang->WRONG_REQUEST);
     }
     $objectConfig = Db_Object_Config::getInstance($name);
     // Check ACL permissions
     $acl = $objectConfig->getAcl();
     if ($acl) {
         if (!$acl->can(Db_Object_Acl::ACCESS_CREATE, $name) || !$acl->can(Db_Object_Acl::ACCESS_VIEW, $name)) {
             Response::jsonError($this->_lang->get('ACL_ACCESS_DENIED'));
         }
     }
     try {
         $obj = new Db_Object($name);
     } catch (Exception $e) {
         Response::jsonError($this->_lang->get('CANT_GET_VALIDATE_INFO'));
     }
     $builder = new Db_Object_Builder($name);
     $tableExists = $builder->tableExists();
     $colUpd = array();
     $indUpd = array();
     $keyUpd = array();
     if ($tableExists) {
         $colUpd = $builder->prepareColumnUpdates();
         $indUpd = $builder->prepareIndexUpdates();
         $keyUpd = $builder->prepareKeysUpdate();
         $engineUpdate = $builder->prepareEngineUpdate();
     }
     if (empty($colUpd) && empty($indUpd) && empty($keyUpd) && $tableExists && !$engineUpdate) {
         Response::jsonSuccess(array(), array('nothingToDo' => true));
     }
     $template = new Template();
     $template->disableCache();
     $template->engineUpdate = $engineUpdate;
     $template->columns = $colUpd;
     $template->indexes = $indUpd;
     $template->keys = $keyUpd;
     $template->tableExists = $tableExists;
     $template->tableName = $obj->getTable();
     $template->lang = $this->_lang;
     $msg = $template->render(Application::getTemplatesPath() . 'orm_validate_msg.php');
     Response::jsonSuccess(array(), array('text' => $msg, 'nothingToDo' => false));
 }
Example #26
0
 /**
  * (non-PHPdoc)
  * @see Bgtask_Storage::addTaskRecord()
  */
 public function addTaskRecord($description)
 {
     $object = new Db_Object('bgtask');
     $object->title = $description;
     $pid = $object->save();
     $this->_objects[$pid] = $object;
     return $pid;
 }
Example #27
0
 public function clearBlockCache(Db_Object $object)
 {
     $blockManager = new Blockmanager();
     $blockManager->invalidateCacheBlockId($object->getId());
 }
Example #28
0
 public function testGetTitle()
 {
     $cfg = Db_Object_Config::getInstance('Page');
     $data = $cfg->getData();
     $data['link_title'] = '/ {code} / {menu_title} /';
     $cfg->setData($data);
     $page = new Db_Object('Page');
     $page->set('code', 'pageCode');
     $page->set('menu_title', 'pageTitle');
     //echo $page->getTitle();exit;
     $this->assertEquals('/ pageCode / pageTitle /', $page->getTitle());
 }
Example #29
0
 /**
  * Mark object as hand croped
  * @param integer $id
  * @return void
  */
 public function markCroped($id)
 {
     $obj = new Db_Object($this->_name, $id);
     $obj->set('croped', 1);
     $obj->save();
 }
Example #30
0
 public function otitleAction()
 {
     $object = Request::post('object', 'string', false);
     $id = Request::post('id', 'string', false);
     if (!$object || !Db_Object_Config::configExists($object)) {
         Response::jsonError($this->_lang->WRONG_REQUEST);
     }
     try {
         $o = Db_Object::factory($object, $id);
         Response::jsonSuccess(array('title' => $o->getTitle()));
     } catch (Exception $e) {
         Model::factory($object)->logError('Cannot get title for ' . $object . ':' . $id);
         Response::jsonError($this->_lang->get('CANT_EXEC'));
     }
 }