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


PHP Profile::find方法代码示例

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


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

示例1: displayTabContentForItem

 static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $withtemplate = 0)
 {
     return;
     $profile = new Profile();
     $found_profiles = $profile->find("`interface` = 'central'");
     $tab_profile = new self();
     $found_tab_profiles = $tab_profile->find("`plugin_custom_tabs_id` = " . $item->getID());
     echo "<form method='POST' action='tabprofile.form.php' />";
     echo "<table class='tab_cadre_fixe'>";
     echo "<tr><th colspan='4'>" . __("Visibility") . "</th></tr>";
     $odd = 0;
     foreach ($found_profiles as $profiles_id => $profile_fields) {
         if ($odd % 2 === 0) {
             echo "<tr>";
         }
         echo "<td>" . $profile_fields['name'] . "</td>";
         echo "<td>";
         Dropdown::showYesNo("tab_profile[{$profiles_id}]", 0);
         echo "</td>";
         if ($odd % 2 === 1) {
             echo "</tr>";
         }
         $odd++;
     }
     if ($odd % 2 === 0) {
         echo "</tr>";
     }
     echo "<tr><td colspan='4'><div class='center'>";
     echo "<input type='submit' name='update' value=\"" . _sx('button', 'Post') . "\" class='submit'>";
     echo "</div></td></tr>";
     echo "</table>";
     Html::closeForm();
     return true;
 }
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:34,代码来源:tabprofile.class.php

示例2: showResults

 function showResults($q, $page)
 {
     $profile = new Profile();
     $search_engine = $profile->getSearchEngine('profile');
     $search_engine->set_sort_mode('chron');
     // Ask for an extra to see if there's more.
     $search_engine->limit(($page - 1) * PROFILES_PER_PAGE, PROFILES_PER_PAGE + 1);
     if (false === $search_engine->query($q)) {
         $cnt = 0;
     } else {
         $cnt = $profile->find();
     }
     if ($cnt > 0) {
         $terms = preg_split('/[\\s,]+/', $q);
         $results = new PeopleSearchResults($profile, $terms, $this);
         $results->show();
         $profile->free();
         $this->pagination($page > 1, $cnt > PROFILES_PER_PAGE, $page, 'peoplesearch', array('q' => $q));
     } else {
         // TRANS: Message on the "People search" page where a query has no results.
         $this->element('p', 'error', _('No results.'));
         $this->searchSuggestions($q);
         $profile->free();
     }
 }
开发者ID:microcosmx,项目名称:experiments,代码行数:25,代码来源:peoplesearch.php

示例3: ShowProfile

 public function ShowProfile($Id)
 {
     $this->profile = Profile::find($Id);
     if (!$this->profile) {
         App::abort(404, 'That user does not exist');
     }
     return View::make('pages.profile.profile', ['profile' => $this->profile, 'page_title' => $this->profile->name, 'services_list' => ['Test link' => ''], 'requests_list' => [], 'skills' => ['test' => 5, 'foo' => 6, 'btest' => 5, 'bfoo' => 6, 'ctest' => 5, 'cfoo' => 6, 'dtest' => 5, 'dfoo' => 6]]);
 }
开发者ID:JosephCrandall44,项目名称:assistance.net,代码行数:8,代码来源:BillingController.php

示例4: createForContainer

 static function createForContainer(PluginFieldsContainer $container)
 {
     $profile = new Profile();
     $found_profiles = $profile->find();
     $fields_profile = new self();
     foreach ($found_profiles as $profile_item) {
         $fields_profile->add(array('profiles_id' => $profile_item['id'], 'plugin_fields_containers_id' => $container->fields['id'], 'right' => CREATE));
     }
     return true;
 }
开发者ID:publik1974,项目名称:fields,代码行数:10,代码来源:profile.class.php

