• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Engine_Db_Table类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中Engine_Db_Table的典型用法代码示例。如果您正苦于以下问题:PHP Engine_Db_Table类的具体用法?PHP Engine_Db_Table怎么用?PHP Engine_Db_Table使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: deleteAction

 public function deleteAction()
 {
     if (!$this->_helper->requireAuth()->setAuthParams('ynsocialads_campaign', null, 'delete')->isValid()) {
         return;
     }
     // In smoothbox
     $this->_helper->layout->setLayout('admin-simple');
     $id = $this->_getParam('id');
     $campaign = Engine_Api::_()->getItem('ynsocialads_campaign', $id);
     if (!$campaign->isDeletable()) {
         return;
     }
     $this->view->campaign_id = $id;
     // Check post
     if ($this->getRequest()->isPost()) {
         $db = Engine_Db_Table::getDefaultAdapter();
         $db->beginTransaction();
         try {
             $campaign->deleteAllAds();
             $campaign->status = "deleted";
             $campaign->save();
             $db->commit();
         } catch (Exception $e) {
             $db->rollBack();
             throw $e;
         }
         $this->_forward('success', 'utility', 'core', array('smoothboxClose' => 10, 'parentRefresh' => 10, 'messages' => array('')));
     }
 }
开发者ID:hoalangoc,项目名称:ftf,代码行数:29,代码来源:CampaignsController.php


示例2: editAction

 public function editAction()
 {
     // In smoothbox
     $this->_helper->layout->setLayout('admin-simple');
     $id = $this->_getParam('id', 0);
     $location = Engine_Api::_()->getItem('user_location', $id);
     if (!$id || !$location) {
         return $this->_helper->requireSubject()->forward();
     }
     $form = $this->view->form = new User_Form_Admin_Location_Add();
     $form->setAction($this->getFrontController()->getRouter()->assemble(array()));
     $form->setField($location);
     if ($location->level) {
         $form->removeElement('continent');
     }
     // Check post
     if ($this->getRequest()->isPost() && $form->isValid($this->getRequest()->getPost())) {
         // Ok, we're good to add field
         $values = $form->getValues();
         $db = Engine_Db_Table::getDefaultAdapter();
         $db->beginTransaction();
         try {
             $location->title = $values["title"];
             if ($location->level == 0) {
                 $location->continent = $values['continent'];
             }
             $location->save();
             $db->commit();
         } catch (Exception $e) {
             $db->rollBack();
             throw $e;
         }
         return $this->_forward('success', 'utility', 'core', array('smoothboxClose' => true, 'parentRefresh' => true, 'messages' => array('Edit successfully!')));
     }
 }
开发者ID:hoalangoc,项目名称:ftf,代码行数:35,代码来源:AdminLocationsController.php


示例3: init

 public function init()
 {
     $this->setMethod('POST');
     $defaultArgs = array('disableLoadDefaultDecorators' => true, 'decorators' => array('ViewHelper'));
     $identity = $this->getAttrib('user_id');
     $user_object = Engine_Api::_()->user()->getUser($identity);
     $user_id = new Zend_Form_Element_Hidden('user_id');
     $user_id->setValue($identity);
     $email = new Zend_Form_Element_Text('email', $defaultArgs);
     $email->addValidator('emailAddress', true)->addValidator(new Zend_Validate_Db_NoRecordExists(Engine_Db_Table::getTablePrefix() . 'users', 'email'));
     $email->setValue($user_object->email);
     $password = new Zend_Form_Element_Password('password', $defaultArgs);
     $password->addValidator('stringLength', false, array(6, 32));
     $passconf = new User_Form_Element_PasswordConfirm('passconf', $defaultArgs);
     //$passconf->addDecorator('ViewHelper');
     if ($settings->getSetting('user.signup.username', 1) > 0) {
         $username = new Zend_Form_Element_Text('username', $defaultArgs);
         $username->setValue($user_object->username);
         $username->addValidator('stringLength', true, array(6, 32))->addValidator(new Zend_Validate_Db_NoRecordExists(Engine_Db_Table::getTablePrefix() . 'users', 'username'));
     }
     $language = new Zend_Form_Element_Select('language', $defaultArgs);
     $language->addMultiOptions(array('English', 'post-English'));
     $language->setValue($user_object->language_id);
     $level_id = new Zend_Form_Element_Select('level_id', $defaultArgs);
     $level_id->setValue($user_object->level_id);
     $levels = Engine_Api::_()->authorization()->getLevelInfo();
     foreach ($levels as $level) {
         $level_id->addMultiOption($level['level_id'], $level['title']);
     }
     $this->addElements(array($user_id, $email, $password, $passconf, $username, $level_id, $language));
 }
