本文整理汇总了PHP中Self类的典型用法代码示例。如果您正苦于以下问题:PHP Self类的具体用法?PHP Self怎么用?PHP Self使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Self类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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();
}
示例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;
}
示例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;
}
示例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();
}
示例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;
}
示例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);
}
示例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'));
}
示例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;
}
示例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];
}
示例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;
}
}
}
示例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;
}
示例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();
}
示例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;
}
示例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];
}
示例15: getSelectors
public static function getSelectors()
{
foreach (Self::All() as $item) {
$returnArray[$item->id] = $item->getName();
}
return $returnArray;
}