示例5: showResults

 /**
  * Search for users matching the query and spit the results out
  * as a quick-n-dirty JSON document
  *
  * @return void
  */
 function showResults()
 {
     $people = array();
     $profile = new Profile();
     $search_engine = $profile->getSearchEngine('profile');
     $search_engine->set_sort_mode('nickname_desc');
     $search_engine->limit(0, 10);
     $search_engine->query(strtolower($this->query . '*'));
     $cnt = $profile->find();
     if ($cnt > 0) {
         $sql = 'SELECT profile.* FROM profile, user WHERE profile.id = user.id ' . ' AND LEFT(LOWER(profile.nickname), ' . strlen($this->query) . ') = \'%s\' ' . ' LIMIT 0, 10';
         $profile->query(sprintf($sql, $this->query));
     }
     while ($profile->fetch()) {
         $people[] = $profile->nickname;
     }
     header('Content-Type: application/json; charset=utf-8');
     print json_encode($people);
 }
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:25,代码来源:userautocomplete.php

示例6: update

 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     $input = Input::only('first_name', 'last_name', 'website');
     $rules = array('first_name' => 'required');
     $v = Validator::make($input, $rules);
     if ($v->fails()) {
         return Output::push(array('path' => 'profile', 'errors' => $v, 'input' => TRUE));
     }
     if ($id && Auth::user()->profile_id == $id) {
         $profile = Profile::find($id);
         $profile->first_name = $input['first_name'];
         $profile->last_name = $input['last_name'];
         $profile->website = $input['website'];
         $profile->save();
         return Output::push(array('path' => 'profile', 'messages' => array('success', _('Profile has been saved'))));
     } else {
         return Output::push(array('path' => 'profile', 'messages' => array('fail', _('Unable to update profile')), 'input' => TRUE));
     }
 }
开发者ID:digideskio,项目名称:voip-id,代码行数:25,代码来源:ProfileController.php

示例7: indexAction

 public function indexAction()
 {
     $aProfile = Profile::find();
     $this->view->aProfile = $aProfile;
     //        echo '<pre>';
     //        // Traversing with a foreach
     //        foreach ($aUser as $user) {
     //            var_dump(get_class($user), $user->getId());
     //        }
     //        var_dump(
     //            $aUser->current(),
     //            $aUser->count(),
     //            get_class($aUser),
     //            get_class_methods($aUser),
     //            ($this->view->aUser)
     //        );die;
     //        $this->view->count = rand(0,10);
     //        error_log($this->view->count);
     //        $this->view->aUser = 'test';
     //        echo 'ici';die;
 }
开发者ID:bri13geii,项目名称:fredwork,代码行数:21,代码来源:ProfileController.php

示例8: create

 public function create($event)
 {
     if (Yii::$app->user->isGuest) {
         $profile = Yii::$app->request->post('Profile');
         $partnerRequest = Yii::$app->request->post('PartnerRequest');
         $partnerEmail = Yii::$app->request->post('register-form')['email'];
     } else {
         $profile = Profile::find()->where(['user_id' => Yii::$app->user->id])->one();
         $partnerRequest = PartnerRequest::find()->where(['sender_id' => $profile->user_id])->one();
         $partnerEmail = $profile->user->email;
     }
     try {
         Yii::$app->partnerMailer->compose('partner-request-manager', ['partnerRequest' => $partnerRequest, 'profile' => $profile])->setFrom($event->sender->module->senderEmail)->setTo($event->sender->module->partnerManagerEmail)->setSubject(Yii::t('shop', 'New partner request'))->send();
     } catch (Exception $ex) {
         throw new Exception($ex);
     }
     try {
         Yii::$app->partnerMailer->compose('partner-request-partner', ['partnerRequest' => $partnerRequest, 'profile' => $profile])->setFrom($event->sender->module->senderEmail)->setTo($partnerEmail)->setSubject(Yii::t('shop', 'Partner request'))->send();
     } catch (Exception $ex) {
         throw new Exception($ex);
     }
 }
开发者ID:black-lamp,项目名称:blcms-shop,代码行数:22,代码来源:ProductBootstrap.php

示例9: handle

 function handle($args)
 {
     parent::handle($args);
     $profile = new Profile();
     $profile->find();
     $server = common_config('site', 'server');
     $path = common_config('site', 'path');
     $mainpath = 'http://' . $server . '/' . $path . '/index.php/';
     //'http://192.168.1.123/statusnet_copy/index.php/';
     while ($profile->fetch()) {
         //echo $this->ID;
         //$store[] = $object; // builds an array of object lines.
         $nickname = $profile->nickname;
         $profileurl = $mainpath . $nickname;
         $data = Profile::staticGet('id', $profile->id);
         $orign = clone $data;
         $data->profileurl = $profileurl;
         if (!$data->update($orign)) {
             echo 'profile update error' . $data->id;
             echo '<br>';
         }
     }
 }
