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


PHP object::find方法代码示例

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


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

示例1: testFind

/**
 * testFind
 *
 * @retun void
 * @access public
 */
	function testFind() {
		$result = $this->Produto->find('all');
		$expected = array(
			array(
				'Produto' => array(
					'id' => 1,
					'nome' => 'Produto 1',
					'valor' => '1,99'
				)
			),
			array(
				'Produto' => array(
					'id' => 2,
					'nome' => 'Produto 2',
					'valor' => '1.000,20'
				)
			),
			array(
				'Produto' => array(
					'id' => 3,
					'nome' => 'Produto 3',
					'valor' => '1.999.000,00'
				)
			)
		);
		$this->assertEqual($result, $expected);
	}
开发者ID:rafaelqueiroz,项目名称:cake_ptbr,代码行数:33,代码来源:ajuste_float.test.php

示例2: get_forms

 /**
  * Get Forms
  *
  * Returns an array of Form Model Objects.
  *
  * @param array $where
  * @return array|bool
  */
 public function get_forms(array $where = array())
 {
     if ('form' != $this->_object->get_type()) {
         return FALSE;
     }
     return $this->_object->find(NULL, $where);
 }
开发者ID:kjohnson,项目名称:3.0-commits-io,代码行数:15,代码来源:ModelFactory.php

示例3: testUserDetailFind

 /**
  * testDetailFind
  *
  * @return void
  */
 public function testUserDetailFind()
 {
     $this->UserDetail->recursive = -1;
     $results = $this->UserDetail->find('all');
     $this->assertTrue(!empty($results));
     $this->assertTrue(is_array($results));
 }
开发者ID:robksawyer,项目名称:grabitdown,代码行数:12,代码来源:UserDetailTest.php

示例4: process

 /**
  * Process menu
  *
  * @param  object $module
  * @param  object $element
  * @return object
  */
 public function process($module, $element)
 {
     foreach ($element->find('a') as $ele) {
         if ($type = $ele->attr("data-type")) {
             if ($type == "separator") {
                 $ele->parent()->addClass("uk-nav-divider");
                 $ele->parent()->removeChild($ele);
             } else {
                 $ele->removeAttr('data-type');
                 if (!$ele->parent()->parent()->hasClass('uk-navbar-nav') && !($module->nav_settings["accordion"] && $ele->parent()->first("ul.level2"))) {
                     $ele->parent()->addClass("uk-nav-header");
                     foreach ($ele->children() as $child) {
                         $ele->parent()->prepend($child);
                     }
                     $ele->replaceWith($ele->text());
                 }
             }
         }
     }
     foreach ($element->first("ul:first")->addClass($module->nav_settings["modifier"])->find('ul.level2 ul') as $ul) {
         if (!$ul->hasClass('uk-nav-sub')) {
             $ul->removeAttr("class");
         }
     }
     foreach ($element->find('li') as $li) {
         $li->removeAttr('data-id')->removeAttr('data-menu-active')->removeAttr('data-menu-columns')->removeAttr('data-menu-columnwidth')->removeAttr('data-menu-icon')->removeAttr('data-menu-image')->removeAttr('data-menu-subtitle');
         $li->removeClass("level1")->removeClass("level2")->removeClass("level3")->removeClass("level4")->parent()->removeClass("level1")->removeClass("level2")->removeClass("level3")->removeClass("level4");
     }
     return $element;
 }
开发者ID:ziyou-liu,项目名称:1line,代码行数:37,代码来源:Post.php