开发者ID:HiLeo1610,项目名称:tumlumsach,代码行数:31,代码来源:Account.php


示例4: deleteContentAction

 public function deleteContentAction()
 {
     // In smoothbox
     $this->_helper->layout->setLayout('admin-simple');
     $content_id = $this->_getParam('content_id');
     $this->view->content_id = $content_id;
     // Check post
     if ($this->getRequest()->isPost()) {
         $db = Engine_Db_Table::getDefaultAdapter();
         $db->beginTransaction();
         try {
             $content = Engine_Api::_()->getItem('ynfeed_welcome', $content_id);
             if ($content) {
                 $content->delete();
             }
             $db->commit();
         } catch (Exception $e) {
             $db->rollBack();
             throw $e;
         }
         $this->_forward('success', 'utility', 'core', array('smoothboxClose' => 10, 'parentRefresh' => 10, 'messages' => array('')));
     }
     // Output
     $this->renderScript('admin-welcome/delete.tpl');
 }
开发者ID:hoalangoc,项目名称:ftf,代码行数:25,代码来源:AdminWelcomeController.php


示例5: editAction

 public function editAction()
 {
     // In smoothbox
     $this->_helper->layout->setLayout('admin-simple');
     // Must have an id
     if (!($id = $this->_getParam('id'))) {
         die('No identifier specified');
     }
     $typeTable = Engine_Api::_()->getDbtable('languages', 'user');
     $type = $typeTable->find($id)->current();
     $form = $this->view->form = new User_Form_Admin_Language_Add();
     $form->setAction($this->getFrontController()->getRouter()->assemble(array()));
     $form->setField($type);
     // Check post
     if ($this->getRequest()->isPost() && $form->isValid($this->getRequest()->getPost())) {
         // Ok, we're good to add field
         $values = $form->getValues();
         $db = Engine_Db_Table::getDefaultAdapter();
         $db->beginTransaction();
         try {
             $type->title = $values["label"];
             $type->save();
             $db->commit();
         } catch (Exception $e) {
             $db->rollBack();
             throw $e;
         }
         return $this->_forward('success', 'utility', 'core', array('smoothboxClose' => 10, 'parentRefresh' => 10, 'messages' => array('')));
     }
     // Output
     $this->renderScript('admin-languages/form.tpl');
 }
开发者ID:hoalangoc,项目名称:ftf,代码行数:32,代码来源:AdminLanguagesController.php


示例6: init

 public function init()
 {
     $settings = Engine_Api::_()->getApi('settings', 'core');
     $this->setTitle('SignUp - Required Info');
     // Init email
     $this->addElement('Text', 'email', array('label' => 'Email Address', 'description' => 'You will use your email address to login.', 'required' => true, 'allowEmpty' => false, 'tabindex' => $tabIndex++, 'validators' => array(array('NotEmpty', true), array('EmailAddress', true), array('Db_NoRecordExists', true, array(Engine_Db_Table::getTablePrefix() . 'users', 'email')))));
     $this->email->getValidator('Db_NoRecordExists')->setMessage('Someone has already registered this email address, please use another one.', 'recordFound');
     // Add banned email validator
     $bannedEmailValidator = new Engine_Validate_Callback(array($this, 'checkBannedEmail'), $emailElement);
     $bannedEmailValidator->setMessage("This email address is not available, please use another one.");
     $this->email->addValidator($bannedEmailValidator);
     if ($settings->getSetting('socialconnect.inputpassword', 0)) {
         // Element: password
         $this->addElement('Password', 'password', array('label' => 'Password', 'description' => 'Passwords must be at least 6 characters in length.', 'required' => true, 'allowEmpty' => false, 'validators' => array(array('NotEmpty', true), array('StringLength', false, array(6, 32))), 'tabindex' => $tabIndex++));
         $this->password->getDecorator('Description')->setOptions(array('placement' => 'APPEND'));
         $this->password->getValidator('NotEmpty')->setMessage('Please enter a valid password.', 'isEmpty');
         // Element: passconf
         $this->addElement('Password', 'passconf', array('label' => 'Password Again', 'description' => 'Enter your password again for confirmation.', 'required' => true, 'validators' => array(array('NotEmpty', true)), 'tabindex' => $tabIndex++));
         $this->passconf->getDecorator('Description')->setOptions(array('placement' => 'APPEND'));
         $this->passconf->getValidator('NotEmpty')->setMessage('Please make sure the "password" and "password again" fields match.', 'isEmpty');
         $specialValidator = new Engine_Validate_Callback(array($this, 'checkPasswordConfirm'), $this->password);
         $specialValidator->setMessage('Password did not match', 'invalid');
         $this->passconf->addValidator($specialValidator);
     }
     // Init submit
     $this->addElement('Button', 'submit', array('label' => 'Continue', 'type' => 'submit', 'ignore' => true));
 }
