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


PHP Engine_Api::_方法代码示例

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


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

示例1: init

 public function init()
 {
     $view = Zend_Registry::get('Zend_View');
     $this->setTitle('Delete Sub Library');
     $this->setAttrib('class', 'global_form_popup');
     $this->setDescription('Are you sure that you want to delete this library? It will not be recoverable after being deleted.');
     //get table
     $mappingTable = Engine_Api::_()->getDbTable('mappings', 'user');
     //get videos mapping of library
     $params = array();
     $params['owner_type'] = $this->_library->getType();
     $params['owner_id'] = $this->_library->getIdentity();
     $videoMappings = $mappingTable->getItemsMapping('video', $params);
     if (count($this->_subs) && count($videoMappings)) {
         //get main Library
         $viewer = Engine_Api::_()->user()->getViewer();
         $mainLibrary = $viewer->getMainLibrary();
         $arrValue = array();
         $arrValue[0] = $view->translate('None');
         $arrValue[$mainLibrary->getIdentity()] = $view->translate($mainLibrary->getTitle());
         foreach ($this->_subs as $sub) {
             if ($sub->isSelf($this->_library)) {
                 continue;
             }
             $arrValue[$sub->getIdentity()] = $view->translate($sub->getTitle());
         }
         $this->addElement('Select', 'move_to', array('label' => 'Move to Library?', 'description' => 'If you delete this library, all existing content will be moved to another one.', 'multiOptions' => $arrValue));
     }
     $this->addElement('Button', 'submit_button', array('value' => 'submit_button', 'label' => 'Delete', 'onclick' => 'removeSubmit()', 'type' => 'submit', 'ignore' => true, 'decorators' => array('ViewHelper')));
     $this->addElement('Cancel', 'cancel', array('label' => 'cancel', 'link' => true, 'prependText' => ' or ', 'href' => '', 'onclick' => 'parent.Smoothbox.close();', 'decorators' => array('ViewHelper')));
     $this->addDisplayGroup(array('submit_button', 'cancel'), 'buttons', array('decorators' => array('FormElements', 'DivDivDivWrapper')));
 }
开发者ID:hoalangoc,项目名称:ftf,代码行数:32,代码来源:Delete.php

示例2: setPhoto

 public function setPhoto($photo)
 {
     if ($photo instanceof Zend_Form_Element_File) {
         $file = $photo->getFileName();
     } else {
         if (is_array($photo) && !empty($photo['tmp_name'])) {
             $file = $photo['tmp_name'];
         } else {
             if (is_string($photo) && file_exists($photo)) {
                 $file = $photo;
             } else {
                 throw new Event_Model_Exception('invalid argument passed to setPhoto');
             }
         }
     }
     $name = basename($file);
     $path = APPLICATION_PATH . DIRECTORY_SEPARATOR . 'temporary';
     $params = array('parent_id' => $this->getIdentity(), 'parent_type' => 'ynfeed');
     // Save
     $storage = Engine_Api::_()->storage();
     // Resize image (icon)
     $image = Engine_Image::factory();
     $image->open($file)->resize(16, 16)->write($path . '/ic_' . $name)->destroy();
     // Store
     $iMain = $storage->create($path . '/ic_' . $name, $params);
     // Remove temp files
     @unlink($path . '/ic_' . $name);
     // Update row
     $this->photo_id = $iMain->file_id;
     $this->save();
     return $this;
 }
开发者ID:hoalangoc,项目名称:ftf,代码行数:32,代码来源:Content.php

示例3: indexAction

 public function indexAction()
 {
     $this->view->form = $form = new Ynnotification_Form_Admin_Style();
     $values = Engine_Api::_()->getApi('settings', 'core')->getSetting('avdnotification.customcssobj', 0);
     $values = Zend_JSON::decode($values);
     if ($values) {
         $form->populate($values);
     }
     if ($this->getRequest()->isPost() && $form->isValid($this->_getAllParams())) {
         $values = $form->getValues();
         if (isset($_POST['submit'])) {
             // $str = $this->view->partial("_css.tpl");
             $arr_keys = array_keys($values);
             $arr_values = array_values($values);
             $arr_keys = array_map(array($this, 'map'), $arr_keys);
             $str = str_replace($arr_keys, $arr_values, $str);
             Engine_Api::_()->getApi('settings', 'core')->setSetting('avdnotification.customcssobj', Zend_JSON::encode($values));
             Engine_Api::_()->getApi('settings', 'core')->setSetting('avdnotification', $str);
             $form->addNotice('Your changes have been saved.');
         } else {
             if (isset($_POST['clear'])) {
                 Engine_Api::_()->getApi('settings', 'core')->setSetting('avdnotification.customcssobj', '');
                 Engine_Api::_()->getApi('settings', 'core')->setSetting('avdnotification', '');
                 $form->populate(array('mes_background' => '79B4D4', 'text_color' => ''));
                 $form->addNotice('You have set default styles.');
             }
         }
     }
 }