示例5: process

 /**
  * Process menu
  *
  * @param  object $module
  * @param  object $element
  * @return object
  */
 public function process($module, $element)
 {
     $element->first('ul:first')->attr('class', 'uk-navbar-nav');
     foreach ($element->find('ul.level2') as $ul) {
         // get parent li
         $li = $ul->parent();
         // get columns
         $columns = (int) $li->attr('data-menu-columns');
         if ($columns > 1) {
             $i = 0;
             $column = -1;
             $children = $ul->children('li');
             if ($children->length > $columns) {
                 $remainder = $children->length % $columns;
                 $colrows = ($children->length - $remainder) / $columns;
             } else {
                 $remainder = 0;
                 $colrows = 1;
             }
             foreach ($children as $child) {
                 if ($i-- == 0) {
                     $i = $remainder-- > 0 ? $colrows : $colrows - 1;
                     $column++;
                 }
                 if ($li->children('ul')->length == $column) {
                     $li->append('<ul class="level2"></ul>');
                 }
                 if ($column > 0) {
                     $li->children('ul')->item($column)->append($child);
                 }
             }
             $columns = $column + 1;
         } else {
             $columns = 1;
         }
         // get width
         $width = (int) $li->attr('data-menu-columnwidth');
         $style = $width > 0 ? sprintf(' style="min-width: %spx; max-width: %spx; width:%spx;"', $columns * $width, $columns * $width, $width) : null;
         // append dropdown divs
         $li->append(sprintf('<div class="uk-dropdown uk-dropdown-navbar uk-dropdown-width-%d"%s><div class="uk-grid uk-dropdown-grid"></div></div>', $columns, $style));
         $div = $li->first('div.uk-dropdown div.uk-grid');
         foreach ($li->children('ul') as $i => $u) {
             $u->addClass("uk-nav uk-nav-navbar");
             $div->append(sprintf('<div class="uk-width-1-%d"></div>', $columns))->children('div')->item($i)->append($u);
         }
     }
     foreach ($element->find('li.level1') as $li) {
         $li->attr("data-uk-dropdown", "{}");
         if ($li->attr('data-menu-subtitle')) {
             $li->first("a")->addClass('uk-navbar-nav-subtitle');
         }
     }
     foreach ($element->find("ul.level3") as $list) {
         $list->addClass("uk-nav-sub");
     }
     return $element;
 }
开发者ID:ziyou-liu,项目名称:1line,代码行数:64,代码来源:Navbar.php

示例6: process

 /**
  * Process menu
  *
  * @param  object $module
  * @param  object $element
  * @return object
  */
 public function process($module, $element)
 {
     $use_scrollspy = false;
     $active_url = false;
     //assuming the first active menu item is the current page
     if ($module->nav_settings['scrollspy'] && ($active = $element->first('li.uk-active'))) {
         $active = $active->first('a');
         $active_url = preg_replace('/#(.+)$/', '', $active->attr('href'));
     }
     foreach ($element->find('a') as $ele) {
         // check if scrollspy needs to be applied
         if ($module->nav_settings['scrollspy'] && $active_url && strpos($ele->attr('href'), $active_url . '#') !== false) {
             $use_scrollspy = true;
             if (strpos($active->attr('href'), '#') === false) {
                 $active->attr('href', '#top');
             }
             $ele->attr('href', strstr($ele->attr('href'), '#'));
         }
         if ($type = $ele->attr("data-type")) {
             if ($type == "separator-line") {
                 $ele->parent()->addClass("uk-nav-divider");
                 $ele->parent()->removeChild($ele);
             } else {
                 if ($type == "separator-text") {
                     $ele->removeAttr('data-type');
                 } else {
                     // header
                     $ele->removeAttr('data-type');
                     if (!$ele->parent()->parent()->hasClass('uk-navbar-nav') && !($module->nav_settings["accordion"] && $ele->parent()->first("ul.level2"))) {
                         $ele->parent()->addClass("uk-nav-header");
                         foreach ($ele->children() as $child) {
                             $ele->parent()->prepend($child);
                         }
                         $ele->replaceWith($ele->text());
                     }
                 }
             }
         }
     }
     foreach ($element->first("ul:first")->addClass($module->nav_settings["modifier"])->find('ul.level2 ul') as $ul) {
         if (!$ul->hasClass('uk-nav-sub')) {
             $ul->removeAttr("class");
         }
     }
     foreach ($element->find('li') as $li) {
         $li->removeAttr('data-id')->removeAttr('data-menu-active')->removeAttr('data-menu-columns')->removeAttr('data-menu-columnwidth')->removeAttr('data-menu-icon')->removeAttr('data-menu-image')->removeAttr('data-menu-subtitle');
         $li->removeClass("level1")->removeClass("level2")->removeClass("level3")->removeClass("level4")->parent()->removeClass("level1")->removeClass("level2")->removeClass("level3")->removeClass("level4");
     }
     // apply scrollspy
     if ($use_scrollspy && $active_url) {
         $element->first('ul:first')->attr('data-uk-scrollspy-nav', '{closest: \'li\', smoothscroll: true}');
     }
     return $element;
 }
