当前位置: 首页>>代码示例>>PHP>>正文


PHP Key::flag方法代码示例

本文整理汇总了PHP中Key::flag方法的典型用法代码示例。如果您正苦于以下问题:PHP Key::flag方法的具体用法?PHP Key::flag怎么用?PHP Key::flag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Key的用法示例。


在下文中一共展示了Key::flag方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: flag

 public function flag()
 {
     $key = new Key($this->key_id);
     $key->flag();
 }
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:5,代码来源:Sheet.php

示例2: view

 /**
  * Constructs a view of this form and returns it in a string.
  *
  * This function will construct a view of this form whether in edit mode
  * or submission mode and return it in a string for display.
  *
  * @param  boolean $edit Whether the view is in edit mode or not.
  * @return mixed   A templated string on success, or a FALSE on failure.
  * @access public
  */
 function view($edit = FALSE, $error = null)
 {
     if ($this->isHidden() && !$edit || !$this->isSaved() && !Current_User::allow('phatform', 'edit_forms')) {
         return dgettext('phatform', 'This form is not available for viewing at this time.');
     }
     $GLOBALS['CNT_phatform']['title'] = $this->getLabel();
     /* Do some basic checks if we're not in edit mode */
     if (!$edit) {
         /* If this form is not anonymous and the user is not logged in, print message and bail */
         if (($this->_editData || !$this->_anonymous) && !Current_User::isLogged()) {
             return dgettext('phatform', 'You must be logged in to view this form!');
         }
         /* If this form is not multi submit and the user has filled out this for before,
            print message and bail */
         if (!$this->_editData && !$this->_multiSubmit && $this->hasSubmission()) {
             return dgettext('phatform', 'You have already filled out this form!');
         }
         if (!Current_User::isDeity() && Current_User::allow('phatform', 'user_forms_only')) {
             if (Current_User::getUsername() != $this->getOwner()) {
                 return dgettext('phatform', 'You only have permission to edit your own forms!');
             }
         }
     }
     /* Assume the PHAT position :) */
     if (!isset($this->_position)) {
         $this->_position = 0;
     }
     /* Setup limit for loop */
     if ($this->_position + $this->_pageLimit > sizeof($this->_elements)) {
         $limit = $this->_position + (sizeof($this->_elements) - $this->_position);
     } else {
         $limit = $this->_position + $this->_pageLimit;
     }
     /* Begin view template array */
     if ($this->currentPage() == 1) {
         $viewTags['BLURB0'] = PHPWS_Text::parseOutput($this->_blurb0, ENCODE_PARSED_TEXT, false, true);
         if (!$this->_saved) {
             $viewTags['WARNING'] = dgettext('phatform', 'The form must be saved before it is available to the public.');
         }
     }
     $formTags = array();
     /* If this form has elements, loop and add them to the form template array */
     if (is_array($this->_elements) && sizeof($this->_elements) > 0) {
         for ($i = $this->_position; $i < $limit; $i++) {
             $sectionTags = array();
             $elementInfo = explode(':', $this->_elements[$i]);
             $this->element = new $elementInfo[0]($elementInfo[1]);
             /* If user can edit data, populate for element with it */
             if (!$edit && $this->_editData && is_array($this->_userData)) {
                 if (isset($this->_userData[$this->element->getLabel()]) && $this->isSerialized($this->_userData[$this->element->getLabel()])) {
                     $value = unserialize(stripslashes($this->_userData[$this->element->getLabel()]));
                     $this->element->setValue($value);
                 } else {
                     $this->element->setValue($this->_userData[$this->element->getLabel()]);
                 }
             }
             /* Setup color for alternating rows in the section template */
             if (isset($flag) && $flag) {
                 $flag = FALSE;
             } else {
                 $sectionTags['BGCOLOR'] = ' class="bgcolor1" ';
                 $flag = TRUE;
             }
             /* Get view of the current element */
             $sectionTags['ELEMENT'] = $this->element->view();
             if ($this->_showElementNumbers) {
                 $sectionTags['ELEMENT'] = $i + 1 . '. ' . $sectionTags['ELEMENT'];
             }
             /* If in edit mode, show the element editor for the current element */
             if ($edit) {
                 $sectionTags['ELEMENT_NAME'] = PHPWS_Text::parseOutput($this->element->getLabel(), ENCODE_PARSED_TEXT, false, true);
                 $sectionTags['ELEMENT_EDITOR'] = $this->_elementEditor($i);
             }
             if (!isset($formTags['ELEMENTS'])) {
                 $formTags['ELEMENTS'] = PHPWS_Template::processTemplate($sectionTags, 'phatform', 'form/section.tpl');
             } else {
                 $formTags['ELEMENTS'] .= PHPWS_Template::processTemplate($sectionTags, 'phatform', 'form/section.tpl');
             }
         }
         /* If we are on last page...show the submit button */
         if (!$edit) {
             if ($this->currentPage() == $this->numPages()) {
                 if ($this->_editData && $this->currentPage() > 1) {
                     $formTags['BACK_BUTTON'] = PHPWS_Form::formSubmit(dgettext('phatform', 'Back'), 'PHAT_Back');
                 }
                 if (PHATFORM_CAPTCHA && $this->_anonymous && !Current_User::isLogged()) {
                     PHPWS_Core::initCoreClass('Captcha.php');
                     $formTags['CAPTCHA'] = Captcha::get();
                 }
                 $formTags['SUBMIT_BUTTON'] = PHPWS_Form::formSubmit(dgettext('phatform', 'Finish'), 'PHAT_Submit');
//.........这里部分代码省略.........
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:101,代码来源:Form.php

示例3: view

 /**
  * Displays the blog entry
  *
  * @param boolean edit       If true, show edit link
  * @param boolean summarized If true, this is a summarized entry
  */
 public function view($edit = true, $summarized = true)
 {
     if (!$this->id) {
         PHPWS_Core::errorPage(404);
     }
     $key = new Key($this->key_id);
     if (!$key->allowView() || !Blog_User::allowView()) {
         Current_User::requireLogin();
         return dgettext('blog', 'You do not have permission to view this entry.');
     }
     $template['TITLE'] = sprintf('<a href="%s" rel="bookmark">%s</a>', $this->getViewLink(true), $this->title);
     $template['TITLE_NO_LINK'] = $this->title;
     if ($this->publish_date > time()) {
         $template['UNPUBLISHED'] = dgettext('blog', 'Unpublished');
     } elseif ($this->expire_date && $this->expire_date < time()) {
         $template['UNPUBLISHED'] = dgettext('blog', 'Expired');
     }
     $template['LOCAL_DATE'] = $this->getPublishDate();
     $summary = $this->getSummary(true);
     $entry = $this->getEntry(true);
     if ($summarized) {
         if (empty($summary)) {
             $template['SUMMARY'] = PHPWS_Text::parseTag($entry);
         } else {
             if (!empty($entry)) {
                 $template['READ_MORE'] = PHPWS_Text::rewriteLink(Icon::get('chevron-circle-down') . '&nbsp;' . dgettext('blog', 'Read more'), 'blog', array('id' => $this->id), null, 'Read more of this entry', 'btn btn-default');
             }
             $template['SUMMARY'] = PHPWS_Text::parseTag($summary);
         }
     } else {
         $template['SUMMARY'] = PHPWS_Text::parseTag($summary);
         $template['ENTRY'] = PHPWS_Text::parseTag($entry);
     }
     $template['IMAGE'] = $this->getFile($this->thumbnail && $summarized);
     if ($edit && (Current_User::allow('blog', 'edit_blog', $this->id, 'entry') || Current_User::allow('blog', 'edit_blog') && $this->author_id == Current_User::getId())) {
         $vars['blog_id'] = $this->id;
         $vars['action'] = 'admin';
         $vars['command'] = 'edit';
         $template['EDIT_LINK'] = PHPWS_Text::secureLink(dgettext('blog', 'Edit'), 'blog', $vars);
         $template['EDIT_URI'] = PHPWS_Text::linkAddress('blog', $vars, true);
         if (!$summarized) {
             MiniAdmin::add('blog', array(PHPWS_Text::secureLink(dgettext('blog', 'Edit blog'), 'blog', $vars)));
         }
     }
     // Check setting for showing when the entry was posted
     if (PHPWS_Settings::get('blog', 'show_posted_by')) {
         $template['POSTED_BY'] = dgettext('blog', 'By');
         $template['AUTHOR'] = $this->author;
     }
     // Check settings for showing the author of the entry
     if (PHPWS_Settings::get('blog', 'show_posted_date')) {
         $template['PUBLISHED'] = dgettext('blog', 'Published');
         $template['POSTED_ON'] = dgettext('blog', 'Posted on');
         $template['PUBLISHED_DATE'] = $this->getPublishDateShort();
     }
     if ($summarized) {
         $view_tpl = 'view_list.tpl';
     } else {
         $template['COMMENT_SCRIPT'] = PHPWS_Settings::get('blog', 'comment_script');
         $key->flag();
         $view_tpl = 'view_full.tpl';
     }
     return PHPWS_Template::process($template, 'blog', $view_tpl);
 }
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:70,代码来源:Blog.php


注:本文中的Key::flag方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。