コード例 #1
0
ファイル: proposal.php プロジェクト: netixx/frankiz
 function handler_remove($page, $id = null)
 {
     S::assert_xsrf_token();
     $val = ValidateFilter::fromId($id, false);
     if ($val === false) {
         $page->trigError("This item doesn't exist");
         return;
     }
     $val->select(ValidateSelect::validate());
     if ($val->writer()->id() != S::user()->id()) {
         throw new Exception("Invalid crendentials");
     }
     S::logger()->log('proposal/remove', array('type' => $val->type(), 'writer' => $val->writer()->id(), 'group' => $val->group()->id(), 'created' => $val->created()->toDb(), 'item' => $val->itemToDb()));
     $val->item()->sendmailcancel(S::user());
     $val->clean();
     pl_redirect(Env::v('url'));
 }
コード例 #2
0
ファイル: admin.php プロジェクト: netixx/frankiz
 function handler_validate($page, $gid = null, $vid = null)
 {
     $page->assign('msg', '');
     $gf = new GroupFilter(new PFC_Or(new GFC_Id($gid), new GFC_Name($gid)));
     $group = $gf->get(true);
     if (!$group) {
         throw new Exception("This Group (' . {$gid} . ') doesn't exist");
     }
     $group->select(GroupSelect::base());
     if (!S::user()->hasRights($group, Rights::admin())) {
         throw new Exception("You don't have the credential to validate request in this group");
     }
     $filter = new ValidateFilter(new VFC_Group($group));
     $collec = $filter->get()->select(ValidateSelect::validate());
     if (Env::has('val_id')) {
         $el = $collec->get(Env::v('val_id'));
         if (!$el) {
             $page->assign('msg', 'La validation a déjà été effectuée.');
         } else {
             if (Env::has('accept') || Env::has('delete')) {
                 S::logger()->log('admin/validate', array('type' => $el->type(), 'writer' => $el->writer()->id(), 'group' => $el->group()->id(), 'created' => $el->created()->toDb(), 'valid' => Env::has('accept'), 'item' => $el->itemToDb()));
             }
             if ($el->handle_form() && (Env::has('accept') || Env::has('delete'))) {
                 $collec->remove(Env::v('val_id'));
             }
         }
     }
     $page->assign('validation', is_null($vid) ? 0 : $vid);
     $page->assign('isEdition', false);
     $page->assign('gid', $gid);
     $page->assign('group', $group);
     $page->assign('val', $collec);
     $page->addCssLink('validate.css');
     $page->addCssLink('surveys.css');
     $page->assign('title', "Validations des requêtes");
     $page->changeTpl('validate/validate.tpl');
 }
コード例 #3
0
ファイル: frankizpage.php プロジェクト: netixx/frankiz
 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'));
     }
 }