本文整理汇总了PHP中Self类的典型用法代码示例。如果您正苦于以下问题:PHP Self类的具体用法?PHP Self怎么用?PHP Self使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Self类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: sort
/**
* @return mixed
*/
public static function sort($array = null)
{
$instance = new Self($array);
if (true === is_array($array)) {
$instance->set($array);
}
return $instance->doSort()->toArray();
}
开发者ID:yejune,项目名称:bootapp,代码行数:11,代码来源:Dependency.php
示例2: buscarPorId
/**
* Busca uma doula existente no banco de dados
* @param int $id
* @return Doula
*/
public static function buscarPorId($id)
{
$doula = new Self();
$obj = $doula->ver(tbl_doulas, $id);
if ($id !== $obj->id) {
return false;
}
$this->hydrate((array) $doula);
return $doula;
}
开发者ID:umbernardo,项目名称:banco_projetos,代码行数:15,代码来源:Doula.php
示例3: mediaObject
/**
* Models a collection media object for media feeds
*
* @param type $mediaObject
* @param type $mediaObjectType
* @param type $mediaObjectId
*
* return void;
*/
public static function mediaObject(&$mediaObject, $collection)
{
//If the media object is not a collection! skip it
//1.Load the collection!
if (!is_object($collection) && is_a($collection, Entity::class)) {
$thisModel = new Self();
$attachment = $thisModel->loadObjectByURI($collection);
}
//If the media object is not a collection! skip it
$objectTypeshaystack = array("collection");
if (!in_array($collection->getObjectType(), $objectTypeshaystack)) {
return;
}
//Nothing to do here if we can't deal with it!
$collectionObject = new Media\Collection();
//2.Get all the elements in the collection, limit 5 if more than 5
//3.Trigger their timeline display
$collectionObject->set("objectType", "collection");
$collectionObject->set("uri", $collection->getObjectURI());
//Now lets populate our collection with Items
$collectionItems = $collection->getPropertyValue("collection_items");
$collectionItemize = explode(",", $collectionItems);
$collectionObject->set("totalItems", count($collectionItemize));
if (is_array($collectionItemize) && !empty($collectionItemize)) {
$items = array();
foreach ($collectionItemize as $item) {
$itemObject = Media\MediaLink::getNew();
//@TODO Will probably need to query for objectType of items in collection?
//@TODO Also this will help in removing objects from collections that have previously been deleted
$itemObjectEntity = $thisModel->load->model("attachment", "system")->loadObjectByURI($item);
//Load the item with the attachment to get all its properties
//Now check object_id exists;
//If not delete the object all together;
//Also check if attachments_src is defined and exsits;
//If attachments id does not exists, delete the item from this collection;
$itemObjectURL = !empty($item) ? "/system/object/{$item}/" : "http://placeskull.com/100/100/999999";
$itemObject->set("url", $itemObjectURL);
$itemObject->set("uri", $item);
$itemObject->set("height", null);
$itemObject->set("width", null);
$itemObject->set("type", $itemObjectEntity->getPropertyValue("attachment_type"));
$itemObject->set("name", $itemObjectEntity->getPropertyValue("attachment_name"));
$items[] = $itemObject::getArray();
unset($itemObject);
}
$collectionObject->set("items", $items);
}
//Now set the collection Object as the media Object
$mediaObject = $collectionObject;
unset($collection);
unset($collectionObject);
//All done
return true;
}
开发者ID:budkit,项目名称:budkit-cms,代码行数:63,代码来源:collection.php
示例4: store
/**
* @param $string
* @param [$string]
* @return @response
*/
public static function store($module, $action)
{
$audit = new Self();
$audit->module = $module;
$audit->action = $action;
$audit->ip = Request::getClientIp();
$audit->user = self::getUser();
$audit->created_at = Carbon::now();
$audit->updated_at = Carbon::now();
$audit->save();
}
开发者ID:fagray,项目名称:fposs,代码行数:16,代码来源:Audit.php
示例5: view_data
public static function view_data(Request $request, Post $post)
{
$instance = new Self();
$per_page = session('per_page') ? session('per_page') : config('constants.per_page');
$post = Post::with('user.votes')->with('subreddit.moderators')->with('comments')->where('id', $post->id)->first();
$comment = $post->comments;
$user = User::where('id', '=', Auth::id())->get();
$check = $post->subreddit->moderators->where('user_id', Auth::id())->first();
$isModerator = $check ? true : false;
$result['per_page'] = $per_page;
$result['comments'] = $instance->comment_list($per_page, $request, $post, $comment, $user, $isModerator);
$result['total_comments'] = $instance->total_comments($post);
return $result;
}
开发者ID:ReyRodriguez,项目名称:laravel-reddit,代码行数:14,代码来源:CommentController.php
示例6: login
/**
* 登录日志
* @param [type] $type [description]
* @param [type] $user [description]
* @return [type] [description]
*/
public static function login($type, $user)
{
$related_id = $user->id;
switch ($type) {
case 'employee':
$action_type_id = 1;
$ins_type_id = 6;
$memo = '员工登录';
break;
case 'agency':
$action_type_id = 2;
$ins_type_id = 5;
$memo = '代理商登录';
break;
case 'department':
$action_type_id = 3;
$ins_type_id = 4;
$memo = '科室登录';
break;
default:
break;
}
$memo = $memo . '-' . username();
Self::add_log($action_type_id, $ins_type_id, $related_id, $memo);
}
开发者ID:newset,项目名称:robot,代码行数:31,代码来源:ILog.php
示例7: details
public static function details(Request $request)
{
//Note this is piggybacking on regular event controller functions, beware of changing them!!
$eid = $request->eid;
$event = Event::getEvent($eid);
$invites = Self::getInvitesFromEid($eid);
$all_poll_options = Self::getPollOptionsFromEid($eid);
$itemslist = Event::getEventItems($eid);
$userRSVP = Invite::getUserRSVP($eid);
$items = [];
$item_users = [];
$ticketcost = (string) $event['ticketprice'];
if (!strpos($ticketcost, '.')) {
$ticketcost = $ticketcost . ".00";
}
foreach ($itemslist as $item) {
array_push($items, $item);
if ($item->uid != 0) {
$tmpUser = User::getById($item->uid);
array_push($item_users, $tmpUser);
}
}
$chat_messages = MessageController::getMessagesFromEid($eid);
return response()->json(compact('event', 'all_poll_options', 'items', 'invites', 'chat_messages', 'item_users', 'userRSVP', 'ticketcost'));
}
开发者ID:umSoftEng2GrpE,项目名称:partEZ,代码行数:25,代码来源:ApiEventDetailsController.php
示例8: process
public static function process($numWords, $numNums, $numChars)
{
//read in the words from the file on a single line
$word = file("wordList.txt");
//convert it to a 2 dimensional array. Index [0][n] is line 1
$result = array_map(function ($v) {
return explode(" ", $v);
}, file("wordList.txt", FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES));
//create password with selected number of words.
$pWord = "";
for ($g = 0; $g < $numWords; $g++) {
$temp = $result[0][rand(0, count($result[0]))];
$pWord = $pWord . $temp;
}
//clean out any special characters that may be in the file
$pWord = Self::clean($pWord);
//add characters
for ($f = 0; $f < $numChars; $f++) {
$pWord = $pWord . chr(rand(33, 45));
}
//add numbers
for ($e = 0; $e < $numNums; $e++) {
$pWord = $pWord . rand(0, 9);
}
return $pWord;
}
开发者ID:acbrunso,项目名称:foobooks,代码行数:26,代码来源:Logic.php
示例9: getOrder
public function getOrder($user_id)
{
$query = Self::find()->select('*')->from('fin_order as order')->leftjoin('fin_student as student', 'order.user_id = student.user_id')->where(['order.merchant_id' => $user_id]);
$pages = new Pagination(['defaultPageSize' => 5, 'totalCount' => $query->count()]);
$order = $query->offset($pages->offset)->limit($pages->limit)->Asarray()->all();
return ['order' => $order, 'pages' => $pages];
}
开发者ID:wangpengzhen,项目名称:web,代码行数:7,代码来源:Order.php
示例10: getCountry
public static function getCountry(array $country) {
foreach ($country as $key => $value) {
# code...
switch($value) {
case 'India': Self::$con="in";
return Self::$con;
break;
case 'US': Self::$con="us";
return Self::$con;
break;
case 'UK': Self::$con="uk";
return Self::$con;
break;
case 'Hong Kong': Self::$con="hk";
return Self::$con;
break;
case 'Turkey': Self::$con="tr";
return Self::$con;
break;
}
}
}
开发者ID:jinguanio,项目名称:RClubAPI_NEW,代码行数:30,代码来源:Country.php
示例11: searchResult
public static function searchResult()
{
require_once 'Search.model.php';
require_once 'Upload.model.php';
require_once 'User.model.php';
$data = array();
if (isset($_POST['searchProduct'])) {
$searchProduct = $_POST['searchField'];
$category = $_POST['category'];
$state = $_POST['state'];
$sort = $_POST['sort'];
$query = SearchModel::searchQuery($searchProduct, $category, $state, $sort);
try {
$searchresult = SearchModel::getSearchResult($searchProduct, $category, $state, $sort);
$data['template'] = 'searchResult.html';
$data['products'] = $searchresult;
$data['states'] = UserModel::getStates();
$data['categories'] = UploadModel::getCategories();
} catch (Exception $e) {
$data['error'] = $e->getMessage();
$data['template'] = 'error.html';
$data['states'] = UserModel::getStates();
$data['categories'] = UploadModel::getCategories();
}
} else {
$searchCheck = Self::searchCheck();
$data['redirect'] = 'error.html';
}
return $data;
}
开发者ID:miahellqvist,项目名称:webbloppis,代码行数:30,代码来源:Search.controller.php
示例12: picked_stocks
function picked_stocks($code)
{
//grab informatino from database.
$movements = $this->movement->selected($code);
$stocks = $this->stocks->selected($code);
//set table layout and view
foreach ($stocks as $stock) {
$stockarr[] = $this->parser->parse('Stocks/stock_table', (array) $stock, true);
}
$parms = array('table_open' => '<table class="stocks">');
$this->table->set_template($parms);
//generate html elements
$rows = $this->table->make_columns($stockarr, 1);
$this->data['stocktable'] = $this->table->generate($rows);
foreach ($movements as $moves) {
$movementarr[] = $this->parser->parse('Stocks/movement_table', (array) $moves, true);
}
$parm = array('table_open' => '<table class ="movements">');
$this->table->set_template($parm);
$rows_movement = $this->table->make_columns($movementarr, 1);
$this->data['movementtable'] = $this->table->generate($rows_movement);
//generate drop down menu and tables
$this->data['pageselect'] = Self::populate_options();
$this->data['pagebody'] = 'Stocks/stockview';
$this->render();
}
开发者ID:rupindersandhu,项目名称:Assignment-1-PHP,代码行数:26,代码来源:Stock.php
示例13: postprocess
public static function postprocess($sessions, $groupparams, $user, $yachs, $sport, $period)
{
$olmapdetails->startpoints = $sessions;
$olmapdetails->extent = Self::fullextent($period);
$olmapdetails->sessions_sport = Self::getsports($period);
return $olmapdetails;
}
开发者ID:hogeh,项目名称:htraininglogs2,代码行数:7,代码来源:startpoint_olmapposthelper.php
示例14: sel_detail
public function sel_detail($user_id)
{
$query = Self::find()->select('*')->from('fin_detail')->where(['user_id' => $user_id]);
$pages = new Pagination(['defaultPageSize' => 5, 'totalCount' => $query->count()]);
$detail = $query->offset($pages->offset)->limit($pages->limit)->Asarray()->all();
return ['detail' => $detail, 'pages' => $pages];
}
开发者ID:wangpengzhen,项目名称:web,代码行数:7,代码来源:Detail.php
示例15: getSelectors
public static function getSelectors()
{
foreach (Self::All() as $item) {
$returnArray[$item->id] = $item->getName();
}
return $returnArray;
}
开发者ID:reportingsjr,项目名称:makerspace-manager,代码行数:7,代码来源:EasySelect.php
示例16: CurrenyRatesUpdate
public static function CurrenyRatesUpdate()
{
ini_set('max_execution_time', 150000);
ini_set("memory_limit", "128M");
$max_date_sql = "select MAX(day) day from currency_rates";
$max_date_res = Yii::app()->db->createCommand($max_date_sql)->queryAll(true);
//var_dump($max_date_res[0]["day"]);
//exit;
$start_date = date($max_date_res[0]["day"]);
// date("2000-01-01"); // date('Y-m-d', strtotime('-1 years'));
$start_date = strtotime($start_date);
$start_date = strtotime("+1 day", $start_date);
$start_date = date('Y-m-d', $start_date);
$currencies = ['EUR', 'JPY', 'GBP', 'AUD', 'CHF', 'CAD', 'MXN', 'CNY', 'CNH', 'NZD', 'SEK', 'RUB', 'DKK', 'NOK', 'HKD', 'SGD', 'TRY', 'KRW', 'ZAR', 'BRL', 'INR'];
while (strtotime($start_date) <= strtotime("now")) {
$existing_rate = CurrencyRates::model()->findByAttributes(['day' => $start_date]);
if (count($existing_rate) == 0) {
$currency_rates = new CurrencyRates();
$currency_rates->day = $start_date;
foreach ($currencies as $cur) {
$currency_rates->{$cur} = 1;
$Url = "http://currencies.apps.grandtrunk.net/getrate/" . $start_date . "/" . $cur . "/USD";
$get_rate = Self::url_get_contents($Url);
if ($get_rate >= 0) {
$currency_rates->{$cur} = $get_rate;
}
}
$currency_rates->save();
}
///+one day//
$start_date = strtotime($start_date);
$start_date = strtotime("+1 day", $start_date);
$start_date = date('Y-m-d', $start_date);
}
}
开发者ID:artmart,项目名称:verare,代码行数:35,代码来源:Calculators.php
示例17: getLignes
public static function getLignes()
{
// Récupère la configuration du délais du cache, sinon deux heures par défaut
Config::get('cache.arretsCacheDelay') ? $cacheDelay = Config::get('cache.arretsCacheDelay') : ($cacheDelay = 120);
$search = Input::get('search');
$lignes = Self::remember($cacheDelay)->where('libelleLigne', 'like', '%' . $search . '%')->orWhere('idLigne', '=', $search)->groupBy('numero')->lists('libelleLigne', 'numero');
return Response::json($lignes);
}
开发者ID:Adelinegen,项目名称:Linea,代码行数:8,代码来源:Ligne.php
示例18: getArrets
/**
* Retourne un JSON contenant les arrêts
*/
public static function getArrets()
{
// Récupère la configuration du délais du cache, sinon deux heures par défaut
Config::get('cache.arretsCacheDelay') ? $cacheDelay = Config::get('cache.arretsCacheDelay') : ($cacheDelay = 120);
$search = Input::get('search');
$arrets = Self::remember($cacheDelay)->where('nomArret', 'like', '%' . $search . '%')->distinct('nomArret')->lists('nomArret');
return Response::json($arrets);
}
开发者ID:Adelinegen,项目名称:Linea,代码行数:11,代码来源:Arret.php
示例19: ToCheckbox
public function ToCheckbox($para)
{
$para = Self::idName($para);
if ($para['status']) {
return self::_Todo($para, 'checkbox');
} else {
return $para['msg'];
}
}
开发者ID:keigonec,项目名称:EricXie-Xii,代码行数:9,代码来源:XiiHtml.php
示例20: availableProperties
public static function availableProperties()
{
$properties = Self::all();
$result = [];
foreach ($properties as $property) {
$result[$property->id] = $property->description;
}
return $result;
}
开发者ID:aboustayyef,项目名称:tarzanRent,代码行数:9,代码来源:Property.php
注:本文中的Self类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论