开发者ID:hoalangoc,项目名称:ftf,代码行数:29,代码来源:AdminStylesController.php

示例4: init

 public function init()
 {
     $this->clearDecorators()->addDecorator('FormElements')->addDecorator('Form')->addDecorator('HtmlTag', array('tag' => 'div', 'class' => 'search'))->addDecorator('HtmlTag2', array('tag' => 'div', 'class' => 'clear'));
     $this->setAttribs(array('id' => 'filter_form', 'class' => 'global_form_box'))->setMethod('GET');
     $displayname = new Zend_Form_Element_Text('displayname');
     $displayname->setLabel('Display Name')->clearDecorators()->addDecorator('ViewHelper')->addDecorator('Label', array('tag' => null, 'placement' => 'PREPEND'))->addDecorator('HtmlTag', array('tag' => 'div'));
     $username = new Zend_Form_Element_Text('username');
     $username->setLabel('Username')->clearDecorators()->addDecorator('ViewHelper')->addDecorator('Label', array('tag' => null, 'placement' => 'PREPEND'))->addDecorator('HtmlTag', array('tag' => 'div'));
     $email = new Zend_Form_Element_Text('email');
     $email->setLabel('Email')->clearDecorators()->addDecorator('ViewHelper')->addDecorator('Label', array('tag' => null, 'placement' => 'PREPEND'))->addDecorator('HtmlTag', array('tag' => 'div'));
     $levels = Engine_Api::_()->getDbtable('levels', 'authorization')->getLevelsAssoc();
     $levelMultiOptions = array(0 => ' ');
     foreach ($levels as $key => $value) {
         $levelMultiOptions[$key] = $value;
     }
     $level_id = new Zend_Form_Element_Select('level_id');
     $level_id->setLabel('Level')->clearDecorators()->addDecorator('ViewHelper')->addDecorator('Label', array('tag' => null, 'placement' => 'PREPEND'))->addDecorator('HtmlTag', array('tag' => 'div'))->setMultiOptions($levelMultiOptions);
     $enabled = new Zend_Form_Element_Select('enabled');
     $enabled->setLabel('Approved')->clearDecorators()->addDecorator('ViewHelper')->addDecorator('Label', array('tag' => null, 'placement' => 'PREPEND'))->addDecorator('HtmlTag', array('tag' => 'div'))->setMultiOptions(array('-1' => '', '0' => 'Not Approved', '1' => 'Approved'))->setValue('-1');
     $submit = new Zend_Form_Element_Button('search', array('type' => 'submit'));
     $submit->setLabel('Search')->clearDecorators()->addDecorator('ViewHelper')->addDecorator('HtmlTag', array('tag' => 'div', 'class' => 'buttons'))->addDecorator('HtmlTag2', array('tag' => 'div'));
     $this->addElement('Hidden', 'order', array('order' => 10001));
     $this->addElement('Hidden', 'order_direction', array('order' => 10002));
     $this->addElement('Hidden', 'user_id', array('order' => 10003));
     $this->addElements(array($displayname, $username, $email, $level_id, $enabled, $submit));
     // Set default action without URL-specified params
     $params = array();
     foreach (array_keys($this->getValues()) as $key) {
         $params[$key] = null;
     }
     $this->setAction(Zend_Controller_Front::getInstance()->getRouter()->assemble($params));
 }
开发者ID:hoalangoc,项目名称:ftf,代码行数:32,代码来源:Filter.php

示例5: isVideoUpload

 public function isVideoUpload()
 {
     $table = Engine_Api::_()->getItemTable("video");
     $viewer = Engine_Api::_()->user()->getViewer();
     $select = $table->select()->where("owner_id = ?", $viewer->getIdentity())->limit(1);
     return $table->fetchRow($select);
 }
