Autodoc
  • Namespace
  • Class
  • Tree

Namespaces

  • BlueTihi
    • Context
  • Brickrouge
    • Element
      • Nodes
    • Renderer
    • Widget
  • ICanBoogie
    • ActiveRecord
    • AutoConfig
    • CLDR
    • Composer
    • Core
    • Event
    • Exception
    • HTTP
      • Dispatcher
      • Request
    • I18n
      • Translator
    • Mailer
    • Modules
      • Taxonomy
        • Support
      • Thumbnailer
        • Versions
    • Object
    • Operation
      • Dispatcher
    • Prototype
    • Routes
    • Routing
      • Dispatcher
    • Session
  • Icybee
    • ActiveRecord
      • Model
    • ConfigOperation
    • Document
    • EditBlock
    • Element
      • ActionbarContextual
      • ActionbarSearch
      • ActionbarToolbar
    • FormBlock
    • Installer
    • ManageBlock
    • Modules
      • Articles
      • Cache
        • Collection
        • ManageBlock
      • Comments
        • ManageBlock
      • Contents
        • ManageBlock
      • Dashboard
      • Editor
        • Collection
      • Files
        • File
        • ManageBlock
      • Forms
        • Form
        • ManageBlock
      • I18n
      • Images
        • ManageBlock
      • Members
      • Modules
        • ManageBlock
      • Nodes
        • ManageBlock
        • Module
      • Pages
        • BreadcrumbElement
        • LanguagesElement
        • ManageBlock
        • NavigationBranchElement
        • NavigationElement
        • Page
        • PageController
      • Registry
      • Search
      • Seo
      • Sites
        • ManageBlock
      • Taxonomy
        • Terms
          • ManageBlock
        • Vocabulary
          • ManageBlock
      • Users
        • ManageBlock
        • NonceLogin
        • Roles
      • Views
        • ActiveRecordProvider
        • Collection
        • View
    • Operation
      • ActiveRecord
      • Constructor
      • Module
      • Widget
    • Rendering
  • None
  • Patron
  • PHP

Classes

  • ActivateOperation
  • DeactivateOperation
  • InactivesBlock
  • ManageBlock
  • ManageController
  • Module
 1 <?php
 2 
 3 /*
 4  * This file is part of the Icybee package.
 5  *
 6  * (c) Olivier Laviale <olivier.laviale@gmail.com>
 7  *
 8  * For the full copyright and license information, please view the LICENSE
 9  * file that was distributed with this source code.
10  */
11 
12 namespace Icybee\Modules\Modules;
13 
14 /**
15  * Activates the specified modules.
16  */
17 class ActivateOperation extends \ICanBoogie\Operation
18 {
19     protected function get_controls()
20     {
21         return array
22         (
23             self::CONTROL_PERMISSION => Module::PERMISSION_ADMINISTER
24         )
25 
26         + parent::get_controls();
27     }
28 
29     protected function validate(\ICanBoogie\Errors $errors)
30     {
31         global $core;
32 
33         $install_errors = new \ICanBoogie\Errors;
34 
35         foreach ((array) $this->key as $key => $dummy)
36         {
37             try
38             {
39                 $core->modules[$key] = true;
40                 $module = $core->modules[$key];
41                 $install_errors->clear();
42                 $rc = $module->is_installed($install_errors);
43 
44                 if (!$rc || count($install_errors))
45                 {
46                     $module->install($errors);
47 
48                     \ICanBoogie\log_success('The module %title was installed.', array('title' => $module->title));
49                 }
50 
51                 $enabled[$key] = true;
52             }
53             catch (\Exception $e)
54             {
55                 $core->modules[$key] = false;
56                 $errors[] = $e->getMessage();
57             }
58         }
59 
60         return !count($errors);
61     }
62 
63     protected function process()
64     {
65         global $core;
66 
67         $enabled = array_keys($core->modules->enabled_modules_descriptors);
68         $enabled = array_flip($enabled);
69 
70         foreach ((array) $this->key as $key => $dummy)
71         {
72             $enabled[$key] = true;
73         }
74 
75         $core->vars['enabled_modules'] = array_keys($enabled);
76 
77         $this->response->location = \ICanBoogie\Routing\contextualize('/admin/' . (string) $this->module);
78 
79         return true;
80     }
81 }
Autodoc API documentation generated by ApiGen 2.8.0