當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Element::factory方法代碼示例

本文整理匯總了PHP中Element::factory方法的典型用法代碼示例。如果您正苦於以下問題:PHP Element::factory方法的具體用法?PHP Element::factory怎麽用?PHP Element::factory使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Element的用法示例。


在下文中一共展示了Element::factory方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: __construct

 public function __construct()
 {
     parent::__construct('formLogin', 'Login');
     $this->addElement(Element::factory('text', 'username', 'Username'));
     $this->addElement(Element::factory('password', 'password', 'Password'));
     $this->addButtons(Form::BTN_SUBMIT);
     $this->getElement('submit')->setCaption('Login');
 }
開發者ID:jamesread,項目名稱:lanlist.org,代碼行數:8,代碼來源:FormLogin.php

示例2: __construct

 public function __construct()
 {
     parent::__construct('formDeleteUser', 'Delete user?');
     requirePriv('USER_DELETE');
     $this->addElement(Element::factory('hidden', 'uid', null, $_REQUEST['formDeleteUser-uid']));
     $this->addElement(Element::factory('html', 'msg', null, 'Sure?'));
     $this->addButtons(Form::BTN_SUBMIT);
 }
開發者ID:jamesread,項目名稱:lanlist.org,代碼行數:8,代碼來源:FormDeleteUser.php

示例3: __construct

 public function __construct()
 {
     parent::__construct('formRegister', 'Register a new account');
     $this->addElement(Element::factory('alphanumeric', 'username', 'Username'));
     $this->addElement(Element::factory('password', 'password1', 'Password'));
     $this->addElement(Element::factory('password', 'password2', 'Password (confirm)'));
     $this->addElement(Element::factory('text', 'email', 'E-Mail address'));
     $this->addButtons(Form::BTN_SUBMIT);
 }
開發者ID:jamesread,項目名稱:lanlist.org,代碼行數:9,代碼來源:FormRegister.php

示例4: __construct

 public function __construct()
 {
     parent::__construct('formChangePassword', 'Change password');
     if (!Session::isLoggedIn()) {
         throw new Exception('You need to be logged in to change your password.');
     }
     $this->addElement(Element::factory('password', 'password1', 'New password'));
     $this->addElement(Element::factory('password', 'password2', 'Password (confirm)'));
     $this->addButtons(Form::BTN_SUBMIT);
 }
開發者ID:jamesread,項目名稱:lanlist.org,代碼行數:10,代碼來源:FormChangePassword.php

示例5: getElementOrganization

 private function getElementOrganization()
 {
     global $db;
     $sql = 'SELECT o.id, o.title FROM organizers o WHERE o.published = 1 ORDER BY o.title ASC';
     $stmt = $db->query($sql);
     $el = Element::factory('select', 'organization', 'Organization');
     foreach ($stmt->fetchAll() as $organization) {
         $el->addOption($organization['title'], $organization['id']);
     }
     return $el;
 }
開發者ID:jamesread,項目名稱:lanlist.org,代碼行數:11,代碼來源:FormJoinOrganizer.php

示例6: getGroupSelectionElement

 private function getGroupSelectionElement($currentGroup)
 {
     global $db;
     $el = Element::factory('select', 'group', 'Primary group');
     $sql = 'SELECT g.id, g.title FROM groups g';
     $stmt = $db->prepare($sql);
     $stmt->execute();
     foreach ($stmt->fetchAll() as $group) {
         $el->addOption($group['title'], $group['id']);
     }
     $el->setValue($currentGroup);
     return $el;
 }
開發者ID:jamesread,項目名稱:lanlist.org,代碼行數:13,代碼來源:FormEditUser.php

示例7: getElementSleeping

 private function getElementSleeping($val)
 {
     $el = Element::factory('select', 'sleeping', 'Sleeping');
     $el->addOption('Not aranged by organizer');
     $el->addOption('Not an overnight event');
     $el->addOption('Private rooms at venue');
     $el->addOption('Indoors at venue');
     $el->addOption('Indoors and camping at venue');
     $el->addOption('Indoors, camping and private rooms at venue');
     $el->addOption('Indoors at venue. Camping and hotels nearby.');
     $el->setValue($val);
     return $el;
 }
