public function savesliderimagesAction()
 {
     if ($datas = $this->getRequest()->getPost()) {
         try {
             $url = "";
             $image_id = null;
             $application = $this->getApplication();
             $relative_path = '/' . $application->getId() . '/slider_images/';
             $folder = Application_Model_Application::getBaseImagePath() . $relative_path;
             $datas['dest_folder'] = $folder;
             $uploader = new Core_Model_Lib_Uploader();
             if ($file = $uploader->savecrop($datas)) {
                 $url = Application_Model_Application::getImagePath() . $relative_path . $file;
                 $library = new Media_Model_Library();
                 $library->find($application->getHomepageSliderLibraryId());
                 if (!$library->getId()) {
                     $library->setName('homepage_slider_' . $application->getId())->save();
                     $application->setHomepageSliderLibraryId($library->getId())->save();
                 }
                 $image = new Media_Model_Library_Image();
                 $image->setLibraryId($library->getId())->setLink($url)->setAppId($application->getId())->save();
                 $image_id = $image->getId();
             }
             $datas = array('success' => 1, 'file' => array("id" => $image_id, "url" => $url));
         } catch (Exception $e) {
             $datas = array('error' => 1, 'message' => $e->getMessage());
         }
         $this->getLayout()->setHtml(Zend_Json::encode($datas));
     }
 }
<?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);
}
$this->query("\n    CREATE TABLE `cms_application_block` (\n        `block_id` int(11) unsigned NOT NULL AUTO_INCREMENT,\n        `type` varchar(10) COLLATE utf8_unicode_ci NOT NULL,\n        `position` tinyint(1) unsigned NOT NULL DEFAULT '0',\n        `icon` varchar(255) COLLATE utf8_unicode_ci NOT NULL,\n        `title` varchar(20) COLLATE utf8_unicode_ci NOT NULL,\n        `template` text COLLATE utf8_unicode_ci NOT NULL,\n        `mobile_template` varchar(100) COLLATE utf8_unicode_ci NOT NULL,\n        PRIMARY KEY (`block_id`)\n  ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;\n\n    CREATE TABLE `cms_application_page` (\n        `page_id` int(11) NOT NULL AUTO_INCREMENT,\n        `value_id` int(11) unsigned NOT NULL,\n        `title` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,\n        `content` text COLLATE utf8_unicode_ci,\n        `picture` VARCHAR(255) NULL DEFAULT NULL,\n        `created_at` datetime NOT NULL,\n        `updated_at` datetime NOT NULL,\n        PRIMARY KEY (`page_id`),\n        KEY `KEY_VALUE_ID` (`value_id`)\n    ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;\n");
$this->query("\n    CREATE TABLE `cms_application_page_block` (\n        `value_id` int(11) unsigned NOT NULL AUTO_INCREMENT,\n        `block_id` int(11) unsigned NOT NULL,\n        `page_id` int(11) unsigned NOT NULL,\n        `position` tinyint(1) unsigned NOT NULL DEFAULT '0',\n        PRIMARY KEY (`value_id`)\n    ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;\n\n    CREATE TABLE `cms_application_page_block_address` (\n        `address_id` int(11) unsigned NOT NULL AUTO_INCREMENT,\n        `value_id` int(11) unsigned NOT NULL,\n        `label` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,\n        `address` text COLLATE utf8_unicode_ci NOT NULL,\n        `latitude` VARCHAR(20) NULL DEFAULT NULL,\n        `longitude` VARCHAR(20) NULL DEFAULT NULL,\n        `show_address` tinyint(1) NOT NULL DEFAULT '0',\n        `show_geolocation_button` tinyint(1) NOT NULL DEFAULT '0',\n        PRIMARY KEY (`address_id`),\n        KEY `KEY_VALUE_ID` (`value_id`)\n    ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;\n");
$this->query("\n    CREATE TABLE `cms_application_page_block_image` (\n        `image_id` int(11) unsigned NOT NULL AUTO_INCREMENT,\n        `value_id` int(11) unsigned NOT NULL,\n        `image` varchar(255) COLLATE utf8_unicode_ci NOT NULL,\n        `library_id` int(11) DEFAULT NULL,\n        `description` varchar(255) COLLATE utf8_unicode_ci NOT NULL,\n        `layout` text COLLATE utf8_unicode_ci,\n        PRIMARY KEY (`image_id`),\n        KEY `KEY_VALUE_ID` (`value_id`)\n    ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;\n\n    CREATE TABLE `cms_application_page_block_image_library` (\n        `image_id` int(11) unsigned NOT NULL AUTO_INCREMENT,\n        `library_id` int(11) unsigned NOT NULL,\n        `image_url` varchar(255) COLLATE utf8_unicode_ci NOT NULL,\n        `image_fullsize_url` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,\n        PRIMARY KEY (`image_id`)\n    ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;\n");
$this->query("\n    CREATE TABLE `cms_application_page_block_text` (\n        `text_id` int(11) unsigned NOT NULL AUTO_INCREMENT,\n        `value_id` int(11) unsigned NOT NULL,\n        `content` text COLLATE utf8_unicode_ci NOT NULL,\n        `image` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,\n        `size` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,\n        `alignment` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL,\n        `layout_id` tinyint(1) unsigned NOT NULL,\n        PRIMARY KEY (`text_id`),\n        KEY `KEY_VALUE_ID` (`value_id`)\n    ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;\n\n    CREATE TABLE `cms_application_page_block_video` (\n        `video_id` int(11) unsigned NOT NULL AUTO_INCREMENT,\n        `value_id` int(11) unsigned NOT NULL,\n        `type_id` enum('link','youtube','podcast') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'link',\n        `description` varchar(255) COLLATE utf8_unicode_ci NOT NULL,\n        `image` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,\n        PRIMARY KEY (`video_id`),\n        KEY `FK_CMS_APPLICATION_PAGE_BLOCK_VALUE_ID` (`value_id`)\n    ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;\n");
$this->query("\n    CREATE TABLE `cms_application_page_block_video_link` (\n        `video_id` int(11) unsigned NOT NULL AUTO_INCREMENT,\n        `link` varchar(255) COLLATE utf8_unicode_ci NOT NULL,\n        `description` varchar(255) COLLATE utf8_unicode_ci NOT NULL,\n        `image` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,\n        PRIMARY KEY (`video_id`)\n    ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;\n\n    CREATE TABLE `cms_application_page_block_video_podcast` (\n        `video_id` int(11) unsigned NOT NULL AUTO_INCREMENT,\n        `search` varchar(255) COLLATE utf8_unicode_ci NOT NULL,\n        `link` varchar(255) COLLATE utf8_unicode_ci NOT NULL,\n        PRIMARY KEY (`video_id`)\n    ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;\n");
$this->query("\n    CREATE TABLE `cms_application_page_block_video_youtube` (\n        `video_id` int(11) unsigned NOT NULL AUTO_INCREMENT,\n        `search` varchar(255) COLLATE utf8_unicode_ci NOT NULL,\n        `youtube` varchar(255) COLLATE utf8_unicode_ci NOT NULL,\n        PRIMARY KEY (`video_id`)\n    ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;\n\n    CREATE TABLE `cms_application_page_block_button` (\n        `button_id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,\n        `value_id` INT(11) UNSIGNED NOT NULL,\n        `type_id` ENUM('link','phone') NOT NULL DEFAULT 'phone',\n        `content` VARCHAR(256) NULL DEFAULT NULL,\n        PRIMARY KEY (`button_id`),\n        KEY `KEY_VALUE_ID` (`value_id`)\n    ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;\n");
$this->query("\n    ALTER TABLE `cms_application_page`\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 `cms_application_page_block_address`\n        ADD FOREIGN KEY `FK_VALUE_ID` (`value_id`) REFERENCES `cms_application_page_block` (`value_id`) ON DELETE CASCADE ON UPDATE CASCADE;\n");
$this->query("\n    ALTER TABLE `cms_application_page_block_image`\n        ADD FOREIGN KEY `FK_VALUE_ID` (`value_id`) REFERENCES `cms_application_page_block` (`value_id`) ON DELETE CASCADE ON UPDATE CASCADE;\n");
$this->query("\n    ALTER TABLE `cms_application_page_block_text`\n        ADD FOREIGN KEY `FK_VALUE_ID` (`value_id`) REFERENCES `cms_application_page_block` (`value_id`) ON DELETE CASCADE ON UPDATE CASCADE;\n");
$this->query("\n    ALTER TABLE `cms_application_page_block_video`\n        ADD FOREIGN KEY `FK_VALUE_ID` (`value_id`) REFERENCES `cms_application_page_block` (`value_id`) ON DELETE CASCADE ON UPDATE CASCADE;\n");
$this->query("\n    ALTER TABLE `cms_application_page_block_video_link`\n        ADD FOREIGN KEY `FK_VIDEO_ID` (`video_id`) REFERENCES `cms_application_page_block_video` (`video_id`) ON DELETE CASCADE ON UPDATE CASCADE;\n");
$this->query("\n    ALTER TABLE `cms_application_page_block_video_podcast`\n        ADD FOREIGN KEY `FK_VIDEO_ID` (`video_id`) REFERENCES `cms_application_page_block_video` (`video_id`) ON DELETE CASCADE ON UPDATE CASCADE;\n");
$this->query("\n    ALTER TABLE `cms_application_page_block_video_youtube`\n        ADD FOREIGN KEY `FK_VIDEO_ID` (`video_id`) REFERENCES `cms_application_page_block_video` (`video_id`) ON DELETE CASCADE ON UPDATE CASCADE;\n");
$library = new Media_Model_Library();
$library->setName('Custom Page')->save();
$icon_paths = array('/custom_page/custom1.png', '/loyalty/loyalty6.png', '/newswall/newswall1.png', '/newswall/newswall2.png', '/newswall/newswall3.png', '/newswall/newswall4.png', '/push_notifications/push1.png', '/push_notifications/push2.png', '/catalog/catalog6.png', '/catalog/catalog8.png', '/catalog/catalog9.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();
    }
}
$datas = array('library_id' => $library->getId(), 'icon_id' => $icon_id, 'code' => 'custom_page', 'name' => 'Custom Page', 'model' => 'Cms_Model_Application_Page', 'desktop_uri' => 'cms/application_page/', 'mobile_uri' => 'cms/mobile_page_view/', 'only_once' => 0, 'is_ajax' => 1, 'position' => 70, 'social_sharing_is_available' => 1);
$option = new Application_Model_Option();
$option->setData($datas)->save();
$datas = array(array('type' => 'text', 'position' => 1, 'icon' => 'icon-file-alt', 'title' => 'Text', 'template' => 'cms/application/page/edit/block/text.phtml', 'mobile_template' => 'cms/page/%s/view/block/text.phtml'), array('type' => 'image', 'position' => 2, 'icon' => 'icon-picture', 'title' => 'Image', 'template' => 'cms/application/page/edit/block/image.phtml', 'mobile_template' => 'cms/page/%s/view/block/image.phtml'), array('type' => 'video', 'position' => 3, 'icon' => 'icon-facetime-video', 'title' => 'Video', 'template' => 'cms/application/page/edit/block/video.phtml', 'mobile_template' => 'cms/page/%s/view/block/video.phtml'), array('type' => 'address', 'position' => 4, 'icon' => 'icon-location-arrow', 'title' => 'Address', 'template' => 'cms/application/page/edit/block/address.phtml', 'mobile_template' => 'cms/page/%s/view/block/address.phtml'), array('type' => 'button', 'position' => 5, 'icon' => 'icon-barcode', 'title' => 'Button', 'template' => 'cms/application/page/edit/block/button.phtml', 'mobile_template' => 'cms/page/%s/view/block/button.phtml'));
Esempio n. 4
0
<?php

