예제 #1
0
<?php

$resource = new Acl_Model_Resource();
$resource->find("features", "code");
if ($resource->getId()) {
    $resource->setCode("feature")->save();
}
예제 #2
0
<?php

$this->query("\n    CREATE TABLE `message_application` (\n        `message_id` int(11) unsigned NOT NULL AUTO_INCREMENT,\n        `author_id` int(11) unsigned NOT NULL,\n        `app_id` int(11) unsigned NOT NULL,\n        `message` text COLLATE utf8_unicode_ci NOT NULL,\n        `created_at` datetime NOT NULL,\n        PRIMARY KEY (`message_id`),\n        KEY `author_id` (`author_id`),\n        KEY `app_id` (`app_id`)\n    ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;\n");
$this->query("\n    CREATE TABLE `message_application_file` (\n        `file_id` int(11) unsigned NOT NULL AUTO_INCREMENT,\n        `message_id` int(11) unsigned NOT NULL,\n        `file` varchar(255) COLLATE utf8_unicode_ci NOT NULL,\n        PRIMARY KEY (`file_id`),\n        KEY `message_id` (`message_id`)\n    ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ;\n");
$this->query("\n    ALTER TABLE `message_application`\n        ADD CONSTRAINT `FK_MESSAGE_APPLICATION_APP_ID`\n            FOREIGN KEY (`app_id`) REFERENCES `application` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE;\n");
$this->query("\n    ALTER TABLE `message_application_file`\n        ADD CONSTRAINT `FK_MESSAGE_APPLICATION_FILE_MESSAGE_ID`\n            FOREIGN KEY (`message_id`) REFERENCES `message_application` (`message_id`) ON DELETE CASCADE ON UPDATE CASCADE;\n");
$resource = new Acl_Model_Resource();
$resource->find("editor_settings", "code");
if ($resource_id = $resource->getId()) {
    $data = array("parent_id" => $resource_id, "code" => "editor_settings_messages", "label" => "Access the editor messages", "url" => "message/application/*");
    $resource = new Acl_Model_Resource();
    $resource->find("editor_settings_messages", "code");
    $resource->addData($data)->save();
}
예제 #3
0
<?php

$resource = new Acl_Model_Resource();
$resource->find("features", "code");
$resources = $resource->findAll(array("parent_id = ?" => $resource->getId()));
foreach ($resources as $resource) {
    if (stripos($resource->getData("url"), "*") === false) {
        $resource->setUrl($resource->getData("url") . "*")->save();
    }
}
$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();
                }
            }
        }
    }
}
예제 #5
0
<?php

$weather_resource = new Acl_Model_Resource();
$weather_resource->find("weather", "code");
if ($weather_resource->getId()) {
    $weather_resource->setCode("feature_weather")->setLabel("Weather")->save();
}
예제 #6
0
<?php

$resources = array(array("code" => "feature_magento", "label" => "Magento", "url" => "weblink/application_magento/*"), array("code" => "feature_woocommerce", "label" => "WooCommerce", "url" => "weblink/application_woocommerce/*"), array("code" => "feature_prestashop", "label" => "Prestashop", "url" => "weblink/application_prestashop/*"), array("code" => "feature_volusion", "label" => "Volusion", "url" => "weblink/application_volusion/*"), array("code" => "feature_shopify", "label" => "Shopify", "url" => "weblink/application_shopify/*"));
$resource = new Acl_Model_Resource();
$resource->find("feature", "code");
if ($resource_id = $resource->getId()) {
    foreach ($resources as $data) {
        $resource = new Acl_Model_Resource();
        $resource->find($data["code"], "code");
        if (!$resource->getId()) {
            $data["parent_id"] = $resource_id;
            $resource->addData($data)->save();
        }
    }
}
예제 #7
0
<?php

$features = array('Magento' => array('icon_path' => '/magento/magento1.png', 'datas' => array('code' => 'magento', 'name' => 'Magento', 'model' => 'Weblink_Model_Type_Mono', 'desktop_uri' => 'weblink/application_magento/', 'mobile_uri' => 'weblink/mobile_mono/', 'only_once' => 0, 'is_ajax' => 0, 'position' => 155)), 'WooCommerce' => array('icon_path' => '/woocommerce/woocommerce1.png', 'datas' => array('code' => 'woocommerce', 'name' => 'WooCommerce', 'model' => 'Weblink_Model_Type_Mono', 'desktop_uri' => 'weblink/application_woocommerce/', 'mobile_uri' => 'weblink/mobile_mono/', 'only_once' => 0, 'is_ajax' => 0, 'position' => 155)), 'Prestashop' => array('icon_path' => '/prestashop/prestashop1.png', 'datas' => array('code' => 'prestashop', 'name' => 'Prestashop', 'model' => 'Weblink_Model_Type_Mono', 'desktop_uri' => 'weblink/application_prestashop/', 'mobile_uri' => 'weblink/mobile_mono/', 'only_once' => 0, 'is_ajax' => 0, 'position' => 155)), 'Volusion' => array('icon_path' => '/volusion/volusion1.png', 'datas' => array('code' => 'volusion', 'name' => 'Volusion', 'model' => 'Weblink_Model_Type_Mono', 'desktop_uri' => 'weblink/application_volusion/', 'mobile_uri' => 'weblink/mobile_mono/', 'only_once' => 0, 'is_ajax' => 0, 'position' => 155)), 'Shopify' => array('icon_path' => '/shopify/shopify1.png', 'datas' => array('code' => 'shopify', 'name' => 'Shopify', 'model' => 'Weblink_Model_Type_Mono', 'desktop_uri' => 'weblink/application_shopify/', 'mobile_uri' => 'weblink/mobile_mono/', 'only_once' => 0, 'is_ajax' => 0, 'position' => 155)));
$resource = new Acl_Model_Resource();
$resource->find("feature", "code");
$resource_id = $resource->getId();
foreach ($features as $feature_name => $feature) {
    $library = new Media_Model_Library();
    $library->setName($feature_name)->save();
    $datas = array('library_id' => $library->getId(), 'link' => $feature['icon_path'], 'can_be_colorized' => 1);
    $image = new Media_Model_Library_Image();
    $image->setData($datas)->save();
    $icon_id = $image->getId();
    $datas = $feature['datas'];
    $datas['library_id'] = $library->getId();
    $datas['icon_id'] = $icon_id;
    $option = new Application_Model_Option();
    $option->setData($datas)->save();
    if ($resource_id) {
        $data = array("parent_id" => $resource_id, "code" => "feature_" . $feature['datas']['code'], "label" => $feature_name, "url" => $feature['datas']['desktop_uri']);
        $resource = new Acl_Model_Resource();
        $resource->find("feature_" . $feature['datas']['code'], "code");
        $resource->addData($data)->save();
    }
}