本文整理汇总了PHP中Application_Model_Option::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Application_Model_Option::find方法的具体用法?PHP Application_Model_Option::find怎么用?PHP Application_Model_Option::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Application_Model_Option
的用法示例。
在下文中一共展示了Application_Model_Option::find方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: find
public function find($id, $field = null)
{
parent::find($id, $field);
$this->addOptionDatas();
$this->prepareUri();
return $this;
}
示例2: getDummy
public function getDummy()
{
$color = str_replace('#', '', $this->getApplication()->getBlock('tabbar')->getImageColor());
$option = new Application_Model_Option();
$option->find('newswall', 'code');
$dummy = new self();
$dummy->addData($option->getData())->setTabbarName('Sample')->setIsDummy(1)->setIsActive(1)->setIconUrl(Core_Model_Url::create("template/block/colorize", array('id' => $dummy->getIconId(), 'color' => $color)))->setId(0);
return $dummy;
}
示例3: findallAction
public function findallAction()
{
$preview = new Preview_Model_Preview();
$previews = $preview->findAll(null, array("group_by" => "aop.preview_id"));
$data = array();
foreach ($previews as $preview) {
$option = new Application_Model_Option();
$option->find($preview->getOptionId());
$data[] = array("id" => $preview->getId(), "title" => $preview->getTitle(), "feature" => $preview->getOptionId(), "feature_name" => $option->getName());
}
$this->_sendHtml($data);
}
示例4: createDummyContents
public function createDummyContents($option_value, $design, $category)
{
$dummy_content_xml = $this->_getDummyXml($design, $category);
foreach ($dummy_content_xml->folders->folder as $folder) {
$root_category = new Folder_Model_Category();
$root_category->addData((array) $folder->category->main->content)->save();
if ($folder->category->main->features) {
$i = 1;
foreach ($folder->category->main->features->feature as $feature) {
$option = new Application_Model_Option();
$option->find((string) $feature->code, "code")->getObject();
$option_value_obj = new Application_Model_Option_Value();
$icon_id = NULL;
if ((string) $feature->icon) {
$icon = new Media_Model_Library_Image();
$icon->find((string) $feature->icon, "link");
if (!$icon->getData()) {
$icon->setLibraryId($option->getLibraryId())->setLink((string) $feature->icon)->setOptionId($option->getId())->setCanBeColorized($feature->colorizable ? (string) $feature->colorizable : 1)->setPosition(0)->save();
}
$icon_id = $icon->getId();
}
$datas = array("tabbar_name" => (string) $feature->name ? (string) $feature->name : NULL, "icon_id" => $icon_id, "app_id" => $this->getApplication()->getId(), "option_id" => $option->getId(), "layout_id" => $this->getApplication()->getLayout()->getId(), "folder_id" => $option_value->getId(), "folder_category_id" => $root_category->getId(), "folder_category_position" => $i++);
$option_value_obj->addData($datas)->save();
}
}
$this->unsData();
$this->setValueId($option_value->getId())->setRootCategoryId($root_category->getId())->save();
foreach ($folder->category->subcategory as $subcategory) {
$sub_root_category = new Folder_Model_Category();
$sub_root_category->addData((array) $subcategory->content)->setParentId($root_category->getId())->save();
if ($folder->category->subcategory->features) {
$i = 1;
foreach ($folder->category->subcategory->features->children() as $feature) {
$option = new Application_Model_Option();
$option->find((string) $feature->code, "code")->getObject();
$option_value_obj = new Application_Model_Option_Value();
$icon_id = NULL;
if ((string) $feature->icon) {
$icon = new Media_Model_Library_Image();
$icon->find((string) $feature->icon, "link");
if (!$icon->getData()) {
$icon->setLibraryId($option->getLibraryId())->setLink((string) $feature->icon)->setOptionId($option->getId())->setCanBeColorized(1)->setPosition(0)->save();
}
$icon_id = $icon->getId();
}
$datas = array("tabbar_name" => (string) $feature->name ? (string) $feature->name : NULL, "icon_id" => $icon_id, "app_id" => $this->getApplication()->getId(), "option_id" => $option->getId(), "layout_id" => $this->getApplication()->getLayout()->getId(), "folder_id" => $option_value->getId(), "folder_category_id" => $sub_root_category->getId(), "folder_category_position" => $i++);
$option_value_obj->addData($datas)->save();
}
}
}
}
}
示例5: 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();
}
}
示例6: findaccessAction
public function findaccessAction()
{
if ($data = Zend_Json::decode($this->getRequest()->getRawBody())) {
try {
if (empty($data["admin_id"]) or empty($data["app_id"])) {
throw new Exception($this->_("An error occurred while saving. Please try again later."));
}
$admin = new Admin_Model_Admin();
$admin->find($data["admin_id"]);
$app = new Application_Model_Application();
$app->find($data["app_id"]);
$app_acl_option = new Application_Model_Acl_Option();
$forbidden_options = $app_acl_option->findAllByAppId($data["app_id"], $data["admin_id"]);
$option_tmp = array();
foreach ($forbidden_options as $option) {
$option_tmp[] = $option->getValueId();
}
$forbidden_options = $option_tmp;
$data = array("app_name" => $app->getName(), "user_name" => $admin->getData("firstname") . " " . $admin->getData("lastname"), "can_add_page" => $admin->isAllowedToAddPages($data["app_id"]), "options" => array());
foreach ($app->getOptions() as $option) {
$option_is_allowed = !in_array($option->getValueId(), $forbidden_options);
$option_obj = new Application_Model_Option();
$option_obj->find($option->getOptionId());
if ($option_obj->getId()) {
$icon_url = $option_obj->getIconUrl();
} else {
$icon_url = null;
}
$data["options"][] = array("value_id" => $option->getValueId(), "icon_url" => $icon_url, "name" => $option->getTabbarName() ? $option->getTabbarName() : $option->getName(), "code" => $option->getCode(), "is_allowed" => $option_is_allowed);
}
} catch (Exception $e) {
$data = array("error" => 1, "message" => $e->getMessage());
}
$this->_sendHtml($data);
}
}
示例7: addfeatureAction
public function addfeatureAction()
{
if ($datas = $this->getRequest()->getPost()) {
try {
// Test s'il y a un value_id
if (empty($datas['value_id'])) {
throw new Exception($this->_('An error occurred while saving'));
}
// Récupère l'option_value en cours
$option_value = new Application_Model_Option_Value();
$option_value->find($datas['value_id']);
$category = new Folder_Model_Category();
$category->find($datas['category_id'], 'category_id');
// Récupère l'option_value en cours
$category_option_value = new Application_Model_Option_Value();
$category_option_value->find($datas['category_value_id']);
$next_positon = $category_option_value->getNextFolderCategoryPosition($datas['category_id']);
$option_folder = new Application_Model_Option();
$option_folder->find(array('code' => 'folder'));
$option_folder_id = $option_folder->getOptionId();
if ($category_option_value->getFolderCategoryId() == $datas['category_id'] || $category_option_value->getOptionId() == $option_folder_id) {
throw new Exception($this->_('You cannot add this feature'));
}
$category_option_value->setFolderId($datas['value_id'])->setFolderCategoryPosition($next_positon)->setFolderCategoryId($category->getCategoryId())->save();
$html = array('success' => 1, 'folder_id' => $datas['value_id']);
} catch (Exception $e) {
$html = array('message' => $e->getMessage());
}
$this->getLayout()->setHtml(Zend_Json::encode($html));
}
}
示例8:
<?php
$option = new Application_Model_Option();
$option->find("calendar", "code");
$option->setMobileUri("event/mobile_list/")->save();
示例9: setbackgroundimageAction
public function setbackgroundimageAction()
{
if ($datas = $this->getRequest()->getPost()) {
try {
$option_value = new Application_Model_Option_Value();
$option_value->find($datas['option_id']);
if (!$option_value->getId()) {
throw new Exception($this->_("An error occurred while saving your picture. Please try againg later."));
}
// Récupère l'option
$option = new Application_Model_Option();
$option->find($option_value->getOptionId());
$save_path = '/feature/' . $option->getId() . '/background/';
$relative_path = Application_Model_Application::getImagePath() . $save_path;
$folder = Application_Model_Application::getBaseImagePath() . $save_path;
$datas['dest_folder'] = $folder;
$uploader = new Core_Model_Lib_Uploader();
$file = $uploader->savecrop($datas);
$option_value->setBackgroundImage($save_path . $file)->save();
$datas = array('success' => 1, 'file' => $relative_path . $file);
} catch (Exception $e) {
$datas = array('error' => 1, 'message' => $e->getMessage());
}
$this->getLayout()->setHtml(Zend_Json::encode($datas));
}
}
示例10: varchar
<?php
$fields = array_keys($this->_db->describeTable("application_option"));
if (!in_array("mobile_view_uri", $fields)) {
$this->query("\n ALTER TABLE `application_option` ADD `mobile_view_uri` varchar(100) NULL DEFAULT NULL AFTER `mobile_uri`;\n ALTER TABLE `application_option` ADD `mobile_view_uri_parameter` varchar(100) NULL DEFAULT NULL AFTER `mobile_view_uri`;\n ");
}
$mobile_view_uris = array("booking" => array("mobile_view_uri" => "booking/mobile_view/", "mobile_view_uri_parameter" => null), "calendar" => array("mobile_view_uri" => "event/mobile_view/", "mobile_view_uri_parameter" => "event_id"), "catalog" => array("mobile_view_uri" => "catalog/mobile_category_product_view/", "mobile_view_uri_parameter" => "product_id"), "custom_page" => array("mobile_view_uri" => "cms/mobile_page_view/", "mobile_view_uri_parameter" => null), "discount" => array("mobile_view_uri" => "promotion/mobile_view/", "mobile_view_uri_parameter" => "promotion_id"), "fanwall" => array("mobile_view_uri" => "comment/mobile_view/", "mobile_view_uri_parameter" => "comment_id"), "image_gallery" => array("mobile_view_uri" => "media/mobile_gallery_image_view/", "mobile_view_uri_parameter" => "gallery_id,offset/0"), "m_commerce" => array("mobile_view_uri" => "mcommerce/mobile_product/", "mobile_view_uri_parameter" => "product_id"), "music_gallery" => array("mobile_view_uri" => "media/mobile_api_music_playlist/", "mobile_view_uri_parameter" => "playlist_id"), "newswall" => array("mobile_view_uri" => "comment/mobile_view/", "mobile_view_uri_parameter" => "comment_id"), "qr_discount" => array("mobile_view_uri" => "promotion/mobile_view/", "mobile_view_uri_parameter" => "promotion_id"), "rss_feed" => array("mobile_view_uri" => "rss/mobile_feed_view/", "mobile_view_uri_parameter" => "feed_id"), "set_meal" => array("mobile_view_uri" => "catalog/mobile_setmeal_view/", "mobile_view_uri_parameter" => "set_meal_id"), "video_gallery" => array("mobile_view_uri" => "media/mobile_gallery_video_view/", "mobile_view_uri_parameter" => "gallery_id,offset/1"));
foreach ($mobile_view_uris as $option_code => $option_uris) {
$application_option = new Application_Model_Option();
$application_option->find($option_code, "code");
if ($application_option->getId()) {
$application_option->setMobileViewUri($option_uris["mobile_view_uri"]);
$application_option->setMobileViewUriParameter($option_uris["mobile_view_uri_parameter"]);
$application_option->save();
}
}
示例11:
<?php
$option = new Application_Model_Option();
$option->find("image_gallery", "code");
$option->setMobileUri("media/mobile_gallery_image_list/")->save();
$option = new Application_Model_Option();
$option->find("video_gallery", "code");
$option->setMobileUri("media/mobile_gallery_video_list/")->save();
示例12:
<?php
$option = new Application_Model_Option();
$option->find("catalog", "code");
$option->setModel("Catalog_Model_Category")->save();
示例13: VARCHAR
<?php
$this->query("ALTER TABLE `promotion` ADD `picture` VARCHAR(255) NULL DEFAULT NULL AFTER `title`");
$promotion = new Application_Model_Option();
$promotion->find("discount", "code");
$layouts = array(array("code" => 1, "option_id" => $promotion->getId(), "name" => "Layout 1", "preview" => "/customization/layout/promotion/layout-1.png", "position" => 1), array("code" => 2, "option_id" => $promotion->getId(), "name" => "Layout 2", "preview" => "/customization/layout/promotion/layout-2.png", "position" => 2));
foreach ($layouts as $data) {
$this->_db->insert("application_option_layout", $data);
}
示例14: VARCHAR
<?php
$fields = array_keys($this->_db->describeTable("comment"));
$field = in_array("customer_id", $fields) ? "customer_id" : "value_id";
$this->query("\n ALTER TABLE `comment`\n ADD `title` VARCHAR(100) NULL DEFAULT NULL AFTER `{$field}`,\n ADD `subtitle` VARCHAR(255) NULL DEFAULT NULL AFTER `title`,\n ADD `date` VARCHAR(100) NULL DEFAULT NULL AFTER `image`\n ;\n");
$newswall = new Application_Model_Option();
$newswall->find("newswall", "code");
$layouts = array(array("code" => 1, "option_id" => $newswall->getId(), "name" => "Layout 1", "preview" => "/customization/layout/newswall/layout-1.png", "position" => 1), array("code" => 2, "option_id" => $newswall->getId(), "name" => "Layout 2", "preview" => "/customization/layout/newswall/layout-2.png", "position" => 2));
foreach ($layouts as $data) {
$this->_db->insert("application_option_layout", $data);
}
示例15: getPage
public function getPage($code)
{
$dummy = new Application_Model_Option();
$dummy->find($code, 'code');
$page_sought = new Application_Model_Option_Value();
return $page_sought->find(array('option_id' => $dummy->getId()));
}