开发者ID:hoalangoc,项目名称:ftf,代码行数:27,代码来源:AddEmail.php


示例7: indexAction

 public function indexAction()
 {
     if (!Engine_Api::_()->core()->hasSubject()) {
         return $this->setNoRender();
     }
     if (!($group = Engine_Api::_()->core()->getSubject('group'))) {
         return $this->setNoRender();
     }
     $viewer = Engine_Api::_()->user()->getViewer();
     if (!$group->authorization()->isAllowed($viewer, "view")) {
         return $this->setNoRender();
     }
     if ($this->_getParam('number') != '' && $this->_getParam('number') >= 0) {
         $limit = $this->_getParam('number');
     } else {
         $limit = 5;
     }
     $db = Engine_Db_Table::getDefaultAdapter();
     $db->beginTransaction();
     $select = "SELECT count(*) as post_count, `result`.subject_id FROM ((SELECT type1.`action_id`  , type1.`subject_id` , 'action' as 'type'\n                    FROM engine4_activity_actions type1\n                    WHERE object_type = 'group' and object_id = {$group->getIdentity()})\n                    UNION (\n                    SELECT like1.`action_id` , like2.`poster_id` as 'subject_id' , 'like' as 'type'\n                    FROM engine4_activity_likes like2\n                    JOIN engine4_activity_actions like1 ON like2.resource_id = like1.action_id\n                    WHERE like1.object_type =  'group'\n                    AND like1.object_id = {$group->getIdentity()})\n                    UNION (\n                    SELECT com1.`action_id`, com2.`poster_id` as 'subject_id' , 'comment' as 'type'\n                    FROM engine4_activity_comments com2\n                    JOIN engine4_activity_actions com1 ON com2.resource_id = com1.action_id\n                    WHERE com1.object_type =  'group'\n                    AND com1.object_id = {$group->getIdentity()}\n                    )\n                    ) as `result`\n                    GROUP BY `result`.subject_id\n                    ORDER BY post_count DESC";
     $results = $db->fetchAll($select);
     $this->view->limit = $limit;
     $this->view->group = $group;
     $this->view->results = $results;
     // Do not render if nothing to show
     if (count($results) <= 0) {
         return $this->setNoRender();
     }
 }
开发者ID:hoalangoc,项目名称:ftf,代码行数:29,代码来源:Controller.php


示例8: editAction

 public function editAction()
 {
     // In smoothbox
     $this->_helper->layout->setLayout('admin-simple');
     $id = $this->_getParam('id');
     $this->view->campaign_id = $id;
     // Check post
     if ($this->getRequest()->isPost()) {
         $newTitle = strip_tags($this->getRequest()->getPost('newTitle'));
         $db = Engine_Db_Table::getDefaultAdapter();
         $db->beginTransaction();
         try {
             $campaign = Engine_Api::_()->getItem('ynsocialads_campaign', $id);
             $campaign->title = $newTitle;
             $campaign->save();
             $db->commit();
         } catch (Exception $e) {
             $db->rollBack();
             throw $e;
         }
         $this->_forward('success', 'utility', 'core', array('smoothboxClose' => 10, 'parentRefresh' => 10, 'messages' => array('')));
     }
     // Output
     $this->renderScript('admin-campaigns/edit.tpl');
 }
开发者ID:hoalangoc,项目名称:ftf,代码行数:25,代码来源:AdminCampaignsController.php