$this->query("\n    CREATE TABLE `comment` (\n        `comment_id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,\n        `value_id` int(11) unsigned NOT NULL,\n        `text` varchar(255) COLLATE utf8_unicode_ci NOT NULL,\n        `image` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,\n        `is_visible` int(11) DEFAULT '1',\n        `created_at` datetime NOT NULL,\n        `updated_at` datetime NOT NULL,\n        PRIMARY KEY (`comment_id`),\n        KEY `KEY_VALUE_ID` (`value_id`)\n    ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;\n\n    CREATE TABLE `comment_answer` (\n        `answer_id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,\n        `comment_id` int(11) UNSIGNED NOT NULL,\n        `customer_id` int(11) NOT NULL,\n        `text` varchar(255) COLLATE utf8_unicode_ci NOT NULL,\n        `is_visible` tinyint(1) NOT NULL DEFAULT '1',\n        `created_at` datetime NOT NULL,\n        `updated_at` datetime NOT NULL,\n        PRIMARY KEY (`answer_id`),\n        KEY `KEY_COMMENT_ID` (`comment_id`),\n        KEY `KEY_CUSTOMER_ID` (`customer_id`)\n    ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;\n");
$this->query("\n    CREATE TABLE `comment_like` (\n        `like_id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,\n        `comment_id` int(11) UNSIGNED NOT NULL,\n        `customer_id` int(11) UNSIGNED DEFAULT NULL,\n        `customer_ip` varchar(255) COLLATE utf8_unicode_ci NOT NULL,\n        `user_agent` varchar(255) COLLATE utf8_unicode_ci NOT NULL,\n        PRIMARY KEY (`like_id`),\n        KEY `KEY_COMMENT_ID` (`comment_id`)\n    ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;\n");
$this->query("\n    ALTER TABLE `comment`\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 `comment_answer`\n        ADD FOREIGN KEY `FK_COMMENT_ID` (`comment_id`) REFERENCES `comment` (`comment_id`) ON DELETE CASCADE ON UPDATE CASCADE;\n");
$this->query("\n    ALTER TABLE `comment_like`\n        ADD FOREIGN KEY `FK_COMMENT_ID` (`comment_id`) REFERENCES `comment` (`comment_id`) ON DELETE CASCADE ON UPDATE CASCADE;\n");
$library = new Media_Model_Library();
$library->setName('Newswall')->save();
$icon_paths = array('/newswall/newswall1.png', '/newswall/newswall2.png', '/newswall/newswall3.png', '/newswall/newswall4.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();
    }
}
$datas = array('library_id' => $library->getId(), 'icon_id' => $icon_id, 'code' => 'newswall', 'name' => 'Newswall', 'model' => 'Comment_Model_Comment', 'desktop_uri' => 'comment/application/', 'mobile_uri' => 'comment/mobile/', 'only_once' => 0, 'is_ajax' => 1, 'position' => 10);
$option = new Application_Model_Option();
$option->setData($datas)->save();
<?php

