public function save() { if (!$this->getId()) { $this->setIsRead(0); } return parent::save(); }
protected function _prepareFbPost($post_datas) { $post = new Core_Model_Default(); $icon_url = "https://graph.facebook.com/{$post_datas['from']['id']}/picture"; $count_comments = isset($post_datas['comments']['data']) ? count($post_datas['comments']['data']) : 0; if ($count_comments == 25) { $count_comments = ' > ' . $count_comments; } $count_likes = isset($post_datas['likes']['data']) ? count($post_datas['likes']['data']) : 0; if ($count_likes == 25) { $count_likes = ' > ' . $count_likes; } $comments = array(); if (!empty($post_datas['comments']['data']) && is_array($post_datas['comments']['data'])) { foreach ($post_datas['comments']['data'] as $comment) { $created_at = new Zend_Date($comment['created_time'], Zend_Date::ISO_8601, new Zend_Locale('en_US')); $comments[] = new Core_Model_Default(array('id' => $comment['id'], 'name' => $comment['from']['name'], 'message' => $comment['message'], 'picture' => "https://graph.facebook.com/{$comment['from']['id']}/picture", 'created_at' => $created_at->toString($this->_("MM/dd/y hh:mm a")))); } } $created_at = new Zend_Date($post_datas['created_time'], Zend_Date::ISO_8601, new Zend_Locale('en_US')); $message = ''; if (!empty($post_datas['message'])) { $message = $post_datas['message']; } else { if (!empty($post_datas['story'])) { $message = $post_datas['story']; } } $picture = !empty($post_datas['picture']) ? $post_datas['picture'] : ''; $picture = !empty($post_datas['object_id']) ? "https://graph.facebook.com/{$post_datas['object_id']}/picture?width=200" : $picture; $datas = array('id' => $post_datas['id'], 'author' => $post_datas['from']['name'], "avatar_url" => $icon_url, 'message' => $message, 'short_message' => strlen($message) > 300 ? Core_Model_Lib_String::truncate($message, 300) : $message, 'picture' => $picture, 'details' => !empty($post_datas['name']) ? $post_datas['name'] : '', "link" => isset($post_datas['link']) ? $post_datas['link'] : '', "created_at" => $created_at->toString($this->_("MM/dd/y hh:mm a")), "comments" => $comments, "nbr_of_comments" => $count_comments, "nbr_of_likes" => $count_likes); $post->setData($datas); return $post; }
public function save() { if (!$this->getPeriodId()) { $this->setPeriodId(self::PERIOD_WEEKLY); } return parent::save(); }
public function __construct($params = array()) { parent::__construct($params); $config = array('appId' => self::getAppId(), 'secret' => self::getSecretKey()); $this->_facebook = new Facebook($config); return $this; }
public function save() { if ($this->getIsIllimited()) { $this->setEndDate(null); } parent::save(); }
public function save() { parent::save(); if ($this->getAppId() and is_array($this->_value_ids)) { $this->saveValueIds($this->getAppId()); } }
public function save() { parent::save(); $blocks = $this->getData('block') ? $this->getData('block') : array(); // if($this->getData('block')) { $this->getTable()->saveBlock($this->getId(), $blocks); // } }
public function find($id, $field = null) { parent::find($id, $field); if (!$this->getId()) { $this->setRadius(10.0); } return $this; }
public function delete() { if (!$this->getId()) { return $this; } $this->getRootCategory()->delete(); return parent::delete(); }
public function save() { parent::save(); if ($resources = $this->getResources()) { $this->getTable()->saveResources($this->getId(), $resources); } return $this; }
public function save() { parent::save(); if ($this->_language_data) { $this->getTable()->saveLanguageData($this->getId(), $this->_language_data); } return $this; }
public function prepareFeature($option_value) { parent::prepareFeature($option_value); if (!$this->getId()) { $this->setValueId($option_value->getValueId())->setAppId($option_value->getAppId())->save(); } return $this; }
public function save() { // S'il n'y a pas de période défini pour le jeu, affecte la période par défaut (1 semaine) if (!$this->getPeriodId()) { $this->setPeriodId(self::PERIOD_WEEKLY); } return parent::save(); }
public function save() { if ($this->getAppId()) { $this->getTable()->saveAppBlock($this); } else { parent::save(); } return $this; }
public function save() { $price = trim(str_replace(array(Core_Model_Language::getCurrencySymbol(), ' '), '', $this->getData('price'))); $filter = new Zend_Filter_LocalizedToNormalized(); $filter->setOptions(array('locale' => Zend_Registry::get('Zend_Locale'))); $this->setData('price', $filter->filter($price)); parent::save(); return $this; }
public static function getStoreCategeories() { $categories = array(); foreach (self::$_store_categories as $key => $category) { $category_name = parent::_($category); $categories[$category_name] = new Core_Model_Default(array('id' => $key, 'name' => parent::_($category_name))); } ksort($categories); return $categories; }
public function save($comment_id, $customer_id, $ip, $ua) { $duplicate_like = $this->getTable()->findByIp($comment_id, $customer_id, $ip, $ua); if (count($duplicate_like) == 0) { parent::save(); return true; } else { return false; } }
public function save() { parent::save(); if (!$this->getIsDeleted() and $this->getTypeId() == 'picasa' || $this->getTypeId() == 'instagram') { if ($this->getTypeInstance()->getId()) { $this->getTypeInstance()->delete(); } $this->getTypeInstance()->setData($this->_getTypeInstanceData())->setGalleryId($this->getId())->save(); } return $this; }
public function save() { $isDeleted = $this->getIsDeleted(); parent::save(); if (!$isDeleted) { if ($this->getTypeInstance()->getId()) { $this->getTypeInstance()->delete(); } $this->getTypeInstance()->setData($this->_getTypeInstanceData())->setGalleryId($this->getId())->save(); } return $this; }
public function save() { if (!$this->getSkipIsVisibleState()) { // $config = new Comment_Model_Pos_Config(); // $config->findByPosId($this->getPosId()); // $this->setIsVisible((int) $config->isAutocommit()); // Zend_Debug::dump($config->getData()); // Zend_Debug::dump($this->getData()); // die; } $this->setIsVisible(1); return parent::save(); }
protected function _initRequest() { Core_Model_Language::prepare(); $frontController = $this->_front_controller; $this->_request = new Siberian_Controller_Request_Http(); $this->_request->isInstalling(!Installer_Model_Installer::isInstalled()); $this->_request->setPathInfo(); $baseUrl = $this->_request->getScheme() . '://' . $this->_request->getHttpHost() . $this->_request->getBaseUrl(); $this->_request->setBaseUrl($baseUrl); $frontController->setRequest($this->_request); Siberian_View::setRequest($this->_request); Core_Model_Default::setBaseUrl($this->_request->getBaseUrl()); }
public function save() { parent::save(); if ($this->getData("message_files")) { $new_files = array(); foreach ($this->getData("message_files") as $key => $file) { if ($file and $file != "") { $new_files[] = $this->saveFile($file); } } $this->setMessageFiles($new_files); } }
public function save() { $countries = Zend_Registry::get('Zend_Locale')->getTranslationList('Territory', null, 2); if ($this->getCountryCode()) { if (empty($countries[$this->getCountryCode()])) { throw new Exception($this->_("An error occurred while saving. The country is not valid.")); } else { if ($this->getCountry() != $countries[$this->getCountryCode()]) { $this->setCountry($countries[$this->getCountryCode()]); } } } return parent::save(); }
public function delete() { $category_option = new Application_Model_Option_Value(); $option_values = $category_option->findAll(array('folder_category_id' => $this->getId())); if ($option_values->count()) { foreach ($option_values as $option_value) { $option_value->setFolderId(null)->setFolderCategoryId(null)->setFolderCategoryPosition(null)->save(); } } foreach ($this->getChildren() as $child) { $child->delete(); } return parent::delete(); }
public function save() { parent::save(); if ($this->getNewOption() and !$this->getIsDeleted()) { $new_option_ids = array(); foreach ($this->getNewOption() as $option_id => $new_option) { $is_new = false; $option = new Catalog_Model_Product_Group_Option(); if (stripos($option_id, 'new') === false) { $new_option['option_id'] = $option_id; } else { $is_new = true; } $new_option['group_id'] = $this->getId(); $option->addData($new_option)->save(); if ($is_new) { $new_option_ids[] = $option->getId(); } } $this->setNewOptionIds($new_option_ids); } }
public function __construct($params = array()) { parent::__construct($params); $this->_db_table = 'Media_Model_Db_Table_Library_Image'; return $this; }
public function save() { if (!$this->getIsDeleted()) { if (!$this->getPosition()) { $this->setPosition($this->findLastPosition($this->getValueId(), $this->getParentId())); } } else { foreach ($this->getChildren() as $child) { $child->setIsDeleted(1)->save(); } } parent::save(); if (!$this->getData('is_deleted')) { if (!empty($this->_products)) { foreach ($this->_products as $product) { $product->setCategoryId($this->getId())->setValueId($this->getValueId())->save(); } } } else { if (!$this->getParentId()) { foreach ($this->getChildren() as $child) { foreach ($child->getProducts() as $product) { $product->delete(); } } foreach ($this->getProducts() as $product) { $product->delete(); } } } }
public function __construct($params = array()) { parent::__construct($params); $this->_db_table = 'Template_Model_Db_Table_Design'; return $this; }
public function getPath($action, $params = array(), $env = null) { if ($this->getValueId()) { $params["value_id"] = $this->getValueId(); } $request = Zend_Controller_Front::getInstance()->getRequest(); $use_key = $request->useApplicationKey(); $path = null; $force_uri = stripos($action, "/") !== false; $uri = $force_uri ? $action : $this->getUri(); if ($uri) { if (!is_null($env)) { if (!$force_uri) { $uri .= $action; } if ($this->getData("{$env}_uri")) { $uri = $this->getData("{$env}_uri"); } if ($env == "mobile") { $request->useApplicationKey(true); } } if ($env != "desktop" and !$this->getIsAjax() and $this->getObject()->getLink()) { $path = $this->getObject()->getLink()->getUrl(); } else { $path = parent::getPath($uri, $params); } } else { $path = '/front/index/noroute'; } $request->useApplicationKey($use_key); return $path; }
public function __construct($datas = array()) { parent::__construct($datas); $this->_db_table = 'Application_Model_Db_Table_Option_Layout'; }