示例9: denyAction

 public function denyAction()
 {
     // In smoothbox
     $this->_helper->layout->setLayout('admin-simple');
     $request = Engine_Api::_()->getItem('advgroup_request', $this->_getParam('req_id'));
     $id = $this->_getParam('id');
     $this->view->group_id = $id;
     // Check post
     if ($this->getRequest()->isPost()) {
         $db = Engine_Db_Table::getDefaultAdapter();
         $db->beginTransaction();
         try {
             $group = Engine_Api::_()->getItem('group', $id);
             if ($group) {
                 $group->requested = false;
                 $group->save();
             }
             if ($request) {
                 $request->status = 2;
                 $request->save();
             }
             $db->commit();
         } catch (Exception $e) {
             $db->rollBack();
             throw $e;
         }
         $notifyApi = Engine_Api::_()->getDbtable('notifications', 'activity');
         $notifyApi->addNotification($group->getOwner(), $group, $group, 'advgroup_request_denied');
         $this->_forward('success', 'utility', 'core', array('smoothboxClose' => 10, 'parentRefresh' => 10, 'messages' => array('')));
     }
     // Output
     $this->renderScript('admin-request/deny.tpl');
 }
开发者ID:hoalangoc,项目名称:ftf,代码行数:33,代码来源:AdminRequestController.php


示例10: getDb

 public function getDb()
 {
     if ($this->_db == null) {
         $this->_db = Engine_Db_Table::getDefaultAdapter();
     }
     return $this->_db;
 }
开发者ID:hoalangoc,项目名称:ftf,代码行数:7,代码来源:export.php


示例11: emailAction

 public function emailAction()
 {
     // In smoothbox
     $this->_helper->layout->setLayout('admin-simple');
     $id = $this->_getParam('id');
     $this->view->request_id = $id;
     // Check post
     if ($this->getRequest()->isPost()) {
         $table = Engine_Api::_()->getDbTable('inviterequests', 'user');
         $db = Engine_Db_Table::getDefaultAdapter();
         $db->beginTransaction();
         $post = $this->getRequest()->getPost();
         try {
             $viewer = Engine_Api::_()->user()->getViewer();
             $request = Engine_Api::_()->getItem('user_inviterequest', $id);
             $message = trim($post['message']);
             $mailType = 'user_email_request';
             $mailParams = array('host' => $_SERVER['HTTP_HOST'], 'email' => $email, 'date' => time(), 'sender_email' => $request->email, 'sender_title' => $viewer->getTitle(), 'sender_link' => $viewer->getHref(), 'message' => $message);
             Engine_Api::_()->getApi('mail', 'core')->sendSystem($request->email, $mailType, $mailParams);
             $db->commit();
         } catch (Exception $e) {
             $db->rollBack();
             throw $e;
         }
         $this->_forward('success', 'utility', 'core', array('smoothboxClose' => true, 'parentRefresh' => true, 'messages' => array('Email has been sent to requester.')));
     }
 }
开发者ID:hoalangoc,项目名称:ftf,代码行数:27,代码来源:AdminRequestsController.php


示例12: onItemDeleteBefore

 public function onItemDeleteBefore($event)
 {
     $item = $event->getPayload();
     if ($item instanceof Core_Model_Item_Abstract) {
         $db = Engine_Db_Table::getDefaultAdapter();
         $db->delete('engine4_seo_pages', array('page_id = ?' => $item->getGuid()));
     }
 }
开发者ID:rwetzlmayr,项目名称:seo-module,代码行数:8,代码来源:Core.php


示例13: deleteNode

 public function deleteNode($node, $moveToId = 0)
 {
     $moveToId = (int) $moveToId;
     $db = Engine_Db_Table::getDefaultAdapter();
     $ids = $node->getAllChildrenIds();
     $db->update('engine4_event_events', array('category_id' => $moveToId), 'category_id IN(' . implode(',', $ids) . ')');
     $db->delete('engine4_event_categories', 'category_id IN(' . implode(',', $ids) . ')');
 }
开发者ID:hoalangoc,项目名称:ftf,代码行数:8,代码来源:Categories.php


