コード例 #1
0
ファイル: PageController.php プロジェクト: pi-module/demo
 /**
  * For page render
  */
 public function viewAction()
 {
     $id = _get('id');
     $row = $this->getModel('page')->find($id);
     $page = $row->toArray();
     $page['module'] = $this->getModule();
     $form = new BaseForm();
     $form->add(array('name' => 'tag', 'type' => 'tag'));
     $this->view()->assign('form', $form);
     $this->view()->assign('page', $page);
     $this->view()->setTemplate('page-content');
 }
コード例 #2
0
ファイル: ConfigForm.php プロジェクト: Andyyang1981/pi
 /**
  * {@inheritDoc}
  */
 public function isValid()
 {
     foreach ($this->configs as $config) {
         $this->addFilter($config);
     }
     return parent::isValid();
 }
コード例 #3
0
ファイル: PostForm.php プロジェクト: Andyyang1981/pi
 /**
  * Constructor
  *
  * @param null|string|int $name   Optional name for the element
  * @param string          $markup Page type: text, html, markdown
  */
 public function __construct($name = null, $markup = null)
 {
     $name = $name ?: 'comment-post';
     $this->markup = $markup ?: $this->markup;
     parent::__construct($name);
     $this->setAttribute('action', Pi::service('comment')->getUrl('submit'));
 }
コード例 #4
0
ファイル: EventForm.php プロジェクト: pi-module/event
 public function __construct($name = null, $option = array())
 {
     $this->option = $option;
     $this->thumbUrl = isset($option['thumbUrl']) ? $option['thumbUrl'] : '';
     $this->removeUrl = isset($option['removeUrl']) ? $option['removeUrl'] : '';
     $this->module = Pi::service('module')->current();
     parent::__construct($name);
 }
コード例 #5
0
ファイル: LoginForm.php プロジェクト: Andyyang1981/pi
 /**
  * Constructor
  *
  * @param string $name
  * @param array $config
  */
 public function __construct($name, array $config = array())
 {
     if (!$config) {
         $config = Pi::user()->config();
     }
     $this->config = $config;
     parent::__construct($name);
 }
コード例 #6
0
ファイル: BlockStaticForm.php プロジェクト: Andyyang1981/pi
 public function isValid()
 {
     $inputFilter = $this->getInputFilter();
     $inputFilter->add(array('name' => 'title', 'filters' => array(array('name' => 'StringTrim'))));
     $inputFilter->add(array('name' => 'name', 'required' => false, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(new WidgetNameDuplicate())));
     $inputFilter->add(array('name' => 'description', 'required' => false, 'filters' => array(array('name' => 'StringTrim'))));
     $inputFilter->add(array('name' => 'id', 'required' => true, 'allow_empty' => true));
     $inputFilter->add(array('name' => 'content', 'required' => true, 'allow_empty' => false));
     $inputFilter->add(array('name' => 'type', 'required' => true, 'allow_empty' => true));
     return parent::isValid();
 }
コード例 #7
0
ファイル: DraftEditForm.php プロジェクト: Andyyang1981/pi
 /**
  * Initialize object
  * 
  * @param string  $name     Form name
  * @param array   $options  Optional parameters
  */
 public function __construct($name, $options = array())
 {
     if (isset($options['mode'])) {
         $this->mode = $options['mode'];
     }
     if (Config::FORM_MODE_CUSTOM == $this->mode) {
         $this->items = isset($options['elements']) ? $options['elements'] : array();
     } elseif (!empty($options['elements'])) {
         $this->items = $options['elements'];
     } else {
         $this->items = $this->getDefaultElements($this->mode);
     }
     parent::__construct($name);
 }
コード例 #8
0
ファイル: SitemapForm.php プロジェクト: pi-module/event
 public function __construct($name = null)
 {
     parent::__construct($name);
 }
コード例 #9
0
ファイル: EditUserForm.php プロジェクト: Andyyang1981/pi
 public function __construct($name, $fields)
 {
     $this->fields = $fields;
     $this->name = $name;
     parent::__construct($this->name);
 }
コード例 #10
0
ファイル: RegisterForm.php プロジェクト: pi-module/event
 public function __construct($name = null, $option = array())
 {
     $this->option = $option;
     parent::__construct($name);
 }
コード例 #11
0
ファイル: AccountForm.php プロジェクト: Andyyang1981/pi
 /**
  * Constructor
  *
  * @param null|string|int $name Optional name for the element
  * @param Account $user User account row
  */
 public function __construct($name = null, $user = null)
 {
     $this->user = $user;
     parent::__construct($name);
 }
