Example #1
0
 /**
  * Add content types to models of the module config for the application
  *
  * @param  Application $application
  * @return void
  */
 public static function bootstrap(Application $application)
 {
     $resources = $application->config()['resources'];
     $params = $application->services()->getParams('nav.phire');
     $config = $application->module('phire-content');
     $models = isset($config['models']) ? $config['models'] : null;
     $types = Table\ContentTypes::findAll(['order' => 'order ASC']);
     foreach ($types->rows() as $type) {
         if (null !== $models) {
             if (!isset($models['Phire\\Content\\Model\\Content'])) {
                 $models['Phire\\Content\\Model\\Content'] = [];
             }
             $models['Phire\\Content\\Model\\Content'][] = ['type_field' => 'type_id', 'type_value' => $type->id, 'type_name' => $type->name];
         }
         $resources['content-type-' . $type->id . '|content-type-' . str_replace(' ', '-', strtolower($type->name))] = ['index', 'add', 'edit', 'remove'];
         if (!isset($params['tree']['content']['children'])) {
             $params['tree']['content']['children'] = [];
         }
         $params['tree']['content']['children']['content-type-' . $type->id] = ['name' => $type->name, 'href' => '/content/' . $type->id, 'acl' => ['resource' => 'content-type-' . $type->id, 'permission' => 'index']];
     }
     $application->mergeConfig(['resources' => $resources]);
     $application->services()->setParams('nav.phire', $params);
     if (null !== $models) {
         $application->module('phire-content')->mergeConfig(['models' => $models]);
     }
     $content = Table\Content::findBy(['roles!=' => 'a:0:{}']);
     if ($content->hasRows()) {
         foreach ($content->rows() as $c) {
             $application->services()->get('acl')->addResource(new \Pop\Acl\Resource\Resource('content-' . $c->id));
         }
     }
 }
Example #2
0
 /**
  * Bootstrap the module
  *
  * @param  Application $application
  * @return void
  */
 public static function bootstrap(Application $application)
 {
     $resources = $application->config()['resources'];
     $params = $application->services()->getParams('nav.phire');
     $config = $application->module('phire-media');
     $models = isset($config['models']) ? $config['models'] : null;
     $libraries = Table\MediaLibraries::findAll(['order' => 'order ASC']);
     foreach ($libraries->rows() as $library) {
         if (null !== $models) {
             if (!isset($models['Phire\\Media\\Model\\Media'])) {
                 $models['Phire\\Media\\Model\\Media'] = [];
             }
             $models['Phire\\Media\\Model\\Media'][] = ['type_field' => 'library_id', 'type_value' => $library->id, 'type_name' => $library->name];
         }
         $resources['media-library-' . $library->id . '|media-library-' . str_replace(' ', '-', strtolower($library->name))] = ['index', 'add', 'edit', 'remove'];
         if (!isset($params['tree']['media']['children'])) {
             $params['tree']['media']['children'] = [];
         }
         $params['tree']['media']['children']['media-library-' . $library->id] = ['name' => $library->name, 'href' => '/media/' . $library->id, 'acl' => ['resource' => 'media-library-' . $library->id, 'permission' => 'index']];
     }
     $application->mergeConfig(['resources' => $resources]);
     $application->services()->setParams('nav.phire', $params);
     if (null !== $models) {
         $application->module('phire-media')->mergeConfig(['models' => $models]);
     }
 }
Example #3
0
 /**
  * Bootstrap the module
  *
  * @param  Application $application
  * @return void
  */
 public static function bootstrap(Application $application)
 {
     $forms = $application->config()['forms'];
     if (isset($forms['Phire\\Content\\Form\\Content'])) {
         $forms['Phire\\Content\\Form\\Content'][0]['content_tags'] = ['type' => 'text', 'label' => 'Tags', 'attributes' => ['size' => 15, 'class' => 'tags-field']];
         $application->mergeConfig(['forms' => $forms], true);
     }
 }
Example #4
0
 /**
  * Bootstrap the module
  *
  * @param  Application $application
  * @return void
  */
 public static function bootstrap(Application $application)
 {
     $forms = $application->config()['forms'];
     if (isset($forms['Phire\\Content\\Form\\Content'])) {
         $forms['Phire\\Content\\Form\\Content'][0]['feed'] = ['type' => 'radio', 'label' => 'Include in Feed?', 'value' => ['1' => 'Yes', '0' => 'No'], 'marked' => '0'];
         $forms['Phire\\Content\\Form\\Content'][0]['feed_type'] = ['type' => 'hidden', 'value' => 'content'];
     }
     if (isset($forms['Phire\\Media\\Form\\Media'])) {
         $forms['Phire\\Media\\Form\\Media'][0]['feed'] = ['type' => 'radio', 'label' => 'Include in Feed?', 'value' => ['1' => 'Yes', '0' => 'No'], 'marked' => '0'];
         $forms['Phire\\Media\\Form\\Media'][0]['feed_type'] = ['type' => 'hidden', 'value' => 'media'];
     }
     $application->mergeConfig(['forms' => $forms], true);
 }
