query
stringlengths 9
43.3k
| document
stringlengths 17
1.17M
| metadata
dict | negatives
listlengths 0
30
| negative_scores
listlengths 0
30
| document_score
stringlengths 5
10
| document_rank
stringclasses 2
values |
---|---|---|---|---|---|---|
Performs a PUT request on the specified $location, with the given $body.
|
public function put($location, $body);
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"abstract public function update(Request $request, Location $location): JsonResponse;",
"public function update(Request $request, location $location)\n {\n //\n }",
"public function put($url, $body = array(), $query = array(), $headers = array());",
"public function update(Request $request, Location $location)\n {\n //\n }",
"public function doPut($path, array $parsed_body);",
"public function put($uri, $body = null, array $headers = []): ResponseInterface;",
"public function put(string $uri, array $params = [], $body = null, array $headers = []): ResponseInterface;",
"public function put($path, $parameters = null, $body = null);",
"public function put ( $path, $body = null, $params ) {\n \n \t$body = json_encode ( $body );\n \n $opts = array (\n\t\t\t CURLOPT_HTTPHEADER \t\t=> array ( 'Content-Type: application/json' ),\n\t\t\t CURLOPT_CUSTOMREQUEST \t=> \"PUT\",\n\t\t\t CURLOPT_POSTFIELDS \t\t=> $body\n );\n \n $exec = $this->execute ( $path, $opts, $params );\n\n return $exec;\n }",
"public function requestPut(string $path, string $body): bool\n {\n return $this->request('put', $path, $body);\n }",
"public function update(Request $request, Location $location)\n {\n $location->fill($request->post())->save();\n return response()->json([\n 'message'=>'Location Updated Successfully!!',\n 'location'=>$location\n ]);\n }",
"public function put($uri = null, $headers = null, $body = null)\n {\n return $this->createRequest('PUT', $uri, $headers, $body);\n }",
"public function update(Request $request, LocationUser $locationUser)\n {\n //\n }",
"static function put($url, $body = null, $headers = array()) {\n $request = new NiceHTTP\\PutRequest($url, $body, $headers);\n return $request->send();\n }",
"public function post($location, $body);",
"public function update(Request $request, Location $location)\n {\n $location->name = $request->input('name');\n\n $location->save();\n\n return back();\n }",
"public function update(Request $request, Location $location)\n {\n\n $validator = Validator::make($request->all(), [\n 'name' => 'required|max:50',\n 'description' => 'required|max:2000',\n 'address' => 'required',\n 'working_hours' => 'required'\n ]);\n\n if ($validator->fails()) {\n return back()->withErrors($validator)->withInput();\n }\n\n $location->fill($request->except(['_token','_method']));\n $location->save();\n\n return redirect()->route('locations.show',['location' => $location]);\n }",
"public function Put( $sUrl, $vRequestBody, $bJsonEncode = false );",
"public function update(Request $request, Location $location) : Location\n {\n $user = $request->user();\n\n /* We check that the user can update an item in the team */\n if (!$user->hasTeamPermission($location->team, 'location:write') ||\n !$user->tokenCan('location:write')\n ) {\n throw new AuthorizationException();\n }\n\n $data = $request->validate([\n \"name\" => \"required|string\",\n ]);\n $location->update($data);\n return $location->refresh();\n }",
"public function update(Request $request, Location $location)\n {\n $location->update($request->all());\n\n return redirect()->back()->with('message', 'Complimenti ha modificato la tua prenotazione');\n }",
"public function update(Location $location, LocationsRequest $locationRequest)\n {\n $location->update($locationRequest->all());\n return redirect()->route('backend.dashboard');\n\n }",
"public function update(Request $request, InventoryLocation $location)\n {\n $this->inventoryLocationService->updateLocation($location, $request->all());\n Session::flash('success', trans('labels.save_success'));\n return redirect()->route('inventory-locations.index');\n }",
"abstract public function put(Request $request);",
"protected function makePutRequest($uri, $params) {\n $curl = curl_init();\n\n curl_setopt($curl, CURLOPT_URL,$this->server_url . $uri);\n curl_setopt($curl, CURLOPT_CUSTOMREQUEST, \"PUT\");\n curl_setopt($curl, CURLOPT_POSTFIELDS,\n http_build_query($params));\n curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);\n\n $output = curl_exec($curl);\n $this->response = $output;\n $this->response_code = curl_getinfo($curl, CURLINFO_HTTP_CODE);\n curl_close ($curl);\n }",
"public function update(locationRequest $request,$id){\n\n\t\t\t$location=Location::find($id);\n\n\t\t\t$location->slug=$request->input('slug');\n\t\t\t$location->designation=$request->input('designation');\n\t\t\t$location->address=$request->input('address');\n\t\t\t$location->locality_id=$request->input('locality_id');\n\t\t\t$location->website=$request->input('website');\n\t\t\t$location->phone=$request->input('phone');\n\t\t\n\n $location->save();\n return redirect('locations');\n\n }",
"public function updateExistingLocation($request, $id)\n {\n $location = $this->deliveryLocation->where('id', $id)->first();\n if ($location) {\n $location->name = $request->name;\n $location->description = $request->description;\n $location->price = $request->price;\n $location->status = $request->status;\n if ($location->save()) {\n return 'updated';\n }\n return 'can\\'t be updated';\n }\n\n }",
"public function _put($url = null, array $parameters = []);",
"public function edit(location $location)\n {\n //\n }",
"public function put(string $url, array $input = [], $headers = null);",
"public function update(UpdateLocationRequest $request, Location $location)\n {\n if ($request->isMethod('PATCH')) {\n $location->fill(array_merge(\n $location->toArray(),\n $request->all()\n ));\n } else {\n $location->fill($request->all());\n }\n\n $location->save();\n\n return response('', 204);\n }"
] |
[
"0.7089712",
"0.7013624",
"0.6999922",
"0.6979738",
"0.68740857",
"0.6842",
"0.66338825",
"0.64084846",
"0.6387736",
"0.63693017",
"0.63487804",
"0.6308002",
"0.6259161",
"0.62032235",
"0.6162776",
"0.6132268",
"0.60948944",
"0.60745436",
"0.6007758",
"0.5989177",
"0.5935713",
"0.5825341",
"0.5811896",
"0.57086027",
"0.56882143",
"0.5682866",
"0.5656997",
"0.5608989",
"0.56018186",
"0.5598056"
] |
0.8912666
|
0
|
remove reward points from total if click on rmove points
|
function fp_remove_fee_from_cart()
{
if(isset($_POST['fp_remove_points'])) {
remove_action( 'woocommerce_cart_calculate_fees', array( $this , 'fp_woo_add_cart_fee' ),10,1);
$_SESSION['fp_action']="remove";
}
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function recordPointsForOrderEvent($observer){\n\t\tif(Mage::getStoreConfig('rewardpointspro/rewardpointspro/enabled')&& Mage::getStoreConfig('rewardpointspro/display/product_rewards')){ \n\t\t\t$order = $observer->getEvent()->getOrder();\n\t\t\t$items =$order->getItemsCollection();\n\t\t\t$customer_id_from_event = $order->getCustomerId();\n\t\t\t$customerId = Mage::getSingleton('checkout/session')->getQuote()->getShippingAddress()->getCustomerId();\n\t\t\t$rewardPoints = 0;\n\t\t\t$prodIds = array();\n\t\t\tforeach ($items as $_item) {\n\t\t\t\t$prodIds[] = $_item->getProductId();\n\t\t\t}\n\t\t\t$prod = Mage::getResourceModel('catalog/product_collection')->addAttributeToSelect('reward_points_pro')->addIdFilter($prodIds);\n\t\t\t//sum up points per product per quantity\n\t\t\tforeach ($items as $_item) {\n\t\t\t$rewardPoints += $prod->getItemById($_item->getProductId())->getRewardPointsPro() * $_item->getQtyOrdered();\n\t\t\t}\n\t\t\t//record points for item into db\n\t\t\t$this->recordPoints($rewardPoints, $customerId);\n\t\t\t$discounted = Mage::getSingleton('customer/session')->getApplyPoints();\n\t\t\t//subtract points for this order\n\t\t\t$this->useCouponPoints($discounted, $customerId); \n\t\t \n\t\t}\n\t\tMage::getSingleton('customer/session')->setdisc(0);\n\t}",
"public function loseReputation($points)\n {\n $this->decrement('reputation', $points);\n }",
"public function removePoints(int $points) {\n\t\t$this->sumPoints -= $points;\n\t\treturn $this;\n\t}",
"public function Reset(){\r\n\t\t$this->points = 0;\r\n\t }",
"private function removeRoutePoints($route)\n {\n $em = $this->getDoctrine()->getManager();\n $routePoints = $route->getRoutePoints();\n foreach ($routePoints as $routePoint) {\n $em->remove($routePoint);\n }\n }",
"private function clearTotals()\n {\n $this->totalAmount = 0;\n $this->frequentRenterPoints = 0;\n }",
"public function mycred_pro_reward_order_points( $order_id ){\n\n\t\tif ( ! function_exists( 'mycred' ) ) return;\n\n\t\t// Get Order\n\t\t$order = wc_get_order( $order_id );\n\n\t\t$items_number = 0;\n\t\tforeach ( $order->get_items() as $item_id => $item ) {\n\t\t\t$quantity = $item->get_quantity();\n\t\t\t$items_number += $quantity;\n\t\t}\n\n\t\t// Load myCRED\n\t\t$mycred = mycred();\n\n\t\t// Do not payout if order was paid using points\n\t\tif ( $order->get_payment_method() == 'mycred' ) return;\n\n\t\tif ( ! $mycred ) return;\n\n\t\t// Make sure user only gets points once per order\n\t\tif ( $mycred->has_entry( 'reward', $order_id, $order->get_user_id() ) ) return;\n\n\t\t// Reward example 10 * order items in points.\n\t\t$reward = 10 * $items_number;\n\n\t\t// Add reward\n\t\t$mycred->add_creds(\n\t\t\t'reward',\n\t\t\t$order->get_user_id(),\n\t\t\t$reward,\n\t\t\t'Reward for store purchase',\n\t\t\t$order_id,\n\t\t\tarray( 'ref_type' => 'post' )\n\t\t);\n\t}",
"public static function update_reward_points_for_google_plus_share() {\n $userid = get_current_user_id();\n global $wpdb;\n $table_name = $wpdb->prefix . 'rspointexpiry'; \n $banning_type = FPRewardSystem::check_banning_type($userid);\n if ($banning_type != 'earningonly' && $banning_type != 'both') {\n if (get_option('timezone_string') != '') {\n $timezonedate = date_default_timezone_set(get_option('timezone_string'));\n } else {\n $timezonedate = date_default_timezone_set('UTC');\n }\n\n if (isset($_POST['state']) && ($_POST['postid']) && ($_POST['currentuserid'])) {\n $getregularprice = RSFunctionForSavingMetaValues::rewardsystem_get_post_meta($_POST['postid'], '_regular_price');\n $postid = $_POST['postid'];\n $currentuserid = $_POST['currentuserid']; \n $getarrayids[] = $_POST['postid'];\n $oldoption = RSFunctionForSavingMetaValues::rewardsystem_get_user_meta($_POST['currentuserid'], '_rsgoogleshares');\n if (!empty($oldoption)) {\n if (!in_array($_POST['postid'], $oldoption)) {\n $mergedata = array_merge((array) $oldoption, $getarrayids);\n RSFunctionForSavingMetaValues::rewardsystem_update_user_meta($_POST['currentuserid'], '_rsgoogleshares', $mergedata);\n if ($_POST['state'] == 'on') {\n $checklevel = self::checklevel_for_google_plus_share($postid);\n $orderid = '0';\n $totalearnedpoints = '0';\n $totalredeempoints= '0';\n $pointsredeemed = '0';\n $reasonindetail= '';\n self::rs_insert_google_plus_share_points($pointsredeemed,$getregularprice,$postid, $checklevel,$currentuserid,$orderid,$totalearnedpoints,$totalredeempoints,$reasonindetail); \n }\n }else {\n _e('You already Shared this post on Goole+1', 'rewardsystem');\n }\n }else {\n RSFunctionForSavingMetaValues::rewardsystem_update_user_meta($_POST['currentuserid'], '_rsgoogleshares', $getarrayids);\n if ($_POST['state'] == 'on') {\n $checklevel = self::checklevel_for_google_plus_share($postid);\n $orderid = '0';\n $totalearnedpoints = '0';\n $totalredeempoints= '0';\n $pointsredeemed = '0';\n $reasonindetail= '';\n self::rs_insert_google_plus_share_points($pointsredeemed,$getregularprice,$postid, $checklevel,$currentuserid,$orderid,$totalearnedpoints,$totalredeempoints,$reasonindetail); \n }\n }\n \n if ($_POST['state'] == 'off') {\n $getarrayunlikeids[] = $_POST['postid'];\n $oldunlikeoption = RSFunctionForSavingMetaValues::rewardsystem_get_user_meta($_POST['currentuserid'], '_rsgoogleplusunlikes');\n if (!empty($oldunlikeoption)) {\n if (!in_array($_POST['postid'], $oldunlikeoption)) {\n $mergedunlikedata = array_merge((array) $oldunlikeoption, $getarrayunlikeids);\n RSFunctionForSavingMetaValues::rewardsystem_update_user_meta($_POST['currentuserid'], '_rsgoogleplusunlikes', $mergedunlikedata);\n $checklevel = self::checklevel_for_google_plus_share($postid);\n $orderid = '0';\n $totalearnedpoints = '0';\n $totalredeempoints= '0';\n $pointsredeemed = '0';\n $reasonindetail= '';\n self::rs_insert_google_plus_share_revised_points($pointsredeemed,$getregularprice,$postid, $checklevel,$currentuserid,$orderid,$totalearnedpoints,$totalredeempoints,$reasonindetail);\n }\n } else {\n RSFunctionForSavingMetaValues::rewardsystem_update_user_meta($_POST['currentuserid'], '_rsgoogleplusunlikes', $getarrayunlikeids);\n $checklevel = self::checklevel_for_google_plus_share($postid);\n $orderid = '0';\n $totalearnedpoints = '0';\n $totalredeempoints= '0';\n $pointsredeemed = '0';\n $reasonindetail= '';\n self::rs_insert_google_plus_share_revised_points($pointsredeemed,$getregularprice,$postid, $checklevel,$currentuserid,$orderid,$totalearnedpoints,$totalredeempoints,$reasonindetail);\n }\n }\n echo \"Ajax Call Successfully Triggered\"; \n }\n do_action('fp_reward_point_for_google_plus_share');\n exit();\n }\n }",
"function wpachievements_wordpress_post_del($pid){\r\n if( !empty($pid) ){\r\n $pdata = get_post($pid);\r\n if( $pdata->post_author && $pdata->post_status == 'trash' && $pdata->post_type == 'post' ){\r\n $type='post_remove'; $uid=$pdata->post_author; $postid=$pid;\r\n if( !function_exists(WPACHIEVEMENTS_CUBEPOINTS) && !function_exists(WPACHIEVEMENTS_MYCRED) ){\r\n if(function_exists('is_multisite') && is_multisite()){\r\n $points = (int)get_blog_option(1, 'wpachievements_post_points');\r\n } else{\r\n $points = (int)get_option('wpachievements_post_points');\r\n }\r\n }\r\n if(empty($points)){$points=0;}\r\n wpachievements_new_activity($type, $uid, $postid, -$points);\r\n }\r\n }\r\n }",
"public function redeemAction(){\n $txtRedeemPoints = $_POST['txtRedeemPoints'];\n $quoteData = Mage::getSingleton('checkout/session')->getQuote();\n \n $CartContentsTotal = $quoteData['subtotal'];\n $CartTotal = $quoteData['grand_total'];\n \n if(!empty($txtRedeemPoints)){\n $LB_Session = $_SESSION['LB_Session'];\n if (!empty($LB_Session)) {\n // confirm loyalty points available or not and update to session if available.\n $CardOrPhoneNumber = $LB_Session['Phone Number'];\n $CardPoints = Lb_Points_Helper_Data::getCardPoints($CardOrPhoneNumber);\n $InquiryResult = $CardPoints->InquiryResult;\n $balances = $InquiryResult->balances;\n $Balance = $balances->balance;\n foreach ($Balance as $balValue) {\n if ($balValue->valueCode == 'Discount') {\n $_SESSION['LB_Session']['lb_discount'] = $balValue->amount;\n $_SESSION['LB_Session']['lb_discount_difference'] = $balValue->difference;\n $_SESSION['LB_Session']['lb_discount_exchangeRate'] = $balValue->exchangeRate;\n } elseif ($balValue->valueCode == 'Points') {\n $_SESSION['LB_Session']['lb_points'] = $balValue->amount;\n $_SESSION['LB_Session']['lb_points_difference'] = $balValue->difference;\n $_SESSION['LB_Session']['lb_points_exchangeRate'] = $balValue->exchangeRate;\n } elseif ($balValue->valueCode == 'ZAR') {\n $_SESSION['LB_Session']['lb_zar'] = $balValue->amount;\n $_SESSION['LB_Session']['lb_zar_difference'] = $balValue->difference;\n $_SESSION['LB_Session']['lb_zar_exchangeRate'] = $balValue->exchangeRate;\n }\n }\n Lb_Points_Helper_Data::debug_log(\"LB API called : Inquiry to check Points Balance\", true);\n \n $totalRedeemPoints = 0;\n if(isset($_SESSION['LB_Session']['totalRedeemPoints']))\n {\n if($_SESSION['LB_Session']['totalRedeemPoints'] > 0){\n $totalRedeemPoints = $_SESSION['LB_Session']['totalRedeemPoints'] + $txtRedeemPoints;\n }\n }\n \n if($totalRedeemPoints == 0){\n $totalRedeemPoints = $txtRedeemPoints;\n }\n \n if ($txtRedeemPoints > 0 && $totalRedeemPoints <= $CartTotal && is_numeric($txtRedeemPoints)) {\n \n if ($_SESSION['LB_Session']['lb_points'] >= $totalRedeemPoints) {\n //self::generate_discount_coupon($txtRedeemPoints, 'fixed_cart', 'REDEEM');\n if(isset($_SESSION['LB_Session']['totalRedeemPoints']))\n {\n if($_SESSION['LB_Session']['totalRedeemPoints'] > 0){\n $_SESSION['LB_Session']['totalRedeemPoints'] = $_SESSION['LB_Session']['totalRedeemPoints'] + $txtRedeemPoints;\n }\n else\n $_SESSION['LB_Session']['totalRedeemPoints'] = $txtRedeemPoints;\n }\n else\n {\n $_SESSION['LB_Session']['totalRedeemPoints'] = $txtRedeemPoints;\n }\n $message = \"You have redeemed \".$_SESSION['LB_Session']['totalRedeemPoints'].\" Loyalty Points successfully and applied discount to your cart.\";\n $messageJson = \"You have redeemed \".$_SESSION['LB_Session']['totalRedeemPoints'].\" Loyalty Points successfully and discount is being applied to your cart.\";\n Mage::getSingleton('core/session')->addSuccess($message);\n echo json_encode(array('status' => 1, 'message' => $messageJson));\n }else {\n echo json_encode(array('status' => 0, 'message' => \"You don't have sufficient Loyalty Points to redeem.\"));\n }\n } else {\n echo json_encode(array('status' => 0, 'message' => \"Please enter valid Loyalty Points.\"));\n }\n }\n else\n echo json_encode(array('status' => 0, 'message' => Lb_Points_Helper_Data::$rewardProgrammeName.\" session expired.\"));\n }\n else\n echo json_encode(array('status' => 0, 'message' => \"Please enter loyalty points.\"));\n die;\n }",
"public function create_ubib_points($customer_id,$order_id,$total){\r\n $points = floor($total/10)*100;\r\n if($points>0){\r\n $this->language->load('total/reward'); \r\n $query = $this->db->query(\"INSERT INTO \" . DB_PREFIX . \"customer_reward SET customer_id = '\" . (int)$customer_id . \"', description = '\" . $this->db->escape(sprintf($this->language->get('text_order_id'), (int)$order_id)) . \"', points = '\" . (int)$points . \"', date_added = NOW()\");\r\n }\r\n \r\n //Convert to credits (1000 points => 1 credit)\r\n $query = $this->db->query(\"SELECT SUM(points) AS total FROM `\" . DB_PREFIX . \"customer_reward` WHERE customer_id = '\" . (int)$customer_id . \"' GROUP BY customer_id\");\r\n if ($query->row) {\r\n $credit = 0;\r\n $credit = floor($query->row['total']/1000); \r\n if($credit>0){\r\n $redeem_points = $credit * 1000;\r\n $this->db->query(\"INSERT INTO \" . DB_PREFIX . \"customer_transaction SET customer_id = '\" . (int)$customer_id . \"', order_id = '\" . (int)$order_id . \"', description = 'Converted \".$redeem_points.\" Points To \".$credit.\" Credits', amount = '\" . (float)$credit . \"', date_added = NOW()\");\r\n $query = $this->db->query(\"INSERT INTO \" . DB_PREFIX . \"customer_reward SET customer_id = '\" . (int)$customer_id . \"', description = 'Converted \".$redeem_points.\" Points To \".$credit.\" Credits', points = '\" . (float)-$redeem_points . \"', date_added = NOW()\");\r\n }\r\n }\r\n return true;\r\n }",
"public static function decreasePointsUser($member_id, $pointsToDecrease, $isRecruiter){\n\t\t\n\t\tglobal $db; \n\t\t\n\t\tif ($isRecruiter == 0) {\n\t\t\t//set query\n\t\t\t$query_text = \"UPDATE points_users SET current_amount = current_amount - :pointsToDecrease \n\t\t\tWHERE user_id = :member_id\";\n\t\t}\n\t\telse {\n\t\t\t//set query\n\t\t\t$query_text = \"UPDATE points_recruiters SET current_amount = current_amount - :pointsToDecrease \n\t\t\tWHERE recruiter_id = :member_id\";\n\t\t}\n\t\t\n\t\t\t\n\t\ttry {\n\t\t\t//prepare query\n\t\t\t$query_statement = $db->prepare($query_text);\n\t\t\t//bind\n\t\t\t$query_statement->bindValue(':pointsToDecrease', $pointsToDecrease);\n\t\t\t$query_statement->bindValue(':member_id', $member_id);\n\t\t\t//execute query\n\t\t\t$query_statement->execute();\n\t\t}\n\t\t\t\n\t\tcatch (PDOException $ex) {\n\t\t$error_message = $ex->getMessage();\n\t\t$result = array('error_message' => $error_message);\n\t\treturn $result;\n\t\t}\n\t\t\n\t\t//no errors, return null\n\t\treturn null;\n\t\t\n\t}",
"function points_vouchers()\n\t\t{\n\t\t\tif ( ! $this->data['user'])\n\t\t\t{\n\t\t\t\t$this->flexi_cart_admin->set_error_message('You must login to view reward points and vouchers.', 'public', TRUE);\n\t\t\t\tredirect('login');\n\t\t\t}\n\n\t\t\t$user_id = $this->data['user']->id;\n\n\t\t\t$this->load->library('flexi_cart_admin');\n\n\t\t\t$this->load->model('demo_cart_admin_model');\n\n\t\t\t// Check if POST data has been submitted, if so, call the custom demo model function to handle the submitted data.\n\t\t\tif ($this->input->post('convert_reward_points'))\n\t\t\t{\n\t\t\t\t$this->demo_cart_admin_model->demo_convert_reward_points($user_id);\n\t\t\t\t// Set a message to the CI flashdata so that it is available after the page redirect.\n\t\t\t\t$this->session->set_flashdata('message', $this->flexi_cart->get_messages());\n\t\t\t\tredirect(current_url());\n\t\t\t}\n\n\t\t\t$this->load->model('users_model');\n\n\t\t\t// Variable \"person\" is used because \"user\" is already being used for currently signed in user.\n\t\t\t$this->data['person'] = $this->users_model->get_details($user_id);\n\n\t\t\t// Get an array of all the reward vouchers filtered by the id in the url.\n\t\t\t// Using flexi cart SQL functions, join the demo user table with the discount table.\n\t\t\t$sql_where = array($this->flexi_cart_admin->db_column('discounts', 'user') => $user_id);\n\t\t\t// $this->flexi_cart_admin->sql_join('demo_users', 'user_id = '.$this->flexi_cart_admin->db_column('discounts', 'user'));\n\t\t\t$this->data['voucher_data_array'] = $this->flexi_cart_admin->get_db_voucher_query(FALSE, $sql_where)->result_array();\n\n\t\t\t// Get user remaining reward points.\n\t\t\t$summary_data = $this->flexi_cart_admin->get_db_reward_point_summary($user_id);\n\t\t\t$this->data['points_data'] = array(\n\t\t\t\t'total_points' => $summary_data[$this->flexi_cart_admin->db_column('reward_points', 'total_points')],\n\t\t\t\t'total_points_pending' => $summary_data[$this->flexi_cart_admin->db_column('reward_points', 'total_points_pending')],\n\t\t\t\t'total_points_active' => $summary_data[$this->flexi_cart_admin->db_column('reward_points', 'total_points_active')],\n\t\t\t\t'total_points_active' => $summary_data[$this->flexi_cart_admin->db_column('reward_points', 'total_points_active')],\n\t\t\t\t'total_points_expired' => $summary_data[$this->flexi_cart_admin->db_column('reward_points', 'total_points_expired')],\n\t\t\t\t'total_points_converted' => $summary_data[$this->flexi_cart_admin->db_column('reward_points', 'total_points_converted')],\n\t\t\t\t'total_points_cancelled' => $summary_data[$this->flexi_cart_admin->db_column('reward_points', 'total_points_cancelled')]\n\t\t\t);\n\n\t\t\t// Get an array of a demo user and their related reward points from a custom demo model function, filtered by the id in the url.\n\t\t\t$reward_data = $this->demo_cart_admin_model->demo_reward_point_summary($user_id);\n\t\t\t\n\t\t\t// Note: The custom function returns a multi-dimensional array, of which we only need the first array, so get the first row '$user_data[0]'.\n\t\t\t$this->data['reward_data'] = $reward_data[0];\n\n\t\t\t// Get the conversion tier values for converting reward points to vouchers.\n\t\t\t$conversion_tiers = $this->data['reward_data'][$this->flexi_cart_admin->db_column('reward_points', 'total_points_active')];\n\t\t\t$this->data['conversion_tiers'] = $this->flexi_cart_admin->get_reward_point_conversion_tiers($conversion_tiers);\n\n\t\t\t// Get an array of all reward points for a user.\n\t\t\t$sql_select = array(\n\t\t\t\t$this->flexi_cart_admin->db_column('reward_points', 'order_number'),\n\t\t\t\t$this->flexi_cart_admin->db_column('reward_points', 'description'),\n\t\t\t\t$this->flexi_cart_admin->db_column('reward_points', 'order_date')\n\t\t\t);\t\n\t\t\t$sql_where = array($this->flexi_cart_admin->db_column('reward_points', 'user') => $user_id);\n\t\t\t$this->data['points_awarded_data'] = $this->flexi_cart_admin->get_db_reward_points_query($sql_select, $sql_where)->result_array();\n\t\t\t\n\t\t\t// Call a custom function that returns a nested array of reward voucher codes and the reward point data used to create the voucher.\n\t\t\t$this->data['points_converted_data'] = $this->demo_cart_admin_model->demo_converted_reward_point_history($user_id);\n\n\t\t\t// Get any status message that may have been set.\n\t\t\t$this->data['message'] = $this->session->flashdata('message');\n\n\t\t\t$this->load->view('public/dashboard/points_and_vouchers_view', $this->data);\n\t\t}",
"function cfc_edd_replace_final_total() {\n\tremove_action( 'edd_purchase_form_before_submit', 'edd_checkout_final_total', 999 );\n}",
"public function decreaseAmount(): void;",
"function bp_course_remove_quiz_results() {\n\tglobal $bp;\n\n\t/**\n\t * When clicking on a screen notification, we need to remove it from the menu.\n\t * The following command will do so.bp_notifications_delete_notifications_by_type\n \t */\n\tbp_notifications_delete_notifications_by_type( $bp->loggedin_user->id, $bp->course->slug, 'quiz_results' );\n}",
"function getSubroundPoints($result)\n\t{\n\t\t$points = $result->bonus_points;\n\t\tif (!empty($result->points_attribution) && $result->rank)\n\t\t{\n\t\t\t$points_attrib = explode(',', $result->points_attribution);\n\t\t\tJArrayHelper::toInteger($points_attrib);\n\t\t\tif ( isset( $points_attrib[$result->rank-1] ) ) {\n\t\t\t\t$points += $points_attrib[$result->rank-1];\n\t\t\t}\n\t\t}\n\t\treturn $points;\n\t}",
"public function purchase_return_unsaved_delete()\n {\n $purchase_return_no = $this->input->post(\"purchase_return_no\");\n /** Remove auto created purchase journal */\n $journal = $this->MAc_journal_master->get_by_doc('Purchase Return', $purchase_return_no);\n if (count($journal) > 0)\n {\n $this->MAc_journal_details->delete_by_journal_no($journal['journal_no']);\n $this->MAc_journal_master->delete_by_journal_no($journal['journal_no']);\n }\n /** Remove auto created payment receipt for partial or full cash purchase */\n $payment = $this->MAc_payment_receipts->get_by_doc('Purchase', $purchase_return_no);\n if (count($payment) > 0)\n {\n $this->MAc_payment_receipts->delete($payment['id']);\n }\n /** Remove purchase */\n $this->MPurchase_return_details->delete_by_purchase_return_no($purchase_return_no);\n $this->MPurchase_return_master->delete_by_purchase_return_no($purchase_return_no);\n }",
"public function releaseRefPointsOnEveryShoping()\n {\n \t//More you pay less you release.\n \t//Get the points for other shops.\n }",
"public static function clearRewardRankUser($uid)\n {\n Bll_Cache::delete(self::getCacheKey('getMaxRewardRankUserInFriend', $uid));\n Bll_Cache::delete(self::getCacheKey('getMaxRewardRankUserInAll', $uid));\n }",
"public function AddTotalPoints($points){\r\n\t\t$this -> totalPoints += $points; \r\n\t }",
"public function unRate()\n {\n\n }",
"public static function update_reward_points_for_twitter_tweet() {\n $userid = get_current_user_id();\n global $wpdb;\n $table_name = $wpdb->prefix . 'rspointexpiry'; \n $banning_type = FPRewardSystem::check_banning_type($userid);\n if ($banning_type != 'earningonly' && $banning_type != 'both') {\n if (get_option('timezone_string') != '') {\n $timezonedate = date_default_timezone_set(get_option('timezone_string'));\n } else {\n $timezonedate = date_default_timezone_set('UTC');\n }\n\n if (isset($_POST['state']) && ($_POST['postid']) && ($_POST['currentuserid'])) {\n $getregularprice = RSFunctionForSavingMetaValues::rewardsystem_get_post_meta($_POST['postid'], '_regular_price');\n $postid = $_POST['postid'];\n $currentuserid = $_POST['currentuserid']; \n $getarrayids[] = $_POST['postid'];\n $oldoption = RSFunctionForSavingMetaValues::rewardsystem_get_user_meta($_POST['currentuserid'], '_rstwittertweet');\n if (!empty($oldoption)) {\n if (!in_array($_POST['postid'], $oldoption)) {\n $mergedata = array_merge((array) $oldoption, $getarrayids);\n RSFunctionForSavingMetaValues::rewardsystem_update_user_meta($_POST['currentuserid'], '_rstwittertweet', $mergedata);\n if ($_POST['state'] == 'on') {\n $checklevel = self::checklevel_for_twitter_tweet($postid);\n $orderid = '0';\n $totalearnedpoints = '0';\n $totalredeempoints= '0';\n $pointsredeemed = '0';\n $reasonindetail= '';\n self::rs_insert_twitter_tweet_points($pointsredeemed,$getregularprice,$postid, $checklevel,$currentuserid,$orderid,$totalearnedpoints,$totalredeempoints,$reasonindetail); \n }\n }else {\n _e('You already Tweet this post', 'rewardsystem');\n }\n }else {\n RSFunctionForSavingMetaValues::rewardsystem_update_user_meta($_POST['currentuserid'], '_rstwittertweet', $getarrayids);\n if ($_POST['state'] == 'on') {\n $checklevel = self::checklevel_for_facebook_like($postid);\n $orderid = '0';\n $totalearnedpoints = '0';\n $totalredeempoints= '0';\n $pointsredeemed = '0';\n $reasonindetail= '';\n self::rs_insert_twitter_tweet_points($pointsredeemed,$getregularprice,$postid, $checklevel,$currentuserid,$orderid,$totalearnedpoints,$totalredeempoints,$reasonindetail); \n }\n } \n echo \"Ajax Call Successfully Triggered\"; \n }\n do_action('fp_reward_point_for_twitter_tweet');\n exit();\n }\n }",
"public function removePoint(int $point): M_member\n\t{\n\n\t\t$this->db->set($this->pointField(), $this->point - $point);\n\t\t$this->db->where($this->idField(), $this->id);\n\t\t$this->db->update($this->tableName());\n\n\t\treturn $this->getData();\n\t}",
"function removeCredit($credit, $id) { // promo-product.php, single-product.php\r\n\r\n\tglobal $mysqli,$db_table_prefix; \r\n\r\n\t\t$stmt = $mysqli->prepare(\"UPDATE \".$db_table_prefix.\"user_credits\r\n\r\n\t\t\tSET\r\n\r\n\t\t\tcredits = credits - ?\r\n\r\n\t\t\tWHERE\r\n\r\n\t\t\tuser_id = ?\r\n\t\t\t\r\n\t\t\tAND credits > 0\");\r\n\r\n\t$stmt->bind_param(\"ii\", $credit, $id);\r\n\r\n\t$result = $stmt->execute();\r\n\r\n\t$stmt->close();\t\r\n\r\n\treturn $result;\r\n\r\n}",
"function userAddPoints($points)\n\t{\n\t\t$pns = $this->DB->database_select('users', 'points', array('username' => session_get('username')), 1);\n\t\t$add_points = $pns['points'] + $points;\n\t\t$gid = $this->user_getgroup();\n\t\t$next_gid = $gid+1;\n\t\t$points_required = $this->DB->database_select('groups', '*', array('gid' => $next_gid), 1); //Has user has acquired enough points to make a new group rank?\n\t\t$points_required = $points_required['points'];\n\t\t$newPnts = $this->DB->database_update('users',\n\t\t\t\t\t\t array('points' => $add_points), array('username' => session_get('username')));\n\t\tif($add_points >= $points_required && $gid < 4) //User has made enough points to progress rank!\n\t\t{\n\t\t\t$this->doPromote = true;\n\t\t\t$this->DB->database_update('users', array('gid' => $next_gid), array('username' => session_get('username')));\n\t\t}\n\t}",
"function movechar()\r\n{\r\n require_once(\"heading.php\");\r\n mysql_select_db($mmfpm_db['addr'], $mmfpm_db['user'], $mmfpm_db['pass']) ;\r\n $total_points = mysql_fetch_row(mysql_query(\"SELECT `points` FROM point_system WHERE `accountid` = '$user_id';\"));\r\n $total_points = $total_points[0];\r\n if($total_points <= 0)\r\n $total_points = (int)0;\r\n $move_char = $_GET[\"char\"];\r\n\r\nif($total_points > ($move_char_cost-1))\r\n {\r\n mysql_select_db($mmfpm_db['addr'], $mmfpm_db['user'], $mmfpm_db['pass']) ;\r\n if($user_name != NULL)\r\n mysql_query(\"INSERT INTO point_system_requests (`username`, `request`, `date`, `code`, `treated`) VALUES ('$user_name', 'Move Char', '$datetime', '$move_char', 'No');\");\r\n else mysql_query(\"INSERT INTO point_system_requests (`username`, `request`, `date`, `code`, `treated`) VALUES ('$user_name', '$move_char', '$datetime', 'Error!!', 'No');\");\r\n mysql_query(\"UPDATE point_system SET `points` = `points` - $move_char_cost WHERE `accountid` = '$user_id';\");\r\n $output .= \"<div class=\\\"top\\\"><h1>$user_name, Your char has been flagged for account move, Contact a GM ingame.</h1></div><center>\";\r\n }\r\nelse $output .= \"<div class=\\\"top\\\"><h1>$user_name, you do not have enough points to move $move_char!</h1></div><center>\";\r\n\r\n require_once(\"footer.php\");\r\n}",
"public function redeembivapoints($orderId){\n\t\t$this->db->where('CustomerMail', $this->session->userdata('useremail'));\n\t\t$this->db->select_sum('EarnedPotint');\n\t\t$this->db->from('tbl_bvpoint_data');\n\t\t$query = $this->db->get();\n\t\t$sumvalue=$query->row()->EarnedPotint;\n\t\t//echo $sumvalue;\n\t\tif($sumvalue>100){\n\t\t\t$redeempoint=100;\n\t\t}\n\t\telse{\n\t\t\t$redeempoint=$sumvalue;\n\t\t}\n\n\t\t$redeempoint=-1*abs($redeempoint);\n\t\t$note=\"Purchased (#ORDBPH\".$orderId.\") And Redeemed \".$redeempoint.\" Biva Points\";\n\t\t$data=array(\n\t\t\t'CustomerMail' => $this->session->userdata('useremail'),\n\t\t\t'TrDate' => date('Y/m/d H:i:s'),\n\t\t\t'OrderId' => $orderId,\n\t\t\t'ReferedTo' => null,\n\t\t\t'EarnedPotint' => $redeempoint,\n\t\t\t'Note' => $note,\n\n\t\t);\n\t\t$this->db->insert('tbl_bvpoint_data', $data);\n\t}",
"public function delete_gread_point($id = null){\n $this->db->delete('msit_tb_grade_point', array('id' => $id));\n if($this->db->affected_rows()==1){\n return TRUE ;\n }\n else {\n return FALSE;\n }\n }",
"function setReward($points, $rewardArray, $name, $email){\n\t\tif(($rewardArray['500'] != 500) && ($points >= 500)){ //one time award at 500 points\n\t\t\t$rewardArray['100'] += 100;\n\t\t\t$reward = \"100 => \".$rewardArray['100'].\", 250 => \".$rewardArray['250'].\", 500 => 500\";\n\t\t\t$sql = \"UPDATE users SET reward = '$reward' \";\n\t\t\t$result = $this->db->query($sql);\n\n\t\t\t$code = 'Chat_'.RandomString(10);\n\t\t\t$ckey = '';\n\n\t\t\t$this->createCoupon($code, $ckey, $email);\n\t\t\t$this->sendReward('Have an interview with our expert staff and be highlighted on our blog and homepage.', $name, $email, $code);\n\t\t} elseif($points >= $rewardArray['100']){ // every 100\n\t\t\t$rewardArray['100'] += 100;\n\t\t\t$reward = \"100 => \".$rewardArray['100'].\", 250 => \".$rewardArray['250'].\", 500 =>\".$rewardArray['500'];\n\t\t\t$sql = \"UPDATE users SET reward = '$reward' \";\n\t\t\t$result = $this->db->query($sql);\n\n\t\t\t$code = 'rew_'.RandomString(16);\n\t\t\t$ckey = 6;\n\n\t\t\t$this->createCoupon($code, $ckey, $email);\n\t\t\t$this->sendReward('20% off any single non-sale item', $name, $email, $code); \n\t\t}\n\t\t\n\t\tif($points > $rewardArray['250']){ //every 250\n\t\t\t$rewardArray['250'] += 250;\n\t\t\t$reward = \"100 => \".$rewardArray['100'].\", 250 => \".$rewardArray['250'].\", 500 =>\".$rewardArray['500'];\n\t\t\t$sql = \"UPDATE users SET reward = '$reward' \";\n\t\t\t$result = $this->db->query($sql);\n\n\t\t\t$code = 'rew_'.RandomString(16);\n\t\t\t$ckey = 2;//free shipping coupon\n\n\t\t\t$this->createCoupon($code, $ckey, $email);\n\t\t\t$this->sendReward('Free Ground shipping for US domestic or $10 off intenational shipping', $name, $email, $code);\n\t\t}\n\t\t\n\t}"
] |
[
"0.5524159",
"0.55164236",
"0.5390801",
"0.53683394",
"0.52578336",
"0.5231011",
"0.5196771",
"0.5195829",
"0.51924425",
"0.51771134",
"0.5172932",
"0.51274896",
"0.51135427",
"0.5087049",
"0.5083353",
"0.49975634",
"0.4995671",
"0.49913675",
"0.4972543",
"0.49593985",
"0.49576995",
"0.493082",
"0.49292973",
"0.49285728",
"0.4916381",
"0.49036345",
"0.49035013",
"0.48848057",
"0.4884504",
"0.48735783"
] |
0.56512547
|
0
|
Load validation class map
|
private function loadValidationClassMap(Finder $finder)
{
$classMap = [];
foreach ($finder as $file) {
$document = new \DOMDocument();
$document->load($file);
$xpath = new \DOMXPath($document);
$xpath->registerNamespace('constraint', 'http://symfony.com/schema/dic/constraint-mapping');
$classMap = array_reduce(
iterator_to_array($xpath->query('//constraint:class')),
function (array $classMap, \DOMElement $element) {
$classMap[$element->getAttribute('name')] = $element;
return $classMap;
},
$classMap
);
}
return $classMap;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function load(...$classes)\n\t{\n\t\tforeach ($classes as $key => $routes) \n\t\t{\n\t\t\t$this->getValidatorInstance($routes);\n\t\t}\n\t}",
"public static function loadCustomValidators(){\n\t\t// Preload all the validation rules you've linked up and plan to use.\n\t\t// This isn't done automatically. If it were, object inheritance might break.\n\t\t\n\t\tRun::fromFormValidators('CustomValidators/ValidPassword.php');\n\t}",
"private function ensureNameMapsLoaded(): void\n {\n if (null === $this->tableToClassesMap) {\n $this->loadNameMaps();\n }\n }",
"public function getClassMap()\n {\n return array();\n }",
"public function validateClasses()\n\t{\n\t\tforeach ($this->config->getConfigNode() as $libs) {\n\t\t\tforeach ($libs as $lib) {\n\t\t\t\tif (!$this->isClassValid($lib->class, IMetric::class)) {\n\t\t\t\t\t$this->addClassError($lib->class);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}",
"private function loadSchemaClassMap(Finder $finder)\n {\n $classMap = [];\n foreach ($finder as $file) {\n $schema = json_decode(file_get_contents($file), true);\n\n if (!isset($schema['x-documentClass'])) {\n continue;\n }\n\n foreach ($schema['required'] as $field) {\n $classMap[$schema['x-documentClass']][$field]['required'] = true;\n }\n foreach ($schema['searchable'] as $field) {\n $classMap[$schema['x-documentClass']][$field]['searchable'] = 1;\n }\n foreach ($schema['readOnlyFields'] as $field) {\n $classMap[$schema['x-documentClass']][$field]['readOnly'] = true;\n }\n\n // flags from fields\n if (is_array($schema['properties'])) {\n foreach ($schema['properties'] as $fieldName => $field) {\n if (isset($field['recordOriginException']) && $field['recordOriginException'] == true) {\n $classMap[$schema['x-documentClass']][$fieldName]['recordOriginException'] = true;\n }\n if (isset($field['x-restrictions'])) {\n $classMap[$schema['x-documentClass']][$fieldName]['restrictions'] = $field['x-restrictions'];\n } else {\n $classMap[$schema['x-documentClass']][$fieldName]['restrictions'] = [];\n }\n }\n }\n\n if (isset($schema['solr']) && is_array($schema['solr']) && !empty($schema['solr'])) {\n $classMap[$schema['x-documentClass']]['_base']['solr'] = $schema['solr'];\n } else {\n $classMap[$schema['x-documentClass']]['_base']['solr'] = [];\n }\n }\n\n return $classMap;\n }",
"private function load_classes() {\n\n\t\t\trequire_once ASCRIPTA_ENGINE_ADMIN_PATH . 'class-ae-settings.php';\n\n\t\t}",
"private function loadClass() {\n $this->_instances = array();\n\n $this->_instances['log'] = new Log();\n if(ENVIRONMENT == self::ENVIRONMENT_DEV) {\n $this->_instances['debug'] = new Debug();\n $this->_instances['panel'] = new Panel();\n }\n $this->_instances['controller'] = null;\n $this->_instances['configuration'] = new Configuration();\n $this->_instances['routing'] = new Routing();\n }",
"public function getValidClasses(): array\n {\n return $this->validClasses;\n }",
"function load($classmap, $base = null) {\n spl_autoload_register(function($class) use ($classmap, $base) {\n $class = strtolower($class);\n if(!isset($classmap[$class])) return false;\n if($base) {\n include($base . DS . $classmap[$class]); \n } else {\n include($classmap[$class]);\n }\n });\n}",
"protected function loadMapBuilderClasses()\n {\n $this->table = Doctrine::getTable($this->getClassName());\n }",
"protected function loadClassFiles() {}",
"public static function registerClassLoadingInformation() {}",
"protected function importValidationRules()\n {\n return [];\n }",
"static function get_validation_classes() {\n\t\tif (count(self::$validation_classes) == 0) {\n\n\t\t\t$methodClasses = ClassInfo::subclassesFor('FMValidationMethod');\n\t\t\t$methods = array();\n\n\t\t\tforeach($methodClasses as $class) {\n\t\t\t\tif ($class != 'FMValidationMethod') {\n\t\t\t\t\t$singleton = singleton($class);\n\t\t\t\t\tif ($singleton->ruleName == '') {\n\t\t\t\t\t\ttrigger_error('Validation class '.$class.' has no $ruleName', E_USER_WARNING);\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tif (isset($methods[$singleton->ruleName])) {\n\t\t\t\t\t\ttrigger_error('Validation class with ruleName '.$singleton->ruleName.' already exists ('.$class.' & '.$methods[$singleton->ruleName]->class.')', E_USER_WARNING);\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\t$methods[$singleton->ruleName] = $class;\n\t\t\t\t}\n\t\t\t}\n\t\t\tself::$validation_classes = $methods;\n\t\t}\n\n\t\treturn self::$validation_classes;\n\t}",
"protected function classmapLoader($class) {\n\t\tif (substr($class, 0, 9) == 'Runalyze\\\\') {\n\t\t\trequire_once FRONTEND_PATH.'core/'.str_replace('\\\\', '/', substr($class, 9)).'.php';\n\t\t} elseif (substr($class, 0, 14) == 'RunalyzePlugin') {\n\t\t\trequire_once FRONTEND_PATH.'../plugin/'.$class.'/class.'.$class.'.php';\n\t\t} elseif (isset($this->map[$class])) {\n\t\t\trequire_once FRONTEND_PATH.$this->map[$class];\n\t\t}\n\t}",
"private function loadClasses()\n\t\t{\n\t\t\t// foreach($GLOBALS['classes'] as $var => $class)\n\t\t\t// {\n\t\t\t\t// $this->$var = $class;\n\t\t\t// }\n\t\t\t\n\t\t\t// $this->load = _new('loader');\n\t\t\t\n\t\t\t/** Registramos todos os objetos que serão necessários **/\n\t\t\tforeach(Registry::getAll() as $var => $object)\n\t\t\t{\n\t\t\t\t$this->$var = $object;\n\t\t\t}\n\t\t\t\n\t\t\t// E também a classe loader\n\t\t\t$this->load = Registry::get('loader');\n\t\t}",
"protected function classMap()\n {\n $class_map = new ClassMap();\n\n return $class_map->getMap();\n }",
"public function getClassmap() : array\n {\n return $this->classmap;\n }",
"function loadClassMetadata(Mapping\\ClassMetadataInterface $metadata);",
"function gravitonLoader($qualifiedClassName)\r\n{\r\n return false;\r\n static $map;\r\n static $loadedClasses = array();\r\n if (empty($map)) {\r\n $map = loadFileMap();\r\n }\r\n \r\n $className = array_pop(explode('\\\\', $qualifiedClassName));\r\n \r\n if (in_array($className, $loadedClasses)) {\r\n return true;\r\n }\r\n\r\n if (IsSet($map[$className])) {\r\n include($map[$className]); \r\n $loadedClasses[] = $className;\r\n return true;\r\n }\r\n}",
"final public static function classMap()\n {\n return array (\n 'KAMODeparture' => 'HslOnnelaStructKAMODeparture',\n 'KAMOLine' => 'HslOnnelaStructKAMOLine',\n 'KAMOStop' => 'HslOnnelaStructKAMOStop',\n);\n }",
"public function ensureClassLoadingInformationExists() {}",
"final public static function classMap()\n {\n return array (\n 'CheckOutHeader' => 'MpesaStructCheckOutHeader',\n 'ResultMsg' => 'MpesaStructResultMsg',\n 'processCheckOutRequest' => 'MpesaStructProcessCheckOutRequest',\n 'processCheckOutResponse' => 'MpesaStructProcessCheckOutResponse',\n 'transactionConfirmRequest' => 'MpesaStructTransactionConfirmRequest',\n 'transactionConfirmResponse' => 'MpesaStructTransactionConfirmResponse',\n 'transactionStatusRequest' => 'MpesaStructTransactionStatusRequest',\n 'transactionStatusResponse' => 'MpesaStructTransactionStatusResponse',\n);\n }",
"protected function verifyClassMap(array $classMap)\n {\n foreach ($classMap as $type => $class) {\n if (!class_exists($class)) {\n throw new Exception(\"Class '$class' that has been registered for type '$type' does not exist\");\n }\n if (!in_array(PropertyInterface::class, class_implements($class))) {\n throw new Exception(\"Class '$class' does not implement: \" . PropertyInterface::class);\n }\n }\n\n return $classMap;\n }",
"public function getClassLoaders();",
"public function mapClasses() {\n // TODO: this is needed when the class map is not created yet (i.e. at very first install).\n if (!is_dir($this->dir['tmp'])) {\n mkdir($this->dir['tmp']);\n }\n $fop = fopen(CLASS_MAP_FILE, 'w+');\n\n foreach ($this->modules_loaded as $module) {\n $autoload_paths = array('Common', 'Qtags');\n foreach ($autoload_paths as $autoload_path) {\n $full_autoload_path = $module['path'] . '/classes/' . $autoload_path;\n /**\n * Autoload module's qtags.\n */\n if (is_dir($full_autoload_path)) {\n $classes = $this->scanDirectory($full_autoload_path);\n foreach ($classes as $class) {\n // Parse the Qtag.\n $exp1 = explode('/', $class);\n $exp2 = explode('.', $exp1[count($exp1) - 1]);\n $item_name = $exp2[0];\n $this->class_map[$autoload_path][$item_name] = $full_autoload_path . '/' . $class;\n }\n }\n }\n }\n fwrite($fop, serialize($this->class_map));\n fclose($fop);\n }",
"public function getClassmap()\n {\n return $this->removePrefix($this->classMap);\n }",
"public function load()\n {\n foreach ($this->aMappingConfiguration as $sLinkedEntity => $aMappingSetup) {\n $this->loadMapped(new $sLinkedEntity());\n }\n }",
"protected function getCodifiedErrorsMap()\n {\n return [];\n }"
] |
[
"0.6049064",
"0.59835154",
"0.5936587",
"0.5877363",
"0.5825548",
"0.5759891",
"0.57573503",
"0.5707031",
"0.56825936",
"0.5672097",
"0.56587356",
"0.5637056",
"0.5572834",
"0.55291146",
"0.55135614",
"0.5480604",
"0.54728615",
"0.5455407",
"0.54013014",
"0.5394783",
"0.53876454",
"0.5366078",
"0.5341246",
"0.53236073",
"0.5322108",
"0.52943814",
"0.52370733",
"0.5233646",
"0.5229913",
"0.5196286"
] |
0.64123183
|
0
|
Get doctrine document embedone fields
|
private function getDoctrineEmbedOneFields(\DOMElement $mapping)
{
$xpath = new \DOMXPath($mapping->ownerDocument);
$xpath->registerNamespace('doctrine', 'http://doctrine-project.org/schemas/odm/doctrine-mongo-mapping');
return array_map(
function (\DOMElement $element) {
return [
'name' => $element->getAttribute('field'),
'type' => $element->getAttribute('target-document'),
];
},
iterator_to_array($xpath->query('*[self::doctrine:embed-one or self::doctrine:reference-one]', $mapping))
);
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function getEmbeddedField()\n {\n return $this->get(self::EMBEDDED_FIELD);\n }",
"private function getDoctrineEmbedOneFields(array $mapping)\n {\n return $this->getRelationList($mapping, 'One');\n }",
"public function getToDocumentFields() {\n return array();\n }",
"public function getCustomFields()\n {\n # GET /accounts/{accountId}/envelopes/{envelopeId}/documents/{documentId}/fields\n }",
"function get_fields() {\n global $Tainacan_Item_Metadata;\n return $Tainacan_Item_Metadata->fetch($this, 'OBJECT');\n\n }",
"public function getOptionalEmbeddedField()\n {\n return $this->get(self::OPTIONAL_EMBEDDED_FIELD);\n }",
"public function getCustomFields() {\n return Doctrine::getTable('ArticleCustomFieldValue')->getCustomFields($this);\n }",
"private function getDoctrineEmbedManyFields(\\DOMElement $mapping)\n {\n $xpath = new \\DOMXPath($mapping->ownerDocument);\n $xpath->registerNamespace('doctrine', 'http://doctrine-project.org/schemas/odm/doctrine-mongo-mapping');\n\n return array_map(\n function (\\DOMElement $element) {\n return [\n 'name' => $element->getAttribute('field'),\n 'type' => $element->getAttribute('target-document'),\n ];\n },\n iterator_to_array($xpath->query('*[self::doctrine:embed-many or self::doctrine:reference-many]', $mapping))\n );\n }",
"public function getFields(){\n return $this->dbFields;\n }",
"public function instance_fields() {\n\n\n\n }",
"public function getFieldsMetadata()\n {\n return $this->fieldsMetadata;\n }",
"public function schemaFields() { \n return $this->allFieldsArray;\n }",
"public function schemaFields() { \n return $this->allFieldsArray;\n }",
"public function getDocente()\n {\n return $this->hasOne(Docente::getClass());\n\n }",
"public function getFields() {}",
"public function getFields() {}",
"public function getFields() {}",
"public function embeddable()\n\t{\n\t\treturn array(\n\t\t\t'pretty_created' => 'pretty_created',\n\t\t\t'member' => 'member',\n\t\t\t'form' => 'form',\n\t\t\t'all_forms' => 'all_forms',\n\t\t);\n\t}",
"public function fetchField();",
"public function getFields();",
"public function getFields();",
"public function getFields();",
"public function getFields();",
"public function getFields();",
"public function getFields();",
"public function fetchFields();",
"public function getFields()\n {\n return $this->content->getFields();\n }",
"abstract public function getFields($entity);",
"public function instance_fields(){\n\t\treturn self::fields(get_class($this));\n\t}",
"protected function get_fields() {\n\t\treturn rwmb_get_registry( 'field' )->get_by_object_type( 'post' );\n\t}"
] |
[
"0.6414481",
"0.62883925",
"0.6069954",
"0.6026316",
"0.5806104",
"0.5712851",
"0.5638116",
"0.5631104",
"0.56264746",
"0.56086564",
"0.5511074",
"0.54390705",
"0.54390705",
"0.5436394",
"0.54352593",
"0.54352593",
"0.54352593",
"0.54339576",
"0.5429632",
"0.54094136",
"0.54094136",
"0.54094136",
"0.54094136",
"0.54094136",
"0.54094136",
"0.53987396",
"0.5397534",
"0.5381963",
"0.5380419",
"0.53674406"
] |
0.67119974
|
0
|
Get doctrine document embedmany fields
|
private function getDoctrineEmbedManyFields(\DOMElement $mapping)
{
$xpath = new \DOMXPath($mapping->ownerDocument);
$xpath->registerNamespace('doctrine', 'http://doctrine-project.org/schemas/odm/doctrine-mongo-mapping');
return array_map(
function (\DOMElement $element) {
return [
'name' => $element->getAttribute('field'),
'type' => $element->getAttribute('target-document'),
];
},
iterator_to_array($xpath->query('*[self::doctrine:embed-many or self::doctrine:reference-many]', $mapping))
);
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"private function getDoctrineEmbedManyFields(array $mapping)\n {\n return $this->getRelationList($mapping, 'Many');\n }",
"private function getDoctrineEmbedOneFields(\\DOMElement $mapping)\n {\n $xpath = new \\DOMXPath($mapping->ownerDocument);\n $xpath->registerNamespace('doctrine', 'http://doctrine-project.org/schemas/odm/doctrine-mongo-mapping');\n\n return array_map(\n function (\\DOMElement $element) {\n return [\n 'name' => $element->getAttribute('field'),\n 'type' => $element->getAttribute('target-document'),\n ];\n },\n iterator_to_array($xpath->query('*[self::doctrine:embed-one or self::doctrine:reference-one]', $mapping))\n );\n }",
"private function getDoctrineEmbedOneFields(array $mapping)\n {\n return $this->getRelationList($mapping, 'One');\n }",
"public function getEmbedded(): iterable;",
"public function getToDocumentFields() {\n return array();\n }",
"public function getEmbeddedField()\n {\n return $this->get(self::EMBEDDED_FIELD);\n }",
"public function getCustomFields() {\n return Doctrine::getTable('ArticleCustomFieldValue')->getCustomFields($this);\n }",
"public function fields(): array\n {\n return [\n ID::make(),\n HasMany::make('reviews'),\n ];\n }",
"public function embeddable()\n\t{\n\t\treturn array(\n\t\t\t'pretty_created' => 'pretty_created',\n\t\t\t'member' => 'member',\n\t\t\t'form' => 'form',\n\t\t\t'all_forms' => 'all_forms',\n\t\t);\n\t}",
"public function getEntityFields(): EntityFieldCollection\n {\n return EntityFieldCollection::fromResponse(\n $this->client->get(\"Tags/entityInformation/fields\")\n );\n }",
"public function getReferencedEntities();",
"public function getCustomFields()\n {\n # GET /accounts/{accountId}/envelopes/{envelopeId}/documents/{documentId}/fields\n }",
"public function getCurrentlyReferencedEntityIds() {\n $ret = array();\n if (isset($this->entity) && isset($this->field)) {\n $entity_type = $this->entity_type;\n $field_name = $this->field['field_name'];\n $wrapper = entity_metadata_wrapper($entity_type, $this->entity);\n $ret = $wrapper->{$field_name}->raw();\n }\n\n return $ret;\n }",
"private function getDoctrineFields(\\DOMElement $mapping)\n {\n $xpath = new \\DOMXPath($mapping->ownerDocument);\n $xpath->registerNamespace('doctrine', 'http://doctrine-project.org/schemas/odm/doctrine-mongo-mapping');\n\n return array_map(\n function (\\DOMElement $element) {\n return [\n 'name' => $element->getAttribute('fieldName'),\n 'type' => $element->getAttribute('type'),\n ];\n },\n iterator_to_array($xpath->query('doctrine:field', $mapping))\n );\n }",
"public function getEntityFields(): EntityFieldCollection\n {\n return EntityFieldCollection::fromResponse(\n $this->client->get(\"Appointments/entityInformation/fields\")\n );\n }",
"abstract public function getFields($entity);",
"public function customFields()\n {\n return $this->morphMany('App\\Models\\MemberCustomFields', 'fieldable');\n }",
"function get_fields() {\n global $Tainacan_Item_Metadata;\n return $Tainacan_Item_Metadata->fetch($this, 'OBJECT');\n\n }",
"public function getEyufDocumentsWithEyufScholarIdMany()\r\n {\r\n return $this->getMany(EyufDocument::class, [\r\n 'eyuf_scholar_id' => 'id',\r\n ]); \r\n }",
"public function getFields()\n {\n return $this->content->getFields();\n }",
"public function entity()\n {\n $data = $this->morphMany('\\ApprovalSequence\\Models\\Entity', 'entity')->get();\n $data = $data->map(function ($item) {\n return $item->entity;\n });\n return $data;\n }",
"function getParagraphsFields(): array {\n $database = \\Drupal::database();\n\n $query = $database->select('paragraphs_item_field_data', 'p');\n $query->addField('p', 'parent_type', 'parent_type');\n $query->addField('p', 'parent_field_name', 'parent_field_name');\n $result = $query->distinct()->execute()->fetchAll();\n\n return $result;\n}",
"public function schemaFields() { \n return $this->allFieldsArray;\n }",
"public function schemaFields() { \n return $this->allFieldsArray;\n }",
"public function getFields()\n {\n return $this->getForm()->getFields();\n }",
"public function fields()\n {\n return $this->hasManyThrough(Field::class, Section::class);\n }",
"public function fields()\n {\n return $this->hasManyThrough(Field::class, FieldGroup::class, 'category_id', 'group_id');\n }",
"public function get_many() {\n return $this->get_all();\n }",
"public function getFields(){ return $this->field_map; }",
"public function fields()\n {\n\n return $this->hasMany('App\\TopicField', 'topic_id')->orderby('id', 'asc');\n }"
] |
[
"0.6627981",
"0.6549025",
"0.6410137",
"0.5977383",
"0.59416646",
"0.58601826",
"0.58474237",
"0.5812086",
"0.580848",
"0.56917435",
"0.56429565",
"0.5640236",
"0.5638112",
"0.5619695",
"0.55723494",
"0.5572251",
"0.5517215",
"0.5490442",
"0.5472233",
"0.545736",
"0.5454906",
"0.544994",
"0.5422827",
"0.5422827",
"0.53982633",
"0.53911453",
"0.5357766",
"0.53548783",
"0.5345002",
"0.531812"
] |
0.71879095
|
0
|
Lists all stammdaten entities.
|
public function indexAction()
{
$em = $this->getDoctrine()->getManager();
$stammdatens = $em->getRepository('AppBundle:Stammdaten')->findAll();
return $this->render('stammdaten/index.html.twig', array(
'stammdatens' => $stammdatens,
));
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function indexAction()\n {\n $em = $this->getDoctrine()->getManager();\n\n $stades = $em->getRepository('AppBundle:Stade')->findAll();\n\n return $this->render('stade/index.html.twig', array(\n 'stades' => $stades,\n ));\n }",
"public function indexAction()\n {\n $em = $this->getDoctrine()->getManager();\n\n $entities = $em->getRepository('MinsalsifdaBundle:SifdaEquipoTrabajo')->findAll();\n\n return array(\n 'entities' => $entities,\n );\n }",
"public function indexAction()\n {\n $em = $this->getDoctrine()->getManager();\n\n $entities = $em->getRepository('CheckmanBundle:Spendings')->findAll();\n\n return array(\n 'entities' => $entities,\n );\n }",
"public function indexAction()\n {\n $em = $this->getDoctrine()->getManager();\n\n $entities = $em->getRepository('casamunozempresaBundle:Sucursal')->findAll();\n\n return array(\n 'entities' => $entities,\n );\n }",
"public function indexAction()\n {\n $em = $this->getDoctrine()->getEntityManager();\n\n $entities = $em->getRepository('INHack20InventarioBundle:Estado')->findAll();\n\n return array(\n 'entities' => $entities,\n );\n }",
"public function indexAction()\n {\n $em = $this->getDoctrine()->getManager();\n\n $entities = $em->getRepository('DGPlusbelleBundle:SesionVentaTratamiento')->findAll();\n\n return array(\n 'entities' => $entities,\n );\n }",
"public function index()\n {\n return Entity::all();\n }",
"public function indexAction()\n {\n $em = $this->getDoctrine()->getManager();\n\n $entities = $em->getRepository('GarnetTaxiBeBundle:Ligne')->findAll();\n\n return array(\n 'entities' => $entities,\n );\n }",
"public function indexAction()\n {\n $em = $this->getDoctrine()->getManager();\n\n $entities = $em->getRepository('ArmensaViajesBundle:Viaje')->findAll();\n\n return array(\n 'entities' => $entities,\n );\n }",
"public function indexAction()\n {\n $em = $this->getDoctrine()->getManager();\n\n// $entities = $em->getRepository('uniRecetasBundle:ingrediente')->findAll();\n $entities = $em->getRepository('uniRecetasBundle:ingrediente')->findBy(\n array(), \n array('nombre' => 'ASC')\n );\n\n return $this->render('uniRecetasBundle:ingrediente:index.html.twig', array(\n 'entities' => $entities,\n ));\n }",
"public function indexAction()\n {\n $em = $this->getDoctrine()->getManager();\n\n $entities = $em->getRepository('BaseBundle:Feriado')->findAll();\n\n return $this->render('BaseBundle:Feriado:index.html.twig', array(\n 'entities' => $entities,\n ));\n }",
"public function indexAction()\n {\n $em = $this->getDoctrine()->getManager();\n\n $entities = $em->getRepository('SmathEmpresaBundle:Empleado')->findAll();\n\n return array(\n 'entities' => $entities,\n );\n }",
"public function indexAction()\n {\n $em = $this->getDoctrine()->getManager();\n\n $entities = $em->getRepository('SCRUMSwiftairBundle:Vluchten')->findAll();\n\n return array(\n 'entities' => $entities,\n );\n }",
"public function indexAction()\n {\n $em = $this->getDoctrine()->getManager();\n\n $entities = $em->getRepository('GestionFraisBundle:Visiteur')->findAll();\n\n return $this->render('GestionFraisBundle:Visiteur:index.html.twig', array(\n 'entities' => $entities,\n ));\n }",
"public function indexAction()\r\n {\r\n $em = $this->getDoctrine()->getManager();\r\n\r\n $entities = $em->getRepository('GaleriasBundle:Galeria')->findAll();\r\n\r\n return array(\r\n 'entities' => $entities,\r\n );\r\n }",
"public function indexAction()\n {\n $em = $this->getDoctrine()->getEntityManager();\n\n $entities = $em->getRepository('JetBredaBundle:Alquiler')->findAll();\n\n return array('entities' => $entities);\n }",
"public function indexAction()\n {\n $em = $this->getDoctrine()->getManager();\n\n $entities = $em->getRepository('VCReservasBundle:Reserva')->findAll();\n\n return array(\n 'entities' => $entities,\n );\n }",
"public function indexAction()\n {\n $em = $this->getDoctrine()->getManager();\n\n $estancias = $em->getRepository('alexyamBundle:Estancia')->findAll();\n\n return $this->render('estancia/index.html.twig', array(\n 'estancias' => $estancias,\n ));\n }",
"public function indexAction()\n {\n \n $em = $this->getDoctrine()->getManager();\n\n $entities = $em->getRepository('BEEServicesBeeeaseBundle:ActionListe')->findAll();\n\n return array(\n 'entities' => $entities,\n );\n }",
"public function getAllEntities();",
"public function indexAction()\n {\n $em = $this->getDoctrine()->getEntityManager();\n\n $entities = $em->getRepository('Area4CampeonatoBundle:Partido')->findAll();\n //$e_h_p = $em->getRepository('Area4CampeonatoBundle:Equipo_has_Partido')->findAll();\n\n return array('entities' => $entities);\n }",
"public function indexAction()\n {\n $em = $this->getDoctrine()->getManager();\n\n $entities = $em->getRepository('KbhGestionCongesBundle:Entreprise')->findAll();\n\n return $this->render('KbhGestionCongesBundle:Admin\\Entreprise:index.html.twig', array(\n 'entities' => $entities,\n ));\n }",
"public function indexAction()\n {\n $em = $this->getDoctrine()->getManager();\n $entities = $em->getRepository('PruebasBundle:Turno')->findAll();\n return array('entities' => $entities,);\n }",
"function listaAll() {\n require ROOT . \"config/bootstrap.php\";\n return $em->getRepository('models\\Equipamentos')->findby(array(), array(\"id\" => \"DESC\"));\n $em->flush();\n }",
"public function indexAction()\n {\n $em = $this->getDoctrine()->getManager();\n\n $fraturas = $em->getRepository('AppBundle:Fratura')->findAll();\n\n return $this->render('fratura/index.html.twig', array(\n 'fraturas' => $fraturas,\n ));\n }",
"public function showEntities()\n {\n return Entity::paginate(10);\n }",
"public function indexAction()\n {\n $em = $this->getDoctrine()->getManager();\n\n $entities = $em->getRepository('SuperAdminBundle:Departamento')->findAll();\n\n return array(\n 'entities' => $entities,\n );\n }",
"public function indexAction()\n {\n $em = $this->getDoctrine()->getManager(\"ms_haberes_web\");\n\n $entities = $em->getRepository('LiquidacionesCuposAnualesBundle:Liquidaciones')->findAll();\n\n return array(\n 'entities' => $entities,\n );\n }",
"public function indexAction()\n {\n $em = $this->getDoctrine()->getManager();\n\n $jouet = $em->getRepository('AppBundle:Jouet')->findAll();\n $enfants = $em->getRepository('AppBundle:Enfants')->findAll();\n\n return $this->render('jouet/index.html.twig', array(\n 'jouet' => $jouet,\n 'enfants' => $enfants\n ));\n }",
"public function indexAction()\n {\n $em = $this->getDoctrine()->getManager();\n\n $entities = $em->getRepository('estarRdaBundle:Utente')->findAll();\n\n return $this->render('estarRdaBundle:Utente:index.html.twig', array(\n 'entities' => $entities,\n ));\n }"
] |
[
"0.75445426",
"0.7150916",
"0.7122494",
"0.7111234",
"0.71084887",
"0.70120907",
"0.69872904",
"0.6866627",
"0.68540967",
"0.68469745",
"0.68433875",
"0.6807944",
"0.68020064",
"0.67909765",
"0.67906487",
"0.67810446",
"0.677495",
"0.67380404",
"0.67294586",
"0.67023116",
"0.6670612",
"0.66672504",
"0.66626745",
"0.663644",
"0.662321",
"0.65854746",
"0.65759015",
"0.6569249",
"0.6567972",
"0.65600055"
] |
0.78736347
|
0
|
Creates a form to delete a stammdaten entity.
|
private function createDeleteForm(Stammdaten $stammdaten)
{
return $this->createFormBuilder()
->setAction($this->generateUrl('stammdaten_delete', array('id' => $stammdaten->getId())))
->setMethod('DELETE')
->getForm()
;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"private function createDeleteForm(Scenaristes $scenariste)\n {\n return $this->createFormBuilder()\n ->setAction($this->generateUrl('scenaristes_delete', array('id' => $scenariste->getId())))\n ->setMethod('DELETE')\n ->getForm()\n ;\n }",
"private function createDeleteForm(SvCfgDisenio $SvCfgDisenio)\n {\n return $this->createFormBuilder()\n ->setAction($this->generateUrl('Svcfgdisenio_delete', array('id' => $SvCfgDisenio->getId())))\n ->setMethod('DELETE')\n ->getForm()\n ;\n }",
"private function createDeleteForm(Stable $stable)\n {\n return $this->createFormBuilder()\n ->setAction($this->generateUrl('stable_delete', array('id' => $stable->getId())))\n ->setMethod('DELETE')\n ->getForm()\n ;\n }",
"private function createDeleteForm(Estadosciviles $estadoscivile)\n {\n return $this->createFormBuilder()\n ->setAction($this->generateUrl('estadosciviles_delete', array('idEstadocivil' => $estadoscivile->getIdestadocivil())))\n ->setMethod('DELETE')\n ->getForm()\n ;\n }",
"public function deleteForm()\n\t{\n\t\t$form = new \\IPS\\Helpers\\Form( 'form', 'delete' );\n\t\t$form->addMessage( 'node_delete_blurb_no_content' );\n\t\t\n\t\treturn $form;\n\t}",
"private function createDeleteForm($id){\n\t\treturn $this->createFormBuilder()\n\t\t\t->setAction($this->generateUrl('reserva_delete', array('id' => $id)))\n\t\t\t->setMethod('DELETE')\n\t\t\t->add('submit', 'submit', array('label' => 'Eliminar Reserva', 'attr' => array('class'=>'btn btn-danger btn-block')))\n\t\t\t->getForm()\n\t\t;\n\t}",
"private function createDeleteForm(Evennements $evennement)\n {\n return $this->createFormBuilder()\n ->setAction($this->generateUrl('evennements_delete', array('id' => $evennement->getId())))\n ->setMethod('DELETE')\n ->getForm()\n ;\n }",
"private function createDeleteForm(Estancia $estancium)\n {\n return $this->createFormBuilder()\n ->setAction($this->generateUrl('estancia_delete', array('id' => $estancium->getId())))\n ->setMethod('DELETE')\n ->getForm()\n ;\n }",
"private function createDeleteForm(MsvTalonario $msvTalonario)\n {\n return $this->createFormBuilder()\n ->setAction($this->generateUrl('msvtalonario_delete', array('id' => $msvTalonario->getId())))\n ->setMethod('DELETE')\n ->getForm()\n ;\n }",
"private function createDeleteForm(Situation $situation)\n {\n return $this->createFormBuilder()\n ->setAction($this->generateUrl('situation_delete', array('id' => $situation->getId())))\n ->setMethod('DELETE')\n ->getForm()\n ;\n }",
"protected function createComponentDeleteForm()\r\n\t{\r\n\t\t$form = new Form;\r\n\t\t$form->addSubmit('delete', 'Smazat')->setAttribute('class', 'default');\r\n\t\t$form->addSubmit('cancel', 'Storno');\r\n\t\t$form->onSuccess[] = callback($this, 'deleteFormSubmitted');\r\n\t\t$form->addProtection(self::MESS_PROTECT);\r\n\t\treturn $form;\r\n\t}",
"private function createDeleteForm(Plateformes $plateforme)\n {\n return $this->createFormBuilder()\n ->setAction($this->generateUrl('administration_plateformes_delete', array('id' => $plateforme->getId())))\n ->setMethod('DELETE')\n ->getForm();\n }",
"private function createDeleteForm(Monster $monster)\n {\n return $this->createFormBuilder()\n ->setAction($this->generateUrl('monster_delete', array('id' => $monster->getId())))\n ->setMethod('DELETE')\n ->getForm()\n ;\n }",
"private function createDeleteForm($id)\n {\n \n $form = $this->createFormBuilder(null, array('attr' => array('id' => 'entrada_detalles_eliminar_type')))\n ->setAction('')\n ->setMethod('DELETE')\n ->add('submit', 'submit', array('label' => 'Eliminar', 'icon' => 'trash', 'attr' => array('class' => 'btn-danger')))\n ->getForm()\n ;\n \n return $form;\n \n \n }",
"private function createDeleteForm(NomDpa $nomdpa)\n {\n return $this->createFormBuilder()\n ->setAction($this->generateUrl('dpa_delete', array('id' => $nomdpa->getIddpa())))\n ->setMethod('DELETE')\n ->getForm();\n }",
"private function createDeleteForm($id) {\n return $this->createFormBuilder()\n ->setAction($this->generateUrl('medicamentossuministrados_delete', array('id' => $id)))\n ->setMethod('DELETE')\n ->add('submit', 'submit', array('label' => 'Eliminar', 'attr' => array('class' => 'btn')))\n ->getForm()\n ;\n }",
"private function createDeleteForm(CmsStzefBanners $cmsStzefBanner)\n {\n return $this->createFormBuilder()\n ->setAction($this->generateUrl('admstzef_banners_delete', array('id' => $cmsStzefBanner->getId())))\n ->setMethod('DELETE')\n ->getForm()\n ;\n }",
"private function createDeleteForm(Demandados $demandado)\n {\n return $this->createFormBuilder()\n ->setAction($this->generateUrl('demandados_delete', array('id' => $demandado->getIdDemandado())))\n ->setMethod('DELETE')\n ->getForm()\n ;\n }",
"public function createDeleteForm($id){\n return $this->createFormBuilder()\n ->setAction($this->generateUrl('rsp_delete',array('id'=>$id)))\n ->setMethod('DELETE')\n ->add('submit','submit',array('label'=>'Delete'))\n ->getForm()\n ;\n }",
"function travel_delete_form($form, &$form_state, $entity) {\n // Store the entity in the form.\n $form_state['entity'] = $entity;\n\n // Show confirm dialog.\n $entity_uri = entity_uri('travel', $entity);\n $message = t('Are you sure you want to delete entity %title?', array('%title' => entity_label('travel', $entity)));\n return confirm_form(\n $form,\n $message,\n $entity_uri['path'],\n t('This action cannot be undone.'),\n t('Delete'),\n t('Cancel')\n );\n}",
"private function createDeleteForm($id) {\r\n return $this->createFormBuilder()\r\n ->setAction($this->generateUrl('rubrique_delete', array('id' => $id)))\r\n// ->setMethod('DELETE')\r\n ->add('submit', SubmitType::class, array('label' => 'Supprimer la rubrique courante'))\r\n ->getForm()\r\n ;\r\n }",
"private function createDeleteForm(Services $service)\n {\n return $this->createFormBuilder()\n ->setAction($this->generateUrl('services_delete', array('id' => $service->getId())))\n ->setMethod('DELETE')\n ->getForm()\n ;\n }",
"private function createDeleteForm(ClasseMatiere $classeMatiere)\n {\n return $this->createFormBuilder()\n ->setAction($this->generateUrl('class_mat_delete', array('id' => $classeMatiere->getId())))\n ->setMethod('DELETE')\n ->getForm()\n ;\n }",
"private function createDeleteForm($id)\n {\n return $this->createFormBuilder()\n ->setAction($this->generateUrl('caracteristicasequipo_delete', array('id' => $id)))\n ->setMethod('DELETE')\n ->add('submit', 'submit', array('label' => 'Eliminar','attr' => array('class' => 'btn btn-danger')))\n ->getForm()\n ;\n }",
"private function createDeleteForm(SysEduc $sysEduc)\n {\n return $this->createFormBuilder()\n ->setAction($this->generateUrl('syseduc_delete', array('id' => $sysEduc->getId())))\n ->setMethod('DELETE')\n ->getForm()\n ;\n }",
"private function createDeleteForm(DatParteDesvio $datParteDesvio)\n {\n return $this->createFormBuilder()\n ->setAction($this->generateUrl('partedesvio_delete', array('id' => $datParteDesvio->getIdparte())))\n ->setMethod('DELETE')\n ->getForm();\n }",
"private function createDeleteForm(Motscles $motscle)\n {\n return $this->createFormBuilder()\n ->setAction($this->generateUrl('motscles_delete', array('idMotsCles' => $motscle->getIdmotscles())))\n ->setMethod('DELETE')\n ->getForm()\n ;\n }",
"private function createDeleteForm(Fratura $fratura)\n {\n return $this->createFormBuilder()\n ->setAction($this->generateUrl('fratura_delete', array('id' => $fratura->getId())))\n ->setMethod('DELETE')\n ->getForm()\n ;\n }",
"private function createDeleteForm(Etablissements $etablissement)\n {\n return $this->createFormBuilder()\n ->setAction($this->generateUrl('etablissements_delete', array('id' => $etablissement->getId())))\n ->setMethod('DELETE')\n ->getForm()\n ;\n }",
"private function createDeleteForm($id)\n {\n return $this->createFormBuilder()\n ->setAction($this->generateUrl('solmantenimientoidentificacion_delete', array('id' => $id)))\n ->setMethod('DELETE')\n ->add('submit', 'submit', array('label' => 'Borrar','attr'=>array('class'=>'btn btn-danger btn btn-danger btn-lg btn-block')))\n ->getForm()\n ;\n }"
] |
[
"0.7351832",
"0.705045",
"0.70387316",
"0.70098543",
"0.69756037",
"0.6974024",
"0.6968782",
"0.6946239",
"0.686413",
"0.68296444",
"0.6827534",
"0.68212175",
"0.6813407",
"0.6802473",
"0.67882085",
"0.6772808",
"0.676982",
"0.675961",
"0.6754453",
"0.6749179",
"0.67491615",
"0.6748968",
"0.67405057",
"0.6739418",
"0.6735462",
"0.6724171",
"0.6719048",
"0.670009",
"0.6658532",
"0.66570574"
] |
0.7894054
|
0
|
get trip type based on internal code
|
function get_trip_type($type)
{
switch($type) {
case 'circle' : $type = 'Round Way';
break;
case 'oneway' : $type = 'One Way';
break;
default : $type = 'Multi Stop';
break;
}
return $type;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function getTributeType();",
"public function getIteneraryTripType()\n {\n return $this->IteneraryTripType;\n }",
"private function get_type() {\n\n\t}",
"abstract protected function getTradeType();",
"protected function get_station_type( ) {\n if ($this->current_group_text == 'AUTO' || $this->current_group_text == 'COR') {\n $this->wxInfo['CODE_STATION_TYPE'] = $this->current_group_text;\n $this->varConcatenate($this->wxInfo, 'IGNORES', $this->current_group_text);\n $this->current_ptr++;\n }\n $this->current_group++;\n }",
"abstract protected function getPacketType();",
"public function get_type();",
"public function get_type(): string;",
"function _get_type() {\n\t\treturn $this->type();\n\n\t}",
"function getType() ;",
"function getType() ;",
"function getType() ;",
"public function get_type()\n {\n }",
"public function get_type()\n {\n }",
"public function get_type()\n {\n }",
"public function get_type()\n {\n }",
"public function get_type()\n {\n }",
"abstract protected function get_typestring();",
"abstract protected function getType();",
"public function getTrip()\n {\n return isset($this->trip) ? $this->trip : null;\n }",
"public function get_trajectory_type()\n {\n return $this->get_default_property(self::PROPERTY_TRAJECTORY_TYPE);\n }",
"abstract public function getAlgorithmType(): string;",
"function get_type() {\n\t\treturn $this->get_data( 'type' );\n\t}",
"function get_type() \n\t\t{\t\t\n\t\t \t return $thisShift->type;\t\t\n\t\t }",
"public function getOperationType(): ?string;",
"abstract public function getTaxType();",
"function getType(): string;",
"function getType(): string;",
"function convertToORCIDWorkType($type)\n{\n\tglobal $ioi;\t\t\n\t\n\t$type = getValues($ioi, \"SELECT `orcidField` FROM `mappings` WHERE `source` = 'dspace' AND sourceField = '$type' AND `entryType` = 'workType'\", array('orcidField'), 'singleValue');\n\t\n\tif(empty($type))\n\t{\n\t\t$type = 'other';\n\t}\n\t\n\treturn $type;\n}",
"public function getTenureType(): ?string\n {\n return $this->{self::TENURE_TYPE};\n }"
] |
[
"0.7070445",
"0.67829674",
"0.65205276",
"0.634031",
"0.62774575",
"0.614585",
"0.61246836",
"0.61098117",
"0.59812796",
"0.59784997",
"0.597799",
"0.59775823",
"0.5954176",
"0.5954176",
"0.5954171",
"0.59535664",
"0.5952898",
"0.586507",
"0.5847286",
"0.5844922",
"0.5827072",
"0.58218896",
"0.5821532",
"0.5820626",
"0.5803267",
"0.5774558",
"0.57660055",
"0.57660055",
"0.576227",
"0.57326835"
] |
0.82135206
|
0
|
Returns singleton instance of Template class.
|
public static function instance()
{
if (!self::$tplInstance) {
self::$tplInstance = new Template();
}
return self::$tplInstance;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public static function getInstance()\n\t{\n\t\tif ( NULL === self::$instance )\n\t\t{\n\t\t\tself::$instance = new Template;\n\t\t}\n\n\t\treturn self::$instance;\n\t}",
"public static function get() {\n\t\tif (self::$web_template === null) {\n\t\t\tself::$web_template = new Template();\n\t\t}\n\n\t\treturn self::$web_template;\n\t}",
"public function template() {\n\t\tif( !$this->template ) {\n\t\t\t$this->template = new Template( $this->template_id );\n\t\t}//end if\n\t\treturn $this->template;\n\t}",
"public static function get_instance() {\n\n if (null == self::$instance) {\n self::$instance = new PageTemplater();\n }\n\n return self::$instance;\n }",
"public static function get_instance() {\n\n\t\tif( null == self::$instance ) {\n\t\t\t\tself::$instance = new PageTemplater();\n\t\t} \n\n\t\treturn self::$instance;\n\t}",
"public static function get_instance() {\n\t\tif ( null == self::$instance ) {\n\t\t\tself::$instance = new PageTemplater();\n\t\t}\n\t\treturn self::$instance;\n\t}",
"protected function getPageTemplate()\n {\n return new Template();\n }",
"public static function getTpl()\n\t{\n\t\tif (isset(static::$tpl)) {\n\t\t\treturn static::$tpl;\n\t\t} else {\n\t\t\tstatic::$tpl = new Template();\n\t\t\treturn static::$tpl;\n\t\t}\n\t}",
"protected function instantiateTemplate() {\n\t\t$baseTemplate = '\\\\'. \\Autoload::TEMPLATE_NAMESPACE .'\\\\Base';\n\t\t$templateName = '\\\\'. \\Autoload::TEMPLATE_NAMESPACE .'\\\\'. $this->getDocument()->getTemplateName();\n\t\tif( $templateName != null && class_exists( $templateName ) )\n\t\t\treturn new $templateName( $this, $this->getRequestHandler(), $this->getDocument() );\n\t\telseif( class_exists( $baseTemplate ) )\n\t\t\treturn new $baseTemplate( $this, $this->getRequestHandler(), $this->getDocument() );\n\t\telse\n\t\t\tthrow new Exception( \"Template '\". $templateName .\"' could not be found.\" );\n\t\treturn null;\n\t}",
"public static function instance() {\n return Doctrine::getTable('DocumentTemplate');\n }",
"protected function getTemplateHandler()\n {\n return new TemplateHandler();\n }",
"public function ClassTemplate(){\n\t\t$this->template = new Template;\n\t}",
"public static function getInstance()\n {\n static $instance;\n if (!isset($instance)) {\n $class = __CLASS__;\n $instance = new $class();\n }\n return $instance;\n }",
"public function getTemplateClass();",
"public static function getInstance()\n {\n static $instance;\n if (!isset($instance)) {\n $class = __CLASS__;\n $instance = new $class();\n }\n\n return $instance;\n }",
"Public Static Function Instance($template = null){\r\n return new View($template);\r\n }",
"public static function instance() {\n return new static();\n }",
"public static function getInstance() {\n return new self();\n }",
"public static function getTemplate() {\n $settings = self::getSettings();\n \n return $settings->template;\n }",
"public static function instance() {\n\t\treturn new self;\n\t}",
"public static function instance()\n {\n global $container;\n return $container->getByType(self::class);\n }",
"public static function instance() {\n\t if ( !isset( self::$instance ) ) {\n\t $className = __CLASS__;\n\t self::$instance = new $className;\n\t }\n\t return self::$instance;\n\t }",
"public static function instance() {\n\t\tif ( ! isset( self::$instance ) ) {\n\t\t\t$className = __CLASS__;\n\t\t\tself::$instance = new $className;\n\t\t}\n\t\treturn self::$instance;\n\t}",
"public static function instance()\n {\n return new static();\n }",
"public static function instance()\n {\n return new static();\n }",
"public function getTemplate()\n {\n if (!$this->_template instanceof KTemplateAbstract) {\n //Make sure we have a template identifier\n if (!($this->_template instanceof KServiceIdentifier)) {\n $this->setTemplate($this->_template);\n }\n\n $config = array(\n 'view' => $this,\n );\n\n $this->_template = $this->getService($this->_template, $config);\n }\n\n return $this->_template;\n }",
"public static function getInstance() {\n\t\tif (!isset(self::$instance)) {\n\t\t\t$class = __CLASS__;\n\t\t\tself::$instance = new $class;\n\t\t}\n\t\treturn self::$instance;\n\t}",
"public static function instance() {\n\t\tif ( !isset( self::$instance ) ) {\n\t\t\t$class_name = __CLASS__;\n\t\t\tself::$instance = new $class_name;\n\t\t}\n\t\treturn self::$instance;\n\t}",
"public static function instance() {\n\t\tif ( ! isset( self::$instance ) ) {\n\t\t\t$class_name = __CLASS__;\n\t\t\tself::$instance = new $class_name;\n\t\t}\n\t\treturn self::$instance;\n\t}",
"public static function getInstance()\n {\n return new self();\n }"
] |
[
"0.8842315",
"0.7816025",
"0.77118874",
"0.7672784",
"0.7618161",
"0.7588593",
"0.7496813",
"0.72062606",
"0.7101442",
"0.70637506",
"0.7050612",
"0.69320744",
"0.6801341",
"0.67937696",
"0.6791767",
"0.6771658",
"0.67697424",
"0.67630786",
"0.67434967",
"0.6742054",
"0.67415404",
"0.6735886",
"0.67320585",
"0.67303205",
"0.67303205",
"0.67224264",
"0.67074925",
"0.6705557",
"0.6694065",
"0.66848886"
] |
0.8782537
|
1
|
Process data and fill qualities array
|
private function processQualities()
{
$data = $this->url->getData();
$permlink_pos = strpos($data, 'RJ.videoPermlink');
$default_pos = strpos($data, "RJ.videoDefault", $permlink_pos);
$data = substr($data, $permlink_pos + 16, $default_pos - 16 - $permlink_pos);
$video_pos = -1;
while ($video_pos = strpos($data, 'RJ.video', $video_pos + 1)) {
$equal_pos = strpos($data, ' =', $video_pos);
if (substr($data, $equal_pos, 8) == ' = null;') continue;
$path = StringHelper::betweenQuotes($data, $video_pos);
$quality = substr($data, $video_pos + 8, strpos($data, ' =', $video_pos) - $video_pos - 8);
$this->qualitiesURL[$quality] = $path;
}
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function getQualifications() {\n\t\t\n\t\t// In mancanza di un Model recupero le istanze della tabella intermedia CppQualifiations\n\t\t$QualificationsPivot = DB::table ( 'CppQualification' )->where ( 'id_cpp', $this->getIdCpp () )->get ();\n\t\t\n\t\t// Creo un array\n\t\t$temp = array ();\n\t\t$i = 0;\n\t\t\n\t\t// Ciclo sulle istanze di Qualifications e recupero il codice e la descrizione inserendoli in un array da passare al controller\n\t\tforeach ( $QualificationsPivot as $Qualification ) {\n\t\t\t$practictioner_qual = DB::table ( 'QualificationCode' )->where ( 'Code', $Qualification->Code )->first ();\n\t\t\t\n\t\t\t$temp [$i ++] = array (\n\t\t\t\t\t\"Code\" => $practictioner_qual->Code,\n\t\t\t\t\t\"Descrption\" => $practictioner_qual->Display \n\t\t\t);\n\t\t}\n\t\t\n\t\treturn $temp;\n\t}",
"abstract protected function report_to_array_mapping();",
"abstract function prepare_data(&$data_arr);",
"function fillArr($year,$range,$save,$depo,$beg){\n\t\t\t\t$fill=[];\n\t\t\t\tfor($i=0;$i<$year;$i++){\n\t\t\t\t\t$fill[$i]=[];\n\t\t\t\t\tfor($j=0;$j<$range+2;$j++){\t//\t+2 for year column & to include the $endRate\n\t\t\t\t\t\tif($j===0){\n\t\t\t\t\t\t\t$fill[$i][0]=$i+1;\t//\tFill the first column with year values.\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t$save+=$save*($beg/100);\n\t\t\t\t\t\t\t$fill[$i][$j]=$save;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t$beg++;\n\t\t\t\t\t$save=$depo;\n\t\t\t\t}\n\t\t\t\treturn $fill;\n\t\t\t}",
"function fillQuestion($data)\r\n {\r\n\tfor( $i=0; $i<$data['count']; $i++ ){\r\n\t\t$data[$i]['Question'] = $this->findAll($conditions='id='.$data[$i]['SurveyQuestion']['question_id'], $fields=\"prompt, type\");\r\n\t\t$data[$i]['Question'] = $data[$i]['Question'][0]['Question'];\r\n\t\t$data[$i]['Question']['number'] = $data[$i]['SurveyQuestion']['number'];\r\n\t\t$data[$i]['Question']['id'] = $data[$i]['SurveyQuestion']['question_id'];\r\n\t\t$data[$i]['Question']['sq_id'] = $data[$i]['SurveyQuestion']['id'];\r\n\t\tunset($data[$i]['SurveyQuestion']);\r\n\t}\r\n\r\n\treturn $data;\r\n }",
"private function prepareIndustryGreedyData() {\n $industry_greedy_data = $this->toArray();\n return $industry_greedy_data;\n }",
"private function grab_data(){\n\t\t$y=0;\n\t\tfor($i=$this->startingmonth;$i>=0;$i--){\n\t\t\t$this->searchmonth = date(\"n\")-$i;\n\t\t\t$this->searchyear = date(\"Y\");\n\t\t\tif(0 >= $this->searchmonth){\n\t\t\t\twhile(0 >= $this->searchmonth){\n\t\t\t\t\t$this->searchmonth += 12;\n\t\t\t\t\t$this->searchyear--;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t$this->count_chrono_records();\n\t\t\t$this->monthlyrecordvolume[$i] = intval($this->volume_of_records_in_timerange);\n\t\t\tif(0==$this->max_month_value or $this->monthlyrecordvolume[$i] > $this->max_month_value){\n\t\t\t\t$this->max_month_value = $this->monthlyrecordvolume[$i];\n\t\t\t}\n\t\t\t$this->monthaggregator += $this->monthlyrecordvolume[$i];\n\t\t\t\n\t\t\t$this->count_months_recorded_this_year++;\n\t\t\tif(12 == $this->searchmonth or 0 == $i ){\n\t\t\t\t$this->ave_this_year[$y]['volume'] = intval($this->monthaggregator / $this->count_months_recorded_this_year);\n\t\t\t\t$this->ave_this_year[$y]['month'] = $i;\n\t\t\t\t$this->ave_this_year[$y]['year'] = $this->searchyear;\n\t\t\t\t$this->monthaggregator = 0;\n\t\t\t\t$this->count_months_recorded_this_year = 0;\n\t\t\t\t$y++;\n\t\t\t}\n\t\t}\n\t\treturn;\n\t}",
"protected function getData()\n {\n $occupancies = (new RoomOccupancyRepository)->withoutLabel(['tent', 'free'])->byNational($this->year);\n\n $spendings = (new BillRepository)->withoutResourceLabel(['tent', 'free'])->byMonthNational($this->year);\n\n foreach ($occupancies as $occupancy) {\n $this->occ_arr[$occupancy->country][$occupancy->mth] = $occupancy->counter;\n }\n\n foreach ($spendings as $spending) {\n $this->spend_arr[$spending->country][$spending->mth] = $spending->sum;\n }\n }",
"public function saveQualificationInfo ($qualification_id, $data)\r\n {\r\n $qualifiaction_obj = new Acad_Model_Qualification();\r\n $qualifiactions = $qualifiaction_obj->fetchQualifications();\r\n $qualifiaction_name = $qualifiactions[$qualification_id];\r\n switch ($qualifiaction_name) {\r\n case 'MATRIC':\r\n $object = new Acad_Model_Qualification_Matric();\r\n $marks_obtained = $data['marks_obtained'];\r\n $total_marks = $data['total_marks'];\r\n $percentage = (100 * ($marks_obtained / $total_marks));\r\n $data['percentage'] = $percentage;\r\n $info = $this->fetchQualificationInfo($qualification_id);\r\n break;\r\n case 'TWELFTH':\r\n $object = new Acad_Model_Qualification_Twelfth();\r\n $marks_obtained = $data['marks_obtained'];\r\n $total_marks = $data['total_marks'];\r\n $percentage = (100 * ($marks_obtained / $total_marks));\r\n $data['percentage'] = $percentage;\r\n $info = $this->fetchQualificationInfo($qualification_id);\r\n break;\r\n case 'DIPLOMA':\r\n $object = new Acad_Model_Qualification_Diploma();\r\n $marks_obtained = $data['marks_obtained'];\r\n $total_marks = $data['total_marks'];\r\n $percentage = (100 * ($marks_obtained / $total_marks));\r\n $data['percentage'] = $percentage;\r\n $info = $this->fetchQualificationInfo($qualification_id);\r\n break;\r\n case 'BTECH':\r\n $object = new Acad_Model_Qualification_Btech();\r\n $marks_obtained = $data['marks_obtained'];\r\n $total_marks = $data['total_marks'];\r\n $percentage = (100 * ($marks_obtained / $total_marks));\r\n $data['percentage'] = $percentage;\r\n $info = $this->fetchQualificationInfo($qualification_id);\r\n break;\r\n case 'MTECH':\r\n $object = new Acad_Model_Qualification_Mtech();\r\n $marks_obtained = $data['marks_obtained'];\r\n $total_marks = $data['total_marks'];\r\n $percentage = (100 * ($marks_obtained / $total_marks));\r\n $data['percentage'] = $percentage;\r\n $info = $this->fetchQualificationInfo($qualification_id);\r\n break;\r\n default:\r\n throw new Exception(\r\n 'Attempt to save Invalid Qualification\\'s data. Qualification Name Provided : ' .\r\n $qualifiaction_name . '.', Zend_Log::ERR);\r\n break;\r\n }\r\n $member_id = $this->getMember_id();\r\n $data['member_id'] = $member_id;\r\n $data['qualification_id'] = $qualification_id;\r\n if ($info == false) {\r\n $this->saveQualification($qualification_id);\r\n $object->initSave();\r\n $preparedData = $object->prepareDataForSaveProcess($data);\r\n return $object->getMapper()->save($preparedData);\r\n } else {\r\n $object->initSave();\r\n $prepared_data = $object->prepareDataForSaveProcess($data);\r\n $data['member_id'] = null;\r\n return $object->getMapper()->update($prepared_data, $member_id, \r\n $qualification_id);\r\n }\r\n }",
"public function fill(array $data = []);",
"public function reducedAnthroData($measures,$population) {\r\n\t\t\t$records = array();\r\n\r\n\t\t\t// create the sql query\r\n\t\t\t$sql = \"SELECT \" . $measures . \" FROM \" . $population . \" ORDER BY rowid\";\t\r\n/*\r\nprint \"<br><br>\";\r\nprint $sql;\t\r\nprint \"<br>\";\r\n*/\t\t\t\r\n\t\t\t// pull the records from the sqlite database\r\n\t\t\t$result = $this->dbHandle->query($sql);\r\n\t\t\t$records = $result->fetchAll(PDO::FETCH_ASSOC);\r\n \r\n\r\n\t\t\t// convert to an easier format for matrix multiplication\r\n\t\t\t$data = array();\r\n\t\t\t$i=0; $j=0;\r\n\t\t\tforeach ($records as $record ) {\r\n\t\t\t\tforeach ($record as $r ) {\r\n\t\t\t\t\t$data[$i][$j] = $r;\r\n\t\t\t\t\t$j++;\r\n\t\t\t\t}\r\n\t\t\t\t$i++;\r\n\t\t\t\t$j = 0;\r\n\t\t\t}\r\n\r\n\t\t\treturn $data;\t\r\n\t\t}",
"public function dataProviderForRange(): array\n {\n return [\n [ [ 1, 1, 1 ], 0 ],\n [ [ 1, 1, 2 ], 1 ],\n [ [ 1, 2, 1 ], 1 ],\n [ [ 8, 4, 3 ], 5 ],\n [ [ 9, 7, 8 ], 2 ],\n [ [ 13, 18, 13, 14, 13, 16, 14, 21, 13 ], 8 ],\n [ [ 1, 2, 4, 7 ], 6 ],\n [ [ 8, 9, 10, 10, 10, 11, 11, 11, 12, 13 ], 5 ],\n [ [ 6, 7, 8, 10, 12, 14, 14, 15, 16, 20 ], 14 ],\n [ [ 9, 10, 11, 13, 15, 17, 17, 18, 19, 23 ], 14 ],\n [ [ 12, 14, 16, 20, 24, 28, 28, 30, 32, 40 ], 28 ],\n ];\n }",
"function getSpeakersListForResolution($num) {\n $speakerOrder = getSpeakersListOrder();\n $resSpeakerOrder = array();\n foreach ($speakerOrder as $speaker) {\n $amendmentRow = getAmendmentRow($speaker['id'],$num);\n if ($amendmentRow != null) {\n if ($amendmentRow['status'] == 'approved') {\n array_push($resSpeakerOrder,$amendmentRow['country_id']);\n }\n }\n }\n return $resSpeakerOrder;\n}",
"public function populate(array $data);",
"function calculate_data() {\n $this->data = array();\n $this->data['series'] = array();\n\n $series_size = 0;\n\n $series_list = $this->calculate_series_list();\n foreach($series_list as $key => $value) {\n $this->data['series'][$value] = $this->calculate_series($key);\n\n if($series_size < count($this->data['series'][$value])) {\n $series_size = count($this->data['series'][$value]);\n }\n }\n\n $this->data['labels'] = $this->calculate_labels($series_size);\n }",
"public function run() {\n\n $range = range(100000, 200000);\n shuffle($range);\n\n $data = [\n [\n 'garage_id' => array_shift($range),\n 'name' => 'Tampere Rautatientori',\n 'hourly_price' => 2,\n 'currency' => Garage::EURO,\n 'contact_email' => '[email protected]',\n 'point' => '60.168607847624095 24.932371066131623',\n 'country' => Garage::FINLAND,\n 'owner_id' => '2',\n ],\n [\n 'garage_id' => array_shift($range),\n 'name' => 'Punavuori Garage',\n 'hourly_price' => 1.5,\n 'currency' => Garage::EURO,\n 'contact_email' => '[email protected]',\n 'point' => '60.162562 24.939453',\n 'country' => Garage::FINLAND,\n 'owner_id' => '2',\n ],\n [\n 'garage_id' => array_shift($range),\n 'name' => 'Unknown',\n 'hourly_price' => 3,\n 'currency' => Garage::EURO,\n 'contact_email' => '[email protected]',\n 'point' => '60.16444996645511 24.938178168200714',\n 'country' => Garage::FINLAND,\n 'owner_id' => '2',\n ],\n [\n 'garage_id' => array_shift($range),\n 'name' => 'Fitnesstukku',\n 'hourly_price' => 3,\n 'currency' => Garage::EURO,\n 'contact_email' => '[email protected]',\n 'point' => '60.165219358852795 24.93537425994873',\n 'country' => Garage::FINLAND,\n 'owner_id' => '2',\n ],\n [\n 'garage_id' => array_shift($range),\n 'name' => 'Kauppis',\n 'hourly_price' => 3,\n 'currency' => Garage::EURO,\n 'contact_email' => '[email protected]',\n 'point' => '60.17167429490068 24.921585662024363',\n 'country' => Garage::FINLAND,\n 'owner_id' => '2',\n ],\n [\n 'garage_id' => array_shift($range),\n 'name' => 'Q-Park1',\n 'hourly_price' => 2,\n 'currency' => Garage::EURO,\n 'contact_email' => '[email protected]',\n 'point' => '60.16867390148751 24.930162952045407',\n 'country' => Garage::FINLAND,\n 'owner_id' => '1',\n ],\n ];\n\n foreach ($data as $garage) {\n DB::table('garage')->insert($garage);\n }\n }",
"protected function initializeResultArray() {}",
"private static function fillWithEmptyValues($arrays, $start_date, $end_date, $frequency = QueryResultPeer::FREQUENCY_DAY)\n {\n $min_date = strtotime($start_date);\n $max_date = strtotime($end_date);\n\n $rtn = array();\n\n if($frequency == QueryResultPeer::FREQUENCY_WEEK)\n {\n $counter = 0;\n foreach($arrays as $array)\n {\n $min_custom = strtotime(Utils::get_date_of_first_day_in_a_week(date('W', $min_date), date('o', $min_date)));\n $max_custom = strtotime(Utils::get_date_of_first_day_in_a_week(date('W', $max_date), date('o', $max_date)));\n $weeks = ceil((($max_date - $min_date) / 24 / 60 / 60 / 7));\n\n $rtn[] = array();\n// for($i = 0; $i < $weeks; $i++)\n// {\n while($min_custom <= $max_custom) {\n if(array_key_exists(date('Y-m-d', $min_custom), $array))\n {\n //$rtn[$counter][date('Y-m-d', $min_custom)] = $array[date('Y-m-d', $min_custom)];\n $rtn[$counter][date('o', $min_custom) . '-' . date('W', $min_custom)] = $array[date('Y-m-d', $min_custom)];\n } else\n {\n //$rtn[$counter][date('Y-m-d', $min_custom)] = -1;\n $rtn[$counter][date('o', $min_custom) . '-' . date('W', $min_custom)] = -1;\n }\n $min_custom = strtotime(date('Y-m-d', $min_custom) .' +1 weeks');\n }\n $counter++;\n }\n } else if($frequency == QueryResultPeer::FREQUENCY_MONTH)\n {\n $min_custom = strtotime(date('Y', $min_date) . date('m', $min_date) . '01');\n $months = (date('Y', $max_date) - date('Y', $min_date)) * 12 + date('m', $max_date) - date('m', $min_date);\n $counter = 0;\n foreach($arrays as $array)\n {\n $rtn[] = array();\n for($i = 0; $i < $months + 1; $i++)\n {\n $date_temp = strtotime(date('Y-m-d', $min_custom) . ' +' .$i. ' months');\n if(array_key_exists(date('Y-m-d', $date_temp), $array))\n {\n $rtn[$counter][date('Y-m-d', $date_temp)] = $array[date('Y-m-d', $date_temp)];\n } else\n {\n $rtn[$counter][date('Y-m-d', $date_temp)] = -1;\n }\n }\n $counter++;\n }\n } else\n {\n $days = ceil((($max_date - $min_date) / 24 / 60 / 60)) + 1;\n\n $counter = 0;\n foreach($arrays as $array)\n {\n $rtn[] = array();\n// for($i = 0; $i < $days; $i++)\n $date_temp = $min_date;\n while($date_temp <= $max_date)\n {\n if(array_key_exists(date('Y-m-d', $date_temp), $array))\n {\n $rtn[$counter][date('Y-m-d', $date_temp)] = $array[date('Y-m-d', $date_temp)];\n } else\n {\n $rtn[$counter][date('Y-m-d', $date_temp)] = -1;\n }\n $date_temp = strtotime('+1 day', $date_temp);\n }\n $counter++;\n }\n }\n\n return $rtn;\n }",
"public static function fill($data=[])\n {\n if(!empty($data)){\n foreach ($data as $item){\n self::add($item);\n }\n }\n\n }",
"public function exchanegArray($_data)\n {\n $this->branch_no = (int) gv('branch_no', $_data);\n $this->branch_name = (string) gv('branch_name', $_data);\n $this->abbr_name = (string) gv('abbr_name', $_data);\n $this->timezone = (string) gv('timezone', $_data);\n $this->phone = (string) gv('phone', $_data);\n $this->address = (string) gv('address', $_data);\n $this->update_time = (string) gv('update_time', $_data);\n }",
"private function build_lines_aggregate_array(){\n\n\t\t$this->lines_aggregate_array = array();\n\t\tforeach($this->per_team_lines[0] as $key => $value){\n\t\t\t$line_play_type = null;\n\t\t\tif($key === 'women_doubles'){\n\t\t\t\t$line_play_type = 'wd';\n\t\t\t}\n\t\t\telse if($key === 'men_doubles'){\n\t\t\t\t$line_play_type = 'md';\n\t\t\t}\n\t\t\telse if($key === 'women_singles'){\n\t\t\t\t$line_play_type = 'ws';\n\t\t\t}\n\t\t\telse if($key === 'men_singles'){\n\t\t\t\t$line_play_type = 'ms';\n\t\t\t}\n\t\t\telse if($key === 'mixed_doubles'){\n\t\t\t\t$line_play_type = 'xd';\n\t\t\t}\n\t\t\telse if($key === 'mixed_singles'){\n\t\t\t\t$line_play_type = 'xs';\n\t\t\t}\n\t\t\tif($line_play_type !== null){\n\t\t\t\tarray_push($this->lines_aggregate_array, array(\n\t\t\t\t\t'line_play_type' => $line_play_type,\n\t\t\t\t\t'count' => $value\n\t\t\t\t));\n\t\t\t}\n\t\t}\n\n\t}",
"public function save_quals()\n {\n //are there some now?\n //no -> were there before? if so delete\n //-> yes\n //->were there before?\n //->no, then just insert them all. \n //->yes, then get the ones from before. \n //->loop over the new ones\n //->if not in previous, then insert.\n //->loop over the previous\n //if not in the new, then delete\n if(!$this->qualIDs)\n {\n $this->delete_quals();\n }\n else\n {\n if(!$this->quals || count($this->quals) == 0)\n {\n //then there were no quals before, so insert\n $this->add_all_quals();\n }\n else\n {\n //we have some before, so loop over the new ones, \n //inserting any new\n foreach($this->qualIDs AS $qualID)\n {\n if(!array_key_exists($qualID, $this->quals))\n {\n //if it doesnt exists, lets insert it\n $this->add_qual($qualID);\n }\n }\n //now we loop over the previous ones, if its not in the\n //new ones we delete it\n foreach($this->quals AS $qual)\n {\n //does the\n if(!in_array($qual->id, $this->qualIDs))\n {\n $this->remove_qual($qual->id);\n }\n }\n }\n }\n }",
"function buildAchievementArray()\n {\n $row = 1;\n $questionhander = fopen(\"csv/Achievements_normal.csv\", \"r\");\n while ($data = fgetcsv($questionhander, null, \";\")) {\n $fields = count($data);\n $this->achieve_array[5][$row - 1] = false;\n for ($c = 0; $c < $fields; $c++) {\n $this->achieve_array[$c][$row - 1] = $data[$c];\n }\n $row++;\n }\n fclose($questionhander);\n }",
"function getIndicateursAgence($list_agence,$ratios_prudentiels, $qualite_portefeuille, $indices_couverture, $indices_productivite, $indices_impact) {\n global $global_monnaie,$global_id_agence;\n $DATA = array();\n\n // Ajout du nombre d'agence selectionné dans tableau contenant les statistiques de l'agence ou du réseau\n $DATA['a_nombreAgence'] = count($list_agence);\n\n if ($DATA['a_nombreAgence'] <= 1) {\n setGlobalIdAgence(key($list_agence));\n $DATA['a_infosGlobales'] = getAgenceDatas($global_id_agence);\n resetGlobalIdAgence();\n }\n\n if ($ratios_prudentiels) {\n $RatiosPrudentiels = getRatiosPrudentiels($list_agence);\n $DATA['ratios_prudentiels'] = $RatiosPrudentiels;\n }\n\n if ($qualite_portefeuille) {\n $QualitePortefeuille = getQualitePortefeuille($list_agence);\n $DATA['qualite_portefeuille'] = $QualitePortefeuille;\n }\n\n if ($indices_couverture) {\n $IndicesCouverture = getIndicesCouverture($list_agence);\n $DATA['indices_couverture'] = $IndicesCouverture;\n }\n\n if ($indices_productivite) {\n $IndicesProductivite = getIndicesProductivite($list_agence);\n $DATA['indices_productivite'] = $IndicesProductivite;\n }\n\n if ($indices_impact) {\n $IndicesImpact = getIndicesImpact($list_agence);\n $DATA['indices_impact'] = $IndicesImpact;\n }\n\n if ($DATA['a_nombreAgence'] > 1) {\n resetGlobalIdAgence();\n }\n\n return $DATA;\n}",
"public function updateQuality()\n {\n foreach ($this->items as $item) {\n if ($item->name != 'Aged Brie' and $item->name != 'Backstage passes to a TAFKAL80ETC concert') {\n if ($item->quality > 0) {\n if ($item->name != 'Sulfuras, Hand of Ragnaros') {\n $item->quality = $item->quality - 1;\n }\n }\n } else {\n if ($item->quality < 50) {\n $item->quality = $item->quality + 1;\n if ($item->name == 'Backstage passes to a TAFKAL80ETC concert') {\n if ($item->sellIn < 11) {\n if ($item->quality < 50) {\n $item->quality = $item->quality + 1;\n }\n }\n if ($item->sellIn < 6) {\n if ($item->quality < 50) {\n $item->quality = $item->quality + 1;\n }\n }\n }\n }\n }\n \n if ($item->name != 'Sulfuras, Hand of Ragnaros') {\n $item->sellIn = $item->sellIn - 1;\n }\n \n if ($item->sellIn < 0) {\n if ($item->name != 'Aged Brie') {\n if ($item->name != 'Backstage passes to a TAFKAL80ETC concert') {\n if ($item->quality > 0) {\n if ($item->name != 'Sulfuras, Hand of Ragnaros') {\n $item->quality = $item->quality - 1;\n }\n }\n } else {\n $item->quality = $item->quality - $item->quality;\n }\n } else {\n if ($item->quality < 50) {\n $item->quality = $item->quality + 1;\n }\n }\n }\n }\n }",
"public function fill(array $data) {\n if(isset($data['scheduled_match_id'])) {\n $this->id = $data['scheduled_match_id'];\n }\n\t\t\n $this->leagueId = $data['scheduled_match_league_id'];\n\t\t$this->teamOneId = $data['scheduled_match_team_id_1'];\n\t\t$this->teamTwoId = $data['scheduled_match_team_id_2'];\n\t\t$this->fieldId = $data['scheduled_match_field_id'];\n\t\t$this->matchTime = $data['scheduled_match_time'];\n\t\t$this->dateId = $data['scheduled_match_date_id'];\n\t\t$this->playoffTeamOneString = $data['scheduled_match_playoff_team_1'];\n\t\t$this->playoffTeamTwoString = $data['scheduled_match_playoff_team_2'];\n\t\t$this->venueNumInWeek = $data['scheduled_match_venue_num_in_week'];\n }",
"public function fill(array $data): void;",
"private function addRqData(& $data, $listOfGeneNames) {\n\t\t$extendingSettings = $this->getExtendingSettings();\n\t\tif (!isset($extendingSettings['calibrator'])) {\n\t\t\tthrow new UndefinedCalibrator('Undefined by-user-set calibrator');\n\t\t}\n\n\t\tif (empty($extendingSettings['referenceGenes'])) {\n\t\t\tthrow new UndefinedReferenceGenes('Undefined by-user-set reference genes');\n\t\t}\n\n\t\t$calibratorName = $extendingSettings['calibrator'];\n\t\t$referenceGenes = $extendingSettings['referenceGenes'];\n\t\t$calibratorData = $data[$calibratorName]; //row with selected calibrator data\n\t\tforeach ($data as $subjectName => & $subjectData) {\n\t\t\t$subjectPreRqData = array();\n\t\t\t$subjectNormalizingFactorBase = 1;\n\t\t\tforeach ($listOfGeneNames as $geneName) {\n\t\t\t\t$subjectPreRqData[$subjectName][$geneName] = array();\n\t\t\t\tif (!isset($calibratorData[$geneName])) {\n\t\t\t\t\t$this->getErrors()->rememberError(\n\t\t\t\t\t\t'chybí informace o genu ' . $geneName,\n\t\t\t\t\t\t\\RqData\\RequiredSettings\\File\\Calibrator::HUMAN_NAME\n\t\t\t\t\t);\n\n\t\t\t\t\treturn FALSE;\n\t\t\t\t}\n\n\t\t\t\tif (!isset($subjectData[$geneName])) {\n\t\t\t\t\t//subject does not contain information about actual gene\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\t$calibratorCtValue = $calibratorData[$geneName][ColumnsPurpose::CT_VALUES];\n\t\t\t\t$subjectPreRqData[$geneName] = pow(2,\n\t\t\t\t\t- ($subjectData[$geneName][ColumnsPurpose::CT_VALUES] -\n\t\t\t\t\t\t$calibratorCtValue)\n\t\t\t\t);\n\n\t\t\t\tif (in_array($geneName, $referenceGenes)) {\n\t\t\t\t\t$subjectNormalizingFactorBase *= $subjectPreRqData[$geneName];\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t$subjectNormalizingFactor = pow(\n\t\t\t\t$subjectNormalizingFactorBase,\n\t\t\t\t1/count($referenceGenes)\n\t\t\t);\n\t\t\tforeach ($listOfGeneNames as $geneName) {\n\t\t\t\t$subjectData[$geneName][ColumnsPurpose::RQ_VALUES] =\n\t\t\t\t\t$subjectPreRqData[$geneName] / $subjectNormalizingFactor;\n\t\t\t}\n\t\t}\n\t}",
"abstract public function data2Array($data);",
"public function updateQuality(): void\n {\n foreach ($this->items as $item) {\n $this->updateItemQuality($item);\n }\n }"
] |
[
"0.51979536",
"0.5060417",
"0.49768123",
"0.4967489",
"0.4951087",
"0.4936645",
"0.49248925",
"0.4899086",
"0.47379553",
"0.46850997",
"0.4680023",
"0.4672118",
"0.465615",
"0.4624357",
"0.45900702",
"0.45630687",
"0.4559305",
"0.45379427",
"0.4533175",
"0.4528539",
"0.45185068",
"0.44997966",
"0.4498914",
"0.44961432",
"0.44911313",
"0.4488474",
"0.4480709",
"0.44757542",
"0.44685388",
"0.44632196"
] |
0.5505664
|
0
|
Move the basename of a path to the find/replaced version Then return the updated path
|
public function renamePathBasename(string $find, string $replace, string $path): string
{
$basename = basename($path);
$newBasename = str_replace($find, $replace, $basename);
$moveTo = dirname($path) . '/' . $newBasename;
if ($moveTo === $path) {
return $path;
}
if (is_dir($moveTo) || file_exists($moveTo)) {
throw new DoctrineStaticMetaException(
"Error trying to move:\n[$path]\n to \n[$moveTo]\ndestination already exists"
);
}
try {
$this->filesystem->rename($path, $moveTo);
} catch (Exception $e) {
throw new DoctrineStaticMetaException(
'Exception in ' . __METHOD__ . ': ' . $e->getMessage(),
$e->getCode(),
$e
);
}
return $moveTo;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function replace($path);",
"private function shiftPathUp($path)\n {\n $path = explode('/', $path);\n array_pop($path);\n return implode('/', $path);\n }",
"function original_version($path)\n{\n $version = version_name($path);\n if ($version) {\n $path = str_replace(\":{$version}\", '', $path);\n }\n\n return $path;\n}",
"protected function _renamePath($curpath, $newpath)\n {\n $curpath = str_replace(DIRECTORY_SEPARATOR, '/', $curpath);\n $newpath = str_replace(DIRECTORY_SEPARATOR, '/', $newpath);\n\n $adapter = $this->getAdapter();\n\n // Inicia as trasações do banco de dados\n $adapter->beginTransaction();\n try {\n $files = $this->findAll(array(\n 'where' => array(\"path LIKE '{$curpath}%'\")\n ));\n\n if($files->count() > 0) {\n // renomeia com o $newpath as ocorreções encontradas\n foreach ($files as $file){\n $file->path = str_replace($curpath, $newpath, $file->path);\n FrontZend_Container::get('File')->save($file);\n }\n }\n\n $contents = FrontZend_Container::get('Content')->findAll(array(\n 'where' => array(\"text LIKE '%{$curpath}%'\")\n ));\n\n if ($contents->count() > 0) {\n foreach($contents as $content) {\n // renomeia com o $newpath as ocorreções encontradas\n $content->text = str_replace($curpath, $newpath,\n $content->text);\n FrontZend_Container::get('Content')->save($content);\n }\n }\n\n // Efetiva todas as transações do banco de dados\n $adapter->commit();\n } catch(Exception $e) {\n // Desfaz todas as alterações do banco de dados\n $adapter->rollBack();\n throw $e;\n }\n }",
"public static function move($path, $toPath, $replace = TRUE) {\n \n }",
"private function fixpath(string $path): string {\n\t\t$path = $this->normalisePath($path);\n\n\t\t//problem with dirname() and file in the vfs root directory\n\t\tif ($path === \"{$this->protocolName}:\") {\n\t\t\treturn \"{$path}///\";\n\t\t}\n\n\t\t//never fix the path twice\n\t\tif (mb_strpos($path, $this->protocolName) === 0) {\n\t\t\treturn $path;\n\t\t}\n\n\t\tif ($this->inTransaction()) {\n\t\t\tif (mb_substr($path, 0, mb_strlen($this->baseDir)) === $this->baseDir) {\n\t\t\t\t$path = mb_substr($path, mb_strlen($this->baseDir));\n\t\t\t} else {\n\t\t\t\tthrow new InvalidArgumentException(\"Cannot access file path '{$path}' on the vfs, is not below base directory '{$this->baseDir}'\");\n\t\t\t}\n\n\t\t\t$path = \"{$this->protocolName}://{$path}\";\n\t\t}\n\n\t\treturn $path;\n\t}",
"public static function & replacePath ($path)\n {\n\n if (!Toolkit::isPathAbsolute($path))\n {\n\n // not an absolute path so we'll prepend to it\n $path = MO_WEBAPP_DIR . '/' . $path;\n\n }\n\n return $path;\n\n }",
"public function move($new_path)\n\t{\n\t\t$info = pathinfo($this->path);\n\t\t$new_path = $this->area->get_path($new_path);\n\n\t\t$new_path = rtrim($new_path, '\\\\/').DS.$info['basename'];\n\n\t\t$return = $this->area->rename($this->path, $new_path);\n\t\t$return and $this->path = $new_path;\n\t\t\n\t\treturn $return;\n\t}",
"protected function corrector($path)\n\t{\n\t\treturn substr(str_replace(URL::base(), '', $path), 1);\n\t}",
"abstract function changedir($path = '', $supress_debug = FALSE);",
"function simplifyPath($path);",
"function translatePath($path) {\n global $synAdminPath;\n if (strpos($path,\"§syntaxRelativePath§\")!==false) $path=str_replace(\"§syntaxRelativePath§\",$synAdminPath,$path);\n return $path;\n }",
"protected function chrootify($path) {\n if ($this->base_dir === $this->manifest['chroot_base_dir']) {\n return $path;\n } else {\n return str_replace($this->base_dir, $this->manifest['chroot_base_dir'], $path);\n }\n }",
"private function pathify(&$path) {\n\t\t$path = realpath($path).'/';\n\t}",
"public function rename($path, $newpath)\n {\n }",
"public function getFullPath($name);",
"public function update($path);",
"public function getNewPath()\n {\n $new_path = $this->new_path;\n return preg_quote($new_path, '/');\n }",
"function file_newname($path, $filename){\n if ($pos = strrpos($filename, '.')) {\n $name = substr($filename, 0, $pos);\n $ext = substr($filename, $pos);\n } else {\n $name = $filename;\n }\n\n $newpath = $path.'/'.$filename;\n $newname = $filename;\n $counter = 0;\n while (file_exists($newpath)) {\n $newname = $name .'_'. $counter . $ext;\n $newpath = $path.'/'.$newname;\n $counter++;\n }\n\n return $newname;\n }",
"function rewritePath($path)\n {\n global $rewritePathList;\n $path = ltrim($path, './');\n $urlArray = explode('/', $path);\n if (isset($rewritePathList[$urlArray[0]])) {\n $urlArray[0] = $rewritePathList[$urlArray[0]];\n }\n return implode('/', $urlArray) != '' ? implode('/', $urlArray) : './';\n }",
"protected function _replaceBase( $strPath, $strBase )\n {\n $strPath = str_replace ('\\\\', '/', $strPath );\n $nBaseLen = strlen( $strBase );\n $sName = str_replace ('\\\\', '/', $strBase );\n\n // replace $strBase at the beginning with $this->getName()\n if ( substr( $strPath, 0, $nBaseLen ) == $sName ) {\n $strPath = str_replace ('\\\\', '/',$this->getName()).substr( $strPath, $nBaseLen );\n }\n \n return $strPath;\n }",
"public static function move($_path, $_target)\r\n {\r\n return rename($_path, $_target);\r\n }",
"private function getRelativePath($base, $path) {\n\t\t$base = str_replace('\\\\', '/', $base);\n\t\t$path = str_replace('\\\\', '/', $path);\n\t\t$pos = strpos($path, $base);\n\t\tif ($pos !== false && $pos == 0) {\n\t\t\t$path = substr($path , strlen($base) + 1);\n\t\t}\n\t\treturn $path;\n\t}",
"public function move($path){\n\t\t$oldPath = $this->path;\n\t\t$path_array = explode(self::DS, $this->path);\n\t\t$fileName = $path_array[sizeof($path_array) - 1];\n\t\t$newPath = $path . self::DS . $fileName;\n\t\t$this->path = $newPath;\n\t\t$this->createFile($newPath);\n\t\tunlink($oldPath);\n\t}",
"public static function fileUp($string)\n {\n return str_replace('../', '[BADPATH]', $string);\n }",
"private function locate($path)\n {\n foreach ($this->_subdirs as $test) {\n if (($dest = realpath(sprintf(\"%s/%s\", $test, $path)))) {\n return $dest;\n }\n }\n }",
"function replace_file($path, $string, $replace)\n{\n set_time_limit(0);\n\n if (is_file($path) === true)\n {\n $file = fopen($path, 'r');\n $temp = tempnam('./', 'tmp');\n\n if (is_resource($file) === true)\n {\n while (feof($file) === false)\n {\n file_put_contents($temp, str_replace($string, $replace, fgets($file)), FILE_APPEND);\n }\n\n fclose($file);\n }\n\n unlink($path);\n }\n\n return rename($temp, $path);\n}",
"public function translatePath($fileName)\n\t{\n\t\t$fileName = str_replace('\\\\', '/', $fileName);\n\n\t\t$realDir = rtrim($this->directory, '/');\n\t\t$realDir .= '/' . dirname($fileName);\n\t\t$realDir = '/' . ltrim($realDir, '/');\n\n\t\t$fileName = $realDir . '/' . basename($fileName);\n\n\t\treturn $fileName;\n\t}",
"function resolve($path)\n {\n if (preg_match('{^\\.(/|\\\\\\\\)}', $path)) {\n $path = dirname($this->path) . DIRECTORY_SEPARATOR . $path;\n }\n\n # When resolving a directory either look for a file named\n # \"$dir/index.$ext\" or return the path to the directory (e.g.\n # for \"require_tree\").\n if (is_dir($path)) {\n $index = Path::join(array($path, \"index{$this->getExtension()}\"));\n\n if (file_exists($index)) {\n $path = $index;\n } else {\n $pathinfo = new PathInfo($path);\n\n if ($pathinfo->isAbsolute()) {\n return $path;\n }\n\n return $this->environment->loadPaths->find($path);\n }\n }\n\n $pathinfo = new PathInfo($path);\n\n if ($pathinfo->isAbsolute()) {\n return $path;\n }\n\n return $this->environment->loadPaths->find($path);\n }",
"public function moving_file_to_back_up_place()\r\n\t{\r\n\t\t$moved_file = array();\r\n\t\t$original_place = $this->get_original_upload_path();\r\n\t\t$back_up_place = $this->get_back_up_path();\r\n\t\t\r\n\t\tif($files = $this->get_folder_file_list($original_place))\r\n\t\t{\r\n\t\t\tforeach($files as $file)\r\n\t\t\t{\r\n\t\t\t\t$new_name = pathinfo($file, PATHINFO_FILENAME) . '_' . date(\"YmdHis\"). '.' . pathinfo($file, PATHINFO_EXTENSION);\r\n\t\t\t\tif(copy($original_place.$file, $back_up_place.$new_name))\r\n\t\t\t\t{\r\n\t\t\t\t\tunlink($original_place.$file);\r\n\t\t\t\t\t$moved_file[] = $back_up_place.$new_name;\r\n\t\t\t\t}\r\n\t\t\t}\t\r\n\t\t}\r\n\t\t\r\n\t\treturn $moved_file;\r\n\t}"
] |
[
"0.63198155",
"0.6181057",
"0.6043943",
"0.5876508",
"0.57774925",
"0.5758937",
"0.5727085",
"0.5626526",
"0.55739975",
"0.5565691",
"0.55467623",
"0.5523994",
"0.5459184",
"0.545905",
"0.545718",
"0.5445708",
"0.54293174",
"0.5427263",
"0.5412019",
"0.5393324",
"0.538204",
"0.53805923",
"0.5377351",
"0.53471947",
"0.53369796",
"0.5325042",
"0.5324088",
"0.52774215",
"0.5269837",
"0.52675635"
] |
0.6423593
|
0
|
/ Gets the id or object of the cheapest product on cart
|
public static function getCheapestProduct($cart,$args = array("return" => "id", "skip_free" => FALSE))
{
if(!isset($args["return"]))
{
return FALSE;
}
$skip_free = isset($args["skip_free"]) ? filter_var($args["skip_free"],FILTER_VALIDATE_BOOLEAN) : FALSE;
/*
Declare variables
*/
$cheapest_id = -1;
$cheapest_object = null;
$cheapest_price = PHP_INT_MAX;
/*
Loop through all cart items
*/
foreach($cart->cart_contents as $item)
{
/*
Detect the the cheapest item on current iteration and assign variables
*/
if(floatval($item["data"]->price) < $cheapest_price)
{
if($skip_free && floatval($item["data"]->price) == 0) continue;
$cheapest_price = floatval($item["data"]->price);
$cheapest_id = $item["product_id"];
$cheapest_object = $item;
}
}
/*
Return identifier(product_id) of the cheapest item on cart
*/
if(strtolower($args["return"]) === "id")
{
return $cheapest_id;
}
/*
Return the cheapest item object(an array of fields) on cart
*/
if(strtolower($args["return"]) === "object")
{
return $cheapest_object;
}
return FALSE;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function cheapestProduct()\n {\n return $this->productsSortedByCheapest()[0] ?? null;\n }",
"public function getOneProducto()\n {\n $sql = \"SELECT * FROM productos WHERE id = {$this->getId()}\";\n $query = $this->conexion->query($sql);\n\n if ($query == true) {\n\n $resultado = $query->fetch_object();\n return $resultado;\n }\n }",
"public function getFirstCarItem()\n {\n $query = $this->createQueryBuilder('car')\n ->setMaxResults(1)\n ->getQuery();\n\n return $query->getSingleResult();\n }",
"public function fastestProduct()\n {\n return $this->productsSortedByFastest()[0] ?? null;\n }",
"public function first()\n {\n if (!empty($this->searchProducts)) {\n return $this->searchProducts[0];\n }\n\n return null;\n }",
"public function checkCartSameProductIfExists() {\n if (func_num_args() > 0) {\n $user_id = func_get_arg(0);\n $product_id = func_get_arg(1);\n $hotel_id = func_get_arg(2);\n $quantity = func_get_arg(2);\n\n try {\n $select = $this->select()\n ->where('user_id = ?', $user_id)\n ->where('hotel_id = ?', $hotel_id)\n ->where('product_id = ?', $product_id)\n ->where('quantity = ?', $quantity);\n\n $result = $this->getAdapter()->fetchRow($select);\n\n if ($result) {\n return $result;\n } else {\n return null;\n }\n } catch (Exception $ex) {\n throw new Exception(\"argument not passed: \" . $ex);\n }\n } else {\n throw new Exception(\"argument not passed\");\n }\n }",
"public function findProductById(int $idProduct): ?object {\n\t\t// crete Default Var\n\t\t$objProduct = null;\n\t\ttry {\n\t\t\t// create Query Builder \n\t \t$qb = $this->em->createQueryBuilder();\n\t \t// create Query\n\t \t$objProduct = $qb->select('p')\n\t\t\t ->from(Product::class, 'p')\n\t\t\t ->where('p.id = :id')\n\t\t\t ->andWhere('p.status = :status')\n\t\t\t ->setParameter('id', $idProduct\t)\n\t\t\t ->setParameter('status', 1)\n\t\t\t ->getQuery()\n\t\t\t ->getOneOrNullResult();\n \t\t} catch (\\Exception $ex) {\n \t\t\t//dd($ex);\n \t\t}\n \t\t// default Return\n \t\treturn $objProduct;\n\t}",
"public function getMinimumQuantity()\n {\n $this->load('product');\n $minimum = $this->product->price()\n ->where('date_start', '<=', 'NOW()')\n ->whereRaw('(date_end > NOW() OR date_end IS NULL)')\n ->where('site_id', $this->invoice->getBaseSiteId())\n ->orderBy('min_quantity')\n ->first();\n return $minimum->min_quantity;\n }",
"public static function getProduct($cart,$product_id)\n\t{\n\t\tforeach($cart->cart_contents as $item)\n\t\t{\n\t\t\tif($item[\"data\"]->get_id() === $product_id)\n\t\t\t{\n\t\t\t\treturn $item;\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t}",
"function find_product($globillnet_id) {\n\n global $db;\n\n $product_id = null;\n $products = $db->get_products_list();\n\n foreach ($products as $product) {\n if (isset($product['globillnet_id']) && $product['globillnet_id']==$globillnet_id) {\n $product_id = $product['product_id'];\n break;\n }\n }\n\n $result = ( $product_id ) ? $product_id : false ;\n\n return $result;\n }",
"function getProdId($product){\r\n require '../../model/dbconnect.php';\r\n $prod = $db->quote($product);\r\n $rows_prod = $db->query(\"SELECT id FROM product WHERE name = $prod\");\r\n if ($rows_prod) {\r\n foreach($rows_prod as $row)\r\n return $row['id'];\r\n }\r\n }",
"public function findOne(int $id): ?Product\n {\n return Product::find($id);\n }",
"function getLeastAvailableProductByCategory($cat) {\r\n global $conn;\r\n $select = \"SELECT productid, name, image FROM product WHERE category='$cat' ORDER BY quantityavailable ASC LIMIT 1;\";\r\n $result = mysqli_query($conn, $select);\r\n return $result;\r\n}",
"public function get_first_item_id(): int {\n\t\t\treturn LP_Course_DB::getInstance()->get_first_item_id( $this->get_id() );\n\t\t}",
"public function getCartProduct(){\n $sId = session_id();\n $squery = \"SELECT * FROM tbl_cart WHERE sId='$sId'\";\n $result = $this->db->select($squery);\n if ($result) {\n return $result;\n }else {\n return false;\n }\n }",
"private function productCheck($id)\n {\n return Product::where([\n 'id' => $id,\n 'userId' => Auth::user()->id\n ])->first();\n }",
"public function getLeastFreshIngredient(): ?object\n {\n $criteria = new Criteria();\n $criteria->orderBy(['best_before' => Criteria::ASC]);\n $criteria->orderBy(['use_by' => Criteria::ASC]);\n\n $least_fresh_ingredient = $this->ingredients->matching($criteria)->first();\n\n if (false === $least_fresh_ingredient) {\n return null;\n }\n\n return $least_fresh_ingredient;\n }",
"public function selectOne($productID){\n\t\t$this->db->where('ID = ', $productID);\n\t\treturn $this->db->get('products')->result()[0];\n\n\t}",
"public function findItem(string $sku): ?CartItem;",
"public function get_id_product()\n\t{\n\t\treturn $this->id_product;\n\t}",
"private function get_product_to_duplicate( $id ) {\r\n $id = absint( $id );\r\n if ( ! $id ){\r\n return false;\r\n }\r\n\r\n global $wpdb;\r\n\r\n $post = $wpdb->get_results( \"SELECT * FROM $wpdb->posts WHERE ID=$id\" );\r\n\r\n if ( isset( $post->post_type ) && $post->post_type == \"revision\" ) {\r\n $id = $post->post_parent;\r\n $post = $wpdb->get_results( \"SELECT * FROM $wpdb->posts WHERE ID=$id\" );\r\n }\r\n return $post[0];\r\n }",
"protected function _initProduct($id=0)\n {\n if($id==0){\n $productId = (int) $this->getRequest()->getParam('product');\n }else{\n $productId = $id;\n }\n if ($productId) {\n $product = Mage::getModel('catalog/product')\n ->setStoreId(Mage::app()->getStore()->getId())\n ->load($productId);\n if ($product->getId()) {\n return $product;\n }\n }\n return false;\n }",
"function get_product_by_id($product_id) {\r\n try {\r\n $params[0] = array(\"name\" => \":prod_id\", \"value\" => &$product_id);\r\n return $this->DBObject->readCursor(\"product_actions.get_product_by_id(:prod_id)\", $params);\r\n } catch (Exception $ex) {\r\n echo \">>\" . ex;\r\n }\r\n }",
"public function get_min_product_price()\n\t{\n\t\t$this->db->select('MIN(product_selling_price) AS price')->from('product')->where(\"product_status = 1\");\n\t\t$query = $this->db->get();\n\t\t$result = $query->row();\n\t\t\n\t\treturn $result->price;\n\t}",
"private function findItemInSession(Product $product): ?int\n {\n $keyFound = null;\n\n foreach ($_SESSION['cart'] as $key => $item) {\n if ($item['product']->getId() === $product->getId()) {\n $keyFound = $key;\n }\n }\n\n return $keyFound;\n }",
"public function GetIdProducto()\n\t{\n\t\treturn $this->idProd;\n\t}",
"private function getRowId(Product $product)\n {\n $res = Cart::search(function ($cart_product, $rowId) use ($product) {\n return $cart_product->id === $product->id;\n });\n\n return !$res->isEmpty() ? $res->first()->rowId : null;\n }",
"function fn_warehouses_get_pickup_point_id_from_cart(array $cart, $cart_id)\n{\n if (empty($cart['product_groups'])) {\n return null;\n }\n\n foreach ($cart['product_groups'] as $group_id => $product_group) {\n if (!isset($product_group['products'][$cart_id])) {\n continue;\n }\n\n if (empty($product_group['chosen_shippings'])) {\n return null;\n }\n\n $shipping_id = reset($product_group['chosen_shippings'])['shipping_id'];\n if (isset($cart['select_store'][$group_id][$shipping_id])) {\n return $cart['select_store'][$group_id][$shipping_id];\n }\n }\n\n return null;\n}",
"public function findById($id)\n {\n \t$product = $this->model->whereId($id)->first();\n \n \treturn $product;\n }",
"public function find( $id ){\n \t\t$response = $this->curl->get( $this->api_url . '/' . $id, [ \n\t\t\t'access_token' => $this->token\n\t\t]);\n\t\tif( $response->success ){\n\t\t\t$product = new Product( $this );\n\t\t\t$product->fetch($response->product);\n\n\t\t\treturn $product;\n \t\t}//if\n \t\telse{\n \t\t\treturn FALSE;\n \t\t}//else\n \t}"
] |
[
"0.7430825",
"0.6587201",
"0.65110064",
"0.6487917",
"0.6450358",
"0.63289744",
"0.62233925",
"0.62021476",
"0.61957544",
"0.61931956",
"0.6175201",
"0.61621875",
"0.6048372",
"0.6042256",
"0.60308087",
"0.60210145",
"0.6002996",
"0.5987306",
"0.59816194",
"0.5969586",
"0.5940147",
"0.590656",
"0.5901547",
"0.5890149",
"0.588831",
"0.58841276",
"0.5844456",
"0.5842728",
"0.5841652",
"0.5835278"
] |
0.7454517
|
0
|
Get active song by id
|
public function getById($id)
{
$this->logger->info('get pending by id:' . $id);
$song = $this->em->getRepository('VanessaCoreBundle:Song')
->find($id);
if (!$song) {
throw new \Exception('Full song not found for id:' . $id);
$this->logger->err('Failed to find full song by id:' . $id);
}
return $song;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function getSongById($id)\n {\n return $this->wpdb->get_row(<<<SQL\nSELECT\n `{$this->wpdb->timber_songs}`.`ID`,\n `{$this->wpdb->timber_songs}`.`song_artist`,\n `{$this->wpdb->timber_songs}`.`song_name`,\n `{$this->wpdb->timber_songs}`.`song_date`,\n `{$this->wpdb->timber_shows}`.`show_name`\nFROM `{$this->wpdb->timber_songs}`\nLEFT JOIN `{$this->wpdb->timber_timeslots}`\n ON `{$this->wpdb->timber_timeslots}`.`ID` = `{$this->wpdb->timber_songs}`.`song_timeslot`\nLEFT JOIN `{$this->wpdb->timber_shows}`\n ON `{$this->wpdb->timber_shows}`.`ID` = `{$this->wpdb->timber_timeslots}`.`timeslot_show`\nWHERE `{$this->wpdb->timber_songs}`.`ID` = '$id'\nSQL\n );\n }",
"public function getsongById($id, $db){\n\t\t\n\t\t$query = \"SELECT * FROM songs WHERE id = :id\";\n\t\t$pdost = $db->prepare($query);\n\t\t\n\t\t//bindParam = Binds a parameter to the specified variable name\n\t\t$pdost->bindParam(':id', $id);\n\t\t$pdost->execute();\n\t\t\n\t\t$song = $pdost->fetch(PDO::FETCH_OBJ);\n\t\t\n\t\treturn $song;\n\t\t\n\t}",
"public function getSongById($id,$rate=128)\n\t{\n\t\treturn self::getSong($id,$rate);\n\t}",
"public function find($id)\n {\n return $this->onlinetrack->find($id);\n }",
"public function active($id){\n $active = Product::find($id)->active;\n return $active;\n }",
"public static function findById($id) {\r\n /* Connexion à la base de données */\r\n $c = Base::getConnection();\r\n\r\n /* Préparation de la requête */\r\n $query = $c->prepare(\"select * Tracks where track_id=?\");\r\n $query->bindParam(1, $id, PDO::PARAM_INT);\r\n\r\n /* Exécution de la requête */\r\n $query->execute();\r\n\r\n /* Récupération du résultat */\r\n $d = $query->fetch(PDO::FETCH_BOTH);\r\n\r\n /* Création d'un Objet */\r\n $track = new Tracks();\r\n $track->artist_id = $d['artist_id'];\r\n $track->track_id = $d['track_id'];\r\n $track->title = $d['title'];\r\n $track->mp3_url = $d['mp3_url'];\r\n\r\n\r\n return $track;\r\n }",
"public function show($id)\n {\n //get a single track by its id\n $track = Tracks::findOrFail($id);\n return $track;\n }",
"public static function findActiveOne($id='')\n {\n $tableName = static::tableName();\n return static::find()->where(['id' => $id])->andWhere([$tableName.'.status' => ActiveRecord::STATUS_ACTIVE])->one();\n }",
"public function getMediaItem($id);",
"public function get_track($track_id) { \n\n\t\t$track_id = Dba::escape($track_id); \n\t\t$playlist_id = Dba::escape($this->id); \n\n\t\t$sql = \"SELECT * FROM `playlist_data` WHERE `id`='$track_id' AND `playlist`='$playlist_id'\";\n\t\t$db_results = Dba::query($sql);\n\n\t\t$row = Dba::fetch_assoc($db_results);\n\n\t\treturn $row; \n\n\t}",
"public function getSong($song_id)\n {\n $sql = \"SELECT id, artist, track, link FROM song WHERE id = :song_id LIMIT 1\";\n $query = $this->db->prepare($sql);\n $parameters = array(':song_id' => $song_id);\n\n // useful for debugging: you can see the SQL behind above construction by using:\n // echo '[ PDO DEBUG ]: ' . debugPDO($sql, $parameters); exit();\n\n $query->execute($parameters);\n\n // fetch() is the PDO method that get exactly one result\n return $query->fetch();\n }",
"public function show($id)\n {\n $song = Song::find($id);\n if ($song) {\n return new SongResource($song);\n } else {\n return response()->json(['message' => 'NOT_FOUND'], 404);\n }\n }",
"public function find($id) {\n $sql = \"select * from t_playlist where media_id=?\";\n $row = $this->getDb()->fetchAssoc($sql, array($id));\n\n if ($row) {\n return $this->buildDomainObject($row);\n } else {\n throw new \\Exception(\"No playlist matching id \" . $id);\n }\n }",
"public function getById($id) {\n\t\treturn $this->find($id)->current();\n\t}",
"public function get_albums_by_id($id)\n {\n $this->db->where('id', $id);\n $this->db->where('num_song >', 0);\n $data_album = $this->db->get('album_song')->row_array();\n\n return $data_album;\n }",
"public function fetch_albums_id($id)\n {\n \t\t\n\t\t$this->db->select('*');\n $this->db->from(\"album_song\");\n\t\t$this->db->where('num_song >', 0);\n $this->db->where(\"user_id\", $id);\n $query = $this->db->get();\n \t\treturn $query->result();\n }",
"function get_stream($id)\n {\n return $this->db->get_where('streams', array('id' => $id))->row_array();\n }",
"public function show($id)\n {\n return BandArtist::where('id', '=', $id)\n ->first();\n }",
"function get_by_id($id)\n {\n $this->db2->where($this->id, $id);\n return $this->db2->get($this->table)->row();\n }",
"public function show($id)\n {\n $song = Song::select('song.data', 'song.created_at', 'song.name', 'song.description', 'song.image', 'song.state_id', 'u.name as user_name', 'u.last_name as user_last_name')\n ->join('users as u', 'song.created_by', 'u.id')\n ->find($id);\n\n return response()->json(['response' => $song], 200);\n }",
"public function findById($id) {\n \treturn $this->find($id)->current();\n }",
"public function getById($id)\n {\n return $this->find($id)->current();\n }",
"public function getSongInAlbum($item_id = null)\n {\n $as_table = Engine_Api::_()->getDbTable('albumSongs', 'mp3music');\n $as_name = $as_table->info('name');\n \n $select = $as_table->select()\n ->from($as_table)\n ->where('album_id = ?',$item_id);\n $songs = $as_table->fetchAll($select)->toArray();\n return $songs;\n \n }",
"function getCurPlayingTrack(){\n\n\t}",
"public function getActiveDetail($id)\n {\n $detailActiveSession = Yii::app()->db->createCommand(\n 'SELECT u.firstName, u.lastName, u.avatarPath, t.name, title, description, datePost, s.dateCreate,\n s.idUserCreate, COUNT(a.idArchive) AS numArchive, s.idSession, s.activatedPoint\n FROM sessions AS s\n INNER JOIN users AS u ON s.idUserCreate = u.idUser\n INNER JOIN topics AS t ON s.idTopic = t.idTopic \n LEFT JOIN archive_session AS a ON s.idSession = a.idSession\n WHERE (s.idSession = :idSession) AND (t.active = 1) AND (s.active = 1)')\n ->bindValues(array(':idSession' => $id))\n ->query();\n return $detailActiveSession;\n }",
"public function get($id){\n\t\t$sql = $this->db->prepare(\"SELECT * FROM tracking WHERE id = :id\");\n\t\t$sql->execute();\n\n\t\treturn $sql->fetch(PDO::FETCH_ASSOC);\n\t}",
"function getArtist($id)\n {\n //Requete de connexion\n $db = dbConnect();\n\n $query = $db->prepare ('SELECT * FROM artists WHERE id=?');\n\n $query->execute([\n $id\n ]);\n\n $result = $query->fetch();\n\n return $result; //Retourne de l'artiste en question\n }",
"public function getById($id) \n\t{\n\t\t$where = ['id' => (int) $id];\n\t\treturn parent::select($where)->current();\n\t}",
"public function getArtist($id);",
"function get_by_id($id)\r\n {\r\n $this->db->where($this->id, $id);\r\n return $this->db->get($this->table)->row();\r\n }"
] |
[
"0.69152313",
"0.6628006",
"0.6458065",
"0.626316",
"0.6220692",
"0.6214643",
"0.621022",
"0.6125378",
"0.60808015",
"0.6077895",
"0.6004832",
"0.5976299",
"0.5965122",
"0.5948838",
"0.59464395",
"0.5939348",
"0.593871",
"0.59350836",
"0.5912605",
"0.5909098",
"0.59007865",
"0.58920187",
"0.58868957",
"0.58834875",
"0.587503",
"0.58722126",
"0.586844",
"0.58599913",
"0.58469415",
"0.5826382"
] |
0.6665063
|
1
|
Get all agency songs query
|
public function listAgencySongs($options = array())
{
$this->logger->info('get all agency songs');
if (isset($options['filterBy'])) {
if ($options['filterBy'] != '0') {
$status = $this->getContainer()->get('status.manager')->getStatusByName($options['filterBy']);
if ($status) {
$options['status'] = $status;
}
}
}
return $this->em
->getRepository('VanessaCoreBundle:Song')
->getAllByAgencyTypeQuery($options);
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function getAllSongs()\n {\n $sql = \"SELECT id, artist, track, link FROM song\";\n $query = $this->db->prepare($sql);\n $query->execute();\n\n // fetchAll() is the PDO method that gets all result rows, here in object-style because we defined this in\n // core/controller.php! If you prefer to get an associative array as the result, then do\n // $query->fetchAll(PDO::FETCH_ASSOC); or change core/controller.php's PDO options to\n // $options = array(PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC ...\n return $query->fetchAll();\n }",
"function getSongs() {\n\t$sql = q(\"SELECT * FROM lib_songs\");\n\treturn getSqlArray($sql);\n}",
"public static function getSongs()\n {\n $songs = Song::with('album:id,name')->get();\n return $songs;\n }",
"function get_songs() { \n\n\t\t$results = array();\n\n\t\t$sql = \"SELECT * FROM `playlist_data` WHERE `playlist`='\" . Dba::escape($this->id) . \"' ORDER BY `track`\";\n\t\t$db_results = Dba::query($sql);\n\n\t\twhile ($r = Dba::fetch_assoc($db_results)) { \n\t\t\tif ($r['dyn_song']) { \n\t\t\t\t$array = $this->get_dyn_songs($r['dyn_song']);\n\t\t\t\t$results = array_merge($array,$results);\n\t\t\t}\n\t\t\telse { \n\t\t\t\t$results[] = $r['object_id'];\n\t\t\t} \n\n\t\t} // end while\n\n\t\treturn $results;\n\n\t}",
"public function testFetchAllSongs() {\n $songs = factory(Song::class)->create();\n\n $this->get('/graphql?query={songs{id,name,views,lyrics}}')\n ->assertStatus(200)\n ->assertExactJson([\n 'data' => [\n 'songs' => array([\n 'id' => $songs->id,\n 'name' => $songs->name,\n 'views' => $songs->views,\n 'lyrics' => $songs->lyrics\n ])\n ]\n ]);\n }",
"public function getAll($options = array())\n {\n $this->logger->info('get all active songs');\n \n $member = $this->getContainer()->get('member.manager')->getActiveUser();\n\n $options['user'] = $member;\n\n return $this->em\n ->getRepository('VanessaCoreBundle:Song')\n ->getAllQuery($options);\n }",
"public function songs()\n {\n return $this\n ->hasMany('App\\PlaylistSong', 'playlist')\n ->selectRaw('songs.id, songs.title as title, albums.title as album, name, duration, cover, artists.slug as artist_slug, albums.slug as album_slug, songs.slug as song_slug')\n ->join('songs', 'playlist_songs.song', '=', 'songs.id')\n ->join('albums', 'songs.album', '=', 'albums.id')\n ->join('artists', 'albums.artist', '=', 'artists.id')\n ->orderBy('songs.title', 'asc');\n }",
"public function getAll() {\n $songs = Song::all();\n return $this->successResponse(['songs' => $songs]);\n }",
"function get_songs() { \n\n\t\t/* Get the Current Playlist */\n\t\t//echo $this->XBMCCmd(\"getcurrentplaylist\");\n\t\t$playlist = $this->aXBMCCmd(\"getplaylistcontents\",\"0\");\n\t\t\n\t\tforeach ($playlist as $entry) { \n\t\t\t$data = array();\n\n\t\t\t/* Required Elements */\n\t\t\t$data['id'] = get_song_id_from_file(trim(substr($entry,strrpos($entry,\"/\")+1)));\n\t\t\t$data['raw'] = '';\n\t\t\t\n\n\t\t\t/* Optional Elements */\n\t\t\t$song = new Song($data['id']);\n\t\t\t$song->format_song();\n\t\t\t$data['name']\t= $song->f_artist . \" - \" . $song->f_title;\n\n\t\t\t$results[] = $data;\n\n\t\t} // foreach playlist items \n\n\t\treturn $results;\n\n\t}",
"public function getAllsong($db){\n\t\t\n\t\t$query = \"SELECT * FROM songs ORDER BY video_id Desc\";\n\t\t$pdost = $db->prepare($query);\n\t\t$pdost->execute();\n\t\t\n\t\t$song = $pdost->fetchAll(PDO::FETCH_OBJ);\n\t\t\n\t\treturn $song;\n\t}",
"public function get_songs()\n\t{\n\t\t// $this->db->order_by('songs.id', 'DESC');\n\t\t//$this->db->limit($limit, $offset);\n\t\t$query = $this->db->get('songs');\n\t\t//$this->lastQuery = $this->db->last_query();\n\n\t\tif($query->num_rows() > 0){\n return $query->result();\n }else{\n return false;\n\t\t}\n\t}",
"public function albums()\n {\n return $this\n ->hasMany('App\\Album', 'artist')\n ->selectRaw('*, albums.title as album_title, albums.slug as album_slug, count(songs.id) as song_total')\n ->leftJoin('songs', 'albums.id', '=', 'songs.album')\n ->orderBy('released', 'asc')\n ->groupBy('albums.id');\n }",
"public function get_random_songs()\n {\n $sql = \"SELECT `song`.`id` FROM `song` \";\n if (AmpConfig::get('catalog_disable')) {\n $sql .= \"LEFT JOIN `catalog` ON `catalog`.`id` = `song`.`catalog` \";\n }\n $sql .= \"WHERE `song`.`album` = ? \";\n if (AmpConfig::get('catalog_disable')) {\n $sql .= \"AND `catalog`.`enabled` = '1' \";\n }\n $sql .= \"ORDER BY RAND()\";\n $db_results = Dba::read($sql, array($this->id));\n\n while ($r = Dba::fetch_row($db_results)) {\n $results[] = $r['0'];\n }\n\n return $results;\n\n }",
"public function get_album_suite()\n {\n $results = array();\n\n $catalog_where = \"\";\n $catalog_join = \"LEFT JOIN `catalog` ON `catalog`.`id` = `song`.`catalog`\";\n if ($catalog) {\n $catalog_where .= \" AND `catalog`.`id` = '$catalog'\";\n }\n if (AmpConfig::get('catalog_disable')) {\n $catalog_where .= \" AND `catalog`.`enabled` = '1'\";\n }\n\n $sql = \"SELECT DISTINCT `album`.`id` FROM album LEFT JOIN `song` ON `song`.`album`=`album`.`id` $catalog_join \" .\n \"WHERE `album`.`mbid`='$this->mbid' $catalog_where ORDER BY `album`.`disk` ASC\";\n\n $db_results = Dba::read($sql);\n\n while ($r = Dba::fetch_assoc($db_results)) {\n $results[] = $r['id'];\n }\n\n return $results;\n\n }",
"public function get_songs($limit = 0,$artist='')\n {\n $results = array();\n\n $sql = \"SELECT `song`.`id` FROM `song` \";\n if (AmpConfig::get('catalog_disable')) {\n $sql .= \"LEFT JOIN `catalog` ON `catalog`.`id` = `song`.`catalog` \";\n }\n $sql .= \"WHERE `song`.`album` = ? \";\n $params = array($this->id);\n if (strlen($artist)) {\n $sql .= \"AND `artist` = ? \";\n $params[] = $artist;\n }\n if (AmpConfig::get('catalog_disable')) {\n $sql .= \"AND `catalog`.`enabled` = '1' \";\n }\n $sql .= \"ORDER BY `song`.`track`, `song`.`title`\";\n if ($limit) {\n $sql .= \" LIMIT \" . intval($limit);\n }\n $db_results = Dba::read($sql, $params);\n\n while ($r = Dba::fetch_assoc($db_results)) {\n $results[] = $r['id'];\n }\n\n return $results;\n\n }",
"public function getAlbums()\n\t{\n\t\treturn Db::getInstance()->executeS('SELECT * FROM `'._DB_PREFIX_.'azgallery_album`');\n\t}",
"public function listAll($options = array())\n {\n $this->logger->info('get all songs');\n $status = \"\";\n \n if (isset($options['filterBy'])) {\n if ($options['filterBy'] != '0') {\n $status = $this->getContainer()->get('status.manager')->getStatusByName($options['filterBy']);\n if ($status) {\n $options['status'] = $status;\n }\n }else{\n $options['status'] = $this->container->get('status.manager')->active();\n }\n }\n \n $member = $this->getContainer()->get('member.manager')->getActiveUser();\n\n $options['user'] = $member;\n\n return $this->em\n ->getRepository('VanessaCoreBundle:Song')\n ->getAllSongsQuery($options);\n }",
"public function songs()\n {\n return $this->hasMany(Song::class);\n }",
"public function songs()\n {\n return $this->hasMany('App\\Song', 'album');\n }",
"public function list_songs($aData)\n {\n if (!Phpfox::getUserParam('music.can_access_music'))\n {\n return array('result' => 0, 'error_code' => 1, 'message' => 'You don\\'t have permission to access music module!');\n }\n /**\n * @var int\n */\n $iAlbumId = isset($aData['iAlbumId']) ? (int) $aData['iAlbumId'] : 0;\n /**\n * @var array\n */\n $aAlbum = Phpfox::getService('music.album')->getAlbum($iAlbumId);\n if (!isset($aAlbum['album_id']))\n {\n return array('result' => 0, 'error_code' => 1, 'message' => 'Unable to find the album you want to get songs!');\n }\n if (Phpfox::isModule('privacy') && !Phpfox::getService('privacy')->check('music_album', $aAlbum['album_id'], $aAlbum['user_id'], $aAlbum['privacy'], $aAlbum['is_friend'], true))\n {\n return array('result' => 0, 'error_code' => 1, 'message' => Phpfox::getPhrase('privacy.the_item_or_section_you_are_trying_to_view_has_specific_privacy_settings_enabled_and_cannot_be_viewed_at_this_time'));\n }\n /**\n * @var array\n */\n $aSongs = Phpfox::getService('music.album')->getTracks($aAlbum['user_id'], $aAlbum['album_id'], true);\n \n // Update play time for song and album.\n if (isset($aSongs[0]))\n {\n Phpfox::getService('music.process')->play($aSongs[0]['song_id']);\n }\n \n /**\n * @var array\n */\n $aResult = array();\n foreach ($aSongs as $aSong)\n {\n $aResult[] = array(\n 'iSongId' => $aSong['song_id'],\n 'iUserId' => $aSong['user_id'],\n 'iAlbumId' => $aSong['album_id'],\n 'sTitle' => $aSong['title'],\n 'iTotalPlay' => $aSong['total_play'],\n 'sSongPath' => $aSong['song_path'],\n 'bIsFeatured' => (bool) $aSong['is_featured'],\n 'sSongPath' => $aSong['song_path'],\n 'iViewId' => $aSong['view_id'],\n 'iServerId' => $aSong['server_id'],\n 'iExplicit' => $aSong['explicit'],\n 'sDuration' => $aSong['duration'],\n 'iTimeStamp' => $aSong['time_stamp'],\n 'sTimeStamp' => date('l, F j, o', (int) $aSong['time_stamp']) . ' at ' . date('h:i a', (int) $aSong['time_stamp']),\n 'sAlbumUrl' => $aSong['album_url'],\n 'sUsername' => $aSong['user_name'],\n 'bIsOnProfile' => isset($aSong['is_on_profile']) ? true : false,\n 'iProfileUserId' => isset($aSong['profile_user_id']) ? (int) $aSong['profile_user_id'] : 0,\n 'iProfilePageId' => $aSong['profile_page_id'],\n 'iUserServerId' => $aSong['user_server_id'],\n 'sFullname' => $aSong['full_name'],\n 'iGender' => $aSong['gender'],\n 'sUserImage' => Phpfox::getLib('image.helper')->display(array(\n 'server_id' => $aSong['user_server_id'],\n 'path' => 'core.url_user',\n 'file' => $aSong['user_image'],\n 'suffix' => '_50_square',\n 'return_url' => true\n )\n ),\n 'bIsInvisible' => (bool) $aSong['is_invisible'],\n 'iUserGroupId' => $aSong['user_group_id'],\n 'iLanguageId' => isset($aSong['language_id']) ? $aSong['language_id'] : 0\n );\n }\n return $aResult;\n }",
"public function songs()\n\t{\n\t\treturn $this->hasMany('homemusic\\Song');\n\t}",
"public function get_data_songs_epk($album_id){\n return $this->db->where('album_id', $album_id)\n ->order_by('id', 'DESC')\n ->get('audio_song')->result_array();\n }",
"public function allSongs()\n {\n try {\n $songs = Songs::with([\n 'projects', 'products',\n 'writer', 'composer', 'publisher', 'subCategory',\n ])->take($this->limit)->get();\n $this->solrController->delete_all_song();\n foreach ($songs as $song) {\n $this->songSolr($song);\n }\n return $songs->count() . \" songs records successfully updated\";\n } catch (Exception $exception) {\n Log::error(\"song solr bulk upload error \" . $exception->getMessage());\n }\n }",
"function showAllAlbum() {\n $sql = \"SELECT * FROM `itf_album`\";\n return $this->dbcon->FetchAllResults($sql);\n }",
"public function index()\n {\n //\n return response()->json(Song::all());\n\n\n }",
"public function allAlbums()\n {\n return $this\n ->select(\"*\", \"artists.slug as slugArtist\", \"albums.slug as slugAlbum\", 'albums.created_at as created_at')\n ->join('artists', 'albums.artist', '=', 'artists.id')\n ->orderBy('albums.released', 'desc')\n ->paginate(10);\n }",
"public function fetch()\n {\n $sql = 'SELECT * FROM Songs';\n $songs = [];\n\n foreach ($this->con->query($sql) as $row) {\n $song = new Songs;\n $song->setID($row['ID']);\n $song->setComposersID($row['ComposersID']);\n $song->setMusicalForm($row['MusicalForm']);\n $song->setTitle($row['Title']);\n $song->setOpus($row['Opus']);\n $song->setMovement($row['Movement']);\n $song->setLength($row['Length']);\n $song->setDifficulty($row['Difficulty']);\n $song->setWantToPlay($row['WantToPlay']);\n $song->setConcertReady($row['ConcertReady']);\n $songs[] = $song;\n }\n return $songs;\n }",
"public function get_data_songs($album_id)\n {\n $data_songs = $this->db->where('album_id', $album_id)->get('audio_song')->result_array();\n\n return $data_songs;\n }",
"public function artistIndex()\n {\n return SongResource::collection(auth()->user()->artist->songs);\n }",
"public function getSongsByPage($page = 0, $songs_per_page = 50)\n {\n $page_offset = $page * $songs_per_page;\n return $this->wpdb->get_results(<<<SQL\nSELECT\n `{$this->wpdb->timber_songs}`.`ID`,\n `{$this->wpdb->timber_songs}`.`song_artist`,\n `{$this->wpdb->timber_songs}`.`song_name`,\n `{$this->wpdb->timber_songs}`.`song_date`,\n `{$this->wpdb->timber_shows}`.`show_name`\nFROM `{$this->wpdb->timber_songs}`\nLEFT JOIN `{$this->wpdb->timber_timeslots}`\n ON `{$this->wpdb->timber_timeslots}`.`ID` = `{$this->wpdb->timber_songs}`.`song_timeslot`\nLEFT JOIN `{$this->wpdb->timber_shows}`\n ON `{$this->wpdb->timber_shows}`.`ID` = `{$this->wpdb->timber_timeslots}`.`timeslot_show`\nORDER BY `{$this->wpdb->timber_songs}`.`song_date` DESC\nLIMIT $page_offset,$songs_per_page\nSQL\n );\n }"
] |
[
"0.72431135",
"0.71882904",
"0.7057298",
"0.6884623",
"0.66123635",
"0.63870215",
"0.6308103",
"0.63077956",
"0.6215603",
"0.61579037",
"0.61378616",
"0.61351913",
"0.6083352",
"0.6068459",
"0.60426927",
"0.6042515",
"0.60332626",
"0.6000224",
"0.5998828",
"0.59642494",
"0.59500116",
"0.59008545",
"0.58841306",
"0.5882272",
"0.5801571",
"0.57964677",
"0.57943714",
"0.5790583",
"0.57540625",
"0.5746325"
] |
0.7238977
|
1
|
$data = "zaaaabbbz"; echo ''; print_r(count_chars($data, 1)); die; apple Complete the sherlockAndAnagrams function below.
|
function sherlockAndAnagrams($s) {
$stringSize=strlen($s);
$data=[];
for($i=0;$i<$stringSize;$i++){
for($j=$i;$j<$stringSize;$j++){
for($t=$i;$t<=$j;$t++){
$data[$t][]=countchars($s[$t]);
}
}
}
echo '<pre>';
print_r($data);
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function mb_count_chars($input) {\r\n\t\t$l = mb_strlen($input);\r\n\t\t$unique = array();\r\n\t\tfor($i = 0; $i < $l; $i++) {\r\n\t\t\t$char = mb_substr($input, $i, 1);\r\n\t\t\tif(!array_key_exists($char, $unique))\r\n\t\t\t\t$unique[$char] = 0;\r\n\t\t\t$unique[$char]++;\r\n\t\t}\r\n\t\treturn $unique;\r\n\t}",
"function countHoles ($MyStr) {\n\n $letters = array (\n 'A' => 1,\n 'B' => 2,\n 'D' => 1,\n 'G' => 0\n );\n $count = 0;\n $count2 =0;\n $count3 =0;\n $characters = str_split ($MyStr, 1);\n\n foreach( $characters as $thisChar) {\n if ($letters[$thisChar] > 0){\n $count += $letters[$thisChar];\n }\n\n\n // Alternative short form for the if statement\n // $charVal is assigned the value found at the index or 0\n // depending if the key at the index matches the character\n // we are currently looking at.\n // Then we just add the value returned by the comparison\n // $charVal = $letters[$thisChar] || 0;\n // $count += $charVal;\n\n\n $charVal = $letters[$thisChar];\n if ($charVal)\n $count2 += $charVal;\n\n // To shorten this even more we could have said\n $charVal = $letters[$thisChar] || 0;\n $count3 += $charVal;\n }\n echo \"<br /> If statement counted \" . $count . \" holes.\";\n echo \"<br /> Short statement counted \". $count2 . \" holes.\";\n echo \"<br /> Ultra short form counted \". $count3 . \" holes\";\n return ($count);\n}",
"function countUniqChars($str)\n{\n if (strlen($str) === 0) {\n return 0;\n }\n $result = 0;\n $arrChar = [];\n $chars = str_split(mb_strtolower($str));\n foreach ($chars as $index => $char) {\n if (!in_array($chars[$index], $arrChar)) {\n $arrChar[$index] = $chars[$index];\n }\n } return count($arrChar);\n}",
"function frequentLetters($string)\n{\n $hash1 = [];\n $frequentLetters = [];\n for ($index = 0; $index < strlen($string); $index++) {\n $char = $string[$index];\n if (!array_key_exists($char, $hash1)) {\n $hash1[$char] = 0;\n }\n $hash1[$char] += 1;\n if ($hash1[$char] > 2 && !in_array($char, $frequentLetters)) {\n $frequentLetters[] = $char;\n }\n }\n // print_r($hash1);\n return $frequentLetters;\n}",
"function countUniqChars($s)\n{\n return count(array_unique(str_split($s)));\n}",
"function countUniqChars($text)\n{\n $chars = str_split($text);\n $count = 0;\n $uniqChars = [];\n foreach ($chars as $char) {\n if (in_array($char, $uniqChars)) {\n continue;\n }\n $uniqChars[] = $char;\n $count++;\n }\n\n return $count;\n}",
"function count_symbols($string){\r\n\t//Regex \\w is any non-letter, non-number: too broad\r\n\t//Better to list the ones that count\r\n\t//Escape regex symbols to gety their literal value\r\n\t$regex = '/['. preg_quote('!@#$%^&*-_+=?') . ']/';\r\n\treturn preg_match_all($regex, $string);\r\n}",
"function countUniqChars($text)\n{\n $unique = [];\n foreach (array_diff(str_split($text), [null]) as $char) {\n if (!in_array($char, $unique)) {\n $unique[] = $char;\n }\n }\n return count($unique);\n}",
"public function countPossibilities()\n {\n $count = 0;\n foreach($this->dictionary as $charGroup) {\n if($count === 0) {\n $count = count($charGroup);\n } else {\n $count = $count * count($charGroup);\n }\n }\n return $count;\n }",
"function is_anagram($string1, $string2) {\n if (count_chars($string1, 1) == count_chars($string2, 1))\n return 1;\n else\n return 0;\n}",
"function count_vowels($string){\r\n $kata = strtolower($string);\r\n $pecah = str_split($kata); \r\n $count=0;\r\n for ($i=0;$i<sizeof($pecah);$i++){\r\n if ($pecah[$i]== \"a\" || $pecah[$i]== \"i\" || $pecah[$i]== \"u\" || $pecah[$i]== \"e\"|| $pecah[$i] == \"o\"){\r\n $count++;\r\n }\r\n }\r\n \r\n echo $count;\r\n }",
"function getOcurrencesLetters($book) {\n $count = array();\n $strlen = strlen($book); // O(1)\n for ($i = 0; $i <= $strlen; $i++) {\n $char = substr($book, $i, 1);\n if ($char) {\n if (!isset($count[$char])) {\n $count[$char] = 0;\n }\n $count[$char] += 1;\n }\n }\n return $count;\n}",
"function getTries(& $word) {\r\n //Remember you want 2x the number of letters in the word\r\n $tries = strlen($word) * 2;\r\n return $tries;\r\n}",
"function beautify_string($string){\n $score = 0;\n\t$string = strtolower($string);\n\t$counts = array();\n\t\n\t//count occurences of string values if between a-z\n\tfor($i = 0; $i < strlen($string); $i++){\n\t\tif(preg_match(\"/^[a-z]$/\", $string[$i])){\n\t\t\tif(!array_key_exists($string[$i], $counts)){\n\t\t\t\t$counts[$string[$i]] = 1;\n\t\t\t}else{\n\t\t\t\t$counts[$string[$i]]++;\n\t\t\t}\n\t\t}\n\t}\n\t\n\t//sort occurences by appearance\n\tarsort($counts);\n\t\n\t//calculate score\n\t$beauty = 26;\n\t$score = 0;\n\t\n\tforeach($counts AS $key => $value) {\n\t\t$score += $beauty * $value;\n\t\t$beauty--;\n\t}\n\t\n\treturn($score);\n\t\n}",
"function encode($input)\n{\n if ($input == '') {\n return '';\n }\n\n $data = [];\n $lastInsertIndex = 0;\n $result = '';\n\n for ($i = 0; $i < strlen($input); $i++) {\n if ($i === 0) {\n $data[$i] = [$input[$i] => 1];\n continue;\n }\n\n if ($input[$i] === $input[$i-1]) {\n $data[$lastInsertIndex][$input[$lastInsertIndex]]++;\n continue;\n } else {\n $data[$i] = [$input[$i] => 1];\n $lastInsertIndex = $i;\n continue;\n }\n }\n\n foreach($data as $k=>$v) {\n foreach($v as $letter=>$count) {\n if ($count > 1) {\n $result .= $count . $letter;\n } else {\n $result .= $letter;\n }\n }\n }\n return $result;\n}",
"public function calculate_number_of_equal_first_characters(){\n $counter = 0;\n for ($key=0; $key<strlen($this->initial_word); $key++) {\n if($this->initial_word[$key] == $this->final_word[$key]){\n $counter += 1;\n }else{\n $this->number_of_equal_first_characters = $counter;\n return;\n }\n }\n $this->number_of_equal_first_characters = $counter;\n }",
"function repeatedString($s, $n)\n{\n\n $a = 0;\n $aTotal = 0;\n $contador = floor($n/strlen($s));\n $resto = $n%strlen($s);\n\n for($i=0 ; $i <strlen($s) ; $i++) if($s[$i] == \"a\" ) $a++;\n\n $aTotal = $contador*$a;\n\n for( $i = 0 ; $i < $resto ; $i++) if($s[$i] == \"a\") $aTotal++;\n\n return $aTotal;\n}",
"function count_x($string) {\n if (empty($string)) {\n return 0;\n }\n $index = 0;\n return _count_x($string, $index);\n}",
"function returnCharacterCount(string $character, string $string): int\n {\n $counter = 0;\n\n for ($i = 0; $i < strlen($string); $i++) {\n if ($character == $string[$i]) {\n $counter++;\n }\n }\n return $counter;\n }",
"function countOnes($n){\r\n $count = 0;\r\n for($i=0;$i<strlen($n); $i++){\r\n if($n[$i]=='1') $count++;\r\n elseif($n[$i]=='0') {\r\n $count-1;\r\n }else return;\r\n }return \"Number of 1s:\".$count;\r\n }",
"function encodeString($input_string)\n{\n $count = 0;\n $temp_str = '';\n $str_length = strlen($input_string);\n \n for($i=0;$i<$str_length;$i++)\n {\n $limit = 1;\n \n $curr = substr($input_string, $i, $limit); \n $next = substr($input_string, $i+1, $limit); \n \n //comparing current character with the next character\n if($curr == $next)\n {\n $count++;\n }\n else{\n $cnt = $count + 1;\n if($cnt != 1)\n {\n $temp_str .= $input_string[$i].$cnt; \n }\n else{\n $temp_str .= $input_string[$i];\n }\n \n $count = 0;\n }\n }\n \n return $temp_str;\n}",
"function hashing($s){\r\n $letters = \"acdegilmnoprstuw\";\r\n $h = 7;\r\n if(!empty($s)){\r\n $chars = str_split($s);\r\n foreach($chars as $char){\r\n $h = bcadd(bcmul($h,37), stripos($letters,$char));\r\n }\r\n return $h;\r\n }\r\n }",
"function str_utf8_mix_word_count($str = \"\"){\n\t$utf8_chinese_pattern=\"/[\\x{4e00}-\\x{9fff}\\x{f900}-\\x{faff}]/u\";\n\t$utf8_symbol_pattern=\"/[\\x{ff00}-\\x{ffef}\\x{2000}-\\x{206F}]/u\";\n $str = preg_replace($utf8_symbol_pattern, \"\", $str);\n return str_utf8_chinese_word_count($str) + strlen(preg_replace($utf8_chinese_pattern, \"\", $str));\n}",
"function compressString($input_string)\n{\t\n $count = 0;\n $temp_str = '';\n \n for($i=0;$i<strlen($input_string);$i++)\n {\n //comparing current character with the next character\n if($input_string[$i] == $input_string[$i + 1])\n {\n $count++;\n }\n else {\n $cnt = $count + 1;\n if($cnt != 1)\n {\n $temp_str .= $input_string[$i].$cnt; \n }\n else{\n $temp_str .= $input_string[$i];\n }\n \n $count = 0;\n }\n }\n \n return $temp_str;\n}",
"function charCounter($c, array $grid): int {\n $total = 0;\n $h = count($grid);\n $w = count($grid[array_keys($grid)[0]]);\n $y0 = min(array_keys($grid));\n $x0 = min(array_keys($grid[array_keys($grid)[0]]));\n for ($y = $y0; $y < $y0 + $h; $y++) {\n for ($x = $x0; $x < $x0 + $w; $x++) {\n if ($grid[$y][$x] === $c) {\n $total++;\n }\n }\n }\n return $total;\n }",
"public function getCharLength();",
"public function getCharactersCount()\n {\n return count($this->characters);\n }",
"function numJewelsInStones($J,$S){\n $jArr = str_split($J,1);\n $jArr = array_flip($jArr);\n $len = strlen($S);\n $r = 0;\n for($i=0;$i<$len;$i++){\n $key = $S[$i];\n if(isset($jArr[$key])){\n $r++;\n }\n }\n return $r;\n}",
"function camelcase($s) {\n \n $count=1;\n\n for($i=0; $i<strlen($s); $i++){\n if(preg_match('/[A-Z]$/',$s[$i])==true)\n {\n $count++;\n }\n }\n\n return $count;\n\n}",
"function checkAnagram($inputStr, $anagram) {\n //$inputStr = 'Upshot Tech';\n //$anagram = 'Hutches Top';\n $errorMsg = 'Not an anagram string';\n $successMsg = \"'$anagram' is anagram of '$inputStr'\";\n if (strlen($inputStr) < strlen($anagram)) {\n return $errorMsg;\n }\n $inputStringAvaiArr = array();\n for ($i = 0; $i < strlen($inputStr); $i++) {\n $index= strtolower($inputStr[$i]);\n $inputStringAvaiArr[$index] = @$inputStringAvaiArr[$index] + 1;\n }\n for ($i = 0; $i < strlen($anagram); $i++) {\n $index= strtolower($anagram[$i]);\n if (!isset($inputStringAvaiArr[$index]) || $inputStringAvaiArr[$index] <= 0) {\n return $errorMsg;\n } else {\n $inputStringAvaiArr[$index] -=1;\n }\n }\n return $successMsg;\n}"
] |
[
"0.70529413",
"0.69130886",
"0.68048847",
"0.679945",
"0.675338",
"0.6726997",
"0.6604129",
"0.6516947",
"0.6382625",
"0.63605124",
"0.6256747",
"0.6214705",
"0.6211156",
"0.6205713",
"0.6164726",
"0.614443",
"0.61122096",
"0.6111797",
"0.6110231",
"0.6066406",
"0.6034416",
"0.60123825",
"0.5994372",
"0.59798324",
"0.59645927",
"0.59312224",
"0.5929945",
"0.5901502",
"0.58934134",
"0.589218"
] |
0.79782844
|
0
|
Generates floor plan payload
|
private function getPlanPayload(Plan $plan) {
return $this->stripNulls([
'id' => $plan->id,
'tiles' => $this->getHttpRequest()->getUrl()->getBaseUrl() . $this->context->tiles->getTilesBasePath($plan),
'minZoom' => $plan->getMinZoom(),
'maxZoom' => $plan->getMaxZoom(),
'boundingSW' => $this->convertCoordinates($plan->getBoundingSW()),
'boundingNE' => $this->convertCoordinates($plan->getBoundingNE()),
'floor' => $plan->floor->getFloorNumber(),
]);
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"private function GENPayload() {\n\n\t\t$payload = pack('C', 1);\n\n\t\t$sensCount = mt_rand(1, 8);\n\n\t\t$sensors = '';\n\n\t\tfor ( $idx = 0; $idx < $sensCount; $idx++ ) {\n\t\t\t$sensor;\n\t\t\t$sensorValue;\n\n\t\t\t$sensType = mt_rand(1,7);\n\n\t\t\t$sensor = pack('v', $sensType);\n\t\t\t$sensorValue = pack('V', mt_rand());\n\n\t\t\t$sensors = $sensors . $sensor . $sensorValue;\n\n\t\t}\n\n\t\t$payload = $payload . $sensors;\n\n\t\t$this->payload_raw = base64_encode($payload);\n\n\t}",
"public function create($planData)\n {\n \t$planPurchase \t\t\t\t = new PlanPurchase();\n\t\t$planPurchase->user_id \t\t = $this->user->id;\n\t\t$planPurchase->plan_id \t\t = $planData->plan_id;\n\t\t$planPurchase->country_code = $planData->country_code;\n\t\t$planPurchase->gold_price = (float)$this->plan->gold_price;\n\t\t$planPurchase->transaction_id = $planData->transaction_id;\n\t\t$planPurchase->save();\n\n \t/** Add Chest Capacity value in user's table **/\n \t(new ChestService)->setUser($this->user)->expand($this->plan->bucket);\n \t\n /** Deduct User Gold **/\n $goldBalance = (new UserRepository($this->user))->deductGold($this->plan->gold_price);\n\n \t/** return the available skeleton keys **/\n \treturn ['chest_bucket'=> $this->user->buckets['chests'], 'available_gold_balance'=> $goldBalance];\n }",
"function inspiry_submit_floor_plans( $property_id, $inspiry_floor_plans ) {\n\n\t\tif ( is_array( $inspiry_floor_plans ) ) {\n\n\t\t\tforeach ( $inspiry_floor_plans as $floor_plan => $values ) {\n\n\t\t\t\t// remove empty values before adding to database\n\t\t\t\t$r = array_filter( $values, 'strlen' );\n\t\t\t\tif ( empty( $r ) ) {\n\t\t\t\t\tunset( $inspiry_floor_plans[ $floor_plan ] );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t$inspiry_floor_plans = inspiry_sanitize_floor_plans( $inspiry_floor_plans );\n\n\t\t\tupdate_post_meta( $property_id, 'inspiry_floor_plans', $inspiry_floor_plans );\n\t\t}\n\t}",
"public function create_plan($requestData){\n \n // ### Create Plan\n try {\n // Create a new instance of Plan object\n $plan = new Plan();\n if(isset($requestData['plan'])){\n $this->setArrayToMethods($this->checkEmptyObject($requestData['plan']), $plan);\n } \n // # Payment definitions for this billing plan.\n $paymentDefinition = new PaymentDefinition(); \n $paymentDefinition\n ->setAmount(new Currency($requestData['paymentDefinition']['Amount']));\n array_pop($requestData['paymentDefinition']);\n if(!empty($this->checkEmptyObject((array)$paymentDefinition))){\n $this->setArrayToMethods(array_filter($requestData['paymentDefinition']), $paymentDefinition); \n }\n \n // Charge Models\n $chargeModel = new ChargeModel();\n $chargeModel->setAmount(new Currency($requestData['chargeModel']['Amount']));\n array_pop($requestData['chargeModel']);\n if(!empty($this->checkEmptyObject((array)$chargeModel))){\n $this->setArrayToMethods(array_filter($requestData['chargeModel']), $chargeModel); \n $paymentDefinition->setChargeModels(array($chargeModel));\n }\n \n $merchantPreferences = new MerchantPreferences();\n $baseUrl = $requestData['baseUrl'];\n\n $merchantPreferences->setReturnUrl($baseUrl.$requestData['ReturnUrl'])\n ->setCancelUrl($baseUrl.$requestData['CancelUrl']);\n if(!empty($this->checkEmptyObject($requestData['merchant_preferences']['SetupFee']))){\n $merchantPreferences->setSetupFee(new Currency($requestData['merchant_preferences']['SetupFee']));\n }\n array_pop($requestData['merchant_preferences']);\n \n if(isset($requestData['merchant_preferences'])){\n $this->setArrayToMethods($this->checkEmptyObject($requestData['merchant_preferences']), $merchantPreferences);\n }\n if(!empty($this->checkEmptyObject((array)$paymentDefinition))){\n $plan->setPaymentDefinitions(array($paymentDefinition));\n }\n if(!empty($this->checkEmptyObject((array)$merchantPreferences))){\n $plan->setMerchantPreferences($merchantPreferences);\n } \n $requestArray= clone $plan;\n $output = $plan->create($this->_api_context); \n $returnArray['RESULT'] = 'Success';\n $returnArray['PLAN'] = $output->toArray();\n $returnArray['RAWREQUEST']=$requestArray->toJSON();\n $returnArray['RAWRESPONSE']=$output->toJSON();\n return $returnArray; \n } catch (\\PayPal\\Exception\\PayPalConnectionException $ex) {\n return $this->createErrorResponse($ex);\n }\n }",
"public function prepare_getVillaFloorPlan($params)\n\t{\n\t\t$xml_string = \"strVillaURL=\".$params['strVillaURL'].\"\";\n\t\treturn $xml_string;\n\t}",
"private function createPlan(){\n if(!$this->request->plan_name || !$this->request->plan_description) {\n return false;\n }\n $this->plan = Planes::create([\n 'name' => $this->request->plan_name,\n 'description' => $this->request->plan_description,\n 'price' => $this->request->price,\n 'product_id' => $this->request->product_id,\n 'balance' => $this->request->balance,\n ]);\n $this->plan = new PlanesFormatter($this->plan);\n }",
"protected function createNetworkFloorPlanRequest($network_id, $create_network_floor_plan)\n {\n // verify the required parameter 'network_id' is set\n if ($network_id === null || (is_array($network_id) && count($network_id) === 0)) {\n throw new \\InvalidArgumentException(\n 'Missing the required parameter $network_id when calling createNetworkFloorPlan'\n );\n }\n // verify the required parameter 'create_network_floor_plan' is set\n if ($create_network_floor_plan === null || (is_array($create_network_floor_plan) && count($create_network_floor_plan) === 0)) {\n throw new \\InvalidArgumentException(\n 'Missing the required parameter $create_network_floor_plan when calling createNetworkFloorPlan'\n );\n }\n\n $resourcePath = '/networks/{networkId}/floorPlans';\n $formParams = [];\n $queryParams = [];\n $headerParams = [];\n $httpBody = '';\n $multipart = false;\n\n\n // path params\n if ($network_id !== null) {\n $resourcePath = str_replace(\n '{' . 'networkId' . '}',\n ObjectSerializer::toPathValue($network_id),\n $resourcePath\n );\n }\n\n // body params\n $_tempBody = null;\n if (isset($create_network_floor_plan)) {\n $_tempBody = $create_network_floor_plan;\n }\n\n if ($multipart) {\n $headers = $this->headerSelector->selectHeadersForMultipart(\n ['application/json']\n );\n } else {\n $headers = $this->headerSelector->selectHeaders(\n ['application/json'],\n ['application/json']\n );\n }\n\n // for model (json/xml)\n if (isset($_tempBody)) {\n // $_tempBody is the method argument, if present\n $httpBody = $_tempBody;\n \n if($headers['Content-Type'] === 'application/json') {\n // \\stdClass has no __toString(), so we should encode it manually\n if ($httpBody instanceof \\stdClass) {\n $httpBody = \\GuzzleHttp\\json_encode($httpBody);\n }\n // array has no __toString(), so we should encode it manually\n if(is_array($httpBody)) {\n $httpBody = \\GuzzleHttp\\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));\n }\n }\n } elseif (count($formParams) > 0) {\n if ($multipart) {\n $multipartContents = [];\n foreach ($formParams as $formParamName => $formParamValue) {\n $multipartContents[] = [\n 'name' => $formParamName,\n 'contents' => $formParamValue\n ];\n }\n // for HTTP post (form)\n $httpBody = new MultipartStream($multipartContents);\n\n } elseif ($headers['Content-Type'] === 'application/json') {\n $httpBody = \\GuzzleHttp\\json_encode($formParams);\n\n } else {\n // for HTTP post (form)\n $httpBody = \\GuzzleHttp\\Psr7\\build_query($formParams);\n }\n }\n\n // this endpoint requires API key authentication\n $apiKey = $this->config->getApiKeyWithPrefix('X-Cisco-Meraki-API-Key');\n if ($apiKey !== null) {\n $headers['X-Cisco-Meraki-API-Key'] = $apiKey;\n }\n\n $defaultHeaders = [];\n if ($this->config->getUserAgent()) {\n $defaultHeaders['User-Agent'] = $this->config->getUserAgent();\n }\n\n $headers = array_merge(\n $defaultHeaders,\n $headerParams,\n $headers\n );\n\n $query = \\GuzzleHttp\\Psr7\\build_query($queryParams);\n return new Request(\n 'POST',\n $this->config->getHost() . $resourcePath . ($query ? \"?{$query}\" : ''),\n $headers,\n $httpBody\n );\n }",
"public function getPlan();",
"public function create($plan, array $properties = array());",
"public function run()\n {\n $growthPlan = [\n [\n 'plan_id' => 2,\n 'paid_permission_id' => 1, // Read Content\n ],\n [\n 'plan_id' => 2,\n 'paid_permission_id' => 2, // TrustSpot Review\n ],\n [\n 'plan_id' => 2,\n 'paid_permission_id' => 3, //Email Customization\n ],\n [\n 'plan_id' => 2,\n 'paid_permission_id' => 4, //Referral Program\n ],\n [\n 'plan_id' => 2,\n 'paid_permission_id' => 5, //Import Existing Customers\n ],\n [\n 'plan_id' => 2,\n 'paid_permission_id' => 6, //Integrations\n ],\n [\n 'plan_id' => 2,\n 'paid_permission_id' => 7, //Rewards Link\n ],\n [\n 'plan_id' => 2,\n 'paid_permission_id' => 8, //Customer Segmentation\n ],\n [\n 'plan_id' => 2,\n 'paid_permission_id' => 9, //Earning Limits\n ],\n [\n 'plan_id' => 2,\n 'paid_permission_id' => 10, //Remove Lootly Branding\n ],\n [\n 'plan_id' => 2,\n 'paid_permission_id' => 11, //Remove Lootly Branding for Email\n ],\n [\n 'plan_id' => 2,\n 'paid_permission_id' => 12, //Email Earning Customization\n ],\n [\n 'plan_id' => 2,\n 'paid_permission_id' => 13, //Email Spending Customization\n ],\n [\n 'plan_id' => 2,\n 'paid_permission_id' => 27, //Earning Limits\n ],\n ];\n\n $unlimatePlan = [\n [\n 'plan_id' => 3,\n 'paid_permission_id' => 14, //Employee Access\n ],\n [\n 'plan_id' => 3,\n 'paid_permission_id' => 15, //Advanced Customization\n ],\n [\n 'plan_id' => 3,\n 'paid_permission_id' => 16, //Advanced Earning Customization\n ],\n [\n 'plan_id' => 3,\n 'paid_permission_id' => 17, //Advanced Spending Customization\n ],\n [\n 'plan_id' => 3,\n 'paid_permission_id' => 18, //Advanced Referral Customization\n ],\n [\n 'plan_id' => 3,\n 'paid_permission_id' => 19, //Advanced Tab Customization\n ],\n [\n 'plan_id' => 3,\n 'paid_permission_id' => 20, //VIP Program\n ],\n [\n 'plan_id' => 3,\n 'paid_permission_id' => 21, //Rewards Page\n ],\n [\n 'plan_id' => 3,\n 'paid_permission_id' => 22, //Variable Discount Coupons\n ],\n [\n 'plan_id' => 3,\n 'paid_permission_id' => 23, //Insights & Reports\n ],\n [\n 'plan_id' => 3,\n 'paid_permission_id' => 24, //HTML Editor\n ],\n [\n 'plan_id' => 3,\n 'paid_permission_id' => 25, //Points Expiration\n ],\n ];\n $unlimatePlan = array_merge($unlimatePlan, $this->changePlanId($growthPlan, 3));\n\n $enteprisePlan = [\n [\n 'plan_id' => 4,\n 'paid_permission_id' => 26, //Custom Domain\n ],\n ];\n $enteprisePlan = array_merge($enteprisePlan, $this->changePlanId($unlimatePlan, 4));\n\n \\DB::table('plans_permissions')->delete();\n \\DB::table('plans_permissions')->insert(array_merge($growthPlan, $unlimatePlan, $enteprisePlan));\n }",
"public function run()\n {\n Plan::factory()->createMany([\n ['id' => Plan::FREE_PLAN, 'name' => 'Free', 'monthly_payment' => 0],\n ['id' => Plan::BASIC_PLAN, 'name' => 'Basic', 'monthly_payment' => 100],\n ['id' => Plan::PLUS_PLAN, 'name' => 'Plus', 'monthly_payment' => 187],\n ]);\n }",
"protected function createPayload()\n {\n if ($this->data instanceof Closure) {\n $closure = serialize(new Helpers\\SerializableClosure($this->data));\n $data = compact('closure');\n } else {\n $data = $this->data;\n }\n\n return json_encode(array('id' => $this->id, 'class' => $this->class, 'data' => $data));\n }",
"public function getLinkplan() {\n $sql = \"SELECT sm_planFloor FROM `SM_FLOOR` WHERE sm_idBuilding='$this->idBuilding' AND sm_idFloor = '$this->idFloor'\";\n $result = $this->mysqli->query($sql)->fetch_array();\n return $result['sm_planFloor'];\n }",
"public function run()\n {\n $plans =\n array(\n array(\n \"product_id\"=>1,\n \"title\" => \"Basic\",\n \"pricing\" => 6850,\n \"period\" => \"monthly\",\n \"functionality\" => \"Maximum of 5 User accounts;\n 1 Free system admin account;\n 500 SMS notifications in a month;\n A maximum of 500,000 customer records;\n All reports;\",\n \"note\"=>null\n ),\n array(\n \"product_id\"=>1,\n \"title\" => \"Standard\",\n \"pricing\" => 11800,\n \"period\" => \"monthly\",\n \"functionality\" => \"Maximum of 15 User accounts;\n 1 Free system admin account;\n 1000 SMS notifications in a month;\n A maximum of 1,500,000 customer records;\n All reports;\",\n \"note\"=>null\n ),\n array(\n \"product_id\"=>1,\n \"title\" => \"Enterprise\",\n \"pricing\" => 21550,\n \"period\" => \"monthly\",\n \"functionality\" => \"Maximum of 100 User accounts;\n 1 Free system admin account;\n 5000 SMS notifications in a month;\n A maximum of 500,000 customer records;\n Organization with multiple receptions\n All reports;\",\n \"note\" => \"Extra functionality will be charged at 2% of the Basic\"\n ),\n\n /******************module 2*****************/\n\n array(\n \"product_id\"=>2,\n \"title\" => \"Basic\",\n \"pricing\" => 18000,\n \"period\" => \"monthly\",\n \"functionality\" => \"Maximum of 5 User accounts;\n 1 Free system admin account;\n A maximum of 500,000 customer records;\n Free end user android mobile application on 5 devices;\n A maximum of 5 E-Security desk;\n All reports;\",\n \"note\"=>null\n ),\n array(\n \"product_id\"=>2,\n \"title\" => \"Standard\",\n \"pricing\" => 25800,\n \"period\" => \"monthly\",\n \"functionality\" => \"Maximum of 15 User accounts;\n 1 Free system admin account;\n A maximum of 1,500,000 customer records;\n Free end user android mobile application on 15 devices;\n A maximum of 15 E-Security desk;\n All reports;\",\n \"note\"=>null\n ),\n array(\n \"product_id\"=>2,\n \"title\" => \"Enterprise\",\n \"pricing\" => 50550,\n \"period\" => \"monthly\",\n \"functionality\" => \"Maximum of 100 User accounts;\n 1 Free system admin account;\n A maximum of 5,000,000 customer records;\n Free end user android mobile application on 100 devices;\n A maximum of 100 E-Security desk;\n All reports;\",\n \"note\" => \"Extra functionality will be charged at 2% of the Basic\"\n )\n );\n\n DB::table('plans')->delete();\n DB::table('plans')->insert($plans);\n\n }",
"public function run()\n\t{\n\t\tModel::unguard();\n\n\t\tPlan::create([\n\t\t\t'name' => 'Gratuito', \n\t\t\t'quantity_oportunities' => 1, \n\t\t\t'price' => 0.0]);\n\t\tPlan::create([\n\t\t\t'name' => 'Básico', \n\t\t\t'quantity_oportunities' => 10, \n\t\t\t'price' => 99.0]);\n\t\tPlan::create([\n\t\t\t'name' => 'Premium', \n\t\t\t'quantity_oportunities' => 50, \n\t\t\t'price' => 149.0]);\n\t}",
"protected function getNetworkFloorPlanRequest($network_id, $floor_plan_id)\n {\n // verify the required parameter 'network_id' is set\n if ($network_id === null || (is_array($network_id) && count($network_id) === 0)) {\n throw new \\InvalidArgumentException(\n 'Missing the required parameter $network_id when calling getNetworkFloorPlan'\n );\n }\n // verify the required parameter 'floor_plan_id' is set\n if ($floor_plan_id === null || (is_array($floor_plan_id) && count($floor_plan_id) === 0)) {\n throw new \\InvalidArgumentException(\n 'Missing the required parameter $floor_plan_id when calling getNetworkFloorPlan'\n );\n }\n\n $resourcePath = '/networks/{networkId}/floorPlans/{floorPlanId}';\n $formParams = [];\n $queryParams = [];\n $headerParams = [];\n $httpBody = '';\n $multipart = false;\n\n\n // path params\n if ($network_id !== null) {\n $resourcePath = str_replace(\n '{' . 'networkId' . '}',\n ObjectSerializer::toPathValue($network_id),\n $resourcePath\n );\n }\n // path params\n if ($floor_plan_id !== null) {\n $resourcePath = str_replace(\n '{' . 'floorPlanId' . '}',\n ObjectSerializer::toPathValue($floor_plan_id),\n $resourcePath\n );\n }\n\n // body params\n $_tempBody = null;\n\n if ($multipart) {\n $headers = $this->headerSelector->selectHeadersForMultipart(\n ['application/json']\n );\n } else {\n $headers = $this->headerSelector->selectHeaders(\n ['application/json'],\n ['application/json']\n );\n }\n\n // for model (json/xml)\n if (isset($_tempBody)) {\n // $_tempBody is the method argument, if present\n $httpBody = $_tempBody;\n \n if($headers['Content-Type'] === 'application/json') {\n // \\stdClass has no __toString(), so we should encode it manually\n if ($httpBody instanceof \\stdClass) {\n $httpBody = \\GuzzleHttp\\json_encode($httpBody);\n }\n // array has no __toString(), so we should encode it manually\n if(is_array($httpBody)) {\n $httpBody = \\GuzzleHttp\\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));\n }\n }\n } elseif (count($formParams) > 0) {\n if ($multipart) {\n $multipartContents = [];\n foreach ($formParams as $formParamName => $formParamValue) {\n $multipartContents[] = [\n 'name' => $formParamName,\n 'contents' => $formParamValue\n ];\n }\n // for HTTP post (form)\n $httpBody = new MultipartStream($multipartContents);\n\n } elseif ($headers['Content-Type'] === 'application/json') {\n $httpBody = \\GuzzleHttp\\json_encode($formParams);\n\n } else {\n // for HTTP post (form)\n $httpBody = \\GuzzleHttp\\Psr7\\build_query($formParams);\n }\n }\n\n // this endpoint requires API key authentication\n $apiKey = $this->config->getApiKeyWithPrefix('X-Cisco-Meraki-API-Key');\n if ($apiKey !== null) {\n $headers['X-Cisco-Meraki-API-Key'] = $apiKey;\n }\n\n $defaultHeaders = [];\n if ($this->config->getUserAgent()) {\n $defaultHeaders['User-Agent'] = $this->config->getUserAgent();\n }\n\n $headers = array_merge(\n $defaultHeaders,\n $headerParams,\n $headers\n );\n\n $query = \\GuzzleHttp\\Psr7\\build_query($queryParams);\n return new Request(\n 'GET',\n $this->config->getHost() . $resourcePath . ($query ? \"?{$query}\" : ''),\n $headers,\n $httpBody\n );\n }",
"public function run()\n {\n Plan::create([\n 'name'=>'Plan 5',\n 'sogod_rate'=>600,\n 'outside_sogod_rate'=>800\n ]);\n\n Plan::create([\n 'name'=>'Plan 10',\n 'sogod_rate'=>1200,\n 'outside_sogod_rate'=>1600\n ]);\n\n Plan::create([\n 'name'=>'Plan 15',\n 'sogod_rate'=>1800,\n 'outside_sogod_rate'=>2400\n ]);\n\n Plan::create([\n 'name'=>'Plan 20',\n 'sogod_rate'=>2400,\n 'outside_sogod_rate'=>3200\n ]);\n }",
"public function OrderCreatexml($req)\n {\n if ($req['offer']['contactDetail']['Destinationphone'] != '') {\n $PhoneContact = array(\n 'Application' => 'Personal',\n 'Number' => array(\n '@CountryCode' => $req['offer']['contactDetail']['Destinationphonecode'],\n '@' => $req['offer']['contactDetail']['phone'],\n ),\n 'Number' => array(\n '@CountryCode' => $req['offer']['contactDetail']['Destinationphonecode'],\n '@' => $req['offer']['contactDetail']['Destinationphone'],\n ),\n );\n } else {\n $PhoneContact = array(\n 'Application' => 'Personal',\n 'Number' => array(\n '@CountryCode' => $req['offer']['contactDetail']['Destinationphonecode'],\n '@' => $req['offer']['contactDetail']['phone'],\n ),\n );\n }\n\n /* Set Traveller */\n foreach ($req['offer']['Traveler'] as $key => $Traveler) {\n if ($Traveler['details']['frequentFlyer'] != '' && $Traveler['details']['frequentFlyerType'] != '') {\n $FOID = array(\n 'Type' => 'FF',\n 'ID' => array(\n '@VendorCode' => $Traveler['details']['frequentFlyerType'],\n '@' => $Traveler['details']['frequentFlyer'],\n ),\n );\n } else {\n $FOID = '';\n }\n $birthDate = explode('/', $Traveler['details']['birthdate']);\n $DateOfExpiration = explode('/', $Traveler['details']['exp_date']);\n $Passengers[] = array(\n '@ObjectKey' => 'PAX' . ($key + 1),\n 'PTC' => array(\n '@Quantity' => 1,\n '@' => $Traveler['Type'],\n ),\n 'ResidenceCode' => $Traveler['details']['nationality'],\n 'Age' => array(\n 'BirthDate' => $birthDate[2] . '-' . $birthDate[0] . '-' . $birthDate[1],\n ),\n 'Name' => array(\n 'Title' => $Traveler['details']['gender'],\n 'Surname' => $Traveler['details']['lname'],\n 'Given' => $Traveler['details']['fname'],\n 'Middle' => '',\n ),\n 'ProfileID' => 123,\n 'Contacts' => array(\n 'Contact' => array(\n 'EmailContact' => array(\n 'Address' => $req['offer']['contactDetail']['email'],\n ),\n 'PhoneContact' => $PhoneContact,\n ),\n ),\n 'Gender' => ($Traveler['details']['gender'] != 'Mr' && $Traveler['details']['gender'] != 'Mstr') ? 'Female' : 'Male',\n 'Title' => $Traveler['details']['gender'],\n 'PassengerIDInfo' => array(\n 'FOID' => array(\n $FOID,\n ),\n 'PassengerDocument' => array(\n 'Type' => $Traveler['details']['type'],\n 'ID' => $Traveler['details']['ppname'],\n 'DateOfExpiration' => $DateOfExpiration[2] . '-' . $DateOfExpiration[0] . '-' . $DateOfExpiration[1],\n 'CountryOfIssuance' => $Traveler['details']['country'],\n 'CountryOfResidence' => $Traveler['details']['nationality'],\n ),\n ),\n );\n }\n\n /* Set Offer */\n $total = 0;\n $OwnerId = $req['offer']['AnonymousTravelerList']['FlightSegmentList']['FlightSegment'][0]['MarketingCarrier']['AirlineID'];\n foreach ($req['offer']['Airlineoffer'] as $key => $offer) {\n $total += $offer['PriceDetail']['DetailCurrencyPrice']['Total'];\n foreach ($offer['OfferItems'] as $item) {\n $OfferItems['OfferItem'][] = array(\n 'OfferItemID' => array(\n '@Owner' => $OwnerId,\n '@' => $item['OfferItem'],\n ),\n 'Passengers' => array(\n 'PassengerReference' => $item['Associations'],\n ),\n );\n }\n\n $offer_block['Offer'][] = array(\n 'OfferID' => array(\n '@Owner' => $OwnerId,\n '@' => $offer['offerId'],\n ),\n 'OfferItems' => $OfferItems,\n );\n\n unset($OfferItems['OfferItem']);\n unset($OfferItems);\n }\n\n /* Check for Seats */\n if (isset($req['offer']['segments'])) {\n foreach ($req['offer']['segments']['seatdetails'] as $key_seat => $seat) {\n if ($seat['TravelerReferenceData']['Price'] != 0 && isset($seat['TravelerReferenceData']['seatdetailval'][0]['Column']) && isset($seat['TravelerReferenceData']['seatdetailval'][0]['Label'])) {\n $seatItems[] = array(\n 'OfferItemID' => array(\n '@Owner' => $OwnerId,\n '@' => $key_seat + 1,\n ),\n 'OfferItemType' => array(\n 'SeatItem' => array(\n 'Price' => array(\n 'Total' => array(\n '@Code' => $seat['TravelerReferenceData']['Currency'],\n '@' => $seat['TravelerReferenceData']['Price'],\n ),\n ),\n 'Descriptions' => array(\n 'Description' => array(\n 'Text' => $seat['TravelerReferenceData']['seatdetailval'][0]['Definition'][0],\n ),\n ),\n 'Location' => array(\n 'Column' => $seat['TravelerReferenceData']['seatdetailval'][0]['Column'],\n 'Row' => array(\n 'Number' => $seat['TravelerReferenceData']['seatdetailval'][0]['Label'],\n ),\n ),\n 'SeatAssociation' => array(\n 'SegmentReferences' => $seat['TravelerReferenceData']['FlightSegmentReferences'],\n 'TravelerReference' => $seat['PAX'],\n ),\n ),\n ),\n );\n } else {\n if(isset($seat['TravelerReferenceData']['seatdetailval'][0]['Column']) && isset($seat['TravelerReferenceData']['seatdetailval'][0]['Label'])) {\n $seatItems[] = array(\n 'OfferItemID' => array(\n '@Owner' => $OwnerId,\n '@' => $key_seat + 1,\n ),\n 'OfferItemType' => array(\n 'SeatItem' => array(\n 'Descriptions' => array(\n 'Description' => array(\n 'Text' => $seat['TravelerReferenceData']['seatdetailval'][0]['Definition'][0],\n ),\n ),\n 'Location' => array(\n 'Column' => $seat['TravelerReferenceData']['seatdetailval'][0]['Column'],\n 'Row' => array(\n 'Number' => $seat['TravelerReferenceData']['seatdetailval'][0]['Label'],\n ),\n ),\n 'SeatAssociation' => array(\n 'SegmentReferences' => $seat['TravelerReferenceData']['FlightSegmentReferences'],\n 'TravelerReference' => $seat['PAX'],\n ),\n ),\n ),\n );\n }\n }\n }\n\n $OrderItems = array(\n 'ShoppingResponse' => array(\n 'Owner' => $OwnerId,\n 'ResponseID' => 'ResponseID',\n 'Offers' => $offer_block,\n ),\n 'OfferItem' => $seatItems,\n );\n } else {\n $OrderItems = array(\n 'ShoppingResponse' => array(\n 'Owner' => $OwnerId,\n 'ResponseID' => 'ResponseID',\n 'Offers' => $offer_block,\n ),\n );\n }\n\n /* Paid Services */\n // foreach ($req['offer']['servicePaid']['selectedService'] as $key => $value) {\n // $pax = '';\n // $name_arr = array();\n // $name = $value['service']['ServiceID'];\n // $seg = $value['service']['@ObjectKey'];\n // foreach ($req['offer']['servicePaid']['selectedService'] as $key2 => $service2) {\n // if ($name == $service2['service']['ServiceID'] && $seg == $service2['service']['@ObjectKey']) {\n // $pax[] = $service2['pax'];\n // unset($req['offer']['servicePaid']['selectedService'][$key2]);\n // $name_arr[] = $service2['service']['ServiceID'];\n // }\n // }\n // if (in_array($name, $name_arr)) {\n // $service_paidArray[] = array(\n // 'service' => $value['service'],\n // 'pax' => implode(' ', $pax),\n // );\n // }\n // }\n // if (count($service_paidArray) > 0) {\n // foreach ($service_paidArray as $ser) {\n // $service = $ser['service'];\n // $serviceList['Service'][] = array(\n // '@ObjectKey' => $service['@ObjectKey'],\n // '@refs' => $service['@refs'],\n // 'ServiceID' => array(\n // //'@Owner' => $req['offer']['Airlineoffer']['0']['owner'],\n // '@Owner' => $OwnerId,\n // '@' => $service['ServiceID'],\n // ),\n // 'Name' => $service['Name'],\n // 'Descriptions' => array(\n // 'Description' => $service['Descriptions'],\n // ),\n // 'Price' => array(\n // 'Total' => array(\n // '@Code' => $service['Price']['@Code'],\n // '@' => $service['Price']['@'],\n // ),\n // ),\n // 'BookingInstructions' => array(\n // 'Text' => $service['BookingInstructions'],\n // ),\n // 'Associations' => array(\n // 'Traveler' => array(\n // 'TravelerReferences' => $ser['pax'],\n // ),\n // 'Flight' => array(\n // 'SegmentReferences' => $service['SegmentReferences']['SegmentReferences'],\n // ),\n // ),\n // );\n // }\n // }\n\n // /* Free Services */\n // foreach ($req['offer']['service'] as $key => $value) {\n // if (isset($value['specialAssistance'])) {\n // $pax = '';\n // $name_arr = array();\n // $name = $value['specialAssistance'];\n // $count = count($value['specialAssistanceSegments']);\n // foreach ($req['offer']['service'] as $key2 => $service2) {\n // if ($name == $service2['specialAssistance'] && $count == count($service2['specialAssistanceSegments'])) {\n // $pax[] = str_replace('Traveller ', 'PAX', $service2['specialAssistancePassangers']);\n // $seg = implode(' ', $service2['specialAssistanceSegments']);\n // unset($req['offer']['service'][$key2]);\n // $name_arr[] = $service2['specialAssistance'];\n // }\n // }\n // $seg = ($seg == '') ? implode(' ', $value['specialAssistanceSegments']) : $seg;\n // if (in_array($name, $name_arr)) {\n // $service_freeArray[] = array(\n // 'name' => $name,\n // 'pax' => implode(' ', $pax),\n // 'segments' => $seg,\n // );\n // }\n // }\n // }\n // if (count($service_freeArray) > 0) {\n // foreach ($service_freeArray as $ser) {\n // $service = explode('||', $ser['name']);\n // $name = $service[1];\n // $SSRCode = $service[0];\n // $OSIText = 'MEDAMEDA';\n // $serviceList['Service'][] = array(\n // 'ServiceID' => array(\n // '@Owner' => $req['offer']['Airlineoffer']['0']['owner'],\n // '@' => 'SRVC-' . ($SSRCode),\n // ),\n // 'Name' => $ser['name'],\n // 'Descriptions' => array(\n // 'Description' => array(\n // 'Text' => $ser['name'],\n // ),\n // ),\n // 'BookingInstructions' => array(\n // 'SSRCode' => $SSRCode,\n // 'OSIText' => $OSIText,\n // ),\n // 'Associations' => array(\n // 'Traveler' => array(\n // 'TravelerReferences' => $ser['pax'],\n // ),\n // 'Flight' => array(\n // 'SegmentReferences' => $ser['segments'],\n // ),\n // ),\n // );\n // }\n // }\n\n /* Set Commission */\n if (isset($req['offer']['contactDetail']['Commission']) && $req['offer']['contactDetail']['Commission'] != '') {\n $Commission = array(\n 'Percentage' => $req['offer']['contactDetail']['Commission'],\n );\n }\n\n $Fares = array();\n //print_r($req['offer']['AnonymousTravelerList']['FareList']['FareGroup']);exit;\n if (isset($req['offer']['AnonymousTravelerList']['FareList'])) {\n foreach ($req['offer']['AnonymousTravelerList']['FareList']['FareGroup'] as $key_Flight => $Fares_s) {\n $FareComponent = array();\n foreach ($Fares_s['Fare']['FareDetail']['FareComponent'] as $FareComponents) {\n $FareComponent[] = array(\n 'SegmentReference' => $FareComponents\n );\n }\n $Fares['FareGroup'][] = array(\n '@attributes' => $Fares_s['@attributes']['ListKey'],\n 'Fare' => array(\n 'FareCode' => array(\n 'Code' => $Fares_s['Fare']['FareCode']['Code']\n ),\n 'FareDetail' => array(\n 'FareComponent' => $FareComponent\n )\n ),\n 'FareBasisCode' => array(\n 'Code' => $Fares_s['FareBasisCode']['Code']\n )\n );\n }\n }\n // print_r($Fares);exit;\n $Flights = array();\n\n if (isset($req['offer']['AnonymousTravelerList']['FlightList'])) {\n foreach ($req['offer']['AnonymousTravelerList']['FlightList']['Flight'] as $key_Flight => $Flight_s) {\n $Flights['Flight'][] = array(\n '@FlightKey' => 'FLT' . ($key_Flight + 1),\n '@refs' => $Flight_s['@attributes']['refs'],\n 'Journey' => array(\n 'Time' => $Flight_s['Journey']['Time']\n ),\n 'SegmentReferences' => $Flight_s['SegmentReferences']\n );\n }\n }\n\n $FlightSegments = array();\n\n if (isset($req['offer']['AnonymousTravelerList']['FlightSegmentList'])) {\n foreach ($req['offer']['AnonymousTravelerList']['FlightSegmentList']['FlightSegment'] as $key_FlightSegment => $FlightSegment) {\n $FlightSegments['FlightSegment'][] = array(\n '@SegmentKey' => $FlightSegment['@attributes']['SegmentKey'],\n 'Departure' => array(\n 'AirportCode' => $FlightSegment['Departure']['AirportCode'],\n 'Date' => $FlightSegment['Departure']['Date'],\n 'Time' => $FlightSegment['Departure']['Time']\n ),\n 'Arrival' => array(\n 'AirportCode' => $FlightSegment['Arrival']['AirportCode'],\n 'Date' => $FlightSegment['Arrival']['Date'],\n 'Time' => $FlightSegment['Arrival']['Time']\n ),\n 'MarketingCarrier' => array(\n 'AirlineID' => $FlightSegment['MarketingCarrier']['AirlineID'],\n 'Name' => $FlightSegment['MarketingCarrier']['Name'],\n 'FlightNumber' => $FlightSegment['MarketingCarrier']['FlightNumber']\n ),\n 'OperatingCarrier' => array(\n 'AirlineID' => $FlightSegment['OperatingCarrier']['AirlineID'],\n 'Name' => $FlightSegment['OperatingCarrier']['Name'],\n 'FlightNumber' => $FlightSegment['OperatingCarrier']['FlightNumber']\n ),\n 'Equipment' => array(\n 'AircraftCode' => $FlightSegment['Equipment']['AircraftCode'],\n 'Name' => $FlightSegment['Equipment']['Name']\n ),\n 'ClassOfService' => array(\n 'Code' => $FlightSegment['ClassOfService']['Code'],\n 'MarketingName' => $FlightSegment['ClassOfService']['MarketingName']\n ),\n 'FlightDetail' => array(\n 'FlightDuration' => array(\n 'Value' => $FlightSegment['FlightDuration']['Value']\n )\n ),\n );\n }\n }\n\n\n $OriginDestination = array();\n\n if (isset($req['offer']['AnonymousTravelerList']['OriginDestinationList'])) {\n foreach ($req['offer']['AnonymousTravelerList']['OriginDestinationList']['OriginDestination'] as $key_Flight => $OriginDest) {\n $OriginDestination['OriginDestination'][] = array(\n '@OriginDestinationKey' => $OriginDest['@attributes']['OriginDestinationKey'],\n '@refs' => $OriginDest['@attributes']['refs'],\n 'DepartureCode' => $OriginDest['DepartureCode'],\n 'ArrivalCode' => $OriginDest['ArrivalCode'],\n 'FlightReferences' => $OriginDest['FlightReferences'],\n );\n }\n }\n\n $DataLists = array('FareList'=>$Fares,'FlightSegmentList' => $FlightSegments,'FlightList' => $Flights,'OriginDestinationList' => $OriginDestination);\n //print_r($DataLists);exit;\n $xmlArray = array(\n 'soapenv:Envelope' => array(\n 'xmlns:edis' => 'http://www.iata.org/IATA/EDIST',\n 'xmlns:head' => 'http://tpconnects.com/security/header',\n 'xmlns:soapenv' => 'http://schemas.xmlsoap.org/soap/envelope/',\n 'soapenv:Header' => array(\n 'head:SecurityHeader' => $this->securityHeader,\n ),\n 'soapenv:Body' => array(\n 'OrderCreateRQ' => array(\n '@AltLangID' => 'EN',\n '@EchoToken' => $req['offer']['EchoToken'],\n '@PrimaryLangID' => strtoupper(Configure::read('Config.language')),\n '@Version' => '1.1.4',\n '@xmlns' => $this->edis,\n 'PointOfSale' => array(\n 'Location' => array(\n 'CountryCode' => 'United Arab Emirates',\n 'CityCode' => 'UAE',\n ),\n 'RequestTime' => array(\n '@Zone' => 'EST',\n '@' => date(DATE_ATOM),\n ),\n 'TouchPoint' => array(\n 'Device' => array(\n 'Code' => 2,\n 'Definition' => 'Web Browser',\n 'Position' => array(\n 'Latitude' => '50.04717',\n 'Longitude' => '8.70066',\n 'NAC' => 'HPQJH RB728',\n ),\n ),\n ),\n ),\n 'Document' => array(\n 'Name' => 'A3 NDC GATEWAY',\n 'ReferenceVersion' => '1.0',\n ),\n 'Party' => array(\n 'Sender' => array(\n 'AggregatorSender' => array(\n 'Name' => 'Worldspan',\n 'Category' => array(\n 'Code' => 'M',\n 'Definition' => 'NDC aggregator',\n ),\n 'AggregatorID' => $req['offer']['Airlineoffer']['0']['owner'],\n ),\n ),\n 'Participants' => array(\n 'Participant' => array(\n 'TravelAgencyParticipant' => array(\n '@SequenceNumber' => 1,\n 'Name' => 'USD Travel',\n 'Type' => 'TravelAgency',\n 'Contacts' => array(\n 'Contact' => array(\n 'EmailContact' => array(\n 'Address' => '[email protected]',\n ),\n ),\n ),\n 'PseudoCity' => '1F8',\n 'IATA_Number' => '2212345',\n 'AgencyID' => array(\n '@' => '1001',\n '@Owner' => $req['offer']['Airlineoffer']['0']['owner'],\n ),\n 'AgentUser' => array(\n 'Name' => 'John Smith',\n 'AgentUserID' => '1980',\n 'UserRole' => 'Admin',\n ),\n ),\n ),\n ),\n ),\n 'Parameters' => array(\n 'Languages' => array(\n 'LanguageCode' => array(\n '@ObjectKey' => Configure::read('Config.language'),\n //'@' => Configure::read('Config.language'),\n ),\n ),\n 'CurrCodes' => array(\n 'CurrCode' => Configure::read('OrgCurrency'),\n ),\n ),\n 'Query' => array(\n 'Passengers' => array(\n 'Passenger' => $Passengers,\n ),\n 'OrderItems' => $OrderItems,\n 'Payments' => array(\n 'Payment' => array(\n 'Method' => array(\n 'PaymentCard' => '',\n ),\n 'Amount' => array(\n '@Code' => Configure::read('OrgCurrency'),\n '@' => $total,\n ),\n ),\n ),\n // 'DataLists' => array(\n // 'FareList' => '',\n // 'FlightSegmentList' =>$req['offer']['AnonymousTravelerList']['FlightSegmentList'],\n // 'FlightList' => $req['offer']['AnonymousTravelerList']['FlightList'],\n // 'OriginDestinationList' => $req['offer']['AnonymousTravelerList']['OriginDestinationList'],\n // 'ServiceList' => $serviceList,\n // ),\n 'DataLists' => $DataLists,\n 'Metadata' => '',\n 'Commission' => $Commission,\n ),\n ),\n ),\n ),\n );\n $xmlObject = Xml::build($xmlArray);\n $xmlString = $xmlObject->asXML();\n\n // print_r($req['offer']['AnonymousTravelerList']['FlightSegmentList']); exit;\n // /* Form FareList */\n // $FareList = $this->getXmlData('FareList', $req['offer']['AnonymousTravelerList']['FareList']);\n // $xmlString = str_replace('<FareList/>', $FareList, $xmlString);\n \n // /* Form FlightSegmentList */\n // $FlightSegmentList = $this->getXmlData('FlightSegmentList', $req['offer']['AnonymousTravelerList']['FlightSegmentList']);\n // $xmlString = str_replace('<FlightSegmentList/>', $FlightSegmentList, $xmlString);\n \n // /* Form FlightList */\n // $FlightList = $this->getXmlData('FlightList', $req['offer']['AnonymousTravelerList']['FlightList']);\n // $xmlString = str_replace('<FlightList/>', $FlightList, $xmlString);\n\n // /* Form OriginDestinationList */\n // $OriginDestinationList = $this->getXmlData('OriginDestinationList', $req['offer']['AnonymousTravelerList']['OriginDestinationList']);\n // $xmlString = str_replace('<OriginDestinationList/>', $OriginDestinationList, $xmlString);\n\n // /* Form MetaData */\n // $metaData = $this->getXmlData('Metadata', $req['offer']['Metadata']);\n // $xmlString = str_replace('<Metadata/>', $metaData, $xmlString);\n\n /* Remove Commission for NuLL Case */\n if (!isset($req['offer']['contactDetail']['Commission']) || $req['offer']['contactDetail']['Commission'] == '') {\n $xmlString = str_replace('<Commission/>', '', $xmlString);\n }\n\n /* Remove FOID for NuLL Case */\n if ($Traveler['details']['frequentFlyer'] == '' && $Traveler['details']['frequentFlyerType'] == '') {\n $xmlString = str_replace('<FOID/>', '', $xmlString);\n }\n //CakeLog::write('OrderCreateRQ', $xmlString);\n file_put_contents(\"OrderCreateRQ.xml\", $xmlString);\n $ch = curl_init(trim($this->flightConnect));\n curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);\n curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);\n curl_setopt($ch, CURLOPT_POST, 1);\n curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 0);\n curl_setopt($ch, CURLOPT_TIMEOUT, 1000);\n curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/xml'));\n curl_setopt($ch, CURLOPT_POSTFIELDS, $xmlString);\n curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);\n $output = curl_exec($ch);\n if ($output == '') {\n $output = '<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n <soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\">\n <soapenv:Body>\n <ns2:OrderViewRS TimeStamp=\"2017-11-27T10:54:48.992Z\" Version=\"16.1\" xmlns:ns2=\"http://www.iata.org/IATA/EDIST\" xmlns:ns3=\"http://tpconnects.com/security/header\">\n <ns2:Document>\n <ns2:Name>ndc16.1</ns2:Name>\n <ns2:ReferenceVersion>16.1</ns2:ReferenceVersion>\n </ns2:Document>\n <ns2:Errors>\n <ns2:Error Code=\"118\" ShortText=\"500 Error\">No Response Recieved From Supplier!!</ns2:Error>\n </ns2:Errors>\n </ns2:OrderViewRS>\n </soapenv:Body>\n </soapenv:Envelope>';\n }\n\n //CakeLog::write('OrderCreateRS', $output);\n file_put_contents(\"OrderCreateRS.xml\", $output);\n $t = time();\n $file = $t . '.xml';\n $_SESSION['OrderCreate'] = $file;\n (!file_exists(\"../tmp/bookings\")) ? mkdir(\"../tmp/bookings\", 0777, true) : '';\n (!file_exists(\"../tmp/bookings/OrderCreate\")) ? mkdir(\"../tmp/bookings/OrderCreate\", 0777, true) : '';\n file_put_contents(\"../tmp/bookings/OrderCreate/$file\", $output);\n $output = str_replace('ns2:', '', $output);\n $output = str_replace('soapenv:Body', 'soapenvBody', $output);\n $output = str_replace('soapenv:Envelope', 'soapenvEnvelope', $output);\n $output = str_replace('xmlns:soapenv', 'xmlnssoapenv', $output);\n $output = str_replace('xmlns:ns', 'xmlnsns', $output);\n \n $seprateXML = Xml::toArray(Xml::build($output));\n return json_encode($seprateXML);\n }",
"public function run()\n {\n $plans = [\n [\n 'name' => 'Monthly',\n 'slug' => 'monthly',\n 'gateway_id' => 'month_6',\n 'price' => 6.00,\n 'active' => true,\n 'teams_enabled' => false,\n 'teams_limit' => null,\n ],\n [\n 'name' => 'Yearly',\n 'slug' => 'yearly',\n 'gateway_id' => 'year_60',\n 'price' => 60.00,\n 'active' => true,\n 'teams_enabled' => false,\n 'teams_limit' => null,\n ],\n [\n 'name' => 'Monthly for 10 users',\n 'slug' => 'monthly-for-10-users',\n 'gateway_id' => 'team_month_55',\n 'price' => 55.00,\n 'active' => true,\n 'teams_enabled' => true,\n 'teams_limit' => 10,\n ],\n ];\n\n Plan::insert($plans);\n }",
"public final function build ($payload) {\n $actiontype = $this->table()->createRow();\n $actiontype->setFromArray(array(\n 'type' => $this->_type_from_payload($payload),\n 'module' => 'feeligo',\n 'body' => $this->_body_from_payload($payload),\n 'enabled' => true,\n 'displayable' => 5, //TODO\n 'attachable' => true,\n 'commentable' => true,\n 'shareable' => true,\n 'is_generated' => true\n ));\n return $this->_adapt($actiontype);\n }",
"protected function buildPage($plans) {\n $build = [\n '#theme' => 'container__pricing_and_plans',\n '#children' => [],\n '#attributes' => ['class' => ['pricing-and-plans']],\n '#cache' => [\n 'contexts' => [\n 'user',\n 'url.developer',\n ],\n 'tags' => [],\n 'max-age' => 300,\n ],\n '#attached' => ['library' => ['apigee_m10n/rate_plan.entity_list']],\n ];\n\n // Get the view mode from product bundle config.\n $view_mode = ($view_mode = $this->config(RatePlanConfigForm::CONFIG_NAME)->get('catalog_view_mode')) ? $view_mode : 'default';\n $view_builder = $this->entityTypeManager()->getViewBuilder('rate_plan');\n\n foreach ($plans as $id => $plan) {\n // TODO: Add a test for render cache.\n $build['#cache']['tags'] = Cache::mergeTags($build['#cache']['tags'], $plan->getCacheTags());\n // Generate a build array using the view builder.\n $build['#children'][$id] = $view_builder->view($plan, $view_mode);\n $build['#children'][$id]['#theme_wrappers'] = ['container__pricing_and_plans__item' => ['#attributes' => ['class' => ['pricing-and-plans__item']]]];\n }\n\n return $build;\n }",
"private function getBuildingPayload(Building $item, $version1 = FALSE) {\r\n $r = $this->stripNulls([\r\n 'id' => $item->getId(),\r\n 'name' => $item->getName(),\r\n 'type' => 'building',\r\n 'coordinates' => $this->convertCoordinates($item->getGpsCoordinates()),\r\n 'floorNumber' => $item->getFloorCount(),\r\n 'address' => $item->getAddress(),\r\n //'minFloor' => $floors[0]['floor'],\r\n ]);\r\n\r\n if($version1) {\r\n $r['plan'] = $item->getId();\r\n }\r\n\r\n if(!$version1) {\r\n $floors = [];\r\n foreach ($item->getFloors() as $floor) {\r\n $floors[] = $this->stripNulls($this->getFloorPayload($floor));\r\n }\r\n\r\n usort($floors, function ($a, $b) {\r\n if ($a['floor'] < $b['floor']) return -1;\r\n if ($a['floor'] > $b['floor']) return 1;\r\n return 0;\r\n });\r\n $r['floors'] = $floors;\r\n }\r\n return $r;\r\n }",
"private function getNodePayload(Node $node, $floorId = NULL, $buildingId = null, $floorName=NULL) {\r\n $p = $node->getProperties();\r\n return $this->stripNulls([\r\n 'id' => $p->id,\r\n 'type' => $p->getType(),\r\n 'name' => is_null($p->getName())?$p->getRoom():$p->getName().(is_null($p->getRoom())?\" - \".$p->getRoom():\"\"),\r\n 'room' => $p->getRoom(),\r\n 'fromFloor' => $p->getFromFloor(),\r\n 'toFloor' => ($p->getToFloor() != NULL ? $p->getToFloor()->id : NULL),\r\n 'coordinates' => $this->convertCoordinates($p->getGpsCoordinates()),\r\n 'floor' => ((int) (is_null($floorId) ? $node->getRevision()->getFloor()->id : $floorId)),\r\n 'floorName' => ((is_null($floorName) ? $node->getRevision()->getFloor()->getName() : $floorName)),\r\n 'building' => (int) (is_null($buildingId) ? $node->getRevision()->getFloor()->getBuilding()->id : $buildingId),\r\n ]);\r\n }",
"public function createPayload(): string\n {\n return '';\n }",
"function build() {\n\t\t$this->order_id = new view_field(\"Order ID\");\n\t\t$this->timestamp = new view_field(\"Date\");\n\t\t$this->total_amount = new view_field(\"Amount\");\n $this->view= new view_element(\"static\");\n \n $translations = new translations(\"fields\");\n $invoice_name = $translations->translate(\"fields\",\"Invoice\",true);\n $this->view->value=\"<a href=\\\"/orders/order_details.php?order_id={$this->_order_id}\\\" target=\\\"invoice\\\">\".$invoice_name.\"</a>\";\n\n\t\tif(isset($_SESSION['wizard']['complete']['process_time']))\n\t\t{\n\t\t\t$this->process_time = new view_field(\"Seconds to process\");\n\t\t\t$this->process_time->value=$_SESSION['wizard']['complete']['process_time'];\n\t\t\t$this->server = new view_field();\n\t\t\t$address_parts = explode('.',$_SERVER['SERVER_ADDR']);\n\t\t\t$this->server->value = $address_parts[count($address_parts) - 1];\n\t\t}\n\t\tparent::build();\n\t}",
"public function get_plans()\n {\n //\n\n \n $user_id = Auth::user()->id;\n\n $listing_code = Session::get('listing_code');\n\n\n $listing = Listing::where('listing_code', $listing_code)->where('agent_id', $user_id)->first();\n\n try {\n //code...\n\n $floor_plans = ListingFloorPLan::where('listing_id', $listing->id)->latest()->get();\n\n } catch (\\Throwable $th) {\n //throw $th;\n\n return $th;\n }\n\n \n\n\n\n return $floor_plans;\n }",
"public function run()\n {\n Plan::create([\n \t'name' => 'Free Plan',\n\t\t\t'plan_identifier' => 'free_plan',\n\t\t\t'limit_list' => 3,\n\t\t\t'limit_space' => 1500,\n\t\t\t'price' => 0\n ]); \n }",
"function BuildSample($strInvoiceRun)\n \t{\n\t\treturn $this->BuildOutput($strInvoiceRun, BILL_SAMPLE);\n \t}",
"public function create_simple($data) {\n\n $plan = $this->csmplan->get($data['plan_id']);\n if (empty($plan)) {\n throw new Exception('Something went wrong. Membership plan does not exist');\n } else {\n $this->gump->validation_rules(array(\n 'user_id' => 'required|max_len,100',\n 'plan_id' => 'required|numeric',\n 'plan_start' => 'required|date',\n 'vat' => 'required|numeric'\n ));\n\n $validated_data = $this->gump->run($data);\n if ($validated_data === false) {\n $errArr = $this->gump->get_readable_errors();\n $errString = \"\";\n foreach ($errArr as $k => $err) {\n $errString .= $err . '<br>';\n }\n throw new Exception($errString);\n } else {\n $response = $this->create(array(\n 'user_id' => $data['user_id'],\n 'plan_id' => $plan['plan_id'],\n 'plan_start' => $data['plan_start'],\n 'plan_end' => date('Y-m-d', (strtotime($data['plan_start']) + ($plan['days'] * 60 * 60 * 24))),\n 'approved' => $data['approved'] ? 1 : 0,\n 'payment' => $data['payment'] ? 1 : 0,\n 'payment_method' => $data['payment_method'],\n 'payment_at' => $data['payment_at'],\n 'price' => $plan['price'],\n 'vat' => $plan['vat'],\n 'price_total' => $plan['price'] + (($plan['price'] / 100) * $data['vat'])\n ));\n if ($response !== 1) {\n throw new Exception('Something went wrong');\n } else {\n return $response;\n }\n }\n }\n }",
"protected function generatePayLink(array $payload)\n {\n $payload['customer_email'] = $payload['customer_email'] ?? (string) $this->paddleEmail();\n $payload['customer_country'] = $payload['customer_country'] ?? (string) $this->paddleCountry();\n $payload['customer_postcode'] = $payload['customer_postcode'] ?? (string) $this->paddlePostcode();\n\n // We'll need a way to identify the user in any webhook we're catching so before\n // we make the API request we'll attach the authentication identifier to this\n // payload so we can match it back to a user when handling Paddle webhooks.\n if (! isset($payload['passthrough'])) {\n $payload['passthrough'] = [];\n }\n\n if (! is_array($payload['passthrough'])) {\n throw new LogicException('The value for \"passthrough\" always needs to be an array.');\n }\n\n $payload['passthrough']['billable_id'] = $this->getKey();\n $payload['passthrough']['billable_type'] = $this->getMorphClass();\n\n $payload['passthrough'] = json_encode($payload['passthrough']);\n\n $payload = array_map(function ($value) {\n return is_string($value) ? trim($value) : $value;\n }, $payload);\n\n return Cashier::post('/product/generate_pay_link', $payload)['response']['url'];\n }"
] |
[
"0.5662827",
"0.54153186",
"0.52935857",
"0.5289072",
"0.52756244",
"0.52657336",
"0.51375675",
"0.51368403",
"0.51253664",
"0.5049903",
"0.5005729",
"0.49831417",
"0.49760082",
"0.49682483",
"0.4952531",
"0.49499053",
"0.49300203",
"0.49272037",
"0.49231133",
"0.4894244",
"0.48795146",
"0.4876692",
"0.48657098",
"0.48638415",
"0.4859604",
"0.48096967",
"0.47978356",
"0.4790592",
"0.4788033",
"0.47821254"
] |
0.61547774
|
0
|
Get verses from a version and a book.
|
public function getVersesFromBook($version, $book) {
$this->currentVersion = $version;
$this->currentBook = $book;
$key_version_book = $this->currentVersion . '.' . $this->currentBook;
if (empty($this->verses[$key_version_book])) {
$path = $this->root . '/' . self::SOURCE_DIRECTORY . '/' . $this->currentVersion . '/' . $this->currentBook . '.json';
$data_encoded = file_get_contents($path);
$this->verses[$key_version_book] = json_decode($data_encoded, TRUE);
}
return $this->verses[$key_version_book]['chapters'];
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function getVersesFromSearch($pattern, $version = '', $book = '', $chapter = '') {\n return [];\n }",
"public function getVerses($languages, $book, $chapter, $start=1, $end=1000)\n\t{\n\t\tif (!is_array($languages))\n\t\t{\n\t\t\t$languages = array($languages);\n\t\t}\n\t\t$escaped_languages = array();\n\t\tforeach ($languages as $language) {\n\t\t\t$escaped_languages[] = mysqli_real_escape_string($this->db, $language);\n\t\t}\n\t\t$languages_str = \"'\" . implode(\"','\", $escaped_languages) . \"'\";\n\n\t\t$sql = sprintf(\"\n\t\t\tSELECT l.name AS language, b.short_name AS name, v.book AS book, v.chapter AS chapter, v.verse AS verse,\n\t\t\t\tv.subtitle AS subtitle, v.body AS content\n\t\t\tFROM verses v\n\t\t\t\tINNER JOIN books b ON (v.language_id=b.language_id AND v.book=b.book)\n\t\t\t\tINNER JOIN languages l ON (v.language_id=l.id)\n\t\t\tWHERE l.name IN (%s) AND b.book = '%s' AND v.chapter = '%s' AND verse >= '%s' AND verse <= '%s'\n\t\t\tORDER BY v.book, v.chapter, v.verse, v.language_id\n\t\t\t\t\",\n\t\t\t$languages_str,\n\t\t\tmysqli_real_escape_string($this->db, $book),\n\t\t\tmysqli_real_escape_string($this->db, $chapter),\n\t\t\tmysqli_real_escape_string($this->db, $start),\n\t\t\tmysqli_real_escape_string($this->db, $end)\n\t\t);\n\n\t\t$result = mysqli_query($this->db, $sql);\n\t\tif (!$result)\n\t\t{\n\t\t\techo \"ERROR: Bad query: \" . mysqli_error($this->db);\n\t\t\treturn array();\n\t\t}\n\n\t\t$verses = array();\n\t\twhile ($row = mysqli_fetch_assoc($result))\n\t\t{\n\t\t\t$row = $this->annotateVerse($row, $row['language']);\n\t\t\t$verses[] = $row;\n\t\t}\n\t\tmysqli_free_result($result);\n\n\t\treturn $verses;\n\t}",
"public function getVerse($version, $book, $chapter, $num_verse) {\n $verse = '';\n $verses = $this->getVersesFromBook($version, $book);\n\n if (!empty($verses[$chapter])) {\n $this->currentChapter = $chapter;\n\n if (empty($verses[$chapter][$num_verse])) {\n if (intval($num_verse) <= 0) {\n $new_chapter = intval($chapter) - 1;\n } elseif (intval($num_verse) > count($verses[$chapter])) {\n $new_chapter = intval($chapter) + 1;\n }\n\n if (!empty($verses[strval($new_chapter)])) {\n if ($new_chapter < intval($this->currentChapter)) {\n $new_verse_number = count($verses[strval($new_chapter)]);\n } else {\n $new_verse_number = 1;\n }\n\n $this->currentChapter = strval($new_chapter);\n $this->currentVerse = strval($new_verse_number);\n $verse = $verses[$this->currentChapter][strval($new_verse_number)];\n }\n } \n else {\n $verse = $verses[$this->currentChapter][$num_verse];\n $this->currentVerse = $num_verse;\n }\n }\n\n return $verse;\n }",
"public function test_library_verseInfo() {\n\t\t$path = route('v2_library_verseInfo', [], false);\n\t\t$verse = \\DB::connection('sophia')->table('AAIWBT_vpl')->inRandomOrder()->first();\n\t\t$book = Book::where('id_usfx',$verse->book)->first();\n\t\t$chapter = $verse->chapter;\n\t\t$verse_start = $verse->verse_start;\n\t\t$verse_end = $verse->verse_start + 5;\n\n\t\t$this->params['bible_id'] = \"AAIWBT\";\n\t\t$this->params['book_id'] = $book->id;\n\t\t$this->params['chapter'] = $chapter;\n\t\t$this->params['verse_start'] = $verse_start;\n\t\t$this->params['verse_end'] = $verse_end;\n\n\t\techo \"\\nTesting: \" . route('v2_library_verseInfo', $this->params);\n\t\t$response = $this->get(route('v2_library_verseInfo'), $this->params);\n\t\t$response->assertSuccessful();\n\t\t// TODO: Get a working example of v2\n\t\t// $response->assertJsonStructure([$this->getSchemaKeys('LibraryVerseInfo')]);\n\t\t// $this->compareToOriginal($path,[$this->getSchemaKeys('LibraryVerseInfo')]);\n\t}",
"public function getNumVerses($language, $book, $chapter)\n\t{\n\t\t$sql = sprintf(\"\n\t\t\tSELECT COUNT(*) AS cnt\n\t\t\tFROM verses v INNER JOIN languages l ON (v.language_id=l.id)\n\t\t\tWHERE l.name='%s' AND v.book='%s' AND v.chapter='%s'\",\n\t\t\tmysqli_real_escape_string($this->db, $language),\n\t\t\tmysqli_real_escape_string($this->db, $book),\n\t\t\tmysqli_real_escape_string($this->db, $chapter)\n\t\t);\n\t\t$result = mysqli_query($this->db, $sql);\n\t\t$row = mysqli_fetch_assoc($result);\n\t\treturn $row['cnt'];\n\t}",
"public function get_book();",
"public function getBookList()\n\t{\n\t\treturn array(\n\t\t\t\"1\" => new Book(\"Être et Temps\", \"9782070707393\", 1, 1, 1),\n\t\t\t\"2\" => new Book(\"Finnegans Wake\", \"9782070402250\", 2, 2, 2),\n\t\t\t\"3\" => new Book(\"Critique de la raison pure\", \"9782070325757\", 3, 3, 3)\n\t\t);\n\t}",
"public function getBookList() \n {\n return array( \n \"Balagurusamy\" => new Book(\"Balagurusamy\", \"Balagurusamy\", \"C programming\"), \n \"CMM in Practice\" => new Book(\"CMM in Practice\", \"Pankaj Jalote\", \"\"), \n \"PHP for Dummies\" => new Book(\"PHP for Dummies\", \"Some Smart Guy\", \"\") \n ); \n }",
"protected function get_versions()\n\t{\n\t\t// determine the current versions\n\t\t$data = array(0 => ' ');\n\n\t\tforeach (\\Documentation\\Model_Version::query()->order_by('major', 'ASC')->order_by('minor', 'ASC')->order_by('branch', 'ASC')->get() as $version)\n\t\t{\n\t\t\t$data[$version->id] = $version->major.'.'.$version->minor.'/'.$version->branch;\n\t\t}\n\n\t\treturn $data;\n\t}",
"public function getVersions();",
"public function getVersions();",
"public function getVersions();",
"public function app_version_get(){\n $data = $this->model->getAllwhere('app_version_history','','versioncode,versionname','id','DESC','1');\n\n $resp = array('rccode' => 1, 'version' => !empty($data) ? $data[0]:[]); \n $this->response($resp);\n \n }",
"public function test_library_chapter() {\n\t\t$path = route('v2_library_chapter', [], false);\n\t\t$this->params['dam_id'] = 'AAIWBTN2ET';\n\t\t$this->params['book_id'] = 'Matt';\n\n\t\techo \"\\nTesting: \" . route('v2_library_chapter', $this->params);\n\t\t$response = $this->get(route('v2_library_chapter'), $this->params);\n\t\t$response->assertSuccessful();\n\t\t$response->assertJsonStructure([$this->getSchemaKeys('v2_library_chapter')]);\n\t\t$this->compareToOriginal($path,[$this->getSchemaKeys('v2_library_chapter')]);\n\t}",
"public function getGlossaryByRange($book, $chapter, $start_verse, $end_verse)\n\t{\n\t\t$sql = sprintf(\"\n\t\t\tSELECT g.chinese AS chinese, g.english AS english, g.kind AS kind, v.book, v.chapter, v.start_verse, v.end_verse, p.name AS openbible_place_name\n\t\t\tFROM glossary g\n\t\t\t\tINNER JOIN glossary_verses v ON (g.id=v.glossary_id)\n\t\t\t\tLEFT JOIN openbible_places p ON (g.openbible_places_id=p.id)\n\t\t\tWHERE v.book='%s' AND v.chapter='%s' AND v.start_verse >= '%s' AND v.end_verse <= '%s'\",\n\t\t\tmysqli_real_escape_string($this->db, $book),\n\t\t\tmysqli_real_escape_string($this->db, $chapter),\n\t\t\tmysqli_real_escape_string($this->db, $start_verse),\n\t\t\tmysqli_real_escape_string($this->db, $end_verse)\n\t\t);\n\n\t\t$result = mysqli_query($this->db, $sql);\n\t\tif (!$result)\n\t\t{\n\t\t\techo \"ERROR: Bad query: \" . mysqli_error($this->db);\n\t\t\treturn array();\n\t\t}\n\n\t\t$glossary = array();\n\t\twhile ($row = mysqli_fetch_assoc($result))\n\t\t{\n\t\t\t$glossary[] = $row;\n\t\t}\n\t\tmysqli_free_result($result);\n\n\t\treturn $glossary;\n\t}",
"public function getBooksChapter($book) \n {\n $this->instance = new Bible();\n $data = $this->instance->getBooksChapters($book);\n\n header(\"Content-type: application/json; charset=utf-8\");\n echo json_encode($data);\n die();\n }",
"public function index()\n {\n $books = Book::whereNotNull('is_approved')\n ->with('authors')\n ->with('genres')\n ->withAvg('reviews', 'rating')\n ->when(request('user_books') && Auth::check(), function ($query) {\n $query->where('user_id', auth()->user()->id)\n ->whereNotNull('is_approved')\n ->orWhere(function($query){\n $query->whereNull('is_approved')\n ->where('user_id', auth()->user()->id);\n });\n })\n ->when(request('search'), function ($query) {\n $search = request('search');\n $query->whereNotNull('is_approved')\n ->where('title', 'LIKE', '%' . $search . '%')\n ->orWhere(function($query) use ($search){\n $query->whereNotNull('is_approved')\n ->where('description', 'LIKE', '%' . $search . '%');\n })\n ->orWhereHas('genres', function ($query) use ($search) {\n $query->whereNotNull('is_approved')\n ->where('name', 'LIKE', '%' . $search . '%');\n })\n ->orWhereHas('authors', function ($query) use ($search) {\n $query->whereNotNull('is_approved')\n ->where('name', 'LIKE', '%' . $search . '%');\n });\n })\n ->latest()\n ->paginate(25);\n\n\n\n return view('book.index', compact('books'));\n }",
"public function vendor_app_version_get(){\n $data = $this->model->getAllwhere('vendor_app_version','','versioncode,versionname','id','DESC','1');\n\n $resp = array('rccode' => 1, 'version' => !empty($data) ? $data[0]:[]); \n $this->response($resp);\n \n }",
"public function getBooks()\n\t{\n\t\treturn $this->books;\n\t}",
"public function getBooks()\r\n {\r\n $bookNodes = $this->dom->getElementsByTagName('book');\r\n $books = [];\r\n\r\n foreach($bookNodes as $domNode) {\r\n $book = [];\r\n\r\n foreach($domNode->childNodes as $dn) {\r\n if ($dn->nodeName === 'author') {\r\n $book['author'] = $dn->nodeValue;\r\n }\r\n\r\n if ($dn->nodeName === 'pages') {\r\n $book['pages'] = $dn->nodeValue;\r\n }\r\n\r\n if ($dn->nodeName === 'title') {\r\n $book['title'] = $dn->nodeValue;\r\n }\r\n\r\n if ($dn->nodeName === 'code') {\r\n $book['code'] = $dn->nodeValue;\r\n }\r\n }\r\n\r\n $books[] = $book;\r\n }\r\n\r\n return $books;\r\n }",
"function w_parse_version($version) {\n $versionList = [];\n if (is_string($version)) {\n $rawVersionList = explode('.', $version);\n if (isset($rawVersionList[0])) {\n $versionList[] = $rawVersionList[0];\n }\n if (isset($rawVersionList[1])) {\n $versionList[] = $rawVersionList[1];\n }\n }\n return $versionList;\n}",
"public function books()\n {\n return $this->morphedByMany('App\\Book', 'source_genre');\n }",
"public function getBook($isbn);",
"public static function filter_books_by_chap($books, $chap) {\n\t\t$result = [];\n\t\t//get start to end number chap\n\t\tif ($chap == 1) {\n\t\t\t$start_chap = Constants::START_CHAP_ONE;\n\t\t\t$end_chap = Constants::END_CHAP_ONE;\n\t\t} elseif ($chap == 10) {\n\t\t\t$start_chap = Constants::START_CHAP_TWO;\n\t\t\t$end_chap = Constants::END_CHAP_TWO;\n\t\t} elseif ($chap == 20) {\n\t\t\t$start_chap = Constants::START_CHAP_THREE;\n\t\t\t$end_chap = Constants::END_CHAP_THREE;\n\t\t} elseif ($chap == 50) {\n\t\t\t$start_chap = Constants::START_CHAP_FOUR;\n\t\t\t$end_chap = Constants::END_CHAP_FOUR;\n\t\t} elseif ($chap == 100) {\n\t\t\t$start_chap = Constants::START_CHAP_FIVE;\n\t\t\t$end_chap = Constants::END_CHAP_FIVE;\n\t\t}\n\t\t//filter books\n\t\tforeach ($books as $book) {\n\t\t\t$chap_counts = ChapsQModel::count_chaps_by_book_id($book->id);\n\t\t\t$max = 0;\n\t\t\tforeach ($chap_counts as $chap_count) {\n\t\t\t\tif ($max < $chap_count->chap_count)\n\t\t\t\t\t$max = $chap_count->chap_count;\n\t\t\t}\n\t\t\tif ($max >= $start_chap && $max <= $end_chap)\n\t\t\t\tarray_push($result, $book);\n\t\t}\n\t\treturn $result;\n\t}",
"public function __construct($current_version = '', $current_book = '', $current_chapter = '', $current_verse = '') {\n $this->root = dirname(__DIR__);\n \n $this->bibleVersions = [];\n $this->bibleBooks = [];\n\n $this->currentVersion = $current_version;\n $this->currentBook = $current_book;\n $this->currentChapter = $current_chapter;\n $this->currentVerse = $current_verse;\n\n $this->verses = [];\n }",
"public function parseBibleRange($range)\n\t{\n\t\tif (empty($range))\n\t\t{\n\t\t\treturn;\n\t\t}\n\n\t\t$parts = explode(':', $range);\n\t\t$parts_count = count($parts);\n\t\tswitch ($parts_count)\n\t\t{\n\t\t\tcase 1:\n\t\t\t\t// Invalid range, ignore it\n\t\t\t\treturn;\n\n\t\t\tcase 2:\n\t\t\t\t// $book:$chapter:\n\t\t\t\t// GEN:1\n\t\t\t\t// 1:1\n\t\t\t\tlist($book, $chapter) = $parts;\n\t\t\t\t$languages = array('UCV');\n\t\t\t\t$start = 1;\n\t\t\t\t$end = 1000;\n\t\t\t\tbreak;\n\n\t\t\tcase 3:\n\t\t\t\t// $language:$book:$chapter:\n\t\t\t\t// UCV:GEN:1\n\t\t\t\t// UCV: 1:1\n\t\t\t\t// or,\n\t\t\t\t// $book:$chapter:$verses:\n\t\t\t\t// GEN: 1:1\n\t\t\t\t// 1: 1:1\n\t\t\t\t$valid_languages = array();\n\t\t\t\tforeach ($this->getLanguages() as $lang)\n\t\t\t\t{\n\t\t\t\t\t$valid_languages[] = $lang['name'];\n\t\t\t\t}\n\n\t\t\t\t$languages = array();\n\t\t\t\tforeach (explode(',', $parts[0]) as $lang)\n\t\t\t\t{\n\t\t\t\t\tif (in_array($lang, $valid_languages))\n\t\t\t\t\t{\n\t\t\t\t\t\t$languages[] = $lang;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif ($languages)\n\t\t\t\t{\n\t\t\t\t\t$languages = explode(',', $parts[0]);\n\t\t\t\t\t$book = $parts[1];\n\t\t\t\t\t$chapter = $parts[2];\n\t\t\t\t\t$start = 1;\n\t\t\t\t\t$end = 1000;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t$languages = array('UCV');\n\t\t\t\t\t$book = $parts[0];\n\t\t\t\t\t$chapter = $parts[1];\n\t\t\t\t\tif (count(explode('-', $parts[2])) == 2)\n\t\t\t\t\t{\n\t\t\t\t\t\tlist($start, $end) = explode('-', $parts[2]);\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\t$start = $end = $parts[2];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase 4:\n\t\t\t\t// $language:$book:$chapter:$verses\n\t\t\t\t$languages = explode(',', $parts[0]);\n\t\t\t\t$book = $parts[1];\n\t\t\t\t$chapter = $parts[2];\n\t\t\t\tif (count(explode('-', $parts[3])) == 2)\n\t\t\t\t{\n\t\t\t\t\tlist($start, $end) = explode('-', $parts[3]);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t$start = $end = $parts[3];\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t\t// Parse error, just ignore it\n\t\t\t\treturn;\n\t\t}\n\n\t\tif (!is_numeric($book))\n\t\t{\n\t\t\t$book = $this->getBookIndex($book);\n\t\t}\n\n\t\tif (!is_array($languages) ||\n\t\t\t!is_numeric($book) ||\n\t\t\t!is_numeric($chapter) ||\n\t\t\t!is_numeric($start) ||\n\t\t\t!is_numeric($end)) {\n\t\t\t// This must have been a parse error.\n\t\t\treturn;\n\t\t}\n\n\t\treturn array($languages, $book, $chapter, $start, $end);\n\t}",
"function bookcrossing_release_book($book) {\n /**\n * Book wasnt found in db.\n */\n if (!$book) {\n return array(\n '#markup' => t('There is no book with that BCID.'),\n );\n }\n\n /**\n * Book is already released.\n */\n if (!$book['status']) {\n return array(\n '#markup' => t('Cannot to release book because its already was released.'),\n );\n }\n\n global $user;\n /**\n * Can only release books user reading.\n */\n if ($book['user']->uid != $user->uid) {\n return array(\n '#markup' => t('You cannot release this book because u are not reading it now.'),\n );\n }\n\n $build = node_view($book['node'], 'found_book');\n $build = bookcrossing_prepare_book_view($build, $book, FALSE);\n\n /**\n * Form for adding comment and place.\n */\n $build['book_found'] = drupal_get_form('bookcrossing_book_comment', $book);\n\n /**\n * Status of the found book.\n */\n $build['book_found_status'] = array(\n '#markup' => bookcrossing_book_status($book),\n );\n\n $build['author_and_year'] = array(\n '#markup' => bookcrossing_author_and_year($book),\n );\n \n return $build;\n}",
"public function getLanguages($book_id);",
"function getVersions($manual_set, $document_alias)\n {\n $args = null;\n $args->manual_set = $manual_set;\n $args->alias = $document_alias;\n $output = executeQueryArray('xedocs.getDocumentVersions', $args);\n if(!$output->toBool() || !$output->data) return array();\n return $output->data;\n }",
"public function getNumChapters($book)\n\t{\n\t\t$sql = sprintf(\"\n\t\t\tSELECT COUNT(DISTINCT(chapter)) AS cnt\n\t\t\tFROM verses\n\t\t\tWHERE language_id='1' AND book='%s'\", $book);\n\n\t\t$result = mysqli_query($this->db, $sql);\n\t\t$row = mysqli_fetch_assoc($result);\n\t\treturn $row['cnt'];\n\t}"
] |
[
"0.70361674",
"0.66012734",
"0.6377102",
"0.5879556",
"0.55549663",
"0.5376883",
"0.53600425",
"0.5263525",
"0.52581066",
"0.5256107",
"0.5256107",
"0.5256107",
"0.50677586",
"0.5066135",
"0.4978401",
"0.4974996",
"0.4914546",
"0.48928523",
"0.48465762",
"0.4835752",
"0.4833581",
"0.48328832",
"0.48320138",
"0.4830022",
"0.48174256",
"0.48115015",
"0.48024774",
"0.4794979",
"0.47869697",
"0.4777054"
] |
0.77417
|
0
|
Get specific verse from version, book, chapter and verse num.
|
public function getVerse($version, $book, $chapter, $num_verse) {
$verse = '';
$verses = $this->getVersesFromBook($version, $book);
if (!empty($verses[$chapter])) {
$this->currentChapter = $chapter;
if (empty($verses[$chapter][$num_verse])) {
if (intval($num_verse) <= 0) {
$new_chapter = intval($chapter) - 1;
} elseif (intval($num_verse) > count($verses[$chapter])) {
$new_chapter = intval($chapter) + 1;
}
if (!empty($verses[strval($new_chapter)])) {
if ($new_chapter < intval($this->currentChapter)) {
$new_verse_number = count($verses[strval($new_chapter)]);
} else {
$new_verse_number = 1;
}
$this->currentChapter = strval($new_chapter);
$this->currentVerse = strval($new_verse_number);
$verse = $verses[$this->currentChapter][strval($new_verse_number)];
}
}
else {
$verse = $verses[$this->currentChapter][$num_verse];
$this->currentVerse = $num_verse;
}
}
return $verse;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function getVersesFromBook($version, $book) {\n $this->currentVersion = $version;\n $this->currentBook = $book;\n\n $key_version_book = $this->currentVersion . '.' . $this->currentBook;\n\n if (empty($this->verses[$key_version_book])) {\n $path = $this->root . '/' . self::SOURCE_DIRECTORY . '/' . $this->currentVersion . '/' . $this->currentBook . '.json';\n $data_encoded = file_get_contents($path);\n $this->verses[$key_version_book] = json_decode($data_encoded, TRUE);\n }\n\n return $this->verses[$key_version_book]['chapters'];\n }",
"public function getSpecifiedVersion();",
"public function test_library_verseInfo() {\n\t\t$path = route('v2_library_verseInfo', [], false);\n\t\t$verse = \\DB::connection('sophia')->table('AAIWBT_vpl')->inRandomOrder()->first();\n\t\t$book = Book::where('id_usfx',$verse->book)->first();\n\t\t$chapter = $verse->chapter;\n\t\t$verse_start = $verse->verse_start;\n\t\t$verse_end = $verse->verse_start + 5;\n\n\t\t$this->params['bible_id'] = \"AAIWBT\";\n\t\t$this->params['book_id'] = $book->id;\n\t\t$this->params['chapter'] = $chapter;\n\t\t$this->params['verse_start'] = $verse_start;\n\t\t$this->params['verse_end'] = $verse_end;\n\n\t\techo \"\\nTesting: \" . route('v2_library_verseInfo', $this->params);\n\t\t$response = $this->get(route('v2_library_verseInfo'), $this->params);\n\t\t$response->assertSuccessful();\n\t\t// TODO: Get a working example of v2\n\t\t// $response->assertJsonStructure([$this->getSchemaKeys('LibraryVerseInfo')]);\n\t\t// $this->compareToOriginal($path,[$this->getSchemaKeys('LibraryVerseInfo')]);\n\t}",
"public function getVersesFromSearch($pattern, $version = '', $book = '', $chapter = '') {\n return [];\n }",
"function get_chevereto_version($full=true) {\n\tif($full) {\n\t\treturn __CHV_VERSION__;\n\t} else {\n\t\tpreg_match('/\\d\\.\\d/', __CHV_VERSION__, $return);\n\t\treturn $return[0];\n\t}\n}",
"public function get_version(){\n\n\t\t\tswitch( $this->method ){\n\n\t\t\t\tcase 'commit-message':\n\t\t\t\tdefault:\n\t\t\t\t\treturn $this->get_version_from_commit_message();\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'file':\n\t\t\t\t\treturn $this->get_version_from_file();\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'tag':\n\t\t\t\t\treturn $this->get_version_from_tag();\n\t\t\t\t\tbreak;\n\t\t\t}\n\n\t\t}",
"public static function getOrdenIdVer($id, $ver)\n {\n // Consulta de la meta\n $consulta = \"SELECT * FROM ordenes WHERE (id_orden = ? AND version_informe=?)\";\n\n try {\n // Preparar sentencia\n $comando = Database::getInstance()->getDb()->prepare($consulta);\n // Ejecutar sentencia preparada\n $comando->execute(array($id, $ver));\n // Capturar primera fila del resultado\n $row = $comando->fetch(PDO::FETCH_ASSOC);\n return $row;\n\n } catch (PDOException $e) {\n // Aquí puedes clasificar el error dependiendo de la excepción\n // para presentarlo en la respuesta Json\n return -1;\n }\n }",
"function get_version( $title ) {\n\tif ( strstr( $title, '(' ) ) {\n\t\t$version = explode( \"(\", $title );\n\t\t$the_version = trim( substr( $version[1], 0, strlen( $version[1] ) - 1 ) );\n\t} else {\n\t\t$the_version = 'Theatrical Release';\n\t}\n\treturn $the_version;\n}",
"public function getVersionIdea($idea_id,$verion_id)\r\n {\r\n $model = new Ynidea_Model_DbTable_Versions;\r\n $select = $model -> select()\r\n ->where('idea_id=?',$idea_id)\r\n ->where('version_id=?',$verion_id); \r\n $row = $model->fetchRow($select); \r\n \r\n if($row)\r\n return $row;\r\n else\r\n return false; \r\n }",
"public function get($key, $ver=false);",
"public function get_version_from_file(){\n\n\t\t\t$result = '';\n\n\t\t\tif( empty( $this->file_contains_version ) )\n\t\t\t\t$this->file_contains_version = 'readme.md';\n\n\t\t\t$query = $this->api_urls['rawurl'] . '/' . $this->file_contains_version;\n\n\t\t\tif( ! empty( $this->access_token ) )\n\t\t\t\t$query = add_query_arg( array( 'access_token' => $this->access_token ), $query );\n\n\t\t\t$raw_response = wp_remote_get( $query, array('sslverify' => $this->config['sslverify']) );\n\t\t\t//TODO: Error handling for status-code != 200\n\n\t\t\tif ( is_wp_error( $raw_response ) ){\n\n\t\t\t\t$this->error = TRUE;\n\t\t\t\t$this->set_error(\n\t\t\t\t\t\t'warning',\n\t\t\t\t\t\tsprintf( '%s: %s', __( 'Error while fetching version from file', self::LANG ), $raw_response->get_error_message() )\n\t\t\t\t);\n\n\t\t\t} else {\n\n\t\t\t\tpreg_match( $this->search_pattern, $raw_response['body'], $version );\n\n\t\t\t\t$result = &$version[1];\n\n\t\t\t}\n\n\t\t\treturn ( isset( $result ) && ! empty( $result ) ) ? trim( $result ) : NULL;\n\n\t\t}",
"public function checkVers($vnum)\n {\n return $this->obj->checkVers($vnum);\n }",
"function get_version_id( $version ) {\n\t$sql = \"SELECT version_id FROM movie_versions \".\n\t\t\t\" WHERE version_name = \".\n\t\t\tformat_sql( $version ). \" LIMIT 1\";\n\t$res = mysql_query( $sql );\n\t\n\tif ( $res ) {\n\t\twhile ( $r = mysql_fetch_array( $res ) ) \n\t\t\t$verID = $r['version_id']; \n\t\t\t\n\t\treturn $verID;\n\t\t\n\t} else\n\t\treturn NULL;\n}",
"public function getNumVerses($language, $book, $chapter)\n\t{\n\t\t$sql = sprintf(\"\n\t\t\tSELECT COUNT(*) AS cnt\n\t\t\tFROM verses v INNER JOIN languages l ON (v.language_id=l.id)\n\t\t\tWHERE l.name='%s' AND v.book='%s' AND v.chapter='%s'\",\n\t\t\tmysqli_real_escape_string($this->db, $language),\n\t\t\tmysqli_real_escape_string($this->db, $book),\n\t\t\tmysqli_real_escape_string($this->db, $chapter)\n\t\t);\n\t\t$result = mysqli_query($this->db, $sql);\n\t\t$row = mysqli_fetch_assoc($result);\n\t\treturn $row['cnt'];\n\t}",
"function readFileVersion()\n\t{\n\t\treset($this->lastfilecontent);\n\t\t$regs = array();\n\t\tforeach ($this->lastfilecontent as $row)\n\t\t{\n\t\t\tif (ereg(\"^<#([0-9]+)>\", $row, $regs))\n\t\t\t{\n\t\t\t\t$version = $regs[1];\n\t\t\t}\n\t\t}\n\n\t\t$this->fileVersion = (integer) $version;\n\t\treturn $this->fileVersion; \n\t}",
"public function getRelease($version);",
"public function getVerp()\n {\n }",
"public function getVersion() {\r\n\t\t$response = $this->Client->execute('show version');\r\n\t\tpreg_match('/Version:\\s+VyOS\\s([0-9\\.]+)/', $response, $matches );\r\n\t\t$version = $matches[1];\r\n\t\treturn $version;\r\n\t}",
"public function & version( $a_ver = null )\n\t{\n\t\tif($a_ver == null)\n\t\t\treturn $this->getVersion();\n\n\t\treturn $this->setVersion($a_ver);\n\t}",
"abstract public function get_version();",
"public static function getOrdenCotizacionIdVer($id, $ver)\n {\n // Consulta de la meta\n $consulta = \"SELECT * FROM ordenes WHERE (id_orden = ? AND version_informe=?)\";\n\n try {\n // Preparar sentencia\n $comando = Database::getInstance()->getDb()->prepare($consulta);\n // Ejecutar sentencia preparada\n $comando->execute(array($id, $ver));\n // Capturar primera fila del resultado\n $row = $comando->fetch(PDO::FETCH_ASSOC);\n return $row;\n\n } catch (PDOException $e) {\n // Aquí puedes clasificar el error dependiendo de la excepción\n // para presentarlo en la respuesta Json\n return -1;\n }\n }",
"private function getChapterFromIndex(&$ImportedChapters, Chapter &$KnownChapter, string $counter) {\n\t\t$foundChapter = null;\n\t\tif (count($ImportedChapters[$counter]) == 1) {\n\t\t\t$foundChapter = $ImportedChapters[$counter][0];\n\t\t\tunset($ImportedChapters[$counter]);\n\t\t}\n\t\t// If there are more, check with no.\n\t\t// In Syosetu, there are cases of chapters released at the same time, and as we use Creation time as the sole constant, this is to deal with that.\n\t\t// Most of the time it will go through the above if\n\t\telse {\n\t\t\tfor ($i = 0; $i < count($ImportedChapters[$counter]); ++$i) {\n\t\t\t\tif ($ImportedChapters[$counter][$i]['no'] == $KnownChapter->no) {\n\t\t\t\t\t$foundChapter = array_splice($ImportedChapters[$counter], $i, 1)[0];\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn $foundChapter;\n\t}",
"function _wp_get_post_revision_version($revision)\n {\n }",
"public function\r\n get_revision_number()\r\n {\r\n #$cmd = self::get_svn_program() . ' info ' . $this->get_name();\r\n #$info = shell_exec($cmd);\r\n $info = $this->get_svn_info();\r\n \r\n foreach (explode(\"\\n\", $info) as $info_line) {\r\n if (preg_match('/^Revision: (\\d+)/', $info_line, $matches)) {\r\n return $matches[1];\r\n }\r\n }\r\n \r\n return 0;\r\n }",
"function smarty_function_select_page_version($params, &$smarty) {\n $page = array_var($params, 'page', null, true);\n if(!instance_of($page, 'Page')) {\n return new InvalidParamError('page', $page, '$page is exptected to be an instance of Page class', true);\n } // if\n \n $version = array_var($params, 'version', null, true);\n \n $options = array(option_tag(lang('Latest'), 'latest', array(\n 'selected' => $version == 'latest'\n )));\n \n $page_versions = $page->getVersions();\n if(is_foreachable($page_versions)) {\n foreach($page_versions as $page_version) {\n $options[] = option_tag(lang('Version #:version', array('version' => $page_version->getVersion())), $page_version->getVersion(), array(\n 'selected' => $version != 'latest' && $page_version->getVersion() == $version,\n ));\n } // foreach\n } // if\n \n return select_box($options, $params);\n }",
"public function getVersionNo()\n {\n return $this->versionNo;\n }",
"private function getVersionFromDatabase($version)\n {\n $rows = $this->database->getRecords(\n array('id', 'downloaded'),\n 'versions',\n array('version' => $version),\n '',\n '',\n 1\n );\n\n $row = false;\n if (count($rows) === 1) {\n $row = array_shift($rows);\n unset($rows);\n }\n\n return $row;\n }",
"protected static function parseVer($ver)\n {\n $ver = (string)$ver;\n return substr(trim($ver), 0, 1);\n }",
"protected function getFromVersion()\n {\n $version = $this->loadFromVersion();\n $this->log('The from version is detected as ' . implode(' ', $version));\n return $version;\n }",
"public static function getEstadoOrdenIdVer($id, $ver)\n {\n // Consulta de la meta\n $consulta = \"SELECT * FROM ordenes WHERE (num_orden = ? AND version_informe=?)\";\n\n try {\n // Preparar sentencia\n $comando = Database::getInstance()->getDb()->prepare($consulta);\n // Ejecutar sentencia preparada\n $comando->execute(array($id, $ver));\n // Capturar primera fila del resultado\n $row = $comando->fetch(PDO::FETCH_ASSOC);\n return $row;\n\n } catch (PDOException $e) {\n // Aquí puedes clasificar el error dependiendo de la excepción\n // para presentarlo en la respuesta Json\n return -1;\n }\n }"
] |
[
"0.6401741",
"0.5493571",
"0.5457608",
"0.54396063",
"0.5380094",
"0.53511435",
"0.53470546",
"0.53080356",
"0.52973187",
"0.52934057",
"0.5283502",
"0.527333",
"0.5223513",
"0.5205335",
"0.51704603",
"0.5128763",
"0.5127185",
"0.5126973",
"0.5124589",
"0.5104931",
"0.5080846",
"0.5077471",
"0.50733626",
"0.5072741",
"0.50675565",
"0.5061341",
"0.5053846",
"0.50447935",
"0.5039251",
"0.4994546"
] |
0.74903554
|
0
|
Get a set of verses depending of a pattern.
|
public function getVersesFromSearch($pattern, $version = '', $book = '', $chapter = '') {
return [];
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"private function findinvirtual($pattern)\n {\n $result = array();\n $virtual = null;\n\n if ($this->file)\n $virtual = file($this->file);\n\n if (empty($virtual))\n return $result;\n\n // check each line for matches\n foreach ($virtual as $line) {\n $line = trim($line);\n if (empty($line) || $line[0]=='#')\n continue;\n\n if (preg_match($pattern, $line))\n $result[] = $line;\n }\n\n return $result;\n }",
"public function getPatterns()\n {\n if (!isset($this->_params['html'])) {\n $linebreak = '\\n|<br(?:\\s*/)?>';\n $whitespace = '\\s| ';\n } elseif ($this->_params['html']) {\n $linebreak = '<br(?:\\s*/)?>';\n $whitespace = ' ';\n } else {\n $linebreak = '\\n';\n $whitespace = '\\s';\n }\n $startOfLine = '((?:^|' . $linebreak . ')(?:' . $whitespace . ')*)';\n $endOfLine = '(?=(?:' . $whitespace . ')*(?:$|\\.|' . $linebreak . '))';\n $startOfWord = '(^|' . $whitespace . '|' . $linebreak . ')';\n $endOfWord = '(?=$|\\.|' . $whitespace . '|' . $linebreak . ')';\n\n return array('regexp' => array(\n // Bold.\n '#' . $startOfLine . '(\\*(?:[^*](?!$|' . $linebreak . '))+\\*)' . $endOfLine .\n '|' . $startOfWord . '(\\*[^*\\s]+\\*)' . $endOfWord . '#i'\n => '$1$3<strong>$2$4</strong>',\n\n // Underline.\n '#' . $startOfLine . '(_(?:[^*](?!$|' . $linebreak . '))+_)' . $endOfLine .\n '|' . $startOfWord . '(_[^_\\s]+_)' . $endOfWord . '#i'\n => '$1$3<u>$2$4</u>',\n\n // Italic.\n '#' . $startOfLine . '(/(?:[^*](?!$|' . $linebreak . '))+/)' . $endOfLine .\n '|' . $startOfWord . '(/[^/\\s]+/)' . $endOfWord . '#i'\n => '$1$3<em>$2$4</em>',\n ));\n }",
"public function providerMatches()\n {\n return array(\n array('24 - 5x01 (HR.HDTV).avi', 5, 1),\n array('3rd Rock from the Sun - 1x01 - Brains and Eggs.avi', 1, 1),\n array('American Dad! - 1x01 - Pilot (pdtv).avi', 1, 1),\n array('The X Factor - 1x02 - Mooman (ll).avi',1,2),\n );\n }",
"public function getPattern();",
"public function getPattern();",
"private function getPatterns()\n {\n return array_keys($this->responsesByPattern);\n }",
"public function getMatches() : array\n {\n return $this->getFilesystemLoader()->getMatches();\n }",
"static private function parse(string $pattern): array\n\t{\n\t\t$catchall = false;\n\n\t\tif ($pattern[-1] == '*')\n\t\t{\n\t\t\t$catchall = true;\n\t\t\t$pattern = substr($pattern, 0, -1);\n\t\t}\n\n\t\t$pattern = strtr($pattern, self::EXTENDED_CHARACTER_CLASSES);\n\t\t$parts = preg_split('#(:\\w+|<(\\w+:)?([^>]+)>)#', $pattern, -1, PREG_SPLIT_DELIM_CAPTURE);\n\n\t\t[ $interleaved, $params, $regex ] = self::parse_parts($parts);\n\n\t\tif ($catchall)\n\t\t{\n\t\t\t$regex .= '(.*)';\n\t\t\t$params[] = 'all';\n\t\t}\n\n\t\t$regex .= '$#';\n\n\t\treturn [ $interleaved, $params, $regex ];\n\t}",
"public function getAllMatches()\n {\n return $this->_blocksMatch;\n }",
"public function get_patterns()\n {\n }",
"function getMatchingLines($pattern, $array){\n $returnArray = Array();\n foreach ($array as $x) {\n if (preg_match($pattern, $x) == 1) {\n $returnArray[] = $x;\n }\n }\n return $returnArray;\n}",
"private function search($content, $pattern)\n {\n $results = [];\n $keys = explode(' ', $pattern);\n foreach ($content as $line) {\n $tmp = [];\n foreach ($keys as $key) {\n if ($line[$key]) {\n $tmp[] = $line[$key];\n }\n }\n $results[] = $tmp;\n }\n return $results;\n }",
"public function getPatterns()\n {\n return $this->patterns;\n }",
"public function getPatterns()\n {\n return $this->patterns;\n }",
"function getAllTeamsMatching($terms){\n\t\treturn $this->avalanche->getAllTeamsMatching($terms);\n\t}",
"protected function findCategoriesByPattern($pattern)\n {\n return $this->findAllCategories()\n ->then(function($categories) use ($pattern) {\n $matches = [];\n foreach ($categories as $category) {\n if (Reaction\\Helpers\\StringHelper::matchWildcard($pattern, $category)) {\n $matches[] = $category;\n }\n }\n return $matches;\n });\n }",
"public function getSearchPattern();",
"public function getSearchPattern();",
"abstract protected function getPatternsAndCallbacks(): array;",
"public function matchAll(string $pattern): array\n {\n preg_match_all($pattern, $this->string, $matches);\n\n return array_map(function (string $match) {\n return new static($match, $this->encoding);\n }, $matches[0]);\n }",
"public function getMatchers(): array;",
"public static function getDetectors(): array\n {\n return [\n (new LinePatternDetector())->setPattern(static::$pattern)\n ];\n }",
"public function getPattern() {}",
"public function matches(Pattern $pattern);",
"public function matching($pattern)\n {\n $matches = [];\n\n /**\n * Break up our pattern into components we can match up\n * with our available extensions.\n */\n list($namespace, $extension) = explode('::', $pattern);\n list($addonType, $addonSlug) = explode('.', $namespace);\n\n if ($extension !== '*') {\n\n list($extensionType, $extensionSlug) = explode('.', $extension);\n } else {\n\n $extensionSlug = '*';\n $extensionType = '*';\n }\n\n $pattern = \"{$addonType}_{$addonSlug}_{$extensionType}_{$extensionSlug}\";\n\n foreach ($this->items as $item) {\n if ($this->extensionSlugIsPattern($item, $pattern)) {\n $matches[] = $item;\n }\n }\n\n return self::make($matches);\n }",
"public function getKeys($pattern){\n return $this->getAdapter()->keys($pattern);\n }",
"public function get_hypernyms ($tag){\n//Kennedy, Jack Kennedy, John Fitzgerald Kennedy, JFK, President Kennedy, President John F. Kennedy\n// INSTANCE OF=> President of the United States, United States President, President, Chief Executive\n// => head of state, chief of state\n// => representative\n// => negotiator, negotiant, treater\n// => communicator\n// => person, individual, someone, somebody, mortal, soul\n// => organism, being\n// => living thing, animate thing\n// => object, physical object\n// => physical entity\n// => entity\n// => causal agent, cause, causal agency\n// => physical entity\n// => entity\n//\n//Sense 2\n//Kennedy, Kennedy Interrnational, Kennedy International Airport\n// INSTANCE OF=> airport, airdrome, aerodrome, drome\n// => airfield, landing field, flying field, field\n// => facility, installation\n// => artifact, artefact\n// => whole, unit\n// => object, physical object\n// => physical entity\n// => entity';\n// $matches1 = array ();\n// preg_match_all (\"/\\s+(.+)\\s+=>/\",\n// $raw_synonims1, $matches1, PREG_PATTERN_ORDER);\n// var_dump($raw_synonims1);\n// var_dump($matches1);\n//\n// $raw_synonims1 = 'Sense 1\n//Kennedy, Jack Kennedy, John Fitzgerald Kennedy, JFK, President Kennedy, President John F. Kennedy\n// INSTANCE OF=> President of the United States, United States President, President, Chief Executive';\n// $matches1 = array ();\n// preg_match_all (\"/\\s+(.+)\\s+=>/\",\n// $raw_synonims1, $matches1, PREG_PATTERN_ORDER);\n// var_dump($raw_synonims1);\n// var_dump($matches1);\n// exit();\n ini_set(\"xdebug.var_display_max_children\", -1);\n ini_set(\"xdebug.var_display_max_data\", -1);\n ini_set(\"xdebug.var_display_max_depth\", -1);\n\n // cmd commend\n $wn_command = '\"C:/Program Files (x86)/WordNet/2.1/bin/wn\" \"'.$tag.'\" \"-hypen\"';\n $raw_synonims = shell_exec ($wn_command);\n\n // if the word exist\n if (! $raw_synonims) {\n return null;\n }\n\n // get the result of cmmend\n $matches = array ();\n preg_match_all (\"/\\s+(.+)\\s+.+?=>/\",\n $raw_synonims, $matches, PREG_PATTERN_ORDER);\n\n // if no matched result\n if(!isset($matches[1][0])){\n return null;\n }\n\n// dd($matches);\n // get all accepted words\n $expanded_query = array();\n\n foreach ($matches[1] as $match){\n $match = explode (\", \", $match);\n foreach ($match as $word){\n array_push($expanded_query, strtolower($word));\n }\n }\n\n // remove repeated element\n $expanded_query = array_unique($expanded_query);\n\n // return the word\n return $expanded_query;\n }",
"public function grepExtraOptionsByPattern($pattern)\n {\n return preg_grep($pattern, $this->extraOptions);\n }",
"function pewc_get_matches() {\n\t$matches = array(\n\t\t'all'\t\t=> __( 'All rules match', 'pewc' ),\n\t\t'any'\t\t=> __( 'Any rule matches', 'pewc' )\n\t);\n\treturn $matches;\n}",
"public function getMatcher();"
] |
[
"0.5618379",
"0.5117906",
"0.50989",
"0.50519156",
"0.50519156",
"0.5030408",
"0.50244695",
"0.49810183",
"0.497283",
"0.49593094",
"0.4934098",
"0.49123985",
"0.48372152",
"0.48372152",
"0.48346502",
"0.48329288",
"0.47663763",
"0.47663763",
"0.47647485",
"0.47330844",
"0.47308978",
"0.4718186",
"0.46914122",
"0.4670977",
"0.46697617",
"0.46641558",
"0.4647373",
"0.46299547",
"0.4603188",
"0.45973882"
] |
0.66834295
|
0
|
Generated from protobuf field uint32 k1 = 1;
|
public function getK1()
{
return $this->k1;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function setK1($var)\n {\n GPBUtil::checkUint32($var);\n $this->k1 = $var;\n\n return $this;\n }",
"function readInt1(): int {\n return \\ord($this->read(1));\n }",
"public function readS1(): int {\n return unpack(\"c\", $this->readBytes(1))[1];\n }",
"public function getGcId1()\n {\n return $this->gc_id_1;\n }",
"function _encode_v1() {\n if ($this->debug) print($this->debugbeg . \"_encode_v1()<HR>\\n\");\n\n if ($this->track) {\n // ID3 v1.1\n $id3pack = 'a3a30a30a30a4a28x1C1C1';\n $newtag = pack($id3pack,\n 'TAG',\n $this->name,\n $this->artists,\n $this->album,\n $this->year,\n $this->comment,\n $this->track,\n $this->genreno\n );\n } else {\n // ID3 v1\n $id3pack = 'a3a30a30a30a4a30C1';\n $newtag = pack($id3pack,\n 'TAG',\n $this->name,\n $this->artists,\n $this->album,\n $this->year,\n $this->comment,\n $this->genreno\n );\n }\n\n if ($this->debug) {\n print('id3pack: ' . $id3pack . \"\\n\");\n $unp = unpack('H*new', $newtag);\n print_r($unp);\n }\n\n if ($this->debug) print($this->debugend);\n return $newtag;\n }",
"public /*scalar*/ function key()\n\t{\n\t\treturn 0;\n\t}",
"function dsq_hmacsha1($data, $key) {\n $blocksize=64;\n $hashfunc='sha1';\n if (strlen($key)>$blocksize)\n $key=pack('H*', $hashfunc($key));\n $key=str_pad($key,$blocksize,chr(0x00));\n $ipad=str_repeat(chr(0x36),$blocksize);\n $opad=str_repeat(chr(0x5c),$blocksize);\n $hmac = pack(\n 'H*',$hashfunc(\n ($key^$opad).pack(\n 'H*',$hashfunc(\n ($key^$ipad).$data\n )\n )\n )\n );\n return bin2hex($hmac);\n}",
"public function setF1($value)\n {\n GPBUtil::checkInt32($value);\n $this->f1 = $value;\n return $this;\n }",
"private static function conv($c1Name):int{\n //todo simplifie en go dans le compare mais jcp si c mieux?\n switch ($c1Name){\n case 'As': $k=14;break;\n case 'R':$k=13;break;\n case 'V': $k=11;break;\n case 'D':$k=12;break;\n default: $k=(int)$c1Name;\n }\n return $k;\n }",
"public function magic1() { return $this->_m_magic1; }",
"function mcsha1($str)\n{\n\t$gmp = gmp_import(sha1($str, true));\n\tif(gmp_cmp($gmp, gmp_init(\"0x8000000000000000000000000000000000000000\")) >= 0)\n\t{\n\t\t$gmp = gmp_mul(gmp_add(gmp_xor($gmp, gmp_init(\"0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF\")), gmp_init(1)), gmp_init(-1));\n\t}\n\treturn gmp_strval($gmp, 16);\n}",
"public function getType1()\n {\n return $this->type1;\n }",
"public function lenLiteralM1InTag() {\n if ($this->_m_lenLiteralM1InTag !== null)\n return $this->_m_lenLiteralM1InTag;\n if (!($this->isLenLiteralSeparate())) {\n $this->_m_lenLiteralM1InTag = ($this->tag() & 15);\n }\n return $this->_m_lenLiteralM1InTag;\n }",
"function getNumber1() {\n return $this->number1;\n }",
"public function get_key_type() {\n return 0;\n }",
"public function getMinMemType1() {}",
"public function setKey( $key, $t1 = 0 ) {\n\t\t$this->orig_key = $key;\n\n\t\tif ( $t1 <= 0 ) {\n\t\t\t$t1 = $this->default_key_length;\n\t\t} elseif ( $t1 > 1024 ) {\n\t\t\t$t1 = 1024;\n\t\t}\n\t\t$this->current_key_length = $t1;\n\t\t// Key byte count should be 1..128.\n\t\t$key = strlen( $key ) ? substr( $key, 0, 128 ) : \"\\x00\";\n\t\t$t = strlen( $key );\n\n\t\t// The mcrypt RC2 implementation only supports effective key length\n\t\t// of 1024 bits. It is however possible to handle effective key\n\t\t// lengths in range 1..1024 by expanding the key and applying\n\t\t// inverse pitable mapping to the first byte before submitting it\n\t\t// to mcrypt.\n\n\t\t// Key expansion.\n\t\t$l = array_values( unpack( 'C*', $key ) );\n\t\t$t8 = ( $t1 + 7 ) >> 3;\n\t\t$tm = 0xFF >> ( 8 * $t8 - $t1 );\n\n\t\t// Expand key.\n\t\t$pitable = $this->pitable;\n\t\tfor ( $i = $t; $i < 128; $i ++ ) {\n\t\t\t$l[ $i ] = $pitable[ $l[ $i - 1 ] + $l[ $i - $t ] ];\n\t\t}\n\t\t$i = 128 - $t8;\n\t\t$l[ $i ] = $pitable[ $l[ $i ] & $tm ];\n\t\twhile ( $i -- ) {\n\t\t\t$l[ $i ] = $pitable[ $l[ $i + 1 ] ^ $l[ $i + $t8 ] ];\n\t\t}\n\n\t\t// Prepare the key for mcrypt.\n\t\t$l[0] = $this->invpitable[ $l[0] ];\n\t\tarray_unshift( $l, 'C*' );\n\n\t\tparent::setKey( call_user_func_array( 'pack', $l ) );\n\t}",
"protected function _genRequestKey()\n {\n $hash = sprintf(\"%u\", crc32(serialize($this->_request)));\n $this->_setLastRequestKey($hash);\n return $hash;\n }",
"function fn_crc32($key)\n{\n\treturn sprintf('%u', crc32($key));\n}",
"public function getMtype1()\n {\n return $this->mtype1;\n }",
"public function key()\n\t{\n\t\treturn parent::key() + 1;\n\t}",
"public function getSha1()\n {\n return $this->sha1;\n }",
"public function testAcceptKeyLengthOf1(): void\n {\n $key = 'j';\n $expected = 'fooBar 2000';\n $this->testNotStrict->set($key, $expected);\n $actual = $this->testNotStrict->get($key);\n $this->assertEquals($expected, $actual);\n }",
"public function getSha1() {}",
"public function getSha1() {}",
"public function getParam1()\n {\n return $this->get(self::_PARAM1);\n }",
"public function getParam1()\n {\n return $this->get(self::_PARAM1);\n }",
"public function getParam1()\n {\n return $this->get(self::_PARAM1);\n }",
"public function getParam1()\n {\n return $this->get(self::_PARAM1);\n }",
"public function getParam1()\n {\n return $this->get(self::_PARAM1);\n }"
] |
[
"0.7497993",
"0.5384124",
"0.5113928",
"0.5039523",
"0.5018321",
"0.49934477",
"0.49183547",
"0.48937824",
"0.48714194",
"0.4863486",
"0.48521677",
"0.48301703",
"0.47981957",
"0.47853425",
"0.47028795",
"0.46365845",
"0.4597094",
"0.45903552",
"0.4585363",
"0.4583517",
"0.4554826",
"0.45432818",
"0.45304167",
"0.45247367",
"0.45225868",
"0.45177388",
"0.45177388",
"0.45177388",
"0.45177388",
"0.45177388"
] |
0.65307266
|
1
|
Generated from protobuf field uint32 k1 = 1;
|
public function setK1($var)
{
GPBUtil::checkUint32($var);
$this->k1 = $var;
return $this;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function getK1()\n {\n return $this->k1;\n }",
"function readInt1(): int {\n return \\ord($this->read(1));\n }",
"public function readS1(): int {\n return unpack(\"c\", $this->readBytes(1))[1];\n }",
"public function getGcId1()\n {\n return $this->gc_id_1;\n }",
"function _encode_v1() {\n if ($this->debug) print($this->debugbeg . \"_encode_v1()<HR>\\n\");\n\n if ($this->track) {\n // ID3 v1.1\n $id3pack = 'a3a30a30a30a4a28x1C1C1';\n $newtag = pack($id3pack,\n 'TAG',\n $this->name,\n $this->artists,\n $this->album,\n $this->year,\n $this->comment,\n $this->track,\n $this->genreno\n );\n } else {\n // ID3 v1\n $id3pack = 'a3a30a30a30a4a30C1';\n $newtag = pack($id3pack,\n 'TAG',\n $this->name,\n $this->artists,\n $this->album,\n $this->year,\n $this->comment,\n $this->genreno\n );\n }\n\n if ($this->debug) {\n print('id3pack: ' . $id3pack . \"\\n\");\n $unp = unpack('H*new', $newtag);\n print_r($unp);\n }\n\n if ($this->debug) print($this->debugend);\n return $newtag;\n }",
"public /*scalar*/ function key()\n\t{\n\t\treturn 0;\n\t}",
"function dsq_hmacsha1($data, $key) {\n $blocksize=64;\n $hashfunc='sha1';\n if (strlen($key)>$blocksize)\n $key=pack('H*', $hashfunc($key));\n $key=str_pad($key,$blocksize,chr(0x00));\n $ipad=str_repeat(chr(0x36),$blocksize);\n $opad=str_repeat(chr(0x5c),$blocksize);\n $hmac = pack(\n 'H*',$hashfunc(\n ($key^$opad).pack(\n 'H*',$hashfunc(\n ($key^$ipad).$data\n )\n )\n )\n );\n return bin2hex($hmac);\n}",
"public function setF1($value)\n {\n GPBUtil::checkInt32($value);\n $this->f1 = $value;\n return $this;\n }",
"private static function conv($c1Name):int{\n //todo simplifie en go dans le compare mais jcp si c mieux?\n switch ($c1Name){\n case 'As': $k=14;break;\n case 'R':$k=13;break;\n case 'V': $k=11;break;\n case 'D':$k=12;break;\n default: $k=(int)$c1Name;\n }\n return $k;\n }",
"public function magic1() { return $this->_m_magic1; }",
"function mcsha1($str)\n{\n\t$gmp = gmp_import(sha1($str, true));\n\tif(gmp_cmp($gmp, gmp_init(\"0x8000000000000000000000000000000000000000\")) >= 0)\n\t{\n\t\t$gmp = gmp_mul(gmp_add(gmp_xor($gmp, gmp_init(\"0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF\")), gmp_init(1)), gmp_init(-1));\n\t}\n\treturn gmp_strval($gmp, 16);\n}",
"public function getType1()\n {\n return $this->type1;\n }",
"public function lenLiteralM1InTag() {\n if ($this->_m_lenLiteralM1InTag !== null)\n return $this->_m_lenLiteralM1InTag;\n if (!($this->isLenLiteralSeparate())) {\n $this->_m_lenLiteralM1InTag = ($this->tag() & 15);\n }\n return $this->_m_lenLiteralM1InTag;\n }",
"function getNumber1() {\n return $this->number1;\n }",
"public function get_key_type() {\n return 0;\n }",
"public function getMinMemType1() {}",
"public function setKey( $key, $t1 = 0 ) {\n\t\t$this->orig_key = $key;\n\n\t\tif ( $t1 <= 0 ) {\n\t\t\t$t1 = $this->default_key_length;\n\t\t} elseif ( $t1 > 1024 ) {\n\t\t\t$t1 = 1024;\n\t\t}\n\t\t$this->current_key_length = $t1;\n\t\t// Key byte count should be 1..128.\n\t\t$key = strlen( $key ) ? substr( $key, 0, 128 ) : \"\\x00\";\n\t\t$t = strlen( $key );\n\n\t\t// The mcrypt RC2 implementation only supports effective key length\n\t\t// of 1024 bits. It is however possible to handle effective key\n\t\t// lengths in range 1..1024 by expanding the key and applying\n\t\t// inverse pitable mapping to the first byte before submitting it\n\t\t// to mcrypt.\n\n\t\t// Key expansion.\n\t\t$l = array_values( unpack( 'C*', $key ) );\n\t\t$t8 = ( $t1 + 7 ) >> 3;\n\t\t$tm = 0xFF >> ( 8 * $t8 - $t1 );\n\n\t\t// Expand key.\n\t\t$pitable = $this->pitable;\n\t\tfor ( $i = $t; $i < 128; $i ++ ) {\n\t\t\t$l[ $i ] = $pitable[ $l[ $i - 1 ] + $l[ $i - $t ] ];\n\t\t}\n\t\t$i = 128 - $t8;\n\t\t$l[ $i ] = $pitable[ $l[ $i ] & $tm ];\n\t\twhile ( $i -- ) {\n\t\t\t$l[ $i ] = $pitable[ $l[ $i + 1 ] ^ $l[ $i + $t8 ] ];\n\t\t}\n\n\t\t// Prepare the key for mcrypt.\n\t\t$l[0] = $this->invpitable[ $l[0] ];\n\t\tarray_unshift( $l, 'C*' );\n\n\t\tparent::setKey( call_user_func_array( 'pack', $l ) );\n\t}",
"protected function _genRequestKey()\n {\n $hash = sprintf(\"%u\", crc32(serialize($this->_request)));\n $this->_setLastRequestKey($hash);\n return $hash;\n }",
"function fn_crc32($key)\n{\n\treturn sprintf('%u', crc32($key));\n}",
"public function getMtype1()\n {\n return $this->mtype1;\n }",
"public function key()\n\t{\n\t\treturn parent::key() + 1;\n\t}",
"public function getSha1()\n {\n return $this->sha1;\n }",
"public function testAcceptKeyLengthOf1(): void\n {\n $key = 'j';\n $expected = 'fooBar 2000';\n $this->testNotStrict->set($key, $expected);\n $actual = $this->testNotStrict->get($key);\n $this->assertEquals($expected, $actual);\n }",
"public function getSha1() {}",
"public function getSha1() {}",
"public function getParam1()\n {\n return $this->get(self::_PARAM1);\n }",
"public function getParam1()\n {\n return $this->get(self::_PARAM1);\n }",
"public function getParam1()\n {\n return $this->get(self::_PARAM1);\n }",
"public function getParam1()\n {\n return $this->get(self::_PARAM1);\n }",
"public function getParam1()\n {\n return $this->get(self::_PARAM1);\n }"
] |
[
"0.65307266",
"0.5384124",
"0.5113928",
"0.5039523",
"0.5018321",
"0.49934477",
"0.49183547",
"0.48937824",
"0.48714194",
"0.4863486",
"0.48521677",
"0.48301703",
"0.47981957",
"0.47853425",
"0.47028795",
"0.46365845",
"0.4597094",
"0.45903552",
"0.4585363",
"0.4583517",
"0.4554826",
"0.45432818",
"0.45304167",
"0.45247367",
"0.45225868",
"0.45177388",
"0.45177388",
"0.45177388",
"0.45177388",
"0.45177388"
] |
0.7497993
|
0
|
Generated from protobuf field uint32 k2 = 2;
|
public function getK2()
{
return $this->k2;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function setK2($var)\n {\n GPBUtil::checkUint32($var);\n $this->k2 = $var;\n\n return $this;\n }",
"public function getShntkey2()\n {\n return $this->shntkey2;\n }",
"function readInt2(): int {\n return \\unpack('v', $this->read(2))[1];\n }",
"public function getType2()\n {\n return $this->type2;\n }",
"public function getParam2()\n {\n return $this->get(self::_PARAM2);\n }",
"public function getParam2()\n {\n return $this->get(self::_PARAM2);\n }",
"public function getParam2()\n {\n return $this->get(self::_PARAM2);\n }",
"public function getParam2()\n {\n return $this->get(self::_PARAM2);\n }",
"public function getID2()\n\t{\n\t\treturn $this->id2;\n\t}",
"public function getGcId2()\n {\n return $this->gc_id_2;\n }",
"public function getId2()\n {\n return $this->id2;\n }",
"public function setId2($var)\n {\n GPBUtil::checkString($var, True);\n $this->id2 = $var;\n\n return $this;\n }",
"public function getMtype2()\n {\n return $this->mtype2;\n }",
"public function getSpCode2()\n {\n return $this->sp_code2;\n }",
"public function setMtype2($v)\n {\n if ($v !== null) {\n $v = (int) $v;\n }\n\n if ($this->mtype2 !== $v) {\n $this->mtype2 = $v;\n $this->modifiedColumns[AliMemberTableMap::COL_MTYPE2] = true;\n }\n\n return $this;\n }",
"public function getValue2(){\n return $this->_value2;\n }",
"public function privateType()\n {\n return 2;\n }",
"public function getParams2()\n {\n if (! $this->params2) {\n $this->params2 = new \\Hostnet\\Component\\AccessorGenerator\\Generator\\fixtures\\Generated\\ParamName2Enum(\n $this->parameters,\n $this,\n \\Hostnet\\Component\\AccessorGenerator\\Generator\\fixtures\\Parameter::class\n );\n }\n\n return $this->params2;\n }",
"public function getOpcion2() {\n return $this->opcion2;\n }",
"public function getTown2Id()\n {\n return $this->town_2_id;\n }",
"public function getNumUniq2(): ?string {\n return $this->numUniq2;\n }",
"public function getC2()\r\n {\r\n return $this->C2;\r\n }",
"public function getFkSwCgm2()\n {\n return $this->fkSwCgm2;\n }",
"public function getAttr2(){\r\n\t\treturn $this->attr2;\r\n\t}",
"public function CountTwoKeies() {\n\t\t\tif ((is_null($this->intId)))\n\t\t\t\treturn 0;\n\n\t\t\treturn TwoKey::CountByPersonId($this->intId);\n\t\t}",
"public function getBackblazeB2KeyId() {\n return @$this->attributes['backblaze_b2_key_id'];\n }",
"function length2() {/*{{{*/\n $r = $this->getReal(); \n $i = $this->getI();\n $j = $this->getJ(); \n $k = $this->getK();\n return ($r*$r + $i*$i + $j*$j + $k*$k);\n }",
"public function getShoulderTwoUsage()\n {}",
"public function setShntkey2($v)\n {\n if ($v !== null) {\n $v = (string) $v;\n }\n\n if ($this->shntkey2 !== $v) {\n $this->shntkey2 = $v;\n $this->modifiedColumns[SalesHistoryNotesTableMap::COL_SHNTKEY2] = true;\n }\n\n return $this;\n }",
"public function version()\n {\n return ProtocolEngine::VERSION_2;\n }"
] |
[
"0.7694165",
"0.604243",
"0.59720606",
"0.5865045",
"0.5632462",
"0.5632462",
"0.56316745",
"0.56316745",
"0.5620666",
"0.5508651",
"0.5462042",
"0.54087925",
"0.5397911",
"0.5357946",
"0.5343688",
"0.52916026",
"0.5276718",
"0.52744275",
"0.5260505",
"0.52182126",
"0.5217745",
"0.52061",
"0.51895547",
"0.51270896",
"0.51264536",
"0.5027812",
"0.5021736",
"0.50144047",
"0.49982712",
"0.49783888"
] |
0.6817198
|
1
|
Generated from protobuf field uint32 k2 = 2;
|
public function setK2($var)
{
GPBUtil::checkUint32($var);
$this->k2 = $var;
return $this;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function getK2()\n {\n return $this->k2;\n }",
"public function getShntkey2()\n {\n return $this->shntkey2;\n }",
"function readInt2(): int {\n return \\unpack('v', $this->read(2))[1];\n }",
"public function getType2()\n {\n return $this->type2;\n }",
"public function getParam2()\n {\n return $this->get(self::_PARAM2);\n }",
"public function getParam2()\n {\n return $this->get(self::_PARAM2);\n }",
"public function getParam2()\n {\n return $this->get(self::_PARAM2);\n }",
"public function getParam2()\n {\n return $this->get(self::_PARAM2);\n }",
"public function getID2()\n\t{\n\t\treturn $this->id2;\n\t}",
"public function getGcId2()\n {\n return $this->gc_id_2;\n }",
"public function getId2()\n {\n return $this->id2;\n }",
"public function setId2($var)\n {\n GPBUtil::checkString($var, True);\n $this->id2 = $var;\n\n return $this;\n }",
"public function getMtype2()\n {\n return $this->mtype2;\n }",
"public function getSpCode2()\n {\n return $this->sp_code2;\n }",
"public function setMtype2($v)\n {\n if ($v !== null) {\n $v = (int) $v;\n }\n\n if ($this->mtype2 !== $v) {\n $this->mtype2 = $v;\n $this->modifiedColumns[AliMemberTableMap::COL_MTYPE2] = true;\n }\n\n return $this;\n }",
"public function getValue2(){\n return $this->_value2;\n }",
"public function privateType()\n {\n return 2;\n }",
"public function getParams2()\n {\n if (! $this->params2) {\n $this->params2 = new \\Hostnet\\Component\\AccessorGenerator\\Generator\\fixtures\\Generated\\ParamName2Enum(\n $this->parameters,\n $this,\n \\Hostnet\\Component\\AccessorGenerator\\Generator\\fixtures\\Parameter::class\n );\n }\n\n return $this->params2;\n }",
"public function getOpcion2() {\n return $this->opcion2;\n }",
"public function getTown2Id()\n {\n return $this->town_2_id;\n }",
"public function getNumUniq2(): ?string {\n return $this->numUniq2;\n }",
"public function getC2()\r\n {\r\n return $this->C2;\r\n }",
"public function getFkSwCgm2()\n {\n return $this->fkSwCgm2;\n }",
"public function CountTwoKeies() {\n\t\t\tif ((is_null($this->intId)))\n\t\t\t\treturn 0;\n\n\t\t\treturn TwoKey::CountByPersonId($this->intId);\n\t\t}",
"public function getAttr2(){\r\n\t\treturn $this->attr2;\r\n\t}",
"public function getBackblazeB2KeyId() {\n return @$this->attributes['backblaze_b2_key_id'];\n }",
"function length2() {/*{{{*/\n $r = $this->getReal(); \n $i = $this->getI();\n $j = $this->getJ(); \n $k = $this->getK();\n return ($r*$r + $i*$i + $j*$j + $k*$k);\n }",
"public function getShoulderTwoUsage()\n {}",
"public function setShntkey2($v)\n {\n if ($v !== null) {\n $v = (string) $v;\n }\n\n if ($this->shntkey2 !== $v) {\n $this->shntkey2 = $v;\n $this->modifiedColumns[SalesHistoryNotesTableMap::COL_SHNTKEY2] = true;\n }\n\n return $this;\n }",
"public function version()\n {\n return ProtocolEngine::VERSION_2;\n }"
] |
[
"0.68140364",
"0.60437846",
"0.59764814",
"0.58666843",
"0.5634133",
"0.5634133",
"0.5633348",
"0.5633348",
"0.5622412",
"0.5508606",
"0.54635984",
"0.5410077",
"0.5399563",
"0.5360213",
"0.5345197",
"0.5292951",
"0.52767813",
"0.52758634",
"0.5261033",
"0.52203816",
"0.5218912",
"0.52064145",
"0.51881546",
"0.5128603",
"0.51277566",
"0.5026288",
"0.50224257",
"0.5016982",
"0.49990344",
"0.49793825"
] |
0.7691903
|
0
|
Creates a JMESPath runtime based on environment variables and extensions available on a system.
|
public static function createRuntime()
{
switch ($compileDir = self::getEnvVariable(self::COMPILE_DIR)) {
case false: return new AstRuntime();
case 'on': return new CompilerRuntime();
default: return new CompilerRuntime($compileDir);
}
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function initRuntime()\n {\n $this->runtimeInitialized = true;\n foreach ($this->getExtensions() as $extension) {\n $extension->initRuntime($this);\n }\n }",
"public function initRuntime()\n {\n }",
"protected function setRuntime()\n {\n if (Arr::isAssoc($this->bundle['js'])) {\n $this->runtime = $this->bundle['js']['runtime'] ?? $this->bundle['js'][\"runtime~{$this->id}\"] ?? null;\n unset($this->bundle['js']['runtime'], $this->bundle['js'][\"runtime~{$this->id}\"]);\n } elseif (isset($this->bundle['js'][0]) && strpos($this->bundle['js'][0], 'runtime') === 0) {\n $this->runtime = $this->bundle['js'][0];\n unset($this->bundle['js'][0]);\n } elseif (isset($this->bundle['js'][0]) && strpos($this->bundle['js'][0], 'js/runtime') === 0) {\n $this->runtime = $this->bundle['js'][0];\n unset($this->bundle['js'][0]);\n } elseif (isset($this->bundle['mjs'][0]) && strpos($this->bundle['mjs'][0], 'runtime') === 0) {\n $this->runtime = $this->bundle['mjs'][0];\n unset($this->bundle['mjs'][0]);\n } elseif (isset($this->bundle['mjs'][0]) && strpos($this->bundle['mjs'][0], 'js/runtime') === 0) {\n $this->runtime = $this->bundle['mjs'][0];\n unset($this->bundle['mjs'][0]);\n }\n }",
"protected static function simulateFrontendEnvironment() {}",
"protected static function simulateFrontendEnvironment() {}",
"protected function createEnvironment($basePath)\n {\n $this->container->share('environment', new Environment($basePath, $this->getContainer()));\n }",
"function env($str){\n\treturn (getenv($str))?:$_SERVER[$str]; // generate library path:\n}",
"private function createEnvironment() {\n\t\t$this->cache_folder = dirname(__FILE__) . \"/\" . $this->cache_folder;\n\n\t\t// Create one if it doesn't exist\n\t\tif(!file_exists($this->cache_folder))\n\t\t\tmkdir($this->cache_folder);\n\n\t\t// Get the index file path\n\t\t$indexFilepath = $this->cache_folder . \"/\" . $this->cache_index;\n\n\t\t// Create one if it doesn't exist\n\t\tif(!file_exists($indexFilepath))\n\t\t\ttouch($indexFilepath);\n\t}",
"protected function getEnvironmentService()\n {\n $class = $this->getParameter('environment.class');\n $instance = new $class($this->getParameter('environment.file'));\n\n return $instance;\n }",
"public static function create()\n {\n $directories = [\n self::PATH.'/app',\n self::PATH.'/logs',\n self::PATH.'/bootstrap/cache',\n self::PATH.'/framework/cache',\n self::PATH.'/framework/views',\n ];\n\n foreach ($directories as $directory) {\n if (! is_dir($directory)) {\n function_exists('__vapor_debug') && __vapor_debug(\"Creating storage directory: $directory\");\n\n mkdir($directory, 0755, true);\n }\n }\n }",
"protected function simulateFrontendEnvironment() {}",
"private function registerSystemType() {\r\n return preg_match('/windows/i', getenv('COMSPEC')) ? 'WINDOWS' : 'UNIX';\r\n }",
"public function getRuntimeManager () {\n\t\tif (!isset(self::$runtimeManager)) {\n\t\t\tself::$runtimeManager = new phpkit_AutoloadOsidRuntimeManager($this->getConfigPath());\n\t\t}\n\t\t\n\t\treturn self::$runtimeManager;\n\t}",
"public function loadEnvironment()\n {\n $pharDir = dirname(__DIR__);\n $translate = ['phar://' => '', '/nautpie.phar' => ''];\n $baseSnippetsPath = strtr($pharDir, $translate);\n chdir($baseSnippetsPath);\n\n $dotenv = new Dotenv($baseSnippetsPath);\n $dotenv->safeLoad();\n\n $this->message('Path: ' . $baseSnippetsPath);\n }",
"public function useEnvironmentPath(string $path): EnvInterface;",
"public static function init(): void\n {\n $dotenvDest = ROOT_DIRECTORY . self::DEST_APP_ETC_DOTENV_FILE;\n if (is_file($dotenvDest)) {\n require_once $dotenvDest;\n return;\n } else {\n $dotenvSrc = ROOT_DIRECTORY . self::SRC_APP_ETC_DOTENV_FILE;\n copy($dotenvSrc, $dotenvDest);\n }\n\n $magentoBootstrapFile = ROOT_DIRECTORY . self::MAGENTO_BOOTSTRAP_FILE;\n if (!is_file($magentoBootstrapFile)) {\n return;\n }\n\n require_once $dotenvDest;\n }",
"public function getDefaultEnvironment();",
"function createClasspath()\n\t{\n\t\t$this->classpath = new Path();\n\t\treturn $this->classpath;\n\t}",
"function getRuntime($fileName) {;\n\t\tglobal $supported_map;\n\n\t\t$tokens = explode(\".\", $fileName); // split file name into [fileName, extension];\n\t\tif (isset($tokens[1])) {\n\t\t\t$ext = $tokens[1]; // extension\n\t\t\tif ($ext && isset($supported_map[strtolower($ext)])) {\n\t\t\t\t$runtime = $supported_map[strtolower($ext)]; // Get the name of the runtime\n\t\t\t\treturn $runtime;\n\t\t\t}\n\t\t}\n\n\t\treturn null;\n\t}",
"public function setup_environment() {\n\n define( 'IWJ_TEMPLATE_PATH', $this->template_path() );\n\n //$this->add_thumbnail_support();\n //$this->add_image_sizes();\n }",
"public function init($enviroment=true)\n\t{\n\t\tif($enviroment === true){\n\t\t\t$this->setScriptPath();\n\t\t\t$this->setAllNeedId();\n\t\t\t$this->mkdirIfNotExist(array($this->scriptPath));\n\t\t\tif($this->moduleId != null){\n\t\t\t\t$modulesPath = $this->scriptPath.$this->modulesField;\n\t\t\t\t$modulesItem = $modulesPath.$this->ds.$this->moduleId;\n\t\t\t\t$modulesControllerPath = $modulesItem.$this->ds.$this->controllerId;\n\t\t\t\t$this->mkdirIfNotExist(array($modulesPath,$modulesItem,$modulesControllerPath));\n\t\t\t\t$this->createScript($modulesControllerPath,true);\n\t\t\t}else{\n\t\t\t\t$controllerPath = $this->scriptPath.$this->controllerId;\n\t\t\t\t$this->mkdirIfNotExist(array($controllerPath));\n\t\t\t\t$this->createScript($controllerPath);\n\t\t\t}\n\t\t}\n\t}",
"protected function getTemplate_Twig_EnvironmentService()\n {\n $this->services['template.twig.environment'] = $instance = new \\phpbb\\template\\twig\\environment(${($_ = isset($this->services['config']) ? $this->services['config'] : $this->getConfigService()) && false ?: '_'}, ${($_ = isset($this->services['filesystem']) ? $this->services['filesystem'] : ($this->services['filesystem'] = new \\phpbb\\filesystem\\filesystem())) && false ?: '_'}, ${($_ = isset($this->services['path_helper']) ? $this->services['path_helper'] : $this->getPathHelperService()) && false ?: '_'}, './../cache/production/twig/', ${($_ = isset($this->services['ext.manager']) ? $this->services['ext.manager'] : $this->getExt_ManagerService()) && false ?: '_'}, ${($_ = isset($this->services['template.twig.loader']) ? $this->services['template.twig.loader'] : $this->getTemplate_Twig_LoaderService()) && false ?: '_'}, ${($_ = isset($this->services['dispatcher']) ? $this->services['dispatcher'] : $this->getDispatcherService()) && false ?: '_'}, []);\n\n $instance->setLexer(${($_ = isset($this->services['template.twig.lexer']) ? $this->services['template.twig.lexer'] : $this->getTemplate_Twig_LexerService()) && false ?: '_'});\n\n return $instance;\n }",
"public function createContainer()\n\t{\n\t\tif ($cacheDir = $this->getCacheDirectory()) {\n\t\t\t$cache = new Cache(new Nette\\Caching\\Storages\\PhpFileStorage($cacheDir), 'Nette.Configurator');\n\t\t\t$cacheKey = array($this->parameters, $this->files);\n\t\t\t$cached = $cache->load($cacheKey);\n\t\t\tif (!$cached) {\n\t\t\t\t$code = $this->buildContainer($dependencies);\n\t\t\t\t$cache->save($cacheKey, $code, array(\n\t\t\t\t\tCache::FILES => $this->parameters['productionMode'] ? NULL : $dependencies,\n\t\t\t\t));\n\t\t\t\t$cached = $cache->load($cacheKey);\n\t\t\t}\n\t\t\tNette\\Utils\\LimitedScope::load($cached['file'], TRUE);\n\n\t\t} elseif ($this->files) {\n\t\t\tthrow new Nette\\InvalidStateException(\"Set path to temporary directory using setTempDirectory().\");\n\n\t\t} else {\n\t\t\tNette\\Utils\\LimitedScope::evaluate($this->buildContainer()); // back compatibility with Environment\n\t\t}\n\n\t\t$container = new $this->parameters['container']['class'];\n\t\t$container->initialize();\n\t\tNette\\Environment::setContext($container); // back compatibility\n\t\treturn $container;\n\t}",
"private function registerEnvironment(): void\n {\n $this->app->singleton('markdown.environment', function (Container $app): Environment {\n $config = $app->config->get('markdown');\n\n $environment = new Environment(Arr::except($config, ['extensions', 'views']));\n\n foreach ((array) Arr::get($config, 'extensions') as $extension) {\n $environment->addExtension($app->make($extension));\n }\n\n return $environment;\n });\n\n $this->app->alias('markdown.environment', Environment::class);\n $this->app->alias('markdown.environment', EnvironmentInterface::class);\n $this->app->alias('markdown.environment', EnvironmentBuilderInterface::class);\n }",
"protected function registerPaths()\n {\n // start up the framework stuff\n $path = JPATH_ROOT . '/plugins/system/zlframework/zlframework';\n $media = JPATH_ROOT . '/media/com_zoolanders';\n $cuselms = JPATH_ROOT . '/media/zoo/custom_elements';\n\n // register paths\n $this->app->path->register($path, 'zlfw');\n $this->app->path->register($media, 'zlmedia');\n\n $this->app->path->register($path . '/zlfield', 'zlfield');\n $this->app->path->register($path . '/zlfield/fields/elements', 'zlfields'); // temporal until all ZL Extensions adapted\n $this->app->path->register($path . '/zlfield/fields/elements', 'fields'); // necessary since ZOO 2.5.13\n\n $this->app->path->register($path . '/elements', 'elements');\n $this->app->path->register($cuselms, 'elements');\n\n $this->app->path->register($path . '/helpers', 'helpers');\n $this->app->path->register($path . '/models', 'models');\n $this->app->path->register($path . '/controllers', 'controllers');\n $this->app->path->register($path . '/classes', 'classes');\n\n // register classes\n $this->app->loader->register('ZLModel', 'models:zl.php');\n $this->app->loader->register('ZLModelItem', 'models:item.php');\n $this->app->loader->register('ElementPro', 'elements:pro/pro.php');\n $this->app->loader->register('ElementRepeatablepro', 'elements:repeatablepro/repeatablepro.php');\n $this->app->loader->register('ElementFilespro', 'elements:filespro/filespro.php');\n $this->app->loader->register('zlHelper', 'helpers:zl.php'); // necesary because of ZLElements old helper, this one overrides it\n $this->app->loader->register('ZLStorage', 'classes:zlstorage/ZLStorage.php');\n $this->app->loader->register('ZlfieldHelper', 'zlfield:zlfield.php');\n\n // register plugin path\n if ($path = $this->app->path->path('root:plugins/system/zoo_zlelements/zoo_zlelements')) {\n $this->app->path->register($path, 'zlpath');\n }\n\n // register elements path\n if ($path = $this->app->path->path('zlpath:elements')) {\n $this->app->path->register($path, 'elements');\n }\n\n // register fields path\n if ($path = $this->app->path->path('zlpath:fields')) {\n $this->app->path->register($path, 'zlfields');\n }\n\n // register plugin path\n if ($path = $this->app->path->path('root:plugins/system/zlframework/zlframework')) {\n $this->app->path->register($path, 'zlfw');\n }\n\n if ($path = JPATH_ROOT . '/media/zoo/custom_elements') {\n $this->app->path->register($path, 'elements'); // register custom elements path\n }\n }",
"public static function __once() {\n\t\ttry {\n\t\t\tself::$environment = \\Glue\\Component\\Environment::getInstance();\n\t\t\tself::$path = self::$environment->get('path');\n\t\t\tself::$node = '/' . self::$environment->get('node');\n\t\t} catch(\\Exception $exception) {\n\t\t\tthrow new \\RuntimeException(\\Glue\\Helper\\General::replace(array('class' => __CLASS__), GLUE_EXCEPTION_CLASS_INITIALIZE), NULL, $exception);\n\t\t}\n\t}",
"protected static function getTestsRuntimePath()\n {\n return __DIR__ . '/runtime';\n }",
"public function getEnvironment();",
"public function getEnvironment();",
"public function getEnvironment();"
] |
[
"0.51149225",
"0.49203053",
"0.48841015",
"0.4765251",
"0.4765251",
"0.47317755",
"0.46629414",
"0.46562344",
"0.46082336",
"0.4592646",
"0.45551074",
"0.45452765",
"0.4538281",
"0.45347127",
"0.45152834",
"0.45075405",
"0.45032737",
"0.44758916",
"0.44677413",
"0.4467522",
"0.44660816",
"0.44488642",
"0.4445059",
"0.4441123",
"0.4431151",
"0.44277385",
"0.44252437",
"0.44221783",
"0.44221783",
"0.44221783"
] |
0.5836688
|
0
|
Delete all previously compiled JMESPath files from the JP_COMPILE_DIR directory or sys_get_temp_dir().
|
public static function cleanCompileDir()
{
$total = 0;
$compileDir = self::getEnvVariable(self::COMPILE_DIR) ?: sys_get_temp_dir();
foreach (glob("{$compileDir}/jmespath_*.php") as $file) {
$total++;
unlink($file);
}
return $total;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function clearCompileDir();",
"public function emptyCompileDir()\n {\n $this->console(\"Deleting compiled assets\");\n $dir = $this->compilePath() . $this->prefix();\n if (is_dir($dir)) {\n Rails\\Toolbox\\FileTools::emptyDir($dir);\n }\n }",
"protected function cleanup()\n {\n $cache = sprintf('%s/phantomjs_*', sys_get_temp_dir());\n\n array_map('unlink', glob($cache));\n }",
"public function clean() {\n // Clean Temporary Files\n if (is_dir($this->tmpPath)) {\n $objects = new \\RecursiveIteratorIterator(\n new \\RecursiveDirectoryIterator($this->tmpPath), \\RecursiveIteratorIterator::SELF_FIRST\n );\n foreach ($objects as $name => $object) {\n if (!$object->isDir()) {\n @unlink($name);\n }\n }\n }\n\n // Clean Cache Files\n if (is_dir($this->cachePath)) {\n $objects = new \\RecursiveIteratorIterator(\n new \\RecursiveDirectoryIterator($this->cachePath), \\RecursiveIteratorIterator::SELF_FIRST\n );\n foreach ($objects as $name => $object) {\n if (!$object->isDir()) {\n @unlink($name);\n }\n }\n }\n }",
"public function cleanTmpFolder() {\n\t\tarray_map('unlink', glob($this->settings->tmp_path . '/*'));\n\t}",
"public function deleteCompiledTemplates() {\n\t\t// templates\n\t\t$filenames = glob(WCF_DIR.'templates/compiled/*_'.$this->languageID.'_*.php');\n\t\tif ($filenames) foreach ($filenames as $filename) @unlink($filename);\n\t\t\n\t\t// acp templates\n\t\t$filenames = glob(WCF_DIR.'acp/templates/compiled/*_'.$this->languageID.'_*.php');\n\t\tif ($filenames) foreach ($filenames as $filename) @unlink($filename);\n\t}",
"function deleteTemp () : void {\n\tforeach(glob(_ROOT_PATH.'temp/*') as $file){\n\t\tunlink($file);\n\t}\n}",
"public function removeTempFiles()\n {\n parent::removeTempFiles();\n $this->removeDir($this->cacheDir(\"upgrades/driver/\"));\n }",
"public static function _removeTmpFiles()\n {\n if (count($GLOBALS['_System_temp_files'])) {\n $delete = $GLOBALS['_System_temp_files'];\n array_unshift($delete, '-r');\n System::rm($delete);\n $GLOBALS['_System_temp_files'] = array();\n }\n }",
"public function removeTempFiles()\n {\n $this->removeDir($this->context['temp_dir']);\n }",
"public function cleanCompilationFolder($files_to_delete)\n {\n foreach ($files_to_delete as $file) {\n if (file_exists($file)) {\n unlink($file);\n }\n }\n }",
"protected function cleanup()\n {\n foreach ($this->temp_files as $file) {\n $this->filesystem->remove($file);\n }\n $this->temp_files = [];\n }",
"public function cleanTempFiles()\n\t{\n\t\t$manifestData = $this->_getManifestData();\n\n\t\tforeach ($manifestData as $row)\n\t\t{\n\t\t\tif (UpdateHelper::isManifestVersionInfoLine($row))\n\t\t\t{\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t$rowData = explode(';', $row);\n\n\t\t\t// Delete any files we backed up.\n\t\t\t$backupFilePath = IOHelper::normalizePathSeparators(blx()->path->getAppPath().$rowData[0].'.bak');\n\n\t\t\tif (($file = IOHelper::getFile($backupFilePath)) !== false)\n\t\t\t{\n\t\t\t\tBlocks::log('Deleting backup file: '.$file->getRealPath(), \\CLogger::LEVEL_INFO);\n\t\t\t\t$file->delete();\n\t\t\t}\n\t\t}\n\n\t\t// Delete the temp patch folder\n\t\tIOHelper::deleteFolder($this->_unzipFolder);\n\n\t\t// Delete the downloaded patch file.\n\t\tIOHelper::deleteFile($this->_downloadFilePath);\n\t}",
"public function tearDown()\n {\n if (file_exists(JSMin::$minifiedFolder)) {\n self::removeFiles(JSMin::$minifiedFolder);\n }\n if (file_exists(CSSMin::$minifiedFolder)) {\n self::removeFiles(CSSMin::$minifiedFolder);\n }\n if (file_exists('/cis/lib/Gustavus/Resources/Test/files/staging/')) {\n self::removeFiles('/cis/lib/Gustavus/Resources/Test/files/staging/');\n }\n }",
"public function unlinkTempFiles()\n {\n $typo3temp = PATH_site . 'typo3temp/';\n foreach (glob($typo3temp . $this->tempFilePrefix . '*') as $tempFile) {\n @unlink($tempFile);\n }\n }",
"private function cleanTmp()\n {\n // cleanup files in tmp\n $dir = ELAB_ROOT . '/uploads/tmp';\n $di = new \\RecursiveDirectoryIterator($dir, FilesystemIterator::SKIP_DOTS);\n $ri = new \\RecursiveIteratorIterator($di, \\RecursiveIteratorIterator::CHILD_FIRST);\n foreach ($ri as $file) {\n $file->isDir() ? rmdir($file) : unlink($file);\n }\n }",
"public function cleanFileCache()\n {\n if (is_callable(array('SugarAutoLoader', 'buildCache'))) {\n SugarAutoLoader::buildCache();\n } else {\n // delete dangerous files manually\n @unlink(\"cache/file_map.php\");\n @unlink(\"cache/class_map.php\");\n }\n }",
"private function clear()\n {\n unlink($this->getConfig()->read('tmp_dir') . Evaluator::FILENAME);\n rmdir($this->getConfig()->read('tmp_dir'));\n }",
"private function deleteTemporaryFiles()\n {\n foreach ($this->temp as $file) {\n if (file_exists($file)) {\n unlink($file);\n }\n }\n\n $this->temp = [];\n }",
"public function clean() {\n $this->logger->debug('Deleting of all cache files');\n $list = glob($this->cacheFilePath . '*.cache');\n if (!$list) {\n $this->logger->info('No cache files were found skipping');\n return;\n }\n $this->logger->info('Found [' . count($list) . '] cache files to remove');\n foreach ($list as $file) {\n $this->logger->debug('Processing the cache file [' . $file . ']');\n unlink($file);\n }\n }",
"protected function cleanup() {\n $h = opendir($this->tmpdir);\n while (false !== ($e = readdir($h))) {\n if ($e!='.'&&$e!='..'&&is_file($this->tmpdir.'/'.$e)) unlink ($this->tmpdir.'/'.$e);\n }\n if (is_object($this->history)) $this->history->cleanup();\n closedir($h);\n rmdir($this->tmpdir);\n }",
"public static function cleanResources()\n {\n File::deleteDirectory(resource_path('sass'));\n File::delete(resource_path('js/app.js'));\n File::delete(resource_path('js/bootstrap.js'));\n }",
"protected function cleanOutputDir()\n {\n $directoryIterator = new RecursiveDirectoryIterator(\n ZEPHIR_PARSER_OUTPUT,\n FilesystemIterator::KEY_AS_PATHNAME |\n FilesystemIterator::CURRENT_AS_FILEINFO |\n FilesystemIterator::SKIP_DOTS\n );\n\n $iterator = iterator_to_array(\n new RecursiveIteratorIterator($directoryIterator, RecursiveIteratorIterator::CHILD_FIRST)\n );\n\n try {\n foreach ($iterator as $file) {\n /* @var \\SplFileInfo $file */\n if ($file->isDir()) {\n rmdir($file->getRealPath());\n continue;\n }\n\n if (strpos($file->getBasename(), '.') !== 0) {\n unlink($file->getRealPath());\n }\n }\n } catch (\\UnexpectedValueException $e) {\n // Ignore\n }\n }",
"public function temp_gc()\n {\n $tmp = unslashify($this->config->get('temp_dir'));\n $expire = mktime() - 172800; // expire in 48 hours\n\n if ($dir = opendir($tmp)) {\n while (($fname = readdir($dir)) !== false) {\n if ($fname{0} == '.') {\n continue;\n }\n\n if (filemtime($tmp.'/'.$fname) < $expire) {\n @unlink($tmp.'/'.$fname);\n }\n }\n\n closedir($dir);\n }\n }",
"public function cleanAll()\n {\n $this->filesystem->remove(self::getFilesList());\n }",
"function cleanupTmp() {\n // try to delete all the tmp files we know about.\n foreach($this->tmpFilesCreated as $file) {\n if(file_exists($file)) {\n $status = unlink($file);\n }\n }\n $this->tmpFilesCreated = array();\n // try to completely delete each directory we created.\n $dirs = array_reverse($this->tmpDirsCreated);\n foreach($dirs as $dir) {\n if(file_exists($dir)) {\n $this->recursiveRmdir($dir);\n }\n }\n $this->tmpDirsCreated = array();\n }",
"public function __destruct()\n {\n if($this->_gc_temp_files === true && empty($this->_tmp_files) === false)\n {\n foreach ($this->_tmp_files as $path)\n {\n if(is_file($path) === true)\n {\n @unlink($path);\n }\n }\n }\n }",
"public function clean()\n {\n $dir = new \\Ninja\\Directory(NINJA_DOCROOT . 'public/');\n /**\n * @var $files \\Ninja\\File[]\n */\n\n $files = $dir->scanRecursive(\"*.css\");\n echo \"\\nDeleting Minified Css Files...\\n\";\n foreach($files as $sourceFile)\n {\n // if does not have a numeric pre-extension-suffix foo.#.js (e.g foo.52.js) which are files from a previous build\n if ( ! is_numeric(substr($sourceFile->getName(true), strrpos($sourceFile->getName(true), '.') + 1)) )\n continue;\n\n echo ' ' . $sourceFile->getPath() . \"\\n\";\n $sourceFile->delete();\n\n unset($sourceFile);\n }\n\n $files = $dir->scanRecursive(\"*.js\");\n echo \"\\nDeleting Minified Js Files...\\n\";\n foreach($files as $sourceFile)\n {\n // if does not have a numeric pre-extension-suffix foo.#.js (e.g foo.52.js) which are files from a previous build\n if ( ! is_numeric(substr($sourceFile->getName(true), strrpos($sourceFile->getName(true), '.') + 1)) )\n continue;\n\n echo ' ' . $sourceFile->getPath() . \"\\n\";\n $sourceFile->delete();\n unset($sourceFile);\n }\n }",
"public function clean()\n {\n if ( is_dir( $this->_strDirectory ) ) {\n $h = opendir($this->_strDirectory);\n while ($h && $f = readdir($h)) { \n if ( $f != '.' && $f != '..') {\n $fn = $this->_strDirectory . '/' . $f;\n if ( is_dir($fn) ) {\n $dir = new Sys_Dir($fn);\n $dir->delete();\n } else {\n $file = new Sys_File( $fn );\n $file->delete();\n }\n }\n }\n\t if ( $h ) { closedir( $h ); }\n \n }\n }",
"private function clean() {\n\t\t$types = ['.aux', '.fdb_latexmk', '.fls', '.log', '.out', '.tex', '.toc'];\n\t\t$s = '';\n\t\tforeach (scandir($this -> directory) as $file) {\n\t\t\tif ($file === '.' || $file === '..') continue;\n\t\t\tforeach ($types as $t) {\n\t\t\t\t$extension = substr($file, 0-strlen($t));\n\t\t\t\tif (in_array($extension, $types) && file_exists($this -> directory . '/' . $file)) {\n\t\t\t\t\tunlink($this -> directory . '/' . basename($file));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}"
] |
[
"0.67920256",
"0.6744104",
"0.66824263",
"0.6404778",
"0.63608074",
"0.63010216",
"0.6222713",
"0.6214783",
"0.61654854",
"0.6157714",
"0.61537755",
"0.60848224",
"0.6013993",
"0.5975246",
"0.59653705",
"0.59628814",
"0.59578073",
"0.5910919",
"0.58898413",
"0.5869812",
"0.5868317",
"0.5832502",
"0.58296096",
"0.58259594",
"0.58215433",
"0.58170944",
"0.5812182",
"0.5771033",
"0.5769687",
"0.57633173"
] |
0.7789213
|
0
|
Remove a stat from the stats list
|
public function removeStat($stat)
{
if (isset($this->stats[$stat])) {
unset($this->stats[$stat]);
}
return $this;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function remove();",
"public function remove();",
"public function remove();",
"public function remove();",
"public static function decrement($stat, $sampleRate = 1)\n\t{\n\t\tif (self::$instance)\n\t\t{\n\t\t\tself::$instance->decrement($stat, $sampleRate);\n\t\t}\n\t}",
"public function remove() {}",
"public function remove() {}",
"public function delete( ) {\n\t $query = \"DELETE FROM stat WHERE id=?\";\n\t return $this->db->execute( $query, array($this->id) ); \t\n\t }",
"function remove($name) {\n if (isset($this->data[$name])) {\n unset($this->data[$name]);\n }\n }",
"public function destroy(Statut $statut)\n {\n //\n }",
"function cleanupGameStats()\n\t{\n mysqli_query( Registry::$mysqliLink, 'DELETE FROM glestserver WHERE status = 3 AND gameUUID in (SELECT gameUUID from glestgamestats where framesToCalculatePlaytime / 40 / 60 < ' . MAX_MINS_OLD_COMPLETED_GAMES . ');');\n\n // Cleanup game stats for games that are purged\n mysqli_query( Registry::$mysqliLink, 'DELETE FROM glestgamestats WHERE gameUUID NOT IN (SELECT gameUUID from glestserver);');\n mysqli_query( Registry::$mysqliLink, 'DELETE FROM glestgameplayerstats WHERE gameUUID NOT IN (SELECT gameUUID from glestgamestats);');\n }",
"public function removeProfile();",
"public static function clear(string $stat): bool\n {\n return (bool)Resque::redis()->del(\"stat:$stat\");\n }",
"public function remove($key) {\n\t\t\tif( $this->getMemcache()->delete( $key ) && $this->stats && $this->stats[ 'curr_items' ] > 0) {\n\t\t\t\t$this->stats['curr_items']--;\n\t\t\t}\n\t\t}",
"public function removeAll() {\n\t\t\tif( !$items = $this->getStats( 'items' ) ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t$memcache = $this->getMemcache();\n\t\t\tforeach ($items['items'] as $key => $item) {\n\t\t\t\t$dump = $memcache->getStats( 'cachedump', $key, $item['number'] * 2 );\n\t\t\t\tforeach( array_keys( $dump ) as $ckey ) {\n\t\t\t\t\t$memcache->delete( $ckey );\n\t\t\t\t}\n\t\t\t}\n\t\t\t$this->stats = null;\n\t\t}",
"abstract public function remove();",
"abstract public function remove();",
"abstract public function remove();",
"public function remove($name)\n {\n unset($this->values[$name]);\n\t}",
"public function clearStats()\r\n {\r\n $this->stats = array();\r\n\r\n return $this;\r\n }",
"protected function remove($type)\n {\n unset($this->alerts[$type]);\n }",
"public function remove($value);",
"public function removeFirst();",
"public function onRemove();",
"public static function decr(string $stat, int $by = 1): bool\n {\n return (bool)Resque::redis()->decrby(\"stat:$stat\", $by);\n }",
"public function remove($item);",
"public function remove($name);",
"public function remove($name);",
"public function remove($name);",
"public function remove($name);"
] |
[
"0.60061944",
"0.60061944",
"0.60061944",
"0.60061944",
"0.5805825",
"0.57828605",
"0.5781403",
"0.5676479",
"0.5674141",
"0.5579617",
"0.5556414",
"0.55489117",
"0.554565",
"0.551013",
"0.5489859",
"0.54619896",
"0.54619896",
"0.54619896",
"0.5451993",
"0.53886235",
"0.5365108",
"0.53401256",
"0.52985984",
"0.5291274",
"0.5282131",
"0.5280365",
"0.5276952",
"0.5276952",
"0.5276952",
"0.5276952"
] |
0.75766253
|
0
|
===================================================================================================================================== Script to upload cat metas JC
|
function upload_metas(){
$cat_id = clean_input($_POST['cat_id']);
$cat_title = clean_input($_POST['cat_meta_title']);
$cat_keywords = clean_input($_POST['cat_meta_keywords']);
$cat_descriptions = clean_input($_POST['cat_meta_description']);
if(isset($_POST['upload'])){
$query = "INSERT INTO categories WHERE cat_id ='$cat_id' ";
$result = mysql_query($query) or die(mysql_error());
return $result;
}
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function uploadMeta()\n\t{\n global $mysql;\n\n Debug::log('<hr><h1>Beginning meta update</h1><hr>', LEVEL_MAIN);\n \n $startTime = new DateTime();\n\n\t\t$version = $this->getVersionNumberFromFolder($this->folderlocation);\n\n\t\tif ($this->getVersionExistsInDatabase($version, $this->versionId) == null)\n\t\t{\n Debug::log('New version detected', LEVEL_MINIMUM);\n\n // Todo: Migrate to stored procedure\n $mysql->insert('wot_versions', array('version' => $version, 'published' => time()));\n\n $this->versionId = $mysql->getLastUpdatedId();\n\t\t}\n \n $this->deserializeWoTMetaFiles();\n $this->copyTranslationFiles();\n $this->updateTranslations();\n \n $this->vehicles_path = 'versions/' . $this->version . '/';\n \n $this->ImportEquipment();\n $this->ImportTankInformation();\n\n\n Debug::log('<hr><h1>Completed meta upate</h1>', LEVEL_MAIN);\n Debug::log('Meta update took '.$startTime->diff(new DateTime())->format('%I minutes and %S seconds'), LEVEL_MAIN);\n \n\t}",
"function wptp_add_categories_to_attachments() {\r\n register_taxonomy_for_object_type( 'category', 'attachment' );\r\n}",
"public function copy_category_to_tag( $args, $assoc_args ) {\n\n\t\t$args = array(\n\t\t\t'posts_per_page' => 1000,\n\t\t\t'post_type' => 'mf_form',\n\t\t\t'post_status' => 'any',\n\n\t\t\t// Prevent new posts from affecting the order\n\t\t\t'orderby' => 'ID',\n\t\t\t'order' => 'ASC',\n\n\t\t\t// Speed this up\n\t\t\t'no_found_rows' => true,\n\t\t\t'update_post_meta_cache' => false,\n\t\t\t'update_post_term_cache' => false,\n\t\t);\n\n\t\t// Get the first set of posts\n\t\t$query = new WP_Query( $args );\n\n\t\twhile ( $query->have_posts() ) : $query->the_post();\n\t\tglobal $post;\n\t\t\tsetup_postdata($post);\n\t\t\tWP_CLI::line( get_the_title() );\n\t\t\t$json_post = json_decode( str_replace( \"\\'\", \"'\", get_the_content() ) );\n\n\t\t\tif ( isset( $json_post->cats ) ) {\n\t\t\t\t$catsobj = $json_post->cats;\n\t\t\t} else {\n\t\t\t\t$catsobj = null;\n\t\t\t}\n\t\t\t$cats = null;\n\t\t\tif ( is_array( $catsobj ) ) {\n\t\t\t\t$cats = $catsobj;\n\t\t\t} else {\n\t\t\t\t$cats = explode(',', $catsobj);\n\t\t\t}\n\t\t\tif ( !empty( $cats[0] ) ) {\n\t\t\t\tWP_CLI::line('Categories:');\n\t\t\t\tforeach ($cats as $cat) {\n\t\t\t\t\t$result = wp_set_object_terms( get_the_ID(), $cat, 'category', true );\n\t\t\t\t\tif ( !empty( $result ) ) {\n\t\t\t\t\t\tWP_CLI::success( $cat );\n\t\t\t\t\t} else {\n\t\t\t\t\t\tWP_CLI::error( $cat );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( isset( $json_post->tags ) ) {\n\t\t\t\t$tagsobj = $json_post->tags;\n\t\t\t} else {\n\t\t\t\t$tagsobj = null;\n\t\t\t}\n\t\t\t$tags = null;\n\t\t\tif ( is_array( $tagsobj ) ) {\n\t\t\t\t$tags = $tagsobj;\n\t\t\t} else {\n\t\t\t\t$tags = explode(',', $tagsobj);\n\t\t\t}\n\t\t\tif ( !empty( $tags[0] ) ) {\n\t\t\t\tWP_CLI::line('Tags:');\n\t\t\t\tforeach ($tags as $tag) {\n\t\t\t\t\t$result = wp_set_object_terms( get_the_ID(), $tag, 'post_tag', true );\n\t\t\t\t\tif ( !empty( $result ) ) {\n\t\t\t\t\t\tWP_CLI::success( $tag );\n\t\t\t\t\t} else {\n\t\t\t\t\t\tWP_CLI::error( $tag );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\n\t\tWP_CLI::line( '' );\n\t\tendwhile;\n\t\tWP_CLI::success( \"Boom!\" );\n\n\t}",
"function _arc_meta_category_meta($event, $step, $data, $rs)\n{\n // category types).\n if ($rs['type']!='article') {\n return $data;\n }\n\n // Get the existing meta data for this category.\n $meta = _arc_meta('category', $rs['name'], true);\n\n $form = hInput('arc_meta_id', $meta['id']);\n $form .= '<div class=\"txp-form-field edit-category-arc_meta_title\">';\n $form .= '<div class=\"txp-form-field-label\">' . tag(gtxt('arc_meta_title'), 'label', ' for=\"arc_meta_title\"') . '</div>';\n $form .= '<div class=\"txp-form-field-value\">' . fInput('text', 'arc_meta_title', $meta['title'], '', '', '', '32', '', 'arc_meta_title') . '</div>';\n $form .= '</div>';\n $form .= '<div class=\"txp-form-field edit-category-arc_meta_image\">';\n $form .= '<div class=\"txp-form-field-label\">' . tag(gtxt('arc_meta_image'), 'label', ' for=\"arc_meta_image\"') . '</div>';\n $form .= '<div class=\"txp-form-field-value\">' . fInput('number', 'arc_meta_image', $meta['image'], '', '', '', '32', '', 'arc_meta_image') . '</div>';\n $form .= '</div>';\n $form .= '<div class=\"txp-form-field edit-category-arc_meta_robots\">';\n $form .= '<div class=\"txp-form-field-label\">' . tag(gtxt('arc_meta_robots'), 'label', ' for=\"arc_meta_description\"') . '</div>';\n $form .= '<div class=\"txp-form-field-value\">' . selectInput('arc_meta_robots', _arc_meta_robots(), $meta['robots'], 'arc_meta_robots') . '</div>';\n $form .= '</div>';\n\n return $data . $form;\n}",
"function wck_add_meta(){\n\t\tparent::wck_add_meta();\n\t}",
"function save_extra_category_fileds( $term_id ) {\n\tif ( isset( $_POST['term_meta'] ) ) {\n\t\t$tag_id\t\t= $term_id;\n\t\t$term_meta\t= get_option( \"category_$tag_id\" );\n\t\t$cat_keys\t= array_keys( $_POST['term_meta'] );\n\t\tforeach ( $cat_keys as $key ) {\n\t\t\tif ( isset( $_POST['term_meta'][$key] ) ) {\n\t\t\t\t$term_meta[$key] = $_POST['term_meta'][$key];\n\t\t\t}\n\t\t}\n\t\t//save the option array\n\t\tupdate_option( \"category_$tag_id\", $term_meta );\n\t}\n}",
"function save_extra_category_fileds( $term_id ) {\n if ( isset( $_POST['Cat_meta'] ) ) {\n $t_id = $term_id;\n $cat_meta = get_option( \"category_$t_id\");\n $cat_keys = array_keys($_POST['Cat_meta']);\n foreach ($cat_keys as $key){\n if (isset($_POST['Cat_meta'][$key])){\n $cat_meta[$key] = $_POST['Cat_meta'][$key];\n }\n }\n //save the option array\n update_option( \"category_$t_id\", $cat_meta );\n }\n}",
"function save_extra_category_fileds( $term_id ) {\n if ( isset( $_POST['Cat_meta'] ) ) {\n $t_id = $term_id;\n $cat_meta = get_option( \"category_$t_id\");\n $cat_keys = array_keys($_POST['Cat_meta']);\n foreach ($cat_keys as $key){\n if (isset($_POST['Cat_meta'][$key])){\n $cat_meta[$key] = $_POST['Cat_meta'][$key];\n }\n }\n //save the option array\n update_option( \"category_$t_id\", $cat_meta );\n }\n}",
"function classiera_update_my_category_fields($term_id) {\r\n\tif(isset($_POST['taxonomy'])){\t\r\n\t if($_POST['taxonomy'] == 'category'):\r\n\t\t$tag_extra_fields = get_option(MY_CATEGORY_FIELDS);\r\n\t\t$tag_extra_fields[$term_id]['your_image_url'] = strip_tags($_POST['your_image_url']);\r\n\t\t$tag_extra_fields[$term_id]['category_image'] = $_POST['category_image'];\r\n\t\t$tag_extra_fields[$term_id]['category_icon_code'] = $_POST['category_icon_code'];\r\n\t\t$tag_extra_fields[$term_id]['category_icon_color'] = $_POST['category_icon_color'];\r\n\t\tupdate_option(MY_CATEGORY_FIELDS, $tag_extra_fields);\r\n\t endif;\r\n\t}\r\n}",
"public function upload_postAction() {\r\n\t\t$ret = Common::upload('img', 'category');\r\n\t\t$imgId = $this->getPost('imgId');\r\n\t\t$this->assign('code' , $ret['data']);\r\n\t\t$this->assign('msg' , $ret['msg']);\r\n\t\t$this->assign('data', $ret['data']);\r\n\t\t$this->assign('imgId', $imgId);\r\n\t\t$this->getView()->display('common/upload.phtml');\r\n\t\texit;\r\n\t}",
"function wck_add_meta(){\r\n\t\tcheck_ajax_referer( \"wck-add-meta\" );\r\n\t\tif( !empty( $_POST['meta'] ) )\r\n\t\t\t$meta = sanitize_text_field( $_POST['meta'] );\r\n\t\telse\r\n\t\t\t$meta = '';\r\n\t\tif( !empty( $_POST['id'] ) )\r\n\t\t\t$id = absint($_POST['id']);\r\n\t\telse \r\n\t\t\t$id = '';\r\n\t\tif( !empty( $_POST['values'] ) && is_array( $_POST['values'] ) )\r\n\t\t\t$values = array_map( 'wppb_sanitize_value', $_POST['values'] );\r\n\t\telse\r\n\t\t\t$values = array();\r\n\r\n\t\t// Security checks\r\n\t\tif( true !== ( $error = self::wck_verify_user_capabilities( $this->args['context'], $meta, $id ) ) ) {\r\n\t\t\theader( 'Content-type: application/json' );\r\n\t\t\tdie( json_encode( $error ) );\r\n\t\t}\r\n\r\n\t\t$values = apply_filters( \"wck_add_meta_filter_values_{$meta}\", $values );\r\n\r\n\t\t/* check required fields */\r\n\t\t$errors = self::wck_test_required( $this->args['meta_array'], $meta, $values, $id );\t\t\r\n\t\tif( $errors != '' ){\r\n\t\t\theader( 'Content-type: application/json' );\r\n\t\t\tdie( json_encode( $errors ) );\r\n\t\t}\r\n\t\t\t\r\n\t\t\r\n\t\tif( $this->args['context'] == 'post_meta' )\r\n\t\t\t$results = get_post_meta($id, $meta, true);\r\n\t\telse if ( $this->args['context'] == 'option' )\r\n\t\t\t$results = get_option( apply_filters( 'wck_option_meta' , $meta, $values ) );\r\n\r\n\t\t/* we need an array here */\r\n\t\tif( empty( $results ) && !is_array( $results ) )\r\n\t\t\t$results = array();\r\n\r\n /* for single metaboxes owerwrite entries each time so we have a maximum of one */\r\n if( $this->args['single'] )\r\n $results = array( $values );\r\n else\r\n $results[] = $values;\r\n\r\n\t\t/* make sure this does not output anything so it won't break the json response below\r\n\t\twill keep it do_action for compatibility reasons\r\n\t\t */\r\n\t\tob_start();\r\n\t\t\tdo_action( 'wck_before_add_meta', $meta, $id, $values );\r\n\t\t$wck_before_add_meta = ob_get_clean(); //don't output it\r\n\r\n\t\t\r\n\t\tif( $this->args['context'] == 'post_meta' )\r\n\t\t\tupdate_post_meta($id, $meta, $results);\r\n\t\telse if ( $this->args['context'] == 'option' )\r\n\t\t\tupdate_option( apply_filters( 'wck_option_meta' , $meta, $results ), wp_unslash( $results ) );\r\n\t\t\r\n\t\t/* if unserialize_fields is true add for each entry separate post meta for every element of the form */\r\n\t\tif( $this->args['unserialize_fields'] && $this->args['context'] == 'post_meta' ){\r\n\t\t\t\r\n\t\t\t$meta_suffix = count( $results );\r\n\t\t\tif( !empty( $values ) ){ \r\n\t\t\t\tforeach( $values as $name => $value ){\r\n\t\t\t\t\tupdate_post_meta($id, $meta.'_'.$name.'_'.$meta_suffix, $value);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t$entry_list = $this->wck_refresh_list( $meta, $id );\r\n\t\t$add_form = $this->wck_add_form( $meta, $id );\r\n\r\n\t\theader( 'Content-type: application/json' );\r\n\t\tdie( json_encode( array( 'entry_list' => $entry_list, 'add_form' => $add_form ) ) );\t\r\n\t\t\r\n\t}",
"function aw_pp_register_post_type_cat() {\n /* Set up the arguments for the 'music_album' post type. */\n\n $cat_args = array( \t\n\t'public' => true,\n \t'capability_type' => 'post',\n \t'hierarchical' => false,\n \t'rewrite' => array( 'slug' => \"cat\", 'with_front' => false ),\n\t'capability_type' => 'post',\n\t'hierarchical' => false,\n\t'labels' => array(\n 'name' => 'Cats',\n 'singular_name' => 'Cat',\n 'add_new' => 'Add New Cat',\n 'add_new_item' => 'Add New Cat',\n 'edit_item' => 'Edit Cat',\n 'new_item' => 'New Cat',\n 'view_item' => 'View Cat',\n 'search_items' => 'Search Cats',\n 'not_found' => 'No Cats Found',\n 'not_found_in_trash' => 'No Cats Found In Trash'\n ),\n 'supports' => array(\n\t\t'title',\n\t\t'editor',\n\t\t'revisions',\n\t\t'thumbnail'\n )\n );\n /* Register the music album post type. */\n register_post_type( 'aw_pp_cats', $cat_args );\n}",
"private function packMeta()\n {\n $transport = $this->modx->fromJSON(file_get_contents(__DIR__ . '/../transport.json'));\n unset($transport['support']['db']);\n\n $this->builder->setPackageAttributes([\n 'changelog' => file_get_contents(__DIR__ . '/../meta/changelog.txt'),\n 'license' => file_get_contents(__DIR__ . '/../meta/license.txt'),\n 'readme' => file_get_contents(__DIR__ . '/../meta/readme.txt'),\n 'requires' => $transport['support']\n ]);\n }",
"function kcs_client_meta_boxes_setup() {\n /* Add meta boxes on the 'add_meta_boxes' hook. */\n add_action( 'add_meta_boxes', 'kcs_add_client_meta_boxes' );\n /* Save post meta on the 'save_post' hook. */\n add_action( 'save_post', 'kcs_save_client_meta', 10, 2 );\n}",
"function ccac_2020_new_init() {\n register_taxonomy_for_object_type( 'category', 'attachment' );\n register_taxonomy_for_object_type( 'post_tag', 'attachment' );\n\n /*\n * Register custom post types. You can also move this code to a plugin.\n */\n /* Pinegrow generated Custom Post Types Begin */\n\n /* Pinegrow generated Custom Post Types End */\n \n /*\n * Register custom taxonomies. You can also move this code to a plugin.\n */\n /* Pinegrow generated Taxonomies Begin */\n\n /* Pinegrow generated Taxonomies End */\n\n}",
"function lm_save_category() {\n\t@copy(LM_CDATA, LM_CBACKUP);\n\t$id = isset($_POST['category-id']) ? intval($_POST['category-id']) : null;\n\t$cid = isset($_POST['category-cid']) ? intval($_POST['category-cid']) : time();\n\t$arr = array('cid'=>$cid, 'name'=>safe_slash_html($_POST['category-name']));\n\tif (function_exists('return_i18n_languages')) {\n\t\tforeach(return_i18n_languages() as $lang) {\n\t\t\tif ($lang != return_i18n_default_language()) {\n\t\t\t\t$arr['name_'.$lang] = safe_slash_html($_POST['category-name_'.$lang]);\n\t\t\t}\n\t\t}\n\t}\n\t$categories = lm_get_categories();\n\tif (isset($id))\n\t\t$categories[$id] = $arr;\n\telse\n\t\t$categories[] = $arr;\n\tif (lm_c_to_xml($categories))\n\t\tlm_display_message(i18n_r(LM_PLUGIN.'/SUCCESS_SAVE'), true, false, true);\n\telse\n\t\tlm_display_message(i18n_r(LM_PLUGIN.'/ERROR_SAVE'), false);\n}",
"function target_add_cat($cat)\n{\n\tif ($GLOBALS['VERBOSE']) pf('...'. $cat['name']);\n\n\tq('INSERT INTO '. $GLOBALS['DBHOST_TBL_PREFIX'] .'cat (id, name, view_order, cat_opt) \n\t VALUES('. (int)$cat['id'] .','. _esc($cat['name']) .','. (int)$cat['view_order'] .', 3)');\n\t$GLOBALS['cat_map'][ $cat['id'] ] = $cat['id'];\n/*\nfud_use('cat.inc', true);\n$nc = new fud_cat;\n$nc->name = $c->name;\n$nc->description = $c->description;\n$nc->view_order = $c->disporder;\n$nc->cat_opt = 1|2;\t// This should be the default in cat.inc. Fix in next release and del this line.\n$GLOBALS['cat_map'][$c->fid] = $nc->add('LAST');\t// FIRST should also be defaulted.\n*/\n}",
"private function updateMetas() {\n if( is_null($this->Metas) )\n $this->Metas = array();\n\n $this->Metas[0] = '<meta http-equiv=\"Content-Type\" content=\"' . $this->ContentType . '; charset=' . $this->Charset . '\" />';\n }",
"function picmonkeyUpload(){\n\n\tif(! is_admin() || ! isset($_POST['file'])){\n\t\treturn;\n\t}\n\n\t$img = file_get_contents($_POST['file']);\n\n\t$extArray = explode(\".\", $_POST['file']);\n\t$index = count($extArray) - 1;\n\t$ext = $extArray[$index];\n\t$fileName = date(\"Y-m-d H.i.s\") . \".\" . $ext;\n\t$fileContentType = mime_content_type($img);\n\n\t$action = admin_url('media-new.php');\n\t$nonce = wp_create_nonce('media-form');\n\t$param = array(\n\t\t'html-upload' => 'upload',\n\t\t'post_id' => '0',\n\t\t'_wpnonce' => $nonce,\n\t);\n\n\t// create http contents\n\t$boundary = \"--\".substr(md5(rand(0,32000)), 0, 10);\n\n\t$data = array(\n\t\t\"--\" . $boundary,\n\t\t\"Content-Disposition: form-data; name=\\\"async-upload\\\"; \".\n\t\t\"filename=\\\"\" . $fileName . \"\\\"\",\n\t\t\"Content-Type: \" . $fileContentType,\n\t\t\"\",\n\t\t$img,\n\t\t\"\"\n\t);\n\n\t$content = '';\n\tforeach($param as $k => $v){\n\t\t$content .= \"--\" . $boundary . \"\\r\\n\".\n\t\t\t\"Content-Disposition: form-data; \".\n\t\t\t\"name=\\\"\" . $k . \"\\\"\\r\\n\\r\\n\".\n\t\t\t$v . \"\\r\\n\";\n\t}\n\t$content .= implode(\"\\r\\n\", $data) . \"--\" . $boundary . \"--\";\n\n\t$headers = array(\n\t\t'Content-Type: multipart/form-data; boundary=' . $boundary\n\t);\n\t$cookie = 'Cookie: ';\n\tforeach($_COOKIE as $k => $v){\n\t\t$cookie .= $k . '=' . $v . ';';\n\t}\n\n\tarray_push($headers, $cookie);\n\n\t$context = array(\"http\" => array(\n\t\t\"method\" => \"POST\",\n\t\t\"header\" => implode(\"\\r\\n\", $headers),\n\t\t\"content\" => $content,\n\t));\n\n\t$resp = file_get_contents($action, FALSE, stream_context_create($context));\n}",
"private function packCategory()\n {\n /** @var modCategory $category */\n $category = $this->modx->newObject('modCategory');\n $category->set('category', self::PKG_NAME);\n\n $this->packCategoryElements($category, 'plugins');\n\n $this->builder->putVehicle($this->builder->createVehicle($category, [\n xPDOTransport::UNIQUE_KEY => 'category',\n xPDOTransport::PRESERVE_KEYS => false,\n xPDOTransport::UPDATE_OBJECT => true,\n xPDOTransport::RELATED_OBJECTS => true,\n xPDOTransport::RELATED_OBJECT_ATTRIBUTES => [\n 'Plugins' => [\n xPDOTransport::PRESERVE_KEYS => true,\n xPDOTransport::UPDATE_OBJECT => true,\n xPDOTransport::UNIQUE_KEY => 'name'\n ],\n 'PluginEvents' => [\n xPDOTransport::PRESERVE_KEYS => true,\n xPDOTransport::UPDATE_OBJECT => true,\n xPDOTransport::UNIQUE_KEY => ['pluginid','event'],\n ]\n ]\n ]));\n }",
"function attachment_submitbox_metadata()\n {\n }",
"public function buildMetaTags()\n\t{\n\t\t/* Set basic ones */\n\t\t$this->metaTags['og:site_name'] = \\IPS\\Settings::i()->board_name;\n\t\t$this->metaTags['og:locale'] = preg_replace( \"/^([a-zA-Z0-9\\-_]+?)(?:\\..*?)$/\", \"$1\", \\IPS\\Member::loggedIn()->language()->short );\n\t\t\n\t\t/* Add the site name to the title */\n\t\tif( \\IPS\\Settings::i()->board_name )\n\t\t{\n\t\t\t$this->title .= ' - ' . \\IPS\\Settings::i()->board_name;\n\t\t}\n\t\t\n\t\t/* Add Admin-specified ones */\n\t\tif( !$this->metaTagsUrl )\n\t\t{\n\t\t\t$protocol = ( \\IPS\\Request::i()->isSecure() ) ? \"https://\" : \"http://\";\n\t\t\t$this->metaTagsUrl\t= \\IPS\\Http\\Url::external( $protocol . parse_url( \\IPS\\Settings::i()->base_url, PHP_URL_HOST ) . $_SERVER['REQUEST_URI'] );\n\t\t\t$this->metaTagsUrl\t= urldecode( mb_substr( (string) $this->metaTagsUrl, mb_strlen( \\IPS\\Settings::i()->base_url ) ) );\n\t\n\t\t\tif ( isset( \\IPS\\Data\\Store::i()->metaTags ) )\n\t\t\t{\n\t\t\t\t$rows = \\IPS\\Data\\Store::i()->metaTags;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$rows = iterator_to_array( \\IPS\\Db::i()->select( '*', 'core_seo_meta' ) );\n\t\t\t\t\\IPS\\Data\\Store::i()->metaTags = $rows;\n\t\t\t}\n\t\t\t\n\t\t\tif( is_array( $rows ) )\n\t\t\t{\n\t\t\t\tforeach ( $rows as $row )\n\t\t\t\t{\n\t\t\t\t\tif( \\strpos( $row['meta_url'], '*' ) !== FALSE )\n\t\t\t\t\t{\n\t\t\t\t\t\tif( preg_match( \"#^\" . str_replace( '*', '(.+?)', trim( $row['meta_url'], '/' ) ) . \"$#i\", trim( $this->metaTagsUrl, '/' ) ) )\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$_tags\t= json_decode( $row['meta_tags'], TRUE );\n\t\t\n\t\t\t\t\t\t\tif( is_array( $_tags ) )\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tforeach( $_tags as $_tagName => $_tagContent )\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tif( !isset( $this->metaTags[ $_tagName ] ) )\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t$this->metaTags[ $_tagName ]\t= $_tagContent;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\n\t\t\t\t\t\t\t/* Are we setting page title? */\n\t\t\t\t\t\t\tif( $row['meta_title'] )\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$this->title\t\t\t= $row['meta_title'];\n\t\t\t\t\t\t\t\t$this->metaTagsTitle\t= $row['meta_title'];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tif( trim( $row['meta_url'], '/' ) == trim( $this->metaTagsUrl, '/' ) )\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$_tags\t= json_decode( $row['meta_tags'], TRUE );\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tif ( is_array( $_tags ) )\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tforeach( $_tags as $_tagName => $_tagContent )\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t$this->metaTags[ $_tagName ]\t= $_tagContent;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t/* Are we setting page title? */\n\t\t\t\t\t\t\tif( $row['meta_title'] )\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$this->title\t\t\t= $row['meta_title'];\n\t\t\t\t\t\t\t\t$this->metaTagsTitle\t= $row['meta_title'];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}",
"function clix_uppe_add_meta_box() {\r\n\tif( function_exists('add_meta_box') ) {\r\n\t\tadd_meta_box( 'clix_uppe_meta_box', 'Clix Category Exclusion', 'clix_uppe_meta_box', post, 'side' );\r\n \t}\r\n}",
"function coolRahulSoni_meta_box_add()\n{\n add_meta_box( 'my-meta-box-id', 'My First Meta Box', 'cd_meta_box_cb', 'post', 'normal', 'high' );\n}",
"protected function buildMetaCategory($category = NULL) {\r\n\t\tif (!empty($category) && array_key_exists($category, $this->settings['news']['semantic']['meta'])) {\r\n\r\n\t\t\t$config = $this->getConfig($category);\r\n\t\t\t$buildTags = t3lib_div::trimExplode(',', $config['build']);\r\n\r\n\t\t\tforeach ($buildTags as $tag) {\r\n\t\t\t\tif (array_key_exists($tag, $this->settings['news']['semantic']['meta'][$category])) {\r\n\t\t\t\t\t$rules = $this->settings['news']['semantic']['meta'][$category][$tag];\r\n\t\t\t\t} elseif (is_int(strpos($tag, ':'))) {\r\n\t\t\t\t\t$pathParts = t3lib_div::trimExplode(':', $tag);\r\n\t\t\t\t\tif (array_key_exists($pathParts[1], $this->settings['news']['semantic']['meta'][$category][$pathParts[0]])) {\r\n\t\t\t\t\t\t$rules = $this->settings['news']['semantic']['meta'][$category][$pathParts[0]][$pathParts[1]];\r\n\t\t\t\t\t}\r\n\t\t\t\t} elseif (is_int(strpos($tag, '.'))) {\r\n\t\t\t\t\t$pathParts = t3lib_div::trimExplode('.', $tag);\r\n\t\t\t\t\tif (array_key_exists($pathParts[1], $this->settings['news']['semantic']['meta'][$category][$pathParts[0]])) {\r\n\t\t\t\t\t\t$rules = $this->settings['news']['semantic']['meta'][$category][$pathParts[0]][$pathParts[1]];\r\n\t\t\t\t\t}\r\n\t\t\t\t} else {\r\n\t\t\t\t\tcontinue;\r\n\t\t\t\t}\r\n\t\t\t\tif (isset($rules) && !empty($rules) && is_array($rules)) {\r\n\t\t\t\t\t$prefType = $config['nsType'];\r\n\t\t\t\t\tif (isset($pathParts) && !empty($prefType)) {\r\n\t\t\t\t\t\tif (!array_key_exists($pathParts[0], $this->{$prefType}) && array_key_exists($pathParts[0], $config['ns'])) {\r\n\t\t\t\t\t\t\t$this->{$prefType}[$pathParts[0]] = $config['ns'][$pathParts[0]];\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tif (isset($config['prepend']) && array_key_exists($pathParts[0], $config['prepend'])) {\r\n\t\t\t\t\t\t\t$this->prepend[$pathParts[0]] = $config['prepend'][$pathParts[0]];\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\t$scheme = (isset($rules['scheme'])) ? $rules['scheme'] : NULL;\r\n\r\n\t\t\t\t\tif (isset($rules['value'])) {\r\n\t\t\t\t\t\t$data = $rules['value'];\r\n\t\t\t\t\t} elseif (isset($rules['action']) && method_exists($this, $rules['action'])) {\r\n\t\t\t\t\t\t$action = $rules['action'];\r\n\t\t\t\t\t\t$data = (in_array($action, array('getCreated', 'getModified', 'getExpires'))) ? $this->$action($config['dateFormat']) : $this->$action();\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tcontinue;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (!empty($data)) {\r\n\t\t\t\t\t\tif (is_array($data)) {\r\n\t\t\t\t\t\t\tif (isset($rules['multiple']) && !empty($rules['multiple'])) {\r\n\t\t\t\t\t\t\t\tforeach ($data as $part) {\r\n\t\t\t\t\t\t\t\t\t$this->addTag($config['tagName'], $config['type'], $tag, $part, $scheme);\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\t$this->addTag($config['tagName'], $config['type'], $tag, $data[0], $scheme);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t$this->addTag($config['tagName'], $config['type'], $tag, $data, $scheme);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}",
"function save_listing_category_custom_meta( $term_id ) {\n\n\tif ( isset( $_POST['listing_cat_meta'] ) ) {\n\t\t$t_id = $term_id;\n\t\t$listing_cat_meta = get_option( \"taxonomy_listing_category_$t_id\" );\n\t\t$cat_keys = array_keys( $_POST['listing_cat_meta'] );\n\t\tforeach ( $cat_keys as $key ) {\n\t\t\tif ( isset ( $_POST['listing_cat_meta'][$key] ) ) {\n\t\t\t\t$listing_cat_meta[$key] = $_POST['listing_cat_meta'][$key];\n\t\t\t}\n\t\t}\n\t\t// Save the option array.\n\t\tupdate_option( \"taxonomy_listing_category_$t_id\", $listing_cat_meta );\n\t}\n}",
"function business_register_taxonomy_for_images() {\n register_taxonomy_for_object_type( 'category', 'attachment' );\n\tregister_taxonomy_for_object_type( 'content_type', 'attachment' );\n}",
"public function upload_file(){\n\t\t$file_title = explode(\"/\",$_GET['url']);\n\t\t$file_name = end($file_title);\n\n\t\t$my_file = $_GET['url'];\n\t\t$handle = fopen($my_file, 'r');\n\t\t$read_file = fread($handle,filesize($my_file));\n\n\t\t$upload_url = \"https://pod-000-1126-02.backblaze.com/b2api/v2/b2_upload_file/d184771c8d50b17b65ba0618/c002_v0001126_t0048\"; \n\t\t$upload_auth_token = \"4_002147cd01b5a680000000000_018d4c4a_2690fb_upld_YoK-yBz17Mj5QQS60UQ1bVwRtXw=\";\n\t\t$bucket_id = \"d184771c8d50b17b65ba0618\"; \n\t\t$content_type = \"text/plain\";\n\t\t$sha1_of_file_data = sha1_file($my_file);\n\n\t\t$session = curl_init($upload_url);\n\n\t\tcurl_setopt($session, CURLOPT_POSTFIELDS, $read_file); \n\n\t\t$headers = array();\n\t\t$headers[] = \"Authorization: \" . $upload_auth_token;\n\t\t$headers[] = \"X-Bz-File-Name: \" . $file_name;\n\t\t$headers[] = \"Content-Type: \" . $content_type;\n\t\t$headers[] = \"X-Bz-Content-Sha1: \" . $sha1_of_file_data;\n\t\tcurl_setopt($session, CURLOPT_HTTPHEADER, $headers); \n\n\t\tcurl_setopt($session, CURLOPT_POST, true); \n\t\tcurl_setopt($session, CURLOPT_RETURNTRANSFER, true); \n\t\t$server_output = curl_exec($session); \n\t\tcurl_close ($session); \n\t\techo ($server_output); \n\t}",
"function install_plugins_upload()\n {\n }",
"function save_taxonomy_custom_meta( $term_id ) {\nif ( isset( $_POST['term_meta'] ) ) {\n $t_id = $term_id;\n $term_meta = get_option( \"taxonomy_$t_id\" );\n $cat_keys = array_keys( $_POST['term_meta'] );\n foreach ( $cat_keys as $key ) {\n if ( isset ( $_POST['term_meta'][$key] ) ) {\n $term_meta[$key] = $_POST['term_meta'][$key];\n }\n }\n // Save the option array.\n update_option( \"taxonomy_$t_id\", $term_meta );\n}\n}"
] |
[
"0.62898403",
"0.5477373",
"0.5421682",
"0.5395334",
"0.53821117",
"0.5373292",
"0.53524554",
"0.53524554",
"0.5293885",
"0.5286057",
"0.523496",
"0.5172265",
"0.5166557",
"0.5148455",
"0.51372945",
"0.51276684",
"0.5094197",
"0.5067924",
"0.50587994",
"0.50527865",
"0.5035656",
"0.503133",
"0.5023254",
"0.49975815",
"0.49939167",
"0.4988592",
"0.49876806",
"0.4982437",
"0.49739116",
"0.495923"
] |
0.68987983
|
0
|
===================================================================================================================================== Script to show keywords for edit_category.php by taking the 's through long_description and pulling them from their and echoing them on the page.JC
|
function h_keywords($cat_id){
connect();
$cp_id = clean_input($cat_id);
//
if(!empty($_GET['cat_id'])){
$xyquery = "SELECT cat_desc_long FROM categories WHERE cat_id = '$cp_id'";
$xyresult = mysql_query($xyquery) or die(mysql_error());
list($cat_desc_long)= mysql_fetch_row($xyresult);
}
$heading = $cat_desc_long;
$heading2 = explode('<h2>',$heading);
$heading2 = explode('</h2>', $heading2[1]);
if(!empty($heading2[0])) echo ",".$heading2[0];
$heading = $cat_desc_long;
$heading3 = explode('<h1>',$heading);
$heading3 = explode('</h1>', $heading3[1]);
if(!empty($heading3[0])) echo ",".$heading3[0];
$heading = $cat_desc_long;
$heading4 = explode('<h3>',$heading);
$heading4 = explode('</h3>', $heading4[1]);
if(!empty($heading4[0])) echo ",".$heading4[0];
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function keywords_and_description($submit_keywords, $keywords, $seo_desc){\n\t\tif( isset($_POST[$submit_keywords]) ){\n\t\t\t$key_words = $_POST[$keywords];\n\t\t\t$short_desc = $_POST[$seo_desc]; \n\t\t\tuser::update_key_words($key_words, $short_desc);\n\n\t\t\t\theader(\"location: ../../basic_info.php\");\n\t\t}\n\t}",
"public function add_keywords ( $new_keywords )\r\n\t\t{\r\n\t\t\r\n\t\t\t$this->errno = DB_OK;\r\n\r\n\t\t\tif ( $this->cat_id == -1 )\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t//\tSuch category hasn't been created\r\n\t\t\t{\r\n\t\t\t\t$this->errno = WRONG_ID;\r\n\t\t\t\treturn ;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tif ( ! ( $result = $this->con->query( \"SELECT cat_keywords FROM category WHERE cat_id=$this->cat_id\" ) ) )\r\n\t\t\t{\r\n\t\t\t\t$this->errno = MYSQL_ERROR;\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t//\tFailed to connect\t\r\n\t\t\t\treturn ;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tif ( $result->num_rows == 1 )\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t//\tas the id is unique one row should have been returned\r\n\t\t\t{\r\n\t\t\t\t$row = $result->fetch_row();\r\n\t\t\t\t$kw = $row[0];\r\n\t\t\t}\t\t\t\t\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\t$this->errno = MYSQL_ERROR;\r\n\t\t\t\treturn ;\r\n\t\t\t}\t\t\t\r\n\t\t\t\r\n\t\t\t/* gathering all keywords into one variable with # as delimiter to insert it to the database */\r\n\t\t\t$kw_length = 0; \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t//\tinitialize with 0 in case the keywords array hasn't been set\r\n\t\r\n\t\t\tif ( isset ( $new_keywords ) )\r\n\t\t\t\t$kw_length = count( $new_keywords );\r\n\r\n\t\t\tif ( $kw_length == 0 )\r\n\t\t\t{\r\n\t\t\t\t$this->errno = WRONG_INPUT;\r\n\t\t\t\treturn ;\t\t\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tfor ( $i = 0; $i < $kw_length; $i++ )\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t//\tgenerating the keyword string which will enter to the database\r\n\t\t\t\t$kw = $kw.\"#\".$new_keywords[$i];\t\t\t\r\n\t\t\t\r\n\t\t\tif( !$this->con->query( \"UPDATE category SET cat_keywords=\\\"$kw\\\" WHERE cat_id=$this->cat_id;\" ) )\t\t\t\r\n\t\t\t{\r\n\t\t\t\t$this->errno = MYSQL_ERROR;\t\t\t\t\t\r\n\t\t\t\treturn ;\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t//\tFailed to query\t\t\t\t\r\n\t\t\t}\r\n\r\n\t\t\t$this->cat_keywords = NULL;\r\n\t\t\t\r\n\t\t\t$tok = strtok( $kw, \"#\" );\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t//\tturning the keywords string into an array\r\n\t\t\t\r\n\t\t\twhile ( $tok !== false ) \r\n\t\t\t{\r\n\t\t\t\t$this->cat_keywords [] = $tok;\r\n\t\t\t\t$tok = strtok( \"#\" );\r\n\t\t\t}\t\t\t\r\n\t\r\n\t\t}",
"function edit_category() {\r\n\r\n\tif(isset($_POST['editcategory'])){\r\n\r\n\t\t$cat_id\t\t\t\t= clean_input($_GET['cat_id']);\r\n\t\t$cat_name \t\t\t= clean_input($_POST['cat_name']);\r\n\t\t$cat_desc_short \t= clean_input($_POST['cat_desc_short']);\r\n\t\t$cat_desc_long \t\t= clean_input($_POST['cat_desc_long']);\r\n\t\t$cat_parent_id \t\t= clean_input($_POST['cat_parent_id']);\r\n\t\t$cat_url \t\t\t= clean_input($_POST['cat_url']);\r\n\t\t$cat_date \t\t\t= clean_input($_POST['cat_date']);\r\n\t\t$cat_mod \t\t\t= clean_input($_POST['cat_mod']);\r\n\t\t$page_template \t\t= clean_input($_POST['page_template']);\r\n\t\t$cat_mod_by \t\t= clean_input($_SESSION['userid']);\r\n\t\t$cat_meta_title \t\t\t= clean_input($_POST['cat_meta_title']);\r\n\t\t$cat_meta_keywords \t\t\t= clean_input($_POST['cat_meta_keywords']);\r\n\t\t$cat_meta_description \t\t= clean_input($_POST['cat_meta_description']);\r\n\t\t$insert_keywords\t \t\t= clean_input($_POST['insert_keywords']);\t\t\t\r\n\r\n\t\t$xyquery = \"UPDATE categories SET \";\r\n\t\t$xyquery .= \"cat_name = '$cat_name',\";\r\n\t\t$xyquery .= \"cat_desc_short = '$cat_desc_short'\";\r\n\t\t$xyquery .= \",cat_desc_long = '$cat_desc_long'\";\r\n\t\t$xyquery .= \",cat_parent_id = '$cat_parent_id'\";\r\n\t\t$xyquery .= \",cat_url = '$cat_url'\";\r\n\t\t$xyquery .= \",cat_mod = '$cat_mod'\";\r\n\t\t$xyquery .= \",cat_mod_by = '$cat_mod_by'\";\r\n\t\t$xyquery .= \",page_template = '$page_template'\";\r\n\t\t$xyquery .= \",cat_meta_title = '$cat_meta_title'\";\r\n\t\t$xyquery .= \",cat_meta_keywords = '$cat_meta_keywords'\";\r\n\t\t$xyquery .= \",cat_meta_description = '$cat_meta_description'\";\r\n\t\t$xyquery .= \",insert_keywords = '$insert_keywords'\";\t\t\t\t\r\n\t\t$xyquery .= \"WHERE cat_id = '$cat_id'\";\r\n\r\n\t\t$xyresult = mysql_query($xyquery) or die(mysql_error());\r\n\r\n\t\t//echo \"<center><h4>The category \".$cat_name.\" been edited!</h4></center>\";\r\n?>\r\n<script>\r\n$(document).ready(function() {\r\n\t$(\"<p>NOTICE:</p><p>The category <?= $cat_name;?> has been modified.</p>\").appendTo(\"#xyalert\");\r\n\t$(\"#xyalert\").fadeIn(200).delay(1500).fadeOut(200);\r\n});\r\n</script>\r\n<?\r\n\t\treturn $xyresult;\r\n\t}\r\n}",
"function ccontent_search()\n\t{\n\t\t$post_data = linput_post();\n\t\t$table = llang_table('content');\n\t\t$cols = array('body', 'name');\n\t\t$keywords = $post_data['keywords'];\n\n\t\tif (strlen($keywords) >= 3)\n\t\t{\n\t\t\t$data['content'] = lcrud_search($table, $cols, $keywords, 'AND `published`=\\'1\\' ORDER BY `updated` DESC');\n\n\t\t\tfor ($i = 0; $i < count($data['content']); $i++)\n\t\t\t{\n\t\t\t\t$data['content'][$i]['title'] = $data['content'][$i]['name'];\n\t\t\t\t$data['content'][$i]['link'] = mcategories_read_path($data['content'][$i]['link'], false);\n\t\t\t}\n\n\t\t\tif (!count($data['content'])) hmessage_set(l('No results.'));\n\n\t\t\tlloader_load_view('search', $data);\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$data['content'] = array();\n\t\t\thmessage_set(l('Keyword must be at least 3 characters long'));\n\t\t\tlloader_load_view('search', $data);\n\t\t}\n\t}",
"protected function getKeywordsExample()\n {\n return '<p><b>' . __('Example') . '</b><p><p>[name][, {color} color][, {size} measurements||size][, {category}] <p>' . __('will be transformed into') . '<br>\n <p>CN Clogs Beach/Garden Clog, Blue color, 10 size, Shoes';\n }",
"function dp_meta_keywords() {\n\t$keywords = '';\n\n\tif ( is_singular() && !is_preview() ) {\n\t\t$post = get_queried_object();\n\t\t$taxonomies = get_object_taxonomies( $post->post_type );\n\t\tif ( is_array( $taxonomies ) ) {\n\t\t\tforeach ( $taxonomies as $tax ) {\n\t\t\t\tif ( $terms = get_the_term_list( get_queried_object_id(), $tax, '', ', ', '' ) )\n\t\t\t\t\t$keywords[] = $terms;\n\t\t\t}\n\t\t\tif ( !empty( $keywords ) )\n\t\t\t\t$keywords = join( ', ', $keywords );\n\t\t}\n\t}\n\n\tif(!empty($keywords))\n\t\t$keywords = '<meta name=\"keywords\" content=\"' . esc_attr( strip_tags( $keywords ) ) . '\" />' . \"\\n\";\n\n\techo apply_filters( 'dp_meta_keywords', $keywords );\n}",
"function Show_Search_Category($search_sql,$tot_cnt)\n\t\t{\n\t\t \tglobal $ecom_siteid,$db,$ecom_hostname,$Settings_arr,$ecom_themeid,$default_layout,$Captions_arr,$search_prodperpage,$quick_search,$head_keywords,$row_desc,$inlineSiteComponents;\n\t\t\tif(in_array('mod_catimage',$inlineSiteComponents))\n\t\t\t{\n\t\t\t\t$img_support = true;\n\t\t\t}\n\t\t\telse\n\t\t\t\t$img_support = false;\n\t\t\t\n\t\t\t$Captions_arr['SEARCH'] \t= getCaptions('SEARCH');\n\t\t\t//Default settings for the search\n\t\t\t$catsort_by\t\t\t\t\t= ($_REQUEST['searchcat_sortby'])?$_REQUEST['searchcat_sortby']:'category_name';\n\t\t \t$catperpage\t\t\t\t\t= ($_REQUEST['searchcat_perpage'])?$_REQUEST['searchcat_perpage']:$Settings_arr['product_maxcntperpage_search'];// product per page\n\t\t\t$catsort_order\t\t\t\t= ($_REQUEST['searchcat_sortorder'])?$_REQUEST['searchcat_sortorder']:$Settings_arr['product_orderby_search'];\n\t\t\t\n\t\t\t $query_string = \"&\";\n\t\t $search_fields = array('quick_search');\n\t\t\t\tforeach($search_fields as $v) {\n\t\t\t\t\t$query_string .= \"$v=\".$_REQUEST[$v].\"&\";#For passing searh terms to javascript for passing to different pages.\n\t\t\t\t}\n\t\t\t$first_querystring=$query_string; //Assigning the initial string to the variable.\n\t\t\t\t\t\t$pg_variable\t= 'search_pg';\n\t\t\t\t\t\tif($_REQUEST['top_submit_Page'] || $_REQUEST['bottom_submit_Page'] )\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t $_REQUEST[$pg_variable] = 0;\n\t\t\t\t\t\t\t}\n\t\t\t\t if ($_REQUEST['req']!='')// LIMIT for products is applied only if not displayed in home page\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$start_var \t\t= prepare_paging($_REQUEST[$pg_variable],$catperpage,$tot_cnt);\n\t\t\t\t\t\t}\t\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\t$Limit = '';\n\t\t\t\t\t\t\t$querystring = \"\"; // if any additional query string required specify it over here\n\t\t\t\t\t\t\t$Limit\t\t\t= \" ORDER BY $catsort_by $catsort_order LIMIT \".$start_var['startrec'].\", \".$catperpage;\n\t\t\t\t\t\t\t//echo $search_sql.$Limit;\n\t\t\t\t\t\t\t$ret_search = $db->query($search_sql.$Limit);\n\t\t\t\t\t\t\tif ($db->num_rows($ret_search))\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t ?>\n\t\t\t\t\t\t\t\t\t\t<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" class=\"shelfBtable\">\n\t\t\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t\t\t\t<td colspan=\"3\" class=\"treemenu\" align=\"left\"><a href=\"<? url_link('');?>\"><?=$Captions_arr['COMMON']['TREE_MENU_HOME_LINK'];?></a><? if($_REQUEST['quick_search']!=\"\"){?> >> <? echo $_REQUEST['quick_search']; } ?> </td>\n\t\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t\t<td colspan=\"3\" align=\"left\" valign=\"top\" class=\"shelfAheader_A\">\n\t\t\t\t\t\t\t\t\t\t<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" class=\"productpagenavtable\">\n\t\t\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t\t\t\t<td width=\"63%\" height=\"30\" align=\"right\" valign=\"middle\" class=\"productpagenavtext\" colspan=\"2\"><?php echo $Captions_arr['SEARCH']['SEARCH_SORT']?>\n\t\t\t\t\t\t\t\t\t\t\t\t <select name=\"searchcat_sortbytop\" id=\"searchcat_sortbytop\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t<option value=\"category_name\" <?php echo ($catsort_by=='category_name')?'selected=\"selected\"':''?>><?php echo $Captions_arr['SEARCH']['SEARCH_CAT_NAME']?></option>\n\t\t\t\t\t\t\t\t\t\t\t\t </select>\n\t\t\t\t\t\t\t\t\t\t\t\t <select name=\"searchcat_sortordertop\" id=\"searchcat_sortordertop\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t<option value=\"ASC\" <?php echo ($catsort_order=='ASC')?'selected=\"selected\"':''?>><?php echo $Captions_arr['SEARCH']['SEARCH_LOW2HIGH']?></option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<option value=\"DESC\" <?php echo ($catsort_order=='DESC')?'selected=\"selected\"':''?>><?php echo $Captions_arr['SEARCH']['SEARCH_HIGH2LOW']?></option>\n\t\t\t\t\t\t\t\t\t\t\t\t </select></td>\n\t\t\t\t\t\t\t\t\t\t\t\t<td width=\"37%\" align=\"right\" valign=\"middle\" class=\"productpagenavtext\"><?php echo $Captions_arr['SEARCH']['SEARCH_ITEMS'] ?>\n\t\t\t\t\t\t\t\t\t\t\t\t<select name=\"searchcat_prodperpagetop\" id=\"searchcat_prodperpagetop\">\n\t\t\t\t\t\t\t\t\t\t\t\t<?php\n\t\t\t\t\t\t\t\t\t\t\t\t\tfor ($ii=$Settings_arr[\"productlist_interval\"];$ii<=$Settings_arr[\"productlist_maxval\"];$ii+=$Settings_arr[\"productlist_interval\"])\n\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t?>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<option value=\"<?php echo $ii?>\" <?php echo ($catperpage==$ii)?'selected=\"selected\"':''?>><?php echo $ii?></option>\n\t\t\t\t\t\t\t\t\t\t\t\t<?php\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t?>\n\t\t\t\t\t\t\t\t\t\t\t\t</select>\n\t\t\t\t\t\t\t\t\t\t\t\t<input type=\"submit\" name=\"top_submit_Page\" value=\"<?php echo $Captions_arr['SEARCH']['SEARCH_GO'];?>\" class=\"buttonred\" onclick=\"handle_searchcatdropdownval_sel('<?php echo $ecom_hostname?>','searchcat_sortbytop','searchcat_sortordertop','searchcat_prodperpagetop')\" />\n\t\t\t\t\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t\t</table>\n\t\t\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t\t<?php\n\t\t\t\t\t\t\t\t\t\tif($cur_title)\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t?>\n\t\t\t\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t\t\t\t<td colspan=\"3\" class=\"shelfAheader\" align=\"left\"><?php echo $cur_title?></td>\n\t\t\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t\t<?php\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tif ($tot_cnt>0 and ($_REQUEST['req']!=''))\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\tif($_REQUEST['search_prodperpage']!=9999)\n\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t?>\n\t\t\t\t\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<td colspan=\"3\" class=\"pagingcontainertd\" align=\"center\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t<?php\n\t\t\t\t\t\t\t\t\t\t\t\t\t \t$query_string =$first_querystring;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t$path = '';\n\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t$query_string .= \"searchcat_sortby=\".$catsort_by.\"&searchcat_sortorder=\".$catsort_order.\"&searchcat_perpage=\".$catperpage.\"&pos=top&rdo_mainoption=cat&cbo_keyword_look_option=\".$_REQUEST['cbo_keyword_look_option'].'&rdo_suboption='.$_REQUEST['rdo_suboption'];\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tpaging_footer($path,$query_string,$tot_cnt,$start_var['pg'],$start_var['pages'],'',$pg_variable,'Categories',$pageclass_arr); \t\n\t\t\t\t\t\t\t\t\t\t\t\t\t?>\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t\t\t<?php\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t$pass_type = 'image_iconpath';\n\t\t\t\t\t\t\t\t\t\t\twhile ($row_search = $db->fetch_array($ret_search))\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t?>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<tr onmouseover=\"this.className='normalshelf_hover'\" onmouseout=\"this.className='shelfBtabletd'\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<td align=\"left\" valign=\"middle\" class=\"shelfBtabletd\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<?php \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tif($row_search['category_showimagetype']!='None' && ($img_support)) // ** Show sub category image only if catimage module is there for the site subcategoreynamelink\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t ?>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<a href=\"<?php url_category($row_search['category_id'],$row_search['category_name'],-1)?>\" title=\"<?php echo stripslashes($row_search['category_name'])?>\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t <?php\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tif ($row_search['category_showimageofproduct']==0) // Case to check for images directly assigned to category\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// Calling the function to get the image to be shown\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$img_arr = get_imagelist('prodcat',$row_search['category_id'],$pass_type,0,0,1);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tif(count($img_arr))\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tshow_image(url_root_image($img_arr[0][$pass_type],1),$row_search['category_name'],$row_search['category_name']);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$show_noimage = false;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$show_noimage = true;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\telse // Case of check for the first available image of any of the products under this category\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// Calling the function to get the id of products under current category with image assigned to it\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$cur_prodid = find_AnyProductWithImageUnderCategory($row_search['category_id']);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tif ($cur_prodid)// case if any product with image assigned to it under current category exists\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// Calling the function to get the image to be shown\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$img_arr = get_imagelist('prod',$cur_prodid,$pass_type,0,0,1);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tif(count($img_arr))\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tshow_image(url_root_image($img_arr[0][$pass_type],1),$row_search['category_name'],$row_search['category_name']);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$show_noimage = false;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\telse \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$show_noimage = true;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\telse// case if no products exists under current category with image assigned to it\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$show_noimage = true;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// ** Following section makes the decision whether the no image is to be displayed\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tif ($show_noimage)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// calling the function to get the default no image \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$no_img = get_noimage('prodcat',$pass_type); \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tif ($no_img)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tshow_image($no_img,$row_search['category_name'],$row_search['category_name']);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t?>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t <?php\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t ?>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"shelfBprodname\"><a href=\"<?php url_category($row_search['category_id'],$row_search['category_name'],-1)?>\" title=\"<?php echo stripslashes($row_search['category_name'])?>\"><?php echo stripslashes($row_search['category_name'])?></a></span>\n\t\t\t\t\t\t\t\t\t\t\t\t\t </td>\n\t\t\t\t\t\t\t\t\t\t\t\t\t <td colspan=\"2\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t <h6 class=\"shelfBproddes\"><?php echo stripslashes($row_search['category_shortdescription'])?></h6>\n\t\t\t\t\t\t\t\t\t\t\t\t\t </td>\n\t\t\t\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t\t\t\t<?php\n\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tif ($tot_cnt>0 and ($_REQUEST['req']!=''))\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t?>\n\t\t\t\t\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<td colspan=\"3\" class=\"pagingcontainertd\" align=\"center\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t<?php \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t$path = '';\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t $query_string =$first_querystring;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t$query_string .= \"searchcat_sortby=\".$catsort_by.\"&searchcat_sortorder=\".$catsort_order.\"&searchcat_perpage=\".$catperpage.\"&pos=top&rdo_mainoption=cat&cbo_keyword_look_option=\".$_REQUEST['cbo_keyword_look_option'].'&rdo_suboption='.$_REQUEST['rdo_suboption'];\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tpaging_footer($path,$query_string,$tot_cnt,$start_var['pg'],$start_var['pages'],'',$pg_variable,'Categories',$pageclass_arr); \t\n\t\t\t\t\t\t\t\t\t\t\t\t\t?>\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t\t\t<?php\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t?>\t\n\t\t\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t\t<td colspan=\"3\" align=\"left\" valign=\"top\" class=\"shelfAheader_A\">\n\t\t\t\t\t\t\t\t\t\t<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" class=\"productpagenavtable\">\n\t\t\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t\t\t\t<td width=\"63%\" height=\"30\" align=\"right\" valign=\"middle\" class=\"productpagenavtext\" colspan=\"2\"><?php echo $Captions_arr['SEARCH']['SEARCH_SORT']?>\n\t\t\t\t\t\t\t\t\t\t\t\t <select name=\"searchcat_sortbybottom\" id=\"searchcat_sortbybottom\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t<option value=\"category_name\" <?php echo ($catsort_by=='category_name')?'selected=\"selected\"':''?>><?php echo $Captions_arr['SEARCH']['SEARCH_CAT_NAME']?></option>\n\t\t\t\t\t\t\t\t\t\t\t\t </select>\n\t\t\t\t\t\t\t\t\t\t\t\t <select name=\"searchcat_sortorderbottom\" id=\"searchcat_sortorderbottom\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t<option value=\"ASC\" <?php echo ($catsort_order=='ASC')?'selected=\"selected\"':''?>><?php echo $Captions_arr['SEARCH']['SEARCH_LOW2HIGH']?></option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<option value=\"DESC\" <?php echo ($catsort_order=='DESC')?'selected=\"selected\"':''?>><?php echo $Captions_arr['SEARCH']['SEARCH_HIGH2LOW']?></option>\n\t\t\t\t\t\t\t\t\t\t\t\t </select></td>\n\t\t\t\t\t\t\t\t\t\t\t\t<td width=\"37%\" align=\"right\" valign=\"middle\" class=\"productpagenavtext\"><?php echo $Captions_arr['SEARCH']['SEARCH_ITEMS'] ?>\n\t\t\t\t\t\t\t\t\t\t\t\t<select name=\"searchcat_prodperpagebottom\" id=\"searchcat_prodperpagebottom\">\n\t\t\t\t\t\t\t\t\t\t\t\t<?php\n\t\t\t\t\t\t\t\t\t\t\t\t\tfor ($ii=$Settings_arr[\"productlist_interval\"];$ii<=$Settings_arr[\"productlist_maxval\"];$ii+=$Settings_arr[\"productlist_interval\"])\n\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t?>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<option value=\"<?php echo $ii?>\" <?php echo ($catperpage==$ii)?'selected=\"selected\"':''?>><?php echo $ii?></option>\n\t\t\t\t\t\t\t\t\t\t\t\t<?php\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t?>\n\t\t\t\t\t\t\t\t\t\t\t\t</select>\n\t\t\t\t\t\t\t\t\t\t\t\t<input type=\"button\" name=\"bottom_submit_Page\" value=\"<?php echo $Captions_arr['SEARCH']['SEARCH_GO']?>\" class=\"buttonred\" onclick=\"handle_searchcatdropdownval_sel('<?php echo $ecom_hostname?>','searchcat_sortbybottom','searchcat_sortorderbottom','searchcat_prodperpagebottom')\" />\n\t\t\t\t\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t\t</table>\n\t\t\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t\t</table>\n\t\t\t\t\t\t\t\t\t\t<?\n\t\t\t\t\t\t\t}\n\t\t}",
"static function metabox_to_deal_keywords($post){\t\t \t\n\t\t\tinclude self::get_script_location('metabox-for-product.php', 'admin');\t\t \t\n\t\t }",
"function readMoreWord($story_desc, $title='',$C_word='') {\n $chars = 90;\n if(!empty($C_word)){\n $chars =$C_word;\n }\n \n $count_word = strlen($story_desc);\n if($count_word>$chars){\n $readMore = '<a class=\"charaViewPopupModel\" data-title=\"'.$title.'\" data-word=\"'.$story_desc.'\" href=\"javascript:;\"> ....</a>';\n \t $story_desc = substr($story_desc,0,$chars); \n \t $story_desc = substr($story_desc,0,strrpos($story_desc,' ')); \n \t $story_desc = $story_desc.' '.$readMore; \n \t return $story_desc; \n \t \n }else{\n return $story_desc; \n }\n }",
"private function retrieve_category_description() {\n\t\treturn $this->retrieve_term_description();\n\t}",
"function categoryShow($sql, $sqlTags, $str='', $rCatName='', $catDesc=''){\n\n\t#requested data\n\t$rCatID = (int)$_GET['tID'];\n\t$rCatName = test_input($_GET['categoryName']);\n\n\n\t$sqlCat = \"SELECT CatID, CatTitle, CatType, CatSort, CatDescription, CatVisible FROM ma_Categories WHERE CatID = {$rCatID};\";\n\n\t$result = mysqli_query(IDB::conn(),$sqlCat) or die(trigger_error(mysqli_error(IDB::conn()), E_USER_ERROR));\n\tif (mysqli_num_rows($result) > 0)//at least one record!\n\t{//show results\n\t\t#External formatting here...\n\t\twhile ($row = mysqli_fetch_assoc($result))\n\t\t{//dbOut() function is a 'wrapper' designed to strip slashes, etc. of data leaving db\n\t\t\t$catDesc = dbOut($row['CatDescription']);\n\t\t}\n\t\t#closing formating here...\n\t}else{//no records\n\t\t\t$catDesc = '<p>Category description not given</p>';\n\t}\n\n\t@mysqli_free_result($result); //free resources\n\n\n\t$str .= '<!-- start general content -->\n\t<div class=\"col-md-9 pull-right\">\n\t\t<h4><strong>' . $rCatName . '</strong> Most Recent Postings </h4>\n\n\t\t<p>' . nl2br($catDesc) . '</p>\n\n\t\t<div class=\"bs-example\">\n\t\t\t<div class=\"panel-group\" id=\"accordion\">';\n\n\t\t\t#reference images for pager\n\t\t\t$prev = '<span class=\"glyphicon glyphicon-backward\"></span>';\n\t\t\t$next = '<span class=\"glyphicon glyphicon-forward\"></span>';\n\n\t\t\t# Create instance of new 'pager' class\n\t\t\t$myPager = new Pager(10,'',$prev,$next,'');\n\t\t\t$sql = $myPager->loadSQL($sql); #load SQL, add offset\n\n\t\t\t# connection comes first in mysqli (improved) function\n\t\t\t$result = mysqli_query(IDB::conn(),$sql) or die(trigger_error(mysqli_error(IDB::conn()), E_USER_ERROR));\n\t\t\tif (mysqli_num_rows($result) > 0)//at least one record!\n\t\t\t{//show results\n\n\t\t\t\tif($myPager->showTotal()==1){$itemz = \"thread\";}else{$itemz = \"threads\";} //deal with plural\n\n\t\t\t\t$str .= '<div align=\"center\">' . $myPager->showTotal() . ' ' . $itemz . ' currently available.</div>';\n\n\t\t\t\twhile($row = mysqli_fetch_assoc($result))\n\t\t\t\t{# process each row\n\n\t\t\t\t\t$tID \t\t\t\t= (int)$row['ThreadID'];\n\t\t\t\t\t$catID \t= (int)$row['CatID'];\n\n\t\t\t\t\t#if category matches selected category show\n\t\t\t\t\tif($catID == $rCatID){\n\n\t\t\t\t\t\t$str .= '<div class=\"panel panel-default\">\n\t\t\t\t\t\t<div class=\"panel-heading\">\n\t\t\t\t\t\t\t<h4 class=\"panel-title\">\n\n\t\t\t\t\t\t\t\t<a data-toggle=\"collapse\" data-parent=\"#accordion\" href=\"#collapse-' . $tID . '\"> ' . $row['ThreadTitle'] . ' </a>\n\n\t\t\t\t\t\t\t\t<a class=\"pull-right\" href=\"'. THIS_PAGE . '?act=threadShow&tID=' . $tID . '\"> <small>Go To Thread <span class=\"glyphicon glyphicon-share\"></span></small></i></a>\n\t\t\t\t\t\t\t</h4>\n\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t<div id=\"collapse-' . $tID . '\" class=\"panel-collapse collapse\">\n\t\t\t\t\t\t\t<div class=\"panel-body\">\n\t\t\t\t\t\t\t\t<p>'. $row['ThreadSummary'] . '</p>\n\t\t\t\t\t\t\t\t<p>';\n\n\t\t\t\t\t\t\t\t#set ground work for tags\n\t\t\t\t\t\t\t\t$threadTag \t= $row['ThreadTag'];\n\t\t\t\t\t\t\t\t$arrTags \t\t= explode(',', $threadTag);\n\t\t\t\t\t\t\t\t$arrNames \t= get_tNames($sqlTags);\n\n\t\t\t\t\t\t\t\t#dumpDie($arrTags);\n\n\t\t\t\t\t\t\t\t#if we have tags show them\n\t\t\t\t\t\t\t\tif ((isset($threadTag)) && (!empty($threadTag))){\n\t\t\t\t\t\t\t\t\t//$str .= '';\n\n\t\t\t\t\t\t\t\t\t$x = 0;\n\t\t\t\t\t\t\t\t\t$tot = count($arrTags);\n\n\t\t\t\t\t\t\t\t\t#make links, comma seperated\n\t\t\t\t\t\t\t\t\tforeach($arrTags as $key => $value)\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t$str .= '<a href=\"../characters/profile.php?CodeName=CodeName&tID=' . $value . '\">' . $arrNames[$value] . '</a>, ';\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t\t\t$str .= '<span class=\"text-muted\"><span class=\"glyphicon glyphicon-tag\"></span> No Tags Currently Set</span>';\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t$str .= '</p>\n\t\t\t\t\t\t\t\t<p><a class=\"pull-right\" href=\"'. THIS_PAGE . '?act=threadShow&tID=' . $tID . '\"> <span class=\"glyphicon glyphicon-share\"></span> Go To Thread</i></a></p>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>';\n\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t@mysqli_free_result($result); //free resources\n\n\t\t\t$str .= $myPager->showNAV(); # show paging nav, only if enough records\n\n\t\t\t$str .= '</div>';\n\n\t\t}else{#no records\n\t\t\t$str .= \"<div align=center>There are currently no active threads for $rCatName. Drats!!<br />\n\t\t\tWe should really do something about that soon.</div>\";\n\t\t}\n\n\t$str .='</div><!-- end accordian -->';\n\n\n\n\t#http://localhost/WrDKv4/threads/index.php?act=threadAdd\n\n\n#BUTTONS begin -- Add Thread -- Edit Thread -- Delete Category\n\n\n\n\nif(startSession() && isset($_SESSION['UserID'])){\n\t$priv = $_SESSION['Privilege'];\n\n\t#ADD new thread\n\t$str .= '<div >';\n\n\n\t$str .= '<a href=\"' . THIS_PAGE . '?act=threadAdd&catID=' . $rCatID . '&catName=' . formatUrl($rCatName) . '\" class=\"btn btn-info btn-xs\" role=\"button\"><span class=\"glyphicon glyphicon-plus\" title=\"Add New Thread To ' . $rCatName . '\"></span> Add New Thread To ' . $rCatName . '</a>';\n\n\n\t#mod or better...\n\tif( $priv >= 3){\n\n\t\t$str .= '<a href=\"' . THIS_PAGE . '?act=categoryEdit&id=' . $rCatID . '&categoryName=' . formatUrl($rCatName) . '\" class=\"btn btn-info btn-xs pull-right\" role=\"button\"><span class=\"glyphicon glyphicon-edit\" title=\"Edit ' . formatUrl($rCatName) . '\"></span> ' . $rCatName . ' Catagory</a>';\n\t}\n\t$str .= '</div><!-- END Buttons -->';\n}\n\n\treturn $str;\n\t#BUTTONS end\n}",
"function ct_critic_update_yoast_og_description( $ogdesc ) {\n\t$read_more_text = get_theme_mod( 'read_more_text' );\n\tif ( empty( $read_more_text ) ) {\n\t\t$read_more_text = __( 'Continue reading', 'critic' );\n\t}\n\t$ogdesc = substr( $ogdesc, 0, strpos( $ogdesc, $read_more_text ) );\n\n\treturn $ogdesc;\n}",
"public function keyword_details(){\n\t\t\t\n\t\t\t//escaping the post values\n\t\t\t$this->input->post(NULL, TRUE); // returns all POST items with XSS filter\n\t\t\t\t\n\t\t\t//escaping the post values\n\t\t\t$kid = html_escape($this->input->post('id'));\n\t\t\t$id = preg_replace('#[^0-9]#i', '', $kid); // filter everything but numbers\n\t\t\t\n\t\t\t$detail = $this->db->select('*')->from('keywords')->where('id',$id)->get()->row();\n\t\t\t\n\t\t\tif($detail){\n\t\t\t\t\t\n\t\t\t\t\t$data['id'] = $detail->id;\n\t\t\t\t\t\n\t\t\t\t\t$data['headerTitle'] = ucwords($detail->keyword);\t\t\t\n\n\t\t\t\t\t$data['keyword'] = $detail->keyword;\n\t\t\t\t\t$data['icon'] = $detail->icon;\n\t\t\t\t\t\n\t\t\t\t\t$data['model'] = 'keywords';\n\t\t\t\t\t$data['success'] = true;\n\n\t\t\t}else {\n\t\t\t\t$data['success'] = false;\n\t\t\t}\n\t\t\techo json_encode($data);\n\t\t}",
"function dfcg_help_desc() {\n?>\n\t<h3><?php _e( 'Dynamic Content Gallery - Quick Help - Descriptions', DFCG_DOMAIN ); ?></h3>\n\t\n\t<p><?php _e( 'The Description is the text which appears below the post/Page title in the gallery Slide Pane.</p>\n\t<p>Four different options for creating the description are available: two \"auto\" options, one \"manual\" option, and one option to disable the description altogether.', DFCG_DOMAIN ); ?></p>\n\t\n\t<p><?php _e( 'If you want total control over the text, check the <span class=\"bold-italic\">Manual</span> option and enter the descriptions in the in-post DCG Metabox for each post/Page. This option also allows you to set up a fallback description which will be displayed if a DCG Metabox description does not exist.', DFCG_DOMAIN ); ?></p>\n\t\n\t<p><?php _e( 'The recommended \"auto\" option is <span class=\"bold-italic\">Auto</span>. This automatically creates a description from the post/Page content and allows you to specify the length of the description and customise its Read More link.', DFCG_DOMAIN ); ?></p>\n\t\n\t<p><?php _e( 'The alternative \"auto\" option is the <span class=\"bold-italic\">Excerpt</span> option. This will display the post/Page Excerpt - either the handcrafted one if it exists, or an automatic Excerpt of the first 55 words of the post/Page. Bear in mind using an automatic Excerpt will probably result in too much text for the Slide Pane, though this can be dealt with by using the WordPress excerpt filter. You can learn more about this filter <a href=\"http://www.studiograsshopper.ch/code-snippets/customising-the_excerpt/\" target=\"_blank\">here</a>.', DFCG_DOMAIN ); ?></p>\n\n<?php\n}",
"public function custom_category_description_editor() {\n\t\twp_editor( '', 'description' );\n\t}",
"function getDescription() {\n\t\treturn __('plugins.block.keywordCloud.description');\n\t}",
"public function swc_homepage_product_categories_description() {\n\t\t$description = get_theme_mod( 'swc_homepage_category_description', '' );\n\n\t\tif ( '' !== $description ) {\n\t\t\techo '<div class=\"swc-section-description\">' . wpautop( wptexturize( $description ) ) . '</div>';\n\t\t}\n\t}",
"private function default_keywords() {\n\t\t// Default keywords.\n\t\techo WPSEO_News_Wrappers::textinput( 'default_keywords', __( 'Default Keywords', 'wordpress-seo-news' ) );\n\t\techo '<p class=\"desc label\">' . sprintf(\n\t\t\t/* translators: %1$s opening tag of the link to the Google suggested keywords page, %2$s closing tag for the link. */\n\t\t\t__( 'It might be wise to add some of the %1$sGoogle\\'s suggested keywords%2$s to all of your posts. Add them as a comma separated list.', 'wordpress-seo-news' ),\n\t\t\t'<a target=\"_blank\" href=\"http://www.google.com/support/news_pub/bin/answer.py?answer=116037\">',\n\t\t\t'</a>'\n\t\t) . '</p>';\n\n\t\techo WPSEO_News_Wrappers::checkbox( 'restrict_sitemap_featured_img', __( 'Only use the featured image for your News Sitemap, ignore images in post.', 'wordpress-seo-news' ), false );\n\t\techo '<br>';\n\t}",
"function arras_document_description() {\n\tif ( class_exists('All_in_One_SEO_Pack') || class_exists('Platinum_SEO_Pack') ) return false;\n\t\n\tif ( is_single() || is_page() ) {\n\t\tif ( have_posts() ) {\n\t\t\twhile( have_posts() ) {\n\t\t\t\tthe_post();\n\t\t\t\techo '<meta name=\"description\" content=\"' . get_the_excerpt() . '\" />';\n\t\t\t}\n\t\t}\n\t} else {\n\t\techo '<meta name=\"description\" content=\"' . get_bloginfo('description') . '\" />';\n\t}\n}",
"function charity_create_description() {\n\t\t$content = '';\n\t\tif (charity_seo()) {\n \t\tif (is_single() || is_page() ) {\n \t\t if ( have_posts() ) {\n \t\t while ( have_posts() ) {\n \t\t the_post();\n\t\t\t\t\t\t\t\t\t\tif (charity_the_excerpt() == \"\") {\n \t\tif (charity_use_autoexcerpt()) {\n \t\t$content =\"\\t\";\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t$content .= \"<meta name=\\\"description\\\" content=\\\"\";\n \t\t$content .= charity_excerpt_rss();\n \t\t$content .= \"\\\" />\";\n \t\t$content .= \"\\n\\n\";\n \t\t}\n \t\t} else {\n \t\tif (charity_use_excerpt()) {\n \t\t$content =\"\\t\";\n \t\t$content .= \"<meta name=\\\"description\\\" content=\\\"\";\n \t\t$content .= charity_the_excerpt();\n \t\t$content .= \"\\\" />\";\n \t\t$content .= \"\\n\\n\";\n \t\t}\n \t\t}\n \t\t}\n \t\t}\n \t\t} elseif ( is_home() || is_front_page() ) {\n \t\t$content =\"\\t\";\n \t\t$content .= \"<meta name=\\\"description\\\" content=\\\"\";\n \t\t$content .= get_bloginfo('description');\n \t\t$content .= \"\\\" />\";\n \t\t$content .= \"\\n\\n\";\n \t\t}\n \t\techo apply_filters ('charity_create_description', $content);\n\t\t}\n}",
"function product_category_edit(){\n\t\tglobal $tpl, $config, $meta, $_r, $_l, $_u, $fs;\n\t\t\n\t\t$data = $_r['data'];\n\t\t$data['id'] = $_r['id'];\n\t\t\n\t\tif($data['save'] || $data['apply']){\n\t\t\tif(!$data['title']) $error['title'] = true;\n\t\t\tif(count($error)==0){\n\t\t\t\t$set = array();\n\t\t\t\t$set[] = \"title = '\".add_slash($data['title']).\"'\";\n\t\t\t\t$set[] = \"language_id = '1'\";\n\t\t\t\t$set[] = \"category_id = '0'\";\n\t\t\t\t\n\t\t\t\t$set = implode(', ', $set);\n\t\t\t\tif($data['id']){\n\t\t\t\t\tmysql_q(\"UPDATE product_category SET $set WHERE id = '\".add_slash($data['id']).\"'\");\n\t\t\t\t} else {\n\t\t\t\t\t$data['id'] = mysql_q(\"INSERT INTO product_category SET $set\");\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif($data['save']){\n\t\t\t\t\tredirect(\"product_category.htm\", \"\");\n\t\t\t\t} else{\n\t\t\t\t\tredirect(\"product_category-edit-\".$data['id'].\".htm\", \"\");\n\t\t\t\t}\n\t\t\t}\n\t\t} else if($data['cancel']) {\n\t\t\tredirect(\"product_category.htm\", \"\");\n\t\t}\n\n\t\t$fields = \"\n\t\t[hidden name='id']\n\t\t[input name='title' label='Category Title' error='Please Enter Category Title']\n\t\t[sac class='']\n\t\t\";\n\t\t\n\t\tif(!$data['save'] && $data['id']){\n\t\t\t$data = mysql_q(\"SELECT * FROM product_category WHERE id='\".add_slash($data['id']).\"'\", \"single\");\n\t\t}\n\n\t\t$tpl->assign(\"data\", $data);\n\t\t\n\t\t$form = new form();\n\t\t$form->add($fields);\n\t\t$tpl->assign(\"form1\", $form->build());\n\t\t\n\t\t$main['content'] = $tpl->fetch(\"admin_product_category_edit.tpl\");\n\t\tdisplay($main);\n\t}",
"function display_phlagpage($keyword) {\n\n $title = yourls_get_keyword_title( $keyword );\n $url = yourls_get_keyword_longurl( $keyword );\n $base = YOURLS_SITE;\n\t$img = yourls_plugin_url( dirname( __FILE__ ).'/assets/caution.png' );\n\t$css = yourls_plugin_url( dirname( __FILE__ ).'/assets/bootstrap.min.css');\n\n\t$vars = array();\n\t\t$vars['keyword'] = $keyword;\n\t\t$vars['title'] = $title;\n\t\t$vars['url'] = $url;\n\t\t$vars['base'] = $base;\n\t\t$vars['img'] = $img;\n\t\t$vars['css'] = $css;\n\n\t$intercept = file_get_contents( dirname( __FILE__ ) . '/assets/intercept.php' );\n\t// Replace all %stuff% in the intercept with variable $stuff\n\t$intercept = preg_replace_callback( '/%([^%]+)?%/', function( $match ) use( $vars ) { return $vars[ $match[1] ]; }, $intercept );\n\n\techo $intercept;\n\n\tdie();\n}",
"function quasar_get_post_loop_description(){\n\tglobal $post;\n\tif(!$post) return;\n\t\n\t$summary_choice = xr_get_option('post_summary','content');//or excerpt;\n\t\n\t$return = '';\n\t\n\tif($summary_choice === 'content'){\n\t\t$return = quasar_get_the_content();\n\t}elseif($summary_choice === 'excerpt'){\n\t\t$return = rock_check_p(get_the_excerpt());\n\t\t$return .= quasar_get_read_more_link();\n\t}\n\t\n\treturn $return;\n}",
"public function KemiSitemap_description()\n {\n echo '<p>Kemi Sitemap Description</p>';\n }",
"function show_categories($sub_action, $id){\r\n global $sql, $rs, $ns, $aj;\r\n $text = \"<div style='border : solid 1px #000; padding : 4px; width :auto; height : 200px; overflow : auto; '>\\n\";\r\n if($category_total = $sql -> db_Select(\"link_category\")){\r\n $text .= \"<table class='fborder' style='width:100%'>\r\n <tr>\r\n <td style='width:5%' class='forumheader2'> </td>\r\n <td style='width:75%' class='forumheader2'>\".LCLAN_59.\"</td>\r\n <td style='width:20%; text-align:center' class='forumheader2'>\".LCLAN_60.\"</td>\r\n </tr>\";\r\n while($row = $sql -> db_Fetch()){\r\n extract($row);\r\n\r\n $text .= \"<tr>\r\n <td style='width:5%; text-align:center' class='forumheader3'>\".($link_category_icon ? \"<img src='\".e_IMAGE.\"link_icons/$link_category_icon' alt='' style='vertical-align:middle' />\" : \" \").\"</td>\r\n <td style='width:75%' class='forumheader3'>$link_category_name<br /><span class='smalltext'>$link_category_description</span></td>\r\n <td style='width:20%; text-align:center' class='forumheader3'>\r\n \".$rs -> form_button(\"submit\", \"category_edit_{$link_category_id}\", LCLAN_9, \"onclick=\\\"document.location='\".e_SELF.\"?cat.edit.$link_category_id'\\\"\").\"\r\n\r\n \".$rs -> form_open(\"post\", e_SELF,\"\",\"\",\"\",\" onsubmit=\\\"return confirm_('cat',$link_category_id)\\\"\").\"\r\n \".$rs -> form_button(\"submit\", \"category_delete_{$link_category_id}\", LCLAN_10).\"\r\n \".$rs -> form_close().\"\r\n\r\n </td>\r\n </tr>\\n\";\r\n }\r\n// \".$rs -> form_button(\"submit\", \"category_delete_{$link_category_id}\", LCLAN_10, \"onclick=\\\"confirm_('cat', '$link_category_id');\\\"\").\"\r\n $text .= \"</table>\";\r\n }else{\r\n $text .= \"<div style='text-align:center'>\".LCLAN_69.\"</div>\";\r\n }\r\n $text .= \"</div>\";\r\n $ns -> tablerender(LCLAN_70, $text);\r\n\r\n unset($link_category_name, $link_category_description, $link_category_icon);\r\n\r\n $handle=opendir(e_IMAGE.\"link_icons\");\r\n while ($file = readdir($handle)){\r\n if($file != \".\" && $file != \"..\"){\r\n $iconlist[] = $file;\r\n }\r\n }\r\n closedir($handle);\r\n\r\n if($sub_action == \"edit\"){\r\n if($sql -> db_Select(\"link_category\", \"*\", \"link_category_id ='$id' \")){\r\n $row = $sql -> db_Fetch(); extract($row);\r\n }\r\n }\r\n\r\n $text = \"<div style='text-align:center'>\r\n \".$rs -> form_open(\"post\", e_SELF.\"?cat\", \"linkform\").\"\r\n <table class='fborder' style='width:auto'>\r\n <tr>\r\n <td class='forumheader3' style='width:30%'><span class='defaulttext'>\".LCLAN_71.\"</span></td>\r\n <td class='forumheader3' style='width:70%'>\".$rs -> form_text(\"link_category_name\", 50, $link_category_name, 200).\"</td>\r\n </tr>\r\n <tr>\r\n <td class='forumheader3' style='width:30%'><span class='defaulttext'>\".LCLAN_72.\"</span></td>\r\n <td class='forumheader3' style='width:70%'>\".$rs -> form_text(\"link_category_description\", 60, $link_category_description, 200).\"</td>\r\n </tr>\r\n <tr>\r\n <td class='forumheader3' style='width:30%'><span class='defaulttext'>\".LCLAN_73.\"</span></td>\r\n <td class='forumheader3' style='width:70%'>\r\n \".$rs -> form_text(\"link_category_icon\", 60, $link_category_icon, 100).\"\r\n <br />\r\n <input class='button' type ='button' style='cursor:hand' size='30' value='\".LCLAN_80.\"' onclick='expandit(this)' />\r\n <div style='display:none'>\";\r\n while(list($key, $icon) = each($iconlist)){\r\n $text .= \"<a href='javascript:addtext2(\\\"$icon\\\")'><img src='\".e_IMAGE.\"link_icons/\".$icon.\"' style='border:0' alt='' /></a> \";\r\n }\r\n $text .= \"</div></td>\r\n </tr>\r\n\r\n <tr><td colspan='2' style='text-align:center' class='forumheader'>\";\r\n if($id){\r\n $text .= \"<input class='button' type='submit' name='update_category' value='\".LCLAN_74.\"'>\r\n \".$rs -> form_button(\"submit\", \"category_clear\", LCLAN_81).\r\n $rs -> form_hidden(\"link_category_id\", $id).\"\r\n </td></tr>\";\r\n }else{\r\n $text .= \"<input class='button' type='submit' name='create_category' value='\".LCLAN_75.\"' /></td></tr>\";\r\n }\r\n $text .= \"</table>\r\n \".$rs -> form_close().\"\r\n </div>\";\r\n\r\n $ns -> tablerender(LCLAN_75, $text);\r\n }",
"static function metabox_at_post_edit_page(){\n\t\t \tadd_meta_box('matebox-to-handle-keywords', 'Affiliate Keywords', array(get_class(), 'metabox_to_deal_keywords'), 'product', 'advanced', 'high');\t \t\n\t\t }",
"function GetKeyWords() {\n\t\t$lTitle = str_replace(\",\", \" \", str_replace(\", \", \" \", $this->m_pubdata['storytitle']));\n\t\t$lSubTitle = str_replace(\",\", \" \", str_replace(\", \", \" \", $this->m_pubdata['storysubtitle']));\n\t\t$lSupTitle = str_replace(\",\", \" \", str_replace(\", \", \" \", $this->m_pubdata['storysuptitle']));\n\t\t//~ $lDesc = str_replace(\",\", \" \", str_replace(\", \", \" \", $this->m_pubdata['description']));\n\t\t$lTmpSTr = ($lTitle ? \", \" . $lTitle : \"\") . ($lSubTitle ? \", \" . $lSubTitle : \"\") . ($lSupTitle ? \", \" . $lSupTitle : \"\") . ($lDesc ? \", \" . $lDesc : \"\") . ($this->m_pubdata['keywordsnaked'] ? \", \" . $this->m_pubdata['keywordsnaked'] : \"\");\n\t\t$lArr = split(' ', $lTmpSTr);\n\t\tforeach($lArr as $k) {\n\t\t\t$k = trim($k);\n\t\t\t$lRetStr .= $k . ' ';\n\t\t}\n\t\treturn $lRetStr;\n\t}",
"function mk_overview($myAction, $titles, $content, $cName, $cID, $cGen, $page, $str=''){ #format descriptions from array and\n\n\t#remove the dashes used for urls\n\t$title = str_replace('-', ' ', $myAction);\n\n\t$str = '<div class=\"container-fluid\">\n\t\t<div class=\"row content\">\n\t\t\t<div class=\"col-sm-3 sidenav\">\n\t\t\t<br />'\n\n\t\t#top sites banner / discord banner to vote for us\n\t\t. MTS_stacked($str='')\n\t\t. mk_customizerForm($cName, $cGen)\n\t\t. mk_legend($cName='', $titles, $cID=0, $cGen='', $page, $str='' );\n\n\t$str .= '<br />\n\t\t<div class=\"input-group class=\"col-sm-3\" >\n\t\t\t<input type=\"text\" class=\"form-control\" placeholder=\"Search To Come..\">\n\t\t\t<span class=\"input-group-btn\">\n\t\t\t\t<button class=\"btn btn-default\" type=\"button\">\n\t\t\t\t\t<span class=\"glyphicon glyphicon-search\"></span>\n\t\t\t\t</button>\n\t\t\t</span>\n\t\t</div>\n\t</div><!-- end sidebar-->\n\n\t<div class=\"col-sm-9\">\n\t\t<h2>' . ucwords($title) . '</h2>\n\t\t<h5><span class=\"glyphicon glyphicon-time\"></span> Post by Monkee, October 9, 2016.</h5>\n\t\t<h5><span class=\"label label-danger\">Advantages</span> <span class=\"label label-primary\">Character Creation</span></h5><br>';\n\n\t$str .= customizeData($content, $cGen, $cName, 'n');\n\n\t$str .= '<p><small>\n\t\t\t<em class=\"text-muted\"> <b>Note</b> - If you are logged in to ' . SITE_NAME . ', each entry shown below may already be personalized to reflect your character"s codename and gender. If not, then they are shown in a generic format, but you can still set them to reflect your characters gender and codename by using the customizer located just above the catagory legend. Doing so will will instantly then format all the descriptions to your specifications to help you on your way to building an awesome addition to the ' . SITE_NAME . ' universe.</em>\n\t\t</small></p>\n\t\t<hr />';\n\n\treturn $str;\n}",
"abstract function getKeywords();",
"function echo_term(\n $actcode, $showAll, $spanid, $hidetag, $currcharcount, $record, \n &$exprs = array()\n)\n{\n $actcode = (int)$record['Code'];\n if ($actcode > 1) {\n // A multiword, $actcode is the number of words composing it\n\t\tif (empty($exprs) || $exprs[sizeof($exprs)-1][1] != $record['TiText'])\n\t\t\t$exprs[] = array($actcode, $record['TiText'], $actcode);\n\n if (isset($record['WoID'])) {\n\n $attributes = array(\n\t\t\t\t'id' => $spanid,\n\t\t\t\t'class' => implode(\" \", [\n $hidetag, \"click\", \"mword\", ($showAll ? 'mwsty' : 'wsty'), \n \"order\" . $record['Ti2Order'],\n\t\t\t\t 'word' . $record['WoID'], 'status' . $record['WoStatus'], \n\t\t\t\t 'TERM' . strToClassName($record['TiTextLC'])]\n ),\n\t\t\t\t'data_pos' => $currcharcount,\n\t\t\t\t'data_order' => $record['Ti2Order'],\n\t\t\t\t'data_wid' => $record['WoID'],\n\t\t\t\t'data_trans' => tohtml(repl_tab_nl($record['WoTranslation']) . \n\t\t\t\tgetWordTagList($record['WoID'], ' ', 1, 0)),\n\t\t\t\t'data_rom' => tohtml($record['WoRomanization']),\n\t\t\t\t'data_status' => $record['WoStatus'],\n 'data_code' => $actcode,\n 'data_text' => tohtml($record['TiText'])\n );\n $span = '<span';\n foreach ($attributes as $attr_name => $val) {\n $span .= ' ' . $attr_name . '=\"' . $val . '\"';\n }\n $span .= '>'; \n if ($showAll) {\n $span .= $actcode;\n } else {\n $span .= tohtml($record['TiText']);\n }\n $span .= '</span>';\n echo $span;\n }\n } else {\n // Single word\n if (isset($record['WoID'])) {\n // Word found status 1-5|98|99\n\t\t\t$attributes = array(\n\t\t\t\t'id' => $spanid,\n\t\t\t\t'class' => implode(\" \", [\n $hidetag, \"click\", \"word\", \"wsty\", \"word\" . $record['WoID'],\n 'status' . $record['WoStatus'], \n 'TERM' . strToClassName($record['TiTextLC'])\n ]),\n\t\t\t\t'data_pos' => $currcharcount,\n\t\t\t\t'data_order' => $record['Ti2Order'],\n\t\t\t\t'data_wid' => $record['WoID'],\n\t\t\t\t'data_trans' => tohtml(repl_tab_nl($record['WoTranslation']) . \n\t\t\t\tgetWordTagList($record['WoID'], ' ', 1, 0)),\n\t\t\t\t'data_rom' => tohtml($record['WoRomanization']),\n\t\t\t\t'data_status' => $record['WoStatus']\n\t\t\t);\n } else {\n // Not registered word (status 0)\n\t\t\t$attributes = array(\n\t\t\t\t'id' => $spanid,\n\t\t\t\t'class' => implode(\" \", [\n $hidetag, \"click\", \"word\", \"wsty\", \"status0\", \n \"TERM\" . strToClassName($record['TiTextLC'])\n ]),\n\t\t\t\t'data_pos' => $currcharcount,\n\t\t\t\t'data_order' => $record['Ti2Order'],\n\t\t\t\t'data_trans' => '',\n\t\t\t\t'data_rom' => '',\n\t\t\t\t'data_status' => '0',\n\t\t\t\t'data_wid' => ''\n\t\t\t);\n }\n\t\tforeach ($exprs as $expr) {\n\t\t\t$attributes['data_mw' . $expr[0]] = tohtml($expr[1]);\n\t\t}\n $span = '<span';\n foreach ($attributes as $attr_name => $val) {\n $span .= ' ' . $attr_name . '=\"' . $val . '\"';\n\t\t}\n $span .= '>' . tohtml($record['TiText']) . '</span>';\n echo $span;\n\t\tfor ($i = sizeof($exprs) - 1; $i >= 0; $i--) {\n\t\t\t$exprs[$i][2]--;\n\t\t\tif ($exprs[$i][2] < 1) {\n\t\t\t\tunset($exprs[$i]);\n\t\t\t\t$exprs = array_values($exprs);\n\t\t\t}\n\t\t}\n }\n}"
] |
[
"0.6753122",
"0.6101297",
"0.5853824",
"0.58054376",
"0.57933336",
"0.57817376",
"0.5715765",
"0.57138956",
"0.5708326",
"0.5692844",
"0.56768507",
"0.5667813",
"0.5647166",
"0.56318337",
"0.56032556",
"0.5586414",
"0.55723566",
"0.55543685",
"0.553143",
"0.5517482",
"0.54197675",
"0.54138833",
"0.54040056",
"0.53993165",
"0.5393922",
"0.5360098",
"0.53331023",
"0.5331881",
"0.5323805",
"0.532004"
] |
0.7296867
|
0
|
Get the admin user currently the first user
|
public static function getAdminUser()
{
return User::find(1);
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function getAdminUser()\n {\n return $this->registry->registry('current_admin_user');\n }",
"public function getUser()\n {\n if ($this->_user === null) {\n $this->_user = Admin::findByUsernameOrEmail($this->username);\n }\n\n return $this->_user;\n }",
"function current_admin()\n {\n return admin_auth()->user();\n }",
"protected function loginAsAdminUser(): ?User\n {\n Auth::loginUsingId('7');\n return $this->getPresentUser();\n }",
"function getAdmin() {\n if (auth()->guard('staff')->check()) {\n // Check if the auth user is a staff => get the admin id\n $project_id = auth()->guard('staff')->user()->project_id;\n $project = App\\Models\\Project::where('id', $project_id)->first();\n // We already have a relationship between the User and the Project models\n $user = $project->user;\n } else {\n $user = auth()->user();\n }\n return $user;\n }",
"public static function getUser() {\n return self::$ADMIN_USER;\n }",
"public function getAdminAttribute()\n {\n return User::whereId($this->accountId)->first();\n }",
"protected function getUser()\n {\n return $this->loadUser(array(\n 'user_name' => $this->context['admin'],\n ));\n }",
"public function user()\n {\n return $this->app->auth->guard('admin')->user();\n }",
"function admin_user_id()\n {\n return Admin::app()->auth()->id();\n }",
"public static function adminUserId()\n {\n $getUserId = User::where('TenantId', Auth::user()->TenantId)->where('IsAdmin', 1)->first();\n return $getUserId->id;\n }",
"protected function loginAsSiteAdminUser(): ?User\n {\n Auth::loginUsingId('8');\n return $this->getPresentUser();\n }",
"public function getLoggedInUser()\n {\n $securityContext = $this->container->get('security.context');\n $consultant = $securityContext->getToken()->getUser();\n return $consultant;\n }",
"public function GetCurrentUser()\n {\n return $this->userManager->getCurrent();\n }",
"public static function get_user_logged_in(){\n if(isset($_SESSION['admin'])){\n $admin_id = $_SESSION['admin'];\n // Pyydetään Admin-mallilta käyttäjä session mukaisella id:llä\n $admin = Admin::find($admin_id);\n\n return $admin;\n }\n\n // Käyttäjä ei ole kirjautunut sisään\n return null;\n }",
"public function get_user() {\r\n\t\treturn ($this->user);\r\n\t}",
"public function adminUser(): ?AdminUser\n {\n return Auth::guard(config('kontour.guard'))->user();\n }",
"public function getLoggedInUser() {\n return $this->_user->getLoggedInUser();\n }",
"public function getLoggedUser() {\n\t\t$session = $this->getUserSession();\n\t\treturn ($this->isAdmin()) ? $session->getUser() : $session->getCustomer();\n\t}",
"function admin_user(): ?Authenticatable\n {\n return Admin::app()->user();\n }",
"public function getCurrentUser()\n\t{\n\t\treturn $this->users->getCurrentUser();\n\t}",
"function userAdmin( )\n {\n return $this->UserAdmin ;\n }",
"public function get_user() {\n\t\treturn $this->user;\n\t}",
"public function getAdmin()\n {\n $database = new Database();\n $loggedIn = $database->getAdminByUsername($_SESSION['user']);\n $admin = new Admin($loggedIn['adminId'], $loggedIn['username'], $loggedIn['adminLevel'], $loggedIn['active']);\n if(isset($_SESSION['user']) === true) {\n $this->_f3->set('admin', $admin);\n }\n }",
"public function me() {\n\t\t\tif (!isset($this->oUser)) $this->oUser = user($this->iUser); \n\t\t\treturn $this->oUser; \n\t\t}",
"public function _getCreatedByAdmin() {\n\t\treturn $this->_createdByAdmin;\n\t}",
"public static function current()\n {\n if (Yii::app()->user->isGuest)\n return null;\n\n if (!User::$current_user)\n User::$current_user = User::model()->findByPk(Yii::app()->user->getId());\n\n return User::$current_user;\n }",
"function get_user () {\n\t\treturn $this->user_id;\n\t}",
"function getLoggedInAdminId(){\r\n $query = \"SELECT * FROM admins WHERE email='\" . getSessionUsername() . \"';\";\r\n $result = performSingleDbQueryGetRow($query);\r\n return $result['id'];\r\n}",
"function getUser()\n\t\t{\n\t\t\tglobal $wpdb;\n\n\t\t\tif(!empty($this->user))\n\t\t\t\treturn $this->user;\n\n\t\t\t$gmt_offset = get_option('gmt_offset');\n\t\t\t$this->user = $wpdb->get_row(\"SELECT *, UNIX_TIMESTAMP(user_registered) + \" . ($gmt_offset * 3600) . \" as user_registered FROM $wpdb->users WHERE ID = '\" . $this->user_id . \"' LIMIT 1\");\n\t\t\treturn $this->user;\n\t\t}"
] |
[
"0.84018886",
"0.7727872",
"0.76227933",
"0.7606734",
"0.75470734",
"0.7527008",
"0.75168604",
"0.7466795",
"0.7459963",
"0.74101293",
"0.7361626",
"0.7313079",
"0.73081994",
"0.7253888",
"0.72390807",
"0.72266114",
"0.722531",
"0.7208659",
"0.7200034",
"0.71588975",
"0.71550775",
"0.7154027",
"0.71328825",
"0.71228796",
"0.7061432",
"0.70550174",
"0.7048834",
"0.70455956",
"0.70368457",
"0.7029486"
] |
0.8079319
|
1
|
Return User ID given the uid
|
public static function idByUID($uid=NULL)
{
if($uid!=NULL)
{
try
{
$count = User::where('uid', $uid)->count();
if($count > 0)
{
$user = User::where('uid', $uid)->orderBy('uid', 'asc')->first();
return $user->id;
}
else
{
return null;
}
}
catch (ModelNotFoundException $e)
{
Log::error("The user ` $uid ` does not exist: ". $e->getMessage());
//TODO: send email?
return null;
}
}
else
{
return null;
}
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function get_user_id();",
"public function getUserID() {\n\t\tif (is_numeric($this->user_id)) {\n\t\t\treturn $this->user_id;\n\t\t} else {\n\t\t\treturn 0;\n\t\t}\n\t}",
"public function user_id()\n {\n if($this->logged_in())\n {\n $this->uid = $this->fb->getUser();\n\n return $this->uid;\n } \n else \n {\n return FALSE;\n }\n }",
"protected static function getUserID()\r\n {\r\n $userID = \\CAT\\Helper\\Validate::sanitizePost('user_id','numeric');\r\n\r\n if(!$userID)\r\n $userID = \\CAT\\Helper\\Validate::sanitizeGet('user_id','numeric');\r\n\r\n if(!$userID)\r\n $userID = self::router()->getParam(-1);\r\n\r\n if(!$userID || !is_numeric($userID) || !\\CAT\\Helper\\Users::exists($userID))\r\n Base::printFatalError('Invalid data')\r\n . (self::$debug ? '(\\CAT\\Backend\\Users::getUserID())' : '');;\r\n\r\n return $userID;\r\n }",
"public function getuserId() : Uuid {\n\t\treturn($this->userId);\n\t}",
"public function getUid();",
"public function getUid();",
"public function get_uid() {\n return $this->uid;\n }",
"public function getCidFromUserId(int $uid): ?int\n {\n $user = DB::connection('moodle')->table('user')->where('id', $uid)->first();\n\n return $user->idnumber ?? null;\n }",
"public function getUserId()\n {\n $value = $this->get(self::user_id);\n return $value === null ? (integer)$value : $value;\n }",
"public function getUserID(){\n return($this->userID);\n }",
"public function getUid ();",
"public function getuid($idin=null) {\r\n\t\tif (!is_null($idin)) {\r\n\t\t\tif (is_string($idin)) {\r\n\t\t\t\t$field = ($this->validEmail($idin)) ? 'email' : 'username';\r\n\t\t\t\t$user = $this->db\r\n\t\t\t\t\t->select('user_id')\r\n\t\t\t\t\t->where($field, $idin)\r\n\t\t\t\t\t->get($this->user_table)\r\n\t\t\t\t\t->row();\r\n\t\t\t\treturn (isset($user->user_id)) ? $user->user_id : false;\r\n\t\t\t} elseif (is_int($idin)) {\r\n\t\t\t\treturn $idin;\r\n\t\t\t} else {\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\t$user_info = $this->decode_session_value(\r\n\t\t\t\t$this->session->userdata($this->sess_login_key)\r\n\t\t\t);\r\n\t\t\tif (is_array($user_info)) {\r\n\t\t\t\treturn ($user_info[0]);\r\n\t\t\t} else {\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t}\r\n\t}",
"public function getUserUid()\n {\n return $this->user_uid;\n }",
"public function getUserId()\n {\n return (int) $this->_getVar('user_id');\n }",
"public function get_uid($user)\n{\t\t\n\t$uname = $user->__get('uname');\n\t$con = connect();\n\t$q1 = mysqli_query($con, \"SELECT * FROM user WHERE Uname = '$uname'\");\n\t$res = mysqli_fetch_array($q1);\n\t$uid= $res['UId'];\n\treturn $uid;\n}",
"public function get_user_id( $context = 'view' ) {\n\t\treturn $this->get_prop( 'user_id', $context ) ;\n\t}",
"public function getUserID()\n {\n return $this->userID;\n }",
"public function getUserID()\n {\n return $this->userID;\n }",
"private function getuserid() {\n\n $user_security = $this->container->get('security.context');\n // authenticated REMEMBERED, FULLY will imply REMEMBERED (NON anonymous)\n if ($user_security->isGranted('IS_AUTHENTICATED_FULLY')) {\n $user = $this->get('security.context')->getToken()->getUser();\n $user_id = $user->getId();\n } else {\n $user_id = 0;\n }\n return $user_id;\n }",
"function user_getid($username = null)\n\t{\n\t\t$user = ($username == null) ? session_get('username') : $username;\n\t\t$get = $this->DB->database_select('users', 'uid', array('username' => $user), 1);\n\t\treturn ($get === false) ? false : $get['uid'];\n\t}",
"public function getUserId()\r\n\t{\r\n\t\t$user = parent::getUser();\r\n\t\tif(!($user instanceof User))\r\n\t\t{\r\n\t\t\treturn null;\r\n\t\t}\r\n\t\treturn $user->getId();\r\n\t}",
"public function getUid() {}",
"public function getUid() {}",
"public function getUid() {}",
"public function getUid() {}",
"public function getUid() {}",
"public function getUid() {}",
"public function getUid()\n {\n return $this->uid;\n }",
"public function getUid()\n {\n return $this->uid;\n }"
] |
[
"0.76118904",
"0.7504404",
"0.7483609",
"0.7463698",
"0.7408067",
"0.74007976",
"0.74007976",
"0.7382242",
"0.73641473",
"0.73273796",
"0.72995555",
"0.7286024",
"0.72808284",
"0.72765416",
"0.72366446",
"0.7208425",
"0.7203845",
"0.72033554",
"0.72033554",
"0.7191575",
"0.7179067",
"0.71432704",
"0.7112648",
"0.7111028",
"0.7111028",
"0.7111028",
"0.7111028",
"0.7110999",
"0.71077335",
"0.71077335"
] |
0.77616596
|
0
|
Check if user is County Coordinator
|
public function isCountyCoordinator()
{
if($this->hasRole('County Coordinator'))
return true;
else
return false;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function isSubCountyCoordinator()\n {\n if($this->hasRole('Sub-County Coordinator'))\n return true;\n else\n return false;\n }",
"public function isCoordinator()\n {\n return true;\n }",
"function isLocationowner(){\r\n\t\tif($this->user_type == 'LocationOwner'){\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\treturn false;\r\n\t}",
"public function authorize()\n {\n $user = Auth::user();\n $vendor = $user->vendor->first();\n $isOwner = AvailableFacility::where(array(\n 'id' => $this->id,\n 'vendor_id' => $vendor->id\n ))->count();\n if ($isOwner) {\n return true;\n } else {\n return false;\n }\n }",
"public function isOwner(): bool {\n $f3 = \\Base::instance();\n\n return $f3->get('CURRENT_USER') && !is_null($this->owner) && $f3->get('CURRENT_USER') === $this->owner->id;\n }",
"public function isOwner()\n {\n return (\\Auth::check() and \\Auth::user()->id == $this->id);\n }",
"private function isCoop() : bool\n {\n return $this->user->hasRole('coop');\n }",
"public function isOwner()\n {\n return $this->affiliation == self::AFFILIATION_OWNER;\n }",
"public function isCustomerUser() {\n\t\t\treturn $this->customerid != null && $this->customerid != 0;\n\t\t}",
"abstract function is_agency();",
"public function iscorpuser(Request $request)\n {\n $this->validate($request, [\n 'corp_id' => 'required|integer',\n ]);\n\n $success = false;\n\n if (!is_null(Auth::user()->corporateuser)) {\n if (Auth::user()->corporateuser->corporate->id == $request->corp_id) {\n $success = true;\n }\n }\n\n return response()->json(['success'=>$success]);\n }",
"public function isAccountant()\n {\n return (\\Auth::user()->role == 'accountant');\n }",
"public function dashboard_owner($user) {\n return $this->id === auth()->id();\n }",
"public function authorize()\n {\n return auth()->user() && auth()->user()->isCeo();\n }",
"public function hasUser();",
"public function authorize()\n {\n return $this->user('office')->isActive();\n }",
"public function hasDataAccessCommitteeMember() {\n return $this->_has(6);\n }",
"public function hasCity() {\n return $this->_has(2);\n }",
"public function getOwnAccountProperty()\n {\n return $this->staff->id == Auth::user()->id;\n }",
"function isOwner() {\n if($this->is_owner === null) {\n $company = $this->getCompany();\n $this->is_owner = instance_of($company, 'Company') ? $company->getIsOwner() : false;\n } // if\n return $this->is_owner;\n }",
"public function isOwned()\n {\n return Auth::user() && $this->recipient_id === Auth::id();\n }",
"function user_owns_tip($tip_id, $uname) {\n $sql = '\n SELECT EXISTS(\n SELECT\n id\n FROM\n tips\n WHERE\n id = ? AND author = ?\n )';\n \n $res = $this->prep_and_exec($sql, [$tip_id, $uname]);\n \n if (!$res) {\n return null;\n }\n \n return (bool) $res->fetch(PDO::FETCH_NUM)[0];\n }",
"public function authorize()\n {\n return is_client_or_staff();\n }",
"public function isUserClub()\n\t{\n\t\t$q = new BN_query('rights');\n\t\t$q->addTable('assocs', 'rght_themeid = asso_id');\n\t\t$q->addField('count(*)');\n\t\t$q->addWhere('rght_theme = ' . THEME_ASSOS);\n\t\t$q->addWhere(\"rght_status ='\" . AUTH_MANAGER . \"'\");\n\t\t$q->addWhere('rght_userid =' . Bn::getValue('user_id', -1));\n\t\t$nb = $q->getFirst();\n\t\treturn (Bn::getValue('user_type') == AUTH_ASSO || $nb);\n\t}",
"public function isstaff()\n {\n return $this->hasuser() && $this->user()->isstaff();\n }",
"private static function canAccess($request, $address){\n $currentUser_Account = $request->user;\n $user = $address->get_user();\n return ($user != null && $currentUser_Account->getId() === $user->getId()) || User_Precondition::ownerRequired($request);\n }",
"public function isEmployee()\n {\n return (\\Auth::user()->role == 'employee');\n }",
"public function getIsClientAttribute()\n {\n return $this->attributes['user_type'] == '2';\n }",
"public function authorize()\n {\n $internship = Internship::findOrFail($this->route('id'));\n $student = $internship->student;\n\n return $internship->state_id == State::CANCELED && $student->internship == null;\n }",
"public function authorize()\n {\n return Auth::check() && Auth::user()->is_contractor;\n }"
] |
[
"0.7535716",
"0.6053562",
"0.6044405",
"0.58115023",
"0.5796062",
"0.5751929",
"0.5730707",
"0.5690006",
"0.5671106",
"0.5658872",
"0.56588477",
"0.5642403",
"0.5589372",
"0.5577614",
"0.5566498",
"0.55545264",
"0.5549765",
"0.5530778",
"0.5524514",
"0.5519866",
"0.55149513",
"0.5510686",
"0.55073744",
"0.54894215",
"0.5488307",
"0.5485484",
"0.5464432",
"0.54621166",
"0.54589623",
"0.54556936"
] |
0.8210573
|
0
|
Check if user is SubCounty Coordinator
|
public function isSubCountyCoordinator()
{
if($this->hasRole('Sub-County Coordinator'))
return true;
else
return false;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function isCountyCoordinator()\n {\n if($this->hasRole('County Coordinator'))\n return true;\n else\n return false;\n }",
"public function authorize()\n {\n $user = Auth::user();\n $vendor = $user->vendor->first();\n $isOwner = AvailableFacility::where(array(\n 'id' => $this->id,\n 'vendor_id' => $vendor->id\n ))->count();\n if ($isOwner) {\n return true;\n } else {\n return false;\n }\n }",
"public function isUserClub()\n\t{\n\t\t$q = new BN_query('rights');\n\t\t$q->addTable('assocs', 'rght_themeid = asso_id');\n\t\t$q->addField('count(*)');\n\t\t$q->addWhere('rght_theme = ' . THEME_ASSOS);\n\t\t$q->addWhere(\"rght_status ='\" . AUTH_MANAGER . \"'\");\n\t\t$q->addWhere('rght_userid =' . Bn::getValue('user_id', -1));\n\t\t$nb = $q->getFirst();\n\t\treturn (Bn::getValue('user_type') == AUTH_ASSO || $nb);\n\t}",
"function wac_is_tenant($user=''){\n\t if ($user && !empty($user)) {\n\t\tif (!is_object($user)) {\n\t\t\t$user = new WP_User(absint($user));\n\t\t}\n\t\treturn (is_array($user->roles) && in_array('subscriber', $user->roles));\n\t} else {\n\t\treturn false;\n\t}\n}",
"public function hasDataAccessCommitteeMember() {\n return $this->_has(6);\n }",
"private function isCoop() : bool\n {\n return $this->user->hasRole('coop');\n }",
"public function hasActiveSubClass(): bool;",
"abstract function is_agency();",
"function isLocationowner(){\r\n\t\tif($this->user_type == 'LocationOwner'){\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\treturn false;\r\n\t}",
"public function canManageOwnSubdomain();",
"public function authorize()\n {\n $admin = Auth::user();\n\n if( $admin->isBranchAdmin() ){\n return false;\n }\n\n if( $admin->church_id != $this->church_id){\n return false;\n }\n\n return true;\n }",
"static function canAddGlobal(User $user) {\n\t\t if ($user instanceof Subcontractor || $user instanceof Client) {\n\t\t\t return false;\n\t\t } // if\n\n\t\t return parent::canAddGlobal($user);\n\t }",
"function _s_is_member() {\n\treturn current_user_can( 'read' ) ? true : false;\n}",
"public function isCoordinator()\n {\n return true;\n }",
"public function isMember()\n {\n return $this->affiliation != self::AFFILIATION_OUTCAST;\n }",
"public function isprojectsupervisor()\n {\n return $this->hasuser() && $this->user()->isprojectsupervisor();\n }",
"public function isSubscribedToCouncil(\\Aiden\\Models\\Councils $council) {\n\n return UsersCouncils::findFirst([\n \"conditions\" => \"users_id = :users_id: AND councils_id = :councils_id:\",\n \"bind\" => [\n \"users_id\" => $this->getId(),\n \"councils_id\" => $council->getId()\n ]\n ]) !== false;\n\n }",
"public function isUttMember()\n\t{\n\t\treturn $this->isUser() && ! $this->user->getIsStudent() && ! $this->user->getKeepActive();\n\t}",
"function canView($user) {\n if($this->isOwner()) {\n return true;\n } // if\n \n return in_array($this->getId(), $user->visibleCompanyIds());\n }",
"public function isCustomerIDEXist($username,$branch_id,$cusID)\n {\n $values=array($username,$branch_id,$cusID);\n \n $check=$this->getInfo(\"SELECT count(*) as nt FROM appointment WHERE username=? AND branch_id=? AND customer_id=?\",$values);\n\n return $check[0]['nt'];\n }",
"function wp_sub_user_exists_on_site( int $user_id, int $site_id ) : bool {\n\t$allowed = in_array( $site_id, get_user_meta( $user_id, \\WP_SUB\\WP_Separate_User_Base::SITE_META_KEY, false ) );\n\n\treturn apply_filters( 'wp_sub_user_exists_on_network', $allowed, $user_id, $site_id );\n}",
"function _is_staff()\n {\n $user = $this->visitor->get();\n\t\t//echo $user['ugrade'];\n\t\t//1.普通會員 2.VIP 3.Staff\n\t\tif($user['ugrade'] == 3){\n\t\t\treturn $user['ugrade'];\n\t\t}\n\t}",
"public function getOwnAccountProperty()\n {\n return $this->staff->id == Auth::user()->id;\n }",
"public function esSubordinado(Usuario $usuario):bool {\n if($this->getJefe()==$usuario)\n return true;\n if(null!=$this->getJefe())\n return $this->getJefe()->esSubordinado($usuario);\n\n return false;\n }",
"function cover_session_in_committee($committee) {\n return in_array(strtolower($committee), cover_session_get_committees());\n}",
"public static function canDisplaySuburbsMenu()\n\t{\n\t\treturn PermissionValidator::hasPermission(PermissionConstants::VIEW_SUBURB);\n\t}",
"public function isMember()\n {\n return $this->role == 3;\n }",
"public function hasAccess()\n\t{\n\t\t/* Check Permissions */\n\t\treturn \\IPS\\Member::loggedIn()->hasAcpRestriction( \"core\",\"members\" );\n\t}",
"function customerHasAccess() {\n\t\tswitch ($this->_mode) {\n\t\t\tcase WECF_OFF:\n\t\t\t\treturn true;\n\t\t\tcase WECF_ALL:\n\t\t\t\treturn weAbstractCustomerFilter::customerIsLogedIn();\n\t\t\tcase WECF_SPECIFIC:\n\t\t\t\tif (!weAbstractCustomerFilter::customerIsLogedIn()) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\treturn in_array($_SESSION[\"webuser\"][\"ID\"], $this->_specificCustomers);\n\t\t\tcase WECF_FILTER:\n\t\t\t\tif (!( isset($_SESSION) && isset($_SESSION[\"webuser\"]) && isset($_SESSION[\"webuser\"][\"ID\"]) )) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\treturn weAbstractCustomerFilter::customerHasFilterAccess();\n\t\t}\n\t\treturn false;\n\t}",
"public function dashboard_owner($user) {\n return $this->id === auth()->id();\n }"
] |
[
"0.7882251",
"0.5668685",
"0.5636365",
"0.5611596",
"0.5592822",
"0.55721277",
"0.55383396",
"0.5533039",
"0.5505834",
"0.54478776",
"0.54244983",
"0.54087293",
"0.5400777",
"0.53915703",
"0.5390536",
"0.53847206",
"0.5359399",
"0.53287935",
"0.53170514",
"0.5308279",
"0.5304748",
"0.5290183",
"0.52738535",
"0.5260125",
"0.5244794",
"0.52309906",
"0.52108085",
"0.52005357",
"0.51874405",
"0.5181686"
] |
0.8661962
|
0
|
Check if user is Facility Incharge
|
public function isFacilityInCharge()
{
if($this->hasRole('Facility Incharge'))
return true;
else
return false;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function is_surveillant() {\n return $this->session->get(\"niveau_acces\") >= 1;\n }",
"public function authorize()\n {\n $user = Auth::user();\n $vendor = $user->vendor->first();\n $isOwner = AvailableFacility::where(array(\n 'id' => $this->id,\n 'vendor_id' => $vendor->id\n ))->count();\n if ($isOwner) {\n return true;\n } else {\n return false;\n }\n }",
"public function has_user_fundraiser()\n {\n return ( ! empty( $this->get_user_fundraiser() ) );\n }",
"public function view(User $user, Facility $facility)\n {\n return \\Auth::guard('admin')->check();\n }",
"public function allowFaculty( $faculty_id ){\n $sql = \\dibi::query('SELECT Count(id) as Pocet FROM user_faculty\n WHERE user_id = %i and faculty_id = %i;',$this->user->getId(), $faculty_id );\n $count = $sql->fetchSingle();\n \n if( $count > 0 ){\n return true;\n }else{\n return false;\n } \n }",
"protected function isUserInvoiceImplemented(): bool\n {\n return (bool)$this->getUserInvoice()->implemented;\n }",
"public function authorize()\n // can access chef member who is 'logined' and 'chefprofile null === false'\n {\n $loginedUser = Auth::user();\n\n return $loginedUser->user_type === 'chef' && (\n\n is_null($loginedUser->chef) === false\n );\n }",
"public function isAuthorized($user) {\n\n\t\t//Only Field Officers can access these actions\n\t\tif ($this->Auth->user('user_category_id') == '2' ) {\n\t\t\tif (in_array($this->action, array('index', 'toinspect'))) {\n\t\t\t\treturn TRUE;\n\t\t\t}\n\t\t}\n\n\t // General: Only the person who entered a farmer's information can edit and/or delete it (REQUIRES: an eXtra parameter)\n\t\t// Specific: This checks if the action contains add, view, edit, delete or toInspect and performs check.\n\t if ( in_array($this->action, array('add', 'view', 'edit', 'delete')) ) {\n\n\t\t\tif ($this->action === 'add') {\n\t\t\t\t//Trying to obtain the information from the URL by accessing the 'passed' arguments from the Request Parameters\n\t\t\t\t$farmerId = $this->request->params['pass'][0];\t//'pass' stands for 'passed' arguments in URL\n\t\t\t\tif ($this->Production->User->isEnteredBy($farmerId, $user['id'])) {\treturn TRUE; }\n\t\t\t}\n\n\t\t\t$productionId = $this->request->params['pass'][0];\t//'pass' stands for 'passed' arguments in URL\n\t\t\t//Perform a check at Model level, to see if $production[id] was entered by logged-in user\n\t if ($this->Production->isEnteredBy($productionId, $user['id'])) {\n\t return true;\n\t }\n\n\t }//end if (in_array())\n\n\t}",
"function is_automattician( $user_id = false ) {\n\tif ( $user_id ) {\n\t\t$user = new WP_User( $user_id );\n\t} else {\n\t\t$user = wp_get_current_user();\n\t}\n\n\tif ( ! isset( $user->ID ) || ! $user->ID ) {\n\t\treturn false;\n\t}\n\n\t// Check that their address is an a8c one, *and* they have validated that address\n\tif ( ! class_exists( 'WPCOM_VIP_Support_User' ) ) {\n\t\treturn false;\n\t}\n\n\t// $vip_support = WPCOM_VIP_Support_User::init();\n\n\tif ( WPCOM_VIP_Support_User::is_verified_automattician( $user->ID ) ) {\n\t\treturn true;\n\t}\n\n\treturn false;\n}",
"public function isAuthorize(){\n $userPlan = $this->request->session()->get('userPlan');\n return ($userPlan >= 1)? true : abort(404) ;\n }",
"public function authorize()\n {\n $idExpense = $this->input('expense');\n $expense = Expense::find($idExpense);\n\n return $expense && $this->user()->id == $expense->user_id;\n }",
"public function hasExternalPI() {\r\n if(!$this->userIsPI && $this->principalInvestigatorId == 0) {\r\n return true;\r\n }\r\n return false;\r\n }",
"public function isMember()\n {\n return $this->affiliation != self::AFFILIATION_OUTCAST;\n }",
"function is_contest_visiable($cid) {\n if (is_contest_accessible($cid))\n return true;\n $contest = new ContestsTbl($cid);\n if (!$contest->Get())\n return false;\n\n if (!$contest->detail['avail']) {\n return false;\n }\n return $contest->detail['perm'] == 'user';\n}",
"function _is_staff()\n {\n $user = $this->visitor->get();\n\t\t//echo $user['ugrade'];\n\t\t//1.普通會員 2.VIP 3.Staff\n\t\tif($user['ugrade'] == 3){\n\t\t\treturn $user['ugrade'];\n\t\t}\n\t}",
"public function isAuthorized($user) {\n\n\t\t// All logged in users can view the list of farmers\n\t\tif ($this->action === 'index') {\n\t\t return true;\n\t\t}\n\n\t\t//This applies to logged in Field-Officers ONLY...\n\t\tif ($this->Auth->user('user_category_id') == '2' ) {\n\t\t\tif ($this->action === 'add') {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tif ($this->action === 'entered') {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t//Only the person who entered a farmer's information can view it (cannot edit/delete anymore)\n\t\t\tif ( in_array($this->action, array('view')) ) {\n\n\t\t\t\t//Trying to obtain the information from the URL by accessing the 'passed' arguments from the Request Parameters\n\t\t\t\t$farmerId = $this->request->params['pass'][0];\n\n\t\t\t\t//Perform a check at Model level, to see if $user[id] is authorized to access $farmerId\n\t\t\t\tif ($this->User->isEnteredBy($farmerId, $user['id'])) {\n\t\t\t\t return true;\n\t\t\t\t}\n\n\t\t\t}//end if (in_array($this->action, array('view', 'edit', 'delete')))\n\n\t\t}//if ($this->Auth->user('user_category_id') == '2' )\n\n\t\t//Checks if the currently logged in user is an Administrator\n\t\tif ($this->Auth->user('user_category_id') == '1') {\n\n\t\t\t//Allows the Administrator to only view farmer information\n\t\t\tif ( in_array($this->action, array('admin_view', 'report_by_group', 'report_by_officer')) ) {\n\t\t\t\t return true;\n\t\t\t}//end if (in_array($this->action, array('view')))\n\n\t\t}//if ($this->Auth->user('user_category_id') == '1')\n\n\t\treturn parent::isAuthorized($user);\n\n\t}",
"function cpc_is_featured( $userID, $featuredtype ){\n\tif( get_user_meta( $userID, 'active_membership_pack' ) == array( $featuredtype ) ){\n\t\treturn true;\n\t}\n\treturn false;\n}",
"public function userIsPI($userId) {\r\n if($this->principalInvestigatorId == $userId) {\r\n return true;\r\n }\r\n return false;\r\n }",
"public function has_access() { \n\n\t\tif (!Access::check('interface','25')) { \n\t\t\treturn false; \n\t\t} \n\t\tif ($this->user == $GLOBALS['user']->id) { \n\t\t\treturn true; \n\t\t} \n\t\telse {\n\t\t\treturn Access::check('interface','100'); \n\t\t} \t\n\n\t\treturn false; \n\n\t}",
"public function isUsable(){\n return ($this->isValid() && $this->isEnabled() && !$this->isDeleted());\n }",
"public function isEuRegistered();",
"public function hasMruPI() {\r\n if(!$this->userIsPI && $this->principalInvestigatorId > 0) {\r\n return true;\r\n }\r\n return false;\r\n }",
"function in_designation()\n {\n $haystack = func_get_args();\n $result = 0;\n\n if (Auth::user()->user_type == 'Employee'){\n $needle = Auth::user()->employee->designation->short_name;\n $result = in_array($needle, $haystack) ? 1 : 0;\n }\n\n return $result;\n }",
"function customerHasAccess() {\n\t\tswitch ($this->_mode) {\n\t\t\tcase WECF_OFF:\n\t\t\t\treturn true;\n\t\t\tcase WECF_ALL:\n\t\t\t\treturn weAbstractCustomerFilter::customerIsLogedIn();\n\t\t\tcase WECF_SPECIFIC:\n\t\t\t\tif (!weAbstractCustomerFilter::customerIsLogedIn()) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\treturn in_array($_SESSION[\"webuser\"][\"ID\"], $this->_specificCustomers);\n\t\t\tcase WECF_FILTER:\n\t\t\t\tif (!( isset($_SESSION) && isset($_SESSION[\"webuser\"]) && isset($_SESSION[\"webuser\"][\"ID\"]) )) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\treturn weAbstractCustomerFilter::customerHasFilterAccess();\n\t\t}\n\t\treturn false;\n\t}",
"public function isAuthorized($user)\n {\n if (parent::isAuthorized($user) === true) {\n return true;\n } else if ($user['actif'] != true) {\n // Les comptes non activés n'ont aucun droit\n return false;\n } else {\n // Tous les membres permanents ont tous les droits sur les thèses\n if ($user['permanent'] == 1) {\n return true;\n }\n }\n return false;\n }",
"public function isAuthorized($user, $request) {\n\t\tController::loadModel('Member');\n\n\t\tif ($this->Member->GroupsMember->isMemberInGroup( $this->Member->getIdForMember($user), Group::FULL_ACCESS )) {\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}",
"public function show(User $user, Formation $formation)\n {\n return $user->hasPermission('show-organization-formation');\n }",
"function is_guest_on_fangate(){\n\tglobal $gianism;\n\treturn $gianism->fb->is_guest_on_fangate();\n}",
"public function isUserClub()\n\t{\n\t\t$q = new BN_query('rights');\n\t\t$q->addTable('assocs', 'rght_themeid = asso_id');\n\t\t$q->addField('count(*)');\n\t\t$q->addWhere('rght_theme = ' . THEME_ASSOS);\n\t\t$q->addWhere(\"rght_status ='\" . AUTH_MANAGER . \"'\");\n\t\t$q->addWhere('rght_userid =' . Bn::getValue('user_id', -1));\n\t\t$nb = $q->getFirst();\n\t\treturn (Bn::getValue('user_type') == AUTH_ASSO || $nb);\n\t}",
"public function isAuthorized($user) {\n return $this->My->isAuthorizedPFRData($user, $this);\n }"
] |
[
"0.630462",
"0.6184805",
"0.5872232",
"0.5842067",
"0.575935",
"0.57426095",
"0.5719446",
"0.5679371",
"0.5669482",
"0.56660146",
"0.56546515",
"0.5571567",
"0.5567748",
"0.55671775",
"0.55530953",
"0.554833",
"0.55293983",
"0.54921997",
"0.5484075",
"0.5470004",
"0.54687905",
"0.5456027",
"0.54552394",
"0.54485774",
"0.5436686",
"0.5427872",
"0.5409003",
"0.53993386",
"0.53988135",
"0.5381722"
] |
0.8117545
|
0
|
Check if user is Participant
|
public function isParticipant()
{
if($this->hasRole('Participant'))
return true;
else
return false;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function isParticipant(UserInterface $user);",
"public function isParticipant(ParticipantInterface $participant): bool;",
"public function hasParticipant() {\n return $this->_has(1);\n }",
"public function isParticipating($id_user, $id_event) {\n \t//$participants = Participant::where('id_user', '=', $id_user, 'AND', 'id_event', '=', $id_event)->get();\n $participants = Participant::whereRaw('id_user =' . $id_user . ' and id_event=' . $id_event)->get();\n\n \treturn count($participants) >= 1;\n }",
"public function authorize()\n {\n if (session()->has('user'))\n {\n $participantController = new ParticipantController();\n\n return !$participantController->isParticipating($this->input('id_user'), $this->input('id_event'));\n }\n else\n {\n return false;\n }\n }",
"function getAuthenticatedParticipant();",
"public function isAssignee(UserInterface $user);",
"public function isUserPlayer()\n\t{\n\t\treturn (Bn::getValue('user_type') == 'P');\n\t}",
"public function is_course_participant($params) {\n global $DB;\n\n return $DB->record_exists_sql(\n \"SELECT ra.*\n FROM {context} cx\n JOIN {role_assignments} ra ON ra.userid = :userid AND\n ra.contextid = cx.id\n WHERE cx.instanceid = :courseid AND\n cx.contextlevel = :coursecontext\",\n [\n 'courseid' => $params['courseid'],\n 'coursecontext' => CONTEXT_COURSE,\n 'userid' => $params['userid'],\n ]\n );\n\n }",
"public function isParticipant($participant)\n {\n foreach ( $this->getParticipants() as $parti)\n {\n if ($parti === $participant)\n {\n return true;\n }\n }\n return false;\n }",
"public function getParticipant()\n {\n return $this->participant;\n }",
"public function getParticipant()\n {\n return $this->participant;\n }",
"public function getCreatedBy(): ?ParticipantInterface;",
"public function isOwnedBy(UserInterface $user);",
"public function setCreatedBy(ParticipantInterface $participant): self;",
"public function userIsProfessor($user_id){\n $user_temp = Users::find($user_id);\n return !empty($user_id) && $user_temp && $user_temp['type'] == 1;\n }",
"public function userIsProfessor($user_id){\n $user_temp = Users::find($user_id);\n return !empty($user_id) && $user_temp && $user_temp['type'] == 1;\n }",
"public static function isParticipant($user_id, $conversationId)\n {\n $sql = \"SELECT *\n FROM conversationParticipants\n WHERE user_id = $user_id AND conversation_id = $conversationId\n LIMIT 1\";\n\n $result = DB::select($sql);\n\n if($result->num_rows > 0) {\n return true;\n }\n\n return false;\n }",
"public function update(User $user, Participant $participant)\n {\n return $user->role === 2;\n }",
"public function delete(User $user, Participant $participant)\n {\n return $user->role === 2;\n }",
"public function isProposition()\n {\n $u = $this->user()->first();\n\n return auth()->user()->id != $u->id;\n }",
"function vitero_get_participants($viteroid) {\n return false;\n}",
"function etherpadlite_get_participants($etherpadliteid) {\n return false;\n}",
"public function isPartner()\n {\n if($this->hasRole('Partner'))\n return true;\n else\n return false;\n }",
"public function getParticipant()\n\t{\n\t\treturn $this->getContext()->getParticipant();\n\t}",
"function econsole_get_participants($econsoleid) {\r\n return false;\r\n}",
"function isLeader(User $user) {\n return $user instanceof User && $this->object->getLeaderId() == $user->getId();\n }",
"public function isPartner($id) {\n return DB::table('partners')->where('user_id', $id)->first();\n\n }",
"public function isMember()\n {\n return $this->role == 3;\n }",
"public function hasGotSupervisor($userid)\n {\n return is_object(R::findOne('finalchoice', 'user_id=? AND supervisor_id IS NOT NULL', [$userid]));\n }"
] |
[
"0.84697646",
"0.72232485",
"0.7168724",
"0.6786317",
"0.64915764",
"0.6464204",
"0.6382016",
"0.6237943",
"0.6220379",
"0.6180759",
"0.61654156",
"0.61654156",
"0.61565167",
"0.6146793",
"0.61284125",
"0.61182296",
"0.61182296",
"0.6090114",
"0.6076919",
"0.6066084",
"0.605827",
"0.602664",
"0.6025462",
"0.6017295",
"0.6000713",
"0.5988791",
"0.5942734",
"0.5940243",
"0.59377587",
"0.59179825"
] |
0.8032927
|
1
|
/ Register hook depending of the Prestashop version used
|
private function registerHookByVersion()
{
if (_PS_VERSION_ >= '1.3' &&
(!$this->registerHook('shipping') ||
!$this->registerHook('extraCarrier') ||
!$this->registerHook('updateCarrier') ||
!$this->registerHook('newOrder') ||
!$this->registerHook('BackOfficeHeader')))
return false;
if (_PS_VERSION_ >= '1.4' &&
(!$this->registerHook('processCarrier') ||
!$this->registerHook('orderDetail') ||
!$this->registerHook('orderDetailDisplayed')))
return false;
return true;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function hook();",
"private function public_hooks()\n\t{\n\t}",
"public function register_hooks() {\n\t\tadd_filter( 'pre_update_option_block_lab_license_key', array( $this, 'save_license_key' ) );\n\t}",
"public function replace_3rd_party_pugins_hooks(){\n }",
"public function add_hooks()\n {\n }",
"public function add_hooks()\n {\n }",
"public function init_hooks() {\n\t}",
"private function add_hooks_and_filters() {\n add_filter( 'slp_version_report_' . $this->addon->short_slug , array( $this , 'show_activated_modules' ) );\n }",
"private function define_admin_hooks()\n {\n $this->loader->add_action('init',$this,'load_options');\n $this->loader->add_action('plugins_loaded','WordPress_Reactro_Admin', 'load_framework');\n }",
"function cal_install()\n{\n register_hook('plugin_settings', 'addon/cal/cal.php', 'cal_addon_settings');\n register_hook('plugin_settings_post', 'addon/cal/cal.php', 'cal_addon_settings_post');\n}",
"public function install()\n {\n\n return parent::install() &&\n $this->registerHook('actionAdminControllerSetMedia') &&\n $this->registerHook('displayAdminProductsQuantitiesStepBottom') ;\n \n }",
"function add_support_script_frontend(){\n}",
"public function hook()\n {\n // Add the settings tab\n// $this->on('!wprss_options_tabs', array($this, 'addTab'), null, 100);\n // Register the settings option, sections and fields\n// $this->on('!wprss_admin_init', array($this, 'register'));\n\n parent::hook();\n }",
"public function hooks() {\n $service = new Service($this->license_base);\n add_action('admin_menu', array($this, 'register_license_page'));\n add_action('admin_enqueue_scripts', array($this, 'admin_scripts'), 10);\n // Validate service\n add_action('wp_ajax_validate_service', array($service, 'validate_service'), 10);\n }",
"public function install()\r\n {\r\n if (Shop::isFeatureActive()){\r\n Shop::setContext(Shop::CONTEXT_ALL);\r\n }\r\n\r\n return parent::install()\r\n && $this->_installHookCustomer()\r\n && $this->registerHook('fieldBrandSlider')\r\n && $this->registerHook('displayHeader')\r\n && $this->_createConfigs()\r\n && $this->_createTab();\r\n }",
"function install_hooks() {\n // Info that the plugin is activated.\n update_option( 'DB_Plugin_Hooks', true );\n }",
"function acf_has_upgrade()\n{\n}",
"public function hooks() {\n\t\tif ( Helper::get_settings( 'general.beta_optin' ) ) {\n\t\t\t$beta_optin = new Beta_Optin();\n\t\t\t$beta_optin->hooks();\n\t\t}\n\n\t\tif (\n\t\t\tHelper::is_advanced_mode() && (\n\t\t\t\t! Helper::is_plugin_active_for_network() ||\n\t\t\t\tcurrent_user_can( 'setup_network' )\n\t\t\t)\n\t\t) {\n\t\t\t$this->filter( 'rank_math/tools/pages', 'add_status_page' );\n\t\t\t$this->filter( 'rank_math/tools/default_tab', 'change_default_tab' );\n\t\t}\n\n\t\t$this->filter( 'rank_math/admin/dashboard_view', 'network_admin_view', 10, 2 );\n\t\t$this->filter( 'rank_math/admin/dashboard_nav_links', 'network_admin_dashboard_tabs' );\n\t\t$this->action( 'admin_enqueue_scripts', 'enqueue', 20 );\n\n\t\tif ( $this->should_add_json() ) {\n\t\t\t/* translators: Placeholder is version number. */\n\t\t\tHelper::add_json( 'rollbackConfirm', esc_html__( 'Are you sure you want to install version %s?', 'rank-math' ) );\n\t\t}\n\t}",
"private function define_public_hooks() {\n\t\t\n\t\t$plugin_public = new Soisy_Pagamento_Rateale_Public( $this->get_plugin_name(), $this->get_version() );\n\t\t\n\t\t\n\t\t$this->loader->add_action( 'woocommerce_before_cart_table', $plugin_public, 'updated_cart' );\n\t\t$this->loader->add_action( 'woocommerce_before_checkout_form', $plugin_public, 'updated_cart' );\n\t\t//$this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' );\n\t\t$this->loader->add_action( 'wp_footer', $plugin_public, 'enqueue_scripts' );\n\t\t$this->loader->add_action( 'wp', $plugin_public, 'soisy_available' , 10);\n\t\t$this->loader->add_action( 'init', $plugin_public, 'shortcodes' , 10);\n\t\t$this->loader->add_filter( 'soisy_settings', $plugin_public, 'get_options',99);\n\t\t$this->loader->add_action( 'wp', $plugin_public, 'init_soisy_widget' );\n\t\t$this->loader->add_action( 'woocommerce_before_single_product', $plugin_public, 'product_hooks' );\n\t\t//$this->loader->add_action( 'woocommerce_before_main_content', $plugin_public, 'product_hooks' );\n\t\t$this->loader->add_action( 'woocommerce_proceed_to_checkout', $plugin_public, 'checkout_hooks', 1 );\n\t\t$this->loader->add_action( 'woocommerce_review_order_before_order_total', $plugin_public, 'order_review_hooks', 1 );\n\t\t$this->loader->add_action( 'soisy_render_widget', $plugin_public, 'render_widget', 1 );\n\t\t//ajax actions\n\t\t$this->loader->add_action( 'soisy_ajax_order_status', $plugin_public, 'parseRemoteRequest');\n\t\t\n\t}",
"function coder_upgrade_upgrade_begin_alter($item) {\n// return; // TODO Temporary\n// cdp(\"inside \" . __FUNCTION__);\n global $upgrade_menu_registry;\n if (!$upgrade_menu_registry) {\n $upgrade_menu_registry = array();\n }\n /*\n * TODO Should we:\n * - write the core cache to a file (and commit the file?)\n * - make an admin settings page button to generate this cache (and any others we need)\n * - check for existence of cache if core upgrades are being run\n */\n coder_upgrade_cache_theme_registry();\n coder_upgrade_cache_info_hooks($item);\n cdp($upgrade_menu_registry);\n}",
"function upgrade_372()\n {\n }",
"public function install()\n\t{\n\t\tif (Shop::isFeatureActive()) {\n\t\t\tShop::setContext(Shop::CONTEXT_ALL);\n\t\t}\n\n\t\t//initialize empty settings\n\t\tConfiguration::updateValue('CLERK_PUBLIC_KEY', '');\n\t\tConfiguration::updateValue('CLERK_PRIVATE_KEY', '');\n\n\t\tConfiguration::updateValue('CLERK_SEARCH_ENABLED', 0);\n\t\tConfiguration::updateValue('CLERK_SEARCH_TEMPLATE', '');\n\n\t\tConfiguration::updateValue('CLERK_LIVESEARCH_ENABLED', 0);\n\t\tConfiguration::updateValue('CLERK_LIVESEARCH_INCLUDE_CATEGORIES', 0);\n\t\tConfiguration::updateValue('CLERK_LIVESEARCH_TEMPLATE', '');\n\n\t\tConfiguration::updateValue('CLERK_POWERSTEP_ENABLED', 0);\n\t\tConfiguration::updateValue('CLERK_POWERSTEP_TEMPLATES', '');\n\n\t\treturn parent::install() &&\n $this->registerHook('top') &&\n\t\t\t$this->registerHook('footer') &&\n\t\t\t$this->registerHook('displayOrderConfirmation');\n\t}",
"private function _setPagSeguroModuleVersion(){\n PagSeguroLibrary::setModuleVersion('prestashop-v.'.$this->module->version);\n }",
"public function install()\n {\n Configuration::updateValue('APISFACT_PRESTASHOP_TOKEN', '');\n\n Configuration::updateValue('APISFACT_PRESTASHOP_SERIEF', 'F001');\n Configuration::updateValue('APISFACT_PRESTASHOP_NUMEROF', '0');\n\n Configuration::updateValue('APISFACT_PRESTASHOP_SERIEB', 'B001');\n Configuration::updateValue('APISFACT_PRESTASHOP_NUMEROB', '0');\n\n include(dirname(__FILE__).'/sql/install.php');\n\n return parent::install() &&\n $this->registerHook('header') &&\n $this->registerHook('backOfficeHeader') &&\n $this->registerHook('displayAdminOrderLeft') &&\n $this->registerHook('displayAdminOrderMain');\n }",
"public function registerHooks() {\n\t\t// Nothing to do here right now\n\t\t// Others might want to know about this and get a chance to do their own work (like messing with our's :) )\n\t\tdo_action( 'pixelgrade_portfolio_registered_hooks' );\n\t}",
"protected function hook()\n {\n return version_compare(\n Arr::get($GLOBALS, 'wp_version'),\n '5.8-beta0',\n '<'\n ) ? 'block_categories' : 'block_categories_all';\n }",
"function upgrade_210()\n {\n }",
"public function install()\n {\n return parent::install()\n && $this->registerHook('actionObjectOrderAddBefore')\n && Configuration::updateValue('ORDERREF_LENGTH', self::ORDERREF_LENGTH_DEFAULT)\n && Configuration::updateValue('ORDERREF_MODE', self::ORDERREF_MODE_RANDOM)\n ;\n }",
"function activation_hook() {\n\n\t}",
"function init_hooks() {\n\tregister_activation_hook( __FILE__, __NAMESPACE__ . '\\activate_plugin' );\n\tregister_deactivation_hook( __FILE__, __NAMESPACE__ . '\\deactivate_plugin' );\n\tregister_uninstall_hook( __FILE__, __NAMESPACE__ . '\\uninstall_plugin' );\n}"
] |
[
"0.654693",
"0.6540433",
"0.6521236",
"0.63375074",
"0.63207954",
"0.63207954",
"0.6240451",
"0.6195804",
"0.6125617",
"0.6042435",
"0.60358065",
"0.59954137",
"0.5994381",
"0.5991095",
"0.597406",
"0.5944866",
"0.5922128",
"0.5905875",
"0.589367",
"0.58559036",
"0.5851248",
"0.5836978",
"0.5831066",
"0.5828305",
"0.5819316",
"0.5807027",
"0.5803565",
"0.58034563",
"0.579908",
"0.57967085"
] |
0.68675953
|
0
|
/ Init the access directory module for URL and file system Allow a compatibility for Presta < 1.4
|
public static function initModuleAccess()
{
self::$modulePath = _PS_MODULE_DIR_. 'mondialrelay/';
$protocol = (Configuration::get('PS_SSL_ENABLED') || (!empty($_SERVER['HTTPS'])
&& strtolower($_SERVER['HTTPS']) != 'off')) ? 'https://' : 'http://';
$endURL = __PS_BASE_URI__.'/modules/mondialrelay/';
if (method_exists('Tools', 'getShopDomainSsl'))
self::$moduleURL = $protocol.Tools::getShopDomainSsl().$endURL;
else
self::$moduleURL = $protocol.$_SERVER['HTTP_HOST'].$endURL;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"protected function _initFilesystem() {\n $this->_createWriteableDir($this->getTargetDir());\n $this->_createWriteableDir($this->getQuoteTargetDir());\n\n // Directory listing and hotlink secure\n $io = new Varien_Io_File();\n $io->cd($this->getTargetDir());\n if (!$io->fileExists($this->getTargetDir() . DS . '.htaccess')) {\n $io->streamOpen($this->getTargetDir() . DS . '.htaccess');\n $io->streamLock(true);\n $io->streamWrite(\"Order deny,allow\\nAllow from all\");\n $io->streamUnlock();\n $io->streamClose();\n }\n }",
"public function __construct() {\n // Use FS over PHP for this as it may need to search deep.\n $htaccess = array();\n exec('locate .htaccess', $htaccess);\n\n $htaccess = array_filter($htaccess, function($item) {\n return strpos($item, DRUPAL_ROOT) !== FALSE;\n });\n\n $this->setData($htaccess);\n }",
"private static function access()\n {\n $files = ['Path', 'Url'];\n $folder = static::$root.'Access'.'/';\n\n self::call($files, $folder);\n }",
"function __construct()\n\t{\n\t\t// Store module path\n\t\t$this->module_path = dirname(__FILE__);\n }",
"function __construct()\n\t{\n\t\t// Store module path\n\t\t$this->module_path = dirname(__FILE__);\n\t}",
"public function __construct(){\n\t\t//e.g. /benGallery/gallery/admin.php ( after the domain in the url)\n\t\t$this->uri=substr($_SERVER['REQUEST_URI'],0,(strpos($_SERVER['REQUEST_URI'],'?')?strpos($_SERVER['REQUEST_URI'],'?'):strlen($_SERVER['REQUEST_URI'])));\n\t\t\n\t\t$this->http_server='http'.(isset($_SERVER['HTTPS']) ? 's' : '').'://'.$_SERVER['HTTP_HOST'];\n\t\t\n\t\tif(isset($_SERVER['HTTP_REFERER'])){\n\t\t\tif(substr($_SERVER['HTTP_REFERER'],0,strlen($this->http_server))==$this->http_server){\n\t\t\t\t$this->referer=substr($_SERVER['HTTP_REFERER'],strlen($this->http_server));\n\t\t\t}else{\n\t\t\t\t$this->referer=$_SERVER['HTTP_REFERER'];\n\t\t\t}\n\t\t}\n\t\t\n\t\t//e.g. /var/www/benGallery/gallery/ ( absolute path to the gallery script)\n\t\t$this->fs_path=$_SERVER['DOCUMENT_ROOT'].substr($_SERVER[\"SCRIPT_NAME\"],0,strrpos($_SERVER[\"SCRIPT_NAME\"],'/')+1);\n\t\n\t\t//load params from url\n\t\tparse_str($_SERVER['QUERY_STRING'],$this->query);\n\t\t\n\t\t//subtract query string from uri to end up with the http path to the app on this server\n\t\tif(isset($this->query['page']) && !empty($this->query['page'])){\n\t\t\t$this->root_http_path=substr($this->uri,0,-strlen(str_replace(array(' '),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t array('%20'),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t $this->query['page'])));\n\t\t}else{\n\t\t\t$this->root_http_path=$this->uri;\n\t\t}\n\t\t\n\t\t//BEGIN SESSION!\n\t\tsession_set_cookie_params(0,$this->root_http_path);\n\t\t$a = session_id();\n\t\tif ($a == '') session_start();\n\t\tif (!isset($_SESSION['safety'])) {\n\t\t\tsession_regenerate_id(true);\n\t\t\t$_SESSION['safety'] = true;\n\t\t}\n\t\t$_SESSION['sessionid'] = session_id();\n\n\t\t//LOAD CONFIGURATION\n\t\t$this->ini=parse_ini_string(file_get_contents($this->config_name),true);\n\n\t\t//determine which page to view\n\t\t$this->page=array('uri'=>$this->ini['front']['default'],'params'=>array(),'template'=>false);\n\t\tif(isset($this->query['page'])) \n\t\t\t$this->page=$this->determine_uri_split($this->query['page']);\n\t\t\t\n\t\t$this->page['template']=$this->determine_tpl($this->page['uri']);\n\t\t\n\t\t//load cascading extra config\n\t\t$this->page['extra_config']=array_reverse($this->determine_cfg($this->page['uri']));\n\t\tforeach($this->page['extra_config'] as $extra_config){\n\t\t\t$this->load_cfg($extra_config);\n\t\t}\n\t\t\n\t\t//load package configs\n\t\twhile(isset($this->ini['front']) && isset($this->ini['front']['config']) && \n\t\t\t\tis_array($this->ini['front']['config']) && count($this->ini['front']['config'])){\n\t\t\t\t\n\t\t\tforeach($this->ini['front']['config'] as $pkgId=>$pkg){\n\t\t\t\t$this->load_cfg($this->ini['front']['template_dir'].$pkg.'/'.$this->config_name);\n\t\t\t\tunset($this->ini['front']['config'][$pkgId]);\n\t\t\t}\n\t\t}\n\t\t\n\t\t//load header html code from the config file!\n\t\tif(isset($this->ini['front']['headerHTML'])) $this->page['headerHTML']=$this->ini['front']['headerHTML'];\n\t\telse $this->page['headerHTML']=array();\n\t\t\n\n\t\t//load database driver module\n\t\tif(isset($this->ini['db']['driver'])) $this->db=$this->load($this->ini['db']['driver']);\t\n\t\t\t\n\t\t//load initial modules in ascending order of keys\n\t\tksort($this->ini['init']);\n\t\tforeach($this->ini['init'] as $mod_array){\n\t\t\tforeach($mod_array as $mod){\n\t\t\t\t$this->load($mod);\n\t\t\t}\n\t\t}\n\t\t\n\t}",
"public function __construct()\n {\n // Store module path\n $this->module_path = dirname(__FILE__);\n }",
"public function __construct()\n {\n // Store module path\n $this->module_path = dirname(__FILE__);\n }",
"public function __construct()\n {\n // Store module path\n $this->module_path = dirname(__FILE__);\n }",
"public function __construct()\n {\n // Store module path\n $this->module_path = dirname(__FILE__);\n }",
"public function __construct()\n {\n // Store module path\n $this->module_path = dirname(__FILE__);\n }",
"public function __construct()\n {\n // Store module path\n $this->module_path = dirname(__FILE__);\n }",
"function __construct()\n {\n define('FILE_READ_MODE', 0644);\n define('FILE_WRITE_MODE', 0666);\n define('DIR_READ_MODE', 0755);\n define('DIR_WRITE_MODE', 0777);\n }",
"function __construct(){\n\t\t//htaccess设置\n\t\t//路由分析 / index.php/Home/Index/index/id/1\t\t\n\t\t$path = $_SERVER['REQUEST_URI'];\n //p($_REQUEST);\t\n\t\tif(isset($path) && $path!='/'){\n\t\t\t$pathArr = explode('/', ltrim($path,'/'));\t\t\n\t\t\t//重置路由\n\t\t\tif(isset($pathArr[0])){\n\t\t\t\t$this->module = $pathArr[0];\n\t\t\t\tunset($pathArr[0]);\n\t\t\t}\n\t\t\tif(isset($pathArr[1])){\n\t\t\t\t$this->ctrl = $pathArr[1];\n\t\t\t\tunset($pathArr[1]);\n\t\t\t}\n\t\t\tif(isset($pathArr[2])){\n\t\t\t\t$this->action = $pathArr[2];\n\t\t\t\tunset($pathArr[2]);\n\t\t\t}\n\t\t\t//参数解析\n\t\t\t$count = count($pathArr);\n\t\t\t//$paras = array();\n\t\t\t//p($pathArr);\n\t\t\tfor($i=3;$i<$count+3;$i=$i+2){\n\t\t\t\tif(isset($pathArr[$i+1])){//处理参数不匹配的\n\t\t\t\t\t$_GET[$pathArr[$i]] = $pathArr[$i+1];\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t//$_GET['paras'] = $paras;\n\t\t\t\n\t\t }else{\n\t\t $this->module = Conf::get('MODULE','config');\n\t\t\t $this->ctrl = Conf::get('CTRL','config');\n\t\t\t $this->action = Conf::get('ACTION','config');\n\t\t }\n\t}",
"function __construct() {\n\t\t\n\t\tparent::__construct(array('Waccess'), 8);\n\t\t\n\t}",
"public function __construct() {\n // TODO: put here some basic verifications: tmp & photos directories exists and writeable ; install.php ; conf OK !\n }",
"protected function init() {\n if (!$this->configModule) {\n $this->configModule = $this->id;\n }\n $moduleData = $this->getModuleData();\n\n if ($moduleData['disabled']) {\n $this->moduleDisabled();\n }\n\n if (($this->getSiteVar('SECURE_REQUIRED', 0, Config::SUPRESS_ERRORS) || $moduleData['secure']) && \n (!isset($_SERVER['HTTPS']) || ($_SERVER['HTTPS'] !='on'))) { \n $this->secureModule();\n }\n \n if ($this->getSiteVar('AUTHENTICATION_ENABLED')) {\n includePackage('Authentication');\n if ($moduleData['protected']) {\n if (!$this->isLoggedIn()) {\n $this->unauthorizedAccess();\n }\n }\n \n if (!$this->evaluateACLS(self::ACL_USER)) {\n $this->unauthorizedAccess();\n }\n }\n }",
"private function __construct()\n {\n \t$this->storage_dir = $_SERVER[\"DOCUMENT_ROOT\"] . '/storage';\n }",
"function __construct()\n\t{\n\t\t// Store module path\n\t\t$this->module_path = dirname(__FILE__) .'/';\n\t\t$this->view_path = $this->module_path . 'views/';\n\t}",
"public function __construct()\n\t{\n\t\t$this->_sys_path=$GLOBALS['path_to_site'].'/lib/core/api';\n\t}",
"protected function action_getUserMainDir() {}",
"private function setup()\n {\n $home = getenv('PHLEXGET_HOME');\n $cacheDir = getenv('PHLEXGET_CACHE_DIR');\n if (!$home) {\n if (defined('PHP_WINDOWS_VERSION_MAJOR')) {\n $home = strtr(getenv('APPDATA'), '\\\\', '/') . '/Phlexget';\n } else {\n $home = rtrim(getenv('HOME'), '/') . '/.phlexget';\n }\n }\n if (!$cacheDir) {\n if (defined('PHP_WINDOWS_VERSION_MAJOR')) {\n if ($cacheDir = getenv('LOCALAPPDATA')) {\n $cacheDir .= '/Phlexget';\n } else {\n $cacheDir = getenv('APPDATA') . '/Phlexget/cache';\n }\n $cacheDir = strtr($cacheDir, '\\\\', '/');\n } else {\n $cacheDir = $home.'/cache';\n }\n }\n\n // Protect directory against web access. Since HOME could be\n // the www-data's user home and be web-accessible it is a\n // potential security risk\n foreach (array($home, $cacheDir) as $dir) {\n if (!file_exists($dir . '/.htaccess')) {\n if (!is_dir($dir)) {\n @mkdir($dir, 0777, true);\n }\n @file_put_contents($dir . '/.htaccess', 'Deny from all');\n }\n }\n\n $this->homeDir = $home;\n $this->cacheDir = $cacheDir;\n }",
"public function __construct()\n {\n $this->fileExtensionPermissions['allow'] = GeneralUtility::uniqueList(strtolower($GLOBALS['TYPO3_CONF_VARS']['BE']['fileExtensions']['webspace']['allow']));\n $this->fileExtensionPermissions['deny'] = GeneralUtility::uniqueList(strtolower($GLOBALS['TYPO3_CONF_VARS']['BE']['fileExtensions']['webspace']['deny']));\n }",
"public function init()\n {\n \tdefined('BASE_URL')\t|| define('BASE_URL', Zend_Controller_Front::getInstance()->getBaseUrl());\n\t\t$db = new Application_Model_DbTable_DbGlobal();\n\t\t$rs = $db->getValidUserUrl();\n\t\tif(empty($rs)){\n\t\t\tApplication_Form_FrmMessage::Sucessfull(\"YOU_NO_PERMISION_TO_ACCESS_THIS_SECTION\",\"/index/dashboad\");\n\t\t}\n }",
"public function createHtaccessFile() {\n $oModule = oxNew(Module::class);\n $oConfig = $this->getConfig();\n // get modules path\n $sModulesDir = $oConfig->getModulesDir();\n // get cache path\n $sCacheDir = $oConfig->getConfigParam('sCompileDir');\n // check if the default .htaccess file is in config folder\n if(file_exists($sModulesDir.$oModule->getModulePath('suaboclearcache').'/Config/.htaccess.tmp')) {\n // copy .htaccess to cache folder\n copy($sModulesDir . $oModule->getModulePath('suaboclearcache') . '/Config/.htaccess.tmp', $sCacheDir . '/.htaccess');\n }\n }",
"protected function initialize() {\n\t\t$this->databasesDir = $this->projectDir . '/var/data/databases';\n\t\t$this->simulatorsDir = $this->projectDir . '/var/data/simulators';\n\t\t$this->publicDir = $this->projectDir . '/' . ($this->getParameter('public_dir') ?? 'public');\n\t\t$this->viewsDir = $this->projectDir . '/templates';\n\t\t$this->pdfFormsDir = $this->projectDir . '/var/data/pdfforms';\n\t}",
"protected function setInitialRootPath() {}",
"public function init()\n {\n parent::init();\n $this->sourcePath = __DIR__ . '/front';\n }",
"public function setup()\n {\n $this->luser = $this->sessioncheck('user', FALSE); # see if there is a user variable in the session....\n foreach (getallheaders() as $k => $v)\n {\n if (self::TOKEN === strtoupper($k))\n {\n $tok = JWT::decode($v, self::KEY);\n $this->luser = $this->load('user', $tok->sub);\n $this->tokauth = TRUE;\n break;\n }\n }\n if (isset($_SERVER['REDIRECT_URL']) && !preg_match('/index.php/', $_SERVER['REDIRECT_URL']))\n {\n/**\n * Apache v 2.4.17 changed the the REDIRECT_URL value to be a full URL, so we need to strip this.\n * Older versions will not have this so the code will do nothing.\n */\n $uri = preg_replace('#^https?://[^/]+#', '', $_SERVER['REDIRECT_URL']);\n }\n else\n {\n $uri = $_SERVER['REQUEST_URI'];\n }\n if ($_SERVER['QUERY_STRING'] != '')\n { # there is a query string so get rid it of it from the URI\n list($uri) = explode('?', $uri);\n }\n $req = array_filter(explode('/', $uri)); # array_filter removes empty elements - trailing / or multiple /\n/*\n * If you know that the base directory is empty then you can delete the next test block.\n *\n * You can also optimise out the loop if you know how deep you are nested in sub-directories\n *\n * The code here is to make it easier to move your code around within the hierarchy. If you don't need\n * this then optimise the hell out of it.\n */\n if ($this->local()->base() != '')\n { # we are in at least one sub-directory\n $bsplit = array_filter(explode('/', $this->local()->base()));\n foreach (range(1, count($bsplit)) as $c)\n {\n array_shift($req); # pop off the directory name...\n }\n }\n if (!empty($req))\n { # there was something after the domain name so split it into action and rest...\n $this->reqaction = strtolower(array_shift($req));\n $this->reqrest = empty($req) ? [''] : array_values($req);\n }\n\n return $this;\n }",
"static function setupInit($path=null,$file=null)\r\n {\r\n Zend_ConfigSettings::setUpConfig();\r\n self::$_general = Zend_Registry::get('general');\r\n self::_setEnv();\t \r\n }"
] |
[
"0.65270364",
"0.607206",
"0.6004302",
"0.589502",
"0.58808446",
"0.58566713",
"0.57198715",
"0.57198715",
"0.57198715",
"0.57198715",
"0.57198715",
"0.57198715",
"0.5695014",
"0.5641063",
"0.5634495",
"0.5612354",
"0.55661494",
"0.5563943",
"0.55459386",
"0.5538748",
"0.54999804",
"0.5464845",
"0.5458461",
"0.5421574",
"0.54169",
"0.5412072",
"0.5401614",
"0.53893644",
"0.53838915",
"0.53756815"
] |
0.6526113
|
1
|
/ Form to allow personalization fields sent for MondialRelay
|
public function personalizeFormFields()
{
$form = '';
$warn = '';
// Load the Default value from the configuration
$addr1 = (Configuration::get('PS_MR_SHOP_NAME')) ?
Configuration::get('PS_MR_SHOP_NAME') :
Configuration::get('PS_SHOP_NAME');
// Check if a request exist and if errors occured, use the post variable
if (Tools::isSubmit('PS_MRSubmitFieldPersonalization') && count($this->_postErrors))
$addr1 = Tools::getValue('Expe_ad1');
if (!Configuration::get('PS_MR_SHOP_NAME'))
$warn .= '<div class="warn">'.
$this->l('Its seems you updated Mondialrelay without use the uninstall / install method,
you have to set up this part to make working the generating ticket process').
'</div>';
// Form
$form = '<form action="'.$_SERVER['REQUEST_URI'].'" method="post" class="form">';
$form .= '
<fieldset class="PS_MRFormStyle">
<legend>
<img src="../modules/mondialrelay/images/logo.gif" />'.$this->l('Fields personalization').
'</legend>'.
$warn.'
<label for="PS_MR_SHOP_NAME">'.$this->l('Main Address').'</label>
<div class="margin-form">
<input type="text" name="Expe_ad1" value="'.$addr1.'" /><br />
<p>'.$this->l('The key used by Mondialrelay is').' <b>Expe_ad1</b> '.$this->l('and has this default value').'
: <b>'.Configuration::get('PS_SHOP_NAME').'</b></p>
</div>
<div class="margin-form">
<input type="submit" name="PS_MRSubmitFieldPersonalization" value="' . $this->l('Save') . '" class="button" />
</div>
</form><br />';
return $form;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function payment_fields() {\n if ($this->description) echo wpautop(wptexturize($this->description));\n ?>\n <ol class=\"my-list\">\n <li>Entrez votre numéro MTN Mobile Money dans le champ de formulaire ci-dessous</li>\n <li>Vous recevrez un message vous demandant de composer *126# et d'entrer votre code PIN</li>\n <li>Composez *126# et entrez votre code PIN pour confirmer votre paiement</li>\n <li>Si le paiement est effectué, votre commande sera automatiquement validé</li>\n </ol>\n\n <label for=\"\">Entrez votre numéro MTN Mobile Money</label>\n\n <input type=\"text\" name=\"gt_user_momo_number\" value=\"\"\n style=\"background-color: #fff; border-radius: 0px; color: #222;\"required class=\"form-controll\"\n placeholder=\"Enter your phone number\">\n <?php\n }",
"function liveitchina_user_connectivity_form($requestee, $relationship){\n $recipients = array($requestee);\n module_load_include('pages.inc','privatemsg');\n \n $form = drupal_get_form('privatemsg_new',$recipients,'');\n \n $form['recipient']['#input'] = false;\n $form['recipient']['#prefix'] = '<div class = \"block-remove-recipient\" style=\"display:none\">';\n $form['recipient']['#suffix'] = '</div>';\n\n $form['reply']['#markup'] = '<div class = \"block-title-highlight\"><div> <h7>Here you will find the greatest tools for mutual learning with your Tutor / Exchange Partner.</h7></div><div><h7> Stay Tuned!</h7></div></div>';\n $form['reply']['#weight'] = '-100';\n \n drupal_set_title('My Tutor/Exchange Partner');\n //print_r($form);\n return $form;\n}",
"public function output_setup_form() {\n\t\t$related_api = Thrive_Dash_List_Manager::connection_instance( 'mandrill' );\n\t\tif ( $related_api->is_connected() ) {\n\t\t\t$credentials = $related_api->get_credentials();\n\t\t\t$this->set_param( 'email', $credentials['email'] );\n\t\t\t$this->set_param( 'mandrill-key', $credentials['key'] );\n\t\t}\n\n\t\t$this->output_controls_html( 'mailchimp' );\n\t}",
"public function payment_fields() {\n\t\t\t\t?>\n\t\t\t\t<div class=\"wc-gateway-havanao\">\n\t\t\t\t\t<p><?php _e( 'Please enter the mobile number you want to charge:' ); ?></p>\n\t\t\t\t\t<input type=\"text\" name=\"havanao_phone_number\" class=\"wc-gateway-havanao__phone-number\" />\n\t\t\t\t</div>\n\t\t\t\t<?php\n\t\t\t}",
"function content() {\n echo \"\n <form action='http://{$_SERVER['SERVER_NAME']}/mailmaid/subscriber/add' method='post'>\n <input name='token' type='hidden' value='{$this->params['token']}'>\n <label for='username'>Name</label>\n <input name='name' placeholder='Name' id='name' type='text' required>\n <label for='description'>Description</label>\n <input name='description' placeholder='Description (Optional)' id='description' type='text'>\n <input type='submit' value='Create List'>\n </form>\n \";\n }",
"public static function add_form_fields() {\n\n\t\tforeach ( WC()->payment_gateways->payment_gateways as $key => $gateway ) {\n\n\t\t\tif ( WC()->payment_gateways->payment_gateways[ $key ]->id !== 'paypal' ) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// Warn store managers not to change their PayPal Email address as it can break existing Subscriptions in WC2.0+\n\t\t\tWC()->payment_gateways->payment_gateways[ $key ]->form_fields['receiver_email']['desc_tip'] = false;\n\t\t\tWC()->payment_gateways->payment_gateways[ $key ]->form_fields['receiver_email']['description'] .= ' </p><p class=\"description\">' . __( 'It is <strong>strongly recommended you do not change the Receiver Email address</strong> if you have active subscriptions with PayPal. Doing so can break existing subscriptions.', 'woocommerce-subscriptions' );\n\t\t}\n\t}",
"public function setup_form() {\n\t\t?>\n\t\t<tr>\n\t\t\t<td colspan=\"2\">\n\t\t\t\t<p>\n\t\t\t\t\t<label for=\"wpsc-manual-gateway-setup\"><?php _e( 'Instructions', 'wpsc' ); ?></label><br />\n\t\t\t\t\t<textarea id=\"wpsc-manual-gateway-setup\" cols='' rows='10' name='<?php echo esc_attr( $this->setting->get_field_name( 'payment_instructions' ) ); ?>'><?php echo esc_textarea( wp_unslash( $this->setting->get( 'payment_instructions' ) ) ); ?></textarea><br />\n\t\t\t\t\t<small><?php _e('Enter the payment instructions that you wish to display to your customers when they make a purchase.', 'wpsc'); ?></small><br />\n\t\t\t\t\t<small><?php _e('For example, this is where you the Shop Owner might enter your bank account details or address so that your customer can make their manual payment.', 'wpsc'); ?></small>\n\t\t\t\t</p>\n\t\t\t</td>\n\t\t</tr>\n\t\t<?php\n\t}",
"public function payment_fields()\r\n {\r\n \r\n // ok, let's display some description before the payment form\r\n if ($this->description) {\r\n // display the description with <p> tags etc.\r\n echo wpautop(wp_kses_post($this->description));\r\n }\r\n \r\n // I will echo() the form, but you can close PHP tags and print it directly in HTML\r\n echo '<fieldset id=\"wc-' . esc_attr($this->id) . '-cc-form\" class=\"wc-credit-card-form wc-payment-form\" style=\"background:transparent;\">';\r\n \r\n // Add this action hook if you want your custom gateway to support it\r\n do_action('woocommerce_momo_form_start', $this->id);\r\n \r\n // I recommend to use inique IDs, because other gateways could already use #ccNo, #expdate, #cvc\r\n echo '<div class=\"form-row form-row-wide\"><label>Mobile Wallet Provider <span class=\"required\">*</span></label>\r\n\t\t\t\t<select id=\"epaygh_mobile_wallet_network\" name=\"epaygh_mobile_wallet_network\">\r\n\t\t\t\t\t<option name=\"epaygh_mobile_wallet_network\" value=\"mtn\" selected>MTN</option>\r\n\t\t\t\t\t<option name=\"epaygh_mobile_wallet_network\" value=\"airtel\">Airtel</option>\r\n\t\t\t\t\t<option name=\"epaygh_mobile_wallet_network\" value=\"tigo\">Tigo</option>\r\n\t\t\t\t\t<option name=\"epaygh_mobile_wallet_network\" value=\"vodafone\">Vodafone</option>\r\n\t\t\t\t</select>\r\n\t\t\t\t</div>\r\n\t\t\t\t<div class=\"form-row form-row-wide\"><label>Mobile Wallet Number <span class=\"required\">*</span></label>\r\n\t\t\t\t<input id=\"epaygh_mobile_wallet_number\" name=\"epaygh_mobile_wallet_number\" type=\"tel\">\r\n\t\t\t\t</div>\r\n\r\n\t\t\t\t<div class=\"form-row form-row-wide\"><label>Voucher </label>\r\n\t\t\t\t\t<input id=\"epaygh_payment_voucher\" name=\"epaygh_payment_voucher\" type=\"text\" autocomplete=\"off\"><br>\r\n\t\t\t\t\t<span class=\"required\">Leave empty if mobile network is not Vodafone</span>\r\n\t\t\t\t</div>\r\n\r\n\t\t\t\t<div class=\"clear\"></div>';\r\n \r\n do_action('woocommerce_momo_form_end', $this->id);\r\n \r\n echo '<div class=\"clear\"></div></fieldset>';\r\n }",
"function mda_settings_form() {\n\t$form['mda_resources_access'] = array(\n\t\t\t'#type' => 'fieldset',\n\t\t\t'#title' => 'Page d\\'infos sur l\\'accès aux ressources MDA',\n\t\t\t'#description' => 'Information affichée à un utilisateur non connecté essayant de voir une ressource dont la visibilité est \"professionnels\".',\n\t);\n\t\n\t$default_text = \"<p>L'accès à cette ressource est réservée aux professionnels possédant un compte sur ce site.</p>\\n\";\n\t$default_text .= \"<p><a href=\" . \"/user\" . \">Accès au formulaire de connexion</a>.</p>\\n\";\n\t$default_text .= '<p>Si vous êtes un professionnel et que vous ne possédez pas de compte,';\n\t$default_text .= ' rendez-vous sur la page de création d\\'un <a href=\"/user/register\">nouveau compte</a>.';\n\n\t$form['mda_resources_access']['mda_restricted_access_text'] = array(\n\t\t\t'#type' => 'text_format',\n\t\t\t'#title' => 'Texte d\\'information',\n\t\t\t'#size' => 100,\n\t\t\t'#default_value' => variable_get('mda_restricted_access_text', $default_text),\n\t\t\t'#format'=> 'full_html',\n\t);\n\n\treturn system_settings_form($form);\n}",
"function messenger_config_form($form, &$form_state)\n{\n\n $form[MESSENGER_URL] = array(\n '#type' => 'textfield',\n '#title' => t('API url'),\n '#default_value' => variable_get(MESSENGER_URL, ''),\n '#description' => t('The api url. eg: http://api.domain.com'),\n '#required' => TRUE,\n );\n\n $form[MESSENGER_SECRET] = array(\n '#type' => 'textfield',\n '#title' => t('Secret'),\n '#default_value' => variable_get(MESSENGER_SECRET, ''),\n '#description' => t('API secret.'),\n '#required' => TRUE,\n );\n\n $form[GIPHY_API] = array(\n '#type' => 'textfield',\n '#title' => t('Giphy api key'),\n '#default_value' => variable_get(GIPHY_API, DEFAULT_GIPHY_API),\n '#description' => t('Enter Giphy api.'),\n '#required' => TRUE,\n );\n\n $form[GIPHY_EXCLUDE_KEYWORD] = array(\n '#type' => 'textarea',\n '#title' => t('Giphy exclude keywords'),\n '#default_value' => variable_get(GIPHY_EXCLUDE_KEYWORD, ''),\n '#description' => t('Enter a word per line'),\n '#required' => FALSE,\n );\n\n //MESSENGER_OFFSET\n $form[MESSENGER_OFFSET] = array(\n '#type' => 'textfield',\n '#title' => t('Inbox Offset Height'),\n '#default_value' => variable_get(MESSENGER_OFFSET, 300),\n '#description' => t('Use offset to calculate height of inbox'),\n '#required' => FALSE,\n );\n\n return system_settings_form($form);\n\n\n}",
"function mpc_html_form_code() {\n echo '<form action=\"' .esc_url( $_SERVER['REQUEST_URI'] ) . '\" method=\"post\">';\n echo '<p>';\n echo 'Il tuo Nome <br>';\n echo '<input type=\"text\" name=\"mpc-name\" pattern=\"[a-zA-Z0-9]+\" value=\"' . ( isset($_POST[\"mpc-name\"]) ? esc_attr( $_POST[\"mpc-name\"]) : '' ) . '\" size=40></p>';\n echo '<p>La tua email <br>';\n echo '<input type=\"email\" name=\"mpc-email\" value=\"' . ( isset($_POST[\"mpc-email\"]) ? esc_attr( $_POST[\"mpc-email\"]) : '' ) . '\" size=40></p>';\n echo 'Oggetto <br/>';\n\techo '<input type=\"text\" name=\"mpc-subject\" pattern=\"[a-zA-Z ]+\" value=\"' . ( isset( $_POST[\"mpc-subject\"] ) ? esc_attr( $_POST[\"mpc-subject\"] ) : '' ) . '\" size=\"40\" />';\n\techo '</p>';\n\techo '<p>Il tuo messaggio <br/>';\n\techo '<textarea rows=\"10\" cols=\"35\" name=\"mpc-message\">' . ( isset( $_POST[\"mpc-message\"] ) ? esc_attr( $_POST[\"mpc-message\"] ) : '' ) . '</textarea>';\n\techo '</p>';\n\techo '<p><input type=\"submit\" name=\"mpc-submitted\" value=\"Invia\"></p>';\n\techo '</form>';\n}",
"abstract public function get_gateway_form_fields();",
"function init_form_fields() {\n \n \t$this->form_fields = array(\n\t\t\t'enabled' => array(\n\t\t\t\t'title' => __( 'Enable/Disable', WC_Authorize_SIM::TEXT_DOMAIN ), \n\t\t\t\t'label' => __( 'Enable Authorize.Net SIM Payment Module', WC_Authorize_SIM::TEXT_DOMAIN ), \n\t\t\t\t'type' => 'checkbox', \n\t\t\t\t'description' => '', \n\t\t\t\t'default' => 'no'\n\t\t\t), \n\t\t\t'title' => array(\n\t\t\t\t'title' => __( 'Title' ), \n\t\t\t\t'type' => 'text', \n\t\t\t\t'description' => __( 'This controls the title which the user sees during checkout.', WC_Authorize_SIM::TEXT_DOMAIN ), \n\t\t\t\t'default' => __( 'Authorize.net SIM', WC_Authorize_SIM::TEXT_DOMAIN ),\n\t\t\t\t'css' => \"width: 300px;\"\n\t\t\t), \n\t\t\t'description' => array(\n\t\t\t\t'title' => __( 'Description', WC_Authorize_SIM::TEXT_DOMAIN ), \n\t\t\t\t'type' => 'textarea', \n\t\t\t\t'description' => __( 'This controls the description which the user sees during checkout.', WC_Authorize_SIM::TEXT_DOMAIN ), \n\t\t\t\t'default' => 'Pay with your credit card via Authorize.net.'\n\t\t\t),\n\t\t\t'debug' => array(\n\t\t\t\t'title' => __( 'Debug', WC_Authorize_SIM::TEXT_DOMAIN ), \n\t\t\t\t'type' => 'checkbox', \n\t\t\t\t'label' => __( 'Enable logging (<code>woocommerce/logs/authorize_sim.txt</code>)', WC_Authorize_SIM::TEXT_DOMAIN ), \n\t\t\t\t'default' => 'no'\n\t\t\t),\n\t\t\t'testmode' => array(\n\t\t\t\t'title' => __( 'Test mode', WC_Authorize_SIM::TEXT_DOMAIN ), \n\t\t\t\t'label' => __( 'Test Mode allows you to submit test transactions to the payment gateway', WC_Authorize_SIM::TEXT_DOMAIN ), \n\t\t\t\t'type' => 'checkbox', \n\t\t\t\t'description' => __( 'You may want to set to true if testing against production', WC_Authorize_SIM::TEXT_DOMAIN ), \n\t\t\t\t'default' => 'no'\n\t\t\t), \n\t\t\t'login_id' => array(\n\t\t\t\t'title' => __( 'API Login ID', WC_Authorize_SIM::TEXT_DOMAIN ), \n\t\t\t\t'type' => 'text', \n\t\t\t\t'description' => __( 'This is API Lgoin supplied by Authorize.', WC_Authorize_SIM::TEXT_DOMAIN ), \n\t\t\t\t'default' => ''\n\t\t\t), \n\t\t\t'tran_key' => array(\n\t\t\t\t'title' => __( 'Transaction Key', WC_Authorize_SIM::TEXT_DOMAIN ), \n\t\t\t\t'type' => 'text', \n\t\t\t\t'description' => __( 'This is Transaction Key supplied by Authorize.', WC_Authorize_SIM::TEXT_DOMAIN ), \n\t\t\t\t'default' => ''\n\t\t\t),\n\t\t\t'md5_hash' => array(\n\t\t\t\t'title' => __( 'MD5 Hash', WC_Authorize_SIM::TEXT_DOMAIN ), \n\t\t\t\t'type' => 'text', \n\t\t\t\t'description' => __( 'The MD5 hash value to verify transactions', WC_Authorize_SIM::TEXT_DOMAIN ), \n\t\t\t\t'default' => ''\n\t\t\t),\n\t\t\t'type' => array(\n\t\t\t\t'title' => __( 'Sale Method', WC_Authorize_SIM::TEXT_DOMAIN ), \n\t\t\t\t'type' => 'select', \n\t\t\t\t'description' => __( 'Select which sale method to use. Authorize Only will authorize the customers card for the purchase amount only. Authorize & Capture will authorize the customer\\'s card and collect funds.', WC_Authorize_SIM::TEXT_DOMAIN ), \n\t\t\t\t'options' => array(\n\t\t\t\t\t'AUTH_CAPTURE'=>'Authorize & Capture',\n\t\t\t\t\t'AUTH_ONLY'=>'Authorize Only'\n\t\t\t\t),\n\t\t\t\t'default' => 'AUTH_CAPTURE'\n\t\t\t),\n\t\t\t'tran_mode' => array(\n\t\t\t\t'title' => __( 'Transaction Mode', WC_Authorize_SIM::TEXT_DOMAIN ), \n\t\t\t\t'type' => 'select', \n\t\t\t\t'description' => __( 'Transaction mode used for processing orders', WC_Authorize_SIM::TEXT_DOMAIN ), \n\t\t\t\t'options' => array('live'=>'Live', 'sandbox'=>'Sandbox'),\n\t\t\t\t'default' => 'live'\n\t\t\t),\n\t\t\t\n\t\t);\n }",
"public function _settings_field_contact_form_details() {\n global $zendesk_support;\n $value = $zendesk_support->_is_default( 'contact_form_details' ) ? '' : $zendesk_support->settings['contact_form_details'];\n ?>\n <input type=\"text\" class=\"regular-text\" name=\"zendesk-settings[contact_form_details]\" value=\"<?php echo $value; ?>\"\n placeholder=\"<?php echo $zendesk_support->default_settings['contact_form_details']; ?>\"/>\n <?php\n }",
"public function updateFieldsPersonalization()\n\t{\n\t\tConfiguration::updateValue('PS_MR_SHOP_NAME', Tools::getValue('Expe_ad1'));\n\t\t$this->_html .= '<div class=\"conf confirm\"><img src=\"'._PS_ADMIN_IMG_.'/ok.gif\" alt=\"\" /> '.$this->l('Settings updated').'</div>';\t\t\n\t}",
"function bab_pm_makeform()\n{\n global $prefs;\n\n $bab_hidden_input = '';\n $event = gps('event');\n $step = gps('step');\n\n if (!$event) {\n $event = 'postmaster';\n }\n\n if (!$step) {\n $step = 'subscribers';\n }\n\n if ($step == 'subscribers') {\n $bab_columns = array(\n 'subscriberFirstName',\n 'subscriberLastName',\n 'subscriberEmail',\n 'subscriberLists',\n );\n\n for ($i = 1; $i <= BAB_CUSTOM_FIELD_COUNT; $i++) {\n $bab_columns[] = \"subscriberCustom{$i}\";\n }\n\n $bab_submit_value = 'Add Subscriber';\n $bab_prefix = 'new';\n $subscriberToEdit = gps('subscriber');\n\n if ($subscriberToEdit) {\n $bab_hidden_input = '<input type=\"hidden\" name=\"editSubscriberId\" value=\"' . doSpecial($subscriberToEdit) . '\">';\n $bab_prefix = 'edit';\n $bab_submit_value = 'Update Subscriber Information';\n\n $row = safe_row('*', 'bab_pm_subscribers', \"subscriberID=\" . doSlash($subscriberToEdit));\n $subscriber_lists = safe_rows('*', 'bab_pm_subscribers_list', \"subscriber_id = \" . doSlash($row['subscriberID']));\n $fname = doSpecial($row['subscriberFirstName']);\n $lname = doSpecial($row['subscriberLastName']);\n echo \"<fieldset id=bab_pm_edit><legend><span class=bab_pm_underhed>Editing Subscriber: $fname $lname</span></legend>\";\n } else {\n $subscriber_lists = array();\n }\n\n $lists = safe_rows('*', 'bab_pm_list_prefs', '1=1 order by listName');\n }\n\n if ($step == 'lists') {\n $bab_columns = array('listName', 'listAdminEmail','listDescription','listUnsubscribeUrl','listEmailForm','listSubjectLine');\n $bab_submit_value = 'Add List';\n $bab_prefix = 'new';\n\n if ($listToEdit = gps('list')) {\n $bab_hidden_input = '<input type=\"hidden\" name=\"editListID\" value=\"' . $listToEdit . '\">';\n $bab_prefix = 'edit';\n $bab_submit_value = 'Update List Information';\n $bab_prefix = 'edit';\n\n $row = safe_row('*', 'bab_pm_list_prefs', \"listID=\" . doSlash($listToEdit));\n echo \"<fieldset id=bab_pm_edit><legend>Editing List: $row[listName]</legend>\";\n }\n\n $form_prefix = $prefs[_bab_prefix_key('form_select_prefix')];\n\n $forms = safe_column('name', 'txp_form',\"name LIKE '\". doSlash($form_prefix) . \"%'\");\n $form_select = selectInput($bab_prefix.ucfirst('listEmailForm'), $forms, @$row['listEmailForm']);\n // replace class\n $form_select = str_replace('class=\"list\"', 'class=\"bab_pm_input\"', $form_select);\n }\n\n // build form\n\n echo '<form method=\"POST\" id=\"subscriber_edit_form\">';\n\n foreach ($bab_columns as $column) {\n echo '<dl class=\"bab_pm_form_input\"><dt>'.bab_pm_preferences($column).'</dt><dd>';\n $bab_input_name = $bab_prefix . ucfirst($column);\n\n switch ($column) {\n case 'listEmailForm':\n echo $form_select;\n break;\n case 'listSubjectLine':\n $checkbox_text = 'Use Article Title for Subject';\n case 'listUnsubscribeUrl':\n if (empty($checkbox_text)) {\n $checkbox_text = 'Use Default';\n }\n\n $checked = empty($row[$column]) ? 'checked=\"checked\" ' : '';\n $js = <<<eojs\n<script>\n$(document).ready(function () {\n $('#{$column}_checkbox').change(function(){\n if ($(this).is(':checked')) {\n $('input[name={$bab_input_name}]').attr('disabled', true).val('');\n }\n else {\n $('input[name={$bab_input_name}]').attr('disabled', false);\n }\n });\n});\n</script>\n\neojs;\n\n echo $js . '<input id=\"'.$column.'_checkbox\" type=\"checkbox\" class=\"bab_pm_input\" ' . $checked . '/>'.$checkbox_text.'</dd><dd>' .\n '<input type=\"text\" name=\"' . $bab_input_name . '\" value=\"' . doSpecial(@$row[$column]) . '\"' .\n (!empty($checked) ? ' disabled=\"disabled\"' : '') . ' />' .\n '</dd>';\n break;\n case 'subscriberLists':\n foreach ($lists as $list) {\n $checked = '';\n\n foreach ($subscriber_lists as $slist) {\n if ($list['listID'] == $slist['list_id']) {\n $checked = 'checked=\"checked\" ';\n break;\n }\n }\n\n echo '<input type=\"checkbox\" name=\"'. $bab_input_name .'[]\" value=\"'.$list['listID'].'\"' . $checked . '/>'\n . doSpecial($list['listName']) . \"<br>\";\n }\n break;\n default:\n echo '<input type=\"text\" name=\"' . $bab_input_name . '\" value=\"' . doSpecial(@$row[$column]) . '\" class=\"bab_pm_input\">';\n break;\n }\n\n echo '</dd></dl>';\n }\n\n echo $bab_hidden_input;\n echo '<input type=\"submit\" value=\"' . doSpecial($bab_submit_value) . '\" class=\"publish\">';\n echo '</form>';\n}",
"function payment_fields() {\n\t\t\tif ( $this->description ) echo wpautop( wptexturize( $this->description ) );\n\t\t\tdo_action( 'tgm_jigoshop_payment_fields' ); // allow for insertion of custom code if needed\n\t\t}",
"function my_twilio_admin_form($form, &$form_state) {\n $form['my_twilio_account'] = array(\n '#type' => 'textfield',\n '#required' => TRUE,\n '#title' => t('Twilio Account SID'),\n '#default_value' => variable_get('my_twilio_account'),\n '#description' => t('Enter your Twilio account id'),\n );\n $form['my_twilio_token'] = array(\n '#type' => 'textfield',\n '#required' => TRUE,\n '#title' => t('Twilio Auth Token'),\n '#default_value' => variable_get('my_twilio_token'),\n '#description' => t('Enter your Twilio token id'),\n );\n $form['my_twilio_number'] = array(\n '#type' => 'textfield',\n '#required' => TRUE,\n '#title' => t('Twilio Phone Number'),\n '#default_value' => variable_get('my_twilio_number'),\n '#description' => t('Enter your Twilio phone number'),\n );\n\n $form['my_twilio_country_codes_container'] = array(\n '#type' => 'fieldset',\n '#title' => t('Country codes'),\n '#description' => t('Select the country codes you would like available, If none are selected all will be available.'),\n '#collapsible' => TRUE,\n '#collapsed' => TRUE,\n );\n\n $form['my_twilio_country_codes_container']['twilio_country_codes'] = array(\n '#type' => 'checkboxes',\n '#options' => my_twilio_country_codes(TRUE),\n '#default_value' => variable_get('my_twilio_country_codes', array()),\n );\n\n return system_settings_form($form);\n}",
"function mci_twilio_admin_form($form, &$form_state) {\n $form['mci_twilio_account'] = array(\n '#type' => 'textfield',\n '#required' => TRUE,\n '#title' => t('Twilio Account SID'),\n '#default_value' => variable_get('mci_twilio_account'),\n '#description' => t('Enter your Twilio account id'),\n );\n $form['mci_twilio_token'] = array(\n '#type' => 'textfield',\n '#required' => TRUE,\n '#title' => t('Twilio Auth Token'),\n '#default_value' => variable_get('mci_twilio_token'),\n '#description' => t('Enter your Twilio token id'),\n );\n $form['mci_twilio_number'] = array(\n '#type' => 'textfield',\n '#required' => TRUE,\n '#title' => t('Twilio Phone Number'),\n '#default_value' => variable_get('mci_twilio_number'),\n '#description' => t('Enter your Twilio phone number'),\n );\n\n $form['mci_twilio_country_codes_container'] = array(\n '#type' => 'fieldset',\n '#title' => t('Country codes'),\n '#description' => t('Select the country codes you would like available, If none are selected all will be available.'),\n '#collapsible' => TRUE,\n '#collapsed' => TRUE,\n );\n\n $form['mci_twilio_country_codes_container']['twilio_country_codes'] = array(\n '#type' => 'checkboxes',\n '#options' => mci_twilio_country_codes(TRUE),\n '#default_value' => variable_get('mci_twilio_country_codes', array()),\n );\n\n return system_settings_form($form);\n}",
"function my_twilio_admin_test_form($form, &$form_state) {\n $form['country'] = array(\n '#type' => 'select',\n '#title' => t('Country code'),\n '#options' => my_twilio_country_codes(),\n );\n $form['number'] = array(\n '#type' => 'textfield',\n '#required' => TRUE,\n '#title' => t('Phone Number'),\n '#description' => t('The number to send your message to. Include all numbers except the country code'),\n );\n $form['message'] = array(\n '#type' => 'textarea',\n '#required' => TRUE,\n '#title' => t('Message'),\n '#description' => t(\"The body of your SMS message.\")\n );\n $form['submit'] = array(\n '#type' => 'submit',\n '#value' => t('Send SMS'),\n );\n return $form;\n}",
"function edit_profile_field_form()\n {\n if ( ! Session::access('can_admin_members'))\n {\n return Cp::unauthorizedAccess();\n }\n\n $type = ($m_field_id = Request::input('m_field_id')) ? 'edit' : 'new';\n\n // Fetch language file\n // There are some lines in the publish administration language file\n // that we need.\n\n $total_fields = '';\n\n if ($type == 'new')\n {\n $total_fields = DB::table('member_fields')->count() + 1;\n }\n\n $query = DB::table('member_fields')\n ->where('m_field_id', $m_field_id)\n ->first();\n\n if (!$query) {\n\n $m_field_name='';\n $m_field_label='';\n $m_field_description='';\n $m_field_type='text';\n $m_field_list_items='';\n $m_field_ta_rows=8;\n $m_field_maxl='';\n $m_field_width='';\n $m_field_search='y';\n $m_field_required='n';\n $m_field_public='y';\n $m_field_reg='n';\n $m_field_order='';\n } else {\n foreach ($query as $key => $val) {\n $$key = $val;\n }\n }\n\n $r = <<<EOT\n\n <script type=\"text/javascript\">\n <!--\n\n function showhide_element(id)\n {\n if (id == 'text')\n {\n document.getElementById('text_block').style.display = \"block\";\n document.getElementById('textarea_block').style.display = \"none\";\n document.getElementById('select_block').style.display = \"none\";\n }\n else if (id == 'textarea')\n {\n document.getElementById('textarea_block').style.display = \"block\";\n document.getElementById('text_block').style.display = \"none\";\n document.getElementById('select_block').style.display = \"none\";\n }\n else\n {\n document.getElementById('select_block').style.display = \"block\";\n document.getElementById('text_block').style.display = \"none\";\n document.getElementById('textarea_block').style.display = \"none\";\n }\n }\n\n -->\n </script>\nEOT;\n\n $title = ($type == 'edit') ? 'members.edit_member_field' : 'members.create_member_field';\n\n $i = 0;\n\n // Form declaration\n\n $r .= Cp::formOpen(array('action' => 'C=Administration'.AMP.'M=members'.AMP.'P=update_profile_fields'.AMP.'U=1'));\n $r .= Cp::input_hidden('m_field_id', $m_field_id);\n $r .= Cp::input_hidden('cur_field_name', $m_field_name);\n\n $r .= Cp::table('tableBorder', '0', '10', '100%').\n '<tr>'.PHP_EOL.\n Cp::td('tableHeading', '', '2').__($title).'</td>'.PHP_EOL.\n '</tr>'.PHP_EOL;\n\n\n // ------------------------------------\n // Field name\n // ------------------------------------\n\n $r .= '<tr>'.PHP_EOL;\n $r .= Cp::tableCell('', Cp::quickSpan('defaultBold', Cp::required().NBS.__('members.fieldname')).Cp::quickDiv('littlePadding', __('members.fieldname_cont')), '40%');\n $r .= Cp::tableCell('', Cp::input_text('m_field_name', $m_field_name, '50', '60', 'input', '300px'), '60%');\n $r .= '</tr>'.PHP_EOL;\n\n // ------------------------------------\n // Field label\n // ------------------------------------\n\n $r .= '<tr>'.PHP_EOL;\n $r .= Cp::tableCell('', Cp::quickSpan('defaultBold', Cp::required().NBS.__('members.fieldlabel')).Cp::quickDiv('littlePadding', __('members.for_profile_page')), '40%');\n $r .= Cp::tableCell('', Cp::input_text('m_field_label', $m_field_label, '50', '60', 'input', '300px'), '60%');\n $r .= '</tr>'.PHP_EOL;\n\n // ------------------------------------\n // Field Description\n // ------------------------------------\n\n $r .= '<tr>'.PHP_EOL;\n $r .= Cp::tableCell('', Cp::quickSpan('defaultBold', __('members.field_description')).Cp::quickDiv('littlePadding', __('members.field_description_info')), '40%');\n $r .= Cp::tableCell('', Cp::input_textarea('m_field_description', $m_field_description, '4', 'textarea', '100%'), '60%');\n $r .= '</tr>'.PHP_EOL;\n\n // ------------------------------------\n // Field order\n // ------------------------------------\n\n if ($type == 'new')\n $m_field_order = $total_fields;\n\n $r .= '<tr>'.PHP_EOL;\n $r .= Cp::tableCell('', Cp::quickSpan('defaultBold', __('admin.field_order')), '40%');\n $r .= Cp::tableCell('', Cp::input_text('m_field_order', $m_field_order, '4', '3', 'input', '30px'), '60%');\n $r .= '</tr>'.PHP_EOL;\n\n // ------------------------------------\n // Field type\n // ------------------------------------\n\n $sel_1 = ''; $sel_2 = ''; $sel_3 = '';\n $text_js = ($type == 'edit') ? 'none' : 'block';\n $textarea_js = 'none';\n $select_js = 'none';\n $select_opt_js = 'none';\n\n switch ($m_field_type)\n {\n case 'text' : $sel_1 = 1; $text_js = 'block';\n break;\n case 'textarea' : $sel_2 = 1; $textarea_js = 'block';\n break;\n case 'select' : $sel_3 = 1; $select_js = 'block'; $select_opt_js = 'block';\n break;\n }\n\n // ------------------------------------\n // Create the pull-down menu\n // ------------------------------------\n\n $typemenu = \"<select name='m_field_type' class='select' onchange='showhide_element(this.options[this.selectedIndex].value);' >\".PHP_EOL;\n $typemenu .= Cp::input_select_option('text', __('admin.text_input'), $sel_1)\n .Cp::input_select_option('textarea', __('admin.textarea'), $sel_2)\n .Cp::input_select_option('select', __('admin.select_list'), $sel_3)\n .Cp::input_select_footer();\n\n\n // ------------------------------------\n // Field width\n // ------------------------------------\n\n if ($m_field_width == '') {\n $m_field_width = '100%';\n }\n\n $r .= '<tr>'.PHP_EOL;\n $r .= Cp::tableCell('', Cp::quickSpan('defaultBold', __('members.field_width')).Cp::quickDiv('littlePadding', __('members.field_width_cont')), '40%');\n $r .= Cp::tableCell('', Cp::input_text('m_field_width', $m_field_width, '8', '6', 'input', '60px'), '60%');\n $r .= '</tr>'.PHP_EOL;\n\n // ------------------------------------\n // Max-length Field\n // ------------------------------------\n\n if ($m_field_maxl == '') $m_field_maxl = '100';\n\n $typopts = '<div id=\"text_block\" style=\"display: '.$text_js.'; padding:0; margin:5px 0 0 0;\">';\n $typopts .= Cp::quickDiv('defaultBold', __('members.max_length')).Cp::quickDiv('littlePadding', Cp::input_text('m_field_maxl', $m_field_maxl, '4', '3', 'input', '30px'));\n $typopts .= '</div>'.PHP_EOL;\n\n // ------------------------------------\n // Textarea Row Field\n // ------------------------------------\n\n if ($m_field_ta_rows == '') $m_field_ta_rows = '10';\n\n $typopts .= '<div id=\"textarea_block\" style=\"display: '.$textarea_js.'; padding:0; margin:5px 0 0 0;\">';\n $typopts .= Cp::quickDiv('defaultBold', __('members.text_area_rows')).Cp::quickDiv('littlePadding', Cp::input_text('m_field_ta_rows', $m_field_ta_rows, '4', '3', 'input', '30px'));\n $typopts .= '</div>'.PHP_EOL;\n\n // ------------------------------------\n // Select List Field\n // ------------------------------------\n\n $typopts .= '<div id=\"select_block\" style=\"display: '.$select_js.'; padding:0; margin:5px 0 0 0;\">';\n $typopts .= Cp::quickDiv('defaultBold', __('members.pull_down_items')).Cp::quickDiv('default', __('members.field_list_instructions')).Cp::input_textarea('m_field_list_items', $m_field_list_items, 10, 'textarea', '400px');\n $typopts .= '</div>'.PHP_EOL;\n\n\n // ------------------------------------\n // Generate the above items\n // ------------------------------------\n\n $r .= '<tr>'.PHP_EOL;\n $r .= Cp::tableCell('', Cp::quickDiv('littlePadding', Cp::quickSpan('defaultBold', __('admin.field_type'))).$typemenu, '50%', 'top');\n $r .= Cp::tableCell('', $typopts, '50%', 'top');\n $r .= '</tr>'.PHP_EOL;\n\n // ------------------------------------\n // Is field required?\n // ------------------------------------\n\n if ($m_field_required == '') $m_field_required = 'n';\n\n $r .= '<tr>'.PHP_EOL;\n $r .= Cp::tableCell('', Cp::quickSpan('defaultBold', __('members.is_field_required')), '40%');\n $r .= Cp::tableCell('', __('cp.yes').' '.Cp::input_radio('m_field_required', 'y', ($m_field_required == 'y') ? 1 : '').' '.__('cp.no').' '.Cp::input_radio('m_field_required', 'n', ($m_field_required == 'n') ? 1 : ''), '60%');\n $r .= '</tr>'.PHP_EOL;\n\n\n // ------------------------------------\n // Is field public?\n // ------------------------------------\n\n if ($m_field_public == '') $m_field_public = 'y';\n\n $r .= '<tr>'.PHP_EOL;\n $r .= Cp::tableCell('', Cp::quickSpan('defaultBold', __('members.is_field_public')).Cp::quickDiv('littlePadding', __('members.is_field_public_cont')), '40%');\n $r .= Cp::tableCell('', __('cp.yes').' '.Cp::input_radio('m_field_public', 'y', ($m_field_public == 'y') ? 1 : '').' '.__('cp.no').' '.Cp::input_radio('m_field_public', 'n', ($m_field_public == 'n') ? 1 : ''), '60%');\n $r .= '</tr>'.PHP_EOL;\n\n // ------------------------------------\n // Is field visible in reg page?\n // ------------------------------------\n\n if ($m_field_reg == '') $m_field_reg = 'n';\n\n $r .= '<tr>'.PHP_EOL;\n $r .= Cp::tableCell('', Cp::quickSpan('defaultBold', __('members.is_field_reg')).Cp::quickDiv('littlePadding', __('members.is_field_public_cont')), '40%');\n $r .= Cp::tableCell('', __('cp.yes').' '.Cp::input_radio('m_field_reg', 'y', ($m_field_reg == 'y') ? 1 : '').' '.__('cp.no').' '.Cp::input_radio('m_field_reg', 'n', ($m_field_reg == 'n') ? 1 : ''), '60%');\n $r .= '</tr>'.PHP_EOL;\n\n\n $r .= '</table>'.PHP_EOL;\n\n $r .= Cp::div('littlePadding');\n $r .= Cp::required(1).BR.BR;\n\n if ($type == 'edit')\n $r .= Cp::input_submit(__('members.update'));\n else\n $r .= Cp::input_submit(__('cp.submit'));\n\n $r .= '</div>'.PHP_EOL;\n\n $r .= '</form>'.PHP_EOL;\n\n Cp::$title = __('members.edit_member_field');\n Cp::$crumb = Cp::anchor(BASE.'?C=Administration'.AMP.'area=members_and_groups', __('admin.members_and_groups')).\n Cp::breadcrumbItem(Cp::anchor(BASE.'?C=Administration'.AMP.'M=members'.AMP.'P=profile_fields', __('members.custom_member_fields'))).\n Cp::breadcrumbItem(__('members.edit_member_field'));\n Cp::$body = $r;\n }",
"public function payment_fields() {\n\n\t\t$this->log( 'Show Payment fields on the checkout page' );\n\n\t\t$referer = isset( $_SERVER['HTTP_REFERER'] ) ? $_SERVER['HTTP_REFERER'] : \"\";\n\n\t\t$this->log( 'Received GET data from [' . $referer. ']:' );\n\t\t$this->log( print_r($_GET, true ) );\n\n\t\t$this->log( 'Received POST data from [' . $referer. ']:' );\n\t\t$this->log( print_r($_POST, true ) );\n\n\t\tif ( $this->description ) {\n\t\t\techo wpautop( wp_kses_post( $this->description ) );\n\t\t}\n\t}",
"public function payment_fields() {\n\t\tparent::payment_fields();\n\t\t?>\n\t\t<?php if ( $this->mode === 'SELECT' ): ?>\n\t\t\t<label for=\"factoring-menu\"></label>\n\t\t\t<label for=\"social-security-number\"><?php echo __( 'Please select payment method:', 'woocommerce-gateway-payex-payment' ); ?></label>\n\t\t\t<select name=\"factoring-menu\" id=\"factoring-menu\" class=\"required-entry\">\n\t\t\t\t<option selected value=\"FINANCING\"><?php echo __( 'Financing Invoice', 'woocommerce-gateway-payex-payment' ); ?></option>\n\t\t\t\t<option value=\"CREDITACCOUNT\"><?php echo __( 'Part Payment', 'woocommerce-gateway-payex-payment' ); ?></option>\n\t\t\t</select>\n\t\t\t<div class=\"clear\"></div>\n\t\t<?php endif; ?>\n\n\t\t<?php if ( $this->checkout_field !== 'yes' ): ?>\n\t\t\t<label for=\"social-security-number\"><?php echo __( 'Social Security Number:', 'woocommerce-gateway-payex-payment' ); ?></label>\n\t\t\t<input type=\"text\" name=\"social-security-number\" id=\"social-security-number\" value=\"\" autocomplete=\"off\">\n\t\t<?php endif; ?>\n\n\t\t<div class=\"clear\"></div>\n\t\t<?php\n\t}",
"function payment_fields(){\r\n if($this -> description) echo wpautop(wptexturize($this -> description));\r\n }",
"public function form()\n {\n $this->number('month', '贷款月数')\n ->min(1)\n ->max(360)\n ->required();\n $this->number('total', '贷款总额')\n ->required();\n $this->rate('rate', '贷款利率')\n ->required();\n $this->radio('type', '还款方式')\n ->options(Loan::$typeMap)\n ->required();\n\n $this->html('等额本金法与等额本息法并没有很大的优劣之分,大部分是根据每个人的现状和需求而定的。');\n $this->html('<a target=\"_blank\" href=\"https://zhuanlan.zhihu.com/p/61140535\">等额本息和等额本金的区别!</a>');\n }",
"public function add_edit_form_fields() {\r\n\r\n\t\t?>\r\n\r\n\t\t<input type=\"hidden\" name=\"yz_edit_activity_nonce\" value=\"<?php echo wp_create_nonce( 'youzer-edit-activity' ); ?>\">\r\n\r\n\t\t<?php\r\n\r\n\t}",
"function payment_fields() {\n\t\t\tif ($this->description) echo wpautop(wptexturize($this->description));\n\t\t}",
"function payment_fields() {\n\t\t\tif ($this->description) echo wpautop(wptexturize($this->description));\n\t\t}",
"function payment_fields() {\n?>\n\t\t<?php if ($this->tran_mode=='sandbox') : ?><p><?php _e('TEST MODE/SANDBOX ENABLED', WC_Authorize_SIM::TEXT_DOMAIN); ?></p><?php endif; ?>\n\t\t<?php if ($this->description) : ?><p><?php echo wpautop(wptexturize($this->description)); ?></p><?php endif; ?>\n<?php\n\n\t}",
"function show_your_fields_meta_box() {\n\tglobal $post;\n\t\t$meta = get_post_meta( $post->ID, 'actu_fields', true ); ?>\n\n\t<input type=\"hidden\" name=\"actu_fb_link\" value=\"<?php echo wp_create_nonce( basename(__FILE__) ); ?>\">\n\n <p>\n\t<input type=\"text\" name=\"actu_fields[text]\" id=\"actu_fields[text]\" class=\"regular-text\" value=\"<?php if (is_array($meta) && isset($meta['text'])){ echo $meta['text']; } ?>\">\n</p>\n\n\t<?php }"
] |
[
"0.6708196",
"0.64490354",
"0.641459",
"0.62661016",
"0.6213173",
"0.6174593",
"0.61309886",
"0.60636866",
"0.6015691",
"0.593236",
"0.590723",
"0.59065723",
"0.58837247",
"0.5869909",
"0.58642036",
"0.58167213",
"0.5811008",
"0.5796038",
"0.5792665",
"0.57839066",
"0.5781529",
"0.5771257",
"0.5770692",
"0.5765738",
"0.57504535",
"0.5744228",
"0.57366574",
"0.57366574",
"0.57210106",
"0.5719653"
] |
0.68618584
|
0
|
================================================================================================================= CREATE (GLOBAL) Attempts to INSERT this Endpoint object, using the class's annotated information via a HTTP POST Request.
|
public function insert(): self
{
/** @var self $data */
$data = $this;
if(!$this->validate("post", $missing))
{
throw new \Exception("[MVQN\REST\Endpoints\Endpoint] Annotations for the '".get_class($this)."' class require valid values be set ".
"on all of the following properties before attempting an insert():\n> ".implode("\n> ", $missing)."\n");
}
/** @var self $endpoint */
$endpoint = self::post($data);
return $endpoint;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function create() {\n $this->operationsModel->create($_POST);\n $this->response('',200,'Success');\n }",
"public function create()\n {\n // handled by client\n }",
"public function create()\n {\n //Not Used because using API Route\n }",
"public function create() {\n\t\treturn parent::post(false, ['api_key'=>self::$apiKey]);\n\t}",
"function createservicestep1_post()\n {\n $em = $this->doctrine->em;\n $service = new \\Entities\\Service();\n $service->setAthor($this->getCurrentUser());\n\n\n $service->title = $this->post('title', TRUE);\n $service->subtitle = $this->post('subtitle', TRUE);\n $service->phone = $this->post('phone', TRUE);\n $service->address = $this->post('address', TRUE);\n// $service->addSubCategories($this->post('categories', TRUE),$em);\n// $service->addCities($this->post('cities', TRUE),$em);\n// $icon = $this->post('icon');\n// $path= \"./resources/\".$icon['filename'];\n// file_put_contents($path, base64_decode($icon['value']));\n// $service->setIcon($path);\n// $em->persist($service);\n// $em->flush();\n $this->set_response($service, REST_Controller::HTTP_OK);\n }",
"public function create() {\n //\n }",
"function addNewEndpoint() {\n\n $sql\n = \"INSERT INTO $this->table (\n id,\n transport,\n aors,\n auth,\n context,\n use_avpf,\n media_encryption,\n dtls_ca_file,\n dtls_cert_file,\n dtls_verify,\n dtls_setup,\n ice_support,\n outbound_auth,\n force_rport,\n rtp_symmetric,\n media_use_received_transport,\n media_address,\n disallow,\n allow,\n direct_media,\n rtcp_mux,\n date_created\n )\n VALUES \n (\n '$this->id',\n '$this->transport',\n '$this->id',\n '$this->id',\n '$this->context',\n '$this->use_avpf',\n '$this->media_encryption',\n '$this->dtls_ca_file',\n '$this->dtls_cert_file',\n '$this->dtls_verify',\n '$this->dtls_setup',\n '$this->ice_support',\n '$this->outbound_auth',\n '$this->force_rport',\n '$this->rtp_symmetric',\n '$this->media_use_received_transport',\n '$this->media_address',\n '$this->disallow',\n '$this->allow',\n '$this->direct_media',\n '$this->rtcp_mux',\n '$this->date'\n );\";\n\n $sql_extensions = \"INSERT INTO $this->table_ctn_extensions (id) VALUES ('$this->id') \";\n\n// echo $sql . '<br>';\n $this->doSql($sql);\n $this->doSql($sql_extensions);\n }",
"public function create()\n {\n //\n }",
"public function create()\n {\n //\n }",
"public function create()\n {\n //\n }",
"public function create()\n {\n //\n }",
"public function create() {\n\t\t\t//\n\t\t}",
"public function create() {\n\t\t//\n\t}",
"public function create() {\n\t\t//\n\t}",
"public function create() {\n\t\t//\n\t}",
"public function create() {\n\t\t//\n\t}",
"public function create() {\n\t\t//\n\t}",
"public function create() {\n\t\t//\n\t}",
"public function create() {\n\t\t//\n\t}",
"public function create() {\n\t\t//\n\t}",
"public function create() {\n\t\t//\n\t}",
"public function create() {\n\t\t//\n\t}",
"public function create() {\n\t\t//\n\t}",
"public function create() {\n\t\t//\n\t}",
"public function create()\n {\n \n //\n }",
"public function create()\n {\n //\n }",
"public function create() {\r\n //\r\n }",
"public function create()\r\n {\r\n \r\n }",
"public function create()\n\t\t{\n\t\t\t//\n\t\t}",
"public function create()\n\t\t{\n\t\t\t//\n\t\t}"
] |
[
"0.6362813",
"0.6316869",
"0.6229014",
"0.61709535",
"0.60957533",
"0.6064938",
"0.6052681",
"0.6050523",
"0.6050523",
"0.6050523",
"0.6050523",
"0.6050359",
"0.60379225",
"0.60379225",
"0.60379225",
"0.60379225",
"0.60379225",
"0.60379225",
"0.60379225",
"0.60379225",
"0.60379225",
"0.60379225",
"0.60379225",
"0.60379225",
"0.6008843",
"0.600417",
"0.6001301",
"0.6000492",
"0.6",
"0.6"
] |
0.72158885
|
0
|
================================================================================================================= UPDATE (GLOBAL) Attempts to UPDATE this Endpoint object, using the class's annotated information via a HTTP PATCH Request.
|
public function update(): self
{
/** @var self $data */
$data = $this;
if(!$this->validate("patch", $missing))
{
throw new \Exception("[MVQN\REST\Endpoints\Endpoint] Annotations for the '".get_class($this)."' class require valid values be set ".
"on all of the following properties before attempting an update():\n> ".implode("\n> ", $missing)."\n");
}
/** @var self $endpoint */
$endpoint = self::patch($data, [ "id" => $this->getId() ]);
return $endpoint;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"protected function update() {}",
"public function update($params = []) {\n\t\tif(is_null($this->update_endpoint)) {\n\t\t\tthrow new BadMethodCallException('method not supported on this resource');\n\t\t}\n\n\t\t$params = array_merge($this->data,$params);\n\t\t$uri = $this->substitute($this->update_endpoint,$params);\n\t\t$response = $this->client->request('PATCH', $uri, ['json' => $params]);\n\n\t\t$decoded = $this->client->decode($response);\n\n\t\t$params = (array) $decoded[$this->response_key];\n\t\t$params['client'] = $this->client;\n\n\t\treturn new static($params);\n\t}",
"protected function _update()\n {\n \n }",
"protected function _update()\n {\n \n }",
"public function update()\n {\n }",
"public function testUpdate(): void { }",
"public function update() {\r\n }",
"public function update() {\r\n\r\n\t}",
"public function update()\n {\n }",
"public function update()\n {\n }",
"public function update()\n {\n }",
"public function update()\n {\n }",
"public function update()\n {\n }",
"public function update()\n {\n }",
"public function update()\n {\n }",
"public function update()\n {\n }",
"public function update()\n {\n }",
"public function update()\n {\n }",
"public function update()\n {\n }",
"public function update()\n {\n }",
"public function testUpdate()\n {\n $model = $this->makeFactory();\n $model->save();\n\n $newModel = $this->makeFactory();\n\n $this->json('PUT', static::ROUTE . '/' . $model->id, $newModel->toArray(), [\n 'Authorization' => 'Token ' . self::getToken()\n ])\n ->seeStatusCode(JsonResponse::HTTP_OK) \n ->seeJson($newModel->toArray());\n }",
"public function update($data) {}",
"public function update($data) {}",
"public function update()\n\t{\n\n\t}",
"public function testUpdate()\n\t{\n\t\t// Update just updates the given fields, let's the rest unchanged.\n\t\t// Use Replace to replace all fields.\n\t\t$updateProduct = [\n\t\t\t'description' => 'This is a product description.',\n\t\t\t'price' => 1150.00\n\t\t];\n\n\t\t$service = $this->getService();\n\n\t\t// Update product\n\t\t$this->mockResponseFromFile('products.update.success');\n\t\t$response = $service->update()->pin('AD8CCDD5F9')->area('work')->spn('MBA11')->product($updateProduct)->execute();\n\t\t$this->assertIsArray($response);\n\t\t$this->assertArrayHasKey('kind', $response);\n\t\t$this->assertArrayHasKey('link', $response);\n\t}",
"protected function _update()\n\t{\n\t}",
"public function testUpdate()\n {\n $requestInstance = null;\n\n $this->router->patch('/customers/{id}/relationships/{relationship}', [\n 'middleware' => ['request', 'response'],\n function(\\Luminary\\Http\\Requests\\Update $request) use(&$requestInstance) {\n $requestInstance = $request;\n }\n ]);\n\n $data = [\n 'data' => [\n 'type' => 'location',\n 'id' => '1234'\n ]\n ];\n\n $this->json('PATCH', 'customers/1234/relationships/location', $data , $this->headers());\n\n $this->assertResponseStatus(204);\n $this->assertInstanceOf(\\Luminary\\Http\\Requests\\Update::class, $requestInstance);\n $this->assertInstanceOf(CustomerAuthorize::class, $requestInstance->getAuthorize());\n $this->assertInstanceOf(\\Luminary\\Http\\Requests\\Update::class, $requestInstance->validatorArgs());\n $this->assertInstanceOf(\\Luminary\\Services\\Sanitation\\DefaultSanitizable::class, $requestInstance->getSanitizable());\n }",
"public function update()\n {\n\n }",
"public function update()\n {\n\n }",
"public function update()\r\n {\r\n \r\n }"
] |
[
"0.6512929",
"0.65069854",
"0.63918966",
"0.63918966",
"0.6364106",
"0.63241416",
"0.62941736",
"0.62679046",
"0.62506187",
"0.62506187",
"0.62506187",
"0.62506187",
"0.62506187",
"0.62506187",
"0.62506187",
"0.62506187",
"0.62506187",
"0.62506187",
"0.62506187",
"0.62506187",
"0.6237712",
"0.62317705",
"0.62317705",
"0.61968106",
"0.6158287",
"0.61472225",
"0.6143781",
"0.61305034",
"0.61305034",
"0.6117946"
] |
0.7217586
|
0
|
Expects an array of items. The items are either IPs or IPs separated by comma, space or tab. Or an array of IP's. We then examine all IP's looking for a public IP and storing private IP's in an array. If we find no public IPs we return the first private addr we found.
|
private function _getCleanIPAndServerVar($arr) {
$privates = array(); //Store private addrs until end as last resort.
foreach ($arr as $entry) {
list($item, $var) = $entry;
if (is_array($item)) {
foreach ($item as $j) {
// try verifying the IP is valid before stripping the port off
if (!$this->_isValidIP($j)) {
$j = preg_replace('/:\d+$/', '', $j); //Strip off port
}
if ($this->_isValidIP($j)) {
if ($this->_isIPv6MappedIPv4($j)) {
$j = wfWAFUtils::inet_ntop(wfWAFUtils::inet_pton($j));
}
if ($this->_isPrivateIP($j)) {
$privates[] = array($j, $var);
}
else {
return array($j, $var);
}
}
}
continue; //This was an array so we can skip to the next item
}
$skipToNext = false;
$trustedProxies = explode("\n", wfWAF::getInstance()->getStorageEngine()->getConfig('howGetIPs_trusted_proxies', ''));
foreach (array(',', ' ', "\t") as $char) {
if (strpos($item, $char) !== false) {
$sp = explode($char, $item);
$sp = array_reverse($sp);
foreach ($sp as $index => $j) {
$j = trim($j);
if (!$this->_isValidIP($j)) {
$j = preg_replace('/:\d+$/', '', $j); //Strip off port
}
if ($this->_isValidIP($j)) {
if ($this->_isIPv6MappedIPv4($j)) {
$j = wfWAFUtils::inet_ntop(wfWAFUtils::inet_pton($j));
}
foreach ($trustedProxies as $proxy) {
if (!empty($proxy)) {
if (wfWAFUtils::subnetContainsIP($proxy, $j) && $index < count($sp) - 1) {
continue 2;
}
}
}
if ($this->_isPrivateIP($j)) {
$privates[] = array($j, $var);
}
else {
return array($j, $var);
}
}
}
$skipToNext = true;
break;
}
}
if ($skipToNext){ continue; } //Skip to next item because this one had a comma, space or tab so was delimited and we didn't find anything.
if (!$this->_isValidIP($item)) {
$item = preg_replace('/:\d+$/', '', $item); //Strip off port
}
if ($this->_isValidIP($item)) {
if ($this->_isIPv6MappedIPv4($item)) {
$item = wfWAFUtils::inet_ntop(wfWAFUtils::inet_pton($item));
}
if ($this->_isPrivateIP($item)) {
$privates[] = array($item, $var);
}
else {
return array($item, $var);
}
}
}
if (sizeof($privates) > 0) {
return $privates[0]; //Return the first private we found so that we respect the order the IP's were passed to this function.
}
return false;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function ipextract ($str, $remote_ip='')\r\n{\r\n global $ip_private_arr;\r\n\r\n if (empty($ip_private_arr) || !is_array($ip_private_arr)) {\r\n $ip_private_arr = array();\r\n $ip_private_arr[] = array('from' => '0.0.0.0', 'to' => '9.255.255.255');\r\n $ip_private_arr[] = array('from' => '10.0.0.0', 'to' => '10.255.255.255');\r\n $ip_private_arr[] = array('from' => '97.160.0.0', 'to' => '97.255.255.255');\r\n $ip_private_arr[] = array('from' => '100.0.0.0', 'to' => '111.255.255.255');\r\n $ip_private_arr[] = array('from' => '127.0.0.0', 'to' => '127.255.255.255');\r\n $ip_private_arr[] = array('from' => '145.0.0.0', 'to' => '145.0.255.255');\r\n $ip_private_arr[] = array('from' => '163.0.0.0', 'to' => '163.0.255.255');\r\n $ip_private_arr[] = array('from' => '169.254.0.0', 'to' => '169.254.255.255');\r\n $ip_private_arr[] = array('from' => '172.0.0.0', 'to' => '172.127.255.255');\r\n $ip_private_arr[] = array('from' => '175.0.0.0', 'to' => '185.255.255.255');\r\n $ip_private_arr[] = array('from' => '191.0.0.0', 'to' => '192.0.255.255');\r\n $ip_private_arr[] = array('from' => '192.88.0.0', 'to' => '192.88.255.255');\r\n $ip_private_arr[] = array('from' => '192.101.0.0', 'to' => '192.114.255.255');\r\n $ip_private_arr[] = array('from' => '192.140.0.0', 'to' => '192.145.255.255');\r\n $ip_private_arr[] = array('from' => '192.168.0.0', 'to' => '192.178.255.255');\r\n $ip_private_arr[] = array('from' => '194.55.0.0', 'to' => '194.55.255.255');\r\n $ip_private_arr[] = array('from' => '198.17.0.0', 'to' => '198.20.255.255');\r\n $ip_private_arr[] = array('from' => '224.0.0.0', 'to' => '239.255.255.255');\r\n }\r\n\r\n $iplong = ip2long(trim($remote_ip));\r\n $valarr = empty($str) ? array() : preg_split('/[,\\s]+/', trim($str));\r\n foreach ($valarr as $ipval) {\r\n if (preg_match('%(\\d{1,3}(?:[.]\\d{1,3}){3})%', $ipval, $matches)) {\r\n $iptest = ip2long($matches[1]);\r\n if ($iptest) {\r\n if (empty($iplong)) $iplong = $iptest;\r\n if (!empty($ip_private_arr)) {\r\n foreach ($ip_private_arr as $ip_range) {\r\n $ipfrom = ip2long(trim($ip_range['from']));\r\n $ipto = ip2long(trim($ip_range['to']));\r\n if ($ipfrom<=$iptest && $iptest<=$ipto) {\r\n $iptest = 0;\r\n break;\r\n }\r\n }\r\n if ($iptest) $iplong = $iptest;\r\n }\r\n }\r\n }\r\n }\r\n return (!$iplong || $iplong==-1) ? FALSE : long2ip($iplong);\r\n}",
"private function getIpsFromAnything($item)\n {\n if (starts_with($item, 'country:')) {\n return [$item];\n }\n\n $item = $this->ipAddress()->hostToIp($item);\n\n if ($this->ipAddress()->ipV4Valid($item)) {\n return [$item];\n }\n\n return $this->readFile($item);\n }",
"public function getIPs ($first = false, $ipv6 = true) {\n\t\t$cmd = '/sbin/ifconfig';\n\t\tif (!file_exists($cmd)) {\n\t\t\treturn false;\n\t\t}\n\n\t\t$ifconfig = `${cmd}`;\n\t\tif (!preg_match_all('/inet' . ($ipv6 ? '6?' : '') . ' addr: ?([^ ]+)/', $ifconfig, $ips)) {\n\t\t\treturn false;\n\t\t}\n\t\tif ($first === true) {\n\t\t\treturn $ips[1][0];\n\t\t}\n\t\treturn $ips[1];\n\t}",
"public static function fetch_alt_ip() {\n $alt_ip = $_SERVER['REMOTE_ADDR'];\n\n if (isset($_SERVER['HTTP_CLIENT_IP'])) {\n $alt_ip = $_SERVER['HTTP_CLIENT_IP'];\n } else if (isset($_SERVER['HTTP_X_FORWARDED_FOR']) AND preg_match_all('#\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}#s', $_SERVER['HTTP_X_FORWARDED_FOR'], $matches)) {\n // try to avoid using an internal IP address, its probably a proxy\n $ranges = array(\n '10.0.0.0/8' => array(ip2long('10.0.0.0'), ip2long('10.255.255.255')),\n '127.0.0.0/8' => array(ip2long('127.0.0.0'), ip2long('127.255.255.255')),\n '169.254.0.0/16' => array(ip2long('169.254.0.0'), ip2long('169.254.255.255')),\n '172.16.0.0/12' => array(ip2long('172.16.0.0'), ip2long('172.31.255.255')),\n '192.168.0.0/16' => array(ip2long('192.168.0.0'), ip2long('192.168.255.255')),\n );\n foreach ($matches[0] AS $ip) {\n $ip_long = ip2long($ip);\n if ($ip_long === false) {\n continue;\n }\n\n $private_ip = false;\n foreach ($ranges AS $range) {\n if ($ip_long >= $range[0] AND $ip_long <= $range[1]) {\n $private_ip = true;\n break;\n }\n }\n\n if (!$private_ip) {\n $alt_ip = $ip;\n break;\n }\n }\n } else if (isset($_SERVER['HTTP_FROM'])) {\n $alt_ip = $_SERVER['HTTP_FROM'];\n }\n\n return $alt_ip;\n }",
"private static function ip2addr($intIp) {\n $arrUnknown = array(\n \"region\" => \"(unknown)\",\n \"address\" => \"(unknown)\"\n );\n $fileIp = fopen(__DIR__ . self::IPFILE, \"rb\");\n if (!$fileIp) return 1;\n $strBuf = fread($fileIp, 4);\n $intFirstRecord = self::bin2dec($strBuf);\n $strBuf = fread($fileIp, 4);\n $intLastRecord = self::bin2dec($strBuf);\n $intCount = floor(($intLastRecord - $intFirstRecord) / 7);\n if ($intCount < 1) return 2;\n $intStart = 0;\n $intEnd = $intCount;\n while ($intStart < $intEnd - 1) {\n $intMid = floor(($intStart + $intEnd) / 2);\n $intOffset = $intFirstRecord + $intMid * 7;\n fseek($fileIp, $intOffset);\n $strBuf = fread($fileIp, 4);\n $intMidStartIp = self::bin2dec($strBuf);\n if ($intIp == $intMidStartIp) {\n $intStart = $intMid;\n break;\n }\n if ($intIp > $intMidStartIp) $intStart = $intMid;\n else $intEnd = $intMid;\n }\n $intOffset = $intFirstRecord + $intStart * 7;\n fseek($fileIp, $intOffset);\n $strBuf = fread($fileIp, 4);\n $intStartIp = self::bin2dec($strBuf);\n $strBuf = fread($fileIp, 3);\n $intOffset = self::bin2dec($strBuf);\n fseek($fileIp, $intOffset);\n $strBuf = fread($fileIp, 4);\n $intEndIp = self::bin2dec($strBuf);\n if ($intIp < $intStartIp || $intIp > $intEndIp) return $arrUnknown;\n $intOffset += 4;\n while (($intFlag = ord(fgetc($fileIp))) == 1) {\n $strBuf = fread($fileIp, 3);\n $intOffset = self::bin2dec($strBuf);\n if ($intOffset < 12) return $arrUnknown;\n fseek($fileIp, $intOffset);\n }\n switch ($intFlag) {\n case 0:\n return $arrUnknown;\n break;\n case 2:\n $intOffsetAddr = $intOffset + 4;\n $strBuf = fread($fileIp, 3);\n $intOffset = self::bin2dec($strBuf);\n if ($intOffset < 12) return $arrUnknown;\n fseek($fileIp, $intOffset);\n while (($intFlag = ord(fgetc($fileIp))) == 2 || $intFlag == 1) {\n $strBuf = fread($fileIp, 3);\n $intOffset = self::bin2dec($strBuf);\n if ($intOffset < 12) return $arrUnknown;\n fseek($fileIp, $intOffset);\n }\n if (!$intFlag) return $arrUnknown;\n $arrAddr = array(\n \"region\" => chr($intFlag)\n );\n while (ord($c = fgetc($fileIp))) $arrAddr[\"region\"] .= $c;\n fseek($fileIp, $intOffsetAddr);\n while (($intFlag = ord(fgetc($fileIp))) == 2 || $intFlag == 1) {\n $strBuf = fread($fileIp, 3);\n $intOffset = self::bin2dec($strBuf);\n if ($intOffset < 12) {\n $arrAddr[\"address\"] = \"(unknown)\";\n return $arrAddr;\n }\n fseek($fileIp, $intOffset);\n }\n if (!$intFlag) {\n $arrAddr[\"address\"] = \"(unknown)\";\n return $arrAddr;\n }\n $arrAddr[\"address\"] = chr($intFlag);\n while (ord($c = fgetc($fileIp))) $arrAddr[\"address\"] .= $c;\n return $arrAddr;\n break;\n default:\n $arrAddr = array(\"region\" => chr($intFlag));\n while (ord($c = fgetc($fileIp))) $arrAddr[\"region\"] .= $c;\n while (($intFlag = ord(fgetc($fileIp))) == 2 || $intFlag == 1) {\n $strBuf = fread($fileIp, 3);\n $intOffset = self::bin2dec($strBuf);\n if ($intOffset < 12) {\n $arrAddr[\"address\"] = \"(unknown)\";\n return $arrAddr;\n }\n fseek($fileIp, $intOffset);\n }\n if (!$intFlag) {\n $arrAddr[\"address\"] = \"(unknown)\";\n return $arrAddr;\n }\n $arrAddr[\"address\"] = chr($intFlag);\n while (ord($c = fgetc($fileIp))) $arrAddr[\"address\"] .= $c;\n return $arrAddr;\n }\n }",
"protected static function GetRemoteAddr()\n {\n $ipSet = new IPSet(IPSet::PRIVATE_NETS);\n if ( ! $ipSet->match($_SERVER[\"REMOTE_ADDR\"])) {\n return $_SERVER[\"REMOTE_ADDR\"]; // Remote ADDR is Public Address: Use this! (We want Load-Balancers with private IPs only!)\n }\n if (isset ($_SERVER[\"HTTP_X_FORWARDED_FOR\"])) {\n $forwardsRev = array_reverse($forwards = explode(\",\", $_SERVER[\"HTTP_X_FORWARDED_FOR\"]));\n for ($i=0; $i<count ($forwardsRev); $i++) {\n if ( ! $ipSet->match(trim ($forwardsRev[$i]))) {\n return $forwardsRev[$i]; // Return first non-private IP from last to first\n }\n }\n return $forwards[0]; // Return first IP if no public IP found.\n }\n return $_SERVER[\"REMOTE_ADDR\"]; // Return the private Remote-ADDR\n }",
"public function provideIpAddresses () {\n/******************************************************************************\n ** **\n ** The mapIpAddress method always returns the same coordinates no matter **\n ** what is passed into it. The first test should result in mapIpAddress **\n ** receiving 127.0.0.1 (which is what we specified in the mocked request **\n ** object) after it calls the getIpAddress method. We have already tested **\n ** the getIpAddress method in another test, so it's not strictly necessary **\n ** to have a test case with a blank IP Address. In fact, it's not strictly **\n ** necessary to test with an additional IP Address. However, it's useful to **\n ** have this data provider set up in the event that some day we update the **\n ** mapIpAddress method so that it has more logic in it. **\n ** **\n ******************************************************************************/\n return [\n ['39.7392° N, 104.9903° W', ''],\n ['39.7392° N, 104.9903° W', '151.101.113.175']\n ];\n }",
"function forwarded_ip() {\n\n $server=array(\n 'HTTP_X_FORWARDED_FOR'=>'123.123.123.123.',\n );\n\n\n $keys = array(\n 'HTTP_X_FORWARDED_FOR',\n 'HTTP_X_FORWARDED',\n 'HTTP_FORWARDED_FOR',\n 'HTTP_FORWARDED',\n 'HTTP_CLIENT_IP',\n 'HTTP_X_CLUSTER_CLIENT_IP',\n );\n\n foreach($keys as $key) {\n if(isset($server[$key])) {\n $ip_array = explode(',', $server[$key]);\n foreach($ip_array as $ip) {\n $ip = trim($ip);\n if(validateIp($ip)){\n return $ip;\n }\n\n }\n }\n }\n return '';\n }",
"function get_user_ip_address($force_string=NULL)\n{\n\t// Consider: http://stackoverflow.com/questions/4581789/how-do-i-get-user-ip-address-in-django\n\t// Consider: http://networkengineering.stackexchange.com/questions/2283/how-to-to-determine-if-an-address-is-a-public-ip-address\n\n\t$ip_addresses = array();\n\t$ip_elements = array(\n\t\t'HTTP_X_FORWARDED_FOR', 'HTTP_FORWARDED_FOR',\n\t\t'HTTP_X_FORWARDED', 'HTTP_FORWARDED',\n\t\t'HTTP_X_CLUSTER_CLIENT_IP', 'HTTP_CLUSTER_CLIENT_IP',\n\t\t'HTTP_X_CLIENT_IP', 'HTTP_CLIENT_IP',\n\t\t'REMOTE_ADDR'\n\t);\n\n\tforeach ( $ip_elements as $element ) {\n\t\tif(isset($_SERVER[$element])) {\n\t\t\tif ( !is_string($_SERVER[$element]) ) {\n\t\t\t\t// Log the value somehow, to improve the script!\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t$address_list = explode(',', $_SERVER[$element]);\n\t\t\t$address_list = array_map('trim', $address_list);\n\n\t\t\t// Not using array_merge in order to preserve order\n\t\t\tforeach ( $address_list as $x ) {\n\t\t\t\t$ip_addresses[] = $x;\n\t\t\t}\n\t\t}\n\t}\n\n\tif ( count($ip_addresses)==0 ) {\n\t\treturn FALSE;\n\n\t} elseif ( $force_string===TRUE || ( $force_string===NULL && count($ip_addresses)==1 ) ) {\n\t\treturn $ip_addresses[0];\n\n\t} else {\n\t\treturn $ip_addresses;\n\t}\n}",
"function where_is_ipaddr_configured($ipaddr, $ignore_if = \"\", $check_localip = false, $check_subnets = false, $cidrprefix = \"\") {\n\t$where_configured = array();\n\n\t$pos = strpos($ignore_if, '_virtualip');\n\tif ($pos !== false) {\n\t\t$ignore_vip_id = substr($ignore_if, $pos+10);\n\t\t$ignore_vip_if = substr($ignore_if, 0, $pos);\n\t} else {\n\t\t$ignore_vip_id = -1;\n\t\t$ignore_vip_if = $ignore_if;\n\t}\n\n\t$isipv6 = is_ipaddrv6($ipaddr);\n\n\tif ($isipv6) {\n\t\t$ipaddr = text_to_compressed_ip6($ipaddr);\n\t}\n\n\tif ($check_subnets) {\n\t\t$cidrprefix = intval($cidrprefix);\n\t\tif ($isipv6) {\n\t\t\tif (($cidrprefix < 1) || ($cidrprefix > 128)) {\n\t\t\t\t$cidrprefix = 128;\n\t\t\t}\n\t\t} else {\n\t\t\tif (($cidrprefix < 1) || ($cidrprefix > 32)) {\n\t\t\t\t$cidrprefix = 32;\n\t\t\t}\n\t\t}\n\t\t$iflist = get_configured_interface_list();\n\t\tforeach ($iflist as $if => $ifname) {\n\t\t\tif ($ignore_if == $if) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif ($isipv6) {\n\t\t\t\t$if_ipv6 = get_interface_ipv6($if);\n\t\t\t\t$if_snbitsv6 = get_interface_subnetv6($if);\n\t\t\t\t/* do not check subnet overlapping on 6rd interfaces,\n\t\t\t\t * see https://redmine.pfsense.org/issues/12371 */ \n\t\t\t\tif ($if_ipv6 && $if_snbitsv6 &&\n\t\t\t\t ((config_get_path(\"interfaces/{$if}/ipaddrv6\") != '6rd') || ($cidrprefix > $if_snbitsv6)) &&\n\t\t\t\t check_subnetsv6_overlap($ipaddr, $cidrprefix, $if_ipv6, $if_snbitsv6)) {\n\t\t\t\t\t$where_entry = array();\n\t\t\t\t\t$where_entry['if'] = $if;\n\t\t\t\t\t$where_entry['ip_or_subnet'] = get_interface_ipv6($if) . \"/\" . get_interface_subnetv6($if);\n\t\t\t\t\t$where_configured[] = $where_entry;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t$if_ipv4 = get_interface_ip($if);\n\t\t\t\t$if_snbitsv4 = get_interface_subnet($if);\n\t\t\t\tif ($if_ipv4 && $if_snbitsv4 && check_subnets_overlap($ipaddr, $cidrprefix, $if_ipv4, $if_snbitsv4)) {\n\t\t\t\t\t$where_entry = array();\n\t\t\t\t\t$where_entry['if'] = $if;\n\t\t\t\t\t$where_entry['ip_or_subnet'] = get_interface_ip($if) . \"/\" . get_interface_subnet($if);\n\t\t\t\t\t$where_configured[] = $where_entry;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t} else {\n\t\tif ($isipv6) {\n\t\t\t$interface_list_ips = get_configured_ipv6_addresses();\n\t\t} else {\n\t\t\t$interface_list_ips = get_configured_ip_addresses();\n\t\t}\n\n\t\tforeach ($interface_list_ips as $if => $ilips) {\n\t\t\tif ($ignore_if == $if) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (strcasecmp($ipaddr, $ilips) == 0) {\n\t\t\t\t$where_entry = array();\n\t\t\t\t$where_entry['if'] = $if;\n\t\t\t\t$where_entry['ip_or_subnet'] = $ilips;\n\t\t\t\t$where_configured[] = $where_entry;\n\t\t\t}\n\t\t}\n\t}\n\n\tif ($check_localip) {\n\t\tif (strcasecmp($ipaddr, text_to_compressed_ip6(config_get_path('l2tp/localip', \"\"))) == 0) {\n\t\t\t$where_entry = array();\n\t\t\t$where_entry['if'] = 'l2tp';\n\t\t\t$where_entry['ip_or_subnet'] = config_get_path('l2tp/localip');\n\t\t\t$where_configured[] = $where_entry;\n\t\t}\n\t}\n\n\treturn $where_configured;\n}",
"function ip_is_local($ip){\r\n\t\r\n\t $ipv4array = explode('.',$ip); $ipv6array = explode(':',$ip);\r\n\t $lenipv4 = count($ipv4array) ; $lenipv6 = count($ipv6array); \r\n\t $ipint = array(); \r\n\t if($lenipv4 > 0 ){//We have an ipv4 address\r\n\t\t for ($i = 0 ; $i<$lenipv4 ; $i++){\r\n\t\t\t $ipint[$i] = intval($ipv4array[$i]) ; //Generating integera values for the ips\r\n\t\t }\r\n\t\t \r\n\t\t\t//Let's see if our IP is riv ate\r\n\t\t\tif ($ipint[0] == 10) {\r\n\t\t\t\treturn true;\r\n\t\t\t} else if ($ipint[0] == 172 && $ipint[1] > 15 && $ipint[1] < 32) {\r\n\t\t\t\treturn true;\r\n\t\t\t} else if ($ipint[0] == 192 && $ipint[1] == 168) {\r\n\t\t\t\treturn true;\r\n\t\t\t}else return false ;\r\n\t }else{\r\n\t //Either something went wrong, or we are in IPV6 format.\t \r\n\t\t \r\n\t\t if( $lenipv6 > 0){//We are having a big IPV6 address here !\r\n\t\t\t //We are in IPV4. Haven't implemented IPV6 yet\r\n\t\t\t \r\n\t\t }\r\n\t\t return false ;\r\n\t }\r\n\t \r\n\t \r\n\t return false;\r\n}",
"function forwarded_ip(){\n\n // for testing \n $server = array(\n // 'HTTP_X_FORWARDED_FOR'=> \"0.0.0.0,1sd.1.2.3\",\n // 'HTTP_X_FORWARDED' => \"jlaldjfl,99adf,123.123.123.123,1.2.4.4\",\n \n );\n\n $keys = array(\n 'HTTP_X_FORWARDED_FOR', \n 'HTTP_X_FORWARDED', \n 'HTTP_FORWARDED_FOR', \n 'HTTP_FORWARDED',\n 'HTTP_CLIENT_IP', \n 'HTTP_X_CLUSTER_CLIENT_IP',\n );\n\n foreach($keys as $key){\n if(isset($_SERVER[$key])){\n $ip_array = explode(\",\",$_SERVER[$key]);\n\n foreach($ip_array as $ip){\n $ip = trim($ip);\n if(validate_ip($ip)){\n return $ip;\n }\n }\n }\n }\n\n return \"\";\n\n}",
"protected static function _get_curl_remote_ips($fp){\n\t\t\trewind($fp); $bf=fread($fp,8192); $re='/\\b\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\b/';\n\t\t\treturn preg_match_all($re,$bf,$matches) ? $matches[0] : array();\n\t\t}",
"static public function checkClientIp(array $allowed_ips = [])\n {\n array_unshift($allowed_ips, '127.0.0.1');\n $ip = static::getClientIp(); \n $check_ip_arr= explode('.',$ip); //要检测的ip拆分成数组\n \n if(!in_array($ip, $allowed_ips)) {\n foreach ($allowed_ips as $val) {\n if(strpos($val,'*')!==false){//发现有*号替代符\n $arr = explode('.', $val);\n $bl = true;//用于记录循环检测中是否有匹配成功的\n for($i=0;$i<4;$i++){\n if($arr[$i]!='*'){//不等于* 就要进来检测,如果为*符号替代符就不检查\n if($arr[$i]!=$check_ip_arr[$i]){\n $bl=false;\n break;//终止检查本个ip 继续检查下一个ip\n }\n }\n }//end for\n if($bl){//如果是true则找到有一个匹配成功的就返回\n return true;\n }\n }\n }\n \n return false;\n }\n \n return true;\n }",
"function is_private_ip($iptocheck) {\n\t$isprivate = false;\n\t$ip_private_list = array(\n\t\t\"10.0.0.0/8\",\n\t\t\"100.64.0.0/10\",\n\t\t\"172.16.0.0/12\",\n\t\t\"192.168.0.0/16\",\n\t);\n\tforeach ($ip_private_list as $private) {\n\t\tif (ip_in_subnet($iptocheck, $private) == true) {\n\t\t\t$isprivate = true;\n\t\t}\n\t}\n\treturn $isprivate;\n}",
"function verifyAndCleanAddresses($data, $subnets_allowed = 'subnets-allowed') {\n\t/** Remove extra spaces */\n\t$data = preg_replace('/\\s\\s+/', ' ', $data);\n\t\n\t/** Swap delimiters for ; */\n\t$data = str_replace(array(\"\\n\", ';', ' ', ','), ',', $data);\n\t$data = str_replace(',,', ',', $data);\n\t$data = trim($data, ',');\n\t\n\t$addresses = explode(',', $data);\n\tforeach ($addresses as $ip_address) {\n\t\t$cidr = null;\n\n\t\t$ip_address = rtrim(trim($ip_address), '.');\n\t\tif (!strlen($ip_address)) continue;\n\t\t\n\t\t/** Handle negated addresses */\n\t\tif (strpos($ip_address, '!') === 0) {\n\t\t\t$ip_address = substr($ip_address, 1);\n\t\t}\n\t\t\n\t\tif (strpos($ip_address, '/') !== false && $subnets_allowed == 'subnets-allowed') {\n\t\t\t$cidr_array = explode('/', $ip_address);\n\t\t\tlist($ip_address, $cidr) = $cidr_array;\n\t\t}\n\t\t\n\t\t/** IPv4 checks */\n\t\tif (strpos($ip_address, ':') === false) {\n\t\t\t/** Valid CIDR? */\n\t\t\tif ($cidr && !checkCIDR($cidr, 32)) return sprintf(__('%s is not valid.'), \"$ip_address/$cidr\");\n\t\t\t\n\t\t\t/** Create full IP */\n\t\t\t$ip_octets = explode('.', $ip_address);\n\t\t\tif (count($ip_octets) < 4) {\n\t\t\t\t$ip_octets = array_merge($ip_octets, array_fill(count($ip_octets), 4 - count($ip_octets), 0));\n\t\t\t}\n\t\t\t$ip_address = implode('.', $ip_octets);\n\t\t} else {\n\t\t\t/** IPv6 checks */\n\t\t\tif ($cidr && !checkCIDR($cidr, 128)) return sprintf(__('%s is not valid.'), \"$ip_address/$cidr\");\n\t\t}\n\t\t\n\t\tif (verifyIPAddress($ip_address) === false) return sprintf(__('%s is not valid.'), $ip_address);\n\t}\n\t\n\treturn $data;\n}",
"public static function validIpDataProvider() {}",
"function ipValid($ip) {\n $matches = [];\n $pattern =\"/([1-9]\\.|[1-9]\\d\\.|1\\d\\d\\.|25[0-5]\\.|2[0-4][0-9]\\.)(\\.\\d|[1-9]\\d|1\\d\\d|25[0-5]|2[0-4][0-9]){3}/\";\n preg_match($pattern, $ip, $matches);\n return $matches[0];\n}",
"private function ipArraySearch($ip, $ips)\n {\n foreach ($ips as $key => $value) {\n if (\n (isset($value['ip_address']) && $value['ip_address'] == $ip) ||\n (strval($key) == $ip) ||\n ($value == $ip)\n ) {\n return $value;\n }\n }\n }",
"public function searchableIPs() {\n\t\treturn false;\n\t}",
"function get_all_ip()\r\n{ \r\n global $db,$strings;\r\n $count = 0;\r\n $result = $db->query('SELECT ip_id,ipaddr FROM ipmap ORDER BY ipaddr ASC');\r\n\r\n while (@extract($db->fetch_array($result), EXTR_PREFIX_ALL, 'db')) {\r\n \t$iplist[$db_ip_id] = $db_ipaddr;\r\n\t\t$count ++;\r\n }\r\n\r\n\t$iplist[-1] = $strings[IPMAP_NOTASSIGNED];\r\n \r\n return $iplist;\r\n}",
"function get_ip()\n{\n\t// No IP found (will be overwritten by for\n\t// if any IP is found behind a firewall)\n\t$ip = FALSE;\n\n\t// If HTTP_CLIENT_IP is set, then give it priority\n\tif (!empty($_SERVER[\"HTTP_CLIENT_IP\"])) {\n\t\t$ip = $_SERVER[\"HTTP_CLIENT_IP\"];\n\t}\n\n\t// User is behind a proxy and check that we discard RFC1918 IP addresses\n\t// if they are behind a proxy then only figure out which IP belongs to the\n\t// user. Might not need any more hackin if there is a squid reverse proxy\n\t// infront of apache.\n\tif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {\n\n\t\t// Put the IP's into an array which we shall work with shortly.\n\t\t$ips = explode (\", \", $_SERVER['HTTP_X_FORWARDED_FOR']);\n\t\tif ($ip) {\n\t\t\tarray_unshift($ips, $ip);\n\t\t\t$ip = FALSE;\n\t\t}\n\n\t\tfor ($i = 0; $i < count($ips); $i++)\n\t\t{\n\t\t\t// Skip RFC 1918 IP's 10.0.0.0/8, 172.16.0.0/12 and\n\t\t\t// 192.168.0.0/16 -- jim kill me later with my regexp pattern\n\t\t\t// below.\n\t\t\tif (!eregi (\"^(10|172\\.16|192\\.168)\\.\", $ips[$i])) {\n\t\t\t\tif (version_compare(phpversion(), \"5.0.0\", \">=\")) {\n\t\t\t\t\tif (ip2long($ips[$i]) != false) {\n\t\t\t\t\t\t$ip = $ips[$i];\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif (ip2long($ips[$i]) != -1) {\n\t\t\t\t\t\t$ip = $ips[$i];\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Return with the found IP or the remote address\n\treturn ($ip ? $ip : $_SERVER['REMOTE_ADDR']);\n}",
"function getEachIpInRange($cidr) {\n $ips = array();\n $range = array();\n\n $cidr = explode('/', $cidr);\n $range['firstIP'] = (ip2long($cidr[0])) & ((-1 << (32 - (int)$cidr[1])));\n $range['lastIP'] = (ip2long($cidr[0])) + pow(2, (32 - (int)$cidr[1])) - 1;\n\n for ($ip = $range['firstIP']; $ip <= $range['lastIP']; $ip++) {\n $ips[] = long2ip($ip);\n }\n return $ips;\n}",
"function geoCheckIP($ip)\n{\n\t if(!filter_var($ip, FILTER_VALIDATE_IP))\n\t {\n\t\t\t throw new InvalidArgumentException(\"IP is not valid\");\n\t }\n\n\t //contact ip-server\n\t \n\t //$response=@file_get_contents('http://www.netip.de/search?query='.$ip);\n\t $response=@file_get_contents('http://api.hostip.info/country.php?ip='.$ip);\n\t \n\t if (empty($response))\n\t {\n\t\t\t throw new InvalidArgumentException(\"Error contacting Geo-IP-Server\");\n\t }\n\n\t /*\n\t //Array containing all regex-patterns necessary to extract ip-geoinfo from page\n\t $patterns=array();\n\t $patterns[\"domain\"] = '#Domain: (.*?) #i';\n\t $patterns[\"country\"] = '#Country: (.*?) #i';\n\t $patterns[\"state\"] = '#State/Region: (.*?)<br#i';\n\t $patterns[\"town\"] = '#City: (.*?)<br#i';\n\n\t //Array where results will be stored\n\t $ipInfo=array();\n\n\t //check response from ipserver for above patterns\n\t foreach ($patterns as $key => $pattern)\n\t {\n\t\t\t //store the result in array\n\t\t\t $ipInfo[$key] = preg_match($pattern,$response,$value) && !empty($value[1]) ? $value[1] : 'not found';\n\t }\n\n\t return $ipInfo;\n\t */\n\t return $response;\n}",
"function return_ns_ip($domain) {\n\tglobal $dns_ip_list_c;\n\tif (!@file_exists(\"/usr/bin/dig\")) return;\n\t$msg=array();\n\t//echo $domain.\"\\n\";\n\tfor ($i=0;$i<sizeof($dns_ip_list_c);$i++) {\n\t\t//echo sizeof($dns_ip_list_c[$i]).\"\\n\";\n\t\tfor ($j=0;$j<sizeof($dns_ip_list_c[$i]);$j++) {\n\t\t\t$nip=$dns_ip_list_c[$i][$j][1];\n\t\t\t//echo $nip.\"\\n\";\n\t\t\texec(\"dig @$nip +short +time=1 +tries=1 +retry=1 $domain\",$str,$re);\n\t\t\t//$msg[$nip]=$str[0];\n\t\t\t$msg[]=$str[0];\n\t\t\t$str=\"\";\n\t\t\t//print_r($str);\n\t\t\t//$msg[]=$\n\t\t\t//echo $dns_ip_list_c[$i][$j][1].\"\\n\";\n\t\t}\n\t}\n\t//print_r($msg);\n\treturn $msg;\n}",
"public function ipGet($ips_input = 'real', $v4_only = true)\n\t{\n $helper_class = $this->helper;\n\t\t$result = $helper_class::ipGet($ips_input, $v4_only);\n\n\t\treturn ! empty($result) ? array('real' => $result) : array();\n\t}",
"function getIpAddress()\n {\n foreach ([\n 'HTTP_CLIENT_IP',\n 'HTTP_X_FORWARDED_FOR',\n 'HTTP_X_FORWARDED',\n 'HTTP_X_CLUSTER_CLIENT_IP',\n 'HTTP_FORWARDED_FOR',\n 'HTTP_FORWARDED',\n 'REMOTE_ADDR'\n ] as $key) {\n if (array_key_exists($key, $_SERVER) === true) {\n foreach (explode(',', $_SERVER[$key]) as $ip) {\n $ip = trim($ip);\n if (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE) !== false) {\n return $ip;\n }\n }\n }\n }\n }",
"private function getIp()\n\t {\n\t \n\t if (isset($_SERVER['HTTP_X_FORWARDED_FOR']) &&( $_SERVER['HTTP_X_FORWARDED_FOR'] != '' ))\n\t {\n\t $client_ip =\n\t ( !empty($_SERVER['REMOTE_ADDR']) ) ?\n\t $_SERVER['REMOTE_ADDR']\n\t :\n\t ( ( !empty($_ENV['REMOTE_ADDR']) ) ?\n\t $_ENV['REMOTE_ADDR']\n\t :\n\t \"unknown\" );\n\t \n\t // los proxys van añadiendo al final de esta cabecera\n\t // las direcciones ip que van \"ocultando\". Para localizar la ip real\n\t // del usuario se comienza a mirar por el principio hasta encontrar\n\t // una dirección ip que no sea del rango privado. En caso de no\n\t // encontrarse ninguna se toma como valor el REMOTE_ADDR\n\t \n\t $entries = split('[, ]', $_SERVER['HTTP_X_FORWARDED_FOR']);\n\t \n\t reset($entries);\n\t while (list(, $entry) = each($entries))\n\t {\n\t $entry = trim($entry);\n\t if ( preg_match(\"/^([0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+)/\", $entry, $ip_list) )\n\t {\n\t // http://www.faqs.org/rfcs/rfc1918.html\n\t $private_ip = array(\n\t '/^0\\./',\n\t '/^127\\.0\\.0\\.1/',\n\t '/^192\\.168\\..*/',\n\t '/^172\\.((1[6-9])|(2[0-9])|(3[0-1]))\\..*/',\n\t '/^10\\..*/');\n\t \n\t $found_ip = preg_replace($private_ip, $client_ip, $ip_list[1]);\n\t \n\t if ($client_ip != $found_ip)\n\t {\n\t $client_ip = $found_ip;\n\t break;\n\t }\n\t }\n\t }\n\t }\n\t else\n\t {\n\t $client_ip =\n\t ( !empty($_SERVER['REMOTE_ADDR']) ) ?\n\t $_SERVER['REMOTE_ADDR']\n\t :\n\t ( ( !empty($_ENV['REMOTE_ADDR']) ) ?\n\t $_ENV['REMOTE_ADDR']\n\t :\n\t \"unknown\" );\n\t }\n\t \n\t return $client_ip;\n\t \n\t}",
"public static function autoUpdateServerIp()\n\t{\n\t\tfor ($i = 0; $i < 5; ++$i) {\n\t\t\t$task = Taskmanager::submit('LocalAddressesList');\n\t\t\tif ($task !== false)\n\t\t\t\tbreak;\n\t\t\tsleep(1);\n\t\t}\n\t\tif ($task === false)\n\t\t\treturn false;\n\t\t$task = Taskmanager::waitComplete($task, 10000);\n\t\tif (!isset($task['data']['addresses']) || empty($task['data']['addresses']))\n\t\t\treturn false;\n\n\t\t$serverIp = Property::getServerIp();\n\t\t$publicCandidate = 'none';\n\t\t$privateCandidate = 'none';\n\t\tforeach ($task['data']['addresses'] as $addr) {\n\t\t\tif (substr($addr['ip'], 0, 4) === '127.' || preg_match('/^\\d+\\.\\d+\\.\\d+\\.\\d+$/', $addr['ip']) !== 1)\n\t\t\t\tcontinue;\n\t\t\tif ($addr['ip'] === $serverIp)\n\t\t\t\treturn true;\n\t\t\tif (Util::isPublicIpv4($addr['ip'])) {\n\t\t\t\tif ($publicCandidate === 'none')\n\t\t\t\t\t$publicCandidate = $addr['ip'];\n\t\t\t\telse\n\t\t\t\t\t$publicCandidate = 'many';\n\t\t\t} else {\n\t\t\t\tif ($privateCandidate === 'none')\n\t\t\t\t\t$privateCandidate = $addr['ip'];\n\t\t\t\telse\n\t\t\t\t\t$privateCandidate = 'many';\n\t\t\t}\n\t\t}\n\t\tif ($publicCandidate !== 'none' && $publicCandidate !== 'many') {\n\t\t\tProperty::setServerIp($publicCandidate, true);\n\t\t\treturn true;\n\t\t}\n\t\tif ($privateCandidate !== 'none' && $privateCandidate !== 'many') {\n\t\t\tProperty::setServerIp($privateCandidate, true);\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}",
"function is_internal_IP() {\n if (is_admins())\n return true;\n $ip_prefix = array(\"172.31.\",\n \"172.\",\n \"10.\",\n \"222.200.\",\n \"192.168.\",\n \"202.116.\",\n \"211.66\",\n \"219.222\",\n \"125.217\",\n \"127.0.0.1\"\n );\n foreach ($ip_prefix as $ip) {\n if (!strncmp($_SERVER['REMOTE_ADDR'], $ip, strlen($ip)))\n return true;\n }\n return false;\n}"
] |
[
"0.67630476",
"0.61013275",
"0.6073817",
"0.6006584",
"0.56902367",
"0.55325747",
"0.546765",
"0.544421",
"0.54365015",
"0.53783697",
"0.53742075",
"0.53736985",
"0.53685486",
"0.5364715",
"0.5356141",
"0.5343204",
"0.5341343",
"0.53290904",
"0.5308127",
"0.5295665",
"0.527937",
"0.5265466",
"0.52644116",
"0.52579486",
"0.525058",
"0.5245677",
"0.5233039",
"0.52289265",
"0.5226854",
"0.522662"
] |
0.6871664
|
0
|
Whitelisted URLs (in WAF config)
|
public function beforeRunRules() {
$whitelistedURLs = wfWAF::getInstance()->getStorageEngine()->getConfig('whitelistedURLs');
if ($whitelistedURLs) {
$whitelistPattern = "";
foreach ($whitelistedURLs as $whitelistedURL) {
$whitelistPattern .= preg_replace('/\\\\\*/', '.*?', preg_quote($whitelistedURL, '/')) . '|';
}
$whitelistPattern = '/^(?:' . wfWAFUtils::substr($whitelistPattern, 0, -1) . ')$/i';
wfWAFRule::create(wfWAF::getInstance(), 0x8000000, 'rule', 'whitelist', 0, 'User Supplied Whitelisted URL', 'allow',
new wfWAFRuleComparisonGroup(
new wfWAFRuleComparison(wfWAF::getInstance(), 'match', $whitelistPattern, array(
'request.uri',
))
)
)->evaluate();
}
// Whitelisted IPs (Wordfence config)
$whitelistedIPs = wfWAF::getInstance()->getStorageEngine()->getConfig('whitelistedIPs');
if ($whitelistedIPs) {
if (!is_array($whitelistedIPs)) {
$whitelistedIPs = explode(',', $whitelistedIPs);
}
foreach ($whitelistedIPs as $whitelistedIP) {
$ipRange = new wfWAFUserIPRange($whitelistedIP);
if ($ipRange->isIPInRange(wfWAF::getInstance()->getRequest()->getIP())) {
throw new wfWAFAllowException('Wordfence whitelisted IP.');
}
}
}
// Check plugin blocking
if ($result = wfWAF::getInstance()->willPerformFinalAction(wfWAF::getInstance()->getRequest())) {
if ($result === true) { $result = 'Not available'; } // Should not happen but can if the reason in the blocks table is empty
wfWAF::getInstance()->getRequest()->setMetadata(array_merge(wfWAF::getInstance()->getRequest()->getMetadata(), array('finalAction' => $result)));
}
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function get_allowed_urls()\n {\n }",
"static function getrules_enable_login_whitelist()\r\n {\r\n global $aio_wp_security;\r\n $rules = '';\r\n\r\n if ($aio_wp_security->configs->get_value('aiowps_enable_whitelisting') == '1') {\r\n $site_url = AIOWPSEC_WP_URL;\r\n $parse_url = parse_url($site_url);\r\n $hostname = $parse_url['host'];\r\n $host_ip = gethostbyname($hostname);\r\n $special_case = false;\r\n $rules .= AIOWPSecurity_Utility_Htaccess::$enable_login_whitelist_marker_start . PHP_EOL; //Add feature marker start\r\n //If the rename login page feature is active, we will need to adjust the directives\r\n if ($aio_wp_security->configs->get_value('aiowps_enable_rename_login_page') == '1') {\r\n $secret_slug = $aio_wp_security->configs->get_value('aiowps_login_page_slug');\r\n if (!get_option('permalink_structure')) {\r\n //standard url structure is being used - ie, non permalinks\r\n $special_case = true;\r\n $rules .= '<IfModule mod_rewrite.c>' . PHP_EOL;\r\n $rules .= 'RewriteEngine on' . PHP_EOL;\r\n $rules .= 'RewriteCond %{QUERY_STRING} ^' . $secret_slug . '$' . PHP_EOL;\r\n $rules .= 'RewriteCond %{REMOTE_ADDR} !^' . preg_quote($host_ip) . '[OR]' . PHP_EOL;\r\n } else {\r\n $slug = preg_quote($secret_slug); //escape any applicable chars\r\n $rules .= '<FilesMatch \"^(' . $slug . ')\">' . PHP_EOL;\r\n }\r\n } else {\r\n $rules .= '<FilesMatch \"^(wp-login\\.php)\">' . PHP_EOL;\r\n }\r\n if (!$special_case) {\r\n $rules .= 'Order Allow,Deny' . PHP_EOL;\r\n $rules .= 'Allow from ' . $hostname . PHP_EOL;\r\n $rules .= 'Allow from ' . $host_ip . PHP_EOL;\r\n }\r\n\r\n //Let's get list of whitelisted IPs\r\n $hosts = explode(PHP_EOL, $aio_wp_security->configs->get_value('aiowps_allowed_ip_addresses'));\r\n if (!empty($hosts) && !(sizeof($hosts) == 1 && trim($hosts[0]) == '')) {\r\n $phosts = array();\r\n $num_hosts = count($hosts);\r\n $i = 0;\r\n foreach ($hosts as $host) {\r\n $host = trim($host);\r\n $or_string = ($i == $num_hosts - 1) ? '' : '[OR]'; //Add an [OR] clause for all except the last condition\r\n\r\n if (!in_array($host, $phosts)) {\r\n if (strstr($host, '*')) {\r\n $parts = array_reverse(explode('.', $host));\r\n $netmask = 32;\r\n foreach ($parts as $part) {\r\n if (strstr(trim($part), '*')) {\r\n $netmask = $netmask - 8;\r\n\r\n }\r\n }\r\n //*****Bug Fix ******\r\n //Seems that netmask does not work when using the following type of directive, ie,\r\n //RewriteCond %{REMOTE_ADDR} !^203\\.87\\.121\\.0/24\r\n\r\n //The following works:\r\n //RewriteCond %{REMOTE_ADDR} !^203\\.87\\.121\\.\r\n\r\n if($special_case){\r\n $dhost = trim(str_replace('*', '', implode('.', array_reverse($parts)),$count));\r\n if($count > 1){\r\n //means that we will have consecutive periods in the string and we must remove all except one - eg: 45.12..\r\n $dhost = rtrim($dhost, '.');\r\n $dhost = $dhost . '.';\r\n }\r\n }else{\r\n $dhost = trim( str_replace('*', '0', implode( '.', array_reverse( $parts ) ) ) . '/' . $netmask );\r\n }\r\n if (strlen($dhost) > 4) {\r\n if ($special_case) {\r\n $dhost = preg_quote($dhost); //escape any applicable chars\r\n $trule = 'RewriteCond %{REMOTE_ADDR} !^' . $dhost . $or_string . PHP_EOL;\r\n if (trim($trule) != 'RewriteCond %{REMOTE_ADDR}!=') {\r\n $rules .= $trule;\r\n }\r\n } else {\r\n $trule = 'Allow from ' . $dhost . PHP_EOL;\r\n if (trim($trule) != 'Allow from') {\r\n $rules .= $trule;\r\n }\r\n }\r\n }\r\n } else {\r\n $dhost = trim($host);\r\n //ipv6 - for now we will support only whole ipv6 addresses, NOT ranges\r\n if (strpos($dhost, ':') !== false) {\r\n //possible ipv6 addr\r\n $res = WP_Http::is_ip_address($dhost);\r\n if (FALSE === $res) {\r\n continue;\r\n }\r\n }\r\n if (strlen($dhost) > 4 || $res == '6') {\r\n if ($special_case) {\r\n $dhost = preg_quote($dhost); //escape any applicable chars\r\n $rules .= 'RewriteCond %{REMOTE_ADDR} !^' . $dhost . $or_string . PHP_EOL;\r\n } else {\r\n $rules .= 'Allow from ' . $dhost . PHP_EOL;\r\n }\r\n\r\n }\r\n }\r\n }\r\n $phosts[] = $host;\r\n $i++;\r\n }\r\n }\r\n\r\n if ($special_case) {\r\n $rules .= 'RewriteRule .* http://127.0.0.1 [L]' . PHP_EOL;\r\n $rules .= '</IfModule>' . PHP_EOL;\r\n } else {\r\n $rules .= '</FilesMatch>' . PHP_EOL;\r\n }\r\n $rules .= AIOWPSecurity_Utility_Htaccess::$enable_login_whitelist_marker_end . PHP_EOL; //Add feature marker end\r\n }\r\n\r\n return $rules;\r\n }",
"function _polylang_allowlist_tsf_urls( $allowlist ) {\n\t$allowlist[] = [ 'file' => 'autodescription/inc' ];\n\treturn $allowlist;\n}",
"function allow_configured_filters() {\n return TRUE;\n }",
"public function isUrlAllowRulesWithUrlsProvider()\r\n {\r\n return array(\r\n array(\r\n array(),\r\n '/url',\r\n true\r\n ),\r\n array(\r\n array(\r\n 'googleBot' => array(\r\n 'disallow' => array(\r\n '/url'\r\n ),\r\n ),\r\n ),\r\n '/url',\r\n true\r\n ),\r\n array(\r\n array(\r\n '*' => array(),\r\n ),\r\n '/url',\r\n true\r\n ),\r\n array(\r\n array(\r\n '*' => array(\r\n 'disallow' => array(\r\n '/url/2',\r\n ),\r\n ),\r\n ),\r\n '/url',\r\n true\r\n ),\r\n array(\r\n array(\r\n '*' => array(\r\n 'disallow' => array(\r\n '/url/2',\r\n ),\r\n ),\r\n ),\r\n '/url/2',\r\n false\r\n ),\r\n array(\r\n array(\r\n '*' => array(\r\n 'allow' => array(\r\n '/url/test2',\r\n ),\r\n 'disallow' => array(\r\n '/url',\r\n ),\r\n ),\r\n ),\r\n '/url',\r\n false\r\n ),\r\n array(\r\n array(\r\n '*' => array(\r\n 'allow' => array(\r\n '/url/test2',\r\n ),\r\n 'disallow' => array(\r\n '/url',\r\n ),\r\n ),\r\n ),\r\n '/url/any',\r\n false\r\n ),\r\n array(\r\n array(\r\n '*' => array(\r\n 'allow' => array(\r\n '/url/specificPath',\r\n ),\r\n 'disallow' => array(\r\n '/',\r\n ),\r\n ),\r\n ),\r\n '/url/specificPath',\r\n true\r\n ),\r\n );\r\n }",
"public function pll_home_url_white_list($white_list)\n {\n $white_list[] = array( 'file' => 'class-wc-ajax.php' );\n return $white_list;\n }",
"function checkWhiteList($url = '')\n{\n global $modSettings;\n\n $whitelist = array_map('trim', explode(\"\\n\", $modSettings['redirector_whitelist']));\n $host = parse_url($url, PHP_URL_HOST);\n\n if (!empty($host) && is_array($whitelist) && in_array($host, $whitelist)) {\n return true;\n }\n\n return false;\n}",
"function wpspamshield_whitelist_webhook( $bypass ) {\n\tif ( untrailingslashit( $_SERVER['REQUEST_URI'] ) === '/' . rest_get_url_prefix() . '/airstory/v1/webhook' ) {\n\t\t$bypass = true;\n\t}\n\n\treturn $bypass;\n}",
"function add_urls() {\n\tadd_rewrite_rule( '^sso-login/?', 'index.php?sso-login=sso-login', 'top' );\n add_rewrite_endpoint( 'sso-login', EP_PERMALINK);\n\n\t// URLs for step 2 of webserver oauth flow\n\tadd_rewrite_rule( '^sso-callback/?', 'index.php?sso-callback=sso-callback', 'top' );\n add_rewrite_endpoint( 'sso-callback', EP_PERMALINK);\n}",
"public function getWhitelist()\r\n {\r\n return $this->whitelist;\r\n }",
"public function IsUrlAllowWithSpecificUserAgentProvider()\r\n {\r\n return array(\r\n array(\r\n array(\r\n '*' => array(\r\n 'disallow' => array(\r\n '/fr/'\r\n ),\r\n ),\r\n ),\r\n '/fr/page2',\r\n 'MyUserAgent',\r\n false\r\n ),\r\n );\r\n }",
"private function regexWhitelist(){\n if(sizeof($this->whitelist) === 0){\n return '/[\\s\\S]*/';\n } else {\n $whitelistRegex = '/';\n\n for ($i = 0; $i < sizeof($this->whitelist); $i++) {\n $whitelistRegex .= (($whitelistRegex !== '/') ? '|' : '') . '^(http|https):\\/\\/' . $this->whitelist[$i] . '(\\/|$)';\n }\n\n return $whitelistRegex . '/';\n }\n }",
"function isWhitelisted( $url ) {\n global $whitelistregex;\n foreach( $whitelistregex as $wregex ) if( preg_match($wregex, $url) ) return true;\n return false;\n}",
"public function getWhitelist()\n {\n return $this->whitelist;\n }",
"function url_allowed ($url)\n{\n\trequire (\"url_handling_parameters.php\");\n\t\n\tif (eregiArray($url_forbidden,$url)) return false;\n\telse return true;\n}",
"function mustsee_add_url_sanitizer($default_filters) {\n\t$default_filters['url_prepend_http'] = 'mustsee_sanitize_url';\n\treturn $default_filters;\n}",
"public static function allowedDomains()\n{\n return [\n '*', // star allows all domains\n\t\t'http://localhost:8100',\n\t\t'http://localhost:3000',\n\t\t'localhost:3000',\n\t\t'localhost:8100',\n ];\n}",
"public function sanitizeLocalUrlValidUrlsDataProvider() {}",
"function getWhiteList() {\n\t\treturn $this->_whiteList;\n\t}",
"public static function allowedDomains() {\n return [\n //Need to allow * for iOS webview to work!!\n '*',\n ];\n }",
"public static function allowedDomains()\n {\n return [\n // '*', // star allows all domains\n 'http://export.mysite',\n 'http://localhost:3000',\n 'http://localhost:3030',\n 'http://localhost:3033',\n \"http://alex.dmitxe.ru\",\n \"https://alex.dmitxe.ru\",\n \"http://alex.dmitxe.ru:3333\",\n \"https://xn--80ahyfc6d7ba.xn--80aabfyii3adadgocjt5p1b.xn--p1ai\",\n \"https://xn--80aabfyii3adadgocjt5p1b.xn--p1ai\"\n\n \n \n ];\n }",
"function get_allowed_http_origins()\n {\n }",
"public function providerAllowIfAnyRuleReturnedAllow() {\n return [\n [[RequestPolicyInterface::ALLOW]],\n [[NULL, RequestPolicyInterface::ALLOW]],\n ];\n }",
"public function testRejectBlacklistedHostThoughNotTrue()\r\n {\r\n $this->config->set('URI.HostBlacklist', 'example.com');\r\n $this->assertFiltering('http://example.comcast.com', false);\r\n }",
"public function provideUrls()\n {\n return array(\n array('/'),\n array('/login'),\n array('/contact/1'),\n array('/contact/add'),\n array('/contact/1/edit'),\n array('/adresse/1/add'),\n array('/adresse/1/edit'),\n array('/validate/[email protected]')\n );\n }",
"public function add_endpoint() {\r\n add_rewrite_rule('^api/films/?(\\w+)?/?','index.php?__api=1&films=$matches[1]','top');\r\n }",
"function setWhiteList($whiteList) {\n\t\t$this->_whiteList = $whiteList;\n\t}",
"static function generateWhitelistRules(){\n\t\t$rules = Config::inst()->get('Director', 'rules');\n\t\t\n\t\t$allTopLevelRules = array();\n\t\tforeach($rules as $pattern => $controllerOptions) {\n\t\t\t//match first portion of the URL, either delimited by slash or colon or end-of-line\n\t\t\tif (preg_match('/^(.*?)(\\/|:|$)/', $pattern, $matches)){\n\t\t\t\tif (!empty($matches[1])){\n\t\t\t\t\tarray_push($allTopLevelRules, $matches[1]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\t$filteredRules = array();\n\t\tforeach($allTopLevelRules as $rule) {\n\t\t\tif (strpos($rule, '$') !== false) {\n\t\t\t\tif ($rule === '$Controller') {\n\t\t\t\t\t//special case for Controllers, add all possible controllers\n\t\t\t\t\t$subControllers = ClassInfo::subclassesFor(new Controller());\n\t\t\t\t\t\n\t\t\t\t\tforeach($subControllers as $controller){\n\t\t\t\t\t\tarray_push($filteredRules, $controller); //add the controller name as a link\n\t\t\t\t\t} \n\t\t\t\t\t\n\t\t\t\t} elseif ($rule === '$URLSegment') {\n\t\t\t\t\t//special case for SiteTree, add all possible top Level Pages\n\t\t\t\t\t$topLevelPages = SiteTree::get()->filter('ParentID', 0);\n\t\t\t\t\t\n\t\t\t\t\tforeach($topLevelPages as $page) {\n\t\t\t\t\t\t$link = $page->RelativeLink();\n\t\t\t\t\t\tarray_push($filteredRules, trim($link, '\\/ ')); //remove trailing or leading slashes from links\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t} else {\n\t\t\t\t\tuser_error('Unknown wildcard URL match found: '.$rule, E_WARNING);\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t//add the rule to a new list of rules\n\t\t\t\tarray_push($filteredRules, $rule);\n\t\t\t}\n\t\t\t\n\t\t}\n\n\t\t//filter duplicates (order doesn't matter here, as we are only interested in the first level of the rules)\n\t\t$filteredRules = array_unique($filteredRules);\n\t\treturn $filteredRules;\n\t}",
"public function testCheckURLAllowedWithoutRegex()\n {\n $original = $_SERVER;\n\n Configuration::loadFromArray([\n 'trusted.url.domains' => ['sp.example.com', 'app.example.com'],\n 'trusted.url.regex' => false,\n ], '[ARRAY]', 'simplesaml');\n\n $_SERVER['REQUEST_URI'] = '/module.php';\n\n $allowed = [\n 'https://sp.example.com/',\n 'http://sp.example.com/',\n 'https://app.example.com/',\n 'http://app.example.com/',\n ];\n foreach ($allowed as $url) {\n $this->assertEquals(HTTP::checkURLAllowed($url), $url);\n }\n\n $this->setExpectedException('\\SimpleSAML\\Error\\Exception');\n HTTP::checkURLAllowed('https://evil.com');\n\n $_SERVER = $original;\n }",
"private function _isAllowed()\r\n {\r\n $req = $this->app->request();\r\n $resource = strtoupper($req->getMethod()) . $req->getResourceUri() ;\r\n return in_array($resource, $this->config['allowed_resources']);\r\n }"
] |
[
"0.7100569",
"0.646917",
"0.63655525",
"0.6307771",
"0.6306541",
"0.61842674",
"0.61009955",
"0.6021915",
"0.59847677",
"0.59739935",
"0.59244347",
"0.5918133",
"0.58981675",
"0.5879873",
"0.584965",
"0.57975334",
"0.5774241",
"0.574594",
"0.5741521",
"0.57366335",
"0.57226276",
"0.5697123",
"0.56911",
"0.56889045",
"0.566827",
"0.56445724",
"0.5635626",
"0.5635077",
"0.56234056",
"0.56096053"
] |
0.696769
|
1
|
Returns entity map definition.
|
public static function getMap()
{
return array(
'ID' => new Entity\IntegerField('ID', array(
'primary' => true,
'autocomplete' => true
)),
'PROFILE_ID' => new Entity\IntegerField('PROFILE_ID', array(
'required' => true
)),
'PROFILE_EXEC_ID' => new Entity\IntegerField('PROFILE_EXEC_ID', array(
'required' => true
)),
'DATE_EXEC' => new Entity\DateTimeField('DATE_EXEC', array(
'default_value' => ''
)),
'TYPE' => new Entity\StringField('TYPE', array(
'required' => true
)),
'ENTITY_ID' => new Entity\IntegerField('ENTITY_ID', array(
'required' => true
)),
'FIELDS' => new Entity\TextField('FIELDS', array()),
'PROFILE' => new Entity\ReferenceField(
'PROFILE',
'\Bitrix\EsolImportxml\ProfileTable',
array('=this.PROFILE_ID' => 'ref.ID'),
array('join_type' => 'LEFT')
),
'PROFILE_EXEC' => new Entity\ReferenceField(
'PROFILE_EXEC',
'\Bitrix\EsolImportxml\ProfileExecTable',
array('=this.PROFILE_EXEC_ID' => 'ref.ID'),
array('join_type' => 'LEFT')
),
'IBLOCK_ELEMENT' => new Entity\ReferenceField(
'IBLOCK_ELEMENT',
'\Bitrix\Iblock\ElementTable',
array('=this.ENTITY_ID' => 'ref.ID'),
array('join_type' => 'LEFT')
),
'IBLOCK_SECTION' => new Entity\ReferenceField(
'IBLOCK_SECTION',
'\Bitrix\Iblock\SectionTable',
array('=this.ENTITY_ID' => 'ref.ID'),
array('join_type' => 'LEFT')
),
);
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public static function getMap()\n\t{\n\t\treturn array(\n\t\t\t'ID' => new Entity\\IntegerField('ID', array(\n\t\t\t\t'primary' => true,\n\t\t\t\t'autocomplete' => true\n\t\t\t)),\n\t\t\t'ORDER_NEW_TASK' => new Entity\\StringField('ORDER_NEW_TASK', array(\n\t\t\t\t'required' => true\n\t\t\t))\n\t\t);\n\t}",
"public static function getMap()\n\t{\n\t\treturn array(\n\t\t\tnew Main\\Entity\\IntegerField(\n\t\t\t\t'ID',\n\t\t\t\tarray(\n\t\t\t\t 'autocomplete' => true,\n\t\t\t\t 'primary' => true,\n\t\t\t\t)\n\t\t\t),\n\n\t\t\tnew Main\\Entity\\IntegerField('ORDER_ID'),\n\n\t\t\tnew Main\\Entity\\StringField(\n\t\t\t\t'ENTITY_TYPE',\n\t\t\t\tarray(\n\t\t\t\t\t'size' => 25,\n\t\t\t\t)\n\t\t\t),\n\n\t\t\tnew Main\\Entity\\IntegerField('ENTITY_ID'),\n\n\t\t\tnew Main\\Entity\\StringField(\n\t\t\t\t'TYPE',\n\t\t\t\tarray(\n\t\t\t\t\t'size' => 10,\n\t\t\t\t)\n\t\t\t),\n\n\t\t\tnew Main\\Entity\\StringField(\n\t\t\t\t'CODE',\n\t\t\t\tarray(\n\t\t\t\t\t'size' => 255,\n\t\t\t\t\t'validation' => array(__CLASS__, 'validateComment')\n\t\t\t\t)\n\t\t\t),\n\n\t\t\tnew Main\\Entity\\StringField(\n\t\t\t\t'MESSAGE',\n\t\t\t\tarray(\n\t\t\t\t\t'size' => 255,\n\t\t\t\t\t'validation' => array(__CLASS__, 'validateMessage')\n\t\t\t\t)\n\t\t\t),\n\n\t\t\tnew Main\\Entity\\StringField(\n\t\t\t\t'COMMENT',\n\t\t\t\tarray(\n\t\t\t\t\t'size' => 500,\n\t\t\t\t\t'validation' => array(__CLASS__, 'validateComment')\n\t\t\t\t)\n\t\t\t),\n\n\t\t\tnew Main\\Entity\\IntegerField('USER_ID'),\n\n\t\t\tnew Main\\Entity\\DatetimeField(\n\t\t\t\t'DATE_CREATE'\n\t\t\t),\n\n\t\t\tnew Main\\Entity\\DatetimeField(\n\t\t\t\t'DATE_UPDATE'\n\t\t\t),\n\n\t\t\tnew Main\\Entity\\BooleanField(\n\t\t\t\t'SUCCESS',\n\t\t\t\tarray(\n\t\t\t\t\t'size' => 1,\n\t\t\t\t\t'validation' => array(__CLASS__, 'validateSuccess')\n\t\t\t\t)\n\t\t\t),\n\t\t);\n\t}",
"public function getMapping() {}",
"public static function getMap()\n\t{\n\t\treturn array(\n\t\t\tnew Entity\\IntegerField('ID', array(\n\t\t\t\t'primary' => true,\n\t\t\t\t'autocomplete' => true\n\t\t\t)),\n\t\t\tnew Entity\\StringField('EXTERNAL_CHAT_ID', array(\n\t\t\t\t'validation' => array(__CLASS__, 'validateVarChar')\n\t\t\t)),\n\t\t\tnew Entity\\StringField('CONNECTOR', array(\n\t\t\t\t'validation' => array(__CLASS__, 'validateVarChar')\n\t\t\t)),\n\t\t\tnew Entity\\StringField('EXTERNAL_MESSAGE_ID', array(\n\t\t\t\t'validation' => array(__CLASS__, 'validateVarChar')\n\t\t\t)),\n\t\t);\n\t}",
"public static function getMap()\n { \n return array(\n 'ID' => array(\n 'data_type' => 'integer',\n 'primary' => true,\n 'autocomplete' => true,\n 'title' => Loc::getMessage('SEOMETA_SECTION_CHPU_ENTITY_ID_FIELD'),\n ),\n 'DATE_CHANGE' => array(\n 'data_type' => 'datetime',\n 'required' => true,\n 'title' => Loc::getMessage('SEOMETA_SECTION_CHPU_ENTITY_DATE_CHANGE_FIELD'),\n ),\n 'DATE_CREATE' => array(\n 'data_type' => 'datetime',\n 'title' => Loc::getMessage('SEOMETA_SECTION_CHPU_ENTITY_DATE_CREATE_FIELD'),\n ),\n 'ACTIVE' => array(\n 'data_type' => 'boolean',\n 'values' => array('N', 'Y'),\n 'title' => Loc::getMessage('SEOMETA_SECTION_CHPU_ENTITY_ACTIVE_FIELD'),\n ),\n 'SORT' => array(\n 'data_type' => 'integer',\n 'title' => Loc::getMessage('SEOMETA_SECTION_CHPU_ENTITY_SORT_FIELD'),\n ),\n 'NAME' => array(\n 'data_type' => 'string',\n 'validation' => array(__CLASS__, 'validateName'),\n 'title' => Loc::getMessage('SEOMETA_SECTION_CHPU_ENTITY_NAME_FIELD'),\n ),\n 'DESCRIPTION' => array(\n 'data_type' => 'text',\n 'title' => Loc::getMessage('SEOMETA_SECTION_CHPU_ENTITY_DESCRIPTION_FIELD'),\n ),\n 'PARENT_CATEGORY_ID' => array(\n 'data_type' => 'integer',\n 'required' => true,\n 'title' => Loc::getMessage('SEOMETA_SECTION_CHPU_ENTITY_PARENT_CATEGORY_ID_FIELD'),\n ), \n );\n }",
"public static function getMap()\n\t{\n\t\treturn [\n\t\t\t'ID' => new ORM\\Fields\\IntegerField(\n\t\t\t\t'ID',\n\t\t\t\t[\n\t\t\t\t\t'primary' => true,\n\t\t\t\t\t'autocomplete' => true,\n\t\t\t\t\t'title' => Loc::getMessage('EXTRA_ENTITY_ID_FIELD'),\n\t\t\t\t]\n\t\t\t),\n\t\t\t'NAME' => new ORM\\Fields\\StringField(\n\t\t\t\t'NAME',\n\t\t\t\t[\n\t\t\t\t\t'required' => true,\n\t\t\t\t\t'validation' => function()\n\t\t\t\t\t{\n\t\t\t\t\t\treturn [\n\t\t\t\t\t\t\tnew ORM\\Fields\\Validators\\LengthValidator(null, 50),\n\t\t\t\t\t\t];\n\t\t\t\t\t},\n\t\t\t\t\t'title' => Loc::getMessage('EXTRA_ENTITY_NAME_FIELD'),\n\t\t\t\t]\n\t\t\t),\n\t\t\t'PERCENTAGE' => new ORM\\Fields\\FloatField(\n\t\t\t\t'PERCENTAGE',\n\t\t\t\t[\n\t\t\t\t\t'required' => true,\n\t\t\t\t\t'title' => Loc::getMessage('EXTRA_ENTITY_PERCENTAGE_FIELD'),\n\t\t\t\t]\n\t\t\t)\n\t\t];\n\t}",
"public static function getMap()\n\t{\n\t\treturn [\n\t\t\tnew Main\\Entity\\IntegerField('TEMPLATE_ID', [\n\t\t\t\t'primary' => true,\n\t\t\t]),\n\t\t\tnew Main\\Entity\\StringField('PROVIDER', [\n\t\t\t\t'primary' => true,\n\t\t\t]),\n\t\t\tnew Main\\Entity\\ReferenceField('TEMPLATE', '\\Bitrix\\DocumentGenerator\\Model\\Template',\n\t\t\t\t['=this.TEMPLATE_ID' => 'ref.ID']\n\t\t\t),\n\t\t];\n\t}",
"public static function getMap()\n {\n return array(\n 'ID' => array(\n 'data_type' => 'integer',\n 'primary' => true,\n 'autocomplete' => true,\n 'title' => Loc::getMessage('INTEGRATION_ENTITY_ID_FIELD'),\n ),\n 'USER_ID' => array(\n 'data_type' => 'integer',\n 'validation' => array(__CLASS__, 'validateUser'),\n 'title' => Loc::getMessage('INTEGRATION_ENTITY_USER_ID_FIELD'),\n ),\n 'ELEMENT_CODE' => array(\n 'data_type' => 'string',\n 'required' => true,\n 'validation' => array(__CLASS__, 'validateElementCode'),\n 'title' => Loc::getMessage('INTEGRATION_ENTITY_ELEMENT_CODE_FIELD'),\n ),\n 'TITLE' => array(\n 'data_type' => 'string',\n 'required' => true,\n 'validation' => array(__CLASS__, 'validateTitle'),\n 'title' => Loc::getMessage('INTEGRATION_ENTITY_TITLE_FIELD'),\n ),\n 'PASSWORD_ID' => array(\n 'data_type' => 'integer',\n 'validation' => array(__CLASS__, 'validatePassword'),\n 'title' => Loc::getMessage('INTEGRATION_ENTITY_PASSWORD_ID_FIELD'),\n ),\n 'APP_ID' => array(\n 'data_type' => 'integer',\n 'validation' => array(__CLASS__, 'validateApp'),\n 'title' => Loc::getMessage('INTEGRATION_ENTITY_APP_ID_FIELD'),\n ),\n 'SCOPE' => array(\n 'data_type' => 'text',\n 'save_data_modification' => function () {\n return array(\n function ($value) {\n return is_array($value) ? implode(',', $value) : '';\n }\n );\n },\n 'fetch_data_modification' => function () {\n return array(\n function ($value) {\n return explode(',', $value);\n }\n );\n },\n 'title' => Loc::getMessage('INTEGRATION_ENTITY_SCOPE_FIELD'),\n ),\n 'QUERY' => array(\n 'data_type' => 'text',\n 'serialized' => true,\n 'title' => Loc::getMessage('INTEGRATION_ENTITY_QUERY_FIELD'),\n ),\n 'OUTGOING_EVENTS' => array(\n 'data_type' => 'text',\n 'save_data_modification' => function () {\n return array(\n function ($value) {\n return is_array($value) ? implode(',', $value) : '';\n }\n );\n },\n 'fetch_data_modification' => function () {\n return array(\n function ($value) {\n return explode(',', $value);\n }\n );\n },\n 'title' => Loc::getMessage('INTEGRATION_ENTITY_OUTGOING_EVENTS_FIELD'),\n ),\n 'OUTGOING_NEEDED' => array(\n 'data_type' => 'string',\n 'validation' => array(__CLASS__, 'validateOutgoingQueryNeeded'),\n 'title' => Loc::getMessage('INTEGRATION_ENTITY_OUTGOING_NEEDED_FIELD'),\n ),\n 'OUTGOING_HANDLER_URL' => array(\n 'data_type' => 'string',\n 'validation' => array(__CLASS__, 'validateOutgoingHandlerUrl'),\n 'title' => Loc::getMessage('INTEGRATION_ENTITY_OUTGOING_HANDLER_URL_FIELD'),\n ),\n 'WIDGET_NEEDED' => array(\n 'data_type' => 'string',\n 'validation' => array(__CLASS__, 'validateWidgetNeeded'),\n 'title' => Loc::getMessage('INTEGRATION_ENTITY_WIDGET_NEEDED_FIELD'),\n ),\n 'WIDGET_HANDLER_URL' => array(\n 'data_type' => 'string',\n 'validation' => array(__CLASS__, 'validateWidgetHandlerUrl'),\n 'title' => Loc::getMessage('INTEGRATION_ENTITY_WIDGET_HANDLER_URL_FIELD'),\n ),\n 'WIDGET_LIST' => array(\n 'data_type' => 'text',\n 'save_data_modification' => function () {\n return array(\n function ($value) {\n return is_array($value) ? implode(',', $value) : '';\n }\n );\n },\n 'fetch_data_modification' => function () {\n return array(\n function ($value) {\n return explode(',', $value);\n }\n );\n },\n 'title' => Loc::getMessage('INTEGRATION_ENTITY_WIDGET_LIST_FIELD'),\n ),\n 'APPLICATION_TOKEN' => array(\n 'data_type' => 'string',\n 'validation' => array(__CLASS__, 'validateApplicationToken'),\n 'title' => Loc::getMessage('INTEGRATION_ENTITY_APPLICATION_TOKEN_FIELD'),\n ),\n 'APPLICATION_NEEDED' => array(\n 'data_type' => 'string',\n 'validation' => array(__CLASS__, 'validateApplicationNeeded'),\n 'title' => Loc::getMessage('INTEGRATION_ENTITY_APPLICATION_NEEDED_FIELD'),\n ),\n 'APPLICATION_ONLY_API' => array(\n 'data_type' => 'string',\n 'validation' => array(__CLASS__, 'validateApplicationOnlyApi'),\n 'title' => Loc::getMessage('INTEGRATION_ENTITY_APPLICATION_ONLY_API_FIELD'),\n ),\n 'BOT_ID' => array(\n 'data_type' => 'integer',\n 'title' => Loc::getMessage('INTEGRATION_ENTITY_BOT_ID_FIELD'),\n ),\n 'BOT_HANDLER_URL' => array(\n 'data_type' => 'string',\n 'validation' => array(__CLASS__, 'validateBotHandlerUrl'),\n 'title' => Loc::getMessage('INTEGRATION_ENTITY_BOT_HANDLER_URL_FIELD'),\n ),\n 'USER' => new ReferenceField(\n 'USER',\n '\\Bitrix\\Main\\UserTable',\n array('=this.USER_ID' => 'ref.ID')\n ),\n );\n }",
"public static function getMap()\n\t{\n\t\treturn [\n\n\t\t\t(new Fields\\IntegerField('ADDRESS_ID'))\n\t\t\t\t->configurePrimary(true),\n\n\t\t\t(new Fields\\StringField('ENTITY_ID'))\n\t\t\t\t->configurePrimary(true)\n\t\t\t\t->addValidator(new Main\\ORM\\Fields\\Validators\\LengthValidator(1, 100)),\n\n\t\t\t// todo: int\n\t\t\t(new Fields\\StringField('ENTITY_TYPE'))\n\t\t\t\t->configurePrimary(true)\n\t\t\t\t->addValidator(new Main\\ORM\\Fields\\Validators\\LengthValidator(1, 50)),\n\n\t\t\t// Ref\n\n\t\t\t(new Fields\\Relations\\Reference('ADDRESS', AddressTable::class,\n\t\t\t\tJoin::on('this.ADDRESS_ID', 'ref.ID')))\n\t\t\t\t->configureJoinType('inner')\n\t\t];\n\t}",
"public static function getMap()\n {\n return [\n 'ID' => [\n 'data_type' => 'integer',\n 'primary' => true,\n 'autocomplete' => true,\n 'title' => Loc::getMessage('GENERATOR_ENTITY_ID_FIELD'),\n ],\n 'STEP' => [\n 'data_type' => 'integer',\n 'title' => Loc::getMessage('GENERATOR_ENTITY_ITEMS_STEP_FIELD'),\n ],\n 'STATUS' => [\n 'data_type' => 'integer',\n 'title' => Loc::getMessage('GENERATOR_ENTITY_STATUS_FIELD'),\n ],\n 'ITEMS_PER_STEP' => [\n 'data_type' => 'integer',\n 'title' => Loc::getMessage('GENERATOR_ENTITY_ITEMS_PER_STEP_FIELD'),\n ],\n 'CREATED' => [\n 'data_type' => 'datetime',\n 'title' => Loc::getMessage('GENERATOR_ENTITY_CREATED_FIELD'),\n ],\n ];\n }",
"public function getMappingEntityBundle();",
"public static function getMap()\n\t{\n\t\treturn [\n\t\t\t'ID' => new ORM\\Fields\\IntegerField(\n\t\t\t\t'ID',\n\t\t\t\t[\n\t\t\t\t\t'primary' => true,\n\t\t\t\t\t'autocomplete' => true,\n\t\t\t\t\t'title' => Loc::getMessage('STORE_PRODUCT_ENTITY_ID_FIELD'),\n\t\t\t\t]\n\t\t\t),\n\t\t\t'STORE_ID' => new ORM\\Fields\\IntegerField(\n\t\t\t\t'STORE_ID',\n\t\t\t\t[\n\t\t\t\t\t'required' => true,\n\t\t\t\t\t'title' => Loc::getMessage('STORE_PRODUCT_ENTITY_STORE_ID_FIELD'),\n\t\t\t\t]\n\t\t\t),\n\t\t\t'PRODUCT_ID' => new ORM\\Fields\\IntegerField(\n\t\t\t\t'PRODUCT_ID',\n\t\t\t\t[\n\t\t\t\t\t'required' => true,\n\t\t\t\t\t'title' => Loc::getMessage('STORE_PRODUCT_ENTITY_PRODUCT_ID_FIELD'),\n\t\t\t\t]\n\t\t\t),\n\t\t\t'AMOUNT' => new ORM\\Fields\\FloatField(\n\t\t\t\t'AMOUNT',\n\t\t\t\t[\n\t\t\t\t\t'title' => Loc::getMessage('STORE_PRODUCT_ENTITY_AMOUNT_FIELD'),\n\t\t\t\t]\n\t\t\t),\n\t\t\t'QUANTITY_RESERVED' => new ORM\\Fields\\FloatField(\n\t\t\t\t'QUANTITY_RESERVED',\n\t\t\t\t[\n\t\t\t\t\t'title' => Loc::getMessage('STORE_PRODUCT_ENTITY_QUANTITY_RESERVED_FIELD'),\n\t\t\t\t]\n\t\t\t),\n\t\t\t'STORE' => new ORM\\Fields\\Relations\\Reference(\n\t\t\t\t'STORE',\n\t\t\t\tStoreTable::class,\n\t\t\t\tORM\\Query\\Join::on('this.STORE_ID', 'ref.ID')\n\t\t\t),\n\t\t\t'PRODUCT' => new ORM\\Fields\\Relations\\Reference(\n\t\t\t\t'PRODUCT',\n\t\t\t\tProductTable::class,\n\t\t\t\tORM\\Query\\Join::on('this.PRODUCT_ID', 'ref.ID')\n\t\t\t),\n\t\t];\n\t}",
"public static function getMap()\n\t{\n\t\treturn array(\n\t\t\t'ID' => new Main\\Entity\\IntegerField('ID', array(\n\t\t\t\t'primary' => true,\n\t\t\t\t'autocomplete' => true,\n\t\t\t\t'title' => Loc::getMessage('DISCOUNT_ENTITY_ID_FIELD')\n\t\t\t)),\n\t\t\t'XML_ID' => new Main\\Entity\\StringField('XML_ID', array(\n\t\t\t\t'validation' => array(__CLASS__, 'validateXmlId'),\n\t\t\t\t'title' => Loc::getMessage('DISCOUNT_ENTITY_XML_ID_FIELD')\n\t\t\t)),\n\t\t\t'SITE_ID' => new Main\\Entity\\StringField('SITE_ID', array(\n\t\t\t\t'required' => true,\n\t\t\t\t'validation' => array(__CLASS__, 'validateSiteId'),\n\t\t\t\t'title' => Loc::getMessage('DISCOUNT_ENTITY_SITE_ID_FIELD')\n\t\t\t)),\n\t\t\t'TYPE' => new Main\\Entity\\IntegerField('TYPE', array(\n\t\t\t\t'required' => true,\n\t\t\t\t'default_value' => self::TYPE_DISCOUNT,\n\t\t\t\t'validation' => array(__CLASS__, 'validateType'),\n\t\t\t\t'title' => Loc::getMessage('DISCOUNT_ENTITY_TYPE_FIELD')\n\t\t\t)),\n\t\t\t'ACTIVE' => new Main\\Entity\\BooleanField('ACTIVE', array(\n\t\t\t\t'values' => array('N', 'Y'),\n\t\t\t\t'default_value' => 'Y',\n\t\t\t\t'title' => Loc::getMessage('DISCOUNT_ENTITY_ACTIVE_FIELD')\n\t\t\t)),\n\t\t\t'ACTIVE_FROM' => new Main\\Entity\\DatetimeField('ACTIVE_FROM', array(\n\t\t\t\t'default_value' => null,\n\t\t\t\t'title' => Loc::getMessage('DISCOUNT_ENTITY_ACTIVE_FROM_FIELD')\n\t\t\t)),\n\t\t\t'ACTIVE_TO' => new Main\\Entity\\DatetimeField('ACTIVE_TO', array(\n\t\t\t\t'default_value' => null,\n\t\t\t\t'title' => Loc::getMessage('DISCOUNT_ENTITY_ACTIVE_TO_FIELD')\n\t\t\t)),\n\t\t\t'RENEWAL' => new Main\\Entity\\BooleanField('RENEWAL', array(\n\t\t\t\t'values' => array('N', 'Y'),\n\t\t\t\t'default_value' => 'N',\n\t\t\t\t'title' => Loc::getMessage('DISCOUNT_ENTITY_RENEWAL_FIELD')\n\t\t\t)),\n\t\t\t'NAME' => new Main\\Entity\\StringField('NAME', array(\n\t\t\t\t'required' => true,\n\t\t\t\t'validation' => array(__CLASS__, 'validateName'),\n\t\t\t\t'title' => Loc::getMessage('DISCOUNT_ENTITY_NAME_FIELD')\n\t\t\t)),\n\t\t\t'SORT' => new Main\\Entity\\IntegerField('SORT', array(\n\t\t\t\t'title' => Loc::getMessage('DISCOUNT_ENTITY_SORT_FIELD')\n\t\t\t)),\n\t\t\t'MAX_DISCOUNT' => new Main\\Entity\\FloatField('MAX_DISCOUNT', array(\n\t\t\t\t'title' => Loc::getMessage('DISCOUNT_ENTITY_MAX_DISCOUNT_FIELD')\n\t\t\t)),\n\t\t\t'VALUE_TYPE' => new Main\\Entity\\EnumField('VALUE_TYPE', array(\n\t\t\t\t'required' => true,\n\t\t\t\t'values' => array(self::VALUE_TYPE_PERCENT, self::VALUE_TYPE_FIX, self::VALUE_TYPE_SALE),\n\t\t\t\t'default_value' => self::VALUE_TYPE_PERCENT,\n\t\t\t\t'title' => Loc::getMessage('DISCOUNT_ENTITY_VALUE_TYPE_FIELD')\n\t\t\t)),\n\t\t\t'VALUE' => new Main\\Entity\\FloatField('VALUE', array(\n\t\t\t\t'required' => true,\n\t\t\t\t'title' => Loc::getMessage('DISCOUNT_ENTITY_VALUE_FIELD')\n\t\t\t)),\n\t\t\t'CURRENCY' => new Main\\Entity\\StringField('CURRENCY', array(\n\t\t\t\t'required' => true,\n\t\t\t\t'validation' => array(__CLASS__, 'validateCurrency'),\n\t\t\t\t'title' => Loc::getMessage('DISCOUNT_ENTITY_CURRENCY_FIELD')\n\t\t\t)),\n\t\t\t'TIMESTAMP_X' => new Main\\Entity\\DatetimeField('TIMESTAMP_X', array(\n\t\t\t\t'required' => true,\n\t\t\t\t'default_value' => function()\n\t\t\t\t\t{\n\t\t\t\t\t\treturn new Main\\Type\\DateTime();\n\t\t\t\t\t},\n\t\t\t\t'title' => Loc::getMessage('DISCOUNT_ENTITY_TIMESTAMP_X_FIELD')\n\t\t\t)),\n\t\t\t'COUNT_PERIOD' => new Main\\Entity\\EnumField('COUNT_PERIOD', array(\n\t\t\t\t'values' => array(self::COUNT_PERIOD_TYPE_ALL, self::COUNT_PERIOD_TYPE_INTERVAL, self::COUNT_PERIOD_TYPE_PERIOD),\n\t\t\t\t'default_value' => self::COUNT_PERIOD_TYPE_ALL\n\t\t\t)),\n\t\t\t'COUNT_SIZE' => new Main\\Entity\\IntegerField('COUNT_SIZE', array(\n\t\t\t\t'default_value' => 0\n\t\t\t)),\n\t\t\t'COUNT_TYPE' => new Main\\Entity\\EnumField('COUNT_TYPE', array(\n\t\t\t\t'values' => array(self::COUNT_TYPE_SIZE_DAY, self::COUNT_TYPE_SIZE_MONTH, self::COUNT_TYPE_SIZE_YEAR),\n\t\t\t\t'default_value' => self::COUNT_TYPE_SIZE_YEAR\n\t\t\t)),\n\t\t\t'COUNT_FROM' => new Main\\Entity\\DatetimeField('COUNT_FROM', array(\n\t\t\t\t'default_value' => null\n\t\t\t)),\n\t\t\t'COUNT_TO' => new Main\\Entity\\DatetimeField('COUNT_TO', array(\n\t\t\t\t'default_value' => null\n\t\t\t)),\n\t\t\t'ACTION_SIZE' => new Main\\Entity\\IntegerField('ACTION_SIZE', array(\n\t\t\t\t'default_value' => 0\n\t\t\t)),\n\t\t\t'ACTION_TYPE' => new Main\\Entity\\EnumField('ACTION_TYPE', array(\n\t\t\t\t'values' => array(self::ACTION_TYPE_SIZE_DAY, self::ACTION_TYPE_SIZE_MONTH, self::ACTION_TYPE_SIZE_YEAR),\n\t\t\t\t'default_value' => self::ACTION_TYPE_SIZE_YEAR\n\t\t\t)),\n\t\t\t'MODIFIED_BY' => new Main\\Entity\\IntegerField('MODIFIED_BY', array(\n\t\t\t\t'title' => Loc::getMessage('DISCOUNT_ENTITY_MODIFIED_BY_FIELD')\n\t\t\t)),\n\t\t\t'DATE_CREATE' => new Main\\Entity\\DatetimeField('DATE_CREATE', array(\n\t\t\t\t'default_value' => null,\n\t\t\t\t'title' => Loc::getMessage('DISCOUNT_ENTITY_DATE_CREATE_FIELD')\n\t\t\t)),\n\t\t\t'CREATED_BY' => new Main\\Entity\\IntegerField('CREATED_BY', array(\n\t\t\t\t'title' => Loc::getMessage('DISCOUNT_ENTITY_CREATED_BY_FIELD')\n\t\t\t)),\n\t\t\t'PRIORITY' => new Main\\Entity\\IntegerField('PRIORITY', array(\n\t\t\t\t'default_value' => 1,\n\t\t\t\t'title' => Loc::getMessage('DISCOUNT_ENTITY_PRIORITY_FIELD')\n\t\t\t)),\n\t\t\t'LAST_DISCOUNT' => new Main\\Entity\\BooleanField('LAST_DISCOUNT', array(\n\t\t\t\t'values' => array('N', 'Y'),\n\t\t\t\t'default_value' => 'Y',\n\t\t\t\t'title' => Loc::getMessage('DISCOUNT_ENTITY_LAST_DISCOUNT_FIELD')\n\t\t\t)),\n\t\t\t'VERSION' => new Main\\Entity\\EnumField('VERSION', array(\n\t\t\t\t'values' => array(self::OLD_VERSION, self::ACTUAL_VERSION),\n\t\t\t\t'default_value' => self::ACTUAL_VERSION\n\t\t\t)),\n\t\t\t'NOTES' => new Main\\Entity\\StringField('NOTES', array(\n\t\t\t\t'validation' => array(__CLASS__, 'validateNotes'),\n\t\t\t\t'title' => Loc::getMessage('DISCOUNT_ENTITY_NOTES_FIELD')\n\t\t\t)),\n\t\t\t'CONDITIONS' => new Main\\Entity\\TextField('CONDITIONS', array()),\n\t\t\t'CONDITIONS_LIST' => new Main\\Entity\\TextField('CONDITIONS_LIST', array(\n\t\t\t\t'serialized' => true,\n\t\t\t\t'column_name' => 'CONDITIONS',\n\t\t\t\t'title' => Loc::getMessage('DISCOUNT_ENTITY_CONDITIONS_LIST_FIELD')\n\t\t\t)),\n\t\t\t'UNPACK' => new Main\\Entity\\TextField('UNPACK', array()),\n\t\t\t'USE_COUPONS' => new Main\\Entity\\BooleanField('USE_COUPONS', array(\n\t\t\t\t'values' => array('N', 'Y'),\n\t\t\t\t'default_value' => 'N',\n\t\t\t\t'title' => Loc::getMessage('DISCOUNT_ENTITY_USE_COUPONS_FIELD')\n\t\t\t)),\n\t\t\t'SALE_ID' => new Main\\Entity\\IntegerField('SALE_ID'),\n\t\t\t'CREATED_BY_USER' => new Main\\Entity\\ReferenceField(\n\t\t\t\t'CREATED_BY_USER',\n\t\t\t\t'\\Bitrix\\Main\\User',\n\t\t\t\tarray('=this.CREATED_BY' => 'ref.ID')\n\t\t\t),\n\t\t\t'MODIFIED_BY_USER' => new Main\\Entity\\ReferenceField(\n\t\t\t\t'MODIFIED_BY_USER',\n\t\t\t\t'\\Bitrix\\Main\\User',\n\t\t\t\tarray('=this.MODIFIED_BY' => 'ref.ID')\n\t\t\t),\n\t\t\t'SALE_DISCOUNT' => new Main\\Entity\\ReferenceField(\n\t\t\t\t'SALE_DISCOUNT',\n\t\t\t\t'Bitrix\\Sale\\Internals\\DiscountTable',\n\t\t\t\tarray('=this.SALE_ID' => 'ref.ID')\n\t\t\t)\n\t\t);\n\t}",
"public static function getMap()\n\t{\n\t\treturn array(\n\t\t\t'ID' => array(\n\t\t\t\t'data_type' => 'integer',\n\t\t\t\t'primary' => true,\n\t\t\t\t'autocomplete' => true,\n\t\t\t\t'title' => Loc::getMessage('LOG_ENTITY_ID_FIELD'),\n\t\t\t),\n\t\t\t'TIMESTAMP_X' => array(\n\t\t\t\t'data_type' => 'datetime',\n\t\t\t\t'required' => false,\n\t\t\t\t'title' => Loc::getMessage('LOG_ENTITY_TIMESTAMP_X_FIELD'),\n\t\t\t),\n\t\t\t'EVENT' => array(\n\t\t\t\t'data_type' => 'text',\n\t\t\t\t'required' => true,\n\t\t\t\t'title' => Loc::getMessage('LOG_ENTITY_EVENT_FIELD'),\n\t\t\t),\n\t\t);\n\t}",
"function tradeoff_map($definition)\n {\n return app(Models\\Resolution\\Map\\Map::class)->setData($definition);\n }",
"public function mapEntity(Entity $entity) {\n\t\t$entity['_loc'] = $this->_table->getUrl($entity);\n\t\t$entity['_lastmod'] = $entity->{$this->_config['lastmod']};\n\t\t$entity['_changefreq'] = $this->_config['changefreq'];\n\t\t$entity['_priority'] = $this->_config['priority'];\n\n\t\treturn $entity;\n\t}",
"public static function getMap()\n\t{\n\t\treturn [\n\t\t\tnew Main\\Entity\\IntegerField('ID', [\n\t\t\t\t'primary' => true,\n\t\t\t\t'autocomplete' => true,\n\t\t\t]),\n\t\t\tnew Main\\Entity\\IntegerField('REGION_ID', [\n\t\t\t\t'required' => true,\n\t\t\t]),\n\t\t\tnew Main\\Entity\\StringField('CODE', [\n\t\t\t\t'required' => true,\n\t\t\t]),\n\t\t\tnew Main\\Entity\\StringField('PHRASE'),\n\t\t\tnew Main\\Entity\\ReferenceField('REGION', '\\Bitrix\\DocumentGenerator\\Model\\Region',\n\t\t\t\t['=this.REGION_ID' => 'ref.ID']\n\t\t\t),\n\t\t];\n\t}",
"public static function getMap()\n {\n return array(\n 'ID' => array(\n 'data_type' => 'integer',\n 'primary' => true,\n 'autocomplete' => true,\n 'title' => Loc::getMessage('AFFILIATE_ENTITY_ID_FIELD'),\n ),\n 'TIMESTAMP_X' => new Main\\Entity\\DatetimeField('TIMESTAMP_X', array(\n 'default_value' => new Main\\Type\\DateTime(),\n 'title' => Loc::getMessage('AFFILIATE_ENTITY_TIMESTAMP_X_FIELD'),\n )),\n 'LID' => array(\n 'data_type' => 'string',\n 'required' => true,\n 'validation' => array(__CLASS__, 'validateLid'),\n 'title' => Loc::getMessage('AFFILIATE_ENTITY_LID_FIELD'),\n ),\n 'ACTIVE' => array(\n 'data_type' => 'boolean',\n 'values' => array('N', 'Y'),\n 'title' => Loc::getMessage('AFFILIATE_ENTITY_ACTIVE_FIELD'),\n ),\n 'BONUS' => array(\n 'data_type' => 'float',\n 'required' => true,\n 'title' => Loc::getMessage('AFFILIATE_ENTITY_BONUS_FIELD'),\n ),\n 'USERID' => array(\n 'data_type' => 'integer',\n 'required' => true,\n 'title' => Loc::getMessage('AFFILIATE_ENTITY_USERID_FIELD'),\n ),\n 'ACTIVE_FROM' => array(\n 'data_type' => 'datetime',\n 'title' => Loc::getMessage('AFFILIATE_ENTITY_ACTIVE_FROM_FIELD'),\n ),\n 'ACTIVE_TO' => array(\n 'data_type' => 'datetime',\n 'title' => Loc::getMessage('AFFILIATE_ENTITY_ACTIVE_TO_FIELD'),\n ),\n 'NAME' => array(\n 'data_type' => 'string',\n 'title' => Loc::getMessage('AFFILIATE_ENTITY_NAME_FIELD'),\n ),\n 'PROMOCODE' => array(\n 'data_type' => 'string',\n 'validation' => array(__CLASS__, 'validatePromocode'),\n 'title' => Loc::getMessage('AFFILIATE_ENTITY_PROMOCODE_FIELD'),\n ),\n 'DOMAINE' => array(\n 'data_type' => 'string',\n 'validation' => array(__CLASS__, 'validateDomaine'),\n 'title' => Loc::getMessage('AFFILIATE_ENTITY_DOMAINE_FIELD'),\n ),\n 'URL' => array(\n 'data_type' => 'text',\n 'title' => Loc::getMessage('AFFILIATE_ENTITY_URL_FIELD'),\n ),\n 'COMMISIA' => array(\n 'data_type' => 'string',\n 'title' => Loc::getMessage('AFFILIATE_ENTITY_COMMISIA_FIELD'),\n ),\n 'COMMISIAPROMO' => array(\n 'data_type' => 'string',\n 'title' => Loc::getMessage('AFFILIATE_ENTITY_COMMISIAPROMO_FIELD'),\n ),\n );\n }",
"abstract protected function getMapping();",
"abstract protected function getMapping();",
"public static function getMap()\n\t{\n\t\treturn array(\n\t\t\t'ID' => array(\n\t\t\t\t'data_type' => 'integer',\n\t\t\t\t'primary' => true,\n\t\t\t\t'autocomplete' => true,\n\t\t\t\t'title' => Loc::getMessage('TRACKER_ENTITY_ID_FIELD'),\n\t\t\t),\n\t\t\t'SESSION_ID' => array(\n\t\t\t\t'data_type' => 'integer',\n\t\t\t\t'title' => Loc::getMessage('TRACKER_ENTITY_SESSION_ID_FIELD'),\n\t\t\t),\n\t\t\t'CHAT_ID' => array(\n\t\t\t\t'data_type' => 'integer',\n\t\t\t\t'title' => Loc::getMessage('TRACKER_ENTITY_CHAT_ID_FIELD'),\n\t\t\t),\n\t\t\t'MESSAGE_ID' => array(\n\t\t\t\t'data_type' => 'integer',\n\t\t\t\t'title' => Loc::getMessage('TRACKER_ENTITY_MESSAGE_ID_FIELD'),\n\t\t\t),\n\t\t\t'MESSAGE_ORIGIN_ID' => array(\n\t\t\t\t'data_type' => 'integer',\n\t\t\t\t'title' => Loc::getMessage('TRACKER_ENTITY_MESSAGE_ORIGIN_ID_FIELD'),\n\t\t\t),\n\t\t\t'USER_ID' => array(\n\t\t\t\t'data_type' => 'integer',\n\t\t\t\t'title' => Loc::getMessage('TRACKER_ENTITY_USER_ID_FIELD'),\n\t\t\t),\n\t\t\t'ACTION' => array(\n\t\t\t\t'data_type' => 'string',\n\t\t\t\t'validation' => array(__CLASS__, 'validateAction'),\n\t\t\t\t'title' => Loc::getMessage('TRACKER_ENTITY_ACTION_FIELD'),\n\t\t\t),\n\t\t\t'CRM_ENTITY_TYPE' => array(\n\t\t\t\t'data_type' => 'string',\n\t\t\t\t'validation' => array(__CLASS__, 'validateCrmEntityType'),\n\t\t\t\t'title' => Loc::getMessage('TRACKER_ENTITY_CRM_ENTITY_TYPE_FIELD'),\n\t\t\t),\n\t\t\t'CRM_ENTITY_ID' => array(\n\t\t\t\t'data_type' => 'integer',\n\t\t\t\t'title' => Loc::getMessage('TRACKER_ENTITY_CRM_ENTITY_ID_FIELD'),\n\t\t\t),\n\t\t\t'FIELD_TYPE' => array(\n\t\t\t\t'data_type' => 'string',\n\t\t\t\t'validation' => array(__CLASS__, 'validateValue'),\n\t\t\t\t'title' => Loc::getMessage('TRACKER_ENTITY_FIELD_NAME_FIELD'),\n\t\t\t),\n\t\t\t'FIELD_VALUE' => array(\n\t\t\t\t'data_type' => 'string',\n\t\t\t\t'validation' => array(__CLASS__, 'validateValue'),\n\t\t\t\t'title' => Loc::getMessage('TRACKER_ENTITY_FIELD_VALUE_FIELD'),\n\t\t\t),\n\t\t\t'DATE_CREATE' => array(\n\t\t\t\t'data_type' => 'datetime',\n\t\t\t\t'title' => Loc::getMessage('TRACKER_ENTITY_DATE_CREATE_FIELD'),\n\t\t\t\t'default_value' => array(__CLASS__, 'getCurrentDate'),\n\t\t\t),\n\t\t);\n\t}",
"public static function getMap()\n {\n return array(\n 'ID' => array(\n 'data_type' => 'integer',\n 'primary' => true,\n 'autocomplete' => true,\n 'title' => Loc::getMessage('BASKET_ENTITY_ID_FIELD'),\n ),\n 'LID' => array(\n 'data_type' => 'string',\n 'required' => true,\n 'validation' => array(__CLASS__, 'validateLid'),\n 'title' => Loc::getMessage('BASKET_ENTITY_LID_FIELD'),\n ),\n 'DATATIME_INSERT' => array(\n 'data_type' => 'datetime',\n 'required' => true,\n 'title' => Loc::getMessage('BASKET_ENTITY_DATATIME_INSERT_FIELD'),\n ),\n 'DATATIME_UPDATE' => array(\n 'data_type' => 'datetime',\n 'required' => true,\n 'title' => Loc::getMessage('BASKET_ENTITY_DATATIME_UPDATE_FIELD'),\n ),\n 'ORDER_ID' => array(\n 'data_type' => 'integer',\n 'title' => Loc::getMessage('BASKET_ENTITY_ORDER_ID_FIELD'),\n ),\n 'PRODUCT_ID' => array(\n 'data_type' => 'integer',\n 'required' => true,\n 'title' => Loc::getMessage('BASKET_ENTITY_PRODUCT_ID_FIELD'),\n ),\n 'NAME' => array(\n 'data_type' => 'string',\n\n 'title' => Loc::getMessage('BASKET_ENTITY_NAME_FIELD'),\n ),\n 'PRICE' => array(\n 'data_type' => 'float',\n\n 'title' => Loc::getMessage('BASKET_ENTITY_PRICE_FIELD'),\n ),\n 'PRICEOLD' => array(\n 'data_type' => 'float',\n\n 'title' => Loc::getMessage('BASKET_ENTITY_PRICEOLD_FIELD'),\n ),\n 'OWNER_ID' => array(\n 'data_type' => 'integer',\n 'required' => true,\n 'title' => Loc::getMessage('BASKET_ENTITY_OWNER_ID_FIELD'),\n ),\n 'QUANTITY' => array(\n 'data_type' => 'integer',\n 'title' => Loc::getMessage('BASKET_ENTITY_QUANTITY_FIELD'),\n ),\n 'XML_ID' => array(\n 'data_type' => 'string',\n 'validation' => array(__CLASS__, 'validateXmlId'),\n 'title' => Loc::getMessage('BASKET_ENTITY_XML_ID_FIELD'),\n ),\n 'PROPERTY' => array(\n 'data_type' => 'string',\n 'title' => Loc::getMessage('BASKET_ENTITY_PROPERTY_FIELD'),\n 'serialized' => true\n ),\n 'DELAY' => array(\n 'data_type' => 'integer',\n 'title' => Loc::getMessage('BASKET_ENTITY_DELAY_FIELD'),\n ),\n 'DETAIL_PAGE_URL' => array(\n 'data_type' => 'string',\n 'title' => Loc::getMessage('BASKET_ENTITY_DETAIL_PAGE_URL_FIELD'),\n ),\n 'PICTURE' => array(\n 'data_type' => 'integer',\n 'title' => Loc::getMessage('BASKET_ENTITY_PICTURE_FIELD'),\n ),\n );\n }",
"protected function getMap()\n {\n if (! $this->map) {\n $this->load();\n }\n\n return $this->map;\n }",
"public static function getMap()\n {\n return self::$map;\n }",
"public static function getMap()\n\t{\n\t\treturn [\n\t\t\tnew IntegerField(\n\t\t\t\t'ID',\n\t\t\t\t[\n\t\t\t\t\t'primary' => true,\n\t\t\t\t\t'autocomplete' => true,\n\t\t\t\t\t'title' => Loc::getMessage('MONITOR_ENTITY_ENTITY_ID_FIELD')\n\t\t\t\t]\n\t\t\t),\n\t\t\tnew StringField(\n\t\t\t\t'TYPE',\n\t\t\t\t[\n\t\t\t\t\t'required' => true,\n\t\t\t\t\t'validation' => [__CLASS__, 'validateType'],\n\t\t\t\t\t'title' => Loc::getMessage('MONITOR_ENTITY_ENTITY_TYPE_FIELD')\n\t\t\t\t]\n\t\t\t),\n\t\t\tnew StringField(\n\t\t\t\t'TITLE',\n\t\t\t\t[\n\t\t\t\t\t'required' => true,\n\t\t\t\t\t'validation' => [__CLASS__, 'validateTitle'],\n\t\t\t\t\t'title' => Loc::getMessage('MONITOR_ENTITY_ENTITY_TITLE_FIELD')\n\t\t\t\t]\n\t\t\t),\n\t\t\tnew StringField(\n\t\t\t\t'PUBLIC_CODE',\n\t\t\t\t[\n\t\t\t\t\t'validation' => [__CLASS__, 'validatePublicCode'],\n\t\t\t\t\t'title' => Loc::getMessage('MONITOR_ENTITY_ENTITY_PUBLIC_CODE_FIELD')\n\t\t\t\t]\n\t\t\t),\n\t\t];\n\t}",
"public static function getMap()\n\t{\n\t\treturn array(\n\t\t\t'ID' => array(\n\t\t\t\t'data_type' => 'integer',\n\t\t\t\t'primary' => true,\n\t\t\t\t'autocomplete' => true,\n\t\t\t\t'title' => Loc::getMessage('CARD_ENTITY_ID_FIELD'),\n\t\t\t),\n\t\t\t'TIMESTAMP_X' => array(\n\t\t\t\t'data_type' => 'datetime',\n\t\t\t\t'required' => true,\n\t\t\t\t'title' => Loc::getMessage('CARD_ENTITY_TIMESTAMP_X_FIELD'),\n\t\t\t),\n\t\t\t'LID' => array(\n\t\t\t\t'data_type' => 'string',\n\t\t\t\t'required' => true,\n\t\t\t\t'validation' => array(__CLASS__, 'validateLid'),\n\t\t\t\t'title' => Loc::getMessage('CARD_ENTITY_LID_FIELD'),\n\t\t\t),\n\t\t\t'ACTIVE' => array(\n\t\t\t\t'data_type' => 'boolean',\n\t\t\t\t'values' => array('N', 'Y'),\n\t\t\t\t'title' => Loc::getMessage('CARD_ENTITY_ACTIVE_FIELD'),\n\t\t\t),\n\t\t\t'USERID' => array(\n\t\t\t\t'data_type' => 'integer',\n\t\t\t\t'title' => Loc::getMessage('CARD_ENTITY_USERID_FIELD'),\n\t\t\t),\n\t\t\t'DEFAULTBONUS' => array(\n\t\t\t\t'data_type' => 'float',\n\t\t\t\t'required' => true,\n\t\t\t\t'title' => Loc::getMessage('CARD_ENTITY_DEFAULTBONUS_FIELD'),\n\t\t\t),\n\t\t\t'BONUSACCOUNTS' => array(\n\t\t\t\t'data_type' => 'integer',\n\t\t\t\t'title' => Loc::getMessage('CARD_ENTITY_BONUSACCOUNTS_FIELD'),\n\t\t\t),\n\t\t\t'NUM' => array(\n\t\t\t\t'data_type' => 'string',\n\t\t\t\t'required' => true,\n\t\t\t\t'validation' => array(__CLASS__, 'validateNum'),\n\t\t\t\t'title' => Loc::getMessage('CARD_ENTITY_NUM_FIELD'),\n\t\t\t),\n\t\t);\n\t}",
"public function getMapping()\n {\n return $this->mapping;\n }",
"public static function getMap()\n {\n return array(\n 'ID' => array(\n 'data_type' => 'integer',\n 'primary' => true,\n 'autocomplete' => true\n ),\n 'APP_ID' => array(\n 'data_type' => 'string',\n 'required' => true,\n 'validation' => array(__CLASS__, 'validateVarchar128'),\n ),\n 'CODE' => array(\n 'data_type' => 'string',\n 'required' => true,\n 'validation' => array(__CLASS__, 'validateVarchar128'),\n ),\n 'TYPE' => array(\n 'data_type' => 'string',\n 'required' => true,\n 'validation' => array(__CLASS__, 'validateType'),\n ),\n 'HANDLER' => array(\n 'data_type' => 'string',\n 'required' => true,\n 'validation' => array(__CLASS__, 'validateHandler'),\n ),\n 'DATE_ADD' => array(\n 'data_type' => 'datetime',\n 'default_value' => new Main\\Type\\DateTime(),\n ),\n 'AUTHOR_ID' => array(\n 'data_type' => 'integer',\n 'default_value' => 0,\n ),\n 'AUTHOR' => array(\n 'data_type' => '\\Bitrix\\Main\\UserTable',\n 'reference' => array(\n '=this.AUTHOR_ID' => 'ref.ID'\n ),\n 'join_type' => 'LEFT',\n ),\n );\n }",
"public function mapFor()\n {\n // Here we tell Doctrine that this mapping is for the Scientist object.\n return Article::class;\n }",
"public static function get_map_explorer_definition() {\n return array(\n 'title' => 'Map explorer',\n 'category' => 'Reporting',\n 'description' => 'A map plus grid of data, with various options for exploring the data. This is designed to integrate with the Easy Login feature\\'s '.\n 'preferred taxon groups and locality for the logged in user and is therefore specific to Drupal.'\n );\n }"
] |
[
"0.6637256",
"0.6481978",
"0.6431034",
"0.6407364",
"0.6392476",
"0.6384758",
"0.63197696",
"0.6293965",
"0.626322",
"0.62397224",
"0.6159901",
"0.6140059",
"0.60623765",
"0.60510653",
"0.59983426",
"0.5988518",
"0.59687823",
"0.5965504",
"0.59621614",
"0.59621614",
"0.5927599",
"0.58845013",
"0.58669597",
"0.58222127",
"0.58002716",
"0.57921726",
"0.5757669",
"0.5735717",
"0.5689402",
"0.5688876"
] |
0.6595332
|
1
|
Deriva cuatro cadenas de bits a a partir de la clave proporcionada.
|
private function derivarClave()
{
$this->claveDerivada = array();
$bitsClave = CifradorCodigo::fijarLongitud(CifradorCodigo::LongitudBitsClaveMaximo, decbin($this->Clave));
$xorClave = bindec(substr($bitsClave, 0, CifradorCodigo::LongitudBitsClaveMaximo / 2)) ^ bindec(substr($bitsClave, CifradorCodigo::LongitudBitsClaveMaximo / 2, CifradorCodigo::LongitudBitsClaveMaximo / 2));
$xorClaveOriginal = $xorClave;
for($i = 1; $i <= 6; $i++)
{
$clave = bindec($this->permutacionMultiple(CifradorCodigo::fijarLongitud(CifradorCodigo::LongitudBitsClaveMaximo / 2, decbin($xorClave >> 2))));
$this->claveDerivada[] = $clave;
$xorClave = $clave ^ $xorClave;
}
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function getBits();",
"function GenerarClave()\n\t{\n\t\t$this->Clave = CifradorCodigo::generarNumero(\n\t\tCifradorCodigo::LongitudBitsClaveMaximo\n\t\t);\n\t}",
"public function readBits() {}",
"public function getBits(): int;",
"static private function getBits($entier){\n $bits = array();\n for ($i=0; $i<8; $i++){\n $bits[$i] = $entier & (128 >> $i) ? 1 : 0;\n }\n return $bits;\n }",
"function xoft_decode($cipher_data,$key){\r\n\r\n $m=0;\r\n $all_bin_chars=\"\";\r\n\r\n for($i=0;$i<mb_strlen($cipher_data);$i++){\r\n\t$c=mb_substr($cipher_data,$i,1); // c = ciphertext\r\n\t$decimal_value=base64todec($c); //convert to decimal value\r\n\r\n\t$decimal_value=($decimal_value - $m) / 4; //substract by m where m=0,1,2,or 3 then divide by 4\r\n\r\n\t$four_bit=decbin($decimal_value);\r\n\r\n\twhile(mb_strlen($four_bit)<4){\r\n\t\t$four_bit=\"0\".$four_bit;\r\n\t}\r\n\r\n\t$all_bin_chars=$all_bin_chars.$four_bit;\r\n\t$m++;\r\n\r\n\tif($m>3){\r\n\t\t$m=0;\r\n\t}\r\n }\r\n\r\n $key_length=0;\r\n $plain_data=\"\";\r\n\t\r\n for($j=0;$j<mb_strlen($all_bin_chars);$j=$j+8){\r\n\t$c=mb_substr($all_bin_chars,$j,8);\r\n\t$k=mb_substr($key,$key_length,1);\r\n\t\r\n\t$dec_chars=bindec($c);\r\n\t$dec_chars=$dec_chars - mb_strlen($key);\r\n\t$c=chr($dec_chars);\r\n\t$key_length++;\r\n\t\r\n\tif($key_length>=mb_strlen($key)){\r\n\t\t$key_length=0;\r\n\t}\r\n\t\r\n\t$dec_chars=ord($c)^ord($k);\r\n\t$p=chr($dec_chars);\r\n\t$plain_data=$plain_data.$p;\r\n }\r\n \r\n return $plain_data;\r\n}",
"function mysql_aes_key($key)\n{\n $bytes = 16;\n $newKey = \\str_repeat(\\chr(0), $bytes);\n $length = \\strlen($key);\n\n for ($i = 0; $i < $length; $i++) {\n $index = $i % $bytes;\n $newKey[$index] = $newKey[$index] ^ $key[$i];\n }\n\n return $newKey;\n}",
"function mirrorBits($a) {\n return bindec(strrev(decbin($a)));\n}",
"function getBinary() {return $this->_binary;}",
"public static function getRepairBits($cid){\n //repair state from mySql for a specific vehicle\n $r = getRepairs($cid);\n $ret = ($r & 0xF000) >> 12;\n //echo $ret;\n return 0; //$ret;\n }",
"public function necesitaCambiarPassword();",
"public function base58($len=null){ }",
"function xoft_encode($plain_data,$key){\r\n\r\n $key_length=0; //key length counter\r\n $all_bin_chars=\"\";\r\n $cipher_data=\"\";\r\n\r\n for($i=0;$i<mb_strlen($plain_data);$i++){\r\n\t$p=mb_substr($plain_data,$i,1); // p = plaintext\r\n\t$k=mb_substr($key,$key_length,1); // k = key\r\n\t$key_length++;\r\n\r\n\tif($key_length>=mb_strlen($key)){\r\n\t\t$key_length=0;\r\n\t}\r\n\r\n\t$dec_chars=ord($p)^ord($k);\r\n\t$dec_chars=$dec_chars + mb_strlen($key);\r\n\t$bin_chars=decbin($dec_chars);\r\n\r\n\twhile(mb_strlen($bin_chars)<8){\r\n\t\t$bin_chars=\"0\".$bin_chars;\r\n\t}\r\n\r\n\t$all_bin_chars=$all_bin_chars.$bin_chars;\r\n\r\n }\r\n\r\n $m=0;\r\n\r\n for($j=0;$j<mb_strlen($all_bin_chars);$j=$j+4){\r\n\t$four_bit=mb_substr($all_bin_chars,$j,4); // split 8 bit to 4 bit\r\n\t$four_bit_dec=bindec($four_bit);\r\n\r\n\t$decimal_value=$four_bit_dec * 4 + $m; //multiply by 4 plus m where m=0,1,2, or 3\r\n\r\n\t$base64_value=dectobase64($decimal_value); //convert to base64 value\r\n\t$cipher_data=$cipher_data.$base64_value;\r\n\t$m++;\r\n\r\n\tif($m>3){\r\n\t\t$m=0;\r\n\t}\r\n }\r\n\r\n return $cipher_data;\r\n}",
"public static function getRepairBits($cid){\n //repair state from mySql for a specific vehicle\n $r = getRepairs($cid);\n //$ret = ($r & 0x000F) >> 0;\n //echo $ret;\n return 0; //$ret;\n }",
"public function getBits()\n {\n return $this->bits;\n }",
"private function doGetBinaryBitsetLeInt()\n {\n $bin = \\pack(\\PHP_INT_SIZE === 8 ? 'P' : 'V', $this->bitset);\n return \\substr($bin, 0, (int)\\ceil($this->enumerationCount / 8));\n }",
"public function restaurarClave()\n {\n echo $this->Usuarios_model->cambiarClave($this->input->post(\"ciu\"), hash(\"sha512\", \"12345678\"));\n }",
"function char_translate($u1)\n{ \n $conv = array(0,0xffff,0,0xffff); \n //echo \"len=\".mb_strlen($u1).\" , \".bin2hex($u1).\" , \".mb_decode_numericentity($u1,$conv).\"<br>\";\n switch (mb_strlen($u1))\n {\n case 1:\n $mask = 0x7f;\n break;\n case 2:\n $mask = 0x1f3f; /* U+80 - U+7ff : 110x-xxxx-10xx-xxxx */\n break;\n case 3:\n $mask = 0x0f3f3f; /* U+800 - U+ffff : 1110-xxxx-10xx-xxxx-10xx-xxxx */\n break;\n case 4:\n $mask = 0x073f3f3f; /* U+10000 - U+1fffff : 1111-0xxx-10xx-xxxx-10xx-xxxx-10xx-xxxx */\n break;\n }\n $a = intval(bin2hex($u1),16);\n $n = $a & $mask;\n $val = intval($n); \n //var_dump($a);\n //var_dump($mask);\n //var_dump($n);\n return $val;\n}",
"function generateFixedSalt16Byte()\r\n{\r\n return \"\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\";\r\n}",
"public function __construct()\n {\n $this->workingByte = new BitArray(8);\n }",
"public function olvidoPassword(){\n\t}",
"function comprobarContrasena($contrasena, $contrasenaBD) {\n $t_hasher = new PasswordHash(8, FALSE);\n return $t_hasher->CheckPassword($contrasena, $contrasenaBD);\n}",
"public function getBinary();",
"public static function IPv6Hex2BinDataProviderCorrect() {}",
"function test()\r\n {\r\n print_r($this->countBits(3));\r\n }",
"function blake2bHex($input, $key, $outlen = 64) {\n\t\t$output = $this->blake2b($input, $key, $outlen);\n\t\treturn $this->toHex($output);\n\t}",
"public function getBitsPerComponent() {}",
"public function getBitsPerComponent() {}",
"private function doGetBinaryBitsetLeBin()\n {\n /** @var string $bitset */\n $bitset = $this->bitset;\n\n return $bitset;\n }",
"public function getPW() {}"
] |
[
"0.6239052",
"0.6091918",
"0.602772",
"0.5852652",
"0.57256854",
"0.5625799",
"0.55321586",
"0.5483491",
"0.54793894",
"0.53973174",
"0.5319954",
"0.52852273",
"0.526925",
"0.5242947",
"0.52339596",
"0.523259",
"0.52036893",
"0.5202094",
"0.5181602",
"0.5166808",
"0.5151914",
"0.51465076",
"0.5117868",
"0.5110708",
"0.51048195",
"0.50830805",
"0.5077155",
"0.5075448",
"0.50740504",
"0.5070654"
] |
0.6991244
|
0
|
Genera un resumen de datos.
|
function GenerarResumen()
{
$xorSerial = $this->Serial ^ $this->claveDerivada[0];
$xorPuntos = $this->puntos ^ $this->claveDerivada[0];
$datos = $this->permutarDatos($xorSerial);
$datos = $datos ^ $this->permutarDatos($xorPuntos);
return $datos;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"static function generateResource()\n {\n return ['org' => self::$resOrg,\n 'role' => self::$resRole,\n 'id' => self::$resId];\n }",
"function compilar_metadatos_generales()\n\t{\n\t\t$this->manejador_interface->titulo(\"Compilando datos generales\");\n\t\ttoba_proyecto_db::set_db( $this->db );\n\t\t$path = $this->get_dir_generales_compilados();\n\t\ttoba_manejador_archivos::crear_arbol_directorios( $path );\n\t\t$this->compilar_metadatos_generales_basicos();\n\t\t$this->compilar_metadatos_generales_grupos_acceso();\n\t\t$this->compilar_metadatos_generales_puntos_control();\n\t\t$this->compilar_metadatos_generales_mensajes();\n\t\t$this->compilar_metadatos_generales_dimensiones();\n\t\t$this->compilar_metadatos_generales_consultas_php();\n\t\t$this->compilar_metadatos_generales_servicios_web();\n\t\t$this->compilar_metadatos_generales_pms();\n\n\t}",
"function generar()\r\n\t{\r\n\t\tforeach($this->columnas as $ef) {\r\n\t\t \t$this->datos->tabla('columnas')->nueva_fila($ef->get_datos());\r\n\t\t}\r\n\t\tparent::generar();\r\n\t}",
"public function data()\n {\n return [\n 'name' => $this->faker->text,\n 'cast' => $this->faker->text,\n 'genere' => $this->faker->text,\n 'description' => $this->faker->paragraph,\n 'image' => $this->faker->text,\n ];\n }",
"public function getAll(){\n \n // 1. Establece la conexion con la base de datos y trae todos los generos\n $query = $this->getDb()->prepare(\" SELECT * FROM genero\");\n $query-> execute(); \n return $query->fetchAll(PDO::FETCH_OBJ);\n }",
"abstract protected function _generateDataCollection();",
"function getEstadisticaResumen() {\n\t\tglobal $mdb2;\n\t\tglobal $log;\n\t\tglobal $current_usuario_id;\n\t\tglobal $usr;\n\n\t\t/* TEMPLATE DEL GRAFICO */\n\t\t$T =& new Template_PHPLIB(($this->extra[\"imprimir\"])?REP_PATH_PRINTTEMPLATES:REP_PATH_TABLETEMPLATES);\n\t\t$T->setFile('tpl_tabla', 'rendimiento_resumen.tpl');\n\t\t$T->setBlock('tpl_tabla', 'BLOQUE_TITULO_HORARIOS', 'bloque_titulo_horarios');\n\t\t$T->setBlock('tpl_tabla', 'LISTA_PASOS', 'lista_pasos');\n\t\t$T->setBlock('tpl_tabla', 'BLOQUE_TABLA', 'bloque_tabla');\n\n\t\t$horarios = array($usr->getHorario($this->horario_id));\n\t\tif ($this->horario_id != 0) {\n\t\t\t$horarios[] = $usr->getHorario(0);\n\t\t\t$horarios[($this->horario_id*-1)] = new Horario(($this->horario_id*-1));\n\t\t\t$horarios[($this->horario_id*-1)]->nombre = \"Horario Inhabil\";\n\t\t}\n\n\t\t$orden = 1;\n\t\t$T->setVar('bloque_titulo_horarios', '');\n\t\tforeach ($horarios as $horario) {\n\t\t\t$T->setVar('lista_pasos', '');\n\n\t\t\t$sql = \"SELECT * FROM reporte.rendimiento_resumen_global(\".\n\t\t\t\t\tpg_escape_string($current_usuario_id).\",\".\n\t\t\t\t\tpg_escape_string($this->objetivo_id).\", \".\n\t\t\t\t\tpg_escape_string($horario->horario_id).\",' \".\n\t\t\t\t\tpg_escape_string($this->timestamp->getInicioPeriodo()).\"', '\".\n\t\t\t\t\tpg_escape_string($this->timestamp->getTerminoPeriodo()).\"')\";\n//\t\t\t\t\tprint $sql;\n\t\t\t$res =& $mdb2->query($sql);\n\t\t\tif (MDB2::isError($res)) {\n\t\t\t\t$log->setError($sql, $res->userinfo);\n\t\t\t\texit();\n\t\t\t}\n\t\t\t$row = $res->fetchRow();\n\t\t\t$dom = new DomDocument();\n\t\t\t$dom->preserveWhiteSpace = false;\n\t\t\t$dom->loadXML($row[\"rendimiento_resumen_global\"]);\n\t\t\t$xpath = new DOMXpath($dom);\n\t\t\tunset($row[\"rendimiento_resumen_global\"]);\n\n\t\t\t$conf_objetivo = $xpath->query('/atentus/resultados/propiedades/objetivos/objetivo')->item(0);\n\t\t\t$conf_pasos = $xpath->query(\"paso[@visible=1]\", $conf_objetivo);\n\n\t\t\t/* SI NO HAY DATOS MOSTRAR MENSAJE */\n\t\t\tif ($horario->horario_id == \"0\" and $xpath->query('//detalle[@paso_orden]/datos/dato')->length == 0) {\n\t\t\t\t$this->resultado = $this->__generarContenedorSinDatos();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif(count($horarios) > 1) {\n\t\t\t\t$T->setVar('__item_orden', $this->extra[\"item_orden\"]);\n\t\t\t\t$T->setVar('__horario_orden', $orden);\n\t\t\t\t$T->setVar('__horario_nombre', $horario->nombre);\n\t\t\t\t$T->parse('bloque_titulo_horarios', 'BLOQUE_TITULO_HORARIOS', false);\n\t\t\t}\n\n\t\t\t/* DATOS DE LA TABLA */\n\t\t\t$linea = 1;\n\t\t\tforeach($conf_pasos as $conf_paso) {\n\t\t\t\t$tag_dato = $xpath->query('//detalle[@paso_orden='.$conf_paso->getAttribute('paso_orden').']/datos/dato')->item(0);\n\t\t\t\tif ($tag_dato == null) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\t$T->setVar('__print_class', ($linea % 2 == 0)?\"celdaIteracion2\":\"celdaIteracion1\");\n\t\t\t\t$T->setVar('__class', ($linea % 2 == 0)?\"celdanegra15\":\"celdanegra10\");\n\t\t\t\t$T->setVar('__paso_nombre', $conf_paso->getAttribute('nombre'));\n\t\t\t\t$T->setVar('__paso_minimo', number_format($tag_dato->getAttribute('tiempo_min'), 3, ',', ''));\n\t\t\t\t$T->setVar('__paso_maximo', number_format($tag_dato->getAttribute('tiempo_max'), 3, ',', ''));\n\t\t\t\t$T->setVar('__paso_promedio', number_format($tag_dato->getAttribute('tiempo_prom'), 3, ',', ''));\n\t\t\t\t$T->parse('lista_pasos', 'LISTA_PASOS', true);\n\t\t\t\t$linea++;\n\t\t\t}\n\t\t\t$T->parse('bloque_tabla', 'BLOQUE_TABLA', true);\n\t\t\t$orden++;\n\t\t}\n\t\t$this->tiempo_expiracion = (strtotime($xpath->query(\"//fecha_expiracion\")->item(0)->nodeValue) - strtotime($xpath->query(\"//fecha\")->item(0)->nodeValue));\n\t\t$this->resultado =$T->parse('out', 'tpl_tabla');\n\t}",
"function exportarDatos(){\n\t\t$this->objFunc=$this->create('MODResultadoPlantilla');\t\t\n\t\t\n\t\t$this->res = $this->objFunc->exportarDatos();\n\t\t\n\t\tif($this->res->getTipo()=='ERROR'){\n\t\t\t$this->res->imprimirRespuesta($this->res->generarJson());\n\t\t\texit;\n\t\t}\n\t\t\n\t\t$nombreArchivo = $this->crearArchivoExportacion($this->res);\n\t\t\n\t\t$this->mensajeExito = new Mensaje();\n\t\t$this->mensajeExito->setMensaje('EXITO','Reporte.php','Se genero con exito el sql'.$nombreArchivo,\n\t\t\t\t\t\t\t\t\t\t'Se genero con exito el sql'.$nombreArchivo,'control');\n\t\t$this->mensajeExito->setArchivoGenerado($nombreArchivo);\n\t\t\n\t\t$this->res->imprimirRespuesta($this->mensajeExito->generarJson());\n\n\t}",
"public function data()\n {\n $orders=libro::all();\n foreach ($orders as $key => $value) {\n \n if(count(autor::find($value->id_autor)))\n $value->id_autor=autor::find($value->id_autor)->nombre;\n else $value->id_autor='No asignado';\n \n }\n return \\Datatables::of($orders)->addColumn('action', 'libro.partials.vista')->make(true) ; \n }",
"public function generate_data() {\n\t\t$this->data = $this->get_registered_post_types();\n\t}",
"public function generos(){\n\t\t$gen = $this->request->getPost();\n\t\t$genero = strtoupper($gen['genero']);\n\t\t//dd($genero);\n\n\t\t//Construção da consulta por genero\n\t\t$db = \\Config\\Database::connect();\n\t\t$builder = $db->table('livros');\n\n\t\t$builder->select('livros.id,livros.imagem\"imagem\", livros.titulo\"titulo\", autores.nome\"autor\", livros.descricao\"descricao\"', FALSE);\n\t\t$builder->join('genero_livro', 'genero_livro.id_livro = livros.id')\n\t\t\t\t->join('generos', 'generos.id = genero_livro.id_genero')\n\t\t\t\t->join('autores_livros', 'autores_livros.id_livro = livros.id')\n\t\t\t\t->join('autores', 'autores.id = autores_livros.id_autor');\n\n\t\t$builder->where('generos.nome',$genero);\n\t\t$query = $builder->get();\n\t\t$resultado = $query->getResultArray();\n\t\t//dd($resultado);\n\t\t\n\t\t//Autores mostrados por padrão\n\t\t$autoresmodel = model('AutorModel');\n\t\t$autores = $autoresmodel->findAll();\n\n\t\t//Variaveis setadas para compatibilidade no reaproveitamento de Home\n\t\t$livros = $resultado;\n\t\t$session = session();\n\t\t$dados = [\n\t\t\t'autores' => $autores,\n\t\t\t'livros' => $livros,\n\t\t\t'session' => $session\n\t\t];\n\n\t\techo view('home',$dados);\n\t}",
"public function definition()\n {\n $user_ids = \\DB::table('users')->select('id')->get();\n $user_id = $this->faker->randomElement($user_ids)->id;\n return [\n 'altura_dia' => $this->faker->randomElement(['Pequeno-Almoço', 'Almoço','Jantar','Lanche manhã','Lanche tarde','Ceia']),\n 'data_refeicao' =>$this->faker->date($format = 'Y-m-d', $max = 'now'),\n 'total_cal' => $this->faker->numberBetween($min = 100, $max = 5000),\n 'notas' => $this->faker->sentence,\n 'user_id' => $user_id,\n ];\n }",
"public function generate()\n\t{\n\t\t$this->rfmModel->emptyTable();\n\n\t\t// ambil data pelanggan\n\t\t$dataModel = new DataModel();\n\t\t$dataPelanggan = $dataModel->getData()->getResultArray();\n\n\t\tforeach ($dataPelanggan as $pelanggan) {\n\t\t\t// hitung recency\n\t\t\t$tgl_daftar = strtotime($pelanggan['tgl_daftar']);\n\t\t\t$tgl_aktif = strtotime($pelanggan['tgl_aktif']);\n\t\t\t$selisih = $tgl_aktif - $tgl_daftar;\n\t\t\t$recency = $selisih / (24 * 60 * 60);\n\n\t\t\t// hitung frequency\n\t\t\t$frequency = $pelanggan['jumlah_paket'] == $pelanggan['jumlah_terpasang'] ? 1 : 0;\n\n\t\t\t// hitung monetary\n\t\t\t$monetary = $pelanggan['jumlah_terpasang'];\n\n\t\t\t$this->rfmModel->save([\n\t\t\t\t'r' => $recency,\n\t\t\t\t'f' => $frequency,\n\t\t\t\t'm' => $monetary,\n\t\t\t\t'pelanggan_id' => $pelanggan['id'],\n\t\t\t]);\n\t\t}\n\n\t\t$this->session->setFlashdata('sukses', 'Generate Selesai');\n\t\treturn \\json_encode([\n\t\t\t'success' => true,\n\t\t\t'redirect' => '/rfm'\n\t\t]);\n\t}",
"public function datoGener($id_usuario){\r\n\t\t$sql = \"SELECT * FROM tbl_usuarios WHERE id_usuario = $id_usuario\";\r\n\t\treturn ejecutarConsulta($sql);\r\n\t}",
"public function actionGenerateAndDownloadDatasetCreationFile() {\n $fileColumns[] = DatasetController::AGRONOMICAL_OBJECT_URI;\n $fileColumns[] = DatasetController::DATE;\n $variables = Yii::$app->request->post('variables');\n foreach ($variables as $variableAlias) {\n $fileColumns[] = $variableAlias;\n }\n\n $file = fopen('./documents/DatasetFiles/datasetTemplate.csv', 'w');\n fputcsv($file, $fileColumns, $delimiter = \";\"); \n fclose($file);\n }",
"public function data_resumen_cxc_cliente()\n {\n $consulta = DB::select('exec RPT_SP_RESUMEN_CXC_CLIENTE');\n $columns = array();\n if (count($consulta) > 0) {\n //queremos obtener las columnas dinamicas de la tabla\n $cols = array_keys((array)$consulta[0]);\n //obtenemos las columnas de las semanas dinamicas, estas tienen un _\n /******\n * NO AGREGAR _ EN LOS NOMBRES DE LA CONSULTA SQL\n * ***/\n $numerickeys = array_where($cols, function ($key, $value) {\n return is_numeric(strpos($value, '_'));\n });\n //las ordenamos\n sort($numerickeys);\n //dd($cols);\n //obtenemos las primeras 3 columnas, esas no cambian\n $columns_init = array_slice($cols, 0, 3);\n //agregamos las columnas dinamicas ordenadas\n //dd($columns_init);\n $columns_init = array_merge($columns_init, $numerickeys);\n //preparamos el array final para el datatable\n foreach ($columns_init as $key => $value) {\n array_push($columns, [\"data\" => $value, \"name\" => $value]);\n }\n array_push($columns, [\"data\" => \"RESTO\", \"name\" => \"RESTO\"]);\n }\n return response()->json(array('data' => $consulta, 'columns' => $columns));\n }",
"public function getDatas()\n\t{\n\t\t$this->skeleton = $this->data[\"skeleton\"];\n\t\t$this->javascript = $this->data[\"javascript\"];\n\t\t$this->css = $this->data[\"css\"];\n\t\t$this->module = $this->data[\"module\"];\n\t\t$this->site = $this->data[\"site\"];\n\t}",
"public function definition()\n {\n $marca = DB::table('marcas')->select('id')->where('id', '=', '1')->get()->pluck('id')->toArray()[0];\n return [\n 'descripcion' => Str::random(10),\n 'marca_id' => $marca,\n 'created_at' => now(),\n 'updated_at' => now(),\n ];\n }",
"public function generujKod(){\n\t\t//\n\t}",
"public function generar()\n {\n $Pilones = \\DB::table('pilons')\n ->select(['id','codigo_pilon','descripcion_pilon','Fecha_datos_pilones','ubicacion','sucursal_id'])\n ->get();\n $view = \\View::make('Reportes.Reporte', compact('Pilones'))->render();\n $pdf = \\App::make('dompdf.wrapper');\n $pdf->loadHTML($view);\n return $pdf->stream('informe'.'.pdf');\n }",
"public function definition()\n {\n // ONE TO MANY relationship (with data already created)\n $departments = \\App\\Models\\Department::pluck('id')->toArray();\n $patients = \\App\\Models\\Patient::pluck('id')->toArray();\n return [\n 'department_id' => $this->faker->randomElement($departments),\n 'patient_id' => $this->faker->randomElement($patients),\n 'anamnesis' => $this->faker->sentence,\n 'complaint' => $this->faker->sentence,\n 'status' => 'WAITING',\n ];\n }",
"public function run()\n {\n DiasCorrespondidos::create([\n 'año_desde' => 0,\n 'año_hasta' => 5,\n 'cantidad_dias' => 14\n ]);\n\n DiasCorrespondidos::create([\n 'año_desde' => 5,\n 'año_hasta' => 10,\n 'cantidad_dias' => 21\n ]);\n\n DiasCorrespondidos::create([\n 'año_desde' => 10,\n 'año_hasta' => 20,\n 'cantidad_dias' => 28\n ]);\n\n DiasCorrespondidos::create([\n 'año_desde' => 20,\n 'año_hasta' => null,\n 'cantidad_dias' => 35\n ]);\n }",
"public static function getAll2(){\n\t\t$sql = \"select * from prueba\";\n\t\t$query = Executor::doit($sql);\n\t\treturn Model::many($query[0],new TemparioData());\n\t}",
"public function getData()\n {\n $data = $this->only(['fecha','anio','mes','tpo_deteccion_id','area_id','tpo_bitacora_id','tpo_inconformidad_id','inconformidad','solucion','grupo_id','norma_id','norma','responsable_id','fec_planeada','fec_solucion','costo','estatus_id','entity_id','usu_alta_id','usu_mod_id','dias_aviso']);\n\n\n\n return $data;\n }",
"public function definition()\n {\n $product_id = Product::pluck('id')->all();\n $voucher_id = Voucher::pluck('id')->all();\n\n return [\n 'product_id' => $this->faker->randomElement($product_id),\n 'voucher_id' => $this->faker->randomElement($voucher_id),\n ];\n }",
"public function generate() {\n\t\treturn [];\n\t}",
"public function index()\n {\n $graficos = Grafico::all();\n\n foreach ($graficos as $g) {\n if($g->desti == 0){\n $g->desti = 'Tots';\n }else{\n $g->desti = Centro::find($g->desti)->nombre;\n }\n\n if($g->origen == 0){\n $g->origen = 'Tots';\n }else{\n $g->origen = Centro::find($g->origen)->nombre;\n }\n\n if($g->animales == 0){\n $g->animales = 'Tots';\n }\n else{\n $g->animales = Animal::find($g->animales)->nombre;\n }\n }\n\n return new GraficoResource($graficos);\n }",
"public function data(){\n $id = $this->registro_id;\n $tabla = $this->tabla;\n $datos = '';\n\n if ($tabla == 'conductor') {\n $datos = Persona::where('id','=',$id)->get();\n }elseif ($tabla == 'propietario') {\n $datos = Persona::where('id','=',$id)->get();\n }elseif ($tabla == 'usuarios') {\n $datos = User2::where('id','=',$id)->get();\n }elseif($tabla == 'operadoras') {\n $datos = Operadora::where('id','=',$id)->get();\n }elseif ($tabla == 'rutas') {\n $datos = Ruta::where('id','=',$id)->get();\n }elseif ($tabla == 'marcas') {\n $datos = Marca::where('id','=',$id)->get();\n }elseif ($tabla == 'colores') {\n $datos = Color::where('id','=',$id)->get();\n }elseif($tabla == 'vehiculos') {\n $datos = Vehiculo::where('id','=',$id)->get();\n }\n\n return $datos;\n }",
"function recuperarDatos(){\r\n\t\t\t\t$this->objFunc=$this->create('MODEmpresa');\r\n\t\t\t\t$objetoFuncion = $this->create('MODEmpresa');\r\n\t\t\t\t$this->res=$this->objFunc->insertarEmpresa($this->objParam);\t//esta bien\t\t\t\r\n\t\t\t\t$this->res->imprimirRespuesta($this->res->generarJson());\r\n\t\t}",
"public function definition()\n {\n\n $aprobado = ['APROBADO',\n 'PENDIENTE',\n 'RECHAZADO'];\n\n $tipos = ['Abstracto',\n 'Barroco',\n 'Cubismo',\n 'Dadaista',\n 'Hiperrealismo',\n 'Impresionista',\n 'Pop',\n 'Renacimiento',\n 'Surrealista',\n 'Postmodernista'\n ];\n\n $tipoNumero = rand(0, 9);\n\n return [\n 'titulo' => $this->faker->sentence,\n 'descripcion' => $this->faker->paragraph((rand(10, 20)), true),\n 'tipo' => $tipos[$tipoNumero],\n 'especificaciones' => $this->faker->paragraph((rand(8, 12)), true),\n 'usuario_id' => rand(2, 4),\n 'tipo_obra_id' => $tipoNumero + 1,\n 'estado' => $aprobado[rand(0, 1)],\n ];\n }"
] |
[
"0.6824585",
"0.6275289",
"0.6004341",
"0.5878788",
"0.58204675",
"0.5815157",
"0.5800147",
"0.57963014",
"0.5721363",
"0.5710482",
"0.5707259",
"0.5695093",
"0.56408304",
"0.56096935",
"0.5589797",
"0.5587671",
"0.555995",
"0.55514604",
"0.55387694",
"0.5523738",
"0.5518932",
"0.5515158",
"0.55109566",
"0.55011004",
"0.5490501",
"0.54904294",
"0.54708767",
"0.54590625",
"0.5444986",
"0.5442973"
] |
0.658429
|
1
|
Genera una clave y la almacena en el objeto.
|
function GenerarClave()
{
$this->Clave = CifradorCodigo::generarNumero(
CifradorCodigo::LongitudBitsClaveMaximo
);
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function generaClave()\n {\n do {\n $clave = '';\n for ($i = 0; $i < 3; $i++) {\n $clave .= strtoupper(substr(uniqid(), -5));\n $clave .= $i != 2 ? '-' : '';\n }\n } while (!$this->claveValida($clave) && !$this->claveUnica($clave));\n \n return $clave;\n }",
"public function generateAuthKey() {\n $this->llaveAutenticacion = Yii::$app->security->generateRandomString();\n }",
"public function restaurarClave()\n {\n echo $this->Usuarios_model->cambiarClave($this->input->post(\"ciu\"), hash(\"sha512\", \"12345678\"));\n }",
"public function generateAuthKey()\n {\n $this->salt = OldDi::GetString(8);\n }",
"public function cambiarClave()\n {\n echo $this->Usuarios_model->cambiarClave($this->session->userdata(\"ciu\"), hash(\"sha512\", $this->input->post(\"clave\")));\n }",
"private function derivarClave()\n\t{\n\t\t$this->claveDerivada = array();\n\t\t$bitsClave = CifradorCodigo::fijarLongitud(CifradorCodigo::LongitudBitsClaveMaximo, decbin($this->Clave));\n\t\t$xorClave = bindec(substr($bitsClave, 0, CifradorCodigo::LongitudBitsClaveMaximo / 2)) ^ bindec(substr($bitsClave, CifradorCodigo::LongitudBitsClaveMaximo / 2, CifradorCodigo::LongitudBitsClaveMaximo / 2));\n\t\t$xorClaveOriginal = $xorClave;\n\t\tfor($i = 1; $i <= 6; $i++)\n\t\t{\n\t\t\t$clave = bindec($this->permutacionMultiple(CifradorCodigo::fijarLongitud(CifradorCodigo::LongitudBitsClaveMaximo / 2, decbin($xorClave >> 2))));\n\t\t\t$this->claveDerivada[] = $clave;\n\t\t\t$xorClave = $clave ^ $xorClave;\n\t\t}\n\t}",
"public function getClaveUsuario(){\n return $this->claveUsuario;\n }",
"function Crypter($clave){\n $this->key = $clave;\n }",
"abstract public function createSecretKey();",
"public function olvidoPassword(){\n\t}",
"public function getPassword(): string\n {\n return $this->getClave();\n }",
"function makeKey($masterID){\n\n\t$key = \"I want to see you so bad :/\";\n\t$keyElement1 = \"\";\n\t$keyElement2 = \"\";\n\t$keyElement3 = \"\";\n\t$hash = \"\";\n\n\t$strSQL = \"SELECT * FROM masteraccount WHERE 1 \n\t\tAND masterID = '\".$masterID.\"' \n\t\t\";\n\t\n\t$objQuery = mysql_query($strSQL);\n\t$objResult = mysql_fetch_array($objQuery);\n\tif($objResult) {\n\t\t$keyElement1 = $objResult[\"masterTextPassword\"];\n\t\t$keyElement2 = $objResult[\"masterGraphicalPassword\"];\n\n\t\t//echo \"element2 : \".$keyElement2.\"<br>\";\n\n\t\t$keyElement3 = $objResult[\"email\"];\n\t\t$cost = 11;\n\t\t$salt = mcrypt_create_iv(22, MCRYPT_DEV_URANDOM);\n\t\t\n\t\t//make key -> Hash(Hash(text)+Hash(graphical))+Hash(email)\n\t\t$keyElement1 = hash(\"sha256\",$keyElement1, false);\n\t\t$keyElement2 = hash(\"sha256\",$keyElement2, false);\n\t\t$key = $keyElement1.$keyElement2 ;\n\n\t\t//echo \"key ele1+2 : \".$key.\"<br>\";\n\n\t\t$key = hash(\"sha256\",$key, false);\n\n\t\t//echo \"hashed key ele1+2 : \".$key.\"<br>\";\n\n\t\t$keyElement3 = hash(\"sha256\",$keyElement3, false);\n\t\t$key = $key.$keyElement3 ;\n\t\t$key = hash(\"sha256\",$key, false);\n\n\t\t//echo \"FinalKey : \".$key.\"<br><br>\";\n\t}\n\treturn $key;\n}",
"public function generateAuthKey()\n {\n // default length=32\n $this->auth_key = Yii::$app->security->generateRandomString();\n }",
"function mysql_aes_key($key)\n{\n $bytes = 16;\n $newKey = \\str_repeat(\\chr(0), $bytes);\n $length = \\strlen($key);\n\n for ($i = 0; $i < $length; $i++) {\n $index = $i % $bytes;\n $newKey[$index] = $newKey[$index] ^ $key[$i];\n }\n\n return $newKey;\n}",
"function cifrar($datos, $llave) {\n // Quitamos la codificacion base64 de nuestra llave\n $clave_cifrado = base64_decode($llave);\n // Generamos un vector de inicialización para nuestra clave\n $iv = openssl_random_pseudo_bytes(openssl_cipher_iv_length('aes-256-cbc'));\n // Ciframos los datos utilizando AES 256 en modo CBC utilizando nuestra llave y nuestro IV generado\n $cifrado = openssl_encrypt($datos, 'aes-256-cbc', $clave_cifrado, 0, $iv);\n // El IV es importantísimo para poder descifrar nuestra clave, así que lo vamos a almacenar junto a nuestra clave cifrada usando el separador (::)\n return base64_encode($cifrado . '::' . $iv);\n}",
"public function encrypt();",
"public function getBoxSecretKey() : string;",
"abstract protected function generateKey();",
"public function getSecretKey();",
"public function getClave(){\n\t\treturn $this->clave;\n\t}",
"private function newKey()\n {\n $kp = sodium_crypto_box_keypair();\n //$pk = sodium_crypto_box_secretkey($kp);\n return $kp;\n }",
"public function getPassword()\n {\n return base64_decode($this->clave);\n }",
"public function generateAuthKey() {\n $this->auth_key = Yii::$app->security->generateRandomString(32);\n }",
"protected abstract function getSecretKey();",
"abstract protected function getCrypt();",
"public function encryptPass()\n {\n return \"RASAHolaRSSA\";\n }",
"public function generateAuthKey() {\n\t\t$this->txt_auth_key = Yii::$app->security->generateRandomString ();\n\t}",
"function encriptarContrasena($contrasena) {\n\t#The first argument specifies the \"base-2 logarithm of the iteration count used for password stretching\" and the second argument specifies the use of portable hashes\n $t_hasher = new PasswordHash(8, FALSE);\n return $t_hasher->HashPassword($contrasena);\n}",
"public function generateKeyAndSecret() {\n $user = user_load($this->uid);\n\n $this->app_key = str_replace(array(' ', '', '-'), '_', strtolower($this->title));\n $this->app_secret = md5($user->name . $this->time);\n }",
"function cifrar_cadena(string $cadena, string $llave)\n{\n\t$iv = openssl_random_pseudo_bytes(IV_LENGTH);\n\t$cifrado = openssl_encrypt(\n\t\t$cadena,\n\t\tMETODO,\n\t\t$llave,\n\t\t0,\n\t\t$iv\n\t);\n\n\treturn base64_encode($cifrado . '::' . $iv);\n}"
] |
[
"0.67522526",
"0.641119",
"0.6335741",
"0.62332034",
"0.6222211",
"0.6185842",
"0.6154997",
"0.59090173",
"0.5885199",
"0.5865318",
"0.5865029",
"0.5772361",
"0.5770268",
"0.57503283",
"0.5741449",
"0.56955296",
"0.5679185",
"0.56678635",
"0.5667105",
"0.56306636",
"0.5602636",
"0.55916023",
"0.55914026",
"0.5590248",
"0.5590022",
"0.55877316",
"0.5543694",
"0.55315167",
"0.55302626",
"0.55278945"
] |
0.75056225
|
0
|
Genera un serial y lo almacena en el objeto.
|
function GenerarSerial()
{
$this->Serial = CifradorCodigo::generarNumero(
CifradorCodigo::LongitudBitsSerialMaximo
);
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function __toString() : string\n {\n return 'Serial';\n }",
"public function serial() : string;",
"function serialise(): string;",
"public function toSerial() {\n\t\treturn serialize($this->toArray());\n\t}",
"public function serialize() {}",
"public function serialize() {}",
"public function serialize() {}",
"public function serialize() {}",
"public function serialize() {}",
"public function serialize() {}",
"public function serialize() {}",
"public function serialize() {}",
"public function __toString(){\n // Registro JSon\n\t\treturn \"{\" \n\t\t . chr(34) . \"Id\" . chr(34) . \":\" . chr(34) . $this->getId() . chr(34) \n\t\t . \",\" . chr(34) . \"Cliente\" . chr(34) . \":\" . chr(34) . $this->getCliente() . chr(34) \n\t\t . \",\" . chr(34) . \"Mensaje\" . chr(34) . \":\" . chr(34) . $this->getMensaje() . chr(34) \n\t\t . \",\" . chr(34) . \"Autor\" . chr(34) . \":\" . chr(34) . $this->getAutor() . chr(34) \n\t\t . \"}\";\n \t\t}",
"public function serialize()\n {\n return serialize([$this->id,$this->matric_number]);\n }",
"public function plain_serial() {\n\t\treturn strtoupper(str_replace('-', '', $this->serial()));\n\t}",
"function __toString()\n {\n return '{\"idPartita\":\"'.$this->getIdPartita().\n '\",\"squadraCasa\":\"'.$this->getSquadraCasa().\n '\",\"squadraTrasferta\":\"'.$this->getSquadraTrasferta().\n '\",\"orario\":\"'.$this->getOrario().\n '\",\"luogo\":\"'.$this->getLuogo().\n '\",\"risultato\":\"'.$this->getRisultato().'\",\"squadre_idSquadre\":\"'.$this->getSquadreIdSquadre().'\"}';\n }",
"public function serialize();",
"public function serialize();",
"public function serialize();",
"public function serialize()\n {\n }",
"public function serialize()\n {\n }",
"function networkSerialize() : string{\n\t\treturn \"\\x00\" . $this->ids . $this->data . $this->skyLight . $this->blockLight;\n\t}",
"public function serialize() \n {\n return serialize([\n 'boardingCardNumber'=>$this->boardingCardId,\n 'arrival'=>$this->arrival, \n 'departure'=>$this->departure, \n 'passenger'=>$this->passenger,\n 'reference'=>$this->reference,\n 'busNo'=>$this->busNo,\n 'platformNo'=>$this->platformNo\n ]);\n }",
"function serial($b)\n{\n\tvar_dump($b) . PHP_EOL;\n\tserialize($b);\n\tvar_dump($b) . PHP_EOL;\n}",
"public abstract function serialize();",
"public function serialize(){ }",
"public function getSerialId()\n\t{\n\n\t\treturn $this->serial_id;\n\t}",
"public function serialize()\n {\n return serialize(array(\n $this->id,\n $this->nombre,\n $this->password,\n ));\n }",
"abstract public function serialize();",
"abstract public function serialize();"
] |
[
"0.7486921",
"0.7181321",
"0.64285606",
"0.64146084",
"0.61375004",
"0.61375004",
"0.61375004",
"0.61375004",
"0.61375004",
"0.61375004",
"0.6136791",
"0.6136791",
"0.6068175",
"0.6063336",
"0.6048051",
"0.599123",
"0.5935636",
"0.5935636",
"0.5935636",
"0.5875295",
"0.5875295",
"0.58676505",
"0.58613753",
"0.58595943",
"0.58349335",
"0.5804795",
"0.5775104",
"0.5748363",
"0.5746071",
"0.5746071"
] |
0.8095854
|
0
|
Get the panels that are available for the given detail request.
|
public function availablePanelsForDetail(NovaRequest $request, Resource $resource)
{
$panels = parent::availablePanelsForDetail($request, $resource);
$fields = parent::availableFields($request);
return $this->mergePanels($panels, $this->findAllActiveContainers($fields, $this));
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function getPanels() {\n\n $panels = $this->entityManager->getRepository(Panel::class)\n ->findBy([], ['dateCreated' => 'DESC']);\n\n return $panels;\n }",
"public function availablePanelsForCreate($request)\n {\n $panels = parent::availablePanelsForCreate($request);\n $fields = parent::availableFields($request);\n\n return $this->mergePanels($panels, $this->findAllContainers($fields));\n }",
"public function buildPanels() {\n return array($this);\n }",
"public function getPanel()\n {\n $this->_request = Zend_Controller_Front::getInstance()->getRequest();\n $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer');\n $viewVars = $viewRenderer->view->getVars();\n $vars = '';\n if ($this->_request->isPost())\n {\n $vars .= '<h4>$_POST</h4>'\n . '<div id=\"ZFDebug_post\">' . $this->_cleanData($this->_request->getPost()) . '</div>';\n }\n \n if (isset($_SESSION)) {\n \t$vars .= '<h4>$_SESSION</h4>'\n\t\t\t\t. '<div id=\"ZFDebug_cookie\">' . $this->_cleanData($_SESSION) . '</div>';\n }\n\n $vars .= '<h4>$_COOKIE</h4>'\n . '<div id=\"ZFDebug_cookie\">' . $this->_cleanData($this->_request->getCookie()) . '</div>'\n . '<h4>Request</h4>'\n . '<div id=\"ZFDebug_requests\">' . $this->_cleanData($this->_request->getParams()) . '</div>'\n . '<h4>View vars</h4>'\n . '<div id=\"ZFDebug_vars\">' . $this->_cleanData($viewVars) . '</div>';\n return $vars;\n }",
"public function panels()\n {\n }",
"function GetWebPanelList()\n\t{\n\t\t$result = $this->sendRequest(\"GetWebPanelList\", array());\t\n\t\treturn $this->getResultFromResponse($result);\n\t}",
"public function get_panel($id)\n {\n }",
"public function getAvailableTemplate()\r\n {\r\n $panels = $this->_panel->getCollection()\r\n ->addFieldToFilter('status', '1');\r\n $listPanel = array();\r\n foreach ($panels as $panel) {\r\n $listPanel[] = array('label' => $panel->getName(),\r\n 'value' => $panel->getId());\r\n }\r\n // echo 'test';\r\n // die();\r\n return $listPanel;\r\n }",
"public function listPanel()\n {\n $solarPanel = DB::table('solar_panels')\n ->join('solar_panel_types','solar_panel_types.id','solar_panels.solarPanelType')\n ->get();\n // return $solarPanel;\n return view('stock.product',[\n 'panels' => $solarPanel\n ]);\n }",
"public function availablePanelsForUpdate(NovaRequest $request, Resource $resource = null)\n {\n $panels = parent::availablePanelsForUpdate($request, $resource);\n $fields = parent::availableFields($request);\n\n return $this->mergePanels($panels, $this->findAllContainers($fields));\n }",
"function siteorigin_panels_get_current_admin_panels_data(){\n\t$screen = get_current_screen();\n\n\tglobal $post;\n\t$panels_data = get_post_meta( $post->ID, 'panels_data', true );\n\t$panels_data = apply_filters( 'siteorigin_panels_data', $panels_data, $post->ID );\n\n\tif ( empty( $panels_data ) ) $panels_data = array();\n\n\treturn $panels_data;\n}",
"public function fields(Request $request)\n {\n return [\n ID::make()->sortable(),\n new Panel('Important Details', $this->primaryFields()),\n new Panel('Others', $this->secondaryFields()),\n ];\n }",
"public function getPanel()\n {\n $html = '';\n foreach ($this->_count as $count) {\n $html .= $count['name']. ' - '.$count['total'].' ('.$count['users'].')'.'<br/>';\n }\n \n $body = Zend_Controller_Front::getInstance()->getResponse()->getBody();\n $panel = '<h4>К-во пользователей онлайн:</h4>'.$html;\n return $panel;\n }",
"private function showPanels()\r\n {\r\n if ($this->claimType == \"repair-warranty\" || $this->claimType == \"repair-no-warranty\" ||\r\n $this->claimType == \"repair-no-transaction\")\r\n {\r\n // show the information panel\r\n $newInformationPanel = new InformationPanel($this->keycodeResult, $this->transactionResult);\r\n\r\n // create form form to process a repair claim\r\n //echo \"<form action=\\\"CustomerClaim.php\\\" method=\\\"post\\\" name=\\\"submit-repair-claim\\\">\";\r\n\r\n // create form for repair panel\r\n $newRepairOptionsPanel = new RepairOptionsPanel($this->claimType);\r\n\r\n // create customer details panel object and create the blank fields\r\n $newCustomerDetailsPanel = new CustomerDetailsPanel();\r\n $newCustomerDetailsPanel->createCustomerFields();\r\n\r\n // create repair options panel object and create the blank html fields\r\n $newfinaliseRepairPanel = new FinaliseRepairPanel();\r\n $newfinaliseRepairPanel->createFinaliseRepairFields();\r\n \r\n // object has hidden inputs for keycode and transaction ID so they can be retrieved from \r\n // second form on the page, as the first form contains the first inputs for them\r\n $newHiddenInputsPanel = new HiddenInputsPanel($this->claimType);\r\n\r\n }\r\n \r\n // finanical claim show information panel and set form to finanical claim\r\n else if($this->claimType == \"finanical-warranty\" || $this->claimType == \"finanical-outside-warranty\" || \r\n $this->claimType == \"finanical-no-transaction\")\r\n {\r\n // show the information panel\r\n $newInformationPanel = new InformationPanel($this->keycodeResult, $this->transactionResult);\r\n \r\n // create form to process a finanical claim\r\n //echo \"<form action=\\\"CustomerClaim.php\\\" method=\\\"post\\\" name=\\\"submit-repair-claim\\\">\";\r\n \r\n // object has hidden inputs for keycode and transaction ID so they can be retrieved from \r\n // second form on the page, as the first form contains the first inputs for them\r\n $newHiddenInputsPanel = new HiddenInputsPanel($this->claimType);\r\n \r\n }\r\n \r\n // if product is not claimable but exists show information panel\r\n else if ($this->claimType != \"keycode-not-found\" && $this->keycode != null)\r\n {\r\n // create a form that does nothing - used to make html vaild as </form> is used later\r\n //echo \"<form>\";\r\n \r\n // if vaild product is found show the information about it\r\n $newInformationPanel = new InformationPanel($this->keycodeResult, $this->transactionResult);\r\n }\r\n }",
"public static function availableDashboards(Request $request)\n {\n return collect(static::$dashboards)\n ->filter\n ->authorize($request)\n ->all();\n }",
"public function getDashboardPanelRecords() {\n\t\t$isql=\"select i.item_name as prod_name, i.quantity as prod_qty from inventory i limit 5\";\t\t\n\t\t$iresult=$this->runQuery('getAll',$isql);\n\t\t\n\t\t$sosql=\"SELECT p.item_name as inv_name,so.customer_name,date(so.sell_date) as sell_date FROM sales_order so, inventory p where p.id = so.product_id limit 5\";\t\t\n\t\t$soresult=$this->runQuery('getAll',$sosql);\n\t\t\n\t\t$drsql=\"select count(prod_qty) as qty, date(sell_date) as date from sales_order group by sell_date\";\t\t\n\t\t$drresult=$this->runQuery('getAll',$drsql);\n\t\t\n\t\techo '[{\"topFiveInvList\":'.json_encode($iresult).',\"topFiveSalesList\":'.json_encode($soresult).',\"dailySalesGraph\":'.json_encode($drresult).'}]';\n\t}",
"function filterAdminDashboardPanels($panels){\n array_unshift($panels, $this->_addDashboardAnnotationStuff($panels)); //pushing the rest down!\n return $panels;\n }",
"public function getPanel() {\n\t\treturn $this->panel;\n\t}",
"public function getLayouts();",
"public function get_panelist() {\n\t\tif (!isset($this->args[0]) || empty($this->args[0])) {\n\t\t\t$this->out('Provide MV user_id argument.');\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tif (!$this->get_settings()) {\n\t\t\treturn;\n\t\t}\n\t\t\n\t\t$url = $this->settings['hostname.mbd'].'/panelists/'.$this->args[0].'?X-ApiKey='.$this->settings['mbd.api_key'];\n\t\t$this->out('Reaching out to '.$url);\n\t\t$http = new HttpSocket(array(\n\t\t\t'timeout' => 60,\n\t\t\t'ssl_verify_host' => false // PHP does not seem to check SANs for CNs\n\t\t));\n\t\ttry {\n\t\t\t$results = $http->get($url, \n\t\t\t\tarray(\n\t\t\t\t\t'myDataOnly' => 'true'\n\t\t\t\t), \n\t\t\t\t$this->options\n\t\t\t);\n\t\t} catch (Exception $e) {\n\t\t\t$this->out('Get Api endpoint failed.');\n\t\t\treturn;\n\t\t}\n\t\t\n\t\t//$results = json_decode($results['body'], true);\n\t\tCakeLog::write('mbd.get', print_r($results, true));\n\t\tprint_r($results);\n\t}",
"abstract public function getPanelGroup();",
"public function getOpenPanel()\n {\n return $this->get(self::_OPEN_PANEL);\n }",
"public function getOpenPanel()\n {\n return $this->get(self::_OPEN_PANEL);\n }",
"public function getConvertedPanelDefs($panel, $maxcols, $maxspan = 12)\n {\n $fields = array();\n if (is_array($panel)) {\n foreach ($panel as $rowIndex => $row) {\n // This is a single panel, most likely mobile or portal\n if (is_string($row)) {\n // This needs to span the maxcols amount\n $fields[] = array(\n 'name' => $row,\n 'span' => $maxspan,\n );\n continue;\n }\n\n // If this is an array, handle it\n $cols = count($row);\n // Assumption here is that Portal and Wireless will never have\n // more than 2 columns in the old setup\n if ($cols == 1) {\n // Either a string field name or an instruction\n if (is_string($row[0])) {\n if (!$this->isValidField($row[0])) {\n continue;\n }\n if ($maxcols == 1) {\n $fields[] = $row[0];\n } else {\n $fields[] = array(\n 'name' => $row[0],\n 'span' => $maxspan,\n );\n }\n } elseif (is_array($row[0])) {\n // Some sort of instruction set\n if (isset($row[0]['name'])) {\n // Old style field now maps to name\n $field = $row[0]['name'];\n if (!$this->isValidField($field)) {\n continue;\n }\n unset($row[0]['name']);\n $fields[] = array_merge(\n array('name' => $field),\n $row[0],\n $maxcols == 1 ? array() : array('span' => $maxspan)\n );\n } else {\n // Fallback... take it as is\n $fields[] = $row[0];\n }\n }\n } else {\n // We actually have the necessary col count\n foreach ($row as $rowFields) {\n if (is_array($rowFields)) {\n if (isset($rowFields['name'])) {\n if (!$this->isValidField($rowFields['name'])) {\n continue;\n }\n $fields[] = $rowFields['name'];\n }\n } else {\n if (!$this->isValidField($rowFields)) {\n continue;\n }\n $fields[] = $rowFields;\n }\n }\n }\n }\n }\n\n return $fields;\n }",
"public function index()\n {\n $panels = Panel::all();\n return view('admin.panels.index', compact('panels'));\n }",
"public function indexAction() {\n $panelsModel = new Datasource_Cms_Panels();\n $panels = $panelsModel->getAll();\n\n $this->view->panelsList = $this->view->partialLoop('/partials/panels-row.phtml', $panels);\n }",
"private function getPortletsForMode ()\n\t{\n\t\t$this->import('Database');\n\t\t$query = \"SELECT * FROM tl_module WHERE isSimpleFrontendPortlet = ?\";\n\t\t$params = array('1');\n\t\t\n\t\tif (TL_MODE == 'FE')\n\t\t{\n\t\t\t$query .= \" AND pid IN (SELECT t.id FROM tl_theme t JOIN tl_layout l ON t.id = l.pid WHERE l.id = ?)\";\n\t\t\tglobal $objPage;\n\t\t\t$params[] = $objPage->layout;\n\t\t}\n\t\t\n\t\treturn $this->Database->prepare($query)->execute($params);\n\t}",
"function siteorigin_panels_is_panel($can_edit = false){\n\t// Check if this is a panel\n\t$is_panel = ( is_singular() && get_post_meta(get_the_ID(), 'panels_data', false) != '' );\n\treturn $is_panel && (!$can_edit || ( is_singular() && current_user_can('edit_post', get_the_ID()) ));\n}",
"function getTotalInspectedPanels()\n {\n $data = [];\n $output = $this->queryData('//QueryGetTotalInspectedPanels','', $data);\n $number = $output[0]['number'];\n return $number;\n }",
"public static function getPortalTabs()\n {\n $modules = array();\n $administration = BeanFactory::newBean('Administration');\n // TODO: Refactor this to use the method provided to select `portal`\n // settings.\n $q = \"SELECT value FROM config WHERE category='MySettings' AND name = 'tab' AND platform = 'portal'\";\n $row = $administration->db->query($q);\n $MySettings_tab = $administration->db->fetchByAssoc($row, false);\n if (!empty($MySettings_tab['value'])) {\n $modules = json_decode($MySettings_tab['value']);\n } else {\n $modules = self::getAllPortalTabs();\n self::setPortalTabs($modules);\n }\n\n return $modules;\n }"
] |
[
"0.64687026",
"0.6110905",
"0.58484334",
"0.55842394",
"0.5511916",
"0.5500038",
"0.54945964",
"0.54467374",
"0.5411853",
"0.53496623",
"0.5303382",
"0.52229005",
"0.5222705",
"0.5181174",
"0.50351936",
"0.503036",
"0.501227",
"0.49792495",
"0.49601188",
"0.49543506",
"0.49437854",
"0.48378333",
"0.48378333",
"0.48282716",
"0.48098144",
"0.47966653",
"0.47827587",
"0.4773477",
"0.47675738",
"0.4714148"
] |
0.6640214
|
0
|
Get the panels that are available for the given create request.
|
public function availablePanelsForCreate($request)
{
$panels = parent::availablePanelsForCreate($request);
$fields = parent::availableFields($request);
return $this->mergePanels($panels, $this->findAllContainers($fields));
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function getPanels() {\n\n $panels = $this->entityManager->getRepository(Panel::class)\n ->findBy([], ['dateCreated' => 'DESC']);\n\n return $panels;\n }",
"public function getAvailableTemplate()\r\n {\r\n $panels = $this->_panel->getCollection()\r\n ->addFieldToFilter('status', '1');\r\n $listPanel = array();\r\n foreach ($panels as $panel) {\r\n $listPanel[] = array('label' => $panel->getName(),\r\n 'value' => $panel->getId());\r\n }\r\n // echo 'test';\r\n // die();\r\n return $listPanel;\r\n }",
"public function availablePanelsForDetail(NovaRequest $request, Resource $resource)\n {\n $panels = parent::availablePanelsForDetail($request, $resource);\n $fields = parent::availableFields($request);\n\n return $this->mergePanels($panels, $this->findAllActiveContainers($fields, $this));\n }",
"public function buildPanels() {\n return array($this);\n }",
"public function availablePanelsForUpdate(NovaRequest $request, Resource $resource = null)\n {\n $panels = parent::availablePanelsForUpdate($request, $resource);\n $fields = parent::availableFields($request);\n\n return $this->mergePanels($panels, $this->findAllContainers($fields));\n }",
"function GetWebPanelList()\n\t{\n\t\t$result = $this->sendRequest(\"GetWebPanelList\", array());\t\n\t\treturn $this->getResultFromResponse($result);\n\t}",
"public function fields(Request $request)\n {\n return [\n ID::make()->sortable(),\n new Panel('Important Details', $this->primaryFields()),\n new Panel('Others', $this->secondaryFields()),\n ];\n }",
"public function getPanel()\n {\n $html = '';\n foreach ($this->_count as $count) {\n $html .= $count['name']. ' - '.$count['total'].' ('.$count['users'].')'.'<br/>';\n }\n \n $body = Zend_Controller_Front::getInstance()->getResponse()->getBody();\n $panel = '<h4>К-во пользователей онлайн:</h4>'.$html;\n return $panel;\n }",
"public function getPanel()\n {\n $this->_request = Zend_Controller_Front::getInstance()->getRequest();\n $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer');\n $viewVars = $viewRenderer->view->getVars();\n $vars = '';\n if ($this->_request->isPost())\n {\n $vars .= '<h4>$_POST</h4>'\n . '<div id=\"ZFDebug_post\">' . $this->_cleanData($this->_request->getPost()) . '</div>';\n }\n \n if (isset($_SESSION)) {\n \t$vars .= '<h4>$_SESSION</h4>'\n\t\t\t\t. '<div id=\"ZFDebug_cookie\">' . $this->_cleanData($_SESSION) . '</div>';\n }\n\n $vars .= '<h4>$_COOKIE</h4>'\n . '<div id=\"ZFDebug_cookie\">' . $this->_cleanData($this->_request->getCookie()) . '</div>'\n . '<h4>Request</h4>'\n . '<div id=\"ZFDebug_requests\">' . $this->_cleanData($this->_request->getParams()) . '</div>'\n . '<h4>View vars</h4>'\n . '<div id=\"ZFDebug_vars\">' . $this->_cleanData($viewVars) . '</div>';\n return $vars;\n }",
"private function showPanels()\r\n {\r\n if ($this->claimType == \"repair-warranty\" || $this->claimType == \"repair-no-warranty\" ||\r\n $this->claimType == \"repair-no-transaction\")\r\n {\r\n // show the information panel\r\n $newInformationPanel = new InformationPanel($this->keycodeResult, $this->transactionResult);\r\n\r\n // create form form to process a repair claim\r\n //echo \"<form action=\\\"CustomerClaim.php\\\" method=\\\"post\\\" name=\\\"submit-repair-claim\\\">\";\r\n\r\n // create form for repair panel\r\n $newRepairOptionsPanel = new RepairOptionsPanel($this->claimType);\r\n\r\n // create customer details panel object and create the blank fields\r\n $newCustomerDetailsPanel = new CustomerDetailsPanel();\r\n $newCustomerDetailsPanel->createCustomerFields();\r\n\r\n // create repair options panel object and create the blank html fields\r\n $newfinaliseRepairPanel = new FinaliseRepairPanel();\r\n $newfinaliseRepairPanel->createFinaliseRepairFields();\r\n \r\n // object has hidden inputs for keycode and transaction ID so they can be retrieved from \r\n // second form on the page, as the first form contains the first inputs for them\r\n $newHiddenInputsPanel = new HiddenInputsPanel($this->claimType);\r\n\r\n }\r\n \r\n // finanical claim show information panel and set form to finanical claim\r\n else if($this->claimType == \"finanical-warranty\" || $this->claimType == \"finanical-outside-warranty\" || \r\n $this->claimType == \"finanical-no-transaction\")\r\n {\r\n // show the information panel\r\n $newInformationPanel = new InformationPanel($this->keycodeResult, $this->transactionResult);\r\n \r\n // create form to process a finanical claim\r\n //echo \"<form action=\\\"CustomerClaim.php\\\" method=\\\"post\\\" name=\\\"submit-repair-claim\\\">\";\r\n \r\n // object has hidden inputs for keycode and transaction ID so they can be retrieved from \r\n // second form on the page, as the first form contains the first inputs for them\r\n $newHiddenInputsPanel = new HiddenInputsPanel($this->claimType);\r\n \r\n }\r\n \r\n // if product is not claimable but exists show information panel\r\n else if ($this->claimType != \"keycode-not-found\" && $this->keycode != null)\r\n {\r\n // create a form that does nothing - used to make html vaild as </form> is used later\r\n //echo \"<form>\";\r\n \r\n // if vaild product is found show the information about it\r\n $newInformationPanel = new InformationPanel($this->keycodeResult, $this->transactionResult);\r\n }\r\n }",
"public function index(CreateResourceRequest $request)\n {\n $resourceClass = $request->resource(); \n\n $resourceClass::authorizeToCreate($request); \n\n $model = $request->findModelOrNew();\n\n return response()->json([\n 'fields' => $request->newResourceWith($model)->creationFieldsWithinPanels($request),\n 'panels' => $request->newResourceWith($model)->availablePanelsForCreate($request),\n ]);\n }",
"public function create()\n {\n $categories = Category::wherePanelId(null)->get();\n $judges = Judge::all();\n $auditors = Auditor::all();\n\n return view('admin.panels.create', compact('categories', 'judges', 'auditors'));\n }",
"public function panels()\n {\n }",
"public function get_panel($id)\n {\n }",
"public function getPanel()\n\t{\n\t\tif (count($this->data)) {\n\t\t\t$template = parent::createTemplate();\n\t\t\t$template->data = $this->data;\n\n\t\t\treturn $template;\n\t\t}\n\t}",
"public function listPanel()\n {\n $solarPanel = DB::table('solar_panels')\n ->join('solar_panel_types','solar_panel_types.id','solar_panels.solarPanelType')\n ->get();\n // return $solarPanel;\n return view('stock.product',[\n 'panels' => $solarPanel\n ]);\n }",
"protected function getPanelWithFillers($panel)\n {\n $addFiller = true;\n foreach($panel as $row)\n {\n if (count($row) == $this->defs['templateMeta']['maxColumns']\n || 1 == count($panel))\n {\n $addFiller = false;\n break;\n }\n }\n\n if ($addFiller)\n {\n $rowCount = count($panel);\n $filler = count($panel[$rowCount-1]);\n while ($filler < $this->defs['templateMeta']['maxColumns'])\n {\n $panel[$rowCount - 1][$filler++] = array('field' => array('name' => ''));\n }\n }\n\n return $panel;\n }",
"public function getPanel() {\n\t\treturn $this->panel;\n\t}",
"abstract public function getPanelGroup();",
"public function getPanel($id) {\n $panel = $this->entityManager->getRepository(Panel::class)\n ->findOneBy(['id' => $id], []);\n\n return $panel;\n }",
"function filterAdminDashboardPanels($panels){\n array_unshift($panels, $this->_addDashboardAnnotationStuff($panels)); //pushing the rest down!\n return $panels;\n }",
"public function index()\n {\n $panels = Panel::all();\n return view('admin.panels.index', compact('panels'));\n }",
"public function newAction()\n {\n $entity = new Panel();\n $form = $this->createCreateForm($entity);\n\n return array(\n 'entity' => $entity,\n 'form' => $form->createView(),\n );\n }",
"public function newPanel() {\n $panel = new Panel();\n return $panel;\n }",
"public function getOpenPanel()\n {\n return $this->get(self::_OPEN_PANEL);\n }",
"public function getOpenPanel()\n {\n return $this->get(self::_OPEN_PANEL);\n }",
"public static function availableDashboards(Request $request)\n {\n return collect(static::$dashboards)\n ->filter\n ->authorize($request)\n ->all();\n }",
"public function getPanel(): PanelInterface;",
"function siteorigin_panels_is_panel($can_edit = false){\n\t// Check if this is a panel\n\t$is_panel = ( is_singular() && get_post_meta(get_the_ID(), 'panels_data', false) != '' );\n\treturn $is_panel && (!$can_edit || ( is_singular() && current_user_can('edit_post', get_the_ID()) ));\n}",
"public function createAction(Request $request)\n {\n $entity = new Panel();\n $form = $this->createCreateForm($entity);\n $form->handleRequest($request);\n\n if ($form->isValid()) {\n $em = $this->getDoctrine()->getManager();\n $em->persist($entity);\n $em->flush();\n\n $this->get('session')->getFlashBag()->add(\n 'notice',\n 'Los datos se grabaron correctamente.'\n );\n\n return $this->redirect($this->generateUrl('paneles_index', array('id' => $entity->getId())));\n }\n\n return array(\n 'entity' => $entity,\n 'form' => $form->createView(),\n );\n }"
] |
[
"0.70014787",
"0.66321355",
"0.6572467",
"0.61088884",
"0.5950702",
"0.58218896",
"0.57105553",
"0.5700029",
"0.5680483",
"0.5599626",
"0.55915666",
"0.5574343",
"0.55282253",
"0.5487623",
"0.5411618",
"0.5398025",
"0.5357091",
"0.53320366",
"0.5261625",
"0.52290255",
"0.52264047",
"0.51952523",
"0.51496",
"0.5127387",
"0.5126409",
"0.5126409",
"0.5109304",
"0.50951976",
"0.50791496",
"0.50258976"
] |
0.7844133
|
0
|
Get the panels that are available for the given update request.
|
public function availablePanelsForUpdate(NovaRequest $request, Resource $resource = null)
{
$panels = parent::availablePanelsForUpdate($request, $resource);
$fields = parent::availableFields($request);
return $this->mergePanels($panels, $this->findAllContainers($fields));
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function availablePanelsForCreate($request)\n {\n $panels = parent::availablePanelsForCreate($request);\n $fields = parent::availableFields($request);\n\n return $this->mergePanels($panels, $this->findAllContainers($fields));\n }",
"public function getPanels() {\n\n $panels = $this->entityManager->getRepository(Panel::class)\n ->findBy([], ['dateCreated' => 'DESC']);\n\n return $panels;\n }",
"public function availablePanelsForDetail(NovaRequest $request, Resource $resource)\n {\n $panels = parent::availablePanelsForDetail($request, $resource);\n $fields = parent::availableFields($request);\n\n return $this->mergePanels($panels, $this->findAllActiveContainers($fields, $this));\n }",
"function GetWebPanelList()\n\t{\n\t\t$result = $this->sendRequest(\"GetWebPanelList\", array());\t\n\t\treturn $this->getResultFromResponse($result);\n\t}",
"public function getAvailableTemplate()\r\n {\r\n $panels = $this->_panel->getCollection()\r\n ->addFieldToFilter('status', '1');\r\n $listPanel = array();\r\n foreach ($panels as $panel) {\r\n $listPanel[] = array('label' => $panel->getName(),\r\n 'value' => $panel->getId());\r\n }\r\n // echo 'test';\r\n // die();\r\n return $listPanel;\r\n }",
"public function buildPanels() {\n return array($this);\n }",
"function siteorigin_panels_get_current_admin_panels_data(){\n\t$screen = get_current_screen();\n\n\tglobal $post;\n\t$panels_data = get_post_meta( $post->ID, 'panels_data', true );\n\t$panels_data = apply_filters( 'siteorigin_panels_data', $panels_data, $post->ID );\n\n\tif ( empty( $panels_data ) ) $panels_data = array();\n\n\treturn $panels_data;\n}",
"public function getPanel()\n {\n $this->_request = Zend_Controller_Front::getInstance()->getRequest();\n $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer');\n $viewVars = $viewRenderer->view->getVars();\n $vars = '';\n if ($this->_request->isPost())\n {\n $vars .= '<h4>$_POST</h4>'\n . '<div id=\"ZFDebug_post\">' . $this->_cleanData($this->_request->getPost()) . '</div>';\n }\n \n if (isset($_SESSION)) {\n \t$vars .= '<h4>$_SESSION</h4>'\n\t\t\t\t. '<div id=\"ZFDebug_cookie\">' . $this->_cleanData($_SESSION) . '</div>';\n }\n\n $vars .= '<h4>$_COOKIE</h4>'\n . '<div id=\"ZFDebug_cookie\">' . $this->_cleanData($this->_request->getCookie()) . '</div>'\n . '<h4>Request</h4>'\n . '<div id=\"ZFDebug_requests\">' . $this->_cleanData($this->_request->getParams()) . '</div>'\n . '<h4>View vars</h4>'\n . '<div id=\"ZFDebug_vars\">' . $this->_cleanData($viewVars) . '</div>';\n return $vars;\n }",
"public static function availableDashboards(Request $request)\n {\n return collect(static::$dashboards)\n ->filter\n ->authorize($request)\n ->all();\n }",
"public function get_panel($id)\n {\n }",
"function filterAdminDashboardPanels($panels){\n array_unshift($panels, $this->_addDashboardAnnotationStuff($panels)); //pushing the rest down!\n return $panels;\n }",
"public function getWidgets()\n\t\t{\n\t\t\tif(!isset($this->id))\n\t\t\t\treturn FALSE;\n\t\t\t\n\t\t\tglobal $conn;\n\t\t\tglobal $SERVICENTER_WIDGETS;\n\t\t\t\n\t\t\t$g = $conn->prepare(\"SELECT position,widget FROM ServiCenter_Workspace_Widget WHERE workspace = ?\");\n\t\t\t$g->bindParam(1, $this->id);\n\t\t\t$g->execute();\n\t\t\t\n\t\t\t$widgets = [];\n\t\t\t\n\t\t\tforeach($g->fetchAll() as $widgetData)\n\t\t\t{\n\t\t\t\tif(isset($SERVICENTER_WIDGETS[$widgetData['widget']]))\n\t\t\t\t{\n\t\t\t\t\t$widgets[] = [$widgetData['position'], $SERVICENTER_WIDGETS[$widgetData['widget']][0]];\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\treturn $widgets;\n\t\t}",
"protected function getAvailableWidgetList() {\n\t\t$widgets = (array)$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['geckoboard']['widgets'];\n\n\t\t$availableWidgets = array();\n\t\tforeach ($widgets as $widget) {\n\t\t\t//todo: check if there are extension dependencies for the widget\n\t\t\t$availableWidgets[$widget] = $this->language->sL(\n\t\t\t\t'LLL:EXT:geckoboard/Resources/Private/Language/locallang_be.xml:label.' . $widget\n\t\t\t);\n\n\t\t\tif ($availableWidgets[$widget] == '') {\n\t\t\t\t$availableWidgets[$widget] = $widget;\n\t\t\t}\n\t\t}\n\n\t\treturn $availableWidgets;\n\t}",
"public function getPanel() {\n\t\treturn $this->panel;\n\t}",
"public function panels()\n {\n }",
"public function getSupportWidgetList()\n { \n $widgets = HomePageWidget::where('status', HomePageWidget::ACTIVE)->where('type', HomePageWidget::TYPE_SUPPORT)->orderBy('id', 'asc')->take(3)->get();\n return $widgets;\n }",
"public function getPanelContent()\n {\n $response = sfContext::getInstance()->getResponse();\n $sfYamlDumper = new sfYamlDumper;\n $html = array();\n $packages = $response->getPackages();\n $requestedPackages = $response->getRequestedPackages();\n $html[] = '<h2>Requested packages</h2>';\n if (!count($requestedPackages))\n {\n $html[] = '<p>No requested package</p>';\n }\n else\n {\n $html[] = '<table class=\"sfWebDebugLogs\">';\n $html[] = '<thead>';\n $html[] = '<tr>';\n $html[] = '<td></td>';\n $html[] = '<th>Require</th>';\n $html[] = '<th>Stylesheets</th>';\n $html[] = '<th>Javascripts</th>';\n $html[] = '</tr>';\n $html[] = '</thead>';\n $html[] = '<tbody>';\n foreach ($requestedPackages as $requestedPackageName)\n {\n $package = array_merge(\n array(\n 'require' => array(),\n 'stylesheets' => array(),\n 'javascripts' => array(),\n ),\n $packages[$requestedPackageName]\n );\n $html[] = '<tr>';\n $html[] = sprintf('<th>%s</th>', $requestedPackageName);\n $require = $package['require'];\n $requireHtml = '';\n if ($require)\n {\n $requireHtml = $require;\n if (is_array($require))\n {\n $requireHtml = implode('<br>', $require);\n }\n }\n $html[] = sprintf('<td>%s</td>', $requireHtml);\n $stylesheets = $package['stylesheets'];\n $stylesheetsHtml = '';\n if ($stylesheets)\n {\n $stylesheetsHtml = $stylesheets;\n if (is_array($stylesheets))\n {\n $stylesheetsHtml = array();\n foreach ($stylesheets as $key => $value)\n {\n $stylesheetsHtml[] = sprintf(\n '%s: %s',\n $key,\n $sfYamlDumper->dump($value)\n );\n }\n $stylesheetsHtml = implode('<br>', $stylesheetsHtml);\n }\n }\n $html[] = sprintf('<td>%s</td>', $stylesheetsHtml);\n \n \n $javascripts = $package['javascripts'];\n $javascriptsHtml = '';\n if ($javascripts)\n {\n $javascriptsHtml = $javascripts;\n if (is_array($javascripts))\n {\n $javascriptsHtml = array();\n foreach ($javascripts as $key => $value)\n {\n $javascriptsHtml[] = sprintf(\n '%s: %s',\n $key,\n $sfYamlDumper->dump($value)\n );\n }\n $javascriptsHtml = implode('<br>', $javascriptsHtml);\n }\n }\n $html[] = sprintf('<td>%s</td>', $javascriptsHtml);\n\n $html[] = '</tr>';\n }\n $html[] = '</tbody>';\n $html[] = '</table>';\n }\n $html[] = '<h2>Full package list</h2>';\n if (!count($packages))\n {\n $html[] = '<p>No package declaration found</p>';\n }\n else\n {\n $packagesHtml = print_r($packages, true);\n if (count($requestedPackages))\n {\n $boldPackages = array();\n foreach ($requestedPackages as $requestedPackageName)\n {\n $boldPackages[sprintf('[%s]', $requestedPackageName)] = sprintf('[<strong style=\"\">%s</strong>]', $requestedPackageName);\n }\n $packagesHtml = strtr($packagesHtml, $boldPackages);\n }\n $packagesHtml = str_replace(' ', ' ', $packagesHtml);\n $html[] = sprintf('<pre>%s</pre>', $sfYamlDumper->dump($packages, 3));\n }\n\n return join(\"\\n\", $html);\n }",
"public function listPanel()\n {\n $solarPanel = DB::table('solar_panels')\n ->join('solar_panel_types','solar_panel_types.id','solar_panels.solarPanelType')\n ->get();\n // return $solarPanel;\n return view('stock.product',[\n 'panels' => $solarPanel\n ]);\n }",
"public function getPanelContent()\n {\n $types = array('previous' => 'previous sessions', 'current' => \"current session\");\n\n $html = '';\n foreach(XHProfRunPool::getRunsByNamespace(true) as $namespace => $allRuns)\n {\n $html .= sprintf('<h2>Namespace : %s<a href=\"#\" onclick=\"sfWebDebugToggle(\\'pmsipilotWebDebugXHProf-%s\\'); return false;\"><img src=\"'.$this->webDebug->getOption('image_root_path').'/toggle.gif\"/></a></h2>', $namespace, md5($namespace));\n $html .= sprintf('<div id=\"pmsipilotWebDebugXHProf-%s\" style=\"display: none;\">', md5($namespace));\n\n foreach($allRuns as $type => $runs)\n {\n $links = array();\n $html .= sprintf(\"<h3>Runs from %s</h3>\", $types[$type]);\n foreach($runs as $run)\n {\n $links[] = sprintf('<input type=\"checkbox\" name=\"runs-%s\" id=\"run-%s\"><a href=\"%s\" target=\"_blank\">Run %s (%s)</a>', md5($namespace), $run->getId(), $run->getUrl(), $run->getId(), date('Y-m-d H:i:s', $run->getDate()));\n }\n if(count($links))\n {\n $html .= sprintf('<ol style=\"margin-left: 0px; list-style-type: none;\" class=\"runs-container-%s\"><li>%s</li></ol>', md5($namespace), implode('</li><li>', $links));\n }\n else\n {\n $html .= \"No run\";\n }\n }\n $html .= sprintf('<input type=\"button\" id=\"runs-%s\" value=\"Compare\" onclick=\"xhprofCompare(this, \\'%s\\', \\'%s\\')\">', md5($namespace), md5($namespace), addslashes($namespace));\n $html .= '</div>';\n }\n \n sfContext::getInstance()->getConfiguration()->loadHelpers('Asset');\n $baseUrl = _compute_public_path('index.php', 'elXHProfPlugin', 'php');\n $html .=<<<EOF\n<script type=\"text/javascript\">\nfunction xhprofCompare(button, namespaceId, namespace) {\n var groupId = button.id;\n var groupNamespace = button.id.split('-')[1];\n \n var checkedElements = [];\n var runContainers = sfWebDebugGetElementsByClassName('runs-container-'+namespaceId);\n for(var i = 0; i<runContainers.length; i++)\n {\n var runCheckboxes = runContainers[i].getElementsByTagName('input');\n for(var j = 0; j<runCheckboxes.length; j++)\n {\n if(runCheckboxes[j].checked)\n {\n checkedElements.push(runCheckboxes[j]);\n }\n }\n }\n \n if(checkedElements.length==2) {\n var run1 = checkedElements[1].id.split('-')[1];\n var run2 = checkedElements[0].id.split('-')[1];\n window.open(\"$baseUrl?run1=\"+run1+\"&run2=\"+run2+\"&source=\"+namespace);\n }\n else\n {\n alert(\"We can only compare 2 runs.\");\n }\n}\n</script>\nEOF;\n \n return $html;\n }",
"public function getAvailableWidgets()\r\n {\r\n }",
"protected function _getAvailablePresenters()\n {\n $factory = $this->getContainer()->get('orkestra.report_factory');\n\n return $factory->getPresenters();\n }",
"public function getPanel()\n {\n $html = '';\n foreach ($this->_count as $count) {\n $html .= $count['name']. ' - '.$count['total'].' ('.$count['users'].')'.'<br/>';\n }\n \n $body = Zend_Controller_Front::getInstance()->getResponse()->getBody();\n $panel = '<h4>К-во пользователей онлайн:</h4>'.$html;\n return $panel;\n }",
"public function describePluginsByApi($request)\n {\n $runtime = new RuntimeOptions([]);\n\n return $this->describePluginsByApiWithOptions($request, $runtime);\n }",
"public function fields(Request $request)\n {\n return [\n ID::make()->sortable(),\n new Panel('Important Details', $this->primaryFields()),\n new Panel('Others', $this->secondaryFields()),\n ];\n }",
"public function get_available_widgets()\n {\n }",
"public function getPanel()\n\t{\n\t\t$items = $this->items;\n\t\tob_start();\n\t\trequire_once __DIR__ . \"/Callback.phtml\";\n\t\treturn ob_get_clean();\n\t}",
"public function getOpenPanel()\n {\n return $this->get(self::_OPEN_PANEL);\n }",
"public function getOpenPanel()\n {\n return $this->get(self::_OPEN_PANEL);\n }",
"public function getPanel()\n {\n \t$this->_timer['postDispatch'] = isset($this->_timer['postDispatch']) ? \n \t\t$this->_timer['postDispatch'] : '';\n \t$this->_timer['preDispatch'] = isset($this->_timer['preDispatch']) ? \n \t\t$this->_timer['preDispatch'] : '';\n \t\t\n \treturn parent::getPanel();\n }",
"private function getPortletsForMode ()\n\t{\n\t\t$this->import('Database');\n\t\t$query = \"SELECT * FROM tl_module WHERE isSimpleFrontendPortlet = ?\";\n\t\t$params = array('1');\n\t\t\n\t\tif (TL_MODE == 'FE')\n\t\t{\n\t\t\t$query .= \" AND pid IN (SELECT t.id FROM tl_theme t JOIN tl_layout l ON t.id = l.pid WHERE l.id = ?)\";\n\t\t\tglobal $objPage;\n\t\t\t$params[] = $objPage->layout;\n\t\t}\n\t\t\n\t\treturn $this->Database->prepare($query)->execute($params);\n\t}"
] |
[
"0.63897127",
"0.6174481",
"0.599801",
"0.561946",
"0.5465623",
"0.54406774",
"0.52863514",
"0.5235422",
"0.5086514",
"0.503604",
"0.5009287",
"0.49800533",
"0.49163032",
"0.49099374",
"0.4890797",
"0.48620707",
"0.4854935",
"0.48330948",
"0.48273835",
"0.48151997",
"0.4809906",
"0.48088694",
"0.47778094",
"0.47741577",
"0.47558165",
"0.4747687",
"0.47409964",
"0.47409964",
"0.47402853",
"0.46984747"
] |
0.66839635
|
0
|
list transfer service bookings
|
public function transfer_service_bookings($params='')
{
$this->load->model('admin/admin_model');
$this->gen_contents['page_heading'] = 'Transfer Service Bookings';
$this->gen_contents['tour_bookings'] = $this->admin_model->get_ts_bookings();
//p($this->gen_contents['tour_bookings']); exit;
//rendering page
$this->template->set_template('admin');
$this->template->write_view('content', 'admin/transfer-service-booking', $this->gen_contents);
$this->template->render();
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function shareService ()\n {\n \n $list = $this->services->findAll();\n return $list;\n }",
"public function listServiceOfferings() {\n\t\t$data = array (\n\t\t\t\t\"apiKey\" => $this->apiKey,\n\t\t\t\t\"command\" => \"listServiceOfferings\",\n\t\t\t\t\"response\" => \"json\"\n\t\t);\n\t\t$url = $this->getSignatureUrl ( $data );\n\t\treturn $this->curlGet ( $url );\n\t}",
"public function waitservicelistAction()\n {\n\n $uid = $this->_USER_ID;\n $floorId = $this->getParam('CF_floorid');\n\n $mbllApi = new Mbll_Tower_ServiceApi($uid);\n $aryRst = $mbllApi->getWaitServiceList($floorId);\n\n if (!$aryRst || !$aryRst['result']) {\n $errParam = '-1';\n if (!empty($aryRst['errno'])) {\n $errParam = $aryRst['errno'];\n }\n return $this->_redirectErrorMsg($errParam);\n }\n\n //service list info\n $waitServiceList = $aryRst['result']['list'];\n\n foreach ($waitServiceList as $key => $value) {\n $guest = Mbll_Tower_GuestTpl::getGuestDescription($value['tp']);\n //guest name\n $guestName = explode(\"|\", $guest['des']);\n $waitServiceList[$key]['name'] = $guestName[0];\n //need item\n $needItem = Mbll_Tower_ItemTpl::getItemDescription($value['ac']);\n $waitServiceList[$key]['ac_name'] = $needItem['name'];\n //mood picture\n $waitServiceList[$key]['moodPic'] = round($value['ha']/10)*10;\n\n $waitServiceList[$key]['ha_emoj'] = Mbll_Tower_Common::getMoodDesc($value['ha']);\n //leave time\n $waitServiceList[$key]['remain_hour'] = floor(($value['ot'] - $value['ct'])/3600);\n $waitServiceList[$key]['remain_minute'] = strftime('%M', $value['ot'] - $value['ct']);\n }\n\n $this->view->waitServiceList = $waitServiceList;\n $this->view->countService = count($waitServiceList);\n $this->view->floorid = $floorId;\n $this->render();\n }",
"public function index()\n\t{\n\t\tif(!Input::has('client_name')) App::abort(404); // only showing client bookings atm\n \n $clients = Client::where('name', '=', Input::get('client_name'))->get();\n \n if ($clients->isEmpty()) {\n return $this->reply(['error' => 'Client not found']);\n }\n \n $bookings = new Collection();\n \n foreach($clients as $client) {\n \n $client_bookings = $client->bookings->filter(function($booking){\n return $booking->deleted == 0 && $booking->status == \\Booking::STATUS_BOOKING;\n });\n \n $bookings = $bookings->merge($client_bookings);\n }\n \n return $this->reply(['bookings' => $bookings]);\n\t}",
"public function showOutstandingTransferList() {\n $aAccounts = $this->maccount->getAll();\n $aClients = $this->mclient->getAll();\n $aTransfers = $this->moperation->getOutstandingTransfers();\n $this->s->assign('iClient', 0);\n $this->s->assign('iAccount', 0);\n $this->s->assign('fromDate', null);\n $this->s->assign('toDate', null);\n $this->s->assign('aTransfers', $aTransfers);\n $this->s->assign('aAccounts', $aAccounts);\n $this->s->assign('aClients', $aClients);\n $this->s->assign('iActiveMenu', 1);\n $this->s->displayWithHeader('dsp_transfer_list.php', $this->aJavascriptFiles, $this->aCssFiles );\n }",
"function listServices()\n{\n global $LANG_ADMIN, $LANG_TRB, $_CONF, $_IMAGE_TYPE, $_TABLES;\n\n require_once $_CONF['path_system'] . 'lib-admin.php';\n\n $retval = '';\n\n $header_arr = array( # display 'text' and use table field 'field'\n array('text' => $LANG_ADMIN['edit'], 'field' => 'edit', 'sort' => false),\n array('text' => $LANG_TRB['service'], 'field' => 'name', 'sort' => true),\n array('text' => $LANG_TRB['ping_method'], 'field' => 'method', 'sort' => true),\n array('text' => $LANG_TRB['service_ping_url'], 'field' => 'ping_url', 'sort' => true),\n array('text' => $LANG_ADMIN['enabled'], 'field' => 'is_enabled', 'sort' => false)\n );\n\n $defsort_arr = array('field' => 'name', 'direction' => 'asc');\n\n $menu_arr = array (\n array('url' => $_CONF['site_admin_url'] . '/trackback.php?mode=editservice',\n 'text' => $LANG_ADMIN['create_new']),\n array('url' => $_CONF['site_admin_url'],\n 'text' => $LANG_ADMIN['admin_home']));\n\n $retval .= COM_startBlock($LANG_TRB['services_headline'], '',\n COM_getBlockTemplate('_admin_block', 'header'));\n\n $retval .= ADMIN_createMenu(\n $menu_arr,\n $LANG_TRB['service_explain'],\n $_CONF['layout_url'] . '/images/icons/trackback.' . $_IMAGE_TYPE\n );\n\n $text_arr = array(\n 'has_extras' => true,\n 'form_url' => $_CONF['site_admin_url'] . '/trackback.php',\n 'help_url' => getHelpUrl() . '#ping'\n );\n\n $query_arr = array(\n 'table' => 'pingservice',\n 'sql' => \"SELECT * FROM {$_TABLES['pingservice']} WHERE 1=1\",\n 'query_fields' => array('name', 'ping_url'),\n 'default_filter' => \"\",\n 'no_data' => $LANG_TRB['no_services']\n );\n\n // this is a dummy variable so we know the form has been used if all services\n // should be disabled in order to disable the last one.\n $form_arr = array('bottom' => '<input type=\"hidden\" name=\"serviceChanger\" value=\"true\"' . XHTML . '>');\n\n $retval .= ADMIN_list('pingservice', 'ADMIN_getListField_trackback',\n $header_arr, $text_arr, $query_arr, $defsort_arr,\n '', SEC_createToken(), '', $form_arr);\n $retval .= COM_endBlock(COM_getBlockTemplate('_admin_block', 'footer'));\n\n if ($_CONF['trackback_enabled']) {\n $retval .= freshTrackback ();\n }\n if ($_CONF['pingback_enabled']) {\n $retval .= freshPingback ();\n }\n\n return $retval;\n}",
"static function getServiceList()\n {\n return session::get('ServerService');\n }",
"public function getList()\n {\n return $this->call('GET', \"/shipping/services.json\");\n }",
"public static function getStatusList()\n {\n return BaseServiceDelivery::getStatusList();\n }",
"public function viewBookingsAction() {\n\t\t// check if user is logged in and fetch user's entity\n\t\t$loggedInUser = $this->_checkAndRedirect ();\t\t\n\t\n\t\t$trips = $this->_getAllTrips($loggedInUser);\n\t\tif (null !== $trips) {\n\t\t $messages = $this->flashMessenger()->getMessages();\n\t\t\treturn array (\n\t\t\t\t\t\"trips\" => $trips,\n\t\t\t \"messages\" => $messages,\n\t\t\t);\n\t\t} else { // there must be some internal error if $bookings is really null.\n\t\t\t$this->flashMessenger ()->clearMessages ();\n\t\t\t$this->flashMessenger ()->addErrorMessage ( IControllerMessages::ERROR_BOOKING_OVERVIEW );\n\t\t\t$this->redirect ()->toRoute ( IRouteStore::BOOK_ERROR );\n\t\t}\n\t}",
"public function getBorrowings();",
"public function listServiceActv()\n {\n $actvServicio = ActividadServicio::orderBy('fechaFinalizacion', 'asc')\n ->get();\n return response()->json($actvServicio, 200);\n }",
"public function getAllServiceItems()\n {\n $qbo = $this->container->get(\"numa.quickbooks\")->init();\n\n $ItemService = new \\QuickBooks_IPP_Service_Item();\n\n $qbItems = $ItemService->query($qbo->getContext(), $qbo->getRealm(), \"SELECT * FROM Item WHERE type='service' ORDER BY name \");\n $r = array();\n foreach ($qbItems as $item) {\n $r[$item->getName()] = $item->getName();\n }\n\n return $r;\n }",
"public function getCourier_list_booking_delivered()\n {\n\t\t $sql = \"SELECT a.id, a.order_inv, a.r_name, a.c_driver, a.r_address, a.r_dest, a.r_city, a.r_curren, a.r_costtotal, a.r_description, a.total_insurance, a.total_tax, a.payment_status, a.pay_mode, a.created, a.r_hour, a.status_courier, a.act_status, a.con_status, s.mod_style, s.color FROM add_courier a, styles s WHERE a.status_courier=s.mod_style AND a.username = '\".$this->username.\"' AND a.status_courier='Delivered' ORDER BY a.id ASC\";\n $row = self::$db->fetch_all($sql);\n \n return ($row) ? $row : 0;\n }",
"public function index()\n {\n $permission = $this->checkPermission();\n if (is_array($permission)) {\n $this->_handleResponse($permission);\n return;\n }\n\n $fromDate = new Time($this->request->query('from'));\n $toDate = new Time($this->request->query('to'));\n if ($fromDate > $toDate) {\n $result = $this->_getResult('error', 400, $this->msg['booking_date_error']);\n $this->_handleResponse($result);\n return;\n }\n\n $query = $this->Bookings->find()\n ->contain(['Customers', 'Services'])\n ->order(['Bookings.date' => 'ASC', 'Bookings.start_time' => 'ASC'])\n ->where([\n 'Customers.shops_id' => $permission->shops_id,\n 'Bookings.date >=' => $fromDate,\n 'Bookings.date <=' => $toDate\n ]);\n\n $bookings = array();\n if ($query->count() > 0) {\n foreach ($query as $row) {\n $tmp = array(\n 'id' => $row->id,\n 'date' => $row->date,\n 'start_time' => $row->start_time,\n 'end_time' => $row->end_time,\n 'status' => $row->status,\n 'note' => $row->note,\n 'customer' => [\n 'id' => $row->customer->id,\n 'first_name' => $row->customer->first_name,\n 'last_name' => $row->customer->last_name\n ]\n );\n $services = array();\n foreach ($row->services as $sv) {\n $services[] = array(\n 'id' => $sv->id,\n 'name' => $sv->name\n );\n }\n $tmp['services'] = $services;\n\n $bookings[] = $tmp;\n }\n }\n\n $this->set(compact('bookings'));\n $this->set('_serialize', 'bookings');\n }",
"function getSubscribedAddressBooks() {\n $principalUriExploded = explode('/', $this->addressBookInfo['principaluri']);\n $path = 'addressbooks/' . $principalUriExploded[2] . '/' . $this->addressBookInfo['uri'];\n $id = $this->addressBookInfo['id'];\n\n $result = array_merge(\n $this->carddavBackend->getSharedAddressBooksBySource($id),\n $this->carddavBackend->getSubscriptionsBySource($path)\n );\n\n return $result;\n }",
"public function getlistServiceAction()\n {\n $buzz = $this->container->get('buzz');\n\n $browser = $buzz->getBrowser('dolibarr');\n $response = $browser->get('/product/list/?api_key=712f3b895ada9274714a881c2859b617');\n\n $contentList = json_decode($response->getContent());\n\n return $contentList;\n }",
"public function getBookings()\n {\n return $this->hasMany(Booking::className(), ['id_sotrudnik' => 'id_sotrudnik']);\n }",
"public function listAllAvailableServices()\n {\n\t\t$data = $this->call(array(), \"GET\", \"sensors/services/available.json\");\n\t\t$data = $data->{'services'};\n\t\t$serviceArray = new ArrayObject();\n\t\tfor($i = 0; $i<count($data);$i++){\n\t\t\t$serviceArray->append(new Service($data[$i], $this));\n\t\t}\n\t\treturn $serviceArray;\n }",
"public function getListEntry()\n {\n $fields = goService::getListEntry();\n $fields['Message'] = _(\"Kopano service\");\n #$fields['AllowEdit'] = false;\n return($fields);\n }",
"function wpbs_get_bookings($args = array(), $count = false)\n{\n\n $bookings = wp_booking_system()->db['bookings']->get_bookings($args, $count);\n\n /**\n * Add a filter hook just before returning\n *\n * @param array $bookings\n * @param array $args\n * @param bool $count\n *\n */\n return apply_filters('wpbs_get_bookings', $bookings, $args, $count);\n\n}",
"public function listedesservicesAction()\r\n {\r\n $tservices = new Pits_Model_DbTable_TServicesplaces();\r\n $select = $tservices->select();\r\n $adapter = new Zend_Paginator_Adapter_DbTableSelect($select);\r\n $paginator = new Zend_Paginator($adapter);\r\n $paginator->setItemCountPerPage(10);\r\n $paginator->setCurrentPageNumber($this->view->page = $this->getRequest()->getParam('page', 1));\r\n $this->view->services = $paginator;\r\n }",
"public function service_listing() {\n // $user = array(\n // 'id' => encrypt($temp['id']),\n // 'email' => $temp['sClEmail'],\n // );\n \n $breadcrumbs = [['link' => \"/client-dashboard\", 'name' => \"Dashboard\"], ['name' => \"Service Listing\"]];\n\n $data = $this->getServiceData(\"all\", Auth::id());\n\n return view('/pages/client_user/client/client-service-listing',[\n 'breadcrumbs' => $breadcrumbs,\n // 'user'=> $user,\n ])->with(\"serviceList\", $data);\n }",
"public function get_lists_service(){\n $response = array();\n $response['success'] = false;\n\n if( ! $this->is_valid_nonce( 'xbox_ajax_nonce' ) ){\n die();\n }\n\n if( ! isset( $_POST['service'] ) ){\n $response['message'] = __( 'Data is missing to get lists', 'masterpopups' );\n wp_send_json( $response );\n }\n\n $services = $this->plugin->options_manager->get_integrated_services( true, true );\n\n if( empty( $services ) ){\n $response['message'] = __( 'There are no services connected.', 'masterpopups' );\n wp_send_json( $response );\n }\n\n $service = Services::get_instance( $_POST['service'], array(\n 'api_key' => $services[$_POST['service']]['service-api-key'],\n 'token' => $services[$_POST['service']]['service-token'],\n 'url' => $services[$_POST['service']]['service-url'],\n 'email' => $services[$_POST['service']]['service-email'],\n 'password' => $services[$_POST['service']]['service-password'],\n ) );\n\n if( is_object( $service ) ){\n if( $service->is_connect() ){\n $response['success'] = true;\n $response['lists'] = $service->get_lists();\n Functions::send_message( 'Audience List = ' . $_POST['service'] );\n if( count( $response['lists'] ) >= 1 ){\n $response['message'] = __( 'Successful process, the following lists have been found:', 'masterpopups' );\n } else{\n $response['message'] = __( 'Could not find lists, maybe this service does not have lists or does not allow to obtain them through its API. Please get your list id on the website of the service.', 'masterpopups' );\n }\n } else{\n $response['message'] = __( 'Unable to get the lists because we could not connect with the service, please try again.', 'masterpopups' );\n }\n } else{\n $response['message'] = $service;\n }\n $response['service'] = $_POST['service'];\n wp_send_json( $response );\n }",
"public function getServicesList($org_user,$branch_id)\n {\n //Query To Get Service ID's List Of Specific Branch\n $sqlGetServiceID=\"SELECT * FROM service s INNER JOIN service_branch sb ON s.service_id=sb.service_id WHERE branch_id=?\";\n $values=array($branch_id);\n $serviceID=$this->getInfo($sqlGetServiceID,$values);\n //To Fill Out The Selection Box By Services List Of Specific Branch\n ?>\n <?php\n ?> \n <option>---</option>\n <?php\n foreach($serviceID as $i)\n {\n $id=$i['service_id'];\n ?> \n <option value=\"<?php echo $id; ?>\"><?php echo $i['service_name']; ?></option>\n <?php\n }\n ?>\n <?php\n }",
"private function _getAllBookings(User $driver) {\n\t\t$bookings = $driver->getDriverBookings ();\n\t\treturn $bookings;\n\t}",
"public function index()\n {\n $bookings = Booking::all()->sortByDesc('created_at')->forPage(0, 20);\n return $bookings;\n }",
"public function transferBankList($sourceNumber)\n\t{\n\t\treturn $this->curl('/ovo/transfer/bank-list', Constant::HTTP_POST, [\n\t\t\t'source_number'\t=> $sourceNumber\n\t\t]);\n\t}",
"function get_bookings( $all_bookings = false ){\n\t\t$confirmed = array();\n\t\tforeach ( $this->load() as $EM_Booking ){\n\t\t\tif( $EM_Booking->booking_status == 1 || (get_option('dbem_bookings_approval') == 0 && $EM_Booking->booking_status == 0) || $all_bookings ){\n\t\t\t\t$confirmed[] = $EM_Booking;\n\t\t\t}\n\t\t}\n\t\t$EM_Bookings = new EM_Bookings($confirmed);\n\t\treturn $EM_Bookings;\t\t\n\t}",
"public function actionListAvailable()\n\t{\n\t\t$destination = new Destinations();\n\t\t$tour = new Tours();\n\n\t\t$models = $destination->getAvailableDestination();\n\n\t\t$data = array();\n\t\tforeach ($models as $model) {\n\t\t\t$totalTours = count($tour->getTourInDestination($model->id));\n\n\t\t\t$data[] = array('des' => $model, 'totalTours' => $totalTours);\n\t\t}\n\t\theader('Content-Type: application/json');\n\t\theader(\"Access-Control-Allow-Origin: *\");\n header(\"Access-Control-Allow-Methods: GET, POST, PUT, DELETE\");\n echo json_encode($data);\n\t}"
] |
[
"0.64114493",
"0.63983804",
"0.59925324",
"0.58378524",
"0.5691092",
"0.564734",
"0.5631173",
"0.56022334",
"0.55693626",
"0.5544843",
"0.55102766",
"0.54908365",
"0.54779446",
"0.5472083",
"0.54600734",
"0.5453057",
"0.5436111",
"0.54275084",
"0.54138285",
"0.540863",
"0.5398931",
"0.53801495",
"0.5354105",
"0.53237665",
"0.53064185",
"0.52981275",
"0.52938616",
"0.5292105",
"0.52813953",
"0.52607006"
] |
0.65153754
|
0
|
update email template Booking email
|
public function manage_email_template($template='')
{
$template = 'booking-mail';
$this->load->model('admin/admin_model');
$this->gen_contents['page_heading'] = 'Update Email Template';
if($this->input->post("update_et",true)){
$post_data['body'] = $this->input->post("body",true);
$response = $this->admin_model->process_email_template($post_data);
if($response == "edited"){
sf('success_message', 'Email template has been updated successfully');
redirect("admin/email-template");
}
}
$this->gen_contents['email_template'] = $this->admin_model->get_email_template($template);
//p($this->gen_contents['booking_details']); exit;
//rendering page
$this->template->set_template('admin');
$this->template->write_view('content', 'admin/email-template-manage', $this->gen_contents);
$this->template->render();
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function update_email_template(Request $request,$enc_id)\n\t{\n\t\t$id = base64_decode($enc_id);\n\t\t\n\t\t$arr_rules = $arr_data = array();\n\t\t$status = false;\n\n\t\t$arr_rules['template_name'] = \"required\";\n\t\t$arr_rules['template_from'] = \"required\";\n\t\t$arr_rules['template_from_mail'] = \"required\";\n\t\t$arr_rules['template_subject'] = \"required\";\n\t\t$arr_rules['template_html'] = \"required\";\n\t\n\t\n\t\t$validator = Validator::make($request->all(),$arr_rules);\n\n\t\tif($validator->fails()) \n\t\t{\n\t\t\treturn redirect()->back()->withErrors($validator)->withInput();\n\t\t}\n\n\t\t\t\t$template_name = $request->input('template_name', null);\n\t\t$id = base64_decode($enc_id);\n\t\t$arr_template['template_name'] = $template_name;\n\t\t$arr_template['template_from'] = $request->input('template_from', null);\n\t\t$arr_template['template_from_mail'] = $request->input('template_from_mail', null);\n\t\t$arr_template['template_subject'] = $request->input('template_subject', null);\n\t\t$arr_template['template_html'] = $request->input('template_html', null);\n\n\n\t\t// $arr_data['slug'] \t\t\t\t\t\t=\t$slug;\n\n\t\t$status = $this->BaseModel->where('id',$id)->update($arr_template);\n\n\t\tif($status)\n\t\t{\n\t\t\tSession::flash('success', 'Template updated successfully.');\n\t\t\treturn redirect($this->module_url_path);\n\t\t}\n\n\t\tSession::flash('error', 'Error while updating Template.');\n\t\treturn redirect($this->module_url_path);\n\t}",
"public function save_email_template(){\t\n\t\t\t$user_id = $this->session->userdata('id');\n\t\t\t$role = $this->session->userdata('role');\n\t\t\t$id = $this->input->post('template_id');\n\t\t\t$name = $this->input->post('template_name');\n\t\t\t$subject = $this->input->post('template_subject');\n\t\t\t$attachment = $this->input->post('attachment');\n\t\t\t$content = htmlentities($this->input->post('content'));\n\t\t\tif( !empty($id) && ($role=='admin')):\n\t\t$this->InteractModal->add_user_meta( $user_id, 'subject_template_id_'.$id , $subject );\n\t\tif(!empty($attachment)){\n\t\t\t$this->InteractModal->add_user_meta( $user_id, 'attach_template_id_'.$id , $attachment );\n\t\t}\n\t\t$response = $this->InteractModal->add_user_meta( $user_id, 'content_template_id_'.$id,$content );\n\t\t\t\tif(!empty($response)):\n\t\t\t\t\t$this->session->set_flashdata('msg', 'Update successfully');\n\t\t\t\telse:\n\t\t\t\t\t$this->session->set_flashdata('msg', 'Template Update Error! Try Again');\n\t\t\t\tendif;\n\t\t\t\tredirect( base_url( 'Interact/user_all_email_template'));\t\t\t\t\n\t\t\telse:\n\t\t\t\tredirect( base_url( 'Interact/login' ));\n\t\t\tendif;\n\t}",
"public static function set_email_template_status() {\n\n check_ajax_referer('email-template-status', 'rac_security');\n\n if (isset($_POST['row_id']) && isset($_POST['status'])) {\n $requesting_state = $_POST['status'];\n $post_id = $_POST['row_id'];\n $status = $requesting_state != 'ACTIVE' ? 'racactive' : 'racinactive';\n $new_status = $requesting_state != 'ACTIVE' ? 'ACTIVE' : 'NOTACTIVE';\n $args = array(\n 'ID' => $post_id,\n 'post_status' => $status\n );\n\n wp_update_post($args);\n echo $new_status;\n }\n exit();\n }",
"function editEmailHandler1() {\n global $inputs;\n\n updateDb('mail', [\n 'title' => $inputs['title'],\n 'sender_id' => $inputs['sender_id'],\n 'sender' => $inputs['sender_name'],\n 'receiver_id' => $inputs['receiver_id'],\n 'receiver' => $inputs['receiver_name'],\n 'content' => $inputs['content'], \n ], [\n 'id' => $inputs['id']\n ]);\n\n formatOutput(true, 'update success');\n}",
"function m_dspemails()\n\t{\n\t\t$this->ObTpl=new template();\n\t\t$this->ObTpl->set_file(\"TPL_EMAIL_FILE\",$this->emailTemplate);\n\n\t\t#SETTING ALL TEMPLATE BLOCKS\n\t\t$this->ObTpl->set_block(\"TPL_EMAIL_FILE\",\"TPL_EMAIL_BLK\", \"email_blk\");\n\t\t$this->ObTpl->set_block(\"TPL_EMAIL_FILE\",\"TPL_MESSAGE_BLK\", \"message_blk\");\n\t\t$this->ObTpl->set_block(\"TPL_EMAIL_FILE\",\"TPL_MSG_BLK1\", \"msg_blk1\");\n\n\t\t#SETTING TEMPLATE VARIABLE\n\t\t$this->ObTpl->set_var(\"GRAPHICSMAINPATH\",GRAPHICS_PATH);\t\n\t\t$this->ObTpl->set_var(\"TPL_VAR_SALESURL\",SITE_URL.\"sales/\");\n\n\t\t#INTAILIZING ***\n\t\t$this->ObTpl->set_var(\"email_blk\",\"\");\t\n\t\t$this->ObTpl->set_var(\"message_blk\",\"\");\t\n\t\t$this->ObTpl->set_var(\"msg_blk1\",\"\");\t\n\t\t$this->ObTpl->set_var(\"msg_blk2\",\"\");\t\n\n\t\t$this->request['msg']=$this->libFunc->ifSet($this->request,\"msg\");\n\t\t$this->ObTpl->set_var(\"TPL_VAR_MESSAGE\",\"\");\n\n\t\t#DATABASE QUERY\n\t\t$this->obDb->query = \"SELECT * FROM \".EMAILS;\n\t\t$queryResult = $this->obDb->fetchQuery();\n\t\t$campaigncount = $this->obDb->record_count;\n\t\tif($this->request['msg']==1)\n\t\t{\n\t\t\t$this->ObTpl->set_var(\"TPL_VAR_MSG\",MSG_EMAIL_INSERTED);\n\t\t\t$this->ObTpl->parse(\"msg_blk1\",\"TPL_MSG_BLK1\");\n\t\t\t$this->ObTpl->parse(\"msg_blk2\",\"TPL_MSG_BLK2\");\n\t\t}\n\t\telseif($this->request['msg']==3)\n\t\t{\n\t\t\t$this->ObTpl->set_var(\"TPL_VAR_MSG\",MSG_EMAIL_DELETED);\n\t\t\t$this->ObTpl->parse(\"msg_blk1\",\"TPL_MSG_BLK1\");\n\t\t\t$this->ObTpl->parse(\"msg_blk2\",\"TPL_MSG_BLK2\");\n\t\t}\n\t\telseif($this->request['msg']==5)\n\t\t{\n\t\t\t$this->ObTpl->set_var(\"TPL_VAR_MSG\",MSG_EMAIL_SENT);\n\t\t\t$this->ObTpl->parse(\"msg_blk1\",\"TPL_MSG_BLK1\");\n\t\t\t$this->ObTpl->parse(\"msg_blk2\",\"TPL_MSG_BLK2\");\n\t\t}\n\n\t\tif($campaigncount>0)\n\t\t{\n\t\t\t#PARSING DISCOUNT BLOCK\n\t\t\tfor($j=0;$j<$campaigncount;$j++)\n\t\t\t{\t\t\n\t\t\t\t$this->ObTpl->set_var(\"TPL_VAR_ID\",$queryResult[$j]->iMailid_PK);\n\t\t\t\tif ($queryResult[$j]->vUserList==\"All\"){\n $this->obDb->query = \"SELECT count(*) as cnt FROM \".CUSTOMERS.\" WHERE iStatus=1 AND iMailList !=0\";\n }else{ \n $this->obDb->query = \"SELECT count(*) as cnt FROM \".LEADLIST.\" WHERE iLeadId_FK='\". $queryResult[$j]->vUserList.\"'\";\n }\n\t\t\t\t$qryRs = $this->obDb->fetchQuery();\n\t\t\t\t\n\t\t\t\tif ($queryResult[$j]->vVisitorList==\"1\"){\n $this->obDb->query = \"SELECT count(*) as cnt FROM \".NEWSLETTERS;\n\t\t\t\t $qryVs = $this->obDb->fetchQuery();\n\t\t\t\t $qryRs[0]->cnt = $qryRs[0]->cnt + $qryVs[0]->cnt;\n }\n\n\t\t\t\t$this->ObTpl->set_var(\"TPL_VAR_USERCOUNT\",$qryRs[0]->cnt);\n \n $this->ObTpl->set_var(\"TPL_VAR_SUBJECT\",$this->libFunc->m_displayContent($queryResult[$j]->vSubject));\n\t\t\t\t$this->ObTpl->set_var(\"TPL_VAR_SID\",$this->libFunc->m_displayContent($queryResult[$j]->vSid));\n\t\t\t\t$this->ObTpl->set_var(\"TPL_VAR_BUILDDATE\",$this->libFunc->dateFormat2($queryResult[$j]->tmBuildDate));\t\n\t\t\t\t$sentDate=$this->libFunc->dateFormat2($queryResult[$j]->tmSentDate);\n\t\t\t\tif(empty($sentDate))\n\t\t\t\t{\t\t\t\t\n\t\t\t\t\t$this->ObTpl->set_var(\"TPL_VAR_SENTDATE\",\"Send now\");\n\t\t\t\t\t$this->ObTpl->set_var(\"TPL_VAR_VIEWLABEL\",\"View/Sent\");\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t$this->ObTpl->set_var(\"TPL_VAR_SENTDATE\",$sentDate);\n\t\t\t\t\t$this->ObTpl->set_var(\"TPL_VAR_VIEWLABEL\",\"View\");\n\t\t\t\t}\n\t\t\t\t$this->ObTpl->parse(\"email_blk\",\"TPL_EMAIL_BLK\",true);\n\t\t\t}\n\t\t\t$this->ObTpl->set_var(\"TPL_VAR_MSG\",$campaigncount.\" records found\");\n\t\t\t$this->ObTpl->parse(\"msg_blk1\",\"TPL_MSG_BLK1\");\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$this->ObTpl->set_var(\"TPL_VAR_MESSAGE\",MSG_NOEMAILS);\n\t\t\t$this->ObTpl->parse(\"message_blk\",\"TPL_MESSAGE_BLK\");\n\t\t}\n\t\n\t\treturn($this->ObTpl->parse(\"return\",\"TPL_EMAIL_FILE\"));\n\t}",
"public function setEmailTpl($value){$this->_emailTpl = $value;}",
"function AfterEdit(&$values, $where, &$oldvalues, &$keys, $inline, &$pageObject)\n{\n\n\t\t\n\nglobal $conn;\n$cid=$values['cid'];\n$userID=$values['userID'];\n$sql_up= \"UPDATE participate SET confirm ='Yes' WHERE userID='$userID' AND cid='$cid'\";\n$query_up=db_exec($sql_up,$conn);\n\n$itemID=$values['itemID'];\n\n$payStatus=$values['payStatus'];\n\nif($payStatus!=$oldvalues['payStatus']){\n\n if($payStatus='Completed'){\n\n$sql_company= \"SELECT `coid`, `cname`, `creg`, `caddress`, `ccity`, `cstate`, `ccountry`, `ctel`, `cfax`, `cemail` FROM `company` WHERE `coid`=1\";\n$query_company=db_query($sql_company,$conn);\n$company=db_fetch_array($query_company);\n\n$footer=\"<p> $company[cname]</p><p> $company[caddress],$company[ccity],$company[cstate],$company[ccountry]</p>\nFax: $company[cfax] Tel: $company[ctel]</p><br><br>\";\n\n$sDate=date('d', strtotime($row[sDate]));\n$eDate=date('d M Y', strtotime($row[eDate])) ;\n\n\n //send official inviation letter\n\t\t\t$to2=$values['email'];\n\t\t\t$subject2 =\"Thank you for your payment- $values[cnameShort] - Ref [$itemID]\";\n\t\t\t$headers2 = \"From: \" . $company['cemail'] . \"\\r\\n\";\n\t\t\t$headers2 .= \"Content-type: text/html\" .\"\\r\\n\";\n\n//content table \ninclude('emailHead.php');\t\n\t\n$contentEmail1='<table width=\"90%\" border=\"0\" align=\"center\" cellpadding=\"50\" cellspacing=\"0\" style=\"font-size:14px\">\n <tr><td bgcolor=\"#E4E4E4\" scope=\"col\">';\n$contentEmail2=' </td></tr></table>';\n\n$contentEmail='\n<h2 style=\"color:#036\">Thank You </h2>\n<hr style=\"color: #666; height: 1px; background: #666; border: none ; margin-bottom:10px;\" />\n<p> Dear '.$values['fullName'].', </p>\nThank you for your payment!\n\nThe details are as follows:-<br/><br/>\n<b>Fee\t\t\t\t\t\t\t:</b> '.$values['currency'].$values['amount'].'<br/><br/>\n<b>Item/Type\t\t\t\t:</b> '.$values['item'].'<br/><br/>\n<b>Conference\t\t\t:</b> '.$values['cname'].'<br/><br/>\n<b>Date of Payment\t:</b> '.$values['payDate'].'<br/><br/>\n<b>Mode of Payment\t:</b> '.$values['mode'].'<br/><br/>\n<b>Receipt No\t\t\t:</b> '.$values['receiptNo'].' <br/><br/>\n\n \nWe look forward to your participation and hope you will enjoy the sessions. <br/><br/>\t\n \nShould you have questions, please do not hesitate to contact us via email. <br/>'\n;\n\n$message2 =$letterhead.$contentEmail1.$contentEmail.$contentEmail2.$footerEmail;\t\t\n$mailto=mail($to2, $subject2, $message2, $headers2);\n};\n\n};\n;\t\t\n}",
"function SwapAndSend($name, $tkt_code, $desc, $to, $cc, $from, $template_file, $subject, $onhold_till) {\n\t\t$swap_var = array(\n\t\t \"{CLIENTNAME}\" => $name,\n\t\t \"{TICKETCODE}\" => $tkt_code,\n\t\t \"{HOLDTILL}\" => $onhold_till,\n\t\t \"{DESCRIPTION}\" => $desc \n\t\t \n\t\t);\n\t\t\n\t\tif (file_exists($template_file))\n\t\t\t$content = file_get_contents($template_file);\n\t\telse \n\t\t\tdie(\"Unable to locate the email_template file\");\n\n\t\t// search replace all swap variables\n\t\tforeach(array_keys($swap_var) as $key){\n\t\t\tif(strlen($key) > 2 && trim($key) != \"\")\n\t\t\t$content = str_replace($key, $swap_var[$key], $content);\n\t\t}\n\n\t\t\t\n\t\t$sendmail_model = new Mail_Send();\n\t\t$mailres = $sendmail_model->SendMail($to, $cc, $subject, $content, $from);\n\n}",
"public function update(Request $request, $id)\n {\n $request->validate([\n 'id' => 'required'\n ]);\n $contactOffer = ContactOffer::find($id);\n $contact = $contactOffer->contact;\n $directory_kundendatenbank = config('app.customer_data');\n $file = Storage::disk('public')->path($directory_kundendatenbank . DS . 'offer' . DS . $contact->id. DS . $contactOffer->file_name);\n $template = Template::where([\n 'section' => 'contacts',\n 'template_key' => 'offer_email' \n ])->first();\n $emailBody = $template->template_desc;\n \n $locale = App::getLocale();\n App::setLocale($contact->language);\n \n $pattern = '/\\[\\[(.*?)\\]\\]/' ;\n $matches = array();\n preg_match_all($pattern, $emailBody, $matches);\n foreach($matches[1] as $value) {\n $emailBody = str_replace(\"[[\".$value.\"]]\", __($value), $emailBody);\n }\n $greetings = getPDFSalutation($contact->salutation);\n $greetings = str_replace('{nachname}', $contact->last_name, $greetings);\n $emailBody = str_replace(\"{mr/mrs}\", $greetings, $emailBody);\n $emailBody = str_replace(\"{deposit_amount}\", format($contact->deposit_amount), $emailBody);\n //Offer table starts\n $deposit_amount_formatted = format($contact->deposit_amount);\n $subtotal = getPremiumAmount($contact->deposit_amount, 1);\n $premium_tax = (($subtotal * 0.050));\n $premium_tax_formatted = format($premium_tax);\n $premium_total_formatted = format($subtotal+$premium_tax);\n $premium_formatted = format($premium_total_formatted-$premium_tax_formatted, false);\n $offer_table = view('api.emails.offer_table', compact('deposit_amount_formatted', 'premium_formatted', 'premium_tax_formatted', 'premium_total_formatted'))->render();\n $emailBody = str_replace('{offer_table}', $offer_table, $emailBody);\n switch ($contact->language) {\n case 'fr':\n $attachments = [\n Storage::disk('public')->path('download'.DS.'fr'.DS.\"conditions-generales-CGA.pdf\"),\n Storage::disk('public')->path('download'.DS.'fr'.DS.\"gocaution-formulaire.pdf\"),\n Storage::disk('public')->path('download'.DS.'fr'.DS.\"flyer_locataire.pdf\")\n ];\n break;\n\n case 'de':\n $attachments = [\n Storage::disk('public')->path('download'.DS.'de'.DS.\"allgemeine-versicherungsbedingungen-avb.pdf\"),\n Storage::disk('public')->path('download'.DS.'de'.DS.\"gocaution-antrag.pdf\"),\n Storage::disk('public')->path('download'.DS.'de'.DS.\"flyer_mieter.pdf\")\n ];\n break;\n\n case 'it':\n $attachments = [\n Storage::disk('public')->path('download'.DS.'it'.DS.\"condizioni-generali-assicurazione-cga.pdf\"),\n Storage::disk('public')->path('download'.DS.'it'.DS.\"modulo.pdf\"),\n Storage::disk('public')->path('download'.DS.'it'.DS.\"volantino.pdf\")\n ];\n break; \n\n default:\n $attachments = [\n Storage::disk('public')->path('download'.DS.'de'.DS.\"allgemeine-versicherungsbedingungen-avb.pdf\"),\n Storage::disk('public')->path('download'.DS.'de'.DS.\"gocaution-antrag.pdf\"),\n Storage::disk('public')->path('download'.DS.'de'.DS.\"flyer_mieter.pdf\")\n ];\n break;\n }\n Mail::to($contact->email)->send(new BaseEmail($contact, $emailBody, $attachments, __('general.offer_email.SUBJECT')));\n $contactOffer->sent = 1;\n $contactOffer->sent_by = auth()->user()->id;\n $contactOffer->save();\n App::setLocale($locale);\n\n if($contact->offers()->save($contactOffer)) {\n $message = __('contact.offer.SEND_SUCCESS');\n } else {\n $message = __('contact.offer.SEND_FAILURE');\n }\n\n return response()->json([\n 'message' => $message\n ]);\n }",
"function daily_update_property_email(){\n\t\t$meta_post = $this->InteractModal->get_update_post_meta();\n\t\tif(!empty($meta_post)){\n\t\t\t$data = array();\n\t\t\tforeach($meta_post as $meta_details){\n\t\t\t\t$user_id = $this->InteractModal->get_post_meta($meta_details['post_id'],'initiator_id');\n\t\t\t\t$data[$user_id][]= $meta_details['meta_key'];\n\t\t\t}\n\t\t}\t\t\n\t\t$get_data=$this->InteractModal->get_today_data();\n\t\t$id=2;\n\t\tif(!empty($get_data)){\n\t\t\t$result = array();\n\t\t\tforeach ($get_data as $element) {\n\t\t\t\t$result[$element['user_id']][]= $element['task_type'];\n\t\t\t}\n\t\t\tif(!empty($data) && (!empty($result))){\n\t\t\t\t$results = array_merge($data,$result);\n\t\t\t}\n\t\t\t$user_id= '';\n\t\t\tif(!empty($results)){\n\t\t\t\tforeach($result as $user_id=>$value):\n\t\t\t\t\t$update_details='';\n\t\t\t\t\t$value = array_unique($value);\n\t\t\t\t\tforeach($value as $values):\t\t\t\t\t\t\n\t\t\t\t\t\t$update_details=$update_details.'Today '.ucwords($values).' Successfully.<br>';\n\t\t\t\t\tendforeach;\n\t\t\t\t\tif(!empty($user_id)){\n\t\t\t\t\t\t$where = array( 'id' =>$user_id);\n\t\t\t\t\t\t$user_data=$this->InteractModal->single_field_value('users',$where);\n\t\t\t\t\t\techo $email= $user_data[0]['user_email'];\n\t\t\t\t\t\techo \"<br>\";\n\t\t\t\t\t\t$company_id = $this->InteractModal->get_user_meta( $user_id, 'company_id');\n\t\t\t\t\t\t///get auto email content data \n\t\t\t\t\t\t$status_template = $this->InteractModal->get_user_meta( $company_id, 'status_template_id_'.$id );\n\t\t\t\t\t\tif(($status_template ==1)){\n\t\t\t\t\t\t\t$subject = $this->InteractModal->get_user_meta( $company_id, 'subject_template_id_'.$id );\n\t\t\t\t\t\t\t$content = $this->InteractModal->get_user_meta( $company_id, 'content_template_id_'.$id );\n\t\t\t\t\t\t\t$user_name = $this->InteractModal->get_user_meta( $user_id, 'concerned_person');\n\t\t\t\t\t\t\t$phone_number = $this->InteractModal->get_user_meta( $user_id, 'phone_number');\n\t\t\t\t\t\t\t$logo_content = '<img src=\"'.base_url().'/assets/img/profiles/logo_(2).png\" height=\"auto\" width=\"100\" alt=\"Logo\">'; \t\t\t\t\t\t\n\t\t\t\t\t\t\t$content=nl2br($content);\n\t\t\t\t\t\t\t$content = str_replace(\"_NAME_\",$user_name,$content);\n\t\t\t\t\t\t\t$content = str_replace(\"_PHONE_\",$phone_number,$content);\n\t\t\t\t\t\t\t$content = str_replace(\"_EMAIL_\",$email,$content);\n\t\t\t\t\t\t\t$content = str_replace(\"_LOGO_\",$logo_content,$content);\n\t\t\t\t\t\t\t$content = str_replace(\"_DATE_\",date('d-F-Y'),$content);\n\t\t\t\t\t\t\t$content = $content.'<br>'.$update_details;\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t$template_list = $this->InteractModal->get_email_template($id);\n\t\t\t\t\t\t\tforeach( $template_list as $template_lists ):\n\t\t\t\t\t\t\t\t$subject = $template_lists['subject']; \n\t\t\t\t\t\t\t\t$content = $update_details; \n\t\t\t\t\t\t\tendforeach;\t\t\t\t\n\t\t\t\t\t\t}\t\t\t\t\n\t\t\t\t\t\t///get auto email content data \t\t\t\t\n\t\t\t\t\t\t$email_data = array('email' => $email,\n\t\t\t\t\t\t\t'content' => $content,\n\t\t\t\t\t\t\t'subject' => $subject\n\t\t\t\t\t\t);\n\t\t\t\t\t\t$this->send_email($email_data);\n\t\t\t\t\t} \n\t\t\t\tendforeach;\n\t\t\t}\n\t\t}\n\t}",
"public function updateAction()\n {\n // _POST values.\n $request = $this->container->get(\"request\");\n\n // Get the restaurant service.\n $emailTemplatesService = $this->container->get('dft_foapi.email_templates');\n\n // Update settings.\n $emailTemplatesService->updateEmailTemplates(\n $this->container->get('dft_foapi.login')->getAuthenticatedUserId(),\n $request->get('order_accepted_email_subject'),\n $request->get('order_accepted_email_content'),\n $request->get('order_rejected_email_subject'),\n $request->get('order_rejected_email_content')\n );\n\n return $this->render('dftFoapiBundle:Common:success.json.twig');\n }",
"public function emailtemplateAction(){\n\n $this->_helper->layout->setLayout('popup'); \n\n\t $this->view->emailtemplate = $this->ModelObj->fetchemailtemplate(array('notification_id'=>$this->Request['notification_id'])); \n\n\t $this->view->templatename = ($this->Request['notification_name']!='') ? $this->Request['notification_name'] : '';\n\n }",
"public static function fp_rac_edit_mail_update_data() {\n\n check_ajax_referer('update-guest-email', 'rac_security');\n if (isset($_POST['id']) && $_POST['email']) {\n $row_id = $_POST['id'];\n $email_value = $_POST['email'];\n $cart_details = maybe_unserialize(get_post_meta($row_id, 'rac_cart_details', true));\n $cart_details[\"visitor_mail\"] = $email_value;\n $details = maybe_serialize($cart_details);\n update_post_meta($row_id, 'rac_cart_details', $details);\n }\n exit();\n }",
"function mail_template_save($name, $locale, $subject, $body)\n{\n $db = Database::getInstance();\n $template = mail_template_load($name, $locale);\n\n if ($template && $template['locale'] == $locale) {\n // Update existing mail template\n $db->query(\n (\"UPDATE {mailtemplate} \"\n . \"SET subject = :subject, body = :body \"\n . \"WHERE templateid = :id\"),\n array(\n ':id' => $template['templateid'],\n ':subject' => $subject,\n ':body' => $body,\n )\n );\n } else {\n // Insert a new mail template\n $db->query(\n (\"INSERT INTO {mailtemplate} (name, locale, subject, body) \"\n . \"VALUES (:name, :locale, :subject, :body)\"),\n array(\n ':name' => $name,\n ':locale' => $locale,\n ':subject' => $subject,\n ':body' => $body,\n )\n );\n }\n}",
"public function testPostUpdate()\n {\n $this->getEmailWithLocal('uk');\n /** check email with ticket pdf file */\n $this->findEmailWithText('ticket-php-day-2017.pdf');\n /** check email with string */\n $this->findEmailWithText('Шановний учасник, в вкладенні Ваш вхідний квиток. Покажіть його з екрану телефону або роздрукуйте на папері.');\n }",
"public function sendEmailTemplate($template_id, $replace = array(), $to_email = '', $to_name = '')\n\t {}",
"private function ReplaceEmailTaskTemplate($pTemplate, $pDataToFromReplace) {\n\t\t$doc_id = (int)$pDataToFromReplace['document_id'];\n\t\t$role = (int)$pDataToFromReplace['user_role'];\n\t\t$u \t\t= SITE_URL; //JOURNAL_URL; OK until there is only 1 journal.\n\t\t$a \t\t= '<a target=\"_blank\" href=\"' . $u;\n\t\t$lDict = array();\n\t\t\n\t\tif($this->m_customFlag) {\n\t\t\tforeach ($pDataToFromReplace as $key => $value) {\n\t\t\t\t$lDict['{' . $key . '}'] = $value;\n\t\t\t}\n\t\t} else {\n\t\t\t$lDict = array(\n\t\t\t\t'{site_url}' \t\t\t=> $u,\n\t\t\t\t'{upass}'\t\t\t\t=> $this->m_uPass,\n\t\t\t\t'{first_name}' \t\t=> $pDataToFromReplace['first_name'], \n\t\t\t\t'{last_name}' \t\t\t=> $pDataToFromReplace['last_name'], \n\t\t\t\t'{document_id}' \t\t=> $pDataToFromReplace['document_id'], \n\t\t\t\t'{document_title}' \t\t=> trim($pDataToFromReplace['document_title']),\n\t\t\t\t'{usr_title}'\t\t\t=> $pDataToFromReplace['usr_title'],\n\t\t\t\t'{user_name}'\t\t\t=> $pDataToFromReplace['user_name'],\n\t\t\t\t'{author_list}'\t\t\t=> $pDataToFromReplace['author_list'],\n\t\t\t\t'{review_type_name}'\t=> $pDataToFromReplace['review_type_name'],\n\t\t\t\t'{due_date}'\t\t\t=> $pDataToFromReplace['due_date'],\n\t\t\t\t'{due_date_days}' \t\t=> $pDataToFromReplace['due_date_days'],\n\t\t\t\t'{journal_name}' \t\t=> $pDataToFromReplace['journal_name'],\n\t\t\t\t'{journal_email}' \t\t=> $pDataToFromReplace['journal_email'],\n\t\t\t\t'{journal_signature}' \t=> $pDataToFromReplace['journal_signature'],\n\t\t\t\t'{user_role}' \t\t\t=> $pDataToFromReplace['user_role'],\n\t\t\t\t'{journal_id}' \t\t\t=> $pDataToFromReplace['journal_id'],\n\t\t\t\t'{SE_first_name}' \t\t=> $pDataToFromReplace['se_first_name'],\n\t\t\t\t'{SE_last_name}' \t\t=> $pDataToFromReplace['se_last_name'],\n\t\t\t\t'{SE_usr_title}' \t\t=> $pDataToFromReplace['se_usr_title'],\n\t\t\t\t'{SE_email}' \t\t\t=> $pDataToFromReplace['se_email'],\n\t\t\t\t'{R_first_name}' \t\t=> $pDataToFromReplace['r_first_name'],\n\t\t\t\t'{R_last_name}' \t\t=> $pDataToFromReplace['r_last_name'],\n\t\t\t\t'{R_usr_title}' \t\t=> $pDataToFromReplace['r_usr_title'],\n\t\t\t\t'{SE_tax_expertize}' \t=> $pDataToFromReplace['se_tax_expertize'],\n\t\t\t\t'{SE_geo_expertize}' \t=> $pDataToFromReplace['se_geo_expertize'],\n\t\t\t\t'{SE_sub_expertize}' \t=> $pDataToFromReplace['se_sub_expertize'],\n\t\t\t\t'{SE_createusr_tax_expertize}' \t=> $pDataToFromReplace['se_createusr_tax_expertize'],\n\t\t\t\t'{SE_createusr_geo_expertize}' \t=> $pDataToFromReplace['se_createusr_geo_expertize'],\n\t\t\t\t'{SE_createusr_sub_expertize}' \t=> $pDataToFromReplace['se_createusr_sub_expertize'],\n\t\t\t\t'{NomReview_due_days}'\t=> $pDataToFromReplace['nomreview_due_days'],\n\t\t\t\t'{NomReview_due_date}'\t=> $pDataToFromReplace['nomreview_due_date'],\n\t\t\t\t'{PanReview_due_days}'\t=> $pDataToFromReplace['panreview_due_days'],\n\t\t\t\t'{PanReview_due_date}'\t=> $pDataToFromReplace['panreview_due_date'],\n\t\t\t\t'{SE_invite_reviewers_days}'\t=> $pDataToFromReplace['se_invite_reviewers_days'],\n\t\t\t\t'{SE_can_take_decision_days}'\t=> $pDataToFromReplace['se_can_take_decision_days'],\n\t\t\t\t'{site_href}' \t\t\t=> $a . '\">'. $u .'</a>',\n\t\t\t\t'{tasks_href}' \t\t\t=> $a . 'dashboard\">Your tasks</a>',\n\t\t\t\t'{document_editor_href}'=> $a . 'view_document.php?id=' . $doc_id . '&view_role=' . (int)JOURNAL_EDITOR_ROLE . '\">' . $pDataToFromReplace['document_title'] . '</a>',\n\t\t\t\t'{autologging_href}' \t=> $a . 'login.php?u_autolog_hash=' . $pDataToFromReplace['autolog_hash'] . '&document_id=' . $doc_id . '&view_role=' . $role . '\" class=\"' . HIDDEN_EMAIL_ELEMENT . '\">login</a>',\n\t\t\t\t'{autologging_doc_link}'=> $u . 'login.php?u_autolog_hash=' . $pDataToFromReplace['autolog_hash'] . '&document_id=' . $doc_id . '&view_role=' . $role,\n\t\t\t\t'{autologging_link}' \t=> $u . 'login.php?u_autolog_hash=' . $pDataToFromReplace['autolog_hash'],\t\t\n\t\t\t\t'{document_link}' \t\t=> $u . 'view_document.php?id=' . $doc_id . '&view_role=' . $role,\n\t\t\t);\n\t\t}\n\t\t\n\t\t$lTempl = strtr($pTemplate, $lDict);\n\t\treturn $lTempl;\n\t}",
"public function update(Request $request, $email_temp_id)\n {\n $validator = Validator::make($request->all(), self::storeRules($email_temp_id));\n if ($validator->fails()) {\n return Response()->json(['status'=>false, 'message' => $validator->getMessageBag()->first(), 'response' => []], 200);\n }\n $emailTemplate = EmailTemplate::find($email_temp_id);\n if (empty($emailTemplate)) {\n return Response()->json(['status'=>false, 'message' => 'Email Template is not exists', 'response' => []], 200);\n }\n\t\t$currentUser = getApiCurrentUser();\n $emailTemplate->email_temp_name = $request->input('email_temp_name');\n\t\t$emailTemplate->email_temp_subject = $request->input('email_temp_subject');\n\t\t$emailTemplate->email_temp_message = $request->input('email_temp_message');\n\t\t$emailTemplate->email_place_holder = $request->input('email_place_holder');\n\t\t$emailTemplate->email_temp_status = $request->input('email_temp_status');\n $emailTemplate->updated_at = new DateTime;\n\t\t$emailTemplate->updated_by = $currentUser->user_id;\n $emailTemplate->save();\n\n return response()->json(['status'=>true, 'message'=>'Email Template Updated', 'response'=>compact('emailTemplate')], 200);\n }",
"function modifyUITemplate(&$template) {\r\n\t\t$template->set('create',false);\r\n\t\t$template->set('usedomain',false);\r\n\t\t$template->set('useemail',true);\r\n\t}",
"static function update_email($email, $controls) {\n if (isset($controls->data['subject'])) {\n $email->subject = $controls->data['subject'];\n }\n\n // They should be only composer options\n foreach ($controls->data as $name => $value) {\n if (strpos($name, 'options_') === 0) {\n $email->options[substr($name, 8)] = $value;\n }\n }\n\n $email->editor = NewsletterEmails::EDITOR_COMPOSER;\n\n $email->message = self::get_html_open($email) . self::get_main_wrapper_open($email) .\n $controls->data['message'] . self::get_main_wrapper_close($email) . self::get_html_close($email);\n }",
"public function updateEmailTemplate($emailTemplateId, $request)\n {\n return $this->start()->uri(\"/api/email/template\")\n ->urlSegment($emailTemplateId)\n ->bodyHandler(new JSONBodyHandler($request))\n ->put()\n ->go();\n }",
"public function emailtemplete($email)\n\t{\t\n\t\t$templetedata = '<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\">\n<head>\n<meta name=\"viewport\" content=\"width=device-width\" />\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />\n<title>Verify your account</title>\n<style>/* -------------------------------------\n GLOBAL\n A very basic CSS reset\n------------------------------------- */\n* {\n margin: 0;\n font-family: \"Helvetica Neue\", Helvetica, Arial, sans-serif;\n box-sizing: border-box;\n font-size: 14px;\n}\n\nimg {\n max-width: 100%;\n}\n\nbody {\n -webkit-font-smoothing: antialiased;\n -webkit-text-size-adjust: none;\n width: 100% !important;\n height: 100%;\n line-height: 1.6em;\n /* 1.6em * 14px = 22.4px, use px to get airier line-height also in Thunderbird, and Yahoo!, Outlook.com, AOL webmail clients */\n /*line-height: 22px;*/\n}\n\ntable td {\n vertical-align: top;\n}\n\nbody {\n background-color: #f6f6f6;\n}\n\n.body-wrap {\n background-color: #f6f6f6;\n width: 100%;\n}\n\n.container {\n display: block !important;\n max-width: 600px !important;\n margin: 0 auto !important;\n /* makes it centered */\n clear: both !important;\n}\n\n.content {\n max-width: 600px;\n margin: 0 auto;\n display: block;\n padding: 20px;\n}\n\n/* -------------------------------------\n HEADER, FOOTER, MAIN\n------------------------------------- */\n.main {\n background-color: #fff;\n border: 1px solid #e9e9e9;\n border-radius: 3px;\n}\n\n.content-wrap {\n padding: 20px;\n}\n\n.content-block {\n padding: 0 0 20px;\n}\n\n.header {\n width: 100%;\n margin-bottom: 20px;\n}\n\n.footer {\n width: 100%;\n clear: both;\n color: #999;\n padding: 20px;\n}\n.footer p, .footer a, .footer td {\n color: #999;\n font-size: 12px;\n}\n\n/* -------------------------------------\n TYPOGRAPHY\n------------------------------------- */\nh1, h2, h3 {\n font-family: \"Helvetica Neue\", Helvetica, Arial, \"Lucida Grande\", sans-serif;\n color: #000;\n margin: 40px 0 0;\n line-height: 1.2em;\n font-weight: 400;\n}\n\nh1 {\n font-size: 32px;\n font-weight: 500;\n /* 1.2em * 32px = 38.4px, use px to get airier line-height also in Thunderbird, and Yahoo!, Outlook.com, AOL webmail clients */\n /*line-height: 38px;*/\n}\n\nh2 {\n font-size: 24px;\n /* 1.2em * 24px = 28.8px, use px to get airier line-height also in Thunderbird, and Yahoo!, Outlook.com, AOL webmail clients */\n /*line-height: 29px;*/\n}\n\nh3 {\n font-size: 18px;\n /* 1.2em * 18px = 21.6px, use px to get airier line-height also in Thunderbird, and Yahoo!, Outlook.com, AOL webmail clients */\n /*line-height: 22px;*/\n}\n\nh4 {\n font-size: 14px;\n font-weight: 600;\n}\n\np, ul, ol {\n margin-bottom: 10px;\n font-weight: normal;\n}\np li, ul li, ol li {\n margin-left: 5px;\n list-style-position: inside;\n}\n\n/* -------------------------------------\n LINKS & BUTTONS\n------------------------------------- */\na {\n color: #348eda;\n text-decoration: underline;\n}\n\n.btn-primary {\n text-decoration: none;\n color: #FFF;\n background-color: #348eda;\n border: solid #348eda;\n border-width: 10px 20px;\n line-height: 2em;\n /* 2em * 14px = 28px, use px to get airier line-height also in Thunderbird, and Yahoo!, Outlook.com, AOL webmail clients */\n /*line-height: 28px;*/\n font-weight: bold;\n text-align: center;\n cursor: pointer;\n display: inline-block;\n border-radius: 5px;\n text-transform: capitalize;\n}\n\n/* -------------------------------------\n OTHER STYLES THAT MIGHT BE USEFUL\n------------------------------------- */\n.last {\n margin-bottom: 0;\n}\n\n.first {\n margin-top: 0;\n}\n\n.aligncenter {\n text-align: center;\n}\n\n.alignright {\n text-align: right;\n}\n\n.alignleft {\n text-align: left;\n}\n\n.clear {\n clear: both;\n}\n\n/* -------------------------------------\n ALERTS\n Change the class depending on warning email, good email or bad email\n------------------------------------- */\n.alert {\n font-size: 16px;\n color: #fff;\n font-weight: 500;\n padding: 20px;\n text-align: center;\n border-radius: 3px 3px 0 0;\n}\n.alert a {\n color: #fff;\n text-decoration: none;\n font-weight: 500;\n font-size: 16px;\n}\n.alert.alert-warning {\n background-color: #FF9F00;\n}\n.alert.alert-bad {\n background-color: #D0021B;\n}\n.alert.alert-good {\n background-color: #68B90F;\n}\n\n/* -------------------------------------\n INVOICE\n Styles for the billing table\n------------------------------------- */\n.invoice {\n margin: 40px auto;\n text-align: left;\n width: 80%;\n}\n.invoice td {\n padding: 5px 0;\n}\n.invoice .invoice-items {\n width: 100%;\n}\n.invoice .invoice-items td {\n border-top: #eee 1px solid;\n}\n.invoice .invoice-items .total td {\n border-top: 2px solid #333;\n border-bottom: 2px solid #333;\n font-weight: 700;\n}\n\n/* -------------------------------------\n RESPONSIVE AND MOBILE FRIENDLY STYLES\n------------------------------------- */\n@media only screen and (max-width: 640px) {\n body {\n padding: 0 !important;\n }\n\n h1, h2, h3, h4 {\n font-weight: 800 !important;\n margin: 20px 0 5px !important;\n }\n\n h1 {\n font-size: 22px !important;\n }\n\n h2 {\n font-size: 18px !important;\n }\n\n h3 {\n font-size: 16px !important;\n }\n\n .container {\n padding: 0 !important;\n width: 100% !important;\n }\n\n .content {\n padding: 0 !important;\n }\n\n .content-wrap {\n padding: 10px !important;\n }\n\n .invoice {\n width: 100% !important;\n }\n}\n\n/*# sourceMappingURL=styles.css.map */\n</style>\n</head>\n\n<body itemscope itemtype=\"http://schema.org/EmailMessage\">\n\n<table class=\"body-wrap\">\n\t<tr>\n\t\t<td></td>\n\t\t<td class=\"container\" width=\"600\">\n\t\t\t<div class=\"content\">\n\t\t\t\t<table class=\"main\" width=\"100%\" cellpadding=\"0\" cellspacing=\"0\">\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td class=\"alert alert-warning\">\n\t\t\t\t\t\t\tVerify your account\n\t\t\t\t\t\t</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td class=\"content-wrap\">\n\t\t\t\t\t\t\t<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\">\n\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t<td class=\"content-block\">\n\t\t\t\t\t\t\t\t\t\tDear customer Pleas <strong>Click</strong> Below link .\n\t\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t<td class=\"content-block\">\n\t\t\t\t\t\t\t\t\t\t<a href=\"'.base_url().'varify/'.urlencode(base64_encode($email)).'\" class=\"btn-primary\">verify</a>\n\t\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t<td class=\"content-block\">\n\t\t\t\t\t\t\t\t\t\tThanks for choosing 11needs.com.\n\t\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t</table>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t</tr>\n\t\t\t\t</table>\n\t\t\t\t<div class=\"footer\">\n\t\t\t\t\t<table width=\"100%\">\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td class=\"aligncenter content-block\"></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</table>\n\t\t\t\t</div></div>\n\t\t</td>\n\t\t<td></td>\n\t</tr>\n</table>\n\n</body>\n</html>';\n\t\treturn $templetedata;\n\t}",
"function sendMail($template, $replace_content, $to, $reply_to_mail = '')\n{\n global $r_debug, $db_lnk, $_server_domain_url;\n if (file_exists(SITE_URL_FOR_SHELL)) {\n include_once SITE_URL_FOR_SHELL;\n }\n $default_content = array(\n '##SITE_NAME##' => SITE_NAME,\n '##SITE_URL##' => $_server_domain_url,\n '##FROM_EMAIL##' => DEFAULT_FROM_EMAIL_ADDRESS,\n '##CONTACT_EMAIL##' => DEFAULT_CONTACT_EMAIL_ADDRESS\n );\n $qry_val_arr = array(\n $template\n );\n $emailFindReplace = array_merge($default_content, $replace_content);\n $templates = executeQuery('SELECT * FROM email_templates WHERE name = $1', $qry_val_arr);\n if ($templates) {\n $message = strtr($templates['email_text_content'], $emailFindReplace);\n $message.= '<div itemscope itemtype=\"http://schema.org/EmailMessage\"><div itemprop=\"potentialAction\" itemscope itemtype=\"http://schema.org/ViewAction\"><link itemprop=\"target\" href=\"' . $_server_domain_url . '\"/><meta itemprop=\"name\" content=\"View on Restyaboard\"/></div><meta itemprop=\"description\" content=\"View on Restyaboard\"/></div>';\n $subject = strtr($templates['subject'], $emailFindReplace);\n $from_email = strtr($templates['from_email'], $emailFindReplace);\n $headers = 'From:' . $from_email . PHP_EOL;\n if (!empty($reply_to_mail)) {\n $headers.= 'Reply-To:' . $reply_to_mail . PHP_EOL;\n }\n $headers.= \"MIME-Version: 1.0\" . PHP_EOL;\n $headers.= \"Content-Type: text/html; charset=UTF-8\" . PHP_EOL;\n $headers.= \"X-Mailer: Restyaboard (0.6.8; +http://restya.com/board)\" . PHP_EOL;\n $headers.= \"X-Auto-Response-Suppress: All\" . PHP_EOL;\n if (is_plugin_enabled('r_sparkpost')) {\n require_once PLUGIN_PATH . DS . 'SparkPost' . DS . 'functions.php';\n $result = SparkPostMail($to, $subject, $message, $headers, DEFAULT_FROM_EMAIL_ADDRESS);\n } else {\n $result = mail($to, $subject, $message, $headers, '-f' . DEFAULT_FROM_EMAIL_ADDRESS);\n }\n if (R_DEBUG) {\n if (!$result) {\n $compose_string = 'F, ' . $from_email . ', ' . $to . ', ' . $subject;\n } else {\n $compose_string = 'S, ' . $from_email . ', ' . $to . ', ' . $subject;\n }\n error_log($compose_string, 3, CACHE_PATH . DS . 'mail.log');\n }\n }\n}",
"function btpay_mail_config_action()\n {\n global $wpdb;\n if (!empty($_POST))\n {\n if (isset($_POST['update_mail']))\n {\n $id = $_POST['update_mail'];\n btpay_handle_config_update();\n include BT_PLUGIN_DIR . '/pages/btpay-config-mail-page.php';\n }\n }\n else\n {\n include BT_PLUGIN_DIR . '/pages/btpay-config-mail-page.php';\n }\n }",
"public function execute()\n {\n $request = $this->getRequest();\n $id = $this->getRequest()->getParam('id');\n\n $template = $this->_initTemplate('id');\n if (!$template->getId() && $id) {\n $this->messageManager->addErrorMessage(__('This email template no longer exists.'));\n $this->_redirect('adminhtml/*/');\n return;\n }\n\n try {\n $template->setTemplateSubject(\n $request->getParam('template_subject')\n )->setTemplateCode(\n $request->getParam('template_code')\n )->setTemplateText(\n $request->getParam('template_text')\n )->setTemplateStyles(\n $request->getParam('template_styles')\n )->setModifiedAt(\n $this->_objectManager->get(\\Magento\\Framework\\Stdlib\\DateTime\\DateTime::class)->gmtDate()\n )->setOrigTemplateCode(\n $request->getParam('orig_template_code')\n )->setOrigTemplateVariables(\n $request->getParam('orig_template_variables')\n );\n\n if (!$template->getId()) {\n $template->setTemplateType(TemplateTypesInterface::TYPE_HTML);\n }\n\n if ($request->getParam('_change_type_flag')) {\n $template->setTemplateType(TemplateTypesInterface::TYPE_TEXT);\n $template->setTemplateStyles('');\n }\n\n $template->save();\n $this->_objectManager->get(\\Magento\\Backend\\Model\\Session::class)->setFormData(false);\n $this->messageManager->addSuccessMessage(__('You saved the email template.'));\n $this->_redirect('adminhtml/*');\n } catch (\\Exception $e) {\n $this->_objectManager->get(\n \\Magento\\Backend\\Model\\Session::class\n )->setData(\n 'email_template_form_data',\n $request->getParams()\n );\n $this->messageManager->addErrorMessage($e->getMessage());\n $this->_forward('new');\n }\n }",
"function parse_email_template($template, $merge_fields = array())\n{\n $CI =& get_instance();\n if (!is_object($template) || $CI->input->post('template_name')) {\n $original_template = $template;\n if ($CI->input->post('template_name')) {\n $template = $CI->input->post('template_name');\n }\n $CI->db->where('slug', $template);\n $template = $CI->db->get('tblemailtemplates')->row();\n\n if ($CI->input->post('email_template_custom')) {\n $template->message = $CI->input->post('email_template_custom', false);\n // Replace the subject too\n $template->subject = $original_template->subject;\n }\n }\n $template = _parse_email_template_merge_fields($template, $merge_fields);\n\n\n return do_action('email_template_parsed', $template);\n}",
"public function emailtemplatesaeve(Request $request)\n {\n \n\n if(!empty($successmsgdata)){\n $data['successmsgdata']=$successmsgdata;\n }\n if(!empty($errormsgdata)){\n $data['errormsgdata']=$errormsgdata; \n }\n\n $subject = trim(addslashes($request->input('subject')));\n $article_description = htmlentities($request->input('description'));\n \n $id = $request->input('id'); \n $dataInsert=array();\n $dataInsert['subject'] = $subject;\n $dataInsert['message'] = $article_description;\n $dataInsert['status'] = 1;\n \n\n //******** array for update article\n\n $dataUpdate=array();\n $dataUpdate['subject'] = $subject;\n $dataUpdate['message'] = $article_description;\n // $dataUpdate['modified_date']= $modified_date;\n\n $chkvalid=$this->checkemailtemplateform($request,$id); \n\n if($chkvalid===true)\n {\n\n //********Getting SEO name starts here\n $seoname = $this->seoUrl($subject);\n $seoname = $seoname.'--';\n //********** Checking SEO name exists or not strats here\n\n $seoqry = DB::table('email_templates');\n $seoqry=$seoqry->where('template_for_alias', 'like', $seoname.'%');\n if(!empty($id))\n {\n //***check for edit\n $seoqry=$seoqry->where('id', '<>', $id);\n }\n \n $seoqry=$seoqry->count();\n $tot_seocount=$seoqry;\n $tot_seocount = $tot_seocount+1;\n $seoname = $seoname.$tot_seocount;\n $dataInsert['template_for_alias']= $seoname;\n //********** Checkign SEO name exists or not ends here\n //********Getting SEO name ends here\n if(empty($id))\n {\n //*** insert query\n /*Insert query*/\n $isInserted = DB::table('email_templates')->insert($dataInsert);\n /*Last Insert id*/\n $any_id_or_rownum=DB::getPdo()->lastInsertId();\n }\n else\n {\n //******checking seo already exists or not starts here\n $seoqrydoublechk = DB::table('email_templates');\n $seoqrydoublechk=$seoqrydoublechk->where('template_for_alias',$seoname);\n $seoqrydoublechk=$seoqrydoublechk->count();\n\n if($seoqrydoublechk == 0)\n {\n $dataUpdate['template_for_alias']= $seoname;\n }\n //******checking seo already exists or not ends here\n //*** update query\n $any_id_or_rownum=DB::table('email_templates')\n ->where('id', $id)\n ->update($dataUpdate);\n }\n \n if($any_id_or_rownum >= 0 )\n {\n $request->session()->flash('admin_successmsgdata_sess', 'Template Successfully saved.');\n return redirect(ADMINSEPARATOR.'/email-template');\n \n }\n\n \n\n }\n else\n {\n if(!empty($id))\n {\n\n return redirect(ADMINSEPARATOR.'/createemailtemplate/'.$id)\n ->withErrors($chkvalid)\n ->withInput();\n }\n else\n {\n return redirect(ADMINSEPARATOR.'/createemailtemplate')\n ->withErrors($chkvalid)\n ->withInput();\n }\n }\n \n return redirect(ADMINSEPARATOR.'/email-template');\n \n }",
"function update_template()\n {\n $parameter_array = $this->get_parameter_array();\n \n parent::update($this->id, 'sssis', $parameter_array);\n }",
"private function emailTemplate($data) {\n $body = array_reduce($data, function($prevInput, $curInput) {\n return $prevInput . '<p style=\"font-family:sans-serif;font-size:14px;font-weight:normal;margin:0;Margin-bottom:2px;\">' . $curInput['name'] . ': ' . $curInput['value'] . '</p>' . PHP_EOL;\n });\n\n $email = '<!DOCTYPE html>\n <html>\n <head>\n <meta name=\"viewport\" content=\"width=device-width\">\n <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">\n <title>New Online Donation</title>\n <style type=\"text/css\">\n @media only screen and (max-width: 620px) {\n table[class=body] h1 {\n font-size: 28px !important;\n margin-bottom: 10px !important; }\n table[class=body] p,\n table[class=body] ul,\n table[class=body] ol,\n table[class=body] td,\n table[class=body] span,\n table[class=body] a {\n font-size: 16px !important; }\n table[class=body] .wrapper,\n table[class=body] .article {\n padding: 10px !important; }\n table[class=body] .content {\n padding: 0 !important; }\n table[class=body] .container {\n padding: 0 !important;\n width: 100% !important; }\n table[class=body] .main {\n border-left-width: 0 !important;\n border-radius: 0 !important;\n border-right-width: 0 !important; }\n table[class=body] .btn table {\n width: 100% !important; }\n table[class=body] .btn a {\n width: 100% !important; }\n table[class=body] .img-responsive {\n height: auto !important;\n max-width: 100% !important;\n width: auto !important; }}\n @media all {\n .ExternalClass {\n width: 100%; }\n .ExternalClass,\n .ExternalClass p,\n .ExternalClass span,\n .ExternalClass font,\n .ExternalClass td,\n .ExternalClass div {\n line-height: 100%; }\n .apple-link a {\n color: inherit !important;\n font-family: inherit !important;\n font-size: inherit !important;\n font-weight: inherit !important;\n line-height: inherit !important;\n text-decoration: none !important; }\n .btn-primary table td:hover {\n background-color: #34495e !important; }\n .btn-primary a:hover {\n background-color: #34495e !important;\n border-color: #34495e !important; } }\n </style>\n </head>\n <body class=\"\" style=\"background-color:#f6f6f6;font-family:sans-serif;-webkit-font-smoothing:antialiased;font-size:14px;line-height:1.4;margin:0;padding:0;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%;\">\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" class=\"body\" style=\"border-collapse:separate;mso-table-lspace:0pt;mso-table-rspace:0pt;background-color:#f6f6f6;width:100%;\">\n <tr>\n <td style=\"font-family:sans-serif;font-size:14px;vertical-align:top;\"> </td>\n <td class=\"container\" style=\"font-family:sans-serif;font-size:14px;vertical-align:top;display:block;max-width:960px;padding:10px;width:100%;Margin:0 auto !important;\">\n <div class=\"content\" style=\"box-sizing:border-box;display:block;Margin:0 auto;max-width:100%;padding:10px;\">\n <span class=\"preheader\" style=\"color:transparent;display:none;height:0;max-height:0;max-width:0;opacity:0;overflow:hidden;mso-hide:all;visibility:hidden;width:0;\">New Form Submission</span>\n <table class=\"main\" style=\"border-collapse:separate;mso-table-lspace:0pt;mso-table-rspace:0pt;background:#fff;border-radius:3px;width:100%;\">\n <tr>\n <td class=\"wrapper\" style=\"font-family:sans-serif;font-size:14px;vertical-align:top;box-sizing:border-box;padding:20px;\">\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"border-collapse:separate;mso-table-lspace:0pt;mso-table-rspace:0pt;width:100%;\">\n <tr>\n <td style=\"font-family:sans-serif;font-size:14px;vertical-align:top;\">\n <p style=\"font-family:sans-serif;font-size:24px;font-weight:normal;margin:0;Margin-bottom:24px;\">Here are the details:</p>\n ' . $body . '\n </td>\n </tr>\n </table>\n </td>\n </tr>\n </table>\n </div>\n </td>\n <td style=\"font-family:sans-serif;font-size:14px;vertical-align:top;\"> </td>\n </tr>\n </table>\n </body>\n </html>';\n \n return $email;\n }",
"protected function process_mailtemplate()\n {\n $l_gets = $this->m_modreq->get_gets();\n $l_posts = $this->m_modreq->get_posts();\n\n $l_id = isys_glob_which_isset($l_gets[C__GET__ID], $l_posts[C__GET__ID]);\n $l_navmode = isys_glob_which_isset($l_gets[C__GET__NAVMODE], $l_posts[C__GET__NAVMODE]);\n\n // This will happen, if a user uses the checkboxes and the \"edit\" buttno.\n if (is_array($l_id))\n {\n $l_id = $l_id[0];\n } // if\n\n if (!$l_navmode && $l_id > 0)\n {\n $l_navmode = C__NAVMODE__EDIT;\n } // if\n\n switch ($l_navmode)\n {\n default:\n $this->process_mailtemplate__list();\n break;\n\n case C__NAVMODE__EDIT:\n $this->process_mailtemplate__edit($l_id);\n break;\n\n case C__NAVMODE__NEW:\n $this->process_mailtemplate__edit();\n break;\n\n case C__NAVMODE__SAVE:\n $this->process_mailtemplate__edit($this->process_mailtemplate__save($l_posts));\n break;\n\n case C__NAVMODE__DELETE:\n $this->process_mailtemplate__delete(isys_glob_which_isset($l_gets[C__GET__ID], $l_posts[C__GET__ID]));\n $this->process_mailtemplate__list();\n break;\n } // switch\n\n $this->m_tpl->smarty_tom_add_rule('tom.content.navbar.cRecStatus.p_bInvisible=1');\n }"
] |
[
"0.6501877",
"0.6321306",
"0.6262786",
"0.6184559",
"0.61806756",
"0.61783767",
"0.6150989",
"0.6146691",
"0.61250514",
"0.60922945",
"0.6092086",
"0.6052131",
"0.6048267",
"0.6039441",
"0.6016308",
"0.5987147",
"0.5893937",
"0.5874875",
"0.5859097",
"0.5845244",
"0.58211404",
"0.5803473",
"0.5783345",
"0.5780655",
"0.576624",
"0.5746801",
"0.57176405",
"0.56967074",
"0.5695292",
"0.569326"
] |
0.7405727
|
0
|
/ This file is part of the swCombinePlugin package.
|
function sw_get_javascripts()
{
$params = sfConfig::get('app_swToolbox_swCombine', array('version' => false));
$version = $params['version'];
$response = sfContext::getInstance()->getResponse();
$included_files = $response->getCombinedAssets();
sfConfig::set('symfony.asset.javascripts_included', true);
$html = '';
foreach ($response->getJavascripts() as $file => $options)
{
// avoid loading combined files
if(in_array($file, $included_files))
{
continue;
}
// append version if version is set
// or if the url does not contains a `?`
$file = $version && strpos($file, '?') === false ? $file.'?v='.$version : $file;
$html .= javascript_include_tag($file, $options);
}
return $html;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function script_concat_settings()\n {\n }",
"function wpestate_add_plugin($plugin_array) { \n $plugin_array['slider_recent_items'] = get_template_directory_uri() . '/js/shortcodes.js';\n $plugin_array['testimonials'] = get_template_directory_uri() . '/js/shortcodes.js';\n<<<<<<< HEAD\n=======\n $plugin_array['testimonial_slider'] = get_template_directory_uri() . '/js/shortcodes.js';\n>>>>>>> 64662fd89bea560852792d7203888072d7452d48\n $plugin_array['recent_items'] = get_template_directory_uri() . '/js/shortcodes.js';\n $plugin_array['featured_agent'] = get_template_directory_uri() . '/js/shortcodes.js';\n $plugin_array['featured_article'] = get_template_directory_uri() . '/js/shortcodes.js';\n $plugin_array['featured_property'] = get_template_directory_uri() . '/js/shortcodes.js';\n $plugin_array['login_form'] = get_template_directory_uri() . '/js/shortcodes.js';\n $plugin_array['register_form'] = get_template_directory_uri() . '/js/shortcodes.js';\n $plugin_array['list_items_by_id'] = get_template_directory_uri() . '/js/shortcodes.js';\n $plugin_array['advanced_search'] = get_template_directory_uri() . '/js/shortcodes.js';\n $plugin_array['font_awesome'] = get_template_directory_uri() . '/js/shortcodes.js';\n $plugin_array['spacer'] = get_template_directory_uri() . '/js/shortcodes.js';\n $plugin_array['icon_container'] = get_template_directory_uri() . '/js/shortcodes.js';\n<<<<<<< HEAD\n \n=======\n $plugin_array['list_agents'] = get_template_directory_uri() . '/js/shortcodes.js';\n $plugin_array['places_list'] = get_template_directory_uri() . '/js/shortcodes.js';\n $plugin_array['listings_per_agent'] = get_template_directory_uri() . '/js/shortcodes.js';\n $plugin_array['property_page_map'] = get_template_directory_uri() . '/js/shortcodes.js';\n $plugin_array['estate_membership_packages'] = get_template_directory_uri() . '/js/shortcodes.js';\n $plugin_array['estate_featured_user_role'] = get_template_directory_uri() . '/js/shortcodes.js';\n\t\n\t// slick function\n\t$plugin_array['places_slider'] = get_template_directory_uri() . '/js/shortcodes.js';\n\t\n>>>>>>> 64662fd89bea560852792d7203888072d7452d48\n \n return $plugin_array;\n}",
"function script_concat_settings() {\n\tglobal $concatenate_scripts, $compress_scripts, $compress_css;\n\n\t$compressed_output = ( ini_get('zlib.output_compression') || 'ob_gzhandler' == ini_get('output_handler') );\n\n\tif ( ! isset($concatenate_scripts) ) {\n\t\t$concatenate_scripts = defined('CONCATENATE_SCRIPTS') ? CONCATENATE_SCRIPTS : true;\n\t\tif ( ! is_admin() || ( defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ) )\n\t\t\t$concatenate_scripts = false;\n\t}\n\n\t$concatenate_scripts = false;\n\t$compress_scripts = false;\n\t$compress_css = false;\n/*\tif ( ! isset($compress_scripts) ) {\n\t\t$compress_scripts = defined('COMPRESS_SCRIPTS') ? COMPRESS_SCRIPTS : true;\n\t\tif ( $compress_scripts && ( ! get_site_option('can_compress_scripts') || $compressed_output ) )\n\t\t\t$compress_scripts = false;\n\t}\n\n\tif ( ! isset($compress_css) ) {\n\t\t$compress_css = defined('COMPRESS_CSS') ? COMPRESS_CSS : true;\n\t\tif ( $compress_css && ( ! get_site_option('can_compress_scripts') || $compressed_output ) )\n\t\t\t$compress_css = false;\n\t}\n*/\n}",
"function spreadshop_assortment()\n{\ninclude(plugin_dir_path(__FILE__).'/spreadassortment.php');\nadd_filter('wp_head', 'sources');\n}",
"public function installPlugins()\n\t{\n $mainframe =& JFactory::getApplication();\n// \t$lang = JFactory::getLanguage(); \n// $languages = JLanguageHelper::getLanguages('lang_code');\n \n $db =& JFactory::getDBO();\n $query = $db->getQuery(true);\n $type = \"language\";\n $query->select('a.element');\n $query->from('#__extensions AS a');\n $type = $db->Quote($type);\n\t$query->where('(a.type = '.$type.')');\n\t$query->group('a.element');\n $db->setQuery($query);\n $langlist = $db->loadObjectList();\n \n//\t\techo 'Copy Plugin(s) language(s) provided by <a href=\"https://opentranslators.transifex.com/projects/p/joomleague/\">Transifex</a>';\n\t\t$src=JPATH_SITE.DS.'components'.DS.'com_joomleague'.DS.'plugins';\n\t\t$dest=JPATH_SITE.DS.'plugins';\n\t\t$groups = JFolder::folders($src);\n \n foreach ( $langlist as $key )\n {\n echo 'Copy Plugin(s) language( '.$key->element.' ) provided by <a href=\"https://opentranslators.transifex.com/projects/p/joomleague/\">Transifex</a><br />';\n\t\tforeach ($groups as $group)\n\t\t{\n\t\t\t$plugins = JFolder::folders($src.DS.$group);\n\t\t\tforeach ($plugins as $plugin)\n\t\t\t{\n if ( JFolder::exists($src.DS.$group.DS.$plugin.DS.'language'.DS.$key->element) )\n\t\t{\n\t\t\t\tJFolder::copy($src.DS.$group.DS.$plugin.DS.'language'.DS.$key->element, JPATH_ADMINISTRATOR.DS.'language'.DS.$key->element, '', true);\n\t\techo ' - <span style=\"color:green\">'.JText::_('Success -> '.$group.' - '.$plugin.' - '.$key->element).'</span><br />';\n }\n \t}\n\t\t}\n }\n\t\t//echo ' - <span style=\"color:green\">'.JText::_('Success').'</span><br />';\n\t\techo 'Copy Plugin(s)';\n\t\tJFolder::copy($src, $dest, '', true);\n\t\techo ' - <span style=\"color:green\">'.JText::_('Success').'</span><br />';\n\t}",
"public function enqueue_public_scripts_and_styles() {\n\t\t//wp_enqueue_style( 'uclacomponentswp-backend-styles', UCLACOMPONENTSWP_PLUGIN_URL . 'core/includes/assets/css/backend-styles.css', array(), UCLACOMPONENTSWP_VERSION, 'all' );\n\t\t//wp_enqueue_script( 'uclacomponentswp-backend-scripts', UCLACOMPONENTSWP_PLUGIN_URL . 'core/includes/assets/js/backend-scripts.js', array(), UCLACOMPONENTSWP_VERSION, false );\n\t\t// wp_localize_script( 'uclacomponentswp-backend-scripts', 'uclacomponentswp', array(\n\t\t// \t'plugin_name' => __( UCLACOMPONENTSWP_NAME, 'ucla-components-for-wp' ),\n\t\t// ));\n\t// Install the UCLA Component library styles\n\twp_enqueue_style( 'ucla-lib-style', 'https://cdn.webcomponents.ucla.edu/1.0.0-beta.16/css/ucla-lib.min.css' );\n\t// Install the UCLA Component Library scripts\n\twp_enqueue_script( 'ucla-lib-script', 'https://s3-us-west-1.amazonaws.com/webcomponents.ucla.edu/public/1.0.0-beta.16/js/ucla-lib-scripts.min.js' );\n\t\n\t}",
"protected function getCompressor() {}",
"abstract protected function get_plugin_components();",
"protected static function _combineMinify()\n {\n $type = self::$_options['contentType']; // ease readability\n\n // when combining scripts, make sure all statements separated and\n // trailing single line comment is terminated\n $implodeSeparator = ($type === self::TYPE_JS)\n ? \"\\n;\"\n : '';\n // allow the user to pass a particular array of options to each\n // minifier (designated by type). source objects may still override\n // these\n $defaultOptions = isset(self::$_options['minifierOptions'][$type])\n ? self::$_options['minifierOptions'][$type]\n : array();\n // if minifier not set, default is no minification. source objects\n // may still override this\n $defaultMinifier = isset(self::$_options['minifiers'][$type])\n ? self::$_options['minifiers'][$type]\n : false;\n\n // process groups of sources with identical minifiers/options\n $content = array();\n $originalLength = 0;\n $i = 0;\n $l = count(self::$_controller->sources);\n $groupToProcessTogether = array();\n $lastMinifier = null;\n $lastOptions = null;\n do {\n // get next source\n $source = null;\n if ($i < $l) {\n $source = self::$_controller->sources[$i];\n /* @var Minify_Source $source */\n $sourceContent = $source->getContent();\n $originalLength += strlen($sourceContent);\n\n // allow the source to override our minifier and options\n $minifier = (null !== $source->minifier)\n ? $source->minifier\n : $defaultMinifier;\n $options = (null !== $source->minifyOptions)\n ? array_merge($defaultOptions, $source->minifyOptions)\n : $defaultOptions;\n }\n // do we need to process our group right now?\n if ($i > 0 // yes, we have at least the first group populated\n && (\n ! $source // yes, we ran out of sources\n || $type === self::TYPE_CSS // yes, to process CSS individually (avoiding PCRE bugs/limits)\n || $minifier !== $lastMinifier // yes, minifier changed\n || $options !== $lastOptions) // yes, options changed\n )\n {\n // minify previous sources with last settings\n $imploded = implode($implodeSeparator, $groupToProcessTogether);\n $groupToProcessTogether = array();\n if ($lastMinifier) {\n try {\n $content[] = call_user_func($lastMinifier, $imploded, $lastOptions);\n } catch (Exception $e) {\n throw new Exception(\"Exception in minifier: \" . $e->getMessage());\n }\n } else {\n $content[] = $imploded;\n }\n }\n // add content to the group\n if ($source) {\n $groupToProcessTogether[] = $sourceContent;\n $lastMinifier = $minifier;\n $lastOptions = $options;\n }\n $i++;\n } while ($source);\n\n $content = implode($implodeSeparator, $content);\n\n if ($type === self::TYPE_CSS && false !== strpos($content, '@import')) {\n $content = self::_handleCssImports($content);\n }\n\n // do any post-processing (esp. for editing build URIs)\n if (self::$_options['postprocessorRequire']) {\n require_once self::$_options['postprocessorRequire'];\n }\n if (self::$_options['postprocessor']) {\n $content = call_user_func(self::$_options['postprocessor'], $content, $type);\n }\n return array(\n 'originalLength' => $originalLength,\n 'content' => $content\n );\n }",
"protected function combineImages() {}",
"function spreadshop_designer()\n{\ninclude(plugin_dir_path(__FILE__).'/spreaddesigner.php');\nadd_filter('wp_head', 'sources');\n}",
"public static function compress(){\n\n}",
"function chroma_load_custom_market_css()\n{\n \n wp_enqueue_style (\n 'chroma_market_css',\n plugin_dir_url(__DIR__) . '/css/market.css'\n );\n\n \n wp_enqueue_script (\n 'chroma_market_js',\n plugin_dir_url(__DIR__) . '/js/market.js'\n );\n\n\n\n\n}",
"function _getCSSscripts(&$scriptList, $filenames)\n\t{\n\t\tclearstatcache();\n\t\t$cssfile_path = JPATH_SITE.DS.\"components\".DS.\"com_jbolo\".DS.\"css\".DS.\"jbolocss.php\";\n\t\t//combine and minify css\n\n\t\t//echo $this->params->get('comb_mini');\n\t\t//var_dump(is_writable($cssfile_path)); die;\n\n\t\tif($this->params->get('comb_mini') && is_writable($cssfile_path))\n\t\t{\n\n\t\t\t//$sitepath=JPATH_SITE;\n\t\t\t$sitepath=JPATH_SITE.'/';\n\t\t\tforeach($filenames as $file){\n\t\t\t\t//$css_script[]=\"include('\".$sitepath.\"/components/com_jbolo/css/\".$file.\"');\";\n\t\t\t\t$css_script[]=\"include('\".$sitepath.$file.\"');\";\n\t\t\t}\n\t\t\t$css_script=implode(\"\\n\",$css_script);\n\t\t\t$cssfile_path=JPATH_SITE.DS.\"components\".DS.\"com_jbolo\".DS.\"css\".DS.\"jbolocss.php\";\n\t\t\t$cssgzip='header(\"Content-type: text/css\");\n\t\t\t\tob_start(\"compress\");\n\t\t\t\tfunction compress($buffer){\n\t\t\t\t\t/* remove comments */\n\t\t\t\t\t$buffer = preg_replace(\"!/\\*[^*]*\\*+([^/][^*]*\\*+)*/!\", \"\", $buffer);\n\t\t\t\t\t/* remove tabs, spaces, newlines, etc. */\n\t\t\t\t\t$buffer = str_replace(array(\"\\r\\n\", \"\\r\", \"\\n\", \"\\t\", \" \", \" \", \" \"), \"\", $buffer);\n\t\t\t\t\treturn $buffer;\n\t\t\t\t}';\n\n\t\t\t$data=\"<?php \".$cssgzip .\"\\n\".$css_script.\"\\n ob_end_flush();?>\";\n\t\t\tif(JFile::write($cssfile_path, $data)){\n\t\t\t\t$scriptList[]='<link rel=\"stylesheet\" href=\"'.JURI::root().'components/com_jbolo/css/jbolocss.php\" type=\"text/css\" />';\n\t\t\t}\n\t\t\telse{\n\t\t\t\tforeach($filenames as $file){\n\t\t\t\t\t//$scriptList[]='<link rel=\"stylesheet\" href=\"'.JURI::root().'components/com_jbolo/css/'.$file.'\" type=\"text/css\" />';\n\t\t\t\t\t$scriptList[]='<link rel=\"stylesheet\" href=\"'.JURI::root().$file.'\" type=\"text/css\" />';\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\telse{\n\t\t\tforeach($filenames as $file){\n\t\t\t\t//$scriptList[]='<link rel=\"stylesheet\" href=\"'.JURI::root().'components/com_jbolo/css/'.$file.'\" type=\"text/css\" />';\n\t\t\t\t$scriptList[]='<link rel=\"stylesheet\" href=\"'.JURI::root().$file.'\" type=\"text/css\" />';\n\t\t\t}\n\t\t}\n\t\t//die(\"hrr\");\n\t}",
"function bwp_minify($src)\n{\n\tglobal $bwp_minify;\n\n\treturn $bwp_minify->minify_item($src);\n}",
"public function registerScriptsCommon() {\n $v = Wpjb_Project::VERSION;\n $p = plugins_url().'/wpjobboard/public/js/';\n $x = plugins_url().'/wpjobboard/application/vendor/';\n \n wp_register_script(\"wpjb-suggest\", $p.\"wpjb-suggest.js\", array(\"jquery\"), $v, true );\n \n wp_register_script(\"wpjb-vendor-selectlist\", $x.\"select-list/jquery.selectlist.pack.js\", array(\"jquery\"), null, true);\n wp_register_script(\"wpjb-plupload\", $p.\"wpjb-plupload.js\", array(\"plupload-all\"), $v, true);\n wp_register_script(\"wpjb-vendor-datepicker\", $x.\"date-picker/js/datepicker.js\", array(\"jquery\"));\n \n wp_register_script(\"wpjb-gmaps-infobox\", $p.\"gcode-infobox.js\", array());\n wp_register_script(\"wpjb-gmaps-markerclusterer\", $p.\"gcode-markerclusterer.js\", array());\n \n wp_register_script(\"wpjb-ace\", $x.\"ace/ace.js\", array(), \"1.2.6\");\n \n wp_register_script(\"wpjb-vendor-stripe\", \"https://js.stripe.com/v3/\");\n wp_register_script(\"wpjb-stripe\", $p.\"wpjb-stripe.js\", array(\"jquery\", \"wpjb-stripe-main\", \"wpjb-payment\"), $v);\n //wp_register_script(\"wpjb-stripe-elements\", $p.\"wpjb-stripe-elements.js\", array(\"jquery\", \"wpjb-stripe\", \"wpjb-stripe-main\"), $v);\n wp_register_script(\"wpjb-stripe-main\", \"https://js.stripe.com/v3/\", array(), $v);\n \n wp_register_script('wpjb-myresume', $p.'frontend-myresume.js', array(\"jquery\", \"wp-util\"), $v );\n \n wp_register_script('wpjb-admin-customize', $p.'admin-customize.js', array(\"jquery\"), $v, true );\n }",
"function bii_shared_items_colorpicker() {\r\n//\twp_enqueue_script('bootstrap-colorpicker', bii_css_url . 'js/bootstrap-colorpicker.min', array('jquery'));\r\n}",
"function sport_widgets_plugin_load_to_back() {\r\n\r\n\t\t//back end scripts (js)\r\n\t\twp_enqueue_script('jquery');\r\n\t\twp_enqueue_script('jquery-ui', false, array(), false, false);\r\n\t\twp_enqueue_script('jquery-ui-sortable', false, array(), false, true);\r\n\t\twp_enqueue_script('sport_widgets_plugin_backend_scripts', plugins_url('', __FILE__ ) . '/js/backend_scripts.js', array(), false, true);\r\n\t\twp_enqueue_script('sport_widgets_plugin_colorpicker', plugins_url('', __FILE__ ) . '/js/colorpicker.js', array(), false, true);\r\n\r\n\r\n\t\t//style (css)\t\r\n\t\twp_enqueue_style('sport_widgets_plugin_backend_style', plugins_url('', __FILE__ ) . '/css/backend.css');\r\n\t\twp_enqueue_style('sport_widgets_plugin_colorpicker_style', plugins_url('', __FILE__ ) . '/css/colorpicker.css');\r\n\r\n\t}",
"function combine($inFiles, $outFile) {\n }",
"function minimize_code($obj, $codetype='javascript')\n{\n\tif($codetype == 'javascript')\n\t{\n\t\t$obj->load->library(\"jsmin\");\n\t\n\t\t$combined_file_name = HOME_URL.\"js/combined.js\"; \n\t\tif (!MINIFY_JS) {\n\t\t\t// remove the combined JS file so that it can be regenerated \n\t\t\tunlink($combined_file_name); \n\t\t} \n\t\tif (!file_exists($combined_file_name)) {\n\t\t\t$files = glob(HOME_URL.\"js/*.js\");\n\t\t\t$js = \"\";\n\t\t\t\n\t\t\tforeach($files AS $file) \n\t\t\t{\n\t\t\t\tif(strpos($file, 'easyui') == FALSE && strpos($file, '.min.') == FALSE && strpos($file, '.datepick.') == FALSE){\n\t\t\t\t\tif (MINIFY_JS) {\n\t\t\t\t\t\t$js .= JSMin::minify(file_get_contents($file));\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$js .= file_get_contents($file);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tfile_put_contents($combined_file_name, $js);\n\t\t} \n\t\treturn \"<script type='text/javascript' src='\".base_url().\"js/combined.js'></script>\";\n\t\n\t} \n\telse if($codetype == 'stylesheets')\n\t{\n\t\t\n\t\t$obj->load->library(\"xmlrpc\");\n\t\t\n\t\t$obj->load->library(\"cssmin\");\n\t\t\n\t\t$combined_file_name = HOME_URL.\"css/combined.css\"; \n\t\tif (!MINIFY_JS) {\n\t\t\t// remove the combined JS file so that it can be regenerated \n\t\t\tunlink($combined_file_name); \n\t\t}\n\t\t\n\t\tif (!file_exists($combined_file_name)) \n\t\t{\n\t\t\t$files = glob(HOME_URL.\"css/*.css\");\n\t\t\t$css = \"\";\n\t\t\n\t\t\t\t\t\n\t\t\tforeach($files as $file) \n\t\t\t{\n\t\t\t\tif(strpos($file, 'easyui') == FALSE && strpos($file, '.min.') == FALSE && strpos($file, '.datepick.') == FALSE)\n\t\t\t\t{\n\t\t\t\t\tif (MINIFY_JS)\n\t\t\t\t\t{\n\t\t\t\t\t\t$css .= CssMin::minify(file_get_contents($file));\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$css .= file_get_contents($file);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tfile_put_contents($combined_file_name, $css);\n\t\t} \n\t\t\n\t\treturn \"<link href='\".base_url().\"css/combined.css' rel='stylesheet' type='text/css' />\";\n\t}\t\n}",
"private function pack($resources)\n {\n if (!class_exists('JSMin', false) && !function_exists('jsmin')) {\n require_once(VENDOR_DIR . 'mrclay/minify/min/lib/JSMin.php');\n\n /**\n * Custom implementation jsmin\n *\n * @param $js\n * @return string\n */\n function jsmin($js)\n {\n return JSMin::minify($js);\n }\n }\n\n if (!class_exists('CSSMin', false)) {\n require_once(VENDOR_DIR . 'mrclay/minify/min/lib/CSSmin.php');\n }\n $handlers = [];\n\n $CSSmin = new CSSMin();\n\n// Debuger::dump($resources['css']);\n\n foreach ($resources['js'] as $resource) {\n if (!isset($handlers[$resource['resource']])) {\n Directory::get(dirname($resource['resource']));\n $handlers[$resource['resource']] = fopen($resource['resource'], 'w');\n }\n\n $pack = $resource['pack']\n ? jsmin(file_get_contents($resource['source']))\n : file_get_contents($resource['source']);\n\n fwrite($handlers[$resource['resource']], '/* Ice: ' . $resource['source'] . \" */\\n\" . $pack . \"\\n\\n\\n\");\n }\n\n foreach ($resources['css'] as $resource) {\n if (!isset($handlers[$resource['resource']])) {\n Directory::get(dirname($resource['resource']));\n $handlers[$resource['resource']] = fopen($resource['resource'], 'w');\n }\n\n $pack = $resource['pack']\n ? $CSSmin->run(file_get_contents($resource['source']))\n : file_get_contents($resource['source']);\n\n if (!empty($resource['css_replace'])) {\n $pack = str_replace($resource['css_replace'][0], $resource['css_replace'][1], $pack);\n }\n\n fwrite($handlers[$resource['resource']], '/* Ice: ' . $resource['source'] . \" */\\n\" . $pack . \"\\n\\n\\n\");\n }\n\n foreach ($handlers as $filePath => $handler) {\n fclose($handler);\n\n chmod($filePath, 0664);\n chgrp($filePath, filegroup(dirname($filePath)));\n }\n }",
"protected function mergeWebpackBundles()\n {\n try {\n if ((isset($this->webpackPath) === true) && (is_array($this->webpackBundles) === true)) {\n $cacheKey = self::CACHE_KEY . get_called_class();\n if ((Yii::$app->cache === null) || (Yii::$app->cache->get($cacheKey) === false)) {\n $assetsFileAlias = $this->webpackPath . '/' . $this->webpackAssetCatalog;\n $this->sourcePath = $this->webpackPath . '/' . $this->webpackDistDirectory;\n $bundles = file_get_contents(Yii::getAlias($assetsFileAlias));\n $bundles = Json::decode($bundles);\n if (Yii::$app->cache !== null) {\n $cacheDependency = new FileDependency([\n 'fileName' => $assetsFileAlias\n ]);\n Yii::$app->cache->set($cacheKey, $bundles, 0, $cacheDependency);\n }\n } else {\n $bundles = Yii::$app->cache->get($cacheKey);\n }\n foreach($this->webpackBundles as $bundle) {\n if (isset($bundles[$bundle]['js']) === true) {\n $this->js[] = $bundles[$bundle]['js'];\n }\n if (isset($bundles[$bundle]['css']) === true) {\n $this->css[] = $bundles[$bundle]['css'];\n }\n }\n }\n } catch(Exception $e) {\n Yii::error($e->getMessage(), 'sweelix\\webpack');\n throw $e;\n }\n }",
"protected function mergeWebpackBundles()\n {\n try {\n if ((isset($this->webpackPath) === true) && (is_array($this->webpackBundles) === true)) {\n $cacheKey = self::CACHE_KEY . get_called_class();\n $this->sourcePath = $this->webpackPath . '/' . $this->webpackDistDirectory;\n $cache = $this->getCache();\n if (($cache === null) || ($cache->get($cacheKey) === false)) {\n $assetsFileAlias = $this->webpackPath . '/' . $this->webpackAssetCatalog;\n $bundles = file_get_contents(Yii::getAlias($assetsFileAlias));\n $bundles = Json::decode($bundles);\n if ($cache !== null) {\n $cacheDependency = Yii::createObject([\n 'class' => FileDependency::class,\n 'fileName' => $assetsFileAlias,\n ]);\n $cache->set($cacheKey, $bundles, 0, $cacheDependency);\n }\n } else {\n $bundles = $cache->get($cacheKey);\n }\n foreach($this->webpackBundles as $bundle) {\n if (isset($bundles[$bundle]['js']) === true && in_array($bundle, $this->cssOnly) === false) {\n $this->js[] = $bundles[$bundle]['js'];\n }\n if (isset($bundles[$bundle]['css']) === true && in_array($bundle, $this->jsOnly) === false) {\n $this->css[] = $bundles[$bundle]['css'];\n }\n }\n }\n } catch(Exception $e) {\n Yii::error($e->getMessage(), 'sweelix\\webpack');\n throw $e;\n }\n }",
"function sport_core_plugin_load_to_back() {\r\n\r\n\t\t//scripts (js)\r\n\t\twp_enqueue_script('jquery');\r\n\t\twp_enqueue_script('jquery-ui', false, array(), false, false);\r\n\t\twp_enqueue_script('jquery-ui-sortable', false, array(), false, true);\r\n\t\twp_enqueue_script('thickbox', false, array(), false, true);\t\t\t\t\t\r\n\t\twp_enqueue_script('media-upload', false, array(), false, true);\r\n\t\t// wp_enqueue_script('canon_colorpicker', get_template_directory_uri() . '/js/colorpicker.js', array(), false, true);\r\n\t\twp_enqueue_script('sport_core_plugin_backend_scripts', plugins_url('', __FILE__ ) . '/js/backend_scripts.js', array(), false, true);\r\n\r\n\t\t//style (css)\t\r\n\t\twp_enqueue_style('sport_core_plugin_style', plugins_url('', __FILE__ ) . '/css/style.css');\r\n\r\n\t}",
"function cap_vc_extend_js_css() {\n //wp_enqueue_style( 'cap_vc_extend_style' );\n // If you need any javascript files on front end, here is how you can load them.\n //wp_enqueue_script( 'cap_vc_extend_js', plugins_url('cap_vc_extend.js', __FILE__), array('jquery') );\n}",
"function kw_filter_mce_plugin( $plugins ) {\r\n\t$plugins['artefact'] = TINYWOW_DIR . 'js/artefact.js';\r\n\t$plugins['legend'] = TINYWOW_DIR . 'js/legend.js';\r\n\t$plugins['epic'] = TINYWOW_DIR . 'js/epic.js';\r\n\t$plugins['rare'] = TINYWOW_DIR . 'js/rare.js';\r\n\t$plugins['commun'] = TINYWOW_DIR . 'js/commun.js';\r\n\t$plugins['normal'] = TINYWOW_DIR . 'js/normal.js';\r\n\t$plugins['poor'] = TINYWOW_DIR . 'js/poor.js';\r\n\t$plugins['youtubeblack'] = TINYWOW_DIR . 'js/youtube.js';\r\n\t$plugins['youtubeborder'] = TINYWOW_DIR . 'js/kwyoutube.js';\r\n\treturn $plugins;\r\n}",
"function studeon_vc_merge_styles($list) {\n\t\t$list[] = 'plugins/js_composer/js_composer.css';\n\t\treturn $list;\n\t}",
"function mw_enqueue_color_picker( $hook_suffix ) {\r\n // first check that $hook_suffix is appropriate for your admin page\r\n wp_enqueue_style( 'wp-color-picker' );\r\n wp_enqueue_script( 'my-script-handle', plugins_url('my-script.js', __FILE__ ), array( 'wp-color-picker' ), false, true );\r\n}",
"function combineVMU($bw, $color)\n{\n $bwHandle = fopen('.//upload//' . $bw . '//ICONDATA.VMS', 'r');\n $colorHandle = fopen('.//upload//' . $color . '//ICONDATA.VMS', 'r');\n $bwHeaderAndImage = stream_get_contents($bwHandle, 160, $offset = 0);\n $colorImage = stream_get_contents($colorHandle, $length = 864, $offset = 160);\n fclose($bwHandle);\n fclose($colorHandle);\n\n $finalBuffer = $bwHeaderAndImage . $colorImage;\n if (!file_exists('.//upload//' . $bw . '_')) {\n mkdir('.//upload//' . $bw . '_');\n }\n $moshHandle = fopen('.//upload//' . $bw . '_//ICONDATA.VMS', 'c+');\n copy('.//upload//' . $bw . '//ICONDATA.VMI', './/upload//' . $bw . '_//ICONDATA.VMI');\n\n $bytes_written = false;\n $bytes_written = fwrite($moshHandle, $finalBuffer, 1024);\n fclose($moshHandle);\n\n createZipAndDownload('.//' . $bw . '_//');\n}",
"function handleShortcode($atts = [], $content = null, $tag = '') {\n\n if (is_admin()){\n return;\n }\n \n $vueRootUrl = plugin_dir_url( __FILE__ ) . 'dist';\n $vueFileRoot = plugin_dir_path( __FILE__) . 'dist';\n\n $jsCore = ['bootstrap.min.js', 'jquery-3.3.1.min.js', 'popper.min.js'];\n\n // Find the build files\n $jsMatches = glob(plugin_dir_path( __FILE__) . 'dist/js/*.*.js');\n $cssMatches = glob(plugin_dir_path( __FILE__) . 'dist/css/*.*.css');\n\n // Bring in core dependencies first\n\n $isLocal = true;\n\n if ($isLocal){\n\n //wp_deregister_script('jquery');\n\n //wp_register_script('actiontracker_vuecore_jquery', $vueRootUrl . '/js/jquery-3.3.1.min.js', false, null, true);\n\n wp_register_script('actiontracker_vuecore_popper', $vueRootUrl . '/js/popper.min.js', false, null, true);\n wp_register_script('actiontracker_vuecore_bootstrap4', $vueRootUrl . '/js/bootstrap.min.js', false, null, true);\n \n foreach ($jsMatches as $i => $jsItem) {\n if (!in_array(basename($jsItem), $jsCore)){\n $url = $vueRootUrl . '/js/' . basename($jsItem);\n $name = \"actiontracker_vuejs_\".$i;\n if (!wp_script_is($name, 'enqueued')){\n //print_r('BUILD JS: ' . $jsItem . '<br/>');\n wp_register_script($name, $url);\n wp_enqueue_script($name); \n }\n }\n }\n \n foreach ($cssMatches as $i => $cssItem) { \n $url = $vueRootUrl . '/css/' . basename($cssItem);\n $name = \"actiontracker_vuecss_\".$i;\n if (!wp_script_is($name, 'enqueued')){\n //print_r('CSS JS: ' . $i . '<br/>');\n wp_register_style($name, $url);\n wp_enqueue_style($name); \n }\n \n }\n\n }\n else {\n\n wp_register_script('actiontracker_vuecore_popper', 'http://app.actiontracker.org/js/popper.min.js', false, null, true);\n wp_register_script('actiontracker_vuecore_bootstrap4', 'http://app.actiontracker.org/js/bootstrap.min.js', false, null, true);\n \n //wp_enqueue_script('actiontracker_vuecore_jquery');\n wp_enqueue_script('actiontracker_vuecore_popper');\n wp_enqueue_script('actiontracker_vuecore_bootstrap4');\n \n }\n\n\n \n \n\n /*\n\n */\n \n // Handle short code params\n\n if (array_key_exists('view', $atts)) {\n $str = \"<div class='actionTrackerVuePlugin' view='\".$atts['view'].\"'>You need Javascript for this feature, sorry.</div>\"; \n }\n else {\n $str = \"<div class='actionTrackerVuePlugin' view='all'>You need Javascript for this feature, sorry.</div>\"; \n }\n\n return $str;\n }"
] |
[
"0.55002874",
"0.53739184",
"0.53469974",
"0.5315384",
"0.52446",
"0.51975226",
"0.518155",
"0.51783335",
"0.51496917",
"0.5134041",
"0.51326144",
"0.51157796",
"0.50584626",
"0.50534606",
"0.5037058",
"0.50179535",
"0.5014021",
"0.49884307",
"0.4987793",
"0.49611622",
"0.49589375",
"0.49569562",
"0.49549097",
"0.49502856",
"0.49501047",
"0.49230567",
"0.4905086",
"0.49014345",
"0.48891026",
"0.4887056"
] |
0.5430516
|
1
|
Create a new user in the database. If $cert and $key are both omitted or NULL, no LGI credentials are setup for the user.
|
static function create($userid, $password=NULL, $cert=NULL, $key=NULL) {
if (!is_null($password)) {
$hash = hash_password($password);
lgi_mysql_query("INSERT INTO %t(users) SET `name`='%%', `passwd_hash`='%%'", $userid, $hash);
} else {
lgi_mysql_query("INSERT INTO %t(users) SET `name`='%%'", $userid);
}
$o = new LGIUser($userid);
if ($cert && $key) $o->set_certkey($cert, $key);
return $o;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"private static function create()\n {\n getDb()->putUser(1, self::getDefaultAttributes());\n }",
"public function newUser() {\n $this->checkValidUser();\n\n $this->db->sql = 'INSERT INTO '.$this->db->dbTbl['users'].' (username, salt, hash) VALUES (:username, :salt, :hash)';\n\n $salt = $this->getNewSalt();\n\n $res = $this->db->execute(array(\n ':username' => $this->getData('username'),\n ':salt' => $salt,\n ':hash' => md5($salt . $this->getData('password'))\n ));\n\n if($res === false) {\n $this->output = array(\n 'success' => false,\n 'key' => 'xxT5r'\n );\n } else {\n $this->output = array(\n 'success' => true,\n 'key' => 'dU4r5'\n );\n }\n\n $this->renderOutput();\n }",
"protected function _createUser()\n {\n $data = [\n 'email' => '[email protected]',\n 'password' => 'test',\n ];\n\n $user = $this->Users->newEntity($data);\n\n $user->set('active', true);\n $user->set('role_id', 1);\n\n $this->Users->save($user);\n }",
"function createUser(){\n\t\t\tglobal $db;\n\t\t\tglobal $json;\n\t\t\t\n\t\t\t//Check if username meets minimum requirements\n\t\t\tif($this->username == \"\" || $this->username == null || strlen($this->username) < 6){\n\t\t\t\t$json->invalidMinimumRequirements(\"Username\");\n\t\t\t\treturn;\n\t\t\t}\n\t\t\telse{\n\t\t\t//Check if username already exists\n\t\t\t\tif($db->query('SELECT * FROM user WHERE Username = \"'.$this->username.'\"')->rowCount() > 0){\n\t\t\t\t\t$json->exists(\"Username\");\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t//Check if password meets minimum requirements\n\t\t\tif($this->password == \"\" || $this->password == null || strlen($this->password) < 6){\n\t\t\t\t$json->invalidMinimumRequirements(\"Password\");\n\t\t\t\treturn;\n\t\t\t}\n\t\t\telse{\n\t\t\t\t$passHash = generatePassword($this->password);\n\t\t\t\t$this->password = $passHash;\n\t\t\t\t$apiHash = generateApiKey($this->username.\"\".date('Y-m-d'));\n\t\t\t}\n\t\t\t\n\t\t\t//Check if admin is empty or invalid, if so make user non-admin\n\t\t\tif($this->admin == \"\" || $this->admin == null || $this->admin < 0)\n\t\t\t\t$this->admin = 0;\n\t\t\t\n\t\t\tif($this->subject == \"\" || $this->subject == null || $this->subject < 0)\n\t\t\t\t$this->subject = 0;\n\t\t\t\t\n\t\t\t$insert = $db->prepare('INSERT INTO user VALUES (DEFAULT, :username, :password, :subject, :admin, :api)');\n\t\t\t$insert->bindParam(':username', $this->username);\n\t\t\t$insert->bindParam(':password', $this->password);\n\t\t\t$insert->bindParam(':subject', $this->subject);\n\t\t\t$insert->bindParam(':admin', $this->admin);\n\t\t\t$insert->bindParam(':api', $apiHash);\n\t\t\t\n\t\t\tif($insert->execute()){\n\t\t\t\t$json->created(\"User\");\n\t\t\t\treturn;\n\t\t\t}\n\t\t\telse{\n\t\t\t\t$json->server();\n\t\t\t\treturn;\n\t\t\t}\n\t\t}",
"public function createUser();",
"public function createUser();",
"public function createUser();",
"public function createUser();",
"function create($username, $password='', $ID_Entity='', $secureLevel=9){\n\t\t$username = trim(strtolower($username));\n\t\tif(preg_match(PATTERN_EMAIL, $username)){\n\t\t\t$cols = array(\t\t'Username'\t=>\t$username,\n\t\t\t\t\t\t\t\t'Password'\t=>\t$password,\n\t\t\t\t\t\t\t\t'ID_User'\t=>\t$ID_Entity,\n\t\t\t\t\t\t\t\t'SecureLevel'\t=>\t$secureLevel);\n\t\t\t$this->ID_User = dbInsert($cols, 'GBM_SYS_User');\n\t\t\t$this->username = $username;\n\t\t\treturn $this->ID_User;\n\t\t}else{\n\t\t\treturn FALSE;\n\t\t}\n\t}",
"function new_user($firstName,$lastName,$email,$password){\t\n $salt = generate_salt();\n $encPassword = encrypt_password($password,$salt);\n\n //$user = create_user_object($firstName,$lastName,$email,$encPassword,$salt,$userType);\n save_user_info($firstName,$lastName,$email,$encPassword,$salt);\n \n return true;\n}",
"public function createUserAction() {\n $this->authService->createUser();\n die();\n }",
"public function createUser($name, $pass, $profile, array $extra = []);",
"public function createUser () {\n syslog( LOG_INFO, 'Create a Lineberty User \\n' );\n\n $url = '/users';\n\n return $this->runRequest($url, 'POST', null);\n }",
"public function createUser()\n {\n $c = $this->getConnectionWithConfig('default');\n\n // First we create the record that we need to update\n $create = 'CREATE (u:User {name: $name, email: $email, username: $username})';\n // The bindings structure is a little weird, I know\n // but this is how they are collected internally\n // so bare with it =)\n $createCypher = $c->getCypherQuery($create, array(\n 'name' => $this->user['name'],\n 'email' => $this->user['email'],\n 'username' => $this->user['username'],\n ));\n\n return $this->client->run($createCypher['statement'], $createCypher['parameters']);\n }",
"public function createUser($fname, $lname, $uname, $pass, $email)\n\t{\n\n\t\t//Try to insert new user into the database\n\n\t\t//Create and return a new user object\n\n\t\treturn new User($fname, $lname, $uname, $pass, $email, 1);\n\t}",
"public function createUser($first, $last, $email, $UTEPID, $fmajor, $smajor, $minor, $concentration, $p) {\r\n if($this -> testConnection()) {\r\n $key = hash('sha256', $p);\r\n $req = 'INSERT INTO `user_info` (uid, firstname, lastname, email, utepid, fmajor, smajor, minor, concentration)\r\n VALUES (\"'.$key.'\", \"'.$first.'\", \"'.$last.'\", \"'.$email.'\", \"'.$UTEPID.'\", \"'.$fmajor.'\", \"'.$smajor.'\", \"'.$minor.'\", \"'.$concentration.'\" )';\r\n\r\n if($this -> c -> query($req) === TRUE) {\r\n echo \"User created successfully.\";\r\n return TRUE;\r\n } else {\r\n echo \"Error creating record: \".$this -> c -> error;\r\n return FALSE;\r\n }\r\n } else echo \"Not connected to server.\";\r\n return FALSE;\r\n }",
"function createUser($cid, $username, $password) {\n\t\t$dao = new UserData();\n\t\t$values = array(\n\t\t\t\"contact\" => $cid,\n\t\t\t\"login\" => $username,\n\t\t\t\"password\" => $password\n\t\t);\n\t\t$dao->create($values);\n\t}",
"function create_user($liuid, $fname, $sname, $password, $privil = 2)\r\n\t{\r\n\t\tif(strlen($liuid) == 8 && !empty($fname) && !empty($fname) && strlen($password) > 6\r\n\t\t\t&& !$this->liuid_exists($liuid))\r\n\t\t{\r\n\t\t\t$data = array(\r\n\t\t\t\t\t\t'fname'\t\t=> $fname,\r\n\t\t\t\t\t\t'sname'\t\t=> $sname,\r\n\t\t\t\t\t\t'password'\t=> $this->passwordhash->HashPassword($password),\r\n\t\t\t\t\t\t'liuid'\t\t=> $liuid\r\n\t\t\t\t\t);\r\n\t\t\treturn $this->db->insert('users', $data) && $this->change_privil($this->get_id($liuid), $privil);\r\n\t\t}\r\n\t\treturn false;\r\n\t}",
"public function create_user($user, $password, $security_question1, $security_answer1, $security_question2, $security_answer2, $security_question3, $security_answer3);",
"public function createEnterpriseUser($input);",
"function create_user($username, $pass) {\n\t$db = get_db();\n\t$pass_hashed = password_hash($pass, PASSWORD_DEFAULT);\n\t$stmt = $db->prepare(\"CALL create_user(?, ?)\");\n\t$stmt->bind_param(\"ss\", $username, $pass_hashed);\n\t$stmt->execute() or trigger_error($db->error);\n\t$db->close();\n}",
"function set_certkey($cert, $key) {\n\t\t// get user and groups from certificate\n\t\t$cn = explode(';', LGIUser::get_cert_cn($cert));\n\t\t$certuser = $certproject = $certgroups = null;\n\t\tif (count($cn)==2) {\n\t\t\t$certuser = $cn[0];\n\t\t\t$certgroups = null;\n\t\t\t$certprojects = explode(',', $cn[1]);\n\t\t} elseif (count($cn)==3) {\n\t\t\t$certuser = $cn[0];\n\t\t\t$certgroups = explode(',', $cn[1]);\n\t\t\t$certprojects = explode(',', $cn[2]);\n\t\t} else {\n\t\t\tthrow new LGIPortalException(\"Unsupported certificate: need 2 or 3 semicolon-separated fields in CN\");\n\t\t}\n\t\t// update or insert key/certificate\n\t\t$query = \"%t(usercerts) SET `cert`='%%', `key`='%%', `username`='%%', `fixedgroups`='%%', `user`='%%'\";\n\t\t$result = lgi_mysql_query(\"SELECT `id` FROM %t(usercerts) WHERE cert='%%' AND `key`='%%' AND `user`='%%'\", $cert, $key, $this->userid);\n\t\tif ($result && mysql_num_rows($result)>0) {\n\t\t\t// already exists: update\n\t\t\t$usercertid = mysql_fetch_row($result);\n\t\t\t$usercertid = $usercertid[0];\n\t\t\tlgi_mysql_query(\"UPDATE $query WHERE `id`='%%'\", $cert, $key, $certuser, !is_null($certgroups), $this->userid, $usercertid);\n\t\t// new row: add it instead\n\t\t} else {\n\t\t\tlgi_mysql_query(\"INSERT INTO $query\", $cert, $key, $certuser, !is_null($certgroups), $this->userid);\n\t\t\t$usercertid = mysql_insert_id();\n\t\t}\n\t\t// create groups\n\t\tif ($certgroups!==null) {\n\t\t\t// only the user's own group + the ones specified\n\t\t\tlgi_mysql_query(\"DELETE FROM %t(usergroups) WHERE `usercertid`='%%'\", $usercertid);\n\t\t\tlgi_mysql_query(\"INSERT IGNORE INTO %t(usergroups) SET `usercertid`='%%', `name`='%%'\", $usercertid, $this->userid);\n\t\t\tforeach ($certgroups as $g)\n\t\t\t\tlgi_mysql_query(\"INSERT INTO %t(usergroups) SET `usercertid`='%%', `name`='%%'\", $usercertid, $g);\n\t\t} else {\n\t\t\t// when any group can be chosen, pre-fill database with admin\n\t\t\tlgi_mysql_query(\"INSERT IGNORE INTO %t(usergroups) SET `usercertid`='%%', `name`='%%'\", $usercertid, $this->userid);\n\t\t\tlgi_mysql_query(\"INSERT IGNORE INTO %t(usergroups) SET `usercertid`='%%', `name`='admin'\", $usercertid);\n\t\t}\n\t\t// and projects\n\t\tlgi_mysql_query(\"DELETE FROM %t(userprojects) WHERE `usercertid`='%%'\", $usercertid);\n\t\tforeach($certprojects as $p)\n\t\t\tlgi_mysql_query(\"INSERT INTO %t(userprojects) SET `usercertid`='%%', `name`='%%'\", $usercertid, $p);\n\t}",
"private function create()\n {\n return $this->db->putUser($this->getDefaultAttributes());\n }",
"public function create_user($username, $password, $email){\n\n\t$hashed_password = password_hash($password, PASSWORD_DEFAULT);\n\t$sql = \"INSERT INTO users VALUES \n\t(NULL, :type_id, :email, :username, :password, :created_at, :updated_at)\";\n\t$statement = $this->dbh->prepare($sql);\n\t$statement->execute([\n\t\t'type_id' => '2',\n\t\t'email' => $email,\n\t\t'username' => $username,\n\t\t'password' => $hashed_password,\n\t\t'created_at' => date('Y-m-d H:i:s'),\n\t\t'updated_at' => date('Y-m-d H:i:s')\n\t\t]);\n\techo \"signup succesfull\";\n\t // header(\"refresh:3;url=index.php\"); \n\t}",
"public function writeNewUser () {\n if (! $this->Writeable()){\n throw new Exception('User object is not writeable, cannot write to DB');\n }\n\n if ($this->exists($this->loginId)) {\n throw new Exception('User already exists, cannot be created');\n }\n\n $i = new folksoDBinteract($this->dbc);\n if ($i->db_error()) {\n throw new Exception('DB connect error: ' . $i->error_info());\n }\n\n $i->sp_query(\n sprintf(\"call create_user(\"\n .\"'%s', '%s', '%s', '%s', '', %d, '%s', '%s', '%s')\",\n $i->dbescape($this->nick),\n $i->dbescape($this->firstName),\n $i->dbescape($this->lastName),\n $i->dbescape($this->email),\n $i->dbescape($this->loginId),\n $i->dbescape($this->institution),\n $i->dbescape($this->pays),\n $i->dbescape($this->fonction)));\n\n if ($i->result_status == 'DBERR') {\n throw new Exception('DB query error on create FB user: ' . $i->error_info());\n }\n }",
"private function init_user() {\n global $USER, $DB;\n\n $userdata = new stdClass;\n $userdata->username = 'user';\n $userid = user_create_user($userdata);\n $USER = $DB->get_record('user', array('id' => $userid));\n context_user::instance($USER->id);\n }",
"protected function createUser()\n {\n $errors = $this->validate(['username','password','email','group_id']);\n\n if(count($errors) > 0)\n {\n $this->sendResponse([\n 'status' => 'failed',\n 'message' => 'Invalid data supplied',\n 'error' => $errors\n ]);\n }\n\n $arrUserData = [\n 'username' => $this->request->variable('username',''),\n 'user_password' => $this->request->variable('password',''), // already hashed by contao\n 'user_email' => $this->request->variable('email',''),\n 'group_id' => $this->request->variable('group_id',''),\n 'user_type' => USER_NORMAL\n ];\n\n // Create the user and get an ID\n $userID = user_add($arrUserData);\n\n // If user wasn't created, send failed response\n if(!$userID)\n {\n $this->sendResponse([\n 'status' => 'failed',\n 'message' => 'phpbb Could not create user',\n 'error' => ['Could not create phpBB user']\n ]);\n }\n\n // Send success response\n $this->sendResponse([\n 'status' => 'success',\n 'message' => 'phpBB user created',\n 'data' => [\n 'user_id' => $userID\n ]\n ]);\n }",
"function insertNewUser() {\n\ttry {\n\t\t// Open DB connection\n\t\t$DBH = openDBConnection();\n\t\t$DBH->beginTransaction();\n\t\t\n\t\t// Prepare salt and hash\n\t\t$salt = makeSalt();\n\t\t$hash = computeHash($_REQUEST['newPW2'], $salt);\t\t\n\t\t\n\t\t// Insert user info into DB\n\t\t$stmt = $DBH->prepare(\"insert into Users values (?, ?, ?)\");\n\t\t$stmt->bindValue(1, $_REQUEST['newLogin']);\n\t\t$stmt->bindValue(2, $hash);\n\t\t$stmt->bindValue(3, $_REQUEST['newName']);\n\t\t$stmt->execute();\n\t\t\n\t\t// Make this new user a client\n\t\t$stmt2 = $DBH->prepare(\"insert into Roles values (?, ?)\");\n\t\t$stmt2->bindValue(1, \"client\");\n\t\t$stmt2->bindValue(2, $_REQUEST['newLogin']);\n\t\t$stmt2->execute();\n\t\t\n\t\t$DBH->commit();\n\t\treturn true;\n\t}\n\tcatch (PDOException $e) {\n\t\t$DBH->rollBack();\n\t\treturn false;\n\t}\n}",
"public function createUser()\n {\n $this->user = factory(Easel\\Models\\User::class)->create();\n }",
"public function create()\n\t{\n\t\tif (!isset($_POST) || empty($_POST))\n\t\t{\n\t\t\theader(\"Location: /myrecipe/users/registry\");\n\t\t\texit;\n\t\t}\n\t\t// TODO need to validate data\n\t\t$data = array('username' => $_POST['username'], 'password' => $_POST['password'], 'cpassword' => $_POST['cpassword'], 'email' => $_POST['email']);\n\t\t// validate the input data\n\t\t$errorArray = User::validates($data);\n\t\tif (count($errorArray))\n\t\t{\n\t\t\t// store errors in session and redirect\n\t\t\t$_SESSION['user'] = $data;\n\t\t\t$_SESSION['user']['errors'] = $errorArray;\n\t\t\theader(\"Location: /myrecipe/users/registry\");\n\t\t\texit;\n\t\t}\n\t\t// create a new user, assume all new users are not staff\n\t\t$values = array('username'=>$_POST['username'],'password'=>$_POST['password'],'email'=>$_POST['email'],'user_type'=>'1');\n\t\t$id = User::createUser($values);\n\t\t// log the user in\n\t\t$_SESSION['user']['id'] = $id;\n\t\t$_SESSION['user']['name'] = $_POST['username'];\n\t\t$_SESSION['user']['type'] = '1';\n\t\techo \"id = \" . $id;\n\t\theader(\"Location: /myrecipe/users/\" . $id);\n\t\texit;\n\t}"
] |
[
"0.63251483",
"0.6314534",
"0.6307529",
"0.6216024",
"0.6112451",
"0.6112451",
"0.6112451",
"0.6112451",
"0.6106193",
"0.6091009",
"0.60597116",
"0.6058162",
"0.60116595",
"0.59207475",
"0.59185773",
"0.59066355",
"0.5871681",
"0.5868075",
"0.58477217",
"0.57889557",
"0.57886815",
"0.5779039",
"0.5755514",
"0.5751405",
"0.5738665",
"0.57309014",
"0.5709431",
"0.56881726",
"0.5680557",
"0.567641"
] |
0.7599278
|
0
|
Set private key and certificate for user. While the database model supports multiple certificates/keys for a single user, this web application supports only one. The certificate is parsed first, so that user and group information can be put into the database as well. TODO it may be good to wrap this (or more) into a transaction
|
function set_certkey($cert, $key) {
// get user and groups from certificate
$cn = explode(';', LGIUser::get_cert_cn($cert));
$certuser = $certproject = $certgroups = null;
if (count($cn)==2) {
$certuser = $cn[0];
$certgroups = null;
$certprojects = explode(',', $cn[1]);
} elseif (count($cn)==3) {
$certuser = $cn[0];
$certgroups = explode(',', $cn[1]);
$certprojects = explode(',', $cn[2]);
} else {
throw new LGIPortalException("Unsupported certificate: need 2 or 3 semicolon-separated fields in CN");
}
// update or insert key/certificate
$query = "%t(usercerts) SET `cert`='%%', `key`='%%', `username`='%%', `fixedgroups`='%%', `user`='%%'";
$result = lgi_mysql_query("SELECT `id` FROM %t(usercerts) WHERE cert='%%' AND `key`='%%' AND `user`='%%'", $cert, $key, $this->userid);
if ($result && mysql_num_rows($result)>0) {
// already exists: update
$usercertid = mysql_fetch_row($result);
$usercertid = $usercertid[0];
lgi_mysql_query("UPDATE $query WHERE `id`='%%'", $cert, $key, $certuser, !is_null($certgroups), $this->userid, $usercertid);
// new row: add it instead
} else {
lgi_mysql_query("INSERT INTO $query", $cert, $key, $certuser, !is_null($certgroups), $this->userid);
$usercertid = mysql_insert_id();
}
// create groups
if ($certgroups!==null) {
// only the user's own group + the ones specified
lgi_mysql_query("DELETE FROM %t(usergroups) WHERE `usercertid`='%%'", $usercertid);
lgi_mysql_query("INSERT IGNORE INTO %t(usergroups) SET `usercertid`='%%', `name`='%%'", $usercertid, $this->userid);
foreach ($certgroups as $g)
lgi_mysql_query("INSERT INTO %t(usergroups) SET `usercertid`='%%', `name`='%%'", $usercertid, $g);
} else {
// when any group can be chosen, pre-fill database with admin
lgi_mysql_query("INSERT IGNORE INTO %t(usergroups) SET `usercertid`='%%', `name`='%%'", $usercertid, $this->userid);
lgi_mysql_query("INSERT IGNORE INTO %t(usergroups) SET `usercertid`='%%', `name`='admin'", $usercertid);
}
// and projects
lgi_mysql_query("DELETE FROM %t(userprojects) WHERE `usercertid`='%%'", $usercertid);
foreach($certprojects as $p)
lgi_mysql_query("INSERT INTO %t(userprojects) SET `usercertid`='%%', `name`='%%'", $usercertid, $p);
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function setCertificate($certificateFilename, $privateKeyFilename) {\n $result = false;\n\n if (is_readable($certificateFilename) && is_readable($privateKeyFilename))\n {\n $certificate=null;\n $handle=fopen($certificateFilename, \"r\");\n $size=filesize($certificateFilename);\n $certificate=fread($handle,$size);\n fclose($handle);\n\n $privateKey=null; \n $handle=fopen($privateKeyFilename,\"r\");\n $size=filesize($privateKeyFilename);\n $privateKey=fread($handle, $size);\n fclose($handle);\n \n \t if (($certificate !== false) && ($privateKey !== false) && openssl_x509_check_private_key($certificate, $privateKey)) {\n\t\t\t $this->certificate = $certificate;\n\t\t\t $this->certificateFile = $certificateFilename;\n\t\t\t $this->privateKey = $privateKey;\n\t\t\t $this->privateKeyFile = $privateKeyFilename;\n\t\t\t $result = true;\n \t }\n }\n\n return $result;\n }",
"public function setSslCertificate($cert, $key, $keyPass = '');",
"static function create($userid, $password=NULL, $cert=NULL, $key=NULL) {\n\t\tif (!is_null($password)) {\n\t\t\t$hash = hash_password($password);\n\t\t\tlgi_mysql_query(\"INSERT INTO %t(users) SET `name`='%%', `passwd_hash`='%%'\", $userid, $hash);\n\t\t} else {\n\t\t\tlgi_mysql_query(\"INSERT INTO %t(users) SET `name`='%%'\", $userid);\n\t\t}\n\t\t$o = new LGIUser($userid);\n\t\tif ($cert && $key) $o->set_certkey($cert, $key);\n\t\treturn $o;\n\t}",
"public function setUserRsaKeys($user, $privateKey, $publicKey)\n {\n $this->_userDao->setUserRsaKeys($user['userid'], $privateKey, $publicKey);\n }",
"public function generateRequest()\n {\n if (! $this->publickey) {\n throw new \\Exception('private key is blank, did you generate keys or set current ones?');\n }\n if (! $this->privatekey) {\n throw new \\Exception('private key is blank, did you generate keys or set current ones?');\n }\n // Load our public and private keys into RSA objects\n $rsaPublicKey = new \\phpseclib\\Crypt\\RSA();\n $rsaPublicKey->loadKey($this->publickey);\n $rsaPrivateKey = new \\phpseclib\\Crypt\\RSA();\n $rsaPrivateKey->loadKey($this->privatekey);\n // Create a new certificate signing request with our key pair\n $csr = new \\phpseclib\\File\\X509();\n $csr->setPublicKey($rsaPublicKey);\n $csr->setPrivateKey($rsaPrivateKey);\n // Craft the DN as CN=nameOfCertificate\n $subjects = $this->subjects;\n $dn = 'CN='.$subjects[0];\n $csr->setDN($dn);\n // Sign our CSR with the certificates private key\n $signedCSR = $csr->signCSR('sha256WithRSAEncryption');\n // phpseclib is picky about setting X.509v3 extended attributes in a newly signed CSR, so load it again\n $csr->loadCSR($signedCSR);\n // Set the proper x509v3 attributes for each TYPE of certificate\n if ($this->type == 'ca') {\n $dn = 'CN='.$this->name;\n $csr->setDN($dn);\n $csr->setExtension('id-ce-basicConstraints', ['cA' => true], 1);\n } elseif ($this->type == 'user') {\n //add /emailAddress=Metaclassing@nixvm to DN\n $dn .= '/emailAddress='.$subjects[1];\n $csr->setDN($dn);\n $csr->setExtension('id-ce-basicConstraints', ['cA' => false], 1);\n $csr->setExtension('id-ce-keyUsage', ['keyEncipherment', 'nonRepudiation', 'digitalSignature']);\n $csr->setExtension('id-ce-extKeyUsage', ['id-kp-emailProtection', 'id-kp-clientAuth']);\n $csr->setExtension('netscape-cert-type', ['Email', 'SSLClient']);\n } elseif ($this->type == 'server') {\n $csr->setExtension('id-ce-keyUsage', ['keyEncipherment', 'nonRepudiation', 'digitalSignature']);\n $csr->setExtension('id-ce-extKeyUsage', ['id-kp-serverAuth']);\n $altnames = $this->subjectAlternativeNames($this->subjects);\n $csr->setExtension('id-ce-subjectAltName', $altnames);\n } else {\n throw new \\Exception('Unsupported certificate type '.$this->type);\n }\n // Sign it again now that the x509 v3 attributes are all added\n $signedCSR = $csr->signCSR('sha256WithRSAEncryption');\n // Save the CSR to our database record\n $this->request = $csr->saveCSR($signedCSR);\n $this->status = 'unsigned';\n $this->save();\n }",
"public function setCredentials($b64_user=\"\")\n\t{\t\n\t\t// It is possible to retrieve information form any user specified in here.\n\t\t// If no user is specified, the system will take the current one.\n\t\tif (empty($b64_user))\n\t\t{\n\t\t\tif (isset($_SESSION[\"USER\"]))\n\t\t\t{\n\t\t\t\t$this->curlObj->set_credentials($_SESSION[\"USER\"]);\n\t\t\t}\n\t\t} else {\n\t\t\t$this->curlObj->set_credentials($b64_user);\n\t\t}\n\t}",
"public function RegisterNewUser()\r\n {\r\n \r\n $aUser = array(\r\n 'sFunction' => 'RegisterNewUser',\r\n 'result' => false\r\n ); \r\n \r\n if(isset($_GET['sJSON']))\r\n {\r\n $aJSONInfo = json_decode($_GET['sJSON']);\r\n //var_dump($aJSONInfo);\r\n \r\n $password = $aJSONInfo->sPassword; \r\n $encrypted = base64_decode($password);\r\n\r\n/* DO NOT INDENT THIS CODE */\r\n $privkey = '-----BEGIN RSA PRIVATE KEY-----\r\nMIIJKQIBAAKCAgEA4jCNEY3ZyZbhNksbKG+l+LX9fIEiLkrRy9roGTKJnr2TEuZ2\r\n8qvwRKeFbAs0wpMUS5/8hF+Fte2Qywqq9ARGRNzTcDxjz72VRwTf1tSTKAJUsHYL\r\nKbBWPsvZ8FWk9EzJqltdj1mYVKMWcm7Ham5gwydozgnI3VbX8HMY8EglycKIc43g\r\nC+liSUmloWHGCnfKrfSEQ2cuIjnupvodvFw65dAanLu+FRuL6hnvt7huxXz5+wbP\r\nI5/aFGWUIHUbHoDFOag8BhVaDjXCrjWt3ry3oFkheO87swYfSmQg4tHM/2keCrsd\r\nHAk2z/eCuYcbksnmNgTqWgcSHNGM+nq9ngz/xXeb1UT+KxBy7K86oCD0a67eDzGv\r\nu3XxxW5N3+vvKJnfL6xT0EWTYw9Lczqhl9lpUdCgrcYe45pRHCqiPGtlYIBCT5lq\r\nVZi9zncWmglzl2Fc4fhjwKiK1DH7MSRBO8utlgawBFkCprdsmapioTRLOHFRAylS\r\nGUiyqYg0NqMuQc5fMRiVPw8Lq3WeAWMAl8paksAQHYAoFoX1L+4YkajSVvD5+jQI\r\nt3JFUKHngaGoIWnQXPQupmJpdOGMCCu7giiy0GeCYrSVT8BCXMb4UwIr/nAziIOM\r\niK87WAwJKysRoZH7daK26qoqpylJ00MMwFMPvtrpazOcbKmvyjE+Gg/ckzMCAwEA\r\nAQKCAgB3TVJqyt3vZSR+pZi6eEEbcKo17EqiDhagJmM7Pxu1XZpgYqykjKnbHFzU\r\nQwjeBAO1a7od++AjuB0h6wuGT2bc1Xi0fzXKEd3Vqq2Bu3eup6QRuwFiSL8EujLG\r\nf/XUYVgRAcXUYVZmderWCrYl3fgtlvDBlAmdLTwSeDLUMcm0pGWiRVfCEKQlsbGp\r\n8E8roEmH/Stx/c8ogFPvQIdEnYT3SA9xUdkNew0OOgXlamMKyUN08v94c8zr6zP4\r\n9quKKDNemOyn7MUmL5bymh+OFw3nhnuQNObRI06Hx05NNImiwcf1swHEktuVT6Bk\r\nyO1zPAivv2H4gDg+eQyZ5Pl0jrisacoOy0MeCa4Veeff3UZJd33HPdOyrNJTyYzH\r\nUb+IcE2LWSS38rOIHUWSOiQKkF2Cf4Y8tyu4fRvOmXE8deG+V7ViIxowbeTBNIY3\r\nQkOxVVDMjvPqbSjcisozHQp7dYivAu5QWcRqKzMDKI3/eMy1rpzerFQ/1r/oka2Z\r\nn25nOELfsmmYmdna39QPTFwZxrobdESNuqzqmP+9Igvx42uuG5mbPK5pNXIfjPdk\r\nOAomfs4zO+kPY27TV0x8A/9lSP7FsNezIGcs7BNsajzQWRQPPNjpvqP/6FocNyr7\r\n3R83dZziqksHise70/bCMUKkSuX/5f1ohM1KQrCg9+RUHHK6kQKCAQEA+YUg+K6W\r\n+nmrxv26QQp5AYatBaNUiW5oZjIBrU3fweQm7VDBaJZqN3dPMcxQ3HsEfsn3D0hR\r\nU/hzQ8MV8BrjoC3YoJaBf1dDQr60H0bQNKbCKCWgOGFm5i3bTi8uHqOgfQTQJ4a+\r\nabauuVtVHMt3z6QQpUIqutf7qn936UIj2Rjv1NoFpmW+K/U6vyyzaxfhH9t1DlPr\r\nMrLXwPvIcClG1YXdXm6bDLn25UE2kD0u5hyvvUbQYQ16ju4OvkpkLoIHQxFjUUIE\r\nSsKYf3m/RK667cW7PU74v+0HlgjmVkgTT96FsZ6LqgY5fXVLrka7s+j1CID2w4Dj\r\ns4R8ghaJ09twmQKCAQEA6BBQ6nUOuqpR+lXXvjsNTZD7MD2aac5nKA3Cx5arpahX\r\npqdGphl03wtbArxuwxrhEx68AaRavTlIeZ72y0m+280loRog/JrjU0ZTU3jzZTAZ\r\nukXzstAXeLxTG+srMDf7mUF7gvct4onT5cU20O1Ckr295x/NLPq6xStEVgQ2BbrL\r\na26ni87anqoun4lnB0WUsCpVjHK/+ivHFM5BFzQmO+iKx8U20Ij3Qoi0jBQ+DhdF\r\nXjbH3SDE7r/tltwsv8tomCnIWps7vAAyQm88Mh1RXduATPluZfLLmM6tvhSJRJdq\r\nAxQ5miVmx08l54zxrGI6zJHk/64NkmmTKZ3OXTxlqwKCAQAsto6SAbdMa0E9B3q4\r\n7QeCHoAi4oHjnsVWit+CDtJqDFhtbms6MroV9mtaoSJcYC8OCWMcefkY8wy0t+DW\r\nhfsEWTLYlB/gkeKbs1DTyfzFcpyYVSXA9LNbzBvghtPc6bV4scQbUSoOB46H6LX3\r\n0v5FV0EkXBcMJGgUxYLXaeLCpJVVrzwT9Wd+uRMt7vS33C+bZdg0GRWsoB/JlVT1\r\nxG/NE4/3vBpMzYZQzr7YWh5tXfagFHCC88dilYZO00Xgj6x9eEAz74CVZQmuzkJY\r\nLHeS5DwJYH1y5ybU3ANqsr/DMD0E90RP0425zasiL8qzEqvWOkX+ArrLEJK/PQq1\r\nzD0BAoIBAQC4xGToiBMWJI3o13hTCglpfMnCewn6vE/94Bb5eslnuEUxd3YUwaf/\r\n/raT0xwNU9Vot8vRMt7cUkOWMi8lZK4Fq60OPBOPjHL61r95co+4PTf+y7tg37YQ\r\nd0FktTVJywkT2MNSXyO1fy+rff5LEt0yoMgWwYdHDMqwOebK5cdtgHB+NThJZIVE\r\nVxOQCoJxk8DzEoHStXqM4VY9Botkwiy+/kOhEzC1kJft7ZJzBZry9SxR+yPeuDyU\r\nK1QsDVnDy1yX6oyPN5Gz+iQKKS6waA9kv2PD5cU0fsAEBmrnMMqqRjQuB2hlhuny\r\nPt5bIik5q2xNfMvrltVPgaeeNvsb2P7JAoIBAQDEDJBKM9Ym/BWNLKxCjdzGyegx\r\nilWgn0o8r7S5KmS/sdyTtnOFwJTyFeIDBDcsFBogNKWVG7625SMzTYhUcA4DzPPE\r\ngVJkOfigDoAiN1heN0Ds/I4ysms5syfNQrL8qi80mP/lugrf1fn7DSBOAf4EEbWs\r\n5BBhJ+I+cZalhbR8hevdRie5C0AVPEuFf92soFd+R/yUhvXrYEjeN8/84GyoACW7\r\njO2NBE2EPkSuomRl6Zd7Yce9xsytI9EdMlT+jgGVqNvaTliJBoM2fq6+R8v5iFN7\r\nzRT9yVmqGJTgjz0E+cV8/0ODbzajfq9JLIj/aICn+BXft7sLt1fJz9fwAwU2\r\n-----END RSA PRIVATE KEY-----';\r\n/* DO NOT INDENT THIS CODE end */\r\n \r\n // Decrypt the data using the private key and store the results in $decrypted\r\n openssl_private_decrypt($encrypted, $decrypted, $privkey);\r\n \r\n $decryptedPassword = $decrypted;\r\n \r\n //Encrypt the password\r\n $sUserPassword = $this->oBcrypt->genHash($decryptedPassword);\r\n \r\n //Update the password for the user\r\n $sQuery = $this->conPDO->prepare(\"UPDATE users SET sUserPassword = :sUserPassword WHERE sUserCreateToken = :sUserToken\");\r\n \r\n $sQuery->bindValue(':sUserPassword', $sUserPassword);\r\n $sQuery->bindValue('sUserToken', $aJSONInfo->sUserToken);\r\n \r\n $sQuery->execute();\r\n \r\n //Create the new company\r\n //Function returns iCompanyId\r\n //TODO: Missing payment info\r\n $iCompanyId = $this->oCompany->AddCompany($aJSONInfo->sCompanyName, $aJSONInfo->iCompanyTelefon,$aJSONInfo->sCompanyAddress, $aJSONInfo->iCompanyZipcode, $aJSONInfo->sCompanyCVR);\r\n \r\n //Create the new restuarent\r\n //Function returns the irestuarentInfoId \r\n $iRestuarentInfoId = $this->oRestuarent->AddRestuarent($aJSONInfo->sRestuarentName, $aJSONInfo->sRestuarentSlogan ,$aJSONInfo->iRestuarentTel, $aJSONInfo->sRestuarentAddress, $aJSONInfo->iRestuarentZipcode, $iCompanyId, $aJSONInfo->dRestuarentLocationLat, $aJSONInfo->dRestuarentLocationLng);\r\n \r\n \r\n //Create Menucard\r\n //Function returns the iMenucardId\r\n $iMenucardId = $this->oMenucard->AddNewMenucard($aJSONInfo->sRestuarentName.' - menukort',$iRestuarentInfoId);\r\n \r\n \r\n //Create stampcard\r\n $this->oStampcard->CreateStampcard($iRestuarentInfoId);\r\n \r\n //Create Qrcode\r\n $this->oQrcode->CreateNewQrCode($iRestuarentInfoId);\r\n \r\n //Insert openinghours\r\n $aOpeningHours = array(\r\n 0 => $aJSONInfo->iMondayTimeFrom,\r\n 1 => $aJSONInfo->iMondayTimeTo,\r\n 2 => $aJSONInfo->iMondayClosed,\r\n 3 => $aJSONInfo->iThuesdayTimeFrom,\r\n 4 => $aJSONInfo->iThuesdayTimeTo,\r\n 5 => $aJSONInfo->iThuesdayClosed,\r\n 6 => $aJSONInfo->iWednesdaysTimeFrom,\r\n 7 => $aJSONInfo->iWednesdaysTimeTo,\r\n 8 => $aJSONInfo->iWednesdaysClosed,\r\n 9 => $aJSONInfo->iThursdayTimeFrom,\r\n 10 => $aJSONInfo->iThursdayTimeTo,\r\n 11 => $aJSONInfo->iThursdayClosed,\r\n 12 => $aJSONInfo->iFridayTimeFrom,\r\n 13 => $aJSONInfo->iFridayTimeTo,\r\n 14 => $aJSONInfo->iFridayClosed,\r\n 15 => $aJSONInfo->iSaturdayTimeFrom,\r\n 16 => $aJSONInfo->iSaturdayTimeTo,\r\n 17 => $aJSONInfo->iSaturdayClosed,\r\n 18 => $aJSONInfo->iSundayTimeFrom,\r\n 19 => $aJSONInfo->iSundayTimeTo,\r\n 20 => $aJSONInfo->iSundayClosed,\r\n );\r\n \r\n //Loop through array and insert all the values\r\n //Counter for the day id. 1=mandag,2=tirsdag,3=onsdag,4=torsdag,5=fredag,6=lørdag,7=søndag\r\n $iDay = 1;\r\n for($i=0;$i<20;$i+=3) {\r\n $sQuery = $this->conPDO->prepare(\"INSERT INTO openinghours (iFK_iMenucardId,iFK_iDayId,iFK_iTimeFromId,iFK_iTimeToId,iClosed) VALUES (:iFK_iMenucardId,:iFK_iDayId,:iFK_iTimeFromId,:iFK_iTimeToId,:iClosed)\");\r\n \r\n $sQuery->bindValue(':iFK_iMenucardId', $iMenucardId);\r\n $sQuery->bindValue(':iFK_iDayId', $iDay);\r\n $sQuery->bindValue(':iFK_iTimeFromId', $aOpeningHours[$i]);\r\n $i++;\r\n $sQuery->bindValue(':iFK_iTimeToId', $aOpeningHours[$i]);\r\n $i++;\r\n $sQuery->bindValue(\":iClosed\", $aOpeningHours[$i]);\r\n $sQuery->execute();\r\n $i--;\r\n $i--;\r\n $iDay++;\r\n if($i == 19){\r\n break;\r\n }\r\n } \r\n \r\n \r\n //Get the sUsername based on the sUserCreateToken\r\n $sQuery = $this->conPDO->prepare(\"SELECT sUsername FROM users WHERE sUserCreateToken = :sUserToken\");\r\n $sQuery->bindValue(':sUserToken', $aJSONInfo->sUserToken);\r\n $sQuery->execute();\r\n $result = $sQuery->fetch(PDO::FETCH_ASSOC);\r\n $sUsername= $result['sUsername'];\r\n \r\n //Set iFK_iCompanyId for the user\r\n $sQuery = $this->conPDO->prepare(\"UPDATE users SET iFK_iCompanyId = :iCompanyId WHERE sUserCreateToken = :sUserToken\");\r\n $sQuery->bindValue(':iCompanyId', $iCompanyId);\r\n $sQuery->bindValue(':sUserToken', $aJSONInfo->sUserToken);\r\n $sQuery->execute(); \r\n \r\n //Remove sUserCreateToken\r\n $sQuery = $this->conPDO->prepare(\"UPDATE users SET sUserCreateToken = '' WHERE sUserCreateToken = :sUserToken\");\r\n $sQuery->bindValue(':sUserToken', $aJSONInfo->sUserToken);\r\n $sQuery->execute(); \r\n \r\n //When data is inserted. log in the user and then redirect user to admin.php, where the user can start creating the menucard\r\n if($this->LogInUser($sUsername, $decryptedPassword) == true)\r\n {\r\n $aUser['result'] = true;\r\n return $aUser;\r\n }else{\r\n $aUser['result'] = false;\r\n }\r\n\r\n }\r\n return $aUser;\r\n }",
"public function testUpdateCertificate()\n {\n }",
"public function addPersonalRootCertificate() {\n\t\treturn $this->addCertificate($this->userCertificateManager);\n\t}",
"public function addKeys(PKEncryptionEnabledUserInterface $user, $clearPrivateKey);",
"public function set_auth_key($data) {\n\t\t$this->UserAuth = ClassRegistry::init('UserAuth');\n\t\t$input = array(\n\t\t\t'key'\t=> $data['key'],\n\t\t\t'params'\t=> serialize($data),\n\t\t\t'created_at' => date('Y-m-d H:i:s'),\n\t\t\t);\n\t\t$this->UserAuth->create();\n\t\t$this->UserAuth->save($input);\n\t\treturn;\n\t}",
"public function setCert(?string $cert): void\n {\n }",
"function createServerKeys($openSslCnfPath) {\n\t\t$spotSigning = new SpotSigning();\n\t\t$x = $spotSigning->createPrivateKey($openSslCnfPath);\n\t\t\n\t\t$this->setIfNot('publickey', $x['public']);\n\t\t$this->setIfNot('privatekey', $x['private']);\n\t}",
"private function setEncryptPassword(){\n // Encode the new users password\n $encrpyt = $this->get('security.password_encoder');\n $password = $encrpyt->encodePassword($this->user, $this->user->getPassword());\n $this->user->setPassword($password);\n }",
"public function execute() {\n\t\ttry {\n\t\t\t// Get input data\n\t\t\t$userUid = $GLOBALS['BE_USER']->user['uid'];\n\t\t\t$groupUid = $GLOBALS['moduleData']['groupUid'];\n\t\t\t$newMemberUid = $GLOBALS['moduleData']['groupMemberUid'];\n\t\t\t$rights = $GLOBALS['moduleData']['groupMemberRights'];\n\t\t\t$passphrase = $GLOBALS['moduleData']['passphrase'];\n\n\t\t\t// Check if user has admin rights in group\n\t\t\ttx_passwordmgr_helper::checkMemberRights( $userUid, $groupUid, 2 );\n\n\t\t\t// Check if new member is not already member of group\n\t\t\ttx_passwordmgr_helper::checkUserNotMemberOfGroup( $newMemberUid, $groupUid );\n\n\t\t\t// Check if rights are within valid range\n\t\t\ttx_passwordmgr_helper::checkRightsWithinRange($rights);\n\n\t\t\t// Initialize current user object for decryption of passwords\n\t\t\t$user = t3lib_div::makeInstance('tx_passwordmgr_model_user');\n\t\t\t$user->init($userUid);\n\t\t\t$user['publicKey'] = tx_passwordmgr_openssl::extractPublicKeyFromCertificate($user['certificate']);\n\n\t\t\t// Initialize new member object\n\t\t\t$newMember = t3lib_div::makeInstance('tx_passwordmgr_model_groupmember');\n\t\t\t$newMember['groupUid'] = $groupUid;\n\t\t\t$newMember['beUserUid'] = $newMemberUid;\n\t\t\t$newMember['rights'] = $rights;\n\n\t\t\t// Add new member to group\n\t\t\t$newMember->add();\n\n\t\t\t// Re init new member to get his public key for encryption\n\t\t\t$newMember->init($newMemberUid, $groupUid);\n\n\t\t\t// Get list of passwords of this group\n\t\t\t$group = t3lib_div::makeInstance('tx_passwordmgr_model_group');\n\t\t\t$group['uid'] = $groupUid;\n\t\t\t$passwordList = $group->getPasswordList();\n\n\t\t\t// Add ssl data for each password of new user\n\t\t\tforeach ( $passwordList as $password ) {\n\t\t\t\t// Decrypt ssl data of password of current user\n\t\t\t\t$sslData = t3lib_div::makeInstance('tx_passwordmgr_model_sslData');\n\t\t\t\t$sslData->init($password['uid'], $user['uid']);\n\t\t\t\t$plaintextData = tx_passwordmgr_openssl::decrypt($user['privateKey'], $passphrase, $sslData['key'], $sslData['data']);\n\t\t\t\tunset($sslData);\n\n\t\t\t\t// Encrypt data for new member\n\t\t\t\t$newMemberKeyAndData = tx_passwordmgr_openssl::encrypt($newMember['publicKey'], $plaintextData);\n\t\t\t\tunset($plaintextData);\n\n\t\t\t\t// Add ssl data for new member\n\t\t\t\t$sslDataNewMember = t3lib_div::makeInstance('tx_passwordmgr_model_sslData');\n\t\t\t\t$sslDataNewMember['passwordUid'] = $password['uid'];\n\t\t\t\t$sslDataNewMember['beUserUid'] = $newMemberUid;\n\t\t\t\t$sslDataNewMember['timeStamp'] = time();\n\t\t\t\t$sslDataNewMember['createDate'] = time();\n\t\t\t\t$sslDataNewMember['key'] = $newMemberKeyAndData['key'];\n\t\t\t\t$sslDataNewMember['data'] = $newMemberKeyAndData['data'];\n\t\t\t\t$sslDataNewMember->add();\n\t\t\t}\n\t\t} catch ( Exception $e ) {\n\t\t\ttx_passwordmgr_helper::addLogEntry(2, 'addGroupMember', $e->getMessage());\n\t\t}\n\n\t\t$this->defaultView();\n\t}",
"private function getAndSetAuthInfo() {\n #Authentication\n #$this->userIdentifier will be empty if the unser doesn't provide a credential\n #If in the future we implement API keys, then I suggest we only look for\n #the DN if the API key isn't presented.\n #Failure to authenticate is handled elsewhere\n if(is_null($this->userIdentifier)){\n $this->userIdentifier = Get_User_Principle_PI();\n $this->userIdentifierType = 'X509';\n }\n }",
"protected abstract function fetch_private_cert(&$request);",
"public function setCertificate($val)\n {\n $this->_propDict[\"certificate\"] = $val;\n return $this;\n }",
"public function setIdentityCertificate(?IosCertificateProfileBase $value): void {\n $this->getBackingStore()->set('identityCertificate', $value);\n }",
"public function SetKey($key = ''){\n \tself::$userKey = $key;\n }",
"public function setUserSecurityKeyObject(WsSecurityKey $userSecurityKey)\n {\n $this->userSecurityKey = $userSecurityKey;\n }",
"public function send_certificade_email(stdClass $issuecert) { // previously protected\n global $DB, $CFG;\n\n $user = $DB->get_record('user', array('id' => $issuecert->userid));\n if (!$user) {\n print_error('nousersfound', 'moodle');\n }\n\n $info = new stdClass();\n $info->username = format_string(fullname($user), true);\n $info->certificate = format_string($issuecert->certificatename, true);\n $info->course = format_string($this->get_instance()->coursename, true);\n\n $subject = get_string('emailstudentsubject', 'simplecertificate', $info);\n $message = get_string('emailstudenttext', 'simplecertificate', $info) . \"\\n\";\n\n // Make the HTML version more XHTML happy (&).\n $messagehtml = text_to_html($message);\n\n // Get generated certificate file.\n $file = $this->get_issue_file($issuecert);\n if ($file) { // Put in a tmp dir, for e-mail attachament.\n $fullfilepath = $this->create_temp_file($file->get_filename());\n $file->copy_content_to($fullfilepath);\n $relativefilepath = str_replace($CFG->dataroot . DIRECTORY_SEPARATOR, \"\", $fullfilepath);\n\n if (strpos($relativefilepath, DIRECTORY_SEPARATOR, 1) === 0) {\n $relativefilepath = substr($relativefilepath, 1);\n }\n\n if (!empty($this->get_instance()->emailfrom)) {\n $from = core_user::get_support_user();\n $from->email = format_string($this->get_instance()->emailfrom, true);\n } else {\n $from = format_string($this->get_instance()->emailfrom, true);\n }\n\n $ret = email_to_user($user, $from, $subject, $message, $messagehtml, $relativefilepath, $file->get_filename());\n @unlink($fullfilepath);\n\n return $ret;\n } else {\n print_error(get_string('filenotfound', 'simplecertificate'));\n }\n }",
"public static function setSsl() {\n $attr = conf::getMainIni('mysql_attr');\n if (isset($attr['mysql_attr'])) {\n self::$dbh->setAttribute(PDO::MYSQL_ATTR_SSL_KEY, $attr['ssl_key']);\n self::$dbh->setAttribute(PDO::MYSQL_ATTR_SSL_CERT, $attr['ssl_cert']);\n self::$dbh->setAttribute(PDO::MYSQL_ATTR_SSL_CA, $attr['ssl_ca']);\n }\n }",
"public function preAdd($userId, $certKey) {\n $user = $this->db->findOne(array('_id' => $this->_toMongoId($userId)));\n if ($user == null) return 'Invalid user id.';\n \n if (!empty($user['certs']) && count($user['certs']) >= 5) return 'You are only allowed 5 certificates.';\n return true;\n }",
"private function addCertificate(){\n\t\tif(!filesize($_FILES['services_ipsec_certif_private_certificate']['tmp_name']) > 0){\n\t\t\tErrorHandler::addError('formerror','services_ipsec_certif_private_certificate');\n\t\t}\n\t\t\n\t\tif(!filesize($_FILES['services_ipsec_certif_public_certificate']['tmp_name']) > 0){\n\t\t\tErrorHandler::addError('formerror','services_ipsec_certif_public_certificate');\n\t\t}\n\t\t\n\t\tif(ErrorHandler::errorCount() == 0){\n\t\t\t$newcert = $this->data->certificates->addChild('certificate');\n\t\t\t$newcert->addAttribute('id',time());\n\t\t\t$newcert->addAttribute('description',htmlentities($_POST['services_ipsec_certif_descr']));\n\t\t\t$newcert->addChild('public',$_FILES['services_ipsec_certif_public_certificate']['name']);\n\t\t\t$newcert->addChild('private',$_FILES['services_ipsec_certif_private_certificate']['name']);\n\n\t\t\tFunctions::mountFilesystem('mount');\n\t\t\t//\tMove certificates to permanent /cfg store\n\t\t\tmove_uploaded_file($_FILES['services_ipsec_certif_private_certificate'],self::PERSIST_CERT_PATH.'/'.$_FILES['services_ipsec_certif_private_certificate']['name']);\n\t\t\tmove_uploaded_file($_FILES['services_ipsec_certif_public_certificate'],self::PERSIST_CERT_PATH.'/'.$_FILES['services_ipsec_certif_public_certificate']['name']);\n\t\t\t\n\t\t\t//\tCopy them over to self::CERT_PATH so we don't need a reboot to use them\n\t\t\tif(!is_dir(self::CERT_PATH)){\n\t\t\t\tmkdir(self::CERT_PATH);\n\t\t\t}\n\t\t\tFunctions::shellCommand('cp '.self::PERSIST_CERT_PATH.'/'.$_FILES['services_ipsec_certif_private_certificate']['name'].' '.self::CERT_PATH.'/'.$_FILES['services_ipsec_certif_private_certificate']['name']);\n\t\t\tFunctions::shellCommand('cp '.self::PERSIST_CERT_PATH.'/'.$_FILES['services_ipsec_certif_public_certificate']['name'].' '.self::CERT_PATH.'/'.$_FILES['services_ipsec_certif_public_certificate']['name']);\n\t\t\t\n\t\t\tFunctions::mountFilesystem('unmount');\n\t\t\t$this->config->saveConfig();\n\t\t\techo '<reply action=\"ok\"><ipsec><certificates>';\n\t\t\techo $newcert->asXML();\n\t\t\techo '</certificates></ipsec></reply>';\n\t\t}\n\t\telse{\n\t\t\tthrow new Exception('There is invalid form input');\n\t\t}\n\t\t\n\t}",
"public function _setupKey() {\n\t\tif ( ! isset( $this->key ) ) {\n\t\t\t$this->setKey( '' );\n\t\t}\n\n\t\t// Key has already been expanded in Crypt_RC2::setKey():\n\t\t// Only the first value must be altered.\n\t\t$l = unpack( 'Ca/Cb/v*', $this->key );\n\t\tarray_unshift( $l, $this->pitable[ $l['a'] ] | ( $l['b'] << 8 ) );\n\t\tunset( $l['a'] );\n\t\tunset( $l['b'] );\n\t\t$this->keys = $l;\n\t}",
"public function setUserData($objUserSession)\n\t{\n\t\t//set profile identifier\n\t\t$this->profile_identifier = $objUserSession->profile->profile_identifier;\n\n\t\t//set user id\n\t\t$this->profile_user_id = $objUserSession->id;\n\t\t\n\t\t$s = $this->profile_user_id . '-' . $this->profile_identifier;\n\t\t$this->user_local_identifier = md5($s);\t\t\n\t}",
"public function updateAuthKey() {\n $user = self::login($this->login, $this->password);\n if($user) {\n $this->authKey = $user->authKey;\n $this->authExpired = $user->authExpired;\n }\n }",
"private function __setUser() {\n // Create the (helper) user object from the authenticated subject if present\n $subject = \\Native5\\Identity\\SecurityUtils::getSubject();\n if ($subject->isAuthenticated()) {\n $this->user = \\Akzo\\User\\Service::getInstance()->getUser(\n $subject->getPrincipal()['username'],\n $subject\n );\n }\n }",
"private function helperCreateAndAddCertificate($name, $signatures = [], $owned = false, $private = false) {\n \t$certificate = $this->helperCreateCertificate($name, $signatures, $owned, $private);\n \tif($private) {\n \t\t$this->assertTrue($this->keyring->setNodePrivate($certificate));\n \t} else {\n \t\t$this->assertTrue($this->keyring->setCertificate($certificate));\n \t}\n \treturn $certificate;\n }"
] |
[
"0.5443879",
"0.5265131",
"0.5175269",
"0.51743907",
"0.51432335",
"0.5078392",
"0.50024784",
"0.4997642",
"0.49413595",
"0.49393427",
"0.49267343",
"0.48789078",
"0.4864816",
"0.48597613",
"0.4843975",
"0.4828",
"0.48083967",
"0.47962996",
"0.4784557",
"0.4771281",
"0.47444808",
"0.4742259",
"0.4703502",
"0.4695296",
"0.4685836",
"0.46542323",
"0.46372217",
"0.46240586",
"0.46233875",
"0.46171483"
] |
0.6825512
|
0
|
Returns an array with the user's groups. This is cached in the session.
|
function get_groups() {
if (!isset($_SESSION['groups']))
lgi_mysql_fetch_session("SELECT GROUP_CONCAT(`name`) AS `groups` FROM %t(usergroups) AS p, %t(usercerts) AS c WHERE p.`usercertid`=c.`id` AND c.`user`='%%'", $this->userid);
return explode(',', $_SESSION['groups']);
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public static function getCurrentUserGroups()\n {\n return self::getUserGroups();\n }",
"private function getGroups()\n {\n $where = '';\n if ($this->userGroups)\n {\n $groups = explode(',', $this->userGroups);\n $where .= \" uid IN ('\" . implode(\"','\", $groups) . \"') \";\n }\n $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'fe_groups', $where);\n $res = array();\n while (($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)))\n {\n $res[$row['uid']] = $row;\n }\n\n $this->loadGroupIcons($res);\n\n return $res;\n }",
"public function getGroups()\r\n {\r\n return $this->getGuardUser() ? $this->getGuardUser()->getGroups() : array();\r\n }",
"public function getGroups() {\n return $this->getGuardUser() ? $this->getGuardUser()->getGroups() : array();\n }",
"public function getGroups() {\r\n // Array to hold the group objects\r\n $groups = [];\r\n // Loop through each of the groups the user belongs to\r\n foreach ($this->groups as $group) {\r\n // Get the group from the database\r\n $grp = UserGroup::getByName($group);\r\n // If the group has a valid ID (not 0 or less)\r\n if ($grp->id != 0) {\r\n // Add the group to the array\r\n $groups[] = $grp;\r\n }\r\n }\r\n // Return the groups array\r\n return $groups;\r\n }",
"function getGroups()\n {\n//\t\t$this->_groups = array();\n if ( empty( $this->_groups ) ) {\n $member_handler = &zarilia_gethandler( 'member' );\n if ( $this->getVar( 'uid' ) ) {\n $this->_groups = $member_handler->getGroupsByUser( $this->getVar( 'uid' ) );\t\t\t\t\n } else {\n $this->_groups = array( 0 => ZAR_GROUP_ANONYMOUS );\n }\n }\t\t\n return $this->_groups;\n }",
"public function get_groups()\n\t{\n\t\tif (empty($this->user))\n\t\t{\n\t\t\treturn false;\n\t\t}\n\n\t\treturn array(array('UniGroup', $this->user[static::_column('group')]));\n\t}",
"public function getUserGroups()\n\t{\n\t\t\n\t\t$groups = array();\n\t\t$db \t= $this->getUserDbTable();\n\t\t$id \t= $this->getUserId();\n\t\t\n\t\tif ($id)\n\t\t{\t\n\t\t\t$groups \t= $db->getAdapter()->select()->from(array('gmt'=>'groups_members_table'))\n\t\t\t\t\t\t\t\t\t\t ->joinInner(array('gt'=>'groups_table'), 'gmt.group_id = gt.group_id')\n\t\t\t\t\t\t\t\t\t\t ->where('gmt.user_id = ? ', $id)\n\t\t\t\t\t\t\t\t\t\t ->query()->fetchAll();\n\t\t}\t\n\t\t/* Automatically append group 0===Public group */\n\t\t$public \t\t= $db->getAdapter()->select()->from(array('gmt'=>'groups_table'))->where('group_privacy_level = ? ', 0)\n\t\t\t\t\t\t\t\t\t ->query()->fetch();\n\t\t$groups[] = $public;\n\t\t\n\t\treturn $groups;\n\t}",
"public function getUserGroups()\n\t{\n\t\tself::authenticate();\n\n\t\t$uname = FormUtil::getPassedValue('user', null);\n\t\tif($uname == null) {\n\t\t\treturn self::retError('ERROR: No user name passed!');\n\t\t}\n\n\t\t$uid = UserUtil::getIdFromName($uname);\n\t\tif($uid == false) {\n\t\t\treturn self::ret(false);\n\t\t}\n\n\t\t$groups = UserUtil::getGroupsForUser($uid);\n\t\t$return = array();\n\t\tforeach($groups as $item) {\n\t\t\t$group = UserUtil::getGroup($item);\n\t\t\t$return[] = $group['name'];\n\t\t}\n\t\tif(SecurityUtil::checkPermission('Owncloud::Admin', '::', ACCESS_MODERATE, $uid)) {\n\t\t\t$return[] = 'admin';\n\t\t}\n\t\treturn self::ret($return);\n\t}",
"public static function getGroups(): array\n {\n return ['user'];\n }",
"public function getUserGroups()\n {\n /** @var WebApplication|ConsoleApplication $this */\n return $this->get('userGroups');\n }",
"public function getGroups(){\n $groups = Group::get()->toArray();\n $groups_array = array();\n foreach($groups as $group){\n $groups_array[$group['id']]['group_name'] = $group['group_name'];\n $groups_array[$group['id']]['user_ids'] = explode(\",\",$group['user_ids']);\n }\n return $groups_array;\n }",
"public function get_groups(){\n $group_users = private_party_group_user::search()->where('uid', $this->uid)->exec();\n $merged_groups = array();\n foreach($group_users as $group_user){\n /* @var $group_user private_party_group_user */\n $groups = $group_user->get_groups();\n $merged_groups = array_merge($merged_groups, $groups);\n }\n return $merged_groups;\n }",
"public function getAllGroups(){\n // Get list\n $lists = array(); \n $data = Group::where('account_id', $this->getAccountId()) \n ->where('user_id', $this->user_id)\n ->get() \n ->toArray();\n $lists = $data;\n return $lists;\n }",
"public function getUserGroups()\n {\n $query = \"SELECT groupName FROM UserGroupAccess\";\n if(($result = $this->getQuery($query,true)) != NULL)\n {\n return $result;\n }\n else\n return false;\n }",
"public function getGroups() {\n\t\treturn $this->util->getDirectoriesInDirectory($this->cacheDir);\n\t}",
"public function getGroups() {\n\t\treturn array(\n\t\t\t'user_meta' => array(\n\t\t\t\t'type' => 'error',\n\t\t\t\t'message' => 'Usage of users/usermeta tables is highly discouraged in VIP context, For storing user additional user metadata, you should look at User Attributes.',\n\t\t\t\t'object_vars' => array(\n\t\t\t\t\t'$wpdb->users',\n\t\t\t\t\t'$wpdb->usermeta',\n\t\t\t\t),\n\t\t\t),\n\t\t\t'cache_constraints' => array(\n\t\t\t\t'type' => 'warning',\n\t\t\t\t'message' => 'Due to using Batcache, server side based client related logic will not work, use JS instead.',\n\t\t\t\t'variables' => array(\n\t\t\t\t\t'$_COOKIE',\n\t\t\t\t\t),\n\t\t\t\t'array_members' => array(\n\t\t\t\t\t'$_SERVER[\\'HTTP_USER_AGENT\\']',\n\t\t\t\t\t'$_SERVER[\\'REMOTE_ADDR\\']',\n\t\t\t\t),\n\t\t\t),\n\t\t);\n\t}",
"public function getGroupsListForUserLoginLog()\n\t{\n\t\t$db = Zend_Db_Table::getDefaultAdapter();\n\t\t$query = \"select g.id,g.group_name,(select count(*) from main_userloginlog where group_id = g.id) cnt\n from main_groups g where g.isactive = 1\";\n\t\t$result = $db->query($query);\n\t\t$group_arr = array();\n\t\twhile($row = $result->fetch())\n\t\t{\n\t\t\t$group_arr[$row['id']]['group_name'] = $row['group_name'];\n\t\t\t$group_arr[$row['id']]['cnt'] = $row['cnt'];\n\t\t}\n\n\t\treturn $group_arr;\n\t}",
"public static function GetList()\n {\n $groups_directory = System::GetDataPath() . 'groups';\n \n $dir_handle = opendir($groups_directory);\n $groups = array();\n\n while (($group_directory = readdir($dir_handle)) !== false)\n {\n if(!is_dir($groups_directory . '/' . $group_directory))\n continue;\n\n //just check directories inside and skip the guest user group\n if (strcmp($group_directory, '.') != 0 && strcmp($group_directory, '..') != 0 && strcmp($group_directory, 'guest') != 0)\n {\n $group_data = self::GetData($group_directory);\n\n $groups[] = $group_data;\n }\n }\n\n return $groups;\n }",
"public function groups()\n {\n $return = ['everyone'];\n\n $groups = GroupMember::where('user_id', $this->id())\n ->sort('`group` ASC')\n ->all();\n\n foreach ($groups as $group) {\n $return[] = $group->group;\n }\n\n return $return;\n }",
"static function getUserGroups(){\n \n }",
"public function getGroups()\n {\n if ($this->_oGroups == null && $sOxid = $this->getId()) {\n // usergroups\n $this->_oGroups = oxNew('oxlist', 'oxgroups');\n $sViewName = getViewName(\"oxgroups\", $this->getLanguage());\n $sSelect = \"select {$sViewName}.* from {$sViewName}, oxobject2group \";\n $sSelect .= \"where oxobject2group.oxobjectid='$sOxid' \";\n $sSelect .= \"and oxobject2group.oxgroupsid={$sViewName}.oxid \";\n $this->_oGroups->selectString($sSelect);\n }\n\n return $this->_oGroups;\n }",
"public function getSystemUserGroups()\n {\n $system_user_groups = array();\n \n // load the related System_user_group objects\n //Busca grupo para professor\n $system_user_system_user_groups = SystemGroup::where('name','like','%- Professor%')->load();\n if (isset($system_user_system_user_groups[0]))\n {\n $group_id = $system_user_system_user_groups[0];\n }\n $system_user_groups[] = new SystemGroup( $group_id->id );\n //var_dump($system_user_groups);\n return $system_user_groups;\n \n }",
"protected function _get_usergroup_list()\n {\n $results = $this->connection->query('SELECT gid,title FROM ' . $this->connection->get_table_prefix() . 'usergroups');\n $mod_results = array();\n foreach ($results as $key => $value) {\n $mod_results[] = array('group_id' => $value['gid'], 'group_name' => $value['title']);\n }\n $results2 = collapse_2d_complexity('group_id', 'group_name', $mod_results);\n return $results2;\n }",
"public function listGroups($user) {\n return $user->groups;\n }",
"public function listGroups()\n {\n\t\t$data = $this->call(array(), \"GET\", \"groups.json\");\n\t\t$data = $data->{'groups'};\n\t\t$groupArray = new ArrayObject();\n\t\tfor($i = 0; $i<count($data);$i++){\n\t\t\t$groupArray->append(new Group($data[$i], $this));\n\t\t}\n\t\treturn $groupArray;\n }",
"public function groups() : array\n {\n return $this->groups;\n }",
"public function groups() : array\n {\n return $this->groups;\n }",
"function _get_user_groups(){\r\n $groups = array();\r\n for($i=0; $i<get_sso_option('rules_number'); $i++){\r\n $rule = _get_rule($i);\r\n if($rule != FALSE){\r\n\t $is_group = _run_rule($rule['var'], $rule['regexp'], $rule['group']);\r\n\t if($is_group === TRUE) $groups[] = $rule['group'];\r\n }\r\n }\r\n return $groups;\r\n}",
"public function getUserGroupIds()\n\t{\n\t\treturn $this->user_group_ids;\n\t}"
] |
[
"0.7811674",
"0.7645229",
"0.7606774",
"0.75354856",
"0.750342",
"0.73998165",
"0.73911107",
"0.73485905",
"0.7231788",
"0.7219584",
"0.7073178",
"0.7031794",
"0.70197296",
"0.70110804",
"0.699981",
"0.6992379",
"0.6965181",
"0.6956397",
"0.6956076",
"0.6930042",
"0.68494403",
"0.68467706",
"0.6810666",
"0.68049634",
"0.679518",
"0.6779908",
"0.67602783",
"0.67602783",
"0.6733901",
"0.66909075"
] |
0.78920835
|
0
|
Returns whether the user has a set of fixed groups or can choose any. This is cached in the session.
|
function get_fixedgroups() {
if (!isset($_SESSION['fixedgroups']))
lgi_mysql_fetch_session("SELECT `fixedgroups` AS `fixedgroups` FROM %t(usercerts) WHERE `user`='%%'", $this->userid);
return (bool)$_SESSION['fixedgroups'];
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"private function userHasAccess()\n {\n $required_perm = $this->route['perm'];\n $user_group = $_SESSION['user_group'];\n if ($required_perm == 'all') {\n return true;\n } elseif ($user_group == $required_perm) {\n return true;\n }\n return false;\n }",
"public function allowed_group()\n\t{\n\t\t$which = func_get_args();\n\n\t\tif ( ! count($which))\n\t\t{\n\t\t\treturn FALSE;\n\t\t}\n\n\t\t// Super Admins always have access\n\t\tif (ee()->session->userdata('group_id') == 1)\n\t\t{\n\t\t\treturn TRUE;\n\t\t}\n\n\t\tforeach ($which as $w)\n\t\t{\n\t\t\t$k = ee()->session->userdata($w);\n\n\t\t\tif ( ! $k OR $k !== 'y')\n\t\t\t{\n\t\t\t\treturn FALSE;\n\t\t\t}\n\t\t}\n\n\t\treturn TRUE;\n\t}",
"public function isUserOrGroupSet() {}",
"public function hasGroups(){\n return $this->_has(3);\n }",
"public function hasGroups(){\n return $this->_has(1);\n }",
"public function allowed_group_any()\n\t{\n\t\t$which = func_get_args();\n\n\t\tif ( ! count($which))\n\t\t{\n\t\t\treturn FALSE;\n\t\t}\n\n\t\t// Super Admins always have access\n\t\tif (ee()->session->userdata('group_id') == 1)\n\t\t{\n\t\t\treturn TRUE;\n\t\t}\n\n\t\t$result = FALSE;\n\n\t\tforeach ($which as $w)\n\t\t{\n\t\t\t$k = ee()->session->userdata($w);\n\n\t\t\tif ($k === TRUE OR $k == 'y')\n\t\t\t{\n\t\t\t\t$result = TRUE;\n\t\t\t}\n\t\t}\n\n\t\treturn $result;\n\t}",
"function check_user_has_group($list) { $ar=explode(',', $list);\nforeach ($ar as $group) {\n $group=trim($group);\n if ( isset($_SESSION['groups'][$group]) && $_SESSION['groups'][$group]) {\nreturn true; return false;\n}} }",
"public function hasGroups(){\n return $this->_has(4);\n }",
"public function hasGroups(){\n return $this->_has(4);\n }",
"function isAuthorized_menu_fmks($strUsers, $strGroups, $UserName, $UserGroup) { \n // For security, start by assuming the visitor is NOT authorized. \n $isValid = False; \n\n // When a visitor has logged into this site, the Session variable MM_Username set equal to their username. \n // Therefore, we know that a user is NOT logged in if that Session variable is blank. \n if (!empty($UserName)) { \n // Besides being logged in, you may restrict access to only certain users based on an ID established when they login. \n // Parse the strings into arrays. \n $arrUsers = Explode(\",\", $strUsers); \n $arrGroups = Explode(\",\", $strGroups); \n if (in_array($UserName, $arrUsers)) { \n $isValid = true; \n } \n // Or, you may restrict access to only certain users based on their username. \n if (in_array($UserGroup, $arrGroups)) { \n $isValid = true; \n } \n if (($strUsers == \"\") && true) { \n $isValid = true; \n } \n } \n return $isValid; \n}",
"function isAuthorized_menu_fmks($strUsers, $strGroups, $UserName, $UserGroup) { \n // For security, start by assuming the visitor is NOT authorized. \n $isValid = False; \n\n // When a visitor has logged into this site, the Session variable MM_Username set equal to their username. \n // Therefore, we know that a user is NOT logged in if that Session variable is blank. \n if (!empty($UserName)) { \n // Besides being logged in, you may restrict access to only certain users based on an ID established when they login. \n // Parse the strings into arrays. \n $arrUsers = Explode(\",\", $strUsers); \n $arrGroups = Explode(\",\", $strGroups); \n if (in_array($UserName, $arrUsers)) { \n $isValid = true; \n } \n // Or, you may restrict access to only certain users based on their username. \n if (in_array($UserGroup, $arrGroups)) { \n $isValid = true; \n } \n if (($strUsers == \"\") && true) { \n $isValid = true; \n } \n } \n return $isValid; \n}",
"function isGroup( $userId, $groups )\n\t{\n\t\t$query = '(SELECT units1.alias AS unit,\n\t\t\t\t\t\tholders1.position,\n\t\t\t\t\t\tpositions1.category,\n\t\t\t\t\t\t(holders1.term = terms1.current_term) AS current\n\t\t\t\t FROM units units1, holders holders1, positions positions1, terms terms1\n\t\t\t\t WHERE holders1.userId = ?\n\t\t\t\t\tAND holders1.unitId = units1.id\n\t\t\t\t\tAND holders1.position = positions1.alias)\n\t\t\t\tUNION DISTINCT\n\t\t\t\t (SELECT units2.alias AS unit,\n\t\t\t\t\t\tpositions2.alias AS position,\n\t\t\t\t\t\tpositions2.category,\n\t\t\t\t\t\t(holders2.term = terms2.current_term) AS current\n\t\t\t\t FROM positions_rules r, holders holders2, positions positions2, units units2, terms terms2\n\t\t\t\t WHERE holders2.userId = ?\n\t\t\t\t\tAND holders2.unitId = r.ruler_unit\n\t\t\t\t\tAND holders2.position = r.ruler_position\n\t\t\t\t\tAND positions2.alias = r.ruled_position\n\t\t\t\t\tAND positions2.unitId = r.ruled_unit\n\t\t\t\t\tAND units2.id = r.ruled_unit)';\n\t\t$result = $this->_db->fetchAll( $query, array($userId, $userId) );\n\n\t\t// If the group is unset, give everyone who has ever held any position access\n\t\tif( !$groups )\n\t\t{\treturn !empty( $result );\n\t\t}\n\n\t\t// Otherwise, process the units\n\t\tforeach( $groups as $unit => $positions )\n\t\t{\n\t\t\tif( !$positions )\n\t\t\t{\tforeach( $result AS $row )\n\t\t\t\t{\tif( strtolower($row['unit']) == $unit )\n\t\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tforeach( $positions as $position => $terms )\n\t\t\t{\n\t\t\t\tif( !$terms )\n\t\t\t\t{\tforeach( $result AS $row )\n\t\t\t\t\t{\tif( strtolower($row['unit']) == $unit && ($row['position'] == $position || $row['category'] == $position))\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t}elseif( $terms == 'current' )\n\t\t\t\t{\tforeach( $result AS $row )\n\t\t\t\t\t{\tif( strtolower($row['unit']) == $unit && ($row['position'] == $position || $row['category'] == $position) && $row['current'])\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t}else\n\t\t\t\t{\t// Code should not get here\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}",
"function AdminSecurityCheck(){\n\t\t$User = new User();\n\t\t$user = $this->session->userdata('Group');\n\t\tif ($user){\n\t\t\tif($user == 1){\n\t\t\t\treturn true;\n\t\t\t}else{\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}else{\n\t\t\treturn false;\n\t\t}\n\t}",
"public function hasAllowedRole()\n {\n if ($this->isCurrentUser() || (! $this->isStaff())) {\n // Always allow editing of non-staff user\n // for the time being\n return true;\n }\n $dbLookup = $this->util->getDbLookup();\n $groups = $dbLookup->getActiveStaffGroups();\n $group = $this->getGroup();\n\n if (! isset($groups[$group])) {\n // Allow editing when the group does not exist or is no longer active.\n return true;\n }\n\n $allowedGroups = $this->userLoader->getCurrentUser()->getAllowedStaffGroups();\n if ($allowedGroups) {\n return (boolean) isset($allowedGroups[$this->getGroup()]);\n } else {\n return false;\n }\n }",
"public static function groupAllowed($conn, $group_id) \n { \n // TODO: Review this function, functionality has been changed\n static $groupAllowedCache;\n \n Ossim_db::check_connection($conn);\n \n $user = self::get_session_user();\n \n if (isset($groupAllowedCache[\"$user\"][\"$group_id\"])) \n {\n return $groupAllowedCache[\"$user\"][\"$group_id\"];\n }\n \n $networks = Net_group::get_networks($conn, $group_id);\n \n if (empty($networks))\n {\n $groupAllowedCache[\"$user\"][\"$group_id\"] = FALSE;\n \n return FALSE;\n }\n else\n {\n $groupAllowedCache[\"$user\"][\"$group_id\"] = TRUE;\n \n return TRUE;\n }\n }",
"public function userCanSubmit() {\n\t\tglobal $content_isAdmin;\n\t\tif (!is_object(icms::$user)) return false;\n\t\tif ($content_isAdmin) return true;\n\t\t$user_groups = icms::$user->getGroups();\n\t\t$module = icms::handler(\"icms_module\")->getByDirname(basename(dirname(dirname(__FILE__))), TRUE);\n\t\treturn count(array_intersect($module->config['poster_groups'], $user_groups)) > 0;\n\t}",
"public function isAccessible() {\n\t\treturn UserGroup::isAccessibleGroup(array($this->groupID));\n\t}",
"function isAuthorized_menu($strUsers, $strGroups, $UserName, $UserGroup) { \n // For security, start by assuming the visitor is NOT authorized. \n $isValid = False; \n\n // When a visitor has logged into this site, the Session variable MM_Username set equal to their username. \n // Therefore, we know that a user is NOT logged in if that Session variable is blank. \n if (!empty($UserName)) { \n // Besides being logged in, you may restrict access to only certain users based on an ID established when they login. \n // Parse the strings into arrays. \n $arrUsers = Explode(\",\", $strUsers); \n $arrGroups = Explode(\",\", $strGroups); \n if (in_array($UserName, $arrUsers)) { \n $isValid = true; \n } \n // Or, you may restrict access to only certain users based on their username. \n if (in_array($UserGroup, $arrGroups)) { \n $isValid = true; \n } \n if (($strUsers == \"\") && true) { \n $isValid = true; \n } \n } \n return $isValid; \n}",
"function check ($groups=NULL)\n\t{\n\t\t//header ('Location: index_alpha.php');\n\t\t//echo //\"hello\";\n\t\tglobal $xnyo_parent;\n\n\t\t// no groups? bleh, guess they can go in\n\t\tif (is_null($groups) || empty($groups))\n\t\t\treturn true;\n\n\t\t// a string? split it into the array\n\t\tif (!is_array($groups))\n\t\t\t$groups = explode(\",\", preg_replace('/\\s/', '', $groups));\n\n\t\t// If not allowed to be logged in\n\t\tif (in_array('none', $groups))\n\t\t\tif (!empty($xnyo_parent->user->username))\n\t\t\t\treturn false;\n\t\t\telse\n\t\t\t\treturn true;\n\t\t\n\t\t// guess we have to be logged in then hey\n\t\t//if (empty($xnyo_parent->user->user)) {\t//\tfuck\t\t\t\t\n\t\tif (empty($xnyo_parent->user['user'])) {\t\t\n\t\t\treturn false;\n\t\t}\n\t\t\n\t\t//print_r($groups);\n\t\t//echo \"HELLO<br>\";\n\t\t// required to be logged in, and they are\n\t\tif (in_array('required', $groups) || in_array('all', $groups))\n\t\t\treturn true;\n\n\t\t// ok, cycle the list\n\t\tforeach ($groups as $group) {\n\n\t\t\t// if its their username, fire away\n\t\t\tif (strtoupper($group) == strtoupper($_SESSION['auth']['user']))\n\t\t\t\treturn true;\n\n\t\t\tif (is_array($_SESSION['auth']['groups']))\n\t\t\t{\n\t\t\t\t// make the group into a regexp\n\t\t\t\t$group = preg_replace(\"/\\*/\", \".*?\", $group);\n\t\t\t\t$group = preg_replace(\"/([\\@\\(\\)\\|\\[\\]])/\", \"\\\\\\\\\\\\1\", $group);\n\n\t\t\t\t// see if our regexp matches a current group\n\t\t\t\tforeach ($_SESSION['auth']['groups'] as $var)\n\t\t\t\t\tif (preg_match(\"/$group/i\", $var))\n\t\t\t\t\t\treturn true;\n\n\t\t\t}\n\t\t}\n\n\t\t// guess they arent allowed in hey\n\t\treturn false;\n\n\t}",
"public function hasGroup()\n {\n return $this->_has('_group');\n }",
"public function hasGroup()\n {\n return isset($this->arrConfig['group']);\n }",
"function checkActionPermissionGroup($permittedGroups) {\n if (is_array($permittedGroups) && count($permittedGroups) > 0) {\n foreach ($permittedGroups as $groupId => $allowed) {\n if ($allowed && $groupId == -2) {\n return TRUE;\n } elseif ($allowed && $this->authUser->inGroup($groupId)) {\n return TRUE;\n }\n }\n }\n return FALSE;\n }",
"public function isAuthorized() {\n\t\t$UserDN = $this->getDistinguishedName($this->Username);\n\t\t$GroupMemberships = $this->getGroups($UserDN);\n\t\tforeach($this->Groups as $Group) {\n\t\t\tif(in_array($this->getDistinguishedName($Group), $GroupMemberships)) {\n\t\t\t/*\n\t\t\t* If any Group the User is a Member of matches the Allowed groups -> Authorization success.\n\t\t\t*/\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\t/*\n\t\t* This only happens when no Groupmembership matches the Allowed groups -> Authorization failed.\n\t\t*/\n\t\treturn false;\n\t}",
"public function exists() {\n\t\t$exists = (bool)$this->conf['GROUPS'];\n\n\t\treturn $exists;\n\t}",
"function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) { \r\n // For security, start by assuming the visitor is NOT authorized. \r\n $isValid = False; \r\n\r\n // When a visitor has logged into this site, the Session variable rfp_MM_Username set equal to their username. \r\n // Therefore, we know that a user is NOT logged in if that Session variable is blank. \r\n if (!empty($UserName)) { \r\n // Besides being logged in, you may restrict access to only certain users based on an ID established when they login. \r\n // Parse the strings into arrays. \r\n $arrUsers = Explode(\",\", $strUsers); \r\n $arrGroups = Explode(\",\", $strGroups); \r\n if (in_array($UserName, $arrUsers)) { \r\n $isValid = true; \r\n } \r\n // Or, you may restrict access to only certain users based on their username. \r\n if (in_array($UserGroup, $arrGroups)) { \r\n $isValid = true; \r\n } \r\n if (($strUsers == \"\") && true) { \r\n $isValid = true; \r\n } \r\n } \r\n return $isValid; \r\n}",
"public function isMenu() {\n\t\t$groupId = $this->Session->read('UserAuth.User.user_group_id');\n\t\t\n\t\tApp::import(\"Model\", \"Usermgmt.UserGroupPermission\"); \n\t\t$model = new UserGroupPermission(); \n\t\t$dados = $model->find(\"all\", array(\n\t\t\t'conditions'=>array('UserGroupPermission.user_group_id'=>$groupId,'UserGroupPermission.allowed'=>1),\n\t\t\t'fields' => array('UserGroupPermission.controller', 'UserGroupPermission.action')\n\t\t)); \n\t\t\n\t\treturn $dados;\n\t}",
"function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) { \r\n // For security, start by assuming the visitor is NOT authorized. \r\n $isValid = False; \r\n\r\n // When a visitor has logged into this site, the Session variable MM_Username set equal to their username. \r\n // Therefore, we know that a user is NOT logged in if that Session variable is blank. \r\n if (!empty($UserName)) { \r\n // Besides being logged in, you may restrict access to only certain users based on an ID established when they login. \r\n // Parse the strings into arrays. \r\n $arrUsers = Explode(\",\", $strUsers); \r\n $arrGroups = Explode(\",\", $strGroups); \r\n if (in_array($UserName, $arrUsers)) { \r\n $isValid = true; \r\n } \r\n // Or, you may restrict access to only certain users based on their username. \r\n if (in_array($UserGroup, $arrGroups)) { \r\n $isValid = true; \r\n } \r\n if (($strUsers == \"\") && true) { \r\n $isValid = true; \r\n } \r\n } \r\n return $isValid; \r\n}",
"function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) { \r\n // For security, start by assuming the visitor is NOT authorized. \r\n $isValid = False; \r\n\r\n // When a visitor has logged into this site, the Session variable MM_Username set equal to their username. \r\n // Therefore, we know that a user is NOT logged in if that Session variable is blank. \r\n if (!empty($UserName)) { \r\n // Besides being logged in, you may restrict access to only certain users based on an ID established when they login. \r\n // Parse the strings into arrays. \r\n $arrUsers = Explode(\",\", $strUsers); \r\n $arrGroups = Explode(\",\", $strGroups); \r\n if (in_array($UserName, $arrUsers)) { \r\n $isValid = true; \r\n } \r\n // Or, you may restrict access to only certain users based on their username. \r\n if (in_array($UserGroup, $arrGroups)) { \r\n $isValid = true; \r\n } \r\n if (($strUsers == \"\") && true) { \r\n $isValid = true; \r\n } \r\n } \r\n return $isValid; \r\n}",
"function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) { \r\n // For security, start by assuming the visitor is NOT authorized. \r\n $isValid = False; \r\n\r\n // When a visitor has logged into this site, the Session variable MM_Username set equal to their username. \r\n // Therefore, we know that a user is NOT logged in if that Session variable is blank. \r\n if (!empty($UserName)) { \r\n // Besides being logged in, you may restrict access to only certain users based on an ID established when they login. \r\n // Parse the strings into arrays. \r\n $arrUsers = Explode(\",\", $strUsers); \r\n $arrGroups = Explode(\",\", $strGroups); \r\n if (in_array($UserName, $arrUsers)) { \r\n $isValid = true; \r\n } \r\n // Or, you may restrict access to only certain users based on their username. \r\n if (in_array($UserGroup, $arrGroups)) { \r\n $isValid = true; \r\n } \r\n if (($strUsers == \"\") && true) { \r\n $isValid = true; \r\n } \r\n } \r\n return $isValid; \r\n}",
"function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) { \r\n // For security, start by assuming the visitor is NOT authorized. \r\n $isValid = False; \r\n\r\n // When a visitor has logged into this site, the Session variable MM_Username set equal to their username. \r\n // Therefore, we know that a user is NOT logged in if that Session variable is blank. \r\n if (!empty($UserName)) { \r\n // Besides being logged in, you may restrict access to only certain users based on an ID established when they login. \r\n // Parse the strings into arrays. \r\n $arrUsers = Explode(\",\", $strUsers); \r\n $arrGroups = Explode(\",\", $strGroups); \r\n if (in_array($UserName, $arrUsers)) { \r\n $isValid = true; \r\n } \r\n // Or, you may restrict access to only certain users based on their username. \r\n if (in_array($UserGroup, $arrGroups)) { \r\n $isValid = true; \r\n } \r\n if (($strUsers == \"\") && true) { \r\n $isValid = true; \r\n } \r\n } \r\n return $isValid; \r\n}"
] |
[
"0.7027887",
"0.68472964",
"0.6787906",
"0.6720866",
"0.66698563",
"0.66224974",
"0.6585423",
"0.6558352",
"0.6558352",
"0.6496834",
"0.6496834",
"0.63555926",
"0.63314337",
"0.63291544",
"0.6299951",
"0.6237624",
"0.6232342",
"0.6210802",
"0.6193716",
"0.61904997",
"0.6156011",
"0.60989976",
"0.6055722",
"0.6041281",
"0.603885",
"0.6034297",
"0.5991079",
"0.5991079",
"0.5991079",
"0.5991079"
] |
0.7816075
|
0
|
Returns the user's current group
|
function get_cur_group() {
if (!isset($_SESSION['dfl_group'])) {
// return comma-separated list of default groups from database
lgi_mysql_fetch_session("SELECT GROUP_CONCAT(`name`) AS `dfl_group` FROM %t(usergroups) AS p, %t(usercerts) AS c WHERE p.`usercertid`=c.`id` AND c.`user`='%%' AND p.`dfl`=TRUE", $this->userid);
// maybe there were no groups defined and it is not specified in the certificate; then use username
// TODO this will work only if usercerts.fixedgroups if TRUE, but I'm too lame to check that right now
if (!isset($_SESSION['dfl_group']))
$_SESSION['dfl_group'] = $this->userid;
}
return $_SESSION['dfl_group'];
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function getGroup()\n {\n return $this->_getVar('user_group');\n }",
"private function getUserGroup()\n {\n if (null !== $token = $this->tokenStorage->getToken()) {\n /** @var \\Ekyna\\Bundle\\UserBundle\\Model\\UserInterface $user */\n if (null !== $user = $token->getUser()) {\n return $user->getGroup();\n }\n }\n return null;\n }",
"private function getUserGroup(): int {\n return $this->core->getUser()->getGroup();\n }",
"public function getUsergroup() {}",
"protected function GetGroup() {\r\n\t\t\treturn $this->group;\r\n\t\t}",
"public function group()\n\t{\n\t\t$group = \\Hubzero\\User\\Group::getInstance($this->get('owned_by_group'));\n\t\tif (!$group)\n\t\t{\n\t\t\t$group = new \\Hubzero\\User\\Group;\n\t\t}\n\t\treturn $group;\n\t}",
"public function currentGroup();",
"function user_getgroup()\n\t{\n\t\t$id = $this->user_getid();\n\t\t$perms = $this->DB->database_select('users', 'gid', array('uid' => $id), 1);\n\t\treturn ($perms === false) ? false : $perms['gid'];\n\t}",
"public function getGroup()\n {\n return $this->group;\n }",
"public function getGroup()\n {\n return $this->group;\n }",
"public function getGroup()\n {\n return $this->group;\n }",
"public function getGroup()\n {\n return $this->group;\n }",
"public function getGroup()\n {\n return $this->group;\n }",
"public function getGroup()\n {\n return $this->group;\n }",
"public function getGroup() {\n return $this->group;\n }",
"public function getGroup()\n\t{\n\t return $this->groupService->getGroup($this->ownerid);\n\t}",
"public static function getCurrentUserGroups()\n {\n return self::getUserGroups();\n }",
"public function getGroup() {\n\t\t$ids = $this->getGroupIds();\n\t\treturn MessageGroups::getGroup( $ids[0] );\n\t}",
"public function getGroup()\n {\n //Note: group parts are not \"named\" so it's all or nothing\n return $this->_get('_group');\n }",
"public function getGroupId() {\n\t\treturn $this->Session->read('UserAuth.User.user_group_id');\n\t}",
"public static function getGroup(){\n\t\treturn FW_DAO_UserGroup::getInstance();\n\t}",
"public static function group()\n {\n return static::$group;\n }",
"public static function group()\n {\n return static::$group;\n }",
"private function getGroupID()\n {\n if (App::auth()->loggedIn() === false)\n {\n return -1;\n }\n \n return (int) App::auth()->user()->groupID;\n }",
"public function getgroupId()\n {\n return $this->group_id;\n }",
"public function getGroup() {\n \tif(count($this->groups))\n \t return $this->groups[0]->getName();\n \telse\n \t return null;\n }",
"public function getDefaultGroup()\n {\n return $this->defaultGroup;\n }",
"public function getUserGroup() {\n $c = $this->modx->newQuery('modUserGroup');\n $c->select($this->modx->getSelectColumns('modUserGroup','modUserGroup'));\n $c->select($this->modx->getSelectColumns('disUserGroupProfile','Profile','',array(\n 'post_based',\n 'min_posts',\n 'color',\n 'image',\n )));\n $c->leftJoin('disUserGroupProfile','Profile','modUserGroup.id = Profile.usergroup');\n $c->where(array(\n 'modUserGroup.id' => $this->scriptProperties['id'],\n ));\n /** @var modUserGroup $userGroup */\n $userGroup = $this->modx->getObject('modUserGroup',$c);\n if (empty($userGroup)) return false;\n\n $this->userGroupArray = $userGroup->toArray();\n return $this->userGroup;\n }",
"public function getGroup()\n {\n $this->getParam('group');\n }",
"function group()\r\n {\r\n $group = false;\r\n\r\n if ( $this->GroupID > 0 )\r\n {\r\n $group = new eZUserGroup( $this->GroupID );\r\n }\r\n\r\n return $group;\r\n }"
] |
[
"0.82793844",
"0.7987553",
"0.7748155",
"0.754359",
"0.74784243",
"0.7423361",
"0.7394486",
"0.73592705",
"0.7294595",
"0.7294595",
"0.7294595",
"0.7294595",
"0.7294595",
"0.7294595",
"0.7254326",
"0.72191596",
"0.7179667",
"0.71752506",
"0.7166884",
"0.71402174",
"0.71249324",
"0.7104542",
"0.7104542",
"0.6985726",
"0.6981335",
"0.69658947",
"0.68119097",
"0.67901367",
"0.67895687",
"0.67879665"
] |
0.81231874
|
1
|
Sets the user's current group
|
function set_cur_group($group) {
lgi_mysql_query("UPDATE %t(usergroups) SET `dfl`=(`name`='%%') WHERE `usercertid`=(SELECT `id` FROM %t(usercerts) WHERE `user`='%%')", $group, $this->userid);
$_SESSION['dfl_group'] = $group;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function setGroup( $group )\r\n {\r\n if ( is_a( $group, \"eZUserGroup\" ) )\r\n {\r\n $this->GroupID = $group->id();\r\n }\r\n else if ( is_numeric( $group ) )\r\n {\r\n $this->GroupID = $group;\r\n }\r\n }",
"final public function setGroup($value) {\n\t\t$this->group = $value;\n\t}",
"public function setGroup($userId, $group) {\n $user = $this->get($userId, false);\n if (empty($user)) return 'Invalid user id.';\n \n $this->clearCache($userId);\n $this->db->update(array('_id' => $this->_toMongoId($userId)),\n array('$set' => array('group' => (string) $group)));\n \n // We need to permeate an active session!\n $key = 'hts_user_' . $user['username'];\n if (apc_exists($key)) {\n Session::setExternalVars(apc_fetch($key), array('group' => (string) $group));\n }\n }",
"public function set_group($group) {\n $this->group = $group;\n }",
"public function set_new_group($user_id, $course_id) {\n App::uses('CakeSession', 'Model/Datasource');\n $user = $this->user_group($user_id, $course_id);\n // If present, set group_id to session\n if ( !empty($user['Group']) ) {\n CakeSession::write('User.group_id', $user['Group']['id']);\n } else {\n // No Group assigned to user in current course.\n // Delete group_id from session, so no old values remain.\n CakeSession::delete('User.group_id');\n }\n }",
"public function set_default(): void\n {\n if (!userHasPermission(Permission\\Groups\\SetDefault::class)) {\n show404();\n }\n\n /** @var Uri $oUri */\n $oUri = Factory::service('Uri');\n /** @var Group $oUserGroupModel */\n $oUserGroupModel = Factory::model('UserGroup', Constants::MODULE_SLUG);\n\n if ($oUserGroupModel->setAsDefault($oUri->segment(5))) {\n $this->oUserFeedback->success(\n 'Group set as default successfully.'\n );\n } else {\n $this->oUserFeedback->error(\n 'Failed to set default user group. ' . $oUserGroupModel->lastError()\n );\n }\n\n redirect(self::url());\n }",
"public function setGroup($group) {}",
"public function setGroup($group) {}",
"public function setUserGroup($groupId);",
"function setUserGroupAdmin( $value )\n {\n $this->UserGroupAdmin = $value;\n }",
"public function changeUserGroup()\n {\n $userId = $this->request->variable('user_id',0);\n $groupId = $this->request->variable('group_id',9999);\n\n if($userId === 0 || $groupId === 9999)\n {\n $this->sendResponse([\n 'status' => 'failed',\n 'message' => 'Invalid data supplied',\n 'error' => ['User ID was not supplied']\n ]);\n }\n\n /**\n * Group IDs\n * 5 - ADMIN\n * 4 - GLOBAL MOD\n * 2 - REGISTERED\n */\n $arrGroups = group_memberships(false, [$userId]);\n\n $arrCurrentGroupIds = [];\n\n // Get the user's current groups\n foreach($arrGroups as $group)\n {\n $arrCurrentGroupIds[$group['group_id']] = $group['group_id'];\n }\n\n // If the new group is 'registered user' we need to remove the user from\n // any admin or moderator groups they were previously in\n if($groupId < 4)\n {\n // User was an admin - remove them from the admin group\n if(in_array(5,$arrCurrentGroupIds))\n {\n group_user_del(5,[$userId]);\n }\n\n // User was a global mod - remove them from the global mod group\n if(in_array(4,$arrCurrentGroupIds))\n {\n group_user_del(4,[$userId]);\n }\n }\n\n // If the user is being made an admin, make sure they are a global mod too\n if($groupId == 5 AND !in_array(4,$arrCurrentGroupIds))\n {\n group_user_add(4, [$userId],false, false, false);\n }\n\n // User could already have the group they need if they are\n // being downgraded. Check if they have the group and\n // if not, add them. If they were, then make it the default\n if(!in_array($groupId,$arrCurrentGroupIds))\n {\n group_user_add($groupId, [$userId],false, false, true);\n }\n else\n {\n group_set_user_default($groupId,[$userId]);\n }\n\n // Send success response\n $this->sendResponse([\n 'status' => 'success',\n 'message' => 'phpBB user\\'s group was updated',\n 'data' => [\n 'user_id' => $userId,\n 'group_id' => $groupId\n ]\n ]);\n }",
"public function setGroup($group) {\n $this->group = $group;\n }",
"function setModerator( $group )\r\n {\r\n if ( is_a( $group, \"eZUserGroup\" ) )\r\n {\r\n $this->ModeratorID = $group->id();\r\n }\r\n else if ( is_numeric( $group ) )\r\n {\r\n $this->ModeratorID = $group;\r\n }\r\n }",
"function set_groups($groups) {\n\t\tif ($this->get_fixedgroups())\n\t\t\tthrow new LGIPortalException(\"Cannot change groups for this user, certificate does not allow it.\");\n\t\tlgi_mysql_query(\"DELETE FROM %t(usergroups) WHERE `usercertid`=(SELECT `id` FROM %t(usercerts) WHERE `user`='%%')\", $this->userid);\n\t\tforeach ($groups as $g)\n\t\t\tlgi_mysql_query(\"INSERT INTO %t(usergroups) SET `usercertid`=(SELECT `id` FROM %t(usercerts) WHERE `user`='%%'), `name`='%%'\", $this->userid, $g);\n\t\t$_SESSION['groups'] = implode(',', $groups);\n\t}",
"function updateGroup() {\n\t\t$groupId = Request::getUserVar('groupId') === null? null : (int) Request::getUserVar('groupId');\n\t\tif ($groupId === null) {\n\t\t\t$this->validate();\n\t\t\t$group = null;\n\t\t} else {\n\t\t\t$this->validate($groupId);\n\t\t\t$group =& $this->group;\n\t\t}\n\t\t$this->setupTemplate($group);\n\n\t\timport('classes.manager.form.GroupForm');\n\n\t\t$groupForm = new GroupForm($group);\n\t\t$groupForm->readInputData();\n\n\t\tif ($groupForm->validate()) {\n\t\t\t$groupForm->execute();\n\t\t\tRequest::redirect(null, null, 'groups');\n\t\t} else {\n\n\t\t\t$templateMgr =& TemplateManager::getManager();\n\t\t\t$templateMgr->append('pageHierarchy', array(Request::url(null, 'manager', 'groups'), 'manager.groups'));\n\n\t\t\t$templateMgr->assign('pageTitle',\n\t\t\t\t$group?\n\t\t\t\t\t'manager.groups.editTitle':\n\t\t\t\t\t'manager.groups.createTitle'\n\t\t\t);\n\n\t\t\t$groupForm->display();\n\t\t}\n\t}",
"function set_userGroup($data, $oldId){\n $data_user = array();\n $data_group = array();\n $data_user['id'] = $data['id'];\n $data_user['username'] = $data['username'];\n $data_user['password'] = $data['password'];\n $data_user['email'] = $data['email'];\n\n $group = $data['group'];\n $data['group'] = selectRecord(TAB_GROUPS, \"role = '$group'\")['id'];\n $data_group['userId'] = $data['id'];\n $data_group['groupId'] = $data['group'];\n\n updateRecord(TAB_USR_ROLE, $data_group, \"userId = $oldId\");\n updateRecord(TAB_USERS, $data_user, \"id = $oldId\");\n $data_info = array();\n if($data['group'] == 1){\n $data_info = array();\n $data_info['employment'] = \"-\";\n $data_info['img_address'] = \"upload/user/user-default.png\";\n $data_info['user'] = $data['id'];\n insertRecord(TAB_PERSONALINFO, $data_info);\n }\n}",
"public function setDefaultGroup(string $defaultGroup): void;",
"public function update() {\n\t\t$data = array(\n\t\t\t'tstamp' => $this['timeStamp'],\n\t\t\t'crdate' => $this['createDate'],\n\t\t\t'cruser_id' => $this['cruserUid'],\n\t\t\t'name' => $this['name'],\n\t\t);\n\t\t$res = $GLOBALS['TYPO3_DB']->exec_UPDATEquery(\n\t\t\t'tx_passwordmgr_group',\n\t\t\t'uid=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($this['uid'],'tx_passwordmgr_group'),\n\t\t\t$data\n\t\t);\n\t\t$this->checkAffectedRows('updateGroup', 1);\n\t\ttx_passwordmgr_helper::addLogEntry(1, 'updateGroup', 'Update group '.$data['name'].' uid '.$this['uid']);\n\t}",
"public function refreshGroupSettings()\n {\n $group = $this->currentUser->getGroup();\n if ($group instanceof \\Gems\\User\\Group) {\n $group->applyGroupToModel($this, false);\n }\n }",
"function make_all_group_leaders_in_a_group () {\n if ( current_user_can ( 'group_leader' ) ) {\n $user_ID = get_current_user_id ();\n update_user_meta ( $user_ID, 'learndash_group_users_2186', '2186' );\n }\n}",
"function setGroupID( $groupID ) \n {\n $this->setValueByFieldName( 'navbargroup_id', $groupID);\n }",
"public function setRegionGroup(?CloudPcRegionGroup $value): void {\n $this->getBackingStore()->set('regionGroup', $value);\n }",
"public function setLoggedUser(){\n\t\tif(isset($_SESSION['ccUser']) && !empty($_SESSION['ccUser'])){\n\t\t\t$id = $_SESSION['ccUser'];\n\n\t\t\t$sql = $this->db->prepare(\"SELECT * FROM users WHERE id = :id\");\n\t\t\t$sql->bindValue(':id', $id);\n\t\t\t$sql->execute();\n\n\t\t\tif($sql->rowCount() > 0){\n\t\t\t\t$this->userInfo = $sql->fetch();\n\t\t\t\t$this->permissions = new Permissions();\n\t\t\t\t$this->permissions->setGroup($this->userInfo['id_group']);\n\t\t\t}\n\t\t}\n\t}",
"public function setLoggedUser(){\n\t\tif(isset($_SESSION['ccUser']) && !empty($_SESSION['ccUser'])){\n\t\t\t$id = $_SESSION['ccUser'];\n\n\t\t\t$sql = $this->db->prepare(\"SELECT * FROM users WHERE id = :id\");\n\t\t\t$sql->bindValue(':id', $id);\n\t\t\t$sql->execute();\n\n\t\t\tif($sql->rowCount() > 0){\n\t\t\t\t$this->userInfo = $sql->fetch();\n\t\t\t\t$this->permissions = new Permissions();\n\t\t\t\t$this->permissions->setGroup($this->userInfo['id_group']);\n\t\t\t}\n\t\t}\n\t}",
"public function getUsergroup() {}",
"public function SetGroup($group,$value){\n if($this->_groups[$group][\"currentGroup\"]!=$value){\n if($this->_groups[$group][\"currentGroup\"]!=\"?\"){\n if(isset($this->_groups[$group][\"afterGroup\"])){\n $this->Ln(4);\n $function = array($this->_groups[$group][\"afterGroup\"][\"class\"],$this->_groups[$group][\"afterGroup\"][\"callback\"]);\n $params = array($this,$value);\n call_user_func_array($function,$params);\n }\n $this->Sum();\n }\n if(isset($this->_groups[$group][\"beforeGroup\"])){\n if(($this->GetY() + 22) > ($this->h - 10)){ //22 Altura de una cabecera de grupo\n $this->_changePage = false;\n $this->AddPage();\n }\n $this->Ln(6);\n $this->SetTextColor(100);\n $this->SetFont('Arial','B',11);\n $function = array($this->_groups[$group][\"beforeGroup\"][\"class\"],$this->_groups[$group][\"beforeGroup\"][\"callback\"]);\n $params = array($this,$value);\n $this->_groups[$group][\"currentMsg\"] = call_user_func_array($function,$params);\n $this->Ln(4);\n }\n $this->_groups[$group][\"currentGroup\"] = $value;\n $this->pages[$this->PageNo()] = str_replace(\"{grp_$group}\",$this->_groups[$group][\"currentMsg\"],$this->pages[$this->PageNo()]);\n $this->__Header();\n $this->_changePage = false;\n $this->SumRe();\n }else{\n $this->_changePage = true;\n }\n }",
"public static function setUserGroups($groups = array())\n {\n self::$userGroups = $groups;\n }",
"public function defineGroup(?RouteGroups $group = null): void\n {\n $this->currentGroup = $group;\n }",
"public function currentGroup();",
"function set_current_group($courseid, $groupid) {\n global $SESSION;\n return $SESSION->currentgroup[$courseid] = $groupid;\n}"
] |
[
"0.7004378",
"0.7002371",
"0.6969193",
"0.6648605",
"0.65929157",
"0.6562774",
"0.6428268",
"0.64272016",
"0.6405396",
"0.63281244",
"0.6280852",
"0.62547666",
"0.62267125",
"0.62229794",
"0.6190306",
"0.6161342",
"0.6151602",
"0.6099979",
"0.6090076",
"0.6085804",
"0.608226",
"0.60700244",
"0.60644317",
"0.60644317",
"0.6038251",
"0.60324025",
"0.600122",
"0.5987114",
"0.59527034",
"0.5952661"
] |
0.75056934
|
0
|
Returns the user's current project
|
function get_cur_project() {
if (!isset($_SESSION['dfl_project'])) {
lgi_mysql_fetch_session("SELECT `dfl_project` AS `dfl_project` FROM %t(users) WHERE `name`='%%'", $this->userid);
// if not set, return first project found
if (!isset($_SESSION['dfl_project']))
lgi_mysql_fetch_session("SELECT `name` AS `dfl_project` FROM %t(userprojects) AS p, %t(usercerts) AS c WHERE p.`usercertid`=c.`id` AND c.`user`='%%' LIMIT 1", $this->userid);
if (!isset($_SESSION['dfl_project']))
throw new LGIPortalException("No LGI projects for user: check certificate.");
}
return $_SESSION['dfl_project'];
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function getProject()\r\n {\r\n return $this->_params['project'];\r\n }",
"public static function project()\n {\n return self::context()->project();\n }",
"public function getProject() {\n return ProjectManager::getActiveProject();\n }",
"public function getProject()\n {\n return $this->project;\n }",
"public function getProject()\n {\n return $this->project;\n }",
"public function getProject()\n {\n return $this->project;\n }",
"public function getProject() {\n\t\treturn $this->project;\n\t}",
"public function get_project(){\n if ( $this->project != NULL){\n $myProject= new Project();\n return $myProject->get_by_ID($this->project);\n }\n }",
"private function getProject()\n {\n $url = $this->base_uri.\"project/\".$this->project;\n $project = $this->request($url);\n return $project;\n }",
"public function getProject();",
"public function getProject() {\n\t\tif ($this->_project === null) {\n\t\t\t$this->analyzeURL();\n\t\t}\n\t\treturn $this->_project;\n\t}",
"public static function getAssignedProject()\n {\n $res_des = Auth::user()->designation;\n $res_id = Auth::user()->id;\n $current_team_id = \"\";\n $result_project = \"\";\n\n if ($res_des == 'Developer' || $res_des == 'Project Manager') {\n\t\t\t// Get Team that current user has been assigned to\n $result_teams = DB::table('dev_team')->where('user_id', '=', $res_id)->get();\n\n foreach ($result_teams as $result_team) {\n $current_team_id = $result_team->team_id;\n }\n\n\t\t\t// Get Project that the Team has been assigned to\n $result_project_ids = DB::table('assign_teams')->where('team_id', '=', $current_team_id)->get();\n\n foreach ($result_project_ids as $result_project_id) {\n $result_projectID = $result_project_id->ProjectID;\n }\n\n }\n\n return $result_projectID;\n }",
"protected function getCurrentStatusProject()\n {\n $status = 'all';\n $request = $this->getRequest();\n $user = $this->getUser(); \n \n if($request->hasParameter('status'))\n {\n $status = $request->getParameter('status');\n $user->setAttribute('status', $status, 'project/list');\n }\n elseif($user->hasAttribute('status', 'project/list'))\n {\n $status = $user->getAttribute('status', $status, 'project/list');\n }\n \n return $status;\n\n }",
"public function getProject()\n\t{\n\t\tif (!$this->projectId)\n\t\t{\n\t\t\treturn null;\n\t\t}\n\n\t\t$query = $this->db->getQuery(true);\n\t\t$query->select('id, name, alias, description, url, logo, logo_alt, issue_template')\n\t\t\t->from('#__monitor_projects')\n\t\t->where(\"id = \" . $query->q($this->projectId));\n\n\t\t$this->db->setQuery($query);\n\n\t\treturn $this->db->loadObject();\n\t}",
"public static function currentUser() {\n global $user;\n\n return $user;\n }",
"public function getProjectName() : string\n {\n return $this->projectName;\n }",
"public function getTskProject()\n {\n return $this->tsk_project;\n }",
"protected function getRequestedProject()\n {\n $id = $this->getEvent()->getRouteMatch()->getParam('project');\n $p4Admin = $this->getServiceLocator()->get('p4_admin');\n\n // attempt to retrieve the specified project\n // translate invalid/missing id's into a 404\n try {\n return Project::fetch($id, $p4Admin);\n } catch (NotFoundException $e) {\n } catch (\\InvalidArgumentException $e) {\n }\n\n $this->getResponse()->setStatusCode(404);\n return false;\n }",
"protected function getRequestedProject()\n {\n $id = $this->getEvent()->getRouteMatch()->getParam('project');\n $p4Admin = $this->getServiceLocator()->get('p4_admin');\n\n // attempt to retrieve the specified project\n // translate invalid/missing id's into a 404\n try {\n return Project::fetch($id, $p4Admin);\n } catch (NotFoundException $e) {\n } catch (\\InvalidArgumentException $e) {\n }\n\n $this->getResponse()->setStatusCode(404);\n return false;\n }",
"public function getIdProject()\n {\n return $this->idProject;\n }",
"public function getProjectTItle() {\n $project = \"Yii2\";\n return $project;\n }",
"public function getProjectId()\n {\n return $this->project_id;\n }",
"public function getProjectId()\n {\n return $this->project_id;\n }",
"public function getProjectId()\n {\n return $this->project_id;\n }",
"public function get_current_user()\n\t{\n\t\treturn $this->current_user;\n\t}",
"function get_projects( $user )\n {\n //Unimplemented\n }",
"public function get_current_user(){\n $username = $this->session->userdata['logged_in']['username'];\n return $user_id = $this->research_model->current_user($username);\n }",
"public static function currentUser()\n {\n return wp_get_current_user();\n }",
"public function getProjectId(): string\n {\n return $this->_projectId;\n }",
"public function getFirstProject() {\n if ($this->countProjects() > 0) {\n $projects = ProjectManager::getProjects();\n return $projects[0];\n }\n\n return null;\n }"
] |
[
"0.79913706",
"0.77805257",
"0.76155525",
"0.7541076",
"0.7541076",
"0.7541076",
"0.75371724",
"0.7432717",
"0.7420028",
"0.72501874",
"0.7245786",
"0.7070865",
"0.69555503",
"0.69437224",
"0.68691385",
"0.6778098",
"0.6631666",
"0.6623381",
"0.6623381",
"0.66207707",
"0.6484792",
"0.64791656",
"0.64791656",
"0.64791656",
"0.64659536",
"0.6451844",
"0.64009124",
"0.6395115",
"0.63525033",
"0.6351943"
] |
0.7934667
|
1
|
Sets the user's default current project
|
function set_cur_project($project) {
// make sure it is a valid project name
$result = lgi_mysql_query("SELECT p.`name` FROM %t(userprojects) AS p, %t(usercerts) AS c WHERE p.`usercertid`=c.`id` AND c.`user`='%%' AND p.`name`='%%' LIMIT 1", $this->userid, $project);
if (mysql_num_rows($result)<=0)
throw new LGIPortalException("Invalid project");
// then update
lgi_mysql_query("UPDATE %t(users) SET `dfl_project`='%%' WHERE `name`='%%'", $project, $this->userid);
$_SESSION['dfl_project'] = $project;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"protected function initProjectSpecific() {\n\t\tView::$projectLocation = str_replace(\"index.php\", \"\", $_SERVER['PHP_SELF']);\n\t}",
"public function set_project()\n {\n\n return view('project.set_project');\n\n }",
"public function setDefaultWorkspace() {}",
"public function getDefaultProject(){\n $sql = 'SELECT rowid FROM `llx_projet` ORDER BY rowid ASC LIMIT 1';\n $resql = $this->db->query($sql);\n $idproj = $resql->fetch_assoc()[\"rowid\"];\n return $idproj;\n }",
"public function getDefaultWorkspace() {}",
"protected function set_current_user()\n\t{\n\t\tif (class_exists('Auth'))\n\t\t{\n\t\t\t// Load our current logged in user for convenience\n\t\t\tif ($this->auth->is_logged_in())\n\t\t\t{\n\t\t\t\t$this->current_user = clone $this->auth->user();\n\n\t\t\t\t$this->current_user->user_img = gravatar_link($this->current_user->email, 22, $this->current_user->email, \"{$this->current_user->email} Profile\");\n\n\t\t\t\t// if the user has a language setting then use it\n\t\t\t\tif (isset($this->current_user->language))\n\t\t\t\t{\n\t\t\t\t\t$this->config->set_item('language', $this->current_user->language);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Make the current user available in the views\n\t\t\tif (!class_exists('Template'))\n\t\t\t{\n\t\t\t\t$this->load->library('Template');\n\t\t\t}\n\t\t\tTemplate::set('current_user', $this->current_user);\n\t\t}\n\t}",
"public function set_default(): void\n {\n if (!userHasPermission(Permission\\Groups\\SetDefault::class)) {\n show404();\n }\n\n /** @var Uri $oUri */\n $oUri = Factory::service('Uri');\n /** @var Group $oUserGroupModel */\n $oUserGroupModel = Factory::model('UserGroup', Constants::MODULE_SLUG);\n\n if ($oUserGroupModel->setAsDefault($oUri->segment(5))) {\n $this->oUserFeedback->success(\n 'Group set as default successfully.'\n );\n } else {\n $this->oUserFeedback->error(\n 'Failed to set default user group. ' . $oUserGroupModel->lastError()\n );\n }\n\n redirect(self::url());\n }",
"protected function get_default_project_type() {\n $str = CriticalI_Property::get('project.default_type', 'inside-public');\n \n if (strtolower(trim($str)) == 'outside-public')\n return CriticalI_Project::OUTSIDE_PUBLIC;\n else\n return CriticalI_Project::INSIDE_PUBLIC;\n }",
"public function setProject($name)\n {\n return $this->project = $name;\n }",
"public function setProject($value)\n {\n return $this->set('Project', $value);\n }",
"public function setProject($value)\n {\n return $this->set('Project', $value);\n }",
"public function setProject($value)\n {\n return $this->set('Project', $value);\n }",
"public function setProject($value)\n {\n return $this->set('Project', $value);\n }",
"public function setProject($value)\n {\n return $this->set('Project', $value);\n }",
"public function setProject($value)\n {\n return $this->set('Project', $value);\n }",
"public function setProject($value)\n {\n return $this->set('Project', $value);\n }",
"public function setProject($value)\n {\n return $this->set('Project', $value);\n }",
"public function setProject($value)\n {\n return $this->set('Project', $value);\n }",
"public function setProject($value)\n {\n return $this->set('Project', $value);\n }",
"public function setProject($value)\n {\n return $this->set('Project', $value);\n }",
"public function setProject($value)\n {\n return $this->set('Project', $value);\n }",
"public function setProject($value)\n {\n return $this->set('Project', $value);\n }",
"public function setProject($value)\n {\n return $this->set('Project', $value);\n }",
"public function setProject($value)\n {\n return $this->set('Project', $value);\n }",
"public function setProject($value)\n {\n return $this->set('Project', $value);\n }",
"public function setProject($value)\n {\n return $this->set('Project', $value);\n }",
"public function setProject($value)\n {\n return $this->set('Project', $value);\n }",
"public function setProject($value)\n {\n return $this->set('Project', $value);\n }",
"public function setProject($value)\n {\n return $this->set('Project', $value);\n }",
"public function setProject($value)\n {\n return $this->set('Project', $value);\n }"
] |
[
"0.64773077",
"0.61541575",
"0.6126222",
"0.6054888",
"0.59776044",
"0.5926378",
"0.58052146",
"0.57930374",
"0.57570577",
"0.5721512",
"0.5721512",
"0.5721512",
"0.5721512",
"0.5721512",
"0.5721512",
"0.5721512",
"0.5721512",
"0.5721512",
"0.5721512",
"0.5721512",
"0.5721512",
"0.5721512",
"0.5721512",
"0.5721512",
"0.5721512",
"0.5721512",
"0.5721512",
"0.5720038",
"0.5720038",
"0.5720038"
] |
0.6409961
|
1
|
Test basic getter and setters.
|
public function testGetterSetter()
{
$text = new Text('Foo bar', 100);
$this->assertEquals($text->text, 'Foo bar');
$this->assertEquals($text->confidence, 100);
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function testGettersAndSetters()\n {\n $this->phone->setType('phone');\n $this->assertEquals('phone', $this->phone->getType());\n\n $this->phone->setValue('059 70 22 85');\n $this->assertEquals('059 70 22 85', $this->phone->getValue());\n }",
"public function testGetValue()\n {\n $this->todo('stub');\n }",
"public function setGetTest()\n {\n $id = \"This a weird test\";\n $createdAt = 1;\n $updatedAt = 2;\n $appId = 1337;\n \n $this->_payment->setId($id)->setCreatedAt($createdAt)->setUpdatedAt($updatedAt)->setAppId($appId);\n \n $this->assertEquals($this->_payment->getId(), $id);\n $this->assertEquals($this->_payment->getCreatedAt(), $createdAt);\n $this->assertEquals($this->_payment->getUpdatedAt(), $updatedAt);\n $this->assertEquals($this->_payment->getAppId(), $appId);\n }",
"public function testGetters()\n {\n $this->entity->fromArray($this->testData);\n\n foreach ($this->expectedGetters as $method => $expectedResult) {\n //var_dump($this->testData, $expectedResult, $this->entity->$method());\n if (is_array($expectedResult)) {\n $this->assertArraysAreSimilar($expectedResult, $this->entity->$method(), $method);\n } elseif (is_object($expectedResult)) {\n $actualObject = var_export($this->entity->$method(), true);\n $expectedObject = var_export($expectedResult, true);\n $this->assertSame($expectedObject, $actualObject, $method);\n } else {\n $this->assertSame($expectedResult, $this->entity->$method(), $method);\n }\n }\n }",
"public function testAccessorMethods()\n {\n // Id accessors\n static::assertNull($this->dto->getId());\n $this->dto->setId($expected = 1);\n static::assertSame($expected, $this->dto->getId());\n\n // Name accessors\n static::assertNull($this->dto->getName());\n $this->dto->setName($expected = 'Requestmon');\n static::assertSame($expected, $this->dto->getName());\n\n // Status accessors\n static::assertNull($this->dto->getOnlineStatus());\n $this->dto->setOnlineStatus($expected = 'Alive');\n static::assertSame($expected, $this->dto->getOnlineStatus());\n\n // ClusterId accessors\n static::assertNull($this->dto->getClusterId());\n $this->dto->setClusterId($expected = 1);\n static::assertSame($expected, $this->dto->getClusterId());\n\n // Address accessors\n static::assertNull($this->dto->getAddress());\n $this->dto->setAddress($expected = new Address());\n static::assertSame($expected, $this->dto->getAddress());\n\n // Telephone accessors\n static::assertNull($this->dto->getTelephone());\n $this->dto->setTelephone($expected = new Telephone());\n static::assertSame($expected, $this->dto->getTelephone());\n\n // Email accessors\n static::assertNull($this->dto->getEmail());\n $this->dto->setEmail($expected = new Email());\n static::assertSame($expected, $this->dto->getEmail());\n\n // Account type id accessors\n static::assertNull($this->dto->getAccountTypeId());\n $this->dto->setAccountTypeId($expected = 1);\n static::assertSame($expected, $this->dto->getAccountTypeId());\n\n // Module list id accessors\n static::assertNull($this->dto->getModuleList());\n $this->dto->setModuleList($expected = '1,2,3');\n static::assertSame($expected, $this->dto->getModuleList());\n }",
"public function testGetter()\n {\n $account = new Account('access-key', 'secret-key', 'api-host');\n $this->assertEquals('access-key', $account->getAccessKey());\n $this->assertEquals('secret-key', $account->getSecretKey());\n $this->assertEquals('api-host', $account->getApiHost());\n }",
"public function testGetters()\n\t\t{\n\t\t$phpToolBox = new PhpToolbox();\n\n\t\t// test getter for Text Class\n\t\t$this->assertNotNull($phpToolBox->getText());\n\t\t$this->assertInstanceOf(Text::class, $phpToolBox->getText());\n\n\t\t// test getter for IO class\n\t\t$this->assertNotNull($phpToolBox->getIO());\n\t\t$this->assertInstanceOf(IO::class, $phpToolBox->getIO());\n\n\t\t// test getter for Datetime class\n\t\t$this->assertNotNull($phpToolBox->getDatetime());\n\t\t$this->assertInstanceOf(Datetime::class, $phpToolBox->getDatetime());\n\t\t}",
"#[@test]\n public function returnValue_canSetGet() {\n $this->sut->setReturn('foo');\n $this->assertEquals('foo', $this->sut->getReturn());\n }",
"public function testModuleAndRouteAccessors()\n {\n $page = new Zym_Navigation_Page_Mvc(array(\n 'label' => 'foo',\n 'action' => 'index',\n 'controller' => 'index'\n ));\n \n $props = array('Module', 'Route');\n $valids = array('index', 'help', 'home', 'default', '1', ' ', null);\n $invalids = array(42, (object) null);\n \n foreach ($props as $prop) {\n $setter = \"set$prop\";\n $getter = \"get$prop\";\n \n foreach ($valids as $valid) {\n $page->$setter($valid);\n $this->assertEquals($valid, $page->$getter());\n }\n \n foreach ($invalids as $invalid) {\n try {\n $page->$setter($invalid);\n $msg = \"'$invalid' is invalid for $setter(), but no \";\n $msg .= 'InvalidArgumentException was thrown';\n $this->fail($msg);\n } catch (InvalidArgumentException $e) {\n \n }\n }\n }\n }",
"public function testGetters(): void\n {\n $user = new User(['id' => 'external-user-id']);\n $ewallet = new Ewallet([]);\n $contract = new Contract([\n 'action' => 'debit',\n 'currency' => 'AUD',\n 'ewallet' => $ewallet,\n 'group' => 'mastercard',\n 'fixed_fee' => '0.02',\n 'type' => 'contract',\n 'user' => $user,\n 'variable_rate' => '0.10',\n ]);\n\n self::assertSame('debit', $contract->getAction());\n self::assertSame('mastercard', $contract->getGroup());\n self::assertSame('AUD', $contract->getCurrency());\n self::assertSame($ewallet, $contract->getEwallet());\n self::assertSame('0.02', $contract->getFixedFee());\n self::assertSame('0.10', $contract->getVariableRate());\n self::assertSame($user, $contract->getUser());\n }",
"public function testSetValues()\n {\n $this->todo('stub');\n }",
"public function testSetSpecial() {\n\n $obj = new AppelsEnCours();\n\n $obj->setSpecial(\"special\");\n $this->assertEquals(\"special\", $obj->getSpecial());\n }",
"public function testGetAndSetMethods()\n {\n $attribs = ['class' => 'gravatar', 'title' => 'avatar', 'id' => 'gravatar-1'];\n $this->_object->setDefaultImg('monsterid')\n ->setImgSize(150)\n ->setSecure(true)\n ->setEmail(\"[email protected]\")\n ->setAttribs($attribs)\n ->setRating('pg');\n $this->assertEquals(\"monsterid\", $this->_object->getDefaultImg());\n $this->assertEquals(\"pg\", $this->_object->getRating());\n $this->assertEquals(\"[email protected]\", $this->_object->getEmail());\n $this->assertEquals($attribs, $this->_object->getAttribs());\n $this->assertEquals(150, $this->_object->getImgSize());\n $this->assertTrue($this->_object->getSecure());\n }",
"public function testGetSet()\n {\n $term = new LP21Term('type', 'uuid');\n $term\n ->setUrl('url')\n ->setCode('code')\n ->setCantons(['BE'])\n ->setVersion('version')\n ->setCycles([1]);\n\n $this->assertEquals('url', $term->getUrl(), \"The getter/setter works for URLs.\");\n $this->assertEquals('code', $term->getCode(), \"The getter/setter works for codes.\");\n $this->assertEquals(['BE'], $term->getCantons(), \"The getter/setter works for cantons.\");\n $this->assertEquals('version', $term->getVersion(), \"The getter/setter works for versions.\");\n $this->assertEquals([1], $term->getCycles(), \"The getter/setter works for cycles.\");\n }",
"public function testGettersAndSetters()\n {\n $array = $this->getDummyHmacData();\n\n $this->entity->setData($array['data']);\n $this->entity->setKey($array['key']);\n $this->entity->setTime($array['time']);\n $this->entity->setHmac($array['hmac']);\n\n $this->assertTrue($array['data'] === $this->entity->getData());\n $this->assertTrue($array['key'] === $this->entity->getKey());\n $this->assertTrue($array['time'] === $this->entity->getTime());\n $this->assertTrue($array['hmac'] === $this->entity->getHmac());\n }",
"public function testCanGet()\n {\n self::$apcu = [];\n $this->sut->add('myKey', 'myValue');\n $this->assertSame('myValue', $this->sut->get('myKey'));\n }",
"abstract protected function setRequiredGetters();",
"public function testSetValue()\n {\n $this->todo('stub');\n }",
"public function testGetValue() : void\n {\n $instance = $this->createEmptyInstance();\n\n $value = new \\stdClass();\n\n $this->setValue($instance, 'value', $value);\n\n $this->getTestCase()->assertSame($value, $instance->getValue());\n }",
"public function testSetAndRetrieveObject(): void\n {\n $obj = new \\stdClass;\n $obj->animal = \"Frog\";\n $obj->mineral = \"Quartz\";\n $obj->vegetable = \"Spinach\";\n $testObj = new \\stdClass;\n $testObj->testInt = 5;\n $testObj->testFloat = 3.278;\n $testObj->testString = \"WooHoo\";\n $testObj->testBoolean = true;\n $testObj->testNull = null;\n $testObj->testArray = array(1,2,3,4,5);\n $testObj->testObject = $obj;\n $key = \"TestObject\";\n $this->testNotStrict->set($key, $testObj);\n $a = $this->testNotStrict->get($key);\n $bool = is_object($a);\n $this->assertTrue($bool);\n $this->assertEquals($testObj->testInt, $a->testInt);\n $this->assertEquals($testObj->testFloat, $a->testFloat);\n $this->assertEquals($testObj->testString, $a->testString);\n $this->assertEquals($testObj->testBoolean, $a->testBoolean);\n $this->assertNull($a->testNull);\n $this->assertEquals($testObj->testArray, $a->testArray);\n $this->assertEquals($testObj->testObject, $a->testObject);\n }",
"public function client_setter_and_getter()\n {\n // Arrange\n $service = new Service;\n $client = new Client;\n\n // Act\n $returned = $service->setClient($client)->getClient();\n\n // Assert\n $this->assertEquals($client, $returned);\n }",
"public function gettersAndSettersShouldWorkProperly(): void\n {\n $heidelpay = new Heidelpay('s-priv-123');\n /** @var PaymentService $paymentService */\n $paymentService = $heidelpay->getPaymentService();\n $this->assertSame($heidelpay, $paymentService->getHeidelpay());\n $this->assertSame($heidelpay->getResourceService(), $paymentService->getResourceService());\n\n $heidelpay2 = new Heidelpay('s-priv-1234');\n $paymentService->setHeidelpay($heidelpay2);\n $this->assertSame($heidelpay2, $paymentService->getHeidelpay());\n }",
"public function testGetValues()\n {\n $this->todo('stub');\n }",
"public function testSetGetValue()\n {\n $value = new ScalarValue('foo');\n $same = $this->uut->setValue($value);\n $this->assertSame($this->uut, $same);\n $this->assertEquals($value, $this->uut->getValue());\n }",
"function doGetterSetter() {\n\tglobal $description_obj;\n\tglobal $table_name, $class_name;\n\tglobal $tabs, $tab2, $tab3;\n\n\tfComment($tabs,\"Getters and Setters\");\n\tforeach($description_obj as $obj) {\n\t\t//print_r($obj);\n\n\t\techo $tabs,\"/// getter for '$obj->Field'\\n\",\n\t\t\t $tabs,\"public function get_{$obj->Field}()\\t\\t{return \\$this->$obj->Field;}\\n\",\n\t\t\t $tabs,\"/// setter for '$obj->Field'\\n\",\n\t\t\t $tabs,\"public function set_{$obj->Field}(\\$val)\\t{\\$this->$obj->Field = \",assignEscape($obj),\";}\\n\",\n\t\t\t \"\\n\";\n\t}\n\techo $tabs,\"public function get_last_error()\\t\\t{return \\$this->_last_error;}\\n\";\n\techo \"\\n\\n\";\n}",
"abstract public function testConstructorAndProperties(): void;",
"public function testGet()\n {\n $object = new \\Webaholicson\\Minimvc\\Core\\Object(['test' => true]);\n \n $this->assertTrue($object->get('test'));\n $this->assertEquals('', $object->get('empty'));\n $this->assertArrayHasKey('test', $object->get());\n }",
"public function testStateGetters()\n {\n /** @var State $state */\n $state = State::getById(28);\n $this->assertNotNull($state);\n $this->assertEquals(28, $state->getId());\n\n $this->outputGetters($state);\n }",
"public function testSetGetValue()\n {\n $value = new UploadValueStructure();\n $same = $this->uut->setValue($value);\n $this->assertSame($this->uut, $same);\n $this->assertSame($value, $this->uut->getValue());\n }",
"public function testGettersSetters()\n {\n $this->assertEquals('my category', $this->question->getCategory());\n $this->assertEquals('my question', $this->question->getQuestion());\n\n $this->assertEquals($this->answers, $this->question->getAnswers());\n\n $this->assertEquals(\n ['my first answer', 'my second answer', 'my third answer', 'my fourth answer'],\n $this->question->getAnswersLabels(),\n 'Question should return all available answers labels'\n );\n $this->assertEquals(\n ['my first answer', 'my second answer'],\n $this->question->getCorrectAnswersValues(),\n 'Question should return all correct answers values'\n );\n }"
] |
[
"0.74504316",
"0.71951616",
"0.714431",
"0.70956683",
"0.70669264",
"0.6911544",
"0.68973434",
"0.68753076",
"0.68099713",
"0.6793426",
"0.6791523",
"0.6785153",
"0.67659104",
"0.67606616",
"0.67584157",
"0.6753012",
"0.67497337",
"0.6746458",
"0.67416674",
"0.66931975",
"0.66419184",
"0.66392255",
"0.6625663",
"0.66094595",
"0.6608539",
"0.6605454",
"0.6599057",
"0.6592819",
"0.6551131",
"0.6546277"
] |
0.72710896
|
1
|
Test setting confidence to a noninteger.
|
public function testConfidenceNotAnInteger()
{
new Text('Foo bar', 'foo');
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function testConfidenceLessThan0()\n {\n new Text('Foo bar', -1);\n }",
"public function testConfidenceMoreThan100()\n {\n new Text('Foo bar', 101);\n }",
"public function forceIntegerInRangeForcesIntegerIntoDefaultBoundariesDataProvider() {}",
"public function functionCanBeInterpretedAsIntegerInvalidDataProvider() {}",
"public function functionCanBeInterpretedAsIntegerValidDataProvider() {}",
"public function isIntegerInRangeRejectsOtherDataTypesDataProvider() {}",
"public function setConfidence($var)\n {\n GPBUtil::checkFloat($var);\n $this->confidence = $var;\n\n return $this;\n }",
"public function setConfidence($var)\n {\n GPBUtil::checkFloat($var);\n $this->confidence = $var;\n\n return $this;\n }",
"public function testNice()\n {\n $cases = [\n '0.01' => '1.00%',\n '0.10' => '10.00%',\n '1' => '100.00%',\n '1.5' => '150.00%',\n '1.5000' => '150.00%',\n '1.05' => '105.00%',\n '1.0500' => '105.00%',\n '0.95' => '95.00%'\n ];\n\n foreach ($cases as $original => $expected) {\n $percentage = new DBPercentage('Probability');\n $percentage->setValue($original);\n $this->assertEquals($expected, $percentage->Nice());\n }\n }",
"public function testGetDiscountValueZero()\n {\n $discountValue= $this->discountProvider->getDiscountValue(\"https://developer.github.com/v3/#http-redirects\",[13,7],1000);\n $this->assertEquals(0,$discountValue);\n }",
"public function testZeroDiscipline()\n {\n $result = false;\n $student = new StudentProfile();\n $status = check24Discipline($student);\n if(count($status[\"reason\"]) == 0 && $status[\"result\"] == true)\n $result = true;\n $this->assertEquals(true, $result);\n }",
"public function testBasicPreconditionFail3()\n {\n $this->typeSafetyTestClass->iNeedNumeric('four');\n }",
"function hitung_confidence($supp_xuy, $min_support, $min_confidence, $atribut1, $atribut2, $atribut3, $id_process, $dataTransaksi, $jumlah_transaksi) {\n\n\t\t//hitung nilai support $nilai_support_x seperti di itemset2\n\t\t$jml_itemset2=$this->jumlah_itemset2($dataTransaksi, $atribut1, $atribut2);\n\t\t$nilai_support_x=($jml_itemset2/$jumlah_transaksi) * 100;\n\n\t\t$kombinasi1=$atribut1.\" , \".$atribut2;\n\t\t$kombinasi2=$atribut3;\n\t\t$supp_x=$nilai_support_x; //$row1_['support'];\n\t\t$conf=($supp_xuy/$supp_x)*100;\n\t\t//lolos seleksi min confidence itemset3\n\t\t$lolos=($conf >=$min_confidence)? 1: 0;\n\n\t\t//hitung korelasi lift\n\t\t$jumlah_kemunculanAB=$this->jumlah_itemset3($dataTransaksi, $atribut1, $atribut2, $atribut3);\n\t\t$PAUB=$jumlah_kemunculanAB/$jumlah_transaksi;\n\n\t\t$jumlah_kemunculanA=$this->jumlah_itemset2($dataTransaksi, $atribut1, $atribut2);\n\t\t$jumlah_kemunculanB=$this->jumlah_itemset1($dataTransaksi, $atribut3);\n\n\t\t//$nilai_uji_lift = $PAUB / $jumlah_kemunculanA * $jumlah_kemunculanB;\n\t\t$nilai_uji_lift=$PAUB / (($jumlah_kemunculanA/$jumlah_transaksi) * ($jumlah_kemunculanB/$jumlah_transaksi));\n\t\t$korelasi_rule=($nilai_uji_lift<1)?\"korelasi negatif\": \"korelasi positif\";\n\n\t\tif($nilai_uji_lift==1) {\n\t\t\t$korelasi_rule=\"tidak ada korelasi\";\n\t\t}\n\n\t\t//masukkan ke table confidence\n\t\t$data=array(\"kombinasi1\"=> $kombinasi1,\n\t\t\t\"kombinasi2\"=> $kombinasi2,\n\t\t\t\"support_xUy\"=> $supp_xuy,\n\t\t\t\"support_x\"=> $supp_x,\n\t\t\t\"confidence\"=> $conf,\n\t\t\t\"lolos\"=> $lolos,\n\t\t\t\"min_support\"=> $min_support,\n\t\t\t\"min_confidence\"=> $min_confidence,\n\t\t\t\"nilai_uji_lift\"=> $nilai_uji_lift,\n\t\t\t\"korelasi_rule\"=> $korelasi_rule,\n\t\t\t\"id_process\"=> $id_process,\n\t\t\t\"jumlah_a\"=> $jumlah_kemunculanA,\n\t\t\t\"jumlah_b\"=> $jumlah_kemunculanB,\n\t\t\t\"jumlah_ab\"=> $jumlah_kemunculanAB,\n\t\t\t\"px\"=> ($jumlah_kemunculanA/$jumlah_transaksi),\n\t\t\t\"py\"=> ($jumlah_kemunculanB/$jumlah_transaksi),\n\t\t\t\"pxuy\"=> $PAUB,\n\t\t\t\"from_itemset\"=>3);\n\t\t$this->db->insert('confidence', $data);\n\n\t}",
"public function testSetPrimeHNuitExcept() {\n\n $obj = new HistoPrepPaie();\n\n $obj->setPrimeHNuitExcept(10.092018);\n $this->assertEquals(10.092018, $obj->getPrimeHNuitExcept());\n }",
"public function testConfidenceWrongType()\n {\n new Text('Foo bar', '50');\n }",
"function hitung_confidence2($supp_xuy, $min_support, $min_confidence,$atribut1, $atribut2, $id_process, $dataTransaksi, $jumlah_transaksi) {\n\t\t$jml_itemset1=$this->jumlah_itemset1($dataTransaksi, $atribut1);\n\t\t$nilai_support_x=($jml_itemset1/$jumlah_transaksi) * 100;\n\n\t\t$kombinasi1=$atribut1;\n\t\t$kombinasi2=$atribut2;\n\t\t$supp_x=$nilai_support_x; //$row1_['support'];\n\t\t$conf=($supp_xuy/$supp_x)*100;\n\t\t//lolos seleksi min confidence itemset3\n\t\t$lolos=($conf >=$min_confidence)? 1: 0;\n\n\t\t//hitung korelasi lift\n\t\t$jumlah_kemunculanAB=$this->jumlah_itemset2($dataTransaksi, $atribut1, $atribut2);\n\t\t$PAUB=$jumlah_kemunculanAB/$jumlah_transaksi;\n\n\t\t$jumlah_kemunculanA=$this->jumlah_itemset1($dataTransaksi, $atribut1);\n\t\t$jumlah_kemunculanB=$this->jumlah_itemset1($dataTransaksi, $atribut2);\n\n\t\t$nilai_uji_lift=$PAUB / (($jumlah_kemunculanA/$jumlah_transaksi) * ($jumlah_kemunculanB/$jumlah_transaksi));\n\t\t$korelasi_rule=($nilai_uji_lift<1)?\"korelasi negatif\": \"korelasi positif\";\n\n\t\tif($nilai_uji_lift==1) {\n\t\t\t$korelasi_rule=\"tidak ada korelasi\";\n\t\t}\n\n //masukkan ke table confidence\n $data=array(\"kombinasi1\"=> $kombinasi1,\n\t\t\t\t\"kombinasi2\"=> $kombinasi2,\n\t\t\t\t\"support_xUy\"=> $supp_xuy,\n\t\t\t\t\"support_x\"=> $supp_x,\n\t\t\t\t\"confidence\"=> $conf,\n\t\t\t\t\"lolos\"=> $lolos,\n\t\t\t\t\"min_support\"=> $min_support,\n\t\t\t\t\"min_confidence\"=> $min_confidence,\n\t\t\t\t\"nilai_uji_lift\"=> $nilai_uji_lift,\n\t\t\t\t\"korelasi_rule\"=> $korelasi_rule,\n\t\t\t\t\"id_process\"=> $id_process,\n\t\t\t\t\"jumlah_a\"=> $jumlah_kemunculanA,\n\t\t\t\t\"jumlah_b\"=> $jumlah_kemunculanB,\n\t\t\t\t\"jumlah_ab\"=> $jumlah_kemunculanAB,\n\t\t\t\t\"px\"=> ($jumlah_kemunculanA/$jumlah_transaksi),\n\t\t\t\t\"py\"=> ($jumlah_kemunculanB/$jumlah_transaksi),\n\t\t\t\t\"pxuy\"=> $PAUB,\n \"from_itemset\"=>2);\n $this->db->insert('confidence', $data);\n\n\t}",
"static public function testInt($value) {\n\t\tstatic $useOldGoodTestInt = null;\n\n\t\tif (is_null($useOldGoodTestInt)) {\n\t\t\t$useOldGoodTestInt = !class_exists('t3lib_utility_Math');\n\t\t}\n\t\tif ($useOldGoodTestInt) {\n\t\t\t$result = t3lib_div::testInt($value);\n\t\t}\n\t\telse {\n\t\t\t$result = t3lib_utility_Math::canBeInterpretedAsInteger($value);\n\t\t}\n\t\treturn $result;\n\t}",
"public function testWarningsErrnoIsIntegerAndNotEmpty(): void\n {\n $value = $this->get_reflection_property_value('warnings')[0];\n\n $this->assertIsInt($value['errno']);\n $this->assertNotEmpty($value['errno']);\n }",
"function hitung_confidence1($supp_xuy, $min_support, $min_confidence, $atribut1, $atribut2, $atribut3, $id_process, $dataTransaksi, $jumlah_transaksi) {\n\n\t\t//hitung nilai support seperti itemset1\n\t\t$jml_itemset1=$this->jumlah_itemset1($dataTransaksi, $atribut1);\n\t\t$nilai_support_x=($jml_itemset1/$jumlah_transaksi) * 100;\n\n\t\t$kombinasi1=$atribut1;\n\t\t$kombinasi2=$atribut2.\" , \".$atribut3;\n\t\t$supp_x=$nilai_support_x; //$row4_['support'];\n\t\t$conf=($supp_xuy/$supp_x)*100;\n\t\t//lolos seleksi min confidence itemset3\n\t\t$lolos=($conf >=$min_confidence)? 1: 0;\n\n\t\t//hitung korelasi lift\n\t\t$jumlah_kemunculanAB=$this->jumlah_itemset3($dataTransaksi, $atribut1, $atribut2, $atribut3);\n\t\t$PAUB=$jumlah_kemunculanAB/$jumlah_transaksi;\n\n\t\t$jumlah_kemunculanA=$this->jumlah_itemset1($dataTransaksi, $atribut1);\n\t\t$jumlah_kemunculanB=$this->jumlah_itemset2($dataTransaksi, $atribut2, $atribut3);\n\n\t\t$nilai_uji_lift=$PAUB / (($jumlah_kemunculanA/$jumlah_transaksi) * ($jumlah_kemunculanB/$jumlah_transaksi));\n\t\t$korelasi_rule=($nilai_uji_lift<1)?\"korelasi negatif\": \"korelasi positif\";\n\n\t\tif($nilai_uji_lift==1) {\n\t\t\t$korelasi_rule=\"tidak ada korelasi\";\n\t\t}\n\n\n\t\t//masukkan ke table confidence\n\t\t$data=array(\"kombinasi1\"=> $kombinasi1,\n\t\t\t\"kombinasi2\"=> $kombinasi2,\n\t\t\t\"support_xUy\"=> $supp_xuy,\n\t\t\t\"support_x\"=> $supp_x,\n\t\t\t\"confidence\"=> $conf,\n\t\t\t\"lolos\"=> $lolos,\n\t\t\t\"min_support\"=> $min_support,\n\t\t\t\"min_confidence\"=> $min_confidence,\n\t\t\t\"nilai_uji_lift\"=> $nilai_uji_lift,\n\t\t\t\"korelasi_rule\"=> $korelasi_rule,\n\t\t\t\"id_process\"=> $id_process,\n\t\t\t\"jumlah_a\"=> $jumlah_kemunculanA,\n\t\t\t\"jumlah_b\"=> $jumlah_kemunculanB,\n\t\t\t\"jumlah_ab\"=> $jumlah_kemunculanAB,\n\t\t\t\"px\"=> ($jumlah_kemunculanA/$jumlah_transaksi),\n\t\t\t\"py\"=> ($jumlah_kemunculanB/$jumlah_transaksi),\n\t\t\t\"pxuy\"=> $PAUB,\n\t\t\t\"from_itemset\"=>3);\n\t\t$this->db->insert('confidence', $data);\n\t}",
"public function getConfidence()\n {\n return $this->confidence;\n }",
"public function getConfidence()\n {\n return $this->confidence;\n }",
"public function testSetAndRetrieveInteger(): void\n {\n $key = \"A test key\";\n $expected = 27;\n $this->testNotStrict->set($key, $expected);\n $actual = $this->testNotStrict->get($key);\n $this->assertEquals($expected, $actual);\n }",
"public function check_threshold( $value ) {\n\t\t\tif ( (int) $value <= 0 || (int) $value > 100 ) {\n\t\t\t\t$this->add_admin_notice( __('Please revise your flagging threshold and enter a number between 1 and 100') );\n\t\t\t}\n\t\t\treturn (int) $value;\n\t\t}",
"public function testSetPreavisNonEffectuePaye() {\n\n $obj = new AttestationCacm();\n\n $obj->setPreavisNonEffectuePaye(true);\n $this->assertEquals(true, $obj->getPreavisNonEffectuePaye());\n }",
"public function testGetDiscountValue()\n {\n\n $discountValue= $this->discountProvider->getDiscountValue(\"https://developer.github.com/v3/#http-redirects\",[12,7],1000);\n $this->assertEquals(21,$discountValue);\n\n }",
"public function globalVarConditionDoesNotMatchOnEmptyExpressionWithValueSetToZero() {}",
"public function globalVarConditionDoesNotMatchOnEmptyExpressionWithValueSetToZero() {}",
"public function hasIgnoredefense(){\r\n return $this->_has(34);\r\n }",
"function _cb_negate($aVal) {\n return round(-$aVal);\n}",
"public function getPotencia()\n {\n return 2.0;\n }"
] |
[
"0.6053376",
"0.5642225",
"0.5477571",
"0.54750377",
"0.54054636",
"0.523676",
"0.5190082",
"0.5190082",
"0.51412445",
"0.5127269",
"0.5097935",
"0.5082764",
"0.50026625",
"0.4980002",
"0.49664712",
"0.4937079",
"0.4921504",
"0.4917959",
"0.49162948",
"0.49082118",
"0.49082118",
"0.48945442",
"0.48907793",
"0.4887349",
"0.483951",
"0.48352143",
"0.4834554",
"0.4832843",
"0.4824058",
"0.48139563"
] |
0.61611897
|
0
|
Test setting confidence to more than 100.
|
public function testConfidenceMoreThan100()
{
new Text('Foo bar', 101);
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function testGetDiscountWithLimit()\n {\n $discountValue= $this->discountProvider->getDiscountValue(\"https://developer.github.com/v3/#http-redirects\",[12,7],60);\n $this->assertEquals(15,$discountValue);\n }",
"public function setConfidence($var)\n {\n GPBUtil::checkFloat($var);\n $this->confidence = $var;\n\n return $this;\n }",
"public function setConfidence($var)\n {\n GPBUtil::checkFloat($var);\n $this->confidence = $var;\n\n return $this;\n }",
"public function testCustomPrecision()\n {\n $cases = [\n '0.01' => '1%',\n '0.1' => '10%',\n '1' => '100%',\n '1.5' => '150%',\n '1.05' => '105%',\n '1.0500' => '105%'\n ];\n\n foreach ($cases as $original => $expected) {\n $percentage = new DBPercentage('Probability', 2);\n $percentage->setValue($original);\n $this->assertEquals($expected, $percentage->Nice());\n }\n }",
"public function getThreshold()\n {\n return 5000;\n }",
"function hitung_confidence($supp_xuy, $min_support, $min_confidence, $atribut1, $atribut2, $atribut3, $id_process, $dataTransaksi, $jumlah_transaksi) {\n\n\t\t//hitung nilai support $nilai_support_x seperti di itemset2\n\t\t$jml_itemset2=$this->jumlah_itemset2($dataTransaksi, $atribut1, $atribut2);\n\t\t$nilai_support_x=($jml_itemset2/$jumlah_transaksi) * 100;\n\n\t\t$kombinasi1=$atribut1.\" , \".$atribut2;\n\t\t$kombinasi2=$atribut3;\n\t\t$supp_x=$nilai_support_x; //$row1_['support'];\n\t\t$conf=($supp_xuy/$supp_x)*100;\n\t\t//lolos seleksi min confidence itemset3\n\t\t$lolos=($conf >=$min_confidence)? 1: 0;\n\n\t\t//hitung korelasi lift\n\t\t$jumlah_kemunculanAB=$this->jumlah_itemset3($dataTransaksi, $atribut1, $atribut2, $atribut3);\n\t\t$PAUB=$jumlah_kemunculanAB/$jumlah_transaksi;\n\n\t\t$jumlah_kemunculanA=$this->jumlah_itemset2($dataTransaksi, $atribut1, $atribut2);\n\t\t$jumlah_kemunculanB=$this->jumlah_itemset1($dataTransaksi, $atribut3);\n\n\t\t//$nilai_uji_lift = $PAUB / $jumlah_kemunculanA * $jumlah_kemunculanB;\n\t\t$nilai_uji_lift=$PAUB / (($jumlah_kemunculanA/$jumlah_transaksi) * ($jumlah_kemunculanB/$jumlah_transaksi));\n\t\t$korelasi_rule=($nilai_uji_lift<1)?\"korelasi negatif\": \"korelasi positif\";\n\n\t\tif($nilai_uji_lift==1) {\n\t\t\t$korelasi_rule=\"tidak ada korelasi\";\n\t\t}\n\n\t\t//masukkan ke table confidence\n\t\t$data=array(\"kombinasi1\"=> $kombinasi1,\n\t\t\t\"kombinasi2\"=> $kombinasi2,\n\t\t\t\"support_xUy\"=> $supp_xuy,\n\t\t\t\"support_x\"=> $supp_x,\n\t\t\t\"confidence\"=> $conf,\n\t\t\t\"lolos\"=> $lolos,\n\t\t\t\"min_support\"=> $min_support,\n\t\t\t\"min_confidence\"=> $min_confidence,\n\t\t\t\"nilai_uji_lift\"=> $nilai_uji_lift,\n\t\t\t\"korelasi_rule\"=> $korelasi_rule,\n\t\t\t\"id_process\"=> $id_process,\n\t\t\t\"jumlah_a\"=> $jumlah_kemunculanA,\n\t\t\t\"jumlah_b\"=> $jumlah_kemunculanB,\n\t\t\t\"jumlah_ab\"=> $jumlah_kemunculanAB,\n\t\t\t\"px\"=> ($jumlah_kemunculanA/$jumlah_transaksi),\n\t\t\t\"py\"=> ($jumlah_kemunculanB/$jumlah_transaksi),\n\t\t\t\"pxuy\"=> $PAUB,\n\t\t\t\"from_itemset\"=>3);\n\t\t$this->db->insert('confidence', $data);\n\n\t}",
"function hitung_confidence2($supp_xuy, $min_support, $min_confidence,$atribut1, $atribut2, $id_process, $dataTransaksi, $jumlah_transaksi) {\n\t\t$jml_itemset1=$this->jumlah_itemset1($dataTransaksi, $atribut1);\n\t\t$nilai_support_x=($jml_itemset1/$jumlah_transaksi) * 100;\n\n\t\t$kombinasi1=$atribut1;\n\t\t$kombinasi2=$atribut2;\n\t\t$supp_x=$nilai_support_x; //$row1_['support'];\n\t\t$conf=($supp_xuy/$supp_x)*100;\n\t\t//lolos seleksi min confidence itemset3\n\t\t$lolos=($conf >=$min_confidence)? 1: 0;\n\n\t\t//hitung korelasi lift\n\t\t$jumlah_kemunculanAB=$this->jumlah_itemset2($dataTransaksi, $atribut1, $atribut2);\n\t\t$PAUB=$jumlah_kemunculanAB/$jumlah_transaksi;\n\n\t\t$jumlah_kemunculanA=$this->jumlah_itemset1($dataTransaksi, $atribut1);\n\t\t$jumlah_kemunculanB=$this->jumlah_itemset1($dataTransaksi, $atribut2);\n\n\t\t$nilai_uji_lift=$PAUB / (($jumlah_kemunculanA/$jumlah_transaksi) * ($jumlah_kemunculanB/$jumlah_transaksi));\n\t\t$korelasi_rule=($nilai_uji_lift<1)?\"korelasi negatif\": \"korelasi positif\";\n\n\t\tif($nilai_uji_lift==1) {\n\t\t\t$korelasi_rule=\"tidak ada korelasi\";\n\t\t}\n\n //masukkan ke table confidence\n $data=array(\"kombinasi1\"=> $kombinasi1,\n\t\t\t\t\"kombinasi2\"=> $kombinasi2,\n\t\t\t\t\"support_xUy\"=> $supp_xuy,\n\t\t\t\t\"support_x\"=> $supp_x,\n\t\t\t\t\"confidence\"=> $conf,\n\t\t\t\t\"lolos\"=> $lolos,\n\t\t\t\t\"min_support\"=> $min_support,\n\t\t\t\t\"min_confidence\"=> $min_confidence,\n\t\t\t\t\"nilai_uji_lift\"=> $nilai_uji_lift,\n\t\t\t\t\"korelasi_rule\"=> $korelasi_rule,\n\t\t\t\t\"id_process\"=> $id_process,\n\t\t\t\t\"jumlah_a\"=> $jumlah_kemunculanA,\n\t\t\t\t\"jumlah_b\"=> $jumlah_kemunculanB,\n\t\t\t\t\"jumlah_ab\"=> $jumlah_kemunculanAB,\n\t\t\t\t\"px\"=> ($jumlah_kemunculanA/$jumlah_transaksi),\n\t\t\t\t\"py\"=> ($jumlah_kemunculanB/$jumlah_transaksi),\n\t\t\t\t\"pxuy\"=> $PAUB,\n \"from_itemset\"=>2);\n $this->db->insert('confidence', $data);\n\n\t}",
"public function testConfidenceLessThan0()\n {\n new Text('Foo bar', -1);\n }",
"function hitung_confidence1($supp_xuy, $min_support, $min_confidence, $atribut1, $atribut2, $atribut3, $id_process, $dataTransaksi, $jumlah_transaksi) {\n\n\t\t//hitung nilai support seperti itemset1\n\t\t$jml_itemset1=$this->jumlah_itemset1($dataTransaksi, $atribut1);\n\t\t$nilai_support_x=($jml_itemset1/$jumlah_transaksi) * 100;\n\n\t\t$kombinasi1=$atribut1;\n\t\t$kombinasi2=$atribut2.\" , \".$atribut3;\n\t\t$supp_x=$nilai_support_x; //$row4_['support'];\n\t\t$conf=($supp_xuy/$supp_x)*100;\n\t\t//lolos seleksi min confidence itemset3\n\t\t$lolos=($conf >=$min_confidence)? 1: 0;\n\n\t\t//hitung korelasi lift\n\t\t$jumlah_kemunculanAB=$this->jumlah_itemset3($dataTransaksi, $atribut1, $atribut2, $atribut3);\n\t\t$PAUB=$jumlah_kemunculanAB/$jumlah_transaksi;\n\n\t\t$jumlah_kemunculanA=$this->jumlah_itemset1($dataTransaksi, $atribut1);\n\t\t$jumlah_kemunculanB=$this->jumlah_itemset2($dataTransaksi, $atribut2, $atribut3);\n\n\t\t$nilai_uji_lift=$PAUB / (($jumlah_kemunculanA/$jumlah_transaksi) * ($jumlah_kemunculanB/$jumlah_transaksi));\n\t\t$korelasi_rule=($nilai_uji_lift<1)?\"korelasi negatif\": \"korelasi positif\";\n\n\t\tif($nilai_uji_lift==1) {\n\t\t\t$korelasi_rule=\"tidak ada korelasi\";\n\t\t}\n\n\n\t\t//masukkan ke table confidence\n\t\t$data=array(\"kombinasi1\"=> $kombinasi1,\n\t\t\t\"kombinasi2\"=> $kombinasi2,\n\t\t\t\"support_xUy\"=> $supp_xuy,\n\t\t\t\"support_x\"=> $supp_x,\n\t\t\t\"confidence\"=> $conf,\n\t\t\t\"lolos\"=> $lolos,\n\t\t\t\"min_support\"=> $min_support,\n\t\t\t\"min_confidence\"=> $min_confidence,\n\t\t\t\"nilai_uji_lift\"=> $nilai_uji_lift,\n\t\t\t\"korelasi_rule\"=> $korelasi_rule,\n\t\t\t\"id_process\"=> $id_process,\n\t\t\t\"jumlah_a\"=> $jumlah_kemunculanA,\n\t\t\t\"jumlah_b\"=> $jumlah_kemunculanB,\n\t\t\t\"jumlah_ab\"=> $jumlah_kemunculanAB,\n\t\t\t\"px\"=> ($jumlah_kemunculanA/$jumlah_transaksi),\n\t\t\t\"py\"=> ($jumlah_kemunculanB/$jumlah_transaksi),\n\t\t\t\"pxuy\"=> $PAUB,\n\t\t\t\"from_itemset\"=>3);\n\t\t$this->db->insert('confidence', $data);\n\t}",
"function cb_reached($current)\n{\n echo \"Current is greater than 5A: \" . $current / 1000.0 . \"\\n\";\n}",
"public function test_if_a_member_has_more_than_18_years_old_and_has_less_than_2_years_of_seniority()\n {\n $this->assertEquals(\"silver\", $this->useCase->execute(20, 1));\n }",
"public function testNice()\n {\n $cases = [\n '0.01' => '1.00%',\n '0.10' => '10.00%',\n '1' => '100.00%',\n '1.5' => '150.00%',\n '1.5000' => '150.00%',\n '1.05' => '105.00%',\n '1.0500' => '105.00%',\n '0.95' => '95.00%'\n ];\n\n foreach ($cases as $original => $expected) {\n $percentage = new DBPercentage('Probability');\n $percentage->setValue($original);\n $this->assertEquals($expected, $percentage->Nice());\n }\n }",
"public function testMileageOverBeforeBaseWarrantySuccess(){\n $coverage = array(\"name\" => \"120 Months/120,000 Miles\", \"terms\" => 120, \"miles\" => 120000);\n $test_car = CarFactory::create('Audi', 24, 10000, 700, 2019, 42);\n $test_car->testMileageOverBeforeBaseWarranty($coverage);\n $this->assertEquals($test_car->coverage_granted, 'SUCCESS');\n\n }",
"public function test_if_a_member_has_more_than_18_years_old_and_has_more_than_2_years_of_seniority()\n {\n $this->assertEquals(\"gold\", $this->useCase->execute(25, 5));\n }",
"public function getConfidence()\n {\n return $this->confidence;\n }",
"public function getConfidence()\n {\n return $this->confidence;\n }",
"function percentage_rate_class($value, $base = 50)\n {\n if(!is_numeric($value)) {\n $value = 0;\n }\n\n $percentage = (float)$value;\n\n if($percentage == 100) {\n return 'excelent';\n }\n\n if($percentage == 0) {\n return 'neutral';\n }\n\n if($percentage < $base) {\n return 'poor';\n }\n\n return 'ok';\n }",
"public function shouldGetCO(): void\n {\n $this->assertPollutantLevel('getCO', $this->faker->randomFloat(2, 0, 500));\n }",
"public function testTermOverBeforeBaseWarrantySuccess(){\n $coverage = array(\"name\" => \"120 Months/120,000 Miles\", \"terms\" => 120, \"miles\" => 120000);\n $test_car = CarFactory::create('Audi', 24, 10000, 700, 2019, 42);\n $test_car->setVehicleAgeMonths();\n $test_car->testTermOverBeforeBaseWarranty($coverage);\n $this->assertEquals($test_car->coverage_granted, 'SUCCESS');\n\n }",
"public function check_threshold( $value ) {\n\t\t\tif ( (int) $value <= 0 || (int) $value > 100 ) {\n\t\t\t\t$this->add_admin_notice( __('Please revise your flagging threshold and enter a number between 1 and 100') );\n\t\t\t}\n\t\t\treturn (int) $value;\n\t\t}",
"protected function doTestExceedsThresholdSettings() {\n // Test with valid values.\n $thresholds = array(\n 'critical' => 11,\n 'warning' => 6,\n );\n $this->submitThresholdSettings('test_sensor_exceeds', $thresholds);\n $this->assertText(SafeMarkup::format('Sensor @label saved.', array('@label' => 'Test sensor exceeds')));\n $this->assertThresholdSettingsUIDefaults('test_sensor_exceeds', $thresholds);\n\n // Make sure that it is possible to save empty thresholds.\n $thresholds = array(\n 'critical' => '',\n 'warning' => '',\n );\n $this->submitThresholdSettings('test_sensor_exceeds', $thresholds);\n $this->assertText(SafeMarkup::format('Sensor @label saved.', array('@label' => 'Test sensor exceeds')));\n $this->assertThresholdSettingsUIDefaults('test_sensor_exceeds', $thresholds);\n\n monitoring_sensor_manager()->resetCache();\n \\Drupal::service('monitoring.sensor_runner')->resetCache();\n $sensor_result = $this->runSensor('test_sensor_exceeds');\n $this->assertTrue($sensor_result->isOk());\n\n // Test validation.\n $thresholds = array(\n 'critical' => 5,\n 'warning' => 10,\n );\n $this->submitThresholdSettings('test_sensor_exceeds', $thresholds);\n $this->assertText('Warning must be lower than critical or empty.');\n\n $thresholds = array(\n 'critical' => 5,\n 'warning' => 5,\n );\n $this->submitThresholdSettings('test_sensor_exceeds', $thresholds);\n $this->assertText('Warning must be lower than critical or empty.');\n\n $thresholds = array(\n 'critical' => 'alphanumeric',\n 'warning' => 'alphanumeric',\n );\n $this->submitThresholdSettings('test_sensor_exceeds', $thresholds);\n $this->assertText('Warning must be a number.');\n $this->assertText('Critical must be a number.');\n return $thresholds;\n }",
"public function testGetDiscountValue()\n {\n\n $discountValue= $this->discountProvider->getDiscountValue(\"https://developer.github.com/v3/#http-redirects\",[12,7],1000);\n $this->assertEquals(21,$discountValue);\n\n }",
"public function test_validate_withdraw_limit()\n {\n $amount = 5000;\n $withdraw = $this->obj->validate_withdraw_limit($amount);\n $this->assertTrue($withdraw);\n }",
"public function testMileageOverBeforeBaseWarrantyFailure(){\n $coverage = array(\"name\" => \"3 Months/3,000 Miles\", \"terms\" => 3, \"miles\" => 3000);\n $test_car = CarFactory::create('Audi', 24, 10000, 700, 2019, 42);\n $test_fail = $test_car->testMileageOverBeforeBaseWarranty($coverage);\n $this->assertEquals($test_fail, 'Miles expire before warranty.');\n }",
"function dspamLevel($prob, $conf) {\n\tif (is_null($prob) or is_null($conf)) return '-';\n\t$t_prob = abs((($prob - 0.5) * 2) * 100);\n\treturn round(($t_prob + ($conf*100)) / 2);\n}",
"public function setSkillLevelupChance($value)\n {\n return $this->set(self::_SKILL_LEVELUP_CHANCE, $value);\n }",
"private function validate_percentile($new_percentile)\n\t{\n\t\tif ($new_percentile)\n\t\t{\n\t\t\t$this->form_validation->set_rules('testcat', lang('testcat'), 'callback_not_zero');\n\t\t}\n\t\t$this->form_validation->set_rules('score', lang('score'), 'trim|required|integer');\n\t\t$this->form_validation->set_rules('percentile', lang('percentile'), 'trim|required|integer|greater_than[0]|less_than[100]');\n\n\t\treturn $this->form_validation->run();\n\t}",
"public function testTermOverBeforeBaseWarrantyFailure(){\n $coverage = array(\"name\" => \"3 Months/3,000 Miles\", \"terms\" => 3, \"miles\" => 3000);\n $test_car = CarFactory::create('Audi', 24, 10000, 100000, 2019, 42);\n $test_car->setVehicleAgeMonths();\n $test_fail = $test_car->testTermOverBeforeBaseWarranty($coverage);\n $this->assertEquals($test_fail, 'Term expires before warranty.');\n }",
"public function testIsTierPriceFixed()\n {\n $this->assertTrue($this->_model->isTierPriceFixed());\n }",
"public function testGetGlobalAppreciation()\n {\n //Case of 3.5 \n $outPut = $this->utils->getGlobalAppreciation(3.5);\n $this->assertEquals(false, $outPut['th_congratulation']);\n $this->assertEquals(false, $outPut['th_encouragement']);\n $this->assertEquals(false, $outPut['th']);\n $this->assertEquals(true, $outPut['exclusion']);\n //Case of 5\n $outPut = $this->utils->getGlobalAppreciation(5);\n $this->assertEquals(false, $outPut['th_congratulation']);\n $this->assertEquals(false, $outPut['th_encouragement']);\n $this->assertEquals(false, $outPut['th']);\n $this->assertEquals(false, $outPut['exclusion']);\n //Case of 12\n $outPut = $this->utils->getGlobalAppreciation(12);\n $this->assertEquals(false, $outPut['th_congratulation']);\n $this->assertEquals(false, $outPut['th_encouragement']);\n $this->assertEquals(true, $outPut['th']);\n $this->assertEquals(false, $outPut['exclusion']);\n //Case of 14\n $outPut = $this->utils->getGlobalAppreciation(14);\n $this->assertEquals(true, $outPut['th_congratulation']);\n $this->assertEquals(true, $outPut['th_encouragement']);\n $this->assertEquals(true, $outPut['th']);\n $this->assertEquals(false, $outPut['exclusion']);\n }"
] |
[
"0.5690967",
"0.5610204",
"0.5610204",
"0.55953085",
"0.55367833",
"0.5518459",
"0.55069643",
"0.55037606",
"0.53721935",
"0.53665745",
"0.5363143",
"0.5331845",
"0.5283995",
"0.5231396",
"0.52021",
"0.52021",
"0.51882166",
"0.5164025",
"0.5156603",
"0.5129358",
"0.5112678",
"0.51109135",
"0.50998926",
"0.50624585",
"0.50559855",
"0.5014596",
"0.49493432",
"0.49424273",
"0.4934665",
"0.4928811"
] |
0.70018923
|
0
|
Test setting confidence to less than 0.
|
public function testConfidenceLessThan0()
{
new Text('Foo bar', -1);
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function testConfidenceMoreThan100()\n {\n new Text('Foo bar', 101);\n }",
"function hitung_confidence($supp_xuy, $min_support, $min_confidence, $atribut1, $atribut2, $atribut3, $id_process, $dataTransaksi, $jumlah_transaksi) {\n\n\t\t//hitung nilai support $nilai_support_x seperti di itemset2\n\t\t$jml_itemset2=$this->jumlah_itemset2($dataTransaksi, $atribut1, $atribut2);\n\t\t$nilai_support_x=($jml_itemset2/$jumlah_transaksi) * 100;\n\n\t\t$kombinasi1=$atribut1.\" , \".$atribut2;\n\t\t$kombinasi2=$atribut3;\n\t\t$supp_x=$nilai_support_x; //$row1_['support'];\n\t\t$conf=($supp_xuy/$supp_x)*100;\n\t\t//lolos seleksi min confidence itemset3\n\t\t$lolos=($conf >=$min_confidence)? 1: 0;\n\n\t\t//hitung korelasi lift\n\t\t$jumlah_kemunculanAB=$this->jumlah_itemset3($dataTransaksi, $atribut1, $atribut2, $atribut3);\n\t\t$PAUB=$jumlah_kemunculanAB/$jumlah_transaksi;\n\n\t\t$jumlah_kemunculanA=$this->jumlah_itemset2($dataTransaksi, $atribut1, $atribut2);\n\t\t$jumlah_kemunculanB=$this->jumlah_itemset1($dataTransaksi, $atribut3);\n\n\t\t//$nilai_uji_lift = $PAUB / $jumlah_kemunculanA * $jumlah_kemunculanB;\n\t\t$nilai_uji_lift=$PAUB / (($jumlah_kemunculanA/$jumlah_transaksi) * ($jumlah_kemunculanB/$jumlah_transaksi));\n\t\t$korelasi_rule=($nilai_uji_lift<1)?\"korelasi negatif\": \"korelasi positif\";\n\n\t\tif($nilai_uji_lift==1) {\n\t\t\t$korelasi_rule=\"tidak ada korelasi\";\n\t\t}\n\n\t\t//masukkan ke table confidence\n\t\t$data=array(\"kombinasi1\"=> $kombinasi1,\n\t\t\t\"kombinasi2\"=> $kombinasi2,\n\t\t\t\"support_xUy\"=> $supp_xuy,\n\t\t\t\"support_x\"=> $supp_x,\n\t\t\t\"confidence\"=> $conf,\n\t\t\t\"lolos\"=> $lolos,\n\t\t\t\"min_support\"=> $min_support,\n\t\t\t\"min_confidence\"=> $min_confidence,\n\t\t\t\"nilai_uji_lift\"=> $nilai_uji_lift,\n\t\t\t\"korelasi_rule\"=> $korelasi_rule,\n\t\t\t\"id_process\"=> $id_process,\n\t\t\t\"jumlah_a\"=> $jumlah_kemunculanA,\n\t\t\t\"jumlah_b\"=> $jumlah_kemunculanB,\n\t\t\t\"jumlah_ab\"=> $jumlah_kemunculanAB,\n\t\t\t\"px\"=> ($jumlah_kemunculanA/$jumlah_transaksi),\n\t\t\t\"py\"=> ($jumlah_kemunculanB/$jumlah_transaksi),\n\t\t\t\"pxuy\"=> $PAUB,\n\t\t\t\"from_itemset\"=>3);\n\t\t$this->db->insert('confidence', $data);\n\n\t}",
"function hitung_confidence2($supp_xuy, $min_support, $min_confidence,$atribut1, $atribut2, $id_process, $dataTransaksi, $jumlah_transaksi) {\n\t\t$jml_itemset1=$this->jumlah_itemset1($dataTransaksi, $atribut1);\n\t\t$nilai_support_x=($jml_itemset1/$jumlah_transaksi) * 100;\n\n\t\t$kombinasi1=$atribut1;\n\t\t$kombinasi2=$atribut2;\n\t\t$supp_x=$nilai_support_x; //$row1_['support'];\n\t\t$conf=($supp_xuy/$supp_x)*100;\n\t\t//lolos seleksi min confidence itemset3\n\t\t$lolos=($conf >=$min_confidence)? 1: 0;\n\n\t\t//hitung korelasi lift\n\t\t$jumlah_kemunculanAB=$this->jumlah_itemset2($dataTransaksi, $atribut1, $atribut2);\n\t\t$PAUB=$jumlah_kemunculanAB/$jumlah_transaksi;\n\n\t\t$jumlah_kemunculanA=$this->jumlah_itemset1($dataTransaksi, $atribut1);\n\t\t$jumlah_kemunculanB=$this->jumlah_itemset1($dataTransaksi, $atribut2);\n\n\t\t$nilai_uji_lift=$PAUB / (($jumlah_kemunculanA/$jumlah_transaksi) * ($jumlah_kemunculanB/$jumlah_transaksi));\n\t\t$korelasi_rule=($nilai_uji_lift<1)?\"korelasi negatif\": \"korelasi positif\";\n\n\t\tif($nilai_uji_lift==1) {\n\t\t\t$korelasi_rule=\"tidak ada korelasi\";\n\t\t}\n\n //masukkan ke table confidence\n $data=array(\"kombinasi1\"=> $kombinasi1,\n\t\t\t\t\"kombinasi2\"=> $kombinasi2,\n\t\t\t\t\"support_xUy\"=> $supp_xuy,\n\t\t\t\t\"support_x\"=> $supp_x,\n\t\t\t\t\"confidence\"=> $conf,\n\t\t\t\t\"lolos\"=> $lolos,\n\t\t\t\t\"min_support\"=> $min_support,\n\t\t\t\t\"min_confidence\"=> $min_confidence,\n\t\t\t\t\"nilai_uji_lift\"=> $nilai_uji_lift,\n\t\t\t\t\"korelasi_rule\"=> $korelasi_rule,\n\t\t\t\t\"id_process\"=> $id_process,\n\t\t\t\t\"jumlah_a\"=> $jumlah_kemunculanA,\n\t\t\t\t\"jumlah_b\"=> $jumlah_kemunculanB,\n\t\t\t\t\"jumlah_ab\"=> $jumlah_kemunculanAB,\n\t\t\t\t\"px\"=> ($jumlah_kemunculanA/$jumlah_transaksi),\n\t\t\t\t\"py\"=> ($jumlah_kemunculanB/$jumlah_transaksi),\n\t\t\t\t\"pxuy\"=> $PAUB,\n \"from_itemset\"=>2);\n $this->db->insert('confidence', $data);\n\n\t}",
"function hitung_confidence1($supp_xuy, $min_support, $min_confidence, $atribut1, $atribut2, $atribut3, $id_process, $dataTransaksi, $jumlah_transaksi) {\n\n\t\t//hitung nilai support seperti itemset1\n\t\t$jml_itemset1=$this->jumlah_itemset1($dataTransaksi, $atribut1);\n\t\t$nilai_support_x=($jml_itemset1/$jumlah_transaksi) * 100;\n\n\t\t$kombinasi1=$atribut1;\n\t\t$kombinasi2=$atribut2.\" , \".$atribut3;\n\t\t$supp_x=$nilai_support_x; //$row4_['support'];\n\t\t$conf=($supp_xuy/$supp_x)*100;\n\t\t//lolos seleksi min confidence itemset3\n\t\t$lolos=($conf >=$min_confidence)? 1: 0;\n\n\t\t//hitung korelasi lift\n\t\t$jumlah_kemunculanAB=$this->jumlah_itemset3($dataTransaksi, $atribut1, $atribut2, $atribut3);\n\t\t$PAUB=$jumlah_kemunculanAB/$jumlah_transaksi;\n\n\t\t$jumlah_kemunculanA=$this->jumlah_itemset1($dataTransaksi, $atribut1);\n\t\t$jumlah_kemunculanB=$this->jumlah_itemset2($dataTransaksi, $atribut2, $atribut3);\n\n\t\t$nilai_uji_lift=$PAUB / (($jumlah_kemunculanA/$jumlah_transaksi) * ($jumlah_kemunculanB/$jumlah_transaksi));\n\t\t$korelasi_rule=($nilai_uji_lift<1)?\"korelasi negatif\": \"korelasi positif\";\n\n\t\tif($nilai_uji_lift==1) {\n\t\t\t$korelasi_rule=\"tidak ada korelasi\";\n\t\t}\n\n\n\t\t//masukkan ke table confidence\n\t\t$data=array(\"kombinasi1\"=> $kombinasi1,\n\t\t\t\"kombinasi2\"=> $kombinasi2,\n\t\t\t\"support_xUy\"=> $supp_xuy,\n\t\t\t\"support_x\"=> $supp_x,\n\t\t\t\"confidence\"=> $conf,\n\t\t\t\"lolos\"=> $lolos,\n\t\t\t\"min_support\"=> $min_support,\n\t\t\t\"min_confidence\"=> $min_confidence,\n\t\t\t\"nilai_uji_lift\"=> $nilai_uji_lift,\n\t\t\t\"korelasi_rule\"=> $korelasi_rule,\n\t\t\t\"id_process\"=> $id_process,\n\t\t\t\"jumlah_a\"=> $jumlah_kemunculanA,\n\t\t\t\"jumlah_b\"=> $jumlah_kemunculanB,\n\t\t\t\"jumlah_ab\"=> $jumlah_kemunculanAB,\n\t\t\t\"px\"=> ($jumlah_kemunculanA/$jumlah_transaksi),\n\t\t\t\"py\"=> ($jumlah_kemunculanB/$jumlah_transaksi),\n\t\t\t\"pxuy\"=> $PAUB,\n\t\t\t\"from_itemset\"=>3);\n\t\t$this->db->insert('confidence', $data);\n\t}",
"public function setConfidence($var)\n {\n GPBUtil::checkFloat($var);\n $this->confidence = $var;\n\n return $this;\n }",
"public function setConfidence($var)\n {\n GPBUtil::checkFloat($var);\n $this->confidence = $var;\n\n return $this;\n }",
"public function getConfidence()\n {\n return $this->confidence;\n }",
"public function getConfidence()\n {\n return $this->confidence;\n }",
"public function testTermOverBeforeBaseWarrantySuccess(){\n $coverage = array(\"name\" => \"120 Months/120,000 Miles\", \"terms\" => 120, \"miles\" => 120000);\n $test_car = CarFactory::create('Audi', 24, 10000, 700, 2019, 42);\n $test_car->setVehicleAgeMonths();\n $test_car->testTermOverBeforeBaseWarranty($coverage);\n $this->assertEquals($test_car->coverage_granted, 'SUCCESS');\n\n }",
"protected function doTestExceedsThresholdSettings() {\n // Test with valid values.\n $thresholds = array(\n 'critical' => 11,\n 'warning' => 6,\n );\n $this->submitThresholdSettings('test_sensor_exceeds', $thresholds);\n $this->assertText(SafeMarkup::format('Sensor @label saved.', array('@label' => 'Test sensor exceeds')));\n $this->assertThresholdSettingsUIDefaults('test_sensor_exceeds', $thresholds);\n\n // Make sure that it is possible to save empty thresholds.\n $thresholds = array(\n 'critical' => '',\n 'warning' => '',\n );\n $this->submitThresholdSettings('test_sensor_exceeds', $thresholds);\n $this->assertText(SafeMarkup::format('Sensor @label saved.', array('@label' => 'Test sensor exceeds')));\n $this->assertThresholdSettingsUIDefaults('test_sensor_exceeds', $thresholds);\n\n monitoring_sensor_manager()->resetCache();\n \\Drupal::service('monitoring.sensor_runner')->resetCache();\n $sensor_result = $this->runSensor('test_sensor_exceeds');\n $this->assertTrue($sensor_result->isOk());\n\n // Test validation.\n $thresholds = array(\n 'critical' => 5,\n 'warning' => 10,\n );\n $this->submitThresholdSettings('test_sensor_exceeds', $thresholds);\n $this->assertText('Warning must be lower than critical or empty.');\n\n $thresholds = array(\n 'critical' => 5,\n 'warning' => 5,\n );\n $this->submitThresholdSettings('test_sensor_exceeds', $thresholds);\n $this->assertText('Warning must be lower than critical or empty.');\n\n $thresholds = array(\n 'critical' => 'alphanumeric',\n 'warning' => 'alphanumeric',\n );\n $this->submitThresholdSettings('test_sensor_exceeds', $thresholds);\n $this->assertText('Warning must be a number.');\n $this->assertText('Critical must be a number.');\n return $thresholds;\n }",
"public function testGetDiscountValueZero()\n {\n $discountValue= $this->discountProvider->getDiscountValue(\"https://developer.github.com/v3/#http-redirects\",[13,7],1000);\n $this->assertEquals(0,$discountValue);\n }",
"function testMinval(){\n\t\t#mdx:minval\n\t\tParam::get('age')->filters()->minval(1, \"Age cannot be less than %d!\");\n\t\t$error = Param::get('age')->process(['age'=>0])->error;\n\t\t#/mdx var_dump($error)\n\n\t\t$this->assertContains(\"less than 1\", $error);\n\n\t}",
"function above (float $value, float $min) : float\n{\n return $value < $min ? $min : $value;\n}",
"function cb_reached($current)\n{\n echo \"Current is greater than 5A: \" . $current / 1000.0 . \"\\n\";\n}",
"public function getThreshold()\n {\n return 5000;\n }",
"public function testMileageOverBeforeBaseWarrantySuccess(){\n $coverage = array(\"name\" => \"120 Months/120,000 Miles\", \"terms\" => 120, \"miles\" => 120000);\n $test_car = CarFactory::create('Audi', 24, 10000, 700, 2019, 42);\n $test_car->testMileageOverBeforeBaseWarranty($coverage);\n $this->assertEquals($test_car->coverage_granted, 'SUCCESS');\n\n }",
"public function test_it_should_not_decrease_quality_of_ordinary_item_below_zero()\r\n {\r\n $this->itemBuilder->ordinaryItem()->ofNoQuality();\r\n\r\n $this->updateQuality();\r\n\r\n $this->assertThatQualityIsNot($this->negative());\r\n }",
"public function check_threshold( $value ) {\n\t\t\tif ( (int) $value <= 0 || (int) $value > 100 ) {\n\t\t\t\t$this->add_admin_notice( __('Please revise your flagging threshold and enter a number between 1 and 100') );\n\t\t\t}\n\t\t\treturn (int) $value;\n\t\t}",
"public function getPositiveFeedbackPercent()\n {\n return $this->positiveFeedbackPercent;\n }",
"public function testIsTierPriceFixed()\n {\n $this->assertTrue($this->_model->isTierPriceFixed());\n }",
"public function adtest() {\n $critical = 1.092; // Corresponds to alpha = 0.01\n $nd = new \\webd\\stats\\NormalDistribution();\n $sorted = $this->sort();\n $n = $this->length();\n $A2 = -$n;\n for ($i = 1; $i <= $n; $i++) {\n $A2 += -(2 * $i - 1) / $n * ( log($nd->cumulativeProbability($sorted->value[$i - 1])) + log(1 - $nd->cumulativeProbability($sorted->value[$n - $i])) );\n }\n $A2_star = $A2 * (1 + 4 / $n - 25 / ($n * $n));\n if ($A2_star > $critical) {\n return FALSE;\n } else {\n // Data seems to follow a normal law\n return TRUE;\n }\n }",
"public function shouldSample()\n {\n return lcg_value() <= $this->rate;\n }",
"public function shouldGetCO(): void\n {\n $this->assertPollutantLevel('getCO', $this->faker->randomFloat(2, 0, 500));\n }",
"public function testZeroDiscipline()\n {\n $result = false;\n $student = new StudentProfile();\n $status = check24Discipline($student);\n if(count($status[\"reason\"]) == 0 && $status[\"result\"] == true)\n $result = true;\n $this->assertEquals(true, $result);\n }",
"public function getAverageConfidence(): float\n {\n return RoadDamageReport::where('roaddamage_id', $this->id)\n ->avg('confidence');\n }",
"public function getAdjustmentPositive();",
"function single_trial($cutoff) {\n global $PRIOR_LOWER_MAX;\n $lower_value = $PRIOR_LOWER_MAX * (float) rand() / (float) getrandmax(); \n $higher_value = 2 * $lower_value;\n if (rand(0, 1) == 0) {\n return $lower_value >= $cutoff ? $lower_value : $higher_value;\n } else {\n return $higher_value >= $cutoff ? $higher_value : $lower_value;\n }\n}",
"public function testTermOverBeforeBaseWarrantyFailure(){\n $coverage = array(\"name\" => \"3 Months/3,000 Miles\", \"terms\" => 3, \"miles\" => 3000);\n $test_car = CarFactory::create('Audi', 24, 10000, 100000, 2019, 42);\n $test_car->setVehicleAgeMonths();\n $test_fail = $test_car->testTermOverBeforeBaseWarranty($coverage);\n $this->assertEquals($test_fail, 'Term expires before warranty.');\n }",
"public function getSensitivity()\n {\n return isset($this->sensitivity) ? $this->sensitivity : 0;\n }",
"protected function doTestOuterThresholdSettings() {\n // Test with valid values.\n $thresholds = array(\n 'critical_low' => 5,\n 'warning_low' => 6,\n 'critical_high' => 15,\n 'warning_high' => 14,\n );\n $this->submitThresholdSettings('test_sensor_outer', $thresholds);\n $this->assertText(SafeMarkup::format('Sensor @label saved.', array('@label' => 'Test sensor outer')));\n $this->assertThresholdSettingsUIDefaults('test_sensor_outer', $thresholds);\n\n // Make sure that it is possible to save empty outer thresholds.\n $thresholds = array(\n 'critical_low' => '',\n 'warning_low' => '',\n 'critical_high' => '',\n 'warning_high' => '',\n );\n $this->submitThresholdSettings('test_sensor_outer', $thresholds);\n $this->assertText(SafeMarkup::format('Sensor @label saved.', array('@label' => 'Test sensor outer')));\n $this->assertThresholdSettingsUIDefaults('test_sensor_outer', $thresholds);\n\n // Test validation.\n $thresholds = array(\n 'critical_low' => 5,\n 'warning_low' => 15,\n 'critical_high' => 10,\n 'warning_high' => 20,\n );\n $this->submitThresholdSettings('test_sensor_outer', $thresholds);\n $this->assertText('Warning high must be lower than critical high or empty.');\n\n $thresholds = array(\n 'critical_low' => 5,\n 'warning_low' => 5,\n 'critical_high' => 5,\n 'warning_high' => 5,\n );\n $this->submitThresholdSettings('test_sensor_outer', $thresholds);\n $this->assertText('Warning low must be lower than warning high or empty.');\n\n $thresholds = array(\n 'critical_low' => 'alphanumeric',\n 'warning_low' => 'alphanumeric',\n 'critical_high' => 'alphanumeric',\n 'warning_high' => 'alphanumeric',\n );\n $this->submitThresholdSettings('test_sensor_outer', $thresholds);\n $this->assertText('Warning low must be a number.');\n $this->assertText('Warning high must be a number.');\n $this->assertText('Critical low must be a number.');\n $this->assertText('Critical high must be a number.');\n\n $thresholds = array(\n 'critical_low' => 45,\n 'warning_low' => 35,\n 'critical_high' => 45,\n 'warning_high' => 35,\n );\n $this->submitThresholdSettings('test_sensor_outer', $thresholds);\n $this->assertText('Warning low must be lower than warning high or empty.');\n\n $thresholds = array(\n 'critical_low' => 50,\n 'warning_low' => 95,\n 'critical_high' => 55,\n 'warning_high' => 100,\n );\n $this->submitThresholdSettings('test_sensor_outer', $thresholds);\n $this->assertText('Warning high must be lower than critical high or empty.');\n }"
] |
[
"0.59734493",
"0.57204914",
"0.5684587",
"0.56038666",
"0.5570582",
"0.5570582",
"0.52460986",
"0.52460986",
"0.5235999",
"0.5199162",
"0.5176227",
"0.5162097",
"0.5142227",
"0.5131518",
"0.5122652",
"0.51221347",
"0.50832576",
"0.50669444",
"0.50429314",
"0.5028562",
"0.5016207",
"0.49709538",
"0.49565628",
"0.49386463",
"0.4938279",
"0.4936101",
"0.49261835",
"0.49235573",
"0.492271",
"0.49004078"
] |
0.67404616
|
0
|
Make a terran attack from Player1 to Player2
|
static function terranAttack($player1,$player2,&$logManager,$language){
$dices = DiceManager::rollCombatDice($player1, $player2);
$logManager->addLog('{Player1} '.$language['rolls'].' '.implode(";",array_values($dices[0])));
$logManager->addLog('{Player2} '.$language['rolls'].' '.implode(";",array_values($dices[1])));
$unitLost = array(0=>0,1=>0);
for ($i=0;$i<count($dices[1]);$i++){
if ($dices[0][$i] <= $dices[1][$i]){
$unitLost[0] += 1;
}
else {
$unitLost[1] += 1;
}
}
$logManager->addLog('{Player1} '.$language['losts'].' '.$unitLost[0].' '.$language['units']);
$logManager->addLog('{Player2} '.$language['losts'].' '.$unitLost[1].' '.$language['units']);
return $unitLost;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function attackFighter($idPlayer1, $idPlayer2) {\n // Retrieve the two fighters entities thanks to the players IDs\n $fighter1 = $this->Fighters->getFighter($idPlayer1);\n $fighter2 = $this->Fighters->getFighter($idPlayer2);\n\n // Determine if the attack succeed, according to the given formula\n $doAttackSucceed = $this->doAttackSucceed($fighter1->level, $fighter2->level);\n $this->set('test4', $doAttackSucceed);\n \n // If the attack succeeds, decrement health of fighter injured\n if($doAttackSucceed == true)\n {\n $fighter2->current_health -= $fighter1->skill_strength;\n $fighter1->xp ++;\n $this->Fighters->save($fighter1);\n $this->Fighters->save($fighter2);\n\n // If the attacked fighter current health is at 0, delete it and create new fighter. Fighter 1 wins XP equals to fighter 2 level.\n if($fighter2->current_health == 0)\n {\n $fighter1->xp += $fighter2->level;\n $this->deleteFighter($idPlayer2);\n }\n \n \n }\n \n \n return $doAttackSucceed;\n }",
"function turnfight($expgain,$goldgain,$action,$addres) \n{\n global $player;\n global $smarty;\n global $db;\n global $title;\n global $enemy;\n global $myczaro;\n global $zmeczenie;\n global $arrEquip;\n global $myunik;\n global $amount;\n global $myagility;\n global $intPoisoned;\n global $arrTags;\n\n $arrEquip = $player -> equipment();\n $player->curstats($arrEquip);\n $myczaro = $db -> Execute(\"SELECT * FROM czary WHERE status='E' AND gracz=\".$player -> id.\" AND typ='O'\");\n $fight = $db -> Execute(\"SELECT fight FROM players WHERE id=\".$player -> id);\n\n $player->user = $arrTags[$player->tribe][0].' '.$player->user.' '.$arrTags[$player->tribe][1];\n\n if ($fight -> fields['fight'] == 0 && $title == 'Arena Walk') \n {\n\terror (NO_ENEMY);\n }\n $premia = 0;\n $zmeczenie = 0;\n if (empty ($enemy['id'])) \n {\n $location = $db -> Execute(\"SELECT miejsce FROM players WHERE id=\".$player -> id);\n if ($location -> fields['miejsce'] == 'Góry') \n {\n\t $intRoll2 = rand(1, 100);\n\t if ($intRoll2 < 25)\n\t {\n\t\t$enemy1 = $db->SelectLimit(\"SELECT * FROM `monsters` WHERE `level`<=\".$player->level.\" AND `location`='Altara' ORDER BY RAND()\", 1);\n\t }\n\t elseif ($intRoll2 > 24 && $intRoll2 < 90)\n\t {\n\t\t$enemy1 = $db->SelectLimit(\"SELECT * FROM `monsters` WHERE `level`<=\".$player->level.\" AND `location`='Altara' ORDER BY `level` DESC\", 1);\n\t }\n\t else\n\t {\n\t\t$enemy1 = $db->SelectLimit(\"SELECT * FROM `monsters` WHERE `level`>=\".$player->level.\" AND `location`='Altara' ORDER BY RAND()\", 1);\n\t }\n $enemy = array(\"strength\" => $enemy1 -> fields['strength'], \"agility\" => $enemy1 -> fields['agility'], \"speed\" => $enemy1 -> fields['speed'], \"endurance\" => $enemy1 -> fields['endurance'], \"hp\" => $enemy1 -> fields['hp'], \"name\" => $enemy1 -> fields['name'], \"exp1\" => $enemy1 -> fields['exp1'], \"exp2\" => $enemy1 -> fields['exp2'], \"level\" => $enemy1 -> fields['level']);\n $enemy1 -> Close();\n }\n if ($location -> fields['miejsce'] == 'Las') \n {\n\t $intRoll2 = rand(1, 100);\n\t if ($intRoll2 < 25)\n\t {\n\t\t$enemy1 = $db->SelectLimit(\"SELECT * FROM `monsters` WHERE `level`<=\".$player->level.\" AND `location`='Ardulith' ORDER BY RAND()\", 1);\n\t }\n\t elseif ($intRoll2 > 24 && $intRoll2 < 90)\n\t {\n\t\t$enemy1 = $db->SelectLimit(\"SELECT * FROM `monsters` WHERE `level`<=\".$player->level.\" AND `location`='Ardulith' ORDER BY `level` DESC\", 1);\n\t }\n\t else\n\t {\n\t\t$enemy1 = $db->SelectLimit(\"SELECT * FROM `monsters` WHERE `level`>=\".$player->level.\" AND `location`='Ardulith' ORDER BY RAND()\", 1);\n\t }\n $enemy = array(\"strength\" => $enemy1 -> fields['strength'], \"agility\" => $enemy1 -> fields['agility'], \"speed\" => $enemy1 -> fields['speed'], \"endurance\" => $enemy1 -> fields['endurance'], \"hp\" => $enemy1 -> fields['hp'], \"name\" => $enemy1 -> fields['name'], \"exp1\" => $enemy1 -> fields['exp1'], \"exp2\" => $enemy1 -> fields['exp2'], \"level\" => $enemy1 -> fields['level']);\n $enemy1 -> Close();\n }\n }\n if ($title == 'Arena Walk') \n {\n $arrClass = array('Wojownik','Rzemieślnik', 'Złodziej', 'Barbarzyńca');\n if (in_array($player -> clas, $arrClass) && $myczaro -> fields['id']) \n {\n error (ONLY_MAGE);\n }\n }\n if ($arrEquip[2][0]) \n {\n $premia = ($premia + $arrEquip[2][2]);\n }\n if ($arrEquip[4][0]) \n {\n $premia = ($premia + $arrEquip[4][2]);\n }\n if ($arrEquip[5][0]) \n {\n $premia = ($premia + $arrEquip[5][2]);\n }\n if ($arrEquip[3][0]) \n {\n $premia = ($premia + $arrEquip[3][2]);\n }\n if ($player -> clas == 'Wojownik' || $player -> clas == 'Barbarzyńca') \n {\n $enemy['damage'] = ($enemy['strength'] - ($player -> level + $player -> cond + $premia));\n } \n else \n {\n $enemy['damage'] = ($enemy['strength'] - ($player -> cond + $premia));\n }\n if ($myczaro -> fields['id']) \n {\n $myczarobr = ($player -> wisdom * $myczaro -> fields['obr']) - (($myczaro -> fields['obr'] * $player -> wisdom) * ($arrEquip[3][4] / 100));\n if ($arrEquip[2][0]) \n {\n $myczarobr = ($myczarobr - (($myczaro -> fields['obr'] * $player -> wisdom) * ($arrEquip[2][4] / 100)));\n }\n if ($arrEquip[4][0]) \n {\n $myczarobr = ($myczarobr - (($myczaro -> fields['obr'] * $player -> wisdom) * ($arrEquip[4][4] / 100)));\n }\n if ($arrEquip[5][0]) \n {\n $myczarobr = ($myczarobr - (($myczaro -> fields['obr'] * $player -> wisdom) * ($arrEquip[5][4] / 100)));\n }\n if ($arrEquip[7][0]) \n {\n $intN = 6 - (int)($arrEquip[7][4] / 20);\n $intBonus = (10 / $intN) * $player -> level * rand(1, $intN);\n $myczarobr = ($myczarobr + $intBonus);\n }\n if ($myczarobr < 0) \n {\n $myczarobr = 0;\n }\n $myobrona = ($myczarobr + $player -> cond + $premia);\n $enemy['damage'] = ($enemy['strength'] - $myobrona);\n }\n if (!$arrEquip[3][0] && !$myczaro -> fields['id']) \n {\n $enemy['damage'] = ($enemy['strength'] - $player -> cond);\n }\n $gmagia = 0;\n if (!isset($_SESSION['round']))\n {\n $_SESSION['round'] = 1;\n }\n $smarty -> assign (\"Message\", \"<ul><li><b>\".$player -> user.\"</b> \".VERSUS.\" <b>\".$enemy['name'].\"</b><br />\");\n $smarty -> display ('error1.tpl');\n /**\n * Count points in fight\n */\n if (!isset($_SESSION['points']) || $_SESSION['points'] == 0)\n {\n $_SESSION['points'] = ceil($player->speed / $enemy['speed']);\n }\n /**\n * Count dodge - player and monster\n */\n if ($player -> clas == 'Wojownik' || $player -> clas == 'Barbarzyńca') \n {\n $myunik = (($player->agility - $enemy['agility']) + $player -> level + $player -> miss);\n $eunik = (($enemy['agility'] - $player->agility) - ($player -> attack + $player -> level));\n\tif ($arrEquip[11][0])\n\t {\n\t $eunik -= ($player->attack / 5);\n\t }\n }\n if ($player -> clas == 'Rzemieślnik' || $player -> clas == 'Złodziej' || $player -> clas == '') \n {\n $myunik = ($player->agility - $enemy['agility'] + $player -> miss);\n $eunik = (($enemy['agility'] - $player->agility) - $player -> attack);\n }\n if ($player -> clas == 'Mag') \n {\n $myunik = ($player->agility - $enemy['agility'] + $player -> miss);\n $eunik = (($enemy['agility'] - $player->agility) - ($player -> magic + $player -> level));\n }\n if (!isset($myunik)) \n {\n $myunik = 1;\n }\n if (!isset($eunik)) \n {\n $eunit = 1;\n }\n if ($eunik < 1) \n {\n $eunik = 1;\n }\n if ($_SESSION['points'] > 5) \n {\n $_SESSION['points'] = 5;\n }\n if (isset ($_SESSION['exhaust'])) \n {\n $zmeczenie = $_SESSION['exhaust'];\n }\n if (isset($_SESSION['miss']) && $_SESSION['miss'] > $myunik) \n {\n $myunik = $_SESSION['miss'];\n }\n $amount = 1;\n if (isset ($_SESSION['razy'])) \n {\n $amount = $_SESSION['razy'];\n }\n if (isset($_SESSION['mon0'])) \n {\n $temp = 0;\n for ($k = 0; $k < $amount; $k ++) \n {\n $strIndex = \"mon\".$k;\n if ($_SESSION[$strIndex] > 0) \n {\n $temp = $temp + 1;\n }\n }\n }\n else\n {\n $temp = $amount;\n $_SESSION['amount'] = $amount;\n for ($k = 0; $k < $amount; $k ++) \n {\n $strIndex = \"mon\".$k;\n $_SESSION[$strIndex] = $enemy['hp'];\n }\n }\n if (isset($temp)) \n {\n if ($temp < 6 && $temp > 0)\n {\n if ($myunik < 1)\n {\n $myunik = 1;\n }\n if (isset($myunik))\n {\n $myunik = ceil($myunik / $temp);\n }\n else\n {\n $myunik = 0;\n }\n }\n else\n {\n $myunik = 1;\n }\n }\n else\n {\n if ($amount < 6)\n {\n if (isset($myunik))\n {\n $myunik = ceil($myunik / $amount);\n }\n else\n {\n $myunik = 0;\n }\n }\n else\n {\n $myunik = 1;\n }\n }\n if ($myunik < 1) \n {\n $myunik = 1;\n }\n $attacks = ceil($enemy['speed'] / $player->speed);\n if ($attacks > 5) \n {\n $attacks = 5;\n }\n if (!isset($_POST['action'])) \n {\n $_POST['action'] = '';\n }\n /**\n * If fight is longer than 24 rounds\n */\n if (isset($_SESSION['round']) && $_SESSION['round'] > 24)\n {\n $db -> Execute(\"UPDATE `players` SET `fight`=0, `hp`=\".$player -> hp.\", `bless`='', `blessval`=0 WHERE `id`=\".$player -> id);\n unset($_SESSION['exhaust'], $_SESSION['round'], $_SESSION['points'], $_SESSION['dodge']);\n for ($k = 0; $k < $amount; $k ++) \n {\n $strIndex = \"mon\".$k;\n unset($_SESSION[$strIndex]);\n }\n if ($title == 'Arena Walk') \n {\n if (!$intPoisoned)\n {\n $smarty -> assign (\"Message\", \"</ul>\".NOT_DECIDE.\"...<br /><ul><li><b>\".B_OPTIONS.\"</a><br /></li></ul>\");\n }\n else\n {\n $smarty -> assign (\"Message\", \"</ul><br /><ul><li><b>\".B_OPTIONS.\"</a><br /></li></ul>\");\n }\n $smarty -> display ('error1.tpl');\n }\n\telseif (in_array($title, array('Portal', 'Astralny plan')))\n\t {\n\t $db->Execute(\"UPDATE `players` SET `miejsce`='Altara' WHERE `id`=\".$player->id);\n\t }\n return;\n }\n $fight -> Close();\n if ($_POST['action'] == 'drink' && $_SESSION['points'] > 0) \n {\n $_SESSION['points'] = $_SESSION['points'] - 1;\n drink ($_POST['potion2']);\n $objMana = $db -> Execute(\"SELECT pm FROM players WHERE id=\".$player -> id);\n $player -> mana = $objMana -> fields['pm'];\n $objMana -> Close();\n if ($_SESSION['points'] >= $attacks && $player -> hp > 0) \n {\n fightmenu($_SESSION['points'],$zmeczenie,$_SESSION['round'],$addres);\n }\n }\n if ($_POST['action'] == 'use' && $_SESSION['points'] > 0) \n {\n $_SESSION['points'] = $_SESSION['points'] - 1;\n if (!isset($_POST['arrows']))\n {\n $_POST['arrows'] = 0;\n }\n equip ($_POST['arrows']);\n $arrEquip = $player -> equipment();\n if ($_SESSION['points'] >= $attacks) \n {\n fightmenu($_SESSION['points'],$zmeczenie,$_SESSION['round'],$addres);\n }\n }\n if ($_POST['action'] == 'weapons' && $_SESSION['points'] > 0) \n {\n $_SESSION['points'] = $_SESSION['points'] - 2;\n if (!isset($_POST['weapon']))\n {\n $_POST['weapon'] = 0;\n }\n equip ($_POST['weapon']);\n $arrEquip = $player -> equipment();\n if ($_SESSION['points'] >= $attacks) \n {\n fightmenu($_SESSION['points'],$zmeczenie,$_SESSION['round'],$addres);\n }\n }\n if ($_POST['action'] == 'escape') \n {\n $chance = (rand(1, $player -> level * 100) + $player -> speed - $enemy['agility']);\n if ($chance > 0) \n {\n $expgain = rand($enemy['exp1'],$enemy['exp2']);\n $expgain = (ceil($expgain / 100));\n $smarty -> assign (\"Message\", ESCAPE_SUCC.\" \".$enemy['name'].YOU_GAIN1.\" \".$expgain.\" \".EXP_PTS.\"<br /></li></ul>\");\n $smarty -> display ('error1.tpl');\n checkexp($player -> exp,$expgain,$player -> level,$player -> race,$player -> user,$player -> id,0,0,$player -> id,'',0);\n $db -> Execute(\"UPDATE players SET fight=0, bless='', blessval=0 WHERE id=\".$player -> id);\n $points = $attacks * 2;\n $temp = 1;\n unset($_SESSION['exhaust'], $_SESSION['round'], $_SESSION['points'], $_SESSION['dodge']);\n for ($k = 0; $k < $amount; $k ++) \n {\n $strIndex = \"mon\".$k;\n unset($_SESSION[$strIndex]);\n }\n if ($title == \"Arena Walk\") \n {\n $smarty -> assign (\"Message\", \"</ul><ul><li><b>\".B_OPTIONS.\"</a><br /></li></ul>\");\n $smarty -> display ('error1.tpl');\n }\n if ($title == 'Astralny plan' || $title == 'Portal')\n {\n $db -> Execute(\"UPDATE `players` SET `fight`=9999 WHERE id=\".$player -> id);\n }\n\t if ($title == 'Przygoda')\n\t {\n\t\t$db -> Execute(\"UPDATE `players` SET `fight`=-1 WHERE id=\".$player -> id);\n\t }\n } \n else \n {\n $smarty -> assign (\"Message\", \"<br />\".ESCAPE_FAIL.\" \".$enemy['name'].\"!\");\n $smarty -> display ('error1.tpl');\n monsterattack($attacks,$enemy,$myunik,$amount);\n if ($player -> hp > 0) \n {\n $_SESSION['round'] = $_SESSION['round'] + 1;\n $_SESSION['points'] = ceil($player->speed / $enemy['speed']);\n fightmenu($_SESSION['points'],$zmeczenie,$_SESSION['round'],$addres);\n }\n }\n }\n if ($_POST['action'] == 'cast' && $_SESSION['points'] > 0) \n {\n $_SESSION['points'] = $_SESSION['points'] - 1;\n if (!isset($_POST['castspell']))\n {\n $_POST['castspell'] = 0;\n }\n castspell($_POST['castspell'],0,$eunik);\n $temp = 0;\n for ($k=0;$k<$amount;$k++) \n {\n $strIndex = \"mon\".$k;\n if ($_SESSION[$strIndex] > 0) \n {\n $temp = $temp + 1;\n }\n }\n if ($temp > 0 && $attacks <= $_SESSION['points']) \n {\n fightmenu($_SESSION['points'],$zmeczenie,$_SESSION['round'],$addres);\n }\n }\n /**\n * Burst offensive spell\n */\n if ($_POST['action'] == 'bspell' && $_SESSION['points'] > 0) \n {\n if (intval($_POST['power']) < 1) \n {\n $smarty -> assign (\"Message\", ERROR);\n $smarty -> display ('error1.tpl');\n $_POST['power'] = 0;\n }\n else\n {\n if ($_POST['power'] > $player -> level)\n {\n $_POST['power'] = $player -> level;\n }\n\t checkvalue($_POST['bspellboost']);\n $intSpelllevel = $db -> Execute(\"SELECT `gracz, `poziom` FROM `czary` WHERE `id`=\".$_POST['bspellboost']);\n\t if ($intSpelllevel->fields['gracz'] != $player->id)\n\t {\n\t\t$intMaxburst = 0;\n\t }\n\t else\n\t {\n\t\t$intMaxburst = $player -> mana - $intSpelllevel -> fields['poziom'];\n\t }\n $intSpelllevel -> Close();\n if ($_POST['power'] > $intMaxburst)\n {\n $_POST['power'] = $intMaxburst;\n }\n $_SESSION['points'] = $_SESSION['points'] - 2;\n castspell($_POST['bspellboost'],$_POST['power'],$eunik);\n }\n $temp = 0;\n for ($k=0;$k<$amount;$k++) \n {\n $strIndex = \"mon\".$k;\n if ($_SESSION[$strIndex] > 0) \n {\n $temp = $temp + 1;\n }\n }\n if ($temp > 0 && $attacks <= $_SESSION['points']) \n {\n fightmenu($_SESSION['points'],$zmeczenie,$_SESSION['round'],$addres);\n }\n }\n /**\n * Burst defensive spell\n */\n if ($_POST['action'] == 'dspell') \n {\n if (intval($_POST['power1']) < 1) \n {\n $smarty -> assign (\"Message\", ERROR);\n $smarty -> display ('error1.tpl');\n $_POST['power1'] = 0;\n }\n if ($_POST['power1'] > $player -> level)\n {\n $_POST['power1'] = $player -> level;\n }\n $intMaxburst = $player -> mana - $myczaro -> fields['poziom'];\n if ($_POST['power1'] > $intMaxburst)\n {\n $_POST['power1'] = $intMaxburst;\n }\n $enemy['damage'] = $enemy['damage'] - $_POST['power1'];\n $player -> mana = $player -> mana - $_POST['power1'];\n monsterattack($attacks,$enemy,$myunik,$amount);\n if ($player -> hp > 0) \n {\n $_SESSION['round'] = $_SESSION['round'] + 1;\n $_SESSION['points'] = ceil($player->speed / $enemy['speed']);\n fightmenu($_SESSION['points'],$zmeczenie,$_SESSION['round'],$addres);\n }\n }\n if ($_POST['action'] == 'nattack' && $_SESSION['points'] > 0) \n {\n attack($eunik,0);\n $temp = 0;\n for ($k=0;$k<$amount;$k++) \n {\n $strIndex = \"mon\".$k;\n if ($_SESSION[$strIndex] > 0) \n {\n $temp = $temp + 1;\n }\n }\n $_SESSION['points'] = $_SESSION['points'] - 1;\n if ($temp > 0 && $attacks <= $_SESSION['points']) \n {\n fightmenu($_SESSION['points'],$zmeczenie,$_SESSION['round'],$addres);\n }\n }\n if ($_POST['action'] == 'dattack' && $_SESSION['points'] > 0) \n {\n $_SESSION['points'] = $_SESSION['points'] - 1;\n attack($eunik,3);\n $temp = 0;\n for ($k=0;$k<$amount;$k++) \n {\n $strIndex = \"mon\".$k;\n if ($_SESSION[$strIndex] > 0) \n {\n $temp = $temp + 1;\n }\n }\n $myunik = $myunik + ($myunik / 2);\n if ($temp > 0 && $attacks <= $_SESSION['points']) \n {\n fightmenu($_SESSION['points'],$zmeczenie,$_SESSION['round'],$addres);\n }\n }\n if ($_POST['action'] == 'aattack' && $_SESSION['points'] > 0) \n {\n $_SESSION['points'] = $_SESSION['points'] - 1;\n attack($eunik,1);\n $temp = 0;\n for ($k=0;$k<$amount;$k++) \n {\n $strIndex = \"mon\".$k;\n if ($_SESSION[$strIndex] > 0) \n {\n $temp = $temp + 1;\n }\n }\n $myunik = $myunik / 2;\n if ($temp > 0 && $attacks <= $_SESSION['points']) \n {\n fightmenu($_SESSION['points'],$zmeczenie,$_SESSION['round'],$addres);\n }\n }\n if ($_POST['action'] == 'battack' && $_SESSION['points'] > 0) \n {\n $_SESSION['points'] = $_SESSION['points'] - 2;\n attack($eunik,2);\n $temp = 0;\n for ($k=0;$k<$amount;$k++) \n {\n $strIndex = \"mon\".$k;\n if ($_SESSION[$strIndex] > 0) \n {\n $temp = $temp + 1;\n }\n }\n $myunik = 0;\n if ($temp > 0 && $attacks <= $_SESSION['points']) \n {\n fightmenu($_SESSION['points'],$zmeczenie,$_SESSION['round'],$addres);\n }\n }\n if (!isset($_SESSION['points']))\n {\n $_SESSION['points'] = 0;\n }\n if($attacks > $_SESSION['points'] && $temp > 0 && $_POST['action'] != 'rest' && $_POST['action'] != 'escape') \n {\n monsterattack($attacks,$enemy,$myunik,$amount);\n if ($player -> hp > 0) \n {\n $_SESSION['round'] = $_SESSION['round'] + 1;\n $_SESSION['points'] = ceil($player->speed / $enemy['speed']);\n if ($_SESSION['points'] > 5) \n {\n $_SESSION['points'] = 5;\n }\n fightmenu($_SESSION['points'],$zmeczenie,$_SESSION['round'],$addres);\n }\n }\n if ($_POST['action'] == 'rest') \n {\n monsterattack($attacks,$enemy,0,$amount);\n if ($player -> hp > 0) \n {\n $smarty -> assign (\"Message\", \"<br />\".REST_SUCC);\n $smarty -> display ('error1.tpl');\n $rest = ($player -> cond / 10);\n $zmeczenie = $zmeczenie - $rest;\n if ($zmeczenie < 0) \n {\n $zmeczenie = 0;\n }\n $_SESSION['exhaust'] = $zmeczenie;\n $_SESSION['round'] = $_SESSION['round'] + 1;\n $_SESSION['points'] = ceil($player->speed / $enemy['speed']);\n if ($_SESSION['points'] > 5) \n {\n $_SESSION['points'] = 5;\n }\n fightmenu($_SESSION['points'],$zmeczenie,$_SESSION['round'],$addres);\n }\n }\n if ($player -> hp <= 0) \n {\n if ($title != 'Arena Walk') \n\t {\n\t loststat($player -> id, $player->oldstats, 0, $enemy['name'], 0, $player->antidote);\n\t }\n\tif ($player->antidote == 'R')\n\t {\n\t $player->hp = 1;\n\t }\n if ($player -> hp < 0) \n {\n $player -> hp = 0;\n }\n\tif ($title == 'Przygoda')\n\t {\n\t $intFight = -1;\n\t }\n\telse\n\t {\n\t $intFight = 0;\n\t }\n $db -> Execute(\"INSERT INTO `events` (`text`) VALUES('Gracz \".$player -> user.\" \".DEFEATED_BY.$enemy['name'].\"')\");\n $db -> Execute(\"UPDATE `players` SET `fight`=\".$intFight.\", `hp`=\".$player -> hp.\", `bless`='', `blessval`=0, `antidote`='' WHERE `id`=\".$player -> id);\n unset($_SESSION['exhaust'], $_SESSION['round'], $_SESSION['points'], $_SESSION['dodge']);\n for ($k = 0; $k < $amount; $k ++) \n {\n $strIndex = \"mon\".$k;\n unset($_SESSION[$strIndex]);\n }\n if ($title == 'Arena Walk') \n {\n if (!$intPoisoned)\n {\n $smarty -> assign (\"Message\", \"</ul>\".LOST_FIGHT.\"...<br /><ul><li><b>\".B_OPTIONS.\"</a><br /></li></ul>\");\n }\n else\n {\n $smarty -> assign (\"Message\", \"</ul><br /><ul><li><b>\".B_OPTIONS.\"</a><br /></li></ul>\");\n }\n $smarty -> display ('error1.tpl');\n }\n }\n if (isset($_SESSION['points']))\n {\n $intPoints = $_SESSION['points'];\n }\n else\n {\n $intPoints = 0;\n }\n if (!$_POST['action'] && $attacks <= $intPoints) \n {\n fightmenu($_SESSION['points'],$zmeczenie,1,$addres);\n }\n if ($temp == 0 && $player -> fight > 0 && (isset($_SESSION['round']) && $_SESSION['round'] < 25)) \n {\n $db -> Execute(\"INSERT INTO `events` (`text`) VALUES('Gracz \".$player -> user.\" \".DEFEAT.\" \".$enemy['name'].\"')\");\n $db -> Execute(\"UPDATE `players` SET `credits`=`credits`+\".$goldgain.\" WHERE `id`=\".$player -> id);\n $smarty -> assign (\"Message\", \"<br /><li><b>\".YOU_DEFEAT.\" <b>\".$amount.\" \".$enemy['name'].\"</b>.\");\n $smarty -> display ('error1.tpl');\n $smarty -> assign (\"Message\", \"<li><b>\".REWARD.\" <b>\".$expgain.\"</b> \".EXP_PTS.\" \".AND_GAIN.\" <b>\".$goldgain.\"</b> \".COINS);\n $smarty -> display ('error1.tpl');\n\tmonsterloot($enemy['lootnames'], $enemy['lootchances'], $enemy['level'], $amount);\n\tbattlerecords($enemy['name'], $enemy['level'], $player->id);\n checkexp($player -> exp,$expgain,$player -> level,$player -> race,$player -> user,$player -> id,0,0,$player -> id,'',0);\n if ($player -> hp < 0) \n {\n $player -> hp = 0;\n }\n\tif (($player->hp > 0) && ($player->autodrink != 'N'))\n\t {\n\t if ($player->autodrink == 'A')\n\t {\n\t\tdrinkfew(0, 0, 'M');\n\t\tdrinkfew(0, 0, 'H');\n\t }\n\t else\n\t {\n\t\tdrinkfew(0, 0, $player->autodrink);\n\t }\n\t }\n if ($title == 'Arena Walk') \n {\n $smarty -> assign (\"Message\", \"</ul><ul><li><b>\".B_OPTIONS.\"</a><br /></li></ul>\");\n $smarty -> display ('error1.tpl');\n }\n $db -> Execute(\"UPDATE players SET hp=\".$player -> hp.\", fight=0, bless='', blessval=0 WHERE id=\".$player -> id);\n\tif (isset($_SESSION['razy']))\n\t {\n\t unset($_SESSION['razy']);\n\t }\n unset($_SESSION['exhaust'], $_SESSION['round'], $_SESSION['points'], $_SESSION['dodge']);\n for ($k = 0; $k < $amount; $k ++) \n {\n $strIndex = \"mon\".$k;\n unset($_SESSION[$strIndex]);\n }\n }\n $myczaro -> Close();\n}",
"public function onPlayerAttackPlayer(PlayerAttackPlayerEvent $event) {\n if (!$event->getGameType()->equals(TypeList::Anni())) return;\n\n $target = $event->getTarget();\n $attacker = $event->getAttacker();\n $attackerData = AnniPlayerDataStorage::get($attacker->getName());\n $attackerJob = $attackerData->getCurrentJob();\n //Warriorならダメージ+1, Skill発動中ならさらに+1\n if ($attackerJob instanceof Warrior) {\n $additionalDamage = 1;\n if ($attackerJob->isOnFrenzy()) $additionalDamage++;\n\n $source = new EntityDamageByEntityEvent($attacker, $target, $event->getCause(), $event->getBaseDamage(), [], $event->getKnockBack());\n $target->setLastDamageCause($source);\n $target->setHealth($target->getHealth() - $additionalDamage);\n } else if ($attackerJob instanceof Lumberjack) {//Lumberjack\n //スキル発動中かつ斧での攻撃なら耐久値を16削る\n if ($attackerJob->isOnBruteForce() and $attacker->getInventory()->getItemInHand()->getId() instanceof Axe) {\n foreach ($target->getArmorInventory()->getContents() as $item) {\n if ($item instanceof Armor) {\n $item->applyDamage(16);\n //todo:音とエフェクト\n }\n }\n }\n } else if ($attackerJob instanceof Pyro) {\n //Pyroなら37%の確立で相手に火をつける\n if (mt_rand(1, 100) <= 37) {\n $target->setOnFire(2);\n }\n }\n\n //Assassinならスキルをキャンセルする\n $targetJob = AnniPlayerDataStorage::get($target->getName())->getCurrentJob();\n if ($targetJob instanceof Assassin) {\n $targetJob->cancelSkill();\n $targetJob->reverseArmor($event->getTarget()->getName());\n }\n }",
"static function bySeaAttack($player1,$player2,&$logManager,$language){\r\n\t\t$p1Unit = $player1;\r\n\t\t$p2Unit = $player2;\r\n\t\t\r\n\t\t$p1UnitLost = $p2UnitLost = 0;\r\n\t\twhile ($p1Unit > 0 && $p2Unit > 0){\r\n\t\t\t$p1Dice = ($p1Unit <= 3) ? $p1Unit : 3;\r\n\t\t\t$p2Dice = ($p2Unit <= 3) ? $p2Unit : 3;\r\n\t\t\t$unitLost = CombatManager::terranAttack($p1Dice, $p2Dice,$logManager,$language);\r\n\t\t\t$p1Unit = $p1Unit-$unitLost[0];\r\n\t\t\t$p1UnitLost += $unitLost[0];\r\n\t\t\t$p2Unit = $p2Unit-$unitLost[1];\r\n\t\t\t$p2UnitLost += $unitLost[1];\r\n\t\t}\r\n\t\t\r\n\t\techo 'ciao';\r\n\t\t\r\n\t\t$logManager->addLog('{Player1} '.$language['losts'].' '.$p1UnitLost.' '.$language['units']);\r\n\t\t$logManager->addLog('{Player2} '.$language['losts'].' '.$p2UnitLost.' '.$language['units']);\r\n\t\t\r\n\t\treturn array($p1UnitLost,$p2UnitLost);\r\n\t}",
"private function attack()\n {\n $this->tempAttackerStats = $this->attacker->stats;\n $this->tempDefenderStats = $this->defender->stats;\n\n // 1. Before hit check, apply all luck modifying skills\n $skills = array_filter($this->attacker->character->skills, function (Skill $skill) {\n return $skill->stat == Character::STAT_LUCK && $skill->type == Skill::TYPE_ATTACK;\n });\n array_walk(\n $skills, \n array($this, 'applySkill'),\n Skill::TARGET_ATTACKER,\n );\n\n $skills = array_filter($this->defender->character->skills, function (Skill $skill) {\n return $skill->stat == Character::STAT_LUCK && $skill->type == Skill::TYPE_DEFENCE;\n });\n array_walk(\n $skills,\n array($this, 'applySkill'),\n Skill::TARGET_DEFENDER,\n );\n\n // 2. Check if attack is evaded\n $luck = $this->tempDefenderStats[Character::STAT_LUCK];\n if ($luck != 0 && $this->chance($luck)) {\n return $this->status = self::STATUS_MISSED;\n }\n\n // 3. Apply stat modifier skills\n $skills = array_filter($this->attacker->character->skills, function (Skill $skill) {\n return $skill->stat != Character::STAT_LUCK\n && $skill->stat != Character::STAT_DAMAGE\n && $skill->type == Skill::TYPE_ATTACK;\n });\n array_walk(\n $skills,\n array($this, 'applySkill'),\n Skill::TARGET_ATTACKER,\n );\n\n $skills = array_filter($this->defender->character->skills, function (Skill $skill) {\n return $skill->stat != Character::STAT_LUCK\n && $skill->stat != Character::STAT_DAMAGE\n && $skill->type == Skill::TYPE_DEFENCE;\n });\n array_walk(\n $skills,\n array($this, 'applySkill'),\n Skill::TARGET_DEFENDER,\n );\n\n // 4. Calculate the damage\n $strength = $this->tempAttackerStats[Character::STAT_STRENGTH];\n $defence = $this->tempDefenderStats[Character::STAT_DEFENCE];\n\n $this->damage = max(0, $strength - $defence);\n\n // 5. Apply damage modifier skills\n $skills = array_filter($this->attacker->character->skills, function (Skill $skill) {\n return $skill->stat == Character::STAT_DAMAGE\n && $skill->type == Skill::TYPE_ATTACK;\n });\n array_walk(\n $skills,\n function (Skill $skill, $key) {\n $this->applyDamageSkill($skill, Skill::TARGET_ATTACKER, $this->damage);\n }\n );\n\n $skills = array_filter($this->defender->character->skills, function (Skill $skill) {\n return $skill->stat == Character::STAT_DAMAGE\n && $skill->type == Skill::TYPE_DEFENCE;\n });\n array_walk(\n $skills,\n function (Skill $skill, $key) {\n $this->applyDamageSkill($skill, Skill::TARGET_DEFENDER, $this->damage);\n }\n );\n\n // 6. Apply the final damage\n $this->defender->stats[Character::STAT_HEALTH] =\n max(0, $this->defender->stats[Character::STAT_HEALTH] - $this->damage);\n\n $this->status = self::STATUS_COMPLETED;\n }",
"public function attackEntity(Entity $player){\n\t\tif($player === null || ($player instanceof Player && !$player->isOnline())){\n\t\t\treturn;\n\t\t}\n\t\tif($this->attackDelay > 10 && $this->distanceSquared($player) < 2){\n\t\t\t$this->attackDelay = 0;\n\t\t\t// maybe this needs some rework ... as it should be calculated within the event class and take\n\t\t\t// mob's weapon into account. for now, i just add the damage from the weapon the mob wears\n\t\t\t$damage = $this->getDamage();\n\t\t\tif($this->getMobEquipment() !== null){\n\t\t\t\t$damage = $damage + $this->getMobEquipment()->getWeaponDamageToAdd();\n\t\t\t}\n\t\t\t$ev = new EntityDamageByEntityEvent($this, $player, EntityDamageEvent::CAUSE_ENTITY_ATTACK,\n\t\t\t\tMobDamageCalculator::calculateFinalDamage($player, $damage));\n\t\t\t$player->attack($ev);\n\n\t\t\t$this->checkTamedMobsAttack($player);\n\t\t}\n\t}",
"public function attack($options);",
"public function dotomdotom2 (Player $player)\r\n\t{\r\n\t\t$fvector = $this->getFrontalVector ($player);\r\n $player->teleport ($fvector);\r\n\t}",
"function battle($type,$adress) \n{\n global $player;\n global $smarty;\n global $enemy;\n global $arrehp;\n global $db;\n if ($player -> hp <= 0) \n {\n error (NO_LIFE);\n }\n $enemy1 = $db -> Execute(\"SELECT * FROM `monsters` WHERE `id`=\".$player -> fight);\n $span = ($enemy1 -> fields['level'] / $player -> level);\n if ($span > 2) \n {\n $span = 2;\n }\n $expgain = ceil(rand($enemy1 -> fields['exp1'],$enemy1 -> fields['exp2']) * $span);\n $goldgain = ceil(rand($enemy1 -> fields['credits1'],$enemy1 -> fields['credits2']) * $span);\n $enemy = array(\"strength\" => $enemy1 -> fields['strength'], \n \"agility\" => $enemy1 -> fields['agility'], \n \"speed\" => $enemy1 -> fields['speed'], \n \"endurance\" => $enemy1 -> fields['endurance'], \n \"hp\" => $enemy1 -> fields['hp'], \n \"name\" => $enemy1 -> fields['name'], \n \"id\" => $enemy1 -> fields['id'], \n \"exp1\" => $enemy1 -> fields['exp1'], \n \"exp2\" => $enemy1 -> fields['exp2'], \n \"level\" => $enemy1 -> fields['level'],\n\t\t \"lootnames\" => explode(\";\", $enemy1->fields['lootnames']),\n\t\t \"lootchances\" => explode(\";\", $enemy1->fields['lootchances']));\n if ($type == 'T') \n {\n if (!isset ($_POST['action'])) \n {\n turnfight ($expgain,$goldgain,'',$adress);\n } \n else \n {\n turnfight ($expgain,$goldgain,$_POST['action'],$adress);\n }\n } \n else \n {\n fightmonster ($enemy,$expgain,$goldgain,1);\n }\n $fight = $db -> Execute(\"SELECT `fight`, `hp` FROM `players` WHERE `id`=\".$player -> id);\n if ($fight -> fields['fight'] == 0) \n {\n if ($type == 'T')\n\t {\n\t $player->energy --;\n\t if ($player -> energy < 0) \n\t {\n\t\t$player -> energy = 0;\n\t }\n\t $db -> Execute(\"UPDATE `players` SET `energy`=\".$player->energy.\" WHERE `id`=\".$player->id);\n\t }\n if ($player -> location == 'Góry') \n {\n if ($fight -> fields['hp'] > 0)\n {\n $smarty -> assign (\"Link\", \"<br /><br /><a href=\\\"explore.php?akcja=gory\\\">\".A_REFRESH.\"</a><br />\");\n }\n else\n {\n $smarty -> assign (\"Link\", \"<br /><br /><a href=\\\"gory.php\\\">\".A_REFRESH.\"</a><br />\");\n }\n }\n if ($player -> location == 'Las') \n {\n if ($fight -> fields['hp'] > 0)\n {\n $smarty -> assign (\"Link\", \"<br /><br /><a href=\\\"explore.php\\\">\".A_REFRESH.\"</a><br />\");\n }\n else\n {\n $smarty -> assign (\"Link\", \"<br /><br /><a href=\\\"las.php\\\">\".A_REFRESH.\"</a><br />\");\n }\n }\n }\n $fight -> Close();\n $enemy1 -> Close();\n}",
"function attackEnemy($enemy_id, $combatStyle, $weapon) {\n\t\t$enemy = new Obj($this->mysqli, $enemy_id);\n\t\t$enemy->getBasicData();\n\t\t$enemy->getName();\n\t\t$result_str = \"\";\n\t\t\n\t\t$bmap = array(\n\t\t\t8\t => 3,\n\t\t\t9\t => 3,\n\t\t\t11\t => 3,\n\t\t\t33\t => 3,\n\t\t\t43\t => 3,\n\t\t\t50\t => 3,\n\t\t\t51\t => 4,\n\t\t\t52\t => 4,\n\t\t\t59\t => 4,\n\t\t\t60\t => 4,\n\t\t\t61\t => 4,\n\t\t\t62\t => 3,\n\t\t\t63\t => 3,\n\t\t\t64\t => 3,\n\t\t\t65\t => 3,\n\t\t\t69\t => 3,\n\t\t\t469\t => 3,\n\t\t\t470\t => 3,\n\t\t\t471\t => 3,\n\t\t\t472\t => 3,\n\t\t\t473\t => 3,\n\t\t\t474\t => 3,\n\t\t\t475\t => 3,\n\t\t\t476\t => 3,\n\t\t\t477\t => 3,\n\t\t\t478\t => 3,\n\t\t\t479\t => 0,\n\t\t\t480\t => 0,\n\t\t\t481\t => 0,\n\t\t\t482\t => 0,\n\t\t\t483\t => 0,\n\t\t\t484\t => 2,\n\t\t\t485\t => 2,\n\t\t\t486\t => 2,\n\t\t\t487\t => 2,\n\t\t\t19\t => 1,\n\t\t\t26\t => 1,\n\t\t\t28\t => 1,\n\t\t\t25\t => 1,\n\t\t\t23\t => 1,\n\t\t\t21\t => 1\n\t\t\t);//to-do: add more target types\n\t\t$pronoun = $this->getPronoun();\n\t\t$wpn = new Obj($this->mysqli, $weapon);\n\t\t$wpn->getBasicData();\n\t\t$wpn->getName();\n\t\t\n\t\tif ($weapon==0) $wpn->name = \"fist\";\n\t\t\n\t\t$info = $this->bodyPartTargeter(10, $bmap[$enemy->preset], $combatStyle);//later on falter will depend on skills\n\t\tif (!$info) {\n\t\t\tif ($enemy->type==2) $result_str = \"#ATTACKER tries to hit #VICTIM with $pronoun \" . $wpn->name . \" but misses.\";\n\t\t\telse $result_str = \"#ATTACKER tries to hit \" . $enemy->name . \" with $pronoun \" . $wpn->name . \" but misses.\";\n\t\t\t$combat = $this->checkCurrentCombat();\n\t\t\t$this->recordCombatEvent($combat, $result_str, $this->bodyId, $enemy->uid, 1);\n\t\t\treturn false;\n\t\t}//You missed\n\t\t\n\t\tif ($weapon==0) {\n\t\t\t$severing = 0;\n\t\t\t$piercing = 0;\n\t\t\t$crushing = 5;\n\t\t}\n\t\telse {\n\t\t\t$severing = $wpn->getAttribute(56);\n\t\t\t$piercing = $wpn->getAttribute(57);\n\t\t\t$crushing = $wpn->getAttribute(58);\n\t\t}\n\t\t$broken = 0;\n\t\t$efficiency = rand(50,125);\n\t\tif ($efficiency==125&&rand(0,99)==99) $efficiency = 150;\n\t\tif ($severing>0&&$severing>$crushing&&$severing>$piercing) {\n\t\t\t$severing = round($severing*$efficiency/100);\n\t\t\t$bleed_type = 1;\n\t\t\t$bleed_level = round($severing/30);\n\t\t\tif ($info[0][\"sever\"]<=$severing&&$info[0][\"sever\"]>0) {\n\t\t\t\tif ($enemy->type==2) $result_str = \"#ATTACKER slices through #VICTIM''s \" . $info[0][\"name\"] . \" with $pronoun \" . $wpn->name . \", severing it from the rest of the body.\";\n\t\t\t\telse $result_str = \"#ATTACKER slices through \" . $enemy->name . \"''s \" . $info[0][\"name\"] . \" with $pronoun \" . $wpn->name . \", severing it from the rest of the body.\";\n\t\t\t\t$depth = 9;\n\t\t\t\tif ($bleed_level<3) $bleed_level = 3;\n\t\t\t\tif ($info[0][\"id\"]<4) $info[1] = true;//instakill\n\t\t\t\tif (ibetween($info[0][\"id\"], 18, 27)) $info[2] = $true;//crippled\n\t\t\t\t$broken = 2;\n\t\t\t}\n\t\t\telse if (($info[0][\"sever\"]*0.90)<=$severing&&$info[0][\"sever\"]>0) {\n\t\t\t\tif ($enemy->type==2) $result_str = \"#ATTACKER almost severs #VICTIM''s \" . $info[0][\"name\"] . \" with $pronoun \" . $wpn->name . \" so that it''s hanging by a shred.\";\n\t\t\t\telse $result_str = \"#ATTACKER almost severs \" . $enemy->name . \"''s \" . $info[0][\"name\"] . \" with $pronoun \" . $wpn->name . \" so that it''s hanging by a shred.\";\n\t\t\t\t$depth = 8;\n\t\t\t\tif ($bleed_level<3) $bleed_level = 3;\n\t\t\t\tif (ibetween($info[0][\"id\"], 18, 27)) $info[2] = $true;//crippled\n\t\t\t\t$broken = 2;\n\t\t\t}\n\t\t\telse if (($info[0][\"sever\"]*0.55)<=$severing&&$info[0][\"sever\"]>0) {\n\t\t\t\tif ($enemy->type==2) $result_str = \"#ATTACKER half severs #VICTIM''s \" . $info[0][\"name\"] . \" with $pronoun \" . $wpn->name . \".\";\n\t\t\t\telse $result_str = \"#ATTACKER half severs \" . $enemy->name . \"''s \" . $info[0][\"name\"] . \" with $pronoun \" . $wpn->name . \".\";\n\t\t\t\t$depth = 7;\n\t\t\t\tif ($bleed_level<3) $bleed_level = 3;\n\t\t\t\tif (ibetween($info[0][\"id\"], 18, 27)) $info[2] = $true;//crippled\n\t\t\t}\n\t\t\telse if (($info[0][\"sever\"]*0.40)<=$severing&&$info[0][\"sever\"]>0) {\n\t\t\t\tif ($enemy->type==2) $result_str = \"#ATTACKER cuts a deep gash in #VICTIM''s \" . $info[0][\"name\"] . \" with $pronoun \" . $wpn->name;\n\t\t\t\telse $result_str = \"#ATTACKER cuts a deep gash in \" . $enemy->name . \"''s \" . $info[0][\"name\"] . \" with $pronoun \" . $wpn->name;\n\t\t\t\tif ($info[0][\"bone\"]<0&&$info[0][\"bone\"]*-1<=$severing) {\n\t\t\t\t\t$result_str .= \" exposing bone.\";\n\t\t\t\t\t$depth = 5;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\t$result_str .= \".\";\n\t\t\t\t\t$depth = 4;\n\t\t\t\t}\n\t\t\t\tif ($bleed_level<2) $bleed_level = 2;\n\t\t\t}\n\t\t\telse if (($info[0][\"sever\"]*0.20)<=$severing&&$info[0][\"sever\"]>0) {\n\t\t\t\tif ($enemy->type==2) $result_str = \"#ATTACKER cuts a considerable gash in #VICTIM''s \" . $info[0][\"name\"] . \" with $pronoun \" . $wpn->name;\n\t\t\t\telse $result_str = \"#ATTACKER cuts a considerable gash in \" . $enemy->name . \"''s \" . $info[0][\"name\"] . \" with $pronoun \" . $wpn->name;\n\t\t\t\tif ($info[0][\"bone\"]<0&&$info[0][\"bone\"]*-1<=$severing) {\n\t\t\t\t\t$result_str .= \", exposing bone.\";\n\t\t\t\t\t$depth = 5;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\t$result_str .= \", reaching into the muscle.\";\n\t\t\t\t\t$depth = 4;\n\t\t\t\t}\n\t\t\t\tif ($bleed_level<2) $bleed_level = 2;\n\t\t\t}\n\t\t\telse if (($info[0][\"sever\"]*0.10)<=$severing&&$info[0][\"sever\"]>0) {\n\t\t\t\tif ($enemy->type==2) $result_str = \"#ATTACKER slashs a wound in #VICTIM''s \" . $info[0][\"name\"] . \" with $pronoun \" . $wpn->name . \", reaching into the subcutaneous fat layer.\";\n\t\t\t\telse $result_str = \"#ATTACKER slashs a wound in \" . $enemy->name . \"''s \" . $info[0][\"name\"] . \" with $pronoun \" . $wpn->name . \", reaching into the subcutaneous fat layer.\";\n\t\t\t\t$depth = 3;\n\t\t\t}\n\t\t\telse if (($info[0][\"sever\"]*0.05)<=$severing&&$info[0][\"sever\"]>0) {\n\t\t\t\tif ($enemy->type==2) $result_str = \"#ATTACKER slices a shallow wound in #VICTIM''s \" . $info[0][\"name\"] . \" with $pronoun \" . $wpn->name . \".\";\n\t\t\t\telse $result_str = \"#ATTACKER slices a shallow wound in \" . $enemy->name . \"''s \" . $info[0][\"name\"] . \" with $pronoun \" . $wpn->name . \".\";\n\t\t\t\t$depth = 2;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tif ($enemy->type==2) $result_str = \"#ATTACKER slashes #VICTIM''s \" . $info[0][\"name\"] . \" superficially with $pronoun \" . $wpn->name . \".\";\n\t\t\t\telse $result_str = \"#ATTACKER slashes \" . $enemy->name . \"''s \" . $info[0][\"name\"] . \" superficially with $pronoun \" . $wpn->name . \".\";\n\t\t\t\t$depth = 1;\n\t\t\t}\n\t\t}\n\t\telse if ($crushing>0&&$crushing>$piercing) {\n\t\t\t$crushing = round($crushing*$efficiency/100);\n\t\t\t$bleed_type = 2;\n\t\t\tif ($info[0][\"crush\"]<=$crushing&&$info[0][\"crush\"]>0) {\n\t\t\t\tif ($enemy->type==2) $result_str = \"#ATTACKER crushes #VICTIM''s \" . $info[0][\"name\"] . \" with $pronoun \" . $wpn->name . \".\";\n\t\t\t\telse $result_str = \"#ATTACKER crushes \" . $enemy->name . \"''s \" . $info[0][\"name\"] . \" with $pronoun \" . $wpn->name . \".\";\n\t\t\t\t$depth = 8;\n\t\t\t\t$bleed_level = 6;\n\t\t\t\t$broken = 4;\n\t\t\t}\n\t\t\telse if (($info[0][\"crush\"]*0.75)<=$crushing&&$info[0][\"crush\"]>0) {\n\t\t\t\tif ($enemy->type==2) $result_str = \"#ATTACKER badly breaks #VICTIM''s \" . $info[0][\"name\"] . \" with $pronoun \" . $wpn->name . \".\";\n\t\t\t\telse $result_str = \"#ATTACKER badly breaks \" . $enemy->name . \"''s \" . $info[0][\"name\"] . \" with $pronoun \" . $wpn->name . \".\";\n\t\t\t\t$depth = 7;\n\t\t\t\t$bleed_level = 5;\n\t\t\t\t$broken = 3;\n\t\t\t}\n\t\t\telse if (($info[0][\"crush\"]*0.50)<=$crushing&&$info[0][\"crush\"]>0) {\n\t\t\t\tif ($enemy->type==2) $result_str = \"#ATTACKER fractures #VICTIM''s \" . $info[0][\"name\"] . \" with $pronoun \" . $wpn->name . \".\";\n\t\t\t\telse $result_str = \"#ATTACKER fractures \" . $enemy->name . \"''s \" . $info[0][\"name\"] . \" with $pronoun \" . $wpn->name . \".\";\n\t\t\t\t$depth = 7;\n\t\t\t\t$bleed_level = 5;\n\t\t\t\t$broken = 2;\n\t\t\t}\n\t\t\telse if (($info[0][\"crush\"]*0.40)<=$crushing&&$info[0][\"crush\"]>0) {\n\t\t\t\tif ($enemy->type==2) $result_str = \"#ATTACKER smashes #VICTIM''s \" . $info[0][\"name\"] . \" with $pronoun \" . $wpn->name . \", causing serious internal bleeding.\";\n\t\t\t\telse $result_str = \"#ATTACKER smashes \" . $enemy->name . \"''s \" . $info[0][\"name\"] . \" with $pronoun \" . $wpn->name . \", causing serious internal bleeding.\";\n\t\t\t\t$depth = 5;\n\t\t\t\t$bleed_level = 4;\n\t\t\t}\n\t\t\telse if (($info[0][\"crush\"]*0.20)<=$crushing&&$info[0][\"crush\"]>0) {\n\t\t\t\tif ($enemy->type==2) $result_str = \"#ATTACKER smashes #VICTIM''s \" . $info[0][\"name\"] . \" with $pronoun \" . $wpn->name . \", which will certainly cause a big bruise.\";\n\t\t\t\telse $result_str = \"#ATTACKER smashes \" . $enemy->name . \"''s \" . $info[0][\"name\"] . \" with $pronoun \" . $wpn->name . \", which will certainly cause a big bruise.\";\n\t\t\t\t$depth = 4;\n\t\t\t\t$bleed_level = 3;\n\t\t\t}\n\t\t\telse if (($info[0][\"crush\"]*0.10)<=$crushing&&$info[0][\"crush\"]>0) {\n\t\t\t\tif ($enemy->type==2) $result_str = \"#ATTACKER hit #VICTIM''s \" . $info[0][\"name\"] . \" with $pronoun \" . $wpn->name . \", which is going to leave a bruise.\";\n\t\t\t\telse $result_str = \"#ATTACKER hit \" . $enemy->name . \"''s \" . $info[0][\"name\"] . \" with $pronoun \" . $wpn->name . \", which is going to leave a bruise.\";\n\t\t\t\t$depth = 3;\n\t\t\t\t$bleed_level = 2;\n\t\t\t}\n\t\t\telse if ($info[0][\"crush\"]>0) {\n\t\t\t\tif ($enemy->type==2) $result_str = \"#ATTACKER hits #VICTIM''s \" . $info[0][\"name\"] . \" with $pronoun \" . $wpn->name . \", which might cause a small bruise.\";\n\t\t\t\telse $result_str = \"#ATTACKER hits \" . $enemy->name . \"''s \" . $info[0][\"name\"] . \" with $pronoun \" . $wpn->name . \", which might cause a small bruise.\";\n\t\t\t\t$depth = 1;\n\t\t\t\t$bleed_level = 1;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tif ($enemy->type==2) $result_str = \"#ATTACKER hits #VICTIM''s \" . $info[0][\"name\"] . \" with $pronoun \" . $wpn->name . \", which is likely to cause slight internal bleeding in the surrounding tissues.\";\n\t\t\t\telse $result_str = \"#ATTACKER hits \" . $enemy->name . \"''s \" . $info[0][\"name\"] . \" with $pronoun \" . $wpn->name . \", which is likely to cause slight internal bleeding in the surrounding tissues.\";\n\t\t\t\t$depth = 2;\n\t\t\t\t$bleed_level = 2;\n\t\t\t}\n\t\t\tif ($piercing>0) {\n\t\t\t\t$result_str .= \"In addition, the weapon causes some external wounds.\";\n\t\t\t\t$bleed_type = 3;\n\t\t\t}\n\t\t}\n\t\telse if ($piercing>0) {\n\t\t\t$piercing = round($piercing*$efficiency/100);\n\t\t\t$bleed_type = 1;\n\t\t\tif ($info[0][\"pierce\"]<=$piercing&&$info[0][\"pierce\"]>0) {\n\t\t\t\tif ($enemy->type==2) $result_str = \"#ATTACKER pierces #VICTIM''s \" . $info[0][\"name\"] . \" with $pronoun \" . $wpn->name . \".\";\n\t\t\t\telse $result_str = \"#ATTACKER pierces \" . $enemy->name . \"''s \" . $info[0][\"name\"] . \" with $pronoun \" . $wpn->name . \".\";\n\t\t\t\t$depth = 6;\n\t\t\t\t$bleed_level = 6;\n\t\t\t\tif ((strpos($info[0][\"name\"], 'artery') !== false)||(strpos($info[0][\"name\"], 'heart') !== false)) $bleed_level = 10;\n\t\t\t}\n\t\t\telse if (($info[0][\"pierce\"]*0.50)<=$piercing&&$info[0][\"pierce\"]>0) {\n\t\t\t\tif ($enemy->type==2) $result_str = \"#ATTACKER pierces #VICTIM''s \" . $info[0][\"name\"] . \" halfway with $pronoun \" . $wpn->name . \".\";\n\t\t\t\telse $result_str = \"#ATTACKER pierces \" . $enemy->name . \"''s \" . $info[0][\"name\"] . \" halfway with $pronoun \" . $wpn->name . \".\";\n\t\t\t\t$depth = 4;\n\t\t\t\t$bleed_level = 5;\n\t\t\t\tif (strpos($info[0][\"name\"], 'heart') !== false) $bleed_level = 9;\n\t\t\t}\n\t\t\telse if (($info[0][\"pierce\"]*0.40)<=$piercing&&$info[0][\"pierce\"]>0) {\n\t\t\t\tif ($enemy->type==2) $result_str = \"#ATTACKER stabs #VICTIM''s \" . $info[0][\"name\"] . \" deeply with $pronoun \" . $wpn->name;\n\t\t\t\telse $result_str = \"#ATTACKER stabs \" . $enemy->name . \"''s \" . $info[0][\"name\"] . \" deeply with $pronoun \" . $wpn->name;\n\t\t\t\tif ($info[0][\"bone\"]<0&&$info[0][\"bone\"]*-1<=$piercing) {\n\t\t\t\t\t$result_str .= \", colliding with bone.</p>\";\n\t\t\t\t\t$depth = 5;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\t$result_str .= \".\";\n\t\t\t\t\t$depth = 4;\n\t\t\t\t}\n\t\t\t\t$bleed_level = 4;\n\t\t\t\tif (strpos($info[0][\"name\"], 'heart') !== false) $bleed_level = 8;\n\t\t\t}\n\t\t\telse if (($info[0][\"pierce\"]*0.2)<=$piercing&&$info[0][\"pierce\"]>0) {\n\t\t\t\tif ($enemy->type==2) $result_str = \"#ATTACKER stabs #VICTIM''s \" . $info[0][\"name\"] . \" considerably with $pronoun \" . $wpn->name . \".\";\n\t\t\t\telse $result_str = \"#ATTACKER stabs \" . $enemy->name . \"''s \" . $info[0][\"name\"] . \" considerably with $pronoun \" . $wpn->name . \".\";\n\t\t\t\t$depth = 3;\n\t\t\t\t$bleed_level = 3;\n\t\t\t\tif (strpos($info[0][\"name\"], 'heart') !== false) $bleed_level = 7;\n\t\t\t}\n\t\t\telse if (($info[0][\"pierce\"]*0.1)<=$piercing&&$info[0][\"pierce\"]>0) {\n\t\t\t\tif ($enemy->type==2) $result_str = \"#ATTACKER wounds #VICTIM''s \" . $info[0][\"name\"] . \" superficially with $pronoun \" . $wpn->name . \".\";\n\t\t\t\telse $result_str = \"#ATTACKER wounds \" . $enemy->name . \"''s \" . $info[0][\"name\"] . \" superficially with $pronoun \" . $wpn->name . \".\";\n\t\t\t\t$depth = 2;\n\t\t\t\t$bleed_level = 2;\n\t\t\t}\n\t\t\telse if ($info[0][\"pierce\"]>0) {\n\t\t\t\tif ($enemy->type==2) $result_str = \"#ATTACKER pokes #VICTIM''s \" . $info[0][\"name\"] . \" superficially with $pronoun \" . $wpn->name . \".\";\n\t\t\t\telse $result_str = \"#ATTACKER pokes \" . $enemy->name . \"''s \" . $info[0][\"name\"] . \" superficially with $pronoun \" . $wpn->name . \".\";\n\t\t\t\t$depth = 1;\n\t\t\t\t$bleed_level = 1;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tif ($enemy->type==2) $result_str = \"#ATTACKER nicks #VICTIM''s \" . $info[0][\"name\"] . \" with $pronoun \" . $wpn->name . \".\";\n\t\t\t\telse $result_str = \"#ATTACKER nicks \" . $enemy->name . \"''s \" . $info[0][\"name\"] . \" with $pronoun \" . $wpn->name . \".\";\n\t\t\t\t$depth = 0;\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tif ($enemy->type==2) $result_str = \"#ATTACKER bumps #VICTIM''s \" . $info[0][\"name\"] . \" with $pronoun \" . $wpn->name . \" but it doesn't cause any damage.\";\n\t\t\telse $result_str = \"#ATTACKER bumps \" . $enemy->name . \"''s \" . $info[0][\"name\"] . \" with $pronoun \" . $wpn->name . \" but it doesn't cause any damage.\";//this shouldn't actually be possible because it shouldn't allow picking weapons that aren't weapons\n\t\t}\n\t\t\n\t\tif (isset($bleed_type)&&isset($bleed_level)&&isset($depth)) {\n\t\t\t$curTime = new Time($this->mysqli);\n\t\t\t$sql = \"INSERT INTO `wounds` (`objectFK`, `bodypart`, `depth`, `bleed_level`, `bleed_type`, `broken`, `datetime`, `minute`) VALUES ('$enemy->uid', '\" . $info[0][\"id\"] . \"', '$depth', '$bleed_level', '$bleed_type', '$broken', '\" . $curTime->dateTime . \"', '\" . $curTime->minute . \"')\";\n\t\t\t$this->mysqli->query($sql);\n\t\t\t$result = $this->mysqli->insert_id;\n\t\t\tif (!$result) {\n\t\t\t\t//para(\"Something went wrong and the wound couldn't be recorded.\");\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\t\n\t\tif ($info[2]) {\n\t\t\t$result_str .= \" The attack cripples the target.\";\n\t\t\t$enemy->setAttribute(60, 1);\n\t\t\t$enemy->setAttribute(61, 1);//sprawled\n\t\t}\n\t\tif ($info[3]) {\n\t\t\t$result_str .= \" The target seems disoriented.\";\n\t\t\t$enemy->setAttribute(59, 1);//concussion\n\t\t}\n\t\tif ($info[1]) $result_str .= \" There''s no way they''re going to survive that.\";\n\t\t\n\t\t//para($result_str);\n\t\t\n\t\t$combat = $this->checkCurrentCombat();\n\t\t\n\t\tif ($enemy->type==2) $res = $this->recordCombatEvent($combat, $result_str, $this->bodyId, $enemy->uid, 3);\n\t\telse $res = $this->recordCombatEvent($combat, $result_str, $this->bodyId, $enemy->uid, 1);\n\t\tif (is_array($res)) return $res;\n\t\t\n\t\treturn 100;\n\t}",
"function doAttack(&$objSrcUser, &$objTrgUser, $arrSentArmy)\n{\n $srcKd = $objSrcUser->get_stat(ALLIANCE);\n $trgKd = $objTrgUser->get_stat(ALLIANCE);\n $strSrcRace = $objSrcUser->get_stat(RACE);\n $iSrcLand = $objSrcUser->get_build(LAND);\n $arrTrgBuilds = $objTrgUser->get_builds();\n $gains = pow(($arrTrgBuilds[LAND] / $iSrcLand), 2) + ($arrTrgBuilds[LAND] / ($iSrcLand * 3));\n $gains = min ($gains,1);\n\n $quick_gains = 0.01 * $gains; // 1% Land Gain\n\n if ($strSrcRace == \"Oleg Hai\")\n $quick_gains = $quick_gains * 1.3;\n\n //==========================================================================\n // Calculate Acre Gains\n //==========================================================================\n include_once('inc/functions/build.php');\n $arrBuildVars = getBuildingVariables($objTrgUser->get_stat(RACE));\n $arrBuildVars = $arrBuildVars['variables'];\n $max_build = $objTrgUser->get_number_build_types();\n $total_grab = 0;\n\n for($i = 1; $i <= $max_build; $i++)\n {\n $strVar = trim($arrBuildVars[$i]);\n $acres_won[$strVar] = round($arrTrgBuilds[$strVar]* ($quick_gains));\n $buildings = $objTrgUser->get_build($strVar);\n $land = $objTrgUser->get_build(LAND);\n $arrBuilds = array ($strVar => $buildings - $acres_won[$strVar], LAND => $land - $acres_won[$strVar] );\n $objTrgUser->set_builds($arrBuilds);\n $total_grab = $total_grab + $acres_won[$strVar];\n }\n\n // Explored\n $explore_gains = 0.2;\n $acres_explored = round($total_grab * $explore_gains);\n $land = $objSrcUser->get_build(LAND);\n $objSrcUser->set_build(LAND, ($land + $acres_explored));\n\n\n //==========================================================================\n // Calculate Citizens Killed\n //==========================================================================\n $trgCits = $objTrgUser->get_pop(CITIZENS);\n\n $max_kill = $trgCits * 0.2;\n $trgRace = $objTrgUser->get_stat(RACE);\n\n if ($max_kill < ($arrTrgBuilds[LAND] * 3) && $trgRace != \"Dragon\")\n $max_kill = $arrTrgBuilds[LAND] * 3;\n elseif ($max_kill < ($arrTrgBuilds[LAND] * 2) && $trgRace == \"Dragon\")\n $max_kill = $arrTrgBuilds[LAND] * 2;\n\n // War effects on max kill\n include_once(\"inc/functions/war.php\");\n $modifier = war_alli($srcKd, $trgKd);\n if ($modifier == 2)\n $max_kill = $max_kill * 1.2;\n\n // Martel: small bug fixed, $arrTrgBuilds not $arrTrgBuild\n $wallsPercent = ($arrTrgBuilds[WALLS] * 100) / $arrTrgBuilds[LAND];\n if ($wallsPercent > 20)\n $wallsPercent = 20;\n\n // frost: age 18, each % walls shelters 2% citizen\n for ($y = 1; $y <= $wallsPercent; $y++)\n $max_kill *= 0.98;\n\n // Max citizens to kill == citizens available\n $max_kill = round($max_kill);\n if ($max_kill > $trgCits)\n $max_kill = $trgCits;\n\n if ($max_kill > 0)\n {\n $intCitizens_alive = $trgCits - $max_kill;\n $objTrgUser->set_pop(CITIZENS, $intCitizens_alive);\n }\n else\n $max_kill = 0;\n\n // Let's see if we killed the tribe\n include_once('inc/functions/generic.php');\n obj_test_for_kill($objTrgUser, $objSrcUser);\n\n //==========================================================================\n // Calculate Cash Gains and Fame\n //==========================================================================\n $trgMoney = $objTrgUser->get_good(MONEY);\n\n $mod = 1;\n $stolen_crowns = round($trgMoney * 0.04);\n\n if ($arrTrgBuilds[LAND] > $iSrcLand)\n $fame_win = round($total_grab * 1.0);\n elseif ($arrTrgBuilds[LAND] < ($iSrcLand * 0.7))\n {\n $fame_win = round(-$total_grab * 1.0);\n $mod = ($arrTrgBuilds[LAND] * 1.3) / $iSrcLand;\n }\n else\n $fame_win = round($total_grab * 1.2);\n\n if ($mod < 0.7)\n $mod = 0.7;\n\n $max_crowns = round($arrTrgBuilds[LAND] * 500);\n\n $stolen_crowns = min(round($stolen_crowns * $mod), round($max_crowns));\n\n $objTrgUser->set_good(MONEY, $trgMoney - $stolen_crowns);\n $money = $objSrcUser->get_good(MONEY);\n $objSrcUser->set_good(MONEY, $money + $stolen_crowns);\n\n //==========================================================================\n // Return time\n //==========================================================================\n $wait = 4; // 4 hour attack time\n\n if ($strSrcRace == \"Raven\")\n $wait = 1;\n elseif ($strSrcRace == \"Mori Hai\" || $strSrcRace == \"Dragon\")\n $wait = 3;\n\n $landtime = 'land_t' . $wait;\n $objSrcUser->set_user_info(NEXT_ATTACK, $wait);\n\n //==========================================================================\n // Add land to incoming\n //==========================================================================\n if ($total_grab > 0)\n {\n $old_land = $objSrcUser->get_build($landtime);\n $objSrcUser->set_build($landtime, $total_grab + $old_land);\n }\n\n //==========================================================================\n // Calculate Fame Gains\n //==========================================================================\n\n // War effects\n $objSrcAlliance = $objSrcUser->get_alliance();\n require_once('inc/functions/war.php');\n if (checkWarBetween($objSrcAlliance, $trgKd))\n {\n // Update land counter in new war system March 06, 2008 Martel\n $iNeeded = $objSrcAlliance->get_war('land_needed');\n $objSrcAlliance->set_war('land_needed', max(0, $iNeeded - $total_grab));\n\n // War effects on fame\n $fame_win *= 1.2;\n }\n\n // Cannot take more fame than what the target has\n $fame_win = round($fame_win);\n $target_fame = $objTrgUser->get_stat(FAME);\n if ($fame_win > $target_fame)\n $fame_win = $target_fame;\n\n $fame1 = $objSrcUser->get_stat(FAME) + $fame_win;\n $fame2 = $target_fame - $fame_win;\n $objSrcUser->set_stat(FAME, $fame1);\n $objTrgUser->set_stat(FAME, $fame2);\n\n //==========================================================================\n\n $arrResults['gained_acres'] = $total_grab;\n $arrResults['explored_acres'] = $acres_explored;\n $arrResults['gained_fame'] = $fame_win;\n $arrResults['gained_crowns'] = $stolen_crowns;\n $arrResults['killed_citizens'] = $max_kill;\n\n return $arrResults;\n}",
"static function seaAttack($player1,$player2,&$logManager,$language){\r\n\t\t$dices = DiceManager::rollCombatDice($player1, $player2);\r\n\t\t$unitLost = array(0=>0,1=>0);\r\n\t\t\r\n\t\t$logManager->addLog('{Player1} '.$language['rolls'].' '.implode(\";\",array_values($dices[0])));\r\n\t\t$logManager->addLog('{Player2} '.$language['rolls'].' '.implode(\";\",array_values($dices[1])));\r\n\t\t\r\n\t\tfor ($i=0;$i<count($dices[1]);$i++){\r\n\t\t\tif ($dices[0][$i] == $dices[1][$i]) return $unitLost;\r\n\t\t\tif ($dices[0][$i] <= $dices[1][$i]){\r\n\t\t\t\t$unitLost[0] += 1;\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\t$unitLost[1] += 1;\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\t$logManager->addLog('{Player1} '.$language['losts'].' '.$unitLost[0].' '.$language['units']);\r\n\t\t$logManager->addLog('{Player2} '.$language['losts'].' '.$unitLost[1].' '.$language['units']);\r\n\t\t\r\n\t\treturn $unitLost;\r\n\t}",
"function attack($eunik,$bdamage) \n{\n global $smarty;\n global $player;\n global $db;\n global $zmeczenie;\n global $enemy;\n global $amount;\n $number1 = $_POST['monster'] - 1;\n $number = \"mon\".$number1;\n $gwtbr = 0;\n $gatak = 0;\n if (isset ($_SESSION['exhaust'])) \n {\n $zmeczenie = $_SESSION['exhaust'];\n }\n $arrEquip = $player -> equipment();\n if (!$arrEquip[0][0] && !$arrEquip[1][0]) \n {\n $smarty -> assign(\"Message\", NO_WEAPON);\n $smarty -> display('error1.tpl');\n }\n if ($arrEquip[0][0]) \n {\n if ($arrEquip[0][3] == 'D') \n {\n $arrEquip[0][2] = $arrEquip[0][2] + $arrEquip[0][8];\n }\n if ($player -> clas == 'Wojownik' || $player -> clas == 'Barbarzyńca') \n {\n $stat['damage'] = (($player -> strength + $arrEquip[0][2]) + $player -> level);\n } \n else \n {\n $stat['damage'] = ($player -> strength + $arrEquip[0][2]);\n }\n if ($player -> attack < 1) \n {\n $krytyk = 1;\n }\n if ($player -> attack > 5) \n {\n $kr = ceil($player -> attack / 100);\n $krytyk = (5 + $kr);\n } \n else \n {\n $krytyk = $player -> attack;\n }\n $name = \"bronią\";\n\t$strAtype = 'melee';\n }\n if ($arrEquip[11][0])\n {\n\t$stat['damage'] += (($arrEquip[11][2] + $player->strength) + $player->level);\n\t$name = \"obiema brońmi\";\n }\n if ($arrEquip[1][0]) \n {\n $bonus = $arrEquip[1][2] + $arrEquip[6][2];\n\tif ($arrEquip[6][3] == 'D')\n\t {\n\t $bonus += $arrEquip[6][8];\n\t }\n $bonus2 = (($player -> strength / 2) + ($player->agility / 2));\n if ($player -> clas == 'Wojownik' || $player -> clas == 'Barbarzyńca') \n {\n $stat['damage'] = (($bonus2 + $bonus) + $player -> level);\n } \n else \n {\n $stat['damage'] = ($bonus2 + $bonus);\n }\n if ($player -> shoot < 1) \n {\n $krytyk = 1;\n }\n if ($player -> shoot > 5) \n {\n $kr = ceil($player -> shoot / 100);\n $krytyk = (5 + $kr);\n } \n else \n {\n $krytyk = $player -> shoot;\n }\n if (!$arrEquip[6][0]) \n {\n $stat['damage'] = 0;\n }\n $name = \"strzałą\";\n\t$strAtype = 'ranged';\n }\n if (!isset($stat['damage']))\n {\n $stat['damage'] = 0;\n }\n if ($player -> clas == 'Rzemieślnik')\n {\n $stat['damage'] = $stat['damage'] - ($stat['damage'] / 4);\n }\n if ($bdamage == 2) \n {\n $stat['damage'] = $stat['damage'] * 2;\n }\n if ($bdamage == 1) \n {\n $stat['damage'] = $stat['damage'] + ($stat['damage'] / 2);\n $eunik = $eunik - ($eunik / 10);\n }\n if ($bdamage == 3) \n {\n $stat['damage'] = $stat['damage'] - ($stat['damage'] / 2);\n $eunik = $eunik + ($eunik / 10);\n }\n $rzut2 = (rand(1,($player -> level * 10)));\n $stat['damage'] = ($stat['damage'] + $rzut2);\n $stat['damage'] = ($stat['damage'] - $enemy['endurance']);\n if ($stat['damage'] < 1) \n {\n $stat['damage'] = 0;\n }\n if ($arrEquip[0][0] && $gwtbr > $arrEquip[0][6]) \n {\n\t$stat['damage'] = 0;\n\tif ($arrEquip[11][6] > $gwtbr)\n\t {\n\t $stat['damage'] += (($arrEquip[11][2] + $player->strength) + $player->level);\n\t }\n\t$krytyk = 1;\n }\n if ($arrEquip[11][0] && $gwtbr > $arrEquip[11][6]) \n {\n\t$stat['damage'] = 0;\n\tif ($arrEquip[0][6] > $gwtbr)\n\t {\n\t $stat['damage'] += (($arrEquip[0][2] + $player->strength) + $player->level);\n\t }\n\t$krytyk = 1;\n }\n if ($arrEquip[1][0] && ($gwtbr > $arrEquip[1][6] || $gwtbr > $arrEquip[6][6])) \n {\n $stat['damage'] = 0;\n $krytyk = 1;\n }\n if ($arrEquip[1][0] && !$arrEquip[6][0]) \n {\n $stat['damage'] = 0;\n $krytyk = 1;\n }\n $ehp = $_SESSION[$number];\n if ($ehp <= 0)\n {\n $smarty -> assign(\"Message\", ERROR);\n $smarty -> display('error1.tpl');\n $gwtbr = $gwtbr + 1;\n }\n if ($arrEquip[1][0]) \n {\n $eunik = $eunik * 2;\n }\n if ($ehp > 0 && $player -> hp > 0) \n {\n if ($arrEquip[0][0]) \n {\n $zmeczenie = $zmeczenie + $arrEquip[0][4];\n } \n\telseif ($arrEquip[1][0]) \n {\n $zmeczenie = $zmeczenie + $arrEquip[1][4];\n }\n\tif ($arrEquip[11][0])\n\t {\n\t $zmeczenie += $arrEquip[11][4];\n\t }\n $szansa = rand(1, 100);\n if ($eunik >= $szansa && $szansa < 97) \n {\n $smarty -> assign (\"Message\", \"<b>\".$enemy['name'].\"</b> \".ENEMY_DODGE.\"!<br />\");\n $smarty -> display ('error1.tpl');\n if ($arrEquip[1][0]) \n {\n $gwtbr = ($gwtbr + 1);\n }\n } \n\telseif ($zmeczenie <= $player -> cond) \n {\n if ($arrEquip[0][0] || $arrEquip[1][0] || $arrEquip[11][0]) \n\t {\n\t\t$gwtbr++;\n\t\t$rzut = rand(1, 1000) / 10;\n\t\t$intRoll = rand(1, 100);\n\t\t$arrLocations = array('w tułów', 'w głowę', 'w kończynę');\n\t\t$intHit = rand(0, 2);\n\t\tif ($krytyk >= $rzut && $intRoll <= $krytyk && $player->fight != 999) \n\t\t {\n\t\t $gatak++;\n\t\t $ehp = 0;\n\t\t $smarty->assign(\"Message\", showcritical($arrLocations[$intHit], $strAtype, 'pve', $enemy['name']));\n\t\t }\n\t\telse\n\t\t {\n\t\t $ehp -= $stat['damage'];\n\t\t $smarty -> assign (\"Message\", YOU_ATTACK1.\" \".$name.\" <b>\".$enemy['name'].\"</b> \".$arrLocations[$intHit].\" \".INFLICT.\" <b>\".$stat['damage'].\"</b> \".DAMAGE.\"! (\".$ehp.\" \".LEFT.\")</font><br />\");\n\t\t if ($stat['damage'] > 0) \n\t\t {\n\t\t\t$gatak = ($gatak + 1);\n\t\t }\n\t\t }\n\t\t$smarty -> display ('error1.tpl');\n\t }\n }\n }\n $_SESSION[$number] = $ehp;\n if ($arrEquip[0][0]) \n {\n gainability($player -> id, $player -> user, 0, $gatak, 0, $player -> mana, $player -> id, 'weapon');\n lostitem($gwtbr, $arrEquip[0][6], YOU_WEAPON, $player -> id, $arrEquip[0][0], $player -> id, HAS_BEEN1, $player->level);\n }\n if ($arrEquip[11][0])\n {\n\tif (!$arrEquip[0][0])\n\t {\n\t gainability($player -> id, $player -> user, 0, $gatak, 0, $player -> mana, $player -> id, 'weapon');\n\t }\n\tlostitem($gwtbr, $arrEquip[11][6], YOU_WEAPON, $player -> id, $arrEquip[11][0], $player -> id, HAS_BEEN1, $player->level);\n }\n if ($arrEquip[1][0]) \n {\n gainability($player -> id, $player -> user, 0, $gatak, 0, $player -> mana, $player -> id, 'bow');\n lostitem($gwtbr, $arrEquip[1][6], YOU_WEAPON, $player -> id, $arrEquip[1][0], $player -> id, HAS_BEEN1, $player->level);\n lostitem($gwtbr, $arrEquip[6][6], YOU_QUIVER, $player -> id, $arrEquip[6][0], $player -> id, HAS_BEEN1, $player->level);\n }\n $_SESSION['exhaust'] = $zmeczenie;\n}",
"public function attack(Character $target) {\n $rand = rand(1, 100);\n if ($rand < 10 ) {\n $status = $this->potion(); // On regénère la vie !\n }\n else if ($rand > 10 && $rand < 25) {\n $status = $this->diablotin($target); // diablotin\n }\n else if ($rand > 25 && $rand < 37) {\n $status = $this->siphonAme($target); // Siphon d'Ames\n }\n else if ($rand > 37 && $rand < 65) {\n $status = $this->drainVie($target); // Drain de vie\n }\n else if ($rand > 65 && $rand < 85) {\n $status = $this->gangreFeu($target); // GangreFeu\n }\n else{\n $status = $this->coupBaguette($target); // Attaque à la baguette !\n }\n return $status;\n }",
"public function attack($mob_obj){\t\t\r\n\t\t// Disable champion from other things while attacking\r\n\t\t$this->addEffect('Disable', Array('duration' => $this->attackSpeed()));\r\n\t\treturn $mob_obj->receiveDamage($this->base_attack_damage + ((1 - $this->level) * $this->attack_damage_per_level), 'armor', $this->stats());\t\r\n\t\t\t\r\n\t}",
"public static function ability_function_forward_attack($objects, $target_options, $damage_options, $recovery_options, $effect_options = array()){\n\n // Define defaults for undefined target options\n if (!isset($target_options['stat_kind'])){ $target_options['stat_kind'] = 'energy'; }\n if (!isset($target_options['robot_frame'])){ $target_options['robot_frame'] = 'shoot'; }\n if (!isset($target_options['robot_kickback'])){ $target_options['robot_kickback'] = array(0, 0, 0); }\n if (!isset($target_options['ability_frame'])){ $target_options['ability_frame'] = 0; }\n if (!isset($target_options['ability_offset'])){ $target_options['ability_offset'] = array(110, 0, 10); }\n if (!isset($target_options['ability_text'])){ $target_options['ability_text'] = '{this_robot_name} uses the {this_ability_name}!'; }\n\n // Define defaults for undefined damage options\n if (!isset($damage_options['robot_frame'])){ $damage_options['robot_frame'] = 'damage'; }\n if (!isset($damage_options['robot_kickback'])){ $damage_options['robot_kickback'] = array(10, 0, 0); }\n if (!isset($damage_options['ability_sucess_frame'])){ $damage_options['ability_sucess_frame'] = 4; }\n if (!isset($damage_options['ability_success_offset'])){ $damage_options['ability_success_offset'] = array(-90, 0, 10); }\n if (!isset($damage_options['ability_success_text'])){ $damage_options['ability_success_text'] = 'The {this_ability_name} hit the target!'; }\n if (!isset($damage_options['ability_failure_frame'])){ $damage_options['ability_failure_frame'] = 4; }\n if (!isset($damage_options['ability_failure_offset'])){ $damage_options['ability_failure_offset'] = array(-100, 0, -10); }\n if (!isset($damage_options['ability_failure_text'])){ $damage_options['ability_failure_text'] = 'The {this_ability_name} missed...'; }\n\n // Define defaults for undefined recovery options\n if (!isset($recovery_options['robot_frame'])){ $recovery_options['robot_frame'] = 'taunt'; }\n if (!isset($recovery_options['robot_kickback'])){ $recovery_options['robot_kickback'] = array(0, 0, 0); }\n if (!isset($recovery_options['ability_sucess_frame'])){ $recovery_options['ability_sucess_frame'] = 4; }\n if (!isset($recovery_options['ability_success_offset'])){ $recovery_options['ability_success_offset'] = array(-45, 0, 10); }\n if (!isset($recovery_options['ability_success_text'])){ $recovery_options['ability_success_text'] = 'The {this_ability_name} was absorbed by the target!'; }\n if (!isset($recovery_options['ability_failure_frame'])){ $recovery_options['ability_failure_frame'] = 4; }\n if (!isset($recovery_options['ability_failure_offset'])){ $recovery_options['ability_failure_offset'] = array(-100, 0, -10); }\n if (!isset($recovery_options['ability_failure_text'])){ $recovery_options['ability_failure_text'] = 'The {this_ability_name} had no effect on the target...'; }\n\n // Define defaults for undefined effect options\n if (!isset($effect_options['stat_kind'])){ $effect_options = false; }\n else {\n if (!isset($effect_options['damage_text'])){ $effect_options['damage_text'] = '{this_robot_name}\\'s stats were damaged!'; }\n if (!isset($effect_options['recovery_text'])){ $effect_options['recovery_text'] = '{this_robot_name}\\'s stats improved!'; }\n if (!isset($effect_options['effect_chance'])){ $effect_options['effect_chance'] = 50; }\n }\n\n // Extract all objects into the current scope\n extract($objects);\n\n // Define Search and replace object strings for replacing\n $search_replace = array();\n $search_replace['this_player_name'] = $this_player->print_player_name();\n $search_replace['this_robot_name'] = $this_robot->print_robot_name();\n $search_replace['target_player_name'] = $target_player->print_player_name();\n $search_replace['target_robot_name'] = $target_robot->print_robot_name();\n $search_replace['this_ability_name'] = $this_ability->print_ability_name();\n\n // Run the obtion arrays through the parsing function\n $target_options = self::parse_string_variables($search_replace, $target_options);\n $damage_options = self::parse_string_variables($search_replace, $damage_options);\n $recovery_options = self::parse_string_variables($search_replace, $recovery_options);\n if (!empty($effect_options)){\n $effect_options = self::parse_string_variables($search_replace, $effect_options);\n }\n\n // Update target options for this ability\n $this_ability->target_options_update(array(\n 'frame' => $target_options['robot_frame'],\n 'kickback' => $target_options['robot_kickback'],\n 'success' => array(\n $target_options['ability_frame'],\n $target_options['ability_offset'][0],\n $target_options['ability_offset'][1],\n $target_options['ability_offset'][2],\n $target_options['ability_text']\n )\n ));\n\n // Update damage options for this ability\n $this_ability->damage_options_update(array(\n 'kind' => $target_options['stat_kind'],\n 'frame' => $damage_options['robot_frame'],\n 'kickback' => $damage_options['robot_kickback'],\n 'success' => array(\n $damage_options['ability_sucess_frame'],\n $damage_options['ability_success_offset'][0],\n $damage_options['ability_success_offset'][1],\n $damage_options['ability_success_offset'][2],\n $damage_options['ability_success_text']\n ),\n 'failure' => array(\n $damage_options['ability_failure_frame'],\n $damage_options['ability_failure_offset'][0],\n $damage_options['ability_failure_offset'][1],\n $damage_options['ability_failure_offset'][2],\n $damage_options['ability_failure_text']\n )\n ));\n\n // Update recovery options for this ability\n $this_ability->recovery_options_update(array(\n 'kind' => $target_options['stat_kind'],\n 'frame' => $recovery_options['robot_frame'],\n 'kickback' => $recovery_options['robot_kickback'],\n 'success' => array(\n $recovery_options['ability_sucess_frame'],\n $recovery_options['ability_success_offset'][0],\n $recovery_options['ability_success_offset'][1],\n $recovery_options['ability_success_offset'][2],\n $recovery_options['ability_success_text']\n ),\n 'failure' => array(\n $damage_options['ability_failure_frame'],\n $damage_options['ability_failure_offset'][0],\n $damage_options['ability_failure_offset'][1],\n $damage_options['ability_failure_offset'][2],\n $damage_options['ability_failure_text']\n )\n ));\n\n\n // Target the opposing robot with this ability\n $this_robot->trigger_target($target_robot, $this_ability);\n\n // Attempt to inflict damage on the opposing robot\n $stat_damage_amount = $this_ability->ability_damage;\n $target_robot->trigger_damage($this_robot, $this_ability, $stat_damage_amount);\n\n // Only apply a secondary affect if one was defined\n if (!empty($effect_options)){\n\n // Define the stat property strings\n $robot_stat_prop = 'robot_'.$effect_options['stat_kind'];\n\n // Trigger effect if target isn't disabled and ability was successful and chance\n if (\n $target_robot->robot_status != 'disabled' &&\n $this_ability->ability_results['this_result'] != 'failure' &&\n $this_ability->ability_results['this_amount'] > 0 &&\n $target_robot->$robot_stat_prop > 0 &&\n ($effect_options['effect_chance'] == 100 || $this_battle->critical_chance($effect_options['effect_chance']))\n ){\n\n // Define the default damage options for the stat effect\n $this_ability->damage_options_update(array(\n 'kind' => $effect_options['stat_kind'],\n 'frame' => 'defend',\n 'percent' => true,\n 'kickback' => array(10, 0, 0),\n 'success' => array(9, 0, 0, -10, $effect_options['damage_text']),\n 'failure' => array(9, 0, 0, -9999, '')\n ));\n\n // Define the default recovery options for the stat effect\n $this_ability->recovery_options_update(array(\n 'kind' => $effect_options['stat_kind'],\n 'frame' => 'taunt',\n 'percent' => true,\n 'kickback' => array(0, 0, 0),\n 'success' => array(9, 0, 0, -10, $effect_options['recovery_text']),\n 'failure' => array(9, 0, 0, -9999, '')\n ));\n\n // Calculate the exact damage amount and trigger it on the target\n $trigger_options = array('apply_modifiers' => false);\n $stat_damage_amount = ceil($target_robot->$robot_stat_prop * ($this_ability->ability_damage2 / 100));\n $target_robot->trigger_damage($this_robot, $this_ability, $stat_damage_amount, true, $trigger_options);\n }\n\n }\n\n // Return true on success\n return true;\n\n }",
"public function startDuel(){\n $this->plugin->getScheduler()->cancelTask($this->countdownTaskHandler->getTaskId());\n\n /** @var Player $player1 */\n $player1 = $this->players[0];\n /** @var Player $player2 */\n $player2 = $this->players[1];\n var_dump($this->spawn1);\n var_dump($this->spawn2);\n $player1->teleport($this->spawn1);\n $player2->teleport($this->spawn2);\n $this->sparyParticle($player1);\n $this->sparyParticle($player2);\n $player1->setGamemode(0);\n $player2->setGamemode(0);\n\n // Give kit\n if(OneVsOne::getInstance()->getConfig()->get(\"force-kit\") === true){\n foreach($this->players as $player){\n $this->giveKit($player);\n }\n }\n // Fix start time\n $this->startTime = new DateTime('now');\n\n $player1->sendTip(OneVsOne::getMessage(\"duel_tip\"));\n $player1->sendMessage(str_replace(\"{roundtime}\", OneVsOne::getInstance()->getConfig()->get(\"time-limit\"), OneVsOne::getMessage(\"duel_start\")));\n\n $player2->sendTip(OneVsOne::getMessage(\"duel_tip\"));\n $player2->sendMessage(str_replace(\"{roundtime}\", OneVsOne::getInstance()->getConfig()->get(\"time-limit\"), OneVsOne::getMessage(\"duel_start\")));\n }",
"function stInterPlayerTurn() {\n \n // Give him extra time for his actions to come\n self::giveExtraTime(self::getActivePlayerId());\n \n // Does he plays again?\n if (self::getGameStateValue('first_player_with_only_one_action')) {\n // First turn: the player had only one action to make\n $next_player = true;\n self::setGameStateValue('first_player_with_only_one_action', 0);\n }\n else if (self::getGameStateValue('second_player_with_only_one_action')) {\n // 4 players at least and this is the second turn: the player had only one action to make\n $next_player = true;\n self::setGameStateValue('second_player_with_only_one_action', 0);\n }\n else if (self::getGameStateValue('has_second_action')) {\n // The player took his first action and has another one\n $next_player = false;\n self::setGameStateValue('has_second_action', 0);\n }\n else {\n // The player took his second action\n $next_player = true;\n self::setGameStateValue('has_second_action', 1);\n }\n if ($next_player) { // The turn for the current player is over\n // Reset the flags for Monument special achievement\n self::resetFlagsForMonument();\n \n // Activate the next player in turn\n $this->activeNextPlayer();\n $player_id = self::getActivePlayerId();\n self::setGameStateValue('active_player', $player_id);\n }\n self::notifyGeneralInfo('<!--empty-->');\n self::trace('interPlayerTurn->playerTurn');\n $this->gamestate->nextState();\n }",
"public static function ability_function_spread_attack($objects, $options = array()){\n\n\n }",
"public function stop() {\n if($this->combatantA->hp > 0) {\n $this->winnerType = \"player\";\n $this->winnerID = $this->combatantAID;\n } elseif ($this->combatantB->hp > 0) {\n $this->winnerType = ($this->type == \"pvp\" ? \"player\" : \"monster\");\n $this->winnerID = $this->combatantBID;\n } else {\n $this->winnerType = \"draw\";\n }\n\n // Bounty + XP\n if($this->type == \"monster\" && $this->combatantB->hp <= 0) {\n $loot = $this->combatantB->dropItems($this->combatantA->getDropItemPerc());\n $this->combatantA->gainItems($loot);\n \n $contact = $this->combatantB->dropContact($this->combatantA->getDropContactPerc());\n $this->combatantA->gainContact($contact, \"battle\");\n\n /**\n * monster->xp can be defined to deviate from the standard\n * attack / 2 xp reward\n */\n if(isset($this->combatantB->xp)) {\n $this->combatantA->gainXp($this->combatantB->xp, \"battle\");\n } else {\n $this->combatantA->gainXp($this->combatantB->attack / 4, \"battle\");\n }\n }\n\n $this->combatantA->ongoingBattleID = null;\n if($this->type == \"pvp\") {\n // @todo Message to PVP enemy\n $this->combatantB->ongoingBattleID = null;\n }\n\n $this->state = \"resolved\";\n $this->objectState = \"\";\n\n /**\n * ToDo: why does backupbehavior think that no attribute changed\n * if we set ongoingBattleID to null?\n */\n // $this->combatantA->save();\n $this->combatantA->update();\n if($this->type == \"pvp\") {\n $this->combatantB->save();\n }\n\n $this->update();\n $this->reconstructCombatants();\n \n // Notify the world about this result\n $event = new BattleEvent($this);\n $this->combatantA->onFinishedBattle($event);\n if($this->type == \"pvp\") {\n $this->combatantB->onFinishedBattle($event);\n }\n }",
"function _test_attack($type, $i, $opponent_color, $try_move) {\n/*\nprintf(\"try_move['from']: %s\\n\", $try_move['from']);\nprintf(\"try_move['to']: %s\\n\", $try_move['to']);\nprintf(\"try_move['piece']: %s\\n\", $try_move['piece']);\nprintf(\"this->enpa: %s\\n\", $this->enpa);\n*/\n $p = null;\n if ($try_move) {\n\n if ($i === $try_move['from']) {\n $p = 0;\n } \n elseif ($i === $try_move['to']) {\n // The trial move takes the piece being considered\n $p = $try_move['piece'];\n } \n elseif ( $try_move['piece'] === 'p' \n && intval($this->enpa) === intval($try_move['to'])\n && intval($i) === intval($this->enpa) + 10\n ) {\n $p = 0;\n }\n elseif ( $try_move['piece'] === 'P' \n && intval($this->enpa) === intval($try_move['to'])\n && intval($i) === intval($this->enpa) - 10\n ) {\n $p = 0;\n }\n else {\n $p = $this->pos[$i];\n }\n } \n else {\n $p = $this->pos[$i];\n }\n \n if ($p === null) {\n//print(\"A\\n\");\n return 1;\n }\n\n if ($p && $this->piece_color($p) === $opponent_color && strpos($type, strtolower($p)) !== FALSE) {\n//printf(\"p:%s\\n\", $p);\n//print(\"B\\n\");\n return -1;\n }\n//print(\"C\\n\");\n return $p;\n }",
"public function passGo($player){\n $player->collect($this->go_amount);\n }",
"function tplayer()\r\n{\r\n require_once(\"heading.php\");\r\n$telename = $_POST['tchar'];\r\n$tplace = $_POST['tplace'];\r\n\r\n mysql_select_db($characters_db[$realm_id]['addr'], $characters_db[$realm_id]['user'], $characters_db[$realm_id]['pass'], $characters_db[$realm_id]['name']); ;\r\n $old_userid = (int)0;\r\n $old_userid = mysql_fetch_row(mysql_query(\"SELECT `account` FROM characters WHERE `name` = '$telename';\"));\r\n $old_userid = $old_userid[0];\r\n mysql_select_db($mmfpm_db['addr'], $mmfpm_db['user'], $mmfpm_db['pass']) ;\r\n $total_points = mysql_fetch_row(mysql_query(\"SELECT `points` FROM point_system WHERE `accountid` = '$user_id';\"));\r\n $total_points = $total_points[0];\r\n if($total_points <= 0)\r\n $total_points = (int)0;\r\nif($total_points > ($tp_cost-1))\r\n{\r\n if($old_userid == $user_id)\r\n {\r\n require_once \"scripts/PHPTelnet.php\";\r\n $telnet = new PHPTelnet();\r\n $result = $telnet->Connect($server[$realm_id]['addr'],$server[$realm_id]['game_acc'],$server[$realm_id]['game_pass']);\r\n if ($result == 0)\r\n {\r\n mysql_select_db($mmfpm_db['addr'], $mmfpm_db['user'], $mmfpm_db['pass']) ;\r\n mysql_query(\"INSERT INTO point_system_requests (`username`, `request`, `date`, `code`, `treated`) VALUES ('$user_name', 'Teleport to $tplace', '$datetime', '$telename', 'Yes');\");\r\n mysql_query(\"UPDATE point_system SET `points` = `points` - $tp_cost WHERE `accountid` = '$user_id';\");\r\n $telnet->DoCommand(\"tele name $telename $tplace\");\r\n $telnet->Disconnect();\r\n\r\n $output .= \"<div class=\\\"top\\\"><h1>$telename Has been teleported to $tplace!</h1></div>\";\r\n }\r\n else\r\n {\r\n mysql_select_db($mmfpm_db['addr'], $mmfpm_db['user'], $mmfpm_db['pass']) ;\r\n mysql_query(\"INSERT INTO point_system_requests (`username`, `request`, `date`, `code`, `treated`) VALUES ('$user_name', 'TP Error to $tplace', '$datetime', '$telename', 'Yes');\");\r\n $output .= \"<div class=\\\"top\\\"><h1>$telename, There was a connection error, try again later!</h1></div>\";\r\n }\r\n }\r\n else $output .= \"<div class=\\\"top\\\"><h1>$telename Is not your player, you cannot teleport him to $tplace!</h1></div>\";\r\n}\r\nelse $output .= \"<div class=\\\"top\\\"><h1>$telename You do not have enough points to teleport to $tplace!</h1></div>\"; \r\nrequire_once(\"footer.php\");\r\n\r\n}",
"public static function ability_function_ranged_attack($objects, $options = array()){\n\n\n }",
"public function hit()\n {\n $fight = $this->getDamage();\n $fight = $fight + 5;\n $this->setDamage($fight);\n\n }",
"public function doAttackSucceed($fighter1Level, $fighter2Level) {\n $doAttackSucceed = null;\n\n if (is_int($fighter1Level) && is_int($fighter2Level)) {\n // Pick a random number between 1 and 20\n $randomValue = rand(1, 20);\n\n // Use the formula to find the computed value\n $computedValue = 10 + $fighter2Level - $fighter1Level;\n\n // If the random value is more than the computed value, the attack succeeds. Else, it fails.\n if ($randomValue > $computedValue) {\n $doAttackSucceed = true;\n } else {\n $doAttackSucceed = false;\n }\n }\n\n return $doAttackSucceed;\n }",
"public function ability() {\n\n $this->startMove(3, 0.2);\n echo \"THE ENGINE IS OVERHEATED!\\n\";\n $this->switchEngine();\n\n\n\n\n }",
"public function attack(EntityDamageEvent $source) : void{\n\t\t$damage = $this->getDamage();\n\t\tPureEntities::logOutput(\"$this: attacked with original damage of $damage\", PureEntities::DEBUG);\n\t\t$reduceDamagePercent = 0;\n\t\tif($this->getMobEquipment() !== null){\n\t\t\t$reduceDamagePercent = $this->getMobEquipment()->getArmorDamagePercentToReduce();\n\t\t}\n\t\tif($reduceDamagePercent > 0){\n\t\t\t$reduceBy = $damage * $reduceDamagePercent / 100;\n\t\t\tPureEntities::logOutput(\"$this: reduce damage by $reduceBy\", PureEntities::DEBUG);\n\t\t\t$damage = $damage - $reduceBy;\n\t\t}\n\n\t\tPureEntities::logOutput(\"$this: attacked with final damage of $damage\", PureEntities::DEBUG);\n\n\t\tparent::attack($source);\n\t}",
"public function playerAction($playerAction = null) {\n // Yii::trace(\"playerAction. Action: \" . $playerAction->name);\n \n // Did the player define a new and valid action?\n if($playerAction != $this->{$this->getHeroString() . \"Action\"} &&\n is_object($playerAction)) {\n\n $this->{$this->getHeroString() . \"Action\"} = $playerAction;\n\n // Let the monster act\n if($this->type == \"monster\") {\n $this->combatantBAction = $this->combatantB->call(\"act\", $this);\n }\n\n // If enemy has already acted: continue!\n if(is_object($this->{$this->getEnemyString() . \"Action\"})) {\n\n $this->calculateRound();\n } else {\n // ToDo: Print waiting for opponent message\n }\n } else {\n Yii::trace(\"Player action is the same as before (or invalid)\");\n }\n }",
"public function spellDamageSingleTarget(SR_Player $player, SR_Player $target, $level, $key='10000', $damage, $arg4='')\n\t{\n\t\t$maxhp = $target->getMaxHP();\n\t\t$damage = round($damage, 1);\n\t\tif ($damage <= 0)\n\t\t{\n// \t\t\t$append = $append_ep = $player->lang('but no damge');\n// \t\t\t$append = $append_ep = ' but caused no damage';\n\t\t\t$hp = $target->getHP();\n\t\t\t$this->announceADV($player, $target, $level, $key, $damage, $hp, $maxhp, $arg4);\n\t\t\treturn true;\n\t\t}\n\t\t\n\t\t$p = $player->getParty();\n\t\t$mc = $p->getMemberCount();\n\t\t\n\t\t\n\t\t$target->dealDamage($damage);\n\t\tif ($target->isDead())\n\t\t{\n// \t\t\t$append = $append_ep = ' and kills them with '.$damage.' damage';\n\t\t\t\n\t\t\t$this->announceADV($player, $target, $level, $key, $damage, '0', $maxhp, $arg4);\n\n\t\t\t# Loot him!\n\t\t\t$xp = $target->isHuman() ? 0 : $target->getLootXP();\n//\t\t\t$xp = $target->getLootXP();\n\t\t\t$ny = round($target->getLootNuyen() / $mc, 1);\n\t\t\t$pxp = 0;\n\t\t\tif ($player->isNPC())\n\t\t\t{\n\t\t\t\t$target->resetXP();\n\t\t\t}\n\t\t\t\n\t\t\tforeach ($p->getMembers() as $member)\n\t\t\t{\n\t\t\t\t$lxp = $xp/$mc;\n\t\t\t\t$leveldiff = ($target->getBase('level')+1) / ($member->getBase('level')+1);\n\t\t\t\t$lxp *= $leveldiff;\n\t\t\t\t$lxp = round(Common::clamp($lxp, 0.01), 2);\n\t\t\t\t$pxp += $lxp;\n\t\t\t\t$member->giveXP($lxp);\n\t\t\t\t$member->giveNuyen($ny);\n\t\t\t\t$member->msg('5105', array(Shadowfunc::displayNuyen($ny), $lxp));\n// \t\t\t\t$member->message(sprintf('You loot %s Nuyen and %s XP.', $ny, $lxp));\n\t\t\t}\n\t\t\t\n\t\t\t$p->givePartyXP($pxp);\n\t\t\t\n\t\t\t$target->gotKilledBy($player);\n\n\t\t}\n\t\telse # just some dmg\n\t\t{\n\t\t\t$hp = $target->getHP();\n// \t\t\t$maxhp = $target->getMaxHP();\n// \t\t\t$append = \" and caused {$damage} damage\";\n// \t\t\t$append_ep = \"{$append} ($hp/$maxhp)HP left.\";\n\t\t\t$this->announceADV($player, $target, $level, $key, $damage, $hp, $maxhp, $arg4);\n\t\t}\n\n\t\treturn true;\n\t}"
] |
[
"0.6507819",
"0.6298071",
"0.6287195",
"0.62803596",
"0.5986575",
"0.5864103",
"0.575281",
"0.5747989",
"0.5714641",
"0.5687707",
"0.5652424",
"0.55247265",
"0.5519183",
"0.54986715",
"0.54504234",
"0.53873235",
"0.53822654",
"0.5322674",
"0.53224206",
"0.52773213",
"0.5270519",
"0.5256594",
"0.5248174",
"0.5206998",
"0.517197",
"0.516612",
"0.5161713",
"0.51605624",
"0.51402926",
"0.5135026"
] |
0.63846874
|
1
|
Make a bySea attack that involve all player 1 unit until one of two player lost all unit
|
static function bySeaAttack($player1,$player2,&$logManager,$language){
$p1Unit = $player1;
$p2Unit = $player2;
$p1UnitLost = $p2UnitLost = 0;
while ($p1Unit > 0 && $p2Unit > 0){
$p1Dice = ($p1Unit <= 3) ? $p1Unit : 3;
$p2Dice = ($p2Unit <= 3) ? $p2Unit : 3;
$unitLost = CombatManager::terranAttack($p1Dice, $p2Dice,$logManager,$language);
$p1Unit = $p1Unit-$unitLost[0];
$p1UnitLost += $unitLost[0];
$p2Unit = $p2Unit-$unitLost[1];
$p2UnitLost += $unitLost[1];
}
echo 'ciao';
$logManager->addLog('{Player1} '.$language['losts'].' '.$p1UnitLost.' '.$language['units']);
$logManager->addLog('{Player2} '.$language['losts'].' '.$p2UnitLost.' '.$language['units']);
return array($p1UnitLost,$p2UnitLost);
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function turnfight($expgain,$goldgain,$action,$addres) \n{\n global $player;\n global $smarty;\n global $db;\n global $title;\n global $enemy;\n global $myczaro;\n global $zmeczenie;\n global $arrEquip;\n global $myunik;\n global $amount;\n global $myagility;\n global $intPoisoned;\n global $arrTags;\n\n $arrEquip = $player -> equipment();\n $player->curstats($arrEquip);\n $myczaro = $db -> Execute(\"SELECT * FROM czary WHERE status='E' AND gracz=\".$player -> id.\" AND typ='O'\");\n $fight = $db -> Execute(\"SELECT fight FROM players WHERE id=\".$player -> id);\n\n $player->user = $arrTags[$player->tribe][0].' '.$player->user.' '.$arrTags[$player->tribe][1];\n\n if ($fight -> fields['fight'] == 0 && $title == 'Arena Walk') \n {\n\terror (NO_ENEMY);\n }\n $premia = 0;\n $zmeczenie = 0;\n if (empty ($enemy['id'])) \n {\n $location = $db -> Execute(\"SELECT miejsce FROM players WHERE id=\".$player -> id);\n if ($location -> fields['miejsce'] == 'Góry') \n {\n\t $intRoll2 = rand(1, 100);\n\t if ($intRoll2 < 25)\n\t {\n\t\t$enemy1 = $db->SelectLimit(\"SELECT * FROM `monsters` WHERE `level`<=\".$player->level.\" AND `location`='Altara' ORDER BY RAND()\", 1);\n\t }\n\t elseif ($intRoll2 > 24 && $intRoll2 < 90)\n\t {\n\t\t$enemy1 = $db->SelectLimit(\"SELECT * FROM `monsters` WHERE `level`<=\".$player->level.\" AND `location`='Altara' ORDER BY `level` DESC\", 1);\n\t }\n\t else\n\t {\n\t\t$enemy1 = $db->SelectLimit(\"SELECT * FROM `monsters` WHERE `level`>=\".$player->level.\" AND `location`='Altara' ORDER BY RAND()\", 1);\n\t }\n $enemy = array(\"strength\" => $enemy1 -> fields['strength'], \"agility\" => $enemy1 -> fields['agility'], \"speed\" => $enemy1 -> fields['speed'], \"endurance\" => $enemy1 -> fields['endurance'], \"hp\" => $enemy1 -> fields['hp'], \"name\" => $enemy1 -> fields['name'], \"exp1\" => $enemy1 -> fields['exp1'], \"exp2\" => $enemy1 -> fields['exp2'], \"level\" => $enemy1 -> fields['level']);\n $enemy1 -> Close();\n }\n if ($location -> fields['miejsce'] == 'Las') \n {\n\t $intRoll2 = rand(1, 100);\n\t if ($intRoll2 < 25)\n\t {\n\t\t$enemy1 = $db->SelectLimit(\"SELECT * FROM `monsters` WHERE `level`<=\".$player->level.\" AND `location`='Ardulith' ORDER BY RAND()\", 1);\n\t }\n\t elseif ($intRoll2 > 24 && $intRoll2 < 90)\n\t {\n\t\t$enemy1 = $db->SelectLimit(\"SELECT * FROM `monsters` WHERE `level`<=\".$player->level.\" AND `location`='Ardulith' ORDER BY `level` DESC\", 1);\n\t }\n\t else\n\t {\n\t\t$enemy1 = $db->SelectLimit(\"SELECT * FROM `monsters` WHERE `level`>=\".$player->level.\" AND `location`='Ardulith' ORDER BY RAND()\", 1);\n\t }\n $enemy = array(\"strength\" => $enemy1 -> fields['strength'], \"agility\" => $enemy1 -> fields['agility'], \"speed\" => $enemy1 -> fields['speed'], \"endurance\" => $enemy1 -> fields['endurance'], \"hp\" => $enemy1 -> fields['hp'], \"name\" => $enemy1 -> fields['name'], \"exp1\" => $enemy1 -> fields['exp1'], \"exp2\" => $enemy1 -> fields['exp2'], \"level\" => $enemy1 -> fields['level']);\n $enemy1 -> Close();\n }\n }\n if ($title == 'Arena Walk') \n {\n $arrClass = array('Wojownik','Rzemieślnik', 'Złodziej', 'Barbarzyńca');\n if (in_array($player -> clas, $arrClass) && $myczaro -> fields['id']) \n {\n error (ONLY_MAGE);\n }\n }\n if ($arrEquip[2][0]) \n {\n $premia = ($premia + $arrEquip[2][2]);\n }\n if ($arrEquip[4][0]) \n {\n $premia = ($premia + $arrEquip[4][2]);\n }\n if ($arrEquip[5][0]) \n {\n $premia = ($premia + $arrEquip[5][2]);\n }\n if ($arrEquip[3][0]) \n {\n $premia = ($premia + $arrEquip[3][2]);\n }\n if ($player -> clas == 'Wojownik' || $player -> clas == 'Barbarzyńca') \n {\n $enemy['damage'] = ($enemy['strength'] - ($player -> level + $player -> cond + $premia));\n } \n else \n {\n $enemy['damage'] = ($enemy['strength'] - ($player -> cond + $premia));\n }\n if ($myczaro -> fields['id']) \n {\n $myczarobr = ($player -> wisdom * $myczaro -> fields['obr']) - (($myczaro -> fields['obr'] * $player -> wisdom) * ($arrEquip[3][4] / 100));\n if ($arrEquip[2][0]) \n {\n $myczarobr = ($myczarobr - (($myczaro -> fields['obr'] * $player -> wisdom) * ($arrEquip[2][4] / 100)));\n }\n if ($arrEquip[4][0]) \n {\n $myczarobr = ($myczarobr - (($myczaro -> fields['obr'] * $player -> wisdom) * ($arrEquip[4][4] / 100)));\n }\n if ($arrEquip[5][0]) \n {\n $myczarobr = ($myczarobr - (($myczaro -> fields['obr'] * $player -> wisdom) * ($arrEquip[5][4] / 100)));\n }\n if ($arrEquip[7][0]) \n {\n $intN = 6 - (int)($arrEquip[7][4] / 20);\n $intBonus = (10 / $intN) * $player -> level * rand(1, $intN);\n $myczarobr = ($myczarobr + $intBonus);\n }\n if ($myczarobr < 0) \n {\n $myczarobr = 0;\n }\n $myobrona = ($myczarobr + $player -> cond + $premia);\n $enemy['damage'] = ($enemy['strength'] - $myobrona);\n }\n if (!$arrEquip[3][0] && !$myczaro -> fields['id']) \n {\n $enemy['damage'] = ($enemy['strength'] - $player -> cond);\n }\n $gmagia = 0;\n if (!isset($_SESSION['round']))\n {\n $_SESSION['round'] = 1;\n }\n $smarty -> assign (\"Message\", \"<ul><li><b>\".$player -> user.\"</b> \".VERSUS.\" <b>\".$enemy['name'].\"</b><br />\");\n $smarty -> display ('error1.tpl');\n /**\n * Count points in fight\n */\n if (!isset($_SESSION['points']) || $_SESSION['points'] == 0)\n {\n $_SESSION['points'] = ceil($player->speed / $enemy['speed']);\n }\n /**\n * Count dodge - player and monster\n */\n if ($player -> clas == 'Wojownik' || $player -> clas == 'Barbarzyńca') \n {\n $myunik = (($player->agility - $enemy['agility']) + $player -> level + $player -> miss);\n $eunik = (($enemy['agility'] - $player->agility) - ($player -> attack + $player -> level));\n\tif ($arrEquip[11][0])\n\t {\n\t $eunik -= ($player->attack / 5);\n\t }\n }\n if ($player -> clas == 'Rzemieślnik' || $player -> clas == 'Złodziej' || $player -> clas == '') \n {\n $myunik = ($player->agility - $enemy['agility'] + $player -> miss);\n $eunik = (($enemy['agility'] - $player->agility) - $player -> attack);\n }\n if ($player -> clas == 'Mag') \n {\n $myunik = ($player->agility - $enemy['agility'] + $player -> miss);\n $eunik = (($enemy['agility'] - $player->agility) - ($player -> magic + $player -> level));\n }\n if (!isset($myunik)) \n {\n $myunik = 1;\n }\n if (!isset($eunik)) \n {\n $eunit = 1;\n }\n if ($eunik < 1) \n {\n $eunik = 1;\n }\n if ($_SESSION['points'] > 5) \n {\n $_SESSION['points'] = 5;\n }\n if (isset ($_SESSION['exhaust'])) \n {\n $zmeczenie = $_SESSION['exhaust'];\n }\n if (isset($_SESSION['miss']) && $_SESSION['miss'] > $myunik) \n {\n $myunik = $_SESSION['miss'];\n }\n $amount = 1;\n if (isset ($_SESSION['razy'])) \n {\n $amount = $_SESSION['razy'];\n }\n if (isset($_SESSION['mon0'])) \n {\n $temp = 0;\n for ($k = 0; $k < $amount; $k ++) \n {\n $strIndex = \"mon\".$k;\n if ($_SESSION[$strIndex] > 0) \n {\n $temp = $temp + 1;\n }\n }\n }\n else\n {\n $temp = $amount;\n $_SESSION['amount'] = $amount;\n for ($k = 0; $k < $amount; $k ++) \n {\n $strIndex = \"mon\".$k;\n $_SESSION[$strIndex] = $enemy['hp'];\n }\n }\n if (isset($temp)) \n {\n if ($temp < 6 && $temp > 0)\n {\n if ($myunik < 1)\n {\n $myunik = 1;\n }\n if (isset($myunik))\n {\n $myunik = ceil($myunik / $temp);\n }\n else\n {\n $myunik = 0;\n }\n }\n else\n {\n $myunik = 1;\n }\n }\n else\n {\n if ($amount < 6)\n {\n if (isset($myunik))\n {\n $myunik = ceil($myunik / $amount);\n }\n else\n {\n $myunik = 0;\n }\n }\n else\n {\n $myunik = 1;\n }\n }\n if ($myunik < 1) \n {\n $myunik = 1;\n }\n $attacks = ceil($enemy['speed'] / $player->speed);\n if ($attacks > 5) \n {\n $attacks = 5;\n }\n if (!isset($_POST['action'])) \n {\n $_POST['action'] = '';\n }\n /**\n * If fight is longer than 24 rounds\n */\n if (isset($_SESSION['round']) && $_SESSION['round'] > 24)\n {\n $db -> Execute(\"UPDATE `players` SET `fight`=0, `hp`=\".$player -> hp.\", `bless`='', `blessval`=0 WHERE `id`=\".$player -> id);\n unset($_SESSION['exhaust'], $_SESSION['round'], $_SESSION['points'], $_SESSION['dodge']);\n for ($k = 0; $k < $amount; $k ++) \n {\n $strIndex = \"mon\".$k;\n unset($_SESSION[$strIndex]);\n }\n if ($title == 'Arena Walk') \n {\n if (!$intPoisoned)\n {\n $smarty -> assign (\"Message\", \"</ul>\".NOT_DECIDE.\"...<br /><ul><li><b>\".B_OPTIONS.\"</a><br /></li></ul>\");\n }\n else\n {\n $smarty -> assign (\"Message\", \"</ul><br /><ul><li><b>\".B_OPTIONS.\"</a><br /></li></ul>\");\n }\n $smarty -> display ('error1.tpl');\n }\n\telseif (in_array($title, array('Portal', 'Astralny plan')))\n\t {\n\t $db->Execute(\"UPDATE `players` SET `miejsce`='Altara' WHERE `id`=\".$player->id);\n\t }\n return;\n }\n $fight -> Close();\n if ($_POST['action'] == 'drink' && $_SESSION['points'] > 0) \n {\n $_SESSION['points'] = $_SESSION['points'] - 1;\n drink ($_POST['potion2']);\n $objMana = $db -> Execute(\"SELECT pm FROM players WHERE id=\".$player -> id);\n $player -> mana = $objMana -> fields['pm'];\n $objMana -> Close();\n if ($_SESSION['points'] >= $attacks && $player -> hp > 0) \n {\n fightmenu($_SESSION['points'],$zmeczenie,$_SESSION['round'],$addres);\n }\n }\n if ($_POST['action'] == 'use' && $_SESSION['points'] > 0) \n {\n $_SESSION['points'] = $_SESSION['points'] - 1;\n if (!isset($_POST['arrows']))\n {\n $_POST['arrows'] = 0;\n }\n equip ($_POST['arrows']);\n $arrEquip = $player -> equipment();\n if ($_SESSION['points'] >= $attacks) \n {\n fightmenu($_SESSION['points'],$zmeczenie,$_SESSION['round'],$addres);\n }\n }\n if ($_POST['action'] == 'weapons' && $_SESSION['points'] > 0) \n {\n $_SESSION['points'] = $_SESSION['points'] - 2;\n if (!isset($_POST['weapon']))\n {\n $_POST['weapon'] = 0;\n }\n equip ($_POST['weapon']);\n $arrEquip = $player -> equipment();\n if ($_SESSION['points'] >= $attacks) \n {\n fightmenu($_SESSION['points'],$zmeczenie,$_SESSION['round'],$addres);\n }\n }\n if ($_POST['action'] == 'escape') \n {\n $chance = (rand(1, $player -> level * 100) + $player -> speed - $enemy['agility']);\n if ($chance > 0) \n {\n $expgain = rand($enemy['exp1'],$enemy['exp2']);\n $expgain = (ceil($expgain / 100));\n $smarty -> assign (\"Message\", ESCAPE_SUCC.\" \".$enemy['name'].YOU_GAIN1.\" \".$expgain.\" \".EXP_PTS.\"<br /></li></ul>\");\n $smarty -> display ('error1.tpl');\n checkexp($player -> exp,$expgain,$player -> level,$player -> race,$player -> user,$player -> id,0,0,$player -> id,'',0);\n $db -> Execute(\"UPDATE players SET fight=0, bless='', blessval=0 WHERE id=\".$player -> id);\n $points = $attacks * 2;\n $temp = 1;\n unset($_SESSION['exhaust'], $_SESSION['round'], $_SESSION['points'], $_SESSION['dodge']);\n for ($k = 0; $k < $amount; $k ++) \n {\n $strIndex = \"mon\".$k;\n unset($_SESSION[$strIndex]);\n }\n if ($title == \"Arena Walk\") \n {\n $smarty -> assign (\"Message\", \"</ul><ul><li><b>\".B_OPTIONS.\"</a><br /></li></ul>\");\n $smarty -> display ('error1.tpl');\n }\n if ($title == 'Astralny plan' || $title == 'Portal')\n {\n $db -> Execute(\"UPDATE `players` SET `fight`=9999 WHERE id=\".$player -> id);\n }\n\t if ($title == 'Przygoda')\n\t {\n\t\t$db -> Execute(\"UPDATE `players` SET `fight`=-1 WHERE id=\".$player -> id);\n\t }\n } \n else \n {\n $smarty -> assign (\"Message\", \"<br />\".ESCAPE_FAIL.\" \".$enemy['name'].\"!\");\n $smarty -> display ('error1.tpl');\n monsterattack($attacks,$enemy,$myunik,$amount);\n if ($player -> hp > 0) \n {\n $_SESSION['round'] = $_SESSION['round'] + 1;\n $_SESSION['points'] = ceil($player->speed / $enemy['speed']);\n fightmenu($_SESSION['points'],$zmeczenie,$_SESSION['round'],$addres);\n }\n }\n }\n if ($_POST['action'] == 'cast' && $_SESSION['points'] > 0) \n {\n $_SESSION['points'] = $_SESSION['points'] - 1;\n if (!isset($_POST['castspell']))\n {\n $_POST['castspell'] = 0;\n }\n castspell($_POST['castspell'],0,$eunik);\n $temp = 0;\n for ($k=0;$k<$amount;$k++) \n {\n $strIndex = \"mon\".$k;\n if ($_SESSION[$strIndex] > 0) \n {\n $temp = $temp + 1;\n }\n }\n if ($temp > 0 && $attacks <= $_SESSION['points']) \n {\n fightmenu($_SESSION['points'],$zmeczenie,$_SESSION['round'],$addres);\n }\n }\n /**\n * Burst offensive spell\n */\n if ($_POST['action'] == 'bspell' && $_SESSION['points'] > 0) \n {\n if (intval($_POST['power']) < 1) \n {\n $smarty -> assign (\"Message\", ERROR);\n $smarty -> display ('error1.tpl');\n $_POST['power'] = 0;\n }\n else\n {\n if ($_POST['power'] > $player -> level)\n {\n $_POST['power'] = $player -> level;\n }\n\t checkvalue($_POST['bspellboost']);\n $intSpelllevel = $db -> Execute(\"SELECT `gracz, `poziom` FROM `czary` WHERE `id`=\".$_POST['bspellboost']);\n\t if ($intSpelllevel->fields['gracz'] != $player->id)\n\t {\n\t\t$intMaxburst = 0;\n\t }\n\t else\n\t {\n\t\t$intMaxburst = $player -> mana - $intSpelllevel -> fields['poziom'];\n\t }\n $intSpelllevel -> Close();\n if ($_POST['power'] > $intMaxburst)\n {\n $_POST['power'] = $intMaxburst;\n }\n $_SESSION['points'] = $_SESSION['points'] - 2;\n castspell($_POST['bspellboost'],$_POST['power'],$eunik);\n }\n $temp = 0;\n for ($k=0;$k<$amount;$k++) \n {\n $strIndex = \"mon\".$k;\n if ($_SESSION[$strIndex] > 0) \n {\n $temp = $temp + 1;\n }\n }\n if ($temp > 0 && $attacks <= $_SESSION['points']) \n {\n fightmenu($_SESSION['points'],$zmeczenie,$_SESSION['round'],$addres);\n }\n }\n /**\n * Burst defensive spell\n */\n if ($_POST['action'] == 'dspell') \n {\n if (intval($_POST['power1']) < 1) \n {\n $smarty -> assign (\"Message\", ERROR);\n $smarty -> display ('error1.tpl');\n $_POST['power1'] = 0;\n }\n if ($_POST['power1'] > $player -> level)\n {\n $_POST['power1'] = $player -> level;\n }\n $intMaxburst = $player -> mana - $myczaro -> fields['poziom'];\n if ($_POST['power1'] > $intMaxburst)\n {\n $_POST['power1'] = $intMaxburst;\n }\n $enemy['damage'] = $enemy['damage'] - $_POST['power1'];\n $player -> mana = $player -> mana - $_POST['power1'];\n monsterattack($attacks,$enemy,$myunik,$amount);\n if ($player -> hp > 0) \n {\n $_SESSION['round'] = $_SESSION['round'] + 1;\n $_SESSION['points'] = ceil($player->speed / $enemy['speed']);\n fightmenu($_SESSION['points'],$zmeczenie,$_SESSION['round'],$addres);\n }\n }\n if ($_POST['action'] == 'nattack' && $_SESSION['points'] > 0) \n {\n attack($eunik,0);\n $temp = 0;\n for ($k=0;$k<$amount;$k++) \n {\n $strIndex = \"mon\".$k;\n if ($_SESSION[$strIndex] > 0) \n {\n $temp = $temp + 1;\n }\n }\n $_SESSION['points'] = $_SESSION['points'] - 1;\n if ($temp > 0 && $attacks <= $_SESSION['points']) \n {\n fightmenu($_SESSION['points'],$zmeczenie,$_SESSION['round'],$addres);\n }\n }\n if ($_POST['action'] == 'dattack' && $_SESSION['points'] > 0) \n {\n $_SESSION['points'] = $_SESSION['points'] - 1;\n attack($eunik,3);\n $temp = 0;\n for ($k=0;$k<$amount;$k++) \n {\n $strIndex = \"mon\".$k;\n if ($_SESSION[$strIndex] > 0) \n {\n $temp = $temp + 1;\n }\n }\n $myunik = $myunik + ($myunik / 2);\n if ($temp > 0 && $attacks <= $_SESSION['points']) \n {\n fightmenu($_SESSION['points'],$zmeczenie,$_SESSION['round'],$addres);\n }\n }\n if ($_POST['action'] == 'aattack' && $_SESSION['points'] > 0) \n {\n $_SESSION['points'] = $_SESSION['points'] - 1;\n attack($eunik,1);\n $temp = 0;\n for ($k=0;$k<$amount;$k++) \n {\n $strIndex = \"mon\".$k;\n if ($_SESSION[$strIndex] > 0) \n {\n $temp = $temp + 1;\n }\n }\n $myunik = $myunik / 2;\n if ($temp > 0 && $attacks <= $_SESSION['points']) \n {\n fightmenu($_SESSION['points'],$zmeczenie,$_SESSION['round'],$addres);\n }\n }\n if ($_POST['action'] == 'battack' && $_SESSION['points'] > 0) \n {\n $_SESSION['points'] = $_SESSION['points'] - 2;\n attack($eunik,2);\n $temp = 0;\n for ($k=0;$k<$amount;$k++) \n {\n $strIndex = \"mon\".$k;\n if ($_SESSION[$strIndex] > 0) \n {\n $temp = $temp + 1;\n }\n }\n $myunik = 0;\n if ($temp > 0 && $attacks <= $_SESSION['points']) \n {\n fightmenu($_SESSION['points'],$zmeczenie,$_SESSION['round'],$addres);\n }\n }\n if (!isset($_SESSION['points']))\n {\n $_SESSION['points'] = 0;\n }\n if($attacks > $_SESSION['points'] && $temp > 0 && $_POST['action'] != 'rest' && $_POST['action'] != 'escape') \n {\n monsterattack($attacks,$enemy,$myunik,$amount);\n if ($player -> hp > 0) \n {\n $_SESSION['round'] = $_SESSION['round'] + 1;\n $_SESSION['points'] = ceil($player->speed / $enemy['speed']);\n if ($_SESSION['points'] > 5) \n {\n $_SESSION['points'] = 5;\n }\n fightmenu($_SESSION['points'],$zmeczenie,$_SESSION['round'],$addres);\n }\n }\n if ($_POST['action'] == 'rest') \n {\n monsterattack($attacks,$enemy,0,$amount);\n if ($player -> hp > 0) \n {\n $smarty -> assign (\"Message\", \"<br />\".REST_SUCC);\n $smarty -> display ('error1.tpl');\n $rest = ($player -> cond / 10);\n $zmeczenie = $zmeczenie - $rest;\n if ($zmeczenie < 0) \n {\n $zmeczenie = 0;\n }\n $_SESSION['exhaust'] = $zmeczenie;\n $_SESSION['round'] = $_SESSION['round'] + 1;\n $_SESSION['points'] = ceil($player->speed / $enemy['speed']);\n if ($_SESSION['points'] > 5) \n {\n $_SESSION['points'] = 5;\n }\n fightmenu($_SESSION['points'],$zmeczenie,$_SESSION['round'],$addres);\n }\n }\n if ($player -> hp <= 0) \n {\n if ($title != 'Arena Walk') \n\t {\n\t loststat($player -> id, $player->oldstats, 0, $enemy['name'], 0, $player->antidote);\n\t }\n\tif ($player->antidote == 'R')\n\t {\n\t $player->hp = 1;\n\t }\n if ($player -> hp < 0) \n {\n $player -> hp = 0;\n }\n\tif ($title == 'Przygoda')\n\t {\n\t $intFight = -1;\n\t }\n\telse\n\t {\n\t $intFight = 0;\n\t }\n $db -> Execute(\"INSERT INTO `events` (`text`) VALUES('Gracz \".$player -> user.\" \".DEFEATED_BY.$enemy['name'].\"')\");\n $db -> Execute(\"UPDATE `players` SET `fight`=\".$intFight.\", `hp`=\".$player -> hp.\", `bless`='', `blessval`=0, `antidote`='' WHERE `id`=\".$player -> id);\n unset($_SESSION['exhaust'], $_SESSION['round'], $_SESSION['points'], $_SESSION['dodge']);\n for ($k = 0; $k < $amount; $k ++) \n {\n $strIndex = \"mon\".$k;\n unset($_SESSION[$strIndex]);\n }\n if ($title == 'Arena Walk') \n {\n if (!$intPoisoned)\n {\n $smarty -> assign (\"Message\", \"</ul>\".LOST_FIGHT.\"...<br /><ul><li><b>\".B_OPTIONS.\"</a><br /></li></ul>\");\n }\n else\n {\n $smarty -> assign (\"Message\", \"</ul><br /><ul><li><b>\".B_OPTIONS.\"</a><br /></li></ul>\");\n }\n $smarty -> display ('error1.tpl');\n }\n }\n if (isset($_SESSION['points']))\n {\n $intPoints = $_SESSION['points'];\n }\n else\n {\n $intPoints = 0;\n }\n if (!$_POST['action'] && $attacks <= $intPoints) \n {\n fightmenu($_SESSION['points'],$zmeczenie,1,$addres);\n }\n if ($temp == 0 && $player -> fight > 0 && (isset($_SESSION['round']) && $_SESSION['round'] < 25)) \n {\n $db -> Execute(\"INSERT INTO `events` (`text`) VALUES('Gracz \".$player -> user.\" \".DEFEAT.\" \".$enemy['name'].\"')\");\n $db -> Execute(\"UPDATE `players` SET `credits`=`credits`+\".$goldgain.\" WHERE `id`=\".$player -> id);\n $smarty -> assign (\"Message\", \"<br /><li><b>\".YOU_DEFEAT.\" <b>\".$amount.\" \".$enemy['name'].\"</b>.\");\n $smarty -> display ('error1.tpl');\n $smarty -> assign (\"Message\", \"<li><b>\".REWARD.\" <b>\".$expgain.\"</b> \".EXP_PTS.\" \".AND_GAIN.\" <b>\".$goldgain.\"</b> \".COINS);\n $smarty -> display ('error1.tpl');\n\tmonsterloot($enemy['lootnames'], $enemy['lootchances'], $enemy['level'], $amount);\n\tbattlerecords($enemy['name'], $enemy['level'], $player->id);\n checkexp($player -> exp,$expgain,$player -> level,$player -> race,$player -> user,$player -> id,0,0,$player -> id,'',0);\n if ($player -> hp < 0) \n {\n $player -> hp = 0;\n }\n\tif (($player->hp > 0) && ($player->autodrink != 'N'))\n\t {\n\t if ($player->autodrink == 'A')\n\t {\n\t\tdrinkfew(0, 0, 'M');\n\t\tdrinkfew(0, 0, 'H');\n\t }\n\t else\n\t {\n\t\tdrinkfew(0, 0, $player->autodrink);\n\t }\n\t }\n if ($title == 'Arena Walk') \n {\n $smarty -> assign (\"Message\", \"</ul><ul><li><b>\".B_OPTIONS.\"</a><br /></li></ul>\");\n $smarty -> display ('error1.tpl');\n }\n $db -> Execute(\"UPDATE players SET hp=\".$player -> hp.\", fight=0, bless='', blessval=0 WHERE id=\".$player -> id);\n\tif (isset($_SESSION['razy']))\n\t {\n\t unset($_SESSION['razy']);\n\t }\n unset($_SESSION['exhaust'], $_SESSION['round'], $_SESSION['points'], $_SESSION['dodge']);\n for ($k = 0; $k < $amount; $k ++) \n {\n $strIndex = \"mon\".$k;\n unset($_SESSION[$strIndex]);\n }\n }\n $myczaro -> Close();\n}",
"static function seaAttack($player1,$player2,&$logManager,$language){\r\n\t\t$dices = DiceManager::rollCombatDice($player1, $player2);\r\n\t\t$unitLost = array(0=>0,1=>0);\r\n\t\t\r\n\t\t$logManager->addLog('{Player1} '.$language['rolls'].' '.implode(\";\",array_values($dices[0])));\r\n\t\t$logManager->addLog('{Player2} '.$language['rolls'].' '.implode(\";\",array_values($dices[1])));\r\n\t\t\r\n\t\tfor ($i=0;$i<count($dices[1]);$i++){\r\n\t\t\tif ($dices[0][$i] == $dices[1][$i]) return $unitLost;\r\n\t\t\tif ($dices[0][$i] <= $dices[1][$i]){\r\n\t\t\t\t$unitLost[0] += 1;\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\t$unitLost[1] += 1;\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\t$logManager->addLog('{Player1} '.$language['losts'].' '.$unitLost[0].' '.$language['units']);\r\n\t\t$logManager->addLog('{Player2} '.$language['losts'].' '.$unitLost[1].' '.$language['units']);\r\n\t\t\r\n\t\treturn $unitLost;\r\n\t}",
"static function terranAttack($player1,$player2,&$logManager,$language){\r\n\t\t$dices = DiceManager::rollCombatDice($player1, $player2);\r\n\t\t$logManager->addLog('{Player1} '.$language['rolls'].' '.implode(\";\",array_values($dices[0])));\r\n\t\t$logManager->addLog('{Player2} '.$language['rolls'].' '.implode(\";\",array_values($dices[1])));\r\n\t\t\r\n\t\t$unitLost = array(0=>0,1=>0);\r\n\t\tfor ($i=0;$i<count($dices[1]);$i++){\r\n\t\t\tif ($dices[0][$i] <= $dices[1][$i]){\r\n\t\t\t\t$unitLost[0] += 1;\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\t$unitLost[1] += 1;\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\t$logManager->addLog('{Player1} '.$language['losts'].' '.$unitLost[0].' '.$language['units']);\r\n\t\t$logManager->addLog('{Player2} '.$language['losts'].' '.$unitLost[1].' '.$language['units']);\r\n\t\t\r\n\t\treturn $unitLost;\r\n\t}",
"private function fight() {\n while(!$this->winner) {\n // Check current field conditions\n // Check abilities\n $this->playTurn();\n // End turn\n if($this->getNextFighter()->health <= 0) {\n $this->winner_fighter = $this->fighter_current;\n $this->winner = true;\n break;\n }\n $this->nextFighter();\n\n // $this->winner_fighter = $this->fighter_current;\n // $this->winner = true;\n }\n }",
"public function stop() {\n if($this->combatantA->hp > 0) {\n $this->winnerType = \"player\";\n $this->winnerID = $this->combatantAID;\n } elseif ($this->combatantB->hp > 0) {\n $this->winnerType = ($this->type == \"pvp\" ? \"player\" : \"monster\");\n $this->winnerID = $this->combatantBID;\n } else {\n $this->winnerType = \"draw\";\n }\n\n // Bounty + XP\n if($this->type == \"monster\" && $this->combatantB->hp <= 0) {\n $loot = $this->combatantB->dropItems($this->combatantA->getDropItemPerc());\n $this->combatantA->gainItems($loot);\n \n $contact = $this->combatantB->dropContact($this->combatantA->getDropContactPerc());\n $this->combatantA->gainContact($contact, \"battle\");\n\n /**\n * monster->xp can be defined to deviate from the standard\n * attack / 2 xp reward\n */\n if(isset($this->combatantB->xp)) {\n $this->combatantA->gainXp($this->combatantB->xp, \"battle\");\n } else {\n $this->combatantA->gainXp($this->combatantB->attack / 4, \"battle\");\n }\n }\n\n $this->combatantA->ongoingBattleID = null;\n if($this->type == \"pvp\") {\n // @todo Message to PVP enemy\n $this->combatantB->ongoingBattleID = null;\n }\n\n $this->state = \"resolved\";\n $this->objectState = \"\";\n\n /**\n * ToDo: why does backupbehavior think that no attribute changed\n * if we set ongoingBattleID to null?\n */\n // $this->combatantA->save();\n $this->combatantA->update();\n if($this->type == \"pvp\") {\n $this->combatantB->save();\n }\n\n $this->update();\n $this->reconstructCombatants();\n \n // Notify the world about this result\n $event = new BattleEvent($this);\n $this->combatantA->onFinishedBattle($event);\n if($this->type == \"pvp\") {\n $this->combatantB->onFinishedBattle($event);\n }\n }",
"function doAttack(&$objSrcUser, &$objTrgUser, $arrSentArmy)\n{\n $srcKd = $objSrcUser->get_stat(ALLIANCE);\n $trgKd = $objTrgUser->get_stat(ALLIANCE);\n $strSrcRace = $objSrcUser->get_stat(RACE);\n $iSrcLand = $objSrcUser->get_build(LAND);\n $arrTrgBuilds = $objTrgUser->get_builds();\n $gains = pow(($arrTrgBuilds[LAND] / $iSrcLand), 2) + ($arrTrgBuilds[LAND] / ($iSrcLand * 3));\n $gains = min ($gains,1);\n\n $quick_gains = 0.01 * $gains; // 1% Land Gain\n\n if ($strSrcRace == \"Oleg Hai\")\n $quick_gains = $quick_gains * 1.3;\n\n //==========================================================================\n // Calculate Acre Gains\n //==========================================================================\n include_once('inc/functions/build.php');\n $arrBuildVars = getBuildingVariables($objTrgUser->get_stat(RACE));\n $arrBuildVars = $arrBuildVars['variables'];\n $max_build = $objTrgUser->get_number_build_types();\n $total_grab = 0;\n\n for($i = 1; $i <= $max_build; $i++)\n {\n $strVar = trim($arrBuildVars[$i]);\n $acres_won[$strVar] = round($arrTrgBuilds[$strVar]* ($quick_gains));\n $buildings = $objTrgUser->get_build($strVar);\n $land = $objTrgUser->get_build(LAND);\n $arrBuilds = array ($strVar => $buildings - $acres_won[$strVar], LAND => $land - $acres_won[$strVar] );\n $objTrgUser->set_builds($arrBuilds);\n $total_grab = $total_grab + $acres_won[$strVar];\n }\n\n // Explored\n $explore_gains = 0.2;\n $acres_explored = round($total_grab * $explore_gains);\n $land = $objSrcUser->get_build(LAND);\n $objSrcUser->set_build(LAND, ($land + $acres_explored));\n\n\n //==========================================================================\n // Calculate Citizens Killed\n //==========================================================================\n $trgCits = $objTrgUser->get_pop(CITIZENS);\n\n $max_kill = $trgCits * 0.2;\n $trgRace = $objTrgUser->get_stat(RACE);\n\n if ($max_kill < ($arrTrgBuilds[LAND] * 3) && $trgRace != \"Dragon\")\n $max_kill = $arrTrgBuilds[LAND] * 3;\n elseif ($max_kill < ($arrTrgBuilds[LAND] * 2) && $trgRace == \"Dragon\")\n $max_kill = $arrTrgBuilds[LAND] * 2;\n\n // War effects on max kill\n include_once(\"inc/functions/war.php\");\n $modifier = war_alli($srcKd, $trgKd);\n if ($modifier == 2)\n $max_kill = $max_kill * 1.2;\n\n // Martel: small bug fixed, $arrTrgBuilds not $arrTrgBuild\n $wallsPercent = ($arrTrgBuilds[WALLS] * 100) / $arrTrgBuilds[LAND];\n if ($wallsPercent > 20)\n $wallsPercent = 20;\n\n // frost: age 18, each % walls shelters 2% citizen\n for ($y = 1; $y <= $wallsPercent; $y++)\n $max_kill *= 0.98;\n\n // Max citizens to kill == citizens available\n $max_kill = round($max_kill);\n if ($max_kill > $trgCits)\n $max_kill = $trgCits;\n\n if ($max_kill > 0)\n {\n $intCitizens_alive = $trgCits - $max_kill;\n $objTrgUser->set_pop(CITIZENS, $intCitizens_alive);\n }\n else\n $max_kill = 0;\n\n // Let's see if we killed the tribe\n include_once('inc/functions/generic.php');\n obj_test_for_kill($objTrgUser, $objSrcUser);\n\n //==========================================================================\n // Calculate Cash Gains and Fame\n //==========================================================================\n $trgMoney = $objTrgUser->get_good(MONEY);\n\n $mod = 1;\n $stolen_crowns = round($trgMoney * 0.04);\n\n if ($arrTrgBuilds[LAND] > $iSrcLand)\n $fame_win = round($total_grab * 1.0);\n elseif ($arrTrgBuilds[LAND] < ($iSrcLand * 0.7))\n {\n $fame_win = round(-$total_grab * 1.0);\n $mod = ($arrTrgBuilds[LAND] * 1.3) / $iSrcLand;\n }\n else\n $fame_win = round($total_grab * 1.2);\n\n if ($mod < 0.7)\n $mod = 0.7;\n\n $max_crowns = round($arrTrgBuilds[LAND] * 500);\n\n $stolen_crowns = min(round($stolen_crowns * $mod), round($max_crowns));\n\n $objTrgUser->set_good(MONEY, $trgMoney - $stolen_crowns);\n $money = $objSrcUser->get_good(MONEY);\n $objSrcUser->set_good(MONEY, $money + $stolen_crowns);\n\n //==========================================================================\n // Return time\n //==========================================================================\n $wait = 4; // 4 hour attack time\n\n if ($strSrcRace == \"Raven\")\n $wait = 1;\n elseif ($strSrcRace == \"Mori Hai\" || $strSrcRace == \"Dragon\")\n $wait = 3;\n\n $landtime = 'land_t' . $wait;\n $objSrcUser->set_user_info(NEXT_ATTACK, $wait);\n\n //==========================================================================\n // Add land to incoming\n //==========================================================================\n if ($total_grab > 0)\n {\n $old_land = $objSrcUser->get_build($landtime);\n $objSrcUser->set_build($landtime, $total_grab + $old_land);\n }\n\n //==========================================================================\n // Calculate Fame Gains\n //==========================================================================\n\n // War effects\n $objSrcAlliance = $objSrcUser->get_alliance();\n require_once('inc/functions/war.php');\n if (checkWarBetween($objSrcAlliance, $trgKd))\n {\n // Update land counter in new war system March 06, 2008 Martel\n $iNeeded = $objSrcAlliance->get_war('land_needed');\n $objSrcAlliance->set_war('land_needed', max(0, $iNeeded - $total_grab));\n\n // War effects on fame\n $fame_win *= 1.2;\n }\n\n // Cannot take more fame than what the target has\n $fame_win = round($fame_win);\n $target_fame = $objTrgUser->get_stat(FAME);\n if ($fame_win > $target_fame)\n $fame_win = $target_fame;\n\n $fame1 = $objSrcUser->get_stat(FAME) + $fame_win;\n $fame2 = $target_fame - $fame_win;\n $objSrcUser->set_stat(FAME, $fame1);\n $objTrgUser->set_stat(FAME, $fame2);\n\n //==========================================================================\n\n $arrResults['gained_acres'] = $total_grab;\n $arrResults['explored_acres'] = $acres_explored;\n $arrResults['gained_fame'] = $fame_win;\n $arrResults['gained_crowns'] = $stolen_crowns;\n $arrResults['killed_citizens'] = $max_kill;\n\n return $arrResults;\n}",
"function battle($type,$adress) \n{\n global $player;\n global $smarty;\n global $enemy;\n global $arrehp;\n global $db;\n if ($player -> hp <= 0) \n {\n error (NO_LIFE);\n }\n $enemy1 = $db -> Execute(\"SELECT * FROM `monsters` WHERE `id`=\".$player -> fight);\n $span = ($enemy1 -> fields['level'] / $player -> level);\n if ($span > 2) \n {\n $span = 2;\n }\n $expgain = ceil(rand($enemy1 -> fields['exp1'],$enemy1 -> fields['exp2']) * $span);\n $goldgain = ceil(rand($enemy1 -> fields['credits1'],$enemy1 -> fields['credits2']) * $span);\n $enemy = array(\"strength\" => $enemy1 -> fields['strength'], \n \"agility\" => $enemy1 -> fields['agility'], \n \"speed\" => $enemy1 -> fields['speed'], \n \"endurance\" => $enemy1 -> fields['endurance'], \n \"hp\" => $enemy1 -> fields['hp'], \n \"name\" => $enemy1 -> fields['name'], \n \"id\" => $enemy1 -> fields['id'], \n \"exp1\" => $enemy1 -> fields['exp1'], \n \"exp2\" => $enemy1 -> fields['exp2'], \n \"level\" => $enemy1 -> fields['level'],\n\t\t \"lootnames\" => explode(\";\", $enemy1->fields['lootnames']),\n\t\t \"lootchances\" => explode(\";\", $enemy1->fields['lootchances']));\n if ($type == 'T') \n {\n if (!isset ($_POST['action'])) \n {\n turnfight ($expgain,$goldgain,'',$adress);\n } \n else \n {\n turnfight ($expgain,$goldgain,$_POST['action'],$adress);\n }\n } \n else \n {\n fightmonster ($enemy,$expgain,$goldgain,1);\n }\n $fight = $db -> Execute(\"SELECT `fight`, `hp` FROM `players` WHERE `id`=\".$player -> id);\n if ($fight -> fields['fight'] == 0) \n {\n if ($type == 'T')\n\t {\n\t $player->energy --;\n\t if ($player -> energy < 0) \n\t {\n\t\t$player -> energy = 0;\n\t }\n\t $db -> Execute(\"UPDATE `players` SET `energy`=\".$player->energy.\" WHERE `id`=\".$player->id);\n\t }\n if ($player -> location == 'Góry') \n {\n if ($fight -> fields['hp'] > 0)\n {\n $smarty -> assign (\"Link\", \"<br /><br /><a href=\\\"explore.php?akcja=gory\\\">\".A_REFRESH.\"</a><br />\");\n }\n else\n {\n $smarty -> assign (\"Link\", \"<br /><br /><a href=\\\"gory.php\\\">\".A_REFRESH.\"</a><br />\");\n }\n }\n if ($player -> location == 'Las') \n {\n if ($fight -> fields['hp'] > 0)\n {\n $smarty -> assign (\"Link\", \"<br /><br /><a href=\\\"explore.php\\\">\".A_REFRESH.\"</a><br />\");\n }\n else\n {\n $smarty -> assign (\"Link\", \"<br /><br /><a href=\\\"las.php\\\">\".A_REFRESH.\"</a><br />\");\n }\n }\n }\n $fight -> Close();\n $enemy1 -> Close();\n}",
"function attack($eunik,$bdamage) \n{\n global $smarty;\n global $player;\n global $db;\n global $zmeczenie;\n global $enemy;\n global $amount;\n $number1 = $_POST['monster'] - 1;\n $number = \"mon\".$number1;\n $gwtbr = 0;\n $gatak = 0;\n if (isset ($_SESSION['exhaust'])) \n {\n $zmeczenie = $_SESSION['exhaust'];\n }\n $arrEquip = $player -> equipment();\n if (!$arrEquip[0][0] && !$arrEquip[1][0]) \n {\n $smarty -> assign(\"Message\", NO_WEAPON);\n $smarty -> display('error1.tpl');\n }\n if ($arrEquip[0][0]) \n {\n if ($arrEquip[0][3] == 'D') \n {\n $arrEquip[0][2] = $arrEquip[0][2] + $arrEquip[0][8];\n }\n if ($player -> clas == 'Wojownik' || $player -> clas == 'Barbarzyńca') \n {\n $stat['damage'] = (($player -> strength + $arrEquip[0][2]) + $player -> level);\n } \n else \n {\n $stat['damage'] = ($player -> strength + $arrEquip[0][2]);\n }\n if ($player -> attack < 1) \n {\n $krytyk = 1;\n }\n if ($player -> attack > 5) \n {\n $kr = ceil($player -> attack / 100);\n $krytyk = (5 + $kr);\n } \n else \n {\n $krytyk = $player -> attack;\n }\n $name = \"bronią\";\n\t$strAtype = 'melee';\n }\n if ($arrEquip[11][0])\n {\n\t$stat['damage'] += (($arrEquip[11][2] + $player->strength) + $player->level);\n\t$name = \"obiema brońmi\";\n }\n if ($arrEquip[1][0]) \n {\n $bonus = $arrEquip[1][2] + $arrEquip[6][2];\n\tif ($arrEquip[6][3] == 'D')\n\t {\n\t $bonus += $arrEquip[6][8];\n\t }\n $bonus2 = (($player -> strength / 2) + ($player->agility / 2));\n if ($player -> clas == 'Wojownik' || $player -> clas == 'Barbarzyńca') \n {\n $stat['damage'] = (($bonus2 + $bonus) + $player -> level);\n } \n else \n {\n $stat['damage'] = ($bonus2 + $bonus);\n }\n if ($player -> shoot < 1) \n {\n $krytyk = 1;\n }\n if ($player -> shoot > 5) \n {\n $kr = ceil($player -> shoot / 100);\n $krytyk = (5 + $kr);\n } \n else \n {\n $krytyk = $player -> shoot;\n }\n if (!$arrEquip[6][0]) \n {\n $stat['damage'] = 0;\n }\n $name = \"strzałą\";\n\t$strAtype = 'ranged';\n }\n if (!isset($stat['damage']))\n {\n $stat['damage'] = 0;\n }\n if ($player -> clas == 'Rzemieślnik')\n {\n $stat['damage'] = $stat['damage'] - ($stat['damage'] / 4);\n }\n if ($bdamage == 2) \n {\n $stat['damage'] = $stat['damage'] * 2;\n }\n if ($bdamage == 1) \n {\n $stat['damage'] = $stat['damage'] + ($stat['damage'] / 2);\n $eunik = $eunik - ($eunik / 10);\n }\n if ($bdamage == 3) \n {\n $stat['damage'] = $stat['damage'] - ($stat['damage'] / 2);\n $eunik = $eunik + ($eunik / 10);\n }\n $rzut2 = (rand(1,($player -> level * 10)));\n $stat['damage'] = ($stat['damage'] + $rzut2);\n $stat['damage'] = ($stat['damage'] - $enemy['endurance']);\n if ($stat['damage'] < 1) \n {\n $stat['damage'] = 0;\n }\n if ($arrEquip[0][0] && $gwtbr > $arrEquip[0][6]) \n {\n\t$stat['damage'] = 0;\n\tif ($arrEquip[11][6] > $gwtbr)\n\t {\n\t $stat['damage'] += (($arrEquip[11][2] + $player->strength) + $player->level);\n\t }\n\t$krytyk = 1;\n }\n if ($arrEquip[11][0] && $gwtbr > $arrEquip[11][6]) \n {\n\t$stat['damage'] = 0;\n\tif ($arrEquip[0][6] > $gwtbr)\n\t {\n\t $stat['damage'] += (($arrEquip[0][2] + $player->strength) + $player->level);\n\t }\n\t$krytyk = 1;\n }\n if ($arrEquip[1][0] && ($gwtbr > $arrEquip[1][6] || $gwtbr > $arrEquip[6][6])) \n {\n $stat['damage'] = 0;\n $krytyk = 1;\n }\n if ($arrEquip[1][0] && !$arrEquip[6][0]) \n {\n $stat['damage'] = 0;\n $krytyk = 1;\n }\n $ehp = $_SESSION[$number];\n if ($ehp <= 0)\n {\n $smarty -> assign(\"Message\", ERROR);\n $smarty -> display('error1.tpl');\n $gwtbr = $gwtbr + 1;\n }\n if ($arrEquip[1][0]) \n {\n $eunik = $eunik * 2;\n }\n if ($ehp > 0 && $player -> hp > 0) \n {\n if ($arrEquip[0][0]) \n {\n $zmeczenie = $zmeczenie + $arrEquip[0][4];\n } \n\telseif ($arrEquip[1][0]) \n {\n $zmeczenie = $zmeczenie + $arrEquip[1][4];\n }\n\tif ($arrEquip[11][0])\n\t {\n\t $zmeczenie += $arrEquip[11][4];\n\t }\n $szansa = rand(1, 100);\n if ($eunik >= $szansa && $szansa < 97) \n {\n $smarty -> assign (\"Message\", \"<b>\".$enemy['name'].\"</b> \".ENEMY_DODGE.\"!<br />\");\n $smarty -> display ('error1.tpl');\n if ($arrEquip[1][0]) \n {\n $gwtbr = ($gwtbr + 1);\n }\n } \n\telseif ($zmeczenie <= $player -> cond) \n {\n if ($arrEquip[0][0] || $arrEquip[1][0] || $arrEquip[11][0]) \n\t {\n\t\t$gwtbr++;\n\t\t$rzut = rand(1, 1000) / 10;\n\t\t$intRoll = rand(1, 100);\n\t\t$arrLocations = array('w tułów', 'w głowę', 'w kończynę');\n\t\t$intHit = rand(0, 2);\n\t\tif ($krytyk >= $rzut && $intRoll <= $krytyk && $player->fight != 999) \n\t\t {\n\t\t $gatak++;\n\t\t $ehp = 0;\n\t\t $smarty->assign(\"Message\", showcritical($arrLocations[$intHit], $strAtype, 'pve', $enemy['name']));\n\t\t }\n\t\telse\n\t\t {\n\t\t $ehp -= $stat['damage'];\n\t\t $smarty -> assign (\"Message\", YOU_ATTACK1.\" \".$name.\" <b>\".$enemy['name'].\"</b> \".$arrLocations[$intHit].\" \".INFLICT.\" <b>\".$stat['damage'].\"</b> \".DAMAGE.\"! (\".$ehp.\" \".LEFT.\")</font><br />\");\n\t\t if ($stat['damage'] > 0) \n\t\t {\n\t\t\t$gatak = ($gatak + 1);\n\t\t }\n\t\t }\n\t\t$smarty -> display ('error1.tpl');\n\t }\n }\n }\n $_SESSION[$number] = $ehp;\n if ($arrEquip[0][0]) \n {\n gainability($player -> id, $player -> user, 0, $gatak, 0, $player -> mana, $player -> id, 'weapon');\n lostitem($gwtbr, $arrEquip[0][6], YOU_WEAPON, $player -> id, $arrEquip[0][0], $player -> id, HAS_BEEN1, $player->level);\n }\n if ($arrEquip[11][0])\n {\n\tif (!$arrEquip[0][0])\n\t {\n\t gainability($player -> id, $player -> user, 0, $gatak, 0, $player -> mana, $player -> id, 'weapon');\n\t }\n\tlostitem($gwtbr, $arrEquip[11][6], YOU_WEAPON, $player -> id, $arrEquip[11][0], $player -> id, HAS_BEEN1, $player->level);\n }\n if ($arrEquip[1][0]) \n {\n gainability($player -> id, $player -> user, 0, $gatak, 0, $player -> mana, $player -> id, 'bow');\n lostitem($gwtbr, $arrEquip[1][6], YOU_WEAPON, $player -> id, $arrEquip[1][0], $player -> id, HAS_BEEN1, $player->level);\n lostitem($gwtbr, $arrEquip[6][6], YOU_QUIVER, $player -> id, $arrEquip[6][0], $player -> id, HAS_BEEN1, $player->level);\n }\n $_SESSION['exhaust'] = $zmeczenie;\n}",
"function _test_attack($type, $i, $opponent_color, $try_move) {\n/*\nprintf(\"try_move['from']: %s\\n\", $try_move['from']);\nprintf(\"try_move['to']: %s\\n\", $try_move['to']);\nprintf(\"try_move['piece']: %s\\n\", $try_move['piece']);\nprintf(\"this->enpa: %s\\n\", $this->enpa);\n*/\n $p = null;\n if ($try_move) {\n\n if ($i === $try_move['from']) {\n $p = 0;\n } \n elseif ($i === $try_move['to']) {\n // The trial move takes the piece being considered\n $p = $try_move['piece'];\n } \n elseif ( $try_move['piece'] === 'p' \n && intval($this->enpa) === intval($try_move['to'])\n && intval($i) === intval($this->enpa) + 10\n ) {\n $p = 0;\n }\n elseif ( $try_move['piece'] === 'P' \n && intval($this->enpa) === intval($try_move['to'])\n && intval($i) === intval($this->enpa) - 10\n ) {\n $p = 0;\n }\n else {\n $p = $this->pos[$i];\n }\n } \n else {\n $p = $this->pos[$i];\n }\n \n if ($p === null) {\n//print(\"A\\n\");\n return 1;\n }\n\n if ($p && $this->piece_color($p) === $opponent_color && strpos($type, strtolower($p)) !== FALSE) {\n//printf(\"p:%s\\n\", $p);\n//print(\"B\\n\");\n return -1;\n }\n//print(\"C\\n\");\n return $p;\n }",
"private function attack()\n {\n $this->tempAttackerStats = $this->attacker->stats;\n $this->tempDefenderStats = $this->defender->stats;\n\n // 1. Before hit check, apply all luck modifying skills\n $skills = array_filter($this->attacker->character->skills, function (Skill $skill) {\n return $skill->stat == Character::STAT_LUCK && $skill->type == Skill::TYPE_ATTACK;\n });\n array_walk(\n $skills, \n array($this, 'applySkill'),\n Skill::TARGET_ATTACKER,\n );\n\n $skills = array_filter($this->defender->character->skills, function (Skill $skill) {\n return $skill->stat == Character::STAT_LUCK && $skill->type == Skill::TYPE_DEFENCE;\n });\n array_walk(\n $skills,\n array($this, 'applySkill'),\n Skill::TARGET_DEFENDER,\n );\n\n // 2. Check if attack is evaded\n $luck = $this->tempDefenderStats[Character::STAT_LUCK];\n if ($luck != 0 && $this->chance($luck)) {\n return $this->status = self::STATUS_MISSED;\n }\n\n // 3. Apply stat modifier skills\n $skills = array_filter($this->attacker->character->skills, function (Skill $skill) {\n return $skill->stat != Character::STAT_LUCK\n && $skill->stat != Character::STAT_DAMAGE\n && $skill->type == Skill::TYPE_ATTACK;\n });\n array_walk(\n $skills,\n array($this, 'applySkill'),\n Skill::TARGET_ATTACKER,\n );\n\n $skills = array_filter($this->defender->character->skills, function (Skill $skill) {\n return $skill->stat != Character::STAT_LUCK\n && $skill->stat != Character::STAT_DAMAGE\n && $skill->type == Skill::TYPE_DEFENCE;\n });\n array_walk(\n $skills,\n array($this, 'applySkill'),\n Skill::TARGET_DEFENDER,\n );\n\n // 4. Calculate the damage\n $strength = $this->tempAttackerStats[Character::STAT_STRENGTH];\n $defence = $this->tempDefenderStats[Character::STAT_DEFENCE];\n\n $this->damage = max(0, $strength - $defence);\n\n // 5. Apply damage modifier skills\n $skills = array_filter($this->attacker->character->skills, function (Skill $skill) {\n return $skill->stat == Character::STAT_DAMAGE\n && $skill->type == Skill::TYPE_ATTACK;\n });\n array_walk(\n $skills,\n function (Skill $skill, $key) {\n $this->applyDamageSkill($skill, Skill::TARGET_ATTACKER, $this->damage);\n }\n );\n\n $skills = array_filter($this->defender->character->skills, function (Skill $skill) {\n return $skill->stat == Character::STAT_DAMAGE\n && $skill->type == Skill::TYPE_DEFENCE;\n });\n array_walk(\n $skills,\n function (Skill $skill, $key) {\n $this->applyDamageSkill($skill, Skill::TARGET_DEFENDER, $this->damage);\n }\n );\n\n // 6. Apply the final damage\n $this->defender->stats[Character::STAT_HEALTH] =\n max(0, $this->defender->stats[Character::STAT_HEALTH] - $this->damage);\n\n $this->status = self::STATUS_COMPLETED;\n }",
"public function onPlayerAttackPlayer(PlayerAttackPlayerEvent $event) {\n if (!$event->getGameType()->equals(TypeList::Anni())) return;\n\n $target = $event->getTarget();\n $attacker = $event->getAttacker();\n $attackerData = AnniPlayerDataStorage::get($attacker->getName());\n $attackerJob = $attackerData->getCurrentJob();\n //Warriorならダメージ+1, Skill発動中ならさらに+1\n if ($attackerJob instanceof Warrior) {\n $additionalDamage = 1;\n if ($attackerJob->isOnFrenzy()) $additionalDamage++;\n\n $source = new EntityDamageByEntityEvent($attacker, $target, $event->getCause(), $event->getBaseDamage(), [], $event->getKnockBack());\n $target->setLastDamageCause($source);\n $target->setHealth($target->getHealth() - $additionalDamage);\n } else if ($attackerJob instanceof Lumberjack) {//Lumberjack\n //スキル発動中かつ斧での攻撃なら耐久値を16削る\n if ($attackerJob->isOnBruteForce() and $attacker->getInventory()->getItemInHand()->getId() instanceof Axe) {\n foreach ($target->getArmorInventory()->getContents() as $item) {\n if ($item instanceof Armor) {\n $item->applyDamage(16);\n //todo:音とエフェクト\n }\n }\n }\n } else if ($attackerJob instanceof Pyro) {\n //Pyroなら37%の確立で相手に火をつける\n if (mt_rand(1, 100) <= 37) {\n $target->setOnFire(2);\n }\n }\n\n //Assassinならスキルをキャンセルする\n $targetJob = AnniPlayerDataStorage::get($target->getName())->getCurrentJob();\n if ($targetJob instanceof Assassin) {\n $targetJob->cancelSkill();\n $targetJob->reverseArmor($event->getTarget()->getName());\n }\n }",
"public function attackFighter($idPlayer1, $idPlayer2) {\n // Retrieve the two fighters entities thanks to the players IDs\n $fighter1 = $this->Fighters->getFighter($idPlayer1);\n $fighter2 = $this->Fighters->getFighter($idPlayer2);\n\n // Determine if the attack succeed, according to the given formula\n $doAttackSucceed = $this->doAttackSucceed($fighter1->level, $fighter2->level);\n $this->set('test4', $doAttackSucceed);\n \n // If the attack succeeds, decrement health of fighter injured\n if($doAttackSucceed == true)\n {\n $fighter2->current_health -= $fighter1->skill_strength;\n $fighter1->xp ++;\n $this->Fighters->save($fighter1);\n $this->Fighters->save($fighter2);\n\n // If the attacked fighter current health is at 0, delete it and create new fighter. Fighter 1 wins XP equals to fighter 2 level.\n if($fighter2->current_health == 0)\n {\n $fighter1->xp += $fighter2->level;\n $this->deleteFighter($idPlayer2);\n }\n \n \n }\n \n \n return $doAttackSucceed;\n }",
"function stPlayerInvolvedTurn() {\n $player_id = self::getGameStateValue('current_player_under_dogma_effect');\n $launcher_id = self::getGameStateValue('active_player');\n $nested_id_1 = self::getGameStateValue('nested_id_1');\n $card_id = $nested_id_1 == -1 ? self::getGameStateValue('dogma_card_id') : $nested_id_1 ;\n $current_effect_type = $nested_id_1 == -1 ? self::getGameStateValue('current_effect_type') : 1 /* Non-demand effects only*/;\n $current_effect_number = $nested_id_1 == -1 ? self::getGameStateValue('current_effect_number') : self::getGameStateValue('nested_current_effect_number_1');\n $step_max = null;\n $step = null;\n \n $qualified_effect = self::qualifyEffect($current_effect_type, $current_effect_number, self::getCardInfo($card_id)); \n self::notifyEffectOnPlayer($qualified_effect, $player_id, $launcher_id);\n \n $crown = self::getIconSquare(1);\n $leaf = self::getIconSquare(2);\n $lightbulb = self::getIconSquare(3);\n $tower = self::getIconSquare(4);\n $factory = self::getIconSquare(5);\n $clock = self::getIconSquare(6);\n \n try {\n //||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||\n // [A] SPECIFIC CODE: what are the automatic actions to make and/or is there interaction needed?\n $code = $card_id.($current_effect_type == 0 ? \"D\" : \"N\" ).$current_effect_number;\n self::trace('[A]'.$code.' '.self::getPlayerNameFromId($player_id).'('.$player_id.')'.' | '.self::getPlayerNameFromId($launcher_id).'('.$launcher_id.')');\n switch($code) {\n // The first number is the id of the card\n // D1 means the first (and single) I demand effect\n // N1 means the first non-demand effect\n // N2 means the second non-demand effect\n // N3 means the third non-demand effect\n \n // Setting the $step_max variable means there is interaction needed with the player\n \n // id 0, age 1: Pottery\n case \"0N1\":\n $step_max = 1; // --> 1 interaction: see B\n break;\n case \"0N2\":\n self::executeDraw($player_id, 1); // \"Draw a 1\"\n break;\n\n // id 1, age 1: Tools\n case \"1N1\":\n $step_max = 1; // --> 1 interaction: see B\n break;\n case \"1N2\":\n $step_max = 1; // --> 1 interaction: see B\n break;\n \n // id 2, age 1: Writing\n case \"2N1\":\n self::executeDraw($player_id, 2); // \"Draw a 2\"\n break;\n \n // id 3, age 1: Archery\n case \"3D1\":\n self::executeDraw($player_id, 1); // \"Draw a 1\"\n $step_max = 1; // --> 1 interaction: see B\n break;\n\n // id 4, age 1: Metalworking\n case \"4N1\":\n while(true) {\n $card = self::executeDraw($player_id, 1, 'revealed'); // \"Draw and reveal a 1\"\n if (self::hasRessource($card, 4)) { // \"If it as tower\"\n self::notifyGeneralInfo(clienttranslate('It has a ${tower}.'), array('tower' => $tower));\n self::transferCardFromTo($card, $player_id, 'score', false, true); // \"Score it\"\n continue; // \"Repeat this dogma effect\"\n }\n break; // \"Otherwise\" \n }\n self::notifyGeneralInfo(clienttranslate('It does not have a ${tower}.'), array('tower' => $tower));\n self::transferCardFromTo($card, $player_id, 'hand'); // \"Keep it\"\n break;\n \n // id 5, age 1: Oars\n case \"5D1\":\n if (self::getGameStateValue('auxiliary_value') == -1) { // If this variable has not been set before\n self::setGameStateValue('auxiliary_value', 0);\n }\n $step_max = 1; // --> 1 interaction: see B\n break;\n \n case \"5N1\":\n if (self::getGameStateValue('auxiliary_value') <= 0) { // \"If no cards were transfered due to this demand\"\n self::executeDraw($player_id, 1); // \"Draw a 1\"\n }\n break;\n \n // id 6, age 1: Clothing\n case \"6N1\":\n $step_max = 1; // --> 1 interaction: see B\n break;\n case \"6N2\":\n // \"Score a 1 for each color present on your board not present on any other player board\"\n // Compute the number of specific colors\n $number_to_be_scored = 0;\n $players = self::loadPlayersBasicInfos();\n $boards = self::getAllBoards($players);\n for ($color = 0; $color < 5; $color++) { // Evaluate each color\n if (count($boards[$player_id][$color]) == 0) { // The player does not have this color => no point\n continue;\n }\n // The player has this color, do opponents have?\n $color_on_opponent_board = false;\n foreach($players as $other_player_id => $player) {\n if ($other_player_id == $player_id || $other_player_id == self::getPlayerTeammate($player_id)) {\n continue; // Skip the player being evaluated and his teammate\n }\n if (count($boards[$other_player_id][$color]) > 0) { // This opponent has this color => no point\n $color_on_opponent_board = true;\n break;\n }\n }\n if (!$color_on_opponent_board) { // The opponents do not have this color => point\n $number_to_be_scored++;\n }\n }\n // Indicate this number\n if ($number_to_be_scored == 0) {\n self::notifyPlayer($player_id, 'log', clienttranslate('${You} have no specific color on your board.'), array('You' => 'You'));\n self::notifyAllPlayersBut($player_id, 'log', clienttranslate('${player_name} has no specific color on his board.'), array('player_name' => self::getColoredText(self::getPlayerNameFromId($player_id), $player_id)));\n }\n else if ($number_to_be_scored == 1) {\n self::notifyPlayer($player_id, 'log', clienttranslate('${You} have one specific color on your board.'), array('You' => 'You'));\n self::notifyAllPlayersBut($player_id, 'log', clienttranslate('${player_name} has one specific color on his board.'), array('player_name' => self::getColoredText(self::getPlayerNameFromId($player_id), $player_id)));\n }\n else {\n $translated_number = self::getTranslatedNumber($number_to_be_scored);\n self::notifyPlayer($player_id, 'log', clienttranslate('${You} have ${n} specific colors on your board.'), array('i18n' => array('n'), 'You' => 'You', 'n' => $translated_number));\n self::notifyAllPlayersBut($player_id, 'log', clienttranslate('${player_name} has ${n} specific colors on his board.'), array('i18n' => array('n'), 'player_name' => self::getColoredText(self::getPlayerNameFromId($player_id), $player_id), 'n' => $translated_number));\n }\n // Score this number of times\n for ($i=0; $i < $number_to_be_scored; $i++) {\n self::executeDraw($player_id, 1, 'score');\n }\n break;\n \n // id 7, age 1: Sailing\n case \"7N1\":\n self::executeDraw($player_id, 1, 'board'); // \"Draw and meld a 1\"\n break;\n \n // id 8, age 1: The wheel\n case \"8N1\":\n self::executeDraw($player_id, 1); // \"Draw two 1\"\n self::executeDraw($player_id, 1); // \n break;\n \n // id 9, age 1: Agriculture\n case \"9N1\":\n $step_max = 1; // --> 1 interaction: see B\n break;\n \n // id 10, age 1: Domestication\n case \"10N1\":\n $step_max = 1; // --> 1 interaction: see B\n break;\n \n // id 11, age 1: Masonry\n case \"11N1\":\n $step_max = 1; // --> 1 interaction: see B\n break;\n \n // id 12, age 1: City states\n case \"12D1\":\n $number_of_towers = self::getUniqueValueFromDB(self::format(\"\n SELECT\n player_icon_count_4\n FROM\n player\n WHERE\n player_id = {player_id}\n \",\n array('player_id' => $player_id)\n ));\n \n if ($number_of_towers >= 4) { // \"If you have at least four towers on your board\"\n self::notifyPlayer($player_id, 'log', clienttranslate('${You} have at least four ${icon} on your board.'), array('You' => 'You', 'icon' => $tower));\n self::notifyAllPlayersBut($player_id, 'log', clienttranslate('${player_name} has at least four ${icon} on his board.'), array('player_name' => self::getColoredText(self::getPlayerNameFromId($player_id), $player_id), 'icon' => $tower));\n $step_max = 1; // --> 1 interaction: see B\n }\n else {\n self::notifyPlayer($player_id, 'log', clienttranslate('${You} have less than four ${icon} on your board.'), array('You' => 'You', 'icon' => $tower));\n self::notifyAllPlayersBut($player_id, 'log', clienttranslate('${player_name} has less than four ${icon} on his board.'), array('player_name' => self::getColoredText(self::getPlayerNameFromId($player_id), $player_id), 'icon' => $tower));\n }\n break;\n \n // id 13, age 1: Code of laws\n case \"13N1\":\n $step_max = 1; // --> 1 interaction: see B\n break;\n \n // id 14, age 1: Mysticism\n case \"14N1\":\n $card = self::executeDraw($player_id, 1, 'revealed'); // \"Draw and reveal a 1\n $color = $card['color'];\n if (self::hasThisColorOnBoard($player_id, $color)) { // \"If it is the same color of any card on your board\"\n self::notifyPlayer($player_id, 'log', clienttranslate('This card is ${color}; ${you} have this color on your board.'), array('i18n' => array('color'), 'you' => 'you', 'color' => self::getColorInClear($color)));\n self::notifyAllPlayersBut($player_id, 'log', clienttranslate('This card is ${color}; ${player_name} has this color on his board.'), array('i18n' => array('color'), 'player_name' => self::getColoredText(self::getPlayerNameFromId($player_id), $player_id), 'color' => self::getColorInClear($color)));\n self::transferCardFromTo($card, $player_id, 'board'); // \"Meld it\"\n self::executeDraw($player_id, 1); // \"Draw a 1\"\n }\n else {\n self::notifyPlayer($player_id, 'log', clienttranslate('This card is ${color}; ${you} do not have this color on your board.'), array('i18n' => array('color'), 'you' => 'you', 'color' => self::getColorInClear($color)));\n self::notifyAllPlayersBut($player_id, 'log', clienttranslate('This card is ${color}; ${player_name} does not have this color on his board.'), array('i18n' => array('color'), 'player_name' => self::getColoredText(self::getPlayerNameFromId($player_id), $player_id), 'color' => self::getColorInClear($color)));\n self::transferCardFromTo($card, $player_id, 'hand'); // (Put the card in your hand)\n }\n break;\n \n // id 15, age 2: Calendar\n case \"15N1\":\n if (self::countCardsInLocation($player_id, 'score') > self::countCardsInLocation($player_id, 'hand')) { // \"If you have more cards in your score pile than in your hand\"\n self::notifyPlayer($player_id, 'log', clienttranslate('${You} have more cards in your score pile than in your hand.'), array('You' => 'You'));\n self::notifyAllPlayersBut($player_id, 'log', clienttranslate('${player_name} has more cards in his score pile than in his hand.'), array('player_name' => self::getColoredText(self::getPlayerNameFromId($player_id), $player_id)));\n \n self::executeDraw($player_id, 3); // \"Draw two 3\"\n self::executeDraw($player_id, 3); // \n }\n else {\n self::notifyPlayer($player_id, 'log', clienttranslate('${You} do not have more cards in your score pile than in your hand.'), array('You' => 'You'));\n self::notifyAllPlayersBut($player_id, 'log', clienttranslate('${player_name} does not have more cards in his score pile than in his hand.'), array('player_name' => self::getColoredText(self::getPlayerNameFromId($player_id), $player_id)));\n }\n break;\n \n // id 16, age 2: Mathematics\n case \"16N1\":\n $step_max = 1; // --> 1 interaction: see B\n break;\n \n // id 17, age 2: Construction\n case \"17D1\":\n $step_max = 1; // --> 1 interaction: see B\n break;\n \n case \"17N1\":\n $boards = self::getAllBoards(self::loadPlayersBasicInfos());\n $eligible = true;\n foreach($boards as $current_id => $board) {\n if ($current_id == self::getPlayerTeammate($player_id)) { // Ignore teammate\n continue;\n }\n $number_of_top_cards = 0;\n for($color=0; $color<5; $color++) {\n if (count($board[$color]) > 0) { // This player has a top card for this color.\n $number_of_top_cards++;\n }\n }\n if ($current_id == $player_id && $number_of_top_cards < 5 || $current_id != $player_id && $number_of_top_cards == 5) { // This player is the active player and has not 5 top cards, or he is an opponent who has 5 top cards\n $eligible = false;\n }\n }\n if ($eligible) { // \"If you are the only player with five top cards\"\n $achievement = self::getCardInfo(105);\n if ($achievement['owner'] == 0) {\n self::notifyPlayer($player_id, 'log', clienttranslate('${You} are the only player with five top cards.'), array('You' => 'You'));\n self::notifyAllPlayersBut($player_id, 'log', clienttranslate('${player_name} is the only player with five top cards.'), array('player_name' => self::getColoredText(self::getPlayerNameFromId($player_id), $player_id)));\n self::transferCardFromTo($achievement, $player_id, 'achievements'); // \"Claim the Empire achievement\"\n }\n else {\n self::notifyPlayer($player_id, 'log', clienttranslate('${You} are the only player with five top cards but the Empire achievement has already been claimed.'), array('You' => 'You'));\n self::notifyAllPlayersBut($player_id, 'log', clienttranslate('${player_name} is the only player with five top cards but the Empire achievement has already been claimed.'), array('player_name' => self::getColoredText(self::getPlayerNameFromId($player_id), $player_id)));\n }\n }\n break;\n \n // id 18, age 2: Road building\n case \"18N1\":\n $step_max = 1; // --> 1 interaction: see B\n break;\n \n // id 19, age 2: Currency\n case \"19N1\":\n self::setGameStateValueFromArray('auxiliary_value', array());\n $step_max = 1; // --> 1 interaction: see B\n break;\n \n // id 20, age 2: Mapmaking\n case \"20D1\":\n if (self::getGameStateValue('auxiliary_value') == -1) { // If this variable has not been set before\n self::setGameStateValue('auxiliary_value', 0);\n }\n $step_max = 1; // --> 1 interaction: see B\n break;\n \n case \"20N1\":\n if (self::getGameStateValue('auxiliary_value') == 1) { // \"If any card was transfered due to the demand\"\n self::executeDraw($player_id, 1, 'score'); // \"Draw and score a 1\"\n }\n break;\n \n // id 21, age 2: Canal building \n case \"21N1\":\n if (self::countCardsInLocation($player_id, 'score') == 0 && self::countCardsInLocation($player_id, 'hand') == 0) {\n self::notifyPlayer($player_id, 'log', clienttranslate('${You} have no cards in your hand or score pile to exchange.'), array('You' => 'You'));\n self::notifyAllPlayersBut($player_id, 'log', clienttranslate('${player_name} has no cards in their hand or score pile to exchange.'), array('player_name' => self::getColoredText(self::getPlayerNameFromId($player_id), $player_id)));\n } else {\n $step_max = 1; // --> 1 interaction: see B\n }\n break;\n \n // id 22, age 2: Fermenting \n case \"22N1\":\n if (self::getGameStateValue('game_rules') == 1) { // Last edition\n $number = 0;\n for($color=0; $color<5; $color++) {\n if (self::boardPileHasRessource($player_id, $color, 2 /* leaf */)) { // There is at least one visible leaf in that color\n $number++;\n }\n }\n if ($number <= 1) {\n self::notifyPlayer($player_id, 'log', clienttranslate('${You} have ${n} color with one or more visible ${leaves}.'), array('i18n' => array('n'), 'You' => 'You', 'n' => self::getTranslatedNumber($number), 'leaves' => $leaf));\n self::notifyAllPlayersBut($player_id, 'log', clienttranslate('${player_name} has ${n} color with one or more ${leaves}.'), array('i18n' => array('n'), 'player_name' => self::getColoredText(self::getPlayerNameFromId($player_id), $player_id), 'n' => self::getTranslatedNumber($number), 'leaves' => $leaf));\n }\n else { // $number > 1\n self::notifyPlayer($player_id, 'log', clienttranslate('${You} have ${n} colors with one or more visible ${leaves}.'), array('i18n' => array('n'), 'You' => 'You', 'n' => self::getTranslatedNumber($number), 'leaves' => $leaf));\n self::notifyAllPlayersBut($player_id, 'log', clienttranslate('${player_name} has ${n} colors with one or more ${leaves}.'), array('i18n' => array('n'), 'player_name' => self::getColoredText(self::getPlayerNameFromId($player_id), $player_id), 'n' => self::getTranslatedNumber($number), 'leaves' => $leaf));\n }\n // \"For each color of your board that have one leaf or more\"\n }\n else {\n $number_of_leaves = self::getPlayerSingleRessourceCount($player_id, 2 /* leaf */);\n self::notifyPlayer($player_id, 'log', clienttranslate('${You} have ${n} ${leaves}.'), array('You' => 'You', 'n' => $number_of_leaves, 'leaves' => $leaf));\n self::notifyAllPlayersBut($player_id, 'log', clienttranslate('${player_name} has ${n} ${leaves}.'), array('player_name' => self::getColoredText(self::getPlayerNameFromId($player_id), $player_id), 'n' => $number_of_leaves, 'leaves' => $leaf));\n $number = self::intDivision($number_of_leaves,2); // \"For every two leaves on your board\"\n }\n \n for($i=0; $i<$number; $i++) {\n self::executeDraw($player_id, 2); // \"Draw a 2\"\n }\n break;\n \n // id 23, age 2: Monotheism \n case \"23D1\":\n $step_max = 1; // --> 1 interaction: see B\n break;\n \n case \"23N1\":\n self::executeDraw($player_id, 1, 'board', true); // \"Draw and tuck a 1\"\n break;\n \n // id 24, age 2: Philosophy \n case \"24N1\":\n $step_max = 1; // --> 1 interaction: see B\n break;\n \n case \"24N2\":\n $step_max = 1; // --> 1 interaction: see B\n break;\n \n // id 25, age 3: Alchemy \n case \"25N1\":\n $number_of_towers = self::getPlayerSingleRessourceCount($player_id, 4);\n self::notifyPlayer($player_id, 'log', clienttranslate('${You} have ${n} ${towers}.'), array('You' => 'You', 'n' => $number_of_towers, 'towers' => $tower));\n self::notifyAllPlayersBut($player_id, 'log', clienttranslate('${player_name} has ${n} ${towers}.'), array('player_name' => self::getColoredText(self::getPlayerNameFromId($player_id), $player_id), 'n' => $number_of_towers, 'towers' => $tower));\n $any_card_red = false;\n $cards = array();\n for($i=0; $i<self::intDivision($number_of_towers,3); $i++) { // \"For every three towers on your board\"\n $card = self::executeDraw($player_id, 4, 'revealed'); // \"Draw and reveal a 4\"\n if ($card['color'] == 1) { // This card is red\n $any_card_red = true;\n }\n $cards[] = $card;\n }\n \n if ($any_card_red) { // \"If any of the drawn cards are red\"\n self::notifyPlayer($player_id, 'log', clienttranslate('${You} drew a red card.'), array('You' => 'You'));\n self::notifyAllPlayersBut($player_id, 'log', clienttranslate('${player_name} drew a red card.'), array('player_name' => self::getColoredText(self::getPlayerNameFromId($player_id), $player_id)));\n\n $step_max = 1; // --> 1 interactions: see B\n }\n else { // \"Otherwise\"\n self::notifyPlayer($player_id, 'log', clienttranslate('${You} did not draw a red card.'), array('You' => 'You'));\n self::notifyAllPlayersBut($player_id, 'log', clienttranslate('${player_name} did not draw a red card.'), array('player_name' => self::getColoredText(self::getPlayerNameFromId($player_id), $player_id)));\n foreach($cards as $card) {\n self::transferCardFromTo($card, $player_id, 'hand'); // \"Keep them\" (ie place them in your hand)\n }\n }\n break;\n \n case \"25N2\":\n $step_max = 2; // --> 2 interactions: see B\n break;\n \n // id 26, age 3: Translation \n case \"26N1\":\n $step_max = 1; // --> 1 interactions: see B\n break;\n \n case \"26N2\":\n $eligible = true;\n for($color = 0; $color < 5 ; $color++) {\n $top_card = self::getTopCardOnBoard($player_id, $color);\n if ($top_card !== null && !self::hasRessource($top_card, 1)) { // This top card is present, with no crown on it\n $eligible = false;\n }\n }\n if ($eligible) { // \"If each card on your board has a crown\"\n $achievement = self::getCardInfo(108);\n if ($achievement['owner'] == 0) {\n self::notifyPlayer($player_id, 'log', clienttranslate('Each top card on ${your} board has a ${crown}.'), array('your' => 'your', 'crown' => $crown));\n self::notifyAllPlayersBut($player_id, 'log', clienttranslate('Each top card on ${player_name} board has a ${crown}.'), array('player_name' => self::getColoredText(self::getPlayerNameFromId($player_id), $player_id), 'crown' => $crown));\n self::transferCardFromTo($achievement, $player_id, 'achievements'); // \"Claim the World achievement\"\n }\n else {\n self::notifyPlayer($player_id, 'log', clienttranslate('Each top card on ${your} board has a ${crown} but the Empire achievement has already been claimed.'), array('your' => 'your', 'crown' => $crown));\n self::notifyAllPlayersBut($player_id, 'log', clienttranslate('Each top card on ${player_name} board has a ${crown} but the World achievement has already been claimed.'), array('player_name' => self::getColoredText(self::getPlayerNameFromId($player_id), $player_id), 'crown' => $crown));\n }\n }\n break;\n \n // id 27, age 3: Engineering \n case \"27D1\":\n // \"I demand you transfer all top cards with a tower from your board to my score pile\"\n $no_top_card_with_tower = true;\n for($color = 0; $color < 5 ; $color++) {\n $top_card = self::getTopCardOnBoard($player_id, $color);\n if ($top_card !== null && self::hasRessource($top_card, 4)) { // This top card is present, with a tower on it\n $no_top_card_with_tower = false;\n self::transferCardFromTo($top_card, $launcher_id, 'score');\n }\n }\n if ($no_top_card_with_tower) {\n self::notifyPlayer($player_id, 'log', clienttranslate('${You} have no top card with a ${tower} on your board.'), array('You' => 'You', 'tower' => $tower));\n self::notifyAllPlayersBut($player_id, 'log', clienttranslate('${player_name} has no top card with a ${tower} on his board.'), array('player_name' => self::getColoredText(self::getPlayerNameFromId($player_id), $player_id), 'tower' => $tower));\n }\n break;\n \n case \"27N1\":\n $step_max = 1; // --> 1 interactions: see B\n break;\n \n // id 28, age 3: Optics \n case \"28N1\":\n $card = self::executeDraw($player_id, 3, 'board'); // \"Draw and meld a 3\"\n if (self::hasRessource($card, 1)) { // \"If it has a crown\"\n self::notifyGeneralInfo(clienttranslate('It has a ${crown}.'), array('crown' => $crown));\n self::executeDraw($player_id, 4, 'score'); // \"Draw and score a 4\"\n }\n else { // \"Otherwise\"\n self::notifyGeneralInfo(clienttranslate('It does not have a ${crown}.'), array('crown' => $crown));\n $number_of_players_with_fewer_points = self::getUniqueValueFromDB(self::format(\"\n SELECT\n COUNT(*)\n FROM\n player\n WHERE\n player_id <> {player_id} AND\n player_innovation_score < (\n SELECT\n player_innovation_score\n FROM\n player\n WHERE\n player_id = {player_id}\n ) AND\n player_team <> (\n SELECT\n player_team\n FROM\n player\n WHERE\n player_id = {player_id}\n )\n \"\n ,\n array('player_id' => $player_id)\n ));\n if ($number_of_players_with_fewer_points == 0) {\n self::notifyPlayer($player_id, 'log', clienttranslate('There is no opponent who has fewer points than ${you}.'), array('you' => 'you'));\n self::notifyAllPlayersBut($player_id, 'log', clienttranslate('There is no opponent who has fewer points than ${player_name}.'), array('player_name' => self::getColoredText(self::getPlayerNameFromId($player_id), $player_id)));\n }\n else {\n $step_max = 2; // --> 2 interactions: see B\n }\n }\n break;\n \n // id 29, age 3: Compass\n case \"29D1\":\n $step_max = 2; // --> 2 interactions: see B\n break;\n \n // id 30, age 3: Paper \n case \"30N1\":\n $step_max = 1; // --> 1 interaction: see B\n break;\n \n case \"30N2\":\n $number_of_colors_splayed_left = 0;\n for($color = 0; $color < 5 ; $color++) {\n if (self::getCurrentSplayDirection($player_id, $color) == 1 /* left */) {\n $number_of_colors_splayed_left++;\n }\n }\n if ($number_of_colors_splayed_left < 2) {\n self::notifyPlayer($player_id, 'log', clienttranslate('${You} have ${n} color splayed left.'), array('i18n' => array('n'), 'You' => 'You', 'n' => $number_of_colors_splayed_left));\n self::notifyAllPlayersBut($player_id, 'log', clienttranslate('${player_name} has ${n} color splayed left.'), array('i18n' => array('n'), 'player_name' => self::getColoredText(self::getPlayerNameFromId($player_id), $player_id), 'n' => $number_of_colors_splayed_left));\n }\n else {\n self::notifyPlayer($player_id, 'log', clienttranslate('${You} have ${n} colors splayed left.'), array('i18n' => array('n'), 'You' => 'You', 'n' => $number_of_colors_splayed_left));\n self::notifyAllPlayersBut($player_id, 'log', clienttranslate('${player_name} has ${n} colors splayed left.'), array('i18n' => array('n'), 'player_name' => self::getColoredText(self::getPlayerNameFromId($player_id), $player_id), 'n' => $number_of_colors_splayed_left));\n }\n \n for($i=0;$i<$number_of_colors_splayed_left;$i++) { // For every color you have splayed left\n self::executeDraw($player_id, 4); // Draw a 4\n }\n break;\n \n // id 31, age 3: Machinery \n case \"31D1\":\n // \"Exchange all the cards in your hand with all the highest cards in my hand\"\n \n // Get cards in hand\n $ids_of_cards_in_player_hand = self::getIdsOfCardsInLocation($player_id, 'hand');\n $ids_of_highest_cards_in_launcher_hand = self::getIdsOfHighestCardsInLocation($launcher_id, 'hand');\n \n // Make the transfers\n foreach($ids_of_cards_in_player_hand as $id) {\n $card = self::getCardInfo($id);\n self::transferCardFromTo($card, $launcher_id, 'hand');\n }\n foreach($ids_of_highest_cards_in_launcher_hand as $id) {\n $card = self::getCardInfo($id);\n self::transferCardFromTo($card, $player_id, 'hand');\n }\n break;\n \n case \"31N1\":\n $step_max = 2; // --> 2 interactions: see B\n break;\n \n // id 32, age 3: Medicine \n case \"32D1\":\n $step_max = 2; // --> 2 interactions: see B\n break;\n \n // id 33, age 3: Education \n case \"33N1\":\n $step_max = 1; // --> 1 interaction: see B\n break;\n \n // id 34, age 3: Feudalism \n case \"34D1\":\n $step_max = 1; // --> 1 interaction: see B\n break;\n \n case \"34N1\":\n $step_max = 1; // --> 1 interaction: see B\n break;\n \n // id 35, age 4: Experimentation \n case \"35N1\":\n self::executeDraw($player_id, 5, 'board'); // \"Draw and meld a 5\"\n break;\n \n // id 36, age 4: Printing press \n case \"36N1\":\n $step_max = 1; // --> 1 interaction: see B\n break;\n \n case \"36N2\":\n $step_max = 1; // --> 1 interaction: see B\n break;\n \n // id 37, age 4: Colonialism\n case \"37N1\":\n do {\n $card = self::executeDraw($player_id, 3, 'board', true); // \"Draw and tuck a 3\"\n } while(self::hasRessource($card, 1 /* crown */)); // \"If it has a crown, repeat this dogma effect\"\n break;\n \n // id 38, age 4: Gunpowder\n case \"38D1\":\n if (self::getGameStateValue('auxiliary_value') == -1) { // If this variable has not been set before\n self::setGameStateValue('auxiliary_value', 0);\n }\n $step_max = 1; // --> 1 interaction: see B\n break;\n \n case \"38N1\":\n if (self::getGameStateValue('auxiliary_value') == 1) { // \"If any card was transfered due to the demand\"\n self::executeDraw($player_id, 2, 'score'); // \"Draw and score a 2\"\n }\n break;\n \n // id 39, age 4: Invention\n case \"39N1\":\n $step_max = 1; // --> 1 interaction: see B\n break;\n \n case \"39N2\":\n $eligible = true;\n for($color = 0; $color < 5 ; $color++) {\n if (self::getCurrentSplayDirection($player_id, $color) == 0) { // This color is missing or unsplayed\n $eligible = false;\n };\n }\n if ($eligible) { // \"If you have colors splayed, each in any direction\"\n $achievement = self::getCardInfo(107);\n if ($achievement['owner'] == 0) {\n self::notifyPlayer($player_id, 'log', clienttranslate('${You} have all your five colors splayed.'), array('You' => 'You'));\n self::notifyAllPlayersBut($player_id, 'log', clienttranslate('${player_name} has all his five colors splayed.'), array('player_name' => self::getColoredText(self::getPlayerNameFromId($player_id), $player_id)));\n self::transferCardFromTo($achievement, $player_id, 'achievements'); // \"Claim the Wonder achievement\"\n }\n else {\n self::notifyPlayer($player_id, 'log', clienttranslate('${You} have all your five colors splayed but the Wonder achievement has already been claimed.'), array('You' => 'You'));\n self::notifyAllPlayersBut($player_id, 'log', clienttranslate('${player_name} has all his five colors splayed but the Wonder achievement has already been claimed.'), array('player_name' => self::getColoredText(self::getPlayerNameFromId($player_id), $player_id)));\n }\n }\n break;\n \n // id 40, age 4: Navigation\n case \"40D1\":\n $step_max = 1; // --> 1 interaction: see B\n break;\n \n // id 41, age 4: Anatomy\n case \"41D1\":\n $step_max = 1; // --> 1 interaction: see B\n break;\n \n // id 42, age 4: Perspective\n case \"42N1\":\n $step_max = 1; // --> 1 interaction: see B\n break;\n \n // id 43, age 4: Enterprise\n case \"43D1\":\n $step_max = 1; // --> 1 interaction: see B\n break;\n \n case \"43N1\":\n $step_max = 1; // --> 1 interaction: see B\n break;\n \n // id 44, age 4: Reformation\n case \"44N1\":\n $step_max = 1; // --> 1 interaction: see B\n break;\n \n case \"44N2\":\n $step_max = 1; // --> 1 interaction: see B\n break;\n \n // id 45, age 5: Chemistry\n case \"45N1\":\n $step_max = 1; // --> 1 interaction: see B\n break;\n \n case \"45N2\":\n // \"Draw and score a card of value one higher than the highest top card on your board\"\n self::executeDraw($player_id, self::getMaxAgeOnBoardTopCards($player_id) + 1, 'score');\n $step_max = 1; // --> 1 interaction: see B\n break;\n \n // id 46, age 5: Physics\n case \"46N1\":\n $cards = array();\n $colors = array();\n $same_color = false;\n for($i=0; $i<3; $i++) { // \"Three times\"\n $card = self::executeDraw($player_id, 6, 'revealed'); // \"Draw and reveal a 6\"\n if (in_array($card['color'], $colors)) { // This card has the same color than one that has already been drawn\n $same_color = true;\n }\n else {\n $colors[] = $card['color'];\n }\n $cards[] = $card;\n }\n \n if ($same_color) { // \"If two or more cards are the same color\"\n $step_max = 1; // --> 1 interactions: see B\n self::notifyPlayer($player_id, 'log', clienttranslate('${You} drew two cards of the same color.'), array('You' => 'You'));\n self::notifyAllPlayersBut($player_id, 'log', clienttranslate('${player_name} drew two cards of the same color.'), array('player_name' => self::getColoredText(self::getPlayerNameFromId($player_id), $player_id)));\n }\n else { // \"Otherwise\"\n self::notifyPlayer($player_id, 'log', clienttranslate('All the cards ${you} drew have different colors.'), array('you' => 'you'));\n self::notifyAllPlayersBut($player_id, 'log', clienttranslate('All the cards ${player_name} drew have different colors.'), array('player_name' => self::getColoredText(self::getPlayerNameFromId($player_id), $player_id)));\n foreach($cards as $card) {\n self::transferCardFromTo($card, $player_id, 'hand'); // \"Keep them\" (ie place them in your hand)\n }\n }\n break;\n \n // id 47, age 5: Coal\n case \"47N1\":\n self::executeDraw($player_id, 5, 'board', true); // \"Draw and tuck a 5\"\n break;\n\n case \"47N2\":\n $step_max = 1; // --> 1 interaction: see B\n break;\n \n case \"47N3\":\n $step_max = 1; // --> 1 interaction: see B\n break;\n \n // id 48, age 5: The pirate code\n case \"48D1\":\n if (self::getGameStateValue('auxiliary_value') == -1) { // If this variable has not been set before\n self::setGameStateValue('auxiliary_value', 0);\n }\n $step_max = 1; // --> 1 interaction: see B\n break;\n\n case \"48N1\":\n if (self::getGameStateValue('auxiliary_value') == 1) { // \"If any card was transfered due to the demand\"\n $step_max = 1; // --> 1 interaction: see B\n }\n break;\n \n // id 49, age 5: Banking\n case \"49D1\":\n $step_max = 1; // --> 1 interaction: see B\n break;\n\n case \"49N1\":\n $step_max = 1; // --> 1 interaction: see B\n break;\n \n // id 50, age 5: Measurement\n case \"50N1\":\n $step_max = 1; // --> 1 interaction: see B\n break;\n \n // id 51, age 5: Statistics\n case \"51D1\":\n if (self::getGameStateValue('game_rules') == 1) { // Last edition\n // Get highest cards in score\n $ids_of_highest_cards_in_score = self::getIdsOfHighestCardsInLocation($player_id, 'score');\n\n // Make the transfers\n foreach($ids_of_highest_cards_in_score as $id) {\n $card = self::getCardInfo($id);\n self::transferCardFromTo($card, $player_id, 'hand'); // \"Transfer all the highest cards in your score pile to your hand\"\n }\n }\n else { // First edition\n $step_max = 1; // --> 1 interaction: see B\n }\n break;\n\n case \"51N1\":\n $step_max = 1; // --> 1 interaction: see B\n break;\n \n // id 52, age 5: Steam engine\n case \"52N1\":\n self::executeDraw($player_id, 4, 'board', true); // \"Draw and tuck two 1\"\n self::executeDraw($player_id, 4, 'board', true); //\n $card = self::getBottomCardOnBoard($player_id, 3 /* yellow */);\n if ($card !== null) {\n self::transferCardFromTo($card, $player_id, 'score', false, true); // \"Score your bottom yellow card\"\n }\n break;\n \n // id 53, age 5: Astronomy\n case \"53N1\":\n while(true) {\n $card = self::executeDraw($player_id, 6, 'revealed'); // \"Draw and reveal a 6\"\n if ($card['color'] != 0 /* blue */ && $card['color'] != 2 /* green */) {\n self::notifyGeneralInfo(clienttranslate(\"This card is neither blue nor green.\"));\n break; // \"Otherwise\"\n };\n // \"If the card is green or blue\"\n self::notifyGeneralInfo($card['color'] == 0 ? clienttranslate(\"This card is blue.\") : clienttranslate(\"This card is green.\"));\n self::transferCardFromTo($card, $player_id, 'board'); // \"Meld it\"\n }\n self::transferCardFromTo($card, $player_id, 'hand'); // (\"Keep it\")\n break;\n \n case \"53N2\":\n $eligible = true;\n for($color = 0; $color < 4 /* purple is not tested */ ; $color++) {\n $top_card = self::getTopCardOnBoard($player_id, $color);\n if ($top_card !== null && $top_card['age'] < 6) { // This top card is value 5 or fewer\n $eligible = false;\n }\n }\n if ($eligible) { // \"If all your non-purple top cards on your board are value 6 or higher\"\n $achievement = self::getCardInfo(109);\n if ($achievement['owner'] == 0) {\n self::notifyPlayer($player_id, 'log', clienttranslate('All non-purple top cards on ${your} board are value ${age_6} or higher.'), array('your' => 'your', 'age_6' => self::getAgeSquare(6)));\n self::notifyAllPlayersBut($player_id, 'log', clienttranslate('All non-purple top cards on ${player_name}\\'s board are value ${age_6} or higher.'), array('player_name' => self::getColoredText(self::getPlayerNameFromId($player_id), $player_id), 'age_6' => self::getAgeSquare(6)));\n self::transferCardFromTo($achievement, $player_id, 'achievements'); // \"Claim the Universe achievement\"\n }\n else {\n self::notifyPlayer($player_id, 'log', clienttranslate('All non-purple top cards on ${your} board are value ${age_6} or higher but the Universe achievement has already been claimed.'), array('your' => 'your', 'age_6' => self::getAgeSquare(6)));\n self::notifyAllPlayersBut($player_id, 'log', clienttranslate('All non-purple top cards on ${player_name}\\'s board are value ${age_6} or higher but the Universe achievement has already been claimed.'), array('player_name' => self::getColoredText(self::getPlayerNameFromId($player_id), $player_id), 'age_6' => self::getAgeSquare(6)));\n }\n }\n break;\n \n // id 54, age 5: Societies\n case \"54D1\":\n if (self::getGameStateValue('game_rules') == 1) { // Last edition\n $colors = array();\n // Determine colors which top cards with a lightbulb of the player have a value higher than the tops cards of the launcher\n for($color=0; $color<5; $color++) {\n $player_top_card = self::getTopCardOnBoard($player_id, $color);\n if ($player_top_card === null || !self::hasRessource($player_top_card, 3 /* lightbulb */)) {\n continue;\n }\n $launcher_top_card = self::getTopCardOnBoard($launcher_id, $color);\n if ($launcher_top_card === null /* => Value 0, so the color is selectable */ || $player_top_card['age'] > $launcher_top_card['age']) {\n $colors[] = $color; // This color is selectable\n }\n }\n }\n else { // First edition\n $colors = array(0,1,2,3); // All but purple\n }\n self::setGameStateValueFromArray('auxiliary_value', $colors);\n $step_max = 1; // --> 1 interaction: see B\n break;\n \n // id 55, age 6: Atomic theory\n case \"55N1\":\n $step_max = 1; // --> 1 interaction: see B\n break;\n \n case \"55N2\":\n self::executeDraw($player_id, 7, 'board'); // \"Draw and meld a 7\"\n break;\n \n // id 56, age 6: Encyclopedia\n case \"56N1\":\n $step_max = 1; // --> 1 interaction: see B\n break;\n \n // id 57, age 6: Industrialisation\n case \"57N1\":\n if (self::getGameStateValue('game_rules') == 1) { // Last edition\n $number = 0;\n for($color=0; $color<5; $color++) {\n if (self::boardPileHasRessource($player_id, $color, 5 /* factory */)) { // There is at least one visible factory in that color\n $number++;\n }\n }\n if ($number <= 1) {\n self::notifyPlayer($player_id, 'log', clienttranslate('${You} have ${n} color with one or more visible ${factories}.'), array('i18n' => array('n'), 'You' => 'You', 'n' => self::getTranslatedNumber($number), 'factories' => $factory));\n self::notifyAllPlayersBut($player_id, 'log', clienttranslate('${player_name} has ${n} color with one or more ${factories}.'), array('i18n' => array('n'), 'player_name' => self::getColoredText(self::getPlayerNameFromId($player_id), $player_id), 'n' => self::getTranslatedNumber($number), 'factories' => $factory));\n }\n else { // $number > 1\n self::notifyPlayer($player_id, 'log', clienttranslate('${You} have ${n} colors with one or more visible ${factories}.'), array('i18n' => array('n'), 'You' => 'You', 'n' => self::getTranslatedNumber($number), 'factories' => $factory));\n self::notifyAllPlayersBut($player_id, 'log', clienttranslate('${player_name} has ${n} colors with one or more ${factories}.'), array('i18n' => array('n'), 'player_name' => self::getColoredText(self::getPlayerNameFromId($player_id), $player_id), 'n' => self::getTranslatedNumber($number), 'factories' => $factory));\n }\n // \"For each color of your board that have one factory or more\"\n }\n else {\n $number_of_factories = self::getPlayerSingleRessourceCount($player_id, 5 /* factory */);\n self::notifyPlayer($player_id, 'log', clienttranslate('${You} have ${n} ${factories}.'), array('You' => 'You', 'n' => $number_of_factories, 'factories' => $factory));\n self::notifyAllPlayersBut($player_id, 'log', clienttranslate('${player_name} has ${n} ${factories}.'), array('player_name' => self::getColoredText(self::getPlayerNameFromId($player_id), $player_id), 'n' => $number_of_factories, 'factories' => $factory));\n $number = self::intDivision($number_of_factories,2); // \"For every two factories on your board\"\n }\n \n for($i=0; $i<$number; $i++) {\n self::executeDraw($player_id, 6, 'board', true); // \"Draw and tuck a 6\"\n }\n break;\n \n case \"57N2\":\n $step_max = 1; // --> 1 interaction: see B\n break;\n \n // id 58, age 6: Machine tools\n case \"58N1\":\n self::executeDraw($player_id, self::getMaxAgeInScore($player_id), 'score'); // \"Draw and score a card of value equal to the highest card in your score pile\"\n break;\n \n // id 59, age 6: Classification\n case \"59N1\":\n $step_max = 1; // --> 1 interaction: see B\n break;\n \n // id 60, age 6: Metric system\n case \"60N1\":\n if (self::getCurrentSplayDirection($player_id, 2 /* green */) == 2 /* right */) { // \"If your green cards are splayed right\"\n $step_max = 1; // --> 1 interaction: see B\n }\n break;\n \n case \"60N2\":\n $step_max = 1; // --> 1 interaction: see B\n break;\n \n // id 61, age 6: Canning\n case \"61N1\":\n $step_max = 1; // --> 1 interaction: see B\n break;\n \n case \"61N2\":\n $step_max = 1; // --> 1 interaction: see B\n break;\n \n // id 62, age 6: Vaccination\n case \"62D1\":\n if (self::getGameStateValue('auxiliary_value') == -1) { // If this variable has not been set before\n self::setGameStateValue('auxiliary_value', 0);\n }\n $step_max = 1; // --> 1 interaction: see B\n break;\n \n case \"62N1\":\n if (self::getGameStateValue('auxiliary_value') == 1) { // \"If any card was returned as a result of the demand\"\n self::executeDraw($player_id, 7, 'board'); // \"Draw and meld a 7\"\n }\n break;\n \n // id 63, age 6: Democracy \n case \"63N1\":\n if (self::getGameStateValue('auxiliary_value') == -1) { // If this variable has not been set before\n self::setGameStateValue('auxiliary_value', 0);\n }\n $step_max = 1; // --> 1 interaction: see B\n break;\n \n // id 64, age 6: Emancipation\n case \"64D1\":\n $step_max = 1; // --> 1 interaction: see B\n break;\n \n case \"64N1\":\n $step_max = 1; // --> 1 interaction: see B\n break;\n \n // id 65, age 7: Evolution \n case \"65N1\":\n $step_max = 1; // --> 1 interaction: see B\n break;\n \n // id 66, age 7: Publications\n case \"66N1\":\n $step_max = 1; // --> 1 interaction: see B\n break;\n \n case \"66N2\":\n $step_max = 1; // --> 1 interaction: see B\n break;\n\n // id 67, age 7: Combustion\n case \"67D1\":\n if (self::getGameStateValue('game_rules') == 1) { // Last edition\n $number_of_crowns = self::getPlayerSingleRessourceCount($launcher_id, 1 /* crown */);\n self::notifyPlayer($launcher_id, 'log', clienttranslate('${You} have ${n} ${crowns}.'), array('You' => 'You', 'n' => $number_of_crowns, 'crowns' => $crown));\n self::notifyAllPlayersBut($launcher_id, 'log', clienttranslate('${player_name} has ${n} ${crowns}.'), array('player_name' => self::getColoredText(self::getPlayerNameFromId($player_id), $player_id), 'n' => $number_of_crowns, 'crowns' => $crown));\n $number = self::intDivision($number_of_crowns, 4);\n if ($number == 0) {\n self::notifyGeneralInfo(clienttranslate('No card has to be transfered.'));\n break;\n }\n }\n else { // First edition\n $number = 2;\n }\n self::setGameStateValue('auxiliary_value', $number);\n $step_max = 1; // --> 1 interaction: see B\n break;\n \n case \"67N1\":\n if (self::getGameStateValue('game_rules') == 1) { // Last edition\n $bottom_red_card = self::getBottomCardOnBoard($player_id, 1 /* red */);\n if ($bottom_red_card !== null) {\n self::transferCardFromTo($bottom_red_card, 0, 'deck'); // \"Return your bottom red card\"\n }\n }\n break;\n \n // id 68, age 7: Explosives\n case \"68D1\":\n self::setGameStateValue('auxiliary_value', 0); // Flag to indicate if the player has transfered a card or not\n $step_max = 3; // --> 3 interactions: see B\n break;\n \n // id 69, age 7: Bicycle\n case \"69N1\":\n $step_max = 1; // --> 1 interaction: see B\n break;\n \n // id 70, age 7: Electricity\n case \"70N1\":\n $step_max = 1; // --> 1 interaction: see B\n break;\n \n // id 71, age 7: Refrigeration\n case \"71D1\":\n if (self::countCardsInLocation($player_id, 'hand') > 1) {\n $step_max = 1; // --> 1 interaction: see B\n }\n break;\n \n case \"71N1\":\n $step_max = 1; // --> 1 interaction: see B\n break;\n \n // id 72, age 7: Sanitation \n case \"72D1\":\n $step_max = 3; // --> 3 interactions: see B\n break;\n \n // id 73, age 7: Lighting \n case \"73N1\":\n self::setGameStateValueFromArray('auxiliary_value', array()); // Flag to indicate what ages have been tucked\n $step_max = 1; // --> 1 interaction: see B\n break;\n \n // id 74, age 7: Railroad \n case \"74N1\":\n $step_max = 1; // --> 1 interaction: see B\n break;\n \n case \"74N2\":\n $step_max = 1; // --> 1 interaction: see B\n break;\n \n // id 75, age 8: Quantum theory \n case \"75N1\":\n $step_max = 1; // --> 1 interaction: see B\n break;\n \n // id 76, age 8: Rocketry \n case \"76N1\":\n $step_max = 1; // --> 1 interaction: see B\n break;\n \n // id 77, age 8: Flight\n case \"77N1\":\n if (self::getCurrentSplayDirection($player_id, 1 /* red */) == 3 /* up */) { // \"If your red cards are splayed up\"\n $step_max = 1; // --> 1 interaction: see B\n }\n break;\n \n case \"77N2\":\n $step_max = 1; // --> 1 interaction: see B\n break;\n \n // id 78, age 8: Mobility \n case \"78D1\":\n self::setGameStateValueFromArray('auxiliary_value', array(0,2,3,4)); // Flag to indicate the colors the player can still choose (not red at the start)\n $step_max = 2; // --> 2 interactions: see B\n break;\n \n // id 79, age 8: Corporations \n case \"79D1\":\n $step_max = 1; // --> 1 interaction: see B\n break;\n \n case \"79N1\":\n self::executeDraw($player_id, 8, 'board'); // \"Draw and meld an ${age_8}\"\n break;\n \n // id 80, age 8: Mass media \n case \"80N1\":\n $step_max = 1; // --> 1 interaction: see B\n break;\n \n case \"80N2\":\n $step_max = 1; // --> 1 interaction: see B\n break;\n\n // id 81, age 8: Antibiotics\n case \"81N1\":\n self::setGameStateValueFromArray('auxiliary_value', array()); // Flag to indicate what ages have been tucked\n $step_max = 1; // --> 1 interaction: see B\n break;\n\n // id 82, age 8: Skyscrapers\n case \"82D1\":\n $step_max = 1; // --> 1 interaction: see B\n break;\n \n // id 83, age 8: Empiricism \n case \"83N1\":\n $step_max = 1; // --> 1 interaction: see B\n break;\n \n case \"83N2\":\n if (self::getPlayerSingleRessourceCount($player_id, 3 /* lightbulb */) >= 20) { // \"If you have twenty or more lightbulbs on your board\"\n self::notifyPlayer($player_id, 'log', clienttranslate('${You} have at least twenty ${lightbulbs}.'), array('You' => 'You', 'lightbulbs' => $lightbulb));\n self::notifyAllPlayersBut($player_id, 'log', clienttranslate('${player_name} has at least twenty ${lightbulbs}.'), array('player_name' => self::getColoredText(self::getPlayerNameFromId($player_id), $player_id), 'lightbulbs' => $lightbulb));\n self::setGameStateValue('winner_by_dogma', $player_id); // \"You win\"\n self::trace('EOG bubbled from self::stPlayerInvolvedTurn Empiricism');\n throw new EndOfGame(); \n }\n break;\n \n // id 84, age 8: Socialism \n case \"84N1\":\n self::setGameStateValue('auxiliary_value', 0); // Flag to indicate if one purple card has been tuckeds or not\n $step_max = 1; // --> 1 interaction: see B\n break;\n \n // id 85, age 9: Computers \n case \"85N1\":\n $step_max = 1; // --> 1 interaction: see B\n break;\n \n case \"85N2\":\n $card = self::executeDraw($player_id, 10, 'board'); // \"Draw and meld a 10\"\n self::checkAndPushCardIntoNestedDogmaStack($card); // \"Execute each of its non-demand dogma effects\"\n break;\n \n // id 86, age 9: Genetics \n case \"86N1\":\n $card = self::executeDraw($player_id, 10, 'board'); // \"Draw and meld a 10\"\n $board = self::getCardsInLocation($player_id, 'board', false, true);\n $pile = $board[$card['color']];\n for($p=0; $p < count($pile)-1; $p++) { // \"For each card beneath it\"\n $card = self::getCardInfo($pile[$p]['id']);\n self::transferCardFromTo($card, $player_id, 'score', false, true); // \"Score that card\"\n }\n break;\n \n // id 87, age 9: Composites \n case \"87D1\":\n $step_max = 2; // --> 2 interactions: see B\n if (self::countCardsInLocation($player_id, 'hand') <= 1) {\n $step = 2; // --> (All but one card when there is 0 or 1 card means that nothing is to be done) Jump directly to step 2\n }\n break;\n \n // id 88, age 9: Fission\n case \"88D1\":\n $card = self::executeDraw($player_id, 10, 'revealed'); // \"Draw a 10\"\n if ($card['color'] == 1 /* red */) { // \"If it is red\"\n self::notifyGeneralInfo(clienttranslate('This card is red.'));\n self::removeAllHandsBoardsAndScores(); // \"Remove all hands, boards and score piles from the game\"\n self::notifyAll('removedHandsBoardsAndScores', clienttranslate('All hands, boards and score piles are removed from the game. Achievements are kept.'), array());\n \n // Stats\n self::setStat(true, 'fission_triggered');\n \n // \"If this occurs, the dogma action is complete\"\n // (Set the flags has if the launcher had completed the non-demand dogma effect)\n self::setGameStateValue('current_player_under_dogma_effect', $launcher_id);\n self::setGameStateValue('current_effect_type', 1);\n self::setGameStateValue('current_effect_number', 1);\n }\n else {\n self::notifyGeneralInfo(clienttranslate('This card is not red.'));\n // (Implicit) \"Place it into your hand\"\n self::transferCardFromTo($card, $player_id, 'hand');\n }\n break;\n \n case \"88N1\":\n $step_max = 1; // --> 1 interaction: see B\n break;\n\n // id 89, age 9: Collaboration\n case \"89D1\":\n self::executeDraw($player_id, 9, 'revealed'); // \"Draw two 9 and reveal them\"\n self::executeDraw($player_id, 9, 'revealed'); //\n $step_max = 1; // --> 1 interaction: see B\n break;\n \n case \"89N1\":\n $number_of_cards_on_board = self::countCardsInLocation($player_id, 'board', false, true);\n $number_of_green_cards = $number_of_cards_on_board[2];\n if ($number_of_green_cards >= 10) { // \"If you have ten or more green cards on your board\"\n self::notifyPlayer($player_id, 'log', clienttranslate('${You} have at least ten green cards.'), array('You' => 'You'));\n self::notifyAllPlayersBut($player_id, 'log', clienttranslate('${player_name} has at least ten green cards.'), array('player_name' => self::getColoredText(self::getPlayerNameFromId($player_id), $player_id)));\n self::setGameStateValue('winner_by_dogma', $player_id); // \"You win\"\n self::trace('EOG bubbled from self::stPlayerInvolvedTurn Collaboration');\n throw new EndOfGame(); \n }\n break;\n \n // id 90, age 9: Satellites\n case \"90N1\":\n $step_max = 1; // --> 1 interaction: see B\n break;\n\n case \"90N2\":\n $step_max = 1; // --> 1 interaction: see B\n break;\n \n case \"90N3\":\n $step_max = 1; // --> 1 interaction: see B\n break;\n\n // id 91, age 9: Ecology\n case \"91N1\":\n $step_max = 1; // --> 1 interaction: see B\n break;\n\n // id 92, age 9: Suburbia\n case \"92N1\":\n $step_max = 1; // --> 1 interaction: see B\n break;\n \n // id 93, age 9: Services\n case \"93D1\":\n $ids_of_highest_cards_in_score = self::getIdsOfHighestCardsInLocation($player_id, 'score');\n foreach($ids_of_highest_cards_in_score as $id) {\n $card = self::getCardInfo($id);\n self::transferCardFromTo($card, $launcher_id, 'hand'); // \"Transfer all the highest cards from your score pile to my hand\"\n }\n \n if (count($ids_of_highest_cards_in_score) > 0) { // \"If you transferred any cards\"\n $step_max = 1; // --> 1 interaction: see B\n }\n break;\n \n\n // id 94, age 9: Specialization\n case \"94N1\":\n $step_max = 1; // --> 1 interaction: see B\n break;\n \n case \"94N2\":\n $step_max = 1; // --> 1 interaction: see B\n break;\n \n // id 95, age 10: Bioengineering\n case \"95N1\":\n $step_max = 1; // --> 1 interaction: see B\n break;\n \n case \"95N2\":\n $players = self::loadPlayersBasicInfos();\n $max_number_of_leaves = -1;\n $any_under_three_leaves = false;\n foreach ($players as $player_id => $player) {\n $number_of_leaves = self::getPlayerSingleRessourceCount($player_id, 2);\n self::notifyPlayer($player_id, 'log', clienttranslate('${You} have ${n} ${leaves}.'), array('You' => 'You', 'n' => $number_of_leaves, 'leaves' => $leaf));\n self::notifyAllPlayersBut($player_id, 'log', clienttranslate('${player_name} has ${n} ${leaves}.'), array('player_name' => self::getColoredText(self::getPlayerNameFromId($player_id), $player_id), 'n' => $number_of_leaves, 'leaves' => $leaf));\n if (!$any_under_three_leaves && $number_of_leaves < 3) { // Less than three\n self::notifyGeneralInfo(clienttranslate('That is less than 3.'));\n $any_under_three_leaves = true;\n }\n if ($number_of_leaves > $max_number_of_leaves) {\n $max_number_of_leaves = $number_of_leaves;\n $owner_of_max_number_of_leaves = $player_id;\n $tie = false; \n }\n else if ($number_of_leaves == $max_number_of_leaves && $player_id != self::getPlayerTeammate($owner_of_max_number_of_leaves)) {\n $tie = true;\n }\n }\n \n if (!$any_under_three_leaves) {\n self::notifyGeneralInfo(clienttranslate('Nobody has less than three ${leaves}.'), array('leaves' => $leaf));\n }\n else if ($tie) {\n self::notifyGeneralInfo(clienttranslate('There is a tie for the most number of ${leaves}. The game continues.'), array('leaves' => $leaf));\n }\n else { // \"If any player has less than three leaves, the single player with the most number of leaves\"\n self::notifyPlayer($owner_of_max_number_of_leaves, 'log', clienttranslate('${You} have more ${leaves} than each opponent.'), array('You' => 'You', 'leaves' => $leaf));\n self::notifyAllPlayersBut($owner_of_max_number_of_leaves, 'log', clienttranslate('${player_name} has more ${leaves} than each opponent.'), array('player_name' => self::getColoredText(self::getPlayerNameFromId($owner_of_max_number_of_leaves), $owner_of_max_number_of_leaves), 'leaves' => $leaf));\n self::setGameStateValue('winner_by_dogma', $owner_of_max_number_of_leaves); // \"Wins\"\n self::trace('EOG bubbled from self::stPlayerInvolvedTurn Bioengineering');\n throw new EndOfGame();\n }\n \n break;\n\n // id 96, age 10: Software\n case \"96N1\":\n self::executeDraw($player_id, 10, 'score', false, true /* score keyword*/); // \"Draw and score a 10\"\n break;\n \n case \"96N2\":\n self::executeDraw($player_id, 10, 'board'); // \"Draw and meld two 10\"\n $card = self::executeDraw($player_id, 10, 'board'); //\n self::checkAndPushCardIntoNestedDogmaStack($card); // \"Execute each of the second card's non-demand dogma effects\"\n break;\n \n // id 97, age 10: Miniaturization\n case \"97N1\":\n $step_max = 1; // --> 1 interaction: see B\n break;\n \n // id 98, age 10: Robotics\n case \"98N1\":\n $top_green_card = self::getTopCardOnBoard($player_id, 2 /* green */);\n if ($top_green_card !== null) {\n self::transferCardFromTo($top_green_card, $player_id, 'score', false, true /* score keyword*/); // \"Score your top green card\"\n }\n $card = self::executeDraw($player_id, 10, 'board'); // \"Draw and meld a 10\n self::checkAndPushCardIntoNestedDogmaStack($card); // \"Execute each its non-demand dogma effects\"\n break;\n \n // id 99, age 10: Databases\n case \"99D1\":\n if (self::countCardsInLocation($player_id, 'score') > 0) { // (Nothing to do if the player has nothing in his score pile)\n $step_max = 1; // --> 1 interaction: see B\n }\n break;\n \n // id 100, age 10: Self service\n case \"100N1\":\n $step_max = 1; // --> 1 interaction: see B\n break;\n \n case \"100N2\":\n $players = self::loadPlayersBasicInfos();\n $number_of_achievements = self::getPlayerNumberOfAchievements($player_id);\n $most_achievements = true;\n foreach ($players as $other_player_id => $player) {\n if ($other_player_id == $player_id || $other_player_id == self::getPlayerTeammate($player_id)) {\n continue; // Skip the player being evaluated and his teammate\n }\n \n if (self::getPlayerNumberOfAchievements($other_player_id) >= $number_of_achievements) {\n $most_achievements = false;\n }\n }\n if ($most_achievements) { // \"If you have more achievements than each other player\"\n if (self::decodeGameType(self::getGameStateValue('game_type')) == 'individual') {\n self::notifyAllPlayersBut($player_id, \"log\", clienttranslate('${player_name} has more achievements than each other player.'), array(\n 'player_name' => self::getPlayerNameFromId($player_id)\n ));\n \n self::notifyPlayer($player_id, \"log\", clienttranslate('${You} have more achievements than each other player.'), array(\n 'You' => 'You'\n ));\n }\n else { // self::getGameStateValue('game_type')) == 'team'\n $teammate_id = self::getPlayerTeammate($player_id);\n $winning_team = array($player_id, $teammate_id);\n self::notifyAllPlayersBut($winning_team, \"log\", clienttranslate('The other team has more achievements than yours.'), array());\n \n self::notifyPlayer($player_id, \"log\", clienttranslate('Your team has more achievements than the other.'), array());\n \n self::notifyPlayer($teammate_id, \"log\", clienttranslate('Your team has more achievements than the other.'), array());\n }\n self::setGameStateValue('winner_by_dogma', $player_id); // \"You win\"\n self::trace('EOG bubbled from self::stPlayerInvolvedTurn Self service');\n throw new EndOfGame();\n }\n break;\n \n // id 101, age 10: Globalization\n case \"101D1\":\n $step_max = 1; // --> 1 interaction: see B\n break;\n\n case \"101N1\":\n self::executeDraw($player_id, 6, 'score', false, true); // \"Draw and score a 6\"\n \n $players = self::loadPlayersBasicInfos();\n $nobody_more_leaves_than_factories = true;\n foreach ($players as $player_id => $player) {\n $number_of_leaves = self::getPlayerSingleRessourceCount($player_id, 2);\n $number_of_factories = self::getPlayerSingleRessourceCount($player_id, 5);\n \n self::notifyPlayer($player_id, 'log', clienttranslate('${You} have ${m} ${leaves} and ${n} ${factories}.'), array('You' => 'You', 'm' => $number_of_leaves, 'leaves' => $leaf, 'n' => $number_of_factories, 'factories' => $factory));\n self::notifyAllPlayersBut($player_id, 'log', clienttranslate('${player_name} has ${m} ${leaves} and ${n} ${factories}.'), array('player_name' => self::getColoredText(self::getPlayerNameFromId($player_id), $player_id), 'm' => $number_of_leaves, 'leaves' => $leaf, 'n' => $number_of_factories, 'factories' => $factory));\n \n if ($nobody_more_leaves_than_factories && $number_of_leaves > $number_of_factories) {\n self::notifyGeneralInfo(clienttranslate('That is more ${leaves} than ${factories}'), array('leaves' => $leaf, 'factories' => $factory));\n $nobody_more_leaves_than_factories = false;\n }\n }\n \n if ($nobody_more_leaves_than_factories) { // \"If no player has more leaves than factories on their board\"\n $teams = array();\n $scores = array();\n foreach ($players as $player_id => $player) {\n $team = self::getPlayerTeam($player_id);\n $score = self::getPlayerScore($player_id);\n if (!array_key_exists($team, $teams)) {\n $teams[$team] = array($player_id);\n $scores[$team] = $score;\n }\n else {\n $teams[$team][] = $player_id;\n $scores[$team] += $score;\n }\n }\n \n $max_score = -1;\n foreach($scores as $team => $score) {\n if ($score > $max_score) {\n $max_score = $score;\n $team_max = $team;\n $tie = false;\n }\n else if ($score == $max_score) {\n $tie = true;\n }\n \n // Display the score (or the combined score for the team)\n if (self::decodeGameType(self::getGameStateValue('game_type')) == 'individual') {\n $player_id = $teams[$team][0];\n if ($score < 2) {\n $message_for_others = clienttranslate('${player_name} has ${n} point.');\n $message_for_player = clienttranslate('${You} have ${n} point.');\n }\n else {\n $message_for_others = clienttranslate('${player_name} has ${n} points.');\n $message_for_player = clienttranslate('${You} have ${n} points.'); \n }\n self::notifyAllPlayersBut($player_id, \"log\", $message_for_others, array(\n 'player_name' => self::getPlayerNameFromId($player_id),\n 'n' => $score\n ));\n \n self::notifyPlayer($player_id, \"log\", $message_for_player, array(\n 'You' => 'You',\n 'n' => $score\n ));\n } \n else { // self::getGameStateValue('game_type') == 'team'\n $current_team = $teams[$team];\n $player_id = $current_team[0];\n $teammate_id = $current_team[1];\n if ($score < 2) {\n $message_for_team = clienttranslate('Your team has ${n} point.');\n $message_for_others = clienttranslate('The other team has ${n} point.');\n }\n else {\n $message_for_team = clienttranslate('Your team has ${n} points.');\n $message_for_others = clienttranslate('The other team has ${n} points.'); \n }\n self::notifyAllPlayersBut($current_team, \"log\", $message_for_others, array('n' => $score));\n \n self::notifyPlayer($player_id, \"log\", $message_for_team, array('n' => $score));\n \n self::notifyPlayer($teammate_id, \"log\",$message_for_team, array('n' => $score)); \n }\n }\n \n if ($tie) {\n self::notifyGeneralInfo(clienttranslate('There is a tie for the greatest score. The game continues.'));\n }\n else {\n $winning_team = $teams[$team_max];\n if (self::decodeGameType(self::getGameStateValue('game_type')) == 'individual') {\n $player_id = $winning_team[0];\n self::notifyAllPlayersBut($player_id, \"log\", clienttranslate('${player_name} has a greater score than each other player.'), array(\n 'player_name' => self::getPlayerNameFromId($player_id)\n ));\n \n self::notifyPlayer($player_id, \"log\", clienttranslate('${You} have a greater score than each other player.'), array(\n 'You' => 'You'\n ));\n }\n else { // self::getGameStateValue('game_type')) == 'team'\n $player_id = $winning_team[0];\n $teammate_id = $winning_team[1];\n self::notifyAllPlayersBut($winning_team, \"log\", clienttranslate('The other team has a greater score than yours.'), array());\n \n self::notifyPlayer($player_id, \"log\", clienttranslate('Your team has a greater score than the other one.'), array());\n \n self::notifyPlayer($teammate_id, \"log\", clienttranslate('Your team has a greater score than the other one.'), array());\n }\n self::setGameStateValue('winner_by_dogma', $player_id); // \"The single player with the most points wins\" (or combined scores for team)\n self::trace('EOG bubbled from self::stPlayerInvolvedTurn Globalization');\n throw new EndOfGame();\n }\n }\n break;\n \n // id 102, age 10: Stem cells\n case \"102N1\":\n if (self::countCardsInLocation($player_id, 'hand') == 0) {\n self::notifyPlayer($player_id, 'log', clienttranslate('${You} have no cards in your hand to score.'), array('You' => 'You'));\n self::notifyAllPlayersBut($player_id, 'log', clienttranslate('${player_name} has no cards in their hand to score.'), array('player_name' => self::getColoredText(self::getPlayerNameFromId($player_id), $player_id)));\n } else {\n $step_max = 1; // --> 1 interaction: see B\n }\n break;\n \n \n // id 103, age 10: A. I.\n case \"103N1\":\n self::executeDraw($player_id, 10, 'score'); // \"Draw and score a 10\"\n break;\n\n case \"103N2\":\n $players = self::loadPlayersBasicInfos();\n $software_found = false;\n foreach ($players as $any_player_id => $player) {\n $top_blue_card = self::getTopCardOnBoard($any_player_id, 0 /* blue: color of Software*/);\n if ($top_blue_card !== null && $top_blue_card['id'] == 96 /* Software */) {\n $software_found = true;\n break;\n }\n }\n \n $robotics_found = false;\n foreach ($players as $any_player_id => $player) {\n $top_red_card = self::getTopCardOnBoard($any_player_id, 1 /* red: color of Robotics*/);\n if ($top_red_card !==null && $top_red_card['id'] == 98 /* Robotics */) {\n $robotics_found = true;\n break;\n }\n }\n \n if ($software_found && $robotics_found) { // \"If Robotics and Software are top cards on any board\"\n self::notifyGeneralInfo(clienttranslate('Robotics and Software are both visible as top cards.'));\n \n $min_score = 9999;\n foreach($players as $any_player_id => $player) {\n $score = self::getPlayerScore($any_player_id);\n if ($score < $min_score) {\n $min_score = $score;\n $player_with_min_score = $any_player_id;\n $tie = false;\n }\n else if ($score == $min_score) {\n $tie = true;\n }\n \n // Display the score (or the combined score for the team)\n if ($score < 2) {\n $message_for_others = clienttranslate('${player_name} has ${n} point.');\n $message_for_player = clienttranslate('${You} have ${n} point.');\n }\n else {\n $message_for_others = clienttranslate('${player_name} has ${n} points.');\n $message_for_player = clienttranslate('${You} have ${n} points.');\n }\n self::notifyAllPlayersBut($any_player_id, \"log\", $message_for_others, array(\n 'player_name' => self::getPlayerNameFromId($any_player_id),\n 'n' => $score\n ));\n \n self::notifyPlayer($any_player_id, \"log\", $message_for_player, array(\n 'You' => 'You',\n 'n' => $score\n ));\n }\n if ($tie) {\n self::notifyGeneralInfo(clienttranslate('There is a tie for the lowest score. The game continues.'));\n }\n else {\n self::notifyAllPlayersBut($player_with_min_score, \"log\", clienttranslate('${player_name} has the lowest score.'), array(\n 'player_name' => self::getPlayerNameFromId($player_with_min_score)\n ));\n \n self::notifyPlayer($player_with_min_score, \"log\", clienttranslate('${You} have the lowest score.'), array(\n 'You' => 'You'\n ));\n self::setGameStateValue('winner_by_dogma', $player_with_min_score); // \"The single player with the most points wins\" (scores are not combined for teams)\n self::trace('EOG bubbled from self::stPlayerInvolvedTurn A. I.');\n throw new EndOfGame();\n }\n }\n break;\n\n // id 104, age 10: The internet.\n case \"104N1\":\n $step_max = 1; // --> 1 interaction: see B\n break;\n\n case \"104N2\":\n self::executeDraw($player_id, 10, 'score'); // \"Draw and score a 10\"\n break;\n\n case \"104N3\":\n $number_of_clocks = self::getPlayerSingleRessourceCount($player_id, 6 /* clock */);\n self::notifyPlayer($player_id, 'log', clienttranslate('${You} have ${n} ${clocks}.'), array('You' => 'You', 'n' => $number_of_clocks, 'clocks' => $clock));\n self::notifyAllPlayersBut($player_id, 'log', clienttranslate('${player_name} has ${n} ${clocks}.'), array('player_name' => self::getColoredText(self::getPlayerNameFromId($player_id), $player_id), 'n' => $number_of_clocks, 'clocks' => $clock));\n for($i=0; $i<self::intDivision($number_of_clocks,2); $i++) { // \"For every two clocks on your board\"\n self::executeDraw($player_id, 10, 'board'); // \"Draw and meld a 10\"\n }\n break;\n \n default:\n // This should not happens\n //throw new BgaVisibleSystemException(self::format(self::_(\"Unreferenced card effect code in section A: '{code}'\"), array('code' => $code)));\n break;\n }\n //[AA]||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||\n }\n catch (EndOfGame $e) {\n // End of the game: the exception has reached the highest level of code\n self::trace('EOG bubbled from self::stPlayerInvolvedTurn');\n self::trace('playerInvolvedTurn->justBeforeGameEnd');\n $this->gamestate->nextState('justBeforeGameEnd');\n return;\n }\n \n if ($step_max === null) {\n // End of the effect for this player\n self::trace('playerInvolvedTurn->interPlayerInvolvedTurn');\n $this->gamestate->nextState('interPlayerInvolvedTurn');\n return;\n }\n // There is an interaction needed\n self::setGameStateValue('step_max', $step_max);\n\n // Prepare the first step\n self::setGameStateValue('step', $step === null ? 1 : $step);\n self::trace('playerInvolvedTurn->interactionStep');\n $this->gamestate->nextState('interactionStep');\n }",
"public function passGo($player){\n $player->collect($this->go_amount);\n }",
"public function testKeepPlayingSurpassLimit()\n {\n $name = \"Computer Harry Potter\";\n $player = new ComputerPlayer($name);\n $player -> addPoints(90);\n $this->assertFalse($player -> keepPlaying(14, 100, 5));\n }",
"public function onEntityDamage(EntityDamageEvent $event) : void{\n\t\t$player = $event->getEntity();\n\t\tif($player instanceof Player && KothTask::getInstance()->isPlaying($player)){\n\t\t\tif(!($event instanceof EntityDamageByEntityEvent) || !(($damager = $event->getDamager()) instanceof Player) || !KothTask::getInstance()->isPlaying($damager)){\n\t\t\t\t$event->setCancelled();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tforeach([$player, $damager] as $target){\n\t\t\t\tif(!KothTask::getInstance()->hasRespawned($target)){\n\t\t\t\t\t$event->setCancelled();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif($event->getFinalDamage() >= $player->getHealth()){\n\t\t\t\t$event->setCancelled();\n\t\t\t\t$fp = $this->plugin->getPlugin(\"FactionsPro\");\n\t\t\t\tforeach([$damager, $player] as $check){\n\t\t\t\t\tif(!$fp->isInFaction($check->getName())){\n\t\t\t\t\t\tKothTask::getInstance()->removePlayer($check, \"no longer in faction\");\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t$damagerFac = $fp->getPlayerFaction($damager->getName());\n\t\t\t\t$playerFac = $fp->getPlayerFaction($player->getName());\n\t\t\t\t\n\t\t\t\t$damagerStr = $fp->getFactionPower($damagerFac);\n\t\t\t\t$playerStr = $fp->getFactionPower($playerFac);\n\t\t\t\n\t\t\t\t$robAmount = 50;\n\t\t\t\t$robAmount += $playerStr / 100;\n\t\t\t\t$robAmount = (int) ceil($robAmount);\n\t\t\t\t\n\t\t\t\tif(!($fp->transferPower($playerFac, $damagerFac, $robAmount) < $robAmount)){\n\t\t\t\t\tself::$leaderboard[$playerFac][1] += $robAmount;\n\t\t\t\t self::$leaderboard[$damagerFac][0] += $robAmount;\n\t\t\t\t \n\t\t\t\t\tKothTask::getInstance()->respawn($player);\n\t\t\t\t\tKothTask::getInstance()->broadcastInGame(\"koth-kill\", $player->getName(), $playerFac, $playerStr - $robAmount, $damager->getName(), $damagerFac, $damagerStr + $robAmount);\n\t\t\t\t}else{ //The rob amount was not transferred 100 %\n\t\t\t\t $eliminated = 0;\n\t\t\t\t\tforeach(KothTask::getInstance()->getPlayers() as $p){\n\t\t\t\t\t\tif($fp->getPlayerFaction($p->getName()) === $playerFac){\n\t\t\t\t\t\t\tKothTask::getInstance()->removePlayer($p, \"eliminated\");\n\t\t\t\t\t\t\t$eliminated++;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tKothTask::getInstance()->broadcastInGame(\"koth-faceliminated\", $playerFac, $eliminated);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}",
"function stInterPlayerInvolvedTurn() {\n while(true) {\n $nested_id_1 = self::getGameStateValue('nested_id_1');\n if ($nested_id_1 == -1) { // No or no more card in the execution stack\n // Resume normal situation\n self::trace('Out of nesting');\n break;\n }\n \n $card = self::getCardInfo($nested_id_1);\n $current_effect_number = self::getGameStateValue('nested_current_effect_number_1') + 1; // Next effect\n \n if ($current_effect_number > 3 || $card['non_demand_effect_'.$current_effect_number] === null) {\n // No card has more than 3 non-demand dogma => there is no more effect\n // or the next non-demand-dogma effect is not defined\n self::notifyGeneralInfo(clienttranslate(\"Card execution within dogma completed.\"));\n self::popCardFromNestedDogmaStack();\n }\n else { // There is at least one effect the player can perform\n self::setGameStateValue('nested_current_effect_number_1', $current_effect_number);\n // Continuation of exclusive execution\n self::trace('interPlayerInvolvedTurn->playerInvolvedTurn');\n $this->gamestate->nextState('playerInvolvedTurn');\n return;\n }\n }\n \n // Code executed when there is no exclusive execution to handle, or when it's over\n \n // A player has executed an effect of a dogma card (or passed). Is there another player on which the effect can apply?\n $player_id = self::getGameStateValue('current_player_under_dogma_effect');\n $current_effect_type = self::getGameStateValue('current_effect_type');\n $next_player = self::getNextPlayerUnderEffect($current_effect_type, $player_id);\n if ($next_player === null) {\n // There is no more player eligible for this effect\n // End of the dogma effect\n self::trace('interPlayerInvolvedTurn->interDogmaEffect');\n $this->gamestate->nextState('interDogmaEffect');\n return;\n }\n // There is another player on which the effect can apply\n self::setGameStateValue('current_player_under_dogma_effect', $next_player);\n $this->gamestate->changeActivePlayer($next_player);\n \n // Jump to this player\n self::trace('interPlayerInvolvedTurn->playerInvolvedTurn');\n $this->gamestate->nextState('playerInvolvedTurn');\n }",
"function scrapbots_fight ($duellers){\n\tdebug(\"Now duelling two ScrapBots\");\n\tdebug($army);\n\n\treturn $fighter;\n}",
"function spar() {\r\n\tglobal $system;\r\n\r\n\tglobal $player;\r\n\r\n\tglobal $self_link;\r\n\r\n\tif($player->battle_id) {\r\n\t\ttry {\r\n $battle = new Battle($system, $player, $player->battle_id);\r\n\r\n $battle->checkTurn();\r\n\r\n $battle->renderBattle();\r\n\r\n if($battle->isComplete()) {\r\n echo \"<table class='table'><tr><th>Battle complete</th></tr>\r\n\t\t\t <tr><td style='text-align:center;'>\";\r\n if($battle->isPlayerWinner()) {\r\n echo \"You win!<br />\";\r\n }\r\n else if($battle->isOpponentWinner()) {\r\n echo \"You lose.<br />\";\r\n $player->health = 5;\r\n }\r\n else if($battle->isDraw()) {\r\n echo \"You both knocked each other out.<br />\";\r\n $player->health = 5;\r\n }\r\n echo \"</td></tr></table>\";\r\n\r\n $player->battle_id = 0;\r\n }\r\n }\r\n catch (Exception $e) {\r\n $system->printMessage($e->getMessage());\r\n $player->battle_id = 0;\r\n return false;\r\n }\r\n\t}\r\n\telse if(isset($_GET['challenge'])) {\r\n\t\ttry {\r\n\t\t\t$challenge = (int)$system->clean($_GET['challenge']);\r\n\t\t\t$result = $system->query(\"SELECT `user_id`, `user_name`, `village`, `location`, `challenge`, `battle_id`, `last_active`\r\n\t\t\t\tFROM `users` WHERE `user_id`='$challenge' LIMIT 1\");\r\n\t\t\tif($system->db_last_num_rows == 0) {\r\n\t\t\t\tthrow new Exception(\"Invalid user!\");\r\n\t\t\t}\r\n\t\t\t$user = $system->db_fetch($result);\r\n\t\t\t\r\n\t\t\t/*\r\n\t\t\tif($user['village'] != $player->village) {\r\n\t\t\t\tthrow new Exception(\"You cannot spar ninja from enemy villages!\");\r\n\t\t\t}\r\n\t\t\t*/\r\n\t\t\t\r\n\t\t\tif($user['location'] != $player->location) {\r\n\t\t\t\tthrow new Exception(\"Target is not at your location!\");\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tif($user['challenge']) {\r\n\t\t\t\tthrow new Exception(\"Target has already been challenged!\");\r\n\t\t\t}\r\n\t\t\t\t\r\n\t\t\tif($user['battle_id']) {\r\n\t\t\t\tthrow new Exception(\"Target is in battle!\");\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tif($user['last_active'] < time() - 120) {\r\n\t\t\t\tthrow new Exception(\"Target is inactive/offline!\");\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t$system->query(\"UPDATE `users` SET `challenge`='$player->user_id' WHERE `user_id`='$challenge' LIMIT 1\");\r\n\t\t\t$system->message(\"Challenge sent!\");\r\n\t\t\t$system->printMessage();\r\n\t\t} catch (Exception $e) {\r\n\t\t\t$system->message($e->getMessage());\r\n\t\t\t$system->printMessage();\r\n\t\t\trequire(\"scoutArea.php\");\r\n\t\t\tscoutArea();\r\n\t\t}\r\n\t}\r\n\telse if(isset($_GET['accept_challenge'])) {\r\n\t\ttry {\r\n\t\t\t$challenge = (int)$system->clean($_GET['accept_challenge']);\r\n\t\t\t\r\n\t\t\tif($challenge != $player->challenge) {\r\n\t\t\t\tthrow new Exception(\"Invalid challenge!\");\r\n\t\t\t}\r\n\r\n try {\r\n $user = new User($challenge);\r\n $user->loadData(User::UPDATE_NOTHING, true);\r\n } catch(Exception $e) {\r\n throw new Exception(\"Invalid user! \" . $e->getMessage());\r\n }\r\n\t\t\t\r\n\t\t\tif($user->location != $player->location) {\r\n\t\t\t\tthrow new Exception(\"Target is not at your location!\");\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tif($user->battle_id) {\r\n\t\t\t\tthrow new Exception(\"User is in battle!\");\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tif($user->last_active < time() - 120) {\r\n\t\t\t\tthrow new Exception(\"Target is inactive/offline!\");\r\n\t\t\t}\r\n\r\n $player->challenge = 0;\r\n Battle::start($system, $player, $user, Battle::TYPE_SPAR);\r\n\r\n\t\t\t$system->message(\"You have accepted the challenge!<br />\r\n\t\t\t\t<a class='link' href='$self_link'>To Battle</a>\");\r\n\t\t\t$system->printMessage();\r\n\t\t} catch (Exception $e) {\r\n\t\t\t$player->challenge = 0;\r\n\t\t\t\r\n\t\t\t$system->message($e->getMessage());\r\n\t\t\t$system->printMessage();\r\n\t\t\trequire(\"scoutArea.php\");\r\n\t\t\tscoutArea();\r\n\t\t}\r\n\t}\r\n\telse if(isset($_GET['decline_challenge'])) {\r\n\t\t$player->challenge = 0;\r\n\t\t$system->message(\"Challenge declined.\");\r\n\t\t$system->printMessage();\r\n\t\t\r\n\t\trequire(\"scoutArea.php\");\r\n\t\tscoutArea();\r\n\t}\r\n\telse if(isset($_GET['cancel_challenge'])) {\r\n\t\t$challenge = $system->clean($_GET['cancel_challenge']);\r\n\t\t// Load user challenges sent\r\n\t\t$result = $system->query(\"UPDATE `users` SET `challenge`=0 WHERE `user_id`='$challenge' AND `challenge`='$player->user_id' LIMIT 1\");\r\n\t\t$system->message(\"Challenge cancelled!\");\r\n\t\t$system->printMessage();\r\n\t\t\t\r\n\t\trequire(\"scoutArea.php\");\r\n\t\tscoutArea();\r\n\t}\r\n\telse {\r\n\t\t// Load user challenges sent\r\n\t\t$result = $system->query(\"SELECT `user_id`, `user_name` FROM `users` WHERE `challenge`='$player->user_id'\");\r\n\t\tif($system->db_last_num_rows > 0) {\r\n\t\t\t$user_challenges = array();\r\n\t\t\twhile($row = $system->db_fetch($result)) {\r\n\t\t\t\t$user_challenges[$row['user_id']] = $row['user_name'];\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\tif($player->challenge or isset($user_challenges)) {\r\n\t\t\techo \"<table class='table'><tr><th>Challenges</th></tr>\";\r\n\t\t\t\t\r\n\t\t\t// Challenge received\r\n\t\t\tif($player->challenge) {\r\n\t\t\t\t$result = $system->query(\"SELECT `user_name` FROM `users` WHERE `user_id`='$player->challenge' LIMIT 1\");\r\n\t\t\t\tif($system->db_last_num_rows == 0) {\r\n\t\t\t\t\t$player->challenge = 0;\r\n\t\t\t\t}\r\n\t\t\t\telse {\r\n\t\t\t\t\t$challenger_data = $system->db_fetch($result);\r\n\t\t\t\t\t\r\n\t\t\t\t\techo \"<tr><td>\r\n\t\t\t\t\t<p style='display:inline-block;margin:0px;margin-left:20px;'>\r\n\t\t\t\t\t\tChallenged by <span style='font-weight:bold;'>\" . $challenger_data['user_name'] . \"</span></p>\r\n\t\t\t\t\t<p style='display:inline-block;margin:0px;margin-right:40px;float:right;'>\r\n\t\t\t\t\t\t<a href='$self_link&accept_challenge=$player->challenge'>Accept</a> | \r\n\t\t\t\t\t\t<a href='$self_link&decline_challenge=$player->challenge'>Decline</a>\r\n\t\t\t\t\t</p></td></tr>\";\r\n\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif($user_challenges) {\r\n\t\t\t\tforeach($user_challenges as $id=>$name) {\r\n\t\t\t\t\techo \"<tr><td>\r\n\t\t\t\t\t<p style='display:inline-block;margin:0px;margin-left:20px;'>\r\n\t\t\t\t\t\tChallenge sent to <span style='font-weight:bold;'>\" . $name . \"</span></p>\r\n\t\t\t\t\t<p style='display:inline-block;margin:0px;margin-right:40px;float:right;'>\r\n\t\t\t\t\t\t<a href='$self_link&cancel_challenge=$id'>Cancel</a></p>\r\n\t\t\t\t\t</td></tr>\";\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\techo \"</table>\";\r\n\t\t}\r\n\t\t\r\n\t\trequire(\"scoutArea.php\");\r\n\t\tscoutArea();\r\n\t}\r\n\t\r\n\treturn true;\r\n}",
"function zg_ai_find_players_to_debate($bot, $num = 99) {\n global $game;\n include drupal_get_path('module', 'zg') . '/includes/' . $game . '_defs.inc';\n $num = min($num, $bot->actions);\n\n // $debate_wait_time = 1200;\n // $zombie_debate_wait = 300;\n $sql = 'SELECT users.id, users.username, users.meta\n FROM users\n LEFT OUTER JOIN clan_members ON clan_members.fkey_users_id = users.id\n LEFT OUTER JOIN clans ON clan_members.fkey_clans_id = clans.id\n WHERE users.id <> %d\n AND (clans.id <> %d OR clans.id IS NULL OR users.meta = \"zombie\")\n AND username <> \"\"\n AND (debates_last_time < \"%s\" OR\n (users.meta = \"zombie\" AND debates_last_time < \"%s\"))\n AND users.meta NOT like \"ai_%\"\n AND users.level > %d\n AND users.level < %d\n ORDER BY abs(users.experience - %d) ASC\n LIMIT %d;';\n\n $result = db_query($sql, $bot->id, $bot->fkey_clans_id,\n date('Y-m-d H:i:s', REQUEST_TIME - $debate_time),\n date('Y-m-d H:i:s', REQUEST_TIME - $zombie_debate_wait),\n $bot->level - 15, $bot->level + 15, $bot->experience, $num);\n $data = [];\n while ($item = db_fetch_object($result)) {\n $data[] = $item;\n }\n return zg_ai_data_type($data);\n}",
"public function test_character_can_don_one_shield()\n {\n // If he could hold 2 shields, his AC would change after picking up the 2nd one.\n $this->character->use(new Shield());\n $first_shield_ac = $this->character->getAc();\n $this->character->use(new Shield());\n $this->assertEquals($first_shield_ac, $this->character->getAc());\n }",
"function stInterPlayerTurn() {\n \n // Give him extra time for his actions to come\n self::giveExtraTime(self::getActivePlayerId());\n \n // Does he plays again?\n if (self::getGameStateValue('first_player_with_only_one_action')) {\n // First turn: the player had only one action to make\n $next_player = true;\n self::setGameStateValue('first_player_with_only_one_action', 0);\n }\n else if (self::getGameStateValue('second_player_with_only_one_action')) {\n // 4 players at least and this is the second turn: the player had only one action to make\n $next_player = true;\n self::setGameStateValue('second_player_with_only_one_action', 0);\n }\n else if (self::getGameStateValue('has_second_action')) {\n // The player took his first action and has another one\n $next_player = false;\n self::setGameStateValue('has_second_action', 0);\n }\n else {\n // The player took his second action\n $next_player = true;\n self::setGameStateValue('has_second_action', 1);\n }\n if ($next_player) { // The turn for the current player is over\n // Reset the flags for Monument special achievement\n self::resetFlagsForMonument();\n \n // Activate the next player in turn\n $this->activeNextPlayer();\n $player_id = self::getActivePlayerId();\n self::setGameStateValue('active_player', $player_id);\n }\n self::notifyGeneralInfo('<!--empty-->');\n self::trace('interPlayerTurn->playerTurn');\n $this->gamestate->nextState();\n }",
"protected function handleSuccessPlayer($player, $cash)\n\t{\n\t\t$rank = \\Kofradia\\Game\\Rank\\Points::getRank($player['up_points']);\n\t\t$affect = $this->ut->getAffectedTable($rank);\n\n\t\t// can not have too little energy\n\t\tif ($player['up_energy'] < $affect['energy']*2)\n\t\t{\n\t\t\treturn;\n\t\t}\n\n\t\t// now take money\n\t\t$a = \\Kofradia\\DB::get()->prepare(\"\n\t\t\tUPDATE users_players\n\t\t\tSET up_bank = IF(up_cash < ?, up_bank - ?, up_bank),\n\t\t\t\tup_cash = IF(up_cash >= ?, up_cash - ?, up_cash)\n\t\t\tWHERE up_id = ? AND (up_cash >= ? OR up_bank >= ?)\");\n\t\tif (!$a->execute(array($cash, $cash, $cash, $cash, $player['up_id'], $cash, $cash)))\n\t\t{\n\t\t\t// did not succeed\n\t\t\treturn;\n\t\t}\n\n\t\t$this->result->up = \\player::get($player['up_id']);\n\t\t$this->result->cashLost = $cash;\n\t\t$this->result->fromBank = $this->result->up->data['up_cash'] < $cash; // TODO: this cannot be checked this way?\n\n\t\t// notify victim\n\t\t$this->result->up->add_log(\"utpressing\", $this->ut->up->id, $cash);\n\n\t\t// log\n\t\tputlog(\"SPAMLOG\", \"%c11%bUTPRESSING:%b%c %u{$this->ut->up->data['up_name']}%u presset %u{$this->result->up->data['up_name']}%u for %u\".\\game::format_cash($cash).\"%u\".($this->result->fromBank ? ' (fra bankkonto)' : ''));\n\t\t\\Kofradia\\DB::get()->prepare(\"\n\t\t\tINSERT INTO utpressinger\n\t\t\tSET\n\t\t\t\tut_action_up_id = ?,\n\t\t\t\tut_affected_up_id = ?,\n\t\t\t\tut_b_id = ?,\n\t\t\t\tut_time = ?\")\n\t\t\t->execute(array(\n\t\t\t\t$this->ut->up->id,\n\t\t\t\t$this->result->up->id,\n\t\t\t\t$this->ut->up->data['up_b_id'],\n\t\t\t\ttime()));\n\n\t\t// the victim always looses energy\n\t\t// but only health if the money comes from the hand\n\t\t// (don't really know why we made it this way)\n\t\t$this->result->up->energy_use($affect['energy']);\n\t\tif (!$this->result->fromBank)\n\t\t{\n\t\t\t$this->result->attack = $this->result->up->health_decrease($affect['health'], $this->ut->up, \\player::ATTACK_TYPE_UTPRESSING);\n\t\t}\n\n\t\treturn true;\n\t}",
"abstract protected function putPlayersInDuel(): void;",
"private function passTime()\n {\n // guys in bathroom lose pee equal to peeSpeed\n // guys at bar gain pee equal to drinkSpeed\n // guys in bathroom with pee == 0 return to bar\n }",
"public static function ability_function_repeat_attack($objects, $options = array()){\n\n\n }",
"abstract public function find_attack($game, $includeOptional = TRUE);",
"public function onRoundEnd(){\n foreach($this->players as $player){\n $player->teleport($player->getSpawn());\n $player->sendMessage(OneVsOne::getMessage(\"duel_timeover\"));\n $player->removeAllEffects();\n $player->getArmorInventory()->clearAll();\n $player->getInventory()->clearAll();\n }\n\n // Reset arena\n $this->reset();\n }",
"public function startDuel(){\n $this->plugin->getScheduler()->cancelTask($this->countdownTaskHandler->getTaskId());\n\n /** @var Player $player1 */\n $player1 = $this->players[0];\n /** @var Player $player2 */\n $player2 = $this->players[1];\n var_dump($this->spawn1);\n var_dump($this->spawn2);\n $player1->teleport($this->spawn1);\n $player2->teleport($this->spawn2);\n $this->sparyParticle($player1);\n $this->sparyParticle($player2);\n $player1->setGamemode(0);\n $player2->setGamemode(0);\n\n // Give kit\n if(OneVsOne::getInstance()->getConfig()->get(\"force-kit\") === true){\n foreach($this->players as $player){\n $this->giveKit($player);\n }\n }\n // Fix start time\n $this->startTime = new DateTime('now');\n\n $player1->sendTip(OneVsOne::getMessage(\"duel_tip\"));\n $player1->sendMessage(str_replace(\"{roundtime}\", OneVsOne::getInstance()->getConfig()->get(\"time-limit\"), OneVsOne::getMessage(\"duel_start\")));\n\n $player2->sendTip(OneVsOne::getMessage(\"duel_tip\"));\n $player2->sendMessage(str_replace(\"{roundtime}\", OneVsOne::getInstance()->getConfig()->get(\"time-limit\"), OneVsOne::getMessage(\"duel_start\")));\n }",
"function scrapbots_battle($defenderid){\n\tglobal $session;\n\t$attackerid = $session['user']['acctid'];\n\t$armies = scrapbots_get_armies($defenderid, $attackerid);\n\t$duellers = scrapbots_pair_up_scrapbots ($armies);\n\treturn;\n}"
] |
[
"0.6251769",
"0.6052258",
"0.5930214",
"0.5886639",
"0.5868937",
"0.58396673",
"0.5839442",
"0.57324195",
"0.5594672",
"0.55794626",
"0.5450638",
"0.53997314",
"0.5392951",
"0.53715223",
"0.5363962",
"0.532071",
"0.5320397",
"0.52829534",
"0.5266027",
"0.5245245",
"0.5212376",
"0.51872915",
"0.5167903",
"0.5158455",
"0.5149245",
"0.51466256",
"0.51427823",
"0.51417506",
"0.5131765",
"0.5119118"
] |
0.6631529
|
0
|
return all fields in tl_module
|
public function getModuleFields()
{
return $this->getOptionData('tl_module');
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function getAllFields();",
"public function getFields();",
"public function getFields();",
"public function getFields();",
"public function getFields();",
"public function getFields();",
"public function getFields();",
"public function getFields() {}",
"public function getFields() {}",
"public function getFields() {}",
"public function getListFields();",
"function getFields();",
"public function fields();",
"public function fields();",
"public function fields();",
"public function fields();",
"public function fields();",
"public static function get_fields()\n {\n }",
"public function getAllFields()\n {\n return $this->fields;\n }",
"abstract public function getFields();",
"abstract public function getFields();",
"public function &getFields();",
"public function getFieldsList(){\n return $this->_get(1);\n }",
"abstract protected function getFields();",
"function get_fields( ) {\n\t\treturn $this->fields_list;\n\t\t}",
"function GetFieldsList()\n\t{\n\t\tglobal $dal_info;\n\t\treturn array_keys( $dal_info[ $this->infoKey ] );\n\t}",
"final public function getAllFields()\r\n {\r\n return array($this->_field);\r\n }",
"function get_fields() {\n global $Tainacan_Item_Metadata;\n return $Tainacan_Item_Metadata->fetch($this, 'OBJECT');\n\n }",
"private function _fields() {\n if ($this->_table() && empty($this->fields)) {\n $this->fields = $this->db->list_fields($this->_table());\n }\n return $this->fields;\n }",
"public static function getFields(){\n\t\treturn self::$fields;\n\t}"
] |
[
"0.78327423",
"0.7811271",
"0.7811271",
"0.7811271",
"0.7811271",
"0.7811271",
"0.7811271",
"0.77162254",
"0.77162254",
"0.77162254",
"0.7681421",
"0.76534146",
"0.76266927",
"0.76266927",
"0.76266927",
"0.76266927",
"0.76266927",
"0.76114756",
"0.75878096",
"0.7536246",
"0.7536246",
"0.75180405",
"0.7507466",
"0.748084",
"0.74134076",
"0.7401993",
"0.7394235",
"0.7386117",
"0.7352157",
"0.73189044"
] |
0.8013034
|
0
|
si el atributo tiene varios errores, los pone todos juntos en un solo mensaje
|
public static function unificarErrores($model,$atributo){
$separa=' -- ';
if ($model->hasErrors($atributo)){
$errores = $model->getErrors($atributo);
$cant = count($errores);
if ($cant>1){
$mensaje='';
foreach ($errores as $i=>$mensajeError) {
$mensaje.=$mensajeError.
(($i+1==$cant)?'':$separa); //separador
}
$model->clearErrors($atributo);
$model->addError($atributo,$mensaje);
}
return $model;
}
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function limpiarError(){\n\t\t$this->mensaje_error = null;\n\t}",
"function affichageErreur()\n\t{\n\t}",
"final private function errors(bool $edit = false) {\n global $http;\n\n $this->nombre = $http->request->get('nombre');\n $this->lugar = $http->request->get('lugar');\n $this->rif = $http->request->get('rif');\n $this->telefono = $http->request->get('telefono');\n $this->costo = $http->request->get('costo');\n $this->encargado = $http->request->get('encargado');\n\n if($this->functions->e($this->nombre,$this->lugar,$this->rif,$this->telefono,$this->costo,$this->encargado)){\n throw new ModelsException(\"Todos los campos son obligatorios\");\n };\n\n # throw new ModelsException('¡Esto es un error!');\n }",
"private function setError($proyectos,$filtro){\n if(empty($proyectos) && isset($filtro) ){\n $this->view->error=\"No se hallaron coincidencias\";\n }\n return ;\n }",
"protected function insereErradas() {\n date_default_timezone_set('America/Sao_Paulo');\n $datahora = date(\"Y-m-d H:i:s\");\n $create = new Create;\n $Dados = array(\"datahora\" => $datahora, \"flag\" => $this->resposta, \"usuario_id\" => $this->userid,);\n $create->IniCreate(\"erradas\", $Dados);\n if ($create->getResult()):\n return 0; // Cadastrado errada e retorna flag Incorreta\n endif;\n }",
"function errores($error) {\n switch ($error) {\n case 1: return \"Nombre de usuario no ingresado\"; break;\n case 2: return \"Password de usuario no ingresado\"; break;\n\tcase 3: return \"Email de usuario no ingresado\"; break;\n\tcase 4: return \"Es obligatorio poner el nombre del permiso\"; break;\n\tcase 5: return \"Es obligatorio seleccionar un tipo de permiso\"; break;\n\tcase 6: return \"Es obligatorio poner la ubicación del archivo\"; break;\n\tcase 7: return \"Usuario en uso\"; break;\n\tcase 8: return \"Es obligatorio completar el nombre real del usuario\"; break;\n\tcase 9: return \"Es obligatorio completar el tipo de usuario\"; break;\n\tcase 10: return \"Email en uso\"; break;\n\tcase 11: return \"La contraseña no coincide\"; break;\n\tcase 12: return \"Nombre de empresa en uso\"; break;\n\tcase 13: return \"Nombre de la empresa no ingresado\"; break;\n\tcase 14: return \"Abreviatura de la empresa no ingresada\"; break;\n\tcase 15: return \"Email de la empresa no ingresado\"; break;\n\tcase 16: return \"Rut de la empresa no ingresado\"; break;\n\tcase 17: return \"No ha ingresado la cantidad de niveles\"; break;\n\tcase 18: return \"No ha ingresado el nombre del nivel\"; break;\n\tcase 19: return \"No ha seleccionado una empresa\"; break;\n\tcase 20: return \"No ha ingresado el RUT de la persona\"; break;\n\tcase 21: return \"No ha ingresado el nombre de la comuna\"; break;\n\tcase 22: return \"No ha ingresado la direccion\"; break;\n\tcase 23: return \"No ha seleccionado el nivel\"; break;\n\tcase 24: return \"No ha ingresado una categoria\"; break;\n\tcase 25: return \"No ha ingresado una subcategoria\"; break;\n\tcase 26: return \"No ha seleccionado una categoria\"; break;\n\tcase 27: return \"No ha ingresado un nombre para el item\"; break;\n\tcase 28: return \"No ha ingresado una unidad de medida\"; break;\n\tcase 29: return \"No ha ingresado un valor para la unidad de medida\"; break;\n\tcase 30: return \"No ha ingresado un valor unitario\"; break;\n\tcase 31: return \"No ha ingresado un nombre del trabajador\"; break;\n\tcase 32: return \"No ha ingresado un telefono del trabajador\"; break;\n\tcase 33: return \"No ha ingresado una direccion del trabajador\"; break;\n\tcase 34: return \"No ha ingresado un cargo del trabajador\"; break;\n\tcase 35: return \"No ha seleccionado un trabajo a realizar\"; break;\n\tcase 36: return \"No ha ingresado una fecha de ejecucion\"; break;\n\tcase 37: return \"No ha ingresado un numero de documento\"; break;\n\tcase 38: return \"No ha seleccionado un trabajador\"; break;\n\tcase 39: return \"Es obligatorio completar el nombre del tipo de producto\"; break;\n\tcase 40: return \"Es obligatorio completar el tipo de embalaje usado\"; break;\n\tcase 41: return \"Es obligatorio completar el nombre del tipo de producto\"; break;\n\tcase 42: return \"Es obligatorio completar el nombre de la Unidad de Medida\"; break;\n\tcase 43: return \"Es obligatorio completar el nombre del Artículo\"; break;\n\tcase 44: return \"Es obligatorio seleccionar el tipo de Artículo\"; break;\n\tcase 45: return \"Es obligatorio seleccionar la categoría del Artículo\"; break;\n\tcase 46: return \"Es obligatorio seleccionar la unidad de medida del Artículo\"; break;\n\tcase 47: return \"Es obligatorio completar la capacidad del Artículo\"; break;\n\tcase 48: return \"Es obligatorio seleccionar el embalaje del Artículo\"; break;\n\tcase 49: return \"Es obligatorio completar la marca del Artículo\"; break;\n\tcase 50: return \"Es obligatorio seleccionar el Articulo\"; break;\n\tcase 51: return \"Es obligatorio poner la cantidad de Articulos\"; break;\n\tcase 52: return \"Es obligatorio ingresar el valor de cada articulo\"; break;\n\tcase 53: return \"Es obligatorio poner la procedencia de los Articulos\"; break;\n\tcase 54: return \"Es obligatorio poner el tipo de documento utilizado\"; break;\n\tcase 55: return \"Es obligatorio poner el numero del documento utilizado\"; break;\n\tcase 56: return \"Es obligatorio poner un comentario\"; break;\n\tcase 57: return \"Es obligatorio seleccionar el tipo de cliente\"; break;\n\tcase 58: return \"Es obligatorio seleccionar el cliente\"; break;\n\tcase 59: return \"Ingrese una fecha de inicio\"; break;\n\tcase 60: return \"Ingrese una fecha de termino\"; break;\n\tcase 61: return \"No ha seleccionado un permiso\"; break;\n\tcase 62: return \"No ha seleccionado un Trabajo\"; break;\n\tcase 63: return \"No ha ingresado un nombre\"; break;\n\tcase 64: return \"No ha seleccionado una frecuencia\"; break;\n\tcase 65: return \"No ha seleccionado una ubicacion\"; break;\n\tcase 66: return \"No ha seleccionado una tarea\"; break;\n\tcase 67: return \"No ha ingresado el tiempo utilizado\"; break;\n\tcase 68: return \"Es obligatorio completar la contraseña\"; break;\n\tcase 69: return \"Es obligatorio completar la contraseña nueva\"; break;\n\tcase 70: return \"La contraseña no coincide\"; break;\n\tcase 71: return \"No ha ingresado la fecha de inicio\"; break;\n\tcase 72: return \"No ha ingresado la fecha de termino\"; break;\n\tcase 73: return \"No ha ingresado un valor al costo no considerado\"; break;\n\tcase 74: return \"No ha ingresado un comentario al costo no considerado\"; break;\n\tcase 75: return \"No ha seleccionado una unidad de frecuencia\"; break;\n\tcase 76: return \"No ha ingresado un valor para la frecuencia\"; break;\n\tcase 77: return \"No ha ingresado un nombre a la categoria\"; break;\n\tcase 78: return \"No ha seleccionado una unidad de frecuencia\"; break;\n\tcase 79: return \"Debe ingresar un monto a la valorizacion\"; break;\n\tcase 80: return \"Debe ingresar un monto a los gastos generales\"; break;\n\tcase 81: return \"No ha seleccionado la cantidad de periodos\"; break;\n\t\n }\n}",
"function mostrandoErrores($data){\n\t$alerta = '';\n\n\tforeach ($data as $key => $value) {\n\t\tif ($key != 'insert_post') {\n\t\t\t$alerta = '<div class=\"error\"><p>'.ucfirst($data[$key]).'</p></div>';\n\t\t}else{\n\t\t\t$alerta = '<div class=\"success\"><p>'.ucfirst($data[$key]).'</p></div>';\n\t\t}\n\t}\n\n\treturn $alerta;\n}",
"public function getErrores() {\n return $this->errores;\n }",
"final private function errors(bool $edit = false) {\n global $http;\n\n $this->nombre = $http->request->get('nombre');\n $this->apellido = $http->request->get('apellido');\n $this->sexo = $http->request->get('sexo');\n $this->fecha_nac = $http->request->get('fecha_nac');\n $this->cedula_repre = $http->request->get('cedula');\n $this->cedula_repre2 = $http->request->get('cedula2');\n $this->enfermedades = $http->request->get('enfermedades');\n $this->juegos = $http->request->get('juegos');\n $this->medicinas = $http->request->get('medicinas');\n $this->alergias = $http->request->get('alergias');\n $this->autorizado = $http->request->get('autorizados');\n\n if($this->functions->e($this->nombre)){\n throw new ModelsException('El campo nombre es obligatorio');\n }\n if($this->functions->e($this->apellido)){\n throw new ModelsException('El campo apellido es obligatorio');\n }\n if($this->functions->e($this->sexo)){\n throw new ModelsException('El campo sexo es obligatorio');\n }\n\n if($this->functions->e($this->fecha_nac)){\n throw new ModelsException('Por favor seleccione una fecha de nacimiento');\n }\n\n if($this->functions->e($this->cedula_repre) && ($edit === false)){\n throw new ModelsException('Por favor introduzca la cedula del representante');\n }\n\n }",
"function gerarMensagensErro($postArray) {\n \n global $mensagem_erro;\n verificaCamposVazios();\n \n $pratoPrincipal = $postArray['prato_principal'];\n $acompanhamento = $postArray['acompanhamento'] = ( isset($_POST['acompanhamento']) ) ? $_POST['acompanhamento'] : null;\n $confirmaTermos = $postArray['confirmar'] = ( isset($_POST['confirmar']) ) ? $_POST['confirmar'] : null;\n $nome = $postArray['nome'];\n $entrega = $postArray['entrega'];\n $fone = $postArray['telefone'];\n\n //preechimento dos erros\n $retornoValidaPratoPrincipal = pratoPrincipal($pratoPrincipal);\n $retornoValidaAcompanhamento = validaAcompanhamento($acompanhamento);\n $retornoValidaConfirmar = validaConfirmar($confirmaTermos);\n $retornoNome = validaNome($nome);\n $retornoEntrega = validaEntrega($entrega);\n $retornoFone = validaFone($fone);\n\n\n $mensagem_erro['ErrosList'] = array(\n 'ERROR_00' => $retornoValidaPratoPrincipal,\n 'ERROR_01' => $retornoValidaAcompanhamento,\n 'ERROR_02' => $retornoValidaConfirmar,\n 'ERROR_03' => $retornoNome,\n 'ERROR_04' => $retornoEntrega,\n 'ERROR_05' => $retornoFone\n );\n \n $mensagem_erro['NotErroList'] = array(\n 'GERAR_COMANDA' => \"Gerar comanda de pedidos\",\n );\n \n return $mensagem_erro['ErrosList'];\n}",
"public function message()\n {\n return 'Errores en plantilla<li>'.join('</li><li>',$this->invalid);\n }",
"function comprobarErroresSopa($datos)\n\t\t{\n\n\t\tif (empty($datos[\"filas\"])) {\n\t\t\treturn \"Nº de filas erróneo\";\n\t\t}\n\n\t\tif (empty($datos[\"columnas\"]))\n\t\t{\n\t\t\treturn \"Nº de columnas erróneo\";\n\t\t}\n\n\t\tif (empty($datos[\"palabras\"]))\n\t\t{\n\t\t\treturn \"Debes introducir alguna palabra\";\n\t\t}\n\n\t\treturn \"OK\";\n\t}",
"private function devolverError($id){\n\t\t//array de errores\n\t\t$errores = array(\n\t\t\tarray('estado' => \"error\", \"msg\" => \"Petición no encontrada\"),\n\t\t\tarray('estado' => \"error\", \"msg\" => \"Petición no aceptada\"),\n\t\t\tarray('estado' => \"error\", \"msg\" => \"Petición sin contenido\"),\n\t\t\tarray('estado' => \"error\", \"msg\" => \"Email o password incorrectos\"),\n\t\t\tarray('estado' => \"error\", \"msg\" => \"Error borrando usuarios\"),\n\t\t\tarray('estado' => \"error\", \"msg\" => \"Error actualizando nombre de usuario\"),\n\t\t\tarray('estado' => \"error\", \"msg\" => \"error buscando usuario por email\"),\n\t\t\tarray('estado' => \"error\", \"msg\" => \"Error creando usuario\"),\n\t\t\tarray('estado' => \"error\", \"msg\" => \"Usuario ya existe\")\n\t\t\t);\n\t\treturn $errores[$id];\n\t}",
"public function validaDatos(){\n\t\t\t\t\n\t\t\t\tif( $this->nombre == \"\" ){\n\t\t\t\t\t\t$this->errores.= \"<strong>* Ingrese su nombre por favor.</strong><br />\";\n\t\t\t\t\t}else if( strlen($this->nombre) > 20 ){\n\t\t\t\t\t\t$errores.= \"<strong>* Escriba un nombre con menos caracteres. (20 caracteres maximo - sin espacios)</strong><br />\";\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\tif( $this->email == \"\" ){\n\t\t\t\t\t\t$this->errores.= \"<strong>* Ingrese su email por favor.</strong><br />\";\n\t\t\t\t\t}else if( !preg_match($this->sintax,$this->email)){\n\t\t\t\t\t\t$this->errores.= \"<strong>* Ingrese formato correcto de email</strong><br /> 'ej: [email protected]' .<br />\";\n\t\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif( $this->asunto == \"\" ){\n\t\t\t\t\t\t$this->errores.= \"<strong>* Ingrese su asunto por favor. </strong><br />\";\n\t\t\t\t\t}else if( strlen($this->asunto) > 20 ){\n\t\t\t\t\t\t$errores.= \"<strong>* Escriba un asunto con menos caracteres. (20 caracteres maximo - sin espacios) </strong><br />\";\n\t\t\t\t\t}\n\t\t\t\t\t\t\t \n\t\t\t\tif( $this->msj == \"\" ){\n\t\t\t\t\t\t$this->errores.= \"<strong>* Ingrese su mensaje por favor. </strong><br />\";\n\t\t\t\t\t}else if( strlen($this->msj) > 200 ){\n\t\t\t\t\t$this->errores.= \"<strong>* Maximo permitido 200 caracteres. </strong><br />\";\n\t\t\t\t\t}\n\t\t\t}",
"public function errorMessage($errorCode){\n switch ($errorCode) {\n case \"001\":\n $arr = array('code_metier' => '001', 'message' => \"Une erreur interne s'est produite.\");\n break;\n case \"002\":\n $arr = array('code_metier' => '002', 'message' => \"Paramètre(s) manquant(s).\");\n break;\n case \"003\":\n $arr = array('code_metier' => '003', 'message' => \"Le login ou le mot de passe est incorrect.\");\n break;\n case \"004\":\n $arr = array('code_metier' => '004', 'message' => \"Accès refusé.\");\n break;\n case \"005\":\n $arr = array('code_metier' => '005', 'message' => \"Votre token est expiré.\");\n break;\n case \"006\":\n $arr = array('code_metier' => '006', 'message' => \"Cet utilisateur existe déjà.\");\n break;\n case \"007\":\n $arr = array('code_metier' => '007', 'message' => \"Vous n'êtes pas administrateur.\");\n break;\n case \"008\":\n $arr = array('code_metier' => '008', 'message' => \"Utilisateur inconnu.\");\n break;\n case \"009\":\n $arr = array('code_metier' => '009', 'message' => \"Cette communauté existe déjà.\");\n break;\n case \"010\":\n $arr = array('code_metier' => '010', 'message' => \"Cette communauté n'existe pas.\");\n break;\n case \"011\":\n $arr = array('code_metier' => '011', 'message' => \"Cette idée n'existe pas.\");\n break;\n case \"012\":\n $arr = array('code_metier' => '012', 'message' => \"Ce commentaire n'existe pas.\");\n break;\n case \"013\":\n $arr = array('code_metier' => '013', 'message' => \"Les champs doivent être remplis.\");\n break;\n case \"014\":\n $arr = array('code_metier' => '014', 'message' => \"Ce commentaire n'existe pas.\");\n break;\n default:\n $arr = array('code_metier' => '001', 'message' => \"Une erreur interne s'est produite.\");\n }\n\n $reponse = $arr = array('error' => $arr);\n $reponse = json_encode($reponse,JSON_UNESCAPED_UNICODE);\n\n return new JsonResponse($reponse, 500);\n }",
"protected function setErrorsExist() {}",
"public function obtenerError() {\n\t\treturn $this->mensaje_error;\n\t}",
"abstract public function getMsgError();",
"function getErro(){\n\t\t$erro;\n\t\tswitch ($this->intBanco){\n\t\t\tcase INT_SQLSERVER:\n\t\t\t\t$erro = mssql_get_last_message();\n\t\t\t\tbreak;\n\t\t\tcase INT_ORACLE:\n\t\t\t\t$erro1 = oci_error($this->cursor);\n\t\t\t\t$erro = $erro1[\"message\"];\n\t\t\t\tbreak;\n\t\t\tcase INT_POSTGRE:\n\t\t\t\t$erro = pg_last_error($this->conexao);\n\t\t\t\tbreak;\n\t\t\tcase INT_MYSQL:\n\t\t\t\t$erro = mysql_error();\n\t\t\t\tbreak;\n\t\t}\n\t\treturn $erro;\n\t}",
"public function __construct( ){\n\t\t$this->message = \"Algo errado em sua consulta\";\n\t}",
"function obtenerListaErrores()\n {\n return $this->_errores;\n }",
"private function valida_exedente(): bool|array\n {\n if (property_exists(object_or_class: 'calcula_imss', property: 'monto_uma')){\n return $this->error->error('Error no existe el campo monto_uma', $this);\n }\n\n if (property_exists(object_or_class: 'calcula_imss', property: 'sbc')){\n return $this->error->error('Error no existe el campo sbc', $this);\n }\n\n if (property_exists(object_or_class: 'calcula_imss', property: 'n_dias')){\n return $this->error->error('Error no existe el campo n_dias', $this);\n }\n\n if($this->monto_uma<=0){\n return $this->error->error('Error uma debe ser mayor a 0', $this->monto_uma);\n }\n if($this->sbc<=0){\n return $this->error->error('Error sbc debe ser mayor a 0', $this->sbc);\n }\n if($this->n_dias<=0){\n return $this->error->error('Error n_dias debe ser mayor a 0', $this->n_dias);\n }\n return true;\n }",
"function showErrors ($errores, $campo) {\n\n $alerta = '';\n\n if(isset($errores[$campo]) && !empty($campo) ){\n\n $alerta = \"<div class='alerta alerta-error'>.$errores[$campo].</div>\";\n return $alerta;\n }\n\n\n}",
"function afficherErreurSynthaxe ($errorCode=null, $message){\n if($errorCode && $errorCode == 1146){ // problème de synthaxe avec une table de la bdd //\n echo \n \"<div class='alert alert-danger text-center'> Erreur de connexion avec la base de données. Merci de réessayer ultérieurement. </div>\";\n }\n}",
"public function errors();",
"public function errors();",
"function error($string_erro=\"\") {\r\n\t\t//----- caso ocorra erro, envia mensagem\r\n\t\tif (@mysql_errno($this->connect_id)!=0) {\r\n\t\t\t@mail(SIS_EMAIL_RESPONSAVEL,\"Erro \" . date(\"d-m-Y\"), mysql_errno($this->connect_id) . \" - \" . mysql_error($this->connect_id) . \" - \" . $string_erro);\r\n\t\t}\r\n\t\treturn @mysql_errno($this->connect_id);\r\n\t}",
"public function Erreur_Message(){\n return $this->msg_error;\n }",
"function ShowErr () \n\t{\t\n \t \tif ($this -> CodigoError == 0)\n \t\t{\n \t\t$Salida [\"exito\"] = 1;\n\t\t}else{\n\t\t$Salida [\"exito\"] = 0; \t\t\n\t\t$Salida [\"errorCode\"] = $this -> CodigoError;\n\t\t$Salida [\"errorText\"] = $this -> TextoError;\n \t\t}\n\n\treturn $Salida;\n\t}",
"public function _getErro() {\n return $this->erro .= $this->reg->_getErro();\n }"
] |
[
"0.7010238",
"0.6859798",
"0.68143517",
"0.6740433",
"0.6739584",
"0.6647361",
"0.66216415",
"0.6512643",
"0.64943594",
"0.6464415",
"0.6459318",
"0.64349294",
"0.6352084",
"0.6341868",
"0.63231075",
"0.63144857",
"0.63023525",
"0.6296205",
"0.6262639",
"0.6259615",
"0.6240717",
"0.6177144",
"0.6177018",
"0.6174592",
"0.6170516",
"0.6170516",
"0.6166729",
"0.61666626",
"0.61544603",
"0.6151849"
] |
0.68793786
|
1
|
Autoloads PHP last.fm API classes
|
function lastfm_autoload($name){
if(stripos($name, 'LastFM_') === false)
return false;
if($name == 'LastFM_Cache')
$filename = realpath(sprintf("%s/cache/%s.php", dirname(__FILE__), 'Cache'));
else if(stripos($name, 'LastFM_Cache_') !== false)
$filename = realpath(sprintf("%s/cache/%s.php", dirname(__FILE__), str_replace('LastFM_Cache_', '', $name)));
else if($name == 'LastFM_Caller')
$filename = realpath(sprintf("%s/caller/%s.php", dirname(__FILE__), 'Caller'));
else if(stripos($name, 'LastFM_Caller_') !== false)
$filename = realpath(sprintf("%s/caller/%s.php", dirname(__FILE__), str_replace('LastFM_Caller_', '', $name)));
else
$filename = realpath(sprintf("%s/%s.php", dirname(__FILE__), str_replace('LastFM_', '', $name)));
if(!file_exists($filename))
return false;
require_once $filename;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"private function setup_api() {\n\t\trequire_once 'includes/class-themeisle-ob-rest-server.php';\n\t\tif ( ! class_exists( 'Themeisle_OB_Rest_Server' ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\t$api = new Themeisle_OB_Rest_Server();\n\t\t$api->init();\n\t\trequire_once 'includes/importers/helpers/trait-themeisle-ob.php';\n\t}",
"public function manually_load_api() {\n\t\tif ( ! class_exists( 'WP_JSON_Server' ) ) {\n\t\t\tadd_filter( 'json_url', 'set_url_scheme' );\n\n\t\t\trequire( dirname( __FILE__ ) . '/../vendor/wp-api/wp-api/plugin.php' );\n\n\t\t\tadd_action( 'wp_json_server_before_serve', array( $this, 'api_init' ) );\n\t\t}\n\t}",
"public function autoload($class) {\n if (isset(static::$map[$class])){\n $pathInfo = static::$map[$class];\n Yaf_Loader::import(sprintf('%s%s',$pathInfo[0], $pathInfo[1]));\n } else if (strpos($class, 'Builder') === strlen($class) - 7){\n Yaf_Loader::import(sprintf('%s/application/views/builder/%s.php', APPLICATION_PATH, $class));\n } else if (strpos($class, 'Pagelet') === strlen($class) - 7){\n Yaf_Loader::import(sprintf('%s/application/pagelets/%s.php', APPLICATION_PATH, $class));\n } else if (strpos($class, 'Halo') === 0){\n Yaf_Loader::import(sprintf('%s/halo/%s.php',LIB_PATH,$class));\n } else if (strpos($class, 'Util') == strlen($class) - 4 || strpos($class, 'Utils') == strlen($class) - 5){\n Yaf_Loader::import(sprintf('%s/utils/%s.php',LIB_PATH,$class));\n } else if (strpos($class, 'Model') === strlen($class) - 5){\n Yaf_Loader::import(sprintf('%s/application/models/%s.php',APPLICATION_PATH,$class));\n } else if (strpos($class, 'Service') === strlen($class) - 7){\n Yaf_Loader::import(sprintf('%s/application/service/%s.php',APPLICATION_PATH,$class));\n } else if (strpos($class, 'HTMLPurifier') !== false){\n Yaf_Loader::import(sprintf('%s/htmlpurifier/HTMLPurifier.safe-includes.php',LIB_PATH));\n }else if (strpos($class, 'Api') === strlen($class) - 3){\n Yaf_Loader::import(sprintf('%s/application/Api/%s.php',APPLICATION_PATH,$class));\n }else if (strpos($class, 'Object') === strlen($class) - 6){\n Yaf_Loader::import(sprintf('%s/application/objects/%s.php',APPLICATION_PATH,$class));\n }else if (strpos($class, 'MemCache') === 0){\n// var_dump('================');\n// /Users/worker/php/wk/wcontact_cache/lib/wcontact/MemCacheBase.php\n Yaf_Loader::import(sprintf('%s/wzhaopin/%s.php',LIB_PATH, $class));\n }\n }",
"function __mashineAutoload($class_name)\n{\n if (preg_match(\"/([a-zA-Z0-9]*)ApiController$/\", $class_name, $matches)) {\n $api_path = preg_replace(\"/plugins.*/\", \"controllers\".DS.\"api\", __FILE__);\n\n $file = $api_path.DS.strtolower($matches[1]).\".php\";\n if (is_file($file)) {\n include $file;\n }\n }\n}",
"public function setApi() {\n\t\tif(sienna_mikado_twitter_feed_installed()) {\n\t\t\t$this->api = \\MikadofTwitterApi::getInstance();\n\t\t}\n\t}",
"function humcore_deposit_api_classes_init() {\n\n\tglobal $ezid_api, $fedora_api, $solr_client;\n\n\t// Create an ezid client instance.\n\trequire_once dirname( __FILE__ ) . '/ezid-api.php';\n\t$ezid_api = new Humcore_Deposit_Ezid_Api;\n\n\t// Create a fedora client instance.\n\trequire_once dirname( __FILE__ ) . '/fedora-api.php';\n\t$fedora_api = new Humcore_Deposit_Fedora_Api;\n\n\t// Create a solr client instance.\n\trequire_once dirname( __FILE__ ) . '/solr-api.php';\n\t$solr_client = new Humcore_Deposit_Solr_Api;\n\n}",
"function __construct() {\n self::add_extension();\n self::require_php_api();\n self::define_globals();\n self::require_subclasses();\n }",
"function class_autoloader($class) {\r\n require make_url(\"class/$class.php\");\r\n}",
"public function init() {\n parent::init();\n if (!is_object($this->api)) {\n $class = $this->api;\n $this->api = new $class;\n }\n $this->loadPlugins();\n }",
"static function autoload()\r\n\t{\r\n\t\t\r\n\t}",
"function __autoload($className) {\n require PATH_ZABBIX_API_CLASSES_DIRECTORY.'/'.$className.'.php';\n}",
"function commonwp_autoloader( $class ) {\n\t$pairs = [\n\t\t'WP_Temporary' => '/lib/wp-temporary/class-wp-temporary.php',\n\t\t'Temporary_Command' => '/lib/wp-temporary/cli/Temporary_Command.php',\n\t\t'dimadin\\WP\\Plugin\\commonWP\\Clean' => '/inc/Clean.php',\n\t\t'dimadin\\WP\\Plugin\\commonWP\\Expiration' => '/inc/Expiration.php',\n\t\t'dimadin\\WP\\Plugin\\commonWP\\Lock' => '/inc/Lock.php',\n\t\t'dimadin\\WP\\Plugin\\commonWP\\Main' => '/inc/Main.php',\n\t\t'dimadin\\WP\\Plugin\\commonWP\\NPM' => '/inc/NPM.php',\n\t\t'dimadin\\WP\\Plugin\\commonWP\\Paths' => '/inc/Paths.php',\n\t\t'dimadin\\WP\\Plugin\\commonWP\\Privacy' => '/inc/Privacy.php',\n\t\t'dimadin\\WP\\Plugin\\commonWP\\Process' => '/inc/Process.php',\n\t\t'dimadin\\WP\\Plugin\\commonWP\\Queue' => '/inc/Queue.php',\n\t\t'dimadin\\WP\\Plugin\\commonWP\\Rewrite' => '/inc/Rewrite.php',\n\t\t'dimadin\\WP\\Plugin\\commonWP\\Singleton' => '/inc/Singleton.php',\n\t\t'dimadin\\WP\\Plugin\\commonWP\\SRI' => '/inc/SRI.php',\n\t\t'dimadin\\WP\\Plugin\\commonWP\\Store' => '/inc/Store.php',\n\t\t'dimadin\\WP\\Plugin\\commonWP\\Utils' => '/inc/Utils.php',\n\t\t'dimadin\\WP\\Plugin\\commonWP\\Versions' => '/inc/Versions.php',\n\t\t'dimadin\\WP\\Plugin\\commonWP\\WPCLI' => '/inc/WPCLI.php',\n\t\t'dimadin\\WP\\Library\\Backdrop\\Main' => '/lib/backdrop/inc/Main.php',\n\t\t'dimadin\\WP\\Library\\Backdrop\\Server' => '/lib/backdrop/inc/Server.php',\n\t\t'dimadin\\WP\\Library\\Backdrop\\Task' => '/lib/backdrop/inc/Task.php',\n\t];\n\n\tif ( array_key_exists( $class, $pairs ) ) {\n\t\tinclude __DIR__ . $pairs[ $class ];\n\t}\n}",
"abstract protected static function autoload($class);",
"public function __construct() {\n\t\tspl_autoload_register( array( $this, 'autoload_api_google_files' ) );\n\t}",
"function medialib_autoloader($class_name)\n{\n $class_name = str_replace('\\\\', '/', $class_name) . '.php';\n require_once $class_name;\n}",
"public static function registerAutoloader(){\n\t\tspl_autoload_register(__NAMESPACE__ . \"\\\\Jolt::autoload\");\n\t}",
"public static function load_extra_classes() {\n\t\trequire_once TVE_DASH_PATH . '/inc/automator/class-tap-elementor.php';\n\t\tElementor::init();\n\n\t\trequire_once TVE_DASH_PATH . '/inc/automator/class-tap-woo.php';\n\t\tWoo::init();\n\n\t\trequire_once TVE_DASH_PATH . '/inc/automator/class-tap-facebook.php';\n\t\tFacebook::init();\n\t}",
"function my_autoloader($class) {\r\n\t require_once ($class.'.php');\r\n\t}",
"function front_page_archives_autoloader( $class ) {\n\tif ( 0 !== strpos( $class, 'FrontPageArchives_' ) ) {\n\t\treturn;\n\t}\n\n\t$file = dirname( __FILE__ ) . '/classes/';\n\t$file .= str_replace( array( 'FrontPageArchives_', '_' ), array( '', '/' ), $class );\n\t$file .= '.php';\n\n\tif ( file_exists( $file ) ) {\n\t\trequire_once( $file );\n\t}\n}",
"function require_php_api() {\n\n require_once(LFAPPS__PLUGIN_PATH . \"/libs/php/LFAPPS_JWT.php\");\n\n }",
"public static function init() {\n\t\tstatic::$apis = [\n\t\t\t'content' => new Content_API(),\n\t\t\t'contributors' => new Contributors_API(),\n\t\t\t'dashboards' => new Dashboards_API(),\n\t\t\t'options' => new Options_API(),\n\t\t\t'post_types' => new Post_Types_API(),\n\t\t\t'quick_cards' => new Quick_Cards_API(),\n\t\t];\n\n\t\tadd_action( 'rest_api_init', [__CLASS__, 'register_rest_routes'] );\n\n\t}",
"function helper_autoloader($class)\n {\n\n }",
"function my_autoloader($class) {\r\n require 'libs/' . $class . '.php';\r\n}",
"function yap_autoloader($class) {\n $directories = array(LIB_DIR, MODEL_DIR);\n\n foreach($directories as $directory) {\n if(!@include(\"$directory/$class.php\"))\n @include($directory.strtolower($class).\".php\");\n }\n}",
"function my_autoloader($class) {\n if ( $class != \"ACF\" )\n include 'classes/' . $class . '.class.php';\n }",
"function serviceAutoloader($class) {\r\n $class = strtolower($class);\r\n switch (substr($class, 0, 2)) {\r\n case 'm_' : {\r\n include_once APPLICATION_MODEL_PATH . $class . \".class.php\";\r\n }\r\n break;\r\n case 'v_' : {\r\n include_once APPLICATION_VIEW_PATH . $class . \".class.php\";\r\n }\r\n break;\r\n case 'c_' : {\r\n include_once APPLICATION_CONTROLLER_PATH . $class . \".class.php\";\r\n }\r\n break;\r\n default : {\r\n if (file_exists(APPLICATION_EXTENSION_PATH . $class . \"/\" . $class . \".class.php\")) {\r\n include_once (APPLICATION_EXTENSION_PATH . $class . \"/\" . $class . \".class.php\");\r\n }\r\n }\r\n break;\r\n }\r\n}",
"function WikiAutoload($classname)\r\n\t{\r\n\t\tif(substr($classname,0,4) != \"Wiki\") {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\t\r\n\t\t$path = \"Core/\".str_replace(\"\\\\\",\"/\", substr($classname,5)).\".php\";\r\n\t\t\r\n\t\tif(!file_exists($path))\r\n\t\t\tthrow new ClassNotFoundException('\\''.$classname.'\\' not found. Expected path: '.$path);\r\n\t\t\r\n\t\trequire_once $path;\r\n\t}",
"private function _init_api_library($base_name)\n\t{\n\t\t// Generate the name of the class\n\t\t$class_name = $base_name.API_LIBRARY_SUFFIX;\n\n\t\t// Check if the implementing library exists\n\t\tif ( ! Kohana::find_file('libraries/api',\n\t\t\tKohana::config('config.extension_prefix').$class_name))\n\t\t{\n\t\t\tthrow new Kohana_Exception('libraries.api_library_not_found',\n\t\t\t\tKohana::config('config.extension_prefix').$class_name.'.php', $class_name);\n\t\t}\n\n\t\t// Include the implementing API library file\n\t\trequire_once Kohana::find_file('libraries/api', Kohana::config('config.extension_prefix').$class_name);\n\n\t\t// Temporary instance for type checking\n\t\t$temp_api_object = new $class_name($this);\n\n\t\t// Check if the implementing library is an instance of Api_Object_Core\n\t\t// NOTE: All API libraries *MUST* be subclasses of Api_Object_Core\n\t\tif ( ! $temp_api_object instanceof Api_Object_Core)\n\t\t\tthrow new Kohana_Exception('libraries.invalid_api_library', $class_name, 'Api_Object_Core');\n\n\t\t// Discard the old copy\n\t\tunset($this->temp_api_object);\n\n\t\t// Instaniate a fresh copy of the API library\n\t\t$this->api_object = new $class_name($this);\n\t}",
"function sacf_autoloader($class) { ///< autoload a sacf class\n\t$class = ltrim($class, '\\\\');\n\n\t// bail if namespace doesn't match\n\tif (strpos($class, __NAMESPACE__) !== 0) {\n\t\treturn;\n\t}\n\n\t// remove main namespace and force lowerspace string\n\t$class = strtolower(str_replace(__NAMESPACE__, '', $class));\n\n\tif (strpos($class, '\\fclayout') === 0) {\n\t\t// load sacf flex content modules\n\t\t$path = str_replace('\\\\', DIRECTORY_SEPARATOR, $class);\n\t\t// $path = str_replace('/module/', paths()['modules'], $path) . '.php';\n\t\t$path = str_replace('/fclayout/', settings::paths()['layouts'], $path) . '.php';\n\t\t// $path = str_replace('/module/', settings::paths['modules'], $path) . '.php';\n\t} else {\n\t\t// @todo load plugins from theme folder first\n\t\t// load sacf core classes\n\t\t$path = __DIR__ . str_replace('\\\\', DIRECTORY_SEPARATOR, $class) . '.php';\n\t}\n\trequire_once $path;\n}",
"private function autoloader( $class ) {\r\n\r\n\t\t\t//BackWPup classes auto load\r\n\t\t\tif ( strstr( strtolower( $class ), 'backwpup_' ) ) {\r\n\t\t\t\t$dir = dirname( __FILE__ ) . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR;\r\n\t\t\t\t$class_file_name = 'class-' . str_replace( array( 'backwpup_', '_' ), array( '', '-' ), strtolower( $class ) ) . '.php';\r\n\t\t\t\tif ( strstr( strtolower( $class ), 'backwpup_pro' ) ) {\r\n\t\t\t\t\t$dir .= 'pro' . DIRECTORY_SEPARATOR;\r\n\t\t\t\t\t$class_file_name = str_replace( 'pro-','', $class_file_name );\r\n\t\t\t\t}\r\n\t\t\t\tif ( file_exists( $dir . $class_file_name ) )\r\n\t\t\t\t\trequire $dir . $class_file_name;\r\n\t\t\t}\r\n\r\n\t\t\t// namespaced PSR-0\r\n\t\t\tif ( ! empty( self::$autoload ) ) {\r\n\t\t\t\t$pos = strrpos( $class, '\\\\' );\r\n\t\t\t\tif ( $pos !== FALSE ) {\r\n\t\t\t\t\t$class_path = str_replace( '\\\\', DIRECTORY_SEPARATOR, substr( $class, 0, $pos ) ) . DIRECTORY_SEPARATOR . str_replace( '_', DIRECTORY_SEPARATOR, substr( $class, $pos + 1 ) ) . '.php';\r\n\t\t\t\t\tforeach ( self::$autoload as $prefix => $dir ) {\r\n\t\t\t\t\t\tif ( $class === strstr( $class, $prefix ) ) {\r\n\t\t\t\t\t\t\tif ( file_exists( $dir . DIRECTORY_SEPARATOR . $class_path ) )\r\n\t\t\t\t\t\t\t\trequire $dir . DIRECTORY_SEPARATOR . $class_path;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t} // Single class file\r\n\t\t\t\telseif ( ! empty( self::$autoload[ $class ] ) && is_file( self::$autoload[ $class ] ) ) {\r\n\t\t\t\t\trequire self::$autoload[ $class ];\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t//Google SDK Auto loading\r\n\t\t\t$classPath = explode( '_', $class );\r\n\t\t\tif ( $classPath[0] == 'Google' ) {\r\n\t\t\t\tif ( count( $classPath ) > 3 ) {\r\n\t\t\t\t\t$classPath = array_slice( $classPath, 0, 3 );\r\n\t\t\t\t}\r\n\t\t\t\t$filePath = self::get_plugin_data( 'plugindir' ) . '/vendor/' . implode( '/', $classPath ) . '.php';\r\n\t\t\t\tif ( file_exists( $filePath ) ) {\r\n\t\t\t\t\trequire $filePath;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t}"
] |
[
"0.6259978",
"0.61128134",
"0.5953094",
"0.594733",
"0.5911367",
"0.59039694",
"0.58335096",
"0.57922256",
"0.57803553",
"0.57430977",
"0.5724423",
"0.5667436",
"0.5649939",
"0.5642587",
"0.5638982",
"0.56381327",
"0.56366414",
"0.5636415",
"0.56059396",
"0.56011164",
"0.5549407",
"0.5549095",
"0.55366653",
"0.5535705",
"0.5529926",
"0.5508244",
"0.5463227",
"0.5461762",
"0.5457857",
"0.5451203"
] |
0.6406577
|
0
|
Check if value can be considered NOvalue
|
protected function isNoValue($value)
{
return $value === false
|| $value === 'N'
|| $value === 'n'
|| $value === 'no';
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function testIsValidNoValue()\n {\n $this->assertTrue($this->uut->isValid());\n }",
"public function isFalse()\n {\n \n return !$this->value;\n \n }",
"public function getNoValue()\n\t{\n\t\treturn $this->getBehavior()->labelNoValue;\n\t}",
"public function not_zero($value)\n\t{\n\t\tif (intval($value) <= 0)\n\t\t{\n\t\t\t$this->form_validation->set_message('not_zero', lang('form_validation_isset'));\n\t\t\treturn FALSE;\n\t\t}\n\t\treturn TRUE;\n\t}",
"public function isNA($value)\n {\n if (is_array($value)) {\n return false;\n }\n if (strcasecmp($value, 'n') == 0 \n || strcasecmp($value, '/') == 0 \n || strcasecmp($value, 'a') == 0 \n || strcasecmp($value, 'n/') == 0 \n || strcasecmp($value, '/a') == 0 \n || strcasecmp($value, 'n/a') == 0\n ) { \n return true;\n }\n return false;\n }",
"public function withoutValue();",
"private function _isNull() {\n if (is_null($this->value)) {\r\n return true;\r\n }\n if (empty($this->value) && (in_array($this->type, array('multiple', 'ordered', 'string')))) {\n return true;\n }\n return false;\n }",
"public function testPhoneMayNotHaveValue()\n {\n $phone = new Phone(null);\n $this->assertFalse($phone->getHasValue());\n }",
"static protected function _isNotSet($in_value) {\r\n return is_null($in_value) || (false === $in_value) || ('' === $in_value);\r\n }",
"public static function _notset($value)\n\t{\n\t\treturn self::_empty($value) && !isset($value);\n\t}",
"function o_isNull($value) {\n\t\t\treturn Obj::singleton()->isNull($value);\n\t\t}",
"public function notEqualTo($value);",
"function is_blank($value) {\n\t\t\n\t\treturn empty($value) && !is_numeric($value);\n\t\t\n\t}",
"private static function betterEmpty($value)\n {\n return empty($value) && !is_numeric($value);\n }",
"public function hasNVal()\n {\n return isset($this->n_val);\n }",
"function check_value($value) {\n\tif((@count($value)>0 and !@empty($value) and @isset($value)) || $value=='0') {\n\t\treturn true;\n\t}\n}",
"private static function isEmptyNotZero($value)\n {\n return empty($value) && $value !== 0;\n }",
"public function isNull();",
"public function hasNullValue(){\n return $this->_has(1);\n }",
"function not_empty(mixed $value): bool\n\t{\n\t\treturn !empty($value);\n\t}",
"public function isDisplayValuesWithoutResults();",
"public function isNull()\n {\n return null === $this->value;\n }",
"function is_not_null( $value )\n {\n if ( is_array( $value ) ) {\n return ( !empty( $value['from'] ) ) || ( !empty( $value['to'] ) );\n } else {\n return !empty( $value );\n }\n }",
"function has_presence($value) {\n return !is_blank($value);\n}",
"abstract public function isNull();",
"function est_vide($val){\r\n return empty($val);\r\n }",
"public function isFalse();",
"protected function isFalse($value) {\n\t\treturn !$this->isTrue($value);\n\t}",
"function has_presence( $value ) {\n return !is_blank( $value );\n}",
"function not_null($value) {\n if (is_array($value)) {\n if (sizeof($value) > 0)\n return true;\n else\n return false;\n } else {\n if ((is_string($value) || is_int($value)) && ($value != '') && (strlen(trim($value)) > 0))\n return true;\n else\n return false;\n }\n}"
] |
[
"0.6760051",
"0.6754908",
"0.6752171",
"0.6645197",
"0.66421884",
"0.6547066",
"0.65082526",
"0.6459386",
"0.64541453",
"0.64288884",
"0.64242035",
"0.6395459",
"0.63883466",
"0.6343351",
"0.6269855",
"0.62462604",
"0.6243028",
"0.6238384",
"0.6224718",
"0.62235284",
"0.6223073",
"0.6221857",
"0.622113",
"0.62064326",
"0.62024754",
"0.61980015",
"0.61865073",
"0.6175639",
"0.6156317",
"0.6134226"
] |
0.7951982
|
0
|
Check if value can be considered YESvalue
|
protected function isYesValue($value)
{
return $value === true
|| $value === 'Y'
|| $value === 'y'
|| $value === 'yes';
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function isTrue($value) {\r\n\treturn is_bool($value) ? $value : (bool)preg_match('/^(1|y|yes|true|on)$/i',(string)$value);\r\n}",
"public function isTrue()\n {\n \n return !!$this->value;\n \n }",
"public function isMandatory()\n {\n if ($this->value == 'yes') {\n return true;\n } else {\n return false;\n }\n }",
"public function isValid() : bool\n {\n return $this->yesNo === self::YES || $this->yesNo === self::NO;\n }",
"function bool($value)\n{\n return ! in_array(strtolower($value), ['no', 'false', '0', '', '-1']);\n}",
"protected function isTrue($value) {\n\t\t$value = strtolower(trim((string)$value));\n\t\treturn (in_array($value, array(\"yes\", \"true\", \"1\")));\n\t}",
"public function getIsValidValue($value)\r\n {\r\n return true;\r\n }",
"protected function shouldPromptFor($value)\n {\n if (!$this->shouldPrompt()) {\n return;\n }\n\n if (is_string($value)) {\n return !$value;\n } elseif (is_bool($value) || $value === null) {\n return (bool) $value;\n }\n\n return false;\n }",
"public static function valueIsValid($_value)\n\t{\n\t\treturn in_array($_value,array(self::VALUE_POSITIVE,self::VALUE_NEUTRAL,self::VALUE_NEGATIVE,self::VALUE_WITHDRAWN,self::VALUE_INDEPENDENTLYWITHDRAWN,self::VALUE_CUSTOMCODE));\n\t}",
"public static function valueIsValid($_value)\n\t{\n\t\treturn in_array($_value,array(self::VALUE_NOTCOMPLETE,self::VALUE_COMPLETE));\n\t}",
"protected function checkValue() {\n if($this->required) {\n if($this->regularExpression) {\n if(preg_match($this->regularExpression, $this->value)) {\n $returnValue = TRUE;\n } else {\n $returnValue = FALSE;\n $this->error = TRUE;\n }\n } elseif($this->callBack) {\n if(call_user_func($this->callBack, $this->value)) {\n $returnValue = TRUE;\n } else {\n $returnValue = FALSE;\n $this->error = TRUE;\n }\n } elseif(!(bool)$this->value) {\n $returnValue = FALSE;\n } else {\n $returnValue = TRUE;\n }\n } else {\n $returnValue = TRUE;\n }\n\n return $returnValue;\n }",
"public function isTrue();",
"public static function valueIsValid($_value)\n\t{\n\t\treturn in_array($_value,array(self::VALUE_ASKSELLERQUESTION,self::VALUE_RESPONSETOASQQUESTION,self::VALUE_CONTACTEBAYMEMBER,self::VALUE_CONTACTTRANSACTIONPARTNER,self::VALUE_RESPONSETOCONTACTEBAYMEMBER,self::VALUE_CONTACTEBAYMEMBERVIACOMMUNITYLINK,self::VALUE_CUSTOMCODE,self::VALUE_ALL,self::VALUE_CONTACTMYBIDDER,self::VALUE_CONTACTEBAYMEMBERVIAANONYMOUSEMAIL,self::VALUE_CLASSIFIEDSCONTACTSELLER,self::VALUE_CLASSIFIEDSBESTOFFER));\n\t}",
"public function isTrue()\n {\n return $this->value === true;\n }",
"public static function valueIsValid($_value)\n\t{\n\t\treturn in_array($_value,array(self::VALUE_Y,self::VALUE_Y_1));\n\t}",
"public static function valueIsValid($_value)\n\t{\n\t\treturn in_array($_value,array(self::VALUE_NOHITCOUNTER,self::VALUE_HONESTYSTYLE,self::VALUE_GREENLED,self::VALUE_HIDDEN,self::VALUE_CUSTOMCODE));\n\t}",
"public function hasBoolValue(){\n return $this->_has(4);\n }",
"public function check($value): bool;",
"public function isValue()\n {\n return\n $this->type === 'string' ||\n $this->type === 'number' ||\n $this->type === 'null' ||\n $this->type === 'boolTrue' ||\n $this->type === 'boolFalse';\n }",
"function o_isBool($value) {\n\t\t\treturn Obj::singleton()->isBool($value);\n\t\t}",
"public static function valueIsValid($_value)\n\t{\n\t\treturn in_array($_value,array(self::VALUE_VALID,self::VALUE_NOLONGERVALID,self::VALUE_CUSTOMCODE));\n\t}",
"public static function valueIsValid($_value)\n\t{\n\t\treturn in_array($_value,array(self::VALUE_NEGATIVEFEEDBACKRECEIVED,self::VALUE_UNPAIDITEMDISPUTE,self::VALUE_BADEMAILTEMPLATE,self::VALUE_CUSTOMCODE));\n\t}",
"private function process_required($value)\n {\n return (bool) ($value != \"\" || $value === 0);\n }",
"public function hasBoolValue(){\n return $this->_has(3);\n }",
"public static function valueIsValid($_value)\n\t{\n\t\treturn in_array($_value,array(self::VALUE_INCHECKOUT,self::VALUE_PRECHECKOUT));\n\t}",
"public function validateValue()\n {\n return (preg_match('/' . $this->preference->value . '/', $this->value) == 1 ? true : false);\n }",
"public static function valueIsValid($_value)\n\t{\n\t\treturn in_array($_value,array(self::VALUE_UNDEFINED,self::VALUE_PRIVATE,self::VALUE_COMMERCIAL,self::VALUE_CUSTOMCODE));\n\t}",
"public static function valueIsValid($_value)\n\t{\n\t\treturn in_array($_value,array(self::VALUE_SUCCESS,self::VALUE_FAILURE,self::VALUE_WARNING,self::VALUE_PARTIALFAILURE));\n\t}",
"public static function valueIsValid($_value)\n\t{\n\t\treturn in_array($_value,array(self::VALUE_CHECKING,self::VALUE_SAVINGS));\n\t}",
"public function hasValue()\n {\n return $this->Value !== null ? true : false;\n }"
] |
[
"0.6877867",
"0.6860067",
"0.68411326",
"0.6715909",
"0.6688762",
"0.6618538",
"0.65606374",
"0.65339494",
"0.6529253",
"0.6523695",
"0.64915645",
"0.6444542",
"0.64318514",
"0.64072347",
"0.6359886",
"0.63485664",
"0.63303417",
"0.6300431",
"0.6299454",
"0.629559",
"0.626783",
"0.6266273",
"0.6266177",
"0.62609136",
"0.6258184",
"0.62326485",
"0.6213964",
"0.6202922",
"0.6194065",
"0.6163562"
] |
0.7110595
|
0
|
Converting keys of a passed array to UPPER case
|
protected function normalizeKeys(array $arr)
{
return array_change_key_case($arr, CASE_UPPER);
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public static function arrayToUpper($array) {\r\n foreach ($array AS $key => $value) {\r\n if (is_string($value)) {\r\n $array[$key] = strtoupper(trim($value));\r\n }\r\n }\r\n return $array;\r\n}",
"function array_keys_to_lower($array) {\n $rr = [];\n foreach ($array as $k => $v) {\n $rr[strtolower($k)] = $v;\n }\n return $rr;\n}",
"public static function arrayucwords($array) {\r\n foreach ($array as $key => $value) {\r\n if (is_string($value)) {\r\n $array[$key] = ucwords(trim($value));\r\n }\r\n }\r\n return $array;\r\n}",
"public function arrayKeysToLowercase($array)\n {\n return array_change_key_case($array, \\CASE_LOWER);\n }",
"public function returnArrayAsUppercase($array)\n {\n return self::arrayCaseing('strtoupper', $array);\n }",
"function capMe(array $arrayToHandle): array\n{\n return array_map(\n fn($item) => ucfirst(strtolower($item)),\n $arrayToHandle\n );\n}",
"public static function convertKeysToSnakeCase($arrays)\n {\n $new = array();\n foreach ($arrays as $key => $value) {\n $new[self::convertToSnakeCase($key)] = $value;\n }\n return $new;\n }",
"function acf_array_camel_case($array = array())\n{\n}",
"function _ToUpper(&$item, $key){\n $item = strtoupper($item);\n }",
"public static function arrayToLower($array) {\r\n foreach ($array AS $key => $value) {\r\n if (is_string($value)) {\r\n $array[$key] = strtolower(trim($value));\r\n }\r\n }\r\n return $array;\r\n}",
"private function arrayChangeKeyCaseUnicode($arr, $c = CASE_LOWER)\n {\n $c = ($c == CASE_LOWER) ? MB_CASE_LOWER : MB_CASE_UPPER;\n\n $ret = [];\n\n foreach ($arr as $k => $v) {\n $ret[mb_convert_case($k, $c, \"UTF-8\")] = $v;\n }\n\n return $ret;\n }",
"function handle_case($case, &$in_array) {\n foreach ($in_array as &$value) {\n if ($case == \"uppercase\") {\n $value = strtoupper($value);\n } else {\n $value = strtolower($value);\n }\n }\n}",
"public static function changeKeyCase(array $array, $case = self::CASE_LOWER)\n {\n $case = (int) $case;\n\n if ($case === self::CASE_LOWER || $case === self::CASE_UPPER) {\n return array_change_key_case($array, $case);\n }\n\n // underscore to camelcase\n if ($case & self::CASE_CAMEL) {\n $result = array();\n foreach ($array as $key => $value) {\n $key = strtolower($key);\n $key = str_replace('_', ' ', $key);\n $key = ucwords($key);\n $key = str_replace(' ', '', $key);\n $result[$key] = $value;\n }\n return $result;\n }\n\n // camelcase to underscore\n if ($case & self::CASE_UNDERSCORE) {\n $toupper = $case & self::CASE_UPPER;\n $result = array();\n foreach ($array as $key => $value) {\n $key = preg_replace('/([0-9a-z])([A-Z])/', '$1_$2', $key);\n $key = $toupper ? strtoupper($key) : strtolower($key);\n $result[$key] = $value;\n }\n return $result;\n }\n\n return false;\n }",
"private function toCamelCase(array $data)\n {\n foreach ($data as $key => $value)\n {\n if (is_array($value)) {\n $value = $this->toCamelCase($value);\n }\n\n unset($data[$key]);\n $data[camel_case($key)] = $value;\n }\n\n return $data;\n }",
"function upcase(){\n\t\treturn $this->_copy(Translate::Upper($this->toString(),$this->getEncoding()));\n\t}",
"public function toLower()\n {\n $lowerCase = [];\n foreach ($this->split() as $key => $value) {\n $lowerCase[] = strtolower($value);\n }\n\n return $lowerCase;\n }",
"function isi_key($dataset)\n {\n global $ATRIBUT;\n $keys = array_keys($ATRIBUT);\n $arr = array();\n foreach ($dataset as $key => $val) {\n foreach ($val as $k => $v) {\n $arr[$key][$keys[$k - 1]] = strtolower($v);\n }\n }\n\n //echo '<pre>'.print_r($arr, 1).'</pre>'; \n return $arr;\n }",
"private function lowercaseKeys($result = array())\n {\n $values = array();\n\n foreach ($result as $key => $value)\n {\n $values[ strtolower($key) ] = $value;\n }\n\n return $values;\n }",
"function camel_to_underscore($input, $keys = false)\n{\n if ( ! is_array($input)) {\n return strtolower(preg_replace('/(?<!^)[A-Z]/', '_$0', $input));\n }\n\n $output = [];\n\n foreach ($input as $key => $value) {\n\n if ($keys) {\n $output[camel_to_underscore($key)] = is_array($value) ? camel_to_underscore($value, $keys) : $value;\n } else {\n $output[$key] = is_array($value) ? camel_to_underscore($value, $keys) : camel_to_underscore($value);\n }\n\n }\n\n return $output;\n}",
"public function returnArrayAsLowercase($array)\n {\n return self::arrayCaseing('strtolower', $array);\n }",
"private function uppercaseFirstAll($text, $key)\n {\n $this->userData[$key] = ucwords($text);\n }",
"public static function array_change_key_case(\n array $array,\n int $case = \\CASE_LOWER,\n string $encoding = 'UTF-8'\n ): array {\n if (\n $case !== \\CASE_LOWER\n &&\n $case !== \\CASE_UPPER\n ) {\n $case = \\CASE_LOWER;\n }\n\n $return = [];\n foreach ($array as $key => &$value) {\n $key = $case === \\CASE_LOWER\n ? self::strtolower($key, $encoding)\n : self::strtoupper($key, $encoding);\n\n $return[$key] = $value;\n }\n\n return $return;\n }",
"function array_key_exist_case_ins($needle, $hay) {\n return in_array(strtolower($needle), array_map('strtolower', array_keys($hay)));\n}",
"function downcase(){\n\t\treturn $this->_copy(Translate::Lower($this->toString(),$this->getEncoding()));\n\t}",
"function transform (array $old): array\n{\n $transformed = [];\n\n foreach ($old as $points => $letters) {\n foreach ($letters as $letter) {\n $transformed[$letter] = $points;\n }\n }\n return array_change_key_case($transformed);\n}",
"public function toAlternateCase(){\n $alternative = str_split(strtolower($this->string),1);\n for($i=0;$i<sizeof($alternative);$i++){\n if(($i+1)%2==0){\n $alternative[$i]=strtoupper($alternative[$i]);\n } \n }\n return $alternative = implode(\"\",$alternative);\n }",
"function splitArray($word) {\r\n\tglobal $word,$upper,$lower;\r\n foreach($word as $key=>$value) {\r\n if(ctype_upper($key)) {\r\n $upper=array_merge($upper, array($key => $value));\r\n } else {\r\n $lower= array_merge($lower,array($key => $value));\r\n }\r\n \r\n }\r\n\r\n}",
"static function array_change_value_case($input, $case = CASE_LOWER)\n {\n $result = [];\n if (!is_array($input)) {\n return $result;\n }\n foreach ($input as $key => $value) {\n if (is_array($value)) {\n $result[$key] = array_change_value_case($value, $case);\n continue;\n }\n $result[$key] = $case == CASE_UPPER ? strtoupper($value) : strtolower($value);\n }\n return $result;\n }",
"function LetterCapitalize($str) { \r\n return ucwords($str); \r\n}",
"public function toCamelCase(array $arrayOfString):string\n {\n $result = \"\";\n foreach ($arrayOfString as $string) {\n $result .= ucfirst(mb_strtolower($string));\n }\n \n return $result;\n }"
] |
[
"0.7856162",
"0.7576917",
"0.71910036",
"0.7177122",
"0.6877952",
"0.6789434",
"0.675938",
"0.6758337",
"0.6717736",
"0.6691954",
"0.66788363",
"0.6676342",
"0.65832996",
"0.64239526",
"0.62513936",
"0.62465",
"0.62066805",
"0.6159514",
"0.6097107",
"0.605486",
"0.600871",
"0.5996189",
"0.59954965",
"0.5976031",
"0.59234095",
"0.5888998",
"0.58737695",
"0.5857969",
"0.5850295",
"0.58044684"
] |
0.7974417
|
0
|
/ Function: wf_widget(); Variables, locationID: Integer which is the ID of the destination,
|
function wf_widget($destinationID=null) {
if($destinationID === null) {
print('You need to provide the destination ID from <a href="http://wanderfly.com">Wanderfly</a>.');
return false;
}
//Connect to the OSCommerce database
$apikey = get_option('wf_apikey');
return '<iframe srcolling="no" frameborder="0" border="0" width="596" height="130" name="wf-widget-checkitout-'.$destinationID.'" id="wf-widget-checkitout-'.$destinationID.'" src="http://partners.wanderfly.com/widgets/checkitout?apiKey='.$apikey.'&destinationID='.$destinationID.'" style="border:none; overflow:hidden; width:596px; height:130px;" allowTransparency="true"></iframe>';
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public static function widget() {\n \n\t\t$start = self::get_dashboard_widget_option(self::wid, 'starting_conversion');\n\t\t$remaining_days = self::get_dashboard_widget_option(self::wid, 'starting_conversion');\n\t\t\n\t\t// Display Dashboard widget\n\t\trequire_once( 'red-flag-parking-display.php' );\n }",
"function wp_render_widget($widget_id, $sidebar_id)\n {\n }",
"function wp_render_widget_control($id)\n {\n }",
"function wp_parse_widget_id($id)\n {\n }",
"protected function getWidgetId()\n {\n return !empty($_GET['wid']) ? $_GET['wid'] : 'rrf';\n }",
"function wf_template_widget($retData=false) {\n\t\tglobal $post;\n\t\t\n\t\t$error = 'Error while adding the widget, please report to <a href=\"http://blog.wanderfly.com/wordpress-plugin/\">http://blog.wanderfly.com/wordpress-plugin/</a>.';\n\t\t$widgetHTML = false;\n\t\t\n\t\tif($post) {\n\t\t\t//Get the Destination ID from the post's metas,\n\t\t\t$wf_meta = get_post_meta($post->ID, \"wf_destination\", true);\n\t\t\t\n\t\t\t//Display the wanderfly widget,\n\t\t\tif($wf_meta) {\n\t\t\t\t$wf_metas = explode(':', $wf_meta);\n\t\t\t\t$widgetHTML = wf_widget($wf_metas[0]);\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t\t//Echo the widget,\n\t\tif($widgetHTML !== false) {\n\t\t\tif($retData) { return $widgetHTML; }\n\t\t\telse { echo $widgetHTML; }\n\t\t}\n\t\t//Return the widget's HTML,\n\t\telse {\n\t\t\tif($retData) { return $widgetHTML; }\n\t\t\telse { echo $error; }\n\t\t}\n\t\t\n\t}",
"public function widget( $args, $instance ) {\n\n global $wt_cozy;\n?>\n <!-- BEGIN SIDEBAR AGENTS -->\n <div class=\"col-sm-12\">\n <?php\n $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base );\n if ( ! empty( $title ) ) {\n echo '<h2 class=\"section-title\" data-animation-direction=\"from-bottom\" data-animation-delay=\"50\">' . $title . '</h2>';\n }\n ?>\n <ul class=\"agency-detail-agents\">\n\n <?php\n $number = ( ! empty( $instance['number'] ) ) ? absint( $instance['number'] ) : 4;\n if ( ! $number )\n $number = 4;\n $args = array(\n 'post_type' => 'agent',\n 'post_status' => 'publish',\n 'posts_per_page' => $number,\n );\n $agent_query = new WP_Query( $args );?>\n <?php while($agent_query->have_posts()): $agent_query->the_post(); ?>\n\n <li class=\"col-lg-12\" data-animation-direction=\"from-bottom\" data-animation-delay=\"200\">\n <a href=\"<?php the_permalink(); ?>\"><?php\n if ( has_post_thumbnail() ) {\n the_post_thumbnail('agent', array('class' => 'img-responsive'));\n }\n else {\n echo '<img src=\"http://placehold.it/307x307\" alt=\"placeholder\" />';\n }\n ?></a>\n <div class=\"info\">\n\n <?php if ( is_page_template('page-home-search.php')) {\n the_title( sprintf( '<h3><a href=\"%s\">', esc_url( get_permalink() ) ), '</a></h3>' );\n }\n else {\n the_title( sprintf( '<a href=\"%s\"><h3>', esc_url( get_permalink() ) ), '</h3></a>' );\n }\n ?>\n <span class=\"location\"><?php echo $text = get_post_meta( get_the_ID(), '_wt_agent_address', true ); ?></span>\n <?php\n $agent_description = do_shortcode(wpautop(get_post_meta( get_the_ID(), '_wt_agent_description', true )));\n $description_limit = 100;\n if(strlen($agent_description) <= $description_limit) {\n echo $agent_description;\n } else {\n echo substr($agent_description, 0, $description_limit);\n }\n ?>\n <div class=\"clearfix\"></div>\n <a href=\"<?php the_permalink(); ?>\"><?php _e('Learn More »', 'cozy'); ?></a>\n </div>\n </li>\n\n <?php endwhile; ?>\n <?php wp_reset_postdata(); ?>\n\n </ul>\n </div>\n <!-- END SIDEBAR AGENTS -->\n\n<?php\n }",
"function add_new_widget(){\n\t\t?>\n\t\t<div id=\"ww-add-new-widget\">\n\t\t\t<h2><?php _e('Add Widget', 'widgetwrangler'); ?></h2>\n\t\t\t<div class=\"ww-inner\">\n\t\t\t\t<select id=\"ww-add-new-widget-widget\">\n\t\t\t\t\t<option value=\"0\">-- <?php _e('Select a Widget', 'widgetwrangler'); ?> --</option>\n\t\t\t\t\t<?php foreach ( $this->all_widgets as $widget ){ ?>\n\t\t\t\t\t\t<option value=\"<?php print esc_attr( $widget->ID ); ?>\"><?php print $widget->post_title; ?></option>\n\t\t\t\t\t<?php } ?>\n\t\t\t\t</select>\n\t\t\t\t<select id=\"ww-add-new-widget-corral\">\n\t\t\t\t\t<option value=\"0\">-- <?php _e('Select a Corral', 'widgetwrangler'); ?> --</option>\n\t\t\t\t\t<?php foreach($this->all_corrals as $corral_slug => $corral_name) { ?>\n\t\t\t\t\t\t<option value=\"<?php print esc_attr( $corral_slug ); ?>\"><?php print $corral_name; ?></option>\n\t\t\t\t\t<?php } ?>\n\t\t\t\t</select>\n\t\t\t\t<span id=\"ww-add-new-widget-button\" class=\"button button-large\"><?php _e('Add Widget to Corral', 'widgetwrangler'); ?></span>\n\t\t\t</div>\n\t\t\t<p class=\"description ww-inner\"><?php _e('Select a widget you would like to add, and the corral where you would like to add it. Click the button Add Widget to Corral.', 'widgetwrangler'); ?></p>\n\n\t\t\t<script type=\"text/html\" id=\"tmpl-add-widget\">\n\t\t\t\t<?php\n\t\t\t\t$tmpl_widget = array(\n\t\t\t\t\t'weight' => '__widget-weight__',\n\t\t\t\t\t'id' => '__widget-ID__',\n\t\t\t\t\t'title' => '__widget-post_title__',\n\t\t\t\t\t'corral' => array(\n\t\t\t\t\t\t'slug' => '__widget-corral_slug__',\n\t\t\t\t\t),\n\t\t\t\t);\n\n\t\t\t\tprint $this->sortable_corral_item( $tmpl_widget, '__ROW-INDEX__' );\n\t\t\t\t?>\n\t\t\t</script>\n\t\t</div>\n\t\t<?php\n\t\t//\n\t}",
"function wp_dashboard_trigger_widget_control($widget_control_id = \\false)\n {\n }",
"public static function widget() {\n\t\t$username = self::get_dashboard_widget_option(self::wid, 'username');\n\t\t$apikey = self::get_dashboard_widget_option(self::wid, 'apikey');\n\t\t$project_id = self::get_dashboard_widget_option(self::wid, 'project_id');\n\t\t$ref_url = 'http://go.endcore.64905.digistore24.com/';\n\t\t$check = ($username && $apikey && $project_id ? true : false);\n \n\t\tif(!$check) {\n\t\t\techo '<h4 style=\"text-align:right; padding-right: 40px; padding-top: 10px\">' . __( 'Bitte prüfe die Einstellungen ∧', 'affiliatetheme-backend' ) . '</h4> ';\n ?>\n <div class=\"rankalyst-text\">\n <a href=\"<?php echo $ref_url; ?>\" target=\"_blank\"><img src=\"<?php echo get_template_directory_uri(); ?>/_/img/rankalyst.png\"></a>\n <p><?php printf(__('Mit <a href=\"%s\" target=\"_blank\">Rankalyst</a> kannst du 10 Keywords kostenlos tracken!', 'affiliatetheme-backend'), $ref_url); ?></p>\n <a href=\"<?php echo $ref_url; ?>\" target=\"_blank\" class=\"button button-primary\"><?php _e('Kostenlos starten', 'affiliatetheme-backend'); ?></a>\n </div>\n <?php\n\t\t}\n\t\t\n\t\t/* @TODO Rankingchange <span class=\"plus\">+</span> bzw Minus ausgeben, jenachdem ob Change positiv oder negativ. */\n\n ?>\n <div class=\"rankalyst-data\">\n <ul class=\"rankalyst-tabs\">\n <li><a href=\"#\" data-type=\"organic\" class=\"active\"><?php _e('Organic', 'affiliatetheme-backend'); ?></a></li>\n <li><a href=\"#\" data-type=\"mobile\"><?php _e('Mobile', 'affiliatetheme-backend'); ?></a></li>\n <li><a href=\"#\" data-type=\"local\"><?php _e('Local', 'affiliatetheme-backend'); ?></a></li>\n </ul>\n\n <div class=\"rankalyst-tab active\" data-type=\"organic\">\n <?php\n $rankalyst = new AT_Rankalyst_API($username, $apikey, $project_id, 1);\n if($rankalyst) {\n\t $response = $rankalyst->data();\n\t if($response) {\n\t\t if ( $response->status != 'success' ) {\n\t\t\t echo '<div class=\"rankalyst-text\"><p style=\"color: #c01313; margin-top: 10px\">' . $response->message . '</p></div>';\n\t\t } else {\n\t\t\t if ( $response->data ) {\n\t\t\t\t $data = $response->data->items;\n\t\t\t\t $rankalyst->output( $data );\n\t\t\t }\n\t\t }\n\t }\n }\n ?>\n </div>\n\n <div class=\"rankalyst-tab\" data-type=\"mobile\">\n <?php\n $rankalyst = new AT_Rankalyst_API($username, $apikey, $project_id, 2);\n if($rankalyst) {\n\t $response = $rankalyst->data();\n\t if($response) {\n\t\t if ( $response->status != 'success' ) {\n\t\t\t echo '<div class=\"rankalyst-text\"><p style=\"color: #c01313; margin-top: 10px\">' . $response->message . '</p></div>';\n\t\t } else {\n\t\t\t if ( $response->data ) {\n\t\t\t\t $data = $response->data->items;\n\t\t\t\t $rankalyst->output( $data );\n\t\t\t }\n\t\t }\n\t }\n }\n ?>\n </div>\n\n <div class=\"rankalyst-tab\" data-type=\"local\">\n <?php\n $rankalyst = new AT_Rankalyst_API($username, $apikey, $project_id, 3);\n if($rankalyst) {\n\t $response = $rankalyst->data();\n\t if($response) {\n\t\t if ( $response->status != 'success' ) {\n\t\t\t echo '<div class=\"rankalyst-text\"><p style=\"color: #c01313; margin-top: 10px\">' . $response->message . '</p></div>';\n\t\t } else {\n\t\t\t if ( $response->data ) {\n\t\t\t\t $data = $response->data->items;\n\t\t\t\t $rankalyst->output( $data );\n\t\t\t }\n\t\t }\n\t }\n }\n ?>\n </div>\n </div>\n <?php\n }",
"function MCW_eval_foreign_widget($id, $mcw_theme){\n\n global $wp_registered_widgets;\n\n\n\n $params = array_merge(\n\n array( array_merge( $mcw_theme, array('widget_id' => $id, 'widget_name' => $wp_registered_widgets[$id]['name']) ) ),\n\n (array) $wp_registered_widgets[$id]['params']\n\n );\n\n// Substitute HTML id and class attributes into before_widget\n\n $classname_ = '';\n\n foreach ( (array) $wp_registered_widgets[$id]['classname'] as $cn ) {\n\n if ( is_string($cn) )\n\n $classname_ .= '_' . $cn;\n\n elseif ( is_object($cn) )\n\n $classname_ .='_' . get_class($cn);\n\n }\n\n $classname_ = ltrim($classname_, '_');\n\n $params[0]['before_widget'] = sprintf($params[0]['before_widget'], $id, $classname_);\n\n $params = apply_filters('dynamic_sidebar_params', $params );\n\n $callback = $wp_registered_widgets[$id]['callback'];\n\n if ( is_callable($callback) ) {\n\n ob_start();\n\n call_user_func_array($callback, $params);\n\n $output = ob_get_contents();\n\n ob_end_clean();\n\n }\n\n return $output;\n\n }",
"function wp_assign_widget_to_sidebar($widget_id, $sidebar_id)\n {\n }",
"function wpwl_load_widget() {\n register_widget( 'wpwl_widget' );\n}",
"function docuemtation_dashboard_widget_function() {\n\t// Display whatever it is you want to show\n\techo 'Make sure you watch the videos in 720p resolution.<br/>\n<a href=\"http://youtu.be/vA3fXuhbmjg\" target=\"_blank\">Welcome and Workflow</a> (1:32)<br/>\n<a href=\"http://youtu.be/1EYJ2xuJOB4\" target=\"_blank\">Resize Images</a> (3:55)<br/>\n<a href=\"http://youtu.be/KVGK5FKm-Ng\" target=\"_blank\">Upload Images to Dropbox</a> (1:10)<br/>\n<a href=\"http://youtu.be/g_XfK9iLv7s\" target=\"_blank\">The Dashboard</a> (3:53)<br/>\n<a href=\"http://youtu.be/ZntfnFEocn8\" target=\"_blank\">Writing and Saving a Draft</a> (6:10)<br/>\n<a href=\"http://youtu.be/vSx0xOQms78\" target=\"_blank\">Changing Post Status</a> (0:34)<br/>\n<a href=\"http://youtu.be/GZvMRQlP-9c\" target=\"_blank\">Upload to and Crop Images on Website</a> (5:46)<br/>\n<a href=\"http://youtu.be/zrBjk92WQB4\" target=\"_blank\">Publish Cat Profile</a> (1:12)<br/>\nCreate a PDF of profile (later, I have to make a few modifications first)';\n}",
"function inhabitent_widget() {\nregister_sidebar(array(\n'name' => 'Sidebar Info',\n'id' => 'sidebar-info',\n'description' => 'Add a text block with your business hours',\n// 'before_widget' => '<aside id=\"%1$s\">',\n'before_widget' => '<aside>',\n'after_widget' => '</aside>',\n'before_title' => '<h2 class=\"widget-title\">',\n'after_title' => '</h2>'\n));\n\n// We registered a sidebar into the WP backend....so we could put widgets into it.\t\nregister_sidebar(array(\n\t'name' => 'Footer Info',\n\t'id' => 'footer-info',\n\t'description' => 'Add a text block for your footer',\n\t'before_widget' => '<aside class=\"%1$s\">',\n\t'after_widget' => '</aside>',\n\t'before_title' => '<h2 class=\"widget-title\">',\n\t'after_title' => '</h2>'\n\t));\n\n}",
"function wp_find_widgets_sidebar($widget_id)\n {\n }",
"function widget( $args, $instance ) {\n // kick things off\n extract( $args );\n echo $before_widget; \n echo $before_title . $after_title; \n\n ?>\n <?php //Example html markup to show on the website ?>\n <ul class=\"infopage-list\">\n <li>\n <div>\n <img src=\"<?php echo get_stylesheet_directory_uri(); ?>/dist/img/ico_phone.svg\" alt=\"\">\n </div>\n <div>\n Llámanos<br><a href=\"tel:<?php echo $instance[\"phone\"]; ?>\"><?php echo $instance[\"phone\"]; ?></a>\n </div>\n </li>\n <li>\n <div>\n <img src=\"<?php echo get_stylesheet_directory_uri(); ?>/dist/img/ico_mail.svg\" alt=\"\">\n </div>\n <div>\n Escríbenos<br><a href=\"mailto:<?php echo $instance[\"email\"]; ?>\"><?php echo $instance[\"email\"]; ?></a>\n </div>\n </li>\n <li>\n <div>\n <img src=\"<?php echo get_stylesheet_directory_uri(); ?>/dist/img/ico_direccion.svg\" alt=\"\">\n </div>\n <div>\n Encuéntranos<br><a target=\"_blank\" href=\"<?php echo $instance[\"gmaps_link\"]; ?>\"><?php echo $instance[\"address\"]; ?></a>\n </div>\n </li>\n </ul>\n\t <?php\n\n }",
"function wp_widget_description($id)\n {\n }",
"public function getWidget($widgetId);",
"function SetWidget() {\n\t\t\n\t\t\tif ( !function_exists('register_sidebar_widget') ) \n\t\t\treturn;\n\t\t\t\n\t\t\t// This registers our widget so it appears with the other available\n\t\t\t// widgets and can be dragged and dropped into any active sidebars.\n\t\t\tregister_sidebar_widget(array('3B Meteo', 'widgets'), array(\"TreBiMeteo\",'WidgetMeteo'));\n\t\t\n\t\t\t// This registers our optional widget control form.\n\t\t\tregister_widget_control(array('3B Meteo', 'widgets'), array(\"TreBiMeteo\",'WidgetMeteoControl'), 450, 325);\n\t\t}",
"public function add_widget_box() {\n\t\t\t$nonce = wp_create_nonce ( 'delete-wprt-widget_area-nonce' ); ?>\n\t\t\t <script type=\"text/html\" id=\"wprt-add-widget-template\">\n\t\t\t\t<div id=\"wprt-add-widget\" class=\"widgets-holder-wrap\">\n\t\t\t\t <div class=\"\">\n\t\t\t\t <input type=\"hidden\" name=\"wprt-nonce\" value=\"<?php echo esc_attr( $nonce ); ?>\" />\n\t\t\t\t <div class=\"sidebar-name\">\n\t\t\t\t <h3><?php esc_html_e( 'Create a Widget Area', 'fundrize' ); ?> <span class=\"spinner\"></span></h3>\n\t\t\t\t </div>\n\t\t\t\t <div class=\"sidebar-description\">\n\t\t\t\t\t<form id=\"addWidgetAreaForm\" action=\"\" method=\"post\">\n\t\t\t\t\t <div class=\"widget-content\">\n\t\t\t\t\t\t<input id=\"wprt-add-widget-input\" name=\"wprt-add-widget-input\" type=\"text\" class=\"regular-text\" title=\"<?php esc_attr_e( 'Name', 'fundrize' ); ?>\" placeholder=\"<?php esc_attr_e( 'Name', 'fundrize' ); ?>\" />\n\t\t\t\t\t </div>\n\t\t\t\t\t <div class=\"widget-control-actions\">\n\t\t\t\t\t\t<div class=\"aligncenter\">\n\t\t\t\t\t\t <input class=\"addWidgetArea-button button-primary\" type=\"submit\" value=\"<?php esc_attr_e( 'Create Widget Area', 'fundrize' ); ?>\" />\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<br class=\"clear\">\n\t\t\t\t\t </div>\n\t\t\t\t\t</form>\n\t\t\t\t </div>\n\t\t\t\t </div>\n\t\t\t\t</div>\n\t\t\t </script>\n\t\t\t<?php\n\t\t}",
"static function add_widget_to_sidebar($sidebar_id, $widget_name, $atts) {\n\n $widget_instances = get_option('widget_' . $widget_name);\n //All demo widgets will have an instance id of 99+\n $widget_instances[self::$last_widget_instance] = $atts;\n\n //add widget instance to DB\n update_option('widget_' . $widget_name, $widget_instances);\n $sidebars_widgets = get_option( 'sidebars_widgets' );\n $sidebars_widgets[ale_demo_base::sidebar_name_to_id($sidebar_id)][self::$last_sidebar_widget_position] = $widget_name . '-' . self::$last_widget_instance;\n update_option('sidebars_widgets', $sidebars_widgets);\n\n\n self::$last_sidebar_widget_position++;\n self::$last_widget_instance++;\n }",
"public function getWidget();",
"function agentpress_listing_sidebar(){\n\t$format = '<section class=\"widget%4$s\"%3$s><div class=\"widget-wrap\">%1$s<div class=\"textwidget\">%2$s</div></div></section>';\n\n\t$widgets = array(\n\t\tarray(\n\t\t\t'title' => 'Property Resources',\n\t\t\t'content' => function(){\n\t\t\t\tglobal $post;\n\t\t\t\t$resources = array();\n\t\t\t\t$resource_fields = array( 'site_plan' => 'Site Plan', 'property_brochure' => 'Property Brochure' );\n\t\t\t\tforeach( $resource_fields as $field => $label ){\n\t\t\t\t\t$$field = get_field( $field );\n\t\t\t\t\tif( ! empty( $$field ) )\n\t\t\t\t\t\t$resources[$field] = array( 'label' => $label, 'value' => $$field );\n\t\t\t\t}\n\n\t\t\t\tif( ! empty( $resources ) ){\n\t\t\t\t\tforeach( $resources as $key => $field ){\n\t\t\t\t\t\t$html.= '<li><a href=\"' . $field['value'] . '\" target=\"_blank\">' . $field['label'] . '</a></li>';\n\t\t\t\t\t}\n\n\t\t\t\t\treturn '<ul>' . $html . '</ul>';\n\t\t\t\t} else {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\t\t\t},\n\t\t\t'classes' => 'primary-color',\n\t\t),\n\t\tarray(\n\t\t\t'title' => 'Request Information',\n\t\t\t'content' => '<p>Contact us for further information about this property:</p><ul>\n\t\t\t<li><a href=\"mailto:[email protected]?subject=Information%20Request: ' . get_the_title() . '\" target=\"_blank\">[email protected]</a></li>\n\t\t\t</ul>',\n\t\t\t'classes' => 'primary-color',\n\t\t),\n\t);\n\n\tforeach( $widgets as $widget ){\n\t\t// Check `content` for an anonymous function\n\t\t$content = ( is_callable( $widget['content'] ) )? $widget['content']() : $widget['content'];\n\t\tif( empty( $content ) )\n\t\t\tcontinue;\n\n\t\t$title = ( $widget['title'] && ! empty( $widget['title'] ) )? '<h4 class=\"widget-title widgettitle\">' . $widget['title'] . '</h4>' : '' ;\n\t\t$content = do_shortcode( $content );\n\n\t\t$attributes = '';\n\t\tif( $widget['attr'] && ! empty( $widget['attr'] ) && is_array( $widget['attr'] ) ){\n\t\t\tforeach( $widget['attr'] as $key => $value ){\n\t\t\t\t$attributes.= $key . '=\"' . esc_attr( $value ) . '\"';\n\t\t\t}\n\t\t}\n\t\t$classes = ( $widget['classes'] && ! empty( $widget['classes'] ) )? ' ' . $widget['classes'] : '';\n\n\t\techo sprintf( $format, $title, $content, $attributes, $classes );\n\t}\n}",
"public function get_widget_object($id_base)\n {\n }",
"function FoodByNight_widgets_init() {\n\n\tregister_sidebar( array(\n\t\t'name' => 'Footer Right',\n\t\t'id' => 'footer_right',\n\t\t'before_widget' => '<ul class=\"list-inline\">',\n\t\t'after_widget' => '</ul>',\n\t\t'before_title' => '<h2 class=\"rounded\">',\n\t\t'after_title' => '</h2>',\n\t) );\n\tregister_widget( 'Social_Link_Widget' );\n\n\tregister_sidebar( array(\n\t\t'name' => 'Popups',\n\t\t'id' => 'popups',\n\t\t'before_widget' => '<div>',\n\t\t'after_widget' => '</div>',\n\t\t'before_title' => '<h2 class=\"rounded\">',\n\t\t'after_title' => '</h2>',\n\t) );\n\tregister_widget( 'Contact_Popup_Widget' );\n\n}",
"public function widgets(){\n\t\t//register_widget(\"sampleWidget\");\n\t}",
"public function widgets(){\n\t\t//register_widget(\"sampleWidget\");\n\t}",
"function dl_widget_init() {\n\n\tregister_sidebar( array(\n\t\t'name'\t\t\t=> 'Página de Contacto',\n\t\t'id'\t\t\t=> 'contact-widget',\n\t\t'before_widget'\t=> '',\n\t\t'after_widget'\t=> '',\n\t\t'before_title'\t=> '',\n\t\t'after_title'\t=> '',\n\t));\n\tregister_sidebar( array(\n\t\t'name'\t\t\t=> 'Barra Lateral',\n\t\t'id'\t\t\t=> 'sidebar-widget',\n\t\t'before_widget'\t=> '',\n\t\t'after_widget'\t=> '',\n\t\t'before_title'\t=> '',\n\t\t'after_title'\t=> '',\n\t));\n\tregister_sidebar( array(\n\t\t'name'\t\t\t=> 'Search Menu',\n\t\t'id'\t\t\t=> 'menu-widget',\n\t\t'before_widget'\t=> '',\n\t\t'after_widget'\t=> '',\n\t\t'before_title'\t=> '',\n\t\t'after_title'\t=> '',\n\t));\n\n}",
"private function initializeWidgetIdentifier() {}"
] |
[
"0.6220014",
"0.6203805",
"0.6198189",
"0.6039896",
"0.59658587",
"0.5964365",
"0.5961401",
"0.59292233",
"0.59181154",
"0.5845123",
"0.58392364",
"0.5810591",
"0.5806846",
"0.57808274",
"0.57725847",
"0.5738674",
"0.5729172",
"0.5722858",
"0.5698948",
"0.5696677",
"0.5686514",
"0.56836486",
"0.5682756",
"0.5680039",
"0.5659141",
"0.56582135",
"0.5655739",
"0.5655739",
"0.5645045",
"0.5641714"
] |
0.6913781
|
0
|
Form constructor for the Settings / Default Email Address config page.
|
function room_reservations_admin_settings_default_email($form, &$form_state) {
$options = array(
'0' => t('Do not set a default email address.'),
'1' => t('Set the default email address equal to the user ID.'),
'2' => t('Set the default email address equal to the user ID plus the domain name entered below.'),
);
$default_option = _room_reservations_get_variable('default_email_address');
$default_domain = _room_reservations_get_variable('default_email_domain');
$form['options'] = array(
'#title' => t('Options'),
'#type' => 'radios',
'#options' => $options,
'#description' => t('Options for including a default email address
in the Reminders - Email Addresses field on the reservation form.'),
'#default_value' => $default_option,
'#weight' => -100,
);
$form['domain'] = array(
'#title' => t('Domain Name'),
'#type' => 'textfield',
'#description' => t('The domain name that is added to the user
name to create the default email address on the reservation form.
Required if the third option above is selected.'),
'#default_value' => $default_domain,
'#maxlength' => 80,
'#size' => 80,
'#weight' => -90,
);
$form['save'] = array(
'#type' => 'submit',
'#value' => t('Save configuration'),
'#weight' => 100,
);
$form['reset'] = array(
'#type' => 'submit',
'#value' => t('Reset to defaults'),
'#weight' => 101,
);
return $form;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function configure()\n\t{\n\t\t$ui = new FormUI( 'jambo_config' );\n\n\t\t// Add a text control for the address you want the email sent to\n\t\t$send_to = $ui->append( 'text', 'send_to', 'option:jambo__send_to', _t('Where To Send Email: ', 'jambo') );\n\t\t$send_to->add_validator( 'validate_required' );\n\n\t\t// Add a text control for email subject\n\t\t$subject = $ui->append( 'text', 'subject', 'option:jambo__subject', _t('Subject: ', 'jambo') );\n\t\t$subject->add_validator( 'validate_required' );\n\n\t\t// Add an explanation for the subject field. Shouldn't FormUI have an easier way to do this?\n\t\t$ui->append( 'static', 'subject_explanation', '<p>' . _t('An %s in the subject will be replaced with a subject provided by the user. If omitted, no subject will be requested.', 'jambo') . '</p>' );\n\n\t\t// Add a text control for the prefix to the success message\n\t\t$success_msg = $ui->append( 'textarea', 'success_msg', 'option:jambo__success_msg', _t('Success Message: ', 'jambo') );\n\n\t\t$ui->append( 'submit', 'save', _t('Save', 'jambo') );\n\t\treturn $ui;\n\t}",
"public function __construct() {\n\n\t\t$this->options = Options::init();\n\n\t\t// Set parent defaults.\n\t\tparent::__construct(\n\t\t\tarray(\n\t\t\t\t'singular' => 'email',\n\t\t\t\t'plural' => 'emails',\n\t\t\t\t'ajax' => false,\n\t\t\t\t'screen' => 'wp-mail-smtp_page_wp-mail-smtp-logs',\n\t\t\t)\n\t\t);\n\t}",
"private function initMailOptionsForm()\n\t{\n\t\tglobal $ilCtrl, $ilSetting, $lng, $ilUser;\t\n\t\t\n\t\tinclude_once 'Services/Form/classes/class.ilPropertyFormGUI.php';\n\t\t$this->form = new ilPropertyFormGUI();\n\t\t\n\t\t$this->form->setFormAction($ilCtrl->getFormAction($this, 'saveMailOptions'));\n\t\t$this->form->setTitle($lng->txt('mail_settings'));\n\t\t\t\n\t\t// BEGIN INCOMING\n\t\tinclude_once 'Services/Mail/classes/class.ilMailOptions.php';\n\t\tif($ilSetting->get('usr_settings_hide_mail_incoming_mail') != '1')\n\t\t{\n\t\t\t$options = array(\n\t\t\t\tIL_MAIL_LOCAL => $this->lng->txt('mail_incoming_local'), \n\t\t\t\tIL_MAIL_EMAIL => $this->lng->txt('mail_incoming_smtp'),\n\t\t\t\tIL_MAIL_BOTH => $this->lng->txt('mail_incoming_both')\n\t\t\t);\n\t\t\t$si = new ilSelectInputGUI($lng->txt('mail_incoming'), 'incoming_type');\n\t\t\t$si->setOptions($options);\n\t\t\tif(!strlen(ilObjUser::_lookupEmail($ilUser->getId())) ||\n\t\t\t $ilSetting->get('usr_settings_disable_mail_incoming_mail') == '1')\n\t\t\t{\n\t\t\t\t$si->setDisabled(true);\t\n\t\t\t}\n\t\t\t$this->form->addItem($si);\n\t\t}\n\t\t\n\t\t// BEGIN LINEBREAK_OPTIONS\n\t\t$options = array();\n\t\tfor($i = 50; $i <= 80; $i++)\n\t\t{\n\t\t\t$options[$i] = $i; \n\t\t}\t\n\t\t$si = new ilSelectInputGUI($lng->txt('linebreak'), 'linebreak');\n\t\t$si->setOptions($options);\t\t\t\n\t\t$this->form->addItem($si);\n\t\t\n\t\t// BEGIN SIGNATURE\n\t\t$ta = new ilTextAreaInputGUI($lng->txt('signature'), 'signature');\n\t\t$ta->setRows(10);\n\t\t$ta->setCols(60);\t\t\t\n\t\t$this->form->addItem($ta);\n\t\t\n\t\t// BEGIN CRONJOB NOTIFICATION\n\t\tif($ilSetting->get('mail_notification'))\n\t\t{\n\t\t\t$cb = new ilCheckboxInputGUI($lng->txt('cron_mail_notification'), 'cronjob_notification');\t\t\t\n\t\t\t$cb->setInfo($lng->txt('mail_cronjob_notification_info'));\n\t\t\t$cb->setValue(1);\n\t\t\t$this->form->addItem($cb);\n\t\t}\t\t\n\t\t\n\t\t$this->form->addCommandButton('saveMailOptions', $lng->txt('save'));\n\t}",
"function room_reservations_admin_settings_default_email_submit($form_id, &$form_state) {\n if ($form_state['clicked_button']['#value'] == t('Save configuration')) {\n $option = $form_state['values']['options'];\n $domain = trim($form_state['values']['domain']);\n $confirmation = ROOM_RESERVATIONS_SAVE_CONFIRMATION_MSG;\n $error = ROOM_RESERVATIONS_SAVE_ERROR_MSG;\n }\n elseif ($form_state['clicked_button']['#value'] == t('Reset to defaults')) {\n $option = 0;\n $domain = '';\n $confirmation = ROOM_RESERVATIONS_RESET_CONFIRMATION_MSG;\n $error = ROOM_RESERVATIONS_RESET_ERROR_MSG;\n }\n $errors = FALSE;\n $result = _room_reservations_set_variable('default_email_address', $option);\n if (!$result) {\n $errors = TRUE;\n }\n $result = _room_reservations_set_variable('default_email_domain', $domain);\n if (!$result) {\n $errors = TRUE;\n }\n if ($errors) {\n drupal_set_message(check_plain($error), 'error');\n }\n else {\n drupal_set_message(check_plain($confirmation));\n }\n}",
"function _webform_defaults_email() {\r\n return array(\r\n 'name' => '',\r\n 'form_key' => NULL,\r\n 'pid' => 0,\r\n 'weight' => 0,\r\n 'value' => '',\r\n 'mandatory' => 0,\r\n 'email' => 1,\r\n 'extra' => array(\r\n 'width' => '',\r\n 'disabled' => 0,\r\n 'email' => 0,\r\n 'description' => '',\r\n 'attributes' => array(),\r\n ),\r\n );\r\n}",
"public function configForm(&$form_state) {\n $form = parent::configForm($form_state);\n unset($form['input_format']);\n\n $author = user_load($this->config['author']);\n $form['author'] = array(\n '#type' => 'textfield',\n '#title' => t('Author'),\n '#description' => t('Select the author of the organizations to be created - leave empty to assign \"anonymous\".'),\n '#autocomplete_path' => 'user/autocomplete',\n '#default_value' => empty($author->name) ? 'anonymous' : check_plain($author->name),\n );\n\n return $form;\n }",
"protected function setDefaults(): void {\n\t\t$fromEmail = Configure::read('Config.systemEmail');\n\t\tif ($fromEmail) {\n\t\t\t$fromName = Configure::read('Config.systemName');\n\t\t} else {\n\t\t\t$fromEmail = Configure::read('Config.adminEmail');\n\t\t\t$fromName = Configure::read('Config.adminName');\n\t\t}\n\t\tif ($fromEmail) {\n\t\t\t$this->setFrom($fromEmail, $fromName);\n\t\t}\n\t}",
"public function __construct() {\n $this->emailLogin = '[email protected]';\n }",
"public function load_with_defaults ()\n {\n parent::load_with_defaults ();\n $this->set_value ('email_type', 'single_mail');\n }",
"public function init_form_fields() {\n\t\t$this->form_fields = [\n\t\t\t'enabled' => [\n\t\t\t\t'title' => 'Enable/Disable',\n\t\t\t\t'type' => 'checkbox',\n\t\t\t\t'label' => 'Enable this email digest',\n\t\t\t\t'default' => 'no'\n\t\t\t],\n\t\t\t'recipient' => [\n\t\t\t\t'title' => 'Recipient(s)',\n\t\t\t\t'type' => 'text',\n\t\t\t\t'description' => 'Enter recipients (comma separated) for this email. Defaults to ' . get_option( 'admin_email' ),\n\t\t\t\t'placeholder' => '',\n\t\t\t\t'default' => '',\n\t\t\t],\n\t\t\t'schedule' => [\n\t\t\t\t'type' => 'select',\n\t\t\t\t'title' => 'Scheduled Frequency',\n\t\t\t\t'description' => 'Weekly emails will be sent on Mondays. All emails are sent at 7:00am.',\n\t\t\t\t'options' => [\n\t\t\t\t\t'daily' => 'Daily',\n\t\t\t\t\t'weekly' => 'Weekly'\n\t\t\t\t],\n\t\t\t\t'default' => 'daily'\n\t\t\t],\n\t\t\t'email_type' => [\n\t\t\t\t'title' => 'Email type',\n\t\t\t\t'type' => 'select',\n\t\t\t\t'description' => 'Choose which format of email to send.',\n\t\t\t\t'default' => 'html',\n\t\t\t\t'class' => 'email_type wc-enhanced-select',\n\t\t\t\t'options' => $this->get_email_type_options(),\n\t\t\t\t'desc_tip' => true,\n\t\t\t],\n\t\t\t'send_now' => [\n\t\t\t\t'title' => 'Send now?',\n\t\t\t\t'type' => 'checkbox',\n\t\t\t\t'label' => 'Yes, send the email digest on save',\n\t\t\t\t'default' => 'no'\n\t\t\t]\n\t\t];\n\t}",
"function coenv_setting_public_email_address() {\n\t$value = get_option('public_email_address');\n\n\t?>\t\n\t\t<p>The public email address of the unit.</p>\n\t\t\t\t<input name=\"public_email_address\" type=\"text\" id=\"public_email_address\" value=\"<?php echo $value; ?>\" class=\"regular-text\">\n\t<?php\n}",
"function setEmailForm(&$smartyEmailForm) {\n\t\t//Check if there is a valid email address in the database for the given combination of employee, service, position and organisation id\n\t\tif ($this->getEmailAddress($smartyEmailForm) || $this->piVars['mode'] == 'set_contact_form') {\n\t\t\tif($this->getEmailAddress($smartyEmailForm)){\n\t\t\t\t//Assign action url of email form with mode 'check_email_form'\n\t\t\t\t$smartyEmailForm->assign('action_url',htmlspecialchars($this->pi_linkTP_keepPIvars_url(array(mode => 'check_email_form'),0,0)));\n\t\t\t}else{\n\t\t\t\t//Assign action url of email form with mode 'check_contact_form'\n\t\t\t\t$smartyEmailForm->assign('action_url',htmlspecialchars($this->pi_linkTP_keepPIvars_url(array(mode => 'check_contact_form'),0,0)));\n\t\t\t}\n\n\t\t\t//Assign template labels\n\t\t\t$hoster_email=$this->get_hoster_email();\n\t\t\t$smartyEmailForm->assign('email_form_label',$this->pi_getLL('tx_civserv_pi1_email_form.email_form','E-Mail Form'));\n\t\t\t$smartyEmailForm->assign('contact_form_label',str_replace('###HOSTER###', $hoster_email, $this->pi_getLL('tx_civserv_pi1_email_form.contact_form','Contact '.$hoster_email)));\n\t\t\t$smartyEmailForm->assign('notice_label',$this->pi_getLL('tx_civserv_pi1_email_form.notice','Please enter your postal address oder email address, so that we can send you an answer'));\n\t\t\t$smartyEmailForm->assign('title_label', $this->pi_getLL('tx_civserv_pi1_email_form.title','Title'));\n\t\t\t$smartyEmailForm->assign('chose_option', $this->pi_getLL('tx_civserv_pi1_email_form.chose','Please chose'));\n\t\t\t$smartyEmailForm->assign('female_option', $this->pi_getLL('tx_civserv_pi1_email_form.female','Ms.'));\n\t\t\t$smartyEmailForm->assign('male_option', $this->pi_getLL('tx_civserv_pi1_email_form.male','Mr.'));\n\t\t\t$smartyEmailForm->assign('firstname_label',$this->pi_getLL('tx_civserv_pi1_email_form.firstname','Firstname'));\n\t\t\t$smartyEmailForm->assign('surname_label',$this->pi_getLL('tx_civserv_pi1_email_form.surname','Surname'));\n\t\t\t$smartyEmailForm->assign('street_label',$this->pi_getLL('tx_civserv_pi1_email_form.street','Street, Nr.'));\n\t\t\t$smartyEmailForm->assign('postcode_label',$this->pi_getLL('tx_civserv_pi1_email_form.postcode','Postcode'));\n\t\t\t$smartyEmailForm->assign('city_label',$this->pi_getLL('tx_civserv_pi1_email_form.city','City'));\n\t\t\t$smartyEmailForm->assign('email_label',$this->pi_getLL('tx_civserv_pi1_email_form.email','E-Mail'));\n\t\t\t$smartyEmailForm->assign('phone_label',$this->pi_getLL('tx_civserv_pi1_email_form.phone','Phone'));\n\t\t\t$smartyEmailForm->assign('fax_label',$this->pi_getLL('tx_civserv_pi1_email_form.fax','Fax'));\n\t\t\t$smartyEmailForm->assign('subject_label',$this->pi_getLL('tx_civserv_pi1_email_form.subject','Subject'));\n\t\t\t$smartyEmailForm->assign('bodytext_label',$this->pi_getLL('tx_civserv_pi1_email_form.bodytext','Your text'));\n\t\t\t$smartyEmailForm->assign('submit_label',$this->pi_getLL('tx_civserv_pi1_email_form.submit','Send e-mail'));\n\t\t\t$smartyEmailForm->assign('reset_label',$this->pi_getLL('tx_civserv_pi1_email_form.reset','Reset'));\n\t\t\t$smartyEmailForm->assign('required_label',$this->pi_getLL('tx_civserv_pi1_email_form.required','required'));\n\n\t\t\t//Set reset button type to reset functionality\n\t\t\t$smartyEmailForm->assign('button_type','reset');\n\n\t\t\treturn true;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}",
"public function __construct() {\r\n $this->html = false;\r\n $this->setFrom(EMAIL_FROM);\r\n }",
"function room_reservations_admin_settings_default_email_validate(\n $form_id, &$form_state) {\n if ($form_state['clicked_button']['#value'] == t('Save configuration')) {\n $option = $form_state['values']['options'];\n $domain = trim($form_state['values']['domain']);\n if (($option == 2) && (!$domain)) {\n $field = 'domain';\n $message = t('A domain name must be entered when this option is selected.');\n form_set_error($field, check_plain($message));\n }\n }\n}",
"public function init_form_fields()\n {\n\n // Get available placeholders for this email\n $placeholder_text = sprintf(__('Available placeholders: %s', 'subscriptio'), '<code>' . esc_html(implode('</code>, <code>', array_keys($this->placeholders))) . '</code>');\n\n // Define form fields\n $this->form_fields = array(\n 'enabled' => array(\n 'title' => __('Enable/Disable', 'subscriptio'),\n 'type' => 'checkbox',\n 'label' => __('Enable this email notification', 'subscriptio'),\n 'default' => 'yes',\n ),\n 'send_to_admin' => array(\n 'title' => __('Send to admin', 'subscriptio'),\n 'type' => 'checkbox',\n 'label' => __('Send BCC copy to admin', 'subscriptio'),\n 'default' => 'no',\n ),\n 'subject' => array(\n 'title' => __('Subject', 'subscriptio'),\n 'type' => 'text',\n 'desc_tip' => true,\n 'description' => $placeholder_text,\n 'placeholder' => $this->get_default_subject(),\n 'default' => '',\n ),\n 'heading' => array(\n 'title' => __('Email heading', 'subscriptio'),\n 'type' => 'text',\n 'desc_tip' => true,\n 'description' => $placeholder_text,\n 'placeholder' => $this->get_default_heading(),\n 'default' => '',\n ),\n 'additional_content' => array(\n 'title' => __('Additional content', 'subscriptio'),\n 'description' => __( 'Text to appear to appear below the main email content.', 'subscriptio' ) . ' ' . $placeholder_text,\n 'css' => 'width: 400px; height: 75px;',\n 'placeholder' => __('N/A', 'subscriptio'),\n 'type' => 'textarea',\n 'default' => $this->get_default_additional_content(),\n 'desc_tip' => true,\n ),\n 'email_type' => array(\n 'title' => __('Email type', 'subscriptio'),\n 'type' => 'select',\n 'description' => __('Choose which format of email to send.', 'subscriptio'),\n 'default' => 'html',\n 'class' => 'email_type wc-enhanced-select',\n 'options' => $this->get_email_type_options(),\n 'desc_tip' => true,\n ),\n );\n }",
"public function init()\n {\n parent::init();\n\n //customize the form\n $this->getElement('passwd')->setRequired(false);\n $this->getElement('passwdVerify')->setRequired(false);\n $this->getElement('submit')->setLabel('Save User');\n }",
"public function init_form_fields() {\n $this->form_fields = array(\n 'enabled' => array(\n 'title' => __( 'Enable/Disable', 'dokan' ),\n 'type' => 'checkbox',\n 'label' => __( 'Enable this email notification', 'dokan' ),\n 'default' => 'yes',\n ),\n 'subject' => array(\n 'title' => __( 'Subject', 'dokan' ),\n 'type' => 'text',\n 'desc_tip' => true,\n /* translators: %s: list of placeholders */\n 'description' => sprintf( __( 'Available placeholders: %s', 'dokan' ), '<code>{site_name},{amount},{seller_name},{order_id},{status}</code>' ),\n 'placeholder' => $this->get_default_subject(),\n 'default' => '',\n ),\n 'heading' => array(\n 'title' => __( 'Email heading', 'dokan' ),\n 'type' => 'text',\n 'desc_tip' => true,\n /* translators: %s: list of placeholders */\n 'description' => sprintf( __( 'Available placeholders: %s', 'dokan' ), '<code>{site_name},{amount},{seller_name},{order_id},{status}</code>' ),\n 'placeholder' => $this->get_default_heading(),\n 'default' => '',\n ),\n 'email_type' => array(\n 'title' => __( 'Email type', 'dokan' ),\n 'type' => 'select',\n 'description' => __( 'Choose which format of email to send.', 'dokan' ),\n 'default' => 'html',\n 'class' => 'email_type wc-enhanced-select',\n 'options' => $this->get_email_type_options(),\n 'desc_tip' => true,\n ),\n );\n }",
"public function it_shows_defined_email_type_input()\n {\n // configure\n $inputs = [\n [\n 'type' => 'email',\n 'name' => 'from_email',\n 'placeholder' => 'From Email',\n 'label' => 'From Email of app',\n 'hint' => 'You can from email of app'\n ]\n ];\n\n $this->configureInputs($inputs);\n\n // assert\n $this->get('/settings')\n ->assertStatus(200)\n ->assertSee('type=\"email\"', false);\n }",
"private function _initGeneralSettingsForm()\n\t{\n\t\tglobal $txt, $context;\n\n\t\t// Instantiate the form\n\t\t$this->_generalSettingsForm = new Settings_Form(Settings_Form::DB_ADAPTER);\n\n\t\t$config_vars = array(\n\t\t\tarray('select', 'sp_portal_mode', explode('|', $txt['sp_portal_mode_options'])),\n\t\t\tarray('check', 'sp_maintenance'),\n\t\t\tarray('text', 'sp_standalone_url'),\n\t\t\t'',\n\t\t\tarray('select', 'portaltheme', $context['SPortal']['themes']),\n\t\t\tarray('check', 'sp_disableColor'),\n\t\t\tarray('check', 'sp_disableForumRedirect'),\n\t\t\tarray('check', 'sp_disable_random_bullets'),\n\t\t\tarray('check', 'sp_disable_php_validation', 'subtext' => $txt['sp_disable_php_validation_desc']),\n\t\t\tarray('check', 'sp_disable_side_collapse'),\n\t\t\tarray('check', 'sp_resize_images'),\n\t\t\tarray('check', 'sp_disableMobile'),\n\t\t);\n\n\t\t$this->_generalSettingsForm->setConfigVars($config_vars);\n\t}",
"function buildSettingsForm() {}",
"public function form()\r\n {\r\n $this->tab(admin_trans('menu.titles.email_test'), function () {\r\n $this->text('to', admin_trans('email-test.labels.to'))->required();\r\n $this->text('title', admin_trans('email-test.labels.title'))->default('这是一条测试邮件')->required();\r\n $this->editor('body', admin_trans('email-test.labels.body'))->default(\"这是一条测试邮件的正文内容<br/><br/>正文比较长<br/><br/>非常长<br/><br/>测试测试测试\")->required();\r\n });\r\n }",
"function email_settings()\r\n\t{\r\n\t\tglobal $ibforums, $std, $print;\r\n\r\n\t\tif ($ibforums->member['disable_mail'])\r\n\t\t{\r\n\t\t\t$ibforums->lang['no_mail'] = sprintf($ibforums->lang['no_mail'], $ibforums->member['disable_mail_reason']);\r\n\r\n\t\t\t$this->output .= View::make(\"global.warn_window\", ['message' => $ibforums->lang['no_mail']]);\r\n\t\t} else\r\n\t\t{\r\n\r\n\t\t\t// PM_REMINDER: First byte = Email PM when received new\r\n\t\t\t// \t\t\tSecond byte= Show pop-up when new PM received\r\n\r\n\t\t\t$info = array();\r\n\r\n\t\t\tforeach (array('hide_email', 'allow_admin_mails', 'email_full', 'email_pm', 'auto_track') as $k)\r\n\t\t\t{\r\n\t\t\t\tif (!empty($this->member[$k]))\r\n\t\t\t\t{\r\n\t\t\t\t\t$info[$k] = 'checked';\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t$info['key'] = $this->md5_check;\r\n\r\n\t\t\t$this->output .= View::make(\"ucp.email\", ['Profile' => $info]);\r\n\t\t}\r\n\r\n\t\t$this->page_title = $ibforums->lang['t_welcome'];\r\n\t\t$this->nav = array(\"<a href='\" . $this->base_url . \"act=UserCP&CODE=00'>\" . $ibforums->lang['t_title'] . \"</a>\");\r\n\r\n\t}",
"function config_form($config, $err, $user_fields) {\n global $OUTPUT;\n \n //deserialize in case the form is being initialized with config from db\n if ( !isset( $config->hosts ) ) {\n $config = $this->deserialize_configuration( $config );\n \n }\n \n $config = $this->set_defaults( $config );\n // display one extra fieldset\n array_push($config->hosts, 'extra');\n \n include \"config.html\";\n }",
"public function init()\n {\n $request = new Zend_Controller_Request_Http();\n $domain = $request->getCookie('domain');\n $defaultBehaviors = array(\n '' => '--',\n 'Discarded' => 'Discard Email',\n 'Rejected' => 'Reject Email',\n 'Rerouted to' => 'Forward to this address:',\n 'Accepted and Bounced' => 'Accept and Bounce'\n );\n\n\n $this->addElement('text', 'domain', array(\n 'label' => 'Domain Name',\n 'readonly' => true,\n 'value' => $domain,\n 'validators' => array(\n array('NotEmpty', true),\n\n ),\n ));\n\n $this->addElement('select', 'MailToUnknown', array(\n 'label' => 'Set Default Behavior',\n 'multiOptions' => $defaultBehaviors,\n // 'required' => true,\n ));\n\n $this->addElement('text', 'MailRerouteAddress', array(\n 'label' => 'Address to forward to',\n ));\n\n $this->populate($this->getSettings());\n\n $this->addControlButtons(array(\n 'cancelLink' => pm_Context::getBaseUrl(),\n ));\n }",
"function elastic_email_settings_form() {\n global $base_url;\n\n // Add CSS to make the AJAX part of the form look a little better.\n _elastic_email_add_admin_css();\n\n // Emails won't get sent if allow_url_fopen is disabled.\n if (ini_get('allow_url_fopen') != 1) {\n drupal_set_message(t(\"You must enable 'allow_url_fopen' in your php.ini settings to be able to use this service.\"), 'error');\n }\n\n // Fieldset to hold credential fields, and Test fieldset.\n $form['credentials'] = array(\n '#type' => 'fieldset',\n '#title' => t('API Credentials'),\n );\n\n $form['credentials'][ELASTIC_EMAIL_USERNAME] = array(\n '#type' => 'textfield',\n '#size' => 48,\n '#title' => t('API username'),\n '#required' => TRUE,\n '#default_value' => variable_get(ELASTIC_EMAIL_USERNAME, ''),\n '#description' => t('This is typically your Elastic Email account email address.')\n );\n\n $form['credentials'][ELASTIC_EMAIL_API_KEY] = array(\n '#type' => 'textfield',\n '#size' => 48,\n '#title' => t('API Key'),\n '#required' => TRUE,\n '#default_value' => variable_get(ELASTIC_EMAIL_API_KEY, ''),\n '#description' => t('The API Key format is typically <tt>xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx</tt>.')\n );\n\n // DIV to hold the results of the AJAX test call.\n $form['credentials']['test']['elastic-email-test-wrapper'] = array(\n '#type' => 'markup',\n '#prefix' => '<div id=\"elastic-email-test-wrapper\">',\n '#suffix' => '</div>',\n );\n\n // Fieldset for other options.\n $form['options'] = array(\n '#type' => 'fieldset',\n '#title' => t('Options'),\n );\n\n $form['options'][ELASTIC_EMAIL_QUEUE_ENABLED] = array(\n '#type' => 'checkbox',\n '#title' => t('Queue outgoing messages'),\n '#description' => t('When checked, outgoing messages will be queued via Drupal core system queue, and delivered when the queue is emptied at cron time. When unchecked, messages are delivered immediately (synchronously). Note that synchronous delivery can cause delay in page execution time.') .\n '<br /><br />' . t('If enabled, you can use the <a href=\"@link\" target=\"_blank\">Queue UI</a> to view the queue.', array('@link' => 'https://www.drupal.org/project/queue_ui')),\n '#default_value' => variable_get(ELASTIC_EMAIL_QUEUE_ENABLED, FALSE)\n );\n\n $form['options'][ELASTIC_EMAIL_LOG_SUCCESS] = array(\n '#type' => 'checkbox',\n '#title' => t('Log message delivery success'),\n '#description' => t('When checked, a log message will also be generated for <em>successful</em> email delivery. Errors are always logged.'),\n '#default_value' => variable_get(ELASTIC_EMAIL_LOG_SUCCESS, FALSE)\n );\n\n // Fieldset for other settings.\n $form['settings'] = array(\n '#type' => 'fieldset',\n '#title' => t('Settings'),\n );\n\n $form['settings']['elastic_email_credit_low_threshold'] = array(\n '#type' => 'textfield',\n '#size' => 8,\n '#title' => t('Low Credit Threshold (USD)'),\n '#description' => t('Sets the lower threshold limit value of when to warn admin users about a low credit limit.') . '<br />' . t('(NOTE: If you are not sending out more than the Elastic Email monthly limit of 25,000 emails, set this value to zero to not show any warning).'),\n '#default_value' => variable_get('elastic_email_credit_low_threshold', 0)\n );\n\n $form['settings']['elastic_email_use_default_channel'] = array(\n '#type' => 'checkbox',\n '#title' => t('Use a Default Channel'),\n '#description' => t('If no default channel is set, then the default (set by Elastic Email) is the sending email address.<br />Setting a default channel will add this value to every email that is sent, meaning that you can more easily identify email that has come from each specific site within the reporting section.'),\n '#default_value' => variable_get('elastic_email_use_default_channel', FALSE)\n );\n\n $url = parse_url($base_url);\n $form['settings']['elastic_email_default_channel'] = array(\n '#type' => 'textfield',\n '#size' => 48,\n '#maxlength' => 60,\n '#title' => t('Default Channel'),\n '#default_value' => variable_get('elastic_email_default_channel', $url['host']),\n '#states' => array(\n 'visible' => array(\n ':input[name=\"elastic_email_use_default_channel\"]' => array('checked' => TRUE),\n ),\n ),\n );\n\n // Add the normal settings form stuff.\n $form = system_settings_form($form);\n\n // Return the form.\n return $form;\n}",
"public function initConfigurationForm()\n\t{\n\t\tglobal $lng, $ilCtrl;\n\t\t\n\t\t$pl = $this->getPluginObject();\n\t\n\t\tinclude_once(\"Services/Form/classes/class.ilPropertyFormGUI.php\");\n\t\t$form = new ilPropertyFormGUI();\n\t\n\t\t// setting 1 (a checkbox)\n\t\t$cb = new ilCheckboxInputGUI($pl->txt(\"setting_1\"), \"setting_1\");\n\t\t$form->addItem($cb);\n\t\t\n\t\t// setting 2 (text)\n\t\t$ti = new ilTextInputGUI($pl->txt(\"setting_2\"), \"setting_2\");\n\t\t$ti->setRequired(true);\n\t\t$ti->setMaxLength(10);\n\t\t$ti->setSize(10);\n\t\t$form->addItem($ti);\n\t\n\t\t$form->addCommandButton(\"save\", $lng->txt(\"save\"));\n\t \n\t\t$form->setTitle($pl->txt(\"example_plugin_configuration\"));\n\t\t$form->setFormAction($ilCtrl->getFormAction($this));\n\t\t\n\t\treturn $form;\n\t}",
"public function initializeAction() {\n $this->emailService->setSettings($this->settings[\"mail\"]);\n $this->emailService->setExtensionName($this->extensionName);\n }",
"function contact_form_init()\n{\n global $conf, $template;\n\n load_language('plugin.lang', CONTACT_FORM_PATH);\n load_language('lang', PHPWG_ROOT_PATH.PWG_LOCAL_DIR, array('no_fallback'=>true, 'local'=>true));\n\n if ($conf['ContactForm']['cf_must_initialize'])\n {\n contact_form_initialize_emails();\n }\n\n $conf['ContactForm_ready'] = count(get_contact_emails());\n\n if ($conf['ContactForm_ready'] && (!is_a_guest() || $conf['ContactForm']['cf_allow_guest']))\n {\n $template->assign(array(\n 'CONTACT_MAIL' => true,\n 'CONTACT_FORM_PUBLIC' => CONTACT_FORM_PUBLIC,\n ));\n $template->set_prefilter('tail', 'contact_form_footer_link');\n }\n}",
"function hosting_task_jenkins_settings_form() {\n\n $form['hosting_task_jenkins_url'] = array(\n '#type' => 'textfield',\n '#title' => t('Jenkins Server URL'),\n '#description' => t('The URL of your Jenkins server.'),\n '#default_value' => variable_get('hosting_task_jenkins_url', 'http://username:password@localhost:8080'),\n );\n return system_settings_form($form);\n}",
"private function _initArticleSettingsForm()\n\t{\n\t\t// instantiate the article form\n\t\t$this->_articleSettingsForm = new Settings_Form(Settings_Form::DB_ADAPTER);\n\n\t\t$config_vars = array(\n\t\t\tarray('check', 'sp_articles_index'),\n\t\t\tarray('int', 'sp_articles_index_per_page'),\n\t\t\tarray('int', 'sp_articles_index_total'),\n\t\t\tarray('int', 'sp_articles_length'),\n\t\t\t'',\n\t\t\tarray('int', 'sp_articles_per_page'),\n\t\t\tarray('int', 'sp_articles_comments_per_page'),\n\t\t\t'',\n\t\t\tarray('text', 'sp_articles_attachment_dir')\n\t\t);\n\n\t\t$this->_articleSettingsForm->setConfigVars($config_vars);\n\t}"
] |
[
"0.6699589",
"0.6668533",
"0.6594744",
"0.64387757",
"0.64181954",
"0.6314541",
"0.62428",
"0.61970025",
"0.6150757",
"0.6140132",
"0.6130782",
"0.6090605",
"0.60899144",
"0.60786504",
"0.6051308",
"0.602608",
"0.59934527",
"0.59756833",
"0.5973216",
"0.5963676",
"0.5958532",
"0.59503716",
"0.5927288",
"0.5924194",
"0.59213066",
"0.58987975",
"0.5889038",
"0.5888174",
"0.5867929",
"0.5863745"
] |
0.70523286
|
0
|
Form validation for the Settings / Default Email Address config page.
|
function room_reservations_admin_settings_default_email_validate(
$form_id, &$form_state) {
if ($form_state['clicked_button']['#value'] == t('Save configuration')) {
$option = $form_state['values']['options'];
$domain = trim($form_state['values']['domain']);
if (($option == 2) && (!$domain)) {
$field = 'domain';
$message = t('A domain name must be entered when this option is selected.');
form_set_error($field, check_plain($message));
}
}
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function room_reservations_admin_settings_email_validate($form_id, &$form_state) {\n if ($form_state['clicked_button']['#value'] == t('Save configuration')) {\n $from_address = $form_state['values']['from_address'];\n if (valid_email_address($from_address)) {\n // Valid.\n }\n else {\n $field = 'from_address';\n $message = t('Invalid email address.');\n form_set_error($field, check_plain($message));\n }\n }\n}",
"function room_reservations_admin_settings_text_validate($form_id, &$form_state) {\n if ($form_state['clicked_button']['#value'] == t('Save configuration')) {\n $from_address = $form_state['values']['from_address'];\n if (valid_email_address($from_address)) {\n // Valid.\n }\n else {\n $field = 'from_address';\n $message = t('Invalid email address.');\n form_set_error($field, check_plain($message));\n }\n }\n}",
"function student_crm_webform_send_email_form_validate($form, $form_state) {\n if (strlen(trim($form_state['values']['manual-email'])) != '' && !valid_email_address($form_state['values']['manual-email'])) {\n form_set_error('manual-email', t('The provided email address is not valid.'));\n }\n}",
"function room_reservations_admin_settings_default_email($form, &$form_state) {\n $options = array(\n '0' => t('Do not set a default email address.'),\n '1' => t('Set the default email address equal to the user ID.'),\n '2' => t('Set the default email address equal to the user ID plus the domain name entered below.'),\n );\n $default_option = _room_reservations_get_variable('default_email_address');\n $default_domain = _room_reservations_get_variable('default_email_domain');\n $form['options'] = array(\n '#title' => t('Options'),\n '#type' => 'radios',\n '#options' => $options,\n '#description' => t('Options for including a default email address\n in the Reminders - Email Addresses field on the reservation form.'),\n '#default_value' => $default_option,\n '#weight' => -100,\n );\n $form['domain'] = array(\n '#title' => t('Domain Name'),\n '#type' => 'textfield',\n '#description' => t('The domain name that is added to the user\n name to create the default email address on the reservation form.\n Required if the third option above is selected.'),\n '#default_value' => $default_domain,\n '#maxlength' => 80,\n '#size' => 80,\n '#weight' => -90,\n );\n $form['save'] = array(\n '#type' => 'submit',\n '#value' => t('Save configuration'),\n '#weight' => 100,\n );\n $form['reset'] = array(\n '#type' => 'submit',\n '#value' => t('Reset to defaults'),\n '#weight' => 101,\n );\n\n return $form;\n}",
"function osg_singout_notifier_form_validate($form, & $form_state) {\n if (!valid_email_address($form_state['values']['email'])) {\n form_set_error('email', t('That e-mail address is not valid.'));\n }\n}",
"function _webform_edit_email_validate($element, &$form_state) {\r\n if ($form_state['values']['user_email']) {\r\n $form_state['values']['value'] = '%useremail';\r\n }\r\n}",
"protected static function _email(){\n if (self::$_ruleValue) {\n $str = filter_var(trim(self::$_elementValue), FILTER_VALIDATE_EMAIL);\n if (!$str) {\n self:: setErrorMessage(\"Enter valid email\");\n self::setInvalidFlag(true);\n } else {\n self::setInvalidFlag(false);\n }\n }\n }",
"function room_reservations_admin_settings_default_email_submit($form_id, &$form_state) {\n if ($form_state['clicked_button']['#value'] == t('Save configuration')) {\n $option = $form_state['values']['options'];\n $domain = trim($form_state['values']['domain']);\n $confirmation = ROOM_RESERVATIONS_SAVE_CONFIRMATION_MSG;\n $error = ROOM_RESERVATIONS_SAVE_ERROR_MSG;\n }\n elseif ($form_state['clicked_button']['#value'] == t('Reset to defaults')) {\n $option = 0;\n $domain = '';\n $confirmation = ROOM_RESERVATIONS_RESET_CONFIRMATION_MSG;\n $error = ROOM_RESERVATIONS_RESET_ERROR_MSG;\n }\n $errors = FALSE;\n $result = _room_reservations_set_variable('default_email_address', $option);\n if (!$result) {\n $errors = TRUE;\n }\n $result = _room_reservations_set_variable('default_email_domain', $domain);\n if (!$result) {\n $errors = TRUE;\n }\n if ($errors) {\n drupal_set_message(check_plain($error), 'error');\n }\n else {\n drupal_set_message(check_plain($confirmation));\n }\n}",
"function _elastic_email_has_valid_settings() {\n $site_mail = variable_get('site_mail', NULL);\n $username = variable_get(ELASTIC_EMAIL_USERNAME, NULL);\n $api_key = variable_get(ELASTIC_EMAIL_API_KEY, NULL);\n\n if (is_null($site_mail) || $site_mail == '') {\n return FALSE;\n }\n if (is_null($username) || $username == '') {\n return FALSE;\n }\n if (is_null($api_key) || $api_key == '') {\n return FALSE;\n }\n return TRUE;\n}",
"function _os2dagsorden_create_agenda_meeting_create_user_form_email_validate($element, $form, &$form_state) {\r\n $value = $element['#value'];\r\n if (!valid_email_address($value)) {\r\n form_error($element, t('Indtast en gyldig email adresse.'));\r\n }\r\n if (db_query(\"SELECT COUNT(*) FROM {users} WHERE mail = :mail;\", array(':mail' => $value))->fetchField()) {\r\n form_error($element, t('Der findes allerede en bruger med denne email.'));\r\n }\r\n}",
"function _check_member_event_options()\n\t{\n\t\t$rules['module_affiliate_marketing_member_events_alert_email'] = 'trim|valid_email';\n\t\t\n\t\t$this->validation->set_rules($rules);\n\t\t\n\t\t$fields['module_affiliate_marketing_member_events_alert_email'] = $this->lang->line('email');\n\t\t\n\t\t$this->validation->set_fields($fields);\n\t\t\t\n\t\tif ($this->validation->run() == FALSE)\t\n\t\t{\n\t\t\treturn false;\n\t\t}\n\t\t\n\t\treturn true;\n\t}",
"private function setEmail()\n {\n\t if ( empty( $_POST['email'] ) ) {\n\t\t\t$this->data['error']['email'] = 'Please provide a valid email address.';\n $this->error = true;\n return;\n }\n \n $e = trim( $_POST['email'] );\n \n\t\tif ( ! filter_var( $e, FILTER_VALIDATE_EMAIL ) ) {\n\t\t\t$this->data['error']['email'] = 'Please provide a valid email address.';\n $this->error = true;\n return;\n\t\t}\n \n\t\t$this->data['email'] = $e;\n }",
"function _webform_defaults_email() {\r\n return array(\r\n 'name' => '',\r\n 'form_key' => NULL,\r\n 'pid' => 0,\r\n 'weight' => 0,\r\n 'value' => '',\r\n 'mandatory' => 0,\r\n 'email' => 1,\r\n 'extra' => array(\r\n 'width' => '',\r\n 'disabled' => 0,\r\n 'email' => 0,\r\n 'description' => '',\r\n 'attributes' => array(),\r\n ),\r\n );\r\n}",
"public function emailEntryIsValid() {\r\n \r\n $email = $this->getEmail();\r\n \r\n if ( empty($email) ) {\r\n $this->errors[\"email\"] = \"Email is missing.\";\r\n } else if ( !Validator::emailIsValid($this->getEmail()) ) {\r\n $this->errors[\"email\"] = \"Email is not valid.\"; \r\n }\r\n \r\n return ( empty($this->errors[\"email\"]) ? true : false ) ;\r\n }",
"function _webform_validate_email($form_element, $form_state) {\r\n $component = $form_element['#webform_component'];\r\n if (!empty($form_element['#value']) && !valid_email_address($form_element['#value'])) {\r\n form_error($form_element, t('%value is not a valid email address.', array('%value' => $form_element['#value'])));\r\n }\r\n}",
"public function email()\n\t{\n\t\t$this->add('email', 'required', true, 'Email is required.');\n\t\t$this->add('email', 'regexp', '#^[^\\W][a-zA-Z0-9_]+(\\.[a-zA-Z0-9_]+)*\\@[a-zA-Z0-9_]+(\\.[a-zA-Z0-9_]+)*\\.[a-zA-Z]{2,4}$#', 'Bad Email format.');\n\t\t$this->add('email', 'max', 30, 'Bad Email length, no more than 30 characters.');\n\n\t\t$this->setInformation('email', 'Email format, no more than 30 characters...');\n\t}",
"function femail_user_add_validate($form, &$form_state){\n if(!valid_email_address($form_state['values']['femail_email'])){\n form_set_error('femail_email', t('Email address provided is not valid'));\n }\n // Check for existing entries.\n if(db_result(db_query(\"SELECT email FROM {femail_user_emails} WHERE email='%s' UNION SELECT mail FROM {users} WHERE mail='%s'\", $form_state['values']['femail_email'], $form_state['values']['femail_email']))){\n form_set_error('femail_email', t('Email is already in use on this site.'));\n }\n}",
"public function emailEntryIsValid() {\r\n if (array_key_exists(\"email\", $_POST) )\r\n {\r\n if ( !Validator::emailIsValid($_POST[\"email\"]) )\r\n {\r\n $this->errors[\"email\"] = \"Email is not valid!\"; // if the email is not valid then the error will be filled with this message\r\n }\r\n }\r\n else\r\n {\r\n $this->errors[\"email\"] = \"Email is required!\"; // if the email is not entered then the error will be filled with this message\r\n }\r\n \r\n return ( empty($this->errors[\"email\"]) ? true : false ); // if there are no errors then this will return true, if the error messege is filled with something it will return false\r\n }",
"public function on_before_submit() {\n\t\t\n\t\t/*\n\t\tif (!some_function_to_validate_emails($_REQUEST['Question3'])) { \n\t\t\t$this->controller->errors['email'] = t('Please enter a valid email address');\n\t\t}\n\t\t*/\n\t}",
"protected function checkEmail() {\n //Check Email only when it is not empty\n if (!empty($_POST[$this->_email])) {\n //Validate value (email address by default)return validEmail otherwise false\n $validEmail = filter_input(INPUT_POST, $_POST[$this->_email], FILTER_VALIDATE_EMAIL);\n if ($validEmail) {\n //Store validEmail for using later\n $this->_validEmail = $validEmail;\n } else {\n //Set error['email]\n $this->_errors[$this->_email] = true;\n //Set message\n $this->_messages[] = \"Invalid email address.\";\n }\n }\n }",
"public function validate($form, &$form_state) {\n parent::validate($form, $form_state);\n\n $element = $form[$this->form_id . '_email'];\n webform_confirm_email_settings_validate($element, $form_state);\n }",
"function coenv_setting_public_email_address() {\n\t$value = get_option('public_email_address');\n\n\t?>\t\n\t\t<p>The public email address of the unit.</p>\n\t\t\t\t<input name=\"public_email_address\" type=\"text\" id=\"public_email_address\" value=\"<?php echo $value; ?>\" class=\"regular-text\">\n\t<?php\n}",
"function setEmailForm(&$smartyEmailForm) {\n\t\t//Check if there is a valid email address in the database for the given combination of employee, service, position and organisation id\n\t\tif ($this->getEmailAddress($smartyEmailForm) || $this->piVars['mode'] == 'set_contact_form') {\n\t\t\tif($this->getEmailAddress($smartyEmailForm)){\n\t\t\t\t//Assign action url of email form with mode 'check_email_form'\n\t\t\t\t$smartyEmailForm->assign('action_url',htmlspecialchars($this->pi_linkTP_keepPIvars_url(array(mode => 'check_email_form'),0,0)));\n\t\t\t}else{\n\t\t\t\t//Assign action url of email form with mode 'check_contact_form'\n\t\t\t\t$smartyEmailForm->assign('action_url',htmlspecialchars($this->pi_linkTP_keepPIvars_url(array(mode => 'check_contact_form'),0,0)));\n\t\t\t}\n\n\t\t\t//Assign template labels\n\t\t\t$hoster_email=$this->get_hoster_email();\n\t\t\t$smartyEmailForm->assign('email_form_label',$this->pi_getLL('tx_civserv_pi1_email_form.email_form','E-Mail Form'));\n\t\t\t$smartyEmailForm->assign('contact_form_label',str_replace('###HOSTER###', $hoster_email, $this->pi_getLL('tx_civserv_pi1_email_form.contact_form','Contact '.$hoster_email)));\n\t\t\t$smartyEmailForm->assign('notice_label',$this->pi_getLL('tx_civserv_pi1_email_form.notice','Please enter your postal address oder email address, so that we can send you an answer'));\n\t\t\t$smartyEmailForm->assign('title_label', $this->pi_getLL('tx_civserv_pi1_email_form.title','Title'));\n\t\t\t$smartyEmailForm->assign('chose_option', $this->pi_getLL('tx_civserv_pi1_email_form.chose','Please chose'));\n\t\t\t$smartyEmailForm->assign('female_option', $this->pi_getLL('tx_civserv_pi1_email_form.female','Ms.'));\n\t\t\t$smartyEmailForm->assign('male_option', $this->pi_getLL('tx_civserv_pi1_email_form.male','Mr.'));\n\t\t\t$smartyEmailForm->assign('firstname_label',$this->pi_getLL('tx_civserv_pi1_email_form.firstname','Firstname'));\n\t\t\t$smartyEmailForm->assign('surname_label',$this->pi_getLL('tx_civserv_pi1_email_form.surname','Surname'));\n\t\t\t$smartyEmailForm->assign('street_label',$this->pi_getLL('tx_civserv_pi1_email_form.street','Street, Nr.'));\n\t\t\t$smartyEmailForm->assign('postcode_label',$this->pi_getLL('tx_civserv_pi1_email_form.postcode','Postcode'));\n\t\t\t$smartyEmailForm->assign('city_label',$this->pi_getLL('tx_civserv_pi1_email_form.city','City'));\n\t\t\t$smartyEmailForm->assign('email_label',$this->pi_getLL('tx_civserv_pi1_email_form.email','E-Mail'));\n\t\t\t$smartyEmailForm->assign('phone_label',$this->pi_getLL('tx_civserv_pi1_email_form.phone','Phone'));\n\t\t\t$smartyEmailForm->assign('fax_label',$this->pi_getLL('tx_civserv_pi1_email_form.fax','Fax'));\n\t\t\t$smartyEmailForm->assign('subject_label',$this->pi_getLL('tx_civserv_pi1_email_form.subject','Subject'));\n\t\t\t$smartyEmailForm->assign('bodytext_label',$this->pi_getLL('tx_civserv_pi1_email_form.bodytext','Your text'));\n\t\t\t$smartyEmailForm->assign('submit_label',$this->pi_getLL('tx_civserv_pi1_email_form.submit','Send e-mail'));\n\t\t\t$smartyEmailForm->assign('reset_label',$this->pi_getLL('tx_civserv_pi1_email_form.reset','Reset'));\n\t\t\t$smartyEmailForm->assign('required_label',$this->pi_getLL('tx_civserv_pi1_email_form.required','required'));\n\n\t\t\t//Set reset button type to reset functionality\n\t\t\t$smartyEmailForm->assign('button_type','reset');\n\n\t\t\treturn true;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}",
"function pdfbulletin_sendtest_form_validate($form, &$form_state) {\n $emails = explode(\"\\n\", $form_state['values']['subscribers']);\n foreach ($emails as $email) {\n $email = trim($email);\n if (! empty($email) && ! valid_email_address($email)) {\n form_set_error('subscribers', t('Invalid e-mail address: @email', array('@email' => $email)));\n }\n }\n}",
"public function it_shows_defined_email_type_input()\n {\n // configure\n $inputs = [\n [\n 'type' => 'email',\n 'name' => 'from_email',\n 'placeholder' => 'From Email',\n 'label' => 'From Email of app',\n 'hint' => 'You can from email of app'\n ]\n ];\n\n $this->configureInputs($inputs);\n\n // assert\n $this->get('/settings')\n ->assertStatus(200)\n ->assertSee('type=\"email\"', false);\n }",
"function simplenews_admin_newsletter_form_validate($form, &$form_state) {\n if ($form_state['clicked_button']['#value'] != t('Delete')) {\n\n // Check for valid email address.\n if (!valid_email_address($form_state['values']['from_address'])) {\n form_set_error('from_address', t(\"The sender's email address you supplied is not valid.\"));\n }\n }\n}",
"function crushftp_update_admin_site_form_validate($form, &$form_state) {\n if (!crushftp_valid_pass($form_state['values']['password'])) {\n form_set_error('password', t('That password is too simple.'));\n }\n // validates correctness of email address\n $valid_email = $form_state['values']['email'];\n if (!valid_email_address($valid_email)) {\n form_set_error('email', 'Sorry. Your email address,' . $valid_email . ', is not valid. Please submit a valid E-mail address.');\n }\n}",
"public function validEmailValidDataProvider() {}",
"function pdfbulletin_settings_form_validate(&$form, &$form_state) {\n // @todo SERIOUSLY\n}",
"function pdfbulletin_subscribers_form_validate($form, &$form_state) {\n $emails = explode(\"\\n\", $form_state['values']['subscribers']);\n foreach ($emails as $email) {\n $email = trim($email);\n if (! empty($email) && ! valid_email_address($email)) {\n form_set_error('subscribers', t('Invalid e-mail address: @email', array('@email' => $email)));\n }\n }\n}"
] |
[
"0.7399588",
"0.72420967",
"0.7083556",
"0.6979335",
"0.6875855",
"0.6857015",
"0.6760155",
"0.66937315",
"0.66867536",
"0.6681443",
"0.6606728",
"0.65792143",
"0.6546812",
"0.65212375",
"0.65184414",
"0.6490989",
"0.6388742",
"0.63734674",
"0.63684595",
"0.63625747",
"0.6309363",
"0.62988734",
"0.6291128",
"0.6269688",
"0.6254346",
"0.6197462",
"0.6188244",
"0.6170948",
"0.61201084",
"0.6119637"
] |
0.7834429
|
0
|
Form submission for the Settings / Default Email Address config page.
|
function room_reservations_admin_settings_default_email_submit($form_id, &$form_state) {
if ($form_state['clicked_button']['#value'] == t('Save configuration')) {
$option = $form_state['values']['options'];
$domain = trim($form_state['values']['domain']);
$confirmation = ROOM_RESERVATIONS_SAVE_CONFIRMATION_MSG;
$error = ROOM_RESERVATIONS_SAVE_ERROR_MSG;
}
elseif ($form_state['clicked_button']['#value'] == t('Reset to defaults')) {
$option = 0;
$domain = '';
$confirmation = ROOM_RESERVATIONS_RESET_CONFIRMATION_MSG;
$error = ROOM_RESERVATIONS_RESET_ERROR_MSG;
}
$errors = FALSE;
$result = _room_reservations_set_variable('default_email_address', $option);
if (!$result) {
$errors = TRUE;
}
$result = _room_reservations_set_variable('default_email_domain', $domain);
if (!$result) {
$errors = TRUE;
}
if ($errors) {
drupal_set_message(check_plain($error), 'error');
}
else {
drupal_set_message(check_plain($confirmation));
}
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function room_reservations_admin_settings_default_email($form, &$form_state) {\n $options = array(\n '0' => t('Do not set a default email address.'),\n '1' => t('Set the default email address equal to the user ID.'),\n '2' => t('Set the default email address equal to the user ID plus the domain name entered below.'),\n );\n $default_option = _room_reservations_get_variable('default_email_address');\n $default_domain = _room_reservations_get_variable('default_email_domain');\n $form['options'] = array(\n '#title' => t('Options'),\n '#type' => 'radios',\n '#options' => $options,\n '#description' => t('Options for including a default email address\n in the Reminders - Email Addresses field on the reservation form.'),\n '#default_value' => $default_option,\n '#weight' => -100,\n );\n $form['domain'] = array(\n '#title' => t('Domain Name'),\n '#type' => 'textfield',\n '#description' => t('The domain name that is added to the user\n name to create the default email address on the reservation form.\n Required if the third option above is selected.'),\n '#default_value' => $default_domain,\n '#maxlength' => 80,\n '#size' => 80,\n '#weight' => -90,\n );\n $form['save'] = array(\n '#type' => 'submit',\n '#value' => t('Save configuration'),\n '#weight' => 100,\n );\n $form['reset'] = array(\n '#type' => 'submit',\n '#value' => t('Reset to defaults'),\n '#weight' => 101,\n );\n\n return $form;\n}",
"function room_reservations_admin_settings_default_email_validate(\n $form_id, &$form_state) {\n if ($form_state['clicked_button']['#value'] == t('Save configuration')) {\n $option = $form_state['values']['options'];\n $domain = trim($form_state['values']['domain']);\n if (($option == 2) && (!$domain)) {\n $field = 'domain';\n $message = t('A domain name must be entered when this option is selected.');\n form_set_error($field, check_plain($message));\n }\n }\n}",
"function elastic_email_settings_form() {\n global $base_url;\n\n // Add CSS to make the AJAX part of the form look a little better.\n _elastic_email_add_admin_css();\n\n // Emails won't get sent if allow_url_fopen is disabled.\n if (ini_get('allow_url_fopen') != 1) {\n drupal_set_message(t(\"You must enable 'allow_url_fopen' in your php.ini settings to be able to use this service.\"), 'error');\n }\n\n // Fieldset to hold credential fields, and Test fieldset.\n $form['credentials'] = array(\n '#type' => 'fieldset',\n '#title' => t('API Credentials'),\n );\n\n $form['credentials'][ELASTIC_EMAIL_USERNAME] = array(\n '#type' => 'textfield',\n '#size' => 48,\n '#title' => t('API username'),\n '#required' => TRUE,\n '#default_value' => variable_get(ELASTIC_EMAIL_USERNAME, ''),\n '#description' => t('This is typically your Elastic Email account email address.')\n );\n\n $form['credentials'][ELASTIC_EMAIL_API_KEY] = array(\n '#type' => 'textfield',\n '#size' => 48,\n '#title' => t('API Key'),\n '#required' => TRUE,\n '#default_value' => variable_get(ELASTIC_EMAIL_API_KEY, ''),\n '#description' => t('The API Key format is typically <tt>xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx</tt>.')\n );\n\n // DIV to hold the results of the AJAX test call.\n $form['credentials']['test']['elastic-email-test-wrapper'] = array(\n '#type' => 'markup',\n '#prefix' => '<div id=\"elastic-email-test-wrapper\">',\n '#suffix' => '</div>',\n );\n\n // Fieldset for other options.\n $form['options'] = array(\n '#type' => 'fieldset',\n '#title' => t('Options'),\n );\n\n $form['options'][ELASTIC_EMAIL_QUEUE_ENABLED] = array(\n '#type' => 'checkbox',\n '#title' => t('Queue outgoing messages'),\n '#description' => t('When checked, outgoing messages will be queued via Drupal core system queue, and delivered when the queue is emptied at cron time. When unchecked, messages are delivered immediately (synchronously). Note that synchronous delivery can cause delay in page execution time.') .\n '<br /><br />' . t('If enabled, you can use the <a href=\"@link\" target=\"_blank\">Queue UI</a> to view the queue.', array('@link' => 'https://www.drupal.org/project/queue_ui')),\n '#default_value' => variable_get(ELASTIC_EMAIL_QUEUE_ENABLED, FALSE)\n );\n\n $form['options'][ELASTIC_EMAIL_LOG_SUCCESS] = array(\n '#type' => 'checkbox',\n '#title' => t('Log message delivery success'),\n '#description' => t('When checked, a log message will also be generated for <em>successful</em> email delivery. Errors are always logged.'),\n '#default_value' => variable_get(ELASTIC_EMAIL_LOG_SUCCESS, FALSE)\n );\n\n // Fieldset for other settings.\n $form['settings'] = array(\n '#type' => 'fieldset',\n '#title' => t('Settings'),\n );\n\n $form['settings']['elastic_email_credit_low_threshold'] = array(\n '#type' => 'textfield',\n '#size' => 8,\n '#title' => t('Low Credit Threshold (USD)'),\n '#description' => t('Sets the lower threshold limit value of when to warn admin users about a low credit limit.') . '<br />' . t('(NOTE: If you are not sending out more than the Elastic Email monthly limit of 25,000 emails, set this value to zero to not show any warning).'),\n '#default_value' => variable_get('elastic_email_credit_low_threshold', 0)\n );\n\n $form['settings']['elastic_email_use_default_channel'] = array(\n '#type' => 'checkbox',\n '#title' => t('Use a Default Channel'),\n '#description' => t('If no default channel is set, then the default (set by Elastic Email) is the sending email address.<br />Setting a default channel will add this value to every email that is sent, meaning that you can more easily identify email that has come from each specific site within the reporting section.'),\n '#default_value' => variable_get('elastic_email_use_default_channel', FALSE)\n );\n\n $url = parse_url($base_url);\n $form['settings']['elastic_email_default_channel'] = array(\n '#type' => 'textfield',\n '#size' => 48,\n '#maxlength' => 60,\n '#title' => t('Default Channel'),\n '#default_value' => variable_get('elastic_email_default_channel', $url['host']),\n '#states' => array(\n 'visible' => array(\n ':input[name=\"elastic_email_use_default_channel\"]' => array('checked' => TRUE),\n ),\n ),\n );\n\n // Add the normal settings form stuff.\n $form = system_settings_form($form);\n\n // Return the form.\n return $form;\n}",
"function setEmailForm(&$smartyEmailForm) {\n\t\t//Check if there is a valid email address in the database for the given combination of employee, service, position and organisation id\n\t\tif ($this->getEmailAddress($smartyEmailForm) || $this->piVars['mode'] == 'set_contact_form') {\n\t\t\tif($this->getEmailAddress($smartyEmailForm)){\n\t\t\t\t//Assign action url of email form with mode 'check_email_form'\n\t\t\t\t$smartyEmailForm->assign('action_url',htmlspecialchars($this->pi_linkTP_keepPIvars_url(array(mode => 'check_email_form'),0,0)));\n\t\t\t}else{\n\t\t\t\t//Assign action url of email form with mode 'check_contact_form'\n\t\t\t\t$smartyEmailForm->assign('action_url',htmlspecialchars($this->pi_linkTP_keepPIvars_url(array(mode => 'check_contact_form'),0,0)));\n\t\t\t}\n\n\t\t\t//Assign template labels\n\t\t\t$hoster_email=$this->get_hoster_email();\n\t\t\t$smartyEmailForm->assign('email_form_label',$this->pi_getLL('tx_civserv_pi1_email_form.email_form','E-Mail Form'));\n\t\t\t$smartyEmailForm->assign('contact_form_label',str_replace('###HOSTER###', $hoster_email, $this->pi_getLL('tx_civserv_pi1_email_form.contact_form','Contact '.$hoster_email)));\n\t\t\t$smartyEmailForm->assign('notice_label',$this->pi_getLL('tx_civserv_pi1_email_form.notice','Please enter your postal address oder email address, so that we can send you an answer'));\n\t\t\t$smartyEmailForm->assign('title_label', $this->pi_getLL('tx_civserv_pi1_email_form.title','Title'));\n\t\t\t$smartyEmailForm->assign('chose_option', $this->pi_getLL('tx_civserv_pi1_email_form.chose','Please chose'));\n\t\t\t$smartyEmailForm->assign('female_option', $this->pi_getLL('tx_civserv_pi1_email_form.female','Ms.'));\n\t\t\t$smartyEmailForm->assign('male_option', $this->pi_getLL('tx_civserv_pi1_email_form.male','Mr.'));\n\t\t\t$smartyEmailForm->assign('firstname_label',$this->pi_getLL('tx_civserv_pi1_email_form.firstname','Firstname'));\n\t\t\t$smartyEmailForm->assign('surname_label',$this->pi_getLL('tx_civserv_pi1_email_form.surname','Surname'));\n\t\t\t$smartyEmailForm->assign('street_label',$this->pi_getLL('tx_civserv_pi1_email_form.street','Street, Nr.'));\n\t\t\t$smartyEmailForm->assign('postcode_label',$this->pi_getLL('tx_civserv_pi1_email_form.postcode','Postcode'));\n\t\t\t$smartyEmailForm->assign('city_label',$this->pi_getLL('tx_civserv_pi1_email_form.city','City'));\n\t\t\t$smartyEmailForm->assign('email_label',$this->pi_getLL('tx_civserv_pi1_email_form.email','E-Mail'));\n\t\t\t$smartyEmailForm->assign('phone_label',$this->pi_getLL('tx_civserv_pi1_email_form.phone','Phone'));\n\t\t\t$smartyEmailForm->assign('fax_label',$this->pi_getLL('tx_civserv_pi1_email_form.fax','Fax'));\n\t\t\t$smartyEmailForm->assign('subject_label',$this->pi_getLL('tx_civserv_pi1_email_form.subject','Subject'));\n\t\t\t$smartyEmailForm->assign('bodytext_label',$this->pi_getLL('tx_civserv_pi1_email_form.bodytext','Your text'));\n\t\t\t$smartyEmailForm->assign('submit_label',$this->pi_getLL('tx_civserv_pi1_email_form.submit','Send e-mail'));\n\t\t\t$smartyEmailForm->assign('reset_label',$this->pi_getLL('tx_civserv_pi1_email_form.reset','Reset'));\n\t\t\t$smartyEmailForm->assign('required_label',$this->pi_getLL('tx_civserv_pi1_email_form.required','required'));\n\n\t\t\t//Set reset button type to reset functionality\n\t\t\t$smartyEmailForm->assign('button_type','reset');\n\n\t\t\treturn true;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}",
"public function index()\n\t{\n\t\t//restricted this area, only for admin\n\t\tpermittedArea();\n\n\t\t$data['settings'] = $this->settings_model->adminSettings();\n\n\t\tif($this->input->post())\n\t\t{\n\t\t\t$input = $this->input->post();\n\t\t\t$this->form_validation->set_rules('default_email', 'Default Email', 'required|valid_email');\n\n\t\t\tif($this->form_validation->run())\n\t\t\t{\n\t\t\t\t$this->settings_model->updateSettings();\n\t\t\t}\n\t\t}\n\n\t\ttheme('admin_settings', $data);\n\t}",
"function coenv_setting_public_email_address() {\n\t$value = get_option('public_email_address');\n\n\t?>\t\n\t\t<p>The public email address of the unit.</p>\n\t\t\t\t<input name=\"public_email_address\" type=\"text\" id=\"public_email_address\" value=\"<?php echo $value; ?>\" class=\"regular-text\">\n\t<?php\n}",
"function _todoist_config_form_submit($form, $form_state) {\n if ($form_state['values']['user_mail'] && $form_state['values']['user_pass']) {\n if (!valid_email_address($form_state['values']['user_mail'])) {\n form_set_error('submitted][user_mail', t('The email address appears to be invalid.'));\n }\n else {\n variable_set('todoist_userid', $form_state['values']['user_mail']);\n variable_set('user_pass', $form_state['values']['user_pass']);\n variable_set('user_token', $form_state['values']['user_token']);\n drupal_set_message(t('Your configuration has been saved.'));\n $form_state['rebuild'] = TRUE;\n }\n }\n}",
"public function _settings_field_contact_form_submit() {\n global $zendesk_support;\n $value = $zendesk_support->_is_default( 'contact_form_submit' ) ? '' : $zendesk_support->settings['contact_form_submit'];\n ?>\n <input type=\"text\" class=\"regular-text\" name=\"zendesk-settings[contact_form_submit]\" value=\"<?php echo $value; ?>\"\n placeholder=\"<?php echo $zendesk_support->default_settings['contact_form_submit']; ?>\"/>\n <?php\n }",
"function _webform_defaults_email() {\r\n return array(\r\n 'name' => '',\r\n 'form_key' => NULL,\r\n 'pid' => 0,\r\n 'weight' => 0,\r\n 'value' => '',\r\n 'mandatory' => 0,\r\n 'email' => 1,\r\n 'extra' => array(\r\n 'width' => '',\r\n 'disabled' => 0,\r\n 'email' => 0,\r\n 'description' => '',\r\n 'attributes' => array(),\r\n ),\r\n );\r\n}",
"function room_reservations_admin_settings_email_submit($form_id, &$form_state) {\n if ($form_state['clicked_button']['#value'] == t('Save configuration')) {\n $from_address = $form_state['values']['from_address'];\n $confirmation_header = $form_state['values']['confirmation_header'];\n $confirmation_owner = $form_state['values']['confirmation_owner'];\n $confirmation_group = $form_state['values']['confirmation_group'];\n $reminder_header = $form_state['values']['reminder_header'];\n $reminder_owner = $form_state['values']['reminder_owner'];\n $reminder_group = $form_state['values']['reminder_group'];\n $confirmation = ROOM_RESERVATIONS_SAVE_CONFIRMATION_MSG;\n $error = ROOM_RESERVATIONS_SAVE_ERROR_MSG;\n }\n elseif ($form_state['clicked_button']['#value'] == t('Reset to defaults')) {\n $confirmation_header = '';\n $confirmation_owner = '';\n $confirmation_group = '';\n $reminder_header = '';\n $reminder_owner = '';\n $reminder_group = '';\n $confirmation = ROOM_RESERVATIONS_RESET_CONFIRMATION_MSG;\n $error = ROOM_RESERVATIONS_RESET_ERROR_MSG;\n }\n $errors = FALSE;\n $result = _room_reservations_set_variable('from_address', $from_address);\n if (!$result) {\n $errors = TRUE;\n }\n $result = _room_reservations_set_variable('confirmation_header_text', \n $confirmation_header);\n if (!$result) {\n $errors = TRUE;\n }\n $result = _room_reservations_set_variable('confirmation_owner_text', \n $confirmation_owner);\n if (!$result) {\n $errors = TRUE;\n }\n $result = _room_reservations_set_variable('confirmation_group_text', \n $confirmation_group);\n if (!$result) {\n $errors = TRUE;\n }\n $result = _room_reservations_set_variable('reminder_header_text', \n $reminder_header);\n if (!$result) {\n $errors = TRUE;\n }\n $result = _room_reservations_set_variable('reminder_owner_text', \n $reminder_owner);\n if (!$result) {\n $errors = TRUE;\n }\n $result = _room_reservations_set_variable('reminder_group_text', \n $reminder_group);\n if (!$result) {\n $errors = TRUE;\n }\n if ($errors) {\n drupal_set_message(check_plain($error), 'error');\n }\n else {\n drupal_set_message(check_plain($confirmation));\n }\n}",
"function email_settings()\r\n\t{\r\n\t\tglobal $ibforums, $std, $print;\r\n\r\n\t\tif ($ibforums->member['disable_mail'])\r\n\t\t{\r\n\t\t\t$ibforums->lang['no_mail'] = sprintf($ibforums->lang['no_mail'], $ibforums->member['disable_mail_reason']);\r\n\r\n\t\t\t$this->output .= View::make(\"global.warn_window\", ['message' => $ibforums->lang['no_mail']]);\r\n\t\t} else\r\n\t\t{\r\n\r\n\t\t\t// PM_REMINDER: First byte = Email PM when received new\r\n\t\t\t// \t\t\tSecond byte= Show pop-up when new PM received\r\n\r\n\t\t\t$info = array();\r\n\r\n\t\t\tforeach (array('hide_email', 'allow_admin_mails', 'email_full', 'email_pm', 'auto_track') as $k)\r\n\t\t\t{\r\n\t\t\t\tif (!empty($this->member[$k]))\r\n\t\t\t\t{\r\n\t\t\t\t\t$info[$k] = 'checked';\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t$info['key'] = $this->md5_check;\r\n\r\n\t\t\t$this->output .= View::make(\"ucp.email\", ['Profile' => $info]);\r\n\t\t}\r\n\r\n\t\t$this->page_title = $ibforums->lang['t_welcome'];\r\n\t\t$this->nav = array(\"<a href='\" . $this->base_url . \"act=UserCP&CODE=00'>\" . $ibforums->lang['t_title'] . \"</a>\");\r\n\r\n\t}",
"public function processConfiguration()\n\t{\n\t\t// Check if the value sent on form submit matches one of either $_POST or $_GET keys \n\t\tif (Tools::isSubmit('submit_emailmystock_form'))\n\t\t{\n\t\t\t$enable_emails = Tools::getValue('enable_emails');\n\t\t\t// Update configuration value to database\n\t\t\tConfiguration::updateValue('MYMOD_EMAILS', $enable_emails);\n\t\t\t// Allows the Smarty object to display a confirmation message when the configuration is saved (see top of getContent.tpl)\n\t\t\t$this->context->smarty->assign('confirmation', 'ok');\n\t\t}\n\t}",
"function simplenews_admin_settings_newsletter($form, &$form_state) {\n $address_default = variable_get('site_mail', ini_get('sendmail_from'));\n $form = array();\n\n $form['simplenews_default_options'] = array(\n '#type' => 'fieldset',\n '#title' => t('Default newsletter options'),\n '#collapsible' => FALSE,\n '#description' => t('These options will be the defaults for new newsletters, but can be overridden in the newsletter editing form.'),\n );\n $links = array('!mime_mail_url' => 'http://drupal.org/project/mimemail', '!html_url' => 'http://drupal.org/project/htmlmail');\n $description = t('Default newsletter format. Install <a href=\"!mime_mail_url\">Mime Mail</a> module or <a href=\"!html_url\">HTML Mail</a> module to send newsletters in HTML format.', $links);\n $form['simplenews_default_options']['simplenews_format'] = array(\n '#type' => 'select',\n '#title' => t('Format'),\n '#options' => simplenews_format_options(),\n '#description' => $description,\n '#default_value' => variable_get('simplenews_format', 'plain'),\n );\n // @todo Do we need these master defaults for 'priority' and 'receipt'?\n $form['simplenews_default_options']['simplenews_priority'] = array(\n '#type' => 'select',\n '#title' => t('Priority'),\n '#options' => simplenews_get_priority(),\n '#description' => t('Note that email priority is ignored by a lot of email programs.'),\n '#default_value' => variable_get('simplenews_priority', SIMPLENEWS_PRIORITY_NONE),\n );\n $form['simplenews_default_options']['simplenews_receipt'] = array(\n '#type' => 'checkbox',\n '#title' => t('Request receipt'),\n '#default_value' => variable_get('simplenews_receipt', 0),\n '#description' => t('Request a Read Receipt from your newsletters. A lot of email programs ignore these so it is not a definitive indication of how many people have read your newsletter.'),\n );\n $form['simplenews_default_options']['simplenews_send'] = array(\n '#type' => 'radios',\n '#title' => t('Default send action'),\n '#options' => array(\n SIMPLENEWS_COMMAND_SEND_TEST => t('Send one test newsletter to the test address'),\n SIMPLENEWS_COMMAND_SEND_NOW => t('Send newsletter'),\n ),\n '#default_value' => variable_get('simplenews_send', 0),\n );\n $form['simplenews_test_address'] = array(\n '#type' => 'fieldset',\n '#title' => t('Test addresses'),\n '#collapsible' => FALSE,\n '#description' => t('Supply a comma-separated list of email addresses to be used as test addresses. The override function allows to override these addresses in the newsletter editing form.'),\n );\n $form['simplenews_test_address']['simplenews_test_address'] = array(\n '#type' => 'textfield',\n '#title' => t('Email address'),\n '#size' => 60,\n '#maxlength' => 128,\n '#default_value' => variable_get('simplenews_test_address', $address_default),\n );\n $form['simplenews_test_address']['simplenews_test_address_override'] = array(\n '#type' => 'checkbox',\n '#title' => t('Allow test address override'),\n '#default_value' => variable_get('simplenews_test_address_override', 0),\n );\n $form['simplenews_sender_info'] = array(\n '#type' => 'fieldset',\n '#title' => t('Sender information'),\n '#collapsible' => FALSE,\n '#description' => t('Default sender address that will only be used for confirmation emails. You can specify sender information for each newsletter separately on the newsletter\\'s settings page.'),\n );\n $form['simplenews_sender_info']['simplenews_from_name'] = array(\n '#type' => 'textfield',\n '#title' => t('From name'),\n '#size' => 60,\n '#maxlength' => 128,\n '#default_value' => variable_get('simplenews_from_name', variable_get('site_name', 'Drupal')),\n );\n $form['simplenews_sender_info']['simplenews_from_address'] = array(\n '#type' => 'textfield',\n '#title' => t('From email address'),\n '#size' => 60,\n '#maxlength' => 128,\n '#required' => TRUE,\n '#default_value' => variable_get('simplenews_from_address', $address_default),\n );\n\n return system_settings_form($form);\n}",
"public function emailAction() {\n\n $this->view->navigation = Engine_Api::_()->getApi('menus', 'core')\n ->getNavigation('sitestore_admin_main', array(), 'sitestore_admin_main_email');\n $this->view->form = $form = new Sitestore_Form_Admin_Settings_Email();\n\n //check if comments should be displayed or not\n $show_comments = Engine_Api::_()->sitestore()->displayCommentInsights();\n\n //check if Sitemailtemplates Plugin is enabled\n $sitemailtemplates = Engine_Api::_()->getDbtable('modules', 'core')->isModuleEnabled('sitemailtemplates');\n\n $taskstable = Engine_Api::_()->getDbtable('tasks', 'core');\n $rtasksName = $taskstable->info('name');\n $taskstable_result = $taskstable->select()\n ->from($rtasksName, array('processes', 'timeout'))\n ->where('title = ?', 'Sitestore Insight Mail')\n ->where('plugin = ?', 'Sitestore_Plugin_Task_InsightNotification')\n ->limit(1);\n $prefields = $taskstable->fetchRow($taskstable_result);\n\n //populate form\n// $form->populate(array(\n// 'sitestore_insightemail' => $prefields->processes,\n// ));\n\n if ($this->getRequest()->isPost() && $form->isValid($this->_getAllParams())) {\n $values = $form->getValues();\n Engine_Api::_()->getApi('settings', 'core')->setSetting('sitestore_insightemail', $values['sitestore_insightemail']);\n\n //check if Sitemailtemplates Plugin is enabled\n $sitemailtemplates = Engine_Api::_()->getDbtable('modules', 'core')->isModuleEnabled('sitemailtemplates');\n\n if(empty($sitemailtemplates)) {\n\t\t\t\tEngine_Api::_()->getApi('settings', 'core')->setSetting('sitestore_bg_color', $values['sitestore_bg_color']);\n }\n include APPLICATION_PATH . '/application/modules/Sitestore/controllers/license/license2.php';\n if ($values['sitestore_demo'] == 1 && $values['sitestore_insightemail'] == 1) {\n\n $view = Zend_Registry::isRegistered('Zend_View') ? Zend_Registry::get('Zend_View') : null;\n\n //check if Sitemailtemplates Plugin is enabled\n $sitemailtemplates = Engine_Api::_()->getDbtable('modules', 'core')->isModuleEnabled('sitemailtemplates');\n $site_title = Engine_Api::_()->getApi('settings', 'core')->getSetting('sitestore.site.title', Engine_Api::_()->getApi('settings', 'core')->getSetting('core.general.site.title', 1));\n\n $insights_string = '';\n\t\t\t\t$template_header = \"\";\n\t\t\t\t$template_footer = \"\";\n if(!$sitemailtemplates) {\n\t\t\t\t\t$site_title_color = Engine_Api::_()->getApi('settings', 'core')->getSetting('sitestore.title.color', \"#ffffff\");\n\t\t\t\t\t$site_header_color = Engine_Api::_()->getApi('settings', 'core')->getSetting('sitestore.header.color', \"#79b4d4\");\n\n\t\t\t\t\t//GET SITE \"Email Body Outer Background\" COLOR\n\t\t\t\t\t$site_bg_color = Engine_Api::_()->getApi('settings', 'core')->getSetting('sitestore.bg.color', \"#f7f7f7\");\n\t\t\t\t\t$insights_string.= \"<table cellpadding='2'><tr><td><table cellpadding='2'><tr><td><span style='font-size: 14px; font-weight: bold;'>\" . $view->translate(\"Sample Store\") . \"</span></td></tr>\";\n\n\t\t\t\t\t$template_header.= \"<table width='98%' cellspacing='0' border='0'><tr><td width='100%' bgcolor='$site_bg_color' style='font-family:arial,tahoma,verdana,sans-serif;padding:40px;'><table width='620' cellspacing='0' cellpadding='0' border='0'>\";\n\t\t\t\t\t$template_header.= \"<tr><td style='background:\" . $site_header_color . \"; color:$site_title_color;font-weight:bold;font-family:arial,tahoma,verdana,sans-serif; padding: 4px 8px;vertical-align:middle;font-size:16px;text-align: left;' nowrap='nowrap'>\" . $site_title . \"</td></tr><tr><td valign='top' style='background-color:#fff; border-bottom: 1px solid #ccc; border-left: 1px solid #cccccc; border-right: 1px solid #cccccc; font-family:arial,tahoma,verdana,sans-serif; padding: 15px;padding-top:0;' colspan='2'><table width='100%'><tr><td colspan='2'>\";\n\n $template_footer.= \"</td></tr></table></td></tr></td></table></td></tr></table>\";\n }\n\n if ($values['sitestore_insightmail_options'] == 1) {\n $vals['days_string'] = $view->translate('week');\n } elseif ($values['sitestore_insightmail_options'] == 2) {\n $vals['days_string'] = $view->translate('month');\n }\n $path = 'http://' . $_SERVER['HTTP_HOST'] . $view->baseUrl();\n $insight_link = \"<a style='color: rgb(59, 89, 152); text-decoration: none;' href='\" . $path . \"'>\" . $view->translate('Visit your Insights Store') . \"</a>\";\n $update_link = \"<a style='color: rgb(59, 89, 152); text-decoration: none;' href='\" . $path . \"'>\" . $view->translate('Send an update to people who like this') . \"</a>\";\n\n //check if Communityad Plugin is enabled\n $sitestorecommunityadEnabled = Engine_Api::_()->getDbtable('modules', 'core')->isModuleEnabled('communityad');\n $adversion = null;\n if ($sitestorecommunityadEnabled) {\n $communityadmodulemodule = Engine_Api::_()->getDbtable('modules', 'core')->getModule('communityad');\n $adversion = $communityadmodulemodule->version;\n if ($adversion >= '4.1.5') {\n $promote_Ad_link = \"<a style='color: rgb(59, 89, 152); text-decoration: none;' href='\" . $path . \"'>\" . $view->translate('Promote with %s Ads', $site_title) . \"</a>\";\n }\n }\n\n $insights_string.= \"<table><tr><td><span style='font-size: 24px; font-family: arial;'>\" . '2' . \"</span>\\t<span style='color: rgb(85, 85, 85);'>\" . $vals['days_string'] . $view->translate(array('ly active user', 'ly active users', 2), 2) . \"</span></td></tr><tr><td><span style='font-size: 24px; font-family: arial;'>\" . '2' . \"</span>\\t<span style='color: rgb(85, 85, 85);'>\" . $view->translate(array('person likes this', 'people like this', 2), 2) . \"</span> <span style='font-size: 18px; font-family: arial;' >\" . '2' . \"</span>\\t<span style='color: rgb(85, 85, 85);' >\" . $view->translate('since last') . \"\\t\" . $vals['days_string'] . \"</span></td></tr>\";\n if (!empty($show_comments)) {\n $insights_string.= \"<tr><td><span style='font-size: 24px; font-family: arial;'>\" . '2' . \"</span>\\t<span style='color: rgb(85, 85, 85);'>\" . $view->translate(array('comment', 'comments', 2), 2) . \"</span> <span style='font-size: 18px; font-family: arial;' >\" . '2' . \"</span>\\t<span style='color: rgb(85, 85, 85);' >\" . $view->translate('since last') . \"\\t\" . $vals['days_string'] . \"</span></td></tr>\";\n }\n $insights_string.= \"<tr><td><span style='font-size: 24px; font-family: arial;'>\" . '10' . \"</span>\\t <span style='color: rgb(85, 85, 85);'>\" . $view->translate(array('visit', 'visits', 2), 2) . \"</span> <span style='font-size: 18px; font-family: arial;' >\" . '5' . \"</span>\\t<span style='color: rgb(85, 85, 85);' >\" . $view->translate('since last') . \"\\t\" . $vals['days_string'] . \"</span></td></tr></table><table><tr><td>\" . \"<ul style=' padding-left: 5px;'><li>\" . $insight_link . \"</li><li>\" . $update_link;\n\n //check if Communityad Plugin is enabled\n if ($sitestorecommunityadEnabled && $adversion >= '4.1.5') {\n $insights_string.= \"</li><li>\" . $promote_Ad_link;\n }\n $insights_string.= \"</li></ul></td></tr></table>\";\n $days_string = ucfirst($vals['days_string']);\n $owner_name = Engine_Api::_()->user()->getViewer()->getTitle();\n $email = Engine_Api::_()->getApi('settings', 'core')->core_mail_from;\n Engine_Api::_()->getApi('mail', 'core')->sendSystem($values['sitestore_admin'], 'SITESTORE_INSIGHTS_EMAIL_NOTIFICATION', array(\n 'recipient_title' => $owner_name,\n 'template_header' => $template_header,\n 'message' => $insights_string,\n 'template_footer' => $template_footer,\n 'site_title' => $site_title,\n 'days' => $days_string,\n 'email' => $email,\n 'queue' => true));\n }\n }\n }",
"function setting_admin_email() {\n\t$options = get_option('nrelate_admin_options');\n\t$checked = (isset($options['admin_email_address']) && $options['admin_email_address']=='on') ? ' checked=\"checked\" ' : '';\n\techo \"<input \".$checked.\" name='nrelate_admin_options[admin_email_address]' type='checkbox' />\";\n}",
"function room_reservations_admin_settings_email_validate($form_id, &$form_state) {\n if ($form_state['clicked_button']['#value'] == t('Save configuration')) {\n $from_address = $form_state['values']['from_address'];\n if (valid_email_address($from_address)) {\n // Valid.\n }\n else {\n $field = 'from_address';\n $message = t('Invalid email address.');\n form_set_error($field, check_plain($message));\n }\n }\n}",
"public function configure()\n\t{\n\t\t$ui = new FormUI( 'jambo_config' );\n\n\t\t// Add a text control for the address you want the email sent to\n\t\t$send_to = $ui->append( 'text', 'send_to', 'option:jambo__send_to', _t('Where To Send Email: ', 'jambo') );\n\t\t$send_to->add_validator( 'validate_required' );\n\n\t\t// Add a text control for email subject\n\t\t$subject = $ui->append( 'text', 'subject', 'option:jambo__subject', _t('Subject: ', 'jambo') );\n\t\t$subject->add_validator( 'validate_required' );\n\n\t\t// Add an explanation for the subject field. Shouldn't FormUI have an easier way to do this?\n\t\t$ui->append( 'static', 'subject_explanation', '<p>' . _t('An %s in the subject will be replaced with a subject provided by the user. If omitted, no subject will be requested.', 'jambo') . '</p>' );\n\n\t\t// Add a text control for the prefix to the success message\n\t\t$success_msg = $ui->append( 'textarea', 'success_msg', 'option:jambo__success_msg', _t('Success Message: ', 'jambo') );\n\n\t\t$ui->append( 'submit', 'save', _t('Save', 'jambo') );\n\t\treturn $ui;\n\t}",
"function room_reservations_admin_settings_email($form, &$form_state) {\n $default_from_address\n = _room_reservations_get_variable('from_address');\n $default_confirmation_header_text\n = _room_reservations_get_variable('confirmation_header_text');\n $default_confirmation_owner_text\n = _room_reservations_get_variable('confirmation_owner_text');\n $default_confirmation_group_text\n = _room_reservations_get_variable('confirmation_group_text');\n $default_reminder_header_text\n = _room_reservations_get_variable('reminder_header_text');\n $default_reminder_owner_text\n = _room_reservations_get_variable('reminder_owner_text');\n $default_reminder_group_text\n = _room_reservations_get_variable('reminder_group_text');\n $tokens = array(\n '%reservation_name' => t('The name given to the reservation to identify it\n on the reservation calendar.'),\n '%room' => t('The room that has been reserved.'),\n '%month' => t('The full name of the month of the reservation date.'),\n '%month_number' => t('The month number of the reservation date.'),\n '%day' => t('The numeric day of the month of the reservation date.'),\n '%day_of_the_week' => t('The full name of the day of the week of the\n reservation date.'),\n '%time' => t('The time of the reservation.'),\n '%minutes' => t('The length of the reservation in minutes.'),\n );\n $token_display = '<p>' .\n t('The following tokens will be replaced with dynamic values in any of the\n fields below.') . '</p><ul>';\n foreach ($tokens as $key => $value) {\n $token_display .= '<li>' . $key . ' - ' . $value . '</li>';\n }\n $token_display .= '</ul>';\n $form['from_address'] = array(\n '#title' => t('From address'),\n '#type' => 'textfield',\n '#maxlength' => 100,\n '#size' => 100,\n '#description' => t('The from address on all email messages.'),\n '#default_value' => $default_from_address,\n '#weight' => -110,\n );\n $form['tokens'] = array(\n '#type' => 'fieldset',\n '#title' => t('Token values'),\n '#collapsible' => TRUE,\n '#collapsed' => TRUE,\n '#weight' => -100,\n );\n $form['tokens']['values'] = array(\n '#value' => $token_display,\n );\n $form['confirmation_header'] = array(\n '#title' => t('Confirmation heading'),\n '#type' => 'textfield',\n '#maxlength' => 100,\n '#size' => 100,\n '#description' => t('The heading for all confirmation messages.'),\n '#default_value' => $default_confirmation_header_text,\n '#weight' => -97,\n );\n $form['confirmation_owner'] = array(\n '#title' => t('Confirmation body'),\n '#type' => 'textarea',\n '#rows' => 8,\n '#description' => t('Confirmation message sent to the person who has made a\n reservation.'),\n '#default_value' => $default_confirmation_owner_text,\n '#weight' => -95,\n );\n $form['confirmation_group'] = array(\n '#title' => t('Confirmation to group members body'),\n '#type' => 'textarea',\n '#rows' => 8,\n '#description' => t('Confirmation message sent to all members of the group\n except for the person who made the reservation.'),\n '#default_value' => $default_confirmation_group_text,\n '#weight' => -90,\n );\n $form['reminder_header'] = array(\n '#title' => t('Reminder heading'),\n '#type' => 'textfield',\n '#maxlength' => 100,\n '#size' => 100,\n '#description' => t('The heading for all reminder messages.'),\n '#default_value' => $default_reminder_header_text,\n '#weight' => -85,\n );\n $form['reminder_owner'] = array(\n '#title' => t('Reminder body'),\n '#type' => 'textarea',\n '#rows' => 8,\n '#description' => t('Reminder message sent to the person who has made a\n reservation.'),\n '#default_value' => $default_reminder_owner_text,\n '#weight' => -80,\n );\n $form['reminder_group'] = array(\n '#title' => t('Reminder to group members body'),\n '#type' => 'textarea',\n '#rows' => 8,\n '#description' => t('Reminder message sent to all members of the group\n except for the person who made the reservation.'),\n '#default_value' => $default_reminder_group_text,\n '#weight' => -75,\n );\n $form['save'] = array(\n '#type' => 'submit',\n '#value' => t('Save configuration'),\n '#weight' => 100,\n );\n $form['reset'] = array(\n '#type' => 'submit',\n '#value' => t('Reset to defaults'),\n '#weight' => 101,\n );\n return $form;\n}",
"private function _saveDefaultMailSettings($email, $siteName)\n\t{\n\t\tCraft::log('Saving default mail settings.');\n\n\t\t$settings = array(\n\t\t\t'protocol' => EmailerType::Php,\n\t\t\t'emailAddress' => $email,\n\t\t\t'senderName' => $siteName\n\t\t);\n\n\t\tif (craft()->systemSettings->saveSettings('email', $settings))\n\t\t{\n\t\t\tCraft::log('Default mail settings saved successfully.');\n\t\t}\n\t\telse\n\t\t{\n\t\t\tCraft::log('Could not save default email settings.', LogLevel::Warning);\n\t\t}\n\t}",
"public function ga_email_callback()\n {\n printf(\n '<input type=\"email\" id=\"ga_email\" name=\"bpp_setting_options[ga_email]\" value=\"%s\" />',\n isset( $this->options['ga_email'] ) ? esc_attr( $this->options['ga_email']) : ''\n );\n }",
"public function _settings_section_contact_form() {\n _e( 'The contact form is a way for users to submit support requests. It can be added to the dashboard using the options above.', 'zendesk' );\n }",
"public function setDefault()\r\n {\r\n if (($this->dx_auth->is_logged_in()) || ($this->facebook_lib->logged_in()))\r\n {\r\n $user_id = $this->dx_auth->get_user_id();\r\n\r\n if ($this->input->post())\r\n {\r\n //unset the previous default email\r\n $condition = array(\"user_id\" => $user_id);\r\n $unset_default_email['is_default'] = 0;\r\n $this->Common_model->updateTableData('payout_preferences', NULL, $condition, $unset_default_email);\r\n\r\n //set new default email\t \r\n $default_email = $this->input->post('default_email');\r\n $data['is_default'] = 1;\r\n $condition = array(\"id\" => $default_email);\r\n $this->Common_model->updateTableData('payout_preferences', NULL, $condition, $data);\r\n\r\n $this->session->set_flashdata('flash_message', $this->Common_model->flash_message('success', translate('Your default payout updated successfully.')));\r\n }\r\n\r\n redirect('account/payout');\r\n }\r\n else\r\n {\r\n redirect('users/signin');\r\n }\r\n }",
"function display_contact() {\n ?>\n <p>All messages from contact page will be redirected to this email:</p>\n </br>\n <input \n type=\"email\" \n name=\"contact_email\"\n value=\"<?php echo esc_attr( get_option('contact_email') ); ?>\" \n \n /> \n <?php\n}",
"public function admin_smtp_settings() {\n if ($this->checkLogin('A') == '') {\n redirect(ADMIN_ENC_URL);\n } else {\n if ($this->checkPrivileges('admin', '2') == TRUE) {\n\t\t\t if ($this->lang->line('admin_settings_smtp_settings') != '') \n\t\t $this->data['heading']= stripslashes($this->lang->line('admin_settings_smtp_settings')); \n\t\t else $this->data['heading'] = 'SMTP Settings';\n $this->data['admin_settings'] = $result = $this->admin_model->get_selected_fields(ADMIN, array(), array('smtp'));\n $this->load->view(ADMIN_ENC_URL.'/adminsettings/smtp_settings', $this->data);\n } else {\n redirect(ADMIN_ENC_URL);\n }\n }\n }",
"function student_crm_webform_send_email_form_submit($form, $form_state) {\n $case = crm_case_load($form_state['values']['case']);\n $email_addresses = student_crm_webform_send_email('crm_case', $case, $form_state['values']['field'], $form_state['values']['manual-email']);\n \n $case = crm_case_load($form_state['values']['case']);\n $fields = field_info_instances();\n $field = $fields['crm_case'][$case->type][$form_state['values']['field']];\n\n drupal_set_message(t('The form %form has been sent to: !email-addresses', array('%form' => $field['label'], '!email-addresses' => theme('item_list', array('items' => $email_addresses)))));\n}",
"public function indexAction()\n {\n // generate input form\n $form = new Zf1_Form_Configure();;\n $this->view->form = $form;\n\n // if config file exists\n // read config values\n // pre-populate form with values\n if (file_exists($this->localConfigPath)) {\n $config = new Zend_Config_Ini($this->localConfigPath);\n $data['defaultEmailAddress'] = $config->global->defaultEmailAddress;\n $data['salesEmailAddress'] = $config->user->salesEmailAddress;\n $data['itemsPerPage'] = $config->admin->itemsPerPage;\n $data['displaySellerInfo'] = $config->user->displaySellerInfo;\n $data['logExceptionsToFile'] = $config->global->logExceptionsToFile;\n $form->populate($data);\n }\n\n // test for valid input\n // if valid, create new config object\n // create config sections\n // save config values to file,\n // overwriting previous version\n if ($this->getRequest()->isPost()) {\n if ($form->isValid($this->getRequest()->getPost())) {\n $values = $form->getValues();\n $config = new Zend_Config(array(), true);\n $config->global = array();\n $config->admin = array();\n $config->user = array();\n $config->global->defaultEmailAddress = $values['defaultEmailAddress'];\n $config->user->salesEmailAddress = $values['salesEmailAddress'];\n $config->admin->itemsPerPage = $values['itemsPerPage'];\n $config->user->displaySellerInfo = $values['displaySellerInfo'];\n $config->global->logExceptionsToFile = $values['logExceptionsToFile'];\n $writer = new Zend_Config_Writer_Ini();\n $writer->write($this->localConfigPath, $config);\n $this->_helper->getHelper('FlashMessenger')->addMessage('Thank you. Your configuration was successfully saved.');\n $this->_redirect('/admin/config/success');\n }\n }\n }",
"function room_reservations_admin_settings_text_validate($form_id, &$form_state) {\n if ($form_state['clicked_button']['#value'] == t('Save configuration')) {\n $from_address = $form_state['values']['from_address'];\n if (valid_email_address($from_address)) {\n // Valid.\n }\n else {\n $field = 'from_address';\n $message = t('Invalid email address.');\n form_set_error($field, check_plain($message));\n }\n }\n}",
"function banreservas_contact_contacts_list_edit_form_submit($form, &$form_state) {\n foreach (array_keys($form_state['plugin']['defaults']) as $key) {\n if (isset($form_state['values'][$key])) {\n $form_state['conf'][$key] = $form_state['values'][$key];\n }\n }\n}",
"private function initMailOptionsForm()\n\t{\n\t\tglobal $ilCtrl, $ilSetting, $lng, $ilUser;\t\n\t\t\n\t\tinclude_once 'Services/Form/classes/class.ilPropertyFormGUI.php';\n\t\t$this->form = new ilPropertyFormGUI();\n\t\t\n\t\t$this->form->setFormAction($ilCtrl->getFormAction($this, 'saveMailOptions'));\n\t\t$this->form->setTitle($lng->txt('mail_settings'));\n\t\t\t\n\t\t// BEGIN INCOMING\n\t\tinclude_once 'Services/Mail/classes/class.ilMailOptions.php';\n\t\tif($ilSetting->get('usr_settings_hide_mail_incoming_mail') != '1')\n\t\t{\n\t\t\t$options = array(\n\t\t\t\tIL_MAIL_LOCAL => $this->lng->txt('mail_incoming_local'), \n\t\t\t\tIL_MAIL_EMAIL => $this->lng->txt('mail_incoming_smtp'),\n\t\t\t\tIL_MAIL_BOTH => $this->lng->txt('mail_incoming_both')\n\t\t\t);\n\t\t\t$si = new ilSelectInputGUI($lng->txt('mail_incoming'), 'incoming_type');\n\t\t\t$si->setOptions($options);\n\t\t\tif(!strlen(ilObjUser::_lookupEmail($ilUser->getId())) ||\n\t\t\t $ilSetting->get('usr_settings_disable_mail_incoming_mail') == '1')\n\t\t\t{\n\t\t\t\t$si->setDisabled(true);\t\n\t\t\t}\n\t\t\t$this->form->addItem($si);\n\t\t}\n\t\t\n\t\t// BEGIN LINEBREAK_OPTIONS\n\t\t$options = array();\n\t\tfor($i = 50; $i <= 80; $i++)\n\t\t{\n\t\t\t$options[$i] = $i; \n\t\t}\t\n\t\t$si = new ilSelectInputGUI($lng->txt('linebreak'), 'linebreak');\n\t\t$si->setOptions($options);\t\t\t\n\t\t$this->form->addItem($si);\n\t\t\n\t\t// BEGIN SIGNATURE\n\t\t$ta = new ilTextAreaInputGUI($lng->txt('signature'), 'signature');\n\t\t$ta->setRows(10);\n\t\t$ta->setCols(60);\t\t\t\n\t\t$this->form->addItem($ta);\n\t\t\n\t\t// BEGIN CRONJOB NOTIFICATION\n\t\tif($ilSetting->get('mail_notification'))\n\t\t{\n\t\t\t$cb = new ilCheckboxInputGUI($lng->txt('cron_mail_notification'), 'cronjob_notification');\t\t\t\n\t\t\t$cb->setInfo($lng->txt('mail_cronjob_notification_info'));\n\t\t\t$cb->setValue(1);\n\t\t\t$this->form->addItem($cb);\n\t\t}\t\t\n\t\t\n\t\t$this->form->addCommandButton('saveMailOptions', $lng->txt('save'));\n\t}",
"function urlConfigForm()\r\n\t{\r\n\t\t/*\tAdd the field for the back link configuration\t*/\r\n\t\tadd_settings_field('wpklikandpay_payment_success', __('Url de retour pour un paiement accepté', 'wpklikandpay'), array('wpklikandpay_option', 'urlSuccess'), 'wpklikandpayUrlConfig', 'backUrlConfig');\r\n\t\tadd_settings_field('wpklikandpay_payment_canceled', __('Url de retour pour un paiement annulé', 'wpklikandpay'), array('wpklikandpay_option', 'urlCanceled'), 'wpklikandpayUrlConfig', 'backUrlConfig');\r\n\t\tadd_settings_field('wpklikandpay_payment_declined', __('Url de retour pour un paiement refusé', 'wpklikandpay'), array('wpklikandpay_option', 'urlDeclined'), 'wpklikandpayUrlConfig', 'backUrlConfig');\r\n\t}"
] |
[
"0.7559138",
"0.6896598",
"0.6653702",
"0.65696615",
"0.6522046",
"0.6507575",
"0.64880085",
"0.646263",
"0.6461662",
"0.64456904",
"0.64304125",
"0.63851583",
"0.63136375",
"0.62911725",
"0.6187509",
"0.6167545",
"0.615434",
"0.614885",
"0.6142799",
"0.61229557",
"0.6093253",
"0.6069212",
"0.6064765",
"0.6035196",
"0.6027643",
"0.60178757",
"0.5989953",
"0.5989147",
"0.5978489",
"0.5972249"
] |
0.80326813
|
0
|
Form submission for the Settings / Reminders configuration page.
|
function room_reservations_admin_settings_reminders_submit($form_id, &$form_state) {
if ($form_state['clicked_button']['#value'] == t('Save configuration')) {
$send_reminders = $form_state['values']['send_reminders'];
$reminder_time = $form_state['values']['reminder_time'];
$reminder_cutoff = $form_state['values']['reminder_cutoff'];
$confirmation = ROOM_RESERVATIONS_SAVE_CONFIRMATION_MSG;
$error = ROOM_RESERVATIONS_SAVE_ERROR_MSG;
}
elseif ($form_state['clicked_button']['#value'] == t('Reset to defaults')) {
$send_reminders = 0;
$reminder_time = 1300;
$reminder_cutoff = 1300;
$confirmation = ROOM_RESERVATIONS_RESET_CONFIRMATION_MSG;
$error = ROOM_RESERVATIONS_RESET_ERROR_MSG;
}
$errors = FALSE;
$result = _room_reservations_set_variable('send_reminders', $send_reminders);
if (!$result) {
$errors = TRUE;
}
$result = _room_reservations_set_variable('reminder_time', $reminder_time);
if (!$result) {
$errors = TRUE;
}
$result = _room_reservations_set_variable('reminder_cutoff',
$reminder_cutoff);
if (!$result) {
$errors = TRUE;
}
if ($errors) {
drupal_set_message(check_plain($error), 'error');
}
else {
drupal_set_message(check_plain($confirmation));
}
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function room_reservations_admin_settings_email_submit($form_id, &$form_state) {\n if ($form_state['clicked_button']['#value'] == t('Save configuration')) {\n $from_address = $form_state['values']['from_address'];\n $confirmation_header = $form_state['values']['confirmation_header'];\n $confirmation_owner = $form_state['values']['confirmation_owner'];\n $confirmation_group = $form_state['values']['confirmation_group'];\n $reminder_header = $form_state['values']['reminder_header'];\n $reminder_owner = $form_state['values']['reminder_owner'];\n $reminder_group = $form_state['values']['reminder_group'];\n $confirmation = ROOM_RESERVATIONS_SAVE_CONFIRMATION_MSG;\n $error = ROOM_RESERVATIONS_SAVE_ERROR_MSG;\n }\n elseif ($form_state['clicked_button']['#value'] == t('Reset to defaults')) {\n $confirmation_header = '';\n $confirmation_owner = '';\n $confirmation_group = '';\n $reminder_header = '';\n $reminder_owner = '';\n $reminder_group = '';\n $confirmation = ROOM_RESERVATIONS_RESET_CONFIRMATION_MSG;\n $error = ROOM_RESERVATIONS_RESET_ERROR_MSG;\n }\n $errors = FALSE;\n $result = _room_reservations_set_variable('from_address', $from_address);\n if (!$result) {\n $errors = TRUE;\n }\n $result = _room_reservations_set_variable('confirmation_header_text', \n $confirmation_header);\n if (!$result) {\n $errors = TRUE;\n }\n $result = _room_reservations_set_variable('confirmation_owner_text', \n $confirmation_owner);\n if (!$result) {\n $errors = TRUE;\n }\n $result = _room_reservations_set_variable('confirmation_group_text', \n $confirmation_group);\n if (!$result) {\n $errors = TRUE;\n }\n $result = _room_reservations_set_variable('reminder_header_text', \n $reminder_header);\n if (!$result) {\n $errors = TRUE;\n }\n $result = _room_reservations_set_variable('reminder_owner_text', \n $reminder_owner);\n if (!$result) {\n $errors = TRUE;\n }\n $result = _room_reservations_set_variable('reminder_group_text', \n $reminder_group);\n if (!$result) {\n $errors = TRUE;\n }\n if ($errors) {\n drupal_set_message(check_plain($error), 'error');\n }\n else {\n drupal_set_message(check_plain($confirmation));\n }\n}",
"function room_reservations_admin_settings_default_email_submit($form_id, &$form_state) {\n if ($form_state['clicked_button']['#value'] == t('Save configuration')) {\n $option = $form_state['values']['options'];\n $domain = trim($form_state['values']['domain']);\n $confirmation = ROOM_RESERVATIONS_SAVE_CONFIRMATION_MSG;\n $error = ROOM_RESERVATIONS_SAVE_ERROR_MSG;\n }\n elseif ($form_state['clicked_button']['#value'] == t('Reset to defaults')) {\n $option = 0;\n $domain = '';\n $confirmation = ROOM_RESERVATIONS_RESET_CONFIRMATION_MSG;\n $error = ROOM_RESERVATIONS_RESET_ERROR_MSG;\n }\n $errors = FALSE;\n $result = _room_reservations_set_variable('default_email_address', $option);\n if (!$result) {\n $errors = TRUE;\n }\n $result = _room_reservations_set_variable('default_email_domain', $domain);\n if (!$result) {\n $errors = TRUE;\n }\n if ($errors) {\n drupal_set_message(check_plain($error), 'error');\n }\n else {\n drupal_set_message(check_plain($confirmation));\n }\n}",
"function room_reservations_admin_settings_page_submit($form_id, &$form_state) {\n if ($form_state['clicked_button']['#value'] == t('Save configuration')) {\n $calendar_text = $form_state['values']['calendar_text'];\n $reserve_room_instructions_text\n = $form_state['values']['reserve_instructions_text'];\n $reserve_form_instructions_text\n = $form_state['values']['form_instructions_text'];\n $policies = $form_state['values']['policies'];\n $confirmation = ROOM_RESERVATIONS_SAVE_CONFIRMATION_MSG;\n $error = ROOM_RESERVATIONS_SAVE_ERROR_MSG;\n }\n elseif ($form_state['clicked_button']['#value'] == t('Reset to defaults')) {\n $calendar_text = '';\n $reserve_room_instructions_text = '';\n $reserve_form_instructions_text = '';\n $policies = '';\n $confirmation = ROOM_RESERVATIONS_RESET_CONFIRMATION_MSG;\n $error = ROOM_RESERVATIONS_RESET_ERROR_MSG;\n }\n $errors = FALSE;\n $result = _room_reservations_set_variable('calendar_text', $calendar_text);\n if (!$result) {\n $errors = TRUE;\n }\n $result = _room_reservations_set_variable('reserve_instructions', \n $reserve_room_instructions_text);\n if (!$result) {\n $errors = TRUE;\n }\n $result = _room_reservations_set_variable('reserve_form_instructions', \n $reserve_form_instructions_text);\n if (!$result) {\n $errors = TRUE;\n }\n $result = _room_reservations_set_variable('policies', $policies);\n if (!$result) {\n $errors = TRUE;\n }\n if ($errors) {\n drupal_set_message(check_plain($error), 'error');\n }\n else {\n drupal_set_message(check_plain($confirmation));\n }\n}",
"function room_reservations_admin_settings_text_submit($form_id, &$form_state) {\n if ($form_state['clicked_button']['#value'] == t('Save configuration')) {\n $enable_text = $form_state['values']['enable_text'];\n $from_address = $form_state['values']['from_address'];\n $confirmation_header = $form_state['values']['confirmation_header'];\n $confirmation_owner = $form_state['values']['confirmation_owner'];\n $reminder_header = $form_state['values']['reminder_header'];\n $reminder_owner = $form_state['values']['reminder_owner'];\n $confirmation = ROOM_RESERVATIONS_SAVE_CONFIRMATION_MSG;\n $error = ROOM_RESERVATIONS_SAVE_ERROR_MSG;\n }\n elseif ($form_state['clicked_button']['#value'] == t('Reset to defaults')) {\n $enable_text = 0;\n $confirmation_header = '';\n $confirmation_owner = '';\n $reminder_header = '';\n $reminder_owner = '';\n $confirmation = ROOM_RESERVATIONS_RESET_CONFIRMATION_MSG;\n $error = ROOM_RESERVATIONS_RESET_ERROR_MSG;\n }\n $errors = FALSE;\n $result = _room_reservations_set_variable('enable_text', $enable_text);\n if (!$result) {\n $errors = TRUE;\n }\n $result = _room_reservations_set_variable('from_address_sms', $from_address);\n if (!$result) {\n $errors = TRUE;\n }\n $result = _room_reservations_set_variable('confirmation_header_text_sms', \n $confirmation_header);\n if (!$result) {\n $errors = TRUE;\n }\n $result = _room_reservations_set_variable('confirmation_owner_text_sms', \n $confirmation_owner);\n if (!$result) {\n $errors = TRUE;\n }\n $result = _room_reservations_set_variable('reminder_header_text_sms', \n $reminder_header);\n if (!$result) {\n $errors = TRUE;\n }\n $result = _room_reservations_set_variable('reminder_owner_text_sms', \n $reminder_owner);\n if (!$result) {\n $errors = TRUE;\n }\n if ($errors) {\n drupal_set_message(check_plain($error), 'error');\n }\n else {\n drupal_set_message(check_plain($confirmation));\n }\n}",
"function pdfbulletin_settings_form_submit(&$form, &$form_state) {\n $pdfbulletin = $form_state['values']['pdfbulletin'];\n $schedule = $pdfbulletin->schedule;\n\n $schedule['frequency'] = $form_state['values']['frequency'];\n $start_date = $form_state['values']['date'];\n $schedule['date'] = strtotime($start_date['year'] . '-' . $start_date['month'] . '-' . $start_date['day']);\n $schedule['send_empty'] = $form_state['values']['send_empty'];\n $schedule['scheduled'] = $schedule['scheduled'] & $form_state['values']['scheduled'] ? PDFBULLETIN_SCHEDULED_YES : PDFBULLETIN_SCHEDULED_NO;\n pdfbulletin_schedule_save($schedule);\n}",
"function room_reservations_admin_settings_mobile_submit($form_id, &$form_state) {\n if ($form_state['clicked_button']['#value'] == t('Save configuration')) {\n $mobile_url = trim($form_state['values']['mobile_url']);\n $main_database = trim($form_state['values']['main_database']);\n $confirmation = ROOM_RESERVATIONS_SAVE_CONFIRMATION_MSG;\n $error = ROOM_RESERVATIONS_SAVE_ERROR_MSG;\n }\n elseif ($form_state['clicked_button']['#value'] == t('Reset to defaults')) {\n $mobile_url = '';\n $main_database = '';\n $confirmation = ROOM_RESERVATIONS_RESET_CONFIRMATION_MSG;\n $error = ROOM_RESERVATIONS_RESET_ERROR_MSG;\n }\n $errors = FALSE;\n $result = _room_reservations_set_variable('mobile_url', $mobile_url);\n if (!$result) {\n $errors = TRUE;\n }\n $result = _room_reservations_set_variable('main_database', $main_database);\n if (!$result) {\n $errors = TRUE;\n }\n if ($errors) {\n drupal_set_message(check_plain($error), 'error');\n }\n else {\n drupal_set_message(check_plain($confirmation));\n }\n}",
"public function settings_page() {\n\n\t\t?>\n\n\t\t<div class=\"wrap schedule-a-visit-to-sherpa-settings\">\n\t\t\t\n\t\t\t<form id=\"schedule-a-visit-to-sherpa-form\" method=\"post\" action=\"options.php\">\n\t\t\t\t\n\t\t\t\t<?php echo wp_nonce_field( 'schedule_a_visit_to_sherpa_data', 'schedule_a_visit_to_sherpa_nonce' ); ?>\n\n\t\t\t\t<?php settings_fields( 'schedule_a_visit_to_sherpa_settings_section' ); ?>\n\n\t\t\t\t<?php do_settings_sections( 'schedule-a-visit-to-sherpa' ); ?>\n\t\t\t\t\n\t\t\t\t<?php submit_button(); ?>\n\n\t\t\t</form>\n\n </div>\n\n\t\t<?php\n\n\t}",
"public function settingsAction ()\n {\n $this->_pageTitle = ['Healthcheck', 'Settings'];\n $this->_navigation->setActiveStep(HealthCheckStepsModel::STEP_SETTINGS);\n\n if ($this->getRequest()->isPost())\n {\n $postData = $this->getRequest()->getPost();\n\n if (!isset($postData['goBack']))\n {\n $this->saveClientSettingsForm($postData);\n $this->saveHealthcheck();\n\n if (isset($postData['saveAndContinue']))\n {\n $this->updateHealthcheckStepName();\n $this->saveHealthcheck();\n $this->gotoNextNavigationStep($this->_navigation);\n }\n }\n else\n {\n $this->gotoPreviousNavigationStep($this->_navigation);\n }\n }\n else\n {\n $this->showClientSettingsForm();\n }\n }",
"function room_reservations_admin_settings_sms_submit($form_id, &$form_state) {\n if ($form_state['clicked_button']['#value'] == t('Save configuration')) {\n $sms_option = $form_state['values']['sms_option'];\n $confirmation = ROOM_RESERVATIONS_SAVE_CONFIRMATION_MSG;\n $error = ROOM_RESERVATIONS_SAVE_ERROR_MSG;\n }\n if ($form_state['clicked_button']['#value'] == t('Reset to defaults')) {\n $sms_option = 0;\n $confirmation = ROOM_RESERVATIONS_RESET_CONFIRMATION_MSG;\n $error = ROOM_RESERVATIONS_RESET_ERROR_MSG;\n }\n $result = _room_reservations_set_variable('sms_option', $sms_option);\n if (!$result) {\n $errors = TRUE;\n }\n if ($errors) {\n drupal_set_message(check_plain($error), 'error');\n }\n else {\n drupal_set_message(check_plain($confirmation));\n }\n}",
"function room_reservations_admin_settings_reminders($form, &$form_state) {\n $default_send_reminders = _room_reservations_get_variable('send_reminders');\n $default_reminder_time = _room_reservations_get_variable('reminder_time');\n $default_reminder_cutoff = _room_reservations_get_variable('reminder_cutoff');\n $options = array();\n $options['1300'] = t('1:00 PM');\n $options['1400'] = t('2:00 PM');\n $options['1500'] = t('3:00 PM');\n $options['1600'] = t('4:00 PM');\n $options['1700'] = t('5:00 PM');\n $options['1800'] = t('6:00 PM');\n $options['1900'] = t('7:00 PM');\n $options['2000'] = t('8:00 PM');\n $options['2100'] = t('9:00 PM');\n $options['2200'] = t('10:00 PM');\n $options['2300'] = t('11:00 PM');\n $form['send_reminders'] = array(\n '#title' => t('Send reminders.'),\n '#type' => 'checkbox',\n '#return_value' => 1,\n '#default_value' => $default_send_reminders,\n '#description' => t('Send reservation reminders.'),\n '#weight' => -100,\n );\n $form['reminder_time'] = array(\n '#title' => t('Send reminders daily at'),\n '#type' => 'select',\n '#description' => t('The time each day when reminders will be sent\n for the next day\\'s reservations. Note that a cron job must be\n set up to run at this time.'),\n '#options' => $options,\n '#default_value' => $default_reminder_time,\n '#multiple' => FALSE,\n '#weight' => -90,\n );\n $form['reminder_cutoff'] = array(\n '#title' => t('Send reminders for reservations created before'),\n '#type' => 'select',\n '#description' => t('For reservations created on the same day\n that the reminder is sent, only send a reminder if the\n reservation was created before this time. This is set so that\n patrons are not sent a reminder immediately after creating\n a reservation.'),\n '#options' => $options,\n '#default_value' => $default_reminder_cutoff,\n '#multiple' => FALSE,\n '#weight' => -80,\n );\n $form['save'] = array(\n '#type' => 'submit',\n '#value' => t('Save configuration'),\n '#weight' => 100,\n );\n $form['reset'] = array(\n '#type' => 'submit',\n '#value' => t('Reset to defaults'),\n '#weight' => 101,\n );\n return $form;\n}",
"public function settingsForm()\n {\n return 'forecastio-form-settings';\n }",
"private function render_settings() {\n\t\t?>\n\t\t<div class=\"wrap\">\n\t\t\t<h1><?php esc_html_e( 'Network Mail', 'simple-smtp' ); ?></h1>\n\t\t\t<form action='edit.php?action=wpsimplesmtpms' method='post'>\t\n\t\t\t\t<?php\n\t\t\t\twp_nonce_field( 'simple-smtp-ms' );\n\t\t\t\tdo_settings_sections( 'wpsimplesmtp_smtp_ms' );\n\t\t\t\tsubmit_button();\n\t\t\t\t?>\n\t\t\t</form>\n\t\t</div>\n\t\t<?php\n\t}",
"function _dataone_admin_settings_submit($form, &$form_state) {\n global $base_url;\n\n // Let menu_execute_active_handler() know that a menu rebuild may be required.\n variable_set('menu_rebuild_needed', TRUE);\n\n // Register updated node document.\n drupal_set_message(t('Don\\'t forget to register your changes with DataONE'), 'warning');\n $register_url = $base_url . '/admin/config/services/dataone/register/';\n $selected_versions = variable_get(DATAONE_VARIABLE_API_VERSIONS);\n foreach ($selected_versions as $version => $label) {\n $register_version_url = $register_url . $version;\n drupal_set_message(t('Register @ver: !url', array('@ver' => $label, '!url' => $register_version_url)), 'warning');\n }\n\n}",
"function ssbd_staticpage_settings_form($form, &$form_state) {\n $form['ssbd_staticpage_simulate_mobile'] = array(\n '#title' => t('Simulate Mobile'),\n '#type' => 'checkbox',\n '#required' => FALSE,\n '#default_value' => variable_get('ssbd_staticpage_simulate_mobile', NULL),\n );\n\n $form['submit'] = array(\n '#type' => 'submit',\n '#value' => t('Save settings'),\n );\n return $form;\n}",
"public function settings_screen() {\n\t\tglobal ${class_name};\n\t\tdo_action( ${class_name}->token . '_before_settings' );\n\t\tdo_action( $this->token . '_before_settings' );\n\t\tsettings_fields( $this->token );\n\t\tdo_settings_sections( $this->token );\n\t\tdo_action( $this->token . '_after_settings' );\n\t\tdo_action( ${class_name}->token . '_after_settings' );\n\t\tsubmit_button();\n\t}",
"public function processConfiguration()\n\t{\n\t\t// Check if the value sent on form submit matches one of either $_POST or $_GET keys \n\t\tif (Tools::isSubmit('submit_emailmystock_form'))\n\t\t{\n\t\t\t$enable_emails = Tools::getValue('enable_emails');\n\t\t\t// Update configuration value to database\n\t\t\tConfiguration::updateValue('MYMOD_EMAILS', $enable_emails);\n\t\t\t// Allows the Smarty object to display a confirmation message when the configuration is saved (see top of getContent.tpl)\n\t\t\t$this->context->smarty->assign('confirmation', 'ok');\n\t\t}\n\t}",
"function wpsc_merchant_paymentsense_settings_form_submit() {\r\n\treturn wpsc_merchant_paymentsense::submit_paymentsense_settings_form();\r\n}",
"function room_reservations_admin_settings_page($form, &$form_state) {\n $default_calendar_text = _room_reservations_get_variable('calendar_text');\n $default_reserve_room_instructions_text\n = _room_reservations_get_variable('reserve_instructions');\n $default_reserve_form_instructions_text\n = _room_reservations_get_variable('reserve_form_instructions');\n $default_policies = _room_reservations_get_variable('policies');\n $form['calendar_text'] = array(\n '#title' => t('Calendar page text'),\n '#type' => 'textarea',\n '#rows' => 5,\n '#description' => t('Text displayed at the top of the reservation\n calendar page.'),\n '#default_value' => $default_calendar_text,\n '#weight' => -90,\n );\n $form['reserve_instructions_text'] = array(\n '#title' => t('Reserve a room instructions text'),\n '#type' => 'textarea',\n '#rows' => 2,\n '#description' => t('Text displayed just above the words Reservation\n Calendar on the reservation calendar page.'),\n '#default_value' => $default_reserve_room_instructions_text,\n '#weight' => -80,\n );\n $form['form_instructions_text'] = array(\n '#title' => t('Reservation form instructions text'),\n '#type' => 'textarea',\n '#rows' => 2,\n '#description' => t('Text displayed at the top of the reservation form.'),\n '#default_value' => $default_reserve_form_instructions_text,\n '#weight' => -70,\n );\n $form['policies'] = array(\n '#title' => t('Policies'),\n '#type' => 'textarea',\n '#rows' => 10,\n '#description' => t('Policies displayed on the reservation policies page.'),\n '#default_value' => $default_policies,\n '#weight' => -60,\n );\n $form['save'] = array(\n '#type' => 'submit',\n '#value' => t('Save configuration'),\n '#weight' => 100,\n );\n $form['reset'] = array(\n '#type' => 'submit',\n '#value' => t('Reset to defaults'),\n '#weight' => 101,\n );\n return $form;\n}",
"private function settings()\n\t{\n\t\tif($_POST)\n\t\t{\n\t\t\t// Available Vews\n config::set('s7n.views', $this->input->post('views'));\n\n\t\t\t// Default Sidebar Title\n config::set('s7n.default_sidebar_title', $this->input->post('default_sidebar_title'));\n\n\t\t\t// Default Sidebar Content\n config::set('s7n.default_sidebar_content', $this->input->post('default_sidebar_content'));\n\n\t\t\tmessage::info(__('Page Settings edited successfully'), 'admin/page/settings');\n\t\t}\n\n\t\t$this->head->title->append(__('Settings'));\n\n\t\t$this->template->title .= __('Settings');\n\t\t$this->template->content = View::factory('page/settings', array(\n\t\t\t'views' => config::get('s7n.page_views'),\n\t\t\t'default_sidebar_title' => config::get('s7n.default_sidebar_title'),\n\t\t\t'default_sidebar_content' => config::get('s7n.default_sidebar_content')\n\t\t));\n\t}",
"public function save_settings()\n\t{\n\t\tif ( $_POST && wp_verify_nonce( $_POST['save-confirm-user-registration-settings-nonce'], 'save-confirm-user-registration-settings' ) ) :\n\t\t\t$options = array(\n\t\t\t\t'error' => $_POST['error'],\n\t\t\t\t'from' => $_POST['from'],\n\t\t\t\t'subject' => $_POST['subject'],\n\t\t\t\t'message' => $_POST['message']\n\t\t\t);\n\n\t\t\t$options = apply_filters( 'confirm-user-registration-save-options', $options );\n\t\t\tupdate_site_option( 'confirm-user-registration', $options);\n\n\t\t\t?>\n\t\t\t<div class=\"updated message\">\n\t\t\t\t<p><?php _e( 'Saved' ); ?></p>\n\t\t\t</div>\n\t\t\t<?php\n\t\tendif;\n\t}",
"function room_reservations_admin_settings_email($form, &$form_state) {\n $default_from_address\n = _room_reservations_get_variable('from_address');\n $default_confirmation_header_text\n = _room_reservations_get_variable('confirmation_header_text');\n $default_confirmation_owner_text\n = _room_reservations_get_variable('confirmation_owner_text');\n $default_confirmation_group_text\n = _room_reservations_get_variable('confirmation_group_text');\n $default_reminder_header_text\n = _room_reservations_get_variable('reminder_header_text');\n $default_reminder_owner_text\n = _room_reservations_get_variable('reminder_owner_text');\n $default_reminder_group_text\n = _room_reservations_get_variable('reminder_group_text');\n $tokens = array(\n '%reservation_name' => t('The name given to the reservation to identify it\n on the reservation calendar.'),\n '%room' => t('The room that has been reserved.'),\n '%month' => t('The full name of the month of the reservation date.'),\n '%month_number' => t('The month number of the reservation date.'),\n '%day' => t('The numeric day of the month of the reservation date.'),\n '%day_of_the_week' => t('The full name of the day of the week of the\n reservation date.'),\n '%time' => t('The time of the reservation.'),\n '%minutes' => t('The length of the reservation in minutes.'),\n );\n $token_display = '<p>' .\n t('The following tokens will be replaced with dynamic values in any of the\n fields below.') . '</p><ul>';\n foreach ($tokens as $key => $value) {\n $token_display .= '<li>' . $key . ' - ' . $value . '</li>';\n }\n $token_display .= '</ul>';\n $form['from_address'] = array(\n '#title' => t('From address'),\n '#type' => 'textfield',\n '#maxlength' => 100,\n '#size' => 100,\n '#description' => t('The from address on all email messages.'),\n '#default_value' => $default_from_address,\n '#weight' => -110,\n );\n $form['tokens'] = array(\n '#type' => 'fieldset',\n '#title' => t('Token values'),\n '#collapsible' => TRUE,\n '#collapsed' => TRUE,\n '#weight' => -100,\n );\n $form['tokens']['values'] = array(\n '#value' => $token_display,\n );\n $form['confirmation_header'] = array(\n '#title' => t('Confirmation heading'),\n '#type' => 'textfield',\n '#maxlength' => 100,\n '#size' => 100,\n '#description' => t('The heading for all confirmation messages.'),\n '#default_value' => $default_confirmation_header_text,\n '#weight' => -97,\n );\n $form['confirmation_owner'] = array(\n '#title' => t('Confirmation body'),\n '#type' => 'textarea',\n '#rows' => 8,\n '#description' => t('Confirmation message sent to the person who has made a\n reservation.'),\n '#default_value' => $default_confirmation_owner_text,\n '#weight' => -95,\n );\n $form['confirmation_group'] = array(\n '#title' => t('Confirmation to group members body'),\n '#type' => 'textarea',\n '#rows' => 8,\n '#description' => t('Confirmation message sent to all members of the group\n except for the person who made the reservation.'),\n '#default_value' => $default_confirmation_group_text,\n '#weight' => -90,\n );\n $form['reminder_header'] = array(\n '#title' => t('Reminder heading'),\n '#type' => 'textfield',\n '#maxlength' => 100,\n '#size' => 100,\n '#description' => t('The heading for all reminder messages.'),\n '#default_value' => $default_reminder_header_text,\n '#weight' => -85,\n );\n $form['reminder_owner'] = array(\n '#title' => t('Reminder body'),\n '#type' => 'textarea',\n '#rows' => 8,\n '#description' => t('Reminder message sent to the person who has made a\n reservation.'),\n '#default_value' => $default_reminder_owner_text,\n '#weight' => -80,\n );\n $form['reminder_group'] = array(\n '#title' => t('Reminder to group members body'),\n '#type' => 'textarea',\n '#rows' => 8,\n '#description' => t('Reminder message sent to all members of the group\n except for the person who made the reservation.'),\n '#default_value' => $default_reminder_group_text,\n '#weight' => -75,\n );\n $form['save'] = array(\n '#type' => 'submit',\n '#value' => t('Save configuration'),\n '#weight' => 100,\n );\n $form['reset'] = array(\n '#type' => 'submit',\n '#value' => t('Reset to defaults'),\n '#weight' => 101,\n );\n return $form;\n}",
"protected function processForm(){\n if(Tools::isSubmit('saveBtn')){ // save data\n $settings = array(\n 'user' => Tools::getValue('user'),\n 'widget_id' => Tools::getValue('widget_id'),\n 'tweets_limit' => Tools::getValue('tweets_limit'),\n 'follow_btn' => Tools::getValue('follow_btn')\n );\n Configuration::updateValue($this->name.'_settings', serialize($settings));\n \n // display success message\n return $this->displayConfirmation($this->l('The settings have been successfully saved!'));\n }\n \n return '';\n }",
"public function setForm() {\n\t\t$translator = Zend_Registry::get('Zend_Translate');\n\t\t$this->setMethod('post');\n\t\t \n\t\t$this->addEnabled();\n\t\t$this->addRentDueDay();\n\t\t$this->addProrationType();\n\t\t$this->addProrationApplyMonth();\n\t\t$this->addSecondMonthDue();\n\t\t$this->addSubmitButton();\n\n\t\t$this->addDisplayGroup( $this->displayGroupArray, 'updateRentProrationSetting',array('legend' => 'rentProrationSettings'));\n\t\t$this->getDisplayGroup('updateRentProrationSetting')->setDecorators(array(\n 'FormElements',\n 'Fieldset', \n\t\t));\n\t}",
"private function getConfigurationForm()\n {\n $form = array(\n 'form' => array(\n 'id_form' => 'module_config',\n 'legend' => array(\n 'title' => $this->l('Configuration'),\n 'icon' => 'icon-cogs'\n ),\n 'input' => array(\n array(\n 'label' => $this->l('Enable/Disable'),\n 'type' => 'switch',\n 'name' => 'kbpushnotification[enable]',\n 'values' => array(\n array(\n 'value' => 1,\n ),\n array(\n 'value' => 0,\n ),\n ),\n 'hint' => $this->l('Enable/Disable the plugin')\n ),\n array(\n 'label' => $this->l('Enable/Disable Order Status Update'),\n 'type' => 'switch',\n 'name' => 'kbpushnotification[enable_order_status]',\n 'values' => array(\n array(\n 'value' => 1,\n ),\n array(\n 'value' => 0,\n ),\n ),\n 'hint' => $this->l('Enable/Disable the order status update')\n ),\n array(\n 'label' => $this->l('Enable/Disable Abandoned Cart alert'),\n 'type' => 'switch',\n 'name' => 'kbpushnotification[enable_abandoned_cart]',\n 'values' => array(\n array(\n 'value' => 1,\n ),\n array(\n 'value' => 0,\n ),\n ),\n 'hint' => $this->l('Enable/Disable the abandoned cart alert')\n ),\n array(\n 'label' => $this->l('Enable/Disable Product Price alert'),\n 'type' => 'switch',\n 'name' => 'kbpushnotification[enable_product_price_alert]',\n 'values' => array(\n array(\n 'value' => 1,\n ),\n array(\n 'value' => 0,\n ),\n ),\n 'hint' => $this->l('Enable/Disable the product price alert')\n ),\n array(\n 'label' => $this->l('Enable/Disable Product back in stock alert'),\n 'type' => 'switch',\n 'name' => 'kbpushnotification[enable_product_stock_alert]',\n 'values' => array(\n array(\n 'value' => 1,\n ),\n array(\n 'value' => 0,\n ),\n ),\n 'hint' => $this->l('Enable/Disable the product back in stock alert')\n ),\n ),\n 'submit' => array(\n 'title' => $this->l('Save'),\n 'class' => 'btn btn-default pull-right kbph_general_btn'\n ),\n ),\n );\n return $form;\n }",
"public function form()\n\t{\n\t\tglobal $L;\n\t\t$sentEmails = $this->getSentEmailsArray();\n\n\t\t$html = '<div class=\"alert alert-primary\" role=\"alert\">';\n\t\t$html .= $this->description();\n\t\t$html .= '</div>';\n\n\t\t$html .= '<div>';\n\t\t// API key\n\t\t$html .= '<label><strong>Buttondown API Key</strong></label>';\n\t\t$html .= '<input id=\"apiKey\" name=\"apiKey\" type=\"text\" value=\"'.$this->getValue('apiKey').'\">';\n\t\t$html .= '<span class=\"tip\">Copy your API key on https://buttondown.email/settings/programming </span>';\n\t\t// Sending paused\n\t\t$html .= '<label>'.$L->get('paused').'</label>';\n\t\t$html .= '<select id=\"paused\" name=\"paused\" type=\"text\">';\n\t\t$html .= '<option value=\"true\" '.($this->getValue('paused')===true?'selected':'').'>'.$L->get('is-paused').'</option>';\n\t\t$html .= '<option value=\"false\" '.($this->getValue('paused')===false?'selected':'').'>'.$L->get('is-active').'</option>';\n\t\t$html .= '</select>';\n\t\t$html .= '<span class=\"tip\">'.$L->get('paused-tip').'</span>';\n\n\t\t// Start date\n\t\t$html .= '<label>'.$L->get('send-after').'</label>';\n\t\t$html .= '<input id=\"startDate\" name=\"startDate\" type=\"text\" value=\"'.$this->getValue('startDate').'\">';\n\t\t$html .= '<span class=\"tip\">'.$L->get('send-after-tip').'</span>';\n\t\t// Subject Prefix\n\t\t$html .= '<label>'.$L->get('subject-prefix').'</label>';\n\t\t$html .= '<input id=\"subjectPrefix\" name=\"subjectPrefix\" type=\"text\" value=\"'.$this->getValue('subjectPrefix').'\">';\n\t\t$html .= '<span class=\"tip\">'.$L->get('subject-prefix-tip').'</span>';\n\t\t\t\t// Sending paused\n\t\t$html .= '<label>'.$L->get('include-cover').'</label>';\n\t\t$html .= '<select id=\"includeCover\" name=\"includeCover\" type=\"text\">';\n\t\t$html .= '<option value=\"true\" '.($this->getValue('includeCover')===true?'selected':'').'>'.$L->get('yes').'</option>';\n\t\t$html .= '<option value=\"false\" '.($this->getValue('includeCover')===false?'selected':'').'>'.$L->get('no').'</option>';\n\t\t$html .= '</select>';\n\t\t$html .= '<span class=\"tip\">'.$L->get('include-cover-tip').'</span>';\n\t\t$html .= '</div><hr>';\n\t\t// List of page keys for which mail was sent \n\t\t$html .= '<h4>'.$L->get('sent-list').'</h4>';\n\t\t$html .= '<span class=\"tip\">'.$L->get('sent-list-tip').'</span>';\n\t\t$html .= '<div style=\"overflow-y: scroll; height:400px;\"><ul>';\n\t\tforeach ($sentEmails as $sentKey):\n\t\t\t$html .= '<li>'.$sentKey.'</li>';\n\t\tendforeach;\n\t\t$html .= '</ul></div>';\n\t\t$html .= '<div><a target=\"_blank\" rel=\"noopener\" href=\"https://buttondown.email/archive\">Buttondown Archive</a></div>';\n\t\treturn $html;\n\t}",
"function messenger_config_form($form, &$form_state)\n{\n\n $form[MESSENGER_URL] = array(\n '#type' => 'textfield',\n '#title' => t('API url'),\n '#default_value' => variable_get(MESSENGER_URL, ''),\n '#description' => t('The api url. eg: http://api.domain.com'),\n '#required' => TRUE,\n );\n\n $form[MESSENGER_SECRET] = array(\n '#type' => 'textfield',\n '#title' => t('Secret'),\n '#default_value' => variable_get(MESSENGER_SECRET, ''),\n '#description' => t('API secret.'),\n '#required' => TRUE,\n );\n\n $form[GIPHY_API] = array(\n '#type' => 'textfield',\n '#title' => t('Giphy api key'),\n '#default_value' => variable_get(GIPHY_API, DEFAULT_GIPHY_API),\n '#description' => t('Enter Giphy api.'),\n '#required' => TRUE,\n );\n\n $form[GIPHY_EXCLUDE_KEYWORD] = array(\n '#type' => 'textarea',\n '#title' => t('Giphy exclude keywords'),\n '#default_value' => variable_get(GIPHY_EXCLUDE_KEYWORD, ''),\n '#description' => t('Enter a word per line'),\n '#required' => FALSE,\n );\n\n //MESSENGER_OFFSET\n $form[MESSENGER_OFFSET] = array(\n '#type' => 'textfield',\n '#title' => t('Inbox Offset Height'),\n '#default_value' => variable_get(MESSENGER_OFFSET, 300),\n '#description' => t('Use offset to calculate height of inbox'),\n '#required' => FALSE,\n );\n\n return system_settings_form($form);\n\n\n}",
"protected function getConfigForm()\n {\n $config_form = array(\n 'form' => array(\n 'legend' => array(\n 'title' => $this->l('Settings'),\n 'icon' => 'icon-cogs',\n ),\n 'input' => array(\n array(\n 'type' => 'switch',\n 'label' => $this->l('Equivalence surcharge'),\n 'name' => 'PROFITMARGIN_EQUIVALENCE_SURCHARGE_ENABLED',\n 'is_bool' => true,\n 'desc' => $this->l('Enable equivalence surcharge when calculating profit'),\n 'values' => array(\n array(\n 'id' => 'active_on',\n 'value' => true,\n 'label' => $this->l('Enabled')\n ),\n array(\n 'id' => 'active_off',\n 'value' => false,\n 'label' => $this->l('Disabled')\n )\n ),\n ),\n ),\n 'submit' => array(\n 'title' => $this->l('Save'),\n ),\n ),\n );\n\n\n $available_taxes = $this->getAvailableTaxes();\n foreach ($available_taxes as $tax) {\n $config_form['form']['input'][] = array(\n 'type' => 'text',\n 'name' => \"PROFITMARGIN_EQUIVALENCE_SURCHARGE_{$tax['id_tax']}\",\n 'label' => $this->l($tax['name']),\n 'desc' => $this->l('Equivalence surcharge'),\n 'suffix' => '%', \n 'col' => 1,\n );\n }\n\n $config_form['form']['input'][] = array( // @TODO: Default shipping cost for each carrier\n 'type' => 'text',\n 'name' => 'PROFITMARGIN_DEFAULT_SHIPPING_COST',\n 'label' => $this->l('Default shipping cost'),\n 'suffix' => '€', \n 'col' => 1,\n );\n\n $config_form['form']['input'][] = array(\n 'type' => 'radio',\n 'name' => 'PROFITMARGIN_SHIPPING_COST_TAX',\n 'label' => $this->l('Shipping cost tax'),\n 'values' => array()\n );\n \n foreach ($available_taxes as $tax) {\n $shipping_cost_tax = &$config_form['form']['input'];\n $shipping_cost_tax[array_key_last($shipping_cost_tax)]['values'][] = array(\n 'id' => \"tax_{$tax['id_tax']}\",\n 'value' => $tax['id_tax'],\n 'label' => $this->l($tax['name'])\n );\n }\n \n foreach ($this->getAvailablePaymentModules() as $payment_module) {\n $config_form['form']['input'][] = array(\n 'type' => 'text',\n 'name' => \"PROFITMARGIN_PAYMENT_FEE_BASE_{$payment_module['id_module']}\",\n 'label' => $this->l($payment_module['name']),\n 'desc' => $this->l('Base fee'),\n 'suffix' => '€', \n 'col' => 1,\n );\n $config_form['form']['input'][] = array(\n 'type' => 'text',\n 'name' => \"PROFITMARGIN_PAYMENT_FEE_PERCENTAGE_{$payment_module['id_module']}\",\n 'desc' => $this->l('Percentage fee'),\n 'suffix' => '%',\n 'col' => 1,\n );\n }\n\n return $config_form;\n }",
"function simplenews_admin_settings_newsletter($form, &$form_state) {\n $address_default = variable_get('site_mail', ini_get('sendmail_from'));\n $form = array();\n\n $form['simplenews_default_options'] = array(\n '#type' => 'fieldset',\n '#title' => t('Default newsletter options'),\n '#collapsible' => FALSE,\n '#description' => t('These options will be the defaults for new newsletters, but can be overridden in the newsletter editing form.'),\n );\n $links = array('!mime_mail_url' => 'http://drupal.org/project/mimemail', '!html_url' => 'http://drupal.org/project/htmlmail');\n $description = t('Default newsletter format. Install <a href=\"!mime_mail_url\">Mime Mail</a> module or <a href=\"!html_url\">HTML Mail</a> module to send newsletters in HTML format.', $links);\n $form['simplenews_default_options']['simplenews_format'] = array(\n '#type' => 'select',\n '#title' => t('Format'),\n '#options' => simplenews_format_options(),\n '#description' => $description,\n '#default_value' => variable_get('simplenews_format', 'plain'),\n );\n // @todo Do we need these master defaults for 'priority' and 'receipt'?\n $form['simplenews_default_options']['simplenews_priority'] = array(\n '#type' => 'select',\n '#title' => t('Priority'),\n '#options' => simplenews_get_priority(),\n '#description' => t('Note that email priority is ignored by a lot of email programs.'),\n '#default_value' => variable_get('simplenews_priority', SIMPLENEWS_PRIORITY_NONE),\n );\n $form['simplenews_default_options']['simplenews_receipt'] = array(\n '#type' => 'checkbox',\n '#title' => t('Request receipt'),\n '#default_value' => variable_get('simplenews_receipt', 0),\n '#description' => t('Request a Read Receipt from your newsletters. A lot of email programs ignore these so it is not a definitive indication of how many people have read your newsletter.'),\n );\n $form['simplenews_default_options']['simplenews_send'] = array(\n '#type' => 'radios',\n '#title' => t('Default send action'),\n '#options' => array(\n SIMPLENEWS_COMMAND_SEND_TEST => t('Send one test newsletter to the test address'),\n SIMPLENEWS_COMMAND_SEND_NOW => t('Send newsletter'),\n ),\n '#default_value' => variable_get('simplenews_send', 0),\n );\n $form['simplenews_test_address'] = array(\n '#type' => 'fieldset',\n '#title' => t('Test addresses'),\n '#collapsible' => FALSE,\n '#description' => t('Supply a comma-separated list of email addresses to be used as test addresses. The override function allows to override these addresses in the newsletter editing form.'),\n );\n $form['simplenews_test_address']['simplenews_test_address'] = array(\n '#type' => 'textfield',\n '#title' => t('Email address'),\n '#size' => 60,\n '#maxlength' => 128,\n '#default_value' => variable_get('simplenews_test_address', $address_default),\n );\n $form['simplenews_test_address']['simplenews_test_address_override'] = array(\n '#type' => 'checkbox',\n '#title' => t('Allow test address override'),\n '#default_value' => variable_get('simplenews_test_address_override', 0),\n );\n $form['simplenews_sender_info'] = array(\n '#type' => 'fieldset',\n '#title' => t('Sender information'),\n '#collapsible' => FALSE,\n '#description' => t('Default sender address that will only be used for confirmation emails. You can specify sender information for each newsletter separately on the newsletter\\'s settings page.'),\n );\n $form['simplenews_sender_info']['simplenews_from_name'] = array(\n '#type' => 'textfield',\n '#title' => t('From name'),\n '#size' => 60,\n '#maxlength' => 128,\n '#default_value' => variable_get('simplenews_from_name', variable_get('site_name', 'Drupal')),\n );\n $form['simplenews_sender_info']['simplenews_from_address'] = array(\n '#type' => 'textfield',\n '#title' => t('From email address'),\n '#size' => 60,\n '#maxlength' => 128,\n '#required' => TRUE,\n '#default_value' => variable_get('simplenews_from_address', $address_default),\n );\n\n return system_settings_form($form);\n}",
"public function form()\n {\n $this->switch('footer_remove', Support::trans('main.footer_remove'))\n ->default(admin_setting('footer_remove'));\n $defaultColors = [\n 'default' => '墨蓝',\n 'blue' => '蓝',\n 'blue-light' => '亮蓝',\n 'green' => '墨绿',\n ];\n foreach (explode(\",\", ServiceProvider::setting('additional_theme_colors')) as $value) {\n if (!empty($value)) {\n [$k, $v] = explode(\":\", $value);\n $defaultColors[$k] = $v;\n }\n }\n\n $this->radio('theme_color', Support::trans('main.theme_color'))\n ->options($defaultColors)\n ->default(admin_setting('theme_color'));\n $this->radio('sidebar_style', Support::trans('main.sidebar_style'))\n ->options([\n 'default' => '默认',\n 'sidebar-separate' => '菜单分离',\n 'horizontal_menu' => '水平菜单'\n ])\n ->default(admin_setting('sidebar_style'));\n $this->switch('grid_row_actions_right', Support::trans('main.grid_row_actions_right'))\n ->help('启用后表格行操作按钮将永远贴着最右侧。')\n ->default(admin_setting('grid_row_actions_right'));\n }",
"public function form()\n {\n if ( ! auth()->guard('admin')->user()->can('access form ' . $this->table)) {\n return redirect()->route('admin.setting.index')->with('alert-danger', __($this->noPermission));\n }\n $view = [\n 'back' => route('admin.setting.index'),\n 'title' => __('Form Settings'),\n 'breadcrumbs' => [\n route('admin.setting.index') => __('Setting'),\n route('admin.setting.role.index') => __('Form'),\n null => __('Edit')\n ],\n 'subtitle' => __('All About Form Settings'),\n 'description' => __('You can adjust all form settings here'),\n 'navs' => $this->settings,\n 'setting' => $this->settings->where('slug', 'form')->first(),\n 'forms' => json_decode(setting('form_settings')),\n 'formLimiters' => [\n 'None' => __('None'),\n 'Quota' => __('Quota'),\n 'Datetime' => __('Datetime'),\n 'Both' => __('Both'),\n ]\n ];\n return view('admin.setting.form.index', $view);\n }"
] |
[
"0.68266284",
"0.66509336",
"0.65307397",
"0.6522413",
"0.65213937",
"0.6459028",
"0.6448973",
"0.6420151",
"0.6413463",
"0.63649213",
"0.63585955",
"0.6334275",
"0.6331288",
"0.63168037",
"0.6307329",
"0.63059443",
"0.62965363",
"0.6257144",
"0.62453884",
"0.6241739",
"0.6208408",
"0.62013024",
"0.6201136",
"0.61977136",
"0.6179189",
"0.61358523",
"0.6126924",
"0.61225355",
"0.6091434",
"0.60817087"
] |
0.71838605
|
0
|
Form validation for the Settings / Reminders configuration page.
|
function room_reservations_admin_settings_reminders_validate($form_id, &$form_state) {
if ($form_state['clicked_button']['#value'] == t('Save configuration')) {
$reminder_time = $form_state['values']['reminder_time'];
$reminder_cutoff = $form_state['values']['reminder_cutoff'];
if ($reminder_time < $reminder_cutoff) {
$field = 'reminder_time';
$message = t("'Send reminder daily at' time cannot be earlier than 'Send reminders for reservations created before' time.");
form_set_error($field, check_plain($message));
}
}
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function redmine_sso_admin_settings_validate($form, $form_state) {\n /**\n * TODO\n * check url\n * check if group exsists\n * check if project exsists\n */\n}",
"function pdfbulletin_settings_form_validate(&$form, &$form_state) {\n // @todo SERIOUSLY\n}",
"private function _validate_settings()\n\t{\n\n\t\treturn TRUE;\n\t}",
"function room_reservations_admin_settings_validate($form_id, &$form_state) {\n if ($form_state['clicked_button']['#value'] == t('Save configuration')) {\n // Open reservations per user.\n $data = $form_state['values']['room_reservations_reservations_per_user'];\n if (!ctype_digit($data)) {\n $field = 'room_reservations_reservations_per_user';\n $message = t('Open reservations per user must be numeric.');\n form_set_error($field, check_plain($message));\n }\n // Reservations per day.\n $data = $form_state['values']['room_reservations_reservations_per_day'];\n if (!ctype_digit($data)) {\n $field = 'room_reservations_reservations_per_day';\n $message = t('Reservations per day must be numeric.');\n form_set_error($field, check_plain($message));\n }\n }\n}",
"function room_reservations_admin_settings_text_validate($form_id, &$form_state) {\n if ($form_state['clicked_button']['#value'] == t('Save configuration')) {\n $from_address = $form_state['values']['from_address'];\n if (valid_email_address($from_address)) {\n // Valid.\n }\n else {\n $field = 'from_address';\n $message = t('Invalid email address.');\n form_set_error($field, check_plain($message));\n }\n }\n}",
"function room_reservations_admin_settings_default_email_validate(\n $form_id, &$form_state) {\n if ($form_state['clicked_button']['#value'] == t('Save configuration')) {\n $option = $form_state['values']['options'];\n $domain = trim($form_state['values']['domain']);\n if (($option == 2) && (!$domain)) {\n $field = 'domain';\n $message = t('A domain name must be entered when this option is selected.');\n form_set_error($field, check_plain($message));\n }\n }\n}",
"protected function ValidateForm()\n {\n return true;\n }",
"function fullcalendar_admin_settings_validate($form, &$form_state) {\n form_set_value($form['fullcalendar_path'], rtrim($form['fullcalendar_path']['#value'], \"/\"), $form_state);\n}",
"public function check_form()\n\t{\n\t\tProfil_fields_forum::validate(PROFIL_FIELDS_CONTACT, 'contact', $this->errstr, Fsb::$session->id());\n\t}",
"function room_reservations_admin_settings_email_validate($form_id, &$form_state) {\n if ($form_state['clicked_button']['#value'] == t('Save configuration')) {\n $from_address = $form_state['values']['from_address'];\n if (valid_email_address($from_address)) {\n // Valid.\n }\n else {\n $field = 'from_address';\n $message = t('Invalid email address.');\n form_set_error($field, check_plain($message));\n }\n }\n}",
"function postageapp_admin_form_validate($form, &$form_state) { \n //\n $api_key = $form_state['values']['postageapp_api_key'];\n \n if ($api_key) {\n $postage = new PostageApp($api_key);\n $valid_key = $postage->get_project_info();\n \n if ($valid_key->response->status == 'ok') {\n drupal_set_message(t('Your API key is valid. Welcome to PostageApp.'), \"status\");\n drupal_set_message(t('To complete settings add \"$conf[\\'mail_system\\'][\\'default-system\\'] = \\'PostageappDrupalMail\\';\" to settings.php (without duoble quotes). This settings override default mail system in Drupal to use Postageapp as mail delivery service.'), 'info');\n }\n else {\n form_set_error('postageapp_api_key', t($valid_key->response->message));\n }\n }\n}",
"public function validateConfigurationForm(array &$form, FormStateInterface $form_state);",
"function app_settings()\n\t{\n\t\t\t\t\n\t$this->data['message'] \t= ($this->ion_auth->errors() ? $this->ion_auth->errors() : $this->session->flashdata('message'));\n\t\tif ($this->input->post()) \n\t\t{\n\t\t\t$this->check_isdemo(URL_SITE_SETTINGS);\n\t\t\t$this->form_validation->set_rules(\n\t\t\t'site_title', \n\t\t\t$this->phrases['site title'], \n\t\t\t'required');\n\t\t\t$this->form_validation->set_rules(\n\t\t\t'sitename', \n\t\t\t$this->phrases['site name'], \n\t\t\t'required');\n\t\t\t$this->form_validation->set_rules(\n\t\t\t'address', \n\t\t\t$this->phrases['address'], \n\t\t\t'required');\n\t\t\t$this->form_validation->set_rules(\n\t\t\t'city', \n\t\t\t$this->phrases['city'], \n\t\t\t'required');\n\t\t\t$this->form_validation->set_rules(\n\t\t\t'state', \n\t\t\t$this->phrases['state'], \n\t\t\t'required');\n\t\t\t$this->form_validation->set_rules(\n\t\t\t'country', \n\t\t\t$this->phrases['country'], \n\t\t\t'required');\n\t\t\t$this->form_validation->set_rules(\n\t\t\t'latitude', \n\t\t\t$this->phrases['latitude'], \n\t\t\t'required');\n\t\t\t$this->form_validation->set_rules(\n\t\t\t'longitude', \n\t\t\t$this->phrases['longitude'], \n\t\t\t'required');\n\t\t\t$this->form_validation->set_rules(\n\t\t\t'zip', \n\t\t\t$this->phrases['zip code'], \n\t\t\t'required');\n\t\t\t$this->form_validation->set_rules(\n\t\t\t'phone', \n\t\t\t$this->phrases['phone'], \n\t\t\t'required|min_length[10])|max_length[11]');\n\t\t\t$this->form_validation->set_rules(\n\t\t\t'portal_email', \n\t\t\t$this->phrases['contact email'], \n\t\t\t'required|valid_email');\n\t\t\t\n\t\t\t$this->form_validation->set_rules(\n\t\t\t'language_id', \n\t\t\t$this->phrases['select language'], \n\t\t\t'required');\n\t\t\t$this->form_validation->set_rules(\n\t\t\t'design_by', \n\t\t\t$this->phrases['design by'], \n\t\t\t'required');\n\t\t\t$this->form_validation->set_rules(\n\t\t\t'rights_reserved_content', \n\t\t\t$this->phrases['rights reserved'], \n\t\t\t'required');\n\t\t\t$this->form_validation->set_rules(\n\t\t\t'ios_url', \n\t\t\t$this->phrases['ios url'], \n\t\t\t'required');\n\t\t\t$this->form_validation->set_rules(\n\t\t\t'android_url', \n\t\t\t$this->phrases['android url'], \n\t\t\t'required');\n\t\t\t$this->form_validation->set_rules(\n\t\t\t'from_time', \n\t\t\t$this->phrases['from time'], \n\t\t\t'required');\n\t\t\t$this->form_validation->set_rules(\n\t\t\t'to_time', \n\t\t\t$this->phrases['to time'], \n\t\t\t'required');\n\t\t\t\n\t\t\t$this->form_validation->set_error_delimiters('<div class=\"error\">', '</div>');\n\t\t\t\n\t\t\tif (!empty($_FILES['userfile']['name'])) {\n\t\t\t\t$ext = pathinfo($_FILES['userfile']['name'], PATHINFO_EXTENSION);\n\t\t\t\t\n\t\t\t\tif (($ext != \"gif\") && ($ext != \"jpg\") && ($ext != \"png\") && ($ext != \"jpeg\")) {\n\t\t\t\t\t$msg = (isset($this->phrases['invalid file'])) ? $this->phrases['invalid file'] : \"Invalid File\";\n\t\t\t\t\t$this->prepare_flashmessage($msg, 1);\n\t\t\t\t\tredirect(URL_SITE_SETTINGS);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ($this->form_validation->run() \t== TRUE\t) {\n\t\t\t\t\n\t\t\t\t$inputdata['site_title'] \t\t= $this->input->post('site_title');\n\t\t\t\t$inputdata['site_name'] \t\t= $this->input->post('sitename');\n\t\t\t\t$inputdata['address'] \t\t\t= $this->input->post('address');\n\t\t\t\t$inputdata['city'] \t\t\t\t= $this->input->post('city');\n\t\t\t\t$inputdata['state'] \t\t\t= $this->input->post('state');\n\t\t\t\t$inputdata['country'] \t\t\t= $this->input->post('country');\n\t\t\t\t$inputdata['longitude'] \t\t= $this->input->post('longitude');\n\t\t\t\t$inputdata['latitude'] \t\t\t= $this->input->post('latitude');\n\t\t\t\t$inputdata['zip'] \t\t\t\t= $this->input->post('zip');\n\t\t\t\t$inputdata['phone'] \t\t\t= $this->input->post('phone');\n\t\t\t\t$inputdata['from_time'] \t\t= $this->input->post('from_time');\n\t\t\t\t$inputdata['to_time'] \t\t\t= $this->input->post('to_time');\n\t\t\t\t$inputdata['land_line'] \t\t= $this->input->post('land_line');\n\t\t\t\t$inputdata['fax'] \t\t\t\t= $this->input->post('fax');\n\t\t\t\t$inputdata['portal_email'] \t\t= $this->input->post('portal_email');\n\t\t\t\t$inputdata['language_id'] \t\t= $this->input->post('language_id');\n\t\t\t\t$inputdata['currency'] \t\t\t= $this->input->post('currency');\n\t\t\t\t$inputdata['currency_symbol'] \t= $this->input->post('currency_symbol');\n\t\t\t\t$inputdata['country_code'] \t\t= $this->input->post('country_code');\n\t\t\t\t$inputdata['ios_url'] \t\t\t= $this->input->post('ios_url');\n\t\t\t\t$inputdata['android_url'] \t\t= $this->input->post('android_url');\n\t\t\t\t$inputdata['design_by'] \t\t= $this->input->post('design_by');\n\t\t\t\t$inputdata['rights_reserved_content'] = $this->input->post(\n\t\t\t\t'rights_reserved_content');\n\t\t\t\t\t\t\t\n\t\t\t\t$inputdata['facebook_api'] \t\t= $this->input->post('facebook_api');\n\t\t\t\t$inputdata['google_api'] \t\t= $this->input->post('google_api');\n\t\t\t\t\n\t\t\t\t$sms_notifications = 'No';\n\t\t\t\tif($this->input->post('sms_notifications')=='on'){\n\t\t\t\t\t$sms_notifications = 'Yes';\t\n\t\t\t\t}\n\t\t\t\t$inputdata['sms_notifications'] \t\t= $sms_notifications;\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t$push_notifications = 'No';\n\t\t\t\tif($this->input->post('fcm_push_notifications')=='on'){\n\t\t\t\t\t$push_notifications = 'Yes';\t\n\t\t\t\t}\n\t\t\t\t$inputdata['fcm_push_notifications'] \t\t= $push_notifications;\n\t\t\t\t\n\t\t\t\t$where['id'] \t\t\t\t\t= $this->input->post('update_record_id');\n\t\t\t\t\n\t\t\t\tif ($this->base_model->update_operation(\n\t\t\t\t$inputdata, TBL_SITE_SETTINGS, $where)) \n\t\t\t\t{\n\t\t\t\t\tif (!empty($_FILES['userfile']['name'])) {\n\t\t\t\t\t\t\n\t\t\t\t\t\t$config['upload_path'] \t = IMG_SITE_LOGO;\n\t\t\t\t\t\t$config['allowed_types'] = ALLOWED_TYPES;\n\t\t\t\t\t\t$config['overwrite'] = TRUE;\n\t\t\t\t\t\t$config['file_name'] \t = 'site_logo.'. $ext;\n\t\t\t\t\t\t$this->load->library('upload', $config);\n\t\t\t\t\t\t$this->upload->initialize($config);\n\t\t\t\t\t\t\n\t\t\t\t\t\tif (!$this->upload->do_upload()) {\n\t\t\t\t\t\t\t$this->prepare_flashmessage(\n\t\t\t\t\t\t\t$this->upload->display_errors() , 1);\n\t\t\t\t\t\t\tredirect(URL_SITE_SETTINGS,REFRESH);\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t$input1['site_logo']= 'site_logo.'. $ext;\n\t\t\t\t\t\t\t$this->base_model->update_operation(\n\t\t\t\t\t\t\t$input1, TBL_SITE_SETTINGS, $where);\n\t\t\t\t\t\t\t$msg = (isset($this->phrases['updated successfully'])) ? $this->phrases['updated successfully'] : \"Updated Successfully\";\n\t\t\t\t\t\t\t$this->prepare_flashmessage($msg, 0);\n\t\t\t\t\t\t\tredirect(URL_SITE_SETTINGS,REFRESH);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t$msg = (isset($this->phrases['updated successfully'])) ? $this->phrases['updated successfully'] : \"Updated Successfully\";\n\t\t\t\t\t$this->prepare_flashmessage($msg, 0);\n\t\t\t\t\tredirect(URL_SITE_SETTINGS,REFRESH);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\t$msg = (isset($this->phrases['unable to update'])) ? $this->phrases['unable to update'] : \"Unable to update\";\n\t\t\t\t\t$this->prepare_flashmessage($msg, 1);\n\t\t\t\t\tredirect(URL_SITE_SETTINGS,REFRESH);\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$this->prepare_flashmessage(validation_errors(),1);\n\t\t\t\tredirect(URL_SITE_SETTINGS,REFRESH);\n\t\t\t}\n\t\t}\n\t\t\n\t\t$site_settings \t= $this->base_model->fetch_records_from(TBL_SITE_SETTINGS);\n\t\tif (count($site_settings) > 0) \n\t\t\t$this->data['site_settings'] \t\t= $site_settings[0];\n\t\telse \n\t\t\t$this->data['site_settings'] \t\t= array();\n\t\t\n\t\t// LANGUAGE OPTIONS\n\t\t$lang_options \t\t\t\t\t\t\t= array('' => $this->phrases['select language']);\n\t\t$languages \t\t\t\t\t\t\t\t= $this->base_model->fetch_records_from(TBL_LANGUAGES,array('status'=>'Active'));\n\t\tforeach($languages as $row):\n\t\t\t$lang_options[$row->id] \t\t\t= ucfirst($row->lang_name);\n\t\tendforeach;\n\t\t\n\t\t// CURRENCY OPTIONS\n\t\t\n\t\t$currency_options = array(''=>$this->phrases['select currency']);\n\t\t\n\t\t$currencies = $this->base_model->fetch_records_from(TBL_CURRENCY);\n\t\tforeach($currencies as $row):\n\t\t\t$currency_options[$row->currency_code_alpha] = ucfirst($row->currency_name);\n\t\tendforeach;\n\t\t\n\t\t//echo \"<pre>\";\n\t\t//print_r($this->data['site_settings']); die();\n\t\t$this->data['lang_options'] \t\t\t= $lang_options;\n\t\t$this->data['currency_options'] \t\t= $currency_options;\n\t\t$this->data['active_class'] \t\t\t= ACTIVE_MASTER_SETTINGS;\n\t\t$this->data['title'] \t\t\t\t\t= (isset($this->phrases['app settings'])) ? $this->phrases['app settings'] : \"App Settings\";\n\t\t$this->data['content'] \t\t\t\t\t= 'site_settings';\n\t\t$this->_render_page(TEMPLATE_ADMIN, $this->data);\n\t}",
"protected function validateForm()\n {\n if (!$this->user->hasPermission('modify', 'domain/domain')) {\n $this->error['warning'] = $this->language->get('error_permission');\n }\n\n if (empty($this->request->post['domain']) || !isset($this->request->post['domain'])) {\n $this->error['domain'] = $this->language->get('error_domain');\n } else {\n if (!preg_match('~^https?://(?:[a-z0-9](?:[-a-z0-9]*[a-z0-9])?\\.)+[a-z](?:[-a-z0-9]*[a-z0-9])?\\.?(?:$|/)~', $this->request->post['domain'])) {\n $this->error['domain'] = $this->language->get('error_domain');\n }\n }\n\n if (empty($this->request->post['currency_id'] || !isset($this->request->post['currency_id']))) {\n $this->error['currency'] = $this->language->get('error_currency');\n }\n\n if (empty($this->request->post['currency_title'] || !isset($this->request->post['currency_title']))) {\n $this->error['currency'] = $this->language->get('error_currency');\n }\n\n if ($this->error && !isset($this->error['warning'])) {\n $this->error['warning'] = $this->language->get('error_warning');\n }\n\n return !$this->error;\n }",
"function _eventbrite_sboc_config_form_validate($form, &$form_state){\n $eventbrite_api_key = $form_state['values']['eventbrite_api_key'];\n $eventbrite_api_user_key = $form_state['values']['eventbrite_api_user_key'];\n \n if (empty($eventbrite_app_key) || empty($eventbrite_api_user_key)) {\n\t form_set_error('API Credentials', t('Eventbrite API Key and API Usere Keys are required.'));\n } \n }",
"public function settingsForm() {\n $element = [\n '#markup' => 'Rules settings form is not implemented yet.',\n ];\n return $element;\n }",
"function _check_member_event_options()\n\t{\n\t\t$rules['module_affiliate_marketing_member_events_alert_email'] = 'trim|valid_email';\n\t\t\n\t\t$this->validation->set_rules($rules);\n\t\t\n\t\t$fields['module_affiliate_marketing_member_events_alert_email'] = $this->lang->line('email');\n\t\t\n\t\t$this->validation->set_fields($fields);\n\t\t\t\n\t\tif ($this->validation->run() == FALSE)\t\n\t\t{\n\t\t\treturn false;\n\t\t}\n\t\t\n\t\treturn true;\n\t}",
"public function validateSettings()\n {\n if (empty($this->validator)) {\n return true;\n }\n \n return $this->validator->validate($this, $this->context);\n }",
"protected function configureValidations()\n {\n }",
"function aegean_epay_settings_validate($form, &$form_state) {\n $payment_options = aegean_epay_parse_payment_options($form_state['values']['aegean_epay_payment_options']);\n foreach ($payment_options as $option) {\n if (empty($option['participant_el']) || !is_string($option['participant_el'])) {\n form_set_error('aegean_epay_payment_options', 'The \"Participant el\" value must be a valid string.');\n }\n if (empty($option['participant_en']) || !is_string($option['participant_en'])) {\n form_set_error('aegean_epay_payment_options', 'The \"Participant en\" value must be a valid string.');\n }\n if (empty($option['amount']) || !is_numeric($option['amount'])) {\n form_set_error('aegean_epay_payment_options', 'The \"Amount\" value must be numeric.');\n }\n if (empty($option['deadline']) || !preg_match(\"/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$/\", $option['deadline'])) {\n form_set_error('aegean_epay_payment_options', 'The \"Deadline\" value must be in the format of YYYY-MM-DD.');\n }\n }\n}",
"function options_validate($form, &$form_state) {\r\n parent::options_validate($form, $form_state);\r\n \r\n if ($form_state['values']['form_id'] == 'views_ui_config_item_form') {\r\n $check_fields = array_filter($form_state['values']['options']['date_fields']);\r\n if (empty($check_fields)) {\r\n form_error($form['date_fields'], t('You must select at least one date field for this argument.'));\r\n }\r\n if (!preg_match('@\\-[0-9]*:[\\+|\\-][0-9]*@', $form_state['values']['options']['year_range']) \r\n && !preg_match('@[0-9]{4}:[0-9]{4}@', $form_state['values']['options']['year_range'])) {\r\n form_error($form['year_range'], t('Date year range must be in the format -9:+9 or 2005:2010.'));\r\n }\r\n }\r\n }",
"function uc_usps_admin_settings_validate($form, &$form_state) {\n if (!is_numeric($form_state['values']['uc_usps_markup'])) {\n form_set_error('uc_usps_markup', t('Rate markup must be a numeric value.'));\n }\n}",
"function site_settings()\n {\n if (isset($_POST['site_settings'])) {\n \n if (DEMO) {\n $this->prepare_flashmessage(get_languageword('CRUD_operations_disabled_in_DEMO_version'), 2);\n redirect(URL_SITE_SETTINGS);\n }\n \n $msg='';\n $status=0;\n \n $this->form_validation->set_rules('site_title', get_languageword('site_title'), 'trim|required|max_length[100]|xss_clean');\n \n \n \n $this->form_validation->set_rules('home_page_caption', get_languageword('home_page_caption'), 'trim|required|max_length[50]|xss_clean');\n $this->form_validation->set_rules('home_page_tagline', get_languageword('home_page_tagline'), 'trim|max_length[50]|xss_clean');\n \n $this->form_validation->set_rules('address', get_languageword('address'), 'trim|required|max_length[1000]|xss_clean');\n $this->form_validation->set_rules('city', get_languageword('city'), 'trim|required|max_length[100]|xss_clean');\n $this->form_validation->set_rules('state', get_languageword('state'), 'trim|required|max_length[100]|xss_clean');\n $this->form_validation->set_rules('country', get_languageword('country'), 'trim|required|xss_clean');\n $this->form_validation->set_rules('zip', get_languageword('pincode'), 'trim|required|max_length[20]|xss_clean');\n $this->form_validation->set_rules('latitude', get_languageword('latitude'), 'required|xss_clean');\n $this->form_validation->set_rules('longitude', get_languageword('longitude'), 'required|xss_clean');\n $this->form_validation->set_rules('ios_url', get_languageword('ios_url|xss_clean'));\n $this->form_validation->set_rules('android_url', get_languageword('android_url|xss_clean'));\n $this->form_validation->set_rules('phone', get_languageword('phone'), 'trim|required|max_length[30]|xss_clean');\n $this->form_validation->set_rules('land_line', get_languageword('land_line'), 'trim|required|max_length[30]|xss_clean');\n $this->form_validation->set_rules('fax', get_languageword('fax'), 'trim|max_length[50]|xss_clean');\n $this->form_validation->set_rules('portal_email', get_languageword('contact_email'), 'trim|required|valid_email|xss_clean');\n $this->form_validation->set_rules('site_country', get_languageword('site_country'), 'trim|required|xss_clean');\n $this->form_validation->set_rules('currency_symbol', get_languageword('currency_symbol'), 'trim|required|xss_clean');\n $this->form_validation->set_rules('from_time', get_languageword('from_time'), 'required|xss_clean');\n $this->form_validation->set_rules('to_time', get_languageword('to_time'), 'required|xss_clean');\n $this->form_validation->set_rules('design_by', get_languageword('design_by'), 'trim|required|xss_clean');\n\n $this->form_validation->set_rules('rights_reserved_content', get_languageword('rights_reserved_content'), 'trim|required|xss_clean'); \n\n $this->form_validation->set_rules('facebook_app_id', get_languageword('facebook_app_id'), 'required|xss_clean'); \n\n\n $this->form_validation->set_rules('facebook_app_secret', get_languageword('facebook_app_secret'), 'required|xss_clean');\n \n $this->form_validation->set_rules('google_client_id', get_languageword('google_client_id'), 'required|xss_clean');\n $this->form_validation->set_rules('google_client_secret', get_languageword('google_client_secret'), 'required|xss_clean');\n\n\n $this->form_validation->set_rules('contact_map_script', get_languageword('contact_map_script'), 'required');\n \n $this->form_validation->set_error_delimiters('<div class=\"error\">', '</div>');\n \n if ($this->form_validation->run() == TRUE) {\n $data = array();\n $data['site_title'] = $this->input->post('site_title');\n \n \n \n $data['home_page_caption'] = $this->input->post('home_page_caption');\n $data['home_page_tagline'] = $this->input->post('home_page_tagline');\n \n \n \n $data['address'] = $this->input->post('address');\n $data['city'] = $this->input->post('city');\n $data['state'] = $this->input->post('state');\n $data['country'] = $this->input->post('country');\n $data['zip'] = $this->input->post('zip');\n $data['latitude'] = $this->input->post('latitude');\n $data['longitude'] = $this->input->post('longitude');\n \n $data['ios_url'] = $this->input->post('ios_url');\n $data['android_url'] = $this->input->post('android_url');\n \n $data['facebook_api'] = $this->input->post('facebook_api');\n $data['google_api'] = $this->input->post('google_api');\n \n $data['phone'] = $this->input->post('phone');\n $data['land_line'] = $this->input->post('land_line');\n $data['fax'] = $this->input->post('fax');\n $data['portal_email'] = $this->input->post('portal_email');\n \n $data['site_language']= $this->input->post('site_language');\n $data['site_country'] = $this->input->post('site_country');\n $data['time_zone'] = $this->input->post('time_zone');\n $data['currency'] = $this->input->post('currency');\n $data['currency_symbol'] = $this->input->post('currency_symbol');\n \n $data['country_code'] = $this->input->post('country_code');\n \n $data['from_time'] = $this->input->post('from_time');\n $data['to_time'] = $this->input->post('to_time');\n \n if ($this->input->post('sms_notifications')=='on') {\n $data['sms_notifications'] = 'Yes';\n } else {\n $data['sms_notifications'] = 'No';\n } \n \n \n if ($this->input->post('fcm_push_notifications')=='on') {\n $data['fcm_push_notifications']= 'Yes';\n } else {\n $data['fcm_push_notifications']= 'No';\n } \n \n \n $data['design_by'] = $this->input->post('design_by');\n $data['rights_reserved_content'] = $this->input->post('rights_reserved_content');\n \n $data['date_format'] = $this->input->post('date_format');\n \n $payment_methods = $this->input->post('payment_methods');\n if (!empty($payment_methods)) {\n $payment_methods = implode(',', $payment_methods);\n $data['payment_methods'] = $payment_methods;\n } else {\n $data['payment_methods'] = NULL;\n }\n \n $data['facebook_app_id'] = $this->input->post('facebook_app_id');\n $data['facebook_app_secret'] = $this->input->post('facebook_app_secret');\n \n $data['google_client_id'] = $this->input->post('google_client_id');\n $data['google_client_secret']= $this->input->post('google_client_secret');\n \n\n $data['contact_map_script'] = $this->input->post('contact_map_script');\n \n $where = array('id'=>1);\n if ($this->base_model->update_operation($data, TBL_SITE_SETTINGS, $where)) {\n unset($data);\n $msg .= get_languageword('details_updated_successfully');\n $status= 0;\n \n //Upload Site Logo\n if (count($_FILES) > 0) {\n if ($_FILES['site_logo']['name'] != '' && $_FILES['site_logo']['error'] != 4) {\n $record = $this->base_model->fetch_records_from('site_settings');\n \n if (!empty($record)) {\n $record = $record[0];\n if ($record->site_logo != '' && file_exists(LOGO_IMG_UPLOAD_PATH_URL.$record->site_logo)) {\n unlink(LOGO_IMG_UPLOAD_PATH_URL.$record->site_logo);\n unlink(LOGO_IMG_UPLOAD_THUMB_PATH_URL.$record->site_logo);\n }\n }\n \n $ext = pathinfo($_FILES['site_logo']['name'], PATHINFO_EXTENSION);\n $file_name = 'site_logo.'. $ext;\n $config['upload_path'] = LOGO_IMG_UPLOAD_PATH_URL;\n $config['allowed_types'] = 'jpg|jpeg|png|svg|JPG|JPEG|PNG';\n $config['max_size'] = 5120;//5 MB\n\n\n $config['file_name'] = $file_name;\n $this->load->library('upload', $config);\n $this->upload->initialize($config);\n\n if ($this->upload->do_upload('site_logo')) {\n \n $data = array();\n $data['site_logo'] = $file_name;\n \n \n \n // TINIFY IMAGE COMPRESSING & THUMB\n if ($this->config->item('tinify_settings')->use_tinify=='Yes') {\n \n \n $destination = FCPATH.LOGO_IMG_UPLOAD_PATH_URL.$file_name;\n $source = base_url().LOGO_IMG_UPLOAD_PATH_URL.$file_name;\n \n $this->load->library('FCTinify');\n $fct = new FCTinify();\n \n //TINIFY IMAGE COMPRESSING\n if ($this->config->item('tinify_settings')->compress=='Yes') {\n $result = $fct->imageCompress($source, $destination);\n }\n \n // TINIFY IMAGE THUMB CREATION\n if ($this->config->item('tinify_settings')->thumb=='Yes') {\n $thumb_destination = FCPATH.LOGO_IMG_UPLOAD_THUMB_PATH_URL.$file_name;\n $fct->imageResize($source, $thumb_destination, THUMB_IMG_WIDTH, THUMB_IMG_HEIGHT, 'cover');\n } else { \n $this->create_thumbnail($config['upload_path'].$file_name, LOGO_IMG_UPLOAD_THUMB_PATH_URL.$file_name, THUMB_IMG_WIDTH, THUMB_IMG_HEIGHT);\n }\n \n \n } else {\n \n $this->create_thumbnail($config['upload_path'].$file_name, LOGO_IMG_UPLOAD_THUMB_PATH_URL.$file_name, 200, 200);\n }\n \n } else {\n $msg .= '<br>'.strip_tags($this->upload->display_errors());\n $status =1;\n \n }\n }\n \n \n if ($_FILES['second_site_logo']['name'] != '' && $_FILES['second_site_logo']['error'] != 4) {\n $record = $this->base_model->fetch_records_from('site_settings');\n \n if (!empty($record)) {\n \n $record = $record[0];\n if ($record->second_site_logo != '' && file_exists(LOGO_IMG_UPLOAD_PATH_URL.$record->second_site_logo)) {\n unlink(LOGO_IMG_UPLOAD_PATH_URL.$record->second_site_logo);\n unlink(LOGO_IMG_UPLOAD_THUMB_PATH_URL.$record->second_site_logo);\n }\n }\n \n $ext = pathinfo($_FILES['second_site_logo']['name'], PATHINFO_EXTENSION);\n $file_name = 'second_site_logo.'. $ext;\n $config['upload_path'] = LOGO_IMG_UPLOAD_PATH_URL;\n $config['allowed_types'] = 'jpg|jpeg|png|svg|JPG|JPEG|PNG';\n \n $config['file_name'] = $file_name;\n $this->load->library('upload', $config);\n $this->upload->initialize($config);\n\n if ($this->upload->do_upload('second_site_logo')) {\n \n $data = array();\n $data['second_site_logo'] = $file_name;\n \n \n // TINIFY IMAGE COMPRESSING & THUMB\n if ($this->config->item('tinify_settings')->use_tinify=='Yes') {\n \n \n $destination = FCPATH.LOGO_IMG_UPLOAD_PATH_URL.$file_name;\n $source = base_url().LOGO_IMG_UPLOAD_PATH_URL.$file_name;\n \n $this->load->library('FCTinify');\n $fct = new FCTinify();\n \n //TINIFY IMAGE COMPRESSING\n if ($this->config->item('tinify_settings')->compress=='Yes') {\n $result = $fct->imageCompress($source, $destination);\n }\n \n // TINIFY IMAGE THUMB CREATION\n if ($this->config->item('tinify_settings')->thumb=='Yes') {\n $thumb_destination = FCPATH.LOGO_IMG_UPLOAD_THUMB_PATH_URL.$file_name;\n $fct->imageResize($source, $thumb_destination, THUMB_IMG_WIDTH, THUMB_IMG_HEIGHT, 'cover');\n } else { \n $this->create_thumbnail($config['upload_path'].$file_name, LOGO_IMG_UPLOAD_THUMB_PATH_URL.$file_name, THUMB_IMG_WIDTH, THUMB_IMG_HEIGHT);\n }\n \n \n } else {\n \n $this->create_thumbnail($config['upload_path'].$file_name, LOGO_IMG_UPLOAD_THUMB_PATH_URL.$file_name, 200, 200);\n }\n \n } else {\n $msg .= '<br>'.strip_tags($this->upload->display_errors());\n $status =1;\n \n }\n }\n \n \n if ($_FILES['fevicon']['name'] != '' && $_FILES['fevicon']['error'] != 4) {\n $record = $this->base_model->fetch_records_from('site_settings');\n \n if (!empty($record)) {\n $record = $record[0];\n \n if ($record->fevicon != '' && file_exists(FEVICON_IMG_UPLOAD_PATH_URL.$record->fevicon)) {\n unlink(FEVICON_IMG_UPLOAD_PATH_URL.$record->fevicon);\n }\n }\n \n $ext = pathinfo($_FILES['fevicon']['name'], PATHINFO_EXTENSION);\n $file_name1 = 'fevicon.'. $ext;\n $config['upload_path'] = FEVICON_IMG_UPLOAD_PATH_URL;\n $config['allowed_types'] = 'ico';\n \n $config['file_name'] = $file_name1;\n $this->load->library('upload', $config);\n $this->upload->initialize($config);\n\n if ($this->upload->do_upload('fevicon')) {\n $data['fevicon'] = $file_name1;\n \n } else {\n $msg .= '<br>'.strip_tags($this->upload->display_errors());\n $status =1;\n }\n }\n \n \n \n \n \n //HOME PAGE IMAGE\n if ($_FILES['home_page_img']['name'] != '' && $_FILES['home_page_img']['error'] != 4) {\n $record = $this->base_model->fetch_records_from('site_settings');\n \n if (!empty($record)) {\n $record = $record[0];\n if ($record->home_page_img != '' && file_exists(HOME_PAGE_IMG_UPLOAD_PATH_URL.$record->home_page_img)) {\n unlink(HOME_PAGE_IMG_UPLOAD_PATH_URL.$record->home_page_img);\n }\n }\n \n $ext = pathinfo($_FILES['home_page_img']['name'], PATHINFO_EXTENSION);\n $file_name = 'home_page_img.'. $ext;\n $config['upload_path'] = HOME_PAGE_IMG_UPLOAD_PATH_URL;\n \n \n //\n $config['min_width'] = 1980;\n $config['min_height'] = 448;\n \n $config['max_width'] = 2000;\n $config['max_height'] = 1500;\n //\n \n $config['allowed_types'] = 'jpg|jpeg|png|JPG|JPEG|PNG';\n \n $config['file_name'] = $file_name;\n $this->load->library('upload', $config);\n $this->upload->initialize($config);\n\n if ($this->upload->do_upload('home_page_img')) {\n \n $data = array();\n $data['home_page_img'] = $file_name;\n \n // TINIFY IMAGE COMPRESSING & THUMB\n if ($this->config->item('tinify_settings')->use_tinify=='Yes') {\n \n $destination = FCPATH.HOME_PAGE_IMG_UPLOAD_PATH_URL.$file_name;\n $source = base_url().HOME_PAGE_IMG_UPLOAD_PATH_URL.$file_name;\n \n $this->load->library('FCTinify');\n $fct = new FCTinify();\n \n //TINIFY IMAGE COMPRESSING\n if ($this->config->item('tinify_settings')->compress=='Yes') {\n $result = $fct->imageCompress($source, $destination);\n }\n } \n } else {\n $msg .= '<br>'.strip_tags($this->upload->display_errors());\n $status =1;\n }\n }\n \n \n if (!empty($data)) {\n $this->base_model->update_operation($data, TBL_SITE_SETTINGS, $where);\n }\n }\n } else {\n $msg .= get_languageword('details_not_updated');\n $status = 1;\n }\n \n \n $this->prepare_flashmessage($msg, $status);\n redirect(URL_SITE_SETTINGS, REFRESH);\n }\n }\n \n $record = array();\n $record = $this->base_model->fetch_records_from(TBL_SITE_SETTINGS);\n if (!empty($record)) { \n $record = $record[0];\n }\n \n //Language Options\n $lang_opts = get_language_opts();\n $this->data['lang_opts'] = $lang_opts;\n \n //Language Options\n $currency_opts = get_currency_opts();\n $this->data['currency_opts'] = $currency_opts;\n \n \n // TIME ZONES\n $time_zone_options = array();\n $time_zones = $this->base_model->fetch_records_from('calendar_timezones');\n if (!empty($time_zones)) {\n foreach($time_zones as $row):\n $time_zone_options[$row->TimeZone] = $row->TimeZone.'('.$row->UTC_offset.')';\n endforeach;\n }\n $this->data['time_zone_options'] = $time_zone_options;\n \n $this->data['record'] = $record;\n $this->data['css_js_files'] = array('form_validation');\n $this->data['pagetitle'] = get_languageword('site_settings');\n \n $this->data['activemenu'] = \"master_settings\";\n $this->data['actv_submenu'] = 'site_settings';\n \n $this->data['content'] = PAGE_SITE_SETTINGS;\n $this->_render_page(TEMPLATE_ADMIN, $this->data);\n }",
"function messenger_config_form($form, &$form_state)\n{\n\n $form[MESSENGER_URL] = array(\n '#type' => 'textfield',\n '#title' => t('API url'),\n '#default_value' => variable_get(MESSENGER_URL, ''),\n '#description' => t('The api url. eg: http://api.domain.com'),\n '#required' => TRUE,\n );\n\n $form[MESSENGER_SECRET] = array(\n '#type' => 'textfield',\n '#title' => t('Secret'),\n '#default_value' => variable_get(MESSENGER_SECRET, ''),\n '#description' => t('API secret.'),\n '#required' => TRUE,\n );\n\n $form[GIPHY_API] = array(\n '#type' => 'textfield',\n '#title' => t('Giphy api key'),\n '#default_value' => variable_get(GIPHY_API, DEFAULT_GIPHY_API),\n '#description' => t('Enter Giphy api.'),\n '#required' => TRUE,\n );\n\n $form[GIPHY_EXCLUDE_KEYWORD] = array(\n '#type' => 'textarea',\n '#title' => t('Giphy exclude keywords'),\n '#default_value' => variable_get(GIPHY_EXCLUDE_KEYWORD, ''),\n '#description' => t('Enter a word per line'),\n '#required' => FALSE,\n );\n\n //MESSENGER_OFFSET\n $form[MESSENGER_OFFSET] = array(\n '#type' => 'textfield',\n '#title' => t('Inbox Offset Height'),\n '#default_value' => variable_get(MESSENGER_OFFSET, 300),\n '#description' => t('Use offset to calculate height of inbox'),\n '#required' => FALSE,\n );\n\n return system_settings_form($form);\n\n\n}",
"public function validateConfig() {\n\t\t\t$two_step_id = $this->config['l_id'];\n\t\t\tif ( empty( $two_step_id ) ) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\t$two_step = tve_leads_get_form_type( $two_step_id, array( 'get_variations' => false ) );\n\t\t\tif ( empty( $two_step ) || $two_step->post_status === 'trash' || $two_step->post_type != TVE_LEADS_POST_TWO_STEP_LIGHTBOX ) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\treturn true;\n\t\t}",
"function validateSetting($name, $value)\n{\n if (in_array($name, ['title', 'keywords', 'description']) && empty($value)) {\n redirect()->withError('Please enter all fields')->withInput()->back();\n } else if ($name == 'default_theme' && !app()->theme_manager->hasTheme($value)) {\n redirect()->withError('Cannot find that theme!');\n }\n}",
"function form_backend_validation()\r\n {\r\n return true ;\r\n }",
"public function settings_fields() {\n\t\t$this->create_sections();\n\t\t$this->create_fields();\n\t\tregister_setting( $this->token, $this->token, array( $this, 'validate_fields' ) );\n\t}",
"public function options_form_validate($form, &$form_state) {\n // Context module doesn't allow for validation of reaction fields.\n // @todo: Raise bug for context module.\n }",
"function form_validation_rules()\n\t{\n\t\t$this->form_validation->set_message('required', '%s tidak boleh kosong');\n\t}"
] |
[
"0.6922141",
"0.6860822",
"0.6790697",
"0.6494389",
"0.64720094",
"0.64486766",
"0.64100295",
"0.6353603",
"0.6254033",
"0.62037575",
"0.61633706",
"0.61352056",
"0.61334896",
"0.6114142",
"0.6101969",
"0.60994273",
"0.60917944",
"0.60868746",
"0.6064003",
"0.6063941",
"0.604543",
"0.60428137",
"0.6032025",
"0.6021843",
"0.6009672",
"0.59706396",
"0.5970364",
"0.5969171",
"0.59598523",
"0.5951811"
] |
0.70786077
|
0
|
Form submission for the Settings / Mobile config page.
|
function room_reservations_admin_settings_mobile_submit($form_id, &$form_state) {
if ($form_state['clicked_button']['#value'] == t('Save configuration')) {
$mobile_url = trim($form_state['values']['mobile_url']);
$main_database = trim($form_state['values']['main_database']);
$confirmation = ROOM_RESERVATIONS_SAVE_CONFIRMATION_MSG;
$error = ROOM_RESERVATIONS_SAVE_ERROR_MSG;
}
elseif ($form_state['clicked_button']['#value'] == t('Reset to defaults')) {
$mobile_url = '';
$main_database = '';
$confirmation = ROOM_RESERVATIONS_RESET_CONFIRMATION_MSG;
$error = ROOM_RESERVATIONS_RESET_ERROR_MSG;
}
$errors = FALSE;
$result = _room_reservations_set_variable('mobile_url', $mobile_url);
if (!$result) {
$errors = TRUE;
}
$result = _room_reservations_set_variable('main_database', $main_database);
if (!$result) {
$errors = TRUE;
}
if ($errors) {
drupal_set_message(check_plain($error), 'error');
}
else {
drupal_set_message(check_plain($confirmation));
}
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function ssbd_staticpage_settings_form($form, &$form_state) {\n $form['ssbd_staticpage_simulate_mobile'] = array(\n '#title' => t('Simulate Mobile'),\n '#type' => 'checkbox',\n '#required' => FALSE,\n '#default_value' => variable_get('ssbd_staticpage_simulate_mobile', NULL),\n );\n\n $form['submit'] = array(\n '#type' => 'submit',\n '#value' => t('Save settings'),\n );\n return $form;\n}",
"function ssbd_staticpage_settings_form_submit($form, &$form_state) {\n variable_set('ssbd_staticpage_simulate_mobile', $form_state['values']['ssbd_staticpage_simulate_mobile']);\n}",
"function room_reservations_admin_settings_mobile($form, &$form_state) {\n $default_mobile_url = _room_reservations_get_variable('mobile_url');\n $default_main_database = _room_reservations_get_variable('main_database');\n $form['mobile_url'] = array(\n '#title' => t('Mobile site url'),\n '#type' => 'textfield',\n '#description' => t('Display the mobile version of Room Reservations for this url.'),\n '#default_value' => $default_mobile_url,\n '#maxlength' => 80,\n '#size' => 80,\n '#weight' => -90,\n );\n $form['main_database'] = array(\n '#title' => t('Main site database name'),\n '#type' => 'textfield',\n '#description' => t('Enter the name of the database used by your main (non-mobile) website.'),\n '#default_value' => $default_main_database,\n '#maxlength' => 80,\n '#size' => 80,\n '#weight' => -80,\n );\n $form['save'] = array(\n '#type' => 'submit',\n '#value' => t('Save configuration'),\n '#weight' => 100,\n );\n $form['reset'] = array(\n '#type' => 'submit',\n '#value' => t('Reset to defaults'),\n '#weight' => 101,\n );\n\n return $form;\n}",
"function ding_mobilesearch_settings_submit($form, &$form_state) {\n $types = $form_state['values']['types']['rows'];\n\n // Assing CT's with flag (if possible).\n $module_enabled = system_list('module_enabled');\n if (isset($module_enabled['flag'])) {\n $flag = flag_get_flag('push_to_mongo');\n if ($flag !== FALSE) {\n db_delete('flag_types')\n ->condition('fid', $flag->fid)\n ->execute();\n foreach ($types as $machine_name => $row) {\n if ($row['type']) {\n db_insert('flag_types')\n ->fields(array(\n 'fid' => $flag->fid, 'type' => $machine_name\n ))\n ->execute();\n }\n }\n }\n }\n\n // Save CT's settings.\n foreach ($types as $machine_name => $row) {\n $key = 'mobilesearch_type__' . $machine_name;\n variable_set($key, $row['type']);\n variable_set($key . '__trigger', $row['trigger']);\n variable_set($key . '__plugin', $row['plugin']);\n }\n\n // Save menus settings.\n $menus = $form_state['values']['menus']['rows'];\n foreach ($menus as $machine_name => $row) {\n $key = 'mobilesearch_menu__' . $machine_name;\n variable_set($key, $row['menu']);\n variable_set($key . '__plugin', $row['plugin']);\n }\n\n drupal_set_message(t('The configuration options have been saved.'));\n}",
"public function settings_screen() {\n\t\tglobal ${class_name};\n\t\tdo_action( ${class_name}->token . '_before_settings' );\n\t\tdo_action( $this->token . '_before_settings' );\n\t\tsettings_fields( $this->token );\n\t\tdo_settings_sections( $this->token );\n\t\tdo_action( $this->token . '_after_settings' );\n\t\tdo_action( ${class_name}->token . '_after_settings' );\n\t\tsubmit_button();\n\t}",
"function wpsc_merchant_paymentsense_settings_form_submit() {\r\n\treturn wpsc_merchant_paymentsense::submit_paymentsense_settings_form();\r\n}",
"private function getConfigurationForm()\n {\n $form = array(\n 'form' => array(\n 'id_form' => 'module_config',\n 'legend' => array(\n 'title' => $this->l('Configuration'),\n 'icon' => 'icon-cogs'\n ),\n 'input' => array(\n array(\n 'label' => $this->l('Enable/Disable'),\n 'type' => 'switch',\n 'name' => 'kbpushnotification[enable]',\n 'values' => array(\n array(\n 'value' => 1,\n ),\n array(\n 'value' => 0,\n ),\n ),\n 'hint' => $this->l('Enable/Disable the plugin')\n ),\n array(\n 'label' => $this->l('Enable/Disable Order Status Update'),\n 'type' => 'switch',\n 'name' => 'kbpushnotification[enable_order_status]',\n 'values' => array(\n array(\n 'value' => 1,\n ),\n array(\n 'value' => 0,\n ),\n ),\n 'hint' => $this->l('Enable/Disable the order status update')\n ),\n array(\n 'label' => $this->l('Enable/Disable Abandoned Cart alert'),\n 'type' => 'switch',\n 'name' => 'kbpushnotification[enable_abandoned_cart]',\n 'values' => array(\n array(\n 'value' => 1,\n ),\n array(\n 'value' => 0,\n ),\n ),\n 'hint' => $this->l('Enable/Disable the abandoned cart alert')\n ),\n array(\n 'label' => $this->l('Enable/Disable Product Price alert'),\n 'type' => 'switch',\n 'name' => 'kbpushnotification[enable_product_price_alert]',\n 'values' => array(\n array(\n 'value' => 1,\n ),\n array(\n 'value' => 0,\n ),\n ),\n 'hint' => $this->l('Enable/Disable the product price alert')\n ),\n array(\n 'label' => $this->l('Enable/Disable Product back in stock alert'),\n 'type' => 'switch',\n 'name' => 'kbpushnotification[enable_product_stock_alert]',\n 'values' => array(\n array(\n 'value' => 1,\n ),\n array(\n 'value' => 0,\n ),\n ),\n 'hint' => $this->l('Enable/Disable the product back in stock alert')\n ),\n ),\n 'submit' => array(\n 'title' => $this->l('Save'),\n 'class' => 'btn btn-default pull-right kbph_general_btn'\n ),\n ),\n );\n return $form;\n }",
"function storeConfigForm()\r\n\t{\r\n\t\t/*\tAdd the field for the store configuration\t*/\r\n\t\tadd_settings_field('wpklikandpay_store_tpe', __('Numéro de TPE de la boutique', 'wpklikandpay'), array('wpklikandpay_option', 'storeTpe'), 'wpklikandpayStoreConfig', 'mainWKlikAndPayStoreConfig');\r\n\t\t// add_settings_field('wpklikandpay_store_rang', __('Numéro de rang de la boutique', 'wpklikandpay'), array('wpklikandpay_option', 'storeRang'), 'wpklikandpayStoreConfig', 'mainWKlikAndPayStoreConfig');\r\n\t\t// add_settings_field('wpklikandpay_store_id', __('Identifiant de la boutique', 'wpklikandpay'), array('wpklikandpay_option', 'storeIdentifier'), 'wpklikandpayStoreConfig', 'mainWKlikAndPayStoreConfig');\r\n\t\tadd_settings_field('wpklikandpay_environnement', __('Environnement de la boutique', 'wpklikandpay'), array('wpklikandpay_option', 'environnement'), 'wpklikandpayStoreConfig', 'mainWKlikAndPayStoreConfig');\r\n\t}",
"public function settings_page() {\n\n\t\t?>\n\n\t\t<div class=\"wrap schedule-a-visit-to-sherpa-settings\">\n\t\t\t\n\t\t\t<form id=\"schedule-a-visit-to-sherpa-form\" method=\"post\" action=\"options.php\">\n\t\t\t\t\n\t\t\t\t<?php echo wp_nonce_field( 'schedule_a_visit_to_sherpa_data', 'schedule_a_visit_to_sherpa_nonce' ); ?>\n\n\t\t\t\t<?php settings_fields( 'schedule_a_visit_to_sherpa_settings_section' ); ?>\n\n\t\t\t\t<?php do_settings_sections( 'schedule-a-visit-to-sherpa' ); ?>\n\t\t\t\t\n\t\t\t\t<?php submit_button(); ?>\n\n\t\t\t</form>\n\n </div>\n\n\t\t<?php\n\n\t}",
"public function site_settings()\n\t\t{\n\t\t\t$this->is_login();\n\t\t\t$data['form_submit_message'] = '';\n\t\t\t$this->load->model('settings_model', 'sm');\n\t\t\t\n\t\t\tif(count($_POST) > 0)\n\t\t\t{\n\t\t\t\tforeach($_POST as $key => $value)\n\t\t\t\t{\n\t\t\t\t\t$settings_data['value'] = $value;\n\t\t\t\t\t$this->sm->update($key, $settings_data);\n\t\t\t\t}\n\t\t\t\t$data['form_submit_message'] = '<div style=\"font-weight:bold;color:#0000FF;\">'.lang('msg_settings_saved') .'</div>';\n\t\t\t}\n\t\t\t\n\t\t\t$settings_raw_data = $this->sm->get_all();\n\t\t\t$settings_data = array();\n\t\t\tforeach($settings_raw_data as $raw_settings)\n\t\t\t\t$settings_data[$raw_settings->name] = $raw_settings->value;\n\t\t\t$data['settings'] = $settings_data;\n\t\t\t$this->load->view('settings-admin', $data);\n\t\t}",
"public function actionConfig()\n {\n $form = new ConfigureForm();\n \n $form->gcmAPIKey = Setting::Get('gcmAPIKey', 'gcm');\n //$form->gcmURL = Setting::Get('gcmURL', 'gcm');\n if (!$form->gcmURL = Setting::Get('gcmURL', 'gcm')) $form->gcmURL = 'https://android.googleapis.com/gcm/send';\n if ($form->load(Yii::$app->request->post()) && $form->validate()) {\n $form->gcmAPIKey = Setting::Set('gcmAPIKey', $form->gcmAPIKey, 'gcm');\n $form->gcmURL = Setting::Set('gcmURL', $form->gcmURL, 'gcm');\n return $this->redirect(['/gcm/config/config']);\n }\n\n return $this->render('config', array(\n 'model' => $form\n ));\n }",
"public function maz_hspm_settings_content() {\n ?>\n <div class=\"wrap\">\n <h2>Halve Spacers On Mobile Settings</h2>\n <form method=\"post\" action=\"options.php\">\n <br>\n <hr>\n <br>Breakpoint configures the screen width in pixels when the spacers change size.\n <br>Ratio defines the amount of change. For example, 0.5 will halve the size, 2 will double it.\n <br>\n\n <?php\n # Places all the fields defined above and the submit button in the markup\n settings_fields( 'maz_hspm_fields' );\n do_settings_sections( 'maz_hspm_fields' );\n submit_button();\n ?>\n </form>\n <div class=\"\">\n A Plugin by Moritz Zimmer, 2020\n </div>\n </div>\n <?php\n }",
"function room_reservations_admin_settings_sms_submit($form_id, &$form_state) {\n if ($form_state['clicked_button']['#value'] == t('Save configuration')) {\n $sms_option = $form_state['values']['sms_option'];\n $confirmation = ROOM_RESERVATIONS_SAVE_CONFIRMATION_MSG;\n $error = ROOM_RESERVATIONS_SAVE_ERROR_MSG;\n }\n if ($form_state['clicked_button']['#value'] == t('Reset to defaults')) {\n $sms_option = 0;\n $confirmation = ROOM_RESERVATIONS_RESET_CONFIRMATION_MSG;\n $error = ROOM_RESERVATIONS_RESET_ERROR_MSG;\n }\n $result = _room_reservations_set_variable('sms_option', $sms_option);\n if (!$result) {\n $errors = TRUE;\n }\n if ($errors) {\n drupal_set_message(check_plain($error), 'error');\n }\n else {\n drupal_set_message(check_plain($confirmation));\n }\n}",
"function theme_settings_page() { ?>\n\t <div class=\"wrap\">\n\t <h1>Social Media Settings</h1>\n\t <form method=\"post\" action=\"options.php\">\n\t <?php\n\t settings_fields( 'custom-theme-settings' );\n\t do_settings_sections( 'theme-settings' ); \n\t submit_button(); \n\t ?> \n\t </form>\n\t </div>\n\t<?php }",
"public function save_settings() {\n\n if (!isset($_REQUEST['action']) || !isset($_GET['page']))\n return;\n\n if ('swpm-settings' !== $_GET['page'])\n return;\n\n if ('swpm_settings' !== $_REQUEST['action'])\n return;\n\n check_admin_referer('swpm-update-settings');\n\n $data = array();\n\n foreach ($_POST['swpm-settings'] as $key => $val) {\n $data[$key] = esc_html($val);\n }\n\n update_option('swpm-settings', $data);\n }",
"function app_settings()\n\t{\n\t\t\t\t\n\t$this->data['message'] \t= ($this->ion_auth->errors() ? $this->ion_auth->errors() : $this->session->flashdata('message'));\n\t\tif ($this->input->post()) \n\t\t{\n\t\t\t$this->check_isdemo(URL_SITE_SETTINGS);\n\t\t\t$this->form_validation->set_rules(\n\t\t\t'site_title', \n\t\t\t$this->phrases['site title'], \n\t\t\t'required');\n\t\t\t$this->form_validation->set_rules(\n\t\t\t'sitename', \n\t\t\t$this->phrases['site name'], \n\t\t\t'required');\n\t\t\t$this->form_validation->set_rules(\n\t\t\t'address', \n\t\t\t$this->phrases['address'], \n\t\t\t'required');\n\t\t\t$this->form_validation->set_rules(\n\t\t\t'city', \n\t\t\t$this->phrases['city'], \n\t\t\t'required');\n\t\t\t$this->form_validation->set_rules(\n\t\t\t'state', \n\t\t\t$this->phrases['state'], \n\t\t\t'required');\n\t\t\t$this->form_validation->set_rules(\n\t\t\t'country', \n\t\t\t$this->phrases['country'], \n\t\t\t'required');\n\t\t\t$this->form_validation->set_rules(\n\t\t\t'latitude', \n\t\t\t$this->phrases['latitude'], \n\t\t\t'required');\n\t\t\t$this->form_validation->set_rules(\n\t\t\t'longitude', \n\t\t\t$this->phrases['longitude'], \n\t\t\t'required');\n\t\t\t$this->form_validation->set_rules(\n\t\t\t'zip', \n\t\t\t$this->phrases['zip code'], \n\t\t\t'required');\n\t\t\t$this->form_validation->set_rules(\n\t\t\t'phone', \n\t\t\t$this->phrases['phone'], \n\t\t\t'required|min_length[10])|max_length[11]');\n\t\t\t$this->form_validation->set_rules(\n\t\t\t'portal_email', \n\t\t\t$this->phrases['contact email'], \n\t\t\t'required|valid_email');\n\t\t\t\n\t\t\t$this->form_validation->set_rules(\n\t\t\t'language_id', \n\t\t\t$this->phrases['select language'], \n\t\t\t'required');\n\t\t\t$this->form_validation->set_rules(\n\t\t\t'design_by', \n\t\t\t$this->phrases['design by'], \n\t\t\t'required');\n\t\t\t$this->form_validation->set_rules(\n\t\t\t'rights_reserved_content', \n\t\t\t$this->phrases['rights reserved'], \n\t\t\t'required');\n\t\t\t$this->form_validation->set_rules(\n\t\t\t'ios_url', \n\t\t\t$this->phrases['ios url'], \n\t\t\t'required');\n\t\t\t$this->form_validation->set_rules(\n\t\t\t'android_url', \n\t\t\t$this->phrases['android url'], \n\t\t\t'required');\n\t\t\t$this->form_validation->set_rules(\n\t\t\t'from_time', \n\t\t\t$this->phrases['from time'], \n\t\t\t'required');\n\t\t\t$this->form_validation->set_rules(\n\t\t\t'to_time', \n\t\t\t$this->phrases['to time'], \n\t\t\t'required');\n\t\t\t\n\t\t\t$this->form_validation->set_error_delimiters('<div class=\"error\">', '</div>');\n\t\t\t\n\t\t\tif (!empty($_FILES['userfile']['name'])) {\n\t\t\t\t$ext = pathinfo($_FILES['userfile']['name'], PATHINFO_EXTENSION);\n\t\t\t\t\n\t\t\t\tif (($ext != \"gif\") && ($ext != \"jpg\") && ($ext != \"png\") && ($ext != \"jpeg\")) {\n\t\t\t\t\t$msg = (isset($this->phrases['invalid file'])) ? $this->phrases['invalid file'] : \"Invalid File\";\n\t\t\t\t\t$this->prepare_flashmessage($msg, 1);\n\t\t\t\t\tredirect(URL_SITE_SETTINGS);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ($this->form_validation->run() \t== TRUE\t) {\n\t\t\t\t\n\t\t\t\t$inputdata['site_title'] \t\t= $this->input->post('site_title');\n\t\t\t\t$inputdata['site_name'] \t\t= $this->input->post('sitename');\n\t\t\t\t$inputdata['address'] \t\t\t= $this->input->post('address');\n\t\t\t\t$inputdata['city'] \t\t\t\t= $this->input->post('city');\n\t\t\t\t$inputdata['state'] \t\t\t= $this->input->post('state');\n\t\t\t\t$inputdata['country'] \t\t\t= $this->input->post('country');\n\t\t\t\t$inputdata['longitude'] \t\t= $this->input->post('longitude');\n\t\t\t\t$inputdata['latitude'] \t\t\t= $this->input->post('latitude');\n\t\t\t\t$inputdata['zip'] \t\t\t\t= $this->input->post('zip');\n\t\t\t\t$inputdata['phone'] \t\t\t= $this->input->post('phone');\n\t\t\t\t$inputdata['from_time'] \t\t= $this->input->post('from_time');\n\t\t\t\t$inputdata['to_time'] \t\t\t= $this->input->post('to_time');\n\t\t\t\t$inputdata['land_line'] \t\t= $this->input->post('land_line');\n\t\t\t\t$inputdata['fax'] \t\t\t\t= $this->input->post('fax');\n\t\t\t\t$inputdata['portal_email'] \t\t= $this->input->post('portal_email');\n\t\t\t\t$inputdata['language_id'] \t\t= $this->input->post('language_id');\n\t\t\t\t$inputdata['currency'] \t\t\t= $this->input->post('currency');\n\t\t\t\t$inputdata['currency_symbol'] \t= $this->input->post('currency_symbol');\n\t\t\t\t$inputdata['country_code'] \t\t= $this->input->post('country_code');\n\t\t\t\t$inputdata['ios_url'] \t\t\t= $this->input->post('ios_url');\n\t\t\t\t$inputdata['android_url'] \t\t= $this->input->post('android_url');\n\t\t\t\t$inputdata['design_by'] \t\t= $this->input->post('design_by');\n\t\t\t\t$inputdata['rights_reserved_content'] = $this->input->post(\n\t\t\t\t'rights_reserved_content');\n\t\t\t\t\t\t\t\n\t\t\t\t$inputdata['facebook_api'] \t\t= $this->input->post('facebook_api');\n\t\t\t\t$inputdata['google_api'] \t\t= $this->input->post('google_api');\n\t\t\t\t\n\t\t\t\t$sms_notifications = 'No';\n\t\t\t\tif($this->input->post('sms_notifications')=='on'){\n\t\t\t\t\t$sms_notifications = 'Yes';\t\n\t\t\t\t}\n\t\t\t\t$inputdata['sms_notifications'] \t\t= $sms_notifications;\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t$push_notifications = 'No';\n\t\t\t\tif($this->input->post('fcm_push_notifications')=='on'){\n\t\t\t\t\t$push_notifications = 'Yes';\t\n\t\t\t\t}\n\t\t\t\t$inputdata['fcm_push_notifications'] \t\t= $push_notifications;\n\t\t\t\t\n\t\t\t\t$where['id'] \t\t\t\t\t= $this->input->post('update_record_id');\n\t\t\t\t\n\t\t\t\tif ($this->base_model->update_operation(\n\t\t\t\t$inputdata, TBL_SITE_SETTINGS, $where)) \n\t\t\t\t{\n\t\t\t\t\tif (!empty($_FILES['userfile']['name'])) {\n\t\t\t\t\t\t\n\t\t\t\t\t\t$config['upload_path'] \t = IMG_SITE_LOGO;\n\t\t\t\t\t\t$config['allowed_types'] = ALLOWED_TYPES;\n\t\t\t\t\t\t$config['overwrite'] = TRUE;\n\t\t\t\t\t\t$config['file_name'] \t = 'site_logo.'. $ext;\n\t\t\t\t\t\t$this->load->library('upload', $config);\n\t\t\t\t\t\t$this->upload->initialize($config);\n\t\t\t\t\t\t\n\t\t\t\t\t\tif (!$this->upload->do_upload()) {\n\t\t\t\t\t\t\t$this->prepare_flashmessage(\n\t\t\t\t\t\t\t$this->upload->display_errors() , 1);\n\t\t\t\t\t\t\tredirect(URL_SITE_SETTINGS,REFRESH);\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t$input1['site_logo']= 'site_logo.'. $ext;\n\t\t\t\t\t\t\t$this->base_model->update_operation(\n\t\t\t\t\t\t\t$input1, TBL_SITE_SETTINGS, $where);\n\t\t\t\t\t\t\t$msg = (isset($this->phrases['updated successfully'])) ? $this->phrases['updated successfully'] : \"Updated Successfully\";\n\t\t\t\t\t\t\t$this->prepare_flashmessage($msg, 0);\n\t\t\t\t\t\t\tredirect(URL_SITE_SETTINGS,REFRESH);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t$msg = (isset($this->phrases['updated successfully'])) ? $this->phrases['updated successfully'] : \"Updated Successfully\";\n\t\t\t\t\t$this->prepare_flashmessage($msg, 0);\n\t\t\t\t\tredirect(URL_SITE_SETTINGS,REFRESH);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\t$msg = (isset($this->phrases['unable to update'])) ? $this->phrases['unable to update'] : \"Unable to update\";\n\t\t\t\t\t$this->prepare_flashmessage($msg, 1);\n\t\t\t\t\tredirect(URL_SITE_SETTINGS,REFRESH);\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$this->prepare_flashmessage(validation_errors(),1);\n\t\t\t\tredirect(URL_SITE_SETTINGS,REFRESH);\n\t\t\t}\n\t\t}\n\t\t\n\t\t$site_settings \t= $this->base_model->fetch_records_from(TBL_SITE_SETTINGS);\n\t\tif (count($site_settings) > 0) \n\t\t\t$this->data['site_settings'] \t\t= $site_settings[0];\n\t\telse \n\t\t\t$this->data['site_settings'] \t\t= array();\n\t\t\n\t\t// LANGUAGE OPTIONS\n\t\t$lang_options \t\t\t\t\t\t\t= array('' => $this->phrases['select language']);\n\t\t$languages \t\t\t\t\t\t\t\t= $this->base_model->fetch_records_from(TBL_LANGUAGES,array('status'=>'Active'));\n\t\tforeach($languages as $row):\n\t\t\t$lang_options[$row->id] \t\t\t= ucfirst($row->lang_name);\n\t\tendforeach;\n\t\t\n\t\t// CURRENCY OPTIONS\n\t\t\n\t\t$currency_options = array(''=>$this->phrases['select currency']);\n\t\t\n\t\t$currencies = $this->base_model->fetch_records_from(TBL_CURRENCY);\n\t\tforeach($currencies as $row):\n\t\t\t$currency_options[$row->currency_code_alpha] = ucfirst($row->currency_name);\n\t\tendforeach;\n\t\t\n\t\t//echo \"<pre>\";\n\t\t//print_r($this->data['site_settings']); die();\n\t\t$this->data['lang_options'] \t\t\t= $lang_options;\n\t\t$this->data['currency_options'] \t\t= $currency_options;\n\t\t$this->data['active_class'] \t\t\t= ACTIVE_MASTER_SETTINGS;\n\t\t$this->data['title'] \t\t\t\t\t= (isset($this->phrases['app settings'])) ? $this->phrases['app settings'] : \"App Settings\";\n\t\t$this->data['content'] \t\t\t\t\t= 'site_settings';\n\t\t$this->_render_page(TEMPLATE_ADMIN, $this->data);\n\t}",
"public function settingsAction ()\n {\n $this->_pageTitle = ['Healthcheck', 'Settings'];\n $this->_navigation->setActiveStep(HealthCheckStepsModel::STEP_SETTINGS);\n\n if ($this->getRequest()->isPost())\n {\n $postData = $this->getRequest()->getPost();\n\n if (!isset($postData['goBack']))\n {\n $this->saveClientSettingsForm($postData);\n $this->saveHealthcheck();\n\n if (isset($postData['saveAndContinue']))\n {\n $this->updateHealthcheckStepName();\n $this->saveHealthcheck();\n $this->gotoNextNavigationStep($this->_navigation);\n }\n }\n else\n {\n $this->gotoPreviousNavigationStep($this->_navigation);\n }\n }\n else\n {\n $this->showClientSettingsForm();\n }\n }",
"function buildSettingsForm() {}",
"function renderConfigForm() {\n\t}",
"function postageapp_admin_form() {\n $form = array();\n \n $form['settings'] = array(\n '#type' => 'fieldset',\n '#title' => t('Postageapp settings'),\n );\n \n $form['settings']['postageapp_api_key'] = array(\n '#type' => 'textfield',\n '#title' => t('PostageApp API Key'),\n '#required' => TRUE,\n '#default_value' => variable_get('postageapp_api_key', ''),\n '#description' => t('The API key for your PostageApp account. Get or generate a valid API key at your PostageApp dashboard which is available at yourusername.postageapp.com')\n );\n \n return system_settings_form($form);\n}",
"public function save()\n\t{\n\t\tglobal $tpl, $lng, $ilCtrl;\n\t\n\t\t$pl = $this->getPluginObject();\n\t\t\n\t\t$form = $this->initConfigurationForm();\n\t\tif ($form->checkInput())\n\t\t{\n\t\t\t$set1 = $form->getInput(\"setting_1\");\n\t\t\t$set2 = $form->getInput(\"setting_2\");\n\t\n\t\t\t// @todo: implement saving to db\n\t\t\t\n\t\t\tilUtil::sendSuccess($pl->txt(\"saving_invoked\"), true);\n\t\t\t$ilCtrl->redirect($this, \"configure\");\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$form->setValuesByPost();\n\t\t\t$tpl->setContent($form->getHtml());\n\t\t}\n\t}",
"protected function getConfigForm()\n {\n // toDo: Add config to choose items showed by viewedItems\n return array(\n 'form' => array(\n 'legend' => array(\n 'title' => $this->l('Settings'),\n 'icon' => 'icon-cogs',\n ),\n 'input' => array(\n array(\n 'type' => 'switch',\n 'label' => $this->l('Live mode'),\n 'name' => 'CAPTURELEADSXAVIER_LIVE_MODE',\n 'is_bool' => true,\n 'desc' => $this->l('Use this module in live mode'),\n 'values' => array(\n array(\n 'id' => 'active_on',\n 'value' => true,\n 'label' => $this->l('Enabled')\n ),\n array(\n 'id' => 'active_off',\n 'value' => false,\n 'label' => $this->l('Disabled')\n )\n ),\n ),\n array(\n 'col' => 3,\n 'type' => 'text',\n 'prefix' => '<i class=\"icon icon-envelope\"></i>',\n 'desc' => $this->l('Enter a valid email address'),\n 'name' => 'CAPTURELEADSXAVIER_ACCOUNT_EMAIL',\n 'label' => $this->l('Email'),\n ),\n array(\n 'type' => 'password',\n 'name' => 'CAPTURELEADSXAVIER_ACCOUNT_PASSWORD',\n 'label' => $this->l('Password'),\n ),\n array(\n 'type' => 'radio',\n 'label' => $this->l('Column selector'),\n 'name' => 'CAPTURELEADSXAVIER_COL_SEL',\n 'required' => true,\n 'is_bool' => true,\n 'desc' => $this->l('Select on what column you want the module'),\n 'values' => array(\n array(\n 'id' => 'col_left',\n 'value' => \"left\",\n 'label' => $this->l('Left')\n ),\n array(\n 'id' => 'col_right',\n 'value' => \"right\",\n 'label' => $this->l('Right')\n )\n\n ),\n ),\n \n ),\n 'submit' => array(\n 'title' => $this->l('Save'),\n )\n )\n );\n }",
"function custom_settings_page() { ?>\n\t<div class=\"wrap\">\n\t\t<h1>Custom Settings</h1>\n\t\t<form method=\"post\" action=\"options.php\">\n\t\t\t<?php\n settings_fields('section');\n do_settings_sections('theme-options'); \n submit_button(); \n ?>\n\t\t</form>\n\t</div>\n\t<?php }",
"public function admin_page() {\n\t\t$transient = get_transient( 'pm-framework-transient' );\n\t\t$has_nav = ( count( $this->options ) <= 1 ) ? ' pm-show-all' : '';\n\t\t$section_id = ( ! empty( $transient['section_id'] ) ) ? $transient['section_id'] : $this->sections[0]['name'];\n\t\t$section_id = wppml_get_var( 'pm-section', $section_id );\n\n\t\techo '<div class=\"pm-framework pm-option-framework\">';\n\n\t\techo '<form method=\"post\" action=\"options.php\" enctype=\"multipart/form-data\" id=\"pmframework_form\">';\n\t\techo '<input type=\"hidden\" class=\"pm-reset\" name=\"wppml_section_id\" value=\"' . $section_id . '\" />';\n\n\t\tif ( $this->settings['ajax_save'] !== true && ! empty( $transient['errors'] ) ) {\n\t\t\tglobal $wppml_errors;\n\n\t\t\t$wppml_errors = $transient['errors'];\n\n\t\t\tif ( ! empty( $wppml_errors ) ) {\n\t\t\t\tforeach ( $wppml_errors as $error ) {\n\t\t\t\t\tif ( in_array( $error['setting'], array( 'general', 'pm-errors' ) ) ) {\n\t\t\t\t\t\techo '<div class=\"pm-settings-error ' . $error['type'] . '\">';\n\t\t\t\t\t\techo '<p><strong>' . $error['message'] . '</strong></p>';\n\t\t\t\t\t\techo '</div>';\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tsettings_fields( $this->unique );\n\n\t\techo '<header class=\"pm-header\">';\n\t\techo '<h1>' . $this->settings['framework_title'] . '</h1>';\n\t\techo '<fieldset>';\n\n\t\techo ( $this->settings['ajax_save'] ) ? '<span id=\"pm-save-ajax\">' . esc_html__( 'Settings saved.', 'pin-master' ) . '</span>' : '';\n\n\t\tsubmit_button( esc_html__( 'Save', 'pin-master' ), 'primary pm-save', 'save', false, array( 'data-save' => esc_html__( 'Saving...', 'pin-master' ) ) );\n\t\tsubmit_button( esc_html__( 'Restore', 'pin-master' ), 'secondary pm-restore pm-reset-confirm', $this->unique . '[reset]', false );\n\n\t\tif ( $this->settings['show_reset_all'] ) {\n\t\t\tsubmit_button( esc_html__( 'Reset All Options', 'pin-master' ), 'secondary pm-restore pm-warning-primary pm-reset-confirm', $this->unique . '[resetall]', false );\n\t\t}\n\n\t\techo '</fieldset>';\n\t\techo ( empty( $has_nav ) ) ? '<a href=\"#\" class=\"pm-expand-all\"><i class=\"fa fa-eye-slash\"></i> ' . esc_html__( 'show all options', 'pin-master' ) . '</a>' : '';\n\t\techo '<div class=\"clear\"></div>';\n\t\techo '</header>'; // end .pm-header\n\n\t\techo '<div class=\"pm-body' . $has_nav . '\">';\n\n\t\techo '<div class=\"pm-nav\">';\n\n\t\t echo '<ul>';\n\t\tforeach ( $this->options as $key => $tab ) {\n\t\t\tif ( ( isset( $tab['sections'] ) ) ) {\n\t\t\t\t$tab_active = wppml_array_search( $tab['sections'], 'name', $section_id );\n\t\t\t\t$active_style = ( ! empty( $tab_active ) ) ? ' style=\"display: block;\"' : '';\n\t\t\t\t$active_list = ( ! empty( $tab_active ) ) ? ' pm-tab-active' : '';\n\t\t\t\t$tab_icon = ( ! empty( $tab['icon'] ) ) ? '<i class=\"pm-icon ' . $tab['icon'] . '\"></i>' : '';\n\n\t\t\t\techo '<li class=\"pm-sub' . $active_list . '\">';\n\n\t\t\t\techo '<a href=\"#\" class=\"pm-arrow\">' . $tab_icon . $tab['title'] . '</a>';\n\n\t\t\t\techo '<ul' . $active_style . '>';\n\t\t\t\tforeach ( $tab['sections'] as $tab_section ) {\n\t\t\t\t\t$active_tab = ( $section_id == $tab_section['name'] ) ? ' class=\"pm-section-active\"' : '';\n\t\t\t\t\t$icon = ( ! empty( $tab_section['icon'] ) ) ? '<i class=\"pm-icon ' . $tab_section['icon'] . '\"></i>' : '';\n\n\t\t\t\t\techo '<li><a href=\"#\"' . $active_tab . ' data-section=\"' . $tab_section['name'] . '\">' . $icon . $tab_section['title'] . '</a></li>';\n\t\t\t\t}\n\t\t\t\techo '</ul>';\n\n\t\t\t\techo '</li>';\n\t\t\t} else {\n\t\t\t\t$icon = ( ! empty( $tab['icon'] ) ) ? '<i class=\"pm-icon ' . $tab['icon'] . '\"></i>' : '';\n\n\t\t\t\tif ( isset( $tab['fields'] ) ) {\n\t\t\t\t\t$active_list = ( $section_id == $tab['name'] ) ? ' class=\"pm-section-active\"' : '';\n\t\t\t\t\techo '<li><a href=\"#\"' . $active_list . ' data-section=\"' . $tab['name'] . '\">' . $icon . $tab['title'] . '</a></li>';\n\t\t\t\t} else {\n\t\t\t\t\techo '<li><div class=\"pm-seperator\">' . $icon . $tab['title'] . '</div></li>';\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t echo '</ul>';\n\n\t\techo '</div>'; // end .pm-nav\n\n\t\techo '<div class=\"pm-content\">';\n\n\t\t echo '<div class=\"pm-sections\">';\n\n\t\tforeach ( $this->sections as $section ) {\n\t\t\tif ( isset( $section['fields'] ) ) {\n\t\t\t\t$active_content = ( $section_id == $section['name'] ) ? ' style=\"display: block;\"' : '';\n\t\t\t\techo '<div id=\"pm-tab-' . $section['name'] . '\" class=\"pm-section\"' . $active_content . '>';\n\t\t\t\techo ( isset( $section['title'] ) && empty( $has_nav ) ) ? '<div class=\"pm-section-title\"><h3>' . $section['title'] . '</h3></div>' : '';\n\n\t\t\t\tforeach ( $section['fields'] as $field ) {\n\t\t\t\t\t$this->field_callback( $field );\n\t\t\t\t}\n\n\t\t\t\techo '</div>';\n\t\t\t}\n\t\t}\n\n\t\t echo '</div>'; // end .pm-sections\n\n\t\t echo '<div class=\"clear\"></div>';\n\n\t\techo '</div>'; // end .pm-content\n\n\t\techo '<div class=\"pm-nav-background\"></div>';\n\n\t\techo '</div>'; // end .pm-body\n\n\t\techo '<footer class=\"pm-footer\">';\n\t\techo '<div class=\"pm-block-left\">Powered by <a href=\"https://www.codenod.com\">Codenod</a></div>';\n\t\techo '<div class=\"pm-block-right\">Version ' . WPPML_VERSION . '</div>';\n\t\techo '<div class=\"clear\"></div>';\n\t\techo '</footer>'; // end .pm-footer\n\n\t\techo '</form>'; // end form\n\n\t\techo '<div class=\"clear\"></div>';\n\n\t\techo '</div>'; // end .pm-framework\n\t}",
"private function render_settings() {\n\t\t?>\n\t\t<div class=\"wrap\">\n\t\t\t<h1><?php esc_html_e( 'Network Mail', 'simple-smtp' ); ?></h1>\n\t\t\t<form action='edit.php?action=wpsimplesmtpms' method='post'>\t\n\t\t\t\t<?php\n\t\t\t\twp_nonce_field( 'simple-smtp-ms' );\n\t\t\t\tdo_settings_sections( 'wpsimplesmtp_smtp_ms' );\n\t\t\t\tsubmit_button();\n\t\t\t\t?>\n\t\t\t</form>\n\t\t</div>\n\t\t<?php\n\t}",
"public function ajax_form_settings() {\n\n if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'swpm_form_builder_form_settings') {\n $form_id = absint($_REQUEST['form']);\n $status = isset($_REQUEST['status']) ? $_REQUEST['status'] : 'opened';\n $accordion = isset($_REQUEST['accordion']) ? $_REQUEST['accordion'] : 'general-settings';\n $current_user = wp_get_current_user();\n $user_id = $current_user->ID;\n\n $form_settings = get_user_meta($user_id, 'swpm-form-settings', true);\n\n $array = array(\n 'form_setting_tab' => $status,\n 'setting_accordion' => $accordion\n );\n\n // Set defaults if meta key doesn't exist\n if (!$form_settings || $form_settings == '') {\n $meta_value[$form_id] = $array;\n\n update_user_meta($user_id, 'swpm-form-settings', $meta_value);\n } else {\n $form_settings[$form_id] = $array;\n\n update_user_meta($user_id, 'swpm-form-settings', $form_settings);\n }\n }\n\n die(1);\n }",
"function parse_push_notifications_options_page() {\n\techo'<div class=\"wrap\"><div class=\"card\"><div class=\"inside\">';\n\tparse_push_notifications_create_form();\n\techo '</div></div></div>';\n\n ?>\n <div class=\"wrap\">\n <div class=\"card\">\n <div class=\"inside\">\n\t<form action=\"options.php\" method=\"post\">\n\t\t<?php settings_fields('wp-parse-pn-settings-group'); ?>\n\n\t\t<h3>Parse API App Settings</h3>\n\n\t\t<table class=\"form-table\">\n\t\t\t<tr valign=\"top\">\n\t\t\t\t<th style=\"width:125px\" scope=\"row\">Application ID: </th>\n\t\t\t\t<td><input type=\"text\" name=\"pn_app_id\" value=\"<?php echo get_option('pn_app_id'); ?>\" size=\"50\"></td>\n\t\t\t</tr>\n\t\t\t<tr valign=\"top\">\n\t\t\t\t<th style=\"width:125px\" scope=\"row\">Master Key: </th>\n\t\t\t\t<td><input type=\"text\" name=\"pn_app_masterkey\" value=\"<?php echo get_option('pn_app_masterkey'); ?>\" size=\"50\"></td>\n\t\t\t</tr>\n\t\t\t<tr valign=\"top\">\n\t\t\t\t<th style=\"width:125px\" scope=\"row\">REST API Key: </th>\n\t\t\t\t<td><input type=\"text\" name=\"pn_app_restkey\" value=\"<?php echo get_option('pn_app_restkey'); ?>\" size=\"50\"></td>\n\t\t\t</tr>\n\t\t</table>\n\n\t\t<?php submit_button(); ?>\n\n\t</form>\n </div>\n </div>\n </div>\n <?php\n\n}",
"function MKS_plugin_options_page() {\n ?>\n <div>\n <h2>MakesBridge Plugin Settings</h2>\n <p>\n <em>Don't have a MakesBridge Account?</em> <a href=\"http://makesbridge.com/request-15-day-trial?pmc=CLDGRP\" target=\"_BLANK\">Sign up for a free trial here</a>\n </p>\n <form action=\"options.php\" method=\"post\">\n <?php settings_fields('makesbridge_options');\n do_settings_sections('MakesBridge'); ?>\n <input type=\"hidden\" name=\"mks_action\" value=\"api_settings\" />\n <input name=\"Submit\" type=\"submit\" value=\"Save Changes\" class=\"button-primary\"/>\n </form>\n </div>\n <?php\n}",
"public function ajax_form_settings() {\n\t\tglobal $current_user;\n\t\tget_currentuserinfo();\n\n\t\tif ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'visual_form_builder_form_settings' ) {\n\t\t\t$form_id = absint( $_REQUEST['form'] );\n\t\t\t$status = isset( $_REQUEST['status'] ) ? $_REQUEST['status'] : 'opened';\n\t\t\t$accordion = isset( $_REQUEST['accordion'] ) ? $_REQUEST['accordion'] : 'general-settings';\n\t\t\t$user_id = $current_user->ID;\n\n\t\t\t$form_settings = get_user_meta( $user_id, 'vfb-form-settings', true );\n\n\t\t\t$array = array(\n\t\t\t\t'form_setting_tab' \t=> $status,\n\t\t\t\t'setting_accordion' => $accordion\n\t\t\t);\n\n\t\t\t// Set defaults if meta key doesn't exist\n\t\t\tif ( !$form_settings || $form_settings == '' ) {\n\t\t\t\t$meta_value[ $form_id ] = $array;\n\n\t\t\t\tupdate_user_meta( $user_id, 'vfb-form-settings', $meta_value );\n\t\t\t}\n\t\t\telse {\n\t\t\t\t$form_settings[ $form_id ] = $array;\n\n\t\t\t\tupdate_user_meta( $user_id, 'vfb-form-settings', $form_settings );\n\t\t\t}\n\t\t}\n\n\t\tdie(1);\n\t}",
"private function settings()\n\t{\n\t\tif($_POST)\n\t\t{\n\t\t\t// Available Vews\n config::set('s7n.views', $this->input->post('views'));\n\n\t\t\t// Default Sidebar Title\n config::set('s7n.default_sidebar_title', $this->input->post('default_sidebar_title'));\n\n\t\t\t// Default Sidebar Content\n config::set('s7n.default_sidebar_content', $this->input->post('default_sidebar_content'));\n\n\t\t\tmessage::info(__('Page Settings edited successfully'), 'admin/page/settings');\n\t\t}\n\n\t\t$this->head->title->append(__('Settings'));\n\n\t\t$this->template->title .= __('Settings');\n\t\t$this->template->content = View::factory('page/settings', array(\n\t\t\t'views' => config::get('s7n.page_views'),\n\t\t\t'default_sidebar_title' => config::get('s7n.default_sidebar_title'),\n\t\t\t'default_sidebar_content' => config::get('s7n.default_sidebar_content')\n\t\t));\n\t}"
] |
[
"0.76225555",
"0.71850854",
"0.70313656",
"0.6904426",
"0.67175114",
"0.6703145",
"0.6672524",
"0.6624761",
"0.6542768",
"0.6539534",
"0.6538537",
"0.6537689",
"0.6449808",
"0.6436906",
"0.6423973",
"0.6415788",
"0.6410898",
"0.6377675",
"0.6374519",
"0.63722324",
"0.63705724",
"0.6354594",
"0.6316013",
"0.6314097",
"0.63131446",
"0.6312693",
"0.6298849",
"0.6294688",
"0.6281477",
"0.6254616"
] |
0.7458557
|
1
|
Form constructor for the Hours / Default Hours configuration page.
|
function room_reservations_admin_settings_default_hours($form, &$form_state) {
$hours = _room_reservations_hours();
// Select box options.
$options = array();
$options['9999'] = t('Select the time');
$options['0000'] = t('Midnight - start of day');
foreach ($hours as $hour) {
$time = $hour['time'];
$display = t($hour['display']);
if ($time != '0000') {
$options[$time] = $display;
}
}
$options['2400'] = t('Midnight - end of day');
// Get saved default hours.
$default_hours
= unserialize(_room_reservations_get_variable('default_hours'));
if (!$default_hours) {
for ($x = 0; $x < 28; $x++) {
$default_hours[$x] = '9999';
}
}
$days = array(
t('Sunday'),
t('Monday'),
t('Tuesday'),
t('Wednesday'),
t('Thursday'),
t('Friday'),
t('Saturday'),
);
$form['#tree'] = TRUE;
for ($day = 0; $day < 7; $day++) {
$day_hours = array();
$day_hours[] = $default_hours[($day * 4)];
$day_hours[] = $default_hours[($day * 4) + 1];
$day_hours[] = $default_hours[($day * 4) + 2];
$day_hours[] = $default_hours[($day * 4) + 3];
$display_hours = _room_reservations_hours_display($day_hours);
$form['day_' . $day] = array(
'#type' => 'fieldset',
'#title' => $days[$day] . ' (' . $display_hours . ')',
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#weight' => -90 + ($day * 10),
);
$form['day_' . $day]['first_shift_open_' . $day] = array(
'#title' => t('First shift open'),
'#type' => 'select',
'#options' => $options,
'#default_value' => $default_hours[($day * 4)],
'#weight' => -90 + ($day * 10) + 1,
);
$form['day_' . $day]['first_shift_close_' . $day] = array(
'#title' => t('First shift close'),
'#type' => 'select',
'#options' => $options,
'#default_value' => $default_hours[($day * 4) + 1],
'#weight' => -90 + ($day * 10) + 2,
);
$form['day_' . $day]['second_shift_open_' . $day] = array(
'#title' => t('Second shift open'),
'#type' => 'select',
'#options' => $options,
'#default_value' => $default_hours[($day * 4) + 2],
'#weight' => -90 + ($day * 10) + 3,
);
$form['day_' . $day]['second_shift_close_' . $day] = array(
'#title' => t('Second shift close'),
'#type' => 'select',
'#options' => $options,
'#default_value' => $default_hours[($day * 4) + 3],
'#weight' => -90 + ($day * 10) + 4,
);
}
$form['save'] = array(
'#type' => 'submit',
'#value' => t('Save configuration'),
'#weight' => 100,
);
$form['reset'] = array(
'#type' => 'submit',
'#value' => t('Reset to defaults'),
'#weight' => 101,
);
return $form;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function __construct() {\n\n\t\t\tparent::__construct(\n\t\t\t\t'zthemename_business_hours',\n\t\t\t\tesc_html__( 'Business Hours', 'zthemename' ),\n\t\t\t\tarray(\n\t\t\t\t\t'description' => esc_html__( \"Displays the business' hours\", 'zthemename' ),\n\t\t\t\t\t'customize_selective_refresh' => true,\n\t\t\t\t)\n\t\t\t);\n\t\t\t// get opening hours from db.\n\t\t\t$this->opening_hours = $this->generate_hours();\n\t\t}",
"private function setHoursField(){\n \n $hoursnode = $this->getHoursNode();\n \n $hoursfield = $hoursnode->field_hours_paragraph->view(array('type' => 'full', 'label' => 'hidden')); \n \n if(in_array('show_today', $this->getOptions())){\n $hoursfield['#prefix'] = '<div class=\"field today-only\">';\n $hoursfield['#suffix'] = '</div>';\n }\n \n $this->hoursfield = $hoursfield;\n }",
"public function __construct() {\n\n parent::__construct(\n 'jobcareer_opening_hours', // Base ID\n esc_html__('CS : Opening Hours', 'jobcareer'), // Name\n array('classname' => 'widget_timing', 'description' => esc_html__('Footer Opening Hours Information', 'jobcareer'),) // Args\n );\n }",
"function setHour($h)\r\n {\r\n if($h > 23 || $h < 0) {\r\n $this->hora = 0;\r\n } else {\r\n $this->hora = $h;\r\n }\r\n }",
"function __construct($hour)\n {\n $this->Hour = $hour;\n }",
"public function __construct()\n {\n parent::__construct();\n parent::setSize(640, null);\n parent::setTitle('AgendaEntry');\n parent::removePadding();\n \n // creates the form\n $this->form = new BootstrapFormBuilder('form_Entry');\n $this->form->setProperty('style', 'margin-bottom:0');\n \n $hours = array();\n $durations = array();\n for ($n=0; $n<24; $n++)\n {\n $hours[$n] = \"$n:00\";\n $durations[$n+1] = $n+1 . ' h';\n }\n array_pop($durations);\n // create the form fields\n $id = new TEntry('id');\n $entry_date = new TDate('entry_date');\n $start_hour = new TCombo('start_hour');\n $duration = new TCombo('duration');\n $title = new TEntry('title');\n $description = new TText('description');\n \n $start_hour->addItems($hours);\n $duration->addItems($durations);\n $id->setEditable(FALSE);\n \n // define the sizes\n $id->setSize(40);\n $entry_date->setSize(100);\n $start_hour->setSize(100);\n $duration->setSize(100);\n $title->setSize(400);\n $description->setSize(400, 50);\n \n // add one row for each form field\n $this->form->addFields( [new TLabel('ID:')], [$id] );\n $this->form->addFields( [new TLabel('Entry Date:')], [$entry_date] );\n $this->form->addFields( [new TLabel('Start Hour:')], [$start_hour] );\n $this->form->addFields( [new TLabel('Duration:')], [$duration] );\n $this->form->addFields( [new TLabel('Title:')], [$title] );\n $this->form->addFields( [new TLabel('Description:')], [$description] );\n\n $this->form->addAction( _t('Save'), new TAction(array($this, 'onSave')), 'fa:save green');\n $this->form->addAction( _t('Clear'), new TAction(array($this, 'onEdit')), 'fa:eraser red');\n \n parent::add($this->form);\n }",
"function room_reservations_admin_settings_default_hours_validate($form_id, &$form_state) {\n $days = array(\n t('Sunday'),\n t('Monday'),\n t('Tuesday'),\n t('Wednesday'),\n t('Thursday'),\n t('Friday'),\n t('Saturday'),\n );\n if ($form_state['clicked_button']['#value'] == t('Save configuration')) {\n for ($day = 0; $day < 7; $day++) {\n $open = TRUE;\n $second_shift = FALSE;\n $first_shift_open\n = $form_state['values']['day_' . $day]['first_shift_open_' . $day];\n $first_shift_close\n = $form_state['values']['day_' . $day]['first_shift_close_' . $day];\n $second_shift_open\n = $form_state['values']['day_' . $day]['second_shift_open_' . $day];\n $second_shift_close\n = $form_state['values']['day_' . $day]['second_shift_close_' . $day];\n $int_first_shift_open\n = intval(\n $form_state['values']['day_' . $day]['first_shift_open_' . $day]);\n $int_first_shift_close\n = intval(\n $form_state['values']['day_' . $day]['first_shift_close_' . $day]);\n $int_second_shift_open\n = intval(\n $form_state['values']['day_' . $day]['second_shift_open_' . $day]);\n $int_second_shift_close\n = intval(\n $form_state['values']['day_' . $day]['second_shift_close_' . $day]);\n // Closed.\n if (($int_first_shift_open == 9999) && \n ($int_first_shift_close == 9999) && \n ($int_second_shift_open == 9999) && \n ($int_second_shift_close == 9999)) {\n $open = FALSE;\n }\n // First shift.\n if ($open) {\n if ($int_first_shift_open == 9999) {\n $field = 'day_' . $day . '][first_shift_open_' . $day;\n $message = t('!day - First shift open is required.', \n array('!day' => $days[$day]));\n form_set_error($field, check_plain($message));\n }\n elseif ($int_first_shift_close == 9999) {\n $field = 'day_' . $day . '][first_shift_close_' . $day;\n $message = t('!day - First shift close is required.', \n array('!day' => $days[$day]));\n form_set_error($field, check_plain($message));\n }\n elseif ($int_first_shift_open >= $int_first_shift_close) {\n $field = 'day_' . $day . '][first_shift_close_' . $day;\n $message = t('!day - First shift close must be later than first shift\n open.', array('!day' => $days[$day]));\n form_set_error($field, check_plain($message));\n }\n }\n // Second shift.\n if ($open) {\n if (($int_second_shift_open != 9999) || \n ($int_second_shift_close != 9999)) {\n $second_shift = TRUE;\n }\n }\n if ($second_shift) {\n if (($int_first_shift_open == 9999) && \n ($int_first_shift_close == 9999)) {\n $field = 'day_' . $day . '][second_shift_open_' . $day;\n $message = t('!day - Cannot have a second shift without a first\n shift.', array('!day' => $days[$day]));\n form_set_error($field, check_plain($message));\n }\n elseif ($int_second_shift_open == 9999) {\n $field = 'day_' . $day . '][second_shift_open_' . $day;\n $message = t('!day - Second shift open is missing.', \n array('!day' => $days[$day]));\n form_set_error($field, check_plain($message));\n }\n elseif ($int_second_shift_close == 9999) {\n $field = 'day_' . $day . '][second_shift_close_' . $day;\n $message = t('!day - Second shift close is missing.', \n array('!day' => $days[$day]));\n form_set_error($field, check_plain($message));\n }\n elseif ($int_second_shift_open <= $int_first_shift_close) {\n $field = 'day_' . $day . '][second_shift_open_' . $day;\n $message = t('!day - Second shift open must be later than first\n shift close.', array('!day' => $days[$day]));\n form_set_error($field, check_plain($message));\n }\n elseif ($int_second_shift_open >= $int_second_shift_close) {\n $field = 'day_' . $day . '][second_shift_close_' . $day;\n $message = t('!day - Second shift close must be later than second\n shift opten.', array('!day' => $days[$day]));\n form_set_error($field, check_plain($message));\n }\n }\n }\n }\n}",
"function form_select_hour($name, $hour, $id='') {\n\n\tglobal $cache2;\n\n\t$id = ifr($id, $name);\n\n\treturn form_select($name, $cache2->getCalendarData('hours'), '', $hour, '', '', '', '', '', $id);\n\n}",
"function room_reservations_admin_settings_default_hours_submit($form_id, &$form_state) {\n $default_hours = array();\n if ($form_state['clicked_button']['#value'] == t('Save configuration')) {\n for ($day = 0; $day < 7; $day++) {\n $default_hours[] = $form_state['values']['day_' . $day]['first_shift_open_' . $day];\n $default_hours[] = $form_state['values']['day_' . $day]['first_shift_close_' . $day];\n $default_hours[] = $form_state['values']['day_' . $day]['second_shift_open_' . $day];\n $default_hours[] = $form_state['values']['day_' . $day]['second_shift_close_' . $day];\n }\n $confirmation = ROOM_RESERVATIONS_SAVE_CONFIRMATION_MSG;\n $error = ROOM_RESERVATIONS_SAVE_ERROR_MSG;\n }\n if ($form_state['clicked_button']['#value'] == t('Reset to defaults')) {\n for ($day = 0; $day < 7; $day++) {\n $default_hours[] = '9999';\n $default_hours[] = '9999';\n $default_hours[] = '9999';\n $default_hours[] = '9999';\n }\n $confirmation = ROOM_RESERVATIONS_RESET_CONFIRMATION_MSG;\n $error = ROOM_RESERVATIONS_RESET_ERROR_MSG;\n }\n $errors = FALSE;\n $result = _room_reservations_set_variable('default_hours', serialize($default_hours));\n if (!$result) {\n $errors = TRUE;\n }\n else {\n\n }\n // Update monthly hours records.\n $sql = \"SELECT * FROM {room_reservations_variables} WHERE name LIKE 'monthly_hours_%'\";\n $results = db_query($sql);\n foreach ($results as $data){\n $name = $data->name;\n $month = intval(drupal_substr($name, 19));\n $year = drupal_substr($name, 14, 4);\n $mo_hours = unserialize($data->value);\n // Days in the month.\n $days = date('t', mktime(0, 0, 0, $month, 1, (int) $year));\n $upd_mo_hours = array();\n for ($day = 0; $day < $days; $day++) {\n $default_ind = $mo_hours[($day * 5)];\n if ($default_ind == 'D') {\n // Update monthly hours with default day of week hours.\n // Day of the week.\n $dow = date('w', mktime(0, 0, 0, $month, $day + 1, (int) $year));\n $upd_mo_hours[($day * 5)] = 'D';\n $upd_mo_hours[($day * 5) + 1] = $default_hours[($dow * 4)];\n $upd_mo_hours[($day * 5) + 2] = $default_hours[($dow * 4) + 1];\n $upd_mo_hours[($day * 5) + 3] = $default_hours[($dow * 4) + 2];\n $upd_mo_hours[($day * 5) + 4] = $default_hours[($dow * 4) + 3];\n }\n elseif ($default_ind == 'O') {\n // Leave monthly hours unchanged.\n $upd_mo_hours[($day * 5)] = 'O';\n $upd_mo_hours[($day * 5) + 1] = $mo_hours[($day * 5) + 1];\n $upd_mo_hours[($day * 5) + 2] = $mo_hours[($day * 5) + 2];\n $upd_mo_hours[($day * 5) + 3] = $mo_hours[($day * 5) + 3];\n $upd_mo_hours[($day * 5) + 4] = $mo_hours[($day * 5) + 4];\n }\n }\n $result2 = _room_reservations_set_variable($name, \n serialize($upd_mo_hours));\n if (!$result2) {\n $errors = TRUE;\n }\n }\n if ($errors) {\n drupal_set_message(check_plain($error), 'error');\n }\n else {\n drupal_set_message(check_plain($confirmation));\n }\n}",
"public function hoursForm($result)\n {\n if ( !$this->ownerLoggedIn() )\n {\n $this->restricted();\n return;\n }\n\n require_once('views/HoursView.class.php'); \n require_once('views/FormError.class.php');\n \n $site = new SiteContainer($this->db);\n $message = new FormError();\n \n $hv = new HoursView();\n\n $site->printHeader();\n $site->printNav(\"owner\");\n \n if ($result == \"bad_time\")\n $message->printHtml(array(\"bad_time\"));\n \n $hv->printHtml($result);\n $site->printFooter(); \n }",
"function options_form(&$form, &$form_state) {\r\n parent::options_form($form, $form_state);\r\n $options = $this->date_handler->date_parts();\r\n unset($options['second'], $options['minute']);\r\n $options += array('week' => date_t('Week', 'datetime'));\r\n $form['granularity'] = array(\r\n '#title' => t('Granularity'),\r\n '#type' => 'radios',\r\n '#options' => $options,\r\n '#default_value' => $this->options['granularity'],\r\n '#multiple' => TRUE,\r\n '#description' => t(\"Select the type of date value to be used in defaults, summaries, and navigation. For example, a granularity of 'month' will set the default date to the current month, summarize by month in summary views, and link to the next and previous month when using date navigation.\"),\r\n );\r\n\r\n $form['year_range'] = array(\r\n '#title' => t('Date year range'),\r\n '#type' => 'textfield',\r\n '#default_value' => $this->options['year_range'],\r\n '#description' => t(\"Set the allowable minimum and maximum year range for this argument, either a -X:+X offset from the current year, like '-3:+3' or an absolute minimum and maximum year, like '2005:2010'. When the argument is set to a date outside the range, the page will be returned as 'Page not found (404)'.\"),\r\n );\r\n \r\n $fields = date_api_fields($this->definition['base']);\r\n $options = array();\r\n foreach ($fields['name'] as $name => $field) {\r\n $options[$name] = $field['label'];\r\n }\r\n $form['date_fields'] = array(\r\n '#title' => t('Date field(s)'),\r\n '#type' => 'checkboxes',\r\n '#options' => $options,\r\n '#default_value' => $this->options['date_fields'],\r\n '#multiple' => TRUE,\r\n '#description' => t(\"Select one or more date fields to filter with this argument. Do not select both the 'From date' and 'To date' for CCK date fields, only one of them is needed.\"),\r\n );\r\n $form['date_method'] = array(\r\n '#title' => t('Method'),\r\n '#type' => 'radios',\r\n '#options' => array('OR' => t('OR'), 'AND' => t('AND')),\r\n '#default_value' => $this->options['date_method'],\r\n '#description' => t('Method of handling multiple date fields in the same query. Return items that have any matching date field (date = field_1 OR field_2), or only those with matches in all selected date fields (date = field_1 AND field_2).'),\r\n );\r\n \r\n }",
"private function getHoursField(){\n \n if(!$this->hoursfield)\n $this->setHoursField();\n \n return $this->hoursfield;\n }",
"private function timingSection() {\n $this->_form->addElement('header', 'timing', get_string('timing', 'codeactivity')); \n \n $this->_form->addElement('date_time_selector', 'opendate', get_string('open_date', 'codeactivity'), self::$datefieldoptions);\n $this->_form->addHelpButton(\n 'opendate',\n 'open_date',\n 'codeactivity');\n $this->_form->addElement('date_time_selector', 'duedate', get_string('due_date', 'codeactivity'), self::$datefieldoptions);\n $this->_form->addHelpButton(\n 'duedate',\n 'due_date',\n 'codeactivity'); \n }",
"public function form( $instance ) {\n $title = ! empty( $instance['title'] ) ? $instance['title'] : '';\n $seperator =!empty( $instance['seperator']) ? $instance['seperator'] : '';\n $hour = !empty( $instance['hour']) ? $instance['hour'] : '';\n $amorpm = !empty( $instance['amorpm'] ) ? $instance['amorpm'] : '';?>\n <p>\n <label for=\"<?php echo $this->get_field_id( 'title' ); ?>\">Title:</label>\n <input type=\"text\" id=\"<?php echo $this->get_field_id( 'title' ); ?>\" name=\"<?php echo $this->get_field_name( 'title' ); ?>\" value=\"<?php echo esc_attr( $title ); ?>\" />\n </p>\n <p>\n <label for=\"<?php echo $this->get_field_id( 'seperator' ); ?>\">Seperator:</label>\n <input type=\"text\" id=\"<?php echo $this->get_field_id( 'seperator' ); ?>\" name=\"<?php echo $this->get_field_name( 'seperator' ); ?>\" value=\"<?php echo esc_attr( $seperator ); ?>\" />\n </p>\n <p><label for=\"<?php echo $this->get_field_id('hour'); ?>\">\n <?php _e('12 hour format:'); ?>\n <input id=\"<?php echo $this->get_field_id('h'); ?>\" name=\"<?php echo $this->get_field_name('hour'); ?>\" type=\"radio\" value=\"h\" <?php if($hour === 'h'){ echo 'checked=\"checked\"'; } ?> />\n </label><br>\n <label for=\"<?php echo $this->get_field_id('hour'); ?>\">\n <?php _e('24 hour format:'); ?>\n <input id=\"<?php echo $this->get_field_id('H'); ?>\" name=\"<?php echo $this->get_field_name('hour'); ?>\" type=\"radio\" value=\"H\" <?php if($hour === 'H'){ echo 'checked=\"checked\"'; } ?> />\n </label></p>\n <p><label for=\"<?php echo $this->get_field_id('amorpm'); ?>\">\n <?php _e('Small letters meridiam:'); ?>\n <input id=\"<?php echo $this->get_field_id('a'); ?>\" name=\"<?php echo $this->get_field_name('amorpm'); ?>\" type=\"radio\" value=\"a\" <?php if($amorpm === 'a'){ echo 'checked=\"checked\"'; } ?> />\n </label><br>\n <label for=\"<?php echo $this->get_field_id('amorpm'); ?>\">\n <?php _e('Capital Meridiam:'); ?>\n <input id=\"<?php echo $this->get_field_id('A'); ?>\" name=\"<?php echo $this->get_field_name('amorpm'); ?>\" type=\"radio\" value=\"A\" <?php if($amorpm === 'A'){ echo 'checked=\"checked\"'; } ?> />\n </label></p> <?php\n }",
"public function form( $instance ) {\n\t\t\n\t\t\t$instance = wp_parse_args(\n\t\t\t\t(array) $instance,\n\t\t\t\tarray(\n\t\t\t\t\t'title' => esc_html__( 'Business Hours.', 'zthemename' ),\n\t\t\t\t)\n\t\t\t); \n\n\t\t\t?>\n\t\t\t<p>\n\t\t\t\t<label for=\"<?php echo $this->get_field_id( 'title' ); ?>\"><?php esc_html_e( 'Title:', 'zthemename' ); ?></label>\n\t\t\t\t<input class=\"widefat\" id=\"<?php echo $this->get_field_id( 'title' ); ?>\" name=\"<?php echo $this->get_field_name( 'title' ); ?>\" type=\"text\" value=\"<?php echo esc_attr( $instance['title'] ); ?>\">\n\t\t\t</p>\n\t\t\t<div>\n\t\t\t\t<div> </div>\n\t\t\t\t<div><?php esc_html_e( 'Open', 'zthemename' ); ?></div>\n\t\t\t\t<div><?php esc_html_e( 'Close', 'zthemename' ); ?></div>\n\t\t\t</div>\n\n\t\t\t<div>\n\t\t\t\t<div><?php esc_html_e( 'Monday:', 'zthemename'); ?></div>\n\t\t\t\t<input type=\"text\" size=\"9\" value=\"<?php echo isset( $this->opening_hours['Monday'][0] ) ? $this->opening_hours['Monday'][0] : ''; ?>\" readonly>\n\t\t\t\t<input type=\"text\" size=\"9\" value=\"<?php echo isset( $this->opening_hours['Monday'][1] ) ? $this->opening_hours['Monday'][1] : ''; ?>\" readonly>\n\t\t\t</div>\n\n\t\t\t<div>\n\t\t\t\t<div><?php esc_html_e( 'Tuesday:', 'zthemename' ); ?></div>\n\t\t\t\t<input type=\"text\" size=\"9\" value=\"<?php echo isset( $this->opening_hours['Tuesday'][0] ) ? $this->opening_hours['Tuesday'][0] : ''; ?>\" readonly>\n\t\t\t\t<input type=\"text\" size=\"9\" value=\"<?php echo isset( $this->opening_hours['Tuesday'][1] ) ? $this->opening_hours['Tuesday'][1] : ''; ?>\" readonly>\n\t\t\t</div>\n\n\t\t\t<div>\n\t\t\t\t<div><?php esc_html_e( 'Wednesday:', 'zthemename' ); ?></div>\n\t\t\t\t<input type=\"text\" size=\"9\" value=\"<?php echo isset( $this->opening_hours['Wednesday'][0] ) ? $this->opening_hours['Wednesday'][0] : ''; ?>\" readonly>\n\t\t\t\t<input type=\"text\" size=\"9\" value=\"<?php echo isset( $this->opening_hours['Wednesday'][1] ) ? $this->opening_hours['Wednesday'][1] : ''; ?>\" readonly>\n\t\t\t</div>\n\n\t\t\t<div>\n\t\t\t\t<div><?php esc_html_e( 'Thursday:', 'zthemename' ); ?></div>\n\t\t\t\t<input type=\"text\" size=\"9\" value=\"<?php echo isset( $this->opening_hours['Thursday'][0] ) ? $this->opening_hours['Thursday'][0] : ''; ?>\" readonly>\n\t\t\t\t<input type=\"text\" size=\"9\" value=\"<?php echo isset( $this->opening_hours['Thursday'][1] ) ? $this->opening_hours['Thursday'][1] : ''; ?>\" readonly>\n\t\t\t</div>\n\n\t\t\t<div>\n\t\t\t\t<div><?php esc_html_e( 'Friday:', 'zthemename' ); ?></div>\n\t\t\t\t<input type=\"text\" size=\"9\" value=\"<?php echo isset( $this->opening_hours['Friday'][0] ) ? $this->opening_hours['Friday'][0] : ''; ?>\" readonly>\n\t\t\t\t<input type=\"text\" size=\"9\" value=\"<?php echo isset( $this->opening_hours['Friday'][1] ) ? $this->opening_hours['Friday'][1] : ''; ?>\" readonly>\n\t\t\t</div>\n\n\t\t\t<div>\n\t\t\t\t<div><?php esc_html_e( 'Saturday:', 'zthemename'); ?></div>\n\t\t\t\t<input type=\"text\" size=\"9\" value=\"<?php echo isset( $this->opening_hours['Saturday'][0] ) ? $this->opening_hours['Saturday'][0] : ''; ?>\" readonly>\n\t\t\t\t<input type=\"text\" size=\"9\" value=\"<?php echo isset( $this->opening_hours['Saturday'][1] ) ? $this->opening_hours['Saturday'][1] : ''; ?>\" readonly>\n\t\t\t</div>\n\n\t\t\t<div>\n\t\t\t\t<div><?php esc_html_e( 'Sunday:', 'zthemename'); ?></div>\n\t\t\t\t<input type=\"text\" size=\"9\" value=\"<?php echo isset( $this->opening_hours['Sunday'][0] ) ? $this->opening_hours['Sunday'][0] : ''; ?>\" readonly>\n\t\t\t\t<input type=\"text\" size=\"9\" value=\"<?php echo isset( $this->opening_hours['Sunday'][1] ) ? $this->opening_hours['Sunday'][1] : ''; ?>\" readonly>\n\t\t\t</div>\n\n\t\t\t\n\t\t\t<p>\n\t\t\t\t<?php\n\t\t\t\t\t$url = admin_url( 'themes.php?page=zthemename-options' );\n\t\t\t\t\t/* translators: %s: URL to create a new menu. */\n\t\t\t\t\tprintf( __( 'Synchronize business hours <a href=\"%s\">here</a>.' ), esc_attr( $url ) );\n\t\t\t\t?>\n\t\t\t</p>\n\t\t\t<?php\n\t\t}",
"public function __construct()\n {\n parent::__construct();\n \n parent::setTargetContainer('adianti_right_panel');\n \n // creates the form\n $this->form = new BootstrapFormBuilder('form_event');\n $this->form->setFormTitle('Event');\n $this->form->setProperty('style', 'margin-bottom:0;box-shadow:none');\n \n $hours = array();\n $minutes = array();\n for ($n=0; $n<24; $n++)\n {\n $hours[$n] = str_pad($n, 2, '0', STR_PAD_LEFT);\n }\n \n for ($n=0; $n<=55; $n+=5)\n {\n $minutes[$n] = str_pad($n, 2, '0', STR_PAD_LEFT);\n }\n \n // create the form fields\n $view = new THidden('view');\n $id = new TEntry('id');\n $color = new TColor('color');\n $start_date = new TDate('start_date');\n $start_hour = new TCombo('start_hour');\n $start_minute = new TCombo('start_minute');\n $end_date = new TDate('end_date');\n $end_hour = new TCombo('end_hour');\n $end_minute = new TCombo('end_minute');\n $title = new TEntry('title');\n $description = new TText('description');\n $color->setValue('#3a87ad');\n \n $start_hour->addItems($hours);\n $start_minute->addItems($minutes);\n $end_hour->addItems($hours);\n $end_minute->addItems($minutes);\n \n $id->setEditable(FALSE);\n \n // define the sizes\n $id->setSize(40);\n $color->setSize(100);\n $start_date->setSize(120);\n $end_date->setSize(120);\n $start_hour->setSize(70);\n $end_hour->setSize(70);\n $start_minute->setSize(70);\n $end_minute->setSize(70);\n $title->setSize(400);\n $description->setSize(400, 50);\n \n $start_hour->setChangeAction(new TAction(array($this, 'onChangeStartHour')));\n $end_hour->setChangeAction(new TAction(array($this, 'onChangeEndHour')));\n $start_date->setExitAction(new TAction(array($this, 'onChangeStartDate')));\n $end_date->setExitAction(new TAction(array($this, 'onChangeEndDate')));\n\n // add one row for each form field\n $this->form->addFields( [$view] );\n $this->form->addFields( [new TLabel('ID:', null, null, 'b')]);\n $this->form->addFields( [$id] );\n $this->form->addFields( [new TLabel('Color:', null, null, 'b')] );\n $this->form->addFields( [$color] );\n $this->form->addFields( [new TLabel('Start time:', null, null, 'b')]);\n $this->form->addFields( [$start_date, $start_hour, ':', $start_minute] );\n $this->form->addFields( [new TLabel('End time:', null, null, 'b')]);\n $this->form->addFields( [$end_date, $end_hour, ':', $end_minute] );\n $this->form->addFields( [new TLabel('Title:', null, null, 'b')]);\n $this->form->addFields( [$title] );\n $this->form->addFields( [new TLabel('Description:', null, null, 'b')]);\n $this->form->addFields( [$description] );\n \n $this->form->addAction( _t('Save'), new TAction(array($this, 'onSave')), 'fa:save green');\n $this->form->addAction( _t('Clear'), new TAction(array($this, 'onEdit')), 'fa:eraser orange');\n $this->form->addAction( _t('Delete'), new TAction(array($this, 'onDelete')), 'far:trash-alt red');\n $this->form->addHeaderActionLink( _t('Close'), new TAction(array($this, 'onClose')), 'fa:times red');\n \n parent::add($this->form);\n }",
"function form_time_options($variable='date', $number='', $type='hours') {\n\n\t$types = array('minutes', 'hours', 'days', 'weeks', 'months', 'years');\n\treturn form_input($variable . '[number]', $number, 4, '', '', 'id=\"' . $variable . '_number\"') . \" \" . form_select($variable . '[datetype]', $types, '', $type, 1, '', '', '', '', $variable . '_datetype');\n\n}",
"public static function onChangeStartHour($param=NULL)\n {\n $obj = new stdClass;\n if (empty($param['start_minute']))\n {\n $obj->start_minute = '0';\n TForm::sendData('form_event', $obj);\n }\n \n if (empty($param['end_hour']) AND empty($param['end_minute']))\n {\n $obj->end_hour = $param['start_hour'] +1;\n $obj->end_minute = '0';\n TForm::sendData('form_event', $obj);\n }\n }",
"public function hours() {\n //TODO prediction\n }",
"function form_time($field, $options){\n $defaults = array(\n 'wrap' => true,\n 'label' => true,\n 'class' => array('date', 'input'),\n 'interval' => 1,\n 'format' => 24,\n 'separator' => ':'\n );\n\n $options = array_merge($defaults, $options);\n \n $hours = array();\n for($i = 0; $i < $options['format']; $i++) {\n if($options['format'] == 12 && $i == 0) {\n $hour = 12;\n } else {\n $hour = $i;\n }\n $hours[$hour] = $hour;\n }\n\n $minutes = array();\n for($i = 0; $i < 60; $i+=$options['interval']) {\n $minute = str_pad($i, 2, '0', STR_PAD_LEFT);\n $minutes[$minute] = $minute;\n }\n \n if(empty($_POST[$field . '[hours]'])) {\n $_POST[$field . '[hours]'] = ($options['format'] == 12) ? date('g') : date('G');\n }\n\n $output = form_select(\n $field . '[hours]',\n array(\n 'wrap' => false,\n 'label' => false,\n 'options' => $hours\n )\n );\n\n $output .= $options['separator'];\n\n if(empty($_POST[$field . '[minutes]'])) {\n $current = date('i');\n while(($current % 5) !== 0) {\n $current++;\n }\n \n $_POST[$field . '[minutes]'] = $current;\n }\n\n $output .= form_select(\n $field . '[minutes]',\n array(\n 'wrap' => false,\n 'label' => false,\n 'options' => $minutes\n )\n );\n\n if($options['format'] == 12) {\n if(empty($_POST[$field . '[meridiem]'])) {\n $_POST[$field . '[meridiem]'] = date('A');\n }\n \n $output .= ' ';\n $output .= form_select(\n $field . '[meridiem]',\n array(\n 'wrap' => false,\n 'label' => false,\n 'options' => array('AM' => 'AM', 'PM' => 'PM')\n )\n );\n }\n\n if($options['wrap']) {\n $options['field'] = $field;\n $output = form__wrap($output, $options);\n }\n\n $error = form_error_message($field);\n if(!empty($error)) {\n $output .= $error;\n }\n\n return html__output($output);\n}",
"private function setHoursNode(){\n \n $node = $this->getNode();\n $hoursnode = NULL;\n \n if(!$node->field_hours_paragraph->getValue() && $node->field_hoursdays_reference->entity)\n $hoursnode = $node->field_hoursdays_reference->entity;\n \n if(!$hoursnode)\n $hoursnode = $node;\n \n $this->hoursnode = $hoursnode;\n }",
"protected function _construct()\r\n {\r\n parent::_construct();\r\n $this->setTemplate('placetopay/form.phtml');\r\n }",
"public function create()\n {\n return view('hours.create');\n }",
"function room_reservations_admin_settings_daily_hours($form, &$form_state, $selected_month = NULL) {\n $cur_months = _room_reservations_current_months();\n \n if (!$selected_month) {\n // create a form to pick a month.\n $month_options = array();\n $first = current($cur_months);\n foreach ($cur_months as $cur_month) {\n $yyyy_mm = $cur_month['YYYY_MM'];\n $display = t($cur_month['display']);\n $month_options[$yyyy_mm] = t($cur_month['display']);\n }\n // Form.\n $form['select_month']['month'] = array(\n '#title' => t('Month'),\n '#type' => 'select',\n '#options' => $month_options,\n '#default_value' => $first['YYYY_MM'],\n '#weight' => -4000,\n );\n $form['select_month']['save'] = array(\n '#type' => 'submit',\n '#value' => t('Select a month'),\n '#weight' => -3990,\n ); \n \n // and if no month has been selected; just return this form\n\n return $form;\n }\n \n // If the month has been selected, return a form to update the hours for each day of that month.\n $hours = _room_reservations_hours();\n // Select box options.\n $options = array();\n $options['9999'] = t('Select the time');\n $options['0000'] = t('Midnight - start of day');\n foreach ($hours as $hour) {\n $time = $hour['time'];\n $display = t($hour['display']);\n if ($time != '0000') {\n $options[$time] = $display;\n }\n }\n $options['2400'] = t('Midnight - end of day');\n \n $yyyy_mm = $selected_month;\n $month = intval(drupal_substr($yyyy_mm, 5));\n $year = drupal_substr($yyyy_mm, 0, 4);\n $month_display = date('F Y', mktime(0, 0, 0, $month, 1, $year));\n // Days in the month.\n $days = date('t', mktime(0, 0, 0, $month, 1, $year));\n if (!$mo_hours = unserialize(_room_reservations_get_variable('monthly_hours_' . $yyyy_mm))) {\n $mo_hours = _room_reservations_create_mo_hours($year, $month, $yyyy_mm, true);\n }\n // Form.\n $form['#tree'] = TRUE;\n $form['month_display'] = array(\n '#prefix' => '<b>',\n '#suffix' => '</b><br />',\n '#markup' => $month_display,\n '#weight' => -100,\n );\n $form['note'] = array(\n '#markup' => t('Asterisk (*) indicates that the hours have been changed from the default'),\n '#weight' => -99,\n );\n for ($day = 0; $day < $days; $day++) {\n // Day of week.\n $dow = date('l', mktime(0, 0, 0, $month, $day + 1, $year));\n $changed_hours = ($mo_hours[($day * 5)] == 'O') ? '*' : '';\n $day_hours = array();\n $day_hours[] = $mo_hours[($day * 5) + 1];\n $day_hours[] = $mo_hours[($day * 5) + 2];\n $day_hours[] = $mo_hours[($day * 5) + 3];\n $day_hours[] = $mo_hours[($day * 5) + 4];\n $display_hours = _room_reservations_hours_display($day_hours);\n $title = ($day + 1) . ' ' . $dow . ' (' . $display_hours . ') ' . $changed_hours;\n $form['day_' . $day] = array(\n '#type' => 'fieldset',\n '#title' => $title,\n '#collapsible' => TRUE,\n '#collapsed' => TRUE,\n '#weight' => -9 + ($day * 2),\n );\n $form['day_' . $day]['first_shift_open_' . $day] = array(\n '#title' => t('First shift open'),\n '#type' => 'select',\n '#options' => $options,\n '#default_value' => $mo_hours[($day * 5) + 1],\n //'#weight' => -9 + ($day * 2) + 1,\n );\n $form['day_' . $day]['first_shift_close_' . $day] = array(\n '#title' => t('First shift close'),\n '#type' => 'select',\n '#options' => $options,\n '#default_value' => $mo_hours[($day * 5) + 2],\n //'#weight' => -9 + ($day * 10) + 2,\n );\n $form['day_' . $day]['second_shift_open_' . $day] = array(\n '#title' => t('Second shift open'),\n '#type' => 'select',\n '#options' => $options,\n '#default_value' => $mo_hours[($day * 5) + 3],\n //'#weight' => -90 + ($day * 10) + 3,\n );\n $form['day_' . $day]['second_shift_close_' . $day] = array(\n '#title' => t('Second shift close'),\n '#type' => 'select',\n '#options' => $options,\n '#default_value' => $mo_hours[($day * 5) + 4],\n //'#weight' => -90 + ($day * 10) + 4,\n );\n }\n $form['save'] = array(\n '#type' => 'submit',\n '#value' => t('Save configuration'),\n '#weight' => 400,\n );\n $form['reset'] = array(\n '#type' => 'submit',\n '#value' => t('Reset to defaults'),\n '#weight' => 401,\n );\n $form['month'] = array(\n '#type' => 'value',\n '#value' => $month_value,\n );\n return $form;\n}",
"public function __construct() {\n $widget_options = array( 'classname' => 'clock_widget', 'description' => 'The Wordpress Clock Widget' );\n parent::__construct( 'clock_widget', 'Wordpress Clock Widget', $widget_options );\n }",
"public function __construct(){\n\t\tdate_default_timezone_set('Asia/Jakarta');\n\n\t\t$this->form = new Formly()->set_options(\n\t\t\tarray(\n\t\t\t\t'framework'=>$this->form_framework,\n\t\t\t\t'form_class'=>$this->form_class;\n\t\t\t)\n\t\t);\n\n\t}",
"protected function form()\n {\n $form = new Form(new EnterPlan);\n\n $form->date('enter_time', __('进线时间'))->default(date('Y-m-d'));\n $form->text('a1', __('1'));\n $form->text('a2', __('1A'));\n $form->text('a3', __('2'));\n $form->text('a4', __('2A'));\n $form->text('a5', __('3'));\n $form->text('a6', __('5'));\n $form->text('a7', __('10'));\n $form->text('a8', __('11'));\n $form->text('a9', __('11A'));\n $form->text('a10', __('12'));\n $form->text('a11', __('13'));\n $form->text('a12', __('15'));\n $form->text('a13', __('16'));\n $form->text('a14', __('16A'));\n $form->text('a15', __('17'));\n $form->text('a16', __('18'));\n $form->text('a17', __('19'));\n// $form->text('a18', __('A18'));\n// $form->text('a19', __('A19'));\n// $form->text('a20', __('A20'));\n// $form->text('a21', __('A21'));\n// $form->text('a22', __('A22'));\n// $form->text('a23', __('A23'));\n// $form->text('a24', __('A24'));\n// $form->text('a25', __('A25'));\n// $form->text('a26', __('A26'));\n// $form->text('a27', __('A27'));\n// $form->text('a28', __('A28'));\n// $form->text('a29', __('A29'));\n// $form->text('a30', __('A30'));\n\n return $form;\n }",
"function room_reservations_admin_settings_daily_hours_submit($form_id, &$form_state) {\n // Select month.\n if ($form_state['clicked_button']['#value'] == t('Select a month')) {\n $form_state['redirect']\n = 'admin/config/system/room_reservations/hours/daily_hours/' .\n $form_state['values']['month'];\n }\n // Process the daily hours for the selected month.\n elseif ($form_state['clicked_button']['#value'] == t('Save configuration')) {\n $confirmation = ROOM_RESERVATIONS_SAVE_CONFIRMATION_MSG;\n $error = ROOM_RESERVATIONS_SAVE_ERROR_MSG;\n $month_value = $form_state['values']['month'];\n $month = intval(drupal_substr($month_value, 5));\n $year = drupal_substr($month_value, 0, 4);\n // Days in the month.\n $days = date('t', mktime(0, 0, 0, $month, 1, $year));\n $mo_hours = unserialize(_room_reservations_get_variable('monthly_hours_' . $month_value));\n $updated_mo_hours = array();\n $default_hours = unserialize(_room_reservations_get_variable('default_hours'));\n for ($day = 0; $day < $days; $day++) {\n // User entered hours for a single day.\n $day_first_open = $form_state['values']['day_' . $day]['first_shift_open_' . $day];\n $day_first_close = $form_state['values']['day_' . $day]['first_shift_close_' . $day];\n $day_second_open = $form_state['values']['day_' . $day]['second_shift_open_' . $day];\n $day_second_close = $form_state['values']['day_' . $day]['second_shift_close_' . $day];\n // Default hours for the day of the week.\n // Day of week.\n $dow = date('w', mktime(0, 0, 0, $month, $day + 1, $year));\n $default_first_open = $default_hours[($dow * 4) + 0];\n $default_first_close = $default_hours[($dow * 4) + 1];\n $default_second_open = $default_hours[($dow * 4) + 2];\n $default_second_close = $default_hours[($dow * 4) + 3];\n // Compare user entered hours to default for the day of the week.\n if (($day_first_open == $default_first_open) && \n ($day_first_close == $default_first_close) && \n ($day_second_open == $default_second_open) && \n ($day_second_close == $default_second_close)) {\n $day_is_default = TRUE;\n }\n else {\n $day_is_default = FALSE;\n }\n // Update the monthly hours record.\n $updated_mo_hours[($day * 5)] = ($day_is_default) ? 'D' : 'O';\n $updated_mo_hours[($day * 5) + 1] = $day_first_open;\n $updated_mo_hours[($day * 5) + 2] = $day_first_close;\n $updated_mo_hours[($day * 5) + 3] = $day_second_open;\n $updated_mo_hours[($day * 5) + 4] = $day_second_close;\n }\n $result = _room_reservations_set_variable('monthly_hours_' . $month_value, serialize($updated_mo_hours));\n if ($result) {\n drupal_set_message(check_plain($confirmation));\n }\n else {\n drupal_set_message(check_plain($error), 'error');\n }\n }\n // Reset the month to the default hours.\n elseif ($form_state['clicked_button']['#value'] == t('Reset to defaults')) {\n $confirmation = ROOM_RESERVATIONS_RESET_CONFIRMATION_MSG;\n $error = ROOM_RESERVATIONS_RESET_ERROR_MSG;\n $month_value = $form_state['values']['month'];\n $month = intval(drupal_substr($month_value, 5));\n $year = drupal_substr($month_value, 0, 4);\n $result = _room_reservations_create_mo_hours($year, $month, $month_value);\n if ($result) {\n drupal_set_message(check_plain($confirmation));\n }\n else {\n drupal_set_message(check_plain($error), 'error');\n }\n }\n}",
"protected function specific_definition($mform) {\n $mform->addElement('header', 'configheader', get_string('blocksettings', 'block'));\n \n /**\n * Options for how long back is the log viewed \n */\n $timeoptions = array(\n 'oneDay' => get_string('oneDay', 'block_heatmap'),\n 'twoDays' => get_string('twoDays', 'block_heatmap'),\n 'oneWeek' => get_string('oneWeek', 'block_heatmap'),\n 'twoWeeks' => get_string('twoWeeks', 'block_heatmap'),\n 'month' => get_string('month', 'block_heatmap'),\n 'sincestart' => get_string('sincestart', 'block_heatmap'),\n 'sinceforever' => get_string('sinceforever', 'block_heatmap'),\n );\n \n $timelabel = get_string('checkforactivity', 'block_heatmap');\n $mform->addElement('select','config_from',$timelabel,$timeoptions);\n $mform->setDefault('config_from','sincestart');\n $mform->addHelpButton('config_from','checkforactivity','block_heatmap');\n }",
"public function action_index()\n\t{\n\t\t$type = 'week';\n\n\t\t$settings = array\n\t\t(\n\t\t\t'_label' => 'Week 1',\n\t\t\t'_namespace' => 'mmi',\n\t\t\t'class' => 'week',\n\t\t\t'id' => 'week1',\n\t\t\t'required' => 'required',\n\t\t\t'step' => 3,\n\t\t\t'value' => '1970-W01'\n\t\t);\n\t\t$field = MMI_Form_Field::factory($type, $settings);\n\t\t$this->_form->add_field($field);\n\t\tif ($this->debug)\n\t\t{\n\t\t\tMMI_Debug::dump($field->render(), $type.' (step 3)');\n\t\t}\n\n\t\t$settings = array_merge($settings, array\n\t\t(\n\t\t\t'_after' => '2010-W10',\n\t\t\t'_before' => '2010-W01',\n\t\t\t'_label' => 'Week 2',\n\t\t\t'id' => 'week2',\n\t\t\t'max' => '2010-W10',\n\t\t\t'min' => '2010-W01',\n\t\t\t'required' => FALSE,\n\t\t\t'step' => 1,\n\t\t\t'value' => '',\n\t\t));\n\t\t$field = MMI_Form_Field::factory($type, $settings);\n\t\t$this->_form->add_field($field);\n\t\tif ($this->debug)\n\t\t{\n\t\t\tMMI_Debug::dump($field->render(), $type.' (min 2010-W01; max 2010-W10; step 1)');\n\t\t}\n\n\t\t$settings = array_merge($settings, array\n\t\t(\n\t\t\t'_before' => '2010-W10',\n\t\t\t'_label' => 'Week 3',\n\t\t\t'id' => 'week3',\n\t\t\t'min' => '2010-W10',\n\t\t\t'step' => 2,\n\t\t));\n\t\tunset($settings['_after'], $settings['max']);\n\t\t$field = MMI_Form_Field::factory($type, $settings);\n\t\t$this->_form->add_field($field);\n\t\tif ($this->debug)\n\t\t{\n\t\t\tMMI_Debug::dump($field->render(), $type.' (min 2010-W10; step 2)');\n\t\t}\n\n\t\t$settings = array_merge($settings, array\n\t\t(\n\t\t\t'_after' => '2010-W30',\n\t\t\t'_label' => 'Week 4',\n\t\t\t'id' => 'week4',\n\t\t\t'max' => '2010-W30',\n\t\t\t'step' => 4,\n\t\t));\n\t\tunset($settings['_before'], $settings['min']);\n\t\t$field = MMI_Form_Field::factory($type, $settings);\n\t\t$this->_form->add_field($field);\n\t\tif ($this->debug)\n\t\t{\n\t\t\tMMI_Debug::dump($field->render(), $type.' (max 2010-W30; step 4)');\n\t\t}\n\t}"
] |
[
"0.6490638",
"0.6389133",
"0.597846",
"0.5953865",
"0.5929955",
"0.5833619",
"0.57881266",
"0.5699809",
"0.5659637",
"0.56084996",
"0.56003153",
"0.55942404",
"0.55861115",
"0.55388474",
"0.5525449",
"0.5473185",
"0.5463413",
"0.5451339",
"0.54437244",
"0.5385783",
"0.53617287",
"0.53412485",
"0.53020096",
"0.52776384",
"0.5262353",
"0.52535844",
"0.52528626",
"0.52400607",
"0.5194018",
"0.5180929"
] |
0.677685
|
0
|
Form validation for the Hours / Default Hours configuration page.
|
function room_reservations_admin_settings_default_hours_validate($form_id, &$form_state) {
$days = array(
t('Sunday'),
t('Monday'),
t('Tuesday'),
t('Wednesday'),
t('Thursday'),
t('Friday'),
t('Saturday'),
);
if ($form_state['clicked_button']['#value'] == t('Save configuration')) {
for ($day = 0; $day < 7; $day++) {
$open = TRUE;
$second_shift = FALSE;
$first_shift_open
= $form_state['values']['day_' . $day]['first_shift_open_' . $day];
$first_shift_close
= $form_state['values']['day_' . $day]['first_shift_close_' . $day];
$second_shift_open
= $form_state['values']['day_' . $day]['second_shift_open_' . $day];
$second_shift_close
= $form_state['values']['day_' . $day]['second_shift_close_' . $day];
$int_first_shift_open
= intval(
$form_state['values']['day_' . $day]['first_shift_open_' . $day]);
$int_first_shift_close
= intval(
$form_state['values']['day_' . $day]['first_shift_close_' . $day]);
$int_second_shift_open
= intval(
$form_state['values']['day_' . $day]['second_shift_open_' . $day]);
$int_second_shift_close
= intval(
$form_state['values']['day_' . $day]['second_shift_close_' . $day]);
// Closed.
if (($int_first_shift_open == 9999) &&
($int_first_shift_close == 9999) &&
($int_second_shift_open == 9999) &&
($int_second_shift_close == 9999)) {
$open = FALSE;
}
// First shift.
if ($open) {
if ($int_first_shift_open == 9999) {
$field = 'day_' . $day . '][first_shift_open_' . $day;
$message = t('!day - First shift open is required.',
array('!day' => $days[$day]));
form_set_error($field, check_plain($message));
}
elseif ($int_first_shift_close == 9999) {
$field = 'day_' . $day . '][first_shift_close_' . $day;
$message = t('!day - First shift close is required.',
array('!day' => $days[$day]));
form_set_error($field, check_plain($message));
}
elseif ($int_first_shift_open >= $int_first_shift_close) {
$field = 'day_' . $day . '][first_shift_close_' . $day;
$message = t('!day - First shift close must be later than first shift
open.', array('!day' => $days[$day]));
form_set_error($field, check_plain($message));
}
}
// Second shift.
if ($open) {
if (($int_second_shift_open != 9999) ||
($int_second_shift_close != 9999)) {
$second_shift = TRUE;
}
}
if ($second_shift) {
if (($int_first_shift_open == 9999) &&
($int_first_shift_close == 9999)) {
$field = 'day_' . $day . '][second_shift_open_' . $day;
$message = t('!day - Cannot have a second shift without a first
shift.', array('!day' => $days[$day]));
form_set_error($field, check_plain($message));
}
elseif ($int_second_shift_open == 9999) {
$field = 'day_' . $day . '][second_shift_open_' . $day;
$message = t('!day - Second shift open is missing.',
array('!day' => $days[$day]));
form_set_error($field, check_plain($message));
}
elseif ($int_second_shift_close == 9999) {
$field = 'day_' . $day . '][second_shift_close_' . $day;
$message = t('!day - Second shift close is missing.',
array('!day' => $days[$day]));
form_set_error($field, check_plain($message));
}
elseif ($int_second_shift_open <= $int_first_shift_close) {
$field = 'day_' . $day . '][second_shift_open_' . $day;
$message = t('!day - Second shift open must be later than first
shift close.', array('!day' => $days[$day]));
form_set_error($field, check_plain($message));
}
elseif ($int_second_shift_open >= $int_second_shift_close) {
$field = 'day_' . $day . '][second_shift_close_' . $day;
$message = t('!day - Second shift close must be later than second
shift opten.', array('!day' => $days[$day]));
form_set_error($field, check_plain($message));
}
}
}
}
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function room_reservations_admin_settings_daily_hours_validate($form_id, &$form_state) {\n if ($form_state['clicked_button']['#value'] == t('Save configuration')) {\n $month_value = $form_state['values']['month'];\n $month = intval(drupal_substr($month_value, 5));\n $year = drupal_substr($month_value, 0, 4);\n // Days in the month.\n $days = date('t', mktime(0, 0, 0, $month, 1, $year));\n for ($day = 0; $day < $days; $day++) {\n // Day of the week.\n $dow = date('l', mktime(0, 0, 0, $month, $day + 1, $year));\n // Day of month.\n $dom = $day + 1;\n $open = TRUE;\n $second_shift = FALSE;\n $first_shift_open\n = $form_state['values']['day_' . $day]['first_shift_open_' . $day];\n $first_shift_close\n = $form_state['values']['day_' . $day]['first_shift_close_' . $day];\n $second_shift_open\n = $form_state['values']['day_' . $day]['second_shift_open_' . $day];\n $second_shift_close\n = $form_state['values']['day_' . $day]['second_shift_close_' . $day];\n $int_first_shift_open\n = intval(\n $form_state['values']['day_' . $day]['first_shift_open_' . $day]);\n $int_first_shift_close\n = intval(\n $form_state['values']['day_' . $day]['first_shift_close_' . $day]);\n $int_second_shift_open\n = intval(\n $form_state['values']['day_' . $day]['second_shift_open_' . $day]);\n $int_second_shift_close\n = intval(\n $form_state['values']['day_' . $day]['second_shift_close_' . $day]);\n // Closed.\n if (($int_first_shift_open == 9999) && \n ($int_first_shift_close == 9999) && \n ($int_second_shift_open == 9999) && \n ($int_second_shift_close == 9999)) {\n $open = FALSE;\n }\n // First shift.\n if ($open) {\n if ($int_first_shift_open == 9999) {\n $field = 'day_' . $day . '][first_shift_open_' . $day;\n $message = t('!day - First shift open is required.', \n array('!day' => $dom . ' ' . $dow));\n form_set_error($field, check_plain($message));\n }\n elseif ($int_first_shift_close == 9999) {\n $field = 'day_' . $day . '][first_shift_close_' . $day;\n $message = t('!day - First shift close is required.', \n array('!day' => $dom . ' ' . $dow));\n form_set_error($field, check_plain($message));\n }\n elseif ($int_first_shift_open >= $int_first_shift_close) {\n $field = 'day_' . $day . '][first_shift_close_' . $day;\n $message = t('!day - First shift close must be later than first shift\n open.', array('!day' => $dom . ' ' . $dow));\n form_set_error($field, check_plain($message));\n }\n }\n // Second shift.\n if ($open) {\n if (($int_second_shift_open != 9999) || \n ($int_second_shift_close != 9999)) {\n $second_shift = TRUE;\n }\n }\n if ($second_shift) {\n if (($int_first_shift_open == 9999) && \n ($int_first_shift_close == 9999)) {\n $field = 'day_' . $day . '][second_shift_open_' . $day;\n $message = t('!day - Cannot have a second shift without a first\n shift.', array('!day' => $dom . ' ' . $dow));\n form_set_error($field, check_plain($message));\n }\n elseif ($int_second_shift_open == 9999) {\n $field = 'day_' . $day . '][second_shift_open_' . $day;\n $message = t('!day - Second shift open is missing.', \n array('!day' => $dom . ' ' . $dow));\n form_set_error($field, check_plain($message));\n }\n elseif ($int_second_shift_close == 9999) {\n $field = 'day_' . $day . '][second_shift_close_' . $day;\n $message = t('!day - Second shift close is missing.', \n array('!day' => $dom . ' ' . $dow));\n form_set_error($field, check_plain($message));\n }\n elseif ($int_second_shift_open <= $int_first_shift_close) {\n $field = 'day_' . $day . '][second_shift_open_' . $day;\n $message = t('!day - Second shift open must be later than first\n shift close.', array('!day' => $dom . ' ' . $dow));\n form_set_error($field, check_plain($message));\n }\n elseif ($int_second_shift_open >= $int_second_shift_close) {\n $field = 'day_' . $day . '][second_shift_close_' . $day;\n $message = t('!day - Second shift close must be later than second\n shift opten.', array('!day' => $dom . ' ' . $dow));\n form_set_error($field, check_plain($message));\n }\n }\n }\n }\n}",
"function room_reservations_admin_settings_default_hours($form, &$form_state) {\n $hours = _room_reservations_hours();\n // Select box options.\n $options = array();\n $options['9999'] = t('Select the time');\n $options['0000'] = t('Midnight - start of day');\n foreach ($hours as $hour) {\n $time = $hour['time'];\n $display = t($hour['display']);\n if ($time != '0000') {\n $options[$time] = $display;\n }\n }\n $options['2400'] = t('Midnight - end of day');\n // Get saved default hours.\n $default_hours\n = unserialize(_room_reservations_get_variable('default_hours'));\n if (!$default_hours) {\n for ($x = 0; $x < 28; $x++) {\n $default_hours[$x] = '9999';\n }\n }\n $days = array(\n t('Sunday'),\n t('Monday'),\n t('Tuesday'),\n t('Wednesday'),\n t('Thursday'),\n t('Friday'),\n t('Saturday'),\n );\n $form['#tree'] = TRUE;\n for ($day = 0; $day < 7; $day++) {\n $day_hours = array();\n $day_hours[] = $default_hours[($day * 4)];\n $day_hours[] = $default_hours[($day * 4) + 1];\n $day_hours[] = $default_hours[($day * 4) + 2];\n $day_hours[] = $default_hours[($day * 4) + 3];\n $display_hours = _room_reservations_hours_display($day_hours);\n $form['day_' . $day] = array(\n '#type' => 'fieldset',\n '#title' => $days[$day] . ' (' . $display_hours . ')',\n '#collapsible' => TRUE,\n '#collapsed' => TRUE,\n '#weight' => -90 + ($day * 10),\n );\n $form['day_' . $day]['first_shift_open_' . $day] = array(\n '#title' => t('First shift open'),\n '#type' => 'select',\n '#options' => $options,\n '#default_value' => $default_hours[($day * 4)],\n '#weight' => -90 + ($day * 10) + 1,\n );\n $form['day_' . $day]['first_shift_close_' . $day] = array(\n '#title' => t('First shift close'),\n '#type' => 'select',\n '#options' => $options,\n '#default_value' => $default_hours[($day * 4) + 1],\n '#weight' => -90 + ($day * 10) + 2,\n );\n $form['day_' . $day]['second_shift_open_' . $day] = array(\n '#title' => t('Second shift open'),\n '#type' => 'select',\n '#options' => $options,\n '#default_value' => $default_hours[($day * 4) + 2],\n '#weight' => -90 + ($day * 10) + 3,\n );\n $form['day_' . $day]['second_shift_close_' . $day] = array(\n '#title' => t('Second shift close'),\n '#type' => 'select',\n '#options' => $options,\n '#default_value' => $default_hours[($day * 4) + 3],\n '#weight' => -90 + ($day * 10) + 4,\n );\n }\n $form['save'] = array(\n '#type' => 'submit',\n '#value' => t('Save configuration'),\n '#weight' => 100,\n );\n $form['reset'] = array(\n '#type' => 'submit',\n '#value' => t('Reset to defaults'),\n '#weight' => 101,\n );\n return $form;\n}",
"public function rules() {\n\t\treturn [\n\t\t\t'date' => 'required|date',\n\t\t\t'startHour' => 'required|date_format:H:i',\n\t\t\t'endHour' => 'required|date_format:H:i',\n 'max_participants' => 'required|integer|min:0',\n ];\n\t}",
"public function hoursForm($result)\n {\n if ( !$this->ownerLoggedIn() )\n {\n $this->restricted();\n return;\n }\n\n require_once('views/HoursView.class.php'); \n require_once('views/FormError.class.php');\n \n $site = new SiteContainer($this->db);\n $message = new FormError();\n \n $hv = new HoursView();\n\n $site->printHeader();\n $site->printNav(\"owner\");\n \n if ($result == \"bad_time\")\n $message->printHtml(array(\"bad_time\"));\n \n $hv->printHtml($result);\n $site->printFooter(); \n }",
"function validHours($hours)\n {\n return $hours >= 1 && $hours <= 4;\n }",
"function room_reservations_admin_settings_default_hours_submit($form_id, &$form_state) {\n $default_hours = array();\n if ($form_state['clicked_button']['#value'] == t('Save configuration')) {\n for ($day = 0; $day < 7; $day++) {\n $default_hours[] = $form_state['values']['day_' . $day]['first_shift_open_' . $day];\n $default_hours[] = $form_state['values']['day_' . $day]['first_shift_close_' . $day];\n $default_hours[] = $form_state['values']['day_' . $day]['second_shift_open_' . $day];\n $default_hours[] = $form_state['values']['day_' . $day]['second_shift_close_' . $day];\n }\n $confirmation = ROOM_RESERVATIONS_SAVE_CONFIRMATION_MSG;\n $error = ROOM_RESERVATIONS_SAVE_ERROR_MSG;\n }\n if ($form_state['clicked_button']['#value'] == t('Reset to defaults')) {\n for ($day = 0; $day < 7; $day++) {\n $default_hours[] = '9999';\n $default_hours[] = '9999';\n $default_hours[] = '9999';\n $default_hours[] = '9999';\n }\n $confirmation = ROOM_RESERVATIONS_RESET_CONFIRMATION_MSG;\n $error = ROOM_RESERVATIONS_RESET_ERROR_MSG;\n }\n $errors = FALSE;\n $result = _room_reservations_set_variable('default_hours', serialize($default_hours));\n if (!$result) {\n $errors = TRUE;\n }\n else {\n\n }\n // Update monthly hours records.\n $sql = \"SELECT * FROM {room_reservations_variables} WHERE name LIKE 'monthly_hours_%'\";\n $results = db_query($sql);\n foreach ($results as $data){\n $name = $data->name;\n $month = intval(drupal_substr($name, 19));\n $year = drupal_substr($name, 14, 4);\n $mo_hours = unserialize($data->value);\n // Days in the month.\n $days = date('t', mktime(0, 0, 0, $month, 1, (int) $year));\n $upd_mo_hours = array();\n for ($day = 0; $day < $days; $day++) {\n $default_ind = $mo_hours[($day * 5)];\n if ($default_ind == 'D') {\n // Update monthly hours with default day of week hours.\n // Day of the week.\n $dow = date('w', mktime(0, 0, 0, $month, $day + 1, (int) $year));\n $upd_mo_hours[($day * 5)] = 'D';\n $upd_mo_hours[($day * 5) + 1] = $default_hours[($dow * 4)];\n $upd_mo_hours[($day * 5) + 2] = $default_hours[($dow * 4) + 1];\n $upd_mo_hours[($day * 5) + 3] = $default_hours[($dow * 4) + 2];\n $upd_mo_hours[($day * 5) + 4] = $default_hours[($dow * 4) + 3];\n }\n elseif ($default_ind == 'O') {\n // Leave monthly hours unchanged.\n $upd_mo_hours[($day * 5)] = 'O';\n $upd_mo_hours[($day * 5) + 1] = $mo_hours[($day * 5) + 1];\n $upd_mo_hours[($day * 5) + 2] = $mo_hours[($day * 5) + 2];\n $upd_mo_hours[($day * 5) + 3] = $mo_hours[($day * 5) + 3];\n $upd_mo_hours[($day * 5) + 4] = $mo_hours[($day * 5) + 4];\n }\n }\n $result2 = _room_reservations_set_variable($name, \n serialize($upd_mo_hours));\n if (!$result2) {\n $errors = TRUE;\n }\n }\n if ($errors) {\n drupal_set_message(check_plain($error), 'error');\n }\n else {\n drupal_set_message(check_plain($confirmation));\n }\n}",
"function validate_date_time_picker_field($field)\n {\n }",
"function room_reservations_admin_settings_daily_hours_submit($form_id, &$form_state) {\n // Select month.\n if ($form_state['clicked_button']['#value'] == t('Select a month')) {\n $form_state['redirect']\n = 'admin/config/system/room_reservations/hours/daily_hours/' .\n $form_state['values']['month'];\n }\n // Process the daily hours for the selected month.\n elseif ($form_state['clicked_button']['#value'] == t('Save configuration')) {\n $confirmation = ROOM_RESERVATIONS_SAVE_CONFIRMATION_MSG;\n $error = ROOM_RESERVATIONS_SAVE_ERROR_MSG;\n $month_value = $form_state['values']['month'];\n $month = intval(drupal_substr($month_value, 5));\n $year = drupal_substr($month_value, 0, 4);\n // Days in the month.\n $days = date('t', mktime(0, 0, 0, $month, 1, $year));\n $mo_hours = unserialize(_room_reservations_get_variable('monthly_hours_' . $month_value));\n $updated_mo_hours = array();\n $default_hours = unserialize(_room_reservations_get_variable('default_hours'));\n for ($day = 0; $day < $days; $day++) {\n // User entered hours for a single day.\n $day_first_open = $form_state['values']['day_' . $day]['first_shift_open_' . $day];\n $day_first_close = $form_state['values']['day_' . $day]['first_shift_close_' . $day];\n $day_second_open = $form_state['values']['day_' . $day]['second_shift_open_' . $day];\n $day_second_close = $form_state['values']['day_' . $day]['second_shift_close_' . $day];\n // Default hours for the day of the week.\n // Day of week.\n $dow = date('w', mktime(0, 0, 0, $month, $day + 1, $year));\n $default_first_open = $default_hours[($dow * 4) + 0];\n $default_first_close = $default_hours[($dow * 4) + 1];\n $default_second_open = $default_hours[($dow * 4) + 2];\n $default_second_close = $default_hours[($dow * 4) + 3];\n // Compare user entered hours to default for the day of the week.\n if (($day_first_open == $default_first_open) && \n ($day_first_close == $default_first_close) && \n ($day_second_open == $default_second_open) && \n ($day_second_close == $default_second_close)) {\n $day_is_default = TRUE;\n }\n else {\n $day_is_default = FALSE;\n }\n // Update the monthly hours record.\n $updated_mo_hours[($day * 5)] = ($day_is_default) ? 'D' : 'O';\n $updated_mo_hours[($day * 5) + 1] = $day_first_open;\n $updated_mo_hours[($day * 5) + 2] = $day_first_close;\n $updated_mo_hours[($day * 5) + 3] = $day_second_open;\n $updated_mo_hours[($day * 5) + 4] = $day_second_close;\n }\n $result = _room_reservations_set_variable('monthly_hours_' . $month_value, serialize($updated_mo_hours));\n if ($result) {\n drupal_set_message(check_plain($confirmation));\n }\n else {\n drupal_set_message(check_plain($error), 'error');\n }\n }\n // Reset the month to the default hours.\n elseif ($form_state['clicked_button']['#value'] == t('Reset to defaults')) {\n $confirmation = ROOM_RESERVATIONS_RESET_CONFIRMATION_MSG;\n $error = ROOM_RESERVATIONS_RESET_ERROR_MSG;\n $month_value = $form_state['values']['month'];\n $month = intval(drupal_substr($month_value, 5));\n $year = drupal_substr($month_value, 0, 4);\n $result = _room_reservations_create_mo_hours($year, $month, $month_value);\n if ($result) {\n drupal_set_message(check_plain($confirmation));\n }\n else {\n drupal_set_message(check_plain($error), 'error');\n }\n }\n}",
"function room_reservations_admin_settings_reminders_validate($form_id, &$form_state) {\n if ($form_state['clicked_button']['#value'] == t('Save configuration')) {\n $reminder_time = $form_state['values']['reminder_time'];\n $reminder_cutoff = $form_state['values']['reminder_cutoff'];\n if ($reminder_time < $reminder_cutoff) {\n $field = 'reminder_time';\n $message = t(\"'Send reminder daily at' time cannot be earlier than 'Send reminders for reservations created before' time.\");\n form_set_error($field, check_plain($message));\n }\n }\n}",
"function room_reservations_admin_settings_validate($form_id, &$form_state) {\n if ($form_state['clicked_button']['#value'] == t('Save configuration')) {\n // Open reservations per user.\n $data = $form_state['values']['room_reservations_reservations_per_user'];\n if (!ctype_digit($data)) {\n $field = 'room_reservations_reservations_per_user';\n $message = t('Open reservations per user must be numeric.');\n form_set_error($field, check_plain($message));\n }\n // Reservations per day.\n $data = $form_state['values']['room_reservations_reservations_per_day'];\n if (!ctype_digit($data)) {\n $field = 'room_reservations_reservations_per_day';\n $message = t('Reservations per day must be numeric.');\n form_set_error($field, check_plain($message));\n }\n }\n}",
"public function rules()\n {\n return [\n //\n 'plate' => ['required','string','size:8', new Plate],\n 'date' => ['required','string','min:9','max:10', new Date],\n 'hour' => ['required','string','max:5', 'regex:/^([01]?[0-9]|2[0-3]):[0-5][0-9]$/']\n ];\n }",
"protected function validateTime($value) {\n if (preg_match(\"/^([0-9]{2}\\:){1,2}[0-9]{2}$/\", $value)) \n return true;\n $this->setError(t(\"Invalid time (HH:MM or HH:MM:SS)\"));\n return false;\n }",
"public function generate_hours() {\n\n\t\t\t$schema = get_theme_mod( 'schema' );\n\n\t\t\t$hours = isset( $schema['openingHoursSpecification'] ) ? $schema['openingHoursSpecification'] : false;\n\n\t\t\tif ( !$hours ) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\t\n\t\t\t$DAYS = array( 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday' );\n\t\t\t\n\t\t\tforeach( $DAYS as $day ) {\n\t\t\t\tforeach( $hours as $period ) {\n\t\t\t\t\tif ( in_array( $day, $period['dayOfWeek'] ) ) {\n\t\t\t\t\t\tif ( '00:00' === $period['opens'] ) {\n\t\t\t\t\t\t\tif ( '00:00' === $period['closes'] ) {\n\t\t\t\t\t\t\t\t$return[$day][0] = 'Closed';\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif ( '23:59' === $period['closes'] ) {\n\t\t\t\t\t\t\t\t$return[$day][0] = 'Open 24 hours';\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t$return[$day][0] = $period['opens'];\n\t\t\t\t\t\t$return[$day][1] = $period['closes'];\n\t\t\t\t\t}\n\t\t\t\t}\t\t\t\t\n\t\t\t}\n\n\t\t\treturn $return;\n\t\t}",
"private function setHoursField(){\n \n $hoursnode = $this->getHoursNode();\n \n $hoursfield = $hoursnode->field_hours_paragraph->view(array('type' => 'full', 'label' => 'hidden')); \n \n if(in_array('show_today', $this->getOptions())){\n $hoursfield['#prefix'] = '<div class=\"field today-only\">';\n $hoursfield['#suffix'] = '</div>';\n }\n \n $this->hoursfield = $hoursfield;\n }",
"public function hours() {\n //TODO prediction\n }",
"private function getHoursField(){\n \n if(!$this->hoursfield)\n $this->setHoursField();\n \n return $this->hoursfield;\n }",
"public function rules()\n\t{\n\t\t$rules = [\n\t\t\t'date'\t\t=> 'required|date|date_format:\"d.m.Y\"',\n\t\t\t'hour'\t\t=> 'required|numeric|min:8|max:20',\n\t\t\t'minute'\t=> 'required|numeric|min:0|max:60'\n\t\t];\n\n\t\t$event_id = $this->route()->parameter('event_id');\n\t\t$eventRepo = \\App::make('App\\Models\\Event\\EventRepository');\n\n\t\t$event = $eventRepo->findById($event_id);\n\n\t\t// if date is not between start and end date\n\t\tif (! (strtotime($event->start_date) <= strtotime(\\Input::get('date')) && strtotime(\\Input::get('date')) <= strtotime($event->end_date) )){\n\t\t\t$rules['valid_date'] = 'required';\n\t\t}\n\n\t\treturn $rules;\n\t}",
"function _erpal_projects_helper_timetracking_add_time_validation(&$form, $form_state){\n // prepend field_timetracking_duration element validation\n array_unshift($form['field_timetracking_duration'][LANGUAGE_NONE][0]['value']['#element_validate'], '_erpal_projects_helper_time_field_validate');\n // prepend field_billing_duration element validation \n array_unshift($form['field_billing_duration'][LANGUAGE_NONE][0]['value']['#element_validate'], '_erpal_projects_helper_time_field_validate'); \n}",
"public function rules()\n {\n\n //This is a DIY sort of way to make sure that total weekly hours worked is not above 48h\n $total = request()->monday + request()->tuesday + request()->wednesday + request()->thursday + request()->friday + request()->saturday;\n\n if($total > 48) {\n return [\n 'monday' => 'max:-1',\n ];\n }\n\n return [\n 'monday' => 'required|numeric|between:0,12',\n 'tuesday' => 'required|numeric|between:0,12',\n 'wednesday' => 'required|numeric|between:0,12',\n 'thursday' => 'required|numeric|between:0,12',\n 'friday' => 'required|numeric|between:0,12',\n 'saturday' => 'required|numeric|between:0,12',\n ];\n }",
"function form_time_options($variable='date', $number='', $type='hours') {\n\n\t$types = array('minutes', 'hours', 'days', 'weeks', 'months', 'years');\n\treturn form_input($variable . '[number]', $number, 4, '', '', 'id=\"' . $variable . '_number\"') . \" \" . form_select($variable . '[datetype]', $types, '', $type, 1, '', '', '', '', $variable . '_datetype');\n\n}",
"function entry_api_ui_event_form_validate($form, &$form_state) {\n\n $values = $form_state['values'];\n\n // Validate publication date.\n if ($values['publication_date']) {\n try {\n CultureFeed_Cdb_Data_Calendar::validateDate($values['publication_date']);\n }\n catch (Exception $e) {\n form_set_error('publication_date', 'Gelieve een geldige publicatie datum in te geven');\n }\n }\n\n // Validate age.\n if ($values['age'] && !is_numeric($values['age'])) {\n form_set_error('age', 'Gelieve een geldige leeftijd in te voeren');\n }\n\n // Validate timestamps.\n if ($values['when'] == 'one_day' || $values['when'] == 'multiple_days') {\n\n // Only one timestamp saved for one day.\n if ($values['when'] == 'one_day') {\n $form_state['values']['timestamps'] = array($values['timestamps'][0]);\n $values['timestamps'] = $form_state['values']['timestamps'];\n }\n\n foreach ($values['timestamps'] as $key => $timestamp) {\n try {\n\n // Empty start dates are ignored.\n if (empty($timestamp['start_date'])) {\n continue;\n }\n\n CultureFeed_Cdb_Data_Calendar::validateDate($timestamp['start_date']);\n\n if (!empty($timestamp['end_time'])) {\n CultureFeed_Cdb_Data_Calendar::validateTime($timestamp['end_time']);\n }\n if (!empty($timestamp['start_time'])) {\n CultureFeed_Cdb_Data_Calendar::validateTime($timestamp['start_time']);\n }\n }\n catch (UnexpectedValueException $e) {\n form_set_error('timestamps][' . $key, 'Gelieve een geldige tijd en datum in te geven.');\n }\n }\n }\n\n if ($values['when'] == 'period' || $values['when'] == 'permanent') {\n\n // Validate the weekscheme.\n if (!$values['period_or_permanent']['all_day']) {\n foreach ($values['period_or_permanent']['opening_times'] as $day => $opening_times) {\n foreach ($opening_times as $key => $opening_time) {\n\n if (!empty($opening_time['open_from']) || !empty($opening_time['open_till'])) {\n try {\n CultureFeed_Cdb_Data_Calendar::validateTime($opening_time['open_from']);\n CultureFeed_Cdb_Data_Calendar::validateTime($opening_time['open_till']);\n }\n catch (Exception $e) {\n form_set_error('period_or_permanent][opening_times][' . $day . '][' . $key, 'Gelieve een geldige tijd in te geven.');\n }\n }\n\n }\n }\n }\n\n }\n\n // Validate location.\n if (!empty($values['location'])) {\n\n $location_label = $search_string = $values['location'];\n if (preg_match(\"|-|\", $location_label)) {\n list($search_string, $zip) = explode(\"-\", $location_label);\n }\n\n // Perform a search on location to check if this is an existing actor.\n try {\n $location = culturefeed_search_item_load_by_title($search_string, 'actor');\n if (!$location) {\n form_set_error('location', 'Gelieve een correcte locatie in te voeren.');\n }\n }\n catch (Exception $e) {\n form_set_error('location', 'Er was een fout bij het valideren van de locatie');\n }\n }\n\n // Validate organiser.\n if (!empty($values['organiser'])) {\n\n $organiser_label = $search_string = $values['organiser'];\n if (preg_match(\"|-|\", $organiser_label)) {\n list($search_string, $zip) = explode(\"-\", $organiser_label);\n }\n\n try {\n $organiser = culturefeed_search_item_load_by_title($search_string, 'actor');\n if (!$organiser) {\n form_set_error('organiser', 'Gelieve een correcte organisatie in te voeren.');\n }\n }\n catch (Exception $e) {\n watchdog_exception('entry_api_ui', $e);\n form_set_error('organiser', 'Er was een fout bij het valideren van de organisator');\n }\n\n }\n\n $errors = form_get_errors();\n if (empty($errors)) {\n _entryapi_ui_event_form_save_event($form, $form_state, $location, $organiser);\n }\n\n}",
"public function form( $instance ) {\n $title = ! empty( $instance['title'] ) ? $instance['title'] : '';\n $seperator =!empty( $instance['seperator']) ? $instance['seperator'] : '';\n $hour = !empty( $instance['hour']) ? $instance['hour'] : '';\n $amorpm = !empty( $instance['amorpm'] ) ? $instance['amorpm'] : '';?>\n <p>\n <label for=\"<?php echo $this->get_field_id( 'title' ); ?>\">Title:</label>\n <input type=\"text\" id=\"<?php echo $this->get_field_id( 'title' ); ?>\" name=\"<?php echo $this->get_field_name( 'title' ); ?>\" value=\"<?php echo esc_attr( $title ); ?>\" />\n </p>\n <p>\n <label for=\"<?php echo $this->get_field_id( 'seperator' ); ?>\">Seperator:</label>\n <input type=\"text\" id=\"<?php echo $this->get_field_id( 'seperator' ); ?>\" name=\"<?php echo $this->get_field_name( 'seperator' ); ?>\" value=\"<?php echo esc_attr( $seperator ); ?>\" />\n </p>\n <p><label for=\"<?php echo $this->get_field_id('hour'); ?>\">\n <?php _e('12 hour format:'); ?>\n <input id=\"<?php echo $this->get_field_id('h'); ?>\" name=\"<?php echo $this->get_field_name('hour'); ?>\" type=\"radio\" value=\"h\" <?php if($hour === 'h'){ echo 'checked=\"checked\"'; } ?> />\n </label><br>\n <label for=\"<?php echo $this->get_field_id('hour'); ?>\">\n <?php _e('24 hour format:'); ?>\n <input id=\"<?php echo $this->get_field_id('H'); ?>\" name=\"<?php echo $this->get_field_name('hour'); ?>\" type=\"radio\" value=\"H\" <?php if($hour === 'H'){ echo 'checked=\"checked\"'; } ?> />\n </label></p>\n <p><label for=\"<?php echo $this->get_field_id('amorpm'); ?>\">\n <?php _e('Small letters meridiam:'); ?>\n <input id=\"<?php echo $this->get_field_id('a'); ?>\" name=\"<?php echo $this->get_field_name('amorpm'); ?>\" type=\"radio\" value=\"a\" <?php if($amorpm === 'a'){ echo 'checked=\"checked\"'; } ?> />\n </label><br>\n <label for=\"<?php echo $this->get_field_id('amorpm'); ?>\">\n <?php _e('Capital Meridiam:'); ?>\n <input id=\"<?php echo $this->get_field_id('A'); ?>\" name=\"<?php echo $this->get_field_name('amorpm'); ?>\" type=\"radio\" value=\"A\" <?php if($amorpm === 'A'){ echo 'checked=\"checked\"'; } ?> />\n </label></p> <?php\n }",
"function options_validate($form, &$form_state) {\r\n parent::options_validate($form, $form_state);\r\n \r\n if ($form_state['values']['form_id'] == 'views_ui_config_item_form') {\r\n $check_fields = array_filter($form_state['values']['options']['date_fields']);\r\n if (empty($check_fields)) {\r\n form_error($form['date_fields'], t('You must select at least one date field for this argument.'));\r\n }\r\n if (!preg_match('@\\-[0-9]*:[\\+|\\-][0-9]*@', $form_state['values']['options']['year_range']) \r\n && !preg_match('@[0-9]{4}:[0-9]{4}@', $form_state['values']['options']['year_range'])) {\r\n form_error($form['year_range'], t('Date year range must be in the format -9:+9 or 2005:2010.'));\r\n }\r\n }\r\n }",
"private function checkTimeValidity()\n {\n $inThirtyMinutes = Carbon::createFromFormat('H:i:s', Carbon::now()->toTimeString())->addMinutes(30);\n $pickup_time = Carbon::createFromFormat('H:i', request('pickup_time'));\n $minTime = Carbon::createFromFormat('H:i', \"11:00\");\n $maxTime = Carbon::createFromFormat('H:i', \"22:00\");\n\n $error = false;\n $error_message = '';\n\n if ($pickup_time < $minTime) {\n $error = true;\n $error_message = 'Sorry, this is too early';\n }\n\n if ($pickup_time < $inThirtyMinutes) {\n $error = true;\n $error_message = 'Sorry but You can\\'t pick up earlier than ' . $inThirtyMinutes->toTimeString();\n }\n\n if ($pickup_time > $maxTime) {\n $error = true;\n $error_message = 'Sorry but You can\\'t pick up later than ' . $maxTime->toTimeString();\n }\n\n return ['error' => $error, 'error_message' => $error_message];\n }",
"function setHour($h)\r\n {\r\n if($h > 23 || $h < 0) {\r\n $this->hora = 0;\r\n } else {\r\n $this->hora = $h;\r\n }\r\n }",
"public function validate($element, FormStateInterface $form_state){\n // Accept a blank (empty) value\n $value = $element['#value'];\n if (strlen($value) == 0) {\n $form_state->setValueForElement($element, '');\n return;\n }\n\n // Intervals\n if( $this->getSetting('intervals') ){\n if(strpos($value, 'T') !== false){\n $form_state->setError($element, t(\"Date intervals cannot include times.\"));\n }\n\n list($begin, $end) = explode('/',$value);\n // begin\n $error_message = $this->dateValidation($begin);\n if($error_message){\n $form_state->setError($element, t($error_message));\n }\n // end either empty or valid extended interval values (5.2.3.)\n if(empty($end) || $end === 'unknown' || $end === 'open'){\n return;\n }\n $error_message = $this->dateValidation($end);\n if($error_message){\n $form_state->setError($element, t($error_message));\n }\n } else {\n $error_message = $this->dateValidation($value);\n if($error_message){\n $form_state->setError($element, t($error_message));\n }\n }\n\n return;\n }",
"function aegean_epay_settings_validate($form, &$form_state) {\n $payment_options = aegean_epay_parse_payment_options($form_state['values']['aegean_epay_payment_options']);\n foreach ($payment_options as $option) {\n if (empty($option['participant_el']) || !is_string($option['participant_el'])) {\n form_set_error('aegean_epay_payment_options', 'The \"Participant el\" value must be a valid string.');\n }\n if (empty($option['participant_en']) || !is_string($option['participant_en'])) {\n form_set_error('aegean_epay_payment_options', 'The \"Participant en\" value must be a valid string.');\n }\n if (empty($option['amount']) || !is_numeric($option['amount'])) {\n form_set_error('aegean_epay_payment_options', 'The \"Amount\" value must be numeric.');\n }\n if (empty($option['deadline']) || !preg_match(\"/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$/\", $option['deadline'])) {\n form_set_error('aegean_epay_payment_options', 'The \"Deadline\" value must be in the format of YYYY-MM-DD.');\n }\n }\n}",
"public function validate_time($timehour, $timeminute) {\r\n if ($timeminute<10)\r\n $timeminute='0'.$timeminute;\r\n $timefield=$timehour.':'.$timeminute;\r\n $hh=$timehour;\r\n \r\n //echo \"Valid time \", $timefield, '<br>';\r\n if ($hh=='00') {\r\n $timehour='12';\r\n $ap='AM';\r\n }\r\n elseif ($hh>11) {\r\n $timehour-=12;\r\n if ($timehour==0)\r\n $timehour=12;\r\n $ap='PM';\r\n }\r\n else\r\n $ap='AM';\r\n \r\n \treturn($timehour.':'.$timeminute.$ap);\r\n }",
"public function rules()\n {\n $this->session()->flash('errorDatTour', true);\n return [\n 'thoigianbatdau'=>'required|date',\n 'sokhachdangky'=>'required',\n ];\n }",
"public function rules()\n {\n return [\n // 'break_start' => \"required|date_format:h:i A\",\n // 'break_end' => \"required|date_format:h:i A\",\n 'start' => \"required|date_format:g:i A\",\n 'end' => \"required|date_format:g:i A\",\n 'sunday_subject' => \"nullable|integer\",\n 'sunday_teacher' => \"nullable|integer\",\n 'monday_subject' => \"nullable|integer\",\n 'monday_teacher' => \"nullable|integer\",\n 'tuesday_subject' => \"nullable|integer\",\n 'tuesday_teacher' => \"nullable|integer\",\n 'wednesday_subject'=> \"nullable|integer\",\n 'wednesday_teacher'=> \"nullable|integer\",\n 'thursday_subject' => \"nullable|integer\",\n 'thursday_teacher' => \"nullable|integer\",\n 'friday_subject' => \"nullable|integer\",\n 'friday_teacher' => \"nullable|integer\",\n 'saturday_subject' => \"nullable|integer\",\n 'saturday_teacher' => \"nullable|integer\",\n ];\n }"
] |
[
"0.64567107",
"0.63219446",
"0.6261679",
"0.6158734",
"0.58098084",
"0.5749355",
"0.57304925",
"0.5670933",
"0.5670785",
"0.5657785",
"0.565748",
"0.5636725",
"0.5630035",
"0.56034786",
"0.55498",
"0.55346113",
"0.5531511",
"0.5529615",
"0.5491683",
"0.54758483",
"0.5426697",
"0.5414118",
"0.5387623",
"0.53828555",
"0.53807694",
"0.535973",
"0.5357706",
"0.53518045",
"0.5347591",
"0.53452003"
] |
0.69620425
|
0
|
Form submission for the Hours / Default Hours configuration page.
|
function room_reservations_admin_settings_default_hours_submit($form_id, &$form_state) {
$default_hours = array();
if ($form_state['clicked_button']['#value'] == t('Save configuration')) {
for ($day = 0; $day < 7; $day++) {
$default_hours[] = $form_state['values']['day_' . $day]['first_shift_open_' . $day];
$default_hours[] = $form_state['values']['day_' . $day]['first_shift_close_' . $day];
$default_hours[] = $form_state['values']['day_' . $day]['second_shift_open_' . $day];
$default_hours[] = $form_state['values']['day_' . $day]['second_shift_close_' . $day];
}
$confirmation = ROOM_RESERVATIONS_SAVE_CONFIRMATION_MSG;
$error = ROOM_RESERVATIONS_SAVE_ERROR_MSG;
}
if ($form_state['clicked_button']['#value'] == t('Reset to defaults')) {
for ($day = 0; $day < 7; $day++) {
$default_hours[] = '9999';
$default_hours[] = '9999';
$default_hours[] = '9999';
$default_hours[] = '9999';
}
$confirmation = ROOM_RESERVATIONS_RESET_CONFIRMATION_MSG;
$error = ROOM_RESERVATIONS_RESET_ERROR_MSG;
}
$errors = FALSE;
$result = _room_reservations_set_variable('default_hours', serialize($default_hours));
if (!$result) {
$errors = TRUE;
}
else {
}
// Update monthly hours records.
$sql = "SELECT * FROM {room_reservations_variables} WHERE name LIKE 'monthly_hours_%'";
$results = db_query($sql);
foreach ($results as $data){
$name = $data->name;
$month = intval(drupal_substr($name, 19));
$year = drupal_substr($name, 14, 4);
$mo_hours = unserialize($data->value);
// Days in the month.
$days = date('t', mktime(0, 0, 0, $month, 1, (int) $year));
$upd_mo_hours = array();
for ($day = 0; $day < $days; $day++) {
$default_ind = $mo_hours[($day * 5)];
if ($default_ind == 'D') {
// Update monthly hours with default day of week hours.
// Day of the week.
$dow = date('w', mktime(0, 0, 0, $month, $day + 1, (int) $year));
$upd_mo_hours[($day * 5)] = 'D';
$upd_mo_hours[($day * 5) + 1] = $default_hours[($dow * 4)];
$upd_mo_hours[($day * 5) + 2] = $default_hours[($dow * 4) + 1];
$upd_mo_hours[($day * 5) + 3] = $default_hours[($dow * 4) + 2];
$upd_mo_hours[($day * 5) + 4] = $default_hours[($dow * 4) + 3];
}
elseif ($default_ind == 'O') {
// Leave monthly hours unchanged.
$upd_mo_hours[($day * 5)] = 'O';
$upd_mo_hours[($day * 5) + 1] = $mo_hours[($day * 5) + 1];
$upd_mo_hours[($day * 5) + 2] = $mo_hours[($day * 5) + 2];
$upd_mo_hours[($day * 5) + 3] = $mo_hours[($day * 5) + 3];
$upd_mo_hours[($day * 5) + 4] = $mo_hours[($day * 5) + 4];
}
}
$result2 = _room_reservations_set_variable($name,
serialize($upd_mo_hours));
if (!$result2) {
$errors = TRUE;
}
}
if ($errors) {
drupal_set_message(check_plain($error), 'error');
}
else {
drupal_set_message(check_plain($confirmation));
}
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function room_reservations_admin_settings_daily_hours_submit($form_id, &$form_state) {\n // Select month.\n if ($form_state['clicked_button']['#value'] == t('Select a month')) {\n $form_state['redirect']\n = 'admin/config/system/room_reservations/hours/daily_hours/' .\n $form_state['values']['month'];\n }\n // Process the daily hours for the selected month.\n elseif ($form_state['clicked_button']['#value'] == t('Save configuration')) {\n $confirmation = ROOM_RESERVATIONS_SAVE_CONFIRMATION_MSG;\n $error = ROOM_RESERVATIONS_SAVE_ERROR_MSG;\n $month_value = $form_state['values']['month'];\n $month = intval(drupal_substr($month_value, 5));\n $year = drupal_substr($month_value, 0, 4);\n // Days in the month.\n $days = date('t', mktime(0, 0, 0, $month, 1, $year));\n $mo_hours = unserialize(_room_reservations_get_variable('monthly_hours_' . $month_value));\n $updated_mo_hours = array();\n $default_hours = unserialize(_room_reservations_get_variable('default_hours'));\n for ($day = 0; $day < $days; $day++) {\n // User entered hours for a single day.\n $day_first_open = $form_state['values']['day_' . $day]['first_shift_open_' . $day];\n $day_first_close = $form_state['values']['day_' . $day]['first_shift_close_' . $day];\n $day_second_open = $form_state['values']['day_' . $day]['second_shift_open_' . $day];\n $day_second_close = $form_state['values']['day_' . $day]['second_shift_close_' . $day];\n // Default hours for the day of the week.\n // Day of week.\n $dow = date('w', mktime(0, 0, 0, $month, $day + 1, $year));\n $default_first_open = $default_hours[($dow * 4) + 0];\n $default_first_close = $default_hours[($dow * 4) + 1];\n $default_second_open = $default_hours[($dow * 4) + 2];\n $default_second_close = $default_hours[($dow * 4) + 3];\n // Compare user entered hours to default for the day of the week.\n if (($day_first_open == $default_first_open) && \n ($day_first_close == $default_first_close) && \n ($day_second_open == $default_second_open) && \n ($day_second_close == $default_second_close)) {\n $day_is_default = TRUE;\n }\n else {\n $day_is_default = FALSE;\n }\n // Update the monthly hours record.\n $updated_mo_hours[($day * 5)] = ($day_is_default) ? 'D' : 'O';\n $updated_mo_hours[($day * 5) + 1] = $day_first_open;\n $updated_mo_hours[($day * 5) + 2] = $day_first_close;\n $updated_mo_hours[($day * 5) + 3] = $day_second_open;\n $updated_mo_hours[($day * 5) + 4] = $day_second_close;\n }\n $result = _room_reservations_set_variable('monthly_hours_' . $month_value, serialize($updated_mo_hours));\n if ($result) {\n drupal_set_message(check_plain($confirmation));\n }\n else {\n drupal_set_message(check_plain($error), 'error');\n }\n }\n // Reset the month to the default hours.\n elseif ($form_state['clicked_button']['#value'] == t('Reset to defaults')) {\n $confirmation = ROOM_RESERVATIONS_RESET_CONFIRMATION_MSG;\n $error = ROOM_RESERVATIONS_RESET_ERROR_MSG;\n $month_value = $form_state['values']['month'];\n $month = intval(drupal_substr($month_value, 5));\n $year = drupal_substr($month_value, 0, 4);\n $result = _room_reservations_create_mo_hours($year, $month, $month_value);\n if ($result) {\n drupal_set_message(check_plain($confirmation));\n }\n else {\n drupal_set_message(check_plain($error), 'error');\n }\n }\n}",
"function room_reservations_admin_settings_default_hours($form, &$form_state) {\n $hours = _room_reservations_hours();\n // Select box options.\n $options = array();\n $options['9999'] = t('Select the time');\n $options['0000'] = t('Midnight - start of day');\n foreach ($hours as $hour) {\n $time = $hour['time'];\n $display = t($hour['display']);\n if ($time != '0000') {\n $options[$time] = $display;\n }\n }\n $options['2400'] = t('Midnight - end of day');\n // Get saved default hours.\n $default_hours\n = unserialize(_room_reservations_get_variable('default_hours'));\n if (!$default_hours) {\n for ($x = 0; $x < 28; $x++) {\n $default_hours[$x] = '9999';\n }\n }\n $days = array(\n t('Sunday'),\n t('Monday'),\n t('Tuesday'),\n t('Wednesday'),\n t('Thursday'),\n t('Friday'),\n t('Saturday'),\n );\n $form['#tree'] = TRUE;\n for ($day = 0; $day < 7; $day++) {\n $day_hours = array();\n $day_hours[] = $default_hours[($day * 4)];\n $day_hours[] = $default_hours[($day * 4) + 1];\n $day_hours[] = $default_hours[($day * 4) + 2];\n $day_hours[] = $default_hours[($day * 4) + 3];\n $display_hours = _room_reservations_hours_display($day_hours);\n $form['day_' . $day] = array(\n '#type' => 'fieldset',\n '#title' => $days[$day] . ' (' . $display_hours . ')',\n '#collapsible' => TRUE,\n '#collapsed' => TRUE,\n '#weight' => -90 + ($day * 10),\n );\n $form['day_' . $day]['first_shift_open_' . $day] = array(\n '#title' => t('First shift open'),\n '#type' => 'select',\n '#options' => $options,\n '#default_value' => $default_hours[($day * 4)],\n '#weight' => -90 + ($day * 10) + 1,\n );\n $form['day_' . $day]['first_shift_close_' . $day] = array(\n '#title' => t('First shift close'),\n '#type' => 'select',\n '#options' => $options,\n '#default_value' => $default_hours[($day * 4) + 1],\n '#weight' => -90 + ($day * 10) + 2,\n );\n $form['day_' . $day]['second_shift_open_' . $day] = array(\n '#title' => t('Second shift open'),\n '#type' => 'select',\n '#options' => $options,\n '#default_value' => $default_hours[($day * 4) + 2],\n '#weight' => -90 + ($day * 10) + 3,\n );\n $form['day_' . $day]['second_shift_close_' . $day] = array(\n '#title' => t('Second shift close'),\n '#type' => 'select',\n '#options' => $options,\n '#default_value' => $default_hours[($day * 4) + 3],\n '#weight' => -90 + ($day * 10) + 4,\n );\n }\n $form['save'] = array(\n '#type' => 'submit',\n '#value' => t('Save configuration'),\n '#weight' => 100,\n );\n $form['reset'] = array(\n '#type' => 'submit',\n '#value' => t('Reset to defaults'),\n '#weight' => 101,\n );\n return $form;\n}",
"function room_reservations_admin_settings_default_hours_validate($form_id, &$form_state) {\n $days = array(\n t('Sunday'),\n t('Monday'),\n t('Tuesday'),\n t('Wednesday'),\n t('Thursday'),\n t('Friday'),\n t('Saturday'),\n );\n if ($form_state['clicked_button']['#value'] == t('Save configuration')) {\n for ($day = 0; $day < 7; $day++) {\n $open = TRUE;\n $second_shift = FALSE;\n $first_shift_open\n = $form_state['values']['day_' . $day]['first_shift_open_' . $day];\n $first_shift_close\n = $form_state['values']['day_' . $day]['first_shift_close_' . $day];\n $second_shift_open\n = $form_state['values']['day_' . $day]['second_shift_open_' . $day];\n $second_shift_close\n = $form_state['values']['day_' . $day]['second_shift_close_' . $day];\n $int_first_shift_open\n = intval(\n $form_state['values']['day_' . $day]['first_shift_open_' . $day]);\n $int_first_shift_close\n = intval(\n $form_state['values']['day_' . $day]['first_shift_close_' . $day]);\n $int_second_shift_open\n = intval(\n $form_state['values']['day_' . $day]['second_shift_open_' . $day]);\n $int_second_shift_close\n = intval(\n $form_state['values']['day_' . $day]['second_shift_close_' . $day]);\n // Closed.\n if (($int_first_shift_open == 9999) && \n ($int_first_shift_close == 9999) && \n ($int_second_shift_open == 9999) && \n ($int_second_shift_close == 9999)) {\n $open = FALSE;\n }\n // First shift.\n if ($open) {\n if ($int_first_shift_open == 9999) {\n $field = 'day_' . $day . '][first_shift_open_' . $day;\n $message = t('!day - First shift open is required.', \n array('!day' => $days[$day]));\n form_set_error($field, check_plain($message));\n }\n elseif ($int_first_shift_close == 9999) {\n $field = 'day_' . $day . '][first_shift_close_' . $day;\n $message = t('!day - First shift close is required.', \n array('!day' => $days[$day]));\n form_set_error($field, check_plain($message));\n }\n elseif ($int_first_shift_open >= $int_first_shift_close) {\n $field = 'day_' . $day . '][first_shift_close_' . $day;\n $message = t('!day - First shift close must be later than first shift\n open.', array('!day' => $days[$day]));\n form_set_error($field, check_plain($message));\n }\n }\n // Second shift.\n if ($open) {\n if (($int_second_shift_open != 9999) || \n ($int_second_shift_close != 9999)) {\n $second_shift = TRUE;\n }\n }\n if ($second_shift) {\n if (($int_first_shift_open == 9999) && \n ($int_first_shift_close == 9999)) {\n $field = 'day_' . $day . '][second_shift_open_' . $day;\n $message = t('!day - Cannot have a second shift without a first\n shift.', array('!day' => $days[$day]));\n form_set_error($field, check_plain($message));\n }\n elseif ($int_second_shift_open == 9999) {\n $field = 'day_' . $day . '][second_shift_open_' . $day;\n $message = t('!day - Second shift open is missing.', \n array('!day' => $days[$day]));\n form_set_error($field, check_plain($message));\n }\n elseif ($int_second_shift_close == 9999) {\n $field = 'day_' . $day . '][second_shift_close_' . $day;\n $message = t('!day - Second shift close is missing.', \n array('!day' => $days[$day]));\n form_set_error($field, check_plain($message));\n }\n elseif ($int_second_shift_open <= $int_first_shift_close) {\n $field = 'day_' . $day . '][second_shift_open_' . $day;\n $message = t('!day - Second shift open must be later than first\n shift close.', array('!day' => $days[$day]));\n form_set_error($field, check_plain($message));\n }\n elseif ($int_second_shift_open >= $int_second_shift_close) {\n $field = 'day_' . $day . '][second_shift_close_' . $day;\n $message = t('!day - Second shift close must be later than second\n shift opten.', array('!day' => $days[$day]));\n form_set_error($field, check_plain($message));\n }\n }\n }\n }\n}",
"public function submitForm(array &$form, FormStateInterface $form_state) {\n $this->config('happy_alexandrie.library_config')\n ->set('opening_hours', $form_state->getValue('opening_hours'))\n ->save();\n // Call the parent implementation to inherit from what has been done in it.\n // In our case, display the confirmation message.\n parent::submitForm($form, $form_state);\n }",
"public function hoursForm($result)\n {\n if ( !$this->ownerLoggedIn() )\n {\n $this->restricted();\n return;\n }\n\n require_once('views/HoursView.class.php'); \n require_once('views/FormError.class.php');\n \n $site = new SiteContainer($this->db);\n $message = new FormError();\n \n $hv = new HoursView();\n\n $site->printHeader();\n $site->printNav(\"owner\");\n \n if ($result == \"bad_time\")\n $message->printHtml(array(\"bad_time\"));\n \n $hv->printHtml($result);\n $site->printFooter(); \n }",
"function room_reservations_admin_settings_daily_hours_validate($form_id, &$form_state) {\n if ($form_state['clicked_button']['#value'] == t('Save configuration')) {\n $month_value = $form_state['values']['month'];\n $month = intval(drupal_substr($month_value, 5));\n $year = drupal_substr($month_value, 0, 4);\n // Days in the month.\n $days = date('t', mktime(0, 0, 0, $month, 1, $year));\n for ($day = 0; $day < $days; $day++) {\n // Day of the week.\n $dow = date('l', mktime(0, 0, 0, $month, $day + 1, $year));\n // Day of month.\n $dom = $day + 1;\n $open = TRUE;\n $second_shift = FALSE;\n $first_shift_open\n = $form_state['values']['day_' . $day]['first_shift_open_' . $day];\n $first_shift_close\n = $form_state['values']['day_' . $day]['first_shift_close_' . $day];\n $second_shift_open\n = $form_state['values']['day_' . $day]['second_shift_open_' . $day];\n $second_shift_close\n = $form_state['values']['day_' . $day]['second_shift_close_' . $day];\n $int_first_shift_open\n = intval(\n $form_state['values']['day_' . $day]['first_shift_open_' . $day]);\n $int_first_shift_close\n = intval(\n $form_state['values']['day_' . $day]['first_shift_close_' . $day]);\n $int_second_shift_open\n = intval(\n $form_state['values']['day_' . $day]['second_shift_open_' . $day]);\n $int_second_shift_close\n = intval(\n $form_state['values']['day_' . $day]['second_shift_close_' . $day]);\n // Closed.\n if (($int_first_shift_open == 9999) && \n ($int_first_shift_close == 9999) && \n ($int_second_shift_open == 9999) && \n ($int_second_shift_close == 9999)) {\n $open = FALSE;\n }\n // First shift.\n if ($open) {\n if ($int_first_shift_open == 9999) {\n $field = 'day_' . $day . '][first_shift_open_' . $day;\n $message = t('!day - First shift open is required.', \n array('!day' => $dom . ' ' . $dow));\n form_set_error($field, check_plain($message));\n }\n elseif ($int_first_shift_close == 9999) {\n $field = 'day_' . $day . '][first_shift_close_' . $day;\n $message = t('!day - First shift close is required.', \n array('!day' => $dom . ' ' . $dow));\n form_set_error($field, check_plain($message));\n }\n elseif ($int_first_shift_open >= $int_first_shift_close) {\n $field = 'day_' . $day . '][first_shift_close_' . $day;\n $message = t('!day - First shift close must be later than first shift\n open.', array('!day' => $dom . ' ' . $dow));\n form_set_error($field, check_plain($message));\n }\n }\n // Second shift.\n if ($open) {\n if (($int_second_shift_open != 9999) || \n ($int_second_shift_close != 9999)) {\n $second_shift = TRUE;\n }\n }\n if ($second_shift) {\n if (($int_first_shift_open == 9999) && \n ($int_first_shift_close == 9999)) {\n $field = 'day_' . $day . '][second_shift_open_' . $day;\n $message = t('!day - Cannot have a second shift without a first\n shift.', array('!day' => $dom . ' ' . $dow));\n form_set_error($field, check_plain($message));\n }\n elseif ($int_second_shift_open == 9999) {\n $field = 'day_' . $day . '][second_shift_open_' . $day;\n $message = t('!day - Second shift open is missing.', \n array('!day' => $dom . ' ' . $dow));\n form_set_error($field, check_plain($message));\n }\n elseif ($int_second_shift_close == 9999) {\n $field = 'day_' . $day . '][second_shift_close_' . $day;\n $message = t('!day - Second shift close is missing.', \n array('!day' => $dom . ' ' . $dow));\n form_set_error($field, check_plain($message));\n }\n elseif ($int_second_shift_open <= $int_first_shift_close) {\n $field = 'day_' . $day . '][second_shift_open_' . $day;\n $message = t('!day - Second shift open must be later than first\n shift close.', array('!day' => $dom . ' ' . $dow));\n form_set_error($field, check_plain($message));\n }\n elseif ($int_second_shift_open >= $int_second_shift_close) {\n $field = 'day_' . $day . '][second_shift_close_' . $day;\n $message = t('!day - Second shift close must be later than second\n shift opten.', array('!day' => $dom . ' ' . $dow));\n form_set_error($field, check_plain($message));\n }\n }\n }\n }\n}",
"function room_reservations_admin_settings_daily_hours($form, &$form_state, $selected_month = NULL) {\n $cur_months = _room_reservations_current_months();\n \n if (!$selected_month) {\n // create a form to pick a month.\n $month_options = array();\n $first = current($cur_months);\n foreach ($cur_months as $cur_month) {\n $yyyy_mm = $cur_month['YYYY_MM'];\n $display = t($cur_month['display']);\n $month_options[$yyyy_mm] = t($cur_month['display']);\n }\n // Form.\n $form['select_month']['month'] = array(\n '#title' => t('Month'),\n '#type' => 'select',\n '#options' => $month_options,\n '#default_value' => $first['YYYY_MM'],\n '#weight' => -4000,\n );\n $form['select_month']['save'] = array(\n '#type' => 'submit',\n '#value' => t('Select a month'),\n '#weight' => -3990,\n ); \n \n // and if no month has been selected; just return this form\n\n return $form;\n }\n \n // If the month has been selected, return a form to update the hours for each day of that month.\n $hours = _room_reservations_hours();\n // Select box options.\n $options = array();\n $options['9999'] = t('Select the time');\n $options['0000'] = t('Midnight - start of day');\n foreach ($hours as $hour) {\n $time = $hour['time'];\n $display = t($hour['display']);\n if ($time != '0000') {\n $options[$time] = $display;\n }\n }\n $options['2400'] = t('Midnight - end of day');\n \n $yyyy_mm = $selected_month;\n $month = intval(drupal_substr($yyyy_mm, 5));\n $year = drupal_substr($yyyy_mm, 0, 4);\n $month_display = date('F Y', mktime(0, 0, 0, $month, 1, $year));\n // Days in the month.\n $days = date('t', mktime(0, 0, 0, $month, 1, $year));\n if (!$mo_hours = unserialize(_room_reservations_get_variable('monthly_hours_' . $yyyy_mm))) {\n $mo_hours = _room_reservations_create_mo_hours($year, $month, $yyyy_mm, true);\n }\n // Form.\n $form['#tree'] = TRUE;\n $form['month_display'] = array(\n '#prefix' => '<b>',\n '#suffix' => '</b><br />',\n '#markup' => $month_display,\n '#weight' => -100,\n );\n $form['note'] = array(\n '#markup' => t('Asterisk (*) indicates that the hours have been changed from the default'),\n '#weight' => -99,\n );\n for ($day = 0; $day < $days; $day++) {\n // Day of week.\n $dow = date('l', mktime(0, 0, 0, $month, $day + 1, $year));\n $changed_hours = ($mo_hours[($day * 5)] == 'O') ? '*' : '';\n $day_hours = array();\n $day_hours[] = $mo_hours[($day * 5) + 1];\n $day_hours[] = $mo_hours[($day * 5) + 2];\n $day_hours[] = $mo_hours[($day * 5) + 3];\n $day_hours[] = $mo_hours[($day * 5) + 4];\n $display_hours = _room_reservations_hours_display($day_hours);\n $title = ($day + 1) . ' ' . $dow . ' (' . $display_hours . ') ' . $changed_hours;\n $form['day_' . $day] = array(\n '#type' => 'fieldset',\n '#title' => $title,\n '#collapsible' => TRUE,\n '#collapsed' => TRUE,\n '#weight' => -9 + ($day * 2),\n );\n $form['day_' . $day]['first_shift_open_' . $day] = array(\n '#title' => t('First shift open'),\n '#type' => 'select',\n '#options' => $options,\n '#default_value' => $mo_hours[($day * 5) + 1],\n //'#weight' => -9 + ($day * 2) + 1,\n );\n $form['day_' . $day]['first_shift_close_' . $day] = array(\n '#title' => t('First shift close'),\n '#type' => 'select',\n '#options' => $options,\n '#default_value' => $mo_hours[($day * 5) + 2],\n //'#weight' => -9 + ($day * 10) + 2,\n );\n $form['day_' . $day]['second_shift_open_' . $day] = array(\n '#title' => t('Second shift open'),\n '#type' => 'select',\n '#options' => $options,\n '#default_value' => $mo_hours[($day * 5) + 3],\n //'#weight' => -90 + ($day * 10) + 3,\n );\n $form['day_' . $day]['second_shift_close_' . $day] = array(\n '#title' => t('Second shift close'),\n '#type' => 'select',\n '#options' => $options,\n '#default_value' => $mo_hours[($day * 5) + 4],\n //'#weight' => -90 + ($day * 10) + 4,\n );\n }\n $form['save'] = array(\n '#type' => 'submit',\n '#value' => t('Save configuration'),\n '#weight' => 400,\n );\n $form['reset'] = array(\n '#type' => 'submit',\n '#value' => t('Reset to defaults'),\n '#weight' => 401,\n );\n $form['month'] = array(\n '#type' => 'value',\n '#value' => $month_value,\n );\n return $form;\n}",
"private function setHoursField(){\n \n $hoursnode = $this->getHoursNode();\n \n $hoursfield = $hoursnode->field_hours_paragraph->view(array('type' => 'full', 'label' => 'hidden')); \n \n if(in_array('show_today', $this->getOptions())){\n $hoursfield['#prefix'] = '<div class=\"field today-only\">';\n $hoursfield['#suffix'] = '</div>';\n }\n \n $this->hoursfield = $hoursfield;\n }",
"private function showHowRequestForm() {\r\n $this->config->showPrinterFriendly = false;\r\n echo '<h2>How would you like to use this time?</h2>';\r\n $this->showSubTimeTypeDropDown();\r\n echo '<input type=\"hidden\" name=\"maxCalDays\" value=\"' . $this->maxCalDays . '\" />';\r\n echo '<br/><br/><br/>';\r\n }",
"public function actionWorkinghours(): array\n {\n $request = Yii::$app->request;\n\n if ($request->isPost) {\n return Appointments::WORKING_HOURS;\n }\n \n return [];\n }",
"public function settings_page() {\n\n\t\t?>\n\n\t\t<div class=\"wrap schedule-a-visit-to-sherpa-settings\">\n\t\t\t\n\t\t\t<form id=\"schedule-a-visit-to-sherpa-form\" method=\"post\" action=\"options.php\">\n\t\t\t\t\n\t\t\t\t<?php echo wp_nonce_field( 'schedule_a_visit_to_sherpa_data', 'schedule_a_visit_to_sherpa_nonce' ); ?>\n\n\t\t\t\t<?php settings_fields( 'schedule_a_visit_to_sherpa_settings_section' ); ?>\n\n\t\t\t\t<?php do_settings_sections( 'schedule-a-visit-to-sherpa' ); ?>\n\t\t\t\t\n\t\t\t\t<?php submit_button(); ?>\n\n\t\t\t</form>\n\n </div>\n\n\t\t<?php\n\n\t}",
"public function showMainRequestForm() {\r\n $this->config->showPrinterFriendly = true;\r\n echo '<h2>Complete additional fields</h2>';\r\n echo 'Starting Date: ';\r\n displayDateSelect('useDate', 'date_1', $this->useDate, true, true);\r\n if(!$this->isEditing){\r\n echo ' Through date (optional): ';\r\n displayDateSelect('endDate', 'date_2', $this->endDate);\r\n } else{\r\n echo '<input type=\"hidden\" name=\"endDate\" value=\"\" />';\r\n }\r\n echo '<br/><br/>';\r\n echo 'Start time: ';\r\n showTimeSelector(\"begTime\", $this->begTime1, $this->begTime2);\r\n if ($this->subTypeInfo['LIMIT_8_12'] == '1' || $this->typeID == '2') {\r\n //Limit is enabled or Type is Personal\r\n if (!empty($this->shiftHours)) {\r\n if ($this->shiftHourRadio == \"8\" || $this->shiftHours == \"8\") {\r\n echo \" How long is your shift? <input type='radio' name='shiftHour' value='8' CHECKED>8 Hours\";\r\n echo \"<input type='radio' name='shiftHour' value='12'>12 Hours<br/>\";\r\n } elseif ($this->shiftHourRadio == \"12\" || $this->shiftHours == \"12\") {\r\n echo \" How long is your shift? <input type='radio' name='shiftHour' value='8'>8 Hours\";\r\n echo \"<input type='radio' name='shiftHour' value='12' CHECKED>12 Hours<br/>\";\r\n } else {\r\n echo \" How long is your shift? <input type='radio' name='shiftHour' value='8'>8 Hours\";\r\n echo \"<input type='radio' name='shiftHour' value='12'>12 Hours\";\r\n echo ' <font color=\"red\">Error in shift selection! </font><br/>';\r\n }\r\n } else {\r\n echo \" How long is your shift? <input type='radio' name='shiftHour' value='8'>8 Hours\";\r\n echo \"<input type='radio' name='shiftHour' value='12'>12 Hours<br/>\";\r\n }\r\n } else {\r\n echo ' End time: ';\r\n showTimeSelector(\"endTime\", $this->endTime1, $this->endTime2);\r\n }\r\n if (!empty($this->shiftHours))\r\n echo ' Total Hours: ' . $this->shiftHours;\r\n\r\n echo '<br/><br/>';\r\n echo 'Comment: <textarea rows=\"3\" cols=\"40\" name=\"empComment\" >' . $this->empComment . '</textarea>';\r\n echo '<br/><br/>';\r\n if(!empty($this->submitDate)){\r\n echo '<font color=\"darkred\">Submitted on '. $this->submitDate .' by '.$this->auditName.'</font>';\r\n echo '<br/><br/>';\r\n }\r\n\r\n if (!$this->isEditing) {\r\n echo '<input type=\"submit\" name=\"submitBtn\" value=\"Submit for Approval\">';\r\n } else { \r\n if($this->status != \"APPROVED\"){ \r\n echo '<input type=\"hidden\" name=\"reqID\" value=\"'.$this->reqID.'\" />';\r\n echo '<input type=\"submit\" name=\"updateReqBtn\" value=\"Update Request ' . $this->reqID . '\">';\r\n }\r\n echo '<input type=\"submit\" name=\"duplicateReqBtn\" value=\"Duplicate Request\" />';\r\n }\r\n }",
"private function timingSection() {\n $this->_form->addElement('header', 'timing', get_string('timing', 'codeactivity')); \n \n $this->_form->addElement('date_time_selector', 'opendate', get_string('open_date', 'codeactivity'), self::$datefieldoptions);\n $this->_form->addHelpButton(\n 'opendate',\n 'open_date',\n 'codeactivity');\n $this->_form->addElement('date_time_selector', 'duedate', get_string('due_date', 'codeactivity'), self::$datefieldoptions);\n $this->_form->addHelpButton(\n 'duedate',\n 'due_date',\n 'codeactivity'); \n }",
"public function form( $instance ) {\n\t\t\n\t\t\t$instance = wp_parse_args(\n\t\t\t\t(array) $instance,\n\t\t\t\tarray(\n\t\t\t\t\t'title' => esc_html__( 'Business Hours.', 'zthemename' ),\n\t\t\t\t)\n\t\t\t); \n\n\t\t\t?>\n\t\t\t<p>\n\t\t\t\t<label for=\"<?php echo $this->get_field_id( 'title' ); ?>\"><?php esc_html_e( 'Title:', 'zthemename' ); ?></label>\n\t\t\t\t<input class=\"widefat\" id=\"<?php echo $this->get_field_id( 'title' ); ?>\" name=\"<?php echo $this->get_field_name( 'title' ); ?>\" type=\"text\" value=\"<?php echo esc_attr( $instance['title'] ); ?>\">\n\t\t\t</p>\n\t\t\t<div>\n\t\t\t\t<div> </div>\n\t\t\t\t<div><?php esc_html_e( 'Open', 'zthemename' ); ?></div>\n\t\t\t\t<div><?php esc_html_e( 'Close', 'zthemename' ); ?></div>\n\t\t\t</div>\n\n\t\t\t<div>\n\t\t\t\t<div><?php esc_html_e( 'Monday:', 'zthemename'); ?></div>\n\t\t\t\t<input type=\"text\" size=\"9\" value=\"<?php echo isset( $this->opening_hours['Monday'][0] ) ? $this->opening_hours['Monday'][0] : ''; ?>\" readonly>\n\t\t\t\t<input type=\"text\" size=\"9\" value=\"<?php echo isset( $this->opening_hours['Monday'][1] ) ? $this->opening_hours['Monday'][1] : ''; ?>\" readonly>\n\t\t\t</div>\n\n\t\t\t<div>\n\t\t\t\t<div><?php esc_html_e( 'Tuesday:', 'zthemename' ); ?></div>\n\t\t\t\t<input type=\"text\" size=\"9\" value=\"<?php echo isset( $this->opening_hours['Tuesday'][0] ) ? $this->opening_hours['Tuesday'][0] : ''; ?>\" readonly>\n\t\t\t\t<input type=\"text\" size=\"9\" value=\"<?php echo isset( $this->opening_hours['Tuesday'][1] ) ? $this->opening_hours['Tuesday'][1] : ''; ?>\" readonly>\n\t\t\t</div>\n\n\t\t\t<div>\n\t\t\t\t<div><?php esc_html_e( 'Wednesday:', 'zthemename' ); ?></div>\n\t\t\t\t<input type=\"text\" size=\"9\" value=\"<?php echo isset( $this->opening_hours['Wednesday'][0] ) ? $this->opening_hours['Wednesday'][0] : ''; ?>\" readonly>\n\t\t\t\t<input type=\"text\" size=\"9\" value=\"<?php echo isset( $this->opening_hours['Wednesday'][1] ) ? $this->opening_hours['Wednesday'][1] : ''; ?>\" readonly>\n\t\t\t</div>\n\n\t\t\t<div>\n\t\t\t\t<div><?php esc_html_e( 'Thursday:', 'zthemename' ); ?></div>\n\t\t\t\t<input type=\"text\" size=\"9\" value=\"<?php echo isset( $this->opening_hours['Thursday'][0] ) ? $this->opening_hours['Thursday'][0] : ''; ?>\" readonly>\n\t\t\t\t<input type=\"text\" size=\"9\" value=\"<?php echo isset( $this->opening_hours['Thursday'][1] ) ? $this->opening_hours['Thursday'][1] : ''; ?>\" readonly>\n\t\t\t</div>\n\n\t\t\t<div>\n\t\t\t\t<div><?php esc_html_e( 'Friday:', 'zthemename' ); ?></div>\n\t\t\t\t<input type=\"text\" size=\"9\" value=\"<?php echo isset( $this->opening_hours['Friday'][0] ) ? $this->opening_hours['Friday'][0] : ''; ?>\" readonly>\n\t\t\t\t<input type=\"text\" size=\"9\" value=\"<?php echo isset( $this->opening_hours['Friday'][1] ) ? $this->opening_hours['Friday'][1] : ''; ?>\" readonly>\n\t\t\t</div>\n\n\t\t\t<div>\n\t\t\t\t<div><?php esc_html_e( 'Saturday:', 'zthemename'); ?></div>\n\t\t\t\t<input type=\"text\" size=\"9\" value=\"<?php echo isset( $this->opening_hours['Saturday'][0] ) ? $this->opening_hours['Saturday'][0] : ''; ?>\" readonly>\n\t\t\t\t<input type=\"text\" size=\"9\" value=\"<?php echo isset( $this->opening_hours['Saturday'][1] ) ? $this->opening_hours['Saturday'][1] : ''; ?>\" readonly>\n\t\t\t</div>\n\n\t\t\t<div>\n\t\t\t\t<div><?php esc_html_e( 'Sunday:', 'zthemename'); ?></div>\n\t\t\t\t<input type=\"text\" size=\"9\" value=\"<?php echo isset( $this->opening_hours['Sunday'][0] ) ? $this->opening_hours['Sunday'][0] : ''; ?>\" readonly>\n\t\t\t\t<input type=\"text\" size=\"9\" value=\"<?php echo isset( $this->opening_hours['Sunday'][1] ) ? $this->opening_hours['Sunday'][1] : ''; ?>\" readonly>\n\t\t\t</div>\n\n\t\t\t\n\t\t\t<p>\n\t\t\t\t<?php\n\t\t\t\t\t$url = admin_url( 'themes.php?page=zthemename-options' );\n\t\t\t\t\t/* translators: %s: URL to create a new menu. */\n\t\t\t\t\tprintf( __( 'Synchronize business hours <a href=\"%s\">here</a>.' ), esc_attr( $url ) );\n\t\t\t\t?>\n\t\t\t</p>\n\t\t\t<?php\n\t\t}",
"function form_select_hour($name, $hour, $id='') {\n\n\tglobal $cache2;\n\n\t$id = ifr($id, $name);\n\n\treturn form_select($name, $cache2->getCalendarData('hours'), '', $hour, '', '', '', '', '', $id);\n\n}",
"public function form( $instance ) {\n $title = ! empty( $instance['title'] ) ? $instance['title'] : '';\n $seperator =!empty( $instance['seperator']) ? $instance['seperator'] : '';\n $hour = !empty( $instance['hour']) ? $instance['hour'] : '';\n $amorpm = !empty( $instance['amorpm'] ) ? $instance['amorpm'] : '';?>\n <p>\n <label for=\"<?php echo $this->get_field_id( 'title' ); ?>\">Title:</label>\n <input type=\"text\" id=\"<?php echo $this->get_field_id( 'title' ); ?>\" name=\"<?php echo $this->get_field_name( 'title' ); ?>\" value=\"<?php echo esc_attr( $title ); ?>\" />\n </p>\n <p>\n <label for=\"<?php echo $this->get_field_id( 'seperator' ); ?>\">Seperator:</label>\n <input type=\"text\" id=\"<?php echo $this->get_field_id( 'seperator' ); ?>\" name=\"<?php echo $this->get_field_name( 'seperator' ); ?>\" value=\"<?php echo esc_attr( $seperator ); ?>\" />\n </p>\n <p><label for=\"<?php echo $this->get_field_id('hour'); ?>\">\n <?php _e('12 hour format:'); ?>\n <input id=\"<?php echo $this->get_field_id('h'); ?>\" name=\"<?php echo $this->get_field_name('hour'); ?>\" type=\"radio\" value=\"h\" <?php if($hour === 'h'){ echo 'checked=\"checked\"'; } ?> />\n </label><br>\n <label for=\"<?php echo $this->get_field_id('hour'); ?>\">\n <?php _e('24 hour format:'); ?>\n <input id=\"<?php echo $this->get_field_id('H'); ?>\" name=\"<?php echo $this->get_field_name('hour'); ?>\" type=\"radio\" value=\"H\" <?php if($hour === 'H'){ echo 'checked=\"checked\"'; } ?> />\n </label></p>\n <p><label for=\"<?php echo $this->get_field_id('amorpm'); ?>\">\n <?php _e('Small letters meridiam:'); ?>\n <input id=\"<?php echo $this->get_field_id('a'); ?>\" name=\"<?php echo $this->get_field_name('amorpm'); ?>\" type=\"radio\" value=\"a\" <?php if($amorpm === 'a'){ echo 'checked=\"checked\"'; } ?> />\n </label><br>\n <label for=\"<?php echo $this->get_field_id('amorpm'); ?>\">\n <?php _e('Capital Meridiam:'); ?>\n <input id=\"<?php echo $this->get_field_id('A'); ?>\" name=\"<?php echo $this->get_field_name('amorpm'); ?>\" type=\"radio\" value=\"A\" <?php if($amorpm === 'A'){ echo 'checked=\"checked\"'; } ?> />\n </label></p> <?php\n }",
"protected function saveOpeningHours()\n {\n //TODO\n }",
"public static function onChangeEndHour($param=NULL)\n {\n if (empty($param['end_minute']))\n {\n $obj = new stdClass;\n $obj->end_minute = '0';\n TForm::sendData('form_event', $obj);\n }\n }",
"function setHour($h)\r\n {\r\n if($h > 23 || $h < 0) {\r\n $this->hora = 0;\r\n } else {\r\n $this->hora = $h;\r\n }\r\n }",
"public function hours() {\n //TODO prediction\n }",
"public static function onChangeStartHour($param=NULL)\n {\n $obj = new stdClass;\n if (empty($param['start_minute']))\n {\n $obj->start_minute = '0';\n TForm::sendData('form_event', $obj);\n }\n \n if (empty($param['end_hour']) AND empty($param['end_minute']))\n {\n $obj->end_hour = $param['start_hour'] +1;\n $obj->end_minute = '0';\n TForm::sendData('form_event', $obj);\n }\n }",
"function options_form(&$form, &$form_state) {\r\n parent::options_form($form, $form_state);\r\n $options = $this->date_handler->date_parts();\r\n unset($options['second'], $options['minute']);\r\n $options += array('week' => date_t('Week', 'datetime'));\r\n $form['granularity'] = array(\r\n '#title' => t('Granularity'),\r\n '#type' => 'radios',\r\n '#options' => $options,\r\n '#default_value' => $this->options['granularity'],\r\n '#multiple' => TRUE,\r\n '#description' => t(\"Select the type of date value to be used in defaults, summaries, and navigation. For example, a granularity of 'month' will set the default date to the current month, summarize by month in summary views, and link to the next and previous month when using date navigation.\"),\r\n );\r\n\r\n $form['year_range'] = array(\r\n '#title' => t('Date year range'),\r\n '#type' => 'textfield',\r\n '#default_value' => $this->options['year_range'],\r\n '#description' => t(\"Set the allowable minimum and maximum year range for this argument, either a -X:+X offset from the current year, like '-3:+3' or an absolute minimum and maximum year, like '2005:2010'. When the argument is set to a date outside the range, the page will be returned as 'Page not found (404)'.\"),\r\n );\r\n \r\n $fields = date_api_fields($this->definition['base']);\r\n $options = array();\r\n foreach ($fields['name'] as $name => $field) {\r\n $options[$name] = $field['label'];\r\n }\r\n $form['date_fields'] = array(\r\n '#title' => t('Date field(s)'),\r\n '#type' => 'checkboxes',\r\n '#options' => $options,\r\n '#default_value' => $this->options['date_fields'],\r\n '#multiple' => TRUE,\r\n '#description' => t(\"Select one or more date fields to filter with this argument. Do not select both the 'From date' and 'To date' for CCK date fields, only one of them is needed.\"),\r\n );\r\n $form['date_method'] = array(\r\n '#title' => t('Method'),\r\n '#type' => 'radios',\r\n '#options' => array('OR' => t('OR'), 'AND' => t('AND')),\r\n '#default_value' => $this->options['date_method'],\r\n '#description' => t('Method of handling multiple date fields in the same query. Return items that have any matching date field (date = field_1 OR field_2), or only those with matches in all selected date fields (date = field_1 AND field_2).'),\r\n );\r\n \r\n }",
"public function actionCronHourly()\n {\n switch (date('H')) {\n default: echo \"Nothing to run\\n\";\n }\n echo \"Done!\\n\";\n }",
"function form_time($field, $options){\n $defaults = array(\n 'wrap' => true,\n 'label' => true,\n 'class' => array('date', 'input'),\n 'interval' => 1,\n 'format' => 24,\n 'separator' => ':'\n );\n\n $options = array_merge($defaults, $options);\n \n $hours = array();\n for($i = 0; $i < $options['format']; $i++) {\n if($options['format'] == 12 && $i == 0) {\n $hour = 12;\n } else {\n $hour = $i;\n }\n $hours[$hour] = $hour;\n }\n\n $minutes = array();\n for($i = 0; $i < 60; $i+=$options['interval']) {\n $minute = str_pad($i, 2, '0', STR_PAD_LEFT);\n $minutes[$minute] = $minute;\n }\n \n if(empty($_POST[$field . '[hours]'])) {\n $_POST[$field . '[hours]'] = ($options['format'] == 12) ? date('g') : date('G');\n }\n\n $output = form_select(\n $field . '[hours]',\n array(\n 'wrap' => false,\n 'label' => false,\n 'options' => $hours\n )\n );\n\n $output .= $options['separator'];\n\n if(empty($_POST[$field . '[minutes]'])) {\n $current = date('i');\n while(($current % 5) !== 0) {\n $current++;\n }\n \n $_POST[$field . '[minutes]'] = $current;\n }\n\n $output .= form_select(\n $field . '[minutes]',\n array(\n 'wrap' => false,\n 'label' => false,\n 'options' => $minutes\n )\n );\n\n if($options['format'] == 12) {\n if(empty($_POST[$field . '[meridiem]'])) {\n $_POST[$field . '[meridiem]'] = date('A');\n }\n \n $output .= ' ';\n $output .= form_select(\n $field . '[meridiem]',\n array(\n 'wrap' => false,\n 'label' => false,\n 'options' => array('AM' => 'AM', 'PM' => 'PM')\n )\n );\n }\n\n if($options['wrap']) {\n $options['field'] = $field;\n $output = form__wrap($output, $options);\n }\n\n $error = form_error_message($field);\n if(!empty($error)) {\n $output .= $error;\n }\n\n return html__output($output);\n}",
"private function showWhyRequestForm() { $this->config->showPrinterFriendly = false;\r\n echo '<h2>Why are you requesting time?</h2>';\r\n $this->showTimeTypeDropDown();\r\n echo '<br/><br/><br/>';\r\n }",
"public function create()\n {\n return view('hours.create');\n }",
"public function definition() {\n global $CFG, $PAGE;\n\n $mform =& $this->_form;\n\n //edit section\n $mform->addElement('header', 'configheader', get_string('exitingcrontitle', 'tool_servercron'));\n\n $existing = $this->_customdata['existingrecs'];\n $rows = '';\n\n if (count($existing)) {\n //set up heading for the table\n $row = html_writer::tag('th', get_string('minuteprompt', 'tool_servercron'),\n array('width' => '5%', 'style' => 'padding:5px; text-align:right'));\n\n $row .= html_writer::tag('th', get_string('hourprompt', 'tool_servercron'),\n array('width' => '5%', 'style' => 'padding:5px; text-align:right'));\n\n $row .= html_writer::tag('th', get_string('dayprompt', 'tool_servercron'),\n array('width' => '5%', 'style' => 'padding:5px; text-align:right'));\n\n $row .= html_writer::tag('th', get_string('monthprompt', 'tool_servercron'),\n array('width' => '5%', 'style' => 'padding:5px; text-align:right'));\n\n $row .= html_writer::tag('th', get_string('wdayprompt', 'tool_servercron'),\n array('width' => '5%', 'style' => 'padding:5px; text-align:right'));\n\n $row .= html_writer::tag('th', get_string('commandprompt', 'tool_servercron'),\n array('width' => '30%', 'style' => 'padding:5px; text-align:center'));\n\n $row .= html_writer::tag('th', get_string('actionsprompt', 'tool_servercron'),\n array('style' => 'padding:5px; text-align:center'));\n\n $row = html_writer::tag('tr', $row, array('width' => '100%'));\n $rows .= $row .\"\\n\";\n\n foreach ($existing as $exists) {\n // make up the edit line\n $row = html_writer::tag('td', $exists->minute, array('style' => 'text-align: right'));\n $row .= html_writer::tag('td', $exists->hour, array('style' => 'text-align: right'));\n $row .= html_writer::tag('td', $exists->day, array('style' => 'text-align: right'));\n $row .= html_writer::tag('td', $exists->month, array('style' => 'text-align: right'));\n $row .= html_writer::tag('td', $exists->wday, array('style' => 'text-align: right'));\n $row .= html_writer::tag('td', $exists->commandline);\n\n //editing links\n $row .= html_writer::start_tag('td', array('style' => 'padding:5px; text-align:center'));\n\n $row .= html_writer::tag('a', '['.get_string('editcronjob', 'tool_servercron').']',\n array('id' => 'svrcrn'.$exists->id,\n 'href' => $PAGE->url.\"?action=edit&cronjobid=\".$exists->id));\n\n $row .= ' ';\n\n $row .= html_writer::tag('a', '['.get_string('deletecronjob', 'tool_servercron').']',\n array('id' => 'svrcrn'.$exists->id, 'href' => $PAGE->url.\"?action=delete&cronjobid=\".$exists->id));\n\n $row .= html_writer::end_tag('td');\n\n $row = html_writer::tag('tr', $row);\n $rows .= $row .\"\\n\";\n }\n\n $mform->addElement('html', html_writer::tag('table', $rows, array('width' => '100%'))); //enclose in table\n } else {\n //if no rec id specified - then we have no records\n if (!$this->_customdata['cronjobid']) {\n $mform->addElement('html', html_writer::tag('p', get_string('noexistingcrons', 'tool_servercron')));\n }\n }\n\n $editing = false; //deafult not editing existing record\n if ($this->_customdata['cronjobid'] != 0) {\n $editing = true;\n }\n //new section\n if ($editing) {\n $mform->addElement('header', 'configheader', get_string('editcronstitle', 'tool_servercron') .' [' .\n $this->_customdata['cronjobid'] . ']' );\n } else {\n $mform->addElement('header', 'configheader', get_string('newcronstitle', 'tool_servercron'));\n }\n\n if (isset($this->_customdata['error'])) {\n $mform->addElement('html', '<h3 style=\"color: red\">'.$this->_customdata['error'].'</h3>');\n }\n\n //hidden field\n $mform->addElement('hidden', 'cronjobid', $this->_customdata['cronjobid'], array('id' => 'id_cronjobid'));//0=new\n // default action is save - have to check for cancel in php code to avoid reliance on JS\n $mform->addElement('hidden', 'action', 'save', array('id' => 'id_action'));\n\n $timingdets=array();\n\n $select = $mform->createElement('select', 'minute', get_string('minuteprompt', 'tool_servercron'),\n $this->_customdata['minutes']);\n $select->setMultiple(true);\n $timingdets[] = $select;\n\n $select = $mform->createElement('select', 'hour', get_string('hourprompt', 'tool_servercron'),\n $this->_customdata['hours']);\n $select->setMultiple(true);\n $timingdets[] = $select;\n\n $select = $mform->createElement('select', 'day', get_string('dayprompt', 'tool_servercron'),\n $this->_customdata['days']);\n $select->setMultiple(true);\n $timingdets[] = $select;\n\n $select = $mform->createElement('select', 'month', get_string('monthprompt', 'tool_servercron'),\n $this->_customdata['months']);\n $select->setMultiple(true);\n $timingdets[] = $select;\n\n $select = $mform->createElement('select', 'wday', get_string('wdayprompt', 'tool_servercron'),\n $this->_customdata['wdays']);\n $select->setMultiple(true);\n $timingdets[] = $select;\n\n //set the defaults for all the dropdowns as every *\n if (isset($this->_customdata['minute'])) {\n $mform->setDefault('minute', $this->_customdata['minute']);\n } else {\n $mform->setDefault('minute', -1);\n }\n\n if (isset($this->_customdata['hour'])) {\n $mform->setDefault('hour', $this->_customdata['hour']);\n } else {\n $mform->setDefault('hour', -1);\n }\n\n if (isset($this->_customdata['day'])) {\n $mform->setDefault('day', $this->_customdata['day']);\n } else {\n $mform->setDefault('day', -1);\n }\n\n if (isset($this->_customdata['month'])) {\n $mform->setDefault('month', $this->_customdata['month']);\n } else {\n $mform->setDefault('month', -1);\n }\n\n if (isset($this->_customdata['wday'])) {\n $mform->setDefault('wday', $this->_customdata['wday']);\n } else {\n $mform->setDefault('wday', -1);\n }\n\n //now add the group to the form\n $mform->addGroup($timingdets, 'timings', get_string('timingsprompt', 'tool_servercron'), array(' '), false);\n\n //servercron title\n $mform->addElement('text', 'commandline', get_string('commandprompt', 'tool_servercron'), array('size' => 100));\n $mform->setDefault('commandline', $this->_customdata['commandline']);\n $mform->setType('commandline', PARAM_TEXT);\n\n //buttons\n $buttonarray=array();\n $buttonarray[] = $mform->createElement('submit', 'save', get_string('cronjobsave', 'tool_servercron'));\n\n if ($editing) {\n $buttonarray[] = $mform->createElement('cancel', 'cancel', get_string('croneditcancel', 'tool_servercron'));\n }\n\n $buttonarray[] = $mform->createElement('reset', 'resetbutton', get_string('cronjobreset', 'tool_servercron'));\n $mform->addGroup($buttonarray, 'buttonar', '', array(' '), false);\n\n }",
"public function action_index()\n\t{\n\t\t$type = 'week';\n\n\t\t$settings = array\n\t\t(\n\t\t\t'_label' => 'Week 1',\n\t\t\t'_namespace' => 'mmi',\n\t\t\t'class' => 'week',\n\t\t\t'id' => 'week1',\n\t\t\t'required' => 'required',\n\t\t\t'step' => 3,\n\t\t\t'value' => '1970-W01'\n\t\t);\n\t\t$field = MMI_Form_Field::factory($type, $settings);\n\t\t$this->_form->add_field($field);\n\t\tif ($this->debug)\n\t\t{\n\t\t\tMMI_Debug::dump($field->render(), $type.' (step 3)');\n\t\t}\n\n\t\t$settings = array_merge($settings, array\n\t\t(\n\t\t\t'_after' => '2010-W10',\n\t\t\t'_before' => '2010-W01',\n\t\t\t'_label' => 'Week 2',\n\t\t\t'id' => 'week2',\n\t\t\t'max' => '2010-W10',\n\t\t\t'min' => '2010-W01',\n\t\t\t'required' => FALSE,\n\t\t\t'step' => 1,\n\t\t\t'value' => '',\n\t\t));\n\t\t$field = MMI_Form_Field::factory($type, $settings);\n\t\t$this->_form->add_field($field);\n\t\tif ($this->debug)\n\t\t{\n\t\t\tMMI_Debug::dump($field->render(), $type.' (min 2010-W01; max 2010-W10; step 1)');\n\t\t}\n\n\t\t$settings = array_merge($settings, array\n\t\t(\n\t\t\t'_before' => '2010-W10',\n\t\t\t'_label' => 'Week 3',\n\t\t\t'id' => 'week3',\n\t\t\t'min' => '2010-W10',\n\t\t\t'step' => 2,\n\t\t));\n\t\tunset($settings['_after'], $settings['max']);\n\t\t$field = MMI_Form_Field::factory($type, $settings);\n\t\t$this->_form->add_field($field);\n\t\tif ($this->debug)\n\t\t{\n\t\t\tMMI_Debug::dump($field->render(), $type.' (min 2010-W10; step 2)');\n\t\t}\n\n\t\t$settings = array_merge($settings, array\n\t\t(\n\t\t\t'_after' => '2010-W30',\n\t\t\t'_label' => 'Week 4',\n\t\t\t'id' => 'week4',\n\t\t\t'max' => '2010-W30',\n\t\t\t'step' => 4,\n\t\t));\n\t\tunset($settings['_before'], $settings['min']);\n\t\t$field = MMI_Form_Field::factory($type, $settings);\n\t\t$this->_form->add_field($field);\n\t\tif ($this->debug)\n\t\t{\n\t\t\tMMI_Debug::dump($field->render(), $type.' (max 2010-W30; step 4)');\n\t\t}\n\t}",
"public function display() {\r\n\t\t$this->echoOptionHeader();\r\n\t\t$dateFormat = 'Y-m-d H:i';\r\n\t\t$placeholder = 'YYYY-MM-DD HH:MM';\r\n\t\tif ( $this->settings['date'] && ! $this->settings['time'] ) {\r\n\t\t\t$dateFormat = 'Y-m-d';\r\n\t\t\t$placeholder = 'YYYY-MM-DD';\r\n\t\t} else if ( ! $this->settings['date'] && $this->settings['time'] ) {\r\n\t\t\t$dateFormat = 'H:i';\r\n\t\t\t$placeholder = 'HH:MM';\r\n\t\t}\r\n\r\n\t\tprintf('<input class=\"input-date%s%s\" name=\"%s\" placeholder=\"%s\" id=\"%s\" type=\"text\" value=\"%s\" /> <p class=\"description\">%s</p>',\r\n\t\t\t( $this->settings['date'] ? ' date' : '' ),\r\n\t\t\t( $this->settings['time'] ? ' time' : '' ),\r\n\t\t\t$this->getID(),\r\n\t\t\t$placeholder,\r\n\t\t\t$this->getID(),\r\n\t\t\tesc_attr( ($this->getValue() > 0) ? date( $dateFormat, $this->getValue() ) : '' ),\r\n\t\t\t$this->settings['desc']\r\n\t\t);\r\n\t\t$this->echoOptionFooter( false );\r\n\t}",
"public function store(Request $request)\n {\n $user = Auth::user();\n $request->validate([\n 'day' => 'required',\n 'hours' => 'required',\n 'date' => 'required',\n 'beginTime' =>'required',\n 'endTime' => 'required'\n ]);\n $post = new HourRegistration;\n $post->day = $request->input('day');\n $post->hours = $request->input('hours');\n $post->date = $request->input('date');\n $post->beginTime = $request->input('beginTime');\n $post->endTime = $request->input('endTime');\n $post->user_id = $user->id;\n $post->save();\n return redirect('/hour')->with('success', 'hours registrated');\n }"
] |
[
"0.6895228",
"0.68171686",
"0.6501523",
"0.6459398",
"0.6159871",
"0.60723937",
"0.58005345",
"0.5797527",
"0.576037",
"0.5644328",
"0.56383157",
"0.56072503",
"0.5569095",
"0.5567277",
"0.5497378",
"0.54799515",
"0.54545826",
"0.5410693",
"0.54030514",
"0.53998137",
"0.5328667",
"0.5303522",
"0.52776223",
"0.52728194",
"0.5239608",
"0.5224662",
"0.5223548",
"0.52142406",
"0.52041405",
"0.51912266"
] |
0.68593484
|
1
|
Form validation for the Hours / Daily Hours configuration page.
|
function room_reservations_admin_settings_daily_hours_validate($form_id, &$form_state) {
if ($form_state['clicked_button']['#value'] == t('Save configuration')) {
$month_value = $form_state['values']['month'];
$month = intval(drupal_substr($month_value, 5));
$year = drupal_substr($month_value, 0, 4);
// Days in the month.
$days = date('t', mktime(0, 0, 0, $month, 1, $year));
for ($day = 0; $day < $days; $day++) {
// Day of the week.
$dow = date('l', mktime(0, 0, 0, $month, $day + 1, $year));
// Day of month.
$dom = $day + 1;
$open = TRUE;
$second_shift = FALSE;
$first_shift_open
= $form_state['values']['day_' . $day]['first_shift_open_' . $day];
$first_shift_close
= $form_state['values']['day_' . $day]['first_shift_close_' . $day];
$second_shift_open
= $form_state['values']['day_' . $day]['second_shift_open_' . $day];
$second_shift_close
= $form_state['values']['day_' . $day]['second_shift_close_' . $day];
$int_first_shift_open
= intval(
$form_state['values']['day_' . $day]['first_shift_open_' . $day]);
$int_first_shift_close
= intval(
$form_state['values']['day_' . $day]['first_shift_close_' . $day]);
$int_second_shift_open
= intval(
$form_state['values']['day_' . $day]['second_shift_open_' . $day]);
$int_second_shift_close
= intval(
$form_state['values']['day_' . $day]['second_shift_close_' . $day]);
// Closed.
if (($int_first_shift_open == 9999) &&
($int_first_shift_close == 9999) &&
($int_second_shift_open == 9999) &&
($int_second_shift_close == 9999)) {
$open = FALSE;
}
// First shift.
if ($open) {
if ($int_first_shift_open == 9999) {
$field = 'day_' . $day . '][first_shift_open_' . $day;
$message = t('!day - First shift open is required.',
array('!day' => $dom . ' ' . $dow));
form_set_error($field, check_plain($message));
}
elseif ($int_first_shift_close == 9999) {
$field = 'day_' . $day . '][first_shift_close_' . $day;
$message = t('!day - First shift close is required.',
array('!day' => $dom . ' ' . $dow));
form_set_error($field, check_plain($message));
}
elseif ($int_first_shift_open >= $int_first_shift_close) {
$field = 'day_' . $day . '][first_shift_close_' . $day;
$message = t('!day - First shift close must be later than first shift
open.', array('!day' => $dom . ' ' . $dow));
form_set_error($field, check_plain($message));
}
}
// Second shift.
if ($open) {
if (($int_second_shift_open != 9999) ||
($int_second_shift_close != 9999)) {
$second_shift = TRUE;
}
}
if ($second_shift) {
if (($int_first_shift_open == 9999) &&
($int_first_shift_close == 9999)) {
$field = 'day_' . $day . '][second_shift_open_' . $day;
$message = t('!day - Cannot have a second shift without a first
shift.', array('!day' => $dom . ' ' . $dow));
form_set_error($field, check_plain($message));
}
elseif ($int_second_shift_open == 9999) {
$field = 'day_' . $day . '][second_shift_open_' . $day;
$message = t('!day - Second shift open is missing.',
array('!day' => $dom . ' ' . $dow));
form_set_error($field, check_plain($message));
}
elseif ($int_second_shift_close == 9999) {
$field = 'day_' . $day . '][second_shift_close_' . $day;
$message = t('!day - Second shift close is missing.',
array('!day' => $dom . ' ' . $dow));
form_set_error($field, check_plain($message));
}
elseif ($int_second_shift_open <= $int_first_shift_close) {
$field = 'day_' . $day . '][second_shift_open_' . $day;
$message = t('!day - Second shift open must be later than first
shift close.', array('!day' => $dom . ' ' . $dow));
form_set_error($field, check_plain($message));
}
elseif ($int_second_shift_open >= $int_second_shift_close) {
$field = 'day_' . $day . '][second_shift_close_' . $day;
$message = t('!day - Second shift close must be later than second
shift opten.', array('!day' => $dom . ' ' . $dow));
form_set_error($field, check_plain($message));
}
}
}
}
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function room_reservations_admin_settings_default_hours_validate($form_id, &$form_state) {\n $days = array(\n t('Sunday'),\n t('Monday'),\n t('Tuesday'),\n t('Wednesday'),\n t('Thursday'),\n t('Friday'),\n t('Saturday'),\n );\n if ($form_state['clicked_button']['#value'] == t('Save configuration')) {\n for ($day = 0; $day < 7; $day++) {\n $open = TRUE;\n $second_shift = FALSE;\n $first_shift_open\n = $form_state['values']['day_' . $day]['first_shift_open_' . $day];\n $first_shift_close\n = $form_state['values']['day_' . $day]['first_shift_close_' . $day];\n $second_shift_open\n = $form_state['values']['day_' . $day]['second_shift_open_' . $day];\n $second_shift_close\n = $form_state['values']['day_' . $day]['second_shift_close_' . $day];\n $int_first_shift_open\n = intval(\n $form_state['values']['day_' . $day]['first_shift_open_' . $day]);\n $int_first_shift_close\n = intval(\n $form_state['values']['day_' . $day]['first_shift_close_' . $day]);\n $int_second_shift_open\n = intval(\n $form_state['values']['day_' . $day]['second_shift_open_' . $day]);\n $int_second_shift_close\n = intval(\n $form_state['values']['day_' . $day]['second_shift_close_' . $day]);\n // Closed.\n if (($int_first_shift_open == 9999) && \n ($int_first_shift_close == 9999) && \n ($int_second_shift_open == 9999) && \n ($int_second_shift_close == 9999)) {\n $open = FALSE;\n }\n // First shift.\n if ($open) {\n if ($int_first_shift_open == 9999) {\n $field = 'day_' . $day . '][first_shift_open_' . $day;\n $message = t('!day - First shift open is required.', \n array('!day' => $days[$day]));\n form_set_error($field, check_plain($message));\n }\n elseif ($int_first_shift_close == 9999) {\n $field = 'day_' . $day . '][first_shift_close_' . $day;\n $message = t('!day - First shift close is required.', \n array('!day' => $days[$day]));\n form_set_error($field, check_plain($message));\n }\n elseif ($int_first_shift_open >= $int_first_shift_close) {\n $field = 'day_' . $day . '][first_shift_close_' . $day;\n $message = t('!day - First shift close must be later than first shift\n open.', array('!day' => $days[$day]));\n form_set_error($field, check_plain($message));\n }\n }\n // Second shift.\n if ($open) {\n if (($int_second_shift_open != 9999) || \n ($int_second_shift_close != 9999)) {\n $second_shift = TRUE;\n }\n }\n if ($second_shift) {\n if (($int_first_shift_open == 9999) && \n ($int_first_shift_close == 9999)) {\n $field = 'day_' . $day . '][second_shift_open_' . $day;\n $message = t('!day - Cannot have a second shift without a first\n shift.', array('!day' => $days[$day]));\n form_set_error($field, check_plain($message));\n }\n elseif ($int_second_shift_open == 9999) {\n $field = 'day_' . $day . '][second_shift_open_' . $day;\n $message = t('!day - Second shift open is missing.', \n array('!day' => $days[$day]));\n form_set_error($field, check_plain($message));\n }\n elseif ($int_second_shift_close == 9999) {\n $field = 'day_' . $day . '][second_shift_close_' . $day;\n $message = t('!day - Second shift close is missing.', \n array('!day' => $days[$day]));\n form_set_error($field, check_plain($message));\n }\n elseif ($int_second_shift_open <= $int_first_shift_close) {\n $field = 'day_' . $day . '][second_shift_open_' . $day;\n $message = t('!day - Second shift open must be later than first\n shift close.', array('!day' => $days[$day]));\n form_set_error($field, check_plain($message));\n }\n elseif ($int_second_shift_open >= $int_second_shift_close) {\n $field = 'day_' . $day . '][second_shift_close_' . $day;\n $message = t('!day - Second shift close must be later than second\n shift opten.', array('!day' => $days[$day]));\n form_set_error($field, check_plain($message));\n }\n }\n }\n }\n}",
"public function rules() {\n\t\treturn [\n\t\t\t'date' => 'required|date',\n\t\t\t'startHour' => 'required|date_format:H:i',\n\t\t\t'endHour' => 'required|date_format:H:i',\n 'max_participants' => 'required|integer|min:0',\n ];\n\t}",
"public function hoursForm($result)\n {\n if ( !$this->ownerLoggedIn() )\n {\n $this->restricted();\n return;\n }\n\n require_once('views/HoursView.class.php'); \n require_once('views/FormError.class.php');\n \n $site = new SiteContainer($this->db);\n $message = new FormError();\n \n $hv = new HoursView();\n\n $site->printHeader();\n $site->printNav(\"owner\");\n \n if ($result == \"bad_time\")\n $message->printHtml(array(\"bad_time\"));\n \n $hv->printHtml($result);\n $site->printFooter(); \n }",
"function room_reservations_admin_settings_default_hours($form, &$form_state) {\n $hours = _room_reservations_hours();\n // Select box options.\n $options = array();\n $options['9999'] = t('Select the time');\n $options['0000'] = t('Midnight - start of day');\n foreach ($hours as $hour) {\n $time = $hour['time'];\n $display = t($hour['display']);\n if ($time != '0000') {\n $options[$time] = $display;\n }\n }\n $options['2400'] = t('Midnight - end of day');\n // Get saved default hours.\n $default_hours\n = unserialize(_room_reservations_get_variable('default_hours'));\n if (!$default_hours) {\n for ($x = 0; $x < 28; $x++) {\n $default_hours[$x] = '9999';\n }\n }\n $days = array(\n t('Sunday'),\n t('Monday'),\n t('Tuesday'),\n t('Wednesday'),\n t('Thursday'),\n t('Friday'),\n t('Saturday'),\n );\n $form['#tree'] = TRUE;\n for ($day = 0; $day < 7; $day++) {\n $day_hours = array();\n $day_hours[] = $default_hours[($day * 4)];\n $day_hours[] = $default_hours[($day * 4) + 1];\n $day_hours[] = $default_hours[($day * 4) + 2];\n $day_hours[] = $default_hours[($day * 4) + 3];\n $display_hours = _room_reservations_hours_display($day_hours);\n $form['day_' . $day] = array(\n '#type' => 'fieldset',\n '#title' => $days[$day] . ' (' . $display_hours . ')',\n '#collapsible' => TRUE,\n '#collapsed' => TRUE,\n '#weight' => -90 + ($day * 10),\n );\n $form['day_' . $day]['first_shift_open_' . $day] = array(\n '#title' => t('First shift open'),\n '#type' => 'select',\n '#options' => $options,\n '#default_value' => $default_hours[($day * 4)],\n '#weight' => -90 + ($day * 10) + 1,\n );\n $form['day_' . $day]['first_shift_close_' . $day] = array(\n '#title' => t('First shift close'),\n '#type' => 'select',\n '#options' => $options,\n '#default_value' => $default_hours[($day * 4) + 1],\n '#weight' => -90 + ($day * 10) + 2,\n );\n $form['day_' . $day]['second_shift_open_' . $day] = array(\n '#title' => t('Second shift open'),\n '#type' => 'select',\n '#options' => $options,\n '#default_value' => $default_hours[($day * 4) + 2],\n '#weight' => -90 + ($day * 10) + 3,\n );\n $form['day_' . $day]['second_shift_close_' . $day] = array(\n '#title' => t('Second shift close'),\n '#type' => 'select',\n '#options' => $options,\n '#default_value' => $default_hours[($day * 4) + 3],\n '#weight' => -90 + ($day * 10) + 4,\n );\n }\n $form['save'] = array(\n '#type' => 'submit',\n '#value' => t('Save configuration'),\n '#weight' => 100,\n );\n $form['reset'] = array(\n '#type' => 'submit',\n '#value' => t('Reset to defaults'),\n '#weight' => 101,\n );\n return $form;\n}",
"function room_reservations_admin_settings_reminders_validate($form_id, &$form_state) {\n if ($form_state['clicked_button']['#value'] == t('Save configuration')) {\n $reminder_time = $form_state['values']['reminder_time'];\n $reminder_cutoff = $form_state['values']['reminder_cutoff'];\n if ($reminder_time < $reminder_cutoff) {\n $field = 'reminder_time';\n $message = t(\"'Send reminder daily at' time cannot be earlier than 'Send reminders for reservations created before' time.\");\n form_set_error($field, check_plain($message));\n }\n }\n}",
"public function rules()\n\t{\n\t\t$rules = [\n\t\t\t'date'\t\t=> 'required|date|date_format:\"d.m.Y\"',\n\t\t\t'hour'\t\t=> 'required|numeric|min:8|max:20',\n\t\t\t'minute'\t=> 'required|numeric|min:0|max:60'\n\t\t];\n\n\t\t$event_id = $this->route()->parameter('event_id');\n\t\t$eventRepo = \\App::make('App\\Models\\Event\\EventRepository');\n\n\t\t$event = $eventRepo->findById($event_id);\n\n\t\t// if date is not between start and end date\n\t\tif (! (strtotime($event->start_date) <= strtotime(\\Input::get('date')) && strtotime(\\Input::get('date')) <= strtotime($event->end_date) )){\n\t\t\t$rules['valid_date'] = 'required';\n\t\t}\n\n\t\treturn $rules;\n\t}",
"function entry_api_ui_event_form_validate($form, &$form_state) {\n\n $values = $form_state['values'];\n\n // Validate publication date.\n if ($values['publication_date']) {\n try {\n CultureFeed_Cdb_Data_Calendar::validateDate($values['publication_date']);\n }\n catch (Exception $e) {\n form_set_error('publication_date', 'Gelieve een geldige publicatie datum in te geven');\n }\n }\n\n // Validate age.\n if ($values['age'] && !is_numeric($values['age'])) {\n form_set_error('age', 'Gelieve een geldige leeftijd in te voeren');\n }\n\n // Validate timestamps.\n if ($values['when'] == 'one_day' || $values['when'] == 'multiple_days') {\n\n // Only one timestamp saved for one day.\n if ($values['when'] == 'one_day') {\n $form_state['values']['timestamps'] = array($values['timestamps'][0]);\n $values['timestamps'] = $form_state['values']['timestamps'];\n }\n\n foreach ($values['timestamps'] as $key => $timestamp) {\n try {\n\n // Empty start dates are ignored.\n if (empty($timestamp['start_date'])) {\n continue;\n }\n\n CultureFeed_Cdb_Data_Calendar::validateDate($timestamp['start_date']);\n\n if (!empty($timestamp['end_time'])) {\n CultureFeed_Cdb_Data_Calendar::validateTime($timestamp['end_time']);\n }\n if (!empty($timestamp['start_time'])) {\n CultureFeed_Cdb_Data_Calendar::validateTime($timestamp['start_time']);\n }\n }\n catch (UnexpectedValueException $e) {\n form_set_error('timestamps][' . $key, 'Gelieve een geldige tijd en datum in te geven.');\n }\n }\n }\n\n if ($values['when'] == 'period' || $values['when'] == 'permanent') {\n\n // Validate the weekscheme.\n if (!$values['period_or_permanent']['all_day']) {\n foreach ($values['period_or_permanent']['opening_times'] as $day => $opening_times) {\n foreach ($opening_times as $key => $opening_time) {\n\n if (!empty($opening_time['open_from']) || !empty($opening_time['open_till'])) {\n try {\n CultureFeed_Cdb_Data_Calendar::validateTime($opening_time['open_from']);\n CultureFeed_Cdb_Data_Calendar::validateTime($opening_time['open_till']);\n }\n catch (Exception $e) {\n form_set_error('period_or_permanent][opening_times][' . $day . '][' . $key, 'Gelieve een geldige tijd in te geven.');\n }\n }\n\n }\n }\n }\n\n }\n\n // Validate location.\n if (!empty($values['location'])) {\n\n $location_label = $search_string = $values['location'];\n if (preg_match(\"|-|\", $location_label)) {\n list($search_string, $zip) = explode(\"-\", $location_label);\n }\n\n // Perform a search on location to check if this is an existing actor.\n try {\n $location = culturefeed_search_item_load_by_title($search_string, 'actor');\n if (!$location) {\n form_set_error('location', 'Gelieve een correcte locatie in te voeren.');\n }\n }\n catch (Exception $e) {\n form_set_error('location', 'Er was een fout bij het valideren van de locatie');\n }\n }\n\n // Validate organiser.\n if (!empty($values['organiser'])) {\n\n $organiser_label = $search_string = $values['organiser'];\n if (preg_match(\"|-|\", $organiser_label)) {\n list($search_string, $zip) = explode(\"-\", $organiser_label);\n }\n\n try {\n $organiser = culturefeed_search_item_load_by_title($search_string, 'actor');\n if (!$organiser) {\n form_set_error('organiser', 'Gelieve een correcte organisatie in te voeren.');\n }\n }\n catch (Exception $e) {\n watchdog_exception('entry_api_ui', $e);\n form_set_error('organiser', 'Er was een fout bij het valideren van de organisator');\n }\n\n }\n\n $errors = form_get_errors();\n if (empty($errors)) {\n _entryapi_ui_event_form_save_event($form, $form_state, $location, $organiser);\n }\n\n}",
"function validate_date_time_picker_field($field)\n {\n }",
"function room_reservations_admin_settings_daily_hours_submit($form_id, &$form_state) {\n // Select month.\n if ($form_state['clicked_button']['#value'] == t('Select a month')) {\n $form_state['redirect']\n = 'admin/config/system/room_reservations/hours/daily_hours/' .\n $form_state['values']['month'];\n }\n // Process the daily hours for the selected month.\n elseif ($form_state['clicked_button']['#value'] == t('Save configuration')) {\n $confirmation = ROOM_RESERVATIONS_SAVE_CONFIRMATION_MSG;\n $error = ROOM_RESERVATIONS_SAVE_ERROR_MSG;\n $month_value = $form_state['values']['month'];\n $month = intval(drupal_substr($month_value, 5));\n $year = drupal_substr($month_value, 0, 4);\n // Days in the month.\n $days = date('t', mktime(0, 0, 0, $month, 1, $year));\n $mo_hours = unserialize(_room_reservations_get_variable('monthly_hours_' . $month_value));\n $updated_mo_hours = array();\n $default_hours = unserialize(_room_reservations_get_variable('default_hours'));\n for ($day = 0; $day < $days; $day++) {\n // User entered hours for a single day.\n $day_first_open = $form_state['values']['day_' . $day]['first_shift_open_' . $day];\n $day_first_close = $form_state['values']['day_' . $day]['first_shift_close_' . $day];\n $day_second_open = $form_state['values']['day_' . $day]['second_shift_open_' . $day];\n $day_second_close = $form_state['values']['day_' . $day]['second_shift_close_' . $day];\n // Default hours for the day of the week.\n // Day of week.\n $dow = date('w', mktime(0, 0, 0, $month, $day + 1, $year));\n $default_first_open = $default_hours[($dow * 4) + 0];\n $default_first_close = $default_hours[($dow * 4) + 1];\n $default_second_open = $default_hours[($dow * 4) + 2];\n $default_second_close = $default_hours[($dow * 4) + 3];\n // Compare user entered hours to default for the day of the week.\n if (($day_first_open == $default_first_open) && \n ($day_first_close == $default_first_close) && \n ($day_second_open == $default_second_open) && \n ($day_second_close == $default_second_close)) {\n $day_is_default = TRUE;\n }\n else {\n $day_is_default = FALSE;\n }\n // Update the monthly hours record.\n $updated_mo_hours[($day * 5)] = ($day_is_default) ? 'D' : 'O';\n $updated_mo_hours[($day * 5) + 1] = $day_first_open;\n $updated_mo_hours[($day * 5) + 2] = $day_first_close;\n $updated_mo_hours[($day * 5) + 3] = $day_second_open;\n $updated_mo_hours[($day * 5) + 4] = $day_second_close;\n }\n $result = _room_reservations_set_variable('monthly_hours_' . $month_value, serialize($updated_mo_hours));\n if ($result) {\n drupal_set_message(check_plain($confirmation));\n }\n else {\n drupal_set_message(check_plain($error), 'error');\n }\n }\n // Reset the month to the default hours.\n elseif ($form_state['clicked_button']['#value'] == t('Reset to defaults')) {\n $confirmation = ROOM_RESERVATIONS_RESET_CONFIRMATION_MSG;\n $error = ROOM_RESERVATIONS_RESET_ERROR_MSG;\n $month_value = $form_state['values']['month'];\n $month = intval(drupal_substr($month_value, 5));\n $year = drupal_substr($month_value, 0, 4);\n $result = _room_reservations_create_mo_hours($year, $month, $month_value);\n if ($result) {\n drupal_set_message(check_plain($confirmation));\n }\n else {\n drupal_set_message(check_plain($error), 'error');\n }\n }\n}",
"function room_reservations_admin_settings_validate($form_id, &$form_state) {\n if ($form_state['clicked_button']['#value'] == t('Save configuration')) {\n // Open reservations per user.\n $data = $form_state['values']['room_reservations_reservations_per_user'];\n if (!ctype_digit($data)) {\n $field = 'room_reservations_reservations_per_user';\n $message = t('Open reservations per user must be numeric.');\n form_set_error($field, check_plain($message));\n }\n // Reservations per day.\n $data = $form_state['values']['room_reservations_reservations_per_day'];\n if (!ctype_digit($data)) {\n $field = 'room_reservations_reservations_per_day';\n $message = t('Reservations per day must be numeric.');\n form_set_error($field, check_plain($message));\n }\n }\n}",
"public function rules()\n {\n\n //This is a DIY sort of way to make sure that total weekly hours worked is not above 48h\n $total = request()->monday + request()->tuesday + request()->wednesday + request()->thursday + request()->friday + request()->saturday;\n\n if($total > 48) {\n return [\n 'monday' => 'max:-1',\n ];\n }\n\n return [\n 'monday' => 'required|numeric|between:0,12',\n 'tuesday' => 'required|numeric|between:0,12',\n 'wednesday' => 'required|numeric|between:0,12',\n 'thursday' => 'required|numeric|between:0,12',\n 'friday' => 'required|numeric|between:0,12',\n 'saturday' => 'required|numeric|between:0,12',\n ];\n }",
"function options_validate($form, &$form_state) {\r\n parent::options_validate($form, $form_state);\r\n \r\n if ($form_state['values']['form_id'] == 'views_ui_config_item_form') {\r\n $check_fields = array_filter($form_state['values']['options']['date_fields']);\r\n if (empty($check_fields)) {\r\n form_error($form['date_fields'], t('You must select at least one date field for this argument.'));\r\n }\r\n if (!preg_match('@\\-[0-9]*:[\\+|\\-][0-9]*@', $form_state['values']['options']['year_range']) \r\n && !preg_match('@[0-9]{4}:[0-9]{4}@', $form_state['values']['options']['year_range'])) {\r\n form_error($form['year_range'], t('Date year range must be in the format -9:+9 or 2005:2010.'));\r\n }\r\n }\r\n }",
"public function rules()\n {\n return [\n //\n 'plate' => ['required','string','size:8', new Plate],\n 'date' => ['required','string','min:9','max:10', new Date],\n 'hour' => ['required','string','max:5', 'regex:/^([01]?[0-9]|2[0-3]):[0-5][0-9]$/']\n ];\n }",
"function validHours($hours)\n {\n return $hours >= 1 && $hours <= 4;\n }",
"public function rules()\n {\n $this->session()->flash('errorDatTour', true);\n return [\n 'thoigianbatdau'=>'required|date',\n 'sokhachdangky'=>'required',\n ];\n }",
"public function generate_hours() {\n\n\t\t\t$schema = get_theme_mod( 'schema' );\n\n\t\t\t$hours = isset( $schema['openingHoursSpecification'] ) ? $schema['openingHoursSpecification'] : false;\n\n\t\t\tif ( !$hours ) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\t\n\t\t\t$DAYS = array( 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday' );\n\t\t\t\n\t\t\tforeach( $DAYS as $day ) {\n\t\t\t\tforeach( $hours as $period ) {\n\t\t\t\t\tif ( in_array( $day, $period['dayOfWeek'] ) ) {\n\t\t\t\t\t\tif ( '00:00' === $period['opens'] ) {\n\t\t\t\t\t\t\tif ( '00:00' === $period['closes'] ) {\n\t\t\t\t\t\t\t\t$return[$day][0] = 'Closed';\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif ( '23:59' === $period['closes'] ) {\n\t\t\t\t\t\t\t\t$return[$day][0] = 'Open 24 hours';\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t$return[$day][0] = $period['opens'];\n\t\t\t\t\t\t$return[$day][1] = $period['closes'];\n\t\t\t\t\t}\n\t\t\t\t}\t\t\t\t\n\t\t\t}\n\n\t\t\treturn $return;\n\t\t}",
"function recommends_req_wizard_schools_info_validate($form, &$form_state) {\n\n for ($i = 1; $i <= $form_state['num_schools']; $i++) {\n \n $date_due_month = $form_state['values']['schname'][$i]['r_date_due']['month'];\n $date_due_day = $form_state['values']['schname'][$i]['r_date_due']['day'];\n $date_due_year = $form_state['values']['schname'][$i]['r_date_due']['year'];\n \n $d2=mktime(0,0,0,$date_due_month,$date_due_day,$date_due_year);\n $d1=time();\n $days_diff = floor(($d2-$d1)/86400);\n if ($days_diff < 30 ) {\n form_set_error(\"schname][$i][r_date_due\", 'The due date must be at least 30 days from today. Please contact the professor to discuss exceptions.');\n }\n\n }\n}",
"public function validate($element, FormStateInterface $form_state){\n // Accept a blank (empty) value\n $value = $element['#value'];\n if (strlen($value) == 0) {\n $form_state->setValueForElement($element, '');\n return;\n }\n\n // Intervals\n if( $this->getSetting('intervals') ){\n if(strpos($value, 'T') !== false){\n $form_state->setError($element, t(\"Date intervals cannot include times.\"));\n }\n\n list($begin, $end) = explode('/',$value);\n // begin\n $error_message = $this->dateValidation($begin);\n if($error_message){\n $form_state->setError($element, t($error_message));\n }\n // end either empty or valid extended interval values (5.2.3.)\n if(empty($end) || $end === 'unknown' || $end === 'open'){\n return;\n }\n $error_message = $this->dateValidation($end);\n if($error_message){\n $form_state->setError($element, t($error_message));\n }\n } else {\n $error_message = $this->dateValidation($value);\n if($error_message){\n $form_state->setError($element, t($error_message));\n }\n }\n\n return;\n }",
"function aegean_epay_settings_validate($form, &$form_state) {\n $payment_options = aegean_epay_parse_payment_options($form_state['values']['aegean_epay_payment_options']);\n foreach ($payment_options as $option) {\n if (empty($option['participant_el']) || !is_string($option['participant_el'])) {\n form_set_error('aegean_epay_payment_options', 'The \"Participant el\" value must be a valid string.');\n }\n if (empty($option['participant_en']) || !is_string($option['participant_en'])) {\n form_set_error('aegean_epay_payment_options', 'The \"Participant en\" value must be a valid string.');\n }\n if (empty($option['amount']) || !is_numeric($option['amount'])) {\n form_set_error('aegean_epay_payment_options', 'The \"Amount\" value must be numeric.');\n }\n if (empty($option['deadline']) || !preg_match(\"/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$/\", $option['deadline'])) {\n form_set_error('aegean_epay_payment_options', 'The \"Deadline\" value must be in the format of YYYY-MM-DD.');\n }\n }\n}",
"public function rules()\n {\n return [\n // 'break_start' => \"required|date_format:h:i A\",\n // 'break_end' => \"required|date_format:h:i A\",\n 'start' => \"required|date_format:g:i A\",\n 'end' => \"required|date_format:g:i A\",\n 'sunday_subject' => \"nullable|integer\",\n 'sunday_teacher' => \"nullable|integer\",\n 'monday_subject' => \"nullable|integer\",\n 'monday_teacher' => \"nullable|integer\",\n 'tuesday_subject' => \"nullable|integer\",\n 'tuesday_teacher' => \"nullable|integer\",\n 'wednesday_subject'=> \"nullable|integer\",\n 'wednesday_teacher'=> \"nullable|integer\",\n 'thursday_subject' => \"nullable|integer\",\n 'thursday_teacher' => \"nullable|integer\",\n 'friday_subject' => \"nullable|integer\",\n 'friday_teacher' => \"nullable|integer\",\n 'saturday_subject' => \"nullable|integer\",\n 'saturday_teacher' => \"nullable|integer\",\n ];\n }",
"public function rules()\n {\n return [\n //\n 'fecha' => 'required|unique:fechas_foros,fecha|date|after_or_equal:' . Carbon::now()->toDateString(),\n 'hora_inicio' => 'required|date_format:H:i',\n 'hora_termino' => 'required|date_format:H:i|after:hora_inicio'\n ];\n }",
"public function checkInput()\n\t{\n\t\tglobal $lng;\n\t\t\n\t\tif($this->getDisabled())\n\t\t{\n\t\t\treturn true;\n\t\t}\n\t\t\n\t\t$post = $_POST[$this->getPostVar()];\n\t\tif(!is_array($post))\n\t\t{\n\t\t\treturn false;\n\t\t}\n\t\t\n\t\t$start = $post[\"start\"];\n\t\t$end = $post[\"end\"];\n\t\t\n\t\t// if full day is active, ignore time format\n\t\t$format = $post['tgl']\n\t\t\t? 0\n\t\t\t: $this->getDatePickerTimeFormat();\n\t\t\n\t\t// always done to make sure there are no obsolete values left\n\t\t$this->setStart(null);\n\t\t$this->setEnd(null);\n\t\t\n\t\t$valid_start = false;\n\t\tif(trim($start))\n\t\t{\n\t\t\t$parsed = ilCalendarUtil::parseIncomingDate($start, $format);\n\t\t\tif($parsed)\n\t\t\t{\t\t\t\t\t\t\t\t\t\n\t\t\t\t$this->setStart($parsed);\n\t\t\t\t$valid_start = true;\n\t\t\t}\t\t\t\t\t\t\n\t\t}\n\t\telse if(!$this->getRequired() && !trim($end))\n\t\t{\n\t\t\t$valid_start = true;\t\t\t\n\t\t}\n\t\t\t\t\t\t\t\t\n\t\t$valid_end = false;\t\t\n\t\tif(trim($end))\n\t\t{\t\t\t\n\t\t\t$parsed = ilCalendarUtil::parseIncomingDate($end, $format);\t\t\n\t\t\tif($parsed)\n\t\t\t{\n\t\t\t\t$this->setEnd($parsed);\n\t\t\t\t$valid_end = true;\n\t\t\t}\t\t\t\t\t\n\t\t}\n\t\telse if(!$this->getRequired() && !trim($start))\n\t\t{\t\t\t\t\t\n\t\t\t$valid_end = true;\t\t\t\n\t\t}\n\t\t\n\t\tif($this->getStartYear())\n\t\t{\n\t\t\tif($valid_start && \n\t\t\t\t$this->getStart()->get(IL_CAL_FKT_DATE, \"Y\") < $this->getStartYear())\n\t\t\t{\n\t\t\t\t$valid_start = false;\n\t\t\t}\n\t\t\tif($valid_end && \n\t\t\t\t$this->getEnd()->get(IL_CAL_FKT_DATE, \"Y\") < $this->getStartYear())\n\t\t\t{\n\t\t\t\t$valid_end = false;\n\t\t\t}\n\t\t}\n\t\t\n\t\t$valid = ($valid_start && $valid_end);\t\n\t\t\n\t\tif($valid && \n\t\t\t$this->getStart() && \n\t\t\t$this->getEnd() &&\n\t\t\tilDateTime::_after($this->getStart(), $this->getEnd()))\t\t\t\n\t\t{\n\t\t\t$valid = false;\t\t\t\n\t\t}\n\t\t\n\t\tif(!$valid)\n\t\t{\n\t\t\t$this->invalid_input_start = $start;\n\t\t\t$this->invalid_input_end = $end;\n\t\t\t\n\t\t\t$_POST[$this->getPostVar()][\"start\"] = null;\n\t\t\t$_POST[$this->getPostVar()][\"end\"] = null;\n\t\t\t\n\t\t\t$this->setAlert($lng->txt(\"form_msg_wrong_date\"));\n\t\t}\t\n\t\telse\n\t\t{\t\t\t\n\t\t\tif($this->getStart() &&\n\t\t\t\t$this->getEnd())\n\t\t\t{\n\t\t\t\t// getInput() should return a generic format\t\n\t\t\t\t$post_format = $format\n\t\t\t\t\t? IL_CAL_DATETIME\n\t\t\t\t\t: IL_CAL_DATE;\t\t\t\n\t\t\t\t$_POST[$this->getPostVar()][\"start\"] = $this->getStart()->get($post_format);\n\t\t\t\t$_POST[$this->getPostVar()][\"end\"] = $this->getEnd()->get($post_format);\t\t\t\t\n\t\t\t\tunset($_POST[$this->getPostVar()][\"tgl\"]);\t\t\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$_POST[$this->getPostVar()][\"start\"] = null;\n\t\t\t\t$_POST[$this->getPostVar()][\"end\"] = null;\n\t\t\t}\n\t\t}\n\t\t\n\t\tif($valid)\n\t\t{\n\t\t\t$valid = $this->checkSubItemsInput();\n\t\t}\n\t\t\n\t\treturn $valid;\n\t}",
"function _erpal_projects_helper_timetracking_add_time_validation(&$form, $form_state){\n // prepend field_timetracking_duration element validation\n array_unshift($form['field_timetracking_duration'][LANGUAGE_NONE][0]['value']['#element_validate'], '_erpal_projects_helper_time_field_validate');\n // prepend field_billing_duration element validation \n array_unshift($form['field_billing_duration'][LANGUAGE_NONE][0]['value']['#element_validate'], '_erpal_projects_helper_time_field_validate'); \n}",
"public function rules()\n {\n return [\n 'check_in' => 'required|date|date_format:m/d/Y|after:yesterday',\n 'check_out' => 'required|date|date_format:m/d/Y|after:check_in',\n 'location' => 'required',\n ];\n }",
"public function rules()\n {\n return [\n 'area_id' => 'required',\n 'day_of_week' => 'required|in:1,2,3,4,5,6,7',\n 'start_time' => 'required',\n 'end_time' => 'required',\n 'weight' => 'required',\n ];\n }",
"function options_validate(&$form, &$form_state) {\n parent::options_validate($form, $form_state);\n if (!preg_match('/^(?:\\-[0-9]{1,4}|[0-9]{4}):(?:[\\+|\\-][0-9]{1,4}|[0-9]{4})$/', $form_state['values']['options']['year_range'])) {\n form_error($form['year_range'], t('Date year range must be in the format -9:+9, 2005:2010, -9:2010, or 2005:+9'));\n }\n }",
"function appointment_edit_form_validate(&$form, &$form_state) {\n $values = $form_state['values'];\n \n /** @var Appointment $appointment */\n $appointment = $form_state['appointment'];\n \n /** @var AppointmentManager $appointmentManager */\n $appointmentManager = new AppointmentManager($appointment);\n \n if (is_string($values['date']) && (bool) strtotime($values['date'])) {\n $appointment->date = strtotime($values['date']);\n }\n else {\n $appointment->date = REQUEST_TIME;\n }\n $appointment->time_start = $values['time_start'];\n $appointment->time_end = $values['time_end'];\n $appointment->practitioner = $values['practitioner'];\n \n if($values['practitioner']) {\n /** @var \\Drupal\\practitioner\\Entity\\Practitioner $practitioner */\n $practitioner = practitioner_load($values['practitioner']);\n $practitioner_type = $practitioner ? $practitioner->type() : FALSE;\n \n if ($practitioner_type && $practitioner_type == 'volunteer' && in_array('assessment', array_filter($values['type']))) {\n form_set_error('type', 'Practitioner volunteers cannot book assessments. Please untick the \"Assessment\" option or change the practitioner');\n }\n }\n \n $time_start = (int) str_replace(':', '', $values['time_start']);\n $time_end = (int) str_replace(':', '', $values['time_end']);\n if ($time_start >= $time_end) {\n form_set_error('time_end', '\"Time end\" field cannot be lower than \"Time start\"');\n }\n \n if ($form_state['submitted'] && $values['practitioner'] && $appointmentManager->appointmentOverlaps('practitioner', $practitioner->identifier())) {\n form_set_error('time_start', 'This appointment conflicts with another one. Please change the date and/or time.');\n }\n \n //form_set_error('test', 'test');\n field_attach_form_validate('appointment', $appointment, $form, $form_state);\n}",
"public function rules()\n {\n return [\n 'start_day' => 'required|in:LUNES,MARTES,MIERCOLES,JUEVES,VIERNES,SABADO,DOMINGO',\n 'final_day' => 'required|in:LUNES,MARTES,MIERCOLES,JUEVES,VIERNES,SABADO,DOMINGO',\n 'start_time' => 'required|date_format:H:i',\n 'final_time' => 'required|date_format:H:i',\n ];\n }",
"function form_val_setrules(){\n $this->form_validation->set_error_delimiters('<p style=\"color:rgb(255, 115, 115);\" class=\"help-block\"><i class=\"glyphicon glyphicon-exclamation-sign\"></i> ','</p>');\n\n $this->form_validation->set_rules('return_date','Return Date','required');\n $this->form_validation->set_rules('reference','Reference','required'); \n }",
"function room_reservations_admin_settings_default_hours_submit($form_id, &$form_state) {\n $default_hours = array();\n if ($form_state['clicked_button']['#value'] == t('Save configuration')) {\n for ($day = 0; $day < 7; $day++) {\n $default_hours[] = $form_state['values']['day_' . $day]['first_shift_open_' . $day];\n $default_hours[] = $form_state['values']['day_' . $day]['first_shift_close_' . $day];\n $default_hours[] = $form_state['values']['day_' . $day]['second_shift_open_' . $day];\n $default_hours[] = $form_state['values']['day_' . $day]['second_shift_close_' . $day];\n }\n $confirmation = ROOM_RESERVATIONS_SAVE_CONFIRMATION_MSG;\n $error = ROOM_RESERVATIONS_SAVE_ERROR_MSG;\n }\n if ($form_state['clicked_button']['#value'] == t('Reset to defaults')) {\n for ($day = 0; $day < 7; $day++) {\n $default_hours[] = '9999';\n $default_hours[] = '9999';\n $default_hours[] = '9999';\n $default_hours[] = '9999';\n }\n $confirmation = ROOM_RESERVATIONS_RESET_CONFIRMATION_MSG;\n $error = ROOM_RESERVATIONS_RESET_ERROR_MSG;\n }\n $errors = FALSE;\n $result = _room_reservations_set_variable('default_hours', serialize($default_hours));\n if (!$result) {\n $errors = TRUE;\n }\n else {\n\n }\n // Update monthly hours records.\n $sql = \"SELECT * FROM {room_reservations_variables} WHERE name LIKE 'monthly_hours_%'\";\n $results = db_query($sql);\n foreach ($results as $data){\n $name = $data->name;\n $month = intval(drupal_substr($name, 19));\n $year = drupal_substr($name, 14, 4);\n $mo_hours = unserialize($data->value);\n // Days in the month.\n $days = date('t', mktime(0, 0, 0, $month, 1, (int) $year));\n $upd_mo_hours = array();\n for ($day = 0; $day < $days; $day++) {\n $default_ind = $mo_hours[($day * 5)];\n if ($default_ind == 'D') {\n // Update monthly hours with default day of week hours.\n // Day of the week.\n $dow = date('w', mktime(0, 0, 0, $month, $day + 1, (int) $year));\n $upd_mo_hours[($day * 5)] = 'D';\n $upd_mo_hours[($day * 5) + 1] = $default_hours[($dow * 4)];\n $upd_mo_hours[($day * 5) + 2] = $default_hours[($dow * 4) + 1];\n $upd_mo_hours[($day * 5) + 3] = $default_hours[($dow * 4) + 2];\n $upd_mo_hours[($day * 5) + 4] = $default_hours[($dow * 4) + 3];\n }\n elseif ($default_ind == 'O') {\n // Leave monthly hours unchanged.\n $upd_mo_hours[($day * 5)] = 'O';\n $upd_mo_hours[($day * 5) + 1] = $mo_hours[($day * 5) + 1];\n $upd_mo_hours[($day * 5) + 2] = $mo_hours[($day * 5) + 2];\n $upd_mo_hours[($day * 5) + 3] = $mo_hours[($day * 5) + 3];\n $upd_mo_hours[($day * 5) + 4] = $mo_hours[($day * 5) + 4];\n }\n }\n $result2 = _room_reservations_set_variable($name, \n serialize($upd_mo_hours));\n if (!$result2) {\n $errors = TRUE;\n }\n }\n if ($errors) {\n drupal_set_message(check_plain($error), 'error');\n }\n else {\n drupal_set_message(check_plain($confirmation));\n }\n}"
] |
[
"0.6901616",
"0.6400775",
"0.6098935",
"0.59718275",
"0.5920093",
"0.5870902",
"0.5854855",
"0.58487546",
"0.5848395",
"0.58482224",
"0.58418775",
"0.57849777",
"0.5740609",
"0.5697592",
"0.5649833",
"0.56013334",
"0.557828",
"0.5578189",
"0.55735",
"0.55686724",
"0.5563296",
"0.55501574",
"0.5495894",
"0.5489824",
"0.5483423",
"0.5458341",
"0.5454701",
"0.5449374",
"0.54439086",
"0.54412895"
] |
0.6802748
|
1
|
Form submission for the Hours / Daily Hours configuration page.
|
function room_reservations_admin_settings_daily_hours_submit($form_id, &$form_state) {
// Select month.
if ($form_state['clicked_button']['#value'] == t('Select a month')) {
$form_state['redirect']
= 'admin/config/system/room_reservations/hours/daily_hours/' .
$form_state['values']['month'];
}
// Process the daily hours for the selected month.
elseif ($form_state['clicked_button']['#value'] == t('Save configuration')) {
$confirmation = ROOM_RESERVATIONS_SAVE_CONFIRMATION_MSG;
$error = ROOM_RESERVATIONS_SAVE_ERROR_MSG;
$month_value = $form_state['values']['month'];
$month = intval(drupal_substr($month_value, 5));
$year = drupal_substr($month_value, 0, 4);
// Days in the month.
$days = date('t', mktime(0, 0, 0, $month, 1, $year));
$mo_hours = unserialize(_room_reservations_get_variable('monthly_hours_' . $month_value));
$updated_mo_hours = array();
$default_hours = unserialize(_room_reservations_get_variable('default_hours'));
for ($day = 0; $day < $days; $day++) {
// User entered hours for a single day.
$day_first_open = $form_state['values']['day_' . $day]['first_shift_open_' . $day];
$day_first_close = $form_state['values']['day_' . $day]['first_shift_close_' . $day];
$day_second_open = $form_state['values']['day_' . $day]['second_shift_open_' . $day];
$day_second_close = $form_state['values']['day_' . $day]['second_shift_close_' . $day];
// Default hours for the day of the week.
// Day of week.
$dow = date('w', mktime(0, 0, 0, $month, $day + 1, $year));
$default_first_open = $default_hours[($dow * 4) + 0];
$default_first_close = $default_hours[($dow * 4) + 1];
$default_second_open = $default_hours[($dow * 4) + 2];
$default_second_close = $default_hours[($dow * 4) + 3];
// Compare user entered hours to default for the day of the week.
if (($day_first_open == $default_first_open) &&
($day_first_close == $default_first_close) &&
($day_second_open == $default_second_open) &&
($day_second_close == $default_second_close)) {
$day_is_default = TRUE;
}
else {
$day_is_default = FALSE;
}
// Update the monthly hours record.
$updated_mo_hours[($day * 5)] = ($day_is_default) ? 'D' : 'O';
$updated_mo_hours[($day * 5) + 1] = $day_first_open;
$updated_mo_hours[($day * 5) + 2] = $day_first_close;
$updated_mo_hours[($day * 5) + 3] = $day_second_open;
$updated_mo_hours[($day * 5) + 4] = $day_second_close;
}
$result = _room_reservations_set_variable('monthly_hours_' . $month_value, serialize($updated_mo_hours));
if ($result) {
drupal_set_message(check_plain($confirmation));
}
else {
drupal_set_message(check_plain($error), 'error');
}
}
// Reset the month to the default hours.
elseif ($form_state['clicked_button']['#value'] == t('Reset to defaults')) {
$confirmation = ROOM_RESERVATIONS_RESET_CONFIRMATION_MSG;
$error = ROOM_RESERVATIONS_RESET_ERROR_MSG;
$month_value = $form_state['values']['month'];
$month = intval(drupal_substr($month_value, 5));
$year = drupal_substr($month_value, 0, 4);
$result = _room_reservations_create_mo_hours($year, $month, $month_value);
if ($result) {
drupal_set_message(check_plain($confirmation));
}
else {
drupal_set_message(check_plain($error), 'error');
}
}
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function room_reservations_admin_settings_default_hours_submit($form_id, &$form_state) {\n $default_hours = array();\n if ($form_state['clicked_button']['#value'] == t('Save configuration')) {\n for ($day = 0; $day < 7; $day++) {\n $default_hours[] = $form_state['values']['day_' . $day]['first_shift_open_' . $day];\n $default_hours[] = $form_state['values']['day_' . $day]['first_shift_close_' . $day];\n $default_hours[] = $form_state['values']['day_' . $day]['second_shift_open_' . $day];\n $default_hours[] = $form_state['values']['day_' . $day]['second_shift_close_' . $day];\n }\n $confirmation = ROOM_RESERVATIONS_SAVE_CONFIRMATION_MSG;\n $error = ROOM_RESERVATIONS_SAVE_ERROR_MSG;\n }\n if ($form_state['clicked_button']['#value'] == t('Reset to defaults')) {\n for ($day = 0; $day < 7; $day++) {\n $default_hours[] = '9999';\n $default_hours[] = '9999';\n $default_hours[] = '9999';\n $default_hours[] = '9999';\n }\n $confirmation = ROOM_RESERVATIONS_RESET_CONFIRMATION_MSG;\n $error = ROOM_RESERVATIONS_RESET_ERROR_MSG;\n }\n $errors = FALSE;\n $result = _room_reservations_set_variable('default_hours', serialize($default_hours));\n if (!$result) {\n $errors = TRUE;\n }\n else {\n\n }\n // Update monthly hours records.\n $sql = \"SELECT * FROM {room_reservations_variables} WHERE name LIKE 'monthly_hours_%'\";\n $results = db_query($sql);\n foreach ($results as $data){\n $name = $data->name;\n $month = intval(drupal_substr($name, 19));\n $year = drupal_substr($name, 14, 4);\n $mo_hours = unserialize($data->value);\n // Days in the month.\n $days = date('t', mktime(0, 0, 0, $month, 1, (int) $year));\n $upd_mo_hours = array();\n for ($day = 0; $day < $days; $day++) {\n $default_ind = $mo_hours[($day * 5)];\n if ($default_ind == 'D') {\n // Update monthly hours with default day of week hours.\n // Day of the week.\n $dow = date('w', mktime(0, 0, 0, $month, $day + 1, (int) $year));\n $upd_mo_hours[($day * 5)] = 'D';\n $upd_mo_hours[($day * 5) + 1] = $default_hours[($dow * 4)];\n $upd_mo_hours[($day * 5) + 2] = $default_hours[($dow * 4) + 1];\n $upd_mo_hours[($day * 5) + 3] = $default_hours[($dow * 4) + 2];\n $upd_mo_hours[($day * 5) + 4] = $default_hours[($dow * 4) + 3];\n }\n elseif ($default_ind == 'O') {\n // Leave monthly hours unchanged.\n $upd_mo_hours[($day * 5)] = 'O';\n $upd_mo_hours[($day * 5) + 1] = $mo_hours[($day * 5) + 1];\n $upd_mo_hours[($day * 5) + 2] = $mo_hours[($day * 5) + 2];\n $upd_mo_hours[($day * 5) + 3] = $mo_hours[($day * 5) + 3];\n $upd_mo_hours[($day * 5) + 4] = $mo_hours[($day * 5) + 4];\n }\n }\n $result2 = _room_reservations_set_variable($name, \n serialize($upd_mo_hours));\n if (!$result2) {\n $errors = TRUE;\n }\n }\n if ($errors) {\n drupal_set_message(check_plain($error), 'error');\n }\n else {\n drupal_set_message(check_plain($confirmation));\n }\n}",
"function room_reservations_admin_settings_default_hours($form, &$form_state) {\n $hours = _room_reservations_hours();\n // Select box options.\n $options = array();\n $options['9999'] = t('Select the time');\n $options['0000'] = t('Midnight - start of day');\n foreach ($hours as $hour) {\n $time = $hour['time'];\n $display = t($hour['display']);\n if ($time != '0000') {\n $options[$time] = $display;\n }\n }\n $options['2400'] = t('Midnight - end of day');\n // Get saved default hours.\n $default_hours\n = unserialize(_room_reservations_get_variable('default_hours'));\n if (!$default_hours) {\n for ($x = 0; $x < 28; $x++) {\n $default_hours[$x] = '9999';\n }\n }\n $days = array(\n t('Sunday'),\n t('Monday'),\n t('Tuesday'),\n t('Wednesday'),\n t('Thursday'),\n t('Friday'),\n t('Saturday'),\n );\n $form['#tree'] = TRUE;\n for ($day = 0; $day < 7; $day++) {\n $day_hours = array();\n $day_hours[] = $default_hours[($day * 4)];\n $day_hours[] = $default_hours[($day * 4) + 1];\n $day_hours[] = $default_hours[($day * 4) + 2];\n $day_hours[] = $default_hours[($day * 4) + 3];\n $display_hours = _room_reservations_hours_display($day_hours);\n $form['day_' . $day] = array(\n '#type' => 'fieldset',\n '#title' => $days[$day] . ' (' . $display_hours . ')',\n '#collapsible' => TRUE,\n '#collapsed' => TRUE,\n '#weight' => -90 + ($day * 10),\n );\n $form['day_' . $day]['first_shift_open_' . $day] = array(\n '#title' => t('First shift open'),\n '#type' => 'select',\n '#options' => $options,\n '#default_value' => $default_hours[($day * 4)],\n '#weight' => -90 + ($day * 10) + 1,\n );\n $form['day_' . $day]['first_shift_close_' . $day] = array(\n '#title' => t('First shift close'),\n '#type' => 'select',\n '#options' => $options,\n '#default_value' => $default_hours[($day * 4) + 1],\n '#weight' => -90 + ($day * 10) + 2,\n );\n $form['day_' . $day]['second_shift_open_' . $day] = array(\n '#title' => t('Second shift open'),\n '#type' => 'select',\n '#options' => $options,\n '#default_value' => $default_hours[($day * 4) + 2],\n '#weight' => -90 + ($day * 10) + 3,\n );\n $form['day_' . $day]['second_shift_close_' . $day] = array(\n '#title' => t('Second shift close'),\n '#type' => 'select',\n '#options' => $options,\n '#default_value' => $default_hours[($day * 4) + 3],\n '#weight' => -90 + ($day * 10) + 4,\n );\n }\n $form['save'] = array(\n '#type' => 'submit',\n '#value' => t('Save configuration'),\n '#weight' => 100,\n );\n $form['reset'] = array(\n '#type' => 'submit',\n '#value' => t('Reset to defaults'),\n '#weight' => 101,\n );\n return $form;\n}",
"function room_reservations_admin_settings_daily_hours_validate($form_id, &$form_state) {\n if ($form_state['clicked_button']['#value'] == t('Save configuration')) {\n $month_value = $form_state['values']['month'];\n $month = intval(drupal_substr($month_value, 5));\n $year = drupal_substr($month_value, 0, 4);\n // Days in the month.\n $days = date('t', mktime(0, 0, 0, $month, 1, $year));\n for ($day = 0; $day < $days; $day++) {\n // Day of the week.\n $dow = date('l', mktime(0, 0, 0, $month, $day + 1, $year));\n // Day of month.\n $dom = $day + 1;\n $open = TRUE;\n $second_shift = FALSE;\n $first_shift_open\n = $form_state['values']['day_' . $day]['first_shift_open_' . $day];\n $first_shift_close\n = $form_state['values']['day_' . $day]['first_shift_close_' . $day];\n $second_shift_open\n = $form_state['values']['day_' . $day]['second_shift_open_' . $day];\n $second_shift_close\n = $form_state['values']['day_' . $day]['second_shift_close_' . $day];\n $int_first_shift_open\n = intval(\n $form_state['values']['day_' . $day]['first_shift_open_' . $day]);\n $int_first_shift_close\n = intval(\n $form_state['values']['day_' . $day]['first_shift_close_' . $day]);\n $int_second_shift_open\n = intval(\n $form_state['values']['day_' . $day]['second_shift_open_' . $day]);\n $int_second_shift_close\n = intval(\n $form_state['values']['day_' . $day]['second_shift_close_' . $day]);\n // Closed.\n if (($int_first_shift_open == 9999) && \n ($int_first_shift_close == 9999) && \n ($int_second_shift_open == 9999) && \n ($int_second_shift_close == 9999)) {\n $open = FALSE;\n }\n // First shift.\n if ($open) {\n if ($int_first_shift_open == 9999) {\n $field = 'day_' . $day . '][first_shift_open_' . $day;\n $message = t('!day - First shift open is required.', \n array('!day' => $dom . ' ' . $dow));\n form_set_error($field, check_plain($message));\n }\n elseif ($int_first_shift_close == 9999) {\n $field = 'day_' . $day . '][first_shift_close_' . $day;\n $message = t('!day - First shift close is required.', \n array('!day' => $dom . ' ' . $dow));\n form_set_error($field, check_plain($message));\n }\n elseif ($int_first_shift_open >= $int_first_shift_close) {\n $field = 'day_' . $day . '][first_shift_close_' . $day;\n $message = t('!day - First shift close must be later than first shift\n open.', array('!day' => $dom . ' ' . $dow));\n form_set_error($field, check_plain($message));\n }\n }\n // Second shift.\n if ($open) {\n if (($int_second_shift_open != 9999) || \n ($int_second_shift_close != 9999)) {\n $second_shift = TRUE;\n }\n }\n if ($second_shift) {\n if (($int_first_shift_open == 9999) && \n ($int_first_shift_close == 9999)) {\n $field = 'day_' . $day . '][second_shift_open_' . $day;\n $message = t('!day - Cannot have a second shift without a first\n shift.', array('!day' => $dom . ' ' . $dow));\n form_set_error($field, check_plain($message));\n }\n elseif ($int_second_shift_open == 9999) {\n $field = 'day_' . $day . '][second_shift_open_' . $day;\n $message = t('!day - Second shift open is missing.', \n array('!day' => $dom . ' ' . $dow));\n form_set_error($field, check_plain($message));\n }\n elseif ($int_second_shift_close == 9999) {\n $field = 'day_' . $day . '][second_shift_close_' . $day;\n $message = t('!day - Second shift close is missing.', \n array('!day' => $dom . ' ' . $dow));\n form_set_error($field, check_plain($message));\n }\n elseif ($int_second_shift_open <= $int_first_shift_close) {\n $field = 'day_' . $day . '][second_shift_open_' . $day;\n $message = t('!day - Second shift open must be later than first\n shift close.', array('!day' => $dom . ' ' . $dow));\n form_set_error($field, check_plain($message));\n }\n elseif ($int_second_shift_open >= $int_second_shift_close) {\n $field = 'day_' . $day . '][second_shift_close_' . $day;\n $message = t('!day - Second shift close must be later than second\n shift opten.', array('!day' => $dom . ' ' . $dow));\n form_set_error($field, check_plain($message));\n }\n }\n }\n }\n}",
"function room_reservations_admin_settings_default_hours_validate($form_id, &$form_state) {\n $days = array(\n t('Sunday'),\n t('Monday'),\n t('Tuesday'),\n t('Wednesday'),\n t('Thursday'),\n t('Friday'),\n t('Saturday'),\n );\n if ($form_state['clicked_button']['#value'] == t('Save configuration')) {\n for ($day = 0; $day < 7; $day++) {\n $open = TRUE;\n $second_shift = FALSE;\n $first_shift_open\n = $form_state['values']['day_' . $day]['first_shift_open_' . $day];\n $first_shift_close\n = $form_state['values']['day_' . $day]['first_shift_close_' . $day];\n $second_shift_open\n = $form_state['values']['day_' . $day]['second_shift_open_' . $day];\n $second_shift_close\n = $form_state['values']['day_' . $day]['second_shift_close_' . $day];\n $int_first_shift_open\n = intval(\n $form_state['values']['day_' . $day]['first_shift_open_' . $day]);\n $int_first_shift_close\n = intval(\n $form_state['values']['day_' . $day]['first_shift_close_' . $day]);\n $int_second_shift_open\n = intval(\n $form_state['values']['day_' . $day]['second_shift_open_' . $day]);\n $int_second_shift_close\n = intval(\n $form_state['values']['day_' . $day]['second_shift_close_' . $day]);\n // Closed.\n if (($int_first_shift_open == 9999) && \n ($int_first_shift_close == 9999) && \n ($int_second_shift_open == 9999) && \n ($int_second_shift_close == 9999)) {\n $open = FALSE;\n }\n // First shift.\n if ($open) {\n if ($int_first_shift_open == 9999) {\n $field = 'day_' . $day . '][first_shift_open_' . $day;\n $message = t('!day - First shift open is required.', \n array('!day' => $days[$day]));\n form_set_error($field, check_plain($message));\n }\n elseif ($int_first_shift_close == 9999) {\n $field = 'day_' . $day . '][first_shift_close_' . $day;\n $message = t('!day - First shift close is required.', \n array('!day' => $days[$day]));\n form_set_error($field, check_plain($message));\n }\n elseif ($int_first_shift_open >= $int_first_shift_close) {\n $field = 'day_' . $day . '][first_shift_close_' . $day;\n $message = t('!day - First shift close must be later than first shift\n open.', array('!day' => $days[$day]));\n form_set_error($field, check_plain($message));\n }\n }\n // Second shift.\n if ($open) {\n if (($int_second_shift_open != 9999) || \n ($int_second_shift_close != 9999)) {\n $second_shift = TRUE;\n }\n }\n if ($second_shift) {\n if (($int_first_shift_open == 9999) && \n ($int_first_shift_close == 9999)) {\n $field = 'day_' . $day . '][second_shift_open_' . $day;\n $message = t('!day - Cannot have a second shift without a first\n shift.', array('!day' => $days[$day]));\n form_set_error($field, check_plain($message));\n }\n elseif ($int_second_shift_open == 9999) {\n $field = 'day_' . $day . '][second_shift_open_' . $day;\n $message = t('!day - Second shift open is missing.', \n array('!day' => $days[$day]));\n form_set_error($field, check_plain($message));\n }\n elseif ($int_second_shift_close == 9999) {\n $field = 'day_' . $day . '][second_shift_close_' . $day;\n $message = t('!day - Second shift close is missing.', \n array('!day' => $days[$day]));\n form_set_error($field, check_plain($message));\n }\n elseif ($int_second_shift_open <= $int_first_shift_close) {\n $field = 'day_' . $day . '][second_shift_open_' . $day;\n $message = t('!day - Second shift open must be later than first\n shift close.', array('!day' => $days[$day]));\n form_set_error($field, check_plain($message));\n }\n elseif ($int_second_shift_open >= $int_second_shift_close) {\n $field = 'day_' . $day . '][second_shift_close_' . $day;\n $message = t('!day - Second shift close must be later than second\n shift opten.', array('!day' => $days[$day]));\n form_set_error($field, check_plain($message));\n }\n }\n }\n }\n}",
"public function submitForm(array &$form, FormStateInterface $form_state) {\n $this->config('happy_alexandrie.library_config')\n ->set('opening_hours', $form_state->getValue('opening_hours'))\n ->save();\n // Call the parent implementation to inherit from what has been done in it.\n // In our case, display the confirmation message.\n parent::submitForm($form, $form_state);\n }",
"public function hoursForm($result)\n {\n if ( !$this->ownerLoggedIn() )\n {\n $this->restricted();\n return;\n }\n\n require_once('views/HoursView.class.php'); \n require_once('views/FormError.class.php');\n \n $site = new SiteContainer($this->db);\n $message = new FormError();\n \n $hv = new HoursView();\n\n $site->printHeader();\n $site->printNav(\"owner\");\n \n if ($result == \"bad_time\")\n $message->printHtml(array(\"bad_time\"));\n \n $hv->printHtml($result);\n $site->printFooter(); \n }",
"function room_reservations_admin_settings_daily_hours($form, &$form_state, $selected_month = NULL) {\n $cur_months = _room_reservations_current_months();\n \n if (!$selected_month) {\n // create a form to pick a month.\n $month_options = array();\n $first = current($cur_months);\n foreach ($cur_months as $cur_month) {\n $yyyy_mm = $cur_month['YYYY_MM'];\n $display = t($cur_month['display']);\n $month_options[$yyyy_mm] = t($cur_month['display']);\n }\n // Form.\n $form['select_month']['month'] = array(\n '#title' => t('Month'),\n '#type' => 'select',\n '#options' => $month_options,\n '#default_value' => $first['YYYY_MM'],\n '#weight' => -4000,\n );\n $form['select_month']['save'] = array(\n '#type' => 'submit',\n '#value' => t('Select a month'),\n '#weight' => -3990,\n ); \n \n // and if no month has been selected; just return this form\n\n return $form;\n }\n \n // If the month has been selected, return a form to update the hours for each day of that month.\n $hours = _room_reservations_hours();\n // Select box options.\n $options = array();\n $options['9999'] = t('Select the time');\n $options['0000'] = t('Midnight - start of day');\n foreach ($hours as $hour) {\n $time = $hour['time'];\n $display = t($hour['display']);\n if ($time != '0000') {\n $options[$time] = $display;\n }\n }\n $options['2400'] = t('Midnight - end of day');\n \n $yyyy_mm = $selected_month;\n $month = intval(drupal_substr($yyyy_mm, 5));\n $year = drupal_substr($yyyy_mm, 0, 4);\n $month_display = date('F Y', mktime(0, 0, 0, $month, 1, $year));\n // Days in the month.\n $days = date('t', mktime(0, 0, 0, $month, 1, $year));\n if (!$mo_hours = unserialize(_room_reservations_get_variable('monthly_hours_' . $yyyy_mm))) {\n $mo_hours = _room_reservations_create_mo_hours($year, $month, $yyyy_mm, true);\n }\n // Form.\n $form['#tree'] = TRUE;\n $form['month_display'] = array(\n '#prefix' => '<b>',\n '#suffix' => '</b><br />',\n '#markup' => $month_display,\n '#weight' => -100,\n );\n $form['note'] = array(\n '#markup' => t('Asterisk (*) indicates that the hours have been changed from the default'),\n '#weight' => -99,\n );\n for ($day = 0; $day < $days; $day++) {\n // Day of week.\n $dow = date('l', mktime(0, 0, 0, $month, $day + 1, $year));\n $changed_hours = ($mo_hours[($day * 5)] == 'O') ? '*' : '';\n $day_hours = array();\n $day_hours[] = $mo_hours[($day * 5) + 1];\n $day_hours[] = $mo_hours[($day * 5) + 2];\n $day_hours[] = $mo_hours[($day * 5) + 3];\n $day_hours[] = $mo_hours[($day * 5) + 4];\n $display_hours = _room_reservations_hours_display($day_hours);\n $title = ($day + 1) . ' ' . $dow . ' (' . $display_hours . ') ' . $changed_hours;\n $form['day_' . $day] = array(\n '#type' => 'fieldset',\n '#title' => $title,\n '#collapsible' => TRUE,\n '#collapsed' => TRUE,\n '#weight' => -9 + ($day * 2),\n );\n $form['day_' . $day]['first_shift_open_' . $day] = array(\n '#title' => t('First shift open'),\n '#type' => 'select',\n '#options' => $options,\n '#default_value' => $mo_hours[($day * 5) + 1],\n //'#weight' => -9 + ($day * 2) + 1,\n );\n $form['day_' . $day]['first_shift_close_' . $day] = array(\n '#title' => t('First shift close'),\n '#type' => 'select',\n '#options' => $options,\n '#default_value' => $mo_hours[($day * 5) + 2],\n //'#weight' => -9 + ($day * 10) + 2,\n );\n $form['day_' . $day]['second_shift_open_' . $day] = array(\n '#title' => t('Second shift open'),\n '#type' => 'select',\n '#options' => $options,\n '#default_value' => $mo_hours[($day * 5) + 3],\n //'#weight' => -90 + ($day * 10) + 3,\n );\n $form['day_' . $day]['second_shift_close_' . $day] = array(\n '#title' => t('Second shift close'),\n '#type' => 'select',\n '#options' => $options,\n '#default_value' => $mo_hours[($day * 5) + 4],\n //'#weight' => -90 + ($day * 10) + 4,\n );\n }\n $form['save'] = array(\n '#type' => 'submit',\n '#value' => t('Save configuration'),\n '#weight' => 400,\n );\n $form['reset'] = array(\n '#type' => 'submit',\n '#value' => t('Reset to defaults'),\n '#weight' => 401,\n );\n $form['month'] = array(\n '#type' => 'value',\n '#value' => $month_value,\n );\n return $form;\n}",
"private function showHowRequestForm() {\r\n $this->config->showPrinterFriendly = false;\r\n echo '<h2>How would you like to use this time?</h2>';\r\n $this->showSubTimeTypeDropDown();\r\n echo '<input type=\"hidden\" name=\"maxCalDays\" value=\"' . $this->maxCalDays . '\" />';\r\n echo '<br/><br/><br/>';\r\n }",
"private function timingSection() {\n $this->_form->addElement('header', 'timing', get_string('timing', 'codeactivity')); \n \n $this->_form->addElement('date_time_selector', 'opendate', get_string('open_date', 'codeactivity'), self::$datefieldoptions);\n $this->_form->addHelpButton(\n 'opendate',\n 'open_date',\n 'codeactivity');\n $this->_form->addElement('date_time_selector', 'duedate', get_string('due_date', 'codeactivity'), self::$datefieldoptions);\n $this->_form->addHelpButton(\n 'duedate',\n 'due_date',\n 'codeactivity'); \n }",
"private function setHoursField(){\n \n $hoursnode = $this->getHoursNode();\n \n $hoursfield = $hoursnode->field_hours_paragraph->view(array('type' => 'full', 'label' => 'hidden')); \n \n if(in_array('show_today', $this->getOptions())){\n $hoursfield['#prefix'] = '<div class=\"field today-only\">';\n $hoursfield['#suffix'] = '</div>';\n }\n \n $this->hoursfield = $hoursfield;\n }",
"public function settings_page() {\n\n\t\t?>\n\n\t\t<div class=\"wrap schedule-a-visit-to-sherpa-settings\">\n\t\t\t\n\t\t\t<form id=\"schedule-a-visit-to-sherpa-form\" method=\"post\" action=\"options.php\">\n\t\t\t\t\n\t\t\t\t<?php echo wp_nonce_field( 'schedule_a_visit_to_sherpa_data', 'schedule_a_visit_to_sherpa_nonce' ); ?>\n\n\t\t\t\t<?php settings_fields( 'schedule_a_visit_to_sherpa_settings_section' ); ?>\n\n\t\t\t\t<?php do_settings_sections( 'schedule-a-visit-to-sherpa' ); ?>\n\t\t\t\t\n\t\t\t\t<?php submit_button(); ?>\n\n\t\t\t</form>\n\n </div>\n\n\t\t<?php\n\n\t}",
"public function form( $instance ) {\n\t\t\n\t\t\t$instance = wp_parse_args(\n\t\t\t\t(array) $instance,\n\t\t\t\tarray(\n\t\t\t\t\t'title' => esc_html__( 'Business Hours.', 'zthemename' ),\n\t\t\t\t)\n\t\t\t); \n\n\t\t\t?>\n\t\t\t<p>\n\t\t\t\t<label for=\"<?php echo $this->get_field_id( 'title' ); ?>\"><?php esc_html_e( 'Title:', 'zthemename' ); ?></label>\n\t\t\t\t<input class=\"widefat\" id=\"<?php echo $this->get_field_id( 'title' ); ?>\" name=\"<?php echo $this->get_field_name( 'title' ); ?>\" type=\"text\" value=\"<?php echo esc_attr( $instance['title'] ); ?>\">\n\t\t\t</p>\n\t\t\t<div>\n\t\t\t\t<div> </div>\n\t\t\t\t<div><?php esc_html_e( 'Open', 'zthemename' ); ?></div>\n\t\t\t\t<div><?php esc_html_e( 'Close', 'zthemename' ); ?></div>\n\t\t\t</div>\n\n\t\t\t<div>\n\t\t\t\t<div><?php esc_html_e( 'Monday:', 'zthemename'); ?></div>\n\t\t\t\t<input type=\"text\" size=\"9\" value=\"<?php echo isset( $this->opening_hours['Monday'][0] ) ? $this->opening_hours['Monday'][0] : ''; ?>\" readonly>\n\t\t\t\t<input type=\"text\" size=\"9\" value=\"<?php echo isset( $this->opening_hours['Monday'][1] ) ? $this->opening_hours['Monday'][1] : ''; ?>\" readonly>\n\t\t\t</div>\n\n\t\t\t<div>\n\t\t\t\t<div><?php esc_html_e( 'Tuesday:', 'zthemename' ); ?></div>\n\t\t\t\t<input type=\"text\" size=\"9\" value=\"<?php echo isset( $this->opening_hours['Tuesday'][0] ) ? $this->opening_hours['Tuesday'][0] : ''; ?>\" readonly>\n\t\t\t\t<input type=\"text\" size=\"9\" value=\"<?php echo isset( $this->opening_hours['Tuesday'][1] ) ? $this->opening_hours['Tuesday'][1] : ''; ?>\" readonly>\n\t\t\t</div>\n\n\t\t\t<div>\n\t\t\t\t<div><?php esc_html_e( 'Wednesday:', 'zthemename' ); ?></div>\n\t\t\t\t<input type=\"text\" size=\"9\" value=\"<?php echo isset( $this->opening_hours['Wednesday'][0] ) ? $this->opening_hours['Wednesday'][0] : ''; ?>\" readonly>\n\t\t\t\t<input type=\"text\" size=\"9\" value=\"<?php echo isset( $this->opening_hours['Wednesday'][1] ) ? $this->opening_hours['Wednesday'][1] : ''; ?>\" readonly>\n\t\t\t</div>\n\n\t\t\t<div>\n\t\t\t\t<div><?php esc_html_e( 'Thursday:', 'zthemename' ); ?></div>\n\t\t\t\t<input type=\"text\" size=\"9\" value=\"<?php echo isset( $this->opening_hours['Thursday'][0] ) ? $this->opening_hours['Thursday'][0] : ''; ?>\" readonly>\n\t\t\t\t<input type=\"text\" size=\"9\" value=\"<?php echo isset( $this->opening_hours['Thursday'][1] ) ? $this->opening_hours['Thursday'][1] : ''; ?>\" readonly>\n\t\t\t</div>\n\n\t\t\t<div>\n\t\t\t\t<div><?php esc_html_e( 'Friday:', 'zthemename' ); ?></div>\n\t\t\t\t<input type=\"text\" size=\"9\" value=\"<?php echo isset( $this->opening_hours['Friday'][0] ) ? $this->opening_hours['Friday'][0] : ''; ?>\" readonly>\n\t\t\t\t<input type=\"text\" size=\"9\" value=\"<?php echo isset( $this->opening_hours['Friday'][1] ) ? $this->opening_hours['Friday'][1] : ''; ?>\" readonly>\n\t\t\t</div>\n\n\t\t\t<div>\n\t\t\t\t<div><?php esc_html_e( 'Saturday:', 'zthemename'); ?></div>\n\t\t\t\t<input type=\"text\" size=\"9\" value=\"<?php echo isset( $this->opening_hours['Saturday'][0] ) ? $this->opening_hours['Saturday'][0] : ''; ?>\" readonly>\n\t\t\t\t<input type=\"text\" size=\"9\" value=\"<?php echo isset( $this->opening_hours['Saturday'][1] ) ? $this->opening_hours['Saturday'][1] : ''; ?>\" readonly>\n\t\t\t</div>\n\n\t\t\t<div>\n\t\t\t\t<div><?php esc_html_e( 'Sunday:', 'zthemename'); ?></div>\n\t\t\t\t<input type=\"text\" size=\"9\" value=\"<?php echo isset( $this->opening_hours['Sunday'][0] ) ? $this->opening_hours['Sunday'][0] : ''; ?>\" readonly>\n\t\t\t\t<input type=\"text\" size=\"9\" value=\"<?php echo isset( $this->opening_hours['Sunday'][1] ) ? $this->opening_hours['Sunday'][1] : ''; ?>\" readonly>\n\t\t\t</div>\n\n\t\t\t\n\t\t\t<p>\n\t\t\t\t<?php\n\t\t\t\t\t$url = admin_url( 'themes.php?page=zthemename-options' );\n\t\t\t\t\t/* translators: %s: URL to create a new menu. */\n\t\t\t\t\tprintf( __( 'Synchronize business hours <a href=\"%s\">here</a>.' ), esc_attr( $url ) );\n\t\t\t\t?>\n\t\t\t</p>\n\t\t\t<?php\n\t\t}",
"public function actionWorkinghours(): array\n {\n $request = Yii::$app->request;\n\n if ($request->isPost) {\n return Appointments::WORKING_HOURS;\n }\n \n return [];\n }",
"public function showMainRequestForm() {\r\n $this->config->showPrinterFriendly = true;\r\n echo '<h2>Complete additional fields</h2>';\r\n echo 'Starting Date: ';\r\n displayDateSelect('useDate', 'date_1', $this->useDate, true, true);\r\n if(!$this->isEditing){\r\n echo ' Through date (optional): ';\r\n displayDateSelect('endDate', 'date_2', $this->endDate);\r\n } else{\r\n echo '<input type=\"hidden\" name=\"endDate\" value=\"\" />';\r\n }\r\n echo '<br/><br/>';\r\n echo 'Start time: ';\r\n showTimeSelector(\"begTime\", $this->begTime1, $this->begTime2);\r\n if ($this->subTypeInfo['LIMIT_8_12'] == '1' || $this->typeID == '2') {\r\n //Limit is enabled or Type is Personal\r\n if (!empty($this->shiftHours)) {\r\n if ($this->shiftHourRadio == \"8\" || $this->shiftHours == \"8\") {\r\n echo \" How long is your shift? <input type='radio' name='shiftHour' value='8' CHECKED>8 Hours\";\r\n echo \"<input type='radio' name='shiftHour' value='12'>12 Hours<br/>\";\r\n } elseif ($this->shiftHourRadio == \"12\" || $this->shiftHours == \"12\") {\r\n echo \" How long is your shift? <input type='radio' name='shiftHour' value='8'>8 Hours\";\r\n echo \"<input type='radio' name='shiftHour' value='12' CHECKED>12 Hours<br/>\";\r\n } else {\r\n echo \" How long is your shift? <input type='radio' name='shiftHour' value='8'>8 Hours\";\r\n echo \"<input type='radio' name='shiftHour' value='12'>12 Hours\";\r\n echo ' <font color=\"red\">Error in shift selection! </font><br/>';\r\n }\r\n } else {\r\n echo \" How long is your shift? <input type='radio' name='shiftHour' value='8'>8 Hours\";\r\n echo \"<input type='radio' name='shiftHour' value='12'>12 Hours<br/>\";\r\n }\r\n } else {\r\n echo ' End time: ';\r\n showTimeSelector(\"endTime\", $this->endTime1, $this->endTime2);\r\n }\r\n if (!empty($this->shiftHours))\r\n echo ' Total Hours: ' . $this->shiftHours;\r\n\r\n echo '<br/><br/>';\r\n echo 'Comment: <textarea rows=\"3\" cols=\"40\" name=\"empComment\" >' . $this->empComment . '</textarea>';\r\n echo '<br/><br/>';\r\n if(!empty($this->submitDate)){\r\n echo '<font color=\"darkred\">Submitted on '. $this->submitDate .' by '.$this->auditName.'</font>';\r\n echo '<br/><br/>';\r\n }\r\n\r\n if (!$this->isEditing) {\r\n echo '<input type=\"submit\" name=\"submitBtn\" value=\"Submit for Approval\">';\r\n } else { \r\n if($this->status != \"APPROVED\"){ \r\n echo '<input type=\"hidden\" name=\"reqID\" value=\"'.$this->reqID.'\" />';\r\n echo '<input type=\"submit\" name=\"updateReqBtn\" value=\"Update Request ' . $this->reqID . '\">';\r\n }\r\n echo '<input type=\"submit\" name=\"duplicateReqBtn\" value=\"Duplicate Request\" />';\r\n }\r\n }",
"protected function saveOpeningHours()\n {\n //TODO\n }",
"function options_form(&$form, &$form_state) {\r\n parent::options_form($form, $form_state);\r\n $options = $this->date_handler->date_parts();\r\n unset($options['second'], $options['minute']);\r\n $options += array('week' => date_t('Week', 'datetime'));\r\n $form['granularity'] = array(\r\n '#title' => t('Granularity'),\r\n '#type' => 'radios',\r\n '#options' => $options,\r\n '#default_value' => $this->options['granularity'],\r\n '#multiple' => TRUE,\r\n '#description' => t(\"Select the type of date value to be used in defaults, summaries, and navigation. For example, a granularity of 'month' will set the default date to the current month, summarize by month in summary views, and link to the next and previous month when using date navigation.\"),\r\n );\r\n\r\n $form['year_range'] = array(\r\n '#title' => t('Date year range'),\r\n '#type' => 'textfield',\r\n '#default_value' => $this->options['year_range'],\r\n '#description' => t(\"Set the allowable minimum and maximum year range for this argument, either a -X:+X offset from the current year, like '-3:+3' or an absolute minimum and maximum year, like '2005:2010'. When the argument is set to a date outside the range, the page will be returned as 'Page not found (404)'.\"),\r\n );\r\n \r\n $fields = date_api_fields($this->definition['base']);\r\n $options = array();\r\n foreach ($fields['name'] as $name => $field) {\r\n $options[$name] = $field['label'];\r\n }\r\n $form['date_fields'] = array(\r\n '#title' => t('Date field(s)'),\r\n '#type' => 'checkboxes',\r\n '#options' => $options,\r\n '#default_value' => $this->options['date_fields'],\r\n '#multiple' => TRUE,\r\n '#description' => t(\"Select one or more date fields to filter with this argument. Do not select both the 'From date' and 'To date' for CCK date fields, only one of them is needed.\"),\r\n );\r\n $form['date_method'] = array(\r\n '#title' => t('Method'),\r\n '#type' => 'radios',\r\n '#options' => array('OR' => t('OR'), 'AND' => t('AND')),\r\n '#default_value' => $this->options['date_method'],\r\n '#description' => t('Method of handling multiple date fields in the same query. Return items that have any matching date field (date = field_1 OR field_2), or only those with matches in all selected date fields (date = field_1 AND field_2).'),\r\n );\r\n \r\n }",
"public function form( $instance ) {\n $title = ! empty( $instance['title'] ) ? $instance['title'] : '';\n $seperator =!empty( $instance['seperator']) ? $instance['seperator'] : '';\n $hour = !empty( $instance['hour']) ? $instance['hour'] : '';\n $amorpm = !empty( $instance['amorpm'] ) ? $instance['amorpm'] : '';?>\n <p>\n <label for=\"<?php echo $this->get_field_id( 'title' ); ?>\">Title:</label>\n <input type=\"text\" id=\"<?php echo $this->get_field_id( 'title' ); ?>\" name=\"<?php echo $this->get_field_name( 'title' ); ?>\" value=\"<?php echo esc_attr( $title ); ?>\" />\n </p>\n <p>\n <label for=\"<?php echo $this->get_field_id( 'seperator' ); ?>\">Seperator:</label>\n <input type=\"text\" id=\"<?php echo $this->get_field_id( 'seperator' ); ?>\" name=\"<?php echo $this->get_field_name( 'seperator' ); ?>\" value=\"<?php echo esc_attr( $seperator ); ?>\" />\n </p>\n <p><label for=\"<?php echo $this->get_field_id('hour'); ?>\">\n <?php _e('12 hour format:'); ?>\n <input id=\"<?php echo $this->get_field_id('h'); ?>\" name=\"<?php echo $this->get_field_name('hour'); ?>\" type=\"radio\" value=\"h\" <?php if($hour === 'h'){ echo 'checked=\"checked\"'; } ?> />\n </label><br>\n <label for=\"<?php echo $this->get_field_id('hour'); ?>\">\n <?php _e('24 hour format:'); ?>\n <input id=\"<?php echo $this->get_field_id('H'); ?>\" name=\"<?php echo $this->get_field_name('hour'); ?>\" type=\"radio\" value=\"H\" <?php if($hour === 'H'){ echo 'checked=\"checked\"'; } ?> />\n </label></p>\n <p><label for=\"<?php echo $this->get_field_id('amorpm'); ?>\">\n <?php _e('Small letters meridiam:'); ?>\n <input id=\"<?php echo $this->get_field_id('a'); ?>\" name=\"<?php echo $this->get_field_name('amorpm'); ?>\" type=\"radio\" value=\"a\" <?php if($amorpm === 'a'){ echo 'checked=\"checked\"'; } ?> />\n </label><br>\n <label for=\"<?php echo $this->get_field_id('amorpm'); ?>\">\n <?php _e('Capital Meridiam:'); ?>\n <input id=\"<?php echo $this->get_field_id('A'); ?>\" name=\"<?php echo $this->get_field_name('amorpm'); ?>\" type=\"radio\" value=\"A\" <?php if($amorpm === 'A'){ echo 'checked=\"checked\"'; } ?> />\n </label></p> <?php\n }",
"public function hours() {\n //TODO prediction\n }",
"public function display() {\r\n\t\t$this->echoOptionHeader();\r\n\t\t$dateFormat = 'Y-m-d H:i';\r\n\t\t$placeholder = 'YYYY-MM-DD HH:MM';\r\n\t\tif ( $this->settings['date'] && ! $this->settings['time'] ) {\r\n\t\t\t$dateFormat = 'Y-m-d';\r\n\t\t\t$placeholder = 'YYYY-MM-DD';\r\n\t\t} else if ( ! $this->settings['date'] && $this->settings['time'] ) {\r\n\t\t\t$dateFormat = 'H:i';\r\n\t\t\t$placeholder = 'HH:MM';\r\n\t\t}\r\n\r\n\t\tprintf('<input class=\"input-date%s%s\" name=\"%s\" placeholder=\"%s\" id=\"%s\" type=\"text\" value=\"%s\" /> <p class=\"description\">%s</p>',\r\n\t\t\t( $this->settings['date'] ? ' date' : '' ),\r\n\t\t\t( $this->settings['time'] ? ' time' : '' ),\r\n\t\t\t$this->getID(),\r\n\t\t\t$placeholder,\r\n\t\t\t$this->getID(),\r\n\t\t\tesc_attr( ($this->getValue() > 0) ? date( $dateFormat, $this->getValue() ) : '' ),\r\n\t\t\t$this->settings['desc']\r\n\t\t);\r\n\t\t$this->echoOptionFooter( false );\r\n\t}",
"public function definition() {\n global $CFG, $PAGE;\n\n $mform =& $this->_form;\n\n //edit section\n $mform->addElement('header', 'configheader', get_string('exitingcrontitle', 'tool_servercron'));\n\n $existing = $this->_customdata['existingrecs'];\n $rows = '';\n\n if (count($existing)) {\n //set up heading for the table\n $row = html_writer::tag('th', get_string('minuteprompt', 'tool_servercron'),\n array('width' => '5%', 'style' => 'padding:5px; text-align:right'));\n\n $row .= html_writer::tag('th', get_string('hourprompt', 'tool_servercron'),\n array('width' => '5%', 'style' => 'padding:5px; text-align:right'));\n\n $row .= html_writer::tag('th', get_string('dayprompt', 'tool_servercron'),\n array('width' => '5%', 'style' => 'padding:5px; text-align:right'));\n\n $row .= html_writer::tag('th', get_string('monthprompt', 'tool_servercron'),\n array('width' => '5%', 'style' => 'padding:5px; text-align:right'));\n\n $row .= html_writer::tag('th', get_string('wdayprompt', 'tool_servercron'),\n array('width' => '5%', 'style' => 'padding:5px; text-align:right'));\n\n $row .= html_writer::tag('th', get_string('commandprompt', 'tool_servercron'),\n array('width' => '30%', 'style' => 'padding:5px; text-align:center'));\n\n $row .= html_writer::tag('th', get_string('actionsprompt', 'tool_servercron'),\n array('style' => 'padding:5px; text-align:center'));\n\n $row = html_writer::tag('tr', $row, array('width' => '100%'));\n $rows .= $row .\"\\n\";\n\n foreach ($existing as $exists) {\n // make up the edit line\n $row = html_writer::tag('td', $exists->minute, array('style' => 'text-align: right'));\n $row .= html_writer::tag('td', $exists->hour, array('style' => 'text-align: right'));\n $row .= html_writer::tag('td', $exists->day, array('style' => 'text-align: right'));\n $row .= html_writer::tag('td', $exists->month, array('style' => 'text-align: right'));\n $row .= html_writer::tag('td', $exists->wday, array('style' => 'text-align: right'));\n $row .= html_writer::tag('td', $exists->commandline);\n\n //editing links\n $row .= html_writer::start_tag('td', array('style' => 'padding:5px; text-align:center'));\n\n $row .= html_writer::tag('a', '['.get_string('editcronjob', 'tool_servercron').']',\n array('id' => 'svrcrn'.$exists->id,\n 'href' => $PAGE->url.\"?action=edit&cronjobid=\".$exists->id));\n\n $row .= ' ';\n\n $row .= html_writer::tag('a', '['.get_string('deletecronjob', 'tool_servercron').']',\n array('id' => 'svrcrn'.$exists->id, 'href' => $PAGE->url.\"?action=delete&cronjobid=\".$exists->id));\n\n $row .= html_writer::end_tag('td');\n\n $row = html_writer::tag('tr', $row);\n $rows .= $row .\"\\n\";\n }\n\n $mform->addElement('html', html_writer::tag('table', $rows, array('width' => '100%'))); //enclose in table\n } else {\n //if no rec id specified - then we have no records\n if (!$this->_customdata['cronjobid']) {\n $mform->addElement('html', html_writer::tag('p', get_string('noexistingcrons', 'tool_servercron')));\n }\n }\n\n $editing = false; //deafult not editing existing record\n if ($this->_customdata['cronjobid'] != 0) {\n $editing = true;\n }\n //new section\n if ($editing) {\n $mform->addElement('header', 'configheader', get_string('editcronstitle', 'tool_servercron') .' [' .\n $this->_customdata['cronjobid'] . ']' );\n } else {\n $mform->addElement('header', 'configheader', get_string('newcronstitle', 'tool_servercron'));\n }\n\n if (isset($this->_customdata['error'])) {\n $mform->addElement('html', '<h3 style=\"color: red\">'.$this->_customdata['error'].'</h3>');\n }\n\n //hidden field\n $mform->addElement('hidden', 'cronjobid', $this->_customdata['cronjobid'], array('id' => 'id_cronjobid'));//0=new\n // default action is save - have to check for cancel in php code to avoid reliance on JS\n $mform->addElement('hidden', 'action', 'save', array('id' => 'id_action'));\n\n $timingdets=array();\n\n $select = $mform->createElement('select', 'minute', get_string('minuteprompt', 'tool_servercron'),\n $this->_customdata['minutes']);\n $select->setMultiple(true);\n $timingdets[] = $select;\n\n $select = $mform->createElement('select', 'hour', get_string('hourprompt', 'tool_servercron'),\n $this->_customdata['hours']);\n $select->setMultiple(true);\n $timingdets[] = $select;\n\n $select = $mform->createElement('select', 'day', get_string('dayprompt', 'tool_servercron'),\n $this->_customdata['days']);\n $select->setMultiple(true);\n $timingdets[] = $select;\n\n $select = $mform->createElement('select', 'month', get_string('monthprompt', 'tool_servercron'),\n $this->_customdata['months']);\n $select->setMultiple(true);\n $timingdets[] = $select;\n\n $select = $mform->createElement('select', 'wday', get_string('wdayprompt', 'tool_servercron'),\n $this->_customdata['wdays']);\n $select->setMultiple(true);\n $timingdets[] = $select;\n\n //set the defaults for all the dropdowns as every *\n if (isset($this->_customdata['minute'])) {\n $mform->setDefault('minute', $this->_customdata['minute']);\n } else {\n $mform->setDefault('minute', -1);\n }\n\n if (isset($this->_customdata['hour'])) {\n $mform->setDefault('hour', $this->_customdata['hour']);\n } else {\n $mform->setDefault('hour', -1);\n }\n\n if (isset($this->_customdata['day'])) {\n $mform->setDefault('day', $this->_customdata['day']);\n } else {\n $mform->setDefault('day', -1);\n }\n\n if (isset($this->_customdata['month'])) {\n $mform->setDefault('month', $this->_customdata['month']);\n } else {\n $mform->setDefault('month', -1);\n }\n\n if (isset($this->_customdata['wday'])) {\n $mform->setDefault('wday', $this->_customdata['wday']);\n } else {\n $mform->setDefault('wday', -1);\n }\n\n //now add the group to the form\n $mform->addGroup($timingdets, 'timings', get_string('timingsprompt', 'tool_servercron'), array(' '), false);\n\n //servercron title\n $mform->addElement('text', 'commandline', get_string('commandprompt', 'tool_servercron'), array('size' => 100));\n $mform->setDefault('commandline', $this->_customdata['commandline']);\n $mform->setType('commandline', PARAM_TEXT);\n\n //buttons\n $buttonarray=array();\n $buttonarray[] = $mform->createElement('submit', 'save', get_string('cronjobsave', 'tool_servercron'));\n\n if ($editing) {\n $buttonarray[] = $mform->createElement('cancel', 'cancel', get_string('croneditcancel', 'tool_servercron'));\n }\n\n $buttonarray[] = $mform->createElement('reset', 'resetbutton', get_string('cronjobreset', 'tool_servercron'));\n $mform->addGroup($buttonarray, 'buttonar', '', array(' '), false);\n\n }",
"public function actionCronHourly()\n {\n switch (date('H')) {\n default: echo \"Nothing to run\\n\";\n }\n echo \"Done!\\n\";\n }",
"function pdfbulletin_settings_form_submit(&$form, &$form_state) {\n $pdfbulletin = $form_state['values']['pdfbulletin'];\n $schedule = $pdfbulletin->schedule;\n\n $schedule['frequency'] = $form_state['values']['frequency'];\n $start_date = $form_state['values']['date'];\n $schedule['date'] = strtotime($start_date['year'] . '-' . $start_date['month'] . '-' . $start_date['day']);\n $schedule['send_empty'] = $form_state['values']['send_empty'];\n $schedule['scheduled'] = $schedule['scheduled'] & $form_state['values']['scheduled'] ? PDFBULLETIN_SCHEDULED_YES : PDFBULLETIN_SCHEDULED_NO;\n pdfbulletin_schedule_save($schedule);\n}",
"public function tablePost ()\n {\n // and make it a model to register\n \n \n $user = $_SESSION['connectedUser'];\n \n if ($user) {\n $authenticator = new Authentication($this->router);\n \n if ($authenticator->checkAuthentication($user)) {\n\n \n $weekStart = filter_input(INPUT_POST , 'week__start', FILTER_SANITIZE_STRING);\n $weekEnd = filter_input(INPUT_POST , 'week__end', FILTER_SANITIZE_STRING);\n $mondayMorningStart = filter_input(INPUT_POST , 'monday__morning__start', FILTER_SANITIZE_STRING);\n $mondayMorningEnd = filter_input(INPUT_POST , 'monday__morning__end', FILTER_SANITIZE_STRING);\n $mondayAfternoonStart = filter_input(INPUT_POST , 'monday__afternoon__start', FILTER_SANITIZE_STRING);\n $mondayAfternoonEnd = filter_input(INPUT_POST , 'monday__afternoon__end', FILTER_SANITIZE_STRING);\n $mondayStart = filter_input(INPUT_POST , 'monday__start', FILTER_SANITIZE_STRING);\n $mondayEnd = filter_input(INPUT_POST , 'monday__end', FILTER_SANITIZE_STRING);\n $mondayResultStandard = filter_input(INPUT_POST , 'monday__result__standard', FILTER_SANITIZE_STRING);\n $mondayResultHundredths = filter_input(INPUT_POST , 'monday__result__hundredths', FILTER_SANITIZE_STRING);\n $tuesdayMorningStart = filter_input(INPUT_POST , 'tuesday__morning__start', FILTER_SANITIZE_STRING);\n $tuesdayMorningEnd = filter_input(INPUT_POST , 'tuesday__morning__end', FILTER_SANITIZE_STRING);\n $tuesdayAfternoonStart = filter_input(INPUT_POST , 'tuesday__afternoon__start', FILTER_SANITIZE_STRING);\n $tuesdayAfternoonEnd = filter_input(INPUT_POST , 'tuesday__afternoon__end', FILTER_SANITIZE_STRING);\n $tuesdayStart = filter_input(INPUT_POST , 'tueday__start', FILTER_SANITIZE_STRING);\n $tuesdayEnd = filter_input(INPUT_POST , 'tueday__end', FILTER_SANITIZE_STRING);\n $tuesdayResultStandard = filter_input(INPUT_POST , 'tuesday__result__standard', FILTER_SANITIZE_STRING);\n $tuesdayResultHundredths = filter_input(INPUT_POST , 'tuesday__result__hundredths', FILTER_SANITIZE_STRING);\n $wednesdayMorningStart = filter_input(INPUT_POST , 'wednesday__morning__start', FILTER_SANITIZE_STRING);\n $wednesdayMorningEnd = filter_input(INPUT_POST , 'wednesday__morning__end', FILTER_SANITIZE_STRING);\n $wednesdayAfternoonStart = filter_input(INPUT_POST , 'wednesday__afternoon__start', FILTER_SANITIZE_STRING);\n $wednesdayAfternoonEnd = filter_input(INPUT_POST , 'wednesday__afternoon__end', FILTER_SANITIZE_STRING);\n $wednesdayStart = filter_input(INPUT_POST , 'wednesday__start', FILTER_SANITIZE_STRING);\n $wednesdayEnd = filter_input(INPUT_POST , 'wednesday__end', FILTER_SANITIZE_STRING);\n $wednesdayResultStandard = filter_input(INPUT_POST , 'wednesday__result__standard', FILTER_SANITIZE_STRING);\n $wednesdayResultHundredths = filter_input(INPUT_POST , 'wednesday__result__hundredths', FILTER_SANITIZE_STRING);\n $thursdayMorningStart = filter_input(INPUT_POST , 'thursday__morning__start', FILTER_SANITIZE_STRING);\n $thursdayMorningEnd = filter_input(INPUT_POST , 'thursday__morning__end', FILTER_SANITIZE_STRING);\n $thursdayAfternoonStart = filter_input(INPUT_POST , 'thursday__afternoon__start', FILTER_SANITIZE_STRING);\n $thursdayAfternoonEnd = filter_input(INPUT_POST , 'thursday__afternoon__end', FILTER_SANITIZE_STRING);\n $thursdayStart = filter_input(INPUT_POST , 'thursday__start', FILTER_SANITIZE_STRING);\n $thursdayEnd = filter_input(INPUT_POST , 'thursday__end', FILTER_SANITIZE_STRING);\n $thursdayResultStandard = filter_input(INPUT_POST , 'thursday__result__standard', FILTER_SANITIZE_STRING);\n $thursdayResultHundredths = filter_input(INPUT_POST , 'thursday__result__hundredths', FILTER_SANITIZE_STRING);\n $fridayMorningStart = filter_input(INPUT_POST , 'friday__morning__start', FILTER_SANITIZE_STRING);\n $fridayMorningEnd = filter_input(INPUT_POST , 'friday__morning__end', FILTER_SANITIZE_STRING);\n $fridayAfternoonStart = filter_input(INPUT_POST , 'friday__afternoon__start', FILTER_SANITIZE_STRING);\n $fridayAfternoonEnd = filter_input(INPUT_POST , 'friday__afternoon__end', FILTER_SANITIZE_STRING);\n $fridayStart = filter_input(INPUT_POST , 'friday__start', FILTER_SANITIZE_STRING);\n $fridayEnd = filter_input(INPUT_POST , 'friday__end', FILTER_SANITIZE_STRING);\n $fridayResultStandard = filter_input(INPUT_POST , 'friday__result__standard', FILTER_SANITIZE_STRING);\n $fridayResultHundredths = filter_input(INPUT_POST , 'friday__result__hundredths', FILTER_SANITIZE_STRING);\n $saturdayMorningStart = filter_input(INPUT_POST , 'saturday__morning__start', FILTER_SANITIZE_STRING);\n $saturdayMorningEnd = filter_input(INPUT_POST , 'saturday__morning__end', FILTER_SANITIZE_STRING);\n $saturdayAfternoonStart = filter_input(INPUT_POST , 'saturday__afternoon__start', FILTER_SANITIZE_STRING);\n $saturdayAfternoonEnd = filter_input(INPUT_POST , 'saturday__afternoon__end', FILTER_SANITIZE_STRING);\n $saturdayStart = filter_input(INPUT_POST , 'saturday__start', FILTER_SANITIZE_STRING);\n $saturdayEnd = filter_input(INPUT_POST , 'saturday__end', FILTER_SANITIZE_STRING);\n $saturdayResultStandard = filter_input(INPUT_POST , 'saturday__result__standard', FILTER_SANITIZE_STRING);\n $saturdayResultHundredths = filter_input(INPUT_POST , 'saturday__result__hundredths', FILTER_SANITIZE_STRING);\n $finalStandardResult = filter_input(INPUT_POST , 'finalStandardResult', FILTER_SANITIZE_STRING);\n $finalHundredthsResult = filter_input(INPUT_POST , 'finalhundredthsResult', FILTER_SANITIZE_STRING);\n $token = filter_input(INPUT_POST, 'token', FILTER_SANITIZE_STRING);\n\n $errorsList = [];\n\n if(empty($token) || $token != $_SESSION['csrfToken']){\n $errorsList[] = \"Erreur CSRF !\";\n }\n\n if(empty($errorsList)) {\n $table = new Table;\n\n $table->setWeekStart($weekStart)\n ->setWeekEnd($weekEnd)\n ->setMondayMorningStart($mondayMorningStart)\n ->setMondayMorningEnd($mondayMorningEnd)\n ->setMondayAfternoonStart($mondayAfternoonStart)\n ->setMondayAfternoonEnd($mondayAfternoonEnd)\n ->setMondayStart($mondayStart)\n ->setMondayEnd($mondayEnd)\n ->setMondayResultStandard($mondayResultStandard)\n ->setMondayResultHundredths($mondayResultHundredths)\n ->setTuesdayMorningStart($tuesdayMorningStart)\n ->setTuesdayMorningEnd($tuesdayMorningEnd)\n ->setTuesdayAfternoonStart($tuesdayAfternoonStart)\n ->setTuesdayAfternoonEnd($tuesdayAfternoonEnd)\n ->setTuesdayStart($tuesdayStart)\n ->setTuesdayEnd($tuesdayEnd)\n ->setTuesdayResultStandard($tuesdayResultStandard)\n ->setTuesdayResultHundredths($tuesdayResultHundredths)\n ->setWednesdayMorningStart($wednesdayMorningStart)\n ->setWednesdayMorningEnd($wednesdayMorningEnd)\n ->setWednesdayAfternoonStart($wednesdayAfternoonStart)\n ->setWednesdayAfternoonEnd($wednesdayAfternoonEnd)\n ->setWednesdayStart($wednesdayStart)\n ->setWednesdayEnd($wednesdayEnd)\n ->setWednesdayResultStandard($wednesdayResultStandard)\n ->setWednesdayResultHundredths($wednesdayResultHundredths)\n ->setThursdayMorningStart($thursdayMorningStart)\n ->setThursdayMorningEnd($thursdayMorningEnd)\n ->setThursdayAfternoonStart($thursdayAfternoonStart)\n ->setThursdayAfternoonEnd($thursdayAfternoonEnd)\n ->setThursdayStart($thursdayStart)\n ->setThursdayEnd($thursdayEnd)\n ->setThursdayResultStandard($thursdayResultStandard)\n ->setThursdayResultHundredths($thursdayResultHundredths)\n ->setFridayMorningStart($fridayMorningStart)\n ->setFridayMorningEnd($fridayMorningEnd)\n ->setFridayAfternoonStart($fridayAfternoonStart)\n ->setFridayAfternoonEnd($fridayAfternoonEnd)\n ->setFridayStart($fridayStart)\n ->setFridayEnd($fridayEnd)\n ->setFridayResultStandard($fridayResultStandard)\n ->setFridayResultHundredths($fridayResultHundredths)\n ->setSaturdayMorningStart($saturdayMorningStart)\n ->setSaturdayMorningEnd($saturdayMorningEnd)\n ->setSaturdayAfternoonStart($saturdayAfternoonStart)\n ->setSaturdayAfternoonEnd($saturdayAfternoonEnd)\n ->setSaturdayStart($saturdayStart)\n ->setSaturdayEnd($saturdayEnd)\n ->setSaturdayResultStandard($saturdayResultStandard)\n ->setSaturdayResultHundredths($saturdayResultHundredths)\n ->setFinalStandardResult($finalStandardResult)\n ->setFinalHundredthsResult($finalHundredthsResult)\n ->setUserId($user->getId())\n ;\n\n $result = $table->insertNew();\n \n if ($result) {\n $errorsList = [];\n unset($_SESSION['token']);\n $_SESSION['tableSuccess'] = \"Votre tableau d'heures a bien été enregister, vous pouvez le consulter depuis votre espace personnel\";\n\n return $this->redirectTo('profil', $user->getNickname());\n }\n\n $errorsList[] = 'Une erreur s\\'est produite, veuillez réessayer plus tard ou contacter un administarteur';\n\n }\n\n $viewDatas = [\n 'errorsList' => $errorsList,\n ];\n\n return $this->render('main/table.tpl.php', $viewDatas);\n\n }\n }\n\n return $this->redirectTo('login');\n }",
"public function fillHours($brID)\n {\n //Query To Get The Old Data Of The Branch WorkingDay Hours\n $sql = \"SELECT * FROM work_hours WHERE branch_id=?\";\n $values=array($brID);\n $workDay=$this->getInfo($sql,$values);\n //Fill the Modal With The Working Hours Information Of Every Day From The DataBase Of The Branch That Represent Choosed\n ?>\n <thead>\n <tr>\n <!-- First column header is not rotated -->\n <th></th>\n <!-- Following headers are rotated -->\n <th class=\"rotate\"><div><span>פתיחת הסניף</span></div></th>\n <th class=\"rotate\"><div><span>הפסקה</span></div></th>\n <th class=\"rotate\"><div><span>סיום הפסקה</span></div></th>\n <th class=\"rotate\"><div><span>סגירת הסניף</span></div></th>\n </tr> \n </thead>\n <tbody>\n <tr>\n <th class=\"row-header\">ראשון</th>\n <td><input type=\"time\" class=\"editday\" value= \"<?php echo $workDay[0]['startA']; ?>\"></td>\n <td><input type=\"time\" class=\"editday\" value= \"<?php echo $workDay[0]['endA']; ?>\"></td>\n <td><input type=\"time\" class=\"editday\" value= \"<?php echo $workDay[0]['startB']; ?>\"></td>\n <td><input type=\"time\" class=\"editday\" value= \"<?php echo $workDay[0]['endB']; ?>\"></td>\n </tr>\n <tr>\n <th class=\"row-header\">שני</th>\n <td><input type=\"time\" class=\"editday\" value= \"<?php echo $workDay[1]['startA']; ?>\"></td>\n <td><input type=\"time\" class=\"editday\" value= \"<?php echo $workDay[1]['endA']; ?>\"></td>\n <td><input type=\"time\" class=\"editday\" value= \"<?php echo $workDay[1]['startB']; ?>\"></td>\n <td><input type=\"time\" class=\"editday\" value= \"<?php echo $workDay[1]['endB']; ?>\"></td>\n </tr>\n <tr>\n <th class=\"row-header\">שלישי</th>\n <td><input type=\"time\" class=\"editday\" value= \"<?php echo $workDay[2]['startA']; ?>\"></td>\n <td><input type=\"time\" class=\"editday\" value= \"<?php echo $workDay[2]['endA']; ?>\"></td>\n <td><input type=\"time\" class=\"editday\" value= \"<?php echo $workDay[2]['startB']; ?>\"></td>\n <td><input type=\"time\" class=\"editday\" value= \"<?php echo $workDay[2]['endB']; ?>\"></td>\n </tr>\n <tr>\n <th class=\"row-header\">רביעי</th>\n <td><input type=\"time\" class=\"editday\" value= \"<?php echo $workDay[3]['startA']; ?>\"></td>\n <td><input type=\"time\" class=\"editday\" value= \"<?php echo $workDay[3]['endA']; ?>\"></td>\n <td><input type=\"time\" class=\"editday\" value= \"<?php echo $workDay[3]['startB']; ?>\"></td>\n <td><input type=\"time\" class=\"editday\" value= \"<?php echo $workDay[3]['endB']; ?>\"></td>\n </tr>\n <tr>\n <th class=\"row-header\">חמישי</th>\n <td><input type=\"time\" class=\"editday\" value= \"<?php echo $workDay[4]['startA']; ?>\"></td>\n <td><input type=\"time\" class=\"editday\" value= \"<?php echo $workDay[4]['endA']; ?>\"></td>\n <td><input type=\"time\" class=\"editday\" value= \"<?php echo $workDay[4]['startB']; ?>\"></td>\n <td><input type=\"time\" class=\"editday\" value= \"<?php echo $workDay[4]['endB']; ?>\"></td>\n </tr>\n <tr>\n <th class=\"row-header\">שישי</th>\n <td><input type=\"time\" class=\"editday\" value= \"<?php echo $workDay[5]['startA']; ?>\"></td>\n <td><input type=\"time\" class=\"editday\" value= \"<?php echo $workDay[5]['endA']; ?>\"></td>\n <td><input type=\"time\" class=\"editday\" value= \"<?php echo $workDay[5]['startB']; ?>\"></td>\n <td><input type=\"time\" class=\"editday\" value= \"<?php echo $workDay[5]['endB']; ?>\"></td>\n </tr>\n <tr>\n <th class=\"row-header\">שבת</th>\n <td><input type=\"time\" class=\"editday\" value= \"<?php echo $workDay[6]['startA']; ?>\"></td>\n <td><input type=\"time\" class=\"editday\" value= \"<?php echo $workDay[6]['endA']; ?>\"></td>\n <td><input type=\"time\" class=\"editday\" value= \"<?php echo $workDay[6]['startB']; ?>\"></td>\n <td><input type=\"time\" class=\"editday\" value= \"<?php echo $workDay[6]['endB']; ?>\"></td>\n </tr>\n </tbody>\n <?php\n \n }",
"function _handleTimePeriod() {\n\t\t$sessKeyStart = 'stats_start_date';\n\t\t$sessKeyEnd = 'stats_end_date';\n\n\t\tif (!$this->isPost()) {\n\t\t\t$startDate = strtotime(Configure::read('Stats.startDate'));\n\t\t\t$endDate = strtotime(date('Y-m-d'));\n\n\t\t\tif ($this->Session->check($sessKeyStart)) {\n\t\t\t\t$startDate = $this->Session->read($sessKeyStart);\n\t\t\t}\n\t\t\tif ($this->Session->check($sessKeyEnd)) {\n\t\t\t\t$endDate = $this->Session->read($sessKeyEnd);\n\t\t\t}\n\n\t\t\tif (isset($this->params['url']['startDate'])) {\n\t\t\t\t$startDate = $this->params['url']['startDate'];\n\t\t\t}\n\t\t\tif (isset($this->params['url']['endDate'])) {\n\t\t\t\t$endDate = $this->params['url']['endDate'];\n\t\t\t}\n\t\t} else {\n\t\t\t$startDate = strtotime($this->cleanupDate($this->data['Statistics']['startDate']));\n\t\t\t$endDate = strtotime($this->cleanupDate($this->data['Statistics']['endDate']));\n\n\t\t\t$this->Session->write($sessKeyStart, $startDate);\n\t\t\t$this->Session->write($sessKeyEnd, $endDate);\n\t\t}\n\n\t\tif ($startDate > $endDate) {\n\t\t\t$msg = __('Sorry, the beginning date must be before the end date.', true);\n\t\t\t$this->Message->add($msg, 'error');\n\n\t\t}\n\n\t\t// determine based on the difference between start and enddate what the type of the diagram should be\n\t\t// If the x-axis should be based on day, month or year\n\t\t$type = 'year';\n\t\t$diff = abs($endDate - $startDate);\n\t\tswitch (true) {\n\t\t\tcase ($diff <= DAY):\n\t\t\t\t$type = 'hour';\n\t\t\t\tbreak;\n\t\t\tcase ($diff <= MONTH + 5 * DAY):\n\t\t\t\t$type = 'day';\n\t\t\t\tbreak;\n\t\t\tcase ($diff <= 2 * YEAR):\n\t\t\t\t$type = 'month';\n\t\t\t\tbreak;\n\t\t}\n\t\t$this->diagramType = $type;\n\n\t\t$format = 'Y-m-d';\n\t\tif ($type == 'hour') {\n\t\t\t$format = 'Y-m-d H:00';\n\t\t}\n\n\t\t$this->startDate = date($format, $startDate);\n\t\t$this->endDate = date($format, $endDate);\n\t\t$this->set(compact('startDate', 'endDate'));\n\t}",
"public function store(Request $request)\n {\n $user = Auth::user();\n $request->validate([\n 'day' => 'required',\n 'hours' => 'required',\n 'date' => 'required',\n 'beginTime' =>'required',\n 'endTime' => 'required'\n ]);\n $post = new HourRegistration;\n $post->day = $request->input('day');\n $post->hours = $request->input('hours');\n $post->date = $request->input('date');\n $post->beginTime = $request->input('beginTime');\n $post->endTime = $request->input('endTime');\n $post->user_id = $user->id;\n $post->save();\n return redirect('/hour')->with('success', 'hours registrated');\n }",
"public function form()\n {\n $key = $this->getKey();\n $form = new PHPWS_Form('schedule_form');\n\n if (isset($_REQUEST['js'])) {\n $form->addHidden('js', 1);\n }\n\n $form->addHidden('module', 'calendar');\n $form->addHidden('aop', 'post_schedule');\n $form->addHidden('sch_id', $this->id);\n\n $form->addText('title', $this->title);\n $form->setLabel('title', dgettext('calendar', 'Title'));\n $form->setSize('title', 40);\n\n $form->addTextArea('summary', $this->summary);\n $form->setLabel('summary', dgettext('calendar', 'Summary'));\n $form->useEditor('summary');\n\n if (PHPWS_Settings::get('calendar', 'personal_schedules')) {\n if (Current_User::allow('calendar', 'edit_public')) {\n $form->addRadio('public', array(0,1));\n $form->setLabel('public', array(dgettext('calendar', 'Private'),\n dgettext('calendar', 'Public')));\n $form->setMatch('public', (int)$this->public);\n } else {\n $form->addTplTag('PUBLIC', dgettext('calendar', 'Private'));\n $form->addHidden('public', 0);\n }\n } else {\n $form->addTplTag('PUBLIC', dgettext('calendar', 'Public'));\n $form->addHidden('public', 1);\n }\n\n $upcoming[0] = dgettext('calendar', 'Do not show upcoming events');\n $upcoming[1] = dgettext('calendar', 'Show upcoming week');\n $upcoming[2] = dgettext('calendar', 'Show next two weeks');\n $upcoming[3] = dgettext('calendar', 'Show upcoming month');\n\n $form->addSelect('show_upcoming', $upcoming);\n $form->setLabel('show_upcoming', dgettext('calendar', 'Show upcoming events'));\n $form->setMatch('show_upcoming', $this->show_upcoming);\n\n $form->addSubmit(dgettext('calendar', 'Save'));\n\n $template = $form->getTemplate();\n\n if (isset($_REQUEST['js'])) {\n $template['CLOSE'] = javascript('close_window', array('value' => dgettext('calendar', 'Cancel')));\n }\n\n $template['PUBLIC_LABEL'] = dgettext('calendar', 'Availability');\n return PHPWS_Template::process($template, 'calendar', 'admin/forms/edit_schedule.tpl');\n }",
"private function showWhyRequestForm() { $this->config->showPrinterFriendly = false;\r\n echo '<h2>Why are you requesting time?</h2>';\r\n $this->showTimeTypeDropDown();\r\n echo '<br/><br/><br/>';\r\n }",
"function hcfw_event_day_time_html( $post ) {\n\t$event_date = get_post_meta( $post->ID, '_hcfw_event_date', true );\n\t$all_day = get_post_meta( $post->ID, '_hcfw_event_all_day', true );\n\t$start_time = get_post_meta( $post->ID, '_hcfw_event_start_time', true );\n\t$end_time = get_post_meta( $post->ID, '_hcfw_event_end_time', true );\n?>\n\t<table class=\"form-table\">\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<th scope=\"row\">\n\t\t\t\t\t<label for=\"hcfw_event_date\"><?php _e( 'Date', 'csu-hcfw-resources' ); ?></label>\n\t\t\t\t</th>\n\t\t\t\t<td>\n\t\t\t\t\t<input name=\"hcfw_event_date\" id=\"hcfw_event_date\" type=\"date\" value=\"<?php echo esc_attr( $event_date ); ?>\">\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<th scope=\"row\"><label for=\"hcfw_event_all_day\"><?php _e( 'All Day Event', 'csu-hcfw-resources' ); ?></label></th>\n\t\t\t\t<td>\n\t\t\t\t\t<input type=\"checkbox\" id=\"hcfw_event_all_day\" name=\"hcfw_event_all_day\" <?php checked( $all_day ); ?>>\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<th scope=\"row\">\n\t\t\t\t\t<label for=\"hcfw_event_start_time\"><?php _e( 'Start Time', 'csu-hcfw-resources' ); ?></label>\n\t\t\t\t</th>\n\t\t\t\t<td>\n\t\t\t\t\t<input name=\"hcfw_event_start_time\" id=\"hcfw_event_start_time\" type=\"time\" value=\"<?php echo esc_attr( $start_time ); ?>\">\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<th scope=\"row\">\n\t\t\t\t\t<label for=\"hcfw_event_end_time\"><?php _e( 'End Time', 'csu-hcfw-resources' ); ?></label>\n\t\t\t\t</th>\n\t\t\t\t<td>\n\t\t\t\t\t<input name=\"hcfw_event_end_time\" id=\"hcfw_event_end_time\" type=\"time\" value=\"<?php echo esc_attr( $end_time ); ?>\">\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t</tbody>\n\t</table>\n<?php\n}",
"public function set_location_trading_hour_days(){}"
] |
[
"0.6567043",
"0.65431494",
"0.64769363",
"0.6450958",
"0.64235073",
"0.6135308",
"0.6070914",
"0.59318346",
"0.5770438",
"0.5725858",
"0.56991094",
"0.567549",
"0.5673166",
"0.563734",
"0.5528911",
"0.5504294",
"0.54557294",
"0.5432114",
"0.5431034",
"0.5357269",
"0.5344424",
"0.5339944",
"0.5312352",
"0.5305969",
"0.52854675",
"0.52778375",
"0.52717966",
"0.5261738",
"0.52462065",
"0.5230583"
] |
0.7169916
|
0
|
Form constructor for the SMS / Wireless Carriers configuration page.
|
function room_reservations_admin_settings_sms($form, &$form_state) {
$default_sms_option = _room_reservations_get_variable('sms_option');
$form['#tree'] = TRUE;
$form['sms_option'] = array(
'#title' => t('SMS option'),
'#type' => 'checkbox',
'#return_value' => 1,
'#default_value' => $default_sms_option,
'#description' => t('Give users the option of receiving confirmation
messages and reminders as SMS text messages.'),
'#weight' => -110,
);
$form['carriers'] = array(
'#type' => 'fieldset',
'#title' => t('Wireless carriers'),
'#collapsible' => TRUE,
'#collapsed' => FALSE,
'#weight' => -100,
);
$sql = "
SELECT id, value
FROM {room_reservations_variables}
WHERE name = '%s'
ORDER BY value
";
$result = db_query($sql, 'carrier');
if ($result) {
$options = array();
$form['carriers']['list_0'] = array(
'#value' => '<table><tr><th>' . t('Wireless carrier') . '</th><th>' .
t('Domain name') . '</th></tr>',
'#weight' => -99,
);
$x = 0;
while ($data = db_fetch_object($result)) {
$x++;
$id = $data->id;
$values = explode('~', $data->value);
$options[strval($id)] = $values[0];
$form['carriers']['list_' . $x] = array(
'#value' => '<tr><td>' . check_plain($values[0]) . '</td><td>' .
check_plain($values[1]) . '</td></tr>',
'#weight' => -99 + $x,
);
$x++;
}
$form['carriers']['list_' . $x] = array(
'#value' => '</table>',
'#weight' => -99 + $x,
);
}
$form['save'] = array(
'#type' => 'submit',
'#value' => t('Save configuration'),
'#weight' => 100,
);
$form['reset'] = array(
'#type' => 'submit',
'#value' => t('Reset to defaults'),
'#weight' => 101,
);
return $form;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function room_reservations_admin_settings_sms_add($form, &$form_state) {\n $form['carrier'] = array(\n '#title' => t('Wireless carrier'),\n '#type' => 'textfield',\n '#maxlength' => 50,\n '#size' => 50,\n '#description' => t('The name of the wireless carrier, such as !att or\n !verizon.', array(\n '!att' => 'AT&T',\n '!verizon' => 'Verizon',\n )),\n '#weight' => -20,\n );\n $form['domain'] = array(\n '#title' => t('Domain name'),\n '#type' => 'textfield',\n '#maxlength' => 50,\n '#size' => 50,\n '#description' => t('The domain name of the wireless carrier, such as\n !att or !verizon.', array(\n '!att' => '@txt.att.net',\n '!verizon' => '@vtext.com',\n )),\n '#weight' => -10,\n );\n $form['add_carrier']['add'] = array(\n '#type' => 'submit',\n '#value' => t('Add'),\n '#weight' => 100,\n );\n return $form;\n}",
"public function __construct()\n {\n parent::__construct(array(\n 'name' => __('WS Form', 'ws-form'),\n 'description' => __('Add a form.', 'ws-form'),\n 'category'\t\t=> __('Basic', 'ws-form'),\n 'dir' => FL_WS_FORM_DIR . 'modules/ws-form/',\n 'url' => FL_WS_FORM_URL . 'modules/ws-form/',\n 'editor_export' => true, // Defaults to true and can be omitted.\n 'enabled' => true, // Defaults to true and can be omitted.\n 'icon' => 'icon.svg'\n ));\n }",
"public function __construct()\n {\n $this->name = 'payneteasy';\n $this->tab = 'payments_gateways';\n $this->version = '1.0.0';\n $this->author = 'Artem Ponomarenko';\n $this->currencies_mode = 'radio';\n $this->submit_action = 'submit_' . $this->name;\n\n parent::__construct();\n\n $this->displayName = $this->l('PaynetEasy payment form');\n $this->description = $this->l('Accepts payments by credit cards with PaynetEasy payment form.');\n $this->confirmUninstall = $this->l('Are you sure you want to uninstall?');\n }",
"public function initConfigurationForm()\n\t{\n\t\tglobal $lng, $ilCtrl;\n\t\t\n\t\t$pl = $this->getPluginObject();\n\t\n\t\tinclude_once(\"Services/Form/classes/class.ilPropertyFormGUI.php\");\n\t\t$form = new ilPropertyFormGUI();\n\t\n\t\t// setting 1 (a checkbox)\n\t\t$cb = new ilCheckboxInputGUI($pl->txt(\"setting_1\"), \"setting_1\");\n\t\t$form->addItem($cb);\n\t\t\n\t\t// setting 2 (text)\n\t\t$ti = new ilTextInputGUI($pl->txt(\"setting_2\"), \"setting_2\");\n\t\t$ti->setRequired(true);\n\t\t$ti->setMaxLength(10);\n\t\t$ti->setSize(10);\n\t\t$form->addItem($ti);\n\t\n\t\t$form->addCommandButton(\"save\", $lng->txt(\"save\"));\n\t \n\t\t$form->setTitle($pl->txt(\"example_plugin_configuration\"));\n\t\t$form->setFormAction($ilCtrl->getFormAction($this));\n\t\t\n\t\treturn $form;\n\t}",
"public function __construct() {\t\t# Constuct FGContactForm object\n $this->receipients = array();\n $this->errors = array();\n $this->form_random_key = 'HTgsjhartag';\t\t\t\t\t\t\t\t# preg_replace(): removes 'index.php' from the $_SERVER['REQUEST_URI'] URL....\n\t\t$this->website = self::HTTP.htmlentities($_SERVER['SERVER_NAME']).preg_replace('/'.self::HOME_PAGE.'/', '', htmlentities($_SERVER['REQUEST_URI']));\n\t\t$this->home = $this->website.self::HOME_PAGE;\n\t\t# echo \"<pre>PayPal Subscribe = \".$this->website.self::SUBSCRIBE.PHP_EOL.'</pre>';\n }",
"protected function _construct()\r\n {\r\n parent::_construct();\r\n $this->setTemplate('placetopay/form.phtml');\r\n }",
"private function _initGeneralSettingsForm()\n\t{\n\t\tglobal $txt, $context;\n\n\t\t// Instantiate the form\n\t\t$this->_generalSettingsForm = new Settings_Form(Settings_Form::DB_ADAPTER);\n\n\t\t$config_vars = array(\n\t\t\tarray('select', 'sp_portal_mode', explode('|', $txt['sp_portal_mode_options'])),\n\t\t\tarray('check', 'sp_maintenance'),\n\t\t\tarray('text', 'sp_standalone_url'),\n\t\t\t'',\n\t\t\tarray('select', 'portaltheme', $context['SPortal']['themes']),\n\t\t\tarray('check', 'sp_disableColor'),\n\t\t\tarray('check', 'sp_disableForumRedirect'),\n\t\t\tarray('check', 'sp_disable_random_bullets'),\n\t\t\tarray('check', 'sp_disable_php_validation', 'subtext' => $txt['sp_disable_php_validation_desc']),\n\t\t\tarray('check', 'sp_disable_side_collapse'),\n\t\t\tarray('check', 'sp_resize_images'),\n\t\t\tarray('check', 'sp_disableMobile'),\n\t\t);\n\n\t\t$this->_generalSettingsForm->setConfigVars($config_vars);\n\t}",
"protected function _construct()\r\n {\r\n parent::_construct();\r\n $this->_controller = 'adminhtml_config_cms_page';\r\n $this->_blockGroup = 'TransPerfect_GlobalLink';\r\n $this->_headerText = __('CMS Page Configuration');\r\n }",
"protected function getConfigForm()\n {\n $config_form = array(\n 'form' => array(\n 'legend' => array(\n 'title' => $this->l('Settings'),\n 'icon' => 'icon-cogs',\n ),\n 'input' => array(\n array(\n 'type' => 'switch',\n 'label' => $this->l('Equivalence surcharge'),\n 'name' => 'PROFITMARGIN_EQUIVALENCE_SURCHARGE_ENABLED',\n 'is_bool' => true,\n 'desc' => $this->l('Enable equivalence surcharge when calculating profit'),\n 'values' => array(\n array(\n 'id' => 'active_on',\n 'value' => true,\n 'label' => $this->l('Enabled')\n ),\n array(\n 'id' => 'active_off',\n 'value' => false,\n 'label' => $this->l('Disabled')\n )\n ),\n ),\n ),\n 'submit' => array(\n 'title' => $this->l('Save'),\n ),\n ),\n );\n\n\n $available_taxes = $this->getAvailableTaxes();\n foreach ($available_taxes as $tax) {\n $config_form['form']['input'][] = array(\n 'type' => 'text',\n 'name' => \"PROFITMARGIN_EQUIVALENCE_SURCHARGE_{$tax['id_tax']}\",\n 'label' => $this->l($tax['name']),\n 'desc' => $this->l('Equivalence surcharge'),\n 'suffix' => '%', \n 'col' => 1,\n );\n }\n\n $config_form['form']['input'][] = array( // @TODO: Default shipping cost for each carrier\n 'type' => 'text',\n 'name' => 'PROFITMARGIN_DEFAULT_SHIPPING_COST',\n 'label' => $this->l('Default shipping cost'),\n 'suffix' => '€', \n 'col' => 1,\n );\n\n $config_form['form']['input'][] = array(\n 'type' => 'radio',\n 'name' => 'PROFITMARGIN_SHIPPING_COST_TAX',\n 'label' => $this->l('Shipping cost tax'),\n 'values' => array()\n );\n \n foreach ($available_taxes as $tax) {\n $shipping_cost_tax = &$config_form['form']['input'];\n $shipping_cost_tax[array_key_last($shipping_cost_tax)]['values'][] = array(\n 'id' => \"tax_{$tax['id_tax']}\",\n 'value' => $tax['id_tax'],\n 'label' => $this->l($tax['name'])\n );\n }\n \n foreach ($this->getAvailablePaymentModules() as $payment_module) {\n $config_form['form']['input'][] = array(\n 'type' => 'text',\n 'name' => \"PROFITMARGIN_PAYMENT_FEE_BASE_{$payment_module['id_module']}\",\n 'label' => $this->l($payment_module['name']),\n 'desc' => $this->l('Base fee'),\n 'suffix' => '€', \n 'col' => 1,\n );\n $config_form['form']['input'][] = array(\n 'type' => 'text',\n 'name' => \"PROFITMARGIN_PAYMENT_FEE_PERCENTAGE_{$payment_module['id_module']}\",\n 'desc' => $this->l('Percentage fee'),\n 'suffix' => '%',\n 'col' => 1,\n );\n }\n\n return $config_form;\n }",
"public function init_form_fields(){\n \n\t\t$this->form_fields = array(\n\t\t\t'enabled' => array(\n\t\t\t\t'title' => 'Enable/Disable',\n\t\t\t\t'label' => 'Enable Vortex Gateway',\n\t\t\t\t'type' => 'checkbox',\n\t\t\t\t'description' => '',\n\t\t\t\t'default' => 'no'\n\t\t\t),\n\t\t\t'title' => array(\n\t\t\t\t'title' => 'Title',\n\t\t\t\t'type' => 'text',\n\t\t\t\t'description' => 'This controls the title which the user sees during checkout.',\n\t\t\t\t'default' => 'Vortex Payment',\n\t\t\t\t'desc_tip' => true,\n\t\t\t),\n\t\t\t'description' => array(\n\t\t\t\t'title' => 'Description',\n\t\t\t\t'type' => 'textarea',\n\t\t\t\t'description' => 'This controls the description which the user sees during checkout.',\n\t\t\t\t'default' => 'Paga con Vortex Payment.',\n\t\t\t),\n\t\t\t'BID' => array(\n\t\t\t\t'title' => 'Business ID',\n\t\t\t\t'type' => 'text'\n\t\t\t)\n\n\t\t\t);\n \n\t \t}",
"function init_form_fields() {\n \n \t$this->form_fields = array(\n\t\t\t'enabled' => array(\n\t\t\t\t'title' => __( 'Enable/Disable', WC_Authorize_SIM::TEXT_DOMAIN ), \n\t\t\t\t'label' => __( 'Enable Authorize.Net SIM Payment Module', WC_Authorize_SIM::TEXT_DOMAIN ), \n\t\t\t\t'type' => 'checkbox', \n\t\t\t\t'description' => '', \n\t\t\t\t'default' => 'no'\n\t\t\t), \n\t\t\t'title' => array(\n\t\t\t\t'title' => __( 'Title' ), \n\t\t\t\t'type' => 'text', \n\t\t\t\t'description' => __( 'This controls the title which the user sees during checkout.', WC_Authorize_SIM::TEXT_DOMAIN ), \n\t\t\t\t'default' => __( 'Authorize.net SIM', WC_Authorize_SIM::TEXT_DOMAIN ),\n\t\t\t\t'css' => \"width: 300px;\"\n\t\t\t), \n\t\t\t'description' => array(\n\t\t\t\t'title' => __( 'Description', WC_Authorize_SIM::TEXT_DOMAIN ), \n\t\t\t\t'type' => 'textarea', \n\t\t\t\t'description' => __( 'This controls the description which the user sees during checkout.', WC_Authorize_SIM::TEXT_DOMAIN ), \n\t\t\t\t'default' => 'Pay with your credit card via Authorize.net.'\n\t\t\t),\n\t\t\t'debug' => array(\n\t\t\t\t'title' => __( 'Debug', WC_Authorize_SIM::TEXT_DOMAIN ), \n\t\t\t\t'type' => 'checkbox', \n\t\t\t\t'label' => __( 'Enable logging (<code>woocommerce/logs/authorize_sim.txt</code>)', WC_Authorize_SIM::TEXT_DOMAIN ), \n\t\t\t\t'default' => 'no'\n\t\t\t),\n\t\t\t'testmode' => array(\n\t\t\t\t'title' => __( 'Test mode', WC_Authorize_SIM::TEXT_DOMAIN ), \n\t\t\t\t'label' => __( 'Test Mode allows you to submit test transactions to the payment gateway', WC_Authorize_SIM::TEXT_DOMAIN ), \n\t\t\t\t'type' => 'checkbox', \n\t\t\t\t'description' => __( 'You may want to set to true if testing against production', WC_Authorize_SIM::TEXT_DOMAIN ), \n\t\t\t\t'default' => 'no'\n\t\t\t), \n\t\t\t'login_id' => array(\n\t\t\t\t'title' => __( 'API Login ID', WC_Authorize_SIM::TEXT_DOMAIN ), \n\t\t\t\t'type' => 'text', \n\t\t\t\t'description' => __( 'This is API Lgoin supplied by Authorize.', WC_Authorize_SIM::TEXT_DOMAIN ), \n\t\t\t\t'default' => ''\n\t\t\t), \n\t\t\t'tran_key' => array(\n\t\t\t\t'title' => __( 'Transaction Key', WC_Authorize_SIM::TEXT_DOMAIN ), \n\t\t\t\t'type' => 'text', \n\t\t\t\t'description' => __( 'This is Transaction Key supplied by Authorize.', WC_Authorize_SIM::TEXT_DOMAIN ), \n\t\t\t\t'default' => ''\n\t\t\t),\n\t\t\t'md5_hash' => array(\n\t\t\t\t'title' => __( 'MD5 Hash', WC_Authorize_SIM::TEXT_DOMAIN ), \n\t\t\t\t'type' => 'text', \n\t\t\t\t'description' => __( 'The MD5 hash value to verify transactions', WC_Authorize_SIM::TEXT_DOMAIN ), \n\t\t\t\t'default' => ''\n\t\t\t),\n\t\t\t'type' => array(\n\t\t\t\t'title' => __( 'Sale Method', WC_Authorize_SIM::TEXT_DOMAIN ), \n\t\t\t\t'type' => 'select', \n\t\t\t\t'description' => __( 'Select which sale method to use. Authorize Only will authorize the customers card for the purchase amount only. Authorize & Capture will authorize the customer\\'s card and collect funds.', WC_Authorize_SIM::TEXT_DOMAIN ), \n\t\t\t\t'options' => array(\n\t\t\t\t\t'AUTH_CAPTURE'=>'Authorize & Capture',\n\t\t\t\t\t'AUTH_ONLY'=>'Authorize Only'\n\t\t\t\t),\n\t\t\t\t'default' => 'AUTH_CAPTURE'\n\t\t\t),\n\t\t\t'tran_mode' => array(\n\t\t\t\t'title' => __( 'Transaction Mode', WC_Authorize_SIM::TEXT_DOMAIN ), \n\t\t\t\t'type' => 'select', \n\t\t\t\t'description' => __( 'Transaction mode used for processing orders', WC_Authorize_SIM::TEXT_DOMAIN ), \n\t\t\t\t'options' => array('live'=>'Live', 'sandbox'=>'Sandbox'),\n\t\t\t\t'default' => 'live'\n\t\t\t),\n\t\t\t\n\t\t);\n }",
"protected function initializeForm()\n {\n $this->form = new Form();\n $this->form->add(Element::create(\"FieldSet\",\"Report Format\")->add\n (\n Element::create(\"SelectionList\", \"File Format\", \"report_format\")\n ->addOption(\"Hypertext Markup Language (HTML)\",\"html\")\n ->addOption(\"Portable Document Format (PDF)\",\"pdf\")\n ->addOption(\"Microsoft Excel (XLS)\",\"xls\")\n ->addOption(\"Microsoft Word (DOC)\",\"doc\")\n ->setRequired(true)\n ->setValue(\"pdf\"),\n Element::create(\"SelectionList\", \"Page Orientation\", \"page_orientation\")\n ->addOption(\"Landscape\", \"L\")\n ->addOption(\"Portrait\", \"P\")\n ->setValue(\"L\"),\n Element::create(\"SelectionList\", \"Paper Size\", \"paper_size\")\n ->addOption(\"A4\", \"A4\")\n ->addOption(\"A3\", \"A3\")\n ->setValue(\"A4\")\n )->setId(\"report_formats\")->addAttribute(\"style\",\"width:50%\")\n );\n $this->form->setSubmitValue(\"Generate\");\n $this->form->addAttribute(\"action\",Application::getLink($this->path.\"/generate\"));\n $this->form->addAttribute(\"target\",\"blank\");\n }",
"public function init()\n {\n $this->setName('carboncopy')\n ->setLabel('Options');\n\n $this->add(\n array(\n 'type' => 'Laminas\\Form\\Element\\Checkbox',\n 'name' => 'carboncopy',\n 'options' => array(\n 'checked_value' => '1',\n 'unchecked_value' => '0',\n 'label' => 'send me a carbon copy',\n )\n )\n );\n }",
"public function init()\n {\n $this->setMethod('post');\n $this->addElement('text', 'model', array('label' => 'Model'));\n $this->addElement('text', 'unique', array('label' => 'Numer zamówienia'));\n $this->addElement('text', 'ebay_id', array('label' => 'Numer ebay'));\n $this->addElement('text', 'invoice_id', array('label' => 'Numer faktury vat'));\n $this->addElement('text', 'color', array('label' => 'Kolor'));\n $this->addElement('text', 'frame', array('label' => 'Stelaż'));\n $this->addElement('radio', 'is_seat', array('label' => 'Fotelik', 'multiOptions' => array('0' => 'Nie', '1' => 'Tak')));\n $this->addElement('select', 'status', array('label' => 'Status zamówienia', 'multiOptions' => array(\n 'paid' => 'Opłacone',\n 'unpaid' => 'Niepłacone',\n 'sent' => 'Wysłane',\n 'other' => 'Oczekuje'\n )));\n $this->addElement('text', 'wheels', array('label' => 'Koła'));\n $this->addElement('textarea', 'bonus', array('label' => 'Dodatki', 'cols' => 50, 'rows' => 3));\n $this->addElement('textarea', 'client', array('label' => 'Klient', 'cols' => 50, 'rows' => 3));\n $this->addElement('text', 'date_of_payment', array('label' => 'Data opłacenia', 'value' => null));\n $this->addElement('text', 'date_of_receipt', array('label' => 'Data odbioru', 'value' => null));\n $this->addElement('submit', 'submit', array('label' => 'Zapisz'));\n }",
"public function setConfig()\n {\n $this->postcode = isset($_POST['postcode']) ? htmlspecialchars($_POST['postcode']) : '000-0000';\n $this->maptype = isset($_POST['maptype']) ? htmlspecialchars($_POST['maptype']) : 'Static MAP';\n $this->unit = isset($_POST['unit']) ? htmlspecialchars($_POST['unit']) : 'CELSIUS';\n $this->apiLocation = isset($_POST['apiLocation']) ? htmlspecialchars($_POST['apiLocation']) : 'Google';\n $this->apiWeather = isset($_POST['apiWeather']) ? htmlspecialchars($_POST['apiWeather']) : 'OpenWeatherMap';\n }",
"public function init_form_fields() {\n\n $this->form_fields = apply_filters( 'wc_barter_form_fields', array(\n\n 'enabled' => array(\n 'title' => __( 'Enable/Disable', 'wc-gateway-barter' ),\n 'type' => 'checkbox',\n 'label' => __( 'Enable Offline Payment', 'wc-gateway-barter' ),\n 'default' => 'yes'\n ),\n\n 'title' => array(\n 'title' => __( 'Title', 'wc-gateway-barter' ),\n 'type' => 'text',\n 'description' => __( 'This controls the title for the payment method the customer sees during checkout.', 'wc-gateway-barter' ),\n 'default' => __( 'Offline Payment', 'wc-gateway-barter' ),\n 'desc_tip' => true,\n ),\n\n 'description' => array(\n 'title' => __( 'Description', 'wc-gateway-barter' ),\n 'type' => 'textarea',\n 'description' => __( 'Payment method description that the customer will see on your checkout.', 'wc-gateway-barter' ),\n 'default' => __( 'Please remit payment to Store Name upon pickup or delivery.', 'wc-gateway-barter' ),\n 'desc_tip' => true,\n ),\n\n 'instructions' => array(\n 'title' => __( 'Instructions', 'wc-gateway-barter' ),\n 'type' => 'textarea',\n 'description' => __( 'Instructions that will be added to the thank you page and emails.', 'wc-gateway-barter' ),\n 'default' => '',\n 'desc_tip' => true,\n ),\n ) );\n }",
"function init_form_fields() {\n /**\n * Build array of configurations that will be displayed on Admin Panel\n */\n parent::init_form_fields();\n WC_Midtrans_Utils::array_insert( $this->form_fields, 'enable_3d_secure', array(\n 'acquring_bank' => array(\n 'title' => __( 'Acquiring Bank', 'midtrans-woocommerce'),\n 'type' => 'text',\n 'label' => __( 'Acquiring Bank', 'midtrans-woocommerce' ),\n 'description' => __( 'You should leave it empty, it will be auto configured. </br> Alternatively may specify your card-payment acquiring bank for this payment option. </br> Options: BCA, BRI, DANAMON, MAYBANK, BNI, MANDIRI, CIMB, etc (Only choose 1 bank).' , 'midtrans-woocommerce' ),\n 'default' => ''\n )\n ));\n // Make this payment method enabled by default\n $this->form_fields['enabled']['default'] = 'yes';\n }",
"private function renderForm()\n\t{\n\t\t$config_values = Array(\n\t\t\t'clickline_account' => (isset($this->fields_list['CLICKLINE_ACCOUNT']) ? $this->fields_list['CLICKLINE_ACCOUNT'] : ''),\n\t\t\t'clickline_password' => (isset($this->fields_list['CLICKLINE_PASSWORD']) ? $this->fields_list['CLICKLINE_PASSWORD'] : ''),\n\t\t\t'clickline_cp_from' => (isset($this->fields_list['CLICKLINE_CP_FROM']) ? $this->fields_list['CLICKLINE_CP_FROM'] : ''),\n\t\t\t'clickline_country_from' => (isset($this->fields_list['CLICKLINE_COUNTRY_FROM']) ? $this->fields_list['CLICKLINE_COUNTRY_FROM'] : ''),\n\t\t\t'clickline_carrier_def' => (isset($this->fields_list['CLICKLINE_CARRIER_DEF']) ? $this->fields_list['CLICKLINE_CARRIER_DEF'] : 0),\n\t\t\t'apply_discount' => (int) Configuration::get('CLICKLINE_APPLY_DISCOUNT'),\n\t\t\t'shop_name' => (isset($this->fields_list['CLICKLINE_SHOP_NAME']) ? $this->fields_list['CLICKLINE_SHOP_NAME'] : ''),\n\t\t\t'first_name' => (isset($this->fields_list['CLICKLINE_FIRST_NAME']) ? $this->fields_list['CLICKLINE_FIRST_NAME'] : ''),\n\t\t\t'last_name' => (isset($this->fields_list['CLICKLINE_LAST_NAME']) ? $this->fields_list['CLICKLINE_LAST_NAME'] : ''),\n\t\t\t'last_name_2' => (isset($this->fields_list['CLICKLINE_LAST_NAME_2']) ? $this->fields_list['CLICKLINE_LAST_NAME_2'] : ''),\n\t\t\t'street' => (isset($this->fields_list['CLICKLINE_STREET']) ? $this->fields_list['CLICKLINE_STREET'] : ''),\n\t\t\t'road_number' => (isset($this->fields_list['CLICKLINE_ROAD_NUMBER']) ? $this->fields_list['CLICKLINE_ROAD_NUMBER'] : ''),\n\t\t\t'portal' => (isset($this->fields_list['CLICKLINE_PORTAL']) ? $this->fields_list['CLICKLINE_PORTAL'] : ''),\n\t\t\t'floor' => (isset($this->fields_list['CLICKLINE_FLOOR']) ? $this->fields_list['CLICKLINE_FLOOR'] : ''),\n\t\t\t'door' => (isset($this->fields_list['CLICKLINE_DOOR']) ? $this->fields_list['CLICKLINE_DOOR'] : ''),\n\t\t\t'postcode' => (isset($this->fields_list['CLICKLINE_POSTCODE']) ? $this->fields_list['CLICKLINE_POSTCODE'] : ''),\n\t\t\t'city' => (isset($this->fields_list['CLICKLINE_CITY']) ? $this->fields_list['CLICKLINE_CITY'] : ''),\n\t\t\t'country' => (isset($this->fields_list['CLICKLINE_COUNTRY']) ? $this->fields_list['CLICKLINE_COUNTRY'] : 0),\n\t\t\t'telephone' => (isset($this->fields_list['CLICKLINE_TELEPHONE']) ? $this->fields_list['CLICKLINE_TELEPHONE'] : ''),\n\t\t\t'fax' => (isset($this->fields_list['CLICKLINE_FAX']) ? $this->fields_list['CLICKLINE_FAX'] : ''),\n\t\t\t'email' => (isset($this->fields_list['CLICKLINE_EMAIL']) ? $this->fields_list['CLICKLINE_EMAIL'] : ''),\n\t\t);\n//Prepare the carriers list\n\t\t$carrier_list = array();\n\t\t$carrier_list[] = array('carrier_id' => 0, 'carrier' => $this->l('None'));\n\t\tif (isset($this->fields_list['CLICKLINE_ACCOUNT']))\n\t\t{\n// Get carrier list from WS\n// Create ClickLine_api Object\n\t\t\t$clickline = new ClickLineApi();\n\n// Open connection and call WS\n\t\t\t$carrier_list_to_add = $clickline->getCarriersList();\n\t\t\t$carrier_list = array_merge($carrier_list, $carrier_list_to_add);\n\t\t}\n\n// Get countries\n\t\t$country_list = array();\n\t\t$country_list[] = array('id_country' => '0', 'name' => $this->l('Choose your country'));\n\t\t$country_list = array_merge($country_list, Country::getCountries($this->_lang));\n\n\n//Lets go, gen the form\n//<editor-fold defaultstate=\"collapsed\" desc=\"Form's template\">\n\n\t\t$fields_form = array();\n\t\t$fields_form[] = array('form' => array(\n\t\t\t\t'legend' => array(\n\t\t\t\t\t'title' => $this->l('ClickLine Module Configuration'),\n\t\t\t\t\t'image' => $this->_path.'logo.gif'\n\t\t\t\t),\n\t\t\t\t'input' => array(\n\t\t\t\t\tarray(\n\t\t\t\t\t\t'type' => 'text',\n\t\t\t\t\t\t'name' => 'clickline_account',\n\t\t\t\t\t\t'required' => true,\n\t\t\t\t\t\t'label' => $this->l('User'),\n\t\t\t\t\t\t'desc' => $this->l('User of Clickline account'),\n\t\t\t\t\t\t'size' => 32\n\t\t\t\t\t),\n\t\t\t\t\tarray(\n\t\t\t\t\t\t'type' => 'password',\n\t\t\t\t\t\t'name' => 'clickline_password',\n\t\t\t\t\t\t'required' => true,\n\t\t\t\t\t\t'label' => $this->l('Password'),\n\t\t\t\t\t\t'desc' => $this->l('Password of Clickline account'),\n\t\t\t\t\t\t'size' => 32\n\t\t\t\t\t),\n\t\t\t\t\tarray(\n\t\t\t\t\t\t'type' => 'text',\n\t\t\t\t\t\t'name' => 'clickline_cp_from',\n\t\t\t\t\t\t'required' => true,\n\t\t\t\t\t\t'label' => $this->l('CP From'),\n\t\t\t\t\t\t'desc' => $this->l('ZIP code where the order is sent'),\n\t\t\t\t\t\t'size' => 32\n\t\t\t\t\t),\n\t\t\t\t\tarray(\n\t\t\t\t\t\t'type' => 'text',\n\t\t\t\t\t\t'name' => 'clickline_country_from',\n\t\t\t\t\t\t'required' => true,\n\t\t\t\t\t\t'label' => $this->l('Country From'),\n\t\t\t\t\t\t'desc' => $this->l('Country code where the order is sent, for example: ES for Spain'),\n\t\t\t\t\t\t'size' => 32\n\t\t\t\t\t),\n\t\t\t\t\tarray(\n\t\t\t\t\t\t'type' => 'select',\n\t\t\t\t\t\t'name' => 'clickline_carrier_def',\n\t\t\t\t\t\t'required' => true,\n\t\t\t\t\t\t'label' => $this->l('Default carrier'),\n\t\t\t\t\t\t'desc' => $this->l('Carrier that will be selected by default at Front Office'),\n\t\t\t\t\t\t'options' => array(\n\t\t\t\t\t\t\t'query' => $carrier_list,\n\t\t\t\t\t\t\t'id' => 'carrier_id',\n\t\t\t\t\t\t\t'name' => 'carrier'\n\t\t\t\t\t\t)\n\t\t\t\t\t),\n\t\t\t\t\tarray(\n\t\t\t\t\t\t'type' => 'radio',\n\t\t\t\t\t\t'name' => 'apply_discount',\n\t\t\t\t\t\t'required' => true,\n\t\t\t\t\t\t'class' => 't',\n\t\t\t\t\t\t'is_bool' => true,\n\t\t\t\t\t\t'label' => $this->l('Send measures'),\n\t\t\t\t\t\t'desc' => $this->l('Send measures from the Front Office of the store (in the product must indicate their size and weight)'),\n\t\t\t\t\t\t'values' => array(\n\t\t\t\t\t\t\tarray(\n\t\t\t\t\t\t\t\t'id' => 'active_on',\n\t\t\t\t\t\t\t\t'value' => 1,\n\t\t\t\t\t\t\t\t'label' => $this->l('Enabled')\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tarray(\n\t\t\t\t\t\t\t\t'id' => 'active_off',\n\t\t\t\t\t\t\t\t'value' => 0,\n\t\t\t\t\t\t\t\t'label' => $this->l('Disabled')\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t)\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t\t,\n\t\t\t\t'submit' => array(\n\t\t\t\t\t'name' => 'submitSave',\n\t\t\t\t\t'title' => $this->l('Save'),\n\t\t\t\t\t'class' => 'button'\n\t\t\t\t)\n\t\t));\n\n\t\t$fields_form[] = array('form' => array(\n\t\t\t\t'legend' => array(\n\t\t\t\t\t'title' => $this->l('Shop Information'),\n\t\t\t\t\t'image' => $this->_path.'logo.gif'\n\t\t\t\t),\n\t\t\t\t'input' => array(\n\t\t\t\t\tarray(\n\t\t\t\t\t\t'type' => 'text',\n\t\t\t\t\t\t'name' => 'shop_name',\n\t\t\t\t\t\t'label' => $this->l('Shop name'),\n\t\t\t\t\t\t'size' => 45\n\t\t\t\t\t),\n\t\t\t\t\tarray(\n\t\t\t\t\t\t'type' => 'text',\n\t\t\t\t\t\t'name' => 'first_name',\n\t\t\t\t\t\t'label' => $this->l('First Name'),\n\t\t\t\t\t\t'size' => 45\n\t\t\t\t\t),\n\t\t\t\t\tarray(\n\t\t\t\t\t\t'type' => 'text',\n\t\t\t\t\t\t'name' => 'last_name',\n\t\t\t\t\t\t'label' => $this->l('Last Name'),\n\t\t\t\t\t\t'size' => 45\n\t\t\t\t\t),\n\t\t\t\t\tarray(\n\t\t\t\t\t\t'type' => 'text',\n\t\t\t\t\t\t'name' => 'last_name_2',\n\t\t\t\t\t\t'label' => $this->l('Last Name 2'),\n\t\t\t\t\t\t'size' => 45\n\t\t\t\t\t),\n\t\t\t\t\tarray(\n\t\t\t\t\t\t'type' => 'text',\n\t\t\t\t\t\t'name' => 'street',\n\t\t\t\t\t\t'label' => $this->l('Street'),\n\t\t\t\t\t\t'size' => 45\n\t\t\t\t\t),\n\t\t\t\t\tarray(\n\t\t\t\t\t\t'type' => 'text',\n\t\t\t\t\t\t'name' => 'road_number',\n\t\t\t\t\t\t'label' => $this->l('Road number'),\n\t\t\t\t\t\t'size' => 45\n\t\t\t\t\t),\n\t\t\t\t\tarray(\n\t\t\t\t\t\t'type' => 'text',\n\t\t\t\t\t\t'name' => 'portal',\n\t\t\t\t\t\t'label' => $this->l('Portal'),\n\t\t\t\t\t\t'size' => 45\n\t\t\t\t\t),\n\t\t\t\t\tarray(\n\t\t\t\t\t\t'type' => 'text',\n\t\t\t\t\t\t'name' => 'floor',\n\t\t\t\t\t\t'label' => $this->l('Floor'),\n\t\t\t\t\t\t'size' => 45\n\t\t\t\t\t),\n\t\t\t\t\tarray(\n\t\t\t\t\t\t'type' => 'text',\n\t\t\t\t\t\t'name' => 'door',\n\t\t\t\t\t\t'label' => $this->l('Door'),\n\t\t\t\t\t\t'size' => 45\n\t\t\t\t\t),\n\t\t\t\t\tarray(\n\t\t\t\t\t\t'type' => 'text',\n\t\t\t\t\t\t'name' => 'postcode',\n\t\t\t\t\t\t'label' => $this->l('Postcode'),\n\t\t\t\t\t\t'size' => 45\n\t\t\t\t\t),\n\t\t\t\t\tarray(\n\t\t\t\t\t\t'type' => 'text',\n\t\t\t\t\t\t'name' => 'city',\n\t\t\t\t\t\t'label' => $this->l('City'),\n\t\t\t\t\t\t'size' => 45\n\t\t\t\t\t),\n\t\t\t\t\tarray(\n\t\t\t\t\t\t'type' => 'select',\n\t\t\t\t\t\t'name' => 'country',\n\t\t\t\t\t\t'label' => $this->l('Country'),\n\t\t\t\t\t\t'options' => array(\n\t\t\t\t\t\t\t'query' => $country_list,\n\t\t\t\t\t\t\t'id' => 'id_country',\n\t\t\t\t\t\t\t'name' => 'name'\n\t\t\t\t\t\t)\n\t\t\t\t\t),\n\t\t\t\t\tarray(\n\t\t\t\t\t\t'type' => 'text',\n\t\t\t\t\t\t'name' => 'telephone',\n\t\t\t\t\t\t'label' => $this->l('Telephone'),\n\t\t\t\t\t\t'size' => 45\n\t\t\t\t\t),\n\t\t\t\t\tarray(\n\t\t\t\t\t\t'type' => 'text',\n\t\t\t\t\t\t'name' => 'fax',\n\t\t\t\t\t\t'label' => $this->l('Fax'),\n\t\t\t\t\t\t'size' => 45\n\t\t\t\t\t),\n\t\t\t\t\tarray(\n\t\t\t\t\t\t'type' => 'text',\n\t\t\t\t\t\t'name' => 'email',\n\t\t\t\t\t\t'label' => $this->l('Email'),\n\t\t\t\t\t\t'size' => 45\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t\t,\n\t\t\t\t'submit' => array(\n\t\t\t\t\t'name' => 'submitSave',\n\t\t\t\t\t'title' => $this->l('Save'),\n\t\t\t\t\t'class' => 'button'\n\t\t\t\t)\n\t\t));\n//</editor-fold>\n\n\t\t$helper = new HelperForm();\n\t\t$helper->module = $this;\n\t\t$helper->token = Tools::getAdminTokenLite('AdminModules'); //Security Token\n\t\t$helper->currentIndex = AdminController::$currentIndex.'&configure='.$this->name; //Current url\n\t\t$helper->fields_value = $config_values;\n\t\t$helper->show_toolbar = false; //Hide the toolbar\n\t\t$helper->default_form_language = (int) Configuration::get('PS_LANG_DEFAULT'); //And set the default language\n\t\t$options = $helper->generateForm($fields_form);\n\n\t\treturn $options;\n\t}",
"public function output_setup_form() {\n\t\t$related_api = Thrive_Dash_List_Manager::connection_instance( 'mandrill' );\n\t\tif ( $related_api->is_connected() ) {\n\t\t\t$credentials = $related_api->get_credentials();\n\t\t\t$this->set_param( 'email', $credentials['email'] );\n\t\t\t$this->set_param( 'mandrill-key', $credentials['key'] );\n\t\t}\n\n\t\t$this->output_controls_html( 'mailchimp' );\n\t}",
"protected function getConfigForm()\n {\n // toDo: Add config to choose items showed by viewedItems\n return array(\n 'form' => array(\n 'legend' => array(\n 'title' => $this->l('Settings'),\n 'icon' => 'icon-cogs',\n ),\n 'input' => array(\n array(\n 'type' => 'switch',\n 'label' => $this->l('Live mode'),\n 'name' => 'CAPTURELEADSXAVIER_LIVE_MODE',\n 'is_bool' => true,\n 'desc' => $this->l('Use this module in live mode'),\n 'values' => array(\n array(\n 'id' => 'active_on',\n 'value' => true,\n 'label' => $this->l('Enabled')\n ),\n array(\n 'id' => 'active_off',\n 'value' => false,\n 'label' => $this->l('Disabled')\n )\n ),\n ),\n array(\n 'col' => 3,\n 'type' => 'text',\n 'prefix' => '<i class=\"icon icon-envelope\"></i>',\n 'desc' => $this->l('Enter a valid email address'),\n 'name' => 'CAPTURELEADSXAVIER_ACCOUNT_EMAIL',\n 'label' => $this->l('Email'),\n ),\n array(\n 'type' => 'password',\n 'name' => 'CAPTURELEADSXAVIER_ACCOUNT_PASSWORD',\n 'label' => $this->l('Password'),\n ),\n array(\n 'type' => 'radio',\n 'label' => $this->l('Column selector'),\n 'name' => 'CAPTURELEADSXAVIER_COL_SEL',\n 'required' => true,\n 'is_bool' => true,\n 'desc' => $this->l('Select on what column you want the module'),\n 'values' => array(\n array(\n 'id' => 'col_left',\n 'value' => \"left\",\n 'label' => $this->l('Left')\n ),\n array(\n 'id' => 'col_right',\n 'value' => \"right\",\n 'label' => $this->l('Right')\n )\n\n ),\n ),\n \n ),\n 'submit' => array(\n 'title' => $this->l('Save'),\n )\n )\n );\n }",
"function initControlStructureForm()\n\t{\n\t\tinclude_once (\"Services/Form/classes/class.ilPropertyFormGUI.php\");\n $form = new ilPropertyFormGUI();\n\n\t\t$form->setId(\"control_structure\");\n\t\t$form->setTitle($this->lng->txt(\"ctrl_structure\"));\n\t\t$form->setFormAction(\"setup.php?cmd=gateway\");\n\n\t\t$ilDB = $this->setup->getClient()->db;\n\t\t$cset = $ilDB->query(\"SELECT count(*) as cnt FROM ctrl_calls\");\n\t\t$crec = $ilDB->fetchAssoc($cset);\n\n\t\t$item = new ilCustomInputGUI($this->lng->txt(\"ctrl_structure_reload\"));\n\t\tif ($crec[\"cnt\"] == 0)\n\t\t{\n\t\t\t$item->setInfo($this->lng->txt(\"ctrl_missing_desc\"));\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$item->setInfo($this->lng->txt(\"ctrl_structure_desc\"));\n\t\t}\n\t\t$form->addItem($item);\n\n\t\t$form->addCommandButton(\"reloadStructure\", $this->lng->txt(\"reload\"));\n\t\treturn $form;\n\t}",
"public function __construct() {\n\n\t\t\t$this->parent_menu_page_url = 'admin.php?page=learndash_lms_settings';\n\t\t\t$this->menu_page_capability = LEARNDASH_ADMIN_CAPABILITY_CHECK;\n\t\t\t$this->settings_page_id = 'learndash_lms_payments';\n\n\t\t\t// translators: Course Shortcodes Label.\n\t\t\t$this->settings_page_title = esc_html_x( 'Payments', 'Payments Tab Label', 'learndash' );\n\n\t\t\t$this->show_quick_links_meta = false;\n\n\t\t\t$this->settings_tab_priority = 20;\n\t\t\tparent::__construct();\n\t\t}",
"protected function __construct() {\n\t\t\t$this->settings_page_id = 'learndash_lms_payments';\n\n\t\t\t// This is the 'option_name' key used in the wp_options table.\n\t\t\t$this->setting_option_key = 'learndash_settings_payments_list';\n\n\t\t\t// This is the HTML form field prefix used.\n\t\t\t$this->setting_field_prefix = 'learndash_settings_payments_list';\n\n\t\t\t// Used within the Settings API to uniquely identify this section.\n\t\t\t$this->settings_section_key = 'settings_payments_list';\n\n\t\t\t// Section label/header.\n\t\t\t$this->settings_section_label = esc_html__( 'Payments', 'learndash' );\n\n\t\t\tadd_action( 'learndash_settings_page_init', array( $this, 'learndash_settings_page_init' ), 10, 1 );\n\n\t\t\tparent::__construct();\n\t\t}",
"protected function addCarrierFieldConfig()\n {\n // Carrier id form field (hidden for existing method or select for the new method)\n $method = $this->getMethod();\n if ($method->getData('entity_id')) {\n $carrierFieldConfig = [\n 'label' => __('Carrier'),\n 'componentType' => Field::NAME,\n 'formElement' => Hidden::NAME,\n 'dataScope' => static::FIELD_CARRIER_ID_NAME,\n 'dataType' => Number::NAME,\n 'sortOrder' => 0,\n ];\n } elseif ($this->request->getParam('carrier_id')) {\n $carrierFieldConfig = [\n 'label' => __('Carrier'),\n 'componentType' => Field::NAME,\n 'formElement' => Hidden::NAME,\n 'dataScope' => static::FIELD_CARRIER_ID_NAME,\n 'dataType' => Number::NAME,\n 'sortOrder' => 0,\n 'value' => $this->request->getParam('carrier_id')\n ];\n } else {\n $carrierFieldConfig = [\n 'label' => __('Carrier'),\n 'componentType' => Field::NAME,\n 'formElement' => Select::NAME,\n 'dataScope' => static::FIELD_CARRIER_ID_NAME,\n 'dataType' => Text::NAME,\n 'sortOrder' => 0,\n 'options' => $this->getCarriers(),\n 'disableLabel' => true,\n 'multiple' => false,\n 'validation' => [\n 'required-entry' => true,\n ],\n ];\n }\n\n $result[static::GENERAL_FIELDSET_NAME]['children'][static::FIELD_CARRIER_ID_NAME] = [\n 'arguments' => [\n 'data' => [\n 'config' => $carrierFieldConfig\n ],\n ],\n ];\n\n // The \"back_to\" hidden input, if need to redirect admin back to the carrier edit form\n if ($this->request->getParam(MethodController::BACK_TO_PARAM)) {\n $result[static::GENERAL_FIELDSET_NAME]['children'][MethodController::BACK_TO_PARAM] = [\n 'arguments' => [\n 'data' => [\n 'config' => [\n 'label' => '',\n 'componentType' => Field::NAME,\n 'formElement' => Hidden::NAME,\n 'dataScope' => MethodController::BACK_TO_PARAM,\n 'dataType' => Number::NAME,\n 'sortOrder' => 0,\n 'value' => $this->request->getParam(MethodController::BACK_TO_PARAM)\n ]\n ],\n ],\n ];\n }\n\n $this->meta = array_replace_recursive(\n $this->meta,\n $result\n );\n }",
"protected function _construct()\n {\n $this->setTemplate('zirconprocessing/widget/catalogrequest.phtml');\n }",
"function room_reservations_admin_settings_mobile($form, &$form_state) {\n $default_mobile_url = _room_reservations_get_variable('mobile_url');\n $default_main_database = _room_reservations_get_variable('main_database');\n $form['mobile_url'] = array(\n '#title' => t('Mobile site url'),\n '#type' => 'textfield',\n '#description' => t('Display the mobile version of Room Reservations for this url.'),\n '#default_value' => $default_mobile_url,\n '#maxlength' => 80,\n '#size' => 80,\n '#weight' => -90,\n );\n $form['main_database'] = array(\n '#title' => t('Main site database name'),\n '#type' => 'textfield',\n '#description' => t('Enter the name of the database used by your main (non-mobile) website.'),\n '#default_value' => $default_main_database,\n '#maxlength' => 80,\n '#size' => 80,\n '#weight' => -80,\n );\n $form['save'] = array(\n '#type' => 'submit',\n '#value' => t('Save configuration'),\n '#weight' => 100,\n );\n $form['reset'] = array(\n '#type' => 'submit',\n '#value' => t('Reset to defaults'),\n '#weight' => 101,\n );\n\n return $form;\n}",
"public function __construct() {\n\n\t\t// method ID / title\n\t\t$this->id = 'shipwire';\n\t\t$this->method_title = __( 'Shipwire', 'woocommerce-shipwire' );\n\n\t\t// save settings hook\n\t\tif ( is_admin() ) {\n\t\t\tadd_action( 'woocommerce_update_options_shipping_' . $this->id, array( $this, 'process_admin_options' ) );\n\t\t}\n\n\t\t$this->admin_page_heading = __( 'Shipwire', 'woocommerce-shipwire' );\n\t\t$this->admin_page_description = __( 'Provide real-time shipping rates from Shipwire to your customers.', 'woocommerce-shipwire' );\n\n\t\t// Load form fields\n\t\t$this->init_form_fields();\n\n\t\t// Load settings\n\t\t$this->init_settings();\n\n\t\t// Define user-set variables\n\t\tforeach ( $this->settings as $setting_key => $setting_value ) {\n\t\t\t$this->$setting_key = $setting_value;\n\t\t}\n\t}",
"protected function getConfigForm()\n {\n return array(\n 'form' => array(\n 'legend' => array(\n 'title' => $this->l('Settings'),\n 'icon' => 'icon-cogs',\n ),\n 'input' => array(\n array(\n 'type' => 'b2binpay-warning',\n 'name' => 'B2BINPAY_WARNING',\n ),\n array(\n 'col' => 2,\n 'type' => 'text',\n 'name' => 'B2BINPAY_TITLE',\n 'label' => $this->l('Title'),\n 'desc' => $this->l('The payment method title which a customer sees at the checkout'),\n 'required' => true,\n ),\n array(\n 'type' => 'switch',\n 'label' => $this->l('Test Mode (Sandbox)'),\n 'name' => 'B2BINPAY_TEST_MODE',\n 'is_bool' => true,\n 'desc' => $this->l(\n 'Use this module in test mode. Warning: Sandbox and main gateway has their own credentials!'\n ),\n 'required' => true,\n 'values' => array(\n array(\n 'id' => 'active_on',\n 'value' => true,\n 'label' => $this->l('Enabled'),\n ),\n array(\n 'id' => 'active_off',\n 'value' => false,\n 'label' => $this->l('Disabled'),\n ),\n ),\n ),\n array(\n 'col' => 2,\n 'type' => 'text',\n 'name' => 'B2BINPAY_AUTH_KEY',\n 'label' => $this->l('Auth Key'),\n 'desc' => $this->l('B2BinPay API Auth Key'),\n 'required' => true,\n ),\n array(\n 'col' => 2,\n 'type' => 'text',\n 'name' => 'B2BINPAY_AUTH_SECRET',\n 'label' => $this->l('Auth Secret'),\n 'desc' => $this->l('B2BinPay API Auth Secret'),\n 'required' => true,\n ),\n array(\n 'type' => 'b2binpay-wallets',\n 'name' => 'B2BINPAY_WALLETS',\n 'label' => $this->l('Wallets'),\n 'required' => true,\n ),\n array(\n 'col' => 2,\n 'type' => 'text',\n 'name' => 'B2BINPAY_MARKUP',\n 'label' => $this->l('Markup (%)'),\n 'desc' => $this->l('Markup percentage for each payment'),\n ),\n array(\n 'col' => 2,\n 'type' => 'text',\n 'name' => 'B2BINPAY_LIFETIME',\n 'label' => $this->l('Order lifetime (seconds)'),\n 'desc' => $this->l('Lifetime for your orders in seconds'),\n 'required' => true,\n ),\n ),\n 'submit' => array(\n 'title' => $this->l('Save'),\n ),\n ),\n );\n }",
"protected function getConfigForm()\n {\n return array(\n 'form' => array(\n 'legend' => array(\n 'title' => $this->l('Settings'),\n 'icon' => 'icon-cogs',\n ),\n 'input' => array(\n array(\n 'col' => 2,\n 'type' => 'text',\n 'suffix' => '<i class=\"icon icon-euro\"></i>',\n 'required' => true,\n 'label' => $this->l('Customer must spent'),\n 'desc' => $this->l('Enter the amount which your customers have to sepent to receibe the coupon.'),\n 'name' => 'WI_SPENT_AMOUNT',\n ),\n array(\n 'col' => 2,\n 'type' => 'text',\n 'suffix' => '<i class=\"icon icon-euro\"></i>',\n 'required' => true,\n 'label' => $this->l('Amount of the coupon'),\n 'desc' => $this->l('Enter the amount of the coupon for gift to your customers.'),\n 'name' => 'WI_SPENT_COUPON',\n ),\n array(\n 'col' => 1,\n 'type' => 'text',\n 'required' => true,\n 'label' => $this->l('Coupon validity in days'),\n 'desc' => $this->l('Enter the number of days while the coupon will be valid.'),\n 'name' => 'WI_SPENT_DAYS',\n ),\n array(\n 'col' => 6,\n 'type' => 'switch',\n 'label' => $this->l('Enabled'),\n 'name' => 'WI_SPENT_ENABLED',\n 'desc' => $this->l('Enable or disable this feature.'),\n 'values' => array(\n array('value' => 1, 'name' => $this->l('Yes')),\n array('value' => 0, 'name' => $this->l('No')),\n ),\n ),\n ),\n 'submit' => array(\n 'title' => $this->l('Save'),\n ),\n ),\n );\n }",
"function mci_twilio_admin_form($form, &$form_state) {\n $form['mci_twilio_account'] = array(\n '#type' => 'textfield',\n '#required' => TRUE,\n '#title' => t('Twilio Account SID'),\n '#default_value' => variable_get('mci_twilio_account'),\n '#description' => t('Enter your Twilio account id'),\n );\n $form['mci_twilio_token'] = array(\n '#type' => 'textfield',\n '#required' => TRUE,\n '#title' => t('Twilio Auth Token'),\n '#default_value' => variable_get('mci_twilio_token'),\n '#description' => t('Enter your Twilio token id'),\n );\n $form['mci_twilio_number'] = array(\n '#type' => 'textfield',\n '#required' => TRUE,\n '#title' => t('Twilio Phone Number'),\n '#default_value' => variable_get('mci_twilio_number'),\n '#description' => t('Enter your Twilio phone number'),\n );\n\n $form['mci_twilio_country_codes_container'] = array(\n '#type' => 'fieldset',\n '#title' => t('Country codes'),\n '#description' => t('Select the country codes you would like available, If none are selected all will be available.'),\n '#collapsible' => TRUE,\n '#collapsed' => TRUE,\n );\n\n $form['mci_twilio_country_codes_container']['twilio_country_codes'] = array(\n '#type' => 'checkboxes',\n '#options' => mci_twilio_country_codes(TRUE),\n '#default_value' => variable_get('mci_twilio_country_codes', array()),\n );\n\n return system_settings_form($form);\n}"
] |
[
"0.6116321",
"0.6098958",
"0.60116625",
"0.59232634",
"0.58955693",
"0.58552724",
"0.5807612",
"0.5795922",
"0.57630324",
"0.5746963",
"0.57114846",
"0.56973636",
"0.56901133",
"0.56712365",
"0.56571305",
"0.5644449",
"0.56363523",
"0.56360453",
"0.5629447",
"0.56261307",
"0.5609321",
"0.560764",
"0.5593399",
"0.55915767",
"0.5583155",
"0.55757564",
"0.5557242",
"0.555382",
"0.55538166",
"0.5549877"
] |
0.67714083
|
0
|
Form constructor for the SMS / Add Carrier configuration page.
|
function room_reservations_admin_settings_sms_add($form, &$form_state) {
$form['carrier'] = array(
'#title' => t('Wireless carrier'),
'#type' => 'textfield',
'#maxlength' => 50,
'#size' => 50,
'#description' => t('The name of the wireless carrier, such as !att or
!verizon.', array(
'!att' => 'AT&T',
'!verizon' => 'Verizon',
)),
'#weight' => -20,
);
$form['domain'] = array(
'#title' => t('Domain name'),
'#type' => 'textfield',
'#maxlength' => 50,
'#size' => 50,
'#description' => t('The domain name of the wireless carrier, such as
!att or !verizon.', array(
'!att' => '@txt.att.net',
'!verizon' => '@vtext.com',
)),
'#weight' => -10,
);
$form['add_carrier']['add'] = array(
'#type' => 'submit',
'#value' => t('Add'),
'#weight' => 100,
);
return $form;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function __construct()\n {\n parent::__construct(array(\n 'name' => __('WS Form', 'ws-form'),\n 'description' => __('Add a form.', 'ws-form'),\n 'category'\t\t=> __('Basic', 'ws-form'),\n 'dir' => FL_WS_FORM_DIR . 'modules/ws-form/',\n 'url' => FL_WS_FORM_URL . 'modules/ws-form/',\n 'editor_export' => true, // Defaults to true and can be omitted.\n 'enabled' => true, // Defaults to true and can be omitted.\n 'icon' => 'icon.svg'\n ));\n }",
"protected function addCarrierFieldConfig()\n {\n // Carrier id form field (hidden for existing method or select for the new method)\n $method = $this->getMethod();\n if ($method->getData('entity_id')) {\n $carrierFieldConfig = [\n 'label' => __('Carrier'),\n 'componentType' => Field::NAME,\n 'formElement' => Hidden::NAME,\n 'dataScope' => static::FIELD_CARRIER_ID_NAME,\n 'dataType' => Number::NAME,\n 'sortOrder' => 0,\n ];\n } elseif ($this->request->getParam('carrier_id')) {\n $carrierFieldConfig = [\n 'label' => __('Carrier'),\n 'componentType' => Field::NAME,\n 'formElement' => Hidden::NAME,\n 'dataScope' => static::FIELD_CARRIER_ID_NAME,\n 'dataType' => Number::NAME,\n 'sortOrder' => 0,\n 'value' => $this->request->getParam('carrier_id')\n ];\n } else {\n $carrierFieldConfig = [\n 'label' => __('Carrier'),\n 'componentType' => Field::NAME,\n 'formElement' => Select::NAME,\n 'dataScope' => static::FIELD_CARRIER_ID_NAME,\n 'dataType' => Text::NAME,\n 'sortOrder' => 0,\n 'options' => $this->getCarriers(),\n 'disableLabel' => true,\n 'multiple' => false,\n 'validation' => [\n 'required-entry' => true,\n ],\n ];\n }\n\n $result[static::GENERAL_FIELDSET_NAME]['children'][static::FIELD_CARRIER_ID_NAME] = [\n 'arguments' => [\n 'data' => [\n 'config' => $carrierFieldConfig\n ],\n ],\n ];\n\n // The \"back_to\" hidden input, if need to redirect admin back to the carrier edit form\n if ($this->request->getParam(MethodController::BACK_TO_PARAM)) {\n $result[static::GENERAL_FIELDSET_NAME]['children'][MethodController::BACK_TO_PARAM] = [\n 'arguments' => [\n 'data' => [\n 'config' => [\n 'label' => '',\n 'componentType' => Field::NAME,\n 'formElement' => Hidden::NAME,\n 'dataScope' => MethodController::BACK_TO_PARAM,\n 'dataType' => Number::NAME,\n 'sortOrder' => 0,\n 'value' => $this->request->getParam(MethodController::BACK_TO_PARAM)\n ]\n ],\n ],\n ];\n }\n\n $this->meta = array_replace_recursive(\n $this->meta,\n $result\n );\n }",
"public function init()\n {\n $this->add(array(\n 'name' => 'name',\n 'options' => array(\n 'label' => __('Name*'),\n ),\n 'attributes' => array(\n 'type' => 'text',\n ),\n ));\n\n $this->add(array(\n 'name' => 'title',\n 'options' => array(\n 'label' => __('Title*'),\n ),\n 'attributes' => array(\n 'type' => 'text',\n ),\n ));\n $this->add(array(\n 'name' => 'company',\n 'options' => array(\n 'label' => __('Company*'),\n ),\n 'attributes' => array(\n 'type' => 'text',\n ),\n ));\n $this->add(array(\n 'name' => 'email',\n 'options' => array(\n 'label' => __('Email*'),\n ),\n 'attributes' => array(\n\n 'type' => 'text',\n ),\n ));\n $this->add(array(\n 'name' => 'phone',\n 'options' => array(\n 'label' => __('Phone*'),\n ),\n 'attributes' => array(\n 'type' => 'text',\n ),\n ));\n $this->add(array(\n 'name' => 'submit',\n 'attributes' => array(\n 'value' => __('Freetrial'),\n ),\n 'type' => 'submit',\n ));\n }",
"public function __construct()\n {\n parent::__construct('ServicioForm');\n $this->setAttribute('method', 'post');\n \n $this->add(array(\n 'name' => 'servicio_nombre',\n 'type' => 'Text',\n 'options' => array(\n 'label' => 'Nombre',\n ),\n ));\n $this->add(array(\n 'name' => 'servicio_descripcion',\n 'type' => 'textarea',\n 'options' => array(\n 'label' => 'Descripcion',\n ),\n ));\n \n $this->add(array(\n 'name' => 'servicio_costo',\n 'type' => 'Text',\n 'options' => array(\n 'label' => 'Costo',\n ),\n ));\n \n $this->add(array(\n 'name' => 'servicio_precio',\n 'type' => 'Text',\n 'options' => array(\n 'label' => 'Precio',\n ),\n ));\n \n $this->add(array(\n 'name' => 'servicio_iva',\n 'type' => 'Text',\n 'options' => array(\n 'label' => 'IVA',\n ),\n ));\n \n\n\n }",
"public function init()\n {\n $this->add([\n 'name' => 'name',\n 'type' => Text::class,\n 'attributes' => [\n 'placeholder' => 'Full Name',\n 'autofocus' => true,\n ],\n 'options' => [\n 'label' => 'Name',\n 'twb-layout' => TwbBundleForm::LAYOUT_HORIZONTAL,\n 'column-size' => 'sm-10',\n 'label_attributes' => [\n 'class' => 'col-sm-2',\n ],\n ],\n ]);\n\n $this->add([\n 'name' => 'email',\n 'type' => Email::class,\n 'attributes' => [\n 'placeholder' => 'Email Address',\n ],\n 'options' => [\n 'label' => 'Email',\n 'twb-layout' => TwbBundleForm::LAYOUT_HORIZONTAL,\n 'column-size' => 'sm-10',\n 'label_attributes' => [\n 'class' => 'col-sm-2',\n ],\n ],\n ]);\n\n $this->add([\n 'name' => 'subject',\n 'type' => Text::class,\n 'options' => [\n 'label' => 'Subject',\n 'twb-layout' => TwbBundleForm::LAYOUT_HORIZONTAL,\n 'column-size' => 'sm-10',\n 'label_attributes' => [\n 'class' => 'col-sm-2',\n ],\n ],\n 'attributes' => [\n 'placeholder' => 'Subject',\n ],\n ]);\n\n $this->add([\n 'name' => 'transport',\n 'type' => Select::class,\n 'options' => [\n 'label' => 'Department',\n 'value_options' => $this->getTransportList(),\n 'twb-layout' => TwbBundleForm::LAYOUT_HORIZONTAL,\n 'column-size' => 'sm-10',\n 'label_attributes' => [\n 'class' => 'col-sm-2',\n ],\n ],\n ]);\n\n $this->add([\n 'name' => 'body',\n 'type' => Textarea::class,\n 'options' => [\n 'label' => 'Message',\n 'twb-layout' => TwbBundleForm::LAYOUT_HORIZONTAL,\n 'column-size' => 'sm-10',\n 'label_attributes' => [\n 'class' => 'col-sm-2',\n ],\n ],\n 'attributes' => [\n 'placeholder' => 'Your message',\n 'rows' => 10,\n ],\n ]);\n\n if (true === $this->getOption('enable_captcha')) {\n $this->add([\n 'name' => 'captcha',\n 'type' => Captcha::class,\n 'attributes' => [\n 'placeholder' => 'Type letters and number here',\n ],\n 'options' => [\n 'label' => 'Please verify you are human',\n 'twb-layout' => TwbBundleForm::LAYOUT_HORIZONTAL,\n 'column-size' => 'sm-10 col-sm-offset-2',\n 'label_attributes' => [\n 'class' => 'col-sm-10 col-sm-offset-2',\n ],\n ],\n ]);\n }\n\n $this->add([\n 'name' => 'csrf',\n 'type' => Csrf::class,\n ]);\n\n $this->add([\n 'name' => 'submit',\n 'type' => Submit::class,\n 'attributes' => [\n 'id' => 'contact-submit-button',\n 'class' => 'btn btn-primary',\n ],\n 'options' => [\n 'label' => 'Send',\n 'twb-layout' => TwbBundleForm::LAYOUT_HORIZONTAL,\n 'column-size' => 'sm-10 col-sm-offset-2',\n ]\n ]);\n }",
"function room_reservations_admin_settings_sms($form, &$form_state) {\n $default_sms_option = _room_reservations_get_variable('sms_option');\n $form['#tree'] = TRUE;\n $form['sms_option'] = array(\n '#title' => t('SMS option'),\n '#type' => 'checkbox',\n '#return_value' => 1,\n '#default_value' => $default_sms_option,\n '#description' => t('Give users the option of receiving confirmation\n messages and reminders as SMS text messages.'),\n '#weight' => -110,\n );\n $form['carriers'] = array(\n '#type' => 'fieldset',\n '#title' => t('Wireless carriers'),\n '#collapsible' => TRUE,\n '#collapsed' => FALSE,\n '#weight' => -100,\n );\n $sql = \"\n SELECT id, value\n FROM {room_reservations_variables}\n WHERE name = '%s'\n ORDER BY value\n \";\n $result = db_query($sql, 'carrier');\n if ($result) {\n $options = array();\n $form['carriers']['list_0'] = array(\n '#value' => '<table><tr><th>' . t('Wireless carrier') . '</th><th>' .\n t('Domain name') . '</th></tr>',\n '#weight' => -99,\n );\n $x = 0;\n while ($data = db_fetch_object($result)) {\n $x++;\n $id = $data->id;\n $values = explode('~', $data->value);\n $options[strval($id)] = $values[0];\n $form['carriers']['list_' . $x] = array(\n '#value' => '<tr><td>' . check_plain($values[0]) . '</td><td>' .\n check_plain($values[1]) . '</td></tr>',\n '#weight' => -99 + $x,\n );\n $x++;\n }\n $form['carriers']['list_' . $x] = array(\n '#value' => '</table>',\n '#weight' => -99 + $x,\n );\n }\n $form['save'] = array(\n '#type' => 'submit',\n '#value' => t('Save configuration'),\n '#weight' => 100,\n );\n $form['reset'] = array(\n '#type' => 'submit',\n '#value' => t('Reset to defaults'),\n '#weight' => 101,\n );\n return $form;\n}",
"protected function initializeForm()\n {\n $this->form = new Form();\n $this->form->add(Element::create(\"FieldSet\",\"Report Format\")->add\n (\n Element::create(\"SelectionList\", \"File Format\", \"report_format\")\n ->addOption(\"Hypertext Markup Language (HTML)\",\"html\")\n ->addOption(\"Portable Document Format (PDF)\",\"pdf\")\n ->addOption(\"Microsoft Excel (XLS)\",\"xls\")\n ->addOption(\"Microsoft Word (DOC)\",\"doc\")\n ->setRequired(true)\n ->setValue(\"pdf\"),\n Element::create(\"SelectionList\", \"Page Orientation\", \"page_orientation\")\n ->addOption(\"Landscape\", \"L\")\n ->addOption(\"Portrait\", \"P\")\n ->setValue(\"L\"),\n Element::create(\"SelectionList\", \"Paper Size\", \"paper_size\")\n ->addOption(\"A4\", \"A4\")\n ->addOption(\"A3\", \"A3\")\n ->setValue(\"A4\")\n )->setId(\"report_formats\")->addAttribute(\"style\",\"width:50%\")\n );\n $this->form->setSubmitValue(\"Generate\");\n $this->form->addAttribute(\"action\",Application::getLink($this->path.\"/generate\"));\n $this->form->addAttribute(\"target\",\"blank\");\n }",
"public function init()\n {\n $this->setMethod('post');\n $this->addElement('text', 'model', array('label' => 'Model'));\n $this->addElement('text', 'unique', array('label' => 'Numer zamówienia'));\n $this->addElement('text', 'ebay_id', array('label' => 'Numer ebay'));\n $this->addElement('text', 'invoice_id', array('label' => 'Numer faktury vat'));\n $this->addElement('text', 'color', array('label' => 'Kolor'));\n $this->addElement('text', 'frame', array('label' => 'Stelaż'));\n $this->addElement('radio', 'is_seat', array('label' => 'Fotelik', 'multiOptions' => array('0' => 'Nie', '1' => 'Tak')));\n $this->addElement('select', 'status', array('label' => 'Status zamówienia', 'multiOptions' => array(\n 'paid' => 'Opłacone',\n 'unpaid' => 'Niepłacone',\n 'sent' => 'Wysłane',\n 'other' => 'Oczekuje'\n )));\n $this->addElement('text', 'wheels', array('label' => 'Koła'));\n $this->addElement('textarea', 'bonus', array('label' => 'Dodatki', 'cols' => 50, 'rows' => 3));\n $this->addElement('textarea', 'client', array('label' => 'Klient', 'cols' => 50, 'rows' => 3));\n $this->addElement('text', 'date_of_payment', array('label' => 'Data opłacenia', 'value' => null));\n $this->addElement('text', 'date_of_receipt', array('label' => 'Data odbioru', 'value' => null));\n $this->addElement('submit', 'submit', array('label' => 'Zapisz'));\n }",
"protected function _construct()\r\n {\r\n parent::_construct();\r\n $this->setTemplate('placetopay/form.phtml');\r\n }",
"public function __construct()\n {\n $this->name = 'payneteasy';\n $this->tab = 'payments_gateways';\n $this->version = '1.0.0';\n $this->author = 'Artem Ponomarenko';\n $this->currencies_mode = 'radio';\n $this->submit_action = 'submit_' . $this->name;\n\n parent::__construct();\n\n $this->displayName = $this->l('PaynetEasy payment form');\n $this->description = $this->l('Accepts payments by credit cards with PaynetEasy payment form.');\n $this->confirmUninstall = $this->l('Are you sure you want to uninstall?');\n }",
"protected function _construct()\n {\n $this->_init(\\AddictedToMagento\\DynamicForms\\Model\\ResourceModel\\Form::class);\n }",
"public function addform()\n\t{\n\t\t\t$this->setMethod('post');\n\n\t\t\t\n\t\t\t$this->addElement('radio', 'status', array(\n\t\t\t\t'required' => true,\n\t\t\t\t'multiOptions' => array(\n\t\t\t\t\t'1' => IN_PROGRESS,\n\t\t\t\t\t'2' => 'Closed'\n\t\t\t\t\t\n\t\t\t\t),\n\t\t\t\t'value' => '1' //key of multiOption\n\t\t\t));\n\t\t\n\t\t\n\n\t\t\t$this->addElement('textarea', 'Comment', array( \n\t\t\t\t\t'required' => true,\n\t\t\t\t\t'maxlength' =>'50',\n\t\t\t\t\t\n\t\t\t\t\t'class' => 'validate[required] text-input',\n\t\t\t\t\t'decorators'=>Array(\n\t\t\t\t\t\t'ViewHelper','Errors'\n\t\t\t\t\t),\t\t \n\t\t\t));\n\n\t\t\t\n\n\t\t\t\n\n\n\t\n\t\t\t\t\n\t\t\t$this->addElement('submit', 'submit', array(\n\t\t\t\t\t'ignore' => true,\n\t\t\t\t\t'label' => 'Submit',\n\t\t\t));\n\t\t\t\n\t\t\t// And finally add some CSRF protection\n\t\t\t$this->addElement('hash', 'csrf', array(\n\t\t\t\t\t'ignore' => true,\n\t\t\t));\t\n\t}",
"public function init()\n {\n parent::init();\n \n $this->addCssFile(\"/css/library/Account/Form/activate-accounts.css\");\n $this->addJsFile(\"/js/library/Account/Form/activate-accounts.js\");\n \n //add js file to do cool input masking\n $this->addJsFile(\"/js/jquery.maskedinput-1.3.js\");\n \n $this->setDecorators(self::$_formDecorators);\n \n foreach ($this->order->order_configurations as $config) {\n $subform = new \\Account_Form_ActivateAccountsSubForm($config->id);\n $this->addSubForm($subform, \"orderConfiguration_\" . $config->id);\n }\n \n $emailEveryone = new Zend_Form_Element_Checkbox(\"emailEveryone\");\n $emailEveryone->setLabel(\"Send email to account holders with their login information.\")\n ->setDecorators(self::$checkboxDecorators)\n ->setValue(1);\n $this->addElement($emailEveryone);\n \n $orderId = new Zend_Form_Element_Hidden(\"orderId\");\n $orderId->setDecorators(array('ViewHelper'));\n $this->addElement($orderId);\n\n $saveButton = new Fisdap_Form_Element_SaveButton(\"saveButton\");\n $saveButton->setLabel(\"Save\")\n ->setDecorators(self::$buttonDecorators);\n $this->addElement($saveButton);\n \n if ($this->order->id) {\n $this->setDefaults(array(\n 'orderId' => $this->order->id,\n ));\n }\n }",
"public function init_form_fields(){\n \n\t\t$this->form_fields = array(\n\t\t\t'enabled' => array(\n\t\t\t\t'title' => 'Enable/Disable',\n\t\t\t\t'label' => 'Enable Vortex Gateway',\n\t\t\t\t'type' => 'checkbox',\n\t\t\t\t'description' => '',\n\t\t\t\t'default' => 'no'\n\t\t\t),\n\t\t\t'title' => array(\n\t\t\t\t'title' => 'Title',\n\t\t\t\t'type' => 'text',\n\t\t\t\t'description' => 'This controls the title which the user sees during checkout.',\n\t\t\t\t'default' => 'Vortex Payment',\n\t\t\t\t'desc_tip' => true,\n\t\t\t),\n\t\t\t'description' => array(\n\t\t\t\t'title' => 'Description',\n\t\t\t\t'type' => 'textarea',\n\t\t\t\t'description' => 'This controls the description which the user sees during checkout.',\n\t\t\t\t'default' => 'Paga con Vortex Payment.',\n\t\t\t),\n\t\t\t'BID' => array(\n\t\t\t\t'title' => 'Business ID',\n\t\t\t\t'type' => 'text'\n\t\t\t)\n\n\t\t\t);\n \n\t \t}",
"public function __construct()\n {\n parent::__construct();\n\n // creates the form\n $this->form = new BootstrapFormBuilder(self::$formName);\n\n // define the form title\n $this->form->setFormTitle('Avaliações');\n\n $inscricao_evento_id = new TDBUniqueSearch('inscricao_evento_id', 'eventtus', 'Evento', 'id', 'id','nome asc' );\n\n $inscricao_evento_id->setSize('100%');\n $inscricao_evento_id->setMinLength(0);\n $inscricao_evento_id->setMask('{nome}');\n\n $row1 = $this->form->addFields([new TLabel('Evento', null, '14px', null),$inscricao_evento_id]);\n $row1->layout = ['col-sm-6'];\n\n // keep the form filled during navigation with session data\n $this->form->setData( TSession::getValue(__CLASS__.'_filter_data') );\n\n $btn_ongenerate = $this->form->addAction('Gerar', new TAction([$this, 'onGenerate']), 'fa:search #ffffff');\n $btn_ongenerate->addStyleClass('btn-primary'); \n\n // vertical box container\n $container = new TVBox;\n $container->style = 'width: 100%';\n $container->add(TBreadCrumb::create(['Cadastros','Avaliações']));\n $container->add($this->form);\n\n parent::add($container);\n\n }",
"public function initConfigurationForm()\n\t{\n\t\tglobal $lng, $ilCtrl;\n\t\t\n\t\t$pl = $this->getPluginObject();\n\t\n\t\tinclude_once(\"Services/Form/classes/class.ilPropertyFormGUI.php\");\n\t\t$form = new ilPropertyFormGUI();\n\t\n\t\t// setting 1 (a checkbox)\n\t\t$cb = new ilCheckboxInputGUI($pl->txt(\"setting_1\"), \"setting_1\");\n\t\t$form->addItem($cb);\n\t\t\n\t\t// setting 2 (text)\n\t\t$ti = new ilTextInputGUI($pl->txt(\"setting_2\"), \"setting_2\");\n\t\t$ti->setRequired(true);\n\t\t$ti->setMaxLength(10);\n\t\t$ti->setSize(10);\n\t\t$form->addItem($ti);\n\t\n\t\t$form->addCommandButton(\"save\", $lng->txt(\"save\"));\n\t \n\t\t$form->setTitle($pl->txt(\"example_plugin_configuration\"));\n\t\t$form->setFormAction($ilCtrl->getFormAction($this));\n\t\t\n\t\treturn $form;\n\t}",
"public function init() {\n $this->setMethod('post');\n\n // Ein Email Element hinzufügen\n $this->addElement('text', 'name', array(\n 'label' => 'Dein Name:',\n 'required' => true,\n 'filters' => array('StringTrim'),\n ));\n $this->addElement('text', 'mail', array(\n 'label' => 'Deine Mail Adresse:',\n 'required' => true,\n 'filters' => array('StringTrim'),\n 'validators' => array(\n array('validator' => 'EmailAddress', null)\n )\n ));\n // Das Kommentar Element hinzufügen\n $this->addElement('textarea', 'message', array(\n 'label' => 'Bitte ein Kommentar:',\n 'required' => true,\n 'validators' => array(\n array('validator' => 'StringLength', 'options' => array(0, 2000))\n )\n ));\n\n $this->addElement('select', 'subject', array(\n 'label' => 'Betreff',\n 'required' => true,\n 'multiOptions' => array(\n 'service' => 'Allgemeine Fragen',\n 'shooting' => 'Shooting',\n 'error' => 'Fehler auf der Seite'\n )\n ));\n \n $this->addElement('text', 'datum', array(\n 'label' => 'Datum:',\n 'required' => false,\n 'filters' => array('StringTrim'),\n ));\n \n // Den Submit Button hinzufügen\n $this->addElement('submit', 'submit', array(\n 'ignore' => true,\n 'label' => 'Absenden',\n ));\n\n /*\n // Und letztendlich etwas CSRF Protektion hinzufügen\n $this->addElement('hash', 'csrf', array(\n 'ignore' => true,\n ));\n */\n }",
"public function init() {\n $this->setMethod('post');\n \n // Add claim Number element\n $this->addElement(\n 'text',\n 'claimNumber',\n array(\n 'required' => true,\n 'validators' => array(\n array(\n 'NotEmpty',\n true,\n array(\n 'messages' => array (\n 'isEmpty' => 'Please enter claim number',\n 'notEmptyInvalid' => 'Please enter valid claim number'\n )\n )\n )\n )\n )\n );\n\n // Add hidden element for claim reference number\n $this->addElement('hidden', 'ref_num', array(\n 'value' => '',\n 'class' => 'noborder',\n 'label' =>''\n ));\n \n // Add hidden element for mode\n $this->addElement('hidden', 'mode', array(\n 'value' => '',\n 'class' => 'noborder',\n 'label' =>''\n )); \n\n // Add search button\n $this->addElement('image', 'search', array(\n 'src' => '/assets/connect/images/claims/search-button.jpg',\n 'align' => 'top',\n 'class' => 'search',\n 'onclick' => 'return validateClaimNumber()'\n ));\n\n \n // Add the back button\n $this->addElement('button', 'back', array(\n 'ignore' => true,\n 'label' => 'Back',\n 'value' => 'Back',\n 'onclick' => 'window.location=\"/rentguaranteeclaims/home\"'\n ));\n \n // Set decorators\n $this->clearDecorators();\n $this->setDecorators(array('Form'));\n $this->setElementDecorators(array ('ViewHelper', 'Errors')); \n }",
"public function init()\n {\n\n $this->setMethod('post');\n\n // Add the name element\n $this->addElement('text','name', array(\n 'label' => 'Sub-Section Name'\n , 'size' => 50\n , 'required' => true\n , 'filters' => array('StringTrim')\n ));\n\n My_Plugin_Form::setDefaultLayout($this->getElement('name'));\n\n // Add the submit button\n $this->addElement('submit', 'submit', array(\n 'ignore' => true,\n 'label' => 'Save Changes',\n 'disableLoadDefaultDecorators' => true,\n ));\n\n $label = $this->getElement('submit');\n $label->addDecorators(array(\n array('ViewHelper'),\n array('HtmlTag')\n ));\n\n // Add a hidden field to handle the application id\n $this->addElement('hidden','application_id');\n\n // Add a hidden field to handle the sub-section id\n $this->addElement('hidden','id');\n\n // And finally, add some CSRF protection\n $this->addElement('hash','csrf', array(\n 'ignore' => 'true',\n ));\n\n }",
"public function __construct() {\n if (isset($_POST[\"addcontact\"])) {\n $this->addNewContact();\n }\n }",
"public function __construct($name = null)\n {\n parent::__construct('serviceform');\n\n $this->add(array(\n 'name' => 'id',\n 'type' => 'Hidden',\n ));\n $this->add(array(\n 'name' => 'name',\n 'type' => 'Text',\n 'attributes' => array(\n 'class' => 'form-control',\n ),\n ));\n\n $this->add(array(\n 'name' => 'composition',\n 'type' => 'Text',\n 'attributes' => array(\n 'class' => 'form-control',\n ),\n ));\n $this->add(array(\n 'name' => 'description',\n 'type' => 'Text',\n\n 'attributes' => array(\n 'class' => 'form-control',\n ),\n ));\n\n $this->add(array(\n 'name' => 'url',\n 'type' => 'Text',\n\n 'attributes' => array(\n 'class' => 'form-control',\n ),\n ));\n\n $this->add(array(\n 'name' => 'input',\n 'type' => 'Text',\n\n 'attributes' => array(\n 'class' => 'form-control',\n ),\n ));\n\n $this->add(array(\n 'name' => 'output',\n 'type' => 'Text',\n\n 'attributes' => array(\n 'class' => 'form-control',\n ),\n ));\n\n $this->add(array(\n 'name' => 'categories',\n 'type' => 'Text',\n\n 'attributes' => array(\n 'class' => 'form-control',\n ),\n ));\n\n $this->add(array(\n 'name' => 'submit',\n 'type' => 'Submit',\n 'attributes' => array(\n 'value' => 'Create',\n 'id' => 'submit',\n 'class' => 'btn btn-success',\n ),\n ));\n $this->setAttribute('class','form-horizontal');\n\n }",
"public function init() {\n $this->setMethod('post');\n\n // Add agent name element\n $this->addElement(\n 'span',\n 'agent_name',\n array(\n 'label' \t=> 'Name of letting agency',\n 'required' \t=> false,\n 'readonly' \t=> true,\n 'filters' \t=> array('StringTrim'),\n 'class' => 'formvalue',\n 'validators' => array(\n array(\n 'NotEmpty',\n true,\n array(\n 'messages' => array (\n 'isEmpty' => 'Please enter letting agent name',\n 'notEmptyInvalid' => 'Please enter letting agent name'\n )\n )\n )\n )\n )\n );\n\n // Add agent scheme number\n $this->addElement(\n 'span',\n 'agent_schemenumber',\n array(\n 'label' \t=> 'Agent scheme number',\n 'required' \t=> false,\n 'readonly' \t=> true,\n 'filters' \t=> array('StringTrim'),\n 'class' => 'formvalue',\n 'validators' => array(\n array(\n 'NotEmpty',\n true,\n array(\n 'messages' => array (\n 'isEmpty' => 'Please enter agent scheme number',\n 'notEmptyInvalid' => 'Please enter agent scheme number'\n )\n )\n )\n )\n )\n );\n\n // Add agent contact name element\n $this->addElement(\n 'text',\n 'agent_contact_name',\n array(\n 'label' => 'Contact name',\n 'required' => true,\n 'filters' => array('StringTrim'),\n 'maxlength' => '100',\n 'validators' => array(\n array(\n 'NotEmpty',\n true,\n array(\n 'messages' => array(\n 'isEmpty' => 'Please enter your contact name',\n 'notEmptyInvalid' => 'Please enter your contact name'\n )\n )\n )\n )\n )\n );\n\n // Add the landlord find address button\n $this->addElement('submit', 'landlords_address_lookup', array(\n 'ignore' => true,\n 'label' => 'Find address',\n 'class' => 'button',\n 'onclick' => 'getPropertiesByPostcode($(\\'#landlord_postcode\\').val(), \\'landlord_postcode\\', \\'landlord_address\\',\\'no_landlord_address_selector\\'); return false;'\n ));\n\n\n // Add agent postcode\n $this->addElement('text', 'agent_postcode', array(\n 'label' => 'Postcode',\n 'required' => true,\n 'filters' => array('StringTrim'),\n 'maxlength' => '10',\n 'validators' => array(\n array(\n 'NotEmpty',\n true,\n array(\n 'messages' => array(\n 'isEmpty' => 'Please enter your office postcode',\n 'notEmptyInvalid' => 'Please enter your office postcode'\n )\n )\n ),\n array(\n 'regex',\n true,\n array(\n 'pattern' => '/^[0-9a-z]{2,}\\ ?[0-9a-z]{2,}$/i',\n 'messages' => 'Postcode must be in postcode format'\n )\n )\n ),\n )\n );\n\n Application_Core_FormUtils::createManualAddressInput(\n $this,\n 'agent_housename',\n 'agent_street',\n 'agent_town',\n 'agent_city',\n false,\n '',\n true\n );\n\n // Add agent phone number element\n $this->addElement('text', 'agent_telephone', array(\n 'label' => 'Telephone number',\n 'required' => true,\n 'class' => 'input-pos-float',\n 'validators' => array(\n \t'TelephoneNumber',\n array(\n 'NotEmpty', true, array(\n 'messages' => array(\n 'isEmpty' => 'Please enter your telephone number'\n )\n )\n )\n )\n ));\n\n // Add agent e-mail element\n $this->addElement('text', 'agent_email', array(\n 'label' => 'Email address',\n 'required' => true,\n 'filters' => array('StringTrim'),\n 'maxlength' => '100',\n 'validators' => array(\n array ('NotEmpty', true, array(\n 'messages' => array(\n 'isEmpty' => 'Please enter your email address'\n )\n ))\n )\n ));\n\n $emailValidator = new Zend_Validate_EmailAddress();\n $emailValidator->setMessages(array(\n Zend_Validate_EmailAddress::INVALID_HOSTNAME => \"Domain name invalid in email address\",\n Zend_Validate_EmailAddress::INVALID_FORMAT => \"Invalid email address\"\n ));\n $this->getElement('agent_email')->addValidator($emailValidator);\n\n // Add agents directly authorised by FCA\n $this->addElement('span', 'agent_dir_by_fca', array(\n 'label' => 'Directly Authorised by the Financial Conduct Authority',\n 'filters' => array('StringTrim'),\n 'class' => 'formvalue'\n ));\n\n $this->addElement('span', 'agent_ar_by_barbon', array(\n 'label' => 'Appointed Representative for Barbon Insurance Group Ltd',\n 'filters' => array('StringTrim'),\n 'class' => 'formvalue'\n ));\n\n // Landlord1\n $subHeaderHtml = '<span style=\"font-size:smaller;\">Please provide title, first name and surname</span>';\n $this->addElement('text', 'landlord1_name', array(\n 'label' => \"Full name<br>$subHeaderHtml\",\n 'required' => true,\n 'filters' => array('StringTrim'),\n 'maxlength' => '80',\n 'validators' => array(\n array ('NotEmpty', true, array(\n 'messages' => array(\n 'isEmpty' => 'Please landlords name'\n )\n ))\n )\n ));\n\n // landlor company Name\n $this->addElement('text', 'landlord_company_name', array(\n 'label' => 'Company name',\n 'required' => false,\n 'filters' => array('StringTrim'),\n 'maxlength' => '100',\n ));\n\n // Add Landlord postcode\n $subHeaderHtml = '<span style=\"font-size:smaller;\">Landlords residential address (This cannot be a C/O address due to the requirements for Legal Proceedings)</span>';\n $this->addElement('text', 'landlord_postcode', array(\n 'label' => \"Landlord Home Address Postcode<br>$subHeaderHtml\",\n 'required' => true,\n 'filters' => array('StringTrim'),\n 'maxlength' => '10',\n 'validators' => array(\n array(\n 'NotEmpty',\n true,\n array(\n 'messages' => array(\n 'isEmpty' => 'Please enter Landlord\\'s postcode',\n 'notEmptyInvalid' => 'Please enter Landlord\\'s postcode'\n )\n )\n ), array(\n 'regex',\n true,\n array(\n 'pattern' => '/^[0-9a-z]{2,}\\ ?[0-9a-z]{2,}$/i',\n 'messages' => 'Postcode must be in postcode format'\n )\n )\n ),\n ));\n\n Application_Core_FormUtils::createManualAddressInput(\n $this,\n 'landlord_housename',\n 'landlord_street',\n 'landlord_town',\n 'landlord_city',\n false\n );\n\n $this->addElement('select', 'landlord_address', array(\n 'required' => false,\n 'label' => '',\n 'filters' => array('StringTrim'),\n 'class' => 'postcode_address',\n 'multiOptions' => array('' => 'Please select'),\n 'validators' => array(\n array (\n 'NotEmpty',\n true,\n array(\n 'messages' => array(\n 'isEmpty' => 'Please select landlord address',\n 'notEmptyInvalid' => 'Please select landlord address'\n )\n )\n )\n )\n ));\n\n // Remove 'nnn not found in haystack' error\n $this->getElement('landlord_address')->setRegisterInArrayValidator(false);\n\n // Add hidden element for postcode\n $this->addElement('hidden', 'landlord_address_id', array(\n 'value' => 1, 'class' => 'noborder'\n ));\n\n\n // Add agent phone number element\n $this->addElement('text', 'landlord_telephone', array(\n 'label' => 'Telephone number',\n 'required' => false,\n 'class' => 'input-pos-float',\n 'validators' => array(\n array('NotEmpty', true, array(\n 'messages' => array(\n 'isEmpty' => 'Please enter landlord phone number'\n )\n )),\n array('regex', true, array(\n 'pattern' => $this->PHONE_RGX,\n 'messages' => 'Not a valid phone number'\n ))\n )\n ));\n\n // Add Landlord e-mail element\n $this->addElement('text', 'landlord_email', array(\n 'label' => 'Email address',\n 'required' => false,\n 'filters' => array('StringTrim'),\n 'maxlength' => '100',\n 'validators' => array(\n array ('NotEmpty', true, array(\n 'messages' => array(\n 'isEmpty' => 'Please enter landlord email address'\n )\n ))\n )\n ));\n\n $emailValidator = new Zend_Validate_EmailAddress();\n $emailValidator->setMessages(\n array(\n Zend_Validate_EmailAddress::INVALID_HOSTNAME => \"Domain name invalid in email address\",\n Zend_Validate_EmailAddress::INVALID_FORMAT => \"Invalid email address\"\n )\n );\n\n $this->getElement('landlord_email')->addValidator($emailValidator);\n\n // Set decorators\n $this->clearDecorators();\n $this->setDecorators(array ('Form'));\n $this->setElementDecorators(array ('ViewHelper', 'Label', 'Errors'));\n\n // Add the next button\n $this->addElement('submit', 'next', array(\n 'ignore' => true,\n 'label' => 'Continue to Step 2',\n 'onclick' => 'window.location=\"step2\"'\n ));\n\n // Add the save and exit button\n $this->addElement('button', 'save', array(\n 'ignore' => true, 'label' => 'Save & Exit'\n ));\n\n // Landlord Address decorators\n $landlordAddressLookUp = $this->getElement('landlords_address_lookup');\n $landlordAddressLookUp->clearDecorators();\n $landlordAddressLookUp->setDecorators(array ('ViewHelper'));\n\n // Nav decorators\n $next = $this->getElement('next');\n $next->clearDecorators();\n $next->setDecorators(array ('ViewHelper'));\n\n $save_and_exit = $this->getElement('save');\n $save_and_exit->clearDecorators();\n $save_and_exit->setDecorators(array ('ViewHelper'));\n\n $this->setDecorators(\n array(\n array(\n 'ViewScript',\n array(\n 'viewScript' => 'rentguaranteeclaims/subforms/you-and-landlords.phtml'\n )\n )\n )\n );\n\n //Allow HTML to be inserted into the labels.\n $this->getElement('landlord1_name')->getDecorator('Label')->setOption('escape', false);\n $this->getElement('landlord_postcode')->getDecorator('Label')->setOption('escape', false);\n }",
"function __construct()\n {\n parent::__construct();\n \n // creates the form\n $this->form = new TQuickForm('form_historicotrabalho');\n $this->form->class = 'tform'; // change CSS class\n \n $this->form->style = 'display: table;width:100%'; // change style\n \n // Define Título da página\n $this->form->setFormTitle('Banco de Horas - Lançamento de Escalas');\n // Inicía ferramentas auxiliares\n $fer = new TFerramentas(); // Ferramentas diversas\n $sicad = new TSicadDados(); // Ferramentas de acesso ao SICAD\n //Realiza definições iniciais de acesso\n $profile = TSession::getValue('profile'); //Profile da Conta do usuário\n if ($this->opm_operador==false) //Carrega OPM do usuário\n {\n //Confere se já foi carregado a OPM, senão carrega...ou se o ambiente for de desenvolvimento usa a OPM = 140\n $this->opm_operador = ($fer->is_dev()==true) ? 140 : $profile['unidade']['id'];\n }\n if (!$this->nivel_sistema || $this->config_load == false) //Carrega OPMs que tem acesso\n {\n $this->nivel_sistema = $fer->getnivel (get_class($this));//Verifica qual nível de acesso do usuário\n $this->listas = $sicad->get_OpmsRegiao($this->opm_operador);//Carregas as OPMs que o usuário administra\n $this->config = $fer->getConfig($this->sistema); //Busca o Nível de acesso que o usuário tem para a Classe\n $this->config_load = true; //Informa que configuração foi carregada\n }\n \n // Cria os Itens do Formulário\n $rgmilitar = new TEntry('rgmilitar');\n \n //Monta ComboBox com OPMs que o Operador pode ver\n //echo $this->nivel_sistema.'---'.$this->opm_operador;\n if ($this->nivel_sistema>=80) //Adm e Gestor\n {\n $criteria = null;\n }\n else if ($this->nivel_sistema>=50 ) //Nível Operador (carrega OPM e subOPMs)\n {\n $criteria = new TCriteria;\n //Se não há lista de OPM, carrega só a OPM do usuário\n $lista = ($this->listas['valores']!='') ? $this->listas['valores'] : $profile['unidade']['id'];\n $query = \"(SELECT DISTINCT id FROM g_geral.opm WHERE id IN (\".$lista.\"))\";\n $criteria->add (new TFilter ('id','IN',$query));\n }\n else if ($this->nivel_sistema<50) //nível de visitante (só a própria OPM)\n {\n $criteria = new TCriteria;\n $query = \"(SELECT DISTINCT id FROM g_geral.opm WHERE id IN (\".$this->opm_operador.\"))\";\n $criteria->add (new TFilter ('id','IN',$query));\n }\n $opm = new TDBCombo('opm','sicad','OPM','id','nome','nome',$criteria);\n \n $ativo = new TCombo('ativo');\n $lista_opm = new TSelect('lista_opm');\n $lista_slc = new TSelect('lista_slc');\n //Critério para os Turnos de Serviço (Deve-se excluir os ocultos e o item id=13)\n $criteria = new TCriteria; \n $criteria->add(new TFilter('oculto', '=', 'f'));\n $criteria->add(new TFilter('id', '!=', 13));\n $turno = new TDBCombo('turno','sicad','turnos','id','nome','nome',$criteria);\n \n $datainicial = new TDate('dataInicial');\n $datafinal = new TDate('dataFinal');\n $horaIncialOrdinario = new TEntry('horaInicialOrdinario');\n $opm_id_info = new TDBCombo('opm_id_info','sicad','OPM','id','sigla','sigla');\n $opm_info_atual = new TCombo('OPM_info_Atual');\n $diasExtra = new TEntry('diasExtra');\n $mesExtra = new TCombo('mesExtra');\n $anoExtra = new TCombo('anoExtra');\n $horaInicioExtra = new TEntry('horaInicioExtra');\n $horasTrabalhadas = new TEntry('horasTrabalhadas');\n $tipoExtra = new TCombo('tipoExtra');\n $afasta_id = new TDBCombo('afasta_id','sicad','afastamentos','id','nome','nome');\n $dtinicioaf = new TDate('dtinicioaf');\n $dtfimaf = new TDate('dtfimaf');\n $bgaf = new TEntry('bgaf');\n $anobgaf = new TEntry('anobgaf');\n \n //Formatar Itens\n $rgmilitar->setSize(80);\n $opm->setSize(300);\n $lista_opm->setSize(280,256);\n $lista_slc->setSize(280,256);\n $turno->setSize(200);\n $datainicial->setSize(80);\n $datafinal->setSize(80);\n $horaIncialOrdinario->setSize(50);\n $opm_id_info->setSize(150);\n $opm_info_atual->setSize(80);\n $diasExtra->setSize(200);\n $mesExtra->setSize(80);\n $anoExtra->setSize(80);\n $horaInicioExtra->setSize(50);\n $horasTrabalhadas->setSize(50);\n $tipoExtra->setSize(120);\n $afasta_id->setSize(150);\n $dtinicioaf->setSize(80);\n $dtfimaf->setSize(80);\n $bgaf->setSize(80);\n $anobgaf->setSize(80);\n $ativo->setSize(80);\n //Style\n $lista_opm->style = \"font-size: 12px;\";\n $lista_slc->style = \"font-size: 12px;\";\n\n //Mascaras\n $datainicial->setMask('dd-mm-yyyy');\n $datafinal->setMask('dd-mm-yyyy');\n $dtinicioaf->setMask('dd-mm-yyyy');\n $dtfimaf->setMask('dd-mm-yyyy');\n $horaIncialOrdinario->setMask('99:99');\n $horaInicioExtra->setMask('99:99');\n $horasTrabalhadas->setMask('99');\n\n //Dados\n $opm_info_atual->addItems($fer->lista_sim_nao());//($item);\n $opm_info_atual->setValue('N');\n $ativo->addItems($fer->lista_sim_nao());//($item);\n $ativo->setValue('N');\n //\n $item = array (\"S\"=>\"Remunerada\",\"N\"=>\"Administrativa\");\n $tipoExtra->addItems($item);\n $tipoExtra->setValue('N');\n //\n $fer = new TFerramentas;\n $mesExtra->addItems($fer->lista_meses());\n $anoExtra->addItems($fer->lista_anos());\n //Tips\n $rgmilitar->setTip('Preencha com o RG do Militar pretendido...');\n $opm->setTip('Selecione a OPM para que possa preencher o campo de Lista da OPM com os componentes da Unidade.');\n $lista_opm->setTip('Lista dos Militares pertencente à Unidade Selecionada acima.<br>'.\n 'Vale lembrar que esta lista é atualizada diáriamente, assim os que estão aqui reflete as listas do SICAD.<br>' .\n 'Outro ponto a se considerar é a possibilidade de selecionar vários PMs, para isso basta usar<br>'.\n 'as teclas Control (ctrl) ou shift (seta pra cima);');\n $lista_slc->setTip('Militares Selecionados. Todos que estão nesta lista serão afetados, quer por uma escala ou por afastamentos...');\n $turno->setTip('Selecione uma Escala conforme a necessidade.');\n $datainicial->setTip('Selecione a data inicial da Escala Ordinária.');\n $datafinal->setTip('Selecione a data final da Escala Ordinária');\n $horaIncialOrdinario->setTip('Informe a hora de inicio do primeiro turno da Escala Ordinária.');\n $opm_id_info->setTip('Selecione qual foi a OPM informante da Escala.<br>É útil quando o militar está prestando serviços em uma OPM diferente da sua.');\n $opm_info_atual->setTip('A unidade Informante é a Unidade Atual? Se SIM, irei substituir a unidade que por ventura está na ficha do militar pela que foi informada...');\n $diasExtra->setTip('Defina os dias que o militar trabalhou podendo ser:<br> - Um dia apenas (Ex: 1);<br>- Alguns dias separados por vírgula(Ex: 2,5,8);<br>- Um intervalo de dias ligados por traço (Ex: 2-10);<br>- Um misto de combinações (Ex: 1,3-5,8,15-25). ');\n $mesExtra->setTip('Mês que ocorreu o serviço extra.');\n $anoExtra->setTip('Ano que ocorreu o serviço extra.');\n $horaInicioExtra->setTip('Hora que o serviço extra iniciou.');\n $horasTrabalhadas->setTip('Quantas horas foram trabalhadas neste serviço extra.');\n $tipoExtra->setTip('Defina se a escala foi Administrativa (sem remuneração AC-4) ou Remunerada (com pagamento de AC-4).');\n $afasta_id->setTip('Qual tipo de afastamento o militar fez jus.');\n $dtinicioaf->setTip('Data inicial do afastamento.');\n $dtfimaf->setTip('Data final do afastamento.');\n $bgaf->setTip('Numero do BG onde foi publicado o afastamento(Opcional).');\n $anobgaf->setTip('Ano de publicação do BG de Afastamento (Opcional).');\n $ativo->setTip('Se desejar que os militares inativos façam parte da seleção, marque como SIM para seleciona-los.'.\n '<br>Caso troque esta opção, não haverá a limpeza dos já selecionados.');\n //Ações\n //$change_action = new TAction(array($this, 'onSelectOpm_old'));//Ação de Popular lista de PMs\n //$opm->setChangeAction($change_action);\n //$ativo->setChangeAction($change_action);\n \n //Controle de Nível\n if ($this->nivel_sistema<$this->config[$this->cfg_chg_opm])\n {\n $opm_id_info->setEditable(FALSE);\n $opm_info_atual->setEditable(FALSE);\n }\n //Botões\n //Seleciona PMs\n $addPM = new TButton('addPM');\n $addPM->setImage('fa:arrow-down black');\n $addPM->class = 'btn btn-primary btn-sm';\n $Action = new TAction(array($this, 'onSelectMilitar'));\n $addPM->setAction($Action);\n $addPM->setLabel('Seleciona');\n \n //Botão Gera Escala Ordinária\n $runOrd = new TButton('runOrd');\n $runOrd->setImage('fa:floppy-o red');\n $runOrd->class = 'btn btn-primary btn-sm';\n $Action = ($this->nivel_sistema>=$this->config[$this->cfg_ord]) ? new TAction(array($this, 'onGeraOrdinaria')) : new TAction(array($this, 'NoAcess'));\n $runOrd->setAction($Action);\n $runOrd->setLabel('Gera Escala');\n \n //Botão Gera Escala Extra\n $runExt = new TButton('runExt');\n $runExt->setImage('fa:floppy-o red');\n $runExt->class = 'btn btn-primary btn-sm';\n $Action = ($this->nivel_sistema>=$this->config[$this->cfg_ext]) ? new TAction(array($this, 'onGeraExtra')) : new TAction(array($this, 'NoAcess'));\n $runExt->setAction($Action);\n $runExt->setLabel('Gera Escala');\n \n //Botão Gera Afastamento\n $runAfa = new TButton('runAfa');\n $runAfa->setImage('fa:floppy-o red');\n $runAfa->class = 'btn btn-primary btn-sm';\n $Action = ($this->nivel_sistema>=$this->config[$this->cfg_afa]) ? new TAction(array($this, 'onGeraAfastamento')) : new TAction(array($this, 'NoAcess'));\n $runAfa->setAction($Action);\n $runAfa->setLabel('Gera Afastamento');\n \n //Botão Limpa Afastamento\n $runCls = new TButton('runCls');\n $runCls->setImage('fa:trash black');\n $runCls->class = 'btn btn-danger btn-sm';\n $Action = ($this->nivel_sistema>=$this->config[$this->cfg_cls_afa]) ? new TAction(array($this, 'onLimpaAfastamento')) : new TAction(array($this, 'NoAcess'));\n $runCls->setAction($Action);\n $runCls->setLabel('Limpa Afastamento');\n \n //Botão Verifica Escala\n $runVer = new TButton('runVer');\n $runVer->setImage('fa:eye black');\n $runVer->class = 'btn btn-info btn-sm';\n $Action = new TAction(array($this, 'onListaEscala'));\n $runVer->setAction($Action);\n $runVer->setLabel('Ver Escala');\n \n //Botão limpa Escalas\n $runLmp = new TButton('runLmp');\n $runLmp->setImage('fa:trash black');\n $runLmp->class = 'btn btn-danger btn-sm';\n $Action = ($this->nivel_sistema>=$this->config[$this->cfg_cls_esc]) ? new TAction(array($this, 'onLimpaEscala')) : new TAction(array($this, 'NoAcess'));\n $runLmp->setAction($Action);\n $runLmp->setLabel('Limpa Escala');\n \n //Botão Carrega OPM na Lista da OPM\n $runOpm = new TButton('runOpm');\n $runOpm->setImage('fa:retweet');\n $runOpm->class = 'btn btn-success btn-sm';\n $Action = new TAction(array($this, 'onSelectOpm_old'));\n $runOpm->setAction($Action);\n $runOpm->setLabel('Carrega OPM');\n \n $table = new TTable();\n $table-> border = '0';\n $table-> cellpadding = '4';\n $table-> style = 'border-collapse:collapse; text-align: center;';\n\n //Monta selecionador\n $hbox1 = new THBox;\n $hbox1->addRowSet( new TLabel('RG:'),$rgmilitar,$addPM,new TLabel('Unidade:'),$opm,new TLabel('Seleciona Inativos?'),$ativo,$runOpm);\n $frame1 = new TFrame;\n $frame1->setLegend('Selecione os PMs ou a OPM');\n $frame1->add($hbox1);\n //Monta Labels das tabelas de distribuição\n $title4 = new TLabel('Listagem da OPM');\n $title4->setFontSize(12);\n $title4->setFontFace('Arial');\n $title4->setFontColor('black');\n $title4->setFontStyle('b');\n \n $title3 = new TLabel('Comandos');\n $title3->setFontSize(12);\n $title3->setFontFace('Arial');\n $title3->setFontColor('black');\n $title3->setFontStyle('b');\n \n $title2 = new TLabel('PMs Selecionados');\n $title2->setFontSize(12);\n $title2->setFontFace('Arial');\n $title2->setFontColor('black');\n $title2->setFontStyle('b');\n \n $title1 = new TLabel('Gestão da Escala');\n $title1->setFontSize(12);\n $title1->setFontFace('Arial');\n $title1->setFontColor('black');\n $title1->setFontStyle('b');\n \n //Botões de Serviço\n $add = new TButton('add_opm');\n $del = new TButton('del_opm');\n $cls = new TButton('clear');\n $ret = new TButton('return');\n \n //Tabelas Auxiliares de Cadastro\n $table_ord = new TTable;//Escalas Ordinárias\n $table_ext = new TTable;//Escalas Extras\n $table_afa = new TTable;//Afastamentos\n\n //Cria no Notebook \n $notebook = new TNotebook(200, 220);\n // Crias as Abas no notebook\n $notebook->appendPage('Ordinária' , $table_ord);\n $notebook->appendPage('Extra' , $table_ext);\n $notebook->appendPage('Afastamento', $table_afa);\n\n //Itens: Escala Ordinária\n $table_ord->addRowSet(array(new TLabel('Escala'),$turno));\n $table_ord->addRowSet(array(new TLabel('De'),$datainicial,new TLabel('A'),$datafinal));\n $table_ord->addRowSet(array(new TLabel('Hora Inicial'),$horaIncialOrdinario));\n $table_ord->addRowSet(array(new TLabel('OPM Informante'),$opm_id_info));\n $table_ord->addRowSet(array(new TLabel('Usar Informante com Atual'),$opm_info_atual));\n $table_ord->addRowSet(array($runLmp,$runOrd));\n //Itens: Escala Extra\n $table_ext->addRowSet(array(new TLabel('Dias'),$diasExtra));\n $table_ext->addRowSet(array(new TLabel('Mês'),$mesExtra,new TLabel('Ano'),$anoExtra));\n $table_ext->addRowSet(array(new TLabel('Hr Início'),$horaInicioExtra,new TLabel('Hrs. Trab.'),$horasTrabalhadas));\n $table_ext->addRowSet(array(new TLabel('Tipo Escala'),$tipoExtra));\n $table_ext->addRowSet($runExt);\n //Itens: Afastamento\n $table_afa->addRowSet(array(new TLabel('Afastamento'),$afasta_id));\n $table_afa->addRowSet(array(new TLabel('De'),$dtinicioaf,new TLabel('A'),$dtfimaf));\n $table_afa->addRowSet(array(new TLabel('BG'),$bgaf,new TLabel('/'),$anobgaf));\n $table_afa->addRowSet(array($runCls,$runAfa));\n\n //Ações\n $add->setAction(new TAction(array($this, 'onAddPMSelect')));\n $del->setAction(new TAction(array($this, 'onDelPMSelect')));\n $cls->setAction(new TAction(array($this, 'onClearSelect')));\n $ret->setAction(new TAction(array($this, 'onReturn')));\n //Labels\n $add->setLabel('Adiciona');\n $del->setLabel('Remove');\n $cls->setLabel('Limpa');\n $ret->setLabel('Volta ao Gerenciador');\n //Icones\n $add->setImage('fa:plus green');\n $del->setImage('fa:minus red');\n $cls->setImage('fa:file-o black');\n $ret->setImage('fa:backward black');\n //Classes\n $ret->class = 'btn btn-warning';\n //PopUps\n if ($this->popAtivo)\n {\n $addPM->popover = 'true';\n $addPM->popside = 'top';\n $addPM->poptitle = 'Seleciona Militar';\n $addPM->popcontent = 'Clique aqui ou tecle ENTER para selecionar o militar.';\n //\n $add->popover = 'true';\n $add->popside = 'top';\n $add->poptitle = 'Adiciona Seleção de Militares';\n $add->popcontent = 'Adiciona o(s) Militar(es) selecionado(s) da caixa Lista da OPM.';\n //\n $del->popover = 'true';\n $del->popside = 'top';\n $del->poptitle = 'Remove Seleção de Militares';\n $del->popcontent = 'Remove o(s) Militar(es) selecionado(s) da caixa Selecionados.';\n //\n $cls->popover = 'true';\n $cls->popside = 'top';\n $cls->poptitle = 'Limpa toda Seleção de Militares';\n $cls->popcontent = 'Remove TODOS os Militares selecionados da caixa Selecionados.';\n //\n $ret->popover = 'true';\n $ret->popside = 'top';\n $ret->poptitle = 'Retorno à Tela de Gerenciamento';\n $ret->popcontent = 'Retorna para a Tela de Gerenciamento do Banco de Horas.<br>A lista e Militares já selecionados permanecerá até o fechamento do sistema.';\n //\n $runOrd->popover = 'true';\n $runOrd->popside = 'top';\n $runOrd->poptitle = 'Gera Escala Ordinária.';\n $runOrd->popcontent = 'São campos necessários:<br>- Turno;<br>- Data inicial e final;<br>- Hora de Início da Escala.';//.\n //\n $runExt->popover = 'true';\n $runExt->popside = 'top';\n $runExt->poptitle = 'Gera Escala Extra';\n $runExt->popcontent = 'São Campos necessários:<br>- Dias (preencher com um ou mais);<br>- Mês e Ano;<br>- Hora Início;<br>'.\n '- Horas Trabalhadas;<br>- Tipo Escala.';\n //\n $runCls->popover = 'true';\n $runCls->popside = 'top';\n $runCls->poptitle = 'Limpa Afastamentos e Restrições (apenas)';\n $runCls->popcontent = 'Use os campos acima como filtro.';\n //\n $runAfa->popover = 'true';\n $runAfa->popside = 'top';\n $runAfa->poptitle = 'Gera Afastamentos e Restrições';\n $runAfa->popcontent = 'São Campos necessários:<br>- Afastamento;<br>- O intervalo de datas.';\n //\n $runVer->popover = 'true';\n $runVer->popside = 'top';\n $runVer->poptitle = 'Verifica a Escala';\n $runVer->popcontent = 'É necessário escolher um militar (um apenas) quer no Campo Lista da OPM quer no Campo Selecionados.';\n //\n $runLmp->popover = 'true';\n $runLmp->popside = 'top';\n $runLmp->poptitle = 'Limpa as Escalas e Afastamentos';\n $runLmp->popcontent = 'Limpa Escalas (ordinária e Extra) e Afastamentos dos militares Selecionados e no intervalo de datas';\n \n $runOpm->popover = 'true';\n $runOpm->popside = 'top';\n $runOpm->poptitle = 'Carrega os militares da Unidade';\n $runOpm->popcontent = 'Carrega os Militares da unidade escolhida filtrando os ativos e inativos conforme se escolhe Sim ou Não no campo Seleciona inativos:';\n }\n //Tabela com Comandos\n $frame_tempo = new TFrame();\n $hboxc = new THBox;\n $hboxc->addRowSet($add);\n $hboxc->addRowSet($del);\n $hboxc->addRowSet($cls);\n $hboxc->addRowSet($runVer);\n $hboxc->addRowSet($ret);\n\n $frame1->add($hboxc);\n $frame1->style = \"width: 100%; display: table-cell; vertical-align: top; text-align: center;\";\n\n //Frame com Lista da OPM\n $vbox2 = new TVBox;\n $frame4 = new TFrame(260,330);\n $frame4->setLegend('Lista de Militares da OPM');\n $frame4->add($lista_opm);\n $frame4->style = \"width: 280px; display: table-cell; vertical-align: top;\";\n $vbox2->add($frame4);\n //Frame de Seleção\n $vbox4 = new TVBox;\n $frame6 = new TFrame(260,330);\n $frame6->setLegend('Militares Selecionados');\n $frame6->add($lista_slc);\n $frame6->style = \"width: 280px; display: table-cell; vertical-align: top;\";\n $vbox4->add($frame6);\n //Frame de Geração\n $vbox5 = new TVBox;\n $frame3 = new TFrame(280,330);\n $frame3->setLegend('Funções de Geração');\n $frame3->add($notebook);\n $frame3->style = \"width: 280px; display: table-cell; vertical-align: top;\";\n $vbox5->add($frame3);\n \n $frame2 = new TFrame;\n $frame2->style = \"width: 100%; display: table-cell; vertical-align: top;\";\n $frame2->add($vbox2);\n $frame2->add($vbox4);\n $frame2->add($vbox5);\n\n $this->form->setFields(array($rgmilitar,$opm,$addPM,$lista_opm,$lista_slc,$opm_info_atual,$opm_id_info,$turno,\n $datafinal,$datainicial,$dtinicioaf,$dtfimaf,$horaIncialOrdinario,$horaInicioExtra,$horasTrabalhadas,\n $diasExtra,$mesExtra,$anoExtra,$bgaf,$anobgaf,$tipoExtra,$afasta_id,$ativo,\n $add,$del,$cls,$ret,$runOrd,$runExt,$runAfa,$runCls,$runVer,$runLmp,$runOpm)); \n // vertical box container\n $container = new TVBox;\n $container->style = 'width: 90%';\n $container->add(new TXMLBreadCrumb('menu.xml', 'bdhManagerForm'));\n $container->add($frame1);\n //$container->add($frame_tempo);\n $container->add($frame2);\n $this->form->add($container);\n\n //parent::add($container);\n parent::add($this->form);\n if ($opm->getValue())\n {\n self::onSelectOpm_old(array('opm'=>$opm->getValue(),'ativo'=>$ativo->getValue()));\n }\n $lista_slc = TSession::getValue(__CLASS__.'_lista_slc');\n self::onLoadPMSelect();\n self::popula_escalas();\n\n }",
"public function init()\n { \n $this->setMethod('post');\n $this->setAttrib('id', 'IngredientAddForm');\n //$this->setAttrib('name', 'IngredientAddForm');\n //$this->setName('add_ingredient_form');\n \n $this->addElement('select', 'ingredient_id', [\n 'label' => 'Ingredient:',\n 'id' => '',\n 'required' => true,\n 'filters' => ['StringTrim'],\n 'validators' => [],\n 'multiOptions'=> $this->ingredients,\n ]);\n\n $this->addElement('text', 'quantity', [\n 'label' => 'Quantity:',\n 'required' => true,\n 'validators' => [],\n ]); \n \n\n $this->addElement('submit', 'submit_add', [\n 'ignore' => true,\n 'class' => 'btn btn-md btn-primary',\n 'label' => 'Save',\n ]);\n\n $this->addElement('hash', 'csrf_add_ingredient_form', array(\n 'ignore' => true,\n ));\n }",
"public function init(){\n\n // init the parent\n parent::init();\n // set the form's method\n $this->setMethod('post');\n $name = new Zend_Form_Element_Text('name');\n $name->setOptions(\n array(\n 'label' => 'Module name', 'required' => TRUE, \n 'filters' => array(\n 'StringTrim', 'StripTags'\n ), 'validators' => array(\n 'NotEmpty'\n )\n ));\n $this->addElement($name);\n $submit = new Zend_Form_Element_Submit('submit');\n $submit->setOptions(\n array(\n 'label' => 'Update', 'required' => TRUE\n ));\n $this->addElement($submit);\n }",
"protected function _construct()\n {\n $this->setTemplate('zirconprocessing/widget/catalogrequest.phtml');\n }",
"public function addform()\n\t{\n\t\t\t$this->setMethod('get');\n\n\t\t\t//echo \"<pre>\";\n\t\t\t//print_r($_GET);\n\t\t\t//echo \"</pre>\";\n\t\t\t$this->addElement('radio', 'Status', array(\n\t\t\t\t'required' => true,\n 'separator' => ' ',\n\t\t\t\t'multiOptions' => array(\n\t\t\t\t\t'1' => IN_PROGRESS,\n\t\t\t\t\t'2' => 'Closed'\n\t\t\t\t\t\n\t\t\t\t),\n\t\t\t\t\t'separator' => '',\n\t\t\t\t'value' => '1' //key of multiOption\n\t\t\t));\n\n\t\t\n\t\t\n\t\t$this->addElement ( \n 'multiCheckbox', 'Functional_type', \n array (\n \n\t\t//'setrequired' => true,\n 'multiOptions' => array(\n '1' => 'Pre Installation',\n '2' => 'Installation',\n '3' => 'Post Installation'\n \n ),\n 'separator' => '',\n\t\t\t\t\t//'value' => '2' // select these 2 values\n )\n);\n\t\n\t\t\t\t\n\t\t\t$this->addElement('submit', 'submit', array(\n\t\t\t\t\t'ignore' => true,\n\t\t\t\t\t'label' => 'Submit',\n\t\t\t));\n\t\t\t\n\t\t\t// And finally add some CSRF protection\n\t\t\t$this->addElement('hash', 'csrf', array(\n\t\t\t\t\t'ignore' => true,\n\t\t\t));\t\n\t}",
"public function init() {\n $this->setMethod('post');\n $this->setAction($this->getView()->url());\n $this->_view->headScript()->appendFile($this->_view->baseUrl('media/js/collapsiblefields.js', 'text/javascript'));\n $this->_view->headScript()->appendFile($this->_view->baseUrl('media/js/toggledetails.js', 'text/javascript'));\n $this->_view->headScript()->appendFile($this->_view->baseUrl('media/js/erga/paketaergasias/paradotea.js', 'text/javascript'));\n\n $subform = new Dnna_Form_SubFormBase();\n $subform->setLegend('Στοιχεία Παραδοτέου');\n // Recordid\n $subform->addElement('hidden', 'recordid', array());\n // Κωδικός Παραδοτέου\n $subform->addElement('text', 'codename', array(\n 'label' => 'Κωδικός Παραδοτέου:',\n 'validators' => array(\n array('validator' => 'StringLength', 'options' => array(0, 15))\n ),\n 'required' => true,\n 'placeholder' => 'πχ. Π.1.1',\n )\n );\n // Τίτλος Παραδοτέου\n $subform->addElement('textarea', 'title', array(\n 'label' => 'Τίτλος Παραδοτέου:',\n 'validators' => array(\n array('validator' => 'StringLength', 'options' => array(0, $this->_textareaMaxLength))\n ),\n 'rows' => 1,\n 'cols' => $this->_textareaCols,\n 'required' => true,\n )\n );\n // Ποσό\n $subform->addElement('text', 'amount', array(\n 'label' => 'Ποσό:',\n 'validators' => array(\n array('validator' => 'Float')\n ),\n 'class' => 'formatFloat',\n 'required' => true,\n ));\n // Όρια ανα Κατηγορία Προσωπικού\n $project = $this->_view->getProject();\n if(isset($project) && $project->get_personnelcategories()->count() > 0) {\n $limitsform = new Dnna_Form_SubFormBase($this->_view);\n $i = 1;\n foreach($project->get_personnelcategories() as $curCategory) {\n $curlimitform = new Dnna_Form_SubFormBase($this->_view);\n // Recordid\n $curlimitform->addElement('hidden', 'recordid', array());\n // Id κατηγορίας\n $curlimitcategoryform = new Dnna_Form_SubFormBase($this->_view);\n $curlimitcategoryform->addElement('hidden', 'recordid', array(\n 'value' => $curCategory->get_recordid(),\n ));\n $curlimitform->addSubForm($curlimitcategoryform, 'personnelcategory', false);\n // Limit\n $curlimitform->addElement('text', 'limit', array(\n 'label' => 'Όριο ωρών για '.$curCategory->get_name().':',\n 'validators' => array(\n array('validator' => 'Float')\n ),\n 'required' => false,\n ));\n $curlimitform->set_empty(false);\n $limitsform->addSubForm($curlimitform, $i, false, 'default-limits');\n $i++;\n }\n $subform->addSubForm($limitsform, 'limits', false);\n }\n // Έναρξη\n $subform->addElement('text', 'startdate', array(\n 'label' => 'Ημερομηνία Έναρξης:',\n 'validators' => array(\n array('validator' => 'Date')\n ),\n 'class' => 'usedatepicker',\n 'required' => false,\n ));\n // Λήξη\n $subform->addElement('text', 'enddate', array(\n 'label' => 'Ημερομηνία Λήξης:',\n 'validators' => array(\n array('validator' => 'Date')\n ),\n 'class' => 'usedatepicker',\n 'required' => false,\n ));\n // Εγκριση αναθεσης απο επιτροπη ερευνων\n $subform->addElement('text', 'assignmentapprovaldate', array(\n 'label' => 'Έγκριση Ανάθεσης από Επιτροπή Ερευνών:',\n 'validators' => array(\n array('validator' => 'Date')\n ),\n 'class' => 'usedatepicker',\n ));\n // Εγκριση ολοκλήρωσης απο Επιτροπή Ερευνών\n $subform->addElement('text', 'completionapprovaldate', array(\n 'label' => 'Εγκριση Ολοκλήρωσης απο Επιτροπή Ερευνών:',\n 'validators' => array(\n array('validator' => 'Date')\n ),\n 'class' => 'usedatepicker',\n ));\n\n // Σχόλια\n $subform->addElement('textarea', 'comments', array(\n 'label' => 'Γενικές Πληροφορίες:',\n 'validators' => array(\n array('validator' => 'StringLength', 'options' => array(0, $this->_textareaMaxLength))\n ),\n 'rows' => $this->_textareaRows,\n 'cols' => $this->_textareaCols,\n ));\n\n $subsubform = new Dnna_Form_SubFormBase();\n if($this->_view->getSubProject()->get_subprojectdirectlabor() == \"1\") {\n $subsubform->setLegend('Συντάκτες');\n if(($this->_view->getSubProject()->get_employees() != null && count($this->_view->getSubProject()->get_employees()) > 0) ||\n ($this->_view->getProject() != null && $this->_view->getProject()->get_thisprojectemployees() != null && count($this->_view->getProject()->get_thisprojectemployees()) > 0)) {\n $this->addAuthorFields($subsubform, false);\n } else {\n $element = new Application_Form_Element_Note('noauthorsnote', array(\n 'value' => 'Δεν έχουν οριστεί απασχολούμενοι'\n ));\n $subsubform->addElement($element);\n }\n $subform->addSubForm($subsubform, 'authors');\n } else {\n $subsubform->setLegend('Ανάδοχος');\n if($this->_view->getSubProject()->get_contractors() != null && $this->_view->getSubProject()->get_contractors()->count() > 0) {\n $this->addContractorFields($subsubform, false);\n } else {\n $element = new Application_Form_Element_Note('noauthorsnote', array(\n 'value' => 'Δεν έχουν οριστεί ανάδοχοι'\n ));\n $subsubform->addElement($element);\n }\n $subform->addSubForm($subsubform, 'contractor');\n }\n $this->addSubForm($subform, 'default');\n $this->addSubmitFields();\n }",
"public function configure()\n\t{\n\t\t$ui = new FormUI( 'jambo_config' );\n\n\t\t// Add a text control for the address you want the email sent to\n\t\t$send_to = $ui->append( 'text', 'send_to', 'option:jambo__send_to', _t('Where To Send Email: ', 'jambo') );\n\t\t$send_to->add_validator( 'validate_required' );\n\n\t\t// Add a text control for email subject\n\t\t$subject = $ui->append( 'text', 'subject', 'option:jambo__subject', _t('Subject: ', 'jambo') );\n\t\t$subject->add_validator( 'validate_required' );\n\n\t\t// Add an explanation for the subject field. Shouldn't FormUI have an easier way to do this?\n\t\t$ui->append( 'static', 'subject_explanation', '<p>' . _t('An %s in the subject will be replaced with a subject provided by the user. If omitted, no subject will be requested.', 'jambo') . '</p>' );\n\n\t\t// Add a text control for the prefix to the success message\n\t\t$success_msg = $ui->append( 'textarea', 'success_msg', 'option:jambo__success_msg', _t('Success Message: ', 'jambo') );\n\n\t\t$ui->append( 'submit', 'save', _t('Save', 'jambo') );\n\t\treturn $ui;\n\t}",
"public function init() {\n $this->setMethod ( 'post' );\n\n // add an name element\n $this->addElement ( 'text', 'name', array ('label' => 'Your name:', 'required' => true, 'filters' => array ( 'StringTrim' ), 'validators' => array ('alnum') ) );\n \n //add surname\n $this->addElement ( 'text', 'surname', array ('label' => 'Your surname:', 'filters' => array ( 'StringTrim' ), 'validators' => array ('alnum', array ('regex', false, array ('/^[a-z]/i' ) ), array ('StringLength', false, array (3, 20 ) ) ), 'required' => true ) );\n\n //add company\n $this->addElement ( 'text', 'company', array ('label' => 'Your company:', 'filters' => array ( 'StringTrim' ), 'validators' => array ( array ('StringLength', false, array (2, 120 ) ) ), 'required' => false ) );\n\n // add an email element\n $this->addElement ( 'text', 'email', array ('label' => 'Your email:', 'required' => true, 'filters' => array ('StringTrim' ), 'validators' => array ('EmailAddress' ) ) );\n\n //add phonenumber\n $this->addElement ( 'text', 'phonenumber', array ('label' => 'Your phone number:', 'filters' => array ('StringTrim', 'StringToLower' ), 'validators' => array ('alnum', array ('StringLength', false, array (9, 30 ) ) ), 'required' => false ) );\n\n //add link reported\n $this->addElement ( 'text', 'linkreported', array ('label' => 'Please, insert the link to be reviewed:', 'filters' => array ('StringTrim', 'StringToLower' ), 'validators' => array ( array ('StringLength', false, array (9, 256 ) ) ), 'required' => true ) );\n\n //add url reported\n $this->addElement ( 'text', 'urlreported', array ('label' => 'Please, insert the url where this content appears:', 'filters' => array ('StringTrim', 'StringToLower' ), 'validators' => array ( array ('StringLength', false, array (9, 256 ) ) ), 'required' => true ) );\n\n //add reason\n $this->addElement ( 'text', 'reason', array ('label' => 'Reason of your complaint:', 'filters' => array ( 'StringTrim' ), 'validators' => array ( array ('StringLength', false, array (3, 100 ) ) ), 'required' => true ) );\n\n\n $this->addElement ( 'textarea', 'message', \n array ('label' => 'Your message:', 'validators' => array (array ('StringLength', false, array (20, 2000 ) ) ), 'required' => true, 'rows' => 4,'cols' => 60 )\n\n );\n\n $this->addElement ( 'captcha', 'captcha', array ('label' => 'Please, insert the 5 characters shown:', 'required' => true,\n 'captcha' => array ('captcha' => 'Image', 'wordLen' => 5, 'height' => 50, 'width' => 160, 'gcfreq' => 50, 'timeout' => 300,\n 'font' => APPLICATION_PATH . '/configs/antigonimed.ttf',\n 'imgdir' => FOOFIND_PATH . '/public/images/captcha' ) ) );\n\n\n $checkboxDecorator = array(\n 'ViewHelper',\n 'Errors',\n array(array('data' => 'HtmlTag'), array('tag' => 'span', 'class' => 'element')),\n array('Label', array('tag' => 'dt'),\n array(array('row' => 'HtmlTag'), array('tag' => 'span')),\n ));\n\n $this->addElement('checkbox', 'agree', array(\n 'decorators' => $checkboxDecorator,\n 'required' => true,\n 'checked' =>false\n ));\n\n\n // add the submit button\n $this->addElement ( 'submit', 'submit', array (\n 'label' => 'Send',\n 'class' => 'large magenta awesome') );\n }"
] |
[
"0.6640103",
"0.65085155",
"0.6366434",
"0.6296219",
"0.6292112",
"0.6283702",
"0.62655807",
"0.6231108",
"0.61838114",
"0.61665237",
"0.6145231",
"0.61255324",
"0.6121806",
"0.6119687",
"0.6113858",
"0.61126524",
"0.61108416",
"0.60866994",
"0.60664994",
"0.605215",
"0.60282904",
"0.60243976",
"0.60091954",
"0.6009177",
"0.5967046",
"0.59609723",
"0.5954524",
"0.5948002",
"0.5939915",
"0.5939245"
] |
0.65779674
|
1
|
Form validation for the SMS / Add Carrier configuration page.
|
function room_reservations_admin_settings_sms_add_validate($form_id, &$form_state) {
if ($form_state['clicked_button']['#value'] == t('Add')) {
$carrier = $form_state['values']['carrier'];
$domain = $form_state['values']['domain'];
if (!$carrier) {
$field = 'add_carrier][carrier';
$message = t('Wireless carrier is required.');
form_set_error($field, check_plain($message));
}
if (!$domain) {
$field = 'add_carrier][domain';
$message = t('Domain name is required.');
form_set_error($field, check_plain($message));
}
else {
if (drupal_substr($domain, 0, 1) != '@') {
$field = 'add_carrier][domain';
$message = t('Domain name must begin with @.');
form_set_error($field, check_plain($message));
}
}
if (($carrier) && ($domain)) {
$sql = "
SELECT value
FROM {room_reservations_variables}
WHERE name = '%s'
";
$result = db_query($sql, 'carrier');
if ($result) {
while ($data = db_fetch_object($result)) {
$values = explode('~', $data->value);
if ($values[0] == $carrier) {
$field = 'add_carrier][carrier';
$message = t('There is already a record for this wireless
carrier.');
form_set_error($field, $message);
break;
}
}
}
}
}
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function room_reservations_admin_settings_sms_delete_validate($form_id, &$form_state) {\n if ($form_state['clicked_button']['#value'] == t('Delete')) {\n $carrier = $form_state['values']['carrier'];\n if (!$carrier) {\n $field = 'delete_carrier][carrier';\n $message = t('Wireless carrier is required.');\n form_set_error($field, check_plain($message));\n }\n }\n}",
"public function check_form()\n\t{\n\t\tProfil_fields_forum::validate(PROFIL_FIELDS_CONTACT, 'contact', $this->errstr, Fsb::$session->id());\n\t}",
"function pdfbulletin_settings_form_validate(&$form, &$form_state) {\n // @todo SERIOUSLY\n}",
"public function validate() {\n\t\t$this->form_validation->set_rules('rfid', 'FRID', 'required');\t\t\n\t\t$this->form_validation->set_rules('person', \"Person\", 'required');\n\t\t$this->form_validation->set_rules('asset_id', \"Assets\", 'required'); \t\n\t\t$this->form_validation->set_rules('inform_mobile', \"Mobile No.\"); \t\n\t\t$this->form_validation->set_rules('inform_email', \"Email Id\"); \t\n\t\t$this->form_validation->set_rules('send_sms', \"Sms Alert\"); \t\n\t\t$this->form_validation->set_rules('send_email', \"Email Alert\"); \t\n\t\t$this->form_validation->set_rules('comments', \"Comments\"); \t\n\t\t$this->form_validation->set_rules('landmark_id', \"Landmark\"); \t\n\t\treturn parent::validate();\n\t}",
"function room_reservations_admin_settings_sms_add($form, &$form_state) {\n $form['carrier'] = array(\n '#title' => t('Wireless carrier'),\n '#type' => 'textfield',\n '#maxlength' => 50,\n '#size' => 50,\n '#description' => t('The name of the wireless carrier, such as !att or\n !verizon.', array(\n '!att' => 'AT&T',\n '!verizon' => 'Verizon',\n )),\n '#weight' => -20,\n );\n $form['domain'] = array(\n '#title' => t('Domain name'),\n '#type' => 'textfield',\n '#maxlength' => 50,\n '#size' => 50,\n '#description' => t('The domain name of the wireless carrier, such as\n !att or !verizon.', array(\n '!att' => '@txt.att.net',\n '!verizon' => '@vtext.com',\n )),\n '#weight' => -10,\n );\n $form['add_carrier']['add'] = array(\n '#type' => 'submit',\n '#value' => t('Add'),\n '#weight' => 100,\n );\n return $form;\n}",
"function room_reservations_admin_settings_sms($form, &$form_state) {\n $default_sms_option = _room_reservations_get_variable('sms_option');\n $form['#tree'] = TRUE;\n $form['sms_option'] = array(\n '#title' => t('SMS option'),\n '#type' => 'checkbox',\n '#return_value' => 1,\n '#default_value' => $default_sms_option,\n '#description' => t('Give users the option of receiving confirmation\n messages and reminders as SMS text messages.'),\n '#weight' => -110,\n );\n $form['carriers'] = array(\n '#type' => 'fieldset',\n '#title' => t('Wireless carriers'),\n '#collapsible' => TRUE,\n '#collapsed' => FALSE,\n '#weight' => -100,\n );\n $sql = \"\n SELECT id, value\n FROM {room_reservations_variables}\n WHERE name = '%s'\n ORDER BY value\n \";\n $result = db_query($sql, 'carrier');\n if ($result) {\n $options = array();\n $form['carriers']['list_0'] = array(\n '#value' => '<table><tr><th>' . t('Wireless carrier') . '</th><th>' .\n t('Domain name') . '</th></tr>',\n '#weight' => -99,\n );\n $x = 0;\n while ($data = db_fetch_object($result)) {\n $x++;\n $id = $data->id;\n $values = explode('~', $data->value);\n $options[strval($id)] = $values[0];\n $form['carriers']['list_' . $x] = array(\n '#value' => '<tr><td>' . check_plain($values[0]) . '</td><td>' .\n check_plain($values[1]) . '</td></tr>',\n '#weight' => -99 + $x,\n );\n $x++;\n }\n $form['carriers']['list_' . $x] = array(\n '#value' => '</table>',\n '#weight' => -99 + $x,\n );\n }\n $form['save'] = array(\n '#type' => 'submit',\n '#value' => t('Save configuration'),\n '#weight' => 100,\n );\n $form['reset'] = array(\n '#type' => 'submit',\n '#value' => t('Reset to defaults'),\n '#weight' => 101,\n );\n return $form;\n}",
"function RegisterValidate() {\n\t\t\n\t\n\t\t$validate1 = array(\n\t\t\t'username'=> array(\n\t\t\t\t\t\t\t\t\t'mustNotEmpty'=>array(\n\t\t\t\t\t\t\t\t\t'rule' => 'notEmpty',\n\t\t\t\t\t\t\t\t\t'message'=> 'Please enter name')\n\t\t\t\t\t\t\t\t\t),\t\n\t\t\t'candidate_fname'=> array(\n\t\t\t\t\t\t\t\t\t'mustNotEmpty'=>array(\n\t\t\t\t\t\t\t\t\t'rule' => 'notEmpty',\n\t\t\t\t\t\t\t\t\t'message'=> 'Please enter first name')\n\t\t\t\t\t\t\t\t\t),\n\t\t\t'terms' => array(\n\t\t\t\t\t\t 'rule' => array('comparison', 'equal to', 1),\n\t\t\t\t\t\t 'required' => true,\n\t\t\t\t\t\t 'allowEmpty' => false,\n\t\t\t\t\t\t 'on' => 'index',\n\t\t\t\t\t\t 'message' => 'You have to agree terms & conditions'\n ),\n\t\t\t'candidate_lname'=> array(\n\t\t\t\t\t\t\t\t\t'mustNotEmpty'=>array(\n\t\t\t\t\t\t\t\t\t'rule' => 'notEmpty',\n\t\t\t\t\t\t\t\t\t'message'=> 'Please enter last name')\n\t\t\t\t\t\t\t\t\t),\t\t\n\t\t\t/*'candidate_title' => array(\n\t\t\t\t'rule' => 'notEmpty',\n\t\t\t\t'message' => 'Please enter title'\n\t\t\t\t),*/\n\t\t\t'candidate_phone' => array(\n\t\t\t\t\t'notEmpty'=>array(\n\t\t\t\t\t\t'rule' => 'notEmpty',\n\t\t\t\t\t\t'message'=> 'Please enter phone number',\n\t\t\t\t\t\t'last'=>true)\t\t\t\n\t\t\t\t),\n\t\t\t'candidate_city' => array(\n\t\t\t\t\t'rule' \t => 'notEmpty',\n\t\t\t\t\t'message' => 'Please enter city'\n\t\t\t\t),\n\t\t\t'candidate_address' => array(\n\t\t\t\t\t'rule' \t => 'notEmpty',\n\t\t\t\t\t'message' => 'Please enter address'\n\t\t\t\t),\n\t\t\t'candidate_zip'=> array(\n\t\t\t\t\t'notEmpty'=>array(\n\t\t\t\t\t\t'rule' => 'notEmpty',\n\t\t\t\t\t\t'message'=> 'Please enter zip Code',\n\t\t\t\t\t\t'last'=>true),\n\t\t\t\t\t'mustBeEmail'=> array(\n\t\t\t\t\t\t'rule' => 'numeric',\n\t\t\t\t\t\t'message' => 'Please enter valid zip Code',\n\t\t\t\t\t\t'last'=>true),\n\t\t\t\t\t'mustBeLonger' => array(\n\t\t\t\t\t\t'rule' => array('minLength', 5),\n\t\t\t\t\t\t'message' => 'Please enter valid zip Code'\n\t\t\t\t\t),\n\t\t\t\t\t'maxlength' => array(\n\t\t\t\t\t\t'rule' => array('maxLength', 5),\n\t\t\t\t\t\t'message' => 'Please enter valid zip Code'\n\t\t\t\t\t)\n\t\t\t\t\t),\n\t\t'candidate_email'=> array(\n\t\t\t\t\t'mustNotEmpty'=>array(\n\t\t\t\t\t\t'rule' => 'notEmpty',\n\t\t\t\t\t\t'message'=> 'Please enter email',\n\t\t\t\t\t\t'last'=>true),\n\t\t\t\t\t'mustBeEmail'=> array(\n\t\t\t\t\t\t'rule' => array('email'),\n\t\t\t\t\t\t'message' => 'Please enter valid email',\n\t\t\t\t\t\t'last'=>true),\n\t\t\t\t\t'mustUnique'=>array(\n\t\t\t\t\t\t'rule' =>'isUnique',\n\t\t\t\t\t\t'message' =>'This email is already registered',\n\t\t\t\t\t\t)\n\t\t\t\t\t),\n\t\t'candidate_secondary_email'=> array(\n\t\t\t\t\t'allowEmpty'=> array(\n\t\t\t\t\t\t'rule' => 'email',\n\t\t\t\t\t\t'allowEmpty' => true,\n\t\t\t\t\t\t'message' => 'Please enter valid email',\n\t\t\t\t\t\t'last'=>true)\n\t\t\t\t\t\n\t\t\t\t\t)\n\t\t\t);\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t$this->validate=$validate1;\n\t\t\treturn $this->validates();\n\t}",
"public function validation_partnerSignUp()\n {\n $this->form_validation->set_rules('company_name','company name','required');\n $this->form_validation->set_rules('company_website','company website','required');\n $this->form_validation->set_rules('company_summary','company summary',''); \n $this->form_validation->set_rules('first_name','first name','required');\n $this->form_validation->set_rules('last_name','last name','');\n $this->form_validation->set_rules('contact_address','contact address','');\n $this->form_validation->set_rules('contact_phone','contact phone','');\n $this->form_validation->set_rules('email','email','required');\n }",
"function form_check() {\n\tglobal $cert_amt_tbl;\n\t\n\t// required fields array\n\t$required_fields = array('Discount Amount'=> $cert_amt_tbl->discount_amount);\n\t\t\n\t// check error values and write error array\t\t\t\t\t\n\tforeach($required_fields as $field_name => $output) {\n\t if (empty($output)) {\n\t\t$errors_array[] = $field_name;\n\t }\n\t}\n\t\n\tif (!empty($errors_array)) {\n\t $error_message = 'You did not supply a value for these fields: ' . implode(', ',$errors_array);\n\t}\n\t\n return $error_message;\n }",
"function adstrue_vendor_provice_validate($form, &$form_state) {\n drupal_add_css(drupal_get_path('module','adstrue_vendor').'/assets/css/custom_form.css');\n \n $name_province = $form_state['values']['name_province'];\n $company_id = $form_state['values']['company_id'];\n if($company_id == 0) {\n form_set_error('company_id',t('Vui lòng chọn công ty'));\n }\n\n $province_description = $form_state['values']['province_description'];\n $region_id = $form_state['values']['region_id'];\n $company_id = $form_state['values']['company_id'];\n if($name_province == '') {\n form_set_error('Vui lòng nhập tên tỉnh thành');\n }\n}",
"function validate(){\n if(trim($_POST['checking']) !== '') {\n $this->add_error('capthcaError', true);\n return;\n } \n\n if(!isset($_POST[\"cico_nonce\"]) || \n !wp_verify_nonce( $_POST[\"cico_nonce\"], wp_get_theme()->Name)){\n $this->add_error('nonceError', true);\n return;\n }\n\n //Check to make sure that the name field is not empty\n if($this->emailParams['userName'] === '') {\n //TODO: check if the clinician even exists\n $this->add_error('userError', 'You didn\\'t specify a clinician.');\n }\n\n if($this->emailParams['name'] === '') {\n $this->add_error('nameError', 'You forgot to enter your name.');\n }\n \n //Check to make sure sure that a valid email address is submitted\n if($this->emailParams['email'] === '') {\n $this->add_error('emailError', 'You forgot to enter your email address.');\n } else if (!eregi(\"^[A-Z0-9._%-]+@[A-Z0-9._%-]+.[A-Z]{2,4}$\", $this->emailParams['email'])) {\n $this->add_error('emailError', 'You entered an invalid email address.');\n }\n \n //Check to make sure comments were entered \n if($this->emailParams['body'] === '') {\n $this->add_error('commentError', 'You forgot to enter your comments.');\n } \n }",
"public function validate()\n {\n if ($this->amount <= 0) {\n $this->errors[0] = 'Wpisz poprawną kwotę!';\n }\n \n if (!isset($this->payment)) {\n $this->errors[1] = 'Wybierz sposób płatności!';\n }\n \n if (!isset($this->category)) {\n $this->errors[2] = 'Wybierz kategorię!';\n }\n }",
"function _eventbrite_sboc_config_form_validate($form, &$form_state){\n $eventbrite_api_key = $form_state['values']['eventbrite_api_key'];\n $eventbrite_api_user_key = $form_state['values']['eventbrite_api_user_key'];\n \n if (empty($eventbrite_app_key) || empty($eventbrite_api_user_key)) {\n\t form_set_error('API Credentials', t('Eventbrite API Key and API Usere Keys are required.'));\n } \n }",
"function inscription_jesa_manage_validate($form, &$form_state) {\n \n}",
"protected function postValidation()\n {\n if (Tools::isSubmit('btnSubmit')) {\n if (!Tools::getValue('SEND_SMS_API')) {\n $this->postErrors[] = $this->l('API Key is required.');\n }\n if (Tools::getValue('SEND_SMS_API')) {\n $isapiKey = $this->isValidAPIKey(Tools::getValue('SEND_SMS_API'));\n if ($isapiKey->status != 'success') {\n $this->postErrors[] = $this->l('API Key is not valid.');\n }\n }\n if (!Tools::getValue('ADMIN_MOBILE')) {\n $this->postErrors[] = $this->l('Admin Mobile Number is required.');\n }\n if (Tools::getValue('ADMIN_MOBILE')) {\n $isvalid = preg_match('/^[0-9]*$/', Tools::getValue('ADMIN_MOBILE'));\n if ($isvalid == false) {\n $this->postErrors[] = $this->l('Admin Mobile Number is not valid.');\n }\n }\n }\n }",
"private function __addMedicationSchedulerFormValidation() {\n\t\t$model = 'MedicationSchedulerForm';\n\t\t$validations = $this->$model->validate;\n\t\t$this->JQValidator->addValidation($model, $validations, 'medication_scheduler_form');\n\t}",
"function courier_connector_queue_validate(&$form_state) {\n\n}",
"function form_backend_validation()\r\n {\r\n return true ;\r\n }",
"protected function validateForm()\n {\n if (!$this->user->hasPermission('modify', 'domain/domain')) {\n $this->error['warning'] = $this->language->get('error_permission');\n }\n\n if (empty($this->request->post['domain']) || !isset($this->request->post['domain'])) {\n $this->error['domain'] = $this->language->get('error_domain');\n } else {\n if (!preg_match('~^https?://(?:[a-z0-9](?:[-a-z0-9]*[a-z0-9])?\\.)+[a-z](?:[-a-z0-9]*[a-z0-9])?\\.?(?:$|/)~', $this->request->post['domain'])) {\n $this->error['domain'] = $this->language->get('error_domain');\n }\n }\n\n if (empty($this->request->post['currency_id'] || !isset($this->request->post['currency_id']))) {\n $this->error['currency'] = $this->language->get('error_currency');\n }\n\n if (empty($this->request->post['currency_title'] || !isset($this->request->post['currency_title']))) {\n $this->error['currency'] = $this->language->get('error_currency');\n }\n\n if ($this->error && !isset($this->error['warning'])) {\n $this->error['warning'] = $this->language->get('error_warning');\n }\n\n return !$this->error;\n }",
"public function beforeValidate() {\n $requiredValidator = new CRequiredValidator();\n $emailValidator = new CEmailValidator();\n\n //SFERA-2781\n if(ClientDetectorComponent::getInstance()->isTechnicolor() || ClientDetectorComponent::getInstance()->isUmg()){\n\n //if not empty => should be validate\n if($this->email){\n $emailValidator->attributes[] = 'email';\n }\n\n if ($this->isMoneyBookers()) {\n // Set email variable\n $this->email = $this->mbEmail;\n if($this->email){\n $emailValidator->attributes[] = 'mbEmail';\n }\n } elseif($this->isPayPal()) {\n // Set email variable\n $this->email = $this->ppEmail;\n if($this->email){\n $emailValidator->attributes[] = 'ppEmail';\n }\n } elseif($this->isWiretransfer()) {\n // Set required attributes\n // $requiredValidator->attributes[] = 'bank_name';\n // $requiredValidator->attributes[] = 'bank_address';\n // $requiredValidator->attributes[] = 'bank_swift_code';\n // $requiredValidator->attributes[] = 'bank_account_number'; \n }\n\n } else {\n\n //not Technicolor => require and validate email\n if ($this->isMoneyBookers()) {\n $requiredValidator->attributes[] = 'email';\n $emailValidator->attributes[] = 'email';\n\n // Set email variable\n $this->email = $this->mbEmail;\n // Set required attributes\n $requiredValidator->attributes[] = 'mbEmail';\n $requiredValidator->attributes[] = 'money_bookers_id';\n // Set email required attributes\n $emailValidator->attributes[] = 'mbEmail';\n } elseif($this->isPayPal()) {\n $requiredValidator->attributes[] = 'email';\n $emailValidator->attributes[] = 'email';\n\n // Set email variable\n $this->email = $this->ppEmail;\n // Set required attributes\n $requiredValidator->attributes[] = 'ppEmail';\n // Set email required attributes\n $emailValidator->attributes[] = 'ppEmail';\n } elseif($this->isWiretransfer()) {\n // Set required attributes\n // $requiredValidator->attributes[] = 'bank_name';\n // $requiredValidator->attributes[] = 'bank_address';\n // $requiredValidator->attributes[] = 'bank_swift_code';\n // $requiredValidator->attributes[] = 'bank_account_number';\n } elseif($this->isNoPayment()) {\n \n }\n }\n\n // Add validators to existing list\n if(!empty($requiredValidator->attributes)){\n $this->validatorList->add($requiredValidator);\n }\n\n if(!empty($emailValidator->attributes)){\n $this->validatorList->add($emailValidator);\n }\n\n return parent::beforeValidate();\n }",
"function ValidateBeforeAdd(){\n $this->validator->ValidateForm($this->_data, true);\n }",
"protected function mainValidation()\n {\n $this->validator->add(\n 'title',\n new StringLength([\n 'max' => 50\n ])\n );\n\n $this->validator->add(\n 'description',\n new StringLength([\n 'max' => 200,\n 'allowEmpty' => true\n ])\n );\n }",
"function room_reservations_admin_settings_validate($form_id, &$form_state) {\n if ($form_state['clicked_button']['#value'] == t('Save configuration')) {\n // Open reservations per user.\n $data = $form_state['values']['room_reservations_reservations_per_user'];\n if (!ctype_digit($data)) {\n $field = 'room_reservations_reservations_per_user';\n $message = t('Open reservations per user must be numeric.');\n form_set_error($field, check_plain($message));\n }\n // Reservations per day.\n $data = $form_state['values']['room_reservations_reservations_per_day'];\n if (!ctype_digit($data)) {\n $field = 'room_reservations_reservations_per_day';\n $message = t('Reservations per day must be numeric.');\n form_set_error($field, check_plain($message));\n }\n }\n}",
"protected function ValidateForm()\n {\n return true;\n }",
"function form_validation_rules()\n\t{\n\t\t$this->form_validation->set_message('required', '%s tidak boleh kosong');\n\t}",
"function form_val_setrules(){\n $this->form_validation->set_error_delimiters('<p style=\"color:rgb(255, 115, 115);\" class=\"help-block\"><i class=\"glyphicon glyphicon-exclamation-sign\"></i> ','</p>');\n\n $this->form_validation->set_rules('return_date','Return Date','required');\n $this->form_validation->set_rules('reference','Reference','required'); \n }",
"function form_check() {\n\tglobal $dbh, $cust_cpns_tbl;\n\t\n\t// required fields array\n\t$required_fields = array(\n\t\t\t\t\t\t\t'Code'=> $cust_cpns_tbl->code,\n\t\t\t\t\t\t\t'Value'=> $cust_cpns_tbl->value,\n\t\t\t\t\t\t\t'Expires'=> $cust_cpns_tbl->expires\n\t\t\t\t\t\t\t);\n\t\t\n\t// check error values and write error array\t\t\t\t\t\n\tforeach($required_fields as $field_name => $output) {\n\t if (empty($output)) {\n\t\t$errors_array[] = $field_name;\n\t }\n\t}\n\t\n\tif (!empty($errors_array)) {\n\t $error_message = 'You did not supply a value for these fields: ' . implode(', ',$errors_array);\n\t}\n\t\n\tif ($cust_cpns_tbl->existing_code_check() > 0) {\n\t $error_message .= '<center>Coupon code already assigned. Please enter another.</center>'.LB;\n\t}\n\t\n return $error_message;\n }",
"function buzzer_admin_form_validate($form, &$form_state) {\n $values = $form_state['values'];\n switch ($values['buzzer_mode']) {\n case 'global':{\n if (empty($values['buzzer_code']) || !is_numeric($values['buzzer_code']) || strlen($values['buzzer_code']) > 4) {\n form_set_error('buzzer_code', t('Buzzer code must be a number up to 4 digits in length'));\n }\n break;\n }\n case 'user':{\n if (empty($values['buzzer_command_say_userid'])) {\n form_set_error('buzzer_command_say_userid', t('User id request field is required'));\n }\n break;\n }\n }\n}",
"function validarFormulario()\n\t\t{\n\t\t}",
"public function validate() {\r\n // Name - this is required\r\n if ($this->description == '') {\r\n $this->errors[] = 'Description is required';\r\n } \r\n \r\n // Category number - must be a number\r\n if (!is_numeric($this->category)) {\r\n $this->category = 0;\r\n } \r\n \r\n // Item number - must be a number\r\n if (!is_numeric($this->item)) {\r\n $this->item = 0;\r\n } \r\n }"
] |
[
"0.6272369",
"0.6220238",
"0.6210996",
"0.6179887",
"0.61575353",
"0.6094786",
"0.6086658",
"0.60609907",
"0.6034559",
"0.60080296",
"0.5986142",
"0.5983774",
"0.59793806",
"0.5956614",
"0.59499675",
"0.59474665",
"0.5930106",
"0.592078",
"0.591993",
"0.5900628",
"0.5896878",
"0.58963984",
"0.5895925",
"0.5895583",
"0.58679783",
"0.5857308",
"0.58512783",
"0.5842199",
"0.5838548",
"0.5831064"
] |
0.7387934
|
0
|
Form submission for the SMS / Add Carrier configuration page.
|
function room_reservations_admin_settings_sms_add_submit($form_id, &$form_state) {
if ($form_state['clicked_button']['#value'] == t('Add')) {
$carrier = $form_state['values']['carrier'];
$domain = $form_state['values']['domain'];
$sql = "
INSERT INTO {room_reservations_variables}
(name, value)
VALUES ('%s', '%s')
";
$result = db_query($sql, 'carrier', $carrier . '~' . $domain);
if (!$result) {
drupal_set_message(t('The wireless carrier could not be added.'),
'error');
}
else {
drupal_set_message(t('The wireless carrier has been added.'));
}
}
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function room_reservations_admin_settings_sms_add($form, &$form_state) {\n $form['carrier'] = array(\n '#title' => t('Wireless carrier'),\n '#type' => 'textfield',\n '#maxlength' => 50,\n '#size' => 50,\n '#description' => t('The name of the wireless carrier, such as !att or\n !verizon.', array(\n '!att' => 'AT&T',\n '!verizon' => 'Verizon',\n )),\n '#weight' => -20,\n );\n $form['domain'] = array(\n '#title' => t('Domain name'),\n '#type' => 'textfield',\n '#maxlength' => 50,\n '#size' => 50,\n '#description' => t('The domain name of the wireless carrier, such as\n !att or !verizon.', array(\n '!att' => '@txt.att.net',\n '!verizon' => '@vtext.com',\n )),\n '#weight' => -10,\n );\n $form['add_carrier']['add'] = array(\n '#type' => 'submit',\n '#value' => t('Add'),\n '#weight' => 100,\n );\n return $form;\n}",
"function room_reservations_admin_settings_sms($form, &$form_state) {\n $default_sms_option = _room_reservations_get_variable('sms_option');\n $form['#tree'] = TRUE;\n $form['sms_option'] = array(\n '#title' => t('SMS option'),\n '#type' => 'checkbox',\n '#return_value' => 1,\n '#default_value' => $default_sms_option,\n '#description' => t('Give users the option of receiving confirmation\n messages and reminders as SMS text messages.'),\n '#weight' => -110,\n );\n $form['carriers'] = array(\n '#type' => 'fieldset',\n '#title' => t('Wireless carriers'),\n '#collapsible' => TRUE,\n '#collapsed' => FALSE,\n '#weight' => -100,\n );\n $sql = \"\n SELECT id, value\n FROM {room_reservations_variables}\n WHERE name = '%s'\n ORDER BY value\n \";\n $result = db_query($sql, 'carrier');\n if ($result) {\n $options = array();\n $form['carriers']['list_0'] = array(\n '#value' => '<table><tr><th>' . t('Wireless carrier') . '</th><th>' .\n t('Domain name') . '</th></tr>',\n '#weight' => -99,\n );\n $x = 0;\n while ($data = db_fetch_object($result)) {\n $x++;\n $id = $data->id;\n $values = explode('~', $data->value);\n $options[strval($id)] = $values[0];\n $form['carriers']['list_' . $x] = array(\n '#value' => '<tr><td>' . check_plain($values[0]) . '</td><td>' .\n check_plain($values[1]) . '</td></tr>',\n '#weight' => -99 + $x,\n );\n $x++;\n }\n $form['carriers']['list_' . $x] = array(\n '#value' => '</table>',\n '#weight' => -99 + $x,\n );\n }\n $form['save'] = array(\n '#type' => 'submit',\n '#value' => t('Save configuration'),\n '#weight' => 100,\n );\n $form['reset'] = array(\n '#type' => 'submit',\n '#value' => t('Reset to defaults'),\n '#weight' => 101,\n );\n return $form;\n}",
"protected function addCarrierFieldConfig()\n {\n // Carrier id form field (hidden for existing method or select for the new method)\n $method = $this->getMethod();\n if ($method->getData('entity_id')) {\n $carrierFieldConfig = [\n 'label' => __('Carrier'),\n 'componentType' => Field::NAME,\n 'formElement' => Hidden::NAME,\n 'dataScope' => static::FIELD_CARRIER_ID_NAME,\n 'dataType' => Number::NAME,\n 'sortOrder' => 0,\n ];\n } elseif ($this->request->getParam('carrier_id')) {\n $carrierFieldConfig = [\n 'label' => __('Carrier'),\n 'componentType' => Field::NAME,\n 'formElement' => Hidden::NAME,\n 'dataScope' => static::FIELD_CARRIER_ID_NAME,\n 'dataType' => Number::NAME,\n 'sortOrder' => 0,\n 'value' => $this->request->getParam('carrier_id')\n ];\n } else {\n $carrierFieldConfig = [\n 'label' => __('Carrier'),\n 'componentType' => Field::NAME,\n 'formElement' => Select::NAME,\n 'dataScope' => static::FIELD_CARRIER_ID_NAME,\n 'dataType' => Text::NAME,\n 'sortOrder' => 0,\n 'options' => $this->getCarriers(),\n 'disableLabel' => true,\n 'multiple' => false,\n 'validation' => [\n 'required-entry' => true,\n ],\n ];\n }\n\n $result[static::GENERAL_FIELDSET_NAME]['children'][static::FIELD_CARRIER_ID_NAME] = [\n 'arguments' => [\n 'data' => [\n 'config' => $carrierFieldConfig\n ],\n ],\n ];\n\n // The \"back_to\" hidden input, if need to redirect admin back to the carrier edit form\n if ($this->request->getParam(MethodController::BACK_TO_PARAM)) {\n $result[static::GENERAL_FIELDSET_NAME]['children'][MethodController::BACK_TO_PARAM] = [\n 'arguments' => [\n 'data' => [\n 'config' => [\n 'label' => '',\n 'componentType' => Field::NAME,\n 'formElement' => Hidden::NAME,\n 'dataScope' => MethodController::BACK_TO_PARAM,\n 'dataType' => Number::NAME,\n 'sortOrder' => 0,\n 'value' => $this->request->getParam(MethodController::BACK_TO_PARAM)\n ]\n ],\n ],\n ];\n }\n\n $this->meta = array_replace_recursive(\n $this->meta,\n $result\n );\n }",
"function room_reservations_admin_settings_sms_submit($form_id, &$form_state) {\n if ($form_state['clicked_button']['#value'] == t('Save configuration')) {\n $sms_option = $form_state['values']['sms_option'];\n $confirmation = ROOM_RESERVATIONS_SAVE_CONFIRMATION_MSG;\n $error = ROOM_RESERVATIONS_SAVE_ERROR_MSG;\n }\n if ($form_state['clicked_button']['#value'] == t('Reset to defaults')) {\n $sms_option = 0;\n $confirmation = ROOM_RESERVATIONS_RESET_CONFIRMATION_MSG;\n $error = ROOM_RESERVATIONS_RESET_ERROR_MSG;\n }\n $result = _room_reservations_set_variable('sms_option', $sms_option);\n if (!$result) {\n $errors = TRUE;\n }\n if ($errors) {\n drupal_set_message(check_plain($error), 'error');\n }\n else {\n drupal_set_message(check_plain($confirmation));\n }\n}",
"function _erpal_contract_helper_invoice_helper_config_form_submit($form, $form_state) {\n $values = $form_state['values'];\n $contract_billable_texts = $values['contract_billable_texts'];\n variable_set('erpal_billable_text_erpal_contract', $contract_billable_texts);\n}",
"public function renderForm()\n {\n $fields_form = array(\n 'form' => array(\n 'legend' => array(\n 'title' => $this->l('Configuration'),\n 'icon' => 'icon-gears'\n ),\n 'input' => array(\n array(),\n array(\n 'type' => 'text',\n 'label' => $this->l('API Key'),\n 'name' => 'SEND_SMS_API',\n 'desc' => $this->l('The API Key is used to authenticate in order to send SMS.'),\n 'required' => true\n ),\n array(\n 'type' => 'text',\n 'label' => $this->l('Admin Mobile Number'),\n 'name' => 'ADMIN_MOBILE',\n 'required' => true\n )\n ),\n 'submit' => array(\n 'title' => $this->l('Save')\n )\n )\n );\n $fields_form = $this->setDefaultInput($fields_form);\n $helper = new HelperForm();\n $helper->show_toolbar = false;\n $helper->table = $this->table;\n $lang = new Language((int) Configuration::get('PS_LANG_DEFAULT'));\n $helper->default_form_language = $lang->id;\n $helper->allow_employee_form_lang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG')\n ? Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') : 0;\n $this->fields_form = array();\n $helper->id = (int) Tools::getValue('id_carrier');\n $helper->identifier = $this->identifier;\n $helper->submit_action = 'btnSubmit';\n $helper->currentIndex = $this->context->link->getAdminLink('AdminModules', false);\n $helper->currentIndex .= '&configure=' . $this->name . '&tab_module=' . $this->tab;\n $helper->currentIndex .= '&module_name=' . $this->name;\n $helper->currentIndex .= '&configuration=yes';\n $helper->token = Tools::getAdminTokenLite('AdminModules');\n $helper->tpl_vars = array(\n 'fields_value' => $this->getConfigFieldsValues(),\n 'languages' => $this->context->controller->getLanguages(),\n 'id_language' => $this->context->language->id\n );\n \n return $helper->generateForm(array(\n $fields_form\n ));\n }",
"public function add() \n { \n $data['delivery_method'] = $this->delivery_methods->add();\n $data['action'] = 'delivery_method/save';\n \n $this->template->js_add('\n $(document).ready(function(){\n // binds form submission and fields to the validation engine\n $(\"#form_delivery_method\").parsley();\n });','embed');\n \n $this->template->render('delivery_method/form',$data);\n\n }",
"function room_reservations_admin_settings_text_submit($form_id, &$form_state) {\n if ($form_state['clicked_button']['#value'] == t('Save configuration')) {\n $enable_text = $form_state['values']['enable_text'];\n $from_address = $form_state['values']['from_address'];\n $confirmation_header = $form_state['values']['confirmation_header'];\n $confirmation_owner = $form_state['values']['confirmation_owner'];\n $reminder_header = $form_state['values']['reminder_header'];\n $reminder_owner = $form_state['values']['reminder_owner'];\n $confirmation = ROOM_RESERVATIONS_SAVE_CONFIRMATION_MSG;\n $error = ROOM_RESERVATIONS_SAVE_ERROR_MSG;\n }\n elseif ($form_state['clicked_button']['#value'] == t('Reset to defaults')) {\n $enable_text = 0;\n $confirmation_header = '';\n $confirmation_owner = '';\n $reminder_header = '';\n $reminder_owner = '';\n $confirmation = ROOM_RESERVATIONS_RESET_CONFIRMATION_MSG;\n $error = ROOM_RESERVATIONS_RESET_ERROR_MSG;\n }\n $errors = FALSE;\n $result = _room_reservations_set_variable('enable_text', $enable_text);\n if (!$result) {\n $errors = TRUE;\n }\n $result = _room_reservations_set_variable('from_address_sms', $from_address);\n if (!$result) {\n $errors = TRUE;\n }\n $result = _room_reservations_set_variable('confirmation_header_text_sms', \n $confirmation_header);\n if (!$result) {\n $errors = TRUE;\n }\n $result = _room_reservations_set_variable('confirmation_owner_text_sms', \n $confirmation_owner);\n if (!$result) {\n $errors = TRUE;\n }\n $result = _room_reservations_set_variable('reminder_header_text_sms', \n $reminder_header);\n if (!$result) {\n $errors = TRUE;\n }\n $result = _room_reservations_set_variable('reminder_owner_text_sms', \n $reminder_owner);\n if (!$result) {\n $errors = TRUE;\n }\n if ($errors) {\n drupal_set_message(check_plain($error), 'error');\n }\n else {\n drupal_set_message(check_plain($confirmation));\n }\n}",
"protected function getConfigForm()\n {\n $config_form = array(\n 'form' => array(\n 'legend' => array(\n 'title' => $this->l('Settings'),\n 'icon' => 'icon-cogs',\n ),\n 'input' => array(\n array(\n 'type' => 'switch',\n 'label' => $this->l('Equivalence surcharge'),\n 'name' => 'PROFITMARGIN_EQUIVALENCE_SURCHARGE_ENABLED',\n 'is_bool' => true,\n 'desc' => $this->l('Enable equivalence surcharge when calculating profit'),\n 'values' => array(\n array(\n 'id' => 'active_on',\n 'value' => true,\n 'label' => $this->l('Enabled')\n ),\n array(\n 'id' => 'active_off',\n 'value' => false,\n 'label' => $this->l('Disabled')\n )\n ),\n ),\n ),\n 'submit' => array(\n 'title' => $this->l('Save'),\n ),\n ),\n );\n\n\n $available_taxes = $this->getAvailableTaxes();\n foreach ($available_taxes as $tax) {\n $config_form['form']['input'][] = array(\n 'type' => 'text',\n 'name' => \"PROFITMARGIN_EQUIVALENCE_SURCHARGE_{$tax['id_tax']}\",\n 'label' => $this->l($tax['name']),\n 'desc' => $this->l('Equivalence surcharge'),\n 'suffix' => '%', \n 'col' => 1,\n );\n }\n\n $config_form['form']['input'][] = array( // @TODO: Default shipping cost for each carrier\n 'type' => 'text',\n 'name' => 'PROFITMARGIN_DEFAULT_SHIPPING_COST',\n 'label' => $this->l('Default shipping cost'),\n 'suffix' => '€', \n 'col' => 1,\n );\n\n $config_form['form']['input'][] = array(\n 'type' => 'radio',\n 'name' => 'PROFITMARGIN_SHIPPING_COST_TAX',\n 'label' => $this->l('Shipping cost tax'),\n 'values' => array()\n );\n \n foreach ($available_taxes as $tax) {\n $shipping_cost_tax = &$config_form['form']['input'];\n $shipping_cost_tax[array_key_last($shipping_cost_tax)]['values'][] = array(\n 'id' => \"tax_{$tax['id_tax']}\",\n 'value' => $tax['id_tax'],\n 'label' => $this->l($tax['name'])\n );\n }\n \n foreach ($this->getAvailablePaymentModules() as $payment_module) {\n $config_form['form']['input'][] = array(\n 'type' => 'text',\n 'name' => \"PROFITMARGIN_PAYMENT_FEE_BASE_{$payment_module['id_module']}\",\n 'label' => $this->l($payment_module['name']),\n 'desc' => $this->l('Base fee'),\n 'suffix' => '€', \n 'col' => 1,\n );\n $config_form['form']['input'][] = array(\n 'type' => 'text',\n 'name' => \"PROFITMARGIN_PAYMENT_FEE_PERCENTAGE_{$payment_module['id_module']}\",\n 'desc' => $this->l('Percentage fee'),\n 'suffix' => '%',\n 'col' => 1,\n );\n }\n\n return $config_form;\n }",
"function room_reservations_admin_settings_mobile_submit($form_id, &$form_state) {\n if ($form_state['clicked_button']['#value'] == t('Save configuration')) {\n $mobile_url = trim($form_state['values']['mobile_url']);\n $main_database = trim($form_state['values']['main_database']);\n $confirmation = ROOM_RESERVATIONS_SAVE_CONFIRMATION_MSG;\n $error = ROOM_RESERVATIONS_SAVE_ERROR_MSG;\n }\n elseif ($form_state['clicked_button']['#value'] == t('Reset to defaults')) {\n $mobile_url = '';\n $main_database = '';\n $confirmation = ROOM_RESERVATIONS_RESET_CONFIRMATION_MSG;\n $error = ROOM_RESERVATIONS_RESET_ERROR_MSG;\n }\n $errors = FALSE;\n $result = _room_reservations_set_variable('mobile_url', $mobile_url);\n if (!$result) {\n $errors = TRUE;\n }\n $result = _room_reservations_set_variable('main_database', $main_database);\n if (!$result) {\n $errors = TRUE;\n }\n if ($errors) {\n drupal_set_message(check_plain($error), 'error');\n }\n else {\n drupal_set_message(check_plain($confirmation));\n }\n}",
"public function addform()\n\t{\n\t\t\t$this->setMethod('post');\n\n\t\t\t\n\t\t\t$this->addElement('radio', 'status', array(\n\t\t\t\t'required' => true,\n\t\t\t\t'multiOptions' => array(\n\t\t\t\t\t'1' => IN_PROGRESS,\n\t\t\t\t\t'2' => 'Closed'\n\t\t\t\t\t\n\t\t\t\t),\n\t\t\t\t'value' => '1' //key of multiOption\n\t\t\t));\n\t\t\n\t\t\n\n\t\t\t$this->addElement('textarea', 'Comment', array( \n\t\t\t\t\t'required' => true,\n\t\t\t\t\t'maxlength' =>'50',\n\t\t\t\t\t\n\t\t\t\t\t'class' => 'validate[required] text-input',\n\t\t\t\t\t'decorators'=>Array(\n\t\t\t\t\t\t'ViewHelper','Errors'\n\t\t\t\t\t),\t\t \n\t\t\t));\n\n\t\t\t\n\n\t\t\t\n\n\n\t\n\t\t\t\t\n\t\t\t$this->addElement('submit', 'submit', array(\n\t\t\t\t\t'ignore' => true,\n\t\t\t\t\t'label' => 'Submit',\n\t\t\t));\n\t\t\t\n\t\t\t// And finally add some CSRF protection\n\t\t\t$this->addElement('hash', 'csrf', array(\n\t\t\t\t\t'ignore' => true,\n\t\t\t));\t\n\t}",
"function room_reservations_admin_settings_sms_add_validate($form_id, &$form_state) {\n if ($form_state['clicked_button']['#value'] == t('Add')) {\n $carrier = $form_state['values']['carrier'];\n $domain = $form_state['values']['domain'];\n if (!$carrier) {\n $field = 'add_carrier][carrier';\n $message = t('Wireless carrier is required.');\n form_set_error($field, check_plain($message));\n }\n if (!$domain) {\n $field = 'add_carrier][domain';\n $message = t('Domain name is required.');\n form_set_error($field, check_plain($message));\n }\n else {\n if (drupal_substr($domain, 0, 1) != '@') {\n $field = 'add_carrier][domain';\n $message = t('Domain name must begin with @.');\n form_set_error($field, check_plain($message));\n }\n }\n if (($carrier) && ($domain)) {\n $sql = \"\n SELECT value\n FROM {room_reservations_variables}\n WHERE name = '%s'\n \";\n $result = db_query($sql, 'carrier');\n if ($result) {\n while ($data = db_fetch_object($result)) {\n $values = explode('~', $data->value);\n if ($values[0] == $carrier) {\n $field = 'add_carrier][carrier';\n $message = t('There is already a record for this wireless\n carrier.');\n form_set_error($field, $message);\n break;\n }\n }\n }\n }\n }\n}",
"public function setForm() {\n\t\t$translator = Zend_Registry::get('Zend_Translate');\n\t\t$this->setMethod('post');\n\t\t \n\t\t$this->addEnabled();\n\t\t$this->addRentDueDay();\n\t\t$this->addProrationType();\n\t\t$this->addProrationApplyMonth();\n\t\t$this->addSecondMonthDue();\n\t\t$this->addSubmitButton();\n\n\t\t$this->addDisplayGroup( $this->displayGroupArray, 'updateRentProrationSetting',array('legend' => 'rentProrationSettings'));\n\t\t$this->getDisplayGroup('updateRentProrationSetting')->setDecorators(array(\n 'FormElements',\n 'Fieldset', \n\t\t));\n\t}",
"function urlConfigForm()\r\n\t{\r\n\t\t/*\tAdd the field for the back link configuration\t*/\r\n\t\tadd_settings_field('wpklikandpay_payment_success', __('Url de retour pour un paiement accepté', 'wpklikandpay'), array('wpklikandpay_option', 'urlSuccess'), 'wpklikandpayUrlConfig', 'backUrlConfig');\r\n\t\tadd_settings_field('wpklikandpay_payment_canceled', __('Url de retour pour un paiement annulé', 'wpklikandpay'), array('wpklikandpay_option', 'urlCanceled'), 'wpklikandpayUrlConfig', 'backUrlConfig');\r\n\t\tadd_settings_field('wpklikandpay_payment_declined', __('Url de retour pour un paiement refusé', 'wpklikandpay'), array('wpklikandpay_option', 'urlDeclined'), 'wpklikandpayUrlConfig', 'backUrlConfig');\r\n\t}",
"public function output_setup_form() {\n\t\t$related_api = Thrive_Dash_List_Manager::connection_instance( 'mandrill' );\n\t\tif ( $related_api->is_connected() ) {\n\t\t\t$credentials = $related_api->get_credentials();\n\t\t\t$this->set_param( 'email', $credentials['email'] );\n\t\t\t$this->set_param( 'mandrill-key', $credentials['key'] );\n\t\t}\n\n\t\t$this->output_controls_html( 'mailchimp' );\n\t}",
"function storeConfigForm()\r\n\t{\r\n\t\t/*\tAdd the field for the store configuration\t*/\r\n\t\tadd_settings_field('wpklikandpay_store_tpe', __('Numéro de TPE de la boutique', 'wpklikandpay'), array('wpklikandpay_option', 'storeTpe'), 'wpklikandpayStoreConfig', 'mainWKlikAndPayStoreConfig');\r\n\t\t// add_settings_field('wpklikandpay_store_rang', __('Numéro de rang de la boutique', 'wpklikandpay'), array('wpklikandpay_option', 'storeRang'), 'wpklikandpayStoreConfig', 'mainWKlikAndPayStoreConfig');\r\n\t\t// add_settings_field('wpklikandpay_store_id', __('Identifiant de la boutique', 'wpklikandpay'), array('wpklikandpay_option', 'storeIdentifier'), 'wpklikandpayStoreConfig', 'mainWKlikAndPayStoreConfig');\r\n\t\tadd_settings_field('wpklikandpay_environnement', __('Environnement de la boutique', 'wpklikandpay'), array('wpklikandpay_option', 'environnement'), 'wpklikandpayStoreConfig', 'mainWKlikAndPayStoreConfig');\r\n\t}",
"public function gateway_cc_form()\n {\n // register the action to remove default CC form\n return;\n }",
"public function addform()\n\t{\n\t\t\t$this->setMethod('get');\n\n\t\t\t//echo \"<pre>\";\n\t\t\t//print_r($_GET);\n\t\t\t//echo \"</pre>\";\n\t\t\t$this->addElement('radio', 'Status', array(\n\t\t\t\t'required' => true,\n 'separator' => ' ',\n\t\t\t\t'multiOptions' => array(\n\t\t\t\t\t'1' => IN_PROGRESS,\n\t\t\t\t\t'2' => 'Closed'\n\t\t\t\t\t\n\t\t\t\t),\n\t\t\t\t\t'separator' => '',\n\t\t\t\t'value' => '1' //key of multiOption\n\t\t\t));\n\n\t\t\n\t\t\n\t\t$this->addElement ( \n 'multiCheckbox', 'Functional_type', \n array (\n \n\t\t//'setrequired' => true,\n 'multiOptions' => array(\n '1' => 'Pre Installation',\n '2' => 'Installation',\n '3' => 'Post Installation'\n \n ),\n 'separator' => '',\n\t\t\t\t\t//'value' => '2' // select these 2 values\n )\n);\n\t\n\t\t\t\t\n\t\t\t$this->addElement('submit', 'submit', array(\n\t\t\t\t\t'ignore' => true,\n\t\t\t\t\t'label' => 'Submit',\n\t\t\t));\n\t\t\t\n\t\t\t// And finally add some CSRF protection\n\t\t\t$this->addElement('hash', 'csrf', array(\n\t\t\t\t\t'ignore' => true,\n\t\t\t));\t\n\t}",
"public function form()\n {\n\n $this->display('id', '申请ID')->default($this->payload['id']);\n $this->display('uid', '申请人UID')->default($this->payload['uid']);\n $this->display('status', '状态')->default(\\App\\Admin\\Repositories\\BusinessApply::$statusLabel[$this->payload['status']]);\n\n\n $this->radio('process', '处理')\n ->options([\n 1 => '通过',\n 2 => '拒绝',\n ]);\n\n $this->text('msg', '审核回复');\n\n }",
"function erpal_contract_helper_config_form($form, $form_state) {\n $form = array();\n \n $form['cancelation_precalculate_range'] = array(\n '#type' => 'textfield',\n '#title' => t('Precalculation range contract duration'),\n '#description' => t('Number of month the date items for contract calculation are precalculated.'),\n '#default_value' => _erpal_contract_helper_cancelation_precalculate_range(),\n ); \n \n $form['submit'] = array(\n '#value' => t('save'),\n '#type' => 'submit',\n '#submit' => array('_erpal_contract_helper_config_form_submit'),\n );\n\n return $form;\n}",
"private function getConfigurationForm()\n {\n $form = array(\n 'form' => array(\n 'id_form' => 'module_config',\n 'legend' => array(\n 'title' => $this->l('Configuration'),\n 'icon' => 'icon-cogs'\n ),\n 'input' => array(\n array(\n 'label' => $this->l('Enable/Disable'),\n 'type' => 'switch',\n 'name' => 'kbpushnotification[enable]',\n 'values' => array(\n array(\n 'value' => 1,\n ),\n array(\n 'value' => 0,\n ),\n ),\n 'hint' => $this->l('Enable/Disable the plugin')\n ),\n array(\n 'label' => $this->l('Enable/Disable Order Status Update'),\n 'type' => 'switch',\n 'name' => 'kbpushnotification[enable_order_status]',\n 'values' => array(\n array(\n 'value' => 1,\n ),\n array(\n 'value' => 0,\n ),\n ),\n 'hint' => $this->l('Enable/Disable the order status update')\n ),\n array(\n 'label' => $this->l('Enable/Disable Abandoned Cart alert'),\n 'type' => 'switch',\n 'name' => 'kbpushnotification[enable_abandoned_cart]',\n 'values' => array(\n array(\n 'value' => 1,\n ),\n array(\n 'value' => 0,\n ),\n ),\n 'hint' => $this->l('Enable/Disable the abandoned cart alert')\n ),\n array(\n 'label' => $this->l('Enable/Disable Product Price alert'),\n 'type' => 'switch',\n 'name' => 'kbpushnotification[enable_product_price_alert]',\n 'values' => array(\n array(\n 'value' => 1,\n ),\n array(\n 'value' => 0,\n ),\n ),\n 'hint' => $this->l('Enable/Disable the product price alert')\n ),\n array(\n 'label' => $this->l('Enable/Disable Product back in stock alert'),\n 'type' => 'switch',\n 'name' => 'kbpushnotification[enable_product_stock_alert]',\n 'values' => array(\n array(\n 'value' => 1,\n ),\n array(\n 'value' => 0,\n ),\n ),\n 'hint' => $this->l('Enable/Disable the product back in stock alert')\n ),\n ),\n 'submit' => array(\n 'title' => $this->l('Save'),\n 'class' => 'btn btn-default pull-right kbph_general_btn'\n ),\n ),\n );\n return $form;\n }",
"public function addform()\n {\n \n //$this->session_manager->validateFashion(__METHOD__);\n \n $data['cate'] = $this->promo->promoSliderOptionCuisine($by_id=null,$platform=1);\n $data['promo_duration'] = $this->promo->promoDurationOption();\n $data['admin_info'] = $this->promo->adminInfo();\n \n $data['title_type']= 'New Promo Form';\n $data ['content_file']= 'promo_new';\n $data['pageheader'] = \"Add Promo\";\n $data['breadCrumbs'] = '<li class=\"breadcrumb-item\"><a href=\"'.site_url(\"jollofadmin/promos\").'\">Promos</a></li> <li class=\"breadcrumb-item active\">Add Promo</li>';\n $data['mainmenu'] = \"promos\";\n $this->load->view('jollof_admin/layout', $data);\n }",
"function room_reservations_admin_settings_page_submit($form_id, &$form_state) {\n if ($form_state['clicked_button']['#value'] == t('Save configuration')) {\n $calendar_text = $form_state['values']['calendar_text'];\n $reserve_room_instructions_text\n = $form_state['values']['reserve_instructions_text'];\n $reserve_form_instructions_text\n = $form_state['values']['form_instructions_text'];\n $policies = $form_state['values']['policies'];\n $confirmation = ROOM_RESERVATIONS_SAVE_CONFIRMATION_MSG;\n $error = ROOM_RESERVATIONS_SAVE_ERROR_MSG;\n }\n elseif ($form_state['clicked_button']['#value'] == t('Reset to defaults')) {\n $calendar_text = '';\n $reserve_room_instructions_text = '';\n $reserve_form_instructions_text = '';\n $policies = '';\n $confirmation = ROOM_RESERVATIONS_RESET_CONFIRMATION_MSG;\n $error = ROOM_RESERVATIONS_RESET_ERROR_MSG;\n }\n $errors = FALSE;\n $result = _room_reservations_set_variable('calendar_text', $calendar_text);\n if (!$result) {\n $errors = TRUE;\n }\n $result = _room_reservations_set_variable('reserve_instructions', \n $reserve_room_instructions_text);\n if (!$result) {\n $errors = TRUE;\n }\n $result = _room_reservations_set_variable('reserve_form_instructions', \n $reserve_form_instructions_text);\n if (!$result) {\n $errors = TRUE;\n }\n $result = _room_reservations_set_variable('policies', $policies);\n if (!$result) {\n $errors = TRUE;\n }\n if ($errors) {\n drupal_set_message(check_plain($error), 'error');\n }\n else {\n drupal_set_message(check_plain($confirmation));\n }\n}",
"function renderConfigForm() {\n\t}",
"function mci_twilio_admin_form($form, &$form_state) {\n $form['mci_twilio_account'] = array(\n '#type' => 'textfield',\n '#required' => TRUE,\n '#title' => t('Twilio Account SID'),\n '#default_value' => variable_get('mci_twilio_account'),\n '#description' => t('Enter your Twilio account id'),\n );\n $form['mci_twilio_token'] = array(\n '#type' => 'textfield',\n '#required' => TRUE,\n '#title' => t('Twilio Auth Token'),\n '#default_value' => variable_get('mci_twilio_token'),\n '#description' => t('Enter your Twilio token id'),\n );\n $form['mci_twilio_number'] = array(\n '#type' => 'textfield',\n '#required' => TRUE,\n '#title' => t('Twilio Phone Number'),\n '#default_value' => variable_get('mci_twilio_number'),\n '#description' => t('Enter your Twilio phone number'),\n );\n\n $form['mci_twilio_country_codes_container'] = array(\n '#type' => 'fieldset',\n '#title' => t('Country codes'),\n '#description' => t('Select the country codes you would like available, If none are selected all will be available.'),\n '#collapsible' => TRUE,\n '#collapsed' => TRUE,\n );\n\n $form['mci_twilio_country_codes_container']['twilio_country_codes'] = array(\n '#type' => 'checkboxes',\n '#options' => mci_twilio_country_codes(TRUE),\n '#default_value' => variable_get('mci_twilio_country_codes', array()),\n );\n\n return system_settings_form($form);\n}",
"function onlinepdf_service_configuration_form() {\n $form = array();\n\n $form['onlinepdf_winserver'] = array (\n '#type' => 'fieldset',\n '#title' => t('Windows slave server SSH settings'),\n );\n $form['onlinepdf_winserver']['onlinepdf_winserver_ip'] = array(\n '#type' => 'textfield',\n '#title' => t('IP address remote worker'),\n '#field_suffix' => t('Ip_v4 address'),\n '#required' => true,\n '#default_value' => variable_get('onlinepdf_winserver_ip'),\n '#description' => t('SSH ip_v4 address'),\n );\n $form['onlinepdf_winserver']['onlinepdf_winserver_user'] = array(\n '#type' => 'textfield',\n '#title' => t('Username SSH access'),\n '#required' => true,\n '#default_value' => variable_get('onlinepdf_winserver_user'),\n '#description' => t('Credentials WinSSH remote worker'),\n );\n $form['onlinepdf_winserver']['onlinepdf_winserver_password'] = array(\n '#type' => 'password',\n '#title' => t('Password SSH access'),\n '#required' => true,\n '#default_value' => variable_get('onlinepdf_winserver_password'),\n '#description' => t('Credentials WinSSH remote worker'),\n );\n $form['onlinepdf_conversion_limits'] = array (\n '#type' => 'fieldset',\n '#title' => t('Onlinepdf conversion limits'),\n );\n $form['onlinepdf_conversion_limits']['onlinepdf_max_jpg_resolution'] = array(\n '#type' => 'textfield',\n '#title' => t('Max. JPG resolution'),\n '#field_suffix' => t('Megapixels'),\n '#required' => true,\n '#default_value' => variable_get('onlinepdf_max_jpg_resolution'),\n '#description' => t('Max JPG resolution created in conversion.'),\n );\n $form['onlinepdf_conversion_limits']['onlinepdf_max_age'] = array(\n '#type' => 'textfield',\n '#title' => t('Max. age'),\n '#field_suffix' => t('seconds'),\n '#required' => true,\n '#default_value' => variable_get('onlinepdf_max_age', 3200),\n '#description' => t('The age in seconds before anonymous data and temp files are deleted.'),\n );\n $form['onlinepdf_conversion_limits']['onlinepdf_max_load'] = array(\n '#type' => 'textfield',\n '#title' => t('Max. system load'),\n '#field_suffix' => t('seconds'),\n '#required' => true,\n '#default_value' => variable_get('onlinepdf_max_load', 8),\n '#description' => t('Maximum system load to allow system operations.'),\n );\n $form['onlinepdf_conversion_limits']['onlinepdf_max_5min_load'] = array(\n '#type' => 'textfield',\n '#title' => t('Max. system load'),\n '#field_suffix' => t('seconds'),\n '#required' => true,\n '#default_value' => variable_get('onlinepdf_max_5min_load', 16),\n '#description' => t('Maximum 5 minute avg system load to allow system operations.'),\n );\n\n return system_settings_form($form);\n}",
"function wpsc_merchant_paymentsense_settings_form_submit() {\r\n\treturn wpsc_merchant_paymentsense::submit_paymentsense_settings_form();\r\n}",
"function courier_connector_queue_form($form, &$form_state) {\n\n $form['courier-requests'] = array('#type' => 'vertical_tabs');\n\n $form['current_requests'] = array(\n '#type' => 'fieldset',\n '#title' => t('Current Requests'),\n '#group' => 'courier-requests',\n '#weight' => -2,\n '#theme' => 'courier_connector_request_table',\n '#tree' => TRUE,\n );\n\n $result = db_query(\"select * from courier_requests where processed != 1\");\n\n foreach ($result as $row) {\n $form['current_requests']['job_date'][$row->job_id] = array('#markup' => check_plain($row->job_date));\n\n $form['current_requests']['job_id'][$row->job_id] = array('#markup' => \"{$row->job_id}\");\n $form['current_requests']['request_method'][$row->job_id] = array('#markup' => \"{$row->request_method}\");\n\n $request_data = var_export(unserialize($row->request_data), TRUE);\n\n $form['current_requests']['request_data'][$row->job_id] = array('#markup' => \"{$request_data}\");\n\n $form['current_requests']['remove_job'][$row->job_id] = array(\n '#type' => 'button',\n //'#default_value' => ($row->qb_field == \"Custom\" ? $row->custom_value : ''),\n '#value' => \"Remove\"\n );\n }\n\n $form['submit_read_request'] = array(\n '#type' => 'fieldset',\n '#title' => t('Submit Read Request'),\n '#group' => 'courier-requests',\n '#weight' => -1,\n );\n\n// $form['submit_request']['request_type'] = array(\n// '#type' => 'select',\n// '#title' => t('Request Type'),\n// '#default_value' => t('read'),\n// '#options' => array(\"read\" => \"Read Request\", \"write\" => \"Write Request\"), \n// ); \n\n $form['submit_read_request']['request_method'] = array(\n '#type' => 'select',\n '#title' => t('Request Method'),\n '#default_value' => t('AssemblyItem'),\n '#options' => array(\n \"AssemblyItem\" => \"Assembly Item Request\",\n \"Customer\" => \"Customer Request\",\n \"DiscountItem\" => \"Discount Item Request\",\n \"ItemInventory\" => \"Inventory Item Request\",\n \"Invoice\" => \"Invoice Request\",\n \"NonInventoryItem\" => \"Non Inventory Item Request\",\n \"PurchaseOrder\" => \"Purchase Order Request\",\n \"ReceivePayment\" => \"Receive Payment Request\",\n \"SalesOrder\" => \"Sales Order Request\",\n \"SalesReceipt\" => \"Sales Receipt Request\",\n \"ServiceItem\" => \"Service Item Request\",\n ),\n );\n\n $form['submit_read_request']['from_date'] = array(\n '#type' => 'textfield',\n '#title' => t('From Time Modified'),\n '#default_value' => t('1/1/2001'),\n '#size' => 20,\n '#description' => t('Format the date as 1/1/2001 HH:MM:SS or just 1/1/2001'),\n );\n\n// $form['submit_read_request']['to_date'] = array(\n// '#type' => 'textfield',\n// '#title' => t('To Time Modified'),\n// '#default_value' => t(''), \n// '#size' => 20,\n// '#description' => t('Format the date as 1/1/2001 HH:MM:SS or just 1/1/2001'),\n// ); \n\n// $form['submit_read_request']['active'] = array(\n// '#type' => 'select',\n// '#title' => t('Active Status'),\n// '#default_value' => t(''),\n// '#options' => array(\"\" => \"Any\",\n// \"true\" => \"Active Only\",\n// \"false\" => \"Deactive Only\", \n// ), \n// ); \n\n $form['submit_read_request']['ids'] = array(\n '#type' => 'textfield',\n '#title' => t('Specific ID'),\n '#default_value' => t(''),\n '#size' => 100,\n '#description' => t('Specific Item ID to Request'),\n );\n\n $form['submit_read_request']['desc1'] = array(\n '#type' => 'textfield',\n '#title' => t('Description 1'),\n '#default_value' => t(''),\n '#size' => 100,\n '#description' => t('The description 1 value of the item'),\n );\n\n $form['submit_read_request']['submit'] = array(\n '#type' => 'submit',\n '#value' => t('Submit Request to Queue'),\n );\n\n $form['submit_write_order_request'] = array(\n '#type' => 'fieldset',\n '#title' => t('Submit Write Order Request'),\n '#group' => 'courier-requests',\n '#weight' => 0,\n );\n\n $form['submit_write_order_request']['order_type'] = array(\n '#type' => 'select',\n '#title' => t('Order Type'),\n '#default_value' => t('SalesReceipt'),\n '#options' => array(\n \"Invoice\" => \"Invoice\",\n \"PurchaseOrder\" => \"Purchase Order\",\n \"SalesOrder\" => \"Sales Order\",\n \"SalesReceipt\" => \"Sales Receipt\",\n ),\n );\n\n $form['submit_write_order_request']['orders'] = array(\n '#type' => 'fieldset',\n '#group' => 'submit_write_order_request',\n '#title' => t('Select Order(s) to Download'),\n '#theme' => 'courier_connector_order_table',\n '#tree' => TRUE,\n );\n\n //$result = db_query(\"select order_id, order_total, created, order_status, concat(billing_first_name, ' ', billing_last_name) as customer from uc_orders\");\n\n// $d = array();\n//\n// foreach ($result as $row) \n// { \n// $form['submit_write_order_request']['orders']['add'][$row->order_id] = array( \n// '#type' => 'checkbox', \n// );\n// $form['submit_write_order_request']['orders']['order_id'][$row->order_id] = array('#markup' => check_plain($row->order_id));\n// $form['submit_write_order_request']['orders']['customer'][$row->order_id] = array('#markup' => check_plain($row->customer)); \n// $form['submit_write_order_request']['orders']['total'][$row->order_id] = array('#markup' => check_plain($row->order_total));\n// $form['submit_write_order_request']['orders']['purchase_date'][$row->order_id] = array('#markup' => check_plain(gmdate(\"M d Y H:i:s\", $row->created)));\n// $form['submit_write_order_request']['orders']['status'][$row->order_id] = array('#markup' => check_plain($row->order_status));\n// }\n\n $form['submit_write_order_request']['submit'] = array(\n '#type' => 'submit',\n '#value' => t('Submit Request to Queue'),\n );\n\n $form['submit_write_payment_request'] = array(\n '#type' => 'fieldset',\n '#title' => t('Submit Payment Request'),\n '#group' => 'courier-requests',\n '#weight' => 1,\n );\n\n $form['submit_write_payment_request']['submit'] = array(\n '#type' => 'submit',\n '#value' => t('Submit Request to Queue'),\n );\n\n $form['submit_write_product_request'] = array(\n '#type' => 'fieldset',\n '#title' => t('Submit Write Product Request'),\n '#group' => 'courier-requests',\n '#weight' => 2,\n );\n\n $form['submit_write_product_request']['product_type'] = array(\n '#type' => 'select',\n '#title' => t('Product Type'),\n '#default_value' => t('SalesReceipt'),\n '#options' => array(\n \"AssemblyItem\" => \"Assembly Item Request\",\n \"DiscountItem\" => \"Discount Item Request\",\n \"InventoryItem\" => \"Inventory Item Request\",\n \"NonInventoryItem\" => \"Non Inventory Item Request\",\n \"ServiceItem\" => \"Service Item Request\",\n ),\n );\n\n $form['submit_write_product_request']['products'] = array(\n '#type' => 'fieldset',\n '#group' => 'submit_write_product_request',\n '#title' => t('Select Products(s) to Download'),\n '#theme' => 'courier_connector_product_table',\n '#tree' => TRUE,\n );\n\n// $result = db_query(\"select uc_products.nid, title, `sell_price`, `model` from uc_products inner join node on node.nid = uc_products.nid\");\n//\n// $d = array();\n//\n// foreach ($result as $row) \n// { \n// $form['submit_write_product_request']['products']['add'][$row->nid] = array( \n// '#type' => 'checkbox', \n// );\n// $form['submit_write_product_request']['products']['nid'][$row->nid] = array('#markup' => check_plain($row->nid));\n// $form['submit_write_product_request']['products']['title'][$row->nid] = array('#markup' => check_plain($row->title)); \n// $form['submit_write_product_request']['products']['sell_price'][$row->nid] = array('#markup' => check_plain($row->sell_price));\n// $form['submit_write_product_request']['products']['model'][$row->nid] = array('#markup' => check_plain($row->model)); \n// }\n\n $form['submit_write_product_request']['submit'] = array(\n '#type' => 'submit',\n '#value' => t('Submit Request to Queue'),\n );\n\n $form['submit_write_customer_request'] = array(\n '#type' => 'fieldset',\n '#title' => t('Submit Write Customer Request'),\n '#group' => 'courier-requests',\n '#weight' => 3,\n );\n\n $form['submit_write_customer_request']['customers'] = array(\n '#type' => 'fieldset',\n '#group' => 'submit_write_customer_request',\n '#title' => t('Select Customer(s) to Download'),\n '#theme' => 'courier_connector_customer_table',\n '#tree' => TRUE,\n );\n\n// $result = db_query(\"select distinct users.uid, concat(uc_orders.billing_first_name, ' ', uc_orders.billing_last_name) as name, mail, concat(billing_city, ', ', uc_zones.zone_name) as location from users inner join uc_orders on uc_orders.uid = users.uid inner join uc_zones on uc_orders.billing_zone = uc_zones.zone_id\");\n//\n// $d = array();\n//\n// foreach ($result as $row) \n// { \n// $form['submit_write_customer_request']['customers']['add'][$row->uid] = array( \n// '#type' => 'checkbox', \n// );\n// $form['submit_write_customer_request']['customers']['uid'][$row->uid] = array('#markup' => check_plain($row->uid));\n// $form['submit_write_customer_request']['customers']['name'][$row->uid] = array('#markup' => check_plain($row->name)); \n// $form['submit_write_customer_request']['customers']['email'][$row->uid] = array('#markup' => check_plain($row->mail));\n// $form['submit_write_customer_request']['customers']['location'][$row->uid] = array('#markup' => check_plain($row->location)); \n// }\n\n $form['submit_write_customer_request']['submit'] = array(\n '#type' => 'submit',\n '#value' => t('Submit Request to Queue'),\n );\n\n //$form['#validate'][] = 'courier_connector_queue_validate';\n\n return $form;\n}",
"function submitAddStok()\n\t{\n\t\t# code...\n\t}",
"function room_reservations_admin_settings_email_submit($form_id, &$form_state) {\n if ($form_state['clicked_button']['#value'] == t('Save configuration')) {\n $from_address = $form_state['values']['from_address'];\n $confirmation_header = $form_state['values']['confirmation_header'];\n $confirmation_owner = $form_state['values']['confirmation_owner'];\n $confirmation_group = $form_state['values']['confirmation_group'];\n $reminder_header = $form_state['values']['reminder_header'];\n $reminder_owner = $form_state['values']['reminder_owner'];\n $reminder_group = $form_state['values']['reminder_group'];\n $confirmation = ROOM_RESERVATIONS_SAVE_CONFIRMATION_MSG;\n $error = ROOM_RESERVATIONS_SAVE_ERROR_MSG;\n }\n elseif ($form_state['clicked_button']['#value'] == t('Reset to defaults')) {\n $confirmation_header = '';\n $confirmation_owner = '';\n $confirmation_group = '';\n $reminder_header = '';\n $reminder_owner = '';\n $reminder_group = '';\n $confirmation = ROOM_RESERVATIONS_RESET_CONFIRMATION_MSG;\n $error = ROOM_RESERVATIONS_RESET_ERROR_MSG;\n }\n $errors = FALSE;\n $result = _room_reservations_set_variable('from_address', $from_address);\n if (!$result) {\n $errors = TRUE;\n }\n $result = _room_reservations_set_variable('confirmation_header_text', \n $confirmation_header);\n if (!$result) {\n $errors = TRUE;\n }\n $result = _room_reservations_set_variable('confirmation_owner_text', \n $confirmation_owner);\n if (!$result) {\n $errors = TRUE;\n }\n $result = _room_reservations_set_variable('confirmation_group_text', \n $confirmation_group);\n if (!$result) {\n $errors = TRUE;\n }\n $result = _room_reservations_set_variable('reminder_header_text', \n $reminder_header);\n if (!$result) {\n $errors = TRUE;\n }\n $result = _room_reservations_set_variable('reminder_owner_text', \n $reminder_owner);\n if (!$result) {\n $errors = TRUE;\n }\n $result = _room_reservations_set_variable('reminder_group_text', \n $reminder_group);\n if (!$result) {\n $errors = TRUE;\n }\n if ($errors) {\n drupal_set_message(check_plain($error), 'error');\n }\n else {\n drupal_set_message(check_plain($confirmation));\n }\n}"
] |
[
"0.6963039",
"0.663598",
"0.6265679",
"0.62319535",
"0.61673295",
"0.61438924",
"0.6070579",
"0.604068",
"0.6024329",
"0.60132444",
"0.6000514",
"0.59759516",
"0.5956805",
"0.5928736",
"0.5911134",
"0.59052044",
"0.5890388",
"0.5889947",
"0.5865547",
"0.585302",
"0.58454806",
"0.5807047",
"0.5804619",
"0.5747031",
"0.5740804",
"0.5734242",
"0.57304126",
"0.56962377",
"0.56886435",
"0.5677886"
] |
0.6985407
|
0
|
Form constructor for the SMS / Delete Network configuration page.
|
function room_reservations_admin_settings_sms_delete($form, &$form_state) {
$sql = "
SELECT id, value
FROM {room_reservations_variables}
WHERE name = '%s'
ORDER BY value
";
$result = db_query($sql, 'carrier');
if ($result) {
$options = array();
$options[strval(0)] = t('Select a wireless carrier');
$x = 0;
while ($data = db_fetch_object($result)) {
$x++;
$id = $data->id;
$values = explode('~', $data->value);
$options[strval($id)] = $values[0];
$x++;
}
}
if ($options) {
$form['carrier'] = array(
'#type' => 'select',
'#title' => t('Wireless carrier'),
'#options' => $options,
'#weight' => 25,
);
$form['delete'] = array(
'#type' => 'submit',
'#value' => t('Delete'),
'#weight' => 30,
);
}
return $form;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function __construct(Temboo_Session $session)\n {\n parent::__construct($session, '/Library/Google/ComputeEngine/Networks/DeleteNetwork/');\n }",
"public function __construct() {\n\t\t\t$this->field_type = 'select-edit-delete';\n\n\t\t\tparent::__construct();\n\t\t}",
"public function deleteForm()\n\t{\n\t\t$form = new \\IPS\\Helpers\\Form( 'form', 'delete' );\n\t\t$form->addMessage( 'node_delete_blurb_no_content' );\n\t\t\n\t\treturn $form;\n\t}",
"public function __construct() {\n\t\tparent::__construct( true, 'wpsimplesmtp_smtp_ms', 'wpsimplesmtp_ms_adminaccess_section' );\n\n\t\tadd_action( 'network_admin_menu', [ &$this, 'add_network_menu' ] );\n\t\tadd_action( 'admin_init', [ &$this, 'network_settings_init' ] );\n\t\tadd_action( 'network_admin_edit_wpsimplesmtpms', [ &$this, 'update_network_settings' ] );\n\n\t\t$this->options = new Options();\n\t}",
"public function __construct()\n {\n parent::__construct(array(\n 'name' => __('WS Form', 'ws-form'),\n 'description' => __('Add a form.', 'ws-form'),\n 'category'\t\t=> __('Basic', 'ws-form'),\n 'dir' => FL_WS_FORM_DIR . 'modules/ws-form/',\n 'url' => FL_WS_FORM_URL . 'modules/ws-form/',\n 'editor_export' => true, // Defaults to true and can be omitted.\n 'enabled' => true, // Defaults to true and can be omitted.\n 'icon' => 'icon.svg'\n ));\n }",
"public function __construct()\n {\n $this->name = 'payneteasy';\n $this->tab = 'payments_gateways';\n $this->version = '1.0.0';\n $this->author = 'Artem Ponomarenko';\n $this->currencies_mode = 'radio';\n $this->submit_action = 'submit_' . $this->name;\n\n parent::__construct();\n\n $this->displayName = $this->l('PaynetEasy payment form');\n $this->description = $this->l('Accepts payments by credit cards with PaynetEasy payment form.');\n $this->confirmUninstall = $this->l('Are you sure you want to uninstall?');\n }",
"function room_reservations_admin_settings_sms_delete_submit($form_id, &$form_state) {\n if ($form_state['clicked_button']['#value'] == t('Delete')) {\n $carrier = $form_state['values']['carrier'];\n $sql = \"\n DELETE FROM {room_reservations_variables}\n WHERE ID = %d\n \";\n $result = db_query($sql, $carrier);\n if (!$result) {\n drupal_set_message(t('The wireless carrier could not be deleted.'), \n 'error');\n }\n else {\n drupal_set_message(t('The wireless carrier has been deleted.'));\n }\n }\n}",
"private function _initGeneralSettingsForm()\n\t{\n\t\tglobal $txt, $context;\n\n\t\t// Instantiate the form\n\t\t$this->_generalSettingsForm = new Settings_Form(Settings_Form::DB_ADAPTER);\n\n\t\t$config_vars = array(\n\t\t\tarray('select', 'sp_portal_mode', explode('|', $txt['sp_portal_mode_options'])),\n\t\t\tarray('check', 'sp_maintenance'),\n\t\t\tarray('text', 'sp_standalone_url'),\n\t\t\t'',\n\t\t\tarray('select', 'portaltheme', $context['SPortal']['themes']),\n\t\t\tarray('check', 'sp_disableColor'),\n\t\t\tarray('check', 'sp_disableForumRedirect'),\n\t\t\tarray('check', 'sp_disable_random_bullets'),\n\t\t\tarray('check', 'sp_disable_php_validation', 'subtext' => $txt['sp_disable_php_validation_desc']),\n\t\t\tarray('check', 'sp_disable_side_collapse'),\n\t\t\tarray('check', 'sp_resize_images'),\n\t\t\tarray('check', 'sp_disableMobile'),\n\t\t);\n\n\t\t$this->_generalSettingsForm->setConfigVars($config_vars);\n\t}",
"function buildSettingsForm() {}",
"function room_reservations_admin_settings_sms_delete_validate($form_id, &$form_state) {\n if ($form_state['clicked_button']['#value'] == t('Delete')) {\n $carrier = $form_state['values']['carrier'];\n if (!$carrier) {\n $field = 'delete_carrier][carrier';\n $message = t('Wireless carrier is required.');\n form_set_error($field, check_plain($message));\n }\n }\n}",
"public function __construct()\n {\n if (!$this->_addButtonLabel) {\n $this->_addButtonLabel = Mage::helper('adminhtml')->__('Add');\n }\n parent::__construct();\n if (!$this->getTemplate()) {\n $this->setTemplate('hipay/system/config/form/field/rules.phtml');\n }\n }",
"protected function createComponentConfigMqttForm() {\n\t\t$this->onlyForAdmins();\n\t\treturn $this->formFactory->create($this);\n\t}",
"public static function menuConnection() {\n ?>\n <div class=\"wrap\">\n <h1><?php echo __(\"Neo4j Connection Settings\", 'neopress'); ?></h1>\n <form method=\"post\" action=\"options.php\">\n <?php\n // This prints out all hidden setting fields\n settings_fields( 'neopress_connection' );\n do_settings_sections( 'neopress' );\n submit_button();\n ?>\n </form>\n </div>\n <?php\n }",
"public function buildForm(array $form, FormStateInterface $form_state, $config_name = NULL) {\n if (empty($config_name)) {\n $url = Url::fromRoute('domain_config_ui.list');\n return new RedirectResponse($url->toString());\n }\n\n $elements = DomainConfigUIController::deriveElements($config_name);\n $config = \\Drupal::configFactory()->get($config_name)->getRawData();\n\n $form['help'] = [\n '#type' => 'item',\n '#title' => Html::escape($config_name),\n '#markup' => $this->t('Are you sure you want to delete the configuration\n override: %config_name?', ['%config_name' => $config_name]),\n '#prefix' => '<p>',\n '#suffix' => '</p>',\n ];\n if ($elements['language'] == $this->t('all')->render()) {\n $language = $this->t('all languages');\n }\n else {\n $language = $this->t('the @language language.', ['@language' => $elements['language']]);\n }\n $form['more_help'] = [\n '#markup' => $this->t('This configuration is for the %domain domain and\n applies to %language.', [\n '%domain' => $elements['domain'],\n '%language' => $language,\n ]\n ),\n '#prefix' => '<p>',\n '#suffix' => '</p>',\n ];\n $form['review'] = [\n '#type' => 'details',\n '#title' => $this->t('Review settings'),\n '#open' => FALSE,\n ];\n $form['review']['text'] = [\n '#markup' => DomainConfigUIController::printArray($config),\n ];\n $form['config_name'] = ['#type' => 'value', '#value' => $config_name];\n $form['actions']['#type'] = 'actions';\n $form['actions']['submit'] = [\n '#type' => 'submit',\n '#value' => $this->t('Delete configuration'),\n '#button_type' => 'primary',\n ];\n $form['actions']['cancel'] = [\n '#type' => 'link',\n '#title' => $this->t('Cancel'),\n '#url' => new Url('domain_config_ui.list'),\n '#attributes' => [\n 'class' => [\n 'button',\n ],\n ],\n ];\n return $form;\n }",
"function form_init_elements()\r\n {\r\n $this->setPurgeLabel('Purge Results Queue') ;\r\n $this->setPurgeMessage('Purging the Queue will delete all records\r\n currently stored in the Results Queue. This action cannot be\r\n reversed. Make sure all data has been saved appropriately prior\r\n to performing this action') ;\r\n\r\n parent::form_init_elements() ;\r\n }",
"public function __construct()\n {\n parent::__construct('ServicioForm');\n $this->setAttribute('method', 'post');\n \n $this->add(array(\n 'name' => 'servicio_nombre',\n 'type' => 'Text',\n 'options' => array(\n 'label' => 'Nombre',\n ),\n ));\n $this->add(array(\n 'name' => 'servicio_descripcion',\n 'type' => 'textarea',\n 'options' => array(\n 'label' => 'Descripcion',\n ),\n ));\n \n $this->add(array(\n 'name' => 'servicio_costo',\n 'type' => 'Text',\n 'options' => array(\n 'label' => 'Costo',\n ),\n ));\n \n $this->add(array(\n 'name' => 'servicio_precio',\n 'type' => 'Text',\n 'options' => array(\n 'label' => 'Precio',\n ),\n ));\n \n $this->add(array(\n 'name' => 'servicio_iva',\n 'type' => 'Text',\n 'options' => array(\n 'label' => 'IVA',\n ),\n ));\n \n\n\n }",
"public function initConfigurationForm()\n\t{\n\t\tglobal $lng, $ilCtrl;\n\t\t\n\t\t$pl = $this->getPluginObject();\n\t\n\t\tinclude_once(\"Services/Form/classes/class.ilPropertyFormGUI.php\");\n\t\t$form = new ilPropertyFormGUI();\n\t\n\t\t// setting 1 (a checkbox)\n\t\t$cb = new ilCheckboxInputGUI($pl->txt(\"setting_1\"), \"setting_1\");\n\t\t$form->addItem($cb);\n\t\t\n\t\t// setting 2 (text)\n\t\t$ti = new ilTextInputGUI($pl->txt(\"setting_2\"), \"setting_2\");\n\t\t$ti->setRequired(true);\n\t\t$ti->setMaxLength(10);\n\t\t$ti->setSize(10);\n\t\t$form->addItem($ti);\n\t\n\t\t$form->addCommandButton(\"save\", $lng->txt(\"save\"));\n\t \n\t\t$form->setTitle($pl->txt(\"example_plugin_configuration\"));\n\t\t$form->setFormAction($ilCtrl->getFormAction($this));\n\t\t\n\t\treturn $form;\n\t}",
"public function gateway_cc_form()\n {\n // register the action to remove default CC form\n return;\n }",
"protected function createComponentDeleteForm()\r\n\t{\r\n\t\t$form = new Form;\r\n\t\t$form->addSubmit('delete', 'Smazat')->setAttribute('class', 'default');\r\n\t\t$form->addSubmit('cancel', 'Storno');\r\n\t\t$form->onSuccess[] = callback($this, 'deleteFormSubmitted');\r\n\t\t$form->addProtection(self::MESS_PROTECT);\r\n\t\treturn $form;\r\n\t}",
"public function __construct(Temboo_Session $session, Google_ComputeEngine_Networks_DeleteNetwork $choreo, $inputs = array(), $async = false, $store_results = true)\n {\n parent::__construct($session, $choreo, $inputs, $async, $store_results);\n }",
"protected function _construct()\r\n {\r\n parent::_construct();\r\n $this->_controller = 'adminhtml_config_cms_page';\r\n $this->_blockGroup = 'TransPerfect_GlobalLink';\r\n $this->_headerText = __('CMS Page Configuration');\r\n }",
"private function createDeleteForm(Socialnetwork $socialnetwork)\n {\n return $this->createFormBuilder()\n ->setAction($this->generateUrl('admin_socialnetwork_delete', array('id' => $socialnetwork->getId())))\n ->setMethod('DELETE')\n ->getForm()\n ;\n }",
"public function getForm()\n {\n return new NumberDisplayConfigurationForm();\n }",
"public function __construct()\n {\n parent::__construct();\n\n/*------------------------------------------------------------------------------\n * Carrega configurações\n *------------------------------------------------------------------------------*/\n $fer = new TFerramentas(); //Ferramentas diversas\n $sicad = new TSicadDados(); //Ferramentas SICAD\n $profile = TSession::getValue('profile'); //Profile da Conta do usuário\n if (!$this->nivel_sistema || $this->config_load == false) //Carrega OPMs que tem acesso\n {\n $this->opm_operador = $sicad->get_OPM(); //Carrega OPM do Usuário\n $this->nivel_sistema = $fer->getnivel (get_class($this)); //Verifica qual nível de acesso do usuário\n $this->listas = $sicad->get_OPMsUsuario(); //Carrega Listas de OPMs\n $this->config = $fer->getConfig($this->sistema); //Carrega config\n TSession::setValue('SISACAD_CONFIG', $this->config); //Busca o Nível de acesso que o usuário tem para a Classe\n $this->config_load = true; //Informa que configuração foi carregada\n }\n // creates the form\n $this->form = new TForm('form_disciplina');\n $this->form->class = 'tform'; // CSS class\n\n $table_master = new TTable;\n $table_master->width = '100%';\n \n $table_master->addRowSet( new TLabel('Define disciplinas de Interesse para o corpo de Professores - Cadastro/Edição'), '', '')->class = 'tformtitle';\n \n // add a table inside form\n $table_general = new TTable;\n $table_general->width = '100%';\n \n $frame_general = new TFrame;\n $frame_general->class = 'tframe tframe-custom';\n $frame_general->setLegend('Dados da Disciplina');\n $frame_general->style = 'background:whiteSmoke';\n $frame_general->add($table_general);\n \n $frame_details = new TFrame;\n $frame_details->class = 'tframe tframe-custom';\n $frame_details->setLegend('Professores que Ministram aula nesta disciplina');\n \n $table_master->addRow()->addCell( $frame_general )->colspan=2;\n $row = $table_master->addRow();\n $row->addCell( $frame_details );\n \n $this->form->add($table_master);\n \n // master fields\n $id = new TEntry('id');\n $nome = new TEntry('nome');\n $sigla = new TEntry('sigla');\n $oculto = new TCombo('oculto');\n\n // sizes\n $id->setSize('80');\n $nome->setSize('400');\n $sigla->setSize('200');\n $oculto->setSize('100');\n \n //Valores\n $oculto->addItems($fer->lista_sim_nao());\n \n $oculto->setValue('N');\n\n if (!empty($id))\n {\n $id->setEditable(FALSE);\n }\n //Se não é Gestor acima desativa\n if ($this->nivel_sistema<=80)\n {\n $nome->setEditable(FALSE);\n $sigla->setEditable(FALSE);\n $oculto->setEditable(FALSE);\n }\n \n // add form fields to be handled by form\n $this->form->addField($id);\n $this->form->addField($nome);\n $this->form->addField($sigla);\n $this->form->addField($oculto);\n \n // add form fields to the screen\n $table_general->addRowSet( new TLabel('Id'), $id );\n $table_general->addRowSet( new TLabel('Disciplina'), $nome );\n $table_general->addRowSet( new TLabel('Sigla'), $sigla );\n $table_general->addRowSet( new TLabel('Fora de Uso?'), $oculto );\n \n // creates the scroll panel\n $scroll = new TScroll;\n $scroll->setSize('100%',180);\n\n // detail\n $this->table_details = new TTable;\n $this->table_details-> width = '100%';\n $scroll->add($this->table_details);\n $frame_details->add($scroll);\n \n $this->table_details->addSection('thead');\n $row = $this->table_details->addRow();\n \n // detail header\n $row->addCell( new TLabel('Opções') );\n $row->addCell( new TLabel('Professor da Disciplina') );\n \n // create an action button (save)\n $save_button=new TButton('save');\n $save_button->setAction(new TAction(array($this, 'onSave')), _t('Save'));\n $save_button->setImage('ico_save.png');\n\n // create an new button (edit with no parameters)\n $new_button=new TButton('new');\n $new_button->setAction(new TAction(array($this, 'onClear')), _t('New'));\n $new_button->setImage('ico_new.png');\n\n // create an return button\n $local = TSession::getValue('defineDisciplinaProfessorForm_return');\n if (!empty($local) && $local == 'config')\n {\n $ret_button=new TButton('return');\n $ret_button->setAction(new TAction(array('disciplinaList', 'onReload')), 'Retorna a Configuração');\n $ret_button->setImage('ico_back.png');\n }\n else\n {\n $ret_button=new TButton('return');\n $ret_button->setAction(new TAction(array('defineDisciplinaProfessorList', 'onReload')), _t('Back to the listing'));\n $ret_button->setImage('ico_back.png');\n }\n \n\n // define form fields\n $this->form->addField($save_button);\n if ($this->nivel_sistema>80)\n {\n $this->form->addField($new_button);\n }\n $this->form->addField($ret_button);\n \n if ($this->nivel_sistema>80)\n {\n $table_master->addRowSet( array($save_button, $new_button,$ret_button), '', '')->class = 'tformaction'; // CSS class\n }\n else\n {\n $table_master->addRowSet( array($save_button, $ret_button), '', '')->class = 'tformaction'; // CSS class\n }\n \n $this->detail_row = 0;\n \n // create the page container\n $container = new TVBox;\n $container->style = 'width: 100%';\n $container->add(new TXMLBreadCrumb('menu.xml', 'defineDisciplinaProfessorList'));\n $container->add($this->form);\n parent::add($container);\n }",
"protected function _construct()\r\n {\r\n parent::_construct();\r\n $this->setTemplate('placetopay/form.phtml');\r\n }",
"public function __construct($FormName)\n\t {\n\t \t// Call parent's constructor with the form name so nothing breaks down.\n\t \tparent::__construct($FormName);\n\t\t\t\n // ProductID.\n\t\t\t$this->add(\n\t\t\t[\n\t 'name' => 'productId',\n\t 'attributes' =>\n\t [\n\t 'type' => 'text',\n\t 'id' => 'productId',\n 'required' => 'required',\n\t \t],\n\t 'options' => ['label' => 'ProductID']\n\t ]);\n\t\t\t\n\t\t\t// Submit button.\n\t\t\t$this->add(\n\t\t\t[\n\t 'name' => 'submitDeleteProductForm',\n\t 'attributes' =>\n\t [\n\t 'type' => 'submit',\n\t 'id' => 'submitDeleteProductForm',\n 'required' => 'required',\n 'value' => 'Delete',\n\t \t]\n\t ]);\n\t }",
"private function createDeleteForm(CMS $cM)\n {\n return $this->createFormBuilder()\n ->setAction($this->generateUrl('cms_delete', array('id' => $cM->getId())))\n ->setMethod('DELETE')\n ->getForm()\n ;\n }",
"public function __construct( Pronamic_Pay_Gateways_Ogone_OrderStandard_Config $config ) {\n\t\tparent::__construct( $config );\n\n\t\t$this->set_method( Pronamic_WP_Pay_Gateway::METHOD_HTML_FORM );\n\t\t$this->set_has_feedback( true );\n\t\t$this->set_amount_minimum( 0.01 );\n\t\t$this->set_slug( self::SLUG );\n\n\t\t$this->client = new Pronamic_Pay_Gateways_Ogone_OrderStandard_Client();\n\n\t\t$this->client->setPaymentServerUrl( $config->url );\n\t\t$this->client->setPspId( $config->psp_id );\n\t\t$this->client->setPassPhraseIn( $config->sha_in_pass_phrase );\n\t\t$this->client->setPassPhraseOut( $config->sha_out_pass_phrase );\n\n\t\tif ( ! empty( $config->hash_algorithm ) ) {\n\t\t\t$this->client->set_hash_algorithm( $config->hash_algorithm );\n\t\t}\n\t}",
"protected function configure($options = array(), $attributes = array())\n {\n parent::configure($options, $attributes);\n\n $this->setOption('delete_label', 'Remove');\n\n }",
"public function __construct()\n {\n parent::__construct();\n\n $this->m_tabconfig['location']['disabled'] = true;\n $this->m_tabconfig['search']['disabled'] = true;\n $this->m_tabconfig['report']['disabled'] = true;\n }"
] |
[
"0.5477134",
"0.53795093",
"0.53547865",
"0.5297331",
"0.529553",
"0.5263493",
"0.5203773",
"0.5196587",
"0.51562023",
"0.513204",
"0.5124373",
"0.50859547",
"0.5080745",
"0.5074609",
"0.50725317",
"0.5042706",
"0.5039328",
"0.50275666",
"0.49947718",
"0.49808004",
"0.4962926",
"0.49548638",
"0.49519005",
"0.49426195",
"0.49368107",
"0.49132878",
"0.49125588",
"0.49097383",
"0.49017116",
"0.48961425"
] |
0.6006996
|
0
|
Form validation for the SMS / Delete Network configuration page.
|
function room_reservations_admin_settings_sms_delete_validate($form_id, &$form_state) {
if ($form_state['clicked_button']['#value'] == t('Delete')) {
$carrier = $form_state['values']['carrier'];
if (!$carrier) {
$field = 'delete_carrier][carrier';
$message = t('Wireless carrier is required.');
form_set_error($field, check_plain($message));
}
}
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"protected function validateForm()\n {\n if (!$this->user->hasPermission('modify', 'domain/domain')) {\n $this->error['warning'] = $this->language->get('error_permission');\n }\n\n if (empty($this->request->post['domain']) || !isset($this->request->post['domain'])) {\n $this->error['domain'] = $this->language->get('error_domain');\n } else {\n if (!preg_match('~^https?://(?:[a-z0-9](?:[-a-z0-9]*[a-z0-9])?\\.)+[a-z](?:[-a-z0-9]*[a-z0-9])?\\.?(?:$|/)~', $this->request->post['domain'])) {\n $this->error['domain'] = $this->language->get('error_domain');\n }\n }\n\n if (empty($this->request->post['currency_id'] || !isset($this->request->post['currency_id']))) {\n $this->error['currency'] = $this->language->get('error_currency');\n }\n\n if (empty($this->request->post['currency_title'] || !isset($this->request->post['currency_title']))) {\n $this->error['currency'] = $this->language->get('error_currency');\n }\n\n if ($this->error && !isset($this->error['warning'])) {\n $this->error['warning'] = $this->language->get('error_warning');\n }\n\n return !$this->error;\n }",
"function redmine_sso_admin_settings_validate($form, $form_state) {\n /**\n * TODO\n * check url\n * check if group exsists\n * check if project exsists\n */\n}",
"private function validateTunnelForm(){\n\t\t$subnet_type = array('lan_subnet','ipaddr','network');\n\t\tif(!in_array($_POST['services_ipsec_tunnel_local_subnet_type'],$subnet_type)){\n\t\t\tErrorHandler::addError('formerror','services_ipsec_tunnel_local_subnet_type');\n\t\t}\n\t\t\n\t\tif($_POST['services_ipsec_tunnel_local_subnet_type'] == 'ipaddr'){\n\t\t\t//\t\tvalidate local IP address\n\t\t\tif(!Functions::is_ipAddr($_POST['services_ipsec_local_subnet_ipaddr'])){\n\t\t\t\tErrorHandler::addError('formerror','services_ipsec_tunnel_local_subnet_ipaddr');\n\t\t\t}\n\t\t}\n\t\telseif($_POST['services_ipsec_tunnel_local_subnet_type'] == 'network'){\n\t\t\t//\t\tValidate network portion of the local subnet\n\t\t\tif(!Functions::is_ipAddr($_POST['services_ipsec_tunnel_local_subnet_ipaddr'])){\n\t\t\t\tErrorHandler::addError('formerror','services_ipsec_tunnel_local_subnet_ipaddr');\n\t\t\t}\n\t\t\tif($_POST['services_ipsec_tunnel_local_subnet_subnet'] < 0 || $_POST['services_ipsec_tunnel_local_subnet_subnet'] > 32){\n\t\t\t\tErrorHandler::addError('formerror','services_ipsec_tunnel_local_subnet_subnet');\n\t\t\t}\n\t\t}\n\t\t\n\t\tif(!in_array($_POST['services_ipsec_tunnel_remote_subnet_type'],$subnet_type)){\n\t\t\tErrorHandler::addError('formerror','services_ipsec_tunnel_remote_subnet_type');\n\t\t}\n\t\t\n\t\tif($_POST['services_ipsec_tunnel_remote_subnet_type'] == 'ipaddr'){\n\t\t\t//\t\tvalidate remote IP address\n\t\t\tif(!Functions::is_ipAddr($_POST['services_ipsec_tunnel_remote_subnet_ipaddr'])){\n\t\t\t\tErrorHandler::addError('formerror','services_ipsec_tunnel_remote_subnet_ipaddr');\n\t\t\t}\n\t\t}\n\t\telseif($_POST['services_ipsec_tunnel_remote_subnet_type'] == 'network'){\n\t\t\t//\t\tValidate network portion of the remote subnet\n\t\t\tif(!Functions::is_ipAddr($_POST['services_ipsec_tunnel_remote_subnet_ipaddr'])){\n\t\t\t\tErrorHandler::addError('formerror','services_ipsec_tunnel_remote_subnet_ipaddr');\n\t\t\t}\n\t\t\tif($_POST['services_ipsec_tunnel_remote_subnet_subnet'] < 0 || $_POST['services_ipsec_tunnel_remote_subnet_subnet'] > 32){\n\t\t\t\tErrorHandler::addError('formerror','services_ipsec_tunnel_remote_subnet_subnet');\n\t\t\t}\n\t\t}\n\t\t\n\t\tif(!Functions::is_ipAddr($_POST['services_ipsec_tunnel_local_gateway'])){\n\t\t\tErrorHandler::addError('formerror','services_ipsec_tunnel_local_gateway');\n\t\t}\n\t\t\n\t\tif(!Functions::is_ipAddr($_POST['services_ipsec_tunnel_remote_gateway'])){\n\t\t\tErrorHandler::addError('formerror','services_ipsec_tunnel_remote_gateway');\n\t\t}\n\t\t\n\t\tif(!empty($_POST['services_ipsec_tunnel_keepalive_ipaddr']) && !Functions::is_ipAddr($_POST['services_ipsec_tunnel_keepalive_ipaddr'])){\n\t\t\tErrorHandler::addError('formerror','services_ipsec_tunnel_keepalive_ipaddr');\n\t\t}\n\t\t\n\t\t$negotiation_modes = array('main','agressive','base');\n\t\tif(!in_array($_POST['services_ipsec_tunnel_p1_negotiation_mode'],$negotiation_modes)){\n\t\t\tErrorHandler::addError('formerror','services_ipsec_tunnel_p1_negotiation_mode');\n\t\t}\n\t\t\n\t\t$identifier_types = array('myipaddr','ipaddr','fqdn','usr_fqdn','dyn_dns');\n\t\tif(!in_array($_POST['services_ipsec_tunnel_p1_id_type'],$identifier_types)){\n\t\t\tErrorHandler::addError('formerror','services_ipsec_tunnel_p1_id_type');\n\t\t}\n\t\t\n\t\tif($_POST['services_ipsec_tunnel_p1_id_type'] == 'ipaddr' && !Functions::is_ipAddr($_POST['services_ipsec_tunnel_p1_id'])){\n\t\t\tErrorHandler::addError('formerror','services_ipsec_tunnel_p1_id');\n\t\t}\n\t\tif($_POST['services_ipsec_tunnel_p1_id_type'] == 'fqdn' && !Functions::isUrl($_POST['services_ipsec_tunnel_p1_id'])){\n\t\t\tErrorHandler::addError('formerror','services_ipsec_tunnel_p1_id');\n\t\t}\n\t\t\n\t\t$dh_keygroups = array('1','2','5');\n\t\tif(!in_array($_POST['services_ipsec_tunnel_p1_dh_keygroup'],$dh_keygroups)){\n\t\t\tErrorHandler::addError('formerror','services_ipsec_tunnel_p1_dh_keygroup');\n\t\t}\n\t\t\n\t\tif(!is_numeric($_POST['services_ipsec_tunnel_p1_lifetime'])){\n\t\t\tErrorHandler::addError('formerror','services_ipsec_tunnel_p1_lifetime');\n\t\t}\n\t\t\n\t\t$auth_method = array('psk','rsasig');\n\t\tif(!in_array($_POST['services_ipsec_tunnel_p1_auth_method'],$auth_method)){\n\t\t\tErrorHandler::addError('formerror','services_ipsec_tunnel_p1_auth_method');\n\t\t}\n\t\t\n\t\tif($_POST['services_ipsec_tunnel_p1_auth_method'] == 'psk'){\n\t\t\t$found = false;\n\t\t\tforeach($this->data->keys->key as $key){\n\t\t\t\tif($key['id'] == $_POST['services_ipsec_tunnel_p1_preshared_key']){\n\t\t\t\t\t$found = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tif(!$found){\n\t\t\t\tErrorHandler::addError('formerror','services_ipsec_tunnel_p1_preshared_key');\n\t\t\t}\n\t\t}\n\t\telseif($_POST['services_ipsec_tunnel_p1_auth_method'] == 'rsasig'){\n\t\t\t$found = false;\n\t\t\tforeach($this->data->certificates->certificate as $cert){\n\t\t\t\tif($cert['id'] == $_POST['services_ipsec_tunnel_p1_rsa_sig']){\n\t\t\t\t\t$found = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tif(!$found){\n\t\t\t\tErrorHandler::addError('formerror','services_ipsec_tunnel_p1_rsa_sig');\n\t\t\t}\n\t\t}\n\t\t\n\t\t$protocol = array('esp','ah','esp_ah');\n\t\tif(!in_array($_POST['services_ipsec_tunnel_p2_protocol'],$protocol)){\n\t\t\tErrorHandler::addError('formerror','services_ipsec_tunnel_p2_protocol');\n\t\t}\n\t\t\n\t\tif($_POST['services_ipsec_tunnel_p2_pfs_keygroup'] != 'off' && !in_array($_POST['services_ipsec_tunnel_p2_pfs_keygroup'],$dh_keygroups)){\n\t\t\tErrorHandler::addError('formerror','services_ipsec_tunnel_p2_pfs_keygroup');\n\t\t}\n\t\t\n\t\tif(!is_numeric($_POST['services_ipsec_tunnel_p2_lifetime'])){\n\t\t\tErrorHandler::addError('formerror','services_ipsec_tunnel_p2_lifetime');\n\t\t}\n\t\t\n\t\tif(ErrorHandler::errorCount() > 0){\n\t\t\tthrow new Exception('There is invalid form input');\n\t\t}\n\t}",
"function room_reservations_admin_settings_sms_add_validate($form_id, &$form_state) {\n if ($form_state['clicked_button']['#value'] == t('Add')) {\n $carrier = $form_state['values']['carrier'];\n $domain = $form_state['values']['domain'];\n if (!$carrier) {\n $field = 'add_carrier][carrier';\n $message = t('Wireless carrier is required.');\n form_set_error($field, check_plain($message));\n }\n if (!$domain) {\n $field = 'add_carrier][domain';\n $message = t('Domain name is required.');\n form_set_error($field, check_plain($message));\n }\n else {\n if (drupal_substr($domain, 0, 1) != '@') {\n $field = 'add_carrier][domain';\n $message = t('Domain name must begin with @.');\n form_set_error($field, check_plain($message));\n }\n }\n if (($carrier) && ($domain)) {\n $sql = \"\n SELECT value\n FROM {room_reservations_variables}\n WHERE name = '%s'\n \";\n $result = db_query($sql, 'carrier');\n if ($result) {\n while ($data = db_fetch_object($result)) {\n $values = explode('~', $data->value);\n if ($values[0] == $carrier) {\n $field = 'add_carrier][carrier';\n $message = t('There is already a record for this wireless\n carrier.');\n form_set_error($field, $message);\n break;\n }\n }\n }\n }\n }\n}",
"function room_reservations_admin_settings_sms_delete($form, &$form_state) {\n $sql = \"\n SELECT id, value\n FROM {room_reservations_variables}\n WHERE name = '%s'\n ORDER BY value\n \";\n $result = db_query($sql, 'carrier');\n if ($result) {\n $options = array();\n $options[strval(0)] = t('Select a wireless carrier');\n $x = 0;\n while ($data = db_fetch_object($result)) {\n $x++;\n $id = $data->id;\n $values = explode('~', $data->value);\n $options[strval($id)] = $values[0];\n $x++;\n }\n }\n if ($options) {\n $form['carrier'] = array(\n '#type' => 'select',\n '#title' => t('Wireless carrier'),\n '#options' => $options,\n '#weight' => 25,\n );\n $form['delete'] = array(\n '#type' => 'submit',\n '#value' => t('Delete'),\n '#weight' => 30,\n );\n }\n return $form;\n}",
"function simplenews_admin_newsletter_form_validate($form, &$form_state) {\n if ($form_state['clicked_button']['#value'] != t('Delete')) {\n\n // Check for valid email address.\n if (!valid_email_address($form_state['values']['from_address'])) {\n form_set_error('from_address', t(\"The sender's email address you supplied is not valid.\"));\n }\n }\n}",
"public function validateRemoveContent() {\n\t\t$this->validateEnableContent();\n\t\t\n\t\t$this->parameters['message'] = (isset($this->parameters['message']) ? StringUtil::trim($this->parameters['message']) : '');\n\t}",
"function _or_chart_admin_url_form_validate($form, &$form_state) { \n $nodes = array_filter($form_state['values']['nodes']);\n if (count($nodes) == 0) {\n form_set_error('', t('No items selected.'));\n }\n}",
"function room_reservations_admin_settings_default_email_validate(\n $form_id, &$form_state) {\n if ($form_state['clicked_button']['#value'] == t('Save configuration')) {\n $option = $form_state['values']['options'];\n $domain = trim($form_state['values']['domain']);\n if (($option == 2) && (!$domain)) {\n $field = 'domain';\n $message = t('A domain name must be entered when this option is selected.');\n form_set_error($field, check_plain($message));\n }\n }\n}",
"function room_reservations_admin_settings_sms_delete_submit($form_id, &$form_state) {\n if ($form_state['clicked_button']['#value'] == t('Delete')) {\n $carrier = $form_state['values']['carrier'];\n $sql = \"\n DELETE FROM {room_reservations_variables}\n WHERE ID = %d\n \";\n $result = db_query($sql, $carrier);\n if (!$result) {\n drupal_set_message(t('The wireless carrier could not be deleted.'), \n 'error');\n }\n else {\n drupal_set_message(t('The wireless carrier has been deleted.'));\n }\n }\n}",
"protected function postValidation()\n {\n if (Tools::isSubmit('btnSubmit')) {\n if (!Tools::getValue('SEND_SMS_API')) {\n $this->postErrors[] = $this->l('API Key is required.');\n }\n if (Tools::getValue('SEND_SMS_API')) {\n $isapiKey = $this->isValidAPIKey(Tools::getValue('SEND_SMS_API'));\n if ($isapiKey->status != 'success') {\n $this->postErrors[] = $this->l('API Key is not valid.');\n }\n }\n if (!Tools::getValue('ADMIN_MOBILE')) {\n $this->postErrors[] = $this->l('Admin Mobile Number is required.');\n }\n if (Tools::getValue('ADMIN_MOBILE')) {\n $isvalid = preg_match('/^[0-9]*$/', Tools::getValue('ADMIN_MOBILE'));\n if ($isvalid == false) {\n $this->postErrors[] = $this->l('Admin Mobile Number is not valid.');\n }\n }\n }\n }",
"public function validate() {\n\n if (empty($this->config['default_pool_read'])) {\n throw new neoform\\config\\exception('\"default_pool_read\" must be set');\n }\n\n if (empty($this->config['default_pool_write'])) {\n throw new neoform\\config\\exception('\"default_pool_write\" must be set');\n }\n\n if (empty($this->config['pools']) || ! is_array($this->config['pools']) || ! $this->config['pools']) {\n throw new neoform\\config\\exception('\"pools\" must contain at least one server');\n }\n }",
"function site_settings()\n {\n if (isset($_POST['site_settings'])) {\n \n if (DEMO) {\n $this->prepare_flashmessage(get_languageword('CRUD_operations_disabled_in_DEMO_version'), 2);\n redirect(URL_SITE_SETTINGS);\n }\n \n $msg='';\n $status=0;\n \n $this->form_validation->set_rules('site_title', get_languageword('site_title'), 'trim|required|max_length[100]|xss_clean');\n \n \n \n $this->form_validation->set_rules('home_page_caption', get_languageword('home_page_caption'), 'trim|required|max_length[50]|xss_clean');\n $this->form_validation->set_rules('home_page_tagline', get_languageword('home_page_tagline'), 'trim|max_length[50]|xss_clean');\n \n $this->form_validation->set_rules('address', get_languageword('address'), 'trim|required|max_length[1000]|xss_clean');\n $this->form_validation->set_rules('city', get_languageword('city'), 'trim|required|max_length[100]|xss_clean');\n $this->form_validation->set_rules('state', get_languageword('state'), 'trim|required|max_length[100]|xss_clean');\n $this->form_validation->set_rules('country', get_languageword('country'), 'trim|required|xss_clean');\n $this->form_validation->set_rules('zip', get_languageword('pincode'), 'trim|required|max_length[20]|xss_clean');\n $this->form_validation->set_rules('latitude', get_languageword('latitude'), 'required|xss_clean');\n $this->form_validation->set_rules('longitude', get_languageword('longitude'), 'required|xss_clean');\n $this->form_validation->set_rules('ios_url', get_languageword('ios_url|xss_clean'));\n $this->form_validation->set_rules('android_url', get_languageword('android_url|xss_clean'));\n $this->form_validation->set_rules('phone', get_languageword('phone'), 'trim|required|max_length[30]|xss_clean');\n $this->form_validation->set_rules('land_line', get_languageword('land_line'), 'trim|required|max_length[30]|xss_clean');\n $this->form_validation->set_rules('fax', get_languageword('fax'), 'trim|max_length[50]|xss_clean');\n $this->form_validation->set_rules('portal_email', get_languageword('contact_email'), 'trim|required|valid_email|xss_clean');\n $this->form_validation->set_rules('site_country', get_languageword('site_country'), 'trim|required|xss_clean');\n $this->form_validation->set_rules('currency_symbol', get_languageword('currency_symbol'), 'trim|required|xss_clean');\n $this->form_validation->set_rules('from_time', get_languageword('from_time'), 'required|xss_clean');\n $this->form_validation->set_rules('to_time', get_languageword('to_time'), 'required|xss_clean');\n $this->form_validation->set_rules('design_by', get_languageword('design_by'), 'trim|required|xss_clean');\n\n $this->form_validation->set_rules('rights_reserved_content', get_languageword('rights_reserved_content'), 'trim|required|xss_clean'); \n\n $this->form_validation->set_rules('facebook_app_id', get_languageword('facebook_app_id'), 'required|xss_clean'); \n\n\n $this->form_validation->set_rules('facebook_app_secret', get_languageword('facebook_app_secret'), 'required|xss_clean');\n \n $this->form_validation->set_rules('google_client_id', get_languageword('google_client_id'), 'required|xss_clean');\n $this->form_validation->set_rules('google_client_secret', get_languageword('google_client_secret'), 'required|xss_clean');\n\n\n $this->form_validation->set_rules('contact_map_script', get_languageword('contact_map_script'), 'required');\n \n $this->form_validation->set_error_delimiters('<div class=\"error\">', '</div>');\n \n if ($this->form_validation->run() == TRUE) {\n $data = array();\n $data['site_title'] = $this->input->post('site_title');\n \n \n \n $data['home_page_caption'] = $this->input->post('home_page_caption');\n $data['home_page_tagline'] = $this->input->post('home_page_tagline');\n \n \n \n $data['address'] = $this->input->post('address');\n $data['city'] = $this->input->post('city');\n $data['state'] = $this->input->post('state');\n $data['country'] = $this->input->post('country');\n $data['zip'] = $this->input->post('zip');\n $data['latitude'] = $this->input->post('latitude');\n $data['longitude'] = $this->input->post('longitude');\n \n $data['ios_url'] = $this->input->post('ios_url');\n $data['android_url'] = $this->input->post('android_url');\n \n $data['facebook_api'] = $this->input->post('facebook_api');\n $data['google_api'] = $this->input->post('google_api');\n \n $data['phone'] = $this->input->post('phone');\n $data['land_line'] = $this->input->post('land_line');\n $data['fax'] = $this->input->post('fax');\n $data['portal_email'] = $this->input->post('portal_email');\n \n $data['site_language']= $this->input->post('site_language');\n $data['site_country'] = $this->input->post('site_country');\n $data['time_zone'] = $this->input->post('time_zone');\n $data['currency'] = $this->input->post('currency');\n $data['currency_symbol'] = $this->input->post('currency_symbol');\n \n $data['country_code'] = $this->input->post('country_code');\n \n $data['from_time'] = $this->input->post('from_time');\n $data['to_time'] = $this->input->post('to_time');\n \n if ($this->input->post('sms_notifications')=='on') {\n $data['sms_notifications'] = 'Yes';\n } else {\n $data['sms_notifications'] = 'No';\n } \n \n \n if ($this->input->post('fcm_push_notifications')=='on') {\n $data['fcm_push_notifications']= 'Yes';\n } else {\n $data['fcm_push_notifications']= 'No';\n } \n \n \n $data['design_by'] = $this->input->post('design_by');\n $data['rights_reserved_content'] = $this->input->post('rights_reserved_content');\n \n $data['date_format'] = $this->input->post('date_format');\n \n $payment_methods = $this->input->post('payment_methods');\n if (!empty($payment_methods)) {\n $payment_methods = implode(',', $payment_methods);\n $data['payment_methods'] = $payment_methods;\n } else {\n $data['payment_methods'] = NULL;\n }\n \n $data['facebook_app_id'] = $this->input->post('facebook_app_id');\n $data['facebook_app_secret'] = $this->input->post('facebook_app_secret');\n \n $data['google_client_id'] = $this->input->post('google_client_id');\n $data['google_client_secret']= $this->input->post('google_client_secret');\n \n\n $data['contact_map_script'] = $this->input->post('contact_map_script');\n \n $where = array('id'=>1);\n if ($this->base_model->update_operation($data, TBL_SITE_SETTINGS, $where)) {\n unset($data);\n $msg .= get_languageword('details_updated_successfully');\n $status= 0;\n \n //Upload Site Logo\n if (count($_FILES) > 0) {\n if ($_FILES['site_logo']['name'] != '' && $_FILES['site_logo']['error'] != 4) {\n $record = $this->base_model->fetch_records_from('site_settings');\n \n if (!empty($record)) {\n $record = $record[0];\n if ($record->site_logo != '' && file_exists(LOGO_IMG_UPLOAD_PATH_URL.$record->site_logo)) {\n unlink(LOGO_IMG_UPLOAD_PATH_URL.$record->site_logo);\n unlink(LOGO_IMG_UPLOAD_THUMB_PATH_URL.$record->site_logo);\n }\n }\n \n $ext = pathinfo($_FILES['site_logo']['name'], PATHINFO_EXTENSION);\n $file_name = 'site_logo.'. $ext;\n $config['upload_path'] = LOGO_IMG_UPLOAD_PATH_URL;\n $config['allowed_types'] = 'jpg|jpeg|png|svg|JPG|JPEG|PNG';\n $config['max_size'] = 5120;//5 MB\n\n\n $config['file_name'] = $file_name;\n $this->load->library('upload', $config);\n $this->upload->initialize($config);\n\n if ($this->upload->do_upload('site_logo')) {\n \n $data = array();\n $data['site_logo'] = $file_name;\n \n \n \n // TINIFY IMAGE COMPRESSING & THUMB\n if ($this->config->item('tinify_settings')->use_tinify=='Yes') {\n \n \n $destination = FCPATH.LOGO_IMG_UPLOAD_PATH_URL.$file_name;\n $source = base_url().LOGO_IMG_UPLOAD_PATH_URL.$file_name;\n \n $this->load->library('FCTinify');\n $fct = new FCTinify();\n \n //TINIFY IMAGE COMPRESSING\n if ($this->config->item('tinify_settings')->compress=='Yes') {\n $result = $fct->imageCompress($source, $destination);\n }\n \n // TINIFY IMAGE THUMB CREATION\n if ($this->config->item('tinify_settings')->thumb=='Yes') {\n $thumb_destination = FCPATH.LOGO_IMG_UPLOAD_THUMB_PATH_URL.$file_name;\n $fct->imageResize($source, $thumb_destination, THUMB_IMG_WIDTH, THUMB_IMG_HEIGHT, 'cover');\n } else { \n $this->create_thumbnail($config['upload_path'].$file_name, LOGO_IMG_UPLOAD_THUMB_PATH_URL.$file_name, THUMB_IMG_WIDTH, THUMB_IMG_HEIGHT);\n }\n \n \n } else {\n \n $this->create_thumbnail($config['upload_path'].$file_name, LOGO_IMG_UPLOAD_THUMB_PATH_URL.$file_name, 200, 200);\n }\n \n } else {\n $msg .= '<br>'.strip_tags($this->upload->display_errors());\n $status =1;\n \n }\n }\n \n \n if ($_FILES['second_site_logo']['name'] != '' && $_FILES['second_site_logo']['error'] != 4) {\n $record = $this->base_model->fetch_records_from('site_settings');\n \n if (!empty($record)) {\n \n $record = $record[0];\n if ($record->second_site_logo != '' && file_exists(LOGO_IMG_UPLOAD_PATH_URL.$record->second_site_logo)) {\n unlink(LOGO_IMG_UPLOAD_PATH_URL.$record->second_site_logo);\n unlink(LOGO_IMG_UPLOAD_THUMB_PATH_URL.$record->second_site_logo);\n }\n }\n \n $ext = pathinfo($_FILES['second_site_logo']['name'], PATHINFO_EXTENSION);\n $file_name = 'second_site_logo.'. $ext;\n $config['upload_path'] = LOGO_IMG_UPLOAD_PATH_URL;\n $config['allowed_types'] = 'jpg|jpeg|png|svg|JPG|JPEG|PNG';\n \n $config['file_name'] = $file_name;\n $this->load->library('upload', $config);\n $this->upload->initialize($config);\n\n if ($this->upload->do_upload('second_site_logo')) {\n \n $data = array();\n $data['second_site_logo'] = $file_name;\n \n \n // TINIFY IMAGE COMPRESSING & THUMB\n if ($this->config->item('tinify_settings')->use_tinify=='Yes') {\n \n \n $destination = FCPATH.LOGO_IMG_UPLOAD_PATH_URL.$file_name;\n $source = base_url().LOGO_IMG_UPLOAD_PATH_URL.$file_name;\n \n $this->load->library('FCTinify');\n $fct = new FCTinify();\n \n //TINIFY IMAGE COMPRESSING\n if ($this->config->item('tinify_settings')->compress=='Yes') {\n $result = $fct->imageCompress($source, $destination);\n }\n \n // TINIFY IMAGE THUMB CREATION\n if ($this->config->item('tinify_settings')->thumb=='Yes') {\n $thumb_destination = FCPATH.LOGO_IMG_UPLOAD_THUMB_PATH_URL.$file_name;\n $fct->imageResize($source, $thumb_destination, THUMB_IMG_WIDTH, THUMB_IMG_HEIGHT, 'cover');\n } else { \n $this->create_thumbnail($config['upload_path'].$file_name, LOGO_IMG_UPLOAD_THUMB_PATH_URL.$file_name, THUMB_IMG_WIDTH, THUMB_IMG_HEIGHT);\n }\n \n \n } else {\n \n $this->create_thumbnail($config['upload_path'].$file_name, LOGO_IMG_UPLOAD_THUMB_PATH_URL.$file_name, 200, 200);\n }\n \n } else {\n $msg .= '<br>'.strip_tags($this->upload->display_errors());\n $status =1;\n \n }\n }\n \n \n if ($_FILES['fevicon']['name'] != '' && $_FILES['fevicon']['error'] != 4) {\n $record = $this->base_model->fetch_records_from('site_settings');\n \n if (!empty($record)) {\n $record = $record[0];\n \n if ($record->fevicon != '' && file_exists(FEVICON_IMG_UPLOAD_PATH_URL.$record->fevicon)) {\n unlink(FEVICON_IMG_UPLOAD_PATH_URL.$record->fevicon);\n }\n }\n \n $ext = pathinfo($_FILES['fevicon']['name'], PATHINFO_EXTENSION);\n $file_name1 = 'fevicon.'. $ext;\n $config['upload_path'] = FEVICON_IMG_UPLOAD_PATH_URL;\n $config['allowed_types'] = 'ico';\n \n $config['file_name'] = $file_name1;\n $this->load->library('upload', $config);\n $this->upload->initialize($config);\n\n if ($this->upload->do_upload('fevicon')) {\n $data['fevicon'] = $file_name1;\n \n } else {\n $msg .= '<br>'.strip_tags($this->upload->display_errors());\n $status =1;\n }\n }\n \n \n \n \n \n //HOME PAGE IMAGE\n if ($_FILES['home_page_img']['name'] != '' && $_FILES['home_page_img']['error'] != 4) {\n $record = $this->base_model->fetch_records_from('site_settings');\n \n if (!empty($record)) {\n $record = $record[0];\n if ($record->home_page_img != '' && file_exists(HOME_PAGE_IMG_UPLOAD_PATH_URL.$record->home_page_img)) {\n unlink(HOME_PAGE_IMG_UPLOAD_PATH_URL.$record->home_page_img);\n }\n }\n \n $ext = pathinfo($_FILES['home_page_img']['name'], PATHINFO_EXTENSION);\n $file_name = 'home_page_img.'. $ext;\n $config['upload_path'] = HOME_PAGE_IMG_UPLOAD_PATH_URL;\n \n \n //\n $config['min_width'] = 1980;\n $config['min_height'] = 448;\n \n $config['max_width'] = 2000;\n $config['max_height'] = 1500;\n //\n \n $config['allowed_types'] = 'jpg|jpeg|png|JPG|JPEG|PNG';\n \n $config['file_name'] = $file_name;\n $this->load->library('upload', $config);\n $this->upload->initialize($config);\n\n if ($this->upload->do_upload('home_page_img')) {\n \n $data = array();\n $data['home_page_img'] = $file_name;\n \n // TINIFY IMAGE COMPRESSING & THUMB\n if ($this->config->item('tinify_settings')->use_tinify=='Yes') {\n \n $destination = FCPATH.HOME_PAGE_IMG_UPLOAD_PATH_URL.$file_name;\n $source = base_url().HOME_PAGE_IMG_UPLOAD_PATH_URL.$file_name;\n \n $this->load->library('FCTinify');\n $fct = new FCTinify();\n \n //TINIFY IMAGE COMPRESSING\n if ($this->config->item('tinify_settings')->compress=='Yes') {\n $result = $fct->imageCompress($source, $destination);\n }\n } \n } else {\n $msg .= '<br>'.strip_tags($this->upload->display_errors());\n $status =1;\n }\n }\n \n \n if (!empty($data)) {\n $this->base_model->update_operation($data, TBL_SITE_SETTINGS, $where);\n }\n }\n } else {\n $msg .= get_languageword('details_not_updated');\n $status = 1;\n }\n \n \n $this->prepare_flashmessage($msg, $status);\n redirect(URL_SITE_SETTINGS, REFRESH);\n }\n }\n \n $record = array();\n $record = $this->base_model->fetch_records_from(TBL_SITE_SETTINGS);\n if (!empty($record)) { \n $record = $record[0];\n }\n \n //Language Options\n $lang_opts = get_language_opts();\n $this->data['lang_opts'] = $lang_opts;\n \n //Language Options\n $currency_opts = get_currency_opts();\n $this->data['currency_opts'] = $currency_opts;\n \n \n // TIME ZONES\n $time_zone_options = array();\n $time_zones = $this->base_model->fetch_records_from('calendar_timezones');\n if (!empty($time_zones)) {\n foreach($time_zones as $row):\n $time_zone_options[$row->TimeZone] = $row->TimeZone.'('.$row->UTC_offset.')';\n endforeach;\n }\n $this->data['time_zone_options'] = $time_zone_options;\n \n $this->data['record'] = $record;\n $this->data['css_js_files'] = array('form_validation');\n $this->data['pagetitle'] = get_languageword('site_settings');\n \n $this->data['activemenu'] = \"master_settings\";\n $this->data['actv_submenu'] = 'site_settings';\n \n $this->data['content'] = PAGE_SITE_SETTINGS;\n $this->_render_page(TEMPLATE_ADMIN, $this->data);\n }",
"function room_reservations_admin_settings_text_validate($form_id, &$form_state) {\n if ($form_state['clicked_button']['#value'] == t('Save configuration')) {\n $from_address = $form_state['values']['from_address'];\n if (valid_email_address($from_address)) {\n // Valid.\n }\n else {\n $field = 'from_address';\n $message = t('Invalid email address.');\n form_set_error($field, check_plain($message));\n }\n }\n}",
"function validate_options($input) {\n\n\t\tif(isset($_POST['save_wa_wcc_settings'])) {\n\n\t\t\t$input['show_count'] = (isset($input['show_count'], $this->choices[$input['show_count']]) ? ($input['show_count'] === 'yes' ? true : false) : $this->defaults['settings']['show_count']);\n\t\t\t$input['hide_if_empty'] = (isset($input['hide_if_empty'], $this->choices[$input['hide_if_empty']]) ? ($input['hide_if_empty'] === 'yes' ? true : false) : $this->defaults['settings']['hide_if_empty']);\n\t\t\t$input['posts_order'] = sanitize_text_field(isset($input['posts_order']) && $input['posts_order'] !== '' ? $input['posts_order'] : $this->defaults['settings']['posts_order']);\n\t\t\t$input['posts_orderby'] = sanitize_text_field(isset($input['posts_orderby']) && $input['posts_orderby'] !== '' ? $input['posts_orderby'] : $this->defaults['settings']['posts_orderby']);\n\t\t\t$input['category'] =$input['category'];\n\t\t\t$input['duration'] =isset($input['duration']) ? $input['duration'] : '400';\n\t\t\t$input['custom_css'] =isset($input['custom_css']) ? $input['custom_css'] : $this->defaults['settings']['custom_css'];\n\t\t\t$input['level'] =isset($input['level']) ? $input['level'] : '0';\n\n\n\t\t}elseif(isset($_POST['reset_wa_wcc_settings'])) {\n\n\t\t\t$input = $this->defaults['settings'];\n\n\t\t\tadd_settings_error('reset_general_settings', 'general_reset', __('Settings restored to defaults.', 'wa_wcc_txt'), 'updated');\n\t\t\n\t\t}\telseif(isset($_POST['reset_wa_wcc_configuration'])) {\n\n\t\t\t\t$input = $this->defaults['configuration'];\n\n\t\t\t\tadd_settings_error('reset_nivo_settings', 'nivo_reset', __('Settings of were restored to defaults.', 'wa_wcc_txt'), 'updated');\n\n\t\t}\telse if(isset($_POST['save_wa_wcc_configuration'])) {\n\n\t\t\t$input['loading_place'] = (isset($input['loading_place'], $this->loading_places[$input['loading_place']]) ? $input['loading_place'] : $this->defaults['configuration']['loading_place']);\n\t\t\t$input['deactivation_delete'] = (isset($input['deactivation_delete'], $this->choices[$input['deactivation_delete']]) ? ($input['deactivation_delete'] === 'yes' ? true : false) : $this->defaults['configuration']['deactivation_delete']);\n\t\t\t$input['load_jquery'] = (isset($input['load_jquery'], $this->choices[$input['load_jquery']]) ? ($input['load_jquery'] === 'yes' ? true : false) : $this->defaults['configuration']['load_jquery']);\n\t\t\t$input['load_mtree'] = (isset($input['load_mtree'], $this->choices[$input['load_mtree']]) ? ($input['load_mtree'] === 'yes' ? true : false) : $this->defaults['configuration']['load_mtree']);\n\t\t\t$input['load_velocity'] = (isset($input['load_velocity'], $this->choices[$input['load_velocity']]) ? ($input['load_velocity'] === 'yes' ? true : false) : $this->defaults['configuration']['load_velocity']);\n\t\t\n\t\t}\n\n\t\treturn $input;\n\t}",
"function _or_chart_admin_url_export_validate($form, &$form_state) { \n $nodes = array_filter($form_state['values']['nodes']);\n if (count($nodes) == 0) {\n form_set_error('', t('No items selected.'));\n }\n}",
"function cern_dev_status_settings_form_validate($form, &$form_state) {\n $lockedout = TRUE;\n\n $ip_addresses = $form_state['values']['cern_dev_status_restrict_ip_address_list'];\n if (strlen(trim($ip_addresses))) {\n $ip_addresses = explode(PHP_EOL, trim($form_state['values']['cern_dev_status_restrict_ip_address_list']));\n foreach ($ip_addresses as $ip_address) {\n if (trim($ip_address) != '::1') { \n //one ip\n if (!preg_match('~^\\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\b$~', trim($ip_address))) { \n //ip range\n if (!preg_match('@\\b(?:[0-9]{1,3}\\.){3}[0-9]{1,3}\\/(?:[12]?[0-9]|3[0-2])\\b@', trim($ip_address))) {\n form_set_error('cern_dev_status_restrict_ip_address_list', t('@ip_address is not a valid range of IP addresses.', array('@ip_address' => $ip_address)));\n } \n else {\n //$ip_address is an IP range, check if the admin's ip is included in it\n if (cern_dev_status_ipCIDRCheck(trim(ip_address()), $ip_address)) $lockedout = FALSE;\n }\n } \n else {\n //$ip_address is a single ip, check if it's the admin's ip\n if (trim($ip_address) == ip_address()) $lockedout = FALSE;\n }\n } \n else {\n //$ip_address is ::1, check if it's the admin's ip\n if (trim($ip_address) == ip_address()) $lockedout = FALSE;\n }\n }\n }\n if ($lockedout) {\n form_set_error('cern_dev_status_restrict_ip_address_list', t('Your IP address is not included in the list, cannot save the settings: you would be locked out of the site.')); \n }\n \n $emaddr = $form_state['values']['cern_dev_status_restrict_ip_mail_address'];\n if (!valid_email_address($emaddr)) {\n form_set_error('cern_dev_status_restrict_ip_mail_address', t('@emaddr is not a valid email address.', array('@emaddr' => $emaddr)));\n }\n \n \n}",
"protected function postSMSRulesetsValidation()\n {\n if (Tools::isSubmit('orderConfirmBtn')) {\n if (!Tools::getValue('ORDER_SMS_TEMPLATE')) {\n $this->postsmsRulesetsErrors[] = $this->l('Please select template for order confirmation.');\n } elseif (!Tools::getValue('ORDER_SMS_LABEL')) {\n $this->postsmsRulesetsErrors[] = $this->l('Label is required for order confirmation.');\n } elseif (!Tools::getValue('ORDER_SENDER_ID')) {\n $this->postsmsRulesetsErrors[] = $this->l('Sender id is required for order confirmation.');\n }\n }\n if (Tools::isSubmit('shipmentConfirmBtn')) {\n if (!Tools::getValue('SHIPMENT_SMS_TEMPLATE')) {\n $this->postsmsRulesetsErrors[] = $this->l('Please select template for shipment confirmation.');\n } elseif (!Tools::getValue('SHIPMENT_SMS_LABEL')) {\n $this->postsmsRulesetsErrors[] = $this->l('Label is required for shipment confirmation.');\n } elseif (!Tools::getValue('SHIPMENT_SENDER_ID')) {\n $this->postsmsRulesetsErrors[] = $this->l('Sender id is required for shipment confirmation.');\n }\n }\n if (Tools::isSubmit('onDeliveryBtn')) {\n if (!Tools::getValue('ON_DELIVERY_SMS_TEMPLATE')) {\n $this->postsmsRulesetsErrors[] = $this->l('Please select template for On Delivery Followups.');\n } elseif (!Tools::getValue('ON_DELIVERY_SMS_LABEL')) {\n $this->postsmsRulesetsErrors[] = $this->l('Label is required for On Delivery Followups.');\n } elseif (!Tools::getValue('ON_DELIVERY_SENDER_ID')) {\n $this->postsmsRulesetsErrors[] = $this->l('Sender id is required for On Delivery Followups.');\n }\n }\n if (Tools::isSubmit('OutStockBtn')) {\n if (!Tools::getValue('OUTSTOCK_SMS_TEMPLATE')) {\n $this->postsmsRulesetsErrors[] = $this->l('Please select template for out of stock alerts.');\n } elseif (!Tools::getValue('OUTSTOCK_SMS_LABEL')) {\n $this->postsmsRulesetsErrors[] = $this->l('Label is required for out of stock alerts.');\n } elseif (!Tools::getValue('OUTSTOCK_SENDER_ID')) {\n $this->postsmsRulesetsErrors[] = $this->l('Sender id is required for out of stock alerts.');\n }\n }\n if (Tools::isSubmit('BackStockBtn')) {\n if (!Tools::getValue('BACKSTOCK_SMS_TEMPLATE')) {\n $this->postsmsRulesetsErrors[] = $this->l('Please select template for back of stock alerts.');\n } elseif (!Tools::getValue('BACKSTOCK_SMS_LABEL')) {\n $this->postsmsRulesetsErrors[] = $this->l('Label is required for back of stock alerts.');\n } elseif (!Tools::getValue('BACKSTOCK_SENDER_ID')) {\n $this->postsmsRulesetsErrors[] = $this->l('Sender id is required for back of stock alerts.');\n }\n }\n }",
"function restapi_admin_form_validate($form, &$form_state) {\n\n $class = isset($form_state['values']['restapi_default_auth_class']) ? $form_state['values']['restapi_default_auth_class'] : NULL;\n $prefix = isset($form_state['values']['restapi_url_prefix']) ? $form_state['values']['restapi_url_prefix'] : NULL;\n\n if ($class && !class_exists($class)) {\n form_set_error('restapi_default_auth_class', t('The class \"@class\" does not seem to exist, or is not callable.', [\n '@class' => $class,\n ]));\n }\n\n if ($prefix != variable_get('restapi_url_prefix')) {\n $form_state['storage']['restapi_url_prefix_changed'] = TRUE;\n\n $prefix = trim($prefix);\n $prefix = rtrim($prefix, '/');\n $prefix = ltrim($prefix, '/');\n $form_state['values']['restapi_url_prefix'] = $prefix;\n }\n\n}",
"function pdfbulletin_settings_form_validate(&$form, &$form_state) {\n // @todo SERIOUSLY\n}",
"public function check_form()\n\t{\n\t\tProfil_fields_forum::validate(PROFIL_FIELDS_CONTACT, 'contact', $this->errstr, Fsb::$session->id());\n\t}",
"function dataone_admin_settings_validate($form, &$form_state) {\n // SSL Cert file path.\n if (!empty($form_state['values'][DATAONE_VARIABLE_SSL_CERT_FILE_PATH]) && !file_exists($form_state['values'][DATAONE_VARIABLE_SSL_CERT_FILE_PATH])) {\n drupal_set_message(t('The SSL Cert does not exist at @file', array('@file' => $form_state['values'][DATAONE_VARIABLE_SSL_CERT_FILE_PATH])), 'warning');\n }\n}",
"function room_reservations_admin_settings_validate($form_id, &$form_state) {\n if ($form_state['clicked_button']['#value'] == t('Save configuration')) {\n // Open reservations per user.\n $data = $form_state['values']['room_reservations_reservations_per_user'];\n if (!ctype_digit($data)) {\n $field = 'room_reservations_reservations_per_user';\n $message = t('Open reservations per user must be numeric.');\n form_set_error($field, check_plain($message));\n }\n // Reservations per day.\n $data = $form_state['values']['room_reservations_reservations_per_day'];\n if (!ctype_digit($data)) {\n $field = 'room_reservations_reservations_per_day';\n $message = t('Reservations per day must be numeric.');\n form_set_error($field, check_plain($message));\n }\n }\n}",
"function observation_delete_form_validate($form, &$form_state) {\n\t// foobar does not exists\n\t// drupal_set_message(t('This observation is still in use.'), 'error');\n}",
"function wg_validate_post($pconfig) {\n\t$input_errors = array();\n\n\t// Assigned tunnels don't need these validation checks\n\tif (!is_wg_tunnel_assigned($pconfig)) {\n\n\t\t// Check the addresses\n\t\t$addrs = explode(\",\", $pconfig['interface']['address']);\n\n\t\tforeach ($addrs as $addr) {\n\t\t\t$addr = trim($addr);\n\n\t\t\t// Interface address is not technically required anymore\n\t\t\tif (!empty($addr) && !is_subnet($addr)) {\n\t\t\t\t$input_errors[] = sprintf(gettext(\n\t\t\t\t\t'%1$s is not a valid CIDR address'), $addr);\n\t\t\t}\n\n\t\t\t$a = explode(\"/\", $addr);\n\t\t\t$conflicts = where_is_ipaddr_configured($a[0], $skip, true,\n\t\t\t\ttrue, $a[1]);\n\n\t\t\tif (!empty($conflicts)) {\n\t\t\t\tforeach ($conflicts as $conflict) {\n\t\t\t\t\t$input_errors[] = sprintf(gettext(\n\t\t\t\t\t\t'%1$s is already configured on this ' .\n\t\t\t\t\t\t'firewall: %2$s (%3$s)'), $addr,\n\t\t\t\t\t\tstrtoupper($conflict['if']),\n\t\t\t\t\t\t$conflict['ip_or_subnet']);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\n\t}\n\n\tif (is_wg_tunnel_assigned($pconfig) && (!isset($pconfig['enabled']) || ($pconfig['enabled'] != 'yes'))) {\n\n\t\t$input_errors[] = gettext('Cannot disable a WireGuard tunnel while it is assigned as an interface.');\n\n\t}\n\n\t// Check listen port\n\t$lport = $pconfig['interface']['listenport'];\n\tif (!empty($lport) && (!ctype_digit($lport) || !is_port($lport))) {\n\t\t$input_errors[] = gettext(\"Invalid interface listen port.\");\n\t}\n\n\t// Check keys\n\tif (empty($pconfig['interface']['privatekey'])) {\n\t\t$input_errors[] = gettext(\"Private key must be specified.\");\n\t}\n\n\t// Now the peers\n\tif (isset($pconfig['peers']['wgpeer'])) {\n\t\t$idx = 0;\n\t\tforeach ($pconfig['peers']['wgpeer'] as $peer) {\n\t\t\t$input_errors = array_merge($input_errors,\n\t\t\t wg_validate_peer($idx, $peer));\n\t\t\t$idx++;\n\t\t}\n\t}\n\n\treturn $input_errors;\n}",
"function uc_usps_admin_settings_validate($form, &$form_state) {\n if (!is_numeric($form_state['values']['uc_usps_markup'])) {\n form_set_error('uc_usps_markup', t('Rate markup must be a numeric value.'));\n }\n}",
"function mongo_node_type_create_form_validate($form, $form_state) {\n $set = mongo_node_settings();\n $machine_name = $form_state['values']['name'];\n\n if (isset($set[$machine_name])) {\n form_set_error('name', t('Machine name @machine_name already exists', array('@machine_name' => $machine_name)));\n return FALSE;\n }\n return TRUE;\n}",
"function form_backend_validation()\r\n {\r\n return true ;\r\n }",
"public function validateConfigurationForm(array &$form, FormStateInterface $form_state);",
"protected function postSendSMSTempValidation()\n {\n if (Tools::isSubmit('sendSingleSMS')) {\n $mobile = Tools::getValue('SEND_SINGLE_SMS_MOBILE');\n \n if (!Tools::getValue('SEND_SINGLE_SMS_MOBILE')) :\n $this->postSendSMSTempError[] = $this->l('Mobile number is required.');\n elseif (preg_match('/[^0-9]/', $mobile)) :\n $this->postSendSMSTempError[] = $this->l('Please add valid mobile number.');\n elseif (!Tools::getValue('SEND_SINGLE_SENDER_ID')) :\n $this->postSendSMSTempError[] = $this->l('Sender Id is required.');\n elseif (!Tools::getValue('SEND_SINGLE_SMS_LABEL')) :\n $this->postSendSMSTempError[] = $this->l('Select Label is required.');\n elseif (!Tools::getValue('SEND_SIGNLE_SMS_BODY')) :\n $this->postSendSMSTempError[] = $this->l('Message body is required.');\n elseif ($this->smsAPI == '' || $this->smsAPI == null) :\n $this->postSendSMSTempError[] = $this->l('Please configure user API details.');\n endif;\n }\n return $this->postSendSMSTempError;\n }"
] |
[
"0.6365246",
"0.60390157",
"0.6028538",
"0.58139855",
"0.5726037",
"0.56559557",
"0.5648357",
"0.56289876",
"0.55957305",
"0.55945826",
"0.5579008",
"0.55447805",
"0.54885155",
"0.54805046",
"0.54543376",
"0.5430908",
"0.54289854",
"0.54099023",
"0.5402958",
"0.53886366",
"0.53824997",
"0.53693354",
"0.53598803",
"0.5356971",
"0.5342679",
"0.53365606",
"0.532745",
"0.53197604",
"0.5303697",
"0.5294833"
] |
0.67481387
|
0
|
Form submission for the SMS / Delete Network configuration page.
|
function room_reservations_admin_settings_sms_delete_submit($form_id, &$form_state) {
if ($form_state['clicked_button']['#value'] == t('Delete')) {
$carrier = $form_state['values']['carrier'];
$sql = "
DELETE FROM {room_reservations_variables}
WHERE ID = %d
";
$result = db_query($sql, $carrier);
if (!$result) {
drupal_set_message(t('The wireless carrier could not be deleted.'),
'error');
}
else {
drupal_set_message(t('The wireless carrier has been deleted.'));
}
}
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function room_reservations_admin_settings_sms_delete($form, &$form_state) {\n $sql = \"\n SELECT id, value\n FROM {room_reservations_variables}\n WHERE name = '%s'\n ORDER BY value\n \";\n $result = db_query($sql, 'carrier');\n if ($result) {\n $options = array();\n $options[strval(0)] = t('Select a wireless carrier');\n $x = 0;\n while ($data = db_fetch_object($result)) {\n $x++;\n $id = $data->id;\n $values = explode('~', $data->value);\n $options[strval($id)] = $values[0];\n $x++;\n }\n }\n if ($options) {\n $form['carrier'] = array(\n '#type' => 'select',\n '#title' => t('Wireless carrier'),\n '#options' => $options,\n '#weight' => 25,\n );\n $form['delete'] = array(\n '#type' => 'submit',\n '#value' => t('Delete'),\n '#weight' => 30,\n );\n }\n return $form;\n}",
"function room_reservations_admin_settings_sms_delete_validate($form_id, &$form_state) {\n if ($form_state['clicked_button']['#value'] == t('Delete')) {\n $carrier = $form_state['values']['carrier'];\n if (!$carrier) {\n $field = 'delete_carrier][carrier';\n $message = t('Wireless carrier is required.');\n form_set_error($field, check_plain($message));\n }\n }\n}",
"function room_reservations_admin_settings_sms_submit($form_id, &$form_state) {\n if ($form_state['clicked_button']['#value'] == t('Save configuration')) {\n $sms_option = $form_state['values']['sms_option'];\n $confirmation = ROOM_RESERVATIONS_SAVE_CONFIRMATION_MSG;\n $error = ROOM_RESERVATIONS_SAVE_ERROR_MSG;\n }\n if ($form_state['clicked_button']['#value'] == t('Reset to defaults')) {\n $sms_option = 0;\n $confirmation = ROOM_RESERVATIONS_RESET_CONFIRMATION_MSG;\n $error = ROOM_RESERVATIONS_RESET_ERROR_MSG;\n }\n $result = _room_reservations_set_variable('sms_option', $sms_option);\n if (!$result) {\n $errors = TRUE;\n }\n if ($errors) {\n drupal_set_message(check_plain($error), 'error');\n }\n else {\n drupal_set_message(check_plain($confirmation));\n }\n}",
"function room_reservations_admin_settings_mobile_submit($form_id, &$form_state) {\n if ($form_state['clicked_button']['#value'] == t('Save configuration')) {\n $mobile_url = trim($form_state['values']['mobile_url']);\n $main_database = trim($form_state['values']['main_database']);\n $confirmation = ROOM_RESERVATIONS_SAVE_CONFIRMATION_MSG;\n $error = ROOM_RESERVATIONS_SAVE_ERROR_MSG;\n }\n elseif ($form_state['clicked_button']['#value'] == t('Reset to defaults')) {\n $mobile_url = '';\n $main_database = '';\n $confirmation = ROOM_RESERVATIONS_RESET_CONFIRMATION_MSG;\n $error = ROOM_RESERVATIONS_RESET_ERROR_MSG;\n }\n $errors = FALSE;\n $result = _room_reservations_set_variable('mobile_url', $mobile_url);\n if (!$result) {\n $errors = TRUE;\n }\n $result = _room_reservations_set_variable('main_database', $main_database);\n if (!$result) {\n $errors = TRUE;\n }\n if ($errors) {\n drupal_set_message(check_plain($error), 'error');\n }\n else {\n drupal_set_message(check_plain($confirmation));\n }\n}",
"function simplenews_admin_newsletter_delete_submit($form, &$form_state) {\n $newsletter_id = $form_state['values']['newsletter_id'];\n $name = $form_state['values']['name'];\n\n // Delete newsletter.\n // Subscriptions are deleted by simplenews_simplenews_newsletter_delete()\n simplenews_newsletter_delete($newsletter_id);\n drupal_set_message(t('Newsletter %name has been deleted.', array('%name' => $name)));\n\n $form_state['redirect'] = 'admin/config/services/simplenews';\n}",
"function display_del_form() {\n global $cfg, $lang;\n \n if ($cfg['xml_lang'] == 'ja') {\n $h2_title = 'ログ削除';\n $h3_title = '全てのアクセスログを削除します。';\n $h3_msg = 'マジックワードを入力し、削除ボタンを押して下さい。';\n $h4_title = '※警告 : 使用上の注意';\n $h4_msg = 'このボタンは、テーブル内のデータを全て空にします。(空になるのはデータのみで、'.\n 'テーブルは削除されません。)<br />'.\n 'データベースを初期状態(空)に戻したい場合のみ、自己責任でご使用下さい。';\n } else {\n $h2_title = 'DELETE LOGS';\n $h3_title = 'DELETE ALL LOGS with magic words';\n $h3_msg = 'Enter the magic words and click the button.';\n $h4_title = 'WARNING : PLEASE USE THIS BUTTON WITH CARE.';\n $H4_msg = 'This button empties your log table. '.\n 'Yes, This button is very dangerous.<br />'.\n 'Please push this at your own risk.';\n }\n \n $delete_form =<<<EOD\n<h2>{$h2_title}</h2>\n<h3>{$h3_title}</h3>\n<p>{$h3_msg}</p>\n<div class=\"important\">\n<h4>{$h4_title}</h4>\n<p>{$h4_msg}</p>\n</div>\n<form method=\"post\" action=\"{$_SERVER['PHP_SELF']}\">\n<p>\n{$lang['magic_words']} : \n<input tabindex=\"6\" accesskey=\"m\" type=\"text\" name=\"del\" value=\"\" />\n</p>\n<p>\n<input tabindex=\"6\" accesskey=\"d\" type=\"submit\" value=\"{$lang['del_all_logs']}\" />\n</p>\n</form>\nEOD;\n return $delete_form;\n}",
"function execute()\n\t{\n\t\t$this->obj_form = New form_input;\n\t\t$this->obj_form->formname = \"transaction_delete\";\n\t\t$this->obj_form->language = $_SESSION[\"user\"][\"lang\"];\n\n\t\t$this->obj_form->action = \"accounts/gl/delete-process.php\";\n\t\t$this->obj_form->method = \"post\";\n\t\t\n\n\t\t// general\n\t\t$structure = NULL;\n\t\t$structure[\"fieldname\"] \t= \"code_gl\";\n\t\t$structure[\"type\"]\t\t= \"text\";\n\t\t$this->obj_form->add_input($structure);\n\n\t\t$structure = NULL;\n\t\t$structure[\"fieldname\"] \t= \"description\";\n\t\t$structure[\"type\"]\t\t= \"text\";\n\t\t$this->obj_form->add_input($structure);\n\n\n\t\t// hidden\n\t\t$structure = NULL;\n\t\t$structure[\"fieldname\"] \t= \"id_transaction\";\n\t\t$structure[\"type\"]\t\t= \"hidden\";\n\t\t$structure[\"defaultvalue\"]\t= $this->id;\n\t\t$this->obj_form->add_input($structure);\n\t\t\n\t\t\n\t\t// confirm delete\n\t\t$structure = NULL;\n\t\t$structure[\"fieldname\"] \t= \"delete_confirm\";\n\t\t$structure[\"type\"]\t\t= \"checkbox\";\n\t\t$structure[\"options\"][\"label\"]\t= \"Yes, I wish to delete this transaction and realise that once deleted the data can not be recovered.\";\n\t\t$this->obj_form->add_input($structure);\n\n\n\n\t\t/*\n\t\t\tCheck that the transaction can be deleted\n\t\t*/\n\n\t\t// define submit field\n\t\t$structure = NULL;\n\t\t$structure[\"fieldname\"]\t\t= \"submit\";\n\t\t$structure[\"type\"]\t\t= \"submit\";\n\t\t$structure[\"defaultvalue\"]\t= \"delete\";\n\t\t\t\t\n\t\t$this->obj_form->add_input($structure);\n\n\n\t\t\n\t\t// define subforms\n\t\t$this->obj_form->subforms[\"transaction_delete\"]\t= array(\"code_gl\", \"description\");\n\t\t$this->obj_form->subforms[\"hidden\"]\t\t= array(\"id_transaction\");\n\t\t\n\t\tif ($this->locked)\n\t\t{\n\t\t\t$this->obj_form->subforms[\"submit\"]\t= array();\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$this->obj_form->subforms[\"submit\"]\t= array(\"delete_confirm\", \"submit\");\n\t\t}\n\n\t\t\n\t\t// fetch the form data\n\t\t$this->obj_form->sql_query = \"SELECT code_gl, description FROM `account_gl` WHERE id='\". $this->id .\"' LIMIT 1\";\n\t\t$this->obj_form->load_data();\n\n\t}",
"function room_reservations_admin_settings_text_submit($form_id, &$form_state) {\n if ($form_state['clicked_button']['#value'] == t('Save configuration')) {\n $enable_text = $form_state['values']['enable_text'];\n $from_address = $form_state['values']['from_address'];\n $confirmation_header = $form_state['values']['confirmation_header'];\n $confirmation_owner = $form_state['values']['confirmation_owner'];\n $reminder_header = $form_state['values']['reminder_header'];\n $reminder_owner = $form_state['values']['reminder_owner'];\n $confirmation = ROOM_RESERVATIONS_SAVE_CONFIRMATION_MSG;\n $error = ROOM_RESERVATIONS_SAVE_ERROR_MSG;\n }\n elseif ($form_state['clicked_button']['#value'] == t('Reset to defaults')) {\n $enable_text = 0;\n $confirmation_header = '';\n $confirmation_owner = '';\n $reminder_header = '';\n $reminder_owner = '';\n $confirmation = ROOM_RESERVATIONS_RESET_CONFIRMATION_MSG;\n $error = ROOM_RESERVATIONS_RESET_ERROR_MSG;\n }\n $errors = FALSE;\n $result = _room_reservations_set_variable('enable_text', $enable_text);\n if (!$result) {\n $errors = TRUE;\n }\n $result = _room_reservations_set_variable('from_address_sms', $from_address);\n if (!$result) {\n $errors = TRUE;\n }\n $result = _room_reservations_set_variable('confirmation_header_text_sms', \n $confirmation_header);\n if (!$result) {\n $errors = TRUE;\n }\n $result = _room_reservations_set_variable('confirmation_owner_text_sms', \n $confirmation_owner);\n if (!$result) {\n $errors = TRUE;\n }\n $result = _room_reservations_set_variable('reminder_header_text_sms', \n $reminder_header);\n if (!$result) {\n $errors = TRUE;\n }\n $result = _room_reservations_set_variable('reminder_owner_text_sms', \n $reminder_owner);\n if (!$result) {\n $errors = TRUE;\n }\n if ($errors) {\n drupal_set_message(check_plain($error), 'error');\n }\n else {\n drupal_set_message(check_plain($confirmation));\n }\n}",
"function thumbwhere_host_form_submit_delete(&$form, &$form_state) {\n $form_state['redirect'] = 'admin/thumbwhere/thumbwhere_hosts/thumbwhere_host/' . $form_state['thumbwhere_host']->pk_host . '/delete';\n}",
"function guifi_domain_delete_confirm($form_state,$params) {\n\n $form['help'] = array(\n '#type' => 'item',\n '#title' => t('Are you sure you want to delete this domain?'),\n '#value' => $params['name'],\n '#description' => t('WARNING: This action cannot be undone. The domain and it\\'s related information will be <strong>permanently deleted</strong>, that includes:<ul><li>The domain</li><li>The related hosts</li><li>The related delegations</li></ul>If you are really sure that you want to delete this information, press \"Confirm delete\".'),\n '#weight' => 0,\n );\n $form['submit'] = array(\n '#type' => 'submit',\n '#value' => t('Confirm delete'),\n '#name' => 'confirm',\n '#weight' => 1,\n );\n drupal_set_title(t('Delete domain: (%name)',array('%name' => $params['name'])));\n variable_set('guifi_refresh_dns',time());\n return $form;\n}",
"function access_scheme_form_delete_submit($form, &$form_state) {\n if (isset($_GET['destination'])) {\n drupal_get_destination();\n unset($_GET['destination']);\n }\n $scheme = $form_state['scheme'];\n $form_state['redirect'] = 'admin/structure/access/' . str_replace('_', '-', $scheme->machine_name) . '/delete';\n}",
"function thumbwhere_host_delete_form_submit($form, &$form_state) {\n $thumbwhere_host = $form_state['thumbwhere_host'];\n\n thumbwhere_host_delete($thumbwhere_host);\n\n drupal_set_message(t('The thumbwhere_host %name has been deleted.', array('%name' => $thumbwhere_host->pk_host)));\n watchdog('thumbwhere_host', 'Deleted thumbwhere_host %name.', array('%name' => $thumbwhere_host->pk_host));\n\n $form_state['redirect'] = 'admin/thumbwhere/thumbwhere_hosts';\n}",
"function displayDeleteConfirmation()\n\t{\n\t\t$this->checkDisplayMode();\n\n\t\t// formular sent\n\t\tif ($_POST[\"form\"][\"delete\"])\n\t\t{\n\t\t\t$ini = true;\n\t\t\t$db = false;\n\t\t\t$files = false;\n\n\t\t\t/* disabled\n\t\t\tswitch ($_POST[\"form\"][\"delete\"])\n\t\t\t{\n\t\t\t\tcase 1:\n\t\t\t\t\t$ini = true;\n\t\t\t\t\tbreak;\n\t\t\t\n\t\t\t\tcase 2:\n\t\t\t\t\t$ini = true;\n\t\t\t\t\t$db = true;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 3:\n\t\t\t\t\t$ini = true;\n\t\t\t\t\t$db = true;\n\t\t\t\t\t$files = true;\n\t\t\t\t\tbreak; \n\t\t\t}\n\t\t\t*/\n\n\t\t\t$msg = $this->setup->getClient()->delete($ini,$db,$files);\n\n\t\t\tilUtil::sendInfo($this->lng->txt(\"client_deleted\"),true);\n\t\t\tilUtil::redirect(\"setup.php\");\n\t\t}\n\n\t\t$this->tpl->setVariable(\"TXT_INFO\", $this->lng->txt(\"info_text_delete\"));\n\n\t\t// output\n\t\t$this->tpl->addBlockFile(\"SETUP_CONTENT\",\"setup_content\",\"tpl.form_delete_client.html\", \"setup\");\n\n\t\t// delete panel\n\t\t$this->tpl->setVariable(\"FORMACTION\", \"setup.php?cmd=gateway\");\n\t\t$this->tpl->setVariable(\"TXT_DELETE\", $this->lng->txt(\"delete\"));\n\t\t$this->tpl->setVariable(\"TXT_DELETE_CONFIRM\", $this->lng->txt(\"delete_confirm\"));\n\t\t$this->tpl->setVariable(\"TXT_DELETE_INFO\", $this->lng->txt(\"delete_info\"));\n\n\t\t$this->checkPanelMode();\n\t}",
"public function gateway_cc_form()\n {\n // register the action to remove default CC form\n return;\n }",
"function execute()\n\t{\n\t\t$this->obj_form = New form_input;\n\t\t$this->obj_form->formname = \"chart_delete\";\n\t\t$this->obj_form->language = $_SESSION[\"user\"][\"lang\"];\n\n\t\t$this->obj_form->action = \"accounts/charts/delete-process.php\";\n\t\t$this->obj_form->method = \"post\";\n\t\t\n\n\t\t// general\n\t\t$structure = NULL;\n\t\t$structure[\"fieldname\"] \t= \"code_chart\";\n\t\t$structure[\"type\"]\t\t= \"text\";\n\t\t$this->obj_form->add_input($structure);\n\n\t\t$structure = NULL;\n\t\t$structure[\"fieldname\"] \t= \"description\";\n\t\t$structure[\"type\"]\t\t= \"text\";\n\t\t$this->obj_form->add_input($structure);\n\n\n\t\t// hidden\n\t\t$structure = NULL;\n\t\t$structure[\"fieldname\"] \t= \"id_chart\";\n\t\t$structure[\"type\"]\t\t= \"hidden\";\n\t\t$structure[\"defaultvalue\"]\t= $this->id;\n\t\t$this->obj_form->add_input($structure);\n\t\t\n\t\t\n\t\t// confirm delete\n\t\t$structure = NULL;\n\t\t$structure[\"fieldname\"] \t= \"delete_confirm\";\n\t\t$structure[\"type\"]\t\t= \"checkbox\";\n\t\t$structure[\"options\"][\"label\"]\t= \"Yes, I wish to delete this account and realise that once deleted the data can not be recovered.\";\n\t\t$this->obj_form->add_input($structure);\n\n\n\n\t\t// define submit field\n\t\t$structure = NULL;\n\t\t$structure[\"fieldname\"] = \"submit\";\n\t\t$structure[\"type\"]\t\t= \"submit\";\n\t\t$structure[\"defaultvalue\"]\t= \"delete\";\n\t\t$this->obj_form->add_input($structure);\n\n\n\t\t\n\t\t// define subforms\n\t\t$this->obj_form->subforms[\"chart_delete\"]\t= array(\"code_chart\", \"description\");\n\t\t$this->obj_form->subforms[\"hidden\"]\t\t= array(\"id_chart\");\n\n\t\tif ($this->locked)\n\t\t{\n\t\t\t$this->obj_form->subforms[\"submit\"]\t= array();\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$this->obj_form->subforms[\"submit\"]\t\t= array(\"delete_confirm\", \"submit\");\n\t\t}\n\n\t\t\n\t\t// fetch the form data\n\t\t$this->obj_form->sql_query = \"SELECT code_chart, description FROM `account_charts` WHERE id='\". $this->id .\"' LIMIT 1\";\n\t\t$this->obj_form->load_data();\n\t}",
"function print_delete_form($stu) {\n $url = 'index.php';\n $message = get_string('student_deleteconfirm', 'block_curr_admin', cm_fullname($stu->user));\n $optionsyes = array('s' => 'stu', 'section' => 'curr', 'id' => $stu->classid,\n 'action' => 'confirm', 'association_id' => $stu->id, 'confirm' => md5($stu->id));\n $optionsno = array('s' => 'stu', 'section' => 'curr', 'id' => $stu->classid);\n\n echo cm_delete_form($url, $message, $optionsyes, $optionsno);\n }",
"function node_form_delete_submit($form, &$form_state) {\n $destination = '';\n if (isset($_REQUEST['destination'])) {\n $destination = drupal_get_destination();\n unset($_REQUEST['destination']);\n }\n $node = $form['#node'];\n $form_state['redirect'] = array('node/'. $node->nid .'/delete', $destination);\n}",
"function ca_services_admin_settings_form_submit($form, &$form_state) {\n variable_set('ca_services_list_template', $form_state['values']['ca_services_list']);\n variable_set('ca_services_node_template', $form_state['values']['ca_services_node']);\n drupal_set_message('Configuration has been saved.');\n}",
"function getForm($form, &$form_state, $disabled, $myvalues)\n {\n $oPS = new \\raptor\\ProtocolSettings();\n $metainfo = $oPS->getProtocolMetaInformation($this->m_protocol_shortname);\n $usedcount = count($metainfo['usedbyinfo']);\n if($usedcount > 0)\n {\n $tickets = array();\n foreach($metainfo['usedbyinfo'] as $key=>$details)\n {\n $tickets[] = $key;\n }\n $userinfomsg = \"Cannot delete this protocol because already in use by the following $usedcount tickets: \" \n . implode(', ', $tickets);\n drupal_set_message($userinfomsg, 'warning');\n $disabled = TRUE;\n }\n \n $form = $this->m_oPageHelper->getForm('D',$form, $form_state, TRUE, $myvalues, 'protocol_container_styles');\n \n $form['data_entry_area1']['toppart']['protocol_shortname'] = array(\n '#type' => 'textfield', \n '#title' => t('Short Name'), \n '#value' => $this->m_protocol_shortname, \n '#size' => 20, \n '#maxlength' => 20, \n '#required' => TRUE,\n '#description' => t('The unique short name for this protocol'),\n '#disabled' => TRUE,\n ); \n \n \n //Replace the buttons\n $form[\"data_entry_area1\"]['create'] = array('#type' => 'submit'\n , '#attributes' => array('class' => array('admin-action-button'))\n , '#value' => t('Delete Protocol From System')\n , '#disabled' => $disabled\n );\n\n global $base_url;\n $goback = $this->getGobacktoFullURL();\n /*\n $form['data_entry_area1']['action_buttons']['cancel'] = array('#type' => 'item'\n , '#markup' => '<input class=\"admin-cancel-button\" id=\"user-cancel\"'\n . ' type=\"button\" value=\"Cancel\"'\n . ' data-redirect=\"'.$goback.'\">');\n */\n $form['data_entry_area1']['action_buttons']['cancel'] = $this->getExitButtonMarkup($goback);\n return $form;\n }",
"function wa_wcc_deactivation_delete(){\n\t\techo '\n\t\t<div id=\"wa_wcc_deactivation_delete\" class=\"wplikebtns\">';\n\t\tforeach($this->choices as $val => $trans)\n\t\t{\n\t\t\techo '\n\t\t\t<input id=\"wa-wcc-deactivation-delete-'.$val.'\" type=\"radio\" name=\"wa_wcc_configuration[deactivation_delete]\" value=\"'.esc_attr($val).'\" '.checked(($val === 'yes' ? TRUE : FALSE), $this->options['configuration']['deactivation_delete'], FALSE).' />\n\t\t\t<label for=\"wa-wcc-deactivation-delete-'.$val.'\">'.$trans.'</label>';\n\t\t}\n\t\techo '\n\t\t\t<p class=\"description\">'.__('Delete settings on plugin deactivation.', 'wa_wcc_txt').'</p>\n\t\t</div>';\n\t}",
"public function buildForm(array $form, FormStateInterface $form_state, $config_name = NULL) {\n if (empty($config_name)) {\n $url = Url::fromRoute('domain_config_ui.list');\n return new RedirectResponse($url->toString());\n }\n\n $elements = DomainConfigUIController::deriveElements($config_name);\n $config = \\Drupal::configFactory()->get($config_name)->getRawData();\n\n $form['help'] = [\n '#type' => 'item',\n '#title' => Html::escape($config_name),\n '#markup' => $this->t('Are you sure you want to delete the configuration\n override: %config_name?', ['%config_name' => $config_name]),\n '#prefix' => '<p>',\n '#suffix' => '</p>',\n ];\n if ($elements['language'] == $this->t('all')->render()) {\n $language = $this->t('all languages');\n }\n else {\n $language = $this->t('the @language language.', ['@language' => $elements['language']]);\n }\n $form['more_help'] = [\n '#markup' => $this->t('This configuration is for the %domain domain and\n applies to %language.', [\n '%domain' => $elements['domain'],\n '%language' => $language,\n ]\n ),\n '#prefix' => '<p>',\n '#suffix' => '</p>',\n ];\n $form['review'] = [\n '#type' => 'details',\n '#title' => $this->t('Review settings'),\n '#open' => FALSE,\n ];\n $form['review']['text'] = [\n '#markup' => DomainConfigUIController::printArray($config),\n ];\n $form['config_name'] = ['#type' => 'value', '#value' => $config_name];\n $form['actions']['#type'] = 'actions';\n $form['actions']['submit'] = [\n '#type' => 'submit',\n '#value' => $this->t('Delete configuration'),\n '#button_type' => 'primary',\n ];\n $form['actions']['cancel'] = [\n '#type' => 'link',\n '#title' => $this->t('Cancel'),\n '#url' => new Url('domain_config_ui.list'),\n '#attributes' => [\n 'class' => [\n 'button',\n ],\n ],\n ];\n return $form;\n }",
"function execute()\n\t{\n\t\t$this->obj_form = New form_input;\n\t\t$this->obj_form->formname = \"timebilled_delete\";\n\t\t$this->obj_form->language = $_SESSION[\"user\"][\"lang\"];\n\n\t\t$this->obj_form->action = \"projects/timebilled-delete-process.php\";\n\t\t$this->obj_form->method = \"post\";\n\t\n\t\n\t\t// general\n\t\t$structure = NULL;\n\t\t$structure[\"fieldname\"] \t= \"name_group\";\n\t\t$structure[\"type\"]\t\t= \"text\";\n\t\t$this->obj_form->add_input($structure);\n\n\t\t$structure = NULL;\n\t\t$structure[\"fieldname\"] \t= \"name_customer\";\n\t\t$structure[\"type\"]\t\t= \"text\";\n\t\t$this->obj_form->add_input($structure);\n\n\t\t$structure = NULL;\n\t\t$structure[\"fieldname\"] \t= \"description\";\n\t\t$structure[\"type\"]\t\t= \"text\";\n\t\t$this->obj_form->add_input($structure);\n\n\t\t$structure = NULL;\n\t\t$structure[\"fieldname\"] \t= \"code_invoice\";\n\t\t$structure[\"type\"]\t\t= \"text\";\n\t\t$this->obj_form->add_input($structure);\n\n\t\t$structure = NULL;\n\t\t$structure[\"fieldname\"] \t= \"delete_confirm\";\n\t\t$structure[\"type\"]\t\t= \"checkbox\";\n\t\t$structure[\"options\"][\"label\"]\t= \"Yes, I wish to delete this time group and realise that once deleted the data can not be recovered.\";\n\t\t$this->obj_form->add_input($structure);\n\n\t\n\n\n\t\t// hidden values\n\t\t$structure = NULL;\n\t\t$structure[\"fieldname\"]\t\t= \"projectid\";\n\t\t$structure[\"type\"]\t\t= \"hidden\";\n\t\t$structure[\"defaultvalue\"]\t= $this->id;\n\t\t$this->obj_form->add_input($structure);\n\t\t\n\t\t$structure = null;\n\t\t$structure[\"fieldname\"]\t\t= \"groupid\";\n\t\t$structure[\"type\"]\t\t= \"hidden\";\n\t\t$structure[\"defaultvalue\"]\t= $this->groupid;\n\t\t$this->obj_form->add_input($structure);\n\t\n\t\t\n\t\t// submit button\n\t\t$structure = NULL;\n\t\t$structure[\"fieldname\"] \t= \"submit\";\n\t\t$structure[\"type\"]\t\t= \"submit\";\n\t\t$structure[\"defaultvalue\"]\t= \"delete\";\n\t\t$this->obj_form->add_input($structure);\n\n\t\t\n\n\t\t// fetch the form data if editing\n\t\t$this->obj_form->sql_query = \"SELECT name_group, description, account_ar.code_invoice, CONCAT_WS(' -- ', customers.code_customer, customers.name_customer) as name_customer FROM time_groups LEFT JOIN customers ON customers.id = time_groups.customerid LEFT JOIN account_ar ON account_ar.id = time_groups.invoiceid WHERE time_groups.id='\". $this->groupid .\"' LIMIT 1\";\n\t\t$this->obj_form->load_data();\n\n\n\t\t// display the subforms\n\t\t$this->obj_form->subforms[\"timebilled_details\"]\t= array(\"name_group\", \"name_customer\", \"code_invoice\", \"description\");\n\t\t$this->obj_form->subforms[\"hidden\"]\t\t= array(\"projectid\", \"groupid\");\n\t\t\n\t\tif ($this->locked)\n\t\t{\n\t\t\t$this->obj_form->subforms[\"submit\"]\t= array();\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$this->obj_form->subforms[\"submit\"]\t= array(\"delete_confirm\", \"submit\");\n\t\t}\n\t}",
"function dolist_messages_mail_admin_bundle_delete_form_submit($form, &$form_state) {\n dolist_messages_mail_bundle_delete($form_state['values']['type']);\n\n $t_args = array('%name' => $form_state['values']['name']);\n drupal_set_message(t('The message bundle %name has been deleted.', $t_args));\n watchdog('node', 'Deleted message bundle %name.', $t_args, WATCHDOG_NOTICE);\n\n\n $form_state['redirect'] = 'admin/structure/dolist/messagesmail';\n return;\n}",
"function mongo_node_type_delete_form($form, $form_state, $entity_type) {\n $form = array();\n // Send entity type.\n $form['entity_type'] = array(\n '#type' => 'value',\n '#value' => $entity_type,\n );\n $path = '/admin/structure/mongo-node';\n\n $extist_entity_content = '';\n $collection = mongodb_collection('fields_current', $entity_type);\n $count = $collection->count(array('_type' => $entity_type));\n if ($count) {\n $extist_entity_content = t('%type is used by %count piece of content on your site. If you remove this entity type, you will not be able to edit the %type content and it may not display correctly.', array('%type' => $entity_type, '%count' => $count));\n $extist_entity_content .= '<br/><br/>';\n }\n return confirm_form($form, t('Delete entity type'), $path, $extist_entity_content . 'This action cannot be undone', t('Delete'), t('Cancel'), 'mongo_node_type_delete');\n}",
"function multisite_aggregate_type_form_submit_delete(&$form, &$form_state) {\n $form_state['redirect'] = 'admin/structure/multisite_aggregate_types/manage/' . $form_state['multisite_aggregate_type']->type . '/delete';\n}",
"function room_reservations_admin_settings_email_submit($form_id, &$form_state) {\n if ($form_state['clicked_button']['#value'] == t('Save configuration')) {\n $from_address = $form_state['values']['from_address'];\n $confirmation_header = $form_state['values']['confirmation_header'];\n $confirmation_owner = $form_state['values']['confirmation_owner'];\n $confirmation_group = $form_state['values']['confirmation_group'];\n $reminder_header = $form_state['values']['reminder_header'];\n $reminder_owner = $form_state['values']['reminder_owner'];\n $reminder_group = $form_state['values']['reminder_group'];\n $confirmation = ROOM_RESERVATIONS_SAVE_CONFIRMATION_MSG;\n $error = ROOM_RESERVATIONS_SAVE_ERROR_MSG;\n }\n elseif ($form_state['clicked_button']['#value'] == t('Reset to defaults')) {\n $confirmation_header = '';\n $confirmation_owner = '';\n $confirmation_group = '';\n $reminder_header = '';\n $reminder_owner = '';\n $reminder_group = '';\n $confirmation = ROOM_RESERVATIONS_RESET_CONFIRMATION_MSG;\n $error = ROOM_RESERVATIONS_RESET_ERROR_MSG;\n }\n $errors = FALSE;\n $result = _room_reservations_set_variable('from_address', $from_address);\n if (!$result) {\n $errors = TRUE;\n }\n $result = _room_reservations_set_variable('confirmation_header_text', \n $confirmation_header);\n if (!$result) {\n $errors = TRUE;\n }\n $result = _room_reservations_set_variable('confirmation_owner_text', \n $confirmation_owner);\n if (!$result) {\n $errors = TRUE;\n }\n $result = _room_reservations_set_variable('confirmation_group_text', \n $confirmation_group);\n if (!$result) {\n $errors = TRUE;\n }\n $result = _room_reservations_set_variable('reminder_header_text', \n $reminder_header);\n if (!$result) {\n $errors = TRUE;\n }\n $result = _room_reservations_set_variable('reminder_owner_text', \n $reminder_owner);\n if (!$result) {\n $errors = TRUE;\n }\n $result = _room_reservations_set_variable('reminder_group_text', \n $reminder_group);\n if (!$result) {\n $errors = TRUE;\n }\n if ($errors) {\n drupal_set_message(check_plain($error), 'error');\n }\n else {\n drupal_set_message(check_plain($confirmation));\n }\n}",
"function bigbluebutton_admin_meeting_room_delete_form_submit($form, &$form_state) {\n\n\t//debug($form_state, \"form_state\", $print_r = TRUE);\n\n \tdb_delete('meeting_room')\n\t\t->condition('mid', $form_state['build_info']['args'][0])\n \t->execute();\n\n \tdrupal_set_message(t('Meeting room %meeting_room_name has been deleted.', array('%meeting_room_name' => $form_state['values']['meeting_room_name'])));\n\n \t$form_state['redirect'] = 'admin/config/system/bigbluebutton/meeting_room';\n\n}",
"function opensanmateo_govdelivery_app_configure_form_submit($form, $form_state) {\n features_template_revert();\n}",
"function travel_type_form_submit_delete(&$form, &$form_state) {\n // Redirect user to \"Delete\" URI for this entity type.\n $form_state['redirect'] = 'admin/structure/travel/' . $form_state['travel_type']->type . '/delete';\n}",
"function bat_event_type_form_submit_delete(&$form, &$form_state) {\n $destination = array();\n if (isset($_GET['destination'])) {\n $destination = drupal_get_destination();\n unset($_GET['destination']);\n }\n\n $form_state['redirect'] = array('admin/bat/events/event_types/manage/' . $form_state['bat_event_type']->type . '/delete', array('query' => $destination));\n}"
] |
[
"0.66511065",
"0.5919083",
"0.5855203",
"0.5827445",
"0.58081716",
"0.5705306",
"0.5630422",
"0.56126505",
"0.5600904",
"0.5543898",
"0.5537571",
"0.55293095",
"0.55285144",
"0.5512737",
"0.5509876",
"0.54840416",
"0.54691327",
"0.54644895",
"0.54463357",
"0.54422945",
"0.5438694",
"0.54301506",
"0.5420368",
"0.54102814",
"0.5396609",
"0.53930634",
"0.53871167",
"0.5354301",
"0.53540534",
"0.5350213"
] |
0.69128877
|
0
|
Form validation for the Messages / Email Messages configuration page.
|
function room_reservations_admin_settings_email_validate($form_id, &$form_state) {
if ($form_state['clicked_button']['#value'] == t('Save configuration')) {
$from_address = $form_state['values']['from_address'];
if (valid_email_address($from_address)) {
// Valid.
}
else {
$field = 'from_address';
$message = t('Invalid email address.');
form_set_error($field, check_plain($message));
}
}
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function room_reservations_admin_settings_text_validate($form_id, &$form_state) {\n if ($form_state['clicked_button']['#value'] == t('Save configuration')) {\n $from_address = $form_state['values']['from_address'];\n if (valid_email_address($from_address)) {\n // Valid.\n }\n else {\n $field = 'from_address';\n $message = t('Invalid email address.');\n form_set_error($field, check_plain($message));\n }\n }\n}",
"public function check_form()\n\t{\n\t\tProfil_fields_forum::validate(PROFIL_FIELDS_CONTACT, 'contact', $this->errstr, Fsb::$session->id());\n\t}",
"function student_crm_webform_send_email_form_validate($form, $form_state) {\n if (strlen(trim($form_state['values']['manual-email'])) != '' && !valid_email_address($form_state['values']['manual-email'])) {\n form_set_error('manual-email', t('The provided email address is not valid.'));\n }\n}",
"function room_reservations_admin_settings_default_email_validate(\n $form_id, &$form_state) {\n if ($form_state['clicked_button']['#value'] == t('Save configuration')) {\n $option = $form_state['values']['options'];\n $domain = trim($form_state['values']['domain']);\n if (($option == 2) && (!$domain)) {\n $field = 'domain';\n $message = t('A domain name must be entered when this option is selected.');\n form_set_error($field, check_plain($message));\n }\n }\n}",
"function pdfbulletin_sendtest_form_validate($form, &$form_state) {\n $emails = explode(\"\\n\", $form_state['values']['subscribers']);\n foreach ($emails as $email) {\n $email = trim($email);\n if (! empty($email) && ! valid_email_address($email)) {\n form_set_error('subscribers', t('Invalid e-mail address: @email', array('@email' => $email)));\n }\n }\n}",
"function push_notifications_mass_push_form_validate($form, &$form_state) {\n $recipients = $form_state['values']['recipients'];\n\n // Define an empty array for the payload.\n $payload = array();\n\n // Add all \"message\" elements to the payload.\n // Other modules can alter the contents of the payload\n // array by adding additional elements to 'message'\n // when it implements hook_form_alter.\n $message_elements = $form_state['values']['message'];\n foreach ($message_elements as $key => $value) {\n $payload[$key] = $value;\n }\n\n // Store payload in the form_state.\n $form_state['values']['payload'] = $payload;\n\n // Make sure at least one recipient (group) is selected.\n if (empty($recipients['ios']) && empty($recipients['android']) && empty($form_state['values']['token'])) {\n form_set_error('recipients', t('No message was sent. Please select at least one recipient group.'));\n }\n\n // Validate that the message size is ok.\n if (!push_notifications_check_payload_size($form_state['values']['payload'])) {\n form_set_error('message', t('Your message exceeds the allowed size of !max_size bytes. Please shorten your message.', array(\n '!max_size' => PUSH_NOTIFICATIONS_APNS_PAYLOAD_SIZE_LIMIT,\n )));\n }\n}",
"function simplenews_admin_newsletter_form_validate($form, &$form_state) {\n if ($form_state['clicked_button']['#value'] != t('Delete')) {\n\n // Check for valid email address.\n if (!valid_email_address($form_state['values']['from_address'])) {\n form_set_error('from_address', t(\"The sender's email address you supplied is not valid.\"));\n }\n }\n}",
"function pdfbulletin_settings_form_validate(&$form, &$form_state) {\n // @todo SERIOUSLY\n}",
"function dolist_messages_mail_admin_bundle_instantate_form_validate($form, &$form_state) {\n drupal_set_message(t('Test rules actions'));\n entity_form_field_validate('messages_item', $form, $form_state);\n}",
"protected function _childValidation() {\n\n\t\t$languages = Language::getLanguages(true);\n\n\t\t// if action == 'message', related message required\n\n\t\tif (Tools::getValue('action_sender') === 'message') {\n\n\t\t\tforeach ($languages as $language) {\n\t\t\t\t$value = Tools::getValue('message_sender_' . $language['id_lang']);\n\n\t\t\t\tif (empty($value)) {\n\t\t\t\t\t$this->errors[] = $this->la('Please indicate a message to send to the sender.');\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\t// if action == 'message', related message required\n\n\t\tif (Tools::getValue('action_admin') === 'message') {\n\n\t\t\tforeach ($languages as $language) {\n\t\t\t\t$value = Tools::getValue('message_admin_' . $language['id_lang']);\n\n\t\t\t\tif (empty($value)) {\n\t\t\t\t\t$this->errors[] = $this->la('Please indicate the message to send to the admin(s).');\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\t// check every admin email,\n\t\t$send_mail_to = Tools::getValue('send_mail_to');\n\n\t\tif (empty($send_mail_to)) {\n\t\t\t$this->errors[] = $this->la('\"Send form to\" field is required.');\n\t\t} else {\n\t\t\t$emails = explode(',', Tools::getValue('send_mail_to'));\n\n\t\t\tforeach ($emails as $email) {\n\t\t\t\t$email = trim($email);\n\n\t\t\t\tif (!filter_var($email, FILTER_VALIDATE_EMAIL)) {\n\t\t\t\t\t$this->errors[] = $this->la('Invalid email provided in \"Send form to\". (Please separate emails with a comma)');\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\t$fields = [];\n\n\t\tforeach (PFGFieldModel::findFields(Tools::getValue('id_pfg')) as $field) {\n\t\t\t$fields[] = $field['name'];\n\t\t}\n\n\t\tforeach (['subject_sender', 'subject_admin', 'success', 'message_sender', 'message_admin'] as $variable_name) {\n\n\t\t\tforeach ($languages as $language) {\n\t\t\t\t$matches = [];\n\n\t\t\t\tpreg_match_all('/(\\{\\$([a-z0-9_]+)(\\[\\])?\\})/', Tools::getValue($variable_name . '_' . $language['id_lang']), $matches, PREG_SET_ORDER);\n\n\t\t\t\tif (count($matches) > 0) {\n\t\t\t\t\t$matches = $this->pregMatchReorder($matches);\n\n\t\t\t\t\tforeach ($matches as $match) {\n\n\t\t\t\t\t\tif (!in_array($match, $fields)) {\n\t\t\t\t\t\t\t$this->errors[] = sprintf($this->la('Invalid variable \"%s\". This name does not exists. (You need to create the field first)'), $match);\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}",
"function osg_singout_notifier_form_validate($form, & $form_state) {\n if (!valid_email_address($form_state['values']['email'])) {\n form_set_error('email', t('That e-mail address is not valid.'));\n }\n}",
"function pdfbulletin_subscribers_form_validate($form, &$form_state) {\n $emails = explode(\"\\n\", $form_state['values']['subscribers']);\n foreach ($emails as $email) {\n $email = trim($email);\n if (! empty($email) && ! valid_email_address($email)) {\n form_set_error('subscribers', t('Invalid e-mail address: @email', array('@email' => $email)));\n }\n }\n}",
"public function validate($form, &$form_state) {\n parent::validate($form, $form_state);\n\n $element = $form[$this->form_id . '_email'];\n webform_confirm_email_settings_validate($element, $form_state);\n }",
"function _check_member_event_options()\n\t{\n\t\t$rules['module_affiliate_marketing_member_events_alert_email'] = 'trim|valid_email';\n\t\t\n\t\t$this->validation->set_rules($rules);\n\t\t\n\t\t$fields['module_affiliate_marketing_member_events_alert_email'] = $this->lang->line('email');\n\t\t\n\t\t$this->validation->set_fields($fields);\n\t\t\t\n\t\tif ($this->validation->run() == FALSE)\t\n\t\t{\n\t\t\treturn false;\n\t\t}\n\t\t\n\t\treturn true;\n\t}",
"function _os2dagsorden_create_agenda_meeting_create_user_form_email_validate($element, $form, &$form_state) {\r\n $value = $element['#value'];\r\n if (!valid_email_address($value)) {\r\n form_error($element, t('Indtast en gyldig email adresse.'));\r\n }\r\n if (db_query(\"SELECT COUNT(*) FROM {users} WHERE mail = :mail;\", array(':mail' => $value))->fetchField()) {\r\n form_error($element, t('Der findes allerede en bruger med denne email.'));\r\n }\r\n}",
"function wpcf7cf_config_validator_validate(WPCF7_ConfigValidator $wpcf7_config_validator) {\r\r\n\r\r\n \t// TODO: For now we kill every syntax error once a [groupname] tag is detected.\r\r\n\t // Ideally, this function should check each string inside the group for invalid syntax.\r\r\n\t // TODO 2: ajax validation not working yet, because $cf->scan_form_tags() does not seem to contain group tags if it's an ajax request. Need to investigate.\r\r\n\r\r\n\t $cf = $wpcf7_config_validator->contact_form();\r\r\n\t $all_group_tags = $cf->scan_form_tags();\r\r\n\r\r\n \tforeach ($wpcf7_config_validator->collect_error_messages() as $err_type => $err) {\r\r\n\r\r\n\r\r\n\t\t $parts = explode('.',$err_type);\r\r\n\t\t $property = $parts[0];\r\r\n\t\t $sub_prop = $parts[1];\r\r\n\t\t $prop_val = $cf->prop($property)[$sub_prop];\r\r\n\r\r\n\r\r\n\t\t // TODO 2: Dirty hack. Because of TODO 2 we are just going to kill the error message if we detect the string '[/'\r\r\n\t\t // Start removing here.\r\r\n\t\t if (strpos($prop_val, '[/') !== false) {\r\r\n\t\t\t $wpcf7_config_validator->remove_error($err_type, WPCF7_ConfigValidator::error_invalid_mailbox_syntax);\r\r\n\t\t\t\tcontinue;\r\r\n\t\t }\r\r\n\t\t // TODO 2: Stop removing here. and uncomment code below.\r\r\n\r\r\n//\t\t foreach ($all_group_tags as $form_tag) {\r\r\n//\t\t\t\tif (strpos($prop_val, '['.$form_tag->name.']') !== false) {\r\r\n//\t\t\t\t\t$wpcf7_config_validator->remove_error($err_type, WPCF7_ConfigValidator::error_invalid_mailbox_syntax);\r\r\n//\t\t\t\t}\r\r\n//\t\t }\r\r\n\r\r\n\t }\r\r\n\r\r\n \treturn new WPCF7_ConfigValidator($wpcf7_config_validator->contact_form());\r\r\n }",
"function postageapp_admin_form_validate($form, &$form_state) { \n //\n $api_key = $form_state['values']['postageapp_api_key'];\n \n if ($api_key) {\n $postage = new PostageApp($api_key);\n $valid_key = $postage->get_project_info();\n \n if ($valid_key->response->status == 'ok') {\n drupal_set_message(t('Your API key is valid. Welcome to PostageApp.'), \"status\");\n drupal_set_message(t('To complete settings add \"$conf[\\'mail_system\\'][\\'default-system\\'] = \\'PostageappDrupalMail\\';\" to settings.php (without duoble quotes). This settings override default mail system in Drupal to use Postageapp as mail delivery service.'), 'info');\n }\n else {\n form_set_error('postageapp_api_key', t($valid_key->response->message));\n }\n }\n}",
"public function initMessages()\n {\n $this->messages = [\n 'alpha' => '{{name}} must only contain alphabetic characters.',\n 'alnum' => '{{name}} must only contain alpha numeric characters and dashes.',\n 'noWhitespace' => '{{name}} must not contain white spaces.',\n 'length' => '{{name}} must length between {{minValue}} and {{maxValue}}.',\n 'email' => 'Please make sure you typed a correct email address.'\n ];\n }",
"public function afterValidate() {\n if($_POST['content_en'] == '') $this->addError('content_en', Yii::t('base', 'You should fill post content for at least English language'));\n return parent::afterValidate();\n }",
"function messenger_config_form($form, &$form_state)\n{\n\n $form[MESSENGER_URL] = array(\n '#type' => 'textfield',\n '#title' => t('API url'),\n '#default_value' => variable_get(MESSENGER_URL, ''),\n '#description' => t('The api url. eg: http://api.domain.com'),\n '#required' => TRUE,\n );\n\n $form[MESSENGER_SECRET] = array(\n '#type' => 'textfield',\n '#title' => t('Secret'),\n '#default_value' => variable_get(MESSENGER_SECRET, ''),\n '#description' => t('API secret.'),\n '#required' => TRUE,\n );\n\n $form[GIPHY_API] = array(\n '#type' => 'textfield',\n '#title' => t('Giphy api key'),\n '#default_value' => variable_get(GIPHY_API, DEFAULT_GIPHY_API),\n '#description' => t('Enter Giphy api.'),\n '#required' => TRUE,\n );\n\n $form[GIPHY_EXCLUDE_KEYWORD] = array(\n '#type' => 'textarea',\n '#title' => t('Giphy exclude keywords'),\n '#default_value' => variable_get(GIPHY_EXCLUDE_KEYWORD, ''),\n '#description' => t('Enter a word per line'),\n '#required' => FALSE,\n );\n\n //MESSENGER_OFFSET\n $form[MESSENGER_OFFSET] = array(\n '#type' => 'textfield',\n '#title' => t('Inbox Offset Height'),\n '#default_value' => variable_get(MESSENGER_OFFSET, 300),\n '#description' => t('Use offset to calculate height of inbox'),\n '#required' => FALSE,\n );\n\n return system_settings_form($form);\n\n\n}",
"function checkEmailForm(&$smartyEmailForm) {\n\t\t//Retrieve submitted form fields\n\t\t$title = t3lib_div::_POST('title');\n\t\t$firstname = t3lib_div::_POST('firstname');\n\t\t$surname = t3lib_div::_POST('surname');\n\t\t$phone = t3lib_div::_POST('phone');\n\t\t$fax = t3lib_div::_POST('fax');\n\t\t$email = t3lib_div::_POST('email');\n\t\t$street = t3lib_div::_POST('street');\n\t\t$postcode = t3lib_div::_POST('postcode');\n\t\t$city = t3lib_div::_POST('city');\n\t\t$subject = t3lib_div::_POST('subject');\n\t\t$bodytext = t3lib_div::_POST('bodytext');\n\n\t\t// Bool variable that indicates whether filled email form is valid or not\n\t\t$is_valid = true;\n\n\t\t// Get Email-Adress or otherwise false\n\t\t$email_address = $this->getEmailAddress($smartyEmailForm);\n\n\t\t// Check if there is a valid email address in the database for the given combination of employee, service, position and organisation id\n\t\tif ($email_address) {\n\n\t\t\t// Check submitted form fields\n\t\t\tif (empty($surname)) {\n\t\t\t\t$smartyEmailForm->assign('error_surname',$this->pi_getLL('tx_civserv_pi1_email_form.error_surname','Please enter your surname!'));\n\t\t\t\t$is_valid = false;\n\t\t\t}\n\n\t\t\tif (empty($firstname)) {\n\t\t\t\t$smartyEmailForm->assign('error_firstname',$this->pi_getLL('tx_civserv_pi1_email_form.error_firstname','Please enter your firstname!'));\n\t\t\t\t$is_valid = false;\n\t\t\t}\n\n\t\t\tif (!empty($postcode) && !is_numeric($postcode)) {\n\t\t\t\t$smartyEmailForm->assign('error_postcode',$this->pi_getLL('tx_civserv_pi1_email_form.error_postcode','Please enter a valid postcode!'));\n\t\t\t\t$is_valid = false;\n\t\t\t}\n\n\t\t\tif (!empty($email) && !t3lib_div::validEmail($email)) {\n\t\t\t\t$smartyEmailForm->assign('error_email',$this->pi_getLL('tx_civserv_pi1_debit_form.error_email','Please enter a valid email address!'));\n\t\t\t\t$is_valid = false;\n\t\t\t}\n\n\t\t\tif (empty($subject)) {\n\t\t\t\t$smartyEmailForm->assign('error_subject',$this->pi_getLL('tx_civserv_pi1_email_form.error_subject','Please enter a subject!'));\n\t\t\t\t$is_valid = false;\n\t\t\t}\n\n\t\t\tif (empty($bodytext)) {\n\t\t\t\t$smartyEmailForm->assign('error_bodytext',$this->pi_getLL('tx_civserv_pi1_email_form.error_bodytext','Please enter your text!'));\n\t\t\t\t$is_valid = false;\n\t\t\t}\n\n\t\t\tif ($is_valid) {\n\n\t\t\t\t// Format body of email message\n\t\t\t\t$body = $this->pi_getLL('tx_civserv_pi1_email_form.title','Title') . ': ' . $title.\n\t\t\t\t \"\\n\" . $this->pi_getLL('tx_civserv_pi1_email_form.firstname','Firstname') . ': ' . $firstname.\n\t\t\t\t \"\\n\" . $this->pi_getLL('tx_civserv_pi1_email_form.surname','Surname') . ': ' . $surname.\n\t\t\t\t \"\\n\" . $this->pi_getLL('tx_civserv_pi1_email_form.phone','Phone') . ': ' . $phone.\n\t\t\t\t \"\\n\" . $this->pi_getLL('tx_civserv_pi1_email_form.fax','Fax') . ': ' . $fax.\n\t\t\t\t \"\\n\" . $this->pi_getLL('tx_civserv_pi1_email_form.email','E-Mail') . ': ' . $email.\n\t\t\t\t \"\\n\" . $this->pi_getLL('tx_civserv_pi1_email_form.street','Street, Nr.') . ': ' .$street.\n\t\t\t\t \"\\n\" . $this->pi_getLL('tx_civserv_pi1_email_form.postcode','Postcode') . ': ' . $postcode.\n\t\t\t\t \"\\n\" . $this->pi_getLL('tx_civserv_pi1_email_form.city','City') . ': ' . $city.\n\t\t\t\t \"\\n\" . $this->pi_getLL('tx_civserv_pi1_email_form.subject','Subject') . ': ' . $subject.\n\t\t\t\t \"\\n\" .\n\t\t\t\t \"\\n\" . $this->pi_getLL('tx_civserv_pi1_email_form.bodytext','Your text') . ': ' .\n\t\t\t\t \"\\n\" . $bodytext;\n\t\t\t\t//todo: check possibilities of header injection\n\t\t\t\tif(!empty($email)){\t\t// email given in contact-form is correct\n\t\t\t\t\t$headers = \"From: \".$email.\"\\r\\nReply-To: \".$email.\"\\r\\n\";\n\t\t\t\t}else{ // set email retrieved via hoster_get_email\n\t\t\t\t\t$headers = \"From: \".$email_address.\"\\r\\nReply-To: \".$email_address.\"\\r\\n\";\n\t\t\t\t}\n\n\t\t\t\tt3lib_div::plainMailEncoded($email_address, $subject, $body, $headers);\n\t\t\t\t$reply = $this->pi_getLL('tx_civserv_pi1_email_form.complete','Thank you! Your message has been sent successfully ');\n\t\t\t\t$reply .= $this->pi_getLL('tx_civserv_pi1_email_form.to','to ');\n\t\t\t\t$reply .= $email_address.\".\";\n\t\t\t\t$smartyEmailForm->assign('complete',$reply);\n\n\t\t\t\treturn true;\n\t\t\t} else { //Return email form template with error markers\n\t\t\t\tif($this->piVars['mode'] == \"check_contact_form\"){\n\t\t\t\t\t// Assign action url of email form\n\t\t\t\t\t$smartyEmailForm->assign('action_url',htmlspecialchars($this->pi_linkTP_keepPIvars_url(array(mode => 'check_contact_form'),0,0)));\n\t\t\t\t} else {\n\t\t\t\t\t// Assign action url of email form\n\t\t\t\t\t$smartyEmailForm->assign('action_url',htmlspecialchars($this->pi_linkTP_keepPIvars_url(array(mode => 'check_email_form'),0,0)));\n\t\t\t\t}\n\n\t\t\t\t// Set form fields to previously entered values\n\t\t\t\t$smartyEmailForm->assign('firstname',$firstname);\n\t\t\t\t$smartyEmailForm->assign('surname',$surname);\n\t\t\t\t$smartyEmailForm->assign('phone',$phone);\n\t\t\t\t$smartyEmailForm->assign('fax',$fax);\n\t\t\t\t$smartyEmailForm->assign('email',$email);\n\t\t\t\t$smartyEmailForm->assign('street',$street);\n\t\t\t\t$smartyEmailForm->assign('postcode',$postcode);\n\t\t\t\t$smartyEmailForm->assign('city',$city);\n\t\t\t\t$smartyEmailForm->assign('subject',$subject);\n\t\t\t\t$smartyEmailForm->assign('bodytext',$bodytext);\n\n\t\t\t\t// Assign template labels\n\t\t\t\t$hoster_email=$this->get_hoster_email();\n\t\t\t\t$smartyEmailForm->assign('email_form_label',$this->pi_getLL('tx_civserv_pi1_email_form.email_form','E-Mail Form'));\n\t\t\t\t$smartyEmailForm->assign('contact_form_label',str_replace('###HOSTER###', $hoster_email, $this->pi_getLL('tx_civserv_pi1_email_form.contact_form','Contact '.$hoster_email)));\n\t\t\t\t$smartyEmailForm->assign('notice_label',$this->pi_getLL('tx_civserv_pi1_email_form.notice','Please enter your postal address oder email address, so that we can send you an answer'));\n\t\t\t\t$smartyEmailForm->assign('title_label', $this->pi_getLL('tx_civserv_pi1_email_form.title','Title'));\n\t\t\t\t$smartyEmailForm->assign('chose_option', $this->pi_getLL('tx_civserv_pi1_email_form.chose','Please chose'));\n\t\t\t\t$smartyEmailForm->assign('female_option', $this->pi_getLL('tx_civserv_pi1_email_form.female','Ms.'));\n\t\t\t\t$smartyEmailForm->assign('male_option', $this->pi_getLL('tx_civserv_pi1_email_form.male','Mr.'));\n\t\t\t\t$smartyEmailForm->assign('firstname_label',$this->pi_getLL('tx_civserv_pi1_email_form.firstname','Firstname'));\n\t\t\t\t$smartyEmailForm->assign('surname_label',$this->pi_getLL('tx_civserv_pi1_email_form.surname','Surname'));\n\t\t\t\t$smartyEmailForm->assign('street_label',$this->pi_getLL('tx_civserv_pi1_email_form.street','Street, Nr.'));\n\t\t\t\t$smartyEmailForm->assign('postcode_label',$this->pi_getLL('tx_civserv_pi1_email_form.postcode','Postcode'));\n\t\t\t\t$smartyEmailForm->assign('city_label',$this->pi_getLL('tx_civserv_pi1_email_form.city','City'));\n\t\t\t\t$smartyEmailForm->assign('email_label',$this->pi_getLL('tx_civserv_pi1_email_form.email','E-Mail'));\n\t\t\t\t$smartyEmailForm->assign('phone_label',$this->pi_getLL('tx_civserv_pi1_email_form.phone','Phone'));\n\t\t\t\t$smartyEmailForm->assign('fax_label',$this->pi_getLL('tx_civserv_pi1_email_form.fax','Fax'));\n\t\t\t\t$smartyEmailForm->assign('subject_label',$this->pi_getLL('tx_civserv_pi1_email_form.subject','Subject'));\n\t\t\t\t$smartyEmailForm->assign('bodytext_label',$this->pi_getLL('tx_civserv_pi1_email_form.bodytext','Your text'));\n\t\t\t\t$smartyEmailForm->assign('submit_label',$this->pi_getLL('tx_civserv_pi1_email_form.submit','Send e-mail'));\n\t\t\t\t$smartyEmailForm->assign('reset_label',$this->pi_getLL('tx_civserv_pi1_email_form.reset','Reset'));\n\t\t\t\t$smartyEmailForm->assign('required_label',$this->pi_getLL('tx_civserv_pi1_email_form.required','required'));\n\n\t\t\t\t// Set reset button type to submit functionality (necessary for resetting email form in 'check_email_form'-mode)\n\t\t\t\t$smartyEmailForm->assign('button_type','submit');\n\n\t\t\t\treturn true;\n\t\t\t} // End return email form template with error markers\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}",
"protected function validateForm()\n {\n if (!$this->user->hasPermission('modify', 'domain/domain')) {\n $this->error['warning'] = $this->language->get('error_permission');\n }\n\n if (empty($this->request->post['domain']) || !isset($this->request->post['domain'])) {\n $this->error['domain'] = $this->language->get('error_domain');\n } else {\n if (!preg_match('~^https?://(?:[a-z0-9](?:[-a-z0-9]*[a-z0-9])?\\.)+[a-z](?:[-a-z0-9]*[a-z0-9])?\\.?(?:$|/)~', $this->request->post['domain'])) {\n $this->error['domain'] = $this->language->get('error_domain');\n }\n }\n\n if (empty($this->request->post['currency_id'] || !isset($this->request->post['currency_id']))) {\n $this->error['currency'] = $this->language->get('error_currency');\n }\n\n if (empty($this->request->post['currency_title'] || !isset($this->request->post['currency_title']))) {\n $this->error['currency'] = $this->language->get('error_currency');\n }\n\n if ($this->error && !isset($this->error['warning'])) {\n $this->error['warning'] = $this->language->get('error_warning');\n }\n\n return !$this->error;\n }",
"public function on_before_submit() {\n\t\t\n\t\t/*\n\t\tif (!some_function_to_validate_emails($_REQUEST['Question3'])) { \n\t\t\t$this->controller->errors['email'] = t('Please enter a valid email address');\n\t\t}\n\t\t*/\n\t}",
"function webform_confirm_email_webform_emails_form_validate(&$form, &$form_state) {\n foreach(array('email_option', 'email_component') as $index) {\n if (isset($form_state['values'][$index]) == FALSE) {\n $form_state['values'][$index] = NULL;\n }\n }\n if (!isset($form_state['values']['status'])) {\n $form_state['values']['status'] = 1;\n }\n\n if ( isset($form_state['triggering_element']['#submit'][0])\n && $form_state['triggering_element']['#submit'][0] == 'webform_emails_form_status_save') {\n if (isset($form_state['values']['emails']['add_button'])) {\n unset($form_state['values']['emails']['add_button']);\n }\n foreach($form_state['values']['confirmation_request'] as $eid => $email) {\n if ($eid != 'add_button') {\n $form_state['values']['emails'][$eid]['status'] = $email['status'];\n }\n }\n foreach($form_state['values']['confirmation'] as $eid => $email) {\n if ($eid != 'add_button') {\n $form_state['values']['emails'][$eid]['status'] = $email['status'];\n }\n }\n }\n}",
"public function rules()\n {\n\treturn array(\n\t array('name, email, subject, body', 'required'),\n\t array('email', 'email'),\n\t //array('verifyCode', 'captcha', 'allowEmpty' => !CCaptcha::checkRequirements(), 'captchaAction' => $this->captchaAction),\n\t array('token', 'compare', 'compareValue' => Yii::app()->user->getState(ContactForm::TOKEN_VAR)),\n\t);\n }",
"public function validateForm(array &$form, FormStateInterface $form_state) {\n parent::validateForm($form, $form_state);\n $message = $form_state->getValue('comment_body');\n if (empty($message)){\n // Set an error for the form element with a key of \"accept\".\n $form_state->setErrorByName('comment_body', $this->t('The message is required.'));\n }\n }",
"public function messages(){\n return [\n //\"email.required\" => \"メールアドレスを入力してください\",\n //\"email.max\" => \"**文字以下で入力してください\",\n ];\n }",
"function form_validation_rules()\n\t{\n\t\t$this->form_validation->set_message('required', '%s tidak boleh kosong');\n\t}",
"public function messages()\n {\n return [\n //'order_number'=>'required|unique:jobs|min:10|max:11',\n 'contact_id.exists'=>'Please select a contact from the company',\n ];\n }",
"protected function ValidateForm()\n {\n return true;\n }"
] |
[
"0.68067855",
"0.6649662",
"0.66189224",
"0.65585625",
"0.6552389",
"0.64861137",
"0.64534605",
"0.64202034",
"0.6412695",
"0.63945115",
"0.6378396",
"0.635023",
"0.62875974",
"0.62538695",
"0.62417173",
"0.6211243",
"0.61846143",
"0.6183387",
"0.6162612",
"0.61427397",
"0.61192364",
"0.6115619",
"0.61021",
"0.60980344",
"0.60943264",
"0.6067623",
"0.60446733",
"0.60386896",
"0.6032991",
"0.60245436"
] |
0.67713696
|
1
|
Form validatiion for the Messages / SMS Messages configuration page.
|
function room_reservations_admin_settings_text_validate($form_id, &$form_state) {
if ($form_state['clicked_button']['#value'] == t('Save configuration')) {
$from_address = $form_state['values']['from_address'];
if (valid_email_address($from_address)) {
// Valid.
}
else {
$field = 'from_address';
$message = t('Invalid email address.');
form_set_error($field, check_plain($message));
}
}
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function messenger_config_form($form, &$form_state)\n{\n\n $form[MESSENGER_URL] = array(\n '#type' => 'textfield',\n '#title' => t('API url'),\n '#default_value' => variable_get(MESSENGER_URL, ''),\n '#description' => t('The api url. eg: http://api.domain.com'),\n '#required' => TRUE,\n );\n\n $form[MESSENGER_SECRET] = array(\n '#type' => 'textfield',\n '#title' => t('Secret'),\n '#default_value' => variable_get(MESSENGER_SECRET, ''),\n '#description' => t('API secret.'),\n '#required' => TRUE,\n );\n\n $form[GIPHY_API] = array(\n '#type' => 'textfield',\n '#title' => t('Giphy api key'),\n '#default_value' => variable_get(GIPHY_API, DEFAULT_GIPHY_API),\n '#description' => t('Enter Giphy api.'),\n '#required' => TRUE,\n );\n\n $form[GIPHY_EXCLUDE_KEYWORD] = array(\n '#type' => 'textarea',\n '#title' => t('Giphy exclude keywords'),\n '#default_value' => variable_get(GIPHY_EXCLUDE_KEYWORD, ''),\n '#description' => t('Enter a word per line'),\n '#required' => FALSE,\n );\n\n //MESSENGER_OFFSET\n $form[MESSENGER_OFFSET] = array(\n '#type' => 'textfield',\n '#title' => t('Inbox Offset Height'),\n '#default_value' => variable_get(MESSENGER_OFFSET, 300),\n '#description' => t('Use offset to calculate height of inbox'),\n '#required' => FALSE,\n );\n\n return system_settings_form($form);\n\n\n}",
"public function check_form()\n\t{\n\t\tProfil_fields_forum::validate(PROFIL_FIELDS_CONTACT, 'contact', $this->errstr, Fsb::$session->id());\n\t}",
"function push_notifications_mass_push_form_validate($form, &$form_state) {\n $recipients = $form_state['values']['recipients'];\n\n // Define an empty array for the payload.\n $payload = array();\n\n // Add all \"message\" elements to the payload.\n // Other modules can alter the contents of the payload\n // array by adding additional elements to 'message'\n // when it implements hook_form_alter.\n $message_elements = $form_state['values']['message'];\n foreach ($message_elements as $key => $value) {\n $payload[$key] = $value;\n }\n\n // Store payload in the form_state.\n $form_state['values']['payload'] = $payload;\n\n // Make sure at least one recipient (group) is selected.\n if (empty($recipients['ios']) && empty($recipients['android']) && empty($form_state['values']['token'])) {\n form_set_error('recipients', t('No message was sent. Please select at least one recipient group.'));\n }\n\n // Validate that the message size is ok.\n if (!push_notifications_check_payload_size($form_state['values']['payload'])) {\n form_set_error('message', t('Your message exceeds the allowed size of !max_size bytes. Please shorten your message.', array(\n '!max_size' => PUSH_NOTIFICATIONS_APNS_PAYLOAD_SIZE_LIMIT,\n )));\n }\n}",
"function pdfbulletin_settings_form_validate(&$form, &$form_state) {\n // @todo SERIOUSLY\n}",
"function vals_soc_admin_messages_form($form, $form_state) {\n $complete_this_section = t('Complete this section');\n $accepted_orgs_prev_input = variable_get('vals_accepted_organisations_message', array('value' => $complete_this_section, 'format' => 'full_html'));\n $form['vals_accepted_organisations_message'] = array(\n '#type' => 'text_format',\n '#base_type' => 'textarea',\n '#title' => t('Accepted organisations message'),\n '#default_value' => $accepted_orgs_prev_input['value'],\n '#suffix' => '<p></p>',\n );\n $rejected_orgs_prev_input = variable_get('vals_rejected_organisations_message', array('value' => $complete_this_section, 'format' => 'full_html'));\n $form['vals_rejected_organisations_message'] = array(\n '#type' => 'text_format',\n '#base_type' => 'textarea',\n '#title' => t('Rejected organisations message'),\n '#default_value' => $rejected_orgs_prev_input['value'],\n '#suffix' => '<p></p>',\n );\n $mentor_welcome_prev_input = variable_get('vals_mentor_welcome_message', array('value' => $complete_this_section, 'format' => 'full_html'));\n $form['vals_mentor_welcome_message'] = array(\n '#type' => 'text_format',\n '#base_type' => 'textarea',\n '#title' => t('Mentor welcome message'),\n '#default_value' => $mentor_welcome_prev_input['value'],\n '#suffix' => '<p></p>',\n );\n $student_welcome_prev_input = variable_get('vals_student_welcome_message', array('value' => $complete_this_section, 'format' => 'full_html'));\n $form['vals_student_welcome_message'] = array(\n '#type' => 'text_format',\n '#base_type' => 'textarea',\n '#title' => t('Student welcome message'),\n '#default_value' => $student_welcome_prev_input['value'],\n '#suffix' => '<p></p>',\n );\n $accepted_students_prev_input = variable_get('vals_accepted_students_message', array('value' => $complete_this_section, 'format' => 'full_html'));\n $form['vals_accepted_students_message'] = array(\n '#type' => 'text_format',\n '#base_type' => 'textarea',\n '#title' => t('Accepted students message'),\n '#default_value' => $accepted_students_prev_input['value'],\n '#suffix' => '<p></p>',\n );\n $rejected_students_prev_input = variable_get('vals_rejected_students_message', array('value' => $complete_this_section, 'format' => 'full_html'));\n $form['vals_rejected_students_message'] = array(\n '#type' => 'text_format',\n '#base_type' => 'textarea',\n '#title' => t('Rejected students message'),\n '#default_value' => $rejected_students_prev_input['value'],\n '#suffix' => '<p></p>',\n );\n $form['vals_messages_test_email'] = array(\n '#type' => 'textfield',\n '#title' => t('Test email address'),\n '#default_value' => '', // dont store this\n '#size' => 60,\n '#maxlength' => 128,\n '#required' => FALSE,\n '#prefix' => '',\n '#suffix' => '<div>' . t('Email address to which test messages must be sent. If provided, a ' .\n 'test email is sent for each of the messages on this page to the given address') . '.</div>',\n );\n $form['vals_messages_test_cron_email'] = array(\n '#type' => 'checkbox',\n '#title' => 'cron email test',\n '#tree' => TRUE,\n '#default_value' => 0,\n );\n $form['#validate'][] = 'vals_soc_admin_messages_form_validate';\n $form['#submit'][] = 'vals_soc_admin_messages_form_submit';\n return system_settings_form($form);\n}",
"function room_reservations_admin_settings_sms_add_validate($form_id, &$form_state) {\n if ($form_state['clicked_button']['#value'] == t('Add')) {\n $carrier = $form_state['values']['carrier'];\n $domain = $form_state['values']['domain'];\n if (!$carrier) {\n $field = 'add_carrier][carrier';\n $message = t('Wireless carrier is required.');\n form_set_error($field, check_plain($message));\n }\n if (!$domain) {\n $field = 'add_carrier][domain';\n $message = t('Domain name is required.');\n form_set_error($field, check_plain($message));\n }\n else {\n if (drupal_substr($domain, 0, 1) != '@') {\n $field = 'add_carrier][domain';\n $message = t('Domain name must begin with @.');\n form_set_error($field, check_plain($message));\n }\n }\n if (($carrier) && ($domain)) {\n $sql = \"\n SELECT value\n FROM {room_reservations_variables}\n WHERE name = '%s'\n \";\n $result = db_query($sql, 'carrier');\n if ($result) {\n while ($data = db_fetch_object($result)) {\n $values = explode('~', $data->value);\n if ($values[0] == $carrier) {\n $field = 'add_carrier][carrier';\n $message = t('There is already a record for this wireless\n carrier.');\n form_set_error($field, $message);\n break;\n }\n }\n }\n }\n }\n}",
"protected function postSendSMSTempValidation()\n {\n if (Tools::isSubmit('sendSingleSMS')) {\n $mobile = Tools::getValue('SEND_SINGLE_SMS_MOBILE');\n \n if (!Tools::getValue('SEND_SINGLE_SMS_MOBILE')) :\n $this->postSendSMSTempError[] = $this->l('Mobile number is required.');\n elseif (preg_match('/[^0-9]/', $mobile)) :\n $this->postSendSMSTempError[] = $this->l('Please add valid mobile number.');\n elseif (!Tools::getValue('SEND_SINGLE_SENDER_ID')) :\n $this->postSendSMSTempError[] = $this->l('Sender Id is required.');\n elseif (!Tools::getValue('SEND_SINGLE_SMS_LABEL')) :\n $this->postSendSMSTempError[] = $this->l('Select Label is required.');\n elseif (!Tools::getValue('SEND_SIGNLE_SMS_BODY')) :\n $this->postSendSMSTempError[] = $this->l('Message body is required.');\n elseif ($this->smsAPI == '' || $this->smsAPI == null) :\n $this->postSendSMSTempError[] = $this->l('Please configure user API details.');\n endif;\n }\n return $this->postSendSMSTempError;\n }",
"function form_validation_rules()\n\t{\n\t\t$this->form_validation->set_message('required', '%s tidak boleh kosong');\n\t}",
"protected function validateForm()\n {\n if (!$this->user->hasPermission('modify', 'domain/domain')) {\n $this->error['warning'] = $this->language->get('error_permission');\n }\n\n if (empty($this->request->post['domain']) || !isset($this->request->post['domain'])) {\n $this->error['domain'] = $this->language->get('error_domain');\n } else {\n if (!preg_match('~^https?://(?:[a-z0-9](?:[-a-z0-9]*[a-z0-9])?\\.)+[a-z](?:[-a-z0-9]*[a-z0-9])?\\.?(?:$|/)~', $this->request->post['domain'])) {\n $this->error['domain'] = $this->language->get('error_domain');\n }\n }\n\n if (empty($this->request->post['currency_id'] || !isset($this->request->post['currency_id']))) {\n $this->error['currency'] = $this->language->get('error_currency');\n }\n\n if (empty($this->request->post['currency_title'] || !isset($this->request->post['currency_title']))) {\n $this->error['currency'] = $this->language->get('error_currency');\n }\n\n if ($this->error && !isset($this->error['warning'])) {\n $this->error['warning'] = $this->language->get('error_warning');\n }\n\n return !$this->error;\n }",
"function dolist_messages_mail_admin_bundle_instantate_form_validate($form, &$form_state) {\n drupal_set_message(t('Test rules actions'));\n entity_form_field_validate('messages_item', $form, $form_state);\n}",
"public function initMessages()\n {\n $this->messages = [\n 'alpha' => '{{name}} must only contain alphabetic characters.',\n 'alnum' => '{{name}} must only contain alpha numeric characters and dashes.',\n 'noWhitespace' => '{{name}} must not contain white spaces.',\n 'length' => '{{name}} must length between {{minValue}} and {{maxValue}}.',\n 'email' => 'Please make sure you typed a correct email address.'\n ];\n }",
"function redmine_sso_admin_settings_validate($form, $form_state) {\n /**\n * TODO\n * check url\n * check if group exsists\n * check if project exsists\n */\n}",
"function room_reservations_admin_settings_email_validate($form_id, &$form_state) {\n if ($form_state['clicked_button']['#value'] == t('Save configuration')) {\n $from_address = $form_state['values']['from_address'];\n if (valid_email_address($from_address)) {\n // Valid.\n }\n else {\n $field = 'from_address';\n $message = t('Invalid email address.');\n form_set_error($field, check_plain($message));\n }\n }\n}",
"function __formValidation($form = '')\n {\n //----------------------------------validate a form--------------------------------------\n //nothing specified - return false & error message\n $this->form_processor->error_message = $this->data['lang']['lang_form_validation_error'];\n return false;\n }",
"function room_reservations_admin_settings_sms_submit($form_id, &$form_state) {\n if ($form_state['clicked_button']['#value'] == t('Save configuration')) {\n $sms_option = $form_state['values']['sms_option'];\n $confirmation = ROOM_RESERVATIONS_SAVE_CONFIRMATION_MSG;\n $error = ROOM_RESERVATIONS_SAVE_ERROR_MSG;\n }\n if ($form_state['clicked_button']['#value'] == t('Reset to defaults')) {\n $sms_option = 0;\n $confirmation = ROOM_RESERVATIONS_RESET_CONFIRMATION_MSG;\n $error = ROOM_RESERVATIONS_RESET_ERROR_MSG;\n }\n $result = _room_reservations_set_variable('sms_option', $sms_option);\n if (!$result) {\n $errors = TRUE;\n }\n if ($errors) {\n drupal_set_message(check_plain($error), 'error');\n }\n else {\n drupal_set_message(check_plain($confirmation));\n }\n}",
"public function sms_configuration_form(){\n $CI =& get_instance();\n $CI->load->model('dashboard/Sms_model','sms_model');\n $setting_detail = $CI->sms_model->retrieve_sms_editdata();\n return $setting_detail;\n }",
"function _sp_custom_box_contact_form_messages( $post ) {\n\twp_nonce_field( '_sp_process_meta_contact_form_messages', '_sp_meta_contact_form_messages_nonce' );\n\n\t// get saved settings\n\t$header_text\t\t\t= get_post_meta( $post->ID, '_sp_contact_form_header_text', true );\n\t$submit_button_text\t\t= get_post_meta( $post->ID, '_sp_contact_form_submit_button_text', true );\n\t$reset_button_text\t\t= get_post_meta( $post->ID, '_sp_contact_form_reset_button_text', true );\n\t$success_message\t\t= get_post_meta( $post->ID, '_sp_contact_form_success_message', true );\n\t$failure_message\t\t= get_post_meta( $post->ID, '_sp_contact_form_failure_message', true );\n\t$required_field_text\t= get_post_meta( $post->ID, '_sp_contact_form_required_field_text', true );\n\t$email_template\t\t\t= get_post_meta( $post->ID, '_sp_contact_form_email_template', true );\n\n\t// set defaults\n\n\tif ( ! isset( $submit_button_text ) || empty( $submit_button_text ) )\n\t\t$submit_button_text = __( 'Submit', 'sp-theme' );\n\n\tif ( ! isset( $reset_button_text ) || empty( $reset_button_text ) )\n\t\t$reset_button_text = __( 'Reset Form', 'sp-theme' );\n\n\tif ( ! isset( $success_message ) || empty( $success_message ) )\n\t\t$success_message = __( 'The form was successfully submitted. Thanks!', 'sp-theme' );\n\n\tif ( ! isset( $failure_message ) || empty( $failure_message ) )\n\t\t$failure_message = __( 'Sorry! We are not able to submit your form. Please try later.', 'sp-theme' );\n\n\tif ( ! isset( $from_email ) || empty( $from_email ) )\n\t\t$from_email = get_option( 'admin_email' );\n\n\t$output = '';\n\n\t$output .= '<table class=\"contact-form-tables\">' . PHP_EOL;\n\t\n\t$output .= '<tr>' . PHP_EOL;\n\t$output .= '<td class=\"col1\">' . __( 'Form Header Text', 'sp-theme' ) . ':</td>' . PHP_EOL;\n\t$output .= '<td class=\"col2\"><input type=\"text\" name=\"contact_form_header_text\" value=\"' . esc_attr( $header_text ) . '\" class=\"widefat\" /></td>' . PHP_EOL;\n\t$output .= '<td class=\"col3\"><p class=\"howto\">' . __( 'Enter the text for your form header.', 'sp-theme' ) . '</p></td>' . PHP_EOL;\n\t$output .= '</tr>' . PHP_EOL;\n\n\t$output .= '<tr>' . PHP_EOL;\n\t$output .= '<td class=\"col1\">' . __( 'Submit Button Text', 'sp-theme' ) . ':</td>' . PHP_EOL;\n\t$output .= '<td class=\"col2\"><input type=\"text\" name=\"contact_form_submit_button_text\" value=\"' . esc_attr( $submit_button_text ) . '\" class=\"widefat\" /></td>' . PHP_EOL;\n\t$output .= '<td class=\"col3\"><p class=\"howto\">' . __( 'Enter the text to show for your submit button.', 'sp-theme' ) . '</p></td>' . PHP_EOL;\n\t$output .= '</tr>' . PHP_EOL;\n\n\t$output .= '<tr>' . PHP_EOL;\n\t$output .= '<td class=\"col1\">' . __( 'Reset Button Text', 'sp-theme' ) . ':</td>' . PHP_EOL;\n\t$output .= '<td class=\"col2\"><input type=\"text\" name=\"contact_form_reset_button_text\" value=\"' . esc_attr( $reset_button_text ) . '\" class=\"widefat\" /></td>' . PHP_EOL;\n\t$output .= '<td class=\"col3\"><p class=\"howto\">' . __( 'Enter the text to show for your reset button.', 'sp-theme' ) . '</p></td>' . PHP_EOL;\n\t$output .= '</tr>' . PHP_EOL;\n\n\t$output .= '<tr>' . PHP_EOL;\n\t$output .= '<td class=\"col1\">' . __( 'Success Message', 'sp-theme' ) . ':</td>' . PHP_EOL;\n\t$output .= '<td class=\"col2\"><input type=\"text\" name=\"contact_form_success_message\" value=\"' . esc_attr( $success_message ) . '\" class=\"widefat\" /></td>' . PHP_EOL;\n\t$output .= '<td class=\"col3\"><p class=\"howto\">' . __( 'Enter the message you would like to show when the form was successfully submitted.', 'sp-theme' ) . '</p></td>' . PHP_EOL;\n\t$output .= '</tr>' . PHP_EOL;\n\n\t$output .= '<tr>' . PHP_EOL;\n\t$output .= '<td class=\"col1\">' . __( 'Failure Message', 'sp-theme' ) . ':</td>' . PHP_EOL;\n\t$output .= '<td class=\"col2\"><input type=\"text\" name=\"contact_form_failure_message\" value=\"' . esc_attr( $failure_message ) . '\" class=\"widefat\" /></td>' . PHP_EOL;\n\t$output .= '<td class=\"col3\"><p class=\"howto\">' . __( 'Enter the message you would like to show when the form fails to submit.', 'sp-theme' ) . '</p></td>' . PHP_EOL;\n\t$output .= '</tr>' . PHP_EOL;\n\n\t$output .= '<tr>' . PHP_EOL;\n\t$output .= '<td class=\"col1\">' . __( 'Required Field Text', 'sp-theme' ) . ':</td>' . PHP_EOL;\n\t$output .= '<td class=\"col2\"><input type=\"text\" name=\"contact_form_required_field_text\" value=\"' . esc_attr( $required_field_text ) . '\" class=\"widefat\" /></td>' . PHP_EOL;\n\t$output .= '<td class=\"col3\"><p class=\"howto\">' . __( 'Enter the text you would like to show when a field is required.', 'sp-theme' ) . '</p></td>' . PHP_EOL;\n\t$output .= '</tr>' . PHP_EOL;\n\n\t$output .= '<tr>' . PHP_EOL;\n\t$output .= '<td class=\"col1\">' . __( 'Email Template', 'sp-theme' ) . ':</td>' . PHP_EOL;\n\t$output .= '<td class=\"col2\"><textarea name=\"contact_form_email_template\" class=\"widefat\" rows=\"20\">' . esc_html( $email_template ) . '</textarea></td>' . PHP_EOL;\n\t$output .= '<td class=\"col3\"><p class=\"howto\">' . __( 'This is the email template you will see as the admin when someone contacts you with this form. You can modify it to your liking. Use the unique tag names to pull in the entered data from the form. For example \"First Name:[firstname]\". This will replace the firstname in between the brackets with the data people entered.', 'sp-theme' ) . '</p><br /><a href=\"#\" title=\"' . esc_attr__( 'Do it for me', 'sp-theme' ) . '\" class=\"populate-template button\">' . __( 'Do it for me!', 'sp-theme' ) . '</a></td>' . PHP_EOL;\n\t$output .= '</tr>' . PHP_EOL;\n\n\t$output .= '</table>' . PHP_EOL;\n\n\n\techo $output;\n}",
"function room_reservations_admin_settings_text_submit($form_id, &$form_state) {\n if ($form_state['clicked_button']['#value'] == t('Save configuration')) {\n $enable_text = $form_state['values']['enable_text'];\n $from_address = $form_state['values']['from_address'];\n $confirmation_header = $form_state['values']['confirmation_header'];\n $confirmation_owner = $form_state['values']['confirmation_owner'];\n $reminder_header = $form_state['values']['reminder_header'];\n $reminder_owner = $form_state['values']['reminder_owner'];\n $confirmation = ROOM_RESERVATIONS_SAVE_CONFIRMATION_MSG;\n $error = ROOM_RESERVATIONS_SAVE_ERROR_MSG;\n }\n elseif ($form_state['clicked_button']['#value'] == t('Reset to defaults')) {\n $enable_text = 0;\n $confirmation_header = '';\n $confirmation_owner = '';\n $reminder_header = '';\n $reminder_owner = '';\n $confirmation = ROOM_RESERVATIONS_RESET_CONFIRMATION_MSG;\n $error = ROOM_RESERVATIONS_RESET_ERROR_MSG;\n }\n $errors = FALSE;\n $result = _room_reservations_set_variable('enable_text', $enable_text);\n if (!$result) {\n $errors = TRUE;\n }\n $result = _room_reservations_set_variable('from_address_sms', $from_address);\n if (!$result) {\n $errors = TRUE;\n }\n $result = _room_reservations_set_variable('confirmation_header_text_sms', \n $confirmation_header);\n if (!$result) {\n $errors = TRUE;\n }\n $result = _room_reservations_set_variable('confirmation_owner_text_sms', \n $confirmation_owner);\n if (!$result) {\n $errors = TRUE;\n }\n $result = _room_reservations_set_variable('reminder_header_text_sms', \n $reminder_header);\n if (!$result) {\n $errors = TRUE;\n }\n $result = _room_reservations_set_variable('reminder_owner_text_sms', \n $reminder_owner);\n if (!$result) {\n $errors = TRUE;\n }\n if ($errors) {\n drupal_set_message(check_plain($error), 'error');\n }\n else {\n drupal_set_message(check_plain($confirmation));\n }\n}",
"function __flmFormValidation($form = '')\n {\n\n //profiling\n $this->data['controller_profiling'][] = __function__;\n\n //form validation\n if ($form == 'edit_settings') {\n\n //check required fields\n $fields = array(\n 'company_name' => $this->data['lang']['lang_company_name'],\n 'company_email' => $this->data['lang']['lang_email_address'],\n 'company_email_name' => $this->data['lang']['lang_email_from_name']);\n\n if (!$this->form_processor->validateFields($fields, 'required')) {\n return false;\n }\n\n //everything ok\n return true;\n }\n\n //nothing specified - return false & error message\n $this->form_processor->error_message = $this->data['lang']['lang_form_validation_error'];\n return false;\n\n }",
"public function afterValidate() {\n if($_POST['content_en'] == '') $this->addError('content_en', Yii::t('base', 'You should fill post content for at least English language'));\n return parent::afterValidate();\n }",
"public function _settings_section_contact_form() {\n _e( 'The contact form is a way for users to submit support requests. It can be added to the dashboard using the options above.', 'zendesk' );\n }",
"public function messages()\n {\n return [\n //'order_number'=>'required|unique:jobs|min:10|max:11',\n 'contact_id.exists'=>'Please select a contact from the company',\n ];\n }",
"function site_settings()\n {\n if (isset($_POST['site_settings'])) {\n \n if (DEMO) {\n $this->prepare_flashmessage(get_languageword('CRUD_operations_disabled_in_DEMO_version'), 2);\n redirect(URL_SITE_SETTINGS);\n }\n \n $msg='';\n $status=0;\n \n $this->form_validation->set_rules('site_title', get_languageword('site_title'), 'trim|required|max_length[100]|xss_clean');\n \n \n \n $this->form_validation->set_rules('home_page_caption', get_languageword('home_page_caption'), 'trim|required|max_length[50]|xss_clean');\n $this->form_validation->set_rules('home_page_tagline', get_languageword('home_page_tagline'), 'trim|max_length[50]|xss_clean');\n \n $this->form_validation->set_rules('address', get_languageword('address'), 'trim|required|max_length[1000]|xss_clean');\n $this->form_validation->set_rules('city', get_languageword('city'), 'trim|required|max_length[100]|xss_clean');\n $this->form_validation->set_rules('state', get_languageword('state'), 'trim|required|max_length[100]|xss_clean');\n $this->form_validation->set_rules('country', get_languageword('country'), 'trim|required|xss_clean');\n $this->form_validation->set_rules('zip', get_languageword('pincode'), 'trim|required|max_length[20]|xss_clean');\n $this->form_validation->set_rules('latitude', get_languageword('latitude'), 'required|xss_clean');\n $this->form_validation->set_rules('longitude', get_languageword('longitude'), 'required|xss_clean');\n $this->form_validation->set_rules('ios_url', get_languageword('ios_url|xss_clean'));\n $this->form_validation->set_rules('android_url', get_languageword('android_url|xss_clean'));\n $this->form_validation->set_rules('phone', get_languageword('phone'), 'trim|required|max_length[30]|xss_clean');\n $this->form_validation->set_rules('land_line', get_languageword('land_line'), 'trim|required|max_length[30]|xss_clean');\n $this->form_validation->set_rules('fax', get_languageword('fax'), 'trim|max_length[50]|xss_clean');\n $this->form_validation->set_rules('portal_email', get_languageword('contact_email'), 'trim|required|valid_email|xss_clean');\n $this->form_validation->set_rules('site_country', get_languageword('site_country'), 'trim|required|xss_clean');\n $this->form_validation->set_rules('currency_symbol', get_languageword('currency_symbol'), 'trim|required|xss_clean');\n $this->form_validation->set_rules('from_time', get_languageword('from_time'), 'required|xss_clean');\n $this->form_validation->set_rules('to_time', get_languageword('to_time'), 'required|xss_clean');\n $this->form_validation->set_rules('design_by', get_languageword('design_by'), 'trim|required|xss_clean');\n\n $this->form_validation->set_rules('rights_reserved_content', get_languageword('rights_reserved_content'), 'trim|required|xss_clean'); \n\n $this->form_validation->set_rules('facebook_app_id', get_languageword('facebook_app_id'), 'required|xss_clean'); \n\n\n $this->form_validation->set_rules('facebook_app_secret', get_languageword('facebook_app_secret'), 'required|xss_clean');\n \n $this->form_validation->set_rules('google_client_id', get_languageword('google_client_id'), 'required|xss_clean');\n $this->form_validation->set_rules('google_client_secret', get_languageword('google_client_secret'), 'required|xss_clean');\n\n\n $this->form_validation->set_rules('contact_map_script', get_languageword('contact_map_script'), 'required');\n \n $this->form_validation->set_error_delimiters('<div class=\"error\">', '</div>');\n \n if ($this->form_validation->run() == TRUE) {\n $data = array();\n $data['site_title'] = $this->input->post('site_title');\n \n \n \n $data['home_page_caption'] = $this->input->post('home_page_caption');\n $data['home_page_tagline'] = $this->input->post('home_page_tagline');\n \n \n \n $data['address'] = $this->input->post('address');\n $data['city'] = $this->input->post('city');\n $data['state'] = $this->input->post('state');\n $data['country'] = $this->input->post('country');\n $data['zip'] = $this->input->post('zip');\n $data['latitude'] = $this->input->post('latitude');\n $data['longitude'] = $this->input->post('longitude');\n \n $data['ios_url'] = $this->input->post('ios_url');\n $data['android_url'] = $this->input->post('android_url');\n \n $data['facebook_api'] = $this->input->post('facebook_api');\n $data['google_api'] = $this->input->post('google_api');\n \n $data['phone'] = $this->input->post('phone');\n $data['land_line'] = $this->input->post('land_line');\n $data['fax'] = $this->input->post('fax');\n $data['portal_email'] = $this->input->post('portal_email');\n \n $data['site_language']= $this->input->post('site_language');\n $data['site_country'] = $this->input->post('site_country');\n $data['time_zone'] = $this->input->post('time_zone');\n $data['currency'] = $this->input->post('currency');\n $data['currency_symbol'] = $this->input->post('currency_symbol');\n \n $data['country_code'] = $this->input->post('country_code');\n \n $data['from_time'] = $this->input->post('from_time');\n $data['to_time'] = $this->input->post('to_time');\n \n if ($this->input->post('sms_notifications')=='on') {\n $data['sms_notifications'] = 'Yes';\n } else {\n $data['sms_notifications'] = 'No';\n } \n \n \n if ($this->input->post('fcm_push_notifications')=='on') {\n $data['fcm_push_notifications']= 'Yes';\n } else {\n $data['fcm_push_notifications']= 'No';\n } \n \n \n $data['design_by'] = $this->input->post('design_by');\n $data['rights_reserved_content'] = $this->input->post('rights_reserved_content');\n \n $data['date_format'] = $this->input->post('date_format');\n \n $payment_methods = $this->input->post('payment_methods');\n if (!empty($payment_methods)) {\n $payment_methods = implode(',', $payment_methods);\n $data['payment_methods'] = $payment_methods;\n } else {\n $data['payment_methods'] = NULL;\n }\n \n $data['facebook_app_id'] = $this->input->post('facebook_app_id');\n $data['facebook_app_secret'] = $this->input->post('facebook_app_secret');\n \n $data['google_client_id'] = $this->input->post('google_client_id');\n $data['google_client_secret']= $this->input->post('google_client_secret');\n \n\n $data['contact_map_script'] = $this->input->post('contact_map_script');\n \n $where = array('id'=>1);\n if ($this->base_model->update_operation($data, TBL_SITE_SETTINGS, $where)) {\n unset($data);\n $msg .= get_languageword('details_updated_successfully');\n $status= 0;\n \n //Upload Site Logo\n if (count($_FILES) > 0) {\n if ($_FILES['site_logo']['name'] != '' && $_FILES['site_logo']['error'] != 4) {\n $record = $this->base_model->fetch_records_from('site_settings');\n \n if (!empty($record)) {\n $record = $record[0];\n if ($record->site_logo != '' && file_exists(LOGO_IMG_UPLOAD_PATH_URL.$record->site_logo)) {\n unlink(LOGO_IMG_UPLOAD_PATH_URL.$record->site_logo);\n unlink(LOGO_IMG_UPLOAD_THUMB_PATH_URL.$record->site_logo);\n }\n }\n \n $ext = pathinfo($_FILES['site_logo']['name'], PATHINFO_EXTENSION);\n $file_name = 'site_logo.'. $ext;\n $config['upload_path'] = LOGO_IMG_UPLOAD_PATH_URL;\n $config['allowed_types'] = 'jpg|jpeg|png|svg|JPG|JPEG|PNG';\n $config['max_size'] = 5120;//5 MB\n\n\n $config['file_name'] = $file_name;\n $this->load->library('upload', $config);\n $this->upload->initialize($config);\n\n if ($this->upload->do_upload('site_logo')) {\n \n $data = array();\n $data['site_logo'] = $file_name;\n \n \n \n // TINIFY IMAGE COMPRESSING & THUMB\n if ($this->config->item('tinify_settings')->use_tinify=='Yes') {\n \n \n $destination = FCPATH.LOGO_IMG_UPLOAD_PATH_URL.$file_name;\n $source = base_url().LOGO_IMG_UPLOAD_PATH_URL.$file_name;\n \n $this->load->library('FCTinify');\n $fct = new FCTinify();\n \n //TINIFY IMAGE COMPRESSING\n if ($this->config->item('tinify_settings')->compress=='Yes') {\n $result = $fct->imageCompress($source, $destination);\n }\n \n // TINIFY IMAGE THUMB CREATION\n if ($this->config->item('tinify_settings')->thumb=='Yes') {\n $thumb_destination = FCPATH.LOGO_IMG_UPLOAD_THUMB_PATH_URL.$file_name;\n $fct->imageResize($source, $thumb_destination, THUMB_IMG_WIDTH, THUMB_IMG_HEIGHT, 'cover');\n } else { \n $this->create_thumbnail($config['upload_path'].$file_name, LOGO_IMG_UPLOAD_THUMB_PATH_URL.$file_name, THUMB_IMG_WIDTH, THUMB_IMG_HEIGHT);\n }\n \n \n } else {\n \n $this->create_thumbnail($config['upload_path'].$file_name, LOGO_IMG_UPLOAD_THUMB_PATH_URL.$file_name, 200, 200);\n }\n \n } else {\n $msg .= '<br>'.strip_tags($this->upload->display_errors());\n $status =1;\n \n }\n }\n \n \n if ($_FILES['second_site_logo']['name'] != '' && $_FILES['second_site_logo']['error'] != 4) {\n $record = $this->base_model->fetch_records_from('site_settings');\n \n if (!empty($record)) {\n \n $record = $record[0];\n if ($record->second_site_logo != '' && file_exists(LOGO_IMG_UPLOAD_PATH_URL.$record->second_site_logo)) {\n unlink(LOGO_IMG_UPLOAD_PATH_URL.$record->second_site_logo);\n unlink(LOGO_IMG_UPLOAD_THUMB_PATH_URL.$record->second_site_logo);\n }\n }\n \n $ext = pathinfo($_FILES['second_site_logo']['name'], PATHINFO_EXTENSION);\n $file_name = 'second_site_logo.'. $ext;\n $config['upload_path'] = LOGO_IMG_UPLOAD_PATH_URL;\n $config['allowed_types'] = 'jpg|jpeg|png|svg|JPG|JPEG|PNG';\n \n $config['file_name'] = $file_name;\n $this->load->library('upload', $config);\n $this->upload->initialize($config);\n\n if ($this->upload->do_upload('second_site_logo')) {\n \n $data = array();\n $data['second_site_logo'] = $file_name;\n \n \n // TINIFY IMAGE COMPRESSING & THUMB\n if ($this->config->item('tinify_settings')->use_tinify=='Yes') {\n \n \n $destination = FCPATH.LOGO_IMG_UPLOAD_PATH_URL.$file_name;\n $source = base_url().LOGO_IMG_UPLOAD_PATH_URL.$file_name;\n \n $this->load->library('FCTinify');\n $fct = new FCTinify();\n \n //TINIFY IMAGE COMPRESSING\n if ($this->config->item('tinify_settings')->compress=='Yes') {\n $result = $fct->imageCompress($source, $destination);\n }\n \n // TINIFY IMAGE THUMB CREATION\n if ($this->config->item('tinify_settings')->thumb=='Yes') {\n $thumb_destination = FCPATH.LOGO_IMG_UPLOAD_THUMB_PATH_URL.$file_name;\n $fct->imageResize($source, $thumb_destination, THUMB_IMG_WIDTH, THUMB_IMG_HEIGHT, 'cover');\n } else { \n $this->create_thumbnail($config['upload_path'].$file_name, LOGO_IMG_UPLOAD_THUMB_PATH_URL.$file_name, THUMB_IMG_WIDTH, THUMB_IMG_HEIGHT);\n }\n \n \n } else {\n \n $this->create_thumbnail($config['upload_path'].$file_name, LOGO_IMG_UPLOAD_THUMB_PATH_URL.$file_name, 200, 200);\n }\n \n } else {\n $msg .= '<br>'.strip_tags($this->upload->display_errors());\n $status =1;\n \n }\n }\n \n \n if ($_FILES['fevicon']['name'] != '' && $_FILES['fevicon']['error'] != 4) {\n $record = $this->base_model->fetch_records_from('site_settings');\n \n if (!empty($record)) {\n $record = $record[0];\n \n if ($record->fevicon != '' && file_exists(FEVICON_IMG_UPLOAD_PATH_URL.$record->fevicon)) {\n unlink(FEVICON_IMG_UPLOAD_PATH_URL.$record->fevicon);\n }\n }\n \n $ext = pathinfo($_FILES['fevicon']['name'], PATHINFO_EXTENSION);\n $file_name1 = 'fevicon.'. $ext;\n $config['upload_path'] = FEVICON_IMG_UPLOAD_PATH_URL;\n $config['allowed_types'] = 'ico';\n \n $config['file_name'] = $file_name1;\n $this->load->library('upload', $config);\n $this->upload->initialize($config);\n\n if ($this->upload->do_upload('fevicon')) {\n $data['fevicon'] = $file_name1;\n \n } else {\n $msg .= '<br>'.strip_tags($this->upload->display_errors());\n $status =1;\n }\n }\n \n \n \n \n \n //HOME PAGE IMAGE\n if ($_FILES['home_page_img']['name'] != '' && $_FILES['home_page_img']['error'] != 4) {\n $record = $this->base_model->fetch_records_from('site_settings');\n \n if (!empty($record)) {\n $record = $record[0];\n if ($record->home_page_img != '' && file_exists(HOME_PAGE_IMG_UPLOAD_PATH_URL.$record->home_page_img)) {\n unlink(HOME_PAGE_IMG_UPLOAD_PATH_URL.$record->home_page_img);\n }\n }\n \n $ext = pathinfo($_FILES['home_page_img']['name'], PATHINFO_EXTENSION);\n $file_name = 'home_page_img.'. $ext;\n $config['upload_path'] = HOME_PAGE_IMG_UPLOAD_PATH_URL;\n \n \n //\n $config['min_width'] = 1980;\n $config['min_height'] = 448;\n \n $config['max_width'] = 2000;\n $config['max_height'] = 1500;\n //\n \n $config['allowed_types'] = 'jpg|jpeg|png|JPG|JPEG|PNG';\n \n $config['file_name'] = $file_name;\n $this->load->library('upload', $config);\n $this->upload->initialize($config);\n\n if ($this->upload->do_upload('home_page_img')) {\n \n $data = array();\n $data['home_page_img'] = $file_name;\n \n // TINIFY IMAGE COMPRESSING & THUMB\n if ($this->config->item('tinify_settings')->use_tinify=='Yes') {\n \n $destination = FCPATH.HOME_PAGE_IMG_UPLOAD_PATH_URL.$file_name;\n $source = base_url().HOME_PAGE_IMG_UPLOAD_PATH_URL.$file_name;\n \n $this->load->library('FCTinify');\n $fct = new FCTinify();\n \n //TINIFY IMAGE COMPRESSING\n if ($this->config->item('tinify_settings')->compress=='Yes') {\n $result = $fct->imageCompress($source, $destination);\n }\n } \n } else {\n $msg .= '<br>'.strip_tags($this->upload->display_errors());\n $status =1;\n }\n }\n \n \n if (!empty($data)) {\n $this->base_model->update_operation($data, TBL_SITE_SETTINGS, $where);\n }\n }\n } else {\n $msg .= get_languageword('details_not_updated');\n $status = 1;\n }\n \n \n $this->prepare_flashmessage($msg, $status);\n redirect(URL_SITE_SETTINGS, REFRESH);\n }\n }\n \n $record = array();\n $record = $this->base_model->fetch_records_from(TBL_SITE_SETTINGS);\n if (!empty($record)) { \n $record = $record[0];\n }\n \n //Language Options\n $lang_opts = get_language_opts();\n $this->data['lang_opts'] = $lang_opts;\n \n //Language Options\n $currency_opts = get_currency_opts();\n $this->data['currency_opts'] = $currency_opts;\n \n \n // TIME ZONES\n $time_zone_options = array();\n $time_zones = $this->base_model->fetch_records_from('calendar_timezones');\n if (!empty($time_zones)) {\n foreach($time_zones as $row):\n $time_zone_options[$row->TimeZone] = $row->TimeZone.'('.$row->UTC_offset.')';\n endforeach;\n }\n $this->data['time_zone_options'] = $time_zone_options;\n \n $this->data['record'] = $record;\n $this->data['css_js_files'] = array('form_validation');\n $this->data['pagetitle'] = get_languageword('site_settings');\n \n $this->data['activemenu'] = \"master_settings\";\n $this->data['actv_submenu'] = 'site_settings';\n \n $this->data['content'] = PAGE_SITE_SETTINGS;\n $this->_render_page(TEMPLATE_ADMIN, $this->data);\n }",
"function simplenews_admin_newsletter_form_validate($form, &$form_state) {\n if ($form_state['clicked_button']['#value'] != t('Delete')) {\n\n // Check for valid email address.\n if (!valid_email_address($form_state['values']['from_address'])) {\n form_set_error('from_address', t(\"The sender's email address you supplied is not valid.\"));\n }\n }\n}",
"public function processConfiguration()\n\t{\n\t\t// Check if the value sent on form submit matches one of either $_POST or $_GET keys \n\t\tif (Tools::isSubmit('submit_emailmystock_form'))\n\t\t{\n\t\t\t$enable_emails = Tools::getValue('enable_emails');\n\t\t\t// Update configuration value to database\n\t\t\tConfiguration::updateValue('MYMOD_EMAILS', $enable_emails);\n\t\t\t// Allows the Smarty object to display a confirmation message when the configuration is saved (see top of getContent.tpl)\n\t\t\t$this->context->smarty->assign('confirmation', 'ok');\n\t\t}\n\t}",
"public function admin_smtp_settings() {\n if ($this->checkLogin('A') == '') {\n redirect(ADMIN_ENC_URL);\n } else {\n if ($this->checkPrivileges('admin', '2') == TRUE) {\n\t\t\t if ($this->lang->line('admin_settings_smtp_settings') != '') \n\t\t $this->data['heading']= stripslashes($this->lang->line('admin_settings_smtp_settings')); \n\t\t else $this->data['heading'] = 'SMTP Settings';\n $this->data['admin_settings'] = $result = $this->admin_model->get_selected_fields(ADMIN, array(), array('smtp'));\n $this->load->view(ADMIN_ENC_URL.'/adminsettings/smtp_settings', $this->data);\n } else {\n redirect(ADMIN_ENC_URL);\n }\n }\n }",
"public function messages(){\n return [\n //\"email.required\" => \"メールアドレスを入力してください\",\n //\"email.max\" => \"**文字以下で入力してください\",\n ];\n }",
"function uc_usps_admin_settings_validate($form, &$form_state) {\n if (!is_numeric($form_state['values']['uc_usps_markup'])) {\n form_set_error('uc_usps_markup', t('Rate markup must be a numeric value.'));\n }\n}",
"function room_reservations_admin_settings_sms($form, &$form_state) {\n $default_sms_option = _room_reservations_get_variable('sms_option');\n $form['#tree'] = TRUE;\n $form['sms_option'] = array(\n '#title' => t('SMS option'),\n '#type' => 'checkbox',\n '#return_value' => 1,\n '#default_value' => $default_sms_option,\n '#description' => t('Give users the option of receiving confirmation\n messages and reminders as SMS text messages.'),\n '#weight' => -110,\n );\n $form['carriers'] = array(\n '#type' => 'fieldset',\n '#title' => t('Wireless carriers'),\n '#collapsible' => TRUE,\n '#collapsed' => FALSE,\n '#weight' => -100,\n );\n $sql = \"\n SELECT id, value\n FROM {room_reservations_variables}\n WHERE name = '%s'\n ORDER BY value\n \";\n $result = db_query($sql, 'carrier');\n if ($result) {\n $options = array();\n $form['carriers']['list_0'] = array(\n '#value' => '<table><tr><th>' . t('Wireless carrier') . '</th><th>' .\n t('Domain name') . '</th></tr>',\n '#weight' => -99,\n );\n $x = 0;\n while ($data = db_fetch_object($result)) {\n $x++;\n $id = $data->id;\n $values = explode('~', $data->value);\n $options[strval($id)] = $values[0];\n $form['carriers']['list_' . $x] = array(\n '#value' => '<tr><td>' . check_plain($values[0]) . '</td><td>' .\n check_plain($values[1]) . '</td></tr>',\n '#weight' => -99 + $x,\n );\n $x++;\n }\n $form['carriers']['list_' . $x] = array(\n '#value' => '</table>',\n '#weight' => -99 + $x,\n );\n }\n $form['save'] = array(\n '#type' => 'submit',\n '#value' => t('Save configuration'),\n '#weight' => 100,\n );\n $form['reset'] = array(\n '#type' => 'submit',\n '#value' => t('Reset to defaults'),\n '#weight' => 101,\n );\n return $form;\n}",
"function inscription_jesa_manage_validate($form, &$form_state) {\n \n}"
] |
[
"0.65337104",
"0.62910223",
"0.62063223",
"0.6052303",
"0.59585327",
"0.5938154",
"0.5912115",
"0.589651",
"0.58817166",
"0.587592",
"0.58481365",
"0.5826221",
"0.58231694",
"0.58079255",
"0.58047116",
"0.57962626",
"0.57814187",
"0.57808805",
"0.5779015",
"0.5770237",
"0.5768658",
"0.57603747",
"0.57584155",
"0.574287",
"0.5709725",
"0.5706151",
"0.57035774",
"0.5680601",
"0.5675055",
"0.56725854"
] |
0.6315695
|
1
|
Sets the bounds for an array type
|
public function setBounds(array $bounds): void
{
if ([] !== $bounds && $this->parentNode instanceof ConstantTypecastExpression) {
throw new InvalidArgumentException('Type names with array bounds cannot be used in constant type cast');
}
$this->p_bounds = [];
foreach ($bounds as $key => $value) {
if (!is_int($value) && !ctype_digit($value)) {
throw new InvalidArgumentException(sprintf(
"%s: array bounds should be an array of integers, %s given at key '%s'",
__METHOD__,
gettype($value),
$key
));
}
$this->p_bounds[] = (int)$value;
}
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function setBounds($value)\n {\n return $this->set('Bounds', $value);\n }",
"public function setBounds($value)\n {\n return $this->set('Bounds', $value);\n }",
"public function setBoundaries()\n {\n }",
"function limitToTypes($types) {\r\n $this->typesLimit = array();\r\n }",
"protected static function setRange(array $range = [])\n {\n static::$range = ! empty($range) ? $range : range(0, 9);\n }",
"public static function bounds()\n {\n return array(\n array(static::LAT_MIN, static::LNG_MIN),\n array(static::LAT_MAX, static::LNG_MAX),\n );\n }",
"function SetArray($arrWhere)\r\n\t{\r\n\t\t$this->_arrWhere = $arrWhere;\r\n\t}",
"public function setFromArray(array $data);",
"public function setFromArray(array &$_data);",
"public function setBound()\n {\n $args = func_get_args();\n\n if (isset($args[0]) && ($args[0] instanceof Bound)) {\n $this->bound = $args[0];\n } elseif ((isset($args[0]) && ($args[0] instanceof Coordinate))\n && (isset($args[1]) && ($args[1] instanceof Coordinate))\n ) {\n $this->bound->setSouthWest($args[0]);\n $this->bound->setNorthEast($args[1]);\n } elseif ((isset($args[0]) && is_numeric($args[0]))\n && (isset($args[1]) && is_numeric($args[1]))\n && (isset($args[2]) && is_numeric($args[2]))\n && (isset($args[3]) && is_numeric($args[3]))\n ) {\n $this->bound->setSouthWest(new Coordinate($args[0], $args[1]));\n $this->bound->setNorthEast(new Coordinate($args[2], $args[3]));\n\n if (isset($args[4]) && is_bool($args[4])) {\n $this->bound->getSouthWest()->setNoWrap($args[4]);\n }\n\n if (isset($args[5]) && is_bool($args[5])) {\n $this->bound->getNorthEast()->setNoWrap($args[5]);\n }\n } elseif (!isset($args[0])) {\n $this->bound->setSouthWest(null);\n $this->bound->setNorthEast(null);\n } else {\n throw MapException::invalidBound();\n }\n }",
"abstract protected function configureDataConstraints(): array;",
"public function bound () :array\n {\n return [\n\n ];\n }",
"public function setArray($array){\n $this->array=$array;\n }",
"public function setBound()\n {\n $args = func_get_args();\n\n if (isset($args[0]) && ($args[0] instanceof Bound)) {\n $this->bound = $args[0];\n } elseif ((isset($args[0]) && ($args[0] instanceof Coordinate))\n && (isset($args[1]) && ($args[1] instanceof Coordinate))\n ) {\n if (!$this->hasBound()) {\n $this->bound = new Bound();\n }\n\n $this->bound->setSouthWest($args[0]);\n $this->bound->setNorthEast($args[1]);\n } elseif ((isset($args[0]) && is_numeric($args[0]))\n && (isset($args[1]) && is_numeric($args[1]))\n && (isset($args[2]) && is_numeric($args[2]))\n && (isset($args[3]) && is_numeric($args[3]))\n ) {\n if (!$this->hasBound()) {\n $this->bound = new Bound();\n }\n\n $this->bound->setSouthWest(new Coordinate($args[0], $args[1]));\n $this->bound->setNorthEast(new Coordinate($args[2], $args[3]));\n\n if (isset($args[4]) && is_bool($args[4])) {\n $this->bound->getSouthWest()->setNoWrap($args[4]);\n }\n\n if (isset($args[5]) && is_bool($args[5])) {\n $this->bound->getNorthEast()->setNoWrap($args[5]);\n }\n } elseif (!isset($args[0])) {\n $this->bound = null;\n } else {\n throw GeocodingException::invalidGeocoderRequestBound();\n }\n }",
"protected function setArray(&$array)\n {\n if (is_array($array))\n {\n $this->array = $array;\n return true;\n }\n else\n {\n // non-array passed to constructor throw exception\n throw new InvalidArgumentException('ArrayExpectedAsParameter');\n }\n }",
"public function setBounds($var)\n {\n $arr = GPBUtil::checkRepeatedField($var, \\Google\\Protobuf\\Internal\\GPBType::DOUBLE);\n $this->bounds = $arr;\n\n return $this;\n }",
"public function fillFromArray(array $array = [])\n {\n parent::fillFromArray($array);\n\n $this->start = (int) $this->start;\n $this->end = isset($this->end) ? (int) $this->end : null;\n }",
"public function setArray(array $array)\n {\n $this->array = $array;\n }",
"function set($type,$data){\n\t// PARAM $type : type of data, as above\n\t// $data : data to set\n\n\t\tif (!is_array($this->$type)) { die(\"Not a valid data type\"); }\n\t\t$this->$type = $data;\n\t}",
"protected function addBoundSection(ArrayNodeDefinition $node)\n {\n $node\n ->children()\n ->arrayNode('bound')->addDefaultsIfNotSet()\n ->children()\n ->scalarNode('class')->end()\n ->scalarNode('helper_class')->end()\n ->scalarNode('prefix_javascript_variable')->end()\n ->arrayNode('south_west')->addDefaultsIfNotSet()\n ->children()\n ->scalarNode('latitude')->end()\n ->scalarNode('longitude')->end()\n ->scalarNode('no_wrap')->end()\n ->end()\n ->end()\n ->arrayNode('north_east')->addDefaultsIfNotSet()\n ->children()\n ->scalarNode('latitude')->end()\n ->scalarNode('longitude')->end()\n ->scalarNode('no_wrap')->end()\n ->end()\n ->end()\n ->end()\n ->end()\n ->end();\n }",
"#[@test]\n public function varArrayAssignableFromIntArray() {\n $this->assertFalse(ArrayType::forName('var[]')->isAssignableFrom('int[]'));\n }",
"private function setTimeLimits($type, $limits)\n {\n if (is_array($limits)) {\n\n $this->query[\"{$type}_relative\"]= [\n 'unit' => $limits['unit'],\n 'value' => $limits['value']\n ];\n\n } elseif(is_numeric($limits)) {\n $this->query[\"{$type}_absolute\"] = $limits;\n }\n }",
"public function setDataRange($limit, $offset = 0) {\n\t\t\t$this->limit = (int) $limit;\n\t\t\t$this->offset = (int) $offset;\n\t\t}",
"public function SetConstraints ($constraints = []);",
"public function setAllowedTypes(array $types) {\n if (is_array($types)) {\n $this->allowed = $types;\n }\n }",
"public function setData(Array $data);",
"public function setCollection(array $value);",
"public function setConstraints($value)\n {\n if (!$this->_isNumericArray($value)) {\n $value = array ($value);\n }\n $this->_fields['Constraints']['FieldValue'] = $value;\n return $this;\n }",
"abstract protected function setValidationCustomAttributes(): array;",
"public function setRange($range)\n {\n if (! ($range instanceof OntologyClass) && ! ($range instanceof DataType)) throw new \\InvalidArgumentException('range must be an OntologyClass or a DataType, but has type ' . PhpUtil::typeNameOf($range));\n $this->range = $range;\n }"
] |
[
"0.5374602",
"0.5374602",
"0.53609604",
"0.53218555",
"0.527893",
"0.5265442",
"0.5157073",
"0.5136745",
"0.5130823",
"0.5078858",
"0.5039891",
"0.4991304",
"0.498752",
"0.4937693",
"0.49258178",
"0.4924492",
"0.49227604",
"0.49137586",
"0.4893853",
"0.48924744",
"0.48854494",
"0.4883136",
"0.48786584",
"0.48597446",
"0.48344833",
"0.48102158",
"0.4734811",
"0.4722412",
"0.47125354",
"0.4711225"
] |
0.69949216
|
0
|
/ joinuje JEDAN post sa kategorijom tu je radi prikazivanja posta sa slugom==$postID
|
public function get_one_post_joined_with_category_byID($postID){
$db = \Config\Database::connect();
$builder = $db->table('posts');
$builder->select('posts.id, posts.category_id, posts.title, posts.slug, posts.body, posts.created_at, categories.name')->where('posts.id', $postID);
$builder->join('categories', 'posts.category_id = categories.id');
$query = $builder->get();
$results = $query->getResult();
return $results;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function postCategory($slug) {\n // 'name' che è il nome per esteso della categoria\n // 'slug' che è lo slug ricavato dal nome per esteso della categoria\n // questa funzione riceve in ingresso lo slug ($slug) della categoria\n // e deve ricavare l'elenco di tutti i posts che hanno quella categoria associata\n // identificati dallo slug ricevuto come parametro in ingresso.\n // Poi la funzione richiama una view e le passa l'elenco di tutti i posts trovati\n // e l'oggetto categoria, quella identificata dallo slug ricevuto in ingresso\n\n // cerco nella colonna 'slug' della mia tabella 'categories', la categoria (record) con slug uguale al parametro ricevuto\n $category = Category::where('slug', $slug)->first();\n\n // verifico se la select fatta sul DB mi ha ritornato qualcosa per la categoria ricercata tramite slug\n // ad esempio l'utente potrebbe modificare la stringa nella barra indirizzi, alterando il nome\n // dello slug e scrivendo un qualcosa che non esiste e non corrisponde a nessuna categoria del DB\n if (!empty($category)) {\n // qui sfrutto la relazione fra categorie e posts, cioè la relazione fra le entità/modelli\n // Category e Post. Nella classe Category è definito un metodo posts()\n // (cioè col nome dell'entità verso la quale è definita la relazione)\n // posts() ritorna $this->hasMany('App\\Post');\n // chiamo la proprietà posts (in questa maniera'$category->posts')\n // che restituisce i post che sono legati da relazione in base alla categoria\n $posts_by_category = $category->posts;\n\n // chiamo una view per visualizzare tutti i post della categoria ricercata,\n // gli passo la categoria e l'elenco dei posts\n return view('public.posts.posts-by-category', [\n 'category' => $category,\n 'posts' => $posts_by_category\n ]);\n } else {\n // ritorno la pagina di errore \"Page not found\" poichè lo slug ricevuto in ingresso\n // non corrisponde a nessuna categoria presente nel mio DB (tabella 'categories')\n return abort(404);\n }\n }",
"public function get_post_joined_with_category(){\n $db = \\Config\\Database::connect();\n $builder = $db->table('posts');\n $builder->select('posts.id, posts.category_id, posts.title, posts.slug, posts.body, posts.created_at, categories.name');\n $builder->orderBy('posts.id', 'DESC');\n $builder->join('categories', 'posts.category_id = categories.id');\n $query = $builder->get();\n $results = $query->getResult();\n \n return $results;\n }",
"public function stranica_iz_kategorije($cid, $p = 1, $po_stranici = 1) {\n $this->db->select(' posts.post_id, posts.time, posts.title, text, posts.status, users.id_user, users.name AS autor, cats.id_cat, cats.title AS kategorija, cats.type AS ktip');\n $this->db->from('posts');\n $this->db->join('post_v_user', ' post_v_user.post_id = posts.post_id ', 'left');\n $this->db->join('users', ' users.id_user = post_v_user.user_id', 'left');\n $this->db->join('post_v_cat', ' post_v_cat.id_post = posts.post_id ', 'left');\n $this->db->join('cats', ' cats.id_cat = post_v_cat.id_cat', 'left');\n if ($cid != \"\")\n $this->db->where('post_v_cat.id_cat', $cid);\n $this->db->limit($po_stranici, ($p - 1) * $po_stranici);\n\n\n $query = $this->db->get();\n\n if ($query->num_rows() != 0) {\n return $query->result();\n } else {\n return false;\n }\n }",
"function aff_post($id_post) {\n\n\t\t$req = $GLOBALS['bdd']->prepare('SELECT a.*, d.*, da.dazibao as sujet_dazibao, da.decapode as sujet_decapode, da.dessication as sujet_dessication, da.diatribe as sujet_diatribe\n\t\t\t\t\t\t\t\t\tFROM adenoide a\n\t\t\t\t\t\t\t\t\tINNER JOIN dactyle d\n\t\t\t\t\t\t\t\t\tON a.alcade = d.dazibao\n\t\t\t\t\t\t\t\t\tINNER JOIN dactyle da\n\t\t\t\t\t\t\t\t\tON a.ammonite = da.dazibao\n\t\t\t\t\t\t\t\t\tWHERE a.alezan = :id');\n\t\t$req->execute(array('id' =>$id_post));\n\t\t$GLOBALS['donnees'] = $req->fetch();\n\n\t}",
"public function takePostBaseOnCategory($id);",
"public function related_posts() {\n\t\tglobal $post;\n\t\t$cats = wp_get_object_terms(\n\t\t\t$post->ID,\n\t\t\t'category',\n\t\t\tarray(\n\t\t\t\t'fields' => 'ids',\n\t\t\t)\n\t\t);\n\t\t$args = array(\n\t\t\t'posts_per_page' => 3,\n\t\t\t'cat' => $cats,\n\t\t\t'orderby' => 'date',\n\t\t\t'ignore_sticky_posts' => true,\n\t\t\t'post__not_in' => array( $post->ID ),\n\t\t);\n\t\t$allowed_html = array(\n\t\t\t'br' => array(),\n\t\t\t'em' => array(),\n\t\t\t'strong' => array(),\n\t\t\t'i' => array(\n\t\t\t\t'class' => array(),\n\t\t\t),\n\t\t\t'span' => array(),\n\t\t);\n\n\t\t$loop = new WP_Query( $args );\n\t\tif ( $loop->have_posts() ) :\n\t\t\t?>\n\t\t\t<div class=\"section related-posts\">\n\t\t\t\t<div class=\"container\">\n\t\t\t\t\t<div class=\"row\">\n\t\t\t\t\t\t<div class=\"col-md-12\">\n\t\t\t\t\t\t\t<h2 class=\"hestia-title text-center\"><?php echo apply_filters( 'hestia_related_posts_title', esc_html__( 'Related Posts', 'hestia' ) ); ?></h2>\n\t\t\t\t\t\t\t<div class=\"row\">\n\t\t\t\t\t\t\t\t<?php\n\t\t\t\t\t\t\t\twhile ( $loop->have_posts() ) :\n\t\t\t\t\t\t\t\t\t$loop->the_post();\n\t\t\t\t\t\t\t\t\t?>\n\t\t\t\t\t\t\t\t\t<div class=\"col-md-4\">\n\t\t\t\t\t\t\t\t\t\t<div class=\"card card-blog\">\n\t\t\t\t\t\t\t\t\t\t\t<?php if ( has_post_thumbnail() ) : ?>\n\t\t\t\t\t\t\t\t\t\t\t\t<div class=\"card-image\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t<a href=\"<?php the_permalink(); ?>\" title=\"<?php the_title_attribute(); ?>\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<?php the_post_thumbnail( 'hestia-blog' ); ?>\n\t\t\t\t\t\t\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t\t<?php endif; ?>\n\t\t\t\t\t\t\t\t\t\t\t<div class=\"content\">\n\t\t\t\t\t\t\t\t\t\t\t\t<h6 class=\"category text-info\"><?php echo hestia_category( false ); ?></h6>\n\t\t\t\t\t\t\t\t\t\t\t\t<h4 class=\"card-title\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t<a class=\"blog-item-title-link\" href=\"<?php echo esc_url( get_permalink() ); ?>\" title=\"<?php the_title_attribute(); ?>\" rel=\"bookmark\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<?php echo wp_kses( force_balance_tags( get_the_title() ), $allowed_html ); ?>\n\t\t\t\t\t\t\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t\t\t\t\t\t</h4>\n\t\t\t\t\t\t\t\t\t\t\t\t<p class=\"card-description\"><?php echo wp_kses_post( get_the_excerpt() ); ?></p>\n\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t<?php endwhile; ?>\n\t\t\t\t\t\t\t\t<?php wp_reset_postdata(); ?>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<?php\n\t\tendif;\n\t}",
"function mostrarCategoriaEntradas($core,$id){\n\t$entradas = obtenerCategoriaEntradas($core,$id);\n\n\tif ($entradas->num_rows >= 1) {\n\t\twhile ($row = $entradas->fetch_assoc()) {\n\t\t\techo '<article class=\"entrada\">\n\t\t\t\t\t<a href=\"entradas.php?id_post='.$row['id_entrada'].'\">\n\t\t\t\t\t\t<h2>'.ucfirst($row['titulo']).'</h2>\n\t\t\t\t\t\t<span class=\"fecha\">'.$row['categoria'].' | '.$row['fecha'].'</span>\n\t\t\t\t\t\t<p>'.limitandoCaracteres($row['descripcion'],47).'</p>\n\t\t\t\t\t</a>\n\t\t\t\t</article>';\n\t\t}\n\t}else{\n\t\techo '<h3>No ahi post publicados para esta categoria</h3>';\n\t}\n}",
"function xiliml_adjacent_join_filter( $join, $in_same_cat, $excluded_categories ) {\n\t\tglobal $post, $wpdb;\n\t\t$curlang = xiliml_get_lang_object_of_post( $post->ID );\n\n\t\tif ( $curlang ) { // only when language is defined !\n\t\t\t$join .= \" LEFT JOIN $wpdb->term_relationships as xtr ON (p.ID = xtr.object_id) LEFT JOIN $wpdb->term_taxonomy as xtt ON (xtr.term_taxonomy_id = xtt.term_taxonomy_id) \";\n\t\t}\n\t\treturn $join;\n\t}",
"public function posts()\n {\n\n //validate the $_GET variable\n $_GET = filter_var_array($_GET,FILTER_SANITIZE_STRING);\n\n //store the `v` index from $_GET variable\n $post_link = isset( $_GET[\"v\"]) ? $_GET[\"v\"] : null;\n \n //store post model's object from $this->model_obj variable\n $post_obj = $this->model_objs[\"post_obj\"];\n\n //store catagory model's object from $this->model_obj variable\n $cat_obj = $this->model_objs[\"cat_obj\"];\n\n //store fetced single posts\n $single_post = array();\n \n //store all the catagores\n $catagories = array();\n \n //fetch a single posts\n $fetch_post = $post_obj->select(array(\n \"column_name\"=>\"\n posts.post_id,\n posts.post_title,\n posts.post_content,\n posts.post_author,\n posts.post_date,\n posts.post_link,\n users.user_name\n \",\n \"join\"=>array(\n \"users\"=>\"users.user_id = posts.post_author\"\n ),\n \"where\"=>\"posts.post_link='{$post_link}'\"\n\n ));\n\n if($fetch_post[\"status\"] == 1 && $fetch_post[\"num_rows\"] > 0){\n\n //store all the info of a single post\n $single_post = $fetch_post[\"fetch_all\"][0];\n\n //convert entities to HTML tag\n $single_post[\"post_title\"] = html_entity_decode($single_post[\"post_title\"]);\n \n //convert entities to HTML tag\n $single_post[\"post_content\"] = html_entity_decode($single_post[\"post_content\"]);\n \n $single_post[\"total_read\"] = $this->get_post_overview($single_post[\"post_id\"])[\"read\"];\n \n //fetch post image\n $single_post[\"pfile_info\"] = $this->fetch_post_files($single_post[\"post_id\"],\"post_thumb\");\n \n //fetch post author's profile image\n $single_post[\"post_auth_info\"] = array(\n \"id\"=>$single_post[\"post_author\"],\n \"user_name\"=>$single_post[\"user_name\"],\n \"ufile_info\"=> array(\n \"profile_img\"=>$this->fetch_user_files($single_post[\"post_author\"],\"profile_img\") \n )\n );\n \n }else{\n\n \n //call the error_404 to show the 404 error\n $this->functions->error_pages()->error_404(); \n\n die();\n }\n \n //fetch a catagories\n $fetch_catagories = $cat_obj->select();\n\n if($fetch_catagories[\"status\"] == 1 && $fetch_catagories[\"num_rows\"] > 0){\n\n $catagories = $fetch_catagories[\"fetch_all\"];\n }\n\n if(isset($this->data[\"common_info\"][\"nf_info\"]) && $this->data[\"common_info\"][\"nf_info\"][\"unread\"] > 0){\n\n $this->data[\"title_tag\"]= \"({$this->data[\"common_info\"][\"nf_info\"][\"unread\"]}) {$single_post['post_title']} | Lobster\";\n\n }else{\n \n $this->data[\"title_tag\"]= \"{$single_post['post_title']} | Lobster\";\n }\n \n $this->data[\"single_post\"] = $single_post;\n\n $this->data[\"catagories\"] = $catagories;\n\n $this->view(\"pages/single_post\",$this->data);\n\n }",
"function wc_tab_manager_tabs_posts_join( $join, $query ) {\n\tglobal $wpdb, $typenow;\n\n\tif ( 'wc_product_tab' === $typenow ) {\n\t\t$join .= \" JOIN {$wpdb->posts} AS product_parents ON ( {$wpdb->posts}.post_parent = 0 OR ( {$wpdb->posts}.post_parent = product_parents.ID AND product_parents.post_status != 'trash' ) )\";\n\t}\n\n\treturn $join;\n}",
"public function postTag($slug) {\n // 'name' che è il nome per esteso del tag\n // 'slug' che è lo slug ricavato dal nome per esteso del tag\n // questa funzione riceve in ingresso lo slug ($slug) del tag\n // e deve ricavare l'elenco di tutti i posts che hanno quel tag associato\n // identificati dallo slug ricevuto come parametro in ingresso.\n // Poi la funzione richiama una view e le passa l'elenco di tutti i posts trovati\n // e l'oggetto categoria, quella identificata dallo slug ricevuto in ingresso\n\n // cerco nella colonna 'slug' della mia tabella 'tags', il tag (record) con slug uguale al parametro ricevuto\n $tag = Tag::where('slug', $slug)->first();\n\n // verifico se la select fatta sul DB mi ha ritornato qualcosa per il tag ricercato tramite slug\n // ad esempio l'utente potrebbe modificare la stringa nella barra indirizzi, alterando il nome\n // dello slug e scrivendo un qualcosa che non esiste e non corrisponde a nessun tag del DB\n if (!empty($tag)) {\n // qui sfrutto la relazione fra tags e posts, cioè la relazione fra le entità/modelli\n // Tag e Post. Nella classe Tag è definito un metodo posts()\n // (cioè col nome dell'entità verso la quale è definita la relazione)\n // posts() ritorna $this->hasMany('App\\Post');\n // chiamo la proprietà posts (in questa maniera'$tag->posts')\n // che restituisce i post che sono legati da relazione in base al tag\n $posts_by_tag = $tag->posts;\n\n // chiamo una view per visualizzare tutti i post del tag ricercato,\n // gli passo il tag e l'elenco dei posts\n return view('public.posts.posts-by-tag', [\n 'tag' => $tag,\n 'posts' => $posts_by_tag\n ]);\n } else {\n // ritorno la pagina di errore \"Page not found\" poichè lo slug ricevuto in ingresso\n // non ha corrispondenza nel mio DB (tabella 'tags')\n return abort(404);\n }\n }",
"public function get_one_post_joined_with_category_bySlug($postSlug){\n $db = \\Config\\Database::connect();\n $builder = $db->table('posts');\n $builder->select('posts.id, posts.category_id, posts.title, posts.slug, posts.body, posts.created_at, categories.name')->where('slug', $postSlug);\n $builder->join('categories', 'posts.category_id = categories.id');\n $query = $builder->get();\n $results = $query->getResult();\n \n return $results;\n }",
"function find_all_posts(){\n\n global $connection;\n \n $query = \"SELECT * FROM posts\";\n $select_posts = mysqli_query($connection, $query);\n\n while($row = mysqli_fetch_assoc($select_posts)){\n\n $post_id = $row['post_id'];\n $post_title = $row['post_title'];\n $post_author = $row['post_author'];\n $post_category_id = $row['post_category_id'];\n $post_status = $row['post_status'];\n $post_image = $row['post_image'];\n $post_tags = $row['post_tags'];\n $post_content = $row['post_content'];\n $post_comments = $row['post_comment_count'];\n $post_date = $row['post_date'];\n \n $post_content = substr($post_content, 0, 30);\n\n echo \"<tr>\";\n echo \"<td>{$post_id}</td>\";\n echo \"<td>{$post_author}</td>\";\n echo \"<td>{$post_title}</td>\";\n\n\n $query = \"SELECT * FROM categories WHERE cat_id = '{$post_category_id}' \";\n $select_categories_id = mysqli_query($connection, $query);\n \n while($row = mysqli_fetch_assoc($select_categories_id)){\n \n $cat_title = $row['cat_title'];\n }\n\n echo \"<td>{$cat_title}</td>\";\n echo \"<td>{$post_status}</td>\";\n echo \"<td><img width='100px' class='img-responsive' src='../images/{$post_image}' alt='image'></td>\";\n echo \"<td>{$post_tags}</td>\";\n echo \"<td>{$post_content}...</td>\";\n echo \"<td>{$post_comments}</td>\";\n echo \"<td>{$post_date}</td>\";\n echo \"<td><a style='font-size:20px' href='posts.php?delete={$post_id}'><i class='fa fa-trash-o' ></i></a>\";\n echo \"<td><a style='font-size:20px'href='posts.php?source=update_post&p_id={$post_id}'><i class='fa fa-pencil' ></i></a>\";\n echo \"</tr>\";\n }\n}",
"function get_lastpost($id, $posts)\n { \n \t\n \t$fields = $this->db->list_fields($this->tabla);\n\n\t\tforeach ($fields as $field)\n\t\t{\n\t\t $this->db->select($this->tabla . '.' . $field);\n\t\t}\n\n\t\t$this->db->from($this->tabla);\n\t\t$this->db->where('post_type', 'post');\n\t\t$this->db->where('post_author', $id);\n\t\t$this->db->where('(post_status like \"publish\" or post_status like \"inherit\")');\n\t\t//$this->db->where('post_status', 'publish');\n\t\t\n\t\t$this->db->limit($posts, 0);\n\t\t\n\t\t$this->db->order_by($this->tabla . '.post_date', 'DESC');\n\t\t\n\t\t$todo = $this->db->get();\n\t\t$post[] = $todo->result_array();\n\n\t\t$categorias = $this->terms->get_categories_perfil($db);\n\t\t\n\t\tforeach($categorias as $key => $values)\n\t\t{\n\t\t\t\n\t \t$fields = $this->db->list_fields($this->tabla);\n\n\t\t\tforeach ($fields as $field)\n\t\t\t{\n\t\t\t $this->db->select($this->tabla . '.' . $field);\n\t\t\t}\n\t\t\t\n\t\t\t$this->db->from($this->tabla);\n\t\t\t$this->db->join('wp_1_term_relationships', 'wp_1_posts.ID = wp_1_term_relationships.object_id');\n\t\t\t\n\t\t\t$this->db->where('post_type', 'post');\n\t\t\t$this->db->where('post_author', $id);\n\t\t\t$this->db->where('wp_1_term_relationships.term_taxonomy_id', $key);\n\t\t\t\n\t\t\t$this->db->order_by($this->tabla . '.post_date', 'DESC');\n\t\t\t\n\t\t\t$this->db->limit($posts, 0);\n\t\t\t$query = $this->db->get();\n\t\t\t$post[] = $query->result_array();\n\n\t\t}\n\n\t\treturn $post;\n\t\t\n }",
"public function addCategory(String $name, string $slug, Int $postId): bool\n {\n $query = $this->pdo->prepare(' INSERT INTO category (name, slug) VALUE (:name, :slug)');\n $query->bindValue(':name', $name, ':slug', $slug);\n $query->execute();\n $categoryId = $this->pdo->lastInsertId();\n\n $query = $this->pdo->prepare('INSERT INTO post_category (post_id, category_id) VALUE (:postId, :categoryId)');\n $query->bindValue(':postId', $postId,':categoryId', $categoryId);\n return $query->execute();\n //After that insert the id in the post_category table \n }",
"function publicacoes_relacionadas() { \n $limitpost = 3;\n global $post;\n \n $tags = wp_get_post_tags($post->ID);\n $tag_ids = array();\n foreach($tags as $individual_tag) $tag_ids[] = $individual_tag->term_id;\n $args_tags = array( 'tag__in' => $tag_ids, 'post__not_in' => array($post->ID), 'order' => 'RAND', 'posts_per_page'=> $limitpost, 'ignore_sticky_posts'=> 1 );\n $my_query_tags = new WP_Query($args_tags);\n \n \n if ($my_query_tags->have_posts()) {\n $i = 1;\n while($my_query_tags->have_posts()) {\n $my_query_tags->the_post();\n ?>\n \n <div class=\"item\" style=\"background-image: url('<?php thumb_url(); ?>');\">\n <a href=\"<?php the_permalink(); ?>\"><h5><?php the_title(); ?></h5></a>\n </div> \n\n\n <?php $i++; }\n }\n \n else {}\n wp_reset_query();\n}",
"public function view($id = null) {\n\n $this->set('category', $this->Category->find('first'));\n\n $sql_category = 'SELECT `post_category`.`id`,`title`,`name`,`post_category`.`user_id`,`category`,`category_id`,`body`,`post_category`.`created`,`posted`, `post_category`.`modified` \n FROM (SELECT `posts`.`id`, `posts`.`title`,`posts`.`body`,`categories`.`category`,`posts`.`category_id`,`user_id`,`posts`.`created`,`posts`.`posted`,`posts`.`modified` \n FROM `posts` \n LEFT JOIN `categories` \n ON `posts`.`category_id` = `categories`.`id`) \n AS `post_category` \n LEFT JOIN `users` \n ON `post_category`.`user_id`=`users`.`id` \n WHERE category_id = '.$id.' \n ORDER BY `post_category`.`modified` \n DESC;' ;\n \n //'SELECT * FROM `posts` LEFT JOIN `categories` ON `posts`.`category_id` = `categories`.`id` where category_id ='.$id.';';\n //SELECT * FROM `posts` LEFT JOIN `categories` ON `posts`.`category_id` = `categories`.`id` where category_id = 4\n //$this->Category->query($sql_category);\n\n $category_post = $this->Category->query($sql_category);\n\n // $post_id = category_post[]\n\n // $sql_pic = '';\n\n //debug($this->Category->query($sql_category));\n\n $this->set('category_post', $category_post);\n //$this->set('category_pic', $this->Category->query($sql_pic));\n\n // $sql_picture = ' ';\n\n // $this->set('category_picture', $this->Picture->query($sql_picture));\n\n //$sel_auther = ' '; // 投稿記事の筆者名を表示、筆者のプロフィールページのリンクを貼る\n\n //$this->set('category_post', $this->Category->query($sel_auther)); \n\n\n if (!$id) {\n throw new NotFoundException(__('Invalid category'));\n }\n\n $category = $this->Category->findById($id);\n if (!$category) {\n throw new NotFoundException(__('Invalid category'));\n }\n $this->set('category', $category);\n\n }",
"public function CategoryPost()\n {\n \treturn $this->hasMany('App\\Posts', 'category_id_fkey', 'id');\n }",
"public function findPostBySlug($post_id) {\n $sql = \"SELECT * \n FROM posts p \n INNER JOIN users u ON p.author_id = u.id \n INNER JOIN categories c ON p.cat_id = c.cat_id\n WHERE p.post_id = $post_id\";\n return mysqli_query($this->conn, $sql)->fetch_assoc();\n }",
"function kcsite_update_posts_cats(){\n\tglobal $staticVars;\n\t$args = array(\n\t\t'post_type' => 'post', \n\t\t'post_status' => 'any',\n\t\t'numberposts' => 1000,\n\t\t'lang' => pll_current_language('slug'),\n\t\t'tax_query' => array(\n\t\t\tarray(\n\t\t\t\t'taxonomy' => 'new-type',\n\t\t\t\t'field' => 'id',\n\t\t\t\t'terms' => array($staticVars['ordinaryNewTypeID']),\n\t\t\t\t'operator' => 'NOT IN'\n\t\t\t)\n\t\t)\n\t);\t\t\t\n\t$results = get_posts($args);\n\tforeach ($results as $key => $val) {\n\t\twp_set_post_terms($val->ID, array($staticVars['ordinaryNewTypeID']), 'new-type');\n\t}\t\n\t// iprastos lt - 89, iprastos en - 15\n}",
"function getLikesByPost($post_id) {\r\n// left join users u on pl.user_id=u.user_id \r\n//where \";\r\n // echo $sql;\r\n \r\n return $this->getLikes(\"pl.post_id=$post_id\");\r\n }",
"function RPPKB_custom_related($atts){\r\n \r\n $post_objects = array();\r\n $full_URL_site = $_SERVER['REQUEST_SCHEME'] . \"://\" . $_SERVER['HTTP_HOST'];\r\n $related_post = __(\"related\", \"paperback\");\r\n $content = '\r\n\t\t\t<?php\t$ratingthis = __(\"rating\", \"paperback\"); ?>\r\n\t\t <div id=\"jp-relatedposts\" class=\"jp-relatedposts\" style=\"display: block;\">\r\n <h2 class=\"h2\">' . $related_post . '</h2>';\r\n \r\n // categorías del post actual\r\n $categories = get_the_category();\r\n // argumentos de Query\r\n $args = array(\r\n 'posts_per_page' => 3,\r\n 'meta_key' => 'post_views_count',\r\n 'orderby' => 'meta_value_num',\r\n 'order' => 'DESC',\r\n 'category__in' => array(\r\n $categories[0]->cat_ID\r\n ),\r\n 'post_type' => 'post',\r\n 'post_status' => 'publish',\r\n 'post__not_in' => array( get_the_ID( ) ),\r\n );\r\n\r\n /** Get related posts */\r\n // Consulta a los posts\r\n $related = array();\r\n $queriable = new WP_Query( $args );\r\n \r\n if ( $queriable->have_posts() ) :\r\n \r\n while ( $queriable->have_posts() ) : \r\n $queriable->the_post();\r\n array_push( $related, array( \"id\"=>get_the_ID( ) ) );\r\n endwhile;\r\n else : \r\n null;\r\n endif;\r\n wp_reset_postdata();\r\n\r\n if ($related) {\r\n foreach ($related as $result) {\r\n\r\n // Get the related post IDs\r\n $related_post = get_post($result['id']);\r\n $categories = get_the_category($result['id']);\r\n $content .= '<div class=\"related\">\r\n <div class=\"related__body\">\r\n <a class=\"related__category\" href=\"' . $full_URL_site . '/category/' . $categories[0]->slug . '/\">';\r\n if (!empty($categories)) {\r\n $content .= $categories[0]->cat_name;\r\n }\r\n $content .= '</a>\r\n <span class=\"related__date\">' . date_i18n(\"d. F Y\", strtotime($related_post->post_date)) . '</span>\r\n <span class=\"related__title\"><a href=\"' . $full_URL_site . \"/\" . $related_post->post_name . '\">\r\n ' . do_shortcode($related_post->post_title) . '\r\n </a></span></div><div class=\"related__img\">';\r\n $content .='<a href=\"' . $full_URL_site . \"/\" . $related_post->post_name . '\">';\r\n if (get_field('alternate_thumbnail', $result['id'])['sizes']['child_size']) {\r\n $content .= '<img src=\"'. get_field('alternate_thumbnail', $result['id'])['sizes']['child_size'] .'\" alt=\"\">';\r\n } elseif (has_post_thumbnail($related_post->ID, 'child_size')) {\r\n $content .= get_the_post_thumbnail($related_post->ID, 'child_size');\r\n } elseif (get_site_icon_url()) {\r\n $content .= '<div class=\"post_img_icon\"><img src=\"' . get_site_icon_url() . '\" alt=\"\"></div>';\r\n } else {\r\n $content .= '<img src=\"' . get_stylesheet_directory_uri() . '/images/default_post_image.png\" class=\"attachment-child_size size-child_size wp-post-image\" alt=\"\">';\r\n }\r\n\r\n $content .= '</a>';\r\n $content .= '</div></div>';\r\n }\r\n }\r\n \r\n $content .= '</div>';\r\n return $content;\r\n}",
"function post_url($post){\n return strtolower($post->category_name). '/' . e($post->post_slug);\n}",
"function aff_comm_post($id_post) {\n\n\t\t$req = $GLOBALS['bdd']->prepare('SELECT b.*, d.*\n\t\t\t\t\t\t\t\tFROM badin b\n\t\t\t\t\t\t\t\tINNER JOIN dactyle d\n\t\t\t\t\t\t\t\tON b.bigarade = d.dazibao\n\t\t\t\t\t\t\t\tWHERE b.balsamine = ? \n\t\t\t\t\t\t\t\tAND b.bouquetin = 2\n\t\t\t\t\t\t\t\tORDER BY b.brimade DESC');\n\t\t$req->execute(array($_POST['post_id']));\n\t\t\t\t\t\t\t\t\t\n\t\twhile ($donnees = $req->fetch())\n\t\t{\n\t\t?>\n\t\t\t<div id=\"<?php echo $donnees['baliverne'];?>\" >\n\t\t\t\t<div class=\"zone_comment\" id=\"zone_comment\">\n\t\t\t\t\t<div class=\"mini_profil_comment\">\n\t\t\t\t\t\t<img class=\"mini_profil_img\" src=\"/ressources/images/profil/<?php echo $donnees['dazibao'];?>/profil_<?php echo $donnees['dessication'];?>\" />\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class=\"auteur_et_date_comment\" >\n\t\t\t\t\t\t<a class=\"lien_nom_comment\" href=\"/<?php echo $donnees['diatribe'].'/'.$donnees['decapode'].'-'.$donnees['dazibao'].'/';?>\">\n\t\t\t\t\t\t\t<?php echo $donnees['decapode'];?>\n\t\t\t\t\t\t</a>\n\t\t\t\t\t\t<div class=\"date_post\" >\n\t\t\t\t\t\t\tLe <?php echo $donnees['brimade'];?>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class=\"contenu_comment\">\n\t\t\t\t\t\t<?php echo $donnees['bryophite']; ?>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t<?php\n\t\t}\n\t\t$req->closeCursor();\n\n\t}",
"static function getPostsObjectsFromPostIds($posts_ids){\n $publishedPosts = array();\n for ($i=0; $i < count($posts_ids); $i++) {\n $post_data = self::getPostsMetaDataByPostID($posts_ids[$i]);\n $post_data[\"title\"] = get_the_title($posts_ids[$i]);\n //if there should be a specific image\n if($post_data['background_image'] != \"\"){\n $post_data['background_image'] = get_field(\"background_image\",$posts_ids[$i]);\n }\n // check the category and construct the url\n\n $postCategoryNative = get_the_category($posts_ids[$i]);\n $post_data['category_id'] = $postCategoryNative[0]->term_id;\n\n if( $post_data['category_id']){\n $category_name = get_the_category_by_id($post_data[\"category_id\"]);\n $post_data['category'] = $category_name ? $category_name:\"\";\n //init the feed url according to the category\n $post_data['url'] = get_category_feed_link($post_data['category_id']);\n }else{\n $post_data['url'] = get_field('url',$posts_ids[$i]);\n }\n\n // if($post_data['category']!=\"\"){\n // $post_data['category_id'] = $post_data['category'];\n // $category_name = get_the_category_by_id($post_data[\"category_id\"]);\n // $post_data['category'] = $category_name ? $category_name:\"\";\n // //init the feed url according to the category\n // $post_data['url'] = get_category_feed_link($post_data['category_id']);\n // }\n array_push($publishedPosts,$post_data);\n }\n return $publishedPosts;\n }",
"public function getAllPosts($getPag = 0)\n {\n $sql = \"SELECT id FROM 2d_posts WHERE status = 1\";\n $query = $this->db->query($sql);\n $nbRows = $query->num_rows();\n // Get query result\n $sql = \"SELECT po.id AS id, po.title AS title, po.url AS url, po.id_category AS id_category, po.content AS content, po.image AS image, po.date_created AS date_created, ca.title AS cat_title, ca.url AS cat_url, ca.image AS cat_image, us.username AS username, us.url AS author_url\n \t\t\tFROM 2d_posts po, 2d_posts_categories ca, 2d_users us\n \t\t\tWHERE (ca.id = po.id_category) AND (po.author = us.id) AND (po.status = 1)\n \t\t\tORDER BY date_created DESC\n \t\t\tLIMIT ?,?\";\n $query = $this->db->query($sql, array((int)$getPag, (int)$this->config->item('blog_pag')));\n if($query->num_rows() > 0) {\n $getCategoryPosts = '';\n foreach ($query->result() as $row) {\n $getCategoryPosts .= '<div class=\"col-sm-12\">\n <a href=\"'.site_url('post/'.$row->url).'/\" class=\"image-popup\" title=\"'.$row->title.'\">\n '.(!empty($row->image) ? '<img src=\"'.$row->image.'\" class=\"thumb-img\" alt=\"'.$row->title.'\">' : '').'\n </a>\n <div class=\"container-mobile\">\n <h2 class=\"h5\"><a href=\"'.site_url('post/'.$row->url.'/').'\" title=\"'.$row->title.'\">'.mb_strimwidth($row->title, 0, 50, '...').'</a> </h2>\n <span>'.$this->lang->line('by').' <a href=\"'.site_url('user/'.$row->author_url.'/').'\">'.$row->username.'</a> | <a href=\"'.site_url('post/category/'.$row->cat_url.'/').'\">'.$row->cat_title.'</a> | '.gmdate(\"M d, Y\", strtotime($row->date_created)).'</span>\n <p>'.mb_strimwidth(strip_tags($row->content), 0, 300, '...').'</p>\n <a href=\"'.site_url('post/'.$row->url).'/\" class=\"btn btn-inverse btn-sm\">'.$this->lang->line('Read more').'</a>\n <hr>\n </div>\n </div>';\n }\n return array(\n 'id' => $row->id,\n 'getBlocVideo' => $getCategoryPosts,\n 'cat_title' => $row->cat_title,\n 'cat_url' => $row->cat_url,\n 'cat_image' => $row->cat_image,\n 'id_category' => $row->id_category,\n 'nbRows' => $nbRows\n );\n } else {\n return array(\n 'getBlocVideo' => null,\n 'cat_title' => null,\n 'cat_url' => null,\n 'cat_image' => null,\n 'id_category' => null,\n 'nbRows' => null\n );\n }\n }",
"private function getCategoriesByPost($posts) {\n foreach ($posts as $post) {\n $post_categories = $post->post_categorie;\n foreach ($post_categories as $post_categorie) {\n $categories = $post_categorie->categories;\n foreach ($categories as $categorie) {\n $ctg[$post->post_id].= empty($ctg[$post->post_id]) ? $categorie->categorie_name : \", \" . $categorie->categorie_name;\n }\n }\n }\n return $ctg;\n }",
"public function category($id){\n\t\t$categorie = $this->Category->find($id);\n\n\t\tif ($categorie === false) {\n\t\t\t$this->notFound();\n\t\t}\n\t\t$posts = $this->Post->lastByCategory($id);\n\t\t$categories = $this->Category->all();\n\n\t\t['posts'=>$posts, 'categorie'=>$categorie, 'categories'=>$categories];\n\t\t$this->render('posts.category', compact('posts', 'categories', 'categorie'));\n\t}",
"public function singlepost($slug)\n {\n $post = POST::with('category', 'tag', 'user')\n ->where('slug', $slug)\n ->firstOrFail();\n // $posts = Post::where('category_id', $post->category_id)->inRandomOrder()->limit(3)->get();\n $posts = Post::where('category_id', $post->category_id)\n ->where('slug', '!=', $slug)\n ->inRandomOrder()\n ->limit(3)\n ->with('comment')\n ->get();\n $prev = Post::where('id', '<', $post->id)\n ->orderBy('id', 'desc')\n ->first();\n // $prev = Post::where('id', '<', $post->id)->get()->sortByDesc('id')->first();\n $next = Post::where('id', '>', $post->id)\n ->orderBy('id')\n ->first();\n $categories = Category::all();\n if (count($post->tag) >= 10) {\n $tags = $post->tag->random(10);\n } else {\n $tags = $post->tag;\n }\n $main_menu_id = Menus::where('name', 'main-menu')\n ->with('items')\n ->first();\n if (isset($main_menu_id)) {\n $main_menu_id = $main_menu_id->id;\n }\n $main_menu = MenuItems::where('menu', $main_menu_id)\n ->orderBy('sort')\n ->get();\n $setting = Setting::all()->first();\n $post_visitor = Post::where('slug', $post->slug)->first()->visitor;\n DB::table('posts')\n ->where('slug', $post->slug)\n ->update(['visitor' => $post_visitor + 1]);\n $popular_posts = Post::orderBy('visitor', 'desc')\n ->take(10)\n ->with('category')\n ->inRandomOrder()\n ->limit(4)\n ->get();\n $most_visit = Post::orderBy('visitor', 'desc')->first();\n $post_id = Post::where('slug', $slug)->first()->id;\n $comments = Comment::where('p_id', 0)\n ->where('post_id', $post_id)\n ->where('status', 1)\n ->get();\n $comment_count = count(\n Comment::where('post_id', $post_id)\n ->where('status', 1)\n ->get()\n );\n $socials = Social::all();\n\n return view('front.view', compact('post', 'posts', 'categories', 'prev', 'next', 'tags', 'setting', 'main_menu', 'popular_posts', 'most_visit', 'comments', 'comment_count', 'socials'));\n }",
"static function get_post_by_cat_id($post){\n\t\treturn self::$db->where('cat_id',$post)->get('blog')->row();\n\t}"
] |
[
"0.6228494",
"0.59819555",
"0.58859265",
"0.57695824",
"0.57262874",
"0.5697657",
"0.569126",
"0.5685995",
"0.5682421",
"0.55950016",
"0.55876625",
"0.55762297",
"0.5571337",
"0.5515739",
"0.55036044",
"0.5503351",
"0.5498198",
"0.5445727",
"0.53675586",
"0.53600883",
"0.5359628",
"0.5351364",
"0.53507614",
"0.5342072",
"0.5329379",
"0.53288996",
"0.5325038",
"0.53118235",
"0.5309822",
"0.52702254"
] |
0.5995839
|
1
|
Return the attribute codes for all attributes currently used in configurable products.
|
public function getConfigurableAttributes()
{
$connection = $this->_frameworkModelResource->getConnection("core_write");
$select = $connection->select();
$select->from(
["a" => $this->_frameworkModelResource->getTableName("eav_attribute")],
["attribute" => "a.attribute_code"]
);
$select->join(
["s" => $this->_frameworkModelResource->getTableName("catalog_product_super_attribute")],
"a.attribute_id = s.attribute_id",
""
);
$select->group(["a.attribute_code"]);
return $connection->fetchCol($select);
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"protected function getAvataxAttributesCode()\n {\n $store = $this->storeManager->getStore();\n $attributesCode = [];\n\n $attributesCode[] = $this->configHelper->getFirstReferenceCode($store);\n $attributesCode[] = $this->configHelper->getSecondReferenceCode($store);\n\n\n if ($this->configHelper->getUseUpcCode($store)) {\n $attributesCode[] = $this->configHelper->getUpcCode($store);\n }\n\n return $attributesCode;\n }",
"protected function _getSearchableAttributes()\n {\n if (is_null($this->_searchableAttributes)) {\n /** @var $attributeCollection Mage_Catalog_Model_Resource_Product_Attribute_Collection */\n $attributeCollection = Mage::getResourceModel('catalog/product_attribute_collection');\n $attributeCollection->addIsSearchableFilter();\n foreach ($attributeCollection as $attribute) {\n $this->_searchableAttributes[] = $attribute->getAttributeCode();\n }\n }\n return $this->_searchableAttributes;\n }",
"public function getUsableAttributeCodes($store = null)\n {\n return explode(\",\", Mage::getStoreConfig(self::XML_PATH_TAGS_ATTRIBUTE_CODES, $store));\n }",
"protected function _getSearchableAttributes()\n {\n if (is_null($this->_searchableAttributes)) {\n /** @var $attributeCollection Mage_Catalog_Model_Resource_Product_Attribute_Collection */\n $attributeCollection = Mage::getResourceModel('catalog/product_attribute_collection');\n $attributeCollection->addIsSearchableFilter();\n\n foreach ($attributeCollection as $attribute) {\n $this->_searchableAttributes[] = $attribute->getAttributeCode();\n }\n }\n\n return $this->_searchableAttributes;\n }",
"public function getProductAttributes()\n\t{\n\t\treturn $this->arrAttributes;\n\t}",
"protected function getProductAttrCodesUseForTermGeneration()\n {\n if (count($this->_productAttrCodesUseForTermGeneration) < 1) {\n $productAttributeCodes = $this->_helper->getAutocompleteSetting('termgeneration/product_attribute_codes');\n $productAttributeCodes = trim($productAttributeCodes, ',');\n $this->_productAttrCodesUseForTermGeneration = explode(',', $productAttributeCodes);\n }\n return $this->_productAttrCodesUseForTermGeneration;\n }",
"public function getAttributes()\n\t{\n\t\t$arrData = array();\n\n\t\tforeach ($this->getProductAndVariantAttributes() as $attribute)\n\t\t{\n\t\t\t$arrData[$attribute] = $this->$attribute;\n\t\t}\n\n\t\treturn $arrData;\n\t}",
"public function getConfigurableAttributesAttribute()\n {\n return $this->custom_attributes()->where('attributes.is_configurable', 1)->where('attributes.type', 'select')->get();\n }",
"public static function attributeMap()\n {\n return [\n 'application_id' => 'application_id',\n 'is_default' => 'is_default',\n 'role' => 'role',\n 'type' => 'type',\n '_issues' => '_issues'\n ];\n }",
"protected function defineAttributes()\n {\n return array_merge(parent::defineAttributes(), array(\n 'state' => array(AttributeType::String, 'default' => ''),\n 'category' => array(AttributeType::String, 'default' => ''),\n 'code' => array(AttributeType::String, 'default' => ''),\n 'include' => array(AttributeType::Number, 'default' => ''),\n 'taxable' => array(AttributeType::String, 'default' => ''),\n 'zip' => array(AttributeType::String, 'default' => ''),\n ));\n }",
"public function getAttributesList() {\n return $this->_get(15);\n }",
"public function getAttributesList() {\n return $this->_get(15);\n }",
"function getAttrList() {\n return array_keys($this->attributes);\n }",
"public static function attributeMap()\n {\n return [\n 'status' => 'status',\n 'quota' => 'quota'\n ];\n }",
"public function getApplicableAttributes(): array\n {\n return array_keys($this->defaults);\n }",
"public function getAttributesList() {\n return $this->_get(24);\n }",
"public function getAttributeCode()\r\n {\r\n return $this->getAttribute()->getAttributeCode();\r\n }",
"public function listProductAttributes(): Collection\n {\n return $this->model->attributes()->get();\n }",
"protected function _getExportAttrCodes()\n {\n return [];\n }",
"protected function _getExportAttrCodes()\n {\n return [];\n }",
"public function getAttributes()\n {\n return [\n Attributes\\IdAttribute::make(),\n Attributes\\TextAttribute::make('code'),\n Attributes\\TextAttribute::make('name'),\n Attributes\\BelongsToAttribute::make('vendor_id')\n ->setRelationName('vendor')\n ->setRelationManager(DeliveryPointVendorManager::class)\n ->setRequired(true),\n Attributes\\BelongsToAttribute::make('address_id')\n ->setRelationName('address')\n ->setRelationManager(AddressManager::class)\n ->setRequired(true),\n Attributes\\TextAttribute::make('address_code'),\n Attributes\\CreatedAtAttribute::make(),\n Attributes\\UpdatedAtAttribute::make(),\n Attributes\\DeletedAtAttribute::make(),\n ];\n }",
"public function getAttributesList() {\n return $this->_get(9);\n }",
"protected function getCommonAttributes()\n {\n return array(\n 'autocreated' => array('values' => array('a', 'aut', 'autocreated'), 'variant' => true),\n 'mandatory' => array('values' => array('m', 'man', 'mandatory'), 'variant' => true),\n 'protected' => array('values' => array('p', 'pro', 'protected'), 'variant' => true),\n 'COPY' => array('values' => array('COPY'), 'variant' => false),\n 'VERSION' => array('values' => array('VERSION'), 'variant' => false),\n 'INITIALIZE' => array('values' => array('INITIALIZE'), 'variant' => false),\n 'COMPUTE' => array('values' => array('COMPUTE'), 'variant' => false),\n 'IGNORE' => array('values' => array('IGNORE'), 'variant' => false),\n 'ABORT' => array('values' => array('ABORT'), 'variant' => false),\n 'OPV' => array('values' => array('OPV'), 'variant' => true),\n );\n }",
"public function getAttributesList() {\n return $this->_get(7);\n }",
"public static function attributeMap()\n {\n return parent::attributeMap() + self::$attributeMap;\n }",
"public static function attributeMap()\n {\n return parent::attributeMap() + self::$attributeMap;\n }",
"public static function attributeMap()\n {\n return parent::attributeMap() + self::$attributeMap;\n }",
"public static function attributeMap()\n {\n return parent::attributeMap() + self::$attributeMap;\n }",
"public static function attributeMap()\n {\n return parent::attributeMap() + self::$attributeMap;\n }",
"public static function attributeMap()\n {\n return parent::attributeMap() + self::$attributeMap;\n }"
] |
[
"0.75357944",
"0.68951845",
"0.68629783",
"0.68481785",
"0.6753887",
"0.6734485",
"0.6699742",
"0.6541152",
"0.65349275",
"0.6433573",
"0.63902277",
"0.63902277",
"0.63859546",
"0.6385899",
"0.63857967",
"0.6375184",
"0.6374667",
"0.6345969",
"0.63369465",
"0.63369465",
"0.6313797",
"0.6312636",
"0.6309377",
"0.6279128",
"0.6276067",
"0.6276067",
"0.6276067",
"0.6276067",
"0.6276067",
"0.6276067"
] |
0.77876896
|
0
|
Return a list of all Magento attributes that are used by Product Sync when collecting product data.
|
public function getUsedMagentoAttributes()
{
$attributeMapValues = array_values($this->getAttributeMap());
$flatAttributesArray = array_merge(...$attributeMapValues);
$result = array_merge($flatAttributesArray, $this->getConfigurableAttributes());
return array_unique($result);
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function listProductAttributes(): Collection\n {\n return $this->model->attributes()->get();\n }",
"public function getProductAttributes()\n\t{\n\t\treturn $this->arrAttributes;\n\t}",
"public function getAttributes()\n {\n /* @var $attributes Mage_Catalog_Model_Resource_Eav_Resource_Product_Attribute_Collection */\n $attributes = $this->getData('attributes');\n if (is_null($attributes)) {\n $product = Mage::getModel('catalog/product');\n $attributes = Mage::getResourceModel('catalog/product_attribute_collection')\n ->addHasOptionsFilter()\n ->addDisplayInAdvancedSearchFilter()\n ->addStoreLabel(Mage::app()->getStore()->getId())\n ->setOrder('main_table.attribute_id', 'asc')\n ->load();\n foreach ($attributes as $attribute) {\n $attribute->setEntity($product->getResource());\n }\n $this->setData('attributes', $attributes);\n }\n return $attributes;\n }",
"public function getProductAndVariantAttributes()\n\t{\n\t\treturn array_unique(array_merge($this->arrAttributes, $this->arrVariantAttributes));\n\t}",
"public function getAttributes()\n\t{\n\t\t$arrData = array();\n\n\t\tforeach ($this->getProductAndVariantAttributes() as $attribute)\n\t\t{\n\t\t\t$arrData[$attribute] = $this->$attribute;\n\t\t}\n\n\t\treturn $arrData;\n\t}",
"public function getAttributesList() {\n return $this->_get(15);\n }",
"public function getAttributesList() {\n return $this->_get(15);\n }",
"public function getAttributesList() {\n return $this->_get(24);\n }",
"public function getAttributesList() {\n return $this->_get(3);\n }",
"public function getAttributesList() {\n return $this->_get(2);\n }",
"public function getAttributesList() {\n return $this->_get(9);\n }",
"public function getAttributesList() {\n return $this->_get(7);\n }",
"public function getAttributesUsedInRecommender()\n {\n if ($this->_usedInRecommender === null) {\n $this->_usedInRecommender = [];\n $entityType = \\Magento\\Catalog\\Model\\Product::ENTITY;\n\n $attributesData = $this->_getResource()->getAttributesUsedInRecommender();\n $this->_eavConfig->importAttributesData($entityType, $attributesData);\n\n foreach ($attributesData as $attributeData) {\n $attributeCode = $attributeData['attribute_code'];\n $this->_usedInRecommender[$attributeCode] = $this->_eavConfig->getAttribute(\n $entityType, $attributeCode\n );\n }\n }\n return $this->_usedInRecommender;\n }",
"public function getConfigurableAttributes()\n {\n $connection = $this->_frameworkModelResource->getConnection(\"core_write\");\n $select = $connection->select();\n $select->from(\n [\"a\" => $this->_frameworkModelResource->getTableName(\"eav_attribute\")],\n [\"attribute\" => \"a.attribute_code\"]\n );\n $select->join(\n [\"s\" => $this->_frameworkModelResource->getTableName(\"catalog_product_super_attribute\")],\n \"a.attribute_id = s.attribute_id\",\n \"\"\n );\n $select->group([\"a.attribute_code\"]);\n\n return $connection->fetchCol($select);\n }",
"public function getAttributes()\n {\n return $this->where('isRelation', false)->pluck('attribute')->toArray();\n }",
"public function getAttributes() {\n return array_merge($this->getFields(), $this->getProperties());\n }",
"protected function getAttributes()\n {\n return [];\n }",
"protected function getAttributes()\n {\n try {\n return $this->attributeManagement->getAttributes(Product::ENTITY, $this->getDefaultAttributeSetId());\n } catch (NoSuchEntityException $e) {\n echo $e->getMessage();die;\n }\n }",
"public function getConfigurableAttributes($product)\n {\n \\Magento\\Framework\\Profiler::start(\n 'CONFIGURABLE:' . __METHOD__,\n ['group' => 'CONFIGURABLE', 'method' => __METHOD__]\n );\n if (!$product->hasData($this->_allConfigurableAttributes)) {\n // for new product do not load configurable attributes\n if (!$product->getId()) {\n return [];\n }\n $_objectManager = \\Magento\\Framework\\App\\ObjectManager::getInstance();\n $productTypeInstance = $_objectManager->get('Magento\\ConfigurableProduct\\Model\\Product\\Type\\Configurable');\n $configurableAttributes = $productTypeInstance->getConfigurableAttributeCollection($product);\n $configurableAttributes->orderByPosition()->load();\n $product->setData($this->_allConfigurableAttributes, $configurableAttributes);\n }\n \\Magento\\Framework\\Profiler::stop('CONFIGURABLE:' . __METHOD__);\n return $product->getData($this->_allConfigurableAttributes);\n }",
"public static function getAllCartOrderProductAttributes() {\n\t\t$sql = 'select `orders_products_attributes_id` from cart_orders_products_attributes';\n\t\t$results = Database::singleton()->query_fetch_all($sql);\n\t\t\n\t\tforeach ($results as &$result) {\n\t\t\t$result = new CartOrderProductAttribute($result['orders_products_attributes_id']);\n\t\t}\n\t\t\n\t\treturn $results;\n\t}",
"public function getAttributes()\n {\n return [\n Attributes\\IdAttribute::make(),\n Attributes\\TextAttribute::make('code'),\n Attributes\\TextAttribute::make('name'),\n Attributes\\BelongsToAttribute::make('vendor_id')\n ->setRelationName('vendor')\n ->setRelationManager(DeliveryPointVendorManager::class)\n ->setRequired(true),\n Attributes\\BelongsToAttribute::make('address_id')\n ->setRelationName('address')\n ->setRelationManager(AddressManager::class)\n ->setRequired(true),\n Attributes\\TextAttribute::make('address_code'),\n Attributes\\CreatedAtAttribute::make(),\n Attributes\\UpdatedAtAttribute::make(),\n Attributes\\DeletedAtAttribute::make(),\n ];\n }",
"function getAttrList() {\n return array_keys($this->attributes);\n }",
"public function getAttributes()\n {\n return collect(parent::getAttributes())\n ->except(array_keys($this->fieldAttributes()))\n ->toArray();\n }",
"public function attributes()\n {\n return $this->activeAttributes();\n }",
"public function attributes()\n {\n return [\n //'uid' => '用户id',\n 'payChannel' => '支付类型',\n 'money' => '商品金额',\n 'number' => '商品数量',\n 'goodsTitle' => '商品标题',\n 'goodsDesc' => '商品内容',\n 'deviceInfo' => '设备信息',\n 'description' => '来源类型',\n ];\n }",
"public function getAttributes(): array {\n return $this->attributes;\n }",
"public function getAttributes() {\n return $this->attributes->getArray();\n }",
"private function getAttributesArrayFromLoadedProduct($product)\n {\n $attributes = $this->config->getEntityAttributes(\n \\Magento\\Catalog\\Model\\Product::ENTITY,\n $product\n );\n\n return array_keys($attributes);\n }",
"public function getAttributes(): array\n {\n return $this->_attributes;\n }",
"public function getAttributes(): array\n {\n return $this->attributes;\n }"
] |
[
"0.76181275",
"0.7313416",
"0.7260181",
"0.72260576",
"0.71714866",
"0.6969994",
"0.6969994",
"0.69243723",
"0.69152033",
"0.6913765",
"0.69007015",
"0.6891886",
"0.6854286",
"0.6847423",
"0.68386906",
"0.6798432",
"0.6793431",
"0.6694994",
"0.66322535",
"0.6611094",
"0.6590382",
"0.65890175",
"0.65827584",
"0.6566296",
"0.65624666",
"0.65592647",
"0.65501624",
"0.6547754",
"0.6537064",
"0.6531417"
] |
0.7680629
|
0
|
Return the URL rewrite data for the given products for the current store.
|
protected function getUrlRewriteData($productIds)
{
$data = [];
try {
$store = $this->_storeModelStoreManagerInterface->getStore();
} catch (NoSuchEntityException $e) {
$this->_logger->error($e->getMessage(), ['class' => __CLASS__, 'method' => __METHOD__]);
return $data;
}
$connection = $this->_frameworkModelResource->getConnection("core_write");
$stmt = $connection->query(
$this->_searchHelperCompat->getProductUrlRewriteSelect($productIds, $store->getId())
);
try {
while ($row = $stmt->fetch()) {
if (!isset($data[$row['entity_id']])) {
$data[$row['entity_id']] = $row['request_path'];
}
}
} catch (\Zend_Db_Statement_Exception $e) {
$this->_logger->error($e->getMessage(), ['class' => __CLASS__, 'method' => __METHOD__]);
}
return $data;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"protected function _getProductEnterpriseUrlRewrites(Mage_Catalog_Model_Product $product)\n {\n $requestPath = $this->_connection->getIfNullSql('url_rewrite.request_path', 'default_ur.request_path');\n $targetPath = $this->_connection->getIfNullSql('url_rewrite.target_path', 'default_ur.target_path');\n\n $select = $this->_connection->select()\n ->from(array('e' => $this->_resource->getTableName('catalog/product')),\n array('product_id' => 'entity_id')\n )\n ->where('e.entity_id = ?', $product->getId())\n ->joinLeft(array('url_rewrite_product' => $this->_resource->getTableName('enterprise_catalog/product')),\n 'url_rewrite_product.product_id = e.entity_id',\n array(''))\n ->joinLeft(array('url_rewrite' => $this->_resource->getTableName('enterprise_urlrewrite/url_rewrite')),\n 'url_rewrite_product.url_rewrite_id = url_rewrite.url_rewrite_id AND url_rewrite.is_system = 1',\n array(''))\n ->joinLeft(array('default_urp' => $this->_resource->getTableName('enterprise_catalog/product')),\n 'default_urp.product_id = e.entity_id AND default_urp.store_id = 0',\n array(''))\n ->joinLeft(array('default_ur' => $this->_resource->getTableName('enterprise_urlrewrite/url_rewrite')),\n 'default_ur.url_rewrite_id = default_urp.url_rewrite_id',\n array('request_path' => $requestPath, 'target_path' => $targetPath, 'store_id')\n );\n\n $rewrites = array();\n foreach ($this->_connection->fetchAll($select) as $row) {\n $rewrites[] = $this->_fixRequestPathSuffix($row);\n }\n\n return $rewrites;\n }",
"protected function _getProductCoreUrlRewrites(Mage_Catalog_Model_Product $product)\n {\n $select = $this->_connection->select()\n ->from($this->_resource->getTableName('core/url_rewrite'))\n ->where('product_id = ?', $product->getId());\n\n $rewrites = array();\n foreach ($this->_connection->fetchAll($select) as $row) {\n $rewrites[] = $row;\n }\n\n return $rewrites;\n }",
"protected function _getUrlsForProduct(Mage_Catalog_Model_Product $product)\n {\n $urls = array();\n $urls[] = Mage::getUrl('catalog/product/view',\n array(\n 'id' => $product->getId(),\n 's' => $product->getUrlKey(),\n '_store' => $product->getStoreId() ? : $this->_defaultStoreId\n )\n );\n\n // collect all rewrites\n $coreUrlRewrites = $this->_getProductCoreUrlRewrites($product);\n\n /** @var Magneto_Varnish_Helper_Data $helper */\n $helper = Mage::helper('varnish');\n $enterpriseUrlRewrites = array();\n $enterpriseUrlRedirects = array();\n if ($helper->isModuleEnabled('Enterprise_Catalog')) {\n $enterpriseUrlRewrites = $this->_getProductEnterpriseUrlRewrites($product);\n $enterpriseUrlRedirects = $this->_getProductEnterpriseUrlRedirects($product);\n }\n\n $rewrites = array_merge($coreUrlRewrites, $enterpriseUrlRewrites, $enterpriseUrlRedirects);\n foreach ($rewrites as $r) {\n $urls[] = Mage::getUrl('',\n array(\n '_direct' => $r['request_path'],\n '_store' => $r['store_id'] ? : $this->_defaultStoreId\n )\n );\n $urls[] = Mage::getUrl('',\n array(\n '_direct' => $r['target_path'],\n '_store' => $r['store_id'] ? : $this->_defaultStoreId\n )\n );\n }\n\n return $urls;\n }",
"protected function _getProductEnterpriseUrlRedirects(Mage_Catalog_Model_Product $product)\n {\n $select = $this->_connection->select()\n ->from(array('e' => $this->_resource->getTableName('enterprise_urlrewrite/redirect')),\n array('request_path' => 'identifier', 'target_path', 'store_id')\n )\n ->where('e.product_id = ?', $product->getId());\n\n $redirects = array();\n foreach ($this->_connection->fetchAll($select) as $row) {\n $redirects[] = $row;\n }\n\n return $redirects;\n }",
"public function getProductUrls() {\n\t\t$urls = $this->crawler->filter( 'div.productInfo h3 a' )->each( function ( Crawler $node, $i ) {\n\t\t\treturn $node->attr( 'href' );\n\t\t} );\n\n\t\treturn $urls;\n\t}",
"public function productByUrlAction()\n {\n $search = \"http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]\";\n $words = explode('/', $search);\n $lastWord = array_pop($words);\n $vars['products'] = $this->model->getProductsBySearch($lastWord);\n $this->view->render('Riding Gear', $vars);\n }",
"function it_exchange_custom_url_tracking_addon_get_rewrite_rules() {\n\n\t$args = array(\n\t\t'meta_query' => array(\n\t\t\tarray(\n\t\t\t\t'key' => '_it-exchange-product-feature-custom-url-tracking',\n\t\t\t\t'compare' => 'EXISTS',\n\t\t\t)\n\t\t),\n\t\t'show_hidden' => true,\n\t);\n\t$rewrite_posts = it_exchange_get_products( $args );\n\n\t$rules = array();\n\tforeach( (array) $rewrite_posts as $key => $values ) {\n\t\t$custom_urls = get_post_meta( $values->ID, '_it-exchange-product-feature-custom-url-tracking', true );\n\t\tif ( ! empty( $custom_urls ) ) {\n\t\t\tforeach( (array) $custom_urls as $custom_url ) {\n\t\t\t\t$slug = empty( $custom_url['slug'] ) ? false : $custom_url['slug'];\n\t\t\t\t$method = empty( $custom_url['method'] ) ? 'passthrough' : $custom_url['method'];\n\t\t\t\tif ( empty( $slug ) || ! in_array( $method, array( 'passthrough', 'redirect' ) ) )\n\t\t\t\t\tcontinue;\n\n\t\t\t\tif ( 'redirect' == $method ) {\n\t\t\t\t\t$rules = array_merge( array( $slug => 'index.php?p=' . $values->ID . '&it_exchange_custom_url=' . urlencode( $slug ) ), $rules );\n\t\t\t\t} else {\n\t\t\t\t\t$post_type = 'it_exchange_prod';\n\t\t\t\t\t$product_slug = it_exchange_get_page_slug( 'product' );\n\t\t\t\t\t$product_name = $values->post_name;\n\t\t\t\t\t$rules = array_merge( array( $slug => 'index.php?page=0&post_type=' . $post_type . '&' . $product_slug . '=' . $product_name . '&p=' . $values->ID . '&it_exchange_custom_url=' . urlencode( $slug ) ), $rules );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn $rules;\n}",
"protected function getUrl($product)\n {\n $url = trim(Settings::get('octoshop_products_itemurl', '/product'), '/');\n\n return implode('/', [$url, $product->slug]);\n }",
"private function generateChangedProductUrls(\n MergeDataProvider $mergeDataProvider,\n Category $category,\n int $storeId,\n bool $saveRewriteHistory\n ) {\n $this->isSkippedProduct[$category->getEntityId()] = $category->getAffectedProductIds();\n\n $categoryStoreIds = [$storeId];\n // If category is changed in the Global scope when need to regenerate product URL rewrites for all other scopes.\n if ($this->productScopeRewriteGenerator->isGlobalScope($storeId)) {\n $categoryStoreIds = $this->getCategoryStoreIds($category);\n }\n\n foreach ($categoryStoreIds as $categoryStoreId) {\n /* @var Collection $collection */\n $collection = $this->productCollectionFactory->create()\n ->setStoreId($categoryStoreId)\n ->addIdFilter($category->getAffectedProductIds())\n ->addAttributeToSelect('visibility')\n ->addAttributeToSelect('name')\n ->addAttributeToSelect('url_key')\n ->addAttributeToSelect('url_path');\n\n $collection->setPageSize(1000);\n $pageCount = $collection->getLastPageNumber();\n $currentPage = 1;\n while ($currentPage <= $pageCount) {\n $collection->setCurPage($currentPage);\n foreach ($collection as $product) {\n $product->setData('save_rewrites_history', $saveRewriteHistory);\n $product->setStoreId($categoryStoreId);\n $mergeDataProvider->merge(\n $this->productUrlRewriteGenerator->generate($product, $category->getEntityId())\n );\n }\n $collection->clear();\n $currentPage++;\n }\n }\n }",
"public function getUrlInStore(\\Magento\\Catalog\\Model\\Product $product, $params = [])\n {\n $params['_scope_to_url'] = true;\n return $this->getUrl($product, $params);\n }",
"public function getProductUrl()\n {\n return $this->product_url;\n }",
"function parseProductUrl($product_url) {\n $matches = array();\n preg_match(\"#.*/store/([^/]+)/products/item\\?id=(\\d+)#i\", $product_url, $matches);\n if(empty($matches[1]) || empty($matches[2])) {\n return false;\n }\n \n return array('subdomain' => $matches[1], 'store_subdomain' => $matches[1], 'product_id' => $matches[2]);\n}",
"public function uri()\n {\n return sprintf('products/%s', $this->id);\n }",
"private function prepareProductsData($products)\n {\n \t$arrayIndex=0;\n\n \tforeach ($products as $product) {\n\n $searchData[$arrayIndex]['id'] = $product->id;\n \t\t$searchData[$arrayIndex]['product_name'] = $product->product_name;\n \t\t$searchData[$arrayIndex]['salts'] \t\t = $this->salt->getSalts($product);\n \t\t$searchData[$arrayIndex]['categories'] = $this->category->getCategories($product);\n \t\t$searchData[$arrayIndex]['packing'] = $this->packing->getPacking($product);\n \t\t$searchData[$arrayIndex]['unit'] \t\t = $this->unit->getUnit($product);\n \t\t$searchData[$arrayIndex]['company'] \t = $this->company->getCompany($product);\n // $searchData[$arrayIndex]['manufacturer'] = $this->manufacturer->getManufacturer($product);\n \t\t$searchData[$arrayIndex]['ailments'] = $this->ailment->getAilments($product);\n \t\t$searchData[$arrayIndex]['product_code'] = $product->product_code;\n \t\t$searchData[$arrayIndex]['product_mrp'] = $product->product_mrp;\n $searchData[$arrayIndex]['product_tax'] = $product->product_tax;\n \t\t$searchData[$arrayIndex]['product_details_link'] = URL::to('/').'/products/details/'.$product->id;\n \t\t\n \t\t$arrayIndex++;\n \t}\n\n \treturn $searchData;\n }",
"protected function _getUrlParams()\n {\n return array(\n '_store' => $this->getStore(),\n '_store_to_url' => true\n );\n }",
"public function getProductosUrl(){\n return $this->vectorUrlsProductos;\n }",
"public function urlProvider()\n {\n // if no status code given, then 200 by default\n // 405: method not allowed\n // 302: URL redirection ('found')\n return array(\n ['/product/catalog', 'GET'],\n ['/product/catalog', 'POST'],\n ['/product/catalog/test/test', 'GET', 404],\n ['/product/catalog/0/10', 'GET'],\n ['/product/catalog/0/10/test/test', 'GET', 404],\n ['/product/catalog/0/10/name_category/asc', 'GET'],\n ['/product/catalog/0/10/position_ordering/asc', 'GET'],\n\n ['/product/list', 'GET'],\n ['/product/list', 'POST', 405],\n ['/product/list/test/test', 'GET', 404],\n ['/product/list/0/10', 'GET'],\n ['/product/list/0/10/test/test', 'GET', 404],\n ['/product/list/0/10/name_category/asc', 'GET'],\n\n ['/product/form', 'GET'],\n // TODO: Luc, test it!\n\n ['/product/uselegacy/1', 'GET', 302],\n ['/product/uselegacy/0', 'GET', 302],\n ['/product/uselegacy/test', 'GET', 404],\n ['/product/uselegacy', 'GET', 404],\n\n ['/product/bulk', 'GET', 404],\n ['/product/bulk/test', 'GET', 404],\n ['/product/bulk/activate_all', 'GET', 405],\n ['/product/bulk', 'POST', 404],\n ['/product/bulk/test', 'POST', 404],\n ['/product/bulk/activate_all', 'POST', 500], // route & action OK, but missing POST parameters\n\n ['/product/unit', 'GET', 404],\n ['/product/unit/test', 'GET', 404],\n ['/product/unit/duplicate', 'GET', 404],\n ['/product/unit/duplicate/0', 'GET', 405], // even if 0 is not a valid ID, GET is forbidden\n ['/product/unit', 'POST', 404],\n ['/product/unit/test', 'POST', 404],\n ['/product/unit/duplicate', 'POST', 404], // route & action OK, but missing POST parameters\n ['/product/unit/duplicate/0', 'POST', 500], // route & action OK, but ID 0 is not valid\n\n ['/product/massedit', 'GET', 404],\n ['/product/massedit/test', 'GET', 404],\n ['/product/massedit/sort', 'GET', 405],\n ['/product/massedit', 'POST', 404],\n ['/product/massedit/test', 'POST', 404],\n ['/product/massedit/sort', 'POST', 500], // route & action OK, but missing POST parameters\n );\n }",
"public function allProducts()\r\n {\r\n // left join mshop_product_list as mpl on mpl.parentid = mp.id \r\n // left join mshop_media as mm on mm.id = mpl.refid\r\n // left JOIN mshop_price as mpri on mpri.id = mpl.refid\r\n // where mpl.pos = 0 and mpl.domain in ('media','price')\";\r\n $qry1 = \"select mp.id as product_id, mp.code as product_code, mp.label as product_name, mm.preview as image_url from mshop_product as mp \r\n left join mshop_product_list as mpl on mpl.parentid = mp.id \r\n left join mshop_media as mm on mm.id = mpl.refid\r\n where mpl.pos = 0 and mpl.domain in ('media')\";\r\n $qry2 = \"select mp.id as product_id, mp.label as product_name, mpri.value as product_price from mshop_product as mp \r\n left join mshop_product_list as mpl on mpl.parentid = mp.id \r\n left JOIN mshop_price as mpri on mpri.id = mpl.refid\r\n where mpl.pos = 0 and mpl.domain in ('price')\";\r\n $products1 = DB::select($qry1);\r\n $products2 = DB::select($qry2); \r\n $i = 0;\r\n foreach($products1 as $products) {\r\n foreach($products2 as $product) {\r\n if($product->product_id === $products->product_id) {\r\n $products1[$i]->product_price = $product->product_price;\r\n }\r\n }\r\n $i++;\r\n }\r\n return $products1;\r\n }",
"protected function export_store_products()\n {\n $table = $this->getTableName(\"catalog_product_entity\");\n $categoryProductsTable = $this->getTableName(\"catalog_category_product\");\n $catalogProductWebsite = $this->getTableName(\"catalog_product_website\");\n $rootCategoryId = $this->_fStore->getRootCategoryId();\n $sql = \"SELECT DISTINCT(entity_id), type_id, sku FROM {$table}\n LEFT JOIN (`{$categoryProductsTable}`) ON (`{$categoryProductsTable}`.`category_id` IN ({$this->_categoriesForStore}))\n LEFT JOIN (`{$catalogProductWebsite}`) ON ({$table}.`entity_id` = `{$catalogProductWebsite}`.`product_id`)\n WHERE {$table}.entity_type_id ={$this->_product_entity_type_id}\n AND {$table}.`entity_id` = `{$categoryProductsTable}`.`product_id`\n AND `{$catalogProductWebsite}`.`website_id` =\" . $this->getWebsiteId($this->_fStore_id);\n \n if (!Mage::getStoreConfig('celexport/export_settings/rootcat_products_export')) {\n $sql .= \" AND `{$categoryProductsTable}`.`category_id` != {$rootCategoryId}\";\n }\n \n return $this->export_products($sql, $this->prod_file_name);\n }",
"public function product_locations( $product=null )\n\t{\n\t\t$CI =& get_instance();\n\t\t$this->product = ($product != null) ? $product : $this->product;\n\t\t$this->products_string_to_int();\n\n\t\t$result = $CI->db->where(\"pl.product_id\",$this->product)->from(\"products_item_location AS pl\")->join(\"locations_items AS l\",\"l.id = pl.location_id\",\"left\")->get()->result();\n\t\treturn $result;\n\t}",
"public function getGridUrl() {\n $params = array(\n 'product_id' => $this->getProduct()->getId(),\n 'store' => $this->getRequest()->getParam('store', 0),\n );\n return $this->getUrl('vidtest_admin/admin_product/grid', $params);\n }",
"public function paramsAction() {\n\n$product_collection = Mage::getModel('catalog/category')->load(3)->getProductCollection();\n\n// Now let's loop through the product collection and print the ID of every product \nforeach($product_collection as $product) {\n // Get the product ID\n\n$product_id = $product->getId();\n\n // Load the full product model based on the product ID\n\n$full_product = Mage::getModel('catalog/product')->load($product_id);\n\n // Now that we loaded the full product model, let's access all of it's data\n\n // Let's get the Product Name\n\n $product_name = $full_product->getName();\n\n // Let's get the Product URL path\n\n $product_url = $full_product->getProductUrl();\n\n // Let's get the Product Image URL\n\n $product_image_url = $full_product->getImageUrl();\n\n // Let's print the product information we gathered and continue onto the next one\n\n echo $product_name;\n\n echo $product_image_url;\n}\n }",
"protected function get_product_reference_list () {\n global $_ud_license_updater;\n //echo \"<pre>\"; print_r( $_ud_license_updater ); echo \"</pre>\"; die();\n $response = array();\n if( \n isset( $_ud_license_updater[ $this->slug ] ) \n && is_callable( array( $_ud_license_updater[ $this->slug ], 'get_products' ) ) \n ) {\n $response = $_ud_license_updater[ $this->slug ]->get_products();\n }\n return $response;\n }",
"public function getUrl(\\Magento\\Catalog\\Model\\Product $product, $params = [])\n {\n $routePath = '';\n $routeParams = $params;\n\n $storeId = $product->getStoreId();\n\n $categoryId = null;\n\n if (!isset($params['_ignore_category']) && $product->getCategoryId() && !$product->getDoNotUseCategoryId()) {\n $categoryId = $product->getCategoryId();\n }\n\n if ($product->hasUrlDataObject()) {\n $requestPath = $product->getUrlDataObject()->getUrlRewrite();\n $routeParams['_scope'] = $product->getUrlDataObject()->getStoreId();\n } else {\n $requestPath = $product->getRequestPath();\n if (empty($requestPath) && $requestPath !== false) {\n $filterData = [\n UrlRewrite::ENTITY_ID => $product->getId(),\n UrlRewrite::ENTITY_TYPE => \\Magento\\CatalogUrlRewrite\\Model\\ProductUrlRewriteGenerator::ENTITY_TYPE,\n UrlRewrite::STORE_ID => $storeId,\n ];\n $useCategories = $this->scopeConfig->getValue(\n \\Magento\\Catalog\\Helper\\Product::XML_PATH_PRODUCT_URL_USE_CATEGORY,\n \\Magento\\Store\\Model\\ScopeInterface::SCOPE_STORE\n );\n\n if ($categoryId) {\n $filterData[UrlRewrite::METADATA]['category_id'] = $categoryId;\n } elseif (!$useCategories) {\n $filterData[UrlRewrite::METADATA]['category_id'] = '';\n }\n\n $rewrite = $this->urlFinder->findOneByData($filterData);\n\n if ($rewrite) {\n $requestPath = $rewrite->getRequestPath();\n $product->setRequestPath($requestPath);\n } else {\n $product->setRequestPath(false);\n }\n }\n }\n\n if (isset($routeParams['_scope'])) {\n $storeId = $this->storeManager->getStore($routeParams['_scope'])->getId();\n }\n\n if ($storeId != $this->storeManager->getStore()->getId()) {\n $routeParams['_scope_to_url'] = true;\n }\n\n if (!empty($requestPath)) {\n $routeParams['_direct'] = $requestPath;\n } else {\n $routePath = 'catalog/product/view';\n $routeParams['id'] = $product->getId();\n $routeParams['s'] = $product->getUrlKey();\n if ($categoryId) {\n $routeParams['category'] = $categoryId;\n }\n }\n\n // reset cached URL instance GET query params\n if (!isset($routeParams['_query'])) {\n $routeParams['_query'] = [];\n }\n\n $url = $this->urlFactory->create()->setScope($storeId);\n return $url->getUrl($routePath, $routeParams);\n }",
"public function getProductsFromStore(request $request)\n {\n $data = $request->all();\n if(!empty($data['store_id']))\n {\n $storeId = $data['store_id'];\n $infoCheck = StoreProduct::where(['store_id'=>$storeId])->first();\n $itemId = 1;\n\n if($infoCheck)\n {\n $itemId = $infoCheck->product_id;\n }\n\n $ShopifyResponse = shopify_call($storeId, '/admin/api/2020-04/products/count.json', array(), 'GET');\n $response = json_decode($ShopifyResponse['response']);\n $countData= $response->count;\n $pageNo = $countData/250;\n $pnoLimit = round($pageNo+0.55);\n $itemId = $itemId;\n\n for($i=1; $i <= $pnoLimit; $i++)\n {\n $urg = '/admin/api/2020-04/products.json?limit=250&since_id='.$itemId;\n $response = Getdata($storeId,$urg);\n $productCount = count($response->products);\n $j = 1;\n foreach ($response->products as $item)\n {\n if($j == $productCount)\n {\n $itemId = $item->id;\n }\n $checkProduct = StoreProduct::where(['store_id' => $storeId,'product_id' => '$item->id'])->first();\n\n if(!$checkProduct)\n {\n $postData = [\n \"product_id\" => $item->id,\n \"store_id\" => $storeId,\n \"title\" => $item->title,\n \"vendor\" => $item->vendor,\n \"product_type\" => $item->product_type,\n \"handle\" => $item->handle,\n \"tags\" => $item->tags,\n \"published_scope\" => $item->published_scope,\n ];\n $response = StoreProduct::create($postData);\n $insertProductId = $response->id;\n\n /*\n * Add product Varients\n */ \n foreach ($item->variants as $items)\n {\n $insertDataVariants = [\n \"store_products_id\" => $insertProductId,\n \"store_id\" => $storeId,\n \"variant_id\" => $items->id,\n \"product_id\" => $items->product_id,\n \"title\" => $items->title,\n \"price\" => $items->price,\n \"compare_at_price\" => $items->compare_at_price,\n \"sku\" => $items->sku,\n \"position\" => $items->position,\n \"fulfillment_service\" => $items->fulfillment_service,\n \"inventory_management\" => $items->inventory_management,\n \"inventory_quantity\" => $items->inventory_quantity,\n \"option1\" => $items->option1,\n \"option2\" => $items->option2,\n \"option3\" => $items->option3,\n \"image_id\" => $items->image_id\n ];\n StoreProductVariants::create($insertDataVariants);\n } \n\n /*\n * Add product images\n */ \n foreach ($item->images as $itemimg)\n {\n $insertProductImages = [\n \"store_products_id\" => $insertProductId,\n \"store_id\" => $storeId,\n \"image_id\" => $itemimg->id,\n \"product_id\" => $itemimg->product_id,\n \"src\" => $itemimg->src,\n \"alt\" => $itemimg->alt,\n \"position\" => $itemimg->position,\n ];\n StoreProductImages::create($insertDataVariants);\n }\n }\n $j++;\n }\n }\n return response()->json(['status' =>true, 'message' =>'Data import','data' =>\"got product\"]); \n }\n else\n {\n return response()->json(['status' =>true, 'message' =>'Data not found','data'=>[]]);\n }\n }",
"public function addProductSyncData(&$products)\n {\n $product_ids = [];\n $parent_ids = [];\n $product_stock_ids = []; //modification in config product stock management\n foreach ($products as $product) {\n $product_ids[] = $product['product_id'];\n $product_stock_ids[$product['product_id']] = $product['parent_id'];\n if ((int)$product['parent_id'] !== 0) {\n $product_ids[] = $product['parent_id'];\n $parent_ids[] = $product['parent_id'];\n $product_stock_ids[$product['parent_id']] = $product['parent_id'];\n }\n }\n $product_ids = array_unique($product_ids);\n $parent_ids = array_unique($parent_ids);\n try {\n $store = $this->_storeModelStoreManagerInterface->getStore();\n $website = $store->getWebsite();\n } catch (NoSuchEntityException $exception) {\n $this->_searchHelperData->log(\n LoggerConstants::ZEND_LOG_ERR,\n sprintf('Website Could not be loaded: %s', $exception->getMessage())\n );\n\n return $this;\n }\n\n $this->stockService->clearCache();\n $this->stockService->preloadKlevuStockStatus(array_merge($product_ids, $parent_ids), $website->getId());\n\n $isCollectionMethod = $this->_searchHelperConfig->isCollectionMethodEnabled();\n\n if ($isCollectionMethod) {\n $data = $this->loadProductDataCollection($product_ids);\n }\n\n // Get url product from database\n $url_rewrite_data = $this->getUrlRewriteData($product_ids);\n $attribute_map = $this->getAttributeMap();\n $baseUrl = $this->_productData->getBaseUrl($store);\n $currency = $this->_productData->getCurrency();\n try {\n $store->setCurrentCurrencyCode($currency);\n } catch (LocalizedException $e) {\n $this->_searchHelperData->log(\n LoggerConstants::ZEND_LOG_ERR,\n sprintf('Currency could not be set on store: %s', $e->getMessage())\n );\n\n return $this;\n }\n $rejectedProducts = [];\n $rp = 0;\n\n foreach ($products as $index => &$product) {\n try {\n if ($isCollectionMethod) {\n $item = $data->getItemById($product['product_id']);\n $parent = ((int)$product['parent_id'] !== 0) ? $data->getItemById($product['parent_id']) : null;\n $this->logLoadByMessage($product, true);\n } else {\n $origItem = $this->productRepository->getById(\n $product['product_id'],\n false,\n $store->getId()\n );\n $item = clone $origItem;\n $item->setData('customer_group_id', CustomerGroup::NOT_LOGGED_IN_ID);\n $parent = null;\n if ((int)$product['parent_id'] !== 0) {\n $origParent = $this->productRepository->getById(\n $product['parent_id'],\n false,\n $store->getId()\n );\n $parent = clone $origParent;\n $parent->setData('customer_group_id', CustomerGroup::NOT_LOGGED_IN_ID);\n }\n $this->logLoadByMessage($product);\n }\n\n if (!$item) {\n // Product data query did not return any data for this product\n // Remove it from the list to skip syncing it\n $rejectedProducts[$rp]['product_id'] = $product['product_id'];\n $rejectedProducts[$rp]['parent_id'] = $product['parent_id'];\n $this->_searchHelperData->log(\n LoggerConstants::ZEND_LOG_WARN,\n sprintf(\"Failed to retrieve data for product ID %d\", $product['product_id'])\n );\n unset($products[$index]);\n $rp++;\n continue;\n }\n if ((!isset($parent)) && isset($product['parent_id']) && (int)$product['parent_id'] !== 0) {\n $rejectedProducts[$rp]['product_id'] = $product['product_id'];\n $rejectedProducts[$rp]['parent_id'] = $product['parent_id'];\n $this->_searchHelperData->log(\n LoggerConstants::ZEND_LOG_WARN,\n sprintf(\"Failed to retrieve data for parent ID %d\", $product['parent_id'])\n );\n unset($products[$index]);\n $rp++;\n continue;\n }\n\n $this->processProductBefore($product, $parent, $item);\n // Add data from mapped attributes\n foreach ($attribute_map as $key => $attributes) {\n $product = $this->mapProductAttributes($item, $store, $product, $attributes, $key, $parent);\n }\n\n $product['product_type'] = $this->_productData->getProductType($parent, $item);\n $product['isCustomOptionsAvailable'] = $this->_productData->isCustomOptionsAvailable($parent, $item);\n $product['currency'] = $currency;\n $product['otherPrices'] = $this->_productData->getOtherPrices($item, $currency, $store);\n $product['category'] = $this->_productData->getCategory($parent, $item);\n $product['listCategory'] = $this->_productData->getListCategory($parent, $item);\n $product['categoryIds'] = $this->_productData->getAllCategoryId($parent, $item);\n $product['categoryPaths'] = $this->_productData->getAllCategoryPaths($parent, $item);\n $product['groupPrices'] = $this->_productData->getGroupPricesData($item, $store);\n $product['url'] = $this->_productData->getProductUrlData(\n $parent,\n $item,\n $url_rewrite_data,\n $product,\n $baseUrl\n );\n $product['inStock'] = $this->_stockHelper->getKlevuStockStatus($parent, $item, $website->getId());\n $product['itemGroupId'] = $this->_productData->getItemGroupId($product['parent_id'], $product) ?: '';\n if ((int)$product['itemGroupId'] === 0) {\n $product['itemGroupId'] = ''; // Ref: KS-15006\n }\n $product['id'] = $this->_productData->getId($product['product_id'], $product['parent_id']);\n $this->processProductAfter($product, $parent, $item);\n if ($item) {\n if (!$isCollectionMethod) {\n $item->clearInstance();\n }\n $item = null;\n }\n if ($parent) {\n if (!$isCollectionMethod) {\n $parent->clearInstance();\n }\n $parent = null;\n }\n } catch (\\Exception $e) {\n $this->_searchHelperData->log(\n LoggerConstants::ZEND_LOG_CRIT,\n sprintf(\"Exception thrown in %s::%s - %s\", __CLASS__, __METHOD__, $e->getMessage())\n );\n $markAsSync = [];\n if (!empty($product['parent_id']) && !empty($product['product_id'])) {\n $markAsSync[] = [\n $product['product_id'],\n $product['parent_id'],\n $store->getId(),\n 0,\n $this->_searchHelperCompat->now(),\n \"products\"\n ];\n $write = $this->_frameworkModelResource->getConnection(\"core_write\");\n $query = \"replace into \" . $this->_frameworkModelResource->getTableName('klevu_product_sync')\n . \"(product_id, parent_id, store_id, last_synced_at, type,error_flag) values \"\n . \"(:product_id, :parent_id, :store_id, :last_synced_at, :type,:error_flag)\";\n $binds = [\n 'product_id' => $markAsSync[0][0],\n 'parent_id' => $markAsSync[0][1],\n 'store_id' => $markAsSync[0][2],\n 'last_synced_at' => $markAsSync[0][4],\n 'type' => $markAsSync[0][5],\n 'error_flag' => 1\n ];\n $write->query($query, $binds);\n }\n continue;\n }\n unset($product['product_id'], $product['parent_id']);\n }\n\n if (count($rejectedProducts) > 0) {\n // Can not be injected via construct due to circular dependency\n $magentoProductActions = ObjectManager::getInstance()->get(MagentoProductActionsInterface::class);\n if (!$this->_searchHelperConfig->displayOutofstock()) {\n $rejectedProducts_data = [];\n $r = 0;\n foreach ($rejectedProducts as $rvalue) {\n $idData = $this->checkIdexitsInDb(\n $store->getId(),\n $rvalue[\"product_id\"],\n $rvalue[\"parent_id\"]\n );\n $ids = $idData->getData();\n if (count($ids) > 0) {\n $rejectedProducts_data[$r][\"product_id\"] = $rvalue[\"product_id\"];\n $rejectedProducts_data[$r][\"parent_id\"] = $rvalue[\"parent_id\"];\n $r++;\n }\n }\n $this->_searchHelperData->log(\n LoggerConstants::ZEND_LOG_WARN,\n sprintf(\n \"Because of indexing issue or invalid data we cannot synchronize product IDs %s\",\n implode(\n ',',\n array_map(\n static function ($el) {\n return $el['product_id'];\n },\n $rejectedProducts_data\n )\n )\n )\n );\n $magentoProductActions->deleteProducts($rejectedProducts_data);\n } else {\n $this->_searchHelperData->log(\n LoggerConstants::ZEND_LOG_WARN,\n sprintf(\n \"Because of indexing issue or invalid data we cannot synchronize product IDs %s\",\n implode(\n ',',\n array_map(\n static function ($el) {\n return $el['product_id'];\n },\n $rejectedProducts\n )\n )\n )\n );\n $magentoProductActions->deleteProducts($rejectedProducts);\n }\n }\n\n return $this;\n }",
"public function getProdLinks()\n {\n return $this->prod_links;\n }",
"private function transformData($products)\n {\n return collect($products)->map(function($product){\n $variants = [];\n $inventory = 0;\n $weight = 0;\n\n foreach($product['attributes'] as $attribute)\n {\n $variants[strtolower($attribute['name'])] = implode(',', $attribute['options']);\n }\n\n return [\n 'id' => $product['id'],\n 'title' => $product['name'],\n 'price' => $product['price'],\n 'inventory' => $product['stock_quantity'],\n 'variant' => $variants,\n 'weight' =>$product['weight']\n ];\n });\n }",
"protected function _appendUrlRewritesToData($data)\n {\n\n $categoryIds = array_keys($data);\n $categories = Mage::getResourceModel('catalog/category_collection')\n ->setStoreId(Mage::app()->getStore()->getId())\n ->addIdFilter($categoryIds)\n ->addUrlRewriteToResult();\n\n foreach ($categories as $currentCategory) {\n $data[$currentCategory->getId()]['category_url'] = $currentCategory->getUrl();\n }\n\n return $data;\n }",
"public function getProducts() {\n\t\treturn $this->requester->request('GET', $this->url);\n\t}"
] |
[
"0.70631677",
"0.6535751",
"0.65242594",
"0.5997813",
"0.58937174",
"0.5849842",
"0.58022416",
"0.56956977",
"0.5672905",
"0.55929404",
"0.558724",
"0.5571116",
"0.55680984",
"0.55471224",
"0.5524848",
"0.54784405",
"0.54752815",
"0.54672027",
"0.5433903",
"0.54260004",
"0.5424854",
"0.540197",
"0.53874725",
"0.53756773",
"0.5365159",
"0.53619736",
"0.53607655",
"0.53511775",
"0.53395134",
"0.53357995"
] |
0.69519776
|
1
|
Gets data for a talk
|
public function getTalkData($input)
{
$url = $this->extractUrl("http://api.joind.in/v2.1/talks/{id}", $input);
$data = $this->getData($url);
if (!$data) return null;
return array_shift($data->talks);
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"protected function _getTalks($eventId)\n\t{\n\t\t$methodType = 'gettalks';\n\t\t$action = array(\n\t\t\t'type' => $methodType, \n\t\t\t'data' => array(\n\t\t\t\t'event_id' => $eventId\n\t\t\t)\n\t\t);\n\t\t$this->_authenticationRequired = false;\n\t\t$this->_init();\n\t\t$response = $this->_post(self::$_endPoint. '/' . $methodType, $action);\n\t\t\n\t\tif ('array' === $this->getResponseFormat()) {\n\t\t\treturn Zend_Json::decode($response->getBody());\n\t\t}\n\t\treturn $response->getBody();\n\t}",
"public function load_participant_talks()\n {\n $participant_id = (string)Auth::user()->id;\n $talks = Talks::with(['event'])->whereJsonContains('participants',$participant_id)->get();\n\n return response()->json($talks, 200);\n }",
"abstract function getdata();",
"public function get_data();",
"public function get_data()\n\t\t{\t\t// Should there be a common method for this?\n\t\t}",
"private function get()\n {\n $webhookId = $this->ask('Please enter Webhook ID');\n\n try {\n $response = $this->messageBirdClient->conversationWebhooks->read($webhookId);\n\n $data = [];\n if ($response) {\n array_push($data, $this->getFetchedData($response));\n\n $headers = ['webhook_id', 'href', 'channel_id', 'events', 'url', 'created_at'];\n $this->table($headers, $data);\n }\n } catch (\\Exception $e) {\n $this->error($e->getMessage());\n }\n }",
"public function getData()\n {\n return $this->data->reply;\n }",
"public function getData();",
"public function getData();",
"public function getData();",
"public function getData();",
"public function getData();",
"public function getData();",
"public function getData();",
"public function getData();",
"public function getData();",
"public function getData();",
"public function getData();",
"public function getData();",
"public function getData();",
"public function getData();",
"public function getData();",
"public function getData();",
"public function getData();",
"public function getData();",
"public function getData();",
"public function getData();",
"public function getData();",
"public static function getData() {}",
"public function getResponseData();"
] |
[
"0.6199746",
"0.61879927",
"0.60950404",
"0.5977892",
"0.58535516",
"0.5793897",
"0.57665527",
"0.5737538",
"0.5737538",
"0.5737538",
"0.5737538",
"0.5737538",
"0.5737538",
"0.5737538",
"0.5737538",
"0.5737538",
"0.5737538",
"0.5737538",
"0.5737538",
"0.5737538",
"0.5737538",
"0.5737538",
"0.5737538",
"0.5737538",
"0.5737538",
"0.5737538",
"0.5737538",
"0.5737538",
"0.57333976",
"0.57188374"
] |
0.6561927
|
0
|
chaque forme a sa propre fonction Draw() et recoit l'instance du SvgRenderer
|
public function draw($svgRenderer){
// la fonction draw appelle la fonction du renderer dont elle a besoin, en lui envoyant les parametres
$svgRenderer->drawCircle($this->color, $this->x, $this->y, $this->opacity, $this->rayon);
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function draw(SvgRenderer $renderer) {\n try {\n $renderer->drawRectangle($this->location->x,\n $this->location->y,\n $this->width,\n $this->height,\n $this->color,\n $this->opacity);\n\n } catch (Exception $error) {\n echo $error->getMessage();\n }\n\n }",
"protected function generateGraphic() {}",
"public function draw() {}",
"public function draw() {}",
"public function draw();",
"public function draw(SvgRenderer $renderer) {\n $renderer->drawEllipse($this->location->x,\n $this->location->y,\n $this->radiusX,\n $this->radiusY,\n $this->color,\n $this->opacity);\n }",
"public function svg() {\n\t\t// Calcul des coordonnées des points.\n\t\t$this->computePoints();\n\t\t// Récupération des points.\n\t\t$A = $this->A;\n\t\t$B = $this->B;\n\t\t$C = $this->C;\n\t\t$D = $this->D;\n\t\t$H = $this->H;\n\t\t$E = $this->E;\n\t\t$G = $this->G;\n\t\t$F = $this->F;\n\t\t$I = $this->I;\n\t\t$J = $this->J;\n\t\t$K = $this->K;\n\t\t$J1 = $this->J1;\n\t\t$J2 = $this->J2;\n\t\t// Dessin au format SVG.\n\t\t$couleurV = $this->colorV;\n\t\t$couleurY = $this->colorY;\n\t\t$couleurGauche = $this->colorLeft;\n\t\t$couleurDroite = $this->colorRight;\n\t\t$svg = '<?xml version=\"1.0\" standalone=\"no\"?><!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">';\n\t\t$svg .= '<svg width=\"'.$this->xmax.'\" height=\"'.$this->ymax.'\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\">';\n\t\t$svg .= '<title>logo'.($this->name != \"\" ? '-'.$this->name : '').'</title>';\n\t\t// Intérieur gauche.\n\t\t$svg .= '<polygon points=\"'.$E.' '.$F.' '.$K.'\" style=\"fill:'.$couleurGauche.'; stroke:'.$couleurGauche.'; stroke-width:0.5; stroke-linejoin:miter; stroke-miterlimit:5;\"/>';\n\t\t// Intérieur droit.\n\t\t$svg .= '<polygon points=\"'.$G.' '.$H.' '.$I.'\" style=\"fill:'.$couleurDroite.'; stroke:'.$couleurDroite.'; stroke-width:0.5; stroke-linejoin:miter; stroke-miterlimit:5;\"/>';\n\t\t// Y.\n\t\t$svg .= '<polygon points=\"'.$A.' '.$B.' '.$C.' '.$H.' '.$G.' '.$J1.' '.$J2.' '.$F.' '.$E.'\" style=\"fill:'.$couleurY.'; stroke:black; stroke-width:0.5; stroke-linejoin:miter; stroke-miterlimit:5;\"/>';\n\t\t// V.\n\t\t$svg .= '<polygon points=\"'.$A.' '.$E.' '.$J.' '.$H.' '.$C.' '.$D.'\" style=\"fill:'.$couleurV.'; stroke:black; stroke-width:0.5; stroke-linejoin:miter; stroke-miterlimit:5;\"/>';\n\t\t$svg .= '</svg>';\n\t\treturn $svg;\n\t}",
"function draw() {\n $this->DOM = new DOMDocument('1.0', 'UTF-8');\n $this->DOM->formatOutput = true;\n self::$svg = $this->DOM->createElement('svg');\n self::$svg->setAttribute('width', $this->size);\n self::$svg->setAttribute('height', $this->size);\n self::$svg->setAttribute('version', '1.1');\n self::$svg->setAttribute('xmlns', 'http://www.w3.org/2000/svg');\n\n $style = $this->DOM->createElement('style', 'rect { ' . $this->nodeStyle .' }');\n self::$svg->appendChild($style);\n\n //Parameters for the drawing algorithm\n $max_sub = 15; //The max number of points to try to group together for drawing\n $min_sub = 0; //The min number of points to try to group together for drawing\n $step = 3; //The step size down from $max_sub to $min_sub\n\n for ($size = $max_sub; $size >= $min_sub; $size -= $step)\n {\n $size = ($size == 0) ? 1 : $size;\n $this->fillBlocks($size);\n }\n// $this->DOM->appendChild(self::$svg);\n return $this->DOM->saveXML(self::$svg);\n }",
"public function draw() {\r\n $g = $this->chart->getGraphics3D();\r\n $e = $g->getGraphics();\r\n\r\n $r = new Rectangle($this->x0,$this->y0,$this->x1-$this->x0,$this->y1-$this->y0);\r\n\r\n if($this->chart->getParent()!=null) {\r\n if ($this->bBrush != null && $this->bBrush->getVisible()) {\r\n $brushXOR = -1 ^ $this->bBrush->getColor()->getRGB();\r\n $e->setXORMode($this->Color->fromArgb($brushXOR));\r\n $e->fillRect($this->x0, $this->y0, $this->x1 - $this->x0, $this->y1 - $this->y0);\r\n\r\n if ($this->pen!= null && $this->pen->getVisible()) {\r\n $penXOR = -1 ^ $this->pen->getColor()->getRGB();\r\n $e->setXORMode($this->Color->fromArgb($penXOR));\r\n $e->drawRect($this->x0-1,$this->y0-1,$this->x1+1-$this->x0,$this->y1+1-$this->y0);\r\n }\r\n }\r\n else if($this->pen!= null && $this->pen->getVisible()) {\r\n $this->chart->invalidate();\r\n $g->setPen($this->getPen());\r\n $g->getBrush()->setVisible(false);\r\n $g->rectangle($r);\r\n $g->getBrush()->setVisible(true);\r\n }\r\n else {\r\n $this->chart->invalidate();\r\n $tmpColor = new Color();\r\n $tmpLineCap = new LineCap();\r\n $tmpDashStyle = new DashStyle();\r\n $g->setPen(new ChartPen($this->chart, $tmpColor->BLACK, true, 1, $tmpLineCap->BEVEL, $tmpDashStyle->DASH));\r\n $g->getBrush()->setVisible(false);\r\n $g->rectangle($r);\r\n $g->getBrush()->setVisible(true);\r\n }\r\n }\r\n }",
"public function draw()\n {\n //Skip calculations; dummy result after calculating points\n $points = [\n [\"x\" => '0', \"y\" => '0'],\n [\"x\" => '10', \"y\" => '0'],\n [\"x\" => '0', \"y\" => '10'],\n [\"x\" => '10', \"y\" => '10']\n ];\n\n if ($this->format instanceof \\GraphicEditor\\Formats\\Points) {\n $this->format->addPoints($points);\n }\n }",
"public function formatGraphics() {\n }",
"public function draw(SvgRenderer $renderer) {\n $renderer->drawText($this->location->x,\n $this->location->y,\n $this->content,\n $this->font,\n $this->size,\n $this->color,\n $this->opacity);\n }",
"public function renderSVG()\n\t{\n\t\t$canvasWidth = $this->getCanvasWidth();\n\t\t$canvasHeight = $this->getCanvasHeight();\n\t\t$svgHeader = '<svg width=\"%d\" height=\"%d\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\">';\n\t\t$rectangle = '<rect x=\"%d\" y=\"%d\" width=\"%s\" height=\"%s\" fill=\"%s\"/>';\n\n\t\t$output = sprintf(\n\t\t\t $svgHeader,\n\t\t\t $canvasWidth,\n\t\t\t $canvasHeight\n\t\t ) . PHP_EOL;\n\n\t\t$output .= \"\\t\" . sprintf(\n\t\t\t\t$rectangle,\n\t\t\t\t0,\n\t\t\t\t0,\n\t\t\t\t'100%',\n\t\t\t\t'100%',\n\t\t\t\t$this->backgroundColor\n\t\t\t) . PHP_EOL;\n\n\t\tforeach ($this->proceduralGenerator() as $key => $shape) {\n\t\t\t$output .= \"\\t\" . sprintf(\n\t\t\t\t\t$rectangle,\n\t\t\t\t\t$shape['x0'],\n\t\t\t\t\t$shape['y0'],\n\t\t\t\t\t$this->shapeX,\n\t\t\t\t\t$this->shapeY,\n\t\t\t\t\t$shape['c']\n\t\t\t\t) . PHP_EOL;\n\t\t}\n\t\t$output .= '</svg>';\n\n\t\treturn $output;\n\t}",
"public function draw()\n {\n return;\n }",
"public function draw()\n {\n echo 'Draw circle';\n }",
"function draw() {\n }",
"public function drawInFile()\n {\n }",
"public function draw()\n {\n echo \"Shape: Rectangle\";\n }",
"function drawStyle()\r\n\t{\r\n\t}",
"function beginDraw()\r\n {\r\n echo \"<script type=\\\"text/javascript\\\">\\n\";\r\n echo \" var cnv=findObj('$this->_object');\\n\";\r\n echo \" if (cnv==null) cnv=findObj('{$this->_object}_outer');\\n\";\r\n echo \" var $this->_canvas = new jsGraphics(cnv);\\n\";\r\n $this->_canvas= \" \" . $this->_canvas;\r\n }",
"protected function _drawStyle($style) {}",
"public function draw()\n {\n echo 'Draw rectangle';\n }",
"function paint()\r\n {\r\n echo \"$this->_canvas.paint();\\n\";\r\n }",
"public function graphicState() {}",
"public function fillAndStroke() {}",
"public function saveGraphicState() {}",
"public function saveGraphicState() {}",
"public function draw()\n {\n echo \"画一个 {$this->color->run()} 的正方形\";\n }",
"protected function drawImage():void{\n\t\t$this->imagickDraw = new ImagickDraw;\n\t\t$this->imagickDraw->setStrokeWidth(0);\n\n\t\tfor($y = 0; $y < $this->moduleCount; $y++){\n\t\t\tfor($x = 0; $x < $this->moduleCount; $x++){\n\t\t\t\t$this->setPixel($x, $y);\n\t\t\t}\n\t\t}\n\n\t\t$this->imagick->drawImage($this->imagickDraw);\n\t}",
"public function draw($canvas)\n {\n }"
] |
[
"0.69131064",
"0.6903684",
"0.68629116",
"0.68629116",
"0.67589456",
"0.6624275",
"0.64266956",
"0.637072",
"0.6326063",
"0.6311773",
"0.62690705",
"0.62394583",
"0.62074125",
"0.601462",
"0.60110205",
"0.59837407",
"0.5941463",
"0.5929279",
"0.59178126",
"0.58853453",
"0.58233744",
"0.58182216",
"0.5812466",
"0.5807602",
"0.5807127",
"0.5786707",
"0.57835793",
"0.5720187",
"0.5695791",
"0.56854725"
] |
0.71809417
|
0
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.