public function showMain()
 {
     // the Add/Edit form.
     $form = new Curry_Form_ModelForm('CronJobSchedule', array('withRelations' => array('CronJob'), 'columnElements' => array('relation__cronjob' => array('select', array('multiOptions' => array(null => '[ Select a job ]') + CronJobQuery::create()->find()->toKeyValue('PrimaryKey', 'FQJobHandler'), 'order' => 0))), 'onFillForm' => function ($cronJobSchedule, $form) {
     }));
     $list = new Curry_ModelView_List('CronJobSchedule', array('modelForm' => $form, 'columns' => array('fq_job_handler' => array('label' => 'Job handler', 'callback' => function ($cronJobSchedule) {
         return $cronJobSchedule->getCronJob()->getFQJobHandler();
     }, 'order' => 0, 'action' => 'edit')), 'actions' => array('action_edit_data' => array('label' => 'Edit job data', 'href' => (string) url('', array('module', 'view' => 'MainEditJobData')), 'single' => true))));
     $list->show($this);
 }
 /** {@inheritdoc} */
 public function showMain()
 {
     $modules = array();
     foreach (Curry_Module::getModuleList() as $className) {
         $parts = explode("_", str_replace("_Module_", "_", $className));
         $package = array_shift($parts);
         $modules[$package][$className] = join(" / ", $parts);
     }
     $templates = array('' => "[ None ]") + Curry_Backend_Template::getTemplateSelect();
     $form = new Curry_Form_ModelForm('Module', array('columnElements' => array('module_class' => array('select', array('multiOptions' => $modules)), 'content_visibility' => array('select', array('multiOptions' => PageModulePeer::$contentVisiblityOptions)), 'template' => array('select', array('multiOptions' => $templates)))));
     $list = new Curry_ModelView_List('Module', array('modelForm' => $form));
     $list->show($this);
 }
 public function showMain()
 {
     $user = User::getUser();
     $role = $user->getUserRole();
     if ($role->getPrimaryKey() != 1 && $role->getName() != 'Super') {
         throw new Exception('This module can be used by an administrator only.');
     }
     $this->renderMenu();
     $mfOwner = new Curry_Form_ModelForm('Managedfile', array('columnElements' => array('filepath' => false, 'type' => false, 'filemime' => false, 'deleted' => false, 'permission' => false, 'created_at' => false, 'updated_at' => false, 'relation__owner' => array('select', array('label' => 'File owner', 'multiOptions' => UserQuery::create()->find()->toKeyValue('UserId', 'Name'), 'required' => true))), 'withRelations' => array('Owner')));
     // create the list view
     $q = ManagedfileQuery::create();
     $list = new Curry_ModelView_List($q, array('title' => 'Managedfiles', 'modelForm' => array($this, 'showMainNewEntity'), 'hide' => array('type'), 'columns' => array('filepath' => array('action' => false), 'owner' => array('order' => 3, 'label' => 'Owner', 'callback' => function ($o) {
         return (string) $o->getOwner();
     }, 'action' => 'set_owner'), 'permission' => array('order' => 4, 'callback' => function ($o) {
         return $o->getHumanReadablePermissions();
     }, 'action' => 'set_permissions'), 'deleted' => array('order' => 5, 'label' => 'Expunged')), 'actions' => array('set_permissions' => array('label' => 'Change file permissions', 'href' => (string) url('', array('module', 'view' => 'MainFilePerm')), 'single' => true, 'class' => 'inline'), 'set_owner' => array('label' => 'Change file owner', 'action' => new Curry_ModelView_Form($mfOwner), 'single' => true, 'class' => 'inline'))));
     $list->removeAction('edit');
     $list->removeAction('delete');
     // render the list
     $list->show($this);
 }