开发者ID:hoalangoc,项目名称:ftf,代码行数:7,代码来源:Weights.php

示例6: indexAction

 public function indexAction()
 {
     $viewer = Engine_Api::_()->user()->getViewer();
     if (empty($viewer)) {
         return $this->setNoRender();
     }
 }
开发者ID:HiLeo1610,项目名称:tumlumsach,代码行数:7,代码来源:Controller.php

示例7: init

 public function init()
 {
     $this->clearDecorators()->addDecorator('FormElements')->addDecorator('Form')->addDecorator('HtmlTag', array('tag' => 'div', 'class' => 'search'))->addDecorator('HtmlTag2', array('tag' => 'div', 'class' => 'clear'));
     $this->setAttribs(array('id' => 'filter_form', 'class' => 'global_form_box'));
     $username = new Zend_Form_Element_Text('username');
     $username->setLabel('Username')->clearDecorators()->addDecorator('ViewHelper')->addDecorator('Label', array('tag' => null, 'placement' => 'PREPEND'))->addDecorator('HtmlTag', array('tag' => 'div'));
     $email = new Zend_Form_Element_Text('email');
     $email->setLabel('Email')->clearDecorators()->addDecorator('ViewHelper')->addDecorator('Label', array('tag' => null, 'placement' => 'PREPEND'))->addDecorator('HtmlTag', array('tag' => 'div'));
     $levelMultiOptions = array(0 => ' ');
     /*      $table = $this->_helper->api()->getItemTable('user');
           $select = $viewer->membership()->getMembersSelect('user_id');
           $friends = $table->fetchAll($select);*/
     $levels = Engine_Api::_()->getDbtable('levels', 'authorization')->fetchAll();
     foreach ($levels as $row) {
         $levelMultiOptions[$row->level_id] = $row->getTitle();
     }
     $level_id = new Zend_Form_Element_Select('level_id');
     $level_id->setLabel('Level')->clearDecorators()->addDecorator('ViewHelper')->addDecorator('Label', array('tag' => null, 'placement' => 'PREPEND'))->addDecorator('HtmlTag', array('tag' => 'div'))->setMultiOptions($levelMultiOptions);
     $enabled = new Zend_Form_Element_Select('enabled');
     $enabled->setLabel('Approved')->clearDecorators()->addDecorator('ViewHelper')->addDecorator('Label', array('tag' => null, 'placement' => 'PREPEND'))->addDecorator('HtmlTag', array('tag' => 'div'))->setMultiOptions(array('-1' => '', '0' => 'Not Approved', '1' => 'Approved'))->setValue('-1');
     $submit = new Zend_Form_Element_Button('search', array('type' => 'submit'));
     $submit->setLabel('Search')->clearDecorators()->addDecorator('ViewHelper')->addDecorator('HtmlTag', array('tag' => 'div', 'class' => 'buttons'))->addDecorator('HtmlTag2', array('tag' => 'div'));
     $this->addElement('Hidden', 'order', array('order' => 10001));
     $this->addElement('Hidden', 'order_direction', array('order' => 10002));
     $this->addElements(array($username, $email, $level_id, $enabled, $submit));
     // Set default action
     $this->setAction(Zend_Controller_Front::getInstance()->getRouter()->assemble(array()));
 }
开发者ID:robeendey,项目名称:ce,代码行数:28,代码来源:Filter.php