示例14: denyAction

 public function denyAction()
 {
     $id = $this->_getParam('id');
     $array_id = $this->_getParam('array_id');
     $reasonTable = Engine_Api::_()->getItemTable('slprofileverify_reason');
     $this->view->reasons = $reasonTable->fetchAll();
     $type = $this->_getParam('type');
     if ($type != "unverifying") {
         $type = "denied";
     }
     $this->view->type = $type;
     if ($this->getRequest()->isPost()) {
         $values = $this->getRequest()->getPost();
         if (!isset($values['reason']) && !isset($values['other'])) {
             $this->view->error_reason = 1;
             return;
         }
         if (empty($values['content']) && isset($values['other'])) {
             $this->view->error_reason = 2;
             return;
         }
         $messages = "<ul style='list-style: square inside none;'>";
         if (isset($values['reason'])) {
             foreach ($values['reason'] as $reason_id) {
                 $reason = Engine_Api::_()->getItem('slprofileverify_reason', $reason_id);
                 $messages .= "<li>" . $reason->description . '</li>';
             }
         }
         if (!empty($values['content'])) {
             $messages .= "<li>" . $values['content'] . '</li>';
         }
         $messages .= "</ul>";
         $db = Engine_Db_Table::getDefaultAdapter();
         $db->beginTransaction();
         try {
             $settingApi = Engine_Api::_()->getApi('core', 'slprofileverify');
             if (!empty($array_id)) {
                 $array_ids = split(",", $array_id);
                 foreach ($array_ids as $id) {
                     if ($id) {
                         $settingApi->verifyUser($id, 'unverified');
                         $settingApi->sendMailVerify($id, $messages, $type);
                     }
                 }
             } else {
                 if ($id) {
                     $settingApi->verifyUser($id, 'unverified');
                     $settingApi->sendMailVerify($id, $messages, $type);
                 }
             }
             $db->commit();
         } catch (Exception $e) {
             $db->rollBack();
             throw $e;
         }
         $this->_forward('success', 'utility', 'core', array('smoothboxClose' => 10, 'parentRefresh' => 10, 'messages' => array('successfully')));
     }
 }
开发者ID:hoalangoc,项目名称:ftf,代码行数:58,代码来源:VerifyController.php


示例15: contactAction

 public function contactAction()
 {
     $translate = Zend_Registry::get('Zend_Translate');
     $this->view->form = $form = new Core_Form_Contact();
     if (!$this->getRequest()->isPost()) {
         return;
     }
     if (!$form->isValid($this->getRequest()->getPost())) {
         return;
     }
     // Success! Process
     // Mail gets logged into database, so perform try/catch in this Controller
     $db = Engine_Db_Table::getDefaultAdapter();
     $db->beginTransaction();
     try {
         // the contact form is emailed to the first SuperAdmin by default
         $users_table = Engine_Api::_()->getDbtable('users', 'user');
         $users_select = $users_table->select()->where('level_id = ?', 1)->where('enabled >= ?', 1);
         $super_admin = $users_table->fetchRow($users_select);
         $viewer = Engine_Api::_()->user()->getViewer();
         $values = $form->getValues();
         // Check for error report
         $error_report = '';
         $name = $this->_getParam('name');
         $loc = $this->_getParam('loc');
         $time = $this->_getParam('time');
         if ($name && $loc && $time) {
             $error_report .= "\r\n";
             $error_report .= "\r\n";
             $error_report .= "-------------------------------------";
             $error_report .= "\r\n";
             $error_report .= $this->view->translate('The following information about an error was included with this message:');
             $error_report .= "\r\n";
             $error_report .= $this->view->translate('Exception: ') . base64_decode(urldecode($name));
             $error_report .= "\r\n";
             $error_report .= $this->view->translate('Location: ') . base64_decode(urldecode($loc));
             $error_report .= "\r\n";
             $error_report .= $this->view->translate('Time: ') . date('c', base64_decode(urldecode($time)));
             $error_report .= "\r\n";
         }
         // Make params
         $mail_settings = array('host' => $_SERVER['HTTP_HOST'], 'email' => $super_admin->email, 'date' => time(), 'recipient_title' => $super_admin->getTitle(), 'recipient_link' => $super_admin->getHref(), 'recipient_photo' => $super_admin->getPhotoUrl('thumb.icon'), 'sender_title' => $values['name'], 'sender_email' => $values['email'], 'message' => $values['body'], 'error_report' => $error_report);
         if ($viewer && $viewer->getIdentity()) {
             $mail_settings['sender_title'] .= ' (' . $viewer->getTitle() . ')';
             $mail_settings['sender_email'] .= ' (' . $viewer->email . ')';
             $mail_settings['sender_link'] = $viewer->getHref();
         }
         // send email
         Engine_Api::_()->getApi('mail', 'core')->sendSystem($super_admin->email, 'core_contact', $mail_settings);
         // if the above did not throw an exception, it succeeded
         $db->commit();
         $this->view->status = true;
         $this->view->message = $translate->_('Thank you for contacting us!');
     } catch (Zend_Mail_Transport_Exception $e) {
         $db->rollBack();
         throw $e;
     }
 }
开发者ID:robeendey,项目名称:ce,代码行数:58,代码来源:HelpController.php


