예제 #1
0
파일: Show.php 프로젝트: sinfocol/gwf3
 public function templateShow(GWF_Guestbook $gb)
 {
     $nested = $gb->isNestingAllowed();
     if ($nested) {
         return $this->templateNested($gb);
     }
     $user = GWF_Session::getUser();
     $can_moderate = $gb->canModerate($user);
     $gbid = $gb->getID();
     $mod = GWF_GuestbookMSG::IN_MODERATION;
     $conditions = "gbm_gbid={$gbid}";
     $conditions .= $can_moderate ? '' : " AND gbm_options&{$mod}=0";
     //		$orderby = $nested ? 'gbm_replyto ASC, gbm_date ASC' : 'gbm_date ASC';
     $orderby = 'gbm_date ASC';
     $msgs = GDO::table('GWF_GuestbookMSG');
     $ipp = $this->module->cfgItemsPerPage();
     $nItems = $msgs->countRows($conditions);
     $nPages = GWF_PageMenu::getPagecount($ipp, $nItems);
     $page = Common::clamp(intval(Common::getGet('page', $nPages)), 1, $nPages);
     $gbid_app = $gbid === 1 ? '' : '/' . $gbid;
     # append
     // TODO tVAR cleanup ?
     $tVars = array('gb' => $gb, 'entries' => $msgs->selectObjects('*', $conditions, $orderby, $ipp, GWF_PageMenu::getFrom($page, $ipp)), 'page_menu' => GWF_PageMenu::display($page, $nPages, GWF_WEB_ROOT . 'guestbook/show' . $gbid_app . '/page-%PAGE%'), 'href_sign' => GWF_WEB_ROOT . 'guestbook/sign/' . $gbid, 'href_moderate' => GWF_WEB_ROOT . 'guestbook/edit/' . $gbid, 'can_moderate' => $can_moderate, 'can_sign' => $gb->canSign(GWF_Session::getUser(), $this->module->cfgAllowGuest()), 'allow_url' => $this->module->cfgAllowURL(), 'allow_email' => $this->module->cfgAllowEMail(), 'btn_edit' => $can_moderate ? GWF_Button::options(GWF_WEB_ROOT . 'guestbook/edit/' . $gbid, $this->module->lang('btn_edit_gb')) : '');
     $filename = 'show.tpl';
     //		$filename = $nested ? 'show_nested.php' : 'show.php';
     return $this->module->template($filename, $tVars);
 }
예제 #2
0
파일: Moderate.php 프로젝트: sinfocol/gwf3
 public function getForm(GWF_Guestbook $gb)
 {
     $data = array();
     $data['title'] = array(GWF_Form::STRING, $gb->getVar('gb_title'), $this->module->lang('th_gb_title'));
     $data['locked'] = array(GWF_Form::CHECKBOX, $gb->isLocked(), $this->module->lang('th_gb_locked'));
     $data['moderated'] = array(GWF_Form::CHECKBOX, $gb->isModerated(), $this->module->lang('th_gb_moderated'));
     $data['g_view'] = array(GWF_Form::CHECKBOX, $gb->isGuestViewable(), $this->module->lang('th_gb_guest_view'));
     $data['g_sign'] = array(GWF_Form::CHECKBOX, $gb->isGuestWriteable(), $this->module->lang('th_gb_guest_sign'));
     $data['bbcode'] = array(GWF_Form::CHECKBOX, $gb->isBBAllowed(), $this->module->lang('th_gb_bbcode'));
     $data['website'] = array(GWF_Form::CHECKBOX, $gb->isURLAllowed(), $this->module->lang('th_gb_urls'));
     $data['smileys'] = array(GWF_Form::CHECKBOX, $gb->isSmileyAllowed(), $this->module->lang('th_gb_smiles'));
     $data['emails'] = array(GWF_Form::CHECKBOX, $gb->isEMailAllowed(), $this->module->lang('th_gb_emails'));
     $data['emailentries'] = array(GWF_Form::CHECKBOX, $gb->isEMailOnSign(), $this->module->lang('th_mailonsign'));
     if ($this->module->cfgNesting()) {
         $data['nesting'] = array(GWF_Form::CHECKBOX, $gb->isNestingAllowed(), $this->module->lang('th_gb_nesting'));
     }
     $data['descr'] = array(GWF_Form::MESSAGE, $gb->getVar('gb_descr'), $this->module->lang('th_gb_descr'));
     $data['edit'] = array(GWF_Form::SUBMIT, $this->module->lang('btn_edit_gb'));
     return new GWF_Form($this, $data);
 }