$this->query("\n    CREATE TABLE `contact` (\n        `contact_id` int(11) NOT NULL AUTO_INCREMENT,\n        `value_id` int(11) unsigned NOT NULL,\n        `name` longtext COLLATE utf8_unicode_ci,\n        `description` longtext COLLATE utf8_unicode_ci,\n        `facebook` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,\n        `twitter` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,\n        `website` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,\n        `cover` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,\n        `email` varchar(255) COLLATE utf8_unicode_ci NOT NULL,\n        `civility` varchar(5) COLLATE utf8_unicode_ci NOT NULL,\n        `firstname` varchar(255) COLLATE utf8_unicode_ci NOT NULL,\n        `lastname` varchar(255) COLLATE utf8_unicode_ci NOT NULL,\n        `street` varchar(255) COLLATE utf8_unicode_ci NOT NULL,\n        `postcode` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL,\n        `city` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,\n        `country` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,\n        `latitude` DECIMAL(11,8) NULL DEFAULT NULL,\n        `longitude` DECIMAL(11,8) NULL DEFAULT NULL,\n        `phone` varchar(15) COLLATE utf8_unicode_ci DEFAULT NULL,\n        `created_at` datetime NOT NULL,\n        `updated_at` datetime NOT NULL,\n        PRIMARY KEY (`contact_id`),\n        KEY `KEY_VALUE_ID` (`value_id`)\n    ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;\n");
$this->query("\n    ALTER TABLE `contact`\n        ADD FOREIGN KEY `FK_VALUE_ID` (`value_id`) REFERENCES `application_option_value` (`value_id`) ON DELETE CASCADE ON UPDATE CASCADE;\n");
$library = new Media_Model_Library();
$library->setName('Contact')->save();
$icon_paths = array('/contact/contact1.png', '/contact/contact2.png', '/contact/contact3.png', '/contact/contact4.png', '/contact/contact5.png', '/contact/contact6.png', '/contact/contact7.png', '/contact/contact8.png', '/contact/contact9.png', '/contact/contact10.png', '/contact/contact11.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("contact", "code");
$data = array('category_id' => $category->getId(), 'library_id' => $library->getId(), 'icon_id' => $icon_id, 'code' => 'contact', 'name' => 'Contact', 'model' => 'Contact_Model_Contact', 'desktop_uri' => 'contact/application/', 'mobile_uri' => 'contact/mobile_view/', 'only_once' => 0, 'is_ajax' => 1, 'position' => 120);
$option = new Application_Model_Option();
$option->setData($data)->save();
<?php

$this->query("\n    CREATE TABLE `maps` (\n      `maps_id` int(11) unsigned NOT NULL AUTO_INCREMENT,\n      `value_id` int(11) unsigned NOT NULL,\n      `address` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,\n      `latitude` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,\n      `longitude` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,\n      PRIMARY KEY(`maps_id`),\n      KEY `value_id` (`value_id`)\n) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;\n\n");
$this->query("\n    ALTER TABLE `maps` ADD CONSTRAINT `FK_MAPS_VALUE_ID` FOREIGN KEY (`value_id`) REFERENCES `application_option_value`(`value_id`) ON DELETE CASCADE ON UPDATE CASCADE;\n");
$this->query("\n    ALTER TABLE `maps` ADD `unit` VARCHAR(2) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL ;\n");
// Create the gallery
$library = new Media_Model_Library();
$library->setName('Maps')->save();
// Create the icons
$icons = array("/maps/maps1.png", "/maps/maps2.png", "/maps/maps3.png");
$icon_id = null;
foreach ($icons as $icon) {
    $data = array('library_id' => $library->getId(), 'link' => $icon, 'can_be_colorized' => 1);
    $image = new Media_Model_Library_Image();
    $image->setData($data)->save();
    if (is_null($icon_id)) {
        $icon_id = $image->getId();
    }
}
$category = new Application_Model_Option_Category();
$category->find("misc", "code");
$data = array('category_id' => $category->getId(), 'library_id' => $library->getId(), 'icon_id' => $icon_id, 'code' => 'maps', 'name' => 'Maps', 'model' => 'Maps_Model_Maps', 'desktop_uri' => 'maps/application/', 'mobile_uri' => 'maps/mobile_view/', 'only_once' => 0, 'is_ajax' => 1, 'position' => 240);
$option = new Application_Model_Option();
$option->setData($data)->save();
<?php

$this->query("\n    CREATE TABLE `weblink` (\n        `weblink_id` int(11) unsigned NOT NULL AUTO_INCREMENT,\n        `value_id` int(11) unsigned NOT NULL,\n        `type_id` tinyint(1) unsigned NOT NULL DEFAULT '1',\n        `cover` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,\n        `created_at` datetime NOT NULL,\n        `updated_at` datetime NOT NULL,\n        PRIMARY KEY (`weblink_id`)\n    ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;\n\n    CREATE TABLE `weblink_link` (\n        `link_id` int(11) unsigned NOT NULL AUTO_INCREMENT,\n        `weblink_id` int(11) unsigned NOT NULL,\n        `picto` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,\n        `title` varchar(40) COLLATE utf8_unicode_ci DEFAULT NULL,\n        `url` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,\n        `position` tinyint(1) unsigned NOT NULL DEFAULT '0',\n        PRIMARY KEY (`link_id`),\n        KEY `KEY_WEBLINK_ID` (`weblink_id`)\n    ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;\n");
$this->query("\n    ALTER TABLE `weblink_link`\n        ADD FOREIGN KEY `FK_WEBLINK_ID` (`weblink_id`) REFERENCES `weblink` (`weblink_id`) ON DELETE CASCADE ON UPDATE CASCADE;\n");
$library = new Media_Model_Library();
$library->setName('Weblink')->save();
$icon_paths = array('/weblink/link1.png', '/weblink/link2.png', '/weblink/link3.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();
    }
}
$datas = array('library_id' => $library->getId(), 'icon_id' => $icon_id, 'code' => "weblink_mono", 'name' => "Link", 'model' => "Weblink_Model_Type_Mono", 'desktop_uri' => "weblink/application_mono/", 'mobile_uri' => "weblink/mobile_mono/", 'only_once' => 0, 'is_ajax' => 0, 'position' => 150);
$option = new Application_Model_Option();
$option->setData($datas)->save();
$datas = array('library_id' => $library->getId(), 'icon_id' => $icon_id, 'code' => "weblink_multi", 'name' => "Links", 'model' => "Weblink_Model_Type_Multi", 'desktop_uri' => "weblink/application_multi/", 'mobile_uri' => "weblink/mobile_multi/", 'only_once' => 0, 'is_ajax' => 1, 'position' => 160);
$option = new Application_Model_Option();
$option->setData($datas)->save();
Esempio n. 8
0
<?php

$this->query("\n    CREATE TABLE `rss_feed` (\n        `feed_id` int(11) NOT NULL AUTO_INCREMENT,\n        `value_id` int(11) unsigned NOT NULL,\n        `title` varchar(20) COLLATE utf8_unicode_ci NOT NULL,\n        `link` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,\n        `position` tinyint(1) unsigned NOT NULL DEFAULT '0',\n        `picture` tinyint(1) DEFAULT NULL,\n        `created_at` datetime NOT NULL,\n        `updated_at` datetime NOT NULL,\n        PRIMARY KEY (`feed_id`),\n        KEY `KEY_VALUE_ID` (`value_id`)\n    ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;\n");
$this->query("\n    ALTER TABLE `rss_feed`\n        ADD FOREIGN KEY `FK_VALUE_ID` (`value_id`) REFERENCES `application_option_value` (`value_id`) ON DELETE CASCADE ON UPDATE CASCADE;\n");
$library = new Media_Model_Library();
$library->setName('RSS Feed')->save();
$icon_paths = array('/rss_feed/rss1.png', '/rss_feed/rss2.png', '/rss_feed/rss3.png', '/newswall/newswall1.png', '/newswall/newswall2.png', '/newswall/newswall3.png', '/newswall/newswall4.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();
    }
}
$datas = array('library_id' => $library->getId(), 'icon_id' => $icon_id, 'code' => 'rss_feed', 'name' => 'RSS Feed', 'model' => 'Rss_Model_Feed', 'desktop_uri' => 'rss/application_feed/', 'mobile_uri' => 'rss/mobile_feed/', 'only_once' => 0, 'is_ajax' => 1, 'position' => 80);
$option = new Application_Model_Option();
$option->setData($datas)->save();
<?php

$this->query("\n    CREATE TABLE `socialgaming_game` (\n        `game_id` int(11) unsigned NOT NULL AUTO_INCREMENT,\n        `value_id` INT(11) UNSIGNED NOT NULL,\n        `period_id` tinyint(1) NOT NULL DEFAULT '0',\n        `name` varchar(100) COLLATE utf8_unicode_ci NOT NULL,\n        `gift` varchar(100) COLLATE utf8_unicode_ci NOT NULL,\n        `end_at` date DEFAULT NULL,\n        `created_at` datetime NOT NULL,\n        `updated_at` datetime NOT NULL,\n        PRIMARY KEY (`game_id`)\n    ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;\n");
$this->query("\n    ALTER TABLE `socialgaming_game`\n        ADD FOREIGN KEY `FK_APPLICATION_OPTION_VALUE_VALUE_ID` (value_id) references `application_option_value` (`value_id`) ON UPDATE CASCADE ON DELETE CASCADE\n    ;\n");
$library = new Media_Model_Library();
$library->setName('Contest')->save();
$icon_paths = array('/contest/contest1.png', '/contest/contest2.png', '/contest/contest3.png', '/contest/contest4.png', '/contest/contest5.png');
$icon_id = 0;
foreach ($icon_paths as $key => $icon_path) {
    $data = array('library_id' => $library->getId(), 'link' => $icon_path, 'can_be_colorized' => 1);
    $image = new Media_Model_Library_Image();
    $image->setData($data)->save();
    if ($key == 0) {
        $icon_id = $image->getId();
    }
}
$category = new Application_Model_Option_Category();
$category->find("social", "code");
$data = array('category_id' => $category->getId(), 'library_id' => $library->getId(), 'icon_id' => $icon_id, 'code' => "social_gaming", 'name' => "Contest", 'model' => "Socialgaming_Model_Game", 'desktop_uri' => "socialgaming/application/", 'mobile_uri' => "socialgaming/mobile_view/", 'only_once' => 1, 'is_ajax' => 1, 'position' => 60);
$option = new Application_Model_Option();
$option->setData($data)->save();
Esempio n. 10
0
 public function addPictures()
 {
     if ($picture_list = $this->getPictureList()) {
         if (!($library_id = $this->getLibraryId())) {
             $library = new Media_Model_Library();
             $library->setName("product_" . uniqid())->save();
             $library_id = $library->getId();
             $this->setLibraryId($library_id);
         }
         foreach ($picture_list as $picture) {
             if ($picture != "") {
                 $image = new Media_Model_Library_Image();
                 $img_data = array("link" => $picture, "can_be_colorized" => 0, "library_id" => $library_id);
                 $image->setData($img_data)->save();
             }
         }
     }
 }
