本文整理汇总了PHP中Application_Model_Option::findAll方法的典型用法代码示例。如果您正苦于以下问题:PHP Application_Model_Option::findAll方法的具体用法?PHP Application_Model_Option::findAll怎么用?PHP Application_Model_Option::findAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Application_Model_Option
的用法示例。
在下文中一共展示了Application_Model_Option::findAll方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例2: findAction
public function findAction()
{
$previews = new Preview_Model_Preview();
$data = array();
if ($this->getRequest()->getParam("preview_id")) {
$previews = $previews->findAll(array("aop.preview_id" => $this->getRequest()->getParam("preview_id")));
$data_tmp = array();
foreach ($previews as $preview) {
if ($preview->getlibraryId()) {
$images = $preview->findImages();
$images_data = array();
foreach ($images as $image) {
$images_data[] = array("id" => $image->getImageId(), "link" => $image->getlink(), "new" => 0, "to_delete" => 0);
}
}
if ($preview->getPreviewId()) {
$data_tmp[$preview->getLanguageCode()] = array("title" => $preview->getTitle(), "description" => $preview->getDescription(), "language_code" => $preview->getLanguageCode(), "from_database" => 1, "images" => $images_data);
}
}
if (!empty($data_tmp)) {
$data["previews"] = $data_tmp;
}
$data["section_title_one"] = $this->_("Edit the preview");
} else {
$data["section_title_one"] = $this->_("Create a new preview");
$option = new Application_Model_Option();
$option_list = array();
$options = $option->findAll(array(), 'position ASC');
foreach ($options as $option) {
$option_list[$option->getId()] = $option->getName();
}
$data["options"] = $option_list;
}
$data["section_title_two"] = $this->_("Preview images");
$languages = Core_Model_Language::getLanguages();
$language_list = array();
foreach ($languages as $language) {
$language_list[$language->getCode()] = $language->getName();
}
$data["languages"] = $language_list;
$data["current_language"] = Core_Model_Language::getCurrentLanguage();
$this->_sendHtml($data);
}
示例3: DirectoryIterator
<?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();
示例4: array
}
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();
}
}
示例5: int
<?php
$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: INT
<?php
$this->query("\n CREATE TABLE `application_option_category` (\n `category_id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,\n `code` VARCHAR(50) NOT NULL DEFAULT 1,\n `name` VARCHAR(50) NOT NULL,\n `icon` VARCHAR(255) NOT NULL,\n `position` TINYINT(1) NOT NULL DEFAULT 1,\n `created_at` datetime NOT NULL,\n `updated_at` datetime NOT NULL,\n PRIMARY KEY (`category_id`)\n ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;\n");
$categories = array(array("code" => "social", "name" => "Social", "icon" => "icon-share", "position" => 10, "features" => array("newswall", "fanwall", "social_gaming", "facebook")), array("code" => "media", "name" => "Media", "icon" => "icon-play", "position" => 20, "features" => array("image_gallery", "video_gallery", "music_gallery", "radio", "rss_feed")), array("code" => "contact", "name" => "Contact", "icon" => "icon-phone", "position" => 30, "features" => array("contact", "push_notification", "inapp_messages", "topic", "booking", "form")), array("code" => "monetization", "name" => "Monetization", "icon" => "icon-money", "position" => 40, "features" => array("m_commerce", "discount", "catalog", "set_meal", "loyalty", "qr_discount")), array("code" => "customization", "name" => "Customization", "icon" => "icon-edit", "position" => 50, "features" => array("custom_page", "source_code")), array("code" => "integration", "name" => "Integration", "icon" => "icon-globe", "position" => 60, "features" => array("weblink_mono", "weblink_multi", "wordpress", "magento", "woocommerce", "volusion", "shopify", "prestashop")), array("code" => "events", "name" => "Events", "icon" => "icon-calendar", "position" => 70, "features" => array("calendar")), array("code" => "misc", "name" => "Misc", "icon" => "icon-code", "position" => 80, "features" => array("folder", "padlock", "places", "code_scan")));
$this->query("ALTER TABLE `application_option` ADD `category_id` INT(11) UNSIGNED NOT NULL AFTER `option_id`;");
foreach ($categories as $category_data) {
$category = new Application_Model_Option_Category();
$category->setData($category_data)->save();
foreach ($category_data["features"] as $feature_code) {
$this->_db->update("application_option", array("category_id" => $category->getId()), array("code = ?" => $feature_code));
}
}
$option = new Application_Model_Option();
$options = $option->findAll(array("uncategorized" => new Zend_Db_Expr("category_id = 0")));
if ($options->count() > 0) {
$category = new Application_Model_Option_Category();
$category->setData(array("code" => "other", "name" => "Other", "icon" => "icon-circle", "position" => 1000))->save();
$this->_db->update("application_option", array("category_id" => $category->getId()), array("category_id = ?" => "0"));
}
$this->query("\n ALTER TABLE `application_option`\n ADD CONSTRAINT `FK_APPLICATION_OPTION_CATEGORY_ID`\n FOREIGN KEY (`category_id`) REFERENCES `application_option_category` (`category_id`) ON UPDATE CASCADE ON DELETE CASCADE;\n");