Example #1
0
 public static function initManagement()
 {
     $widgets = Service::getAvailableWidgets();
     $snippets = array();
     foreach ($widgets as $widget) {
         $snippetHtml = $widget->adminHtmlSnippet();
         if ($snippetHtml != '') {
             $snippets[] = $snippetHtml;
         }
     }
     ipAddJsVariable('ipWidgetSnippets', $snippets);
     ipAddJsVariable('ipContentInit', Model::initManagementData());
     ipAddJs('Ip/Internal/Core/assets/js/jquery-ui/jquery-ui.js');
     ipAddCss('Ip/Internal/Core/assets/js/jquery-ui/jquery-ui.css');
     if (ipConfig()->isDebugMode()) {
         ipAddJs('Ip/Internal/Content/assets/management/ipContentManagementInit.js');
         ipAddJs('Ip/Internal/Content/assets/management/content.js');
         ipAddJs('Ip/Internal/Content/assets/management/jquery.ip.contentManagement.js');
         ipAddJs('Ip/Internal/Content/assets/management/jquery.ip.widgetbutton.js');
         ipAddJs('Ip/Internal/Content/assets/management/jquery.ip.layoutModal.js');
         ipAddJs('Ip/Internal/Content/assets/management/jquery.ip.block.js');
         ipAddJs('Ip/Internal/Content/assets/management/jquery.ip.widget.js');
         ipAddJs('Ip/Internal/Content/assets/management/exampleContent.js');
         ipAddJs('Ip/Internal/Content/assets/management/drag.js');
         ipAddJs('Ip/Internal/Content/Widget/Columns/assets/Columns.js');
         ipAddJs('Ip/Internal/Content/Widget/File/assets/File.js');
         ipAddJs('Ip/Internal/Content/Widget/File/assets/jquery.ipWidgetFile.js');
         ipAddJs('Ip/Internal/Content/Widget/File/assets/jquery.ipWidgetFileContainer.js');
         ipAddJs('Ip/Internal/Content/Widget/Form/assets/Form.js');
         ipAddJs('Ip/Internal/Content/Widget/Form/assets/FormContainer.js');
         ipAddJs('Ip/Internal/Content/Widget/Form/assets/FormField.js');
         ipAddJs('Ip/Internal/Content/Widget/Form/assets/FormOptions.js');
         ipAddJs('Ip/Internal/Content/Widget/Html/assets/Html.js');
         ipAddJs('Ip/Internal/Content/Widget/Video/assets/Video.js');
         ipAddJs('Ip/Internal/Content/Widget/Image/assets/Image.js');
         ipAddJs('Ip/Internal/Content/Widget/Gallery/assets/Gallery.js');
         ipAddJs('Ip/Internal/Content/Widget/Text/assets/Text.js');
         ipAddJs('Ip/Internal/Content/Widget/Heading/assets/Heading.js');
         ipAddJs('Ip/Internal/Content/Widget/Heading/assets/HeadingModal.js');
         ipAddJs('Ip/Internal/Content/Widget/Map/assets/Map.js');
     } else {
         ipAddJs('Ip/Internal/Content/assets/management.min.js');
     }
     ipAddJs('Ip/Internal/Core/assets/js/jquery-tools/jquery.tools.ui.scrollable.js');
     ipAddJs('Ip/Internal/Content/assets/jquery.ip.uploadImage.js');
     ipAddJsVariable('isMobile', \Ip\Internal\Browser::isMobile());
     ipAddJsVariable('ipWidgetLayoutModalTemplate', ipView('view/widgetLayoutModal.php')->render());
 }
Example #2
0
 /**
  * @return array
  */
 public static function initManagementData()
 {
     $tmpWidgets = Model::getAvailableWidgetObjects();
     $tmpWidgets = Model::sortWidgets($tmpWidgets);
     $tags = array('Core' => array());
     $uncategorizedWidgets = array();
     unset($tmpWidgets['Columns']);
     foreach ($tmpWidgets as $key => $widget) {
         if ($widget->isCore()) {
             $tags['Core'][$key] = $widget->getName();
         } else {
             $pluginName = $widget->getPluginName();
             if (!array_key_exists($pluginName, $tags)) {
                 $tags[$pluginName] = array();
             }
             $tags[$pluginName][] = $widget->getName();
         }
     }
     // Filter out single widget categories
     foreach ($tags as $key => $widget) {
         $widgetCount = count($tags[$key]);
         if ($widgetCount === 1) {
             $uncategorizedWidgets[] = $widget[0];
             unset($tags[$key]);
         }
     }
     if (count($uncategorizedWidgets) > 0) {
         $tags['Other'] = $uncategorizedWidgets;
     }
     //these two tranlsations appear here just to make translations engine to find these dynamic translations
     __('Other', 'Ip-admin', false);
     __('Core', 'Ip-admin', false);
     $revision = \Ip\ServiceLocator::content()->getCurrentRevision();
     $revisions = \Ip\Internal\Revision::getPageRevisions(ipContent()->getCurrentPage()->getId());
     $manageableRevision = isset($revisions[0]['revisionId']) && $revisions[0]['revisionId'] == $revision['revisionId'];
     $page = ipContent()->getCurrentPage();
     $tags = ipFilter('ipAdminWidgets', $tags);
     $data = array('widgets' => $tmpWidgets, 'tags' => $tags, 'page' => $page, 'currentRevision' => $revision, 'manageableRevision' => $manageableRevision, 'categorySplit' => 3, 'mobile' => Browser::isMobile());
     $controlPanelHtml = ipView('view/adminPanel.php', $data)->render();
     $data = array('tags' => $tags, 'controlPanelHtml' => $controlPanelHtml, 'manageableRevision' => $manageableRevision);
     return $data;
 }