Esempio n. 11
0
$library = new Media_Model_Library();
$library->setName('Images')->save();
$icon_paths = array('/images/image1.png', '/images/image2.png', '/images/image3.png', '/images/image4.png', '/images/image5.png', '/images/image6.png', '/images/image7.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();
    }
}
$datas = array('library_id' => $library->getId(), 'icon_id' => $icon_id, 'code' => 'image_gallery', 'name' => 'Images', 'model' => 'Media_Model_Gallery_Image', 'desktop_uri' => 'media/application_gallery_image/', 'mobile_uri' => 'media/mobile_gallery_image/', 'only_once' => 0, 'is_ajax' => 1, 'position' => 90);
$option = new Application_Model_Option();
$option->setData($datas)->save();
// Videos Gallery
$library = new Media_Model_Library();
$library->setName('Videos')->save();
$icon_paths = array('/videos/video1.png', '/videos/video2.png', '/videos/video3.png', '/videos/video4.png', '/videos/video5.png', '/videos/video6.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();
    }
}
$datas = array('library_id' => $library->getId(), 'icon_id' => $icon_id, 'code' => 'video_gallery', 'name' => 'Videos', 'model' => 'Media_Model_Gallery_Video', 'desktop_uri' => 'media/application_gallery_video/', 'mobile_uri' => 'media/mobile_gallery_video/', 'only_once' => 0, 'is_ajax' => 1, 'position' => 100);
$option = new Application_Model_Option();
$option->setData($datas)->save();
Esempio n. 12
0
<?php

$this->query("\n    CREATE TABLE `catalog_category` (\n        `category_id` int(11) NOT NULL AUTO_INCREMENT,\n        `parent_id` int(11) DEFAULT NULL,\n        `value_id` int(11) unsigned NOT NULL,\n        `name` varchar(50) COLLATE utf8_unicode_ci NOT NULL,\n        `is_active` tinyint(1) NOT NULL DEFAULT '1',\n        `position` smallint(5) NOT NULL DEFAULT '0',\n        `created_at` datetime NOT NULL,\n        `updated_at` datetime NOT NULL,\n        PRIMARY KEY (`category_id`),\n        KEY `KEY_VALUE_ID` (`value_id`),\n        KEY `KEY_PARENT_ID` (`parent_id`)\n    ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;\n\n    CREATE TABLE `catalog_product` (\n        `product_id` int(11) NOT NULL AUTO_INCREMENT,\n        `category_id` int(11) DEFAULT NULL,\n        `value_id` int(11) unsigned NOT NULL,\n        `tax_id` int(11) DEFAULT NULL,\n        `type` varchar(20) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'basic',\n        `name` varchar(50) COLLATE utf8_unicode_ci NOT NULL,\n        `description` text COLLATE utf8_unicode_ci NOT NULL,\n        `picture` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,\n        `price` decimal(12,4) DEFAULT NULL,\n        `format_quantity` tinyint(2) NOT NULL DEFAULT '0',\n        `conditions` varchar(75) COLLATE utf8_unicode_ci DEFAULT NULL,\n        `is_active` tinyint(1) NOT NULL DEFAULT '1',\n        `position` smallint(5) NOT NULL DEFAULT '0',\n        `created_at` datetime NOT NULL,\n        `updated_at` datetime NOT NULL,\n        PRIMARY KEY (`product_id`),\n        KEY `KEY_CATEGORY_ID` (`category_id`),\n        KEY `KEY_VALUE_ID` (`value_id`)\n    ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;\n");
$this->query("\n    CREATE TABLE `catalog_product_format` (\n      `option_id` int(11) NOT NULL AUTO_INCREMENT,\n      `product_id` int(11) NOT NULL,\n      `title` varchar(255) COLLATE utf8_unicode_ci NOT NULL,\n      `price` decimal(8,2) NOT NULL,\n      PRIMARY KEY (`option_id`),\n      KEY `KEY_PRODUCT_ID` (`product_id`)\n    ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;\n");
$this->query("\n    ALTER TABLE `catalog_category`\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 `catalog_product`\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 `catalog_product_format`\n        ADD FOREIGN KEY `FK_PRODUCT_ID` (`product_id`) REFERENCES `catalog_product` (`product_id`) ON DELETE CASCADE ON UPDATE CASCADE;\n");
$library = new Media_Model_Library();
$library->setName('Catalog')->save();
$icon_paths = array('/catalog/catalog1.png', '/catalog/catalog2.png', '/catalog/catalog3.png', '/catalog/catalog4.png', '/catalog/catalog5.png', '/catalog/catalog6.png', '/catalog/catalog7.png', '/promotion/discount4.png', '/catalog/catalog8.png', '/catalog/catalog9.png', '/catalog/catalog10.png', '/catalog/catalog11.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();
    }
}
$datas = array('library_id' => $library->getId(), 'icon_id' => $icon_id, 'code' => 'catalog', 'name' => 'Catalog', 'model' => 'Catalog_Model_Product', 'desktop_uri' => 'catalog/application/', 'mobile_uri' => 'catalog/mobile_category/', 'only_once' => 0, 'is_ajax' => 1, 'position' => 30);
$option = new Application_Model_Option();
$option->setData($datas)->save();
    $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("monetization", "code");
