query
stringlengths
7
5.25k
document
stringlengths
15
1.06M
metadata
dict
negatives
listlengths
3
101
negative_scores
listlengths
3
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Process received transactions data
protected function _processSpentTransactionData($data = [], $result = []) { foreach ($data as $trans) { if (isset($result[$trans['time']])) { $result[$trans['time']]['spent'] = abs($trans['credit']); } else { $result[$trans['time']] = [ 'y' => $trans['time'], 'received' => 0, 'spent' => abs($trans['credit']), ]; } } return $result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function processTransaction($data){\n\n\t\t$bmtProducts = array( // todo add more products \n\t\t\t91390007 => '50',\n\t\t\t91390006 => '10',\n\t\t\t91390005 => '25',\n\t\t\t91390009 => '100',\n\t\t\t91390008 => '75',\n\t\t\t\n\t\t);\n\t \n\t $sessionId = $data['ccom'];\n\t $pid = $data['productid'];\n\t \...
[ "0.6781948", "0.6701362", "0.6361216", "0.6347485", "0.620456", "0.6199414", "0.61197317", "0.60036254", "0.60004485", "0.59847015", "0.5842665", "0.5772446", "0.57524115", "0.5746092", "0.57354873", "0.57333404", "0.568481", "0.56506306", "0.5636272", "0.5615098", "0.5572615...
0.0
-1
Get transaction data for graph last 24 hours
public function getTransactionsDataLast24Hours($customerId) { $to = $this->_date->date('Y-m-d H:i:s'); $from = strtotime($to."-24hours"); $from = $this->_date->date('Y-m-d H:i:s', $from); $transactionResource = $this->_transactionFactory->create()->getResource(); $result = []; $data = $transactionResource->getReceivedCreditTransactionsByHour($from, $to, $customerId); $result = $this->_processReceivedTransactionData($data, $result); $data = $transactionResource->getSpentCreditTransactionsByHour($from, $to, $customerId); $result = $this->_processSpentTransactionData($data, $result); $result = array_values($result); return $result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getChartData() {\n $fromDate = Carbon::now()->subMinutes(60);\n $toDate = Carbon::now();\n\n $chart = new TaskActivity;\n $chartData = Auth::user()->tasks()->where('is_complete', 0)->whereBetween('created_at', [$fromDate, $toDate])->get()->pluck('created_at')->toArray();...
[ "0.60542", "0.59338474", "0.57770365", "0.5693097", "0.5671071", "0.55951077", "0.5591348", "0.5587907", "0.5587562", "0.5577061", "0.5568402", "0.5552195", "0.55167", "0.5442502", "0.54316807", "0.54188687", "0.54127675", "0.538055", "0.5363416", "0.53165084", "0.52765894", ...
0.638745
0
Get transaction data for graph last 7 days
public function getTransactionDataLast7Days($customerId) { $to = $this->_date->date('Y-m-d'); $from = strtotime($to."-7days"); $from = $this->_date->date('Y-m-d', $from); $to .= ' 23:59:59'; $transactionResource = $this->_transactionFactory->create()->getResource(); $result = []; $data = $transactionResource->getReceivedCreditTransactionsByDay($from, $to, $customerId); $result = $this->_processReceivedTransactionData($data, $result); $data = $transactionResource->getSpentCreditTransactionsByDay($from, $to, $customerId); $result = $this->_processSpentTransactionData($data, $result); $result = array_values($result); return $result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function graphData()\n {\n $dayOfWeek = ['Lunes', 'Martes', 'Miercoles', 'Jueves', 'Viernes', 'Sabado', 'Domingo'];\n $colors = [\n 'rgba(201, 203, 207, 0.8)', //gray\n 'rgba(255, 99, 132, 0.8)', //Red\n 'rgba(255, 159, 64, 0.8)', //Orange\n 'rgba(75, 192, 192, 0.8)', //green\n...
[ "0.61208314", "0.6014315", "0.58201826", "0.5778815", "0.5752533", "0.57223696", "0.5625854", "0.56048405", "0.558557", "0.55691063", "0.5525034", "0.5522897", "0.55196416", "0.54932946", "0.5476488", "0.5458259", "0.5436292", "0.5436242", "0.54315376", "0.54266995", "0.54122...
0.6137587
0
Get transaction data for graph last month
public function getTransactionDataLastMonth($customerId) { $to = $this->_date->date('Y-m-d'); $from = strtotime($to."-30days"); $from = $this->_date->date('Y-m-d', $from); $to .= ' 23:59:59'; $transactionResource = $this->_transactionFactory->create()->getResource(); $result = []; $data = $transactionResource->getReceivedCreditTransactionsByDay($from, $to, $customerId); $result = $this->_processReceivedTransactionData($data, $result); $data = $transactionResource->getSpentCreditTransactionsByDay($from, $to, $customerId); $result = $this->_processSpentTransactionData($data, $result); $result = array_values($result); return $result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function graphData()\n {\n $dayOfWeek = ['Lunes', 'Martes', 'Miercoles', 'Jueves', 'Viernes', 'Sabado', 'Domingo'];\n $colors = [\n 'rgba(201, 203, 207, 0.8)', //gray\n 'rgba(255, 99, 132, 0.8)', //Red\n 'rgba(255, 159, 64, 0.8)', //Orange\n 'rgba(75, 192, 192, 0.8)', //green\n...
[ "0.64858806", "0.63189", "0.62106276", "0.60974693", "0.5990626", "0.5970631", "0.5957802", "0.59255177", "0.5884934", "0.58690435", "0.58343613", "0.5818631", "0.5817361", "0.5742855", "0.5735136", "0.5733393", "0.5692241", "0.5644872", "0.56400865", "0.56345624", "0.5621875...
0.6270143
2
Get transaction data for graph last year
public function getTransactionDataLastYear($customerId) { $to = $this->_date->date('Y-m-d'); $from = strtotime($to."-1year"); $from = $this->_date->date('Y-m-d', $from); $to .= ' 23:59:59'; $transactionResource = $this->_transactionFactory->create()->getResource(); $result = []; $data = $transactionResource->getReceivedCreditTransactionsByMonth($from, $to, $customerId); $result = $this->_processReceivedTransactionData($data, $result); $data = $transactionResource->getSpentCreditTransactionsByMonth($from, $to, $customerId); $result = $this->_processSpentTransactionData($data, $result); $result = array_values($result); return $result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getLastYearData() {\n\t\t$dates = getPeriods('LastYear');\n\t\treturn $this->getDataByInterval($dates['startMonth'], $dates['startYear'], $dates['endMonth'], $dates['endYear'], 12);\t\t\n\t}", "public function TransactionChart(Request $request)\n {\n \t$year = $request->input('year') ? $req...
[ "0.63582754", "0.634956", "0.57779545", "0.56938326", "0.5657003", "0.5616629", "0.561383", "0.54926366", "0.5490506", "0.5480437", "0.54111034", "0.53703535", "0.53418267", "0.5303236", "0.52978903", "0.52888536", "0.5286701", "0.52859354", "0.52704364", "0.52629477", "0.524...
0.60402113
2
Get transaction data for graph last 2 years
public function getTransactionDataLast2Years($customerId) { $to = $this->_date->date('Y-m-d'); $from = strtotime($to."-2year"); $from = $this->_date->date('Y-m-d', $from); $to .= ' 23:59:59'; $transactionResource = $this->_transactionFactory->create()->getResource(); $result = []; $data = $transactionResource->getReceivedCreditTransactionsByMonth($from, $to, $customerId); $result = $this->_processReceivedTransactionData($data, $result); $data = $transactionResource->getSpentCreditTransactionsByMonth($from, $to, $customerId); $result = $this->_processSpentTransactionData($data, $result); $result = array_values($result); return $result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getLastYearData() {\n\t\t$dates = getPeriods('LastYear');\n\t\treturn $this->getDataByInterval($dates['startMonth'], $dates['startYear'], $dates['endMonth'], $dates['endYear'], 12);\t\t\n\t}", "public function getGraphDataForAnAccount($startDate, $endDate, $acc_id){\n\t\t$result = Transaction::wh...
[ "0.60202193", "0.58048856", "0.57760024", "0.57711565", "0.5679172", "0.5591546", "0.55611396", "0.5534792", "0.55335593", "0.5418142", "0.53831774", "0.5345678", "0.53005767", "0.52926964", "0.5277447", "0.5244677", "0.5233765", "0.523042", "0.5188856", "0.5172038", "0.51548...
0.6082251
0
Process received transactions data
protected function _processOrderData($data = []) { $key = ''; foreach ($data as $trans) { if (!$key) { $key = $trans['time']; } $result[$trans['time']] = [ 'y' => $trans['time'], 'order_num' => isset($trans['order_num'])?$trans['order_num']:0, 'amount' => isset($trans['amount'])?$trans['amount']:0, ]; } return $result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function processTransaction($data){\n\n\t\t$bmtProducts = array( // todo add more products \n\t\t\t91390007 => '50',\n\t\t\t91390006 => '10',\n\t\t\t91390005 => '25',\n\t\t\t91390009 => '100',\n\t\t\t91390008 => '75',\n\t\t\t\n\t\t);\n\t \n\t $sessionId = $data['ccom'];\n\t $pid = $data['productid'];\n\t \...
[ "0.6781948", "0.6701362", "0.6361216", "0.6347485", "0.620456", "0.6199414", "0.61197317", "0.60036254", "0.60004485", "0.59847015", "0.5842665", "0.5772446", "0.57524115", "0.5746092", "0.57354873", "0.57333404", "0.568481", "0.56506306", "0.5636272", "0.5615098", "0.5572615...
0.0
-1
Get order data last 24 hours
public function getOrdersDataLast24Hours($vendorId) { $to = $this->_date->date('Y-m-d H:i:s'); $from = strtotime($to."-24hours"); $from = $this->_date->date('Y-m-d H:i:s', $from); $orderResource = $this->_vendorOrderFactory->create()->getResource(); $data = $orderResource->getNumOfOrderByHour($from, $to, $vendorId); $result = $this->_processOrderData($data); $result = array_values($result); return $result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function get_recent_orders(){\n\t $orders = $this->Order->get_recent_orders();\n\t if($this->params['requested']){\n\t return $orders;\n\t }else{\n\t $this->set('orders', $orders);\n\t }\n \n\t}", "public static function get24HoursAgo(){\n return date('Y-m-d H:i:s',strtotime(\...
[ "0.6115435", "0.5914363", "0.5797083", "0.5697635", "0.5637294", "0.5628435", "0.5624406", "0.5550792", "0.55285096", "0.55255234", "0.5479182", "0.5447161", "0.54254276", "0.5407645", "0.5390537", "0.538642", "0.5371739", "0.53544015", "0.5353523", "0.5353523", "0.53225225",...
0.6659961
0
Get order data last 7 days
public function getOrdersDataLast7Days($vendorId) { $to = $this->_date->date('Y-m-d'); $from = strtotime($to."-7days"); $from = $this->_date->date('Y-m-d', $from); $to .= ' 23:59:59'; $orderResource = $this->_vendorOrderFactory->create()->getResource(); $data = $orderResource->getNumOfOrderByDay($from, $to, $vendorId); $result = $this->_processOrderData($data); $result = array_values($result); return $result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getLastSevenDaysRevenue() {\n $userClient = Auth::user()->clientID;\n\n if($userClient == 1) {\n \t\n $result = DB::select(\"SELECT calendar.datefield AS DATE,IFNULL(SUM(r.amount),0) AS total FROM request_logs r RIGHT JOIN calendar ON (DATE(r.date_created) = calendar.dat...
[ "0.6258321", "0.6032126", "0.5924634", "0.5919259", "0.5840765", "0.58389056", "0.58226204", "0.5803716", "0.57998663", "0.5730479", "0.56885207", "0.56826484", "0.5654919", "0.5624115", "0.5619001", "0.5585667", "0.5570741", "0.54992676", "0.5497031", "0.5445543", "0.5427387...
0.6676397
0
Get order data for graph last month
public function getOrdersDataLastMonth($vendorId) { $to = $this->_date->date('Y-m-d'); $from = strtotime($to."-30days"); $from = $this->_date->date('Y-m-d', $from); $to .= ' 23:59:59'; $orderResource = $this->_vendorOrderFactory->create()->getResource(); $data = $orderResource->getNumOfOrderByDay($from, $to, $vendorId); $result = $this->_processOrderData($data); $result = array_values($result); return $result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getDataMonth()\n {\n return $this->model()->where('created_at', '>=', Carbon::now()->startOfMonth())->get();\n }", "public function graphData()\n {\n $dayOfWeek = ['Lunes', 'Martes', 'Miercoles', 'Jueves', 'Viernes', 'Sabado', 'Domingo'];\n $colors = [\n 'rgba(201, 203, 2...
[ "0.63019407", "0.62294954", "0.6180937", "0.6114102", "0.60551393", "0.5959811", "0.5848587", "0.58300054", "0.57639945", "0.5739747", "0.5709766", "0.5689291", "0.5674271", "0.5672121", "0.5668826", "0.56526935", "0.56256413", "0.56184655", "0.5602932", "0.55902594", "0.5541...
0.5981382
5
Get orders data for graph last year
public function getOrdersDataLastYear($vendorId) { $to = $this->_date->date('Y-m-d'); $from = strtotime($to."-1year"); $from = $this->_date->date('Y-m-d', $from); $to .= ' 23:59:59'; $orderResource = $this->_vendorOrderFactory->create()->getResource(); $data = $orderResource->getNumOfOrderByMonth($from, $to, $vendorId); $result = $this->_processOrderData($data); $result = array_values($result); return $result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getOrders() {\n\t\t$orders = Mage::getModel ( 'sales/order' )->getCollection ()->addAttributeToSelect ( \"*\" )->addAttributeToFilter ( 'status', array ('complete') );\n\t\t$orders_data = $this->preapreOrdersTosend ( $orders );\n\t\treturn $orders_data;\n\t}", "public function getOrdersDataLast2Years($v...
[ "0.6137392", "0.606342", "0.60371614", "0.6024123", "0.5996329", "0.5934803", "0.5846875", "0.58465433", "0.5836489", "0.57916576", "0.5789612", "0.57834584", "0.5763714", "0.57595646", "0.5739751", "0.5706384", "0.56945807", "0.5690902", "0.5682889", "0.5681555", "0.55825484...
0.6176183
0
Get orders data for graph last 2 years
public function getOrdersDataLast2Years($vendorId) { $to = $this->_date->date('Y-m-d'); $from = strtotime($to."-2year"); $from = $this->_date->date('Y-m-d', $from); $to .= ' 23:59:59'; $orderResource = $this->_vendorOrderFactory->create()->getResource(); $data = $orderResource->getNumOfOrderByMonth($from, $to, $vendorId); $result = $this->_processOrderData($data); $result = array_values($result); return $result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getOrders() {\n\t\t$orders = Mage::getModel ( 'sales/order' )->getCollection ()->addAttributeToSelect ( \"*\" )->addAttributeToFilter ( 'status', array ('complete') );\n\t\t$orders_data = $this->preapreOrdersTosend ( $orders );\n\t\treturn $orders_data;\n\t}", "public function getOutstandingOrders()\n ...
[ "0.61164427", "0.5987768", "0.5911272", "0.58855456", "0.5795916", "0.57806545", "0.5758788", "0.5743868", "0.57264215", "0.5662732", "0.56624943", "0.5649392", "0.56460464", "0.56296027", "0.56075716", "0.554253", "0.55382454", "0.5533397", "0.5504726", "0.5494692", "0.54931...
0.62975216
0
Get paid amount last 24 hours
public function getAmountsDataLast24Hours($vendorId) { $to = $this->_date->date('Y-m-d H:i:s'); $from = strtotime($to."-24hours"); $from = $this->_date->date('Y-m-d H:i:s', $from); $orderResource = $this->_vendorOrderFactory->create()->getResource(); $data = $orderResource->getAmountsByHour($from, $to, $vendorId); $result = $this->_processOrderData($data); $result = array_values($result); return $result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getPaymentAuthExpiration();", "public static function get24HoursAgo(){\n return date('Y-m-d H:i:s',strtotime(\"-1 days\"));\n }", "public function getExpiration();", "public function getRelativeExpiration(): \\DateInterval;", "public function getTotalPaid();", "public function g...
[ "0.61048967", "0.60730714", "0.591904", "0.58494616", "0.5784993", "0.5761473", "0.5740352", "0.57386655", "0.5713298", "0.569081", "0.5685817", "0.5662327", "0.5628338", "0.5580329", "0.556388", "0.5526758", "0.551033", "0.5495572", "0.54939234", "0.54702985", "0.54702985", ...
0.54435486
23
Get paid amount last 7 days
public function getAmountsDataLast7Days($vendorId) { $to = $this->_date->date('Y-m-d'); $from = strtotime($to."-7days"); $from = $this->_date->date('Y-m-d', $from); $to .= ' 23:59:59'; $orderResource = $this->_vendorOrderFactory->create()->getResource(); $data = $orderResource->getAmountsByDay($from, $to, $vendorId); $result = $this->_processOrderData($data); $result = array_values($result); return $result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static function getPayDate() {\n return new DateTime(date(\"Ymd H:i:s\", strtotime('+ 7 days')));\n }", "public function getMonthlyFee();", "function getProfitLastWeek(){\n global $db;\n \n $get = getWeek();//Pulls most recent week from purchasing table\n $week = $g...
[ "0.6397035", "0.6129371", "0.61082494", "0.60387796", "0.5936025", "0.59044975", "0.5853579", "0.58346456", "0.5821185", "0.575851", "0.5719715", "0.56653273", "0.56105053", "0.5604782", "0.55988073", "0.55477196", "0.5534675", "0.55147266", "0.5427948", "0.5417524", "0.54038...
0.56338406
12
Get paid amount last month
public function getAmountsDataLastMonth($vendorId) { $to = $this->_date->date('Y-m-d'); $from = strtotime($to."-30days"); $from = $this->_date->date('Y-m-d', $from); $to .= ' 23:59:59'; $orderResource = $this->_vendorOrderFactory->create()->getResource(); $data = $orderResource->getAmountsByDay($from, $to, $vendorId); $result = $this->_processOrderData($data); $result = array_values($result); return $result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getMonthlyFee();", "public function getProfitMonth(){\n\t\tglobal $db;\n\t\t$date_now = date('Y-m').'-01';\n\t\t$last_month = date('Y-m', strtotime('-1 month')).'-01';\n\n\t\t$sql = $db->prepare(\"SELECT SUM(price) FROM project01_report WHERE date_init BETWEEN '$last_month' AND '$date_now' \");\...
[ "0.68698126", "0.68231267", "0.6483436", "0.6371976", "0.6362899", "0.6345615", "0.6224541", "0.61965346", "0.6177446", "0.61648774", "0.61598235", "0.6116789", "0.60735", "0.6034552", "0.6029726", "0.6013092", "0.5995471", "0.59944236", "0.5983563", "0.59803563", "0.59561753...
0.53571135
82
Get paid amount last year
public function getAmountsDataLastYear($vendorId) { $to = $this->_date->date('Y-m-d'); $from = strtotime($to."-1year"); $from = $this->_date->date('Y-m-d', $from); $to .= ' 23:59:59'; $orderResource = $this->_vendorOrderFactory->create()->getResource(); $data = $orderResource->getAmountsByMonth($from, $to, $vendorId); $result = $this->_processOrderData($data); $result = array_values($result); return $result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getYear() {}", "public function receipt_year() {\n $this->db->select('YEAR(receipt_master.date_transfer) AS year_pay');\n $this->db->where('receipt_master.type_receipt_id', 5);\n $this->db->where('receipt_master.status_receipt_id', 1);\n $this->db->where('receipt_maste...
[ "0.6462789", "0.6368475", "0.6221266", "0.62104636", "0.6199526", "0.6188869", "0.61713487", "0.6107393", "0.61063874", "0.6081917", "0.60647273", "0.605971", "0.60405564", "0.6021551", "0.5979511", "0.59642303", "0.59386605", "0.5936051", "0.5896815", "0.58818483", "0.588184...
0.57716787
33
Get paid amount last 2 years
public function getAmountsDataLast2Years($vendorId) { $to = $this->_date->date('Y-m-d'); $from = strtotime($to."-2year"); $from = $this->_date->date('Y-m-d', $from); $to .= ' 23:59:59'; $orderResource = $this->_vendorOrderFactory->create()->getResource(); $data = $orderResource->getAmountsByMonth($from, $to, $vendorId); $result = $this->_processOrderData($data); $result = array_values($result); return $result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getDifferenceInYears();", "function formatAsYears($paymentPeriods, $paymentTerm)\n{\n $days = $paymentPeriods * $paymentTerm;\n $years = round($days / 365, 1);\n return $years;\n}", "public function getLastYearData() {\n\t\t$dates = getPeriods('LastYear');\n\t\treturn $this->getDataByI...
[ "0.61900914", "0.60370886", "0.5881575", "0.5788142", "0.57079434", "0.56943154", "0.56689715", "0.56558144", "0.55912715", "0.5557239", "0.55455476", "0.5524324", "0.5481294", "0.54745454", "0.547291", "0.546731", "0.54236317", "0.5414736", "0.53936255", "0.5392288", "0.5377...
0.5817088
3
funcion ultimo cliente para guardar el Empleado_idEmpleado
function ultimoCliente() { $query = $this->db->query('SELECT MAX(idCliente) as idCliente from cliente'); foreach($query->result_array() as $d) { return( $d['idCliente']); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function GuardarEmpleado()\n {\n //Creo la conexion a la DB.\n $objetoAccesoDato = AccesoDatos::dameUnObjetoAcceso();\n\n //Creo la consulta INSERT.\n $consulta = $objetoAccesoDato->RetornarConsulta(\"INSERT into empleado (nombre,turno,tipo)values('$this->nombre','$this->tipo'...
[ "0.7614188", "0.67663884", "0.6710776", "0.66748893", "0.65489644", "0.65332836", "0.65332836", "0.652973", "0.64936984", "0.6422517", "0.6381397", "0.63496107", "0.63442326", "0.6291047", "0.6264177", "0.6259227", "0.62446684", "0.6209219", "0.6169536", "0.61444026", "0.6115...
0.0
-1
comprovar si existe nobre de usuario para registro cliente
function check_User($user_id) { if ($this->Logeo_model->check_User($user_id)) { $this->form_validation->set_message('check_User', "$user_id no Disponible"); return FALSE; } else { return TRUE; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private function existe_usuario()\n\t{\n\t\t$data = $this->request->getRawInput();\n\t\t$ruc = $data['nick']; \n\t\t$usu = new Admin_model();\n\t\t$usuarioObject = $usu->where(\"nick\", $ruc) \n\t\t->first();\n\t\treturn !is_null($usuarioObject);\n\t\t \n\t}", "function Boolean_Existencia_Usuario($username,$emai...
[ "0.73709846", "0.68137", "0.6810606", "0.6797553", "0.6796816", "0.6757448", "0.67523235", "0.67438734", "0.6654201", "0.6482175", "0.64433396", "0.6441933", "0.64321893", "0.64256275", "0.64206606", "0.64146906", "0.6413275", "0.6392416", "0.6362193", "0.6360377", "0.6345079...
0.0
-1
comprovar si existe nobre de usuario para registro cliente
function check_email($Email) { if ($this->Logeo_model->check_email($Email)) { $this->form_validation->set_message('check_email', "$Email ya esta registrado "); return FALSE; } else { return TRUE; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private function existe_usuario()\n\t{\n\t\t$data = $this->request->getRawInput();\n\t\t$ruc = $data['nick']; \n\t\t$usu = new Admin_model();\n\t\t$usuarioObject = $usu->where(\"nick\", $ruc) \n\t\t->first();\n\t\treturn !is_null($usuarioObject);\n\t\t \n\t}", "function Boolean_Existencia_Usuario($username,$emai...
[ "0.73709846", "0.68137", "0.6810606", "0.6797553", "0.6796816", "0.6757448", "0.67523235", "0.67438734", "0.6654201", "0.6482175", "0.64433396", "0.6441933", "0.64321893", "0.64256275", "0.64206606", "0.64146906", "0.6413275", "0.6392416", "0.6362193", "0.6360377", "0.6345079...
0.0
-1
the test pages key in on FALSE, so don't rename to assertFalse
public function assertNotTrue($bool, $label = "") { if (!$bool) { $this->currResults[$this->count] = $this->tag."assertNotTrue $label TRUE"; } else { $this->currResults[$this->count] = $this->tag."assertNotTrue $label FALSE"; } $this->count++; $this->tag = ""; return !$bool; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function testRestrictPage()\n {\n $this->assertTrue(true);\n }", "public function isTeste() {\n return false;\n }", "public function testGuestNotAccessSettingsPage()\n\t{\n\t\t$this->open('setting');\n\t\t$this->assertTextNotPresent('Settings');\n\t}", "public function testTroub...
[ "0.6641856", "0.66418374", "0.6360166", "0.63117653", "0.626287", "0.6097981", "0.60663253", "0.6059799", "0.6058551", "0.60422266", "0.600909", "0.5994836", "0.59617776", "0.59524614", "0.5933293", "0.59285605", "0.5918608", "0.5885063", "0.5878168", "0.5877327", "0.58423734...
0.0
-1
/ EXPORT DATA CUSTOMER TO EXCEL export_data
public function actionExport(){ //$custDataMTI=Yii::$app->db_esm->createCommand("CALL ERP_MASTER_CUSTOMER_export('CUSTOMER_MTI')")->queryAll(); /* 22=NKA*/ $cusDataProviderNKA= new ArrayDataProvider([ 'key' => 'ID', 'allModels'=>Yii::$app->db_esm->createCommand(" SELECT CUST_KD,CUST_NM,(SELECT CUST_KTG_NM FROM c0001k WHERE CUST_KTG=CUST_TYPE limit 1) AS TYPE_NM, ALAMAT,TLP1,PIC FROM c0001 WHERE CUST_KTG='1' AND CUST_TYPE='22' #AND CUST_KD<>CUST_GRP ORDER BY CUST_GRP ASC ")->queryAll(), ]); $aryCusDataProviderNKA=$cusDataProviderNKA->allModels; /*15=MTI*/ $cusDataProviderMTI= new ArrayDataProvider([ 'key' => 'ID', 'allModels'=>Yii::$app->db_esm->createCommand(" SELECT CUST_KD,CUST_NM,(SELECT CUST_KTG_NM FROM c0001k WHERE CUST_KTG=CUST_TYPE limit 1) AS TYPE_NM, ALAMAT,TLP1,PIC FROM c0001 WHERE CUST_KTG='1' AND CUST_TYPE='15' #AND CUST_KD<>CUST_GRP ORDER BY CUST_GRP ASC ")->queryAll(), ]); $aryCusDataProviderMTI=$cusDataProviderMTI->allModels; /*OTHERS*/ $cusDataProvideOTHER= new ArrayDataProvider([ 'key' => 'ID', 'allModels'=>Yii::$app->db_esm->createCommand(" SELECT CUST_KD,CUST_NM,(SELECT CUST_KTG_NM FROM c0001k WHERE CUST_KTG=CUST_TYPE limit 1) AS TYPE_NM, ALAMAT,TLP1,PIC FROM c0001 WHERE CUST_KTG='1' AND CUST_TYPE<>'15' AND CUST_TYPE<>22 ORDER BY CUST_GRP ASC ")->queryAll(), ]); $aryCusDataProviderOTHER=$cusDataProvideOTHER->allModels; /*SOURCE NKA*/ $excel_dataNKA = Export2ExcelBehavior::excelDataFormat($aryCusDataProviderNKA); //$excel_title = $excel_dataNKA['excel_title']; $excel_ceilsNKA = $excel_dataNKA['excel_ceils']; /*SOURCE MTI*/ $excel_dataMTI = Export2ExcelBehavior::excelDataFormat($aryCusDataProviderMTI); $excel_ceilsMTI = $excel_dataMTI['excel_ceils']; /*SOURCE OTHERS*/ $excel_dataOTHER= Export2ExcelBehavior::excelDataFormat($aryCusDataProviderOTHER); $excel_ceilsOTHER = $excel_dataOTHER['excel_ceils']; $excel_content = [ [ 'sheet_name' => 'NKA CUSTOMER', 'sheet_title' => ['CUST_ID','CUST_NM','TYPE','ALAMAT','TLP','PIC'], //$excel_ceils,//'sad',//[$excel_title], 'ceils' => $excel_ceilsNKA, //'freezePane' => 'E2', 'headerColor' => Export2ExcelBehavior::getCssClass("header"), 'headerColumnCssClass' => [ 'CUST_KD' => Export2ExcelBehavior::getCssClass('header'), 'CUST_NM' => Export2ExcelBehavior::getCssClass('header'), 'TYPE_NM' => Export2ExcelBehavior::getCssClass('header'), 'ALAMAT' => Export2ExcelBehavior::getCssClass('header'), 'TLP1' => Export2ExcelBehavior::getCssClass('header'), 'PIC' => Export2ExcelBehavior::getCssClass('header') ], //define each column's cssClass for header line only. You can set as blank. 'oddCssClass' => Export2ExcelBehavior::getCssClass("odd"), 'evenCssClass' => Export2ExcelBehavior::getCssClass("even"), ], [ 'sheet_name' => 'MTI CUSTOMER', 'sheet_title' => ['CUST_ID','CUST_NM','TYPE','ALAMAT','TLP','PIC'], //$excel_ceils,//'sad',//[$excel_title], 'ceils' => $excel_ceilsMTI, //'freezePane' => 'E2', 'headerColor' => Export2ExcelBehavior::getCssClass("header"), 'headerColumnCssClass' => [ 'CUST_KD' => Export2ExcelBehavior::getCssClass('header'), 'CUST_NM' => Export2ExcelBehavior::getCssClass('header'), 'TYPE_NM' => Export2ExcelBehavior::getCssClass('header'), 'ALAMAT' => Export2ExcelBehavior::getCssClass('header'), 'TLP1' => Export2ExcelBehavior::getCssClass('header'), 'PIC' => Export2ExcelBehavior::getCssClass('header') ], //define each column's cssClass for header line only. You can set as blank. 'oddCssClass' => Export2ExcelBehavior::getCssClass("odd"), 'evenCssClass' => Export2ExcelBehavior::getCssClass("even"), ], [ 'sheet_name' => 'OTHERS', 'sheet_title' => ['CUST_ID','CUST_NM','TYPE','ALAMAT','TLP','PIC'], //$excel_ceils,//'sad',//[$excel_title], 'ceils' => $excel_ceilsOTHER, //'freezePane' => 'E2', 'headerColor' => Export2ExcelBehavior::getCssClass("header"), 'headerColumnCssClass' => [ 'CUST_KD' => Export2ExcelBehavior::getCssClass('header'), 'CUST_NM' => Export2ExcelBehavior::getCssClass('header'), 'TYPE_NM' => Export2ExcelBehavior::getCssClass('header'), 'ALAMAT' => Export2ExcelBehavior::getCssClass('header'), 'TLP1' => Export2ExcelBehavior::getCssClass('header'), 'PIC' => Export2ExcelBehavior::getCssClass('header') ], //define each column's cssClass for header line only. You can set as blank. 'oddCssClass' => Export2ExcelBehavior::getCssClass("odd"), 'evenCssClass' => Export2ExcelBehavior::getCssClass("even"), ], ]; $excel_file = "PostmanCustomer"; $this->export2excel($excel_content, $excel_file); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function export()\n {\n return Excel::download(new CustomerFormExport, 'customers.xlsx');\n }", "public function customerExcelExport()\n\t{\n\t\t$status = $this->uri->segment(4);\n\t\t$sortArr = array('field' => 'id', 'type' => 'desc');\n\t\t$condition = array();\n\t\t$rep_code = ltrim($this-...
[ "0.7273157", "0.71103466", "0.68950903", "0.6861178", "0.6842097", "0.68392146", "0.67696273", "0.676585", "0.6759252", "0.6742916", "0.67324704", "0.6712874", "0.6661427", "0.6622592", "0.66106033", "0.66018516", "0.6594915", "0.6557342", "0.6557279", "0.6537715", "0.6515369...
0.60140264
98
Upload image to folder "upload/image"
public function upload($image = '', $name = '') { $config['upload_path'] = './' . $this->upload_dir; $config['allowed_types'] = 'jpg|jpeg|png|gif'; $config['file_name'] = $name; $config['overwrite'] = $name == '' ? FALSE : TRUE; $this->CI->upload->initialize($config); if(!$this->CI->upload->do_upload($image)) { exit($this->CI->upload->display_errors()); } else { return array( 'status' => TRUE, 'data' => $this->CI->upload->data() ); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function uploadImage() \n {\n if (is_null($this->image)) {\n return;\n }\n \n // move image from temp directory to destination one\n $this->image->move(\n $this->getUploadRootDir(),\n $this->image->getClientOriginalName()\n );\n\n...
[ "0.75014377", "0.7426471", "0.73365986", "0.72539794", "0.7206848", "0.7186193", "0.7074563", "0.7059047", "0.70299363", "0.7007299", "0.7007299", "0.6988962", "0.6988962", "0.6988962", "0.6988962", "0.6988962", "0.6988962", "0.69413173", "0.6932226", "0.6901961", "0.6900001"...
0.0
-1
Funtion to get the orientation and size (width & height) of source and target image
private function _calculate_size($source = array(), $target = array()) { $return = $target; switch($target['orientation']) { case 'portrait' : if($source['orientation'] == 'portrait') { if($source['height'] > $target['height']) { $test_width = $source['width'] / ($source['height'] / $target['height']); } else { $test_width = $source['width'] * ($target['height'] / $source['height']); } if($test_width >= $target['width']) { $return['height'] = $target['height']; $return['width'] = ''; } else { $return['width'] = $target['width']; $return['height'] = ''; } } else { $return['height'] = $target['height']; $return['width'] = ''; } break; case 'landscape' : if($source['orientation'] == 'landscape') { if($source['width'] > $target['width']) { $test_height = $source['height'] / ($source['width'] / $target['width']); } else { $test_height = $source['height'] * ($target['width'] / $source['width']); } if($test_height >= $target['height']) { $return['width'] = $target['width']; $return['height'] = ''; } else { $return['height'] = $target['height']; $return['width'] = ''; } } else { $return['width'] = $target['width']; $return['height'] = ''; } break; case 'box' : if($source['orientation'] == 'portrait') { $return['width'] = $target['width']; $return['height'] = ''; } elseif($source['orientation'] == 'landscape') { $return['height'] = $target['height']; $return['width'] = ''; } break; } return $return; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function wp_image_matches_ratio($source_width, $source_height, $target_width, $target_height)\n {\n }", "function get_intermediate_image_sizes()\n {\n }", "public function _get_img_info()\n {\n if ( ! file_exists($this->source_file) || ! filesize($this->source_file)) {\n return...
[ "0.65955704", "0.6293387", "0.62654376", "0.60870034", "0.60772336", "0.60467917", "0.6022207", "0.59446186", "0.5915781", "0.5891282", "0.58888495", "0.5829087", "0.5817982", "0.580959", "0.5809302", "0.57964665", "0.5788052", "0.5767061", "0.5764752", "0.5748477", "0.573905...
0.72320074
0
Function to resize uploaded image
public function resize($source = array(), $new_name = '', $config = array()) { $source_width = $source['image_width']; $source_height = $source['image_height']; $width = $config['width']; $height = $config['height']; $max = FALSE; if(array_key_exists('max', $config)) $max = $config['max']; $mark = ''; if(array_key_exists('mark', $config)) $mark = $config['mark']; $create_new = FALSE; if(array_key_exists('create_new', $config)) $create_new = $config['create_new']; if($create_new && $mark == '') $mark = 'resized-'; $orientation = 'box'; if($height > $width) { $orientation = 'portrait'; } elseif($height < $width) { $orientation = 'landscape'; } $source_orientation = 'box'; if($source_height > $source_width) { $source_orientation = 'portrait'; } elseif($source_height < $source_width) { $source_orientation = 'landscape'; } if($max) { $size = array( 'width' => $width, 'height' => $height ); } else { $size = $this->_calculate_size(array( 'orientation' => $source_orientation, 'width' => $source_width, 'height' => $source_height ), array( 'orientation' => $orientation, 'width' => $width, 'height' => $height )); } $thumb['image_library'] = 'gd2'; $thumb['source_image'] = $source['full_path']; $thumb['width'] = $size['width']; $thumb['height'] = $size['height']; $thumb['maintain_ratio'] = TRUE; $thumb['quality'] = 100; if($create_new) { $thumb['new_image'] = './' . $this->upload_dir . $mark . $new_name . $source['file_ext']; } $this->CI->image_lib->initialize($thumb); if($this->CI->image_lib->resize()) { return array( 'status' => TRUE ); } else { exit($this->image_lib->display_errors()); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private function resize() {\n\t\tswitch($this->type) {\n\t\t\tcase 'image/jpeg':\n\t\t\t\t$originalImage = imagecreatefromjpeg($this->tempName);\n\t\t\tbreak;\n\t\t\tcase 'image/png':\n\t\t\t\t$originalImage = imagecreatefrompng($this->tempName);\n\t\t\tbreak;\n\t\t\tcase 'image/gif':\n\t\t\t\t$originalImage = ima...
[ "0.76179403", "0.73459333", "0.73206663", "0.7294077", "0.7253657", "0.72468084", "0.7239712", "0.71652424", "0.71518344", "0.7131445", "0.7058114", "0.70504713", "0.702063", "0.70206153", "0.69948167", "0.698871", "0.6972791", "0.69624656", "0.6939342", "0.6890605", "0.68740...
0.0
-1
Crop image center of it's
public function crop($source = array(), $new_name, $config = array()) { $source_width = $source['image_width']; $source_height = $source['image_height']; $width = $config['width']; $height = $config['height']; $mark = ''; if(array_key_exists('mark', $config)) $mark = $config['mark']; $create_new = FALSE; if(array_key_exists('create_new', $config)) $create_new = $config['create_new']; if($create_new && $mark == '') $mark = 'cropped-'; $orientation = 'box'; if($height > $width) { $orientation = 'portrait'; } elseif($height < $width) { $orientation = 'landscape'; } $source_orientation = 'box'; if($source_height > $source_width) { $source_orientation = 'portrait'; } elseif($source_height < $source_width) { $source_orientation = 'landscape'; } $size = $this->_calculate_size(array( 'orientation' => $source_orientation, 'width' => $source_width, 'height' => $source_height ), array( 'orientation' => $orientation, 'width' => $width, 'height' => $height )); $thumb['image_library'] = 'gd2'; $thumb['source_image'] = $source['full_path']; $thumb['width'] = $size['width']; $thumb['height'] = $size['height']; $thumb['maintain_ratio'] = TRUE; $thumb['quality'] = 100; if($create_new) { $thumb['new_image'] = './' . $this->upload_dir . $mark . $new_name; } $this->CI->image_lib->initialize($thumb); if($this->CI->image_lib->resize()) { $this->CI->image_lib->clear(); if($create_new) { $thumb['source_image'] = $source['file_path'] . $mark . $new_name; } else { $thumb['source_image'] = $source['file_path'] . $new_name; } $thumb['width'] = $width; $thumb['height'] = $height; $thumb['maintain_ratio'] = FALSE; $thumb['quality'] = 100; $thumb['new_image'] = ''; if($create_new) { list($thumb_width, $thumb_height) = getimagesize($source['file_path'] . $mark . $new_name); } else { list($thumb_width, $thumb_height) = getimagesize($source['file_path'] . $new_name); } if($thumb_height == $height) { $thumb['x_axis'] = ($thumb_width - $width) / 2; $thumb['y_axis'] = 0; } else { $thumb['y_axis'] = ($thumb_height - $height) / 2; $thumb['x_axis'] = 0; } $this->CI->image_lib->initialize($thumb); if($this->CI->image_lib->crop()) { return array( 'status' => TRUE ); } else { exit($this->image_lib->display_errors()); } } else { exit($this->image_lib->display_errors()); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function image_crop()\n\t{\n\t\t$protocol = 'image_process_'.$this->resize_protocol;\n\t\t\n\t\tif (substr($protocol, -3) == 'gd2')\n\t\t{\n\t\t\t$protocol = 'image_process_gd';\n\t\t}\n\t\t\n\t\treturn $this->$protocol('crop');\n\t}", "public function crop()\n\t{\n\t\t$protocol = ($this->image_library === 'gd2'...
[ "0.69298387", "0.6836823", "0.6823078", "0.66575724", "0.6652952", "0.66306645", "0.6507793", "0.6440605", "0.639549", "0.6372605", "0.63682693", "0.6302628", "0.6299234", "0.6244354", "0.623321", "0.6232006", "0.62100184", "0.6194608", "0.6143459", "0.61158496", "0.6101551",...
0.0
-1
Function to get image(s) in folder "upload/image"
public function get($name = '', $mark = '', $wildcard = FALSE) { $img = array(); $wildcard_character = $wildcard ? '*.*' : ''; $search = ''; $search = ($mark != '') ? $search . $mark : '' ; $search = ($name == '') ? $search . $wildcard_character : $search . $name . $wildcard_character ; foreach(glob($this->upload_dir . $search) as $filename){ $img[] = $filename; } return $img; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function get_all_image_uploaded(){\n if($this->username && $this->id){\n if(file_exists($this->image_path . DS . $this->username)){\n $images = scandir($this->image_path . DS . $this->username);\n if(!empty($images)){\n $images = array_diff(...
[ "0.73892516", "0.72510624", "0.7110068", "0.6849811", "0.68296015", "0.67516506", "0.6742462", "0.6713042", "0.66894954", "0.664664", "0.66405356", "0.66364115", "0.66085684", "0.65916353", "0.65871584", "0.6571846", "0.64799213", "0.6452745", "0.6440676", "0.6440374", "0.642...
0.0
-1
Function to convert base64 image source to actual image (saved in folder "upload/image/") from textarea
public function convert_inline($str = '', $new_name = '', $mark = 'inline-') { $img = array(); $start = '<img'; $end = '>'; $pattern = sprintf('/%s(.+?)%s/ims', preg_quote($start, '/'), preg_quote($end, '/')); $search = true; $i = 1; while($search) { if (preg_match($pattern, $str, $matches)) { list(, $match) = $matches; $img[$i] = $start . $match . $end; $str = str_replace($start . $match . $end, "{gambar_$i}", $str); $i++; } else { $search = false; break; } } $start = 'src="data:image/'; $end = '"'; $pattern = sprintf('/%s(.+?)%s/ims', preg_quote($start, '/'), preg_quote($end, '/')); $img_to_check = array(); foreach ($img as $key=>$val) { if (preg_match($pattern, $val, $matches)) { list(, $match) = $matches; $img[$key] = str_replace($start . $match . $end, '{new_src}', $img[$key]); $ex_match = explode(',', $match); $base64_image = trim($ex_match[1]); $ex_type = explode(';', $ex_match[0]); $type = $ex_type[0]; $image = base64_decode($base64_image); $image_name = $mark . $new_name . '-img-' . $key . '.' . $type; file_put_contents($this->upload_dir . $image_name, $image); $new_source = base_url($this->upload_dir . $image_name); $img[$key] = str_replace('{new_src}', 'src="' . $new_source . '"', $img[$key]); } else { if(strpos($val, base_url($this->upload_dir)) !== FALSE) { $ex_val = explode(base_url(), $val); $to_check = substr($ex_val[1], 0, strpos($ex_val[1], '"')); $img_nm = str_replace($this->upload_dir, '', $to_check); $img_nm_2 = substr($img_nm, 0, strpos($img_nm, '-img')); if(!in_array($img_nm_2, $img_to_check)) $img_to_check[] = $img_nm_2; } } $str = str_replace("{gambar_$key}", $img[$key], $str); } foreach ($img_to_check as $k => $v) { $old_images = $this->get($v, '', TRUE); foreach($old_images as $k2 => $v2) { $found = FALSE; $file = base_url($v2); foreach($img as $k3 => $v3) { if(strpos($v3, $file) !== FALSE) { $found = TRUE; } } if(!$found) { unlink($v2); } } } return $str; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function base64_to_jpeg($base64_string, $output_file) {\r\n $ifp = fopen( $output_file, 'wb' ); \r\n\r\n // split the string on commas\r\n // $data[ 0 ] == \"data:image/png;base64\"\r\n // $data[ 1 ] == <actual base64 string>\r\n $data = explode( ',', $base64_string );\r\n\r\n // we could add val...
[ "0.66056406", "0.6549904", "0.6549904", "0.6549904", "0.65218616", "0.6515471", "0.6508633", "0.64702266", "0.64379996", "0.64375913", "0.6426032", "0.63914585", "0.63342065", "0.6328248", "0.6311814", "0.6283171", "0.62531686", "0.62498945", "0.61767113", "0.61458457", "0.61...
0.0
-1
Function to delete image(s) in folder "upload/image/" from string (textarea)
public function delete_inline($str = '') { $img = array(); $start = '<img'; $end = '>'; $pattern = sprintf('/%s(.+?)%s/ims', preg_quote($start, '/'), preg_quote($end, '/')); $search = true; $i = 1; while($search) { if (preg_match($pattern, $str, $matches)) { list(, $match) = $matches; $img[$i] = $start . $match . $end; $str = str_replace($start . $match . $end, "{gambar_$i}", $str); $i++; } else { $search = false; break; } } $img_to_check = array(); foreach ($img as $key=>$val) { if(strpos($val, base_url($this->upload_dir)) !== FALSE) { $ex_val = explode(base_url(), $val); $to_check = substr($ex_val[1], 0, strpos($ex_val[1], '"')); $img_nm = str_replace($this->upload_dir, '', $to_check); $img_nm_2 = substr($img_nm, 0, strpos($img_nm, '-img')); if(!in_array($img_nm_2, $img_to_check)) $img_to_check[] = $img_nm_2; } } foreach ($img_to_check as $k => $v) { $old_images = $this->get($v, '', TRUE); foreach($old_images as $k2 => $v2) { unlink($v2); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function deleteTextSectionBoxImg(){\n\t\tif(count($_POST)>0){\t\t\t\n\t\t\t\t\t\t\n\t\t\t$location_id = $_POST['location_id'];\n\t\t\t$this->db->where(\"location_id\", $location_id);\n\t\t\t\n\t\t\tif($this->db->query(\"update tbl_school_text_sections set left_photo='' where location_id=\".$location_id.\"\"...
[ "0.71468705", "0.6568241", "0.6530515", "0.6522266", "0.64925385", "0.6433204", "0.6336417", "0.6304616", "0.6269292", "0.6255756", "0.62461334", "0.6218025", "0.6205243", "0.62029546", "0.6140321", "0.6121915", "0.6113719", "0.6076112", "0.606387", "0.60293925", "0.59917665"...
0.66651547
1
Function to copy image
public function copy($source, $target) { if(!copy($source, $target)) { return FALSE; } else { return TRUE; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function copyImages();", "public function copy_image($image_id=null, $foreign_key=null) {\n\t // test function\n\t $this->Image->image_clone($image_id, $foreign_key);\n\t exit;\n }", "function _copy_image_file($attachment_id)\n {\n }", "function createCopy( $I )\n{\n\t// get width and height\n\t...
[ "0.86789256", "0.6987816", "0.68263185", "0.6821014", "0.67134887", "0.6627083", "0.6581096", "0.65409523", "0.6374775", "0.6354191", "0.6333342", "0.6292245", "0.62898445", "0.6280418", "0.6250946", "0.6244684", "0.62239826", "0.62184274", "0.62168634", "0.61389434", "0.6045...
0.0
-1
our list of mime types
static function get_mime_type($file) { $mime_types = array( "pdf" => "application/pdf" , "exe" => "application/octet-stream" , "zip" => "application/zip" // ,"docx"=>"application/msword" , "docx" => "application/vnd.openxmlformats-officedocument.wordprocessingml.document" , "doc" => "application/msword" , "rtf" => "text/rtf" , "txt" => "text/plain" , "xls" => "application/vnd.ms-excel" , "ppt" => "application/vnd.ms-powerpoint" , "pptx" => "application/vnd.openxmlformats-officedocument.presentationml.presentation" , "gif" => "image/gif" , "png" => "image/png" , "jpeg" => "image/jpg" , "jpg" => "image/jpg" , "mp3" => "audio/mpeg" , "wav" => "audio/x-wav" , "mpeg" => "video/mpeg" , "mpg" => "video/mpeg" , "mpe" => "video/mpeg" , "mov" => "video/quicktime" , "avi" => "video/x-msvideo" , "3gp" => "video/3gpp" , "css" => "text/css" , "jsc" => "application/javascript" , "js" => "application/javascript" , "php" => "text/html" , "htm" => "text/html" , "html" => "text/html" , "xlsx" => "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" , "xltx" => "application/vnd.openxmlformats-officedocument.spreadsheetml.template" , "potx" => "application/vnd.openxmlformats-officedocument.presentationml.template" , "ppsx" => "application/vnd.openxmlformats-officedocument.presentationml.slideshow" , "pptx" => "application/vnd.openxmlformats-officedocument.presentationml.presentation" , "sldx" => "application/vnd.openxmlformats-officedocument.presentationml.slide" , "docx" => "application/vnd.openxmlformats-officedocument.wordprocessingml.document" , "dotx" => "application/vnd.openxmlformats-officedocument.wordprocessingml.template" , "xlam" => "application/vnd.ms-excel.addin.macroEnabled.12" , "xlsb" => "application/vnd.ms-excel.sheet.binary.macroEnabled.12" ); $extention = explode('.', $file); $extension = end($extention); $extension = strtolower($extension); return $mime_types[$extension]; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static function getAllMimeTypes():array;", "public function provider_mime_type() {\n\t\treturn array(\n\t\t\tarray( 'not-found.txt', false ),\n\t\t\tarray( 'empty.txt', version_compare( PHP_VERSION, '7.4', '>=' ) ? 'application/x-empty' : 'inode/x-empty' ),\n\t\t\tarray( 'file.aac', 'audio/aac' ),\n\t\t\t...
[ "0.84841037", "0.8219087", "0.81329864", "0.8121718", "0.8051271", "0.80279964", "0.8012918", "0.7993711", "0.7973081", "0.79279345", "0.78502285", "0.7840629", "0.7797382", "0.77961123", "0.77957976", "0.7763951", "0.76712495", "0.76610696", "0.7629549", "0.76218915", "0.757...
0.0
-1
Lap de sap xep
function sapXep($arr){ for ($i = 0; $i < count($arr) - 1; $i ++){ // Tim vi tri min $min = $i; for ($j = $i +1; $j < count($arr); $j ++){ if ($arr[$j] < $arr[$min]){ $min = $j; } } //sau khi co vi tri nho nhat thi doi vi tri voi $i $temp = $arr[$i]; $arr[$i] = $arr[$min]; $arr[$min] = $temp; } return $arr; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function xlate($ie, $oe) {}", "function sigaloneval($origerr,$numplaces){\n\n\t\t$x=round($origerr*(pow(10,(($numplaces-1)-floor(log10($origerr)))))) * pow(10,(floor(log10($origerr)))-($numplaces-1));\n\t\n\t\treturn($x);\n\n\t}", "abstract function fromexp();", "public function elso()\n {\n }",...
[ "0.5573334", "0.51431936", "0.5116433", "0.50235045", "0.50072986", "0.49689907", "0.4965571", "0.4951736", "0.49300718", "0.4929089", "0.4915702", "0.488355", "0.48551887", "0.4835545", "0.4817069", "0.48159826", "0.47848994", "0.47732717", "0.47726303", "0.47489056", "0.474...
0.49490154
8
$this>executeSql('SET foreign_key_checks = 0');
public function disableForeignKeyChecks($table) { }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static function reset_foreignKeyChecks() {\r\n global $db;\r\n \r\n $query = \"SET FOREIGN_KEY_CHECKS=1\";\r\n\r\n $statement = $db->prepare($query);\r\n \r\n if ($statement == FALSE) {\r\n display_db_error($db->error);\r\n }\r\n \r\n $succe...
[ "0.80160594", "0.7893242", "0.7484943", "0.74503255", "0.7053146", "0.69078195", "0.6838983", "0.68052393", "0.67678577", "0.6501624", "0.6485554", "0.64761555", "0.63847595", "0.6377485", "0.6322503", "0.6299462", "0.62988484", "0.6266875", "0.62115693", "0.61777693", "0.612...
0.59403026
29
Close file db connection
private function closeConnection(){ $this->file_db = null; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function close()\n {\n $this->db = null;\n }", "function closeDbConnection() {\n global $objDb;\n\n if (isset($objDb)) {\n @$objDb->Close();\n }\n }", "public function close(){\r\n\t\tself::$dbh = null;\r\n\t\tself::$db = null;\r\n\t}", "private function...
[ "0.74138427", "0.7256991", "0.7221398", "0.7221372", "0.71733254", "0.7165144", "0.7143436", "0.7102166", "0.7099516", "0.7094162", "0.7094162", "0.7090901", "0.70108014", "0.69957393", "0.6973319", "0.6968854", "0.6959267", "0.6924283", "0.6920764", "0.6920764", "0.6912208",...
0.84680706
0
Display a listing of the resource.
public function index(Product $product) { $prod_var = Productvariant::with('product', 'productmirrors')->where('product_id', $product->id)->get(); $data = compact('product', 'prod_var'); return view('backend.inc.products.indexproductvariant', $data); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function indexAction()\n {\n $limit = $this->Request()->getParam('limit', 1000);\n $offset = $this->Request()->getParam('start', 0);\n $sort = $this->Request()->getParam('sort', array());\n $filter = $this->Request()->getParam('filter', array());\n\n $result = $this->re...
[ "0.7446777", "0.736227", "0.73005503", "0.72478926", "0.71631265", "0.71489686", "0.7131636", "0.7105969", "0.71029514", "0.7101372", "0.70508176", "0.6995128", "0.69890636", "0.6934895", "0.6900203", "0.6899281", "0.6891734", "0.6887235", "0.68670005", "0.6849741", "0.683052...
0.0
-1
Show the form for creating a new resource.
public function create(Product $product) { $categories = Category::all(); $lenses = Lense::all(); $mirrors = Mirror::all(); $data = compact('categories', 'product', 'lenses', 'mirrors'); return view('backend.inc.products.productvariant', $data); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function create()\n {\n return $this->showForm('create');\n }", "public function create()\n {\n return $this->showForm('create');\n }", "public function create()\n {\n return view('admin.resources.create');\n }", "public function create(){\n\n return view(...
[ "0.75948673", "0.75948673", "0.75863165", "0.7577412", "0.75727344", "0.7500887", "0.7434847", "0.7433956", "0.73892003", "0.73531085", "0.73364776", "0.73125", "0.7296102", "0.7281891", "0.72741455", "0.72424185", "0.7229325", "0.7226713", "0.7187349", "0.7179176", "0.717428...
0.0
-1
Store a newly created resource in storage.
public function store(Product $product, Request $request) { $this->validate($request, [ 'lense_id' => 'required', 'addmore.*.mirror_id' => 'required', 'addmore.*.price' => 'required' ]); $prod_var = Productvariant::create([ 'product_id' => $product->id, 'lense_id' => $request->lense_id, ]); foreach ($request->addmore as $key => $value) { Productmirrors::create([ 'prod_var' => $prod_var->id, 'mirror_id' => $value['mirror_id'], 'price' => $value['price'] ]); } return redirect(route('admin.productvariant.index', $product->id)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function store($data, Resource $resource);", "public function store()\n {\n /* Check if logged in user is authorized to make this request */\n $this->authorizeAction();\n\n if (method_exists($this, 'storeValidations')) {\n $this->request->validate($this->storeValidations...
[ "0.72865677", "0.7145327", "0.71325725", "0.6640912", "0.66209733", "0.65685713", "0.652643", "0.65095705", "0.64490104", "0.637569", "0.63736665", "0.63657933", "0.63657933", "0.63657933", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.63424...
0.0
-1
Display the specified resource.
public function show(Productvariant $id) { // }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function show(Resource $resource)\n {\n // not available for now\n }", "public function show(Resource $resource)\n {\n //\n }", "function Display($resource_name, $cache_id = null, $compile_id = null)\n {\n $this->_smarty->display($resource_name, $cache_id, $compile_id...
[ "0.8233718", "0.8190437", "0.6828712", "0.64986944", "0.6495974", "0.6469629", "0.6462615", "0.6363665", "0.6311607", "0.62817234", "0.6218966", "0.6189695", "0.61804265", "0.6171014", "0.61371076", "0.61207956", "0.61067593", "0.6105954", "0.6094066", "0.6082806", "0.6045245...
0.0
-1
Show the form for editing the specified resource.
public function edit(Product $product, $id) { $categories = Category::all(); $prod_var = Productvariant::find($id); $prod_mirror = Productmirrors::where('prod_var', $prod_var->id)->get(); $lenses = Lense::all(); $mirrors = Mirror::all(); $data = compact('categories', 'product', 'lenses', 'mirrors', 'prod_var', 'prod_mirror'); return view('backend.inc.products.productvariant', $data); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function edit(Resource $resource)\n {\n return view('admin.resources.edit', compact('resource'));\n }", "public function edit(Resource $resource)\n {\n //\n }", "public function edit($id)\n {\n /* Check if logged in user is authorized to make this request */\n ...
[ "0.78550774", "0.7692893", "0.7273195", "0.7242132", "0.7170847", "0.70622855", "0.7053459", "0.6982539", "0.69467914", "0.6945275", "0.6941114", "0.6928077", "0.69019294", "0.68976134", "0.68976134", "0.6877213", "0.68636996", "0.68592185", "0.68566656", "0.6844697", "0.6833...
0.0
-1
Update the specified resource in storage.
public function update(Request $request, Product $product, $id) { $prod_var = Productvariant::find($id); $prod_mirror = Productmirrors::where('prod_var', $prod_var->id)->get(); $prod_var->fill([ 'product_id' => $product->id, 'lense_id' => $request->lense_id, ]); $prod_mirror->fill([ 'prod_var' => $prod_var->id, 'mirror_id' => $request->mirror_id, 'price' => $request->price ]); $prod_var->save(); $prod_mirror->save(); return redirect(route('admin.productvariant.index', $product->id)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function updateShopifyResource() {\n $this->saving();\n $this->getShopifyApi()->call([\n 'URL' => API::PREFIX . $this->getApiPathSingleResource(),\n 'METHOD' => 'PUT',\n 'DATA' => [\n static::getResourceSingularName() => $this->shopifyData\n ...
[ "0.7425105", "0.70612276", "0.70558053", "0.6896673", "0.6582159", "0.64491373", "0.6346954", "0.62114537", "0.6145042", "0.6119944", "0.61128503", "0.6099993", "0.6087866", "0.6052593", "0.6018941", "0.60060275", "0.59715486", "0.5946516", "0.59400934", "0.59377414", "0.5890...
0.0
-1
Remove the specified resource from storage.
public function destroy(Product $product, $id) { $var_id = Productvariant::find($id); $var_id->delete(); return redirect(route('admin.productvariant.index', $product->id)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function delete($resource){\n return $this->fetch($resource, self::DELETE);\n }", "public function destroy(Resource $resource)\n {\n //\n }", "public function removeResource($resourceID)\n\t\t{\n\t\t}", "public function unpublishResource(PersistentResource $resource)\n {\n ...
[ "0.6672584", "0.6659381", "0.6635911", "0.6632799", "0.6626075", "0.65424126", "0.65416265", "0.64648265", "0.62882507", "0.6175931", "0.6129922", "0.60893893", "0.6054415", "0.60428125", "0.60064924", "0.59337646", "0.5930772", "0.59199584", "0.5919811", "0.5904504", "0.5897...
0.0
-1
Hexa to RGBA Convector
private function mombo_hex_2_rgba($color, $opacity = false) { $default = 'rgb(0,0,0)'; //Return default if no color provided if(empty($color)) return $default; //Sanitize $color if "#" is provided if ($color[0] == '#' ) { $color = substr( $color, 1 ); } //Check if color has 6 or 3 characters and get values if (strlen($color) == 6) { $hex = array( $color[0] . $color[1], $color[2] . $color[3], $color[4] . $color[5] ); } elseif ( strlen( $color ) == 3 ) { $hex = array( $color[0] . $color[0], $color[1] . $color[1], $color[2] . $color[2] ); } else { return $default; } //Convert hexadec to rgb $rgb = array_map('hexdec', $hex); //Check if opacity is set(rgba or rgb) if($opacity){ if(abs($opacity) > 1) $opacity = 1.0; $output = 'rgba('.implode(",",$rgb).','.$opacity.')'; } else { $output = 'rgb('.implode(",",$rgb).')'; } //Return rgb(a) color string return $output; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function hex2rgb($hex){\r\n //$hex = strtoupper($str_enc_hex);\r\n //echo $hex;\r\n $hex = str_replace('#', '', $hex);\r\n $red=-1;\r\n $green=-1;\r\n $blue=-1;\r\n if(strlen($hex)==3){\r\n $red=hexdec($hex[0].$hex[0]);\r\n $green=hexdec($hex[1].$hex[1]);\r\n $blue=hexdec($hex[2].$hex[...
[ "0.66850686", "0.65061605", "0.63369465", "0.63369465", "0.63305384", "0.6323536", "0.63030005", "0.6285287", "0.6281137", "0.62720853", "0.6258914", "0.62466025", "0.6218696", "0.6212062", "0.62082523", "0.61886936", "0.6145379", "0.6144343", "0.6068081", "0.6023239", "0.600...
0.56277114
54
end mombo_color function Title Color
public function mombo_main_headings_color() { }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function color()\n {\n }", "function header_textcolor()\n {\n }", "public function colour();", "public static function title_style() {\n\t\techo self::get_title_style();\n\t}", "function wpvideocoach_get_introduction_title_color()\r\n{\r\n\tglobal $wpvideocoach_introduction_title_color;...
[ "0.7096249", "0.70107734", "0.6979684", "0.66814655", "0.6673122", "0.65584165", "0.65584165", "0.65584165", "0.65584165", "0.6505964", "0.6499117", "0.6499117", "0.64491725", "0.642134", "0.6413471", "0.6411118", "0.6364862", "0.63640344", "0.63510656", "0.61426854", "0.6141...
0.7443092
0
/ =========================================================================== = Script : EGAT eLearning = Author : S.Kongdej
function getStartDate($courseid,$parent,$lessonid) { global $config,$start; // หาวันเปิดเรียนของ $scheduleid $sql = "SELECT LessonID, Length, LessonParentID FROM $config[tablelesson]"; $sql .= " WHERE CourseID='$courseid' AND LessonParentID='$parent' ORDER BY LessonParentID,Ordering"; $result=db_select($sql); for($i=0;list($id,$length,$parent) = mysql_fetch_row($result);$i++) { if ($id != $lessonid) { $start=dateAdd($start,$length+1); if (getStartDate($courseid,$id,$lessonid) == false) { break; } } else { return false; } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function gagnerExperience()\n {\n }", "public function getDescent();", "public function getDescent() {}", "public function getDescent() {}", "public function getDescent() {}", "public function getDescent() {}", "public function getDescent() {}", "public function run()\n {\n _Lo...
[ "0.5639499", "0.56358", "0.55534256", "0.55534256", "0.5551649", "0.5551649", "0.5551649", "0.5527118", "0.54495835", "0.52223825", "0.52087295", "0.52068096", "0.5183525", "0.5149822", "0.51317835", "0.5123924", "0.51058584", "0.5081229", "0.50551164", "0.50381887", "0.50264...
0.0
-1
Create a new instance and fill it from a JSON object.
public function __construct(int $statusCode, Data $data) { parent::__construct($statusCode, $data); $this->setDataReleaseId($data->dataReleaseID) ->setStations($data->stations); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function __construct($json) {\n if (is_null($json)) {\n $json = new \\stdClass();\n }\n\n $this->json = $json;\n }", "public static function from_json($json)\n\t\t{\n\t\t\t$model = get_called_class();\n\t\t\treturn new $model(\\System\\Json::decode($json));\n\t\t}", "public function __con...
[ "0.7090455", "0.7052225", "0.6754275", "0.6572496", "0.65650016", "0.65176064", "0.64424086", "0.63882995", "0.6360605", "0.63558507", "0.63549674", "0.63487065", "0.6340798", "0.62967", "0.6289467", "0.62889075", "0.6286377", "0.6283649", "0.626902", "0.62569606", "0.6229649...
0.0
-1
Get data release id.
public function getDataReleaseId(): string { return $this->dataReleaseId; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getReleaseId()\n {\n return $this->releaseId;\n }", "public function getReleaseId()\n {\n return $this->releaseId;\n }", "public function getOpenLibraryId()\n\t\t{\n\t\t\tif(is_null($this->data))\n\t\t\t\treturn null;\n\t\t\t\n\t\t\treturn $this->data['id'];\n\t\t}", ...
[ "0.7695248", "0.7695248", "0.64955163", "0.6300455", "0.62680334", "0.61314946", "0.60505235", "0.60342413", "0.6019357", "0.60134554", "0.6009943", "0.6007542", "0.59380174", "0.59291166", "0.59287125", "0.591493", "0.591493", "0.5857901", "0.5844902", "0.58355254", "0.58354...
0.8414799
0
Set data release id.
protected function setDataReleaseId(string $dataReleaseId): self { $this->dataReleaseId = $dataReleaseId; return $this; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function setRelease($value)\n {\n $this->setItemValue('release', ['id' => (int)$value]);\n }", "public function getDataReleaseId(): string\n {\n return $this->dataReleaseId;\n }", "public function setId($data)\n {\n $this->_Id=$data;\n return $this;\n }", ...
[ "0.67902726", "0.624353", "0.61390096", "0.61390096", "0.5980777", "0.59107894", "0.58449024", "0.58192074", "0.5810818", "0.58065796", "0.5798259", "0.5743553", "0.5732892", "0.5725409", "0.5722967", "0.57227546", "0.57194066", "0.5715638", "0.57135105", "0.57041436", "0.570...
0.66559243
1
Assigns the arguments to instance variables to be used by the render() method.
public function __construct(\Twig_Environment $tplEngine, $route, PostMapper $postMapper) { $this->tplEngine = $tplEngine; $this->route = $route; $this->postMapper = $postMapper; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function initializeArgumentsAndRender() {}", "public function initializeArgumentsAndRender() {}", "private function registerRenderMethodArguments() {}", "public function __construct()\n {\n $this->arguments = func_get_args();\n }", "private function setArgs(){\n\t\t$this->args = array(\...
[ "0.7951505", "0.7950352", "0.6755027", "0.63289315", "0.63146675", "0.6292237", "0.6169728", "0.6106866", "0.6105751", "0.6105751", "0.6105751", "0.6077628", "0.6051013", "0.60274774", "0.596285", "0.5952601", "0.5796338", "0.57780474", "0.5775523", "0.57522184", "0.5720121",...
0.0
-1
Contains all of the binding logic in order to render the admin.tpl file.
public function render(array $globalBindings = []) { $route = strpos($this->route, '/') !== false ? explode('/', $this->route)[0] : $this->route; if (isset($_GET['postID'])) $post = $this->postMapper->getPostByID($_GET['postID'], false); else $post = ''; $tpl = $this->tplEngine->loadTemplate("{$route}.tpl"); $bindings = [ 'loggedIn' => $_SESSION['user']['user_id'], 'pLevel' => $_SESSION['user']['pLevel'], 'post' => $post ]; return $tpl->render(array_merge($bindings, $globalBindings)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function render_admin_page () {\n\t\tif (!Upfront_Permissions::current(Upfront_Permissions::BOOT)) wp_die(\"Nope.\");\n\n\t\tif (!class_exists('Thx_Sanitize')) require_once (dirname(__FILE__) . '/class_thx_sanitize.php');\n\t\tif (!class_exists('Thx_Template')) require_once (dirname(__FILE__) . '/class_thx_...
[ "0.5953425", "0.585859", "0.5841698", "0.5824138", "0.58148354", "0.5809363", "0.5796085", "0.5781424", "0.575418", "0.57345647", "0.5716918", "0.5694845", "0.567676", "0.5615203", "0.5597088", "0.5592816", "0.55843425", "0.55826575", "0.5579435", "0.55663234", "0.5555022", ...
0.0
-1
Handle an incoming request.
public function handle($request, Closure $next) { try { $token = $request->bearerToken(); $verifyToken = $this->jwtHelperService->verifyJwtToken($token); if ($verifyToken['errors'] == true) { // handle jwt error echo json_encode($verifyToken); exit(); } // passed token validate, continue with request $tokenClaims = (array) $verifyToken['result']; $request->attributes->add(['token_claims' => $tokenClaims]); } catch (\Exception $e) { // } return $next($request); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "abstract public function handle_request();", "public function handleRequest();", "public function handleRequest();", "public function handleRequest();", "protected abstract function handleRequest();", "abstract public function handleRequest($request);", "abstract public function handleRequest(Request $...
[ "0.8299201", "0.8147294", "0.8147294", "0.8147294", "0.8127764", "0.7993589", "0.7927201", "0.7912899", "0.7899075", "0.76317674", "0.75089735", "0.7485808", "0.74074036", "0.7377414", "0.736802", "0.7294553", "0.72389543", "0.7230166", "0.72108", "0.71808434", "0.7170364", ...
0.0
-1
/ cek telat select nomor_surat_masuk, keterangan_surat_masuk, nomor_SIK, ((SLA)(DATEDIFF(tanggal_SIK,DATE_FORMAT(FROM_UNIXTIME(update_status_SIK), '%Y%m%d')))1) as pengerjaan, tanggal_sik, SLA, DATE_FORMAT(FROM_UNIXTIME(update_status_SIK), '%Y%m%d') as done from pms_lan WHERE status_SIK='Done' and ((SLA)(DATEDIFF(tanggal_SIK,DATE_FORMAT(FROM_UNIXTIME(update_status_SIK), '%Y%m%d')))1)<0 and tanggal_surat_masuk BETWEEN '20191201' AND '20191231'
public function SLA(){ $sql="select * from pms_lan WHERE status_SIK='Done' and status_by_case is null and kategori='pms_lan' and tanggal_surat_masuk BETWEEN '".date("Y-m-d" , strtotime($_POST['date1']))."' AND '".date("Y-m-d" , strtotime($_POST['date2']))."'"; return $this->db->query($sql)->result_array(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function check_peminjaman(){\n\t\t$tbl_peminjaman_inventaris = $this->db->query(\" SELECT a.kodepeminjam_user, a.kode_inventaris, \n\t\t\tCASE \n\t\t\t\tWHEN a.konfirmasi_peminjaman='0' AND a.konfirmasi_kembali='0' THEN 'Menunggu Konfirmasi'\n\t\t\t\tWHEN a.konfirmasi_peminjaman='0' AND a.konfirmasi_kembali...
[ "0.6335532", "0.6151182", "0.60268176", "0.5979784", "0.5976792", "0.5973393", "0.5884077", "0.58538026", "0.58411914", "0.58250445", "0.57868296", "0.57827914", "0.57699525", "0.575896", "0.5757371", "0.5748462", "0.5726883", "0.57199335", "0.5710533", "0.570993", "0.5704452...
0.6240229
1
Authenticates a user. The example implementation makes sure if the username and password are both 'demo'. In practical applications, this should be changed to authenticate against some persistent user identity storage (e.g. database).
public function authenticate() { $record = Employee::model()->findByAttributes(array('username' => $this->username)); // here I use Email as user name which comes from database if ($record === null) { $this->_id = 'user Null'; $this->errorCode = self::ERROR_USERNAME_INVALID; } else if (CPasswordHelper::verifyPassword($this->password, $record->password) == false) // here I compare db password with password field { $this->_id = $this->username; $this->errorCode = self::ERROR_PASSWORD_INVALID; } else if ($record['is_active'] != 1) // here I check status as Active in db { $this->errorCode = Y::t('login', 'Prisijungimas išjungtas'); } else { $this->_id = $record->usertype; $this->errorCode = self::ERROR_NONE; $this->setState('__name', $record->usertype); $this->setState('title', $record->name); $this->setState('id', $record->id); $settings = Setting::model()->findAll('employee_id=:eid', array(':eid' => $record->id)); $grid = array(); foreach($settings as $s) { $grid[$s->title] = $s->value; } $this->setState('grid', $grid); Yii::app()->user->setState('_timeZone', 'Europe/Vilnius'); //Yii::app()->localtime->Locale = 'lt_lt'; // eg 'en_gb' //Yii::app()->localtime->TimeZone = 'Europe/Vilnius'; //$user->timezone->name; //Yii::app()->localtime->dateFormat = 'long'; //$user->timezone->name; } return !$this->errorCode; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function authenticate()\n {\n $query = $this->newQuery()->select('*')->where([\n 'username' => $this->username,\n 'disabled' => 0\n ]);\n\n $userRow = $query->execute()->fetch('assoc');\n\n if (empty($userRow)) {\n return new AuthenticationResu...
[ "0.6910684", "0.6747703", "0.6731109", "0.66322005", "0.66122454", "0.65927655", "0.6576096", "0.65335304", "0.65280175", "0.6524533", "0.6501626", "0.6488619", "0.6488619", "0.64870036", "0.64792305", "0.6460366", "0.6458286", "0.64514524", "0.6441598", "0.64366984", "0.6406...
0.0
-1
1 = CSV import error
public static function addErrorRowToDatabase($data, $errorType) { // 2 = no source_fiscal // 3 = contract_value is 0 // 4 = manual error flag if (! isset($data['sourceOrigin'])) { $data['sourceOrigin'] = 1; } $defaults = [ 'uuid' => null, 'ownerAcronym' => '', 'referenceNumber' => null, 'contractValue' => 0, 'sourceYear' => null, 'sourceQuarter' => null, 'sourceFiscal' => null, 'sourceOrigin' => null, 'sourceCsvFilename' => null, ]; $data = array_merge($defaults, $data); $output = [ 'json_id' => $data['uuid'], 'owner_acronym' => $data['ownerAcronym'], 'reference_number' => $data['referenceNumber'], 'contract_value' => $data['contractValue'], 'source_year' => $data['sourceYear'], 'source_quarter' => $data['sourceQuarter'], 'source_fiscal' => $data['sourceFiscal'], 'source_origin' => $data['sourceOrigin'], 'source_csv_filename' => $data['sourceCsvFilename'], 'row_created_at' => date('Y-m-d H:i:s'), 'gen_is_error' => 1, 'gen_error_via' => intval($errorType), ]; DB::table('l_contracts')->insert($output); try { return true; } catch (\Illuminate\Database\QueryException $e) { // dd($output); echo "Failed to add error row (query exception) \n"; return false; } catch (PDOException $e) { echo "Failed to add error row (PDO exception) \n"; return false; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function importcsv()\n\t{\n\t\tif( $this->import_start() )\n\t\t{\n\t\t\t// Reads the content which has been uploaded to the tmp file into a text var\n\t\t\t$content = file_get_contents($this->file['tmp_name']);\n\t\t\tunlink($this->file['tmp_name']);\t\t\t\t//delete tmp file\n\n\t\t\t$rows\t\t= $this->cvs2...
[ "0.7146849", "0.7133175", "0.6796284", "0.66229147", "0.6596257", "0.65135676", "0.65079963", "0.6497818", "0.6457223", "0.6449575", "0.6449289", "0.644322", "0.63494515", "0.63454115", "0.63079023", "0.6222137", "0.62158084", "0.6185931", "0.61650974", "0.61631113", "0.61542...
0.0
-1
Reset all the "generated" values related to identifying duplicates and amended contracts
public static function resetGeneratedValues($acronym = null) { $updateArray = [ 'gen_is_duplicate' => 0, 'gen_duplicate_via' => null, 'gen_duplicate_source_id' => null, 'gen_is_amendment' => 0, 'gen_amendment_via' => null, 'gen_amendment_group_id' => null, 'gen_effective_start_year' => null, 'gen_effective_end_year' => null, 'gen_effective_total_value' => null, 'gen_effective_yearly_value' => null, ]; if ($acronym) { return DB::table('l_contracts')->where('owner_acronym', '=', $acronym)->update($updateArray); } else { return DB::table('l_contracts')->update($updateArray); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function reset()\n {\n $this->values[self::contractorstatics] = null;\n $this->values[self::stores] = array();\n $this->values[self::visited] = array();\n $this->values[self::review_info] = array();\n $this->values[self::customer_info] = array();\n $this->values[...
[ "0.68253595", "0.6740691", "0.6681399", "0.6585703", "0.6581564", "0.65534204", "0.65452754", "0.65414774", "0.652923", "0.64638394", "0.6457158", "0.6444771", "0.64388466", "0.6429578", "0.64243233", "0.6423029", "0.64032197", "0.64020044", "0.6388882", "0.6388422", "0.63872...
0.0
-1
Update a list of IDs and mark them as duplicates
public static function markDuplicateEntries($ownerAcronym, $duplicateRows, $method = 1) { // Includs the ownerAcronym just to be on the safe side. // Remove the first entry (so that it isn't also marked as a duplicate, since at least one entry should stay "valid") $sourceId = $duplicateRows->shift(); $duplicateRows = $duplicateRows->toArray(); return DB::table('l_contracts') ->where('owner_acronym', '=', $ownerAcronym) ->whereIn('id', $duplicateRows) ->update([ 'gen_is_duplicate' => 1, 'gen_duplicate_via' => $method, 'gen_duplicate_source_id' => $sourceId, ]); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function cleanDuplicates( );", "protected function removeDuplicates(): void\n {\n $this->startTiming();\n\n $this->logInfo('Removing duplicates...');\n\n $this->list = array_unique($this->list);\n\n $this->endTiming();\n }", "public function testWithDuplicates(): void\n...
[ "0.6089941", "0.5669913", "0.56429535", "0.5314409", "0.5308217", "0.5283567", "0.5275853", "0.5171307", "0.51356965", "0.5090612", "0.50717807", "0.50022185", "0.4994174", "0.4986897", "0.49809968", "0.4975844", "0.49294817", "0.49021614", "0.4878782", "0.4864983", "0.486463...
0.0
-1
Based on a single contract row, check for duplicates in the rest of the database:
public static function findDuplicateEntries($rowData) { // For all modes, limit to the same department owner_acronym $totalDuplicates = 0; // mode 1: same contract_value, same gen_vendor_normalized, same raw_contract_date $duplicateRows = DB::table('l_contracts') ->where('owner_acronym', '=', $rowData['owner_acronym']) ->where('gen_is_duplicate', '=', 0) ->where('gen_is_error', '=', 0) ->where('contract_value', '=', $rowData['contract_value']) ->where('gen_vendor_normalized', '=', $rowData['gen_vendor_normalized']) ->where('raw_contract_date', '=', $rowData['raw_contract_date']) ->whereNotNull('source_fiscal') ->orderBy('source_fiscal', 'asc') ->orderBy('id', 'asc') ->pluck('id'); if ($duplicateRows->count() > 1) { // Then, there's duplicates based on this method. $totalDuplicates += self::markDuplicateEntries($rowData['owner_acronym'], $duplicateRows, 1); } // mode 2: same contract_value, same gen_vendor_normalized, same reference_number, same gen_start_year // (in case the raw contract dates are formatted inconsistently or missing) $duplicateRows = DB::table('l_contracts') ->where('owner_acronym', '=', $rowData['owner_acronym']) ->where('gen_is_duplicate', '=', 0) ->where('gen_is_error', '=', 0) ->where('contract_value', '=', $rowData['contract_value']) ->where('gen_vendor_normalized', '=', $rowData['gen_vendor_normalized']) ->where('reference_number', '=', $rowData['reference_number']) ->where('gen_start_year', '=', $rowData['gen_start_year']) ->whereNotNull('source_fiscal') ->orderBy('source_fiscal', 'asc') ->orderBy('id', 'asc') ->pluck('id'); if ($duplicateRows->count() > 1) { // Then, there's duplicates based on this method. $totalDuplicates += self::markDuplicateEntries($rowData['owner_acronym'], $duplicateRows, 2); } // mode 3: same gen_vendor_normalized and same reference_number // (in case both the raw contract dates and the vendor names are input inconsistently) $duplicateRows = DB::table('l_contracts') ->where('owner_acronym', '=', $rowData['owner_acronym']) ->where('gen_is_duplicate', '=', 0) ->where('gen_is_error', '=', 0) ->where('contract_value', '=', $rowData['contract_value']) ->where('reference_number', '=', $rowData['reference_number']) ->whereNotNull('source_fiscal') ->orderBy('source_fiscal', 'asc') ->orderBy('id', 'asc') ->pluck('id'); if ($duplicateRows->count() > 1) { // Then, there's duplicates based on this method. $totalDuplicates += self::markDuplicateEntries($rowData['owner_acronym'], $duplicateRows, 3); } return $totalDuplicates; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function checkForDuplicateCongress($footprintData, $connection, $currentCongressID = 0)\n{\n $result = 0;\n $congresses = getAllCongresses($connection);\n foreach ($congresses as $congress)\n {\n if ($congress['name'] == $footprintData['name'] ||\n $congress['shortName'] == $footprint...
[ "0.62174606", "0.6211915", "0.59374905", "0.59031355", "0.5791158", "0.57821923", "0.57049656", "0.5698443", "0.5698303", "0.5681922", "0.5586908", "0.5582221", "0.5521944", "0.5517507", "0.54370445", "0.5415155", "0.5412063", "0.5404182", "0.538865", "0.53866214", "0.5384303...
0.69457513
0
Includs the ownerAcronym just to be on the safe side.
public static function markAmendmentEntries($ownerAcronym, $amendmentRows, $method = 1) { // Remove the first entry (so that it isn't also marked as a duplicate, since at least one entry should stay "valid") $sourceId = $amendmentRows->shift(); $amendmentRows = $amendmentRows->toArray(); // Update the original (sourceId) entry DB::table('l_contracts') ->where('owner_acronym', '=', $ownerAcronym) ->where('id', '=', $sourceId) ->update([ 'gen_amendment_group_id' => $sourceId, ]); return DB::table('l_contracts') ->where('owner_acronym', '=', $ownerAcronym) ->whereIn('id', $amendmentRows) ->update([ 'gen_is_amendment' => 1, 'gen_amendment_via' => $method, 'gen_amendment_group_id' => $sourceId, ]); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function acronym($acronym) {\n\n if(array_key_exists($acronym, $this->acronyms)) {\n\n $title = $this->_xmlEntities($this->acronyms[$acronym]);\n\n $this->doc .= '<abbr title=\"'.$title\n .'\">'.$this->_xmlEntities($acronym).'</abbr>';\n\n } else {\n $t...
[ "0.5888614", "0.5743649", "0.5540859", "0.5528757", "0.5528757", "0.5527869", "0.5469167", "0.541511", "0.541511", "0.5410004", "0.5390602", "0.5388397", "0.53863543", "0.5385558", "0.5379496", "0.53761625", "0.533497", "0.533177", "0.5268252", "0.5260099", "0.52296096", "0...
0.0
-1
For all modes, limit to the same department owner_acronym
public static function findAmendmentEntries($rowData) { $totalAmendments = 0; // mode 1: same gen_vendor_normalized, same reference_number, different contract_value $amendmentRows = DB::table('l_contracts') ->where('owner_acronym', '=', $rowData['owner_acronym']) // Ensure it's not the exact same row: ->where('id', '!=', $rowData['id']) // Make sure it's not a duplicate entry ->where('gen_is_duplicate', '=', 0) // Make sure it's not an error row ->where('gen_is_error', '=', 0) // Make sure it isn't part of a different amendment group (TODO - review this) ->whereNull('gen_amendment_group_id') ->whereNotNull('source_fiscal') // Make sure it's the same vendor: ->where('gen_vendor_normalized', '=', $rowData['gen_vendor_normalized']) // This is a bit of a complicated combination, but the resulting SQL is, // and ("reference_number" = ? or ("original_value" = ? and "gen_start_year" = ?)) // Because of threshold limits (sole source, NAFTA, etc.), we wouldn't want to just match original and contract values without also matching start years (in case completely different contracts have the same values). ->where(function ($query) use ($rowData) { return $query->where('reference_number', '=', $rowData['reference_number']) ->orWhere(function ($query) use ($rowData) { return $query->where('original_value', '=', $rowData['contract_value']) ->where('gen_start_year', '=', $rowData['gen_start_year']); }); }) ->orderBy('source_fiscal', 'asc') ->orderBy('contract_value', 'asc') // ->orderBy('id', 'asc') // ->toSql(); ->pluck('id'); if ($amendmentRows->count() > 0) { // Just 1 row is enough (since it'll be different than the original row) // Add back in the original ID (sorted by source_fiscal then ID in the earlier query in findAmendments) $amendmentRows->prepend($rowData['id']); $totalAmendments += self::markAmendmentEntries($rowData['owner_acronym'], $amendmentRows, 1); } return $totalAmendments; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private function _applyEditableParam()\n {\n if ($this->editable) {\n // Limit the query to only the global sets the user has permission to edit\n $editableSetIds = Craft::$app->getGlobals()->getEditableSetIds();\n $this->subQuery->andWhere(['elements.id' => $editableSetI...
[ "0.52315277", "0.52315277", "0.49320942", "0.4710645", "0.4710645", "0.46338335", "0.46246937", "0.4617554", "0.4613992", "0.46018186", "0.45874065", "0.45848894", "0.4556027", "0.45220125", "0.45114926", "0.45003697", "0.44856146", "0.4483433", "0.44793963", "0.4456362", "0....
0.0
-1
Unlike the Paths version,this one gets it from the database:
public static function getAllDepartmentAcronyms() { return DB::table('l_contracts') ->select(['owner_acronym']) ->orderBy('owner_acronym') ->distinct() ->pluck('owner_acronym') ->toArray(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public abstract function getEntityPath();", "function _get_path($pid) {\n\t\t\t\t$set = new NestedSet();\n\t\t\t\t$set->set_table_name($this->mod_tbl);\n\t\t\t\treturn $set->getPath($pid);\n\t\t\t}", "public function getObjectPath() {}", "public static function getByPath($path) {}", "public function getByP...
[ "0.64717185", "0.6399928", "0.6247359", "0.6228643", "0.61967707", "0.6174692", "0.6112609", "0.61114657", "0.61096305", "0.61096305", "0.61096305", "0.61096305", "0.61065936", "0.61065936", "0.6099704", "0.60651636", "0.6049412", "0.60482085", "0.6028152", "0.60117185", "0.6...
0.0
-1
rowData is a collection of rows that all have the same gen_amendment_group_id
public static function calculateEffectiveAmendmentValues($rowData) { // These are already sorted by ascending source_fiscal foreach ($rowData as $row) { // Fix for situations where the end year is earlier than the start year // use whichever is later of the start year or the source year (when it was published). if ($row->gen_end_year < $row->gen_start_year) { $row->gen_end_year = $row->gen_start_year; if ($row->source_year > $row->gen_end_year) { $row->gen_end_year = $row->source_year; } } } // We're using Collection methods here, which are great: // https://laravel.com/docs/5.6/collections // Step 1: find the earliest and latest years of the contract $earliestYear = $rowData->min('gen_start_year'); // Update: rather than the maximum end year, it should actually be the end year of the *last* row in the (ordered by source_fiscal) array of amendments. // In some cases, the contract gets *shortened* from what was originally planned. // $latestYear = $rowData->max('gen_end_year'); $latestYear = $rowData->last()->gen_end_year; // Edge cases where the end year is earlier than the start year, use the last one's start year instead: if ($rowData->last()->gen_start_year > $rowData->last()->gen_end_year) { $latestYear = $rowData->last()->gen_start_year; } $originalValue = $rowData->min('original_value'); if (! $originalValue) { $originalValue = $rowData->min('contract_value'); } // Step 2: create an array range of each year in this set, and then match each year with the most updated amendment row ID $years = range($earliestYear, $latestYear); $yearMapping = []; $firstRow = 1; $genAmendmentGroupId = null; foreach ($rowData as $row) { // Store this for error tracking later (it's the same for all rows in rowData) if (! $genAmendmentGroupId) { $genAmendmentGroupId = $row->gen_amendment_group_id; } foreach ($years as $year) { if ($firstRow) { // Use the start_year since this is the beginning // even if the source_year is later (if it was retroactively published) if ($row->gen_start_year <= $year && $row->gen_end_year >= $year) { $yearMapping[$year] = $row->id; } } else { // Use the source_year instead of the start_year if ($row->source_year <= $year && $row->gen_end_year >= $year) { $yearMapping[$year] = $row->id; } } } $firstRow = 0; } // dd($yearMapping); // var_dump($yearMapping); // array:3 [ // 2010 => 1251303 // 2011 => 1250608 // 2012 => 1250608 // ] // Step 3: loop through rows again and set effective start and end years $cumulativeTotal = 0; $firstRow = 1; $rowIdsToUpdate = []; foreach ($rowData as $row) { $effectiveStartYear = null; $effectiveEndYear = null; foreach ($yearMapping as $year => $rowId) { if ($rowId == $row->id) { // If they match, update the effective start and end years // echo "Match: " . $row->id . " for " . $year . "\n"; if ($effectiveStartYear == null || $year < $effectiveStartYear) { $effectiveStartYear = $year; } if ($effectiveEndYear == null || $year > $effectiveEndYear) { $effectiveEndYear = $year; } } else { // echo "No match for: " . $row->id . " for " . $year . "\n"; } } if ($effectiveStartYear == null || $effectiveEndYear == null) { // If this row ID isn't in the yearMapping array, skip to the next row. // echo "Skipping... \n"; continue; } $rowIdsToUpdate[] = $row->id; // echo "here for " . $row->id . "\n"; $row->gen_effective_start_year = $effectiveStartYear; $row->gen_effective_end_year = $effectiveEndYear; // Effective total value is, the theoretical yearly value of the contract over the originally planned start and end years if ($firstRow) { $theoreticalYearlyValue = $row->contract_value / ($row->gen_end_year - $row->gen_start_year + 1); } else { // Update 2021-04-03: Subtract the cumulative total from the latest contract value here, before averaging across the years between the row's end year and source year $theoreticalYearlyValue = ($row->contract_value - $cumulativeTotal) / ($row->gen_end_year - $row->source_year + 1); } // dd($effectiveEndYear); $row->gen_effective_total_value = $theoreticalYearlyValue * ($effectiveEndYear - $effectiveStartYear + 1); $row->gen_effective_yearly_value = $row->gen_effective_total_value / ($effectiveEndYear - $effectiveStartYear + 1); $cumulativeTotal += $row->gen_effective_total_value; $firstRow = 0; } $updatesSaved = 0; // Update the rows in the database: foreach ($rowData as $index => $row) { $isFinalValue = 0; if ($index == count($rowData) - 1) { $isFinalValue = 1; } // Make sure there are actually changes if (in_array($row->id, $rowIdsToUpdate)) { DB::table('l_contracts') ->where('owner_acronym', '=', $row->owner_acronym) ->where('id', '=', $row->id) ->update([ 'gen_effective_start_year' => $row->gen_effective_start_year, 'gen_effective_end_year' => $row->gen_effective_end_year, 'gen_effective_total_value' => $row->gen_effective_total_value, 'gen_effective_yearly_value' => $row->gen_effective_yearly_value, 'gen_original_value' => $originalValue, 'gen_is_most_recent_value' => $isFinalValue, ]); $updatesSaved = 1; // echo "Updated " . $row->id . "\n"; } else { // Update the effective total and yearly values, but not the start and end years // these are amendments that were overridden by other amendments in the same year. DB::table('l_contracts') ->where('owner_acronym', '=', $row->owner_acronym) ->where('id', '=', $row->id) ->update([ 'gen_effective_total_value' => 0, 'gen_effective_yearly_value' => 0, ]); } } if ($updatesSaved) { return true; } else { echo "No updates for gen_amendment_group_id " . $genAmendmentGroupId . "\n"; return false; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static function findAmendmentEntries($rowData)\n {\n\n $totalAmendments = 0;\n \n // mode 1: same gen_vendor_normalized, same reference_number, different contract_value\n $amendmentRows = DB::table('l_contracts')\n ->where('owner_acronym', '=', $rowData['owner_acron...
[ "0.5957105", "0.5507267", "0.54892516", "0.5171704", "0.5128485", "0.5044327", "0.5043565", "0.49736753", "0.49367654", "0.49367654", "0.49228874", "0.490096", "0.48835528", "0.48523474", "0.4783132", "0.47780377", "0.47698572", "0.4762013", "0.4756047", "0.47501367", "0.4739...
0.44623297
70
Deprecated by the renormalizeVendorNames function below
public static function updateCleanVendorNames($updateExport = 1) { $vendorData = VendorData::getInstance(); foreach ($vendorData->vendorTable as $rawName => $cleanName) { echo "Replacing <" . $rawName . "> with <" . $cleanName . ">\n"; // Update the source contracts table // This may not do as precise of matches as the original vendor cleanup function - it'll catch new additions to the table, but not updates to the $charactersToRemove array. DB::table('l_contracts') ->where('gen_vendor_clean', '=', VendorData::cleanupVendorName($rawName)) ->update([ 'gen_vendor_normalized' => $cleanName, ]); if ($updateExport) { // DB::table('exports_v1') // ->where('vendor_clean', '=', $rawName) // ->update([ // 'vendor_clean' => $cleanName, // ]); DB::table('exports_v1') ->where('gen_vendor_clean', '=', VendorData::cleanupVendorName($rawName)) ->update([ 'gen_vendor_normalized' => $cleanName, ]); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getVendorName(): string;", "public function getVendorName(): string\n {\n return 'local';\n }", "protected function _setVendor()\n {\n // use as the vendor name. e.g., './scripts/solar' => 'solar'\n $path = explode(DIRECTORY_SEPARATOR, $this->_argv[0]);\n $...
[ "0.6208851", "0.55763763", "0.55318815", "0.5431639", "0.5357439", "0.53371686", "0.52724415", "0.5271765", "0.5200153", "0.51787835", "0.51627636", "0.5161855", "0.515724", "0.5150761", "0.51237714", "0.51178396", "0.505705", "0.5047539", "0.5040993", "0.50276005", "0.502562...
0.54108953
4
constructor function used to insert middleware
public function __construct() { $this->middleware('SancofaAuth'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function __construct()\n {\n $this -> middleware('auth');\n $this -> middleware('check_block');\n }", "public function __construct()\n {\n $middlewareGroup = new MiddlewareGroup();\n $middlewareGroup->user();\n $middlewareGroup->handle();\n }", "public func...
[ "0.7918249", "0.7828829", "0.76440424", "0.7577852", "0.7523472", "0.7505965", "0.74646103", "0.74549204", "0.7441405", "0.7411816", "0.73964274", "0.7368868", "0.73661655", "0.73047435", "0.7304375", "0.7298311", "0.72967213", "0.72899944", "0.7283466", "0.72737044", "0.7267...
0.0
-1
function used to display home
public function index() { return view('home'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Home()\n {\n $this->requestSessionInfo();\n\n // muestra solo 2\n $recent_artworks = $this->modelArtwork->GetFrontArtworks(2);\n $this->view->ShowHome($recent_artworks);\n }", "public function route_home() {\n\t\techo '<h1>It wurks!</h1>';\n\t}", "public function use...
[ "0.77371264", "0.7717973", "0.7572559", "0.7558468", "0.7551558", "0.7544596", "0.7533615", "0.75168365", "0.75090516", "0.7502538", "0.746737", "0.7438322", "0.74308497", "0.739617", "0.7382344", "0.73743004", "0.73552626", "0.7346734", "0.7296992", "0.72769505", "0.727096",...
0.0
-1
Print a filter based on the given $templateFile which points to a Twig template
public function printFilter($templateFile= 'filterInTable.tpl'){ $template = Template::getTwig()->loadTemplate($templateFile); return $template->render( array( 'name' => $this->name, 'values' => $this->printValues() ) ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function twig_raw_filter($string)\n{\n return $string;\n}", "public function renderFile(Environment $twig): string;", "private function filterPHP($file) {\n ob_start();\n\n // The variable $template can be used in the script as $this is used here\n $template = $this;\n require $file;\n\n...
[ "0.6113867", "0.6056232", "0.5937417", "0.5924085", "0.59157926", "0.57483596", "0.56511116", "0.56497365", "0.5554979", "0.55074346", "0.5492174", "0.5479007", "0.53762245", "0.5374541", "0.5355738", "0.5327672", "0.5319593", "0.53074265", "0.530409", "0.529241", "0.52806795...
0.76564646
0
Create where statement by the given value which depends on the implementor class. It can be a valueId, or the given value.
public function createWhere($value) { return $this->createWhereByValue( $this->findValueById($valueId) ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private function createWhereByValue($value){\n $filterDbOfValue = $value->getFilterDB();\n if(is_null($filterDbOfValue)){\n $filterDbOfValue = $this->id .\"='\".$value->getId().\"'\";\n }\n return $filterDbOfValue;\n }", "public function createWhere($valueId){\n r...
[ "0.7251644", "0.6701346", "0.6478626", "0.644625", "0.64044714", "0.6368244", "0.6313666", "0.6309462", "0.6287369", "0.62851363", "0.62437606", "0.6237217", "0.62060475", "0.61912864", "0.61772203", "0.6133428", "0.6099568", "0.6094826", "0.6043162", "0.60377264", "0.6023463...
0.73254764
0
Handle an incoming request.
public function handle($request, Closure $next, $type="super") { $this->typetest=$type; $ret=false; if(USER_ADMIN){ if($type=="super" && USER_PETSHOP == false){ $ret=true; } if($type=="petshop" && USER_PETSHOP!=false){ $ret=true; } if($type=="all"){ $ret=true; } if( $type=="superOrPetowner" && ( USER_PETSHOP_ID==$request->petshop_id || USER_PETSHOP==false || $request->petshop_id=='0' || $request->petshop_id=="" ) ){ $ret=true; } } return $ret ? $next($request, $type) : response('', 403); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "abstract public function handle_request();", "public function handleRequest();", "public function handleRequest();", "public function handleRequest();", "protected abstract function handleRequest();", "abstract public function handleRequest($request);", "abstract public function handleRequest(Request $...
[ "0.8299201", "0.8147294", "0.8147294", "0.8147294", "0.8127764", "0.7993589", "0.7927201", "0.7912899", "0.7899075", "0.76317674", "0.75089735", "0.7485808", "0.74074036", "0.7377414", "0.736802", "0.7294553", "0.72389543", "0.7230166", "0.72108", "0.71808434", "0.7170364", ...
0.0
-1
Set up page defaults.
public function initializeDefaults() { $page = $this->getCollectionObject(); Loader::helper('clov_page', 'clov'); // Show non-draft expenses and draft expenses owned by the user. ClovPageHelper::addBlockByHandle($page, 'clov_expense_list'); ClovPageHelper::addBlockByHandle($page, 'clov_expense_list', array( 'uID' => '0', 'activePages' => '0', )); ClovPageHelper::addBlockByHandle($page, 'clov_relative_link', array( 'action' => 'clov/expenses/-/add', 'text' => t('Add A New Expense'), 'class' => 'clov-action-link clov-add-link', )); $this->initializePermissions(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected function setupPage() {}", "private static function initialize_defaults() {\r\n\t\t\tself::$default_settings['credentials'] = array();\r\n\r\n\t\t\tself::$default_settings['has_first_question'] = 'no';\r\n\r\n\t\t\t// We want the Urtaks to appear by default, so let's append them\r\n\t\t\tself::$default_...
[ "0.7362204", "0.7002553", "0.69986475", "0.69279706", "0.69279706", "0.6767306", "0.67425966", "0.67388934", "0.6633468", "0.6548153", "0.6546395", "0.65377283", "0.6498041", "0.6494784", "0.64900386", "0.6463835", "0.64476943", "0.6428139", "0.64153785", "0.6392683", "0.6392...
0.6752894
6
Set up default permissions.
public function initializePermissions() { Loader::helper('clov_permissions', 'clov'); $page = $this->getCollectionObject(); ClovPermissionsHelper::setBaselinePermissions($page); // Project managers and employees can add new expenses. $clovGroups = Loader::package('clov')->getGroups(); $page->assignPermissions($clovGroups[ClovPackage::PROJECT_MANAGERS], array('add_subpage')); $page->assignPermissions($clovGroups[ClovPackage::EMPLOYEES], array('add_subpage')); // Only allow clov_expense pages under this one. ClovPermissionsHelper::restrictSubpageType($page, CollectionType::getByHandle('clov_expense')); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function setDefaultPermissions()\n {\n $this->allow('guest', 'default_error');\n $this->allow('guest', 'default_uploader');\n $this->allow('guest', 'default_lang');\n $this->allow('guest', 'people_auth');\n $this->allow('guest', 'api_auth');\n $this->allow('guest...
[ "0.82586575", "0.79242224", "0.74304485", "0.7417947", "0.7224578", "0.7102657", "0.70275515", "0.6897554", "0.6891287", "0.68890446", "0.68890446", "0.68890446", "0.68890446", "0.68890446", "0.68613964", "0.6754806", "0.6694697", "0.6676938", "0.6670931", "0.66610813", "0.66...
0.64157367
27
Action to allow a user to add a new expense.
public function add() { $entry = $this->getEntryToAdd('clov_expense'); // Default to the logged-in user. $loggedInUser = new User; $entry->setAttribute('clov_expense_payer', $loggedInUser->getUserID()); // If the user got here from a project page, pre-fill the project // attribute. Loader::helper('clov_url', 'clov'); if($project = ClovUrlHelper::loadReferrerPage('clov_project')) { $entry->setAttribute('clov_expense_project', $project->getCollectionID()); } $this->set('entry', $entry); $this->set('showSaveDraft', true); $this->render('clov/default/add'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function addExpenseAction()\n\t{\n\t\t$expense = new Expense($_POST);\n\t\t\n\t\tif ($expense->addExpense()) {\n\t\t\tFlash::addMessage('Add expense successful!');\n\t\t\t\n\t\t\t$this->redirect('/profile/expenseForm');\n\t\t} else {\n\t\t\tFlash::addMessage('Add expense unsuccessful, please try again!', Fl...
[ "0.8273928", "0.76954234", "0.70365936", "0.6929456", "0.68369997", "0.6636071", "0.6512573", "0.6475286", "0.6455503", "0.6442551", "0.64412916", "0.6402608", "0.6362004", "0.63363075", "0.6334624", "0.6318255", "0.63086754", "0.6304994", "0.62851876", "0.6274362", "0.625846...
0.77033734
1
Action to allow a user to edit an existing expense.
public function edit($cID) { $entry = $this->getEntryToEdit($cID); $this->set('entry', $entry); $this->set('showSaveDraft', true); $this->render('clov/default/edit'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function edit(Expense $expense)\n {\n //\n }", "public function edit(Expense $expense)\n {\n //\n }", "public function edit( Expenses $expenses ) {\n //\n }", "function edit($expenses_id)\n { \n\t\tif ($this->auth->loggedin()) {\n\t\t\t$id = $this->auth->userid...
[ "0.86577326", "0.86577326", "0.84517413", "0.7908673", "0.78986496", "0.78270763", "0.7816504", "0.7747384", "0.7570398", "0.75106645", "0.7332953", "0.73311645", "0.73094684", "0.72742414", "0.72681177", "0.7217165", "0.718886", "0.71645033", "0.7119471", "0.71124727", "0.71...
0.0
-1
Save an expense. This is the action that both the add & edit forms submit to.
public function save($cID) { $entry = $this->getEntryToSave($cID); if($this->saveEntry($entry)) { Loader::helper('clov_url', 'clov'); // Redirect to the associated project or the generic list page. // Drafts always go to the generic list page because drafts are // not shown on the project page. if(!$entry->isComposerDraft() && $projectID = $entry->getAttribute('clov_expense_project')) { $project = Page::getByID($projectID); $this->redirect(ClovUrlHelper::getCollectionRoute($project)); } else { $this->redirect('clov/expenses'); } } else { // Something went wrong. Show the edit view where errors can be // displayed. $this->edit($entry->getCollectionID()); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function addExpenseAction()\n\t{\n\t\t$expense = new Expense($_POST);\n\t\t\n\t\tif ($expense->addExpense()) {\n\t\t\tFlash::addMessage('Add expense successful!');\n\t\t\t\n\t\t\t$this->redirect('/profile/expenseForm');\n\t\t} else {\n\t\t\tFlash::addMessage('Add expense unsuccessful, please try again!', Fl...
[ "0.7616036", "0.68547523", "0.6811038", "0.6811038", "0.6735758", "0.6654462", "0.6652764", "0.6651849", "0.6641644", "0.6607206", "0.65666515", "0.6527555", "0.64734066", "0.6456755", "0.64544475", "0.6452617", "0.6447812", "0.6385678", "0.6313902", "0.631229", "0.63038576",...
0.0
-1
Save method for interface
public function save($data);
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public abstract function save();", "abstract public function save();", "abstract public function save();", "abstract public function save();", "abstract public function save();", "abstract public function save();", "public function save() {}", "public function save() {}", "public function save() {}...
[ "0.8323629", "0.8231945", "0.8231945", "0.8231945", "0.8231945", "0.8231945", "0.79014146", "0.79014146", "0.790038", "0.7896929", "0.7797633", "0.7767889", "0.7767889", "0.7767889", "0.7767889", "0.7767889", "0.7767889", "0.7767889", "0.7767889", "0.7767889", "0.7767889", ...
0.69459295
64
filter between database entry row and dataaccessobjects\n validates database value
private static function clean($in) { return htmlentities($in); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "abstract protected function filterFieldvalue();", "abstract function get_sql_filter($data);", "protected function filter_row(&$row) {}", "abstract public function filterFields();", "abstract protected function filterField(): string;", "function dataVerification($fieldName=null,$value=null,$tableName){\r\...
[ "0.64261895", "0.6103079", "0.5991156", "0.55947495", "0.5495172", "0.5435611", "0.540329", "0.540329", "0.53804904", "0.53389007", "0.5333275", "0.5314852", "0.5277785", "0.5204024", "0.52024233", "0.5190446", "0.51651275", "0.5127004", "0.51221544", "0.51164764", "0.5076392...
0.0
-1
translate database row to ForumThread
public static function toThread($data) { $thread = new ForumThread(Parse::clean($data->topic)); $thread->setId(Parse::clean($data->id)); $thread->setSubjectFK(Parse::clean($data->subject)); return $thread; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Forum_showThread(&$PAGEDATA, &$id) {\n\trequire_once SCRIPTBASE.'ww.incs/bb2html.php';\n\tWW_addCSS('/ww.plugins/forum/frontend/forum.css');\n\t$script='$(function(){$(\".ratings\").ratings();});';\n\tWW_addScript('ratings/ratings.js');\n\tWW_addInlineScript($script);\n\t$thread=dbRow('select * from forum...
[ "0.58324414", "0.5804083", "0.5800071", "0.57637006", "0.5755244", "0.5709423", "0.56874114", "0.56669766", "0.5648643", "0.56475234", "0.54793316", "0.54456306", "0.5416198", "0.54152834", "0.54046494", "0.5372317", "0.53578883", "0.5289383", "0.5275244", "0.52680343", "0.52...
0.6420657
0
translate database row to ForumSubject
public static function toSubject($data) { $subj = new ForumSubject(); $subj->setId(Parse::clean($data->id)); $subj->setTopic(Parse::clean($data->topic)); $subj->setSubtitle(Parse::clean($data->subtitle)); return $subj; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function subject_obtain($report_subject)\n\t{\n\t\t$sql = 'SELECT t.topic_title, t.topic_first_post_id\n\t\t\tFROM ' . BB_POSTS . ' p\n\t\t\tINNER JOIN ' . BB_POSTS_TEXT . ' pt\n\t\t\t\tON pt.post_id = p.post_id\n\t\t\tINNER JOIN ' . BB_TOPICS . ' t\n\t\t\t\tON t.topic_id = p.topic_id\n\t\t\tWHERE p.post_id = ' . ...
[ "0.619802", "0.6001956", "0.5975424", "0.561473", "0.5539607", "0.553472", "0.55325335", "0.55325335", "0.5529022", "0.5519426", "0.5517631", "0.5487055", "0.54284054", "0.53972363", "0.5377242", "0.5360678", "0.5346992", "0.5340689", "0.5332699", "0.5331949", "0.53112787", ...
0.59466463
3
translate database row to Role
public static function toRole($data) { return new Role( (int) Parse::clean($data->id), (string) Parse::clean($data->title) ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getRole()\n\t{\n\t\t$column = self::COL_ROLE;\n\t\t$v = $this->$column;\n\n\t\tif( $v !== null){\n\t\t\t$v = (string)$v;\n\t\t}\n\n\t\treturn $v;\n\t}", "function translate_level_to_role($level)\n {\n }", "public function getRole();", "public function getRole();", "public function get...
[ "0.70421773", "0.674241", "0.67201006", "0.67201006", "0.6687683", "0.6643433", "0.6575945", "0.65338296", "0.6517904", "0.6514955", "0.64639443", "0.64161825", "0.6392676", "0.63348615", "0.62882066", "0.6280999", "0.6278904", "0.6251113", "0.62088037", "0.61973906", "0.6190...
0.6548822
7
translate database row to News
public static function toNews($data) { $news = new News(); $news->setId(Parse::clean($data->id)); $news->setAuthorPK(Parse::clean($data->author)); $news->setTitle(Parse::clean($data->title)); $news->setMessage(Parse::clean($data->message)); $news->setCreated(Parse::clean($data->created)); return $news; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function frontpage_news_manual(&$db) {\n $newsq = $db->Execute(\"SELECT * FROM `frontpage_news`\");\n if($newsq->numrows()==0) return \"No news to show.\";\n\n while($item = $newsq->fetchrow()) {\n $news .= \"<div style='border:1px solid #CCC;margin:4px;padding:4px;-moz-border-radius-topright:12px;...
[ "0.6109563", "0.6082923", "0.60338396", "0.6025663", "0.59787697", "0.5885495", "0.58462244", "0.580724", "0.5804226", "0.5750887", "0.56910336", "0.56821924", "0.5677215", "0.5665121", "0.56553566", "0.5654239", "0.5640323", "0.5638037", "0.5546119", "0.5514486", "0.5499933"...
0.6236477
0
translate database row to ForumPost
public static function toPost($data) { $post = new ForumPost(); $post->setId(Parse::clean($data->id)); $post->setAuthorFK(Parse::clean($data->author)); $post->setMessage(Parse::clean($data->message)); $post->setCreated(Parse::clean($data->created)); $post->setEdited(Parse::clean($data->edited)); $post->setThreadFK(Parse::clean($data->thread)); return $post; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _convert_entity_to_post($entity)\n {\n // Was a model passed instead of an entity?\n $post = $entity;\n if (!$entity instanceof stdClass) {\n $post = $entity->get_entity();\n }\n // Create the post content\n $post_content = clone $post;\n fore...
[ "0.5863838", "0.58136", "0.58066976", "0.5783343", "0.5687801", "0.56641865", "0.55674404", "0.5265369", "0.5230894", "0.5221956", "0.5219688", "0.5205111", "0.52033657", "0.5176459", "0.5135551", "0.5093767", "0.5081421", "0.50801456", "0.5077786", "0.5017135", "0.50143826",...
0.60153496
0
translate database row to ForumUser
public static function toUser($data) { $user = new ForumUser(); $user->setId((int) Parse::clean($data->id)); $user->setName(Parse::clean($data->name)); $user->setEmail(Parse::clean(crypt( $data->email, $GLOBALS['database']['crypt_salt'] ))); $user->setRole(Parse::clean($data->title)); $user->setRegistered(Parse::clean($data->registered)); $user->setBanned($data->banned === 't' ? 1:0); return $user; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function convert_from_sql_row($row)\n\t{\n $this->SignupId = (int)$row->SignupId;\n $this->UserId = (int)$row->UserId;\n $this->RunId = (int)$row->RunId;\n $this->State = (string)$row->State;\n $this->PrevState = (string)$row->PrevState;\n $this->Gender = (string)$row->Gen...
[ "0.6022985", "0.58756256", "0.58455765", "0.5843801", "0.58296764", "0.5796157", "0.55355024", "0.5527318", "0.55139244", "0.547733", "0.5456897", "0.54538655", "0.54429287", "0.54169077", "0.53633946", "0.53233415", "0.5283422", "0.52714103", "0.5245202", "0.5216264", "0.521...
0.65553194
0
file_put_contents("/tmp/checkuser", "test"); $user = fileowner("/tmp/checkuser"); unlink("/tmp/checkuser"); if ($user!=1000) die; get passed emoncms location from bash e.g. $ echo /var/www/emoncms | php get_emoncms_mysql_auth.php
function getInput() { $input = ''; $fr = fopen("php://stdin", "r"); while (!feof ($fr)) { $input .= fgets($fr); } fclose($fr); return $input; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function get_file_owner($path) {\n $owner = posix_getpwuid(fileowner($path));\n return $owner['name'];\n}", "function create_user_dir(){\n\t$safeUserDir=bin2hex(random_bytes(4));\n\t$oldDir=getcwd();\n\tchdir(FS_PATH);\n\tif(mkdir(\"$safeUserDir\")) {\n\tchmod(\"$safeUserDir\",0755); //owner=r,w,x group=r,x...
[ "0.5897775", "0.586112", "0.5818095", "0.58112043", "0.5760281", "0.5743319", "0.57107216", "0.56859136", "0.5685158", "0.5609091", "0.56083274", "0.5492623", "0.535124", "0.5343659", "0.5305757", "0.5275475", "0.526083", "0.5244101", "0.5225427", "0.52209437", "0.52172863", ...
0.0
-1
Create a new rate limit middleware instance.
public function __construct(HttpKernelInterface $app, Container $container) { $this->app = $app; $this->container = $container; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected function limiter(): RateLimiter\n {\n return app(RateLimiter::class);\n }", "public static function rateLimit(): self\n {\n return self::getInstance('RATE_LIMIT');\n }", "public function enableRateLimit(): self\n {\n $this->rateLimitEnabled = true;\n\n retur...
[ "0.69492733", "0.67098063", "0.6482791", "0.6340871", "0.61786133", "0.6069534", "0.58163744", "0.58163744", "0.58163744", "0.58163744", "0.57594424", "0.5738933", "0.5721038", "0.56558895", "0.56016034", "0.5507725", "0.5496628", "0.5478485", "0.5471619", "0.5471619", "0.542...
0.0
-1
Handle a given request and return the response.
public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true) { $this->container->boot(); $this->prepareConfig($request); // Internal requests as well as requests that are not targetting the // API will not be rate limited. We'll also be sure not to perform // any rate limiting if it has been disabled. if ($request instanceof InternalRequest or ! $this->router->requestTargettingApi($request) or $this->rateLimitingDisabled()) { return $this->app->handle($request, $type, $catch); } $this->cache->add($this->config['keys']['requests'], 0, $this->config['reset']); $this->cache->add($this->config['keys']['reset'], time() + ($this->config['reset'] * 60), $this->config['reset']); $this->cache->increment($this->config['keys']['requests']); if ($this->exceededRateLimit()) { list ($version, $format) = $this->router->parseAcceptHeader($request); $response = (new Response(['message' => $this->config['exceeded']], 403))->morph($format); } else { $response = $this->app->handle($request, $type, $catch); } return $this->adjustResponseHeaders($response); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function handleRequest($request)\n {\n list ($route, $params) = $request->resolve();\n $this->requestedRoute = $route;\n $result = $this->runAction($route, $params);\n\n if ($result instanceof Response) {\n return $result;\n } elseif ($result instanceof Loope...
[ "0.7805343", "0.77512974", "0.74457014", "0.7348467", "0.734071", "0.73403794", "0.7243689", "0.71927017", "0.7187858", "0.7187858", "0.7187858", "0.71546423", "0.7114376", "0.7063579", "0.7033677", "0.69575655", "0.6947007", "0.6932509", "0.6826806", "0.67929596", "0.6747536...
0.0
-1
Adjust the response headers and return the response.
protected function adjustResponseHeaders($response) { $requestsRemaining = $this->config['limit'] - $this->cache->get($this->config['keys']['requests']); if ($requestsRemaining < 0) { $requestsRemaining = 0; } $response->headers->set('X-RateLimit-Limit', $this->config['limit']); $response->headers->set('X-RateLimit-Remaining', $requestsRemaining); $response->headers->set('X-RateLimit-Reset', $this->cache->get($this->config['keys']['reset'])); return $response; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected function sendHeaders()\n {\n http_response_code($this->response_status_code);\n\n // collect current headers into array\n $headers = headers_list();\n\n foreach ($headers as $h) {\n $h_parts = explode(\":\", $h);\n\n if (array_key_exists($h_parts[0], $...
[ "0.72100633", "0.70166314", "0.6617447", "0.65059", "0.6494378", "0.6429676", "0.64204526", "0.6357893", "0.63467634", "0.63161814", "0.6305381", "0.6291304", "0.62866765", "0.6254819", "0.61898685", "0.61814004", "0.61748695", "0.6126393", "0.6121223", "0.6117924", "0.611541...
0.6186615
15
Determine if the client has exceeded their rate limit.
protected function exceededRateLimit() { return $this->cache->get($this->config['keys']['requests']) > $this->config['limit']; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private function isRateLimitReached()\n {\n if (!$this->getRateLimit()) {\n throw new InstagramThrottleException('400 Bad Request : You have reached Instagram API Rate Limit', 400);\n }\n }", "public function isLimitExceeded();", "public function isAPICallLimitErr() {\n //...
[ "0.76984394", "0.7511876", "0.7430753", "0.7338698", "0.705702", "0.70023066", "0.6976481", "0.6953007", "0.6891207", "0.6840113", "0.6775359", "0.6755924", "0.6675948", "0.66168153", "0.6584276", "0.6497298", "0.6490639", "0.6482962", "0.64381623", "0.6385098", "0.6330897", ...
0.83757097
0
Deteremine if the request is authenticated.
protected function isAuthenticatedRequest() { if (! is_null($this->authenticatedRequest)) { return $this->authenticatedRequest; } return $this->authenticatedRequest = $this->auth->check(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private function _isAuthenticated()\n\t{\n\t\treturn true;\n\t}", "public function isAuthenticated() {\n\t}", "public function isAuthenticated()\n {\n return $this->getUser() !== null;\n }", "public function isAuthenticated()\r\n {\r\n return true; \r\n }", "public function isA...
[ "0.734579", "0.7165258", "0.7108767", "0.7032801", "0.7004497", "0.7004497", "0.7004497", "0.7004497", "0.6991808", "0.6991808", "0.69695544", "0.6878613", "0.68752825", "0.6846195", "0.684384", "0.6816934", "0.67929107", "0.6769155", "0.6715971", "0.6715526", "0.67150074", ...
0.6461455
35
Prepare the configuration for the request.
protected function prepareConfig($request) { $this->config = array_merge($this->config, $this->container->make('config')->get('api::rate_limiting')); if ($this->isAuthenticatedRequest()) { $this->config = array_merge(['exceeded' => $this->config['exceeded']], $this->config['authenticated']); } else { $this->config = array_merge(['exceeded' => $this->config['exceeded']], $this->config['unauthenticated']); } $this->config['keys']['requests'] = sprintf('dingo:api:requests:%s', $request->getClientIp()); $this->config['keys']['reset'] = sprintf('dingo:api:reset:%s', $request->getClientIp()); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function prepareRequest()\r\n {\r\n\r\n }", "public function prepareRequest()\n {\n }", "protected function initConfiguration()\n {\n $this->initJsonConfiguration();\n $this->initApiGatewayConfiguration('kyc_service/' . $this->requestPath, false);\n }", "public ...
[ "0.69601846", "0.6925541", "0.6668498", "0.6461505", "0.6407273", "0.6392652", "0.6287327", "0.6282456", "0.62120664", "0.62031174", "0.61844707", "0.6163672", "0.6125928", "0.6116237", "0.611167", "0.60669315", "0.6005491", "0.5999368", "0.59947604", "0.5992889", "0.59454376...
0.6381858
6
Determine if rate limiting is disabled.
protected function rateLimitingDisabled() { return $this->config['limit'] == 0; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function isRateLimitEnabled(): bool\n {\n return $this->rateLimitEnabled === true;\n }", "protected function exceededRateLimit()\n {\n return $this->cache->get($this->config['keys']['requests']) > $this->config['limit'];\n }", "public function isDisabled() {}", "public functi...
[ "0.80362725", "0.6431033", "0.6367116", "0.6316369", "0.6316369", "0.6316369", "0.62642473", "0.6238752", "0.62275565", "0.62133664", "0.61785895", "0.6177483", "0.611829", "0.6115391", "0.60724354", "0.60677505", "0.6042399", "0.602266", "0.60194993", "0.60177106", "0.599801...
0.85676414
0
Dynamically handle binding calls on the container.
public function __get($binding) { $binding = isset($this->mappings[$binding]) ? $this->mappings[$binding] : $binding; if (isset($this->bindings[$binding])) { return $this->bindings[$binding]; } return $this->bindings[$binding] = $this->container->make($binding); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected static function bind() {}", "private function bindContainer()\n {\n parent::setInstance($this);\n \n $this->instance('container', $this);\n $this->instance(BaseContainer::class, $this);\n }", "protected function bind()\n {\n if (!isset($this->di)) {\n ...
[ "0.7012186", "0.6951914", "0.6830161", "0.678788", "0.6603382", "0.6479015", "0.64080894", "0.6309403", "0.62760365", "0.6273394", "0.61973417", "0.6165383", "0.6155472", "0.6136002", "0.60884905", "0.6042611", "0.603274", "0.6000865", "0.5976934", "0.5955015", "0.5952089", ...
0.0
-1
Specify Zend_Db_Table instance to use for data operations
public function setDbTable ($dbTable) { if (is_string($dbTable)) { $dbTable = new $dbTable(); } if (! $dbTable instanceof Zend_Db_Table_Abstract) { throw new Exception('Invalid table data gateway provided'); } $this->_dbTable = $dbTable; return $this; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getTable()\n {\n if ($this->_table == null) {\n $this->_table = new Zend_Db_Table($this->_tableName);\n }\n\n return $this->_table;\n }", "abstract protected function getTable();", "public function getTable()\r\n\t{\r\n\t\tif ($this->_table===null) {\r\n\t\...
[ "0.70389414", "0.6711118", "0.6651927", "0.6640382", "0.6640382", "0.6640382", "0.6640382", "0.6640382", "0.6640382", "0.6640382", "0.65645045", "0.65645045", "0.65415335", "0.65367997", "0.6514711", "0.6512614", "0.6463396", "0.6457792", "0.6435995", "0.63897693", "0.6362614...
0.5845462
86
Get registered Zend_Db_Table instance
public function getDbTable () { if (null === $this->_dbTable) { $this->setDbTable('Core_Model_DbTable_Nationalities'); } return $this->_dbTable; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getTable()\n {\n if ($this->_table == null) {\n $this->_table = new Zend_Db_Table($this->_tableName);\n }\n\n return $this->_table;\n }", "public function getTable()\r\n\t{\r\n\t\tif ($this->_table===null) {\r\n\t\t\t$this->_table=new $this->_tableClass;\r\n\...
[ "0.79708755", "0.73712486", "0.7011595", "0.69867915", "0.69488376", "0.69312936", "0.6903663", "0.687256", "0.68554455", "0.68460095", "0.682809", "0.68018216", "0.6791526", "0.67760456", "0.6772882", "0.6760848", "0.67447394", "0.67272943", "0.67272943", "0.67272943", "0.67...
0.0
-1
$status = Post::where('id', $post_id)>pbpgs()>where('id', $pbpg_id)>pivot('status');
public static function check($post_id, $pbpg_id) { $post = Post::where('id', $post_id)->first(); $status = $post->pbpgs->where('id', $pbpg_id)->first()->pivot->status; return $status; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function blue()\n {\n return $this->users()->wherePivot('team','modry');\n }", "public function bimbingan($status = null)\n {\n $bimbingan = $this->belongsToMany(\n 'PMW\\Models\\Proposal',\n 'bimbingan',\n 'id_pengguna',\n 'id_tim')\n ...
[ "0.5501788", "0.52438015", "0.5222567", "0.52159816", "0.51492894", "0.5148914", "0.5147015", "0.5012503", "0.4995222", "0.49465474", "0.4939952", "0.49022", "0.48716477", "0.48268053", "0.482571", "0.4820807", "0.48160303", "0.47997707", "0.4796085", "0.47931153", "0.4780666...
0.7210851
0
Display a listing of the resource.
public function index() { // }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function indexAction()\n {\n $limit = $this->Request()->getParam('limit', 1000);\n $offset = $this->Request()->getParam('start', 0);\n $sort = $this->Request()->getParam('sort', array());\n $filter = $this->Request()->getParam('filter', array());\n\n $result = $this->re...
[ "0.7446777", "0.736227", "0.73005503", "0.72478926", "0.71631265", "0.71489686", "0.7131636", "0.7105969", "0.71029514", "0.7101372", "0.70508176", "0.6995128", "0.69890636", "0.6934895", "0.6900203", "0.6899281", "0.6891734", "0.6887235", "0.68670005", "0.6849741", "0.683052...
0.0
-1
Show the form for creating a new resource.
public function create() { // }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function create()\n {\n return $this->showForm('create');\n }", "public function create()\n {\n return $this->showForm('create');\n }", "public function create()\n {\n return view('admin.resources.create');\n }", "public function create(){\n\n return view(...
[ "0.75948673", "0.75948673", "0.75863165", "0.7577412", "0.75727344", "0.7500887", "0.7434847", "0.7433956", "0.73892003", "0.73531085", "0.73364776", "0.73125", "0.7296102", "0.7281891", "0.72741455", "0.72424185", "0.7229325", "0.7226713", "0.7187349", "0.7179176", "0.717428...
0.0
-1
Store a newly created resource in storage.
public function store(Request $request) { $validation = Validator::make($request->all(), [ 'name' => 'required', 'acronym' => 'required', ]); if ($validation->fails()) { return response()->json([ 'status' => 400, 'message' => 'Erro! Preencha todos os campos.', ]); } try { $state = new State(); $state->name = $request->input('name'); $state->acronym = $request->input('acronym'); $state->save(); return response()->json([ 'status' => 200, 'message' => 'Criado com sucesso!', ]); } catch (Exception $e) { return response()->json([ 'status' => 400, 'message' => $e->getMessage(), ]); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function store($data, Resource $resource);", "public function store()\n {\n /* Check if logged in user is authorized to make this request */\n $this->authorizeAction();\n\n if (method_exists($this, 'storeValidations')) {\n $this->request->validate($this->storeValidations...
[ "0.72865677", "0.7145327", "0.71325725", "0.6640912", "0.66209733", "0.65685713", "0.652643", "0.65095705", "0.64490104", "0.637569", "0.63736665", "0.63657933", "0.63657933", "0.63657933", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.63424...
0.0
-1
Display the specified resource.
public function show(State $state) { // }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function show(Resource $resource)\n {\n // not available for now\n }", "public function show(Resource $resource)\n {\n //\n }", "function Display($resource_name, $cache_id = null, $compile_id = null)\n {\n $this->_smarty->display($resource_name, $cache_id, $compile_id...
[ "0.8233718", "0.8190437", "0.6828712", "0.64986944", "0.6495974", "0.6469629", "0.6462615", "0.6363665", "0.6311607", "0.62817234", "0.6218966", "0.6189695", "0.61804265", "0.6171014", "0.61371076", "0.61207956", "0.61067593", "0.6105954", "0.6094066", "0.6082806", "0.6045245...
0.0
-1
Show the form for editing the specified resource.
public function edit(Request $request) { $validation = Validator::make($request->all(), [ 'id' => 'required', 'name' => 'required', 'acronym' => 'required', ]); if ($validation->fails()) { return response()->json([ 'status' => 400, 'message' => 'Erro! Preencha todos os campos.', ]); } try { $state = State::findOrFail($request->input('id')); $state->name = $request->input('name'); $state->acronym = $request->input('acronym'); $state->save(); return response()->json([ 'status' => 200, 'message' => 'Salvo com sucesso!', ]); } catch (Exception $e) { return response()->json([ 'status' => 500, 'message' => $e->getMessage(), ]); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function edit(Resource $resource)\n {\n return view('admin.resources.edit', compact('resource'));\n }", "public function edit(Resource $resource)\n {\n //\n }", "public function edit($id)\n {\n /* Check if logged in user is authorized to make this request */\n ...
[ "0.78550774", "0.7692893", "0.7273195", "0.7242132", "0.7170847", "0.70622855", "0.7053459", "0.6982539", "0.69467914", "0.6945275", "0.6941114", "0.6928077", "0.69019294", "0.68976134", "0.68976134", "0.6877213", "0.68636996", "0.68592185", "0.68566656", "0.6844697", "0.6833...
0.0
-1
Update the specified resource in storage.
public function update(Request $request, State $state) { // }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function updateShopifyResource() {\n $this->saving();\n $this->getShopifyApi()->call([\n 'URL' => API::PREFIX . $this->getApiPathSingleResource(),\n 'METHOD' => 'PUT',\n 'DATA' => [\n static::getResourceSingularName() => $this->shopifyData\n ...
[ "0.7425105", "0.70612276", "0.70558053", "0.6896673", "0.6582159", "0.64491373", "0.6346954", "0.62114537", "0.6145042", "0.6119944", "0.61128503", "0.6099993", "0.6087866", "0.6052593", "0.6018941", "0.60060275", "0.59715486", "0.5946516", "0.59400934", "0.59377414", "0.5890...
0.0
-1
Remove the specified resource from storage.
public function destroy(State $state) { // }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function delete($resource){\n return $this->fetch($resource, self::DELETE);\n }", "public function destroy(Resource $resource)\n {\n //\n }", "public function removeResource($resourceID)\n\t\t{\n\t\t}", "public function unpublishResource(PersistentResource $resource)\n {\n ...
[ "0.6672584", "0.6659381", "0.6635911", "0.6632799", "0.6626075", "0.65424126", "0.65416265", "0.64648265", "0.62882507", "0.6175931", "0.6129922", "0.60893893", "0.6054415", "0.60428125", "0.60064924", "0.59337646", "0.5930772", "0.59199584", "0.5919811", "0.5904504", "0.5897...
0.0
-1
Get the path the user should be redirected to when they are not authenticated.
protected function redirectTo($request) { if (! $request->expectsJson()) { return route('login'); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function redirectPath()\n {\n $redirect = app('user.logic')->getUserInfo('admin') ? $this->redirectTo : $this->redirectToHome;\n return $redirect;\n }", "public function redirectPath()\n {\n if (method_exists($this, 'redirectTo')) {\n return $this->redirectTo();\n ...
[ "0.7755095", "0.76014847", "0.7291407", "0.7266697", "0.7207652", "0.7203327", "0.71280384", "0.7094288", "0.70882577", "0.7075417", "0.7048034", "0.7048034", "0.7011364", "0.7000666", "0.6992354", "0.6969801", "0.6922098", "0.68287885", "0.68030256", "0.6769999", "0.6675081"...
0.0
-1
Handle an incoming request.
public function handle($request, \Closure $next, ...$guards) { if (!is_null(Auth::user()) && !Auth::user()->is_activated) { if (Hash::check('default', Auth::user()->password)) { Auth::logout(); return redirect()->route('password.request')->with('status', trans('auth.passwordDefault')); } Auth::logout(); throw ValidationException::withMessages([ 'email' => [trans('auth.activated')], ]); } $this->authenticate($request, $guards); return $next($request); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "abstract public function handle_request();", "public function handleRequest();", "public function handleRequest();", "public function handleRequest();", "protected abstract function handleRequest();", "abstract public function handleRequest($request);", "abstract public function handleRequest(Request $...
[ "0.8299201", "0.8147294", "0.8147294", "0.8147294", "0.8127764", "0.7993589", "0.7927201", "0.7912899", "0.7899075", "0.76317674", "0.75089735", "0.7485808", "0.74074036", "0.7377414", "0.736802", "0.7294553", "0.72389543", "0.7230166", "0.72108", "0.71808434", "0.7170364", ...
0.0
-1