コード例 #12
0
ファイル: BlockModuleForm.php プロジェクト: Andyyang1981/pi
 /**
  * {@inheritDoc}
  */
 public function isValid()
 {
     $inputFilter = $this->getInputFilter();
     $inputFilter->add(array('name' => 'title', 'filters' => array(array('name' => 'StringTrim'))));
     $inputFilter->add(array('name' => 'name', 'required' => false, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(new \Module\System\Validator\BlockNameDuplicate())));
     $inputFilter->add(array('name' => 'description', 'required' => false, 'filters' => array(array('name' => 'StringTrim'))));
     $inputFilter->add(array('name' => 'subline', 'required' => false, 'filters' => array(array('name' => 'StringTrim'))));
     $inputFilter->add(array('name' => 'class', 'required' => false, 'filters' => array(array('name' => 'StringTrim'))));
     $inputFilter->add(array('name' => 'cache_ttl', 'required' => false));
     $inputFilter->add(array('name' => 'cache_level', 'required' => false));
     $inputFilter->add(array('name' => 'id', 'allow_empty' => true));
     $inputFilter->add(array('name' => 'root', 'required' => true, 'allow_empty' => true));
     $inputFilter->add(array('name' => 'title_hidden', 'required' => true, 'allow_empty' => true));
     $inputFilter->add(array('name' => 'body_fullsize', 'required' => true, 'allow_empty' => true));
     $this->addConfigFilter($inputFilter);
     return parent::isValid();
 }
コード例 #13
0
ファイル: RoleForm.php プロジェクト: Andyyang1981/pi
 /**
  * Constructor
  *
  * @param null|string|int $name Optional name for the form
  * @param string $section
  */
 public function __construct($name = null, $section = 'front')
 {
     $this->section = $section;
     parent::__construct($name);
 }
コード例 #14
0
ファイル: MemberForm.php プロジェクト: Andyyang1981/pi
 /**
  * Constructor
  *
  * @param null|string|int $name Optional name for the form
  * @param array $user User account data
  */
 public function __construct($name = null, $user = array())
 {
     $this->user = array_merge($this->user, $user);
     parent::__construct($name);
 }
コード例 #15
0
ファイル: UserForm.php プロジェクト: Andyyang1981/pi
 /**
  * {@inheritDoc}
  *
  * Canonize compound data
  */
 public function getData($flags = FormInterface::VALUES_NORMALIZED)
 {
     $data = parent::getData($flags);
     $result = array();
     foreach ($data as $key => $value) {
         $tmp = Pi::api('form', 'user')->parseCompoundFieldName($key);
         if ($tmp) {
             $result[$tmp[0]][0][$tmp[1]] = $value;
         } else {
             $result[$key] = $value;
         }
     }
     return $result;
 }
コード例 #16
0
ファイル: PlansForm.php プロジェクト: pi-module/plans
 public function __construct($name = null, $option = array())
 {
     $this->option = $option;
     $this->module = Pi::service('module')->current();
     parent::__construct($name);
 }
コード例 #17
0
 /**
  * Get sort form instance
  * 
  * @param int $from
  * @param array $sibling
  *
  * @return Form
  */
 protected function getSortForm($from, array $sibling)
 {
     $name = $sibling[$from];
     unset($sibling[$from]);
     $form = new Form();
     $elements = array(array('name' => 'from', 'options' => array('label' => __('From')), 'attributes' => array('class' => 'form-control', 'options' => array($from => $name)), 'type' => 'select'), array('name' => 'to', 'options' => array('label' => __('To')), 'attributes' => array('class' => 'form-control', 'options' => array(0 => __('First of')) + $sibling), 'type' => 'select'), array('name' => 'security', 'type' => 'csrf'), array('name' => 'submit', 'attributes' => array('value' => __('Submit')), 'type' => 'submit'));
     foreach ($elements as $element) {
         $form->add($element);
     }
     return $form;
 }
コード例 #18
0
ファイル: PageAddForm.php プロジェクト: Andyyang1981/pi
 /**
  * Constructor
  *
  * @param null|string|int $name Optional name for the form
  * @param string $module Page module
  */
 public function __construct($name = null, $module = null)
 {
     $this->module = $module;
     parent::__construct($name);
 }
コード例 #19
0
ファイル: ResetPasswordForm.php プロジェクト: Andyyang1981/pi
 /**
  * Constructor
  *
  * @param string|int $name Optional name for the element
  * @param string            $type
  */
 public function __construct($name = null, $type = null)
 {
     $this->type = $type;
     parent::__construct($name);
 }
コード例 #20
0
ファイル: PageForm.php プロジェクト: Andyyang1981/pi
 /**
  * Constructor
  *
  * @param null|string|int $name Optional name for the element
  * @param string $markup Page type: text, html, markdown
  */
 public function __construct($name = null, $markup = null)
 {
     $this->markup = $markup ?: $this->markup;
     parent::__construct($name);
 }
コード例 #21
0
ファイル: CategoryForm.php プロジェクト: pi-module/plans
 public function __construct($name = null, $option = array())
 {
     parent::__construct($name);
 }
コード例 #22
0
ファイル: DraftCustomForm.php プロジェクト: Andyyang1981/pi
 public function __construct($name, $options = array())
 {
     $this->items = isset($options['elements']) ? $options['elements'] : array();
     $this->custom = isset($options['custom']) ? $options['custom'] : array();
     parent::__construct($name);
 }