开发者ID:ejailesb,项目名称:repo,代码行数:61,代码来源:Post.php

示例7: retrieveByCredentials

 /**
  * Retrieve a user by the given credentials.
  *
  * @param  array $credentials
  * @return \Krenor\LdapAuth\Objects\LdapUser|null
  */
 public function retrieveByCredentials(array $credentials)
 {
     $username = $credentials['username'];
     $result = $this->ldap->find($username);
     if (!is_null($result)) {
         $user = new $this->model();
         $user->build($result);
         return $user;
     }
     return null;
 }
开发者ID:hbalagtas,项目名称:ldap-auth,代码行数:17,代码来源:LdapAuthUserProvider.php

示例8: getItemData

 /**
  * Extract the data (title,size,unit_price,description) from the DOM object
  * @param  object $dom Dom object
  * @return array      Data exracted from the DOM
  */
 static function getItemData($dom)
 {
     $itemData = [];
     $title = $dom->find('.productTitleDescriptionContainer h1');
     $description = $dom->find('#information .productText p');
     $price = $dom->find('.pricePerUnit text');
     $itemData['title'] = $title[0]->innertext;
     //divide by 1024 to get the size of the page in kilobytes and round it
     $itemData['size'] = round($dom->size / 1024, 2) . 'kb';
     //remove the currency sign and trim the string to get the numeric price of the product
     $itemData['unit_price'] = trim(str_replace('£', '', $price[0]->innertext));
     $itemData['description'] = $description[0]->innertext;
     return $itemData;
 }
开发者ID:kimon89,项目名称:scraper,代码行数:19,代码来源:Scraper.php

示例9: get

 /**
  * Gets (extended) config 
  * @param  string $identifier
  * @return array
  */
 public function get($identifier)
 {
     if (!isset($this->configs[$identifier])) {
         $files = $this->path->find('config.' . $identifier, false);
         $config = array();
         foreach ($files as $file) {
             $fileContent = (include $file);
             $fileContent = $fileContent ? $fileContent : array();
             $config = array_merge($config, $fileContent);
         }
         $this->config[$identifier] = $config;
     }
     return $this->config[$identifier];
 }
开发者ID:hungrylab,项目名称:binocle-framework,代码行数:19,代码来源:Config.php

示例10: find

 /**
  * Get an item by its ID
  *
  * @param $id
  * @param array $columns
  * @return mixed
  */
 public function find($id, $columns = ['*'])
 {
     if (is_null($id) || empty($id)) {
         throw new InvalidArgumentException('Invalid id');
     }
     return $this->model->find($id, $columns);
 }
开发者ID:jinseokoh,项目名称:ask,代码行数:14,代码来源:EloquentRepository.php

示例11: token

 /**
  * Create and save a token for given record
  *
  * @param object $model Model
  * @param mixed $id Record ID
  * @param string $field Use this field instead of the configured one
  * @param int $length Use this length instead of the configured one
  * @param string $chars Use this chars instead of the configured ones
  * @return string Token
  */
 public function token($model, $id = null, $field = null, $length = null, $chars = null)
 {
     foreach (array_keys($this->default) as $var) {
         if (empty(${$var})) {
             ${$var} = $this->settings[$model->alias][$var];
         }
     }
     $token = false;
     $charCount = strlen($chars);
     while (empty($token) || $model->find('count', array('conditions' => array($model->alias . '.' . $field => $token), 'recursive' => -1)) > 0) {
         $token = '';
         for ($i = 0; $i < $length; $i++) {
             $token .= $chars[mt_rand(0, $charCount - 1)];
         }
     }
     if (!empty($token)) {
         if (empty($id)) {
             $id = $model->id;
         }
         if (empty($id)) {
             $token = false;
         } else {
             $model->id = $id;
             $model->saveField($field, $token);
         }
     }
     return $token;
 }
