本文整理汇总了PHP中Application_Model_Option类的典型用法代码示例。如果您正苦于以下问题:PHP Application_Model_Option类的具体用法?PHP Application_Model_Option怎么用?PHP Application_Model_Option使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Application_Model_Option类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: getOptions
public function getOptions()
{
if (!$this->_options) {
$option = new Application_Model_Option();
$this->_options = $option->findAll(array("category_id = ?" => $this->getId()));
}
return $this->_options;
}
开发者ID:bklein01,项目名称:siberian_cms_2,代码行数:8,代码来源:Category.php
示例2: 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);
}
开发者ID:bklein01,项目名称:siberian_cms_2,代码行数:12,代码来源:ListController.php
示例3: 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();
}
}
}
}
}
开发者ID:bklein01,项目名称:siberian_cms_2,代码行数:52,代码来源:Folder.php
示例4: 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);
}
开发者ID:bklein01,项目名称:siberian_cms_2,代码行数:32,代码来源:HomeController.php
示例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();
}
}
开发者ID:bklein01,项目名称:siberian_cms_2,代码行数:40,代码来源:Page.php
示例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);
}
}
开发者ID:bklein01,项目名称:siberian_cms_2,代码行数:36,代码来源:AclController.php
示例7: Application_Model_Option
<?php
$option = new Application_Model_Option();
$option->find("custom_page", "code");
$option->setMobileUri("cms/mobile_page_view/")->save();
开发者ID:bklein01,项目名称:siberian_cms_2,代码行数:5,代码来源:database.1.2.0.php
示例8: 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));
}
}
开发者ID:bklein01,项目名称:siberian_cms_2,代码行数:31,代码来源:ApplicationController.php
示例9: Application_Model_Option
<?php
$application_option = new Application_Model_Option();
$application_option->find("topic", "code");
$application_option->setMobileUri("topic/mobile_list/")->save();
开发者ID:bklein01,项目名称:siberian_cms_2,代码行数:5,代码来源:database.3.8.1.php
示例10: array
<?php
$layouts = array();
$option = new Application_Model_Option();
$option->find("wordpress", "code");
foreach (array(1, 2, 3) as $layout_code) {
$layouts[] = array("code" => $layout_code, "option_id" => $option->getId(), "name" => "Layout {$layout_code}", "preview" => "/customization/layout/wordpress/layout-{$layout_code}.png", "position" => $layout_code);
}
foreach ($layouts as $data) {
$this->_db->insert("application_option_layout", $data);
}
开发者ID:bklein01,项目名称:siberian_cms_2,代码行数:11,代码来源:database.3.13.0.php
示例11: Media_Model_Library
<?php
$media_library = new Media_Model_Library();
$media_library->setName("Code Scan")->save();
$icon_id = null;
$files_icon = new DirectoryIterator(Core_Model_Directory::getBasePathTo("images/library/code_scan"));
foreach ($files_icon as $file) {
if ($file->isDot()) {
continue;
}
$icon = new Media_Model_Library_Image();
$icon_data = array("library_id" => $media_library->getId(), "link" => "/code_scan/" . $file->getFilename(), "can_be_colorized" => 1);
$icon->setData($icon_data)->save();
if ($icon_id == null) {
$icon_id = $icon->getId();
}
}
$option_data = array("code" => "code_scan", "name" => "Code Scan", "model" => "Codescan_Model_Codescan", "library_id" => $media_library->getId(), "icon_id" => $icon_id, "desktop_uri" => "codescan/application/", "mobile_uri" => "codescan/mobile_view/", "position" => 150);
$option = new Application_Model_Option();
$option->setData($option_data)->save();
开发者ID:bklein01,项目名称:siberian_cms_2,代码行数:20,代码来源:database.3.11.0.install.php
示例12: 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();
}
}
}
}
开发者ID:bklein01,项目名称:siberian_cms_2,代码行数:49,代码来源:Category.php
示例13: array
}
if (isset($opts->clinic_text_block)) {
$values = array('name' => 'Блок на главной странице', 'alias' => 'index', 'text' => '<h3>Как долго делается коронка?</h3><p>На первом приёме врач-ортодонт делает слепок пациенту. Слепок передаётся технику, который изготавливает коронку. Весь процесс занимает 4—7 дней. В этот промежуток, пацтиент выбирает — ходить без зуба или поставить временную пломбу. Готовую коронку одевают на следующем приёме, подтачивают детали. Процесс вставки безболезненный.</p>');
$block = Application_Model_TextBlock::create();
foreach ($values as $name => $value) {
$block->{'set' . ucfirst($name)}($value);
}
$block->show();
}
if (isset($opts->remove_clinic_text_block)) {
$block = Application_Model_TextBlock::getByAlias('index');
$block->remove();
}
if (isset($opts->create_advice_galleries)) {
$list = Application_Model_Medical_Advice::getList();
foreach ($list as $advice) {
/**
* @var Application_Model_Medical_Advice $advice
*/
$advice->setGallery(RM_Gallery::create());
$advice->save();
}
}
if (isset($opts->second_phone)) {
$option = Application_Model_Option::create();
$option->getContent()->setName('Дополнительный телефон');
$option->setOptionKey('second-phone');
$option->getContent()->setValue('+7 (999) 999 99 99');
$option->save();
}
exit;
开发者ID:Rademade,项目名称:MedOptima,代码行数:31,代码来源:cli.php
示例14: array_keys
<?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);
}
开发者ID:bklein01,项目名称:siberian_cms_2,代码行数:11,代码来源:database.3.7.1.php
示例15: foreach
$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();
}
开发者ID:bklein01,项目名称:siberian_cms_2,代码行数:31,代码来源:database.3.8.0.install.php
示例16:
<?php
require_once 'define.php';
use Application_Model_Option as Option;
$option = Option::create();
$option->getContent()->setName('Префикс телефона');
$option->setOptionKey('phone-prefix');
$option->getContent()->setValue('(8452)');
$option->save();
$option = Option::create();
$option->getContent()->setName('Телефон без префикса');
$option->setOptionKey('phone-without-prefix');
$option->getContent()->setValue('47-77-88');
$option->save();
$option = Option::create();
$option->getContent()->setName('Телефон с префиксом');
$option->setOptionKey('phone-with-prefix');
$option->getContent()->setValue('(8452) 47-77-88');
$option->save();
$option = Option::create();
$option->getContent()->setName('Email');
$option->setOptionKey('email');
$option->getContent()->setValue('[email protected]');
$option->save();
$option = Option::create();
$option->getContent()->setName('Адрес');
$option->setOptionKey('address');
$option->getContent()->setValue('улица Тархова 39, Саратов, Россия, 162539');
$option->save();
开发者ID:Rademade,项目名称:MedOptima,代码行数:29,代码来源:options.php
示例17: 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();
}
}
}
开发者ID:bklein01,项目名称:siberian_cms_2,代码行数:12,代码来源:Product.php
示例18: int
<?php
$this->query("\n CREATE TABLE `wordpress` (\n `wp_id` int(11) unsigned NOT NULL AUTO_INCREMENT,\n `value_id` int(11) unsigned NOT NULL,\n `url` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',\n `created_at` datetime NOT NULL,\n `updated_at` datetime NOT NULL,\n PRIMARY KEY (`wp_id`),\n KEY `KEY_VALUE_ID` (`value_id`)\n ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;\n\n CREATE TABLE `wordpress_category` (\n `category_id` int(11) unsigned NOT NULL AUTO_INCREMENT,\n `wp_id` int(11) unsigned NOT NULL,\n `wp_category_id` int(11) NOT NULL,\n `position` tinyint(1) unsigned NOT NULL DEFAULT '0',\n PRIMARY KEY (`category_id`),\n KEY `KEY_WP_ID` (`wp_id`)\n ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;\n");
$this->query("\n ALTER TABLE `wordpress`\n ADD FOREIGN KEY `FK_VALUE_ID` (`value_id`) REFERENCES `application_option_value` (`value_id`) ON DELETE CASCADE ON UPDATE CASCADE;\n");
$this->query("\n ALTER TABLE `wordpress_category`\n ADD FOREIGN KEY `FK_WP_ID` (`wp_id`) REFERENCES `wordpress` (`wp_id`) ON DELETE CASCADE ON UPDATE CASCADE;\n");
$library = new Media_Model_Library();
$library->setName('Wordpress')->save();
$icon_paths = array('/wordpress/wordpress1.png');
$icon_id = 0;
foreach ($icon_paths as $key => $icon_path) {
$datas = array('library_id' => $library->getId(), 'link' => $icon_path, 'can_be_colorized' => 1);
$image = new Media_Model_Library_Image();
$image->setData($datas)->save();
if ($key == 0) {
$icon_id = $image->getId();
}
}
$category = new Application_Model_Option_Category();
$category->find("integration", "code");
$data = array('category_id' => $category->getId(), 'library_id' => $library->getId(), 'icon_id' => $icon_id, 'code' => "wordpress", 'name' => "Wordpress", 'model' => "Wordpress_Model_Wordpress", 'desktop_uri' => "wordpress/application/", 'mobile_uri' => "wordpress/mobile_list/", 'only_once' => 0, 'is_ajax' => 1, 'position' => 170, 'social_sharing_is_available' => 1);
$option = new Application_Model_Option();
$option->setData($data)->save();
$layouts = array();
foreach (array(1, 2, 3) as $layout_code) {
$layouts[] = array("code" => $layout_code, "option_id" => $option->getId(), "name" => "Layout {$layout_code}", "preview" => "/customization/layout/wordpress/layout-{$layout_code}.png", "position" => $layout_code);
}
foreach ($layouts as $data) {
$this->_db->insert("application_option_layout", $data);
}
开发者ID:bklein01,项目名称:siberian_cms_2,代码行数:29,代码来源:database.3.15.0.install.php
示例19: 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));
}
}
开发者ID:BeamlabsTigre,项目名称:Webapp,代码行数:26,代码来源:FeaturesController.php
示例20: Media_Model_Library
<?php
$media_library = new Media_Model_Library();
$media_library->setName("Code Scan")->save();
$icon_id = null;
$files_icon = new DirectoryIterator(Core_Model_Directory::getBasePathTo("images/library/code_scan"));
foreach ($files_icon as $file) {
if ($file->isDot()) {
continue;
}
$icon = new Media_Model_Library_Image();
$icon_data = array("library_id" => $media_library->getId(), "link" => "/code_scan/" . $file->getFilename(), "can_be_colorized" => 1);
$icon->setData($icon_data)->save();
if ($icon_id == null) {
$icon_id = $icon->getId();
}
}
$option = new Application_Model_Option();
$all_options = $option->findAll("", "position DESC");
$option_data = array("code" => "code_scan", "name" => "Code Scan", "model" => "Codescan_Model_Codescan", "library_id" => $media_library->getId(), "icon_id" => $icon_id, "desktop_uri" => "codescan/application/", "mobile_uri" => "codescan/mobile_view/", "position" => $all_options[0]->getPosition() + 10);
$option->setData($option_data)->save();
开发者ID:bklein01,项目名称:siberian_cms_2,代码行数:21,代码来源:database.3.3.0.php
注:本文中的Application_Model_Option类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论