示例8: indexAction

 public function indexAction()
 {
     parent::indexAction();
     $this->view->navigation = $navigation = Engine_Api::_()->getApi('menus', 'core')->getNavigation('profilecompleteness_admin_main', array(), 'profilecompleteness_admin_main_manage');
     $type_id = 1;
     $option_id = $this->_getParam('option_id');
     if (empty($option_id)) {
         $option_id = 1;
     }
     $this->view->option_id = $option_id;
     $table = new ProfileCompleteness_Model_DbTable_Weights();
     $db = $table->getAdapter();
     $select = $table->select()->setIntegrityCheck(false);
     $maptable = $db->select()->from(array('map' => 'engine4_user_fields_maps'))->from(array('meta' => 'engine4_user_fields_meta'), array())->where("map.child_id = meta.field_id AND meta.TYPE != 'heading'")->where('map.field_id=?', $type_id)->where('map.option_id = ?', $option_id);
     $result = $db->select()->from(array('m' => $maptable), array('m.option_id', 'm.child_id'))->joinleft(array('w' => 'engine4_profilecompleteness_weights'), 'm.`child_id` = w.`field_id`', array('w.field_id'))->where('w.field_id IS NULL');
     $select->from(array('r' => $result));
     $rows = $table->fetchAll($select);
     if (count($rows) != 0) {
         $db = $table->getAdapter();
         $db->beginTransaction();
         foreach ($rows as $row) {
             $values = array('field_id' => $row->child_id, 'weight' => 1, 'type_id' => $row->option_id);
             $row = $table->createRow();
             $row->setFromArray($values);
             $row->save();
         }
         $db->commit();
     }
     $this->view->type = $option_id;
 }
开发者ID:hoalangoc,项目名称:ftf,代码行数:30,代码来源:AdminManageController.php

示例9: indexAction

 public function indexAction()
 {
     // Should we consider creation or modified recent?
     $recentType = $this->_getParam('recentType', 'creation');
     if (!in_array($recentType, array('creation', 'modified'))) {
         $recentType = 'creation';
     }
     $this->view->recentType = $recentType;
     $this->view->recentCol = $recentCol = $recentType . '_date';
     // Get paginator
     $table = Engine_Api::_()->getItemTable('video');
     $select = $table->select()->where('search = ?', 1)->where('status = ?', 1);
     if ($recentType == 'creation') {
         // using primary should be much faster, so use that for creation
         $select->order('video_id DESC');
     } else {
         $select->order($recentCol . ' DESC');
     }
     $this->view->paginator = $paginator = Zend_Paginator::factory($select);
     // Set item count per page and current page number
     $paginator->setItemCountPerPage($this->_getParam('itemCountPerPage', 4));
     $paginator->setCurrentPageNumber($this->_getParam('page', 1));
     // Hide if nothing to show
     if ($paginator->getTotalItemCount() <= 0) {
         return $this->setNoRender();
     }
 }
开发者ID:hoalangoc,项目名称:ftf,代码行数:27,代码来源:Controller.php

示例10: indexAction

 public function indexAction()
 {
     $table = Engine_Api::_()->getItemTable('ynfeedback_idea');
     $select = $table->getIdeasSelect(array('orderby' => 'vote_count', 'direction' => 'DESC'));
     $select->limit(Engine_Api::_()->getApi('settings', 'core')->getSetting('ynfeedback_max_idea', 20));
     $this->view->ideas = $table->fetchAll($select);
 }
开发者ID:hoalangoc,项目名称:ftf,代码行数:7,代码来源:Controller.php

示例11: onMenuInitialize_UserProfileMessage

 public function onMenuInitialize_UserProfileMessage($row)
 {
     // Not logged in
     $viewer = Engine_Api::_()->user()->getViewer();
     $subject = Engine_Api::_()->core()->getSubject();
     if (!$viewer->getIdentity() || $viewer->getGuid(false) === $subject->getGuid(false)) {
         return false;
     }
     // Get setting?
     $permission = Engine_Api::_()->authorization()->getPermission($viewer->level_id, 'messages', 'create');
     if (Authorization_Api_Core::LEVEL_DISALLOW === $permission) {
         return false;
     }
     $messageAuth = Engine_Api::_()->authorization()->getPermission($viewer->level_id, 'messages', 'auth');
     if ($messageAuth == 'none') {
         return false;
     } else {
         if ($messageAuth == 'friends') {
             // Get data
             $direction = (int) Engine_Api::_()->getApi('settings', 'core')->getSetting('user.friends.direction', 1);
             if (!$direction) {
                 //one way
                 $friendship_status = $viewer->membership()->getRow($subject);
             } else {
                 $friendship_status = $subject->membership()->getRow($viewer);
             }
             if (!$friendship_status || $friendship_status->active == 0) {
                 return false;
             }
         }
     }
     return array('label' => "Send Message", 'icon' => 'application/modules/Messages/externals/images/send.png', 'route' => 'messages_general', 'params' => array('action' => 'compose', 'to' => $subject->getIdentity()));
 }
开发者ID:HiLeo1610,项目名称:tumlumsach,代码行数:33,代码来源:Menus.php

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