示例16: getAllOutboxSelect

 public function getAllOutboxSelect($users)
 {
     $rName = Engine_Api::_()->getDbtable('recipients', 'messages')->info('name');
     $cName = $this->info('name');
     $str = implode(",", array_map(array($this, "getFirst"), $users));
     $select = "\n    SELECT `engine4_messages_conversations`.* FROM `engine4_messages_conversations` \n\t\tRIGHT JOIN (`engine4_messages_recipients` INNER JOIN `engine4_ynbanmem_extramessage` ON `engine4_messages_recipients`.outbox_message_id = `engine4_ynbanmem_extramessage`.message_id) \n\t\tON `engine4_messages_recipients`.`conversation_id` = `engine4_messages_conversations`.`conversation_id` WHERE (`engine4_messages_recipients`.`user_id` IN (" . $str . ")) AND (`engine4_messages_recipients`.`outbox_deleted` = 0)  ORDER BY outbox_updated DESC;\n    \n    ";
     $db = Engine_Db_Table::getDefaultAdapter();
     return $db->fetchAll($select);
 }
开发者ID:hoalangoc,项目名称:ftf,代码行数:9,代码来源:Conversations.php


示例17: altUrl

 public function altUrl(Core_Model_Item_Abstract $item)
 {
     $db = Engine_Db_Table::getDefaultAdapter();
     if (isset($this->_memo[$item->getGuid()])) {
         return $this->_memo[$item->getGuid()];
     }
     $url = $db->select()->from('engine4_seo_pages', 'url')->where('page_id = ?', $item->getGuid())->query()->fetchColumn();
     $this->_memo[$item->getGuid()] = $url;
     return $url;
 }
开发者ID:rwetzlmayr,项目名称:seo-module,代码行数:10,代码来源:AltUrl.php


示例18: getValues

 public function getValues($service)
 {
     $return = array();
     if (!is_string($service)) {
         return $return;
     }
     $adapter = Engine_Db_Table::getDefaultAdapter();
     $sql = "\n            select concat('pfid_',t1.field_id) as name, t1.opt_id as value\n            from engine4_socialconnect_maps as t1\n            where t1.service = '{$service}'";
     $rs = $adapter->fetchPairs($sql);
     return $rs;
 }
开发者ID:hoalangoc,项目名称:ftf,代码行数:11,代码来源:Maps.php


