Пример #1
0
 /**
  * Method to show a form to update context settings
  */
 protected function __updatesettings()
 {
     $context = $this->objContext->getContextDetails($this->contextCode);
     $objContextForms = $this->getObject('contextforms');
     $form = $objContextForms->editContextForm($context);
     $this->setVarByRef('form', $form);
     return 'editcontextsettings_tpl.php';
 }
 /**
  * Method to render the block
  */
 public function show()
 {
     if ($this->contextCode == 'root' || $this->contextCode == '') {
         return '';
     }
     $contextDetails = $this->objContext->getContextDetails($this->contextCode);
     if ($contextDetails == FALSE) {
         return '';
     }
     $numModules = count($this->objModules->getContextPlugins());
     $modules = $this->objContextModules->getContextModules($this->contextCode);
     if (count($modules) == 0) {
         $str = '<div class="noRecordsMessage">' . $this->objLanguage->code2Txt('mod_context_contexthasnopluginsabs', 'context', array('plugins' => 'plugins'), 'This [-context-] does not have any [-plugins-] enabled') . '</div>';
     } else {
         $table = $this->newObject('htmltable', 'htmlelements');
         $objIcon = $this->newObject('geticon', 'htmlelements');
         $counter = 0;
         foreach ($modules as $module) {
             $moduleInfo = $this->objModules->getModuleInfo($module);
             if ($moduleInfo['isreg']) {
                 if ($counter % 2 == 0) {
                     $table->startRow('context_plugin');
                 }
                 $objIcon->setModuleIcon($module);
                 $moduleTitle = $this->objModules->getModuleTitle($module);
                 $objIcon->alt = $moduleTitle;
                 $objIcon->title = $moduleTitle;
                 $link = new link($this->uri(NULL, $module));
                 $link->link = $objIcon->show();
                 $table->addCell($link->show(), 25, 'middle');
                 $link->link = $moduleTitle;
                 $table->addCell($link->show(), '45%', 'middle');
                 $counter++;
                 if ($counter % 2 == 0) {
                     $table->endRow();
                 }
             }
         }
         if ($counter % 2 == 1) {
             $table->addCell('&nbsp;');
             $table->addCell('&nbsp;');
             $table->endRow();
         }
         $str = $table->show();
     }
     $str .= '<p align="right">' . $this->objLanguage->code2Txt('mod_context_unusedpluginsabs', 'context', array('plugins' => 'plugins'), 'Unused [-plugins-]') . ': ' . ($numModules - count($modules)) . '</p>';
     $link = new link($this->uri(array('action' => 'manageplugins')));
     $link->link = $this->objLanguage->code2Txt('mod_context_managepluginsabs', 'context', array('plugins' => 'plugins'), 'Manage [-plugins-]');
     return $str . '<p class="admin_link">' . $link->show() . '</p>';
 }
 /**
  * Method to render the block
  */
 public function show()
 {
     // Check Context Code is Valid
     if ($this->contextCode == 'root' || $this->contextCode == '') {
         return '';
     }
     // Get Context Details
     $contextDetails = $this->objContext->getContextDetails($this->contextCode);
     // Check that Context Exists
     if ($contextDetails == FALSE) {
         return '';
     }
     // Prepare Block
     $objContextImage = $this->getObject('contextimage');
     $objIcon = $this->newObject('geticon', 'htmlelements');
     $image = $objContextImage->getContextImage($this->contextCode);
     if ($image == FALSE) {
         $objIcon->setIcon('imagepreview');
         $image = $objIcon->show();
     } else {
         $image = '<img src="' . $image . '" />';
     }
     $table = $this->newObject('htmltable', 'htmlelements');
     $table->startRow();
     $table->addCell($image, 120);
     $str = '<p><strong>' . ucwords($this->objLanguage->code2Txt('mod_context_contexttitle', 'context', NULL, '[-context-] Title')) . '</strong>: ' . $contextDetails['title'] . '</p>';
     $str .= '<p><strong>' . ucwords($this->objLanguage->code2Txt('mod_context_contextstatus', 'context', NULL, '[-context-] status')) . '</strong>: ' . $contextDetails['status'] . '</p>';
     if ($this->objSysConfig->getValue('context_access_private_only', 'context', 'false') == 'false' || $this->objUser->isAdmin()) {
         $str .= '<p><strong>' . $this->objLanguage->languageText('mod_context_accessettings', 'context', 'Access Settings') . '</strong>: ' . $contextDetails['access'] . '</p>';
     }
     $table->addCell($str);
     $table->endRow();
     $link = new link($this->uri(array('action' => 'updatesettings')));
     $link->link = ucwords($this->objLanguage->code2Txt('mod_context_changecontextsettings', 'context', NULL, 'Change [-context-] Settings'));
     return $table->show() . '<p>' . $link->show() . '</p>';
 }