開發者ID:jamesread,項目名稱:lanlist.org,代碼行數:13,代碼來源:FormEditEvent.php

示例8: __construct

 public function __construct($id, $isNewArticle = false)
 {
     $this->id = $id;
     Session::requirePriv('EDIT_BLOG');
     if (empty($isNewArticle)) {
         parent::__construct('editBlogPost', 'New post');
     } else {
         parent::__construct('editBlogPost', 'Edit post');
     }
     $post = $this->getPost();
     $this->addElement(Element::factory('textarea', 'title', 'Title', $post['title']));
     $this->addElement(Element::factory('textarea', 'content', 'Content', $post['content']));
     $this->addDefaultButtons();
 }
開發者ID:jamesread,項目名稱:lanlist.org,代碼行數:14,代碼來源:FormEditBlogPost.php

示例9: getOrganizerList

 public static function getOrganizerList($includeNull = false)
 {
     global $db;
     $sql = 'SELECT id, title FROM organizers ORDER BY title ASC';
     $stmt = $db->prepare($sql);
     $stmt->execute();
     $el = Element::factory('select', 'organizer', 'Organizer');
     foreach ($stmt->fetchAll() as $orgie) {
         $el->addOption($orgie['title'], $orgie['id']);
     }
     if ($includeNull) {
         $el->addOption('(null)', 0);
     }
     return $el;
 }
開發者ID:jamesread,項目名稱:lanlist.org,代碼行數:15,代碼來源:FormHelpers.php

示例10: __construct

 public function __construct()
 {
     parent::__construct('newOrganizer', 'New Organizer');
     if (Session::getUser()->hasPriv('CREATE_ORGANIZERS')) {
         $this->addElement(Element::factory('html', 'description', null, 'This will appear in the organizers list as soon as you submit the form.'));
     } else {
         $currentOrganizer = Session::getUser()->getData('organization');
         if (empty($currentOrganizer) && $currentOrganizer != 0) {
             throw new PermissionException('Cannot create another organizer, you already have one aginst your account');
         }
         $this->addElement(Element::factory('html', 'description', null, 'This will not appear in the organizers list immidiately, it will first have to be approved by one of our smiling friendly admins - they accept bribes in the form of cake.'));
     }
     $this->addElement(Element::factory('text', 'title', 'Title'));
     $this->addElement(Element::factory('text', 'websiteUrl', 'Website URL'));
     $this->addElement(Element::factory('textarea', 'blurb', 'Blurb', null, 'A blurb describes the organizer, prehaps the year you started, how experienced you are, or if you like cake. Its best to leave event specific information to when you go to create events.'));
     $this->addButtons(Form::BTN_SUBMIT);
 }
開發者ID:jamesread,項目名稱:lanlist.org,代碼行數:17,代碼來源:FormNewOrganizer.php

示例11: __construct

 public function __construct()
 {
     parent::__construct('formEditVenue', 'Edit Venue');
     $venue = $this->getVenue();
     if (Session::getUser()->getData('organization') != $venue['organizer']) {
         Session::requirePriv('EDIT_VENUE');
     }
     $this->addElement(Element::factory('hidden', 'id', null, $venue['id']));
     $this->addElement(Element::factory('text', 'title', 'Title', $venue['title']));
     $this->addElement(Element::factory('text', 'lat', 'Lat', $venue['lat']));
     $this->getElement('lat')->setMinMaxLengths(1, 10);
     $this->addElement(Element::factory('text', 'lng', 'Lng', $venue['lng']));
     $this->getElement('lng')->setMinMaxLengths(1, 10);
     $this->addElement(FormHelpers::getElementCountry($venue['country']));
     $this->addElement(FormHelpers::getOrganizerList());
     $this->getElement('organizer')->setValue($venue['organizer']);
     $this->addButtons(Form::BTN_SUBMIT);
 }
開發者ID:jamesread,項目名稱:lanlist.org,代碼行數:18,代碼來源:FormEditVenue.php