开发者ID:jianoll,项目名称:SpeakEnglish_Server,代码行数:23,代码来源:apidatamigrationprofile.php

示例10: showResults

 function showResults($q, $page)
 {
     $profile = new Profile();
     // lcase it for comparison
     // $q = strtolower($q);
     $search_engine = $profile->getSearchEngine('identica_people');
     $search_engine->set_sort_mode('chron');
     // Ask for an extra to see if there's more.
     $search_engine->limit(($page - 1) * PROFILES_PER_PAGE, PROFILES_PER_PAGE + 1);
     if (false === $search_engine->query($q)) {
         $cnt = 0;
     } else {
         $cnt = $profile->find();
     }
     if ($cnt > 0) {
         $terms = preg_split('/[\\s,]+/', $q);
         $results = new PeopleSearchResults($profile, $terms, $this);
         $results->show();
     } else {
         $this->element('p', 'error', _('No results'));
     }
     $profile->free();
     $this->pagination($page > 1, $cnt > PROFILES_PER_PAGE, $page, 'peoplesearch', array('q' => $q));
 }
开发者ID:Br3nda,项目名称:laconica,代码行数:24,代码来源:peoplesearch.php

示例11: getUsers

 function getUsers()
 {
     $profile = new Profile();
     // Comment this out or disable to get global profile searches
     $profile->joinAdd(array('id', 'user:id'));
     $offset = ($this->page - 1) * PROFILES_PER_PAGE;
     $limit = PROFILES_PER_PAGE + 1;
     if (!empty($this->q)) {
         // User is searching via query
         $search_engine = $profile->getSearchEngine('profile');
         $mode = 'reverse_chron';
         if ($this->sort == 'nickname') {
             if ($this->reverse) {
                 $mode = 'nickname_desc';
             } else {
                 $mode = 'nickname_asc';
             }
         } else {
             if ($this->reverse) {
                 $mode = 'chron';
             }
         }
         $search_engine->set_sort_mode($mode);
         $search_engine->limit($offset, $limit);
         $search_engine->query($this->q);
         $profile->find();
     } else {
         // User is browsing via AlphaNav
         switch ($this->filter) {
             case 'all':
                 // NOOP
                 break;
             case '0-9':
                 $profile->whereAdd(sprintf('LEFT(%1$s.%2$s, 1) BETWEEN %3$s AND %4$s', $profile->escapedTableName(), 'nickname', $profile->_quote("0"), $profile->_quote("9")));
                 break;
             default:
                 $profile->whereAdd(sprintf('LEFT(LOWER(%1$s.%2$s), 1) = %3$s', $profile->escapedTableName(), 'nickname', $profile->_quote($this->filter)));
         }
         $order = sprintf('%1$s.%2$s %3$s, %1$s.%4$s ASC', $profile->escapedTableName(), $this->getSortKey('nickname'), $this->reverse ? 'DESC' : 'ASC', 'nickname');
         $profile->orderBy($order);
         $profile->limit($offset, $limit);
         $profile->find();
     }
     return $profile;
 }
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:45,代码来源:userdirectory.php

示例12: getTagged

 /**
  * Get profiles tagged with this people tag,
  * include modified timestamp as a "cursor" field
  * order by descending order of modified time
  *
  * @param integer $offset   offset
  * @param integer $limit    maximum no of results
  * @param integer $since_id=null    since unix timestamp
  * @param integer $upto=null  maximum unix timestamp when subscription was made
  *
  * @return Profile results
  */
 function getTagged($offset = 0, $limit = null, $since = 0, $upto = 0)
 {
     $tagged = new Profile();
     $tagged->joinAdd(array('id', 'profile_tag:tagged'));
     #@fixme: postgres
     $tagged->selectAdd('unix_timestamp(profile_tag.modified) as "cursor"');
     $tagged->whereAdd('profile_tag.tagger = ' . $this->tagger);
     $tagged->whereAdd("profile_tag.tag = '{$this->tag}'");
     if ($since != 0) {
         $tagged->whereAdd('cursor > ' . $since);
     }
     if ($upto != 0) {
         $tagged->whereAdd('cursor <= ' . $upto);
     }
     if ($limit != null) {
         $tagged->limit($offset, $limit);
     }
     $tagged->orderBy('profile_tag.modified DESC');
     $tagged->find();
     return $tagged;
 }
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:33,代码来源:Profile_list.php

