本文整理汇总了PHP中Application_Model_Option::getCode方法的典型用法代码示例。如果您正苦于以下问题:PHP Application_Model_Option::getCode方法的具体用法?PHP Application_Model_Option::getCode怎么用?PHP Application_Model_Option::getCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Application_Model_Option
的用法示例。
在下文中一共展示了Application_Model_Option::getCode方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: findallAction
public function findallAction()
{
$option_values = $this->getApplication()->getPages(10);
$data = array('pages' => array());
$color = $this->getApplication()->getBlock('tabbar')->getImageColor();
$background_color = $this->getApplication()->getBlock('tabbar')->getBackgroundColor();
foreach ($option_values as $option_value) {
$data['pages'][] = array('value_id' => $option_value->getId(), 'id' => intval($option_value->getId()), 'code' => $option_value->getCode(), 'name' => $option_value->getTabbarName(), 'is_active' => $option_value->isActive(), 'url' => $option_value->getUrl(null, array('value_id' => $option_value->getId()), false), 'path' => $option_value->getPath(null, array('value_id' => $option_value->getId()), false), 'icon_url' => $this->_getColorizedImage($option_value->getIconId(), $color), 'icon_is_colorable' => $option_value->getImage()->getCanBeColorized(), 'is_locked' => $option_value->isLocked(), 'is_link' => !$option_value->getIsAjax(), 'position' => $option_value->getPosition());
}
$option = new Application_Model_Option();
$option->findTabbarMore();
$data['more_items'] = array('code' => $option->getCode(), 'name' => $option->getTabbarName(), 'is_active' => $option->isActive(), 'url' => "", 'icon_url' => $this->_getColorizedImage($option->getIconUrl(), $color), 'icon_is_colorable' => 1);
$option = new Application_Model_Option();
$option->findTabbarAccount();
$data['customer_account'] = array('code' => $option->getCode(), 'name' => $option->getTabbarName(), 'is_active' => $option->isActive(), 'url' => $this->getUrl("customer/mobile_account_login"), 'path' => $this->getPath("customer/mobile_account_login"), 'login_url' => $this->getUrl("customer/mobile_account_login"), 'login_path' => $this->getPath("customer/mobile_account_login"), 'edit_url' => $this->getUrl("customer/mobile_account_edit"), 'edit_path' => $this->getPath("customer/mobile_account_edit"), 'icon_url' => $this->_getColorizedImage($option->getIconUrl(), $color), 'icon_is_colorable' => 1, 'is_visible' => $this->getApplication()->usesUserAccount());
$layout = new Application_Model_Layout_Homepage();
$layout->find($this->getApplication()->getLayoutId());
$data['layout'] = array("layout_id" => "l{$this->getApplication()->getLayoutId()}", "visibility" => $this->getApplication()->getLayoutVisibility(), "use_horizontal_scroll" => (int) $layout->getUseHorizontalScroll(), "position" => $layout->getPosition());
$data['limit_to'] = $this->getApplication()->getLayout()->getNumberOfDisplayedIcons();
$data['layout_id'] = 'l' . $this->getApplication()->getLayoutId();
$data['tabbar_is_transparent'] = $background_color == "transparent";
$data['homepage_slider_is_visible'] = (bool) $this->getApplication()->getHomepageSliderIsVisible();
$data['homepage_slider_duration'] = $this->getApplication()->getHomepageSliderDuration();
$data['homepage_slider_loop_at_beginning'] = (bool) $this->getApplication()->getHomepageSliderLoopAtBeginning();
$homepage_slider_images = array();
$slider_images = $this->getApplication()->getSliderImages();
foreach ($slider_images as $slider_image) {
$homepage_slider_images[] = $slider_image->getLink();
}
$data['homepage_slider_images'] = $homepage_slider_images;
$this->_sendHtml($data);
}
示例2: createDummyContents
public function createDummyContents($option_value, $design, $category)
{
$option = new Application_Model_Option();
$option->find($option_value->getOptionId());
$dummy_content_xml = $this->_getDummyXml($design, $category);
if ($option->getCode() == 'places' && $dummy_content_xml->places) {
foreach ($dummy_content_xml->places->children() as $content) {
$this->unsData();
$blocks = array();
$i = 1;
foreach ($content->block as $block_content) {
$block = new Cms_Model_Application_Block();
$block->find((string) $block_content->type, "type");
$data = (array) $block_content;
if ($block_content->image_url) {
$data['image_url'] = (array) $block_content->image_url;
$data['image_fullsize_url'] = (array) $block_content->image_fullsize_url;
}
$data["block_id"] = $block->getId();
$blocks[$i++] = $data;
}
$this->addData((array) $content->content)->setBlock($blocks)->setValueId($option_value->getId())->save();
}
} else {
$blocks = array();
$i = 1;
foreach ($dummy_content_xml->blocks->children() as $content) {
$block = new Cms_Model_Application_Block();
$block->find((string) $content->type, "type");
$data = (array) $content;
if ($content->image_url) {
$data['image_url'] = (array) $content->image_url;
$data['image_fullsize_url'] = (array) $content->image_fullsize_url;
}
$data["block_id"] = $block->getId();
$blocks[$i++] = $data;
}
$this->setValueId($option_value->getId())->setBlock($blocks)->save();
}
}
示例3: createDummyContents
public function createDummyContents($option_value, $design, $category)
{
$option = new Application_Model_Option();
$option->find($option_value->getOptionId());
$dummy_content_xml = $this->_getDummyXml($design, $category);
if ($option->getCode() == "catalog") {
foreach ($dummy_content_xml->catalog->children() as $categories) {
$this->unsData();
//check si la category existe sur cette app
$category_data = array("name" => $categories->name, "value_id" => $option_value->getId());
$category_id = $this->find($category_data)->getCategoryId();
if (!$category_id) {
$this->setName((string) $categories->name)->setValueId($option_value->getId())->save();
$category_id = $this->getId();
}
foreach ($categories->products->children() as $product) {
$product_model = new Catalog_Model_Product();
if ($product->attributes()->subcategory) {
$sub_category_model = new Catalog_Model_Category();
//check si la sous category existe sur cette app
$subcategory_data = array("name" => $product->attributes()->subcategory, "value_id" => $option_value->getId());
$sub_category_model->find($subcategory_data);
if (!$sub_category_model->getCategoryId()) {
$sub_category_model->setName($product->attributes()->subcategory)->setValueId($option_value->getId())->setParentId($category_id)->save();
$product_model->setCategoryId($sub_category_model->getId());
} else {
$sub_category_model->setParentId($category_id)->save();
$product_model->setCategoryId($sub_category_model->getId());
}
} else {
$product_model->setCategoryId($category_id);
}
foreach ($product->content->children() as $key => $value) {
$product_model->addData((string) $key, (string) $value);
}
if ($product->formats) {
$format_option = array();
foreach ($product->formats->children() as $format) {
foreach ($format as $key => $val) {
$format_option[$format->getName()][(string) $key] = (string) $val;
}
}
$product_model->setOption($format_option);
}
$product_model->setValueId($option_value->getId())->save();
}
}
}
}
示例4: createDummyContents
public function createDummyContents($option_value, $design, $category)
{
$option = new Application_Model_Option();
$option->find($option_value->getOptionId());
$dummy_content_xml = $this->_getDummyXml($design, $category);
if ($option->getCode() == "set_meal") {
foreach ($dummy_content_xml->set_meal->children() as $content) {
$this->unsData();
$this->addData((array) $content)->setValueId($option_value->getId())->save();
}
}
}
示例5: int
$this->query("\n CREATE TABLE `acl_resource` (\n `resource_id` int(11) unsigned NOT NULL AUTO_INCREMENT,\n `parent_id` int(11) unsigned DEFAULT NULL,\n `code` varchar(50) COLLATE utf8_unicode_ci NOT NULL,\n `label` varchar(255) COLLATE utf8_unicode_ci NOT NULL,\n `url` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,\n PRIMARY KEY (resource_id)\n ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;\n");
$this->query("\n CREATE TABLE `acl_role` (\n `role_id` int(11) unsigned NOT NULL AUTO_INCREMENT,\n `code` varchar(50) COLLATE utf8_unicode_ci NOT NULL,\n `label` varchar(255) COLLATE utf8_unicode_ci NOT NULL,\n PRIMARY KEY(role_id)\n ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;\n");
$this->query("\n INSERT INTO `acl_role` (`code`, `label`) VALUES ('Admin', 'Administrator : full access');\n");
$this->query("\n CREATE TABLE `acl_resource_role` (\n `resource_id` int(11) unsigned NOT NULL,\n `role_id` int(11) unsigned NOT NULL,\n PRIMARY KEY(resource_id,role_id)\n ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;\n");
$this->query("\n ALTER TABLE `acl_resource_role`\n ADD CONSTRAINT `FK_RESOURCE_ROLE_RESOURCE_ID` FOREIGN KEY (`resource_id`) REFERENCES `acl_resource` (`resource_id`) ON DELETE CASCADE ON UPDATE CASCADE,\n ADD CONSTRAINT `FK_RESOURCE_ROLE_ROLE_ID` FOREIGN KEY (`role_id`) REFERENCES `acl_role` (`role_id`) ON DELETE CASCADE ON UPDATE CASCADE;\n");
$this->query("\n ALTER TABLE `admin` \n ADD `role_id` INT(11) UNSIGNED NOT NULL DEFAULT '1' AFTER `parent_id`, \n ADD INDEX (`role_id`);\n");
$resource_data = array(array("code" => "application", "label" => "Manage applications", "children" => array(array("code" => "application_create", "label" => "Create an application", "url" => "admin/application/createpost"), array("code" => "application_delete", "label" => "Delete an application", "url" => "admin/application/delete"))), array("code" => "editor", "label" => "Access the application editor", "children" => array(array("code" => "editor_design", "label" => "Access the Design tab", "url" => "application/customization_design_style/edit"), array("code" => "editor_colors", "label" => "Access the Colors tab", "url" => "application/customization_design_colors/edit"), array("code" => "editor_features", "label" => "Access the Features tab", "url" => "application/customization_features/list"), array("code" => "editor_application", "label" => "Access the Application tab", "url" => "application/customization_publication_app/index"), array("code" => "editor_publication", "label" => "Access the Publication tab", "url" => "application/customization_publication_infos/index"), array("code" => "editor_settings", "label" => "Access the settings from the editor", "children" => array(array("code" => "editor_settings_tc", "label" => "Access the Terms & Conditions tab", "url" => "application/settings_tc/*"), array("code" => "editor_settings_facebook", "label" => "Access the Facebook tab", "url" => "application/settings_facebook/*"), array("code" => "editor_settings_domain", "label" => "Access the Domain tab", "url" => "application/settings_domain/*"))))), array("code" => "admin_access_management", "label" => "Manage the editor users", "url" => "admin/access_management/*"), array("code" => "analytics", "label" => "Analytics page", "url" => "application/settings_facebook/*"), array("code" => "promote", "label" => "Promote page", "url" => "application/promote/*"), array("code" => "users", "label" => "Users page", "url" => "customer/application/list"), array("code" => "support", "label" => "Support"));
if (Siberian_Version::TYPE == "PE") {
$resource_data[] = array("code" => "sales_invoice", "label" => "List, open and print the invoices", "url" => "sales/admin_invoice/*");
}
$option = new Application_Model_Option();
$options = $option->findAll();
$features_resources = array("code" => "feature", "label" => "Features", "children" => array());
foreach ($options as $option) {
$features_resources["children"][] = array("code" => "feature_" . $option->getCode(), "label" => $option->getname(), "url" => $option->getDesktopUri() . "*");
}
$resource_data[] = $features_resources;
foreach ($resource_data as $data) {
$resource = new Acl_Model_Resource();
$resource->setData($data)->save();
if (!empty($data["children"])) {
foreach ($data["children"] as $child_resource) {
$child = new Acl_Model_Resource();
$child->setData($child_resource)->setParentId($resource->getId())->save();
if (!empty($child_resource["children"])) {
foreach ($child_resource["children"] as $child_child_resource) {
$child_child = new Acl_Model_Resource();
$child_child->setData($child_child_resource)->setParentId($child->getId())->save();
}
}
示例6: createDummyContents
public function createDummyContents($category)
{
$design = $this->getDesign();
$design_content = new Template_Model_Design_Content();
$design_contents = $design_content->findAll(array('design_id' => $design->getDesignId()));
foreach ($design_contents as $content) {
$option_value = new Application_Model_Option_Value();
$option = new Application_Model_Option();
$option->find($content->getOptionId());
if (!$option->getId()) {
continue;
}
$option_value->setOptionId($content->getOptionId())->setAppId($this->getApplication()->getId())->setTabbarName($content->getOptionTabbarName())->setIconId($content->getOptionIcon())->setBackgroundImage($content->getOptionBackgroundImage())->save();
if ($option->getModel() && $option->getCode() != "push_notification") {
$option->getObject()->createDummyContents($option_value, $design, $category);
}
}
}
示例7: saveAction
public function saveAction()
{
if ($data = Zend_Json::decode($this->getRequest()->getRawBody())) {
try {
$previews = $data["previews"];
$option_id = !empty($data["option_id"]) ? $data["option_id"] : null;
$preview_id = !empty($data["preview_id"]) ? $data["preview_id"] : null;
if (empty($previews)) {
throw new Exception($this->_("An error occurred while saving your previews. Please try again later."));
}
$preview = new Preview_Model_Preview();
if (!empty($option_id) and empty($preview_id)) {
//No preview for this option yet, we create one if it doesn't exists.
$preview->find($option_id, "option_id");
if ($preview->getId()) {
throw new Exception($this->_("Sorry, but an existing preview for this feature has been found. Please edit existing one."));
}
$preview->setData("option_id", $option_id);
} else {
//Existing preview
if (!empty($preview_id)) {
$preview->find($data["preview_id"]);
} else {
throw new Exception($this->_("An error occurred while saving your previews. Please try again later."));
}
}
$previews_language_data = array();
foreach ($previews as $language_code => $data) {
$option = new Application_Model_Option();
$option->find($preview->getOptionId());
if ($preview->getId()) {
$library_id = $preview->findLibraryIdByLanguageCode($language_code);
} else {
$library_id = null;
}
if (!$library_id) {
$library = new Media_Model_Library();
$library->setName('preview_' . $language_code . '_' . $option->getCode())->save();
$data["library_id"] = $library->getId();
} else {
$data["library_id"] = $library_id;
}
//IMAGES------------------------------------------------
foreach ($data["images"] as $key => $image) {
$library_image = new Media_Model_Library_Image();
//We only copy new files
if ($image["new"] == 1) {
$old_path = Core_Model_Directory::getTmpDirectory(true);
$new_path = Core_Model_Directory::getBasePathTo("images/previews/" . $language_code . "/" . $option->getCode());
$new_path_base = Core_Model_Directory::getPathTo("images/previews/" . $language_code . "/" . $option->getCode());
if (!is_dir($new_path)) {
if (!@mkdir($new_path, 0777, true)) {
throw new Exception($this->_("Unable to create the directory."));
}
}
if (!@rename($old_path . "/" . $image["filename"], $new_path . "/" . $image["filename"])) {
throw new Exception($this->_("Unable to copy the file."));
}
$data_image = array("library_id" => $data["library_id"], "link" => $new_path_base . "/" . $image["filename"], "can_be_colorized" => 0, "position" => $key);
$library_image->setData($data_image)->save();
} else {
//For existing images, we save position
$library_image->find($image["id"]);
if ($library_image->getImageId()) {
$library_image->setPosition($key)->save();
}
}
//We delete images to delete
if ($image["to_delete"] == 1 and $image["new"] == 0) {
if (!@unlink(Core_Model_Directory::getBasePathTo($image["link"]))) {
throw new Exception($this->_("Unable to delete the file."));
}
$library_image = new Media_Model_Library_Image();
$library_image->find($image["id"]);
$library_image->delete();
}
}
unset($data["images"]);
//<--IMAGES------------------------------------------------
unset($data["from_database"]);
$data['language_code'] = $language_code;
$data['preview_id'] = $preview->getId();
$previews_language_data[] = $data;
}
$preview->setLanguageData($previews_language_data);
$preview->save();
$data = array("success" => 1, "message" => $this->_("Preview successfully saved"));
} catch (Exception $e) {
$data = array("error" => 1, "message" => $e->getMessage());
}
$this->_sendHtml($data);
}
}