示例12: __construct

 public function __construct()
 {
     parent::__construct('newVenue', 'New Venue');
     $this->addElement(Element::factory('html', 'desc', null, 'A venue is a physical place where an event will be hosted, this may be a convention centre, a hall or just your house. You can specify detail such as sleeping arangements when the event is created.'));
     $this->addElement(Element::factory('text', 'title', 'Title', null, 'eg: Budleigh Salterton town hall, Cheltenham Racecourse, etc.'));
     $this->addElement(FormHelpers::getElementCountry('United Kingdom'));
     $this->addElement(Element::factory('html', 'locationDesc', null, '<br />The geodetic (WGS84) latitude/longitude of your venue. This can be awkward, but it allows us to put a pin on the map. We cannot use post/zip codes because many countries do not have them! <a href = "http://www.getlatlon.com/">http://getlatlong.com</a> will convert an address to a rough lat/lng. '));
     $this->addElement(Element::factory('numeric', 'lat', 'Latitude'))->setAllowNegative(true);
     $this->addElement(Element::factory('numeric', 'lng', 'Longitude'))->setAllowNegative(true);
     if (Session::hasPriv('NEW_VENUE')) {
         $this->addElement(FormHelpers::getOrganizerList());
         if (isset($_REQUEST['formNewVenue-organizer'])) {
             $this->getElement('organizer')->setValue($_REQUEST['formNewVenue-organizer']);
         }
     }
     $this->addButtons(Form::BTN_SUBMIT);
     $this->requireFields(array('title', 'lat', 'lng', 'country'));
 }
開發者ID:jamesread,項目名稱:lanlist.org,代碼行數:18,代碼來源:FormNewVenue.php

示例13: process

 public function process()
 {
     global $db;
     $sql = 'INSERT INTO events (title, dateStart, dateFinish, organizer, venue, published, website, createdDate, createdBy) VALUES (:title, :dateStart, :dateFinish, :organizer, :venue, :published, :website, :createdDate, :createdBy)';
     $stmt = $db->prepare($sql);
     $stmt->bindValue(':title', $this->getElementValue('title'));
     $stmt->bindValue(':dateStart', $this->getElementValue('dateStart'));
     $stmt->bindValue(':dateFinish', $this->getElementValue('dateFinish'));
     $stmt->bindValue(':website', $this->getElementValue('eventWebsite'));
     $stmt->bindValue(':createdDate', date(DATE_ATOM));
     $stmt->bindValue(':createdBy', Session::getUser()->getId());
     if (Session::getUser()->hasPriv('CREATE_EVENTS')) {
         $this->addElement(Element::factory('html', 'msg', null, 'Hi superuser.'));
         $stmt->bindValue(':organizer', $this->getElementValue('organizer'));
         $stmt->bindValue(':published', 1);
         $stmt->bindValue(':venue', $this->getElementValue('venue'));
     } else {
         if (Session::getUser()->getData('organization') != null) {
             $stmt->bindValue(':venue', $this->getElementValue('venue'));
             $organizer = fetchOrganizer(Session::getUser()->getData('organization'));
             if ($organizer['published']) {
                 $this->addElement(Element::factory('html', 'msg', null, 'You are authorized to create public events for your organization.'));
                 $stmt->bindValue(':organizer', $organizer['id']);
                 $stmt->bindValue(':published', 1);
             } else {
                 $this->addElement(Element::factory('html', 'msg', null, 'Your event will be linked to your organization, but will not be public until your organization has been approved.'));
                 $stmt->bindValue(':organizer', $organizer['id']);
                 $stmt->bindValue(':published', 0);
             }
         } else {
             $this->addElement(Element::factory('html', 'msg', null, 'You can create events, but they will not appear in public lists until approved.'));
             $stmt->bindValue(':organizer', '');
             $stmt->bindValue(':published', 0);
             $stmt->bindValue(':venue', '');
         }
     }
     $stmt->execute();
     $eventId = $db->lastInsertId();
     Logger::messageDebug('Event ' . $this->getElementValue('title') . ' created by: ' . Session::getUser()->getUsername(), LocalEventType::CREATE_EVENT);
     redirect('viewEvent.php?id=' . $eventId, 'Event created.');
 }