Exemple #4
0
 public function showRoles()
 {
     if (!$this->hasPermission(self::PERMISSION_ROLES)) {
         throw new Exception('You dont have permission to access this view.');
     }
     $this->addMenu();
     $user = User::getUser();
     $backendModules = Curry_Backend::getBackendList();
     $disable = array();
     $backend = array("*" => "All");
     if (!$user->hasAccess('*')) {
         $disable[] = '*';
     }
     foreach ($backendModules as $backendClass => $backendName) {
         $backend[$backendClass] = $backendName;
         $permissions = method_exists($backendClass, 'getPermissions') ? call_user_func(array($backendClass, 'getPermissions')) : array();
         foreach ($permissions as $permission) {
             $backend[$backendClass . "/" . $permission] = Curry_Core::SELECT_TREE_PREFIX . $permission;
             if (!$user->hasAccess($backendClass . "/" . $permission)) {
                 $disable[] = $backendClass . "/" . $permission;
             }
         }
         if (!$user->hasAccess($backendClass)) {
             $disable[] = $backendClass;
         }
     }
     $content = array();
     $contentAccess = array("*" => "All") + Curry_Module::getModuleList();
     $allContentAccess = $user->hasAccess('Curry_Backend_Content/*');
     foreach ($contentAccess as $k => $v) {
         $content['Curry_Backend_Content/' . $k] = $v;
         if (!$allContentAccess && !$user->hasAccess('Curry_Backend_Content/' . $k)) {
             $disable[] = 'Curry_Backend_Content/' . $k;
         }
     }
     $form = new Curry_ModelView_Form('UserRole', array('elements' => array('backend' => array('multiselect', array('label' => 'Backend access', 'multiOptions' => $backend, 'size' => 10, 'order' => 1, 'disable' => $disable, 'validators' => array(array('InArray', true, array(array_diff(array_keys($backend), $disable)))))), 'content' => array('multiselect', array('label' => 'Content access', 'multiOptions' => $content, 'size' => 10, 'order' => 2, 'disable' => $disable, 'validators' => array(array('InArray', true, array(array_diff(array_keys($content), $disable))))))), 'onFillForm' => function (UserRole $role, $form) {
         $access = UserRoleAccessQuery::create()->filterByUserRole($role)->select('Module')->find()->getArrayCopy();
         $form->backend->setValue($access);
         $form->content->setValue($access);
     }, 'onFillModel' => function (UserRole $role, $form, $values) {
         $access = array_merge((array) $values['backend'], (array) $values['content']);
         $collection = new PropelObjectCollection();
         $collection->setModel('UserRoleAccess');
         foreach ($access as $a) {
             $ura = new UserRoleAccess();
             $ura->setModule($a);
             $collection->append($ura);
         }
         $role->setUserRoleAccesss($collection);
     }));
     $q = UserRoleQuery::create();
     $list = new Curry_ModelView_List($q, array('modelForm' => $form));
     $list->addAction('file_permissions', array('action' => $this->getFileAccessList(), 'class' => 'inline', 'single' => true));
     $list->show($this);
 }
Exemple #5
0
 /**
  * Show revisions for page.
  *
  */
 public function showPageRevisions()
 {
     $page = self::getPage(PageAccessPeer::PERM_REVISIONS);
     $ses = new Zend_Session_Namespace(__CLASS__);
     $ses->pageView = 'PageRevisions';
     $this->addPageMenu($page);
     $query = PageRevisionQuery::create()->filterByPage($page);
     $list = new Curry_ModelView_List($query, array('columns' => array('template' => false, 'description' => array('escape' => false, 'callback' => function ($pageRevision) {
         $page = $pageRevision->getPage();
         $icon = '';
         if ($page->getActivePageRevision() === $pageRevision) {
             $icon .= ' <i class="icon-bolt" title="Active revision" />';
         }
         if ($page->getWorkingPageRevision() === $pageRevision) {
             $icon .= ' <i class="icon-wrench" title="Working revision"></i>';
         }
         return htmlspecialchars($pageRevision->getDescription()) . $icon;
     })), 'actions' => array('edit' => false, 'new' => array('href' => (string) url('', array("module", "page_id" => $page->getPageId(), "view" => "CreateRevision"))), 'make_working' => array('label' => 'Switch to working', 'single' => true, 'class' => 'post', 'action' => function ($revision, $backend) use($page) {
         if (isPost()) {
             $page->setWorkingPageRevision($revision);
             $page->save();
             $backend->createModelUpdateEvent('Page', $page->getPrimaryKey(), 'update');
             $backend->createModelUpdateEvent('PageRevision', $revision->getPrimaryKey(), 'update');
         }
     }))));
     if (self::getPagePermission($page, PageAccessPeer::PERM_PUBLISH)) {
         $list->addAction('publish_date', array('label' => 'Set publish date', 'single' => true, 'class' => 'inline', 'href' => (string) url('', array('module', 'view' => 'SetPublishDate'))));
         $list->addAction('publish', array('single' => true, 'class' => 'post', 'action' => function ($revision, Curry_Backend_Page $backend) use($page) {
             if (isPost()) {
                 $backend->publishRevision($revision);
                 $backend->createModelUpdateEvent('Page', $page->getPrimaryKey(), 'update');
                 $backend->createModelUpdateEvent('PageRevision', $revision->getPrimaryKey(), 'update');
             }
         }));
     }
     $list->show($this);
 }
Exemple #6
0
 /**
  * Show edit fields.
  */
 public function showFields()
 {
     $this->addMainMenu();
     $form = new Curry_Form_ModelForm('LanguageString', array('ignorePks' => false, 'columnElements' => array('last_used' => false)));
     $list = new Curry_ModelView_List('LanguageString', array('modelForm' => $form, 'maxPerPage' => 0, 'defaultSortColumn' => 'id', 'columns' => array('id' => array('hide' => false))));
     $list->show($this);
 }