开发者ID:rchick,项目名称:syrup,代码行数:38,代码来源:tokenable.php

示例12: local_compile_extends_settings_navigation

/**
 * Add a "Compile" menu link to the Course Admin block as the top link.
 *
 * @author Gerald Albion
 * date 2014-10-31
 * @copyright 2014 Royal Roads University
 * @param object $settingsnav Main navigation object.
 * @param object $context Course context.
 */
function local_compile_extends_settings_navigation($settingsnav, $context)
{
    // Context must be course.
    if ($context->contextlevel != CONTEXT_COURSE) {
        return;
    }
    // Must be in a valid course: Cannot be course id 0.
    if ($context->instanceid == 0) {
        return;
    }
    // Must be in a valid course: Course must be retrievable.
    if (!($course = get_course($context->instanceid))) {
        return;
    }
    // Must be enrolled or otherwise allowed to view the course.
    if (!(is_enrolled($context) || is_viewing($context))) {
        return;
    }
    // Must have a course admin menu in which to add link.
    if (!($coursenode = $settingsnav->find('courseadmin', navigation_node::TYPE_COURSE))) {
        return;
    }
    // Good to go.  Build the menu item.
    $url = new moodle_url('/local/compile/list_modules.php', array('id' => $course->id));
    $newnode = navigation_node::create(get_string('menucaption', 'local_compile'), $url, navigation_node::NODETYPE_LEAF, 'compile', 'compile', new pix_icon('i/settings', ''));
    // We want to put this link at the top: find the existing top (first) node.
    $firstnode = $coursenode->get_children_key_list()[0];
    // Add the menu item to the menu, before the first node.
    $coursenode->add_node($newnode, $firstnode);
}
开发者ID:royalroads,项目名称:RRU-Moodle,代码行数:39,代码来源:lib.php

示例13: process

 /**
  * Process menu
  *
  * @param  object $module
  * @param  object $element
  * @return object
  */
 public function process($module, $element)
 {
     $ul = $element->first('ul:first')->attr('class', 'uk-nav');
     if ($module->nav_settings["accordion"]) {
         $ul->addClass("uk-nav-parent-icon")->addClass("uk-nav-side")->attr("data-uk-nav", "{}");
         foreach ($ul->find("ul.level2") as $list) {
             if ($list->prev()->tag() == 'a' && !$list->prev()->attr("href")) {
                 $list->prev()->attr("href", "#");
             }
             $list->addClass("uk-nav-sub");
         }
     } else {
         foreach ($ul->find("ul.level2") as $list) {
             $list->addClass("uk-nav-sub");
         }
     }
     if ($module->position == "offcanvas") {
         foreach ($element->find("a") as $span) {
             if ($span->attr("data-type")) {
                 $span->removeAttr("data-type")->removeAttr("class");
             }
         }
     }
     return $element;
 }
开发者ID:ziyou-liu,项目名称:1line,代码行数:32,代码来源:Nav.php