示例13: getUsers

 function getUsers()
 {
     $profile = new Profile();
     $offset = ($this->page - 1) * PROFILES_PER_PAGE;
     $limit = PROFILES_PER_PAGE + 1;
     if (isset($this->q)) {
         // User is searching via query
         $search_engine = $profile->getSearchEngine('profile');
         $mode = 'reverse_chron';
         if ($this->sort == 'nickname') {
             if ($this->reverse) {
                 $mode = 'nickname_desc';
             } else {
                 $mode = 'nickname_asc';
             }
         } else {
             if ($this->reverse) {
                 $mode = 'chron';
             }
         }
         $search_engine->set_sort_mode($mode);
         $search_engine->limit($offset, $limit);
         $search_engine->query($this->q);
         $profile->find();
     } else {
         // User is browsing via AlphaNav
         $sort = $this->getSortKey();
         $sql = 'SELECT profile.* FROM profile, user WHERE profile.id = user.id';
         switch ($this->filter) {
             case 'all':
                 // NOOP
                 break;
             case '0-9':
                 $sql .= '  AND LEFT(profile.nickname, 1) BETWEEN \'0\' AND \'9\'';
                 break;
             default:
                 $sql .= sprintf(' AND LEFT(LOWER(profile.nickname), 1) = \'%s\'', $this->filter);
         }
         $sql .= sprintf(' ORDER BY profile.%s %s, profile.nickname ASC LIMIT %d, %d', $sort, $this->reverse ? 'DESC' : 'ASC', $offset, $limit);
         $profile->query($sql);
     }
     return $profile;
 }
开发者ID:Grasia,项目名称:bolotweet,代码行数:43,代码来源:userdirectory.php

示例14: update

 /**
  * Update the specified profile in storage.
  * PUT /profiles/{id}
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     // Validate input.
     $input = array('age' => Input::get('age'), 'height' => Input::get('height'), 'weight' => Input::get('weight'));
     $rules = array('age' => array('required', 'integer'), 'height' => 'required', 'weight' => 'required');
     $validator = Validator::make($input, $rules);
     if ($validator->fails()) {
         $messages = $validator->messages();
         return Redirect::back()->withErrors($messages)->withInput();
     }
     $height = Input::get('height');
     $weight = Input::get('weight');
     if (Input::get('heightUnit') == 'in') {
         // Convert to cm
         $height = $height / 0.3937;
     }
     if (Input::get('weightUnit') == 'lb') {
         // Convert to kg
         $weight = $weight / 2.2046;
     }
     $profile = Profile::find($id);
     $profile->user_id = Auth::user()->id;
     $profile->male = Input::get('gender');
     $profile->age = Input::get('age');
     $profile->height = $height;
     $profile->weight = $weight;
     $profile->activity = Input::get('activity');
     if ($profile->save()) {
         return Redirect::route('entries.index', $profile->id);
     } else {
         return Redirect::back()->withInput();
     }
 }
开发者ID:JustinMackenzie,项目名称:meal-log,代码行数:40,代码来源:ProfilesController.php

示例15: json_encode

            if (isset($data['profile']['id'])) {
                Profile::find($data['profile']['id'])->update($data['profile']);
                $results["value"] = "Update";
            } else {
                Profile::create($data['profile']);
                $results["value"] = "New";
            }
            $results["success"] = "true";
        } else {
            $results["success"] = "false";
            $results["error"] = "No auth";
        }
        echo json_encode($results);
    });
    $app->post('/delete', function () use($app) {
        $data = json_decode($app->request->getBody(), true);
        $results = [];
        $results["success"] = "false";
        if (validatedKey($data['user'])) {
            $personal = Profile::find($data['personal']['id']);
            $personal->delete();
            $results["profiles"] = Profile::all();
            $results["success"] = "true";
            $results["value"] = "delete";
        } else {
            $results["success"] = "false";
            $results["error"] = "No auth";
        }
        echo json_encode($results);
    });
});
开发者ID:devsnippet,项目名称:sobic,代码行数:31,代码来源:profile.php


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