示例13: indexAction

 public function indexAction()
 {
     $tag_table = Engine_Api::_()->getDbtable('tags', 'core');
     $tag_map_table = Engine_Api::_()->getDbtable('tagMaps', 'core');
     $event_table = Engine_Api::_()->getItemTable('event');
     $tag_name = $tag_table->info('name');
     $tag_map_name = $tag_map_table->info('name');
     $event_name = $event_table->info('name');
     $filter_select = $tag_map_table->select()->distinct()->from($tag_map_name, array("{$event_name}.repeat_group", "{$tag_map_name}.tag_id", "{$tag_map_name}.resource_type"))->setIntegrityCheck(false)->joinLeft($event_name, "{$event_name}.event_id = {$tag_map_name}.resource_id", '')->where("{$event_name}.search = ?", "1");
     $select = $tag_table->select()->from($tag_name, array("{$tag_name}.*", "Count({$tag_name}.tag_id) as count"));
     $select->joinLeft($filter_select, "t.tag_id = {$tag_name}.tag_id", '');
     $select->order("count DESC");
     $select->group("{$tag_name}.text");
     $select->where("t.resource_type = ?", "event");
     if (Engine_Api::_()->core()->hasSubject('user')) {
         $user = Engine_Api::_()->core()->getSubject('user');
         $select->where("t.tagger_id = ?", $user->getIdentity());
     } else {
         if (Engine_Api::_()->core()->hasSubject('event')) {
             $event = Engine_Api::_()->core()->getSubject('event');
             $user = $event->getOwner();
             $select->where("t.tagger_id = ?", $user->getIdentity());
         }
     }
     $this->view->tags = $tag_table->fetchAll($select);
 }
开发者ID:hoalangoc,项目名称:ftf,代码行数:26,代码来源:Controller.php

示例14: getTable

 public function getTable()
 {
     if (is_null($this->_table)) {
         $this->_table = Engine_Api::_()->getDbtable('ratings', 'video');
     }
     return $this->_table;
 }
开发者ID:hoalangoc,项目名称:ftf,代码行数:7,代码来源:Rating.php

示例15: init

 public function init()
 {
     $this->clearDecorators()->addDecorator('FormElements')->addDecorator('Form')->addDecorator('HtmlTag', array('tag' => 'div', 'class' => 'search'))->addDecorator('HtmlTag2', array('tag' => 'div', 'class' => 'clear'));
     $this->setAttribs(array('id' => 'filter_form', 'class' => 'global_form_box'))->setMethod('GET');
     $types = Engine_Api::_()->getDbtable('modules', 'ynmoderation')->getTypesAssoc();
     $typeMultiOptions = array(0 => ' ');
     foreach ($types as $key => $value) {
         $typeMultiOptions[$key] = $value;
     }
     $type_id = new Zend_Form_Element_Select('type_id');
     $type_id->setLabel('Type')->clearDecorators()->addDecorator('ViewHelper')->addDecorator('Label', array('tag' => null, 'placement' => 'PREPEND'))->addDecorator('HtmlTag', array('tag' => 'div'))->setMultiOptions($typeMultiOptions);
     $description = new Zend_Form_Element_Text('description');
     $description->setLabel('Description')->clearDecorators()->addDecorator('ViewHelper')->addDecorator('Label', array('tag' => null, 'placement' => 'PREPEND'))->addDecorator('HtmlTag', array('tag' => 'div'));
     $submit = new Zend_Form_Element_Button('search', array('type' => 'submit'));
     $submit->setLabel('Search')->clearDecorators()->addDecorator('ViewHelper')->addDecorator('HtmlTag', array('tag' => 'div', 'class' => 'buttons'))->addDecorator('HtmlTag2', array('tag' => 'div'));
     $this->addElement('Hidden', 'order', array('order' => 10001));
     $this->addElement('Hidden', 'order_direction', array('order' => 10002));
     $this->addElements(array($type_id, $description, $submit));
     // Set default action without URL-specified params
     $params = array();
     foreach (array_keys($this->getValues()) as $key) {
         $params[$key] = null;
     }
     $this->setAction(Zend_Controller_Front::getInstance()->getRouter()->assemble($params));
 }
开发者ID:hoalangoc,项目名称:ftf,代码行数:25,代码来源:Filter.php


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