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


PHP Engine_Db_Table::getDefaultAdapter方法代码示例

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


在下文中一共展示了Engine_Db_Table::getDefaultAdapter方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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

示例4: 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

示例5: 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

示例6: 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

示例7: getDb

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

示例10: 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

示例11: 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

示例12: 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

示例13: 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

示例14: 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

示例15: 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


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