/** * Execute the console command. */ public function fire() { $tableBuilder = $this->getHelperSet()->get('table'); // Build summary $table = []; $this->getQueries(); foreach ($this->queries as $route => $log) { $table[$route] = [$route, count($log['queries'])]; } // Sort by number of queries $table = array_sort($table, function ($entry) { return $entry[1] * -1; }); // Filter out low-query pages $table = array_filter($table, function ($entry) { return $entry[1] > 10; }); // Render $tableBuilder->setHeaders(['Route', 'Queries'])->setRows($table); $tableBuilder->render($this->getOutput()); if ($route = $this->option('route')) { $route = $this->laravel['url']->to($route); echo $this->queries[$route]['response']; print_r($this->queries[$route]['queries']); } }
public static function getStatusArray() { $db = XenForo_Application::get('db'); $userModel = new Xenforo_Model_User; $options = XenForo_Application::get('options'); $numStatusShown = $options->RCBDRecentStatusNumView; $showComments = $options->RCBDRecentStatusShowComments; $onePerUser = $options->RCBDRecentStatusOnePerUser; $data = XenForo_Application::getSimpleCacheData("RCBDRecentStatus_status_array"); if (!$data) { if ($onePerUser == 1) { $statusArray = $db->fetchAll($db->limit("SELECT * FROM (SELECT * FROM xf_profile_post WHERE message_state <> 'deleted' AND profile_user_id = user_id ORDER BY post_date DESC) t1 GROUP BY t1.user_id ORDER BY post_date DESC", $numStatusShown)); $statusArray = array_sort($statusArray, "post_date"); } else { $statusArray = $db->fetchAll($db->limit("SELECT * FROM xf_profile_post WHERE profile_user_id = user_id AND message_state <> 'deleted' ORDER BY post_date DESC", $numStatusShown)); } XenForo_Application::setSimpleCacheData("RCBDRecentStatus_status_array", $statusArray); } else { $statusArray = $data; } $recentStatus = array(); $postIds = array(); if (sizeof($statusArray) == 0) { $statusArray = array(0 => array("profile_post_id" => 0, "user_id" => 1, "post_date" => time(), "message" => "No status entries yet, be the first!")); } foreach ($statusArray as $status) { $postIds[] = $status['profile_post_id']; } $commentsArray = array(); $commentsSortedArray = array(); if ($showComments == 1) { $matches = implode(',', $postIds); $data = XenForo_Application::getSimpleCacheData("RCBDRecentStatus_comments_array"); if (!$data) { $commentsArray = $db->fetchAll($db->limit("SELECT * FROM xf_profile_post_comment WHERE profile_post_id in(" . $matches . ") ORDER BY profile_post_id DESC, comment_date", $numStatusShown)); XenForo_Application::setSimpleCacheData("RCBDRecentStatus_comments_array", $commentsArray); } else { $commentsArray = $data; } $commentsUserObjs = getUserData($commentsArray); $currentPostId = -99; $commentGroup = array(); foreach ($commentsArray as $status) { if ($currentPostId != $status['profile_post_id']) { if ($currentPostId != -99) { $commentsSortedArray[$currentPostId] = $commentGroup; $commentGroup = array(); } $currentPostId = $status['profile_post_id']; } $commentGroup[] = array("user" => $commentsUserObjs[$status['user_id']], "status" => $status['message'], "time" => $status['comment_date'], "post_id" => $status['profile_post_id']); } $commentsSortedArray[$currentPostId] = $commentGroup; } $statusUserObjs = getUserData($statusArray); foreach ($statusArray as $status) { $recentStatus[] = array("user" => $statusUserObjs[$status['user_id']], "status" => $status['message'], "time" => $status['post_date'], "post_id" => $status['profile_post_id']); } $returnArrays = array("status" => $recentStatus, "comments" => $commentsSortedArray); return $returnArrays; }
function prod__list() { $out = aikiGetForm($_GET["form"], $_GET["mode"]); $flag = ""; $where = ""; if (isset($_GET["division"]) && $_GET["division"] > "") { $where = aikiWhereFromTree("prod_division", $_GET["division"], "division"); $flag = "division"; } $Item = aikiListItems($_GET["form"], $where); $Item["result"] = array_sort($Item["result"], "id"); $Item["form"] = $_GET["form"]; $out->contentSetData($Item); $out->contentSetValues($Item); $modal = $out->find("div.modal"); foreach ($modal as $m) { if ($m->attr("id") == "") { $m->attr("id", "{$_GET["form"]}Edit"); } $m->attr("data-backdrop", "static"); if ($m->find("[data-formsave]")->length && $m->find("[data-formsave]")->attr("data-formsave") == "") { $m->find("[data-formsave]")->attr("data-formsave", "#{$_GET["form"]}EditForm"); } if ($m->find(".modal-title")->html() == "") { $m->find(".modal-title")->html("Редактирование"); } } if ($flag == "division") { $out = $out->find("#prodList .list")->html(); return $out; } if ($flag == "") { return $out->outerHtml(); } }
public function __construct(Player $player, array $properties, array $stats = null) { parent::__construct($properties); $this->player = $player; $this->statistics = new AccountStatistics($this, $stats); $properties['characters'] = array_sort($properties['characters'], function ($value) { return $value['characterBase']['characterId']; }); $this->characters = new CharacterCollection($this, $properties['characters']); }
private function sortSections($sections) { $sorts = ['F' => 1, 'W' => 2, 'Sp' => 3, 'Su' => 4]; return array_sort($sections, function ($section) use($sorts) { $term = array_get($section, 'term'); $year = substr($term, -2); $quarter = substr($term, 0, strlen($term) - 2); return [$year, array_get($sorts, $quarter), array_get($section, 'section_number')]; }); }
function sql_loadTransCats($myc, $uvjet) { global $dconf, $debug; $chdb = sql_readtable($myc, 'trans_cat', $uvjet); if (!$chdb) { return false; } array_sort($chdb, "type"); return $chdb; }
/** * Bind a associative array values to equivalent on string with colons. * @param string $str * @param array $replace * @example str_bind("Hello :name!", ["name" => "World"]) // "Hello World!" * @return mixed */ function str_bind($str, $replace = []) { $replace = array_sort($replace, function ($value, $key) { return mb_strlen($key) * -1; }); foreach ($replace as $key => $value) { $str = str_replace(':' . $key, $value, $str); } return $str; }
public function sort($sortColumn) { if ($this->has($sortColumn)) { $this->data = array_sort($this->get($sortColumn, []), function ($value, $key) { return $key; }); $this->persist(); } return $this; }
function getMenu($listMenus) { global $langage; //Filtrage entre les différents menus $parentsMenus = array(); $linksMenus = array(); //Classification des menus foreach ($listMenus as $menu) { if ($menu->id_parent_menu == NULL) { $parentsMenus[] = $menu; } else { $linksMenus[] = $menu; } } //effectuer un tri des menus $PM_Tri = array_sort($parentsMenus, SORT_COLUMN_NAME); $LM_Tri = array_sort($linksMenus, SORT_COLUMN_NAME); $HTMLMenu = ""; //Traitement des menus foreach ($PM_Tri as $parentMenu) { if ($parentMenu->type_url == Menu::TYPE_URL_AJAX || $parentMenu->type_url == Menu::TYPE_URL_EXTERNE) { switch ($parentMenu->type_url) { case Menu::TYPE_URL_AJAX: $template = TEMPLATE_AJAX; break; case Menu::TYPE_URL_EXTERNE: $template = TEMPLATE_SIMPLE_URL; break; default: break; } $HTMLMenu .= buildUrlMenu($parentMenu, null, $template); } else { $navbar_menu_links = ""; foreach ($LM_Tri as $linkmenu) { if ($linkmenu->id_parent_menu == $parentMenu->id_menu) { switch ($linkmenu->type_url) { case Menu::TYPE_URL_AJAX: $template = TEMPLATE_AJAX; break; case Menu::TYPE_URL_EXTERNE: $template = TEMPLATE_SIMPLE_URL; break; default: break; } $navbar_menu_links .= buildUrlMenu($linkmenu, null, $template); } } $HTMLMenu .= buildUrlMenu($parentMenu, $navbar_menu_links, TEMPLATE_PARENT_MENU); } } return $HTMLMenu; }
public function parseFacet($root, $name) { $values = []; foreach ($root->xpath('//s:FACET[@NAME="' . $name . '"]/s:FACET_VALUES') as $value) { $values[] = ['value' => $value->attr('KEY'), 'count' => intval($value->attr('VALUE'))]; } $values = array_reverse(array_sort($values, function ($value) { return $value['count']; })); return array_slice($values, 0, 10); }
function page__list() { $out = aikiGetForm($_GET["form"], $_GET["mode"]); $Item = aikiListItems("page"); $Item["result"] = array_sort($Item["result"], "id"); $out->contentSetData($Item); $out->find("div.modal")->attr("id", "pageEdit"); $out->find("div.modal")->attr("data-backdrop", "static"); $out->find("[data-formsave]")->attr("data-formsave", "#pageEditForm"); $out->find(".modal-title")->html("Редактирование страницы"); return $out->outerHtml(); }
function dict__list() { $form = $_GET["form"]; $out = aikifromFile("http://{$_SERVER["HTTP_HOST"]}/engine/forms/{$form}/{$form}_list.php"); $Item = aikiListItems("comments"); $Item["result"] = array_sort($Item["result"], "date", SORT_DESC); $out->contentSetData($Item); $out->find("div.modal")->attr("id", "{$form}Edit"); $out->find("div.modal")->attr("data-backdrop", "static"); $out->find("[data-formsave]")->attr("data-formsave", "#{$form}EditForm"); $out->find(".modal-title")->html("Редактирование справочника"); return $out->outerHtml(); }
/** * Create the nation phone list array, include nation name & phone code * Format like [nation_name][_][phone_code]. Ex: Australlia +61 */ function nation_phone_array() { $option = ""; $contents = file_get_contents(realpath(public_path('json/countries.json'))); $countries = json_decode(stripslashes($contents), true); $countries = array_values(array_sort($countries, function ($value) { return $value['name']; })); $nationPhones = array_map(function ($country) { return $country['name'] . ' ' . $country['phone']; }, $countries); return $nationPhones; }
protected function getTableState() { $table = []; $config = $this->config['state']; foreach ($this->states as $state) { if (in_array($state, array_keys($config))) { $table[] = $config[$state]; } } $table = array_sort($table, function ($value) { return $value['position']; }); return $table; }
public function syncdata(Request $request) { /*$client = new Client([ // Base URI is used with relative requests 'base_uri' => 'https://todoist.com', // You can set any number of default request options. 'timeout' => 2.0, ]); $response = $client->request('POST', '/oauth/access_token', [ "form_params" => [ "client_id"=>"de27417420bf4d14881b239ed8506e1d" , "client_secret"=>"dce0445f47794e51ad85b70090524cb9" , "code"=> $request->input('code') ] ]); $token = json_decode($response->getBody()->getContents())->access_token; var_dump($token);*/ $client = new Client(); $response = $client->request('POST', 'https://todoist.com/API/v6/sync', ["form_params" => ["token" => "31ecf41c4338d45dd4c6ad65f706207366691925", "seq_no" => uniqid(), "resource_types" => '["all"]']]); $data = json_decode($response->getBody()->getContents()); $projects = array_values(array_sort($data->Projects, function ($value) { $value = (array) $value; return $value['item_order']; })); DB::table('project_user')->delete(); DB::table('label_todo')->delete(); DB::table('todos')->where("estimated_time", 0)->delete(); $todos = $data->Items; $labels = $data->Labels; $user = $data->User; $collaborators = $data->Collaborators; $collaboratorStates = $data->CollaboratorStates; //var_dump($todos); $this->user = $user; $this->collaborators = $collaborators; $this->projects = $projects; $this->collaboratorStates = $collaboratorStates; $this->todos = $todos; $this->labels = $labels; $this->updateLabels(); $this->updateUser(); $this->updateConnectedUsers(); $this->updateProjectList(); $this->updateCollaboratorStates(); $this->updateTodoList(); return Redirect::back(); }
private function sliceData($sezione, $prodotti_raw, $pagine_repo, $listini_repo) { $listini = $listini_repo->getAllFront(); $contenuti = $pagine_repo->getContentForPage($sezione); $prodotti = []; foreach ($prodotti_raw as $prodotto) { $prodotti[strtoupper($prodotto['nome'])][] = $prodotto; } $categorie = collect(array_pluck(array_collapse($prodotti), 'categoria_terapeutica'))->unique(); $principi_validi = array_pluck(collect(array_pluck(array_collapse($prodotti), 'principio_attivo'))->unique(), 'slug'); $principi = collect(array_sort(array_pluck(array_collapse($prodotti), 'principio_attivo'), function ($value) { return $value['nome']; }))->unique(); return array($prodotti, $categorie, $principi, $principi_validi, $contenuti, $listini); }
/** * Compile the routes into a displayable format. * * @return array */ protected function getRoutes() { $results = []; foreach ($this->routes as $route) { $results[] = $this->getRouteInformation($route); } if ($sort = $this->option('sort')) { $results = array_sort($results, function ($value) use($sort) { return $value[$sort]; }); } if ($this->option('reverse')) { $results = array_reverse($results); } return array_filter($results); }
function AggregateFeed($collections, $find_by = NULL, $accept = "text/html") { $this->per_page = 10; $this->_currentRow = 0; $this->EOF = false; $this->members = array(); $sortmembers = array(); $this->collections = $collections; $this->accept = $accept; foreach ($this->collections as $tab => $coll) { foreach ($coll->members as $pk => $time) { $sortmembers[] = array('time' => $time, 'resource' => $coll->resource, 'record_id' => $pk); } } $this->members = array_sort($sortmembers, 'time', $this->per_page); }
/** *私信分组点进去后展示两个用户之间具体的的私信内容 */ public function showConcretePM() { $userId = I('userId'); //分组那个人的ID if ($userId != null && isUserLogin()) { if ($userId != session('userId')) { $where1['pm_sender_id'] = session('userId'); $where1['pm_receiver_id'] = $userId; $where2['rm_receiver_id'] = session('userId'); $where2['rm_sender_id'] = $userId; $data1 = M('primessage')->field('pm_sender_id,pm_receiver_id,pm_content,pm_time')->where($where1)->order('pm_time')->select(); //我发给他的私信 $data2 = M('rcemessage')->field('rm_id,rm_sender_id as pm_sender_id,rm_receiver_id as pm_receiver_id,rm_content as pm_content,rm_time as pm_time')->where($where2)->order('pm_time')->select(); //他发给我的私信 $data = array_merge($data1, $data2); //将两个数组整合到一个数组中去 $data = array_sort($data, 'pm_time', 'asc'); //按时间升序排序 $result = array(); $result[0] = current($data); for ($i = 1; $i < count($data); $i++) { $result[$i] = next($data); //重新将data数组按第一维排序保存到result数组中,即result[0]、result[1]、result[2]、result[3]、result[4]。。。 } $a = M('user')->field('user_name')->where(array('user_id' => $userId))->select(); $userName = $a[0]['user_name']; //查询到那个人的名称 $b = M('userinfo')->field('info_pic')->where(array('user_id' => $userId))->select(); $infoPic = $b[0]['info_pic']; // dump($infoPic); // dump($result); // dump($userName); // die(); $pmSum = count($result); $this->assign('userId', $userId); $this->assign('userName', $userName); $this->assign('pmInfo', $result); $this->assign('pmSum', $pmSum); // $this->assign('infoPic',$infoPic); $this->display('pm'); } else { $this->error('您不能给自己发私信'); } } else { $this->error('请先登录'); } }
static function get_upcoming_schedules_to_tour($cheapest_upcoming_schedules) { //////////////////////////////// // Sort By Flight // //////////////////////////////// $upcoming_schedules = array_sort($cheapest_upcoming_schedules, function ($cheapest_upcoming_schedules) { if (!$cheapest_upcoming_schedules->departure_until) { return $cheapest_upcoming_schedules->departure; } else { return $cheapest_upcoming_schedules->departure_until; } }); /////////////////// // Return result // /////////////////// return $upcoming_schedules; }
/** * Bind data to the view. * * @param View $view * * @return void */ public function compose(View $view) { // This menu item declares the menu and // sets it as an array of arrays. $menu = [['name' => trans('web::seat.assets'), 'permission' => 'corporation.assets', 'highlight_view' => 'assets', 'route' => 'corporation.view.assets'], ['name' => trans_choice('web::seat.bookmark', 2), 'permission' => 'corporation.bookmarks', 'highlight_view' => 'bookmarks', 'route' => 'corporation.view.bookmarks'], ['name' => trans('web::seat.contacts'), 'permission' => 'corporation.contacts', 'highlight_view' => 'contacts', 'route' => 'corporation.view.contacts'], ['name' => trans('web::seat.contracts'), 'permission' => 'corporation.contracts', 'highlight_view' => 'contracts', 'route' => 'corporation.view.contracts'], ['name' => trans('web::seat.industry'), 'permission' => 'corporation.industry', 'highlight_view' => 'industry', 'route' => 'corporation.view.industry'], ['name' => trans('web::seat.killmails'), 'permission' => 'corporation.killmails', 'highlight_view' => 'killmails', 'route' => 'corporation.view.killmails'], ['name' => trans('web::seat.market'), 'permission' => 'corporation.market', 'highlight_view' => 'market', 'route' => 'corporation.view.market'], ['name' => trans('web::seat.pocos'), 'permission' => 'corporation.pocos', 'highlight_view' => 'pocos', 'route' => 'corporation.view.pocos'], ['name' => trans('web::seat.security'), 'permission' => 'corporation.security', 'highlight_view' => 'security', 'route' => 'corporation.view.security.roles'], ['name' => trans_choice('web::seat.starbase', 2), 'permission' => 'corporation.starbases', 'highlight_view' => 'starbases', 'route' => 'corporation.view.starbases'], ['name' => trans('web::seat.summary'), 'permission' => 'corporation.summary', 'highlight_view' => 'summary', 'route' => 'corporation.view.summary'], ['name' => trans('web::seat.standings'), 'permission' => 'corporation.standings', 'highlight_view' => 'standings', 'route' => 'corporation.view.standings'], ['name' => trans('web::seat.tracking'), 'permission' => 'corporation.tracking', 'highlight_view' => 'tracking', 'route' => 'corporation.view.tracking'], ['name' => trans('web::seat.wallet_journal'), 'permission' => 'corporation.journal', 'highlight_view' => 'journal', 'route' => 'corporation.view.journal'], ['name' => trans('web::seat.wallet_transactions'), 'permission' => 'corporation.transactions', 'highlight_view' => 'transactions', 'route' => 'corporation.view.transactions']]; // Load any package menus if (!empty(config('package.corporation.menu'))) { foreach (config('package.corporation.menu') as $menu_data) { $prepared_menu = $this->load_plugin_menu($menu_data); array_push($menu, $prepared_menu); } } // Sort the menu alphabetically. $menu = array_values(array_sort($menu, function ($value) { return $value['name']; })); $view->with('menu', $menu); }
/** * Bind data to the view. * * @param View $view * * @return void */ public function compose(View $view) { // This menu item declares the menu and // sets it as an array of arrays. $menu = []; // Load any package menus if (!empty(config('package.character.menu'))) { foreach (config('package.character.menu') as $menu_data) { $prepared_menu = $this->load_plugin_menu('character', $menu_data); array_push($menu, $prepared_menu); } } // Sort the menu alphabetically. $menu = array_values(array_sort($menu, function ($value) { return $value['name']; })); $view->with('menu', $menu); }
/** * Bind data to the view. * * @param View $view * * @return void */ public function compose(View $view) { // This menu item declares the menu and // sets it as an array of arrays. $menu = [['name' => trans('web::seat.assets'), 'permission' => 'character.assets', 'highlight_view' => 'assets', 'route' => 'character.view.assets'], ['name' => trans_choice('web::seat.bookmark', 2), 'permission' => 'character.bookmarks', 'highlight_view' => 'bookmarks', 'route' => 'character.view.bookmarks'], ['name' => trans('web::seat.calendar'), 'permission' => 'character.calendar', 'highlight_view' => 'calendar', 'route' => 'character.view.calendar'], ['name' => trans('web::seat.channels'), 'permission' => 'character.channels', 'highlight_view' => 'channels', 'route' => 'character.view.channels'], ['name' => trans('web::seat.contacts'), 'permission' => 'character.contacts', 'highlight_view' => 'contacts', 'route' => 'character.view.contacts'], ['name' => trans('web::seat.contracts'), 'permission' => 'character.contracts', 'highlight_view' => 'contracts', 'route' => 'character.view.contracts'], ['name' => trans('web::seat.industry'), 'permission' => 'character.industry', 'highlight_view' => 'industry', 'route' => 'character.view.industry'], ['name' => trans('web::seat.killmails'), 'permission' => 'character.killmails', 'highlight_view' => 'killmails', 'route' => 'character.view.killmails'], ['name' => trans('web::seat.mail'), 'permission' => 'character.mail', 'highlight_view' => 'mail', 'route' => 'character.view.mail'], ['name' => trans('web::seat.market'), 'permission' => 'character.market', 'highlight_view' => 'market', 'route' => 'character.view.market'], ['name' => trans('web::seat.notifications'), 'permission' => 'character.notifications', 'highlight_view' => 'notifications', 'route' => 'character.view.notifications'], ['name' => trans('web::seat.pi'), 'permission' => 'character.pi', 'highlight_view' => 'pi', 'route' => 'character.view.pi'], ['name' => trans('web::seat.research'), 'permission' => 'character.research', 'highlight_view' => 'research', 'route' => 'character.view.research'], ['name' => trans('web::seat.sheet'), 'permission' => 'character.sheet', 'highlight_view' => 'sheet', 'route' => 'character.view.sheet'], ['name' => trans('web::seat.skills'), 'permission' => 'character.skills', 'highlight_view' => 'skills', 'route' => 'character.view.skills'], ['name' => trans('web::seat.standings'), 'permission' => 'character.standings', 'highlight_view' => 'standings', 'route' => 'character.view.standings'], ['name' => trans('web::seat.wallet_journal'), 'permission' => 'character.journal', 'highlight_view' => 'journal', 'route' => 'character.view.journal'], ['name' => trans('web::seat.wallet_transactions'), 'permission' => 'character.transactions', 'highlight_view' => 'transactions', 'route' => 'character.view.transactions']]; // Load any package menus if (!empty(config('package.character.menu'))) { foreach (config('package.character.menu') as $menu_data) { $prepared_menu = $this->load_plugin_menu($menu_data); array_push($menu, $prepared_menu); } } // Sort the menu alphabetically. $menu = array_values(array_sort($menu, function ($value) { return $value['name']; })); $view->with('menu', $menu); }
/** * */ public function log() { $file_list = array(); $files_list = array(); File::getFiles(LOG_PATH, $file_list, '#\\.log#i'); foreach ($file_list as $key => $value) { $files_list_temp = array(); $files_list_temp['id'] = base64_encode($value); $files_list_temp['name'] = $value; $files_list_temp['size'] = File::realSize($value); $files_list_temp['create_time'] = date("Y-m-d H:i:s", File::filectime($value)); $files_list_temp['mod_time'] = date("Y-m-d H:i:s", File::filemtime($value)); $files_list[] = $files_list_temp; } $files_list = array_sort($files_list, "mod_time"); $this->assign('logs_list', $files_list); $this->display(); }
/** * Compile the routes into a displayable format. * * @return array */ protected function getRoutes() { $routes = []; foreach ($this->routes as $collection) { foreach ($collection->getRoutes() as $route) { $routes[] = $this->filterRoute(['host' => $route->domain(), 'uri' => implode('|', $route->methods()) . ' ' . $route->uri(), 'name' => $route->getName(), 'action' => $route->getActionName(), 'protected' => $this->routeHasAuthMiddleware($route) ? 'Yes' : 'No', 'versions' => implode(', ', $route->versions()), 'scopes' => implode(', ', $route->scopes())]); } } if ($sort = $this->option('sort')) { $routes = array_sort($routes, function ($value) use($sort) { return $value[$sort]; }); } if ($this->option('reverse')) { $routes = array_reverse($routes); } return array_filter(array_unique($routes, SORT_REGULAR)); }
/** * 获取数据 * @param int $fid * @return Ambigous <string, unknown, void, unknown> */ public function get_info($fid) { $sql = "SELECT * FROM `tools_plan` WHERE id = '{$fid}' LIMIT 1"; $query = $this->db->query($sql); $reuslt['plan'] = $query->row_array(); $reuslt['plan']['exceptdays'] = json_decode($reuslt['plan']['exceptdays'], TRUE); $reuslt['plan']['pic_start'] = date("Y-m-d", strtotime("-" . (date('w', strtotime($reuslt['plan']['begintime'])) - 1) . " days", strtotime($reuslt['plan']['begintime']))); $reuslt['plan']['pic_end'] = date("Y-m-d", strtotime("+" . (7 - date('w', strtotime($reuslt['plan']['endtime']))) . " days", strtotime($reuslt['plan']['endtime']))); $sql = "SELECT *,expstrt as timepoint,'task' as type FROM `tools_plan_task` WHERE fid = '{$fid}' AND is_del = 0"; $query = $this->db->query($sql); $task = $query->result_array(); $sql = "SELECT *,'milestone' as type FROM `tools_plan_milestone` WHERE fid = '{$fid}' AND is_del = 0"; $query = $this->db->query($sql); $milestone = $query->result_array(); $tm = array_merge($task, $milestone); $reuslt['tm'] = array_sort($tm, 'timepoint'); $reuslt['bname'] = $reuslt['plan']['bname']; return $reuslt; }
/** *Ajax检测商机名称 * **/ public function check() { import("@.ORG.SplitWord"); $sp = new SplitWord(); $m_business = M('Business'); $useless_words = array(L('COMPANY'), L('LIMITED'), L('DI'), L('LIMITED_COMPANY')); if ($this->isAjax()) { $split_result = $sp->SplitRMM($_POST['name']); if (!is_utf8($split_result)) { $split_result = iconv("GB2312//IGNORE", "UTF-8", $split_result); } $result_array = explode(' ', trim($split_result)); if (count($result_array) < 2) { $this->ajaxReturn(0, '', 0); die; } foreach ($result_array as $k => $v) { if (in_array($v, $useless_words)) { unset($result_array[$k]); } } $name_list = $m_business->getField('name', true); $seach_array = array(); foreach ($name_list as $k => $v) { $search = 0; foreach ($result_array as $k2 => $v2) { if (strpos($v, $v2) > -1) { $v = str_replace("{$v2}", "<span style='color:red;'>{$v2}</span>", $v, $count); $search += $count; } } if ($search > 2) { $seach_array[$k] = array('value' => $v, 'search' => $search); } } $seach_sort_result = array_sort($seach_array, 'search', 'desc'); if (empty($seach_sort_result)) { $this->ajaxReturn(0, L('ABLE_ADD'), 0); } else { $this->ajaxReturn($seach_sort_result, L('CUSTOMER_IS_CREATED'), 1); } } }
public function index() { $species = collect(Species::all())->shuffle(); /* * */ $highestTierTaxaGroup = TaxaGroup::where('tier', '=', 1)->where('uploadToWeb', '=', 1)->get(); $secondTierTaxaGroup = TaxaGroup::where('tier', '=', 2)->where('uploadToWeb', '=', 1)->get(); // $test = []; // $test1 = []; // HomeController::recursivelyGetSpecies(TaxaGroup::find('Diptera (True Flies)'),$test, $test1); // // return implode(' ', $test1); // Sort genusName in ascending order $secondTierTaxaGroup = array_values(array_sort($secondTierTaxaGroup, function ($value) { return $value['taxaGroupID']; })); return View::make('pages.home', ['specimens' => $species, 'genusNames' => $secondTierTaxaGroup, 'classNames' => $highestTierTaxaGroup]); }
public function getPendapatan() { $employees = []; $tmp_employees = DB::table('fact_absensi')->select('id_pegawai')->distinct()->orderBy('id_pegawai')->get(); foreach ($tmp_employees as $employee) { $emp = DB::table('dim_pegawai')->select('nama_pegawai')->where('id_pegawai', $employee->id_pegawai)->first(); $employees[] = ['id_pegawai' => $employee->id_pegawai, 'nama_pegawai' => $emp->nama_pegawai]; } $employees = array_values(array_sort($employees, function ($value) { return $value['nama_pegawai']; })); $employees = json_decode(json_encode($employees)); $months = []; $tmp_times = DB::table('dim_waktu')->get(); foreach ($tmp_times as $time) { $date = DateTime::createFromFormat('d-n-Y', '01-' . $time->bulan . '-' . $time->tahun); $months[] = ['id_waktu' => $time->id_waktu, 'bulan' => $date->format('F Y')]; } $months = json_decode(json_encode($months)); return view('pencapaian')->with(compact(['employees', 'months'])); }
/** * Pull notifications from remotes * @return array Notifications */ function get_notifications() { global $config; $obj = array(); foreach ($config['notifications'] as $name => $url) { echo '[ ' . date('r') . ' ] ' . $url . ' '; $feed = json_decode(json_encode(simplexml_load_string(file_get_contents($url))), true); if (isset($feed['channel'])) { $feed = parse_rss($feed); } else { $feed = parse_atom($feed); } array_walk($feed, function (&$items, $key, $url) { $items['source'] = $url; }, $url); $obj = array_merge($obj, $feed); echo '(' . sizeof($obj) . ')' . PHP_EOL; } $obj = array_sort($obj, 'datetime'); return $obj; }