Exemple #1
0
 /**
  * @dataProvider getFiles
  */
 public function testMiniModules($mininame)
 {
     global $globals;
     // Load minimodule
     $mini = FrankizMiniModule::get($mininame, false);
     $tplPath = $globals->spoolroot . '/templates/default/' . $mini->template();
     $this->assertTrue(file_exists($tplPath), "Minimodule template does not exist");
 }
Exemple #2
0
 function handler_home($page)
 {
     $page->assign('MiniModules_COL_LEFT', FrankizMiniModule::get(S::user()->minimodules(FrankizMiniModule::COL_LEFT)));
     $page->assign('MiniModules_COL_MIDDLE', FrankizMiniModule::get(S::user()->minimodules(FrankizMiniModule::COL_MIDDLE)));
     $page->assign('MiniModules_COL_RIGHT', FrankizMiniModule::get(S::user()->minimodules(FrankizMiniModule::COL_RIGHT)));
     $postit = Group::from('postit');
     // /!\ : Everybody can read the post-it, you don't have to be member of the group
     $nf = new NewsFilter(new PFC_And(new NFC_Current(), new NFC_TargetGroup($postit)), new NFO_Begin(true));
     $postit_news = $nf->get(true);
     if ($postit_news) {
         $postit_news->select(NewsSelect::news());
     }
     $page->assign('postit_news', $postit_news);
     $page->assign('title', 'Accueil');
     $page->changeTpl('frankiz/home.tpl');
 }
Exemple #3
0
 public function run()
 {
     $skin = $this->load_skin();
     $this->assign('skin', S::v('skin'));
     $user = S::user();
     $this->assign('user', $user);
     $this->assign('logged', !is_null($user) && S::logged());
     // Remote IP
     $this->assign('remip', IPAddress::getInstance());
     $this->assign('MiniModules_COL_FLOAT', FrankizMiniModule::get(S::user()->minimodules(FrankizMiniModule::COL_FLOAT)));
     $this->addCssLink(FrankizMiniModule::batchCss());
     // Enable JSON loading of the module only
     if (Env::has('solo')) {
         $this->jsonAssign('content', $this->raw());
         $this->jsonAssign('title', $this->get_template_vars('title'));
         $this->jsonAssign('pl_css', $this->get_template_vars('pl_css'));
         $this->jsonAssign('pl_js', $this->get_template_vars('pl_js'));
         $this->runJSon();
     } else {
         $this->assign('quick_validate', array());
         if (S::user()->castes(Rights::admin())->count() > 0) {
             $validate_filter = new ValidateFilter(new VFC_User(S::user()));
             $validates = $validate_filter->get()->select(ValidateSelect::quick());
             $quick_validate = $validates->split('group');
             $this->assign('quick_validate', $quick_validate);
         }
         $request_filter = new ValidateFilter(new VFC_Writer(S::user()));
         $requests = $request_filter->get()->select(ValidateSelect::quick());
         $this->assign('self_url', pl_self());
         $this->assign('quick_requests', $requests);
         $this->_run(self::getTplPath('frankiz.tpl'));
     }
 }
Exemple #4
0
 function handler_ajax_minimodules_remove($page)
 {
     $json = json_decode(Env::v('json'));
     $m = FrankizMiniModule::get($json->name);
     $success = S::user()->removeMinimodule($m);
     if (!$success) {
         $page->jsonAssign('error', "Impossible de désactiver le minimodule");
     }
     return PL_JSON;
 }