示例14: strtolower

 /**
  * Instantiates a class
  *
  * @access    private
  * @param    string
  * @param    string
  * @return    null
  */
 function _ci_init_class($class, $prefix = '', $config = FALSE)
 {
     $class = strtolower($class);
     // Is there an associated config file for this class?
     // {{{ Matchbox
     $module = $this->_matchbox->argument(3);
     if ($config === null) {
         if ($filepath = $this->_matchbox->find('config/' . $class . EXT, $module)) {
             include $filepath;
         }
     }
     // }}}
     if ($prefix == '') {
         $name = class_exists('CI_' . $class) ? 'CI_' . $class : $class;
     } else {
         $name = $prefix . $class;
     }
     // Set the variable name we will assign the class to
     $classvar = !isset($this->_ci_varmap[$class]) ? $class : $this->_ci_varmap[$class];
     // Instantiate the class
     $CI =& get_instance();
     if ($config !== NULL) {
         $CI->{$classvar} = new $name($config);
     } else {
         $CI->{$classvar} = new $name();
     }
 }
开发者ID:bema2004sw,项目名称:pyrocms,代码行数:35,代码来源:Loader.php

示例15: admin_edit

 /**
  * Admin edit
  *
  * @param integer $id
  * @return void
  * @access public
  */
 public function admin_edit($id = null)
 {
     // Protect against administrator edit
     if ($id == null || $id < 4) {
         $this->Session->setFlash(__('Invalid request.'), 'flash_message_error');
         $this->redirect(array('action' => 'index'));
     }
     $errors = null;
     if (!empty($this->request->data)) {
         $this->request->data['Aro']['model'] = '';
         // update alias with user data
         if ($this->request->data['Aro']['foreign_key'] != '') {
             $this->request->data['Aro']['model'] = 'User';
             $this->request->data['Aro']['alias'] = $this->User->field('Name', array('id' => $this->request->data['Aro']['foreign_key']));
         }
         $this->Node->recursive = -1;
         $this->request->data = array_merge($this->Node->read(null, $id), $this->request->data);
         // alias must be unique
         $this->Node->validate = array('alias' => array('rule' => 'isUnique', 'message' => __('Group / User name must be unique!!')));
         if ($this->Node->save($this->request->data)) {
             $this->Session->setFlash(__('Saved with success.'), 'flash_message_info');
             $this->redirect(array('action' => 'index'));
         } else {
             $this->Session->setFlash(__('Could not be saved. Please, try again.'), 'flash_message_error');
         }
     }
     if (empty($this->request->data)) {
         $this->request->data = $this->Node->read(null, $id);
     }
     $parents[0] = "[ " . __('Root') . " ]";
     $nodelist = $this->Node->generateTreeList(null, '{n}.Aro.id', '{n}.Aro.alias', ' - ', '-1');
     $acolist = $this->Acl->Aco->generateTreeList(null, '{n}.Aco.id', '{n}.Aco.alias', ' - ', '-1');
     $acoAccessList = $this->Acl->Aco->generateTreeList(null, '{n}.Aco.id', '{n}.Aco.alias', '', '-1');
     $acoAliasList = $acoAccessList;
     foreach ($acoAccessList as $key => $value) {
         $alias = "";
         $path = $this->Acl->Aco->getPath($key);
         foreach ($path as $pathAlias) {
             if ($alias != '') {
                 $alias = $alias . '/';
             }
             $alias = $alias . $pathAlias['Aco']['alias'];
         }
         $acoAliasList[$key] = $alias;
         $acoAccessList[$key] = $this->Acl->check($this->request->data['Aro']['alias'], $alias);
         #value
     }
     if ($nodelist) {
         foreach ($nodelist as $key => $value) {
             $parents[$key] = $value;
         }
     }
     $foreignKeys = array();
     // if node is group type ( without foreignKey ) do no show available users
     if ($this->Node->field('foreign_key')) {
         $usersOnAro = $this->Node->find('list', array('fields' => array('Aro.foreign_key'), 'conditions' => array('Aro.foreign_key <>' => null, 'Aro.id <>' => $id)));
         $foreignKeys = $this->User->find('list', array('conditions' => array('User.active' => '1', 'NOT' => array('User.id' => $usersOnAro))));
     }
     $this->set(compact('parents', 'acolist', 'foreignKeys', 'acoAccessList', 'acoAliasList'));
 }
开发者ID:jefflv,项目名称:phkapa,代码行数:67,代码来源:ArosController.php


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