public function saveAction() { if ($datas = $this->getRequest()->getParams()) { try { if (empty($datas['design_id'])) { throw new Exception($this->_('An error occurred while saving')); } $application = $this->getApplication(); $category = new Template_Model_Category(); $design = new Template_Model_Design(); $design->find($datas['design_id']); if (!$design->getId()) { throw new Exception($this->_('An error occurred while saving')); } else { if ($design->getCode() != "blank" && empty($datas['category_id'])) { throw new Exception($this->_('An error occurred while saving')); } } if (!empty($datas['category_id'])) { $category->find($datas['category_id']); if (!$category->getCode()) { throw new Exception($this->_('An error occurred while saving')); } } $this->getApplication()->setLayoutVisibility(Application_Model_Layout_Homepage::VISIBILITY_HOMEPAGE)->setDesign($design, $category)->save(); $html = array('success' => 1, 'overview_src' => $design->getOverview(), 'homepage_standard' => $application->getHomepageBackgroundImageUrl(), 'homepage_hd' => $application->getHomepageBackgroundImageUrl('hd'), 'homepage_tablet' => $application->getHomepageBackgroundImageUrl('tablet'), 'app_icon' => $application->getIcon(), "display_layout_options" => $application->getLayout()->getVisibility() == Application_Model_Layout_Homepage::VISIBILITY_ALWAYS); } catch (Exception $e) { $html = array('message' => $e->getMessage(), 'message_buttom' => 1, 'message_loader' => 1); } } $this->getLayout()->setHtml(Zend_Json::encode($html)); }
public function saveAction() { if ($datas = $this->getRequest()->getParams()) { try { if (empty($datas['design_id'])) { throw new Exception($this->_('An error occurred while saving')); } $application = $this->getApplication(); $design = new Template_Model_Design(); $design->find($datas['design_id']); if (!$design->getId()) { throw new Exception($this->_('An error occurred while saving')); } $this->getApplication()->setDesign($design)->save(); $html = array('success' => 1, 'overview_src' => $design->getOverview(), 'homepage_normal' => $application->getHomepageBackgroundImageUrl(), 'homepage_retina4' => $application->getHomepageBackgroundImageUrl('retina')); } catch (Exception $e) { $html = array('message' => $e->getMessage(), 'message_buttom' => 1, 'message_loader' => 1); } } $this->getLayout()->setHtml(Zend_Json::encode($html)); }
foreach ($category->findAll() as $category_data) { $category_ids[$category_data->getCode()] = $category_data->getId(); } foreach ($categories_designs as $category_code => $design_codes) { $categories_designs_data = array("category_id" => $category_ids[$category_code]); foreach ($design_codes as $design_code) { $categories_designs_data["design_id"] = $design_ids[$design_code]; $this->_db->insert("template_design_category", $categories_designs_data); } } // Assigning features to designs $design_codes = array("dj" => array("newswall" => array("icon" => "/newswall/newswall2.png"), "music_gallery" => array("name" => "Playlists"), "push_notification" => array("name" => "Messages", "icon" => "/push_notifications/push2.png"), "image_gallery" => array("icon" => "/images/image5.png"), "facebook" => array(), "calendar" => array("icon" => "/calendar/calendar2.png"), "video_gallery" => array("icon" => "/videos/video2.png"), "custom_page" => array("name" => "About me"), "booking" => array("icon" => "/booking/booking4.png")), "fairground" => array("fanwall" => array("icon" => "/../../images/templates/fairground/icons/fanwall.png"), "loyalty" => array("name" => "Loyalty", "icon" => "/loyalty/loyalty4.png"), "social_gaming" => array("icon" => "/contest/contest4.png"), "discount" => array("name" => "Coupons", "icon" => "/discount/discount5.png"), "calendar" => array("icon" => "/calendar/calendar2.png"), "image_gallery" => array("icon" => "/images/image7.png"), "push_notification" => array("name" => "Push", "icon" => "/push_notifications/push3.png"), "video_gallery" => array(), "newswall" => array("name" => "News"), "facebook" => array()), "pizza" => array("m_commerce" => array("name" => "Orders"), "loyalty" => array("name" => "Loyalty"), "social_gaming" => array(), "discount" => array(), "facebook" => array(), "contact" => array())); foreach ($design_codes as $design_code => $option_codes) { foreach ($option_codes as $option_code => $option_infos) { $design = new Template_Model_Design(); $design->find($design_code, "code"); $option = new Application_Model_Option(); $options = $option->findAll(array("code IN (?)" => $option_code)); foreach ($options as $option) { $icon_id = NULL; if (isset($option_infos["icon"])) { $icon = new Media_Model_Library_Image(); $icon->find($option_infos["icon"], "link"); if (!$icon->getData()) { $icon->setLibraryId($option->getLibraryId())->setLink($option_infos["icon"])->setOptionId($option->getId())->setCanBeColorized(1)->setPosition(0)->save(); } $icon_id = $icon->getId(); } $data = array("design_id" => $design->getId(), "option_id" => $option->getId(), "option_tabbar_name" => isset($option_infos["name"]) ? $option_infos["name"] : NULL, "option_icon" => $icon_id, "option_background_image" => isset($option_infos["background_image"]) ? $option_infos["background_image"] : NULL); $design_content = new Template_Model_Design_Content(); $design_content->setData($data)->save();
public function checkDependencies() { $package = $this->getPackageDetails(); $dependencies = $package->getDependencies(); if (!empty($dependencies) and is_array($dependencies)) { foreach ($dependencies as $type => $dependency) { switch ($type) { case "system": if (strtolower($dependency["type"]) != strtolower(Siberian_Version::TYPE)) { throw new Exception($this->_("This update is designed for the %s, you can't install it in your %s.", $package->getName(), Siberian_Version::NAME)); } // If the current version of Siberian equals the package's version if (version_compare(Siberian_Version::VERSION, $package->getVersion()) >= 0) { throw new Exception($this->_("You already have installed this update.")); // If the current version is too old } else { $compare = version_compare(Siberian_Version::VERSION, $dependency["version"]); if ($compare == -1) { throw new Exception($this->_("Please update your system to the %s version before installing this update.", $dependency["version"])); } elseif ($compare == 1) { throw new Exception($this->_("You already have installed this update.")); } } break; case "module": /** * @todo Test the module installs' / updates' dependencies */ // $module = new Installer_Model_Installer_Module(); // $module->prepare($dependency["name"]); // $version = $module->getVersion() ? $module->getVersion() : Installer_Model_Installer_Module::DEFAULT_VERSION; // $compare = version_compare($version, $dependency["version"]); // // if($compare == 1) { // throw new Exception($this->_("You already have installed this update.")); // } else if($compare == -1) { // throw new Exception($this->_("Please update the module to the %s version before installing this update.", $dependency["version"])); // } break; case "template": $template_design = new Template_Model_Design(); $template_design->find($package->getCode(), "code"); if ($template_design->getId()) { throw new Exception($this->_("You already have installed this template.")); } $compare = version_compare(Siberian_Version::VERSION, $dependency["version"]); if ($compare == -1) { throw new Exception($this->_("Please update your system to the %s version before installing this update.", $dependency["version"])); } break; } } } }
$this->_db->insert("template_design_category", $categories_designs_data); } } // Assigning features to designs $design_codes = array("big_company" => array("custom_page" => array("name" => "Company"), "newswall" => array(), "push_notification" => array("name" => "Push", "icon" => "/push_notifications/push4.png"), "folder" => array("name" => "Products", "icon" => "/booking/booking4.png"), "places" => array("name" => "Locations"), "video_gallery" => array(), "contact" => array(), "facebook" => array(), "weblink_multi" => array(), "form" => array()), "dj" => array("newswall" => array("icon" => "/newswall/newswall2.png"), "music_gallery" => array("name" => "Playlists"), "push_notification" => array("name" => "Messages", "icon" => "/push_notifications/push2.png"), "image_gallery" => array("icon" => "/images/image5.png"), "facebook" => array(), "calendar" => array("icon" => "/calendar/calendar2.png"), "video_gallery" => array("icon" => "/videos/video2.png"), "custom_page" => array("name" => "About me"), "booking" => array("icon" => "/booking/booking4.png")), "fairground" => array("fanwall" => array("icon" => "/../../images/templates/fairground/icons/fanwall.png"), "loyalty" => array("name" => "Loyalty", "icon" => "/loyalty/loyalty4.png"), "social_gaming" => array("icon" => "/contest/contest4.png"), "discount" => array("name" => "Coupons", "icon" => "/discount/discount5.png"), "calendar" => array("icon" => "/calendar/calendar2.png"), "image_gallery" => array("icon" => "/images/image7.png"), "push_notification" => array("name" => "Push", "icon" => "/push_notifications/push3.png"), "video_gallery" => array(), "newswall" => array("name" => "News"), "facebook" => array()), "fitness" => array("newswall" => array("icon" => "/fanwall/fanwall2.png"), "loyalty" => array("icon" => "/loyalty/loyalty2.png"), "push_notification" => array("name" => "Push Notifications", "icon" => "/push_notifications/push5.png"), "discount" => array("name" => "Coupons", "icon" => "/discount/discount4.png"), "facebook" => array(), "fanwall" => array("name" => "Activity", "icon" => "/fanwall/fanwall4.png"), "custom_page" => array("name" => "About us"), "source_code" => array("name" => "BMI", "icon" => "/booking/booking4.png"), "image_gallery" => array("icon" => "/images/image4.png"), "video_gallery" => array("icon" => "/videos/video2.png"), "contact" => array()), "grande_palace" => array("newswall" => array("background_image" => "/../../images/templates/grande_palace/content/bg.png"), "discount" => array("icon" => "/discount/discount4.png", "background_image" => "/../../images/templates/grande_palace/content/bg.png"), "loyalty" => array("icon" => "/loyalty/loyalty5.png", "background_image" => "/../../images/templates/grande_palace/content/bg.png"), "folder" => array("name" => "Infos", "icon" => "/../../images/templates/grande_palace/icons/infos.png", "background_image" => "/../../images/templates/grande_palace/content/bg.png"), "booking" => array("background_image" => "/../../images/templates/grande_palace/content/bg.png"), "form" => array("name" => "Feedbacks", "icon" => "/form/form3.png", "background_image" => "/../../images/templates/grande_palace/content/bg.png"), "push_notification" => array("icon" => "/push_notifications/push5.png", "background_image" => "/../../images/templates/grande_palace/content/bg.png"), "contact" => array()), "jewellery" => array("m_commerce" => array("name" => "Shop", "icon" => "/../../images/templates/jewellery/icons/shop.png"), "discount" => array("name" => "Coupons", "icon" => "/discount/discount3.png"), "form" => array("name" => "Pre-order"), "image_gallery" => array("name" => "Gallery", "icon" => "/images/image3.png"), "places" => array("name" => "Locations"), "custom_page" => array("name" => "About")), "paris" => array("custom_page" => array("name" => "The City"), "video_gallery" => array("icon" => "/videos/video5.png"), "calendar" => array(), "places" => array(), "fanwall" => array("name" => "Activity Wall", "icon" => "/fanwall/fanwall2.png"), "push_notification" => array("name" => "Messages", "icon" => "/push_notifications/push3.png"), "image_gallery" => array("icon" => "/images/image5.png"), "radio" => array(), "weblink_multi" => array(), "folder" => array("icon" => "/folders/folder5.png")), "pizza" => array("m_commerce" => array("name" => "Orders"), "loyalty" => array("name" => "Loyalty"), "social_gaming" => array(), "discount" => array(), "facebook" => array(), "contact" => array()), "publisher" => array("newswall" => array(), "image_gallery" => array("name" => "Portfolio", "icon" => "/images/image5.png"), "catalog" => array("icon" => "/../../images/templates/publisher/icons/catalog.png"), "push_notification" => array("name" => "Push"), "custom_page" => array("name" => "Custom"), "rss_feed" => array(), "facebook" => array(), "form" => array(), "contact" => array()), "real_estate_one" => array("custom_page" => array("name" => "About", "icon" => "/../../images/templates/real_estate_one/icons/about.png"), "newswall" => array("name" => "New Rentals", "icon" => "/newswall/newswall2.png"), "push_notification" => array("name" => "Push", "icon" => "/push_notifications/push5.png"), "form" => array("name" => "Your needs", "icon" => "/form/form2.png"), "booking" => array("name" => "Appointment"), "image_gallery" => array("name" => "Properties", "icon" => "/images/image3.png"), "contact" => array(), "facebook" => array()), "rush_cafe" => array("newswall" => array(), "loyalty" => array("icon" => "/loyalty/loyalty6.png"), "push_notification" => array("name" => "Notifications", "icon" => "/push_notifications/push2.png"), "catalog" => array(), "set_meal" => array(), "discount" => array("name" => "Coupons"), "facebook" => array(), "fanwall" => array(), "form" => array("icon" => "/form/form3.png"), "places" => array(), "contact" => array()), "surgery" => array("custom_page" => array("name" => "About us"), "discount" => array("name" => "Specials", "icon" => "/discount/discount3.png"), "form" => array("name" => "Requests", "icon" => "/form/form2.png"), "image_gallery" => array("name" => "Galleries", "icon" => "/images/image7.png"), "padlock" => array("name" => "Restricted"), "places" => array("name" => "Locations"), "booking" => array(), "contact" => array()), "university" => array("custom_page" => array("name" => "Studies", "icon" => "/newswall/newswall4.png"), "newswall" => array(), "rss_feed" => array(), "radio" => array(), "calendar" => array("icon" => "/calendar/calendar3.png"), "folder" => array("icon" => "/folders/folder4.png"), "push_notification" => array("name" => "Notifications"), "facebook" => array(), "fanwall" => array("icon" => "/fanwall/fanwall2.png"), "image_gallery" => array("icon" => "/images/image4.png"), "video_gallery" => array("icon" => "/videos/video5.png"), "form" => array("name" => "Requests", "icon" => "/form/form2.png"))); foreach ($design_codes as $design_code => $option_codes) { foreach ($option_codes as $option_code => $option_infos) { $design = new Template_Model_Design(); $design->find($design_code, "code"); $option = new Application_Model_Option(); $options = $option->findAll(array("code IN (?)" => $option_code)); foreach ($options as $option) { $icon_id = NULL; if (isset($option_infos["icon"])) { $icon = new Media_Model_Library_Image(); $icon->find($option_infos["icon"], "link"); if (!$icon->getData()) { $icon->setLibraryId($option->getLibraryId())->setLink($option_infos["icon"])->setOptionId($option->getId())->setCanBeColorized(1)->setPosition(0)->save(); } $icon_id = $icon->getId(); } $data = array("design_id" => $design->getId(), "option_id" => $option->getId(), "option_tabbar_name" => isset($option_infos["name"]) ? $option_infos["name"] : NULL, "option_icon" => $icon_id, "option_background_image" => isset($option_infos["background_image"]) ? $option_infos["background_image"] : NULL); $this->_db->insert("template_design_content", $data); } } } $design_codes = array("zenstitut", "hairdresser", "fall_wedding", "purple_croco", "grand_palace", "white_shadow", "side_brown"); foreach ($design_codes as $design_code) { $design = new Template_Model_Design(); $design->find($design_code, "code")->delete(); }