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 use ICanBoogie\I18n;
15 
16 class Module extends \Icybee\Module
17 {
18     const OPERATION_ACTIVATE = 'activate';
19     const OPERATION_DEACTIVATE = 'deactivate';
20 
21     protected function block_install($module_id)
22     {
23         global $core;
24 
25         if (!$core->user->has_permission(self::PERMISSION_ADMINISTER, $this))
26         {
27             return '<div class="alert alert-error">' . I18n\t('You don\'t have enought privileges to install packages.') . '</div>';
28         }
29 
30         if (empty($core->modules[$module_id]))
31         {
32             return '<div class="alert alert-error">' . I18n\t('The module %module_id does not exists.', array('%module_id' => $module_id)) . '</div>';
33         }
34 
35         $errors = new \ICanBoogie\Errors;
36         $module = $core->modules[$module_id];
37 
38         $is_installed = $module->is_installed($errors);
39 
40         if ($is_installed && !count($errors))
41         {
42             return '<div class="alert alert-error">' . I18n\t('The module %module is already installed', array('%module' => $module_id)) . '</div>';
43         }
44 
45         $errors->clear();
46         $is_installed = $module->install($errors);
47 
48         if (!$is_installed || count($errors))
49         {
50             return '<div class="alert alert-error">' . I18n\t('Unable to install the module %module', array('%module' => $module_id)) . '</div>';
51         }
52 
53         return '<div class="alert alert-success">' . I18n\t('The module %module has been installed. <a href="' . $core->site->path . '/admin/' . $this . '">Retourner à la liste.</a>', array('%module' => $module_id)) . '</div>';
54     }
55 }
Autodoc API documentation generated by ApiGen 2.8.0