開發者ID:jamesread,項目名稱:lanlist.org,代碼行數:41,代碼來源:FormNewEvent.php

示例14: __construct

 public function __construct()
 {
     parent::__construct('formSendEmailToUser', 'Send email to user');
     Session::requirePriv('SEND_EMAIL');
     $uid = $_REQUEST['formSendEmailToUser-uid'];
     $uid = intval($uid);
     $this->user = User::getUserById($uid);
     $sql = 'SELECT o.* FROM users u LEFT JOIN organizers o ON u.organization = o.id WHERE u.id = :userId LIMIT 1';
     $stmt = DatabaseFactory::getInstance()->prepare($sql);
     $stmt->bindValue(':userId', $this->user->getId());
     $stmt->execute();
     if ($stmt->numRows()) {
         $this->organizer = $stmt->fetchRow();
     } else {
         $this->organizer = array('title' => '???', 'id' => '0');
     }
     $this->addElement(Element::factory('hidden', 'uid', null, $uid));
     $this->addElement(Element::factory('text', 'email', 'Send to', $this->user->getData('email'), 'User: <a href = "viewUser.php?id=' . $this->user->getId() . '">' . $this->user->getData('username') . '</a> Organizer: <a href = "viewOrganizer.php?id=' . $this->organizer['id'] . '">' . $this->organizer['title'] . '</a>'));
     $this->addElement(Element::factory('text', 'subject', 'Subject', 'Message from a human!'));
     $this->addElement(Element::factory('textarea', 'body', 'Body', 'Hey ' . $this->user->getUsername() . ', ' . "\n\n" . 'Your message here.' . "\n\n- lanlist.org ", 'No footer will be appended. From: mailer@lanlist.org'));
     $this->loadTemplate();
     $this->addButtons(Form::BTN_SUBMIT);
 }
開發者ID:jamesread,項目名稱:lanlist.org,代碼行數:23,代碼來源:FormSendEmailToUser.php

示例15: __construct

 public function __construct()
 {
     parent::__construct('formEditOrganizer', 'Edit Organizer');
     $organizer = fetchOrganizer($_REQUEST['formEditOrganizer-id']);
     if (Session::getUser()->hasPriv('PUBLISH_ORGANIZERS')) {
         $this->addElement(Element::factory('checkbox', 'published', 'Published', $organizer['published']));
     }
     $this->addElement(Element::factory('text', 'title', 'Title', $organizer['title']));
     $this->addElement(Element::factory('hidden', 'id', null, $organizer['id']));
     $this->addElement(Element::factory('text', 'websiteUrl', 'Website', $organizer['websiteUrl']));
     $this->addElement(Element::factory('date', 'assumedStale', 'Assumed stale since', $organizer['assumedStale']));
     $this->addElement(Element::factory('text', 'steamGroupUrl', 'Steam group URL', htmlify($organizer['steamGroupUrl'])));
     $this->getElement('steamGroupUrl')->setMinMaxLengths(0, 255);
     $this->addElement(Element::factory('textarea', 'blurb', 'Blurb', $organizer['blurb']));
     $this->addElement(Element::factory('file', 'banner', 'Banner image', null, 'Your organizer banner image. Preferably a PNG, maximum image size is 468x160'));
     $this->getElement('banner')->destinationDir = 'resources/images/organizer-logos/';
     $this->getElement('banner')->destinationFilename = $organizer['id'] . '.jpg';
     $this->getElement('banner')->setMaxImageBounds(468, 160);
     if (!Session::hasPriv('EDIT_ORGANIZER') && Session::getUser()->getData('organization') != $organizer['id']) {
         throw new PermissionsException();
     }
     $this->addButtons(Form::BTN_SUBMIT);
 }
開發者ID:jamesread,項目名稱:lanlist.org,代碼行數:23,代碼來源:FormEditOrganizer.php


注:本文中的Element::factory方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。