示例19: init

 public function init()
 {
     // @todo fix form CSS/decorators
     // @todo replace fake values with real values
     $this->setTitle('General Settings')->setAction(Zend_Controller_Front::getInstance()->getRouter()->assemble(array()));
     // Init email
     $this->addElement('Text', 'email', array('label' => 'Email Address', 'required' => true, 'allowEmpty' => false, 'validators' => array(array('NotEmpty', true), array('EmailAddress', true), array('Db_NoRecordExists', true, array(Engine_Db_Table::getTablePrefix() . 'users', 'email', array('field' => 'user_id', 'value' => $this->getItem()->getIdentity()))))));
     $this->email->getValidator('NotEmpty')->setMessage('Please enter a valid email address.', 'isEmpty');
     $this->email->getValidator('Db_NoRecordExists')->setMessage('Someone has already registered this email address, please use another one.', 'recordFound');
     // Init username
     $this->addElement('Text', 'username', array('label' => 'Profile Address', 'required' => true, 'allowEmpty' => false, 'validators' => array(array('NotEmpty', true), array('Alnum', true), array('StringLength', true, array(4, 64)), array('Regex', true, array('/^[a-z0-9]/i')), array('Db_NoRecordExists', true, array(Engine_Db_Table::getTablePrefix() . 'users', 'username', array('field' => 'user_id', 'value' => $this->getItem()->getIdentity()))))));
     $this->username->getValidator('NotEmpty')->setMessage('Please enter a valid profile address.', 'isEmpty');
     $this->username->getValidator('Db_NoRecordExists')->setMessage('Someone has already picked this profile address, please use another one.', 'recordFound');
     $this->username->getValidator('Regex')->setMessage('Profile addresses must start with a letter.', 'regexNotMatch');
     $this->username->getValidator('Alnum')->setMessage('Profile addresses must be alphanumeric.', 'notAlnum');
     // Init type
     $this->addElement('Select', 'accountType', array('label' => 'Account Type'));
     // Init Facebook
     $facebook_enable = Engine_Api::_()->getApi('settings', 'core')->getSetting('core_facebook_enable', 'none');
     if ('none' != $facebook_enable) {
         $and_publish = 'publish' == $facebook_enable ? ' and publish content to your Facebook wall.' : '.';
         $this->addElement('Dummy', 'facebook', array('label' => 'Facebook Integration', 'description' => 'Linking your Facebook account will let you login with Facebook' . $and_publish, 'content' => User_Model_DbTable_Facebook::loginButton('Integrate with my Facebook')));
         $this->addElement('Checkbox', 'facebook_id', array('label' => 'Integrate with my Facebook', 'description' => 'Facebook Integration'));
     }
     // Init timezone
     $this->addElement('Select', 'timezone', array('label' => 'Timezone', 'description' => 'Select the city closest to you that shares your same timezone.', 'multiOptions' => array('US/Pacific' => '(UTC-8) Pacific Time (US & Canada)', 'US/Mountain' => '(UTC-7) Mountain Time (US & Canada)', 'US/Central' => '(UTC-6) Central Time (US & Canada)', 'US/Eastern' => '(UTC-5) Eastern Time (US & Canada)', 'America/Halifax' => '(UTC-4)  Atlantic Time (Canada)', 'America/Anchorage' => '(UTC-9)  Alaska (US & Canada)', 'Pacific/Honolulu' => '(UTC-10) Hawaii (US)', 'Pacific/Samoa' => '(UTC-11) Midway Island, Samoa', 'Etc/GMT-12' => '(UTC-12) Eniwetok, Kwajalein', 'Canada/Newfoundland' => '(UTC-3:30) Canada/Newfoundland', 'America/Buenos_Aires' => '(UTC-3) Brasilia, Buenos Aires, Georgetown', 'Atlantic/South_Georgia' => '(UTC-2) Mid-Atlantic', 'Atlantic/Azores' => '(UTC-1) Azores, Cape Verde Is.', 'Europe/London' => 'Greenwich Mean Time (Lisbon, London)', 'Europe/Berlin' => '(UTC+1) Amsterdam, Berlin, Paris, Rome, Madrid', 'Europe/Athens' => '(UTC+2) Athens, Helsinki, Istanbul, Cairo, E. Europe', 'Europe/Moscow' => '(UTC+3) Baghdad, Kuwait, Nairobi, Moscow', 'Iran' => '(UTC+3:30) Tehran', 'Asia/Dubai' => '(UTC+4) Abu Dhabi, Kazan, Muscat', 'Asia/Kabul' => '(UTC+4:30) Kabul', 'Asia/Yekaterinburg' => '(UTC+5) Islamabad, Karachi, Tashkent', 'Asia/Dili' => '(UTC+5:30) Bombay, Calcutta, New Delhi', 'Asia/Katmandu' => '(UTC+5:45) Nepal', 'Asia/Omsk' => '(UTC+6) Almaty, Dhaka', 'India/Cocos' => '(UTC+6:30) Cocos Islands, Yangon', 'Asia/Krasnoyarsk' => '(UTC+7) Bangkok, Jakarta, Hanoi', 'Asia/Hong_Kong' => '(UTC+8) Beijing, Hong Kong, Singapore, Taipei', 'Asia/Tokyo' => '(UTC+9) Tokyo, Osaka, Sapporto, Seoul, Yakutsk', 'Australia/Adelaide' => '(UTC+9:30) Adelaide, Darwin', 'Australia/Sydney' => '(UTC+10) Brisbane, Melbourne, Sydney, Guam', 'Asia/Magadan' => '(UTC+11) Magadan, Soloman Is., New Caledonia', 'Pacific/Auckland' => '(UTC+12) Fiji, Kamchatka, Marshall Is., Wellington')));
     // Init default locale
     $locale = Zend_Registry::get('Locale');
     $localeMultiKeys = array_merge(array_keys(Zend_Locale::getLocaleList()));
     $localeMultiOptions = array();
     $languages = Zend_Locale::getTranslationList('language', $locale);
     $territories = Zend_Locale::getTranslationList('territory', $locale);
     foreach ($localeMultiKeys as $key) {
         if (!empty($languages[$key])) {
             $localeMultiOptions[$key] = $languages[$key];
         } else {
             $locale = new Zend_Locale($key);
             $region = $locale->getRegion();
             $language = $locale->getLanguage();
             if (!empty($languages[$language]) && !empty($territories[$region])) {
                 $localeMultiOptions[$key] = $languages[$language] . ' (' . $territories[$region] . ')';
             }
         }
     }
     $localeMultiOptions = array_merge(array('auto' => '[Automatic]'), $localeMultiOptions);
     $this->addElement('Select', 'locale', array('label' => 'Locale', 'description' => 'Dates, times, and other settings will be displayed using this locale setting.', 'multiOptions' => $localeMultiOptions));
     // Init submit
     $this->addElement('Button', 'submit', array('label' => 'Save Changes', 'type' => 'submit', 'ignore' => true));
     // Create display group for buttons
     #$this->addDisplayGroup($emailAlerts, 'checkboxes');
     // Set default action
     $this->setAction(Zend_Controller_Front::getInstance()->getRouter()->assemble(array('module' => 'user', 'controller' => 'settings', 'action' => 'general'), 'default'));
 }