$datas = array('category_id' => $category->getId(), 'library_id' => $library->getId(), 'icon_id' => $icon_id, 'code' => 'catalog', 'name' => 'Catalog', 'model' => 'Catalog_Model_Category', 'desktop_uri' => 'catalog/application/', 'mobile_uri' => 'catalog/mobile_category_list/', "mobile_view_uri" => "catalog/mobile_category_product_view/", "mobile_view_uri_parameter" => "product_id", 'only_once' => 0, 'is_ajax' => 1, 'position' => 30, 'social_sharing_is_available' => 1);
$option = new Application_Model_Option();
$option->setData($datas)->save();
$catalog_value_id = $option->getId();
// SET MEAL
$catalog_option = new Application_Model_Option();
$catalog_option->find('catalog', 'code');
$library = new Media_Model_Library();
if (!$catalog_option->getId()) {
    $library->setName('Set Meal')->save();
    $icon_paths = array('/catalog/catalog1.png', '/catalog/catalog2.png', '/catalog/catalog3.png', '/catalog/catalog4.png', '/catalog/catalog5.png', '/catalog/catalog6.png', '/catalog/catalog7.png', '/promotion/discount4.png', '/catalog/catalog8.png', '/catalog/catalog9.png', '/catalog/catalog10.png', '/catalog/catalog11.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();
        }
    }
} else {
    $library->find($catalog_option->getLibraryId());
    $icons = $library->getIcons();
<?php

$this->query('
    CREATE TABLE `social_facebook` (
        `facebook_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
        `value_id` int(11) unsigned NOT NULL,
        `fb_user` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
        `created_at` datetime NOT NULL,
        `updated_at` datetime NOT NULL,
        PRIMARY KEY (`facebook_id`)
    ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
');
$library = new Media_Model_Library();
$library->setName('Facebook')->save();
$icon_paths = array('/social_facebook/facebook1.png');
$icon_id = 0;
foreach ($icon_paths as $key => $icon_path) {
    $data = array('library_id' => $library->getId(), 'link' => $icon_path, 'can_be_colorized' => 1);
    $image = new Media_Model_Library_Image();
    $image->setData($data)->save();
    if ($key == 0) {
        $icon_id = $image->getId();
    }
}
$category = new Application_Model_Option_Category();
$category->find("social", "code");
$data = array('category_id' => $category->getId(), 'library_id' => $library->getId(), 'icon_id' => $icon_id, 'code' => "facebook", 'name' => "Facebook", 'model' => "Social_Model_Facebook", 'desktop_uri' => "social/application_facebook/", 'mobile_uri' => "social/mobile_facebook_list/", 'only_once' => 0, 'is_ajax' => 1, 'position' => 210);
$option = new Application_Model_Option();
$option->setData($data)->save();
Esempio n. 15
0
 public function uploadiconAction()
 {
     if ($datas = $this->getRequest()->getPost()) {
         try {
             $uploader = new Core_Model_Lib_Uploader();
             $file = $uploader->savecrop($datas);
             if (!empty($file)) {
                 $option_value = new Application_Model_Option_Value();
                 $option_value->find($datas['option_id']);
                 $lib = new Media_Model_Library();
                 $lib->find($option_value->getLibraryId());
                 $library_name = $lib->getName();
                 $formated_library_name = Core_Model_Lib_String::format($library_name, true);
                 $base_lib_path = Media_Model_Library_Image::getBaseImagePathTo($formated_library_name);
                 $files = Core_Model_Directory::getTmpDirectory(true) . '/' . $file;
                 $CanBeColorized = $datas['is_colorized'] == 'true' ? 1 : 0;
                 if (!is_dir($base_lib_path)) {
                     mkdir($base_lib_path, 0777, true);
                 }
                 if (!copy($files, $base_lib_path . '/' . $file)) {
                     throw new exception($this->_('An error occurred while saving your picture. Please try againg later.'));
                 } else {
                     $icon_lib = new Media_Model_Library_Image();
                     $icon_lib->setLibraryId($option_value->getLibraryId())->setLink('/' . $formated_library_name . '/' . $file)->setOptionId($option_value->getOptionId())->setAdminId($this->getSession()->getAdmin()->getId())->setCanBeColorized($CanBeColorized)->setPosition(0)->save();
                     $option_value->setIcon('/' . $formated_library_name . '/' . $file)->setIconId($icon_lib->getImageId())->save();
                     $icon_saved = $this->setIcon($icon_lib->getImageId(), $datas['option_id']);
                     // Charge l'option_value
                     $option_value = new Application_Model_Option_Value();
                     $option_value->find($datas['option_id']);
                     $icon_color = $this->getApplication()->getDesignBlock('tabbar')->getImageColor();
                     $html = array('success' => 1, 'file' => '/' . $formated_library_name . '/' . $file, 'icon_id' => $icon_lib->getImageId(), 'colorizable' => $CanBeColorized, 'icon_url' => Media_Model_Library_Image::getImagePathTo($formated_library_name . '/' . $file), 'colored_icon_url' => $this->getUrl('template/block/colorize', array('id' => $option_value->getIconId(), 'color' => str_replace('#', '', $icon_color))), 'colored_header_icon_url' => $icon_saved['colored_header_icon_url'], 'message' => '', 'message_button' => 1, 'message_loader' => 1);
                 }
             }
         } catch (Exception $e) {
             $html = array('message' => $e->getMessage(), 'message_button' => 1, 'message_loader' => 1);
         }
         $this->getLayout()->setHtml(Zend_Json::encode($html));
     }
 }
$library = new Media_Model_Library();
$library->setName('Push')->save();
$icon_paths = array('/push_notifications/push1.png', '/push_notifications/push2.png', '/push_notifications/push3.png', '/push_notifications/push4.png', '/push_notifications/push5.png', '/loyalty/loyalty6.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();
    }
}
$datas = array('library_id' => $library->getId(), 'icon_id' => $icon_id, 'code' => "push_notification", 'name' => "Push Notifications", 'model' => "Push_Model_Message", 'desktop_uri' => "push/application/", 'mobile_uri' => "push/mobile_list/", 'only_once' => 1, 'is_ajax' => 1, 'position' => 130);
$option = new Application_Model_Option();
$option->setData($datas)->save();
// In-App Message
$library = new Media_Model_Library();
$library->setName('Messages')->save();
$icon_paths = array('/inapp_messages/inapp1.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();
    }
}
$datas = array('library_id' => $library->getId(), 'icon_id' => $icon_id, 'code' => "inapp_messages", 'name' => "In-App Messages", 'model' => "Push_Model_Message", 'desktop_uri' => "push/application/", 'mobile_uri' => "push/mobile_list/", 'only_once' => 1, 'is_ajax' => 1, 'position' => 130);
$option = new Application_Model_Option();
$option->setData($datas)->save();
<?php

$this->query("\n    CREATE TABLE `booking` (\n        `booking_id` INT(11) UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,\n        `value_id` INT(11) UNSIGNED NOT NULL\n    ) ENGINE=InnoDB CHARACTER SET=utf8 COLLATE=utf8_unicode_ci;\n\n    CREATE TABLE `booking_store` (\n        `store_id` INT(11) UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,\n        `booking_id` INT(11) NOT NULL,\n        `store_name` VARCHAR(255) NOT NULL,\n        `email` VARCHAR(255) NOT NULL,\n        KEY `KEY_BOOKING_ID` (`booking_id`)\n    ) ENGINE=InnoDB CHARACTER SET=utf8 COLLATE=utf8_unicode_ci;\n");
$library = new Media_Model_Library();
$library->setName('Booking')->save();
$icon_paths = array('booking1.png', 'booking2.png', 'booking3.png', 'booking4.png', 'booking5.png', 'booking6.png', 'booking7.png', 'booking8.png', 'booking9.png', 'booking10.png', 'booking11.png');
$icon_id = 0;
foreach ($icon_paths as $key => $icon_path) {
    $datas = array('library_id' => $library->getId(), 'link' => '/booking/' . $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("contact", "code");
$data = array('category_id' => $category->getId(), 'library_id' => $library->getId(), 'icon_id' => $icon_id, 'code' => 'booking', 'name' => 'Booking', 'model' => 'Booking_Model_Booking', 'desktop_uri' => 'booking/application/', 'mobile_uri' => 'booking/mobile_view/', "mobile_view_uri" => "booking/mobile_view/", "mobile_view_uri_parameter" => null, 'only_once' => 0, 'is_ajax' => 1, 'position' => 140);
$option = new Application_Model_Option();
$option->setData($data)->save();
<?php

$this->query("\n\n    CREATE TABLE `loyalty_card` (\n        `card_id` int(11) NOT NULL AUTO_INCREMENT,\n        `value_id` int(11) unsigned NOT NULL,\n        `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,\n        `number_of_points` smallint(5) NOT NULL,\n        `advantage` varchar(255) COLLATE utf8_unicode_ci NOT NULL,\n        `conditions` varchar(255) COLLATE utf8_unicode_ci NOT NULL,\n        `use_once` TINYINT(1) NOT NULL DEFAULT 0,\n        `created_at` datetime NOT NULL,\n        `updated_at` datetime NOT NULL,\n        KEY `KEY_VALUE_ID` (`value_id`),\n        PRIMARY KEY (`card_id`)\n    ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;\n\n    CREATE TABLE `loyalty_card_customer` (\n        `customer_card_id` int(11) NOT NULL AUTO_INCREMENT,\n        `card_id` int(11) NOT NULL,\n        `customer_id` int(11) UNSIGNED NOT NULL,\n        `number_of_points` smallint(5) NOT NULL,\n        `is_used` tinyint(1) NOT NULL DEFAULT '0',\n        `number_of_error` tinyint(1) unsigned NOT NULL DEFAULT '0',\n        `validate_by` int(11) DEFAULT NULL,\n        `created_at` datetime NOT NULL,\n        `updated_at` datetime NOT NULL,\n        `used_at` datetime DEFAULT NULL,\n        `last_error` datetime DEFAULT NULL,\n        PRIMARY KEY (`customer_card_id`),\n        KEY `KEY_CARD_ID` (`card_id`),\n        KEY `KEY_CUSTOMER_ID` (`customer_id`)\n    ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;\n");
$this->query("\n    CREATE TABLE `loyalty_card_customer_log` (\n        `log_id` int(11) NOT NULL AUTO_INCREMENT,\n        `customer_id` int(11) UNSIGNED NOT NULL,\n        `card_id` int(11) NOT NULL,\n        `password_id` int(11) NOT NULL,\n        `number_of_points` smallint(5) unsigned NOT NULL DEFAULT '1',\n        `created_at` datetime NOT NULL,\n        PRIMARY KEY (`log_id`),\n        KEY `KEY_CUSTOMER_ID` (`customer_id`),\n        KEY `KEY_CARD_ID` (`card_id`),\n        KEY `KEY_PASSWORD_ID` (`password_id`)\n    ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;\n\n    CREATE TABLE `loyalty_card_password` (\n        `password_id` int(11) NOT NULL AUTO_INCREMENT,\n        `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,\n        `password` varchar(100) COLLATE utf8_unicode_ci NOT NULL,\n        `app_id` int(11) UNSIGNED NOT NULL,\n        `created_at` datetime NOT NULL,\n        `updated_at` datetime NOT NULL,\n        PRIMARY KEY (`password_id`)\n    ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;\n");
$this->query("\n    ALTER TABLE `loyalty_card`\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 `loyalty_card_customer`\n        ADD FOREIGN KEY `FK_CARD_ID` (`card_id`) REFERENCES `loyalty_card` (`card_id`) ON DELETE CASCADE ON UPDATE CASCADE;\n");
$this->query("\n    ALTER TABLE `loyalty_card_customer_log`\n        ADD FOREIGN KEY `FK_CARD_ID` (`card_id`) REFERENCES `loyalty_card` (`card_id`) ON DELETE CASCADE ON UPDATE CASCADE;\n");
$this->query("\n    ALTER TABLE `loyalty_card_password`\n        ADD FOREIGN KEY `FK_APP_ID` (`app_id`) REFERENCES `application` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE;\n");
$library = new Media_Model_Library();
$library->setName('Loyalty Card')->save();
$icon_paths = array('/loyalty/loyalty1.png', '/loyalty/loyalty2.png', '/loyalty/loyalty3.png', '/loyalty/loyalty4.png', '/loyalty/loyalty5.png', '/loyalty/loyalty6.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("monetization", "code");
$data = array('category_id' => $category->getId(), 'library_id' => $library->getId(), 'icon_id' => $icon_id, 'code' => "loyalty", 'name' => "Loyalty Card", 'model' => "LoyaltyCard_Model_LoyaltyCard", 'desktop_uri' => "loyaltycard/application/", 'mobile_uri' => "loyaltycard/mobile_view/", 'only_once' => 0, 'is_ajax' => 1, 'position' => 50);
$option = new Application_Model_Option();
$option->setData($data)->save();
$this->query('
    CREATE TABLE IF NOT EXISTS `padlock` (
        `padlock_id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
        `value_id` INT(11) UNSIGNED NOT NULL,
        `created_at` DATETIME NOT NULL,
        `updated_at` DATETIME NOT NULL,
        PRIMARY KEY (`padlock_id`),
        FOREIGN KEY `FK_PADLOCK_VALUE_ID` (`value_id`) REFERENCES `application_option_value` (`value_id`) ON DELETE CASCADE ON UPDATE CASCADE
    ) ENGINE=InnoDB CHARACTER SET=utf8 COLLATE=utf8_unicode_ci;
');
$this->query('
    CREATE TABLE IF NOT EXISTS `padlock_value` (
        `padlock_value_id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
        `app_id` INT(11) UNSIGNED NOT NULL,
        `value_id` INT(11) UNSIGNED NOT NULL,
        PRIMARY KEY (`padlock_value_id`),
        FOREIGN KEY `FK_PADLOCK_VALUE_APP_ID` (`app_id`) REFERENCES `application` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE
    ) ENGINE=InnoDB CHARACTER SET=utf8 COLLATE=utf8_unicode_ci;
');
// Create the gallery
$library = new Media_Model_Library();
$library->setName('Padlock')->save();
// Create the icon
$data = array("library_id" => $library->getId(), 'link' => "/padlock/padlock.png", "can_be_colorized" => 1);
$image = new Media_Model_Library_Image();
$image->setData($data)->save();
$icon_id = $image->getId();
// Create and declare the feature
$data = array('library_id' => $library->getId(), 'icon_id' => $icon_id, 'code' => "padlock", 'name' => "Padlock", 'model' => "Padlock_Model_Padlock", 'desktop_uri' => "padlock/application/", 'mobile_uri' => "padlock/mobile_view/", 'only_once' => 0, 'is_ajax' => 1, 'position' => 220);
$option = new Application_Model_Option();
$option->setData($data)->save();
$option = new Application_Model_Option();
$option->setData($data)->save();
// Videos Gallery
$library = new Media_Model_Library();
$library->setName('Videos')->save();
$icon_paths = array('/videos/video1.png', '/videos/video2.png', '/videos/video3.png', '/videos/video4.png', '/videos/video5.png', '/videos/video6.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();
    }
}
$data = array('category_id' => $category->getId(), 'library_id' => $library->getId(), 'icon_id' => $icon_id, 'code' => "video_gallery", 'name' => "Videos", 'model' => "Media_Model_Gallery_Video", 'desktop_uri' => "media/application_gallery_video/", 'mobile_uri' => "media/mobile_gallery_video_list/", "mobile_view_uri" => "media/mobile_gallery_video_view/", "mobile_view_uri_parameter" => "gallery_id,offset/1", 'only_once' => 0, 'is_ajax' => 1, 'position' => 100);
$option = new Application_Model_Option();
$option->setData($data)->save();
// Music Gallery
$library = new Media_Model_Library();
$library->setName('Musics')->save();
$icon_paths = array('/musics/music1.png', '/musics/music2.png', '/musics/music3.png', '/musics/music4.png', '/musics/music5.png', '/musics/music6.png', '/musics/music7.png', '/musics/music8.png', '/musics/music9.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();
    }
}
Esempio n. 21
0
<?php

// Créé la table de base
$this->query("\n    CREATE TABLE `form` (\n        `form_id` int(11) unsigned NOT NULL AUTO_INCREMENT,\n        `value_id` int(11) unsigned NOT NULL,\n        `email` varchar(50) COLLATE utf8_unicode_ci NOT NULL,\n        `created_at` datetime NOT NULL,\n        `updated_at` datetime NOT NULL,\n        PRIMARY KEY (`form_id`)\n    ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;\n\n    CREATE TABLE `form_field` (\n        `field_id` int(11) NOT NULL AUTO_INCREMENT,\n        `section_id` int(11) NOT NULL,\n        `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,\n        `option` text COLLATE utf8_unicode_ci NOT NULL,\n        `required` tinyint(4) NOT NULL DEFAULT '0',\n        `type` varchar(50) COLLATE utf8_unicode_ci NOT NULL,\n        `position` smallint(5) NOT NULL DEFAULT '0',\n        `created_at` datetime NOT NULL,\n        `updated_at` datetime NOT NULL,\n        PRIMARY KEY (`field_id`)\n    ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;\n");
$this->query("\n    CREATE TABLE `form_section` (\n        `section_id` int(11) NOT NULL AUTO_INCREMENT,\n        `value_id` int(10) unsigned NOT NULL,\n        `name` varchar(50) COLLATE utf8_unicode_ci NOT NULL,\n        `created_at` datetime NOT NULL,\n        `updated_at` datetime NOT NULL,\n        PRIMARY KEY (`section_id`)\n    ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;\n\n");
$library = new Media_Model_Library();
$library->setName('Form')->save();
$icon_paths = array('/form/form1.png', '/form/form2.png', '/form/form3.png', '/calendar/calendar1.png', '/catalog/catalog6.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();
    }
}
$datas = array('library_id' => $library->getId(), 'icon_id' => $icon_id, 'code' => 'form', 'name' => 'Form', 'model' => 'Form_Model_Form', 'desktop_uri' => 'form/application/', 'mobile_uri' => 'form/mobile/', 'only_once' => 0, 'is_ajax' => 1, 'position' => 190);
$option = new Application_Model_Option();
$option->setData($datas)->save();
<?php

$this->query("\n    CREATE TABLE topic (\n        `topic_id` int(11) unsigned NOT NULL AUTO_INCREMENT,\n        `value_id` int(11) unsigned NOT NULL,\n        `app_id` int(11) unsigned NOT NULL,\n        `description` VARCHAR(250) COLLATE utf8_unicode_ci NULL,\n        `created_at` datetime NOT NULL,\n        `updated_at` datetime NOT NULL,\n        PRIMARY KEY (`topic_id`),\n        KEY KEY_VALUE_ID (value_id),\n        KEY option_value (value_id),\n        KEY app_id (app_id)\n    ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;\n");
$this->query("\n    CREATE TABLE `topic_category` (\n        `category_id` int(11) unsigned NOT NULL AUTO_INCREMENT,\n        `topic_id` int(11) unsigned NOT NULL,\n        `parent_id` int(11) unsigned DEFAULT NULL,\n        `name` varchar(50) COLLATE utf8_unicode_ci NOT NULL,\n        `description` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,\n        `picture` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,\n        `position` int(11) NOT NULL,\n        `created_at` datetime NOT NULL,\n        `updated_at` datetime NOT NULL,\n        PRIMARY KEY (`category_id`),\n        KEY `topic_id` (`topic_id`)\n    ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;\n");
$this->query("\n    CREATE TABLE `topic_category_message` (\n        `category_message_id` int(11) unsigned NOT NULL AUTO_INCREMENT,\n        `category_id` int(11) unsigned NOT NULL,\n        `message_id` int(11) unsigned NOT NULL,\n        PRIMARY KEY (`category_message_id`)\n    ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;\n");
$this->query("\n    CREATE TABLE `topic_subscription` (\n        `subscription_id` int(11) unsigned NOT NULL AUTO_INCREMENT,\n        `category_id` int(11) unsigned NOT NULL,\n        `device_uid` text COLLATE utf8_unicode_ci NOT NULL,\n        PRIMARY KEY (`subscription_id`),\n        KEY `category_id` (`category_id`)\n    ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;\n");
$this->query("\n    ALTER TABLE `topic`\n        ADD CONSTRAINT FK_TOPIC_APP_ID\n            FOREIGN KEY (`app_id`) REFERENCES `application` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE;\n");
$this->query("\n    ALTER TABLE `topic`\n        ADD CONSTRAINT FK_TOPIC_VALUE_ID\n            FOREIGN KEY (`value_id`) REFERENCES `application_option_value` (`value_id`) ON DELETE CASCADE ON UPDATE CASCADE;\n");
$this->query("\n    ALTER TABLE `topic_category`\n        ADD CONSTRAINT `FK_TOPIC_CATEGORY_TOPIC_ID`\n            FOREIGN KEY (`topic_id`) REFERENCES `topic` (`topic_id`) ON DELETE CASCADE ON UPDATE CASCADE;\n");
$this->query("\n    ALTER TABLE `topic_subscription`\n        ADD CONSTRAINT `FK_TOPIC_SUBSCRIPTION_CATEGORY_ID`\n            FOREIGN KEY (`category_id`) REFERENCES `topic_category` (`category_id`) ON DELETE CASCADE ON UPDATE CASCADE;\n");
$library = new Media_Model_Library();
$library->setName('Topics')->save();
$icon_paths = array('/topic/topics1.png', '/topic/topics2.png', '/topic/topics3.png', '/topic/topics4.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();
    }
}
$datas = array('library_id' => $library->getId(), 'icon_id' => $icon_id, 'code' => "topic", 'name' => "Topics", 'model' => "Topic_Model_Topic", 'desktop_uri' => "topic/application/", 'mobile_uri' => "topic/mobile_view/", 'only_once' => 1, 'is_ajax' => 1, 'position' => 241);
$option = new Application_Model_Option();
$option->setData($datas)->save();
$this->query("\n    CREATE TABLE `promotion` (\n        `promotion_id` int(11) NOT NULL AUTO_INCREMENT,\n        `value_id` int(11) unsigned NOT NULL,\n        `title` varchar(255) COLLATE utf8_unicode_ci NOT NULL,\n        `picture` VARCHAR(255) NULL DEFAULT NULL,\n        `description` text COLLATE utf8_unicode_ci NOT NULL,\n        `conditions` varchar(100) COLLATE utf8_unicode_ci NOT NULL,\n        `is_unique` tinyint(1) NOT NULL DEFAULT '0',\n        `end_at` date DEFAULT NULL,\n        `force_validation` tinyint(1) unsigned NOT NULL DEFAULT '0',\n        `is_active` tinyint(1) NOT NULL DEFAULT '1',\n        `condition_type` varchar(9) COLLATE utf8_unicode_ci DEFAULT NULL,\n        `condition_number_of_points` tinyint(2) DEFAULT NULL,\n        `condition_period_number` tinyint(2) DEFAULT NULL,\n        `condition_period_type` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,\n        `is_shared` tinyint(1) NOT NULL DEFAULT '0',\n        `owner` tinyint(1) NOT NULL DEFAULT '1',\n        `unlock_by` enum('account', 'qrcode') NOT NULL DEFAULT 'account',\n        `unlock_code` VARCHAR(10) NULL DEFAULT NULL,\n        `created_at` datetime NOT NULL,\n        `updated_at` datetime NOT NULL,\n        PRIMARY KEY (`promotion_id`),\n        KEY `KEY_VALUE_ID` (`value_id`)\n    ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;\n\n    CREATE TABLE `promotion_customer` (\n        `promotion_customer_id` int(11) NOT NULL AUTO_INCREMENT,\n        `promotion_id` int(11) NOT NULL,\n        `pos_id` int(11) DEFAULT NULL,\n        `customer_id` int(11) UNSIGNED NOT NULL,\n        `is_used` tinyint(1) unsigned NOT NULL DEFAULT '0',\n        `number_of_error` tinyint(1) unsigned NOT NULL DEFAULT '0',\n        `created_at` datetime NOT NULL,\n        `last_error` datetime DEFAULT NULL,\n        PRIMARY KEY (`promotion_customer_id`),\n        KEY `KEY_PROMOTION_ID` (`promotion_id`)\n    ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;\n");
$this->query("\n    ALTER TABLE `promotion`\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 `promotion_customer`\n        ADD FOREIGN KEY `FK_PROMOTION_ID` (`promotion_id`) REFERENCES `promotion` (`promotion_id`) ON DELETE CASCADE ON UPDATE CASCADE;\n");
$library = new Media_Model_Library();
$library->setName('Discount')->save();
$icon_paths = array('/discount/discount1.png', '/discount/discount2.png', '/discount/discount3.png', '/discount/discount4.png', '/discount/discount5.png', '/loyalty/loyalty6.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();
    }
}
$datas = array('library_id' => $library->getId(), 'icon_id' => $icon_id, 'code' => 'discount', 'name' => 'Discount', 'model' => 'Promotion_Model_Promotion', 'desktop_uri' => 'promotion/application/', 'mobile_uri' => "promotion/mobile_list/", 'only_once' => 0, 'is_ajax' => 1, 'position' => 20, 'social_sharing_is_available' => 1);
$option = new Application_Model_Option();
$option->setData($datas)->save();
$layouts = array(array("code" => 1, "option_id" => $option->getId(), "name" => "Layout 1", "preview" => "/customization/layout/promotion/layout-1.png", "position" => 1), array("code" => 2, "option_id" => $option->getId(), "name" => "Layout 2", "preview" => "/customization/layout/promotion/layout-2.png", "position" => 2));
foreach ($layouts as $data) {
    $this->_db->insert("application_option_layout", $data);
}
$media_library = new Media_Model_Library();
$media_library->find("Code Scan", "name");
$last_icon = count($media_library->getIcons()) - 1;
$icons = $media_library->getIcons();
$icon_id = $icons[$last_icon]->getId();
$option = new Application_Model_Option();
$all_options = $option->findAll("", "position DESC");
$option_data = array("code" => "qr_discount", "name" => "QR Coupons", "model" => "Promotion_Model_Promotion", "library_id" => $media_library->getId(), "icon_id" => $icon_id, "desktop_uri" => "promotion/application/", "mobile_uri" => "promotion/mobile_list/", "position" => 25);
$option->setData($option_data)->save();
<?php

$this->query("\n    CREATE TABLE `folder` (\n        `folder_id` int(11) unsigned NOT NULL AUTO_INCREMENT,\n        `value_id` int(11) unsigned NOT NULL,\n        `root_category_id` int(11) unsigned NOT NULL,\n        PRIMARY KEY (`folder_id`),\n        KEY `KEY_VALUE_ID` (`value_id`),\n        KEY `KEY_CAT_ID` (`root_category_id`)\n    ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;\n\n    CREATE TABLE `folder_category` (\n        `category_id` int(11) unsigned NOT NULL AUTO_INCREMENT,\n        `parent_id` int(11) unsigned DEFAULT NULL,\n        `type_id` enum('folder') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'folder',\n        `picture` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,\n        `title` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,\n        `subtitle` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,\n        `pos` int(11) DEFAULT NULL,\n        PRIMARY KEY (`category_id`),\n        KEY `KEY_PARENT_ID` (`parent_id`)\n    ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;\n");
$this->query("\n    ALTER TABLE `folder`\n        ADD FOREIGN KEY `FK_VALUE_ID` (`value_id`) REFERENCES `application_option_value` (`value_id`) ON DELETE CASCADE ON UPDATE CASCADE,\n        ADD FOREIGN KEY `FK_ROOT_CATEGORY_ID` (`root_category_id`) REFERENCES `folder_category` (`category_id`) ON DELETE CASCADE ON UPDATE CASCADE;\n");
$this->query("\n    ALTER TABLE `folder_category`\n        ADD FOREIGN KEY `FK_PARENT_ID` (`parent_id`) REFERENCES `folder_category` (`category_id`) ON DELETE CASCADE ON UPDATE CASCADE;\n");
$library = new Media_Model_Library();
$library->setName('Folders')->save();
$icon_paths = array('/folders/folder1.png', '/folders/folder2.png', '/folders/folder3.png', '/folders/folder4.png', '/folders/folder5.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();
    }
}
$datas = array('library_id' => $library->getId(), 'icon_id' => $icon_id, 'code' => "folder", 'name' => "Folder", 'model' => "Folder_Model_Folder", 'desktop_uri' => "folder/application/", 'mobile_uri' => "folder/mobile_list/", 'only_once' => 0, 'is_ajax' => 1, 'position' => 180);
$option = new Application_Model_Option();
$option->setData($datas)->save();
        `description` LONGTEXT NULL DEFAULT NULL,
        `address` VARCHAR(255) COLLATE utf8_unicode_ci NULL DEFAULT NULL,
        `location_label` VARCHAR(50) NULL DEFAULT NULL,
        `location_url` VARCHAR(50) NULL DEFAULT NULL,
        `rsvp` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
        `ticket_shop_url` VARCHAR(255) NULL DEFAULT NULL,
        `websites` TEXT NULL DEFAULT NULL,
        `picture` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
        `created_at` datetime NOT NULL,
        `updated_at` datetime NOT NULL,
        PRIMARY KEY (`event_id`),
        KEY `KEY_AGENDA_ID` (`agenda_id`)
    ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

');
$this->query("\n    ALTER TABLE `event_custom`\n        ADD FOREIGN KEY `FK_AGENDA_ID` (`agenda_id`) REFERENCES `event` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE;\n");
$library = new Media_Model_Library();
$library->setName('Calendar')->save();
$icon_paths = array('/calendar/calendar1.png', '/calendar/calendar2.png', '/calendar/calendar3.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();
    }
}
$datas = array('library_id' => $library->getId(), 'icon_id' => $icon_id, 'code' => 'calendar', 'name' => 'Calendar', 'model' => 'Event_Model_Event', 'desktop_uri' => 'event/application/', 'mobile_uri' => 'event/mobile_list/', 'only_once' => 0, 'is_ajax' => 1, 'position' => 200, 'social_sharing_is_available' => 1);
$option = new Application_Model_Option();
$option->setData($datas)->save();
<?php

$this->query("\n    CREATE TABLE `rss_feed` (\n        `feed_id` int(11) NOT NULL AUTO_INCREMENT,\n        `value_id` int(11) unsigned NOT NULL,\n        `title` varchar(20) COLLATE utf8_unicode_ci NOT NULL,\n        `link` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,\n        `position` tinyint(1) unsigned NOT NULL DEFAULT '0',\n        `picture` tinyint(1) DEFAULT NULL,\n        `created_at` datetime NOT NULL,\n        `updated_at` datetime NOT NULL,\n        PRIMARY KEY (`feed_id`),\n        KEY `KEY_VALUE_ID` (`value_id`)\n    ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;\n");
$this->query("\n    ALTER TABLE `rss_feed`\n        ADD FOREIGN KEY `FK_VALUE_ID` (`value_id`) REFERENCES `application_option_value` (`value_id`) ON DELETE CASCADE ON UPDATE CASCADE;\n");
$library = new Media_Model_Library();
$library->setName("RSS Feed")->save();
$icon_paths = array("/rss_feed/rss1.png", "/rss_feed/rss2.png", "/rss_feed/rss3.png", "/newswall/newswall1.png", "/newswall/newswall2.png", "/newswall/newswall3.png", "/newswall/newswall4.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();
    }
}
$datas = array("library_id" => $library->getId(), "icon_id" => $icon_id, "code" => "rss_feed", "name" => "RSS Feed", "model" => "Rss_Model_Feed", "desktop_uri" => "rss/application_feed/", "mobile_uri" => "rss/mobile_feed_list/", "mobile_view_uri" => "rss/mobile_feed_view/", "mobile_view_uri_parameter" => "feed_id", "only_once" => 0, "is_ajax" => 1, "position" => 80, "social_sharing_is_available" => 1);
$option = new Application_Model_Option();
$option->setData($datas)->save();
<?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();
Esempio n. 28
0
<?php

// Créé les tables
$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();
    }
}
$datas = array('library_id' => $library->getId(), 'icon_id' => $icon_id, 'code' => 'wordpress', 'name' => 'Wordpress', 'model' => 'Wordpress_Model_Wordpress', 'desktop_uri' => 'wordpress/application/', 'mobile_uri' => 'wordpress/mobile/', 'only_once' => 0, 'is_ajax' => 1, 'position' => 170);
$option = new Application_Model_Option();
$option->setData($datas)->save();
Esempio n. 29
0
<?php

$this->query("\n    CREATE TABLE `push_apns_devices` (\n        `device_id` int(11) NOT NULL AUTO_INCREMENT,\n        `app_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,\n        `app_version` varchar(25) COLLATE utf8_unicode_ci DEFAULT NULL,\n        `device_uid` varchar(50) COLLATE utf8_unicode_ci NOT NULL,\n        `last_known_latitude` decimal(11,8) DEFAULT NULL,\n        `last_known_longitude` decimal(11,8) DEFAULT NULL,\n        `device_token` char(64) COLLATE utf8_unicode_ci NOT NULL,\n        `device_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,\n        `device_model` varchar(100) COLLATE utf8_unicode_ci NOT NULL,\n        `device_version` varchar(25) COLLATE utf8_unicode_ci NOT NULL,\n        `push_badge` enum('disabled','enabled') COLLATE utf8_unicode_ci DEFAULT 'disabled',\n        `push_alert` enum('disabled','enabled') COLLATE utf8_unicode_ci DEFAULT 'disabled',\n        `push_sound` enum('disabled','enabled') COLLATE utf8_unicode_ci DEFAULT 'disabled',\n        `status` enum('active','uninstalled') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'active',\n        `created_at` datetime NOT NULL,\n        `updated_at` timestamp NOT NULL,\n        PRIMARY KEY (`device_id`),\n        UNIQUE KEY `UNIQUE_KEY_APP_NAME_APP_VERSION_DEVICE_UID` (`app_name`,`app_version`,`device_uid`),\n        KEY `KEY_DEVICE_TOKEN` (`device_token`),\n        KEY `KEY_STATUS` (`status`)\n    ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;\n\n    CREATE TABLE `push_delivered_message` (\n        `deliver_id` int(11) NOT NULL AUTO_INCREMENT,\n        `device_id` int(11) NOT NULL,\n        `device_uid` text COLLATE utf8_unicode_ci NOT NULL,\n        `device_type` tinyint(1) NOT NULL,\n        `message_id` int(11) NOT NULL,\n        `status` tinyint(1) NOT NULL DEFAULT '0',\n        `is_read` tinyint(1) NOT NULL DEFAULT '0',\n        `is_displayed` int(11) NOT NULL DEFAULT '0',\n        `delivered_at` datetime NOT NULL,\n        PRIMARY KEY (`deliver_id`),\n        KEY `KEY_DEVICE_ID` (`device_id`)\n    ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;\n");
$this->query("\n    CREATE TABLE `push_gcm_devices` (\n        `device_id` int(11) NOT NULL AUTO_INCREMENT,\n        `app_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,\n        `registration_id` text COLLATE utf8_unicode_ci,\n        `development` enum('production','sandbox') CHARACTER SET latin1 NOT NULL DEFAULT 'production',\n        `status` enum('active','uninstalled') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'active',\n        `created_at` datetime NOT NULL,\n        `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP,\n        PRIMARY KEY (`device_id`)\n    ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;\n\n    CREATE TABLE `push_messages` (\n        `message_id` int(11) NOT NULL AUTO_INCREMENT,\n        `title` varchar(30) COLLATE utf8_unicode_ci NOT NULL,\n        `text` varchar(255) COLLATE utf8_unicode_ci NOT NULL,\n        `latitude` decimal(11,8) DEFAULT NULL,\n        `longitude` decimal(11,8) DEFAULT NULL,\n        `radius` decimal(7,2) DEFAULT NULL,\n        `send_at` datetime DEFAULT NULL,\n        `send_until` datetime DEFAULT NULL,\n        `delivered_at` datetime DEFAULT NULL,\n        `status` enum('queued','delivered','sending','failed') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'queued',\n        `created_at` datetime NOT NULL,\n        `updated_at` datetime NOT NULL,\n        PRIMARY KEY (`message_id`)\n    ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;\n");
$this->query("\n    CREATE TABLE `push_certificate` (\n        `certificate_id` int(11) NOT NULL AUTO_INCREMENT,\n        `app_id` INT(11) NULL DEFAULT NULL,\n        `type` varchar(30) NOT NULL,\n        `path` varchar(255) NULL DEFAULT NULL,\n        `created_at` datetime NOT NULL,\n        `updated_at` datetime NOT NULL,\n        PRIMARY KEY (`certificate_id`)\n    ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;\n");
$library = new Media_Model_Library();
$library->setName('Push')->save();
$icon_paths = array('/push_notifications/push1.png', '/push_notifications/push2.png', '/push_notifications/push3.png', '/push_notifications/push4.png', '/push_notifications/push5.png', '/loyalty/loyalty6.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();
    }
}
$datas = array('library_id' => $library->getId(), 'icon_id' => $icon_id, 'code' => 'push_notification', 'name' => 'Push Notifications', 'model' => '', 'desktop_uri' => 'push/application/', 'mobile_uri' => 'push/mobile/', 'only_once' => 1, 'is_ajax' => 1, 'position' => 130);
$option = new Application_Model_Option();
$option->setData($datas)->save();
Esempio n. 30
0
<?php

// Create the gallery
$library = new Media_Model_Library();
$library->setName('Tip')->save();
// Create the icons
$icons = array("/tip/tip1.png", "/tip/tip2.png");
$icon_id = null;
foreach ($icons as $icon) {
    $data = array('library_id' => $library->getId(), 'link' => $icon, 'can_be_colorized' => 1);
    $image = new Media_Model_Library_Image();
    $image->setData($data)->save();
    if (is_null($icon_id)) {
        $icon_id = $image->getId();
    }
}
//Categorization
$category = new Application_Model_Option_Category();
$category->find("misc", "code");
$category_id = null;
if ($category->getId()) {
    $category_id = $category->getId();
}
// Create and declare the feature
$data = array('library_id' => $library->getId(), 'icon_id' => $icon_id, 'code' => 'tip', 'name' => 'Tips calculator', 'model' => 'Tip_Model_Tip', 'desktop_uri' => 'tip/application/', 'mobile_uri' => 'tip/mobile_view/', 'only_once' => 0, 'is_ajax' => 1, 'position' => 240, 'social_sharing_is_available' => 0, 'category_id' => $category_id);
$option = new Application_Model_Option();
$option->setData($data)->save();
$resource = new Acl_Model_Resource();
$resource->find("feature", "code");
if ($resource_id = $resource->getId()) {
    $data = array("parent_id" => $resource_id, "code" => "feature_tip", "label" => "Tips calculator", "url" => "tips/application/*");