Example #5
0
 /**
  * Bootstrap the module
  *
  * @param  Application $application
  * @return void
  */
 public static function bootstrap(Application $application)
 {
     if ($application->isRegistered('phire-content')) {
         $templates = Table\Templates::findBy(['parent_id' => null]);
         if ($templates->hasRows()) {
             $forms = $application->config()['forms'];
             foreach ($templates->rows() as $template) {
                 if ($template->visible) {
                     $forms['Phire\\Content\\Form\\Content'][0]['content_template']['value'][$template->id] = $template->name;
                 }
             }
             $application->mergeConfig(['forms' => $forms], true);
         }
     }
 }
Example #6
0
 /**
  * Bootstrap the module
  *
  * @param  Application $application
  * @return void
  */
 public static function bootstrap(Application $application)
 {
     $forms = $application->config()['forms'];
     $cat = new Model\Category();
     $cat->getAll();
     if (count($cat->getFlatMap()) > 0) {
         $categoryValues = $cat->getCategoryValues();
         if (isset($forms['Phire\\Content\\Form\\Content'])) {
             $forms['Phire\\Content\\Form\\Content'][0]['categories'] = ['type' => 'checkbox', 'label' => 'Categories', 'value' => $categoryValues];
             $forms['Phire\\Content\\Form\\Content'][0]['category_type'] = ['type' => 'hidden', 'value' => 'content'];
         }
         if (isset($forms['Phire\\Media\\Form\\Media'])) {
             $forms['Phire\\Media\\Form\\Media'][0]['categories'] = ['type' => 'checkbox', 'label' => 'Categories', 'value' => $categoryValues];
             $forms['Phire\\Media\\Form\\Media'][0]['category_type'] = ['type' => 'hidden', 'value' => 'media'];
         }
         if (isset($forms['Phire\\Media\\Form\\Batch'])) {
             $forms['Phire\\Media\\Form\\Batch'][0]['categories'] = ['type' => 'checkbox', 'label' => 'Categories', 'value' => $categoryValues];
             $forms['Phire\\Media\\Form\\Batch'][0]['category_type'] = ['type' => 'hidden', 'value' => 'media'];
         }
         $application->mergeConfig(['forms' => $forms], true);
     }
 }
Example #7
0
 /**
  * Bootstrap the module
  *
  * @param  Application $application
  * @return void
  */
 public static function bootstrap(Application $application)
 {
     if ($application->isRegistered('phire-content')) {
         $theme = Table\Themes::findBy(['active' => 1]);
         if (isset($theme->id)) {
             $dir = new Dir($_SERVER['DOCUMENT_ROOT'] . BASE_PATH . CONTENT_PATH . '/themes/' . $theme->folder, ['filesOnly' => true]);
             $parentDir = null;
             if (null !== $theme->parent_id) {
                 $parentTheme = Table\Themes::findById($theme->parent_id);
                 if (isset($parentTheme->id)) {
                     $parentDir = new Dir($_SERVER['DOCUMENT_ROOT'] . BASE_PATH . CONTENT_PATH . '/themes/' . $parentTheme->folder, ['filesOnly' => true]);
                 }
             }
             $forms = $application->config()['forms'];
             if (null !== $parentDir) {
                 $dirFiles = $dir->getFiles();
                 foreach ($dirFiles as $file) {
                     if (strpos($file, '.ph') !== false && !in_array($file, $application->module('phire-themes')['invisible'])) {
                         $forms['Phire\\Content\\Form\\Content'][0]['content_template']['value'][$file] = $file;
                     }
                 }
                 foreach ($parentDir->getFiles() as $file) {
                     if (!in_array($file, $dirFiles) && strpos($file, '.ph') !== false && !in_array($file, $application->module('phire-themes')['invisible'])) {
                         $forms['Phire\\Content\\Form\\Content'][0]['content_template']['value'][$file] = $file . ' (parent)';
                     }
                 }
             } else {
                 foreach ($dir->getFiles() as $file) {
                     if (strpos($file, '.ph') !== false && !in_array($file, $application->module('phire-themes')['invisible'])) {
                         $forms['Phire\\Content\\Form\\Content'][0]['content_template']['value'][$file] = $file;
                     }
                 }
             }
             $application->mergeConfig(['forms' => $forms], true);
         }
     }
 }