开发者ID:robeendey,项目名称:ce,代码行数:53,代码来源:General.php


示例20: init

 public function init()
 {
     $this->setAttrib('id', 'admin_members_edit')->setTitle('Edit Member')->setDescription('You can change the details of this member\'s account here.')->setAction($_SERVER['REQUEST_URI']);
     // init email
     $this->addElement('Text', 'email', array('label' => 'Email Address', 'validators' => array(array('NotEmpty', true), array('EmailAddress', true), array('Db_NoRecordExists', true, array(Engine_Db_Table::getTablePrefix() . 'users', 'email', array('field' => 'user_id', 'value' => (int) $this->_userIdentity)))), 'filters' => array('StringTrim')));
     $this->email->getValidator('EmailAddress')->getHostnameValidator()->setValidateTld(false);
     // init username
     if (Engine_Api::_()->getApi('settings', 'core')->getSetting('user.signup.username', 1) > 0) {
         $this->addElement('Text', 'username', array('label' => 'Username'));
     }
     // init password
     $this->addElement('Password', 'password', array('label' => 'Password'));
     $this->addElement('Password', 'password_conf', array('label' => 'Password Again'));
     // Init level
     $levelMultiOptions = array();
     //0 => ' ');
     $levels = Engine_Api::_()->getDbtable('levels', 'authorization')->fetchAll();
     foreach ($levels as $row) {
         $levelMultiOptions[$row->level_id] = $row->getTitle();
     }
     $this->addElement('Select', 'level_id', array('label' => 'Member Level', 'multiOptions' => $levelMultiOptions));
     // Init level
     $networkMultiOptions = array();
     //0 => ' ');
     $networks = Engine_Api::_()->getDbtable('networks', 'network')->fetchAll();
     foreach ($networks as $row) {
         $networkMultiOptions[$row->network_id] = $row->getTitle();
     }
     $this->addElement('Multiselect', 'network_id', array('label' => 'Networks', 'multiOptions' => $networkMultiOptions));
     // Get list of Member Types
     $db = Engine_Db_Table::getDefaultAdapter();
     $member_type_result = $db->select('option_id, label')->from('engine4_user_fields_options')->where('field_id = 1')->query()->fetchAll();
     $member_type_count = count($member_type_result);
     $member_type_array = array();
     for ($i = 0; $i < $member_type_count; $i++) {
         $member_type_array[$member_type_result[$i]['option_id']] = $member_type_result[$i]['label'];
     }
     $this->addElement('Select', 'profile_type', array('label' => 'Profile Type', 'multiOptions' => $member_type_array));
     // Init approved
     $this->addElement('Checkbox', 'approved', array('label' => 'Approved?'));
     // Init verified
     $this->addElement('Checkbox', 'verified', array('label' => 'Verified?'));
     // Init enabled
     $this->addElement('Checkbox', 'enabled', array('label' => 'Enabled?'));
     // Buttons
     $this->addElement('Button', 'submit', array('label' => 'Save Changes', 'type' => 'submit', 'ignore' => true, 'decorators' => array('ViewHelper')));
     $this->addElement('Cancel', 'cancel', array('label' => 'cancel', 'link' => true, 'prependText' => ' or ', 'onclick' => 'parent.Smoothbox.close();', 'decorators' => array('ViewHelper')));
     $this->addDisplayGroup(array('submit', 'cancel'), 'buttons');
     $button_group = $this->getDisplayGroup('buttons');
     $button_group->addDecorator('DivDivDivWrapper');
 }
开发者ID:hoalangoc,项目名称:ftf,代码行数:51,代码来源:Edit.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Engine_Form类代码示例发布时间:2022-05-23
下一篇:
PHP Engine_Api类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap