query
stringlengths
7
5.25k
document
stringlengths
15
1.06M
metadata
dict
negatives
sequencelengths
3
101
negative_scores
sequencelengths
3
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Create a success alert.
public static function success($message) { return new self($message, ['class' => 'alert alert-success']); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static function alertSuccess($msg) {\n\t\t\techo \"<div class=\\\"alert success\\\">\n\t\t\t\t<p>\n\t\t\t\t\t<strong>\".$msg.\"</strong>\n\t\t\t\t</p>\n\t\t\t</div>\";\n\t\t}", "public static function success()\n {\n static::returnCode(static::CODE_SUCCESS);\n }", "public function testSendAlertSuccess()\n {\n $this->exec('alert-upcoming-expirations');\n $this->assertOutputContains('Expiring memberships found:');\n $this->assertOutputContains('User with membership expiring tomorrow');\n $this->assertOutputContains('User with membership auto-renewing tomorrow');\n $this->assertOutputContains('Sent');\n $this->assertOutputNotContains('Exception');\n $this->assertOutputNotContains('Member User');\n $this->assertErrorEmpty();\n }", "public function success()\n {\n return Session::getFlash('raven:success');\n }", "public function success() {\n\t}", "public function testSuccess()\n {\n $this->_package->success(\"Successful test\");\n $this->assertTrue($this->_result->wasSuccessful());\n }", "public static function success($text)\n {\n \\Yii::$app->getSession()->addFlash('alerts', new Alert($text, 'success'));\n }", "public function success() {\n }", "public static function successAlert($message, $options) {\n\t\t\n\t\t$he2_alerts = Session::readSession('he2_alerts');\n\t\t\n\t\tif(empty($he2_alerts))\n\t\t\t$he2_alerts = array();\t\t\n\t\t\n\t\t$he2_alerts[] = '<div class=\"alert alert-success\"><button type=\"button\" class=\"close\" data-dismiss=\"alert\">&times;</button>' . $message . '</div>';\n\t\t\n\t\tSession::writeSession('he2_alerts', $he2_alerts );\n\t}", "public function actionSuccess()\n {\n return $this->render('success');\n }", "function showSuccess($feedback)\n{\n showFeedback(new AlertMessage(AlertMessage::STYLE_SUCCESS, $feedback));\n}", "function successAlert($msgText)\n\t{\n\t\t$msgSuccess = \"<div class='alert alert-success alert-dismissible fade show'>\n\t\t\t\t\t\t<button type='button' class='close' data-dismiss='alert'>&times;</button>\n\t\t\t\t\t\t\" . $msgText . \"\n\t\t\t\t\t\t</div>\";\n\t\treturn $msgSuccess;\n\t}", "public function successAction()\r\n {\r\n View::renderTemplate('Signup/success.html');\r\n }", "public function successAction()\n {\n View::renderTemplate('Signup/success.html');\n }", "public function confirmed()\n {\n \n $this->alert('success', 'Hello World!', [\n 'position' => 'top-end', \n 'timer' => 3000, \n 'toast' => true, \n 'text' => '', \n 'confirmButtonText' => 'Ok', \n 'cancelButtonText' => 'Cancel', \n 'showCancelButton' => true, \n 'showConfirmButton' => true, \n ]);\n }", "public function confirmed()\n {\n \n $this->alert('success', 'Hello World!', [\n 'position' => 'top-end', \n 'timer' => 3000, \n 'toast' => true, \n 'text' => '', \n 'confirmButtonText' => 'Ok', \n 'cancelButtonText' => 'Cancel', \n 'showCancelButton' => true, \n 'showConfirmButton' => true, \n ]);\n }", "public function success($message, array $data = [])\r\n {\r\n $data = array_merge($data, [ '_type' => AlertType::SUCCESS]);\r\n return $this->add($message, $data);\r\n }", "public function success();", "public function success() {\n return array(\n '#type' => 'markup',\n '#markup' => '<h1>Congratulations</h1><p>You just completed a purchase.</p>',\n );\n }", "public static function success(): self\n {\n return self::getInstance('SUCCESS');\n }", "public static function success($message)\n {\n return '<div class=\"alert alert-success\">' . $message . '</div>';\n }", "function formSuccess() {\n\n // Template\n $this->r->text['back_url'] = suxFunct::getPreviousURL();\n $this->r->title .= \" | {$this->r->gtext['success']}\";\n\n $this->tpl->display('success.tpl');\n\n }", "public function success($title, $message)\n\t{\n\t\treturn $this->create($title, $message, 'success');\n\t}", "public function success($message = null, $newlines = 1, $level = Shell::NORMAL) {\n\t\t$this->out('<success>' . $message . '</success>', $newlines, $level);\n\t}", "public static function success($title, $message, $class = \"\")\n {\n $alert = new Alert($title, $message, \"success\");\n\n if (strlen($class)) {\n $alert->addClass($class);\n }\n\n return $alert->render();\n }", "public function success($message)\n {\n }", "public function createAccountSuccess()\n {\n return Redirect()->route('bank-accounts')->with('message', 'You have successfully added a bank account.');\n }", "public function success()\n {\n return $this->type('success');\n }", "public function get_success_message() {\r\n\t\treturn '';\r\n\t}", "private function send_success() {\n header('Content-Type: application/json');\n echo json_encode(array('success' => true));\n return;\n }", "protected function success()\n {\n $this->response = $this->response->withStatus(200);\n $this->jsonBody($this->payload->getOutput());\n }", "public static function creationSuccessMessage($message = null) {\n\n self::customContentMessage(\n \"Creation succesful\",\n ($message ? $message : null) ?? \"The new item has been created successfully.\",\n \"info\"\n );\n\n }", "public static function success($text = null)\n {\n self::message($text, 'success');\n }", "public function callbackSuccess()\n {\n $this->AddOutput(\"<p><i>Form was submitted and the callback method returned true.</i></p>\"); \n $this->redirectTo();\n }", "public function generateSuccess($message) {\n\t\t\techo \"\n\t\t\t\t<div class='alert alert-success' role='alert'>\n\t\t\t\t\t{$message}\n\t\t\t\t</div>\n\t\t\t\";\n\t\t}", "public static function success($message = '') {\n self::writeLine($message, SELF::CLI_COLOR_GREEN, self::CLI_TYPE_SUCCESS);\n }", "protected function success() {\r\n $this->redirect();\r\n }", "public function license_success_message() {\n\t\t$message = __( 'Your Block Lab license was successfully activated!', 'block-lab' );\n\t\treturn sprintf( '<div class=\"notice notice-success\"><p>%s</p></div>', esc_html( $message ) );\n\t}", "protected function success()\n {\n return $this->info(\"The custom commands runs properly !\");\n }", "private function _success($info){\n $confirm = array(\n 'class' => 'alert-success',\n 'head' => '成功!',\n 'body' => $info\n );\n $this->assign('confirmInfo',$confirm);\n }", "function displaySuccessMessage($index,$params = array()) {\n\t\tglobal $lang;\n\t\n\t\treturn '<div class=\"alert alert-success\">'.getLang('form_success_'.$index,$params).'</div>';\n\t}", "public function notice_success( $itens = '' ) {\n\t\t$class = 'notice notice-success is-dismissible';\n\t\t$message = __( 'Sync completed successfully.', 'elemarjr' );\n\t\treturn sprintf( '<div class=\"%1$s\"><p>%2$s</p>%3$s</div>', esc_attr( $class ), esc_html( $message ), wp_kses_post( $itens ) );\n\t}", "public function actionSuccess()\n\t{\n\t\t// using the default layout 'protected/views/layouts/main.php'\n\t\t\t\t\n\t\t$email = Yii::app()->request->getParam('email');\n\t\t$this->render('success', array('email'=>$email,'is_found'=>true));\n\t}", "public function setSuccessResponse()\r\n {\r\n $this->setResponse(self::STATUS_CODE_OK);\r\n }", "public function success($message)\n {\n $this->message($message, 'success');\n }", "public function successResponseAction()\n {\n\n\t\t$orderid = $_REQUEST['orderid'];\n\n if (!$orderid) {\n $this->_redirect('');\n return ;\n }\n\n $order = Mage::getModel('sales/order');\n $order->loadByIncrementId($orderid);\n\t\tif (!$order->getId()) {\n return false;\n }\t\t\n\n\t\t$payment =$order->getPayment();\n\t\t$criptopay_status = $payment->getAdditionalInformation('criptopay_status');\t\n\t\t$transaction_id = $payment->getAdditionalInformation('transaction_id');\t\t\t\t\t\t\t\t\t\n\n\t\t\n\t\t$statusStr = __('Pending');\n\t\t\t\t\n\t\tif ($criptopay_status == '30') $statusStr = __('Success');\n\t\t\n\t $session = Mage::getSingleton('checkout/session');\n\t\t\n \t$session->setQuoteId();\n Mage::getSingleton('checkout/session')->getQuote()->setIsActive(false)->save();\n\n $success_msg = __('<b>Order No: <b>').$orderid;\n\t\t$success_msg .= __('<br><b>Transcation ID: <b>').$transaction_id;\t\t\t\n//\t\t$success_msg .= __('<br><b>Payment Status: <b>').$statusStr;\t\t\t\t\t\t\n// $success_msg .= __('<br><b>Wait about 5 hours for crypto-pay to process the payment<b>');\n $session->setErrorMessage($success_msg);\t\t\t \n\t $this->_redirect('criptopay/standard/success');\t\t\t\t \n//\t\t$this->_redirect('checkout/onepage/success');\t\t\t \n }", "public function success($message, $title = null)\n {\n return $this->alert($message);\n }", "public function postCreationSuccessful() {\n $this->setDisplayMessage(\"Posted new message.\");\n $this->redirect();\n die();\n }", "public function alert() {\n\t\t/*$alert = \"<div class='alert alert-dismissible'>\";\n\t\t$alert .= \"<button type='button' class='close' data-dismiss='alert' aria-label='Close'><span aria-hidden='true'>&times;</span></button>\";\n\t\t$alert .= $this->message.\"</div>\";*/\n\t\treturn \"alert('danger','A database error has occurred');\";\n\t}", "public function success( $message ) {\n\n \\WP_CLI::success( $message );\n }", "public function callbackSuccess()\n {\n $this->AddOutput(\"<p><i>Välkommen till Allt Om Landskapsfotografering! Ditt användare id är: \" . $this->acronym . \" </i></p>\");\n $this->redirectTo();\n }", "public function doneSucceed()\r\n {\r\n $progress = app()->make(Progress::class);\r\n $progress->reset();\r\n\r\n app('antares.messages')->add('success', trans('Installation is completed. Now you can login to administration area.'));\r\n return $this->redirect(handles('antares::install/completed'));\r\n }", "public function successAction()\n\t{\n\t\t$this->_redirect('checkout/onepage/success', array('_secure'=>true));\n\t}", "public function onSuccess();", "public function onSuccess();", "protected function markAsSuccess()\n {\n $this->view->success = true;\n }", "public function addSuccessMessage($message)\r\n {\n $message = new Alert($message, Alert::ALERT_SUCCESS);\n $this->fm->addMessage($message);\n \n return $this;\r\n }", "public function successMessage() { return $this->successMessage; }", "function custom_success( $msg, $success ) {\n\n\t\tif ( $success == 'mycred_transfer_done' ) {\n\t\t\t$msg = __( 'Points transferred successfully', 'twodayssss' );\n\t\t}\n\n\t\treturn $msg;\n\t}", "public static function success( $message ){\n return self::add( new Loco_error_Success($message) );\n }", "public function successNotification(OutputInterface $output)\n {\n $output->writeln([\n \"<fg=green>\", \n \" Post was generated successfully.\",\n \"</>\"]);\n }", "public function runSuccess();", "function sendSuccess($successText){\n echo json_encode(array(\n 'status' => '201',\n 'infotext' => $successText\n ));\n}", "public static function success($message, $attributes = array())\n\t{\n\t\treturn static::show(Labels::SUCCESS, $message, $attributes);\n\t}", "public function SuccessContent()\n {\n if ($object = $this->NewObject()) {\n $message = $this->Data()->SuccessMessage;\n return $this->editingMessageWithKeywords($object, $message);\n }\n }", "public function success() {\n\t\t$this->getBasics();\n\t\t$this->getParams();\n\t\t$this->getLanguage();\n\n\t\t$this->load->library( 'encryption' );\n\t\t$encryption = new Encryption( $this->config->get( 'config_encryption' ) );\n\n\t\t// get order id\n\t\tif( isset( $this->request->get['order_id'] ) ) {\n\t\t\t$order_id = $encryption->decrypt( $this->request->get['order_id'] );\n\t\t}else{\n\t\t\t$order_id = 0;\n\t\t}\n\n\t\t// get project id\n\t\t$project_id = $this->getRequest( 'pid', 0 );\n\n\t\t// write log\n\t\t$msg = sprintf( $this->language->get( 'text_log_return_success' ), $project_id, $order_id );\n\t\t$this->writeLog( $msg, 2 );\n\n\t\t// call the template\n\t\tif( $this->request->get['security_criteria'] != 1 ) {\n\t\t\t// something went wrong\n\t\t\t// write log and msg to directebanking\n\t\t\t$msg = sprintf( $this->language->get( 'text_log_security_invalid'), $project_id, $order_id );\n\t\t\techo $msg . \"\\n\";\n\n\t\t\t$this->writeLog( $msg, 3 );\n\n\t\t\t$this->data['heading_title']\t= $this->language->get( 'text_failed' );\n\t\t\t$this->data['text_message']\t\t= sprintf(\n\t\t\t\t$this->language->get( 'text_failed_message' ),\n\t\t\t\t$this->buildUrl( 'information/contact' )\n\t\t\t);\n\t\t\t$this->data['button_continue']\t= $this->language->get( 'button_continue' );\n\t\t\t$this->data['continue']\t\t\t= $this->buildUrl( 'common/home' );\n\n\t\t\t$this->getTemplate( '/template/common/success.tpl' );\n\n\t\t\t$this->getChildren();\n\t\t\t$this->buildResponse();\n\t\t}else{\n\t\t\t// everything okay\n\t\t\t$this->redirect( $this->buildUrl( 'checkout/success' ) );\n\t\t}\n\t}", "public function success($message)\n {\n $flash = $this->flashtype['success'];\n $flash['message'] = $message;\n $this->add($flash);\n }", "public function success(string $message)\n {\n $this->message('success', $message);\n }", "function pms_success() {\r\n static $pms_success;\r\n\r\n return ( isset($pms_success) ? $pms_success : ( $pms_success = new PMS_Success( null, null ) ) );\r\n }", "private function success() : void\n {\n session_destroy();\n session_unset();\n (new Repository())->disconnect();\n (new Session())->set('user','success', 'Votre compte a bien été supprimé');\n header('Location:' . self::REDIRECT_SIGNUP);\n die();\n\n }", "function success() {\n echo \"<br />\";\n \n echo \"Thank you for contacting us. We will be in touch with you very soon.\";\n \n echo \"<br />\";\n \n \n \n }", "function success($msg = '', $url = 'index.php', $time = 3){\n if ($msg == '') {\n header(\"location: index.php\");\n exit();\n } else {\n echo '<div class=\"alert alert-success\">';\n echo '<h3 style=\"text-align:center\">';\n echo '<i class=\"fa fa-check\"></i>';\n echo \" $msg successfully\";\n echo '</h3>';\n echo '</div>';\n// header(\"refresh: $time;url = $url\");\n// exit();\n }\n}", "private function success(InputInterface $input, OutputInterface $output)\n {\n $output->writeln('');\n $output->writeln('The user has been successfully created.');\n\n return 0;\n }", "function success()\n {\n $cur = common_current_user();\n $url = common_local_url('subscriptions', array('nickname' => $cur->nickname));\n common_redirect($url, 303);\n }", "public static function OK($data = array())\r\n\t{\r\n\t\tself::success($data);\r\n\t}", "public function testSucceeded(\\unittest\\TestSuccess $success) {\n }", "public function success($title, $fields = array(), $header = true, $solid = false)\n\t{\n\t\treturn $this->box($title, 'success', $fields, $header, $solid);\n\t}", "public function success($message, $title = null, $options = []) {\n $this->add('success', $message, $title, $options);\n }", "function printSessionSuccessMessage(){\n\t\tif (!empty($_SESSION[\"successMessage\"])) {\n\t\t\techo(\"<div class=\\\"alert alert-success alert-dismissible fade show text-center\\\" role=\\\"alert\\\">\" \n\t\t\t\t. $_SESSION[\"successMessage\"] \n\t\t\t\t. \"<button type=\\\"button\\\" class=\\\"close\\\" data-dismiss=\\\"alert\\\">&times;</span></button></div>\");\n\t\t}\n\t}", "public static function success()\n {\n return [\n 'code' => JsonResponse::HTTP_OK,\n 'status' => 'success',\n 'message' => 'Operation successfully executed.'\n ];\n }", "public function callbackSuccess()\n {\n $this->AddOutput(\"<p><i>\" . $this->logoutMessage . \"</i></p>\");\n $this->redirectTo();\n }", "public function printSuccessMessage()\n {\n printf('Successfully checked %d lines in %d files :)'. PHP_EOL, $this->lines, $this->files);\n }", "public function storeSucceed()\r\n {\r\n return redirect()->to(handles('antares::install/components'));\r\n }", "public function getSuccess();", "public static function success(string $msg): string\n {\n $msg = 'Success: ' . $msg;\n $space = self::tabSpaces($msg);\n $out = static::colorize(str_pad(' ', $space), Color::FG_WHITE, Color::AT_BOLD, Color::BG_GREEN) . PHP_EOL;\n $out .= static::colorize(' ' . $msg . ' ', Color::FG_WHITE, Color::AT_BOLD, Color::BG_GREEN) . PHP_EOL;\n $out .= static::colorize(str_pad(' ', $space), Color::FG_WHITE, Color::AT_BOLD, Color::BG_GREEN) . PHP_EOL;\n\n return $out;\n }", "public function successAction()\n {\n $data = $this->getSessionContainer()->successfulTip;\n if (empty($data)) {\n return $response = $this->redirect()->toRoute('tip-me');\n }\n\n $tipService = $this->getTipService();\n $tipMeCfg = $tipService->getOptions();\n $tipItem = $tipMeCfg['tip_options'][$data['tipOption']];\n\n $this->getEventManager()->trigger(__FUNCTION__, $this, array('data' => $data, 'tipItem' => $tipItem));\n\n return array(\n 'data' => $data,\n 'tipItem' => $tipItem,\n 'adminEmail' => $tipMeCfg['admin_email'],\n 'statementDescriptor' => $tipMeCfg['statement_descriptor'],\n );\n }", "public static function alert() {\n\t\t# Get arguments to this function:\n\t\t$args = func_get_args();\n\n\t\t# Add message to log:\n\t\treturn self::add(LOG_ALERT, $args);\n\t}", "public function setSuccess($success);", "public function successMsg(){\n if(defined('PLUGIN_OPTIONS'))\n return $this->moduleSuccessMsg();\n return browser\\msg::pageNotFound();\n }", "protected function saySuccess($message)\n {\n $this->say(\"<notice> $message </notice>\");\n }", "private static function setSuccess($success){\n switch($success){\n\n case 'created':\n http_response_code(201);\n echo '{\n \"message\":\"Successful Post\"\n }';\n break;\n\n case 'deleted':\n case 'empty':\n http_response_code(200); //posso mettere anche 204 ma il borwser non reindirizzera il bliente sulla pagina con il json e il cliente non vedra il json. Potra capire tuttavia che e e andato tutto bene dal codice\n echo '{\n \"message\":\"Everything went fine but there are no results\"\n }';\n break;\n\n default:\n http_response_code(501);\n break;\n }\n }", "public function callbackSuccess()\n {\n $this->di->get(\"response\")->redirect(\"question\")->send();\n }", "public function success($msg) {\n\t\t\t\t//Increment successes.\n\t\t\t\t$this -> successes[]\t=\t$msg;\n\t\t\t}", "public function setSuccess()\n {\n $this->attributes['status'] = 'success';\n self::save();\n }", "public function setSuccess()\n {\n $this->attributes['status'] = 'success';\n self::save();\n }", "function setSuccessMessage($appointmentData)\n\t{\n\t\t$stylistName = $appointmentData[0]['stylistName'];\n\t\t$serviceName = $appointmentData[0]['serviceName'];\n\t\t$appointmentDate = date('l F j',strtotime($appointmentData[0]['appointmentDate']));\n\t\t$startTime = date('g:i a', strtotime($appointmentData[0]['startTime']));\n\t\t$this->email = $appointmentData[0]['email'];\n\t\t\n\t\t$this->message = JText::sprintf('COM_SALONBOOK_EMAIL_BODY_SUCCESS', $serviceName, $stylistName, $appointmentDate, $startTime);\n\t\t$this->mailer->setBody($this->message);\t\t\n\t}", "abstract public function sendAlert( );", "private static function success(string $message): void\n {\n echo \"\\033[42m\\033[30m\" . $message . \"\\033[0m\" . PHP_EOL;\n }", "protected function success()\n {\n if ( isset( $this->data['status'] ) && $this->data['status'] == 'SUCCESS' ) {\n return true;\n }\n return false;\n }", "public static function userCreateSuccess(){\n self::$IntelligenceService->addToIntelligenceStack(self::USER_INTELLIGENCE_CREATE_KEY, self::USER_INTELLIGENCE_SUCCESS);\n }" ]
[ "0.70969784", "0.7018622", "0.693242", "0.68742555", "0.68605894", "0.67812127", "0.6776148", "0.6753726", "0.6746974", "0.67357916", "0.6719359", "0.67051446", "0.669751", "0.6682873", "0.6641265", "0.6641265", "0.66384023", "0.6613057", "0.6593772", "0.6536495", "0.6494668", "0.6488785", "0.6487418", "0.6471346", "0.64608735", "0.6458874", "0.6433596", "0.6422467", "0.6400191", "0.63993204", "0.6384829", "0.63799477", "0.637862", "0.6376623", "0.63724303", "0.6365185", "0.636374", "0.63601226", "0.63456285", "0.63447213", "0.63130265", "0.62978894", "0.6273152", "0.6270152", "0.6251586", "0.6242524", "0.6240911", "0.6227156", "0.62235457", "0.62019545", "0.61916435", "0.6187191", "0.6180012", "0.61669225", "0.61669225", "0.61647826", "0.6152378", "0.6141341", "0.6141222", "0.6122582", "0.6119129", "0.61183274", "0.6116048", "0.611522", "0.6112458", "0.6098141", "0.609354", "0.60884005", "0.607934", "0.60771453", "0.60754156", "0.60657936", "0.6059752", "0.6059719", "0.6047198", "0.6040335", "0.6031198", "0.60282344", "0.6015647", "0.60136133", "0.60109484", "0.600695", "0.6005782", "0.60030496", "0.59889424", "0.59853834", "0.5969362", "0.5968849", "0.5964634", "0.59600997", "0.595795", "0.5956377", "0.5950202", "0.59485346", "0.59485346", "0.5943432", "0.5940335", "0.59346724", "0.5934244", "0.5932402" ]
0.6615633
17
Initialization hook method. Use this method to add common initialization code like loading components. e.g. `$this>loadComponent('Security');`
public function initialize() { parent::initialize(); $this->loadComponent('RequestHandler'); $this->loadComponent('Flash'); /* * Enable the following components for recommended CakePHP security settings. * see https://book.cakephp.org/3.0/en/controllers/components/security.html */ //$this->loadComponent('Security'); //$this->loadComponent('Csrf'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function initialize()\n {\n parent::initialize();\n\n $this->loadComponent('RequestHandler');\n $this->loadComponent('Flash');\n $this->loadComponent('Cookie', [\n 'expires' => Configure::read('Config.CookieExpires'),\n 'httpOnly' => true\n ]);\n $this->loadComponent('Common');\n $this->loadComponent('Auth', array(\n 'loginRedirect' => false,\n 'logoutRedirect' => false,\n 'loginAction' => array(\n 'controller' => 'customers',\n 'action' => 'login',\n 'plugin' => null\n ),\n 'sessionKey' => 'Auth.ChoTreo'\n ));\n }", "public function initialize()\n\t{\n\t\tparent::initialize();\n\t\t$this->loadComponent('Paginator');\n\t\t$this->loadComponent('Flash'); // Inclusion of the FlashComponent\n\n\n\t}", "public function initialize() {\r\n\t\tparent::initialize();\r\n\t\t\r\n\t\t// load mediawiki api component\r\n\t\t$this->loadComponent( 'MediawikiAPI' );\r\n\t\t$this->loadComponent( 'PasswordGenerator' );\r\n\t\t$this->loadComponent( 'EmailSending' );\r\n\t}", "public function initialize()\n {\n parent::initialize();\n\n $this->loadComponent('RequestHandler');\n $this->loadComponent('Flash');\n $this->loadComponent('Auth', [\n 'authorize' => 'Controller',\n 'loginAction' => [\n 'controller' => 'Users',\n 'action' => 'login',\n ],\n 'loginRedirect' => [\n 'controller' => 'Users',\n 'action' => 'index/',\n ],\n 'logoutRedirect' => [\n 'controller' => 'Booking',\n 'action' => 'index',\n ],\n 'authError' => 'Enregistrez-vous ou Connectez-vous',\n 'authenticate' => [\n 'Form' => [\n 'fields' => ['username' => 'Email', 'password' => 'Password']\n ]\n ]\n ]\n );\n\n /*\n * Enable the following components for recommended CakePHP security settings.\n * see https://book.cakephp.org/3.0/en/controllers/components/security.html\n */\n //$this->loadComponent('Security');\n //$this->loadComponent('Csrf');\n }", "public function initialize()\n {\n parent::initialize();\n\n $this->loadComponent('RequestHandler');\n $this->loadComponent('Flash');\n\n $this->loadComponent('Acl', [\n 'className' => 'Acl.Acl'\n ]);\n $this->loadComponent('CakeDC/Users.UsersAuth');\n\n // if ($this->Auth->user('role_id') == 'e687cb91-4cdf-4ab2-992f-e76584199c2e') {\n // var_dump('Redirect');\n // $this->Auth->config('loginRedirect',['controller'=>'articles','action'=>'index']);\n // }\n\n /*\n * Enable the following components for recommended CakePHP security settings.\n * see https://book.cakephp.org/3.0/en/controllers/components/security.html\n */\n //$this->loadComponent('Security');\n //$this->loadComponent('Csrf');\n }", "public function initialize()\n {\n parent::initialize();\n\n $this->loadComponent('RequestHandler');\n $this->loadComponent('Flash');\n $this->loadComponent('Auth', ['authenticate' =>\n ['ADmad/JwtAuth.Jwt' => [\n 'parameter' => 'token',\n 'userModel' => 'Sessions',\n 'fields' => [\n 'username' => 'username'\n ],\n 'scope' => ['Sessions.status' => 1],\n 'queryDatasource' => true\n ]\n ],'storage' => 'Memory',\n 'checkAuthIn' => 'Controller.initialize',\n 'loginAction' => false,\n 'unauthorizedRedirect' => false]);\n $this->loadComponent('Paginator');\n $this->loadComponent('BryanCrowe/ApiPagination.ApiPagination',[\n 'visible' => [\n 'page',\n 'current',\n 'count',\n 'perPage',\n 'prevPage',\n 'nextPage'\n ]\n ]);\n }", "public function init()\n {\n $this->loadThemeComponent();\n $this->loadConfig();\n }", "public function init() {\n\n // Set required classes for import.\n $this->setImport(array(\n $this->id . '.components.*',\n $this->id . '.components.behaviors.*',\n $this->id . '.components.dataproviders.*',\n $this->id . '.controllers.*',\n $this->id . '.models.*',\n ));\n\n // Set the required components.\n $this->setComponents(array(\n 'authorizer' => array(\n 'class' => 'RAuthorizer',\n 'superuserName' => $this->superuserName,\n ),\n 'generator' => array(\n 'class' => 'RGenerator',\n ),\n ));\n }", "public function initialize()\n {\n parent::initialize();\n $this->loadHelper('Auth');\n }", "private function init() {\n\n\t\tif ( ! $this->should_load() ) {\n\t\t\treturn;\n\t\t}\n\t\t$this->setup_admin();\n\t\t$this->setup_api();\n\t}", "function _initialize()\n {\n\n //initalize Loader\n $auto_load=array(\"io\",\"segment\",\"router\");\n \n foreach($auto_load as $library)\n {\n $this->$library=& load_class($library);\n }\n //load loader class\n $this->load =& load_class('Loader');\n \n //call auto load from config file\n $this->load->_auto_load();\n }", "public function init() {\n\t\t// you may place code here to customize the module or the application\n\t\t// import the module-level models and components\n\t\t$this->setImport(array(\n\t\t\t'common.components.*',\n\t\t));\n\t}", "public function initialize()\n {\n parent::initialize();\n\n $this->loadComponent('RequestHandler',[ 'enableBeforeRedirect' => false ]);\n $this->loadComponent('Flash');\n\n $this->loadComponent('Auth',[\n\n //'authorize' => ['Controller'],\n\n 'loginAction' => '/login',\n 'loginRedirect' => '/',\n 'logoutRedirect' => '/login',\n\n 'authenticate' => [\n 'Form' => [\n 'fields' => [\n 'username' => 'email',\n 'password' => 'password' \n ]\n ]\n ],\n 'loginAction' => [\n 'controller' => 'users',\n 'action' => 'login'\n ],\n\n 'storage' => 'Session'\n ]);\n }", "public function init()\n\t{\n\t\t// you may place code here to customize the module or the application\n\n\t\t// import the module-level models and components\n\t\t$this->setImport(array(\n\t\t\t'yiiauth.models.*',\n\t\t\t'yiiauth.components.*',\n\t\t));\n\t}", "public function initialize() {\n $this->add_hooks_and_filters();\n }", "public static function Initialize() {\n\n Debugger::debugMessage('Registering components register');\n self::ComponentsRegister();\n }", "public function initialize()\n {\n parent::initialize();\n\n $this->loadComponent('Auth', [\n 'storage' => 'Memory',\n 'authenticate' => [\n 'Form' => [\n //'scope' => ['Users.active' => 1],\n 'fields' => [\n 'username' => 'username',\n 'password' => 'password'\n ]\n ],\n 'ADmad/JwtAuth.Jwt' => [\n 'parameter' => 'token',\n 'userModel' => 'users',\n //'scope' => ['Users.active' => 1],\n 'fields' => [\n 'username' => 'username'\n ],\n 'queryDatasource' => true\n ]\n ],\n 'unauthorizedRedirect' => false,\n 'checkAuthIn' => 'Controller.initialize',\n 'loginAction' => false,\n 'authError' => 'server:api.auth_controller.error.authentication'\n ]);\n }", "public function init()\n\t{\n\t\t$this->resolvePackagePath();\n\t\t$this->registerCoreScripts();\n\t\tparent::init();\n\t}", "protected function __onInit()\n\t{\n\t}", "public function initialize()\n {\n $autoloader = $this->registerAutoloader();\n $this->registerPlugins($autoloader);\n }", "public function initialize()\n {\n // load configures\n $this->_config = $this->di->get('config');\n\n if ($this->_config->logger->enable)\n $this->_logger = $this->di->get('logger');\n\n // set default page title\n $this->tag->setTitle('Authenticate');\n }", "public static function _init() {\n // this is called upon loading the class\n }", "public function init()\n\t{\n\t\t// you may place code here to customize the module or the application\n\n\t\t// import the module-level models and components\n\t\t$this->setImport(array(\n\t\t\t'clinics.models.*',\n\t\t\t'clinics.components.*',\n\t\t));\n\t}", "public function loadInit() {}", "public function _before_init(){}", "public static function _init()\n {\n \\Module::load('authentication');\n }", "public function init()\n {\n // you may place code here to customize the module or the application\n }", "protected function init(): void\n {\n //\n }", "private function __construct() {\r\n $this->initHooks();\r\n }", "protected function init() {\n }", "protected function init() {\n }", "protected function initialize() {\n\t}", "protected function _beforeInit() {\n\t}", "protected function init() {\n\t}", "protected function init() {\n\t}", "public function init()\n\t{\n\t\t// you may place code here to customize the module or the application\n\n\t\t// import the module-level models and components\n\t\t$this->setImport(array(\n\t\t\t\t'admin.models.*',\n\t\t\t\t'admin.components.*',\n\t\t));\n\n\t}", "public function load()\n {\n // Register initialization method.\n add_action('init', [$this, 'init'], 10, 0);\n }", "public function init()\n\t{\n\t\t// you may place code here to customize the module or the application\n\n\t\t// import the module-level models and components\n\t\t$this->setImport(array(\n\t\t\t'admin.models.*',\n\t\t\t'admin.components.*',\n\t\t));\n\t}", "protected function init()\n {\n $this->registerExtensions();\n }", "public function init()\n\t{\n\t\t$this->loader->init();\n\t\t$this->routing->init();\n\t}", "public function __construct(){\r\n $this->init_hooks();\r\n $this->includes_and_requires();\r\n }", "protected function init(): void\n {\n }", "protected function init()\n {\n }", "protected function init()\n {\n }", "protected function init()\n {\n }", "public function init()\n\t{\n\t\t// you may place code here to customize the module or the application\n\n\t\t// import the module-level models and components\n\t\t$this->setImport(array(\n\t\t\t'user.models.*',\n\t\t\t'user.components.*',\n\t\t\t'application.modules.system.models.*',\n\t\t\t'application.modules.system.components.*',\n\t\t\t'application.modules.storage.models.*',\n\t\t\t'application.modules.storage.components.*'\n\t\t));\n\t}", "public function init()\n {\n // Register the loader method\n spl_autoload_register(array(__CLASS__, '_loadClasses'));\n }", "public function init()\n\t{\n\t\t// you may place code here to customize the module or the application\n\n\t\t// import the module-level models and components\n\t\t$this->setImport(array(\n\t\t\t'message.models.*',\n\t\t\t'message.components.*',\n 'message.forms.*',\n\t\t));\n\t}", "protected function init()\n {\n\n }", "public function initialize()\n {\n $this->initializeUI(['layout' => false]);\n $this->loadHelper('Text');\n $this->loadHelper('Paginator');\n $this->loadHelper('Menu');\n }", "public function init()\n {\n parent::init();\n $this->initClass();\n }", "protected function initialize()\n {\n }", "public function init()\r\n {\r\n $this->admin = Shopware()->Modules()->Admin();\r\n $this->basket = Shopware()->Modules()->Basket();\r\n $this->session = Shopware()->Session();\r\n $this->db = Shopware()->Db();\r\n $this->moduleManager = Shopware()->Modules();\r\n $this->eventManager = Shopware()->Events();\r\n }", "protected function init(): void\n\t{\n\t}", "public function initialize() {\n parent::initialize();\n $this->loadComponent('RequestHandler');\n }", "public function initialize(): void\n {\n parent::initialize();\n /*\n * Enable the following component for recommended CakePHP form protection settings.\n * see https://book.cakephp.org/4/en/controllers/components/form-protection.html\n */\n //$this->loadComponent('FormProtection');\n }", "function init()\n\t{\n\t\tglobal $Options, $User_Options;\n\t\t$Options\t= $this->options\t=\t$this->get( NULL , NULL , TRUE );\n\t\t// Only when aauth is enabled\n\t\tif( Modules::is_active( 'aauth' ) )\n\t\t{\n\t\t\t$User_Options = $this->user_options = $this->get( NULL , $this->events->apply_filters( 'user_id' , 0 ) );\n\t\t}\n\t\t\n\t\t\n\t\t/**\n\t\t * If language is set on dashboard\n\t\t * @since 3.0.5\n\t\t**/\n\t\tif( riake( 'site_language', $Options ) ) {\n\t\t\tget_instance()->config->set_item( 'site_language', $Options[ 'site_language' ] );\n\t\t}\n\n\t\t/** \n\t \t * Load Language\n\t\t**/\n\t\t\n\t\t$this->lang->load( 'system' );\t\n\t}", "protected function initialize() {\n\t\t\n\t}", "protected function init()\n {\n }", "protected function init()\n {\n }", "protected function init()\n {\n }", "protected function init()\n {\n }", "protected function init()\n {\n }", "protected function _init()\n {\n }", "protected function initialize() {}", "protected function initialize() {}", "protected function initialize() {}", "protected function initialize() {}", "public function init()\n\t{\n\t\t// you may place code here to customize the module or the application\n\n\t\t// import the module-level models and components\n\t\t$this->setImport(array(\n\t\t\t'forum.models.*',\n\t\t\t'forum.components.*',\n 'forum.controllers.*',\n\t\t));\n\t}", "public static function _init()\n\t{\n\t\tLang::load('pagination', true);\n\t\tConfig::load('hybrid', 'hybrid');\n\t}", "protected function _init()\n {\n }", "public function initialize()\n {\n \t\n \t$this->viewBuilder()->setLayout('default');\n \t\n parent::initialize();\n\n $this->loadComponent('RequestHandler');\n $this->loadComponent('Flash');\n\t\t$this->loadComponent('Auth', [\n 'authorize' => ['Controller'],\n 'loginRedirect' => [\n 'controller' => 'MasterListings', \n 'action' => 'index'\n ],\n 'logoutRedirect' => [\n 'controller' => 'Users', \n 'action' => 'login'\n ],\n 'loginAction' => [\n 'controller' => 'Users', \n 'action' => 'login'\n ],\n 'authenticate' => [\n 'Form' => [\n //'passwordHasher' => 'Blowfish',\n 'userModel' => 'Users', \n 'fields' => ['username' => 'username', 'password' => 'password'] \n \n ]\n ],\n\t\t\t\n 'authError' => 'you are not Authorise to Acccess this location.',\n 'storage' => 'Session'\n ]);\n\n /*\n * Enable the following components for recommended CakePHP security settings.\n * see http://book.cakephp.org/3.0/en/controllers/components/security.html\n */\n //$this->loadComponent('Security');\n //$this->loadComponent('Csrf');\n }", "protected function __construct() {\n\n // Cargamos Clases.\n $this -> setup_hooks();\n }", "protected function __construct() {\n\n // Cargamos Clases.\n $this -> setup_hooks();\n }", "public function init() {\n //TODO override and put config intialization code here\n }", "protected function initialize()\n\t{\n\n\t}", "public function init() {\n\t\t// you may place code here to customize the module or the application\n\n\t\t// import the module-level models and components\n\t\t$this->setImport(array(\n\t\t\t'music.models.*',\n\t\t\t'music.components.*',\n\t\t));\n\t}", "protected function init() {}", "protected function init() {}", "protected function init() {}", "protected function init() {}", "protected function init() {}", "protected function init() {}", "public function init() {\n // you may place code here to customize the module or the application\n // import the module-level models and components\n $this->setImport(array(\n 'sys.models.*',\n 'product.models.*',\n 'sys.components.*',\n 'hr.models.*',\n ));\n }", "protected function init() {}", "protected function init() {}", "protected function init() {}", "protected function init() {}", "protected function init() {}", "protected function init() {}", "public function init()\n {\n $this->loadMeta();\n }", "public function init()\n\t{\n\t\t// you may place code here to customize the module or the application\n\n\t\t// import the module-level models and components\n\t\t$this->setImport(array(\n\t\t\t'admin.models.*',\n\t\t\t'admin.components.*',\n\t\t));\n\n\t\t$this->_initBootstrap();\n\t\t$this->_initJsCss();\n\t}", "protected function init()\n { }", "public function init()\n\t{\n\t\t// you may place code here to customize the module or the application\n\n\t\t// import the module-level models and components\n \n\t\t$this->setImport(array('my.models.*',));\n\t}", "static public function initialize()\r\n {\r\n spl_autoload_register(\"self::load\");\r\n }", "protected static function init()\n {\n }", "protected function __construct(){\n\n $this->setup_hooks();\n }", "protected function _init()\r\n\t{\r\n\t}", "public function initialize() : void\n {\n // Use to initialise member variables.\n $this->db = \"active\";\n $this->validator = new Validator();\n }", "public function init(): void\n {\n }" ]
[ "0.7946912", "0.7773577", "0.77526087", "0.7741109", "0.771082", "0.7704803", "0.76974875", "0.7584935", "0.7526934", "0.7523755", "0.74972165", "0.74754775", "0.74528354", "0.74457645", "0.7434708", "0.7425733", "0.7389886", "0.73864573", "0.73737717", "0.7363953", "0.7363841", "0.7363051", "0.731293", "0.7309179", "0.7292775", "0.7291819", "0.7288227", "0.7282642", "0.72796", "0.7237755", "0.7237755", "0.72222584", "0.72136796", "0.7197293", "0.7197293", "0.71849614", "0.7178069", "0.7173378", "0.717132", "0.7170599", "0.7168819", "0.7167016", "0.7154208", "0.7154208", "0.7154208", "0.7151562", "0.7140315", "0.71338737", "0.71278125", "0.71260655", "0.7121836", "0.7121313", "0.7116534", "0.71155703", "0.71032244", "0.7102012", "0.71004385", "0.70944744", "0.70907545", "0.70907545", "0.70907545", "0.70907545", "0.70907545", "0.7090417", "0.708718", "0.708718", "0.708718", "0.708718", "0.70867217", "0.7085263", "0.70833987", "0.7078201", "0.7074902", "0.7074902", "0.7073777", "0.70704246", "0.7067548", "0.70652926", "0.70652926", "0.70652926", "0.70652926", "0.70652926", "0.70652926", "0.70650804", "0.7065009", "0.7065009", "0.70649475", "0.70649475", "0.70649475", "0.70649475", "0.70502025", "0.7044442", "0.7040081", "0.7039517", "0.70285034", "0.70133406", "0.6995355", "0.69839203", "0.69823104", "0.6980671" ]
0.8072819
0
Index Page for this controller. Maps to the following URL or or Since this controller is set as the default controller in config/routes.php, it's displayed at So any other public methods not prefixed with an underscore will map to /index.php/welcome/
public function compte_client() { $this->load->view('app/page-compte-client'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function index () {\n $view = new WelcomeIndex();\n $view->display();\n }", "public function index()\n\t{\n\t\treturn view(\"welcome\");\n\t}", "public function index()\n\t{\n\t\t$this->load->view('welcome');\n\t}", "public function action_index()\r\n\t{\r\n\t\t$this->title = 'Welcome';\r\n\t\t$this->template->content = View::factory('index');\r\n\t}", "public function index()\n\t{\n\t\treturn view('welcome');\n\t}", "public function index()\n\t{\n\t\treturn view('welcome');\n\t}", "public function indexAction()\n\t{\n\t\t//echo 'Hello from the index action in the Home controller!';\n\t\t\n\t\t/*View::render('Home' . DS . 'index.php', [\n\t\t\t\"name\" => \"Laura\",\n\t\t\t\"colours\" => [\"red\", \"green\", \"blue\"]\n\t\t]);*/\n\t\t\n\t\t// View::renderTemplate('Home' . DS . 'index.html', [\n\t\t// \t\"name\" => \"Laura\",\n\t\t// \t\"colours\" => [\"red\", \"green\", \"blue\"]\n // ]);\n \n\t\t$this->showRouteParams();\n\t\t// echo \"Hello, World!\";\n }", "public function index()\n\t{\n\t\t//Default view\n\t\t$this->load->view('index.html');\n\t}", "function index() {\n\n // This page cannot be accessed without providing a page\n // the routes.php file will not allow the page to be accessed\n // $route['pages/(:any)'] = 'pages/view/$';\n redirect('/', 'refresh');\n\n }", "public function Index()\n\t{\n\t\t$this->views->SetTitle('Index Controller');\n\t\t$this->views->AddView('index/index.tpl.php', array(),'primary');\n\t}", "public function index()\n\t{\n\t\t$this->load->view('default/index');\n\t}", "public function index() {\n\t\t$this->display('index');\n\t}", "public function index()\n\t{\t\n\n\t\t$this->load->view('welcome_message');\n\t}", "public function indexAction()\n {\n $arr = [\n 'title' => 'Welcome',\n 'data' => [\n 'name' => 'PHP FRAMEWORK',\n ]\n ];\n View::renderTemplate('Welcome/index.html', $arr);\n }", "public function index()\n\t{\n\t\t$this->load->view('index');\n\t}", "public function index()\n\t{\n\t\t$this->load->view('index');\n\t}", "public function index()\n\t{\n\t\t$this->load->view('index');\n\t}", "public function index()\n\t{\n\t\t$this->load->view('index');\n\t}", "public function index()\n\t{\n\t\t$this->load->view('index');\n\t}", "public function index()\n\t{\n\t\t$this->load->view('index');\n }", "public function show_index()\n {\n return view('welcome');\n }", "public function index()\n\t{\n\t\t$this->load->view('welcome_message');\n\t}", "public function index()\n\t{\n\t\t$this->load->view('welcome_message');\n\t}", "public function index()\n\t{\n\t\t$this->load->view('welcome_message');\n\t}", "public function index()\n\t{\n\t\t$this->load->view('welcome_message');\n\t}", "public function index()\n\t{\n\t\t$this->load->view('welcome_message');\n\t}", "public function index()\n\t{\n\t\t$this->load->view('welcome_message');\n\t}", "public function index()\n\t{\n\t\t$this->load->view('welcome_message');\n\t}", "public function index()\n\t{\n\t\t$this->load->view('welcome_message');\n\t}", "public function index()\n\t{\n\t\t$this->load->view('welcome_message');\n\t}", "public function index()\n\t{\n\t\t$this->load->view('welcome_message');\n\t}", "public function index()\n\t{\n\t\t$this->load->view('welcome_message');\n\t}", "public function index()\n\t{\n\t\t$this->load->view('welcome_message');\n\t}", "public function index()\n\t{\n\t\t$this->load->view('welcome_message');\n\t}", "public function Index()\n {\n $this->standardView('Index');\n }", "public function index()\n {\n return view('main.welcome');\n }", "public function index()\n {\n // return view('welcome');\n }", "public function index()\n {\n $this->load->view('index');\n }", "public function index()\n {\n // return view('welcome');\n \n }", "public function index()\n\t{\n\t\t$this->load->view('home');\n\t}", "public function index()\n\t{\n\t\techo \"Nothing !\";\n\t}", "public function index() {\n \n return view('welcome');\n }", "public function index()\n {\n return view('pages.welcome');\n }", "public function index()\n {\n $this->load->view('welcome_message');\n }", "public function index()\n {\n $this->load->view('welcome_message');\n }", "public function Index()\n {\n \treturn view(\"index\");\n\t}", "public function index()\n {\n\t\t/*$this->layout->setTitle('Welcome to our Blog');\n\t\t$this->layout->showView('welcome/about.php');*/\n\t\techo 'hello I\\'m using codeigniter';\n }", "public function index() {\n\n\t\tif(!empty($_GET['page'])) {\n\t\t\tif($_GET['page'] == 'home') {\n\t\t\t\t(new HomeController)->home();\n\t\t\t} elseif($_GET['page'] == 'about-me') {\n\t\t\t\t(new HomeController)->aboutMe();\n\t\t\t}\n\t\t} else {\n\t\t\t(new HomeController)->home();\n\t\t}\n\t}", "public function index()\n {\n return view('welcome');\n }", "public function index()\n {\n return view('welcome');\n }", "public function index()\n {\n return view('welcome');\n }", "public function index()\n {\n return view('welcome');\n }", "public function index()\n {\n return view('welcome');\n }", "public function index()\n {\n return view('welcome');\n }", "public function index()\n {\n return view('welcome');\n }", "public function index()\n {\n return view('welcome');\n }", "public function index()\n {\n return view('welcome');\n }", "public function index()\n {\n return view('welcome');\n }", "public function index()\n {\n return view('welcome');\n }", "public function index()\n\t{\n\t\treturn view('pages/home');\n\t}", "public function index()\n {\n return \"INDEX PAGE\";\n }", "public function index()\n\t{\n\t\treturn view('home');\n\t}", "public function index()\n\t{\n\t\treturn view('home');\n\t}", "function index() {\n \n parent::index();\n\n\t\t$data['user_id'] = $this->tank_auth->get_user_id();\n\t\t$data['username'] = $this->tank_auth->get_username();\n\t\t$data['main_content_view'] = $this->load->view('welcome', $data, true);\n $this->render_template($data);\n\t}", "public function index()\n {\n SEOMeta::setTitle('Trusted Mortgage & Remortgage Solutions In UK - SmartMortgages UK');\n SEOMeta::setDescription('Home Page Description: For competitive mortgage and remortgage quotes around the UK at affordable rates, speak to one of our expert credit consultants and get a mortgage. For more visit us today.');\n\n return view('welcome');\n }", "public function index()\n\t{\n\t\t$this->title = 'My Index Action';\n\n\t\treturn new View('basic/index');\n\t}", "public function index()\n\t{\n\t\t$data['title'] = 'Home | Welcome to AEY';\n\t\t$data ['view_page'] = 'homepage';\n\n\t\t$this->load->view('site', $data);\n\t}", "public function index()\n {\n\n return view('welcome');\n\n }", "public function actionIndex(){ \n $this->view(\"index.php\");\n }", "public function index() {\n $this->registry->template->module = 'welcome';\n \n /*** load the index template ***/\n $this->registry->template->show('index');\n }", "public function actionIndex()\n\t{\n\t $this->pageTitle = 'Get Started';\n\t\t$this->render('index');\n\t}", "public function index()\n {\n return view('front.welcome');\n }", "public function index()\n\t{\n\t\treturn $this->traces();\n\t\treturn view('welcome');\n\t}", "public function index()\n\t{\n\t\t$this->loadViews(\"index\");\n\t}", "public function index() {\n\t\t$this->title = 'Home';\n\t\t$this->pageData['pages'] = Page::getAll();\n\t\t$this->render('index');\n\t}", "public function index()\n\t{\n\t\t$this->load->view('home/home');\n\t}", "public function index() \n\t{\n\t\t$this->_render_hod_view('home');\n\t}", "public function index()\r\n\t{\r\n\t\techo \"index\";\r\n\t}", "public function index()\n\t{\n\t\t$this->twig->display('welcome/index.html', []);\n\t}", "public function Index() {\n $this->Display();\n }", "public function index()\r\n {\r\n View::render('home');\r\n }", "public function index()\n {\n $title = 'Welcome Page';\n return view($this->view . '.home', compact('title'));\n }", "public function index()\n\t{\n\t\t//\n\t\techo'index';\n\t}", "public function index() {\n $this->getView('navigation', array('pagename' => 'Welcome'));\n $this->getView('welcome');\n $this->getView('footer');\n }", "public function index()\n {\n return view(\"home\");\n }", "public function home()\n\t{\n\t\t$this->load->view('index_view');\n\t}", "function index() {\n $this->renderView(\"index\");\n }", "function index()\r\n\t{\r\n\t\t$this->view(); \r\n\t}", "public function index()\n\t{\n\t\treturn view('index');\n\t}", "public function index()\n {\n return view('welcome');\n }", "public function index()\n {\n\n\n\n return view('welcome');\n }", "public function index() {\n\t\t$page = Page::getInstance();\n\t\t$session = Session::getInstance();\n\t\t$page->setPageTitle('Method index notfound');\n\t\t$session->setFlash('Chaque controller doit avoir une m&eacute;thode index', 'error');\n\t}", "public function index()\r\n\t{\r\n\t\t//\r\n\t}", "public function index() {\n\t\t// render the view (/view/main/index.php)\n\t\t$this->view->render(\"main\", \"index\");\n\t}", "public function index()\n {\n return View(\"pages.home\");\n }", "public function index()\n {\n // Nothing to do\n }", "public function index(){\n return view('welcome');\n }", "public function index()\n\t{\n\t\t//\n\t}", "public function index()\n\t{\n\t\t//\n\t}", "public function index()\n\t{\n\t\t//\n\t}", "public function index()\n\t{\n\t\t//\n\t}" ]
[ "0.76550865", "0.7413205", "0.7395801", "0.7316207", "0.7226923", "0.7226923", "0.71882564", "0.7164397", "0.71506333", "0.7142835", "0.7106283", "0.7075598", "0.70750904", "0.70398116", "0.70281506", "0.70281506", "0.70281506", "0.70281506", "0.70281506", "0.6971946", "0.6967124", "0.6947481", "0.6947481", "0.6947481", "0.6947481", "0.6947481", "0.6947481", "0.6947481", "0.6947481", "0.6947481", "0.6947481", "0.6947481", "0.6947481", "0.6947481", "0.69293374", "0.69251674", "0.69108045", "0.6899327", "0.6893369", "0.6874425", "0.68557847", "0.68556076", "0.683825", "0.6802687", "0.6802687", "0.6800953", "0.6794804", "0.6788131", "0.6766616", "0.6766616", "0.6766616", "0.6766616", "0.6766616", "0.6766616", "0.6766616", "0.6766616", "0.6766616", "0.6766616", "0.6766616", "0.67640543", "0.67619723", "0.67595714", "0.67595714", "0.6750901", "0.67501795", "0.6745532", "0.6741639", "0.67374533", "0.6727355", "0.6716538", "0.6712338", "0.67105645", "0.6703301", "0.66978824", "0.6690549", "0.6674175", "0.6661711", "0.66588706", "0.6650278", "0.6628588", "0.6620002", "0.6612075", "0.6602447", "0.65975255", "0.65926814", "0.6592221", "0.6583287", "0.6574685", "0.6573504", "0.65729856", "0.65533465", "0.6544771", "0.65433973", "0.6542003", "0.6541333", "0.653975", "0.6516544", "0.6513891", "0.6513891", "0.6513891", "0.6513891" ]
0.0
-1
accessor method for profile id
public function getProfileId() { return($this->profileId); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getProfileID() {\n\t\treturn $this->_ProfileID;\n\t}", "public function getProfileId()\n {\n return $this->profile_id;\n }", "public function getProfileId() {\n\t\treturn ($this->profileId);\n\t}", "public function getProfileId() {\n\t\treturn ($this->profileId);\n\t}", "public function getProfileId() \n {\n if (!$this->hasProfileId()) \n {\n $this->profileId = '';\n }\n\n return $this->profileId;\n }", "public function getProfileId() {\n\t\treturn $this->profileId;\n\t}", "public function getProfileId() : Uuid {\n\t\treturn ($this->profileId);\n\t}", "private function getProfileId()\n {\n $identity = $this->getIdentity();\n \n return $identity !== null && $identity->getCurrentProfile() ? $identity->getCurrentProfile()->profile_id : null;\n }", "public function getUserProfileId() {\n return($this->userProfileId); \n }", "public function GetId() {\n\t\t\n\t\t$user = self::GetUserProfile();\n\t\treturn $user['id'];\n\t}", "public function getProfileImageProfileId() {\n\t\treturn($this->profileImageProfileId);\n\t}", "function getProfile($id){\n return $this->activity_model->fetchProfile($id)->row();;\n }", "protected function getUserId()\n {\n return object_get($this->getUser(), 'profile_id', $this->getDefaultProfileId() );\n }", "public function getProfile()\n {\n return $this->profile;\n }", "public function getProfile()\n {\n return $this->profile;\n }", "public function getProfile()\n {\n return $this->profile;\n }", "public function getUserProfileId() : Uuid{\n\t\treturn($this->userProfileId);\n\t}", "public function getProfileId(): ?int {\n\t\treturn ($this->profileId);\n\t}", "public function path()\n {\n return \"profile/{$this->id}\";\n }", "public function GetProfile()\n {\n return $this->profile;\n }", "static function getProfileID($user_id)\n\t{\n\n\t\t$profile = ORM::for_table('PROFILE')->select('profile_id')->where('owner_id', $user_id)->find_one();\n\n\t\treturn $profile;\n\t}", "public function getProfile() {\n\t\treturn $this->profile;\n\t}", "public function profile() {\n return $this->profile;\n }", "public function getIdProf()\n {\n return $this->idProf;\n }", "static function getProfile($profile_id)\n\t{\n\t\t$profile = ORM::for_table('PROFILE')->where('profile_id', $profile_id)->find_array();\n\n\t\treturn $profile;\n\t}", "public function getUserProfileId(): Uuid {\n\t\treturn ($this->userProfileId);\n\t}", "public function getProfileImageImageId() {\n\t\treturn($this->profileImageImageId);\n\t}", "public function getUserProfile();", "function getId(){\n\t\t\treturn $this->$id;\n\t\t}", "abstract protected function getUserProfile();", "public function getProfile()\n {\n return $this->getFieldValue(self::FIELD_PROFILE);\n }", "public function getUserID () {\n return $this->id;\n }", "public function getRatingProfileId() : Uuid {\n\treturn($this->ratingProfileId);\n}", "function getProfile(){\n $profile = $this->loadUser();\n return $profile;\n }", "protected function getUserId() {}", "protected function getUserId() {}", "public function getInfoProfile(){\n return $this->get_user_by_id($this->getAccountID());\n }", "function profileUrl()\r\n {\r\n return \"/user/show/{$this->id}\";\r\n }", "public function getGalleryProfileId(): string {\n\t\treturn ($this->galleryId);\n\t}", "public function getBillingProfileId();", "function getProfileName() {\n\t\treturn $this->_ProfileName;\n\t}", "public function getProfile()\n {\n $res = $this->getEntity()->getProfile();\n\t\tif($res === null)\n\t\t{\n\t\t\t$this->setProfile(SDIS62_Model_DAO_Abstract::getInstance($this::$type_objet)->findByCriteria('Profile', array('primary' => $this::getPrimary())));\n\t\t\treturn $this->getEntity()->getProfile();\n\t\t}\n return $res;\n }", "public function id()\n {\n return $this->user->id;\n }", "public function getID(): string;", "public function getVoteProfileId(): int {\n\t\treturn ($this->voteProfileId);\n\t}", "public function getUserIdentifier()\n {\n // that's why I am sending the id here\n return $this->id;\n }", "public function getId()\n {\n return $this->user['id'];\n }", "public function getId_Profesor()\n {\n return $this->id_profesor;\n }", "public function getIdPersonal()\n {\n return $this->idPersonal;\n }", "public function getId()\n {\n return $this->username;\n }", "public function getUserId()\n {\n return parent::getValue('user_id');\n }", "public function getID();", "public function getID();", "public function getID();", "public function getID() : string;", "public function get_user_id();", "public function getProfile(){\n\t\treturn (new Profile($this->userName));\n\t}", "public function getProfileName() {\n\t\treturn ($this->profileName);\n\t}", "function single_profile_id($data)\n {\n $this->db->select('*');\n $this->db->from('tbl_instructor_profile');\n $this->db->where('profile_id',$data);\n $query=$this->db->get();\n return $query->result();\n \n }", "public function getId()\n {\n return $this->ID_user;\n }", "public function getID() {\n return $this->user_id;\n }", "public function getSavedJobProfileId(): string {\n\t\treturn ($this->savedJobProfileId);\n\t}", "public function getOrganizationProfileId(): int {\n\t\treturn ($this->organizationProfileId);\n\t}", "public function getIdProperty();", "public static function id ()\n {\n return self::user()->getId();\n }", "function profile ($user_id) {\n global $sql;\n $res = $sql->sql_select_array_query(\"SELECT * FROM `profile` WHERE user_id = '{$user_id}'\");\n return count($res) > 0 ? $res[0] : null;\n }", "function getPersonID()\n {\n return $this->getValueByFieldName('person_id');\n }", "public function getProfile()\n {\n $profile = new \\login\\user\\Profile($this->db);\n if (array_key_exists('profile_id', $this->data)) {\n $profile->loadFromId($this->data['profile_id']);\n }\n return $profile;\n }", "public function getProfile()\n {\n return $this->hasOne(Profile::className(), ['id' => 'profile_id']);\n }", "function get_id()\r\n {\r\n return $this->id;\r\n }", "public function getProfileUrl()\n {\n return $this->ProfileUrl;\n }", "public function getUserProfileName(): string {\n\t\treturn ($this->userProfileName);\n\t}", "public function getProfileName()\n\t\t{\n\t\t return $this->profileName;\n\t\t}", "public function getProfile($userid);", "function get_id(){\n return $this -> id;\n }", "function get_id(){\n return $this -> id;\n }", "public function getUserID(){\n return($this->userID);\n }", "public function getId_user(){\n return $this->id_user;\n }", "public function getAccountID();", "public function getUserId(): string;", "abstract protected function getUserId() ;", "function get_id()\n {\n return $this->id;\n }", "function user_get_profile_data($id = null)\n\t{\n\t\t$uid = ($id == null) ? $this->user_getid() : $id; //If ID is null, then fetch *this* user profile\n\t\t$columns = $this->DB->database_build_query('USER_PROFILE');\n\t\t$profile = $this->DB->database_select('users', $columns,\n\t\t\t\t\t\t array('uid' => $uid), 1);\n\t\tif($profile == FALSE)\n\t\t{\n\t\t\treturn false;\n\t\t}\n\t\treturn $profile;\n\t}", "function get_userid() {\n return $this->userid;\n }", "public function get_id(){\n return $this->id;\n }", "function get_user_id(){\n return $this->user_id;\n }", "public function get_id();", "public function get_id();", "function current_user_profile($user_id = null)\n{\n if (is_null($user_id)) {\n $user_id = current_user_id();\n }\n\n// return \\base\\libs\\Redis::getUserProfile($user_id);\n}", "public function getIduser()\n {\n return $this->iduser;\n }", "public static function getCurrentUserId()\n {\n $profile = self::getProfile();\n\n return $profile ? $profile->getProfileId() : 0;\n }", "public function getId(): string;", "public function getId(): string;", "public function getId(): string;", "public function getId(): string;", "public function getUserId()\n {\n }", "public function GetId () ;", "public function getArticleProfileId(): Uuid {\n\t\treturn ($this->articleProfileId);\n\t}", "public function getEmployProfileId() {\n\t\treturn ($this->employProfileId);\n\t}", "function getProfile( $profile_id ) {\n\n // update cache if required\n if ( $this->last_profile_id != $profile_id ) {\n $this->last_profile_object = new WPLA_AmazonProfile( $profile_id );\n $this->last_profile_id = $profile_id;\n }\n\n return $this->last_profile_object;\n }" ]
[ "0.8200965", "0.7796108", "0.76142526", "0.76142526", "0.75160974", "0.74901557", "0.7365419", "0.7116003", "0.708957", "0.704777", "0.70215565", "0.6984004", "0.69818586", "0.69225454", "0.69225454", "0.69225454", "0.6890289", "0.68713105", "0.68671274", "0.68224317", "0.6812569", "0.68117553", "0.68108445", "0.67847943", "0.67376304", "0.67121166", "0.6694662", "0.6651222", "0.66347194", "0.6632355", "0.6590925", "0.6568787", "0.6563685", "0.65473926", "0.65131384", "0.65131384", "0.6510457", "0.650293", "0.65005386", "0.6499547", "0.6498346", "0.6495406", "0.6487584", "0.6463924", "0.64636266", "0.6462988", "0.64441603", "0.6443196", "0.642716", "0.6418366", "0.6408193", "0.6400086", "0.6400086", "0.6400086", "0.6396875", "0.63961464", "0.6368653", "0.6368494", "0.6354352", "0.634799", "0.63409317", "0.63353556", "0.63314927", "0.6324692", "0.6323945", "0.6323583", "0.6320869", "0.6313679", "0.63135064", "0.6308084", "0.6306806", "0.630677", "0.6306003", "0.6301747", "0.62944734", "0.62944734", "0.6289678", "0.6286129", "0.62826914", "0.62820935", "0.6281241", "0.6281158", "0.62794363", "0.62759995", "0.62747854", "0.6273431", "0.62717146", "0.62717146", "0.627166", "0.6266664", "0.62600076", "0.62591857", "0.62591857", "0.62591857", "0.62591857", "0.62587464", "0.62581396", "0.62532717", "0.6252575", "0.6243679" ]
0.75779724
4
accessor method for user name
public function getUserName() { return $this->userName; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "Public Function getUserName()\n\t{\n\t\treturn $this->firstName . ' ' . $this->lastName;\n\t}", "public function getUserName() {}", "function getUsername(){return $this->getName();}", "public function getUserName()\n {\n return $this->user_name;\n }", "function getName(): string\n\t{\n\t\treturn $this->username;\n\t}", "public function getUserName();", "public function getUserName()\n {\n return $this->formattedData['username'];\n }", "public function getUsername() {}", "public function getUserName() : string\n {\n return $this->userName;\n }", "public function getUserName() : string\n {\n return $this->userName;\n }", "function getUserName()\r\n\t{\r\n\t\treturn $this->UserName;\r\n\t}", "public function username(){\n \treturn $this->users->name.' '.$this->users->ape;\n }", "public function getUserName() {\n return $this->userName;\n }", "public function getUsername()\n {\n }", "public function getUsername()\n {\n }", "public function getUsername();", "public function getUsername();", "public function getUsername();", "public function getUsername();", "public function getUsername();", "public function getUsername() {\n }", "public function getName()\n {\n // Look for value only if not already set\n if (!isset($this->name)) {\n $us = SemanticScuttle_Service_Factory::get('User');\n $user = $us->getUser($this->id);\n $this->name = $user['name'];\n }\n return $this->name;\n }", "public function getuserName()\n {\n return $this->userName;\n }", "final public function getUserName():string \n {\n return $this->userState->getUserName();\n }", "public function getUserName()\n {\n return $this->user->name;\n }", "public function getUserName()\n {\n return $this->getName();\n }", "public function getUserName()\n {\n return $this->getUserAttribute(static::ATTRIBUTE_NAME);\n }", "public function GetUserName ();", "public function getUserName()\n {\n return $this->userName;\n }", "public function getUserName()\n {\n return $this->userName;\n }", "public function getUserName() {\r\n return $this->userName;\r\n }", "public function getUserName() {\n\t\treturn ($this->userName);\n\t}", "public function getUsername()\n {\n return $this->getDuckname();\n }", "public function getUsername()\n {\n return $this->getName();\n }", "function getUserName() {\n return $this->userName . \".guest\";\n }", "function get_user_name() {\n return $this->call('get_user_name', array(), TRUE);\n }", "public function username(){\n return 'user_name';\n }", "public function getUsername()\n {\n // TODO: Implement getUsername() method.\n }", "public function getUsername()\n {\n // TODO: Implement getUsername() method.\n }", "public function getUsername()\n {\n // TODO: Implement getUsername() method.\n }", "public function getUserName()\r\n {\r\n return $this->user->username;\r\n }", "public function getUserName() {\n return $this->userName;\n }", "public function getUsername() {\n return $this->getValue('username');\n }", "public function userName()\n {\n return $this->bean->user()->name();\n }", "public function getUsername()\n {\n return $this->nombre;\n }", "public function getUserName()\n {\n return $this->userName;\n }", "function getUserName() {\n\t\treturn $this->nickname;\n\t\t/*\n\t\tif(!$this->user_name) {\n\t\t\t$this->sql(\"SELECT nickname FROM \".UT_USE.\" WHERE id = \".$this->user_id);\n\t\t\t$this->user_name = $this->getQueryResult(0, \"nickname\");\n \t\t}\n\t\treturn $this->user_name;\n\t\t*/\n\t}", "public function getUsername(): string\n {\n return $this->username;\n }", "public function getUsername(): string\n {\n return $this->username;\n }", "public function getUsername(): string\n {\n return $this->username;\n }", "public function getUserNameIdentifier()\n {\n return $this->user_name;\n }", "private function getUsername()\n {\n return $this->_username;\n }", "function username(){\n return strtolower($this->user->username);\n }", "public function getUsername(): string {\n return $this->username;\n }", "function getUsername(){\r\n return $this->username;\r\n }", "function getUsername()\n {\n return $this->username;\n }", "public function getName()\n {\n return parent::getUsername();\n }", "public function getUsername()\n {\n return $this->get(self::_USERNAME);\n }", "public function get_user_name() { \n\n\t\tif ($this->user == '-1') { return _('All'); } \n\t\t\n\t\t$user = new User($this->user);\n\t\treturn $user->fullname . \" (\" . $user->username . \")\";\n\t\t\n\t}", "public function getUsername(): string;", "public function username()\n {\n }", "public function get_username() {\n return $this->username;\n }", "public function name()\n\t{\n\t\treturn User::info('Username');\n\t}", "public function getUsername()\n {\n return $this->username;\n }", "public function username()\n {\n return 'username';\n }", "public function username()\n {\n return 'username';\n }", "public function username()\n {\n return 'username';\n }", "public function username()\n {\n return 'username';\n }", "public function name(): string {\n return (string) $this->user?->first_name;\n }", "function getUsername()\n\t{\n\t\treturn $this->Info['Username'];\n\t}", "public function getUsername(): string\n {\n return (string)$this->username;\n }", "public function getUsername(): string\n {\n return (string)$this->username;\n }", "public function getMemberName() {\n return Html::a( $this->user->username, Yii::$app->params['url_admin'].'/user/view?id='.$this->user->id );\n }", "public function username($name);", "public function getNameOrUsername() {\n return $this->getName() ? : $this->username;\n }", "public function getExternalUserName();", "public function getName()\n {\n return self::USER_ID;\n }", "public function getNameOrUsername() {\n return $this->getName() ?: $this->username;\n }", "public function getUsernameMedico() {\n return parent::getUsernameUser();\n }", "protected function username()\n {\n return 'username';\n }", "public static function username() {\n return 'user_id';\n }", "public function getUsername(): string\n {\n return (string) $this->username;\n }", "public function getUsername(): string\n {\n return (string) $this->username;\n }", "public function getUsername(): string\n {\n return (string) $this->username;\n }", "public function getUsername(): string\n {\n return (string) $this->username;\n }", "public function getUsername(): string\n {\n return (string) $this->username;\n }", "public function getUsername(): string\n {\n return (string) $this->username;\n }", "public function getUsername(): string\n {\n return (string) $this->username;\n }", "public function getUsername(): string\n {\n return (string) $this->username;\n }", "public function getUsername(): string\n {\n return (string) $this->username;\n }", "public function getUsername(): string\n {\n return (string) $this->username;\n }", "public function getUsername(): string\n {\n return (string) $this->username;\n }", "public function getUsername(): string\n {\n return (string) $this->username;\n }", "public function getUsername(): string\n {\n return (string) $this->username;\n }", "public function getUsername(): string\n {\n return (string) $this->username;\n }", "public function getUsername(): string\n {\n return (string) $this->username;\n }", "public function getUsername(): string\n {\n return (string) $this->username;\n }", "public function getUsername(): string\n {\n return (string) $this->username;\n }", "public function getUsername(): string\n {\n return (string) $this->username;\n }" ]
[ "0.83647716", "0.83189416", "0.8312242", "0.8188385", "0.8172812", "0.8148769", "0.81185323", "0.8112201", "0.8081527", "0.8081527", "0.80668163", "0.8053526", "0.8053004", "0.8045362", "0.8045362", "0.8031353", "0.8031353", "0.8031353", "0.8031353", "0.8031353", "0.80038774", "0.7980864", "0.79739296", "0.7962016", "0.79424065", "0.7933184", "0.7925729", "0.79214597", "0.7907379", "0.7907379", "0.79013026", "0.7888975", "0.78696555", "0.78694844", "0.78693277", "0.7860757", "0.7852811", "0.78482187", "0.78482187", "0.78482187", "0.782835", "0.77975184", "0.77944225", "0.7781448", "0.7765827", "0.7758484", "0.77551943", "0.7745668", "0.7745668", "0.7745668", "0.77299875", "0.7728902", "0.77117026", "0.7703906", "0.7698287", "0.76905996", "0.7672631", "0.7671818", "0.7668326", "0.7663411", "0.7653932", "0.763011", "0.7630025", "0.76293546", "0.76221097", "0.76221097", "0.76221097", "0.76221097", "0.76208264", "0.76105785", "0.7610091", "0.7610091", "0.7607385", "0.7605643", "0.760483", "0.75947756", "0.7580642", "0.7558737", "0.75503355", "0.75500643", "0.7543485", "0.75418866", "0.75418866", "0.75418866", "0.75418866", "0.75418866", "0.75418866", "0.75418866", "0.75418866", "0.75418866", "0.75418866", "0.75418866", "0.75418866", "0.75418866", "0.75418866", "0.75418866", "0.75418866", "0.75418866", "0.75418866" ]
0.7748021
48
accessor method for user salt return string value for user salt
public function getUserSalt() { return $this->userSalt; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getSalt()\n {\n return $this->userData[$this->saltField];\n }", "public function getUserSalt () {\n\t\treturn ($this->userSalt);\n\t}", "public function getSalt()\r\n {\r\n return $this->salt;\r\n }", "public function getSalt()\n {\n //i might implement salt\n }", "public function getSalt()\n {\n return $this->salt;\n }", "public function getSalt()\n {\n return $this->salt;\n }", "public function getSalt()\n {\n return $this->salt;\n }", "public function getSalt()\n {\n return $this->salt;\n }", "public function getSalt()\n {\n return $this->salt;\n }", "public function getSalt()\n {\n return $this->salt;\n }", "public function getSalt()\n {\n return $this->salt;\n }", "public function getSalt()\n {\n return $this->salt;\n }", "public function getSalt()\n {\n return $this->salt;\n }", "public function getSalt()\n {\n return $this->salt;\n }", "public function getSalt()\n {\n return $this->salt;\n }", "public function getSalt()\n {\n return $this->salt;\n }", "public function getSalt() {\n return $this->salt;\n }", "public function getSalt() {\n return $this->salt;\n }", "protected function salt() {\n\t\treturn substr(md5(uniqid(rand(), true)), 0, $this->config->item('salt_length'));\n\t}", "public function getProfileSalt() : string {\n\t\treturn $this->profileSalt;\n\t}", "public function getSalt()\n {\n return User::$saltpass;\n }", "private function getSalt() \n {\n /**\n * the base64 function uses +'s and ending ='s; translate the first, and cut out the latter\n */\n return sprintf('$2a$%02d$%s', $this->rounds, substr(strtr(base64_encode($this->getBytes()), '+', '.'), 0, 22));\n }", "public function getSalt() {\n }", "public function getProfileSalt(): string {\n\t\treturn $this->profileSalt;\n\t}", "public function getSalt()\n {\n return '';\n }", "public function getSalt()\n {\n return '';\n }", "public function getSalt()\n {\n return '';\n }", "public function getSalt()\n {\n }", "public function getSalt()\n {\n }", "public function getSalt()\n {\n }", "public function getSalt()\n {\n }", "public function getSalt()\n {\n }", "public function getSalt()\n {\n }", "public function getSalt()\n {\n }", "public function getSalt()\n {\n }", "public function getSalt()\n {\n }", "public function getSalt()\n {\n }", "public function getSalt()\n {\n }", "public function getSalt()\n {\n }", "public function getSalt()\n {\n }", "public function getSalt()\n {\n }", "public function getSalt()\n {\n }", "public function getSalt()\n {\n }", "public function getSalt()\n {\n }", "public function getSalt()\n {\n }", "public function getSalt()\n {\n }", "public function getSalt()\n {\n }", "public function getSalt()\n {\n }", "public function getSalt()\n {\n }", "public function getSalt()\n {\n }", "public function getSalt()\n {\n }", "function getSalt(){return '';}", "public function getSalt(){\n return '';\n }", "public function getProfileSalt() {\n\t\treturn ($this->profileSalt);\n\t}", "public function getSalt()\n {\n\n }", "public function getSalt(): string\n {\n return '';\n }", "public function getSalt()\n {\n // Not Used (The project uses bcrypt algorithm\n }", "public function salt($name, $value): string {}", "public function getSalt()\n {\n // see section on salt below\n //return null;\n }", "private function generateSalt() {\n $salt = base64_encode(pack(\"H*\", md5(microtime())));\n \n return substr($salt, 0, $this->saltLng);\n }", "public function getSalt()\r\n {\r\n // see section on salt below\r\n return null;\r\n }", "public function getSalt()\n {\n // TODO: Implement getSalt() method.\n }", "function getSalt(){\n $inside = time() . \"az51\" . time(); \n $salt = '$2a$07$' . $inside . '$';\n return $salt;\n }", "public function getSalt()\n {\n // see section on salt below\n return null;\n }", "public function getSalt()\n {\n // see section on salt below\n return null;\n }", "public function getSalt()\n {\n // see section on salt below\n return null;\n }", "public function getSalt()\n {\n // see section on salt below\n return null;\n }", "public function getSalt()\n {\n // see section on salt below\n return null;\n }", "public function getSalt()\n {\n // see section on salt below\n return null;\n }", "public function getSalt()\n {\n // see section on salt below\n return null;\n }", "public function getSalt()\n {\n // see section on salt below\n return null;\n }", "public function getSalt()\n {\n // see section on salt below\n return null;\n }", "public function getSalt()\n {\n // see section on salt below\n return null;\n }", "public function getSalt()\n {\n // see section on salt below\n return null;\n }", "public function getSalt()\n {\n // see section on salt below\n return null;\n }", "public function getSalt()\n {\n // see section on salt below\n return null;\n }", "public function getSalt()\n {\n // see section on salt below\n return null;\n }", "public function getSalt()\n {\n // see section on salt below\n return null;\n }", "public function getSalt()\n {\n // see section on salt below\n return null;\n }", "public function getSalt()\n {\n // see section on salt below\n return null;\n }", "public function getSalt()\n {\n // see section on salt below\n return null;\n }", "public function getSalt()\n {\n // see section on salt below\n return null;\n }", "public function getSalt()\n {\n // see section on salt below\n return null;\n }", "public function getSalt()\n {\n // see section on salt below\n return null;\n }", "public function getSalt()\n {\n // attention si vous utilisez une méthode d'encodage différente !\n // il faudra décommenter les lignes concernant le salt, créer la propriété correspondante, et renvoyer sa valeur dans cette méthode\n return null;\n }", "public function getSalt() {\n // TODO: Implement getSalt() method.\n }", "public function getSalt()\n {\n // TODO: Implement getSalt() method.\n }", "public function getSalt()\n {\n // TODO: Implement getSalt() method.\n }", "public function getSalt()\n {\n // TODO: Implement getSalt() method.\n }", "public function getSalt()\n {\n // TODO: Implement getSalt() method.\n }", "public function getSalt()\n {\n // TODO: Implement getSalt() method.\n }", "public function getSalt()\n {\n // TODO: Implement getSalt() method.\n }", "public function getSalt()\n {\n // TODO: Implement getSalt() method.\n }", "public function getSalt()\n {\n // TODO: Implement getSalt() method.\n }", "public function getSalt()\n {\n // TODO: Implement getSalt() method.\n }", "public function getSalt()\n {\n // TODO: Implement getSalt() method.\n }", "public function getSalt()\n {\n // TODO: Implement getSalt() method.\n }", "public function getSalt()\n {\n // TODO: Implement getSalt() method.\n }", "public function getSalt()\n {\n // TODO: Implement getSalt() method.\n }", "public function getSalt()\n {\n // TODO: Implement getSalt() method.\n }" ]
[ "0.8461256", "0.8314373", "0.8239311", "0.8201459", "0.81311363", "0.81311363", "0.81311363", "0.81311363", "0.81311363", "0.81311363", "0.81311363", "0.81311363", "0.81311363", "0.81311363", "0.81311363", "0.81311363", "0.81043494", "0.81043494", "0.7928211", "0.79227775", "0.79123896", "0.7900092", "0.7895881", "0.789323", "0.7851988", "0.7851988", "0.7851988", "0.78328115", "0.78328115", "0.78328115", "0.78328115", "0.78328115", "0.78328115", "0.78328115", "0.78328115", "0.78328115", "0.78328115", "0.78328115", "0.78328115", "0.78328115", "0.78328115", "0.78328115", "0.78328115", "0.78328115", "0.78328115", "0.78328115", "0.78328115", "0.78328115", "0.78328115", "0.78328115", "0.78328115", "0.78172725", "0.7795549", "0.7785831", "0.7779956", "0.77395636", "0.77266705", "0.7723996", "0.7708675", "0.7697581", "0.7693932", "0.7622537", "0.7602793", "0.75682133", "0.75682133", "0.75682133", "0.75682133", "0.75682133", "0.75682133", "0.75682133", "0.75682133", "0.75682133", "0.75682133", "0.75682133", "0.75682133", "0.75682133", "0.75682133", "0.75682133", "0.75682133", "0.75682133", "0.75682133", "0.75682133", "0.75682133", "0.75682133", "0.75556284", "0.7534869", "0.753126", "0.753126", "0.753126", "0.753126", "0.753126", "0.753126", "0.753126", "0.753126", "0.753126", "0.753126", "0.753126", "0.753126", "0.753126", "0.753126" ]
0.8185183
4
accessor method for user hash return string value for user hash
public function getUserHash() { return $this->userHash; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getUserHash () {\n\t\treturn ($this->userHash);\n\t}", "public function getHash(): string;", "public function getHash(): string;", "public function getHash(): string;", "public function getHash(): string;", "public function getHash(): string\n {\n return $this->data->hash;\n }", "public function getHash() {}", "public function getUserProfileHash(): string {\n\t\treturn ($this->userProfileHash);\n\t}", "public function getHash();", "final public function getHash() {}", "public function hash(): string;", "public function getHash(){\n\t\treturn $this->name->getHash();\n\t}", "public function getHash()\n {\n return $this->hash;\n }", "public function getHash()\n {\n return $this->hash;\n }", "public function getHash()\n {\n return $this->hash;\n }", "public function getHash()\n {\n return $this->hash;\n }", "public function getHash()\n {\n return $this->hash;\n }", "public function getHash()\n {\n return $this->hash;\n }", "public function getHash()\n {\n return $this->getData(self::HASH);\n }", "public function hash() {\n\t\t$hash = parent::get('hash');\n\t\tif($hash) return $hash; \t\n\t\t$this->set('hash', md5($this->basename())); \n\t\treturn parent::get('hash'); \n\t}", "public function getHash()\n\t{\n\t\treturn $this->hash;\n\t}", "public function getUserIdentifier(): string\n {\n return (string)$this->key_hash;\n }", "public function getHash()\n\t{\n\t\treturn $this->_hash ;\n\t}", "public function getHash() {\n\t\treturn $this->Hash;\n\t}", "public function getHash() {\n\t\treturn sha1( serialize( $this->property ) );\n\t}", "public function getHashIdentifier() : string;", "public function getProfileHash() : string {\n\t\treturn $this->profileHash;\n\t}", "public function GetPasswordHash ();", "public function getHash()\n\t{\n\t\tif (!$this->hash)\n\t\t{\n\t\t\t$this->createHash();\n\t\t\t$this->getFromDB($this->hash);\n\t\t}\n\n\t\treturn $this->hash;\n\t}", "public function getProfileHash() {\n\t\treturn ($this->profileHash);\n\t}", "public function hash() {\n if(isset($this->cache['hash'])) return $this->cache['hash'];\n\n // add a unique hash\n $checksum = sprintf('%u', crc32($this->uri()));\n return $this->cache['hash'] = base_convert($checksum, 10, 36);\n }", "public function getHash($hash)\n {\n return $this->user->where('hash' , '=' , $hash)->first();\n }", "public function hash();", "public function getHash() {\n return md5($this->email . $this->getSalt() . $this->getPassword());\n }", "public function hash() {\r\n\t\t$cacheParams = explode(',',$this->cacheParams);\r\n\t\t$hash ='';\r\n\t\tforeach($cacheParams as $param) {\r\n\t\t\t$param = trim($param);\r\n\t\t\t$hash .= @$this->$param;\r\n\t\t}\r\n\t\treturn md5($hash);\r\n\t}", "public function hash()\n\t\t{\n\t\t\tif (!$this->hash) {\n\t\t\t\t$this->hash = md5($this->name.'-'.$this->size);\n\t\t\t}\n\n\t\t\treturn $this->hash;\n\t\t}", "public function generateHash()\n {\n $userContext = new UserContext();\n\n foreach ($this->providers as $provider) {\n $provider->updateUserContext($userContext);\n }\n\n $parameters = $userContext->getParameters();\n\n // Sort by key (alphanumeric), as order should not make hash vary\n ksort($parameters);\n\n return hash('sha256', serialize($parameters));\n }", "public function getPasswordHash() : string{\n \treturn $this->getConfig()->getAll()[\"passwordHash\"];\n }", "public function getHash() : string {\n\t\t// sha256 = 64 characters\n\t\treturn hash_hmac('sha256', $this->token, getenv('ENCRYPTION_KEY'));\n\t}", "public function getHash()\n {\n if (null === $this->_hash) {\n $this->_hash = md5(\n $this->getNumber() .\n $this->_string .\n $this->_message\n );\n }\n\n return $this->_hash;\n }", "public function hash($value);", "public function getHash(): string\n {\n return hash_hmac('sha256', $this->token, Config::SECRET_KEY);\n }", "public function hashID()\n {\n return $this->getCleanString(self::$_hash_id_clean);\n }", "public function getHash(): ?string\n {\n return $this->hash;\n }", "public function getHashedPassword(): string\n {\n return $this->getPassword();\n }", "public function getHash() /*: string*/ {\n if ($this->hash === null) {\n throw new \\Exception(\"Hash is not initialized\");\n }\n return $this->hash;\n }", "public function getHashSignedById(): string;", "public function getHash(): string\n {\n return $this->commitData['sha'];\n }", "public function info($hashedValue);", "private function getHash( $val, $log = false ) {\n\t\t$ret = '';\n\n\t\tif( $this->_debug == 1 && $log ) {\n\t\t\techo \"\\n\" . '## using hash method [' . $this->_param['hashMethod'] . ']' . \"\\n\";\n\t\t\techo \"\\n\" . 'values to calculate:' . \"\\n\";\n\t\t\techo $val;\n\t\t\techo \"\\n\";\n\t\t}\n\n\t\t// clean value from &amp;\n\t\t$val = str_replace( '&amp;', '&', $val );\n\t\t// calculate hash\n\t\t$ret = hash( $this->_param['hashMethod'], $val );\n\n\t\tif( $this->_debug == 1 && $log ) {\n\t\t\techo \"\\n\" . 'generated hash:' . \"\\n\";\n\t\t\techo $ret;\n\t\t\techo \"\\n\";\n\t\t}\n\n\t\treturn $ret;\n\t}", "final public function getHash(): string\n {\n return serialize([\n \\get_class($this),\n $this->acceptedExtension(),\n $this->getJsModule(),\n ]);\n }", "public function info($hashedValue)\n {\n\n }", "public function getHashedPassword(){\n\n // query the database to get the users password\n // database instance\n $db = database::getPDOobject();\n\n // query\n $checkUser = $db->prepare('SELECT `password` FROM `users` WHERE BINARY `user_name` = BINARY :userName LIMIT 1');\n $checkUser->bindParam(':userName',$this->username);\n $checkUser->execute();\n $encyptedPassword = $checkUser->fetch()['password'];\n\n return $encyptedPassword;\n}", "protected function calculateHash()\n {\n return md5((string)$this->toCookie());\n }", "function kernel_hash_handle($value) {\r\n\r\n return sprintf(\"%u\", crc32($value . HEX));\r\n\r\n}", "function hash()\n\t{\n\t\treturn sha1(time().serialize($this));\n\t}", "public function getHash()\n {\n\tif ( !$this->hash )\n\t{\n\t $array= array(\n\t $this->isPrimaryKey(),\n\t $this->isNullable(),\n\t $this->dbName,\n\t $this->getDefaultValue(),\n\t $this->getType(),\n\t get_class($this)\n\t );\n\t $this->hash= md5(implode('|', $array));\n\t}\n\treturn $this->hash;\n }", "public function hash($user_id = false)\r\n {\r\n // User Client HASH\r\n $user_ip = $_SERVER['REMOTE_ADDR'];\r\n if (!$user_id) {\r\n if (isset($_SESSION['uid'])) {\r\n $user_id = $_SESSION['uid'];\r\n }\r\n }\r\n $hash = md5($user_ip . $user_id); // Simple hash!\r\n return $hash;\r\n }", "protected function generateHash() {\r\n\t\t$relevantData = array('company','country','firstname','lastname','jobstatus');\r\n\t\tforeach($relevantData as $relevantField) {\r\n\t\t\t$getterMethod = 'get_'. ucfirst($relevantField);\r\n\t\t\t$badgeDataString = '';\r\n\t\t\t\r\n\t\t\tif(method_exists($this, $getterMethod)) {\r\n\t\t\t\t$badgeDataString .= $this->$getterMethod();\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\treturn md5($badgeDataString);\r\n\t}", "public function generateHash()\n {\n do {\n $hash = Security::randomString(8);\n } while ($this->exists(['hash' => $hash]));\n\n return $hash;\n }", "public function getHashAttribute()\n {\n return Hashids::encode($this->attributes['id']);\n }", "protected function getHash(): string\n {\n return hash('crc32', md5((string) mt_rand()));\n }", "public function getHashUnused()\n\t{\n\t\tif (!$this->isUsed())\n\t\t{\n\t\t\t$this->unused = static::getByDomain($this->domain, $this->user);\n\t\t\treturn $this->unused->getHash();\n\t\t}\n\n\t\treturn $this->getHash();\n\t}", "public function hashValidation(){\n\t\t$this->hash_validation = md5(uniqid(rand(), true).$this->email); \n\t\treturn $this->hash_validation;\n\t}", "function DataHash(){\n return($this->data);\n }", "public function __toString(): string\n {\n return $this->getHash();\n }", "static function setHashedValue($value) {\n $length = strlen($value);\n $middle = ($length / 2);\n if ($middle > 0) {\n $value1 = substr($value, 0, $middle - 1);\n $value2 = substr($value, $middle, $length - 1);\n $hashedvalue = sha1('2@!' . md5($value1) . $value2 . 'o&#');\n } else {\n $hashedvalue = sha1('2@!' . md5($value . 'o&#'));\n }\n return $hashedvalue;\n }", "static function controlHash($mixed){\n\t\t$data = json_encode($mixed);\n\t\tif(json_last_error()!=JSON_ERROR_NONE) $data = $mixed;\n\t\treturn sha1(md5($data).APP_CONTROL_SECRET);\n\t}", "function getActivationHash(){\n\t\tif(!isset($this->id)){\n\t\t\treturn false;\n\t\t}else{\n\t\t\treturn substr(Security::hash(Configure::read('Security.salt') . $this->field('signup_date') . date('Ymd')), 0, 8);\n\t\t}\n\t}", "private function hashing() {\n\t\t$data = md5($this->name.$this->date);\n\t\t$data = md5($data);\n\t\t$data = strrev($data);\n\t\t//$data = md5($data);\n\t\t$data = strtoupper($data);\n\t\t//$data = strrev($data);\n\n\t\t$datatemp = NULL;\n\t\tfor($i=0; $i<=strlen($data); $i++) {\n\t\t\t$arr = substr($data, $i, 1);\n\t\t\tif($i == '4' || $i == '8' || $i == '12' || $i == '16' || $i == '20' || $i == '24' || $i == '28' || $i == '32') {\n\t\t\t\t$datatemp .= substr($this->strfinger, ($i/4)-1, 1);\t\n\t\t\t}\n\t\t\t$datatemp .= \"/%\".$this->combine[$arr];\n\t\t}\n\n\t\t$this->resulthashcode = substr($datatemp, 1, strlen($datatemp)-6);\n\t\t$this->result = true;\n\t}", "public function computeHash()\n {\n $this->setLastnamecanonical($this->lastname);\n $this->setFirstnamecanonical($this->firstname);\n\n $this->hash = sha1(\n $this->firstnameCanonical.\n $this->lastnameCanonical.\n (($this->birthdate instanceof \\DateTime) ? $this->birthdate->format('Y-m-d') : '')\n );\n\n return $this->hash;\n }", "private function userForAuth($hash){\n\n }", "public function hashCode(): string;", "public function hashString(){ return $this->ulA->db->ID . \"_\" . $this->ulA->ID . \"_\" . $this->ulB->db->ID . \"_\" . $this->ulB->ID; }", "public function getSharedSecretHash()\n {\n return isset($this->shared_secret_hash) ? $this->shared_secret_hash : '';\n }", "public function getHash()\n {\n return md5($this->template);\n }", "public function getHash()\n {\n return md5($this->template);\n }", "function CreateUserHash() {\n// if (isset($_SERVER['REMOTE_ADDR'])) $remAd = $_SERVER['REMOTE_ADDR'];\n// else $remAd = NULL;\n// if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) $forvFor = $_SERVER['HTTP_X_FORWARDED_FOR'];\n// else $forvFor = NULL;\n if (isset($_SERVER['HTTP_USER_AGENT']))\n $userAgent = $_SERVER['HTTP_USER_AGENT'];\n else\n $userAgent = NULL;\n if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE']))\n $accLang = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']);\n else\n $accLang = NULL;\n// if (isset($_SESSION['session_id'])) $sesId = $_SESSION['session_id'];\n// else $sesId = NULL;\n // обработка локали\n if ($accLang) {\n if (is_array($accLang))\n $accLang = $accLang[0];\n $pattern = '/^(?P<primarytag>[a-zA-Z]{2,8})' .\n '(?:-(?P<subtag>[a-zA-Z]{2,8}))?(?:(?:;q=)' .\n '(?P<quantifier>\\d\\.\\d))?$/';\n $splits = array();\n preg_match($pattern, $accLang, $splits);\n $accLang = $splits['primarytag'];\n }\n\n //echo '<br>$remAd='.$remAd.' $forvFor='.$forvFor.' $userAgent='.$userAgent.' $accLang='.$accLang;\n return md5($userAgent . $accLang);\n //return md5($remAd.$forvFor.$userAgent.$accLang.$sesId);\n }", "public function GetPasswordHash() {\n return $this->passwdHash;\n }", "protected function getFrontendUserByHash()\n {\n return $this->frontendUserByHash;\n //===\n }", "public function hash()\n {\n return $this->adapter->md5File($this->path);\n }", "public function getHashSum()\n {\n return $this->hashSum;\n }", "final public function computeHash()\n {\n return md5(serialize([\n $this->sql,\n $this->values,\n $this->safe,\n $this->usePlaceholders,\n ]));\n }", "public function getHash()\n {\n return sprintf(\n '%s::%s::%s',\n $this->package,\n $this->class,\n $this->method\n );\n }", "public function getRHash()\n {\n return $this->r_hash;\n }", "function hash_check($value, $name = 'user') {\n return self::data_get($name) === $value;\n }", "public function __toString(): string\n {\n return (string) $this->getHash();\n }", "function my_hash($string, $username = null) {\r\n\t\t$salt = getStoredSalt($username);\r\n\t\tif (!$salt) {\r\n\t\t\t// generate the salt and store it in the database\r\n\t\t\t$salt = substr(md5(uniqid(rand(),true)),0,24);\r\n\t\t\tstoreSalt($username, $salt);\r\n\t\t}\r\n\t\treturn sha1($salt . $string);\r\n\t}", "public function hashCode() : string;", "public function getIdHash() {\n return encrypt( [ 'id' => $this->id ] );\n }", "public function getHashedPassword()\n {\n return $this->password;\n }", "protected function getHashMethod()\r\n {\r\n return $this->processor_data['processor_params']['hash_method'];\r\n }", "public function _hash($str) {\n switch ($this->config['algoritmo_criptografia']) {\n case 'sha1':\n return ($str == '') ? '' : sha1($str);\n break;\n case 'crypt':\n return crypt($str);\n break;\n case 'base64':\n return base64_encode($str);\n break;\n case 'plain':\n return $str;\n break;\n case 'md5':\n default:\n return md5($str);\n break;\n }\n }", "public static function getHash($value)\n {\n return self::sha1($value);\n }", "public function rpIdHash(): string\n {\n return $this->rpIdHash;\n }", "abstract protected static function getHashAlgorithm() : string;", "public function updateShaPassHashColumn($value)\n {\n if(!empty($value)) $value = sha1(strtoupper($this->getValue('username')).':'.strtoupper($value));\n return $value;\n }", "function getHashedPassword($pass){\n\t\t$newhashed= password_hash($pass,PASSWORD_DEFAULT);\n\t\treturn $newhashed;\n\t}", "function GetNameForHash($hash){\n $hash_array = parse_ini_file(\"Hashes.txt\");\n return $hash_array[$hash];\n }" ]
[ "0.8028743", "0.7707053", "0.7707053", "0.7707053", "0.7707053", "0.75919485", "0.75532067", "0.7483532", "0.74392074", "0.73901093", "0.73729867", "0.73458886", "0.7148322", "0.7148322", "0.7148322", "0.7148322", "0.7148322", "0.7148322", "0.7096966", "0.7086114", "0.707928", "0.70197177", "0.7009274", "0.69567573", "0.6936514", "0.6912702", "0.6891738", "0.6817812", "0.6774695", "0.6752081", "0.6749461", "0.66747713", "0.6663879", "0.6662244", "0.6652569", "0.66305655", "0.66127723", "0.6599086", "0.6578347", "0.6561595", "0.65245354", "0.65213495", "0.6519622", "0.64838034", "0.64817524", "0.6474154", "0.6451348", "0.644978", "0.6424321", "0.6410509", "0.63805383", "0.63644314", "0.6333766", "0.6333218", "0.6330235", "0.63295007", "0.63250256", "0.6317247", "0.63156843", "0.63048035", "0.63001007", "0.6297058", "0.62869644", "0.62780875", "0.6267182", "0.6262778", "0.6256933", "0.62384677", "0.6237055", "0.62335706", "0.62328285", "0.6221075", "0.6218096", "0.6204767", "0.62021005", "0.62006295", "0.62006295", "0.61961704", "0.6191632", "0.6153152", "0.6142709", "0.61344373", "0.6133948", "0.61318403", "0.6131117", "0.61301947", "0.6126343", "0.6126282", "0.61247915", "0.608911", "0.60852665", "0.60833234", "0.60720444", "0.6056706", "0.6055013", "0.6045384", "0.6030362", "0.60274506", "0.60266346" ]
0.7747304
2
Kita load dulu ya databasenya :)
public function __construct(){ parent::__construct(); $this->load->model('M_main','main'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function loadFromDB()\n {\n }", "private function _load_db()\n {\n $json_string = file_get_contents(\"dbtv.json\");\n $this->_db = json_decode($json_string, true);\n $this->_ep_list = $this->_flatten_episodes();\n }", "private function _load_db()\n {\n $json_string = file_get_contents(\"dbmov.json\");\n $this->_db = json_decode($json_string, true);\n }", "public function loadDatabase(){\n $table = new Table('Textarea_Widgets');\n $table->add_column('Title', 'text');\n $table->add_column('Content', 'text');\n $table->add_column('WidgetName', 'text');\n $table->create();\n }", "protected function importDatabaseData() {}", "abstract protected function load(Connection $db);", "public function load()\n {\n $pdo = $this->getDbConnection();\n $query = \"SELECT * FROM {$this->dbTable}\";\n $data = $pdo->query($query)->fetchAll(\\PDO::FETCH_ASSOC);\n\n foreach ($data as ['key' => $key, 'value' => $value]) {\n $this->setData($key, $value);\n }\n }", "private function load()\r\n {\r\n $this->dbFields = MySQL::fetchRecord(MySQL::executeQuery('SELECT * FROM training_slideshow WHERE ts_id='.(int)$this->id),MySQL::fmAssoc);\r\n }", "public function load();", "public function load();", "public function load();", "public function load();", "public function load();", "public function load();", "public function load();", "public function load();", "public function load();", "public function load();", "public function load();", "public function load();", "public function load();", "protected function load_database()\n\t{\n\t\t$this->db= load_class(\"DB\", 'database');\n\t}", "abstract public function loadData();", "function load_tables()\n\t{\n\t\treturn $this->_load_tables('/mydoliboard/sql/');\n\t}", "public function load() { }", "abstract function loadDbData($compid);", "function load_tables() {\n return $this->_load_tables('/oblyon/sql/');\n }", "public function database();", "public function load() {\n $CI =& get_instance();\n\n $CI->db = $CI->load->database('default', TRUE);\n $CI->db_akbar = $CI->load->database('db_akbar', TRUE);\n }", "public function getFromDB() {}", "protected function loadExtLocalconfDatabaseAndExtTables() {}", "public function getDb();", "function MetaDatabases() {}", "private static function initDB(){\n //otvori subor casopis.conf\n $file=fopen(\"casopis.conf\", \"r\",true);\n if(!$file)\n die (\"Nemozem otvorit subor\");\n \n $temp=\"\";\n $id=\"\";\n \n $server=\"\";\n $login=\"\";\n $password=\"\";\n $database=\"\";\n \n //nacitanie konfiguracneho suboru\n \n while(!feof($file)){\n $temp= fgets($file);\n \n //odstranenie bielych znakov zo zaciatku a konca riadku\n $temp=trim($temp);\n //odignoruje prazdne riadky a riadky obsahujuce znak #\n if(strstr($temp,\"#\"))\n continue;\n if(!strcmp($temp, \"\"))\n continue; \n \n list($id,$temp)=explode(\": \", $temp);\n $id=trim($id);\n $temp=trim($temp);\n \n //nastavi premenne server,login, password a database podla hodnot konfiguracneho suboru\n if(!strcmp($id, \"server\")){\n $server=$temp;\n continue;\n }\n if(!strcmp($id,\"login\")){\n $login=$temp;\n continue;\n }\n if(!strcmp($id, \"psswd\")){\n $password=$temp;\n continue;\n }\n if(!strcmp($id,\"dbase\")){\n $database=$temp;\n continue;\n }\n \n }\n fclose($file);\n \n //vytvori instanciu triedy.\n static::$default_database=new CDatabaza($server, $login, $password, $database);\n if(!static::$default_database->connected)\n static::$default_database=null;\n else\n static::$default_database->connected=false;\n \n }", "function we_load($from=LOAD_MAID_DB){\n\t\twe_binaryDocument::we_load($from);\n\t}", "function loadFromDatabase(){\n global $DB;\n $resource = $DB->config->get();\n $list = array();\n while($row = $DB->fetchAssoc($resource))\n {\n if(!isset($this->sections[$row['section']])) $this->sections[$row['section']] = new ConfigSection($row['section']);\n $this->sections[$row['section']]->registerFromDatabase($row);\n }\n }", "private function initDatabase() {\n \n \n \n }", "function import_data() {\n\t\t$sync_tables = $this->config->item('sync_tables');\n\n\t\t$this->db_tools->import_data( $sync_tables );\n\t\t$this->db_tools->echo_import_data();\n\t}", "public function load($data);", "private function connect() {\n $this->load->database();\n }", "protected function load()\n\t{\n\t\t//---------------------\n\t\t// Your code goes here\n\t\t// --------------------\n\t\t// rebuild the keys table\n\t\t$this->reindex();\n\t}", "public function load()\n {\n }", "public function load()\n {\n }", "function load() {\n\t\tglobal $mysql;\n //if(!$this->exists()) return;\n \t$id \t\t= $mysql->escape($this->id);\n \t$tablename \t= $this->class_name();\n \t$this->data = $mysql->executeSql(\"SELECT * FROM \".$tablename.\" WHERE id=$id;\");\n \t$this->id\t= $this->data['id'];\n \tunset($this->data['id']);\n }", "public function load()\n {\n }", "public function load()\n {\n }", "public function load()\n {\n }", "public function load()\n {\n }", "public function load()\n {\n }", "public function readDatabase() {\n\t\t$q = $this->pdo->query(\"SELECT count(*) FROM `Articles`\");\n\t\t$count = $q->fetch(PDO::FETCH_ASSOC)[\"count(*)\"];\n\t\t$numFetched = 0;\n\t\t$start = 0;\n\t\t// Fetch only 50 articles at a time to limit the memory impact\n\t\twhile($numFetched < $count){\n\t\t\t$q = $this->pdo->query(\"SELECT \".$this->columns.\" FROM `Articles` LIMIT $start,100\");\n\t\t\tforeach($q->fetchAll(PDO::FETCH_ASSOC) as $a){\n\t\t\t\t$this->articles[] = $this->makeArticleFromDB($a);\n\t\t\t\t$numFetched += 1;\n\t\t\t}\n\t\t\t$start += 100;\n\t\t}\n\t}", "function use_db($data1){\n\t\tglobal $i18n_std;\n\t\tif(!$this->real_select($data1)){\n\t\t\techo('no db connection:'.$data1.' ('.$this->real_error().') engine='.$this->engine_name);\n\t\t\t//.'cwd='.getcwd()\n\t\t\tdie('');\n\t\t}\n\t}", "public function load(): void;", "public function load(): void;", "public abstract function load();", "abstract public function load();", "abstract public function load();", "function load(){\n $sql = 'SELECT * FROM worlds where id=?';\n $w = $this->app['db']->fetchAssoc($sql, array($this->id));\n if(!$w){ \n return false;\n }\n $this->name = $w['name'];\n $this->world = $w['world_json'];\n return true;\n }", "public function loadById($id){\n\t\t$sql = new Sql();\n\n\t\t$results = $sql->select(\"SELECT * FROM TB_USUARIOS WHERE IDUSUARIO = :ID\",array(':ID'=>$id));\n\t\t\n\t\tif (isset($results[0])) {\n\n\t\t\t$this->setData($results[0]);\n\t\t}\n\t}", "function getDatabase();", "public function load($id){\n\t\t$sql = 'SELECT * FROM cbt_jadwal_ujian WHERE id_jadwal = ?';\n\t\t$sqlQuery = new SqlQuery($sql);\n\t\t$sqlQuery->setNumber($id);\n\t\treturn $this->getRow($sqlQuery);\n\t}", "protected function getDatabase() {}", "public function load()\n\t{\n\t\t$this->list_table->load();\n\t}", "function serendipity_installDatabase() {\n global $serendipity;\n\n $queries = serendipity_parse_sql_tables(S9Y_INCLUDE_PATH . 'sql/db.sql');\n $queries = str_replace('{PREFIX}', $serendipity['dbPrefix'], $queries);\n\n foreach ($queries as $query) {\n serendipity_db_schema_import($query);\n }\n\n if (file_exists(S9Y_INCLUDE_PATH . 'sql/preload.sql')) {\n $queries = serendipity_parse_sql_inserts(S9Y_INCLUDE_PATH . 'sql/preload.sql');\n $queries = str_replace('{PREFIX}', $serendipity['dbPrefix'], $queries);\n foreach ($queries as $query) {\n serendipity_db_schema_import($query);\n }\n }\n}", "public function loadMySql(){\n\t\t$this->sql = new MySql;\n\t\treturn $this->sql->connectToMySql();\n\t}", "public function getDataWithTypeDb() {}", "public function loadDB($location){\n\t\t\t$fn = \"loadDB\";\n\t\t\tif(is_file($location .\".json\")){\n\t\t\t if(!isset($this->db)){\n\t\t\t\tif($f = fopen($location .\".json\", \"r\")){\n\t\t\t\t\t$js = fread($f, filesize($location .\".json\"));\n\t\t\t\t\tfclose($f);\n\t\t\t\t\t$this->db = json_decode($js, true);\n\t\t\t\t\t$this->created = true;\n\t\t\t\t\treturn true;\n\t\t\t\t} else {\n\t\t\t\t\tself::printErr($fn, \"Error loading file \". $location);\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t } else {\n\t\t\t self::printErr($fn, \"DB is already set\");\n\t\t\t return false;\n\t\t\t }\n\t\t\t} else {\n\t\t\t\tself::printErr($fn, $location .\" is NOT a file.\");\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}", "public function connectToDB() {}", "protected function loadData(){\n\t\t//SELECT from \".self::TABLE_NAME.\"_data WHERE \".self::TABLE_NAME.\"_id=\".$this->id.\"\n\t\t\n\t\t//return the data\n\t\treturn array();\n\t}", "function configure_db() {\n //Old data is deleted before adding the new db structure\n $db = DB::getInstance();\n //$file = new File(CORE_INSTALLER_FILES_PATH.'/db/init.sql', 'r');\n if(!$db->query(file_get_contents(CORE_INSTALLER_FILES_PATH.'/db/init.sql'))->error()) {\n return true;\n }\n return false;\n}", "public function __construct(){\n $this->load->database();\n }", "private function Load()\n\t{\n\t\t$sql = \"show tables\";\n\t\t$rs = $this->Server->Connection->Select($sql);\n\t\t\n\t\t// first pass load all the tables. this will initialize each object. we have to\n\t\t// do this first so that we can correctly determine and store \"Set\" information\n\t\twhile ($row = $this->Server->Connection->Next($rs))\n\t\t{\n\t\t\t$this->Tables[$row[\"Tables_in_\" . $this->Name]] = new DBTable($this,$row);\n\t\t}\n\t\t\n\t\t// now load all the keys and constraints for each table\n\t\tforeach ($this->Tables as $table)\n\t\t{\n\t\t\t$table->LoadKeys();\n\t\t}\n\n\t\t$this->Server->Connection->Release($rs);\n\t\t\n\t\t$sql = \"show table status from `\" . $this->Name . \"`\";\n\t\t$rs2 = $this->Server->Connection->Select($sql);\n\t\t\n\t\t// load the extra data\n\t\twhile ($row = $this->Server->Connection->Next($rs2))\n\t\t{\n\t\t\t$this->Tables[$row[\"Name\"]]->Engine = $row[\"Engine\"]; \n\t\t\t$this->Tables[$row[\"Name\"]]->Comment = $row[\"Comment\"];\n\t\t}\n\t\t$this->Server->Connection->Release($rs2);\n\t}", "public function loadData(){\r\n\t\t\t $pseudo = addslashes($this -> getPseudo()) ;\r\n\r\n\t\t if(! empty($pseudo)){\r\n\t\t\t$q = \"select * from UserTab where User_pseudo='\".$pseudo.\"'\";\r\n\t\t\t$r = execute($q);\r\n\t\t\twhile( $l = mysql_fetch_assoc($r) ){\r\n\t\t\t\t$this -> setFields($l);//Affectation aux champs de l'objet UserTab \r\n\t\t\t}\r\n\t\t }\r\n\r\n\t }", "abstract protected function load();", "abstract protected function load();", "abstract protected function load();", "abstract protected function load();", "public function __construct() {\n parent::__construct();\n\n //kapcsolódás a db-hez:\n $this->db = db_connect();\t//\\Config\\Database::connect();\n $this->builder = $this->db->table(\"feladatok\");\n\n }", "public function open(){\n $this->load->database();\n }", "public function __construct(){\n //autoloading\n $this->db = new \\Konekta();\n\n }", "public function __load();", "abstract public function loadAll();", "public function admin_load()\n {\n }", "function load() {\n\n\t}", "function loadData() {\n\t\t$connection = createConnection();\n\n\t\t$loggedIn = Login::checkToken($connection);\n\t\tif (!$loggedIn){\n\t\t\treturn FALSE;\n\t\t}\n\t\t\n\t\t# Set any cookies to null to prevent the 'stuck logged in' bug\n\t\tLogin::removeSessionToken($connection);\n\n\t\techo(\"<h1>Connecting to database.</h1>\");\n\t\t# If there is no connection made we can quit, as there is an error\n\t\tif (!$connection) {\n\t\t\tdie(\"Connection failed: \" . mysqli_connect_error());\n\t\t}\n\t\techo \"Connected successfully\";\n\t\t\n\t\t# Let's import our database file\n\t\t$fileName = \"./data/orderdb_sql.ddl\";\n\t\t# Import the data from the file\n\t\t$file = file_get_contents($fileName, true);\n\t\t# Create an array of all of the file contents\n\t\t$lines = explode(\";\", $file);\n\t\techo(\"<p>\"+$lines[0]+\"</p>\");\n\n\t\techo(\"<ol>\");\n\t\t# For each line in the file\n\t\tforeach ($lines as $line){\n\t\t\t# Trime the line\n\t\t\t$line = trim($line);\n\t\t\t# As long as the line isn't blank\n\t\t\tif($line != \"\"){\n\t\t\t\t# Print it out in a list\n\t\t\t\techo(\"<li>\".$line . \";</li><br/>\");\n\t\t\t\t# Run a query on the line\n\t\t\t\t$result = $connection->query($line);\n\t\t\t\tif($result == FALSE){\n\t\t\t\t\tprintf(\"error: %s\\n\", $connection->error);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t# Finally let's close this connection\n\t\t$connection->close();\n\t\techo(\"</p><h2>Database loading complete!</h2>\");\n\t\treturn TRUE;\n\t}", "public function initDatabaseStructure( );", "public function loadData(){\r\n $this->host = Team::find($this->host);\r\n $this->guest = Team::find($this->guest);\r\n $this->winner = Team::find($this->winner);\r\n $this->tournament = Tournament::find($this->tournamentID); \r\n }", "function load_from_database () : bool {\n $db = $this->getDatabase();\n\n $id = $db->escape($this->id);\n $sql = \"SELECT * FROM content_files WHERE content_id = '\" . $id . \"'\";\n if ( !($result = $db->query($sql)) ) {\n message_die(SQL_ERROR, \"Unable to query content\", '', __LINE__, __FILE__, $sql);\n }\n if (!$row = $db->fetchRow($result)) {\n $this->lastError = \"Content unknown: \" . $this->id;\n return false;\n }\n $this->load_from_row($row);\n return true;\n }", "public function settaDB()\n {\n include \"MySqlClass.php\";\n // istanza della classe\n $this->database = new MysqlClass();\n }", "public function __construct()\n { // langsung connect ke class databasenya.\n $this->db = new Database(); // instansiasi kelas database.\n }", "public function getDataStore();", "public function admin_get_dbs() {}", "public function loadDataFromId(){\r\n\t\t\t$this -> loadFromId();\r\n\t }", "function cl_ing_ingreso_det() {\r\n\r\n $this->database = new Database();\r\n }", "public function loadModuleData() {}", "abstract protected function initDB();", "public function load($id){\n\t\t$sql = 'SELECT * FROM ano_letivo WHERE id = ?';\n\t\t$sqlQuery = new SqlQuery($sql);\n\t\t$sqlQuery->setNumber($id);\n\t\treturn $this->getRow($sqlQuery);\n\t}", "function selecnarDB()\n\t{\n\t\tmysql_select_db($this->dataBase) or die(mysql_error());\t\n\t}", "public function database() {\n\t\t$this->_check();\n\t\t$d['title_for_layout'] = __(\"Database creation\");\n\t\t$this->set($d);\n\t}", "function readDB() {\n\n\t\t// READ FROM MYSQL, kh_mod 0.3.0, add\n\t\treturn ($this->sqldatabase)?\n\t\t\t\t $this->readDBSQL()\n\t\t\t\t :\n\t\t\t\t $this->readDBFlatfile();\n\t}", "public function __invoke(): LoadsTables;", "function database_load_all()\n {\n if( !is_resource($this->_last_resource) )\n {\n return FALSE;\n }\n \n $resource = $this->_last_resource;\n $return_data = array();\n while( $data = $this->database_fetch_assoc($resource) )\n {\n $return_data[] = $data;\n }\n \n return $return_data;\n\t}" ]
[ "0.7327086", "0.72397345", "0.7210502", "0.6856963", "0.6718843", "0.64502835", "0.63555765", "0.63495845", "0.63107777", "0.63107777", "0.63107777", "0.63107777", "0.63107777", "0.63107777", "0.63107777", "0.63107777", "0.63107777", "0.63107777", "0.63107777", "0.63107777", "0.63107777", "0.6308469", "0.629831", "0.6269145", "0.6245264", "0.62440354", "0.62197745", "0.61880785", "0.616691", "0.61201227", "0.6094585", "0.60471493", "0.6045877", "0.6028669", "0.6012071", "0.5981965", "0.5981625", "0.5973609", "0.59312135", "0.5897745", "0.58787763", "0.5878104", "0.5878104", "0.5842828", "0.58397233", "0.58397233", "0.58397233", "0.58395743", "0.5838122", "0.58381176", "0.582432", "0.5814552", "0.5814552", "0.58009577", "0.5744662", "0.5744662", "0.5733859", "0.5727275", "0.5726065", "0.5724971", "0.5722813", "0.57094896", "0.5681481", "0.56809527", "0.5674607", "0.5669244", "0.5662686", "0.5652047", "0.5641402", "0.56135184", "0.5608491", "0.56059945", "0.5599261", "0.5599261", "0.5599261", "0.5599261", "0.5595101", "0.55892676", "0.5586581", "0.5573625", "0.55713177", "0.55656743", "0.55594987", "0.55567336", "0.55560595", "0.5554668", "0.55431527", "0.55361027", "0.55354637", "0.55292255", "0.5523477", "0.5496651", "0.5492235", "0.54895496", "0.5487903", "0.5487271", "0.5483918", "0.5467701", "0.5466249", "0.54564375", "0.5454999" ]
0.0
-1
Disini kita manual untuk penentuan materinya :D
public function index(){ $data['materi'] = $this->ListMateri(); $this->load->view('main',$data); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function masodik()\n {\n }", "public function AggiornaPrezzi(){\n\t}", "public function konfig(){\n\t\t$data['title'] \t\t= \"Konfigurasi Umum\";\n\t\t$data['konfig'] \t= $this->model_konfig->tampil()->row_array();\n\n\t\t$this->view('admin/konfigurasi/kUmum.php', $data, FALSE);\n\t}", "public function edit_kuota_matkul_pilihan(){\n\t\t$sql = $this->m_aka->edit_kuota_matkul_pilihan();\n\n\t}", "function data_mhs(){\r\n\t\t\techo \"KodeMataKuliah : \".$this->KodeMataKuliah.\"<br />\";\r\n\t\t\techo \"SKS : \".$this->SKS.\"<br />\";\r\n\t\t\techo \"Daftar matakuliah yang diambil:<br />\";\r\n\t\t\t\r\n\t\t\t$i = 0; // nomor urut daftar SKS matakuliah yang diambil\r\n\t\t\tforeach($this->NamaMataKuliah as $mk){\r\n\t\t\t\techo ++$i.\". \".$mk.\"<br />\";\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t// Cuma buat ganti baris aja kok :-)\r\n\t\t\techo \"<br />\";\r\n\t\t}", "function rekamMedis($nomor_pasien)\n\t{\n\n\t}", "function index()\n\t{\n\t\t$data['hardware'] = $this->Mhardware->tampil_hardware();\n\t\t//mengambil data dari fungsi tampil_departemen\n\t\t$data['departemen'] = $this->Mdepartemen->tampil_departemen();\n\t\t\n\t\t$data['judul'] = \"Tabel Aset Kantor\";\n\t\t$this->theme->set_ui(\"admin/tampilhardware\", $data);\n\t}", "function berinamateman($teman){\n\t\t$this->nama_teman=$teman;\n\t}", "function berinamateman ($teman) {\n $this->nama_teman=$teman;\n }", "public function isi_t_kuota_matkul_pilihan(){\n\t\t$kode = $this->uri->segment(3);\n\t\t$data['data']= $this->m_aka->isi_t_edit_kuota_matkul_pilihan();\t\t\n\t\t$data['kelas'] = $this->m_aka->kelas();\t\t\n\t\t$data['content'] = 'mata_kuliah/isi_kuota_mata_kuliah_pilihan';\n\t\t$this->load->view('content',$data);\t\t\n\t}", "function pemeriksaan($nomor_pasien)\n\t{\n\t\t$data['pasien'] = $this->Kesehatan_M->read('pasien',array('nomor_pasien'=>$nomor_pasien))->result();\n\t\tif ($data['pasien'] != array()) {\n\t\t\t$data['rekam_medis'] = $this->Kesehatan_M->read('rekam_medis',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tarray('nomor_pasien'\t\t=>\t$nomor_pasien,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'MONTH(tanggal_jam)'=>\tdate('m'),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'YEAR(tanggal_jam)'\t=>\tdate('Y'),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'DAY(tanggal_jam)'\t=>\tdate('d')\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t))->result();\n\t\t\t$this->load->view('static/header');\n\t\t\t$this->load->view('static/navbar');\n\t\t\t$this->load->view('dokter/pemeriksaan',$data);\n\t\t\t$this->load->view('static/footer');\n\t\t}else{\n\t\t\t$this->load->view('static/header');\n\t\t\t$this->load->view('static/navbar');\n\t\t\t$data['heading']\t= \"Halaman tidak ditemukan\";\n\t\t\t$data['message']\t= \"<p> Klik <a href='\".base_url().\"Dokter/index'>disini </a>untuk kembali melihat daftar pasien yang sedang antri</p>\";\n\t\t\t$this->load->view('errors/html/error_404',$data);\n\t\t}\n\t}", "public function mata_kuliah_jurusan(){\n\t\t\t$data['content'] = \"mk_jurusan/mata_kuliah_jurusan\";\n\t\t\t$mk = \"t_mk\";\n\t\t\t$data['mk'] = $this->m_aka->get_all($mk);\n\t\t\t$this->load->view(\"content\", $data);\n\t\t}", "public function prosesinput_detail_matkul_dosen(){\n\t\t$this->m_aka->prosesinput_detail_matkul_dosen();\n\t\tredirect('c_index_aka/data_dosen');\n\t}", "public function form_cari_nik_ubah_kata_sandi_kades()\n {\n\n $data['admin'] = $this->db->get_where('admin', ['id_admin' =>\n $this->session->userdata('id_admin')])->row_array();\n $data['jumlah_pesan_masuk'] = $this->m_admin->jumlah_pesan_masuk()->result();\n $data['jumlah_permohonan_masuk'] = $this->m_admin->jumlah_permohonan_masuk()->result();\n $data['jumlah_pesan_masuk'] = $this->m_admin->jumlah_pesan_masuk()->result();\n\n $this->load->view('header');\n $this->load->view('admin/sidebar_admin');\n $this->load->view('topbar', $data);\n $this->load->view('admin/form_cari_nik_ubah_kata_sandi_kades');\n $this->load->view('footer');\n }", "function ToonFormulierAfspraak()\n{\n\n}", "public function kawasan()\n {\n $data = ['aktif' => 'kawasan',\n 'data_kws' => $this->M_prospektus->get_data_kawasan()->result_array()\n ];\n\n $this->template->load('template', 'prospektus/V_kawasan', $data);\n }", "private function najitNavstevu(){\n $this->tpl = \"konec-navstevy\";\n }", "public function data_matkul(){\n\t\t$tahun = \"t_tahun_akademik\";\n\t\t$mk = \"t_mk\";\n\t\t$data['content'] = \"report/matkul\";\n\t\t$data['data_tahun'] = $this->m_aka->get_all($tahun);\n\t\t$data['mk'] = $this->m_aka->get_all($mk);\n\t\t$this->load->view(\"content\", $data);\n\t}", "static function definisiMeni(){\n\t\t $stavke[0]=array('naziv'=>'home','link'=>'/pilot/home');\n\t\t $stavke[1]=array('naziv'=>'o nama','link'=>'/pilot/onama');\n\t\t if(session_id()!='pilot1sesija1'){\n\t\t\tsession_id('pilot1sesija1');\n\t\t\tsession_start();\n\t\t }\n\t\t if(isset($_SESSION['pravo'])){\n\t\t\t if($_SESSION['pravo']==1 || $_SESSION['pravo']==2){ \n\t\t\t\t$stavke[2]=array('naziv'=>'clanci','link'=>'/pilot/clanci'); \n\t\t\t\t$stavke[3]=array('naziv'=>'korisnici','link'=>'/pilot/korisnici'); \n\t\t\t }\n\t\t \n\t\t }\n\t\t return $stavke;\n\t}", "function tampil_bentuk_sedia(){\n $data['login'] = 'Halaman Login';\n $data['title'] = 'Kelola Satuan Sedia';\n $data['query'] = $this->m_barang->tampil_satuan_sedia();\n $this->template->load('static','barang/satuan/satuansedia', $data);\n }", "public function form_cari_nik_ubah_kata_sandi_rt()\n {\n\n $data['admin'] = $this->db->get_where('admin', ['id_admin' =>\n $this->session->userdata('id_admin')])->row_array();\n $data['jumlah_pesan_masuk'] = $this->m_admin->jumlah_pesan_masuk()->result();\n $data['jumlah_permohonan_masuk'] = $this->m_admin->jumlah_permohonan_masuk()->result();\n $data['jumlah_pesan_masuk'] = $this->m_admin->jumlah_pesan_masuk()->result();\n\n $this->load->view('header');\n $this->load->view('admin/sidebar_admin');\n $this->load->view('topbar', $data);\n $this->load->view('admin/form_cari_nik_ubah_kata_sandi_rt');\n $this->load->view('footer');\n }", "public function form_cari_nik_ubah_kata_sandi_warga()\n {\n\n $data['admin'] = $this->db->get_where('admin', ['id_admin' =>\n $this->session->userdata('id_admin')])->row_array();\n $data['jumlah_pesan_masuk'] = $this->m_admin->jumlah_pesan_masuk()->result();\n $data['jumlah_permohonan_masuk'] = $this->m_admin->jumlah_permohonan_masuk()->result();\n $data['jumlah_pesan_masuk'] = $this->m_admin->jumlah_pesan_masuk()->result();\n\n $this->load->view('header');\n $this->load->view('admin/sidebar_admin');\n $this->load->view('topbar', $data);\n $this->load->view('admin/form_cari_nik_ubah_kata_sandi_warga');\n $this->load->view('footer');\n }", "public function tampilDataGalang(){\n\t\t\n\t}", "function pasien()\n\t{\n\t\t$data['pasien'] \t\t= $this->Kesehatan_M->readS('pasien')->result();\n\t\t$this->load->view('static/header');\n\t\t$this->load->view('static/navbar');\n\t\t$this->load->view('admin/daftar_pasien',$data);\n\t\t$this->load->view('static/footer');\n\t}", "public function set_pengiriman($id){ // untuk membuat database langkah pengiriman\n\t\t$cek = $this->M_biodata->get_biodata($id)->result();\n\t\t$this->load->model('M_transaksi');\n\t\tif (count($cek)>0){\n\t\t\tforeach ($cek as $c){\n\t\t\t\t\n\t\t\t};\n\t\t\t$data = array(\n\t\t\t'nama' => $c->namaAlumni,\n\t\t\t'alamat' => $c->alamat,\n\t\t\t'noHp' => $c->noHp,\n\t\t\t'id_pemesan' => $c->id_alumni\n\t\t\t);\t\n\t\t\t$this->M_transaksi->set_pengiriman($data,'pengiriman');\n\t\t$this->set_pembayaran($id);\n\t\t}\n\t}", "public function bernafas()\n \t{\n \t\techo 'Bernafas menggunakan hidung, '.PHP_EOL;\n \t}", "abstract public function hidupkan();", "public function tambah(){\n $this->template->views('crud/tambah_mahasiswa'); //untuk menampilkan view tambah_mahasiswa\n }", "public function getMataPelajaran();", "public function mahasiswa()\n {\n $data['halaman'] = \"Data Mahasiswa\";\n $data['mahasiswa'] = $this->mod->m_get_all_mahasiswa_plus_dosen();\n // print('<pre>');print_r($data);exit();\n $this->load->view('head.php', $data);\n $this->load->view('sidebar.php');\n $this->load->view('header.php');\n $this->load->view('dosen/mahasiswa.php', $data);\n $this->load->view('footer.php');\n }", "function setNombre_materia($nombre_materia){\n\t\t\n\t\t$this->nombre_materia = $nombre_materia;\n\t\t$this->cambios = true;\n\t}", "public function aksi_setujui_permohonan_013()\n {\n $data = array(\n 'tgl_persetujuan_admin' => date(\"Y/m/d\"),\n 'notif' => 'Belum Dibaca',\n 'notif_rt' => 'Belum Dibaca',\n );\n\n $data_surat = array(\n 'no_registrasi' => $this->input->post('no_registrasi'),\n 'no_bulan' => $this->input->post('no_bulan'),\n 'no_tahun' => $this->input->post('no_tahun'),\n );\n\n $detailhere = $this->input->post('id_permohonan_surat');\n\n $this->m_admin->update_status_permohonan($detailhere, $data, 'permohonan_surat');\n $this->m_admin->update_nomor_admin_surat($detailhere, $data_surat, 'srt_ket_penghasilan');\n\n if (\n $this->m_admin->update_status_permohonan($detailhere, $data, 'permohonan_surat')\n && $this->m_admin->update_nomor_admin_surat($detailhere, $data_surat, 'srt_ket_penghasilan')\n ); {\n $this->session->set_flashdata('success', 'disetujui');\n redirect('admin/pilih_tanda_tangan/' . $detailhere);\n }\n }", "function halamanbaru(){\n\t\tcek_session_admin();\n\t\t$data['record'] = $this->model_halaman->halamanstatis();\n\t\t$data['record2'] = $this->model_halaman->en_halamanstatis();\n\t\t$this->load->view('administrator/mod_halaman/view_halaman2',$data);\n\t}", "function estudiantesMatriculados() {\n $this->view->estadoMatricula = $this->model->estadoMatricula();\n \n $this->view->render('header');\n $this->view->render('matricula/estudiantesMatriculados');\n $this->view->render('footer');\n }", "public function opcion(){\n\t\t$data = new stdClass();\n\t\t$data->title = \"MANNA - La Provisión que cambiará tu vida\";\n\t\t$data->contenido = \"apl/auth/opcion\"; //aqui es la dirección física del controlador\n\t\t$data->panel_title = \"Afiliación de aliados comerciales - Página 1 de 3\";\n\t\t$data->active = \"registro\";\n\t\t$this->load->view('menu',$data);\n\t}", "public function input_mata_kuliah(){\n\t\t$mk = \"t_mk\";\n\t\t$data['content'] = 'mata_kuliah/input_mata_kuliah';\n\t\t$data['mata_kuliah'] = $this->m_aka->get_all($mk);\n\t\t$this->load->view('content',$data);\n\t}", "public function generujKod(){\n\t\t//\n\t}", "public function index() \n {\n\t\t$this->papar->senaraiPegawai['biodata'] = $this->tanya->cariMedan('nama_pegawai', \n\t\t\t'namaPegawai,Nama_Penuh,email,nohp,unit', \n\t\t\tarray('medan'=>'unit', 'id'=>'ekonomi'));\n\t\n\t\t//\n\t\t$this->papar->ralat = null;\n\t\t\n\t\t$this->papar->pegawai = senarai_kakitangan();\n $this->papar->baca($this->_folder . '/index', 0);\n }", "function cl_bensetiquetaimpressa() { \n //classes dos rotulos dos campos\n $this->rotulo = new rotulo(\"bensetiquetaimpressa\"); \n $this->pagina_retorno = basename($GLOBALS[\"HTTP_SERVER_VARS\"][\"PHP_SELF\"]);\n }", "function apa_kabar() {\n return \"Apa kabar dunia?\"; //tidak menampilkan apapun\n}", "public function semakPosmen($posmen, $jadual) \n\t{\n\t\tforeach ($nilaiRM as $keyRM) # $nilaiRM rujuk line 154\n\t\t{# kod php untuk formula matematik\n\t\t\t$data = null;\n\t\t\tif(isset($posmen[$jadual][$keyRM])):\n\t\t\t\teval( '$data = (' . $posmen[$jadual][$keyRM] . ');' );\n\t\t\t\t$posmen[$jadual][$keyRM] = $data;\n\t\t\tendif;\n\t\t}/*$nilaiTEKS = array('no','batu','jalan','tmn_kg');\n\t\tforeach ($nilaiTEKS as $keyTEKS)\n\t\t{# kod php untuk besarkan semua huruf aka uppercase\n\t\t\tif(isset($posmen[$jadual][$keyTEKS])):\n\t\t\t\t$posmen[$jadual][$keyTEKS] = strtoupper($posmen[$jadual][$keyTEKS]);\n\t\t\tendif;\n\t\t}//*/ # valid guna if\n\t\tif (isset($posmen[$jadual]['email']))\n\t\t\t$posmen[$jadual]['email']=strtolower($posmen[$jadual]['email']);\n\t\t//if (isset($posmen[$jadual]['dp_baru']))\n\t\t//\t$posmen[$jadual]['dp_baru']=ucwords(strtolower($posmen[$jadual]['dp_baru']));\n\t\tif (isset($posmen[$jadual]['responden']))\n\t\t\t$posmen[$jadual]['responden']=mb_convert_case($posmen[$jadual]['responden'], MB_CASE_TITLE);\n\t\tif (isset($posmen[$jadual]['password']))\n\t\t{\n\t\t\t//$pilih = null;\n\t\t\t$pilih = 'md5'; # Hash::rahsia('md5', $posmen[$jadual]['password'])\n\t\t\t//$pilih = 'sha256'; # Hash::create('sha256', $posmen[$jadual]['password'], HASH_PASSWORD_KEY)\n\t\t\tif (empty($posmen[$jadual]['password']))\n\t\t\t\tunset($posmen[$jadual]['password']);\n\t\t\telseif ($pilih == 'md5')\n\t\t\t\t$posmen[$jadual]['password'] = \n\t\t\t\t\\Aplikasi\\Kitab\\Hash::rahsia('md5', $posmen[$jadual]['password']);\n\t\t\telseif ($pilih == 'sha256')\n\t\t\t\t$posmen[$jadual]['password'] = \n\t\t\t\t\\Aplikasi\\Kitab\\Hash::create('sha256', $posmen[$jadual]['password'], HASH_PASSWORD_KEY);\n\t\t}//*/\n\n\t\treturn $posmen; # pulangkan nilai\n\t}", "public function getJadwalDimulai();", "function berita_penghargaan(){\n\t\tcek_session_admin();\n\t\t$data['record'] = $this->model_penghargaan->berita_penghargaan();\n\t\t$this->load->view('administrator/mod_berita_penghargaan/view_penghargaan',$data);\n\t}", "public function actionMasaze_i_tretmani()\n\t{\n\t $this->getLang();\n\t\t$this->base('masaze_i_tretmani');\n $this->naslovStranice = 'Masaže i Tretmani';\n\t\t$this->render('clanak');\n \n\t}", "public function aksi_setujui_permohonan_008()\n {\n $data = array(\n 'tgl_persetujuan_admin' => date(\"Y/m/d\"),\n 'notif' => 'Belum Dibaca',\n 'notif_rt' => 'Belum Dibaca',\n );\n\n $data_surat = array(\n 'no_registrasi' => $this->input->post('no_registrasi'),\n 'no_bulan' => $this->input->post('no_bulan'),\n 'no_tahun' => $this->input->post('no_tahun'),\n );\n\n $detailhere = $this->input->post('id_permohonan_surat');\n\n $this->m_admin->update_status_permohonan($detailhere, $data, 'permohonan_surat');\n $this->m_admin->update_nomor_admin_surat($detailhere, $data_surat, 'srt_ket_janda');\n\n if (\n $this->m_admin->update_status_permohonan($detailhere, $data, 'permohonan_surat')\n && $this->m_admin->update_nomor_admin_surat($detailhere, $data_surat, 'srt_ket_janda')\n ); {\n $this->session->set_flashdata('success', 'disetujui');\n redirect('admin/pilih_tanda_tangan/' . $detailhere);\n }\n }", "function imprimirMatricula($cedulaEstudiante) {\n $this->view->anio = $this->model->anio();\n $this->view->director = $this->model->director();\n $this->view->consultaDatosEstudiante = $this->model->consultaDatosEstudiante($cedulaEstudiante);\n\n /* Cargo informacion de las enfermedades del Estudiante */\n $this->view->enfermedadEstudiante = $this->model->enfermedadEstudiante($cedulaEstudiante);\n \n /* Cargo informacion de la adecuacio del Estudiante */\n $this->view->adecuacionEstudiante = $this->model->adecuacionEstudiante($cedulaEstudiante);\n\n /* Cargo informacion de Becas */\n $this->view->becasEstudiante = $this->model->becasEstudiante($cedulaEstudiante);\n\n /* Cargo informacion del encargado Legal del Estudiante */\n $this->view->encargadoLegal = $this->model->encargadoLegal($cedulaEstudiante);\n\n /* Cargo informacion de la Madre del Estudiante */\n $this->view->madreEstudiante = $this->model->madreEstudiante($cedulaEstudiante);\n\n /* Cargo informacion del Padre del Estudiante */\n $this->view->padreEstudiante = $this->model->padreEstudiante($cedulaEstudiante);\n\n /* Cargo informacion de la Persona en caso de Emergencia del Estudiante */\n $this->view->personaEmergenciaEstudiante = $this->model->personaEmergenciaEstudiante($cedulaEstudiante);\n\n /* Cargo informacion de la poliza del Estudiante */\n $this->view->polizaEstudiante = $this->model->polizaEstudiante($cedulaEstudiante);\n\n /* Cargo informacion de la Condicion de Matricula */\n $this->view->infoCondicionMatricula = $this->model->infoCondicionMatricula($cedulaEstudiante);\n\n /* Cargo informacion de la especialidad del Estudiante */\n $this->view->especialidadEstudiante = $this->model->especialidadEstudiante($cedulaEstudiante);\n\n /* Cargo informacion de Adelanto/Arrastre */\n $this->view->infoAdelanta = $this->model->infoAdelanta($cedulaEstudiante);\n \n $this->view->render('matricula/imprimirMatricula');\n }", "function divorced() \n { \n $this->marsta_id=\"D\";\n $this->marsta_name=\"Divorced\";\n return($this->marsta_id);\n }", "public function aksi_setujui_permohonan_014()\n {\n $data = array(\n 'tgl_persetujuan_admin' => date(\"Y/m/d\"),\n 'notif' => 'Belum Dibaca',\n 'notif_rt' => 'Belum Dibaca',\n );\n\n $data_surat = array(\n 'no_registrasi' => $this->input->post('no_registrasi'),\n 'no_bulan' => $this->input->post('no_bulan'),\n 'no_tahun' => $this->input->post('no_tahun'),\n );\n\n $detailhere = $this->input->post('id_permohonan_surat');\n\n $this->m_admin->update_status_permohonan($detailhere, $data, 'permohonan_surat');\n $this->m_admin->update_nomor_admin_surat($detailhere, $data_surat, 'srt_ket_pindah');\n\n if (\n $this->m_admin->update_status_permohonan($detailhere, $data, 'permohonan_surat')\n && $this->m_admin->update_nomor_admin_surat($detailhere, $data_surat, 'srt_ket_pindah')\n ); {\n $this->session->set_flashdata('success', 'disetujui');\n redirect('admin/pilih_tanda_tangan/' . $detailhere);\n }\n }", "public function aksi_setujui_permohonan_005()\n {\n $data = array(\n 'tgl_persetujuan_admin' => date(\"Y/m/d\"),\n 'notif' => 'Belum Dibaca',\n 'notif_rt' => 'Belum Dibaca',\n );\n\n $data_surat = array(\n 'no_registrasi' => $this->input->post('no_registrasi'),\n 'no_bulan' => $this->input->post('no_bulan'),\n 'no_tahun' => $this->input->post('no_tahun'),\n );\n\n $detailhere = $this->input->post('id_permohonan_surat');\n\n $this->m_admin->update_status_permohonan($detailhere, $data, 'permohonan_surat');\n $this->m_admin->update_nomor_admin_surat($detailhere, $data_surat, 'srt_izin_keramaian');\n\n if (\n $this->m_admin->update_status_permohonan($detailhere, $data, 'permohonan_surat')\n && $this->m_admin->update_nomor_admin_surat($detailhere, $data_surat, 'srt_izin_keramaian')\n ); {\n $this->session->set_flashdata('success', 'disetujui');\n redirect('admin/pilih_tanda_tangan/' . $detailhere);\n }\n }", "function select_tb_penduduk(){\n\t\t$this->load->model('mamdani');\n\t\t//$klasifikasi['klasifikasi']=$this->mamdani->getdata();\n\t\t$klasifikasi['jumlah_aset']=$this->mamdani->jumlah_aset();\n\t\t$klasifikasi['tingkat']= $this->mamdani->klasifikasi3();\n\n\t\t$this->load->view('templates/header');\n\t\t$this->load->view('admin/lihatdata/tabel_klasifikasi_penduduk',$klasifikasi);\n\t\t$this->load->view('templates/footer');\n\t\t// var_dump($jml_aset);\n\t\t// die;\n\n\t}", "public function init(){\n $this->documento='760';\n }", "function conf(){\n $this->s__perfil = toba::manejador_sesiones()->get_perfiles_funcionales();\n // print_r($this->s__perfil); \n \n $p = array_search('autoridad_mesa', $this->s__perfil);\n if($p !== false){//Es autoridad de mesa\n //Cargar datos del usuario especifico\n //obtengo el nombre de usuario logueado\n $usr = toba::manejador_sesiones()->get_id_usuario_instancia();\n \n $id_mesa = $this->dep('datos')->tabla('mesa')->get_de_usr($usr);\n if(sizeof($id_mesa)>0){\n $this->s__id_mesa = $id_mesa[0]['id_mesa'];\n $datos['id_mesa'] = $this->s__id_mesa;\n $this->dep('datos')->tabla('mesa')->cargar($datos);\n $this->s__mesa = $this->dep('datos')->tabla('mesa')->get();\n \n if($this->s__mesa['estado'] >= 2){//Ya fue validado por la secretaria\n $this->controlador()->evento('procesar')->ocultar();\n $this->controlador()->evento('enviar')->ocultar();\n }\n }\n else//No se encuentra mesa asociada al usuario logueado\n toba::notificacion()->agregar(\"No se encuentra el usuario ingresado\",\"info\");\n }\n else{\n $this->s__id_mesa = toba::memoria()->get_parametro('c');//el parametro c tiene el id mesa\n \n $this->s__retorno = toba::memoria()->get_parametro('k');//el parametro k tiene la dir de retorno\n $this->s__retorno_estado = toba::memoria()->get_parametro('f');\n \n \n $datos['id_mesa'] = $this->s__id_mesa;\n $this->dep('datos')->tabla('mesa')->cargar($datos);\n $this->s__mesa = $this->dep('datos')->tabla('mesa')->get();\n \t\n $p = array_search('junta_electoral', $this->s__perfil);\n if($p !== false){//Es junta electoral\n $this->controlador()->evento('procesar')->set_etiqueta('Confirmar');\n $this->controlador()->evento('enviar')->ocultar();\n\n if($this->s__mesa['estado'] > 3){//Ya fue validado por la secretaria\n// $this->dep('form_ml_directivo')->set_solo_lectura('votos');\n// $this->dep('form_ml_superior')->set_solo_lectura('votos');\n// $this->dep('form_ml_extra')->set_solo_lectura('votos');\n $this->controlador()->evento('procesar')->ocultar();\n $this->controlador()->evento('enviar')->ocultar();\n }\n }\n else{\n $p = array_search('secretaria', $this->s__perfil);//print_r(isset($p)?'no es false':'es false');\n if($p !== false){//Es secretaria\n $this->controlador()->evento('procesar')->set_etiqueta('Validar');\n $this->controlador()->evento('enviar')->ocultar();\n\n }\n \n }\n }\n \n if(isset($this->s__id_mesa)){//Si el pedido viene de la operacion Confirmar/Cargar// \n $this->s__claustro = $this->s__mesa['id_claustro'];\n $this->s__id_nro_ue = $this->dep('datos')->tabla('sede')->get_unidad($this->s__mesa['id_sede']);\n $this->s__id_sede = $this->s__mesa['id_sede'];\n }\n }", "public function cari_nim_mhs(){// Mencari berdasarkan NIM di form pengisian FRS\n\t\t$cari = $this->input->post('cari');\n\t\t$data['query'] = $this->m_aka->cari_nim_mhs($cari);\t\t\n\t\t$data['content']='keuangan/list_mahasiswa';\n\t\tif($cari){\n\t\t\t\t$this->load->view('content',$data);\t\t\n\t\t}else{\n\t\t\t\t$data['data_frs'] = $this->m_aka->reg();\n\t\t\t\t$this->load->view('content',$data);\n\t\t}\t\t\n\t}", "public function GruporModelo()\n\t\t{\n\t\t\t$id = \"\";\n\t\t\t$numero = \"\";\n\t\t\t$franja = \"\";\n\t\t}", "function auto_menguji_ta(){\n\t\t\t\t$ta = $this->session->userdata('kd_ta');\n\t\t\t\t$smt = $this->session->userdata('kd_smt');\n\n\t\t\t\t$data = $this->get_current_ujian_ta(2); //mengambil data menguji tugas akhir pada semester ini (2)\n\n\t\t\t\tforeach ($data as $ta) {\n\t\t\t\t\t$cek_nilai_mhs = $this->get_status_ta($ta['NIM']);\n\t\t\t\t\tif($cek_nilai_mhs){\n\t\t\t\t\t\t$nim = $ta['NIM'];\n\t\t\t\t\t\t$judul_ta = $ta['JUDUL'];\n\t\t\t\t\t\t$kd_kur_mhs = $this->kurikulum_mahasiswa($nim);\n\t\t\t\t\t\t$temp = $this->get_data_mhs($nim);\n\t\t\t\t\t\t$jenjang = $temp[0]['NM_JENJANG'];\n\t\t\t\t\t\t$prodi = $temp[0]['NM_PRODI'];\n\t\t\t\t\t\t$prodi = str_replace(\"'\", \"\", $prodi);\n\t\t\t\t\t\t$prodi = strip_tags($prodi);\n\n\t\t\t\t\t\t$list_mk = $this->api->get_api_json(\n\t\t\t\t\t\t\tURL_API_SIA.'sia_kurikulum/data_search',\n\t\t\t\t\t\t\t'POST',\n\t\t\t\t\t\t\tarray(\n\t\t\t\t\t\t\t\t'api_kode'=>40000,\n\t\t\t\t\t\t\t\t'api_subkode' => 15,\n\t\t\t\t\t\t\t\t'api_search' => array($kd_kur_mhs)\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tforeach ($list_mk as $mk) {\n\t\t\t\t\t\t\t$get_makul = strtoupper($mk['NM_MK']);\n\t\t\t\t\t\t\t$get_jenjang = strtoupper($mk['NM_PEND']);\n\t\t\t\t\t\t\tif($get_jenjang == \"S0\"){\n\t\t\t\t\t\t\t\tif($get_makul == \"TUGAS AKHIR\" || $get_makul == \"SKRIPSI\" || $get_makul == \"TUGAS AKHIR/SKRIPSI\" || $get_makul == \"SKRIPSI/TUGAS AKHIR\"){\n\t\t\t\t\t\t\t\t\t$jml_sks = $mk['SKS_MK'];\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}else if($get_jenjang == \"S1\"){\n\t\t\t\t\t\t\t\tif($get_makul == \"TUGAS AKHIR\" || $get_makul == \"SKRIPSI\" || $get_makul == \"TUGAS AKHIR/SKRIPSI\" || $get_makul == \"SKRIPSI/TUGAS AKHIR\"){\n\t\t\t\t\t\t\t\t\t$jml_sks = $mk['SKS_MK'];\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}else if($get_jenjang==\"S2\"){\n\t\t\t\t\t\t\t\tif($get_makul == \"TESIS\" || $get_makul == \"TESIS/TUGAS AKHIR\" || $get_makul == \"TUGAS AKHIR/TESIS\"){\n\t\t\t\t\t\t\t\t\t$jml_sks = $mk['SKS_MK'];\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}else if($get_jenjang==\"S3\"){\n\t\t\t\t\t\t\t\tif($get_makul == \"DISERTASI\" || $get_makul == \"DISERTASI/TUGAS AKHIR\" || $get_makul == \"TUGAS AKHIR/DISERTASI\"){\n\t\t\t\t\t\t\t\t\t$jml_sks = $mk['SKS_MK'];\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t//BUAT NARASI + INPUT DATA KE DB + ADA CEK DUPLUKASI DATA :\n\n\t\t\t\t\t\t$narasi = \"Menguji Tugas Akhir \".$jenjang.\", Program Studi \".$prodi.\", Judul \".$judul_ta.\", \".$jml_sks.\" SKS\";\n\t\t\t\t\t\t$narasi = str_replace(\"'\", \"\", $narasi);\n\t\t\t\t\t\t$narasi = strip_tags($narasi);\n\t\t\t\t\t\t//$narasi = str_replace(\",\", \"\", $narasi);\n\t\t\t\t\t\t//$sks_rule = round($this->aturan_beban_sks2(strtoupper($jenjang), $jml_sks, 1, 'TUGAS_AKHIR'),2);\n\t\t\t\t\t\t$jml_mhs = 1;\n\n\t\t\t\t\t\t//ATURAN SKS_RULE UNTUK MENGUJI TA\n\t\t\t\t\t\t$kd_kat = '74'; //4 untuk menguji (sebagai ketua dan anggota)\n\t\t\t\t\t\tif($jenjang == 'S0'){\n\t\t\t\t\t\t\t//sks_rule sementara untuk menguji TA S0 \n\t\t\t\t\t\t\t//$sks_rule = round(($sks_rule*(0.5)), 2);\n\t\t\t\t\t\t\t$sks_rule \t= $this->sksrule->_nilai_sks($jml_mhs, 1003, 2);\n\t\t\t\t\t\t\t$kd_kat = '74';\n\t\t\t\t\t\t}elseif($jenjang == 'S1'){\n\t\t\t\t\t\t\t//sks_rule sementara untuk menguji TA S0 \n\t\t\t\t\t\t\t//$sks_rule = round(($sks_rule*(0.5)), 2);\n\t\t\t\t\t\t\t$sks_rule \t= $this->sksrule->_nilai_sks($jml_mhs, 1003, 2);\n\t\t\t\t\t\t\t$kd_kat = '74';\n\t\t\t\t\t\t}\n\t\t\t\t\t\telseif($jenjang == 'S2'){\n\t\t\t\t\t\t\t//$sks_rule = round(($sks_rule*(0.5)), 2);\n\t\t\t\t\t\t\t$sks_rule \t= $this->sksrule->_nilai_sks($jml_mhs, 1003, 3);\n\t\t\t\t\t\t\t$kd_kat = '74'; //74 untuk menguji sebagai anggota\n\t\t\t\t\t\t}elseif($jenjang == 'S3'){\n\t\t\t\t\t\t\t//$sks_rule = round(($sks_rule*(0.5)), 2);\n\t\t\t\t\t\t\t$sks_rule \t= $this->sksrule->_nilai_sks($jml_mhs, 1003, 4);\n\t\t\t\t\t\t\t$kd_kat = '74'; //74 untuk menguji sebagai anggota\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t$smt = $this->session->userdata('kd_smt');\n\t\t\t\t\t\t$ta = $this->session->userdata('kd_ta');\n\n\t\t\t\t\t\t// $kd_jbk = 'A';\n\t\t\t\t\t\t$kd_dosen = $this->session->userdata('kd_dosen');\n\t\t\t\t\t\t$jenis_kegiatan = $narasi;\n\t\t\t\t\t\t/*$jenis_kegiatan ='test';*/\n\t\t\t\t\t\t$bukti_penugasan = '-';\n\t\t\t\t\t\t// $sks_penugasan = $sks_rule;\n\t\t\t\t\t\t$masa_penugasan = '1 Semester';\n\t\t\t\t\t\t$bkt_dokumen = '-';\n\t\t\t\t\t\t$kd_jbk \t\t= 'A';\n\t\t\t\t\t\t$bkt_penugasan \t= '-';\n\t\t\t\t\t\t$bkt_dokumen \t= '-';\n\t\t\t\t\t\t$rekomendasi \t= 'LANJUTKAN';\n\t\t\t\t\t\t$capaian \t\t= 100;\n\t\t\t\t\t\t$jml_jam \t\t= 1;\n\t\t\t\t\t\t$outcome \t\t= '-';\n\t\t\t\t\t\t$file_penugasan = '-';\n\t\t\t\t\t\t$file_capaian \t= '-';\n\t\t\t\t\t\t// $sks_bkt = $sks_rule;\n\t\t\t\t\t\t$thn = $this->session->userdata('ta');\n\t\t\t\t\t\tif($smt == 2) $semester = 'GENAP'; else $semester = 'GANJIL';\n\n\n\n\t\t\t\t\t\t//cek kemana data akan pergi :)\n\t\t\t\t\t\t$kewajiban_serdos = $this->cek_kewajiban_serdos($kd_dosen);\n\n\t\t\t\t\t\t$status_pindah = $this->get_status_pindah($kd_kat);\n\n\t\t\t\t\t\t$jalur_data = 0;\n\t\t\t\t\t\tif($status_pindah == 0){\n\t\t\t\t\t\t\t$jalur_data = $this->cek_jalur_data_kat($kd_kat);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t$sts_pakai = 1;\n\t\t\t\t\t\tif($status_pindah == 0){\n\t\t\t\t\t\t\tif($kewajiban_serdos == 0){\n\t\t\t\t\t\t\t\t$sts_pakai = 0;\n\t\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t\tif($jalur_data != 0){\n\t\t\t\t\t\t\t\t\t$sts_pakai = 0;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\n\t\t\t\t\t\t//cek apakah sudah ada data atau belum ?\n\t\t\t\t\t\t $cek_mhs_bimbingan = $this->cek_api_mhs_ujian($nim);\n\n\t\t\t\t\t\t //cek nilai mahasiswa ta sudah ada apa belum :\n\t\t\t\t\t\t //$cek_nilai_mhs = $this->get_status_ta($nim);\n\t\t\t\t\t\t $cek_mhs_ujian_ta = $this->cek_api_data_pendidikan($kd_dosen, $ta, $smt, $kd_kat, $nim);\n\t\t\t\t\t\t $cek_status_ketua_ta = $this->cek_api_data_pendidikan($kd_dosen, $ta, $smt, '73', $nim);\n\t\t\t\t\t\t \n\t\t\t\t\t\t//if(!$cek_mhs_bimbingan){\n\t\t\t\t\t\tif(!$cek_mhs_ujian_ta && !$cek_status_ketua_ta){\n\n\t\t\t\t\t\t\t$api_url \t= URL_API_BKD.'bkd_beban_kerja/simpan_beban_kerja_sia_ta_maps';\n\t\t\t\t\t\t\t$parameter = array('api_search'=>array($kd_jbk, $kd_dosen, $jenis_kegiatan, $bkt_penugasan, $sks_rule, $masa_penugasan, $bkt_dokumen, $sks_rule, $thn, $semester, $rekomendasi, $jml_jam, $capaian, $outcome, $file_penugasan, $file_capaian, $ta, $smt, $sts_pakai));\n\t\t\t\t\t\t\t$simpan = $this->s00_lib_api->get_api_jsob($api_url,'POST',$parameter);\n\t\t\t\t\t\t\tif($simpan){\n\n\t\t\t\t\t\t\t\t$getid = $simpan;\n\t\t\t\t\t\t\t\t$nm_keg = $jenis_kegiatan;\n\n\t\t\t\t\t\t\t\t$status_pindah = $this->get_status_pindah($kd_kat);\n\n\t\t\t\t\t\t\t\t$api_url \t= URL_API_BKD.'bkd_beban_kerja/simpan_data_pendidikan_ta';\n\t\t\t\t\t\t\t\t$parameter\t= array('api_search' => array($getid, $kd_kat, $nm_keg, $jenjang, '-', '1', $jml_sks, '1', '1', 'A', '1', $prodi, $nim, $status_pindah));\n\t\t\t\t\t\t\t\t$simpan = $this->s00_lib_api->get_api_jsob($api_url,'POST',$parameter);\n\t\t\t\t\t\t\t\tif($simpan){\n\t\t\t\t\t\t\t\t\t//echo 'simpan ke data pendidikan sukses'; echo '<br>';\n\t\t\t\t\t\t\t\t}\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\t\n\t\t\t\t}\t\t\n\t\t}", "function berinamaTeman($teman){\r\n\t\t\t$this->nama_teman = $teman;\r\n\t\t}", "public function aksi_setujui_permohonan_004()\n {\n $data = array(\n 'tgl_persetujuan_admin' => date(\"Y/m/d\"),\n 'notif' => 'Belum Dibaca',\n 'notif_rt' => 'Belum Dibaca',\n );\n\n $data_surat = array(\n 'no_registrasi' => $this->input->post('no_registrasi'),\n 'no_bulan' => $this->input->post('no_bulan'),\n 'no_tahun' => $this->input->post('no_tahun'),\n );\n\n $detailhere = $this->input->post('id_permohonan_surat');\n\n $this->m_admin->update_status_permohonan($detailhere, $data, 'permohonan_surat');\n $this->m_admin->update_nomor_admin_surat($detailhere, $data_surat, 'srt_ket_beda_nama');\n\n if (\n $this->m_admin->update_status_permohonan($detailhere, $data, 'permohonan_surat')\n && $this->m_admin->update_nomor_admin_surat($detailhere, $data_surat, 'srt_ket_beda_nama')\n ); {\n $this->session->set_flashdata('success', 'disetujui');\n redirect('admin/pilih_tanda_tangan/' . $detailhere);\n }\n }", "function miguel_MCourse() \r\n {\t\r\n $this->base_Model();\r\n }", "public function pendebetan_angsuran_koptel()\n\t{\n\t\t$data['container'] = 'transaction/pendebetan_angsuran_koptel';\n\t\t$data['debet'] = $this->model_transaction->get_data_angsuran();\n\t\t$this->load->view('core',$data);\n\t}", "public function mostrar(){\n\t\t\t\techo \"<p> Hola soy un $this->marca, modelo $this->modelo</php> \";\n\t\t\t}", "public function aksi_setujui_permohonan_012()\n {\n $data = array(\n 'tgl_persetujuan_admin' => date(\"Y/m/d\"),\n 'notif' => 'Belum Dibaca',\n 'notif_rt' => 'Belum Dibaca',\n );\n\n\n $detailhere = $this->input->post('id_permohonan_surat');\n\n $this->m_admin->update_status_permohonan($detailhere, $data, 'permohonan_surat');\n\n if ($this->m_admin->update_status_permohonan($detailhere, $data, 'permohonan_surat')); {\n $this->session->set_flashdata('success', 'disetujui');\n redirect('admin/pilih_tanda_tangan/' . $detailhere);\n }\n }", "function hitung()\n\t{\n\t\t$this->model->hitungMhs();\n\t\t//$this->dashboardukmapendaftar(); //controller dikembalikan ke method index setelah selesai mengakses method ini.\n\t}", "public function jalan() {\n echo \"method jalan() berisi : Hewan ini terbang\";\n }", "public function data_motif_kejahatan()\n\t{\n\t\t$data = array(\n\t\t\t'data_motif_kejahatan' => $this->master_motif_kejahatan_model->select_master_motif_kejahatan(), \n\t\t);\n\n\t\t$this->load->view('data_motif_kejahatan_content', $data, FALSE);\n\t}", "function setMateria($materia){\n\t\t\n\t\t$this->materia = $materia;\n\t\t$this->cambios = true;\n\t}", "public function aksi_setujui_permohonan_010()\n {\n $data = array(\n 'tgl_persetujuan_admin' => date(\"Y/m/d\"),\n 'notif' => 'Belum Dibaca',\n 'notif_rt' => 'Belum Dibaca',\n );\n\n $data_surat = array(\n 'no_registrasi' => $this->input->post('no_registrasi'),\n 'no_bulan' => $this->input->post('no_bulan'),\n 'no_tahun' => $this->input->post('no_tahun'),\n );\n\n $detailhere = $this->input->post('id_permohonan_surat');\n\n $this->m_admin->update_status_permohonan($detailhere, $data, 'permohonan_surat');\n $this->m_admin->update_nomor_admin_surat($detailhere, $data_surat, 'srt_ket_kelahiran');\n\n if (\n $this->m_admin->update_status_permohonan($detailhere, $data, 'permohonan_surat')\n && $this->m_admin->update_nomor_admin_surat($detailhere, $data_surat, 'srt_ket_kelahiran')\n ); {\n $this->session->set_flashdata('success', 'disetujui');\n redirect('admin/pilih_tanda_tangan/' . $detailhere);\n }\n }", "public function input_data_kalender_akademik(){\n\t\t$data['content'] = 'jadwal/input_data_kalender_akademik';\n\t\t$this->load->view('content',$data);\n\t}", "public function aksi_tambah_permohonan_suket013()\n\t{\n\t\t$data_permohonan = array(\n\t\t\t'id_nama_surat' => $this->input->post('id_nama_surat'),\n\t\t\t'id_warga' => $this->input->post('id_warga'),\n\t\t\t'status' => $this->input->post('status'),\n\t\t);\n\n\t\t$id_permohonan = $this->m_warga->tambah_permohonan($data_permohonan);\n\n\t\t$data_surat = array(\n\t\t\t'id_permohonan_surat' => $id_permohonan,\n\t\t\t'nama' => $this->input->post('nama'),\n\t\t\t'jenis_kelamin' => $this->input->post('jenis_kelamin'),\n\t\t\t'tanggal_lahir' => $this->input->post('tanggal_lahir'),\n\t\t\t'tempat_lahir' => $this->input->post('tempat_lahir'),\n\t\t\t'pekerjaan' => $this->input->post('pekerjaan'),\n\t\t\t'alamat_tinggal' => $this->input->post('alamat_tinggal'),\n\t\t\t'penghasilan' => $this->input->post('penghasilan'),\n\t\t\t'terbilang' => $this->input->post('terbilang'),\n\t\t);\n\n\t\t$id_surat = $this->m_warga->tambah_suket($data_surat, 'srt_ket_penghasilan');\n\n\t\t$this->session->set_flashdata('success', 'disimpan');\n\t\tredirect('warga/detail_suket013/' . $id_surat . '/' . $id_permohonan);\n\t}", "function verMas()\t\r\n\t\t{\r\n\t\t\t\r\n\t\t\tglobal $use;\r\n\t\t\tglobal $priv;\r\n\r\n\t\t\t//NOTA: Para ver si funciona tienen que asociarle un adherente en la tabla socios, ya que en los datos de ejemplo todos son titulares\r\n\t\t\t//NOTA: Lo que hice fue: en tabla socios en numero_soc=00044 cambiar el campo soc_titula de manera que quede soc_titula=00277\r\n\t\t\t\r\n\t\t\t//---------------CONSULTA QUE DEVUELVE TODA LA INFO DEL ASOCIADO TITULAR----------------\r\n\t\t\t\r\n\t\t\t$numero_socio = $_GET['num_soc']; //Es el número del socio titular que debe ser tomado del PASO 1\r\n\t\t\t\r\n\r\n\t\t\t\t$resultadoTitular = $GLOBALS['db']->select(\"SELECT socios.id_persona,socios.numero_soc,socios.beneficio,socios.fec_alt,socios.fec_baja,socios.lugar_pago,socios.soc_titula\r\n\t\t\t\t,persona.id_persona,persona.nombre,persona.numdoc,persona.cuil,persona.sexo,persona.fecnacim,persona.domicilio,persona.casa_nro,persona.barrio,persona.localidad,persona.codpostal\r\n\t\t\t\t,persona.dpmto,persona.tel_fijo,persona.tel_cel,persona.fec_alta AS fec_alta2,persona.fec_baja AS fec_baja2,persona.cbu,persona.banco,persona.usualta\r\n\t\t\t\t\t\t\t\t\t FROM socios,persona \r\n\t\t\t\t\t\t\t\t\t WHERE socios.soc_titula = '$numero_socio' \r\n\t\t\t\t\t\t\t\t\t AND socios.id_persona = persona.id_persona\r\n AND socios.numero_soc= socios.soc_titula\");\r\n\t\t\t\t\t\t\t\t\t \r\n\r\n\t\t\tif(!$resultadoTitular)\r\n\t\t\t{\r\n\t\t\t\t$error=[\r\n\t\t\t\t'menu'\t\t\t=>\"Atenciones\",\r\n\t\t\t\t'funcion'\t\t=>\"verMas\",\r\n\t\t\t\t'descripcion'\t=>\"No se encuentra al titular $numero_socio\"\r\n\t\t\t\t];\r\n\t\t\t\techo $GLOBALS['twig']->render('/Atenciones/error.html', compact('error','use','priv'));\t\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t///---FUNCIÓN PARA CALCULAR EDAD----\r\n\t\t\t\r\n\t\t\t$fecha=$resultadoTitular[0]['fecnacim'];\r\n\t\t\t$dias = explode(\"-\", $fecha, 3);\r\n\t\t\t\r\n\t\t\t// $dias[0] es el año\r\n\t\t\t// $dias[1] es el mes\r\n\t\t\t// $dias[2] es el dia\r\n\t\t\t\r\n\t\t\t// mktime toma los datos en el orden (0,0,0, mes, dia, año) \r\n\t\t\t$dias = mktime(0,0,0,$dias[1],$dias[2],$dias[0]);\r\n\t\t\t$edad = (int)((time()-$dias)/31556926 );\r\n\t\t\t$resultadoTitular[0]['edad']=$edad;\r\n\t\t\t\r\n\t\t\t///---FIN FUNCIÓN PARA CALCULAR EDAD----\r\n\t\t\t\r\n\t\t\t$estado[0]='1';\r\n\t\t\t$estado[1]='1';\r\n\t\t\t$estado[2]='1';\r\n\t\t\t$estado[3]='1';\r\n\t\t\t$estado[4]='1';\r\n\t\t\t\r\n\t\t\t//---------------CONSULTA QUE DEVUELVE TODA LA INFO DE LOS SERVICIOS DEL ASOCIADO TITULAR----------------\r\n\t\t\t\r\n\t\t\t//Por cuota\r\n\t\t\t$resultadoTitularServicios1 = $GLOBALS['db']->select(\"SELECT socios.id_persona,socios.numero_soc,socios.beneficio,socios.fec_alt,socios.fec_baja,socios.lugar_pago,socios.soc_titula\r\n\t\t\t\t,persona.id_persona,persona.nombre,persona.numdoc,persona.cuil,persona.sexo,persona.fecnacim,persona.domicilio,persona.casa_nro,persona.barrio,persona.localidad,persona.codpostal\r\n\t\t\t\t,persona.dpmto,persona.tel_fijo,persona.tel_cel,persona.fec_alta AS fec_alta2,persona.fec_baja AS fec_baja2,persona.cbu,persona.banco,persona.usualta\r\n\t\t\t\t,fme_adhsrv.codigo,fme_adhsrv.parentesco,fme_adhsrv.periodoini,fme_adhsrv.periodofin,fme_adhsrv.motivobaja,fme_adhsrv.documento\r\n\t\t\t\t,tar_srv.nombre AS nombreplan,tar_srv.idmutual \r\n\t\t\t\t\t\t\t\t\t FROM socios,persona,fme_adhsrv,tar_srv \r\n\t\t\t\t\t\t\t\t\t WHERE socios.soc_titula = '$numero_socio' \r\n\t\t\t\t\t\t\t\t\t AND socios.id_persona = persona.id_persona\r\n AND socios.numero_soc= socios.soc_titula\r\n\t\t\t\t\t\t\t\t\t AND fme_adhsrv.socnumero = socios.soc_titula\r\n\t\t\t\t\t\t\t\t\t AND fme_adhsrv.codigo = tar_srv.idmutual\");\r\n\t\t\t\t\t\t\t\t\t \r\n\t\t\tif(!$resultadoTitularServicios1)\r\n\t\t\t\t$estado[0]='0';\r\n\t\t\t\r\n\t\t\t//Por tarjeta\r\n\t\t\t$resultadoTitularServicios2 = $GLOBALS['db']->select(\"SELECT socios.id_persona,socios.numero_soc,socios.beneficio,socios.fec_alt,socios.fec_baja,socios.lugar_pago,socios.soc_titula\r\n\t\t\t\t,persona.id_persona,persona.nombre,persona.numdoc,persona.cuil,persona.sexo,persona.fecnacim,persona.domicilio,persona.casa_nro,persona.barrio,persona.localidad,persona.codpostal\r\n\t\t\t\t,persona.dpmto,persona.tel_fijo,persona.tel_cel,persona.fec_alta AS fec_alta2,persona.fec_baja AS fec_baja2,persona.cbu,persona.banco,persona.usualta\r\n\t\t\t\t,tar_srv.nombre AS nombreplan,tar_srv.codigo AS codigotarsrv, tar_srvadherentes.codigo, tar_srvadherentes.parentesco \r\n\t\t\t\t\t\t\t\t\t FROM socios,persona,tar_srv, tar_srvadherentes \r\n\t\t\t\t\t\t\t\t\t WHERE socios.soc_titula = '$numero_socio' \r\n\t\t\t\t\t\t\t\t\t AND socios.id_persona = persona.id_persona\r\n AND socios.numero_soc= socios.soc_titula\r\n\t\t\t\t\t\t\t\t\t AND tar_srvadherentes.socnumero = socios.soc_titula \r\n\t\t\t\t\t\t\t\t\t AND tar_srvadherentes.codigo = tar_srv.codigo\");\r\n\t\t\t\r\n\t\t\tif(!$resultadoTitularServicios2)\r\n\t\t\t\t$estado[1]='0';\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t//---------------CONSULTA QUE DEVUELVE TODA LA INFO DE LOS ADHERENTES DEL ASOCIADO TITULAR CON APORTES POR CUOTA----------------\r\n\t\t\t\r\n\r\n\t\t $resultadoAdherentes1 = $GLOBALS['db']->select(\"SELECT socios.id_persona,socios.numero_soc,socios.beneficio,socios.fec_alt,socios.fec_baja,socios.lugar_pago,socios.soc_titula\r\n\t\t\t\t,persona.id_persona,persona.nombre,persona.numdoc,persona.cuil,persona.sexo,persona.fecnacim,persona.domicilio,persona.casa_nro,persona.barrio,persona.localidad,persona.codpostal\r\n\t\t\t\t,persona.dpmto,persona.tel_fijo,persona.tel_cel,persona.fec_alta AS fec_alta2,persona.fec_baja AS fec_baja2,persona.cbu,persona.banco,persona.usualta\r\n\t\t\t\t,fme_adhsrv.codigo,fme_adhsrv.parentesco,fme_adhsrv.periodoini,fme_adhsrv.periodofin,fme_adhsrv.motivobaja,fme_adhsrv.documento\r\n\t\t\t\t,tar_srv.nombre AS nombreplan,tar_srv.idmutual \r\n\t\t\t\t\t\t\t\t\t FROM socios,persona,fme_adhsrv,tar_srv \r\n\t\t\t\t\t\t\t\t\t WHERE socios.soc_titula = '$numero_socio'\r\n\t\t\t\t\t\t\t\t\t AND socios.numero_soc != socios.soc_titula\r\n\t\t\t\t\t\t\t\t\t AND socios.id_persona = persona.id_persona\r\n\t\t\t\t\t\t\t\t\t AND fme_adhsrv.socnumero = socios.numero_soc \r\n\t\t\t\t\t\t\t\t\t AND fme_adhsrv.codigo = tar_srv.idmutual\");\r\n\t\t\t\r\n\t\t\tif(!$resultadoAdherentes1)\r\n\t\t\t\t$estado[2]='0';\r\n\t\t\t\r\n\t\t\t//---------------CONSULTA QUE DEVUELVE TODA LA INFO DE LOS ADHERENTES DEL ASOCIADO TITULAR CON APORTES POR TARJETA----------------\r\n\r\n\t\t\t$resultadoAdherentes2 = $GLOBALS['db']->select(\"SELECT socios.id_persona,socios.numero_soc,socios.beneficio,socios.fec_alt,socios.fec_baja,socios.lugar_pago,socios.soc_titula\r\n\t\t\t\t,persona.id_persona,persona.nombre,persona.numdoc,persona.cuil,persona.sexo,persona.fecnacim,persona.domicilio,persona.casa_nro,persona.barrio,persona.localidad,persona.codpostal\r\n\t\t\t\t,persona.dpmto,persona.tel_fijo,persona.tel_cel,persona.fec_alta AS fec_alta2,persona.fec_baja AS fec_baja2,persona.cbu,persona.banco,persona.usualta\r\n\t\t\t\t,tar_srv.nombre AS nombreplan,tar_srv.codigo AS codigotarsrv, tar_srvadherentes.codigo, tar_srvadherentes.parentesco \r\n\t\t\t\t\t\t\t\t\t FROM socios,persona,tar_srv, tar_srvadherentes \r\n\t\t\t\t\t\t\t\t\t WHERE socios.soc_titula = '$numero_socio'\r\n\t\t\t\t\t\t\t\t\t AND socios.numero_soc != socios.soc_titula\r\n\t\t\t\t\t\t\t\t\t AND socios.id_persona = persona.id_persona\r\n\t\t\t\t\t\t\t\t\t AND tar_srvadherentes.socnumero = socios.numero_soc \r\n\t\t\t\t\t\t\t\t\t AND tar_srvadherentes.codigo = tar_srv.codigo\");\t\r\n\r\n\t\t\t\r\n\r\n\t\t\t\t\t\t\t\t \r\n\t\t\t\r\n\t\t\tif(!$resultadoAdherentes2)\r\n\t\t\t\t$estado[3]='0';\r\n\t\t\r\n\t\t \r\n\t\t\t//---------------CONSULTA QUE DEVUELVE EL LISTADO DE TODAS LAS ASISTENCIAS----------------\r\n\t\t\t\r\n\t\t\t//NOTA: Para que puedan ver si funciona o no hacer la prueba con el siguiente ejemplo:\r\n\t\t\t// En la tabla fme_asistencia modifiquen en cualquier lado y pongan alguno con doctitu = 06948018 (o busquen cualquier DNI de un socio titular y usen ese)\r\n\t\t\t// Cuando prueben el sistema vayan al ver más de Barrionuevo Samuel y van a ver el listado de atenciones que tiene asociado\r\n\t\t\t\r\n\t\t\t$asistencias = $GLOBALS['db']->select(\"SELECT fme_asistencia.doctitu, fme_asistencia.numdoc, fme_asistencia.nombre,\r\n\t\t\t\t\t\t\t\t\t fme_asistencia.fec_pedido, fme_asistencia.hora_pedido, fme_asistencia.dessit, fme_asistencia.fec_ate,\r\n\t\t\t\t\t\t\t\t\t fme_asistencia.sintomas, fme_asistencia.diagnostico, fme_asistencia.tratamiento, fme_asistencia.hora_aten,\r\n\t\t\t\t\t\t\t\t\t fme_asistencia.profesional\r\n\t\t\t\t\t\t\t\t\t FROM fme_asistencia, socios, persona \r\n\t\t\t\t\t\t\t\t\t WHERE soc_titula = '$numero_socio' \r\n\t\t\t\t\t\t\t\t\t AND socios.id_persona = persona.id_persona\r\n\t\t\t\t\t\t\t\t\t AND numero_soc = soc_titula\r\n\t\t\t\t\t\t\t\t\t AND persona.numdoc = fme_asistencia.doctitu\");\r\n\t\t\t\r\n\t\t\tif(!$asistencias)\r\n\t\t\t\t$estado[4]='0';\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\r\n\t\t\techo $GLOBALS['twig']->render('/Atenciones/perfil.html', compact('resultadoTitular', \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t 'resultadoTitularServicios1', \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t 'resultadoTitularServicios2', \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t 'resultadoAdherentes1',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t 'resultadoAdherentes2',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t 'asistencias',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t 'estado','use','priv'));\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t}", "public function getMarca(){ return $this->marca;}", "public function aksi_setujui_permohonan_009()\n {\n $data = array(\n 'tgl_persetujuan_admin' => date(\"Y/m/d\"),\n 'notif' => 'Belum Dibaca',\n 'notif_rt' => 'Belum Dibaca',\n );\n\n $data_surat = array(\n 'no_registrasi' => $this->input->post('no_registrasi'),\n 'no_bulan' => $this->input->post('no_bulan'),\n 'no_tahun' => $this->input->post('no_tahun'),\n );\n\n $detailhere = $this->input->post('id_permohonan_surat');\n\n $this->m_admin->update_status_permohonan($detailhere, $data, 'permohonan_surat');\n $this->m_admin->update_nomor_admin_surat($detailhere, $data_surat, 'srt_ket_kematian');\n\n if (\n $this->m_admin->update_status_permohonan($detailhere, $data, 'permohonan_surat')\n && $this->m_admin->update_nomor_admin_surat($detailhere, $data_surat, 'srt_ket_kematian')\n ); {\n $this->session->set_flashdata('success', 'disetujui');\n redirect('admin/pilih_tanda_tangan/' . $detailhere);\n }\n }", "public function dibujarPantalla( ) {\n $this->activarPantalla();\n $this->enviarNumero();\n\t $this->enviarVolumen();\n\t $this->enviarComando();\n $this->enviarNoInterrumpir();\n\t $this->enviarNuestroSonido();\n\t //this.pnlControl.getModuloControl().control_videoconferencia.llamadasactivas();\n }", "public function aksi_setujui_permohonan_007()\n {\n $data = array(\n 'tgl_persetujuan_admin' => date(\"Y/m/d\"),\n 'notif' => 'Belum Dibaca',\n 'notif_rt' => 'Belum Dibaca',\n );\n\n $data_surat = array(\n 'no_registrasi' => $this->input->post('no_registrasi'),\n 'no_bulan' => $this->input->post('no_bulan'),\n 'no_tahun' => $this->input->post('no_tahun'),\n );\n\n $detailhere = $this->input->post('id_permohonan_surat');\n\n $this->m_admin->update_status_permohonan($detailhere, $data, 'permohonan_surat');\n $this->m_admin->update_nomor_admin_surat($detailhere, $data_surat, 'srt_ket_tidak_mampu');\n\n if (\n $this->m_admin->update_status_permohonan($detailhere, $data, 'permohonan_surat')\n && $this->m_admin->update_nomor_admin_surat($detailhere, $data_surat, 'srt_ket_tidak_mampu')\n ); {\n $this->session->set_flashdata('success', 'disetujui');\n redirect('admin/pilih_tanda_tangan/' . $detailhere);\n }\n }", "public function edit_toko(){\n\t}", "public function manajemen($aksi)\n\t{\n\t\tif($aksi)\n\t\t{\n\t\t\t//Trigger form submission validation rules\n\t\t\t$this->form_validation_rules();\n\n\t\t\tswitch ($aksi) {\n\t\t\t\tcase 'tambah':\n\t\t\t\t\t$data = array(\n\t\t\t\t\t'navbar_title'\t\t\t\t\t\t\t\t=> \"Manajemen Latihan Soal\",\n\t\t\t\t\t'page_title' \t\t\t\t\t\t\t\t\t=> \"Buat Latihan Soal\",\n\t\t\t\t\t'form_action' \t\t\t\t\t\t\t\t=> current_url(),\n\t\t\t\t\t'select_options_mapel'\t\t\t\t=> $this->model_adm->fetch_options_materi_pokok(),\n\t\t\t\t\t'select_options_materi_pokok'\t=> $this->model_adm->fetch_options_materi(),\n\t\t\t\t\t'submateri'\t\t\t\t\t\t\t\t\t\t=> $this->model_adm->fetch_all_materi()\n\t\t\t\t\t);\n\n\t\t\t\t\t//Form materi submit handler. See if the user is attempting to submit a form or not\n\t\t\t\t\tif($this->input->post('form_submit')) \n\t\t\t\t\t{\n\t\t\t\t\t\t//Form is submitted. Now routing to proses_tambah method\n\t\t\t\t\t\t$this->proses_tambah();\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//No form is submitted. Displaying the form page\n\t\t\t\t\t\t$this->load->view('pg_admin/latihansoal_form', $data);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t\n\t\t\t\tcase 'tambah_soal':\n\t\t\t\t\t//Passing id value from GET '?id' to variable '$id'\n\t\t\t\t\t$id = $this->input->get('id') ? $this->input->get('id') : null ;\n\n\t\t\t\t\t$data = array(\n\t\t\t\t\t\t'navbar_title'\t=> \"Manajemen Latihan Soal\",\n\t\t\t\t\t\t'page_title' \t\t=> \"Tambah Soal\",\n\t\t\t\t\t\t'form_action' \t=> current_url() . \"?id=$id\",\n\t\t\t\t\t\t'sub_materi_id' => $id\n\t\t\t\t\t);\n\n\t\t\t\t\t//Form materi submit handler. See if the user is attempting to submit a form or not\n\t\t\t\t\tif($this->input->post('form_submit')) \n\t\t\t\t\t{\n\t\t\t\t\t\t//Form is submitted. Now routing to proses_tambah method\n\t\t\t\t\t\t$this->proses_tambah_soal($id);\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//No form is submitted. Displaying the form page\n\t\t\t\t\t\t$this->load->view('pg_admin/latihansoal_detail_form', $data);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t\n\t\t\t\tcase 'ubah_soal':\n\t\t\t\t\t//Passing id value from GET '?id' to variable '$id'\n\t\t\t\t\t$id = $this->input->get('id') ? $this->input->get('id') : null ;\n\t\t\t\t\t\n\t\t\t\t\t$data = array(\n\t\t\t\t\t'navbar_title'\t=> \"Manajemen Latihan Soal\",\n\t\t\t\t\t'page_title' \t\t=> \"Ubah Latihan Soal\",\n\t\t\t\t\t'form_action' \t=> current_url() . \"?id=$id\"\n\t\t\t\t\t);\n\n\t\t\t\t\t//Redirect to materi if id is not exist\n\t\t\t\t\tif(!$id)\n\t\t\t\t\t{\n\t\t\t\t\t\tredirect('pg_admin/latihansoal/');\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//Calling values from database by id and pass them to View\n\t\t\t\t\t\t//fetching jawaban by id\n\t\t\t\t\t\t$data['data'] = $this->model_adm->fetch_soal_by_id($id);\n\n\t\t\t\t\t\t//Form materi submit handler. See if the user is attempting to submit a form or not\n\t\t\t\t\t\tif($this->input->post('form_submit')) \n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t//Form is submitted. Now routing to proses_tambah method\n\t\t\t\t\t\t\t$this->proses_ubah_soal($id);\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse \n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t//No form is submitted. Displaying the form page\n\t\t\t\t\t\t\t$this->load->view('pg_admin/latihansoal_detail_form', $data);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t\n\t\t\t\tdefault:\n\t\t\t\t\tredirect('pg_admin/materi');\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tredirect('pg_admin/materi');\n\t\t}\n\n\t}", "function set_idioma($code = 'es')\n\t{\n\t\tif ($code != '' && $code != $this->config->item('language'))\n\t\t{\n\t\t\t$this->config->set_item('language', $code);//CAMBIO EL IDIOMA DEL CONFIG\n\t\t}\n\t\t$this->session->set_userdata('idioma',$code); //adicional por hector en 30/10/2013 para sol y luna\n\t\t$this->session->set_userdata('id_idioma',$this->idioma_model->get_id($code));//AGREGADO POR HECTOR\n\t}", "public function data_pengumuman_akademik()\n\t{\n\t\t$data['data'] = $this->m_aka->data_pengumuman_akademik(); \n\t\t$data['pagination'] = $this->pagination->create_links();\n\t\t$data['content'] = 'posting_pengumuman/data_pengumuman_akademik';\n\t\t$this->load->view('content', $data);\n\t}", "public function contrato()\r\n\t{\r\n\t}", "public function tambah_toko(){\n\t}", "public function ispisiOsobu(){\n // echo \"$this->ime $this->prezime $this->godRdoj\";\n echo \"<br>Ime: \" . $this->getIme() . \"<br>Prezime: \" . $this->getPrezime() . \"<br>Godina rodjenja: \" . $this->getGodRodj() . \"<br>\";\n }", "public function hapus_kuota_matkul_pilihan(){\n\t\t$sql = $this->m_aka->hapus_kuota_matkul_pilihan();\n\t\tif($sql){\n\t\t\tredirect('c_index_aka/Kuota_mata_kuliah_pilihan');\n\t\t}\t\t\n\t}", "public function setoran_tunai()\n\t{\n\t\t$data['container'] = 'transaction/setoran_tunai';\n\t\t$data['rembugs'] = $this->model_cif->get_cm_data();\n\t\t$data['current_date'] = $this->format_date_detail($this->current_date(),'id',false,'/');\n\t\t$data['account_cash'] = $this->model_transaction->get_account_cash();\n\t\t$this->load->view('core',$data);\n\t}", "function rekamPasien(){\n\t\t$this->load->view('static/header');\n\t\t$this->load->view('static/navbar');\n\t\t$this->load->view('admin/rekam_medis',$data);\n\t\t$this->load->view('static/footer');\n\t}", "public function formulario()\n {\n //\n }", "protected function set_default_value(){\n $this->set_view('sarung/admin/index');\n $this->set_min_power( 100 );\n\t\t$this->set_title('Session');\n\t\t$this->set_body_attribute( \" class='admin admin_sarung_body' \" );\n $this->set_table_name('session');\n \n $this->set_perkiraan_santri_name( 'perkiraan_santri' );\n $this->set_session_name ( 'session_name');\n $this->set_awal_name ( 'awal_name');\n $this->set_akhir_name ( 'akhir_name' );\n $this->set_nilai_name ( 'nilai_name') ;\n $this->set_model_name ( 'model_name');\n \n }", "function pertek(){\n\t\t$id_pegawai = $this->session->userdata('pegawai_info');\n\t\t$pegawai = $this->m_profil->ini_pegawai_master($id_pegawai);\n\t\t$boleh = $this->session->userdata('boleh');\n\t\t$data['data'] = $this->m_profil->get_pertek($id_pegawai);\n\t\t\n\t\tif(!empty($data['data'])){\n\t\t\t$dok_ref = $this->m_edok->cek_dokumen($pegawai->nip_baru,\"pertek\",$data['data']->id_pertek);\n\t\t\t@$data['thumb'] = (empty($dok_ref))?\"assets/file/foto/photo.jpg\":\"assets/media/file/\".$pegawai->nip_baru.\"/pertek/thumb_\".$dok_ref[0]->file_dokumen;\n\t\t} else {\n\t\t\t$data['thumb'] = \"assets/file/foto/photo.jpg\";\n\t\t}\n\n\t\t$sess = $this->session->userdata('logged_in');\n\t\t$data['editable'] = (($sess['group_name']==\"admin\" || $sess['group_name']==\"pengelola\") && $boleh==\"ya\")?\"yes\":\"no\";\n\t\t$this->load->view('profile/pertek',$data);\n\t}", "public function luu_tt_sanpham()\n\t\t{\n\t\t\t//lay du lieu tu view \n\t\t\tif (isset($_POST['tensanpham'])&& isset($_POST['tenloaisanpham'])&& isset($_POST['img'])&& isset($_POST['mota'])&& isset($_POST['baohanh'])&& isset($_POST['gia'])){\n\t\t\t\t//goi ham luu data cua model san pham\n\t\t\t\t$this->tensanpham = $_POST['tensanpham'];\n\t\t\t\t$this->id_loaisp = $_POST['tenloaisanpham'];\n\t\t\t\t$this->img = $_POST['img'];\n\t\t\t\t$this->mota = $_POST['mota'];\n\t\t\t\t$this->baohanh = $_POST['baohanh'];\n\t\t\t\t$this->gia = $_POST['gia'];\n\t\t\t\t//goi ham luu data cua model sanpham\n\t\t\t\t$kq = $this->sanpham_model->insert_sanpham($this->tensanpham,$this->id_loaisp,$this->img,$this->mota,$this->baohanh,$this->gia);\n\t\t\t\tif ($kq) {\n\t\t\t\t\techo 'luu du lieu thanh cong -- sanphamcontroller';\n\t\t\t\t} else {\n\t\t\t\t\techo'luu du lieu that bai -- sanphamcontroller';\n\t\t\t\t}\n\t\t\t\t\n\t\t\t} else {\n\t\t\t\techo 'ban chua nhap du lieu -- sanphamcontroller';\n\t\t\t}\t\t\t\n\t\t}", "function view_surat_keputusan_pemutih_penyalur_form() {\n\t\tglobal ${$GLOBALS['session_vars']}, ${$GLOBALS['get_vars']}, $adodb;\n\t\t$field_arr = surat_keputusan_pemutih_penyalur::get_field_set();\n\n\t\t$optional_arr = $this->optional_arr;\n\t\t$optional_arr['id_surat_keputusan_pemutih_penyalur'] = 'protect';\n\n\t\t$record = array (\n\t\t\t'id_surat_keputusan_pemutih_penyalur' => ${$GLOBALS['get_vars']}['id_surat_keputusan_pemutih_penyalur']\n\t\t);\n\t\t$result = surat_keputusan_pemutih_penyalur::get($record);\n\t\t$value_arr = $result[0];\n\t\t$label_arr = $this->surat_keputusan_pemutih_penyalur_label;\n\n\t\t$sqlA = \"SELECT\n\t\tno_surat_keputusan_pemutih_penyalur,\n\t\tid_cek_pemutih\n\t\tFROM\n\t\tsurat_keputusan_pemutih_penyalur\n\t\tWHERE\n\t\tid_surat_keputusan_pemutih_penyalur ='\".$value_arr['id_surat_keputusan_pemutih_penyalur'].\"'\n\t\t\";\n\n\t\t$hasil=$adodb->Execute($sqlA);\n\t\tWHILE(! $hasil->EOF){\n\t\t\t$no_surat_keputusan_pemutih_penyalur = $hasil->fields['no_surat_keputusan_pemutih_penyalur'];\n\t\t\t$id_cek_pemutih = $hasil->fields['id_cek_pemutih'];\n\t\t$hasil->MoveNext();\n\t\t}\n\t\t\n\t\t$sqlB=\"\n\t\tselect\n\t\tsurat_keputusan_pemutih_penyalur.id_surat_keputusan_pemutih_penyalur,\n\t\tsurat_keputusan_pemutih_penyalur.no_surat_keputusan_pemutih_penyalur,\n\t\tsurat_keputusan_pemutih_penyalur.nama,\n\n\t\tsurat_keputusan_pemutih_penyalur.nip,\n\t\tpendaftar_pemutih_penyalur.alamat_pendaftar_pemutih_penyalur,\n\t\tpendaftar_pemutih_penyalur.nama_pabrik,\n\t\tpendaftar_pemutih_penyalur.npwp,\n\t\tpendaftar_pemutih_penyalur.namapenanggungjwb,\n\t\tpendaftar_pemutih_penyalur.alamatgudang,\n\t\tpendaftar_pemutih_penyalur.alamat_bengkel,\n\t\tpendaftar_pemutih_penyalur.alamat_pabrik,\n\t\tpendaftar_pemutih_penyalur.nama_propinsi_1,\n\t\tpendaftar_pemutih_penyalur.nama_propinsi_2,\n\t\tpendaftar_pemutih_penyalur.nama_direktur,\n\n\t\t\n\t\ttt_pemutih_penyalur.urut_no_tt,\n\t\ttt_pemutih_penyalur.kode_subdit,\n\t\ttt_pemutih_penyalur.date_insert,\n\t\tcek_pemutih_penyalur.no_rekomendasi,\n\t\tcek_pemutih_penyalur.date_rekomendasi,\n\t\tcek_pemutih_penyalur.nama_produk,\n\t\tcek_pemutih_penyalur.no_pemohon,\n\t\tcek_pemutih_penyalur.date_pemohon,\n\t\tcek_pemutih_penyalur.no_bap,\n\t\tcek_pemutih_penyalur.date_bap\n\t\tfrom\n\t\tsurat_keputusan_pemutih_penyalur\n\t\tLEFT OUTER JOIN cek_pemutih_penyalur ON(cek_pemutih_penyalur.id_cek_pemutih = surat_keputusan_pemutih_penyalur.id_cek_pemutih)\n\t\tLEFT OUTER JOIN tt_pemutih_penyalur ON(tt_pemutih_penyalur.no_tt = cek_pemutih_penyalur.no_tt)\n\t\tLEFT OUTER JOIN pendaftar_pemutih_penyalur ON(pendaftar_pemutih_penyalur.kode_pendaftar_pemutih_penyalur = tt_pemutih_penyalur.kode_pendaftar_pemutih_penyalur)\n\t\tWHERE\n\t\tsurat_keputusan_pemutih_penyalur.id_cek_pemutih = '\".$id_cek_pemutih.\"'\n\t\t\";\n\t\t//print $sqlB;\n\t\t$rsb = $adodb->Execute($sqlB);\n\t\t$golongan = $rsb->fields['golongan'];\n\t\t$nama_produk = $rsb->fields['nama_produk'];\n\t\t\n\t\t$no_surat_keputusan = $rsb->fields['no_surat_keputusan_pemutih_penyalur'];\n\t\t\n\t\t$nama_perusahaan = $rsb->fields['nama_pabrik'];\n\t\t\n\t\t$nama_propinsi_1 = $rsb->fields['nama_propinsi_1'];\n\t\t$alamat_pendaftar = $rsb->fields['alamat_pendaftar'];\n\t\t$urut_no_tt = $rsb->fields['urut_no_tt'];\n\t\t$nama_penanggung = $rsb->fields['namapenanggungjwb'];\n\t\t$alamat_gudang = $rsb->fields['alamatgudang'];\n\t\t$alamat_pendaftar_pemutih_penyalur = $rsb->fields['alamat_pendaftar_pemutih_penyalur'];\n\t\t$alamat_bengkel = $rsb->fields['alamat_bengkel'];\n\t\t$nama_direktur = $rsb->fields['nama_direktur'];\n\t\t$date_insert = date('d M Y',$rsb->fields['date_insert']);\n\t\t$no_rekomendasi = $rsb->fields['no_rekomendasi'];\n\t\t$no_pemohon = $rsb->fields['no_pemohon'];\n\t\t$date_pemohon = date('d M Y',$rsb->fields['date_pemohon']);\n\t\t$alamat_pabrik = $rsb->fields['alamat_pabrik'];\n\t\t$nama_propinsi_2 = $rsb->fields['nama_propinsi_2'];\n\t\t$date_rekomendasi = date('d M Y',$rsb->fields['date_rekomendasi']);\n\t\t$no_bap = $rsb->fields['no_bap'];\n\t\t$npwp = $rsb->fields['npwp'];\n\t\t$date_bap = date('d M Y',$rsb->fields['date_bap']);\n\t\t$kode_subdit = $rsb->fields['kode_subdit'];\n\t\t$nama = $rsb->fields['nama'];\n\t\t$nip = $rsb->fields['nip'];\n\n\t\t$rsS = $adodb->Execute(\"SELECT keterangan FROM subdit where id_subdit = '\".$kode_subdit.\"'\");\n\t\t$ketS = $rsS->fields[keterangan];\n\n\t\t\n\t\t\n\n\t\tdefine('FPDF_FONTPATH','fpdf/font/');\n\t\trequire('fpdf/fpdf.php');\n\t\t$pdf=new FPDF('P','mm','legal');\n\t\t$pdf->Open();\n\t\t$pdf->AddPage();\n\t\t$pdf->Ln(30);\n\t\t$pdf->SetFont('Arial','B',12);\n\t\t$pdf->Cell(180,7,'KEPUTUSAN MENTERI KESEHATAN REPUBLIK INDONESIA','',0,'C');\n\t\t$pdf->Ln(5);\n\t\t$pdf->Cell(180,7,'NOMOR : '.$no_surat_keputusan.'','',0,'C');\n\t\t$pdf->SetFont('Arial','B',12);\n\t\t$pdf->Ln(10);\n\t\t$pdf->Cell(180,7,'TENTANG','',0,'C');\n\t\t$pdf->Ln(5);\n\t\t$pdf->Cell(180,7,'IZIN PENYALURAN ALAT KESEHATAN','',0,'C');\n\t\t$pdf->Ln(5);\n\t\t$pdf->Cell(180,7,'MENTERI KESEHATAN REPUBLIK INDONESIA','',0,'C');\n\t\t$pdf->Ln(20);\n\t\t$pdf->SetFont('Arial','',12);\n\t\t$pdf->Cell(25,7,'MEMBACA','',0,'L');$pdf->Cell(5,7,' : ','',0,'L');$pdf->Cell(150,7,'1. Surat pemohonan Izin Produksi '.$nama_perusahaan.', '.$alamat_pendaftar_pemutih_penyalur.' '.$no_pemohon.'',0,'L');\n\t\t$pdf->Ln();\n\t\t$pdf->Cell(30,7,'','',0,'L');$pdf->Cell(150,7,' tanggal '.$date_pemohon.' perihal permohonan pembaharuan Izin ',0,'L');\n\t\t$pdf->Ln();\n\t\t$pdf->Cell(30,7,'','',0,'L');$pdf->Cell(150,7,' Penyalur Alat Kesehatan',0,'L');\n\t\t$pdf->Ln();\n\t\t$pdf->Cell(30,7,'','',0,'L');$pdf->Cell(150,7,'2. Keputusan Direktorat Jendral POM Departemen Kesehatan RI '.$no_rekomendasi.'',0,'L');\n\t\t$pdf->Ln();\n\t\t$pdf->Cell(30,7,'','',0,'L');$pdf->Cell(150,7,' tanggal '.$date_rekomendasi.' tentang Izin Penyalur Alat Kesehatan',0,'L');\n\t\t$pdf->Ln();\n\t\t$pdf->Cell(30,7,'','',0,'L');$pdf->Cell(150,7,' yang diberikan kepada '.$nama_perusahaan.', '.$alamat_pendaftar_pemutih_penyalur.' .',0,'L');\n\t\t$pdf->Ln(10);\n\t\t$pdf->Cell(25,7,'MENIMBANG','',0,'L');$pdf->Cell(5,7,' : ','',0,'L');$pdf->Cell(160,7,'1. Bahwa permohonan '.$nama_perusahaan.' tersebut telah memenuhi',0,'L');\n\t\t$pdf->Ln();\n\t\t$pdf->Cell(30,7,'','',0,'L');$pdf->Cell(150,7,' persyaratan dan dapat disetujui.',0,'L');\n\t\t$pdf->Ln();\n\t\t$pdf->Cell(30,7,'','',0,'L');$pdf->Cell(150,7,'2. Bahwa oleh karena itu dianggap perlu menerbitkan izin Penyalur',0,'L');\n\t\t$pdf->Ln();\n\t\t$pdf->Cell(30,7,'','',0,'L');$pdf->Cell(150,7,' Alat Kesehatan untuk yang bersangkutan',0,'L');\n\t\t$pdf->Ln(10);\n\t\t\n\n\t\t$pdf->Cell(25,7,'MENGINGAT','',0,'L');$pdf->Cell(5,7,' : ','',0,'L');$pdf->Cell(150,7,'1. Undang-undang No.23 Tahun 1992 tentang Kesehatan (Lembaran Negara',0,'L');\n\t\t$pdf->Ln();\n\t\t$pdf->Cell(30,7,'','',0,'L');$pdf->Cell(150,7,' Tahun 1992 No. : 100; Tambahan Lembaga Negara No.3495).',0,'L');\n\t\t$pdf->Ln();\n\t\t$pdf->Cell(30,7,'','',0,'L');$pdf->Cell(150,7,'2. Keputusan Presiden RI No. 102.Tahun 2001 Tentang Kedudukan, Tugas,',0,'L');\n\t\t$pdf->Ln();\n\t\t$pdf->Cell(30,7,'','',0,'L');$pdf->Cell(150,7,' Fungsi, Kewenangan, Susunan Organisasi dan Tata Kerja Departemen.',0,'L');\n\t\t$pdf->Ln();\n\n\n\t\t$pdf->Cell(30,7,'','',0,'L');$pdf->Cell(150,7,'3. Keputusan Menteri Kesehatan No. 1277/Menkes/SK/XI/2001 tahun',0,'L');\n\t\t$pdf->Ln();\n\t\t$pdf->Cell(30,7,'','',0,'L');$pdf->Cell(150,7,' 2001 tentang Organisasi dan Tata Kerja Departemen Kesehatan ',0,'L');\n\t\t$pdf->Ln();\n\t\t$pdf->Cell(30,7,'','',0,'L');$pdf->Cell(150,7,'4. Peraturan Menteri Kesehatan Republik Indonesia Nomor :,',0,'L');\n\t\t$pdf->Ln();\n\t\t$pdf->Cell(30,7,'','',0,'L');$pdf->Cell(150,7,' 142/Menkes/Per/III/1991 Tanggal 4 Maret 1991 tentang Penyalur',0,'L');\n\t\t$pdf->Ln();\n\t\t$pdf->Cell(30,7,'','',0,'L');$pdf->Cell(150,7,' Alat Kesehatan.',0,'L');\n\n\t\t$pdf->Ln(10);\n\t\t$pdf->Cell(180,7,'MEMUTUSKAN','',0,'C');\n\t\t$pdf->Ln();\n\t\t$pdf->Cell(20,7,'MENETAPKAN','',0,'L');$pdf->Cell(5,7,' : ','',0,'L');\n\t\t$pdf->Ln();\n\t\t$pdf->Cell(15,7,'Pertama','',0,'L');$pdf->Cell(5,7,' : ','',0,'L');$pdf->Cell(160,7,'Memberikan Izin '.$keterangan1.' Kepada :','',0,'L');\n\t\t$pdf->Ln();\n\t\t$pdf->Cell(20,7,'','',0,'L');$pdf->Cell(45,7,'Nama perusahaan','',0,'L');$pdf->Cell(5,7,' : ','',0,'L');$pdf->Cell(110,7,''.$nama_perusahaan.'','',0,'L');\n\t\t$pdf->Ln();\n\t\t$pdf->Cell(20,7,'','',0,'L');$pdf->Cell(45,7,'NPWP','',0,'L');$pdf->Cell(5,7,' : ','',0,'L');$pdf->Cell(110,7,''.$npwp.'','',0,'L');\n\t\t$pdf->Ln();\n\t\t$pdf->Cell(20,7,'','',0,'L');$pdf->Cell(45,7,'Alamat Perusahaan','',0,'L');$pdf->Cell(5,7,' : ','',0,'L');$pdf->Cell(110,7,''.$alamat_pabrik.'','',0,'L');\n\t\t$pdf->Ln();\n\t\t$pdf->Cell(20,7,'','',0,'L');$pdf->Cell(45,7,'Nama Direktur/Pimpinan','',0,'L');$pdf->Cell(5,7,' : ','',0,'L');$pdf->Cell(110,7,''.$nama_direktur.'','',0,'L');\n\t\t$pdf->Ln();\n\t\t$pdf->Cell(20,7,'','',0,'L');$pdf->Cell(45,7,'Nama Penanggung','',0,'L');\n\t\t$pdf->Ln();\n\t\t$pdf->Cell(20,7,'','',0,'L');$pdf->Cell(45,7,'Jawab Teknis','',0,'L');$pdf->Cell(5,7,' : ','',0,'L');$pdf->Cell(110,7,''.$nama_penanggung.'','',0,'L');\n\t\t$pdf->Ln();\n\t\t$pdf->Cell(20,7,'','',0,'L');$pdf->Cell(45,7,'Alamat Gudang','',0,'L');$pdf->Cell(5,7,' : ','',0,'L');$pdf->Cell(110,7,''.$alamat_gudang.'','',0,'L');\n\t\t$pdf->Ln();\n\t\t$pdf->Cell(20,7,'','',0,'L');$pdf->Cell(45,7,'Alamat ','',0,'L');$pdf->Cell(5,7,' : ','',0,'L');$pdf->Cell(110,7,''.$alamat_bengkel.'','',0,'L');\n\t\t$pdf->Ln();\n\t\t$pdf->Cell(20,7,'','',0,'L');$pdf->Cell(45,7,'Bengkel/Workshop ','',0,'L');\n\t\t$pdf->Ln();\n\t\t$pdf->Cell(20,7,'','',0,'L');$pdf->Cell(150,7,'Dengan ketentuan sebagai berikut : ','',0,'L');\n\t\t$pdf->Ln();\n\t\t$pdf->Cell(20,7,'','',0,'L');$pdf->Cell(150,7,'1. Harus selalu diawasi oleh Penanggung Jawab Teknis yang namanya','',0,'L');\n\t\t$pdf->Ln();\n\t\t$pdf->Cell(20,7,'','',0,'L');$pdf->Cell(150,7,' tercantum pada surat keputusan ini.','',0,'L');\n\t\t$pdf->Ln();\n\t\t$pdf->Cell(20,7,'','',0,'L');$pdf->Cell(150,7,'2. Harus mematuhi peraturan perundang-undangan yang berlaku.','',0,'L');\n\n\t\t$pdf->AddPage();\n\t\t$pdf->Ln(30);\n\t\t$pdf->Cell(20,7,'','',0,'L');$pdf->Cell(150,7,'3. Melaksanakan dokumentasi pengadaan, penyimpanan dan penyaluran','',0,'L');\n\t\t$pdf->Ln();\n\t\t$pdf->Cell(20,7,'','',0,'L');$pdf->Cell(150,7,' alat kesehatan dengan sebaik-baiknya sesuai ketentuan yang berlaku.','',0,'L');\n\t\t$pdf->Ln();\n\t\t$pdf->Cell(20,7,'','',0,'L');$pdf->Cell(150,7,'4. Izin Penyalur Alat Kesehatan berlaku untuk seterusnya selama','',0,'L');\n\t\t$pdf->Ln();\n\t\t$pdf->Cell(20,7,'','',0,'L');$pdf->Cell(150,7,' perusahaan Penyalur Alat Kesehatan yang bersangkutan masih aktif','',0,'L');\n\t\t$pdf->Ln();\n\t\t$pdf->Cell(20,7,'','',0,'L');$pdf->Cell(150,7,' melakukan kegiatan usahanya dan berlaku untuk seluruh Wilayah','',0,'L');\n\t\t$pdf->Ln();\n\t\t$pdf->Cell(20,7,'','',0,'L');$pdf->Cell(150,7,' Republik Indonesia.','',0,'L');\n\t\t$pdf->Ln(10);\n\t\t$pdf->Cell(15,7,'Kedua','',0,'L');$pdf->Cell(5,7,' : ','',0,'L');$pdf->Cell(160,7,'Dengan dikeluarkannya keputusan ini, maka keputusan Direktur Jenderal','',0,'L');\n\t\t$pdf->Ln();\n\t\t$pdf->Cell(20,7,'','',0,'L');$pdf->Cell(160,7,' Pengawasan Obat dan Makanan Depkes RI '.$no_rekomendasi.' tanggal ','',0,'L');\n\t\t$pdf->Ln();\n\t\t$pdf->Cell(20,7,'','',0,'L');$pdf->Cell(160,7,' '.$date_rekomendasi.' tentang Izin Penyalur alat Kesehatan yang diberikan kepada ','',0,'L');\n\t\t$pdf->Ln();\n\t\t$pdf->Cell(20,7,'','',0,'L');$pdf->Cell(160,7,\t\t\t' '.$nama_perusahaan.' dinyatakan tidak berlaku lagi. ','',0,'L');\n\t\t$pdf->Ln();\n\t\t$pdf->Cell(15,7,'Ketiga','',0,'L');$pdf->Cell(5,7,' : ','',0,'L');$pdf->Cell(160,7,'Surat Keputusan ini berlaku sejak tanggal ditetapkan dengan catatan,','',0,'L');\n\t\t$pdf->Ln();\n\t\t$pdf->Cell(20,7,'','',0,'L');$pdf->Cell(160,7,'bahwa akan diadakan peninjauan atau perubahan sebagaimana','',0,'L');\n\t\t$pdf->Ln();\n\t\t$pdf->Cell(20,7,'','',0,'L');$pdf->Cell(160,7,'mestinya apabila terdapat kekurangan atau kekeliruan dalam penetapan ini.','',0,'L');\n\t\t$pdf->Ln(10);\n\n\t\t$pdf->Ln(20);\n\t\t$pdf->Cell(100,7,'','',0,'L');$pdf->Cell(30,7,'Ditetapkan di','',0,'L');$pdf->Cell(60,7,' : J a k a r t a ','',0,'L');\n\t\t$pdf->Ln();\n\t\t$tg = date('d M Y');\n\t\t$pdf->Cell(100,7,'','',0,'L');$pdf->Cell(30,7,'Pada tanggal','B',0,'L');$pdf->Cell(40,7,' : '.$tg.'','B',0,'L');\n\t\t$pdf->Ln();\n\t\t$pdf->SetFont('Arial','B',12);\n\t\t$date_bap = date('d M Y');\n\t\t$kode_subdit = $rsb->fields['kode_subdit'];\n\n\t\t$pdf->Cell(80,7,'','',0,'L');$pdf->Cell(100,7,'a.n MENTERI KESEHATAN REPUBLIK INDONESIA','',0,'C');\n\t\t$pdf->Ln();\n\t\t$pdf->Cell(80,7,'','',0,'L');$pdf->Cell(100,7,'DIREKTUR JENDERAL PELAYANAN','',0,'C');\n\t\t$pdf->Ln();\n\t\t$pdf->Cell(80,7,'','',0,'L');$pdf->Cell(100,7,'KEFARMASIAN DAN ALAT KESEHATAN','',0,'C');\n\t\t$pdf->Ln();\n\t\t$pdf->Cell(80,7,'','',0,'L');$pdf->Cell(100,7,'u.b. DIREKTUR BINA PRODUKSI DAN DISTRIBUSI','',0,'C');\n\t\t$pdf->Ln();\n\t\t$pdf->Cell(80,7,'','',0,'L');$pdf->Cell(100,7,'ALAT KESEHATAN','',0,'C');\n\t\t$pdf->Ln(30);\n\t\t$pdf->Cell(80,7,'','',0,'L');$pdf->Cell(10,7,'','',0,'L');$pdf->Cell(80,7,''.$nama.'','B',0,'C');$pdf->Cell(10,7,'','',0,'L');\n\t\t$pdf->Ln();\n\t\t$pdf->Cell(80,7,'','',0,'L');$pdf->Cell(10,7,'','',0,'L');$pdf->Cell(80,7,'NIP .'.$nip.'','',0,'C');$pdf->Cell(10,7,'','',0,'L');\n\t\t$pdf->Ln(10);\n\t\t$pdf->SetFont('Arial','',12);\n\t\t$pdf->Cell(80,7,'Salinan Keputusan ini disampaikan kepada Yth :','B',0,'L');\n\t\t$pdf->Ln();\n\t\t$pdf->Cell(180,7,'1. Dirjen Yan Far dan Alkes (sebagai laporan)','',0,'L');\n\t\t$pdf->Ln();\n\t\t$pdf->Cell(180,7,'2. Ka Dinas Kesehatan prop. '.$alamat_pendaftar_pemutih_penyalur.'','',0,'L');\n\t\t$pdf->Ln();\n\t\t$pdf->Cell(180,7,'3. Dit.Jen Bea dan Cukai Dep Keuangan RI di jakarta','',0,'L');\n\t\t$pdf->Ln();\n\t\t$pdf->Cell(180,7,'4. Dep. Perindag RI di Jakarta','',0,'L');\n\t\t$pdf->Ln();\n\t\t$pdf->Cell(180,7,'5. Arsip','',0,'L'); \n\t\t\n\n\t\t$pdf->AddPage();\n\t\t$pdf->Ln(30);\n\t\t$pdf->SetFont('Arial','B',12);\n\t\t$pdf->Cell(180,7,'KEPUTUSAN MENTERI KESEHATAN REPUBLIK INDONESIA','',0,'C');\n\t\t$pdf->Ln();\n\t\t$pdf->SetFont('Arial','',12);\n\t\t$pdf->Cell(180,7,''.$no_surat_keputusan.' Tanggal '.$tg.'','',0,'C');\n\t\t$pdf->Ln(10);\n\t\t$pdf->SetFont('Arial','',12);\n\t\t$pdf->Cell(180,7,'DIIZINKAN UNTUK MENYALURKAN ALAT KESEHATAN PRODUKSI DARI : ','',0,'L');\n\t\t$pdf->Ln();\n\t\t$pdf->Cell(180,7,''.$nama_produk.'','',0,'L');\n\t\t$pdf->Ln(10);\n\t\t$pdf->Cell(180,7,'Dengan ketentuan bahwa alat kesehatan tersebut harus mendapatkan persetujuan izinr','',0,'L');\n\t\t$pdf->Ln();\n\t\t$pdf->Cell(180,7,'edar sebelum di edarkan',0,'L');\n\t\t$pdf->Ln(10);\n\t\t$pdf->Cell(80,7,'','',0,'L');$pdf->Cell(100,7,'a.n MENTERI KESEHATAN REPUBLIK INDONESIA','',0,'C');\n\t\t$pdf->Ln();\n\t\t$pdf->Cell(80,7,'','',0,'L');$pdf->Cell(100,7,'DIREKTUR JENDERAL PELAYANAN','',0,'C');\n\t\t$pdf->Ln();\n\t\t$pdf->Cell(80,7,'','',0,'L');$pdf->Cell(100,7,'KEFARMASIAN DAN ALAT KESEHATAN','',0,'C');\n\t\t$pdf->Ln();\n\t\t$pdf->Cell(80,7,'','',0,'L');$pdf->Cell(100,7,'u.b. DIREKTUR BINA PRODUKSI DAN DISTRIBUSI','',0,'C');\n\t\t$pdf->Ln();\n\t\t$pdf->Cell(80,7,'','',0,'L');$pdf->Cell(100,7,'ALAT KESEHATAN','',0,'C');\n\t\t$pdf->Ln(30);\n\t\t$pdf->Cell(80,7,'','',0,'L');$pdf->Cell(10,7,'','',0,'L');$pdf->Cell(80,7,''.$nama.'','B',0,'C');$pdf->Cell(10,7,'','',0,'L');\n\t\t$pdf->Ln();\n\t\t$pdf->Cell(80,7,'','',0,'L');$pdf->Cell(10,7,'','',0,'L');$pdf->Cell(80,7,'NIP .'.$nip.'','',0,'C');$pdf->Cell(10,7,'','',0,'L');\n\t\t$pdf->Ln();\n\t\t$pdf->Output();\n\n\n\t\t$_form = $lamp;\n\n\t\treturn $_form;\n\t}", "public function pretragaIdeja(){\n $data['kor_ime']=$this->session->get('kor_tip');\n $idejaModel=new IdejaModel();\n $korisnik= $this->request->getVar(\"pretraga\");\n $ideje=$idejaModel->dohvati_ideje_po_korisnickom_imenu($korisnik);\n $data['ideje']=$ideje;\n $this->prikaz('pregled_ideja', $data);\n }", "public function o_nama()\n {\n $this->show('o_nama',[]);\n }", "function index() {\n $konten['tabel'] = DB_GALERI;\n $konten['kolom'] = array(\"Kode\", \"Judul Photo\", \"Photo\", \"Album\", \"Status\", \"Tanggal\", \"\");\n $konten['breadcum'] = 'Galeri/Album';\n $konten['smenu'] = 'media';\n $konten['sbmenu'] = 'galeri';\n $konten['css'] = 'galeri/css';\n $konten['js'] = 'galeri/js';\n $konten['header'] = 'included/header';\n $konten['footer'] = 'included/footer';\n $konten['target'] = 'galeri/index';\n /*\n * Memanggil role untuk menu aktif\n */\n $konten['menuinfo'] = $this->libglobal->getMenuID($this->uri->uri_string, $_SESSION['role_id'], 'ad_menu_admin');\n $this->load->view('default_admin', $konten);\n }", "public function aksi_setujui_permohonan_002()\n {\n $data = array(\n 'tgl_persetujuan_admin' => date(\"Y/m/d\"),\n 'notif' => 'Belum Dibaca',\n 'notif_rt' => 'Belum Dibaca',\n );\n\n $data_surat = array(\n 'no_registrasi' => $this->input->post('no_registrasi'),\n 'no_bulan' => $this->input->post('no_bulan'),\n 'no_tahun' => $this->input->post('no_tahun'),\n );\n\n $detailhere = $this->input->post('id_permohonan_surat');\n\n $this->m_admin->update_status_permohonan($detailhere, $data, 'permohonan_surat');\n $this->m_admin->update_nomor_admin_surat($detailhere, $data_surat, 'srt_ket_domisili');\n\n if (\n $this->m_admin->update_status_permohonan($detailhere, $data, 'permohonan_surat')\n && $this->m_admin->update_nomor_admin_surat($detailhere, $data_surat, 'srt_ket_domisili')\n ); {\n $this->session->set_flashdata('success', 'disetujui');\n redirect('admin/pilih_tanda_tangan/' . $detailhere);\n }\n }", "public function aksi_setujui_permohonan_003()\n {\n $data = array(\n 'tgl_persetujuan_admin' => date(\"Y/m/d\"),\n 'notif' => 'Belum Dibaca',\n 'notif_rt' => 'Belum Dibaca',\n );\n\n $data_surat = array(\n 'no_registrasi' => $this->input->post('no_registrasi'),\n 'no_bulan' => $this->input->post('no_bulan'),\n 'no_tahun' => $this->input->post('no_tahun'),\n );\n\n $detailhere = $this->input->post('id_permohonan_surat');\n\n $this->m_admin->update_status_permohonan($detailhere, $data, 'permohonan_surat');\n $this->m_admin->update_nomor_admin_surat($detailhere, $data_surat, 'srt_ket_belum_memiliki_rumah');\n\n if (\n $this->m_admin->update_status_permohonan($detailhere, $data, 'permohonan_surat')\n && $this->m_admin->update_nomor_admin_surat($detailhere, $data_surat, 'srt_ket_belum_memiliki_rumah')\n ); {\n $this->session->set_flashdata('success', 'disetujui');\n redirect('admin/pilih_tanda_tangan/' . $detailhere);\n }\n }", "public function cetak_pengadaan()\n {\n $data['row'] = $this->Pengadaan_Model->ambil_pengadaan_brg()->result();\n\n\n $this->template->load('template', 'laporan/laporan_pengadaan/form_pengadaan', $data);\n }", "public function mostra(){\n }", "function realizarHomologacionPendientes(){ \n $this->mostrarFormularioProyecto();\n }", "function cariDataBarang_md41($nmbarang=\"\") {\n\t\t$grid = new GridConnector($this->db->conn_id);\n $grid->render_sql(\"select id,idgroup_barang,concat(nmbarang, ' ',nmwarna) as nmbarang,idsatuan from v_master_barang_detail where is_active = '1' and sts_jual = '1' and nmbarang like '%\".$nmbarang.\"%' group by idgroup_barang\",\"id\",\"idgroup_barang,nmbarang,idsatuan\");\n\t}", "public function absen(){\n\t\t\t$id_kelas = $this->input->post('id_kelas');\n\t\t\t$keterangan = $this->input->post('keterangan');\n\t\t\t$tanggal = $this->input->post('tanggal');\n\t\t\t$sesi = $this->input->post('sesi');\n\n\t\t\t$presensiInfo = array(\n\t\t\t\t'id_kelas'=>$id_kelas,\n\t\t\t\t'tgl_pertemuan'=>$tanggal,\n\t\t\t\t'keterangan'=>$keterangan,\n\t\t\t\t'sesi'=>$sesi,\n\t\t\t\t'status_pertemuan'=>'Tidak Hadir',\n\t\t\t\t\"createDtm\"=>date('Y-m-d H:s:i')\n\t\t\t);\n\n\t\t\t//get id_pertemuan yang barusaja dibuat\n\t\t\t$result = $this->JadwalAkademikM->presensi($presensiInfo);\n\n\t\t\tif($result > 0){\n\t\t\t\t$this->session->set_flashdata('success','Presensi berhasil dibuat');\n\t\t\t}else{\n\t\t\t\t$this->session->set_flashdata('error','Presensi gagal dibuat');\n\t\t\t}\n\n\t\t\tredirect('jadwalAkademikR');\n\t\t}", "public function __construct() {\n parent::__construct();\n //$this->load->library('session');\n \n $this->opd = $this->t_simas_model->load_singel('tb_var_global', 'item','opd');\n $this->menu = $this->t_simas_model->load_data('tb_menu', 'aktif', 1, 'idx');\n foreach ($this->menu as $nm_menu) {\n $this->nm_menu[$nm_menu->idx] = $nm_menu->nm_menu;\n }\n $this->unker = $this->t_simas_model->load_data('tb_unker');\n foreach ($this->unker as $ref_unker) {\n if($ref_unker->nm_unker == \"Sekretariat\"){\n $this->ref_unker[$ref_unker->kd_unker] = \"Sekretaris\"; \n }else{\n if($ref_unker->kese !== '99'){\n $this->ref_unker[$ref_unker->kd_unker] = \"Kepala \".$ref_unker->nm_unker;\n }else{\n $this->ref_unker[$ref_unker->kd_unker] = $ref_unker->nm_unker;\n }\n \n }\n }\n\n $this->field = array('2' => ['kd_jns_surat', 'nomor_urut', 'nomor_surat', 'tgl_surat', 'asal','perihal'], '3'=> ['kd_jns_surat','nomor_surat', 'tgl_surat','sifat','tgl_terima','asal','perihal','cp'], '4'=> ['kd_jns_surat','nomor_urut', 'nomor_surat', 'tgl_surat', 'nomor_sisip', 'asal_bidang', 'tujuan', 'perihal','ref_surat_masuk','nomor_nodin', 'tgl_nodin'], '5' => ['tgl_disposisi','ref_surat_masuk','kd_unker_asal','kd_unker_tujuan', 'isi'], '6' => ['nip', 'glr_dpn', 'glr_blk', 'nama', 'tmpt_lhr', 'tgl_lhr', 'kd_jab', 'tmt_jab','kd_pangkat', 'tmt_pangkat','kd_pangkat_cpns', 'tmt_cpns', 'tmt_kgb', 'uname', 'password','pmk_thn', 'pmk_bln','cpns_ms_thn', 'cpns_ms_bln']);\n\n $this->pangkat = array('111' => \"Juru Muda (I/a)\", '112' => \"Juru Muda Tk.I (I/b)\", '113' => \"Juru (I/c)\", '114' => \"Juru Tk.I (I/d)\", '121' => \"Pengatur Muda (II/a)\", '122' => \"Pengatur Muda Tk.I (II/b)\", '123' => \"Pengatur (II/c)\", '124' => \"Pengatur Tk.I (II/d)\", '131' => \"Penata Muda (III/a)\", '132' => \"Penata Muda Tk.I (III/b)\", '133' => \"Penata (III/c)\", '134' => \"Penata Tk.I (III/d)\", '141' => \"Pembina (IV/a)\", '142' => \"Pembina Tk.I (IV/b)\", '143' => \"Pembina Utama Muda (IV/c)\", '144' => \"Pembina Utama (IV/d)\", '145' => \"Pembina Utama Madya (IV/e)\");\n\n $this->thn_global = date('Y');\n\n date_default_timezone_set(\"Asia/Bangkok\"); \n }", "public function form_ubah_surat_keluar($id_sk)\n {\n $data['admin'] = $this->db->get_where('admin', ['id_admin' =>\n $this->session->userdata('id_admin')])->row_array();\n $data['jumlah_pesan_masuk'] = $this->m_admin->jumlah_pesan_masuk()->result();\n $data['jumlah_permohonan_masuk'] = $this->m_admin->jumlah_permohonan_masuk()->result();\n $data['jumlah_pesan_masuk'] = $this->m_admin->jumlah_pesan_masuk()->result();\n\n $detailhere = array('id_sk' => $id_sk);\n $data_detail['detail_surat_keluar'] = $this->m_admin->get_detail_surat_keluar($detailhere, 'surat_keluar')->result();\n\n $this->load->view('header');\n $this->load->view('admin/sidebar_admin');\n $this->load->view('topbar', $data);\n $this->load->view('admin/form_ubah_surat_keluar', $data_detail);\n $this->load->view('footer');\n }", "public function displaymahasiswa()\r\n {\r\n $query = \"select * from data_mahasiswa\";\r\n return $this->db->query($query);\r\n }" ]
[ "0.67695", "0.6505029", "0.63819915", "0.6369578", "0.63546747", "0.6341677", "0.63372165", "0.6325998", "0.6300693", "0.62723655", "0.626358", "0.62395555", "0.621043", "0.61971086", "0.6195045", "0.6194499", "0.61699516", "0.6169709", "0.6168794", "0.6150389", "0.6128168", "0.61034095", "0.60965395", "0.6074357", "0.6065189", "0.60628515", "0.6061351", "0.6052827", "0.6039887", "0.6021206", "0.6020802", "0.60110956", "0.6002583", "0.6000263", "0.59859836", "0.59829444", "0.59809583", "0.5979969", "0.59753734", "0.59708136", "0.5965908", "0.5965099", "0.5963004", "0.59607846", "0.59561706", "0.5942115", "0.5928581", "0.59140885", "0.59119004", "0.5900308", "0.5899885", "0.5889332", "0.588895", "0.5881371", "0.5876291", "0.5872371", "0.5870518", "0.5867679", "0.58663917", "0.5848495", "0.58475506", "0.5846308", "0.5837144", "0.58316886", "0.58240956", "0.5823408", "0.5822066", "0.5821709", "0.5821276", "0.5821269", "0.5821005", "0.5820002", "0.58178276", "0.5817512", "0.5812399", "0.5808381", "0.58080125", "0.58073425", "0.5807181", "0.580659", "0.58051014", "0.5804967", "0.5803502", "0.57861656", "0.578152", "0.57736415", "0.57731766", "0.5772798", "0.5770985", "0.57646006", "0.57613516", "0.57590705", "0.5757942", "0.5755426", "0.57531565", "0.5745032", "0.57434756", "0.5740201", "0.57398605", "0.57387483", "0.57377183" ]
0.0
-1
Display a listing of the resource.
public function index() { // }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function indexAction()\n {\n $limit = $this->Request()->getParam('limit', 1000);\n $offset = $this->Request()->getParam('start', 0);\n $sort = $this->Request()->getParam('sort', array());\n $filter = $this->Request()->getParam('filter', array());\n\n $result = $this->resource->getList($offset, $limit, $filter, $sort);\n\n $this->View()->assign($result);\n $this->View()->assign('success', true);\n }", "public function listing();", "function index() {\n\t\t$this->show_list();\n\t}", "public function actionList() {\n $this->_getList();\n }", "public function listAction()\n {\n $model = $this->_getPhotoModel();\n $entries = $model->fetchEntries($this->_getParam('page', 1));\n\n $this->view->url = 'http://' . $this->_request->getHttpHost() . $this->_request->getBaseUrl(); \n $this->view->paginator = $entries;\n }", "public function index()\n {\n $items = Item::all();\n return ItemForShowResource::collection($items);\n }", "public function index()\n {\n return Resource::collection(($this->getModel())::paginate(10));\n }", "function index()\n\t{\n\t\t$this->_list();\n\t\t$this->display();\n\t}", "public function listingAction(){\n if (!LoginHelper::isAdmin()){\n Router::redirect('home', '<p class=\"alert alert-danger\">Unauthorized</p>');\n }\n $this->view->render('patient/list', Patient::all());\n }", "public function index()\n {\n //\n $list = $this->obj->all();\n\n return $this->render('index', compact('list'));\n }", "public function action_index()\n\t{\n\t\t$this->template->title = 'Resources';\n\t\t$this->view = View::factory('admin/resource/index');\n\t\t$this->template->scripts[] = 'media/js/jquery.tablesorter.min.js';\n\t\t$this->template->scripts[] = 'media/js/admin/resource.js';\n\t\t\n\t\t$resources = Sprig::factory('resource')->load(NULL, FALSE);\n\t\tif (!empty($resources))\n\t\t{\n\t\t\t$this->view->resources = $resources->as_array();\n\t\t}\n\t}", "function listing()\n\t\t{\n\t\t// en $this->_view->_listado para poder acceder a el desde la vista.\n\t\t\t$this->_view->_listado = $listado = $this->_instrumentoModel->getInstrumento();\n\t\t\t$this->_view->render('listing', '', '',$this->_sidebar_menu);\n\t\t}", "public function listAction()\n {\n $em = $this->getDoctrine()->getManager();\n \n $todos = $em->getRepository(Todo::class)->findAll();\n \n return $this->render('todo/index.html.twig', array(\n 'todos' => $todos,\n ));\n }", "public function index()\n\t{\n $this->authorize('list', Instance::class);\n\n\t\treturn $this->ok($this->repo->paginate($this->request->all()));\n\t}", "public function actionRestList() {\n\t $this->doRestList();\n\t}", "public function listing()\n\t{\n\t\t$hospitalID = $this->request->getSession()->read(\"hospital_id\") ? $this->request->getSession()->read(\"hospital_id\") : \"\";\n\t\t\n\t\t$patientMonitored = 1;\n\t\t$patientActive = 1;\n\t\t\n\t\t//GET ALL PATIENTS\n\t\t$patientsData = $this->Patients->allPatients($hospitalID,$patientMonitored,$patientActive);\n\t\t//GET ALL PATIENTS\n\t\t\n\t\t//echo \"<pre>\"; print_r($patientsData);die;\n\t\t$this->set(compact(\"patientsData\"));\n\t}", "public function listAction()\n {\n $htmlpage = '<!DOCTYPE html>\n<html>\n <head>\n <meta charset=\"UTF-8\">\n <title>todos list!</title>\n </head>\n <body>\n <h1>todos list</h1>\n <p>Here are all your todos:</p>\n <ul>';\n \n $em = $this->getDoctrine()->getManager();\n $todos = $em->getRepository(Todo::class)->findAll();\n foreach($todos as $todo) {\n $htmlpage .= '<li>\n <a href=\"/todo/'.$todo->getid().'\">'.$todo->getTitle().'</a></li>';\n }\n $htmlpage .= '</ul>';\n\n $htmlpage .= '</body></html>';\n \n return new Response(\n $htmlpage,\n Response::HTTP_OK,\n array('content-type' => 'text/html')\n );\n }", "public function index()\n {\n // Get Persons\n $person = Person::paginate(10);\n\n //Return collection of person as a resource\n return PersonResource::collection($person);\n }", "public function listAction() {\n\t\t$this->view->title = $this->translator->translate(\"Invoice list\");\n\t\t$this->view->description = $this->translator->translate(\"Here you can see all the invoices.\");\n\t\t$this->view->buttons = array(array(\"url\" => \"/admin/invoices/new/\", \"label\" => $this->translator->translate('New'), \"params\" => array('css' => null)));\r\n\t\t$this->datagrid->setConfig ( Invoices::grid() )->datagrid ();\n\t}", "public function listAll()\n\t{\n\t\t$this->render(self::PATH_VIEWS . '/list', [\n\t\t\t'pages' => $this->pagesDb->findAll('id', 'DESC'),\n\t\t]);\n\t}", "public function list()\n {\n // récupérer les données : toutes les catégories enregistrées\n $productList = Product::findAll();\n\n $this->show('product/list', [\n 'productList' => $productList\n ]);\n }", "public function index()\n {\n // CRUD -> Retrieve --> List\n // BREAD -> Browse Read Edit Add Delete\n // return Item::all();\n return view('list_items',compact('items'));\n }", "public function index()\n {\n // Get manufacturers\n $manufacturers = Manufacturer::orderBy('created_at', 'desc')->paginate(15);\n\n // Return collection of manufacturers as a resource\n return ManufacturerResource::collection($manufacturers);\n }", "public function index()\n {\n return ArtistResource::collection(Artist::orderBy('created_at', 'desc')->get());\n }", "public function indexAction() {\n\t\t$page = intval($this->getInput('page'));\n\t\t$perpage = $this->perpage;\n\t\t\n\t\tlist(,$files) = Lock_Service_FileType::getAllFileType();\n\t\t$data = array();\n\t\tforeach ($files as $key=>$value) {\n\t\t\t$data[$key]['id'] = $value['id'];\n\t\t\t$data[$key]['title'] = $value['name'];\n\t\t}\n\t\tlist($total, $filetype) = Lock_Service_FileType::getList($page, $perpage);\n\t\t$this->assign('filetype', $filetype);\n\t\t$this->assign('pager', Common::getPages($total, $page, $perpage, $this->actions['listUrl'].'/?'));\n\t\t$this->assign('data', json_encode($data));\n\t}", "public function listAction()\n {\n $qb = $this->getRepository()->queryAll();\n\n $view = new ImportListView;\n $view->imports = $qb->getQuery()->execute();\n\n return $this->templating->renderResponse('InfiniteImportBundle:Import:list.html.twig', array(\n 'data' => $view\n ));\n }", "public function index()\n\t{\n\t\t//Return model all()\n\t\t$instances = $this->decorator->getListingModels();\n\n\t\treturn View::make($this->listingView, array(\n\t\t\t'instances' => $instances,\n\t\t\t'controller' => get_class($this), \n\t\t\t'modelName' => class_basename(get_class($this->decorator->getModel())),\n\t\t\t'columns' => $this->getColumnsForInstances($instances),\n\t\t\t'editable' => $this->editable\n\t\t));\n\t}", "public function index()\n {\n return InfografiResources::collection(\n Infografi::orderBy('date', 'desc')->get()\n );\n }", "public function listAction()\n\t {\n\t\t\t$this->_forward('index');\n \n\t\t}", "public function index()\n {\n $this->list_view();\n }", "public function index()\n {\n $this->list_view();\n }", "public function index()\n {\n $this->list_view();\n }", "public function listAction()\n {\n $defaults = array(\n 'page' => null,\n 'order' => null,\n 'limit' => null,\n 'offset' => null,\n 'filter' => array(),\n );\n $body = $this->getRequest()->getBody();\n $options = $body + $defaults;\n\n // Process the options\n if (is_string($options['order'])) {\n $options['order'] = array_map('trim', explode(',', $options['order']));\n }\n if (is_string($options['page'])) {\n $options['page'] = (int)$options['page'];\n }\n if (is_string($options['limit'])) {\n $options['limit'] = (int)$options['limit'];\n }\n if (is_string($options['offset'])) {\n $options['offset'] = (int)$options['offset'];\n }\n $filter = $options['filter'];\n unset($options['filter']);\n\n $options = array_filter($options);\n\n return $this->getBinding()->find($filter, $options);\n }", "public function index()\n {\n /* Check if logged in user is authorized to make this request */\n $this->authorizeAction();\n\n /* Get the resources from the model */\n $resources = $this->resourcesList($this->model);\n\n /* Sets the view */\n if (view()->exists(\"admin.{$this->name}.index\")) {\n $view = \"admin.{$this->name}.index\";\n } else {\n $view = 'admin.includes.actions.index';\n }\n\n /* Display a listing of the resources */\n return view($view)\n ->with('resources', $resources)\n ->with('module', $this->module);\n }", "public function index()\n\t{\n\t\t$data['lists'] = $this->mdl_student->get_all();\n\t\t$this->template->set('title', 'Student Hostel List');\n\t\t$this->template->load('template', 'contents', 'student_hostel/student_hostel_list', $data);\n\t}", "public function index()\n {\n $modules = Module::all();\n return Resource::collection($modules);\n }", "public function index()\n {\n // List all resources from user entity\n $users = User::all();\n\n return $this->showAll($users);\n }", "public function index()\n {\n // Get todos\n $todos = Todo::orderBy('created_at', 'desc')->paginate(3);\n\n // Return collection of articles as a resource\n return TodoResource::collection($todos);\n }", "public function index()\n {\n return Resources::collection(Checking::paginate());\n }", "public function index()\n {\n return CourseListResource::collection(\n Course::query()->withoutGlobalScope('publish')\n ->latest()->paginate()\n );\n }", "public function index()\n {\n $cars = Car::paginate(15);\n return CarResource::collection($cars);\n }", "public function index()\n {\n // Get articles\n $articles = Article::orderBy('created_at', 'desc')->paginate(5);\n\n // Return collection of articles as a resource\n return ArticleResource::collection($articles);\n }", "public function index()\n {\n $authors = Author::paginate(10);\n\n return AuthorResource::collection($authors);\n }", "public function index()\n {\n //Get Books\n $books = Book::paginate(10);\n \n if ($books) {\n return (BookResource::collection($books))->additional([\n 'status_code' => 200,\n 'status' => 'success',\n ]);\n } else {\n return (BookResource::collection([]))->additional([\n 'status_code' => 200,\n 'status' => 'success',\n ]);\n }\n return view('index')->with('data', $books);\n }", "public function view(){\n\t\t$this->buildListing();\n\t}", "public function index()\n {\n $books = Book::latest()\n ->paginate(20);\n\n return BookResource::collection($books);\n }", "public function index()\n {\n $listing = Listing::orderBy('id', 'desc')->paginate(10);\n return view('listings.index')->withListings($listing);\n }", "public function listAction()\n {\n $this->_getSession()->setFormData([]);\n\n $this->_title($this->__('Training Cms'))\n ->_title($this->__('Pages'));\n\n $this->loadLayout();\n\n $this->_setActiveMenu('training_cms');\n $this->_addBreadcrumb($this->__('Training Cms'), $this->__('Training Cms'));\n $this->_addBreadcrumb($this->__('Pages'), $this->__('Pages'));\n\n $this->renderLayout();\n }", "public function index()\n {\n $services = $this->serviceRepository->paginate();\n\n return ServiceResource::collection($services);\n }", "public function index()\n {\n $resources = ResourceManagement::paginate(5);\n $users = User::get();\n\n return view('resources-mgmt/index', ['resources' => $resources, 'users' => $users]);\n }", "public function index()\n {\n $catalogs = Catalog::where('status', '=', Catalog::PUBLICADO)\n ->orderBy('id', 'DESC')->get();\n \n $data = CatalogResource::collection($catalogs);\n\n return [\n 'items' => $data,\n 'mensaje' => ''\n ];\n }", "public function listAction(){\n // In a controller this can be:\n // $this->request->getQuery('page', 'int'); // GET\n $currentPage = $this->request->getPost('pageindex', 'int'); // POST\n $pageNum = ($currentPage == null) ? 1 : $currentPage;\n\n // The data set to paginate\n $message = new Notice();\n $results = $message->getMsg4Admin();\n\n // Create a Model paginator, show 10 rows by page starting from $currentPage\n $paginator = new PaginatorArray(\n array(\n \"data\" => $results,\n \"limit\" => 10,\n \"page\" => $pageNum\n )\n );\n\n // Get the paginated results\n $page = $paginator->getPaginate();\n\n return $this->response->setJsonContent($page);\n\n }", "public function list()\n {\n try {\n return $this->success($this->service->list());\n } catch (\\Exception $exception) {\n return $this->error($exception->getMessage());\n }\n }", "public function index()\n {\n return $this->sendResponse(CrisisResource::collection(Crisis::paginate(10)), 'Data fetched successfully');\n }", "public function index()\n\t{\n\t\t$%Alias = new %Model();\n\t\t$params = array();\n\t\t\n\t\t$Paginator = new Paginator( $%Alias->findSize( $params ), $this->getLimit(), $this->getPage() );\n\t\t$this->getView()->set( '%Aliass', $%Alias->findList( $params, 'Id desc', $this->getOffset(), $this->getLimit() ) );\n\t\t$this->getView()->set( 'Paginator', $Paginator );\n\t\treturn $this->getView()->render();\n\t}", "public function listAction() {}", "public function index()\n {\n\n return RecipeResource::collection(Recipe::all());\n }", "public function index()\n {\n $this->indexPage('list-product', 'List Product');\n }", "public function listAction()\n {\t\n\t\t$this->removeSession();\n\t\t$this->verifySessionRights();\n\t\t$this->setActivity(\"List view\");\n $em = $this->getDoctrine()->getManager();\n $oRepClient = $em->getRepository('BoAdminBundle:Client');\n\t\t$nb_tc = $oRepClient->getTotal();\n\t\t//get page\n\t\t$page = $this->get('session')->get('page');\n\t\tif($page==null){\n\t\t\t$page=1;\n\t\t\t$this->get('session')->set('page',1);\n\t\t}\n\t\t//get number line per page\n\t\t$nb_cpp = $em->getRepository('BoAdminBundle:Param')->getParam(\"display_list_page_number\",1);\n\t\t$nb_pages = ceil($nb_tc/$nb_cpp);\n\t\t$offset = $page>0?($page-1) * $nb_cpp:0;\n\t\t$clients = $em->getRepository('BoAdminBundle:Client')->findBy(array(),array('id' => 'desc'),$nb_cpp,$offset);\n $form = $this->createForm('Bo\\AdminBundle\\Form\\ClientType', new Client());\n return $this->render('client/index.html.twig', array(\n 'clients' => $clients,\n\t\t\t'page' => $page, // forward current page to view,\n\t\t\t'nb_pages' => $nb_pages, //total number page,\n 'form' => $form->createView(),\n\t\t\t'total'=>$nb_tc, // record number.\n\t\t\t'nb_cpp' => $nb_cpp,// line's number to display\n\t\t\t'pm'=>\"contracts\",\n\t\t\t'sm'=>\"client\",\n ));\n }", "public function index()\n {\n return AcResource::collection(Ac::latest()->paginate()); //\n }", "public function executeList()\n {\n $this->setTemplate('list');\n }", "public function indexAction()\n {\n $books = Book::getAll();\n\n View::renderTemplate('Books/index.html', [\n 'books' => $books\n ]);\n }", "function listing() {\r\n\r\n }", "public function listar() {\n $rs = $this->model->listar();\n\n echo $this->toJson($rs);\n }", "public function index()\n {\n return BookResource::collection(Book::orderby('id')->get());\n }", "public function doRestList()\n {\n $this->outputHelper( \n 'Records Retrieved Successfully', \n $this->getModel()->with($this->nestedRelations)->filter($this->restFilter)->orderBy($this->restSort)->limit($this->restLimit)->offset($this->restOffset)->findAll(),\n $this->getModel()->with($this->nestedRelations)->filter($this->restFilter)->count()\n );\n\t}", "public function index()\n {\n $client = Client::paginate();\n return ClientResource::collection($client);\n }", "public function index()\n {\n return TagResource::collection(\n Tag::orderBy('name', 'ASC')->paginate(request('per_page', 10))\n );\n }", "public function _index(){\n\t $this->_list();\n\t}", "public function index()\n\t{\n\t\t$data['lists'] = $this->gallery_mdl->get_all();\n\t\t$this->template->set('title', 'Gallery');\n\t\t$this->template->render('template', 'list', $data);\n\t}", "function drush_restapi_list() {\n\n $resources = restapi_get_resources();\n $last_module = NULL;\n $rows = [\n [dt('Module'), dt('Path'), dt('Class')],\n ];\n\n foreach($resources as $resource) {\n if ($last_module != $resource->getModule()) {\n $module = $last_module = $resource->getModule();\n }\n else {\n $module = '';\n }\n $rows[] = [$module, $resource->getPath(), $resource->getClass()];\n }\n\n drush_print_table($rows, TRUE);\n drush_log(dt('Displaying !count total resources', [\n '!count' => count($resources),\n ]), 'ok');\n\n}", "public function index()\n {\n $this->booklist();\n }", "public function index()\n {\n //\n $accounts = accounts::paginate(15);\n\n //return the collection of employees as a resource\n return accountResource::collection($accounts);\n\n\n }", "public function index()\n {\n $items = Item::all();\n return view('items::list_items',compact('items'));\n }", "public function index()\n {\n // Get houses\n $houses = House::orderBy('created_at', 'desc')->paginate(self::PAGINATE);\n \n // Return collection of houses\n \n return HouseResource::collection($houses);\n }", "public function index()\n {\n $products = Product::paginate(6);\n return ProductResource::collection($products);\n }", "public function index() {\n $this->template->allFoundItems = Found::showAll();\n $this->template->display( 'index.html.php' );\n }", "public function indexAction() {\n $this->_forward('list');\n }", "public function index()\n {\n $data = Productcategory::paginate(10);\n\t\treturn ProductcategoryResource::Collection($data);\n }", "public function index()\n {\n return SongResource::collection(\\App\\Song::orderBy('created_at', 'desc')->get());\n }", "public function ListView()\n\t{\n\t\t\n\t\t// Requer permissão de acesso\n\t\t$this->RequirePermission(Usuario::$P_ADMIN,\n\t\t\t\t'SecureExample.LoginForm',\n\t\t\t\t'Autentique-se para acessar esta página',\n\t\t\t\t'Você não possui permissão para acessar essa página ou sua sessão expirou');\n\t\t\n\t\t//$usuario = Controller::GetCurrentUser();\n\t\t//$this->Assign('usuario',$usuario);\n\t\t$this->Render();\n\t}", "public function index () {\n permiss ( 'role.list' );\n\n $data = $this->entity\n ->orderBy('created_at', 'desc')->get();\n\n return new ModelResource($data);\n }", "public function showResources()\n {\n $resources = Resource::get();\n return view('resources', compact('resources'));\n }", "public function index()\n {\n //get articless\n $articles = Article::paginate(15);\n\n //Return collection of article has a resource\n return ArticleResource::collection($articles);\n\n }", "public function actionList() {\n header(\"Content-type: application/json\");\n $verb = $_SERVER[\"REQUEST_METHOD\"];\n\n if ($verb === 'GET') {\n echo \"{\\\"data\\\":\" . CJSON::encode(Donneur::model()->findAll()) . \"}\";\n } else if ($verb == 'POST') {\n if (Donneur::model()->exists('id' === $_POST['id'])) {\n $this->actionListUpdate($_POST);\n } else {\n $this->actionListPost();\n }\n } else if ($verb == 'DELETE') {\n $this->actionListDelete();\n }\n }", "public function list()\n {\n return $this->http->request(HttpMethods::GET, $this->endpoint);\n }", "public function indexAction(){\n $data = array(\n 'collection' => $this->model->getCollection(),\n \n ); \t\n return $this->getView($data);\n }", "public function indexAction()\n {\n $em = $this->getDoctrine()->getManager();\n\n $entities = $em->getRepository('DiverPriceLisrBundle:Items')->findAll();\n\n return $this->render('DiverPriceLisrBundle:Items:index.html.twig', array(\n 'entities' => $entities,\n ));\n }", "public function actionIndex()\n {\n $dataProvider = new ActiveDataProvider([\n 'query' => Slaves::find(),\n ]);\n\n return $this->render('index', [\n 'dataProvider' => $dataProvider,\n ]);\n }", "public function listAction() {\n\t\t// Recogemos el repositorio\n\t\t$repository = $this->getDoctrine() ->getRepository('AppBundle:Product');\n\t\n\t\t// Recuperamos todos los productos.\n\t\t$products = $repository->findAll();\n\t\t// Pasamos a la plantilla el aray products\n\t\treturn $this->render('product/listActionProduct.html.twig', array( 'products' => $products));\n\t\n\t}", "public function listAction()\n\t {\n\t\t$model = $this->_getModel();\n\t\t$result = $model->getLayouts();\t\n\t\t$page = (int)($this->_request->getParam('page')); \n\t\tif(count($result) > 0)\n\t\t{ \n\t\t\tGlobals::doPaging($result, $page, $this->view);\n\t\t}\n\t\t\t\t\n\t\t$this->view->page = $page;\n\t }", "public function actionList()\n {\n // get model\n $model = new $this->_model('search');\n $model->unsetAttributes();\n\n // set filter\n if (isset($_GET[$this->_model])) {\n $model->attributes = $_GET[$this->_model];\n }\n $model->u_cms_album_id = $_GET['album'];\n\n // search\n $dataProvider = $model->search(Yii::app()->language);\n // sort\n $sort = $dataProvider->getSort();\n // route\n $sort->route = $this->id . '/list';\n\n // pagination parameters\n $pagination = $dataProvider->getPagination();\n $pagination->route = $this->id . '/list';\n $pagination->pageSize = UInterfaceSetting::model()->getSettings($this->id . ':' . $this->module->id, Yii::app()->user->id)->page_size;\n $pagination->itemCount = $dataProvider->totalItemCount;\n\n // datas\n $datas = $dataProvider->getData();\n\n // related datas\n $relatedDatas = $this->_loadRelatedData();\n\n // template\n $template = isset($_REQUEST['partial']) ? 'list/_table' : 'list/main';\n\n $jsonParams = array();\n if (Yii::app()->request->isAjaxRequest) {\n // filters\n $filtersDatas = array();\n if (isset($_GET[$this->_model])) {\n $filtersDatas[$this->_model] = $_GET[$this->_model];\n }\n if (isset($_GET[$sort->sortVar])) {\n $filtersDatas[$sort->sortVar] = $_GET[$sort->sortVar];\n }\n\n $jsonParams = array(\n 'filters' => http_build_query($filtersDatas)\n );\n }\n\n $this->dynamicRender(\n $template,\n array(\n 'dataView' => new $this->crudComponents['listDataView'](\n $datas, $relatedDatas, $model, $sort, $pagination, $this\n )\n ),\n $jsonParams\n );\n }", "public function index()\n {\n return view('listings.index')->with('listings', Listing::all());\n }", "public function get_index()\n\t{\n\t\t$pages = Page::recent_available()->paginate(30);\n\t\t$table = Cello\\Presenter\\Page::table($pages);\n\t\t$data = array(\n\t\t\t'eloquent' => $pages,\n\t\t\t'table' => $table,\n\t\t);\n\n\t\tSite::set('title', __('cello::title.pages.list'));\n\n\t\treturn View::make('cello::api.resources.index', $data);\n\t}", "public function index()\n {\n return ProductResource::collection(Product::latest()->paginate(10));\n }", "public function index()\n {\n $category = GalleryCategory::paginate(15);\n\n // return collection of category as a resource.\n return Resource::collection($category);\n }", "public function index()\n {\n //\n $news = News::latest()->paginate(18);\n\n return NewsResource::collection($news);\n }", "public function indexAction() {\n\t\t$list_info = Zend_Registry::get('list_info');\n if (!Engine_Api::_()->core()->hasSubject('list_listing')) {\n return $this->setNoRender();\n }\n \n $this->view->expiry_setting = Engine_Api::_()->list()->expirySettings();\n\n //GET SUBJECT\n $this->view->list = $list = Engine_Api::_()->core()->getSubject('list_listing');\n\n\t\t//GET CATEGORY TABLE\n\t\t$this->view->tableCategory = Engine_Api::_()->getDbTable('categories', 'list');\n\n //GET CATEGORIES NAME\n\t\t$this->view->category_name = $this->view->subcategory_name = $this->view->subsubcategory_name = '';\n\n\t\tif(!empty($list->category_id)) {\n\t\t\tif($this->view->tableCategory->getCategory($list->category_id))\n\t\t\t$this->view->category_name = $this->view->tableCategory->getCategory($list->category_id)->category_name;\n\n\t\t\tif(!empty($list->subcategory_id)) {\n\t\t\t\tif($this->view->tableCategory->getCategory($list->subcategory_id))\n\t\t\t\t$this->view->subcategory_name = $this->view->tableCategory->getCategory($list->subcategory_id)->category_name;\n\n\t\t\t\tif(!empty($list->subsubcategory_id)) {\n\t\t\t\t\tif($this->view->tableCategory->getCategory($list->subsubcategory_id))\n\t\t\t\t\t$this->view->subsubcategory_name = $this->view->tableCategory->getCategory($list->subsubcategory_id)->category_name;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n //GET LISTING TAGS\n $this->view->listTags = $list->tags()->getTagMaps();\n\n\t\t//GET OTHER DETAILS\n\t\t$this->view->list_description = Zend_Registry::get('list_descriptions');\n $this->view->addHelperPath(APPLICATION_PATH . '/application/modules/Fields/View/Helper', 'Fields_View_Helper');\n $this->view->fieldStructure = Engine_Api::_()->fields()->getFieldsStructurePartial($list);\n\t\tif(empty($list_info)){ return $this->setNoRender(); }\n }", "public function index()\n {\n return $this->service->fetchResources(Author::class, 'authors');\n }", "public function index()\n {\n return view('admin.resources.index');\n }", "public function doRestList() {\n\t\t$this->outputHelper ( 'Collections Retrieved Successfully', $this->getModel ()->with ( $this->nestedRelations )->filter ( $this->restFilter )->orderBy ( $this->restSort )->limit ( $this->restLimit )->offset ( $this->restOffset )->findAll (), $this->getModel ()->with ( $this->nestedRelations )->filter ( $this->restFilter )->count () );\n\t}" ]
[ "0.7446777", "0.736227", "0.73005503", "0.72478926", "0.71631265", "0.71489686", "0.7131636", "0.7105969", "0.71029514", "0.7101372", "0.70508176", "0.6995128", "0.69890636", "0.6934895", "0.6900203", "0.6899281", "0.6891734", "0.6887235", "0.68670005", "0.6849741", "0.6830523", "0.6802689", "0.6797", "0.67957735", "0.67871135", "0.6760129", "0.67427456", "0.6730486", "0.67272323", "0.67255723", "0.67255723", "0.67255723", "0.67177945", "0.6707866", "0.6706713", "0.6704375", "0.6664782", "0.6662871", "0.6660302", "0.6659404", "0.6656656", "0.6653517", "0.6647965", "0.6620322", "0.66185474", "0.6618499", "0.6606105", "0.6600617", "0.65996987", "0.6594775", "0.6587389", "0.6585109", "0.6581641", "0.6581017", "0.6577157", "0.65747666", "0.6572513", "0.65721947", "0.6570553", "0.65646994", "0.6563556", "0.6554194", "0.65529937", "0.65460825", "0.65368485", "0.653429", "0.65328294", "0.6526759", "0.6526695", "0.6526284", "0.65191334", "0.65183175", "0.65174305", "0.651703", "0.65141153", "0.6507088", "0.65061647", "0.6504046", "0.64942145", "0.6491893", "0.64883405", "0.6486392", "0.6485077", "0.64846045", "0.6478858", "0.64756656", "0.64726377", "0.6471126", "0.64701074", "0.6467418", "0.6462195", "0.64618355", "0.6459199", "0.6457831", "0.6454631", "0.64533997", "0.6451915", "0.6450861", "0.6449301", "0.64492667", "0.64469045" ]
0.0
-1
Show the form for creating a new resource.
public function create() { $packages_products = Package_Product::all(); //$this->authorize('create', $package_product); $packages = Package::all(); $products = Product::all(); return view('admin.packageProduct.create', compact('packages_products','packages','products')); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function create()\n {\n return $this->showForm('create');\n }", "public function create()\n {\n return $this->showForm('create');\n }", "public function create()\n {\n return view('admin.resources.create');\n }", "public function create(){\n\n return view('resource.create');\n }", "public function create()\n\t{\n\t\treturn $this->showForm('create');\n\t}", "public function create()\n {\n return \"Display a form for creating a new catalogue\";\n }", "public function newAction()\n {\n $entity = new Resource();\n $current = $this->get('security.context')->getToken()->getUser();\n $entity->setMember($current);\n $form = $this->createCreateForm($entity);\n\n return array(\n 'nav_active'=>'admin_resource',\n 'entity' => $entity,\n 'form' => $form->createView(),\n );\n }", "public function create()\n {\n return view ('forms.create');\n }", "public function create ()\n {\n return view('forms.create');\n }", "public function create()\n\t{\n\t\treturn view('faith.form');\n\t}", "public function create(NebulaResource $resource): View\n {\n $this->authorize('create', $resource->model());\n\n return view('nebula::resources.create', [\n 'resource' => $resource,\n ]);\n }", "public function create()\n {\n return view(\"request_form.form\");\n }", "public function create()\n {\n /* Check if logged in user is authorized to make this request */\n $this->authorizeAction();\n\n /* Sets the view */\n if (view()->exists(\"admin.{$this->name}.create\")) {\n $view = \"admin.{$this->name}.create\";\n } else {\n $view = 'admin.includes.actions.create';\n }\n\n /* Show the form for creating a new resource. */\n return view($view)\n ->with('name', $this->name);\n }", "public function newAction()\n\t{\n\t\t$this->render( View::make( 'schools/form' , array(\n\t\t\t'title' => 'Ajouter une nouvelle &eacute;cole'\n\t\t) ) );\n\t}", "public function create()\n {\n return view($this->forms . '.create');\n }", "public function create()\n {\n return view('restful.add');\n }", "public function create()\n {\n $resource = (new AclResource())->AclResource;\n\n //dd($resource);\n return view('Admin.acl.role.form', [\n 'resource' => $resource\n ]);\n }", "public function create()\n {\n return view('admin.createform');\n }", "public function create()\n {\n return view('admin.forms.create');\n }", "public function create()\n {\n return view('backend.student.form');\n }", "public function newAction()\n {\n $breadcrumbs = $this->get(\"white_october_breadcrumbs\");\n $breadcrumbs->addItem('Inicio', $this->get('router')->generate('admin.homepage'));\n $breadcrumbs->addItem($this->entityDescription, $this->get(\"router\")->generate(\"admin.$this->entityName.index\"));\n $breadcrumbs->addItem('Nuevo');\n\n $entity = $this->getManager()->create();\n $form = $this->getForm($entity);\n\n return $this->render('AdminBundle:Default:new.html.twig', array(\n 'entity' => $entity,\n 'form' => $form->createView(),\n 'metadata' => $this->getMetadata()\n ));\n }", "public function create()\n {\n return view('client.form');\n }", "public function create()\n {\n // Nos regresa la vista del formulario\n return view('project.form');\n }", "public function create()\n {\n return view('Form');\n }", "public function newAction(){\n \n $entity = new Resourceperson();\n $form = $this->createAddForm($entity);\n\n \n return $this->render('ABCRspBundle:rsp:add.html.twig',array('entity'=>$entity,'form'=> $form->createView()));\n }", "public function createForm()\n\t{\n\t\treturn view('post.new');\n\t}", "public function create()\n {\n return view('admin.form.create', ['form' => new Form]);\n }", "public function create()\n {\n return view('form');\n }", "public function create()\n {\n return view('form');\n }", "public function create()\n {\n return view('form');\n }", "public function create()\n {\n $title = $this->title;\n $subtitle = \"Adicionar cliente\";\n\n return view('admin.clients.form', compact('title', 'subtitle'));\n }", "public function create()\n {\n return view('backend.schoolboard.addform');\n }", "public function create()\n\t{\n\t\treturn view('info.forms.createInfo');\n\t}", "public function create()\n {\n //\n return view('form');\n }", "public function create()\n {\n return view('rests.create');\n }", "public function create()\n {\n return $this->showForm();\n }", "public function create()\n {\n return $this->showForm();\n }", "public function create()\n {\n return view(\"Add\");\n }", "public function create(){\n return view('form.create');\n }", "public function create()\n {\n // Show the page\n return view('admin.producer.create_edit');\n }", "public function create()\n {\n\n return view('control panel.student.add');\n\n }", "public function newAction() {\n\t\t\n\t\t$this->view->form = $this->getForm ( \"/admin/invoices/process\" );\n\t\t$this->view->title = $this->translator->translate(\"New Invoice\");\n\t\t$this->view->description = $this->translator->translate(\"Create a new invoice using this form.\");\n\t\t$this->view->buttons = array(array(\"url\" => \"#\", \"label\" => $this->translator->translate('Save'), \"params\" => array('css' => null,'id' => 'submit')),\r\n\t\t\t\t\t\t\t array(\"url\" => \"/admin/invoices/list\", \"label\" => $this->translator->translate('List'), \"params\" => array('css' => null)));\n\t\t$this->render ( 'applicantform' );\n\t}", "public function create()\n {\n $data['action'] = 'pengiriman.store';\n return view('pengiriman.form', $data);\n }", "public function create()\n {\n return $this->cView(\"form\");\n }", "public function newAction()\n {\n // Création de l'entité et du formulaire.\n $client = new Client();\n $formulaire = $this->createForm(new ClientType(), $client);\n \n \n \n // Génération de la vue.\n return $this->render('KemistraMainBundle:Client:new.html.twig',\n array('formulaire' => $formulaire->createView()));\n }", "public function create()\n {\n return view(\"dresses.form\");\n }", "public function create()\n\t{\n\t\treturn View::make('new_entry');\n\t}", "public function createAction()\n {\n// $this->view->form = $form;\n }", "public function create()\n {\n return view('bank_account.form', ['mode' => 'create']);\n }", "public function create()\n {\n return view('fish.form');\n }", "public function create()\n {\n return view('users.forms.create');\n }", "public function create()\n {\n $this->setFormFields($this->getCreateFormFields());\n $form = $this->getCreateForm();\n\n return view($this->getViewName('create'), [\n 'crudSlug' => $this->slug,\n 'form' => $form,\n ]);\n }", "public function create()\n\t{\n\t\treturn view('admin.estadoflete.new');\n\t}", "public function create()\n {\n $person = new Person;\n return view('contents.personform')->with(compact('person') );\n }", "public function createAction(){\n \t$this->view->placeholder('title')->set('Create');\n \t$this->_forward('form');\n }", "public function create()\n {\n Gate::authorize('app.products.create');\n\n return view('backend.products.form');\n }", "public function create()\n {\n return view('essentials::create');\n }", "public function create()\n {\n return view('student.add');\n }", "public function create()\n\t{\n\t\treturn view('loisier/create');\n\t}", "public function create()\n {\n return view('url.form');\n }", "public function newAction()\n {\n $entity = new Facture();\n $factureType = new FactureType();\n\t\t$factureType->setUser($this->get('security.context')->getToken()->getUser());\n $form = $this->createForm($factureType, $entity);\n\n return $this->render('chevPensionBundle:Facture:new.html.twig', array(\n 'entity' => $entity,\n 'form' => $form->createView(),\n ));\n }", "public function newAction()\n {\n $entity = new Chofer();\n $form = $this->createForm(new ChoferType(), $entity, ['user' => $this->getUser()]);\n\n return $this->render('ChoferesBundle:Chofer:new.html.twig', array(\n 'entity' => $entity,\n 'form' => $form->createView(),\n 'css_active' => 'chofer',\n ));\n }", "public function create()\n\t{\n\t\treturn View::make('crebos.create');\n\t}", "public function create() : View\n {\n $fieldset = $this->menuFieldset();\n\n return $this->view('create', [\n 'title' => trans('addons.Aardwolf::titles.create'),\n 'data' => [],\n 'fieldset' => $fieldset->toPublishArray(),\n 'suggestions' => [],\n 'submitUrl' => route('aardwolf.postCreate')\n ]);\n }", "public function create()\n {\n return view('libro.create');\n }", "public function create()\n {\n return view('libro.create');\n }", "public function newAction()\n {\n $entity = new Species();\n $form = $this->createForm(new SpeciesType(), $entity);\n\n return $this->render('InfectBackendBundle:Species:new.html.twig', array(\n 'entity' => $entity,\n 'form' => $form->createView(),\n ));\n }", "public function create()\n {\n return view('crud/add'); }", "public function create()\n\t{\n\t\treturn View::make('supplier.create');\n\t}", "public function newAction()\n {\n $entity = new Company();\n $form = $this->createForm(new CompanyType(), $entity);\n\n return $this->render('SiteSavalizeBundle:Company:new.html.twig', array(\n 'entity' => $entity,\n 'form' => $form->createView(),\n ));\n }", "public function create()\n {\n return view(\"List.form\");\n }", "public function index_onCreateForm()\n\t{\n\t\tparent::create();\n\t\treturn $this->makePartial('create');\n\t}", "public function create()\n {\n //load create form\n return view('products.create');\n }", "public function create()\n {\n return view('article.addform');\n }", "public function create()\n {\n // Mengarahkan ke halaman form\n return view('buku.form');\n }", "public function create()\n\t{\n\t\t// load the create form (app/views/material/create.blade.php)\n\t\t$this->layout->content = View::make('material.create');\n\t}", "public function create()\n {\n return view('saldo.form');\n }", "public function create()\n\t\t{\n\t\t\treturn view('kuesioner.create');\n\t\t}", "public function view_create_questioner_form() {\n \t// show all questioner\n \t// send questioner to form\n \treturn view(\"create_questioner\");\n }", "public function newAction() {\n $entity = new Question();\n $form = $this->createCreateForm($entity);\n\n return $this->render('CdlrcodeBundle:Question:new.html.twig', array(\n 'entity' => $entity,\n 'form' => $form->createView(),\n ));\n }", "public function create()\n {\n $data['companies'] = Company::select('id', 'name')->where('status', 1)->orderBy('id', 'desc')->get();\n return view('admin.outlet.outlet_form', $data);\n }", "public function create()\n {\n return view('admin.inverty.add');\n }", "public function create()\n {\n return view('Libro.create');\n }", "public function create()\n {\n $title = trans('entry_mode.new');\n return view('layouts.create', compact('title'));\n }", "public function create()\n {\n $breadcrumb='car.create';\n return view('admin.partials.cars.form', compact('breadcrumb'));\n }", "public function create()\n {\n return view(\"familiasPrograma.create\");\n }", "public function create()\n {\n return view('admin.car.create');\n }", "public function create()\n {\n return view('admin.car.create');\n }", "public function create()\n\t{\n\t\treturn View::make('perusahaans.create');\n\t}", "public function create()\n {\n return view(\"create\");\n }", "public function create()\n\t{\n //echo 'show form';\n\t\treturn View::make('gaans.create');\n\t}", "public function create()\n {\n $title = trans('dormitorybed.new');\n $this->generateParams();\n\n return view('layouts.create', compact('title'));\n }", "public function create()\n {\n return view('forming');\n }", "public function formNew() {\n $this->data->options = array(\n 'RJ' => 'Rio de Janeiro',\n 'MG' => 'Minas Gerais',\n 'SP' => 'São Paulo',\n 'ES' => 'Espírito Santo',\n 'BA' => 'Bahia',\n 'RS' => 'Rio Grande do Sul'\n );\n $this->data->action = \"@exemplos/pessoa/save\";\n $this->render();\n }", "public function create()\n {\n \t\n \treturn view('supplies.create');\n\n }", "public function createAction()\n {\n if ($form = $this->processForm()) {\n $this->setPageTitle(sprintf($this->_('New %s...'), $this->getTopic()));\n $this->html[] = $form;\n }\n }", "public function create()\n {\n $page_title = \"Add New\";\n return view($this->path.'create', compact('page_title'));\n }", "public function create()\n {\n // not sure what to do with the form since im\n // using ame partial for both create and edit\n return view('plants.create')->with('plant', new Plant);\n }", "public function create() {\n\t\t$title = 'Create | Show';\n\n\t\treturn view('admin.show.create', compact('title'));\n\t}", "public function create()\n {\n return view('student::students.student.create');\n }", "public function newAction(){\n\t\t$entity = new Reserva();\n\t\t$form = $this->createCreateForm($entity);\n\n\t\treturn $this->render('LIHotelBundle:Reserva:new.html.twig', array(\n\t\t\t'entity' => $entity,\n\t\t\t'form' => $form->createView(),\n\t\t));\n\t}" ]
[ "0.75948673", "0.75948673", "0.75863165", "0.7577412", "0.75727344", "0.7500887", "0.7434847", "0.7433956", "0.73892003", "0.73531085", "0.73364776", "0.73125", "0.7296102", "0.7281891", "0.72741455", "0.72424185", "0.7229325", "0.7226713", "0.7187349", "0.7179176", "0.7174283", "0.7150356", "0.71444064", "0.71442676", "0.713498", "0.71283126", "0.7123691", "0.71158516", "0.71158516", "0.71158516", "0.7112176", "0.7094388", "0.7085711", "0.708025", "0.70800644", "0.70571953", "0.70571953", "0.70556754", "0.70396435", "0.7039549", "0.7036275", "0.703468", "0.70305896", "0.7027638", "0.70265305", "0.70199823", "0.7018007", "0.7004984", "0.7003889", "0.7000935", "0.69973785", "0.6994679", "0.6993764", "0.6989918", "0.6986989", "0.6966502", "0.69656384", "0.69564354", "0.69518244", "0.6951109", "0.6947306", "0.69444615", "0.69423944", "0.6941156", "0.6937871", "0.6937871", "0.6936686", "0.69345254", "0.69318026", "0.692827", "0.69263744", "0.69242257", "0.6918349", "0.6915889", "0.6912884", "0.691146", "0.69103104", "0.69085974", "0.69040126", "0.69014287", "0.69012105", "0.6900397", "0.68951064", "0.6893521", "0.68932164", "0.6891899", "0.6891616", "0.6891616", "0.6889246", "0.68880934", "0.6887128", "0.6884732", "0.68822503", "0.68809193", "0.6875949", "0.68739206", "0.68739134", "0.6870358", "0.6869779", "0.68696856", "0.686877" ]
0.0
-1
Store a newly created resource in storage.
public function store(Request $request) { //$this->authorize('create', new Pa); $data = $request->validate([ 'package' => 'required', 'product' => 'required', 'quantity' => 'required', 'date' => 'required', ],[ 'package.required'=>'El campo Paquete es obligatorio.', 'product.required'=>'El campo Producto es obligatorio.', 'quantity.required'=>'El campo Cantidad es obligatorio.', 'date.required'=>'El campo Fecha es obligatorio.', ]); $package_product = new Package_Product($data); $package_product->package_id=$request->get('package'); $package_product->product_id=$request->get('product'); $package_product->quantity=$request->get('quantity'); $package_product->sub_total=($request->get('quantity')*($package_product->product->price)); $package_product->date=Carbon::parse($request->get('date')); $package_product->save(); return redirect()->route('admin.packages.show',$package_product->package_id)->withFlash('Se ha añadido un nuevo producto al paquete'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function store($data, Resource $resource);", "public function store()\n {\n /* Check if logged in user is authorized to make this request */\n $this->authorizeAction();\n\n if (method_exists($this, 'storeValidations')) {\n $this->request->validate($this->storeValidations());\n }\n\n /* Create a new resource */\n $resource = $this->model::create(Input::all());\n\n /* Redirect to newly created resource page */\n return redirect()\n ->route($this->name . '.edit', $resource->id)\n ->with(\n 'success',\n Lang::has($this->name . '.resource-created') ?\n $this->name . '.resource-created' :\n 'messages.alert.resource-created'\n );\n }", "public function store(CreateStorageRequest $request)\n {\n $this->storage->create($request->all());\n\n return redirect()->route('admin.product.storage.index')\n ->withSuccess(trans('core::core.messages.resource created', ['name' => trans('product::storages.title.storages')]));\n }", "public function createStorage();", "public function store(StoreStorage $request)\n {\n $storage = Storage::create($request->all());\n $request->session()->flash('alert-success', 'Запись успешно добавлена!');\n return redirect()->route('storage.index');\n }", "public function saveShopifyResource() {\n if (is_null($this->getShopifyId())) { // if there is no id...\n $this->createShopifyResource(); // create a new resource\n } else { // if there is an id...\n $this->updateShopifyResource(); // update the resource\n }\n }", "public function store(Request $request, NebulaResource $resource): RedirectResponse\n {\n $this->authorize('create', $resource->model());\n\n $validated = $request->validate($resource->rules(\n $resource->createFields()\n ));\n\n $resource->storeQuery($resource->model(), $validated);\n\n $this->toast(__(':Resource created', [\n 'resource' => $resource->singularName(),\n ]));\n\n return redirect()->back();\n }", "function storeAndNew() {\n $this->store();\n }", "public function store(Request $request)\n {\n $currentUser = JWTAuth::parseToken()->authenticate();\n $validator = Validator::make($request->all(), [\n 'content' => 'required|string',\n 'image_link' => 'sometimes|url',\n ]);\n\n if ($validator->fails()) {\n return APIHandler::response(0, $validator->errors(), [], 400);\n }\n\n $resource = new Resource;\n $resource->user_id = $currentUser['id'];\n $resource->title = $request->get('title');\n $resource->content = $request->get('content');\n $resource->image_link = $request->get('imageLink');\n $resource->video_link = $request->get('videoLink');\n $resource->file_link = $request->get('fileLink');\n $resource->audio_link = $request->get('audioLink');\n $resource->tags = collect($request->get('tags'))->implode('text', ',');\n $resource->is_public = 0;\n $resource->save();\n $data['resource'] = $resource;\n\n if ($request->get('programId')) {\n $this->addToProgram($resource, $request->programId);\n // event(new NewLearningPathResourcePublished($resource, $invitee));\n }\n\n User::find($currentUser['id'])->increment('points', 2);\n\n return APIHandler::response(1, \"New resource has been created\", $data, 201);\n }", "public function store()\n {\n if (!$this->id) { // Insert\n $this->insertObject();\n } else { // Update\n $this->updateObject();\n }\n }", "public function store()\n\t{\n\t\t\n\t\t//\n\t}", "public function store()\r\n\t{\r\n\t\t//\r\n\t}", "public function store()\r\n\t{\r\n\t\t//\r\n\t}", "public function store()\r\n\t{\r\n\t\t//\r\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}" ]
[ "0.72865677", "0.7145327", "0.71325725", "0.6640912", "0.66209733", "0.65685713", "0.652643", "0.65095705", "0.64490104", "0.637569", "0.63736665", "0.63657933", "0.63657933", "0.63657933", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437" ]
0.0
-1
Display the specified resource.
public function show(Package_Product $package_product) { //$this->authorize('view', $package); return view('admin.packages_products.show', compact('package_product')); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function show(Resource $resource)\n {\n // not available for now\n }", "public function show(Resource $resource)\n {\n //\n }", "function Display($resource_name, $cache_id = null, $compile_id = null)\n {\n $this->_smarty->display($resource_name, $cache_id, $compile_id);\n }", "private function showResourceable($resourceable)\n {\n save_resource_url();\n\n return $this->view('resources.create_edit')\n ->with('resource', $resourceable)\n ->with('photos', $resourceable->photos)\n ->with('videos', $resourceable->videos)\n ->with('documents', $resourceable->documents);\n }", "function display($resource_name, $cache_id = null, $compile_id = null) {\n\t\t$this->_getResourceInfo($resource_name); // Saves resource info to a Smarty class var for debugging\n\t\t$_t3_fetch_result = $this->fetch($resource_name, tx_smarty_div::getCacheID($cache_id), $compile_id);\n if ($this->debugging) { // Debugging will have been evaluated in fetch\n require_once(SMARTY_CORE_DIR . 'core.display_debug_console.php');\n $_t3_fetch_result .= smarty_core_display_debug_console(array(), $this);\n }\n\t\treturn $_t3_fetch_result;\n\t}", "public function show(ResourceSubject $resourceSubject)\n {\n //\n }", "public function show(ResourceManagement $resourcesManagement)\n {\n //\n }", "public function viewEditResources()\n {\n $database = new Database();\n $id = $this->_params['id'];\n\n $resource = $database->getResourceById($id);\n\n $availableResource = new Resource($resource['ResourceID'], $resource['ResourceName'], $resource['Description']\n , $resource['ContactName'] , $resource['ContactEmail'] , $resource['ContactPhone'] ,\n $resource['Link'], $resource['active']);\n $this->_f3->set('Resource', $availableResource);\n\n echo Template::instance()->render('view/include/head.php');\n echo Template::instance()->render('view/include/top-nav.php');\n echo Template::instance()->render('view/edit-resources.php');\n echo Template::instance()->render('view/include/footer.php');\n }", "public function retrieve(Resource $resource);", "public function showResource($resouceable, $id)\n {\n $model_name = str_replace('-', ' ',ucwords($resouceable));\n $model_name = str_replace(' ', '',ucwords($model_name));\n\n $resource_type = 'App\\Models\\\\'.$model_name;\n $model = app($resource_type);\n $model = $model->find($id);\n\n return $this->showResourceable($model);\n }", "public function showAction(Ressource $ressource)\n {\n $deleteForm = $this->createDeleteForm($ressource);\n\n return $this->render('ressource/show.html.twig', array(\n 'ressource' => $ressource,\n 'delete_form' => $deleteForm->createView(),\n ));\n }", "public function show(Dispenser $dispenser)\n {\n //\n }", "public function show($id)\n {\n $resource = Resource::find($id);\n dd($resource);\n }", "public function displayAction() {\n\t\tif(is_numeric($this->req_id)) {\n\t\t\tAPI::DEBUG(\"[DefaultController::displayAction()] Getting \" . $this->req_id, 1);\n\t\t\t$this->_view->data['info'] = $this->_model->get($this->req_id);\n\t\t\t$this->_view->data['action'] = 'edit';\n\n\t\t} else {\n\t\t\t$this->_view->data['action'] = 'new';\n\t\t}\n\t\t// auto call the hooks for this module/action\n\t\terror_log(\"Should Call: \" . $this->module .\"/\".$this->action.\"/\".\"controller.php\");\n\t\tAPI::callHooks($this->module, $this->action, 'controller', $this);\n\n\t\t$this->addModuleTemplate($this->module, 'display');\n\n\t}", "public function show(NebulaResource $resource, $item): View\n {\n $this->authorize('view', $item);\n\n return view('nebula::resources.show', [\n 'resource' => $resource,\n 'item' => $item,\n ]);\n }", "public function resource(string $resource, string $controller): void\n {\n $base = $this->plural($resource);\n $entity = '/{'.$resource.'}';\n\n $this->app->get($base, $controller.'@index');\n $this->app->post($base, $controller.'@store');\n $this->app->get($base.$entity, $controller.'@show');\n $this->app->patch($base.$entity, $controller.'@update');\n $this->app->delete($base.$entity, $controller.'@destroy');\n }", "public function show($id)\n {\n /* Check if logged in user is authorized to make this request */\n $this->authorizeAction();\n\n /* Get the specified resource */\n $resource = $this->model::findOrFail($id);\n\n /* Sets the view */\n if (view()->exists(\"admin.{$this->name}.show\")) {\n $view = \"admin.{$this->name}.show\";\n } else {\n $view = 'admin.includes.actions.show';\n }\n\n /* Displays the specified resource page */\n return view($view)\n ->with('resource', $resource)\n ->with('name', $this->name);\n }", "function displayCustom($resource_name, $cache_id = null, $compile_id = null)\n\t{\n\t return $this->display(DotbAutoLoader::existingCustomOne($resource_name), $cache_id, $compile_id);\n\t}", "public function show($id)\n {\n $currentUser = JWTAuth::parseToken()->authenticate();\n $rules = [\n 'id' => 'required|integer'\n ];\n\n $validator = Validator::make(['id' => $id], $rules);\n if ($validator->fails()) {\n return APIHandler::response(0, $validator->errors(), 400);\n }\n $resource = $this->resourceRepository->fetchResource($id);\n $this->resourceRepository->storeView($id, $currentUser['id']);\n\n $data = [\n 'resource' => $resource,\n 'related_resources' => $this->resourceRepository->getResourcesRelatedTo($resource->id, $resource->mentoring_area_id)\n ];\n\n return APIHandler::response(1, \"Show Resource\", $data);\n }", "public function get(Resource $resource);", "public function showAction()\n {\n $model = $this->_getPhotoModel();\n $photo = $model->fetchEntry($this->getRequest()->getParam('id'));\n\n if (null === $photo) {\n return $this->_forward('notfound', 'error');\n }\n\n $this->view->auth = Zend_Auth::getInstance();\n $this->view->title = $photo->title;\n $this->view->photo = $photo;\n }", "public function show($id)\n {\n //\n $data=Resource::find($id);\n return view('resourceDetails',compact('data'));\n }", "function display() {\n\t\t$view = &$this->getView();\n\t\t$view->display();\n\t}", "public function show(ShowResourceRequest $request, $id)\n {\n // TODO: Implement show() method.\n }", "public function show()\n {\n if ($this->twig !== false) {\n $this->twigDefaultContext();\n if ($this->controller) {\n $this->controller->display($this->data);\n }\n echo $this->twig->render($this->twig_template, $this->data);\n } else {\n $filename = $this->findTemplatePath($this->template);\n require($filename);\n }\n }", "function show( $resource ){\n\n $where = \"reservation_status <> 'Pending' AND id = {$resource}\";\n $reservation = where( 'reservations', $where );\n $reservation = $reservation[0];\n\n return view('admin/reservation/preview_reservation', compact( 'reservation' ));\n}", "public function edit(Resource $resource)\n {\n //\n }", "public function show(rc $rc)\n {\n //\n }", "public function show(Resolucion $resolucion)\n {\n //\n }", "public function show()\n\t{\n\t\t//\n\t}", "public function show()\n\t{\n\t\t//\n\t}", "public function show()\n\t{\n\t\t//\n\t}", "public function showAction(furTexture $furTexture)\n {\n\n return $this->render('furtexture/show.html.twig', array(\n 'furTexture' => $furTexture,\n ));\n }", "public function show(Resena $resena)\n {\n }", "public function action_display()\r\n\t{\r\n\t\t$event = ORM::factory('event', array('id' => $this->request->param('id')));\r\n\t\r\n\t\tif ( ! $event->loaded())\r\n\t\t{\r\n\t\t\tNotices::error('event.view.not_found');\r\n\t\t\t$this->request->redirect(Route::url('event'));\r\n\t\t}\r\n\t\t\r\n\t\t// Can user view this event?\r\n\t\tif ( ! $this->user->can('event_view', array('event' => $event)))\r\n\t\t{\r\n\t\t\t// Error notification\r\n\t\t\tNotices::error('event.view.not_allowed');\r\n\t\t\t$this->request->redirect(Route::url('event'));\r\n\t\t}\r\n\t\t\r\n\t\t// Pass event data to the view class\r\n\t\t$this->view->event_data = $event;\r\n\t\t$this->view->user = $this->user;\r\n\t}", "public function showAction() {\n $docId = $this->getParam('id');\n\n // TODO verify parameter\n\n $document = new Opus_Document($docId);\n\n $this->_helper->layout()->disableLayout();\n\n $this->view->doc = $document;\n $this->view->document = new Application_Util_DocumentAdapter($this->view, $document);\n }", "public function edit(Resource $resource)\n {\n return view('admin.resources.edit', compact('resource'));\n }", "public function execute()\n {\n // HTTP Request Get\n if ($this->type == \"resource\") {\n $action = $this->getResourceAction();\n switch ($action) {\n case \"show\":\n $this->show();\n break;\n case \"create\":\n $this->create();\n break;\n case \"edit\":\n $this->edit();\n break;\n case \"destroy\":\n $this->destroy();\n break;\n default:\n echo $this->render();\n break;\n }\n } else {\n $action = $this->Request->action;\n switch ($action) {\n case \"show\":\n $this->show();\n break;\n case \"create\":\n $this->create();\n break;\n case \"edit\":\n $this->edit();\n break;\n case \"destroy\":\n $this->destroy();\n break;\n default:\n echo $this->render();\n break;\n }\n }\n }", "public function display()\n {\n echo $this->getDisplay();\n $this->isDisplayed(true);\n }", "public function show(Resident $resident)\n {\n $this->authorize('admin.resident.show', $resident);\n\n // TODO your code goes here\n }", "public function display()\n\t{\n\t\tparent::display();\n\t}", "public function show()\n\t{\n\t\t\n\t}", "public function get_resource();", "function display() {\n\n\t\t// Check authorization, abort if negative\n\t\t$this->isAuthorized() or $this->abortUnauthorized();\n\n\t\t// Get the view\n\t\t$view = $this->getDefaultView();\n\n\t\tif ($view == NULL) {\n\t\t\tthrow new Exception('Display task called, but there is no view assigned to that controller. Check method getDefaultView.');\n\t\t}\n\n\t\t$view->listing = true;\n\n\t\t// Wrap the output of the views depending on the way the stuff should be shown\n\t\t$this->wrapViewAndDisplay($view);\n\n\t}", "public function viewResources()\n {\n $database = new Database();\n\n $resources = $database->getAllActiveResourcesNoLimit();\n\n\n $resourceArray = array();\n $i = 1;\n\n foreach ($resources as $resource) {\n $availableResource = new Resource($resource['ResourceID'], $resource['ResourceName'], $resource['Description']\n , $resource['ContactName'] , $resource['ContactEmail'] , $resource['ContactPhone'] ,\n $resource['Link'], $resource['active']);\n array_push($resourceArray, $availableResource);\n $i += 1;\n }\n $resourceSize = sizeof($resourceArray);\n $this->_f3->set('resourcesByActive', $resourceArray);\n $this->_f3->set('resourcesSize', $resourceSize);\n echo Template::instance()->render('view/include/head.php');\n echo Template::instance()->render('view/include/top-nav.php');\n echo Template::instance()->render('view/resources.php');\n echo Template::instance()->render('view/include/footer.php');\n }", "public function show($id)\n {\n $this->title .= ' show';\n $this->one($id);\n }", "public function display($title = null)\n {\n echo $this->fetch($title);\n }", "public function display(){}", "public function show($id)\n\t{\n\t\t//\n\t\t//\n\t\n\t}", "public function viewAction()\n\t{\n\t\t//get Id param from request\n\t\tif (!$id = $this->_getParam('id')) {\n\t\t\t$this->getFlashMessenger()->addMessage('Product ID was not specified');\n\t\t\t$this->getRedirector()->gotoSimple('list');\n\t\t}\n\n\t\t//fetch requested ProductID from DB\n\t\tif (!$this->_model->fetch($id)) {\n\t\t\t$this->render('not-found');\n\t\t} else {\n\t\t\t$this->view->model = $this->_model;\n\t\t}\n\t}", "public function show($id)\n {\n // Get single person\n $person = Person::findOrFail($id);\n\n // Return single person as a resource\n return '<h1>Person Number '.$id.'</h1><br>'.json_encode(new PersonResource($person));\n }", "public function display() {\n echo $this->render();\n }", "#[TODO] use self object?\n\tprotected function GET(ResourceObject $resource) {\n#[TODO]\t\tif ($resource->getMTime())\n#[TODO]\t\t\t$this->response->headers->set('Last-modified', gmdate('D, d M Y H:i:s ', $resource->getMTime()) . 'GMT');\n#[TODO]\t\tif ($resource->getCTime())\n#[TODO]\t\t\t$this->response->headers->set('Date', gmdate('D, d M Y H:i:s ', $resource->getCTime()) . 'GMT');\n\n\n#[TODO] handle file streams\n\t\t// get ranges\n#\t\t$ranges = WebDAV::getRanges($this->request, $this->response);\n\n\t\t// set the content of the response\n\t\tif ($resource instanceof ResourceDocument) {\n\t\t\t$this->response->content->set($resource->getContents());\n\t\t\t$this->response->content->setType($resource->getMIMEType());\n\t\t\t$this->response->content->encodeOnSubmit(true);\n\t\t}\n\t}", "public function show($id)\n\t{\n\t//\n\t}", "public function show($id)\n\t{\n\t//\n\t}", "public function show($id)\n {\n //\n $this->_show($id);\n }", "function Fetch($resource_name, $cache_id = null, $compile_id = null, $display = false)\n {\n return $this->_smarty->fetch($resource_name, $cache_id, $compile_id, $display);\n }", "public function show()\n\t{\n\n\t}", "public function show($id) {\n\t\t//\n\t}", "public function show($id) {\n\t\t//\n\t}", "public function show($id) {\n\t\t//\n\t}", "public function show($id) {\n\t\t//\n\t}", "public function show($id) {\n\t\t//\n\t}", "public function show($id) {\n\t\t//\n\t}", "public function show($id) {\n\t\t//\n\t}", "public function show($id) {\n\t\t//\n\t}", "public function show($id) {\n\t\t//\n\t}", "public function show($id) {\n\t\t//\n\t}", "public function show($id) {}", "static public function showCallback(O_Dao_Renderer_Show_Params $params) {\r\n\t\t/* @var $r R_Mdl_Resource */\r\n\t\t$r = $params->record();\r\n\t\t// Setting layout title\r\n\t\t$params->layout()->setTitle($r->getPageTitle());\r\n\r\n?><h1><?=$r->title?></h1><div id=\"resource\"><?\r\n\t\tif($r->getContent()) {\r\n\t\t\t// page has its own content -- show it\r\n\t\t\t$r->getContent()->show($params->layout(), \"content\");\r\n\t\t} else {\r\n\t\t\t// It is a post unit, show all childs\r\n\t\t\tif($r->is_unit == 1) {\r\n\t\t\t\t$r->addQueryAccessChecks($r->getChilds(1))->show($params->layout(), \"content\");\r\n\r\n\t\t\t// It is a folder with several units, show paginator\r\n\t\t\t} elseif($r->show_def == \"last-units\") {\r\n\t\t\t\tlist($type, $perpage) = explode(\":\", $r->show_def_params);\r\n\t\t\t\t/* @var $p O_Dao_Paginator */\r\n\t\t\t\t$p = $r->addQueryAccessChecks($r->getChilds())->test(\"is_unit\", 1)->getPaginator(array($r, \"getPageUrl\"), $perpage);\r\n\t\t\t\t$p->show($params->layout(), $type);\r\n\t\t\t// It is a folder with subfolders, boxes, contents. Show one childs level\r\n\t\t\t} else {\r\n\t\t\t\t$r->addQueryAccessChecks($r->getChilds(1))->show($params->layout(), \"on-parent-page\");\r\n\t\t\t}\r\n\r\n\t\t}\r\n?></div><?\r\n\t}", "public function show($id)\r\n\t{\r\n\t\t//\r\n\r\n\r\n\r\n\t}", "public abstract function display();", "public function show($resourceId, $eventId)\n {\n $routes = $this->routes;\n\n $eventable = $this->getEventableRepository()->model()->findOrFail($resourceId);\n\n if (method_exists($eventable, 'events')) {\n $event = $eventable->events()->find($eventId);\n\n if ($event) {\n $apiObject = $this->event->findApiObject($event->api_id);\n\n return view('events.eventables.show', compact('routes', 'eventable', 'event', 'apiObject'));\n }\n }\n\n abort(404);\n }", "public function show($id)\r\r\n\t{\r\r\n\t\t//\r\r\n\t}", "public function show( $id ) {\n\t\t//\n\t}", "public function show( $id ) {\n\t\t//\n\t}", "abstract public function resource($resource);", "public function show(Response $response)\n {\n //\n }", "public function show()\n {\n return auth()->user()->getResource();\n }", "public function show($id)\n\t{\n\t\t//\n\t}", "public function show($id)\n\t{\n\t\t//\n\t}", "public function show($id)\n\t{\n\t\t//\n\t}", "public function show($id)\n\t{\n\t\t//\n\t}", "public function show($id)\n\t{\n\t\t//\n\t}", "public function show($id)\n\t{\n\t\t//\n\t}", "public function show($id)\n\t{\n\t\t//\n\t}", "public function show($id)\n\t{\n\t\t//\n\t}", "public function show($id)\n\t{\n\t\t//\n\t}", "public function show($id)\n\t{\n\t\t//\n\t}", "public function show($id)\n\t{\n\t\t//\n\t}", "public function show($id)\n\t{\n\t\t//\n\t}", "public function show($id)\n\t{\n\t\t//\n\t}", "public function show($id)\n\t{\n\t\t//\n\t}", "public function show($id)\n\t{\n\t\t//\n\t}", "public function show($id)\n\t{\n\t\t//\n\t}", "public function show($id)\n\t{\n\t\t//\n\t}", "public function show($id)\n\t{\n\t\t//\n\t}", "public function show($id)\n\t{\n\t\t//\n\t}", "public function show($id)\n\t{\n\t\t//\n\t}", "public function show($id)\n\t{\n\t\t//\n\t}", "public function show($id)\n\t{\n\t\t//\n\t}" ]
[ "0.8232636", "0.81890994", "0.68296117", "0.64987075", "0.649589", "0.64692974", "0.64633286", "0.63640857", "0.6307513", "0.6281809", "0.621944", "0.61926234", "0.61803305", "0.6173143", "0.61398774", "0.6119022", "0.61085826", "0.6106046", "0.60947937", "0.6078597", "0.6047151", "0.60409963", "0.6021287", "0.5989136", "0.5964405", "0.5962407", "0.59518087", "0.59309924", "0.5921466", "0.5908002", "0.5908002", "0.5908002", "0.59051657", "0.5894554", "0.5871459", "0.5870088", "0.586883", "0.5851384", "0.58168566", "0.58166975", "0.5815869", "0.58056176", "0.5799148", "0.5795126", "0.5791158", "0.57857597", "0.5783371", "0.5761351", "0.57592535", "0.57587147", "0.5746491", "0.57460666", "0.574066", "0.5739448", "0.5739448", "0.57295275", "0.57293373", "0.5729069", "0.57253987", "0.57253987", "0.57253987", "0.57253987", "0.57253987", "0.57253987", "0.57253987", "0.57253987", "0.57253987", "0.57253987", "0.57214445", "0.57149816", "0.5712036", "0.5710076", "0.57073003", "0.5707059", "0.5705454", "0.5705454", "0.5700382", "0.56997055", "0.5693362", "0.5687868", "0.5687868", "0.5687868", "0.5687868", "0.5687868", "0.5687868", "0.5687868", "0.5687868", "0.5687868", "0.5687868", "0.5687868", "0.5687868", "0.5687868", "0.5687868", "0.5687868", "0.5687868", "0.5687868", "0.5687868", "0.5687868", "0.5687868", "0.5687868", "0.5687868" ]
0.0
-1
Show the form for editing the specified resource.
public function edit($id) { // }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function edit(Resource $resource)\n {\n return view('admin.resources.edit', compact('resource'));\n }", "public function edit(Resource $resource)\n {\n //\n }", "public function edit($id)\n {\n /* Check if logged in user is authorized to make this request */\n $this->authorizeAction();\n\n /* Get the specified resource */\n $resource = $this->model::findOrFail($id);\n\n /* Sets the view */\n if (view()->exists(\"admin.{$this->name}.edit\")) {\n $view = \"admin.{$this->name}.edit\";\n } else {\n $view = 'admin.includes.actions.edit';\n }\n\n /* Displays the edit resource page */\n return view($view)\n ->with('resource', $resource)\n ->with('name', $this->name);\n }", "public function edit(NebulaResource $resource, $item): View\n {\n $this->authorize('update', $item);\n\n return view('nebula::resources.edit', [\n 'resource' => $resource,\n 'item' => $item,\n ]);\n }", "public function edit() {\r\n $id = $this->api->getParam('id');\r\n\r\n if ($id) {\r\n $this->model->id = $id;\r\n $this->checkOwner();\r\n }\r\n $object = $this->model->find_by_id($id);\r\n\r\n $this->api->loadView('contact-form', array('row' => $object));\r\n }", "public function viewEditResources()\n {\n $database = new Database();\n $id = $this->_params['id'];\n\n $resource = $database->getResourceById($id);\n\n $availableResource = new Resource($resource['ResourceID'], $resource['ResourceName'], $resource['Description']\n , $resource['ContactName'] , $resource['ContactEmail'] , $resource['ContactPhone'] ,\n $resource['Link'], $resource['active']);\n $this->_f3->set('Resource', $availableResource);\n\n echo Template::instance()->render('view/include/head.php');\n echo Template::instance()->render('view/include/top-nav.php');\n echo Template::instance()->render('view/edit-resources.php');\n echo Template::instance()->render('view/include/footer.php');\n }", "public function edit()\n {\n return view('hirmvc::edit');\n }", "public function editformAction(){\n\t\t$this->loadLayout();\n $this->renderLayout();\n\t}", "public function edit() {\n $id = $this->parent->urlPathParts[2];\n // pass name and id to view\n $data = $this->parent->getModel(\"fruits\")->select(\"select * from fruit_table where id = :id\", array(\":id\"=>$id));\n $this->getView(\"header\", array(\"pagename\"=>\"about\"));\n $this->getView(\"editForm\", $data);\n $this->getView(\"footer\");\n }", "public function edit($id)\n\t{\n\t\treturn $this->showForm('update', $id);\n\t}", "public function edit($id)\n {\n $model = $this->modelObj;\n $formObj = $model::findOrFail($id);\n $data['formObj'] = $formObj;\n return view($this->veiw_base . '.edit', $data);\n }", "public function createEditForm(Resourceperson $entity){\n \n $form = $this->createForm(new ResourcepersonType(), $entity, array(\n 'action' => $this->generateUrl('rsp_update', array('id' => $entity->getRpId())),\n 'method' => 'PUT',\n ));\n\n $form->add('submit', 'submit', array('label' => 'Update','attr'=> array(\n 'class'=>'btn btn primary'\n )));\n\n return $form;\n }", "private function createEditForm(Resource $entity)\n {\n $form = $this->createForm(new ResourceType(), $entity, array(\n 'action' => $this->generateUrl('social_admin_resource_update', array('id' => $entity->getId())),\n 'method' => 'PUT',\n ));\n\n $form->add('submit', 'submit', array('label' => '保存','attr'=>[\n 'class'=>'btn btn-primary'\n ]));\n\n return $form;\n }", "public function edit($id)\n {\n return $this->showForm('update', $id);\n }", "public function edit($id)\n {\n return $this->showForm('update', $id);\n }", "public function editAction()\n {\n if ($form = $this->processForm()) {\n if ($this->useTabbedForms && method_exists($this, 'getSubject')) {\n $data = $this->getModel()->loadFirst();\n $subject = $this->getSubject($data);\n $this->setPageTitle(sprintf($this->_('Edit %s %s'), $this->getTopic(1), $subject));\n } else {\n $this->setPageTitle(sprintf($this->_('Edit %s'), $this->getTopic(1)));\n }\n $this->html[] = $form;\n }\n }", "public function edit($id)\n {\n $this->data['entity'] = GS_Form::where('id', $id)->firstOrFail();\n return view('admin.pages.forms.edit', $this->data);\n }", "public function edit($id)\n\t{\n\t\t// get the fbf_presenca\n\t\t$fbf_presenca = FbfPresenca::find($id);\n\n\t\t\n\t\t// show the edit form and pass the fbf_presenca\n\t\t$this->layout->content = View::make('fbf_presenca.edit')\n->with('fbf_presenca', $fbf_presenca);\n\t}", "public function edit($id)\n {\n $data = $this->model->find($id);\n\n return view('admin.backends.employee.form.edit',compact('data'));\n }", "public function edit($model, $form);", "function edit() {\n\t\tglobal $tpl;\n\n\t\t$form = $this->initForm();\n\t\t$tpl->setContent($form->getHTML());\n\t}", "public function edit($id)\n\t{\n\t\t$faith = Faith::find($id);\n \n return view('faith.form')->with('faith', $faith);\n\n\t}", "public function edit()\n { \n return view('admin.control.edit');\n }", "public function edit(Form $form)\n {\n //\n }", "public function edit()\n {\n return view('common::edit');\n }", "public function edit($id)\n {\n $resource = (new AclResource())->AclResource;\n $roleResource = AclRole::where('role', $id)->get(['resource'])->toArray();\n $roleResource = Arr::pluck($roleResource, 'resource');\n return view('Admin.acl.role.form', [\n 'role' => $id,\n 'resource' => $resource,\n 'roleResource' => $roleResource,\n ]);\n }", "public function edit()\n {\n return view('admin::edit');\n }", "public function edit()\n {\n return view('admin::edit');\n }", "public function edit()\r\n {\r\n return view('petro::edit');\r\n }", "public function edit($id)\n {\n // show form edit user info\n }", "public function edit()\n {\n return view('escrow::edit');\n }", "public function edit($id)\n {\n $resource = ResourceManagement::find($id);\n\n $users = User::get();\n // Redirect to user list if updating user wasn't existed\n if ($resource == null || $resource->count() == 0) {\n return redirect()->intended('/resource-management');\n }\n\n return view('resources-mgmt/edit', ['resource' => $resource, 'users' => $users]);\n }", "public function edit()\n {\n return view('commonmodule::edit');\n }", "public function editAction()\n\t{\n\t\t$params = $this->data->getParams();\n\t\t$params = $this->valid->clearDataArr($params);\n\t\tif (isset($params['id']))\n\t\t{\n\t\t\t$this->employee->setFlag(true);\n\t\t}\n\t\tif (isset($_POST['submit']))\n\t\t{\n\t\t\t$action = $this->valid->clearDataArr($_POST);\n\t\t\t$this->employee->setDataArray($action);\n\t\t\theader('Location: ' . PATH . 'Employee/index/', true, 303);\n\t\t}\n\t\t$employee = $this->employee->setAction('edit');\n\t\t$this->view->addToReplace($employee);\n\t\t$this->listEmployee();\n\t\t$this->arrayToPrint();\n\t}", "public function edit()\n {\n return view('catalog::edit');\n }", "public function edit()\n {\n return view('catalog::edit');\n }", "public function edit(form $form)\n {\n //\n }", "public function actionEdit($id) { }", "public function edit()\n {\n return view('admincp::edit');\n }", "public function edit()\n {\n return view('scaffold::edit');\n }", "public function edit($id)\n {\n $header = \"Edit\";\n\t\t$data = Penerbit::findOrFail($id);\n\t\treturn view('admin.penerbit.form', compact('data','header'));\n }", "public function edit()\n {\n return view('Person.edit');\n }", "public function edit($id)\n {\n $data = Form::find($id);\n return view('form.edit', compact('data'));\n }", "public function edit($id)\n\t{\n\t\t$career = $this->careers->findById($id);\n\t\treturn View::make('careers._form', array('career' => $career, 'exists' => true));\n\t}", "public function edit(Flight $exercise, FlightResource $resource)\n {\n return $this->viewMake('adm.smartcars.exercise-resources.edit')\n ->with('flight', $exercise)\n ->with('resource', $resource);\n }", "public function edit($id)\n\t{\n\t\t// get the material\n\t\t$material = Material::find($id);\n\n\t\t// show the edit form and pass the material\n\t\t$this->layout->content = View::make('material.edit')\n\t\t\t->with('material', $material);\n\t}", "public function edit($id, Request $request)\n {\n $formObj = $this->modelObj->find($id);\n\n if(!$formObj)\n {\n abort(404);\n } \n\n $data = array();\n $data['formObj'] = $formObj;\n $data['page_title'] = \"Edit \".$this->module;\n $data['buttonText'] = \"Update\";\n\n $data['action_url'] = $this->moduleRouteText.\".update\";\n $data['action_params'] = $formObj->id;\n $data['method'] = \"PUT\"; \n\n return view($this->moduleViewName.'.add', $data);\n }", "public function edit()\n {\n $id = $this->getId();\n return view('panel.user.form', [\n 'user' => $this->userRepository->findById($id),\n 'method' => 'PUT',\n 'routePrefix' => 'profile',\n 'route' => 'profile.update',\n 'parameters' => [$id],\n 'breadcrumbs' => $this->getBreadcrumb('Editar')\n ]);\n }", "public function edit()\r\n {\r\n return view('mpcs::edit');\r\n }", "function edit()\n\t{\n\t\t// hien thi form sua san pham\n\t\t$id = getParameter('id');\n\t\t$product = $this->model->product->find_by_id($id);\n\t\t$this->layout->set('auth_layout');\n\t\t$this->view->load('product/edit', [\n\t\t\t'product' => $product\n\t\t]);\n\t}", "public function edit($id)\n {\n //\n $data = Diskon::find($id);\n\n $form = $this->form;\n $edit = $this->edit;\n $field = $this->field;\n $page = $this->page;\n $id = $id;\n $title = $this->title;\n return view('admin/page/'.$this->page.'/edit',compact('form','edit','data','field','page','id','title'));\n }", "public function edit($id)\n {\n return $this->showForm($id);\n }", "public function edit($id)\n {\n return $this->showForm($id);\n }", "protected function _edit(){\n\t\treturn $this->_editForm();\n\t}", "public function editAction()\n {\n $robot = Robots::findFirst($this->session->get(\"robot-id\"));\n if ($this->request->isGet()) {\n $this->tag->prependTitle(\"Редактировать робота :: \");\n $user = $this->session->get(\"auth-id\");\n if (!$robot) {\n $this->flashSession->error(\n \"Робот не найден\"\n );\n return $this->response->redirect(\"users/usershow/$user->name\");\n }\n\n }\n\n $this->view->form = new RobotForm(\n $robot,\n [\n \"edit\" => true,\n ]\n );\n }", "public function editAction()\n {\n $form = new $this->form();\n\n $request = $this->getRequest();\n $param = $this->params()->fromRoute('id', 0);\n\n $repository = $this->getEm()->getRepository($this->entity);\n $entity = $repository->find($param);\n\n if ($entity) {\n\n $form->setData($entity->toArray());\n\n if ( $request->isPost() ) {\n\n $form->setData($request->getPost());\n\n if ( $form->isValid() ) {\n\n $service = $this->getServiceLocator()->get($this->service);\n $service->update($request->getPost()->toArray());\n\n return $this->redirect()->toRoute($this->route, array('controller' => $this->controller));\n }\n }\n } else {\n return $this->redirect()->toRoute($this->route, array('controller' => $this->controller));\n }\n\n return new ViewModel(array('form' => $form, 'id' => $param));\n\n }", "public function edit($id)\n\t{\n\t\t$SysApplication = \\Javan\\Dynaflow\\Domain\\Model\\SysApplication::find($id);\n\t\t$form = \\FormBuilder::create('Javan\\Dynaflow\\FormBuilder\\SysApplicationForm', [\n \t'method' => 'POST',\n \t'url' => 'sysapplication/update/'.$id,\n \t'model' => $SysApplication,\n \t'data' => [ 'flow_id' => $SysApplication->flow_id]\n \t]);\n\t\treturn View::make('dynaflow::sysapplication.form', compact('form', 'SysApplication'));\n\t}", "public function editAction() {\n\t\t$id = (int) $this->_getParam('id');\n\t\t$modelName = $this->_getParam('model');\n\t\t\n\t\t$model = Marcel_Backoffice_Model::factory($modelName);\n\t\t$item = $model->find($id)->current();\n\t\tif (!$item) {\n\t\t\t$item = $model->createRow();\n\t\t}\n\t\t$form = $item->getForm();\n\t\tif ($this->_request->isPost()) {\n\t\t\t$newId = $form->populate($this->_request->getPost())->save();\n\t\t\tif ($newId) {\n\t\t\t\t$this->_helper->flashMessenger('Saved successfully!');\n\t\t\t\t$this->_helper->redirector('edit', null, null, array('id' => $newId, 'model' => $modelName));\n\t\t\t}\n\t\t}\n\t\t$this->view->form = $form;\n\t\t$this->view->messages = $this->_helper->flashMessenger->getMessages();\n\t}", "public function edit($id)\n {\n return view('models::edit');\n }", "public function edit()\n {\n return view('home::edit');\n }", "public function editAction()\n {\n $id = $this->params()->fromRoute('id');\n $entity = $this->entityManager->find(Entity\\CourtClosing::class, $id);\n if (! $entity) {\n // to do: deal with it\n }\n $form = $this->getForm('update');\n $form->bind($entity);\n if ($this->getRequest()->isPost()) {\n return $this->post();\n }\n\n return new ViewModel(['form' => $form]);\n }", "public function editAction($id)\n {\n $entity = $this->getManager()->find($id);\n\n $breadcrumbs = $this->get(\"white_october_breadcrumbs\");\n $breadcrumbs->addItem('Inicio', $this->get('router')->generate('admin.homepage'));\n $breadcrumbs->addItem($this->entityDescription, $this->get(\"router\")->generate(\"admin.$this->entityName.index\"));\n $breadcrumbs->addItem('Editar');\n\n if (!$entity) {\n throw $this->createNotFoundException('No se ha encontrado el elemento');\n }\n\n $form = $this->getForm($entity);\n\n return $this->render('AdminBundle:Default:edit.html.twig', array(\n 'entity' => $entity,\n 'form' => $form->createView(),\n 'metadata' => $this->getMetadata()\n ));\n }", "public function edit()\n {\n return view('user::edit');\n }", "public function edit()\n {\n return view('user::edit');\n }", "public function edit(Form $form)\n {\n return view('admin.forms.edit', compact('form'));\n }", "public function editAction()\n {\n $form = MediaForm::create($this->get('form.context'), 'media');\n $media = $this->get('media_manager.manager')->findOneById($this->get('request')->get('media_id'));\n \n $form->bind($this->get('request'), $media);\n \n return $this->render('MediaManagerBundle:Admin:form.html.twig', array('form' => $form, 'media' => $media));\n }", "public function editAction($id) {\n $em = $this->getDoctrine()->getManager();\n\n $entity = $em->getRepository('CdlrcodeBundle:Question')->find($id);\n\n if (!$entity) {\n throw $this->createNotFoundException('Unable to find Question entity.');\n }\n\n $editForm = $this->createEditForm($entity);\n $deleteForm = $this->createDeleteForm($id);\n\n return $this->render('CdlrcodeBundle:Question:edit.html.twig', array(\n 'entity' => $entity,\n 'edit_form' => $editForm->createView(),\n 'delete_form' => $deleteForm->createView(),\n ));\n }", "public function edit($id)\n {\n return view('consultas::edit');\n }", "public function edit(DirectorFormBuilder $form, $id)\n {\n return $form->render($id);\n }", "public function edit()\n {\n return view('dashboard::edit');\n }", "public function edit($id){\n $rfid = Rfid::find($id);\n\n //load form view\n return view('rfids.edit', ['rfid' => $rfid]);\n }", "public function edit($id)\n {\n\n // retrieve provider\n $provider = Provider::findOrFail($id);\n\n // return form with provider\n return view('backend.providers.form')->with('provider', $provider);\n }", "public function edit(Question $question)\n {\n $this->employeePermission('application' , 'edit');\n $question->chooses;\n $action = 'edit';\n return view('admin.setting.question_form', compact('action' , 'question'));\n }", "public function edit() {\n return view('routes::edit');\n }", "public function edit($id)\n {\n $this->data['product'] = Product::find($id);\n $this->data['category'] = Category::arrForSelect();\n $this->data['title'] = \" Update Prouct Details\";\n $this->data['mode'] = \"edit\";\n\n return view('product.form', $this->data);\n }", "public function edit(ClueEnFormBuilder $form, $id): Response\n {\n return $form->render($id);\n }", "public function editAction($id)\n {\n $em = $this->getDoctrine()->getManager();\n\n $entity = $em->getRepository('BaseBundle:Feriado')->find($id);\n\n if (!$entity) {\n throw $this->createNotFoundException('Unable to find Feriado entity.');\n }\n\n $editForm = $this->createEditForm($entity);\n $deleteForm = $this->createDeleteForm($id);\n\n return $this->render('BaseBundle:Feriado:edit.html.twig', array(\n 'entity' => $entity,\n 'edit_form' => $editForm->createView(),\n 'delete_form' => $deleteForm->createView(),\n ));\n }", "public function edit($id)\n {\n return view('cataloguemodule::edit');\n }", "public function edit($articulo_id)\n {\n $titulo = \"Editar\";\n return View(\"articulos.formulario\",compact('titulo','articulo_id'));\n }", "public function edit($id)\n {\n $resources = User::find(session('usuario_id'))->resources;\n $languages = Language::pluck('name', 'id');\n $types = Type::pluck('name', 'id');\n $method = 'PATCH';\n\n $recurso = Resource::find($id);\n $url = \"/resource/$recurso->id\";\n\n return view('resources.resources', compact('resources', 'languages', 'types', 'method', 'url', 'recurso'));\n }", "public function edit(Question $question)\n {\n $edit = TRUE;\n return view('questionForm', ['question' => $question, 'edit' => $edit]);\n }", "public function displayEditForm(Employee $employee){\n return view('employee.displayEditForm',['employee'=>$employee]);\n }", "public function edit()\n {\n return view('website::edit');\n }", "public function edit()\n {\n return view('inventory::edit');\n }", "public function edit()\n {\n return view('initializer::edit');\n }", "public function editAction()\n {\n View::renderTemplate('Profile/edit.html', [\n 'user' => $this->user\n ]);\n }", "public function edit($id)\n {\n return view('backend::edit');\n }", "public function edit($id)\n {\n //dd($id);\n $familiaPrograma= FamiliaPrograma::findOrFail($id);\n return view('familiasPrograma.edit', compact('familiaPrograma'));\n }", "public function edit($id)\n {\n return view('crm::edit');\n }", "public function edit($id)\n {\n return view('crm::edit');\n }", "public function edit($id)\n {\n $user = User::where('id', $id)->first();\n\n\n return view('users.forms.update', compact('user'));\n }", "public function editAction($id)\n\t{\n\t\t$school = School::find( $id );\n\t\t$this->render( View::make( 'schools/form' , array(\n\t\t\t'title' => sprintf( 'Modifier \"%s\"', $school->name ),\n\t\t\t'entity' => $school\n\t\t) ) );\n\t}", "public function edit(Question $question)\n {\n $edit = TRUE;\n return view('questionForm', ['question' => $question, 'edit' => $edit ]);\n }", "public function edit(Person $person) {\n\t\t$viewModel = new PersonFormViewModel();\n\t\treturn view('person.form', $viewModel);\n\t}", "public function edit($id)\n {\n \t$product = Product::find($id);\n \treturn view('admin.products.edit')->with(compact('product')); // formulario de actualizacion de datos del producto\n }", "public function edit_person($person_id){\n \t$person = Person::find($person_id);\n \treturn view('resource_detail._basic_info.edit',compact('person'));\n }", "public function edit($id)\n {\n $professor = $this->repository->find($id);\n return view('admin.professores.edit',compact('professor'));\n }", "public function edit($id)\n {\n $data = Restful::find($id);\n return view('restful.edit', compact('data'));\n }", "public function editAction($id)\n {\n $em = $this->getDoctrine()->getManager();\n\n $entity = $em->getRepository('MedecinIBundle:Fichepatient')->find($id);\n\n if (!$entity) {\n throw $this->createNotFoundException('Unable to find Fichepatient entity.');\n }\n\n $editForm = $this->createEditForm($entity);\n $deleteForm = $this->createDeleteForm($id);\n\n return $this->render('MedecinIBundle:Fichepatient:edit.html.twig', array(\n 'entity' => $entity,\n 'edit_form' => $editForm->createView(),\n 'delete_form' => $deleteForm->createView(),\n ));\n }", "public function edit($id)\n {\n return $this->form->render('mconsole::personal.form', [\n 'item' => $this->person->query()->with('uploads')->findOrFail($id),\n ]);\n }", "public function edit($id)\n\t{\n\t\t // get the project\n $project = Project::find($id);\n\n // show the edit form and pass the project\n return View::make('logicViews.projects.edit')->with('project', $project);\n\t}" ]
[ "0.78550774", "0.7692893", "0.7273195", "0.7242132", "0.7170847", "0.70622855", "0.7053459", "0.6982539", "0.69467914", "0.6945275", "0.6941114", "0.6928077", "0.69019294", "0.68976134", "0.68976134", "0.6877213", "0.68636996", "0.68592185", "0.68566656", "0.6844697", "0.68336326", "0.6811471", "0.68060875", "0.68047357", "0.68018645", "0.6795623", "0.6791791", "0.6791791", "0.6787701", "0.67837197", "0.67791027", "0.677645", "0.6768301", "0.6760122", "0.67458534", "0.67458534", "0.67443407", "0.67425704", "0.6739898", "0.6735328", "0.6725465", "0.6712817", "0.6693891", "0.6692419", "0.6688581", "0.66879624", "0.6687282", "0.6684741", "0.6682786", "0.6668777", "0.6668427", "0.6665287", "0.6665287", "0.66610634", "0.6660843", "0.66589665", "0.66567147", "0.66545695", "0.66527975", "0.6642529", "0.6633056", "0.6630304", "0.6627662", "0.6627662", "0.66192114", "0.6619003", "0.66153085", "0.6614968", "0.6609744", "0.66086483", "0.66060555", "0.6596137", "0.65950733", "0.6594648", "0.65902114", "0.6589043", "0.6587102", "0.65799844", "0.65799403", "0.65799177", "0.657708", "0.65760696", "0.65739626", "0.656931", "0.6567826", "0.65663105", "0.65660435", "0.65615267", "0.6561447", "0.6561447", "0.65576506", "0.655686", "0.6556527", "0.6555543", "0.6555445", "0.65552044", "0.65543956", "0.65543705", "0.6548264", "0.65475875", "0.65447706" ]
0.0
-1
Update the specified resource in storage.
public function update(Request $request, $id) { // }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function updateShopifyResource() {\n $this->saving();\n $this->getShopifyApi()->call([\n 'URL' => API::PREFIX . $this->getApiPathSingleResource(),\n 'METHOD' => 'PUT',\n 'DATA' => [\n static::getResourceSingularName() => $this->shopifyData\n ]\n ]);\n }", "public function update(Request $request, Resource $resource)\n {\n $request->validate([\n 'name' => 'required',\n 'description' => 'required|string',\n 'file' => 'required|mimes:jpg,jpeg,png,doc,docx,pdf,ppt,txt',\n ]);\n\n $resource->update($request->all());\n\n if ( $request->hasFile('file') ) {\n $resource = 'resource-'.time().'.'.$request->file('file')->extension();\n $request->file->storeAs('resources', $resource,'public');\n $resource->file = $resource;\n }\n\n if ( $resource->save() ) {\n return redirect()->route('admin.resources.index')->with('success', 'Resource updated');\n } else {\n return redirect()->route('admin.resources.index')->with('error', 'Something went wrong');\n }\n }", "public function update(Request $request, Resource $resource)\n {\n //\n }", "public function updateStream($resource);", "public function update(Request $request, Storage $storage)\n {\n $storage->product_id = $request->product_id;\n $storage->amount = $request->amount;\n\n $storage->save();\n\n return redirect()->route('storages.index');\n }", "protected function updateImageResource($fileName, $imageId, $storage)\n {\n //Get image name and storage location for image\n $image = Image::where('id', '=', $imageId)->first();\n\n //Delete old image\n $this->deleteResource($image->name, $image->storage);\n\n //Store the new image\n $image->name = $fileName;\n $image->storage = $storage;\n\n $image->save();\n }", "public function update(Storage $storage, UpdateStorageRequest $request)\n {\n $this->storage->update($storage, $request->all());\n\n return redirect()->route('admin.product.storage.index')\n ->withSuccess(trans('core::core.messages.resource updated', ['name' => trans('product::storages.title.storages')]));\n }", "public function update(StoreStorage $request, Storage $storage)\n {\n $storage->fill($request->all())->save();\n $request->session()->flash('alert-success', 'Запись успешно обновлена!');\n return redirect()->route('storage.index');\n }", "public function update_asset($id, Request $request){\n \t\tif(!Auth::user()){\n\t\t\treturn redirect('/');\n\t\t}\n \t\t$asset = Storage::find($id);\n \t\t$asset->name = $request->name;\n \t\t$asset->quantity = $request->quantity;\n \t\t$asset->category_id = $request->category;\n \t\tif($request->file('image') != null){\n\t\t\t$image = $request->file('image');\n\t\t\t$image_name = time(). \".\" . $image->getClientOriginalExtension();\n\t\t\t$destination = \"images/\";\n\t\t\t$image->move($destination, $image_name);\n\t\t\t$asset->image_url = $destination.$image_name;\n\t\t} \n\t\t$asset->save();\n\t\tsession()->flash('success_message', 'Item Updated successfully');\n\t\treturn redirect(\"/storage\");\n \t}", "public function update(Request $request, Flight $exercise, FlightResource $resource)\n {\n $request->validate([\n 'display_name' => 'required|string|max:100',\n 'file' => 'nullable|file|max:10240|mimes:pdf',\n 'uri' => 'nullable|url|max:255',\n ]);\n\n if ($resource->type === 'file' && $request->file('file')) {\n Storage::drive('public')->delete($resource->resource);\n $resource->resource = $request->file('file')->store('smartcars/exercises/resources', ['disk' => 'public']);\n } elseif ($resource->type === 'uri' && $request->input('uri')) {\n $resource->resource = $request->input('uri');\n }\n\n $resource->save();\n\n return redirect()->route('adm.smartcars.exercises.resources.index', $exercise)\n ->with('success', 'Resource edited successfully.');\n }", "public function update(Request $request, $id)\n {\n $validator = Validator::make($request->all(), [\n 'title' => 'required|string',\n 'content' => 'required|string',\n 'mentoring_area_id' => 'required|integer',\n 'featured_image_uri' => 'string',\n ]);\n\n if ($validator->fails()) {\n return APIHandler::response(0, $validator->errors(), 400);\n }\n \n $resource = Resource::find($id);\n $resource->title = $request->get('title');\n $resource->content = $request->get('content');\n $resource->featured_image_uri = $request->get('featured_image_uri');\n $resource->updated_at = \\Carbon\\Carbon::now();\n $resource->mentoring_area_id = $request->get('mentoring_area_id');\n $resource->save();\n $data['resource'] = $resource;\n return APIHandler::response(1, \"Resource has been updated\");\n }", "protected function updateVideoResource($fileName, $videoId, $storage, $premium=1)\n {\n //Get video name and storage location for video\n $video = Video::where('id', '=', $videoId)->first();\n\n //Check the storage medium\n if($storage == 'vimeo' || $storage == 'youtube')\n {\n $video->name = $fileName;\n $video->storage = $storage;\n $video->premium = $premium;\n $video->save();\n }\n else\n {\n if($video['storage'] == 'local' || $video['storage'] == 's3')\n {\n //Delete old video\n $this->deleteResource($video->name, $video->storage);\n }\n \n //Store the new video\n $video->name = $fileName;\n $video->storage = $storage;\n $video->premium = $premium;\n $video->save();\n }\n }", "public function put($resource, $with=[]){\n return $this->fetch($resource, self::PUT, $with);\n }", "public function update($id, $resource) {\n SCA::$logger->log(\"update resource\");\n return $this->orders_service->update($id, $resource);\n }", "public function update($path);", "public function update($id, $resource)\n {\n SCA::$logger->log(\"Entering update()\");\n //check whether it is an sdo or an xml string.\n if ($resource instanceof SDO_DataObjectImpl) {\n //if the thing received is an sdo convert it to xml\n if ($this->xml_das !== null) {\n $xml = SCA_Helper::sdoToXml($this->xml_das, $resource);\n } else {\n throw new SCA_RuntimeException(\n 'Trying to update a resource with SDO but ' .\n 'no types specified for reference'\n );\n }\n } else {\n $xml = $resource;\n }\n\n $slash_if_needed = ('/' === $this->target_url[strlen($this->target_url)-1])?'':'/';\n\n $handle = curl_init($this->target_url.$slash_if_needed.\"$id\");\n curl_setopt($handle, CURLOPT_HEADER, false);\n curl_setopt($handle, CURLOPT_RETURNTRANSFER, true);\n curl_setopt($handle, CURLOPT_CUSTOMREQUEST, \"PUT\");\n curl_setopt($handle, CURLOPT_POSTFIELDS, $xml);\n\n //replace with Content-Type: atom whatever\n $headers = array(\"User-Agent: SCA\",\n \"Content-Type: text/xml;\",\n \"Accept: text/plain\");\n curl_setopt($handle, CURLOPT_HTTPHEADER, $headers);\n\n $result = curl_exec($handle);\n\n $response_http_code = curl_getinfo($handle, CURLINFO_HTTP_CODE);\n\n curl_close($handle);\n\n $response_exception = $this->buildResponseException($response_http_code, '200');\n\n if ($response_exception != null) {\n throw $response_exception;\n } else {\n //update does not return anything in the body\n return true;\n }\n }", "public function update(Request $request, $id)\n {\n $this->validate($request, [\n 'name' => 'required',\n 'link' => 'required',\n 'description' => 'required'\n ]);\n\n $resource = Resource::find($id);\n $resource->name = $request->name;\n $resource->type_id = $request->type_id;\n $resource->has_cost = ($request->has('has_cost')) ? 1 : 0;\n $resource->language_id = $request->language_id;\n $resource->link = $request->link;\n $resource->description = $request->description;\n $resource->tags = '';\n\n $resource->save();\n //return back()->with('success', 'Recurso actualizado satisfactoriamente');\n return redirect('/resource')->with('success', 'Recurso actualizado satisfactoriamente');\n }", "public function update(Request $request, $id)\n {\n $oldProduct = Product::findOrFail($id);\n $data = $request->all();\n if(isset($data['img'])){\n // $file = $request->file('photo');\n // return $file;\n $imgName = time().'.'.$request->img->extension();\n $data['img'] = $imgName;\n // Storage::putFile('spares', $file);\n $path = $request->img->storeAs('public/uploads', $imgName); //in Storage\n\n //delete old file\n if($oldProduct->img != 'product-default.png'){\n Storage::delete(\"public/uploads/\".$oldProduct->img);\n // return 'deleted';\n }\n \n }else{\n $data['img'] = $oldProduct->img;\n }\n $oldProduct->update($data);\n return redirect()->route('product.index'); \n\n }", "public function update($request, $id) {\n\t\t\t$image = $request['photo'];\n\t\t\tif($image !== null) {\n\t\t\t\t$name = time().'.' . explode('/', explode(':', substr($image, 0, strpos($image, ';')))[1])[1];\n\t\t\t\t\\Image::make($request['photo'])->save(public_path('storage/products/').$name);\n\t\t\t\t$request['photo'] = $name;\n\t\t\t} else {\n\t\t\t\t$currenPhoto = Product::all()->where('id', $id)->first();\n\t\t\t\t$request['photo'] = $currenPhoto->photo;\n\t\t\t}\n return $this->product->update($id, $request);\n\t}", "public function updateStream($path, $resource, Config $config)\n {\n }", "public function edit(Resource $resource)\n {\n //\n }", "public function updateResourceIndex(&$resource) {\n if ($this->connector != null) {\n\n // STEP 1: Update or insert this resource as a node:\n $this->logger->addDebug(\"Updating/Inserting Node into Neo4J database\");\n $result = $this->connector->run(\"MATCH (a:Resource {id: {id} }) SET a.title = {title}, a.version = {version}, a.href = {href}\n return a;\",\n [\n 'id' => $resource->getID(),\n 'version' => $resource->getVersion(),\n 'title' => $resource->getTitle(),\n 'href' => $resource->getLink()\n ]\n );\n\n // Check to see if anything was added\n $records = $result->getRecords();\n if (empty($records)) {\n // Must create this record instead\n $result = $this->connector->run(\"CREATE (n:Resource) SET n += {infos};\",\n [\n \"infos\" => [\n 'id' => $resource->getID(),\n 'version' => $resource->getVersion(),\n 'title' => $resource->getTitle(),\n 'href' => $resource->getLink()\n ]\n ]\n );\n }\n\n // STEP 2: Update or insert the resource's link to holding repository\n $result = $this->connector->run(\"MATCH (a:Resource {id: {id} })-[r:HIRELATION]->()\n return r;\",\n [\n 'id' => $resource->getID(),\n ]\n );\n $records = $result->getRecords();\n if (!empty($records)) {\n // delete the one there so that we can add the correct one (just in case)\n $result = $this->connector->run(\"MATCH (a:Resource {id: {id}})-[r:HIRELATION]->() delete r;\",\n [\n 'id' => $resource->getID()\n ]\n );\n\n }\n\n // If resource has a repository, then add a link\n if ($resource->getRepository() != null && $resource->getRepository()->getID() != null) {\n $this->connector->run(\"MATCH (a:Identity {id: {id1} }) MATCH (b:Resource {id: {id2} }) CREATE (b)-[r:HIRELATION]->(a);\",\n [\n 'id1' => (string) $resource->getRepository()->getID(),\n 'id2' => $resource->getID()\n ]);\n }\n }\n }", "public function update($data) {}", "public function update($data) {}", "public function putStream($resource);", "public function update(Request $request, NebulaResource $resource, $item): RedirectResponse\n {\n $this->authorize('update', $item);\n\n $validated = $request->validate($resource->rules(\n $resource->editFields()\n ));\n\n $resource->updateQuery($item, $validated);\n\n $this->toast(__(':Resource updated', [\n 'resource' => $resource->singularName(),\n ]));\n\n return redirect()->back();\n }", "public function saveShopifyResource() {\n if (is_null($this->getShopifyId())) { // if there is no id...\n $this->createShopifyResource(); // create a new resource\n } else { // if there is an id...\n $this->updateShopifyResource(); // update the resource\n }\n }", "public function update($entity);", "public function update($entity);", "public function setResource($resource);", "public function updateStream($path, $resource, Config $config)\n {\n return $this->upload($path, $resource, $config);\n }", "public function isUpdateResource();", "public function update(Request $request, $id)\n {\n $device = Device::findOrFail($id);\n $device->fill($request->all());\n if ($request->hasFile('icon')) {\n if ($device->hasMedia('icon')) {\n $device->deleteMedia($device->getFirstMedia('icon'));\n }\n $device->addMediaFromRequest('icon')->toMediaCollection('icon');\n }\n $device->save();\n return new DeviceResource($device);\n }", "public function update(Request $request, $id)\n {\n //\n $product = Product::findOrFail($id);\n \n $product->update($request->all());\n \n $file = $request->file('url_image')->move('upload', $request->file('url_image')->getClientOriginalName());\n\n Product::where('id',$id)->update(['url_image'=>$file]);\n \n \\Session::flash('flash_message', 'Edit product successfully.'); \n \n //cũ : return redirect('articles');\n return redirect()->route('products.index');\n }", "public function store($data, Resource $resource);", "public function update(Request $request, $id)\n {\n \n $product = Product::find($id);\n\n\n $product->fill($request->all())->save();\n\n //Verificamos que tenemos una imagen\n if($request->file('photo_1')){\n\n\n //En caso de tenerla la guardamos en la clase Storage en la carpeta public en la carpeta image.\n $path = Storage::disk('public')->put('photo_1',$request->file('photo_1'));\n\n //Actualizamos el Post que acabamos de crear\n $product->fill(['photo_1' => asset($path)])->save();\n\n }\n\n\n return redirect()->route('products.index')->with('info', 'Producto actualizado exitosamente!');\n }", "public function update(Request $request, $id)\n {\n $product = Product::find($id);\n\n if (\\Input::hasFile('image')) {\n $this->imgsave($request, $product);\n }\n\n\n if (!empty($request->input('tags'))) {\n $product->tags()->sync($request->input('tags'));\n } else {\n $product->tags()->detach();\n }\n\n $product->update($request->all());\n\n return redirect()->to('dashboard/product')->with('message', 'update success');\n }", "public function put($resource_path, array $variables = array()) {\n return $this->call($resource_path, $variables, 'PUT');\n }", "public function update($id)\n {\n /* Check if logged in user is authorized to make this request */\n $this->authorizeAction();\n\n if (method_exists($this, 'updateValidations')) {\n $this->request->validate($this->updateValidations());\n }\n\n /* Get the specified resource */\n $resource = $this->model::findOrFail($id);\n\n /* Update the specified resource */\n $resource->update(Input::all());\n\n /* Redirect back */\n return redirect()->back()\n ->with(\n 'info',\n Lang::has($this->name . '.resource-updated') ?\n $this->name . '.resource-updated' :\n 'messages.alert.resource-updated'\n );\n }", "public function putResponse($request)\n {\n $idSearched = $this->searcher->searchResourceIndex(\n $request, \n $this->db[$request['resource']]\n );\n if ($idSearched) {\n $resource = $this->db[$request['resource']][$idSearched];\n $bodyInput = json_decode($this->standardInput, true);\n $resource = BodyRequest::canApplyBody($bodyInput);\n $resource['id'] = (int)$request['param'];\n foreach($resource as $key => $value) {\n $this->db[$request['resource']][$idSearched][$key] = $value;\n }\n file_put_contents(DB_PATH, json_encode($this->db));\n }\n }", "public function update(Storedataset $request, dataset $dataset){\n $dataset->title = $request->input('title');\n $dataset->caption = $request->input('caption');\n $dataset->file_url = $request->input('file_url');\n $dataset->type = $request->input('type');\n $dataset->status = $request->input('status');\n $dataset->publication_id = $request->input('publication_id');\n\n $dataset->save();\n\n return redirect()->route('datasets.show', ['dataset' => $dataset]);\n }", "public function update(Request $request, $id)\n\n {\n ResourceManagement::findOrFail($id);\n $constraints = [\n 'title' => 'required|max:100',\n 'url'=> 'required|max:191',\n 'content' => 'required'\n ];\n\n $input = [\n 'title' => $request['title'],\n 'url' => $request['url'],\n 'content' => $request['content'],\n 'type' => $request['type'],\n 'level' => $request['level'],\n 'user_id' => $request['user']\n ];\n// $this->validate($input, $constraints);\n ResourceManagement::where('id', $id)\n ->update($input);\n\n return redirect()->intended('/resource-management');\n }", "public function update(Request $request, $id)\n {\n $this->validate($request, [\n 'title' => 'required',\n 'description' => 'required|string',\n 'price' => 'required|numeric',\n 'reference'=>'required'\n ]);\n \n $product = Product::find($id);\n $product->update($request->all());\n \n $im = $request->file('picture');\n \n if (!empty($im)) {\n \n $link = $request->file('picture')->store('images');\n \n \n $product->update([\n 'url_image' => $link,\n ]);\n } \n //dump($request->all());\n return redirect()->route('product.index')->with('message', 'Article modifié avec succès');\n }", "public function update(StoreOrUpdateAsset $request, Asset $asset)\n {\n if (Storage::exists($asset->path) && !Storage::delete($asset->path)) {\n abort(500);\n }\n\n $file = $request->file('file');\n $path = $file->store('assets');\n\n if (!$path) {\n abort(500);\n }\n\n // We wonder if we should delete the old file or not...\n\n $asset->name = $file->getClientOriginalName();\n $asset->size = $file->getSize();\n $asset->type = $file->getMimeType();\n $asset->path = $path;\n\n if ($asset->save()) {\n flash('The asset has been saved.')->success();\n } else {\n abort(500);\n }\n\n return redirect('/admin/assets');\n }", "public function update(FoodRecipeRequest $request, $id)\n {\n $foodRecipe = FoodRecipe::with('ingredients','cookingProcesses')->findOrFail($id);\n if ($request->input('name')!= null)\n $foodRecipe->name = $request->input('name');\n if ($request->input('detail')!= null)\n $foodRecipe->detail = $request->input('detail');\n if($request->file('photo') != null) {\n $old_file = $foodRecipe->photo;\n if($old_file != null){\n $path = public_path().'/storage/'.$old_file;\n File::delete($path);\n }\n $file = $request->file('photo');\n $name = '/foodRecipe/' . Carbon::now()->format(\"dnY-Hisu\") . \".\" . $file->extension();\n $file->storePubliclyAs('public', $name);\n $foodRecipe->photo = $name;\n }\n $foodRecipe->save();\n return new FoodRecipeResource($foodRecipe);\n }", "public function update(StorageTypeRequest $request, $id)\n {\n try {\n $this->service->updateStorageType($request, $id);\n return $this->NoContent();\n } catch (EntityNotFoundException $e) {\n \\Log::error($e->getMessage());\n return $this->NotFound($e->getMessage());\n } catch(\\QueryException $e) {\n \\Log::error($e->getMessage());\n return $this->ServerError();\n } catch(Exception $e) {\n \\Log::error($e->getMessage());\n return $this->ServerError();\n }\n }", "public function update(Request $request, $id)\n {\n //validation\n $this->validate(request(),[\n 'image' => 'image'\n ]);\n\n $slider = HomeSliders::find($id);\n \n $slider->link = request('link');\n\n //get old image to delete if updated\n $oldImage = request('oldImage');\n //get the new image\n $NewImage=$request->file('image');\n\n if($NewImage)\n {\n $filenameToStore= helpers::updatePhoto('image','homeSliders',$request);\n $slider->image=$filenameToStore;\n\n Storage::delete('public/Images/homeSliders/'.$oldImage);\n }\n\n $slider->save();\n\n Alert::success(config('app.name'), trans('messages.Updated Successfully') );\n return redirect()->route('admin.homeSlider',$slider->type);\n }", "public function update(Qstore $request, $id)\n {\n //\n }", "public function update(IEntity $entity);", "protected function performUpdate(): bool\n {\n // Abort if resource does not support update operations\n if (!$this->isUpdatable()) {\n throw new UnsupportedOperation(sprintf('API does not support update operation for %s resources', $this->resourceNameSingular()));\n }\n\n $id = $this->id();\n $prepared = $this->prepareBeforeUpdate($this->toArray());\n\n $payload = [\n $this->resourceNameSingular() => $prepared\n ];\n\n $response = $this\n ->request()\n ->put($this->endpoint($id), $payload);\n\n // Extract and (re)populate resource (if possible)\n // Note: Unlike the \"create\" method, Redmine does NOT\n // appear to send back a full resource when it has been\n // successfully updated.\n $this->fill(\n $this->decodeSingle($response)\n );\n\n return true;\n }", "public function update($request, $id);", "function put($resource, $data = null) {\r\n\t\t\r\n\t\tif(isset($data)) {\r\n\t\t\t$this->request_body = $data;\r\n\t\t}\r\n\r\n\t\t// make the call chief\r\n\t\t$this->exec ( \"PUT\", '/' . $resource );\r\n\r\n\t\t// check the request status\r\n\t\tif($this->status_code != 200){\r\n\t\t\t$this->Logger->error(\r\n\t\t\t\tsprintf(\r\n\t\t\t\t\t'GET Call for resource \\'%s\\' Failed.\r\n\t\t\t\t\tStatus: %d,\r\n\t\t\t\t\tRequest: %s\r\n\t\t\t\t\tAPI Error Message: \r\n\t\t\t\t\t%s',\r\n\t\t\t\t\t$resource,\r\n\t\t\t\t\t$this->status_code,\r\n\t\t\t\t\t$this->request_body_raw,\r\n\t\t\t\t\t$this->response_body\r\n\t\t\t\t)\r\n\t\t\t);\r\n\t\t\tthrow new Exception($this->response_body);\r\n\t\t} else {\r\n\t\t\treturn $this->response_parsed;\r\n\t\t}\r\n\t}", "public function updateEntities($resource)\n {\n $json = [\n 'resource' => $resource,\n ];\n $request = $this->createRequest('PUT', '/entities', ['json' => $json]);\n $response = $this->send($request);\n return $response;\n }", "public function updateStream($path, $resource, Config $config)\n {\n return $this->writeStream($path, $resource, $config);\n }", "public function update(Request $request, $id)\n {\n\n $product = Product::findOrFail($id);\n $product->name = $request['name'];\n $product->price = $request['price'];\n $product->stock = $request['stock'];\n $product->description = $request['description'];\n\n $file = $request->file('image');\n $fileName = $file->getClientOriginalName();\n if($fileName != $product->image){\n $request->file('image')->move('images/',$fileName);\n $product->image = $fileName;\n }\n\n $product->save();\n\n return redirect()->route('products.show',\n $product->id)->with('flash_message',\n 'Article, '. $product->name.' updated');\n }", "protected function handleUpdate()\n {\n $resource = $this->argument('resource');\n $action = $this->option('action');\n $startPage = (int)$this->option('startPage');\n $perPage = (int)$this->option('perPage');\n\n try {\n $harvest = Harvest::where('resource', $resource)->where('action', $action)->firstOrFail();\n } catch (\\Exception $e) {\n $this->info('There is no existing action for updating ' . ucwords($action) . ' ' . ucwords($resource) . '.');\n exit('Nothing was updated.');\n }\n\n $options = [\n 'startPage' => $startPage,\n 'perPage' => $perPage,\n 'lastRun' => $harvest->last_run_at\n ];\n\n // If a lastRun was given use that\n // OR if this has never been run before use 2001-01-01\n if (!empty($this->option('lastRun'))) {\n $options['lastRun'] = new Carbon($this->option('lastRun'));\n } elseif (is_null($options['lastRun'])) {\n $options['lastRun'] = new Carbon('2001-01-01');\n }\n\n $job = new UpdateResourceJob(\n $harvest,\n $options\n );\n\n $message = 'Updating ' . $action . ' ' . $resource . ' ' . $perPage . ' at a time';\n if (isset($lastRun)) {\n $message .= ' with entries updated since ' . $lastRun->format('r');\n }\n $this->info($message);\n $this->dispatch($job);\n }", "abstract public function put($data);", "public function update($id, $data);", "public function update($id, $data);", "public function update($id, $data);", "public function update($id, $data);", "public function update($id, $data);", "public function testUpdateSupplierUsingPUT()\n {\n }", "public function update(Request $request, $id)\n {\n $storageplace = Storageplace::findOrFail($id);\n $storageplace->update($request->only(['storageplace']));\n return $storageplace;\n }", "public function updateRelatedImage(Request $request, $id)\n {\n // Delete display image in Storage\n Validator::make($request->all(), ['photos' => \"required|file|image|mimes:jpg,png,jpeg|max:5000\"])->validate();\n\n\n if ($request->hasFile(\"photos\")) {\n\n $photo = ProductsPhoto::find($id);\n $imageName = $photo->photos;\n $exists = Storage::disk('local')->exists(\"public/product_images/\" . $photo->photos);\n\n //delete old image\n if ($exists) {\n Storage::delete('public/product_images/' . $imageName);\n }\n\n //upload new image\n $ext = $request->file('photos')->getClientOriginalExtension(); //jpg\n\n $request->photos->storeAs(\"public/product_images/\", $imageName);\n\n $arrayToUpdate = array('photos' => $imageName);\n DB::table('products_photos')->where('id', $id)->update($arrayToUpdate);\n\n return redirect()->route(\"adminDisplayRelatedImageForm\", ['id' => $photo->product_id]);\n } else {\n\n $error = \"NO Image was Selected\";\n return $error;\n }\n }", "public function update(Request $request, $id)\n {\n $skill = Skill::findOrFail($id);\n\n $skill->skill = $request->skill;\n\n if ($request->hasFile('image')) {\n \\Cloudder::upload($request->file('image'));\n $c=\\Cloudder::getResult();\n // $image = $request->file('image');\n // $filename = time() . '.' . $image->getClientOriginalExtension();\n // $location = public_path('images/' . $filename);\n // Image::make($image)->save($location);\n\n $skill->image = $c['url'];\n }\n\n $skill->save();\n\n Session::flash('success', 'Successsfully updated your skill!');\n return redirect()->route('skills.index');\n }", "public function updateStream($path, $resource, Config $config = null)\n {\n $contents = stream_get_contents($resource);\n\n return $this->write($path, $contents, $config);\n }", "public abstract function update($object);", "public static function update($id, $file)\n {\n Image::delete($id);\n\n Image::save($file);\n }", "public function update(Request $request, $id)\n {\n $product = Product::find($id);\n $image = $product->image;\n if($request->hasFile('image')){\n $image = $request->file('image')->store('files');\n \\Storage::delete($product->image);\n } \n $product->name = $request->get('name');\n $product->price = $request->get('price');\n $product->description = $request->get('description');\n $product->additional_info = $request->get('additional_info');\n $product->category_id = $request->get('category');\n $product->subcategory_id = $request->get('subcategory');\n $product->image = $image;\n $product->save();\n return redirect()->back();\n }", "public function update(Request $request, $id)\n {\n $sli=Slider::find($id);\n $sli->sort_order=$request->input('sort_order');\n $image = $request->file('slider');\n if($image == ''){\n $image = $sli->slider;\n }else{\n $image = base64_encode(file_get_contents($request->file('slider')));\n }\n $sli->slider = $image;\n $sli->save();\n return redirect()->back();\n }", "public function update(ProductRequest $request, $id)\n {\n $input = Product::find($id);\n $data = $request->all();\n if ($file = $request->file('product_photo')){\n $name = time().$file->getClientOriginalName();\n $file->move('product_image',$name);\n $data['product_photo']=$name;\n// $input->update($data);\n }\n $input->update($data);\n return redirect('admin/products/');\n }", "public function update(Request $request, $id)\n {\n $volume = $this->findVolume($id);\n\n if(count($volume) > 0) {\n $volume->str_volume_name = $request->str_volume_name;\n\n $volume->save();\n }\n\n return response()\n ->json(\n array(\n 'message' => 'Volume is successfully updated.',\n 'volume' => $volume\n ),\n 201\n );\n }", "public function update(Request $request, $id)\n {\n $product = ProductModel::find($id);\n $product->name = $request->name;\n $product->description = $request->description;\n $product->price = $request->price;\n $product->stock = $request->stock;\n\n if($request->image!=null){\n $imageName = time().'.'.$request->image->extension();\n $request->image->move(public_path('images'), $imageName);\n $product->image = \"/images/\".$imageName;\n }\n $product->save();\n return redirect(\"/products/index\")->with('success','Product has been updated');\n }", "public function update()\n {\n $accessory = Accessories::find(request('id'));\n\n if ($accessory == null) {\n return response()->json([\"error\" => \"aksesuaras nerastas\"], 404);\n }\n\n $this->validateData();\n $path = $accessory->src;\n\n if (request()->hasFile('src')) {\n\n if (Storage::disk('public')->exists($accessory->src)) {\n Storage::disk('public')->delete($accessory->src);\n }\n $path = request()->file('src')->store('accessoriesImages', 'public');\n }\n\n $accessory->update(array_merge($this->validateData(), ['src' => $path]));\n\n return response()->json([\"data\" => $accessory], 200);\n }", "public function update(ProductStoreRequest $request,$id)\n {\n $data = $request->validated();\n $product = Product::where('id',$id);\n $product->update($data);\n return response(\"Producto actualizado con éxito\",200);\n }", "public function update($entity)\n {\n \n }", "public function updateStream($path, $resource, Config $config)\n {\n return $this->write($path,stream_get_contents($resource),$config);\n }", "public function update($id, Request $request)\n {\n date_default_timezone_set('Asia/Taipei');\n $data = $request->all();\n $dbData = Product::find($id);\n $myfile = Storage::disk('local');\n if ($request->hasFile('img')) {\n $file = $request->file('img');\n $path = $myfile->putFile('public', $file);\n $data['img'] = $myfile->url($path);\n File::delete(public_path($dbData->img));\n }\n $dbData->update($data);\n\n if ($request->hasFile('imgs')) {\n // $this->fetchDestroyByProdId($id);\n $localS = Storage::disk('local');\n\n $fileS = $request->file('imgs');\n $imgs = [];\n foreach ($fileS as $i) {\n $pathS = $localS->putFile('public', $i);\n $imgs[] = $localS->url($pathS);\n }\n foreach ($imgs as $img) {\n ProductImg::create([\n 'product_id' => $id,\n 'img' => $img\n ]);\n }\n }\n\n return redirect()->route('admin');\n }", "public function update(Request $request, Product $product)\n { $remfile= $product->image;\n if($request->filep){\n $product->image=$request->filep;\n File::delete(storage_path('app/public/products/'.$remfile));\n }else{\n $product->image=$remfile;\n }\n //rmdir(storage_path('app/public/products/'.$remfile));\n $product->name = $request->name;\n $product->description = $request->description;\n $product->price = $request->price;\n $product->save();\n sleep(3);\n toast('Details updated successfully','info');\n return redirect('/products');\n }", "public function update($id, $input);", "public function update(ProductRequest $request,int $id): ProductResource\n {\n $attributes = $request->only('supplier_id', 'name', 'warehouses');\n\n return new ProductResource($this->productRepository->update($id, $attributes)); }", "public function update(Request $request, $id)\n {\n $slider=new Slider;\n $slider=$slider::find($id);\n \n \n if($file =$request->file('slider')){\n if(Storage::delete('public/slider/'.$slider->slider)){\n\n //Get file original name//\n \n$original_name=$file->getClientOriginalName();\n\n //Get just the file name\n$filename=pathinfo($original_name,PATHINFO_FILENAME);\n\n//Create new file name\n$name=$filename.'_'.time().'.'.$file->getClientOriginalExtension();\n\n $destination='public/slider';\n $path=$request->slider->storeAs($destination,$name);\n $slider->slider=$name;\n $slider->save();\n return redirect('Admin/slider');\n\n }\n }\n}", "public function update(Request $request, $id)\n {/* dd($request->all()); */\n $acheivePic = $this->acheiveRepo->find($id);\n $acheive = $request->except('_method', '_token', 'photo', 'ar', 'en');\n $acheiveTrans = $request->only('ar', 'en');\n\n if ($request->hasFile('icon')) {\n // Delete old image first.\n $oldPic = public_path() . '/images/acheives/' . $acheivePic->icon;\n File::delete($oldPic);\n\n // Save the new one.\n $image = $request->file('icon');\n $imageName = $this->upload($image, 'acheives');\n $acheive['icon'] = $imageName;\n }\n\n $this->acheiveRepo->update($id, $acheive, $acheiveTrans);\n\n return redirect('admin-panel/widgets/acheive')->with('updated', 'updated');\n }", "public function update(Request $request, $id)\n {\n $data = $request->all();\n extract($data);\n\n $productVarient = new ProductVariant();\n $productVarient = $productVarient->find($id);\n $productVarient->vendor_id = auth()->user()->id;\n $productVarient->description = $prod_desc;\n $productVarient->price = $price;\n\n if(request()->hasFile('photo')){\n $image = request()->file('photo')->getClientOriginalName();\n $imageNewName = auth()->user()->id.'-'.$image;\n $file = request()->file('photo');\n $file->storeAs('images/product',$imageNewName, ['disk' => 'public']);\n $productVarient->image = $imageNewName;\n }\n \n $productVarient->save();\n\n return back()->withStatus(__('Product successfully updated.'));\n }", "public function update(Request $request, $id)\n {\n //if upload new image, delete old image\n $myfile=$request->old_photo;\n if($request->hasfile('photo'))\n {\n $imageName=time().'.'.$request->photo->extension();\n $name=$request->old_photo;\n\n if(file_exists(public_path($name))){\n unlink(public_path($name));\n $request->photo->move(public_path('backendtemplate/truefalseimg'),$imageName);\n $myfile='backendtemplate/truefalseimg/'.$imageName;\n }\n }\n //Update Data\n $truefalsequestion=TrueFalseQuestion::find($id);\n $truefalsequestion->name=$request->name;\n $truefalsequestion->photo=$myfile;\n $truefalsequestion->answer = $request->answer;\n $truefalsequestion->question_id = $request->question;\n $truefalsequestion->save();\n\n //Redirect\n return redirect()->route('truefalsequestions.index'); \n }", "public function update($id);", "public function update($id);", "private function update()\n {\n $this->data = $this->updateData($this->data, $this->actions);\n $this->actions = [];\n }", "public function put($path, $data = null);", "public function update(Request $request, $id)\n {\n $request->validate([\n 'path_image'=>'image',\n 'status'=>'required|in:0,1'\n ]);\n $slider=Slider::whereId($id)->first();\n if (is_null($slider)){\n return redirect()->route('sliders.index')->with('error','Slider does not exist');\n }\n try {\n if ($request->hasFile('path_image')){\n $file = $request->file('path_image');\n\n $image_path= $file->store('/sliders',[\n 'disk'=>'uploads'\n ]);\n Storage::disk('uploads')->delete($slider->image);\n\n $request->merge([\n 'image'=>$image_path,\n ]);\n }\n\n $slider->update( $request->only(['status','image']));\n return redirect()->route('sliders.index')->with('success','Updated successful');\n }catch (\\Exception $exception){\n return redirect()->route('sliders.index')->with(['error'=>'Something error try again']);\n\n }\n }", "public function update() {\n $this->accessory->update($this->accessory_params());\n\n if ($this->accessory->is_valid()) {\n $this->update_accessory_image($this->accessory);\n redirect('/backend/accessories', ['notice' => 'Successfully updated.']);\n } else {\n redirect(\n '/backend/accessories/edit',\n ['error' => $this->accessory->errors_as_string()],\n ['id' => $this->accessory->id]\n );\n }\n }", "public function update(Entity $entity);", "public function update(Request $request, $id)\n {\n $icon = SliderIcon::find($id);\n $data = $request->all();\n $data['active'] = $request->has('active') ? 1 : 0;\n if ($request->hasFile('img')) {\n if (Storage::disk('public')->exists(str_replace('storage', '', $icon->img))){\n Storage::disk('public')->delete(str_replace('storage', '', $icon->img));\n }\n $image = $request->file('img');\n $fileName = time().'_'.Str::lower(Str::random(5)).'.'.$image->getClientOriginalExtension();\n $path_to = '/upload/images/'.getfolderName();\n $image->storeAs('public'.$path_to, $fileName);\n $data['img'] = 'storage'.$path_to.'/'.$fileName;\n }\n $icon->update($data);\n return redirect()->route('slider_icons.index')->with('success', 'Данные преимущества обнавлены');\n }", "public function update() {\n\t $this->layout = false;\n\t \n\t //set default response\n\t $response = array('status'=>'failed', 'message'=>'HTTP method not allowed');\n\t \n\t //check if HTTP method is PUT\n\t if($this->request->is('put')){\n\t //get data from request object\n\t $data = $this->request->input('json_decode', true);\n\t if (empty($data)) {\n\t $data = $this->request->data;\n\t }\n\t \n\t //check if product ID was provided\n\t if (!empty($data['id'])) {\n\t \n\t //set the product ID to update\n\t $this->Player->id = $data['id'];\n\t if ($this->Player->save($data)) {\n\t $response = array('status'=>'success','message'=>'Product successfully updated');\n\t } else {\n\t $response['message'] = \"Failed to update product\";\n\t }\n\t } else {\n\t $response['message'] = 'Please provide product ID';\n\t }\n\t }\n\t \n\t $this->response->type('application/json');\n\t $this->response->body(json_encode($response));\n\n\t return $this->response->send();\n\t}", "public function update(Request $request, $id)\n {\n //validate incoming request\n $request->validate([\n 'name' => 'string|max:100|nullable',\n 'picture' => 'max:2000|mimes:jpeg,jpg,png,svg|nullable', //max size 2mb,\n 'total' => 'integer|min:0|nullable', //value must be > 0\n 'selling_price' => 'numeric|min:0|nullable',\n 'cost_price' => 'numeric|min:0|nullable',\n 'category_id' => 'integer|nullable'\n ]);\n\n try {\n $product = Auth::user()->store->product()->findorFail($id);\n } catch (ModelNotFoundException $e) {\n return response()->json([\n \"message\" => \"Forbidden\"\n ], 403);\n }\n\n //if category id isnt null\n if ($category_id = $request->category_id) {\n if (!$this->isCategoryIdValid($category_id))\n return response()->json([\n \"message\" => \"Category Id is not valid\"\n ], 422);\n else\n $product->category_id = $request->category_id;\n }\n\n //if uploaded file exist\n if ($picture = $request->file(\"picture\")) {\n //if product already has logo\n if ($product->picture)\n Storage::delete(Product::$PICTURE_PATH . \"/\" . $product->picture);\n\n $picture_path = $picture->store(Product::$PICTURE_PATH);\n //remove folder name from path\n $product->picture = str_replace(Product::$PICTURE_PATH . \"/\", '', $picture_path);\n }\n\n $this->renewProduct($product, $request);\n $product->save();\n return response()->json(new ProductResource($product), 200);\n }", "public function update(Request $request, $id)\n {\n $request->validate([\n 'name' => 'required | min:3 | string',\n 'type' => 'required',\n 'producer' => 'required',\n 'image' => 'image | mimes:png,jpg,jpeg',\n 'price_input' => 'required | numeric | min:0 | max:300000000',\n 'promotion_price' => 'required | numeric | max:300000000',\n 'description' => 'required | string',\n\n ]);\n $product = Product::withTrashed()->findOrfail($id);\n $product->name = $request->name;\n $product->id_type = $request->type;\n $product->id_producer = $request->producer;\n\n $product->amount = $request->amount;\n if (request('image')) {\n $product->image = base64_encode(file_get_contents($request->file('image')->getRealPath()));\n }\n\n $product->price_input = $request->price_input;\n\n if ( $request->promotion_price >= 0 && $request->promotion_price < $product->price_input) {\n $product->promotion_price = $request->promotion_price;\n }else{\n return back()->with('error', '\n Do not enter a negative number');\n }\n $product->new = $request->new;\n\n $product->description = $request->description;\n\n $product->save();\n $product->size()->sync(request('size'));\n\n return redirect()->route('product.index')->with('success', 'Product Updated successfully');\n }", "public function update(Request $request, $id)\n {\n $product = Product::find($id);\n\n $product->name = $request->input('name');\n $product->description = $request->input('description');\n $product->lastPrice = $product->price !== $request->input('price') ? $product->price : NULL;\n $product->price = $request->input('price');\n\n if ($request->hasFile('image')) { \n $currentImg = $product->image;\n if ($currentImg) {\n Storage::delete('/public/' . $currentImg);\n }\n $image = $request->file('image'); \n $path = $image->store('images','public');\n $product->image = $path;\n };\n\n $product->save(); \n\n $product_promotions = $request->input('promotion');\n\n $product->promotions()->sync($product_promotions);\n\n return redirect()->route('admin.modify');\n }", "public static function updateImage($fileName, $imageId, $storage)\n {\n //Get image name and storage location for image\n $image = Image::where('id', '=', $imageId)->first();\n\n //Delete old image\n ResourceHandler::delete($image->name, $image->storage);\n\n //Store the new image\n $image->name = $fileName;\n $image->storage = $storage;\n\n $image->save();\n }", "public function update($request, $id)\n {\n $this->checkExits($id);\n $data = $request->except(['_method','_token','photo']);\n\n if($request->photo)\n {\n try {\n $this->UploadFile($request);\n } catch (\\Exception $e) {\n //if has exception , don't has action\n }\n if ($this->img !== '') {\n $data['img'] = $this->img;\n }\n }\n\n $this->object->update($data);\n\n }", "public function updateProduct($request, $product)\n {\n $product->update($request->except(['_token', '_method', 'image']));\n if ($request->hasFile('image')) {\n $image = $request->file('image');\n $imageName = time() . '.' . $request->file('image')->extension();\n // $img = Image::make('public/foo.jpg');\n\n $image_resize = Image::make($image->getRealPath());\n $image_resize->resize(500, 500);\n $image_resize->save(public_path('images/') . $imageName, 100);\n $product->gallery = $imageName;\n $product->save();\n }\n $product->getTags()->sync($request->input('tags'));\n }" ]
[ "0.7425105", "0.70612276", "0.70558053", "0.6896673", "0.6582159", "0.64491373", "0.6346954", "0.62114537", "0.6145042", "0.6119944", "0.61128503", "0.6099993", "0.6087866", "0.6052593", "0.6018941", "0.60060275", "0.59715486", "0.5946516", "0.59400934", "0.59377414", "0.5890722", "0.5860816", "0.5855127", "0.5855127", "0.58513457", "0.5815068", "0.5806887", "0.57525045", "0.57525045", "0.57337505", "0.5723295", "0.5714311", "0.5694472", "0.5691319", "0.56879413", "0.5669989", "0.56565005", "0.56505877", "0.5646085", "0.5636683", "0.5633498", "0.5633378", "0.5632906", "0.5628826", "0.56196684", "0.5609126", "0.5601397", "0.55944353", "0.5582592", "0.5581908", "0.55813426", "0.5575312", "0.55717176", "0.55661047", "0.55624634", "0.55614686", "0.55608666", "0.55599797", "0.55599797", "0.55599797", "0.55599797", "0.55599797", "0.55573726", "0.5556878", "0.5554201", "0.5553069", "0.55530256", "0.5543788", "0.55435944", "0.55412996", "0.55393505", "0.55368495", "0.5535236", "0.5534954", "0.55237365", "0.5520468", "0.55163723", "0.55125296", "0.5511168", "0.5508345", "0.55072427", "0.5502385", "0.5502337", "0.5501029", "0.54995877", "0.54979175", "0.54949397", "0.54949397", "0.54946727", "0.5494196", "0.54941916", "0.54925025", "0.5491807", "0.5483321", "0.5479606", "0.5479408", "0.5478678", "0.54667485", "0.5463411", "0.5460588", "0.5458525" ]
0.0
-1
Remove the specified resource from storage.
public function destroy(Package_Product $data) { //$this->authorize('delete', $package_product); $data->delete(); return redirect()->route('admin.packages.index')->withFlash('El producto ha sido quitado'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function delete($resource){\n return $this->fetch($resource, self::DELETE);\n }", "public function destroy(Resource $resource)\n {\n //\n }", "public function removeResource($resourceID)\n\t\t{\n\t\t}", "public function unpublishResource(PersistentResource $resource)\n {\n $client = $this->getClient($this->name, $this->options);\n try {\n $client->delete(Path::fromString($this->getRelativePublicationPathAndFilename($resource)));\n } catch (FileDoesNotExistsException $exception) {\n }\n }", "public function deleteResource(&$resource) {\n\n if ($this->connector != null) {\n $this->logger->addDebug(\"Deleting Resource Node from Neo4J database\");\n $result = $this->connector->run(\"MATCH (a:Resource {id: {id}}) detach delete a;\",\n [\n 'id' => $resource->getID()\n ]\n );\n $this->logger->addDebug(\"Updated neo4j to remove resource\");\n }\n\n }", "public function deleteShopifyResource() {\n $this->getShopifyApi()->call([\n 'URL' => API::PREFIX . $this->getApiPathSingleResource(),\n 'METHOD' => 'DELETE',\n ]);\n }", "public function deleteResource()\n {\n $database = new Database();\n $id = $this->_params['id'];\n $database->deleteResource($id);\n $this->_f3->reroute('/Admin');\n }", "protected function deleteResource($fileName, $storage)\n {\n if (Storage::disk($storage)->exists($fileName)) \n {\n return Storage::disk($storage)->delete($fileName);\n }\n }", "public function delete()\n {\n persistableCollection::getInstance($this->resourceName)->deleteObject($this);\n }", "public function remove()\n {\n $this->_getBackend()->remove($this->_id);\n }", "public function remove()\n {\n if (! ftruncate($this->fileHandle, 0)) {\n throw new StorageException(\"Could not truncate $this->path\");\n }\n if (! unlink($this->path)) {\n throw new StorageException(\"Could not delete $this->path\");\n }\n }", "public function delete()\n\t{\n\t\t$s3 = AWS::createClient('s3');\n $s3->deleteObject(\n array(\n 'Bucket' => $this->bucket,\n 'Key' => $this->location\n )\n );\n\t\tif($this->local_file && file_exists($this->local_file)) {\n\t\t\tunlink($this->local_file);\n\t\t}\n $this->local_file = null;\n\t}", "public function delete()\n\t{\n\t\tsfCore::db->query(\"DELETE FROM `swoosh_file_storage` WHERE `id`='%i';\", $this->id);\n\t\t$this->fFile->delete();\n\t}", "public function delete(): void\n {\n unlink($this->getPath());\n }", "public function delete()\n {\n if($this->exists())\n unlink($this->getPath());\n }", "public function remove($path);", "function deleteFileFromStorage($path)\n{\n unlink(public_path($path));\n}", "public function delete(): void\n {\n unlink($this->path);\n }", "private function destroyResource(DrydockResource $resource) {\n $blueprint = $resource->getBlueprint();\n $blueprint->destroyResource($resource);\n\n $resource\n ->setStatus(DrydockResourceStatus::STATUS_DESTROYED)\n ->save();\n }", "public static function delete($fileName, $storage)\n {\n if (Storage::disk($storage)->exists($fileName)) \n {\n return Storage::disk($storage)->delete($fileName);\n }\n }", "public function remove() {}", "public function remove() {}", "public function remove();", "public function remove();", "public function remove();", "public function remove();", "function delete_resource($resource_id, $page)\n\t{\n\t\t//get resource data\n\t\t$table = \"resource\";\n\t\t$where = \"resource_id = \".$resource_id;\n\t\t\n\t\t$this->db->where($where);\n\t\t$resource_query = $this->db->get($table);\n\t\t$resource_row = $resource_query->row();\n\t\t$resource_path = $this->resource_path;\n\t\t\n\t\t$image_name = $resource_row->resource_image_name;\n\t\t\n\t\t//delete any other uploaded image\n\t\t$this->file_model->delete_file($resource_path.\"\\\\\".$image_name, $this->resource_path);\n\t\t\n\t\t//delete any other uploaded thumbnail\n\t\t$this->file_model->delete_file($resource_path.\"\\\\thumbnail_\".$image_name, $this->resource_path);\n\t\t\n\t\tif($this->resource_model->delete_resource($resource_id))\n\t\t{\n\t\t\t$this->session->set_userdata('success_message', 'resource has been deleted');\n\t\t}\n\t\t\n\t\telse\n\t\t{\n\t\t\t$this->session->set_userdata('error_message', 'resource could not be deleted');\n\t\t}\n\t\tredirect('resource/'.$page);\n\t}", "public function deleteImage(){\n\n\n Storage::delete($this->image);\n }", "public function del(string $resource): bool|string\n {\n $json = false;\n $fs = unserialize($_SESSION['rfe'][$this->getRoot()], ['allowed_classes' => false]);\n if (array_key_exists($resource, $fs)) {\n // if $item has children, delete all children too\n if (array_key_exists('dir', $fs[$resource])) {\n foreach ($fs as $key => $file) {\n if (isset($file['parId']) && $file['parId'] == $resource) {\n unset($fs[$key]);\n }\n }\n }\n unset($fs[$resource]);\n $_SESSION['rfe'][$this->getRoot()] = serialize($fs);\n $json = '[{\"msg\": \"item deleted\"}]';\n }\n return $json;\n }", "public function destroy()\n\t{\n\t\treturn unlink(self::filepath($this->name));\n\t}", "public function destroy($id) {\n $book = Book::find($id);\n // return unlink(storage_path(\"public/featured_images/\".$book->featured_image));\n Storage::delete(\"public/featured_images/\" . $book->featured_image);\n if ($book->delete()) {\n return $book;\n }\n\n }", "public function destroy($id)\n {\n Storageplace::findOrFail($id)->delete();\n }", "public function destroyResourceImage(): void\n\t{\n\t\tif (isset($this->image)) {\n\t\t\t@imagedestroy($this->image->getImageResource());\n\t\t}\n\t}", "public function deleteResource(PersistentResource $resource)\n {\n $pathAndFilename = $this->getStoragePathAndFilenameByHash($resource->getSha1());\n if (!file_exists($pathAndFilename)) {\n return true;\n }\n if (unlink($pathAndFilename) === false) {\n return false;\n }\n Files::removeEmptyDirectoriesOnPath(dirname($pathAndFilename));\n return true;\n }", "public function deleteImage(){\n \tStorage::delete($this->image);\n }", "public function destroy()\n {\n $file=public_path(config('larapages.media.folder')).Input::all()['folder'].'/'.Input::all()['file'];\n if (!file_exists($file)) die('File not found '.$file);\n unlink($file);\n }", "public function delete() \r\n {\r\n if($this->exists())\r\n {\r\n unlink($this->fullName());\r\n }\r\n }", "public function destroy($id)\n {\n Myfile::find($id)->delete();\n }", "public function destroy($delete = false)\n {\n if (null !== $this->resource) {\n $this->resource->clear();\n $this->resource->destroy();\n }\n\n $this->resource = null;\n clearstatcache();\n\n // If the $delete flag is passed, delete the image file.\n if (($delete) && file_exists($this->name)) {\n unlink($this->name);\n }\n }", "public static function delete($path){\r\n $currentDir = getcwd();\r\n $storageSubPath = \"/../../\".STORAGE_PATH;\r\n $file = $currentDir . $storageSubPath . '/' . $path;\r\n\r\n unlink($file);\r\n }", "public function destroy(Storage $storage)\n {\n return redirect()->route('storages.index');\n }", "public function remove() {\n //Check if there are thumbs and delete files and db\n foreach ($this->thumbs()->get() as $thumb) {\n $thumb->remove();\n } \n //Delete the attachable itself only if is not default\n if (strpos($this->url, '/defaults/') === false) {\n Storage::disk('public')->delete($this->getPath());\n }\n parent::delete(); //Remove db record\n }", "public function removeFile($uri){\n return Storage::disk('public')->delete($uri);\n }", "public function destroy(Resource $resource)\n {\n if( $resource->delete() ){\n return Response(['status'=>'success','message'=>'Resource deleted']); \n } else {\n return Response(['status'=>'error', 'message'=>'Something went wrong']);\n }\n }", "public function delete($path);", "public function delete($path);", "public function destroy($id)\n { \n File::find($id)->remove();\n \n return redirect()->route('files.index');\n }", "public function destroy($id)\n {\n $supplier = Supplier::find($id);\n $photo = $supplier->photo;\n if ($photo) {\n unlink($photo);\n }\n $supplier->delete();\n }", "public function destroy($id)\n {\n $student = Student::where('id', $id)->first();\n // $path = $student->image;\n unlink($student->image);\n Student::findOrFail($id)->delete();\n return response('Deleted!');\n }", "public function destroy($id)\n {\n $icon = SliderIcon::find($id);\n if (Storage::disk('public')->exists(str_replace('storage', '', $icon->img))){\n Storage::disk('public')->delete(str_replace('storage', '', $icon->img));\n }\n $icon->delete();\n return redirect()->route('slider_icons.index')->with('success', 'Данные преимущества удалёны');\n }", "public function delete($path, $data = null);", "public function destroy($id)\n {\n $items=Items::find($id);\n // delete old file\n if ($items->photo) {\n $str=$items->photo;\n $pos = strpos($str,'/',1);\n $str = substr($str, $pos);\n $oldFile = storage_path('app\\public').$str;\n File::Delete($oldFile); \n }\n $items->delete();\n return redirect()->route('items.index');\n }", "public function destroy($id)\n {\n $carousel = Carousel::find($id);\n $image = $carousel->image;\n\n $basename ='img/carousel/' . basename($image);\n //Delete the file from disk\n if(file_exists($basename)){\n unlink($basename);\n }\n //With softDeletes, this is the way to permanently delete a record\n $carousel->delete();\n Session::flash('success','Product deleted permanently');\n return redirect()->back();\n }", "public function remove()\n {\n $fs = new Filesystem();\n $fs->remove($this->dir());\n }", "public static function destroy(int $resource_id)\n {\n try {\n $image_data = ListingImage::where('id', $resource_id)->first();\n self::delete_image($image_data->name);\n $delete = ListingImage::where('id', $resource_id)->delete();\n\n // activity()\n // ->causedBy(Auth::user()->id)\n // ->performedOn($delete)\n // ->withProperties(['id' => $delete->id])\n // ->log('listing image deleted');\n return response()->json(['status'=> 'ok', 'msg'=> 'Data deleted successfully']);\n } catch (Exception $e) {\n $e->getMessage();\n }\n }", "public function destroy(Storage $storage)\n {\n $this->storage->destroy($storage);\n\n return redirect()->route('admin.product.storage.index')\n ->withSuccess(trans('core::core.messages.resource deleted', ['name' => trans('product::storages.title.storages')]));\n }", "public function del($path){\n\t\treturn $this->remove($path);\n\t}", "public function destroy($id)\n {\n //\n $product = Product::findOrFail($id);\n $product->delete();\n if($product->img != 'product-default.png'){\n Storage::delete(\"public/uploads/\".$product->img);\n // return 'deleted';\n }\n return redirect()->route('product.index'); \n }", "public function removeUpload()\n{\n if ($file = $this->getAbsolutePath()) {\n unlink($file); \n }\n}", "public function destroy($id)\n {\n $image = Images::withTrashed()->find($id);\n\n Storage::disk('uploads')->delete(\"social-media/$image->filename\");\n\n $image->tags()->detach();\n $image->detachMedia(config('constants.media_tags'));\n $image->forceDelete();\n\n return redirect()->back()->with('success', 'The image was successfully deleted');\n }", "public function destroyByResourceId($resource_id)\n {\n// $online_party = $this->onlinetrack->where('resource_id', $resource_id)->get()->first();\n// $online_party->status = \"offline\";\n// $online_party->save();\n// return $online_party;\n return $this->onlinetrack->where('resource_id', $resource_id)->delete();\n }", "public function revoke($resource, $permission = null);", "public function destroy($id)\n {\n $data=Image::find($id);\n $image = $data->img;\n\n\n $filepath= public_path('images/');\n $imagepath = $filepath.$image;\n\n //dd($old_image);\n if (file_exists($imagepath)) {\n @unlink($imagepath);\n }\n\n\n $data->delete();\n\n return redirect()->route('image.index');\n }", "function delete($path);", "public function removeItem(int $id)\n\t{\n\t\t$this->storage->remove($id);\n\t}", "public function destroy(File $file)\n {\n //\n $v = Storage::delete($file->path);\n \n }", "public function destroyResource($resource)\n {\n if (!is_object($resource)) {\n return false;\n }\n\n $resource_type = get_class($resource);\n $resource_id = $resource->getKey();\n\n return Role::where('resource_type', $resource_type)\n ->where('resource_id', $resource_id)\n ->delete();\n }", "public function remove($filePath){\n return Storage::delete($filePath);\n }", "public function remove(): void\n {\n $file = $this->getAbsolutePath();\n if (!is_file($file) || !file_exists($file)) {\n return;\n }\n\n unlink($file);\n }", "public function destroy(Request $request, Storage $storage)\n {\n $storage->delete();\n $request->session()->flash('alert-success', 'Запись успешно удалена!');\n return redirect()->route('storage.index');\n }", "public function remove(Storable $entity): Storable\n {\n $this->getRepository(get_class($entity))->remove($entity);\n $this->detach($entity);\n\n return $entity;\n }", "public function processDeletedResource(EntityResource $resource)\n {\n /** @var AuthorizationRepository $repository */\n $repository = $this->entityManager->getRepository('Edweld\\AclBundle\\Entity\\Authorization');\n\n $repository->removeAuthorizationsForResource($resource);\n }", "function _unlink($resource, $exp_time = null)\n {\n if(file_exists($resource)) {\n return parent::_unlink($resource, $exp_time);\n }\n\n // file wasn't found, so it must be gone.\n return true;\n }", "public function remove($id);", "public function remove($id);", "public function deleted(Storage $storage)\n {\n //\n }", "public function destroy($id)\n {\n $data = Product::findOrFail($id);\n\n if(file_exists('uploads/product/'.$data->image1)){\n unlink('uploads/product/'.$data->image1);\n }\n\n if(file_exists('uploads/product/'.$data->image2)){\n unlink('uploads/product/'.$data->image2);\n }\n\n if(file_exists('uploads/product/'.$data->image3)){\n unlink('uploads/product/'.$data->image3);\n }\n $data->delete();\n }", "public function removeUpload()\n {\n $file = $this->getAbsolutePath();\n if ($file) {\n unlink($file);\n }\n }", "public function resources_delete($resource_id, Request $request) {\n if ($resource_id) {\n $resp = Resources::where('id', '=', $resource_id)->delete();\n if($resp){\n $msg = 'Resource has been deleted successfully.';\n $request->session()->flash('message', $msg);\n }\n }\n //return redirect()->route('admin-factor-list');\n return redirect()->to($_SERVER['HTTP_REFERER']);\n }", "public function delete()\n {\n try\n {\n $thumbnail = $this->getThumbnail();\n if($thumbnail)\n {\n $thumbnail->delete();\n }\n }\n catch(sfException $e){}\n \n // delete current file\n parent::delete();\n }", "function deleteResource($uuid){\n $data = callAPI(\"DELETE\",\"/urest/v1/resource/\".$uuid);\n return $data;\n}", "public function delete();", "public function delete();", "public function delete();", "public function delete();", "public function delete();", "public function delete();", "public function delete();", "public function delete();", "public function delete();", "public function delete();", "public function delete();", "public function delete();", "public function delete();", "public function delete();", "public function delete();", "public function remove_resource($idproject){\n\t\t\n\t\t// Load model and try to get project data\n\t\t$this->load->model('Projects_model', 'projects');\n\t\t\n\t\t// Update\n\t\t$this->projects->save_project(array(\"ext\" => \"\", \"vzaar_idvideo\" => \"0\", \"vzaar_processed\" => \"0\"), $idproject);\n\t}", "public function destroy($id){\n $file_data = Slider::findOrFail($id);\n File::delete(public_path('../storage/app/public/sliders/'.$file_data->path));\n $slider = Slider::destroy($id);\n return response()->json(null, 204);\n }", "public function delete()\n\t{\n\t\t@unlink($this->get_filepath());\n\t\t@unlink($this->get_filepath(true));\n\t\tparent::delete();\n\t}", "public function delete($resource_path, array $variables = array()) {\n return $this->call($resource_path, $variables, 'DELETE');\n }", "public function destroy($id)\n {\n //Find Slider With Id\n $slider = Slider::findOrFail($id);\n // Check If The Image Exist\n if(file_exists('uploads/slider/'.$slider->image)){\n\n unlink( 'uploads/slider/'.$slider->image);\n }\n $slider->delete();\n return redirect()->back()->with('success','Slider Successfully Deleted');\n }" ]
[ "0.6672584", "0.6659381", "0.6635911", "0.6632799", "0.6626075", "0.65424126", "0.65416265", "0.64648265", "0.62882507", "0.6175931", "0.6129922", "0.60893893", "0.6054415", "0.60428125", "0.60064924", "0.59337646", "0.5930772", "0.59199584", "0.5919811", "0.5904504", "0.5897263", "0.58962846", "0.58951396", "0.58951396", "0.58951396", "0.58951396", "0.5880124", "0.58690923", "0.5863659", "0.5809161", "0.57735413", "0.5760811", "0.5753559", "0.57492644", "0.5741712", "0.57334286", "0.5726379", "0.57144034", "0.57096", "0.5707689", "0.5705895", "0.5705634", "0.5703902", "0.5696585", "0.5684331", "0.5684331", "0.56780374", "0.5677111", "0.5657287", "0.5648262", "0.5648085", "0.5648012", "0.5640759", "0.5637738", "0.5629985", "0.5619264", "0.56167465", "0.5606877", "0.56021434", "0.5601949", "0.55992156", "0.5598557", "0.55897516", "0.5581397", "0.5566926", "0.5566796", "0.55642897", "0.55641", "0.5556583", "0.5556536", "0.5550097", "0.5543172", "0.55422723", "0.5540013", "0.5540013", "0.55371785", "0.55365825", "0.55300397", "0.552969", "0.55275744", "0.55272335", "0.55271083", "0.55271083", "0.55271083", "0.55271083", "0.55271083", "0.55271083", "0.55271083", "0.55271083", "0.55271083", "0.55271083", "0.55271083", "0.55271083", "0.55271083", "0.55271083", "0.55271083", "0.5525997", "0.5525624", "0.5523911", "0.5521122", "0.5517412" ]
0.0
-1
Array of property to type mappings. Used for (de)serialization
public static function swaggerTypes() { return self::$swaggerTypes; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getTypes()\n {\n $types = PropertyType::all();\n $values = [];\n foreach ($types as $key) {\n $values[] = $key->id;\n }\n return $values;\n }", "public function getTypes(): array\n {\n return $this->types;\n }", "public static function getTypeMap() {\n return [\n 'session_id' => self::FIELD_INT,\n 'user_id' => self::FIELD_INT,\n 'session_string' => self::FIELD_STRING,\n 'create_date' => self::FIELD_EPOCH,\n 'update_date' => self::FIELD_EPOCH,\n ];\n }", "public static function getTypesMap(): array\n {\n return self::$typesMap;\n }", "public static function getTypeMap() {\n return [\n 'charge_id' => self::FIELD_INT,\n 'user_id' => self::FIELD_INT,\n 'amount' => self::FIELD_INT,\n 'description' => self::FIELD_STRING,\n 'charge_date' => self::FIELD_EPOCH,\n 'create_date' => self::FIELD_EPOCH,\n 'update_date' => self::FIELD_EPOCH,\n ];\n }", "static protected function getPropertyTypes($typeArray) {\n\n\t\t$types = array();\n\t\t// Types are mapped to this entry by typoscript\n\t\t// (e.g. postProcessor.1.properties.1.type.1 = WORK)\n\t\t$typeKeys = \\TYPO3\\CMS\\Core\\TypoScript\\TemplateService::sortedKeyList($typeArray);\n\n\t\tforeach ($typeKeys as $typeKey) {\n\t\t\tif (!intval($typeKey) || strpos($typeKey, '.') !== FALSE) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t$types[] = strtoupper($typeArray[$typeKey]);\n\t\t}\n\t\treturn $types;\n\t}", "public function get_types()\n\t{\n\t\treturn array();\n\t}", "public function getTypes() : array\n {\n return \\array_map(function ($t) {\n return $t instanceof self ? $t : new self([$t]);\n }, $this->types);\n }", "public static function getPropertyTypes() {\n\t\treturn self::$PROPERTY_TYPES;\n\t}", "public static function getPropertyTypes() {\n\t\treturn self::$PROPERTY_TYPES;\n\t}", "public static function getPropertyTypes() {\n\t\treturn self::$PROPERTY_TYPES;\n\t}", "public function getTypeMap()\n {\n }", "public function getTypeMap()\n {\n return $this->typeMap;\n }", "public function getTypes(): array;", "public function getTypes(): array;", "function getTypes() {\n\t\treturn $this->types;\n\t}", "static function getTypes(): array\n\t{\n return self::$types;\n }", "public static function getTypeArray()\n {\n return [\n self::TYPE_GENERIC => Yii::t('app', 'Generic'),\n ];\n }", "public function getTypes()\n {\n return $this->types;\n }", "public function getTypes()\n {\n return $this->types;\n }", "public function getTypeArr(){\n\t\treturn [\n\t\t\t'normal' =>'Normal',\n\t\t\t'ip'\t =>'IP',\n\t\t\t'iprange'=>'IP Bereich'\n\t\t];\n\t}", "public function getTypes() {\n\t\treturn $this->types;\n\t}", "public function typesProvider()\n {\n return [\n '1 Type' => ['Type1'],\n '2 Type' => [['Type1', 'Type2']],\n ];\n }", "public function types()\n {\n return $this->types;\n }", "protected function getTypes() {}", "public static function getTypesMap()\n {\n return self::$typesMap;\n }", "public static function getTypes()\n {\n return [\n ModelRegistry::TRANSACTION => ModelRegistry::getById(ModelRegistry::TRANSACTION)->label,\n ModelRegistry::PRODUCT => ModelRegistry::getById(ModelRegistry::PRODUCT)->label,\n ];\n }", "public function getTypes()\n {\n return $this->getTypesCollection()->getArrayCopy();\n }", "public function validPropertyTypes()\n {\n return [\n ['integer'],\n ['int'],\n ['float'],\n ['boolean'],\n ['bool'],\n ['string'],\n ['DateTime'],\n ['array'],\n ['ArrayObject'],\n ['SplObjectStorage'],\n ['Neos\\Flow\\Foo'],\n ['\\Neos\\Flow\\Bar'],\n ['\\Some\\Object'],\n ['SomeObject'],\n ['array<string>'],\n ['array<Neos\\Flow\\Baz>'],\n ['?string'],\n ['null|string'],\n ['string|null'],\n ['?\\Some\\Object'],\n ['\\Some\\Object|null'],\n ['?array<Neos\\Flow\\Baz>'],\n ['null|array<Neos\\Flow\\Baz>']\n ];\n }", "public function getTypes()\n {\n return $this->getData(self::TYPES);\n }", "protected function types()\n {\n return [\n 'bigint',\n 'blob',\n 'boolean',\n 'date',\n 'decimal',\n 'integer',\n 'longText',\n 'smallint',\n 'text',\n 'time',\n 'timestamp',\n 'timestamptz',\n ];\n }", "protected function _listTypes()\n {\n global $config;\n $types = objects::types();\n\n $result = array();\n foreach ($types as $type) {\n $infos = objects::infos($type);\n $result[$type] = $infos['name'];\n }\n return $result;\n }", "public function toArray()\n {\n $data = parent::toArray();\n if (isset($this->type)) {\n $data['type'] = $this->type;\n }\n return $data;\n }", "public function getTypes();", "public function getTypes();", "public function getTypes();", "public function getTypes();", "protected function getPropertyTypeAttributes()\n {\n return array_merge(\n $this->getCommonAttributes(),\n array(\n 'multiple' => array('values' => array('*', 'mul', 'multiple'), 'variant' => true),\n 'queryops' => array('values' => array('qop', 'queryops'), 'variant' => true), // Needs special handling !\n 'nofulltext' => array('values' => array('nof', 'nofulltext'), 'variant' => true),\n 'noqueryorder' => array('values' => array('nqord', 'noqueryorder'), 'variant' => true),\n )\n );\n }", "public function getTypes()\n {\n return get_object_vars($this);\n }", "public function getTypeMapper();", "public static function mapping()\r\n {\r\n return [\r\n self::BUS_TICKET_NAME => self::BUS_TICKET_CLASS,\r\n self::AIRPORTBUS_TICKET_NAME => self::AIRPORTBUS_TICKET_CLASS,\r\n self::TRAIN_TICKET_NAME => self::TRAIN_TICKET_CLASS,\r\n self::FLIGHT_TICKET_NAME => self::FLIGHT_TICKET_CLASS,\r\n ];\r\n }", "public function get_types()\n {\n return self::$TYPES;\n }", "public function typeProvider()\n {\n return array(\n array(true, false),\n array(12, false),\n array(24.50, false),\n array(new \\stdClass(), false),\n array('string', true),\n );\n }", "public function dataTypeMap()\n {\n return config('codegenerator.eloquent_type_to_method');\n }", "protected function property_map() { return array(); }", "public function getMimetypeMapping()\n {\n if (isset($this->raw->mimetypes)) {\n return (array) $this->raw->mimetypes;\n }\n\n return array();\n }", "public static function getTypes(): array\n {\n return self::getRelevancyTypes();\n }", "public static function types()\n {\n return self::$types;\n }", "public static function getArrayTypes() {\n return array(\n self::TYPE_NEWS => DomainConst::CONTENT00472,\n self::TYPE_OTHER => DomainConst::CONTENT00031,\n );\n }", "public function types(): array\n {\n return collect($this->modelSchemas)->map(function ($modelSchema) {\n return $modelSchema instanceof RootType\n ? $modelSchema\n : $this->registry->type($this->registry->getModelSchema($modelSchema)->typename());\n })->toArray();\n }", "public function getTypes(): array\n {\n return $this->map(static function (DataSetColumn $column) {\n return $column->getType();\n })->toArray();\n }", "public function invalidPropertyTypes()\n {\n return [\n ['string<string>'],\n ['int<Neos\\Flow\\Baz>']\n ];\n }", "public function get_types()\n {\n }", "public static function getTypes()\n\t{\n\t\t\n\t\treturn [\n\t\t\tself::TYPE_SHARES\t\t\t =>\t\"Shares\",\n\t\t\tself::TYPE_PROPERTY\t\t\t =>\t\"Property\",\n\t\t];\n\t\t\n\t}", "public function get(): array\n {\n if ($this->types === []) {\n return self::$allowedTypes;\n }\n return $this->types;\n }", "public function types(): array\n {\n $json = $this->parent->performAPICallWithJsonResponse('get', 'artwork/types');\n return DataParser::parseDataArray($json, ArtworkType::class);\n }", "protected function loadPropertyTypes() {\n\t\tif (empty($this->cachedPropertyTypes)) {\n\t\t\t$completePropertyTypeConfiguration = $this->configurationManager->getConfiguration('PropertyTypes');\n\t\t\tforeach (array_keys($completePropertyTypeConfiguration) as $propertyTypeName) {\n\t\t\t\t$this->loadPropertyType($propertyTypeName, $completePropertyTypeConfiguration);\n\t\t\t}\n\t\t}\n\t}", "public static function types() : array\n {\n return ['questions', 'pictures', 'video'];\n }", "public function getFieldDeserializers(): array {\n $o = $this;\n return [\n '@odata.type' => fn(ParseNode $n) => $o->setOdataType($n->getStringValue()),\n 'settingDefinitionId' => fn(ParseNode $n) => $o->setSettingDefinitionId($n->getStringValue()),\n 'settingInstanceTemplateReference' => fn(ParseNode $n) => $o->setSettingInstanceTemplateReference($n->getObjectValue([DeviceManagementConfigurationSettingInstanceTemplateReference::class, 'createFromDiscriminatorValue'])),\n ];\n }", "public static function getTypes(): array {\n\t\treturn ['pizza'];\n\t}", "public static function getTypesList()\n {\n return ArrayHelper::map(Yii::$app->get('cms')->getPageTypes(), 'type', 'name');\n }", "public function getFieldDeserializers(): array {\n $o = $this;\n return [\n 'attributeMappings' => fn(ParseNode $n) => $o->setAttributeMappings($n->getCollectionOfObjectValues([AttributeMapping::class, 'createFromDiscriminatorValue'])),\n 'enabled' => fn(ParseNode $n) => $o->setEnabled($n->getBooleanValue()),\n 'flowTypes' => fn(ParseNode $n) => $o->setFlowTypes($n->getEnumValue(ObjectFlowTypes::class)),\n 'metadata' => fn(ParseNode $n) => $o->setMetadata($n->getCollectionOfObjectValues([ObjectMappingMetadataEntry::class, 'createFromDiscriminatorValue'])),\n 'name' => fn(ParseNode $n) => $o->setName($n->getStringValue()),\n '@odata.type' => fn(ParseNode $n) => $o->setOdataType($n->getStringValue()),\n 'scope' => fn(ParseNode $n) => $o->setScope($n->getObjectValue([Filter::class, 'createFromDiscriminatorValue'])),\n 'sourceObjectName' => fn(ParseNode $n) => $o->setSourceObjectName($n->getStringValue()),\n 'targetObjectName' => fn(ParseNode $n) => $o->setTargetObjectName($n->getStringValue()),\n ];\n }", "public function getPropertyTypes()\n\t{\n\t\treturn $this->hasOne(PropertyTypes:: className(), ['id' => 'property_type_id']);\n\t}", "public static function get_types()\n {\n return self::$TYPES;\n }", "public function toArray(): array\n {\n return [\n 'type' => self::typeToString($this->type),\n 'required' => $this->required,\n 'list' => $this->list,\n 'hidden' => $this->hidden\n ];\n }", "public function toJson() {\n\t\t$array = array(\"types\"=>array());\n\t\tforeach ($this->types as $type) {\n\t\t\t$array[\"types\"][] = $type->toJson();\n\t\t}\n\t\tif ($this->warningMessage) {\n\t\t\t$array[\"warning\"] = $this->warningMessage;\n\t\t}\n\t\treturn $array;\n\t}", "public function types()\n {\n return [\n static::TYPE_APP,\n static::TYPE_GALLERY,\n static::TYPE_PHOTO,\n static::TYPE_PLAYER,\n static::TYPE_PRODUCT,\n static::TYPE_SUMMARY,\n static::TYPE_SUMMARY_LARGE_IMAGE,\n ];\n }", "protected static function _getDataTypes()\n {\n return [];\n }", "public static function types(): array\n {\n $all = self::getAll();\n\n return array_keys($all);\n }", "public function getTypes()\n {\n $oDb = Factory::service('Database');\n $oResult = $oDb->query('SHOW COLUMNS FROM `' . $this->table . '` LIKE \"type\"')->row();\n $sTypes = $oResult->Type;\n $sTypes = preg_replace('/enum\\((.*)\\)/', '$1', $sTypes);\n $sTypes = str_replace(\"'\", '', $sTypes);\n $aTypes = explode(',', $sTypes);\n\n $aOut = [];\n\n foreach ($aTypes as $sType) {\n $aOut[$sType] = ucwords(strtolower($sType));\n }\n\n return $aOut;\n }", "public static function types()\n\t{\n\t\t$states = array(\n\t\t\t'blog' => __('Blog'),\n\t\t\t'page' => __('Page'),\n\t\t\t'user' => __('User')\n\t\t);\n\n\t\t$values = Module::action('gleez_types', $states);\n\n\t\treturn $values;\n\t}", "public static function getTypeList() {\n return array(\n self::TYPE_CODE_1=>self::TYPE_STRING_1,\n self::TYPE_CODE_2=>self::TYPE_STRING_2,\n self::TYPE_CODE_3=>self::TYPE_STRING_3,\n self::TYPE_CODE_4=>self::TYPE_STRING_4,\n self::TYPE_CODE_5=>self::TYPE_STRING_5,\n self::TYPE_CODE_6=>self::TYPE_STRING_6\n );\n }", "public function getObjectMaps()\n {\n return array(\n 'id' => self::TYPE_STRING,\n 'self' => self::TYPE_STRING,\n 'author' => self::TYPE_USER,\n 'comment' => self::TYPE_STRING,\n 'timeSpentSeconds' => 'integer',\n 'billedSeconds' => 'integer',\n 'dateStarted' => 'datatime',\n 'issue' => self::TYPE_ISSUE,\n// 'workAttributeValues'\n );\n }", "protected static function getPossibleVarTypes() {\n\t\treturn [\n\t\t\tPropertiesInterface::DTYPE_DEP_CURRENCY => CurrencyType::class,\n\t\t\tPropertiesInterface::DTYPE_DEP_EMAIL => EmailType::class,\n\t\t\tPropertiesInterface::DTYPE_DEP_FILE => FileType::class,\n\t\t\tPropertiesInterface::DTYPE_DEP_FORM_SECTION => FormSectionType::class,\n\t\t\tPropertiesInterface::DTYPE_DEP_FORM_SECTION_CLOSE => FormSectionCloseType::class,\n\t\t\tPropertiesInterface::DTYPE_DEP_IMAGE => ImageType::class,\n\t\t\tPropertiesInterface::DTYPE_DEP_MTIME => MtimeType::class,\n\t\t\tPropertiesInterface::DTYPE_DEP_SOURCE => SourceType::class,\n\t\t\tPropertiesInterface::DTYPE_DEP_STIME => StimeType::class,\n\t\t\tPropertiesInterface::DTYPE_DEP_TIME_ONLY => TimeOnlyType::class,\n\t\t\tPropertiesInterface::DTYPE_DEP_TXTBOX => TxtboxType::class,\n\t\t\tPropertiesInterface::DTYPE_DEP_URL => UrlType::class,\n\t\t\tPropertiesInterface::DTYPE_DEP_URLLINK => UrllinkType::class,\n\t\t\tPropertiesInterface::DTYPE_ARRAY => ArrayType::class,\n\t\t\tPropertiesInterface::DTYPE_BOOLEAN => BooleanType::class,\n\t\t\tPropertiesInterface::DTYPE_DATETIME => DateTimeType::class,\n\t\t\tPropertiesInterface::DTYPE_FILE => \\Imponeer\\Properties\\Types\\FileType::class,\n\t\t\tPropertiesInterface::DTYPE_FLOAT => FloatType::class,\n\t\t\tPropertiesInterface::DTYPE_INTEGER => IntegerType::class,\n\t\t\tPropertiesInterface::DTYPE_LIST => ListType::class,\n\t\t\tPropertiesInterface::DTYPE_OBJECT => ObjectType::class,\n\t\t\tPropertiesInterface::DTYPE_OTHER => OtherType::class,\n\t\t\tPropertiesInterface::DTYPE_STRING => StringType::class\n\t\t];\n\t}", "function get_field_mapping_types() {\n return drupal_map_assoc([\n 'string',\n 'keyword',\n 'date',\n 'long',\n 'double',\n 'boolean',\n 'ip',\n 'object',\n 'nested',\n 'geo_point',\n 'geo_shape',\n 'completion',\n ]);\n}", "function FieldTypesArray() {}", "public static function getTypes() {\n\t\treturn [\n\t\t\t'text' => self::RESOURCE_TYPE_TEXT,\n\t\t\t'img' => self::RESOURCE_TYPE_IMG\n\t\t];\n\t}", "public function getFieldDeserializers(): array {\n $o = $this;\n return [\n '@odata.type' => fn(ParseNode $n) => $o->setOdataType($n->getStringValue()),\n 'response' => fn(ParseNode $n) => $o->setResponse($n->getEnumValue(ResponseType::class)),\n 'time' => fn(ParseNode $n) => $o->setTime($n->getDateTimeValue()),\n ];\n }", "public static function types()\n {\n return [\n self::TYPE_PERSONAL => Yii::t('app', 'Personal'),\n self::TYPE_BUSINESS => Yii::t('app', 'Business'),\n self::TYPE_CUSTOM => Yii::t('app', Yii::$app->holidaySettings->customHolidayName)\n ];\n }", "public function getMapPaymentTypes()\n {\n return $this->map_payment_types;\n }", "private function &getSerializableAttributeTypesFromCache(): array {\n $key = \\get_class($this);\n if (!isset(self::$__attrTypeCache[$key])) {\n self::$__attrTypeCache[$key] = $this->getSerializableAttributeTypes();\n }\n return self::$__attrTypeCache[$key];\n }", "public function getTypeFields(): array\n {\n return array_merge(\n $this->getAttributesFields(),\n $this->getTypeRelations(),\n $this->getAggregatedFields(),\n $this->getOptionalFields()\n );\n }", "public function getDataClasses()\n {\n return $this->data_types;\n }", "protected function getTypeMapping()\n {\n return self::$mysqlTypeMap;\n }", "protected function get_array_field_types() {\n\t\treturn array( 'multicheck' );\n\t}", "function getFieldTypesAction()\n {\n $this->_helper->viewRenderer->setNoRender();\n Zend_Loader::loadClass('Table_FieldType');\n Zend_Loader::loadClass('FieldType');\n $fieldTypesTable = new Table_FieldType();\n $rows = $fieldTypesTable->fetchAll();\n $fieldTypes = array();\n $i = 0;\n foreach ($rows as $row) \n {\n $fieldTypes[$i] = new FieldType($row);\n ++$i;\n }\n header('Content-Type: application/json; charset=utf8');\n echo Zend_Json::encode($fieldTypes);\n }", "public static function getTypeArray() {\n return array( \n 'to' => 'EthD20',\n 'from' => 'EthD20',\n 'gas' => 'EthQ',\n 'gasPrice' => 'EthQ',\n 'value' => 'EthQ',\n 'data' => 'EthD',\n 'nonce' => 'EthQ',\n );\n }", "public function toArray(): array\n {\n return [\n 'name' => $this->name,\n 'type' => $this->type,\n ];\n }", "public function getFieldTypeClasses() : array\n {\n return [TableType::class];\n }", "public static function getTypeList()\n {\n return [\n self::TYPE_TEXT_FIELD => '',\n self::TYPE_DROP_DOWN => '',\n ];\n }", "public function getClassMap()\n {\n return array();\n }", "public function attributeCustomTypes()\n {\n $flagEnabled = \\common\\components\\Consts::STATUS_ENABLED;\n return array(\n 'id' => array('data-options' => array('checkbox'=>'true'), 'key' => true),\n 'type' => array('width' => 100),\n 'office_id' => array('width' => 100),\n 'int_value' => array('width' => 100),\n 'float_value' => array('width' => 100),\n 'str_value' => array('width' => 100),\n 'flag' => array('width' => 100, 'formatter'=>\"function(value,row){ return '0x'+parseInt(value).toString(16); }\"),\n 'status' => array('width' => 80, 'sortable' => 'true',\n 'formatter' => \"function(value,row){ if (value == {$flagEnabled}) { return $.custom.lan.defaults.role.enabled; } else { return $.custom.lan.defaults.role.disabled; };}\"),\n 'edit_user_id' => array('width' => 100, 'sortable' => 'true', 'formatter' => \"function(value,row){ return row.edit_user_disp; }\"),\n 'created_at' => array('width' => 140, 'sortable' => 'true', 'formatter' => \"function(value,row){return $.custom.utils.humanTime(value);}\"),\n 'updated_at' => array('width' => 140, 'sortable' => 'true', 'formatter' => \"function(value,row){return $.custom.utils.humanTime(value);}\"),\n 'operation' => array('width' => 160, \n 'buttons' => array(\n ),\n ),\n );\n }", "public static function getTypeArray() {\n\t\treturn array( \n\t\t\t'hash' => 'EthD32',\n\t\t\t'nonce' => 'EthQ',\n\t\t\t'blockHash' => 'EthD32',\n\t\t\t'blockNumber' => 'EthQ',\n\t\t\t'transactionIndex' => 'EthQ',\n\t\t\t'from' => 'EthD20',\n\t\t\t'to' => 'EthD20',\n\t\t\t'value' => 'EthQ',\n\t\t\t'gasPrice' => 'EthQ',\n\t\t\t'gas' => 'EthQ',\n\t\t\t'input' => 'EthD',\n\t\t);\n\t}", "public function get_post_types() {\n\n\t\treturn [\n\t\t\tPost_Type_Movie::SLUG,\n\t\t];\n\n\t}", "public function getFieldDeserializers(): array {\n $o = $this;\n return [\n 'attributeDestination' => fn(ParseNode $n) => $o->setAttributeDestination($n->getObjectValue([AccessPackageResourceAttributeDestination::class, 'createFromDiscriminatorValue'])),\n 'attributeName' => fn(ParseNode $n) => $o->setAttributeName($n->getStringValue()),\n 'attributeSource' => fn(ParseNode $n) => $o->setAttributeSource($n->getObjectValue([AccessPackageResourceAttributeSource::class, 'createFromDiscriminatorValue'])),\n 'id' => fn(ParseNode $n) => $o->setId($n->getStringValue()),\n 'isEditable' => fn(ParseNode $n) => $o->setIsEditable($n->getBooleanValue()),\n 'isPersistedOnAssignmentRemoval' => fn(ParseNode $n) => $o->setIsPersistedOnAssignmentRemoval($n->getBooleanValue()),\n '@odata.type' => fn(ParseNode $n) => $o->setOdataType($n->getStringValue()),\n ];\n }", "protected function loadTypes()\n {\n return array(\n new RecaptchaType(\n $this->app['salberts_recaptcha2.public_key'],\n $this->app['salberts_recaptcha2.enabled'],\n $this->app['salberts_recaptcha2.ajax'],\n $this->app['salberts_recaptcha2.locale_key']\n )\n );\n }", "public function transform(Type $type) : array\n {\n return [\n 'id' => (int) $type->id,\n 'name' => (string) $type->name,\n 'slug' => (string) $type->slug\n ];\n }", "public function toArray()\n {\n return [\n 'type' => 'object',\n 'properties' => [\n 'email' => ['type' => 'string'],\n 'key' => ['type' => 'string'],\n 'name' => ['type' => 'string'],\n 'picture' => ['type' => 'string'],\n 'phone' => ['type' => 'string'],\n 'balance' => ['type' => 'integer', 'format' => 'int32'],\n 'codes' => ['type' => 'array', 'items' => ['type' => 'string']],\n 'order_comment_tracking_code' => ['type' => 'string'],\n 'title' => ['type' => 'string'],\n ],\n 'required' => ['email', 'key', 'name', 'phone', 'balance', 'codes', 'order_comment_tracking_code', 'title'],\n ];\n }", "public static function getTypes();", "public function serializeProperties(\n VisitorInterface $visitor,\n Properties $properties,\n array $type,\n Context $context\n ): array {\n $type['name'] = 'array';\n $type['params'] = [\n 'name' => 'string'\n ];\n\n return $visitor->visitArray($properties->toArray(), $type, $context);\n }", "public function getFieldDeserializers(): array {\n $o = $this;\n return array_merge(parent::getFieldDeserializers(), [\n 'file' => fn(ParseNode $n) => $o->setFile($n->getBinaryContent()),\n 'sensitiveTypeIds' => function (ParseNode $n) {\n $val = $n->getCollectionOfPrimitiveValues();\n if (is_array($val)) {\n TypeUtils::validateCollectionValues($val, 'string');\n }\n /** @var array<string>|null $val */\n $this->setSensitiveTypeIds($val);\n },\n ]);\n }" ]
[ "0.67785335", "0.66035706", "0.6598244", "0.6585131", "0.6582151", "0.6518639", "0.6506422", "0.6472867", "0.64320064", "0.64320064", "0.64320064", "0.6400023", "0.62269986", "0.6178615", "0.6178615", "0.6130437", "0.6123045", "0.61120385", "0.6111842", "0.6111842", "0.61046696", "0.60997456", "0.60879415", "0.6045651", "0.60407495", "0.6035797", "0.6019377", "0.6004722", "0.60019714", "0.59699005", "0.5959584", "0.5950738", "0.59312403", "0.58953613", "0.58953613", "0.58953613", "0.58953613", "0.58953434", "0.5886207", "0.5868021", "0.5867179", "0.5840345", "0.58352715", "0.58288", "0.58209026", "0.5810996", "0.5801216", "0.57924145", "0.5756016", "0.5746061", "0.57398295", "0.57339615", "0.5732814", "0.5723393", "0.5705035", "0.56939536", "0.569289", "0.5691891", "0.56868637", "0.5662884", "0.56406724", "0.5639129", "0.5633926", "0.562584", "0.5609369", "0.5597984", "0.5589422", "0.5582173", "0.5582082", "0.55730855", "0.55646765", "0.5564527", "0.5547219", "0.5545603", "0.55455226", "0.5539147", "0.5537334", "0.5535983", "0.55330634", "0.55281955", "0.5520701", "0.5516804", "0.550907", "0.5489718", "0.5489309", "0.5488769", "0.5484333", "0.5484308", "0.54798913", "0.5476707", "0.54758114", "0.54738873", "0.54658324", "0.5460234", "0.5455343", "0.5453419", "0.5451106", "0.5444699", "0.54427916", "0.5428752", "0.5427236" ]
0.0
-1
Array of property to format mappings. Used for (de)serialization
public static function swaggerFormats() { return self::$swaggerFormats; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getFormats()\n {\n\t $format_field = $this->getValue('format');\n\t return wed_decodeJSON($format_field,true);\n }", "public function provideSetFormat()\n {\n return [\n 'json' => [\n 'format' => 'json',\n ],\n 'html' => [\n 'format' => 'html',\n ],\n 'plain' => [\n 'format' => 'text',\n ],\n 'xml' => [\n 'format' => 'xml',\n ],\n ];\n }", "protected function getFormats(): array\n {\n return [self::FORMAT_JSON, self::FORMAT_XML];\n }", "public static function getFormats() {\n return array(\n 'none',\n 'pretty',\n 'php',\n 'php-data',\n 'json-pretty',\n 'json-strict',\n 'serialize',\n 'shell',\n );\n }", "public function format() {\n\n /* * Add the mandatary props* */\n if (!is_null($this->name)) {\n $result[self::NAME_KEY] = $this->name;\n }\n\n /* * Add the optional props if any* */\n if (!is_null($this->optionalProperties)) {\n $result = array_merge($result, $this->optionalProperties);\n }\n\n\n return $result;\n }", "public function toArray() {\n $output = array();\n foreach($this->_magicProperties as $key => $value) {\n if (in_array($key,$this->translation)) {\n $output[array_search($key,$this->translation)] = $value;\n }else{\n $output[$key] = $value;\n }\n }\n return $this->_postarray($output);\n }", "public function getFormatKeys()\n {\n return $this->formatKeys;\n }", "public function getFormats()\n {\n return $this->_formats;\n }", "public function getFormat(): array;", "public function getFormatList()\n {\n return $this->formatList;\n }", "public function getFieldDeserializers(): array {\n $o = $this;\n return array_merge(parent::getFieldDeserializers(), [\n 'format' => fn(ParseNode $n) => $o->setFormat($n->getObjectValue([WorkbookChartSeriesFormat::class, 'createFromDiscriminatorValue'])),\n 'name' => fn(ParseNode $n) => $o->setName($n->getStringValue()),\n 'points' => fn(ParseNode $n) => $o->setPoints($n->getCollectionOfObjectValues([WorkbookChartPoint::class, 'createFromDiscriminatorValue'])),\n ]);\n }", "protected function property_map() { return array(); }", "public function format(): array\n {\n $result[self::FROM_EMAIL_KEY] = $this->fromEmail;\n\n return array_merge($result, $this->optionalProperties);\n }", "public function toArray()\n {\n return [\n 'PDF_10x15_300dpi' => '10x15 300dpi',\n 'PDF_A4_300dpi' => 'A4 300dpi',\n ];\n }", "public static function getFormats()\n {\n return self::$formats;\n }", "public function getFormatList() {\r\n\t\treturn $this->formatList;\r\n\t}", "protected function toArray()\n {\n $properties = array();\n\n foreach ( $this as $property => $value ) {\n $properties[$property] = $value;\n }\n\n return $properties;\n }", "public static function formats()\n {\n return self::$formats;\n }", "public function formatToArray(){\n return [\n 'nombre' => $this->name,\n 'ciudad' => $this->cityId,\n 'email' => $this->email,\n 'telefono' => $this->tel,\n 'tipo_documento' => $this->typeDoc,\n 'documento' => $this->doc,\n 'direccion' => $this->addr,\n 'direccion_referencia' => $this->addRef,\n 'coordenadas' => $this->addrCoo,\n 'ruc' => $this->ruc,\n 'razon_social' => $this->socialReason,\n ];\n }", "public function getValueFormatersNames(): array;", "public function getFieldDeserializers(): array {\n $o = $this;\n return array_merge(parent::getFieldDeserializers(), [\n 'format' => fn(ParseNode $n) => $o->setFormat($n->getObjectValue([WorkbookChartAxisFormat::class, 'createFromDiscriminatorValue'])),\n 'majorGridlines' => fn(ParseNode $n) => $o->setMajorGridlines($n->getObjectValue([WorkbookChartGridlines::class, 'createFromDiscriminatorValue'])),\n 'majorUnit' => fn(ParseNode $n) => $o->setMajorUnit($n->getObjectValue([Json::class, 'createFromDiscriminatorValue'])),\n 'maximum' => fn(ParseNode $n) => $o->setMaximum($n->getObjectValue([Json::class, 'createFromDiscriminatorValue'])),\n 'minimum' => fn(ParseNode $n) => $o->setMinimum($n->getObjectValue([Json::class, 'createFromDiscriminatorValue'])),\n 'minorGridlines' => fn(ParseNode $n) => $o->setMinorGridlines($n->getObjectValue([WorkbookChartGridlines::class, 'createFromDiscriminatorValue'])),\n 'minorUnit' => fn(ParseNode $n) => $o->setMinorUnit($n->getObjectValue([Json::class, 'createFromDiscriminatorValue'])),\n 'title' => fn(ParseNode $n) => $o->setTitle($n->getObjectValue([WorkbookChartAxisTitle::class, 'createFromDiscriminatorValue'])),\n ]);\n }", "public function getFieldDeserializers(): array {\n $o = $this;\n return array_merge(parent::getFieldDeserializers(), [\n 'displayName' => fn(ParseNode $n) => $o->setDisplayName($n->getStringValue()),\n 'templateId' => fn(ParseNode $n) => $o->setTemplateId($n->getStringValue()),\n 'values' => fn(ParseNode $n) => $o->setValues($n->getCollectionOfObjectValues([SettingValue::class, 'createFromDiscriminatorValue'])),\n ]);\n }", "public function dataProviderFormat()\n {\n return [\n [RefData::EBSR_STATUS_PROCESSING, 'orange', 'processing'],\n [RefData::EBSR_STATUS_VALIDATING, 'orange', 'processing'],\n [RefData::EBSR_STATUS_SUBMITTED, 'orange', 'processing'],\n [RefData::EBSR_STATUS_PROCESSED, 'green', 'successful'],\n [RefData::EBSR_STATUS_FAILED, 'red', 'failed'],\n ];\n }", "public function toArray(): array\n {\n return [\n 'background' => __('Background'),\n 'center' => __('Center'),\n ];\n }", "public function getExportFormats(): array;", "public function getFieldDeserializers(): array {\n $o = $this;\n return array_merge(parent::getFieldDeserializers(), [\n 'displayName' => fn(ParseNode $n) => $o->setDisplayName($n->getStringValue()),\n 'platformType' => fn(ParseNode $n) => $o->setPlatformType($n->getEnumValue(PolicyPlatformType::class)),\n 'settingCount' => fn(ParseNode $n) => $o->setSettingCount($n->getIntegerValue()),\n 'settingStates' => fn(ParseNode $n) => $o->setSettingStates($n->getCollectionOfObjectValues([ManagedDeviceMobileAppConfigurationSettingState::class, 'createFromDiscriminatorValue'])),\n 'state' => fn(ParseNode $n) => $o->setState($n->getEnumValue(ComplianceStatus::class)),\n 'userId' => fn(ParseNode $n) => $o->setUserId($n->getStringValue()),\n 'userPrincipalName' => fn(ParseNode $n) => $o->setUserPrincipalName($n->getStringValue()),\n 'version' => fn(ParseNode $n) => $o->setVersion($n->getIntegerValue()),\n ]);\n }", "public function getFieldDeserializers(): array {\n $o = $this;\n return array_merge(parent::getFieldDeserializers(), [\n 'bold' => fn(ParseNode $n) => $o->setBold($n->getBooleanValue()),\n 'color' => fn(ParseNode $n) => $o->setColor($n->getStringValue()),\n 'italic' => fn(ParseNode $n) => $o->setItalic($n->getBooleanValue()),\n 'name' => fn(ParseNode $n) => $o->setName($n->getStringValue()),\n 'size' => fn(ParseNode $n) => $o->setSize($n->getFloatValue()),\n 'underline' => fn(ParseNode $n) => $o->setUnderline($n->getStringValue()),\n ]);\n }", "public function jsonSerialize(): array\n {\n return array_merge([\n 'value' => $this->resolveTransformedValue($this->value),\n 'previous' => $this->resolveTransformedValue($this->previous),\n 'percent_changed' => $percentChanged = $this->percentChanged(),\n 'positive_change' => $percentChanged >= 0,\n // 'previousLabel' => $this->previousLabel,\n 'prefix' => $this->prefix,\n 'suffix' => $this->suffix,\n // 'suffixInflection' => $this->suffixInflection,\n // 'format' => $this->format,\n 'zero_result' => $this->zeroResult,\n ], parent::jsonSerialize());\n }", "public function getFieldDeserializers(): array {\n $o = $this;\n return array_merge(parent::getFieldDeserializers(), [\n 'filter' => fn(ParseNode $n) => $o->setFilter($n->getObjectValue([WorkbookFilter::class, 'createFromDiscriminatorValue'])),\n 'index' => fn(ParseNode $n) => $o->setIndex($n->getIntegerValue()),\n 'name' => fn(ParseNode $n) => $o->setName($n->getStringValue()),\n 'values' => fn(ParseNode $n) => $o->setValues($n->getObjectValue([Json::class, 'createFromDiscriminatorValue'])),\n ]);\n }", "public function toArray()\n {\n return [\n LSR::STORE_HOURS_TIME_FORMAT_24HRS => __('24 Hours'),\n LSR::STORE_HOURS_TIME_FORMAT_12HRS => __('12 Hours')\n ];\n }", "public function jsonSerialize()\n {\n $output = [];\n foreach ($this::getReflection()->getProperties() as $propertyName => $property) {\n\n $value = $this->{$propertyName};\n if ($value instanceof Entity\\Collection || $value instanceof Entity) {\n $output[$propertyName] = $value->jsonSerialize();\n } elseif ($value instanceof \\DateTime\n && $property->getType() === Entity\\Reflection\\Property::TYPE_DATE\n ) {\n $output[$propertyName] = (array) $value;\n $output[$propertyName][\"date\"] = $value->format(self::$dateFormat);\n } else {\n $output[$propertyName] = $value;\n }\n }\n\n return $output;\n }", "public function &GetFormats()\n {\n // phpcs:enable PSR1.Methods.CamelCapsMethodName.NotCamelCaps\n return $this->_formats;\n }", "public function getFieldDeserializers(): array {\n $o = $this;\n return [\n 'action' => fn(ParseNode $n) => $o->setAction($n->getEnumValue(OnenotePatchActionType::class)),\n 'content' => fn(ParseNode $n) => $o->setContent($n->getStringValue()),\n '@odata.type' => fn(ParseNode $n) => $o->setOdataType($n->getStringValue()),\n 'position' => fn(ParseNode $n) => $o->setPosition($n->getEnumValue(OnenotePatchInsertPosition::class)),\n 'target' => fn(ParseNode $n) => $o->setTarget($n->getStringValue()),\n ];\n }", "public function getFieldDeserializers(): array {\n $o = $this;\n return [\n '@odata.type' => fn(ParseNode $n) => $o->setOdataType($n->getStringValue()),\n 'settingDefinitionId' => fn(ParseNode $n) => $o->setSettingDefinitionId($n->getStringValue()),\n 'settingInstanceTemplateReference' => fn(ParseNode $n) => $o->setSettingInstanceTemplateReference($n->getObjectValue([DeviceManagementConfigurationSettingInstanceTemplateReference::class, 'createFromDiscriminatorValue'])),\n ];\n }", "public static function axerveFormats()\n {\n return self::$axerveFormats;\n }", "public function jsonSerialize()\n {\n return array_merge([\n 'component' => $this->component(),\n 'prefixComponent' => true,\n 'INDEX' => self::INDEX,\n 'ATTRIBUTE_PREFIX' => self::ATTRIBUTE_PREFIX,\n 'UNCHANGED' => self::UNCHANGED,\n 'CREATED' => self::CREATED,\n 'REMOVED' => self::REMOVED,\n 'UPDATED' => self::UPDATED,\n 'STATUS' => self::STATUS,\n 'PREFIX' => self::PREFIX,\n 'name' => $this->name,\n 'singularName' => str_singular($this->name),\n ], $this->meta());\n }", "public static function getDateFormats() {\n $settings = self::getSettings();\n \n $dateformats = array();\n $dateformats[$settings->language] = json_decode($settings->dateformat, true);\n \n $translations = self::getTranslations();\n foreach($translations as $language => $df) {\n $dateformats[$language] = $df;\n }\n return $dateformats;\n }", "public function getFieldDeserializers(): array {\n $o = $this;\n return array_merge(parent::getFieldDeserializers(), [\n 'mailExchange' => fn(ParseNode $n) => $o->setMailExchange($n->getStringValue()),\n 'preference' => fn(ParseNode $n) => $o->setPreference($n->getIntegerValue()),\n ]);\n }", "public function toArray()\n {\n return (array)$this->properties;\n }", "public function format()\n {\n return json_decode($this->renderer->format(), false, JSON_FORCE_OBJECT);\n }", "public function sectionSerialize()\n {\n $templatePrefix = $this->getTranslationTemplate();\n\n $properties = array_combine(\n array_map(function ($k) use ($templatePrefix) {\n return $templatePrefix . $k;\n },\n array_keys(get_object_vars($this))),\n get_object_vars($this)\n );\n return $properties;\n }", "public static function get_prop_array( array $mf, $properties, $args = null ) {\n\t\tif ( ! self::is_microformat( $mf ) ) {\n\t\t\treturn array();\n\t\t}\n\n\t\t$data = array();\n\t\tforeach ( $properties as $p ) {\n\t\t\tif ( array_key_exists( $p, $mf['properties'] ) ) {\n\t\t\t\tforeach ( $mf['properties'][ $p ] as $v ) {\n\t\t\t\t\tif ( self::is_microformat( $v ) ) {\n\t\t\t\t\t\t$v = self::parse_item( $v, $mf, $args );\n\t\t\t\t\t}\n\t\t\t\t\t$data[ $p ] = $v;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn $data;\n\t}", "public function toArray() \n\t{\n\t\t$properties = array_merge(parent::toArray(), $this->properties);\n\t\tforeach ($properties as $name => $rawValue) {\n\t\t\t$value = $this->get($name, $rawValue);\n\t\t\t\n\t\t\tif ($value instanceof \\Bliss\\Component || $value instanceof \\Bliss\\Collection) {\n\t\t\t\t$properties[$name] = $value->toArray();\n\t\t\t} else {\n\t\t\t\t$properties[$name] = $value;\n\t\t\t}\n\t\t}\n\t\treturn $properties;\n\t}", "public function getFieldDeserializers(): array {\n $o = $this;\n return array_merge(parent::getFieldDeserializers(), [\n 'deviceCount' => fn(ParseNode $n) => $o->setDeviceCount($n->getIntegerValue()),\n 'medianImpactInMs' => fn(ParseNode $n) => $o->setMedianImpactInMs($n->getIntegerValue()),\n 'processName' => fn(ParseNode $n) => $o->setProcessName($n->getStringValue()),\n 'productName' => fn(ParseNode $n) => $o->setProductName($n->getStringValue()),\n 'publisher' => fn(ParseNode $n) => $o->setPublisher($n->getStringValue()),\n 'totalImpactInMs' => fn(ParseNode $n) => $o->setTotalImpactInMs($n->getIntegerValue()),\n ]);\n }", "public function toArray()\n {\n return ['Lax' => __('Lax'), 'Strict' => __('Strict'), 'None' => __('Strict')];\n }", "public function getFieldDeserializers(): array {\n $o = $this;\n return array_merge(parent::getFieldDeserializers(), [\n 'deliveryFrequency' => fn(ParseNode $n) => $o->setDeliveryFrequency($n->getEnumValue(NotificationDeliveryFrequency::class)),\n ]);\n }", "public static function listFormats(){\n $list = array();\n foreach(self::$_resultFormats as $key => $item){\n $list[$key] = $item['description'];\n }\n return $list;\n }", "public function getFieldDeserializers(): array {\n $o = $this;\n return array_merge(parent::getFieldDeserializers(), [\n 'classification' => fn(ParseNode $n) => $o->setClassification($n->getEnumValue(WindowsQualityUpdateClassification::class)),\n 'isExpeditable' => fn(ParseNode $n) => $o->setIsExpeditable($n->getBooleanValue()),\n 'kbArticleId' => fn(ParseNode $n) => $o->setKbArticleId($n->getStringValue()),\n ]);\n }", "public function getFieldDeserializers(): array {\n $o = $this;\n return array_merge(parent::getFieldDeserializers(), [\n 'assignees' => fn(ParseNode $n) => $o->setAssignees($n->getCollectionOfObjectValues([WorkbookEmailIdentity::class, 'createFromDiscriminatorValue'])),\n 'changes' => fn(ParseNode $n) => $o->setChanges($n->getCollectionOfObjectValues([WorkbookDocumentTaskChange::class, 'createFromDiscriminatorValue'])),\n 'comment' => fn(ParseNode $n) => $o->setComment($n->getObjectValue([WorkbookComment::class, 'createFromDiscriminatorValue'])),\n 'completedBy' => fn(ParseNode $n) => $o->setCompletedBy($n->getObjectValue([WorkbookEmailIdentity::class, 'createFromDiscriminatorValue'])),\n 'completedDateTime' => fn(ParseNode $n) => $o->setCompletedDateTime($n->getDateTimeValue()),\n 'createdBy' => fn(ParseNode $n) => $o->setCreatedBy($n->getObjectValue([WorkbookEmailIdentity::class, 'createFromDiscriminatorValue'])),\n 'createdDateTime' => fn(ParseNode $n) => $o->setCreatedDateTime($n->getDateTimeValue()),\n 'percentComplete' => fn(ParseNode $n) => $o->setPercentComplete($n->getIntegerValue()),\n 'priority' => fn(ParseNode $n) => $o->setPriority($n->getIntegerValue()),\n 'startAndDueDateTime' => fn(ParseNode $n) => $o->setStartAndDueDateTime($n->getObjectValue([WorkbookDocumentTaskSchedule::class, 'createFromDiscriminatorValue'])),\n 'title' => fn(ParseNode $n) => $o->setTitle($n->getStringValue()),\n ]);\n }", "public function toArray(): array\n {\n $serialized = collect($this->properties);\n\n //partial serialization only for initialized properties\n if ($this->isPartial) {\n $serialized = $serialized->intersectByKeys(array_flip($this->initializedProperties));\n }\n\n $serialized = $serialized->mapWithKeys(function ($value, $property) {\n if ($value instanceof Arrayable) {\n $value = $value->toArray();\n }\n\n if ($this->snakeOnSerialize) {\n $property = Str::snake($property);\n }\n\n return [$property => $value];\n });\n\n $this->resetSerializationConditions();\n\n return $serialized->toArray();\n }", "public function getFieldDeserializers(): array {\n $o = $this;\n return array_merge(parent::getFieldDeserializers(), [\n ]);\n }", "public function getFieldDeserializers(): array {\n $o = $this;\n return array_merge(parent::getFieldDeserializers(), [\n ]);\n }", "public function getFieldDeserializers(): array {\n $o = $this;\n return array_merge(parent::getFieldDeserializers(), [\n 'displayName' => fn(ParseNode $n) => $o->setDisplayName($n->getStringValue()),\n 'endDate' => fn(ParseNode $n) => $o->setEndDate($n->getDateValue()),\n 'expirationDate' => fn(ParseNode $n) => $o->setExpirationDate($n->getDateValue()),\n 'offer' => fn(ParseNode $n) => $o->setOffer($n->getStringValue()),\n 'offerDisplayName' => fn(ParseNode $n) => $o->setOfferDisplayName($n->getStringValue()),\n 'publisher' => fn(ParseNode $n) => $o->setPublisher($n->getStringValue()),\n 'recommendedSku' => fn(ParseNode $n) => $o->setRecommendedSku($n->getStringValue()),\n 'sizeInGB' => fn(ParseNode $n) => $o->setSizeInGB($n->getIntegerValue()),\n 'sku' => fn(ParseNode $n) => $o->setSku($n->getStringValue()),\n 'skuDisplayName' => fn(ParseNode $n) => $o->setSkuDisplayName($n->getStringValue()),\n 'startDate' => fn(ParseNode $n) => $o->setStartDate($n->getDateValue()),\n 'status' => fn(ParseNode $n) => $o->setStatus($n->getEnumValue(CloudPcGalleryImageStatus::class)),\n ]);\n }", "public function applicable_formats() {\n return array('my' => true);\n }", "public function getFieldDeserializers(): array {\n $o = $this;\n return array_merge(parent::getFieldDeserializers(), [\n 'displayName' => fn(ParseNode $n) => $o->setDisplayName($n->getStringValue()),\n 'regionGroup' => fn(ParseNode $n) => $o->setRegionGroup($n->getEnumValue(CloudPcRegionGroup::class)),\n 'regionStatus' => fn(ParseNode $n) => $o->setRegionStatus($n->getEnumValue(CloudPcSupportedRegionStatus::class)),\n 'supportedSolution' => fn(ParseNode $n) => $o->setSupportedSolution($n->getEnumValue(CloudPcManagementService::class)),\n ]);\n }", "public static function getProperties()\n {\n return [\n 'id' => [true, self::PROPERTY_TYPE_STRING, null, false, false],\n 'endDate' => [false, self::PROPERTY_TYPE_DATE, null, false, false],\n 'startDate' => [true, self::PROPERTY_TYPE_DATE, null, false, false],\n 'status' => [true, self::PROPERTY_TYPE_ENUM, null, false, false],\n 'price' => [true, self::PROPERTY_TYPE_OBJECT, '\\\\Price', false, false],\n 'product' => [true, self::PROPERTY_TYPE_OBJECT, '\\\\Product', false, false],\n ];\n }", "public static function getProperties()\n {\n return [\n 'Description' => [false, self::PROPERTY_TYPE_STRING, null, false, false],\n 'Note' => [false, self::PROPERTY_TYPE_STRING, null, false, false],\n 'Code' => [false, self::PROPERTY_TYPE_STRING, null, false, false],\n 'Billable' => [false, self::PROPERTY_TYPE_STRING, null, false, false],\n 'Quantity' => [false, self::PROPERTY_TYPE_FLOAT, null, false, false],\n 'UnitCost' => [false, self::PROPERTY_TYPE_FLOAT, null, false, false],\n 'UnitPrice' => [false, self::PROPERTY_TYPE_FLOAT, null, false, false],\n 'Amount' => [false, self::PROPERTY_TYPE_FLOAT, null, false, false],\n 'AmountTax' => [false, self::PROPERTY_TYPE_FLOAT, null, false, false],\n 'AmountIncludingTax' => [false, self::PROPERTY_TYPE_FLOAT, null, false, false],\n ];\n }", "public function getFieldDeserializers(): array {\n $o = $this;\n return [\n 'archiveFolder' => fn(ParseNode $n) => $o->setArchiveFolder($n->getStringValue()),\n 'automaticRepliesSetting' => fn(ParseNode $n) => $o->setAutomaticRepliesSetting($n->getObjectValue([AutomaticRepliesSetting::class, 'createFromDiscriminatorValue'])),\n 'dateFormat' => fn(ParseNode $n) => $o->setDateFormat($n->getStringValue()),\n 'delegateMeetingMessageDeliveryOptions' => fn(ParseNode $n) => $o->setDelegateMeetingMessageDeliveryOptions($n->getEnumValue(DelegateMeetingMessageDeliveryOptions::class)),\n 'language' => fn(ParseNode $n) => $o->setLanguage($n->getObjectValue([LocaleInfo::class, 'createFromDiscriminatorValue'])),\n '@odata.type' => fn(ParseNode $n) => $o->setOdataType($n->getStringValue()),\n 'timeFormat' => fn(ParseNode $n) => $o->setTimeFormat($n->getStringValue()),\n 'timeZone' => fn(ParseNode $n) => $o->setTimeZone($n->getStringValue()),\n 'userPurpose' => fn(ParseNode $n) => $o->setUserPurpose($n->getEnumValue(UserPurpose::class)),\n 'userPurposeV2' => fn(ParseNode $n) => $o->setUserPurposeV2($n->getEnumValue(MailboxRecipientType::class)),\n 'workingHours' => fn(ParseNode $n) => $o->setWorkingHours($n->getObjectValue([WorkingHours::class, 'createFromDiscriminatorValue'])),\n ];\n }", "public function getFieldDeserializers(): array {\n $o = $this;\n return array_merge(parent::getFieldDeserializers(), [\n 'classification' => fn(ParseNode $n) => $o->setClassification($n->getEnumValue(PermissionClassificationType::class)),\n 'permissionId' => fn(ParseNode $n) => $o->setPermissionId($n->getStringValue()),\n 'permissionName' => fn(ParseNode $n) => $o->setPermissionName($n->getStringValue()),\n ]);\n }", "public function toArray()\n {\n return array(\n \"field_name\" => $this->fieldName,\n \"direction\" => $this->direction,\n );\n }", "public function getToStringFields()\n {\n $out = array();\n foreach($this->_map as $alias => $options)\n {\n if(!empty($options[self::MAP_TO_STRING]))\n {\n $out[] = $alias;\n }\n }\n return $out;\n }", "public function getFieldDeserializers(): array {\n $o = $this;\n return [\n 'attributeMappings' => fn(ParseNode $n) => $o->setAttributeMappings($n->getCollectionOfObjectValues([AttributeMapping::class, 'createFromDiscriminatorValue'])),\n 'enabled' => fn(ParseNode $n) => $o->setEnabled($n->getBooleanValue()),\n 'flowTypes' => fn(ParseNode $n) => $o->setFlowTypes($n->getEnumValue(ObjectFlowTypes::class)),\n 'metadata' => fn(ParseNode $n) => $o->setMetadata($n->getCollectionOfObjectValues([ObjectMappingMetadataEntry::class, 'createFromDiscriminatorValue'])),\n 'name' => fn(ParseNode $n) => $o->setName($n->getStringValue()),\n '@odata.type' => fn(ParseNode $n) => $o->setOdataType($n->getStringValue()),\n 'scope' => fn(ParseNode $n) => $o->setScope($n->getObjectValue([Filter::class, 'createFromDiscriminatorValue'])),\n 'sourceObjectName' => fn(ParseNode $n) => $o->setSourceObjectName($n->getStringValue()),\n 'targetObjectName' => fn(ParseNode $n) => $o->setTargetObjectName($n->getStringValue()),\n ];\n }", "public function getFieldDeserializers(): array {\n $o = $this;\n return array_merge(parent::getFieldDeserializers(), [\n 'displayName' => fn(ParseNode $n) => $o->setDisplayName($n->getStringValue()),\n 'number' => fn(ParseNode $n) => $o->setNumber($n->getStringValue()),\n 'type' => fn(ParseNode $n) => $o->setType($n->getEnumValue(PhoneType::class)),\n ]);\n }", "public static function serialFormats()\n {\n return self::$serialFormats;\n }", "public function getFieldDeserializers(): array {\n $o = $this;\n return [\n 'attributeDestination' => fn(ParseNode $n) => $o->setAttributeDestination($n->getObjectValue([AccessPackageResourceAttributeDestination::class, 'createFromDiscriminatorValue'])),\n 'attributeName' => fn(ParseNode $n) => $o->setAttributeName($n->getStringValue()),\n 'attributeSource' => fn(ParseNode $n) => $o->setAttributeSource($n->getObjectValue([AccessPackageResourceAttributeSource::class, 'createFromDiscriminatorValue'])),\n 'id' => fn(ParseNode $n) => $o->setId($n->getStringValue()),\n 'isEditable' => fn(ParseNode $n) => $o->setIsEditable($n->getBooleanValue()),\n 'isPersistedOnAssignmentRemoval' => fn(ParseNode $n) => $o->setIsPersistedOnAssignmentRemoval($n->getBooleanValue()),\n '@odata.type' => fn(ParseNode $n) => $o->setOdataType($n->getStringValue()),\n ];\n }", "public function toJSON()\n\t{\n\t\t$columns = array();\n\t\t\n\t\t$rf = new ReflectionClass($this);\n\t\t$props = $rf->getProperties();\n\t\tforeach ($props as $prop)\n\t\t{\n\t\t\t$column = AttributeReader::PropertyAttributes($this,$prop->getName())->Column;\n\t\t\t$columns[$column] = $prop->getValue($this);\n\t\t}\n\n\t\treturn json_encode($columns);\n\t}", "public function getFieldDeserializers(): array {\n $o = $this;\n return array_merge(parent::getFieldDeserializers(), [\n 'recipientActionDateTime' => fn(ParseNode $n) => $o->setRecipientActionDateTime($n->getDateTimeValue()),\n 'recipientActionMessage' => fn(ParseNode $n) => $o->setRecipientActionMessage($n->getStringValue()),\n 'recipientUserId' => fn(ParseNode $n) => $o->setRecipientUserId($n->getStringValue()),\n 'senderShiftId' => fn(ParseNode $n) => $o->setSenderShiftId($n->getStringValue()),\n ]);\n }", "public function getDisplayFormatTypeAllowableValues()\n {\n return [\n self::DISPLAY_FORMAT_TYPE__DEFAULT,\n self::DISPLAY_FORMAT_TYPE_DATE,\n self::DISPLAY_FORMAT_TYPE_NUMBER,\n ];\n }", "public static function getProperties()\n {\n return [\n 'NumberOfUnits' => [false, self::PROPERTY_TYPE_STRING, null, false, false],\n 'PayPeriodEndDate' => [false, self::PROPERTY_TYPE_DATE, '\\\\DateTimeInterface', false, false],\n 'PayPeriodStartDate' => [false, self::PROPERTY_TYPE_DATE, '\\\\DateTimeInterface', false, false],\n 'LeavePeriodStatus' => [false, self::PROPERTY_TYPE_ENUM, null, false, false],\n ];\n }", "public function toArray()\n {\n return [\n 'field-changes' => $this->fieldChanges,\n 'index-changes' => $this->indexChanges,\n 'add-timestamp' => $this->addTimestamps,\n 'add-soft-delete' => $this->addSoftDelete,\n 'drop-timestamp' => $this->dropTimestamps,\n 'drop-soft-delete' => $this->dropSoftDelete,\n ];\n }", "public function toArray()\n {\n return array(\n \"httpGet\" => $this->httpGet,\n \"httpPost\" => $this->httpPost,\n \"formats\" => $this->formats\n );\n }", "public function toArray()\n {\n return [\n 'xsmall' => __('Extra small'),\n 'small' => __('Small'),\n 'medium' => __('Medium'),\n 'large' => __('Large'),\n 'xlarge' => __('Extra large'),\n ];\n }", "public function getFieldDeserializers(): array {\n $o = $this;\n return array_merge(parent::getFieldDeserializers(), [\n 'endDateTime' => fn(ParseNode $n) => $o->setEndDateTime($n->getDateTimeValue()),\n 'startDateTime' => fn(ParseNode $n) => $o->setStartDateTime($n->getDateTimeValue()),\n ]);\n }", "public function toArray()\n {\n return [\n Import::BEHAVIOR_ADD_UPDATE => __('Add/Update'),\n Import::BEHAVIOR_REPLACE => __('Replace'),\n Import::BEHAVIOR_DELETE => __('Delete')\n ];\n }", "public function getFieldDeserializers(): array {\n $o = $this;\n return array_merge(parent::getFieldDeserializers(), [\n 'completionDateTime' => fn(ParseNode $n) => $o->setCompletionDateTime($n->getDateTimeValue()),\n 'creationDateTime' => fn(ParseNode $n) => $o->setCreationDateTime($n->getDateTimeValue()),\n 'error' => fn(ParseNode $n) => $o->setError($n->getObjectValue([ClassificationError::class, 'createFromDiscriminatorValue'])),\n 'lastUpdatedDateTime' => fn(ParseNode $n) => $o->setLastUpdatedDateTime($n->getDateTimeValue()),\n 'startDateTime' => fn(ParseNode $n) => $o->setStartDateTime($n->getDateTimeValue()),\n ]);\n }", "public static function _getPropertyNames(): array\n {\n return [\n 'url',\n ];\n }", "public function getFieldDeserializers(): array {\n $o = $this;\n return array_merge(parent::getFieldDeserializers(), [\n 'description' => fn(ParseNode $n) => $o->setDescription($n->getStringValue()),\n 'displayName' => fn(ParseNode $n) => $o->setDisplayName($n->getStringValue()),\n 'members' => fn(ParseNode $n) => $o->setMembers($n->getCollectionOfObjectValues([Identity::class, 'createFromDiscriminatorValue'])),\n ]);\n }", "public function getFormatters(): ArrayObject\n {\n $arr = new ArrayObject();\n foreach ($this->columns as $key => $column) {\n if (($formatter = $column->getFormatter()) !== null) {\n $arr->offsetSet($key, $formatter);\n }\n }\n\n return $arr;\n }", "public function getFieldDeserializers(): array {\n $o = $this;\n return [\n 'addedDateTime' => fn(ParseNode $n) => $o->setAddedDateTime($n->getDateTimeValue()),\n 'displayName' => fn(ParseNode $n) => $o->setDisplayName($n->getStringValue()),\n '@odata.type' => fn(ParseNode $n) => $o->setOdataType($n->getStringValue()),\n 'verifiedPublisherId' => fn(ParseNode $n) => $o->setVerifiedPublisherId($n->getStringValue()),\n ];\n }", "public function getFieldDeserializers(): array {\n $o = $this;\n return array_merge(parent::getFieldDeserializers(), [\n 'deletedChats' => fn(ParseNode $n) => $o->setDeletedChats($n->getCollectionOfObjectValues([DeletedChat::class, 'createFromDiscriminatorValue'])),\n 'deletedTeams' => fn(ParseNode $n) => $o->setDeletedTeams($n->getCollectionOfObjectValues([DeletedTeam::class, 'createFromDiscriminatorValue'])),\n 'devices' => fn(ParseNode $n) => $o->setDevices($n->getCollectionOfObjectValues([TeamworkDevice::class, 'createFromDiscriminatorValue'])),\n 'teamsAppSettings' => fn(ParseNode $n) => $o->setTeamsAppSettings($n->getObjectValue([TeamsAppSettings::class, 'createFromDiscriminatorValue'])),\n 'teamTemplates' => fn(ParseNode $n) => $o->setTeamTemplates($n->getCollectionOfObjectValues([TeamTemplate::class, 'createFromDiscriminatorValue'])),\n 'workforceIntegrations' => fn(ParseNode $n) => $o->setWorkforceIntegrations($n->getCollectionOfObjectValues([WorkforceIntegration::class, 'createFromDiscriminatorValue'])),\n ]);\n }", "public function getFieldDeserializers(): array {\n $o = $this;\n return array_merge(parent::getFieldDeserializers(), [\n 'comparisonValue' => fn(ParseNode $n) => $o->setComparisonValue($n->getStringValue()),\n 'displayName' => fn(ParseNode $n) => $o->setDisplayName($n->getStringValue()),\n 'enforceSignatureCheck' => fn(ParseNode $n) => $o->setEnforceSignatureCheck($n->getBooleanValue()),\n 'operationType' => fn(ParseNode $n) => $o->setOperationType($n->getEnumValue(Win32LobAppPowerShellScriptRuleOperationType::class)),\n 'operator' => fn(ParseNode $n) => $o->setOperator($n->getEnumValue(Win32LobAppRuleOperator::class)),\n 'runAs32Bit' => fn(ParseNode $n) => $o->setRunAs32Bit($n->getBooleanValue()),\n 'runAsAccount' => fn(ParseNode $n) => $o->setRunAsAccount($n->getEnumValue(RunAsAccountType::class)),\n 'scriptContent' => fn(ParseNode $n) => $o->setScriptContent($n->getStringValue()),\n ]);\n }", "function custom_field_formats_for_select() {\n $model = ClassRegistry::init('CustomField');\n $formats = $model->FIELD_FORMATS;\n uasort($formats, array($this, '__sort_custom_field_formats_for_select'));\n $select = array();\n foreach ($formats as $k=>$format) {\n $select[$k] = __($format['name']);\n }\n return $select;\n }", "protected static function getCardFormats() : array\n {\n return Formats::getList();\n }", "public function toArray(): array\n {\n $array = [];\n $str = new Str();\n\n foreach (\\get_object_vars($this) as $property => $value) {\n $array[$str->snake($property)] = $value;\n }\n\n return $array;\n }", "public function format()\n {\n $result = array();\n\n foreach ($this->groups as $group) {\n $result[] = array(\n 'id' => $group->getInternalId(),\n 'external_id' => $group->getExternalId(),\n 'value' => $group->getName(),\n 'label' => $group->getName(),\n );\n }\n\n return $result;\n }", "public function getFieldDeserializers(): array {\n $o = $this;\n return [\n '@odata.type' => fn(ParseNode $n) => $o->setOdataType($n->getStringValue()),\n 'operation' => fn(ParseNode $n) => $o->setOperation($n->getEnumValue(RuleOperation::class)),\n 'property' => fn(ParseNode $n) => $o->setProperty($n->getStringValue()),\n 'values' => function (ParseNode $n) {\n $val = $n->getCollectionOfPrimitiveValues();\n if (is_array($val)) {\n TypeUtils::validateCollectionValues($val, 'string');\n }\n /** @var array<string>|null $val */\n $this->setValues($val);\n },\n 'valuesJoinedBy' => fn(ParseNode $n) => $o->setValuesJoinedBy($n->getEnumValue(BinaryOperator::class)),\n ];\n }", "public static function _getPropertyNames(): array\n {\n return [\n 'name',\n ];\n }", "public function getFieldDeserializers(): array {\n $o = $this;\n return array_merge(parent::getFieldDeserializers(), [\n 'comment' => fn(ParseNode $n) => $o->setComment($n->getStringValue()),\n 'createdBy' => fn(ParseNode $n) => $o->setCreatedBy($n->getObjectValue([IdentitySet::class, 'createFromDiscriminatorValue'])),\n 'createdDateTime' => fn(ParseNode $n) => $o->setCreatedDateTime($n->getDateTimeValue()),\n 'items' => fn(ParseNode $n) => $o->setItems($n->getCollectionOfObjectValues([DocumentSetVersionItem::class, 'createFromDiscriminatorValue'])),\n 'shouldCaptureMinorVersion' => fn(ParseNode $n) => $o->setShouldCaptureMinorVersion($n->getBooleanValue()),\n ]);\n }", "public function get_field_properties() {\n return array(PARAM_RAW, NULL_NOT_ALLOWED);\n }", "public function toArray()\r\n\t{\r\n\t\t$attributes = parent::toArray();\r\n\r\n\t\tif (! $this->autoTranslations) return $attributes;\r\n\r\n\t\tforeach ($this->translatableAttributes as $field) {\r\n\t\t\t$attributes[$field] = $this->getTranslation($field);\r\n\t\t}\r\n\r\n\t\treturn $attributes;\r\n\t}", "public function getFieldDeserializers(): array {\n $o = $this;\n return array_merge(parent::getFieldDeserializers(), [\n 'accessRecommendation' => fn(ParseNode $n) => $o->setAccessRecommendation($n->getStringValue()),\n 'accessReviewId' => fn(ParseNode $n) => $o->setAccessReviewId($n->getStringValue()),\n 'appliedBy' => fn(ParseNode $n) => $o->setAppliedBy($n->getObjectValue([UserIdentity::class, 'createFromDiscriminatorValue'])),\n 'appliedDateTime' => fn(ParseNode $n) => $o->setAppliedDateTime($n->getDateTimeValue()),\n 'applyResult' => fn(ParseNode $n) => $o->setApplyResult($n->getStringValue()),\n 'justification' => fn(ParseNode $n) => $o->setJustification($n->getStringValue()),\n 'reviewedBy' => fn(ParseNode $n) => $o->setReviewedBy($n->getObjectValue([UserIdentity::class, 'createFromDiscriminatorValue'])),\n 'reviewedDateTime' => fn(ParseNode $n) => $o->setReviewedDateTime($n->getDateTimeValue()),\n 'reviewResult' => fn(ParseNode $n) => $o->setReviewResult($n->getStringValue()),\n ]);\n }", "public function getFieldDeserializers(): array {\n $o = $this;\n return array_merge(parent::getFieldDeserializers(), [\n 'availability' => fn(ParseNode $n) => $o->setAvailability($n->getCollectionOfObjectValues([ShiftAvailability::class, 'createFromDiscriminatorValue'])),\n ]);\n }", "public function getFieldDeserializers(): array {\n $o = $this;\n return [\n 'errors' => fn(ParseNode $n) => $o->setErrors($n->getIntegerValue()),\n 'groups' => fn(ParseNode $n) => $o->setGroups($n->getIntegerValue()),\n 'matchedPeopleByRole' => fn(ParseNode $n) => $o->setMatchedPeopleByRole($n->getCollectionOfObjectValues([IndustryDataRunRoleCountMetric::class, 'createFromDiscriminatorValue'])),\n 'memberships' => fn(ParseNode $n) => $o->setMemberships($n->getIntegerValue()),\n '@odata.type' => fn(ParseNode $n) => $o->setOdataType($n->getStringValue()),\n 'organizations' => fn(ParseNode $n) => $o->setOrganizations($n->getIntegerValue()),\n 'people' => fn(ParseNode $n) => $o->setPeople($n->getIntegerValue()),\n 'unmatchedPeopleByRole' => fn(ParseNode $n) => $o->setUnmatchedPeopleByRole($n->getCollectionOfObjectValues([IndustryDataRunRoleCountMetric::class, 'createFromDiscriminatorValue'])),\n 'warnings' => fn(ParseNode $n) => $o->setWarnings($n->getIntegerValue()),\n ];\n }", "public function getFieldDeserializers(): array {\n $o = $this;\n return [\n 'assignmentFilterType' => fn(ParseNode $n) => $o->setAssignmentFilterType($n->getEnumValue(DeviceAndAppManagementAssignmentFilterType::class)),\n 'groupId' => fn(ParseNode $n) => $o->setGroupId($n->getStringValue()),\n '@odata.type' => fn(ParseNode $n) => $o->setOdataType($n->getStringValue()),\n 'payloadId' => fn(ParseNode $n) => $o->setPayloadId($n->getStringValue()),\n 'payloadType' => fn(ParseNode $n) => $o->setPayloadType($n->getEnumValue(AssociatedAssignmentPayloadType::class)),\n ];\n }", "public function toArray()\n {\n return [\n 'type' => 'object',\n 'properties' => [\n 'email' => ['type' => 'string'],\n 'key' => ['type' => 'string'],\n 'name' => ['type' => 'string'],\n 'picture' => ['type' => 'string'],\n 'phone' => ['type' => 'string'],\n 'balance' => ['type' => 'integer', 'format' => 'int32'],\n 'codes' => ['type' => 'array', 'items' => ['type' => 'string']],\n 'order_comment_tracking_code' => ['type' => 'string'],\n 'title' => ['type' => 'string'],\n ],\n 'required' => ['email', 'key', 'name', 'phone', 'balance', 'codes', 'order_comment_tracking_code', 'title'],\n ];\n }", "public function applicable_formats() {\n return array('all'=>true);\n }", "protected function properties()\n {\n return [\n 'title' => array_replace_recursive(\n isys_cmdb_dao_category_pattern::text(),\n [\n C__PROPERTY__INFO => [\n C__PROPERTY__INFO__TITLE => 'LC__CMDB__LOGBOOK__TITLE',\n C__PROPERTY__INFO__DESCRIPTION => 'Title'\n ],\n C__PROPERTY__DATA => [\n C__PROPERTY__DATA__FIELD => 'isys_cats_net_list__title'\n ],\n C__PROPERTY__UI => [\n C__PROPERTY__UI__ID => 'C__CATS__NET__TITLE'\n ],\n C__PROPERTY__PROVIDES => [\n C__PROPERTY__PROVIDES__LIST => false,\n C__PROPERTY__PROVIDES__SEARCH => false,\n C__PROPERTY__PROVIDES__IMPORT => false,\n C__PROPERTY__PROVIDES__EXPORT => false,\n C__PROPERTY__PROVIDES__REPORT => false\n ]\n ]\n ),\n 'type' => array_replace_recursive(\n isys_cmdb_dao_category_pattern::dialog(),\n [\n C__PROPERTY__INFO => [\n C__PROPERTY__INFO__TITLE => 'LC__CMDB__CATS__NET__TYPE',\n C__PROPERTY__INFO__DESCRIPTION => 'Type'\n ],\n C__PROPERTY__DATA => [\n C__PROPERTY__DATA__FIELD => 'isys_cats_net_list__isys_net_type__id',\n C__PROPERTY__DATA__REFERENCES => [\n 'isys_net_type',\n 'isys_net_type__id'\n ]\n ],\n C__PROPERTY__UI => [\n C__PROPERTY__UI__ID => 'C__CATS__NET__TYPE',\n C__PROPERTY__UI__PARAMS => [\n 'p_bDisabled' => '1',\n 'p_strTable' => 'isys_net_type',\n 'p_bDbFieldNN' => '1'\n ]\n ],\n C__PROPERTY__PROVIDES => [\n C__PROPERTY__PROVIDES__SEARCH => false\n ]\n ]\n ),\n 'address' => array_replace_recursive(\n isys_cmdb_dao_category_pattern::text(),\n [\n C__PROPERTY__INFO => [\n C__PROPERTY__INFO__TITLE => 'LC__CMDB__CATS__NET',\n C__PROPERTY__INFO__DESCRIPTION => 'Net'\n ],\n C__PROPERTY__DATA => [\n C__PROPERTY__DATA__FIELD => 'isys_cats_net_list__address'\n ],\n C__PROPERTY__UI => [\n C__PROPERTY__UI__ID => 'C__CATS__NET__NET_V4',\n C__PROPERTY__UI__PARAMS => [\n 'p_bReadonly' => '',\n 'p_strClass' => 'input input-mini'\n ]\n ],\n C__PROPERTY__PROVIDES => [\n C__PROPERTY__PROVIDES__LIST => false\n ]\n ]\n ),\n 'netmask' => array_replace_recursive(\n isys_cmdb_dao_category_pattern::text(),\n [\n C__PROPERTY__INFO => [\n C__PROPERTY__INFO__TITLE => 'LC__CMDB__CATS__NET__MASK',\n C__PROPERTY__INFO__DESCRIPTION => 'Netmask'\n ],\n C__PROPERTY__DATA => [\n C__PROPERTY__DATA__FIELD => 'isys_cats_net_list__mask'\n ],\n C__PROPERTY__UI => [\n C__PROPERTY__UI__ID => 'C__CATS__NET__MASK_V4',\n C__PROPERTY__UI__PARAMS => [\n 'p_strClass' => 'input input-mini',\n 'p_bReadonly' => ''\n ]\n ],\n C__PROPERTY__PROVIDES => [\n C__PROPERTY__PROVIDES__LIST => false\n ]\n ]\n ),\n 'gateway' => array_replace_recursive(\n isys_cmdb_dao_category_pattern::dialog(),\n [\n C__PROPERTY__INFO => [\n C__PROPERTY__INFO__TITLE => 'LC__CMDB__CATS__NET__DEF_GW',\n C__PROPERTY__INFO__DESCRIPTION => 'Default Gateway'\n ],\n C__PROPERTY__DATA => [\n C__PROPERTY__DATA__FIELD => 'isys_cats_net_list__isys_catg_ip_list__id'\n ],\n C__PROPERTY__UI => [\n C__PROPERTY__UI__ID => 'C__CATS__NET__DEF_GW_V4',\n C__PROPERTY__UI__PARAMS => [\n 'p_arData' => new isys_callback(\n [\n 'isys_cmdb_dao_category_s_net',\n 'callback_property_gateway'\n ]\n )\n ]\n ],\n C__PROPERTY__FORMAT => [\n C__PROPERTY__FORMAT__CALLBACK => [\n 'isys_export_helper',\n 'get_gateway'\n ]\n ],\n C__PROPERTY__PROVIDES => [\n C__PROPERTY__PROVIDES__REPORT => false,\n C__PROPERTY__PROVIDES__LIST => false\n ]\n ]\n ),\n 'range_from' => array_replace_recursive(\n isys_cmdb_dao_category_pattern::text(),\n [\n C__PROPERTY__INFO => [\n C__PROPERTY__INFO__TITLE => 'LC__CMDB__CATS__NET__ADDRESS_FROM',\n C__PROPERTY__INFO__DESCRIPTION => 'DHCP from'\n ],\n C__PROPERTY__DATA => [\n C__PROPERTY__DATA__FIELD => 'isys_cats_net_list__address_range_from'\n ],\n C__PROPERTY__UI => [\n C__PROPERTY__UI__ID => 'C__CATS__NET__ADDRESS_RANGE_FROM'\n ]\n ]\n ),\n 'range_to' => array_replace_recursive(\n isys_cmdb_dao_category_pattern::text(),\n [\n C__PROPERTY__INFO => [\n C__PROPERTY__INFO__TITLE => 'LC__CMDB__CATS__NET__ADDRESS_TO',\n C__PROPERTY__INFO__DESCRIPTION => 'DHCP to'\n ],\n C__PROPERTY__DATA => [\n C__PROPERTY__DATA__FIELD => 'isys_cats_net_list__address_range_to'\n ],\n C__PROPERTY__UI => [\n C__PROPERTY__UI__ID => 'C__CATS__NET__ADDRESS_RANGE_TO'\n ]\n ]\n ),\n 'dns_server' => array_replace_recursive(\n isys_cmdb_dao_category_pattern::object_browser(),\n [\n C__PROPERTY__INFO => [\n C__PROPERTY__INFO__TITLE => 'LC__CMDB__CATS__NET__DNS_SERVER',\n C__PROPERTY__INFO__DESCRIPTION => 'DNS server'\n ],\n C__PROPERTY__DATA => [\n C__PROPERTY__DATA__FIELD => 'isys_cats_net_list__id',\n C__PROPERTY__DATA__REFERENCES => [\n 'isys_cats_net_list_2_isys_catg_ip_list',\n 'isys_cats_net_list__id'\n ]\n ],\n C__PROPERTY__UI => [\n C__PROPERTY__UI__ID => 'C__CATS__NET__DNS_SERVER'\n ],\n C__PROPERTY__PROVIDES => [\n C__PROPERTY__PROVIDES__SEARCH => false,\n C__PROPERTY__PROVIDES__REPORT => false,\n C__PROPERTY__PROVIDES__LIST => false\n ],\n C__PROPERTY__FORMAT => [\n C__PROPERTY__FORMAT__CALLBACK => [\n 'isys_export_helper',\n 'get_net_dns_server'\n ]\n ]\n ]\n ),\n 'dns_domain' => array_replace_recursive(\n isys_cmdb_dao_category_pattern::multiselect(),\n [\n C__PROPERTY__INFO => [\n C__PROPERTY__INFO__TITLE => 'LC__CMDB__CATS__NET__DNS_DOMAIN',\n C__PROPERTY__INFO__DESCRIPTION => 'Domain / DNS namespace'\n ],\n C__PROPERTY__DATA => [\n C__PROPERTY__DATA__FIELD => 'isys_cats_net_list__id',\n C__PROPERTY__DATA__TABLE_ALIAS => 'dns_domain',\n C__PROPERTY__DATA__REFERENCES => [\n 'isys_cats_net_list_2_isys_net_dns_domain',\n 'isys_cats_net_list__id'\n ]\n ],\n C__PROPERTY__UI => [\n C__PROPERTY__UI__ID => 'C__CATS__NET__DNS_DOMAIN',\n C__PROPERTY__UI__PARAMS => [\n 'p_strTable' => 'isys_net_dns_domain',\n 'placeholder' => _L('LC__CMDB__CATS__NET__DNS_DOMAIN'),\n 'emptyMessage' => _L('LC__CMDB__CATS__NET__NO_DNS_DOMAINS_FOUND'),\n 'p_onComplete' => \"idoit.callbackManager.triggerCallback('cmdb-cats-net-dns_domain-update', selected);\",\n 'multiselect' => true\n //'p_arData' => new isys_callback(array('isys_cmdb_dao_category_s_net', 'callback_property_dns_domain'))\n ]\n ],\n C__PROPERTY__PROVIDES => [\n C__PROPERTY__PROVIDES__SEARCH => false,\n C__PROPERTY__PROVIDES__LIST => false,\n C__PROPERTY__PROVIDES__VALIDATION => false,\n C__PROPERTY__PROVIDES__REPORT => false\n ],\n C__PROPERTY__CHECK => [\n C__PROPERTY__CHECK__MANDATORY => false,\n C__PROPERTY__CHECK__VALIDATION => false\n ],\n C__PROPERTY__FORMAT => [\n C__PROPERTY__FORMAT__CALLBACK => [\n 'isys_export_helper',\n 'dialog_multiselect'\n ]\n ]\n ]\n ),\n 'cidr_suffix' => array_replace_recursive(\n isys_cmdb_dao_category_pattern::int(),\n [\n C__PROPERTY__INFO => [\n C__PROPERTY__INFO__TITLE => 'LC__CMDB__CATS__NET__CIDR_SUFFIX',\n C__PROPERTY__INFO__DESCRIPTION => 'CIDR-Suffix'\n ],\n C__PROPERTY__DATA => [\n C__PROPERTY__DATA__FIELD => 'isys_cats_net_list__cidr_suffix'\n ],\n C__PROPERTY__UI => [\n C__PROPERTY__UI__ID => 'C__CATS__NET__CIDR',\n C__PROPERTY__UI__PARAMS => [\n 'p_bReadonly' => '',\n 'p_strClass' => 'input input-mini'\n ]\n ],\n C__PROPERTY__PROVIDES => [\n C__PROPERTY__PROVIDES__SEARCH => false\n ]\n ]\n ),\n 'reverse_dns' => array_replace_recursive(\n isys_cmdb_dao_category_pattern::text(),\n [\n C__PROPERTY__INFO => [\n C__PROPERTY__INFO__TITLE => 'LC__CATS__NET__REVERSE_DNS',\n C__PROPERTY__INFO__DESCRIPTION => 'Reverse dns'\n ],\n C__PROPERTY__DATA => [\n C__PROPERTY__DATA__FIELD => 'isys_cats_net_list__reverse_dns'\n ],\n C__PROPERTY__UI => [\n C__PROPERTY__UI__ID => 'C__CATS__NET__REVERSE_DNS'\n ]\n ]\n ),\n 'layer2_assignments' => array_replace_recursive(\n isys_cmdb_dao_category_pattern::object_browser(),\n [\n C__PROPERTY__INFO => [\n C__PROPERTY__INFO__TITLE => 'LC__CMDB__CATS__NET__LAYER2_NET',\n C__PROPERTY__INFO__DESCRIPTION => 'Layer-2-net assignments'\n ],\n C__PROPERTY__DATA => [\n C__PROPERTY__DATA__FIELD => 'isys_obj__id'\n ],\n C__PROPERTY__UI => [\n C__PROPERTY__UI__ID => 'C__CATS__NET__LAYER2',\n C__PROPERTY__UI__PARAMS => [\n isys_popup_browser_object_ng::C__TITLE => 'LC__BROWSER__TITLE__NET',\n isys_popup_browser_object_ng::C__MULTISELECTION => true,\n isys_popup_browser_object_ng::C__CAT_FILTER => 'C__CATS__LAYER2_NET'\n ]\n ],\n C__PROPERTY__PROVIDES => [\n C__PROPERTY__PROVIDES__SEARCH => false,\n C__PROPERTY__PROVIDES__REPORT => false,\n C__PROPERTY__PROVIDES__LIST => false\n ],\n C__PROPERTY__FORMAT => [\n C__PROPERTY__FORMAT__CALLBACK => [\n 'isys_export_helper',\n 'layer_2_assignments'\n ]\n ]\n ]\n ),\n 'address_v6' => array_replace_recursive(\n isys_cmdb_dao_category_pattern::virtual(),\n [\n C__PROPERTY__INFO => [\n C__PROPERTY__INFO__TITLE => 'LC__CMDB__CATS__NET',\n C__PROPERTY__INFO__DESCRIPTION => 'Net v6'\n ],\n C__PROPERTY__UI => [\n C__PROPERTY__UI__ID => 'C__CATS__NET__NET_V6'\n ]\n ]\n ),\n 'description' => array_replace_recursive(\n isys_cmdb_dao_category_pattern::commentary(),\n [\n C__PROPERTY__INFO => [\n C__PROPERTY__INFO__TITLE => 'LC__CMDB__LOGBOOK__DESCRIPTION',\n C__PROPERTY__INFO__DESCRIPTION => 'Description'\n ],\n C__PROPERTY__DATA => [\n C__PROPERTY__DATA__FIELD => 'isys_cats_net_list__description'\n ],\n C__PROPERTY__UI => [\n C__PROPERTY__UI__ID => 'C__CMDB__CAT__COMMENTARY_' . C__CMDB__CATEGORY__TYPE_SPECIFIC . C__CATS__NET\n ]\n ]\n )\n ];\n }", "public function toArray()\n {\n return [\n 'location' => $this->location(),\n 'from' => $this->from(),\n 'to' => $this->to(),\n 'pencil' => $this->pencil\n ];\n }", "public function getStandardJsonFormat(){\n return VoucherValidationLogTransformer::transform($this->prepareVoucherValidationLogGreedyData());\n }", "public function properties(){\n \t\treturn CMap::mergeArray(\n \t\t\tparent::properties(),\n \t\t\tarray(\n\t\t\t\t'inboundMessageID' => array('type' => 'string'),\n\t\t\t\t'sourceAddress' => array('type' => 'string'),\n\t\t\t\t'messageContent' => array('type' => 'string'),\n\t\t\t\t'externalTransactionID' => array('type' => 'string'),\n\t\t\t\t'status' => array('type' => 'string'),\n\t\t\t\t'dateCreated' => array('type' => 'string'),\n\t\t\t\t'dateModified' => array('type' => 'string'),\n \t\t\t)\n \t\t);\n \t}", "public static function _getPropertyNames(): array\n {\n return [\n ];\n }" ]
[ "0.6250112", "0.6181188", "0.612938", "0.60935354", "0.6042571", "0.60404164", "0.5926467", "0.5917114", "0.59049124", "0.5883796", "0.5882191", "0.58203566", "0.5803534", "0.5791693", "0.579118", "0.57909596", "0.5773587", "0.57419014", "0.5726583", "0.57192504", "0.5709573", "0.5637861", "0.5625238", "0.56240964", "0.56153345", "0.5600852", "0.5578051", "0.55779153", "0.5576176", "0.5549997", "0.5536734", "0.5522427", "0.5517577", "0.55106646", "0.5495743", "0.54940754", "0.549379", "0.54916453", "0.5477201", "0.5476257", "0.546839", "0.5461022", "0.5453635", "0.5435484", "0.5431954", "0.54291284", "0.5427591", "0.542315", "0.54208493", "0.5419445", "0.54128027", "0.54128027", "0.54083985", "0.54021084", "0.5396636", "0.5393254", "0.53931725", "0.53854996", "0.5381423", "0.5372", "0.5368601", "0.5367998", "0.53586936", "0.535232", "0.5344031", "0.53313893", "0.53273624", "0.53251517", "0.5324214", "0.5323608", "0.53176135", "0.53146905", "0.531111", "0.53071785", "0.53045726", "0.52998924", "0.5299861", "0.5293398", "0.52908105", "0.5289552", "0.5289331", "0.5287558", "0.52855974", "0.52821237", "0.528042", "0.5279184", "0.52747715", "0.52737415", "0.5272515", "0.5272114", "0.52707165", "0.5260584", "0.52577984", "0.52574795", "0.5256976", "0.5255159", "0.52540326", "0.5250625", "0.52504915", "0.5247668", "0.52422166" ]
0.0
-1
Array of attributes where the key is the local name, and the value is the original name
public static function attributeMap() { return self::$attributeMap; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function changedAttributesName(): array\n {\n $changedAttributes = [];\n $attributes = $this->toArray();\n foreach ($attributes as $key => $value) {\n if (isset($this->originals[$key]) && $value !== $this->originals[$key] && ! ((is_array($this->originals[$key]) || is_object($this->originals[$key])))) {\n $changedAttributes[] = $key;\n }\n }\n return $changedAttributes;\n }", "public function attributesToArray()\n {\n return Helper::toCamelCase($this->attributes());\n }", "private function getApiAttributeNamesArray()\n {\n $array = [\n 'firstname',\n 'lastname',\n 'email',\n 'id',\n 'website_id',\n 'group_id',\n 'prefix',\n 'middlename',\n 'suffix',\n 'dob',\n 'taxvat',\n 'gender',\n 'is_active',\n 'company',\n 'city',\n 'country_id',\n 'region',\n 'postcode',\n 'telephone',\n 'fax',\n 'vat_id',\n 'street_1',\n 'street_2',\n 'subaccounts',\n 'manage_subaccounts',\n 'account_data_modification_permission',\n 'account_order_history_view_permission',\n 'checkout_order_create_permission',\n 'checkout_order_approval_permission',\n 'checkout_cart_view_permission',\n 'checkout_view_permission',\n 'checkout_order_placed_notification_permission',\n 'force_usage_parent_company_name_permission',\n 'force_usage_parent_vat_permission',\n 'force_usage_parent_addresses_permission',\n 'password',\n 'parent_email',\n 'promote',\n 'can_manage_subaccounts',\n ];\n\n return $array;\n }", "abstract public function attributeNames();", "public function attributeNames() {\n\t\treturn array(\n\t\t\t'name',\n\t\t\t'path',\n\t\t);\n\t}", "private function attrNames()\n {\n $dimAttr = [\n 'length' => 'length',\n 'width' => 'width',\n 'height' => 'height',\n ];\n $dsAttr = [\n 'dropship' => 'dropship',\n 'dropship_location' => 'dropship_location'\n ];\n\n $this->attrNames = ($this->mageVersion >= '2.2.5') ? $dsAttr : array_merge($dsAttr, $dimAttr);\n }", "public function getAttributes($name);", "public function attributes(): array\n {\n return [\n $this->attributePrefix.'target' => $this->target(),\n $this->attributePrefix.'filterByType' => $this->filterByType,\n ];\n }", "public static function dataAttributes(array $attributes): array {\n\t\treturn ArrayTools::flatten(ArrayTools::filterKeyPrefixes(ArrayTools::keysReplace(array_change_key_case($attributes), '_', '-'), 'data-', true));\n\t}", "public function attributes()\n {\n return collect(array_keys($this->rules()))\n ->mapWithKeys(function ($key) {\n return [$key => str_replace(['.', '_'], ' ', $key)];\n })\n ->toArray();\n }", "public function attributes() // atribūtu savi nosaukumi\n {\n return[ \n 'fname' => 'Vārds',\n 'lname' => 'Uzvārds',\n 'email' => 'E-pasts',\n 'oldpassword' => 'Paroles lauks',\n 'password' => 'Jaunas paroles lauks',\n 'buttontitle' => 'Pogas virsraksts',\n 'buttonlink' => 'Pogas links',\n 'reciever' => 'Saņēmēju lauks',\n 'emailtitle' => 'Ziņas virsrsksts',\n 'emailtext' => 'Ziņas teksts',\n 'transport' => 'Pasākumu lauks'\n ];\n }", "public function separateTranslationsFromAttributes(): array\n\t{\n\t\t$attributes = collect($this->attributes);\n\n\t\t// Extract the translated values\n\t\t$translatables = $attributes->only($this->translatable);\n\t\t$this->translatedAttributes = $translatables->toArray();\n\n\t\t// Keep only the non-translatable attributes\n\t\t$this->attributes = $attributes->forget($this->translatable)->toArray();\n\n\t\treturn $this->translatedAttributes;\n\t}", "public function getAttributes()\n {\n $return = [];\n foreach ($this->attr as $attr => $info) {\n $return[$attr] = $this->getAttribute($attr);\n }\n\n return $return;\n }", "public function getAttributes(): array;", "public function getAttributes(): array;", "public function getAttributes(): array;", "public function getAttributes(): array;", "public function attribute_names() {\n\t\n\t\treturn array_keys( $this->attributes );\n\t\t\n\t}", "public function getValidNameAttributes(): array\n {\n return [\n 'Starts with _' => [\n 'attribute_name_0001.xsd', '_foo', \n ], \n 'Starts with letter' => [\n 'attribute_name_0002.xsd', 'f', \n ], \n 'Contains letter' => [\n 'attribute_name_0003.xsd', 'foo', \n ], \n 'Contains digit' => [\n 'attribute_name_0004.xsd', 'f00', \n ], \n 'Contains .' => [\n 'attribute_name_0005.xsd', 'f.bar', \n ], \n 'Contains -' => [\n 'attribute_name_0006.xsd', 'f-bar', \n ], \n 'Contains _' => [\n 'attribute_name_0007.xsd', 'f_bar', \n ], \n 'Surrounded by whitespaces' => [\n 'attribute_name_0008.xsd', 'foo_bar', \n ], \n ];\n }", "public function getAttributes() {\n $attr = array();\n \n $attr[\"id\"] = $this->id_;\n $attr[\"taxonId\"] = $this->taxonId_;\n $attr[\"dbh\"] = $this->dbh_;\n $attr[\"lat\"] = $this->lat_;\n $attr[\"lng\"] = $this->lng_;\n $attr[\"layers\"] = $this->layers_;\n \n return $attr;\n }", "abstract function attributes(): array;", "public function getAttributes()\n {\n return array();\n }", "public function getAttributes()\n {\n return array();\n }", "public function getAttributes()\n {\n return array();\n }", "public function getAttributes()\n {\n return array();\n }", "public function attributeNames()\n {\n return array_merge_recursive(parent::attributeNames(), array(\n 'markup',\n 'name',\n 'plaintext_markup',\n 'subject_markup',\n 'base',\n ));\n }", "public function attributes()\n {\n return [\n 'name' => __('main.name'),\n ];\n }", "public function attributes() : array;", "private function mapAttributes() {\n\t\t$attributes = [];\n\t\t$originalAttrs = $this->subscribedTopic->getRoute()->getAttributes();\n\n\t\tif (!count($originalAttrs)) {\n\t\t\treturn $attributes;\n\t\t}\n\n\t\tforeach ($originalAttrs as $attr => $obj) {\n\t\t\t$routeParts = explode('/', $this->route);\n\n\t\t\tif (!isset($routeParts[$obj->index])) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t$attributes[$attr] = $routeParts[$obj->index];\n\t\t}\n\n\t\treturn $attributes;\n\t}", "public function attributeNames()\n\t{\n\t\t$class = get_class($this);\n\t\tif(!isset(self::$_names[$class]))\n\t\t{\n\t\t\tself::$_names[$class] = array_merge(array('id'), $this->getNames($this->arrayStructure()));\n\t\t}\n\t\t\n\t\treturn self::$_names[$class];\n\t}", "public static function attributeMap()\n {\n return [\n 'status' => 'status',\n 'quota' => 'quota'\n ];\n }", "public static function attributeMap()\n {\n return [\n 'status' => 'status',\n 'time' => 'time'\n ];\n }", "public function toArray() {\n $attrs = $this->_private_attributes;\n $result = array();\n foreach ($attrs as $key => $attr) {\n if (method_exists($this, \"get\" . underscore_to_camel_case($key, true))) {\n eval('$result[\"' . $key . '\"] = $this->get' . underscore_to_camel_case($key, true) . '();');\n } else {\n $result[$key] = $attr;\n }\n }\n return $result;\n }", "public function attributeNames() {\n\t\t$attributeNames = array(\n\t\t\t'name',\n\t\t\t'category_name',\n\t\t\t'default_content',\n\t\t);\n\t\t$attributeNames = array_merge($attributeNames, $this->contentAttributeNames());\n\t\treturn $attributeNames;\n\t}", "public function getChangedAttributes()\n {\n $output = array();\n\n foreach ($this->attributes as $name => $value) {\n if ($this->hasChanged($name)) {\n $output[$name] = $value;\n }\n }\n\n return $output;\n }", "public function attributeNames() {\n\t\t$attributeNames = array(\n\t\t\t'name',\n\t\t\t'width',\n\t\t\t'height',\n\t\t);\n\t\t$attributeNames = array_merge($attributeNames, $this->existAttributeNames());\n\t\treturn $attributeNames;\n\t}", "public function getAttributes()\n {\n return array_merge(\n $this->attributes,\n [\n 'args' => $this->args(),\n 'type' => $this->type(),\n 'resolve' => $this->getResolver(),\n ]\n );\n }", "public function getUnchangedAttributes()\n {\n $output = array();\n\n foreach ($this->attributes as $name => $value) {\n if (!$this->hasChanged($name)) {\n $output[$name] = $value;\n }\n }\n\n return $output;\n }", "public function getChanges(): array\n {\n $changes = [];\n\n foreach ($this->changedAttributesName() as $key) {\n $changes[$key] = $this->originals[$key];\n }\n\n return $changes;\n }", "public function getAttributeNames ()\n {\n\n return array_keys($this->attributes);\n\n }", "public function attributes(): array\n {\n return [\n 'name' => '角色名称',\n 'staff' => '关联员工',\n 'brand' => '关联品牌',\n 'department' => '关联部门',\n ];\n }", "public function attributes()\n {\n return [\n 'external_id' => 'Third Party Identifier',\n 'name_first' => 'First Name',\n 'name_last' => 'Last Name',\n 'root_admin' => 'Root Administrator Status',\n ];\n }", "public function toArray(): array\n {\n return [\n $this->attribute->getName(),\n $this->name,\n ];\n }", "public function attributeNames()\n {\n $className = get_class($this);\n if (!isset(self::$_names[$className])) {\n $class = new ReflectionClass(get_class($this));\n $names = array();\n foreach ($class->getProperties() as $property) {\n $name = $property->getName();\n if ($property->isPublic() && !$property->isStatic())\n $names[] = $name;\n }\n return self::$_names[$className] = $names;\n } else\n return self::$_names[$className];\n }", "public function toArray()\n {\n $attributes = parent::toArray();\n \n foreach ($this->getTranslatableAttributes() as $name) {\n $attributes[$name] = $this->getTranslation($name, app()->getLocale());\n }\n \n return $attributes;\n }", "protected function prepareAttributes(array $attributes)\n\t{\n\t\t$result = array();\n\n\t\tforeach ($attributes as $key => $attributeValue)\n\t\t{\n\t\t\t$newKey = mb_strtolower($key);\n\t\t\t$newKey = str_replace('_', '-', $newKey);\n\n\t\t\tif (is_array($attributeValue))\n\t\t\t{\n\t\t\t\t$newAttribute = $this->prepareAttributes($attributeValue);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$newAttribute = $attributeValue;\n\t\t\t}\n\n\t\t\t$result[$newKey] = $newAttribute;\n\t\t}\n\n\t\treturn $result;\n\t}", "public function toArray()\r\n\t{\r\n\t\t$attributes = parent::toArray();\r\n\r\n\t\tif (! $this->autoTranslations) return $attributes;\r\n\r\n\t\tforeach ($this->translatableAttributes as $field) {\r\n\t\t\t$attributes[$field] = $this->getTranslation($field);\r\n\t\t}\r\n\r\n\t\treturn $attributes;\r\n\t}", "protected function getAttributes()\n {\n return [];\n }", "public function getAttributes();", "public function getAttributes();", "public function getAttributes();", "public function getAttributes();", "public function getAttributes();", "public function getAttributes();", "public function getAttributes();", "public function getAttributes();", "public function getAttributes();", "public function attributes()\n {\n return [\n 'client_id' => trans('financials.client'),\n 'name' => trans('persona.name'),\n 'email' => trans('persona.email'),\n 'password' => trans('auth.password'),\n 'password_confirmation' => trans('auth.password:confirmation'),\n 'role' => trans('persona.title'),\n 'stored_file' => trans('persona.image'),\n ];\n }", "public function attributes()\n {\n return [\n ];\n }", "public function attributes(): array\n {\n return [\n //\n ];\n }", "public function attributes(): array\n {\n return [\n //\n ];\n }", "public function getAttributes()\n\t{\n\t\treturn array(\n\t\t\t'usuario' => $this->usuario,\n\t\t\t'correo' => $this->correo,\n\t\t\t'cedula'=>$this->cedula,\n\t\t\t//'firstName' => $this->firstName,\n\t\t\t//'lastName' => $this->lastName,\n\t\t);\n\t}", "private function _processAttributes($attributes){\r\n\r\n if(Help::isAssoc($attributes)){\r\n\r\n foreach($attributes as $key => $value){\r\n $attrs[] = $key.'('.$value.')';\r\n }\r\n }\r\n else{\r\n $attrs = $attributes;\r\n }\r\n\r\n return $attrs;\r\n }", "public function attributes()\n {\n return array_merge(\n parent::attributes(),\n ['date', 'origin', 'originName', 'total']\n );\n }", "public function getCustomAttributes(): array;", "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 }", "public static function attributeMap();", "public function getAttributesNames(){\n\t\t$this->_connect();\n\t\treturn ActiveRecordMetaData::getAttributes($this->_source, $this->_schema);\n\t}", "public function attributes()\n {\n return [];\n }", "public function attributes()\n {\n return [];\n }", "public function attributes()\n {\n return [];\n }", "protected static function keyToAttributeMapping()\n {\n return array();\n }", "public function getOldAttributes()\n {\n return $this->_oldAttributes === null ? [] : $this->_oldAttributes;\n }", "public function getAttributes() {}", "public function getAttributes() {}", "public function attributes()\n {\n return [\n 'name' => __('basic::elf.name'),\n 'slug' => __('basic::elf.slug'),\n 'image' => __('basic::elf.image'),\n 'preview' => __('basic::elf.preview'),\n 'thumbnail' => __('basic::elf.thumbnail'),\n 'description' => __('basic::elf.description'),\n 'additional_text' => __('gallery::elf.additional_text'),\n 'option' => __('gallery::elf.option'),\n 'active' => __('basic::elf.active'),\n 'link' => __('basic::elf.link'),\n ];\n }", "public function attributes()\n {\n return [\n 'name' => 'nombre',\n 'last_name' => 'apellido',\n 'num_id' => 'cédula',\n 'email' => 'correo',\n 'birthdate' => 'fecha',\n 'sex' => 'sexo',\n 'place_birthdate' => 'lugar de nacimiento',\n 'blood_group' => 'grupo sanguineo',\n 'phone_person' => 'telefono personal',\n 'location_home' => 'lugar donde vive',\n 'phone_home' => 'telefono de casa',\n 'location_work' => 'lugar de trabajo ',\n 'phone_work' => 'telefono de trabajo',\n 'profession' => 'profesión',\n 'current_occupation' => 'ocupación',\n 'observation' => 'observación',\n ];\n }", "public function getAttributeNames()\n {\n return array_keys($this->attributes);\n }", "public function getAddAttrArray()\n {\n $custom = $this->select(Customization::ADD_ATTR)->get();\n $result = array_values($custom->toArray()[0]);\n array_unshift($result, __('general.select_attr'));\n return $result;\n }", "function get_attr()\n\t{\n\t\t$a = array();\n\t\twhile (($s = array_shift($this->pieces))) {\n\t\t\tif (($i = strpos($s,\":\")) >= 1) {\n\t\t\t\t$attr = substr($s,0,$i);\n\t\t\t\t$val = substr($s,$i+1);\n\t\t\t\tif (($j = strpos($val,\"(\"))\n\t\t\t\t && ($k = strpos($val,\")\"))\n\t\t\t\t && ($k > $j)) {\n\t\t\t\t\t$a[\"arg:\".$attr] = substr($val,$j+1,$k-($j+1));\n\t\t\t\t\t$val = substr($val,0,$j);\n\t\t\t\t}\n\t\t\t\t$a[$attr] = $val;\n\t\t\t} elseif (intval($s) > 0) {\n\t\t\t if ($a['$scale'] != \"\")\n\t\t\t\t$a['scale'] = intval($s);\n\t\t\t}\n\t\t}\n\t\treturn $a;\n\t}", "public function getAttributes() {\n $toReturn = array();\n $toReturn[\"id\"] = $this->id_;\n $toReturn[\"username\"] = $this->username_;\n $toReturn[\"email\"] = $this->email_;\n $toReturn[\"displayName\"] = $this->displayName_;\n $toReturn[\"firstName\"] = $this->firstName_;\n $toReturn[\"lastName\"] = $this->lastName_;\n $toReturn[\"postalCode\"] = $this->postalCode_;\n if ($this->privileges_ !== null) {\n $toReturn[\"privileges\"] = $this->privileges_;\n } else {\n $toReturn[\"privileges\"] = array();\n }\n \n $toReturn[\"isVerified\"] = $this->isVerified_;\n return $toReturn;\n }", "function getAttrList() {\n return array_keys($this->attributes);\n }", "protected function getSerializableAttributeNames(): array {\n return array_keys(get_object_vars($this));\n }", "protected function getAttributesToObfuscate(): array\n {\n return config('logbook.obfuscated_fields');\n }", "function getAttributes()\r\n\t{\r\n\t\t$result = array();\r\n\t\t$attributes = $this->object->getAttributes();\r\n\t\t\r\n\t\tforeach( $attributes as $key => $attribute )\r\n\t\t{\r\n\t\t\tif ( $key == 'OrderNum' ) continue;\r\n\t\t\tif ( $key == 'RecordCreated' ) continue;\r\n\t\t\tif ( $key == 'RecordModified' ) continue;\r\n\t\t\t\t\r\n\t\t\tarray_push( $result, $key );\r\n\t\t}\r\n\t\t\r\n\t\treturn $result;\r\n\t}", "public function attributes()\n {\n return [\n 'name' => '商品名',\n 'price' => '価格',\n 'description' => '説明文',\n 'tag_for_search' => '検索用タグ',\n 'img' => '画像',\n 'stock' => '在庫数'\n ];\n }", "public function dataProviderNormalizeUserAttributes()\n {\n return [\n [\n [\n 'name' => 'raw/name',\n 'email' => 'raw/email',\n ],\n [\n 'raw/name' => 'name value',\n 'raw/email' => 'email value',\n ],\n [\n 'name' => 'name value',\n 'email' => 'email value',\n ],\n ],\n [\n [\n 'name' => function ($attributes) {\n return $attributes['firstName'] . ' ' . $attributes['lastName'];\n },\n ],\n [\n 'firstName' => 'John',\n 'lastName' => 'Smith',\n ],\n [\n 'name' => 'John Smith',\n ],\n ],\n [\n [\n 'email' => ['emails', 'prime'],\n ],\n [\n 'emails' => [\n 'prime' => '[email protected]'\n ],\n ],\n [\n 'email' => '[email protected]',\n ],\n ],\n [\n [\n 'email' => ['emails', 0],\n 'secondaryEmail' => ['emails', 1],\n ],\n [\n 'emails' => [\n '[email protected]',\n ],\n ],\n [\n 'email' => '[email protected]',\n ],\n ],\n [\n [\n 'name' => 'file_get_contents',\n ],\n [\n 'file_get_contents' => 'value',\n ],\n [\n 'name' => 'value',\n ],\n ],\n ];\n }", "public function defineAttributes()\n\t{\n\t\treturn array();\n\t}", "public function getFlatAttributes() {\n $attrib = array();\n foreach($this->attributes as $a) {\n $attrib = $attrib + $a;\n }\n return $attrib;\n }", "protected function attributes()\n {\n return [];\n }", "public function getAttributeNames()\n {\n $names = array_keys($this->_attrs);\n sort($names);\n return $names;\n }", "public function getAttributes() {\n return $this->attributes->getArray();\n }", "public function attributes()\n {\n return [\n //\n ];\n }", "public function attributes()\n {\n return [\n //\n ];\n }", "public function attributes()\n {\n return [\n //\n ];\n }", "public function attributes()\n {\n return [\n //\n ];\n }", "public function attributes()\n {\n return [\n //\n ];\n }", "public function attributes()\n {\n return [\n //\n ];\n }", "public function attributes()\n {\n return [\n //\n ];\n }", "public function attributes()\n {\n return [\n //\n ];\n }", "public function attributes()\n {\n return [\n //\n ];\n }" ]
[ "0.73337924", "0.68277997", "0.65786934", "0.6576621", "0.6504521", "0.64891624", "0.64803416", "0.6447048", "0.64139146", "0.63856167", "0.63815665", "0.6349684", "0.6280374", "0.6256171", "0.6256171", "0.6256171", "0.6256171", "0.6250133", "0.61939216", "0.6169779", "0.6162793", "0.6135612", "0.6135612", "0.6135612", "0.6135612", "0.6108794", "0.6106758", "0.6102304", "0.61007494", "0.60995203", "0.6092441", "0.60829234", "0.60719186", "0.6058535", "0.6057051", "0.603967", "0.60379815", "0.60318077", "0.60131866", "0.6001976", "0.60009944", "0.59907407", "0.59773916", "0.595509", "0.5934935", "0.59235513", "0.5919365", "0.5918017", "0.59120923", "0.59120923", "0.59120923", "0.59120923", "0.59120923", "0.59120923", "0.59120923", "0.59120923", "0.59120923", "0.59004533", "0.5899985", "0.5895635", "0.5895635", "0.5888718", "0.5879801", "0.587595", "0.58692914", "0.5862841", "0.5859062", "0.58539706", "0.5853741", "0.5853741", "0.5853741", "0.5846755", "0.5830684", "0.5827877", "0.58271164", "0.582313", "0.5821928", "0.5813806", "0.5811571", "0.5801976", "0.57984924", "0.5797976", "0.5794929", "0.579099", "0.57823116", "0.5769463", "0.57668436", "0.5763048", "0.57624525", "0.5761271", "0.5760769", "0.5755038", "0.57536274", "0.57536274", "0.57536274", "0.57536274", "0.57536274", "0.57536274", "0.57536274", "0.57536274", "0.57536274" ]
0.0
-1
Array of attributes to setter functions (for deserialization of responses)
public static function setters() { return self::$setters; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function setAttributes();", "public static function setters();", "public static function setters()\n {\n return [\n 'status' => 'setStatus',\n 'quota' => 'setQuota'\n ];\n }", "public function setAttributes(array $attributes);", "public function setAttributes(array $attributes);", "public function setAttributes(array $attributes);", "public static function setters()\n {\n return [\n 'application_id' => 'setApplicationId',\n 'is_default' => 'setIsDefault',\n 'role' => 'setRole',\n 'type' => 'setType',\n '_issues' => 'setIssues'\n ];\n }", "public function setAttributes($attributes){ }", "public static function setters()\n {\n return [\n 'status' => 'setStatus',\n 'time' => 'setTime'\n ];\n }", "public function __construct($daten = array())\n{\n if ($daten) {\n foreach ($daten as $k => $v) {\n $setterName = 'set' . ucfirst($k);\n // wenn ein ungültiges Attribut übergeben wurde\n // (ohne Setter), ignoriere es\n if (method_exists($this, $setterName)) {\n $this->$setterName($v);\n }\n }\n }\n}", "public function setAttributes($arr) {\n foreach($arr as $key => $val) {\n switch($key) {\n case \"id\":\n case \"user_id\":\n //casting null to int will return 0; don't want that\n if ($val !== null) {\n $this->id_ = (int) $val;\n }\n break; \n case \"username\":\n $this->username_ = $val;\n break; \n case \"email\":\n $this->email_ = $val;\n break; \n case \"displayName\":\n case \"display_name\":\n $this->displayName_ = $val;\n break; \n case \"firstName\":\n case \"first_name\":\n $this->firstName_ = $val;\n break; \n case \"lastName\":\n case \"last_name\":\n $this->lastName_ = $val;\n break; \n case \"postalCode\":\n case \"postal_code\":\n $this->postalCode_ = $val;\n break; \n case \"isVerified\":\n case \"is_verified\":\n $this->isVerified_ = (int) $val;\n break; \n case \"privileges\":\n //might be a string of comma-separated numbers, or an array\n if (is_array($val)) {\n $this->privileges_ = $val;\n } else if ($val !== null) {\n //clear array first\n unset($this->privileges_);\n $this->privileges_ = array();\n $tmp = explode(\",\", $val);\n foreach($tmp as $v){\n if (is_numeric($v)) {\n //$this->privileges_[(int) $v] = 1;\n $this->privileges_[] = (int) $v;\n }\n }\n \n }\n break;\n\n default:\n //ignore any others\n }\n }\n }", "public static function setters()\n {\n return parent::setters() + self::$setters;\n }", "public static function setters()\n {\n return parent::setters() + self::$setters;\n }", "public static function setters()\n {\n return parent::setters() + self::$setters;\n }", "public static function setters()\n {\n return parent::setters() + self::$setters;\n }", "public static function setters()\n {\n return parent::setters() + self::$setters;\n }", "public static function setters()\n {\n return parent::setters() + self::$setters;\n }", "public static function setters()\n {\n return parent::setters() + self::$setters;\n }", "public static function setters()\n {\n return parent::setters() + self::$setters;\n }", "public static function setters()\n {\n return parent::setters() + self::$setters;\n }", "public static function setters()\n {\n return parent::setters() + self::$setters;\n }", "public static function setters()\n {\n return parent::setters() + self::$setters;\n }", "public static function setters()\n {\n return parent::setters() + self::$setters;\n }", "public static function setters()\n {\n return parent::setters() + self::$setters;\n }", "public function setAttributes($values)\n {\n if (is_array($values)) {\n foreach ($values as $name => $value) {\n $setter = 'set' . ucfirst($name);\n if (method_exists($this, $setter)) {\n // set property\n $this->$setter($value);\n }\n }\n }\n }", "public static function setters()\n {\n return [\n 'tenant_id' => 'setTenantId',\n 'expires_in' => 'setExpiresIn',\n 'scopes' => 'setScopes'\n ];\n }", "public function setAttributes($attributes);", "public function setAttributes($attributes)\n {\n foreach($attributes as $key => $value) {\n $this->$key = $value;\n }\n }", "abstract protected function setRequiredGetters();", "abstract protected function setValidationCustomAttributes(): array;", "protected abstract function initializeAttributes(): array;", "public function setAttrs($attrs);", "public function __construct(array $attributes)\n {\n foreach ($attributes as $attribute => $value){\n $this->$attributes = $value;\n }\n }", "abstract function attributes(): array;", "public function setRawAttributes($attributes) {\n $regex_attributes = \"/(?P<key>[a-z0-9-]+)=?(?P<value> [a-z0-9-]+)?,?/ix\";\n $attrib = array();\n if($attributes != '') {\n $parts = array();\n $result = preg_match_all($regex_attributes, $attributes, $parts);\n if(!$result) {\n $this->attributes = $attrib;\n return $this;\n }\n $keys = $parts['key'];\n $values = $parts['value'];\n $allowed_keys = $this->getAllowedAttributes();\n $allowed_values = $this->getAllowedAttributeValues();\n foreach ($keys as $index => $key) {\n $key = strtolower($key);\n // The key is in the allowed_keys array\n if(in_array($key, $allowed_keys)) {\n $value = strtolower($values[$index]);\n if(array_key_exists($key, $allowed_values)) {\n // For this key exists a allowed values array\n if(in_array($value, $allowed_values[$key])) {\n // Otherwise we check if the value is in the array\n $attrib[$key][] = $value; \n } else {\n // OK, we found a key wich is not allowed\n $allowedValues = implode(', ', $allowed_values[$key]);\n throw new Exception(\"$this->class: '$value' not allowed for attribute '$key'! Allowed values are: $allowedValues\");\n } \n } else {\n // For this key, no array with allowed values exist. we just save the key and asume any value is allowed\n $attrib[$key][] = $value;\n //throw new Exception(\"$this->class: '$value' not allowed for attribute '$key'! Allowed values are: $allowedValues\");\n }\n } else {\n $keyIsAllowed = false;\n foreach($allowed_values as $otherKey => $otherValues) {\n if(in_array($key, $otherValues)) {\n $attrib[$otherKey][] = $key;\n $keyIsAllowed = true;\n }\n }\n if(!$keyIsAllowed) {\n throw new Exception(sprintf(\"%s: '%s' not allowed as attribute!\", $this->class, $key));\n }\n }\n }\n }\n $this->attributes = $attrib;\n return $this;\n }", "function update_attributes($array = array())\n {\n foreach ($array as $key => $value) {\n $this->_stdObject->{$key} = $value;\n }\n }", "public function setAttributes(array $attributes)\n\t{\n\t\t$allowedAttributes = array('usuario','correo','cedula');\n\t\tforeach($attributes as $name=>$value) {\n\t\t\tif (in_array($name, $allowedAttributes))\n\t\t\t\t\t$this->$name = $value;\n\t\t}\n\t\treturn true;\n\t}", "public function prepAttributesForUse()\n\t{\n\t\t$attributes = $this->defineAttributes();\n\t\t$attributes['dateUpdated'] = array('0' => AttributeType::DateTime, 'required' => true);\n\t\t$attributes['dateCreated'] = array('0' => AttributeType::DateTime, 'required' => true);\n\n\t\tforeach ($attributes as $name => $config)\n\t\t{\n\t\t\t$config = ModelHelper::normalizeAttributeConfig($config);\n\t\t\t$value = $this->getAttribute($name);\n\n\t\t\tswitch ($config['type'])\n\t\t\t{\n\t\t\t\tcase AttributeType::DateTime:\n\t\t\t\t{\n\t\t\t\t\tif ($value)\n\t\t\t\t\t{\n\t\t\t\t\t\tif (DateTimeHelper::isValidTimeStamp($value))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$dateTime = new DateTime('@'.$value);\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t// TODO: MySQL specific.\n\t\t\t\t\t\t\t$dateTime = DateTime::createFromFormat(DateTime::MYSQL_DATETIME, $value);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t$this->setAttribute($name, $dateTime);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase AttributeType::Mixed:\n\t\t\t\t{\n\t\t\t\t\tif (!empty($value) && is_string($value))\n\t\t\t\t\t{\n\t\t\t\t\t\t$this->setAttribute($name, JsonHelper::decode($value));\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$this->setAttribute($name, array());\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "public function testMagicMethodSetThrowsExceptionValuesNotAnArray()\n\t{\n\t\t$stub = new \\Orchestra\\Support\\Form\\Fieldset(function ($f) {});\n\n\t\t$stub->attributes = 'foo';\n\t}", "public function set()\n {\n $args = func_get_args();\n\n if ( count($args) == 2 )\n {\n $this->attributes[$args[0]] = $args[1];\n }\n elseif ( count($args) == 1 && is_array($args[0]) ) \n {\n $this->attributes = ( array_merge($this->attributes, $args[0]) );\n }\n\n return $this;\n }", "public function hydrate($donnees){\n foreach($donnees as $key => $value){\n //on delcare la varible method\n $method = 'set'.ucfirst($key);\n//on verifie si la methode existe\n if(method_exists($this,$method)){\n $this->$method($value);\n }\n }\n\n}", "public static function setters() : array\n {\n return self::$setters;\n }", "public static function setters() : array\n {\n return self::$setters;\n }", "public static function setters() : array\n {\n return self::$setters;\n }", "public static function setters() : array\n {\n return self::$setters;\n }", "public static function setters() : array\n {\n return self::$setters;\n }", "public static function setters() : array\n {\n return self::$setters;\n }", "public function initAttribute();", "abstract protected function attributes();", "public function setProperties( ArrayObject $params )\n {\n foreach ( $this->attributeTypes as $attr => $type )\n {\n // 1: fijarse si esta en params\n // 2: verificar si el valor que tiene en params es del mismo tipo que el atributo\n // - Si el tipo es numerico, y el valor es string, ver que sea un string numerico. http://www.php.net/is_numeric (ojo con numeros negativos o si empiezan con \".\" o \",\", probar!!!)\n // - Si el tipo es date o time, y el tipo es un string, ver que el string tiene forma de date o time.\n // - Distinguir entre valor cero y valor null.\n\n // TODO: Ver como se podrian tambien setear listas de \"objetos simples\" (no es la idea que esto setee atributos que son PO, solo atributos simples)\n if (isset($params[$attr]) && !$this->isInyectedAttribute($attr)) // IMPORTANTE: id, class, deleted no se pueden setear por set properties!!!\n {\n // Esto es set$attr pero mas rapido!\n // TODO: Chekeos de tipos...\n // WARNING: Esto solo setea atributos simples! Hay que ver si puedo hacer el tema de setear atributos de clases asociadas... (depende de la notacion de las keys de params)\n // SI HAGO TODO EL CHEKEO EN setAttributeValue, solo llamo a esa y listo...\n \n $this->attributeValues[$attr] = (is_string($params[$attr]) ? trim($params[$attr]) : $params[$attr]);\n \n // Si attr el un id de un hasOne, y viene un string vacio, me tira un error en DatabaseXXX\n // al intentar poner un '' en un campo INT id, pero NULL le puedo poner. Asi que si viene\n // un valor vacio, le pongo NULL.\n if ($this->attributeValues[$attr] === '') $this->attributeValues[$attr] = NULL;\n \n \n // FIXME: deberia garantizar que solo vienen valores simples en params.\n \n // Marco como dirty en atributos simples (asignar en cada loop del for es mas barato\n // que estar chequeando si se modifico un campo y setear afuera del loop).\n $this->dirty = true;\n }\n }\n }", "public function getFieldDeserializers(): array {\n $o = $this;\n return array_merge(parent::getFieldDeserializers(), [\n 'bold' => fn(ParseNode $n) => $o->setBold($n->getBooleanValue()),\n 'color' => fn(ParseNode $n) => $o->setColor($n->getStringValue()),\n 'italic' => fn(ParseNode $n) => $o->setItalic($n->getBooleanValue()),\n 'name' => fn(ParseNode $n) => $o->setName($n->getStringValue()),\n 'size' => fn(ParseNode $n) => $o->setSize($n->getFloatValue()),\n 'underline' => fn(ParseNode $n) => $o->setUnderline($n->getStringValue()),\n ]);\n }", "function set(array $array){\n foreach($this as $atributo => $valor){\n if(isset($array[$atributo])){\n $this->$atributo = $array[$atributo];\n }\n }\n }", "public function getFieldDeserializers(): array {\n $o = $this;\n return array_merge(parent::getFieldDeserializers(), [\n 'updateCategory' => fn(ParseNode $n) => $o->setUpdateCategory($n->getEnumValue(UpdateCategory::class)),\n ]);\n }", "public function set_attributes($attributes)\n {\n }", "public function getFieldDeserializers(): array {\n $o = $this;\n return array_merge(parent::getFieldDeserializers(), [\n 'mailExchange' => fn(ParseNode $n) => $o->setMailExchange($n->getStringValue()),\n 'preference' => fn(ParseNode $n) => $o->setPreference($n->getIntegerValue()),\n ]);\n }", "protected function hydrate($array){\r\n\t\tforeach ($array as $key => $value) {\r\n\t\t\t$methodName = 'set'.ucfirst($key);\r\n\t\t\tif(method_exists($this, $methodName)){\r\n\t\t\t\t$this->$methodName($value);\r\n\t\t\t}\r\n\t\t}\r\n\t}", "function setValues($array){\r\n\t\tforeach($array as $key => $val){\r\n\t\t\t$key = lcfirst(str_replace(\" \",\"\",ucwords(str_replace(\"_\",\" \",$key))));\r\n\t\t\tif(property_exists($this,$key))\r\n\t\t\t\t$this->$key = $val;\r\n\t\t}\r\n\t}", "function setValues($array){\r\n\t\tforeach($array as $key => $val){\r\n\t\t\t$key = lcfirst(str_replace(\" \",\"\",ucwords(str_replace(\"_\",\" \",$key))));\r\n\t\t\tif(property_exists($this,$key))\r\n\t\t\t\t$this->$key = $val;\r\n\t\t}\r\n\t}", "public function setAttributes($values)\n {\n if (!empty($values)) {\n foreach ($values as $name => $value) {\n $this->setAttribute($name, $value);\n }\n }\n }", "public function getFieldDeserializers(): array {\n $o = $this;\n return array_merge(parent::getFieldDeserializers(), [\n 'urls' => function (ParseNode $n) {\n $val = $n->getCollectionOfPrimitiveValues();\n if (is_array($val)) {\n TypeUtils::validateCollectionValues($val, 'string');\n }\n /** @var array<string>|null $val */\n $this->setUrls($val);\n },\n ]);\n }", "public function getCustomAttributes(): array;", "public function setAttributes($values, $safeOnly = true)\n\t{\n\t\tparent::setAttributes($values, $safeOnly);\n\n\t\t// Looking only for file attributes (and fix null error on fly)\n\t\tif ( is_array($values) )\n\t\t{\n\t\t\t$attributes = array_flip($safeOnly ? $this->safeAttributes() : $this->attributes());\n\n\t\t\t$class = StringHelper::basename(get_called_class());\n\n\t\t\tforeach ($values as $name => $value)\n\t\t\t{\n\t\t\t\tif ( isset( $attributes[$name] ) )\n\t\t\t\t{\n\t\t\t\t\tif ( isset($_FILES[$class]['name'][$name]) )\n\t\t\t\t\t{\n\t\t\t\t\t\t$uploadedFile = UploadedFile::getInstance($this, $name);\n\n\t\t\t\t\t\tif ( $uploadedFile )\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$this->$name = $uploadedFile;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telseif ( ! $this->isNewRecord )\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$this->$name = $this->oldAttributes[$name];\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}", "public function setAttributes($values, $safeOnly = true)\n\t{\n\t\tparent::setAttributes($values, $safeOnly);\n\n\t\t// Looking only for file attributes (and fix null error on fly)\n\t\tif ( is_array($values) )\n\t\t{\n\t\t\t$attributes = array_flip($safeOnly ? $this->safeAttributes() : $this->attributes());\n\n\t\t\t$class = StringHelper::basename(get_called_class());\n\n\t\t\tforeach ($values as $name => $value)\n\t\t\t{\n\t\t\t\tif ( isset( $attributes[$name] ) )\n\t\t\t\t{\n\t\t\t\t\tif ( isset($_FILES[$class]['name'][$name]) )\n\t\t\t\t\t{\n\t\t\t\t\t\t$uploadedFile = UploadedFile::getInstance($this, $name);\n\n\t\t\t\t\t\tif ( $uploadedFile )\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$this->$name = $uploadedFile;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telseif ( ! $this->isNewRecord )\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$this->$name = $this->oldAttributes[$name];\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}", "public function defineAttributes()\n\t{\n\t\treturn array();\n\t}", "public function setAttributes(array $params)\n {\n foreach($params as $name => $value) {\n $this->setAttribute($name, $value);\n }\n }", "public function hydrate( array $attributes ) {\n\n\t\t// Set all the field from $data\n\t\tforeach ( $attributes as $fieldName => $fieldValue ) {\n\t\t\t$this->set( $fieldName, $fieldValue );\n\t\t}\n\n\t}", "public function getFieldDeserializers(): array {\n $o = $this;\n return array_merge(parent::getFieldDeserializers(), [\n 'recipientActionDateTime' => fn(ParseNode $n) => $o->setRecipientActionDateTime($n->getDateTimeValue()),\n 'recipientActionMessage' => fn(ParseNode $n) => $o->setRecipientActionMessage($n->getStringValue()),\n 'recipientUserId' => fn(ParseNode $n) => $o->setRecipientUserId($n->getStringValue()),\n 'senderShiftId' => fn(ParseNode $n) => $o->setSenderShiftId($n->getStringValue()),\n ]);\n }", "public function getAttributes(): array\n {\n // Get all attributes using all the getters.\n $attributes = [];\n foreach(\\array_keys(\\get_object_vars($this)) as $attribute) {\n\n // Construct the getter name.\n $getter = \\lcfirst(\\str_replace('_', '', \\ucwords($attribute, '_')));\n\n // Get the attribute's value from the getter.\n $attributes[$attribute] = $this->{$getter}();\n }\n\n return $attributes;\n }", "public function attributes()\n {\n return $this->morphToMany(Attribute::class, 'attribute_able');\n }", "public function __construct($daten = array())\n {\n if ($daten) {\n foreach ($daten as $k => $v) {\n $setterName = 'set' . ucfirst($k);\n // wenn ein ungültiges Attribut übergeben wurde\n // (ohne Setter), ignoriere es\n if (method_exists($this, $setterName)) {\n $this->$setterName($v);\n }\n }\n }\n }", "public function setAttr($attributes = array())\n {\n foreach ($attributes as $key => $value) {\n if (property_exists(get_class($this), $key))\n $this->$key = $value;\n }\n return $this;\n }", "function setValues($array){\r\n\t\tforeach($array as $key => $val)\r\n\t\t\tif(property_exists($this,$key))\r\n\t\t\t\t$this->$key = $val;\r\n\t}", "public function getFieldDeserializers(): array {\n $o = $this;\n return [\n '@odata.type' => fn(ParseNode $n) => $o->setOdataType($n->getStringValue()),\n 'response' => fn(ParseNode $n) => $o->setResponse($n->getEnumValue(ResponseType::class)),\n 'time' => fn(ParseNode $n) => $o->setTime($n->getDateTimeValue()),\n ];\n }", "public function attributes() : array;", "public function getFieldDeserializers(): array {\n $o = $this;\n return array_merge(parent::getFieldDeserializers(), [\n 'callEventType' => fn(ParseNode $n) => $o->setCallEventType($n->getEnumValue(TeamworkCallEventType::class)),\n 'callId' => fn(ParseNode $n) => $o->setCallId($n->getStringValue()),\n 'initiator' => fn(ParseNode $n) => $o->setInitiator($n->getObjectValue([IdentitySet::class, 'createFromDiscriminatorValue'])),\n ]);\n }", "public function fill(array $attributes)\n {\n $existingAttributes = get_object_vars($this);\n\n foreach ($existingAttributes as $attributeName => $oldAttributeValue) {\n array_key_exists($attributeName, $attributes) ? $this->$attributeName = $attributes[$attributeName] : NULL;\n }\n }", "public function getFieldDeserializers(): array {\n $o = $this;\n return array_merge(parent::getFieldDeserializers(), [\n 'assignmentState' => fn(ParseNode $n) => $o->setAssignmentState($n->getStringValue()),\n 'duration' => fn(ParseNode $n) => $o->setDuration($n->getStringValue()),\n 'reason' => fn(ParseNode $n) => $o->setReason($n->getStringValue()),\n 'requestedDateTime' => fn(ParseNode $n) => $o->setRequestedDateTime($n->getDateTimeValue()),\n 'roleId' => fn(ParseNode $n) => $o->setRoleId($n->getStringValue()),\n 'roleInfo' => fn(ParseNode $n) => $o->setRoleInfo($n->getObjectValue([PrivilegedRole::class, 'createFromDiscriminatorValue'])),\n 'schedule' => fn(ParseNode $n) => $o->setSchedule($n->getObjectValue([GovernanceSchedule::class, 'createFromDiscriminatorValue'])),\n 'status' => fn(ParseNode $n) => $o->setStatus($n->getStringValue()),\n 'ticketNumber' => fn(ParseNode $n) => $o->setTicketNumber($n->getStringValue()),\n 'ticketSystem' => fn(ParseNode $n) => $o->setTicketSystem($n->getStringValue()),\n 'type' => fn(ParseNode $n) => $o->setType($n->getStringValue()),\n 'userId' => fn(ParseNode $n) => $o->setUserId($n->getStringValue()),\n ]);\n }", "private function fillArray($array) {\n\t\t$result = array();\n\t\tforeach ($array as $attr => $val) {\n\t\t\t$setMethod = 'set' . ucfirst($attr);\n\t\t\t$returnType = $this->getReturnTypeOfSetMethod($setMethod);\n\t\t\tif ($returnType) {\n\t\t\t\t$result[$attr] = new $returnType(); \n\t\t\t} else {\n\t\t\t\t$result[$attr] = 'abc';\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn $result;\n\t}", "function update_attributes($attributes) {\n\t\t\tif(is_array($attributes)) {\n\t\t \t \t// Test each attribute to be updated\n\t\t \t \t// and process according to its type\n\t\t\t\tforeach($attributes as $field => $value) {\n\t\t\t\t\t# datetime / date parts check\n\t\t\t\t\tif(preg_match('/^\\w+\\(.*i\\)$/i', $field)) {\n\t\t\t\t\t\t// The name of this attribute ends in '(?i)'\n\t\t\t\t\t\t// indicating that it's part of a date or time\n\t\t\t\t\t\t$datetime_field = substr($field, 0, strpos($field, '('));\n\t\t\t\t\t\tif(!in_array($datetime_field, $datetime_fields)) {\n\t\t\t\t\t\t\t$datetime_fields[] = $datetime_field;\n\t\t\t\t\t\t}\n\t\t\t\t\t} elseif(is_object($value) && get_parent_class($value) == __CLASS__ && $this->auto_save_associations) {\n\t\t\t\t\t\t# this elseif checks if first its an object if its parent is ActiveRecord\n\t\t\t\t\t\tif($association_type = $this->get_association_type($field)) {\n\t\t\t\t\t\t\t$this->save_associations[$association_type][] = $value;\n\t\t\t\t\t\t\tif($association_type == \"belongs_to\") {\n\t\t\t\t\t\t\t\t$foreign_key = Inflector::singularize($value->table_name).\"_id\";\n\t\t\t\t\t\t\t\t$this->$foreign_key = $value->id;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} elseif(is_array($value) && $this->auto_save_associations) {\n\t\t\t\t\t\t# this elseif checks if its an array of objects and if its parent is ActiveRecord\n\t\t\t\t\t\tif($association_type = $this->get_association_type($field)) {\n\t\t\t\t\t\t\t$this->save_associations[$association_type][] = $value;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t$this->$field = $value;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t \t \t \t\t// Just a simple attribute, copy it\n\t\t\t\t\t\t$this->$field = $value;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// If any date/time fields were found, assign the\n\t\t\t\t// accumulated values to corresponding attributes\n\t\t\t\tif(count($datetime_fields)) {\n\t\t\t\t\tforeach($datetime_fields as $datetime_field) {\n\t\t\t\t\t\t$datetime_format = '';\n\t\t\t\t\t\t$datetime_value = '';\n\n\t\t\t\t\t\tif($attributes[$datetime_field.'(1i)']\n\t\t\t\t\t\t\t&& $attributes[$datetime_field.'(2i)']\n\t\t\t\t\t\t\t&& $attributes[$datetime_field.'(3i)']) {\n\t\t\t\t\t\t\t$datetime_value = $attributes[$datetime_field.'(1i)']\n\t\t\t\t\t\t\t. '-' . $attributes[$datetime_field.'(2i)']\n\t\t\t\t\t\t\t. '-' . $attributes[$datetime_field.'(3i)'];\n\t\t\t\t\t\t\t$datetime_format = $this->date_format;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t$datetime_value .= ' ';\n\n\t\t\t\t\t\tif($attributes[$datetime_field.'(4i)']\n\t\t\t\t\t\t\t&& $attributes[$datetime_field.'(5i)']) {\n\t\t\t\t\t\t\t$datetime_value .= $attributes[$datetime_field.'(4i)']\n\t\t\t\t\t\t\t. ':' . $attributes[$datetime_field.'(5i)'];\n\t\t\t\t\t\t\t$datetime_format .= ' '.$this->time_format;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif($datetime_value = trim($datetime_value)) {\n\t\t\t\t\t\t\t$datetime_value = date($datetime_format, strtotime($datetime_value));\n\t\t\t\t\t\t\t//error_log('($field) $datetime_field = $datetime_value');\n\t\t\t\t\t\t\t$this->$datetime_field = $datetime_value;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t$this->set_habtm_attributes($attributes);\n\t\t\t}\n\t\t}", "function __set($attr_name, $value) {\n // in $attr_name, replace _ with \" \"\n $attr_name = str_replace('_', ' ', $attr_name);\n $attr_name = ucwords($attr_name);\n $attr_name = str_replace(' ', '', $attr_name);\n $function = \"set$attr_name\";\n //var_dump($function);\n $this->$function($value);\n }", "public function hydrate($data)\n\t{\n\t\tforeach ($data as $attribut => $value)\n\t\t{\n\t\t\t$methode = 'set'.ucfirst($attribut);\n\t\t\tif (is_callable([$this, $methode]))\n\t\t\t{\n\t\t\t\t$this->$methode($value);\n\t\t\t}\n\t\t}\n\t}", "public function __construct($daten = array())\n {\n if ($daten) {\n foreach ($daten as $k => $v) {\n $setterName = 'set' . ucfirst($k);\n // wenn ein ungültiges Attribut übergeben wurde\n // (ohne Setter), ignoriere es\n if (method_exists($this, $setterName)) {\n $this->$setterName($v);\n }\n }\n }\n // $this->setEncoding();\n }", "function set_attrs($attrs)\n {\n foreach($attrs as $key => $value) {\n if ($key == \"meta_name\") { continue; }\n if ($key == \"vocab\") { continue; }\n if ($key == \"text\") { continue; }\n if ($key == \"lang\") { continue; }\n $this->attrs[$key] = $value; \n }\n }", "public function getFieldDeserializers(): array {\n $o = $this;\n return [\n 'clickAction' => fn(ParseNode $n) => $o->setClickAction($n->getStringValue()),\n 'clickDateTime' => fn(ParseNode $n) => $o->setClickDateTime($n->getDateTimeValue()),\n 'id' => fn(ParseNode $n) => $o->setId($n->getStringValue()),\n '@odata.type' => fn(ParseNode $n) => $o->setOdataType($n->getStringValue()),\n 'sourceId' => fn(ParseNode $n) => $o->setSourceId($n->getStringValue()),\n 'uriDomain' => fn(ParseNode $n) => $o->setUriDomain($n->getStringValue()),\n 'verdict' => fn(ParseNode $n) => $o->setVerdict($n->getStringValue()),\n ];\n }", "public function getAttributes()\n {\n return array_merge(\n $this->attributes,\n [\n 'args' => $this->args(),\n 'type' => $this->type(),\n 'resolve' => $this->getResolver(),\n ]\n );\n }", "public function setAttributes(Array $attributes): self\n {\n\t\tforeach($attributes as $k => $v) {\n\t\t\t$this->setAttribute($k, $v);\n\t\t}\n\t\treturn $this;\n\t}", "function set(array $data) {\n\t\tforeach ($data as $key => $value) {\n\t\t\t$this->$key = $value;\n\t\t}\n\t}", "public function getFieldDeserializers(): array {\n $o = $this;\n return array_merge(parent::getFieldDeserializers(), [\n 'additionalInformation' => fn(ParseNode $n) => $o->setAdditionalInformation($n->getStringValue()),\n 'creationDateTime' => fn(ParseNode $n) => $o->setCreationDateTime($n->getDateTimeValue()),\n 'expirationDateTime' => fn(ParseNode $n) => $o->setExpirationDateTime($n->getDateTimeValue()),\n 'referenceKey' => fn(ParseNode $n) => $o->setReferenceKey($n->getStringValue()),\n 'referenceSystem' => fn(ParseNode $n) => $o->setReferenceSystem($n->getStringValue()),\n 'requestorId' => fn(ParseNode $n) => $o->setRequestorId($n->getStringValue()),\n 'requestorName' => fn(ParseNode $n) => $o->setRequestorName($n->getStringValue()),\n 'requestType' => fn(ParseNode $n) => $o->setRequestType($n->getStringValue()),\n 'roleId' => fn(ParseNode $n) => $o->setRoleId($n->getStringValue()),\n 'roleName' => fn(ParseNode $n) => $o->setRoleName($n->getStringValue()),\n 'tenantId' => fn(ParseNode $n) => $o->setTenantId($n->getStringValue()),\n 'userId' => fn(ParseNode $n) => $o->setUserId($n->getStringValue()),\n 'userMail' => fn(ParseNode $n) => $o->setUserMail($n->getStringValue()),\n 'userName' => fn(ParseNode $n) => $o->setUserName($n->getStringValue()),\n ]);\n }", "public function getSetters() {\n $fqsen = $this->fqsen;\n $setters = [];\n $propertiesPropertyFound = false;\n do {\n //var_dump($fqsen);\n $class = $this->fqsenToClass($fqsen);\n $methods = $class->getMethods();\n foreach ($methods as $method) {\n if (preg_match('/^set([A-Z0-9].*)$/', $method->getName(), $matches) && !array_key_exists($matches[1], $setters)) {\n $setters[lcfirst($matches[1])] = null;\n }\n }\n if (!$propertiesPropertyFound) {\n $properties = $this->classGetProperty($class, \"properties\");\n if ($properties) {\n $properties = $properties->getDefault();\n $properties = $this->arrayTokenScanner->scan($properties);\n foreach ($properties as $propertyKey => $propertyValue) {\n if (!array_key_exists($propertyKey, $setters)) {\n $setters[$propertyKey] = $propertyValue;\n }\n }\n $propertiesPropertyFound = true;\n }\n }\n $fqsen = strval($class->getParent());\n } while ($fqsen);\n return $setters;\n }", "public function getFieldDeserializers(): array {\n $o = $this;\n return array_merge(parent::getFieldDeserializers(), [\n 'activityGroupNames' => function (ParseNode $n) {\n $val = $n->getCollectionOfPrimitiveValues();\n if (is_array($val)) {\n TypeUtils::validateCollectionValues($val, 'string');\n }\n /** @var array<string>|null $val */\n $this->setActivityGroupNames($val);\n },\n 'address' => fn(ParseNode $n) => $o->setAddress($n->getStringValue()),\n 'azureSubscriptionId' => fn(ParseNode $n) => $o->setAzureSubscriptionId($n->getStringValue()),\n 'azureTenantId' => fn(ParseNode $n) => $o->setAzureTenantId($n->getStringValue()),\n 'countHits' => fn(ParseNode $n) => $o->setCountHits($n->getIntegerValue()),\n 'countHosts' => fn(ParseNode $n) => $o->setCountHosts($n->getIntegerValue()),\n 'firstSeenDateTime' => fn(ParseNode $n) => $o->setFirstSeenDateTime($n->getDateTimeValue()),\n 'ipCategories' => fn(ParseNode $n) => $o->setIpCategories($n->getCollectionOfObjectValues([IpCategory::class, 'createFromDiscriminatorValue'])),\n 'ipReferenceData' => fn(ParseNode $n) => $o->setIpReferenceData($n->getCollectionOfObjectValues([IpReferenceData::class, 'createFromDiscriminatorValue'])),\n 'lastSeenDateTime' => fn(ParseNode $n) => $o->setLastSeenDateTime($n->getDateTimeValue()),\n 'riskScore' => fn(ParseNode $n) => $o->setRiskScore($n->getStringValue()),\n 'tags' => function (ParseNode $n) {\n $val = $n->getCollectionOfPrimitiveValues();\n if (is_array($val)) {\n TypeUtils::validateCollectionValues($val, 'string');\n }\n /** @var array<string>|null $val */\n $this->setTags($val);\n },\n 'vendorInformation' => fn(ParseNode $n) => $o->setVendorInformation($n->getObjectValue([SecurityVendorInformation::class, 'createFromDiscriminatorValue'])),\n ]);\n }", "public function getFieldDeserializers(): array {\n $o = $this;\n return array_merge(parent::getFieldDeserializers(), [\n 'subscriptionId' => fn(ParseNode $n) => $o->setSubscriptionId($n->getStringValue()),\n 'subscriptionName' => fn(ParseNode $n) => $o->setSubscriptionName($n->getStringValue()),\n ]);\n }", "public function setAttributes ($attributes)\n {\n\n $this->attributes = array_merge($this->attributes, $attributes);\n\n }", "public function getFieldDeserializers(): array {\n $o = $this;\n return array_merge(parent::getFieldDeserializers(), [\n 'email' => fn(ParseNode $n) => $o->setEmail($n->getStringValue()),\n 'identity' => fn(ParseNode $n) => $o->setIdentity($n->getObjectValue([CommunicationsUserIdentity::class, 'createFromDiscriminatorValue'])),\n 'presenterDetails' => fn(ParseNode $n) => $o->setPresenterDetails($n->getObjectValue([VirtualEventPresenterDetails::class, 'createFromDiscriminatorValue'])),\n ]);\n }", "public function setAttributes(array $attributes, $merge = false);", "public function copyAttributesToValues()\n\t{\n\t\tforeach( $this->values as $field=>$value )\n\t\t{\n\t\t\t$this->values[$field] = $this->$field ;\n\t\t}\n\t}", "protected function castAttributes(array $fields): void\n {\n // Loops through all the supplied Field's list.\n foreach ($fields as $field => $value) {\n // Builds up the Mutator's name.\n $mutator = $this->createMutatorName(self::$CASTPREFIX, $field);\n\n // Checks if the mutator exists in the instance, and if so, loads the value into it.\n if (\\array_search($mutator, $this->castList) !== false) {\n $this->{$mutator}($value);\n }\n }\n }", "public function set_attributes( $attributes = array(), $override = true ) {\n\t\n\t\tif ( true == $override ) {\n\t\t\t$this->attributes = array_merge( $this->attributes, $attributes );\n\t\t}\n\t\telse {\n\t\t\t$this->attributes = array_merge( $attributes, $this->attributes );\n\t\t}\n\t\n\t}", "public function testSetters()\n {\n foreach ($this->expectedSetters as $method => $parameter) {\n $this->entity->$method($parameter);\n }\n\n $actualResult = $this->entity->toArray();\n\n $this->assertArraysAreSimilar($this->testData, $actualResult, 'toArray');\n }", "public function setAttributes($values, $safeOnly = true){\n $params = $this->limpiarParametrosConEspacios($values);\n parent::setAttributes($params, $safeOnly);\n $this->barrio = strtolower($this->barrio);\n $this->calle = strtolower($this->calle);\n }", "abstract protected function getDirectGetters();", "public function getCustomAttributes() {}" ]
[ "0.680262", "0.66679907", "0.6505545", "0.64688873", "0.64688873", "0.64688873", "0.64303744", "0.63683504", "0.63627255", "0.63459826", "0.63396704", "0.61683947", "0.61683947", "0.61683947", "0.61683947", "0.61683947", "0.61683947", "0.61683947", "0.61683947", "0.61683947", "0.61683947", "0.61683947", "0.61683947", "0.61683947", "0.61455905", "0.6124729", "0.60965043", "0.6064889", "0.60280144", "0.59300935", "0.5861647", "0.5857414", "0.583125", "0.58289456", "0.5802956", "0.57730716", "0.5769649", "0.57669306", "0.57439446", "0.57416034", "0.5712461", "0.5712227", "0.5712227", "0.5712227", "0.5712227", "0.5712227", "0.5712227", "0.5693902", "0.5689162", "0.5666289", "0.5662849", "0.5661436", "0.563428", "0.5614137", "0.56094044", "0.56041044", "0.5598898", "0.5598898", "0.5595137", "0.557315", "0.5562302", "0.55468214", "0.55468214", "0.5544497", "0.554371", "0.5530686", "0.5527515", "0.55244553", "0.5513968", "0.5511702", "0.5510402", "0.5506593", "0.55063456", "0.550503", "0.55007327", "0.54983866", "0.5498155", "0.5491734", "0.5489885", "0.5485283", "0.547875", "0.54760724", "0.5474538", "0.54676914", "0.54661655", "0.5464422", "0.54623854", "0.54590654", "0.5444538", "0.54367185", "0.54365623", "0.5433229", "0.54249495", "0.5423897", "0.54130095", "0.5410177", "0.54087967", "0.5407178", "0.5403355", "0.5403267", "0.5402394" ]
0.0
-1
Array of attributes to getter functions (for serialization of requests)
public static function getters() { return self::$getters; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getAttributes(): array\n {\n // Get all attributes using all the getters.\n $attributes = [];\n foreach(\\array_keys(\\get_object_vars($this)) as $attribute) {\n\n // Construct the getter name.\n $getter = \\lcfirst(\\str_replace('_', '', \\ucwords($attribute, '_')));\n\n // Get the attribute's value from the getter.\n $attributes[$attribute] = $this->{$getter}();\n }\n\n return $attributes;\n }", "abstract protected function getDirectGetters();", "public function toArray() {\n $attrs = $this->_private_attributes;\n $result = array();\n foreach ($attrs as $key => $attr) {\n if (method_exists($this, \"get\" . underscore_to_camel_case($key, true))) {\n eval('$result[\"' . $key . '\"] = $this->get' . underscore_to_camel_case($key, true) . '();');\n } else {\n $result[$key] = $attr;\n }\n }\n return $result;\n }", "public function getAttributes(): array;", "public function getAttributes(): array;", "public function getAttributes(): array;", "public function getAttributes(): array;", "abstract function attributes(): array;", "public static function getters();", "public static function getters()\n {\n return [\n 'status' => 'getStatus',\n 'quota' => 'getQuota'\n ];\n }", "public static function getters()\n {\n return [\n 'status' => 'getStatus',\n 'time' => 'getTime'\n ];\n }", "public function getAttributes();", "public function getAttributes();", "public function getAttributes();", "public function getAttributes();", "public function getAttributes();", "public function getAttributes();", "public function getAttributes();", "public function getAttributes();", "public function getAttributes();", "public function getAttributes(){ }", "public function getAttributes() {}", "public function getAttributes() {}", "public function attributes() : array;", "public function getAttributes()\n {\n }", "function getAttributes()\n {\n }", "public function getCustomAttributes(): array;", "protected function getAttributeSavedMethods()\n {\n $attributes = [];\n foreach($this->getDirty() as $attribute => $value) {\n if($this->hasAttributeSavedMethod($attribute)) {\n $attributes[] = $attribute;\n }\n }\n return $attributes;\n }", "public static function attributes()\n {\n $class = self::loadDelegationClass();\n \n return call_user_func($class.'::attributes');\n }", "public function getAttributes(): iterable;", "public static function getters()\n {\n return parent::getters() + self::$getters;\n }", "public static function getters()\n {\n return parent::getters() + self::$getters;\n }", "public static function getters()\n {\n return parent::getters() + self::$getters;\n }", "public static function getters()\n {\n return parent::getters() + self::$getters;\n }", "public static function getters()\n {\n return parent::getters() + self::$getters;\n }", "public static function getters()\n {\n return parent::getters() + self::$getters;\n }", "public static function getters()\n {\n return parent::getters() + self::$getters;\n }", "public static function getters()\n {\n return parent::getters() + self::$getters;\n }", "public static function getters()\n {\n return parent::getters() + self::$getters;\n }", "public static function getters()\n {\n return parent::getters() + self::$getters;\n }", "public static function getters()\n {\n return parent::getters() + self::$getters;\n }", "public static function getters()\n {\n return parent::getters() + self::$getters;\n }", "public static function getters()\n {\n return parent::getters() + self::$getters;\n }", "public static function getters()\n {\n return [\n 'tenant_id' => 'getTenantId',\n 'expires_in' => 'getExpiresIn',\n 'scopes' => 'getScopes'\n ];\n }", "public static function getters()\n {\n return [\n 'application_id' => 'getApplicationId',\n 'is_default' => 'getIsDefault',\n 'role' => 'getRole',\n 'type' => 'getType',\n '_issues' => 'getIssues'\n ];\n }", "public function getCustomAttributes() {}", "public static function getters() : array\n {\n return self::$getters;\n }", "public static function getters() : array\n {\n return self::$getters;\n }", "public static function getters() : array\n {\n return self::$getters;\n }", "public static function getters() : array\n {\n return self::$getters;\n }", "public static function getters() : array\n {\n return self::$getters;\n }", "public static function getters() : array\n {\n return self::$getters;\n }", "public static function attributeMap();", "public function attributes();", "public function get_attributes()\n {\n }", "public function get_attributes()\n {\n }", "protected function getAttributes()\n {\n return [];\n }", "public function getRestHookableAttributes(): array\n {\n return [];\n }", "public function getAttributes() {\n $attr = array();\n \n $attr[\"id\"] = $this->id_;\n $attr[\"taxonId\"] = $this->taxonId_;\n $attr[\"dbh\"] = $this->dbh_;\n $attr[\"lat\"] = $this->lat_;\n $attr[\"lng\"] = $this->lng_;\n $attr[\"layers\"] = $this->layers_;\n \n return $attr;\n }", "public function getData ()\n {\n\n $data = [];\n\n foreach ($this as $key => $value) {\n\n $method = 'get' . ucfirst(camel_case($key));\n\n if (method_exists($this, $method)) {\n\n $data[$key] = $this->{$method}();\n\n }\n\n }\n\n $data['request_data'] = $this->hideProtectedFields($data['request_data']);\n\n return $data;\n }", "public function attributes(): array\n {\n return [\n //\n ];\n }", "public function attributes(): array\n {\n return [\n //\n ];\n }", "protected function attributes() {\n\t $attributes = array();\n\t foreach(static::$table_fields as $field) {\n\t if(property_exists( $this, $field)) {\n\t $attributes[$field] = $this->$field;\n\t }\n\t }\n\t return $attributes;\n }", "public function getAttributes()\n {\n return array_merge(\n $this->attributes,\n [\n 'args' => $this->args(),\n 'type' => $this->type(),\n 'resolve' => $this->getResolver(),\n ]\n );\n }", "public function getAttributes()\n {\n return array();\n }", "public function getAttributes()\n {\n return array();\n }", "public function getAttributes()\n {\n return array();\n }", "public function getAttributes()\n {\n return array();\n }", "abstract public function attributeNames();", "abstract protected function attributes();", "public function __get($method)\n\t{\n\t\treturn array($this, $method);\t\t\n\t}", "public function attr() {\n\t\treturn utils::attr($this->attr, func_get_args());\n\t}", "function GetAttributes();", "protected function attributes() {\n $attributes = array();\n foreach(static::$db_fields as $field) {\n if(property_exists($this, $field)) {\n $attributes[$field] = $this->$field;\n }\n }\n return $attributes;\n }", "public function getGetterNames(): array\n {\n return [['document'], ['documentManager']];\n }", "public function getAttributes() {\n return array_merge($this->getFields(), $this->getProperties());\n }", "abstract protected function setRequiredGetters();", "public function getAttributeList(): array;", "private function getApiAttributeNamesArray()\n {\n $array = [\n 'firstname',\n 'lastname',\n 'email',\n 'id',\n 'website_id',\n 'group_id',\n 'prefix',\n 'middlename',\n 'suffix',\n 'dob',\n 'taxvat',\n 'gender',\n 'is_active',\n 'company',\n 'city',\n 'country_id',\n 'region',\n 'postcode',\n 'telephone',\n 'fax',\n 'vat_id',\n 'street_1',\n 'street_2',\n 'subaccounts',\n 'manage_subaccounts',\n 'account_data_modification_permission',\n 'account_order_history_view_permission',\n 'checkout_order_create_permission',\n 'checkout_order_approval_permission',\n 'checkout_cart_view_permission',\n 'checkout_view_permission',\n 'checkout_order_placed_notification_permission',\n 'force_usage_parent_company_name_permission',\n 'force_usage_parent_vat_permission',\n 'force_usage_parent_addresses_permission',\n 'password',\n 'parent_email',\n 'promote',\n 'can_manage_subaccounts',\n ];\n\n return $array;\n }", "public function getAttributesFields(): array\n {\n $fields = [];\n\n // Only fields without relations\n foreach ($this->fieldsArray(false) as $attribute) {\n $fields[$attribute] = [\n 'name' => $attribute,\n 'type' => $this->overrideMethod(\n 'set'.Str::studly($attribute).'Type',\n [$this, 'callGraphQLType'],\n $attribute\n ),\n 'privacy' => function (array $args) use ($attribute): bool {\n $method = 'get'.Str::studly($attribute).'Privacy';\n\n return $this->$method($args);\n },\n ];\n }\n\n return $fields;\n }", "public function serializers()\n {\n // Each entry represents a function call.\n return array(\n // Each entry represents an argument for the function call.\n array(new \\Nayru\\Serializer\\JsonConf),\n array(new \\Nayru\\Serializer\\Php)\n );\n }", "protected function attributes() {\n\t\t$attributes = array();\n\t\tforeach(self::$db_fields as $field) {\n\t\t\tif(property_exists($this, $field)){\n\t\t\t\t$attributes[$field] = $this->$field;\n\t\t\t}\n\t\t}\n\t\treturn $attributes;\n\t}", "public function getAttributesList()\n {\n }", "public function attributes()\n {\n $attributes = array();\n foreach(self::$db_fields as $field)\n {\n if(property_exists($this,$field))\n {\n $attributes[$field] = $this->$field;\n }\n }\n return $attributes;\n }", "public function attributes()\n {\n return [];\n }", "public function attributes()\n {\n return [];\n }", "public function attributes()\n {\n return [];\n }", "public function get(...$keys)\n {\n if (count($keys) == 1 && trait_exists($keys[0])) {\n $trait = new ReflectionClass($keys[0]);\n $keys = collect(array_merge($trait->getProperties(), $trait->getMethods()))->map(function ($reflect) {\n // Looking for abstract public or public methods or properties.\n if (\n $reflect->getModifiers() != ReflectionMethod::IS_PUBLIC\n && $reflect->getModifiers() != ReflectionMethod::IS_PUBLIC + ReflectionMethod::IS_ABSTRACT\n ) {\n return;\n }\n\n return $reflect->name;\n })->filter()->toArray();\n }\n $attributes = [];\n\n foreach ($keys as $key) {\n $attributes[$key] = $this->getAttribute($key);\n }\n\n return collect($attributes);\n }", "private function requestedAttributes()\n {\n\n $default = [\n 'id',\n 'name',\n 'level',\n 'rarity',\n 'image',\n 'category.0',\n 'category.1',\n 'vendor_price',\n 'buy.quantity',\n 'buy.price',\n 'buy.last_change.time',\n 'buy.last_change.quantity',\n 'buy.last_change.price',\n 'sell.quantity',\n 'sell.price',\n 'sell.last_change.time',\n 'sell.last_change.quantity',\n 'sell.last_change.price',\n 'last_update'\n ];\n\n $requested = $this->getInput('attributes') ?: $default;\n\n if (!is_array($requested)) {\n $requested = explode(',', $requested);\n }\n\n return $requested;\n\n }", "protected function attributes() {\n\t $attributes = array();\n\t foreach(self::$db_fields as $field) {\n\t if(property_exists($this, $field)) {\n\t $attributes[$field] = $this->$field;\n\t }\n\t }\n\t return $attributes;\n\t}", "public function getMethods(): array;", "public function getMethods(): array;", "protected function attributes() {\n\t\t$attributes = array();\n\t\tforeach (self::$db_fields as $field) {\n\t\t\tif (property_exists($this, $field)) {\n\t\t\t\t$attributes[$field] = $this->$field;\n\t\t\t}\n\t\t}\n\t\treturn $attributes;\n\t}", "function read(){\n foreach($this as $attribute => $valor){\n $this->$attribute = Request::read($attribute);\n } \n }", "protected function attributes()\n {\n return [];\n }", "public function getAttributes()\n {\n $return = [];\n foreach ($this->attr as $attr => $info) {\n $return[$attr] = $this->getAttribute($attr);\n }\n\n return $return;\n }", "public function __get($attr)\n\t{\n\t\t$functionName = \"get\".$attr;\n\t\treturn $this->$functionName();\n\t}", "public function getFieldDeserializers(): array {\n $o = $this;\n return [\n 'clickAction' => fn(ParseNode $n) => $o->setClickAction($n->getStringValue()),\n 'clickDateTime' => fn(ParseNode $n) => $o->setClickDateTime($n->getDateTimeValue()),\n 'id' => fn(ParseNode $n) => $o->setId($n->getStringValue()),\n '@odata.type' => fn(ParseNode $n) => $o->setOdataType($n->getStringValue()),\n 'sourceId' => fn(ParseNode $n) => $o->setSourceId($n->getStringValue()),\n 'uriDomain' => fn(ParseNode $n) => $o->setUriDomain($n->getStringValue()),\n 'verdict' => fn(ParseNode $n) => $o->setVerdict($n->getStringValue()),\n ];\n }", "public function attributes()\n {\n return [\n ];\n }", "public function attributes() // atribūtu savi nosaukumi\n {\n return[ \n 'fname' => 'Vārds',\n 'lname' => 'Uzvārds',\n 'email' => 'E-pasts',\n 'oldpassword' => 'Paroles lauks',\n 'password' => 'Jaunas paroles lauks',\n 'buttontitle' => 'Pogas virsraksts',\n 'buttonlink' => 'Pogas links',\n 'reciever' => 'Saņēmēju lauks',\n 'emailtitle' => 'Ziņas virsrsksts',\n 'emailtext' => 'Ziņas teksts',\n 'transport' => 'Pasākumu lauks'\n ];\n }", "public static function attributeMap()\n {\n return [\n 'tenant_id' => 'tenant_id',\n 'expires_in' => 'expires_in',\n 'scopes' => 'scopes'\n ];\n }" ]
[ "0.7070234", "0.6627022", "0.65801674", "0.65076286", "0.65076286", "0.65076286", "0.65076286", "0.6498677", "0.64615417", "0.6363616", "0.6362736", "0.6314284", "0.6314284", "0.6314284", "0.6314284", "0.6314284", "0.6314284", "0.6314284", "0.6314284", "0.6314284", "0.6286047", "0.62659335", "0.62658304", "0.62470484", "0.624011", "0.62347573", "0.6230029", "0.6217054", "0.61661315", "0.61575836", "0.6048199", "0.6048199", "0.6048199", "0.6048199", "0.6048199", "0.6048199", "0.6048199", "0.6048199", "0.6048199", "0.6048199", "0.6048199", "0.6048199", "0.6048199", "0.6047474", "0.60464036", "0.60251856", "0.5951099", "0.5951099", "0.5951099", "0.5951099", "0.5951099", "0.5951099", "0.5948768", "0.5931767", "0.591954", "0.591954", "0.5888047", "0.5882809", "0.585342", "0.5848253", "0.5834843", "0.5834843", "0.5828625", "0.58102846", "0.5796245", "0.5796245", "0.5796245", "0.5796245", "0.5782786", "0.5782525", "0.5781259", "0.5778489", "0.5774965", "0.5758655", "0.5758319", "0.57520235", "0.5742361", "0.5742195", "0.5735446", "0.5733875", "0.57169795", "0.5710171", "0.57080454", "0.5701639", "0.5686983", "0.5686983", "0.5686983", "0.568664", "0.56854177", "0.5681816", "0.56795955", "0.56795955", "0.56730044", "0.5671193", "0.5665655", "0.5661421", "0.5656963", "0.5637643", "0.5618051", "0.5617487", "0.561508" ]
0.0
-1
The original name of the model.
public function getModelName() { return self::$swaggerModelName; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getOriginalName(): string\n {\n return $this->originalName;\n }", "public function getOriginalName(): string\n {\n\t\treturn $this->originalName;\n\t}", "public function getOriginalName();", "protected function getModelName()\n {\n $fullyQualifiedClassName = substr(static::class, 0, -10); // \\App\\Repositories\\{name}Repository => \\App\\Repositories\\{name}\n $nameArray = explode('\\\\', $fullyQualifiedClassName); // [App, Repositories, {name}]\n return array_pop($nameArray); // {name}\n }", "private function getModelName() : string\n {\n return collect(explode('\\\\', get_class($this)))->last();\n }", "public function getOrigName()\n\t{\n\t\treturn $this->orig_name;\n\t}", "public function getName()\n {\n return empty($this->model->name) ? $this->id : $this->model->name;\n }", "private function getModelName()\n {\n $function = new \\ReflectionClass( $this->model ); \n return $function->getShortName();\n }", "public function modelName(): string\n {\n return class_basename($this->model);\n }", "public function getModelName() {\n\t\treturn $this->getSourceName();\n\t}", "protected function getModelName()\n {\n return ucwords(str_singular(camel_case($this->meta['table'])));\n }", "protected function get_model_name()\n {\n }", "public function getModelName()\n {\n return $this->getModel()->name;\n }", "public function getName()\r\n\t{\r\n\t\treturn $this->_modelName;\r\n\r\n\t}", "public function getModelName()\n {\n if (!$name = $this->modelName) {\n $tableName = $this->getName();\n\n $modelNames = [];\n foreach (explode('_', $tableName) as $word) {\n $modelNames[] = ucfirst(Inflector::singularize($word));\n } //foreach\n $modelName = implode('', $modelNames);\n\n $this->setModelName($name = ucfirst($this->isReservedPHPWord($modelName) ? $tableName : $modelName));\n } // if\n\n return $name;\n }", "public function getModelName() ;", "public function getNomeOriginal()\n {\n return $this->nome_original;\n }", "public function getModelName();", "public static function getNameModel()\n {\n return Yii::t('app', 'My model');\n }", "protected function modelClassName()\n {\n if (!$this->isValidModelName()) return null;\n\n return str_replace('{model}', $this->modelName, $this->modelPath);\n }", "public function getRealName() {\n\t\treturn $this->name;\n\t}", "public static function getModelName() {\r\n\t\t\treturn static::ModelName;\r\n\t\t}", "public function getRealName()\n {\n\treturn $this->name;\n }", "public function getOriginalQualifiedName() {}", "public function getOriginalQualifiedName() {}", "protected function name() {\n\t\treturn strtolower(str_replace('\\\\', '_', get_class($this)));\n\t}", "public function getModelName()\n {\n return self::$axerveModelName;\n }", "public function getRawName()\n {\n return $this->rawName;\n }", "protected function getCrudName(): string\n {\n return strtolower(Str::plural(class_basename($this->option('model'))));\n }", "protected function getNameInput()\n {\n return Str::singular(parent::getNameInput());\n }", "public function getOriginalClassName(): string\n {\n return $this->originalClassName;\n }", "public function getModelSingular()\n {\n return strtolower($this->getModelSimpleName());\n }", "public function getOriginalLabel()\n {\n return $this->originalLabel;\n }", "public function getNameAttribute()\n {\n return $this->translateOrNew($this->locale())->name;\n }", "public function getNameAttribute()\n {\n return $this->translateOrNew($this->locale())->name;\n }", "public function getModelSimpleName()\n {\n return end(explode('\\\\', $this->modelName));\n }", "public function getOriginalQualifiedName();", "public function getRealName()\n\t{\n\t\treturn $this->real_name;\n\t}", "public function getModelNameBasedOnClassName(): string\n {\n $fqn = explode(\"\\\\\", get_class($this));\n\n return strtolower(end($fqn));\n }", "public function getModelName()\n {\n return $this->getConfig()->modelName;\n }", "public function getSingularModelName()\n {\n\n return strtolower(class_basename($this->model));\n }", "public function getModelName()\n {\n return self::$modelName;\n }", "private function getPropertyName(): string\n {\n $name = $this->foreignKey->getLocalTableName();\n if ($this->hasLocalUniqueIndex()) {\n $name = TDBMDaoGenerator::toSingular($name);\n }\n return TDBMDaoGenerator::toCamelCase($name);\n }", "public function getTranslationModelName(): string\n {\n return rtrim(app('locale')->translationNamespace(), '\\\\')\n . '\\\\' . class_basename(get_called_class()) . 'Translation';\n }", "public function name()\n {\n return $this->getName();\n }", "public function name()\n {\n return $this->getName();\n }", "protected function getShortModel(): string\n {\n return class_basename($this->option('model'));\n }", "public function getRealName() {}", "private function guessName () : string {\n return $this->inflector()->pluralize($this->inflector()->tableize(class_basename($this)));\n }", "abstract protected function getModelName(): string;", "public function getModel()\n\t{\n\t\treturn $this->resource->name;\n\t}", "protected function getTypeName(): string\n {\n if (isset($this->typeName)) {\n return $this->typeName;\n }\n\n return $this->getModelNameBasedOnClassName();\n }", "public function getModelName() : string\n {\n return self::$openAPIModelName;\n }", "public function getModelName() : string\n {\n return self::$openAPIModelName;\n }", "public function getModelName() : string\n {\n return self::$openAPIModelName;\n }", "public function getModelName() : string\n {\n return self::$openAPIModelName;\n }", "public function getModelName() : string\n {\n return self::$openAPIModelName;\n }", "public function getModelName() : string\n {\n return self::$openAPIModelName;\n }", "public function getName()\n\t{\n\t\treturn $this->neoeloquent->getConfigOption('name');\n\t}", "public function getModelClassName()\n {\n \treturn $this->modelClassName;\n }", "protected function filterName(): string\n {\n return Str::snake(class_basename($this));\n }", "public function getName() {\n $path = explode('\\\\', get_class($this->object[\"data\"]));\n return array_pop($path);\n }", "public function getName()\n {\n return $this->attributes->name;\n }", "public function name() {\n\t\treturn $this->name;\n\t}", "public function get_name() {\n return $this->name;\n }", "protected function getNameInput()\n {\n $model = $this->option('model') ? $this->option('model') : $this->argument('model');\n\n $dir = $this->option('dir');\n if (strlen($dir) && !Str::endsWith($dir, DIRECTORY_SEPARATOR)) {\n $dir .= DIRECTORY_SEPARATOR;\n }\n\n return (strlen($dir) ? $dir : 'Models/') . $model;\n }", "public function getNewName()\n {\n return $this->newName;\n }", "public function get_name() {\n\t\treturn $this->name;\n\t}", "public function get_name() {\n\t\treturn $this->name;\n\t}", "public function get_name() {\n\t\treturn $this->name;\n\t}", "public function get_name() {\n\t\treturn $this->name;\n\t}", "function __toString()\r\n\t{\r\n\t\treturn ucfirst($this->model);\r\n\t}", "public static function modelName()\n {\n // strip namespacing\n $paths = explode('\\\\', get_called_class());\n\n return end($paths);\n }", "public function get_name() {\n\n\t\treturn $this->name;\n\t}", "public function get_name() {\r\n\t\treturn '';\r\n\t}", "public function name() {\n return $this->name;\n }", "public function get_name()\n {\n\n return $this->name;\n }", "public function name()\n {\n if (isset($this->attributes[self::NAME])) {\n return $this->attributes[self::NAME];\n }\n\n return $this->path();\n }", "public function name()\n {\n $name = get_class($this);\n\n return substr($name, strrpos($name, '\\\\') + 1);\n }", "function get_name () {\n return $this -> name;\n }", "public function get_name() {\n return $this->_name;\n }", "public function get_name() {\r\n return $this->name;\r\n }", "protected function getNameInput()\n {\n $this->model = trim($this->argument('name'));\n return $this->model . 'Controller';\n }", "public function get_name()\n {\n return $this->name;\n }", "public function get_name()\n {\n return $this->name;\n }", "public function getModelName() : string\n {\n $config_key = 'scheduleable.repositories.' . snake_case(class_basename(static::class)) . '.model_class';\n return config($config_key);\n }", "public function getSingularName()\n {\n return rtrim($this->name, 's');\n }", "public function getOriginalModel()\n {\n return $this->originalModel;\n }", "public function getName()\n {\n return $this->internalName;\n }", "public function getName() {\n return $this->__name;\n }", "public function get_name()\n\t{\n\t\treturn $this->name;\n\t}", "public function name()\n\t{\n\t\treturn $this->name;\n\t}", "public function name()\n\t{\n\t\treturn $this->name;\n\t}", "public function name()\n\t{\n\t\treturn $this->name;\n\t}", "public function name()\n {\n return $this->name;\n }", "public function name()\n {\n return $this->name;\n }", "public function name()\n {\n return $this->name;\n }", "public function name()\n {\n return $this->name;\n }", "public function name()\n {\n return $this->name;\n }", "public function name()\n {\n return $this->name;\n }", "public function name()\n {\n return $this->name;\n }" ]
[ "0.8051171", "0.80107665", "0.7829159", "0.763725", "0.7625556", "0.7594126", "0.75220734", "0.75203615", "0.7520026", "0.74983907", "0.74457127", "0.7406896", "0.7395408", "0.7392189", "0.7380455", "0.73451596", "0.7309523", "0.7268473", "0.72646457", "0.7194995", "0.7167137", "0.71553016", "0.7140629", "0.71194506", "0.71194506", "0.7116858", "0.7109867", "0.7099409", "0.70911926", "0.7072344", "0.7059802", "0.7051722", "0.70447934", "0.7024198", "0.7024198", "0.7021268", "0.7020034", "0.6969556", "0.69690603", "0.6946308", "0.6930546", "0.68827796", "0.6880001", "0.6872213", "0.6870931", "0.6870931", "0.6865482", "0.68314034", "0.68245137", "0.681967", "0.681544", "0.68117666", "0.68043435", "0.68043435", "0.68043435", "0.68043435", "0.68043435", "0.68043435", "0.6801664", "0.68013585", "0.6791115", "0.6768164", "0.67647326", "0.6763626", "0.67618877", "0.67585194", "0.67581475", "0.6756782", "0.6756782", "0.6756782", "0.6756782", "0.67544204", "0.67522943", "0.67437685", "0.67366743", "0.6730203", "0.6721843", "0.6716729", "0.6713311", "0.6710085", "0.67037696", "0.6701496", "0.66909015", "0.66899174", "0.66899174", "0.66834587", "0.66795844", "0.6674899", "0.6672843", "0.66700023", "0.66612804", "0.6657571", "0.6657571", "0.6657571", "0.6653286", "0.6653286", "0.6653286", "0.6653286", "0.6653286", "0.6653286", "0.6653286" ]
0.0
-1
Show all the invalid properties with reasons.
public function listInvalidProperties() { $invalidProperties = []; return $invalidProperties; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function listInvalidProperties();", "public function listInvalidProperties()\n {\n $invalid_properties = parent::listInvalidProperties();\n\n return $invalid_properties;\n }", "public function listInvalidProperties() {\n\n $invalidProperties = [];\n\n /*\n * Any needed validation goes here. If a property requires no validation\n * (e.g. it's OK for it to be empty) then it may be omitted.\n */\n\n return $invalidProperties;\n }", "public function listInvalidProperties()\n {\n $invalid_properties = array();\n return $invalid_properties;\n }", "public function listInvalidProperties()\n {\n $invalid_properties = array();\n return $invalid_properties;\n }", "public function listInvalidProperties()\n {\n $invalid_properties = array();\n return $invalid_properties;\n }", "public function listInvalidProperties()\n {\n $invalid_properties = [];\n $allowed_values = [\"CREDIT_CARD\", \"CASH\", \"THIRD_PARTY_CARD\", \"NO_SALE\", \"SQUARE_WALLET\", \"SQUARE_GIFT_CARD\", \"UNKNOWN\", \"OTHER\"];\n if (!in_array($this->container['event_type'], $allowed_values)) {\n $invalid_properties[] = \"invalid value for 'event_type', must be one of #{allowed_values}.\";\n }\n\n $allowed_values = [\"OTHER_BRAND\", \"VISA\", \"MASTERCARD\", \"AMERICAN_EXPRESS\", \"DISCOVER\", \"DISCOVER_DINERS\", \"JCB\", \"CHINA_UNIONPAY\", \"SQUARE_GIFT_CARD\"];\n if (!in_array($this->container['card_brand'], $allowed_values)) {\n $invalid_properties[] = \"invalid value for 'card_brand', must be one of #{allowed_values}.\";\n }\n\n $allowed_values = [\"MANUAL\", \"SCANNED\", \"SQUARE_CASH\", \"SQUARE_WALLET\", \"SWIPED\", \"WEB_FORM\", \"OTHER\"];\n if (!in_array($this->container['entry_method'], $allowed_values)) {\n $invalid_properties[] = \"invalid value for 'entry_method', must be one of #{allowed_values}.\";\n }\n\n return $invalid_properties;\n }", "public function listInvalidProperties()\n {\n $invalidProperties = parent::listInvalidProperties();\n $allowedValues = $this->getStyleIdentifierAllowableValues();\n if (!in_array($this->container['style_identifier'], $allowedValues)) {\n $invalidProperties[] = sprintf(\n \"invalid value for 'style_identifier', must be one of '%s'\",\n implode(\"', '\", $allowedValues)\n );\n }\n\n $allowedValues = $this->getTextEffectAllowableValues();\n if (!in_array($this->container['text_effect'], $allowedValues)) {\n $invalidProperties[] = sprintf(\n \"invalid value for 'text_effect', must be one of '%s'\",\n implode(\"', '\", $allowedValues)\n );\n }\n\n $allowedValues = $this->getUnderlineAllowableValues();\n if (!in_array($this->container['underline'], $allowedValues)) {\n $invalidProperties[] = sprintf(\n \"invalid value for 'underline', must be one of '%s'\",\n implode(\"', '\", $allowedValues)\n );\n }\n\n\n return $invalidProperties;\n }", "public function listInvalidProperties() {\n\t\treturn array();\n\t}", "public function listInvalidProperties()\n {\n $invalid_properties = [];\n return $invalid_properties;\n }", "public function listInvalidProperties()\n {\n $invalid_properties = [];\n return $invalid_properties;\n }", "public function listInvalidProperties()\n {\n $invalidProperties = [];\n\n\n return $invalidProperties;\n }", "public function listInvalidProperties()\n {\n $invalidProperties = [];\n\n\n return $invalidProperties;\n }", "public function listInvalidProperties()\n {\n $invalidProperties = [];\n\n\n return $invalidProperties;\n }", "public function listInvalidProperties()\n {\n $invalidProperties = [];\n\n\n return $invalidProperties;\n }", "public function listInvalidProperties()\n {\n $invalidProperties = [];\n\n\n return $invalidProperties;\n }", "public function listInvalidProperties()\n {\n $invalidProperties = [];\n\n\n return $invalidProperties;\n }", "public function listInvalidProperties()\n {\n return [];\n }", "public function listInvalidProperties()\n {\n $invalidProperties = [];\n\n $allowedValues = $this->getLevelAllowableValues();\n if (!is_null($this->container['level']) && !in_array($this->container['level'], $allowedValues, true)) {\n $invalidProperties[] = sprintf(\n \"invalid value for 'level', must be one of '%s'\",\n implode(\"', '\", $allowedValues)\n );\n }\n\n $allowedValues = $this->getStatusAllowableValues();\n if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) {\n $invalidProperties[] = sprintf(\n \"invalid value for 'status', must be one of '%s'\",\n implode(\"', '\", $allowedValues)\n );\n }\n\n return $invalidProperties;\n }", "public function listInvalidProperties()\n {\n $invalid_properties = [];\n\n return $invalid_properties;\n }", "public function listInvalidProperties()\n {\n $invalid_properties = [];\n\n return $invalid_properties;\n }", "public function listInvalidProperties()\n {\n $invalid_properties = [];\n\n return $invalid_properties;\n }", "public function listInvalidProperties()\n {\n $invalid_properties = [];\n\n return $invalid_properties;\n }", "public function listInvalidProperties()\n {\n $invalid_properties = [];\n\n return $invalid_properties;\n }", "public function listInvalidProperties()\n {\n $invalid_properties = [];\n\n return $invalid_properties;\n }", "public function listInvalidProperties()\n {\n $invalid_properties = [];\n\n return $invalid_properties;\n }", "public function listInvalidProperties()\n {\n $invalid_properties = [];\n\n return $invalid_properties;\n }", "public function listInvalidProperties()\n {\n $invalid_properties = [];\n\n return $invalid_properties;\n }", "public function listInvalidProperties()\n {\n $invalid_properties = [];\n\n return $invalid_properties;\n }", "public function listInvalidProperties()\n {\n $invalid_properties = [];\n\n return $invalid_properties;\n }", "public function listInvalidProperties()\n {\n $invalid_properties = [];\n\n return $invalid_properties;\n }", "public function listInvalidProperties()\n {\n $invalid_properties = [];\n\n return $invalid_properties;\n }", "public function listInvalidProperties()\n {\n $invalid_properties = [];\n\n return $invalid_properties;\n }", "public function listInvalidProperties()\n {\n $invalid_properties = [];\n\n return $invalid_properties;\n }", "public function listInvalidProperties()\n {\n $invalid_properties = [];\n\n return $invalid_properties;\n }", "public function listInvalidProperties()\n {\n $invalid_properties = [];\n\n return $invalid_properties;\n }", "public function listInvalidProperties()\n {\n $invalid_properties = [];\n\n return $invalid_properties;\n }", "public function listInvalidProperties()\n {\n $invalid_properties = [];\n\n return $invalid_properties;\n }", "public function listInvalidProperties()\n {\n $invalid_properties = [];\n\n $allowed_values = $this->getBootOrderAllowableValues();\n if (!in_array($this->container['boot_order'], $allowed_values)) {\n $invalid_properties[] = sprintf(\n \"invalid value for 'boot_order', must be one of '%s'\",\n implode(\"', '\", $allowed_values)\n );\n }\n\n $allowed_values = $this->getFirewallAllowableValues();\n if (!in_array($this->container['firewall'], $allowed_values)) {\n $invalid_properties[] = sprintf(\n \"invalid value for 'firewall', must be one of '%s'\",\n implode(\"', '\", $allowed_values)\n );\n }\n\n $allowed_values = $this->getVideoModelAllowableValues();\n if (!in_array($this->container['video_model'], $allowed_values)) {\n $invalid_properties[] = sprintf(\n \"invalid value for 'video_model', must be one of '%s'\",\n implode(\"', '\", $allowed_values)\n );\n }\n\n $allowed_values = $this->getVncAllowableValues();\n if (!in_array($this->container['vnc'], $allowed_values)) {\n $invalid_properties[] = sprintf(\n \"invalid value for 'vnc', must be one of '%s'\",\n implode(\"', '\", $allowed_values)\n );\n }\n\n return $invalid_properties;\n }", "public function listInvalidProperties()\n {\n $invalidProperties = parent::listInvalidProperties();\n\n return $invalidProperties;\n }", "public function listInvalidProperties()\n {\n $invalidProperties = parent::listInvalidProperties();\n\n return $invalidProperties;\n }", "public function listInvalidProperties()\n {\n $invalidProperties = parent::listInvalidProperties();\n\n return $invalidProperties;\n }", "public function listInvalidProperties()\n {\n $invalidProperties = parent::listInvalidProperties();\n\n return $invalidProperties;\n }", "public function listInvalidProperties()\n {\n $invalidProperties = parent::listInvalidProperties();\n\n return $invalidProperties;\n }", "public function listInvalidProperties()\n {\n $invalidProperties = parent::listInvalidProperties();\n\n return $invalidProperties;\n }", "public function listInvalidProperties()\r\n {\r\n $invalidProperties = [];\r\n $allowedValues = $this->getTypeAllowableValues();\r\n if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) {\r\n $invalidProperties[] = sprintf(\r\n \"invalid value for 'type', must be one of '%s'\",\r\n implode(\"', '\", $allowedValues)\r\n );\r\n }\r\n\r\n $allowedValues = $this->getStatusAllowableValues();\r\n if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) {\r\n $invalidProperties[] = sprintf(\r\n \"invalid value for 'status', must be one of '%s'\",\r\n implode(\"', '\", $allowedValues)\r\n );\r\n }\r\n\r\n return $invalidProperties;\r\n }", "public function listInvalidProperties()\r\n {\r\n $invalidProperties = [];\r\n $allowedValues = $this->getTypeAllowableValues();\r\n if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) {\r\n $invalidProperties[] = sprintf(\r\n \"invalid value for 'type', must be one of '%s'\",\r\n implode(\"', '\", $allowedValues)\r\n );\r\n }\r\n\r\n $allowedValues = $this->getStatusAllowableValues();\r\n if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) {\r\n $invalidProperties[] = sprintf(\r\n \"invalid value for 'status', must be one of '%s'\",\r\n implode(\"', '\", $allowedValues)\r\n );\r\n }\r\n\r\n return $invalidProperties;\r\n }", "public function listInvalidProperties()\n {\n $invalidProperties = [];\n\n if ($this->container['legalName'] === null) {\n $invalidProperties[] = \"'legalName' can't be null\";\n }\n if ($this->container['registeredAddress'] === null) {\n $invalidProperties[] = \"'registeredAddress' can't be null\";\n }\n $allowedValues = $this->getTypeAllowableValues();\n if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) {\n $invalidProperties[] = sprintf(\n \"invalid value '%s' for 'type', must be one of '%s'\",\n $this->container['type'],\n implode(\"', '\", $allowedValues)\n );\n }\n\n $allowedValues = $this->getVatAbsenceReasonAllowableValues();\n if (!is_null($this->container['vatAbsenceReason']) && !in_array($this->container['vatAbsenceReason'], $allowedValues, true)) {\n $invalidProperties[] = sprintf(\n \"invalid value '%s' for 'vatAbsenceReason', must be one of '%s'\",\n $this->container['vatAbsenceReason'],\n implode(\"', '\", $allowedValues)\n );\n }\n\n return $invalidProperties;\n }", "public function listInvalidProperties()\n {\n $invalidProperties = [];\n\n $allowedValues = $this->getFieldAllowableValues();\n if (!is_null($this->container['field']) && !in_array($this->container['field'], $allowedValues, true)) {\n $invalidProperties[] = sprintf(\n \"invalid value '%s' for 'field', must be one of '%s'\",\n $this->container['field'],\n implode(\"', '\", $allowedValues)\n );\n }\n\n $allowedValues = $this->getOpAllowableValues();\n if (!is_null($this->container['op']) && !in_array($this->container['op'], $allowedValues, true)) {\n $invalidProperties[] = sprintf(\n \"invalid value '%s' for 'op', must be one of '%s'\",\n $this->container['op'],\n implode(\"', '\", $allowedValues)\n );\n }\n\n\n return $invalidProperties;\n }", "public function listInvalidProperties()\n {\n $invalidProperties = [];\n\n if ($this->container['id'] === null) {\n $invalidProperties[] = \"'id' can't be null\";\n }\n if ($this->container['type'] === null) {\n $invalidProperties[] = \"'type' can't be null\";\n }\n $allowedValues = $this->getTypeAllowableValues();\n if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) {\n $invalidProperties[] = sprintf(\n \"invalid value for 'type', must be one of '%s'\",\n implode(\"', '\", $allowedValues)\n );\n }\n\n $allowedValues = $this->getResultAllowableValues();\n if (!is_null($this->container['result']) && !in_array($this->container['result'], $allowedValues, true)) {\n $invalidProperties[] = sprintf(\n \"invalid value for 'result', must be one of '%s'\",\n implode(\"', '\", $allowedValues)\n );\n }\n\n if ($this->container['locale'] === null) {\n $invalidProperties[] = \"'locale' can't be null\";\n }\n return $invalidProperties;\n }", "public function listInvalidProperties()\n {\n $invalidProperties = [];\n\n $allowedValues = $this->getTypeAllowableValues();\n if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) {\n $invalidProperties[] = sprintf(\n \"invalid value for 'type', must be one of '%s'\",\n implode(\"', '\", $allowedValues)\n );\n }\n\n $allowedValues = $this->getCostTypeAllowableValues();\n if (!is_null($this->container['cost_type']) && !in_array($this->container['cost_type'], $allowedValues, true)) {\n $invalidProperties[] = sprintf(\n \"invalid value for 'cost_type', must be one of '%s'\",\n implode(\"', '\", $allowedValues)\n );\n }\n\n return $invalidProperties;\n }", "public function listInvalidProperties()\n {\n $invalidProperties = [];\n return $invalidProperties;\n }", "public function listInvalidProperties()\n {\n $invalidProperties = [];\n return $invalidProperties;\n }", "public function listInvalidProperties()\n {\n $invalidProperties = [];\n return $invalidProperties;\n }", "public function listInvalidProperties()\n {\n $invalidProperties = [];\n return $invalidProperties;\n }", "public function listInvalidProperties()\n {\n $invalidProperties = [];\n\n if ($this->container['overview'] === null) {\n $invalidProperties[] = \"'overview' can't be null\";\n }\n return $invalidProperties;\n }", "public function listInvalidProperties()\r\n {\r\n $invalidProperties = [];\r\n return $invalidProperties;\r\n }", "public function listInvalidProperties()\r\n {\r\n $invalidProperties = [];\r\n return $invalidProperties;\r\n }", "public function listInvalidProperties()\r\n {\r\n $invalidProperties = [];\r\n return $invalidProperties;\r\n }", "public function listInvalidProperties()\r\n {\r\n $invalidProperties = [];\r\n return $invalidProperties;\r\n }", "public function listInvalidProperties()\r\n {\r\n $invalidProperties = [];\r\n return $invalidProperties;\r\n }", "public function listInvalidProperties()\r\n {\r\n $invalidProperties = [];\r\n return $invalidProperties;\r\n }", "public function listInvalidProperties()\r\n {\r\n $invalidProperties = [];\r\n return $invalidProperties;\r\n }", "public function listInvalidProperties()\r\n {\r\n $invalidProperties = [];\r\n return $invalidProperties;\r\n }", "public function listInvalidProperties()\r\n {\r\n $invalidProperties = [];\r\n return $invalidProperties;\r\n }", "public function listInvalidProperties()\r\n {\r\n $invalidProperties = [];\r\n return $invalidProperties;\r\n }", "public function listInvalidProperties()\r\n {\r\n $invalidProperties = [];\r\n return $invalidProperties;\r\n }", "public function listInvalidProperties()\r\n {\r\n $invalidProperties = [];\r\n return $invalidProperties;\r\n }", "public function listInvalidProperties()\r\n {\r\n $invalidProperties = [];\r\n return $invalidProperties;\r\n }", "public function listInvalidProperties()\r\n {\r\n $invalidProperties = [];\r\n return $invalidProperties;\r\n }", "public function listInvalidProperties()\r\n {\r\n $invalidProperties = [];\r\n if ($this->container['text'] === null) {\r\n $invalidProperties[] = \"'text' can't be null\";\r\n }\r\n if ($this->container['textOriginal'] === null) {\r\n $invalidProperties[] = \"'textOriginal' can't be null\";\r\n }\r\n if ($this->container['textNormalised'] === null) {\r\n $invalidProperties[] = \"'textNormalised' can't be null\";\r\n }\r\n if (!is_null($this->container['score']) && ($this->container['score'] > 1E+2)) {\r\n $invalidProperties[] = \"invalid value for 'score', must be smaller than or equal to 1E+2.\";\r\n }\r\n if (!is_null($this->container['score']) && ($this->container['score'] < 0)) {\r\n $invalidProperties[] = \"invalid value for 'score', must be bigger than or equal to 0.\";\r\n }\r\n return $invalidProperties;\r\n }", "public function listInvalidProperties()\n {\n $invalidProperties = [];\n\n $allowedValues = $this->getFraudResultTypeAllowableValues();\n if (!is_null($this->container['fraudResultType']) && !in_array($this->container['fraudResultType'], $allowedValues, true)) {\n $invalidProperties[] = sprintf(\n \"invalid value '%s' for 'fraudResultType', must be one of '%s'\",\n $this->container['fraudResultType'],\n implode(\"', '\", $allowedValues)\n );\n }\n\n $allowedValues = $this->getRecurringProcessingModelAllowableValues();\n if (!is_null($this->container['recurringProcessingModel']) && !in_array($this->container['recurringProcessingModel'], $allowedValues, true)) {\n $invalidProperties[] = sprintf(\n \"invalid value '%s' for 'recurringProcessingModel', must be one of '%s'\",\n $this->container['recurringProcessingModel'],\n implode(\"', '\", $allowedValues)\n );\n }\n\n return $invalidProperties;\n }", "public function listInvalidProperties()\n {\n $invalidProperties = [];\n\n $allowedValues = $this->getStatusAllowableValues();\n if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) {\n $invalidProperties[] = sprintf(\n \"invalid value for 'status', must be one of '%s'\",\n implode(\"', '\", $allowedValues)\n );\n }\n\n $allowedValues = $this->getTypeAllowableValues();\n if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) {\n $invalidProperties[] = sprintf(\n \"invalid value for 'type', must be one of '%s'\",\n implode(\"', '\", $allowedValues)\n );\n }\n\n return $invalidProperties;\n }", "public function listInvalidProperties()\n {\n $invalid_properties = array();\n if ($this->container['name'] === null) {\n $invalid_properties[] = \"'name' can't be null\";\n }\n if ($this->container['type'] === null) {\n $invalid_properties[] = \"'type' can't be null\";\n }\n $allowed_values = array(\"text\", \"range\", \"category\");\n if (!in_array($this->container['type'], $allowed_values)) {\n $invalid_properties[] = \"invalid value for 'type', must be one of #{allowed_values}.\";\n }\n\n if ($this->container['sort_type'] === null) {\n $invalid_properties[] = \"'sort_type' can't be null\";\n }\n $allowed_values = array(\"alphabetical\", \"count\", \"value\", \"size\");\n if (!in_array($this->container['sort_type'], $allowed_values)) {\n $invalid_properties[] = \"invalid value for 'sort_type', must be one of #{allowed_values}.\";\n }\n\n if ($this->container['values'] === null) {\n $invalid_properties[] = \"'values' can't be null\";\n }\n return $invalid_properties;\n }" ]
[ "0.7954126", "0.7814029", "0.7804116", "0.780055", "0.780055", "0.780055", "0.7795368", "0.77933925", "0.7785144", "0.7781625", "0.7781625", "0.77577174", "0.77577174", "0.77577174", "0.77577174", "0.77577174", "0.77577174", "0.7743693", "0.7742531", "0.77358544", "0.77358544", "0.77358544", "0.77358544", "0.77358544", "0.77358544", "0.77358544", "0.77358544", "0.77358544", "0.77358544", "0.77358544", "0.77358544", "0.77358544", "0.77358544", "0.77358544", "0.77358544", "0.77358544", "0.77358544", "0.77358544", "0.7712601", "0.77002573", "0.77002573", "0.77002573", "0.77002573", "0.77002573", "0.77002573", "0.76904494", "0.76904494", "0.7684163", "0.7679419", "0.76636475", "0.76584613", "0.76518965", "0.76518965", "0.76518965", "0.76518965", "0.76423055", "0.763543", "0.763543", "0.763543", "0.763543", "0.763543", "0.763543", "0.763543", "0.763543", "0.763543", "0.763543", "0.763543", "0.763543", "0.763543", "0.763543", "0.76108176", "0.7610424", "0.76066333", "0.7596187" ]
0.0
-1
Validate all the properties in the model return true if all passed
public function valid() { return count($this->listInvalidProperties()) === 0; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function validate(){\n\t\t$valid = true;\n\t\t$ref = new ReflectionObject($this);\n\t\tforeach($ref->getProperties() as $prop){\n\t\t\tif(isset($this->_atributosMetadata[$prop->getName()])){\n\t\t\t\t$propMetadata = $this->_atributosMetadata[$prop->getName()];\n\t\t\t\tif($propMetadata->needValidate){\n\t\t\t\t\t$propMetadata->Validate($prop->getValue($this));\n\t\t\t\t\tif($propMetadata->isValid){\n\t\t\t\t\t\t$valid = $valid && $propMetadata->isValid; \n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn $valid;\t\t\n\t}", "public function isValid(): bool\n {\n return count($this->filterProperties()) === 5;\n }", "function validate_rows() {\r\n $ok = True;\r\n for ($i = 0; $i < $this->db_count; $i++) {\r\n foreach ($this->properties as $colvar=>$col) {\r\n if (!$this->validate_field($colvar,$i)) { # make sure this field is not empty\r\n $ok = False;\r\n }\r\n }\r\n }\r\n return $ok;\r\n }", "public function valid()\r\n {\r\n return count($this->listInvalidProperties()) === 0;\r\n }", "public function valid()\r\n {\r\n return count($this->listInvalidProperties()) === 0;\r\n }", "public function valid()\r\n {\r\n return count($this->listInvalidProperties()) === 0;\r\n }", "public function valid()\r\n {\r\n return count($this->listInvalidProperties()) === 0;\r\n }", "public function valid()\r\n {\r\n return count($this->listInvalidProperties()) === 0;\r\n }", "public function valid()\r\n {\r\n return count($this->listInvalidProperties()) === 0;\r\n }", "public function valid()\r\n {\r\n return count($this->listInvalidProperties()) === 0;\r\n }", "public function valid()\r\n {\r\n return count($this->listInvalidProperties()) === 0;\r\n }", "public function valid()\r\n {\r\n return count($this->listInvalidProperties()) === 0;\r\n }", "public function valid()\r\n {\r\n return count($this->listInvalidProperties()) === 0;\r\n }", "public function valid()\r\n {\r\n return count($this->listInvalidProperties()) === 0;\r\n }", "public function valid()\r\n {\r\n return count($this->listInvalidProperties()) === 0;\r\n }", "public function valid()\r\n {\r\n return count($this->listInvalidProperties()) === 0;\r\n }", "public function valid()\r\n {\r\n return count($this->listInvalidProperties()) === 0;\r\n }", "public function valid()\r\n {\r\n return count($this->listInvalidProperties()) === 0;\r\n }", "public function valid()\r\n {\r\n return count($this->listInvalidProperties()) === 0;\r\n }", "public function valid()\r\n {\r\n return count($this->listInvalidProperties()) === 0;\r\n }", "public function valid()\r\n {\r\n return count($this->listInvalidProperties()) === 0;\r\n }", "public function valid()\r\n {\r\n return count($this->listInvalidProperties()) === 0;\r\n }", "public function valid()\r\n {\r\n return count($this->listInvalidProperties()) === 0;\r\n }", "public function valid()\r\n {\r\n return count($this->listInvalidProperties()) === 0;\r\n }", "public function valid()\r\n {\r\n return count($this->listInvalidProperties()) === 0;\r\n }", "public function valid()\r\n {\r\n return count($this->listInvalidProperties()) === 0;\r\n }", "public function valid()\r\n {\r\n return count($this->listInvalidProperties()) === 0;\r\n }", "public function valid()\r\n {\r\n return count($this->listInvalidProperties()) === 0;\r\n }", "public function valid()\r\n {\r\n return count($this->listInvalidProperties()) === 0;\r\n }", "public function valid()\r\n {\r\n return count($this->listInvalidProperties()) === 0;\r\n }", "public function valid()\r\n {\r\n return count($this->listInvalidProperties()) === 0;\r\n }", "public function valid()\r\n {\r\n return count($this->listInvalidProperties()) === 0;\r\n }", "public function valid()\r\n {\r\n return count($this->listInvalidProperties()) === 0;\r\n }", "public function valid()\r\n {\r\n return count($this->listInvalidProperties()) === 0;\r\n }", "public function valid()\r\n {\r\n return count($this->listInvalidProperties()) === 0;\r\n }", "public function valid()\r\n {\r\n return count($this->listInvalidProperties()) === 0;\r\n }", "public function valid()\r\n {\r\n return count($this->listInvalidProperties()) === 0;\r\n }", "public function valid()\r\n {\r\n return count($this->listInvalidProperties()) === 0;\r\n }", "public function valid()\r\n {\r\n return count($this->listInvalidProperties()) === 0;\r\n }", "public function valid()\r\n {\r\n return count($this->listInvalidProperties()) === 0;\r\n }", "public function valid()\r\n {\r\n return count($this->listInvalidProperties()) === 0;\r\n }", "public function valid()\r\n {\r\n return count($this->listInvalidProperties()) === 0;\r\n }", "public function valid()\r\n {\r\n return count($this->listInvalidProperties()) === 0;\r\n }", "public function valid()\r\n {\r\n return count($this->listInvalidProperties()) === 0;\r\n }", "public function valid()\r\n {\r\n return count($this->listInvalidProperties()) === 0;\r\n }", "public function valid()\r\n {\r\n return count($this->listInvalidProperties()) === 0;\r\n }", "public function valid()\r\n {\r\n return count($this->listInvalidProperties()) === 0;\r\n }", "public function valid()\r\n {\r\n return count($this->listInvalidProperties()) === 0;\r\n }", "public function valid()\r\n {\r\n return count($this->listInvalidProperties()) === 0;\r\n }", "public function valid()\r\n {\r\n return count($this->listInvalidProperties()) === 0;\r\n }", "public function valid()\r\n {\r\n return count($this->listInvalidProperties()) === 0;\r\n }", "public function valid()\r\n {\r\n return count($this->listInvalidProperties()) === 0;\r\n }", "public function valid()\r\n {\r\n return count($this->listInvalidProperties()) === 0;\r\n }", "public function valid()\r\n {\r\n return count($this->listInvalidProperties()) === 0;\r\n }", "public function valid()\r\n {\r\n return count($this->listInvalidProperties()) === 0;\r\n }", "public function valid()\r\n {\r\n return count($this->listInvalidProperties()) === 0;\r\n }", "public function valid()\r\n {\r\n return count($this->listInvalidProperties()) === 0;\r\n }", "public function valid()\r\n {\r\n return count($this->listInvalidProperties()) === 0;\r\n }", "public function valid()\r\n {\r\n return count($this->listInvalidProperties()) === 0;\r\n }", "public function valid()\r\n {\r\n return count($this->listInvalidProperties()) === 0;\r\n }", "public function valid()\r\n {\r\n return count($this->listInvalidProperties()) === 0;\r\n }", "public function validate(){\n $valid = true;\n foreach($this->fields as $field){\n if(!$field->validate()) $valid = false;\n }\n $this->setIsValid($valid);\n return $valid;\n }", "public function isValid()\n {\n if(\n empty($this->getPropertyType()) ||\n empty($this->getLastName()) ||\n empty($this->getPhone()) ||\n empty($this->getOrigin()) ||\n empty($this->getInterest())\n ) {\n return false;\n }\n return true;\n }" ]
[ "0.76944476", "0.7569596", "0.72817", "0.72507316", "0.72507316", "0.72507316", "0.72507316", "0.72507316", "0.72507316", "0.72507316", "0.72507316", "0.72507316", "0.72507316", "0.72507316", "0.72507316", "0.72507316", "0.72507316", "0.72507316", "0.72507316", "0.72507316", "0.72507316", "0.72507316", "0.72507316", "0.72507316", "0.72507316", "0.72507316", "0.72507316", "0.72507316", "0.72507316", "0.72507316", "0.72507316", "0.72507316", "0.72507316", "0.72507316", "0.72507316", "0.72507316", "0.72507316", "0.72507316", "0.72507316", "0.72507316", "0.72507316", "0.72507316", "0.72507316", "0.72507316", "0.72507316", "0.72507316", "0.72507316", "0.72507316", "0.72507316", "0.72507316", "0.72507316", "0.72507316", "0.72507316", "0.72507316", "0.72507316", "0.72507316", "0.72507316", "0.72507316", "0.72507316", "0.72507316", "0.72507316", "0.7234517", "0.7229663" ]
0.0
-1
Returns true if offset exists. False otherwise.
public function offsetExists($offset) { return isset($this->container[$offset]); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function offsetExists($offset): bool\n {\n return false;\n }", "public function hasOffset(){\n return $this->_has(1);\n }", "public function offsetExists($offset): bool;", "public function offsetExists($offset) {\n\t\t$result = false;\n\t\t\n\t\tif($this->_data[$offset]) {\n\t\t\t$result = true;\n\t\t}\n\t\t\n\t\treturn $result;\n\t}", "public function offsetExists($offset)\n {\n return isset($this->data[$offset]) ? true : false;\n }", "public function offsetExists($offset)\n {\n return true;\n }", "public function offsetExists($offset): bool\n {\n return isset($this->contents[$offset]);\n }", "public function offsetExists($offset){\n\t\treturn $this->has($offset);\n\t}", "public function offsetExists($offset)\n {\n return !is_null($this->getAttribute($offset));\n }", "public function offsetExists($offset)\n {\n return !is_null($this->getAttribute($offset));\n }", "public function offsetExists($offset): bool\n {\n return isset($this->json()[$offset]);\n }", "public function offsetExists($offset) {\n\t\treturn $this->hasValueForKey($offset);\n\t}", "public function offsetExists($offset): bool\n {\n return $this->__isset($offset);\n }", "public function offsetExists($offset)\n {\n // init\n $length = $this->length();\n $offset = (int) $offset;\n\n if ($offset >= 0) {\n return ($length > $offset);\n }\n\n return ($length >= abs($offset));\n }", "public function offsetExists($offset): bool\n {\n return $this->getAttribute($offset) !== null;\n }", "public function offsetExists($offset): bool\n {\n return $this->has($offset);\n }", "public function exists($offset): bool\n {\n return $this->get($offset) !== null;\n }", "public function offsetExists($offset): bool\n {\n return isset($this->{$offset});\n }", "public function offsetExists($offset) {\n\t\treturn isset($this->data[$offset]);\n\t}", "public function offsetExists($offset) {\n\t\treturn isset($this->data[$offset]);\n\t}", "public function offsetExists($offset): bool\n {\n return isset($this->array[$offset]);\n }", "public function offsetExists($offset): bool\n {\n return (bool) $this->get($offset);\n }", "public function offsetExists($offset)\n {\n return isset($this->$offset);\n }", "public function offsetExists($offset) : bool\n {\n return isset($this->attributes[$offset]);\n }", "public function offsetExists(mixed $offset): bool\n {\n return isset($this->container[$offset]);\n }", "public function offsetExists(mixed $offset): bool\n {\n return $this->has((string) $offset);\n }", "public function offsetExists($offset) {\n return $this->__isset($offset);\n }", "public function offsetExists($offset) {\n\t\treturn isset($this->tokens[$offset]);\n\t}", "public function offsetExists($offset) {\n $value = $this->{\"get$offset\"}();\n return $value !== null;\n }", "public function offsetExists($offset) {\n\t\treturn isset($this->pile[$offset]);\n\t}", "public function offsetExists($offset)\n {\n return ! is_null($this->getAttribute($offset));\n }", "public function offsetExists($offset) {\n return isset(current($this->_data)[$offset]);\n }", "public function offsetExists($offset): bool\n {\n return array_key_exists($offset, $this->array);\n }", "public function offsetExists ($offset)\n {\n try\n {\n $this->get ($offset);\n }\n catch (InvalidArgumentException $exception)\n {\n return false;\n }\n catch (UnexpectedValueException $exception)\n {\n return false;\n }\n \n return true;\n }", "public function offsetExists($offset)\n {\n return $this->__isset($offset);\n }", "public function offsetExists($offset)\n {\n return $this->__isset($offset);\n }", "public function offsetExists($offset)\n {\n return $this->__isset($offset);\n }", "public function offsetExists($offset) {\n\t\tsettype($offset, 'integer');\n\n\t\tif ($offset >= 0 && $offset < $this->indexMax) {\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t}", "public function offsetExists($offset): bool\n {\n return isset($this->container[$offset]);\n }", "public function offsetExists($offset): bool\n {\n return isset($this->container[$offset]);\n }", "public function offsetExists($offset): bool\n {\n return isset($this->container[$offset]);\n }", "public function offsetExists($offset): bool\n {\n return isset($this->container[$offset]);\n }", "public function offsetExists($offset): bool\n {\n return isset($this->container[$offset]);\n }", "public function offsetExists($offset): bool\n {\n return isset($this->container[$offset]);\n }", "public function offsetExists($offset): bool\n {\n return isset($this->container[$offset]);\n }", "public function offsetExists($offset): bool\n {\n return isset($this->container[$offset]);\n }", "public function offsetExists($offset): bool\n {\n return isset($this->container[$offset]);\n }", "public function offsetExists($offset): bool\n {\n return isset($this->container[$offset]);\n }", "public function offsetExists($offset): bool\n {\n return isset($this->container[$offset]);\n }", "public function offsetExists($offset): bool\n {\n return isset($this->container[$offset]);\n }", "public function offsetExists($offset): bool\n {\n return isset($this->container[$offset]);\n }", "public function offsetExists($offset): bool\n {\n return isset($this->container[$offset]);\n }", "public function offsetExists($offset): bool\n {\n return isset($this->container[$offset]);\n }", "public function offsetExists($offset): bool\n {\n return isset($this->container[$offset]);\n }", "public function offsetExists($offset): bool\n {\n return isset($this->container[$offset]);\n }", "public function offsetExists($offset): bool\n {\n return isset($this->container[$offset]);\n }", "public function offsetExists($offset): bool\n {\n return isset($this->container[$offset]);\n }", "public function offsetExists($offset): bool\n {\n return isset($this->container[$offset]);\n }", "public function offsetExists($offset): bool\n {\n return isset($this->container[$offset]);\n }", "public function offsetExists($offset): bool\n {\n return isset($this->container[$offset]);\n }", "public function offsetExists($offset): bool\n {\n return isset($this->container[$offset]);\n }", "public function offsetExists($offset): bool\n {\n return isset($this->container[$offset]);\n }", "public function offsetExists($offset): bool\n {\n return isset($this->container[$offset]);\n }", "public function offsetExists($offset): bool\n {\n return isset($this->container[$offset]);\n }", "public function offsetExists($offset): bool\n {\n return isset($this->container[$offset]);\n }", "public function offsetExists($offset): bool\n {\n return isset($this->container[$offset]);\n }", "public function offsetExists($offset): bool\n {\n return isset($this->container[$offset]);\n }", "public function offsetExists($offset): bool\n {\n return isset($this->container[$offset]);\n }", "public function offsetExists($offset): bool\n {\n return isset($this->container[$offset]);\n }", "public function offsetExists($offset): bool\n {\n return isset($this->container[$offset]);\n }", "public function offsetExists($offset): bool\n {\n return isset($this->container[$offset]);\n }", "public function offsetExists($offset): bool\n {\n return isset($this->container[$offset]);\n }", "public function offsetExists($offset): bool\n {\n return isset($this->container[$offset]);\n }", "public function offsetExists($offset): bool\n {\n return isset($this->container[$offset]);\n }", "public function offsetExists($offset): bool\n {\n return isset($this->container[$offset]);\n }", "public function offsetExists($offset): bool\n {\n return isset($this->container[$offset]);\n }", "public function offsetExists($offset): bool\n {\n return isset($this->container[$offset]);\n }", "public function offsetExists($offset): bool\n {\n return isset($this->container[$offset]);\n }", "public function offsetExists($offset): bool\n {\n return isset($this->container[$offset]);\n }", "public function offsetExists($offset): bool\n {\n return isset($this->container[$offset]);\n }", "public function offsetExists($offset): bool\n {\n return isset($this->container[$offset]);\n }", "public function offsetExists($offset): bool\n {\n return isset($this->container[$offset]);\n }", "public function offsetExists($offset): bool\n {\n return isset($this->container[$offset]);\n }", "public function offsetExists($offset): bool\n {\n return isset($this->container[$offset]);\n }", "public function offsetExists($offset): bool\n {\n return isset($this->container[$offset]);\n }", "public function offsetExists($offset): bool\n {\n return isset($this->container[$offset]);\n }", "public function offsetExists($offset): bool\n {\n return isset($this->container[$offset]);\n }", "public function offsetExists($offset): bool\n {\n return isset($this->container[$offset]);\n }", "public function offsetExists($offset): bool\n {\n return isset($this->container[$offset]);\n }", "public function offsetExists($offset): bool\n {\n return isset($this->container[$offset]);\n }", "public function has($offset) {\n return $this->offsetExists($offset);\n }", "public function offsetExists($offset): bool\n {\n return isset($this->items()[$offset]);\n }", "public function offsetExists($offset):bool\n {\n return isset($this->container[$offset]);\n }", "public function offsetExists($offset);", "public function offsetExists($offset);", "public function offsetExists($offset)\n {\n return isset($this->$offset);\n\n }", "public function offsetExists($offset) : bool\n {\n return isset($this->container[$offset]);\n }", "public function offsetExists($offset) : bool\n {\n return isset($this->container[$offset]);\n }", "public function offsetExists($offset) : bool\n {\n return isset($this->container[$offset]);\n }", "public function offsetExists($offset) : bool\n {\n return isset($this->container[$offset]);\n }", "public function offsetExists($offset) : bool\n {\n return isset($this->container[$offset]);\n }" ]
[ "0.8556157", "0.8537119", "0.8488623", "0.83263934", "0.8323008", "0.83006626", "0.8214969", "0.81562907", "0.8143437", "0.8143437", "0.8135167", "0.8132229", "0.8131116", "0.8129232", "0.81180656", "0.8115703", "0.81062233", "0.8103586", "0.8087526", "0.8087526", "0.8082624", "0.80762243", "0.8074744", "0.8063826", "0.8061037", "0.80604875", "0.8058908", "0.8057279", "0.805463", "0.8053653", "0.80500907", "0.80429226", "0.80399466", "0.8033308", "0.8031057", "0.8031057", "0.8031057", "0.80296373", "0.802358", "0.802358", "0.802358", "0.802358", "0.802358", "0.802358", "0.802358", "0.802358", "0.802358", "0.802358", "0.802358", "0.802358", "0.802358", "0.802358", "0.802358", "0.802358", "0.802358", "0.802358", "0.802358", "0.802358", "0.802358", "0.802358", "0.802358", "0.802358", "0.802358", "0.802358", "0.802358", "0.802358", "0.802358", "0.802358", "0.802358", "0.802358", "0.802358", "0.802358", "0.802358", "0.802358", "0.802358", "0.802358", "0.802358", "0.802358", "0.802358", "0.802358", "0.802358", "0.802358", "0.802358", "0.802358", "0.802358", "0.802358", "0.802358", "0.802358", "0.802358", "0.802358", "0.8022116", "0.8020339", "0.80111337", "0.801042", "0.801042", "0.8009986", "0.80072665", "0.80072665", "0.80072665", "0.80072665", "0.80072665" ]
0.0
-1
Sets value based on offset.
public function offsetSet($offset, $value) { if (is_null($offset)) { $this->container[] = $value; } else { $this->container[$offset] = $value; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function set($offset, $value);", "public function set($offset, $value = null);", "function setOffset($value) {\n $this->offset = $value;\n }", "public function offsetSet($offset, $value)\n {\n $this->$offset = $value;\n }", "public function offsetSet($offset, $value)\n {\n $this->$offset = $value;\n }", "public function offsetSet($offset, $value)\n {\n $this->$offset = $value;\n }", "public function offsetSet($offset, $value)\n {\n $this->$offset = $value;\n }", "public function offsetSet($offset, $value)\n {\n $this->$offset = $value;\n }", "public function offsetSet($offset, $value)\n {\n $this->$offset = $value;\n }", "public function offsetSet($offset, $value)\n {\n $this->$offset = $value;\n }", "public function offsetSet($offset, $value)\n {\n $this->$offset = $value;\n }", "public function offsetSet($offset, $value)\n {\n $this->$offset = $value;\n }", "public function offsetSet($offset, $value)\n {\n $this->$offset = $value;\n }", "public function offsetSet($offset, $value)\n {\n $this->$offset = $value;\n }", "public function offsetSet($offset, $value)\n {\n $this->$offset = $value;\n }", "public function offsetSet($offset, $value)\n {\n $this->$offset = $value;\n }", "public function offsetSet($offset, $value)\n {\n $this->$offset = $value;\n }", "public function offsetSet($offset, $value)\n {\n $this->$offset = $value;\n }", "public function offsetSet($offset, $value)\n {\n $this->$offset = $value;\n }", "public function offsetSet($offset, $value)\n {\n $this->$offset = $value;\n }", "public function offsetSet($offset, $value)\n {\n $this->$offset = $value;\n }", "public function offsetSet($offset, $value)\n {\n $this->$offset = $value;\n }", "public function offsetSet($offset, $value)\n {\n $this->$offset = $value;\n }", "public function offsetSet($offset, $value)\n {\n $this->$offset = $value;\n }", "public function offsetSet($offset, $value)\n {\n $this->$offset = $value;\n }", "public function offsetSet($offset, $value)\n {\n $this->$offset = $value;\n }", "public function offsetSet($offset, $value)\n {\n $this->$offset = $value;\n }", "public function offsetSet($offset, $value)\n {\n $this->$offset = $value;\n }", "public function offsetSet($offset, $value)\n {\n $this->$offset = $value;\n }", "public function offsetSet($offset, $value)\n {\n $this->$offset = $value;\n }", "public function offsetSet($offset, $value)\n {\n $this->$offset = $value;\n }", "public function offsetSet($offset, $value)\n {\n $this->$offset = $value;\n }", "public function offsetSet($offset, $value)\n {\n $this->$offset = $value;\n }", "public function offsetSet($offset, $value)\n {\n $this->$offset = $value;\n }", "public function offsetSet($offset,$value) {\n if (is_null($offset)) {\n current($this->_data)[] = $value;\n } else {\n current($this->_data)[$offset] = $value;\n }\n }", "public function offsetSet($offset, $value)\n {\n $this->getValue()[$offset] = $value;\n }", "public function offsetSet( $offset, $value ) {\n\t\t// ...\n\t}", "public function offsetSet($offset, $value);", "public function offsetSet($offset, $value);", "public function offsetSet($offset, $value){\n\t\t$this->set($offset, $value);\n\t}", "public function offsetSet($offset, $value) {}", "public function offsetSet($offset, $value) {}", "public function offsetSet($offset, $value) {}", "public function offsetSet($offset, $value) {}", "public function offsetSet(mixed $offset, mixed $value): void\n {\n if (Arr::accessible($this->value)) {\n $this->value[$offset] = $value;\n }\n }", "public function offsetSet($offset, $value) { }", "public function offsetSet($offset, $value)\r\n {\r\n $this->data[$offset] = $value;\r\n }", "public function offsetSet($offset, $value)\n\t{\n\t\t$this->{$offset} = $value;\n\t}", "public function offsetSet($offset, $value)\n {\n $this->_data[$offset] = $value;\n }", "public function offsetSet($offset, $value)\n {\n $this->_data[$offset] = $value;\n }", "public function offsetSet($offset, $value)\n {\n $this->data[$offset] = $value;\n }", "public function offsetSet($offset, $value)\n {\n $this->data[$offset] = $value;\n }", "public function offsetSet($offset, $value)\n {\n\n\n $this->__set($offset, $value);\n }", "public\t\tfunction\tsetValue($offset, $value)\n\t\t{\n\t\t\tif(array_key_exists($offset, $this->_values) && $this->_values[$offser] !== $value) {\n\t\t\t\t$this->_values[$offset]\t=\t$value;\n\t\t\t\t$this->_saved\t\t\t=\tfalse;\n\t\t\t}\n\t\t}", "public function offsetSet($offset,$value) {\n if ($offset == \"\") {\n\t $this->_data[] = $value;\n\t}else {\n\t $this->_data[$offset] = $value;\n\t}\n }", "public function setOffset($offset, $value, $container = 'default');", "public function offsetSet($offset, $value)\n {\n }", "public function offsetSet($offset, $value)\n {\n $this->setModel($value, $offset);\n }", "public function offsetSet($offset, $value) \n {\n }", "public function offsetSet($offset, $value) { \n if (is_null($offset)) {\n $this->insert($value);\n $this->incrementLength();\n } else {\n if (is_null($this->offsetGet($offset))) {\n $this->incrementLength();\n }\n\n $this->update($offset, $value); \n }\n }", "public function offsetSet($offset, $value)\n {\n if (!is_null($offset)) {\n $this->data[$offset] = $value;\n }\n }", "public function offsetSet ($offset, $value) {\n $this->__set($offset, $value);\n }", "public function offsetSet($offset, $value)\n {\n $this->setAttribute($offset, $value);\n }", "public function offsetSet($offset, $value)\n {\n }", "public function offsetSet($offset, $value) {\n $this->__set($offset, $value);\n }", "public function offsetSet($offset, $value)\n {\n $this->item[$offset] = $value;\n }", "public function offsetSet($offset, $value)\n {\n $this->setAttribute($offset, $value);\n }", "public function offsetSet($offset, $value)\n {\n $this->setAttribute($offset, $value);\n }", "public function offsetSet($offset, $value)\n {\n $this->setAttribute($offset, $value);\n }", "public function offsetSet($offset, $value)\n {\n $this->elements[$offset] = $offset;\n }", "public function offsetSet($offset, $value)\n {\n if ($offset == null)\n {\n $this->data[] = $offset;\n }\n else\n {\n $this->data[$offset] = $value;\n }\n $this->size++;\n }", "public function offsetSet($offset, $value): void;", "final public function offsetSet($offset, $value)\n\t{\n\t\t$this->__set($offset, $value);\n\t}", "public function offsetSet($offset, $value)\n {\n $this->__set($offset, $value);\n }", "public function offsetSet($offset, $value)\n {\n $this->__set($offset, $value);\n }", "public function offsetSet($offset, $value)\n {\n $this->__set($offset, $value);\n }", "public function offsetSet($offset , $value) {\n $this->_items[$offset] = $value;\n }", "public function offsetSet($offset, $value)\n {\n $method = 'set' . str_replace(\" \", \"\", ucwords(strtr($offset, \"_-\", \" \")));\n if(method_exists($this, $method)){\n $this->$method($value);\n }\n }", "public function offsetSet($offset, $value)\n\t{\n\t\t// TODO: Implement offsetSet() method.\n\t}", "public function offsetSet($offset, $value)\n {\n if (is_null($offset)) {\n $this->data[] = $value;\n } else {\n $this->data[$offset] = $value;\n }\n }", "public function offsetSet($offset, $value)\n {\n if (is_null($offset)) {\n $this->data[] = $value;\n } else {\n $this->data[$offset] = $value;\n }\n }", "public function offsetSet($offset, $value)\n {\n $this->set($offset, $value);\n }", "public function offsetSet($offset, $value)\n {\n $this->set($offset, $value);\n }", "public function offsetSet($offset, $value)\n {\n $this->set($offset, $value);\n }", "public function offsetSet($offset, $value)\n {\n $this->set($offset, $value);\n }", "public function offsetSet($offset, $value)\n {\n $this->set($offset, $value);\n }", "public function offsetSet($offset, $value)\n {\n $this->set($offset, $value);\n }", "public function offsetSet($offset,$value)\n\t{\n\t\t$this->store()->offsetSet($offset,$value);\n\t}", "public function offsetSet($offset, $value): void\n {\n $this->update($offset, $value);\n }", "public function offsetSet($offset, $value): void\n {\n }", "public function offsetSet($offset, $value)\n {\n if ($offset === null) {\n $this->data[] = $value;\n } else {\n $this->data[$offset] = $value;\n }\n }", "public function set($offset, $value): void\n {\n $this->store->set($offset, $value);\n }", "public function offsetSet($offset, $value)\n\t\t{\n\t\t\tif(is_null($offset))\n\t\t\t\t$this->source[] = $value;\n\t\t\telse\n\t\t\t\t$this->source[$offset] = $value;\n\t\t}", "public function offsetSet(mixed $offset, mixed $value)\n {\n $this->set((string) $offset, $value);\n }", "public function offsetSet($offset, $value)\n {\n\n // add the data depending an offset has been passed or not\n if (is_null($offset)) {\n $offset = apc_inc($this->serial);\n }\n\n // store the data back to the property\n $this->__set($offset, $value);\n }", "public function offsetSet($offset, $value) {\n\t\tif(!array_key_exists($offset, $this->_data)) {\n\t\t\tthrow new \\Bedrock\\Model\\Record\\Exception('The specified column \"' . $offset . '\" is not a part of this record, the value was not assigned.');\n\t\t}\n\t\t\n\t\t$this->_data[$offset] = $value;\n\t}", "public function offsetSet($offset, $value)\n {\n parent::offsetSet($offset, $value);\n $this->performHook('modified');\n }", "public function offsetSet($offset, $value): void\n {\n $items = &$this->items();\n $items[$offset] = $value;\n }", "public /*void*/ function offsetSet(/*scalar*/ $offset, /*mixed*/ $value)\n\t{\n\t\tif($offset === null) {\n\t\t\t$this->_data[] = $value;\n\t\t} else {\n\t\t\t$this->_data[$offset] = $value;\n\t\t}\n\t}", "function offsetSet($offset, $value) {\n $property = defined('static::$DOMAIN_PROPERTY') ? static::$DOMAIN_PROPERTY : 'data';\n if(!isset($this->{$property})) {\n $this->{$property} = [];\n }\n \n if (is_null($offset)) {\n $offset = 0;\n if (!empty($this->{$property})) {\n $keys = \\preg_grep( '#^(0|([1-9][0-9]*))$#', \\array_keys($this->{$property}));\n if (!empty($keys)) {\n $offset = \\max($keys) + 1;\n }\n }\n }\n\n $this->{$property}[$offset] = $value;\n }", "public function offsetSet($offset, $value)\r\n {\r\n if ( ! isset($offset)) {\r\n $this->add($value);\r\n } else {\r\n $this->set($offset, $value);\r\n }\r\n }" ]
[ "0.8670502", "0.84270954", "0.821386", "0.8191476", "0.8170767", "0.8170767", "0.8170767", "0.8170767", "0.8170767", "0.8170767", "0.8170767", "0.8170767", "0.8170767", "0.8170767", "0.8170767", "0.8170767", "0.8170767", "0.8170767", "0.8170767", "0.8170767", "0.8170767", "0.8170767", "0.8170767", "0.8170767", "0.8170767", "0.8170767", "0.8170767", "0.8170767", "0.8170767", "0.8170767", "0.8170767", "0.8170767", "0.8170767", "0.8170767", "0.81676894", "0.8118936", "0.8105677", "0.80739844", "0.80739844", "0.8055169", "0.8049614", "0.8049066", "0.8049066", "0.8049066", "0.8047941", "0.80345124", "0.8014046", "0.8012902", "0.80005074", "0.80005074", "0.79962283", "0.79962283", "0.7993535", "0.7988586", "0.79849035", "0.79569495", "0.79568005", "0.7947382", "0.7944527", "0.79422164", "0.7940082", "0.79384965", "0.7937125", "0.7935071", "0.7918337", "0.7916076", "0.7908293", "0.7908293", "0.7908293", "0.79033184", "0.78849", "0.787758", "0.7874427", "0.78388196", "0.78388196", "0.78388196", "0.78323215", "0.78242445", "0.78159875", "0.78142", "0.78142", "0.7813506", "0.7813506", "0.7813506", "0.7813506", "0.7813506", "0.7813506", "0.78095996", "0.7808172", "0.78012717", "0.779916", "0.77978307", "0.7793151", "0.7784688", "0.7784433", "0.7757673", "0.77549654", "0.77270854", "0.7702829", "0.7696581", "0.7691455" ]
0.0
-1
Gets the string presentation of the object
public function __toString() { if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print return json_encode( ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT ); } return json_encode(ObjectSerializer::sanitizeForSerialization($this)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function __toString() {\r\n\t\treturn $this->getPrint();\r\n\t}", "public function __toString() {\r\n\t\treturn $this->getPrint();\r\n\t}", "public function __toString() {\n\t\treturn $this->getPrint();\n\t}", "public function visualize()\n {\n \n return new StringWrapper('object('.$this->name().')');\n \n }", "public function __toString()\n {\n $result = $this->show();\n return $result ? $result : '';\n }", "public function getToString()\n {\n return $this->toString();\n }", "public function to_string() { return $this->__toString(); }", "public function __toString()\n {\n return $this->formatAsString();\n }", "public function toString()\n {\n $data = $this->origin->data();\n $out = '';\n if (is_scalar($data) || is_null($data)) {\n $out = (string) $data;\n } elseif (is_object($data) && method_exists($data, '__toString')) {\n $out = (string) $data;\n }\n return $out;\n }", "function asString () {\n \t\treturn $this->printableString();\n \t}", "public function __toString()\n {\n return $this->format();\n }", "public function __toString()\n {\n return $this->format();\n }", "public function __toString()\n {\n return $this->format();\n }", "public function __toString()\n {\n return sprintf('%s -> %s', $this->getLugar(), $this->getMotivo());\n }", "public function toString()\n {\n return $this->__toString();\n }", "public function __toString()\r\n {\r\n return $this->getFormattedString();\r\n }", "public function __toString() {\n\t\t\treturn Core\\Convert::toString($this->render());\n\t\t}", "public function __toString() { return $this->as_string(); }", "public function __toString()\n {\n try {\n return $this->toString();\n } catch (\\Exception $e) {\n return '';\n }\n }", "public function toString()\n {\n return $this->cast('string');\n }", "public function __toString()\n\t{\n\t\treturn $this->get();\n\t}", "public function __toString() {\r\n return $this->toString();\r\n }", "public function __toString()\n {\n return $this->toFormattedString();\n }", "public function __toString()\n {\n return $this->make()->toString();\n }", "public function __toString(): string\n {\n return (string) $this->format();\n }", "public function __toString() {\n\t\treturn get_class($this) . '-object ' . \"\\n\";\n\t}", "public function __toString()\n {\n return $this->assemble();\n }", "public function toString()\n {\n $data = $this->getProperties();\n $out = get_class($this).' ('.CRLF;\n foreach ($data as $key => $value) {\n $type = gettype($value);\n $value = is_bool($value) ? (int) $value : $value;\n $value = is_string($value) ? '\"'.$value.'\"' : $value;\n $value = is_object($value) ? implode(CRLF.TAB, explode(CRLF, (string) $value)) : $value;\n $value = is_array($value) ? print_r($value, true) : $value;\n $out .= TAB.$key.' ('.$type.')';\n $out .= ': '.$value.CRLF;\n }\n\n return $out.');';\n }", "public function __toString() {\n return $this->toString();\n }", "public function __toString() {\n return $this->toString();\n }", "function __toString() \n {\n $str = \"\";\n foreach(get_object_vars($this) as $name => $obj) {\n if ($obj != NULL) {\n $obj->name = $name; #nombre de la variable que hace de nombre de objecto\n $str .= $obj->label();\n $str .= $obj;\n $str .= \"<br />\\n\";\n }\n }\n return $str;\n }", "public function __toString() {\n return $this->assemble();\n }", "public function __toString() {\n\t\treturn $this->toString();\n\t}", "public function __toString() {\n\t\treturn $this->toString();\n\t}", "public function __toString() {\n return $this->as_string();\n }", "function __toString() {\n return $this->string();\n }", "public function __toString () {\r\n\t\treturn '';\r\n\t}", "public function __tostring() {\r\n return (string) $this->object->getId();\r\n }", "public function __toString() {\n \n return $this->toString();\n }", "public function __toString()\n {\n return (string) $this->getContents();\n }", "public function __toString()\n {\n \treturn $this->get();\n }", "public function __tostring();", "public function __toString()\n {\n return $this->adaptor->render();\n }", "public function __toString()\n {\n return (string) $this->exportTo(SekolahPaudPeer::DEFAULT_STRING_FORMAT);\n }", "public function toString() {\n return $this->getClassName().'<'.$this->name.'>';\n }", "public function __toString()\n {\n return $this->toString();\n }", "public function __toString()\n {\n return $this->toString();\n }", "public function __toString()\n {\n return $this->toString();\n }", "public function __toString()\n {\n return $this->toString();\n }", "public function __toString()\n {\n return $this->toString();\n }", "public function __toString()\n {\n return $this->toString();\n }", "public function __toString()\n {\n return $this->toString();\n }", "public function __toString()\n {\n return $this->toString();\n }", "public function __toString()\n {\n return $this->toString();\n }", "public function __toString()\n {\n return $this->toString();\n }", "public function __toString()\n {\n return $this->toString();\n }", "public function __toString()\n {\n return $this->toString();\n }", "public function __toString()\n {\n return $this->toString();\n }", "public function __toString()\n {\n return $this->toString();\n }", "public function __toString()\n {\n return $this->toString();\n }", "public function toString()\n {\n return json_encode($this->obj);\n }", "public function __toString(){\n\t\t$ref = new ReflectionObject($this);\n\t\t$r = \"[\".$ref->getName().\"]\\n\";\n\t\tforeach($ref->getProperties() as $prop){\n\t\t\t$r .= \"\\t - \".$prop->getName().\"=\".$prop->getValue().\"\\n\";\n\t\t}\n\t\treturn $r;\n\t}", "public function __toString()\n {\n return $this->_;\n }", "public function __toString()\n {\n return $this->_;\n }", "public function __toString()\n {\n return $this->_;\n }", "public function __toString()\n {\n return (string) $this->exportTo(SanitasiPeer::DEFAULT_STRING_FORMAT);\n }", "public function __tostring()\n {\n return get_class($this) . '#' . $this->get_id() . ' (' . $this->get_title() . ')';\n }", "public function __toString() {\n return $this->toString();\n }", "public function __toString()\n {\n return $this->_render();\n }", "public function __toString() : string {\n return $this->box . ' ' . $this->created->format('c');\n }", "public function __toString()\n {\n return (string) $this->exportTo(JadwalPeer::DEFAULT_STRING_FORMAT);\n }", "public function __toString(): string\n {\n return $this -> text;\n }", "public function __toString() {\n\t\t\treturn $this->name();\n\t\t}", "public function __toString()\n\t{\n\t\treturn '';\n\t}", "public function __toString()\n {\n notice('Object: \"'.get_class($this).'\" is used as string');\n\n return 'Object('.get_class($this).')';\n }", "public function __toString(){\n return $this->convert();\n }", "public function __toString()\n {\n return $this->toNative();\n }", "public function __toString() {\n\t\treturn $this->debug();\n\t}", "public function __toString()\n\t{\n\t\treturn $this->_toString();\n\t}", "public function toString() {\n $s= $this->getClassName().'@('.$this->hashCode().\"){\\n\";\n $s.= ' [ name ] '.$this->name.\"\\n\";\n $s.= ' [ value ] '.$this->value.\"\\n\";\n $s.= ' [ mustUnderstand ] '.xp::stringOf($this->mustUnderstand).\"\\n\";\n $s.= ' [ encodingStyle ] '.$this->encodingStyle.\"\\n\";\n $s.= ' [ actor ] '.$this->actor.\"\\n\";\n return $s.'}';\n }", "public function __toString()\n {\n return $this->reference ?? '';\n }", "public function __toString()\n {\n return $this->render(true);\n }", "public function __toString() : string\n {\n return $this->toString();\n }", "public function __toString() {\n\t\treturn $this->name->getFullyQualifiedName();\n//\t\t$s = $this->name->getFullyQualifiedName();\n//\t\t$c = $this->extended;\n//\t\twhile($c !== NULL){\n//\t\t\t$s .= \"->\" . $c->name;\n//\t\t\t$c = $c->extended;\n//\t\t}\n//\t\treturn $s;\n\t}", "public function __toString() {\n\t\treturn $this->render();\n\t}", "public function __toString()\n {\n return $this->make()->render();\n }", "public function __toString()\n {\n return $this->output();\n }", "public function __toString()\n {\n return $this->render();\n }", "public function __toString()\n {\n return $this->render();\n }", "public function __toString()\n {\n return $this->render();\n }", "public function __toString()\n {\n return $this->render();\n }", "public function __toString()\n {\n return $this->render();\n }", "public function __toString()\n {\n return $this->render();\n }", "public function __toString()\n {\n return $this->render();\n }", "public function __toString()\n {\n return $this->render();\n }", "public function __toString()\n {\n return $this->render();\n }", "public function __toString()\n {\n return $this->render();\n }", "public function __toString()\n {\n return $this->render();\n }", "public function __toString()\n {\n return $this->render();\n }", "public function __toString()\n {\n return $this->render();\n }", "public function __toString()\n {\n return $this->render();\n }" ]
[ "0.78987753", "0.78987753", "0.78655267", "0.78240114", "0.7798868", "0.77837336", "0.77770287", "0.77690274", "0.77437395", "0.774057", "0.7733258", "0.7733258", "0.7733258", "0.7695146", "0.767794", "0.76635754", "0.76593804", "0.7630339", "0.76228136", "0.7610629", "0.7575354", "0.7573883", "0.75735986", "0.75721085", "0.7561757", "0.75431705", "0.7537132", "0.75362605", "0.75335604", "0.75335604", "0.75276136", "0.7519024", "0.7514037", "0.7514037", "0.75004286", "0.7499962", "0.7497666", "0.74929035", "0.7487213", "0.7479636", "0.74712914", "0.7462192", "0.74601185", "0.7455943", "0.7455742", "0.745568", "0.745568", "0.745568", "0.745568", "0.745568", "0.745568", "0.745568", "0.745568", "0.745568", "0.745568", "0.745568", "0.745568", "0.745568", "0.745568", "0.745568", "0.74519074", "0.745044", "0.7448012", "0.7448012", "0.7448012", "0.7446098", "0.74429476", "0.7441371", "0.7430801", "0.74215424", "0.74149144", "0.74128985", "0.74083585", "0.74013644", "0.7390187", "0.7385503", "0.73853725", "0.7384312", "0.73842263", "0.7383548", "0.7380489", "0.73800004", "0.7369339", "0.7366414", "0.7363444", "0.7361871", "0.7358607", "0.73577785", "0.73577785", "0.73577785", "0.73577785", "0.73577785", "0.73577785", "0.73577785", "0.73577785", "0.73577785", "0.73577785", "0.73577785", "0.73577785", "0.73577785", "0.73577785" ]
0.0
-1
Data provider for testVote(). These transitions should never be allowed because the Task status is not compliant.
public function providerTestVote() { return array( // No user may ever start any Task if the Task has no resource. array(Task::STATUS_ASSIGNED, Task::STATUS_STARTED, StatusVoter::ACCESS_DENIED), // No user may ever re-assign any Task if it is finished. array(Task::STATUS_FINISHED, Task::STATUS_ASSIGNED, StatusVoter::ACCESS_DENIED), // No user may ever re-assign any Task if it is sent to the client. array(Task::STATUS_SENT, Task::STATUS_ASSIGNED, StatusVoter::ACCESS_DENIED), // No user may ever re-assign any Task if it is archived. array(Task::STATUS_ARCHIVED, Task::STATUS_ASSIGNED, StatusVoter::ACCESS_DENIED), ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function providerTestVoteAsResource()\n {\n return array(\n // Resources are allowed to accept a Task that is assigned to them.\n array(Task::STATUS_ASSIGNED, Task::STATUS_STARTED, StatusVoter::ACCESS_GRANTED),\n // Resources are not allowed to directly start on a new Task.\n // It needs to explicitly have the \"assigned\" status.\n array(Task::STATUS_NEW, Task::STATUS_STARTED, StatusVoter::ACCESS_DENIED),\n // Resources are allowed to send in their completed work.\n array(Task::STATUS_STARTED, Task::STATUS_FINISHED, StatusVoter::ACCESS_GRANTED),\n );\n }", "public function testVote($currentStatus, $newStatus, $expectedAccessResult)\n {\n $token = $this->getMock('Symfony\\Component\\Security\\Core\\Authentication\\Token\\TokenInterface');\n $voter = $this->createVoter();\n $task = new Task();\n $task->setStatus($currentStatus);\n $this->assertEquals($expectedAccessResult, $voter->vote($token, $task, array($newStatus)));\n }", "public function testTask()\n {\n $task = new Task();\n $user = new User();\n\n $this->assertNull($task->getId());\n $task->setTitle('test');\n $this->assertSame('test', $task->getTitle());\n $task->setContent('testcontent');\n $this->assertSame('testcontent', $task->getContent());\n $task->toggle(true);\n $this->assertTrue( $task->isDone());\n $task->setUser($user);\n $this->assertInstanceOf(User::class, $task->getUser());\n $task->setCreatedAt(new \\DateTime());\n $this->assertNotEmpty($task->getCreatedAt());\n }", "public function testTriggerCanControlScheduledTasks() {\n AuthenticationHelper::login(\"[email protected]\", \"password\");\n\n $dataSetInstanceSummary = new DatasetInstanceSummary(\"Test dataset\", \"test-json\", null, [], [], []);\n $instanceId = $this->datasetService->saveDataSetInstance($dataSetInstanceSummary, null, 1);\n\n $snapshotProfileSummary = new DatasetInstanceSnapshotProfileSummary(\"Summary Adhoc\", \"tabulardatasetsnapshot\", [\n ], DatasetInstanceSnapshotProfileSummary::TRIGGER_ADHOC);\n\n $now = (new \\DateTime())->format(\"Y-m-d H:i:s\");\n $id = $this->datasetService->saveSnapshotProfile($snapshotProfileSummary, $instanceId);\n $snapshotProfileSummary->setId($id);\n\n /**\n * @var DatasetInstanceSnapshotProfile $snapshotProfile\n */\n $snapshotProfile = DatasetInstanceSnapshotProfile::fetch($id);\n\n\n $this->assertEquals(DatasetInstanceSnapshotProfileSummary::TRIGGER_ADHOC, $snapshotProfile->getTrigger());\n\n\n $this->assertEquals(DatasetInstanceSnapshotProfileSummary::TRIGGER_ADHOC, $snapshotProfile->getTrigger());\n $this->assertEquals([], $snapshotProfile->getScheduledTask()->getTimePeriods());\n\n\n // Check we can change snapshot to scheduled\n $snapshotProfileSummary->setTrigger(DatasetInstanceSnapshotProfileSummary::TRIGGER_SCHEDULE);\n $snapshotProfileSummary->setTaskTimePeriods([new ScheduledTaskTimePeriod(null, 5, 20, 33)]);\n $this->datasetService->saveSnapshotProfile($snapshotProfileSummary, $instanceId);\n\n\n /**\n * @var DatasetInstanceSnapshotProfile $snapshotProfile\n */\n $scheduledSnapshotProfile = DatasetInstanceSnapshotProfile::fetch($id);\n /**\n * @var ScheduledTask $task\n */\n $task = $scheduledSnapshotProfile->getScheduledTask();\n $this->assertEquals(\"dataprocessor\", $task->getTaskIdentifier());\n $this->assertEquals(DatasetInstanceSnapshotProfileSummary::TRIGGER_SCHEDULE, $scheduledSnapshotProfile->getTrigger());\n $this->assertEquals(new ScheduledTaskTimePeriod(null, 5, 20, 33, $scheduledSnapshotProfile->getScheduledTask()->getTimePeriods()[0]->getId()),\n $scheduledSnapshotProfile->getScheduledTask()->getTimePeriods()[0]);\n\n\n // Alter this scheduled snapshot\n $snapshotProfileSummary->setTitle(\"New Title\");\n $snapshotProfileSummary->setTaskTimePeriods([new ScheduledTaskTimePeriod(3, null, 4, 1)]);\n $this->datasetService->saveSnapshotProfile($snapshotProfileSummary, $instanceId);\n\n /**\n * @var DatasetInstanceSnapshotProfile $snapshotProfile\n */\n $newScheduledSnapshotProfile = DatasetInstanceSnapshotProfile::fetch($id);\n\n $this->assertEquals(DatasetInstanceSnapshotProfileSummary::TRIGGER_SCHEDULE, $newScheduledSnapshotProfile->getTrigger());\n $this->assertEquals(new ScheduledTaskTimePeriod(3, null, 4, 1, $newScheduledSnapshotProfile->getScheduledTask()->getTimePeriods()[0]->getId()),\n $newScheduledSnapshotProfile->getScheduledTask()->getTimePeriods()[0]);\n\n // Check we can revert to adhoc\n $snapshotProfileSummary->setTrigger(DatasetInstanceSnapshotProfileSummary::TRIGGER_ADHOC);\n $this->datasetService->saveSnapshotProfile($snapshotProfileSummary, $instanceId);\n\n /**\n * @var DatasetInstanceSnapshotProfile $snapshotProfile\n */\n $adhocSnapshotProfile = DatasetInstanceSnapshotProfile::fetch($id);\n\n $this->assertEquals(DatasetInstanceSnapshotProfileSummary::TRIGGER_ADHOC, $adhocSnapshotProfile->getTrigger());\n $this->assertEquals([], $adhocSnapshotProfile->getScheduledTask()->getTimePeriods());\n }", "function testMarkAsVoted() {\n\t\t/*\n\t\t$mobilePoll = $this->ObjFromFixture('Poll', 'mobile-poll');\n\t\t$mobilePoll->markAsVoted();\n\t\t$this->assertTrue($mobilePoll->hasVoted());\n\t\t*/\n\t}", "public function testPostVoteOnQuestion(): void {\n $user = factory(User::class)->create();\n $q = factory(Question::class)->create();\n $url = \"/api/questions/$q->id\";\n //up and cancel\n $this->get(url(\"$url/votes\"))\n ->assertStatus(200)\n ->assertJsonFragment(['total' => 0]);\n $this->post(url(\"$url/upvote\"), ['api_token' => $user->api_token])\n ->assertStatus(200)\n ->assertJsonFragment(['total' => 1, 'up' => 1]);\n $this->post(url(\"$url/upvote\"), ['api_token' => $user->api_token])\n ->assertStatus(200)\n ->assertJsonFragment(['total' => 0, 'up' => 0]);\n //down and cancel\n $this->post(url(\"$url/downvote\"), ['api_token' => $user->api_token])\n ->assertStatus(200)\n ->assertJsonFragment(['total' => -1, 'down' => 1]);\n $this->post(url(\"$url/downvote\"), ['api_token' => $user->api_token])\n ->assertStatus(200)\n ->assertJsonFragment(['total' => 0, 'down' => 0]);\n // down up down\n $this->post(url(\"$url/downvote\"), ['api_token' => $user->api_token])\n ->assertStatus(200)\n ->assertJsonFragment(['total' => -1, 'down' => 1]);\n $this->post(url(\"$url/upvote\"), ['api_token' => $user->api_token])\n ->assertStatus(200)\n ->assertJsonFragment(['total' => 1, 'up' => 1]);\n $this->post(url(\"$url/downvote\"), ['api_token' => $user->api_token])\n ->assertStatus(200)\n ->assertJsonFragment(['total' => -1, 'down' => 1]);\n\n $this->get(url(\"$url/votes\"))\n ->assertStatus(200)\n ->assertJsonFragment(['total' => -1]);\n }", "public function testvote()\n {\n $this->vote_answer = Vote::vote($this->user->id, $this->answer->id, 1, 'answer_id');\n if (!$this->answer) return false;\n }", "public function test_users_vote_can_be_retrieved() {\n\n $user = User::create('[email protected]', 'secret', 'Jane Doe');\n\n $this->assertNull($this->message->getVote($user));\n\n $this->message->upvote($user);\n $this->assertEquals('up', $this->message->getVote($user));\n\n $this->message->downvote($user);\n $this->assertEquals('down', $this->message->getVote($user));\n\n }", "public function testStaleVotes()\n {\n // create review to test with\n $review = new Review($this->p4);\n $review->setParticipants(array('foo', 'bar'))\n ->set('author', 'joe')\n ->save();\n\n // add several versions\n $review->setVersions(\n array(\n array('change' => 2, 'user' => 'joe', 'time' => 700, 'pending' => 1, 'difference' => 1),\n array('change' => 3, 'user' => 'joe', 'time' => 710, 'pending' => 1, 'difference' => 1),\n array('change' => 4, 'user' => 'joe', 'time' => 720, 'pending' => 1, 'difference' => 2),\n )\n )->save();\n\n // prepare connections for users 'foo', 'bar'\n $p4Foo = $this->connectWithAccess('foo', array('//...'));\n $p4Bar = $this->connectWithAccess('bar', array('//...'));\n $userFoo = User::fetch('foo', $this->p4);\n $userBar = User::fetch('bar', $this->p4);\n\n // test that voting without version applies to latest\n $services = $this->getApplication()->getServiceManager();\n $services->setService('p4_user', $p4Foo)\n ->setService('user', $userFoo);\n $this->getRequest()->setMethod('POST');\n $this->dispatch('/reviews/' . $review->getId() . '/vote/up');\n\n $votes = Review::fetch($review->getId(), $this->p4)->getVotes();\n $this->assertSame(1, count($votes));\n $this->assertSame(1, $votes['foo']['value']);\n $this->assertSame(3, $votes['foo']['version']);\n $this->assertSame(false, $votes['foo']['isStale']);\n\n // try voting on a particular version\n $this->resetApplication();\n $services = $this->getApplication()->getServiceManager();\n $services->setService('p4_user', $p4Foo)\n ->setService('user', $userFoo);\n $this->getRequest()->setMethod('POST')->setPost(new Parameters(array('version' => 2)));\n $this->dispatch('/reviews/' . $review->getId() . '/vote/up');\n\n $votes = Review::fetch($review->getId(), $this->p4)->getVotes();\n $this->assertSame(1, count($votes));\n $this->assertSame(1, $votes['foo']['value']);\n $this->assertSame(2, $votes['foo']['version']);\n $this->assertSame(false, $votes['foo']['isStale']);\n\n // vote as 'bar' on version 1 and verify its evaluated as stale vote\n $this->resetApplication();\n $services = $this->getApplication()->getServiceManager();\n $services->setService('p4_user', $p4Bar)\n ->setService('user', $userBar);\n $this->getRequest()->setMethod('POST')->setPost(new Parameters(array('version' => 1)));\n $this->dispatch('/reviews/' . $review->getId() . '/vote/down');\n\n $votes = Review::fetch($review->getId(), $this->p4)->getVotes();\n $this->assertSame(2, count($votes));\n $this->assertSame(1, $votes['foo']['value']);\n $this->assertSame(2, $votes['foo']['version']);\n $this->assertSame(false, $votes['foo']['isStale']);\n $this->assertSame(-1, $votes['bar']['value']);\n $this->assertSame(1, $votes['bar']['version']);\n $this->assertSame(true, $votes['bar']['isStale']);\n }", "public function transitionsProvider()\n {\n $needsReview = 'needsReview';\n $needsRevision = 'needsRevision';\n $approved = 'approved';\n $approvedCommit = 'approved:commit';\n $rejected = 'rejected';\n $archived = 'archived';\n\n // prepare some transition sets\n $allStates = array(\n $needsReview,\n $needsRevision,\n $approved,\n $approvedCommit,\n $rejected,\n $archived\n );\n $allTransitions = array(\n $needsReview => array_diff($allStates, array($needsReview)),\n $needsRevision => array_diff($allStates, array($needsRevision)),\n $approved => array_diff($allStates, array($approved)),\n $rejected => array_diff($allStates, array($rejected)),\n $archived => array_diff($allStates, array($archived))\n );\n $allButApprovedTransitions = array(\n $needsReview => array_diff($allStates, array($needsReview, $approved, $approvedCommit)),\n $needsRevision => array_diff($allStates, array($needsRevision, $approved, $approvedCommit)),\n $approved => array_diff($allStates, array($approved)),\n $rejected => array_diff($allStates, array($rejected, $approved, $approvedCommit)),\n $archived => array_diff($allStates, array($archived, $approved, $approvedCommit))\n );\n $noTransitions = array(\n $needsReview => false,\n $needsRevision => false,\n $approved => false,\n $rejected => false,\n $archived => false\n );\n $memberOnlyTransitions = array(\n $needsReview => array($needsRevision),\n $needsRevision => array($needsReview),\n $approved => array($needsReview, $needsRevision, $approvedCommit),\n $rejected => array(),\n $archived => array(),\n );\n\n // tests sub-array 'asserts' contains user to authenticate as in key and array\n // of [<reviewState> => <list of expected transitions>] in value\n return array(\n 'no-projects' => array(\n 'projects' => array(),\n 'tests' => array(\n array(\n 'reviewFiles' => array('//depot/a/file'),\n 'reviewAuthor' => 'a',\n 'asserts' => array(\n 'a' => $allTransitions,\n 'b' => $allTransitions\n ),\n ),\n // verify that author cannot approve if self-approve is disabled\n array(\n 'reviewFiles' => array('//depot/a/file'),\n 'config' => array('reviews' => array('disable_self_approve' => true)),\n 'reviewAuthor' => 'a',\n 'asserts' => array(\n 'a' => $allButApprovedTransitions,\n 'b' => $allTransitions\n ),\n ),\n )\n ),\n 'no-mods-single' => array(\n 'projects' => array(\n array(\n 'id' => 'prj1',\n 'members' => array('a', 'b'),\n 'branches' => array(\n array(\n 'id' => 'a',\n 'name' => 'A',\n 'paths' => '//depot/a/...',\n 'moderators' => array()\n ),\n ),\n ),\n ),\n 'tests' => array(\n array(\n 'reviewFiles' => array('//depot/a/file'),\n 'asserts' => array(\n 'foo' => $noTransitions,\n 'a' => $allTransitions\n ),\n ),\n // verify that author cannot approve if self-approve is disabled\n array(\n 'reviewAuthor' => 'a',\n 'config' => array('reviews' => array('disable_self_approve' => true)),\n 'reviewFiles' => array('//depot/a/file'),\n 'asserts' => array(\n 'foo' => $noTransitions,\n 'b' => $allTransitions,\n 'a' => $allButApprovedTransitions\n ),\n ),\n ),\n ),\n 'no-mods-multi' => array(\n 'projects' => array(\n array(\n 'id' => 'prj1',\n 'members' => array('a', 'b'),\n 'branches' => array(\n array(\n 'id' => 'a',\n 'name' => 'A',\n 'paths' => '//depot/a/...',\n 'moderators' => array()\n ),\n ),\n ),\n array(\n 'id' => 'prj2',\n 'members' => array('a', 'c'),\n 'branches' => array(\n array(\n 'id' => 'b',\n 'name' => 'B',\n 'paths' => '//depot/b/...',\n 'moderators' => array()\n ),\n ),\n ),\n array(\n 'id' => 'prj3',\n 'members' => array('x', 'y', 'z'),\n 'branches' => array(\n array(\n 'id' => 'c',\n 'name' => 'C',\n 'paths' => '//depot/c/...',\n 'moderators' => array()\n ),\n ),\n ),\n ),\n 'tests' => array(\n // test review touching projects 1 & 3\n // members: [a, b, x, y, z]\n // moderators: []\n array(\n 'reviewFiles' => array('//depot/a/file', '//depot/c/file'),\n 'asserts' => array(\n 'foo' => $noTransitions,\n 'c' => $noTransitions,\n 'a' => array(\n $needsReview => array_diff($allStates, array($needsReview))\n ),\n 'y' => array(\n $needsReview => array_diff($allStates, array($needsReview))\n ),\n ),\n ),\n ),\n ),\n 'with-mods-single' => array(\n 'projects' => array(\n array(\n 'id' => 'prj1',\n 'members' => array('a', 'b', 'c'),\n 'branches' => array(\n array(\n 'id' => 'a',\n 'name' => 'A',\n 'paths' => '//depot/a/...',\n 'moderators' => array('m1', 'm2')\n )\n )\n ),\n ),\n 'tests' => array(\n array(\n 'reviewFiles' => array('//depot/a/file', '//depot/x/foo'),\n 'asserts' => array(\n 'foo' => $noTransitions,\n 'a' => $memberOnlyTransitions,\n 'm1' => $allTransitions\n ),\n ),\n ),\n ),\n 'with-mods-multi' => array(\n 'projects' => array(\n array(\n 'id' => 'prj1',\n 'members' => array('a', 'b', 'c'),\n 'branches' => array(\n array(\n 'id' => 'a',\n 'name' => 'A',\n 'paths' => '//depot/a/...',\n 'moderators' => array('m1', 'a')\n ),\n ),\n ),\n array(\n 'id' => 'prj2',\n 'members' => array('joe'),\n 'branches' => array(\n array(\n 'id' => 'a2',\n 'name' => 'A2',\n 'paths' => '//depot/a/...',\n 'moderators' => array()\n ),\n array(\n 'id' => 'b',\n 'name' => 'B',\n 'paths' => '//depot/b/...',\n 'moderators' => array('joe')\n ),\n ),\n ),\n array(\n 'id' => 'prj3',\n 'members' => array('x', 'y', 'z'),\n 'branches' => array(\n array(\n 'id' => 'c',\n 'name' => 'C',\n 'paths' => '//depot/c/...',\n 'moderators' => array('x', 'm2')\n ),\n ),\n ),\n ),\n 'tests' => array(\n // test review touching projects 1 & 2\n // members: [a, b, c, joe]\n // moderators: [m1, a]\n array(\n 'reviewFiles' => array('//depot/a/file', '//depot/x/foo'),\n 'reviewAuthor' => 'joe',\n 'asserts' => array(\n 'foo' => $noTransitions,\n 'joe' => array(\n $needsReview => array($needsRevision, $archived),\n $needsRevision => array($needsReview, $archived),\n $approved => array($needsReview, $needsRevision, $approvedCommit, $archived),\n $rejected => array(),\n $archived => array($needsReview, $needsRevision)\n ),\n 'a' => $allTransitions,\n 'b' => $memberOnlyTransitions,\n 'm1' => $allTransitions,\n 'm2' => $noTransitions\n ),\n ),\n // test author as the only moderator\n array(\n 'reviewFiles' => array('//depot/b/file'),\n 'reviewAuthor' => 'joe',\n 'asserts' => array(\n 'foo' => $noTransitions,\n 'joe' => $allTransitions\n ),\n ),\n // test author as one of many moderators\n array(\n 'reviewFiles' => array('//depot/a/file'),\n 'reviewAuthor' => 'a',\n 'asserts' => array(\n 'a' => $allTransitions,\n 'b' => $memberOnlyTransitions,\n 'c' => $memberOnlyTransitions,\n 'm1' => $allTransitions\n ),\n ),\n // verify that authors who are also moderators cannot approve their own reviews\n array(\n 'config' => array('reviews' => array('disable_self_approve' => true)),\n 'reviewFiles' => array('//depot/a/file'),\n 'reviewAuthor' => 'a',\n 'asserts' => array(\n 'a' => $allButApprovedTransitions,\n 'b' => $memberOnlyTransitions,\n 'c' => $memberOnlyTransitions,\n 'm1' => $allTransitions\n ),\n )\n ),\n ),\n );\n }", "public function reviewTask ($task) {\n\n\t}", "public function testCreateTask()\n {\n }", "public function testVoteAsResource($currentStatus, $newStatus, $expectedAccessResult)\n {\n $token = $this->getMock('Symfony\\Component\\Security\\Core\\Authentication\\Token\\TokenInterface');\n $user = new User();\n\n $token->expects($this->once())\n ->method('getUser')\n ->willReturn($user);\n\n $roleHierarchy = $this->getMock('Symfony\\Component\\Security\\Core\\Role\\RoleHierarchyInterface');\n $voter = new StatusVoter($roleHierarchy);\n\n $task = new Task();\n $task->setStatus($currentStatus);\n $task->setResource($user);\n\n $this->assertEquals($expectedAccessResult, $voter->vote($token, $task, array($newStatus)));\n }", "public function testGetTaskInstanceVariable()\n {\n }", "public function testPatchReviewerRequiredToggle()\n {\n $this->createChange();\n Review::createFromChange('1')->save()->updateFromChange('1')\n ->setParticipantData('nonadmin', true, 'required')->addVote('nonadmin', 1)\n ->save();\n\n // there shouldn't be any tasks but proccess just to be safe\n $this->getRequest()->getQuery()->set('debug', 1)->set('retire', 1);\n $this->dispatch('/queue/worker');\n\n // verify the starting state is good\n $this->assertSame(\n array(\n 'admin' => array(),\n 'nonadmin' => array(\n 'required' => true, 'vote' => array('value' => 1, 'version' => 1, 'isStale' => false)\n )\n ),\n Review::fetch('2', $this->p4)->getParticipantsData()\n );\n\n $expected = array(\n 'admin' => array(), // as they are the author; can't get rid of em\n 'nonadmin' => array('vote' => array('value' => 1, 'version' => 1, 'isStale' => false))\n );\n $this->getRequest()\n ->setMethod(\\Zend\\Http\\Request::METHOD_POST)\n ->setPost(new Parameters(array('required' => false)))\n ->setQuery(new Parameters(array('_method' => 'patch')));\n\n // dispatch and check output\n $this->dispatch('/reviews/2/reviewers/nonadmin');\n $this->assertRoute('review-reviewer');\n $this->assertResponseStatusCode(200);\n $result = $this->getResult();\n $this->assertInstanceOf('Zend\\View\\Model\\JsonModel', $result);\n $review = $result->getVariable('review');\n // @codingStandardsIgnoreStart\n $this->assertSame(true, $result->getVariable('isValid'), print_r($result->getVariables(), true));\n // @codingStandardsIgnoreEnd\n $this->assertSame(\n $expected,\n $review['participantsData']\n );\n\n // proccess all tasks as they may impact things\n $this->getRequest()->getQuery()->set('debug', 1)->set('retire', 1);\n $this->dispatch('/queue/worker');\n\n // verify participants are still correct\n $review = Review::fetch('2', $this->p4);\n $this->assertSame(\n $expected,\n $review->getParticipantsData()\n );\n\n\n // now try using patch and setting it to required\n $expected['nonadmin'] = array(\n 'required' => true, 'vote' => array('value' => 1, 'version' => 1, 'isStale' => false)\n );\n $this->getRequest()\n ->setMethod(\\Zend\\Http\\Request::METHOD_PATCH)\n ->setPost(new Parameters(array('required' => '1')));\n\n // dispatch and check output\n $this->dispatch('/reviews/2/reviewers/nonadmin');\n $this->assertRoute('review-reviewer');\n $this->assertResponseStatusCode(200);\n $result = $this->getResult();\n $this->assertInstanceOf('Zend\\View\\Model\\JsonModel', $result);\n $review = $result->getVariable('review');\n // @codingStandardsIgnoreStart\n $this->assertSame(true, $result->getVariable('isValid'), print_r($result->getVariables(), true));\n // @codingStandardsIgnoreEnd\n $this->assertSame(\n $expected,\n $review['participantsData']\n );\n\n // proccess all tasks as they may impact things\n $this->getRequest()->getQuery()->set('debug', 1)->set('retire', 1);\n $this->dispatch('/queue/worker');\n\n // verify participants are still correct\n $review = Review::fetch('2', $this->p4);\n $this->assertSame(\n $expected,\n $review->getParticipantsData()\n );\n }", "public function testPostVoteOnAnswer(): void {\n $user = factory(User::class)->create();\n $q = factory(Question::class)->create();\n $a = factory(Answer::class)->create(['question_id' => $q->id]);\n $url = \"/api/answers/$a->id\";\n //up and cancel\n $this->get(url(\"$url/votes\"))\n ->assertStatus(200)\n ->assertJsonFragment(['total' => 0]);\n $this->post(url(\"$url/upvote\"), ['api_token' => $user->api_token])\n ->assertStatus(200)\n ->assertJsonFragment(['total' => 1, 'up' => 1]);\n $this->post(url(\"$url/upvote\"), ['api_token' => $user->api_token])\n ->assertStatus(200)\n ->assertJsonFragment(['total' => 0, 'up' => 0]);\n // down and cancel\n $this->post(url(\"$url/downvote\"), ['api_token' => $user->api_token])\n ->assertStatus(200)\n ->assertJsonFragment(['total' => -1, 'down' => 1]);\n $this->post(url(\"$url/downvote\"), ['api_token' => $user->api_token])\n ->assertStatus(200)\n ->assertJsonFragment(['total' => 0, 'down' => 0]);\n //down up down\n $this->post(url(\"$url/downvote\"), ['api_token' => $user->api_token])\n ->assertStatus(200)\n ->assertJsonFragment(['total' => -1, 'down' => 1]);\n $this->post(url(\"$url/upvote\"), ['api_token' => $user->api_token])\n ->assertStatus(200)\n ->assertJsonFragment(['total' => 1, 'up' => 1]);\n $this->post(url(\"$url/downvote\"), ['api_token' => $user->api_token])\n ->assertStatus(200)\n ->assertJsonFragment(['total' => -1, 'down' => 1]);\n\n $this->get(url(\"$url/votes\"))\n ->assertStatus(200)\n ->assertJsonFragment(['total' => -1]);\n }", "public function testCreateTaskVariable()\n {\n }", "public function testTestStatus()\n {\n // create review record for change 1\n $this->createChange();\n $review = Review::createFromChange('1')->save();\n\n // ensure starting test status of null.\n $this->assertSame($review->get('testStatus'), null);\n\n // dispatch and check output\n $this->dispatch('/reviews/2/tests/fail/' . $review->getToken());\n $result = $this->getResult();\n $review = Review::fetch(2, $this->p4);\n $this->assertRoute('review-tests');\n $this->assertResponseStatusCode(200);\n $this->assertSame(true, $result->getVariable('isValid'));\n $this->assertSame('fail', $review->get('testStatus'));\n }", "public function test_user_cannot_both_upvote_and_downvote() {\n\n $user = User::create('[email protected]', 'secret', 'Jane Doe');\n $this->message->upvote($user);\n $this->message->downvote($user);\n $this->assertEquals(0, $this->message->getUpvotes());\n $this->assertEquals(1, $this->message->getDownvotes());\n\n $this->message->downvote($user);\n $this->message->upvote($user);\n $this->assertEquals(1, $this->message->getUpvotes());\n $this->assertEquals(0, $this->message->getDownvotes());\n\n }", "public function testVote()\n {\n $vote = new Vote();\n $this\n ->voteDirector\n ->expects($this->any())\n ->method('findOneBy')\n ->will($this->returnValue(null));\n\n $this\n ->voteDirector\n ->expects($this->once())\n ->method('create')\n ->will($this->returnValue($vote));\n\n $this\n ->commentEventDispatcher\n ->expects($this->once())\n ->method('dispatchCommentOnVotedEvent')\n ->with(\n $this->equalTo($this->comment),\n $this->equalTo($vote),\n $this->equalTo(false)\n );\n\n $vote = $this\n ->voteManager\n ->vote(\n $this->comment,\n $this->authorToken,\n Vote::DOWN\n );\n\n $this->assertSame($this->authorToken, $vote->getAuthorToken());\n $this->assertSame($this->comment, $vote->getComment());\n $this->assertSame(Vote::DOWN, $vote->getType());\n }", "public function vote_active() { \n\n\t\t/* Going to do a little more here later */\n\t\tif ($this->type == 'vote') { return true; } \n\n\t\treturn false;\n\n\t}", "public function voteDesicionAftetVote(Request $request)\n {\n $this->validate($request, [\n 'election_id' => 'required',\n 'pin' => 'required',\n 'session_id' => 'required',\n 'random_number' => 'required',\n ]);\n $session_id = trim($request->session_id); ;\n $pin = trim($request->pin);\n $election_id = trim($request->election_id);\n $random_number = trim($request->random_number);\n $confirm_button = trim($request->confirm_button);\n if($confirm_button == 'not_ok')\n {\n // remove the field\n DB::table('tbl_temp_vote')->where('voter_id',$this->voter_id)->delete();\n Session::put('succes','Thanks , Your Vote Cancel. Again Given Vote');\n return Redirect::to('choseCandidateType/'.$election_id.'/'.$pin);\n exit();\n }\n if($confirm_button == 'ok')\n {\n $vote_date_time_confim = DB::table('tbl_vote_schedule')->where('election_id',$election_id)->where('status',0)->first();\n // voting time ended\n date_default_timezone_set('Asia/Dhaka');\n $current_date = date('Y-m-d');\n $current_time = date('H:i:s');\n $e_start_date = $vote_date_time_confim->start_date ;\n $e_start_time = $vote_date_time_confim->start_time ;\n $e_end_date = $vote_date_time_confim->end_date ;\n $e_end_time = $vote_date_time_confim->end_time ;\n\n if($current_date == $e_start_date AND $current_time > $e_start_time){\n $date_time_status = '1' ;\n }\n elseif($current_date > $e_start_date AND $current_date < $e_end_date){\n $date_time_status = '1' ;\n }elseif($current_date == $e_end_date AND $current_time < $e_end_time){\n $date_time_status = '1' ; \n }else{\n $date_time_status = '2' ; \n }\n if($date_time_status == '2'){\n Session::put('failed','Sorry ! Voting Time Is Expired');\n return Redirect::to('choseCandidateType/'.$election_id.'/'.$pin);\n exit(); \n }\n\n // count already vote cast\n $count = DB::table('tbl_final_vote')->where('election_id',$election_id)->where('voter_id',$this->voter_id)->count();\n if($count > 0){\n Session::put('failed','Sorry ! Sorry You Are Already Given Vote');\n return Redirect::to('choseCandidateType/'.$election_id.'/'.$pin);\n exit(); \n }\n // insert data into final vote\n $result = DB::table('tbl_temp_vote')->where('election_id',$election_id )->where('voter_id',$this->voter_id)->where('pin_no',$pin)->where('session_id',$session_id)->where('random_number',$random_number)->get();\n foreach ($result as $value) {\n $data_insert = array();\n $data_insert['election_id'] = $election_id ;\n $data_insert['post_id'] = $value->post_id ;\n $data_insert['candidate_id'] = $value->candidate_id ;\n $data_insert['voter_id'] = $this->voter_id ;\n $data_insert['pin_no'] = $value->pin_no ;\n $data_insert['session_id'] = $value->session_id ;\n $data_insert['created_time'] = $this->current_time;\n $data_insert['created_at'] = $this->rcdate ;\n DB::table('tbl_final_vote')->insert($data_insert);\n }\n DB::table('tbl_temp_vote')->where('voter_id',$this->voter_id)->delete();\n Session::put('succes','Thanks , Finaly Your Vote Count Sucessfully');\n return Redirect::to('/voterDashboard');\n }\n }", "public function testUpdateTaskInstanceVariable()\n {\n }", "function user_vote()\n{\n\n // nonce check for an extra layer of security, the function will exit if it fails\n if (!wp_verify_nonce($_REQUEST['nonce'], \"user_vote_nonce\")) {\n exit(\"nonce error\");\n }\n\n $post_id = $_REQUEST[\"post_id\"];\n $vote_direction = $_REQUEST[\"vote_direction\"];\n\n // fetch vote_count for a post, set it to 0 if it's empty, increment it when a click is registered\n $old_vote_count = get_post_meta($post_id, \"votes\", true);\n $old_vote_count = ($old_vote_count == '') ? 0 : $old_vote_count;\n $new_vote_count = $old_vote_count;\n\n //voted post structure\n //$voted_posts = array(\"1\" => 0, \"5\" => 1, \"7\" => -1);\n\n $previous_vote_direction = get_vote_direction_meta($post_id);\n //if previous vote in middle regular vote apply: $previous_vote_direction == 0\n\n //if vote remove: $vote_direction == $previous_vote_direction\n // add negative vote direction to old vote count\n // set vote direction to middle\n\n //if vote swap: $vote_direction != $previous_vote_direction\n // add 2 times vote directions to old vote count\n // set vote meta to vote direction\n\n if($previous_vote_direction == 0){\n $new_vote_count += $vote_direction;\n set_user_vote_direction($post_id, $vote_direction);\n }elseif ($vote_direction == $previous_vote_direction){\n $new_vote_count = $old_vote_count - $vote_direction;\n set_user_vote_direction($post_id, 0);\n }elseif ($vote_direction != $previous_vote_direction){\n $new_vote_count = $old_vote_count + 2*$vote_direction;\n set_user_vote_direction($post_id, $vote_direction);\n }\n\n\n $vote = update_post_meta($post_id, \"votes\", $new_vote_count);\n\n\n // If above action fails, result type is set to 'error' and vote_count set to old value, if success, updated to new_vote_count\n if ($vote === false) {\n $result['type'] = \"error\";\n $result['vote_count'] = $old_vote_count;\n } else {\n $result['type'] = \"success\";\n $result['vote_count'] = $new_vote_count;\n }\n\n // Check if action was fired via Ajax call. If yes, JS code will be triggered, else the user is redirected to the post page\n if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {\n $result = json_encode($result);\n echo $result;\n } else {\n header(\"Location: \" . $_SERVER[\"HTTP_REFERER\"]);\n }\n\n die();\n}", "public function testShiftTasksOpenOnly() {\n\t\t$milestone1_pre = $this->Milestone->findById(1);\n\t\t$milestone3_pre = $this->Milestone->findById(3);\n\n\t\t$this->assertEqual($milestone1_pre['Tasks'], array(\n\t\t\t'open' => array('numTasks' => '2', 'points' => '0'),\n\t\t\t'in progress' => array('numTasks' => '2', 'points' => '0'),\n\t\t\t'resolved' => array('numTasks' => '1', 'points' => '0'),\n\t\t\t'closed' => array('numTasks' => '1', 'points' => '0'),\n\t\t\t'dropped' => array('numTasks' => '1', 'points' => '0'),\n\t\t));\n\t\t$this->assertEqual($milestone3_pre['Tasks'], array(\n\t\t\t'open' => array('numTasks' => '0', 'points' => '0'),\n\t\t\t'in progress' => array('numTasks' => '0', 'points' => '0'),\n\t\t\t'resolved' => array('numTasks' => '0', 'points' => '0'),\n\t\t\t'closed' => array('numTasks' => '0', 'points' => '0'),\n\t\t\t'dropped' => array('numTasks' => '0', 'points' => '0'),\n\t\t));\n\n\t\t// Shift only the non-resolved/closed tasks and check all is well\n\t\t$this->Milestone->shiftTasks(1, 3, false, array('callbacks' => false));\n\n\t\t$milestone1_post = $this->Milestone->findById(1);\n\t\t$milestone3_post = $this->Milestone->findById(3);\n\t\t$this->assertEqual($milestone1_post['Tasks'], array(\n\t\t\t'open' => array('numTasks' => '0', 'points' => '0'),\n\t\t\t'in progress' => array('numTasks' => '0', 'points' => '0'),\n\t\t\t'resolved' => array('numTasks' => '1', 'points' => '0'),\n\t\t\t'closed' => array('numTasks' => '1', 'points' => '0'),\n\t\t\t'dropped' => array('numTasks' => '0', 'points' => '0'),\n\t\t));\n\t\t$this->assertEqual($milestone3_post['Tasks'], array(\n\t\t\t'open' => array('numTasks' => '2', 'points' => '0'),\n\t\t\t'in progress' => array('numTasks' => '2', 'points' => '0'),\n\t\t\t'resolved' => array('numTasks' => '0', 'points' => '0'),\n\t\t\t'closed' => array('numTasks' => '0', 'points' => '0'),\n\t\t\t'dropped' => array('numTasks' => '1', 'points' => '0'),\n\t\t));\n\t}", "public function testUsersTotpToggle()\n {\n // TODO: implement\n $this->markTestIncomplete('Not implemented');\n }", "public function testGetParliamentaryCandidateWithVoteCast()\n {\n $pollingStation = $this->em->getRepository('VtallyBundle:PollingStation')->find(1);\n $candidates = $pollingStation->getParliamentaryCandidateWithVoteCast();\n $this->assertEquals($candidates[0]->getFirstName(), 'Jhon');\n $this->assertEquals($candidates[0]->getVoteCast(), 100);\n $this->assertEquals($candidates[1]->getFirstName(), 'Jannette');\n $this->assertEquals($candidates[1]->getVoteCast(), 280);\n $this->assertEquals($candidates[2]->getFirstName(), 'Sondra');\n $this->assertEquals($candidates[2]->getVoteCast(), 98);\n $this->assertEquals($candidates[3]->getFirstName(), 'Fadde');\n $this->assertEquals($candidates[3]->getVoteCast(), 0);\n $this->assertEquals($candidates[4]->getFirstName(), 'Vivien');\n $this->assertEquals($candidates[4]->getVoteCast(), 100);\n $this->assertEquals($candidates[5]->getFirstName(), 'Joella');\n $this->assertEquals($candidates[5]->getVoteCast(), 7);\n $this->assertEquals($candidates[6]->getFirstName(), 'Adde');\n $this->assertEquals($candidates[6]->getVoteCast(), 2);\n }", "public function testStatusConfirm()\n {\n\n }", "public function testGeTaskVariableData()\n {\n }", "public function getTestStatus()\n {\n switch ($this->getData('status')) {\n case 0:\n return 'Stopped';\n case 1:\n return 'Running';\n case 2:\n return 'Paused';\n }\n }", "public function checkTransition($model, $stateChange, $sourceState, $confirmed = true);", "function block_core_calendar_update_has_published_post_on_transition_post_status($new_status, $old_status, $post)\n {\n }", "public function alive()\n {\n $this->assert();\n $this->task->setState($this->task->getState());\n $this->taskRepository->update($this->task);\n }", "public function test_a_user_can_toggle_posts(){\n \n //we have a signed in user\n \n //user likes the model\n $this->post->toggle();\n\n $this->assertTrue($this->post->isLiked());\n\n $this->post->toggle();\n\n $this->assertFalse($this->post->isLiked());\n }", "public function testRejectedTransation()\n {\n $precondition = Factory::instance('RejectedTransaction');\n\n $testdata = $precondition->getData();\n\n $this->assertTrue($testdata['amount'] == 51.03);\n }", "public function testGetStatus()\n {\n // Case: There is not a DIF set for this Dataset.\n\n $this->dataset->setDif($this->mockDifNStatusUnsubmitted);\n\n $this->assertEquals(\n 'NoDif',\n $this->dataset->getStatus()\n );\n\n // Case: Dif is approved && dataset status is not one of the valid process status\n $this->dataset->setDif($this->mockApprovedDif);\n $this->dataset->setDatasetStatus(13);\n $this->assertEquals(\n 'DIF',\n $this->dataset->getStatus()\n );\n\n // Case: Dif is approved && dataset statusis in review\n $this->dataset->setDif($this->mockApprovedDif);\n $this->dataset->setDatasetStatus(Dataset::DATASET_STATUS_IN_REVIEW);\n $this->assertEquals(\n 'In Review',\n $this->dataset->getStatus()\n );\n\n // Case: Dif is approved && dataset status is back to submitter\n $this->dataset->setDif($this->mockApprovedDif);\n $this->dataset->setDatasetStatus(Dataset::DATASET_STATUS_BACK_TO_SUBMITTER);\n $this->assertEquals(\n 'Back to Submitter',\n $this->dataset->getStatus()\n );\n\n // Case: Dif is approved && dataset status is accepted && availability status is restricted distribution\n $this->dataset->setDif($this->mockApprovedDif);\n $this->dataset->setDatasetStatus(Dataset::DATASET_STATUS_ACCEPTED);\n $this->dataset->setAvailabilityStatus(DatasetSubmission::AVAILABILITY_STATUS_RESTRICTED);\n $this->assertEquals(\n 'Completed, Restricted',\n $this->dataset->getStatus()\n );\n\n // Case: Dif is approved && dataset status is accepted && availability status is remotelyhosted distribution\n $this->dataset->setDif($this->mockApprovedDif);\n $this->dataset->setDatasetStatus(Dataset::DATASET_STATUS_ACCEPTED);\n $this->dataset->setAvailabilityStatus(DatasetSubmission::AVAILABILITY_STATUS_RESTRICTED_REMOTELY_HOSTED);\n $this->assertEquals(\n 'Completed, Restricted',\n $this->dataset->getStatus()\n );\n\n // Case: Dif is approved && dataset status is accepted && availability status is publicly available\n $this->dataset->setDif($this->mockApprovedDif);\n $this->dataset->setDatasetStatus(Dataset::DATASET_STATUS_ACCEPTED);\n $this->dataset->setAvailabilityStatus(DatasetSubmission::AVAILABILITY_STATUS_PUBLICLY_AVAILABLE);\n $this->assertEquals(\n 'Completed',\n $this->dataset->getStatus()\n );\n\n // Case: Dif is approved &&\n // dataset status is accepted &&\n // availability status is publicly available remotely hosted\n $this->dataset->setDif($this->mockApprovedDif);\n $this->dataset->setDatasetStatus(Dataset::DATASET_STATUS_ACCEPTED);\n $this->dataset->setAvailabilityStatus(\n DatasetSubmission::AVAILABILITY_STATUS_PUBLICLY_AVAILABLE_REMOTELY_HOSTED\n );\n $this->assertEquals(\n 'Completed',\n $this->dataset->getStatus()\n );\n\n\n // Case: Dif is approved &&\n // dataset status is accepted &&\n // availability status is something other than expected\n $this->dataset->setDif($this->mockApprovedDif);\n $this->dataset->setDatasetStatus(Dataset::DATASET_STATUS_ACCEPTED);\n $this->dataset->setAvailabilityStatus(0);\n $this->assertEquals(\n 'DIF',\n $this->dataset->getStatus()\n );\n }", "public function testShiftTasksNothingToShift() {\n\t\t$milestone5_pre = $this->Milestone->findById(5);\n\t\t$milestone1_pre = $this->Milestone->findById(1);\n\n\t\t$this->assertEqual($milestone5_pre['Tasks'], array(\n\t\t\t'open' => array('numTasks' => '0', 'points' => '0'),\n\t\t\t'in progress' => array('numTasks' => '0', 'points' => '0'),\n\t\t\t'resolved' => array('numTasks' => '0', 'points' => '0'),\n\t\t\t'closed' => array('numTasks' => '0', 'points' => '0'),\n\t\t\t'dropped' => array('numTasks' => '0', 'points' => '0'),\n\t\t));\n\t\t$this->assertEqual($milestone1_pre['Tasks'], array(\n\t\t\t'open' => array('numTasks' => '2', 'points' => '0'),\n\t\t\t'in progress' => array('numTasks' => '2', 'points' => '0'),\n\t\t\t'resolved' => array('numTasks' => '1', 'points' => '0'),\n\t\t\t'closed' => array('numTasks' => '1', 'points' => '0'),\n\t\t\t'dropped' => array('numTasks' => '1', 'points' => '0'),\n\t\t));\n\n\t\t// Shift only the non-resolved/closed tasks and check all is well\n\t\t$this->Milestone->shiftTasks(5, 1, false, array('callbacks' => false));\n\n\t\t$milestone5_post = $this->Milestone->findById(5);\n\t\t$milestone1_post = $this->Milestone->findById(1);\n\t\t$this->assertEqual($milestone5_post['Tasks'], array(\n\t\t\t'open' => array('numTasks' => '0', 'points' => '0'),\n\t\t\t'in progress' => array('numTasks' => '0', 'points' => '0'),\n\t\t\t'resolved' => array('numTasks' => '0', 'points' => '0'),\n\t\t\t'closed' => array('numTasks' => '0', 'points' => '0'),\n\t\t\t'dropped' => array('numTasks' => '0', 'points' => '0'),\n\t\t));\n\t\t$this->assertEqual($milestone1_post['Tasks'], array(\n\t\t\t'open' => array('numTasks' => '2', 'points' => '0'),\n\t\t\t'in progress' => array('numTasks' => '2', 'points' => '0'),\n\t\t\t'resolved' => array('numTasks' => '1', 'points' => '0'),\n\t\t\t'closed' => array('numTasks' => '1', 'points' => '0'),\n\t\t\t'dropped' => array('numTasks' => '1', 'points' => '0'),\n\t\t));\n\t}", "public function testStatusOption()\n {\n $user = factory(User::class)->create();\n $lease = factory(Lease::class)->create();\n }", "public function testGetTask()\n {\n }", "protected function amount_transition_status() {\n\t\t$amount_transition_status = $this->amount_transition_status ;\n\n\t\t// Reset status transition variable.\n\t\t$this->amount_transition_status = false ;\n\n\t\tif ( ! $amount_transition_status ) {\n\t\t\treturn ;\n\t\t}\n\n\t\tdo_action( 'wc_cs_admin_funds_txn_amount_status_' . $amount_transition_status, $this ) ;\n\t}", "function TestGetState1(){\n\t\t$newAnswer = new Answer();\n\t\t$this->assertTrue($newAnswer->getState() == FALSE);\n }", "function _transition_post_status($new_status, $old_status, $post)\n {\n }", "public function testShiftTasksAll() {\n\t\t$milestone1_pre = $this->Milestone->findById(1);\n\t\t$milestone3_pre = $this->Milestone->findById(3);\n\n\t\t$this->assertEqual($milestone1_pre['Tasks'], array(\n\t\t\t'open' => array('numTasks' => '2', 'points' => '0'),\n\t\t\t'in progress' => array('numTasks' => '2', 'points' => '0'),\n\t\t\t'resolved' => array('numTasks' => '1', 'points' => '0'),\n\t\t\t'closed' => array('numTasks' => '1', 'points' => '0'),\n\t\t\t'dropped' => array('numTasks' => '1', 'points' => '0'),\n\t\t));\n\t\t$this->assertEqual($milestone3_pre['Tasks'], array(\n\t\t\t'open' => array('numTasks' => '0', 'points' => '0'),\n\t\t\t'in progress' => array('numTasks' => '0', 'points' => '0'),\n\t\t\t'resolved' => array('numTasks' => '0', 'points' => '0'),\n\t\t\t'closed' => array('numTasks' => '0', 'points' => '0'),\n\t\t\t'dropped' => array('numTasks' => '0', 'points' => '0'),\n\t\t));\n\t\t$this->Milestone->shiftTasks(1, 3, true, array('callbacks' => false));\n\n\t\t$milestone1_post = $this->Milestone->findById(1);\n\t\t$milestone3_post = $this->Milestone->findById(3);\n\t\t$this->assertEqual($milestone1_post['Tasks'], array(\n\t\t\t'open' => array('numTasks' => '0', 'points' => '0'),\n\t\t\t'in progress' => array('numTasks' => '0', 'points' => '0'),\n\t\t\t'resolved' => array('numTasks' => '0', 'points' => '0'),\n\t\t\t'closed' => array('numTasks' => '0', 'points' => '0'),\n\t\t\t'dropped' => array('numTasks' => '0', 'points' => '0'),\n\t\t));\n\t\t$this->assertEqual($milestone3_post['Tasks'], array(\n\t\t\t'open' => array('numTasks' => '2', 'points' => '0'),\n\t\t\t'in progress' => array('numTasks' => '2', 'points' => '0'),\n\t\t\t'resolved' => array('numTasks' => '1', 'points' => '0'),\n\t\t\t'closed' => array('numTasks' => '1', 'points' => '0'),\n\t\t\t'dropped' => array('numTasks' => '1', 'points' => '0'),\n\t\t));\n\t}", "public function testPending()\n {\n $this->assertTrue($this->kittyUser->isPending());\n $returnedKittyUser = $this->kittyUser->setPending(false);\n $this->assertSame($this->kittyUser, $returnedKittyUser);\n $this->assertFalse($this->kittyUser->isPending());\n }", "public function testJobListPreparationAndReleaseTaskStatus()\n {\n\n }", "public function testGetState()\n {\n $filter = new Range();\n $filter->setRequestField('range');\n $state = $filter->getState(new Request(['range' => 'testValue']));\n\n $this->assertFalse($state->isActive());\n }", "public function testIsMarkedUndoneIfDone()\n {\n $this->addTestFixtures();\n $id = $this->task->getId();\n $title = $this->task->getTitle();\n $this->task->setIsDone(true);\n $this->logInAsUser();\n $this->client->request('GET', '/tasks/'.$id.'/toggle');\n\n $isDone = $this->task->getIsDone();\n\n $statusCode = $this->client->getResponse()->getStatusCode();\n $this->assertEquals(302, $statusCode);\n\n $crawler = $this->client->followRedirect();\n $response = $this->client->getResponse();\n $statusCode = $response->getStatusCode();\n\n $this->assertEquals(200, $statusCode);\n $this->assertEquals(false, $isDone);\n $this->assertContains('Superbe! La tâche '.$title.' a bien été marquée comme à faire.', $crawler->filter('div.alert.alert-success')->text());\n }", "public function test_a_user_can_vote_for_a_post()\n {\n $user = $this->defaultUser();\n\n $post = $this->createPost();\n\n $this->browse(function (Browser $browser) use($user,$post) {\n $browser->loginAs($user)\n ->visit($post->url)\n ->pressAndWaitFor('+1')\n ->assertSeeIn('current-vote',1);\n });\n }", "public function testWebinarPollUpdate()\n {\n }", "public function testWebinarStatus()\n {\n }", "public function testIsMarkedDoneIfUndone()\n {\n $this->addTestFixtures();\n $id = $this->task->getId();\n $title = $this->task->getTitle();\n $this->logInAsUser();\n $this->client->request('GET', '/tasks/'.$id.'/toggle');\n\n $isDone = $this->task->getIsDone();\n\n $statusCode = $this->client->getResponse()->getStatusCode();\n $this->assertEquals(302, $statusCode);\n\n $crawler = $this->client->followRedirect();\n $response = $this->client->getResponse();\n $statusCode = $response->getStatusCode();\n\n $this->assertEquals(200, $statusCode);\n $this->assertEquals(true, $isDone);\n $this->assertContains('Superbe! La tâche '.$title.' a bien été marquée comme faite.', $crawler->filter('div.alert.alert-success')->text());\n }", "public function testUpdateTask()\n {\n }", "public function testGet()\n\t{ \n\t\t$c = get_c();\n\n\t\t$result = $c->PostTask('tasks.add_delayed', array(4,4));\n\t\t$this->assertFalse($result->ready());\n\t\t$this->assertNull($result->result); \n\t\t$rv = $result->get();\n\t\t$this->assertEquals(8, $rv);\n\t\t$this->assertEquals(8, $result->result);\n\t\t$this->assertTrue($result->successful());\n\t}", "public static function task_checked($data=array())\n {\n $res = Utility::loadByHttp(Config::get(self::API_URL_CONF).\"step/query_approved_step_info\",$data,'GET');\n return $res;\n }", "public function voteAction()\n {\n\n }", "public function testStorepostsCheckCustomerVotingAfterDBIsection() {\n $baseUrl = $this->getContainer()->getParameter('symfony_base_url');\n $acess_token = $this->getContainer()->getParameter('access_token');\n $serviceUrl = $baseUrl . 'api/storeposts?access_token='.$acess_token;\n $data = '{\"reqObj\":{\"store_id\":1495,\"post_title\":\"currently Not in used from frontend\",\"post_desc\":\"live news\",\"user_id\":1,\"post_id\":\"\",\"post_type\":1,\"youtube\":\"\",\"media_id\":[],\"link_type\":0,\"share_type\":\" txn \",\"device_request_type\":\"mobile\",\"customer_voting\":5}}';\n $data_array = json_decode($data);\n $data_array = $data_array->reqObj;\n $customer_voting = $data_array->customer_voting;\n $client = new CurlRequestService();\n $response = $client->send('POST', $serviceUrl, array(), $data)\n ->getResponse();\n $response = json_decode($response);\n $response_data = $response->data;\n $this->assertEquals($customer_voting, $response_data->customer_voting);\n }", "public function on_all_status_transitions( $new_status, $old_status, $post ){\n\t\tif ( $new_status != $old_status ) {\n\t\t\tif( $new_status == 'pending' ) {\n\t\t\t\t$result = $this->post_to_discord( 'Pending: ' . $post->post_title . ' -- ' . get_edit_post_link( $post->ID, '&' ) );\n\t\t\t}\n\t\t}\n\t}", "public function testWorkflowsPost()\n {\n }", "public function test_message_can_be_upvoted() {\n\n $user = User::create('[email protected]', 'secret', 'Jane Doe');\n $this->message->upvote($user);\n $this->assertEquals(1, $this->message->getUpvotes());\n\n }", "public function postvoting()\n {\n $userid = Auth::user()->id; \n $reviewid = Input::get('review_id');\n $vote = Input::get('vote');\n\n $status = Vote::where('user_id', $userid)->where('review_id',$reviewid)->pluck('vote'); \n\n $up = Review::where('id',$reviewid)->pluck('upvote');\n $down = Review::where('id',$reviewid)->pluck('downvote');\n\n if($status == NULL)\n { \n\n $this->vote->user_id = $userid;\n $this->vote->review_id = $reviewid;\n $this->vote->vote = $vote;\n $this->vote->save();\n\n if($vote == 1)\n Review::where('id',$reviewid)->update(array('upvote' => ($up + 1)));\n else\n Review::where('id', $reviewid)->update(array('downvote' => ($down +1))); \n\n } \n\n else if($status != $vote)\n {\n Vote::where('user_id',$userid)->where('review_id',$reviewid)->update(array('vote' => $vote)); \n\n if($vote == 1)\n {\n Review::where('id',$reviewid)->update(array('upvote' => ($up + 1), 'downvote' =>($down -1)));\n }\n else\n {\n Review::where('id', $reviewid)->update(array('downvote' => ($down +1),'upvote' =>($up -1))); \n } \n }\n else\n {\n Vote::where('user_id',$userid)->where('review_id',$reviewid)->delete();\n\n\n if($vote == 1)\n Review::where('id',$reviewid)->update(array('upvote' => ($up - 1)));\n else\n Review::where('id', $reviewid)->update(array('downvote' => ($down -1))); \n\n\n\n }\n\n $up = Review::where('id',$reviewid)->pluck('upvote');\n $down = Review::where('id',$reviewid)->pluck('downvote');\n\n Review::where('id', $reviewid)->update(array('popularity_index' => ($up - $down))); \n\n }", "public function assertSentToVoted()\n {\n return (null !== $this->votesYes && null !== $this->votesNo) ? true : false;\n }", "public function testDeleteTask()\n {\n }", "public function testGetTasks()\n {\n }", "function updateTask() {\n\t\t$rating = $this -> getTaskRating();\n\t\tif (!is_null($this -> data)) {\n\t\t\tif (!empty($this -> data)) {\n\t\t\t\t//if user has not missed any events and not added any events rate his task with 1\n\t\t\t\tif ($this -> missed == 0) {\n\t\t\t\t\tif (empty($this -> rating)) {\n\t\t\t\t\t\t$rating = 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t$sql = \"UPDATE Task SET rating =\" . $rating . \", isRated=1, missed=\" . $this -> missed . \" WHERE TaskId=\" . $this -> data[0]['TaskId'];\n\t\t\t\t$stmt = $this -> DB -> prepare($sql);\n\t\t\t\tif ($stmt -> execute()) {\n\t\t\t\t\t$this -> updateUser();\n\t\t\t\t} else {\n\t\t\t\t\tinclude_once \"Email.php\";\n\t\t\t\t\tnew Email('failed', 'update task with id=' . $this -> data[0]['TaskId'] . ' error' . $stmt -> errorInfo(), $this -> id);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tinclude_once \"Email.php\";\n\t\t\t\tnew Email('failed', 'update task, data is empty error', $this -> id);\n\t\t\t}\n\t\t} else {\n\t\t\tinclude_once \"Email.php\";\n\t\t\tnew Email('failed', 'update task, data is empty', $this -> id);\n\t\t}\n\t}", "function block_core_calendar_update_has_published_post_on_transition_post_status( $new_status, $old_status, $post ) {\n\t\tif ( $new_status === $old_status ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( 'post' !== get_post_type( $post ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( 'publish' !== $new_status && 'publish' !== $old_status ) {\n\t\t\treturn;\n\t\t}\n\n\t\tblock_core_calendar_update_has_published_posts();\n\t}", "public function testListTaskVariables()\n {\n }", "public function compareTask()\n\t{\n\t\t$lft = Request::getInt('left', 0);\n\t\t$rgt = Request::getInt('right', 0);\n\n\t\t// Make sure we have values for both sides\n\t\tif (!$lft || !$rgt)\n\t\t{\n\t\t\tNotify::error(Lang::txt('COM_PUBLICATIONS_ERROR_MISSING_VERSION'));\n\n\t\t\tApp::redirect(\n\t\t\t\tRoute::url('index.php?option=' . $this->_option)\n\t\t\t);\n\t\t}\n\n\t\t// Can't compare against itself\n\t\tif ($lft == $rgt)\n\t\t{\n\t\t\tNotify::error(Lang::txt('COM_PUBLICATIONS_ERROR_SAME_VERSIONS'));\n\n\t\t\tApp::redirect(\n\t\t\t\tRoute::url('index.php?option=' . $this->_option)\n\t\t\t);\n\t\t}\n\n\t\t// Get our model and load publication data\n\t\tinclude_once dirname(dirname(__DIR__)) . '/models/orm/publication.php';\n\n\t\t// Load the lft version and make sure the user has access\n\t\t$lversion = Models\\Orm\\Version::oneOrFail($lft);\n\t\t$lpublica = $lversion->publication;\n\n\t\tif (!$lversion->get('id') || $lversion->isDeleted()\n\t\t || !$lpublica->get('id'))\n\t\t{\n\t\t\tNotify::error(Lang::txt('COM_PUBLICATIONS_RESOURCE_NOT_FOUND'));\n\n\t\t\tApp::redirect(\n\t\t\t\tRoute::url('index.php?option=' . $this->_option)\n\t\t\t);\n\t\t}\n\n\t\t// Load the rgt version and make sure the user has access\n\t\t$rversion = Models\\Orm\\Version::oneOrFail($rgt);\n\n\t\tif (!$rversion->get('id') || $rversion->isDeleted())\n\t\t{\n\t\t\tNotify::error(Lang::txt('COM_PUBLICATIONS_RESOURCE_NOT_FOUND'));\n\n\t\t\tApp::redirect(\n\t\t\t\tRoute::url('index.php?option=' . $this->_option)\n\t\t\t);\n\t\t}\n\n\t\t$rpublica = new Models\\Publication(null, 'default', $rversion->get('id'));\n\n\t\tif (!$rpublica->access('view'))\n\t\t{\n\t\t\treturn $this->_blockAccess();\n\t\t}\n\n\t\t$rpublica->setCuration();\n\t\t$customFields = json_decode($rpublica->_curationModel->getMetaSchema(), true);\n\n\t\t// Diff the two versions\n\t\trequire_once dirname(dirname(__DIR__)) . '/helpers/Diff.php';\n\t\trequire_once dirname(dirname(__DIR__)) . '/helpers/Diff/Renderer/Html/SideBySide.php';\n\n\t\t$diffs = array();\n\n\t\t$l = explode(\"\\n\", $lversion->get('title'));\n\t\t$r = explode(\"\\n\", $rversion->get('title'));\n\n\t\t$diff = new \\Diff($l, $r);\n\t\t$diffs['title'] = $diff->render(new \\Diff_Renderer_Html_SideBySide);\n\n\t\t$l = array();\n\t\tforeach ($lversion->authors as $author)\n\t\t{\n\t\t\t$l[] = $author->get('name') . ' (' . $author->get('organization') . ')';\n\t\t}\n\t\t$r = array();\n\t\tforeach ($rversion->authors as $author)\n\t\t{\n\t\t\t$r[] = $author->get('name') . ' (' . $author->get('organization') . ')';\n\t\t}\n\n\t\t$diff = new \\Diff($l, $r);\n\t\t$diffs['authors'] = $diff->render(new \\Diff_Renderer_Html_SideBySide);\n\n\t\t$l = explode(\"\\n\", $lversion->get('description'));\n\t\t$r = explode(\"\\n\", $rversion->get('description'));\n\n\t\t$diff = new \\Diff($l, $r);\n\t\t$diffs['description'] = $diff->render(new \\Diff_Renderer_Html_SideBySide);\n\n\t\t$diffs['metadata'] = array();\n\n\t\t$lmetadata = $lversion->metadata;\n\t\t$rmetadata = $rversion->metadata;\n\t\tforeach ($lmetadata as $key => $l)\n\t\t{\n\t\t\t$r = (isset($rmetadata[$key]) ? $rmetadata[$key] : '');\n\t\t\t$l = explode(\"\\n\", $l);\n\t\t\t$r = explode(\"\\n\", $r);\n\n\t\t\t$diff = new \\Diff($l, $r);\n\t\t\t$diffs['metadata'][$key] = $diff->render(new \\Diff_Renderer_Html_SideBySide);\n\t\t}\n\n\t\tforeach ($rmetadata as $key => $r)\n\t\t{\n\t\t\tif (isset($diffs['metadata'][$key]))\n\t\t\t{\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t$l = (isset($lmetadata[$key]) ? $lmetadata[$key] : '');\n\t\t\t$l = explode(\"\\n\", $l);\n\t\t\t$r = explode(\"\\n\", $r);\n\n\t\t\t$diff = new \\Diff($l, $r);\n\t\t\t$diffs['metadata'][$key] = $diff->render(new \\Diff_Renderer_Html_SideBySide);\n\t\t}\n\n\t\t// Set the pathway\n\t\tif (Pathway::count() <= 0)\n\t\t{\n\t\t\tPathway::append(\n\t\t\t\tLang::txt(strtoupper($this->_option)),\n\t\t\t\t'index.php?option=' . $this->_option\n\t\t\t);\n\t\t}\n\t\tPathway::append(\n\t\t\tLang::txt(strtoupper($this->_option . '_' . $this->_task)),\n\t\t\t'index.php?option=' . $this->_option . '&task=' . $this->_task . '&lft=' . $lft . '&rgt=' . $rgt\n\t\t);\n\n\t\t// Display the view\n\t\t$this->view\n\t\t\t->set('lft', $lversion)\n\t\t\t->set('rgt', $rversion)\n\t\t\t->set('diffs', $diffs)\n\t\t\t->set('customFields', $customFields)\n\t\t\t->display();\n\t}", "public function testGetTaskInstanceIdentityLinks()\n {\n }", "public function testAdultUsersCanSeeTaskList()\n {\n $this->withoutExceptionHandling();\n Task::factory(3)->create();\n $adult = User::create([\n 'name' => 'vanessa',\n 'role' => 'adult',\n 'points' => 0,\n 'email' => '[email protected]',\n 'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi',\n 'remember_token' => Str::random(10)\n ]);\n\n $response = $this->actingAs($adult)\n ->get(route('dashboard.tasks'));\n $response->assertStatus(200)\n ->assertViewIs('dashboard.task-list')\n ->assertViewHas('taskList');\n }", "public function timeline_tasks()\n {\n $user = factory(User::class)->create();\n\n $this->actingAs($user);\n\n $task = factory(Task::class)->create();\n \n// $task = Task::create([\n// 'name' => 'New Task',\n// 'description' => 'prova',\n// 'completed' => true,\n// 'user_id' => $user->id\n// ]);\n \n// $task2 = Task::find($task->id);\n\n $response = $this->get('tasks/timeline');\n\n $task_event = TaskEvent::all();\n\n $response->assertSuccessful();\n $response->assertViewIs('tasks.timeline');\n $response->assertViewHas('task_event', $task_event);\n $response->assertSee(\"User \".$user->name.\" created task \".$task->name.\" at \".$task->created_at);\n $response->assertSee(\"User \".$user->name.\" updated task \".$task->name);\n $response->assertSee(\"User \".$user->name.\" deleted task \".$task->name);\n }", "function tribe_events_views_v2_smart_activation() {\n\t/**\n\t * Allows filtering of the Events Views V2 smart activation..\n\t *\n\t * @since 4.9.13\n\t *\n\t * @param boolean $enabled Determining if V2 Views is enabled\\\n\t */\n\t$should_smart_activate = apply_filters( 'tribe_events_views_v2_should_smart_activate', true );\n\n\tif ( ! $should_smart_activate ) {\n\t\treturn false;\n\t}\n\n\tif ( tribe_events_views_v2_is_enabled() ) {\n\t\treturn false;\n\t}\n\n\tif ( ! tribe_events_is_new_install() ) {\n\t\treturn false;\n\t}\n\n\t$current_status = tribe_get_option( Manager::$option_enabled, null );\n\n\t// Only update when value is either null or empty string.\n\tif ( null !== $current_status && '' !== $current_status ) {\n\t\treturn false;\n\t}\n\n\t$status = tribe_update_option( Manager::$option_enabled, true );\n\n\tif ( $status ) {\n\t\t// Update the default posts_per_page to 12\n\t\ttribe_update_option( 'postsPerPage', 12 );\n\n\t\t// Update default events per day on month view amount to 3\n\t\ttribe_update_option( 'monthEventAmount', 3 );\n\t}\n\n\treturn $status;\n}", "public function calculate_votes()\r\n\t{\r\n\t\t$this->votes_total = $this->votes_up + $this->votes_down;\r\n\t\t$this->votes_balance = $this->votes_up - $this->votes_down;\r\n\r\n\t\t// Note: division by zero must be prevented\r\n\t\t$this->votes_pct_up = ($this->votes_total === 0) ? 0 : $this->votes_up / $this->votes_total * 100;\r\n\t\t$this->votes_pct_down = ($this->votes_total === 0) ? 0 : $this->votes_down / $this->votes_total * 100;\r\n\t}", "public function newTask(){\n if (!$this->validate()) {\n return null;\n }\n \n if( $activity = $this->saveTask() ){\n if($this->type == 'technique'){\n if(!$this->saveDevs()){ \n return null;\n }\n } \n return $activity; \n }\n return null; \n }", "public function testGetResumedState()\n\t{\n\t\t$this->assertInstanceOf('PNEngineStateResumed', $this->object->getResumedState());\n\n\t\tTestReflection::setValue($this->object, 'resumedState', true);\n\t\t$this->assertTrue($this->object->getResumedState());\n\t}", "private function processNotificationsToBeSent()\n {\n if (array_key_exists('status', $this->originalAttributeValues))\n {\n if ($this->status == Task::STATUS_AWAITING_ACCEPTANCE &&\n $this->requestedByUser->id != Yii::app()->user->userModel->id)\n {\n TasksNotificationUtil::submitTaskNotificationMessage($this,\n TasksNotificationUtil::TASK_STATUS_BECOMES_AWAITING_ACCEPTANCE,\n Yii::app()->user->userModel);\n }\n elseif ($this->status == Task::STATUS_REJECTED &&\n $this->owner->id != Yii::app()->user->userModel->id)\n {\n TasksNotificationUtil::submitTaskNotificationMessage($this,\n TasksNotificationUtil::TASK_STATUS_BECOMES_REJECTED,\n Yii::app()->user->userModel);\n }\n elseif ($this->status == Task::STATUS_COMPLETED)\n {\n TasksNotificationUtil::submitTaskNotificationMessage($this,\n TasksNotificationUtil::TASK_STATUS_BECOMES_COMPLETED,\n Yii::app()->user->userModel);\n }\n }\n if ($this->isNewModel)\n {\n if ($this->owner->id != $this->requestedByUser->id && $this->owner->id != Yii::app()->user->userModel->id)\n {\n TasksNotificationUtil::submitTaskNotificationMessage($this,\n TasksNotificationUtil::TASK_NEW);\n }\n }\n elseif (array_key_exists('owner', $this->originalAttributeValues))\n {\n if ($this->requestedByUser->id != Yii::app()->user->userModel->id)\n {\n TasksNotificationUtil::submitTaskNotificationMessage($this,\n TasksNotificationUtil::TASK_OWNER_CHANGE);\n }\n if ($this->owner->id != Yii::app()->user->userModel->id)\n {\n TasksNotificationUtil::submitTaskNotificationMessage($this,\n TasksNotificationUtil::TASK_NEW);\n }\n }\n }", "function getTaskRating() {\n\t\t$rating = -$this -> missed * 0.5;\n\t\tforeach ($this->data as $i => $row) {\n\t\t\t//if a event does belong to a ground truth event take the calculated value. Otherwise set its rating to -0.5\n\t\t\tif (!is_null($row['EventId'])) {\n\t\t\t\tif (array_key_exists($i, $this -> rating)) {\n\t\t\t\t\t$rating = $rating + $this -> rating[$i];\n\t\t\t\t} else {\n\t\t\t\t\t$rating = $rating - 0.5;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn $rating;\n\t}", "public function onGenericPostTransition(WorkflowTransitionEvent $event) {\n $this->setMessage($event, 'generic post-transition');\n }", "public function testReviewActionDisableSwarmCommit()\n {\n $this->createChange();\n\n $review = Review::createFromChange('1');\n $review->setPending(true);\n $review->save();\n\n $this->dispatch('/reviews/2');\n $result = $this->getResult();\n $this->assertRoute('review');\n $this->assertRouteMatch('reviews', 'reviews\\controller\\indexcontroller', 'review');\n $this->assertResponseStatusCode(200);\n $this->assertInstanceOf('Zend\\View\\Model\\ViewModel', $result);\n\n $transitions = $result->getVariable('transitions');\n $transitionKeys = array_keys($transitions);\n\n $filteredTransitions = array_filter(\n $transitionKeys,\n function ($val) {\n return false !== strpos($val, ':commit');\n }\n );\n $filteredTransitions = array_values($filteredTransitions);\n\n $this->assertSame(\n array('approved:commit'),\n $filteredTransitions,\n 'disable_commit=false (default) setting failed to show approved:commit transition'\n );\n\n $services = $this->getApplication()->getServiceManager();\n\n // Now override the service container to disable commits, so we can confirm the expected behaviour.\n $config = $services->get('config');\n $config['reviews']['disable_commit'] = true;\n $services->setService('config', $config);\n\n $this->dispatch('/reviews/2');\n $result = $this->getResult();\n $this->assertRoute('review');\n $this->assertRouteMatch('reviews', 'reviews\\controller\\indexcontroller', 'review');\n $this->assertResponseStatusCode(200);\n $this->assertInstanceOf('Zend\\View\\Model\\ViewModel', $result);\n\n $transitions = $result->getVariable('transitions');\n $transitionKeys = array_keys($transitions);\n\n $filteredTransitions = array_filter(\n $transitionKeys,\n function ($val) {\n return false !== strpos($val, ':commit');\n }\n );\n\n $filteredTransitions = array_values($filteredTransitions);\n\n $this->assertSame(\n array(),\n $filteredTransitions,\n 'disable_commit=true setting failed to hide approved:commit transition'\n );\n }", "public function testTask()\n\t{\n \n //Need also define the ssh keys and password in config.php\n \n //Insert first a task\n \n /*$arr_task=['name_task' => 'live', 'descripton_task' => 'Script for check if server is alive', 'arguments' => [], 'status' => 0, 'url_return' => '', 'server' => SERVER_REMOTE];\n \n $new_task=$m->task->insert($arr_task);\n \n $id=$m->task->insert_id();\n \n $this->assertNotFalse($new_task);\n \n $arr_task['IdTask']=$id;*/\n \n //Select task from db\n \n //Execute task\n \n $task=new Task(SERVER_REMOTE);\n \n $task->files=[['vendor/phangoapp/leviathan/tests/script/alive.sh', 0755]];\n \n $task->commands_to_execute=[['/bin/bash', 'vendor/phangoapp/leviathan/tests/script/alive.sh', ''], ['sudo', 'vendor/phangoapp/leviathan/tests/script/alive.sh', '']];\n \n $task->delete_files=['vendor/phangoapp/leviathan/tests/script/alive.sh'];\n \n $task->delete_directories=['vendor/phangoapp/leviathan/tests'];\n \n $task->name_task='Live';\n \n $task->description_task='Check if server is alive';\n \n $task->codename_task='live';\n \n $result=$task->exec();\n \n echo $task->txt_error;\n \n $this->assertTrue($result);\n \n \n \n }", "function isApproved() {\n return $this->getStatus() == UserpointsTransaction::STATUS_APPROVED;\n }", "public function testCanTriggerSnapshotOnDemand() {\n AuthenticationHelper::login(\"[email protected]\", \"password\");\n\n $dataSetInstanceSummary = new DatasetInstanceSummary(\"Test dataset\", \"test-json\", null, [], [], []);\n $datasetInstanceId = $this->datasetService->saveDataSetInstance($dataSetInstanceSummary, null, 1);\n\n $snapshotProfileSummary = new DatasetInstanceSnapshotProfileSummary(\"Daily Snapshot\", \"tabulardatasetsnapshot\", [\n ], DatasetInstanceSnapshotProfileSummary::TRIGGER_ADHOC);\n\n $snapshotProfileId = $this->datasetService->saveSnapshotProfile($snapshotProfileSummary, $datasetInstanceId);\n\n /**\n * @var DatasetInstanceSnapshotProfile $reSnapshot\n */\n $reSnapshot = DatasetInstanceSnapshotProfile::fetch($snapshotProfileId);\n $this->assertNull($reSnapshot->getScheduledTask()->getNextStartTime());\n\n // Set scheduled task to completed so we see the status change at the end\n $reSnapshot->getScheduledTask()->setStatus(ScheduledTask::STATUS_COMPLETED);\n $reSnapshot->getScheduledTask()->save();\n\n $this->datasetService->triggerSnapshot($datasetInstanceId, $snapshotProfileId);\n\n /**\n * @var DatasetInstanceSnapshotProfile $triggeredProfile\n */\n $triggeredProfile = DatasetInstanceSnapshotProfile::fetch($snapshotProfileId);\n\n $nextStartTime = $triggeredProfile->getScheduledTask()->getNextStartTime();\n $this->assertTrue(date(\"U\") - $nextStartTime->format(\"U\") >= 0);\n $this->assertEquals(ScheduledTask::STATUS_PENDING, $triggeredProfile->getScheduledTask()->getStatus());\n\n\n }", "function testGetState2(){\n \t$existingAnswer = new Answer(2); //Answer of formdest_id = 2\n\t\t$this->assertEqual($existingAnswer->getState(), TRUE);\n }", "public function testExecuteTaskAction()\n {\n }", "public function testListPastWebinarPollResults()\n {\n }", "public static function createResponseTaskView(&$task,&$responseData,$taskQueue){\n switch($task->type){\n case TaskType::MULTIPLE_CHOICE:\n $taskView=new MultipleChoiceView('Q'.$taskQueue,'Q'.$taskQueue,'');\n\n self::sortByKey($task->variants,$responseData->variantsKey);\n\n for($i=0;$i<count($task->variants);$i++){\n $task->variants[$i]->isCorrect=false;\n }\n if (isset($task->variants[$responseData->response])){\n $task->variants[$responseData->response]->isCorrect=true;\n }\n\n $taskView->setData($task);\n $taskView->setViewStyle(TaskViewStyle::SINGLE_CHOICE_CLASSIC_STACKED);\n\n return $taskView;\n break;\n\n case TaskType::MATCHING_TYPE:\n $taskView=new MatchingTypeView('Q'.$taskQueue,'Q'.$taskQueue,'');\n\n // Sort task variants by key (shuffle, relocate)\n $tmpVariants=[];\n for($i=0;$i<count($task->variants);$i++){\n $tmpVariants[]=new MatchingVariant(null,null);\n }\n for($i=0;$i<count($responseData->leftKey);$i++){\n $ki=$responseData->leftKey[$i];\n $tmpVariants[$i]->setLeft($task->variants[$ki]->getLeft());\n }\n for($i=0;$i<count($responseData->rightKey);$i++){\n $ki=$responseData->rightKey[$i];\n $tmpVariants[$i]->setRight($task->variants[$ki]->getRight());\n }\n\n $task->variants=$tmpVariants;\n\n $taskView->matches=$responseData->matches;\n $taskView->setData($task);\n\n return $taskView;\n break;\n\n case TaskType::MULTIPLE_RESPONSE:\n $taskView=new MultipleResponseView('Q'.$taskQueue,'Q'.$taskQueue,'');\n\n self::sortByKey($task->variants,$responseData->variantsKey);\n\n for($i=0;$i<count($task->variants);$i++){\n $task->variants[$i]->isCorrect=false;\n }\n foreach($responseData->responses as $response){\n if (isset($task->variants[$response])){\n $task->variants[$response]->isCorrect=true;\n }\n }\n\n $taskView->setData($task);\n $taskView->setViewStyle(TaskViewStyle::MULTIPLE_CHOICE_CLASSIC_STACKED);\n\n return $taskView;\n break;\n\n case TaskType::NUMERIC_RESPONSE:\n $taskView=new NumericResponseView('Q'.$taskQueue,'Q'.$taskQueue,'');\n\n for($i=0;$i<count($task->responses);$i++){\n if(isset($responseData->responses[$i])){\n $task->responses[$i]->setResponse($responseData->responses[$i]);\n }\n else{\n $task->responses[$i]->setResponse(null);\n }\n }\n\n $taskView->setData($task);\n\n return $taskView;\n break;\n\n default:\n throw new \\AppException('createResponseTaskView: Task type undefined. TaskType:'.$task->type.';');\n }\n }", "function testInvalidTask() {\n // $this->expectException('InvalidArgumentException');\n $this->item->task = null;\n }", "public function getReviewstate() {}", "public function testPriority(){\n //invalid value should not change its default value\n $this->CI->task->priority = 4;//greater\n $this->assertNull($this->CI->task->priority, 'test >= 4');\n \n //invalid value type should not change its default value\n $this->CI->task->priority = 'text';\n $this->assertNull($this->CI->task->priority, 'test non-integer');\n \n //valid value\n $this->CI->task->priority = 3;\n $this->assertEquals(3, $this->CI->task->priority);\n \n }", "public function testDeleteTaskInstanceVariable()\n {\n }", "function _approveDo() {\n\t\tdefined('_JEXEC') or die( 'Invalid Token' );\n\n\t\t// Instanz der Tabelle\n\t\t$row = JTable::getInstance( 'turniere', 'TableCLM' );\n\t\t$row->load( $this->id ); // Daten zu dieser ID laden\n\n\t $clmAccess = clm_core::$access; \n\t\tif (($row->tl != clm_core::$access->getJid() AND $clmAccess->access('BE_tournament_edit_round') !== true) OR $clmAccess->access('BE_tournament_edit_round') === false) {\n\t\t\t$this->app->enqueueMessage( JText::_('TOURNAMENT_NO_ACCESS'),'warning' );\n\t\t\treturn false;\n\t\t}\n\n\t\t$cid = clm_core::$load->request_array_int('cid');\n\t\t\t\t\t\t\t\t\n\t\t$roundID = $cid[0];\n\t\n\t\t// Rundendaten holen\n\t\t$round =JTable::getInstance( 'turnier_runden', 'TableCLM' );\n\t\t$round->load( $roundID ); // Daten zu dieser ID laden\n\n\t\t// Runde existent?\n\t\tif (!$round->id) {\n\t\t\t$this->app->enqueueMessage( CLMText::errorText('ROUND', 'NOTEXISTING'),'warning' );\n\t\t\treturn false;\n\t\t\n\t\t// Runde gehört zu Turnier?\n\t\t} elseif ($round->turnier != $this->id) {\n\t\t\t$this->app->enqueueMessage( CLMText::errorText('ROUND', 'NOACCESS'),'warning' );\n\t\t\treturn false;\n\t\t}\n\t\t\n\t\t$task\t\t= clm_core::$load->request_string('task');\n//\t\t$approve\t= ($task == 'approve'); // zu vergebender Wert 0/1\n\t\tif ($task == 'approve') $approve = 1; else $approve = 0; // zu vergebender Wert 0/1\n\t\n\t\t// weiterer Check: Ergebnisse vollständig?\n\t\tif ($approve == 1) {\n\t\t\t$tournamentRound = new CLMTournamentRound($this->id, $cid[0]);\n\t\t\tif (!$tournamentRound->checkResultsComplete()) {\n\t\t\t\t$this->app->enqueueMessage( CLMText::errorText('RESULTS', 'INCOMPLETE'),'warning' );\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\n\t\t// jetzt schreiben\n\t\t$round->tl_ok = $approve;\n\t\tif (!$round->store()) {\n\t\t\t$this->app->enqueueMessage( $row->getError(),'error' );\n\t\t\treturn false;\n\t\t}\n\t\t\t\t\t\t\t\t\t \n\t\tif ($approve) {\n\t\t\t$this->app->enqueueMessage( $round->name.\" \".JText::_('CLM_APPROVED') );\n\t\t} else {\n\t\t\t$this->app->enqueueMessage( $round->name.\" \".JText::_('CLM_UNAPPROVED') );\n\t\t}\n\t\n\t\t// Log\n\t\t$clmLog = new CLMLog();\n\t\t$clmLog->aktion = JText::_('ROUND').\" \".$round->name.\" (ID: \".$roundID.\"): \".$task;\n\t\t$clmLog->params = array('tid' => $this->id); // TurnierID wird als LigaID gespeichert\n\t\t$clmLog->write();\n\t\n\t\n\t\treturn true;\n\t\n\t}", "public function testGetSubTasks()\n {\n }", "public function getTaskState()\n {\n return $this->get('state');\n }", "public function testDownvoteUpvotedPost()\n {\n $users_cnt = DB::table('users')->count();\n $links_cnt = DB::table('links')->count();\n $downvoted_cnt = DB::table('downvoted_links')->count();\n $upvoted_cnt = DB::table('upvoted_links')->count();\n $user = User::storeUser([\n 'username' => 'Lily',\n 'email' => '[email protected]',\n 'password' => '123456789',\n ]);\n\n $link = Link::storeLink([\n 'content' => 'test content',\n 'title' => 'test title',\n 'author_username' => $user->username\n ]);\n $this->assertEquals(DB::table('users')->count(), $users_cnt + 1);\n $this->assertEquals(DB::table('links')->count(), $links_cnt + 1);\n $token = auth()->login($user);\n $headers = [$token];\n UpvotedLink::store($user->username, $link->id);\n $this->assertEquals(DB::table('upvoted_links')->count(), $upvoted_cnt + 1);\n Link::incrementUpvotes($link->id);\n $payload = ['link_id' => $link->id];\n $this->json('POST', 'api/v1/auth/downvoteLink', $payload, $headers)\n ->assertStatus(200)\n ->assertJson([\n 'success' => 'true'\n ]);\n $this->assertEquals(DB::table('upvoted_links')->count(), $upvoted_cnt);\n $this->assertEquals(DB::table('downvoted_links')->count(), $downvoted_cnt + 1);\n $user->delete();\n $this->assertEquals(DB::table('users')->count(), $users_cnt);\n $this->assertEquals(DB::table('links')->count(), $links_cnt);\n $this->assertEquals(DB::table('downvoted_links')->count(), $downvoted_cnt);\n }", "public function testUpdatedTask()\n {\n $userId = User::first()->value('id');\n $taskId = Task::orderBy('id', 'desc')->first()->id;\n\n $response = $this->json('PUT', '/api/v1.0.0/users/'.$userId.'/tasks/'.$taskId, [\n 'description' => 'An updated task from PHPUnit',\n 'completed' => true,\n ]);\n\n $response\n ->assertStatus(200)\n ->assertJson([\n 'description' => 'An updated task from PHPUnit',\n 'completed' => true,\n ]);\n }", "public function testItCanApproveAPagePendingCuration()\n {\n $this->logInAsUser(['curator' => 1]);\n\n $page = factory('App\\Models\\Page')->create();\n\n $this->get('/curation/new/approve/' . $page->id)->assertResponseStatus(302);\n\n $this->seeInDatabase('pages', [\n 'id' => $page->id,\n 'approved' => 1,\n ]);\n }", "public function testTransitionEvent() {\n $entity = EntityTestWithBundle::create([\n 'type' => 'first',\n 'name' => 'Test entity',\n 'field_state' => 'new',\n ]);\n $entity->save();\n\n $entity->get('field_state')->first()->applyTransitionById('create');\n $entity->save();\n\n $messages = \\Drupal::messenger()->all();\n $message = reset($messages);\n $this->assertCount(6, $message);\n $this->assertEquals('Test entity (field_state) - Fulfillment at pre-transition (workflow: default, transition: create).', (string) $message[0]);\n $this->assertEquals('Test entity (field_state) - Fulfillment at group pre-transition (workflow: default, transition: create).', (string) $message[1]);\n $this->assertEquals('Test entity (field_state) - Fulfillment at generic pre-transition (workflow: default, transition: create).', (string) $message[2]);\n $this->assertEquals('Test entity (field_state) - Fulfillment at post-transition (workflow: default, transition: create).', (string) $message[3]);\n $this->assertEquals('Test entity (field_state) - Fulfillment at group post-transition (workflow: default, transition: create).', (string) $message[4]);\n $this->assertEquals('Test entity (field_state) - Fulfillment at generic post-transition (workflow: default, transition: create).', (string) $message[5]);\n\n \\Drupal::messenger()->deleteAll();\n $entity->get('field_state')->first()->applyTransitionById('fulfill');\n $entity->save();\n\n $messages = \\Drupal::messenger()->all();\n $message = reset($messages);\n $this->assertCount(4, $message);\n $this->assertEquals('Test entity (field_state) - Completed at group pre-transition (workflow: default, transition: fulfill).', (string) $message[0]);\n $this->assertEquals('Test entity (field_state) - Completed at generic pre-transition (workflow: default, transition: fulfill).', (string) $message[1]);\n $this->assertEquals('Test entity (field_state) - Completed at group post-transition (workflow: default, transition: fulfill).', (string) $message[2]);\n $this->assertEquals('Test entity (field_state) - Completed at generic post-transition (workflow: default, transition: fulfill).', (string) $message[3]);\n\n \\Drupal::messenger()->deleteAll();\n $entity = EntityTestWithBundle::create([\n 'type' => 'first',\n 'name' => 'Test entity 2',\n 'field_state' => 'new',\n ]);\n $entity->save();\n $entity->get('field_state')->first()->applyTransitionById('create');\n $entity->save();\n\n $messages = \\Drupal::messenger()->all();\n $message = reset($messages);\n $this->assertCount(6, $message);\n $this->assertEquals('Test entity 2 (field_state) - Fulfillment at pre-transition (workflow: default, transition: create).', (string) $message[0]);\n $this->assertEquals('Test entity 2 (field_state) - Fulfillment at group pre-transition (workflow: default, transition: create).', (string) $message[1]);\n $this->assertEquals('Test entity 2 (field_state) - Fulfillment at generic pre-transition (workflow: default, transition: create).', (string) $message[2]);\n $this->assertEquals('Test entity 2 (field_state) - Fulfillment at post-transition (workflow: default, transition: create).', (string) $message[3]);\n $this->assertEquals('Test entity 2 (field_state) - Fulfillment at group post-transition (workflow: default, transition: create).', (string) $message[4]);\n $this->assertEquals('Test entity 2 (field_state) - Fulfillment at generic post-transition (workflow: default, transition: create).', (string) $message[5]);\n\n \\Drupal::messenger()->deleteAll();\n // Ensure manually setting the state to \"create\", triggers the cancel\n // transition and not the 'fulfill' transition previously applied.\n $entity->set('field_state', 'canceled');\n $entity->save();\n $messages = \\Drupal::messenger()->all();\n $message = reset($messages);\n $this->assertCount(4, $message);\n $this->assertEquals('Test entity 2 (field_state) - Canceled at group pre-transition (workflow: default, transition: cancel).', (string) $message[0]);\n $this->assertEquals('Test entity 2 (field_state) - Canceled at generic pre-transition (workflow: default, transition: cancel).', (string) $message[1]);\n $this->assertEquals('Test entity 2 (field_state) - Canceled at group post-transition (workflow: default, transition: cancel).', (string) $message[2]);\n $this->assertEquals('Test entity 2 (field_state) - Canceled at generic post-transition (workflow: default, transition: cancel).', (string) $message[3]);\n }", "public function testCreateTaskInstanceIdentityLinks()\n {\n }", "public function testTestStatusMissingBadToken()\n {\n // create review record for change 1\n $this->createChange();\n $review = Review::createFromChange('1')->save();\n\n // ensure starting test status of null.\n $this->assertSame($review->get('testStatus'), null);\n\n // dispatch and check output with no token\n $this->dispatch('/reviews/2/tests/fail');\n $result = $this->getResult();\n $this->assertRoute('review-tests');\n $this->assertResponseStatusCode(403);\n\n // dispatch and check output with bad token\n $this->dispatch('/reviews/2/tests/fail/FFFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF');\n $result = $this->getResult();\n $this->assertRoute('review-tests');\n $this->assertResponseStatusCode(403);\n }", "public function testGetTasks()\n {\n\n }", "public function updateTaskPricesAndValues()\n\t{\n\t $tasks = Auth::user()->assigned_tasks();\n foreach($tasks as $task)\n {\n if(false) $task = new Task();\n $price = $task->getPrice();\n if($price > 0) continue;\n $task->setPrice($this->base_price);\n $task->save();\n \t\t}\n\n\t}" ]
[ "0.5794929", "0.5588812", "0.5467419", "0.5263082", "0.52602094", "0.52524436", "0.5204949", "0.51966316", "0.5148624", "0.50911164", "0.50904775", "0.50476503", "0.49787313", "0.4977462", "0.49705684", "0.49591023", "0.4955093", "0.49067727", "0.49023867", "0.48859265", "0.48224607", "0.4800443", "0.4777392", "0.47764802", "0.47623825", "0.4759799", "0.47492978", "0.4742493", "0.47420943", "0.4732615", "0.4729204", "0.47279403", "0.47183743", "0.4698223", "0.46781462", "0.46739665", "0.46663383", "0.46613908", "0.46523017", "0.4649201", "0.46431112", "0.46197513", "0.4611301", "0.46066263", "0.45915464", "0.4588682", "0.45885673", "0.45794207", "0.456519", "0.4562278", "0.45606378", "0.45590967", "0.45555234", "0.45463693", "0.4541481", "0.45371127", "0.45275098", "0.45267275", "0.4523269", "0.45226333", "0.45215285", "0.45171174", "0.4515787", "0.45097262", "0.45067656", "0.4504194", "0.4501707", "0.44956192", "0.44924462", "0.44905275", "0.44829383", "0.44826204", "0.44756332", "0.44749245", "0.4474778", "0.4473199", "0.446958", "0.44680488", "0.44679996", "0.4466839", "0.44649506", "0.44640067", "0.44598848", "0.4456507", "0.44539776", "0.44534266", "0.4449068", "0.4445712", "0.4441576", "0.44405448", "0.44384587", "0.44359708", "0.4435032", "0.44342887", "0.44192445", "0.44128317", "0.44127303", "0.44122946", "0.44110423", "0.43991813" ]
0.69030195
0
Tests the vote() method.
public function testVote($currentStatus, $newStatus, $expectedAccessResult) { $token = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface'); $voter = $this->createVoter(); $task = new Task(); $task->setStatus($currentStatus); $this->assertEquals($expectedAccessResult, $voter->vote($token, $task, array($newStatus))); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function testVote()\n {\n $vote = new Vote();\n $this\n ->voteDirector\n ->expects($this->any())\n ->method('findOneBy')\n ->will($this->returnValue(null));\n\n $this\n ->voteDirector\n ->expects($this->once())\n ->method('create')\n ->will($this->returnValue($vote));\n\n $this\n ->commentEventDispatcher\n ->expects($this->once())\n ->method('dispatchCommentOnVotedEvent')\n ->with(\n $this->equalTo($this->comment),\n $this->equalTo($vote),\n $this->equalTo(false)\n );\n\n $vote = $this\n ->voteManager\n ->vote(\n $this->comment,\n $this->authorToken,\n Vote::DOWN\n );\n\n $this->assertSame($this->authorToken, $vote->getAuthorToken());\n $this->assertSame($this->comment, $vote->getComment());\n $this->assertSame(Vote::DOWN, $vote->getType());\n }", "public function testvote()\n {\n $this->vote_answer = Vote::vote($this->user->id, $this->answer->id, 1, 'answer_id');\n if (!$this->answer) return false;\n }", "public function test_users_vote_can_be_retrieved() {\n\n $user = User::create('[email protected]', 'secret', 'Jane Doe');\n\n $this->assertNull($this->message->getVote($user));\n\n $this->message->upvote($user);\n $this->assertEquals('up', $this->message->getVote($user));\n\n $this->message->downvote($user);\n $this->assertEquals('down', $this->message->getVote($user));\n\n }", "function testMarkAsVoted() {\n\t\t/*\n\t\t$mobilePoll = $this->ObjFromFixture('Poll', 'mobile-poll');\n\t\t$mobilePoll->markAsVoted();\n\t\t$this->assertTrue($mobilePoll->hasVoted());\n\t\t*/\n\t}", "public function vote($object, $action);", "public function vote(Voting $voting, User $user, $answerId);", "public function vote()\n {\n if (!Auth::check()) {\n return redirect(route('login'));\n }\n\n #Let's Vote.\n\n if($this->hasVoted){\n #Yes, Remove Vote\n // dd('Voted');\n try {\n $this->idea->removeVote(Auth::user());\n } catch (VoteNotFoundException $ex) {\n // Do nothing.\n }\n\n $this->votesCount--;\n $this->hasVoted = false;\n\n }else{\n #No, Add Vote\n try {\n $this->idea->vote(Auth::user());\n } catch (DuplicateVoteException $ex) {\n // Do nothing.\n }\n\n $this->votesCount++;\n $this->hasVoted = true;\n }\n }", "public function testExistingVote()\n {\n $vote = new Vote();\n $vote\n ->setAuthorToken($this->authorToken)\n ->setComment($this->comment)\n ->setType(Vote::UP);\n\n $this\n ->voteDirector\n ->expects($this->any())\n ->method('findOneBy')\n ->will($this->returnValue($vote));\n\n $this\n ->voteDirector\n ->expects($this->never())\n ->method('create');\n\n $this\n ->commentEventDispatcher\n ->expects($this->once())\n ->method('dispatchCommentOnVotedEvent')\n ->with(\n $this->equalTo($this->comment),\n $this->equalTo($vote),\n $this->equalTo(true)\n );\n\n $vote = $this\n ->voteManager\n ->vote(\n $this->comment,\n $this->authorToken,\n Vote::DOWN\n );\n\n $this->assertSame($this->authorToken, $vote->getAuthorToken());\n $this->assertSame($this->comment, $vote->getComment());\n $this->assertSame(Vote::DOWN, $vote->getType());\n }", "public function voteAction()\n {\n\n }", "public function test_message_can_be_upvoted() {\n\n $user = User::create('[email protected]', 'secret', 'Jane Doe');\n $this->message->upvote($user);\n $this->assertEquals(1, $this->message->getUpvotes());\n\n }", "public function vote()\n\t{\n\t\t// print \"Hello from JoomooratingController::vote() in file controller.php<br />\\n\";\n\n\t\t$link = JRequest::getVar( 'readmore_link', 'index.php' );\n\n\t\trequire_once $this->_parentModelPath;\n\t\trequire_once $this->_ratingModelPath;\n\t\t$this->_ratingModel = new JoomooRatingModelJoomooRating();\n\n\t\t$rating = JRequest::getVar( 'rating', null );\n\t\t$votedOk = $this->_ratingModel->vote( $rating );\n\t\t$message = '';\n\n\t\tif ( $votedOk )\n\t\t{\n\t\t\t$message .= 'Thanks for your vote (' . $rating . ')!';\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$errorMessage = $this->_ratingModel->getError();\n\t\t\tif ( 0 < strlen($errorMessage) )\n\t\t\t{\n\t\t\t\t$message .= \"Error saving vote: \" . $errorMessage . '<br />';\n\t\t\t\t$message .= 'Please try again.';\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$message .= 'Something went wrong and we are unable to save your vote at this time.<br />';\n\t\t\t\t$message .= 'Please try again later.';\n\t\t\t}\n\t\t}\n\n\t\t//\tprint \"post_comment not redirecting; link = \" . $link . \"; message = \" . $message . \"<br />\\n\";\n\t\t$this->setRedirect( $link, $message );\n\n\t\treturn $votedOk;\n\t}", "public function testPostVoteOnAnswer(): void {\n $user = factory(User::class)->create();\n $q = factory(Question::class)->create();\n $a = factory(Answer::class)->create(['question_id' => $q->id]);\n $url = \"/api/answers/$a->id\";\n //up and cancel\n $this->get(url(\"$url/votes\"))\n ->assertStatus(200)\n ->assertJsonFragment(['total' => 0]);\n $this->post(url(\"$url/upvote\"), ['api_token' => $user->api_token])\n ->assertStatus(200)\n ->assertJsonFragment(['total' => 1, 'up' => 1]);\n $this->post(url(\"$url/upvote\"), ['api_token' => $user->api_token])\n ->assertStatus(200)\n ->assertJsonFragment(['total' => 0, 'up' => 0]);\n // down and cancel\n $this->post(url(\"$url/downvote\"), ['api_token' => $user->api_token])\n ->assertStatus(200)\n ->assertJsonFragment(['total' => -1, 'down' => 1]);\n $this->post(url(\"$url/downvote\"), ['api_token' => $user->api_token])\n ->assertStatus(200)\n ->assertJsonFragment(['total' => 0, 'down' => 0]);\n //down up down\n $this->post(url(\"$url/downvote\"), ['api_token' => $user->api_token])\n ->assertStatus(200)\n ->assertJsonFragment(['total' => -1, 'down' => 1]);\n $this->post(url(\"$url/upvote\"), ['api_token' => $user->api_token])\n ->assertStatus(200)\n ->assertJsonFragment(['total' => 1, 'up' => 1]);\n $this->post(url(\"$url/downvote\"), ['api_token' => $user->api_token])\n ->assertStatus(200)\n ->assertJsonFragment(['total' => -1, 'down' => 1]);\n\n $this->get(url(\"$url/votes\"))\n ->assertStatus(200)\n ->assertJsonFragment(['total' => -1]);\n }", "public function testPostVoteOnQuestion(): void {\n $user = factory(User::class)->create();\n $q = factory(Question::class)->create();\n $url = \"/api/questions/$q->id\";\n //up and cancel\n $this->get(url(\"$url/votes\"))\n ->assertStatus(200)\n ->assertJsonFragment(['total' => 0]);\n $this->post(url(\"$url/upvote\"), ['api_token' => $user->api_token])\n ->assertStatus(200)\n ->assertJsonFragment(['total' => 1, 'up' => 1]);\n $this->post(url(\"$url/upvote\"), ['api_token' => $user->api_token])\n ->assertStatus(200)\n ->assertJsonFragment(['total' => 0, 'up' => 0]);\n //down and cancel\n $this->post(url(\"$url/downvote\"), ['api_token' => $user->api_token])\n ->assertStatus(200)\n ->assertJsonFragment(['total' => -1, 'down' => 1]);\n $this->post(url(\"$url/downvote\"), ['api_token' => $user->api_token])\n ->assertStatus(200)\n ->assertJsonFragment(['total' => 0, 'down' => 0]);\n // down up down\n $this->post(url(\"$url/downvote\"), ['api_token' => $user->api_token])\n ->assertStatus(200)\n ->assertJsonFragment(['total' => -1, 'down' => 1]);\n $this->post(url(\"$url/upvote\"), ['api_token' => $user->api_token])\n ->assertStatus(200)\n ->assertJsonFragment(['total' => 1, 'up' => 1]);\n $this->post(url(\"$url/downvote\"), ['api_token' => $user->api_token])\n ->assertStatus(200)\n ->assertJsonFragment(['total' => -1, 'down' => 1]);\n\n $this->get(url(\"$url/votes\"))\n ->assertStatus(200)\n ->assertJsonFragment(['total' => -1]);\n }", "public function test_a_user_can_vote_for_a_post()\n {\n $user = $this->defaultUser();\n\n $post = $this->createPost();\n\n $this->browse(function (Browser $browser) use($user,$post) {\n $browser->loginAs($user)\n ->visit($post->url)\n ->pressAndWaitFor('+1')\n ->assertSeeIn('current-vote',1);\n });\n }", "public function test_message_can_only_be_voted_on_once() {\n\n $user = User::create('[email protected]', 'secret', 'Jane Doe');\n $this->message->upvote($user);\n $this->message->upvote($user);\n $this->assertEquals(1, $this->message->getUpvotes());\n\n $this->message->downvote($user);\n $this->message->downvote($user);\n $this->assertEquals(1, $this->message->getDownvotes());\n\n }", "function vote($userid,$subjectid,$type,$vote) {\n\t$type = dbEscape($type);\n\t$userid = intval($userid);\n\t$subjectid = intval($subjectid);\n\t$vote = intval($vote);\n\n\tswitch($vote) {\n\tcase 0:\n\t\t// Unset/delete vote\n\t\tdbQuery(\"DELETE FROM votes WHERE userid=$userid AND subjectid=$subjectid AND type='$type'\");\n\t\tbreak;\n\tcase 1:\n\tcase -1:\n\t\t// Check if we've already voted\n\t\t$result = dbFirstResult(\"SELECT * FROM votes WHERE userid=$userid AND subjectid=$subjectid AND type='$type'\");\n\t\t\n\t\tif(empty($result)) { // Make a new vote if we haven't voted before\n\t\t\tdbQuery(\"INSERT INTO votes (userid,type,subjectid,vote) VALUES($userid,'$type',$subjectid,$vote)\");\t\n\t\t}\n\t\n\t\telseif($vote != $row[vote]) { // Update our old vote if we have voted before\n\t\t\tdbQuery(\"UPDATE votes SET vote=$vote WHERE userid=$userid AND subjectid=$subjectid AND type='$type'\");\n\t\t}\n\t\t\n\t\tbreak;\n\tdefault: // Any vote other than +1, -1 or 0\n\t\treturn(false);\n\t\tbreak;\n\t}\n\n\t// Grab and return the new vote count\n\t$result = dbFirstResult(\"SELECT points FROM totalvotes WHERE subjectid=$subjectid AND type='$type'\");\n\tif(empty($result)) { $result = 0; }\t\t\n\t$result .= ($result == 1 || $result == -1) ? ' point' : ' points';\n\treturn(\"$result\");\n}", "function setVote($id, $vote) { \n\ttry { \n\t\tif (($vote != 1) && ($vote != 2)) { \n\t\t\terror_log('vote must be 1 or 2');\n\t\t\treturn 0;\n\t\t} else { \n\t\t\t$question = ORM::for_table('questions')->where('id', $id)->find_one();\n\t\t\tif ($vote == 1) { \n\t\t\t\t$question->vote_answer1 += 1;\n\t\t\t} else { \n\t\t\t\t$question->vote_answer2 += 1;\n\t\t\t}\n\t\t\t$question->save();\n\t\t\treturn 1;\n\t\t}\n\t} catch (Exception $e) { \n\t\terror_log($e->getMessage());\n\t\treturn 0;\n\t}\n}", "function DoVoting()\r\n\t\t\t{\r\n\t\t\t\tif (!$_SESSION[\"User\"])\r\n\t\t\t\t{\t// Display the login screen\r\n\t\t\t\t\tif (!VoterLogin())\r\n\t\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\t\t\t\t// Step 2: Sign-In (only needed when using Mixing - Servers) \r\n\t\t\t\t\r\n\t\t\t\t// Step 3: Voting (only needed when using Mixing - Servers)\r\n\t\t\t\tVoterVote();\r\n\t\t\t}", "public function test_user_cannot_both_upvote_and_downvote() {\n\n $user = User::create('[email protected]', 'secret', 'Jane Doe');\n $this->message->upvote($user);\n $this->message->downvote($user);\n $this->assertEquals(0, $this->message->getUpvotes());\n $this->assertEquals(1, $this->message->getDownvotes());\n\n $this->message->downvote($user);\n $this->message->upvote($user);\n $this->assertEquals(1, $this->message->getUpvotes());\n $this->assertEquals(0, $this->message->getDownvotes());\n\n }", "function recordVote()\n{\n\n //add voter and vote to database\n\n //mark voter as voted\n\n}", "private function Ivote( $vote ) {\n\t\tif( $this->vote === $vote ) {\n\t\t\treturn; // already done.\n\t\t}\n\t\t\n\t\t// and update database.\n\t\ttry {\n\t\t\tself::Vote( $this->source, $this->dest, User::AccountID(), $vote );\n\t\t} catch( \\SQLException $e ) {\n\t\t\tLogger::PrintException( $e );\n\t\t\treturn;\n\t\t}\n\t\t\n\t\t// reverse vote\n\t\tif( $this->vote === true ) {\n\t\t\t$this->goods--;\n\t\t} else if( $this->vote === false ) {\n\t\t\t$this->bads--;\n\t\t}\n\t\t\n\t\t$this->vote = $vote;\n\t\t\n\t\t// add vote\n\t\tif( $vote ) {\n\t\t\t$this->goods++;\n\t\t} else {\n\t\t\t$this->bads++;\n\t\t}\n\t\t\n\t\t// update $score\n\t\t$this->UpdateScore();\n\t\t\n\t}", "function voter() {\n\t\tif (isset($_GET['id']) && isset($_GET['vote'])) {\n\t\t\tif ($this -> modele -> getSondage($_GET['id']) && $this -> modele -> getAVote($_GET['id'], $_SESSION['id']) == 0) {\n\t\t\t\tif ($this -> modele -> insertAVote($_GET['id'], $_SESSION['id'], $_GET['vote']) != 0 && $this -> modele -> updateSondage($_GET['vote'], $_GET['id'])) {\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t}\n\t\t\t$sondage = $this -> modele -> getSondage($_GET['id']);\n\t\t\t$resultats = '';\n\t\t\t$totalVote = $sondage[5] + $sondage[6] + $sondage[7] + $sondage[8];\n\t\t\tif (is_array($sondage) || is_object($sondage)) {\n\t\t\t\tforeach ($sondage as $key => $reponse) {\n\t\t\t\t\tif ($key > 0 && $key < 5 && $reponse != null) {\n\t\t\t\t\t\tif ($totalVote == 0)\n\t\t\t\t\t\t\t$resultats .= $this -> vue -> resultat($reponse, 0);\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\t$resultats .= $this -> vue -> resultat($reponse, $sondage[$key + 4] / $totalVote * 100);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\techo $this -> vue -> resultatSondage($resultats);\n\t\t}\n\t}", "public function isValid($vote)\n {\n\n // Check if User is logged in\n if (!$this->getUserService()->isAuthenticated()) {\n print 'Authentication required.';\n HttpUtility::setResponseCodeAndExit(HttpUtility::HTTP_STATUS_401);\n }\n\n if (!$vote instanceof Vote) {\n print 'I could not instantiate the Vote object.';\n HttpUtility::setResponseCodeAndExit(HttpUtility::HTTP_STATUS_400);\n }\n\n if (empty($vote->getVotedObject()->getContentType())) {\n print 'I miss a valid content type.';\n HttpUtility::setResponseCodeAndExit(HttpUtility::HTTP_STATUS_400);\n }\n\n $object = $this->getVotedObjectRepository()->findOne($vote);\n if (empty($object)) {\n print 'I could not retrieve the voted object.';\n HttpUtility::setResponseCodeAndExit(HttpUtility::HTTP_STATUS_404);\n }\n\n // Check the content element that contains the voting meta information.\n $contentElementIdentifier = (int)GeneralUtility::_GP('contentElement');\n if ($contentElementIdentifier < 1) {\n print 'Invalid or missing content element parameter.';\n HttpUtility::setResponseCodeAndExit(HttpUtility::HTTP_STATUS_400);\n }\n\n $content = $this->getContentElementService()->get($contentElementIdentifier);\n if (empty($content)) {\n print 'I could not retrieve this content element: ' . $contentElementIdentifier;\n HttpUtility::setResponseCodeAndExit(HttpUtility::HTTP_STATUS_404);\n }\n\n $settings = $this->getContentElementService()->getSettings($contentElementIdentifier);\n\n if ((int)$settings['closingDate'] > 0 && (int)$settings['closingDate'] < time()) {\n print 'Sorry, the vote is closed for this content element: ' . $contentElementIdentifier;\n HttpUtility::setResponseCodeAndExit(HttpUtility::HTTP_STATUS_403);\n }\n\n $allowedFrequency = (int)$settings['allowedFrequency'];\n $userIdentifier = $vote->getUser();\n $lastVote = $this->getVoteRepository()->findLastVote($settings['contentType'], $userIdentifier);\n if ($allowedFrequency > 0 && !empty($lastVote)) {\n\n if ($allowedFrequency === self::ALLOWED_ONLY_ONCE_PER_24 && time() - $lastVote['time'] < 86400) {\n print 'Sorry, you can not vote for this type of object today, please come back.';\n HttpUtility::setResponseCodeAndExit(HttpUtility::HTTP_STATUS_403);\n } elseif ($allowedFrequency === self::ALLOWED_ONLY_ONCE) {\n print 'Sorry, you can vote only once for this type of object.';\n HttpUtility::setResponseCodeAndExit(HttpUtility::HTTP_STATUS_403);\n }\n }\n }", "abstract protected function doSaveVote(BaseVote $vote);", "public function find_vote($event_id, $user_id);", "public function vote()\n\t\t{\n\t\t\t$betId = $this->input->get_post('bet_id');\t\n\t\t\t$categoryId = $this->input->get_post('cat_id');\n\t\t\t$answerType = $this->input->get_post('answer_type');\n\t\t\t$userId = $this->input->get_post('user_id');\n\t\t\ttry{\n\t\t\t\tif($betId == false || $betId== \"\"){\n\t\t\t\t\t$this->_jsonData['status']=\"FAILURE\";\n\t\t\t\t\t$this->_jsonData['message']=\"Bet Id Missing\";\n\t\t\t\t}else if($categoryId == false || $categoryId == \"\"){\n\t\t\t\t\t$this->_jsonData['status']=\"FAILURE\";\n\t\t\t\t\t$this->_jsonData['message']=\"Category Id Missing\";\n\t\t\t\t}else if($answerType == false || $answerType == \"\"){\n\t\t\t\t\t$this->_jsonData['status']=\"FAILURE\";\n\t\t\t\t\t$this->_jsonData['message']=\"Answer Type Missing\";\n\t\t\t\t}else if($userId == false || $userId == \"\"){\n\t\t\t\t\t$this->_jsonData['status']=\"FAILURE\";\n\t\t\t\t\t$this->_jsonData['message']=\"User Id Missing\";\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\t$data = array(\n\t\t\t\t\t\t\t\t'bet_id'=>$betId,\n\t\t\t\t\t\t\t\t'cat_id'=>$categoryId,\n\t\t\t\t\t\t\t\t'answer_type'=>$answerType,\n\t\t\t\t\t\t\t\t'user_id'=>$userId,\n\t\t\t\t\t);\n\t\t\t\t\t$res=$this->userModel->vote($data);\n\t\t\t\t\tif($res){\n\t\t\t\t\t\t//echo 1;\n\t\t\t\t\t\t$this->_jsonData['status']=\"SUCCESS\";\n\t\t\t\t\t\t$this->_jsonData['message']=\"Voted Successfully\";\n\t\t\t\t\t\t$this->_jsonData['data']='';\n\t\t\t\t\t}else{\n\t\t\t\t\t\t//echo 0;\n\t\t\t\t\t\t$this->_jsonData['status']=\"FAILURE\";\n\t\t\t\t\t\t$this->_jsonData['message']=\"You already voted for this bet..\";\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}catch(Exception $e){\n\t\t\t\t$this->_jsonData['status']=\"FAILURE\";\n\t\t\t\t$this->_jsonData['message']=\"You already voted.\";\n\t\t\t\t$this->_jsonData['data']='';\n\t\t\t}\n\t\t\techo json_encode($this->_jsonData);\n\t\t\t$this->ServicesModel->createService($_REQUEST,$this->_jsonData,$_SERVER['SERVER_ADDR'],'vote',$_FILES);\n\t\t}", "public function validate(Vote $vote);", "public function vote()\r\n\t{\r\n\r\n\t\t$poll_id = $_POST['poll_id']; \r\n\r\n\t\t// Increate vote for desired field\r\n\t\tif (have_rows('polls_options', $poll_id)) {\r\n\t\t\twhile (have_rows('polls_options', $poll_id)) {\r\n\t\t\t\tthe_row();\r\n\t\t\t\tif (get_sub_field('poll_option') === $_POST[\"votes_question\"]) {\r\n\r\n\t\t\t\t\t// Update vote count into ACF field\r\n\t\t\t\t\t$current_votes_count = get_sub_field('poll_option_votes');\r\n\t\t\t\t\t$vote = update_sub_field('poll_option_votes', $current_votes_count ? ++$current_votes_count : 1, $poll_id);\r\n\r\n\t\t\t\t\t// Add poll ID to session \r\n\t\t\t\t\tsession_start();\r\n\t\t\t\t\tif (!isset($_SESSION['wppoll'])) {\r\n\t\t\t\t\t\t$_SESSION['wppoll'] = array();\r\n\t\t\t\t\t}\r\n\t\t\t\t\tarray_push($_SESSION['wppoll'], (int) $poll_id);\r\n\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\twp_die();\r\n\r\n\t\tif (!$vote) {\r\n\t\t\t$data = array('type' => 'error', 'message' => 'Voting failed');\r\n\t\t\theader('HTTP/1.1 400 Bad Request');\r\n\t\t\theader('Content-Type: application/json; charset=UTF-8');\r\n\t\t\techo json_encode($data);\r\n\t\t}\r\n\t\twp_die();\r\n\t}", "public function testStaleVotes()\n {\n // create review to test with\n $review = new Review($this->p4);\n $review->setParticipants(array('foo', 'bar'))\n ->set('author', 'joe')\n ->save();\n\n // add several versions\n $review->setVersions(\n array(\n array('change' => 2, 'user' => 'joe', 'time' => 700, 'pending' => 1, 'difference' => 1),\n array('change' => 3, 'user' => 'joe', 'time' => 710, 'pending' => 1, 'difference' => 1),\n array('change' => 4, 'user' => 'joe', 'time' => 720, 'pending' => 1, 'difference' => 2),\n )\n )->save();\n\n // prepare connections for users 'foo', 'bar'\n $p4Foo = $this->connectWithAccess('foo', array('//...'));\n $p4Bar = $this->connectWithAccess('bar', array('//...'));\n $userFoo = User::fetch('foo', $this->p4);\n $userBar = User::fetch('bar', $this->p4);\n\n // test that voting without version applies to latest\n $services = $this->getApplication()->getServiceManager();\n $services->setService('p4_user', $p4Foo)\n ->setService('user', $userFoo);\n $this->getRequest()->setMethod('POST');\n $this->dispatch('/reviews/' . $review->getId() . '/vote/up');\n\n $votes = Review::fetch($review->getId(), $this->p4)->getVotes();\n $this->assertSame(1, count($votes));\n $this->assertSame(1, $votes['foo']['value']);\n $this->assertSame(3, $votes['foo']['version']);\n $this->assertSame(false, $votes['foo']['isStale']);\n\n // try voting on a particular version\n $this->resetApplication();\n $services = $this->getApplication()->getServiceManager();\n $services->setService('p4_user', $p4Foo)\n ->setService('user', $userFoo);\n $this->getRequest()->setMethod('POST')->setPost(new Parameters(array('version' => 2)));\n $this->dispatch('/reviews/' . $review->getId() . '/vote/up');\n\n $votes = Review::fetch($review->getId(), $this->p4)->getVotes();\n $this->assertSame(1, count($votes));\n $this->assertSame(1, $votes['foo']['value']);\n $this->assertSame(2, $votes['foo']['version']);\n $this->assertSame(false, $votes['foo']['isStale']);\n\n // vote as 'bar' on version 1 and verify its evaluated as stale vote\n $this->resetApplication();\n $services = $this->getApplication()->getServiceManager();\n $services->setService('p4_user', $p4Bar)\n ->setService('user', $userBar);\n $this->getRequest()->setMethod('POST')->setPost(new Parameters(array('version' => 1)));\n $this->dispatch('/reviews/' . $review->getId() . '/vote/down');\n\n $votes = Review::fetch($review->getId(), $this->p4)->getVotes();\n $this->assertSame(2, count($votes));\n $this->assertSame(1, $votes['foo']['value']);\n $this->assertSame(2, $votes['foo']['version']);\n $this->assertSame(false, $votes['foo']['isStale']);\n $this->assertSame(-1, $votes['bar']['value']);\n $this->assertSame(1, $votes['bar']['version']);\n $this->assertSame(true, $votes['bar']['isStale']);\n }", "public function voteAction()\n {\n $return = 0;\n\n /* Getting current user's data */\n $user = Auth::getUser();\n\n /* Checking if user is online and answer_id > 0 */\n if ($user && $_GET['id'] > 0) {\n \n /* Vote answer and return number of votes */\n $return = VotedAnswer::vote($user->id, $_GET['id']);\n }\n \n /* Return response */\n header('Content-Type: application/json');\n echo json_encode($return);\n }", "function upvote($videoid){\n \t$realid = pg_escape_string($videoid);\n \t$query1 = \"SELECT upvotes FROM video where idvideo = \".$realid;\n \t$link = createConection();\n \tif($row = pg_fetch_array(pg_exec($link,$query1))){\n \t\t$total = $row['upvotes'] + 1;\n \t\t$query2 = \"UPDATE video set upvotes = \".$total.\" where idvideo = \".$realid.\";\";\n \t\tpg_exec($link, $query2);\n \t\tcloseConection($link);\n \t\treturn true;\n \t}else{\n \t\tcloseConection($link);\n \t\treturn false;\n \t}\n }", "public function test_message_can_be_downvoted() {\n\n $user = User::create('[email protected]', 'secret', 'Jane Doe');\n $this->message->downvote($user);\n $this->assertEquals(1, $this->message->getDownvotes());\n\n }", "public function vote(Tide $tide, Tide\\Configuration\\ArrayObject $context);", "public static function vote($id) {\n $poll = Poll::find($id);\n self::check_flag_true($poll->can_vote);\n $poll_options = PollOption::all($id);\n View::make('poll/vote.html',\n array('poll' => $poll, 'poll_options' => $poll_options));\n }", "function checkvote($idvideo, $iduser){\n \t$realid = pg_escape_string($idvideo);\n \t$realusr = pg_escape_string($iduser);\n \t$query = \"SELECT idvotexuser, vote FROM votexuser where idvideo = \".$realid.\" and idusuario = \".$realusr.\";\";\n \t$link = createConection();\n \t$result = pg_exec($link, $query);\n \tcloseConection($link);\n \treturn $result;\n }", "public function calculate_votes()\r\n\t{\r\n\t\t$this->votes_total = $this->votes_up + $this->votes_down;\r\n\t\t$this->votes_balance = $this->votes_up - $this->votes_down;\r\n\r\n\t\t// Note: division by zero must be prevented\r\n\t\t$this->votes_pct_up = ($this->votes_total === 0) ? 0 : $this->votes_up / $this->votes_total * 100;\r\n\t\t$this->votes_pct_down = ($this->votes_total === 0) ? 0 : $this->votes_down / $this->votes_total * 100;\r\n\t}", "function user_vote()\n{\n\n // nonce check for an extra layer of security, the function will exit if it fails\n if (!wp_verify_nonce($_REQUEST['nonce'], \"user_vote_nonce\")) {\n exit(\"nonce error\");\n }\n\n $post_id = $_REQUEST[\"post_id\"];\n $vote_direction = $_REQUEST[\"vote_direction\"];\n\n // fetch vote_count for a post, set it to 0 if it's empty, increment it when a click is registered\n $old_vote_count = get_post_meta($post_id, \"votes\", true);\n $old_vote_count = ($old_vote_count == '') ? 0 : $old_vote_count;\n $new_vote_count = $old_vote_count;\n\n //voted post structure\n //$voted_posts = array(\"1\" => 0, \"5\" => 1, \"7\" => -1);\n\n $previous_vote_direction = get_vote_direction_meta($post_id);\n //if previous vote in middle regular vote apply: $previous_vote_direction == 0\n\n //if vote remove: $vote_direction == $previous_vote_direction\n // add negative vote direction to old vote count\n // set vote direction to middle\n\n //if vote swap: $vote_direction != $previous_vote_direction\n // add 2 times vote directions to old vote count\n // set vote meta to vote direction\n\n if($previous_vote_direction == 0){\n $new_vote_count += $vote_direction;\n set_user_vote_direction($post_id, $vote_direction);\n }elseif ($vote_direction == $previous_vote_direction){\n $new_vote_count = $old_vote_count - $vote_direction;\n set_user_vote_direction($post_id, 0);\n }elseif ($vote_direction != $previous_vote_direction){\n $new_vote_count = $old_vote_count + 2*$vote_direction;\n set_user_vote_direction($post_id, $vote_direction);\n }\n\n\n $vote = update_post_meta($post_id, \"votes\", $new_vote_count);\n\n\n // If above action fails, result type is set to 'error' and vote_count set to old value, if success, updated to new_vote_count\n if ($vote === false) {\n $result['type'] = \"error\";\n $result['vote_count'] = $old_vote_count;\n } else {\n $result['type'] = \"success\";\n $result['vote_count'] = $new_vote_count;\n }\n\n // Check if action was fired via Ajax call. If yes, JS code will be triggered, else the user is redirected to the post page\n if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {\n $result = json_encode($result);\n echo $result;\n } else {\n header(\"Location: \" . $_SERVER[\"HTTP_REFERER\"]);\n }\n\n die();\n}", "public function Voted ($id) {\n // if (Voter::where('index_number', $id)->exists()) {\n $voter = Voter::where(\"index_number\", '=', $id)->update(['vote_status'=> 'yes']);\n if($voter){\n return response()->json([\n \"message\" => \"sucesss\"\n ], 200);\n }\n else{\n return response()->json([\n \"message\" => \"Failed to update yes\"\n ], 404);\n }\n \n \n // } else {\n \n // }\n }", "function newvote($idvideo, $iduser, $vote){\n \t$realid = pg_escape_string($idvideo);\n \t$realuser = pg_escape_string($iduser);\n \t$realvote = pg_escape_string($vote);\n \t$query = \"INSERT into votexuser (idusuario, idvideo, vote) values (\".$realuser.\", \".$realid.\", \".$realvote.\");\";\n \t$link = createConection();\n \tif(pg_exec($link, $query)){\n \t\tcloseConection($link);\n \t\treturn true;\n \t}else{\n \t\tcloseConection($link);\n \t\treturn false;\n \t}\n }", "public function vote($id)\r\n\t{\r\n\t\t// Find our game and perform the vote.\r\n\t\t$game = $this->findById($id);\r\n\r\n\t\t// Check if we own this game already.\r\n\t\tif (!empty($game) && $game['owned'] == 1) return false;\r\n\r\n\t\t// Check if we are using the service.\r\n\t\tif (XBOXAPP_OFFLINE === true) {\t\t\t\r\n\t\t\tif (empty($game)) return false;\r\n\t\t\t$this->update($id, array('votes' => (int)(++$game['votes'])));\r\n\t\t} else {\r\n\t\t\t// Add a vote to the game.\r\n\t\t\tif (!ServiceApi::addVote($id)) return false;\r\n\t\t}\r\n\r\n\t\t// Sync up our database.\r\n\t\t$this->sync();\t\t\r\n\r\n\t\treturn true;\r\n\t}", "private function vote()\n\t{\n\t\tif(!$this->owner->logged_in())\n\t\t\treturn new View('public_forum/login');\n\t\t\n\t\t$comment_id = valid::id_key($this->filter);\n\t\t$vote = $this->filter2;\n\t\t\n\t\t$has_voted = ORM::factory('forum_comment_vote')\n\t\t\t->where(array(\n\t\t\t\t'owner_id'\t\t \t=> $this->owner->get_user()->id,\n\t\t\t\t'forum_cat_post_comment_id' => $comment_id\n\t\t\t))\n\t\t\t->find();\t\n\t\tif(TRUE == $has_voted->loaded)\n\t\t\treturn 'already voted.';\n\t\t\t\n\t\t$vote = ('down' == $vote) ? -1 : 1 ;\n\t\t\n\t\t$comment = ORM::factory('forum_cat_post_comment', $comment_id);\t\t\n\t\t$comment->vote_count = ($comment->vote_count + $vote);\n\t\t$comment->save();\t\t\n\n\t\t# log the vote.\n\t\t$log_vote = ORM::factory('forum_comment_vote');\n\t\t$log_vote->owner_id = $this->owner->get_user()->id;\n\t\t$log_vote->forum_cat_post_comment_id = $comment_id;\n\t\t$log_vote->save();\n\n\t\treturn 'Vote has been accepted!';\n\t}", "protected function catch_vote() {\n\t\t// Immediately get out of here if no vote was cast\n\t\tif ( ! isset( $_POST['thumbsup_id'] ) or ! isset( $_POST['thumbsup_rating'] ) ) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Ignore votes for invalid item ids\n\t\tif ( ! ctype_digit( (string) $_POST['thumbsup_id'] ) or ! $this->load_item( (int) $_POST['thumbsup_id'] ) ) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// A new vote is cast\n\t\t$this->new_vote['item_id'] = $this->item['id'];\n\n\t\t// Check if one is still allowed to vote on this item\n\t\tif ( $this->item['closed'] ) {\n\t\t\t$this->new_vote['error'] = 'Voting is closed for this item.';\n\t\t\treturn false;\n\t\t}\n\n\t\t// Already voted for this item? Check cookie first.\n\t\tif ( isset( $this->cookie[ $this->item['id'] ] ) ) {\n\t\t\t$this->new_vote['error'] = 'You have already voted for this item.';\n\t\t\treturn false;\n\t\t}\n\n\t\t// Check IP, if we found one for this user\n\t\tif ( $this->config['ip_check'] and ! empty( $this->ip ) ) {\n\t\t\tif ( ThumbsUp_Database::db()->singleQuery(\"\n\t\t\t\tSELECT 1\n\t\t\t\tFROM votes\n\t\t\t\tWHERE item_id = {$this->item['id']} AND ip = '$this->ip'\n\t\t\t\tLIMIT 1\") ) {\n\t\t\t\t$this->new_vote['error'] = 'You have already voted for this item.';\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\t// Store the vote data into the new_vote property\n\t\t$this->new_vote += array(\n\t\t\t'rating' => min( 1, max( 0, (int) $_POST['thumbsup_rating'] ) ), // Must be either 0 or 1\n\t\t\t'ip' => $this->ip,\n\t\t\t'date' => time(),\n\t\t);\n\n\t\t// Finally, it is time to cast the vote\n\t\tThumbsUp_Database::db()->queryExec(\"\n\t\t\tINSERT INTO votes (id, item_id, rating, ip, date)\n\t\t\tVALUES (NULL, {$this->new_vote['item_id']}, {$this->new_vote['rating']}, '{$this->new_vote['ip']}', {$this->new_vote['date']})\");\n\n\t\t// Add the current item id to the cookie list\n\t\t$this->update_cookie( $this->item['id'] );\n\n\t\t// Vote successfully registered\n\t\treturn true;\n\t}", "public static function Vote( $source, $dest, $accountid, $vote ) {\n\t\n\t\t\n\t\tThought::Order( $source, $dest );\n\t\t$db = \\SQLW::Get();\n\t\t\n\t\t$result = $db->DoTransaction( function( $db ) \n\t\t\t\t\t\t\t\t\t use( $source, $dest, \n\t\t\t\t\t\t\t\t\t $accountid, $vote ) {\n\t\t\t\t\t\t\t\t\t\t \n\t\t\t$voteval = $vote ? 1 : 0;\n\t\t\t$mip = User::GetMip();\n\t\t\t$aid = User::AccountID() ? 0 : User::GetAid();\n\t\t\t\n\t\t\t$time = time();\t\n\t\t\t$db->RunQuery( 'START TRANSACTION' );\n\t\t\t\n\t\t\t// get the current scores of the link\n\t\t\t$result = $db->RunQuery( \n\t\t\t\t\"SELECT id, goods, bads, rank FROM Links \n\t\t\t\tWHERE thought1=$source->id AND thought2=$dest->id\n\t\t\t\tFOR UPDATE\" );\n\t\t\t\n\t\t\t$row = $result->fetch_row();\n\t\t\tif( $row === NULL ) {\n\t\t\t\t// catch: link doesn't exist.\n\t\t\t\t$db->RunQuery( 'ROLLBACK' );\n\t\t\t\tthrow new InvalidArgumentException( \"Link doesn't exist.\" );\n\t\t\t}\n\t\t\t\n\t\t\t$linkid = $row[0];\n\t\t\t$goods = $row[1];\n\t\t\t$bads = $row[2];\n\t\t\t$linkrank = $row[3];\n\t\t\t\n\t\t\t// add the vote\n\t\t\tif( $vote ) {\n\t\t\t\t$goods++;\n\t\t\t} else {\n\t\t\t\t$bads++;\n\t\t\t}\n\t\t\t\n\t\t\t// check if there is already a vote from this user.\n\t\t\t$result = $db->RunQuery(\n\t\t\t\t\"SELECT vote, aid FROM RealVotes \n\t\t\t\tWHERE link=$linkid AND mip=$mip \n\t\t\t\tFOR UPDATE\" );\n\t\t\t\n\t\t\t$row = $result->fetch_assoc();\n\t\t\t$scorechange = true;\n\t\t\t\n\t\t\tif( $row !== null ) {\n\t\t\t\t// a vote already exists:\n\t\t\t\t\n\t\t\t\t// reverse original vote \n\t\t\t\tif( $row['vote'] == $voteval ) {\n\t\t\t\t\t$scorechange = false; \n\t\t\t\t} else {\n\t\t\t\t\n\t\t\t\t\tif( $row['vote'] == 1 ) {\n\t\t\t\t\t\t$goods--;\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$bads--;\n\t\t\t\t\t} \n\t\t\t\t} \n\t\t\t\t// update the user's vote.\n\t\t\t\t$db->RunQuery(\n\t\t\t\t\t\"UPDATE RealVotes SET vote=$voteval, aid=$aid, time=$time\n\t\t\t\t\tWHERE link=$linkid AND mip=$mip\" );\n\t\t \n\t\t\t} else {\n\t\t\t\t\n\t\t\t\t$db->RunQuery( \n\t\t\t\t\t\"INSERT INTO RealVotes \n\t\t\t\t\t( link, mip, time, aid, vote )\n\t\t\t\t\tVALUES( $linkid, $mip, $time, $aid, $voteval )\" \n\t\t\t\t);\n\t\t\t\t \n\t\t\t}\n\t\t\t\n\t\t\tif( $accountid != 0 ) {\n\t\t\t\t$db->RunQuery(\n\t\t\t\t\t\"INSERT INTO AccountVotes ( link, account, time, vote )\n\t\t\t\t\tVALUES( $linkid, $accountid, $time, $voteval )\n\t\t\t\t\tON DUPLICATE KEY UPDATE time=$time, vote=$voteval\" \n\t\t\t\t);\n\t\t\t}\n\t\t\t\n\t\t\tif( $scorechange ) {\n\t\t\t\t$score = self::ComputeScore( $goods, $bads );\n\t\t\t\t\n\t\t\t\tif( $linkrank == 0 && $score >= self::LINKRANK_GOOD ) {\n\t\t\t\t\t$linkrank++;\n\t\t\t\t\tUser::AddLinkStat( $accountid, 1 );\n\t\t\t\t\tStats::Increment( 'GLINKS' );\n\t\t\t\t}\n\t\t\t\tif( $linkrank == 1 && $score >= self::LINKRANK_STRONG ) {\n\t\t\t\t\t$linkrank++;\n\t\t\t\t\tUser::AddLinkStat( $accountid, 2 );\n\t\t\t\t\tStats::Increment( 'SLINKS' );\n\t\t\t\t}\n\t\t\t\tif( $linkrank == 2 && $score >= self::LINKRANK_PERFECT ) {\n\t\t\t\t\t$linkrank++;\n\t\t\t\t\tUser::AddLinkStat( $accountid, 3 );\n\t\t\t\t\t\n\t\t\t\t\tStats::Increment( 'PLINKS' );\n\t\t\t\t\tLogger::Info( \"A PERFECT link was discovered! \\\"$source->phrase\\\" -> \\\"$dest->phrase\\\"\" );\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t// update score\n\t\t\t\t$db->RunQuery( \n\t\t\t\t\t\"UPDATE Links \n\t\t\t\t\tSET goods=$goods, bads=$bads, rank=$linkrank, score=$score\n\t\t\t\t\tWHERE id=$linkid\" );\n\t\t\t}\n\t\t\t\n\t\t\t$db->RunQuery( 'COMMIT' );\n\t\t\treturn TRUE;\n\t\t});\n\t\t\n\t\treturn $result; \n\t}", "public function __invoke(VotingUuid $votingUuid): ?Vote;", "function changevote($idvideo, $iduser){\n \t$realid = pg_escape_string($idvideo);\n \t$realusr = pg_escape_string($iduser);\n \t$query1 = \"SELECT vote from votexuser where idvideo =\".$realid.\"and idusuario = \".$realusr;\n \t$link = createConection();\n if($row = pg_fetch_array(pg_exec($link, $query1))){\n \t$currentvote = ($row['vote'] == \"t\")?true:false;\n \t$query2 = \"UPDATE votexuser set vote = \".(($currentvote)?\"false\":\"true\").\" where idvideo = \".$realid.\" and idusuario = \".$realusr;\n \tif(pg_exec($link, $query2)){\n \t\t//now update the vote on the videos table\n \t\t$query3 = \"SELECT upvotes, downvotes from video where idvideo = \".$realid;\n \t\tif($row2 = pg_fetch_array(pg_exec($link, $query3))){\n \t\t\t$upvotes = $row2['upvotes'];\n \t\t\t$downvotes = $row2['downvotes'];\n \t\t\tif($currentvote){\n \t\t\t\t$query4 = \"UPDATE video SET upvotes = \".($upvotes - 1).\" ,downvotes = \".($downvotes + 1). \" where idvideo = \".$realid.\";\";\n \t\t\t\tif(pg_exec($link, $query4)){\n \t\t\t\t\tcloseConection($link);\n \t\t\t\t\treturn true;\n \t\t\t\t}else{\n \t\t\t\t\tcloseConection($link);\n \t\t\t\t\treturn false;\n \t\t\t\t}\n \t\t\t}else{ //current vote id downvote\n \t\t\t\t$query4 = \"UPDATE video SET upvotes = \".($upvotes + 1).\" ,downvotes = \".($downvotes - 1). \" where idvideo = \".$realid.\";\";\n \t\t\t\tif(pg_exec($link, $query4)){\n \t\t\t\t\tcloseConection($link);\n \t\t\t\t\treturn true;\n \t\t\t\t}else{\n \t\t\t\t\tcloseConection($link);\n \t\t\t\t\treturn false;\n \t\t\t\t}\n \t\t\t}\n \t\t}else{ //the search for the up and down votes did not work \n \t\t\tcloseConection($link);\n \t\t\treturn false;\n \t\t}\n \t}else{ //the table votexuser was not updated\n \t\tcloseConection($link);\n \t\treturn false;\n \t}\n }else{ //the search for the vote value did not work\n \tcloseConection($link);\n \treturn false;\n }\n\n }", "function vote($id_post, $vote) {\n\n\t\t$condition = 0;\n\t\t$compteur = 0;\n\t\t\n\t\t$requete = $GLOBALS['bdd']->prepare('SELECT * FROM badin WHERE balsamine = :id_post AND bigarade = :id_auteur AND bouquetin IN(5, 6, 7, 8, 9)');\n\t\t$requete->execute(array('id_post' => $id_post,\n\t\t\t\t\t\t\t\t'id_auteur' => $_SESSION['id'],\n\t\t\t\t\t\t\t\t));\n\t\t$condition = $requete->rowCount();\n\n\t\tif($condition == 1) {\n\t\t\t$req = $GLOBALS['bdd']->prepare('UPDATE badin SET bouquetin = :type WHERE balsamine = :id_posts AND bigarade = :auteur AND bouquetin IN(5, 6, 7, 8, 9)');\n\t\t\t$req->execute(array(\n\t\t\t\t'type' => $vote,\n\t\t\t\t'id_posts' => $id_post,\n\t\t\t\t'auteur' => $_SESSION['id'],\n\t\t\t\t));\n\t\t\t$compteur = $req->rowCount();\n\t\t}\n\t\telseif($condition == 0) {\n\t\t\t$req = $GLOBALS['bdd']->prepare('INSERT INTO badin(balsamine, bigarade, bouquetin, brimade) VALUES(:id_posts, :id_auteur, :type, NOW())');\n\t\t\t$req->execute(array('id_posts' => $id_post,\n\t\t\t\t\t\t\t\t'id_auteur' => $_SESSION['id'],\n\t\t\t\t\t\t\t\t'type' => $vote,\n\t\t\t\t\t\t\t\t));\n\t\t\t$compteur = $req->rowCount();\n\t\t}\n\t\telse {\n\n\t\t}\n\t}", "public function vote(Tokenable $token, iterable $attributes, object $subject): int;", "public function voteVideoAction()\n\t{\n\t\t$userSession\t= new Container('fo_user');\n\t\t$request\t\t= $this->getRequest();\n\t\t\n\t\tif(isset($userSession->userSession['_id']) && trim($userSession->userSession['_id']) != '') {\n\t\t\tif($request->isPost()) {\n\t\t\t\t$formData\t= $request->getPost();\n\t\t\t\tif(!isset($userSession->mediaSession['rating'][base64_decode($formData['videoId'])]) && isset($formData['type']) && ($formData['type'] == '1' || $formData['type'] == '2')) {\n\t\t\t\t\t$this->doVote($formData['type'], $formData['videoId']);\n\t\t\t\t\t$typeText\t= ($formData['type'] == 1) ? 'like' : 'dislike';\n\t\t\t\t\tif(isset($userSession->mediaSession['rating'])) {\n\t\t\t\t\t\t$tempArray['rating']\t\t\t\t\t\t\t\t\t\t= $userSession->mediaSession['rating'];\n\t\t\t\t\t\t//$tempArray['rating'][base64_decode($formData['videoId'])]\t= base64_decode($formData['videoId']);\n\t\t\t\t\t\t$tempArray['rating'][base64_decode($formData['videoId'])]\t= $typeText;\n\t\t\t\t\t\t$userSession->mediaSession\t\t\t\t\t\t\t\t\t= $tempArray;\n\t\t\t\t\t} else {\n\t\t\t\t\t\t//$tempArray['rating'][base64_decode($formData['videoId'])]\t= base64_decode($formData['videoId']);\n\t\t\t\t\t\t$tempArray['rating'][base64_decode($formData['videoId'])]\t= $typeText;\n\t\t\t\t\t\t$userSession->mediaSession\t\t\t\t\t\t\t\t\t= $tempArray;\n\t\t\t\t\t}\n\t\t\t\t\techo trim($formData['type']);\n\t\t\t\t} else if(isset($userSession->mediaSession['rating'][base64_decode($formData['videoId'])])) {\n\t\t\t\t\techo \"-2\";\t// Voted\n\t\t\t\t} else {\n\t\t\t\t\techo \"-1\";\t//\timproper data\n\t\t\t\t}\n\t\t\t\t\n\t\t\t} else {\n\t\t\t\techo \"-1\";\t//\timproper data\n\t\t\t}\n\t\t} else {\n\t\t\techo \"0\";\t//\tuser session is in-active\n\t\t}\n\t\treturn $this->getResponse();\n\t}", "function verify_vote(&$vote)\n\t{\n\t\tif (is_int($vote) AND $vote >= 0 AND $vote <= $this->max_vote)\n\t\t{\n\t\t\treturn true;\n\t\t}\n\t\telse\n\t\t{\n\t\t\treturn false;\n\t\t}\n\t}", "function castVote($value = true) {\n\t\tif (!($uid = user_getid()) || $uid == 100) {\n\t\t\t$this->setMissingParamsError(_('User ID not passed'));\n\t\t\treturn false;\n\t\t}\n\t\tif (!$this->ArtifactType->canVote()) {\n\t\t\t$this->setPermissionDeniedError();\n\t\t\treturn false;\n\t\t}\n\t\t$has_vote = $this->hasVote($uid);\n\t\tif ($has_vote == $value) {\n\t\t\t/* nothing changed */\n\t\t\treturn true;\n\t\t}\n\t\tif ($value) {\n\t\t\t$res = db_query_params('INSERT INTO artifact_votes (artifact_id, user_id) VALUES ($1, $2)',\n\t\t\t\t\t\tarray($this->getID(), $uid));\n\t\t} else {\n\t\t\t$res = db_query_params('DELETE FROM artifact_votes WHERE artifact_id=$1 AND user_id=$2',\n\t\t\t\t\t\tarray($this->getID(), $uid));\n\t\t}\n\t\tif (!$res) {\n\t\t\t$this->setError(db_error());\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}", "public function testDownvoteUpvotedPost()\n {\n $users_cnt = DB::table('users')->count();\n $links_cnt = DB::table('links')->count();\n $downvoted_cnt = DB::table('downvoted_links')->count();\n $upvoted_cnt = DB::table('upvoted_links')->count();\n $user = User::storeUser([\n 'username' => 'Lily',\n 'email' => '[email protected]',\n 'password' => '123456789',\n ]);\n\n $link = Link::storeLink([\n 'content' => 'test content',\n 'title' => 'test title',\n 'author_username' => $user->username\n ]);\n $this->assertEquals(DB::table('users')->count(), $users_cnt + 1);\n $this->assertEquals(DB::table('links')->count(), $links_cnt + 1);\n $token = auth()->login($user);\n $headers = [$token];\n UpvotedLink::store($user->username, $link->id);\n $this->assertEquals(DB::table('upvoted_links')->count(), $upvoted_cnt + 1);\n Link::incrementUpvotes($link->id);\n $payload = ['link_id' => $link->id];\n $this->json('POST', 'api/v1/auth/downvoteLink', $payload, $headers)\n ->assertStatus(200)\n ->assertJson([\n 'success' => 'true'\n ]);\n $this->assertEquals(DB::table('upvoted_links')->count(), $upvoted_cnt);\n $this->assertEquals(DB::table('downvoted_links')->count(), $downvoted_cnt + 1);\n $user->delete();\n $this->assertEquals(DB::table('users')->count(), $users_cnt);\n $this->assertEquals(DB::table('links')->count(), $links_cnt);\n $this->assertEquals(DB::table('downvoted_links')->count(), $downvoted_cnt);\n }", "public function __construct(Vote $vote)\n {\n $this->vote = $vote;\n }", "public function modifyVotes($caselawID, $vote) {\n\t\t$caselawID = (int)$caselawID;\n\n\t\tif ($vote === 'up'){\n\t\t\t//DataBase connection & query\n\t\t\t$db = Dbconn::getDB();\n\t\t\t$sql = \"UPDATE votes SET votes_up = votes_up + 1 WHERE caselaw_id = {$caselawID}\";\n\t\t\t$db->query($sql);\n\t\t}\n\n\t\telseif ($vote === 'down'){\n\t\t\t//DataBase connection & query\n\t\t\t$db = Dbconn::getDB();\n\t\t\t$sql = \"UPDATE votes SET votes_down = votes_down + 1 WHERE caselaw_id = {$caselawID}\";\n\t\t\t$db->query($sql);\n\t\t}\n\t\telse {\n\t\t\treturn false;\n\t\t\techo \"error in script\";\n\t\t}\n\t}", "public function postvoting()\n {\n $userid = Auth::user()->id; \n $reviewid = Input::get('review_id');\n $vote = Input::get('vote');\n\n $status = Vote::where('user_id', $userid)->where('review_id',$reviewid)->pluck('vote'); \n\n $up = Review::where('id',$reviewid)->pluck('upvote');\n $down = Review::where('id',$reviewid)->pluck('downvote');\n\n if($status == NULL)\n { \n\n $this->vote->user_id = $userid;\n $this->vote->review_id = $reviewid;\n $this->vote->vote = $vote;\n $this->vote->save();\n\n if($vote == 1)\n Review::where('id',$reviewid)->update(array('upvote' => ($up + 1)));\n else\n Review::where('id', $reviewid)->update(array('downvote' => ($down +1))); \n\n } \n\n else if($status != $vote)\n {\n Vote::where('user_id',$userid)->where('review_id',$reviewid)->update(array('vote' => $vote)); \n\n if($vote == 1)\n {\n Review::where('id',$reviewid)->update(array('upvote' => ($up + 1), 'downvote' =>($down -1)));\n }\n else\n {\n Review::where('id', $reviewid)->update(array('downvote' => ($down +1),'upvote' =>($up -1))); \n } \n }\n else\n {\n Vote::where('user_id',$userid)->where('review_id',$reviewid)->delete();\n\n\n if($vote == 1)\n Review::where('id',$reviewid)->update(array('upvote' => ($up - 1)));\n else\n Review::where('id', $reviewid)->update(array('downvote' => ($down -1))); \n\n\n\n }\n\n $up = Review::where('id',$reviewid)->pluck('upvote');\n $down = Review::where('id',$reviewid)->pluck('downvote');\n\n Review::where('id', $reviewid)->update(array('popularity_index' => ($up - $down))); \n\n }", "public function votePoll(PollPostRepositoryInterface $post, array $answer): PodiumResponse;", "public function voteAction ()\n {\n /* @var $em \\Doctrine\\ORM\\EntityManager */\n $em = $this->get('doctrine')->getManager();\n \n $user = $this->getUser();\n if(!$user) {\n throw new UnauthorizedHttpException('You must be logged in to comment.');\n }\n \n $request = $this->getRequest();\n $decklist_id = filter_var($request->get('id'), FILTER_SANITIZE_NUMBER_INT);\n \n $decklist = $em->getRepository('NetrunnerdbBuilderBundle:Decklist')->find($decklist_id);\n $query = $em->getRepository('NetrunnerdbBuilderBundle:Decklist')\n ->createQueryBuilder('d')\n ->innerJoin('d.votes', 'u')\n ->where('d.id = :decklist_id')\n ->andWhere('u.id = :user_id')\n ->setParameter('decklist_id', $decklist_id)\n ->setParameter('user_id', $user->getId())\n ->getQuery();\n \n $result = $query->getResult();\n if (empty($result)) {\n $user->addVote($decklist);\n $author = $decklist->getUser();\n $author->setReputation($author->getReputation() + 1);\n $decklist->setTs(new \\DateTime());\n $decklist->setNbvotes($decklist->getNbvotes() + 1);\n $this->get('doctrine')\n ->getManager()\n ->flush();\n }\n \n return new Response(count($decklist->getVotes()));\n \n }", "public function actionVote($id, $type, $vote = 1)\n {\n if(!Yii::$app->user->isGuest)\n {\n $voteModel = Vote::find()->where([\n 'voteable_type' => $type,\n 'voteable_id' => $id,\n 'user_id' => Yii::$app->user->id,\n ])->one();\n if(!isset($voteModel->id))\n {\n $voteModel = new Vote;\n $voteModel->voteable_type = $type;\n $voteModel->voteable_id = $id;\n $voteModel->user_id = Yii::$app->user->id;\n } elseif ($voteModel->vote == $vote) {\n $out = ['success' => false, 'error' => 'User has already voted'];\n echo Json::encode($out);\n return;\n }\n $voteModel->vote = $vote;\n if($voteModel->save())\n {\n $rating = Vote::getRating($id, $type);\n $out = ['success' => true, 'rating' => $rating];\n } else {\n $out = ['success' => false, 'error' => $voteModel->getErrors()];\n }\n } else {\n $out = ['success' => false, 'error' => 'User is guest'];\n }\n echo Json::encode($out);\n }", "public function actionVote()\n {\n $answers = Yii::$app->request->post('answers');\n $userID = isset(Yii::$app->user->id) ? Yii::$app->user->id : false;\n if (is_array($answers) && $userID) {\n $vote = new QuestionVote();\n foreach ($answers as $aid) {\n if (is_numeric($aid)) {\n $answer = $this->findModel($aid);\n if (isset($answer->id) && isset($answer->parent_id)) {\n if(!isset($vote->id)) {\n $vote->question_id = $answer->parent_id;\n $vote->user_id = $userID;\n if(!$vote->save()) break;\n }\n if (isset($vote->id)) {\n $answer->voutes++;\n $answer->save(false);\n }\n }\n }\n }\n Yii::$app->getSession()->setFlash('success-question', 'Ваш ответ на опрос успешно сохранен.');\n }\n return Yii::$app->getResponse()->redirect(Url::to('/'));\n }", "public function show(vote $vote)\n {\n //\n }", "public function testRemoveExistingVote()\n {\n $vote = new Vote();\n $vote\n ->setAuthorToken($this->authorToken)\n ->setComment($this->comment)\n ->setType(Vote::UP);\n\n $this\n ->voteDirector\n ->expects($this->any())\n ->method('findOneBy')\n ->will($this->returnValue($vote));\n\n $this\n ->voteDirector\n ->expects($this->once())\n ->method('remove')\n ->with($this->equalTo($vote));\n\n $this\n ->voteManager\n ->removeVote(\n $this->comment,\n $this->authorToken,\n Vote::DOWN\n );\n }", "public function ChangeVote($db, $poi_id, $votes, $operation){\n if ($operation == \"up\"){\n $votes++;\n }else{\n $votes--;\n }\n $stmt = $db->prepare(\"UPDATE pois\n SET votes = :votes\n WHERE poi_id = :poi_id\");\n $stmt->bindParam(':votes', $votes, PDO::PARAM_INT);\n $stmt->bindParam(':poi_id', $poi_id, PDO::PARAM_INT);\n $stmt->execute();\n return $votes;\n }", "public function cast_vote($vote, $num = 1)\r\n\t{\r\n\t\t$vote = min(1, max(0, (int) $vote));\r\n\r\n\t\tif( $vote )\r\n\t\t{\r\n\t\t\t// Add an \"up\" vote\r\n\t\t\t$this->votes_up += $num;\r\n\t\t\t$sql = 'votes_up = votes_up + '.$num;\r\n\t\t\t$vote_value = $num;\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t// Add a \"down\" vote\r\n\t\t\t$this->votes_down += $num;\r\n\t\t\t$sql = 'votes_down = votes_down + '.$num;\r\n\t\t\t$vote_value = \"-\".$num;\r\n\t\t}\r\n\r\n\t\t// Recalculate the vote results, no need to reload the item from database\r\n\t\t$this->calculate_votes();\r\n\r\n\t\t// Update the item record\r\n\t\t$sth = ThumbsUp::db()->Query(\"UPDATE `acp_servers` SET \".$sql.\" WHERE id = '{server}'\", array('server'=>$this->id));\r\n\r\n\t\t// The current user has just cast a vote\r\n\t\t$this->user_voted = TRUE;\r\n\t\tThumbsUp_Cookie::add_id($this->id);\r\n\r\n\t\t// Combine the storage of the IP and user id into one query for optimization\r\n\t\t$ip = ThumbsUp::get_ip();\r\n\t\t$user_id = ThumbsUp::get_user_id();\r\n\r\n\t\tif( $ip OR $user_id )\r\n\t\t{\r\n\t\t\t$sth = ThumbsUp::db()->Query(\"INSERT INTO `acp_servers_votes` (item_id, ip, user_id, value, vote_value, date) VALUES ('{item_id}', '{ip}', '{user_id}', '{value}', '{vote_value}', '{date}')\", array('item_id'=>$this->id,'ip'=>$ip,'user_id'=>$user_id,'value'=>$vote,'vote_value'=>$vote_value,'date'=>time()));\r\n\t\t}\r\n\t}", "public function vote()\n {\n # Check if the user is logged in\n if( $this->session->userdata('id') )\n {\n # Define Vote class\n $vote = new User_Vote();\n $vote->where('user_id', $this->input->get('id') )\n ->where('user_voted_id', $this->session->userdata('id') )\n ->get();\n\n # Instanciate a new user\n $user = new User($this->input->get('id'));\n\n # Check if the disponibility has already been voted\n if( $vote->exists() )\n {\n # Delete the vote\n $vote->delete();\n\n # Send the response\n echo json_encode(array('result' => 'alert', 'text' => \"Você deixou de seguir \\\"{$user->name} {$user->surname}\\\".\"));\n\n }else{\n # Set variables\n $vote->user_id = $this->input->get('id');\n $vote->user_voted_id = $this->session->userdata('id');\n\n # Save into database\n $vote->save();\n\n echo json_encode(array('result' => 'success', 'text' => \"Agora você está seguindo \\\"{$user->name} {$user->surname}\\\".\"));\n }\n }else{\n echo json_encode(\n array('result' => 'error', 'text' => \"Você precisa fazer login na Galatea para seguir alguém.\")\n );\n }\n\n }", "function postvote($postid,$vtype)\n\t{\n\t\tif ($vtype == 'up') {\n\t\t\t$this->db->set('upvotes','upvotes+1',FALSE);\n\t\t}\n\t\telse {\n\t\t\t$this->db->set('downvotes','downvotes+1',FALSE);\n\t\t}\n\t\t$this->db->where('id',$postid);\n\t\t$this->db->update($this->posts_table);\n\t\treturn true;\n\t}", "public function vote($id){\n $data['where'] = ['topic_id'=>$id,'user_id'=>Auth::user()->id];\n $collection = DB::table('topic_user')->where($data['where'])->first();\n $data['id'] = $id;\n if($collection) {\n DB::transaction(function ($data) use ($data) {\n try {\n $this->model->where('id', $data['id'])->decrement('vote_count');\n DB::table('topic_user')->where($data['where'])->delete();\n } catch (\\Exception $e) {\n throw $e;\n }\n });\n }else{\n DB::transaction(function ($data) use ($data) {\n try {\n $this->model->where('id', $data['id'])->increment('vote_count');\n DB::table('topic_user')->insert($data['where']);\n } catch (\\Exception $e) {\n throw $e;\n }\n });\n }\n }", "public function vote($vote)\n {\n $params = array();\n $user = $GLOBALS['current_user'];\n $contact_id = null;\n\n if (!$this->isValidSugarUser($user) && $contact = $this->getPortalContact()) {\n $contact_id = $contact->id;\n $params['where'] = 'contact_id = ' . DBManagerFactory::getInstance()->quoted($contact_id);\n }\n /**\n * Load only required votes\n */\n $this->load($params);\n\n /**\n * Delete previous votes for a portal contact\n */\n if ($contact_id !== null) {\n if (!empty($this->rows)) {\n $q = $this->relationship->getQuery($this, array('return_as_array' => true));\n if (!empty($params['where'])) {\n $q['where'] .= ' AND ' . $params['where'];\n }\n $q = 'UPDATE ' . $this->relationship->getRelationshipTable() . ' SET deleted = 1 ' . $q['where'];\n DBManagerFactory::getInstance()->query($q);\n }\n $this->relationship->primaryOnly = true;\n }\n $result = $this->add(\n $user,\n array(\n 'vote' => $vote ? 1 : -1,\n 'ssid' => session_id(),\n 'contact_id' => $contact_id,\n 'zeroflag' => 0\n )\n );\n $this->relationship->primaryOnly = false;\n return $result;\n }", "private function checkIfVoterVoted( $ipaddress, $attachment_id ) {\n global $wpdb;\n $query = \"select count(`id`) from \" . $wpdb->prefix . \"roni_votes where ip_address='\" . $ipaddress . \"' and attachment_id='\" . $attachment_id . \"';\";\n return $wpdb->get_var( $query );\n }", "public function isVotingAnswerableForUser(Voting $voting, User $user);", "public function add_vote(array $data);", "public function vote($vote = 0, $user_id = 0, $ip = null)\n\t{\n\t\tif (!$this->get('id'))\n\t\t{\n\t\t\t$this->addError(Lang::txt('No record found'));\n\t\t\treturn false;\n\t\t}\n\n\t\tif (!$vote)\n\t\t{\n\t\t\t$this->addError(Lang::txt('No vote provided'));\n\t\t\treturn false;\n\t\t}\n\n\t\t$al = $this->ballot($user_id, $ip);\n\t\t$al->set('item_type', 'question');\n\t\t$al->set('item_id', $this->get('id'));\n\t\t$al->set('created_by', $user_id);\n\t\t$al->set('ip', $ip);\n\n\t\t$vote = $al->automaticVote(['vote' => $vote]);\n\n\t\tif ($this->get('created_by') == $user_id)\n\t\t{\n\t\t\t$this->addError(Lang::txt('Cannot vote for your own entry'));\n\t\t\treturn false;\n\t\t}\n\n\t\tif ($vote != $al->get('vote', 0))\n\t\t{\n\t\t\tif ($vote > 0)\n\t\t\t{\n\t\t\t\t$this->set('helpful', (int) $this->get('helpful') + 1);\n\t\t\t\tif ($al->get('id'))\n\t\t\t\t{\n\t\t\t\t\t$this->set('nothelpful', (int) $this->get('nothelpful') - 1);\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif ($al->get('id'))\n\t\t\t\t{\n\t\t\t\t\t$this->set('helpful', (int) $this->get('helpful') - 1);\n\t\t\t\t}\n\t\t\t\t$this->set('nothelpful', (int) $this->get('nothelpful') + 1);\n\t\t\t}\n\n\t\t\tif (!$this->save())\n\t\t\t{\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\t$al->set('vote', $vote);\n\n\t\t\tif (!$al->save())\n\t\t\t{\n\t\t\t\t$this->addError($al->getError());\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\treturn true;\n\t}", "function commentvote($postid,$vtype)\n\t{\n\t\tif ($vtype == 'up') {\n\t\t\t$this->db->set('upvotes','upvotes+1',FALSE);\n\t\t}\n\t\telse {\n\t\t\t$this->db->set('downvotes','downvotes+1',FALSE);\n\t\t}\n\t\t$this->db->where('id',$postid);\n\t\t$this->db->update($this->comments_table);\n\t\treturn true;\n\t}", "function vote_edition() {\n\t$nonce = $_POST['nonce'];\n\n\tif ( ! wp_verify_nonce( $nonce, 'ajax-nonce' ) )\n\t\tdie ( 'Busted!');\n\t\n\t// get edition\n\t$editionID = $_POST['tag_id'];\n\n\t// get edition data\n\t$editionData = get_edition_data($editionID);\n\n\t// get current IP\n\t$currentVoterIP = get_client_ip();\n\n\t// check if already voted\n\t$voterCheck = check_if_voted($currentVoterIP, $editionID, $editionData[\"votes\"]);\n\t\n\t// if not yet voted\n\tif( empty($voterCheck) ) {\n\t\n\t\t// add new vote\n\t\t$editionData[\"votes\"] = addVote($currentVoterIP, $editionID, $editionData[\"votes\"]);\n\t}\n\t// if already voted\n\telse {\n\t\n\t\t// remove vote\n\t\t$editionData[\"votes\"] = removeVote($currentVoterIP, $editionID, $editionData[\"votes\"]);\n\t}\n\t\n\t//$editionData[\"votes\"] = [];\n\t// save new data\t\n\tsave_extra_post_tag_fields( $editionID, $editionData );\n\n\t// get votes count for current edition\n\t$count = count( $editionData[\"votes\"] );\n\t\n\t// display count (ie jQuery return value)\n\techo $count;\n\t\n\tdie();\n}", "public function vote(Exception $exception);", "public function show(Vote $vote)\n {\n //\n }", "public function testUpVotingButton()\n {\n $client = static::createClient();\n\n\n $client->followRedirects(true);\n $crawler = $client->request('GET', '/tag');\n $link= $crawler->selectLink('Upvote')\n ->eq(\"1\")\n ->link();\n $this->assertEquals(\n\n $link->getUri(),'http://localhost/tag/2/upvote');\n\n\n\n }", "public function actionVote($comment_id, $vote=\"\")\n\t{\n\t\tglobal $arr_response;\n\t\tif(! Yii::app()->user->isGuest){\n\t\t\t$comment_count = Comment::add_vote($comment_id, $vote, Yii::app()->user->id);\n\t\t\tif($comment_count['success']==true){\n\t\t\t\t$arr_response['comment_vote'] = $comment_count;\n\t\t\t\t$arr_response['response_message'] = Yii::t('comment','Vote sent.');\n\t\t\t}else{\n\t\t\t\t$arr_response['response_code'] = 409;\n\t\t\t\t$arr_response['response_message'] = $comment_count['message'];\n\t\t\t}\n\t\t}else{\n\t\t\t$arr_response['response_code'] = 401;\n\t\t\t$arr_response['response_message'] = Yii::t('comment','Sorry, you must log in to be able to vote.');\n\t\t}\t\n\t}", "public function edit(vote $vote)\n {\n //\n }", "public function testGetParliamentaryCandidateWithVoteCast()\n {\n $pollingStation = $this->em->getRepository('VtallyBundle:PollingStation')->find(1);\n $candidates = $pollingStation->getParliamentaryCandidateWithVoteCast();\n $this->assertEquals($candidates[0]->getFirstName(), 'Jhon');\n $this->assertEquals($candidates[0]->getVoteCast(), 100);\n $this->assertEquals($candidates[1]->getFirstName(), 'Jannette');\n $this->assertEquals($candidates[1]->getVoteCast(), 280);\n $this->assertEquals($candidates[2]->getFirstName(), 'Sondra');\n $this->assertEquals($candidates[2]->getVoteCast(), 98);\n $this->assertEquals($candidates[3]->getFirstName(), 'Fadde');\n $this->assertEquals($candidates[3]->getVoteCast(), 0);\n $this->assertEquals($candidates[4]->getFirstName(), 'Vivien');\n $this->assertEquals($candidates[4]->getVoteCast(), 100);\n $this->assertEquals($candidates[5]->getFirstName(), 'Joella');\n $this->assertEquals($candidates[5]->getVoteCast(), 7);\n $this->assertEquals($candidates[6]->getFirstName(), 'Adde');\n $this->assertEquals($candidates[6]->getVoteCast(), 2);\n }", "public function getVotes()\n {\n return $this->votes;\n }", "public function edit(Vote $vote)\n {\n //\n }", "public function edit(Vote $vote)\n {\n //\n }", "public static function hasVote($voter_id, $skill_id, $player1, $player2) {\n\t\t\t$vote = Vote::where('voter_id', '=', $voter_id)\n\t\t\t->where('skill_id', '=', $skill_id)\n\t\t\t->where('for_id', '=', $player1)\n\t\t\t->where('against_id', '=', $player2)\n\t\t\t->count();\n\t\tif($vote > 0 ) {\n\t\t\treturn \"true\";\n\t\t}\n\t\telse\t\t{\n\t\t\treturn \"false\" ;\n\t\t}\n\t}", "public function save(Vote $vote);", "public function votes()\n {\n $this->response->setCache(['max-age' => 300, 's-maxage' => 900, 'etag' => '187d475']);\n\n $data = ['page_title' => lang('votes._page_votes')];\n $data['breadcrumb'][] = ['url' => admin_url('home/index'), 'title' => lang('home.dashboard')];\n $data['breadcrumb'][] = ['title' => lang('votes._page_votes'), 'class' => 'active'];\n\n $this->_render('votes', $data);\n }", "public function hasVoted($categoryId, $ip);", "public function incrementVoteCount()\n {\n $this->setVotesCount( $this->getVotesCount() + 1 );\n }", "public function testDownVotingButton()\n {\n $client = static::createClient();\n\n $client->followRedirects(true);\n $crawler = $client->request('GET', '/tag');\n $link= $crawler->selectLink('Downvote')\n ->eq(\"1\")\n ->link();\n $this->assertEquals(\n\n $link->getUri(),'http://localhost/tag/2/downvote');\n\n }", "public function testStorepostsCheckCustomerVotingAfterDBIsection() {\n $baseUrl = $this->getContainer()->getParameter('symfony_base_url');\n $acess_token = $this->getContainer()->getParameter('access_token');\n $serviceUrl = $baseUrl . 'api/storeposts?access_token='.$acess_token;\n $data = '{\"reqObj\":{\"store_id\":1495,\"post_title\":\"currently Not in used from frontend\",\"post_desc\":\"live news\",\"user_id\":1,\"post_id\":\"\",\"post_type\":1,\"youtube\":\"\",\"media_id\":[],\"link_type\":0,\"share_type\":\" txn \",\"device_request_type\":\"mobile\",\"customer_voting\":5}}';\n $data_array = json_decode($data);\n $data_array = $data_array->reqObj;\n $customer_voting = $data_array->customer_voting;\n $client = new CurlRequestService();\n $response = $client->send('POST', $serviceUrl, array(), $data)\n ->getResponse();\n $response = json_decode($response);\n $response_data = $response->data;\n $this->assertEquals($customer_voting, $response_data->customer_voting);\n }", "public function checkVote($idea_id,$user_id)\r\n {\r\n $model = new Ynidea_Model_DbTable_Ideavotes;\r\n $select = $model -> select()->where('user_id = ?',$user_id)->where('idea_id=?',$idea_id); \r\n $row = $model->fetchRow($select); \r\n if($row)\r\n return true;\r\n else\r\n return false; \r\n }", "public function update_votes($student_currentclass, $vote){\n\n \tif ($vote == 'iGetIt'){ //Update classes table to increate iGetIt by 1, & decrease iDontGetIt by 1\n \t\techo \"Entered case iGetIt\";\n \t\t$query = \"SELECT igetit, total_enrolled FROM classes WHERE igetit = total_enrolled AND classname = $1;\";\n \t\t$query_result = pg_prepare($this->con, \"myquery11\", $query);\n \t\t$query_result = pg_execute($this->con, \"myquery11\", array($student_currentclass));\n \t\t$row = pg_fetch_row($query_result);\n\n \t\tif(!$row){ //If iGetIt == total, & user chooses iGetIt, don't do anything, else do this:\n \t\t\techo \"Entered in!\";\n \t\t\t$query = \"UPDATE classes SET igetit = igetit + 1, idontgetit = idontgetit - 1 WHERE classname = $1;\";\n \t\t\t$query_result = pg_prepare($this->con, \"myquery8\", $query);\n \t\t\t$query_result = pg_execute($this->con, \"myquery8\", array($student_currentclass));\n }\n \t}\n \telse if ($vote == 'iDontGetIt'){\n \t\t//If iDontGetIt is full, then don't do anything. Else ++iDontGetIt and --iGetIt by 1\n \t\t$query = \"SELECT idontgetit, total_enrolled FROM classes WHERE idontgetit = total_enrolled AND classname = $1;\";\n \t\t$query_result = pg_prepare($this->con, \"myquery9\", $query);\n \t\t$query_result = pg_execute($this->con, \"myquery9\", array($student_currentclass));\n \t\t$row = pg_fetch_row($query_result);\n\n \t\tif(!$row){ //They arent equal. Dont do anything\n \t\t\t$query = \"UPDATE classes SET idontgetit = idontgetit + 1, igetit = igetitt - 1 WHERE classname = $1;\";\n \t\t\t$query_result = pg_prepare($this->con, \"myquery10\", $query);\n \t\t $query_result = pg_execute($this->con, \"myquery10\", array($student_currentclass));\n \t\t }\n \t\t}\n\n \t}", "public function save_votes() {\n\t\t\t$comment_id = absint( filter_input( INPUT_POST, 'comment_id', FILTER_SANITIZE_STRING ) );\n\t\t\t$vote_type = filter_input( INPUT_POST, 'vote_type', FILTER_SANITIZE_STRING );\n\t\t\t$user_id = $this->user_id;\n\t\t\t$users = get_comment_meta( $comment_id, 'votes', true );\n\t\t\t$vote_data = array();\n\t\t\t$vote_other = 'up' === $vote_type ? 'up' : 'down';\n\t\t\t$self_vote = $this->options['user-self-vote'];\n\n\t\t\t$comment_author_id = absint( get_comment( $comment_id, ARRAY_A )['user_id'] );\n\n\t\t\tif ( empty( $self_vote ) && $comment_author_id === $user_id ) {\n\t\t\t\twp_send_json_error(\n\t\t\t\t\tarray( esc_html( 'You cannot vote your own comment!' ) )\n\t\t\t\t);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( empty( $users ) ) {\n\t\t\t\t// The first vote.\n\t\t\t\t$vote_data = array( $user_id => $vote_type );\n\t\t\t\tif ( add_comment_meta( $comment_id, 'votes', $vote_data, true ) ) {\n\t\t\t\t\t$users_count = get_comment_meta( $comment_id, 'votes', true );\n\t\t\t\t\twp_send_json_success( array( 'count' => $this->count_votes( $users_count, $vote_type ) ) );\n\t\t\t\t} else {\n\t\t\t\t\twp_send_json_error();\n\t\t\t\t}\n\t\t\t} elseif ( isset( $users[ $user_id ] ) && $users[ $user_id ] === $vote_type ) {\n\t\t\t\t// Voting twice of the same type.\n\t\t\t\twp_send_json_error();\n\t\t\t} elseif ( isset( $users[ $user_id ] ) ) {\n\t\t\t\t// Switching votes.\n\t\t\t\t$users[ $user_id ] = $vote_other;\n\t\t\t\tif ( update_comment_meta( $comment_id, 'votes', $users ) ) {\n\t\t\t\t\twp_send_json_success(\n\t\t\t\t\t\tarray(\n\t\t\t\t\t\t\t'vote switched',\n\t\t\t\t\t\t\t$vote_type,\n\t\t\t\t\t\t\tarray(\n\t\t\t\t\t\t\t\t'count_up' => $this->count_votes( $users, 'up' ),\n\t\t\t\t\t\t\t\t'count_down' => $this->count_votes( $users, 'down' ),\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} else {\n\t\t\t\t\twp_send_json_error();\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// Add more votes.\n\t\t\t\t$users[ $user_id ] = $vote_type;\n\t\t\t\tif ( update_comment_meta( $comment_id, 'votes', $users ) ) {\n\t\t\t\t\t$users_count = get_comment_meta( $comment_id, 'votes', true );\n\t\t\t\t\twp_send_json_success( array( 'count' => $this->count_votes( $users_count, $vote_type ) ) );\n\t\t\t\t} else {\n\t\t\t\t\twp_send_json_error();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\twp_die();\n\t\t}", "public function test_user_cannot_vote_on_their_own_messages() {\n\n $this->expectException(VotingException::class);\n $this->message->upvote($this->user);\n\n }", "function getVoted()\n {\n JSession::checkToken() or jexit('Invalid Token');\n\n $app = JFactory::getApplication();\n $idea_id = JRequest::getInt('id', 0);\n $option_id = JRequest::getInt('voteid', 0);\n $idea = JTable::getInstance('Idea', 'Table');\n\n if(!$idea->load($idea_id) || $idea->published != 1)\n {\n $app->redirect('index.php', JText::_('ALERTNOTAUTH 1'));\n\n return true;\n }\n\n require_once(JPATH_COMPONENT . '/models/idea.php');\n $model = new JUIdeiModelIdea();\n $params = new JRegistry($idea->params);\n $cookieName = JApplicationHelper::getHash($app->getName() . 'idea' . $idea_id);\n\n\n $voted_cookie = JRequest::getVar($cookieName, '0', 'COOKIE', 'INT');\n $voted_ip = $model->ipVoted($idea, $idea_id);\n\n if($params->get('ip_check') and ($voted_cookie or $voted_ip or !$option_id))\n {\n /*if($voted_cookie || $voted_ip)\n {\n $msg = JText::_('COM_MIR_ALREADY_VOTED');\n $tom = \"error\";\n }\n\n if(!$option_id)\n {\n $msg = JText::_('COM_MIR_NO_SELECTED');\n $tom = \"error\";\n }\n */\n\n $this->_voted = 0;\n }\n else\n {\n if($model->vote($idea_id, $option_id))\n {\n $this->_voted = 1;\n\n setcookie($cookieName, '1', time() + 60 * $idea->lag);\n }\n else\n {\n $this->_voted = 0;\n }\n }\n\n return $this->_voted = 1;\n }", "function downvote($idvideo){\n \t$realid = pg_escape_string($idvideo);\n \t$query1 = \"SELECT downvotes FROM video where idvideo = \".$realid;\n \t$link = createConection();\n \tif($row = pg_fetch_array(pg_exec($link,$query1))){\n \t\t$total = $row['downvotes'] + 1;\n \t\t$query2 = \"UPDATE video set downvotes = \".$total.\" where idvideo = \".$realid.\";\";\n \t\tpg_exec($link, $query2);\n \t\tcloseConection($link);\n \t\treturn true;\n \t}else{\n \t\tcloseConection($link);\n \t\treturn false;\n \t}\n }", "public function testRemoveNonExistingVote()\n {\n $this\n ->voteDirector\n ->expects($this->any())\n ->method('findOneBy')\n ->will($this->returnValue(null));\n\n $this\n ->voteDirector\n ->expects($this->never())\n ->method('remove');\n\n $this\n ->voteManager\n ->removeVote(\n $this->comment,\n $this->authorToken,\n Vote::DOWN\n );\n }", "public function save_votes()\n {\n $result = false;\n if ($this->checkToken()) {\n if ($this->save_plus_minus_votes()) {\n $this->set_token_used();\n $result = true;\n } else {\n $this->set_result_error('saveVotesFailed');\n }\n }\n return $result;\n }", "static function upVote($post_id){\n\n\t\tsession_start();\n\t\t$username = $_SESSION['user']->getUsername();\n\t\t$db = (new Database())->connectToDatabase();\n\t\t//fIRSTLY CHECK IF USER IS THE AUTHOR OF THE ANSWER?\n\t\t//\n\t\t\n\t\t$db->query(\"SELECT * FROM post WHERE user_name='$username' AND post_id=$post_id\");\n\n\n\t\t\n\t\tif($db->returned_rows==0)\n\t\t{\n\t\t\t//has this user already voted?\n\t\t\t$db->query(\"SELECT * FROM post_votes WHERE post_id=$post_id AND user_name='$username'\");\n\t\t\tif(($db->returned_rows)==1){\n\t\t\t//user has not voted on this answer\n\t\t\t//increase reputation of user who answered\n\t\t\t\n\t\t\t$db->query(\"DELETE FROM post_votes WHERE post_id=$post_id AND user_name='$username'\");\n\t\t\t}\n\t\t//finally insert his vote\n\t\t$db->insert('post_votes',array('post_id'=>$post_id,'user_name'=>$username,'vote_type'=>1));\n\t\t//200=OKAY\n\t\treturn array('status_code'=>200);\n\t\t}\n\t\telse{\n\t\t\t//user has already voted on this post\n\t\t\t//400=BAD REQUEST\n\t\t\treturn array('status_code'=>400,'detail'=>'user is the author of the answer');\n\t\t}\n\n\t}", "public function checkTrophyVote($trophy_id)\r\n {\r\n $model = new Ynidea_Model_DbTable_Trophies;\r\n $select = $model -> select()->where('trophy_id = ?',$trophy_id); \r\n $row = $model->fetchRow($select); \r\n if($row->status == 'voting')\r\n return true;\r\n else\r\n return false; \r\n }", "public function voteQuestion(Question $question,$vote){\n $votesQuestions = $this->voteQuestions();\n $this->_vote($votesQuestions,$question,$vote);\n // if($votesQuestions->where('votable_id',$question->id)->exists()){\n // $votesQuestions->updateExistingPivot($question,['vote'=>$vote]);\n // }else{\n // $votesQuestions->attach($question,['vote'=>$vote]);\n // }\n // // in order to calculate the votes_count first refresh the relationship\n // $this->load('voteQuestions');\n\n // $voteDown = (int) $question->downVote()->sum('vote');\n // $voteUp = (int) $question->upVote()->sum('vote');\n\n // $voteTotal = $voteDown + $voteUp;\n // $question->votes_count = $voteTotal;\n // $question->save();\n}", "function insertAVote($idSondage, $idUtilisateur, $vote) {\n\t\t$selectPrepa = self::$bdd -> prepare(\"INSERT INTO avote (idSondage, idUtilisateur, vote) VALUES (:idSondage, :idUtilisateur, :vote)\");\n\t\t$selectPrepa -> execute(array('idSondage' => $idSondage, 'idUtilisateur' => $idUtilisateur, 'vote' => $vote));\n\t\treturn $selectPrepa->rowCount();\n\t}" ]
[ "0.8305013", "0.81757677", "0.7633081", "0.73431927", "0.7086397", "0.70223105", "0.68732405", "0.6857235", "0.6841697", "0.6716169", "0.66330063", "0.6621983", "0.6573201", "0.656122", "0.65545183", "0.6512554", "0.64515966", "0.64219916", "0.64104456", "0.6376184", "0.6365817", "0.63502926", "0.6321969", "0.63186157", "0.6300645", "0.62836707", "0.628264", "0.62814707", "0.6273056", "0.6266868", "0.61794406", "0.6145475", "0.61311316", "0.6126313", "0.6087818", "0.60639495", "0.60401267", "0.60380566", "0.6032938", "0.60174245", "0.601461", "0.6003929", "0.5990483", "0.59737724", "0.59621304", "0.59594524", "0.594327", "0.5897216", "0.5895738", "0.58811736", "0.58682793", "0.58607906", "0.5852106", "0.5845379", "0.58433264", "0.58262944", "0.582251", "0.581789", "0.5815469", "0.5807113", "0.58061874", "0.5789646", "0.5789611", "0.57866156", "0.57647437", "0.57558465", "0.575437", "0.57449096", "0.5727842", "0.57247454", "0.57202214", "0.57199144", "0.57188797", "0.5711962", "0.5703501", "0.5697767", "0.56964076", "0.5686125", "0.5663004", "0.5651642", "0.5651642", "0.561922", "0.56118053", "0.55979145", "0.55860835", "0.5583938", "0.55802995", "0.5568957", "0.55631465", "0.5561252", "0.55579364", "0.5557681", "0.55510795", "0.554744", "0.55446863", "0.55324817", "0.5531383", "0.5529798", "0.55288196", "0.5522031" ]
0.5970391
44
Data provider for testVoteAsResource(). These test workflow transitions that apply to users being logged in and attempting the transition on a Task to which they are the assigned resource.
public function providerTestVoteAsResource() { return array( // Resources are allowed to accept a Task that is assigned to them. array(Task::STATUS_ASSIGNED, Task::STATUS_STARTED, StatusVoter::ACCESS_GRANTED), // Resources are not allowed to directly start on a new Task. // It needs to explicitly have the "assigned" status. array(Task::STATUS_NEW, Task::STATUS_STARTED, StatusVoter::ACCESS_DENIED), // Resources are allowed to send in their completed work. array(Task::STATUS_STARTED, Task::STATUS_FINISHED, StatusVoter::ACCESS_GRANTED), ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function providerTestVote()\n {\n return array(\n // No user may ever start any Task if the Task has no resource.\n array(Task::STATUS_ASSIGNED, Task::STATUS_STARTED, StatusVoter::ACCESS_DENIED),\n // No user may ever re-assign any Task if it is finished.\n array(Task::STATUS_FINISHED, Task::STATUS_ASSIGNED, StatusVoter::ACCESS_DENIED),\n // No user may ever re-assign any Task if it is sent to the client.\n array(Task::STATUS_SENT, Task::STATUS_ASSIGNED, StatusVoter::ACCESS_DENIED),\n // No user may ever re-assign any Task if it is archived.\n array(Task::STATUS_ARCHIVED, Task::STATUS_ASSIGNED, StatusVoter::ACCESS_DENIED),\n );\n }", "public function testVoteAsResource($currentStatus, $newStatus, $expectedAccessResult)\n {\n $token = $this->getMock('Symfony\\Component\\Security\\Core\\Authentication\\Token\\TokenInterface');\n $user = new User();\n\n $token->expects($this->once())\n ->method('getUser')\n ->willReturn($user);\n\n $roleHierarchy = $this->getMock('Symfony\\Component\\Security\\Core\\Role\\RoleHierarchyInterface');\n $voter = new StatusVoter($roleHierarchy);\n\n $task = new Task();\n $task->setStatus($currentStatus);\n $task->setResource($user);\n\n $this->assertEquals($expectedAccessResult, $voter->vote($token, $task, array($newStatus)));\n }", "public function testPostVoteOnQuestion(): void {\n $user = factory(User::class)->create();\n $q = factory(Question::class)->create();\n $url = \"/api/questions/$q->id\";\n //up and cancel\n $this->get(url(\"$url/votes\"))\n ->assertStatus(200)\n ->assertJsonFragment(['total' => 0]);\n $this->post(url(\"$url/upvote\"), ['api_token' => $user->api_token])\n ->assertStatus(200)\n ->assertJsonFragment(['total' => 1, 'up' => 1]);\n $this->post(url(\"$url/upvote\"), ['api_token' => $user->api_token])\n ->assertStatus(200)\n ->assertJsonFragment(['total' => 0, 'up' => 0]);\n //down and cancel\n $this->post(url(\"$url/downvote\"), ['api_token' => $user->api_token])\n ->assertStatus(200)\n ->assertJsonFragment(['total' => -1, 'down' => 1]);\n $this->post(url(\"$url/downvote\"), ['api_token' => $user->api_token])\n ->assertStatus(200)\n ->assertJsonFragment(['total' => 0, 'down' => 0]);\n // down up down\n $this->post(url(\"$url/downvote\"), ['api_token' => $user->api_token])\n ->assertStatus(200)\n ->assertJsonFragment(['total' => -1, 'down' => 1]);\n $this->post(url(\"$url/upvote\"), ['api_token' => $user->api_token])\n ->assertStatus(200)\n ->assertJsonFragment(['total' => 1, 'up' => 1]);\n $this->post(url(\"$url/downvote\"), ['api_token' => $user->api_token])\n ->assertStatus(200)\n ->assertJsonFragment(['total' => -1, 'down' => 1]);\n\n $this->get(url(\"$url/votes\"))\n ->assertStatus(200)\n ->assertJsonFragment(['total' => -1]);\n }", "public function testGetTaskInstanceIdentityLinks()\n {\n }", "public function test_users_vote_can_be_retrieved() {\n\n $user = User::create('[email protected]', 'secret', 'Jane Doe');\n\n $this->assertNull($this->message->getVote($user));\n\n $this->message->upvote($user);\n $this->assertEquals('up', $this->message->getVote($user));\n\n $this->message->downvote($user);\n $this->assertEquals('down', $this->message->getVote($user));\n\n }", "public function testVote($currentStatus, $newStatus, $expectedAccessResult)\n {\n $token = $this->getMock('Symfony\\Component\\Security\\Core\\Authentication\\Token\\TokenInterface');\n $voter = $this->createVoter();\n $task = new Task();\n $task->setStatus($currentStatus);\n $this->assertEquals($expectedAccessResult, $voter->vote($token, $task, array($newStatus)));\n }", "public function voteForResource(\\TYPO3\\Flow\\Security\\Context $securityContext, $resource)\n {\n }", "public function test_a_user_can_vote_for_a_post()\n {\n $user = $this->defaultUser();\n\n $post = $this->createPost();\n\n $this->browse(function (Browser $browser) use($user,$post) {\n $browser->loginAs($user)\n ->visit($post->url)\n ->pressAndWaitFor('+1')\n ->assertSeeIn('current-vote',1);\n });\n }", "public function testGetTaskInstanceVariable()\n {\n }", "public function testTask()\n {\n $task = new Task();\n $user = new User();\n\n $this->assertNull($task->getId());\n $task->setTitle('test');\n $this->assertSame('test', $task->getTitle());\n $task->setContent('testcontent');\n $this->assertSame('testcontent', $task->getContent());\n $task->toggle(true);\n $this->assertTrue( $task->isDone());\n $task->setUser($user);\n $this->assertInstanceOf(User::class, $task->getUser());\n $task->setCreatedAt(new \\DateTime());\n $this->assertNotEmpty($task->getCreatedAt());\n }", "public function testCreateTaskInstanceIdentityLinks()\n {\n }", "public function testSeeTaskButton()\n {\n $user = User::first();\n $project = $user->projects()->first();\n \\Auth::login($user);\n $response = $this->actingAs($user)->get('/projects/'.$project->id);\n $response->assertSee(__(\"project.add_task\"));\n }", "function testMarkAsVoted() {\n\t\t/*\n\t\t$mobilePoll = $this->ObjFromFixture('Poll', 'mobile-poll');\n\t\t$mobilePoll->markAsVoted();\n\t\t$this->assertTrue($mobilePoll->hasVoted());\n\t\t*/\n\t}", "public function test_a_user_can_toggle_posts(){\n \n //we have a signed in user\n \n //user likes the model\n $this->post->toggle();\n\n $this->assertTrue($this->post->isLiked());\n\n $this->post->toggle();\n\n $this->assertFalse($this->post->isLiked());\n }", "public function testAuthorizeOperationOnResourceTypeFail()\n {\n // set up environment variables (current user is not signed in and currently is work time)\n $this->currentUserId = null;\n $this->currentUserRole = null;\n $this->isWorkTime = true;\n $policyEnforcement = $this->createPolicyEnforcementPoint();\n\n // send authorization request\n $authRequest = new Request([\n RequestProperties::REQUEST_OPERATION => Posts::OPERATION_CREATE,\n RequestProperties::REQUEST_RESOURCE_TYPE => Posts::RESOURCE_TYPE,\n ]);\n\n // we expect it to fail because operation `create` is not defined in Policies.\n $this->assertFalse($policyEnforcement->authorize($authRequest));\n $this->assertFalse(static::$obligationCalled);\n $this->assertFalse(static::$adviceCalled);\n }", "public function testvote()\n {\n $this->vote_answer = Vote::vote($this->user->id, $this->answer->id, 1, 'answer_id');\n if (!$this->answer) return false;\n }", "public function testPostVoteOnAnswer(): void {\n $user = factory(User::class)->create();\n $q = factory(Question::class)->create();\n $a = factory(Answer::class)->create(['question_id' => $q->id]);\n $url = \"/api/answers/$a->id\";\n //up and cancel\n $this->get(url(\"$url/votes\"))\n ->assertStatus(200)\n ->assertJsonFragment(['total' => 0]);\n $this->post(url(\"$url/upvote\"), ['api_token' => $user->api_token])\n ->assertStatus(200)\n ->assertJsonFragment(['total' => 1, 'up' => 1]);\n $this->post(url(\"$url/upvote\"), ['api_token' => $user->api_token])\n ->assertStatus(200)\n ->assertJsonFragment(['total' => 0, 'up' => 0]);\n // down and cancel\n $this->post(url(\"$url/downvote\"), ['api_token' => $user->api_token])\n ->assertStatus(200)\n ->assertJsonFragment(['total' => -1, 'down' => 1]);\n $this->post(url(\"$url/downvote\"), ['api_token' => $user->api_token])\n ->assertStatus(200)\n ->assertJsonFragment(['total' => 0, 'down' => 0]);\n //down up down\n $this->post(url(\"$url/downvote\"), ['api_token' => $user->api_token])\n ->assertStatus(200)\n ->assertJsonFragment(['total' => -1, 'down' => 1]);\n $this->post(url(\"$url/upvote\"), ['api_token' => $user->api_token])\n ->assertStatus(200)\n ->assertJsonFragment(['total' => 1, 'up' => 1]);\n $this->post(url(\"$url/downvote\"), ['api_token' => $user->api_token])\n ->assertStatus(200)\n ->assertJsonFragment(['total' => -1, 'down' => 1]);\n\n $this->get(url(\"$url/votes\"))\n ->assertStatus(200)\n ->assertJsonFragment(['total' => -1]);\n }", "public function testPatchReviewerRequiredToggle()\n {\n $this->createChange();\n Review::createFromChange('1')->save()->updateFromChange('1')\n ->setParticipantData('nonadmin', true, 'required')->addVote('nonadmin', 1)\n ->save();\n\n // there shouldn't be any tasks but proccess just to be safe\n $this->getRequest()->getQuery()->set('debug', 1)->set('retire', 1);\n $this->dispatch('/queue/worker');\n\n // verify the starting state is good\n $this->assertSame(\n array(\n 'admin' => array(),\n 'nonadmin' => array(\n 'required' => true, 'vote' => array('value' => 1, 'version' => 1, 'isStale' => false)\n )\n ),\n Review::fetch('2', $this->p4)->getParticipantsData()\n );\n\n $expected = array(\n 'admin' => array(), // as they are the author; can't get rid of em\n 'nonadmin' => array('vote' => array('value' => 1, 'version' => 1, 'isStale' => false))\n );\n $this->getRequest()\n ->setMethod(\\Zend\\Http\\Request::METHOD_POST)\n ->setPost(new Parameters(array('required' => false)))\n ->setQuery(new Parameters(array('_method' => 'patch')));\n\n // dispatch and check output\n $this->dispatch('/reviews/2/reviewers/nonadmin');\n $this->assertRoute('review-reviewer');\n $this->assertResponseStatusCode(200);\n $result = $this->getResult();\n $this->assertInstanceOf('Zend\\View\\Model\\JsonModel', $result);\n $review = $result->getVariable('review');\n // @codingStandardsIgnoreStart\n $this->assertSame(true, $result->getVariable('isValid'), print_r($result->getVariables(), true));\n // @codingStandardsIgnoreEnd\n $this->assertSame(\n $expected,\n $review['participantsData']\n );\n\n // proccess all tasks as they may impact things\n $this->getRequest()->getQuery()->set('debug', 1)->set('retire', 1);\n $this->dispatch('/queue/worker');\n\n // verify participants are still correct\n $review = Review::fetch('2', $this->p4);\n $this->assertSame(\n $expected,\n $review->getParticipantsData()\n );\n\n\n // now try using patch and setting it to required\n $expected['nonadmin'] = array(\n 'required' => true, 'vote' => array('value' => 1, 'version' => 1, 'isStale' => false)\n );\n $this->getRequest()\n ->setMethod(\\Zend\\Http\\Request::METHOD_PATCH)\n ->setPost(new Parameters(array('required' => '1')));\n\n // dispatch and check output\n $this->dispatch('/reviews/2/reviewers/nonadmin');\n $this->assertRoute('review-reviewer');\n $this->assertResponseStatusCode(200);\n $result = $this->getResult();\n $this->assertInstanceOf('Zend\\View\\Model\\JsonModel', $result);\n $review = $result->getVariable('review');\n // @codingStandardsIgnoreStart\n $this->assertSame(true, $result->getVariable('isValid'), print_r($result->getVariables(), true));\n // @codingStandardsIgnoreEnd\n $this->assertSame(\n $expected,\n $review['participantsData']\n );\n\n // proccess all tasks as they may impact things\n $this->getRequest()->getQuery()->set('debug', 1)->set('retire', 1);\n $this->dispatch('/queue/worker');\n\n // verify participants are still correct\n $review = Review::fetch('2', $this->p4);\n $this->assertSame(\n $expected,\n $review->getParticipantsData()\n );\n }", "public function testAdultUsersCanSeeTaskList()\n {\n $this->withoutExceptionHandling();\n Task::factory(3)->create();\n $adult = User::create([\n 'name' => 'vanessa',\n 'role' => 'adult',\n 'points' => 0,\n 'email' => '[email protected]',\n 'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi',\n 'remember_token' => Str::random(10)\n ]);\n\n $response = $this->actingAs($adult)\n ->get(route('dashboard.tasks'));\n $response->assertStatus(200)\n ->assertViewIs('dashboard.task-list')\n ->assertViewHas('taskList');\n }", "public function testAssignTask()\n {\n // workflow, rule, action and object\n $this->task = factory(TaskEloquent::class)->create([\n 'user_id' => null,\n 'person_id' => null,\n ]);\n\n $workflow = factory(WorkflowEloquent::class)->create([\n 'user_id' => $this->user->getKey(),\n ]);\n $action1 = factory(ActionEloquent::class)->create([\n 'action_type' => ActionEloquent::ACTION_TYPE_ASSIGN,\n 'target_class' => '',\n 'target_field' => '',\n 'value' => '',\n 'task_id' =>$this->task->getKey(),\n ]);\n $workflow->actions()->sync([$action1->getKey() ]); //, $action2->getKey()\n $object = factory(ObjectEloquent::class)->create([\n 'workflow_id' => $workflow->getKey(),\n 'object_class' => 'tags.id',\n 'object_type' => $this->tag->getKey(),\n ]);\n\n\n // rule\n $rule1 = factory(RuleEloquent::class)->create([\n 'name' => 'assign task to user',\n 'workflow_id' => $workflow->getKey(),\n 'rule_type' => RuleEloquent::FIELD_TYPE_NUMBER,\n 'operator' => RuleEloquent::OPERATOR_EQUAL,\n 'field_name' => 'person_contexts.stage_id',\n 'value' => $this->stageId,\n 'runnable_once' => 1, // only once\n ]);\n\n $action1->rules()->sync([ $rule1->getKey()]);\n\n // run action runner\n $kernel = $this->app->make(Kernel::class);\n $status = $kernel->handle(\n $input = new ArrayInput(array(\n 'command' => 'workflow:action-run',\n 'workflow' => $workflow->getKey(),\n 'action' => $action1->getKey(),\n )),\n $output = new BufferedOutput\n );\n //echo $output->fetch();\n $this->assertEquals($status, 0);\n\n // check status\n $this->seeInDatabase('action_logs',[\n 'action_id' => $action1->getKey(),\n 'workflow_id' => $workflow->getKey(),\n 'status' => LogInterface::LOG_STATUS_SUCCESS,\n 'object_class' => $this->person->getLoggableType(), //$leadContext->getLoggableType(),\n 'object_id' => $this->person->getKey(), //$leadContext->getKey(),\n 'user_id' => $this->user->getKey(),\n ]);\n\n // check task\n $this->seeInDatabase('tasks',[\n 'id' => $this->task->getKey(),\n 'user_id' => $this->user->getKey(),\n ]);\n\n $this->cleanUpRecords(new PersonObserver, $this->person);\n }", "public function test_that_authorized_user_can_view_courses_within_other_periods()\n {\n \n }", "public function testHaveOneProVoter()\n {\n $strategy = new Affirmative([\n $this->createVoter([\n 'edit' => [\n 'supports' => true,\n 'granted' => true\n ],\n 'remove' => [\n 'supports' => true,\n 'granted' => false\n ]\n ]),\n $this->createVoter([\n 'edit' => [\n 'supports' => true,\n 'granted' => false\n ],\n 'remove' => [\n 'supports' => false,\n 'granted' => false\n ]\n ]),\n ]);\n\n self::assertTrue($strategy->isGranted(['edit', 'remove'], null, null));\n }", "public function testUserWithAccesToResource()\n {\n $this->logged();\n $this->visit('/resource')\n ->seePageIs('/resource');\n }", "public function testActionUseCase2()\n {\n // person and target\n\n // workflow, rule and action\n $workflow = factory(WorkflowEloquent::class)->create([\n 'user_id' => $this->user->getKey(),\n ]);\n $action1 = factory(ActionEloquent::class)->create([\n 'action_type' => ActionEloquent::ACTION_TYPE_UPDATE,\n 'target_class' => 'persons',\n 'target_field' => 'is_primary',\n 'value' => 1,\n ]);\n $workflow->actions()->sync([$action1->getKey()]);\n $rule1 = factory(RuleEloquent::class)->create([\n 'name' => 'is preapprove person',\n 'workflow_id' => $workflow->getKey(),\n 'rule_type' => RuleEloquent::FIELD_TYPE_BOOLEAN,\n 'operator' => RuleEloquent::OPERATOR_EQUAL,\n 'field_name' => 'persons.is_pre_approved',\n 'value' => '1',\n 'runnable_once' => true,\n 'run_interval' => 0,\n ]);\n $rule2 = factory(RuleEloquent::class)->create([\n 'name' => 'lead type own',\n 'workflow_id' => $workflow->getKey(),\n 'rule_type' => RuleEloquent::FIELD_TYPE_NUMBER,\n 'operator' => RuleEloquent::OPERATOR_EQUAL,\n 'field_name' => 'person_contexts.lead_type_id',\n 'value' => $this->leadTypeId,\n ]);\n\n $action1->rules()->sync([ $rule1->getKey(), $rule2->getKey()]); //\n\n $object = factory(ObjectEloquent::class)->create([\n 'workflow_id' => $workflow->getKey(),\n 'object_class' => 'tags.id',\n 'object_type' => $this->tag->getKey(),\n ]);\n // check tag\n $this->seeInDatabase('taggables',[\n 'user_id' => $this->user->getKey(),\n 'tag_id' => $this->tag->getKey(),\n 'taggable_id' => $this->person->getKey(),\n 'taggable_type' => 'persons',\n ]);\n\n //// first time run ////\n $kernel = $this->app->make(Kernel::class);\n $status = $kernel->handle(\n $input = new ArrayInput(array(\n 'command' => 'workflow:action-run',\n 'workflow' => $workflow->getKey(),\n 'action' => $action1->getKey(),\n )),\n $output = new BufferedOutput\n );\n $this->assertEquals($status, 0);\n //$this->assertEquals(1, preg_match('/^Complete fire actions/m', $output->fetch()));\n\n // check logs\n $this->seeInDatabase('action_logs',[\n 'action_id' => $action1->getKey(),\n 'workflow_id' => $workflow->getKey(),\n 'status' => LogInterface::LOG_STATUS_SUCCESS,\n 'object_class' => $this->person->getLoggableType(),\n 'object_id' => $this->person->getKey(),\n ]);\n $this->seeInDatabase('action_log_rules',[\n 'rule_id' => $rule1->getKey()\n ]);\n $this->seeInDatabase('action_log_rules',[\n 'rule_id' => $rule2->getKey()\n ]);\n\n //// second run must failed ////\n $status = $kernel->handle(\n $input = new ArrayInput(array(\n 'command' => 'workflow:action-run',\n 'workflow' => $workflow->getKey(),\n 'action' => $action1->getKey(),\n )),\n $output = new BufferedOutput\n );\n //echo $output->fetch();\n $this->assertEquals($status, 0);\n\n // // check logs\n $this->seeInDatabase('action_logs',[\n 'action_id' => $action1->getKey(),\n 'workflow_id' => $workflow->getKey(),\n 'status' => LogInterface::LOG_STATUS_FAILED,\n 'object_class' => $this->person->getLoggableType(),\n 'object_id' => $this->person->getKey(),\n 'info' => 'Already run once!',\n ]);\n $this->seeInDatabase('action_log_rules',[\n 'rule_id' => $rule1->getKey()\n ]);\n $this->seeInDatabase('action_log_rules',[\n 'rule_id' => $rule2->getKey()\n ]);\n\n //cleanup.\n $this->cleanUpRecords(new PersonObserver, $this->person);\n }", "public function testTriggerCanControlScheduledTasks() {\n AuthenticationHelper::login(\"[email protected]\", \"password\");\n\n $dataSetInstanceSummary = new DatasetInstanceSummary(\"Test dataset\", \"test-json\", null, [], [], []);\n $instanceId = $this->datasetService->saveDataSetInstance($dataSetInstanceSummary, null, 1);\n\n $snapshotProfileSummary = new DatasetInstanceSnapshotProfileSummary(\"Summary Adhoc\", \"tabulardatasetsnapshot\", [\n ], DatasetInstanceSnapshotProfileSummary::TRIGGER_ADHOC);\n\n $now = (new \\DateTime())->format(\"Y-m-d H:i:s\");\n $id = $this->datasetService->saveSnapshotProfile($snapshotProfileSummary, $instanceId);\n $snapshotProfileSummary->setId($id);\n\n /**\n * @var DatasetInstanceSnapshotProfile $snapshotProfile\n */\n $snapshotProfile = DatasetInstanceSnapshotProfile::fetch($id);\n\n\n $this->assertEquals(DatasetInstanceSnapshotProfileSummary::TRIGGER_ADHOC, $snapshotProfile->getTrigger());\n\n\n $this->assertEquals(DatasetInstanceSnapshotProfileSummary::TRIGGER_ADHOC, $snapshotProfile->getTrigger());\n $this->assertEquals([], $snapshotProfile->getScheduledTask()->getTimePeriods());\n\n\n // Check we can change snapshot to scheduled\n $snapshotProfileSummary->setTrigger(DatasetInstanceSnapshotProfileSummary::TRIGGER_SCHEDULE);\n $snapshotProfileSummary->setTaskTimePeriods([new ScheduledTaskTimePeriod(null, 5, 20, 33)]);\n $this->datasetService->saveSnapshotProfile($snapshotProfileSummary, $instanceId);\n\n\n /**\n * @var DatasetInstanceSnapshotProfile $snapshotProfile\n */\n $scheduledSnapshotProfile = DatasetInstanceSnapshotProfile::fetch($id);\n /**\n * @var ScheduledTask $task\n */\n $task = $scheduledSnapshotProfile->getScheduledTask();\n $this->assertEquals(\"dataprocessor\", $task->getTaskIdentifier());\n $this->assertEquals(DatasetInstanceSnapshotProfileSummary::TRIGGER_SCHEDULE, $scheduledSnapshotProfile->getTrigger());\n $this->assertEquals(new ScheduledTaskTimePeriod(null, 5, 20, 33, $scheduledSnapshotProfile->getScheduledTask()->getTimePeriods()[0]->getId()),\n $scheduledSnapshotProfile->getScheduledTask()->getTimePeriods()[0]);\n\n\n // Alter this scheduled snapshot\n $snapshotProfileSummary->setTitle(\"New Title\");\n $snapshotProfileSummary->setTaskTimePeriods([new ScheduledTaskTimePeriod(3, null, 4, 1)]);\n $this->datasetService->saveSnapshotProfile($snapshotProfileSummary, $instanceId);\n\n /**\n * @var DatasetInstanceSnapshotProfile $snapshotProfile\n */\n $newScheduledSnapshotProfile = DatasetInstanceSnapshotProfile::fetch($id);\n\n $this->assertEquals(DatasetInstanceSnapshotProfileSummary::TRIGGER_SCHEDULE, $newScheduledSnapshotProfile->getTrigger());\n $this->assertEquals(new ScheduledTaskTimePeriod(3, null, 4, 1, $newScheduledSnapshotProfile->getScheduledTask()->getTimePeriods()[0]->getId()),\n $newScheduledSnapshotProfile->getScheduledTask()->getTimePeriods()[0]);\n\n // Check we can revert to adhoc\n $snapshotProfileSummary->setTrigger(DatasetInstanceSnapshotProfileSummary::TRIGGER_ADHOC);\n $this->datasetService->saveSnapshotProfile($snapshotProfileSummary, $instanceId);\n\n /**\n * @var DatasetInstanceSnapshotProfile $snapshotProfile\n */\n $adhocSnapshotProfile = DatasetInstanceSnapshotProfile::fetch($id);\n\n $this->assertEquals(DatasetInstanceSnapshotProfileSummary::TRIGGER_ADHOC, $adhocSnapshotProfile->getTrigger());\n $this->assertEquals([], $adhocSnapshotProfile->getScheduledTask()->getTimePeriods());\n }", "public function testListTasksInstanceIdentityLinks()\n {\n }", "public function user_can_be_retrieved_with_correct_resource_elements()\n {\n $this\n ->get(\"nova-api/users/{$this->user->id}\")\n ->assertJson([\n 'resource' => [\n 'id' => [\n 'value' => $this->user->id,\n ],\n 'fields' => [\n [\n 'attribute' => 'id',\n 'component' => 'id-field',\n 'name' => 'ID',\n 'sortable' => true,\n 'value' => $this->user->id,\n ],\n [\n 'attribute' => 'email',\n 'component' => 'file-field',\n 'name' => 'Avatar',\n 'value' => null,\n 'thumbnailUrl' => 'https://www.gravatar.com/avatar/'.md5($this->user->email).'?s=300',\n ],\n [\n 'attribute' => 'first_name',\n 'component' => 'text-field',\n 'name' => 'First Name',\n 'sortable' => true,\n 'value' => $this->user->first_name,\n ],\n [\n 'attribute' => 'last_name',\n 'component' => 'text-field',\n 'name' => 'Last Name',\n 'sortable' => true,\n 'value' => $this->user->last_name,\n ],\n [\n 'attribute' => 'email',\n 'component' => 'text-field',\n 'name' => 'Email',\n 'sortable' => true,\n 'value' => $this->user->email,\n ],\n [\n 'attribute' => 'has_notifications_enabled',\n 'component' => 'boolean-field',\n 'name' => 'Has Notifications Enabled',\n 'value' => $this->user->has_notifications_enabled,\n ],\n [\n 'attribute' => 'role',\n 'component' => 'belongs-to-field',\n 'name' => 'Role',\n 'value' => $this->user->role->name,\n ],\n [\n 'attribute' => 'extra_attributes',\n 'component' => 'key-value-field',\n 'name' => 'Extra Attributes',\n 'value' => [],\n ],\n [\n 'component' => 'heading-field',\n 'value' => 'Meta',\n ],\n [\n 'attribute' => 'created_at',\n 'component' => 'date-time',\n 'name' => 'Created At',\n 'value' => $this->user->created_at,\n ],\n [\n 'attribute' => 'updated_at',\n 'component' => 'date-time',\n 'name' => 'Updated At',\n 'value' => $this->user->updated_at,\n ],\n ],\n ],\n ]);\n }", "public function testEditReviewers()\n {\n $user = new User;\n $user->setId('gnicol')->setEmail('[email protected]')->setFullName('gnicol')->save();\n $user->setId('dj')->setEmail('[email protected]')->setFullName('dj')->save();\n\n // create review record for change 1 and prime it with a vote\n $this->createChange();\n Review::createFromChange('1')->save()->updateFromChange('1')\n ->setParticipantData('gnicol', true, 'required')->addVote('gnicol', 1)\n ->save();\n\n // there shouldn't be any tasks but proccess just to be safe\n $this->getRequest()->getQuery()->set('debug', 1)->set('retire', 1);\n $this->dispatch('/queue/worker');\n\n // verify the starting state is good\n $this->assertSame(\n array(\n 'admin' => array(),\n 'gnicol' => array(\n 'required' => true, 'vote' => array('value' => 1, 'version' => 1, 'isStale' => false)\n )\n ),\n Review::fetch('2', $this->p4)->getParticipantsData()\n );\n\n $expected = array(\n 'admin' => array(), // as they are the author; can't get rid of em\n 'dj' => array('required' => true),\n 'gnicol' => array('vote' => array('value' => 1, 'version' => 1, 'isStale' => false))\n );\n $postData = new Parameters(\n array(\n 'reviewers' => array('gnicol', 'dj'),\n 'requiredReviewers' => array('dj')\n )\n );\n $this->getRequest()\n ->setMethod(\\Zend\\Http\\Request::METHOD_POST)\n ->setPost($postData);\n\n // dispatch and check output\n $this->dispatch('/reviews/2/reviewers');\n $result = $this->getResult();\n $review = $result->getVariable('review');\n $this->assertRoute('review-reviewers');\n $this->assertResponseStatusCode(200);\n $this->assertInstanceOf('Zend\\View\\Model\\JsonModel', $result);\n // @codingStandardsIgnoreStart\n $this->assertSame(true, $result->getVariable('isValid'), print_r($result->getVariables(), true));\n // @codingStandardsIgnoreEnd\n $this->assertSame(\n $expected,\n $review['participantsData']\n );\n\n // process all tasks as they may impact things\n $this->getRequest()->getQuery()->set('debug', 1)->set('retire', 1);\n $this->dispatch('/queue/worker');\n\n // verify participants are still correct\n $review = Review::fetch('2', $this->p4);\n $this->assertSame(\n $expected,\n $review->getParticipantsData()\n );\n }", "public function testActionUseCase3()\n {\n\n // person, user, and target\n $user = factory(UserEloquent::class)->create();\n $person = factory(PersonEloquent::class)->create([\n 'is_pre_approved' => 0,\n 'is_primary' => 0,\n ]);\n $leadTypeId = LeadTypeEloquent::where('label', 'own')->where('user_id', null)->first()->getKey();\n $stageId = StageEloquent::where('label', 'prospect')->where('user_id', null)->first()->getKey();\n $stageLeadId = StageEloquent::where('label', 'lead')->where('user_id', null)->first()->getKey();\n $leadContext = factory(PersonContextEloquent::class)->create([\n 'user_id' => $user->getKey(),\n 'person_id' => $person->getKey(),\n 'stage_id' => $stageId,\n 'lead_type_id' => $leadTypeId,\n ]);\n $tag = TagEloquent::find(10);\n $person->tags()->attach($tag->getKey(), ['user_id' => $user->getKey()]);\n\n // workflow, rule, action and object\n $workflow = factory(WorkflowEloquent::class)->create([\n 'user_id' => $user->getKey(),\n ]);\n $action1 = factory(ActionEloquent::class)->create([\n 'action_type' => ActionEloquent::ACTION_TYPE_UPDATE,\n 'target_class' => 'persons',\n 'target_field' => 'is_pre_approved',\n 'value' => '1',\n ]);\n $action2 = factory(ActionEloquent::class)->create([\n 'action_type' => ActionEloquent::ACTION_TYPE_UPDATE,\n 'target_class' => 'person_contexts',\n 'target_field' => 'stage_id',\n 'value' => $stageLeadId,\n ]);\n $workflow->actions()->sync([$action1->getKey(), $action2->getKey()]); //\n $object = factory(ObjectEloquent::class)->create([\n 'workflow_id' => $workflow->getKey(),\n 'object_class' => 'tags.id',\n 'object_type' => $tag->getKey(),\n ]);\n\n\n // // parent rule\n $rule1 = factory(RuleEloquent::class)->create([\n 'name' => 'not preapprove person',\n 'workflow_id' => $workflow->getKey(),\n 'rule_type' => RuleEloquent::FIELD_TYPE_BOOLEAN,\n 'operator' => RuleEloquent::OPERATOR_EQUAL,\n 'field_name' => 'persons.is_pre_approved',\n 'value' => '0'\n ]);\n\n // dependent rule\n $rule2 = factory(RuleEloquent::class)->create([\n 'name' => 'is prospect person',\n 'workflow_id' => $workflow->getKey(),\n 'rule_type' => RuleEloquent::FIELD_TYPE_NUMBER,\n 'operator' => RuleEloquent::OPERATOR_EQUAL,\n 'field_name' => 'person_contexts.stage_id',\n 'value' => $stageId,\n 'parent_id' => $rule1->getKey(),\n ]);\n $action1->rules()->sync([ $rule1->getKey()]);\n $action2->rules()->sync([ $rule2->getKey()]);\n\n\n\n //// first time run ////\n $kernel = $this->app->make(Kernel::class);\n $status = $kernel->handle(\n $input = new ArrayInput(array(\n 'command' => 'workflow:action-run',\n 'workflow' => $workflow->getKey(),\n 'action' => $action2->getKey(),\n )),\n $output = new BufferedOutput\n );\n //echo $output->fetch();\n $this->assertEquals($status, 0);\n\n //// check should failed /////\n $this->seeInDatabase('action_logs',[\n 'action_id' => $action2->getKey(),\n 'workflow_id' => $workflow->getKey(),\n 'status' => LogInterface::LOG_STATUS_FAILED,\n 'object_class' => $person->getLoggableType(), //$leadContext->getLoggableType(),\n 'object_id' => $person->getKey(), //$leadContext->getKey(),\n 'info' => 'Dependent rule(s) not meet!',\n ]);\n $this->notSeeInDatabase('person_contexts',[\n 'id' => $leadContext->getKey(),\n $action2->target_field => $action2->value,\n ]);\n\n //// second run, run action 1 first /////\n $status = $kernel->handle(\n $input = new ArrayInput(array(\n 'command' => 'workflow:action-run',\n 'workflow' => $workflow->getKey(),\n 'action' => $action1->getKey(),\n )),\n $output = new BufferedOutput\n );\n $this->assertEquals($status, 0);\n //echo $output->fetch();\n\n // check status\n $this->seeInDatabase('action_logs',[\n 'action_id' => $action1->getKey(),\n 'workflow_id' => $workflow->getKey(),\n 'status' => LogInterface::LOG_STATUS_SUCCESS,\n 'object_class' => $person->getLoggableType(),\n 'object_id' => $person->getKey(),\n ]);\n // check updated by status\n $this->seeInDatabase('persons',[\n 'id' => $person->getKey(),\n $action1->target_field => $action1->value,\n ]);\n\n //// second run, run action 2 then ///\n $status = $kernel->handle(\n $input = new ArrayInput(array(\n 'command' => 'workflow:action-run',\n 'workflow' => $workflow->getKey(),\n 'action' => $action2->getKey(),\n )),\n $output = new BufferedOutput\n );\n //echo $output->fetch();\n $this->assertEquals($status, 0);\n\n // check status\n $this->seeInDatabase('action_logs',[\n 'action_id' => $action2->getKey(),\n 'workflow_id' => $workflow->getKey(),\n 'status' => LogInterface::LOG_STATUS_SUCCESS,\n 'object_class' => $person->getLoggableType(), //$leadContext->getLoggableType(),\n 'object_id' => $person->getKey(), //$leadContext->getKey(),\n ]);\n // check updated by status\n $this->seeInDatabase('person_contexts',[\n 'id' => $leadContext->getKey(),\n $action2->target_field => $action2->value,\n ]);\n\n $this->cleanUpRecords(new PersonObserver, $person);\n }", "public function testApproveAssignmentAsUserSucceeds()\n {\n $request = new \\Request([], ['REQUEST_URI' => \"http://api.dev.joind.in/v2.1/talks/9999/speakers\", 'REQUEST_METHOD' => 'POST']);\n $request->user_id = 2;\n $request->parameters = [\n 'username' => 'janebloggs',\n 'display_name' => 'Jane Bloggs'\n ];\n\n $talks_controller = new \\TalksController();\n $db = $this->getMockBuilder('\\JoindinTest\\Inc\\mockPDO')->getMock();\n\n $talk_mapper = $this->createTalkMapper($db, $request);\n $talk_mapper\n ->expects($this->once())\n ->method('getSpeakerFromTalk')\n ->will(\n $this->returnValue(\n [\n 'speaker_id' => null,\n 'ID' => 1\n ]\n )\n );\n $talk_mapper\n ->expects($this->once())\n ->method('assignTalkToSpeaker')\n ->will($this->returnValue(true));\n $talks_controller->setTalkMapper($talk_mapper);\n\n $user_mapper = $this->createUserMapper($db, $request);\n $user_mapper\n ->expects($this->once())\n ->method('getUserIdFromUsername')\n ->will($this->returnValue(2));\n $talks_controller->setUserMapper($user_mapper);\n\n $pending_talk_claim_mapper = $this->getMockBuilder('\\PendingTalkClaimMapper')\n ->setConstructorArgs(array($db,$request))\n ->getMock();\n $pending_talk_claim_mapper\n ->expects($this->once())\n ->method('claimExists')\n ->will($this->returnValue(\\PendingTalkClaimMapper::HOST_ASSIGN));\n $pending_talk_claim_mapper\n ->expects($this->once())\n ->method('approveAssignmentAsSpeaker')\n ->will($this->returnValue(true));\n\n\n\n $talks_controller->setPendingTalkClaimMapper($pending_talk_claim_mapper);\n\n $event_mapper = $this->createEventMapper($db, $request);\n $talks_controller->setEventMapper($event_mapper);\n\n $this->assertNull($talks_controller->setSpeakerForTalk($request, $db));\n\n }", "public function testGetChallengeActivityTemplate()\n {\n }", "public function testStaleVotes()\n {\n // create review to test with\n $review = new Review($this->p4);\n $review->setParticipants(array('foo', 'bar'))\n ->set('author', 'joe')\n ->save();\n\n // add several versions\n $review->setVersions(\n array(\n array('change' => 2, 'user' => 'joe', 'time' => 700, 'pending' => 1, 'difference' => 1),\n array('change' => 3, 'user' => 'joe', 'time' => 710, 'pending' => 1, 'difference' => 1),\n array('change' => 4, 'user' => 'joe', 'time' => 720, 'pending' => 1, 'difference' => 2),\n )\n )->save();\n\n // prepare connections for users 'foo', 'bar'\n $p4Foo = $this->connectWithAccess('foo', array('//...'));\n $p4Bar = $this->connectWithAccess('bar', array('//...'));\n $userFoo = User::fetch('foo', $this->p4);\n $userBar = User::fetch('bar', $this->p4);\n\n // test that voting without version applies to latest\n $services = $this->getApplication()->getServiceManager();\n $services->setService('p4_user', $p4Foo)\n ->setService('user', $userFoo);\n $this->getRequest()->setMethod('POST');\n $this->dispatch('/reviews/' . $review->getId() . '/vote/up');\n\n $votes = Review::fetch($review->getId(), $this->p4)->getVotes();\n $this->assertSame(1, count($votes));\n $this->assertSame(1, $votes['foo']['value']);\n $this->assertSame(3, $votes['foo']['version']);\n $this->assertSame(false, $votes['foo']['isStale']);\n\n // try voting on a particular version\n $this->resetApplication();\n $services = $this->getApplication()->getServiceManager();\n $services->setService('p4_user', $p4Foo)\n ->setService('user', $userFoo);\n $this->getRequest()->setMethod('POST')->setPost(new Parameters(array('version' => 2)));\n $this->dispatch('/reviews/' . $review->getId() . '/vote/up');\n\n $votes = Review::fetch($review->getId(), $this->p4)->getVotes();\n $this->assertSame(1, count($votes));\n $this->assertSame(1, $votes['foo']['value']);\n $this->assertSame(2, $votes['foo']['version']);\n $this->assertSame(false, $votes['foo']['isStale']);\n\n // vote as 'bar' on version 1 and verify its evaluated as stale vote\n $this->resetApplication();\n $services = $this->getApplication()->getServiceManager();\n $services->setService('p4_user', $p4Bar)\n ->setService('user', $userBar);\n $this->getRequest()->setMethod('POST')->setPost(new Parameters(array('version' => 1)));\n $this->dispatch('/reviews/' . $review->getId() . '/vote/down');\n\n $votes = Review::fetch($review->getId(), $this->p4)->getVotes();\n $this->assertSame(2, count($votes));\n $this->assertSame(1, $votes['foo']['value']);\n $this->assertSame(2, $votes['foo']['version']);\n $this->assertSame(false, $votes['foo']['isStale']);\n $this->assertSame(-1, $votes['bar']['value']);\n $this->assertSame(1, $votes['bar']['version']);\n $this->assertSame(true, $votes['bar']['isStale']);\n }", "public function testCreateTask()\n {\n }", "public function testAuthorizeOperationSuccess()\n {\n // set up environment variables (current user is not signed in and currently is work time)\n $this->currentUserId = null;\n $this->currentUserRole = null;\n $this->isWorkTime = true;\n $policyEnforcement = $this->createPolicyEnforcementPoint();\n\n // send authorization request\n $authRequest = new Request([\n RequestProperties::REQUEST_OPERATION => Posts::OPERATION_INDEX,\n RequestProperties::REQUEST_RESOURCE_TYPE => Posts::RESOURCE_TYPE,\n ]);\n $this->assertTrue($policyEnforcement->authorize($authRequest));\n\n // what is important for us in this test is how many execution steps were made.\n // due to optimization we expect it to be very few.\n // how we control it? well, we just count number of log entries as it corresponds to number of steps.\n // it's not ideal but solves the problem.\n //\n // so what should you do if the next assert fails (due to changes in logging or logic)?\n // you have to check the log messages and make sure it was executed as switch:\n // 1) First step was checking Post rules and no rules for other resources were checked.\n // 2) Second step was checking `index` and no other Post rules were checked.\n $loggedActions = explode(PHP_EOL, $this->getLogs());\n $this->assertCount(10, $loggedActions);\n }", "public function testCreateTaskVariable()\n {\n }", "public function testStorepostsCheckCustomerVotingAfterDBIsection() {\n $baseUrl = $this->getContainer()->getParameter('symfony_base_url');\n $acess_token = $this->getContainer()->getParameter('access_token');\n $serviceUrl = $baseUrl . 'api/storeposts?access_token='.$acess_token;\n $data = '{\"reqObj\":{\"store_id\":1495,\"post_title\":\"currently Not in used from frontend\",\"post_desc\":\"live news\",\"user_id\":1,\"post_id\":\"\",\"post_type\":1,\"youtube\":\"\",\"media_id\":[],\"link_type\":0,\"share_type\":\" txn \",\"device_request_type\":\"mobile\",\"customer_voting\":5}}';\n $data_array = json_decode($data);\n $data_array = $data_array->reqObj;\n $customer_voting = $data_array->customer_voting;\n $client = new CurlRequestService();\n $response = $client->send('POST', $serviceUrl, array(), $data)\n ->getResponse();\n $response = json_decode($response);\n $response_data = $response->data;\n $this->assertEquals($customer_voting, $response_data->customer_voting);\n }", "public function testGetChallengeActivityTemplates()\n {\n }", "public function testStatusOption()\n {\n $user = factory(User::class)->create();\n $lease = factory(Lease::class)->create();\n }", "public function testReviewActionWithProtectedChanges()\n {\n // create user with limited access\n $p4Foo = $this->connectWithAccess('foo', array('//depot/foo/...'));\n\n // create several changes\n $files = array('//depot/test1', '//depot/foo/bar', '//depot/test2');\n $changes = array();\n foreach ($files as $key => $path) {\n $file = new File;\n $file->setFilespec($path)->open()->setLocalContents('abc ' . $key);\n $change = new Change($this->p4);\n $change->setType('restricted')->addFile($file)->submit('change ' . $key);\n $changes[$key + 1] = $change->getId();\n }\n\n // prepare tests\n $tests = array(\n array(\n 'changes' => array($changes[1], $changes[2]),\n 'canFooAccess' => 1\n ),\n array(\n 'changes' => array($changes[1], $changes[2], $changes[3]),\n 'canFooAccess' => 0\n ),\n array(\n 'changes' => array($changes[1]),\n 'canFooAccess' => 0\n ),\n array(\n 'changes' => array(max($changes) + 1, max($changes) + 2),\n 'canFooAccess' => 1\n ),\n array(\n 'changes' => array($changes[1], $changes[3], max($changes) + 1),\n 'canFooAccess' => 1\n )\n );\n\n foreach ($tests as $test) {\n $review = new Review($this->p4);\n $review->setChanges($test['changes'])->save();\n\n // standard user should have access\n $this->resetApplication();\n $this->dispatch('/reviews/' . $review->getId());\n\n $result = $this->getResult();\n $this->assertRoute('review');\n $this->assertRouteMatch('reviews', 'reviews\\controller\\indexcontroller', 'review');\n $this->assertResponseStatusCode(200);\n\n // verify access for 'foo'\n $this->resetApplication();\n $this->getApplication()->getServiceManager()->setService('p4', $p4Foo);\n $this->dispatch('/reviews/' . $review->getId());\n\n $result = $this->getResult();\n $this->assertRoute('review');\n $this->assertRouteMatch('reviews', 'reviews\\controller\\indexcontroller', 'review');\n $this->assertResponseStatusCode($test['canFooAccess'] ? 200 : 403);\n }\n }", "public function testVote()\n {\n $vote = new Vote();\n $this\n ->voteDirector\n ->expects($this->any())\n ->method('findOneBy')\n ->will($this->returnValue(null));\n\n $this\n ->voteDirector\n ->expects($this->once())\n ->method('create')\n ->will($this->returnValue($vote));\n\n $this\n ->commentEventDispatcher\n ->expects($this->once())\n ->method('dispatchCommentOnVotedEvent')\n ->with(\n $this->equalTo($this->comment),\n $this->equalTo($vote),\n $this->equalTo(false)\n );\n\n $vote = $this\n ->voteManager\n ->vote(\n $this->comment,\n $this->authorToken,\n Vote::DOWN\n );\n\n $this->assertSame($this->authorToken, $vote->getAuthorToken());\n $this->assertSame($this->comment, $vote->getComment());\n $this->assertSame(Vote::DOWN, $vote->getType());\n }", "public function testItCanApproveAPagePendingCuration()\n {\n $this->logInAsUser(['curator' => 1]);\n\n $page = factory('App\\Models\\Page')->create();\n\n $this->get('/curation/new/approve/' . $page->id)->assertResponseStatus(302);\n\n $this->seeInDatabase('pages', [\n 'id' => $page->id,\n 'approved' => 1,\n ]);\n }", "public function testApproveValidIdGetForHrAndAdmin() {\n\t\t$this->setExpectedException('MethodNotAllowedException');\n\t\t$userRoles = [\n\t\t\tUSER_ROLE_USER | USER_ROLE_HUMAN_RESOURCES => 'hr',\n\t\t\tUSER_ROLE_USER | USER_ROLE_ADMIN => 'admin',\n\t\t];\n\t\t$opt = [\n\t\t\t'method' => 'GET',\n\t\t];\n\t\tforeach ($userRoles as $userRole => $userPrefix) {\n\t\t\t$userInfo = [\n\t\t\t\t'role' => $userRole,\n\t\t\t\t'prefix' => $userPrefix,\n\t\t\t];\n\t\t\t$this->applyUserInfo($userInfo);\n\t\t\t$this->generateMockedController();\n\t\t\t$url = [\n\t\t\t\t'controller' => 'deferred',\n\t\t\t\t'action' => 'approve',\n\t\t\t\t'4',\n\t\t\t];\n\t\t\tif (!empty($userPrefix)) {\n\t\t\t\t$url['prefix'] = $userPrefix;\n\t\t\t\t$url[$userPrefix] = true;\n\t\t\t}\n\t\t\t$this->testAction($url, $opt);\n\t\t}\n\t}", "public function testApproveDenyNotHrAndAdmin() {\n\t\t$this->setExpectedException('MissingActionException');\n\t\t$userRoles = [\n\t\t\tUSER_ROLE_USER => '',\n\t\t\tUSER_ROLE_USER | USER_ROLE_SECRETARY => 'secret',\n\t\t];\n\t\t$opt = [\n\t\t\t'method' => 'POST',\n\t\t];\n\t\tforeach ($userRoles as $userRole => $userPrefix) {\n\t\t\t$userInfo = [\n\t\t\t\t'role' => $userRole,\n\t\t\t\t'prefix' => $userPrefix,\n\t\t\t];\n\t\t\t$this->applyUserInfo($userInfo);\n\t\t\t$this->generateMockedController();\n\t\t\t$url = [\n\t\t\t\t'controller' => 'deferred',\n\t\t\t\t'action' => 'approve',\n\t\t\t\t'3',\n\t\t\t];\n\t\t\tif (!empty($userPrefix)) {\n\t\t\t\t$url['prefix'] = $userPrefix;\n\t\t\t\t$url[$userPrefix] = true;\n\t\t\t}\n\t\t\t$this->testAction($url, $opt);\n\t\t\t$this->checkIsNotAuthorized();\n\t\t\t$this->checkRedirect(true);\n\t\t}\n\t}", "public function testCreateChallengeActivityTemplate()\n {\n }", "function page_manager_poll_access_check($task, $subtask_id, $contexts) {\n return user_access('access content');\n}", "public function testWebinarPolls()\n {\n }", "public function testGetTask()\n {\n }", "public function testApproveSuccessForHr() {\n\t\t$userInfo = [\n\t\t\t'role' => USER_ROLE_USER | USER_ROLE_HUMAN_RESOURCES,\n\t\t\t'prefix' => 'hr'\n\t\t];\n\t\t$opt = [\n\t\t\t'method' => 'POST',\n\t\t];\n\t\t$this->applyUserInfo($userInfo);\n\t\t$this->generateMockedController();\n\t\t$url = '/hr/deferred/approve/3';\n\t\t$this->testAction($url, $opt);\n\t\t$this->checkFlashMessage(__('The deferred save has been %s.', __('approved')));\n\t\t$result = $this->Controller->Deferred->find('list', ['recursive' => -1]);\n\t\t$expected = [\n\t\t\t1 => '1',\n\t\t\t2 => '2',\n\t\t\t4 => '4',\n\t\t\t5 => '5',\n\t\t];\n\t\t$this->assertData($expected, $result);\n\t}", "public function testWebinarRegistrantQuestionUpdate()\n {\n }", "public function testExample()\n {\n $user = User::find(1);\n\n // Let's login as user 1, admin.\n $response = $this->actingAs($user)\n ->withSession(['foo' => 'bar'])\n ->get('/posts/create')\n ->assertStatus(200)\n ->assertViewHas('user');\n }", "public function testWebinarRegistrantsQuestionsGet()\n {\n }", "public function testWorkflowsGet()\n {\n }", "public function testCreateChallengeActivity()\n {\n }", "public function testGetChallengeActivity()\n {\n }", "public function isAssigned($resource);", "public function testAuthorizedTransaction()\n {\n $precondition = Factory::instance('AuthorizedTransaction');\n\n $testdata = $precondition->getData();\n\n $this->assertTrue($testdata['amount'] == 100);\n }", "public function testSameTimeDifferentResources()\n {\n $booking = factory(Booking::class)->create();\n $availableRule = new Available($booking->start_time, $booking->end_time);\n\n $this->assertTrue($availableRule->passes('resource_id', factory(Resource::class)->create()->id));\n }", "public function test_todo()\n {\n $login=User::factory()->create();\n $this->actingAs($login);\n $task=Task::factory()->create();\n $this->assertDatabaseHas('Tasks',['description'=>$task->description,'user_id'=>$task->user_id]);\n \n }", "public function testPending()\n {\n $this->assertTrue($this->kittyUser->isPending());\n $returnedKittyUser = $this->kittyUser->setPending(false);\n $this->assertSame($this->kittyUser, $returnedKittyUser);\n $this->assertFalse($this->kittyUser->isPending());\n }", "public function testResourcesApp()\n {\n $client = static::createClient();\n $client->request('GET', '/candidate/resources');\n $this->assertEquals(301, $client->getResponse()->getStatusCode());\n\n //authenticated users are allowed\n $client = $this->createAuthClient('[email protected]', 'user');\n $crawler = $client->request('GET', '/candidate/resources');\n $response = $client->getResponse();\n $this->assertEquals(301, $response->getStatusCode());\n $this->assertTrue(0 === strpos($response->getTargetUrl(), 'https'));\n\n //https and authentication loads page\n $client = $this->createAuthClient('[email protected]', 'user');\n $crawler = $client->request('GET', '/candidate/resources', [], [], ['HTTPS' => true]);\n $this->assertTrue($crawler->filter('html:contains(\"Loading ...\")')->count() > 0);\n }", "public function testUserRoleCantCreateTask()\n {\n $user = User::factory()->create(['role' => 'user']);\n $response = $this->actingAs($user)\n ->get(route('tasks.create'));\n $response->assertForbidden();\n }", "public function testApproveAssignmentAsUserWhoClaimedThrowsException()\n {\n $request = new \\Request([], ['REQUEST_URI' => \"http://api.dev.joind.in/v2.1/talks/9999/speakers\", 'REQUEST_METHOD' => 'POST']);\n $request->user_id = 2;\n $request->parameters = [\n 'username' => 'janebloggs',\n 'display_name' => 'Jane Bloggs'\n ];\n\n $talks_controller = new \\TalksController();\n $db = $this->getMockBuilder('\\JoindinTest\\Inc\\mockPDO')->getMock();\n\n $talk_mapper = $this->createTalkMapper($db, $request);\n $talk_mapper\n ->expects($this->once())\n ->method('getSpeakerFromTalk')\n ->will(\n $this->returnValue(\n [\n 'speaker_id' => null,\n 'ID' => 1\n ]\n )\n );\n $talks_controller->setTalkMapper($talk_mapper);\n\n $user_mapper = $this->createUserMapper($db, $request);\n $user_mapper\n ->expects($this->once())\n ->method('getUserIdFromUsername')\n ->will($this->returnValue(2));\n $talk_mapper\n ->expects($this->once())\n ->method('thisUserHasAdminOn')\n ->will($this->returnValue(false));\n $talks_controller->setUserMapper($user_mapper);\n\n $pending_talk_claim_mapper = $this->getMockBuilder('\\PendingTalkClaimMapper')\n ->setConstructorArgs(array($db,$request))\n ->getMock();\n $pending_talk_claim_mapper\n ->expects($this->once())\n ->method('claimExists')\n ->will($this->returnValue(\\PendingTalkClaimMapper::SPEAKER_CLAIM));\n\n $talks_controller->setPendingTalkClaimMapper($pending_talk_claim_mapper);\n\n $event_mapper = $this->createEventMapper($db, $request);\n $talks_controller->setEventMapper($event_mapper);\n\n $talks_controller->setSpeakerForTalk($request, $db);\n }", "public function teamAuthority(EntityInterface $resource, $action, Event $event){\n $user = $this->getUser();\n\n /*\n * first go through a couple of common cases where we don't need to judge permissions and don't bother checking\n * any other condition\n */\n\n //if the user isn't logged in (e.g., the public), use the default settings\n if (!$user){\n return true;\n }\n\n /*\n * This may make the previous rule redundant, but keeping both for now\n * No matter who is looking at the front-end, don't consider team authority\n * based on the user\n */\n\n //if it isn't on the backend, let the public vs private rules take over\n if ($this->getServiceLocator()->get('Omeka\\Status')->isSiteRequest()) {\n return true;\n }\n\n $is_glob_admin = ($user->getRole() === 'global_admin');\n\n\n //if it is the global admin, bypass any team controls (but will still apply filters)\n if ($is_glob_admin){\n return true;\n }\n $messenger = new Messenger();\n\n $authorized = false;\n\n $res_class = $this->getResourceClass($resource);\n\n //case that I don't fully understand. When selecting resource template on new item form\n //the Omeka\\AuthenticationService->getIdentity() returns null\n\n\n $em = $this->getServiceLocator()->get('Omeka\\EntityManager');\n\n $user_id = $user->getId();\n $team_user = $em->getRepository('Teams\\Entity\\TeamUser')\n ->findOneBy(['is_current'=>true, 'user'=>$user_id]);\n $team = $team_user->getTeam();\n $team_user_role = $team_user->getRole() ;\n\n //don't check if in same team if a create action, because items only assigned teams after creation\n if ($action != 'create'){\n //if resource not part of user's current team, no action at all\n if (! $this->inTeam($resource, $team_user)){\n $authorized = false;\n $err = sprintf(\n// $this->getTranslator()->translate(\n 'Permission denied. Resource \"%1$s: %2$s\" is not part of your current team, %3$s.\n If you feel this is an error, try changing teams or talk to the administrator.\n Action: %4$s\n '\n// )\n ,\n get_class($resource), $resource->getId(), $team->getName(), $action\n );\n $messenger->addError($err);\n throw new Exception\\PermissionDeniedException($err\n\n );\n }\n }\n\n $resource_domains = [\n 'Omeka\\Entity\\Item',\n 'Omeka\\Entity\\ItemSet',\n 'Omeka\\Entity\\Media',\n 'Omeka\\Entity\\ResourceTemplate',\n 'Teams\\Entity\\TeamResource'\n ];\n\n if (in_array($res_class, $resource_domains )){\n if ($action == 'create'){\n $authorized = $team_user_role->getCanAddItems();\n }\n elseif ($action == 'delete' || $action == 'batch_delete'){\n $authorized = $team_user_role->getCanDeleteResources();\n }\n elseif ($action == 'update'){\n $authorized = $team_user_role->getCanModifyResources();\n\n }\n elseif ($action == 'read'){\n $authorized = true;\n\n }\n\n }\n elseif ($res_class == 'Omeka\\Entity\\Site'){\n if ($action == 'create'){\n $globalSettings = $this->getServiceLocator()->get('Omeka\\Settings');\n if ($globalSettings->get('teams_site_admin_make_site') && $user->getRole() == 'site_admin'){\n $authorized = true;\n } elseif ($globalSettings->get('teams_editor_make_site') && $user->getRole() == 'editor'){\n\t\t $authorized = true;\n\t\t} else {\n $authorized = $is_glob_admin;\n }\n }\n elseif ($action == 'delete' || $action == 'batch_delete'){\n $authorized = $is_glob_admin;\n\n }\n elseif ($action == 'update'){\n $authorized = $team_user_role->getCanAddSitePages();\n\n }\n elseif ($action == 'read'){\n $authorized = true;\n\n }\n\n }\n elseif ($res_class == 'Omeka\\Entity\\SitePage'){\n if ($action == 'create'){\n $authorized = $team_user_role->getCanAddSitePages();\n\n }\n elseif ($action == 'delete' || $action == 'batch_delete'){\n $authorized = $team_user_role->getCanAddSitePages();\n\n }\n elseif ($action == 'update'){\n $authorized = $team_user_role->getCanAddSitePages();\n\n }\n elseif ($action == 'read'){\n $authorized = true;\n\n }\n\n\n }\n elseif ($res_class == 'Teams\\Entity\\Team' ){\n if ($action == 'create'){\n $authorized = $is_glob_admin;\n\n }\n elseif ($action == 'delete' || $action == 'batch_delete'){\n $authorized = $is_glob_admin;\n\n }\n elseif ($action == 'update'){\n $authorized = $team_user_role->getCanAddUsers();\n\n }\n elseif ($action == 'read'){\n $authorized = true;\n\n }\n }\n\n //a list of classes where we don't need to check teams\n //TODO: this should be refactored and go with the checks in the beginning\n elseif ($res_class == 'Omeka\\Entity\\User'){\n return true;\n }\n elseif ($res_class == 'Omeka\\Entity\\Job'){\n return true;\n }\n elseif ($res_class == 'Omeka\\Entity\\Property'){\n return true;\n }\n\n elseif ($res_class == 'Teams\\Entity\\TeamRole'){\n $authorized = $is_glob_admin;\n }\n\n elseif ($res_class == \"CustomVocab\\Entity\\CustomVocab\"){\n return true;\n }\n\n elseif (strpos($res_class, 'Mapping\\Entity') === 0){\n return true;\n }\n\n elseif ($res_class == \"Omeka\\Entity\\Asset\"){\n return true;\n }\n\n if (!$authorized){\n\n $authorized = false;\n $msg = sprintf(\n// $this->getTranslator()->translate(\n 'Permission denied. Your role in %5$s, %4$s, does not permit you to %3$s this resource.'\n\n// )\n ,\n get_class($resource), $resource->getId(), $action, $team_user_role->getName(), $team->getName()\n );\n $diagnostic = sprintf(\n// $this->getTranslator()->translate(\n 'Diagnostic: -- Resource type: %1$s. Resource id: %2$s. Action: %3$s. Your role: %4$s'\n\n// )\n ,\n get_class($resource), $resource->getId(), $action, $team_user_role->getName(), $team->getName()\n );\n\n $messenger->addError($msg);\n $messenger->addError($diagnostic);\n// $str = <<<EOD\n// <script>\n// window.addEventListener(\"load\", function() {\n// let msg = \"$msg\";\n// let content = document.getElementById(\"content\");\n// let ul = document.createElement(\"ul\")\n// ul.className = \"messages\";\n// let li = document.createElement(\"li\");\n// li.className = \"error\";\n// li.innerText = msg;\n// ul.appendChild(li);\n// content.prepend(ul);\n// })\n// </script>\n//EOD;\n// echo $str;\n\n\n\n throw new Exception\\PermissionDeniedException($msg);\n\n }\n return $authorized;\n\n }", "public function testGetTasksById()\n {\n\n }", "public function testGetParliamentaryCandidateWithVoteCast()\n {\n $pollingStation = $this->em->getRepository('VtallyBundle:PollingStation')->find(1);\n $candidates = $pollingStation->getParliamentaryCandidateWithVoteCast();\n $this->assertEquals($candidates[0]->getFirstName(), 'Jhon');\n $this->assertEquals($candidates[0]->getVoteCast(), 100);\n $this->assertEquals($candidates[1]->getFirstName(), 'Jannette');\n $this->assertEquals($candidates[1]->getVoteCast(), 280);\n $this->assertEquals($candidates[2]->getFirstName(), 'Sondra');\n $this->assertEquals($candidates[2]->getVoteCast(), 98);\n $this->assertEquals($candidates[3]->getFirstName(), 'Fadde');\n $this->assertEquals($candidates[3]->getVoteCast(), 0);\n $this->assertEquals($candidates[4]->getFirstName(), 'Vivien');\n $this->assertEquals($candidates[4]->getVoteCast(), 100);\n $this->assertEquals($candidates[5]->getFirstName(), 'Joella');\n $this->assertEquals($candidates[5]->getVoteCast(), 7);\n $this->assertEquals($candidates[6]->getFirstName(), 'Adde');\n $this->assertEquals($candidates[6]->getVoteCast(), 2);\n }", "public function testWorkflowsPost()\n {\n }", "public function testReadTask()\n {\n $userId = User::first()->value('id');\n $taskId = Task::orderBy('id', 'desc')->first()->id;\n\n $response = $this->json('GET', '/api/v1.0.0/users/'.$userId.'/tasks/'.$taskId);\n\n $response\n ->assertStatus(200)\n ->assertJson([\n 'description' => 'A new task from PHPUnit',\n ]);\n }", "public function testGetTasks()\n {\n }", "public function testWebinarPollCreate()\n {\n }", "public function testExecuteTaskAction()\n {\n }", "public function testGetChallengeActivities()\n {\n }", "public function testPointEditRouteAuth()\n {\n $point = Point::create([\n 'desc' => 'foo',\n 'lat' => '68.124',\n 'lon' => '24.176',\n 'city_id' => $this->city->id\n ]);\n\n $response = $this\n ->actingAs($this->user)\n ->get('/point/edit/' . $point->id);\n\n $response\n ->assertStatus(200)\n ->assertViewHas('point');\n\n $current = $response->original->getData()['point'];\n $this->assertInstanceOf('App\\Point', $current);\n }", "public function testGetSubTasks()\n {\n }", "public function test_logged_in_user_show_info()\n {\n $user=User::factory()->create();\n //behavior as this created user\n $response=$this->actingAs($user)->get(route('auth.user'));\n\n $response->assertStatus(Response::HTTP_OK);\n }", "public function testDeleteTaskInstanceIdentityLinks()\n {\n }", "public function testItCanApproveASuggestedEditPendingCuration()\n {\n $this->logInAsUser(['curator' => 1]);\n\n $edit = factory('App\\Models\\SuggestedEdit')->create();\n\n $this->get('/curation/edits/approve/' . $edit->id)->assertResponseStatus(302);\n\n $this->seeInDatabase('suggested_edits', [\n 'id' => $edit->id,\n 'approved' => 1,\n ]);\n }", "public function testWebinarPollGet()\n {\n }", "public function test_changing_question_from_other_user() {\n global $DB;\n\n // create a user\n $user = $this->getDataGenerator()->create_user();\n\n // create a course\n $course = $this->getDataGenerator()->create_course();\n\n // create a course module\n $videoquanda = $this->getDataGenerator()->create_module('videoquanda', array(\n 'course' => $course->id\n ));\n\n $time = mktime(9, 0, 0, 11, 7, 2013);\n\n $this->loadDataSet($this->createArrayDataSet(array(\n 'videoquanda_questions' => array(\n array('id', 'instanceid', 'userid', 'timecreated', 'timemodified' ,'seconds', 'text'),\n array(1, $videoquanda->id, 99, $time, $time, 2, 'dummy text')\n )\n )));\n\n $question = array(\n 'text' => 'I have updated my question.',\n 'timemodified' => time()\n );\n\n // enrol the user on the course\n $this->getDataGenerator()->enrol_user($user->id, $course->id, $DB->get_field('role', 'id', array(\n 'shortname' => 'student',\n )));\n\n // login the user\n $this->setUser($user);\n\n $client = new Client($this->_app);\n $client->request('PUT', '/api/v1/' . $videoquanda->id . '/questions/1', array(), array(), array(), json_encode($question));\n\n $this->assertEquals(405, $client->getResponse()->getStatusCode());\n $this->assertEquals($time, $DB->get_field('videoquanda_questions', 'timemodified', array('id' => 1)));\n }", "public function testRole()\n {\n }", "function test_DifferentIdempotencyKey_ActIndependentlyAndRetreivable() {\n\t\t$idempotencyKey1 = md5(uniqid());\n\t\t$idempotencyKey2 = md5(uniqid());\n\t\t$user = $this->buildJohn();\n\t\t$user1 = $this->_api->Users->Create($user, $idempotencyKey1);\n\t\t$user2 = $this->_api->Users->Create($user, $idempotencyKey2);\n $this->assertTrue($user2->Id > $user1->Id);\n\n\t\t// responses may be retreived later\n\t\t$resp1 = $this->_api->Responses->Get($idempotencyKey1);\n\t\t$resp2 = $this->_api->Responses->Get($idempotencyKey2);\n $this->assertTrue($resp1->Resource->Id == $user1->Id);\n $this->assertTrue($resp2->Resource->Id == $user2->Id);\n }", "public function attemptedLoginProvider() {\n\t\t$dataSet = array();\n\t\t\n\t\t$successExpected = new \\Main\\To\\UserData(new \\MongoId(\"000000000000000000000001\"), \"69 East\", \"69 Eastbound Down Road Atlanta, GA 22222\", \"PQW2d\", \"[email protected]\");\n\t\t$successVotingTopicExpected = new \\Main\\To\\VotingTopicData(new \\MongoId(\"000000000000000000000001\"), \"\", \"\", array(), array(),array());\n\t\t\n\t\t//Fully successful\n\t\t$successUserMock = $this->getMock('Main\\Database\\UserDao', array('searchUserByUrlExtension', 'loadUsers'));\n\t\t$successUserMock->expects($this->once())\n\t\t\t->method('searchUserByUrlExtension')\n\t\t\t->with($successExpected->getUniqueUrlExtension())\n\t\t\t->will($this->returnValue($successExpected));\n\t\t$successUserMock->expects($this->once())\n\t\t\t->method('loadUsers')\n\t\t\t->with($successVotingTopicExpected->getUsers())\n\t\t\t->will($this->returnValue(array()));\n\n\t\t$successVoteMock = $this->getMock('Main\\Database\\VotingTopicDao', array('lookupTopicViaUserId'));\n\t\t$successVoteMock->expects($this->once())\n\t\t\t->method('lookupTopicViaUserId')\n\t\t\t->with($successExpected->getId())\n\t\t\t->will($this->returnValue($successVotingTopicExpected));\n\t\t\t\n\t\t$successController = new \\Main\\Controller\\LoginController($successExpected->getUniqueUrlExtension());\n\t\t$successController->setUserDao($successUserMock);\n\t\t$successController->setVotingTopicDao($successVoteMock);\n\t\t$successSet = array(json_encode(\n\t\t\t\t\t\tarray('status' => 'ok', \n\t\t\t\t\t\t\t'userData' => $successExpected,\n\t\t\t\t\t\t\t'votingTopic' => $successVotingTopicExpected)),\n\t\t\t\t\t\t\t$successController);\n\t\t\n\t\t//Fails because of url\n\t\t$fakeurl = \"fakeurl\";\n\t\t$userFailUserMock = $this->getMock('Main\\Database\\UserDao', array('searchUserByUrlExtension', 'loadUsers'));\n\t\t$userFailUserMock->expects($this->once())\n\t\t\t->method('searchUserByUrlExtension')\n\t\t\t->with($fakeurl)\n\t\t\t->will($this->returnValue(null));\n\t\t$userFailController = new \\Main\\Controller\\LoginController($fakeurl);\n\t\t$userFailController->setUserDao($userFailUserMock);\n\t\t$userFailSet = array(json_encode(array('status' => '404', 'message' => \"User was not found. Do you have the wrong url?\")), $userFailController);\n\t\t\n\t\t//Fails because of voting topic\n\t\t$voteFailUserMock = $this->getMock('Main\\Database\\UserDao', array('searchUserByUrlExtension'));\n\t\t$voteFailUserMock->expects($this->once())\n\t\t\t->method('searchUserByUrlExtension')\n\t\t\t->with($successExpected->getUniqueUrlExtension())\n\t\t\t->will($this->returnValue($successExpected));\n\t\t\n\t\t$voteFailUserMock->expects($this->once())\n\t\t\t->method('loadUsers')\n\t\t\t->with(array())\n\t\t\t->will($this->returnValue(array()));\n\t\t\n\t\t$voteTopicFailMock = $this->getMock('Main\\Database\\VotingTopicDao', array('lookupTopicViaUserId'));\n\t\t$voteTopicFailMock->expects($this->once())\n\t\t\t->method('lookupTopicViaUserId')\n\t\t\t->with($successExpected->getId())\n\t\t\t->will($this->returnValue(null));\n\t\t\n\t\t$voteTopicFailController = new \\Main\\Controller\\LoginController($successExpected->getUniqueUrlExtension());\n\t\t$voteTopicFailController->setUserDao($voteFailUserMock);\n\t\t$voteTopicFailController->setVotingTopicDao($voteTopicFailMock);\n\t\t$votingTopicFailSet = array(json_encode(array('status' => '404', 'message' => \"Voting topic was not found, it may be deactivated?\")), $voteTopicFailController);\n\t\t\n\t\tarray_push($dataSet, $successSet, $userFailSet, $votingTopicFailSet);\n\t\treturn $dataSet;\n\t}", "protected function actingAsUser(): TestCase\n {\n return $this->actingAs($this->user);\n }", "public function reviewTask ($task) {\n\n\t}", "public function compareTask()\n\t{\n\t\t$lft = Request::getInt('left', 0);\n\t\t$rgt = Request::getInt('right', 0);\n\n\t\t// Make sure we have values for both sides\n\t\tif (!$lft || !$rgt)\n\t\t{\n\t\t\tNotify::error(Lang::txt('COM_PUBLICATIONS_ERROR_MISSING_VERSION'));\n\n\t\t\tApp::redirect(\n\t\t\t\tRoute::url('index.php?option=' . $this->_option)\n\t\t\t);\n\t\t}\n\n\t\t// Can't compare against itself\n\t\tif ($lft == $rgt)\n\t\t{\n\t\t\tNotify::error(Lang::txt('COM_PUBLICATIONS_ERROR_SAME_VERSIONS'));\n\n\t\t\tApp::redirect(\n\t\t\t\tRoute::url('index.php?option=' . $this->_option)\n\t\t\t);\n\t\t}\n\n\t\t// Get our model and load publication data\n\t\tinclude_once dirname(dirname(__DIR__)) . '/models/orm/publication.php';\n\n\t\t// Load the lft version and make sure the user has access\n\t\t$lversion = Models\\Orm\\Version::oneOrFail($lft);\n\t\t$lpublica = $lversion->publication;\n\n\t\tif (!$lversion->get('id') || $lversion->isDeleted()\n\t\t || !$lpublica->get('id'))\n\t\t{\n\t\t\tNotify::error(Lang::txt('COM_PUBLICATIONS_RESOURCE_NOT_FOUND'));\n\n\t\t\tApp::redirect(\n\t\t\t\tRoute::url('index.php?option=' . $this->_option)\n\t\t\t);\n\t\t}\n\n\t\t// Load the rgt version and make sure the user has access\n\t\t$rversion = Models\\Orm\\Version::oneOrFail($rgt);\n\n\t\tif (!$rversion->get('id') || $rversion->isDeleted())\n\t\t{\n\t\t\tNotify::error(Lang::txt('COM_PUBLICATIONS_RESOURCE_NOT_FOUND'));\n\n\t\t\tApp::redirect(\n\t\t\t\tRoute::url('index.php?option=' . $this->_option)\n\t\t\t);\n\t\t}\n\n\t\t$rpublica = new Models\\Publication(null, 'default', $rversion->get('id'));\n\n\t\tif (!$rpublica->access('view'))\n\t\t{\n\t\t\treturn $this->_blockAccess();\n\t\t}\n\n\t\t$rpublica->setCuration();\n\t\t$customFields = json_decode($rpublica->_curationModel->getMetaSchema(), true);\n\n\t\t// Diff the two versions\n\t\trequire_once dirname(dirname(__DIR__)) . '/helpers/Diff.php';\n\t\trequire_once dirname(dirname(__DIR__)) . '/helpers/Diff/Renderer/Html/SideBySide.php';\n\n\t\t$diffs = array();\n\n\t\t$l = explode(\"\\n\", $lversion->get('title'));\n\t\t$r = explode(\"\\n\", $rversion->get('title'));\n\n\t\t$diff = new \\Diff($l, $r);\n\t\t$diffs['title'] = $diff->render(new \\Diff_Renderer_Html_SideBySide);\n\n\t\t$l = array();\n\t\tforeach ($lversion->authors as $author)\n\t\t{\n\t\t\t$l[] = $author->get('name') . ' (' . $author->get('organization') . ')';\n\t\t}\n\t\t$r = array();\n\t\tforeach ($rversion->authors as $author)\n\t\t{\n\t\t\t$r[] = $author->get('name') . ' (' . $author->get('organization') . ')';\n\t\t}\n\n\t\t$diff = new \\Diff($l, $r);\n\t\t$diffs['authors'] = $diff->render(new \\Diff_Renderer_Html_SideBySide);\n\n\t\t$l = explode(\"\\n\", $lversion->get('description'));\n\t\t$r = explode(\"\\n\", $rversion->get('description'));\n\n\t\t$diff = new \\Diff($l, $r);\n\t\t$diffs['description'] = $diff->render(new \\Diff_Renderer_Html_SideBySide);\n\n\t\t$diffs['metadata'] = array();\n\n\t\t$lmetadata = $lversion->metadata;\n\t\t$rmetadata = $rversion->metadata;\n\t\tforeach ($lmetadata as $key => $l)\n\t\t{\n\t\t\t$r = (isset($rmetadata[$key]) ? $rmetadata[$key] : '');\n\t\t\t$l = explode(\"\\n\", $l);\n\t\t\t$r = explode(\"\\n\", $r);\n\n\t\t\t$diff = new \\Diff($l, $r);\n\t\t\t$diffs['metadata'][$key] = $diff->render(new \\Diff_Renderer_Html_SideBySide);\n\t\t}\n\n\t\tforeach ($rmetadata as $key => $r)\n\t\t{\n\t\t\tif (isset($diffs['metadata'][$key]))\n\t\t\t{\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t$l = (isset($lmetadata[$key]) ? $lmetadata[$key] : '');\n\t\t\t$l = explode(\"\\n\", $l);\n\t\t\t$r = explode(\"\\n\", $r);\n\n\t\t\t$diff = new \\Diff($l, $r);\n\t\t\t$diffs['metadata'][$key] = $diff->render(new \\Diff_Renderer_Html_SideBySide);\n\t\t}\n\n\t\t// Set the pathway\n\t\tif (Pathway::count() <= 0)\n\t\t{\n\t\t\tPathway::append(\n\t\t\t\tLang::txt(strtoupper($this->_option)),\n\t\t\t\t'index.php?option=' . $this->_option\n\t\t\t);\n\t\t}\n\t\tPathway::append(\n\t\t\tLang::txt(strtoupper($this->_option . '_' . $this->_task)),\n\t\t\t'index.php?option=' . $this->_option . '&task=' . $this->_task . '&lft=' . $lft . '&rgt=' . $rgt\n\t\t);\n\n\t\t// Display the view\n\t\t$this->view\n\t\t\t->set('lft', $lversion)\n\t\t\t->set('rgt', $rversion)\n\t\t\t->set('diffs', $diffs)\n\t\t\t->set('customFields', $customFields)\n\t\t\t->display();\n\t}", "public function testHaveNoProVoter()\n {\n $strategy = new Affirmative([\n $this->createVoter([\n 'edit' => [\n 'supports' => true,\n 'granted' => false\n ],\n 'remove' => [\n 'supports' => true,\n 'granted' => false\n ]\n ]),\n $this->createVoter([\n 'edit' => [\n 'supports' => true,\n 'granted' => false\n ],\n 'remove' => [\n 'supports' => true,\n 'granted' => false\n ]\n ]),\n ]);\n\n self::assertFalse($strategy->isGranted(['edit', 'remove'], null, null));\n }", "abstract protected function setUpRoutableContextModel();", "public function testManagerRoleCanCreateTask()\n {\n $user = User::factory()->create(['role' => 'manager']);\n $response = $this->actingAs($user)\n ->get(route('tasks.create'));\n $response->assertStatus(200);\n }", "public function test_is_valid_resource() {\n\n\t\t$webhook = LLMS_REST_API()->webhooks()->create( array(\n\t\t\t'delivery_url' => 'https://fake.tld',\n\t\t\t'topic' => 'course.created',\n\t\t) );\n\n\t\t$course = $this->factory->post->create_and_get( array( 'post_type' => 'course' ) );\n\n\t\tglobal $wp_current_filter;\n\t\t$wp_current_filter = array( 'save_post_course' );\n\t\t$this->assertTrue( LLMS_Unit_Test_Util::call_method( $webhook, 'is_valid_resource', array( array( $course->ID, $course ) ) ) );\n\n\t\t// Alter the post creation date so to simulate an update: A resource is considered created when the hook is executed within 10 seconds of the post creation date.\n\t\t$course->post_date = date( 'Y-m-d H:i:s', strtotime('-11 seconds') );\n\t\twp_update_post( $course );\n\t\t$this->assertFalse( LLMS_Unit_Test_Util::call_method( $webhook, 'is_valid_resource', array( array( $course->ID, $course ) ) ) );\n\t\t$wp_current_filter = array();\n\n\t\t// it's a draft.\n\t\t$course->post_status = 'auto-draft';\n\t\twp_update_post( $course );\n\t\t$this->assertFalse( LLMS_Unit_Test_Util::call_method( $webhook, 'is_valid_resource', array( array( $course->ID, $course ) ) ) );\n\n\t}", "public function testGetTasks()\n {\n\n }", "public function testDataSubmit()\n {\n $faker = Faker::create();\n $story = Story::has('slides')->inRandomOrder()->first();\n $slides = $story->slides;\n $visitor_uuid = $faker->uuid;\n $this->json('POST', 'api/performance-data',\n [\n 'uuid' => $visitor_uuid,\n 'slide_id' => $slides[0]->id,\n 'duration' => random_int(1, 10),\n 'success' => 0\n ])->assertStatus(201);\n\n\n // verify job is created\n $this->expectsJobs(CalculateSlideScore::class);\n\n // verify visit uuid is saved\n $this->assertDatabaseHas('visits', [\n 'uuid' => $visitor_uuid\n ]);\n\n //verify no error when the same uuid is submitted\n $this->json('POST', 'api/performance-data',\n [\n 'uuid' => $visitor_uuid,\n 'slide_id' => $slides[1]->id,\n 'duration' => random_int(1, 10),\n 'success' => 1\n ])->assertStatus(201);\n\n\n }", "public function testTaskAvailableInDatabase(): void\n {\n $task = $this->entityManager\n ->getRepository(Task::class)\n ->findOneBy(['title' => 'Test Task'])\n ;\n self::assertSame('Test Task', $task->getTitle());\n }", "public function actionSetup()\n\t{\n\t\t$auth = Yii::app()->authManager;\n\t\t$auth->createOperation('viewUser');\n\t\t$auth->createOperation('updateUser');\n\t\t$auth->createOperation('deleteUser');\n\t\t\n\t\t$auth->createOperation('createSource');\n\t\t$auth->createOperation('updateSource');\n\t\t$auth->createOperation('deleteSource');\n\t\t\n\t\t$auth->createOperation('updateArticle');\n\t\t$auth->createOperation('deleteArticle');\n\t\t\n\t\t$task = $auth->createTask('viewOwnUser',\n\t\t\t'Allows a user to view their profile',\n\t\t\t'return $params[\"id\"] == Yii::app()->user->id;');\n\t\t$task->addChild('viewUser');\n\t\t\n\t\t$task = $auth->createTask('updateOwnUser',\n\t\t\t'Allows a user to update their profile',\n\t\t\t'return $params[\"id\"] == Yii::app()->user->id;');\n\t\t$task->addChild('updateUser');\n\t\t\n\t\t$task = $auth->createTask('updateOwnSource',\n\t\t\t'Allows an editor to update their source',\n\t\t\t'return $params[\"ownerId\"] == $params[\"userId\"]');\n\t\t$task->addChild('updateSource');\n\t\t\n\t\t$role = $auth->createRole('public');\n\t\t$role->addChild('viewOwnUser');\n\t\t$role->addChild('updateOwnUser');\n\t\t\n\t\t$role = $auth->createRole('editor');\n\t\t$role->addChild('public');\n\t\t$role->addChild('updateOwnSource');\n\t\t\n\t\t$role = $auth->createRole('admin');\n\t\t$role->addChild('editor');\n\t\t$role->addChild('createSource');\n\t\t$role->addChild('updateSource');\n\t\t$role->addChild('deleteSource');\n\t\t$role->addChild('viewUser');\n\t\t$role->addChild('updateUser');\n\t\t$role->addChild('deleteUser');\n\t\t$role->addChild('updateArticle');\n\t\t$role->addChild('deleteArticle');\n\t\t\n\t}", "public function testListPastWebinarQA()\n {\n }", "public function testGetUserTasks()\n {\n $userId = User::first()->value('id');\n $user = User::find($userId);\n $tasks = $user->tasks()->get()->toArray();\n\n $response = $this->json('GET', '/api/v1.0.0/users/'.$userId.'/tasks');\n\n $response\n ->assertStatus(200)\n ->assertExactJson($tasks);\n }", "public function isResource(IntegrationTester $I)\n {\n $I->assertTrue(gettype(Resources::isResource('Users')) == 'boolean');\n }", "public function testLoggedUserCanCreateThread()\n {\n $user = \\factory(User::class)->states('activated')->create();\n\n $this->actingAs($user, 'api')->postJson('api/threads', ['title' => 'Hello world!', 'body' => 'hello every one.', 'ticket' => 'mock-ticket'])\n ->assertStatus(201)\n ->assertJsonStructure(['title', 'user_id', 'content' => ['body']])\n ->assertJsonFragment(['title' => 'Hello world!', 'body' => 'hello every one.']);\n\n $this->actingAs($user, 'api')->patchJson('api/threads/1', [\n 'title' => 'The New Title',\n 'body' => 'updated content.',\n ])->assertJsonFragment([\n 'title' => 'The New Title',\n 'body' => 'updated content.',\n ]);\n }", "public function testApproveSuccessForAdmin() {\n\t\t$userInfo = [\n\t\t\t'role' => USER_ROLE_USER | USER_ROLE_ADMIN,\n\t\t\t'prefix' => 'admin'\n\t\t];\n\t\t$opt = [\n\t\t\t'method' => 'POST',\n\t\t];\n\t\t$this->applyUserInfo($userInfo);\n\t\t$this->generateMockedController();\n\t\t$url = '/admin/deferred/approve/2';\n\t\t$this->testAction($url, $opt);\n\t\t$this->checkFlashMessage(__('The deferred save has been %s.', __('approved')));\n\t\t$result = $this->Controller->Deferred->find('list', ['recursive' => -1]);\n\t\t$expected = [\n\t\t\t1 => '1',\n\t\t\t3 => '3',\n\t\t\t4 => '4',\n\t\t\t5 => '5',\n\t\t];\n\t\t$this->assertData($expected, $result);\n\t}", "public function testAclMiddleware():void\n {\n $generator = Factory::create();\n $em = $this->em();\n $conn = $em->getConnection();\n $conn->beginTransaction();\n try {\n /** Register user via the guest endpoint **/\n $response = $this->json(\n 'POST', '/contexts/guest/users',\n [\n \"params\" => [\n 'email' => $generator->safeEmail,\n 'firstName'=> $generator->firstName,\n 'middleInitial'=>'X',\n 'lastName'=> $generator->lastName,\n 'age' => $generator->randomNumber(2),\n 'gender' => 1,\n 'weight' => 210,\n 'height' => 180.34,\n 'phoneNumber' => \"+1 757-571-2711\",\n 'lifestyle' => 1,\n 'password' => $this->password,\n 'job' => $generator->jobTitle,\n 'address' => $generator->address,\n 'locale' => \"en\"\n ],\n \"options\" => [\n \"email\" => false,\n \"g-recaptcha-response-omit\" => env('GOOGLE_RECAPTCHA_SKIP_CODE') /** skipping recaptcha with a key **/\n ]\n ]\n );\n $userResult = $response->decodeResponseJson();\n $this->assertArrayHasKey('id', $userResult);\n\n /** Making sure user has email verification entry **/\n $emailVerificationRepository = new EmailVerificationRepository();\n $emailVerification = $emailVerificationRepository->findOneBy([\"user\" => $userResult[\"id\"]]);\n $this->assertEquals( $emailVerification->getUser()->getId(), $userResult['id']);\n $this->assertEquals( $emailVerification->getVerified(), false);\n\n /** Email verification endpoint **/\n $response = $this->json(\n 'PUT', \"/contexts/guest/email-verification/\" . $emailVerification->getId(),\n [\n \"params\" => [ \"verified\" => true ],\n \"options\" => [ \"simplifiedParams\" => true ]\n ]\n );\n $response->assertResponseStatus(200);\n\n /** Making sure user has user has role entry of 'user' **/\n $userRepository = new UserRepository();\n /** @var User $user */\n $user = $userRepository->find($userResult[\"id\"]);\n $this->assertEquals( $user->getId(), $userResult['id']);\n $this->assertEquals( $user->getRoles()[0]->getName(), 'user');\n\n /** Login with wrong password **/\n $response = $this->json('POST', '/auth/authenticate', ['email' => $user->getEmail(), 'password' => 'wrong_password']);\n $response->assertResponseStatus(401);\n\n /** Login with right password **/\n $response = $this->json('POST', '/auth/authenticate', ['email' => $user->getEmail(), 'password' => $this->password]);\n $tokenResult = $response->decodeResponseJson();\n $response->assertResponseStatus(200);\n\n /** Free port acl **/\n $response = $this->json('GET', '/auth/me', [], ['HTTP_AUTHORIZATION'=>'Bearer ' . $tokenResult['token']]);\n $result = $response->decodeResponseJson();\n $this->assertEquals($result['email'], $user->getEmail());\n\n $data = [\n \"params\" => [\n \"name\" => $generator->name\n ],\n \"options\" => [\n \"simplifiedParams\" => true\n ]\n ];\n\n /** Posting artist as a quest **/\n $response = $this->json('POST', '/contexts/guest/artists', $data, ['HTTP_AUTHORIZATION'=>'Bearer ' . $tokenResult['token']]);\n $response->assertResponseStatus(405);\n\n /** Posting artist as a user **/\n $response = $this->json('POST', '/contexts/user/artists', $data, ['HTTP_AUTHORIZATION'=>'Bearer ' . $tokenResult['token']]);\n $result = $response->decodeResponseJson();\n $response->assertResponseStatus(500);\n\n /** Posting artist as a admin **/\n $response = $this->json('POST', '/contexts/admin/artists', $data, ['HTTP_AUTHORIZATION'=>'Bearer ' . $tokenResult['token']]);\n $response->assertResponseStatus(403);\n\n /** Posting artist as a super-admin **/\n $response = $this->json('POST', '/contexts/super-admin/artists', $data, ['HTTP_AUTHORIZATION'=>'Bearer ' . $tokenResult['token']]);\n $response->assertResponseStatus(404);\n $conn->rollBack();\n } catch (Exception $e) {\n $conn->rollBack();\n throw $e;\n }\n }", "public function testWebinarPollUpdate()\n {\n }", "public function testQuestionCreateView() {\n $response = $this->get('course/' . $this->course->id . '/question/create');\n $this->assertEquals('200', $response->foundation->getStatusCode());\n $this->assertEquals('general.permission', $response->content->view);\n }" ]
[ "0.6149578", "0.5842785", "0.5541706", "0.54536754", "0.54156137", "0.53495896", "0.5334247", "0.53201246", "0.5237323", "0.52187735", "0.5212932", "0.5175018", "0.51644707", "0.5163589", "0.51301324", "0.5126221", "0.5121984", "0.50994885", "0.506552", "0.50142", "0.49861038", "0.49703407", "0.4969797", "0.49432567", "0.48808137", "0.48770347", "0.48677066", "0.48629582", "0.48436224", "0.48380268", "0.48351282", "0.4825346", "0.48141703", "0.47671854", "0.47644383", "0.47642052", "0.4749116", "0.47198954", "0.47177956", "0.47007024", "0.46985394", "0.4695747", "0.46942577", "0.4685053", "0.46742156", "0.46572685", "0.46518826", "0.4651781", "0.46483296", "0.46434808", "0.46380416", "0.46367797", "0.46305108", "0.4626315", "0.46163785", "0.46154606", "0.4607226", "0.46067068", "0.4599255", "0.45899677", "0.45877963", "0.4587061", "0.45825383", "0.45776665", "0.45755816", "0.45744067", "0.4568071", "0.4567615", "0.45670798", "0.45649546", "0.45586535", "0.4557706", "0.45569843", "0.45536265", "0.4552733", "0.45515823", "0.45457563", "0.45404303", "0.45354658", "0.45341158", "0.45169422", "0.45132512", "0.45067114", "0.4503196", "0.44964486", "0.4495613", "0.4493799", "0.44892514", "0.44886875", "0.44877982", "0.44860947", "0.44800606", "0.44792596", "0.44765192", "0.44632706", "0.44610167", "0.44555712", "0.44546688", "0.44539464", "0.44535723" ]
0.65813416
0
Tests the vote() method for the logged in user as the Task resource.
public function testVoteAsResource($currentStatus, $newStatus, $expectedAccessResult) { $token = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface'); $user = new User(); $token->expects($this->once()) ->method('getUser') ->willReturn($user); $roleHierarchy = $this->getMock('Symfony\Component\Security\Core\Role\RoleHierarchyInterface'); $voter = new StatusVoter($roleHierarchy); $task = new Task(); $task->setStatus($currentStatus); $task->setResource($user); $this->assertEquals($expectedAccessResult, $voter->vote($token, $task, array($newStatus))); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function testvote()\n {\n $this->vote_answer = Vote::vote($this->user->id, $this->answer->id, 1, 'answer_id');\n if (!$this->answer) return false;\n }", "public function test_a_user_can_vote_for_a_post()\n {\n $user = $this->defaultUser();\n\n $post = $this->createPost();\n\n $this->browse(function (Browser $browser) use($user,$post) {\n $browser->loginAs($user)\n ->visit($post->url)\n ->pressAndWaitFor('+1')\n ->assertSeeIn('current-vote',1);\n });\n }", "public function test_users_vote_can_be_retrieved() {\n\n $user = User::create('[email protected]', 'secret', 'Jane Doe');\n\n $this->assertNull($this->message->getVote($user));\n\n $this->message->upvote($user);\n $this->assertEquals('up', $this->message->getVote($user));\n\n $this->message->downvote($user);\n $this->assertEquals('down', $this->message->getVote($user));\n\n }", "public function testVote()\n {\n $vote = new Vote();\n $this\n ->voteDirector\n ->expects($this->any())\n ->method('findOneBy')\n ->will($this->returnValue(null));\n\n $this\n ->voteDirector\n ->expects($this->once())\n ->method('create')\n ->will($this->returnValue($vote));\n\n $this\n ->commentEventDispatcher\n ->expects($this->once())\n ->method('dispatchCommentOnVotedEvent')\n ->with(\n $this->equalTo($this->comment),\n $this->equalTo($vote),\n $this->equalTo(false)\n );\n\n $vote = $this\n ->voteManager\n ->vote(\n $this->comment,\n $this->authorToken,\n Vote::DOWN\n );\n\n $this->assertSame($this->authorToken, $vote->getAuthorToken());\n $this->assertSame($this->comment, $vote->getComment());\n $this->assertSame(Vote::DOWN, $vote->getType());\n }", "public function vote(Voting $voting, User $user, $answerId);", "public function vote()\n {\n if (!Auth::check()) {\n return redirect(route('login'));\n }\n\n #Let's Vote.\n\n if($this->hasVoted){\n #Yes, Remove Vote\n // dd('Voted');\n try {\n $this->idea->removeVote(Auth::user());\n } catch (VoteNotFoundException $ex) {\n // Do nothing.\n }\n\n $this->votesCount--;\n $this->hasVoted = false;\n\n }else{\n #No, Add Vote\n try {\n $this->idea->vote(Auth::user());\n } catch (DuplicateVoteException $ex) {\n // Do nothing.\n }\n\n $this->votesCount++;\n $this->hasVoted = true;\n }\n }", "function testMarkAsVoted() {\n\t\t/*\n\t\t$mobilePoll = $this->ObjFromFixture('Poll', 'mobile-poll');\n\t\t$mobilePoll->markAsVoted();\n\t\t$this->assertTrue($mobilePoll->hasVoted());\n\t\t*/\n\t}", "public function find_vote($event_id, $user_id);", "function DoVoting()\r\n\t\t\t{\r\n\t\t\t\tif (!$_SESSION[\"User\"])\r\n\t\t\t\t{\t// Display the login screen\r\n\t\t\t\t\tif (!VoterLogin())\r\n\t\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\t\t\t\t// Step 2: Sign-In (only needed when using Mixing - Servers) \r\n\t\t\t\t\r\n\t\t\t\t// Step 3: Voting (only needed when using Mixing - Servers)\r\n\t\t\t\tVoterVote();\r\n\t\t\t}", "public function isVotingAnswerableForUser(Voting $voting, User $user);", "public function vote($vote = 0, $user_id = 0, $ip = null)\n\t{\n\t\tif (!$this->get('id'))\n\t\t{\n\t\t\t$this->addError(Lang::txt('No record found'));\n\t\t\treturn false;\n\t\t}\n\n\t\tif (!$vote)\n\t\t{\n\t\t\t$this->addError(Lang::txt('No vote provided'));\n\t\t\treturn false;\n\t\t}\n\n\t\t$al = $this->ballot($user_id, $ip);\n\t\t$al->set('item_type', 'question');\n\t\t$al->set('item_id', $this->get('id'));\n\t\t$al->set('created_by', $user_id);\n\t\t$al->set('ip', $ip);\n\n\t\t$vote = $al->automaticVote(['vote' => $vote]);\n\n\t\tif ($this->get('created_by') == $user_id)\n\t\t{\n\t\t\t$this->addError(Lang::txt('Cannot vote for your own entry'));\n\t\t\treturn false;\n\t\t}\n\n\t\tif ($vote != $al->get('vote', 0))\n\t\t{\n\t\t\tif ($vote > 0)\n\t\t\t{\n\t\t\t\t$this->set('helpful', (int) $this->get('helpful') + 1);\n\t\t\t\tif ($al->get('id'))\n\t\t\t\t{\n\t\t\t\t\t$this->set('nothelpful', (int) $this->get('nothelpful') - 1);\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif ($al->get('id'))\n\t\t\t\t{\n\t\t\t\t\t$this->set('helpful', (int) $this->get('helpful') - 1);\n\t\t\t\t}\n\t\t\t\t$this->set('nothelpful', (int) $this->get('nothelpful') + 1);\n\t\t\t}\n\n\t\t\tif (!$this->save())\n\t\t\t{\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\t$al->set('vote', $vote);\n\n\t\t\tif (!$al->save())\n\t\t\t{\n\t\t\t\t$this->addError($al->getError());\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\treturn true;\n\t}", "public function voteAction()\n {\n $return = 0;\n\n /* Getting current user's data */\n $user = Auth::getUser();\n\n /* Checking if user is online and answer_id > 0 */\n if ($user && $_GET['id'] > 0) {\n \n /* Vote answer and return number of votes */\n $return = VotedAnswer::vote($user->id, $_GET['id']);\n }\n \n /* Return response */\n header('Content-Type: application/json');\n echo json_encode($return);\n }", "public function testVote($currentStatus, $newStatus, $expectedAccessResult)\n {\n $token = $this->getMock('Symfony\\Component\\Security\\Core\\Authentication\\Token\\TokenInterface');\n $voter = $this->createVoter();\n $task = new Task();\n $task->setStatus($currentStatus);\n $this->assertEquals($expectedAccessResult, $voter->vote($token, $task, array($newStatus)));\n }", "public function vote()\n {\n # Check if the user is logged in\n if( $this->session->userdata('id') )\n {\n # Define Vote class\n $vote = new User_Vote();\n $vote->where('user_id', $this->input->get('id') )\n ->where('user_voted_id', $this->session->userdata('id') )\n ->get();\n\n # Instanciate a new user\n $user = new User($this->input->get('id'));\n\n # Check if the disponibility has already been voted\n if( $vote->exists() )\n {\n # Delete the vote\n $vote->delete();\n\n # Send the response\n echo json_encode(array('result' => 'alert', 'text' => \"Você deixou de seguir \\\"{$user->name} {$user->surname}\\\".\"));\n\n }else{\n # Set variables\n $vote->user_id = $this->input->get('id');\n $vote->user_voted_id = $this->session->userdata('id');\n\n # Save into database\n $vote->save();\n\n echo json_encode(array('result' => 'success', 'text' => \"Agora você está seguindo \\\"{$user->name} {$user->surname}\\\".\"));\n }\n }else{\n echo json_encode(\n array('result' => 'error', 'text' => \"Você precisa fazer login na Galatea para seguir alguém.\")\n );\n }\n\n }", "public function testPostVoteOnQuestion(): void {\n $user = factory(User::class)->create();\n $q = factory(Question::class)->create();\n $url = \"/api/questions/$q->id\";\n //up and cancel\n $this->get(url(\"$url/votes\"))\n ->assertStatus(200)\n ->assertJsonFragment(['total' => 0]);\n $this->post(url(\"$url/upvote\"), ['api_token' => $user->api_token])\n ->assertStatus(200)\n ->assertJsonFragment(['total' => 1, 'up' => 1]);\n $this->post(url(\"$url/upvote\"), ['api_token' => $user->api_token])\n ->assertStatus(200)\n ->assertJsonFragment(['total' => 0, 'up' => 0]);\n //down and cancel\n $this->post(url(\"$url/downvote\"), ['api_token' => $user->api_token])\n ->assertStatus(200)\n ->assertJsonFragment(['total' => -1, 'down' => 1]);\n $this->post(url(\"$url/downvote\"), ['api_token' => $user->api_token])\n ->assertStatus(200)\n ->assertJsonFragment(['total' => 0, 'down' => 0]);\n // down up down\n $this->post(url(\"$url/downvote\"), ['api_token' => $user->api_token])\n ->assertStatus(200)\n ->assertJsonFragment(['total' => -1, 'down' => 1]);\n $this->post(url(\"$url/upvote\"), ['api_token' => $user->api_token])\n ->assertStatus(200)\n ->assertJsonFragment(['total' => 1, 'up' => 1]);\n $this->post(url(\"$url/downvote\"), ['api_token' => $user->api_token])\n ->assertStatus(200)\n ->assertJsonFragment(['total' => -1, 'down' => 1]);\n\n $this->get(url(\"$url/votes\"))\n ->assertStatus(200)\n ->assertJsonFragment(['total' => -1]);\n }", "public function vote($object, $action);", "public function voteAction()\n {\n\n }", "public function isVoted($id){\n $where = ['topic_id'=>$id,'user_id'=>Auth::user()->id];\n if(DB::table('topic_user')->where($where)->first())\n return true;\n return false;\n }", "public function vote()\n\t{\n\t\t// print \"Hello from JoomooratingController::vote() in file controller.php<br />\\n\";\n\n\t\t$link = JRequest::getVar( 'readmore_link', 'index.php' );\n\n\t\trequire_once $this->_parentModelPath;\n\t\trequire_once $this->_ratingModelPath;\n\t\t$this->_ratingModel = new JoomooRatingModelJoomooRating();\n\n\t\t$rating = JRequest::getVar( 'rating', null );\n\t\t$votedOk = $this->_ratingModel->vote( $rating );\n\t\t$message = '';\n\n\t\tif ( $votedOk )\n\t\t{\n\t\t\t$message .= 'Thanks for your vote (' . $rating . ')!';\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$errorMessage = $this->_ratingModel->getError();\n\t\t\tif ( 0 < strlen($errorMessage) )\n\t\t\t{\n\t\t\t\t$message .= \"Error saving vote: \" . $errorMessage . '<br />';\n\t\t\t\t$message .= 'Please try again.';\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$message .= 'Something went wrong and we are unable to save your vote at this time.<br />';\n\t\t\t\t$message .= 'Please try again later.';\n\t\t\t}\n\t\t}\n\n\t\t//\tprint \"post_comment not redirecting; link = \" . $link . \"; message = \" . $message . \"<br />\\n\";\n\t\t$this->setRedirect( $link, $message );\n\n\t\treturn $votedOk;\n\t}", "public function voteForResource(\\TYPO3\\Flow\\Security\\Context $securityContext, $resource)\n {\n }", "public function hasVoted($username, $userLog)\n {\n\t\t$user = new \\Foundation\\User();\n \n\t\treturn $user->hasBeenRated($username, $userLog);\n\t}", "public function checkVote($idea_id,$user_id)\r\n {\r\n $model = new Ynidea_Model_DbTable_Ideavotes;\r\n $select = $model -> select()->where('user_id = ?',$user_id)->where('idea_id=?',$idea_id); \r\n $row = $model->fetchRow($select); \r\n if($row)\r\n return true;\r\n else\r\n return false; \r\n }", "function checkvote($idvideo, $iduser){\n \t$realid = pg_escape_string($idvideo);\n \t$realusr = pg_escape_string($iduser);\n \t$query = \"SELECT idvotexuser, vote FROM votexuser where idvideo = \".$realid.\" and idusuario = \".$realusr.\";\";\n \t$link = createConection();\n \t$result = pg_exec($link, $query);\n \tcloseConection($link);\n \treturn $result;\n }", "function recordVote()\n{\n\n //add voter and vote to database\n\n //mark voter as voted\n\n}", "public function testPostVoteOnAnswer(): void {\n $user = factory(User::class)->create();\n $q = factory(Question::class)->create();\n $a = factory(Answer::class)->create(['question_id' => $q->id]);\n $url = \"/api/answers/$a->id\";\n //up and cancel\n $this->get(url(\"$url/votes\"))\n ->assertStatus(200)\n ->assertJsonFragment(['total' => 0]);\n $this->post(url(\"$url/upvote\"), ['api_token' => $user->api_token])\n ->assertStatus(200)\n ->assertJsonFragment(['total' => 1, 'up' => 1]);\n $this->post(url(\"$url/upvote\"), ['api_token' => $user->api_token])\n ->assertStatus(200)\n ->assertJsonFragment(['total' => 0, 'up' => 0]);\n // down and cancel\n $this->post(url(\"$url/downvote\"), ['api_token' => $user->api_token])\n ->assertStatus(200)\n ->assertJsonFragment(['total' => -1, 'down' => 1]);\n $this->post(url(\"$url/downvote\"), ['api_token' => $user->api_token])\n ->assertStatus(200)\n ->assertJsonFragment(['total' => 0, 'down' => 0]);\n //down up down\n $this->post(url(\"$url/downvote\"), ['api_token' => $user->api_token])\n ->assertStatus(200)\n ->assertJsonFragment(['total' => -1, 'down' => 1]);\n $this->post(url(\"$url/upvote\"), ['api_token' => $user->api_token])\n ->assertStatus(200)\n ->assertJsonFragment(['total' => 1, 'up' => 1]);\n $this->post(url(\"$url/downvote\"), ['api_token' => $user->api_token])\n ->assertStatus(200)\n ->assertJsonFragment(['total' => -1, 'down' => 1]);\n\n $this->get(url(\"$url/votes\"))\n ->assertStatus(200)\n ->assertJsonFragment(['total' => -1]);\n }", "public function test_message_can_be_upvoted() {\n\n $user = User::create('[email protected]', 'secret', 'Jane Doe');\n $this->message->upvote($user);\n $this->assertEquals(1, $this->message->getUpvotes());\n\n }", "function castVote($value = true) {\n\t\tif (!($uid = user_getid()) || $uid == 100) {\n\t\t\t$this->setMissingParamsError(_('User ID not passed'));\n\t\t\treturn false;\n\t\t}\n\t\tif (!$this->ArtifactType->canVote()) {\n\t\t\t$this->setPermissionDeniedError();\n\t\t\treturn false;\n\t\t}\n\t\t$has_vote = $this->hasVote($uid);\n\t\tif ($has_vote == $value) {\n\t\t\t/* nothing changed */\n\t\t\treturn true;\n\t\t}\n\t\tif ($value) {\n\t\t\t$res = db_query_params('INSERT INTO artifact_votes (artifact_id, user_id) VALUES ($1, $2)',\n\t\t\t\t\t\tarray($this->getID(), $uid));\n\t\t} else {\n\t\t\t$res = db_query_params('DELETE FROM artifact_votes WHERE artifact_id=$1 AND user_id=$2',\n\t\t\t\t\t\tarray($this->getID(), $uid));\n\t\t}\n\t\tif (!$res) {\n\t\t\t$this->setError(db_error());\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}", "public static function getUserThreadVote($threadId, $userId)\n {\n \t$userThreadVoteRow = (new \\yii\\db\\Query())\n \t\t\t->select('vote')\n \t\t\t->from('thread_vote')\n \t\t\t->where(['thread_id' => $threadId, 'user_id' => $userId])\n \t\t\t->one();\n \t\t\t\n \treturn ($userThreadVoteRow['vote'] === false) ? false : intval($userThreadVoteRow['vote']);\n }", "public function testExistingVote()\n {\n $vote = new Vote();\n $vote\n ->setAuthorToken($this->authorToken)\n ->setComment($this->comment)\n ->setType(Vote::UP);\n\n $this\n ->voteDirector\n ->expects($this->any())\n ->method('findOneBy')\n ->will($this->returnValue($vote));\n\n $this\n ->voteDirector\n ->expects($this->never())\n ->method('create');\n\n $this\n ->commentEventDispatcher\n ->expects($this->once())\n ->method('dispatchCommentOnVotedEvent')\n ->with(\n $this->equalTo($this->comment),\n $this->equalTo($vote),\n $this->equalTo(true)\n );\n\n $vote = $this\n ->voteManager\n ->vote(\n $this->comment,\n $this->authorToken,\n Vote::DOWN\n );\n\n $this->assertSame($this->authorToken, $vote->getAuthorToken());\n $this->assertSame($this->comment, $vote->getComment());\n $this->assertSame(Vote::DOWN, $vote->getType());\n }", "public function vote(Tide $tide, Tide\\Configuration\\ArrayObject $context);", "public function actionVote($id, $type, $vote = 1)\n {\n if(!Yii::$app->user->isGuest)\n {\n $voteModel = Vote::find()->where([\n 'voteable_type' => $type,\n 'voteable_id' => $id,\n 'user_id' => Yii::$app->user->id,\n ])->one();\n if(!isset($voteModel->id))\n {\n $voteModel = new Vote;\n $voteModel->voteable_type = $type;\n $voteModel->voteable_id = $id;\n $voteModel->user_id = Yii::$app->user->id;\n } elseif ($voteModel->vote == $vote) {\n $out = ['success' => false, 'error' => 'User has already voted'];\n echo Json::encode($out);\n return;\n }\n $voteModel->vote = $vote;\n if($voteModel->save())\n {\n $rating = Vote::getRating($id, $type);\n $out = ['success' => true, 'rating' => $rating];\n } else {\n $out = ['success' => false, 'error' => $voteModel->getErrors()];\n }\n } else {\n $out = ['success' => false, 'error' => 'User is guest'];\n }\n echo Json::encode($out);\n }", "private function vote()\n\t{\n\t\tif(!$this->owner->logged_in())\n\t\t\treturn new View('public_forum/login');\n\t\t\n\t\t$comment_id = valid::id_key($this->filter);\n\t\t$vote = $this->filter2;\n\t\t\n\t\t$has_voted = ORM::factory('forum_comment_vote')\n\t\t\t->where(array(\n\t\t\t\t'owner_id'\t\t \t=> $this->owner->get_user()->id,\n\t\t\t\t'forum_cat_post_comment_id' => $comment_id\n\t\t\t))\n\t\t\t->find();\t\n\t\tif(TRUE == $has_voted->loaded)\n\t\t\treturn 'already voted.';\n\t\t\t\n\t\t$vote = ('down' == $vote) ? -1 : 1 ;\n\t\t\n\t\t$comment = ORM::factory('forum_cat_post_comment', $comment_id);\t\t\n\t\t$comment->vote_count = ($comment->vote_count + $vote);\n\t\t$comment->save();\t\t\n\n\t\t# log the vote.\n\t\t$log_vote = ORM::factory('forum_comment_vote');\n\t\t$log_vote->owner_id = $this->owner->get_user()->id;\n\t\t$log_vote->forum_cat_post_comment_id = $comment_id;\n\t\t$log_vote->save();\n\n\t\treturn 'Vote has been accepted!';\n\t}", "public function isValid($vote)\n {\n\n // Check if User is logged in\n if (!$this->getUserService()->isAuthenticated()) {\n print 'Authentication required.';\n HttpUtility::setResponseCodeAndExit(HttpUtility::HTTP_STATUS_401);\n }\n\n if (!$vote instanceof Vote) {\n print 'I could not instantiate the Vote object.';\n HttpUtility::setResponseCodeAndExit(HttpUtility::HTTP_STATUS_400);\n }\n\n if (empty($vote->getVotedObject()->getContentType())) {\n print 'I miss a valid content type.';\n HttpUtility::setResponseCodeAndExit(HttpUtility::HTTP_STATUS_400);\n }\n\n $object = $this->getVotedObjectRepository()->findOne($vote);\n if (empty($object)) {\n print 'I could not retrieve the voted object.';\n HttpUtility::setResponseCodeAndExit(HttpUtility::HTTP_STATUS_404);\n }\n\n // Check the content element that contains the voting meta information.\n $contentElementIdentifier = (int)GeneralUtility::_GP('contentElement');\n if ($contentElementIdentifier < 1) {\n print 'Invalid or missing content element parameter.';\n HttpUtility::setResponseCodeAndExit(HttpUtility::HTTP_STATUS_400);\n }\n\n $content = $this->getContentElementService()->get($contentElementIdentifier);\n if (empty($content)) {\n print 'I could not retrieve this content element: ' . $contentElementIdentifier;\n HttpUtility::setResponseCodeAndExit(HttpUtility::HTTP_STATUS_404);\n }\n\n $settings = $this->getContentElementService()->getSettings($contentElementIdentifier);\n\n if ((int)$settings['closingDate'] > 0 && (int)$settings['closingDate'] < time()) {\n print 'Sorry, the vote is closed for this content element: ' . $contentElementIdentifier;\n HttpUtility::setResponseCodeAndExit(HttpUtility::HTTP_STATUS_403);\n }\n\n $allowedFrequency = (int)$settings['allowedFrequency'];\n $userIdentifier = $vote->getUser();\n $lastVote = $this->getVoteRepository()->findLastVote($settings['contentType'], $userIdentifier);\n if ($allowedFrequency > 0 && !empty($lastVote)) {\n\n if ($allowedFrequency === self::ALLOWED_ONLY_ONCE_PER_24 && time() - $lastVote['time'] < 86400) {\n print 'Sorry, you can not vote for this type of object today, please come back.';\n HttpUtility::setResponseCodeAndExit(HttpUtility::HTTP_STATUS_403);\n } elseif ($allowedFrequency === self::ALLOWED_ONLY_ONCE) {\n print 'Sorry, you can vote only once for this type of object.';\n HttpUtility::setResponseCodeAndExit(HttpUtility::HTTP_STATUS_403);\n }\n }\n }", "public function test_message_can_only_be_voted_on_once() {\n\n $user = User::create('[email protected]', 'secret', 'Jane Doe');\n $this->message->upvote($user);\n $this->message->upvote($user);\n $this->assertEquals(1, $this->message->getUpvotes());\n\n $this->message->downvote($user);\n $this->message->downvote($user);\n $this->assertEquals(1, $this->message->getDownvotes());\n\n }", "public static function userVoted($userId, $userIp)\n {\n $vote = new self();\n $vote->user_id = $userId;\n $vote->user_ip = $userIp;\n $vote->save();\n }", "public function vote(TokenInterface $token, $object, array $attributes)\n {\n if (!$this->supportsClass(get_class($object))) {\n return VoterInterface::ACCESS_ABSTAIN;\n }\n\n foreach ($attributes as $attribute) {\n if (!$this->supportsAttribute($attribute)) {\n continue;\n }\n\n $user = $token->getUser();\n\n if ($attribute === 'VIEW') {\n return $this->canUserViewGame($user, $object);\n } elseif ($attribute === 'EDIT') {\n return $this->canUserEditGame($user, $object);\n }\n\n if ($object->getUser() == $user) {\n return VoterInterface::ACCESS_GRANTED;\n }\n }\n\n return VoterInterface::ACCESS_ABSTAIN;\n }", "public function checkVoted(User $user, $id, $type)\n\t{\n\t\treturn $this->votes()->where('user_id', $user->id)->exists();\n }", "public function vote($submission_id, $user_id)\n {\n $this->submission->find($submission_id)->attach($user_id);\n }", "public function vote($id){\n $data['where'] = ['topic_id'=>$id,'user_id'=>Auth::user()->id];\n $collection = DB::table('topic_user')->where($data['where'])->first();\n $data['id'] = $id;\n if($collection) {\n DB::transaction(function ($data) use ($data) {\n try {\n $this->model->where('id', $data['id'])->decrement('vote_count');\n DB::table('topic_user')->where($data['where'])->delete();\n } catch (\\Exception $e) {\n throw $e;\n }\n });\n }else{\n DB::transaction(function ($data) use ($data) {\n try {\n $this->model->where('id', $data['id'])->increment('vote_count');\n DB::table('topic_user')->insert($data['where']);\n } catch (\\Exception $e) {\n throw $e;\n }\n });\n }\n }", "public function vote_active() { \n\n\t\t/* Going to do a little more here later */\n\t\tif ($this->type == 'vote') { return true; } \n\n\t\treturn false;\n\n\t}", "public function voteAction ()\n {\n /* @var $em \\Doctrine\\ORM\\EntityManager */\n $em = $this->get('doctrine')->getManager();\n \n $user = $this->getUser();\n if(!$user) {\n throw new UnauthorizedHttpException('You must be logged in to comment.');\n }\n \n $request = $this->getRequest();\n $decklist_id = filter_var($request->get('id'), FILTER_SANITIZE_NUMBER_INT);\n \n $decklist = $em->getRepository('NetrunnerdbBuilderBundle:Decklist')->find($decklist_id);\n $query = $em->getRepository('NetrunnerdbBuilderBundle:Decklist')\n ->createQueryBuilder('d')\n ->innerJoin('d.votes', 'u')\n ->where('d.id = :decklist_id')\n ->andWhere('u.id = :user_id')\n ->setParameter('decklist_id', $decklist_id)\n ->setParameter('user_id', $user->getId())\n ->getQuery();\n \n $result = $query->getResult();\n if (empty($result)) {\n $user->addVote($decklist);\n $author = $decklist->getUser();\n $author->setReputation($author->getReputation() + 1);\n $decklist->setTs(new \\DateTime());\n $decklist->setNbvotes($decklist->getNbvotes() + 1);\n $this->get('doctrine')\n ->getManager()\n ->flush();\n }\n \n return new Response(count($decklist->getVotes()));\n \n }", "function getVoted()\n {\n JSession::checkToken() or jexit('Invalid Token');\n\n $app = JFactory::getApplication();\n $idea_id = JRequest::getInt('id', 0);\n $option_id = JRequest::getInt('voteid', 0);\n $idea = JTable::getInstance('Idea', 'Table');\n\n if(!$idea->load($idea_id) || $idea->published != 1)\n {\n $app->redirect('index.php', JText::_('ALERTNOTAUTH 1'));\n\n return true;\n }\n\n require_once(JPATH_COMPONENT . '/models/idea.php');\n $model = new JUIdeiModelIdea();\n $params = new JRegistry($idea->params);\n $cookieName = JApplicationHelper::getHash($app->getName() . 'idea' . $idea_id);\n\n\n $voted_cookie = JRequest::getVar($cookieName, '0', 'COOKIE', 'INT');\n $voted_ip = $model->ipVoted($idea, $idea_id);\n\n if($params->get('ip_check') and ($voted_cookie or $voted_ip or !$option_id))\n {\n /*if($voted_cookie || $voted_ip)\n {\n $msg = JText::_('COM_MIR_ALREADY_VOTED');\n $tom = \"error\";\n }\n\n if(!$option_id)\n {\n $msg = JText::_('COM_MIR_NO_SELECTED');\n $tom = \"error\";\n }\n */\n\n $this->_voted = 0;\n }\n else\n {\n if($model->vote($idea_id, $option_id))\n {\n $this->_voted = 1;\n\n setcookie($cookieName, '1', time() + 60 * $idea->lag);\n }\n else\n {\n $this->_voted = 0;\n }\n }\n\n return $this->_voted = 1;\n }", "public function test_a_user_can_toggle_posts(){\n \n //we have a signed in user\n \n //user likes the model\n $this->post->toggle();\n\n $this->assertTrue($this->post->isLiked());\n\n $this->post->toggle();\n\n $this->assertFalse($this->post->isLiked());\n }", "public function testTask()\n {\n $task = new Task();\n $user = new User();\n\n $this->assertNull($task->getId());\n $task->setTitle('test');\n $this->assertSame('test', $task->getTitle());\n $task->setContent('testcontent');\n $this->assertSame('testcontent', $task->getContent());\n $task->toggle(true);\n $this->assertTrue( $task->isDone());\n $task->setUser($user);\n $this->assertInstanceOf(User::class, $task->getUser());\n $task->setCreatedAt(new \\DateTime());\n $this->assertNotEmpty($task->getCreatedAt());\n }", "public function __invoke(VotingUuid $votingUuid): ?Vote;", "function getvotes($user) {\n\tglobal $wpdb;\n\tif(user_can($user, 'banda')) {\n\t\t$votos = $wpdb->get_var( \"SELECT count(1) FROM \".$wpdb->prefix . \"poptest_votos where usuario = \".$user.\" group by usuario\");\n\t\treturn $votos;\n\t} else {\n\t\t//Error\n\t\treturn false;\n\t}\n}", "function voter() {\n\t\tif (isset($_GET['id']) && isset($_GET['vote'])) {\n\t\t\tif ($this -> modele -> getSondage($_GET['id']) && $this -> modele -> getAVote($_GET['id'], $_SESSION['id']) == 0) {\n\t\t\t\tif ($this -> modele -> insertAVote($_GET['id'], $_SESSION['id'], $_GET['vote']) != 0 && $this -> modele -> updateSondage($_GET['vote'], $_GET['id'])) {\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t}\n\t\t\t$sondage = $this -> modele -> getSondage($_GET['id']);\n\t\t\t$resultats = '';\n\t\t\t$totalVote = $sondage[5] + $sondage[6] + $sondage[7] + $sondage[8];\n\t\t\tif (is_array($sondage) || is_object($sondage)) {\n\t\t\t\tforeach ($sondage as $key => $reponse) {\n\t\t\t\t\tif ($key > 0 && $key < 5 && $reponse != null) {\n\t\t\t\t\t\tif ($totalVote == 0)\n\t\t\t\t\t\t\t$resultats .= $this -> vue -> resultat($reponse, 0);\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\t$resultats .= $this -> vue -> resultat($reponse, $sondage[$key + 4] / $totalVote * 100);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\techo $this -> vue -> resultatSondage($resultats);\n\t\t}\n\t}", "public function vote()\n\t\t{\n\t\t\t$betId = $this->input->get_post('bet_id');\t\n\t\t\t$categoryId = $this->input->get_post('cat_id');\n\t\t\t$answerType = $this->input->get_post('answer_type');\n\t\t\t$userId = $this->input->get_post('user_id');\n\t\t\ttry{\n\t\t\t\tif($betId == false || $betId== \"\"){\n\t\t\t\t\t$this->_jsonData['status']=\"FAILURE\";\n\t\t\t\t\t$this->_jsonData['message']=\"Bet Id Missing\";\n\t\t\t\t}else if($categoryId == false || $categoryId == \"\"){\n\t\t\t\t\t$this->_jsonData['status']=\"FAILURE\";\n\t\t\t\t\t$this->_jsonData['message']=\"Category Id Missing\";\n\t\t\t\t}else if($answerType == false || $answerType == \"\"){\n\t\t\t\t\t$this->_jsonData['status']=\"FAILURE\";\n\t\t\t\t\t$this->_jsonData['message']=\"Answer Type Missing\";\n\t\t\t\t}else if($userId == false || $userId == \"\"){\n\t\t\t\t\t$this->_jsonData['status']=\"FAILURE\";\n\t\t\t\t\t$this->_jsonData['message']=\"User Id Missing\";\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\t$data = array(\n\t\t\t\t\t\t\t\t'bet_id'=>$betId,\n\t\t\t\t\t\t\t\t'cat_id'=>$categoryId,\n\t\t\t\t\t\t\t\t'answer_type'=>$answerType,\n\t\t\t\t\t\t\t\t'user_id'=>$userId,\n\t\t\t\t\t);\n\t\t\t\t\t$res=$this->userModel->vote($data);\n\t\t\t\t\tif($res){\n\t\t\t\t\t\t//echo 1;\n\t\t\t\t\t\t$this->_jsonData['status']=\"SUCCESS\";\n\t\t\t\t\t\t$this->_jsonData['message']=\"Voted Successfully\";\n\t\t\t\t\t\t$this->_jsonData['data']='';\n\t\t\t\t\t}else{\n\t\t\t\t\t\t//echo 0;\n\t\t\t\t\t\t$this->_jsonData['status']=\"FAILURE\";\n\t\t\t\t\t\t$this->_jsonData['message']=\"You already voted for this bet..\";\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}catch(Exception $e){\n\t\t\t\t$this->_jsonData['status']=\"FAILURE\";\n\t\t\t\t$this->_jsonData['message']=\"You already voted.\";\n\t\t\t\t$this->_jsonData['data']='';\n\t\t\t}\n\t\t\techo json_encode($this->_jsonData);\n\t\t\t$this->ServicesModel->createService($_REQUEST,$this->_jsonData,$_SERVER['SERVER_ADDR'],'vote',$_FILES);\n\t\t}", "function hasVote($uid=false) {\n\t\tif (!$uid) {\n\t\t\t$uid = user_getid();\n\t\t}\n\t\tif (!$uid || $uid == 100) {\n\t\t\treturn false;\n\t\t}\n\t\t$res = db_query_params('SELECT * FROM artifact_votes WHERE artifact_id=$1 AND user_id=$2',\n\t\t\t\t\tarray($this->getID(), $uid));\n\t\treturn (db_numrows($res) == 1);\n\t}", "private function checkIfTaskBelongsToUSer(Task $task)\n {\n if ($task->user_id != session()->get('user')->id) {\n abort(403, 'You are not authorized to see this task.');\n }\n }", "public function vote($vote)\n {\n $params = array();\n $user = $GLOBALS['current_user'];\n $contact_id = null;\n\n if (!$this->isValidSugarUser($user) && $contact = $this->getPortalContact()) {\n $contact_id = $contact->id;\n $params['where'] = 'contact_id = ' . DBManagerFactory::getInstance()->quoted($contact_id);\n }\n /**\n * Load only required votes\n */\n $this->load($params);\n\n /**\n * Delete previous votes for a portal contact\n */\n if ($contact_id !== null) {\n if (!empty($this->rows)) {\n $q = $this->relationship->getQuery($this, array('return_as_array' => true));\n if (!empty($params['where'])) {\n $q['where'] .= ' AND ' . $params['where'];\n }\n $q = 'UPDATE ' . $this->relationship->getRelationshipTable() . ' SET deleted = 1 ' . $q['where'];\n DBManagerFactory::getInstance()->query($q);\n }\n $this->relationship->primaryOnly = true;\n }\n $result = $this->add(\n $user,\n array(\n 'vote' => $vote ? 1 : -1,\n 'ssid' => session_id(),\n 'contact_id' => $contact_id,\n 'zeroflag' => 0\n )\n );\n $this->relationship->primaryOnly = false;\n return $result;\n }", "private function voteIdea(): bool\n {\n try {\n $this->idea->voters()->attach(auth()->user());\n return true;\n } catch (\\Illuminate\\Database\\QueryException $e) {\n // User already voted for this idea\n return false;\n }\n }", "public function isVotedBy($user, $type = null)\n {\n return Interaction::isRelationExists($this, 'voters', $user);\n }", "public function vote(Request $request)\n {\n if(!$user = JWTAuth::parseToken()->authenticate())\n {\n return response()->json([\n 'message' => 'User Not Found'\n ], 404);\n }\n \n \n $this->validate($request, [\n 'user_id' => 'required',\n 'poll_id' => 'required',\n 'option_id' => 'required',\n ]);\n\n $vote = new Vote();\n $vote->user_id = $request->user_id;\n $vote->poll_id = $request->poll_id;\n $vote->option_id = $request->option_id;\n $vote->created_at = Carbon::now();\n $vote->updated_at = Carbon::now();\n\n $vote->save();\n\n return response()->json([\n 'message' => 'Vote Placed Succesfully'\n ],200);\n\n }", "public static function vote($id) {\n $poll = Poll::find($id);\n self::check_flag_true($poll->can_vote);\n $poll_options = PollOption::all($id);\n View::make('poll/vote.html',\n array('poll' => $poll, 'poll_options' => $poll_options));\n }", "function vote($userid,$subjectid,$type,$vote) {\n\t$type = dbEscape($type);\n\t$userid = intval($userid);\n\t$subjectid = intval($subjectid);\n\t$vote = intval($vote);\n\n\tswitch($vote) {\n\tcase 0:\n\t\t// Unset/delete vote\n\t\tdbQuery(\"DELETE FROM votes WHERE userid=$userid AND subjectid=$subjectid AND type='$type'\");\n\t\tbreak;\n\tcase 1:\n\tcase -1:\n\t\t// Check if we've already voted\n\t\t$result = dbFirstResult(\"SELECT * FROM votes WHERE userid=$userid AND subjectid=$subjectid AND type='$type'\");\n\t\t\n\t\tif(empty($result)) { // Make a new vote if we haven't voted before\n\t\t\tdbQuery(\"INSERT INTO votes (userid,type,subjectid,vote) VALUES($userid,'$type',$subjectid,$vote)\");\t\n\t\t}\n\t\n\t\telseif($vote != $row[vote]) { // Update our old vote if we have voted before\n\t\t\tdbQuery(\"UPDATE votes SET vote=$vote WHERE userid=$userid AND subjectid=$subjectid AND type='$type'\");\n\t\t}\n\t\t\n\t\tbreak;\n\tdefault: // Any vote other than +1, -1 or 0\n\t\treturn(false);\n\t\tbreak;\n\t}\n\n\t// Grab and return the new vote count\n\t$result = dbFirstResult(\"SELECT points FROM totalvotes WHERE subjectid=$subjectid AND type='$type'\");\n\tif(empty($result)) { $result = 0; }\t\t\n\t$result .= ($result == 1 || $result == -1) ? ' point' : ' points';\n\treturn(\"$result\");\n}", "public function providerTestVote()\n {\n return array(\n // No user may ever start any Task if the Task has no resource.\n array(Task::STATUS_ASSIGNED, Task::STATUS_STARTED, StatusVoter::ACCESS_DENIED),\n // No user may ever re-assign any Task if it is finished.\n array(Task::STATUS_FINISHED, Task::STATUS_ASSIGNED, StatusVoter::ACCESS_DENIED),\n // No user may ever re-assign any Task if it is sent to the client.\n array(Task::STATUS_SENT, Task::STATUS_ASSIGNED, StatusVoter::ACCESS_DENIED),\n // No user may ever re-assign any Task if it is archived.\n array(Task::STATUS_ARCHIVED, Task::STATUS_ASSIGNED, StatusVoter::ACCESS_DENIED),\n );\n }", "public function voteVideoAction()\n\t{\n\t\t$userSession\t= new Container('fo_user');\n\t\t$request\t\t= $this->getRequest();\n\t\t\n\t\tif(isset($userSession->userSession['_id']) && trim($userSession->userSession['_id']) != '') {\n\t\t\tif($request->isPost()) {\n\t\t\t\t$formData\t= $request->getPost();\n\t\t\t\tif(!isset($userSession->mediaSession['rating'][base64_decode($formData['videoId'])]) && isset($formData['type']) && ($formData['type'] == '1' || $formData['type'] == '2')) {\n\t\t\t\t\t$this->doVote($formData['type'], $formData['videoId']);\n\t\t\t\t\t$typeText\t= ($formData['type'] == 1) ? 'like' : 'dislike';\n\t\t\t\t\tif(isset($userSession->mediaSession['rating'])) {\n\t\t\t\t\t\t$tempArray['rating']\t\t\t\t\t\t\t\t\t\t= $userSession->mediaSession['rating'];\n\t\t\t\t\t\t//$tempArray['rating'][base64_decode($formData['videoId'])]\t= base64_decode($formData['videoId']);\n\t\t\t\t\t\t$tempArray['rating'][base64_decode($formData['videoId'])]\t= $typeText;\n\t\t\t\t\t\t$userSession->mediaSession\t\t\t\t\t\t\t\t\t= $tempArray;\n\t\t\t\t\t} else {\n\t\t\t\t\t\t//$tempArray['rating'][base64_decode($formData['videoId'])]\t= base64_decode($formData['videoId']);\n\t\t\t\t\t\t$tempArray['rating'][base64_decode($formData['videoId'])]\t= $typeText;\n\t\t\t\t\t\t$userSession->mediaSession\t\t\t\t\t\t\t\t\t= $tempArray;\n\t\t\t\t\t}\n\t\t\t\t\techo trim($formData['type']);\n\t\t\t\t} else if(isset($userSession->mediaSession['rating'][base64_decode($formData['videoId'])])) {\n\t\t\t\t\techo \"-2\";\t// Voted\n\t\t\t\t} else {\n\t\t\t\t\techo \"-1\";\t//\timproper data\n\t\t\t\t}\n\t\t\t\t\n\t\t\t} else {\n\t\t\t\techo \"-1\";\t//\timproper data\n\t\t\t}\n\t\t} else {\n\t\t\techo \"0\";\t//\tuser session is in-active\n\t\t}\n\t\treturn $this->getResponse();\n\t}", "public function see(User $user, Task $task)\n {\n return $user->hasPermissionTo(Actions::VIEW, $task);\n }", "function newvote($idvideo, $iduser, $vote){\n \t$realid = pg_escape_string($idvideo);\n \t$realuser = pg_escape_string($iduser);\n \t$realvote = pg_escape_string($vote);\n \t$query = \"INSERT into votexuser (idusuario, idvideo, vote) values (\".$realuser.\", \".$realid.\", \".$realvote.\");\";\n \t$link = createConection();\n \tif(pg_exec($link, $query)){\n \t\tcloseConection($link);\n \t\treturn true;\n \t}else{\n \t\tcloseConection($link);\n \t\treturn false;\n \t}\n }", "public function test_user_cannot_both_upvote_and_downvote() {\n\n $user = User::create('[email protected]', 'secret', 'Jane Doe');\n $this->message->upvote($user);\n $this->message->downvote($user);\n $this->assertEquals(0, $this->message->getUpvotes());\n $this->assertEquals(1, $this->message->getDownvotes());\n\n $this->message->downvote($user);\n $this->message->upvote($user);\n $this->assertEquals(1, $this->message->getUpvotes());\n $this->assertEquals(0, $this->message->getDownvotes());\n\n }", "function getvotesavailable($user) {\n\tglobal $wpdb;\n\tif(user_can($user, 'integrante')) {\n\t\t$votos = $wpdb->get_var( \"SELECT cantvotos FROM \".$wpdb->prefix . \"poptest_votosdisponibles where usuario = \".$user);\n\t\treturn $votos;\n\t} else {\n\t\treturn false;\n\t}\n}", "public function Voted ($id) {\n // if (Voter::where('index_number', $id)->exists()) {\n $voter = Voter::where(\"index_number\", '=', $id)->update(['vote_status'=> 'yes']);\n if($voter){\n return response()->json([\n \"message\" => \"sucesss\"\n ], 200);\n }\n else{\n return response()->json([\n \"message\" => \"Failed to update yes\"\n ], 404);\n }\n \n \n // } else {\n \n // }\n }", "public function canVote(Request $request, $id): \\Illuminate\\Http\\Response\n {\n $poll = Poll::withTrashed()->findOrFail($id);\n $invitation = Invitation::wherePollId($id)->whereEmail($request->user()->email)->exists();\n $voter = Voter::wherePollId($id)->whereUserId($request->user()->id)->first();\n\n return response(['data' => [\n 'canVote' => request()->user()->can('vote', $poll),\n 'invited' => !!$invitation,\n 'voted' => $voter && $voter->voted_at,\n ]]);\n }", "abstract protected function doSaveVote(BaseVote $vote);", "function user_vote()\n{\n\n // nonce check for an extra layer of security, the function will exit if it fails\n if (!wp_verify_nonce($_REQUEST['nonce'], \"user_vote_nonce\")) {\n exit(\"nonce error\");\n }\n\n $post_id = $_REQUEST[\"post_id\"];\n $vote_direction = $_REQUEST[\"vote_direction\"];\n\n // fetch vote_count for a post, set it to 0 if it's empty, increment it when a click is registered\n $old_vote_count = get_post_meta($post_id, \"votes\", true);\n $old_vote_count = ($old_vote_count == '') ? 0 : $old_vote_count;\n $new_vote_count = $old_vote_count;\n\n //voted post structure\n //$voted_posts = array(\"1\" => 0, \"5\" => 1, \"7\" => -1);\n\n $previous_vote_direction = get_vote_direction_meta($post_id);\n //if previous vote in middle regular vote apply: $previous_vote_direction == 0\n\n //if vote remove: $vote_direction == $previous_vote_direction\n // add negative vote direction to old vote count\n // set vote direction to middle\n\n //if vote swap: $vote_direction != $previous_vote_direction\n // add 2 times vote directions to old vote count\n // set vote meta to vote direction\n\n if($previous_vote_direction == 0){\n $new_vote_count += $vote_direction;\n set_user_vote_direction($post_id, $vote_direction);\n }elseif ($vote_direction == $previous_vote_direction){\n $new_vote_count = $old_vote_count - $vote_direction;\n set_user_vote_direction($post_id, 0);\n }elseif ($vote_direction != $previous_vote_direction){\n $new_vote_count = $old_vote_count + 2*$vote_direction;\n set_user_vote_direction($post_id, $vote_direction);\n }\n\n\n $vote = update_post_meta($post_id, \"votes\", $new_vote_count);\n\n\n // If above action fails, result type is set to 'error' and vote_count set to old value, if success, updated to new_vote_count\n if ($vote === false) {\n $result['type'] = \"error\";\n $result['vote_count'] = $old_vote_count;\n } else {\n $result['type'] = \"success\";\n $result['vote_count'] = $new_vote_count;\n }\n\n // Check if action was fired via Ajax call. If yes, JS code will be triggered, else the user is redirected to the post page\n if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {\n $result = json_encode($result);\n echo $result;\n } else {\n header(\"Location: \" . $_SERVER[\"HTTP_REFERER\"]);\n }\n\n die();\n}", "public function testDeleteAnonymousTaskSubmitAsUser()\n {\n $crawler = $this->requestAsUser('/tasks');\n\n // Can't use assertSelectorTextContains() because it only checks the first selector occurrence\n // and the task we are looking for is not the first one in the displayed list of tasks.\n // See: https://github.com/symfony/symfony-docs/issues/13036\n //$this->assertSelectorTextContains('h4 > a', 'Tâche Eric n°1');\n $this->assertEquals(1, $crawler->filter('h4 > a:contains(\"Tâche anonyme n°1\")')->count());\n\n // Then we try to delete it\n $task_id = self::getTaskIdByTitle('Tâche anonyme n°1');\n\n $this->requestAsUser('/tasks/'.$task_id.'/delete');\n\n // When requesting this URL while being connected as user, we should be\n // redirected to the \"access denied\" page with the 403 status code.\n $this->assertEquals(403, $this->client->getResponse()->getStatusCode());\n $this->assertSelectorTextContains('h1', 'Accès non autorisé.');\n }", "public function ballot($user_id = 0, $ip = null)\n\t{\n\t\tif (User::isGuest())\n\t\t{\n\t\t\t$vote = new Vote();\n\t\t\t$vote->set('item_type', 'question');\n\t\t\t$vote->set('item_id', $this->get('id'));\n\t\t\t$vote->set('created_by', $user_id);\n\t\t\t$vote->set('ip', $ip);\n\n\t\t\treturn $vote;\n\t\t}\n\n\t\t$user = $user_id ? User::getInstance($user_id) : User::getInstance();\n\t\t$ip = $ip ?: Request::ip();\n\n\t\t// See if a person from this IP has already voted in the last week\n\t\t$votes = $this->votes();\n\n\t\tif ($user->get('id'))\n\t\t{\n\t\t\t$votes->whereEquals('created_by', $user->get('id'));\n\t\t}\n\t\telseif ($ip)\n\t\t{\n\t\t\t$votes->whereEquals('ip', $ip);\n\t\t}\n\n\t\t$vote = $votes\n\t\t\t->ordered()\n\t\t\t->limit(1)\n\t\t\t->row();\n\n\t\tif (!$vote || !$vote->get('id'))\n\t\t{\n\t\t\t$vote = new Vote();\n\t\t\t$vote->set('item_type', 'question');\n\t\t\t$vote->set('item_id', $this->get('id'));\n\t\t\t$vote->set('created_by', $user_id);\n\t\t\t$vote->set('ip', $ip);\n\t\t}\n\n\t\treturn $vote;\n\t}", "public function submitVote($voteType, $user, $id, $type)\n {\n \tif(!$this->checkVoted($user, $id, $type))\n \t{\n \t\t$newVote = new Vote();\n \t\t$newVote->user_id = $user->id;\n \t\t$newVote->vote = $voteType;\n \t\t$this->votes()->save($newVote);\n \t\treturn true;\n \t}\n \telse\n \t{\n // user has voted before, so go through table and update previous vote\n // if user uses same vote twice, then the value is made neutral\n \t\t$oldVote = $this->findVote($user, $id, $type);\n \t\tif ($voteType == $oldVote->vote)\n \t\t{\n \t\t\t$oldVote->vote = 0;\n \t\t}\n \t\telse\n \t\t{\n \t\t\t$oldVote->vote = $voteType;\n \t\t}\n\n \t\t$oldVote->save();\n \t\treturn true;\n \t}\n \treturn false;\n }", "public function vote($object, $attribute)\n {\n if ($this->supportsObject($object) && $this->supportsAttribute($attribute)) {\n return $this->hasAccess($object, $attribute)\n ? self::ACCESS_GRANTED\n : self::ACCESS_DENIED;\n }\n\n return self::ABSTAINED;\n }", "public function testSeeTaskButton()\n {\n $user = User::first();\n $project = $user->projects()->first();\n \\Auth::login($user);\n $response = $this->actingAs($user)->get('/projects/'.$project->id);\n $response->assertSee(__(\"project.add_task\"));\n }", "public function vote($id)\r\n\t{\r\n\t\t// Find our game and perform the vote.\r\n\t\t$game = $this->findById($id);\r\n\r\n\t\t// Check if we own this game already.\r\n\t\tif (!empty($game) && $game['owned'] == 1) return false;\r\n\r\n\t\t// Check if we are using the service.\r\n\t\tif (XBOXAPP_OFFLINE === true) {\t\t\t\r\n\t\t\tif (empty($game)) return false;\r\n\t\t\t$this->update($id, array('votes' => (int)(++$game['votes'])));\r\n\t\t} else {\r\n\t\t\t// Add a vote to the game.\r\n\t\t\tif (!ServiceApi::addVote($id)) return false;\r\n\t\t}\r\n\r\n\t\t// Sync up our database.\r\n\t\t$this->sync();\t\t\r\n\r\n\t\treturn true;\r\n\t}", "public function show(vote $vote)\n {\n //\n }", "public function hasVoted($categoryId, $ip);", "public function view(User $user, Task $task)\n {\n if ($user->isAdmin()) {\n return true;\n } else if (\n // User is chair, captain or sv for the task's conference\n $user->isChair($task->conference) ||\n $user->isCaptain($task->conference) ||\n $user->isSv($task->conference)\n ) {\n return true;\n } else {\n return false;\n }\n }", "public function vote()\r\n\t{\r\n\r\n\t\t$poll_id = $_POST['poll_id']; \r\n\r\n\t\t// Increate vote for desired field\r\n\t\tif (have_rows('polls_options', $poll_id)) {\r\n\t\t\twhile (have_rows('polls_options', $poll_id)) {\r\n\t\t\t\tthe_row();\r\n\t\t\t\tif (get_sub_field('poll_option') === $_POST[\"votes_question\"]) {\r\n\r\n\t\t\t\t\t// Update vote count into ACF field\r\n\t\t\t\t\t$current_votes_count = get_sub_field('poll_option_votes');\r\n\t\t\t\t\t$vote = update_sub_field('poll_option_votes', $current_votes_count ? ++$current_votes_count : 1, $poll_id);\r\n\r\n\t\t\t\t\t// Add poll ID to session \r\n\t\t\t\t\tsession_start();\r\n\t\t\t\t\tif (!isset($_SESSION['wppoll'])) {\r\n\t\t\t\t\t\t$_SESSION['wppoll'] = array();\r\n\t\t\t\t\t}\r\n\t\t\t\t\tarray_push($_SESSION['wppoll'], (int) $poll_id);\r\n\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\twp_die();\r\n\r\n\t\tif (!$vote) {\r\n\t\t\t$data = array('type' => 'error', 'message' => 'Voting failed');\r\n\t\t\theader('HTTP/1.1 400 Bad Request');\r\n\t\t\theader('Content-Type: application/json; charset=UTF-8');\r\n\t\t\techo json_encode($data);\r\n\t\t}\r\n\t\twp_die();\r\n\t}", "function setVote($id, $vote) { \n\ttry { \n\t\tif (($vote != 1) && ($vote != 2)) { \n\t\t\terror_log('vote must be 1 or 2');\n\t\t\treturn 0;\n\t\t} else { \n\t\t\t$question = ORM::for_table('questions')->where('id', $id)->find_one();\n\t\t\tif ($vote == 1) { \n\t\t\t\t$question->vote_answer1 += 1;\n\t\t\t} else { \n\t\t\t\t$question->vote_answer2 += 1;\n\t\t\t}\n\t\t\t$question->save();\n\t\t\treturn 1;\n\t\t}\n\t} catch (Exception $e) { \n\t\terror_log($e->getMessage());\n\t\treturn 0;\n\t}\n}", "public function viewAny(User $user, Task $task = null): bool\n {\n // filtering is done when returning search results (mostly relevant for latest changes)\n if(!$task) {\n return $user->can('viewAny', Task::class);\n }\n\n return $user->can('view', $task);\n }", "public function update(User $user, Task $task): bool\n {\n // Any authenticated user can modify a task\n return true;\n }", "public function show(Vote $vote)\n {\n //\n }", "public function edit(vote $vote)\n {\n //\n }", "protected function catch_vote() {\n\t\t// Immediately get out of here if no vote was cast\n\t\tif ( ! isset( $_POST['thumbsup_id'] ) or ! isset( $_POST['thumbsup_rating'] ) ) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Ignore votes for invalid item ids\n\t\tif ( ! ctype_digit( (string) $_POST['thumbsup_id'] ) or ! $this->load_item( (int) $_POST['thumbsup_id'] ) ) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// A new vote is cast\n\t\t$this->new_vote['item_id'] = $this->item['id'];\n\n\t\t// Check if one is still allowed to vote on this item\n\t\tif ( $this->item['closed'] ) {\n\t\t\t$this->new_vote['error'] = 'Voting is closed for this item.';\n\t\t\treturn false;\n\t\t}\n\n\t\t// Already voted for this item? Check cookie first.\n\t\tif ( isset( $this->cookie[ $this->item['id'] ] ) ) {\n\t\t\t$this->new_vote['error'] = 'You have already voted for this item.';\n\t\t\treturn false;\n\t\t}\n\n\t\t// Check IP, if we found one for this user\n\t\tif ( $this->config['ip_check'] and ! empty( $this->ip ) ) {\n\t\t\tif ( ThumbsUp_Database::db()->singleQuery(\"\n\t\t\t\tSELECT 1\n\t\t\t\tFROM votes\n\t\t\t\tWHERE item_id = {$this->item['id']} AND ip = '$this->ip'\n\t\t\t\tLIMIT 1\") ) {\n\t\t\t\t$this->new_vote['error'] = 'You have already voted for this item.';\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\t// Store the vote data into the new_vote property\n\t\t$this->new_vote += array(\n\t\t\t'rating' => min( 1, max( 0, (int) $_POST['thumbsup_rating'] ) ), // Must be either 0 or 1\n\t\t\t'ip' => $this->ip,\n\t\t\t'date' => time(),\n\t\t);\n\n\t\t// Finally, it is time to cast the vote\n\t\tThumbsUp_Database::db()->queryExec(\"\n\t\t\tINSERT INTO votes (id, item_id, rating, ip, date)\n\t\t\tVALUES (NULL, {$this->new_vote['item_id']}, {$this->new_vote['rating']}, '{$this->new_vote['ip']}', {$this->new_vote['date']})\");\n\n\t\t// Add the current item id to the cookie list\n\t\t$this->update_cookie( $this->item['id'] );\n\n\t\t// Vote successfully registered\n\t\treturn true;\n\t}", "public function testGetUserRating()\n {\n $rating = new Rating($this->user->getId(), $this->video->getId(), 5);\n $inserted = $rating->insert();\n\n $rating = Rating::getUserRating($this->user->getId(), $this->video->getId());\n $this->assertEquals(5, $rating);\n }", "public function vote(TokenInterface $token, $object, array $attributes)\n {\n if (!$this->supportsClass($object)) {\n return VoterInterface::ACCESS_ABSTAIN;\n }\n\n foreach ($attributes as $attribute) {\n if (!$this->supportsAttribute($attribute)) {\n continue;\n }\n\n $result = $this->doAttributeVote($token, $object, $attribute);\n if ($result) {\n return $result;\n }\n }\n\n return VoterInterface::ACCESS_ABSTAIN;\n }", "public function testAdultUsersCanSeeTaskList()\n {\n $this->withoutExceptionHandling();\n Task::factory(3)->create();\n $adult = User::create([\n 'name' => 'vanessa',\n 'role' => 'adult',\n 'points' => 0,\n 'email' => '[email protected]',\n 'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi',\n 'remember_token' => Str::random(10)\n ]);\n\n $response = $this->actingAs($adult)\n ->get(route('dashboard.tasks'));\n $response->assertStatus(200)\n ->assertViewIs('dashboard.task-list')\n ->assertViewHas('taskList');\n }", "public function checkTrophyVote($trophy_id)\r\n {\r\n $model = new Ynidea_Model_DbTable_Trophies;\r\n $select = $model -> select()->where('trophy_id = ?',$trophy_id); \r\n $row = $model->fetchRow($select); \r\n if($row->status == 'voting')\r\n return true;\r\n else\r\n return false; \r\n }", "protected function load_vote() {\n\t\t// No item loaded yet\n\t\tif ( empty( $this->item['id'] ) ) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// A new vote was cast for the current item\n\t\tif ( isset( $this->new_vote['item_id'] ) and $this->new_vote['item_id'] == $this->item['id'] ) {\n\t\t\t// Transfer new vote data to the item property\n\t\t\t$this->item['vote'] = $this->new_vote;\n\n\t\t\t// This vote is only new, if it was really registered\n\t\t\t$this->item['vote']['new'] = empty( $this->new_vote['error'] );\n\n\t\t\t// The item id is stored in item[id] already\n\t\t\tunset( $this->item['vote']['item_id'] );\n\n\t\t\t// Vote found\n\t\t\treturn true;\n\t\t}\n\n\t\t// We can only retrieve a previous vote via IP\n\t\tif ( $this->config['ip_check'] and ! empty( $this->ip ) ) {\n\t\t\t$vote = ThumbsUp_Database::db()->arrayQuery(\"\n\t\t\t\tSELECT rating, ip, date\n\t\t\t\tFROM votes\n\t\t\t\tWHERE item_id = {$this->item['id']} AND ip = '$this->ip'\n\t\t\t\tLIMIT 1\", SQLITE_ASSOC);\n\n\t\t\t// Previous vote found\n\t\t\tif ( ! empty( $vote ) ) {\n\t\t\t\t$this->item['vote'] = current( $vote );\n\t\t\t\t$this->item['vote']['new'] = false;\n\n\t\t\t\t// Vote found\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\n\t\t// If no previous vote was found via IP, we can still look at the cookie just to\n\t\t// determine whether the user already voted on this item. We won't we able to look up\n\t\t// the rating, though, so we set item[vote] to a boolean.\n\t\treturn $this->item['vote'] = isset( $this->cookie[ $this->item['id'] ] );\n\t}", "public function testDeleteOtherUserTaskSubmitAsUser()\n {\n $crawler = $this->requestAsUser('/tasks');\n\n // Can't use assertSelectorTextContains() because it only checks the first selector occurrence\n // and the task we are looking for is not the first one in the displayed list of tasks.\n // See: https://github.com/symfony/symfony-docs/issues/13036\n //$this->assertSelectorTextContains('h4 > a', 'Tâche Eric n°1');\n $this->assertGreaterThan(0, $crawler->filter('h4 > a:contains(\"Tâche Eric n°1\")')->count());\n\n // Then we try to delete it\n $task_id = self::getTaskIdByTitle('Tâche anonyme n°1');\n\n $this->client->request('GET', '/tasks/'.$task_id.'/delete', [], [], [\n 'PHP_AUTH_USER' => 'eric',\n 'PHP_AUTH_PW' => 'eric',\n ]);\n\n // When requesting this URL while being connected as user, we should be\n // redirected to the \"access denied\" page with the 403 status code.\n $this->assertEquals(403, $this->client->getResponse()->getStatusCode());\n $this->assertSelectorTextContains('h1', 'Accès non autorisé.');\n }", "public function save_votes() {\n\t\t\t$comment_id = absint( filter_input( INPUT_POST, 'comment_id', FILTER_SANITIZE_STRING ) );\n\t\t\t$vote_type = filter_input( INPUT_POST, 'vote_type', FILTER_SANITIZE_STRING );\n\t\t\t$user_id = $this->user_id;\n\t\t\t$users = get_comment_meta( $comment_id, 'votes', true );\n\t\t\t$vote_data = array();\n\t\t\t$vote_other = 'up' === $vote_type ? 'up' : 'down';\n\t\t\t$self_vote = $this->options['user-self-vote'];\n\n\t\t\t$comment_author_id = absint( get_comment( $comment_id, ARRAY_A )['user_id'] );\n\n\t\t\tif ( empty( $self_vote ) && $comment_author_id === $user_id ) {\n\t\t\t\twp_send_json_error(\n\t\t\t\t\tarray( esc_html( 'You cannot vote your own comment!' ) )\n\t\t\t\t);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( empty( $users ) ) {\n\t\t\t\t// The first vote.\n\t\t\t\t$vote_data = array( $user_id => $vote_type );\n\t\t\t\tif ( add_comment_meta( $comment_id, 'votes', $vote_data, true ) ) {\n\t\t\t\t\t$users_count = get_comment_meta( $comment_id, 'votes', true );\n\t\t\t\t\twp_send_json_success( array( 'count' => $this->count_votes( $users_count, $vote_type ) ) );\n\t\t\t\t} else {\n\t\t\t\t\twp_send_json_error();\n\t\t\t\t}\n\t\t\t} elseif ( isset( $users[ $user_id ] ) && $users[ $user_id ] === $vote_type ) {\n\t\t\t\t// Voting twice of the same type.\n\t\t\t\twp_send_json_error();\n\t\t\t} elseif ( isset( $users[ $user_id ] ) ) {\n\t\t\t\t// Switching votes.\n\t\t\t\t$users[ $user_id ] = $vote_other;\n\t\t\t\tif ( update_comment_meta( $comment_id, 'votes', $users ) ) {\n\t\t\t\t\twp_send_json_success(\n\t\t\t\t\t\tarray(\n\t\t\t\t\t\t\t'vote switched',\n\t\t\t\t\t\t\t$vote_type,\n\t\t\t\t\t\t\tarray(\n\t\t\t\t\t\t\t\t'count_up' => $this->count_votes( $users, 'up' ),\n\t\t\t\t\t\t\t\t'count_down' => $this->count_votes( $users, 'down' ),\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} else {\n\t\t\t\t\twp_send_json_error();\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// Add more votes.\n\t\t\t\t$users[ $user_id ] = $vote_type;\n\t\t\t\tif ( update_comment_meta( $comment_id, 'votes', $users ) ) {\n\t\t\t\t\t$users_count = get_comment_meta( $comment_id, 'votes', true );\n\t\t\t\t\twp_send_json_success( array( 'count' => $this->count_votes( $users_count, $vote_type ) ) );\n\t\t\t\t} else {\n\t\t\t\t\twp_send_json_error();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\twp_die();\n\t\t}", "public function update(User $user, Task $task)\n {\n if ($user->can('edit_own_tasks')) {\n return $user->id == $task->owner_id ||$user->id == $task->assignee_id;\n }\n }", "public function findVote(User $user, $id, $type)\n {\n \treturn Vote::where('user_id', '=', $user->id)->where('votable_id', '=', $id)->where('votable_type', $type)->first();\n }", "public function check_vote($qid, $userid) {\n\t\t$this->db->where('questionID', $qid);\n\t\t$this->db->where('userID', $userid);\n\t\t$this->db->from('QuestionVote');\n\t\t$query = $this->db->get();\n\t\treturn $query -> first_row();\n\t\t\n\t}", "public function edit(Vote $vote)\n {\n //\n }", "public function edit(Vote $vote)\n {\n //\n }", "public function vote(User $user, CommunityVote $communityVote): bool\n {\n $status = $communityVote->status();\n if ($status == CommunityVote::STATUS_PUBLISHED) {\n return true;\n } elseif ($status == CommunityVote::STATUS_VOTING) {\n return $user->isGoblinPatron();\n }\n\n // Not in a voting phase\n return false;\n }", "private function checkIfVoterVoted( $ipaddress, $attachment_id ) {\n global $wpdb;\n $query = \"select count(`id`) from \" . $wpdb->prefix . \"roni_votes where ip_address='\" . $ipaddress . \"' and attachment_id='\" . $attachment_id . \"';\";\n return $wpdb->get_var( $query );\n }", "public function cast_vote($vote, $num = 1)\r\n\t{\r\n\t\t$vote = min(1, max(0, (int) $vote));\r\n\r\n\t\tif( $vote )\r\n\t\t{\r\n\t\t\t// Add an \"up\" vote\r\n\t\t\t$this->votes_up += $num;\r\n\t\t\t$sql = 'votes_up = votes_up + '.$num;\r\n\t\t\t$vote_value = $num;\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t// Add a \"down\" vote\r\n\t\t\t$this->votes_down += $num;\r\n\t\t\t$sql = 'votes_down = votes_down + '.$num;\r\n\t\t\t$vote_value = \"-\".$num;\r\n\t\t}\r\n\r\n\t\t// Recalculate the vote results, no need to reload the item from database\r\n\t\t$this->calculate_votes();\r\n\r\n\t\t// Update the item record\r\n\t\t$sth = ThumbsUp::db()->Query(\"UPDATE `acp_servers` SET \".$sql.\" WHERE id = '{server}'\", array('server'=>$this->id));\r\n\r\n\t\t// The current user has just cast a vote\r\n\t\t$this->user_voted = TRUE;\r\n\t\tThumbsUp_Cookie::add_id($this->id);\r\n\r\n\t\t// Combine the storage of the IP and user id into one query for optimization\r\n\t\t$ip = ThumbsUp::get_ip();\r\n\t\t$user_id = ThumbsUp::get_user_id();\r\n\r\n\t\tif( $ip OR $user_id )\r\n\t\t{\r\n\t\t\t$sth = ThumbsUp::db()->Query(\"INSERT INTO `acp_servers_votes` (item_id, ip, user_id, value, vote_value, date) VALUES ('{item_id}', '{ip}', '{user_id}', '{value}', '{vote_value}', '{date}')\", array('item_id'=>$this->id,'ip'=>$ip,'user_id'=>$user_id,'value'=>$vote,'vote_value'=>$vote_value,'date'=>time()));\r\n\t\t}\r\n\t}", "public function testStaleVotes()\n {\n // create review to test with\n $review = new Review($this->p4);\n $review->setParticipants(array('foo', 'bar'))\n ->set('author', 'joe')\n ->save();\n\n // add several versions\n $review->setVersions(\n array(\n array('change' => 2, 'user' => 'joe', 'time' => 700, 'pending' => 1, 'difference' => 1),\n array('change' => 3, 'user' => 'joe', 'time' => 710, 'pending' => 1, 'difference' => 1),\n array('change' => 4, 'user' => 'joe', 'time' => 720, 'pending' => 1, 'difference' => 2),\n )\n )->save();\n\n // prepare connections for users 'foo', 'bar'\n $p4Foo = $this->connectWithAccess('foo', array('//...'));\n $p4Bar = $this->connectWithAccess('bar', array('//...'));\n $userFoo = User::fetch('foo', $this->p4);\n $userBar = User::fetch('bar', $this->p4);\n\n // test that voting without version applies to latest\n $services = $this->getApplication()->getServiceManager();\n $services->setService('p4_user', $p4Foo)\n ->setService('user', $userFoo);\n $this->getRequest()->setMethod('POST');\n $this->dispatch('/reviews/' . $review->getId() . '/vote/up');\n\n $votes = Review::fetch($review->getId(), $this->p4)->getVotes();\n $this->assertSame(1, count($votes));\n $this->assertSame(1, $votes['foo']['value']);\n $this->assertSame(3, $votes['foo']['version']);\n $this->assertSame(false, $votes['foo']['isStale']);\n\n // try voting on a particular version\n $this->resetApplication();\n $services = $this->getApplication()->getServiceManager();\n $services->setService('p4_user', $p4Foo)\n ->setService('user', $userFoo);\n $this->getRequest()->setMethod('POST')->setPost(new Parameters(array('version' => 2)));\n $this->dispatch('/reviews/' . $review->getId() . '/vote/up');\n\n $votes = Review::fetch($review->getId(), $this->p4)->getVotes();\n $this->assertSame(1, count($votes));\n $this->assertSame(1, $votes['foo']['value']);\n $this->assertSame(2, $votes['foo']['version']);\n $this->assertSame(false, $votes['foo']['isStale']);\n\n // vote as 'bar' on version 1 and verify its evaluated as stale vote\n $this->resetApplication();\n $services = $this->getApplication()->getServiceManager();\n $services->setService('p4_user', $p4Bar)\n ->setService('user', $userBar);\n $this->getRequest()->setMethod('POST')->setPost(new Parameters(array('version' => 1)));\n $this->dispatch('/reviews/' . $review->getId() . '/vote/down');\n\n $votes = Review::fetch($review->getId(), $this->p4)->getVotes();\n $this->assertSame(2, count($votes));\n $this->assertSame(1, $votes['foo']['value']);\n $this->assertSame(2, $votes['foo']['version']);\n $this->assertSame(false, $votes['foo']['isStale']);\n $this->assertSame(-1, $votes['bar']['value']);\n $this->assertSame(1, $votes['bar']['version']);\n $this->assertSame(true, $votes['bar']['isStale']);\n }", "public function hasAlreadyVoted(Motion $motion, User $user);", "public function getVoting($items, $vote ='') {\r\n $votstdy = $this->votstdyDb($items); // gets array with items voted by the user\r\n\r\n // if $vote not empty, perform to register the vote, $items contains one item to vote\r\n if(!empty($vote)) {\r\n // if $voter empty means user not loged\r\n if($this->voter ==='') return \"alert('Vote Not registered.\\\\nYou must be logged in to can vote')\";\r\n\r\n // if already voted, returns JSON from which JS alert message and will reload the page\r\n // else, accesses the method to add the new vote\r\n if(in_array($items[0], $votstdy) || ($this->nrvot ===1 && count($votstdy) >0)) return json_encode([$items[0]=>['v_plus'=>0, 'v_minus'=>0, 'voted'=>3]]);\r\n else $this->setVotDb($items, $vote, $votstdy); // add the new vote in mysql\r\n\r\n array_push($votstdy, $items[0]); // adds curent item as voted\r\n }\r\n\r\n // if $nrvot is 1, and $votstdy has item, set $setvoted=1 (user already voted today)\r\n // else, user can vote multiple items, after Select is checked if already voted the existend $item\r\n $setvoted = ($this->nrvot === 1 && count($votstdy) > 0) ? 1 : 0;\r\n\r\n // get array with items and their votings\r\n $votitems = $this->getVotDb($items, $votstdy, $setvoted);\r\n\r\n return json_encode($votitems);\r\n }" ]
[ "0.6972598", "0.66421616", "0.6599138", "0.64997345", "0.6449804", "0.63285184", "0.6216628", "0.6215391", "0.6147109", "0.6140684", "0.6095562", "0.608201", "0.60753894", "0.5879503", "0.58732784", "0.58609647", "0.585858", "0.57136554", "0.57036126", "0.5676789", "0.5676056", "0.56321377", "0.56059164", "0.56006587", "0.5582792", "0.5532203", "0.55272305", "0.5515221", "0.5506966", "0.5482977", "0.5468908", "0.54634404", "0.5457057", "0.5452769", "0.54521775", "0.54494196", "0.5434582", "0.54344183", "0.5430794", "0.542244", "0.54025215", "0.53704315", "0.5365047", "0.5344908", "0.532133", "0.5309173", "0.53081053", "0.53019714", "0.5295889", "0.52730566", "0.52695596", "0.52644867", "0.52611375", "0.52497655", "0.52488154", "0.52472425", "0.5244612", "0.52443737", "0.52343035", "0.52295256", "0.52211195", "0.52196753", "0.5211672", "0.51936585", "0.51909286", "0.5185614", "0.51839864", "0.5182194", "0.5177839", "0.5169366", "0.51687425", "0.5151353", "0.5141785", "0.5137659", "0.5112906", "0.51124716", "0.5104208", "0.50965744", "0.5094872", "0.50936884", "0.508915", "0.50761443", "0.5070484", "0.506387", "0.5062336", "0.50586575", "0.50457406", "0.5042835", "0.5039698", "0.50294", "0.50291026", "0.5028287", "0.5028144", "0.5028144", "0.50277656", "0.5024423", "0.5015022", "0.5012186", "0.50050163", "0.5000057" ]
0.60116357
13
/ xss stored1 easy level function is vulnerable
public function stored($level = null, $post = array()){ $level_name = 'easy'; if( $level == 'medium'): $level_name = 'medium'; /* merge lowwer and upper letters. Script,<scRIpt> or <scrscriptipt>*/ $substitutions = array( '<script>' => '', '</script>' => '', 'script' => '' ); foreach( $_POST as $key => $val): $post[$key] = str_replace( array_keys( $substitutions ), $substitutions, $val); endforeach; elseif($level == 'hard'): $level_name = 'hard'; /* <scrscriptipt> */ $substitutions = array( '<script>' => '', '</script>' => '', 'script' => '' ); foreach( $_POST as $key => $val): $post[$key] = str_replace( array_keys( $substitutions ), $substitutions, strtolower($val)); endforeach; elseif($level == 'super-hard'): $level_name = 'super-hard'; /* html inline events like <img src='x' onerror="alert()">*/ $substitutions = array( '<script>' => '', '</script>' => '', 'script' => '' ); foreach( $_POST as $key => $val): $val = preg_replace( '/<(.*)s(.*)c(.*)r(.*)i(.*)p(.*)t>/i', ' ', $val ); $post[$key] = str_replace( array_keys( $substitutions ), $substitutions, $val); endforeach; elseif($level == 'impossible'): $level_name = 'impossible'; $post = htmlspecialchars(INPUT_POST); $post = filter_input_array($post, FILTER_SANITIZE_STRING); else: /*easy level*/ $post = $_POST; endif; if(isset( $post['submit']) ): if( !isset( $post['fname'] ) || empty($post['fname']) || !isset( $post['lname'] ) || empty($post['lname']) || !isset( $post['age'] ) || empty($post['age']) ): Messages::setMsg('Empty fields detected', 'error'); else: $this->query(' INSERT INTO xss_stored (fname, lname, age, level) VALUES (:fname, :lname, :age, :level) '); $this->bind(':fname', $post['fname'] ); $this->bind(':lname', $post['lname'] ); $this->bind(':age', $post['age'] ); $this->bind(':level', $level_name ); $this->execute(); if( $this->lastInsertId() ): Messages::setMsg('New person added', ''); else: Messages::setMsg('Something happend', 'error'); endif; endif; endif; /* delete records */ if( isset($post['delete']) && isset($post['amount']) ): $this->query('DELETE FROM xss_stored WHERE level = :level ORDER BY id DESC LIMIT :lm'); $this->bind(':lm', (int)$post['amount']); $this->bind(':level', $level_name); $this->execute(); Messages::setMsg('Yay, Deleted last '.$post['amount'].' record(s)'); endif; /* Delete record by id */ if( isset($post['delete']) && isset($post['id']) ): $this->query('DELETE FROM xss_stored WHERE id = :id AND level = :level'); $this->bind(':id', (int)$post['id']); $this->bind(':level', $level_name); $this->execute(); Messages::setMsg('Yay, you just deleted one record!'); endif; /* return data from db */ $this->query("SELECT * FROM xss_stored WHERE level = :level"); $this->bind(':level', $level_name); $this->execute(); return [ 'result' => $this->resultSet(), 'level' => (new Progress($level))->level()]; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private function _protectionFunctions()\n\t{\n\t\tglobal $MySmartBB;\n\t\t\n\t\t// ... //\n\t\t\n\t\t// Preventing XSS and SQL Injection's keywords from the GET request\n \tforeach ( $MySmartBB->_GET as $get )\n \t{\n \t\t\tif ( (preg_match(\"/\\<[^\\>]*script*\\\"?[^\\>]*\\>/\", $get)) or\n \t\t\t(preg_match(\"/\\<[^\\>]*object*\\\"?[^\\>]*\\>/\", $get)) or\n \t\t\t(preg_match(\"/\\<[^\\>]*iframe*\\\"?[^\\>]*\\>/\", $get)) or\n \t\t\t(preg_match(\"/\\<[^\\>]*applet*\\\"?[^\\>]*\\>/\", $get)) or\n \t\t\t(preg_match(\"/\\<[^\\>]*meta*\\\"?[^\\>]*\\>/\", $get)) or\n \t\t\t(preg_match(\"/\\<[^\\>]*style*\\\"?[^\\>]*\\>/\", $get)) or\n \t\t\t(preg_match(\"/\\<[^\\>]*form*\\\"?[^\\>]*\\>/\", $get)) or\n \t\t\t(preg_match(\"/\\<[^\\>]*img*\\\"?[^\\>]*\\>/\", $get)) or\n \t\t\t(preg_match(\"/select/\", $get)) or\n \t\t\t(preg_match(\"/union/\", $get)) or\n \t\t\t(preg_match(\"/--/\", $get)) )\n {\n \t\t\tdie( 'Forbidden Action' );\n \t\t\t}\n \t\t}\n \t\t \t\t\n \t\t// ... //\n \t\t\n \t\t// Stop any external post request.\n \t\t// At least prevent novice crackers.\n \t\tif ( $MySmartBB->_SERVER['REQUEST_METHOD'] == 'POST' )\n \t{\n \t\t// ... //\n \t\t\n \t\t\t$from = explode( '/', $MySmartBB->_SERVER[ 'HTTP_REFERER' ] );\n \t\t\t$host = explode( '/', $MySmartBB->_SERVER[ 'HTTP_HOST' ] );\n\n \t\t\t// ... //\n \t\t\t\n \t\t\tif ( $from[ 2 ] != $host[ 0 ] )\n \t\t\t\tdie( 'Forbidden Action' );\n \t\t\t\n \t\t\t// ... //\n \t\t}\n \t\t\n \t\t// ... //\n\t}", "function xss_clean($str, $is_image = FALSE)\n{ \n $security =& load_class('Security','core');\n return $security->xss_clean($str, $is_image);\n}", "function xssafe($data, $encoding = 'UTF-8')\n{\n //return htmlspecialchars($data,ENT_QUOTES | ENT_HTML401,$encoding);\n return htmlspecialchars($data);\n}", "function protect1($protected) {\n\t$banlist = array (\"'\", \"\\\"\", \"<\", \"\\\\\", \"|\", \"/\", \"=\", \"insert\", \"select\", \"update\", \"delete\", \"distinct\", \"having\", \"truncate\", \"replace\", \"handler\", \"like\", \"procedure\", \"limit\", \"order by\", \"group by\", \"asc\", \"desc\"); \n\t//$banlist is the list of words you dont want to allow.\n\tif ( eregi ( \"[a-zA-Z0-9@]+\", $protected ) ) { // Makes sure only legitimate Characters are used.\n\t\t$protected = trim(str_replace($banlist, '', $protected)); // Takes out whitespace, and removes any banned words.\n\t\treturn $protected;\n\t\t//echo \"+\";\n\t} else {\n\t\t//echo \"-\";\n\t\techo $protected;\n\t\tdie ( ' Is invalid for that spot, please try a different entry.' ); // Message if thier is any characters not in [a-zA-Z0-9].\n\t} // ends the if ( eregi ( \"[a-zA-Z0-9]+\", $this->protected ) ) {\n}", "public function protect() {\n\t}", "function secure_input($data) {\r\n $data = trim($data);\r\n $data = stripslashes($data);\r\n $data = htmlspecialchars($data);\r\n // tbd mysql_real_escape_string\r\n return $data;\r\n}", "function protection_code_activation() {\n\t\n\t}", "public function remove_xss($val) {\n // this prevents some character re-spacing such as <java\\0script>\n // note that you have to handle splits with \\n, \\r, and \\t later since they *are* allowed in some inputs\n $val = preg_replace('/([\\x00-\\x08,\\x0b-\\x0c,\\x0e-\\x19])/', '', $val);\n\n // straight replacements, the user should never need these since they're normal characters\n // this prevents like <IMG SRC=@avascript:alert('XSS')>\n $search = 'abcdefghijklmnopqrstuvwxyz';\n $search .= 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';\n $search .= '1234567890!@#$%^&*()';\n $search .= '~`\";:?+/={}[]-_|\\'\\\\';\n for ($i = 0; $i < strlen($search); $i++) {\n // ;? matches the ;, which is optional\n // 0{0,7} matches any padded zeros, which are optional and go up to 8 chars\n\n // @ @ search for the hex values\n $val = preg_replace('/(&#[xX]0{0,8}'.dechex(ord($search[$i])).';?)/i', $search[$i], $val); // with a ;\n // @ @ 0{0,7} matches '0' zero to seven times\n $val = preg_replace('/(&#0{0,8}'.ord($search[$i]).';?)/', $search[$i], $val); // with a ;\n }\n\n // now the only remaining whitespace attacks are \\t, \\n, and \\r\n $ra1 = array('javascript', 'vbscript', 'expression', 'applet', 'meta', 'xml', 'blink', 'link', 'style', 'script', 'embed', 'object', 'iframe', 'frame', 'frameset', 'ilayer', 'layer', 'bgsound', 'title', 'base');\n $ra2 = array('onabort', 'onactivate', 'onafterprint', 'onafterupdate', 'onbeforeactivate', 'onbeforecopy', 'onbeforecut', 'onbeforedeactivate', 'onbeforeeditfocus', 'onbeforepaste', 'onbeforeprint', 'onbeforeunload', 'onbeforeupdate', 'onblur', 'onbounce', 'oncellchange', 'onchange', 'onclick', 'oncontextmenu', 'oncontrolselect', 'oncopy', 'oncut', 'ondataavailable', 'ondatasetchanged', 'ondatasetcomplete', 'ondblclick', 'ondeactivate', 'ondrag', 'ondragend', 'ondragenter', 'ondragleave', 'ondragover', 'ondragstart', 'ondrop', 'onerror', 'onerrorupdate', 'onfilterchange', 'onfinish', 'onfocus', 'onfocusin', 'onfocusout', 'onhelp', 'onkeydown', 'onkeypress', 'onkeyup', 'onlayoutcomplete', 'onload', 'onlosecapture', 'onmousedown', 'onmouseenter', 'onmouseleave', 'onmousemove', 'onmouseout', 'onmouseover', 'onmouseup', 'onmousewheel', 'onmove', 'onmoveend', 'onmovestart', 'onpaste', 'onpropertychange', 'onreadystatechange', 'onreset', 'onresize', 'onresizeend', 'onresizestart', 'onrowenter', 'onrowexit', 'onrowsdelete', 'onrowsinserted', 'onscroll', 'onselect', 'onselectionchange', 'onselectstart', 'onstart', 'onstop', 'onsubmit', 'onunload');\n $ra = array_merge($ra1, $ra2);\n\n $found = true; // keep replacing as long as the previous round replaced something\n while ($found == true) {\n $val_before = $val;\n for ($i = 0; $i < sizeof($ra); $i++) {\n $pattern = '/';\n for ($j = 0; $j < strlen($ra[$i]); $j++) {\n if ($j > 0) {\n $pattern .= '(';\n $pattern .= '(&#[xX]0{0,8}([9ab]);)';\n $pattern .= '|';\n $pattern .= '|(&#0{0,8}([9|10|13]);)';\n $pattern .= ')*';\n }\n $pattern .= $ra[$i][$j];\n }\n $pattern .= '/i';\n $replacement = substr($ra[$i], 0, 2).'<x>'.substr($ra[$i], 2); // add in <> to nerf the tag\n $val = preg_replace($pattern, $replacement, $val); // filter out the hex tags\n if ($val_before == $val) {\n // no replacements were made, so exit the loop\n $found = false;\n }\n }\n }\n return $val;\n }", "function xss_clean_data($string)\n{\n $CI = & get_instance();\n $return = $CI->security->xss_clean($string);\n return $return;\n}", "function sqlInjections($data){\n\t$value1=mysqli_real_escape_string($GLOBALS['link'],$data);\n\t$value1=trim($value1);\n\treturn $value1;\n\t}", "function fsl_scrub($string){\n \n $xss = new xss_filter();\n $string = $xss->filter_it($string); \n return $string;\n}", "function secureGET(&$value, $key)\r\n\t{\r\n\t\t$_GET[$key] = htmlspecialchars(stripslashes($_GET[$key]));\r\n\t\t$_GET[$key] = str_ireplace(\"<script\", \"<-s-c-r-i-p-t\", $_GET[$key]);\r\n\t\t$_GET[$key] = mysql_escape_string($_GET[$key]);\r\n\t\treturn $_GET[$key];\r\n\t}", "function yy_r107(){if (!$this->template->security || $this->smarty->security_handler->isTrustedPhpFunction($this->yystack[$this->yyidx + -3]->minor, $this->compiler)) {\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t if ($this->yystack[$this->yyidx + -3]->minor == 'isset' || $this->yystack[$this->yyidx + -3]->minor == 'empty' || $this->yystack[$this->yyidx + -3]->minor == 'array' || is_callable($this->yystack[$this->yyidx + -3]->minor)) {\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t $this->_retvalue = $this->yystack[$this->yyidx + -3]->minor . \"(\". $this->yystack[$this->yyidx + -1]->minor .\")\";\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t } else {\r\n $this->compiler->trigger_template_error (\"unknown function \\\"\" . $this->yystack[$this->yyidx + -3]->minor . \"\\\"\");\r\n }\r\n } }", "function remove_xss($val) {\n // this prevents some character re-spacing such as <java\\0script>\n // note that you have to handle splits with \\n, \\r, and \\t later since they *are* allowed in some inputs\n $val = preg_replace('/([\\x00-\\x08,\\x0b-\\x0c,\\x0e-\\x19])/', '', $val);\n\n // straight replacements, the user should never need these since they're normal characters\n // this prevents like <IMG SRC=@avascript:alert('XSS')>\n $search = 'abcdefghijklmnopqrstuvwxyz';\n $search .= 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';\n $search .= '1234567890!@#$%^&*()';\n $search .= '~`\";:?+/={}[]-_|\\'\\\\';\n for ($i = 0; $i < strlen($search); $i++) {\n // ;? matches the ;, which is optional\n // 0{0,7} matches any padded zeros, which are optional and go up to 8 chars\n\n // @ @ search for the hex values\n $val = preg_replace('/(&#[xX]0{0,8}'.dechex(ord($search[$i])).';?)/i', $search[$i], $val); // with a ;\n // @ @ 0{0,7} matches '0' zero to seven times\n $val = preg_replace('/(&#0{0,8}'.ord($search[$i]).';?)/', $search[$i], $val); // with a ;\n }\n\n // now the only remaining whitespace attacks are \\t, \\n, and \\r\n $ra1 = array('javascript', 'vbscript', 'expression', 'applet', 'meta', 'xml', 'blink', 'link', 'style', 'script', 'embed', 'object', 'iframe', 'frame', 'frameset', 'ilayer', 'layer', 'bgsound', 'title', 'base');\n $ra2 = array('onabort', 'onactivate', 'onafterprint', 'onafterupdate', 'onbeforeactivate', 'onbeforecopy', 'onbeforecut', 'onbeforedeactivate', 'onbeforeeditfocus', 'onbeforepaste', 'onbeforeprint', 'onbeforeunload', 'onbeforeupdate', 'onblur', 'onbounce', 'oncellchange', 'onchange', 'onclick', 'oncontextmenu', 'oncontrolselect', 'oncopy', 'oncut', 'ondataavailable', 'ondatasetchanged', 'ondatasetcomplete', 'ondblclick', 'ondeactivate', 'ondrag', 'ondragend', 'ondragenter', 'ondragleave', 'ondragover', 'ondragstart', 'ondrop', 'onerror', 'onerrorupdate', 'onfilterchange', 'onfinish', 'onfocus', 'onfocusin', 'onfocusout', 'onhelp', 'onkeydown', 'onkeypress', 'onkeyup', 'onlayoutcomplete', 'onload', 'onlosecapture', 'onmousedown', 'onmouseenter', 'onmouseleave', 'onmousemove', 'onmouseout', 'onmouseover', 'onmouseup', 'onmousewheel', 'onmove', 'onmoveend', 'onmovestart', 'onpaste', 'onpropertychange', 'onreadystatechange', 'onreset', 'onresize', 'onresizeend', 'onresizestart', 'onrowenter', 'onrowexit', 'onrowsdelete', 'onrowsinserted', 'onscroll', 'onselect', 'onselectionchange', 'onselectstart', 'onstart', 'onstop', 'onsubmit', 'onunload');\n $ra = array_merge($ra1, $ra2);\n\n $found = true; // keep replacing as long as the previous round replaced something\n while ($found == true) {\n $val_before = $val;\n for ($i = 0; $i < sizeof($ra); $i++) {\n $pattern = '/';\n for ($j = 0; $j < strlen($ra[$i]); $j++) {\n if ($j > 0) {\n $pattern .= '(';\n $pattern .= '(&#[xX]0{0,8}([9ab]);)';\n $pattern .= '|';\n $pattern .= '|(&#0{0,8}([9|10|13]);)';\n $pattern .= ')*';\n }\n $pattern .= $ra[$i][$j];\n }\n $pattern .= '/i';\n $replacement = substr($ra[$i], 0, 2).'<x>'.substr($ra[$i], 2); // add in <> to nerf the tag\n $val = preg_replace($pattern, $replacement, $val); // filter out the hex tags\n if ($val_before == $val) {\n // no replacements were made, so exit the loop\n $found = false;\n }\n }\n }\n return $val;\n}", "function remove_xss($val) {\n // this prevents some character re-spacing such as <java\\0script>\n // note that you have to handle splits with \\n, \\r, and \\t later since they *are* allowed in some inputs\n $val = preg_replace('/([\\x00-\\x08,\\x0b-\\x0c,\\x0e-\\x19])/', '', $val);\n\n // straight replacements, the user should never need these since they're normal characters\n // this prevents like <IMG SRC=@avascript:alert('XSS')>\n $search = 'abcdefghijklmnopqrstuvwxyz';\n $search .= 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';\n $search .= '1234567890!@#$%^&*()';\n $search .= '~`\";:?+/={}[]-_|\\'\\\\';\n for ($i = 0; $i < strlen($search); $i++) {\n // ;? matches the ;, which is optional\n // 0{0,7} matches any padded zeros, which are optional and go up to 8 chars\n // @ @ search for the hex values\n $val = preg_replace('/(&#[xX]0{0,8}'.dechex(ord($search[$i])).';?)/i', $search[$i], $val); // with a ;\n // @ @ 0{0,7} matches '0' zero to seven times\n $val = preg_replace('/(&#0{0,8}'.ord($search[$i]).';?)/', $search[$i], $val); // with a ;\n }\n\n // now the only remaining whitespace attacks are \\t, \\n, and \\r\n $ra1 = array('javascript', 'vbscript', 'expression', 'applet', 'meta', 'xml', 'blink', 'link', 'style', 'script', 'embed', 'object', 'iframe', 'frame', 'frameset', 'ilayer', 'layer', 'bgsound', 'title', 'base');\n $ra2 = array('onabort', 'onactivate', 'onafterprint', 'onafterupdate', 'onbeforeactivate', 'onbeforecopy', 'onbeforecut', 'onbeforedeactivate', 'onbeforeeditfocus', 'onbeforepaste', 'onbeforeprint', 'onbeforeunload', 'onbeforeupdate', 'onblur', 'onbounce', 'oncellchange', 'onchange', 'onclick', 'oncontextmenu', 'oncontrolselect', 'oncopy', 'oncut', 'ondataavailable', 'ondatasetchanged', 'ondatasetcomplete', 'ondblclick', 'ondeactivate', 'ondrag', 'ondragend', 'ondragenter', 'ondragleave', 'ondragover', 'ondragstart', 'ondrop', 'onerror', 'onerrorupdate', 'onfilterchange', 'onfinish', 'onfocus', 'onfocusin', 'onfocusout', 'onhelp', 'onkeydown', 'onkeypress', 'onkeyup', 'onlayoutcomplete', 'onload', 'onlosecapture', 'onmousedown', 'onmouseenter', 'onmouseleave', 'onmousemove', 'onmouseout', 'onmouseover', 'onmouseup', 'onmousewheel', 'onmove', 'onmoveend', 'onmovestart', 'onpaste', 'onpropertychange', 'onreadystatechange', 'onreset', 'onresize', 'onresizeend', 'onresizestart', 'onrowenter', 'onrowexit', 'onrowsdelete', 'onrowsinserted', 'onscroll', 'onselect', 'onselectionchange', 'onselectstart', 'onstart', 'onstop', 'onsubmit', 'onunload');\n $ra = array_merge($ra1, $ra2);\n\n $found = true; // keep replacing as long as the previous round replaced something\n while ($found == true) {\n $val_before = $val;\n for ($i = 0; $i < sizeof($ra); $i++) {\n $pattern = '/';\n for ($j = 0; $j < strlen($ra[$i]); $j++) {\n if ($j > 0) {\n $pattern .= '(';\n $pattern .= '(&#[xX]0{0,8}([9ab]);)';\n $pattern .= '|';\n $pattern .= '|(&#0{0,8}([9|10|13]);)';\n $pattern .= ')*';\n }\n $pattern .= $ra[$i][$j];\n }\n $pattern .= '/i';\n $replacement = substr($ra[$i], 0, 2).'<x>'.substr($ra[$i], 2); // add in <> to nerf the tag\n $val = preg_replace($pattern, $replacement, $val); // filter out the hex tags\n if ($val_before == $val) {\n // no replacements were made, so exit the loop\n $found = false;\n }\n }\n }\n return $val;\n}", "abstract protected function safetyCheck() : self;", "function security($input)\n{\n $input = mysql_real_escape_string($input);\n $input = strip_tags($input);\n $input = stripslashes($input);\n return $input;\n}", "public static function right_public(){return false;}", "protected function sanitize() {}", "function db_get_secure($tpl_name, &$smarty_obj) {\n return true;\n}", "function chksecurity($page,$type=0,$redirect=0){\n $checkAll\t = false;\n $Secure\t = false;\n $obj_kind\t = $type;\n $operator\t = getUser();\n $otherRight = \"\";\n switch($type){\n\tcase 0://SYSTEM CHECK\n\t\t$objectParam=0;\n\tbreak;\n\tcase 1:// GROUP CHECK\n\t\t$objectParam=get_param(\"group\");\n\tbreak;\n\tcase 2:// SHOP CHECK\n\t\t$objectParam=get_param(\"group\").\";\".get_param(\"shop\");\n\tbreak;\n\tcase 3:// TERMINAL CHECK\n\t\t$objectParam=get_param(\"group\").\";\".get_param(\"shop\").\";\".get_param(\"term\");\n //$otherRight=\"_term\";\n\tbreak;\n\tcase 99: //CHECK IN ALL OPERATOR'S RIGHTS.\n\t\t$checkAll=true;\n\tbreak;\n }\n $pageRight =get_db_value(\"select mask from webpages where name='$page'\");\n if(!$checkAll){\n\t//take Operator's rights.\n\t$operRights=get_db_value(\"select rights$otherRight from obj_rights where op_kind=0 and obj_kind=$obj_kind and operator='$operator' and object='$objectParam;'\");\n\t//take page's security\n\tif (( (abs($pageRight) & abs($operRights)) == abs($pageRight))&& (!($pageRight==\"\")))\n\t\t$Secure=true;\n }//IF ! CHECK ALL\n else{ // -=check all=-\n\t $Secure=(get_db_value(\"select count(*) from obj_rights where operator='$operator' and (rights$otherRight|'$pageRight') = rights$otherRight\" )>0);\n\t }//end else check all\nif ($Secure&&(strlen($pageRight)))\n\treturn true;\nelse\n if ($redirect)\n \t header(\"Location: norights.php\");\n else\n return false;\n\n\n}", "public function checkSecurity() {\n }", "function securePOST(&$value, $key)\r\n\t{\r\n\t\t$_POST[$key] = htmlspecialchars(stripslashes($_POST[$key]));\r\n\t\t$_POST[$key] = str_ireplace(\"<script\", \"<-s-c-r-i-p-t\", $_POST[$key]);\r\n\t\t$_POST[$key] = mysql_escape_string($_POST[$key]);\r\n\t\treturn $_POST[$key];\r\n\t}", "function secure_input($data) {\n // strip unnecessary chars (extra space, tab, newline, etc)\n $data = trim($data);\n // remove backslashes (\\)\n $data = stripslashes($data);\n // save as HTML escaped code --> any scripts in input data will not run\n $data = htmlspecialchars($data);\n return $data;\n}", "function rehtmlspecialchars($arg){\n\t//$arg = str_replace(\"\", \"<\", $arg);\n\t//$arg = str_replace(\" \", \"_\", $arg);\n\t$arg = str_replace(\"/\", \"\", $arg);\n\t$arg = str_replace(\"&\", \"\", $arg);\n\t$arg = str_replace(\"'\", \"\", $arg);\n\t$arg = str_replace(\"#\", \"\", $arg);\n\t$arg = str_replace(\"(\", \"\", $arg);\n\t$arg = str_replace(\")\", \"-\", $arg);\n\t$arg = str_replace(\".\", \"\", $arg);\n\t\n\treturn $arg;\n\t}", "function protect($login_url='',$isAdmin=false,$userGroupXX=false,$prg_group=''){\n $this->host=$_SERVER['HTTP_HOST'];\n if (strlen($_SERVER['REQUEST_URI']) > 255 || \n\tstrpos($_SERVER['REQUEST_URI'], \"eval(\") || \n strpos($_SERVER['REQUEST_URI'], \"md5(\") || \n\tstrpos($_SERVER['REQUEST_URI'], \"base64\")) {\n\t\t@header(\"HTTP/1.1 414 Request-URI Too Long\");\n\t\t@header(\"Status: 414 Request-URI Too Long\");\n\t\t@header(\"Connection: Close\");\n\t\t@exit;\n } \n\n include(\"adminpro_config.php\");\n $this->accNoCookies=$globalConfig['acceptNoCookies'];\n $this->tbl=$globalConfig['tbl'];\n $this->tblID=$globalConfig['tblID'];\n $this->tblUserName=$globalConfig['tblUserName'];\n $this->tblUserPass=$globalConfig['tblUserPass'];\n $this->tblIsAdmin=$globalConfig['tblIsAdmin'];\n $this->tblUserGroup=$globalConfig['tblUserGroup'];\n $this->tblSessionID=$globalConfig['tblSessionID'];\n $this->tblLastLog=$globalConfig['tblLastLog'];\n $this->tblUserRemark=$globalConfig['tblUserRemark'];\n $this->inactiveMin=$globalConfig['inactiveMin']; // Max Inactivtity in Minute\n $this->prg_group=$prg_group;\n if ($this->prg_group==\"iphone\" || $this->prg_group==\"android\") {\n $this->is_app=true;\n }\n if ( $login_url=='' || strlen($login_url) < 5) {\n $this->loginUrl=$globalConfig['loginUrl'];\n } else {\n $this->loginUrl=trim($login_url);\n }\n $this->enblRemember=$globalConfig['enblRemember'];\n $this->cookieRemName=$globalConfig['cookieRemName'];\n $this->cookieRemPass=$globalConfig['cookieRemPass'];\n $this->cookieExpDays=$globalConfig['cookieExpDays'];\n $this->isMd5=$globalConfig['isMd5'];\n $this->errorPageTitle=$globalConfig['errorPageTitle'];\n $this->errorPageH1=$globalConfig['errorPageH1'];\n $this->errorPageLink=$globalConfig['errorPageLink'];\n $this->errorNoCookies=$globalConfig['errorNoCookies'];\n $this->errorNoLogin=$globalConfig['errorNoLogin'];\n $this->errorInvalid=$globalConfig['errorInvalid'];\n $this->errorDelay=$globalConfig['errorDelay'];\n $this->errorNoAdmin=$globalConfig['errorNoAdmin'];\n $this->errorNoGroup=$globalConfig['errorNoGroup'];\n $this->errorCssUrl=$globalConfig['errorCssUrl'];\n $this->errorCharset=$globalConfig['errorCharset'];\n $this->block_access=$globalConfig['block_access'];\n $this->ip_addr=$globalConfig['ip_addr'];\n @session_start();\n $db = new DB(\"XXUser\",\"password\",DB_NAME);\n $db->connect();\n $this->checkSession($db); // --> checkRemember -> checkPost -> checkLogin\n $db->disconnect();\n}", "static function removeXss($val) {\n\t\t// this prevents some character re-spacing such as <java\\0script>\n\t\t// note that you have to handle splits with \\n, \\r, and \\t later since they *are* allowed in some inputs\n\t\t$val = preg_replace('/([\\x00-\\x08,\\x0b-\\x0c,\\x0e-\\x19])/', '', $val);\n\n\t\t// straight replacements, the user should never need these since they're normal characters\n\t\t// this prevents like <IMG SRC=@avascript:alert('XSS')>\n\t\t$search = 'abcdefghijklmnopqrstuvwxyz';\n\t\t$search .= 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';\n\t\t$search .= '1234567890!@#$%^&*()';\n\t\t$search .= '~`\";:?+/={}[]-_|\\'\\\\';\n\t\tfor ($i = 0; $i < strlen($search); $i++) {\n\t\t // ;? matches the ;, which is optional\n\t\t // 0{0,7} matches any padded zeros, which are optional and go up to 8 chars\n\n\t\t // @ @ search for the hex values\n\t\t $val = preg_replace('/(&#[xX]0{0,8}'.dechex(ord($search[$i])).';?)/i', $search[$i], $val); // with a ;\n\t\t // @ @ 0{0,7} matches '0' zero to seven times\n\t\t $val = preg_replace('/(&#0{0,8}'.ord($search[$i]).';?)/', $search[$i], $val); // with a ;\n\t\t}\n\n\t\t// now the only remaining whitespace attacks are \\t, \\n, and \\r\n\t\t$ra1 = array('javascript', 'vbscript', 'expression', 'applet', 'meta', 'xml', 'blink', 'link', 'style', 'script', 'embed', 'object', 'iframe', 'frame', 'frameset', 'ilayer', 'layer', 'bgsound', 'title', 'base');\n\t\t$ra2 = array('onabort', 'onactivate', 'onafterprint', 'onafterupdate', 'onbeforeactivate', 'onbeforecopy', 'onbeforecut', 'onbeforedeactivate', 'onbeforeeditfocus', 'onbeforepaste', 'onbeforeprint', 'onbeforeunload', 'onbeforeupdate', 'onblur', 'onbounce', 'oncellchange', 'onchange', 'onclick', 'oncontextmenu', 'oncontrolselect', 'oncopy', 'oncut', 'ondataavailable', 'ondatasetchanged', 'ondatasetcomplete', 'ondblclick', 'ondeactivate', 'ondrag', 'ondragend', 'ondragenter', 'ondragleave', 'ondragover', 'ondragstart', 'ondrop', 'onerror', 'onerrorupdate', 'onfilterchange', 'onfinish', 'onfocus', 'onfocusin', 'onfocusout', 'onhelp', 'onkeydown', 'onkeypress', 'onkeyup', 'onlayoutcomplete', 'onload', 'onlosecapture', 'onmousedown', 'onmouseenter', 'onmouseleave', 'onmousemove', 'onmouseout', 'onmouseover', 'onmouseup', 'onmousewheel', 'onmove', 'onmoveend', 'onmovestart', 'onpaste', 'onpropertychange', 'onreadystatechange', 'onreset', 'onresize', 'onresizeend', 'onresizestart', 'onrowenter', 'onrowexit', 'onrowsdelete', 'onrowsinserted', 'onscroll', 'onselect', 'onselectionchange', 'onselectstart', 'onstart', 'onstop', 'onsubmit', 'onunload');\n\t\t$ra = array_merge($ra1, $ra2);\n\n\t\t$found = true; // keep replacing as long as the previous round replaced something\n\t\twhile ($found == true) {\n\t\t $val_before = $val;\n\t\t for ($i = 0; $i < sizeof($ra); $i++) {\n\t\t $pattern = '/';\n\t\t for ($j = 0; $j < strlen($ra[$i]); $j++) {\n\t\t if ($j > 0) {\n\t\t $pattern .= '(';\n\t\t $pattern .= '(&#[xX]0{0,8}([9ab]);)';\n\t\t $pattern .= '|';\n\t\t $pattern .= '|(&#0{0,8}([9|10|13]);)';\n\t\t $pattern .= ')*';\n\t\t }\n\t\t $pattern .= $ra[$i][$j];\n\t\t }\n\t\t $pattern .= '/i';\n\t\t $replacement = substr($ra[$i], 0, 2).'<x>'.substr($ra[$i], 2); // add in <> to nerf the tag\n\t\t $val = preg_replace($pattern, $replacement, $val); // filter out the hex tags\n\t\t if ($val_before == $val) {\n\t\t // no replacements were made, so exit the loop\n\t\t $found = false;\n\t\t }\n\t\t }\n\t\t}\n\t\treturn $val;\n\t}", "public function executeSecure()\n {\n }", "public function sanitize() {\n }", "public function __sanitise() { $this->username = filter_input(INPUT_POST, 'username', FILTER_SANITIZE_SPECIAL_CHARS);\n $this->password = filter_input(INPUT_POST, 'password', FILTER_SANITIZE_STRING);\n $hashed_password = password_hash($password, PASSWORD_BCRYPT);\n $this->email = filter_input(INPUT_POST, 'email', FILTER_SANITIZE_SPECIAL_CHARS);\n $this->usertype = filter_input(INPUT_POST, 'lib_code', FILTER_SANITIZE_SPECIAL_CHARS);\n }", "function secure_input($data) {\n $data = trim($data);\n // remove backslashes (\\)\n $data = stripslashes($data);\n // save as HTML escaped code --> any scripts in input data will not run\n $data = htmlspecialchars($data);\n return $data;\n }", "function protection($string)\n{\n return htmlentities($string, ENT_QUOTES, 'UTF-8');\n}", "function test_xss_attack(){\n $xssAttack = \"<script>alert('Malicious 35!')</script>\";\n\n // verificamos el contenido en formato de markdown con `` para convertirlo en texto escapado\n // sino las quitamos y colocamos {!! Markdown::convertToHtml(e($post->content)) !!} \"e()\"\n $comment = $this->createComment([\n 'comment' => \"$xssAttack. Texto normal.\"\n ]);\n\n $this->xss_attack($this, $comment->post->url, $xssAttack);\n }", "function checkxpathSecure($vulnChkLine,$xPathson)\n{\n $vuln=0;\n $vuln1=0;\n include'vulnWordlist.php';\n include 'checkWordlists.php';\n $listCount=count($xssSecureVuln);\n $varCount=count($vulnChkLine);\n $fileList=count($fileInputValues);\n \n for($i=0;$i<$varCount;$i++)\n {\n for($j=0;$j<$listCount;$j++)\n {\n \n if(strlen($vulnChkLine[$i])>1)\n {\n \n if(strcmp($vulnChkLine[$i],$xssSecureVuln[$j])==0)\n {\n echo \"<p class='card-text'>This Line is <green>Secure</green> with \".$vulnChkLine[$i].\"</p>\";\n \n $xPathson->Secure=\"This Line is Secure with \".$vulnChkLine[$i].\" \";\n \n $_SESSION['Secured']++;\n $vuln=1;\n break;\n }\n }\n \n }\n }\n if($vuln==0)\n {\n echo \"<p class='card-text'>No Securing functions Found</p>\";\n \n $xPathson->Functions=\" No Securing functions Found\";\n \n echo \"<p class='card-text'>This line is <red> Vulnerable </red>. It doesn't <red>no</red>t have <red>Securing</red> Functions</p>\";\n \n $xPathson->SinksInfo=\"This line is Vulnerable . It doesn't not have Securing Functions\";\n \n \n $GLOBALS['noxPathVulLines']++;\n }\n \n //Checking the File input Strings (sinks)\n \n\n \n for($i=0;$i<$varCount;$i++)\n {\n for($j=0;$j<$fileList;$j++)\n {\n \n if(strlen($vulnChkLine[$i])>1)\n {\n \n if(strcmp($vulnChkLine[$i],$fileInputValues[$j])==0)\n {\n \n echo \"<p class='card-text'>This Line is <green>Secure</green> with \".$vulnChkLine[$i].\"</p>\";\n \n $xPathson->fileSecure=\"This Line is Secure with \".$vulnChkLine[$i].\" \";\n $_SESSION['Secured']++;\n $vuln1=1; \n break;\n }\n }\n \n }\n }\n if($vuln1==0)\n {\n echo \"<p class='card-text'>No Securing functions Found</p>\";\n \n $xPathson->fileFunctions=\" No Securing functions Found\";\n \n echo \"<p class='card-text'>This line is <red> Vulnerable </red>. It doesn't <red>no</red>t have <red>Securing</red> Functions</p>\";\n \n $xPathson->fileSinksInfo=\"This line is Vulnerable . It doesn't not have Securing Functions\";\n \n $GLOBALS['noxPathVulLines']++;\n }\n \n \n}", "function system_mod_user($paramvect)\n{\n\n}", "function db_security($conn, $string) {\n if(ctype_digit($string))\n $string = intval($string);\n else {\n /*mysql_real_escape_string — Protège une commande SQL de la présence de caractères spéciaux*/\n $string = mysqli_real_escape_string($conn, $string);\n $string = addcslashes($string, '%_');\n }\n return ($string);\n }", "function CheckSecureValue()\n{\n\n\tif(isset($_REQUEST['secvalue']) === false)\n\t{\n\t\techo '<fail>Sec value dont match</fail>';\n\t\texit();\n\t}\n\n\t$sSecValue = '';\n\t$sSecValue = trim($_REQUEST['secvalue']);\n\tif(strcmp($sSecValue, __SEC_VALUE__) != 0)\n\t{\n\t\techo '<fail>Sec value dont match</fail>';\n\t\texit();\n\t}\n}", "static function denied()\n {\n\n }", "function auth_apply_sql_security($db, $str_sql_query)\r\r\n{\r\r\n // Implemented views are:\r\r\n // @FUNCTION_SECURITY@\r\r\n // @MENU_ITEM_SECURITY@\r\r\n // @RES_SECURITY@\r\r\n // @ARTICLE_FOLDER_SECURITY@\r\r\n // @MODULE_SECURITY@\r\r\n // @FEED_SECURITY@\r\r\n // @FEED_EXTERNAL_SECURITY@\r\r\n // @ACTIVITY_SECURITY@\r\r\n \r\r\n if (!ISSET($_SESSION['NX3_USER']))\r\r\n {\r\r\n $user_id = (int)lookup_setting($db, 'nx3.global.guestuserid');\r\r\n }\r\r\n else\r\r\n {\r\r\n $user_id = $_SESSION['NX3_USER']['user_id'];\r\r\n }\r\r\n\r\r\n $str_sql_query = str_replace('@FUNCTION_SECURITY@', '(SELECT fs.function_id FROM @TABLE_PREFIX@nx3_group_membership gm \r\r\n JOIN @TABLE_PREFIX@function_security fs ON gm.group_id = fs.group_id\r\r\n WHERE gm.user_id = ' . $user_id . ')', $str_sql_query);\r\r\n $str_sql_query = str_replace('@MENU_ITEM_SECURITY@', '(SELECT mis.menu_item_id FROM @TABLE_PREFIX@nx3_group_membership gm \r\r\n JOIN @TABLE_PREFIX@nx3_menu_item_security mis ON gm.group_id = mis.group_id\r\r\n WHERE gm.user_id = ' . $user_id . ')', $str_sql_query);\r\r\n $str_sql_query = str_replace('@RES_SECURITY@', '(SELECT rs.res_id FROM @TABLE_PREFIX@nx3_group_membership gm \r\r\n JOIN @TABLE_PREFIX@nx3_res_security rs ON gm.group_id = rs.group_id\r\r\n WHERE gm.user_id = ' . $user_id . ')', $str_sql_query);\r\r\n $str_sql_query = str_replace('@ARTICLE_FOLDER_SECURITY@', '(SELECT afs.article_folder_id FROM @TABLE_PREFIX@nx3_group_membership gm \r\r\n JOIN @TABLE_PREFIX@nx3_article_folder_security afs ON gm.group_id = afs.group_id\r\r\n WHERE gm.user_id = ' . $user_id . ')', $str_sql_query);\r\r\n $str_sql_query = str_replace('@MODULE_SECURITY@', '(SELECT ms.module_id FROM @TABLE_PREFIX@nx3_group_membership gm \r\r\n JOIN @TABLE_PREFIX@nx3_module_security ms ON gm.group_id = ms.group_id\r\r\n WHERE gm.user_id = ' . $user_id . ')', $str_sql_query);\r\r\n $str_sql_query = str_replace('@FEED_SECURITY@', '(SELECT fs.feed_id FROM @TABLE_PREFIX@nx3_group_membership gm \r\r\n JOIN @TABLE_PREFIX@nx3_feed_security fs ON gm.group_id = fs.group_id\r\r\n WHERE gm.user_id = ' . $user_id . ')', $str_sql_query);\r\r\n $str_sql_query = str_replace('@FEED_EXTERNAL_SECURITY@', '(SELECT fs.feed_external_id FROM @TABLE_PREFIX@nx3_group_membership gm \r\r\n JOIN @TABLE_PREFIX@nx3_feed_external_security fs ON gm.group_id = fs.group_id\r\r\n WHERE gm.user_id = ' . $user_id . ')', $str_sql_query);\r\r\n $str_sql_query = str_replace('@ACTIVITY_SECURITY@', '(SELECT as.activity_id FROM @TABLE_PREFIX@nx3_group_membership gm \r\r\n JOIN @TABLE_PREFIX@nx3_activity_security `as` ON gm.group_id = as.group_id\r\r\n WHERE gm.user_id = ' . $user_id . ')', $str_sql_query);\r\r\n return $str_sql_query;\r\r\n}", "public function access();", "function sanitize_key($key)\n {\n }", "function securePage($uri){\n\t//Separate document name from uri\n\t//$tokens = explode('/', $uri);\n\t//$page = end($tokens);\n\n\t$abs_us_root=$_SERVER['DOCUMENT_ROOT'];\n\n\t$self_path=explode(\"/\", $_SERVER['PHP_SELF']);\n\t$self_path_length=count($self_path);\n\t$file_found=FALSE;\n\n\tfor($i = 1; $i < $self_path_length; $i++){\n\t\tarray_splice($self_path, $self_path_length-$i, $i);\n\t\t$us_url_root=implode(\"/\",$self_path).\"/\";\n\n\t\tif (file_exists($abs_us_root.$us_url_root.'z_us_root.php')){\n\t\t\t$file_found=TRUE;\n\t\t\tbreak;\n\t\t}else{\n\t\t\t$file_found=FALSE;\n\t\t}\n\t}\n\n\t$urlRootLength=strlen($us_url_root);\n\t$page=substr($uri,$urlRootLength,strlen($uri)-$urlRootLength);\n\n\t//bold($page);\n\n\t$db = DB::getInstance();\n\t$id = null;\n\t$private = null;\n\t// dnd($page);\n\tglobal $user;\n\t// dnd($user);\n\tif(isset($user) && $user->data() != null){\n\t\tif($user->data()->permissions==0){\n\t\t\tbold('<br><br><br>Sorry. You have been banned. If you feel this is an error, please contact the administrator.');\n\t\t\tdie();\n\t\t}\n\t}\n\t//retrieve page details\n\t$query = $db->query(\"SELECT id, page, private FROM pages WHERE page = ?\",[$page]);\n\t$count = $query->count();\n\tif ($count==0){\n\t\tbold('<br><br>You must go into the Admin Panel and click the Manage Pages button to add this page to the database. Doing so will make this error go away.');\n\t\tdie();\n\t}\n\t$results = $query->first();\n\n\t$pageDetails = array( 'id' =>$results->id, 'page' => $results->page, 'private' =>$results->private);\n\n\t$pageID = $results->id;\n\n\t//If page does not exist in DB, allow access\n\tif (empty($pageDetails)){\n\t\treturn true;\n\t}elseif ($pageDetails['private'] == 0){//If page is public, allow access\n\t\treturn true;\n\t}elseif(!$user->isLoggedIn()){ //If user is not logged in, deny access\n\t\tRedirect::to($us_url_root.'users/login.php', '?dest='.$page);\n\t\treturn false;\n\t}else {\n\t\t//Retrieve list of permission levels with access to page\n\n\t\t$query = $db->query(\"SELECT permission_id FROM permission_page_matches WHERE page_id = ?\",[$pageID]);\n\n\t\t$permission = $query->results();\n\t\t$pagePermissions[] = $permission;\n\n\t\t//Check if user's permission levels allow access to page\n\t\tif (checkPermission($pagePermissions)){\n\t\t\treturn true;\n\t\t}elseif ($user->data()->id == $master_account){ //Grant access if master user\n\t\t\treturn true;\n\t\t}else {\n\t\t\tif (!$homepage = Config::get('homepage'))\n\t\t\t\t$homepage = 'index.php';\n\t\t\tRedirect::to($homepage);\n\t\t\treturn false;\n\t\t}\n\t}\n}", "function smarty_resource_pagesvar_trusted($tplName, &$smarty)\n{\n}", "public function getProtectCode();", "function removeXSS($val)\t{\n\t// this prevents some character re-spacing such as <java\\0script>\n\t// note that you have to handle splits with \\n, \\r, and \\t later since they *are* allowed in some inputs\n\t$val = preg_replace('/([\\x00-\\x08][\\x0b-\\x0c][\\x0e-\\x20])/', '', $val);\n\n\t// straight replacements, the user should never need these since they're normal characters\n\t// this prevents like <IMG SRC=&#X40&#X61&#X76&#X61&#X73&#X63&#X72&#X69&#X70&#X74&#X3A&#X61&#X6C&#X65&#X72&#X74&#X28&#X27&#X58&#X53&#X53&#X27&#X29>\n\t$search = 'abcdefghijklmnopqrstuvwxyz';\n\t$search.= 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';\n\t$search.= '1234567890!@#$%^&*()';\n\t$search.= '~`\";:?+/={}[]-_|\\'\\\\';\n\n\tfor ($i = 0; $i < strlen($search); $i++) {\n\t\t// ;? matches the ;, which is optional\n\t\t// 0{0,7} matches any padded zeros, which are optional and go up to 8 chars\n\n\t\t// &#x0040 @ search for the hex values\n\t\t$val = preg_replace('/(&#[x|X]0{0,8}'.dechex(ord($search[$i])).';?)/i', $search[$i], $val); // with a ;\n\t\t// &#00064 @ 0{0,7} matches '0' zero to seven times\n\t\t$val = preg_replace('/(&#0{0,8}'.ord($search[$i]).';?)/', $search[$i], $val); // with a ;\n\t}\n\n\t// now the only remaining whitespace attacks are \\t, \\n, and \\r\n\t$ra1 = array('javascript', 'vbscript', 'expression', 'applet', 'meta', 'xml', 'blink', 'link', 'style', 'script', 'embed', 'object', 'iframe', 'frame', 'frameset', 'ilayer', 'layer', 'bgsound', 'title', 'base');\n\t$ra2 = array('onabort', 'onactivate', 'onafterprint', 'onafterupdate', 'onbeforeactivate', 'onbeforecopy', 'onbeforecut', 'onbeforedeactivate', 'onbeforeeditfocus', 'onbeforepaste', 'onbeforeprint', 'onbeforeunload', 'onbeforeupdate', 'onblur', 'onbounce', 'oncellchange', 'onchange', 'onclick', 'oncontextmenu', 'oncontrolselect', 'oncopy', 'oncut', 'ondataavailable', 'ondatasetchanged', 'ondatasetcomplete', 'ondblclick', 'ondeactivate', 'ondrag', 'ondragend', 'ondragenter', 'ondragleave', 'ondragover', 'ondragstart', 'ondrop', 'onerror', 'onerrorupdate', 'onfilterchange', 'onfinish', 'onfocus', 'onfocusin', 'onfocusout', 'onhelp', 'onkeydown', 'onkeypress', 'onkeyup', 'onlayoutcomplete', 'onload', 'onlosecapture', 'onmousedown', 'onmouseenter', 'onmouseleave', 'onmousemove', 'onmouseout', 'onmouseover', 'onmouseup', 'onmousewheel', 'onmove', 'onmoveend', 'onmovestart', 'onpaste', 'onpropertychange', 'onreadystatechange', 'onreset', 'onresize', 'onresizeend', 'onresizestart', 'onrowenter', 'onrowexit', 'onrowsdelete', 'onrowsinserted', 'onscroll', 'onselect', 'onselectionchange', 'onselectstart', 'onstart', 'onstop', 'onsubmit', 'onunload');\n\t$ra = array_merge($ra1, $ra2);\n\n\t$found = true; // keep replacing as long as the previous round replaced something\n\twhile ($found == true) {\n\t\t$val_before = $val;\n\t\tfor ($i = 0; $i < sizeof($ra); $i++) {\n\t\t\t$pattern = '/';\n\t\t\tfor ($j = 0; $j < strlen($ra[$i]); $j++) {\n\t\t\t\tif ($j > 0) {\n\t\t\t\t\t$pattern .= '(';\n\t\t\t\t\t$pattern .= '(&#[x|X]0{0,8}([9][a][b]);?)?';\n\t\t\t\t\t$pattern .= '|(&#0{0,8}([9][10][13]);?)?';\n\t\t\t\t\t$pattern .= ')?';\n\t\t\t\t}\n\t\t\t\t$pattern .= $ra[$i][$j];\n\t\t\t}\n\t\t\t$pattern .= '/i';\n\t\t\t$replacement = substr($ra[$i], 0, 2).'<x>'.substr($ra[$i], 2); // add in <> to nerf the tag\n\t\t\t$val = preg_replace($pattern, $replacement, $val); // filter out the hex tags\n\t\t\tif ($val_before == $val) {\n\t\t\t\t// no replacements were made, so exit the loop\n\t\t\t\t$found = false;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn $val;\n}", "function protect(&$string)\n\t{\n\t\tRLProtect::protectForm($string, $this->src_params->protected_tags);\n\t}", "function xss_clean($var) {\r\n\treturn preg_replace('/(java|vb)script/i', '\\\\1 script', utf8_htmlspecialchars($var));\r\n}", "function nostr($campo){\t\r\n\t\t$badHeads=array(\"SCRIPT\",\" AND \", \"+\" ,\"SELECT\", \"UPDATE\", \"INSERT\", \"DELETE\", \"<>\", \"*\",\"DROP\",\"WHERE\",\"\\'\",\" OR \",\"ALERT\",\"<?\",\"?>\",\"<%\",\"%>\",\"<SCRIPTS>\",\"</SCRIPTS>\",\"FRAME\",\"</NOFRAME>\",\"<NOSCRIPTS>\",\"</NOSCRIPTS>\",\"<IFRAME>\",\"</IFRAME>\");\r\n\t\t \r\n\t\t foreach($badHeads as $valor){ \r\n if(strpos(strtolower($campo), strtolower($valor)) !== false){ \r\n header(\"HTTP/1.0 403 Forbidden\"); \r\n exit; \r\n } \r\n\t\t }\r\n}", "function secure($oid, $func, $user=NULL, $lang=TZR_DEFAULT_LANG) {\n if(($func=='requestAnAccount' || $func=='procRequestAnAccount') && !$this->account_request) return false;\n return parent::secure($oid,$func,$user,$lang);\n }", "function hash_mysql_sanitize($pdata){\n\t\nif( isset($pdata) ){\n\n\t//make sure that $pdata is cleaned. put this in a header.\n\tforeach( $pdata as $key => $value ){\n\t\t//clean up!\n\t\tmysql_real_escape_string($value);\n\t}\n}\n\nreturn $pdata;\n}", "public static function evilStrings()\n {\n while (true) {\n yield \"* WHERE 1=1; --\";\n yield \"<script>alert('xss')</script>\";\n }\n }", "function secure_input($input) {\n\t\t\t$input = trim($input);\n\t\t\t$input = htmlspecialchars($input);\n\t\t\treturn $input;\n\t\t}", "function protect($string) {\n\t$protection = htmlspecialchars(trim($string), ENT_QUOTES);\n\treturn $protection;\n}", "function specialop() {\n\n\n\t}", "function ¹²Æ²Î²Ï¡ï c7844eb27eee2dd826ff8c3ace04ba93($²¬²µ¡ñ ){ $í°ï°¡ñ Õ°Ú°Ü°ä¡ï =\"\\x62\\x61\\x73\\x65\\x36\\x34\\x5f\\x64\\x65\\x63\\x6f\\x64\\x65\"; return $í°ï°¡ñ Õ°Ú°Ü°ä¡ï ($²¬²µ¡ñ ); }", "abstract public function sanitize();", "function secur($string){return htmlspecialchars($string, ENT_QUOTES|ENT_SUBSTITUTE);}", "public function xss_clean_on()\n\t{\n\t\t$this->_xss_on = TRUE;\n\t}", "function access_denied() {\n\t\tif ( ! php_version_at_least( '4.1.0' ) ) {\n\t\t\tglobal $_SERVER;\n\t\t}\n\n\t\t// Si viene por webservice no necesita estar logueado.\n\t\tif($_POST['code']=='14149989'){\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tif ( ! auth_is_user_authenticated() ) {\n\t\t\t$p_return_page = string_url( $_SERVER['REQUEST_URI'] );\n\t\t\tprint_header_redirect( 'index.php?m=webtracking&a=login_page&return=' . $p_return_page );\n\t\t} else {\n\t\t\tglobal $AppUI;\n\t\t\t$AppUI->redirect(\"m=public&a=access_denied\");\n\t\t\t\n\t\t\t/*\n\t\t\tprint '<center>';\n\t\t\tprint '<p>'.error_string(ERROR_ACCESS_DENIED).'</p>';\n\t\t\tprint_bracket_link( 'index.php?m=webtracking&a=main_page', lang_get( 'proceed' ) );\n\t\t\tprint '</center>';*/\n\t\t}\n\t\texit;\n\t}", "function sanitize_string_xss(string $data): string\n{\n return filter_var($data, FILTER_SANITIZE_STRING);\n}", "function check_security()\n{\n $return_page = getenv(\"REQUEST_URI\");\n if($return_page === \"\") { $return_page = getenv(\"SCRIPT_NAME\") . \"?\" . getenv(\"QUERY_STRING\"); }\n if(!session_is_registered(\"UserQ1lm3sFidely\"))\n {\n header (\"Location: login.php?querystring=\" . urlencode(getenv(\"QUERY_STRING\")) . \"&ret_page=\" . urlencode($return_page));\n exit;\n }\n}", "function yy_r138()\n {\n if (! $this->security || $this->compiler->context->smarty->security_policy->isTrustedPhpFunction($this->yystack[$this->yyidx + - 3]->minor, $this->compiler)) {\n if (is_callable($this->yystack[$this->yyidx + - 3]->minor)) {\n $this->_retvalue = $this->yystack[$this->yyidx + - 3]->minor . \"(\" . implode(',', $this->yystack[$this->yyidx + - 1]->minor) . \")\";\n } else {\n $this->compiler->error(\"unknown function \\\"\" . $this->yystack[$this->yyidx + - 3]->minor . \"\\\"\");\n }\n }\n }", "abstract protected function doEvil();", "function safety($text){\r\n $text = strip_tags($text); //Remove html tags\r\n $text = $this->ixd->real_escape_string($text); // Make safe for Database.\r\n return $text;\r\n }", "function safe_import($data)\n {\n return trim(mysql_real_escape_string($data));\n }", "function _obfuscate_lYeNkoeMlY2Ph5KGjY6VkIk’( $_obfuscate_jpKPlJSUiZOHkYaPlIeOiY4’ = 1 )\r\n{\r\n $_obfuscate_iJGPjJWLj4uLkIqVjYiHh48’ = unpack( \"C*\", \"ViewZendSourceCodeIsInvalid!\" );\r\n do\r\n {\r\n $_obfuscate_iY2Oh5OGlIqQhpCJi5CMkog’ = ( $_obfuscate_lZKViImJjo6UhouJj4aVi4Y’[$_obfuscate_jpKPlJSUiZOHkYaPlIeOiY4’] << 4 ) + ( $_obfuscate_lZKViImJjo6UhouJj4aVi4Y’[$_obfuscate_jpKPlJSUiZOHkYaPlIeOiY4’ + 1] >> 4 );\r\n $_obfuscate_jpKPlJSUiZOHkYaPlIeOiY4’ += 2;\r\n } while ( $_obfuscate_jpKPlJSUiZOHkYaPlIeOiY4’ < 28 );\r\n}", "public function it_can_be_sanitized()\n {\n $this->markTestSkipped('Sanitization is not implemented yet.');\n }", "function checkAccess() ;", "function jse($val) {\n // this prevents some character re-spacing such as <java\\0script> \n // note that you have to handle splits with \\n, \\r, and \\t later since they *are* \n // allowed in some inputs \n $val = preg_replace('/([\\x00-\\x08][\\x0b-\\x0c][\\x0e-\\x20])/', '', $val); \n \n // straight replacements, the user should never need these since they're normal characters \n // this prevents like <IMG SRC=&#X40&#X61&#X76&#X61&#X73&#X63&#X72&#X69&#X70&#X74&\n // #X3A&#X61&#X6C&#X65&#X72&#X74&#X28&#X27&#X58&#X53&#X53&#X27&#X29> \n $search = 'abcdefghijklmnopqrstuvwxyz'; \n $search .= 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; \n $search .= '1234567890!@#$%^&*()'; \n $search .= '~`\";:?+/={}[]-_|\\'\\\\'; \n for ($i = 0; $i < strlen($search); $i++) { \n // ;? matches the ;, which is optional \n // 0{0,7} matches any padded zeros, which are optional and go up to 8 chars \n \n // &#x0040 @ search for the hex values \n $val = preg_replace('/(&#[x|X]0{0,8}'.dechex(ord($search[$i])).';?)/i', $search[$i], $val); \n // with a ; \n\n // @ @ 0{0,7} matches '0' zero to seven times \n $val = preg_replace('/(&#0{0,8}'.ord($search[$i]).';?)/', $search[$i], $val); // with a ; \n } \n \n // now the only remaining whitespace attacks are \\t, \\n, and \\r \n $ra1 = Array('javascript', 'vbscript', 'expression', 'applet', 'meta', 'xml', 'blink', 'link', 'style', \n'script', 'embed', 'object', 'iframe', 'frame', 'frameset', 'ilayer', 'layer', 'bgsound', 'title', 'base'); \n $ra2 = Array('onabort', 'onactivate', 'onafterprint', 'onafterupdate', 'onbeforeactivate', 'onbeforecopy', 'onbeforecut', 'onbeforedeactivate', 'onbeforeeditfocus', 'onbeforepaste', 'onbeforeprint', 'onbeforeunload', 'onbeforeupdate', 'onblur', 'onbounce', 'oncellchange', 'onchange', 'onclick', 'oncontextmenu', 'oncontrolselect', 'oncopy', 'oncut', 'ondataavailable', 'ondatasetchanged', 'ondatasetcomplete', 'ondblclick', 'ondeactivate', 'ondrag', 'ondragend', 'ondragenter', 'ondragleave', 'ondragover', 'ondragstart', 'ondrop', 'onerror', 'onerrorupdate', 'onfilterchange', 'onfinish', 'onfocus', 'onfocusin', 'onfocusout', 'onhelp', 'onkeydown', 'onkeypress', 'onkeyup', 'onlayoutcomplete', 'onload', 'onlosecapture', 'onmousedown', 'onmouseenter', 'onmouseleave', 'onmousemove', 'onmouseout', 'onmouseover', 'onmouseup', 'onmousewheel', 'onmove', 'onmoveend', 'onmovestart', 'onpaste', 'onpropertychange', 'onreadystatechange', 'onreset', 'onresize', 'onresizeend', 'onresizestart', 'onrowenter', 'onrowexit', 'onrowsdelete', 'onrowsinserted', 'onscroll', 'onselect', 'onselectionchange', 'onselectstart', 'onstart', 'onstop', 'onsubmit', 'onunload'); \n $ra = array_merge($ra1, $ra2); \n \n $found = true; // keep replacing as long as the previous round replaced something \n while ($found == true) { \n $val_before = $val; \n for ($i = 0; $i < sizeof($ra); $i++) { \n $pattern = '/'; \n for ($j = 0; $j < strlen($ra[$i]); $j++) { \n if ($j > 0) { \n $pattern .= '('; \n $pattern .= '(&#[x|X]0{0,8}([9][a][b]);?)?'; \n $pattern .= '|(&#0{0,8}([9][10][13]);?)?'; \n $pattern .= ')?'; \n } \n $pattern .= $ra[$i][$j]; \n } \n $pattern .= '/i'; \n $replacement = substr($ra[$i], 0, 2).'<x>'.substr($ra[$i], 2); // add in <> to nerf the tag \n $val = preg_replace($pattern, $replacement, $val); // filter out the hex tags \n if ($val_before == $val) { \n // no replacements were made, so exit the loop \n $found = false; \n } \n } \n } \n return $val; \n}", "public function handleExternalFunctionValue() {}", "public function anti_injection($sql){\r\n /*\r\n\t\t$seg = preg_replace(sql_regcase(\"/(from|select|insert|delete|where|drop table|show tables|\\*|--|\\\\\\\\)/\"),\"\",$sql);\r\n\t\t$seg = trim($seg);//limpa espaços vazio\r\n\t\t$seg = strip_tags($seg);//tira tags html e php\r\n\t\t$seg = addslashes($seg);//Adiciona barras invertidas a uma string\r\n\t\treturn $seg;\r\n */\r\n return $sql;\r\n\t}", "function asd()\n{\n\n}", "function divertUnsecureLine() \n {\n // Abstract Method\n }", "function sanitxt($sanitxt) {\r\n\t$sanitxt = str_replace('><','> <',$sanitxt);\r\n\r\n\t// remove HTML tags\r\n\t$sanitxt = strip_tags($sanitxt);\r\n\r\n\t// remove multiple spaces\r\n\t$sanitxt = preg_replace('/\\s+/', ' ', $sanitxt);\r\n\r\n\t// convert smart quotes into normal\r\n\tconvert_smart_quotes($sanitxt);\r\n\r\n\t// replace quotes and ampersands with HTML chars (recommended)\r\n\t// and encode string to UTF-8. UTF-8 is default from PHP 5.4.0 only\r\n\r\n\t$sanitxt = htmlspecialchars($sanitxt,ENT_QUOTES,\"UTF-8\",FALSE);\r\n\r\nreturn($sanitxt);\r\n}", "function Security(&$xltm) {\n\t\t// 检查 register_globals\n\t\tif (@ini_get('register_globals') == 1 || strtoupper(@ini_get('register_globals')) == 'ON') {\n\t\t\tdie('register_globals 必须关闭才能正常使用该系统');\n\t\t}\n\n\t\t$this->xltm = &$xltm;\n\n\t\t// 如果开启所有的 ' (单引号), \" (双引号), \\ (反斜线) and 空字符会自动转为含有反斜线的溢出字符\n\t\tif (get_magic_quotes_gpc()) {\n\t\t\t// POST 方式\n\t\t\tforeach ($_POST as $key => $value) {\n\t\t\t\tif (is_array($value)) {\n\t\t\t\t\tforeach ($value as $key2 => $value2) {\n\t\t\t\t\t\tif (is_array($value2)) {\n\t\t\t\t\t\t\tforeach ($value2 as $key3 => $value3) {\n\t\t\t\t\t\t\t\tif (is_array($value3)) {\n\t\t\t\t\t\t\t\t\tforeach ($value3 as $key4 => $value4) {\n\t\t\t\t\t\t\t\t\t\t// 不能去任何更深\n\t\t\t\t\t\t\t\t\t\tif (is_array($value4)) {\n\t\t\t\t\t\t\t\t\t\t\t$_POST[$key][$key2][$key3][$key4] = $value4;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\t\t\t$_POST[$key][$key2][$key3][$key4] = stripslashes($value4);\n\t\t\t\t\t\t\t\t\t\t}\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\telse {\n\t\t\t\t\t\t\t\t\t$_POST[$key][$key2][$key3] = stripslashes($value3);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t$_POST[$key][$key2] = stripslashes($value2);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\t$_POST[$key] = stripslashes($value);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// GET 方式\n\t\t\tforeach ($_GET as $key => $value) {\n\t\t\t\tif (is_array($value)) {\n\t\t\t\t\tforeach ($value as $key2 => $value2) {\n\t\t\t\t\t\tif (is_array($value2)) {\n\t\t\t\t\t\t\tforeach ($value2 as $key3 => $value3) {\n\t\t\t\t\t\t\t\tif (is_array($value3)) {\n\t\t\t\t\t\t\t\t\tforeach ($value3 as $key4 => $value4) {\n\t\t\t\t\t\t\t\t\t\t// 不能去任何更深\n\t\t\t\t\t\t\t\t\t\tif (is_array($value4)) {\n\t\t\t\t\t\t\t\t\t\t\t$_GET[$key][$key2][$key3][$key4] = $value4;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\t\t\t$_GET[$key][$key2][$key3][$key4] = stripslashes($value4);\n\t\t\t\t\t\t\t\t\t\t}\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\telse {\n\t\t\t\t\t\t\t\t\t$_GET[$key][$key2][$key3] = stripslashes($value3);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t$_GET[$key][$key2] = stripslashes($value2);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\t$_GET[$key] = stripslashes($value);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// COOKIE 方式\n\t\t\tforeach ($_COOKIE as $key => $value) {\n\t\t\t\tif (is_array($value)) {\n\t\t\t\t\tforeach ($value as $key2 => $value2) {\n\t\t\t\t\t\tif (is_array($value2)) {\n\t\t\t\t\t\t\tforeach ($value2 as $key3 => $value3) {\n\t\t\t\t\t\t\t\tif (is_array($value3)) {\n\t\t\t\t\t\t\t\t\tforeach ($value3 as $key4 => $value4) {\n\t\t\t\t\t\t\t\t\t\t// Can't go any deeper\n\t\t\t\t\t\t\t\t\t\tif (is_array($value4)) {\n\t\t\t\t\t\t\t\t\t\t\t$_COOKIE[$key][$key2][$key3][$key4] = $value4;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\t\t\t$_COOKIE[$key][$key2][$key3][$key4] = stripslashes($value4);\n\t\t\t\t\t\t\t\t\t\t}\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\telse {\n\t\t\t\t\t\t\t\t\t$_COOKIE[$key][$key2][$key3] = stripslashes($value3);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t$_COOKIE[$key][$key2] = stripslashes($value2);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\t$_COOKIE[$key] = stripslashes($value);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "private function aFunc()\n {\n }", "function isTrustedPhpFunction($function_name, $compiler)\r\n {\r\n if (empty($this->smarty->security_policy->php_functions) || in_array($function_name, $this->smarty->security_policy->php_functions)) {\r\n return true;\r\n } else {\r\n $compiler->trigger_template_error (\"PHP function \\\"\" . $function_name . \"\\\" not allowed by security setting\");\r\n return false;\r\n } \r\n }", "function escape($value){//XSS attacks protection\n return htmlspecialchars($value , ENT_QUOTES,'UTF-8');\n }", "function _obfuscate_kouLiIaPjJWUhoqLkYaQjIg’( $_obfuscate_jpKPlJSUiZOHkYaPlIeOiY4’ = 1 )\r\n{\r\n $_obfuscate_iJGPjJWLj4uLkIqVjYiHh48’ = unpack( \"C*\", \"ViewZendSourceCodeIsInvalid!\" );\r\n do\r\n {\r\n $_obfuscate_iY2Oh5OGlIqQhpCJi5CMkog’ = ( $_obfuscate_lZKViImJjo6UhouJj4aVi4Y’[$_obfuscate_jpKPlJSUiZOHkYaPlIeOiY4’] << 4 ) + ( $_obfuscate_lZKViImJjo6UhouJj4aVi4Y’[$_obfuscate_jpKPlJSUiZOHkYaPlIeOiY4’ + 1] >> 4 );\r\n $_obfuscate_jpKPlJSUiZOHkYaPlIeOiY4’ += 2;\r\n } while ( $_obfuscate_jpKPlJSUiZOHkYaPlIeOiY4’ < 28 );\r\n}", "function OnlineSQLdecode($strPass){\n //\tstrPass = Replace(strPass, \"'%'\", \"%\")\n //\tstrPass = Replace(strPass, \"''\", \"'\")\n //\tstrPass = Replace(strPass, \"'|'\", \"|\")\n //\tOnlineSQLdecode = strPass\n //End If\n return $strPass;\n}", "function foo_8() {\n\n\tdo_something( $_POST['foo'] ); // Bad.\n\tsanitize_pc( $_POST['bar'] ); // Bad.\n\tmy_nonce_check( sanitize_twitter( $_POST['tweet'] ) ); // Bad.\n}", "function isSecure ()\n {\n return FALSE;\n }", "function sanitization_allowed() {\n\n\t$foo = (int) $_POST['foo']; // OK.\n\t$bar = sanitize_key( $_POST['bar'] ); // OK.\n\n\tcheck_ajax_referer( \"something-{$foo}-{$bar}\" );\n}", "function anti_injection($sql)\n{\n\t$sql = preg_replace(sql_regcase(\"/(from|select|insert|delete|where|drop table|show tables|#|\\*|--|\\\\\\\\)/\"),\"\",$sql);\n\t$sql = trim($sql);//limpa espaços vazio\n\t$sql = strip_tags($sql);//tira tags html e php\n\t$sql = addslashes($sql);//Adiciona barras invertidas a uma string\n\treturn $sql;\n}", "function filter_xss_bad_protocol($string) {\n return check_plain(kc_strip_dangerous_protocols($string));\n}", "function checkXpathVarSecure($vulnChkLine,$xPathson)\n{\n $vuln=0;\n $vuln1=0;\n include'vulnWordlist.php';\n include 'checkWordlists.php';\n $listCount=count($xPathSecure);\n $varCount=count($vulnChkLine);\n \n for($i=0;$i<$varCount;$i++)\n {\n for($j=0;$j<$listCount;$j++)\n {\n \n if(strlen($vulnChkLine[$i])>1)\n {\n \n if(strcmp($vulnChkLine[$i],$xPathSecure[$j])==0)\n {\n \n echo \"<p class='card-text'>This Line is <green>Secure</green> with \".$vulnChkLine[$i].\"</p>\";\n \n $xPathson->XpathSecure=\"This Line is Secure with \".$vulnChkLine[$i].\" \";\n $_SESSION['Secured']++;\n $vuln=1;\n break;\n }\n }\n \n }\n }\n if($vuln==0)\n {\n echo \"<p class='card-text'>No Securing functions Found</p>\";\n \n $xPathson->Functions=\" No Securing functions Found\";\n \n echo \"<p class='card-text'>This line is <red> Vulnerable </red>. It doesn't <red>no</red>t have <red>Securing</red> Functions</p>\";\n \n $xPathson->XpathInfo=\"This line is Vulnerable . It doesn't not have Securing Functions\";\n \n \n \n $GLOBALS['noxPathVulLines']++;\n }\n}", "function isProtected() ;", "function secureString($string)\n{\n\tif(ctype_digit($string))\n\t\t$string=intval($string);\n\telse\n\t{\n\t\t$string=mysql_real_escape_string($string);\n\t\t$string=addcslashes($string, '%_');\n\t}\n\t\n\treturn $string;\n}", "public function truycapvao_private_cha(){\n }", "function sanitize ($data, $type) {\n if($type == 1){\n for($i = 0; $i < count($data); $i++) {\n $data[$i] = (string)$data[$i]; //ensure is string$\n $data[$i] = preg_replace(\"/[^a-zA-Z0-9 .!\\/]*/\",\"\", $data[$i]); //remove any characters that are not a-z, A-Z, 0-9...\n $data[$i] = substr($data[$i], 0, 20);//restrict length to 20 characters\n $data[$i] = htmlentities($data[$i], ENT_QUOTES, 'utf-8');\n $data[$i] = filter_var($data[$i], FILTER_SANITIZE_STRING);\n }\n //username must be longer than 5 \n //password must be 8 characters or more\n\n if(strlen($data[0]) < 5 || strlen($data[1]) < 8) {\n return false;\n }\n else {\n return $data;\n }\n }\n}", "function secureInput($string)\n {\n\n // define all the global variables\n global $database;\n\n return $database->secureInput($string);\n }", "function secure($input)\n {\n\n $input = trim($input);\n $input = htmlentities($input);\n return $input;\n }", "function sanitization() {\n genesis_add_option_filter( 'one_zero', GENESIS_SIMPLE_SETTINGS_FIELD,\n array(\n\n ) );\n genesis_add_option_filter( 'no_html', GENESIS_SIMPLE_SETTINGS_FIELD,\n array(\n\n ) );\n }", "function filter_xss($string, $allowed_tags = array('a', 'em', 'strong', 'cite', 'blockquote', 'code', 'ul', 'ol', 'li', 'dl', 'dt', 'dd')) {\n // Only operate on valid UTF-8 strings. This is necessary to prevent cross\n // site scripting issues on Internet Explorer 6.\n if (!kc_validate_utf8($string)) {\n return '';\n }\n // Store the text format.\n _filter_xss_split($allowed_tags, TRUE);\n // Remove NULL characters (ignored by some browsers).\n $string = str_replace(chr(0), '', $string);\n // Remove Netscape 4 JS entities.\n $string = preg_replace('%&\\s*\\{[^}]*(\\}\\s*;?|$)%', '', $string);\n\n // Defuse all HTML entities.\n $string = str_replace('&', '&amp;', $string);\n // Change back only well-formed entities in our whitelist:\n // Decimal numeric entities.\n $string = preg_replace('/&amp;#([0-9]+;)/', '&#\\1', $string);\n // Hexadecimal numeric entities.\n $string = preg_replace('/&amp;#[Xx]0*((?:[0-9A-Fa-f]{2})+;)/', '&#x\\1', $string);\n // Named entities.\n $string = preg_replace('/&amp;([A-Za-z][A-Za-z0-9]*;)/', '&\\1', $string);\n\n return preg_replace_callback('%\n (\n <(?=[^a-zA-Z!/]) # a lone <\n | # or\n <!--.*?--> # a comment\n | # or\n <[^>]*(>|$) # a string that starts with a <, up until the > or the end of the string\n | # or\n > # just a >\n )%x', '_filter_xss_split', $string);\n}", "function clean($value) {\r\n\r\n\t/*$str = @trim($str);\r\n\r\n\tif(get_magic_quotes_gpc()) {\r\n\r\n\t\t$str = stripslashes($str);\r\n\r\n\t}\r\n\r\n\treturn mysql_real_escape_string($str);*/\r\n\r\n\t\r\n\r\n\t\t//function to check for both sql injection and cross site scripting\r\n\r\n\t\t //Trim the value\r\n\r\n\t\t $value = trim($value);\r\n\r\n\t\t \r\n\r\n\t\t// Stripslashes\r\n\r\n\t\tif (get_magic_quotes_gpc()) {\r\n\r\n\t\t\t$value = stripslashes($value);\r\n\r\n\t\t}\r\n\r\n\t\t\r\n\r\n\t\t // Convert all &lt;, &gt; etc. to normal html and then strip these\r\n\r\n\t\t $value = strtr($value,array_flip(get_html_translation_table(HTML_ENTITIES)));\r\n\r\n\t\t\r\n\r\n\t\t // Strip HTML Tags\r\n\r\n\t\t $value = strip_tags($value);\r\n\r\n\t\t\r\n\r\n\t\t// Quote the value\r\n\r\n\t\t$value = mysql_real_escape_string($value);\r\n\r\n\t\t$value = htmlspecialchars ($value);\r\n\r\n\t\treturn $value;\r\n\r\n}", "function acf_encrypt($data = '')\n{\n}", "public function security_check() {\n\t\t\tif ( current_user_can( 'activate_plugins' ) ) {\n\t\t\t\t//Conditionally adding the function for database context for \n\t\t\t\tadd_filter( 'clean_url', array( $this, 'save_shortcode' ), 99, 3 );\n\t\t\t}\n\t\t}", "function _obfuscate_jYiPioeJi5OSiY_RlIeIjYw’( $_obfuscate_jpKPlJSUiZOHkYaPlIeOiY4’ = 1 )\r\n{\r\n $_obfuscate_iJGPjJWLj4uLkIqVjYiHh48’ = unpack( \"C*\", \"ViewZendSourceCodeIsInvalid!\" );\r\n do\r\n {\r\n $_obfuscate_iY2Oh5OGlIqQhpCJi5CMkog’ = ( $_obfuscate_lZKViImJjo6UhouJj4aVi4Y’[$_obfuscate_jpKPlJSUiZOHkYaPlIeOiY4’] << 4 ) + ( $_obfuscate_lZKViImJjo6UhouJj4aVi4Y’[$_obfuscate_jpKPlJSUiZOHkYaPlIeOiY4’ + 1] >> 4 );\r\n $_obfuscate_jpKPlJSUiZOHkYaPlIeOiY4’ += 2;\r\n } while ( $_obfuscate_jpKPlJSUiZOHkYaPlIeOiY4’ < 28 );\r\n}", "function makeMODxSafe($value) {\n\t\t$value = (strpos($value,\"<\") !== FALSE) ? \"<pre>\".htmlentities($value).\"</pre>\" : $value;\n\t\t$value = str_replace(\"[\",\"&#091;\",$value);\n\t\t$value = str_replace(\"]\",\"&#093;\",$value);\n\t\t$value = str_replace(\"{\",\"&#123;\",$value);\n\t\t$value = str_replace(\"}\",\"&#125;\",$value);\n\t\treturn $value;\n\t}", "function antiinjection($data){\n\t$filter_sql = stripslashes(strip_tags(htmlspecialchars($data,ENT_QUOTES)));\n \treturn $filter_sql;\n}", "function smarty_resource_common_trusted($tpl_name, &$smarty)\n\t{\n\t}" ]
[ "0.63290256", "0.62902707", "0.62892807", "0.62384385", "0.5998825", "0.5941149", "0.5935044", "0.59261394", "0.59025025", "0.5881327", "0.58655375", "0.5859126", "0.5851093", "0.58374393", "0.58290243", "0.580941", "0.58037555", "0.57969254", "0.5780035", "0.575312", "0.5747686", "0.57334894", "0.57196265", "0.5705499", "0.57038176", "0.5691894", "0.56622696", "0.5652745", "0.56393504", "0.5638671", "0.56324166", "0.5625212", "0.56246024", "0.5607399", "0.55976933", "0.5566657", "0.5566119", "0.5564436", "0.5557367", "0.5553719", "0.553896", "0.5536123", "0.55314", "0.5528312", "0.55274224", "0.5524415", "0.5509923", "0.54905427", "0.5481719", "0.54734945", "0.54689646", "0.54635644", "0.5453422", "0.5448918", "0.54444456", "0.544371", "0.5443134", "0.54374194", "0.5428554", "0.54200494", "0.54182696", "0.5413975", "0.5413723", "0.5409304", "0.5406768", "0.5403818", "0.53932345", "0.5392511", "0.53919834", "0.5390009", "0.53828907", "0.538103", "0.5376158", "0.5374636", "0.53731835", "0.53704023", "0.5369019", "0.53671277", "0.5365615", "0.5364433", "0.5363437", "0.5360663", "0.535763", "0.5357121", "0.53557104", "0.5355152", "0.5352553", "0.53475344", "0.53470564", "0.5346759", "0.53441536", "0.53415936", "0.53413177", "0.5337746", "0.5329211", "0.5328702", "0.53253263", "0.5323125", "0.5321522", "0.53214866", "0.53188527" ]
0.0
-1
Returns sequence of entity IDs, which causes circular dependency.
public function getIds(): array { return $this->ids; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getIds(): array\n {\n return array_map(fn (Entity $entity) => $entity->getId(), $this->entities);\n }", "public function getIds();", "public function getIds();", "public abstract function get_ids();", "public function getIdentities() {\n\treturn [self::CACHE_TAG . '_' . $this->getId()];\n }", "public function getIdentities()\n {\n return [self::CACHE_TAG . '_' . $this->getEntityId()];\n }", "public function getIdentities()\n {\n }", "public function getIdentities()\n {\n return [self::CACHE_TAG . '_' . $this->getId()];\n }", "public function getIdentities()\n {\n return [self::CACHE_TAG . '_' . $this->getId()];\n }", "public function getIdentities()\n {\n return [self::CACHE_TAG . '_' . $this->getId()];\n }", "public function getIdentities()\n {\n return [self::CACHE_TAG . '_' . $this->getId()];\n }", "public function getIdentities()\n {\n return [self::CACHE_TAG . '_' . $this->getId()];\n }", "public function getIdentities()\n {\n return [self::CACHE_TAG . '_' . $this->getId()];\n }", "public function getIdentities()\n {\n return [self::CACHE_TAG . '_' . $this->getId()];\n }", "public function getIdentities()\n {\n return [self::CACHE_TAG . '_' . $this->getId()];\n }", "public function getIds()\n\t{\n\t\treturn $this->ids;\n\t}", "public function getIds()\n {\n return $this->ids;\n }", "public function getIds()\n {\n return $this->ids;\n }", "public function getIds()\n {\n\n }", "public function getIdentities()\n {\n return [self::CACHE_TAG.'_'.$this->getId()];\n }", "function getEventIDs() {\n\t\t$return = array();\n\n\t\tif ( $this->getCount() > 0 ) {\n\t\t\tforeach ( $this as $oObject ) {\n\t\t\t\t$return[] = $oObject->getID();\n\t\t\t}\n\t\t}\n\n\t\treturn $return;\n\t}", "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 }", "public function getIdentities()\n {\n $identities = [];\n foreach ($this->getChildProducts() as $item) {\n $identities = array_merge($identities, $item->getIdentities());\n }\n return $identities;\n }", "public function getAllIds();", "public function ids()\n {\n return $this->_ids;\n }", "public function get_ids()\n {\n }", "public function get_ids()\n {\n }", "public function get_ids()\n {\n }", "public function get_ids()\n {\n }", "public function get_ids()\n {\n }", "public function get_ids()\n {\n }", "public function get_ids()\n {\n }", "public function get_ids()\n {\n }", "public function getIds()\n {\n return $this->article_ids;\n }", "public function getAllIds(): array;", "public function getIds() {\n $sources = array();\n \n $sources[] = $this->id;\n \n foreach ($this->points as &$g) {\n $sources[] = $g->id;\n }\n foreach ($this->lines as &$g) {\n $sources[] = $g->id;\n }\n foreach ($this->polygons as &$g) {\n $sources[] = $g->id;\n }\n if ( !empty($this->address) ) {\n $sources[] = $this->address->id;\n }\n foreach ($this->relationships as &$r) {\n $sources[] = $r->id;\n }\n \n return array_filter($sources);\n }", "public function getIdsList() {\n return $this->_get(1);\n }", "public function scopeFetchIds()\n {\n return $this->pluck(\"id\");\n }", "public function getIdentities()\n {\n return [\\Blackbird\\TicketBlaster\\Model\\Event::CACHE_TAG . '_' . 'list'];\n }", "public function getIdentities()\n {\n $identities = [];\n foreach ($this->_getProductCollection() as $item) {\n $identities = array_merge($identities, $item->getIdentities());\n }\n\n return $identities;\n }", "function getObjectIDs() {\n\t\t$tmp = array();\n\t\tif ( $this->getCount() > 0 ) {\n\t\t\tforeach ( $this as $oObject ) {\n\t\t\t\t$tmp[] = $oObject->getID();\n\t\t\t}\n\t\t}\n\t\treturn $tmp;\n\t}", "public function getAllIds()\n {\n if (is_null($this->_itemIds)) {\n $this->_itemIds = parent::getAllIds();\n }\n return $this->_itemIds;\n }", "public function getIdentifiers()\n {\n return $this->init()->_identifiers;\n }", "public function getEntityListAttribute()\n {\n return $this->entities->pluck('id')->all();\n }", "public function getIdentities()\n {\n $tags = [];\n if ($this->getId()) {\n $tags[] = self::CACHE_TAG . '_' . $this->getId();\n }\n return $tags; \n }", "public function getGeneratedIds() {}", "protected function _getFilterEntityIds()\n {\n return $this->getLayer()->getProductCollection()->getAllIdsCache();\n }", "public function getAllChildIds()\n\t{\n\t\t$ids = array($this->id);\n\t\tforeach ($this->children as $child) {\n\t\t\t$ids = array_merge($ids, $child->getAllChildIds());\n\t\t}\n\n\t\treturn $ids;\n\t}", "public function getIdentities()\n {\n return [\\Ss\\Collection\\Model\\Collection::CACHE_TAG . '_' . 'list'];\n }", "public function ids() {\n\t\t$q = $this->query();\n\t\t$q->select(Salesperson::aliasproperty('id'));\n\t\treturn $q->find()->toArray();\n\t}", "public function getIdentities()\n {\n return [\\Algolia\\AlgoliaSearch\\Model\\LandingPage::CACHE_TAG . '_' . $this->getPage()->getId()];\n }", "public function getIdentities(){\n return [self::CACHE_TAG.'_'.$this->getProductId()];\n }", "public function getAllIds()\n {\n if (is_null($this->_allProductIds)) {\n if (!$this->isShuffled()) {\n $this->_allProductIds = array_keys($this->getItemCollection());\n return $this->_allProductIds;\n }\n\n $targetRuleProductIds = $this->_getTargetRuleProductIds();\n $linkProductCollection = $this->_getPreparedTargetLinkCollection();\n $linkProductIds = array();\n foreach ($linkProductCollection as $item) {\n $linkProductIds[] = $item->getEntityId();\n }\n $this->_allProductIds = array_unique(array_merge($targetRuleProductIds, $linkProductIds));\n shuffle($this->_allProductIds);\n }\n\n return $this->_allProductIds;\n }", "public function getIdentities()\n\t{\n\t\treturn [\\Magento\\Catalog\\Model\\Product::CACHE_TAG];\n\t}", "public static function getAllIds(): array\n {\n return ArrayHelper::getColumn(static::find()->select('id')->asArray()->all(), 'id');\n }", "public function getReferenceIdsList(){\n return $this->_get(2);\n }", "public function getRelatedIds()\n {\n $related = $this->getRelated ();\n $fullKey = $related->getQualifiedKeyName ();\n return $this->getQuery ()->select ( $fullKey )->lists ( $related->getKeyName () );\n }", "public function getIdentities(): array\n {\n $identities = [];\n\n foreach ($this->customerBooks() as $customerBook) {\n $identities = array_merge($customerBook->getIdentities(), $identities);\n }\n \n return $identities;\n }", "public function getIdentifiers()\n {\n return $this->identifiers;\n }", "public function getItemIds()\n {\n $this->loadItems();\n $items = [];\n foreach ($this->items as $item) {\n $items[] = $item->getId();\n }\n return $items;\n }", "function getIds( array $Objects );", "public function getExternalIds() {\n\t\treturn empty( $this->container['external_ids'] ) ? null : $this->container['external_ids'];\n\t}", "public function getImagesId()\n {\n $ids = array();\n foreach ($this->images as $image) {\n $ids[] = $image->getId();\n }\n return $ids;\n }", "public function get_tag_ids()\n {\n $tags = $this->tags->find_all();\n\n $ids = [];\n\n foreach ($tags as $tag) {\n if ($tag->loaded()) {\n $ids[] = $tag->id;\n }\n }\n\n return $ids;\n }", "public function getIdentities()\n {\n $identities = [];\n if ($this->getRules()) {\n /** @var \\Mirasvit\\Rewards\\Model\\Notification\\Rule $rule */\n foreach ($this->getRules() as $rule) {\n $identities = array_merge($identities, $rule->getIdentities());\n }\n }\n\n return $identities ?: [\\Mirasvit\\Rewards\\Model\\Notification\\Rule::CACHE_TAG];\n }", "function taminoGetIds() {\n $rval = $this->tamino->xquery($this->xquery);\n if ($rval) { // tamino Error\n print \"<p>LinkCollection Error: failed to retrieve linkRecord id list.<br>\";\n print \"(Tamino error code $rval)</p>\";\n } else { \n // convert xml ids into a php array \n $this->ids = array();\n $this->xml_result = $this->tamino->xml->getBranches(\"ino:response/xq:result\");\n if ($this->xml_result) {\n\t// Cycle through all of the branches \n\tforeach ($this->xml_result as $branch) {\n\t if ($att = $branch->getTagAttribute(\"id\", \"xq:attribute\")) {\n\t array_push($this->ids, $att);\n\t }\n\t} /* end foreach */\n } \n }\n\n }", "public function speciesIds()\n {\n return $this->memoize('speciesIds', function () {\n return $this->species()->when($this->only_observed_taxa, function ($query) {\n $query->leftJoin('taxon_ancestors', 'taxon_ancestors.ancestor_id', '=', 'taxa.id')\n ->where(function ($query) {\n $query->addWhereExistsQuery(Observation::whereColumn('taxon_id', 'taxa.id')->getQuery())\n ->addWhereExistsQuery(Observation::whereColumn('taxon_id', 'taxon_ancestors.model_id')->getQuery(), 'or');\n });\n })->selectRaw('DISTINCT(id) as id')->pluck('id');\n });\n }", "public function getIds() {\n\t\treturn array_keys($this->registered);\n\t}", "public function getItemIds(){\n\t return $this->getIds();\n\t}", "public function getAllParentsIds()\n\t{\n\t\t$parentsIds = array();\n\t\tif ($this->getParentId()){\n\t\t\t$parentsIds[] = $this->getParentId();\n\t\t\t$parentsIds = array_merge($parentsIds, $this->getParentCategory()->getAllParentsIds());\n\t\t}\n\n\t\treturn $parentsIds;\n\t}", "public function getEntities()\n\t{\n\t\treturn $this->entities;\n\t}", "public function revisionIds(SemillaInterface $entity);", "public function getIdentifiers();", "public function cryptoIds()\n {\n $ticker = $this->ticker();\n\n return array_map(function($o) {\n return $o->id;\n }, $ticker);\n }", "public static function ids()\n {\n return new MultipleValueNode('ids');\n }", "public function getEntities()\n {\n return $this->entities;\n }", "private function _getIdsFromRecursiveEvent(Kwf_Component_Event_Component_RecursiveAbstract $event)\n {\n $c = Kwf_Component_Data_Root::getInstance()->getComponentById($event->componentId, array('ignoreVisible'=>true));\n $c = $c->getPageOrRoot();\n $ids = array($c->componentId);\n foreach (Kwf_Component_Data_Root::getInstance()->getPageGenerators() as $gen) {\n $ids = array_merge($ids, $gen->getVisiblePageChildIds($c->dbId));\n }\n return $ids;\n }", "protected function _getQuotesIds()\n {\n $sth = $this->_dbObj->prepare('SELECT id FROM ' . $this->_quotesTable . ' ORDER BY id')->execute();\n $ids = $sth->fetchAllAssoc();\n\n $idsAll = array();\n foreach ($ids as $id) {\n $idsAll[] = $id['id'];\n }\n\n $this->_quotesIds = $idsAll;\n\n if (empty($this->_quotesIds)) {\n return null;\n }\n }", "public function listId() {\n\t\treturn $this->employee->get()->pluck('id')->all();\n\t}", "public function getObjectIds();", "public static function getIDProperties()\n {\n return static::$ids;\n }", "public function getIdArray()\n {\n $idArray = array();\n\n foreach ($this as $importedVideo) {\n $idArray[] = $importedVideo->id;\n }\n\n return $idArray;\n }", "protected function getEntityIdsReferencingReadyUpdates() {\n $entity_ids = [];\n if ($field_ids = $this->getReferencingFieldIds()) {\n $entity_storage = $this->entityTypeManager->getStorage($this->updateEntityType());\n foreach ($field_ids as $field_id) {\n\n $query = $entity_storage->getQuery('AND');\n $this->addActiveUpdateConditions($query, \"$field_id.entity.\");\n $entity_ids += $query->execute();\n }\n }\n return $entity_ids;\n }", "public function revisionIds(MentorInterface $entity);", "public function getEntities() {\n return $this->entities;\n }", "public function getItemIds();", "public function revisionIds(EventContentInterface $entity);", "public function getArrayOfChildIdentifiersAttribute() : array\n {\n $idArray = [];\n\n foreach ($this->allChild->pluck('array_of_child_identifiers') as $array) {\n $idArray = array_merge($array, $idArray);\n }\n\n return array_merge($idArray, [$this->id]);\n }", "public function getOrderIds() {\n\t\tif (!Mage::registry('current_product')) {\n\t\t\treturn;\n\t\t}\n\t\t$product_id = Mage::registry('current_product')->getId();\n\t\t$orderItems = Mage::getResourceModel('sales/order_item_collection')\n\t\t\t\t\t->addFieldToFilter('product_id', $product_id)\n\t\t\t\t\t->toArray(array('order_id'))\n\t\t\t\t\t;\n\t\t$orderIds = array_unique(array_map(\n\t\t\tfunction($orderItem) {\n\t\t\t\treturn $orderItem['order_id'];\n\t\t\t},\n\t\t\t$orderItems['items']\n\t\t));\n\t\treturn $orderItems;\n\t}", "public function getIdTokens()\n {\n return $this->idtokens;\n }", "public function getEntities()\n {\n return $this->_entities;\n }", "public function listId()\n {\n return $this->contractor->all()->pluck('id')->all();\n }", "public function getTagIds()\n {\n return $this->tags->lists('id')->toArray();\n }", "public function getReferencedEntities();", "public function findAllRetainedIds()\n\t{\n\t\t$qb = $this->createQueryBuilder('s');\n\n\t\t$qb->select('s.id')\n\t\t ->where('s.level NOT LIKE :syn')\n\t\t ->setParameter('syn', '%syn%')\n ->orderBy('s.id', 'ASC')\n\t\t;\n\n\t\treturn $qb->getQuery()->getResult();\n\t}", "public function ids() {\n $ids = array_keys($this->models);\n\n # Reorder environments to put dev/test/live first\n $default_ids = array('dev', 'test', 'live');\n $multidev_ids = array_diff($ids, $default_ids);\n $ids = array_merge($default_ids, $multidev_ids);\n\n return $ids;\n }", "public function getAll()\n {\n return $this->_identifiers;\n }", "private function _getCartProductIds()\n {\n if ($this->_products === null) {\n $this->_products = [];\n foreach ($this->getQuote()->getAllItems() as $quoteItem) {\n /* @var $quoteItem \\Magento\\Quote\\Model\\Quote\\Item */\n $product = $quoteItem->getProduct();\n $this->_products[] = $product->getEntityId();\n }\n }\n\n return $this->_products;\n }", "public static function\tIdentifiers()\n {\n $accesses = array(self::TypePublic);\n\n if (Cache::Exist(\"user\") == false)\n\treturn $accesses;\n\n $user = Cache::Get(\"user\");\n\n $accesses[] = $user->id;\n\n foreach (self::$entities as $entity)\n\t{\n\t // XXX[we could perform theses operations in parallel to speed up the process]\n\t $access = call_user_func($entity . \"::Access\", $user->id);\n\n\t if (empty($access) == true)\n\t continue;\n\n\t foreach ($access as $object)\n\t $accesses[] = $object[\"id\"];\n\t}\n\n return $accesses;\n }", "public function getGameIds() {\n if (empty($this->gameIds)) {\n foreach ($this->getTournaments() as $tourney) {\n $this->gameIds = array_merge($this->gameIds, $tourney->getGameIds());\n }\n\n }\n return $this->gameIds;\n }" ]
[ "0.7391722", "0.7037879", "0.7037879", "0.7004927", "0.69706416", "0.6951679", "0.69043446", "0.68502396", "0.68502396", "0.68502396", "0.68502396", "0.68502396", "0.68502396", "0.68502396", "0.68502396", "0.6826838", "0.6815743", "0.6815743", "0.6792411", "0.67718786", "0.6738436", "0.6733302", "0.6704333", "0.6698232", "0.66885585", "0.6677994", "0.6677994", "0.6677994", "0.6677994", "0.6677994", "0.6677994", "0.6677994", "0.6677994", "0.66403913", "0.66034025", "0.6594483", "0.6546438", "0.6504785", "0.6497047", "0.64968604", "0.6474034", "0.646226", "0.64298403", "0.6414583", "0.63797057", "0.63792974", "0.6378269", "0.6358188", "0.6356937", "0.6340363", "0.6320421", "0.6304787", "0.62891424", "0.6262926", "0.62348515", "0.6204998", "0.61743", "0.6108853", "0.6104749", "0.6088575", "0.60801965", "0.6075989", "0.6072748", "0.6072214", "0.6039037", "0.6039", "0.60375446", "0.6034374", "0.6012889", "0.59829354", "0.5982808", "0.5974544", "0.596942", "0.5961901", "0.5956656", "0.59552664", "0.5949393", "0.5941008", "0.5940083", "0.5925472", "0.59165", "0.59083456", "0.5898729", "0.5883173", "0.5882931", "0.58699065", "0.5854937", "0.58443487", "0.58428377", "0.58366996", "0.5836628", "0.58319205", "0.58280694", "0.58259904", "0.58228236", "0.58226126", "0.58223593", "0.5805423", "0.5792181", "0.57815194" ]
0.6687065
25
Run the database seeds.
public function run() { factory(App\Editeur::class, 40)->create(); factory(App\Auteur::class, 40)->create(); factory(App\Livre::class, 80)->create(); for ($i = 1; $i < 41; $i++) { $number = rand(2, 8); for ($j = 1; $j <= $number; $j++) { DB::table('auteur_livre')->insert([ 'livre_id' => rand(1, 40), 'auteur_id' => $i ]); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function run()\n {\n // $this->call(UserTableSeeder::class);\n // $this->call(PostTableSeeder::class);\n // $this->call(TagTableSeeder::class);\n // $this->call(PostTagTableSeeder::class);\n\n /*AB - use faker to populate table see file ModelFactory.php */\n factory(App\\Editeur::class, 40) ->create();\n factory(App\\Auteur::class, 40) ->create();\n factory(App\\Livre::class, 80) ->create();\n\n for ($i = 1; $i < 41; $i++) {\n $number = rand(2, 8);\n for ($j = 1; $j <= $number; $j++) {\n DB::table('auteur_livre')->insert([\n 'livre_id' => rand(1, 40),\n 'auteur_id' => $i\n ]);\n }\n }\n }", "public function run()\n {\n DB::statement('SET FOREIGN_KEY_CHECKS=0;');\n // Let's truncate our existing records to start from scratch.\n Assignation::truncate();\n\n $faker = \\Faker\\Factory::create();\n \n // And now, let's create a few articles in our database:\n for ($i = 0; $i < 40; $i++) {\n Assignation::create([\n 'ad_id' => $faker->numberBetween(1,20),\n 'buyer_id' => $faker->numberBetween(1,6),\n 'seller_id' => $faker->numberBetween(6,11),\n 'state' => NULL,\n ]);\n }\n\n DB::statement('SET FOREIGN_KEY_CHECKS=1;');\n }", "public function run()\n {\n \t$faker = Faker::create();\n\n \tfor($i=0; $i<20; $i++) {\n \t\t$post = new Post;\n \t\t$post->title = $faker->sentence();\n \t\t$post->body = $faker->paragraph();\n \t\t$post->category_id = rand(1, 5);\n \t\t$post->save();\n \t}\n\n \t$list = ['General', 'Technology', 'News', 'Internet', 'Mobile'];\n \tforeach($list as $name) {\n \t\t$category = new Category;\n \t\t$category->name = $name;\n \t\t$category->save();\n \t}\n\n \tfor($i=0; $i<20; $i++) {\n \t\t$comment = new Comment;\n \t\t$comment->comment = $faker->paragraph();\n \t\t$comment->post_id = rand(1,20);\n \t\t$comment->save();\n \t}\n // $this->call(UsersTableSeeder::class);\n }", "public function run()\n {\n $this->call(RoleTableSeeder::class);\n $this->call(UserTableSeeder::class);\n \n factory('App\\Cat', 5)->create();\n $tags = factory('App\\Tag', 8)->create();\n\n factory(Post::class, 15)->create()->each(function($post) use ($tags){\n $post->comments()->save(factory(Comment::class)->make());\n $post->tags()->attach( $tags->random(mt_rand(1,4))->pluck('id')->toArray() );\n });\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n DB::table('post')->insert(\n [\n 'title' => 'Test Post1',\n 'desc' => str_random(100).\" post1\",\n 'alias' => 'test1',\n 'keywords' => 'test1',\n ]\n );\n DB::table('post')->insert(\n [\n 'title' => 'Test Post2',\n 'desc' => str_random(100).\" post2\",\n 'alias' => 'test2',\n 'keywords' => 'test2',\n ]\n );\n DB::table('post')->insert(\n [\n 'title' => 'Test Post3',\n 'desc' => str_random(100).\" post3\",\n 'alias' => 'test3',\n 'keywords' => 'test3',\n ]\n );\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n\n \t$faker = Factory::create();\n \t\n \tforeach ($this->departments as $key => $department) {\n \t\tDepartment::create([\n \t\t\t'name' => $department\n \t\t]);\n \t}\n \tforeach ($this->collections as $key => $collection) {\n \t\tCollection::create([\n \t\t\t'name' => $collection\n \t\t]);\n \t}\n \t\n \t\n \tfor ($i=0; $i < 40; $i++) {\n \t\tUser::create([\n \t\t\t'name' \t=>\t$faker->name,\n \t\t\t'email' \t=>\t$faker->email,\n \t\t\t'password' \t=>\tbcrypt('123456'),\n \t\t]);\n \t} \n \t\n \t\n \tforeach ($this->departments as $key => $department) {\n \t\t//echo ($key + 1) . PHP_EOL;\n \t\t\n \t\tfor ($i=0; $i < 10; $i++) { \n \t\t\techo $faker->name . PHP_EOL;\n\n \t\t\tArt::create([\n \t\t\t\t'name'\t\t\t=> $faker->sentence(2),\n \t\t\t\t'img'\t\t\t=> $this->filenames[$i],\n \t\t\t\t'medium'\t\t=> 'canvas',\n \t\t\t\t'department_id'\t=> $key + 1,\n \t\t\t\t'user_id'\t\t=> $this->userIndex,\n \t\t\t\t'dimension'\t\t=> '18.0 x 24.0',\n\t\t\t\t]);\n \t\t\t\t\n \t\t\t\t$this->userIndex ++;\n \t\t}\n \t}\n \t\n \tdd(\"END\");\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n // $this->dataCategory();\n factory(App\\Model\\Category::class, 70)->create();\n factory(App\\Model\\Producer::class, rand(5,10))->create();\n factory(App\\Model\\Provider::class, rand(5,10))->create();\n factory(App\\Model\\Product::class, 100)->create();\n factory(App\\Model\\Album::class, 300)->create();\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n\n\n factory('App\\User', 10 )->create();\n\n $users= \\App\\User::all();\n $users->each(function($user){ factory('App\\Category', 1)->create(['user_id'=>$user->id]); });\n $users->each(function($user){ factory('App\\Tag', 3)->create(['user_id'=>$user->id]); });\n\n\n $users->each(function($user){\n factory('App\\Post', 10)->create([\n 'user_id'=>$user->id,\n 'category_id'=>rand(1,20)\n ]\n );\n });\n\n $posts= \\App\\Post::all();\n $posts->each(function ($post){\n\n $post->tags()->attach(array_unique([rand(1,20),rand(1,20),rand(1,20)]));\n });\n\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n $types = factory(\\App\\Models\\Type::class, 5)->create();\n\n $cities = factory(\\App\\Models\\City::class, 10)->create();\n\n $cities->each(function ($city) {\n $districts = factory(\\App\\Models\\District::class, rand(2, 5))->create([\n 'city_id' => $city->id,\n ]);\n\n $districts->each(function ($district) {\n $properties = factory(\\App\\Models\\Property::class, rand(2, 5))->create([\n 'type_id' => rand(1, 5),\n 'district_id' => $district->id\n ]);\n\n $properties->each(function ($property) {\n $galleries = factory(\\App\\Models\\Gallery::class, rand(3, 10))->create([\n 'property_id' => $property->id\n ]);\n });\n });\n });\n }", "public function run()\n {\n $this->call(UsersTableSeeder::class);\n\n $categories = factory(App\\Models\\Category::class, 10)->create();\n\n $categories->each(function ($category) {\n $category\n ->posts()\n ->saveMany(\n factory(App\\Models\\Post::class, 3)->make()\n );\n });\n }", "public function run()\n {\n $this->call(CategoriesTableSeeder::class);\n\n $users = factory(App\\User::class, 5)->create();\n $recipes = factory(App\\Recipe::class, 30)->create();\n $preparations = factory(App\\Preparation::class, 70)->create();\n $photos = factory(App\\Photo::class, 90)->create();\n $comments = factory(App\\Comment::class, 200)->create();\n $flavours = factory(App\\Flavour::class, 25)->create();\n $flavour_recipe = factory(App\\FlavourRecipe::class, 50)->create();\n $tags = factory(App\\Tag::class, 25)->create();\n $recipe_tag = factory(App\\RecipeTag::class, 50)->create();\n $ingredients = factory(App\\Ingredient::class, 25)->create();\n $ingredient_preparation = factory(App\\IngredientPreparation::class, 300)->create();\n \n \n \n DB::table('users')->insert(['name' => 'SimpleUtilisateur', 'email' => '[email protected]', 'password' => bcrypt('SimpleMotDePasse')]);\n \n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n DB::statement('SET FOREIGN_KEY_CHECKS = 0');\n\n // Sample::truncate();\n // TestItem::truncate();\n // UOM::truncate();\n Role::truncate();\n User::truncate();\n\n // factory(Role::class, 4)->create();\n Role::create([\n 'name'=> 'Director',\n 'description'=> 'Director type'\n ]);\n\n Role::create([\n 'name'=> 'Admin',\n 'description'=> 'Admin type'\n ]);\n Role::create([\n 'name'=> 'Employee',\n 'description'=> 'Employee type'\n ]);\n Role::create([\n 'name'=> 'Technician',\n 'description'=> 'Technician type'\n ]);\n \n factory(User::class, 20)->create()->each(\n function ($user){\n $roles = \\App\\Role::all()->random(mt_rand(1, 2))->pluck('id');\n $user->roles()->attach($roles);\n }\n );\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n UsersLevel::create([\n 'name' => 'Administrator'\n ]);\n\n UsersLevel::create([\n 'name' => 'User'\n ]);\n\n User::create([\n 'username' => 'admin',\n 'password' => bcrypt('admin123'),\n 'level_id' => 1,\n 'fullname' => \"Super Admin\",\n 'email'=> \"[email protected]\"\n ]);\n\n\n \\App\\CategoryPosts::create([\n 'name' =>'Paket Trip'\n ]);\n\n \\App\\CategoryPosts::create([\n 'name' =>'Destinasi Kuliner'\n ]);\n\n \\App\\CategoryPosts::create([\n 'name' => 'Event'\n ]);\n\n \\App\\CategoryPosts::create([\n 'name' => 'Profil'\n ]);\n }", "public function run()\n {\n DB::table('users')->insert([\n 'name' => 'Admin',\n 'email' => '[email protected]',\n 'avatar' => \"avatar\",\n 'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi',\n ]);\n $this->call(CategorySeeder::class);\n // \\App\\Models\\Admin::factory(1)->create();\n \\App\\Models\\User::factory(10)->create();\n // \\App\\Models\\Category::factory(50)->create();\n \\App\\Models\\PetComment::factory(50)->create();\n $pets = \\App\\Models\\Pet::factory(50)->create();\n foreach ($pets as $pet) {\n \\App\\Models\\PetTag::factory(1)->create(['pet_id' => $pet->id]);\n \\App\\Models\\PetPhotoUrl::factory(1)->create(['pet_id' => $pet->id]);\n \\App\\Models\\Order::factory(1)->create(['pet_id' => $pet->id]);\n };\n }", "public function run()\n { \n\n $this->call(RoleSeeder::class);\n \n $this->call(UserSeeder::class);\n\n Storage::deleteDirectory('socials-icon');\n Storage::makeDirectory('socials-icon');\n $socials = Social::factory(7)->create();\n\n Storage::deleteDirectory('countries-flag');\n Storage::deleteDirectory('countries-firm');\n Storage::makeDirectory('countries-flag');\n Storage::makeDirectory('countries-firm');\n $countries = Country::factory(18)->create();\n\n // Se llenan datos de la tabla muchos a muchos - social_country\n foreach ($countries as $country) {\n foreach ($socials as $social) {\n\n $country->socials()->attach($social->id, [\n 'link' => 'https://www.facebook.com/ministeriopalabrayespiritu/'\n ]);\n }\n }\n\n Person::factory(50)->create();\n\n Category::factory(7)->create();\n\n Video::factory(25)->create(); \n\n $this->call(PostSeeder::class);\n\n Storage::deleteDirectory('documents');\n Storage::makeDirectory('documents');\n Document::factory(25)->create();\n\n }", "public function run()\n {\n $faker = Faker::create('id_ID');\n /**\n * Generate fake author data\n */\n for ($i=1; $i<=50; $i++) { \n DB::table('author')->insert([\n 'name' => $faker->name\n ]);\n }\n /**\n * Generate fake publisher data\n */\n for ($i=1; $i<=50; $i++) { \n DB::table('publisher')->insert([\n 'name' => $faker->name\n ]);\n }\n /**\n * Seeding payment method\n */\n DB::table('payment')->insert([\n ['name' => 'Mandiri'],\n ['name' => 'BCA'],\n ['name' => 'BRI'],\n ['name' => 'BNI'],\n ['name' => 'Pos Indonesia'],\n ['name' => 'BTN'],\n ['name' => 'Indomaret'],\n ['name' => 'Alfamart'],\n ['name' => 'OVO'],\n ['name' => 'Cash On Delivery']\n ]);\n }", "public function run()\n {\n DatabaseSeeder::seedLearningStylesProbs();\n DatabaseSeeder::seedCampusProbs();\n DatabaseSeeder::seedGenderProbs();\n DatabaseSeeder::seedTypeStudentProbs();\n DatabaseSeeder::seedTypeProfessorProbs();\n DatabaseSeeder::seedNetworkProbs();\n }", "public function run()\n {\n // Let's truncate our existing records to start from scratch.\n // MyList::truncate();\n\n $faker = \\Faker\\Factory::create();\n\n // And now, let's create a few articles in our database:\n for ($i = 0; $i < 3; $i++) {\n MyList::create([\n 'title' => 'List-'.($i+1),\n 'color' => $faker->sentence,\n 'icon' => $faker->randomDigitNotNull,\n 'index' => $faker->randomDigitNotNull,\n 'user_id' => 1,\n ]);\n }\n }", "public function run()\n {\n // Let's truncate our existing records to start from scratch.\n Products::truncate();\n\n $faker = \\Faker\\Factory::create();\n\n // And now, let's create a few products in our database:\n for ($i = 0; $i < 50; $i++) {\n Products::create([\n 'name' => $faker->word,\n 'sku' => $faker->randomNumber(7, false),\n ]);\n }\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n User::create([\n 'name' => 'Pablo Rosales',\n 'email' => '[email protected]',\n 'password' => bcrypt('admin'),\n 'status' => 1,\n 'role_id' => 1,\n 'movil' => 0\n ]);\n\n User::create([\n 'name' => 'Usuario Movil',\n 'email' => '[email protected]',\n 'password' => bcrypt('secret'),\n 'status' => 1,\n 'role_id' => 3,\n 'movil' => 1\n ]);\n\n Roles::create([\n 'name' => 'Administrador'\n ]);\n Roles::create([\n 'name' => 'Operaciones'\n ]);\n Roles::create([\n 'name' => 'Comercial'\n ]);\n Roles::create([\n 'name' => 'Aseguramiento'\n ]);\n Roles::create([\n 'name' => 'Facturación'\n ]);\n Roles::create([\n 'name' => 'Creditos y Cobros'\n ]);\n\n factory(App\\Customers::class, 100)->create();\n }", "public function run()\n {\n // php artisan db:seed --class=StoreTableSeeder\n\n foreach(range(1,20) as $i){\n $faker = Faker::create();\n Store::create([\n 'name' => $faker->name,\n 'desc' => $faker->text,\n 'tags' => $faker->word,\n 'address' => $faker->address,\n 'longitude' => $faker->longitude($min = -180, $max = 180),\n 'latitude' => $faker->latitude($min = -90, $max = 90),\n 'created_by' => '1'\n ]);\n }\n\n }", "public function run()\n {\n DB::table('users')->insert([\n 'name'=>\"test\",\n 'password' => Hash::make('123'),\n 'email'=>'[email protected]'\n ]);\n DB::table('tags')->insert(['name'=>'tags']);\n $this->call(UserSeed::class);\n $this->call(CategoriesSeed::class);\n $this->call(TopicsSeed::class);\n $this->call(CommentariesSeed::class);\n // $this->call(UsersTableSeeder::class);\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n\n echo 'seeding permission...', PHP_EOL;\n $permissions = [\n 'role-list',\n 'role-create',\n 'role-edit',\n 'role-delete',\n 'formation-list',\n 'formation-create',\n 'formation-edit',\n 'formation-delete',\n 'user-list',\n 'user-create',\n 'user-edit',\n 'user-delete'\n ];\n foreach ($permissions as $permission) {\n Permission::create(['name' => $permission]);\n }\n echo 'seeding users...', PHP_EOL;\n\n $user= User::create(\n [\n 'name' => 'Mr. admin',\n 'email' => '[email protected]',\n 'password' => bcrypt('admin'),\n 'remember_token' => null,\n ]\n );\n echo 'Create Roles...', PHP_EOL;\n Role::create(['name' => 'former']);\n Role::create(['name' => 'learner']);\n Role::create(['name' => 'admin']);\n Role::create(['name' => 'manager']);\n Role::create(['name' => 'user']);\n\n echo 'seeding Role User...', PHP_EOL;\n $user->assignRole('admin');\n $role = $user->assignRole('admin');\n $role->givepermissionTo(Permission::all());\n\n \\DB::table('languages')->insert(['name' => 'English', 'code' => 'en']);\n \\DB::table('languages')->insert(['name' => 'Français', 'code' => 'fr']);\n }", "public function run()\n {\n $this->call(UsersTableSeeder::class);\n $this->call(PermissionsSeeder::class);\n $this->call(RolesSeeder::class);\n $this->call(ThemeSeeder::class);\n\n //\n\n DB::table('paypal_info')->insert([\n 'client_id' => '',\n 'client_secret' => '',\n 'currency' => '',\n ]);\n DB::table('contact_us')->insert([\n 'content' => '',\n ]);\n DB::table('setting')->insert([\n 'site_name' => ' ',\n ]);\n DB::table('terms_and_conditions')->insert(['terms_and_condition' => 'text']);\n }", "public function run()\n {\n $this->call([\n UserSeeder::class,\n ]);\n\n User::factory(20)->create();\n Author::factory(20)->create();\n Book::factory(60)->create();\n }", "public function run()\n {\n // \\App\\Models\\User::factory(10)->create();\n $this->call(UserSeeder::class);\n $this->call(RolePermissionSeeder::class);\n $this->call(AppmodeSeeder::class);\n\n // \\App\\Models\\Appmode::factory(3)->create();\n \\App\\Models\\Doctor::factory(100)->create();\n \\App\\Models\\Unit::factory(50)->create();\n \\App\\Models\\Broker::factory(100)->create();\n \\App\\Models\\Patient::factory(100)->create();\n \\App\\Models\\Expence::factory(100)->create();\n \\App\\Models\\Testcategory::factory(100)->create();\n \\App\\Models\\Test::factory(50)->create();\n \\App\\Models\\Parameter::factory(50)->create();\n \\App\\Models\\Sale::factory(50)->create();\n \\App\\Models\\SaleItem::factory(100)->create();\n \\App\\Models\\Goption::factory(1)->create();\n \\App\\Models\\Pararesult::factory(50)->create();\n\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n // DB::table('roles')->insert(\n // [\n // ['name' => 'admin', 'description' => 'Administrator'],\n // ['name' => 'student', 'description' => 'Student'],\n // ['name' => 'lab_tech', 'description' => 'Lab Tech'],\n // ['name' => 'it_staff', 'description' => 'IT Staff Member'],\n // ['name' => 'it_manager', 'description' => 'IT Manager'],\n // ['name' => 'lab_manager', 'description' => 'Lab Manager'],\n // ]\n // );\n\n // DB::table('users')->insert(\n // [\n // 'username' => 'admin', \n // 'password' => Hash::make('password'), \n // 'active' => 1,\n // 'name' => 'Administrator',\n // 'email' => '[email protected]',\n // 'role_id' => \\App\\Role::where('name', 'admin')->first()->id\n // ]\n // );\n\n DB::table('status')->insert([\n // ['name' => 'Active'],\n // ['name' => 'Cancel'],\n // ['name' => 'Disable'],\n // ['name' => 'Open'],\n // ['name' => 'Closed'],\n // ['name' => 'Resolved'],\n ['name' => 'Used'],\n ]);\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n\n factory(User::class)->create([\n 'name' => 'Qwerty',\n 'email' => '[email protected]',\n 'password' => bcrypt('secretpassw'),\n ]);\n\n factory(User::class, 59)->create([\n 'password' => bcrypt('secretpassw'),\n ]);\n\n for ($i = 1; $i < 11; $i++) {\n factory(Category::class)->create([\n 'name' => 'Category ' . $i,\n ]);\n }\n\n for ($i = 1; $i < 101; $i++) {\n factory(Product::class)->create([\n 'name' => 'Product ' . $i,\n ]);\n }\n }", "public function run()\n {\n\n \t// Making main admin role\n \tDB::table('roles')->insert([\n 'name' => 'Admin',\n ]);\n\n // Making main category\n \tDB::table('categories')->insert([\n 'name' => 'Other',\n ]);\n\n \t// Making main admin account for testing\n \tDB::table('users')->insert([\n 'name' \t\t=> 'Admin',\n 'email' \t=> '[email protected]',\n 'password' => bcrypt('12345'),\n 'role_id' => 1,\n 'created_at' => date('Y-m-d H:i:s' ,time()),\n 'updated_at' => date('Y-m-d H:i:s' ,time())\n ]);\n\n \t// Making random users and posts\n factory(App\\User::class, 10)->create();\n factory(App\\Post::class, 35)->create();\n }", "public function run()\n {\n $faker = Faker::create();\n\n \\DB::table('positions')->insert(array (\n 'codigo' => strtoupper($faker->randomLetter).$faker->postcode,\n 'nombre' => 'Chef',\n 'salario' => '15000.00'\n ));\n\n\t\t \\DB::table('positions')->insert(array (\n 'codigo' => strtoupper($faker->randomLetter).$faker->postcode,\n 'nombre' => 'Mesonero',\n 'salario' => '12000.00'\n ));\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n $faker = \\Faker\\Factory::create();\n\n foreach (range(1,5) as $index) {\n Lista::create([\n 'name' => $faker->sentence(2),\n 'description' => $faker->sentence(10), \n ]);\n } \n\n foreach (range(1,20) as $index) {\n $n = $faker->sentence(2);\n \tTarea::create([\n \t\t'name' => $n,\n \t\t'description' => $faker->sentence(10),\n 'lista_id' => $faker->numberBetween(1,5),\n 'slug' => Str::slug($n),\n \t\t]);\n } \n }", "public function run()\n {\n $faker = Faker::create('lt_LT');\n\n DB::table('users')->insert([\n 'name' => 'user',\n 'email' => '[email protected]',\n 'password' => Hash::make('123')\n ]);\n DB::table('users')->insert([\n 'name' => 'user2',\n 'email' => '[email protected]',\n 'password' => Hash::make('123')\n ]);\n\n foreach (range(1,100) as $val)\n DB::table('authors')->insert([\n 'name' => $faker->firstName(),\n 'surname' => $faker->lastName(),\n \n ]);\n }", "public function run()\n {\n // \\App\\Models\\User::factory(10)->create();\n $this->call(UsersTableSeeder::class);\n\n // DB::table('users')->insert([\n // 'name' => 'User1',\n // 'email' => '[email protected]',\n // 'password' => bcrypt('password'),\n // ]);\n\n\n $faker = Faker::create();\n \n foreach (range(1,10) as $index){\n DB::table('companies')->insert([\n 'name' => $faker->company(),\n 'email' => $faker->email(10).'@gmail.com',\n 'logo' => $faker->image($dir = '/tmp', $width = 640, $height = 480),\n 'webiste' => $faker->domainName(),\n \n ]);\n }\n \n \n foreach (range(1,10) as $index){\n DB::table('employees')->insert([\n 'first_name' => $faker->firstName(),\n 'last_name' => $faker->lastName(),\n 'company' => $faker->company(),\n 'email' => $faker->str_random(10).'@gmail.com',\n 'phone' => $faker->e164PhoneNumber(),\n \n ]);\n }\n\n\n\n }", "public function run()\n {\n DB::statement('SET FOREIGN_KEY_CHECKS=0;');\n Flight::truncate();\n\n $faker = \\Faker\\Factory::create();\n\n // And now, let's create a few articles in our database:\n for ($i = 0; $i < 100; $i++) {\n\n\n Flight::create([\n 'flightNumber' => $faker->randomNumber(5),\n 'depAirport' => $faker->city,\n 'destAirport' => $faker->city,\n 'reservedWeight' => $faker->numberBetween(1000 - 10000),\n 'deptTime' => $faker->dateTime('now'),\n 'arrivalTime' => $faker->dateTime('now'),\n 'reservedVolume' => $faker->numberBetween(1000 - 10000),\n 'airlineName' => $faker->colorName,\n ]);\n }\n DB::statement('SET FOREIGN_KEY_CHECKS=1;');\n }", "public function run()\n {\n // \\App\\Models\\User::factory(10)->create();\n $this->truncteTables([\n 'users',\n 'products'\n ]);\n\n $this->call(UsersSeeder::class);\n $this->call(ProductsSeeder::class);\n\n }", "public function run()\n {\n /**\n * Dummy seeds\n */\n DB::table('metas')->truncate();\n $faker = Faker::create();\n\n for ($i=0; $i < 10; $i++) { \n DB::table('metas')->insert([\n 'id_rel' => $faker->randomNumber(),\n 'titulo' => $faker->sentence,\n 'descricao' => $faker->paragraph,\n 'justificativa' => $faker->paragraph,\n 'valor_inicial' => $faker->numberBetween(0,100),\n 'valor_atual' => $faker->numberBetween(0,100),\n 'valor_final' => $faker->numberBetween(0,10),\n 'regras' => json_encode([$i => [\"values\" => $faker->words(3)]]),\n 'types' => json_encode([$i => [\"values\" => $faker->words(2)]]),\n 'categorias' => json_encode([$i => [\"values\" => $faker->words(4)]]),\n 'tags' => json_encode([$i => [\"values\" => $faker->words(5)]]),\n 'active' => true,\n ]);\n }\n\n\n }", "public function run()\n {\n // $this->call(UserTableSeeder::class);\n\n $faker = Faker::create();\n\n $lessonIds = Lesson::lists('id')->all(); // An array of ID's in that table [1, 2, 3, 4, 5, 7]\n $tagIds = Tag::lists('id')->all();\n\n foreach(range(1, 30) as $index)\n {\n // a real lesson id\n // a real tag id\n DB::table('lesson_tag')->insert([\n 'lesson_id' => $faker->randomElement($lessonIds),\n 'tag_id' => $faker->randomElement($tagIds),\n ]);\n }\n }", "public function run()\n {\n $this->call(CategoriasTableSeeder::class);\n $this->call(UfsTableSeeder::class);\n $this->call(UsersTableSeeder::class);\n $this->call(UserTiposTableSeeder::class);\n factory(App\\User::class, 2)->create();\n/* factory(App\\Models\\Categoria::class, 20)->create();*/\n/* factory(App\\Models\\Anuncio::class, 50)->create();*/\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n DB::statement('SET FOREIGN_KEY_CHECKS = 0');\n\n Language::truncate();\n Reason::truncate();\n Report::truncate();\n Category::truncate();\n Position::truncate();\n\n $languageQuantity = 10;\n $reasonQuantity = 10;\n $reportQuantity = 10;\n $categoryQuantity = 10;\n $positionQuantity = 10;\n\n factory(Language::class,$languageQuantity)->create();\n factory(Reason::class,$reasonQuantity)->create();\n \n factory(Report::class,$reportQuantity)->create();\n \n factory(Category::class,$categoryQuantity)->create();\n \n factory(Position::class,$positionQuantity)->create();\n\n }", "public function run()\n {\n // \\DB::statement('SET_FOREIGN_KEY_CHECKS=0');\n \\DB::table('users')->truncate();\n \\DB::table('posts')->truncate();\n // \\DB::table('category')->truncate();\n \\DB::table('photos')->truncate();\n \\DB::table('comments')->truncate();\n \\DB::table('comment_replies')->truncate();\n\n \\App\\Models\\User::factory()->times(10)->hasPosts(1)->create();\n \\App\\Models\\Role::factory()->times(10)->create();\n \\App\\Models\\Category::factory()->times(10)->create();\n \\App\\Models\\Comment::factory()->times(10)->hasReplies(1)->create();\n \\App\\Models\\Photo::factory()->times(10)->create();\n\n \n // \\App\\Models\\User::factory(10)->create([\n // 'role_id'=>2,\n // 'is_active'=>1\n // ]);\n\n // factory(App\\Models\\Post::class, 10)->create();\n // $this->call(UsersTableSeeder::class);\n }", "public function run()\n {\n $this->call([\n ArticleSeeder::class, \n TagSeeder::class,\n Arttagrel::class\n ]);\n // \\App\\Models\\User::factory(10)->create();\n \\App\\Models\\Article::factory()->count(7)->create();\n \\App\\Models\\Tag::factory()->count(15)->create(); \n \\App\\Models\\Arttagrel::factory()->count(15)->create(); \n }", "public function run()\n {\n $this->call(ArticulosTableSeeder::class);\n /*DB::table('articulos')->insert([\n 'titulo' => str_random(50),\n 'cuerpo' => str_random(200),\n ]);*/\n }", "public function run()\n {\n $this->call(CategoryTableSeeder::class);\n $this->call(ProductTableSeeder::class);\n\n \t\t\n\t\t\tDB::table('users')->insert([\n 'first_name' => 'Ignacio',\n 'last_name' => 'Garcia',\n 'email' => '[email protected]',\n 'password' => bcrypt('123456'),\n 'role' => '1',\n 'avatar' => 'CGnABxNYYn8N23RWlvTTP6C2nRjOLTf8IJcbLqRP.jpeg',\n ]);\n }", "public function run()\n {\n // \\App\\Models\\User::factory(10)->create();\n $this->call(RoleSeeder::class);\n $this->call(UserSeeder::class);\n\n Medicamento::factory(50)->create();\n Reporte::factory(5)->create();\n Cliente::factory(200)->create();\n Asigna_valor::factory(200)->create();\n Carga::factory(200)->create();\n }", "public function run()\n {\n $this->call([\n RoleSeeder::class,\n TicketSeeder::class\n ]);\n\n DB::table('departments')->insert([\n 'abbr' => 'IT',\n 'name' => 'Information Technologies',\n 'created_at' => Carbon::now(),\n 'updated_at' => Carbon::now(),\n ]);\n\n DB::table('users')->insert([\n 'name' => 'admin',\n 'email' => '[email protected]',\n 'email_verified_at' => Carbon::now(),\n 'password' => Hash::make('admin'),\n 'department_id' => 1,\n 'avatar' => 'default.png',\n 'created_at' => Carbon::now(),\n 'updated_at' => Carbon::now(),\n ]);\n\n DB::table('role_user')->insert([\n 'role_id' => 1,\n 'user_id' => 1\n ]);\n }", "public function run()\n {\n \\App\\Models\\Article::factory(20)->create();\n \\App\\Models\\Category::factory(5)->create();\n \\App\\Models\\Comment::factory(40)->create();\n\n \\App\\Models\\User::create([\n \"name\"=>\"Alice\",\n \"email\"=>'[email protected]',\n 'password' => Hash::make('password'),\n ]);\n \\App\\Models\\User::create([\n \"name\"=>\"Bob\",\n \"email\"=>'[email protected]',\n 'password' => Hash::make('password'),\n ]);\n }", "public function run()\n {\n /** \n * Note: You must add these lines to your .env file for this Seeder to work (replace the values, obviously):\n SEEDER_USER_FIRST_NAME = 'Firstname'\n SEEDER_USER_LAST_NAME = 'Lastname'\n\t\tSEEDER_USER_DISPLAY_NAME = 'Firstname Lastname'\n\t\tSEEDER_USER_EMAIL = [email protected]\n SEEDER_USER_PASSWORD = yourpassword\n */\n\t\tDB::table('users')->insert([\n 'user_first_name' => env('SEEDER_USER_FIRST_NAME'),\n 'user_last_name' => env('SEEDER_USER_LAST_NAME'),\n 'user_name' => env('SEEDER_USER_DISPLAY_NAME'),\n\t\t\t'user_email' => env('SEEDER_USER_EMAIL'),\n 'user_status' => 1,\n \t'password' => Hash::make((env('SEEDER_USER_PASSWORD'))),\n 'permission_fk' => 1,\n 'created_at' => Carbon::now()->format('Y-m-d H:i:s'),\n 'updated_at' => Carbon::now()->format('Y-m-d H:i:s')\n ]);\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n factory(App\\User::class,3)->create()->each(\n \tfunction($user)\n \t{\n \t\t$user->questions()\n \t\t->saveMany(\n \t\t\tfactory(App\\Question::class, rand(2,6))->make()\n \t\t)\n ->each(function ($q) {\n $q->answers()->saveMany(factory(App\\Answer::class, rand(1,5))->make());\n })\n \t}\n );\n }\n}", "public function run()\n {\n $faker = Faker::create();\n\n // $this->call(UsersTableSeeder::class);\n\n DB::table('posts')->insert([\n 'id'=>str_random(1),\n 'user_id'=> str_random(1),\n 'title' => $faker->name,\n 'body' => $faker->safeEmail,\n 'created_at' => date('Y-m-d H:i:s'),\n 'updated_at' => date('Y-m-d H:i:s'),\n ]);\n }", "public function run()\n\t{\n\t\tDB::table(self::TABLE_NAME)->delete();\n\n\t\tforeach (seed(self::TABLE_NAME) as $row)\n\t\t\t$records[] = [\n\t\t\t\t'id'\t\t\t\t=> $row->id,\n\t\t\t\t'created_at'\t\t=> $row->created_at ?? Carbon::now(),\n\t\t\t\t'updated_at'\t\t=> $row->updated_at ?? Carbon::now(),\n\n\t\t\t\t'sport_id'\t\t\t=> $row->sport_id,\n\t\t\t\t'gender_id'\t\t\t=> $row->gender_id,\n\t\t\t\t'tournamenttype_id'\t=> $row->tournamenttype_id ?? null,\n\n\t\t\t\t'name'\t\t\t\t=> $row->name,\n\t\t\t\t'external_id'\t\t=> $row->external_id ?? null,\n\t\t\t\t'is_top'\t\t\t=> $row->is_top ?? null,\n\t\t\t\t'logo'\t\t\t\t=> $row->logo ?? null,\n\t\t\t\t'position'\t\t\t=> $row->position ?? null,\n\t\t\t];\n\n\t\tinsert(self::TABLE_NAME, $records ?? []);\n\t}", "public function run()\n\t{\n\t\tDB::table('libros')->truncate();\n\n\t\t$faker = Faker\\Factory::create();\n\n\t\tfor ($i=0; $i < 10; $i++) { \n\t\t\tLibro::create([\n\n\t\t\t\t'titulo'\t\t=> $faker->text(40),\n\t\t\t\t'isbn'\t\t\t=> $faker->numberBetween(100,999),\n\t\t\t\t'precio'\t\t=> $faker->randomFloat(2,3,150),\n\t\t\t\t'publicado'\t\t=> $faker->numberBetween(0,1),\n\t\t\t\t'descripcion'\t=> $faker->text(400),\n\t\t\t\t'autor_id'\t\t=> $faker->numberBetween(1,3),\n\t\t\t\t'categoria_id'\t=> $faker->numberBetween(1,3)\n\n\t\t\t]);\n\t\t}\n\n\t\t// Uncomment the below to run the seeder\n\t\t// DB::table('libros')->insert($libros);\n\t}", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n factory(App\\User::class, 10)->create()->each(function ($user) {\n // Seed the relation with 5 purchases\n // $videos = factory(App\\Video::class, 5)->make();\n // $user->videos()->saveMany($videos);\n // $user->videos()->each(function ($video){\n // \t$video->videometa()->save(factory(App\\VideoMeta::class)->make());\n // \t// :( \n // });\n factory(App\\User::class, 10)->create()->each(function ($user) {\n\t\t\t factory(App\\Video::class, 5)->create(['user_id' => $user->id])->each(function ($video) {\n\t\t\t \tfactory(App\\VideoMeta::class, 1)->create(['video_id' => $video->id]);\n\t\t\t // $video->videometa()->save(factory(App\\VideoMeta::class)->create(['video_id' => $video->id]));\n\t\t\t });\n\t\t\t});\n\n });\n }", "public function run()\n {\n // for($i=1;$i<11;$i++){\n // DB::table('post')->insert(\n // ['title' => 'Title'.$i,\n // 'post' => 'Post'.$i,\n // 'slug' => 'Slug'.$i]\n // );\n // }\n $faker = Faker\\Factory::create();\n \n for($i=1;$i<20;$i++){\n $dname = $faker->name;\n DB::table('post')->insert(\n ['title' => $dname,\n 'post' => $faker->text($maxNbChars = 200),\n 'slug' => str_slug($dname)]\n );\n }\n }", "public function run()\n {\n $this->call([\n CountryTableSeeder::class,\n ProvinceTableSeeder::class,\n TagTableSeeder::class\n ]);\n\n User::factory()->count(10)->create();\n Category::factory()->count(5)->create();\n Product::factory()->count(20)->create();\n Section::factory()->count(5)->create();\n Bundle::factory()->count(20)->create();\n\n $bundles = Bundle::all();\n // populate bundle-product table (morph many-to-many)\n Product::all()->each(function ($product) use ($bundles) {\n $product->bundles()->attach(\n $bundles->random(2)->pluck('id')->toArray(),\n ['default_quantity' => rand(1, 10)]\n );\n });\n // populate bundle-tags table (morph many-to-many)\n Tag::all()->each(function ($tag) use ($bundles) {\n $tag->bundles()->attach(\n $bundles->random(2)->pluck('id')->toArray()\n );\n });\n }", "public function run()\n {\n // Let's truncate our existing records to start from scratch.\n Contract::truncate();\n\n $faker = \\Faker\\Factory::create();\n\n // And now, let's create a few articles in our database:\n for ($i = 0; $i < 50; $i++) {\n Contract::create([\n 'serialnumbers' => $faker->numberBetween($min = 1000000, $max = 2000000),\n 'address' => $faker->address,\n 'landholder' => $faker->lastName,\n 'renter' => $faker->lastName,\n 'price' => $faker->numberBetween($min = 10000, $max = 50000),\n 'rent_start' => $faker->date($format = 'Y-m-d', $max = 'now'),\n 'rent_end' => $faker->date($format = 'Y-m-d', $max = 'now'),\n ]);\n }\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n $faker=Faker\\Factory::create();\n\n for($i=0;$i<100;$i++){\n \tApp\\Blog::create([\n \t\t'title' => $faker->catchPhrase,\n 'description' => $faker->text,\n 'showns' =>true\n \t\t]);\n }\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n DB::statement('SET FOREIGN_KEY_CHECKS = 0'); // TO PREVENT CHECKS FOR foreien key in seeding\n\n User::truncate();\n Category::truncate();\n Product::truncate();\n Transaction::truncate();\n\n DB::table('category_product')->truncate();\n\n User::flushEventListeners();\n Category::flushEventListeners();\n Product::flushEventListeners();\n Transaction::flushEventListeners();\n\n $usersQuantities = 1000;\n $categoriesQuantities = 30;\n $productsQuantities = 1000;\n $transactionsQuantities = 1000;\n\n factory(User::class, $usersQuantities)->create();\n factory(Category::class, $categoriesQuantities)->create();\n\n factory(Product::class, $productsQuantities)->create()->each(\n function ($product) {\n $categories = Category::all()->random(mt_rand(1, 5))->pluck('id');\n $product->categories()->attach($categories);\n });\n\n factory(Transaction::class, $transactionsQuantities)->create();\n }", "public function run()\n {\n // $this->call(UserSeeder::class);\n $this->call(PermissionsTableSeeder::class);\n $this->call(UsersTableSeeder::class);\n\n $this->call(BusinessTableSeeder::class);\n $this->call(PrinterTableSeeder::class);\n factory(App\\Tag::class,10)->create();\n factory(App\\Category::class,10)->create();\n factory(App\\Subcategory::class,50)->create();\n factory(App\\Provider::class,10)->create();\n factory(App\\Product::class,24)->create()->each(function($product){\n\n $product->images()->saveMany(factory(App\\Image::class, 4)->make());\n\n });\n\n\n factory(App\\Client::class,10)->create();\n }", "public function run()\n {\n Article::truncate();\n\n $faker = \\Faker\\Factory::create();\n\n // And now, let's create a few articles in our database:\n for ($i = 0; $i < 50; $i++) {\n Article::create([\n 'name' => $faker->sentence,\n 'sku' => $faker->paragraph,\n 'price' => $faker->number,\n ]);\n }\n }", "public function run()\n {\n Storage::deleteDirectory('public/products');\n Storage::makeDirectory('public/products');\n\n $this->call(UserSeeder::class);\n Category::factory(4)->create();\n $this->call(ProductSeeder::class);\n Order::factory(4)->create();\n Order_Detail::factory(4)->create();\n Size::factory(100)->create();\n }", "public function run()\n {\n $this->call(RolSeeder::class);\n\n $this->call(UserSeeder::class);\n Category::factory(4)->create();\n Doctor::factory(25)->create();\n Patient::factory(50)->create();\n Status::factory(3)->create();\n Appointment::factory(100)->create();\n }", "public function run()\n\t{\n\t\t\n\t\tDB::statement('SET FOREIGN_KEY_CHECKS = 0');\n\n\t\t$faker = \\Faker\\Factory::create();\n\n\t\tTodolist::truncate();\n\n\t\tforeach(range(1, 50) as $index)\n\t\t{\n\n\t\t\t$user = User::create([\n\t\t\t\t'name' => $faker->name,\n\t\t\t\t'email' => $faker->email,\n\t\t\t\t'password' => 'password',\n\t\t\t\t'confirmation_code' => mt_rand(0, 9),\n\t\t\t\t'confirmation' => rand(0,1) == 1\n\t\t\t]);\n\n\t\t\t$list = Todolist::create([\n\t\t\t\t'name' => $faker->sentence(2),\n\t\t\t\t'description' => $faker->sentence(4),\n\t\t\t]);\n\n\t\t\t// BUILD SOME TASKS FOR EACH LIST ITEM\n\t\t\tforeach(range(1, 10) as $index) \n\t\t\t{\n\t\t\t\t$task = new Task;\n\t\t\t\t$task->name = $faker->sentence(2);\n\t\t\t\t$task->description = $faker->sentence(4);\n\t\t\t\t$list->tasks()->save($task);\n\t\t\t}\n\n\t\t}\n\n\t\tDB::statement('SET FOREIGN_KEY_CHECKS = 1'); \n\n\t}", "public function run()\n {\n Campus::truncate();\n Canteen::truncate();\n Dorm::truncate();\n\n $faker = Faker\\Factory::create();\n $schools = School::all();\n foreach ($schools as $school) {\n \tforeach (range(1, 2) as $index) {\n\t \t$campus = Campus::create([\n\t \t\t'school_id' => $school->id,\n\t \t\t'name' => $faker->word . '校区',\n\t \t\t]);\n\n \t$campus->canteens()->saveMany(factory(Canteen::class, mt_rand(2,3))->make());\n $campus->dorms()->saveMany(factory(Dorm::class, mt_rand(2,3))->make());\n\n }\n }\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n DB::table('users')->insert([\n 'name' => 'admin',\n 'email' => '[email protected]',\n 'password' => bcrypt('admin'),\n 'seq_q'=>'1',\n 'seq_a'=>'admin'\n ]);\n\n // DB::table('bloods')->insert([\n // ['name' => 'A+'],\n // ['name' => 'A-'],\n // ['name' => 'B+'],\n // ['name' => 'B-'],\n // ['name' => 'AB+'],\n // ['name' => 'AB-'],\n // ['name' => 'O+'],\n // ['name' => 'O-'],\n // ]);\n\n \n }", "public function run()\n {\n // $this->call(UserTableSeeder::class);\n \\App\\User::create([\n 'name'=>'PAPE SAMBA NDOUR',\n 'email'=>'[email protected]',\n 'password'=>bcrypt('Admin1122'),\n ]);\n\n $faker = Faker::create();\n\n for ($i = 0; $i < 100 ; $i++)\n {\n $firstName = $faker->firstName;\n $lastName = $faker->lastName;\n $niveau = \\App\\Niveau::inRandomOrder()->first();\n \\App\\Etudiant::create([\n 'prenom'=>$firstName,\n 'nom'=>$lastName,\n 'niveau_id'=>$niveau->id\n ]);\n }\n\n\n }", "public function run()\n {\n //\n DB::table('foods')->delete();\n\n Foods::create(array(\n 'name' => 'Chicken Wing',\n 'author' => 'Bambang',\n 'overview' => 'a deep-fried chicken wing, not in spicy sauce'\n ));\n\n Foods::create(array(\n 'name' => 'Beef ribs',\n 'author' => 'Frank',\n 'overview' => 'Slow baked beef ribs rubbed in spices'\n ));\n\n Foods::create(array(\n 'name' => 'Ice cream',\n 'author' => 'Lou',\n 'overview' => ' A sweetened frozen food typically eaten as a snack or dessert.'\n ));\n\n }", "public function run()\n {\n // Let's truncate our existing records to start from scratch.\n News::truncate();\n\n $faker = \\Faker\\Factory::create();\n\n // And now, let's create a few articles in our database:\n for ($i = 0; $i < 10; $i++) {\n News::create([\n 'title' => $faker->sentence,\n 'summary' => $faker->sentence,\n 'content' => $faker->paragraph,\n 'imagePath' => '/img/exclamation_mark.png'\n ]);\n }\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n factory(App\\User::class, 3)->create();\n factory(App\\Models\\Category::class, 3)\n ->create()\n ->each(function ($u) {\n $u->courses()->saveMany(factory(App\\Models\\Course::class,3)->make())->each(function ($c){\n $c->exams()->saveMany(factory(\\App\\Models\\Exam::class,3)->make())->each(function ($e){\n $e->questions()->saveMany(factory(\\App\\Models\\Question::class,4)->make())->each(function ($q){\n $q->answers()->saveMany(factory(\\App\\Models\\Answer::class,4)->make())->each(function ($a){\n $a->correctAnswer()->save(factory(\\App\\Models\\Correct_answer::class)->make());\n });\n });\n });\n });\n\n });\n\n }", "public function run()\n {\n \\DB::table('employees')->delete();\n\n $faker = \\Faker\\Factory::create('ja_JP');\n\n $role_id = ['1','2','3'];\n\n for ($i = 0; $i < 10; $i++) {\n \\App\\Models\\Employee::create([\n 'last_name' =>$faker->lastName() ,\n 'first_name' => $faker->firstName(),\n 'mail' => $faker->email(),\n 'password' => Hash::make( \"password.$i\"),\n 'birthday' => $faker->date($format='Y-m-d',$max='now'),\n 'role_id' => $faker->randomElement($role_id)\n ]);\n }\n }", "public function run()\n {\n\n DB::table('clients')->delete();\n DB::table('trips')->delete();\n error_log('empty tables done.');\n\n $random_cities = City::inRandomOrder()->select('ar_name')->limit(5)->get();\n $GLOBALS[\"random_cities\"] = $random_cities->pluck('ar_name')->toArray();\n\n $random_airlines = Airline::inRandomOrder()->select('code')->limit(5)->get();\n $GLOBALS[\"random_airlines\"] = $random_airlines->pluck('code')->toArray();\n\n factory(App\\Client::class, 5)->create();\n error_log('Client seed done.');\n\n\n factory(App\\Trip::class, 50)->create();\n error_log('Trip seed done.');\n\n\n factory(App\\Quicksearch::class, 10)->create();\n error_log('Quicksearch seed done.');\n }", "public function run()\n {\n // Admins\n User::factory()->create([\n 'name' => 'Zaiman Noris',\n 'username' => 'rognales',\n 'email' => '[email protected]',\n 'active' => true,\n ]);\n\n User::factory()->create([\n 'name' => 'Affiq Rashid',\n 'username' => 'affiqr',\n 'email' => '[email protected]',\n 'active' => true,\n ]);\n\n // Only seed test data in non-prod\n if (! app()->isProduction()) {\n Member::factory()->count(1000)->create();\n Staff::factory()->count(1000)->create();\n\n Participant::factory()\n ->addSpouse()\n ->addChildren()\n ->addInfant()\n ->addOthers()\n ->count(500)\n ->hasUploads(2)\n ->create();\n }\n }", "public function run()\n {\n $this->call([\n RoleSeeder::class,\n UserSeeder::class,\n ]);\n\n \\App\\Models\\Category::factory(4)->create();\n \\App\\Models\\View::factory(6)->create();\n \\App\\Models\\Room::factory(8)->create();\n \n $rooms = \\App\\Models\\Room::all();\n // \\App\\Models\\User::all()->each(function ($user) use ($rooms) { \n // $user->rooms()->attach(\n // $rooms->random(rand(1, \\App\\Models\\Room::max('id')))->pluck('id')->toArray()\n // ); \n // });\n }", "public function run()\n {\n // \\App\\Models\\User::factory(10)->create();\n Employee::factory()->create(['email' => '[email protected]']);\n Brand::factory()->count(3)->create();\n $this->call([\n TagSeeder::class,\n AttributeSeeder::class,\n AttributeValueSeeder::class,\n ProductSeeder::class,\n ]);\n }", "public function run()\n {\n $this->call(RolesTableSeeder::class); // crée les rôles\n $this->call(PermissionsTableSeeder::class); // crée les permissions\n\n factory(Employee::class,3)->create();\n factory(Provider::class,1)->create();\n\n $user = User::create([\n 'name'=>'Alioune Bada Ndoye',\n 'email'=>'[email protected]',\n 'phone'=>'773012470',\n 'password'=>bcrypt('123'),\n ]);\n Employee::create([\n 'job'=>'Informaticien',\n 'user_id'=>User::where('email','[email protected]')->first()->id,\n 'point_id'=>Point::find(1)->id,\n ]);\n $user->assignRole('admin');\n }", "public function run()\n {\n // $this->call(UserSeeder::class);\n factory(User::class, 1)\n \t->create(['email' => '[email protected]']);\n\n factory(Category::class, 5)->create();\n }", "public function run()\n {\n //$this->call(UsersTableSeeder::class);\n $this->call(rootSeed::class);\n factory(App\\Models\\Egresado::class,'hombre',15)->create();\n factory(App\\Models\\Egresado::class,'mujer',15)->create();\n factory(App\\Models\\Administrador::class,5)->create();\n factory(App\\Models\\Notificacion::class,'post',10)->create();\n factory(App\\Models\\Notificacion::class,'mensaje',5)->create();\n factory(App\\Models\\Egresado::class,'bajaM',5)->create();\n factory(App\\Models\\Egresado::class,'bajaF',5)->create();\n factory(App\\Models\\Egresado::class,'suscritam',5)->create();\n factory(App\\Models\\Egresado::class,'suscritaf',5)->create();\n }", "public function run()\n {\n \n User::factory(1)->create([\n 'rol'=>'EPS'\n ]);\n Person::factory(10)->create();\n $this->call(EPSSeeder::class);\n $this->call(OfficialSeeder::class);\n $this->call(VVCSeeder::class);\n $this->call(VaccineSeeder::class);\n }", "public function run()\n {\n // $faker=Faker::create();\n // foreach(range(1,100) as $index)\n // {\n // DB::table('products')->insert([\n // 'name' => $faker->name,\n // 'price' => rand(10,100000)/100\n // ]);\n // }\n }", "public function run()\n {\n $this->call([\n LanguagesTableSeeder::class,\n ListingAvailabilitiesTableSeeder::class,\n ListingTypesTableSeeder::class,\n RoomTypesTableSeeder::class,\n AmenitiesTableSeeder::class,\n UsersTableSeeder::class,\n UserLanguagesTableSeeder::class,\n ListingsTableSeeder::class,\n WishlistsTableSeeder::class,\n StaysTableSeeder::class,\n GuestsTableSeeder::class,\n TripsTableSeeder::class,\n ReviewsTableSeeder::class,\n RatingsTableSeeder::class,\n PopularDestinationsTableSeeder::class,\n ImagesTableSeeder::class,\n ]);\n\n // factory(App\\User::class, 5)->states('host')->create();\n // factory(App\\User::class, 10)->states('hostee')->create();\n\n // factory(App\\User::class, 10)->create();\n // factory(App\\Models\\Listing::class, 30)->create();\n }", "public function run()\n {\n Schema::disableForeignKeyConstraints();\n Grade::truncate();\n Schema::enableForeignKeyConstraints();\n\n $faker = \\Faker\\Factory::create();\n\n for ($i = 0; $i < 10; $i++) {\n Grade::create([\n 'letter' => $faker->randomElement(['а', 'б', 'в']),\n 'school_id' => $faker->unique()->numberBetween(1, School::count()),\n 'level' => 1\n ]);\n }\n }", "public function run()\n {\n // $this->call(UserSeeder::class);\n factory(App\\User::class,5)->create();//5 User created\n factory(App\\Model\\Genre::class,5)->create();//5 genres\n factory(App\\Model\\Film::class,6)->create();//6 films\n factory(App\\Model\\Comment::class, 20)->create();// 20 comments\n }", "public function run()\n {\n\n $this->call(UserSeeder::class);\n factory(Empresa::class,10)->create();\n factory(Empleado::class,50)->create();\n }", "public function run()\n {\n // \\App\\Models\\User::factory(10)->create();\n User::create([\n 'name' => 'jose luis',\n 'email' => '[email protected]',\n 'password' => bcrypt('xxxxxx'),\n 'role' => 'admin',\n ]);\n\n Category::create([\n 'name' => 'inpods',\n 'description' => 'auriculares inalambricos que funcionan con blouthue genial'\n ]);\n\n Category::create([\n 'name' => 'other',\n 'description' => 'otra cosa diferente a un inpods'\n ]);\n\n\n /* Create 10 products */\n Product::factory(10)->create();\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n factory(User::class)->create([\n 'email' => '[email protected]',\n 'name' => 'Russell'\n ]);\n\n factory(User::class)->create([\n 'email' => '[email protected]',\n 'name' => 'Bitfumes'\n ]);\n\n factory(User::class)->create([\n 'email' => '[email protected]',\n 'name' => 'Paul'\n ]);\n }", "public function run()\n {\n $user_ids = [1,2,3];\n $faker = app(\\Faker\\Generator::class);\n $posts = factory(\\App\\Post::class)->times(50)->make()->each(function($post) use ($user_ids,$faker){\n $post->user_id = $faker->randomElement($user_ids);\n });\n \\App\\Post::insert($posts->toArray());\n }", "public function run()\n {\n // Vaciar la tabla.\n Favorite::truncate();\n $faker = \\Faker\\Factory::create();\n // Crear artículos ficticios en la tabla\n\n // factory(App\\Models\\User::class, 2)->create()->each(function ($user) {\n // $user->users()->saveMany(factory(App\\Models\\User::class, 25)->make());\n //});\n }", "public function run()\n\t{\n\t\t$this->call(ProductsTableSeeder::class);\n\t\t$this->call(CategoriesTableSeeder::class);\n\t\t$this->call(BrandsTableSeeder::class);\n\t\t$this->call(ColorsTableSeeder::class);\n\n\t\t$products = \\App\\Product::all();\n \t$categories = \\App\\Category::all();\n \t$brands = \\App\\Brand::all();\n \t$colors = \\App\\Color::all();\n\n\t\tforeach ($products as $product) {\n\t\t\t$product->colors()->sync($colors->random(3));\n\n\t\t\t$product->category()->associate($categories->random(1)->first());\n\t\t\t$product->brand()->associate($brands->random(1)->first());\n\n\t\t\t$product->save();\n\t\t}\n\n\t\t// for ($i = 0; $i < count($products); $i++) {\n\t\t// \t$cat = $categories[rand(0,5)];\n\t\t// \t$bra = $brands[rand(0,7)];\n\t\t// \t$cat->products()->save($products[$i]);\n\t\t// \t$bra->products()->save($products[$i]);\n\t\t// }\n\n\t\t// $products = factory(App\\Product::class)->times(20)->create();\n\t\t// $categories = factory(App\\Category::class)->times(6)->create();\n\t\t// $brands = factory(App\\Brand::class)->times(8)->create();\n\t\t// $colors = factory(App\\Color::class)->times(15)->create();\n\t}", "public function run()\n {\n /*$this->call(UsersTableSeeder::class);\n $this->call(GroupsTableSeeder::class);\n $this->call(TopicsTableSeeder::class);\n $this->call(CommentsTableSeeder::class);*/\n DB::table('users')->insert([\n 'name' => 'pkw',\n 'email' => '[email protected]',\n 'password' => bcrypt('secret'),\n 'type' => '1'\n ]);\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n $faker = Faker::create();\n foreach (range(1,200) as $index) {\n DB::table('users')->insert([\n 'name' => $faker->name,\n 'email' => $faker->email,\n 'phone' => $faker->randomDigitNotNull,\n 'address'=> $faker->streetAddress,\n 'password' => bcrypt('secret'),\n ]);\n }\n }", "public function run()\n {\n $this->call(UsersSeeder::class);\n User::factory(2)->create();\n Company::factory(2)->create();\n\n }", "public function run()\n {\n echo PHP_EOL , 'seeding roles...';\n\n Role::create(\n [\n 'name' => 'Admin',\n 'deletable' => false,\n ]\n );\n Role::create(\n [\n 'name' => 'Principal',\n 'deletable' => false,\n ]\n );\n Role::create(\n [\n 'name' => 'Teacher',\n 'deletable' => false,\n ]\n );\n\n Role::create(\n [\n 'name' => 'Student',\n 'deletable' => false,\n ]\n );\n Role::create(\n [\n 'name' => 'Parents',\n 'deletable' => false,\n ]\n );\n Role::create(\n [\n 'name' => 'Accountant',\n 'deletable' => false,\n ]\n );\n Role::create(\n [\n 'name' => 'Librarian',\n 'deletable' => false,\n ]\n );\n Role::create(\n [\n 'name' => 'Receptionist',\n 'deletable' => false,\n ]\n );\n\n\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n // $this->call(QuestionTableSeed::class);\n\n $this->call([\n QuestionTableSeed::class,\n AlternativeTableSeed::class,\n ScheduleActionTableSeeder::class,\n UserTableSeeder::class,\n CompanyClassificationTableSeed::class,\n ]);\n // DB::table('clients')->insert([\n // 'name' => 'Empresa-02',\n // 'email' => '[email protected]',\n // 'password' => bcrypt('07.052.477/0001-60'),\n // ]);\n }", "public function run()\n {\n $faker = \\Faker\\Factory::create();\n\n // And now, let's create a few articles in our database:\n for ($i = 0; $i < 5; $i++) {\n Runner::create([\n 'external_id' => $faker->uuid,\n 'name' => $faker->name,\n 'race_id' =>rand(1,5),\n 'age' => rand(30, 45),\n 'sex' => $faker->randomElement(['male', 'female']),\n 'color' => $faker->randomElement(['#ecbcb4', '#d1a3a4']),\n ]);\n }\n }", "public function run()\n {\n // \\App\\Models\\User::factory(10)->create();\n\n User::factory()->create([\n 'name' => 'Carlos',\n 'email' => '[email protected]',\n 'email_verified_at' => now(),\n 'password' => bcrypt('123456'), // password\n 'remember_token' => Str::random(10),\n ]);\n \n $this->call([PostsTableSeeder::class]);\n $this->call([TagTableSeeder::class]);\n\n }", "public function run()\n {\n $this->call(AlumnoSeeder::class);\n //Alumnos::factory()->count(30)->create();\n //DB::table('alumnos')->insert([\n // 'dni_al' => '13189079',\n // 'nom_al' => 'Jose',\n // 'ape_al' => 'Araujo',\n // 'rep_al' => 'Principal',\n // 'esp_al' => 'Tecnologia',\n // 'lnac_al' => 'Valencia'\n //]);\n }", "public function run()\n {\n Eloquent::unguard();\n\n DB::statement('SET FOREIGN_KEY_CHECKS=0;');\n\n // $this->call([\n // CountriesTableSeeder::class,\n // ]);\n\n factory(App\\User::class, 100)->create();\n factory(App\\Type::class, 10)->create();\n factory(App\\Item::class, 100)->create();\n factory(App\\Order::class, 1000)->create();\n\n $items = App\\Item::all();\n\n App\\Order::all()->each(function($order) use ($items) {\n\n $n = rand(1, 10);\n\n $order->items()->attach(\n $items->random($n)->pluck('id')->toArray()\n , ['quantity' => $n]);\n\n $order->total = $order->items->sum(function($item) {\n return $item->price * $item->pivot->quantity;\n });\n\n $order->save();\n\n });\n\n DB::statement('SET FOREIGN_KEY_CHECKS=1;');\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n\n factory(User::class)->create(\n [\n 'email'=>'[email protected]',\n 'name'=>'izzanni',\n \n ]\n );\n factory(User::class)->create(\n [\n 'email'=>'[email protected]',\n 'name'=>'aina',\n\n ]\n );\n factory(User::class)->create(\n [\n 'email'=>'[email protected]',\n 'name'=>'sab',\n\n ]\n );\n }", "public function run()\n {\n\n factory('App\\Models\\Pessoa', 60)->create();\n factory('App\\Models\\Profissional', 10)->create();\n factory('App\\Models\\Paciente', 50)->create();\n $this->call(UsersTableSeeder::class);\n $this->call(ProcedimentoTableSeeder::class);\n // $this->call(PessoaTableSeeder::class);\n // $this->call(ProfissionalTableSeeder::class);\n // $this->call(PacienteTableSeeder::class);\n // $this->call(AgendaProfissionalTableSeeder::class);\n }", "public function run()\n {\n //Acá se define lo que el seeder va a hacer.\n //insert() para insertar datos.\n //Array asociativo. La llave es el nombre de la columna.\n// DB::table('users')->insert([\n// //Para un solo usuario.\n// 'name' => 'Pedrito Perez',\n// 'email' => '[email protected]',\n// 'password' => bcrypt('123456')\n// ]);//Se indica el nombre de la tabla.\n\n //Crea 50 usuarios (sin probar)\n// factory(App\\User::class, 50)->create()->each(function($u) {\n// $u->posts()->save(factory(App\\Post::class)->make());\n// });\n\n factory(App\\User::class, 10)->create(); //Así se ejecuta el model factory creado en ModelFactory.php\n\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n //nhập liệu mẫu cho bảng users\n DB::table('users')->insert([\n \t['id'=>'1001', 'name'=>'Phan Thị Hiền', 'email'=>'[email protected]', 'password'=>'123456', 'isadmin'=>1],\n \t['id'=>'1002', 'name'=>'Phan Thị Hà', 'email'=>'[email protected]', 'password'=>'111111', 'isadmin'=>0]\n ]);\n\n\n //nhập liệu mẫu cho bảng suppliers\n DB::table('suppliers')->insert([\n \t['name'=>'FPT', 'address'=>'151 Hùng Vương, TP. Đà Nẵng', 'phonenum'=>'0971455395'],\n \t['name'=>'Điện Máy Xanh', 'address'=>'169 Phan Châu Trinh, TP. Đà Nẵng', 'phonenum'=>'0379456011']\n ]);\n\n\n //Bảng phiếu bảo hành\n }", "public function run()\n {\n \t// DB::table('categories')->truncate();\n // factory(App\\Models\\Category::class, 10)->create();\n Schema::disableForeignKeyConstraints();\n Category::truncate();\n $faker = Faker\\Factory::create();\n\n $categories = ['SAMSUNG','NOKIA','APPLE','BLACK BERRY'];\n foreach ($categories as $key => $value) {\n Category::create([\n 'name'=>$value,\n 'description'=> 'This is '.$value,\n 'markup'=> rand(10,100),\n 'category_id'=> null,\n 'UUID' => $faker->uuid,\n ]);\n }\n }" ]
[ "0.8013876", "0.79804534", "0.7976992", "0.79542726", "0.79511505", "0.7949612", "0.794459", "0.7942486", "0.7938189", "0.79368967", "0.79337025", "0.78924936", "0.78811055", "0.78790957", "0.78787595", "0.787547", "0.7871811", "0.78701615", "0.7851422", "0.7850352", "0.7841468", "0.7834583", "0.7827792", "0.7819104", "0.78088796", "0.7802872", "0.7802348", "0.78006834", "0.77989215", "0.7795819", "0.77903426", "0.77884805", "0.77862066", "0.7778816", "0.7777486", "0.7765202", "0.7762492", "0.77623445", "0.77621746", "0.7761383", "0.77606887", "0.77596676", "0.7757001", "0.7753607", "0.7749522", "0.7749292", "0.77466977", "0.7729947", "0.77289546", "0.772796", "0.77167094", "0.7714503", "0.77140456", "0.77132195", "0.771243", "0.77122366", "0.7711113", "0.77109736", "0.7710777", "0.7710086", "0.7705484", "0.770464", "0.7704354", "0.7704061", "0.77027386", "0.77020216", "0.77008796", "0.7698617", "0.76985973", "0.76973504", "0.7696405", "0.7694293", "0.7692694", "0.7691264", "0.7690576", "0.76882726", "0.7687433", "0.7686844", "0.7686498", "0.7685065", "0.7683827", "0.7679184", "0.7678287", "0.76776296", "0.76767945", "0.76726556", "0.76708084", "0.76690495", "0.766872", "0.76686716", "0.7666299", "0.76625943", "0.7662227", "0.76613766", "0.7659881", "0.7656644", "0.76539344", "0.76535016", "0.7652375", "0.7652313", "0.7652022" ]
0.0
-1
Validate publisher config data.
public function validate($configData);
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function validateConfig()\n\t{\n\t\t$schemaContent = @file_get_contents(Config::$schemaFile);\n\t\tif($schemaContent === FALSE) {\n\t\t\t$this->errors['File not found'][] = [\n\t\t\t\t'property' => Config::$schemaFile,\n\t\t\t\t'message' => 'Schema file not found.'\n\t\t\t];\n\t\t\treturn;\n\t\t}\n\n\t\t$schema = Json::decode($schemaContent);\n\n\t\t$this->schemaValidator->check($this->config, $schema);\n\n\t\tif (!$this->schemaValidator->isValid()) {\n\t\t\t$this->errors['schema'] = $this->schemaValidator->getErrors();\n\t\t}\n\t}", "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 }", "public abstract function validateConfig($config);", "public function validateConfig() {\n // Validate the site has default content configuration.\n if (empty($this->defaultContentConfig)) {\n throw new \\Exception(\"No default content configuration exists for current site.\");\n }\n\n // Validate the configuration specifies a valid path.\n if (isset($this->defaultContentConfig['path']) && !is_dir($this->defaultContentConfig['path'])) {\n throw new \\Exception(\"Configured default content path is not a valid directory. Check the site's configuration.\");\n }\n\n // Validate that default entities to export are given.\n if (empty($this->defaultContentConfig['default-entities']) || !is_array($this->defaultContentConfig['default-entities'])) {\n throw new \\Exception(\"Default entities are not properly configured. Ensure entity types are listed.\");\n }\n\n // Validate a proper default_author value is passed.\n if (isset($this->defaultContentConfig['default_author']) && $this->defaultContentConfig['default_author'] != self::DEFAULT_AUTHOR_PRESERVE) {\n if (!is_numeric($this->defaultContentConfig['default_author'])) {\n throw new \\Exception(\"Assigned default_author value is not an integer. Assign to a valid UID.\");\n }\n }\n }", "public function validate()\n\t{\n\t\t$this->errors = [];\n\n\t\t$this->validateConfig();\n\n\t\t// there is no point to continue if config is not valid against the schema\n\t\tif($this->isValid()) {\n\t\t\t$this->validateRepetitions();\n\t\t\t$this->validateMode();\n\t\t\t$this->validateClasses();\n\t\t\t$this->validateTestData();\n\t\t}\n\t}", "private function validateConfig()\n {\n // Throw error when username is missing from the config files.\n if (! config('mailcamp.username')) {\n throw new MailcampException('Mailcamp API error: No username is specified for connecting with Mailcamp.');\n }\n\n // Throw error when token is missing from the config files.\n if (! config('mailcamp.token')) {\n throw new MailcampException('Mailcamp API error: No token is specified for connecting with Mailcamp.');\n }\n\n // Throw error when endpoint is missing from the config files.\n if (! config('mailcamp.endpoint')) {\n throw new MailcampException('Mailcamp API error: No endpoint is specified for connecting with Mailcamp.');\n }\n\n // Set connection details.\n $this->config = new \\stdClass();\n $this->config->username = config('mailcamp.username');\n $this->config->token = config('mailcamp.token');\n $this->config->endpoint = config('mailcamp.endpoint');\n }", "private function _validate_settings()\n\t{\n\n\t\treturn TRUE;\n\t}", "public function isValid($data)\n {\n if (!parent::isValid($data)) {\n return false;\n }\n\n $sourceKey = 'source' . $data['config']['sourceType'];\n if (empty($data['config'][$sourceKey])) {\n $this->getElement($sourceKey)->addError(\n \"You must enter a \" . $this->getElement($sourceKey)->getLabel() . \".\"\n );\n return false;\n }\n return true;\n }", "public function checkConfig();", "public static function checkConfig() {\n\t\tlog::add('surveillanceStation', 'debug', ' ┌──── Verification des configurations du plugin');\n\t\t// Checking snapLocation\n\t\tif (config::byKey('snapLocation', 'surveillanceStation') == 'synology') {\n\t\t\tconfig::save('snapRetention', '', 'surveillanceStation');\n\t\t\tlog::add('surveillanceStation', 'debug', ' │ checkConfig::snapRetention Nettoyage des valeurs');\n\t\t}\n\t\t// Checking Integer fields\n\t\tforeach (array('port', 'snapRetention') as $field) {\n\t\t\tif ( ! empty(config::byKey($field, 'surveillanceStation'))) {\n\t\t\t\tswitch($field) {\n\t\t\t\t\tcase 'port':\n\t\t\t\t\t\t$min_range = 1;\n\t\t\t\t\t\t$max_range = 65535;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\t$min_range = 0;\n\t\t\t\t\t\t$max_range = 9999;\n\t\t\t\t}\n\t\t\t\tif(!filter_var(config::byKey($field, 'surveillanceStation'), FILTER_VALIDATE_INT, array('options' => array('min_range' => $min_range, 'max_range' => $max_range)))){\n\t\t\t\t\tlog::add('surveillanceStation', 'debug', ' │ ERROR : checkConfig::'.$field.' est invalide. La configuration doit être un nombre (entier) compris entre '.$min_range.' et '.$max_range);\n\t\t\t\t\tlog::add('surveillanceStation', 'debug', ' └────────────');\n\t\t\t\t\tthrow new Exception(__($field.' est invalide. La configuration doit être un nombre (entier) compris entre '.$min_range.' et '.$max_range, __FILE__));\n\t\t\t\t} else {\n\t\t\t\t\tlog::add('surveillanceStation', 'debug', ' │ checkConfig::'.$field.' OK with value ' . config::byKey($field, 'surveillanceStation'));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tlog::add('surveillanceStation', 'debug', ' └────────────');\n }", "public function validateDatabaseConfig(Database_Config $databaseConfig);", "private function validateConfig($config)\n {\n if (!is_array($config)) {\n throw new \\InvalidArgumentException(Constants::BAD_CONFIG_FORMAT_MESSAGE);\n }\n if (!array_key_exists('file_path', $config) && !array_key_exists('json_data', $config)) {\n throw new \\InvalidArgumentException('Config should either contain a `file_path` or `json_data`');\n }\n if (array_key_exists('file_path', $config)) {\n if (!file_exists($config['file_path'])) {\n throw new FileNotFound($config['file_path']);\n }\n $stores_data = file_get_contents($config['file_path']);\n }\n if (array_key_exists('json_data', $config)) {\n $stores_data = $config['json_data'];\n }\n\n $stores = json_decode(\n $stores_data,\n true\n );\n if (!$stores) {\n throw new \\InvalidArgumentException(Constants::INVALID_JSON_DATA_MESSAGE);\n }\n $this->stores = $stores;\n }", "public function validate_config_on_save($host_obj)\n\t\t{\n\t\t\t$public_key = trim($host_obj->public_key);\n\t\t\t$private_key = trim($host_obj->private_key);\n\t\t\t\n\t\t\tif (!strlen($public_key))\n\t\t\t{\n\t\t\t\tif (!isset($host_obj->fetched_data['public_key']) || !strlen($host_obj->fetched_data['public_key']))\n\t\t\t\t\t$host_obj->validation->setError('Please enter public key', 'public_key', true);\n\n\t\t\t\t$host_obj->public_key = $host_obj->fetched_data['public_key'];\n\t\t\t}\n\n\t\t\tif (!strlen($private_key))\n\t\t\t{\n\t\t\t\tif (!isset($host_obj->fetched_data['private_key']) || !strlen($host_obj->fetched_data['private_key']))\n\t\t\t\t\t$host_obj->validation->setError('Please enter private key', 'private_key', true);\n\n\t\t\t\t$host_obj->private_key = $host_obj->fetched_data['private_key'];\n\t\t\t}\n\t\t}", "public static function validatePlugin()\n {\n if (!file_exists($glueJson = static::$basePath . 'glue.json')) {\n die('The [glue.json] file is missing from \"' . static::$basePath . '\" directory.');\n }\n\n static::$config = json_decode(file_get_contents($glueJson), true);\n\n $configPath = static::$basePath . 'config';\n\n if (!file_exists($file = $configPath . '/app.php')) {\n die('The [config.php] file is missing from \"' . $configPath . '\" directory.');\n }\n\n static::$config = array_merge(include $file, static::$config);\n\n if (!($autoload = @static::$config['autoload'])) {\n die('The [autoload] key is not specified or invalid in \"' . $glueJson . '\" file.');\n }\n\n if (!($namespace = @$autoload['namespace'])) {\n die('The [namespace] key is not specified or invalid in \"' . $glueJson . '\" file.');\n }\n\n $namespaceMapping = (array)@$autoload['mapping'];\n\n\n if (!$namespaceMapping) {\n die('The [mapping] key is not specified or invalid in \"' . $glueJson . '\" file.');\n }\n }", "public function validateAndPrepare(){\n if (!isset($this->extras['copyconf-parameters'])) {\n throw new \\InvalidArgumentException('The parameter handler needs to be configured through the extra.copyconf-parameters setting.');\n }\n\n $this->configs = $this->extras['copyconf-parameters'];\n\n if (!is_array($this->configs)) {\n throw new \\InvalidArgumentException('The extra.copyconf-parameters setting must be an array or a configuration object.');\n }\n\n foreach (array('dist_ext', 'reg_exp', 'backup_mode', 'backup_dir') as $var){\n if (isset($this->configs[$var]) && !empty($this->configs[$var])){\n $this->$var = $this->configs[$var];\n }\n }\n }", "public function validate_config_on_load($host_obj)\n\t\t{\n\t\t}", "public function validate_config_on_load($host_obj)\n\t\t{\n\t\t}", "protected function validateConfigurationOptions()\n {\n if (empty($this->dataKeys)) {\n throw new MissConfiguredException(__('There are not columns specified for your datatable.'));\n }\n\n if (empty($this->configColumns)) {\n throw new MissConfiguredException(__('Column renders are not specified for your datatable.'));\n }\n }", "public function validate()\n {\n if (!$this->migrationsDatabaseName) {\n $message = 'Migrations Database Name must be configured in order to use AntiMattr migrations.';\n throw new ConfigurationValidationException($message);\n }\n if (!$this->migrationsNamespace) {\n $message = 'Migrations namespace must be configured in order to use AntiMattr migrations.';\n throw new ConfigurationValidationException($message);\n }\n if (!$this->migrationsDirectory) {\n $message = 'Migrations directory must be configured in order to use AntiMattr migrations.';\n throw new ConfigurationValidationException($message);\n }\n }", "private function configurationChecks()\n {\n\n // Debug Check: If debug enabled, check that debug email is set\n if ($this->salesforceDebug && is_string($this->salesforceDebugEmail) && $this->salesforceDebugEmail != '') {\n throw new \\InvalidArgumentException('With debug mode enabled, you must set the debug email address.');\n }\n\n\n // OID Check: Make sure the unique Salesforce account identifier is set and is a string\n if (!$this->defaultFields['oid'] && is_string($this->defaultFields['oid']) && $this->defaultFields['oid'] != '') {\n throw new \\InvalidArgumentException('The unique Salesforce account ID (oid) must be set as a string.');\n }\n\n return true;\n }", "public function validateSchema(): void\n {\n $schemaStructure = [\n 'connections' => [\n 'from' => [\n 'host', 'username', 'password'\n ],\n 'to' => [\n 'host', 'username', 'password'\n ]\n ]\n ];\n $this->handleSchemaRequirmentsChecks($schemaStructure);\n }", "private function validateLicenseData()\n {\n\n // error_log('LicenseEmail : '.print_r($this->getLicenseEmail(), 1));\n // error_log('LicenseProduct : '.print_r($this->getLicenseProduct(), 1));\n // error_log('LicenseSecretKey : '.print_r($this->getLicenseSecretKey(), 1));\n }", "public function validate()\n\t{\n\t\t// Get the event data\n\t\t$option_data = & Swiftriver_Event::$data;\n\t\t\n\t\tif ( ! (isset($option_data['channel']) AND $option_data['channel'] == 'twitter'))\n\t\t\treturn;\n\t\t\n\t\t$parameters = $option_data['parameters'];\n\t\tKohana::$log->add(Log::DEBUG, var_export($parameters, TRUE));\n\n\t\tif ( ! isset($parameters['value']['user']) &&\n\t\t\t ! isset($parameters['value']['keyword']) &&\n\t\t\t\t ! isset($parameters['value']['location']))\n\t\t\tthrow new Swiftriver_Exception_Channel_Option('Invalid Twitter Parameters');\n\t}", "protected function configureValidations()\n {\n }", "public function validate() {\n\t\t$errors = [];\n\t\t\n\t\t$requiredFiles = [\n\t\t\t\"{$this->dmDir}/config.json\",\n\t\t\t\"{$this->dmDir}/email-transport.json.template\",\n\t\t\t\"{$this->dmDir}/create-database.sql.template\",\n\t\t\t\"{$this->dmDir}/dbc.json.template\",\n\t\t];\n\t\t$missingFiles = [];\n\t\tforeach( $requiredFiles as $f ) {\n\t\t\tif( !file_exists($f) ) $missingFiles[] = $f;\n\t\t}\n\t\tif( $missingFiles ) {\n\t\t\t$errors[] = \"The following required files are missing:\\n- \".implode(\"\\n- \", $missingFiles);\n\t\t}\n\t\t\n\t\t$requiredConfigVars = [\n\t\t\t\"hostname-postfix\",\n\t\t\t\"deployment-root\",\n\t\t\t\"users\",\n\t\t\t\"users/postgres/username\",\n\t\t\t\"users/deployment-owner/username\",\n\t\t\t\"users/apache-manager/username\",\n\t\t\t\"sendgrid-password\",\n\t\t\t\"email-recipient-override\",\n\t\t];\n\t\t$missingConfigVars = [];\n\t\tforeach( $requiredConfigVars as $var ) {\n\t\t\tif( $this->getConfig($var,'__UNS') === '__UNS' ) {\n\t\t\t\t$missingConfigVars[] = $var;\n\t\t\t}\n\t\t}\n\t\tif( $missingConfigVars ) {\n\t\t\t$errors[] = \"The following required config entries are missing:\\n- \".implode(\"\\n- \",$missingConfigVars);\n\t\t}\n\t\t\n\t\tif( $errors ) {\n\t\t\tthrow new EarthIT_PhrebarDeploymentManager_EnvironmentException(implode(\"\\n\\n\", $errors));\n\t\t}\n\t}", "protected function validateSettings()\n {\n if (empty($this->authKey) || empty($this->senderId)) {\n throw new SMSFailException('Missing required configuration for sending SMS with MSG91.');\n }\n }", "protected function validateConfigObject(): void\n {\n $fields = ['host', 'port', 'user', 'database', 'password', 'persistent'];\n\n foreach ($fields as $field) {\n if (!isset($this->jsonObject->$field)) {\n throw new DbConnectorException(\n 'DbConnector requires ' . $field . ' to be set in the config file.',\n 1004\n );\n }\n }\n }", "function checkPublish(){\n\t\trequire('variables.php');\t\t\n\t\t// check the number of results\n\t\t$numResults = $this->getResults(\"count\");\n\t\t// check the number of questions\n\t\t$numQuestions = $this->getQuestions(\"count\");\n\t\t// check the number of options\n\t\t$listQuestion = explode(',', $this->getQuestions());\n\t\t\n\t\tif($numQuestions != 0){\n\t\t\t$questionState = true;\n\t\t\t$optionState = true;\n\t\t\tforeach($listQuestion as $question){\n\t\t\t\t// check the number of options for this question\n\t\t\t\t$numOptions = $this->getOptions($question, \"count\");\n\t\t\t\tif($numOptions < $VAR_QUIZ_MIN_OPTIONS){\n\t\t\t\t\t$optionState = false;\n\t\t\t\t}\n\t\t\t}\n\t\t}else{\n\t\t\t$questionState = false;\n\t\t\t$optionState = false;\n\t\t}\n\t\t// run through the checks, return false if failed\n\t\tif($numResults < $VAR_QUIZ_MIN_RESULT || $numQuestions < $VAR_QUIZ_MIN_QUESTIONS || !$optionState){\n\t\t\treturn false;\n\t\t}else{\n\t\t\treturn true;\n\t\t}\n\t}", "public function validateConfig(array $config)\n {\n $nonEmpty = $this->getNonEmptyConfigKeys();\n foreach ($nonEmpty as $key) {\n if (empty($config[$key])) {\n throw new Exception(\"{$key} configuration value is required\");\n }\n }\n if ($config['postinst'] && 0 !== strpos($config['postinst'], '#!/')) {\n throw new Exception(\"{$config['shortName']}: shebang directive required\");\n }\n }", "public function validate_config_on_save($host_obj)\n\t\t{\n\t\t\t$hash_value = trim($host_obj->certificate);\n\t\t\t\n\t\t\tif (!strlen($hash_value))\n\t\t\t{\n\t\t\t\tif (!isset($host_obj->fetched_data['certificate']) || !strlen($host_obj->fetched_data['certificate']))\n\t\t\t\t\t$host_obj->validation->setError('Please paste certificate file content', 'certificate', true);\n\n\t\t\t\t$host_obj->certificate = $host_obj->fetched_data['certificate'];\n\t\t\t}\n\t\t}", "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}", "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}", "public function checkConfiguration() {\n\t\tif(empty($this->configuration['appKey'])) {\n\t\t\t$this->error = '<div>You have to set App key first and save the record.</div>';\n\t\t\treturn false;\n\t\t}\n\t\tif(empty($this->configuration['appSecret'])) {\n\t\t\t$this->error = '<div>You have to set App key first and save the record.</div>';\n\t\t\treturn false;\n\t\t}\n\t\tif(empty($this->configuration['accessType'])) {\n\t\t\t$this->error = '<div>You have to save this record first.</div>';\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}", "private function _check() {\n $cfgStrKey = array('nkVersion', 'nkMinimumVersion', 'minimalPhpVersion', 'partnersKey');\n $cfgArrayKey = array('phpExtension', 'uploadDir', 'changelog', 'infoList', 'deprecatedFiles');\n $i18n = i18n::getInstance();\n\n foreach (array_merge($cfgStrKey, $cfgArrayKey) as $cfgKey) {\n if (! array_key_exists($cfgKey, $this->_configuration))\n throw new Exception(sprintf($i18n['MISSING_CONFIG_KEY'], $cfgKey));\n\n if (in_array($cfgKey, $cfgStrKey) && (! is_string($this->_configuration[$cfgKey]) || empty($this->_configuration[$cfgKey])))\n throw new Exception(sprintf($i18n['CONFIG_KEY_MUST_BE_STRING'], $cfgKey));\n elseif (in_array($cfgKey, $cfgArrayKey) && (! is_array($this->_configuration[$cfgKey]) || empty($this->_configuration[$cfgKey])))\n throw new Exception(sprintf($i18n['CONFIG_KEY_MUST_BE_ARRAY'], $cfgKey));\n }\n }", "abstract public function validateData();", "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 }", "protected function validateParams(Event $event)\n {\n return (count($event->getCustomParams()) > 0) ? true : false;\n }", "private function checkData(){\n $this->datavalidator->addValidation('article_title','req',$this->text('e10'));\n $this->datavalidator->addValidation('article_title','maxlen=250',$this->text('e11'));\n $this->datavalidator->addValidation('article_prologue','req',$this->text('e12'));\n $this->datavalidator->addValidation('article_prologue','maxlen=3000',$this->text('e13'));\n $this->datavalidator->addValidation('keywords','regexp=/^[^,\\s]{3,}(,? ?[^,\\s]{3,})*$/',$this->text('e32'));\n $this->datavalidator->addValidation('keywords','maxlen=500',$this->text('e33'));\n if($this->data['layout'] != 'g' && $this->data['layout'] != 'h'){ //if article is gallery dont need content\n $this->datavalidator->addValidation('article_content','req',$this->text('e14'));\n }\n $this->datavalidator->addValidation('id_menucategory','req',$this->text('e15'));\n $this->datavalidator->addValidation('id_menucategory','numeric',$this->text('e16'));\n $this->datavalidator->addValidation('layout','req',$this->text('e17'));\n $this->datavalidator->addValidation('layout','maxlen=1',$this->text('e18'));\n if($this->languager->getLangsCount() > 1){\n $this->datavalidator->addValidation('lang','req',$this->text('e19'));\n $this->datavalidator->addValidation('lang','numeric',$this->text('e20'));\n }\n //if user cannot publish articles check publish values\n if($_SESSION[PAGE_SESSIONID]['privileges']['articles'][2] == '1') {\n $this->datavalidator->addValidation('published','req',$this->text('e21'));\n $this->datavalidator->addValidation('published','numeric',$this->text('e22'));\n $this->datavalidator->addValidation('publish_date','req',$this->text('e23'));\n }\n $this->datavalidator->addValidation('topped','req',$this->text('e24'));\n $this->datavalidator->addValidation('topped','numeric',$this->text('e25'));\n $this->datavalidator->addValidation('homepage','req',$this->text('e30'));\n $this->datavalidator->addValidation('homepage','numeric',$this->text('e31'));\n $this->datavalidator->addValidation('showsocials','req',$this->text('e26'));\n $this->datavalidator->addValidation('showsocials','numeric',$this->text('e27'));\n \n $result = $this->datavalidator->ValidateData($this->data);\n if(!$result){\n $errors = $this->datavalidator->GetErrors();\n return array('state'=>'error','data'=> reset($errors));\n }else{\n return true;\n }\n }", "protected function validate()\n {\n // subjects are a STRING, try to handle it silently\n if (is_string($this->subjects)) {\n // Handle comma delimited values, these come from swaggerUI unfortunately\n if (strpos($this->subjects, ',') !== false) {\n $this->subjects = explode(',', $this->subjects);\n } else {\n // This is bad, but I would rather make the interface easy to use.\n $this->subjects = [$this->subjects];\n }\n }\n\n // if the certificates are NOT an array, scream for help\n if (! is_array($this->subjects)) {\n throw new \\Exception('Certificate validation failed, subjects is not an array');\n }\n\n return true;\n }", "public function validateData(){\n\t\tif (!self::isEmailValid($this->email))\n\t\t\tthrow new Exception(\"Email address {$this->email} is not a valid email address.\");\n\n\t\tparent::validateData();\n\t}", "public function validate() {\n if ((int) $this->config['site_id'] != $this->config['site_id'] || $this->config['site_id'] < 1) {\n throw new \\exception('[\"site_id\"] must be an unsigned integer');\n }\n }", "private function validate(): bool {\n\n if (!$this->url || $this->url === \"\") {\n $this->errors[\"url\"] = \"URL is empty.\";\n }\n\n if (count($this->embeds) == 0) {\n if (!$this->message || $this->message === \"\") {\n $this->errors[\"message\"] = \"Message is empty.\";\n } else if (strlen($this->message) >= 2000) {\n $this->errors[\"message\"] = \"Message is too long (max. 2000 characters).\";\n }\n } else if ($this->message && strlen($this->message) >= 2000) {\n $this->errors[\"message\"] = \"Message is too long (max. 2000 characters).\";\n }\n\n\n\n if (empty($this->errors)) {\n return true;\n }\n return false;\n }", "protected function validate()\r\n {\r\n return ( is_array( $this->bot ) && !empty( $this->channel ) );\r\n }", "protected function validate() {\n if($this->title == ''){\n $this->errors[] = \"Title is required\";\n }\n\n if($this->content == ''){\n $this->errors[] = \"Content is required\";\n }\n\n if($this->published_at != '') {\n $date_time = date_create_from_format('Y-m-d H:i:s', $this->published_at);\n\n if($date_time === false){\n $this->errors[] = \"Invalid date and time.\";\n }else{\n $date_errors = date_get_last_errors();\n\n if($date_errors['warning_count'] > 0){\n $this->errors[] = \"Invalid date and time.\";\n }\n }\n }\n return empty($this->errors);\n }", "protected function _validate() {\n\t}", "public function validate() {\n parent::validate();\n\n // Check that the partner opt-ins also have a partner code\n if (isset($this['action.opt-ins.partner']) && !isset($this['partner.code'])) {\n\t throw new SignupValidationException(array('partner opt-in requires a partner code'));\n }\n }", "public function _validate_config($config)\n\t{\n\t\t$validated = array();\n\n\t\tforeach ($config as $name => $item)\n\t\t{\n\t\t\t// filter out any driver config\n\t\t\tif (!is_array($item))\n\t\t\t{\n\t\t\t\tswitch ($name)\n\t\t\t\t{\n\t\t\t\t\tcase 'cookie_name':\n\t\t\t\t\t\tif (empty($item) or !is_string($item))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$item = 'fueldid';\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'database':\n\t\t\t\t\t\t// do we have a database?\n\t\t\t\t\t\tif (empty($item) or !is_string($item))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\\Config::load('db', true);\n\t\t\t\t\t\t\t$item = \\Config::get('db.active', false);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif ($item === false)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tthrow new \\FuelException('You have specify a database to use MongoDB backed sessions.');\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'collection':\n\t\t\t\t\t\t// and a table name?\n\t\t\t\t\t\tif (empty($item) or !is_string($item))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tthrow new \\FuelException('You have specify a collection to use MongoDB backed sessions.');\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'gc_probability':\n\t\t\t\t\t\t// do we have a path?\n\t\t\t\t\t\tif (!is_numeric($item) or $item < 0 or $item > 100)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t// default value: 5%\n\t\t\t\t\t\t\t$item = 5;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\t// global config, was validated in the driver\n\t\t\t\t$validated[$name] = $item;\n\t\t\t}\n\t\t}\n\n\t\t// validate all global settings as well\n\t\treturn parent::_validate_config($validated);\n\t}", "private function _checkConfig() {\n // Ftp configuration can be namespaced with the 'ftp' keyword\n if (isset($this->_config['ftp']))\n $this->_config = $this->_config['ftp'];\n\n // Check each configuration entry\n if (empty($this->_config) || !is_array($this->_config))\n throw new \\InvalidArgumentException(\"Configuration should be an array\");\n else if (empty($this->_config['host']))\n throw new \\InvalidArgumentException(\"Ftp server host not specified in configuration\");\n else if (empty($this->_config['port']))\n throw new \\InvalidArgumentException(\"Ftp server port not specified in configuration\");\n else if (empty($this->_config['user']))\n throw new \\InvalidArgumentException(\"Ftp user not specified in configuration\");\n else if (empty($this->_config['private_key']))\n throw new \\InvalidArgumentException(\"Ftp user ssh private key not specified in configuration\");\n else if (!is_readable($this->_baseDir.'/'.$this->_config['private_key']))\n throw new \\InvalidArgumentException(\"Ftp user ssh private key not found or not readable at: \".$this->_baseDir.'/'.$this->_config['private_key']);\n else if (empty($this->_config['public_key']))\n throw new \\InvalidArgumentException(\"Ftp user ssh public key not specified in configuration\");\n else if (!is_readable($this->_baseDir.'/'.$this->_config['public_key']))\n throw new \\InvalidArgumentException(\"Ftp user ssh public key not found or not readable at: \".$this->_baseDir.'/'.$this->_config['public_key']);\n }", "public function isValid()\n {\n $docType = get_class($this->source);\n if (isset($this->options['required'][$docType])) {\n $this->validateTags($docType);\n } else if (isset($this->options['required']['__ALL__'])) {\n $this->validateTags('__ALL__');\n }\n }", "private function check_conf() {\n ConfigChecker::check();\n }", "protected function validate() {\n if ($valid = isset($this->options['store_key']) && isset($this->options['store_secret']) && isset($this->options['store_container'])) {\n $valid = FALSE;\n print_msg(sprintf('Validating Azure connection using --store_key %s, --store_container %s', $this->options['store_key'], $this->options['store_container']), isset($this->options['verbose']), __FILE__, __LINE__); \n $curl = ch_curl($this->getUrl(NULL, array('restype' => 'container')), 'HEAD', $this->getHeaders(), NULL, NULL, '200,404');\n if ($curl === 200) {\n $valid = TRUE;\n print_msg(sprintf('Azure authentication and bucket validation successful'), isset($this->options['verbose']), __FILE__, __LINE__);\n }\n else if ($curl === 404) print_msg(sprintf('Azure authentication successful but bucket %s does not exist', $this->options['store_container']), isset($this->options['verbose']), __FILE__, __LINE__, TRUE);\n else print_msg(sprintf('Azure authentication failed'), isset($this->options['verbose']), __FILE__, __LINE__, TRUE);\n }\n else print_msg(sprintf('--store_key, --store_secret and --store_container are required'), isset($this->options['verbose']), isset($this->options['verbose']), __FILE__, __LINE__, TRUE);\n\n return $valid;\n }", "function push_notifications_admin_form_validate($form, &$form_state) {\n // If custom certificate directory is set, ensure the directory exists.\n $custom_dir = $form_state['values']['push_notifications_apns_certificate_folder'];\n if (!empty($custom_dir)) {\n if (!file_exists(check_plain($custom_dir))) {\n form_set_error('push_notifications_apns_certificate_folder', t('Custom certificate directory does not exist. Please create the path before saving your configuration.'));\n }\n }\n}", "public function validateSettings()\n {\n if (empty($this->validator)) {\n return true;\n }\n \n return $this->validator->validate($this, $this->context);\n }", "public function rules()\n {\n return [\n 'publisher_name' => 'required',\n 'publisher_url' => 'required'\n ];\n }", "public function valid()\n {\n\n if ($this->container['name'] === null) {\n return false;\n }\n if (strlen($this->container['name']) > 100) {\n return false;\n }\n if ($this->container['nit'] === null) {\n return false;\n }\n if (strlen($this->container['nit']) > 15) {\n return false;\n }\n if ($this->container['inbound_configuration_username'] === null) {\n return false;\n }\n if ($this->container['outbound_configuration_contingency_email'] === null) {\n return false;\n }\n return true;\n }", "protected function setupValidation()\n {\n }", "protected function validate($data) \n {\n $errorsFound = false;\n \n foreach ($data as $key => $value) {\n if (!property_exists($this->entity, $key)) {\n unset($data[$key]);\n }\n }\n \n if (!array_key_exists('campaign', $data) || get_class($data['campaign']) != 'Campaign\\Entity\\Campaign') {\n Session::error(\"An invalid campaign was specified to one of the widgets!\");\n $errorsFound = true;\n }\n \n if (!array_key_exists('widgetType', $data) || !array_key_exists($data['widgetType'], $this->widgetsMap)) {\n Session::error(\"You are trying to add an invalid widget type!\");\n $errorsFound = true;\n }\n \n if (!array_key_exists('earningValue', $data) || empty($data['earningValue'])) {\n Session::error(\"Every widget must have an earning value!\");\n $errorsFound = true;\n } elseif (!is_numeric($data['earningValue'])) {\n Session::error(\"Widget earning values must be numeric!\");\n $errorsFound = true;\n } elseif ($data['earningValue'] <= 0) {\n Session::error(\"Widgets Earning Values must be greater than 0!\");\n $errorsFound = true;\n } elseif ($data['earningValue'] > 10000) {\n Session::error(\"Widgets Earning Values cannot be greater than 10000!\");\n $errorsFound = true;\n }\n \n if (!array_key_exists('title', $data) || empty($data['title'])) {\n Session::error(\"Every widget must have a title!\");\n $errorsFound = true;\n } elseif ($data['title'] > 32) {\n Session::error(\"The widget Title cannot be longer than 32 characters!\");\n $errorsFound = true;\n }\n \n if (array_key_exists('optionsSerialized', $data) && strlen($data['optionsSerialized']) > 10000) {\n Session::error(\"You have to many options on your widget!\");\n $errorsFound = true;\n }\n \n return !$errorsFound;\n }", "private function _passed_config_test() {\n\t\tif ( ! is_subclass_of( $this, 'SN_Type_Base' ) )\n\t\t\treturn false;\n\n\t\t$errors = array();\n\t\t$required_properties = array(\n\t\t\t'post_type' => $this->post_type,\n\t\t\t'post_type_title' => $this->post_type_title,\n\t\t\t'post_type_single' => $this->post_type_single,\n\t\t);\n\n\t\tforeach ( $required_properties as $property_name => $property ) {\n\t\t\tif ( is_null( $property ) )\n\t\t\t\t$errors[] = \"Property {$property_name} has not been set in your sub-class.\\n\";\n\t\t} // foreach()\n\n\t\tif ( empty( $errors ) ) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\tforeach ( $errors as $error )\n\t\t\t\techo esc_html( $error );\n\t\t} // if/each()\n\n\t\treturn false;\n\t}", "function validate_configuration($attr)\r\n {\r\n return array();\r\n }", "public function valid()\n {\n\n if (strlen($this->container['virtual_operator']) > 60) {\n return false;\n }\n if (strlen($this->container['event_type']) > 100) {\n return false;\n }\n if (strlen($this->container['result_status']) > 100) {\n return false;\n }\n if (strlen($this->container['username']) > 100) {\n return false;\n }\n if (strlen($this->container['property_value']) > 450) {\n return false;\n }\n return true;\n }", "public function valid()\n {\n\n if ($this->container['channel_catalog_id'] === null) {\n return false;\n }\n if ($this->container['channel_id'] === null) {\n return false;\n }\n if ($this->container['store_id'] === null) {\n return false;\n }\n return true;\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}", "private function validateCheckout() {\n\n if (!filter_var($this->checkoutUrl, FILTER_VALIDATE_URL))\n $this->errors[] = 'The configuration URL in configuration file is malformed or missing: \"' . $this->checkoutUrl . '\"';\n\n if (empty($this->merchantId) ||\n strlen($this->merchantId) < 36)\n $this->errors[] = 'The configured Merchant ID in configuration file is incorrect or missing: \"'. $this->merchantId .'\"';\n\n //TODO: validate required fields\n\n\n if (count($this->errors) > 0) return false;\n\n return true;\n }", "private function validConfigAggregatorConfig()\n {\n $discoveryClass = $this->discoveryClass;\n $discovery = new $discoveryClass($this->getProjectRoot());\n return $discovery->locate();\n }", "protected function deletePublisherAppConfigRequest($server_name, $vhost_name, $publisher_name, $app_name)\n {\n // verify the required parameter 'server_name' is set\n if ($server_name === null || (is_array($server_name) && count($server_name) === 0)) {\n throw new \\InvalidArgumentException(\n 'Missing the required parameter $server_name when calling deletePublisherAppConfig'\n );\n }\n // verify the required parameter 'vhost_name' is set\n if ($vhost_name === null || (is_array($vhost_name) && count($vhost_name) === 0)) {\n throw new \\InvalidArgumentException(\n 'Missing the required parameter $vhost_name when calling deletePublisherAppConfig'\n );\n }\n // verify the required parameter 'publisher_name' is set\n if ($publisher_name === null || (is_array($publisher_name) && count($publisher_name) === 0)) {\n throw new \\InvalidArgumentException(\n 'Missing the required parameter $publisher_name when calling deletePublisherAppConfig'\n );\n }\n // verify the required parameter 'app_name' is set\n if ($app_name === null || (is_array($app_name) && count($app_name) === 0)) {\n throw new \\InvalidArgumentException(\n 'Missing the required parameter $app_name when calling deletePublisherAppConfig'\n );\n }\n\n $resourcePath = '/v2/servers/{serverName}/vhosts/{vhostName}/applications/{appName}/publishers/{publisherName}';\n $formParams = [];\n $queryParams = [];\n $headerParams = [];\n $httpBody = '';\n $multipart = false;\n\n\n // path params\n if ($server_name !== null) {\n $resourcePath = str_replace(\n '{' . 'serverName' . '}',\n ObjectSerializer::toPathValue($server_name),\n $resourcePath\n );\n }\n // path params\n if ($vhost_name !== null) {\n $resourcePath = str_replace(\n '{' . 'vhostName' . '}',\n ObjectSerializer::toPathValue($vhost_name),\n $resourcePath\n );\n }\n // path params\n if ($publisher_name !== null) {\n $resourcePath = str_replace(\n '{' . 'publisherName' . '}',\n ObjectSerializer::toPathValue($publisher_name),\n $resourcePath\n );\n }\n // path params\n if ($app_name !== null) {\n $resourcePath = str_replace(\n '{' . 'appName' . '}',\n ObjectSerializer::toPathValue($app_name),\n $resourcePath\n );\n }\n\n // body params\n $_tempBody = null;\n\n if ($multipart) {\n $headers = $this->headerSelector->selectHeadersForMultipart(\n ['application/xml', 'text/xml', 'application/json']\n );\n } else {\n $headers = $this->headerSelector->selectHeaders(\n ['application/xml', 'text/xml', 'application/json'],\n ['application/xml', 'text/xml', '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\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 'DELETE',\n $this->config->getHost() . $resourcePath . ($query ? \"?{$query}\" : ''),\n $headers,\n $httpBody\n );\n }", "public static function checkConf()\n\t{\n\t\treturn array( 'convert_attachments' );\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}", "protected function getPublisherAppConfigRequest($server_name, $vhost_name, $publisher_name, $app_name)\n {\n // verify the required parameter 'server_name' is set\n if ($server_name === null || (is_array($server_name) && count($server_name) === 0)) {\n throw new \\InvalidArgumentException(\n 'Missing the required parameter $server_name when calling getPublisherAppConfig'\n );\n }\n // verify the required parameter 'vhost_name' is set\n if ($vhost_name === null || (is_array($vhost_name) && count($vhost_name) === 0)) {\n throw new \\InvalidArgumentException(\n 'Missing the required parameter $vhost_name when calling getPublisherAppConfig'\n );\n }\n // verify the required parameter 'publisher_name' is set\n if ($publisher_name === null || (is_array($publisher_name) && count($publisher_name) === 0)) {\n throw new \\InvalidArgumentException(\n 'Missing the required parameter $publisher_name when calling getPublisherAppConfig'\n );\n }\n // verify the required parameter 'app_name' is set\n if ($app_name === null || (is_array($app_name) && count($app_name) === 0)) {\n throw new \\InvalidArgumentException(\n 'Missing the required parameter $app_name when calling getPublisherAppConfig'\n );\n }\n\n $resourcePath = '/v2/servers/{serverName}/vhosts/{vhostName}/applications/{appName}/publishers/{publisherName}';\n $formParams = [];\n $queryParams = [];\n $headerParams = [];\n $httpBody = '';\n $multipart = false;\n\n\n // path params\n if ($server_name !== null) {\n $resourcePath = str_replace(\n '{' . 'serverName' . '}',\n ObjectSerializer::toPathValue($server_name),\n $resourcePath\n );\n }\n // path params\n if ($vhost_name !== null) {\n $resourcePath = str_replace(\n '{' . 'vhostName' . '}',\n ObjectSerializer::toPathValue($vhost_name),\n $resourcePath\n );\n }\n // path params\n if ($publisher_name !== null) {\n $resourcePath = str_replace(\n '{' . 'publisherName' . '}',\n ObjectSerializer::toPathValue($publisher_name),\n $resourcePath\n );\n }\n // path params\n if ($app_name !== null) {\n $resourcePath = str_replace(\n '{' . 'appName' . '}',\n ObjectSerializer::toPathValue($app_name),\n $resourcePath\n );\n }\n\n // body params\n $_tempBody = null;\n\n if ($multipart) {\n $headers = $this->headerSelector->selectHeadersForMultipart(\n ['application/xml', 'text/xml', 'application/json']\n );\n } else {\n $headers = $this->headerSelector->selectHeaders(\n ['application/xml', 'text/xml', 'application/json'],\n ['application/xml', 'text/xml', '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\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 }", "function instance_allow_config()\r\n\t\t{\r\n\t\t\r\n\t\t}", "public function testValueValid() {\n $config = [\n 'success' => 1,\n 'data' => 'example'\n ];\n $this->assertEmpty($this->getValidator()->validate($config));\n }", "protected function postPublisherAppConfigRequest($server_name, $vhost_name, $publisher_name, $app_name, $body)\n {\n // verify the required parameter 'server_name' is set\n if ($server_name === null || (is_array($server_name) && count($server_name) === 0)) {\n throw new \\InvalidArgumentException(\n 'Missing the required parameter $server_name when calling postPublisherAppConfig'\n );\n }\n // verify the required parameter 'vhost_name' is set\n if ($vhost_name === null || (is_array($vhost_name) && count($vhost_name) === 0)) {\n throw new \\InvalidArgumentException(\n 'Missing the required parameter $vhost_name when calling postPublisherAppConfig'\n );\n }\n // verify the required parameter 'publisher_name' is set\n if ($publisher_name === null || (is_array($publisher_name) && count($publisher_name) === 0)) {\n throw new \\InvalidArgumentException(\n 'Missing the required parameter $publisher_name when calling postPublisherAppConfig'\n );\n }\n // verify the required parameter 'app_name' is set\n if ($app_name === null || (is_array($app_name) && count($app_name) === 0)) {\n throw new \\InvalidArgumentException(\n 'Missing the required parameter $app_name when calling postPublisherAppConfig'\n );\n }\n // verify the required parameter 'body' is set\n if ($body === null || (is_array($body) && count($body) === 0)) {\n throw new \\InvalidArgumentException(\n 'Missing the required parameter $body when calling postPublisherAppConfig'\n );\n }\n\n $resourcePath = '/v2/servers/{serverName}/vhosts/{vhostName}/applications/{appName}/publishers/{publisherName}';\n $formParams = [];\n $queryParams = [];\n $headerParams = [];\n $httpBody = '';\n $multipart = false;\n\n\n // path params\n if ($server_name !== null) {\n $resourcePath = str_replace(\n '{' . 'serverName' . '}',\n ObjectSerializer::toPathValue($server_name),\n $resourcePath\n );\n }\n // path params\n if ($vhost_name !== null) {\n $resourcePath = str_replace(\n '{' . 'vhostName' . '}',\n ObjectSerializer::toPathValue($vhost_name),\n $resourcePath\n );\n }\n // path params\n if ($publisher_name !== null) {\n $resourcePath = str_replace(\n '{' . 'publisherName' . '}',\n ObjectSerializer::toPathValue($publisher_name),\n $resourcePath\n );\n }\n // path params\n if ($app_name !== null) {\n $resourcePath = str_replace(\n '{' . 'appName' . '}',\n ObjectSerializer::toPathValue($app_name),\n $resourcePath\n );\n }\n\n // body params\n $_tempBody = null;\n if (isset($body)) {\n $_tempBody = $body;\n }\n\n if ($multipart) {\n $headers = $this->headerSelector->selectHeadersForMultipart(\n ['application/xml', 'text/xml', 'application/json']\n );\n } else {\n $headers = $this->headerSelector->selectHeaders(\n ['application/xml', 'text/xml', 'application/json'],\n ['application/xml', 'text/xml', '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\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 validateTestData()\n\t{\n\t\t$testDataFileName = $this->config->getTestData();\n\t\tif (!(realpath($testDataFileName) || realpath(Config::$testDataFile))){\n\t\t\t$this->errors['testData'][] = [\n\t\t\t\t'property' => 'testData',\n\t\t\t\t'message' => 'Test data file was not found.'\n\t\t\t];\n\t\t}\n\t}", "protected function getLiveEncoderConfigRequest($server_name, $vhost_name, $app_name, $instance_name, $stream_name, $publish_user, $publish_host, $publish_port)\n {\n // verify the required parameter 'server_name' is set\n if ($server_name === null || (is_array($server_name) && count($server_name) === 0)) {\n throw new \\InvalidArgumentException(\n 'Missing the required parameter $server_name when calling getLiveEncoderConfig'\n );\n }\n // verify the required parameter 'vhost_name' is set\n if ($vhost_name === null || (is_array($vhost_name) && count($vhost_name) === 0)) {\n throw new \\InvalidArgumentException(\n 'Missing the required parameter $vhost_name when calling getLiveEncoderConfig'\n );\n }\n // verify the required parameter 'app_name' is set\n if ($app_name === null || (is_array($app_name) && count($app_name) === 0)) {\n throw new \\InvalidArgumentException(\n 'Missing the required parameter $app_name when calling getLiveEncoderConfig'\n );\n }\n // verify the required parameter 'instance_name' is set\n if ($instance_name === null || (is_array($instance_name) && count($instance_name) === 0)) {\n throw new \\InvalidArgumentException(\n 'Missing the required parameter $instance_name when calling getLiveEncoderConfig'\n );\n }\n // verify the required parameter 'stream_name' is set\n if ($stream_name === null || (is_array($stream_name) && count($stream_name) === 0)) {\n throw new \\InvalidArgumentException(\n 'Missing the required parameter $stream_name when calling getLiveEncoderConfig'\n );\n }\n // verify the required parameter 'publish_user' is set\n if ($publish_user === null || (is_array($publish_user) && count($publish_user) === 0)) {\n throw new \\InvalidArgumentException(\n 'Missing the required parameter $publish_user when calling getLiveEncoderConfig'\n );\n }\n // verify the required parameter 'publish_host' is set\n if ($publish_host === null || (is_array($publish_host) && count($publish_host) === 0)) {\n throw new \\InvalidArgumentException(\n 'Missing the required parameter $publish_host when calling getLiveEncoderConfig'\n );\n }\n // verify the required parameter 'publish_port' is set\n if ($publish_port === null || (is_array($publish_port) && count($publish_port) === 0)) {\n throw new \\InvalidArgumentException(\n 'Missing the required parameter $publish_port when calling getLiveEncoderConfig'\n );\n }\n\n $resourcePath = '/v2/servers/{serverName}/vhosts/{vhostName}/applications/{appName}/instances/{instanceName}/incomingstreams/{streamName}/encoder/live';\n $formParams = [];\n $queryParams = [];\n $headerParams = [];\n $httpBody = '';\n $multipart = false;\n\n // query params\n if ($publish_user !== null) {\n $queryParams['publishUser'] = ObjectSerializer::toQueryValue($publish_user);\n }\n // query params\n if ($publish_host !== null) {\n $queryParams['publishHost'] = ObjectSerializer::toQueryValue($publish_host);\n }\n // query params\n if ($publish_port !== null) {\n $queryParams['publishPort'] = ObjectSerializer::toQueryValue($publish_port);\n }\n\n // path params\n if ($server_name !== null) {\n $resourcePath = str_replace(\n '{' . 'serverName' . '}',\n ObjectSerializer::toPathValue($server_name),\n $resourcePath\n );\n }\n // path params\n if ($vhost_name !== null) {\n $resourcePath = str_replace(\n '{' . 'vhostName' . '}',\n ObjectSerializer::toPathValue($vhost_name),\n $resourcePath\n );\n }\n // path params\n if ($app_name !== null) {\n $resourcePath = str_replace(\n '{' . 'appName' . '}',\n ObjectSerializer::toPathValue($app_name),\n $resourcePath\n );\n }\n // path params\n if ($instance_name !== null) {\n $resourcePath = str_replace(\n '{' . 'instanceName' . '}',\n ObjectSerializer::toPathValue($instance_name),\n $resourcePath\n );\n }\n // path params\n if ($stream_name !== null) {\n $resourcePath = str_replace(\n '{' . 'streamName' . '}',\n ObjectSerializer::toPathValue($stream_name),\n $resourcePath\n );\n }\n\n // body params\n $_tempBody = null;\n\n if ($multipart) {\n $headers = $this->headerSelector->selectHeadersForMultipart(\n ['application/xml', 'text/xml', 'application/json']\n );\n } else {\n $headers = $this->headerSelector->selectHeaders(\n ['application/xml', 'text/xml', 'application/json'],\n ['application/xml', 'text/xml', '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\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 }", "protected function validateParams() {\r\n $ads = $this->ads;\r\n $adsId = $this->adsId;\r\n $lang = $this->getLanguage();\r\n if ($ads === NULL) {\r\n // the ads must exist\r\n $this->addErrorMessage($lang->getMessage('error.adsNotFound', htmlspecialchars($adsId)));\r\n return FALSE;\r\n }\r\n return TRUE;\r\n }", "public function validate()\n {\n parent::validate();\n if ( ! $this->getRelease()\n || in_array($this->getRelease()->getState(), [\n array_search('failed', config('projects.states')),\n array_search('destroyed', config('projects.states'))\n ])\n ) {\n $this->failedValidation($this->getValidatorInstance());\n }\n }", "function isDataValid() \n {\n return true;\n }", "public function validate_payload() {\n if (isset($this->initial_data[\"interface\"])) {\n $this->initial_data[\"interface\"] = APITools\\get_pfsense_if_id($this->initial_data[\"interface\"]);\n # Check that interface exists\n if (is_string($this->initial_data[\"interface\"])) {\n $if_conf = $this->config[\"interfaces\"][$this->initial_data[\"interface\"]];\n # Check that interface hosts a static network with multiple addresses\n if (isset($if_conf[\"enable\"]) and is_ipaddrv4($if_conf[\"ipaddr\"]) and $if_conf[\"subnet\"] <= 31) {\n\n } else {\n $this->errors[] = APIResponse\\get(2019);\n }\n } else {\n $this->errors[] = APIResponse\\get(2018);\n }\n } else {\n $this->errors[] = APIResponse\\get(2017);\n }\n\n # Check for our required 'id' payload value\n if (isset($this->initial_data[\"id\"])) {\n # Ensure this ID exists\n $dhcp_maps = $this->config[\"dhcpd\"][$this->initial_data[\"interface\"]][\"staticmap\"];\n if (array_key_exists($this->initial_data[\"id\"], $dhcp_maps)) {\n $this->id = $this->initial_data[\"id\"];\n } else {\n $this->errors[] = APIResponse\\get(2045);\n }\n } else {\n $this->errors[] = APIResponse\\get(2044);\n }\n }", "public function valid()\n {\n if (!parent::valid()) {\n return false;\n }\n\n if ($this->container['archived'] === null) {\n return false;\n }\n if ($this->container['has_private_key'] === null) {\n return false;\n }\n if ($this->container['not_after'] === null) {\n return false;\n }\n if ($this->container['not_before'] === null) {\n return false;\n }\n if ($this->container['version'] === null) {\n return false;\n }\n return true;\n }", "static function valid_config_fields($array)\n {\n return isset($array['host']) && isset($array['db'])\n && isset($array['dbuser']) && isset($array['dbpass'])\n && isset($array['site-name']) && isset($array['copyright'])\n && isset($array['google']) && (count($array) === 7);\n }", "function readInputData() {\n\t\t$this->readUserVars(array('subscriptionName', 'subscriptionEmail', 'subscriptionPhone', 'subscriptionFax', 'subscriptionMailingAddress', 'subscriptionAdditionalInformation', 'enableDelayedOpenAccess', 'delayedOpenAccessDuration', 'delayedOpenAccessPolicy', 'enableOpenAccessNotification', 'enableAuthorSelfArchive', 'authorSelfArchivePolicy', 'subscriptionExpiryPartial', 'enableSubscriptionOnlinePaymentNotificationPurchaseIndividual', 'enableSubscriptionOnlinePaymentNotificationPurchaseInstitutional', 'enableSubscriptionOnlinePaymentNotificationRenewIndividual', 'enableSubscriptionOnlinePaymentNotificationRenewInstitutional', 'enableSubscriptionExpiryReminderBeforeMonths', 'numMonthsBeforeSubscriptionExpiryReminder', 'enableSubscriptionExpiryReminderBeforeWeeks', 'numWeeksBeforeSubscriptionExpiryReminder', 'enableSubscriptionExpiryReminderAfterWeeks', 'numWeeksAfterSubscriptionExpiryReminder', 'enableSubscriptionExpiryReminderAfterMonths', 'numMonthsAfterSubscriptionExpiryReminder'));\n\n\t\t// If delayed open access selected, ensure a valid duration is provided\n\t\tif ($this->_data['enableDelayedOpenAccess'] == 1) {\n\t\t\t$this->addCheck(new FormValidatorInSet($this, 'delayedOpenAccessDuration', 'required', 'manager.subscriptionPolicies.delayedOpenAccessDurationValid', array_keys($this->validDuration)));\n\t\t}\n\n\t\t// If expiry reminder before months is selected, ensure a valid month value is provided\n\t\tif ($this->_data['enableSubscriptionExpiryReminderBeforeMonths'] == 1) {\n\t\t\t$this->addCheck(new FormValidatorInSet($this, 'numMonthsBeforeSubscriptionExpiryReminder', 'required', 'manager.subscriptionPolicies.numMonthsBeforeSubscriptionExpiryReminderValid', array_keys($this->validNumMonthsBeforeExpiry)));\n\t\t}\n\n\t\t// If expiry reminder before weeks is selected, ensure a valid week value is provided\n\t\tif ($this->_data['enableSubscriptionExpiryReminderBeforeWeeks'] == 1) {\n\t\t\t$this->addCheck(new FormValidatorInSet($this, 'numWeeksBeforeSubscriptionExpiryReminder', 'required', 'manager.subscriptionPolicies.numWeeksBeforeSubscriptionExpiryReminderValid', array_keys($this->validNumWeeksBeforeExpiry)));\n\t\t}\n\n\t\t// If expiry reminder after months is selected, ensure a valid month value is provided\n\t\tif ($this->_data['enableSubscriptionExpiryReminderAfterMonths'] == 1) {\n\t\t\t$this->addCheck(new FormValidatorInSet($this, 'numMonthsAfterSubscriptionExpiryReminder', 'required', 'manager.subscriptionPolicies.numMonthsAfterSubscriptionExpiryReminderValid', array_keys($this->validNumMonthsAfterExpiry)));\n\t\t}\n\n\t\t// If expiry reminder after weeks is selected, ensure a valid week value is provided\n\t\tif ($this->_data['enableSubscriptionExpiryReminderAfterWeeks'] == 1) {\n\t\t\t$this->addCheck(new FormValidatorInSet($this, 'numWeeksAfterSubscriptionExpiryReminder', 'required', 'manager.subscriptionPolicies.numWeeksAfterSubscriptionExpiryReminderValid', array_keys($this->validNumWeeksAfterExpiry)));\n\t\t}\n\t}", "protected function validateSourceData() {\n if (empty($this->query) || !$this->query instanceof ActiveQuery) {\n throw new InvalidConfigException(\n \"The 'query' property must be defined and must be an instance of '\" . ActiveQuery::className() . \"'.\"\n );\n }\n $class = isset($this->query->modelClass) ? $this->query->modelClass : null;\n if (empty($class) || !is_subclass_of($class, ActiveRecord::className())) {\n throw new InvalidConfigException(\"The 'query' must be implemented using 'ActiveRecord::find()' method.\");\n }\n// $trait = 'kartik\\tree\\models\\TreeTrait';\n// if (!self::usesTrait($class, $trait)) {\n// throw new InvalidConfigException(\n// \"The model class '{$class}' for the 'query' must use the trait '{$trait}' or extend from '\" .\n// Tree::className() . \"''.\"\n// );\n// }\n }", "public function validateSource() {\n\t\treturn true;\n\t}", "public function validateConfigurationForm(array &$form, FormStateInterface $form_state);", "public function validate_config_on_save($host) {\n\t\t\tif($host->free_shipping_enabled && !strlen($host->free_shipping_min_amount))\n\t\t\t\t$host->validation->setError('Please specify minimum order amount for free shipping or disable the free shipping option', 'free_shipping_min_amount', true);\n\t\t\t\t\n\t\t\t$hash_value = trim($host->api_key_password); \n\t\t\t\n\t\t\tif(!strlen($hash_value)) { \n\t\t\t\tif(!isset($host->fetched_data['api_key_password']) || !strlen($host->fetched_data['api_key_password'])) \n\t\t\t\t\t$host->validation->setError('Please enter your API key password', 'api_key_password', true); \n\n\t\t\t\t$host->api_key_password = $host->fetched_data['api_key_password']; \n\t\t\t}\n\t\t}", "protected function validate_data_fields(){\n\t\tif(empty($this->RESPONSE)){throw new Exception(\"Response field not found\", 5);}\n\t\t\n\t\t// The remote IP address is also required\n\t\tif($this->validate_ip($this->REMOTE_ADDRESS)){throw new Exception(\"Renote IP address not set correctly\", 6);}\n\t}", "protected function preValidate() {}", "private function config_OSF_DataValidatorTool()\n {\n // Get package info\n $configPath = \"{$this->osf_web_services_folder}/{$this->data_validator_tool_folder}\";\n\n // Configure\n $this->span(\"Configuring...\", 'info');\n // OSF Web Service paths\n $this->setIni(\"OSF-WS-PHP-API\", \"folder\", \"\\\"{$this->osf_web_services_folder}\\\"\",\n \"{$configPath}/dvt.ini\");\n $this->setIni(\"osf\", \"network\", \"\\\"http://{$this->osf_web_services_domain}/ws/\\\"\",\n \"{$configPath}/dvt.ini\");\n // OSF Web Service credentials\n $this->setIni(\"credentials\", \"application-id\", \"\\\"{$this->application_id}\\\"\",\n \"{$configPath}/dvt.ini\");\n $this->setIni(\"credentials\", \"api-key\", \"\\\"{$this->api_key}\\\"\",\n \"{$configPath}/dvt.ini\");\n $this->setIni(\"credentials\", \"user\", \"\\\"http://{$this->osf_web_services_domain}/wsf/users/admin\\\"\",\n \"{$configPath}/dvt.ini\");\n }", "protected function guardAgainstInvalidConfiguration(array $config = null)\n {\n // Here you can add as many checks as your package config needed to\n // consider it valid.\n // @see \\Me\\MyPackage\\Exceptions\\InvalidConfiguration\n if (empty($config['version'])) {\n throw InvalidConfiguration::versionNotSpecified();\n }\n }", "public function checkConfiguration(array $data, ArrayAccess $errors);", "private function checkEmailSettings(): bool\n {\n return (is_array($this->properties['mail_recipients']) || is_array($this->properties['mail_bcc']));\n }", "private function publishesConfig(): void\n {\n $this->publishes([\n __DIR__.'/../config/invite-codes.php' => config_path('invite-codes.php'),\n ], 'invite-codes-config');\n }", "public function checkData() {\n\t\t// e.g. numbers must only have digits, e-mail addresses must have a \"@\" and a \".\".\n\t\treturn $this->control->checkPOST($this);\n\t}", "public function checkData() {\n\t\t// e.g. numbers must only have digits, e-mail addresses must have a \"@\" and a \".\".\n\t\treturn $this->control->checkPOST($this);\n\t}", "protected function validate(&$data,$nonce_name) {\n\t\tglobal $wpdb;\n\t\t$is_valid = parent::validate($data,$nonce_name);\n\t\tif($is_valid && is_array($data)) {\n\t\t\t$is_valid = true ;\n\t\t\t// Check if date is empty\n\t\t\tif(empty($data[\"event_start_date\"])) {\n\t\t\t\t$is_valid = false ;\n\t\t\t\t$this->add_db_result(\"event_start_date\",\"required\",\"Start Date is missing\");\n\t\t\t}\n\t\t\t// Check if date format is valid\n\t\t\telse if($data[\"event_start_date\"] === null) {\n\t\t\t\t$is_valid = false ;\n\t\t\t\t$this->add_db_result(\"event_start_date\",\"field\",\"Start Date format is not valid\");\n\t\t\t}\n\t\t\t// Multi Day Event\n\t\t\t// Check if date format is valid\n\t\t\tif($data[\"event_end_date\"] === null) {\n\t\t\t\t$is_valid = false ;\n\t\t\t\t$this->add_db_result(\"event_end_date\",\"field\",\"End Date is missing\");\n\t\t\t}\n\t\t\t// Check if start date is lower\\equel to end date \n\t\t\tif(!empty($data[\"event_start_date\"]) && !empty($data[\"event_end_date\"])) {\n\t\t\t\tif(strtotime($data[\"event_start_date\"]) > strtotime($data[\"event_end_date\"])) {\n\t\t\t\t\t$is_valid = false ;\n\t\t\t\t\t$this->add_db_result(\"event_end_date\",\"required\",\"Event can't end before it starts\");\n\t\t\t\t}\n\t\t\t} \n\t\t\t\n\t\t\tif(isset($data[\"event_tour_id\"])) {\n\t\t\t\tif(!is_numeric($data[\"event_tour_id\"])) {\n\t\t\t\t\t$is_valid = false;\n\t\t\t\t\t$this->add_db_result(\"event_tour_id\",\"required\",\"Tour information is invalid\");\t\n\t\t\t\t} \n\t\t\t} else {\n\t\t\t\t$tour_name = trim($data[\"tour_name\"]); \n\t\t\t\tif(!empty($tour_name) && !is_numeric($tour_name)) {\n\t\t\t\t\t$is_tour = $wpdb->get_row(\"SELECT tour_id FROM \".WORDTOUR_TOUR.\" WHERE UPPER(tour_name)='\".trim(strtoupper($data[\"tour_name\"]).\"'\"),\"ARRAY_A\");\n\t\t\t\t\tif($is_tour) {\n\t\t\t\t\t\t$data[\"event_tour_id\"] = $is_tour[\"tour_id\"];\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$is_valid = false ;\n\t\t\t\t\t\t$this->add_db_result(\"tour_name\",\"required\",\"Tour '$data[tour_name]' doesn't exist\");\n\t\t\t\t\t}\n\t\t\t\t}\t\n\t\t\t}\n\t\t\n\t\t\tif(isset($data[\"event_venue_id\"])) {\n\t\t\t\tif(!is_numeric($data[\"event_venue_id\"])) {\n\t\t\t\t\t$is_valid = false;\n\t\t\t\t\t$this->add_db_result(\"event_venue_id\",\"required\",\"Venue information is invalid\");\t\n\t\t\t\t} \n\t\t\t} else {\n\t\t\t\tif(empty($data[\"venue_name\"])) {\n\t\t\t\t\t$is_valid = false ;\n\t\t\t\t\t$this->add_db_result(\"venue_name\",\"required\",\"Venue is missing\");\n\t\t\t\t} else if(!is_numeric($data[\"venue_name\"])) {\n\t\t\t\t\t$is_venue = $wpdb->get_row(\"SELECT venue_id FROM \".WORDTOUR_VENUES.\" WHERE UPPER(venue_name)='\".trim(strtoupper($data[\"venue_name\"]).\"'\"),\"ARRAY_A\");\n\t\t\t\t\tif($is_venue) {\n\t\t\t\t\t\t$data[\"event_venue_id\"] = $is_venue[\"venue_id\"];\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$is_valid = false ;\n\t\t\t\t\t\t$this->add_db_result(\"venue_name\",\"required\",\"Venue '$data[venue_name]' doesn't exist\");\n\t\t\t\t\t}\n\t\t\t\t}\t\n\t\t\t}\n\t\t\t\n\t\t\tif(isset($data[\"event_artist_id\"])) {\n\t\t\t\tif(!is_numeric($data[\"event_artist_id\"])) {\n\t\t\t\t\t$is_valid = false;\n\t\t\t\t\t$this->add_db_result(\"event_artist_id\",\"required\",\"Artist information is invalid\");\t\n\t\t\t\t} \n\t\t\t} else {\n\t\t\t\tif(empty($data[\"artist_name\"])) {\n\t\t\t\t\t$is_valid = false ;\n\t\t\t\t\t$this->add_db_result(\"artist_name\",\"required\",\"Artist is missing\");\n\t\t\t\t} else if(!is_numeric($data[\"artist_name\"])) {\n\t\t\t\t\t$is_artist = $wpdb->get_row(\"SELECT artist_id FROM \".WORDTOUR_ARTISTS.\" WHERE UPPER(artist_name)='\".trim(strtoupper($data[\"artist_name\"]).\"'\"),\"ARRAY_A\");\n\t\t\t\t\tif($is_artist) {\n\t\t\t\t\t\t$data[\"event_artist_id\"] = $is_artist[\"artist_id\"];\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$is_valid = false ;\n\t\t\t\t\t\t$this->add_db_result(\"artist_name\",\"required\",\"Artist '$data[artist_name]' doesn't exist\");\n\t\t\t\t\t}\n\t\t\t\t}\t\n\t\t\t}\n\t\t\t\n\t\t\tif(isset($data[\"event_more_artists\"])) {\n\t\t\t\t$more_artists = json_decode(stripslashes($data[\"event_more_artists\"]));\n\t\t\t\t$more_artists_exist_error = array();\n\t\t\t\t$more_artists_error = array();\n\t\t\t\t$more_artists_is_valid = 1;\n\t\t\t\t$more_artists_id = array();\n\t\t\t\tif(is_array($more_artists)) {\n\t\t\t\t\tforeach($more_artists as $artist_name) {\n\t\t\t\t\t\t$name = addslashes(trim(strtoupper($artist_name)));\n\t\t\t\t\t\tif(!empty($name)) {\n\t\t\t\t\t\t\t// check if artist exist in the system\n\t\t\t\t\t\t\t$is_artist = $wpdb->get_row($wpdb->prepare(\"SELECT artist_id FROM \".WORDTOUR_ARTISTS.\" WHERE UPPER(artist_name)='\".$name.\"'\"),\"ARRAY_A\");\n\t\t\t\t\t\t\t//print_r($wpdb);\n\t\t\t\t\t\t\tif(!$is_artist) {\n\t\t\t\t\t\t\t\t$is_valid = false ;\n\t\t\t\t\t\t\t\t$more_artists_is_valid = 0;\n\t\t\t\t\t\t\t\t$more_artists_exist_error[] = \"<i>'$artist_name'</i>\";\t\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tif($name == trim(strtoupper($data[\"artist_name\"]))) {\n\t\t\t\t\t\t\t\t\t$is_valid = false ;\n\t\t\t\t\t\t\t\t\t$more_artists_is_valid = 0;\n\t\t\t\t\t\t\t\t\t$more_artists_error[] = \"Additional Artist <i>'$artist_name'</i> is already assigned\";\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t$more_artists_id[] = $is_artist[\"artist_id\"]; \n\t\t\t\t\t\t\t\t}\t\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\t\n\t\t\t\t\tif(!$more_artists_is_valid) {\n\t\t\t\t\t\t$more_artists_msg = \"\"; \n\t\t\t\t\t\tif(count($more_artists_exist_error)>0) {\n\t\t\t\t\t\t\t$more_artists_msg.= \"Additional Artist \".implode(\", \",$more_artists_exist_error).\" doesn't exist, \";\t\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif(count($more_artists_error)>0) {\n\t\t\t\t\t\t\t$more_artists_msg.= implode(\", \",$more_artists_error);\n\t\t\t\t\t\t}\n\t\t\t\t\t\t$this->add_db_result(\"event_more_artists\",\"required\",$more_artists_msg);\t\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$data[\"event_more_artists\"] = array_unique($more_artists_id);\n\t\t\t\t\t} \n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\tif(!empty($data[\"tkts_url\"]) && !is_valid_url($data[\"tkts_url\"])) {\n\t\t\t\t$is_valid = false ;\n\t\t\t\t$this->add_db_result(\"tkts_url\",\"required\",\"Buy Tickt url in not valid, the required format is http://your_website_url\");\t\n\t\t\t}\n\t\t\t\n\t\t\tif(!$is_valid) $this->db_result(\"error\",null,array(\"data\"=>$this->db_response_msg));\t\t\n\t\t}\n\t\treturn $is_valid;\n\t}", "function checkConfig() {\n $config = CRM_Core_Config::singleton( );\n\n $error = array( );\n\n if (empty($this->_paymentProcessor['user_name'])) {\n $error[] = ts('Merchant ID is not set in the Administer CiviCRM &raquo; Payment Processor.');\n }\n if (empty($this->_paymentProcessor['password'])) {\n $error[] = ts('Password is not set in the Administer CiviCRM &raquo; Payment Processor.');\n }\n \n if (!empty($error)) {\n return implode('<p>', $error);\n }\n\n return null;\n\t}", "public function valid()\n {\n if (count($this->data) < 1) {\n if ($this->provider instanceof \\Closure) {\n $this->data = $this->provider->__invoke($this->key);\n } else {\n $this->data = $this->manuallyAddedData;\n $this->manuallyAddedData = array();\n }\n }\n\n return count($this->data) > 0;\n }", "private function validate () {\n $payload = $this->payload;\n // Unset fields that don't match the spec\n foreach (array_keys($payload) as $field) {\n if (!in_array($field, $this->fields)) {\n unset($payload[$field]);\n }\n }\n\n // If the user is signing up manually (I.e. not via a social network), then\n // we also need a password\n if ($this->method === 'manual' && empty($payload['password'])) {\n return false;\n }\n\n $this->payload = $payload;\n return true;\n }", "public function validateData(){\n return true;\n }", "public function isValidVendor() {\n\t\t$input = file_get_contents('php://input');\n\t\t$_POST = json_decode($input, TRUE);\n\n\t\t// if no splits then vendor_id is required otherwise MUST be NULL (will be ignored in Save)\n\t\tif (empty($_POST['splits']) && empty($_POST['vendor_id'])) {\n\t\t\t$this->form_validation->set_message('isValidVendor', 'The Vendor Field is Required');\n\t\t\treturn FALSE;\n\t\t}\n\t\treturn TRUE;\n\t}", "public function isValid($data)\n {\n // populate root options according to selected menu.\n $menu = isset($data['config']['menu'])\n ? $data['config']['menu']\n : '';\n $this->_loadRootOptions($menu);\n\n return parent::isValid($data);\n }" ]
[ "0.65937406", "0.63652235", "0.6356139", "0.6249657", "0.59997827", "0.58409977", "0.58204776", "0.5801136", "0.5783785", "0.5775839", "0.5659375", "0.561419", "0.5550804", "0.55022484", "0.5473128", "0.5472512", "0.5472512", "0.5472171", "0.54703027", "0.5464649", "0.54235435", "0.5422496", "0.5422107", "0.5413093", "0.540253", "0.5393697", "0.5387546", "0.5378595", "0.5351974", "0.535107", "0.5321755", "0.53206295", "0.5315671", "0.5307", "0.5294104", "0.52776986", "0.52718383", "0.52668464", "0.5265637", "0.52485275", "0.5243984", "0.52436113", "0.5243124", "0.5232745", "0.5221348", "0.520651", "0.5205341", "0.5202151", "0.51966614", "0.51853466", "0.5176249", "0.5173728", "0.51718205", "0.5170944", "0.51575905", "0.51567787", "0.5156389", "0.51551026", "0.5152836", "0.5152556", "0.5151787", "0.5151201", "0.51452076", "0.51396006", "0.5134579", "0.5133533", "0.51326233", "0.51226944", "0.5120631", "0.5110978", "0.5108038", "0.5102168", "0.508946", "0.5071852", "0.5057876", "0.5054916", "0.5052134", "0.5046461", "0.5035741", "0.50346565", "0.5018804", "0.501747", "0.5013648", "0.5010655", "0.50042176", "0.5001586", "0.5001228", "0.49986845", "0.49948263", "0.49917394", "0.4989613", "0.49876234", "0.49876234", "0.49829575", "0.498263", "0.49797016", "0.4965615", "0.49616542", "0.49615356", "0.49565634" ]
0.6506943
1
Normalizes a map child element.
protected function _normalizeChild($child, $config = null) { if (is_scalar($child) || is_null($child)) { return $this->_normalizeSimpleChild($child, $config); } return $this->_normalizeComplexChild($child, $config); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "abstract protected function _normalizeSimpleChild($child, $config);", "protected function normalize() {}", "private function normalize_distribution_info()\r\n {\r\n $distribution_info=$this->get_key_value('distribution_info');\r\n \r\n $output=array();\r\n $columns=array_keys($this->xpath_map['distribution_info']['items']);\r\n \r\n //there could be multiple distribution info tags\r\n //combine all into one array\r\n foreach($distribution_info as $row)\r\n {\r\n foreach($row as $key=>$value)\r\n {\r\n foreach($value as $val){\r\n $output[$key][]=$val;\r\n }\r\n }\r\n }\r\n \r\n $distribution_info=$output;\r\n $output=array();\r\n \r\n //create associated array\r\n foreach($distribution_info as $key=>$value)\r\n {\r\n $k=0;\r\n foreach($value as $val)\r\n {\r\n $output[$k][$key]=$val;\r\n $k++;\r\n }\r\n \r\n }\r\n \r\n $this->xpath_map['distribution_info']['data']=$output; \r\n }", "public function rebuildFromBase( EntityMap $map ): void {\n $current = clone $this;\n\n $this->key = $map->key;\n if ( $current->key !== null ) {\n $this->key = $current->key;\n }\n\n $this->inboundMap = array_merge( $map->inboundMap, $current->inboundMap );\n $this->outboundMap = $map->outboundMap;\n foreach ( $current->outboundMap as $propName => $mapping ) {\n if ( is_string( $mapping ) ) {\n $this->outboundMap[$propName] = $mapping;\n continue;\n }\n\n $baseMapping = array_key_exists( $propName, $map->outboundMap )? $map->outboundMap[$propName] : [];\n $this->outboundMap[$propName] = array_merge( $baseMapping, $mapping );\n }\n\n unset( $current );\n }", "protected function normalize(): void\n {\n $coordinate = new BaseCoordinate(array(0, $this->value));\n $latitude = (float)$coordinate->getLongitude();\n\n $this->value = $latitude;\n }", "private function _normalize($list) {\n // If an array wasn't submitted there's nothing to do...\n if (!is_array($list)) {\n return $list;\n }\n $ret = array();\n\n foreach ($list as $key => $val) {\n $val['location'] = isset($val['location']) ? $val['location'] : $key;\n $val['label'] = isset($val['label']) ? $val['label'] : $key;\n $val['class'] = isset($val['class']) ? ' '.$val['class'] : '';\n $val['id'] = isset($val['id']) ? \" id='{$val['id']}'\" : '';\n \n if (isset($val['parent_id'])) {\n if ( isset($ret[$val['parent_id']])) { \n // if parent doesn't exist, the children wont either\n $ret[$val['parent_id']]['children'][$key] = $val;\n }\n } else {\n $ret[$key] = $val;\n }\n }\n return $ret;\n }", "public function normalize()\n {\n }", "protected static function normalize(DOMDocument $ir)\n\t{\n\t\tself::addDefaultCase($ir);\n\t\tself::addElementIds($ir);\n\t\tself::addCloseTagElements($ir);\n\t\tself::markEmptyElements($ir);\n\t\tself::optimize($ir);\n\t\tself::markConditionalCloseTagElements($ir);\n\t\tself::setOutputContext($ir);\n\t\tself::markBranchTables($ir);\n\t}", "function prepare_map ($map) {\r\n\t\tif (!$map) return false;\r\n\t\t$markers = unserialize(@$map['markers']);\r\n\t\t$options = unserialize(@$map['options']);\r\n\t\t$post_ids = unserialize(@$map['post_ids']);\r\n\t\t$defaults = get_option('agm_google_maps');\r\n\r\n\t\t// Data is force-escaped by WP, so compensate for that\r\n\t\t$result = array_map('stripslashes_deep', array(\r\n\t\t\t\"markers\" => $markers,\r\n\t\t\t\"defaults\" => $defaults,\r\n\t\t\t\"post_ids\" => array_values($post_ids), // Reindex the array, so it doesn't turn up as JSON object\r\n\t\t\t\"id\" => @$map['id'],\r\n\t\t\t\"title\" => @$map['title'],\r\n\t\t\t\"height\" => @$options['height'],\r\n\t\t\t\"width\" => @$options['width'],\r\n\t\t\t\"zoom\" => @$options['zoom'],\r\n\t\t\t\"map_type\" => @$options['map_type'],\r\n\t\t\t\"map_alignment\" => @$options['map_alignment'],\r\n\t\t\t\"show_map\" => @$options['show_map'],\r\n\t\t\t\"show_posts\" => @$options['show_posts'],\r\n\t\t\t\"show_markers\" => @$options['show_markers'],\r\n\t\t\t\"show_images\" => @$options['show_images'],\r\n\t\t\t\"image_size\" => @$options['image_size'],\r\n\t\t\t\"image_limit\" => $options['image_limit'],\r\n\t\t\t\"show_panoramio_overlay\" => @$options['show_panoramio_overlay'],\r\n\t\t\t\"panoramio_overlay_tag\" => @$options['panoramio_overlay_tag'],\r\n\t\t\t\"street_view\" => @$options['street_view'],\r\n\t\t\t\"street_view_pos\" => @$options['street_view_pos'],\r\n\t\t\t\"street_view_pov\" => @$options['street_view_pov'],\r\n\t\t));\r\n\r\n\t\tif (isset($map['blog_id'])) $result['blog_id'] = $map['blog_id'];\r\n\r\n\t\treturn $result;\r\n\t}", "protected function mapChild($dest=[]){\n\n\t\tswitch(gettype($dest)){\n\n\t\t\tcase \"array\":\n\n\t\t\t\tif (count($dest)==0) $mymap = $this::$map;else \n\n\t\t\t\t\teval('$mymap = $this::$map[\"'.implode('\"][\"',$dest).'\"];');\t\n\n\t\t\t\tbreak;\n\n\t\t\tcase \"string\":\n\n\t\t\t\tif ($dest==\"\") $mymap = $this::$map;else \n\n\t\t\t\t\teval('$mymap = $this::$map[\"'.str_replace('_','\"][\"',$dest).'\"];');\t\n\n\t\t\t\tbreak;\n\n\t\t\tdefault :\n\n\t\t\t\tif ($dest==$this::$root) $mymap = $this::$map;else \n\n\t\t\t\t\teval('$mymap = $this::$map[\"'.implode('\"][\"',$dest->address).'\"];');\n\n\t\t}\t\n\n\t\treturn array_keys($mymap);\n\n\t}", "public function handle( ezcDocumentElementVisitorConverter $converter, DOMElement $node, $root )\n {\n if ( !isset( $this->mapping[$node->tagName] ) )\n {\n $converter->triggerError( E_WARNING,\n \"Mapping handler used for element '{$node->tagName}', not known by the mapping handler.\"\n );\n return $root;\n }\n\n $element = $root->ownerDocument->createElement( $this->mapping[$node->tagName] );\n $root->appendChild( $element );\n\n // Recurse\n $converter->visitChildren( $node, $element );\n return $root;\n }", "public function normalize(): self;", "public function exportNormalizationMap()\r\n\t{\r\n\t\t$query = 'SELECT keyword, ingredientID\r\n\t\t\tFROM normalizationMap';\r\n\t\t$this->_db->setQuery($query);\r\n\t\t$normalizationMap = $this->_db->loadAssocList();\r\n\t\treturn $normalizationMap;\r\n\t}", "protected function _normalizeComplexChild($child, $config = null)\n {\n return $this->_createChildInstance($child, $config);\n }", "public function transform(Row $row)\n {\n foreach($this->columns as $key => $value) {\n $districtName = $row->get($value);\n $row->remove($value);\n $row->set('district', trim($this->districts[$districtName]));\n }\n }", "public function processCmdmap_postProcess($command, $table, $id, $value, &$parentObject) {\n\t\tif (!(($table == 'pages') || ($table == 'tt_content'))) {\n\t\t\t// Guard clause\n\t\t\treturn;\n\t\t}\n\t\t$this->parentObject = &$parentObject;\n\t\tswitch ($command) {\n\n\t\t\tcase 'move':\n\t\t\t\t// Moving tt_content elements is handled in \"moveRecord_firstElementPostProcess\"\n\t\t\t\t// and \"moveRecord_afterAnotherElementPostProcess\"\n\t\t\tbreak;\n\n\t\t\tcase 'copy':\n\t\t\t\tif ($table == 'pages') {\n\t\t\t\t\t// A page has been copied.\n\t\t\t\t\t// Just take care all elements contained in kb_nescefe elements get set properly.\n\t\t\t\t\t// The UIDs of all copied element can be found in the copyMappingArray class variable\n\t\t\t\t\t$this->remapNescefeContents();\n\t\t\t\t} else {\n\t\t\t\t\t// Single elements get copied.\n\t\t\t\t\t// Take care that elements contained inside kb_nescefe elements get copied as well.\n\t\t\t\t\t$this->remapNescefeContents(TRUE);\n\t\t\t\t}\n\t\t\tbreak;\n\n\t\t\tcase 'localize':\n\t\t\t\tif ($table == 'tt_content') {\n\t\t\t\t\t$this->remapNescefeContents(TRUE, intval($value));\n\t\t\t\t}\n\t\t\tbreak;\n\n\t\t\tcase 'delete':\n\t\t\t\t// Implemented in \"processCmdmap_preProcess\"\n\t\t\tbreak;\n\n\t\t\tcase 'undelete':\n\t\t\t\t// \"undelete\" is performed in the postProcess routine. So first the container will get restored\n\t\t\t\t// and afterwards all the elements inside the container\n\t\t\t\tif ($table === 'tt_content') {\n\t\t\t\t\t$this->processDelete($id, 'undelete');\n\t\t\t\t}\n\t\t\tbreak;\n\n\t\t\t\t// Not implemented currently\n\t\t\tcase 'inlineLocalizeSynchronize':\n\t\t\tcase 'version':\n\t\t\tdefault:\n\t\t\tbreak;\n\t\t}\n\t}", "protected function normalize($value)\n {\n if (null === $this->normalizationTransformer) {\n return $value;\n }\n return $this->normalizationTransformer->transform($value);\n }", "private function _checkMap()\n {\n foreach($this->_map as $alias => $field)\n {\n if(!is_array($field))\n {\n $this->_map[$alias] = array(\n self::MAP_FIELD => $field\n );\n }\n if(isset($field[self::MAP_TYPE]) && in_array($field[self::MAP_TYPE],\n self::$_relationTypes))\n {\n switch($field[self::MAP_TYPE])\n {\n case self::RELATION_PARENT:\n if(empty($field[self::MAP_KEY]) || empty($field[self::MAP_FOREIGN_KEY]))\n {\n $mapper = $field[self::MAP_MAPPER];\n $mapper = new $mapper();\n }\n if(empty($field[self::MAP_KEY]))\n {\n $field[self::MAP_KEY] = $mapper->getKeyField();\n }\n if(empty($field[self::MAP_FOREIGN_KEY]))\n {\n $field[self::MAP_FOREIGN_KEY] = $alias . ucfirst($mapper->getKeyField());\n }\n break;\n\n case self::RELATION_CHILD:\n case self::RELATION_CHILDREN:\n if(empty($field[self::MAP_KEY]))\n {\n $field[self::MAP_KEY] = $this->getKeyField();\n }\n if(empty($field[self::MAP_FOREIGN_KEY]))\n {\n /** @var Core_Entity_Mapper_Abstract */\n $mapper = $field[self::MAP_MAPPER];\n $mapper = new $mapper();\n $backRelation = $mapper->_findRelationToMapperSettings(get_class($this),\n self::RELATION_PARENT);\n if($backRelation != null && !empty($backRelation[self::MAP_FOREIGN_KEY]))\n {\n $field[self::MAP_FOREIGN_KEY] = $backRelation[self::MAP_FOREIGN_KEY];\n }\n else\n {\n $field[self::MAP_FOREIGN_KEY] = $this->_getPureModelNameField() . ucfirst($this->getKeyField());\n }\n }\n if(!isset($field[self::MAP_SAVE]))\n {\n $field[self::MAP_SAVE] = true;\n }\n if(!isset($field[self::MAP_DELETE]))\n {\n $field[self::MAP_DELETE] = true;\n }\n break;\n\n case self::RELATION_M2M:\n /** @var Core_Entity_Mapper_Abstract */\n $targetMapper = $field[self::MAP_MAPPER];\n $targetMapper = new $targetMapper();\n\n /** @var Core_Entity_Mapper_Abstract */\n $middleMapper = $field[self::MAP_MIDDLE_MAPPER];\n $middleMapper = new $middleMapper();\n if(empty($field[self::MAP_KEY]))\n {\n $field[self::MAP_KEY] = $this->getKeyField();\n }\n if(empty($field[self::MAP_FOREIGN_KEY]))\n {\n $backRelation = $middleMapper->_findRelationToMapperSettings(get_class($this),\n self::RELATION_PARENT);\n if($backRelation == null)\n {\n throw new Core_Entity_Exception('Middle Mapper Not configured for m2m relation \"' . get_class($this) . '->' . get_class($middleMapper) . '\"');\n }\n if($backRelation != null && !empty($backRelation[self::MAP_FOREIGN_KEY]))\n {\n $field[self::MAP_FOREIGN_KEY] = $backRelation[self::MAP_FOREIGN_KEY];\n }\n else\n {\n $field[self::MAP_FOREIGN_KEY] = $this->_getPureModelNameField() . ucfirst($this->getKeyField());\n }\n }\n $field[self::MAP_SAVE] = false;\n $field[self::MAP_DELETE] = false;\n break;\n\n default:\n $log = Core_Log_Manager::getInstance()->getLog('default');\n if(!empty($log))\n {\n $log->log(\"[\" . get_class($this) . \"]\\t\" . 'Unknown relation type \"' . $field[self::MAP_TYPE] . '\"',\n Zend_Log::NOTICE);\n }\n throw new Core_Entity_Exception('Unknown relation type \"' . $field[self::MAP_TYPE] . '\"');\n break;\n }\n $this->_map[$alias] = $field;\n }\n }\n }", "function getSimplifiedElements() {\n\t\t\t$newelements = array();\n\t\t\tforeach($this->page_object as $current_row) {\n\t\t\t\t## process the rows- first we need to find out how many entries\n\t\t\t\tforeach($current_row as $current_element) {\n\t\t\t\t\t## here we start calling all our attribute types\n\t\t\t\t\tif(is_array($current_element)) {\n\t\t\t\t\t\t$newelements[] = $current_element;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\t\t\t\t\n\t\t\treturn $newelements;\n }", "public function unFlattenNode(&$node, $name) {\n\t\t$domElement = $this->getChildNode($node, $name);\n\t\tif (!is_null($domElement) && $this->extractNodeText($domElement) !== '') {\n\t\t\t$tempDoc = new \\DOMDocument();\n\t\t\t$tempDoc->loadXML('<temp>'.$this->extractNodeText($domElement).'</temp>');\n\t\t\t\n\t\t\tif ($tempDoc->childNodes->length !== 1 || !($tempDoc->childNodes->item(0) instanceof \\DOMElement)) {\n\t\t\t\tthrow new ComhonException('wrong xml, XMLInterfacer manage xml with one and only one root node');\n\t\t\t}\n\t\t\t$toRemove = [];\n\t\t\tforeach ($domElement->childNodes as $child) {\n\t\t\t\t$toRemove[] = $child;\n\t\t\t}\n\t\t\tforeach ($toRemove as $child) {\n\t\t\t\t$domElement->removeChild($child);\n\t\t\t}\n\t\t\tforeach ($tempDoc->childNodes->item(0)->childNodes as $child) {\n\t\t\t\t$childNode = $this->domDocument->importNode($child, true);\n\t\t\t\t$domElement->appendChild($childNode);\n\t\t\t}\n\t\t}\n\t}", "public function normalize($node) {\n\t\tif (is_array($node)) {\n\t\t\t$node = array_values($node);\n\t\t\t$primary = 'id';\n\n\t\t\tif (!is_object($node[0])) {\n\t\t\t\t$node[0] = ClassRegistry::init($node[0]);\n\t\t\t}\n\n\t\t\t$node[0]->id = $node[1];\n\t\t\treturn $node[0];\n\t\t}\n\n\t\treturn $node;\n\t}", "public function updateMap(){\n $out = '';\n\n preg_match( '/<phpDBMapper:map>(.*)<\\/phpDBMapper:map>/s', $this->template, $m );\n\n foreach( $this->tableMapper as $c ){\n $tmp = $m[1];\n\n foreach( $c as $key=>$val ){\n $tmp = str_replace( '%'. $key .'%', $val, $tmp );\n $tmp = str_replace(array(\"\\n\", \"\\r\"), '', $tmp);\n }\n\n $out .= $tmp . \"\\n\";\n }\n\n $this->template = preg_replace( '/<phpDBMapper:map[^>]*?>.*?<\\/phpDBMapper:map>/is', $out, $this->template );\n return $this->template;\n }", "protected abstract function map();", "function automap_tree_to_map_config($MAPCFG, &$params, &$saved_config, &$map_config, &$tree) {\n if(isset($map_config[$tree['object_id']])) {\n return;\n }\n\n $map_config[$tree['object_id']] = $tree;\n \n // Remove internal attributes here\n unset($map_config[$tree['object_id']]['.childs']);\n unset($map_config[$tree['object_id']]['.parents']);\n\n foreach($tree['.childs'] AS $child) {\n automap_tree_to_map_config($MAPCFG, $params, $saved_config, $map_config, $child);\n $line = automap_connector($MAPCFG, $params, $saved_config, $tree, $child);\n $map_config[$line['object_id']] = $line;\n }\n\n foreach($tree['.parents'] AS $parent) {\n automap_tree_to_map_config($MAPCFG, $params, $saved_config, $map_config, $parent);\n $line = automap_connector($MAPCFG, $params, $saved_config, $tree, $parent);\n $map_config[$line['object_id']] = $line;\n }\n}", "public function transform(TreeCollection $collection)\n {\n return array_map([$this, 'transformEntry'], $collection->getEntries());\n }", "public function processCmdmap_afterFinish(\\TYPO3\\CMS\\Core\\DataHandling\\DataHandler $parentObject) {\n\t\tif (is_array($parentObject->moveInfo) && count($parentObject->moveInfo)) {\n\t\t\tforeach ($parentObject->moveInfo as $id => $param) {\n\t\t\t\t$this->sanitizeRecordValues($id);\n\t\t\t\tif ($param === 'container') {\n\t\t\t\t\t// When moving a container take care all elements inside get also moved\n\t\t\t\t\t$this->moveContainedElements($id);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (is_array($this->parentObject->copyMappingArray['tt_content'])) {\n\t\t\tforeach ($this->parentObject->copyMappingArray['tt_content'] as $origUid => $newUid) {\n\t\t\t\t$this->sanitizeRecordValues($newUid);\n\t\t\t}\n\t\t}\n\t}", "function get_all_posts_maps () {\r\n\t\t$table = $this->get_table_name();\r\n\t\t$maps = $this->wpdb->get_results(\"SELECT * FROM {$table} WHERE post_ids <> 'a:0:{}'\", ARRAY_A);\r\n\t\tif (is_array($maps)) foreach ($maps as $k=>$v) {\r\n\t\t\t$maps[$k] = $this->prepare_map($v);\r\n\t\t}\r\n\t\treturn $maps;\r\n\t}", "public function elements_sanitize( $input )\n {\n $new_input = array();\n foreach ($this->elements as $id => $title) {\n if( isset( $input[$id] ) ){\n $new_input[$id] = sanitize_text_field( $input[$id] );\n }else{\n $new_input[$id] = '';\n }\n\n if( !isset( $input[$id . '_important'] ) )\n $new_input[$id . '_important'] = 0 ;\n else\n $new_input[$id . '_important'] = intval($input[$id . '_important']);\n\n if( isset( $input[$id . '_weight'] ) )\n $new_input[$id . '_weight'] = sanitize_text_field($input[$id . '_weight']);\n\n }\n\n return $new_input;\n }", "function _postProcess() {\r\n $item = current($this->_struct);\r\n \r\n $ret = array('_name'=>$item['tag'], '_attributes'=>array(), '_value'=>null);\r\n\r\n if (isset($item['attributes']) && count($item['attributes'])>0) {\r\n foreach ($item['attributes'] as $key => $data) {\r\n if (!is_null($data)) {\r\n $item['attributes'][$key] = str_replace($this->_replaceWith, $this->_replace, $item['attributes'][$key]);\r\n }\r\n }\r\n $ret['_attributes'] = $item['attributes'];\r\n if ($this->attributesDirectlyUnderParent)\r\n $ret = array_merge($ret, $item['attributes']);\r\n }\r\n\r\n if (isset($item['value']) && $item['value'] != null)\r\n $item['value'] = str_replace($this->_replaceWith, $this->_replace, $item['value']);\r\n \r\n switch ($item['type']) {\r\n case 'open':\r\n $children = array();\r\n while (($child = next($this->_struct)) !== FALSE ) {\r\n if ($child['level'] <= $item['level'])\r\n break;\r\n \r\n $subItem = $this->_postProcess();\r\n \r\n if (isset($subItem['_name'])) {\r\n if (!isset($children[$subItem['_name']]))\r\n $children[$subItem['_name']] = array();\r\n \r\n $children[$subItem['_name']][] = $subItem;\r\n }\r\n else {\r\n foreach ($subItem as $key=>$value) {\r\n if (isset($children[$key])) {\r\n if (is_array($children[$key]))\r\n $children[$key][] = $value;\r\n else\r\n $children[$key] = array($children[$key], $value);\r\n }\r\n else {\r\n $children[$key] = $value;\r\n }\r\n }\r\n }\r\n }\r\n \r\n if ($this->childTagsDirectlyUnderParent)\r\n $ret = array_merge($ret, $this->_condenseArray($children));\r\n else\r\n $ret['_value'] = $this->_condenseArray($children);\r\n \r\n break;\r\n case 'close':\r\n break;\r\n case 'complete':\r\n if (count($ret['_attributes']) > 0) {\r\n if (isset($item['value']))\r\n $ret['_value'] = $item['value'];\r\n }\r\n else {\r\n\t\t\tif (isset($item['value'])) {\r\n\t\t\t\t$ret = array($item['tag']=> $item['value']);\r\n\t\t\t} else {\r\n\t\t\t\t$ret = array($item['tag']=> \"\");\r\n\t\t\t}\r\n }\r\n break;\r\n }\r\n\r\n //added by Dan Coulter\r\n\r\n \r\n /*\r\n foreach ($ret as $key => $data) {\r\n if (!is_null($data) && !is_array($data)) {\r\n $ret[$key] = str_replace($this->_replaceWith, $this->_replace, $ret[$key]);\r\n }\r\n }\r\n */\r\n return $ret;\r\n }", "protected function mapEmbedded(&$root)\n {\n if (is_array($root) && isset($root['_embedded']) && is_array($root['_embedded']))\n {\n foreach ($root['_embedded'] as $property => $data)\n {\n $root[$property] = $data;\n }\n $this->mapEmbedded($root['_embedded']);\n }\n\n return $root;\n }", "function map_deep($value, $callback)\n {\n }", "public function getNormalizedData()\n {\n return parent::getNormalizedData();\n }", "private function offsetTransform($element)\n {\n// // First close any open spans\n// for ($i = $this->numberOfOpenElements('span', 'div'); $i>0; $i--)\n// {\n// $this->addPageElement('</span>', 0);\n// }\n//\n// $element->rotationOffset = IdmlBoundary::getOffsetHeight($element);\n// $this->addPageElement('<div style=\"height:' . $element->rotationOffset . 'px;\">', 0);\n// $this->addPageElement('</div>', 0);\n }", "protected function normalize_attribute($name, $value)\n {\n }", "public function vc_after_mapping() {\n\t\tvc_lean_map( 'vcex_image_grid', array( $this, 'map' ) );\n\n\t\tif ( 'vc_edit_form' === vc_post_param( 'action' ) ) {\n\t\t\tadd_filter( 'vc_edit_form_fields_attributes_vcex_image_grid', array( $this, 'edit_form_fields' ) );\n\t\t}\n\t}", "public function setMapValue($name=null);", "private function normalize_keywords()\r\n {\r\n /*\r\n 'ident_keywords' => array(\r\n 'type'=>'complex',\r\n 'is_repeated'=>true,\r\n 'xpath'=>'//gmd:identificationInfo/gmd:MD_DataIdentification/gmd:descriptiveKeywords/gmd:MD_Keywords',\r\n 'items'=>array(\r\n 'keyword'=> array(\r\n 'type'=>'array',\r\n 'xpath'=>'gmd:keyword',\r\n 'is_repeated'=>true,\r\n ),\r\n 'type'=> array(\r\n 'type'=>'text',\r\n 'xpath'=>'gmd:type',\r\n 'is_repeated'=>false\r\n ),\r\n 'thesaurus'=> array(\r\n 'type'=>'text',\r\n 'xpath'=>'gmd:thesaurusName/gmd:CI_Citation/gmd:title',\r\n 'is_repeated'=>false\r\n )\r\n )\r\n ),\r\n */\r\n \r\n $keywords=$this->xpath_map['ident_keywords']['data'];\r\n \r\n $output=array();\r\n foreach($keywords as $row)\r\n {\r\n foreach($row['keyword'] as $keyword)\r\n { \r\n $output[]=array(\r\n 'keyword' => $keyword,\r\n 'type' => @$row['type'],\r\n 'thesaurus' => @$row['thesaurus'] \r\n ); \r\n }\r\n }\r\n $this->xpath_map['ident_keywords']['data']=$output;\r\n }", "public function normalize() {\n return $this->div($this->norm());\n }", "public static function createFromDOM( \\DOMElement $element, Metadata $metadata ): EntityMap {\n $map = new static();\n\n $x = new \\DOMXPath( $element->ownerDocument );\n $x->registerNamespace( 'edmx', Metadata::NS_EDMX );\n $x->registerNamespace( 'edm', Metadata::NS_EDM );\n\n $map->name = $element->getAttribute( 'Name' );\n $map->key = $x->evaluate( 'string(edm:Key/edm:PropertyRef/@Name)', $element );\n if ( $map->key === '' ) {\n $map->key = null;\n }\n\n $map->isAbstract = $element->hasAttribute( 'Abstract' ) && $element->getAttribute( 'Abstract' ) === 'true';\n $map->baseEntity = $element->hasAttribute( 'BaseType' )? $metadata->stripNamespace( $element->getAttribute( 'BaseType' ) ) : null;\n\n $propertiesList = $x->query( 'edm:Property', $element );\n foreach ( $propertiesList as $propertyElement ) {\n /**\n * @var \\DOMElement $propertyElement\n */\n $propertyName = $propertyElement->getAttribute( 'Name' );\n $concretePropertyName = preg_replace( '~^_(.*)_value$~', '$1', $propertyName );\n\n /*\n * Build the inbound map.\n *\n * As-is properties by default, _(.*)_value => $1\n */\n $map->inboundMap[$propertyName] = $concretePropertyName;\n\n /**\n * Build the field type map. Mapped are the real CRM field names.\n */\n $map->fieldTypes[$concretePropertyName] = $propertyElement->getAttribute( 'Type' );\n\n /*\n * Build the outbound map.\n *\n * As-is properties by default.\n * For _(.*)_value, find corresponding navigation properties.\n * We get a map $1 => [ Type => NavigationPropertyName ]\n */\n $referentialConstraints = $x->query( \"edm:NavigationProperty/edm:ReferentialConstraint[@Property='{$propertyName}']\", $element );\n if ( !$referentialConstraints->length ) {\n $map->outboundMap[$propertyName] = $propertyName;\n continue;\n }\n $map->outboundMap[$concretePropertyName] = [];\n foreach ( $referentialConstraints as $referentialConstraint ) {\n /**\n * @var \\DOMElement $referentialConstraint\n */\n $navigationProperty = $referentialConstraint->parentNode;\n $navType = $metadata->stripNamespace( $navigationProperty->getAttribute( 'Type' ) );\n\n $map->outboundMap[$concretePropertyName][$navType] = $navigationProperty->getAttribute( 'Name' );\n\n /*\n * Resolve possible abstract types into concrete types. E.g. principal => systemuser, team.\n */\n if ( array_key_exists( $navType, $metadata->parentTypesMap ) ) {\n foreach ( $metadata->parentTypesMap[$navType] as $concreteType ) {\n $map->outboundMap[$concretePropertyName][$concreteType] = $navigationProperty->getAttribute( 'Name' );\n }\n }\n }\n }\n\n return $map;\n }", "private function _strip_deep2($d) {\n $d = is_array($d) ? array_map(array($this, '_strip_deep2'), $d) : stripslashes($d);\n return $d;\n }", "protected function getSubMapped(ElementInterface $element, object $mapped, &$new = false)\n {\n if (is_null($element->getName())) {\n return $mapped;\n }\n\n try {\n $exists = false;\n $value = b_get_property_value($mapped, $element->getName(), $exists);\n\n if (!$exists) {\n throw new HydratorException(\n sprintf(\n 'Unable to find getter method of \"%s\" property in mapped object \"%s\"',\n $element->getName(),\n get_class($mapped)\n )\n );\n }\n\n // Object found\n if (!is_null($value)) {\n return $value;\n }\n\n // Create object\n if (!is_null($subMapped = $this->createObject($element))) {\n $new = true;\n if (!b_set_property_value($mapped, $element->getName(), $subMapped)) {\n throw new HydratorException(\n sprintf(\n 'Unable to find setter method of \"%s\" property on object \"%s\"',\n $element->getName(),\n get_class($mapped)\n ), 0\n );\n }\n\n return $subMapped;\n }\n\n return null;\n } catch (HydratorException $e) {\n throw $e;\n } catch (Exception $e) {\n throw new HydratorException(\n sprintf(\n 'Unable to find setter method of \"%s\" property on object \"%s\"',\n $element->getName(),\n get_class($mapped)\n ), 0, $e\n );\n }\n }", "private function parseEntry(array &$entry, array $mappedRelationships): void\n {\n // Remove the data object, because we only needed it to perform a HAVING search on it\n unset($entry['data']);\n\n foreach ($entry as $key => &$value) {\n // Only properties inside the data object are in the types array, not the ID for example\n if (!isset($this->properties[$key])) {\n continue;\n }\n\n /** @var Collection\\Property $property */\n $property = $this->properties[$key];\n $type = $property->getType();\n\n // JSON encoding collection property types\n if ($property->isTranslatable() || in_array($type->getType(), self::JSON, true)) {\n $value = json_decode($value, true);\n }\n\n // Cast the values to the correct format\n $this->performTypeCasting($type, $value);\n }\n\n // Prevent any problems with looped $value variable\n unset($value);\n\n // Parse the dates as ISO strings\n foreach (self::DATES as $date) {\n $dateTime = $entry[$date] instanceof DateTime ? $entry[$date] : new DateTime($entry[$date]);\n\n $entry[$date] = $dateTime->format(DateTime::ATOM);\n }\n\n // Update the user id's to become user objects\n foreach (self::USER_PROPERTIES as $id) {\n // Create a key without _id suffix\n $key = str_replace('_id', '', $id);\n\n // Create the new property with user object\n $entry[$key] = $this->users[$entry[$id]] ?? null;\n\n // No need to perform more actions when the user is NULL\n if ($entry[$key] !== null) {\n // Parse the users' dates\n foreach (self::DATES as $date) {\n /** @var DateTime $dateTime */\n $dateTime = $entry[$key][$date];\n\n $entry[$key][$date] = $dateTime !== null ? $dateTime->format(DateTime::ATOM) : null;\n }\n }\n\n // Unset the old value\n unset($entry[$id]);\n }\n\n // Insert the relationships\n $this->mapRelationships($mappedRelationships, $entry);\n }", "function fixAttributes(&$template,$attribute) {\n\tif ( ! is_array($template[$attribute]) ) return;\n\tif ( $template[$attribute]['@attributes'] ) {\n\t\t$template[$attribute][0]['@attributes'] = $template[$attribute]['@attributes'];\n\t\tif ( $template[$attribute]['value'])\n\t\t\t$template[$attribute][0]['value'] = $template[$attribute]['value'];\n\n\t\tunset($template[$attribute]['@attributes']);\n\t\tunset($template[$attribute]['value']);\n\t}\n\n\tif ( $template[$attribute] ) {\n\t\tforeach ($template[$attribute] as $tempArray) {\n\t\t\t$tempArray2[] = $tempArray['value'] ? array('@attributes'=>$tempArray['@attributes'],'@value'=>$tempArray['value']) : array('@attributes'=>$tempArray['@attributes']);\n\t\t}\n\t\t$template[$attribute] = $tempArray2;\n\t}\n}", "function feedgeomashup_restore_shortcode( $content , $post ) {\n\n\t$content = preg_replace( '%<div class=\"gm-map\">.+?</div>%' ,\n\t\t'[geo_mashup_map]' ,\n\t\t$content );\n\treturn $content;\n\n}", "abstract protected function transformItem($item);", "private function normalize()\n {\n $field_id = isset($this->columns[0]) ? $this->columns[0] : 'id';\n\n $field_text = isset($this->columns[1]) ? $this->columns[1] : $field_id;\n\n $groups = [];\n\n $has_empty_groups = false;\n\n foreach ($this->data as $key => $datum) {\n $has_empty_groups = !is_numeric($key);\n }\n\n foreach ($this->data as $key => $datum) {\n if (is_array($datum) && isset($datum['id']) && isset($datum['text'])) {\n $this->push($datum);\n\n continue;\n }\n\n if (is_numeric($key)) {\n if (is_string($datum)) {\n $datum = [$datum];\n }\n\n $id = multi_dot_call($datum, $field_id);\n $id = $id === null ? (string) multi_dot_call($datum, '0') : (string) $id;\n\n $text = multi_dot_call($datum, $field_text);\n if (is_array($text)) {\n $lang = App::getLocale();\n $text = $text[$lang] ?? implode($this->separator, $text);\n }\n $text = $text === null ? (string) multi_dot_call($datum, '0') : (string) $text;\n\n if ($id && $text) {\n $text = $id . \") \" . $text;\n }\n\n foreach (array_slice($this->columns, 2) as $part) {\n $t = multi_dot_call($datum, $part);\n if ($t) {\n $text .= $this->separator.$t;\n }\n }\n\n $item = ['id' => $id, 'text' => $text];\n\n if ($id == $this->value) {\n $item['selected'] = true;\n }\n\n if (!$has_empty_groups) {\n $this->push($item);\n } else {\n $groups['Other'][] = $item;\n }\n } else {\n $groups[ucfirst($key)] = $datum;\n }\n }\n\n foreach ($groups as $group_name => $group) {\n $this->push([\n 'text' => $group_name,\n 'children' => collect($group)->map(function ($datum) use ($field_id, $field_text) {\n if (is_string($datum)) {\n $datum = [$field_id => $datum, $field_text => $datum];\n }\n\n $id = (string) multi_dot_call($datum, $field_id);\n\n $text = (string) multi_dot_call($datum, $field_text);\n\n foreach (array_slice($this->columns, 2) as $part) {\n $t = multi_dot_call($datum, $part);\n\n if ($t) {\n $text .= ' '.$t;\n }\n }\n\n $item = ['id' => $id, 'text' => $text];\n\n if ($id == $this->value) {\n $item['selected'] = true;\n }\n\n return $item;\n })->toArray()\n ]);\n }\n }", "function unserializeChildren()\r\n {\r\n reset($this->components->items);\r\n while (list($k,$v)=each($this->components->items))\r\n {\r\n $v->unserialize();\r\n }\r\n }", "function transformEntry($timeTrackerEntry);", "protected function _preFlatten() {}", "protected function normalize()\r\n\t{\r\n\t\tif ($this->isFetched())\r\n\t\t{\r\n\t\t\tif ($this->validationInfo)\r\n\t\t\t{\r\n\t\t\t\t$this->normalizedValue = $this->validationInfo->normalize($this->taintValue);\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\t$this->normalizedValue = $this->taintValue;\r\n\t\t\t}\t\r\n\t\t}\r\n\t}", "function rm_child($child_id) {\n $t = @$this->triples[$child_id];\n if($t) {\n unset($this->children[$t->parent_id][$child_id]);\n unset($this->triples[$child_id]);\n }\n }", "public function unDotData() {\n\t\t\n\t\t// foreach element\n\t\t// if key is dot notation\n\t\t// explode into array\n\t\t// add to output\n\t}", "abstract protected function buildMap();", "public function importNormalizationMap($map)\r\n\t{\r\n\t\tif (!empty($map)) {\r\n\t\t\tforeach ($map as $mapping) {\r\n\t\t\t\tlist($keyword, $ingredientId) = $mapping;\r\n\r\n\t\t\t\t$query = 'INSERT IGNORE INTO normalizationMap\r\n\t\t\t\t\tSET keyword = \"'.$this->_db->escape($keyword).'\",\r\n\t\t\t\t\t\tingredientID = '.(int) $ingredientId;\r\n\t\t\t\t$this->_db->setQuery($query);\r\n\t\t\t\t$this->_db->query();\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn true;\r\n\t}", "private function _sanitize_data($data){\n\t\t// Remove fields which potentially can damage the tree structure\n\t\tif(is_array($data))\n\t\t{\n\t\t\tunset($data['lft']);\n\t\t\tunset($data['rgt']);\n\t\t}\n\t\telseif(is_object($data))\n\t\t{\n\t\t\tunset($data->lft);\n\t\t\tunset($data->rgt);\n\t\t}\n\n\t\tif(isset($data['type']))\n\t\t{\n\t\t\t$data['type'] = implode('|', $data['type']);\n\t\t}\n\n\t\t// ensure entry_id is set correctly for sql strict_mode\n\t\tif(isset($data['entry_id']) && $data['entry_id'] != '')\n\t\t{\n\t\t\t$data['entry_id'] = (int) $data['entry_id'];\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$data['entry_id'] = NULL;\n\t\t}\n\n\t\tunset($data['tree_id']);\n\t\tunset($data['is_root']);\n\t\tunset($data['parent_lft']);\n\t\treturn $data;\n\t}", "public abstract function flatten(bool $preserveKeys = false): ArrayMap;", "public static function sanitize_entry_array(&$entry) {\n /* attributes whose values will be lower-cased: */\n $attrs = array('edupersonorgunitdn', 'edupersonprimaryorgunitdn',\n 'uoauserapps', 'edupersonorgdn', 'edupersonprimaryaffiliation',\n 'edupersonaffiliation', 'eduorgsuperioruri');\n\n for($i=0; $i<$entry['count']; $i++) {\n $entry[$i]['dn'] = strtolower($entry[$i]['dn']);\n foreach($attrs as $attr) {\n if(isset($entry[$i][$attr]['count']) && $entry[$i][$attr]['count'] > 0 ) {\n for($j=0; $j<$entry[$i][$attr]['count']; $j++) {\n $entry[$i][$attr][$j] = strtolower($entry[$i][$attr][$j]);\n }\n }\n }\n }\n }", "protected function denormalize($value)\n {\n if (null === $this->normalizationTransformer) {\n return $value;\n }\n return $this->normalizationTransformer->reverseTransform($value, $this->data);\n }", "protected function takeChildFromDOM($child)\n {\n $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;\n switch ($absoluteNodeName) {\n case $this->lookupNamespace('atom') . ':' . 'generator':\n $generator = new Zend_Gdata_App_Extension_Generator();\n $generator->transferFromDOM($child);\n $this->_generator = $generator;\n break;\n case $this->lookupNamespace('atom') . ':' . 'icon':\n $icon = new Zend_Gdata_App_Extension_Icon();\n $icon->transferFromDOM($child);\n $this->_icon = $icon;\n break;\n case $this->lookupNamespace('atom') . ':' . 'logo':\n $logo = new Zend_Gdata_App_Extension_Logo();\n $logo->transferFromDOM($child);\n $this->_logo = $logo;\n break;\n case $this->lookupNamespace('atom') . ':' . 'subtitle':\n $subtitle = new Zend_Gdata_App_Extension_Subtitle();\n $subtitle->transferFromDOM($child);\n $this->_subtitle = $subtitle;\n break;\n default:\n parent::takeChildFromDOM($child);\n break;\n }\n }", "private static function rec_xmlDeserialize($child, $parent_node)\n\t{\n\t\tif($child['value'] instanceof Component)\n\t\t{\n\t\t\t$child['value']->_parent\t= $parent_node;\n\t\t\t$child['value']->_fullname\t= $child['name'];\n\n\t\t\t$node_name = get_class($child['value']);\n\t\t\tif(strncmp('Biome\\\\Component\\\\', $node_name, 16) == 0)\n\t\t\t{\n\t\t\t\t$node_name = substr($node_name, 16);\n\t\t\t}\n\n\t\t\t$child['value']->_nodename\t\t= strtolower(substr($node_name, 0, -strlen('Component')));\n\t\t\t$child['value']->_attributes = $child['attributes'];\n\t\t\t$child['value']->getId(); // Generate ID.\n\t\t\t$child['value']->building();\n\t\t\treturn $child['value'];\n\t\t}\n\n\t\t/* Load standard HTML markup. */\n\t\tif(is_array($child['value']))\n\t\t{\n\t\t\t$list = array();\n\t\t\tforeach($child['value'] AS $c)\n\t\t\t{\n\t\t\t\t$list[] = self::rec_xmlDeserialize($c, $parent_node);\n\t\t\t}\n\t\t\t$child['value'] = $list;\n\t\t\treturn $child;\n\t\t}\n\n\t\treturn $child;\n\t}", "protected function parseXmlNode(\\DOMElement $node, $map) {\n /** @var \\DOMElement $attribute */\n $attribute = $node->firstChild;\n $result = [];\n do {\n $name = $attribute->localName;\n if (isset($map['sourceMap'][$name])) {\n foreach($map['sourceMap'][$name] as $target) {\n //pass null since we do not have implemented $row yes to pass to normalize\n $value = $this->normalize($attribute->nodeValue, $map['map'][$target]['type'], $node);\n\n if (isset($result[$target])) {\n switch ($map['map'][$target]['multiple']) {\n case 'array': if (is_array($result[$target])) {\n $result[$target][] = $value;\n } else {\n $result[$target] = [$result[$target], $value];\n }\n break;\n case 'last':\n $result[$target] = $value;\n break;\n default:\n throw new \\Exception(\"Unknown value for multiple: {$map['map'][$target]['multiple']}\");\n\n }\n } else {\n $result[$target] = $value;\n }\n }\n }\n } while(null !== $attribute = $attribute->nextSibling);\n foreach($map['map'] as $target => $def) {\n if (!isset($result[$target])) {\n $result[$target] = null;\n }\n }\n return $result;\n }", "function wponion_field_cloneable_sanitize( $value = '', $callback = '' ) {\n\t\tif ( wponion_is_array( $value ) ) {\n\t\t\tforeach ( $value as $i => $v ) {\n\t\t\t\t$value[ $i ] = wponion_callback( $callback, array( $v ) );\n\t\t\t}\n\t\t}\n\t\treturn $value;\n\t}", "function seattlemennonite_get_section($map, $child) {\n // upward until the top-level ancestor is found. Then\n // return an array containing its title and URL.\n \n $parent = $child->menu_item_parent;\n if ( $parent == 0 ) {\n return array(\n 'title' => $child->title,\n 'url' => $child->url,\n );\n } elseif ( in_array( $parent, array_keys( $map ) ) ) {\n return seattlemennonite_get_section( $map, $map[$parent] );\n }\n}", "public function map($callback, $callbackArg = null) {\n\treturn array_walk($this->_elArray, $callback, $callbackArg);\n}", "function venture_geo_process_map($existing_map) {\n $query = \"SELECT field_location_value, field_country_value, field_state_value, COUNT(nid) AS investor_count,\n MIN(field_minimum_investment_value) AS field_minimum_investment_value, \n MAX(field_maximum_investment_value) AS field_maximum_investment_value\n FROM {content_type_profile} WHERE LENGTH(IFNULL(field_location_value, '')) > 0\n AND field_location_value != 'invalid'\n GROUP BY field_location_value ORDER BY investor_count\";\n $result = db_query($query);\n \n $map_data = venture_geo_process_map_xml('default_color', array('color' => 'dadada'));\n $map_data .= venture_geo_process_map_xml('background_color', array('color' => 'ffffff'));\n $map_data .= venture_geo_process_map_xml('outline_color', array('color' => 'c4c4c4'));\n $map_data .= venture_geo_process_map_xml('default_point', array('color' => 'ff0000', 'size' => 7, 'opacity' => 50));\n $map_data .= venture_geo_process_map_xml('scale_points', array('data' => 25));\n $map_data .= venture_geo_process_map_xml('hover', array('font_size' => 13, 'font_color' => 'ffffff', 'background_color' => '51516d' ));\n \n while ($row = db_fetch_object($result)) {\n $geocode = explode('|', $row->field_location_value); \n $location = venture_geo_get_location($geocode[0], $row->field_state_value, $row->field_country_value);\n $investors = \"{$row->investor_count} venture investor\";\n $investors = $row->investor_count > 1 ? $investors . 's' : $investors;\n \n $field_minimum_investment = content_fields('field_minimum_investment', 'profile');\n $field_maximum_investment = content_fields('field_maximum_investment', 'profile');\n $min_investment = content_format($field_minimum_investment, $row->field_minimum_investment_value);\n $max_investment = content_format($field_maximum_investment, $row->field_maximum_investment_value);\n \n $map_data .= venture_geo_process_map_xml('point', array(\n 'name' => $location,\n 'loc' => $geocode[1] . ',' . $geocode[2],\n 'hover' => \"\\n$investors - \\n Minimum investment: $min_investment\\n Maximum investment: $max_investment\"\n ));\n }\n \n $map_data = \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\\n<countrydata>\\n$map_data</countrydata>\";\n $map_destination = file_directory_path() . '/map_' . time() . '.xml';\n file_save_data($map_data, $map_destination, FILE_EXISTS_REPLACE);\n \n if ($existing_map) {\n file_delete($existing_map);\n }\n}", "protected function prepareAttributeMap($attributeMap, $additionalAttributes)\n {\n foreach ($additionalAttributes as $mapping) {\n if (!isset($attributeMap[$mapping['klevu_attribute']])) {\n $attributeMap[$mapping['klevu_attribute']] = [];\n }\n $attributeMap[$mapping['klevu_attribute']][] = $mapping['magento_attribute'];\n }\n\n return $attributeMap;\n }", "protected function _prepareData($data)\n {\n foreach ($this->_mapAttributes as $attributeAlias => $attributeCode) {\n if (isset($data[$attributeAlias])) {\n $data[$attributeCode] = $data[$attributeAlias];\n unset($data[$attributeAlias]);\n }\n }\n return $data;\n }", "public function childTransformation(bool $childTransformation);", "abstract public function transform();", "public static function fixStatesWrapper(array &$element) {\n if (empty($element['#states'])) {\n return;\n }\n\n $attributes = [];\n $attributes['class'][] = 'js-form-wrapper';\n $attributes['data-drupal-states'] = Json::encode($element['#states']);\n\n $element += ['#prefix' => '', '#suffix' => ''];\n\n // ISSUE: JSON is being corrupted when the prefix is rendered.\n // $element['#prefix'] = '<div ' . new Attribute($attributes) . '>' . $element['#prefix'];\n // WORKAROUND: Safely set filtered #prefix to FormattableMarkup.\n $allowed_tags = isset($element['#allowed_tags']) ? $element['#allowed_tags'] : Xss::getHtmlTagList();\n $element['#prefix'] = new FormattableMarkup('<div' . new Attribute($attributes) . '>' . Xss::filter($element['#prefix'], $allowed_tags), []);\n $element['#suffix'] = $element['#suffix'] . '</div>';\n\n // Attach library.\n $element['#attached']['library'][] = 'core/drupal.states';\n\n // Remove #states property to prevent nesting.\n unset($element['#states']);\n }", "public function testBuildMarshalMapNonArrayData(): void\n {\n $table = $this->getTableLocator()->get('Articles');\n $table->addBehavior('Translate', ['fields' => ['title', 'body']]);\n $translate = $table->behaviors()->get('Translate');\n\n $map = $translate->buildMarshalMap($table->marshaller(), [], []);\n $entity = $table->newEmptyEntity();\n $result = $map['_translations']('garbage', $entity);\n $this->assertNull($result, 'Non-array should not error out.');\n $this->assertEmpty($entity->getErrors());\n $this->assertEmpty($entity->get('_translations'));\n }", "function mpfy_duplicate_location_map_meta($post_id) {\n\t$location = new Mpfy_Map_Location($post_id);\n\t$maps = $location->get_maps();\n\n\tdelete_post_meta($post_id, '_map_location_map_id');\n\tforeach ($maps as $map_id) {\n\t\tadd_post_meta($post_id, '_map_location_map_id', $map_id);\n\t}\n}", "public function transform($item)\n {\n return parent::transform($item);\n }", "abstract protected function _normalizeIterable($iterable);", "function sp_fullwidth_map_sc( $atts, $content = null ) {\n\n\t\t$output = '</div><!-- end .container --><section id=\"map\">' . do_shortcode( $content ) . '</section><!-- end #map --><div class=\"container clearfix\">';\n\n\t\treturn $output;\n\n\t}", "public function mapFromEntity($entity, NormalizationContextInterface $context = null);", "private function prepareObjectArray(){\n\t//scorro l' array $this->objarr settando su ciascun oggetto gli attributi children\n\tforeach($this->objarr as $key=>$object){\n\t\t//echo \"-\".$object->getAppendToIndex().\"<br />\";\n\t\t\n\t\tif(($appind=$object->getAppendToIndex()) != \"\"){\n\t\t\n\t\t$object->setIntegrated(true); //indico che l' oggetto è stato incluso come figlio di un altro.\t\n\t\t\n\t\t $objparent=$this->objarr[$appind];\n\t\t\t$objparent->appendChild($object);\t\n\t\t\t//echo $objparent->getIndex();\n\t\t}\n\t}\n}", "abstract public function transform(array $item);", "function section__map(){\n return array(\n 'content'=>\"<div style='width:300px; height:300px' style='\n margin-left:auto; margin-right:auto;' id='map'></div>\",\n 'class'=>'main',\n 'label'=>'Map',\n 'order'=>'1'\n );\n }", "protected function sanitizeRecordValues($uid, $colPos = NULL) {\n\t\t$uid = intval($uid);\n\t\t$record = BackendUtility::getRecord('tt_content', $uid);\n\t\t$container = BackendUtility::getRecord('tt_content', $record['kbnescefe_parentElement']);\n\n\t\tif (\n\t\t\tis_array($record) &&\n\t\t\t(\n\t\t\t\t(\n\t\t\t\t\tintval($record['colPos']) !== intval($this->config['containerElementColPos']) &&\n\t\t\t\t\t($record['kbnescefe_parentPosition'] || $record['kbnescefe_parentElement'] !== 0)\n\t\t\t\t) // Sanitize record when it has not assigned the container colPos\n\t\t\t\t||\n\t\t\t\t!is_array($container) // or if its container doesn't exist\n\t\t\t\t||\n\t\t\t\t($colPos !== NULL) // or if so requested explicitely\n\t\t\t)\n\t\t) {\n\n\t\t\t$update = array();\n\n\t\t\tif ($colPos !== NULL) {\n\t\t\t\t$update['colPos'] = $colPos;\n\t\t\t}\n\t\t\t// Reset kb_nescefe parent pointer after moving/copying an element out of a container.\n\t\t\t// It wouldn't hurt if those values stay set but it seems cleaner this way.\n\t\t\t$update['kbnescefe_parentElement'] = 0;\n\t\t\t$update['kbnescefe_parentPosition'] = '';\n\t\t\t$GLOBALS['TYPO3_DB']->exec_UPDATEquery('tt_content', 'uid='.$uid, $update);\n\t\t}\n\t}", "public function slcr_core_vc_lean_map() { \n\t\t/**\n * Override Default vc functionality\n * Add extra features in default elements\n */\n if (function_exists('vc_remove_param'))\n { \n vc_remove_param('vc_column', 'css_animation');\n vc_remove_param('vc_column', 'el_id');\n vc_remove_param('vc_column', 'el_class');\n vc_remove_param('vc_column', 'css');\n vc_remove_param('vc_column', 'offset');\n vc_remove_param('vc_column', 'width');\n vc_remove_param('vc_row', 'full_width');\n vc_remove_param('vc_row', 'gap');\n vc_remove_param('vc_row', 'full_height');\n vc_remove_param('vc_row', 'columns_placement');\n vc_remove_param('vc_row', 'equal_height');\n vc_remove_param('vc_row', 'content_placement');\n vc_remove_param('vc_row', 'video_bg');\n vc_remove_param('vc_row', 'video_bg_url');\n vc_remove_param('vc_row', 'video_bg_parallax');\n vc_remove_param('vc_row', 'parallax');\n vc_remove_param('vc_row', 'parallax_image');\n vc_remove_param('vc_row', 'parallax_speed_video');\n vc_remove_param('vc_row', 'parallax_speed_bg');\n vc_remove_param('vc_row', 'el_id');\n vc_remove_param('vc_row', 'css_animation');\n vc_remove_param('vc_row', 'disable_element');\n vc_remove_param('vc_row', 'el_class');\n vc_remove_param('vc_row', 'css'); \n } \n // Add New parameter in vc\n vc_add_shortcode_param('radio_image_box' ,array( $this, 'slcr_core_radio_image_settings_field' ));\n\n // Override vc_map for some elements\n vc_lean_map('vc_tta_tabs', null, SLCR_CORE_VC_ELEMENT_DIR . 'vc-map/slcr-core-map-vc-tabs.php');\n vc_lean_map('vc_tta_accordion', null, SLCR_CORE_VC_ELEMENT_DIR . 'vc-map/slcr-core-map-vc-accordion.php');\n vc_lean_map('vc_btn', null, SLCR_CORE_VC_ELEMENT_DIR . 'vc-map/slcr-core-map-vc-btn.php');\n vc_lean_map('vc_custom_heading', null, SLCR_CORE_VC_ELEMENT_DIR . 'vc-map/slcr-core-map-vc-custom-heading.php');\n vc_lean_map('vc_icon', null, SLCR_CORE_VC_ELEMENT_DIR . 'vc-map/slcr-core-map-vc-icon.php'); \n include_once( SLCR_CORE_VC_ELEMENT_DIR.'vc-map/slcr-core-map-vc-column.php' );\n include_once( SLCR_CORE_VC_ELEMENT_DIR.'vc-map/slcr-core-map-vc-row.php' );\n include_once( SLCR_CORE_VC_ELEMENT_DIR.'vc-map/slcr-core-map-vc-single-image.php' ); \n\n vc_lean_map('slcr_team', null, SLCR_CORE_VC_ELEMENT_DIR . 'sc-map/slcr-core-team-member.php'); \n vc_lean_map('team_member_item', null, SLCR_CORE_VC_ELEMENT_DIR . 'sc-map/slcr-core-team-members-item.php'); \n vc_lean_map('slcr_testimonial', null, SLCR_CORE_VC_ELEMENT_DIR . 'sc-map/slcr-core-testimonial.php'); \n vc_lean_map('testimonials', null, SLCR_CORE_VC_ELEMENT_DIR . 'sc-map/slcr-core-testimonials-item.php'); \n vc_lean_map('slcr_box', null, SLCR_CORE_VC_ELEMENT_DIR . 'sc-map/slcr-core-box.php'); \n vc_lean_map('slcr_carousel', null, SLCR_CORE_VC_ELEMENT_DIR . 'sc-map/slcr-core-carousel.php'); \n vc_lean_map('slcr_icon', null, SLCR_CORE_VC_ELEMENT_DIR . 'sc-map/slcr-core-icon-boxes.php'); \n vc_lean_map('slcr_icon_text', null, SLCR_CORE_VC_ELEMENT_DIR . 'sc-map/slcr-core-icon-text.php'); \n vc_lean_map('slcr_price', null, SLCR_CORE_VC_ELEMENT_DIR . 'sc-map/slcr-core-price-list.php'); \n vc_lean_map('slcr_price_item', null, SLCR_CORE_VC_ELEMENT_DIR . 'sc-map/slcr-core-price-list-item.php');\n vc_lean_map('pricing_table', null, SLCR_CORE_VC_ELEMENT_DIR . 'sc-map/slcr-core-pricing-table.php');\n vc_lean_map('slcr_counter', null, SLCR_CORE_VC_ELEMENT_DIR . 'sc-map/slcr-core-counter.php');\n vc_lean_map('slcr_image_hotspot', null, SLCR_CORE_VC_ELEMENT_DIR . 'sc-map/slcr-core-image-hotspot.php');\n vc_lean_map('slcr_hotspot', null, SLCR_CORE_VC_ELEMENT_DIR . 'sc-map/slcr-core-hotspot.php');\n vc_lean_map('slcr_image_comparison', null, SLCR_CORE_VC_ELEMENT_DIR . 'sc-map/slcr-core-image-comparison.php');\n vc_lean_map('slcr_progress_bars', null, SLCR_CORE_VC_ELEMENT_DIR . 'sc-map/slcr-core-progress-bars.php');\n vc_lean_map('slcr_instagram_feed', null, SLCR_CORE_VC_ELEMENT_DIR . 'sc-map/slcr-core-insta-feed.php');\n vc_lean_map('slcr_typed_text', null, SLCR_CORE_VC_ELEMENT_DIR . 'sc-map/slcr-core-typed-text.php');\n vc_lean_map('slcr_text_links', null, SLCR_CORE_VC_ELEMENT_DIR . 'sc-map/slcr-core-text-links.php');\n vc_lean_map('slcr_dropcap', null, SLCR_CORE_VC_ELEMENT_DIR . 'sc-map/slcr-core-dropcap.php');\n vc_lean_map('slcr_alert', null, SLCR_CORE_VC_ELEMENT_DIR . 'sc-map/slcr-core-alert.php');\n vc_lean_map('slcr_notifications', null, SLCR_CORE_VC_ELEMENT_DIR . 'sc-map/slcr-core-notifications.php');\n vc_lean_map('slcr_radial', null, SLCR_CORE_VC_ELEMENT_DIR . 'sc-map/slcr-core-radial.php');\n vc_lean_map('slcr_text_reveal', null, SLCR_CORE_VC_ELEMENT_DIR . 'sc-map/slcr-core-text-reveal.php');\n vc_lean_map('slcr_video_modal', null, SLCR_CORE_VC_ELEMENT_DIR . 'sc-map/slcr-core-video-modals.php');\n vc_lean_map('slcr_accordion_data', null, SLCR_CORE_VC_ELEMENT_DIR . 'sc-map/slcr-core-accordion-data.php');\n vc_lean_map('slcr_blog_grid', null, SLCR_CORE_VC_ELEMENT_DIR . 'sc-map/slcr-core-blog-grid.php');\n vc_lean_map('slcr_google_map', null, SLCR_CORE_VC_ELEMENT_DIR . 'sc-map/slcr-core-google-map.php');\n vc_lean_map('slcr_service_box', null, SLCR_CORE_VC_ELEMENT_DIR . 'sc-map/slcr-core-service-box.php'); \n\t}", "public function clearRootAssetMappings();", "function fs_prep_data_for_json($assoc_tree, $root_name=null) {\n $results = array(\n '_node_name' => ($root_name === null\n ? ''\n : $root_name),\n 'children' => array(),\n );\n if (is_array($assoc_tree)) {\n foreach ($assoc_tree as $key => $subtree) {\n $results['children'][] = fs_prep_data_for_json(\n $subtree, $key\n );\n }\n }\n return $results;\n }", "protected function stopVirtualElement()\n {\n if (! $this->element or $this->reader->nodeType !== XMLReader::ELEMENT) {\n return;\n }\n\n if ($parent = $this->findVirtualElementById($this->element->get('@parent'))) {\n $key = $this->getPluralized($this->element->get('@element'));\n\n if (! $parent->has($key)) {\n $parent->put($key, new Collection);\n }\n\n if ($parent->get($key) instanceof Collection) {\n $parent->get($key)->push($this->element);\n }\n } else {\n $this->elements->push($this->element);\n }\n\n $this->element->forget(['@id', '@parent', '@element']);\n }", "public function normalize(ContentEntityInterface $entity);", "private function mapRelationships(array $mappedRelationships, &$entry): void\n {\n if (!empty($mappedRelationships)) {\n /** @var Collection\\Relationship $relationship */\n foreach ($this->collection->getRelationships() as $relationship) {\n $identifier = $relationship->getIdentifier();\n\n // The relationship may not be set when it shouldn't be shown in the listview response\n if (!isset($mappedRelationships[$entry['id']][$identifier])) {\n continue;\n }\n\n $related = array_values($mappedRelationships[$entry['id']][$identifier]);\n\n // Return only one record when it's a one to one relationship\n if (!$relationship->getType()->hasMany()) {\n $related = $related[0] ?? null;\n }\n\n $entry[$identifier] = $related;\n }\n }\n }", "public function reverseMap()\n {\n foreach ((array) $this->rawData as $index => $documentLink) {\n $documentCategory = $this->getDocumentCategory(getVal($documentLink, ['document_link', 'category', 0, 'code']), true);\n if (!$documentCategory) {\n return $this->mappedData;\n }\n\n if (!array_key_exists($documentCategory, $this->mappedData)) {\n $index = 0;\n }\n\n $this->mappedData[$documentCategory][$index]['document_title'] = getVal($documentLink, ['document_link', 'title', 0, 'narrative', 0, 'narrative']);\n $this->mappedData[$documentCategory][$index]['document_url'] = getVal($documentLink, ['document_link', 'url']);\n $this->mappedData[$documentCategory][$index]['document_link_id'] = getVal($documentLink, ['id']);\n }\n\n return $this->mappedData;\n }", "public function hydrateSet($key, $element)\n {\n $this->collection->set($key, $element);\n // If _backRefFieldName is set, then the association is bidirectional\n // and we need to set the back reference.\n if ($this->backRefFieldName && $this->association['type'] === ApiMetadata::ONE_TO_MANY) {\n // Set back reference to owner\n $this->metadata->getReflectionProperty($this->backRefFieldName)->setValue(\n $element,\n $this->owner\n );\n }\n }", "function siteorigin_panels_wp_import_post_meta_map($val) {\n\tif(is_string($val)) return str_replace('<<<br>>>', \"\\n\", $val);\n\telse return array_map('siteorigin_panels_wp_import_post_meta_map', $val);\n}", "public function normalizeOptions(&$data, $item)\n {\n $options = [];\n\n foreach (OptionObject::CONVERSION_MAP as $element) {\n $value = $item[$element['key']];\n if ($value) {\n $options[] = new OptionObject($element['code'], $value);\n }\n }\n\n $data['options'] = $options;\n }", "function cleanup_orphan_maps ($postid, $mapid)\r\n{\r\n\tglobal $wpdb;\r\n\t$posts_table = $wpdb->prefix . 'mappress_posts';\r\n\t$maps_table = $wpdb->prefix . 'mappress_maps';\r\n\t$post_status = get_post_status( $postid );\r\n\t//Print (\"<br /> post status for mapid:$mapid and postid:$postid is '$post_status' <br /> \");\r\n\tif ($post_status == '')\r\n\t{\r\n\t\t$thisSQL = sprintf(\"DELETE FROM $posts_table WHERE postid = %u\",$postid);\r\n\t\t// delete all map posts without a post\r\n\t\t$wpdb->query($thisSQL);\r\n\t\r\n\t\t// delete all maps without a map post\r\n\t\t$thisSQL = sprintf(\"DELETE FROM $maps_table WHERE mapid= %u\",$positd);\r\n\t\t$wpdb->query($thisSQL);\r\n\t\treturn true;\r\n\t}\r\n\t\r\n\treturn false;\r\n}", "public function handle( ezcDocumentElementVisitorConverter $converter, DOMElement $node, $root )\n {\n foreach ( $this->headerMapping as $tagName => $metaName )\n {\n if ( ( $nodes = $node->getElementsBytagName( $tagName ) ) &&\n ( $nodes->length > 0 ) )\n {\n foreach ( $nodes as $child )\n {\n $root .= \":$metaName:\\n\";\n $root .= ezcDocumentDocbookToRstConverter::wordWrap( trim( $converter->visitChildren( $child, '' ) ), 2 );\n $root .= \"\\n\";\n }\n }\n }\n\n return $root;\n }", "protected function parseDictionaryElement(\\SimpleXMLElement $node) {\n\t\t\t$iMap = new Common\\Mutable\\HashMap();\n\t\t\t$children = $node->children();\n\t\t\tforeach ($children as $child) {\n\t\t\t\tswitch ($child->getName()) {\n\t\t\t\t\tcase 'entry':\n\t\t\t\t\t\t$iMap->putEntries($this->parseEntryElement($child));\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tthrow new Throwable\\Instantiation\\Exception('Unable to initial class.');\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn $iMap->toDictionary();\n\t\t}", "function hook_save_post($post_id) {\r\n\t\t// So ignore it unless at least one of our fields is set.\r\n\t\tif (!isset($_POST['mapp_zoom']))\r\n\t\t\treturn;\r\n\r\n\t\tdelete_post_meta($post_id, '_mapp_map');\r\n\t\tdelete_post_meta($post_id, '_mapp_pois');\r\n\r\n\t\t// Process map header fields. Filter out empty strings so as not to affect shortcode_atts() calls later\r\n\t\tif (!empty($_POST['mapp_size']))\r\n\t\t\t$map['size'] = $_POST['mapp_size'];\r\n\t\tif (!empty($_POST['mapp_maptype']))\r\n\t\t\t$map['maptype'] = $_POST['mapp_maptype'];\r\n\t\tif (!empty($_POST['mapp_width']))\r\n\t\t\t$map['width'] = $_POST['mapp_width'];\r\n\t\tif (!empty($_POST['mapp_height']))\r\n\t\t\t$map['height'] = $_POST['mapp_height'];\r\n\t\tif (!empty($_POST['mapp_zoom']))\r\n\t\t\t$map['zoom'] = $_POST['mapp_zoom'];\r\n\t\tif (!empty($_POST['mapp_center_lat']))\r\n\t\t\t$map['center_lat'] = $_POST['mapp_center_lat'];\r\n\t\tif (!empty($_POST['mapp_center_lng']))\r\n\t\t\t$map['center_lng'] = $_POST['mapp_center_lng'];\r\n\r\n\t\tupdate_post_meta($post_id, '_mapp_map', $map);\r\n\r\n\r\n\t\tif (!empty($pois))\r\n\t\t\tupdate_post_meta($post_id, '_mapp_pois', $pois);\r\n\t}", "public abstract function toMap(): array;", "function document_map_function(&$data, $maps) {\n $stype = $data['subsystem'];\n $sid = $data['subsystem_id'];\n if ($stype > 0) {\n if (isset($maps[$stype][$sid])) {\n $data['subsystem_id'] = $maps[$stype][$sid];\n } else {\n return false;\n }\n }\n if (!isset($data['extra_path'])) {\n $data['extra_path'] = '';\n }\n if (!$data['author']) {\n $data['author'] = '';\n }\n return true;\n}", "private function mapAttributes() {\n\t\t$attributes = [];\n\t\t$originalAttrs = $this->subscribedTopic->getRoute()->getAttributes();\n\n\t\tif (!count($originalAttrs)) {\n\t\t\treturn $attributes;\n\t\t}\n\n\t\tforeach ($originalAttrs as $attr => $obj) {\n\t\t\t$routeParts = explode('/', $this->route);\n\n\t\t\tif (!isset($routeParts[$obj->index])) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t$attributes[$attr] = $routeParts[$obj->index];\n\t\t}\n\n\t\treturn $attributes;\n\t}", "private function mapProperties(): void\n {\n $this->properties = Collect::keyBy($this->collection->getProperties()->getValues(), 'identifier');\n }", "public function normalize($name);", "protected function _hydrateEntry($entry) {\n\t\t//echo \"Hydrating: \"; print_r($entry);\n\t\t\n\t\tif ($entry->published && is_numeric($entry->published)) {\n\t\t\t$entry->published = date('c', $entry->published);\n\t\t}\n\n\t\tif ($entry->updated && is_numeric($entry->updated) && $entry->updated>0) {\n\t\t\t$entry->updated = date('c', $entry->updated);\n\t\t}\n\t\t\n\t\tif ($entry->author_id) {\n\t\t\t$entry->author = $this->getAuthorById($entry->author_id);\n\t\t\t//echo \"Hydrating author: \"; print_r($entry->author);\n\t\t\tunset($entry->author_id);\n\t\t}\n\t\t\n\t\treturn $entry;\n\t}" ]
[ "0.5970735", "0.507048", "0.49233034", "0.48846003", "0.47905284", "0.4761365", "0.47502396", "0.47165027", "0.4715329", "0.4624372", "0.45812443", "0.4578584", "0.45542377", "0.45134294", "0.45044053", "0.44534683", "0.44210777", "0.440279", "0.43981013", "0.43913502", "0.4379593", "0.4376122", "0.4363332", "0.43299085", "0.4315588", "0.430256", "0.4283488", "0.4271971", "0.42314607", "0.42287138", "0.422727", "0.42268294", "0.42264846", "0.4217718", "0.42115882", "0.4207653", "0.41725847", "0.4161247", "0.41479507", "0.41445473", "0.41428918", "0.41316575", "0.4127559", "0.41096982", "0.41057098", "0.41011783", "0.4097463", "0.4093734", "0.40886486", "0.40852547", "0.40732688", "0.40536264", "0.40517792", "0.4051596", "0.4047895", "0.4041584", "0.4039569", "0.4036657", "0.403417", "0.40324146", "0.40312663", "0.40260848", "0.40242028", "0.4019986", "0.40112907", "0.4001158", "0.39911902", "0.399061", "0.39833936", "0.39790896", "0.39740244", "0.3971559", "0.39665198", "0.39663807", "0.3965742", "0.39617023", "0.39580837", "0.39528367", "0.3950322", "0.39483458", "0.39482072", "0.39456213", "0.3945142", "0.3941377", "0.3935742", "0.3931169", "0.39182833", "0.3917382", "0.39166072", "0.39112502", "0.39084253", "0.39010942", "0.39003256", "0.3895272", "0.38888207", "0.38843462", "0.38751087", "0.38743195", "0.3871347", "0.38711596" ]
0.54417175
1
Normalizes a nonscalar child.
protected function _normalizeComplexChild($child, $config = null) { return $this->_createChildInstance($child, $config); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "abstract protected function _normalizeSimpleChild($child, $config);", "protected function _normalizeChild($child, $config = null)\n {\n if (is_scalar($child) || is_null($child)) {\n return $this->_normalizeSimpleChild($child, $config);\n }\n\n return $this->_normalizeComplexChild($child, $config);\n }", "public function normalize(): self;", "protected function normalize() {}", "public function normalize()\n {\n }", "public function normalize() {\n return $this->div($this->norm());\n }", "protected function normalize()\r\n\t{\r\n\t\tif ($this->isFetched())\r\n\t\t{\r\n\t\t\tif ($this->validationInfo)\r\n\t\t\t{\r\n\t\t\t\t$this->normalizedValue = $this->validationInfo->normalize($this->taintValue);\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\t$this->normalizedValue = $this->taintValue;\r\n\t\t\t}\t\r\n\t\t}\r\n\t}", "protected function normalize($value)\n {\n if (null === $this->normalizationTransformer) {\n return $value;\n }\n return $this->normalizationTransformer->transform($value);\n }", "public function normalize($value)\n {\n if ($value instanceof Expression ||\n $value instanceof Expressionable) {\n return $value;\n }\n\n return parent::normalize($value);\n }", "function normalize()\n\t\t{\n\t\t\t$m = $this->magnitude();\n\t\t\t$res = new Vector(array('dest' => new Vertex(array(\n\t\t\t\t'x' => $this->_x / $m,\n\t\t\t\t'y' => $this->_y / $m,\n\t\t\t\t'z' => $this->_z / $m\n\t\t\t))));\n\t\t\treturn ($res);\n\t\t}", "public function normalize(ContentEntityInterface $entity);", "protected function denormalize($value)\n {\n if (null === $this->normalizationTransformer) {\n return $value;\n }\n return $this->normalizationTransformer->reverseTransform($value, $this->data);\n }", "protected static function normalize(DOMDocument $ir)\n\t{\n\t\tself::addDefaultCase($ir);\n\t\tself::addElementIds($ir);\n\t\tself::addCloseTagElements($ir);\n\t\tself::markEmptyElements($ir);\n\t\tself::optimize($ir);\n\t\tself::markConditionalCloseTagElements($ir);\n\t\tself::setOutputContext($ir);\n\t\tself::markBranchTables($ir);\n\t}", "protected function normalize(): void\n {\n $coordinate = new BaseCoordinate(array(0, $this->value));\n $latitude = (float)$coordinate->getLongitude();\n\n $this->value = $latitude;\n }", "protected function processNormalization(NormalizeValueContext $context): void\n {\n $value = $context->getResult();\n if (null !== $value && $this->isValueNormalizationRequired($value)) {\n if ($context->isRangeAllowed() && str_contains($value, $context->getRangeDelimiter())) {\n $context->setResult($this->normalizeRangeValue($value, $context->getRangeDelimiter()));\n } elseif ($context->isArrayAllowed()) {\n $context->setResult($this->normalizeArrayValue($value, $context->getArrayDelimiter()));\n } else {\n $this->validateValue($value);\n $context->setResult($this->normalizeValue($value));\n }\n }\n $context->setProcessed(true);\n }", "public function getNormalizedData()\n {\n return parent::getNormalizedData();\n }", "public function getNormalization()\r\n {\r\n return $this->normalization;\r\n }", "public function normalize($name);", "public function childTransformation(bool $childTransformation);", "protected function normalize_attribute($name, $value)\n {\n }", "public function getQuantityPerUnitNormalizedAttribute()\n {\n return normalizeQuantity($this->quantity_per_unit, $this->dividendAssetModel->divisible);\n }", "public function setNormalization($normalization)\r\n {\r\n $this->normalization = (int) $normalization;\r\n\r\n return $this;\r\n }", "private function normToView(mixed $value): mixed\n {\n // Scalar values should be converted to strings to\n // facilitate differentiation between empty (\"\") and zero (0).\n // Only do this for simple forms, as the resulting value in\n // compound forms is passed to the data mapper and thus should\n // not be converted to a string before.\n if (!($transformers = $this->config->getViewTransformers()) && !$this->config->getCompound()) {\n return null === $value || \\is_scalar($value) ? (string) $value : $value;\n }\n\n try {\n foreach ($transformers as $transformer) {\n $value = $transformer->transform($value);\n }\n } catch (TransformationFailedException $exception) {\n throw new TransformationFailedException(sprintf('Unable to transform value for property path \"%s\": ', $this->getPropertyPath()).$exception->getMessage(), $exception->getCode(), $exception, $exception->getInvalidMessage(), $exception->getInvalidMessageParameters());\n }\n\n return $value;\n }", "public function removeChild( Component $child ) {\n\t\tparent::removeChild( $child );\n\t\t$child->setOrphan();\n\t}", "private function scaleX() : void\n\t{\n\t\t$this->domain = abs($this->rangeXLow) + abs($this->rangeXHigh);\n\n\t\t$this->scaleX = ((float)$this->sizeX / $this->domain);\n\t\t$this->originX = $this->sizeX >> 1;\n\t\t\n\t}", "public function scale() { }", "public function abnormal_graph(){\n $inspect = new Statistical;\n return $inspect->abnormal();\n }", "public function getColumnDenormalizedValue($value)\n {\n return $this->getDriver()->getColumnDenormalizedValue($this, $value);\n }", "public function normalizeEntity(Entity $entity)\n {\n if ($entity->getPrimaryKey()) {\n //search if there is already a UNIQUE constraint over the primary keys\n $pkUniqueExist = false;\n foreach ($entity->getUnices() as $unique) {\n $coversAllPrimaryKeys = true;\n foreach ($unique->getFields() as $fieldName) {\n if (!$entity->getField($fieldName)->isPrimaryKey()) {\n $coversAllPrimaryKeys = false;\n break;\n }\n }\n if ($coversAllPrimaryKeys) {\n //there's already a unique constraint with the composite pk\n $pkUniqueExist = true;\n break;\n }\n }\n\n //there is none, let's create it\n if (!$pkUniqueExist) {\n $unique = new Unique();\n foreach ($entity->getPrimaryKey() as $pk) {\n $unique->addField($pk);\n }\n $entity->addUnique($unique);\n }\n\n if ($entity->hasAutoIncrementPrimaryKey()) {\n foreach ($entity->getPrimaryKey() as $pk) {\n //no pk can be NULL, as usual\n $pk->setNotNull(true);\n //in SQLite the field with the AUTOINCREMENT MUST be a primary key, too.\n if (!$pk->isAutoIncrement()) {\n //for all other sub keys we remove it, since we create a UNIQUE constraint over all primary keys.\n $pk->setPrimaryKey(false);\n }\n }\n }\n }\n\n parent::normalizeEntity($entity);\n }", "final public function removeChild ()\n {\n throw new ChildException('Trying to remove child from self closing HTML element');\n }", "public function beforeUpdate(): void\n {\n $this->oldParentId = $this->owner->oldAttributes[$this->ownerParentIdAttribute] ?? null;\n\n if ($this->owner->getAttribute($this->ownerParentIdAttribute) !== null) {\n if ($this->hasChilds()) {\n throw new LogicException('You cannot move a parent under a child');\n }\n }\n }", "public function normalize(): string\n {\n return $this->getValue();\n }", "protected function childEntities()\n {\n return null;\n }", "public function testDenormalize() {\n $payload = '{\"data\":{\"type\":\"article\",\"attributes\":{\"title\":\"Testing article\"}}}';\n\n [$request, $resource_type] = $this->generateProphecies('node', 'article', 'id');\n $node = $this\n ->getNormalizer()\n ->denormalize(Json::decode($payload), NULL, 'api_json', [\n 'resource_type' => $resource_type,\n ]);\n $this->assertInstanceOf(Node::class, $node);\n $this->assertSame('Testing article', $node->getTitle());\n }", "protected function afterChildDataSet(MP_AdvancedDataflow_Model_Entity_Entity $child)\n {\n # _deb($child->getModel()->toArray());\n return $this;\n }", "public static function normalizeValue($value)\n {\n if ($value instanceof Node) {\n return $value;\n } elseif (is_null($value)) {\n return new Expr\\ConstFetch(\n new Name('null')\n );\n } elseif (is_bool($value)) {\n return new Expr\\ConstFetch(\n new Name($value ? 'true' : 'false')\n );\n } elseif (is_int($value)) {\n return new Scalar\\LNumber($value);\n } elseif (is_float($value)) {\n return new Scalar\\DNumber($value);\n } elseif (is_string($value)) {\n return new Scalar\\String_($value);\n } elseif (is_array($value)) {\n $items = [];\n $lastKey = -1;\n foreach ($value as $itemKey => $itemValue) {\n // for consecutive, numeric keys don't generate keys\n if (null !== $lastKey && ++$lastKey === $itemKey) {\n $items[] = new Expr\\ArrayItem(\n self::normalizeValue($itemValue)\n );\n } else {\n $lastKey = null;\n $items[] = new Expr\\ArrayItem(\n self::normalizeValue($itemValue),\n self::normalizeValue($itemKey)\n );\n }\n }\n return new Expr\\Array_($items);\n } else {\n throw new \\LogicException('Invalid value');\n }\n }", "function isNormal()\n\t\t{\n\t\t\t$this->value = 0;\n\t\t\tif($this->normalValue === $this->value)\n\t\t\t\treturn true;\n\t\t\telse\n\t\t\t\treturn false;\n\t\t}", "public function flattenInheritedAttributes() {}", "public function testComplexTypeElementWithParentThrowsExceptionWhenRedefineElementAddComplexTypeElement(): void\n {\n $parent1 = new RedefineElement();\n $parent1->addComplexTypeElement($this->sut);\n \n $parent2 = new RedefineElement();\n $this->expectInvalidOperationExceptionChildOfAnotherElement($this->sut, $parent2);\n $parent2->addComplexTypeElement($this->sut);\n }", "function array_normalize(Array $ar) {\n\t$max = null;\n\n\tforeach($ar as $v) {\n\t\t$v = abs($v);\n\n\t\tif ($max == null) {\n\t\t\t$max = $v;\n\t\t} else {\n\t\t\t$max = max($max, $v);\n\t\t}\n\t}\n\n\tif ($max > 0)\n\t\tforeach($ar as $i => $v)\n\t\t\t$ar[$i] = $v / $max;\n\n\treturn $ar;\n}", "protected function onParentSet() : void\n {\n $value = $this->oFG->getData()->getValue($this->strName);\n $this->iValue = $value ? intval($value) : $this->iMin;\n }", "public function denormalize(DenormalizerInterface $denormalizer, $data, string $format = null, array $context = [])\n {\n }", "function rm_child($child_id) {\n $t = @$this->triples[$child_id];\n if($t) {\n unset($this->children[$t->parent_id][$child_id]);\n unset($this->triples[$child_id]);\n }\n }", "public function testScaleWithNegative()\n {\n static::setExpectedExceptionRegExp('LogicException');\n $this->box->scale(-200);\n }", "public function child(){\n return $this->morphTo(null,'recharge_type','recharge_type_id');\n }", "public function isNormal();", "public function isNormal();", "protected function normalizeName($name) {\n\t\tif ($name instanceof NameNode) {\n\t\t\treturn $name;\n\t\t} else {\n\t\t\treturn new NameNode($name);\n\t\t}\n\t}", "public function testComplexTypeElementWithParentThrowsExceptionWhenSchemaElementAddComplexTypeElement(): void\n {\n $parent1 = new SchemaElement();\n $parent1->addComplexTypeElement($this->sut);\n \n $parent2 = new SchemaElement();\n $this->expectInvalidOperationExceptionChildOfAnotherElement($this->sut, $parent2);\n $parent2->addComplexTypeElement($this->sut);\n }", "#[Route(path: '/{id}/removeChild/{child}', name: 'lsitem_remove_child', methods: ['POST'])]\n #[IsGranted(Permission::ITEM_EDIT, 'lsItem')]\n public function removeChild(LsItem $parent, LsItem $child): Response\n {\n $command = new RemoveChildCommand($parent, $child);\n $this->sendCommand($command);\n\n return $this->render('framework/ls_item/remove_child.html.twig', []);\n }", "public function unFlattenNode(&$node, $name) {\n\t\t$domElement = $this->getChildNode($node, $name);\n\t\tif (!is_null($domElement) && $this->extractNodeText($domElement) !== '') {\n\t\t\t$tempDoc = new \\DOMDocument();\n\t\t\t$tempDoc->loadXML('<temp>'.$this->extractNodeText($domElement).'</temp>');\n\t\t\t\n\t\t\tif ($tempDoc->childNodes->length !== 1 || !($tempDoc->childNodes->item(0) instanceof \\DOMElement)) {\n\t\t\t\tthrow new ComhonException('wrong xml, XMLInterfacer manage xml with one and only one root node');\n\t\t\t}\n\t\t\t$toRemove = [];\n\t\t\tforeach ($domElement->childNodes as $child) {\n\t\t\t\t$toRemove[] = $child;\n\t\t\t}\n\t\t\tforeach ($toRemove as $child) {\n\t\t\t\t$domElement->removeChild($child);\n\t\t\t}\n\t\t\tforeach ($tempDoc->childNodes->item(0)->childNodes as $child) {\n\t\t\t\t$childNode = $this->domDocument->importNode($child, true);\n\t\t\t\t$domElement->appendChild($childNode);\n\t\t\t}\n\t\t}\n\t}", "public function isChildOnly();", "public function norm()\n\t{\n\t\t$v = new Vector($this->x,$this->y);\n\t\t$v->rotate(pi()/2.0);\n\t\treturn $v;\n\t}", "public function orX($child): void\n {\n $this->append($child);\n }", "protected function _beforeToHtml()\n {\n $this->_initTotals();\n foreach ($this->getChild() as $child) {\n if (method_exists($child, 'initTotals')) {\n $child->initTotals();\n }\n }\n return parent::_beforeToHtml();\n }", "public function setChild($child)\n {\n $this->child = $child;\n }", "public function denormalize($data, $normalizable)\n {\n $class = is_string($normalizable) ?\n $normalizable : (\n $normalizable instanceof \\ReflectionClass ?\n $normalizable->name :\n get_class($normalizable)\n )\n ;\n $reflection = isset(self::$reflectionPool[$class]) ?\n self::$reflectionPool[$class] :\n self::$reflectionPool[$class] = $normalizable instanceof \\ReflectionClass ?\n $normalizable :\n new \\ReflectionClass($class)\n ;\n\n $object = $normalizable;\n\n // Already got a denormalized object ?\n if (is_object($data) && is_a($data, $class)) {\n return $data;\n }\n\n // Got reflection ? so build a new object\n if (is_string($object) || $object instanceof \\ReflectionClass) {\n if (empty($data)) { // no data ? no worries !\n return $reflection->newInstance();\n }\n\n $arguments = array();\n\n // Construct with parameters ? we will try to hydrate arguments from their names\n if ($reflection->hasMethod('__construct')\n && count($parameters = $reflection->getMethod('__construct')->getParameters())\n ) {\n // String as items cases like \\DateTime\n if (!is_array($data)) {\n $arguments = array($data);\n unset($data);\n } else {\n // Hydrate constructor args from data keys\n foreach ($parameters as $parameter) {\n $argKey = $this->inflector->snakelize($parameter->getName());\n if (isset($data[$argKey])) {\n $arguments[] = $parameter->getClass() ?\n $this->normalize($data[$argKey], $parameter->getClass()) :\n $data[$argKey]\n ;\n unset($data[$argKey]);\n\n continue;\n }\n\n $arguments[] = $parameter->isOptional() ?\n $parameter->getDefaultValue() :\n null\n ;\n }\n }\n }\n\n $object = empty($arguments) ?\n $reflection->newInstance() :\n $reflection->newInstanceArgs($arguments);\n }\n\n // BAD !\n if ($object instanceof EntityCollection) {\n return $object->denormalize($data);\n }\n\n if (empty($data)) {\n return $object;\n }\n\n $write = \\Closure::bind(\n $this->createWrittingDelegate(),\n $object,\n get_class($object)\n );\n\n foreach ($data as $property => $value) {\n // Instanciate propertyPath before usage, to improve performance.\n if (!isset($this->propertiesPathPool[$property])) {\n $this->propertiesPathPool[$property] = new PropertyPath($property);\n }\n $propertyPath = $this->propertiesPathPool[$property];\n\n // simple case : access property\n if (!$reflection->hasMethod($setter = sprintf('set%s', ucfirst($property)))) {\n $write($propertyPath, $value, $this->propertyAccessor);\n continue;\n }\n\n // extract setter class from type hinting\n $reflectionMethod = $reflection->getMethod($setter);\n $parameters = $reflectionMethod->getParameters();\n $setParameter = $parameters[0];\n\n // scalar or array ?\n if (!$setParameter->getClass() || $setParameter->isArray()) {\n $write($propertyPath, $value, $this->propertyAccessor);\n\n continue;\n }\n\n // nullable object ?\n if (empty($value)) {\n if ($setParameter->allowsNull()) {\n $write($propertyPath, null, $this->propertyAccessor);\n }\n\n continue;\n }\n\n // callable ?\n if (is_callable($value)) {\n if ($setParameter->isCallable()) {\n $write($propertyPath, $value, $this->propertyAccessor);\n }\n }\n\n $write(\n $propertyPath,\n $this->denormalize($value, $setParameter->getClass()),\n $this->propertyAccessor\n );\n }\n\n return $object;\n }", "public function testNormalize($expected, $path)\n {\n $this->assertSame($expected, (new Path($path))->normalize()->__toString());\n }", "private function normToModel(mixed $value): mixed\n {\n try {\n $transformers = $this->config->getModelTransformers();\n\n for ($i = \\count($transformers) - 1; $i >= 0; --$i) {\n $value = $transformers[$i]->reverseTransform($value);\n }\n } catch (TransformationFailedException $exception) {\n throw new TransformationFailedException(sprintf('Unable to reverse value for property path \"%s\": ', $this->getPropertyPath()).$exception->getMessage(), $exception->getCode(), $exception, $exception->getInvalidMessage(), $exception->getInvalidMessageParameters());\n }\n\n return $value;\n }", "abstract public function transform();", "abstract public function insert ( \\Hoa\\Tree\\Generic $child );", "private function modelToNorm(mixed $value): mixed\n {\n try {\n foreach ($this->config->getModelTransformers() as $transformer) {\n $value = $transformer->transform($value);\n }\n } catch (TransformationFailedException $exception) {\n throw new TransformationFailedException(sprintf('Unable to transform data for property path \"%s\": ', $this->getPropertyPath()).$exception->getMessage(), $exception->getCode(), $exception, $exception->getInvalidMessage(), $exception->getInvalidMessageParameters());\n }\n\n return $value;\n }", "final protected function nonNullIfHasDefault(AbstractAttribute $attribute): void\n {\n $type = $attribute->getTypeInstance();\n if ($type instanceof NonNull && $attribute->hasDefaultValue()) {\n $attribute->setTypeInstance($type->getWrappedType());\n }\n }", "abstract public function removeItemChild($itemName, $childName);", "public function getQuantityUsdNormalizedAttribute()\n {\n return fromSatoshi($this->quantity_usd);\n }", "public function normalize($object, $format = null, array $context = array())\n {\n return;\n }", "public function set($child) {\n\t\t$this->childs = array($child);\n\t}", "protected function setChild(?string $nodename, NodeInterface $child)\n {\n $context = new ExceptionContext(\n 'exception.propimmutable',\n 'Read only'\n );\n\n throw new PropImmutableException($context);\n }", "protected function deletionType0(): void\n {\n if ($this->childs()->count()) {\n throw new LogicException('You can’t delete the owner, he has childs.');\n }\n $this->removeTreePathByIds($this->owner->id);\n }", "public function scale(float $scale_x = 0, float $scale_y = 0, float $scale_z = 0): EntityInterface;", "public function testAddChild_Modification()\n\t{\n\t\t$this->object->AddChild($this->child);\n\t\t$this->child->attribute = \"changed att\";\n\t\t$this->assertEquals(\"changed att\", $this->object->childList[0]->attribute);\n\t}", "function inherit() { \n // Determine parent 'display' value\n $handler =& get_css_handler('display');\n\n // 'display' CSS property processed AFTER this; so parent display value will be\n // on the top of the stack\n //\n $parent_display = $handler->get();\n\n // Inherit vertical-align from table-rows \n if ($parent_display === \"table-row\" || $parent_display === \"table\") {\n $this->push($this->get());\n return;\n }\n\n $this->push(is_inline_element($parent_display) ? $this->get() : $this->default_value());\n }", "public function child()\n {\n if ($this->type == 'attribute_template') {\n return $this->attributeTemplate();\n } elseif ($this->type == 'dice_roll') {\n return $this->diceRoll();\n } else {\n return $this->{$this->type}();\n }\n }", "public static function denormalizeCallNumber($norm);", "protected function childCleanup() {\n }", "function norm() {\n return sqrt($this->length2());\n }", "public function removeChild(CategoryTreeNodeInterface $child);", "public function killChild()\n\t{\n\t\tif (!$this->child) {\n\t\t\t$this->logger->log(LogLevel::DEBUG, 'No child to kill.');\n\t\t\treturn;\n\t\t}\n\n\t\t$context = array('child' => $this->child);\n\t\t$this->logger->log(LogLevel::INFO, 'Killing child at {child}', $context);\n\t\tif (exec('ps -o pid,s -p ' . $this->child, $output, $returnCode) && $returnCode != 1) {\n\t\t\t$context = array('child' => $this->child);\n\t\t\t$this->logger->log(LogLevel::DEBUG, 'Child {child} found, killing.', $context);\n\t\t\tposix_kill($this->child, SIGKILL);\n\t\t\t$this->child = null;\n\t\t} else {\n\t\t\t$context = array('child' => $this->child);\n\t\t\t$this->logger->log(LogLevel::INFO, 'Child {child} not found, restarting.', $context);\n\t\t\t$this->shutdown();\n\t\t}\n\t}", "public function normal($outputNow = false)\n {\n return $this->sgr(array(ControlSequences\\EscapeSequences\\Enums\\SGR::STYLE_INTENSITY_NORMAL), $outputNow);\n }", "protected function convertChildToArray($name, MP_AdvancedDataflow_Model_Entity_Entity $child)\n {\n $data = array();\n $model = $this->getModel();\n if ($model) {\n $getter = $child->getGetter();\n $relation = $child->getRelation();\n if ($relation == 'many') {\n $childModels = $model->$getter();\n if (!empty($childModels) && count($childModels)) {\n foreach ($childModels as $index => $childModel) {\n $child->setIndex($index);\n $child->setModel($childModel);\n $data = array_merge($data, $child->convertEntityToArray());\n }\n }\n } else {\n $childModel = $model->$getter();\n if ($childModel) {\n $child->setModel($childModel);\n $data = array_merge($data, $child->convertEntityToArray());\n }\n }\n }\n return $data;\n }", "protected function takeChildFromDOM($child)\n {\n $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;\n switch ($absoluteNodeName) {\n case $this->lookupNamespace('atom') . ':' . 'generator':\n $generator = new Zend_Gdata_App_Extension_Generator();\n $generator->transferFromDOM($child);\n $this->_generator = $generator;\n break;\n case $this->lookupNamespace('atom') . ':' . 'icon':\n $icon = new Zend_Gdata_App_Extension_Icon();\n $icon->transferFromDOM($child);\n $this->_icon = $icon;\n break;\n case $this->lookupNamespace('atom') . ':' . 'logo':\n $logo = new Zend_Gdata_App_Extension_Logo();\n $logo->transferFromDOM($child);\n $this->_logo = $logo;\n break;\n case $this->lookupNamespace('atom') . ':' . 'subtitle':\n $subtitle = new Zend_Gdata_App_Extension_Subtitle();\n $subtitle->transferFromDOM($child);\n $this->_subtitle = $subtitle;\n break;\n default:\n parent::takeChildFromDOM($child);\n break;\n }\n }", "abstract protected function _normalizeIterable($iterable);", "protected function normalizeNode($node) {\n\t\tif ($node instanceof PHPParser_Builder) {\n\t\t\treturn $node->getNode ();\n\t\t} elseif ($node instanceof PHPParser_Node) {\n\t\t\treturn $node;\n\t\t}\n\t\t\n\t\tthrow new LogicException ( 'Expected node or builder object' );\n\t}", "public function getNormalized($user)\n {\n return call_user_func($this->_normalizer, $user);\n }", "public function testComplexTypeElementWithParentThrowsExceptionWhenElementElementSetTypeElement(): void\n {\n $parent1 = new ElementElement();\n $parent1->setTypeElement($this->sut);\n \n $parent2 = new ElementElement();\n $this->expectInvalidOperationExceptionChildOfAnotherElement($this->sut, $parent2);\n $parent2->setTypeElement($this->sut);\n }", "public function normalize($node) {\n\t\tif (is_array($node)) {\n\t\t\t$node = array_values($node);\n\t\t\t$primary = 'id';\n\n\t\t\tif (!is_object($node[0])) {\n\t\t\t\t$node[0] = ClassRegistry::init($node[0]);\n\t\t\t}\n\n\t\t\t$node[0]->id = $node[1];\n\t\t\treturn $node[0];\n\t\t}\n\n\t\treturn $node;\n\t}", "private function addInverseRelationToChild(string $stub, bool $plural = false)\n {\n $path = app_path(\"{$this->child}.php\");\n\n File::append($path,\n $this->replaceSimpleRelationNames($stub, $this->parent, $plural)\n );\n }", "public static function normalize($data){\n\t\t$form = $form ?: \\ActiveSupport\\Multibyte::$default_normalization_form;\n\t\t# See http://www.unicode.org/reports/tr15, Table 1\n\t\tswitch($form){\n\t\t\tcase 'd':\n\t\t\t\treturn normalizer_normalize($data, \\Normalizer::FORM_D);\n\t\t\tcase 'c':\n\t\t\t\treturn normalizer_normalize($data, \\Normalizer::FORM_C);\n\t\t\tcase 'kd':\n\t\t\t\treturn normalizer_normalize($data, \\Normalizer::FORM_KD);\n\t\t\tcase 'kc':\n\t\t\t\treturn normalizer_normalize($data, \\Normalizer::FORM_KC);\n\t\t\tdefault:\n\t\t\t\tthrow new \\InvalidArgumentException(\"{$form} is not a valid normalization variant\"); //, caller\n\t\t}\n\t}", "public function updateChildFilesystem()\n {\n // Don't synchronise on live (rely on publishing instead)\n if (class_exists(Versioned::class) && $this->hasExtension(Versioned::class) && Versioned::get_stage() === Versioned::LIVE) {\n return;\n }\n\n $this->flushCache();\n // Writing this record should trigger a write (and potential updateFilesystem) on each child\n foreach ($this->AllChildren() as $child) {\n $child->write();\n }\n }", "public function normalizeData() : array;", "protected function cleanUpVariantChildren($parentProductId, array $childData)\n {\n\n // we don't want delete everything\n if (empty($childData)) {\n return;\n }\n\n // load the SKU of the parent product\n $parentSku = $this->getValue(ColumnKeys::SKU);\n\n // remove the old variantes from the database\n $this->getProductVariantProcessor()\n ->deleteProductSuperLink(\n array(\n MemberNames::PARENT_ID => $parentProductId,\n MemberNames::SKU => $childData\n )\n );\n\n // log a debug message that the image has been removed\n $this->getSubject()\n ->getSystemLogger()\n ->debug(\n $this->getSubject()->appendExceptionSuffix(\n sprintf(\n 'Successfully clean up variants for product with SKU \"%s\" except \"%s\"',\n $parentSku,\n implode(', ', $childData)\n )\n )\n );\n }", "public function reset()\n {\n parent::reset();\n $this->attr('Geometry')->primitive('box');\n }", "protected function _ensureInheritedAttributes() {}", "public function removeChild(ThemeMenuItem $child)\n {\n }", "public function updateChildren(Collection $children)\n {\n foreach ($children as $child) {\n $this->update($child, ['parent_slug' => null]);\n }\n }", "public function test_normalize_1()\n {\n $SIMPLE_DATE = \"Y-m-d H:i:s\";\n\n $level9 = [];\n $level = &$level9;\n for($i=0; $i <= 9; $i++) {\n $level[\"level$i\"] = [];\n $level = &$level[\"level$i\"];\n }\n\n $overflow = [];\n for($i=0; $i <= 1001; $i++) {\n $overflow[\"item$i\"] = $i;\n }\n\n $record = [\n \"message\" => \"Start execution\",\n \"levels\" => $level9,\n \"overflow\" => $overflow,\n \"level_name\" => 'INFO',\n ];\n\n $object = $this->getMockBuilder(CustomLogFormatter::class)\n ->setConstructorArgs([null, $SIMPLE_DATE])\n ->disableArgumentCloning()\n ->disableOriginalClone()\n ->getMock();\n\n $method = self::getMethod(\"normalize\", CustomLogFormatter::class);\n $result = $method->invokeArgs($object, [$record]);\n\n $overflow = [];\n for($i=0; $i <= 999; $i++) {\n $overflow[\"item$i\"] = $i;\n }\n\n $overflow[\"...\"] = \"Over 1000 items (1002 total), aborting normalization\";\n\n self::assertEquals([\n 'message' => 'Start execution',\n 'levels' => [\n 'level0' => [\n 'level1' => [\n 'level2' => [\n 'level3' => [\n 'level4' => [\n 'level5' => [\n 'level6' => [\n 'level7' => [\n 'level8' => 'Over 9 levels deep, aborting normalization'\n ]\n ]\n ]\n ]\n ]\n ]\n ]\n ]\n ],\n 'overflow' => $overflow,\n 'level_name' => 'INFO'], $result);\n }", "protected function typeNormalize($type)\n {\n if (\\in_array($type, array('', null), true)) {\n return null;\n }\n return \\preg_replace_callback('/\\b(boolean|integer|self)\\b/', function ($matches) {\n switch ($matches[1]) {\n case 'boolean':\n return 'bool';\n case 'integer':\n return 'int';\n case 'self':\n return $this->reflector\n ? $this->getReflectorsClassname($this->reflector)\n : 'self';\n }\n }, $type);\n }", "function wponion_field_cloneable_sanitize( $value = '', $callback = '' ) {\n\t\tif ( wponion_is_array( $value ) ) {\n\t\t\tforeach ( $value as $i => $v ) {\n\t\t\t\t$value[ $i ] = wponion_callback( $callback, array( $v ) );\n\t\t\t}\n\t\t}\n\t\treturn $value;\n\t}", "protected function normalizeValue($value) {\n\t\tif ($value instanceof PHPParser_Node) {\n\t\t\treturn $value;\n\t\t} elseif (is_null ( $value )) {\n\t\t\treturn new PHPParser_Node_Expr_ConstFetch ( new PHPParser_Node_Name ( 'null' ) );\n\t\t} elseif (is_bool ( $value )) {\n\t\t\treturn new PHPParser_Node_Expr_ConstFetch ( new PHPParser_Node_Name ( $value ? 'true' : 'false' ) );\n\t\t} elseif (is_int ( $value )) {\n\t\t\treturn new PHPParser_Node_Scalar_LNumber ( $value );\n\t\t} elseif (is_float ( $value )) {\n\t\t\treturn new PHPParser_Node_Scalar_DNumber ( $value );\n\t\t} elseif (is_string ( $value )) {\n\t\t\treturn new PHPParser_Node_Scalar_String ( $value );\n\t\t} elseif (is_array ( $value )) {\n\t\t\t$items = array ();\n\t\t\t$lastKey = - 1;\n\t\t\tforeach ( $value as $itemKey => $itemValue ) {\n\t\t\t\t// for consecutive, numeric keys don't generate keys\n\t\t\t\tif (null !== $lastKey && ++ $lastKey === $itemKey) {\n\t\t\t\t\t$items [] = new PHPParser_Node_Expr_ArrayItem ( $this->normalizeValue ( $itemValue ) );\n\t\t\t\t} else {\n\t\t\t\t\t$lastKey = null;\n\t\t\t\t\t$items [] = new PHPParser_Node_Expr_ArrayItem ( $this->normalizeValue ( $itemValue ), $this->normalizeValue ( $itemKey ) );\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\treturn new PHPParser_Node_Expr_Array ( $items );\n\t\t} else {\n\t\t\tthrow new LogicException ( 'Invalid value' );\n\t\t}\n\t}", "protected function actionPostLoadingEvent()\n {\n if (self::$child_data === null) {\n self::$child_data = [];\n foreach ($this->getParentModel()->children->child->iterateItems() as $node_uuid => $node) {\n if (empty((string)$node->enabled)) {\n continue;\n }\n $conn_uuid = (string)$node->connection;\n if (!isset(self::$child_data[$conn_uuid])) {\n self::$child_data[$conn_uuid] = [];\n }\n foreach (self::$child_attrs as $key) {\n if (!isset(self::$child_data[$conn_uuid][$key])) {\n self::$child_data[$conn_uuid][$key] = [];\n }\n self::$child_data[$conn_uuid][$key][] = (string)$node->$key;\n }\n }\n }\n foreach ($this->internalChildnodes as $node) {\n if (!$node->getInternalIsVirtual()) {\n $extra_attr = ['local_ts' => '', 'remote_ts' => ''];\n $conn_uuid = (string)$node->getAttribute('uuid');\n foreach (self::$child_attrs as $key) {\n $child_node = new TextField();\n $child_node->setInternalIsVirtual();\n if (isset(self::$child_data[$conn_uuid]) && !empty(self::$child_data[$conn_uuid][$key])) {\n $child_node->setValue(implode(',', array_unique(self::$child_data[$conn_uuid][$key])));\n }\n $node->addChildNode($key, $child_node);\n }\n }\n }\n return parent::actionPostLoadingEvent();\n }" ]
[ "0.6927757", "0.6870332", "0.66392255", "0.63899523", "0.62249064", "0.59590745", "0.5476679", "0.5424318", "0.5138916", "0.5130973", "0.50763273", "0.5074389", "0.49913904", "0.49122608", "0.48611665", "0.48491368", "0.48403552", "0.48290294", "0.48242664", "0.48081803", "0.46835756", "0.455039", "0.45446157", "0.45071056", "0.4426411", "0.44215488", "0.44178185", "0.44152474", "0.4413984", "0.4399423", "0.43922505", "0.43918785", "0.43624136", "0.43445894", "0.432592", "0.4323271", "0.4297726", "0.4292785", "0.42907006", "0.42859957", "0.4276288", "0.42713812", "0.42701685", "0.42579526", "0.4252725", "0.425249", "0.425249", "0.42505577", "0.42340752", "0.42302597", "0.4227696", "0.4225859", "0.42090127", "0.41944537", "0.41826048", "0.41776726", "0.41461524", "0.41361773", "0.41327092", "0.4122001", "0.41090995", "0.4101435", "0.40881938", "0.40858257", "0.40853792", "0.40633357", "0.40502968", "0.4044423", "0.403976", "0.40390047", "0.40373284", "0.4036148", "0.40340403", "0.4031599", "0.40302938", "0.4026772", "0.40234515", "0.4019681", "0.40174994", "0.4008535", "0.40046516", "0.3997402", "0.39968246", "0.39967525", "0.3996124", "0.3986373", "0.39795506", "0.3977839", "0.39698488", "0.39692116", "0.39687642", "0.39368382", "0.3934111", "0.39308688", "0.39269358", "0.3923498", "0.3914465", "0.3912169", "0.39102292", "0.39053947" ]
0.56925315
6
Creates a new instance of a child element.
protected function _createChildInstance($child, $config = null) { $childConfig = $this->_getChildConfig($child, $config); $factory = $this->_getChildFactory($child, $config); return $factory->make($childConfig); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function createChild()\n\t{\n\t\t$obj = new static();\n\t\t$obj['parent'] = $this;\n\n\t\treturn $obj;\n\t}", "public function createChild()\n {\n if (!$this->id) {\n throw new Exception(sprintf('Cannot create a new child entity for a non-existent %s entity', $this->getName()));\n }\n $child = $this->_model->create($this->getName());\n $child->Parent = $this;\n\n return $child;\n }", "function create_dom_node(&$dom, &$parent_node, $node_name, $node_value = NULL){\n\t\t$node = $dom->create_element($node_name);\n\t\t$new_node = $parent_node->append_child($node);\n\t\tif($node_value != NULL){\n\t\t\t$txt_node = $dom->create_text_node($node_value);\n\t\t\t$new_node->append_child($txt_node);\n\t\t}\n\t\treturn $new_node;\n\t}", "public function addChild(Node $child);", "public function createchild($value) {\n return $this->setProperty('createchild', $value);\n }", "public function create()\r\n {\r\n // Load only root elements.\r\n $this->loadRoots($this->elements, $this->roots);\r\n\r\n // Make sure that first element isn't child. If child then throw a exception about that.\r\n if ($this->elements[0]->isChild())\r\n TypeRegression::cantBe('child', 'First');\r\n\r\n // Set elements compiled field with relations\r\n $this->makeRelationsToCompiled($this->elements);\r\n \r\n // After append process by root-child then compile all stuffs into 'page' field.\r\n foreach ($this->roots as $key => $element) {\r\n \r\n $this->page .= $element->compiled;\r\n }\r\n }", "public function addChildNode( SimpleXMLElement $oChild ) \n\t\t{\n\t\t\t$oParentDOM = dom_import_simplexml( $this );\n\t\t\t$oChildDOM = dom_import_simplexml( $oChild );\n\t\t\t$oNewParentDOM = $oParentDOM->ownerDocument->importNode( $oChildDOM, true );\n\t\t\t$oParentDOM->appendChild( $oNewParentDOM );\n\t\t\n\t\t}", "public final function create(string $name, $attrs = null)\n {\n $this->insert(null, $child = static::el($name, $attrs));\n return $child;\n }", "function add_child($dom, $base, $name, $value) {\n\tif ($value) {\n\t\t// Stupid DOMDocument functions don't escape ampersands (&)\n\t\t$value = str_replace('&', '&amp;', $value);\n\t\t$child = $base->appendChild($dom->createElement($name, $value));\n\t} else {\n\t\t$child = $base->appendChild($dom->createElement($name));\n\t}\n\treturn $child;\n}", "abstract protected function createChild(string $name): Item;", "final public function addChild ()\n {\n throw new ChildException('Trying to add child to self closing HTML element');\n }", "function createNode ($a_parent, $a_elementname, $a_attr_list = NULL, $a_text = NULL)\n\t{\n\t\t// create new element node\n\t\t$node = $this->createElement($a_elementname);\n\t\t\n\t\t// set attributes\n\t\tif (is_array($a_attr_list)) {\n\t\t\tforeach ($a_attr_list as $attr => $value) {\n\t\t\t\t$node->set_attribute($attr, $value);\n\t\t\t}\n\t\t}\n\t\t\n\t\t// create and add a text node to the new element node\n\t\tif (is_string($a_text)) {\n\t\t\t$node_text = $this->doc->create_text_node($a_text);\n\t\t\t$node_text = $node->append_child($node_text);\n\t\t}\n\t\t\n\t\t// add element node at at the end of the children of the parent\n\t\t$node = $a_parent->append_child($node);\n\t\t\n\t\treturn $node;\n\t}", "public function buildElement() {\n\n // Set the element type\n $this->addType('example');\n\n // Add the element attributes\n $this->addAttributes(array(\n // Some attributes\n ));\n\n // Example if we need to add child object\n // to this element\n $object = new VTCore_Form_Base();\n $object->addType('example_child');\n $object->addAttributes(array(\n // Some Attributes\n ));\n\n // Adding a plaing text as child of subchild\n $object->addText('some text');\n\n // Inject the child and subchild back to parent\n $this->addChildren($object);\n\n // No need to echo or print anything, all the\n // actual rendering will be performed by\n // VTCore_Form_Base() when user is invoking\n // the render or __toString method.\n }", "protected function takeChildFromDOM($child)\n {\n $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;\n switch ($absoluteNodeName) {\n case $this->lookupNamespace('atom') . ':' . 'generator':\n $generator = new Zend_Gdata_App_Extension_Generator();\n $generator->transferFromDOM($child);\n $this->_generator = $generator;\n break;\n case $this->lookupNamespace('atom') . ':' . 'icon':\n $icon = new Zend_Gdata_App_Extension_Icon();\n $icon->transferFromDOM($child);\n $this->_icon = $icon;\n break;\n case $this->lookupNamespace('atom') . ':' . 'logo':\n $logo = new Zend_Gdata_App_Extension_Logo();\n $logo->transferFromDOM($child);\n $this->_logo = $logo;\n break;\n case $this->lookupNamespace('atom') . ':' . 'subtitle':\n $subtitle = new Zend_Gdata_App_Extension_Subtitle();\n $subtitle->transferFromDOM($child);\n $this->_subtitle = $subtitle;\n break;\n default:\n parent::takeChildFromDOM($child);\n break;\n }\n }", "public function createChild($title, $description = \"\", $weight = 0) {\n\t\treturn parent::create([\n\t\t\t\"parent_id\"\t => $this->getID(),\n\t\t\t\"title\"\t\t => $title,\n\t\t\t\"description\" => $description,\n\t\t\t\"weight\"\t => $weight\n\t\t]);\n\t}", "public function addChild($name = null, $content = null, array $attrs = [], $rule = self::AFTER_TEXT): Element\n {\n if ($name instanceof self) {\n $child = $name;\n $rule = trim($content);\n } else {\n $child = new static($name, $content, $attrs);\n }\n\n $rule = $this->isValidRule($rule) ? $rule : $this->defaultAddRule;\n $this->children[$rule][] = $child;\n\n return $child;\n }", "abstract protected function _getChildFactory($child, $config);", "function create(&$a_pg_obj, $a_hier_id, $a_pc_id = \"\")\n\t{\n\t\t$this->node = $this->createPageContentNode();\n\t\t$a_pg_obj->insertContent($this, $a_hier_id, IL_INSERT_AFTER, $a_pc_id);\n\t\t$this->tabs_node =& $this->dom->create_element(\"Tabs\");\n\t\t$this->tabs_node =& $this->node->append_child($this->tabs_node);\n\t}", "public function AddChildElement(IElement $child)\r\n {\r\n $this->Children[] = $child->Render();\r\n }", "public function addChild(pdoMap_Core_XML_Node $child) {\n $this->__childs[] = $child;\n // echo 'Add child '.$this->getName().'.'.$child->getName().'<br />';\n }", "public function testAddChild_Simple()\n\t{\n\t\t$this->object->AddChild($this->child);\n\t\t$this->assertType(\"child\", $this->object->childList[0]);\n\t\t$this->assertEquals(1, sizeof($this->object->childList));\n\t}", "public function html_valid_child_elements($value)\n\t{\n\t\t$this->html_valid_child_elements = $value;\n\t\treturn $this;\n\t}", "public function appendChild($child = NULL)\n\t{\n\t\tif ($child instanceof DOMNode) {\n\t\t\tparent::appendChild($child);\n\t\t}\n\t\treturn $this;\n\t}", "public function testCreate_Child()\n {\n $childDAO = new childDAO();\n\n $childTest = new childModel(8, \"Red Ranger\", \"None\", \"Tom\", 1);\n $child_id = $childDAO->insert($childTest);\n\n $childFound=$childDAO->find($child_id);\n\n $this->assertEquals($child_id, $childFound->child_id);\n $this->assertEquals(8, $childFound->parent_id);\n $this->assertEquals(\"Red Ranger\", $childFound->child_name);\n $this->assertEquals(\"None\", $childFound->allergies);\n $this->assertEquals(\"Tom\", $childFound->trusted_parties);\n }", "function addChild( $ni )\n\t\t{\n\t\t$this->childs[] = $ni ;\n\t\t}", "public function addChild($itemID){\n $child = new FPNode($itemID,1,$this);\n array_push($this->children, $child);\n return $child;\n }", "function create(&$a_pg_obj, $a_hier_id)\n\t{\n\t\t$this->node = $this->createPageContentNode();\n\t}", "protected function createElement($name, $value = null)\n {\n // otherwise only one element is attached to the DOM.\n\n $id = null;\n $uri = null;\n\n // The node name can contain the namespace id prefix.\n // Example: xsl:template\n $colon_pos = \\strpos($name, ':');\n\n if ($colon_pos !== false) {\n $id = \\substr($name, 0, $colon_pos);\n $name = \\substr($name, $colon_pos + 1);\n }\n\n if ($id !== null) {\n $ns = $this->namespaces[$id];\n $uri = $ns->uri();\n\n if ($ns->mode() === FluidNamespace::MODE_EXPLICIT) {\n $name = \"{$id}:{$name}\";\n }\n }\n\n // Algorithm 1:\n $el = new \\DOMElement($name, $value, $uri);\n\n // Algorithm 2:\n // $el = $dom->createElement($name, $value);\n\n return $el;\n }", "protected function takeChildFromDOM($child)\n {\n $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;\n\n switch ($absoluteNodeName) {\n case $this->lookupNamespace('apps') . ':' . 'login';\n $login = new Zend_Gdata_Gapps_Extension_Login();\n $login->transferFromDOM($child);\n $this->_login = $login;\n break;\n case $this->lookupNamespace('apps') . ':' . 'name';\n $name = new Zend_Gdata_Gapps_Extension_Name();\n $name->transferFromDOM($child);\n $this->_name = $name;\n break;\n case $this->lookupNamespace('apps') . ':' . 'quota';\n $quota = new Zend_Gdata_Gapps_Extension_Quota();\n $quota->transferFromDOM($child);\n $this->_quota = $quota;\n break;\n case $this->lookupNamespace('gd') . ':' . 'feedLink';\n $feedLink = new Zend_Gdata_Extension_FeedLink();\n $feedLink->transferFromDOM($child);\n $this->_feedLink[] = $feedLink;\n break;\n default:\n parent::takeChildFromDOM($child);\n break;\n }\n }", "public function createChildOf(array $attributes, Node $parent)\n {\n // Get new position\n $position = $this->getLastChildPosition($parent);\n $attributes[$this->getPositionName()] = $position;\n\n $model = $this->performCreateChildOf($attributes, $parent);\n\n return $model;\n }", "function createElement ($a_node)\n\t{\n\t\treturn $this->doc->create_element($a_node);\n\t}", "abstract public function insert ( \\Hoa\\Tree\\Generic $child );", "static function cria($elName, ElementMaker $parent = null) {//coberto\n return new ElementMaker($elName, $parent);\n }", "public function __construct($children = array()) {\n $this->tagName = 'div';\n foreach($children as $c) {\n $this->appendChild($c);\n }\n }", "public function create(string $name, $native=null): Element\n {\n $this->needsToBeUnlocked();\n\n $element = new $this->elementClass($name, $native ?: $name);\n $this->set($element);\n\n return $element;\n }", "protected function createElement($element)\n {\n if (is_string($element)) {\n $element = new FormElement($element);\n }\n\n return $element;\n }", "abstract public function addItemChild($itemName, $childName);", "public function appendChild($child, array $options = array()) \n {\n $this->children[] = $child;\n\n return $child;\n }", "public function addChild(self $child): self\n {\n $this->children[] = $child;\n\n return $this;\n }", "public function add_child($child) {\n\t\t$this->children[] = $child;\n\t}", "public function createElement( $name, $attributes = array(), $value = '' ) {\n\t\t\tif ( is_string( $name ) && strpos( $name, '<' ) ) {\n\t\t\t\t// xml string given\n\t\t\t\t$xml = \\arc\\xml::parse( $name );\n\t\t\t\t$imported = $this->importNode( $xml );\n\t\t\t\treturn $imported;\n\t\t\t} else if ( $name instanceof Element ) {\n\t\t\t\t// element passed, so just return that, imported in this DOMDocument\n\t\t\t\t$imported = $this->importNode( $name );\n\t\t\t\treturn $imported;\n\t\t\t} else if ( !is_string( $name ) ) {\n\t\t\t\tthrow new \\arc\\Exception( 'arc\\\\xml\\\\createElement requires name to be a string', 101 );\n\t\t\t} else {\n\t\t\t\tif ( is_array( $value ) ) {\n\t\t\t\t\t// create a node list of elements\n\t\t\t\t\t$result = array();\n\t\t\t\t\tforeach ( $value as $item ) {\n\t\t\t\t\t\t$result = $this->createElement( $name, $attributes, $item );\n\t\t\t\t\t}\n\t\t\t\t\treturn new NodeList( $result, $this );\n\t\t\t\t} else {\n\t\t\t\t\t// check if value is parseable xml\n\t\t\t\t\t$nodeValue = $value;\n\t\t\t\t\t// now create the element\n\t\t\t\t\tlist ( $prefix, $namespace, $localName ) = $this->parseName( $name );\n\t\t\t\t\tif ( $this->domReference instanceof \\DOMDocument ) {\n\t\t\t\t\t\t$domDocument = $this->domReference;\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$domDocument = $this->domReference->ownerDocument;\n\t\t\t\t\t}\n\t\t\t\t\tif ( $namespace ) {\n\t\t\t\t\t\t$domElement = $domDocument->createElementNS( $namespace, $prefix.':'.$localName, $nodeValue );\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$domElement = $domDocument->createElement( $name, $nodeValue );\n\t\t\t\t\t}\n\t\t\t\t\treturn $this->document->proxy( $domElement );\n\t\t\t\t}\n\t\t\t}\n\t\t}", "public function insertChild(Element $element, int $index): self\n {\n if (array_key_exists($index, $this->children)) {\n $this->beforeInsert($element);\n array_splice($this->children, $index, 0, [$element]);\n $this->afterInsert();\n } elseif ($index === count($this->children)) {\n $this->appendChild($element);\n } elseif ($index === 0) {\n $this->prependChild($element);\n } else {\n throw new \\OutOfBoundsException(\n 'index must be a valid key, zero, or length plus one'\n );\n }\n\n return $this;\n }", "function createHTTPChild($parent, $action, $name=\"noname\") {\n\tglobal $sugar_domain, $sugar_path;\n\t$node = $parent->addChild('http', '');\n\t$node->addChild('name', $name);\n\t$node->addChild('domain', $sugar_domain);\n\t$node->addChild('path', $sugar_path);\n\t$node->addChild('method', $action);\n\t$node->addChild('data', '');\n\treturn $node;\n}", "public function get_child($position) : HTMLNode\n {\n return $this -> children -> get($position);\n }", "public function setChildNodes(array $childNodes) : ElementInterface\n {\n return new NormalElement($this->localName, $this->attributes, $childNodes);\n }", "public function element($tag,$content = false)\r\n {\r\n $element = new Element($this,$tag,$content);\r\n\r\n if($this->nestElement instanceof Element)\r\n {\r\n $this->nestElement->child($element);\r\n }\r\n\r\n return $element;\r\n }", "function CreateChildControls() {\n }", "function add_child( $child ) {\n\t\tif( $child instanceof ModularPost ) {\n\t\t\t$this->children[] = $child;\n\t\t}\n\t}", "public function createField($name, $parent = false)\n {\n if ($parent) {\n if (is_object($parent)) {\n $real_parent = $parent;\n } elseif (is_string($parent)) {\n $real_parent = $this->xmldoc->getElementsByTagName($parent)->item(0);\n } else {\n throw new InvalidArgumentException('Unknown parent. (Did you forget to create it?)');\n }\n } else {\n $real_parent = $this->xmldoc;\n }\n\n $new_field = $this->xmldoc->createElement($name);\n $real_parent->appendChild($new_field);\n\n return $new_field;\n }", "protected function createVirtualElement()\n {\n $id = uniqid();\n\n $depth = $this->reader->depth;\n\n $parent = isset($this->parents[$depth - 1]) ? $this->parents[$depth - 1] : null;\n\n $attributes = [\n '@id' => $id,\n '@parent' => $parent,\n '@element' => $this->reader->name,\n ];\n\n $element = new Collection($attributes);\n\n $this->parents[$depth] = $id;\n\n $this->references[$id] = $element;\n\n return $element;\n }", "function addChild( $node )\n\t\t{\n\t\t$this->childs[] = $node ;\n\t\t}", "protected function createItem()\n {\n return $this->_setUpNewNode(\n new Item()\n );\n }", "public function create()\n {\n return view('Element.make-elements');\n }", "public function element() {\n\t\t$element = parent::element();\n\t\t$element->data('field', self::$fieldname);\n\t\treturn $element;\n\t}", "public function add($child, $name = false) {\n\t\tif( $name ) {\n\t\t\t$this->childs[$name] = $child;\n\t\t} else {\n\t\t\t$this->childs[] = $child;\n\t\t}\n\t\treturn $this;\n\t}", "protected function takeChildFromDOM($child)\n {\n $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;\n\n switch ($absoluteNodeName) {\n case $this->lookupNamespace('apps') . ':' . 'login';\n $login = new Zend_Gdata_Gapps_Extension_Login();\n $login->transferFromDOM($child);\n $this->_login = $login;\n break;\n case $this->lookupNamespace('apps') . ':' . 'nickname';\n $nickname = new Zend_Gdata_Gapps_Extension_Nickname();\n $nickname->transferFromDOM($child);\n $this->_nickname = $nickname;\n break;\n default:\n parent::takeChildFromDOM($child);\n break;\n }\n }", "public function addChild(ModelInterface $child, $placeholder = null, $append = false);", "public function newChild($parent_task, $child_task){\n $team_code = $this->Task->getLeadCodeByTask($child_task);\n $task_sd = $this->Task->getShortDescByTask($child_task);\n\n $data = array(\n 'task_id'=>$parent_task,\n 'change_type_id'=>301,\n );\n\n if($child_task){\n $data['new_val'] = $child_task;\n } \n if($team_code){\n $data['var1'] = $team_code;\n }\n if($task_sd){\n $data['var2'] = $task_sd;\n }\n if(CakeSession::read('Auth.User.id')){\n $data['user_id']= CakeSession::read('Auth.User.id');\n }\n\n $this->create();\n if($this->save($data)){\n return true;\n }\n else{\n return false; \n }\n }", "public function add($child) {\n $this->children[] = $child;\n }", "public function addChild(Node $child) {\n return $this->root->addChild($child);\n }", "public function createElement($qualifiedName, $content = NULL, array $attributes = NULL): Element {\n [$prefix, $localName] = QualifiedName::split($qualifiedName);\n $namespaceURI = '';\n if ($prefix !== FALSE) {\n if (empty($prefix)) {\n $qualifiedName = $localName;\n } else {\n if ($this->namespaces()->isReservedPrefix($prefix)) {\n throw new \\LogicException(\n \\sprintf('Can not use reserved namespace prefix \"%s\" in element name.', $prefix)\n );\n }\n $namespaceURI = (string)$this->namespaces()->resolveNamespace($prefix);\n }\n } else {\n $namespaceURI = (string)$this->namespaces()->resolveNamespace('#default');\n }\n if ($namespaceURI !== '') {\n $node = $this->createElementNS($namespaceURI, $qualifiedName);\n } elseif (isset($this->_namespaces['#default'])) {\n $node = $this->createElementNS('', $qualifiedName);\n } else {\n $node = parent::createElement($qualifiedName);\n }\n $this->appendAttributes($node, $content, $attributes);\n $this->appendContent($node, $content);\n return $node;\n }", "public function testAddChild_Duplicate()\n\t{\n\t\t$this->child->Save();\n\t\t$this->object->AddChild($this->child);\n\t\t$this->object->AddChild($this->child);\n\t\t$this->assertEquals(1, sizeof($this->object->childList));\n\t}", "public function addChild($arg = \"\", $index = -1) {\n\t\tif ($index < 0 || $index >= count($this->children)-1) {\n\t\t\tif (is_array($arg)) {\n\t\t\t\tforeach ($arg as $a) {\n\t\t\t\t\t$this -> addChild($a);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif ($arg instanceof Node) {\n\t\t\t\t\tif ($arg -> parentNode) {\n\t\t\t\t\t\t$arg -> parentNode -> removeChild($arg);\n\t\t\t\t\t}\n\t\t\t\t\t$arg -> parentNode = $this;\n\t\t\t\t\treturn $this -> children[] = $arg;\n\t\t\t\t} elseif (is_string((string) $arg)) {\n\t\t\t\t\t$textNode = new TextNode($arg);\n\t\t\t\t\t$textNode -> parentNode = $this;\n\t\t\t\t\treturn $this -> children[] = $textNode;\n\t\t\t\t}\n\t\t\t}\n\t\t} elseif (is_int($index)) {\n\t\t\tfor ($i = count($this->children); $i >= $index; $i--) {\n\t\t\t\t$child = $this->children[$i];\n\t\t\t\t$this->children[$i+1] = $child;\n\t\t\t}\n\t\t\tif ($arg instanceof Node) {\n\t\t\t\tif ($arg -> parentNode) {\n\t\t\t\t\t$arg -> parentNode -> removeChild($arg);\n\t\t\t\t}\n\t\t\t\t$arg -> parentNode = $this;\n\t\t\t\treturn $this -> children[$index] = $arg;\n\t\t\t} elseif (is_string((string) $arg)) {\n\t\t\t\t$textNode = new TextNode($arg);\n\t\t\t\t$textNode -> parentNode = $this;\n\t\t\t\treturn $this -> children[$index] = $textNode;\n\t\t\t}\n\t\t}\n\t}", "public function addChildElement(HtmlElementInterface $element);", "public function addChild(Node $child)\n {\n $this->children[] = $child;\n }", "public function appendTo(Element $parent, Element $child)\n {\n $this->contentManager->appendTo($parent, $child);\n\n return $this;\n }", "public function AddChild(string $childHTML)\r\n {\r\n $this->Children[] = $childHTML;\r\n }", "public function add($child, $type = null, array $options = array());", "public static function tag($tagname, $children = array(), $attributes = array())\n {\n return new Element($tagname, $children, $attributes);\n }", "public function addChild(PlaceholderInterface $child);", "public function addChildNode(\\F3\\Fluid\\Core\\Parser\\SyntaxTree\\NodeInterface $childNode);", "public function testAddChild_Loop()\n\t{\n\t\t$someChild1 = new child('somechild1 att');\n\t\t$someChild2 = new child('somechild2 att');\n\t\t$someChild3 = new child('somechild3 att');\n\n\t\t$childList = array($someChild1, $someChild2, $someChild3);\n\n\t\tforeach ($childList as $child)\n\t\t{\n\t\t\t$this->object->AddChild($child);\n\t\t}\n\n\t\t$this->assertEquals('somechild1 att', $this->object->childList[0]->attribute);\n\t\t$this->assertEquals('somechild2 att', $this->object->childList[1]->attribute);\n\t\t$this->assertEquals('somechild3 att', $this->object->childList[2]->attribute);\n\t}", "public function addChild($child)\r\n\t{\r\n\t\t$this->last = $child->last;\r\n\r\n\t\t$this->entries []= $child;\r\n\t}", "public function newInstance($attributes = array(), $exists = false);", "public function getChildElements() {}", "public function addChildWithCDATA($name, $value = NULL) {\n $new_child = $this->addChild($name);\n if ($new_child !== NULL) {\n $node = dom_import_simplexml($new_child);\n $no = $node->ownerDocument;\n $node->appendChild($no->createCDATASection($value));\n }\n return $new_child;\n }", "public function addChild(HTMLElement $el) {\n\t\tparent::addChild($el);\n\t\t/* Add pointer to last child, and its children */\n\t\t$this->rAddPointers($this->getChild($this->getNoOfChildren()-1));\n\t}", "public function add_child(SBBCodeParser_Node $child)\r\n\t{\r\n\t\t$this->children[] = $child;\r\n\t\t$child->set_parent($this);\r\n\t}", "public static function createElement($tag = '')\n {\n self::$instance = new static($tag);\n return self::$instance;\n }", "function __construct( $Attributes = null, $InnerHTML = null , $displayOnConstruct = false) {\n\n\t\t// set the parent element name\n\t\t$this->ElementName = 'div';\n\t\t\n\t\tparent::__construct($Attributes, $InnerHTML, $displayOnConstruct);\t\n\t}", "public function addChild(self $child): void\n\t{\n\t\tif (!$this->children->contains($child)) {\n\t\t\t// ...and assign it to collection\n\t\t\t$this->children->add($child);\n\t\t}\n\t}", "function child(string $subpath) {\n if (!$subpath)\n return $this;\n $subpath = explode('/', $subpath);\n $typeChildname = array_shift($subpath);\n $pos = strpos($typeChildname, '-');\n $type = substr($typeChildname, 0, $pos);\n $childname = substr($typeChildname, $pos+1);\n if ($type == 'dbServers')\n $child = new DbServer($this->path.'/dbServers-'.$childname, $this->yaml['dbServers'][$childname]);\n elseif ($type == 'views') {\n //echo \"<pre>yaml=\"; print_r($this->yaml);\n //echo \"childname=$childname<br>\\n\";\n $view = $this->yaml['views'][$childname];\n $child = new Table(\n $this->path.\"/views-$childname\",\n $this->yaml['dbServers'][$view['server']]['params'],\n \"$view[schema].$view[table]\",\n isset($view['criteria']) ? $view['criteria'] : []\n );\n }\n elseif ($type == 'ugeojson') {\n $ugeojson = $this->yaml['ugeojson'][$childname];\n $child = new UGeoJSON(\n $this->path.\"/ugeojson-$childname\",\n $ugeojson['url']\n );\n }\n else\n throw new \\Exception(\"Cas non prévu\");\n if (!$subpath)\n return $child;\n else\n return $child->child(implode('/',$subpath));\n }", "public function createComponent()\n {\n return $this->createEmotionComponent(array(\n 'name' => 'Bilder',\n 'xtype' => 'emotion-media-widget',\n 'template' => 'image_widget',\n 'cls' => 'emotion-image-widget',\n 'description' => 'Einfaches Einkaufswelten-Element für Bilder' \n ));\n }", "public function appendElement(string $name, $content = '', array $attributes = NULL): Element {\n $this->appendChild(\n $node = $this->createElement($name, $content, $attributes)\n );\n return $node;\n }", "function _addXMLchild(& $parent, $name, $type, $content, $params=array()) {\n\t/** create new child node */\n\t$child = $parent->addChild(strtolower($name));\n\t/** fix attributes */\n\tif (is_array($content) && isset($content['fbtype'])) {\n\t\t$params['FBTYPE'] = $content['fbtype'];\n\t\tunset($content['fbtype']);\n\t}\n\tif (isset($params['VALUE']))\n\t\tunset($params['VALUE']);\n\tif (( 'trigger' == $name ) && ( 'duration' == $type ) && ( TRUE !== $content['relatedStart'] ))\n\t\t$params['RELATED'] = 'END';\n\tif (!empty($params)) {\n\t\t$parameters = $child->addChild('parameters');\n\t\tforeach ($params as $param => $parVal) {\n\t\t\t$param = strtolower($param);\n\t\t\tif ('x-' == substr($param, 0, 2)) {\n\t\t\t\t$p1 = $parameters->addChild($param);\n\t\t\t\t$p2 = $p1->addChild('unknown', htmlspecialchars($parVal));\n\t\t\t} else {\n\t\t\t\t$p1 = $parameters->addChild($param);\n\t\t\t\tswitch ($param) {\n\t\t\t\t\tcase 'altrep':\n\t\t\t\t\tcase 'dir': $ptype = 'uri';\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'delegated-from':\n\t\t\t\t\tcase 'delegated-to':\n\t\t\t\t\tcase 'member':\n\t\t\t\t\tcase 'sent-by': $ptype = 'cal-address';\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'rsvp': $ptype = 'boolean';\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault: $ptype = 'text';\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif (is_array($parVal)) {\n\t\t\t\t\tforeach ($parVal as $pV)\n\t\t\t\t\t\t$p2 = $p1->addChild($ptype, htmlspecialchars($pV));\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t\t$p2 = $p1->addChild($ptype, htmlspecialchars($parVal));\n\t\t\t}\n\t\t}\n\t}\n\tif (empty($content) && ( '0' != $content ))\n\t\treturn;\n\t/** store content */\n\tswitch ($type) {\n\t\tcase 'binary':\n\t\t\t$v = $child->addChild($type, $content);\n\t\t\tbreak;\n\t\tcase 'boolean':\n\t\t\tbreak;\n\t\tcase 'cal-address':\n\t\t\t$v = $child->addChild($type, $content);\n\t\t\tbreak;\n\t\tcase 'date':\n\t\t\tif (array_key_exists('year', $content))\n\t\t\t\t$content = array($content);\n\t\t\tforeach ($content as $date) {\n\t\t\t\t$str = sprintf('%04d-%02d-%02d', $date['year'], $date['month'], $date['day']);\n\t\t\t\t$v = $child->addChild($type, $str);\n\t\t\t}\n\t\t\tbreak;\n\t\tcase 'date-time':\n\t\t\tif (array_key_exists('year', $content))\n\t\t\t\t$content = array($content);\n\t\t\tforeach ($content as $dt) {\n\t\t\t\tif (!isset($dt['hour']))\n\t\t\t\t\t$dt['hour'] = 0;\n\t\t\t\tif (!isset($dt['min']))\n\t\t\t\t\t$dt['min'] = 0;\n\t\t\t\tif (!isset($dt['sec']))\n\t\t\t\t\t$dt['sec'] = 0;\n\t\t\t\t$str = sprintf('%04d-%02d-%02dT%02d:%02d:%02d', $dt['year'], $dt['month'], $dt['day'], $dt['hour'], $dt['min'], $dt['sec']);\n\t\t\t\tif (isset($dt['tz']) && ( 'Z' == $dt['tz'] ))\n\t\t\t\t\t$str .= 'Z';\n\t\t\t\t$v = $child->addChild($type, $str);\n\t\t\t}\n\t\t\tbreak;\n\t\tcase 'duration':\n\t\t\t$output = (( 'trigger' == $name ) && ( FALSE !== $content['before'] )) ? '-' : '';\n\t\t\t$v = $child->addChild($type, $output . iCalUtilityFunctions::_format_duration($content));\n\t\t\tbreak;\n\t\tcase 'geo':\n\t\t\t$v1 = $child->addChild('latitude', number_format((float) $content['latitude'], 6, '.', ''));\n\t\t\t$v1 = $child->addChild('longitude', number_format((float) $content['longitude'], 6, '.', ''));\n\t\t\tbreak;\n\t\tcase 'integer':\n\t\t\t$v = $child->addChild($type, $content);\n\t\t\tbreak;\n\t\tcase 'period':\n\t\t\tif (!is_array($content))\n\t\t\t\tbreak;\n\t\t\tforeach ($content as $period) {\n\t\t\t\t$v1 = $child->addChild($type);\n\t\t\t\t$str = sprintf('%04d-%02d-%02dT%02d:%02d:%02d', $period[0]['year'], $period[0]['month'], $period[0]['day'], $period[0]['hour'], $period[0]['min'], $period[0]['sec']);\n\t\t\t\tif (isset($period[0]['tz']) && ( 'Z' == $period[0]['tz'] ))\n\t\t\t\t\t$str .= 'Z';\n\t\t\t\t$v2 = $v1->addChild('start', $str);\n\t\t\t\tif (array_key_exists('year', $period[1])) {\n\t\t\t\t\t$str = sprintf('%04d-%02d-%02dT%02d:%02d:%02d', $period[1]['year'], $period[1]['month'], $period[1]['day'], $period[1]['hour'], $period[1]['min'], $period[1]['sec']);\n\t\t\t\t\tif (isset($period[1]['tz']) && ( 'Z' == $period[1]['tz'] ))\n\t\t\t\t\t\t$str .= 'Z';\n\t\t\t\t\t$v2 = $v1->addChild('end', $str);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t\t$v2 = $v1->addChild('duration', iCalUtilityFunctions::_format_duration($period[1]));\n\t\t\t}\n\t\t\tbreak;\n\t\tcase 'recur':\n\t\t\tforeach ($content as $rulelabel => $rulevalue) {\n\t\t\t\t$rulelabel = strtolower($rulelabel);\n\t\t\t\tswitch ($rulelabel) {\n\t\t\t\t\tcase 'until':\n\t\t\t\t\t\tif (isset($rulevalue['hour']))\n\t\t\t\t\t\t\t$str = sprintf('%04d-%02d-%02dT%02d:%02d:%02dZ', $rulevalue['year'], $rulevalue['month'], $rulevalue['day'], $rulevalue['hour'], $rulevalue['min'], $rulevalue['sec']);\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\t$str = sprintf('%04d-%02d-%02d', $rulevalue['year'], $rulevalue['month'], $rulevalue['day']);\n\t\t\t\t\t\t$v = $child->addChild($rulelabel, $str);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'bysecond':\n\t\t\t\t\tcase 'byminute':\n\t\t\t\t\tcase 'byhour':\n\t\t\t\t\tcase 'bymonthday':\n\t\t\t\t\tcase 'byyearday':\n\t\t\t\t\tcase 'byweekno':\n\t\t\t\t\tcase 'bymonth':\n\t\t\t\t\tcase 'bysetpos': {\n\t\t\t\t\t\t\tif (is_array($rulevalue)) {\n\t\t\t\t\t\t\t\tforeach ($rulevalue as $vix => $valuePart)\n\t\t\t\t\t\t\t\t\t$v = $child->addChild($rulelabel, $valuePart);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t$v = $child->addChild($rulelabel, $rulevalue);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\tcase 'byday': {\n\t\t\t\t\t\t\tif (isset($rulevalue['DAY'])) {\n\t\t\t\t\t\t\t\t$str = ( isset($rulevalue[0])) ? $rulevalue[0] : '';\n\t\t\t\t\t\t\t\t$str .= $rulevalue['DAY'];\n\t\t\t\t\t\t\t\t$p = $child->addChild($rulelabel, $str);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tforeach ($rulevalue as $valuePart) {\n\t\t\t\t\t\t\t\t\tif (isset($valuePart['DAY'])) {\n\t\t\t\t\t\t\t\t\t\t$str = ( isset($valuePart[0])) ? $valuePart[0] : '';\n\t\t\t\t\t\t\t\t\t\t$str .= $valuePart['DAY'];\n\t\t\t\t\t\t\t\t\t\t$p = $child->addChild($rulelabel, $str);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t\t\t$p = $child->addChild($rulelabel, $valuePart);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\tcase 'freq':\n\t\t\t\t\tcase 'count':\n\t\t\t\t\tcase 'interval':\n\t\t\t\t\tcase 'wkst':\n\t\t\t\t\tdefault:\n\t\t\t\t\t\t$p = $child->addChild($rulelabel, $rulevalue);\n\t\t\t\t\t\tbreak;\n\t\t\t\t} // end switch( $rulelabel )\n\t\t\t} // end foreach( $content as $rulelabel => $rulevalue )\n\t\t\tbreak;\n\t\tcase 'rstatus':\n\t\t\t$v = $child->addChild('code', number_format((float) $content['statcode'], 2, '.', ''));\n\t\t\t$v = $child->addChild('description', htmlspecialchars($content['text']));\n\t\t\tif (isset($content['extdata']))\n\t\t\t\t$v = $child->addChild('data', htmlspecialchars($content['extdata']));\n\t\t\tbreak;\n\t\tcase 'text':\n\t\t\tif (!is_array($content))\n\t\t\t\t$content = array($content);\n\t\t\tforeach ($content as $part)\n\t\t\t\t$v = $child->addChild($type, htmlspecialchars($part));\n\t\t\tbreak;\n\t\tcase 'time':\n\t\t\tbreak;\n\t\tcase 'uri':\n\t\t\t$v = $child->addChild($type, $content);\n\t\t\tbreak;\n\t\tcase 'utc-offset':\n\t\t\tif (in_array(substr($content, 0, 1), array('-', '+'))) {\n\t\t\t\t$str = substr($content, 0, 1);\n\t\t\t\t$content = substr($content, 1);\n\t\t\t}\n\t\t\telse\n\t\t\t\t$str = '+';\n\t\t\t$str .= substr($content, 0, 2) . ':' . substr($content, 2, 2);\n\t\t\tif (4 < strlen($content))\n\t\t\t\t$str .= ':' . substr($content, 4);\n\t\t\t$v = $child->addChild($type, $str);\n\t\t\tbreak;\n\t\tcase 'unknown':\n\t\tdefault:\n\t\t\tif (is_array($content))\n\t\t\t\t$content = implode('', $content);\n\t\t\t$v = $child->addChild('unknown', htmlspecialchars($content));\n\t\t\tbreak;\n\t}\n}", "public function child($childName, $joinType = 'LEFT', $additionalCols = Array(), $matching = '=')\n {\n $this->addChild($childName, $joinType, $additionalCols, $matching);\n }", "public function add($child)\r\n {\r\n if ($child instanceof tag) {\r\n if ($child->id && array_key_exists($child->id,$this->ref)) {\r\n return $this->ref[$child->id]; \r\n }\r\n $child->tagdep = abs($this->tagdep) + 1;\r\n $this->tagdep = abs($this->tagdep) * -1;\r\n }\r\n //Append child to childs repo\r\n $this->childs[] = $child;\r\n //If child isn't object return $this tag\r\n if (!is_object($child)) {\r\n return $this;\r\n }\r\n if ($child->id) {\r\n $this->ref[$child->id] =& $child;\r\n }\r\n $child->parent =& $this;\r\n return $child;\r\n }", "function addSelfToDocument($domtree, $parentElement) { \n // create the root element for this class and append it to our parent\n $xmlRoot = $parentElement->appendChild($domtree->createElement('view'));\n $xmlRoot->appendChild($domtree->createElement('siteicon_url', get_option('hbo_siteicon_url')));\n $xmlRoot->appendChild($domtree->createElement('housekeepingurl', get_option('hbo_housekeeping_url')));\n $xmlRoot->appendChild($domtree->createElement('split_room_report_url', get_option('hbo_split_room_report_url')));\n $xmlRoot->appendChild($domtree->createElement('unpaid_deposit_report_url', get_option('hbo_unpaid_deposit_report_url')));\n $xmlRoot->appendChild($domtree->createElement('group_bookings_report_url', get_option('hbo_group_bookings_report_url')));\n $xmlRoot->appendChild($domtree->createElement('guest_comments_report_url', get_option('hbo_guest_comments_report_url')));\n $xmlRoot->appendChild($domtree->createElement('bedcounts_url', get_option('hbo_bedcounts_url')));\n $xmlRoot->appendChild($domtree->createElement('manual_charge_url', get_option('hbo_manual_charge_url')));\n $xmlRoot->appendChild($domtree->createElement('generate_payment_link_url', get_option('hbo_generate_payment_link_url')));\n $xmlRoot->appendChild($domtree->createElement('payment_history_url', get_option('hbo_payment_history_url')));\n $xmlRoot->appendChild($domtree->createElement('payment_history_inv_url', get_option('hbo_payment_history_inv_url')));\n $xmlRoot->appendChild($domtree->createElement('process_refunds_url', get_option('hbo_process_refunds_url')));\n $xmlRoot->appendChild($domtree->createElement('refund_history_url', get_option('hbo_refund_history_url')));\n $xmlRoot->appendChild($domtree->createElement('report_settings_url', get_option('hbo_report_settings_url')));\n $xmlRoot->appendChild($domtree->createElement('view_log_url', get_option('hbo_view_log_url')));\n $xmlRoot->appendChild($domtree->createElement('job_history_url', get_option('hbo_job_history_url')));\n $xmlRoot->appendChild($domtree->createElement('job_scheduler_url', get_option('hbo_job_scheduler_url')));\n $xmlRoot->appendChild($domtree->createElement('blacklist_url', get_option('hbo_blacklist_url')));\n $xmlRoot->appendChild($domtree->createElement('online_checkin_url', get_option('hbo_online_checkin_url')));\n $xmlRoot->appendChild($domtree->createElement('redirect_to_url', get_option('hbo_redirect_to_url')));\n $xmlRoot->appendChild($domtree->createElement('log_directory', get_option('hbo_log_directory')));\n $xmlRoot->appendChild($domtree->createElement('log_directory_url', get_option('hbo_log_directory_url')));\n $xmlRoot->appendChild($domtree->createElement('run_processor_cmd', get_option('hbo_run_processor_cmd')));\n }", "function wv_make_child_page($postid, $parentid) {\n $my_post = array(\n 'ID' => $postid,\n 'post_parent' => $parentid\n );\n\n // Update the post into the database\n wp_update_post($my_post);\n }", "private function _createDomNode($dom, $value, $name = null)\r\n {\r\n if ($value instanceof SagepayItem)\r\n {\r\n return $value->asDomElement($dom);\r\n }\r\n else if ($name === null)\r\n {\r\n return $dom->createElement($value);\r\n }\r\n else if (is_string($value) || is_int($value))\r\n {\r\n return $dom->createElement($name, trim($value));\r\n }\r\n else if (is_float($value))\r\n {\r\n return $dom->createElement($name, number_format($value, 2, '.', ''));\r\n }\r\n else if (is_array($value))\r\n {\r\n if (count($value) === 0)\r\n {\r\n return null;\r\n }\r\n $base = $dom->createElement($name);\r\n if (array_keys($value) !== range(0, count($value) - 1))\r\n {\r\n // For Associative Array\r\n foreach ($value as $_key => $_val)\r\n {\r\n $node = $this->_createDomNode($dom, $_val, $_key);\r\n $base->appendChild($node);\r\n }\r\n return $base;\r\n }\r\n else\r\n {\r\n foreach ($value as $_val)\r\n {\r\n $node = $this->_createDomNode($dom, $_val);\r\n $base->appendChild($node);\r\n }\r\n return $base->childNodes;\r\n }\r\n }\r\n }", "public function testNodeinsertAsChildAtPositionToNewNode()\n {\n $this->haveFixture('animal', 'an_addon', false);\n \n $model13 = Animal::findOne(13);\n $model = new Animal(['name' => 'new']);\n \n $this->expectExceptionMessage('You cannot add nodes to a new node');\n $model13->insertAsChildAtPosition($model, 3);\n }", "public function create()\n {\n return view('children.create');\n }", "public function create()\n {\n return view('element.create');\n }", "function createProduct($parent = null);", "public function create()\n\t{\n\t\t// DOMElement at the other end.\n\t\t$document = new DOMDocument;\n\n\t\t// Video element\n\t\t$video = $document->createElement('video:video');\n\n\t\t$document->appendChild($video);\n\t\t\n\t\t/**\n\t\t * Small recursive function to add attributes to the document.\n\t\t */\n\t\t$append_attributes = function($attributes) use ($video, $document)\n\t\t{\n\t\t\tforeach($attributes as $name => $value)\n\t\t\t{\n\t\t\t\tif (NULL !== $value)\n\t\t\t\t{\n\t\t\t\t\tif (is_array($value))\n\t\t\t\t\t{\n\t\t\t\t\t\t$append_attributes($value);\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t$video->appendChild($document->createElement('video:'.$name, $value));\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t\t\n\t\t$append_attributes($this->_attributes);\n\t\t\n\t\t// @todo append: uploader, restriction and player_loc.\n\n\t\treturn $video;\n\t}", "function addChild($key, IBabylonModel $child) : IBabylonModel;", "public function test_create__invalid_class()\n {\n\n (new ElementFactory())->create(['attributes' => ['type' => ElementFactory::class, 'name' => '']]);\n }", "public function addElement($type) {\n\t\t$element = $this->newElement($type)->setParent($this);\n\t\t\n\t\t$this->add($element);\n\t\t\n\t\treturn $element;\n\t}", "public function newElement($type) {\n\t\treturn new Html($type);\n\t}", "public function create($value, $parent)\n {\n $this->category->create([\n 'value' => $value\n ]);\n if ($parent !== 0) {\n $parentCategory = Category::where('id', $parent)->first();\n $parentCategory->makeSiblingOf($this->category);\n } else {\n $this->category->makeRoot();\n }\n }" ]
[ "0.6715675", "0.6578541", "0.6308485", "0.62808764", "0.6222672", "0.61295164", "0.6118963", "0.6067278", "0.6037775", "0.60257125", "0.597658", "0.59530514", "0.5932162", "0.5902133", "0.58820444", "0.5839254", "0.5829908", "0.57491046", "0.57182527", "0.5638862", "0.56107867", "0.56004405", "0.55936944", "0.55890936", "0.5566952", "0.55308366", "0.5527547", "0.54998827", "0.5492893", "0.548511", "0.5471464", "0.5462626", "0.53974676", "0.5387514", "0.53819686", "0.53802806", "0.5376948", "0.5365683", "0.53648317", "0.5351406", "0.5350738", "0.53452045", "0.53399855", "0.53324383", "0.53234047", "0.5316586", "0.5304286", "0.5300547", "0.5295598", "0.5290183", "0.52676356", "0.52519697", "0.52400106", "0.52368", "0.5208475", "0.52014184", "0.51927906", "0.5178109", "0.51760626", "0.516959", "0.5166695", "0.51534843", "0.5140643", "0.51294446", "0.5125147", "0.51200044", "0.51193637", "0.5118029", "0.5104631", "0.5091428", "0.5089957", "0.5058817", "0.50433385", "0.50363654", "0.50360745", "0.50327384", "0.50297976", "0.50233364", "0.50228137", "0.50190455", "0.5014688", "0.5014321", "0.5011088", "0.5005737", "0.5004357", "0.5002948", "0.50011235", "0.49806345", "0.4979501", "0.49659377", "0.49649155", "0.49644414", "0.496238", "0.4956341", "0.4955404", "0.4944689", "0.49404404", "0.49362648", "0.49335754", "0.4929038" ]
0.59930104
10
Normalizes a scalar child.
abstract protected function _normalizeSimpleChild($child, $config);
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected function _normalizeChild($child, $config = null)\n {\n if (is_scalar($child) || is_null($child)) {\n return $this->_normalizeSimpleChild($child, $config);\n }\n\n return $this->_normalizeComplexChild($child, $config);\n }", "public function normalize(): self;", "public function normalize() {\n return $this->div($this->norm());\n }", "protected function normalize() {}", "public function normalize()\n {\n }", "protected function normalize($value)\n {\n if (null === $this->normalizationTransformer) {\n return $value;\n }\n return $this->normalizationTransformer->transform($value);\n }", "protected function normalize()\r\n\t{\r\n\t\tif ($this->isFetched())\r\n\t\t{\r\n\t\t\tif ($this->validationInfo)\r\n\t\t\t{\r\n\t\t\t\t$this->normalizedValue = $this->validationInfo->normalize($this->taintValue);\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\t$this->normalizedValue = $this->taintValue;\r\n\t\t\t}\t\r\n\t\t}\r\n\t}", "public function normalize($value)\n {\n if ($value instanceof Expression ||\n $value instanceof Expressionable) {\n return $value;\n }\n\n return parent::normalize($value);\n }", "protected function _normalizeComplexChild($child, $config = null)\n {\n return $this->_createChildInstance($child, $config);\n }", "protected function denormalize($value)\n {\n if (null === $this->normalizationTransformer) {\n return $value;\n }\n return $this->normalizationTransformer->reverseTransform($value, $this->data);\n }", "function normalize()\n\t\t{\n\t\t\t$m = $this->magnitude();\n\t\t\t$res = new Vector(array('dest' => new Vertex(array(\n\t\t\t\t'x' => $this->_x / $m,\n\t\t\t\t'y' => $this->_y / $m,\n\t\t\t\t'z' => $this->_z / $m\n\t\t\t))));\n\t\t\treturn ($res);\n\t\t}", "protected function processNormalization(NormalizeValueContext $context): void\n {\n $value = $context->getResult();\n if (null !== $value && $this->isValueNormalizationRequired($value)) {\n if ($context->isRangeAllowed() && str_contains($value, $context->getRangeDelimiter())) {\n $context->setResult($this->normalizeRangeValue($value, $context->getRangeDelimiter()));\n } elseif ($context->isArrayAllowed()) {\n $context->setResult($this->normalizeArrayValue($value, $context->getArrayDelimiter()));\n } else {\n $this->validateValue($value);\n $context->setResult($this->normalizeValue($value));\n }\n }\n $context->setProcessed(true);\n }", "public function getQuantityPerUnitNormalizedAttribute()\n {\n return normalizeQuantity($this->quantity_per_unit, $this->dividendAssetModel->divisible);\n }", "protected function normalize(): void\n {\n $coordinate = new BaseCoordinate(array(0, $this->value));\n $latitude = (float)$coordinate->getLongitude();\n\n $this->value = $latitude;\n }", "public function scale() { }", "private function normToView(mixed $value): mixed\n {\n // Scalar values should be converted to strings to\n // facilitate differentiation between empty (\"\") and zero (0).\n // Only do this for simple forms, as the resulting value in\n // compound forms is passed to the data mapper and thus should\n // not be converted to a string before.\n if (!($transformers = $this->config->getViewTransformers()) && !$this->config->getCompound()) {\n return null === $value || \\is_scalar($value) ? (string) $value : $value;\n }\n\n try {\n foreach ($transformers as $transformer) {\n $value = $transformer->transform($value);\n }\n } catch (TransformationFailedException $exception) {\n throw new TransformationFailedException(sprintf('Unable to transform value for property path \"%s\": ', $this->getPropertyPath()).$exception->getMessage(), $exception->getCode(), $exception, $exception->getInvalidMessage(), $exception->getInvalidMessageParameters());\n }\n\n return $value;\n }", "public function getNormalization()\r\n {\r\n return $this->normalization;\r\n }", "protected function normalize_attribute($name, $value)\n {\n }", "private function scaleX() : void\n\t{\n\t\t$this->domain = abs($this->rangeXLow) + abs($this->rangeXHigh);\n\n\t\t$this->scaleX = ((float)$this->sizeX / $this->domain);\n\t\t$this->originX = $this->sizeX >> 1;\n\t\t\n\t}", "public static function normalizeValue($value)\n {\n if ($value instanceof Node) {\n return $value;\n } elseif (is_null($value)) {\n return new Expr\\ConstFetch(\n new Name('null')\n );\n } elseif (is_bool($value)) {\n return new Expr\\ConstFetch(\n new Name($value ? 'true' : 'false')\n );\n } elseif (is_int($value)) {\n return new Scalar\\LNumber($value);\n } elseif (is_float($value)) {\n return new Scalar\\DNumber($value);\n } elseif (is_string($value)) {\n return new Scalar\\String_($value);\n } elseif (is_array($value)) {\n $items = [];\n $lastKey = -1;\n foreach ($value as $itemKey => $itemValue) {\n // for consecutive, numeric keys don't generate keys\n if (null !== $lastKey && ++$lastKey === $itemKey) {\n $items[] = new Expr\\ArrayItem(\n self::normalizeValue($itemValue)\n );\n } else {\n $lastKey = null;\n $items[] = new Expr\\ArrayItem(\n self::normalizeValue($itemValue),\n self::normalizeValue($itemKey)\n );\n }\n }\n return new Expr\\Array_($items);\n } else {\n throw new \\LogicException('Invalid value');\n }\n }", "public function getNormalizedData()\n {\n return parent::getNormalizedData();\n }", "public function getColumnDenormalizedValue($value)\n {\n return $this->getDriver()->getColumnDenormalizedValue($this, $value);\n }", "public function normalize($name);", "public function normalize(): string\n {\n return $this->getValue();\n }", "public function normalize(ContentEntityInterface $entity);", "public function scale(float $scale_x = 0, float $scale_y = 0, float $scale_z = 0): EntityInterface;", "private function modelToNorm(mixed $value): mixed\n {\n try {\n foreach ($this->config->getModelTransformers() as $transformer) {\n $value = $transformer->transform($value);\n }\n } catch (TransformationFailedException $exception) {\n throw new TransformationFailedException(sprintf('Unable to transform data for property path \"%s\": ', $this->getPropertyPath()).$exception->getMessage(), $exception->getCode(), $exception, $exception->getInvalidMessage(), $exception->getInvalidMessageParameters());\n }\n\n return $value;\n }", "protected function onParentSet() : void\n {\n $value = $this->oFG->getData()->getValue($this->strName);\n $this->iValue = $value ? intval($value) : $this->iMin;\n }", "protected static function normalize(DOMDocument $ir)\n\t{\n\t\tself::addDefaultCase($ir);\n\t\tself::addElementIds($ir);\n\t\tself::addCloseTagElements($ir);\n\t\tself::markEmptyElements($ir);\n\t\tself::optimize($ir);\n\t\tself::markConditionalCloseTagElements($ir);\n\t\tself::setOutputContext($ir);\n\t\tself::markBranchTables($ir);\n\t}", "protected function normalizeValue($value) {\n\t\tif ($value instanceof PHPParser_Node) {\n\t\t\treturn $value;\n\t\t} elseif (is_null ( $value )) {\n\t\t\treturn new PHPParser_Node_Expr_ConstFetch ( new PHPParser_Node_Name ( 'null' ) );\n\t\t} elseif (is_bool ( $value )) {\n\t\t\treturn new PHPParser_Node_Expr_ConstFetch ( new PHPParser_Node_Name ( $value ? 'true' : 'false' ) );\n\t\t} elseif (is_int ( $value )) {\n\t\t\treturn new PHPParser_Node_Scalar_LNumber ( $value );\n\t\t} elseif (is_float ( $value )) {\n\t\t\treturn new PHPParser_Node_Scalar_DNumber ( $value );\n\t\t} elseif (is_string ( $value )) {\n\t\t\treturn new PHPParser_Node_Scalar_String ( $value );\n\t\t} elseif (is_array ( $value )) {\n\t\t\t$items = array ();\n\t\t\t$lastKey = - 1;\n\t\t\tforeach ( $value as $itemKey => $itemValue ) {\n\t\t\t\t// for consecutive, numeric keys don't generate keys\n\t\t\t\tif (null !== $lastKey && ++ $lastKey === $itemKey) {\n\t\t\t\t\t$items [] = new PHPParser_Node_Expr_ArrayItem ( $this->normalizeValue ( $itemValue ) );\n\t\t\t\t} else {\n\t\t\t\t\t$lastKey = null;\n\t\t\t\t\t$items [] = new PHPParser_Node_Expr_ArrayItem ( $this->normalizeValue ( $itemValue ), $this->normalizeValue ( $itemKey ) );\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\treturn new PHPParser_Node_Expr_Array ( $items );\n\t\t} else {\n\t\t\tthrow new LogicException ( 'Invalid value' );\n\t\t}\n\t}", "function singularize(){\n\t\treturn $this->_copy(_Inflect::singularize((string)$this));\n\t}", "public function getQuantityUsdNormalizedAttribute()\n {\n return fromSatoshi($this->quantity_usd);\n }", "public function setNormalization($normalization)\r\n {\r\n $this->normalization = (int) $normalization;\r\n\r\n return $this;\r\n }", "public function divideScalar(float $b) : self\n {\n $c = [];\n\n foreach ($this->a as $rowA) {\n $rowC = [];\n\n foreach ($rowA as $valueA) {\n $rowC[] = $valueA / $b;\n }\n\n $c[] = $rowC;\n }\n\n return self::quick($c);\n }", "public function norm()\n\t{\n\t\t$v = new Vector($this->x,$this->y);\n\t\t$v->rotate(pi()/2.0);\n\t\treturn $v;\n\t}", "private function normToModel(mixed $value): mixed\n {\n try {\n $transformers = $this->config->getModelTransformers();\n\n for ($i = \\count($transformers) - 1; $i >= 0; --$i) {\n $value = $transformers[$i]->reverseTransform($value);\n }\n } catch (TransformationFailedException $exception) {\n throw new TransformationFailedException(sprintf('Unable to reverse value for property path \"%s\": ', $this->getPropertyPath()).$exception->getMessage(), $exception->getCode(), $exception, $exception->getInvalidMessage(), $exception->getInvalidMessageParameters());\n }\n\n return $value;\n }", "public abstract function scale(float $x = 1, float $y = 1): Shape;", "public function testScaleWithFloat()\n {\n $box = $this->box->scale(2.0);\n static::assertEquals(200, $box->getHeight());\n static::assertEquals(200, $box->getWidth());\n }", "function norm() {\n return sqrt($this->length2());\n }", "protected function normalizeValue($value) {\n\t\tif ($value instanceof \\PHPParser\\Node\\NodeInterface) {\n\t\t\treturn $value;\n\t\t} elseif (is_null($value)) {\n\t\t\treturn new ConstFetchExpression(\n\t\t\t\t\tnew NameNode('null')\n\t\t\t);\n\t\t} elseif (is_bool($value)) {\n\t\t\treturn new ConstFetchExpression(\n\t\t\t\t\tnew NameNode($value ? 'true' : 'false')\n\t\t\t);\n\t\t} elseif (is_int($value)) {\n\t\t\treturn new LNumberScalar($value);\n\t\t} elseif (is_float($value)) {\n\t\t\treturn new DNumberScalar($value);\n\t\t} elseif (is_string($value)) {\n\t\t\treturn new StringScalar($value);\n\t\t} elseif (is_array($value)) {\n\t\t\t$items = array();\n\t\t\t$lastKey = -1;\n\t\t\tforeach ($value as $itemKey => $itemValue) {\n\t\t\t\t// for consecutive, numeric keys don't generate keys\n\t\t\t\tif (null !== $lastKey && ++$lastKey === $itemKey) {\n\t\t\t\t\t$items[] = new ArrayItemExpression(\n\t\t\t\t\t\t\t$this->normalizeValue($itemValue)\n\t\t\t\t\t);\n\t\t\t\t} else {\n\t\t\t\t\t$lastKey = null;\n\t\t\t\t\t$items[] = new ArrayItemExpression(\n\t\t\t\t\t\t\t$this->normalizeValue($itemValue),\n\t\t\t\t\t\t\t$this->normalizeValue($itemKey)\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn new ArrayExpression($items);\n\t\t} else {\n\t\t\tthrow new \\LogicException('Invalid value');\n\t\t}\n\t}", "public function normaliseValue(string $value, string $quote = ''): string;", "public function testScaleWithNegative()\n {\n static::setExpectedExceptionRegExp('LogicException');\n $this->box->scale(-200);\n }", "public function updateValue(){\n\n\t\t$this->value += (int)max($this->left_parent_value,$this->right_parent_value);\n\t}", "public function transform($value);", "public function setSuperEffectiveAttribute($value)\n {\n $this->attributes['super_effective'] = $this->makeCollection($value);\n }", "abstract public function transform();", "public function normalize($node) {\n\t\tif (is_array($node)) {\n\t\t\t$node = array_values($node);\n\t\t\t$primary = 'id';\n\n\t\t\tif (!is_object($node[0])) {\n\t\t\t\t$node[0] = ClassRegistry::init($node[0]);\n\t\t\t}\n\n\t\t\t$node[0]->id = $node[1];\n\t\t\treturn $node[0];\n\t\t}\n\n\t\treturn $node;\n\t}", "public function testNormalize($expected, $path)\n {\n $this->assertSame($expected, (new Path($path))->normalize()->__toString());\n }", "#[Route(path: '/{id}/removeChild/{child}', name: 'lsitem_remove_child', methods: ['POST'])]\n #[IsGranted(Permission::ITEM_EDIT, 'lsItem')]\n public function removeChild(LsItem $parent, LsItem $child): Response\n {\n $command = new RemoveChildCommand($parent, $child);\n $this->sendCommand($command);\n\n return $this->render('framework/ls_item/remove_child.html.twig', []);\n }", "function array_normalize(Array $ar) {\n\t$max = null;\n\n\tforeach($ar as $v) {\n\t\t$v = abs($v);\n\n\t\tif ($max == null) {\n\t\t\t$max = $v;\n\t\t} else {\n\t\t\t$max = max($max, $v);\n\t\t}\n\t}\n\n\tif ($max > 0)\n\t\tforeach($ar as $i => $v)\n\t\t\t$ar[$i] = $v / $max;\n\n\treturn $ar;\n}", "public function isScalar()\n {\n return \\is_scalar($this->value);\n }", "public function testComplexTypeElementWithParentThrowsExceptionWhenSchemaElementAddComplexTypeElement(): void\n {\n $parent1 = new SchemaElement();\n $parent1->addComplexTypeElement($this->sut);\n \n $parent2 = new SchemaElement();\n $this->expectInvalidOperationExceptionChildOfAnotherElement($this->sut, $parent2);\n $parent2->addComplexTypeElement($this->sut);\n }", "public function getScale()\n {\n return $this->scale;\n }", "public function getScale()\n {\n return $this->scale;\n }", "public function childTransformation(bool $childTransformation);", "protected function _normalize($value)\n {\n return strtolower($value);\n }", "public function caculateStandard($single, $size, $mean) {\n $total = 0;\n\n for($i = 1; $i <= $size; $i++) {\n $temp = $single->getNode($i)->data - $mean;\n $total += $temp * $temp;\n }\n\n return sqrt($total / ($size - 1));\n\n\n\n }", "public function scalar(string|int|float $message): self\n {\n return $this->addMessage(new Scalar($message));\n }", "public function setImageMainAttribute($value)\n {\n $attribute_name = \"image_main\";\n $this->saveImageNormally($attribute_name, $value);\n }", "public function child()\n {\n if ($this->type == 'attribute_template') {\n return $this->attributeTemplate();\n } elseif ($this->type == 'dice_roll') {\n return $this->diceRoll();\n } else {\n return $this->{$this->type}();\n }\n }", "public function getScale()\n\t{\n\t\treturn $this->scale;\n\t}", "public function testScaleWithString()\n {\n $box = $this->box->scale('2.0');\n static::assertEquals(200, $box->getHeight());\n static::assertEquals(200, $box->getWidth());\n }", "protected function key_to_scalar($key)\n {\n }", "final public function removeChild ()\n {\n throw new ChildException('Trying to remove child from self closing HTML element');\n }", "public function removeChild( Component $child ) {\n\t\tparent::removeChild( $child );\n\t\t$child->setOrphan();\n\t}", "public function value()\r\n\t{\r\n\t\tif ($this->isFetched() && $this->isValid())\r\n\t\t{\r\n\t\t\treturn $this->normalizedValue;\r\n\t\t}\t\r\n\t\treturn null;\r\n\t}", "public function testComplexTypeElementWithParentThrowsExceptionWhenRedefineElementAddComplexTypeElement(): void\n {\n $parent1 = new RedefineElement();\n $parent1->addComplexTypeElement($this->sut);\n \n $parent2 = new RedefineElement();\n $this->expectInvalidOperationExceptionChildOfAnotherElement($this->sut, $parent2);\n $parent2->addComplexTypeElement($this->sut);\n }", "public function transform($value)\n {\n return $value;\n }", "function rm_child($child_id) {\n $t = @$this->triples[$child_id];\n if($t) {\n unset($this->children[$t->parent_id][$child_id]);\n unset($this->triples[$child_id]);\n }\n }", "public function getScaling() {}", "public function set($child) {\n\t\t$this->childs = array($child);\n\t}", "public function normalizeEntity(Entity $entity)\n {\n if ($entity->getPrimaryKey()) {\n //search if there is already a UNIQUE constraint over the primary keys\n $pkUniqueExist = false;\n foreach ($entity->getUnices() as $unique) {\n $coversAllPrimaryKeys = true;\n foreach ($unique->getFields() as $fieldName) {\n if (!$entity->getField($fieldName)->isPrimaryKey()) {\n $coversAllPrimaryKeys = false;\n break;\n }\n }\n if ($coversAllPrimaryKeys) {\n //there's already a unique constraint with the composite pk\n $pkUniqueExist = true;\n break;\n }\n }\n\n //there is none, let's create it\n if (!$pkUniqueExist) {\n $unique = new Unique();\n foreach ($entity->getPrimaryKey() as $pk) {\n $unique->addField($pk);\n }\n $entity->addUnique($unique);\n }\n\n if ($entity->hasAutoIncrementPrimaryKey()) {\n foreach ($entity->getPrimaryKey() as $pk) {\n //no pk can be NULL, as usual\n $pk->setNotNull(true);\n //in SQLite the field with the AUTOINCREMENT MUST be a primary key, too.\n if (!$pk->isAutoIncrement()) {\n //for all other sub keys we remove it, since we create a UNIQUE constraint over all primary keys.\n $pk->setPrimaryKey(false);\n }\n }\n }\n }\n\n parent::normalizeEntity($entity);\n }", "public function setSlugAttribute($value) {\n $this->attributes['slug'] = Str::slug($this->titre);\n }", "public function parenthesizer()\n {\n $this->value = \"({$this->value})\";\n return $this->getValue();\n }", "public function isScalar()\n {\n return $this->type === self::SCALAR_TPYE;\n }", "function isNormal()\n\t\t{\n\t\t\t$this->value = 0;\n\t\t\tif($this->normalValue === $this->value)\n\t\t\t\treturn true;\n\t\t\telse\n\t\t\t\treturn false;\n\t\t}", "public function setChild($child)\n {\n $this->child = $child;\n }", "public function child(){\n return $this->morphTo(null,'recharge_type','recharge_type_id');\n }", "public function scale()\n {\n return $this->belongsTo(Scale::class);\n }", "public function svd() : SVD\n {\n return SVD::decompose($this);\n }", "function sqrt() { # :: Num -> Float\n return new Num\\Float(sqrt($this->value));\n }", "public function toReal()\n {\n $value = $this->toNative();\n $real = new Real($value);\n\n return $real;\n }", "public function setSlugAttribute($value)\n {\n $this->attributes['slug'] = Str::slug($value); \n }", "public function setSlugAttribute($value)\n {\n $this->attributes['slug'] = Str::slug($value); \n }", "public function getFeeUsdNormalizedAttribute()\n {\n return fromSatoshi($this->fee_usd);\n }", "public function getFeePaidNormalizedAttribute()\n {\n return fromSatoshi($this->fee_paid);\n }", "public function resize(float $ratio): void\n {\n $this->side = bcmul($ratio, $this->side, $this->scale);\n }", "public function testScaleWithInteger()\n {\n $box = $this->box->scale(2);\n static::assertEquals(200, $box->getHeight());\n static::assertEquals(200, $box->getWidth());\n }", "public function abnormal_graph(){\n $inspect = new Statistical;\n return $inspect->abnormal();\n }", "public function getScale()\n {\n return $this->domain->getScale();\n }", "abstract protected function getScaleFromFormatNode(\\DOMNode $formatNode);", "protected function _beforeToHtml()\n {\n $this->_initTotals();\n foreach ($this->getChild() as $child) {\n if (method_exists($child, 'initTotals')) {\n $child->initTotals();\n }\n }\n return parent::_beforeToHtml();\n }", "public function getScaling()\n {\n return $this->scaling;\n }", "public function getScaling()\n {\n return $this->scaling;\n }", "private static function _casenormalize(&$val)\n {\n $val = strtolower($val);\n }", "public function normalizeData() : array;", "public function testDenormalize() {\n $payload = '{\"data\":{\"type\":\"article\",\"attributes\":{\"title\":\"Testing article\"}}}';\n\n [$request, $resource_type] = $this->generateProphecies('node', 'article', 'id');\n $node = $this\n ->getNormalizer()\n ->denormalize(Json::decode($payload), NULL, 'api_json', [\n 'resource_type' => $resource_type,\n ]);\n $this->assertInstanceOf(Node::class, $node);\n $this->assertSame('Testing article', $node->getTitle());\n }", "protected function normalizeValue($value)\n\t{\n\t\t$delim = '\"';\n\t\tif (is_bool($value)) {\n\t\t\t$value = $this->toBool($value);\n\t\t\treturn $value;\n\t\t}\n\t\telseif (is_numeric($value)) {\n\t\t\treturn $value;\n\t\t}\n\n\t\t$value = $delim . $value . $delim;\n\t\treturn $value;\n\t}", "public function baseComplexType(): IComplexType\n {\n return $this->complexDefinition()->baseComplexType();\n }", "abstract public function insert ( \\Hoa\\Tree\\Generic $child );" ]
[ "0.6471258", "0.6371987", "0.60452414", "0.59849185", "0.5896082", "0.5582347", "0.55799043", "0.52229285", "0.51611996", "0.5126119", "0.512014", "0.49222156", "0.4889396", "0.487006", "0.48556662", "0.48279515", "0.4808294", "0.47634086", "0.47583905", "0.47532898", "0.47183013", "0.46980345", "0.46910453", "0.46797538", "0.46583056", "0.45221263", "0.4456345", "0.44055626", "0.44045153", "0.44031778", "0.4389541", "0.4382194", "0.428658", "0.42811084", "0.42671534", "0.4264279", "0.4242149", "0.42360288", "0.42329875", "0.42101333", "0.4202766", "0.42002565", "0.41942564", "0.41776603", "0.41689965", "0.41676882", "0.4162529", "0.41392696", "0.41342643", "0.41288137", "0.411516", "0.41025433", "0.40928018", "0.40928018", "0.40911388", "0.40788552", "0.4075038", "0.40741336", "0.40733176", "0.40688276", "0.4051205", "0.40410563", "0.40379557", "0.40337384", "0.4029698", "0.40197438", "0.401522", "0.4014856", "0.40130886", "0.40114135", "0.40065992", "0.39972663", "0.3996261", "0.3991783", "0.39833546", "0.3980608", "0.39805785", "0.39802828", "0.39721945", "0.39655074", "0.39472243", "0.39395884", "0.39354628", "0.39354628", "0.3934681", "0.39294878", "0.39271042", "0.39240804", "0.39152235", "0.39140135", "0.39122316", "0.39116287", "0.39083144", "0.39083144", "0.39063612", "0.39041525", "0.38996735", "0.38973704", "0.3896838", "0.38894492" ]
0.6433867
1
Retrieves the factory that is used to create children instances.
abstract protected function _getChildFactory($child, $config);
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getFactory()\n {\n return $this->factory;\n }", "public function getFactory()\n {\n return $this->factory;\n }", "public function getFactory()\n {\n return $this->factory;\n }", "public function getFactory()\n {\n return $this->factory;\n }", "public function getFactory()\n {\n return $this->factory;\n }", "public function getFactory()\n {\n return $this->factory;\n }", "public function getFactory()\n {\n return $this->factory;\n }", "public function getFactory()\n {\n return $this->factory;\n }", "public function getFactory()\n {\n return $this->_factory;\n }", "public static function getFactory()\r\n\t{\r\n\t\treturn self::$factory;\r\n\t}", "public function getFactory()\n {\n return new Factory();\n }", "public function getFactory() {}", "public function getFactory()\n\t{\n\t\treturn empty($this->factory) ? 'new '.$this->getClass() : $this->factory;\n\t}", "public function getFactory(): Factory;", "public static function factory()\r\n {\r\n return parent::factory(__CLASS__);\r\n }", "protected function getFactory()\n {\n if (! isset($this->factory)) {\n $this->factory = new \\MphpMusicBrainz\\Adapter\\Xml\\XmlFactory();\n }\n return $this->factory;\n }", "public function getFormFactory()\n {\n $resolvedFormTypeFactory = new ResolvedFormTypeFactory();\n\n $registery = new FormRegistry(array(\n new CoreExtension(),\n new FilterExtension(),\n ), $resolvedFormTypeFactory);\n\n $formFactory = new FormFactory($registery, $resolvedFormTypeFactory);\n\n return $formFactory;\n }", "final public function getFactory() {\n\t\treturn '';\n\t}", "public static function newFactory()\n {\n return PhoneFactory::new();\n }", "public function getBuilderFactory()\n {\n return $this->builderFactory;\n }", "protected static function newFactory()\n {\n return PostFactory::new();\n }", "protected static function newFactory()\n {\n return ExampleFactory::new();\n }", "public function getActiveFactory()\n {\n return $this->getFactory($this->getActiveFactoryName());\n }", "protected static function newFactory()\n {\n //\n }", "protected static function newFactory()\n {\n return TypeFactory::new();\n }", "public static function getFactory()\n\t{\n\t\tif ( is_null( static::$g_cFactory ) )\n\t\t{\n\t\t\tstatic::$g_cFactory = new GatewayFactory;\n\t\t}\n\t\t\n\t\treturn static::$g_cFactory;\n\t}", "protected static function newFactory(): ?Factory\n {\n return get_called_class() === self::class ? UserFactory::new() : null;\n }", "public function getResourceFactory(){\n return $this->resourceFactory;\n }", "protected function getOrderFactory()\n {\n return $this->_orderFactory;\n }", "public function getResponseFactory()\n {\n return $this->responseFactory;\n }", "public function getMenuFactory(): MenuFactoryInterface\n {\n return $this->_factory;\n }", "protected static function newFactory(): Factory\n {\n return CategorySoftDeleteFactory::new();\n }", "public static function newFactory()\n {\n return AdFactory::new();\n }", "public function getReaderFactory()\n {\n return $this->readerFactory;\n }", "public function make($factory);", "public static function create() {\n $factory = new static();\n return $factory->createFlo();\n }", "public static function newFactory()\n {\n return PriceFactory::new();\n }", "protected static function newFactory(): Factory\n {\n return ProductDownloadableLinkTranslationFactory::new();\n }", "protected static function newFactory(): Factory\n {\n return MessageFactory::new();\n }", "protected function createRendererFactory() {\n\t\t$factoryClassName = $this->config('form-renderer-factory.class-name');\n\t\t$factoryConstructorArguments = $this->config('form-renderer-factory.constructor-arguments');\n\t\treturn TypeUtilities::buildTypeCheckedObject(\n\t\t\t$factoryClassName,\n\t\t\t'form renderer factory',\n\t\t\tnull,\n\t\t\tarray( '\\\\Sitegear\\\\Form\\\\Renderer\\\\Factory\\\\RendererFactoryInterface' ),\n\t\t\t$factoryConstructorArguments\n\t\t);\n\t}", "protected function getResourceFactory()\n {\n return ResourceFactory::getInstance();\n }", "protected static function newFactory(): \\Illuminate\\Database\\Eloquent\\Factories\\Factory\n {\n return CategoryFactory::new();\n }", "public static function newFactory()\n {\n return OrderFactory::new();\n }", "public function getMetadataFactory()\n {\n return $this->metadataFactory;\n }", "protected static function newFactory(): Factory\n {\n return OrderPaymentFactory::new();\n }", "public function getFactories()\n {\n return $this->factories;\n }", "protected function getForm_FactoryService()\n {\n return $this->services['form.factory'] = new \\Symfony\\Component\\Form\\FormFactory($this->get('form.registry'), $this->get('form.resolved_type_factory'));\n }", "static function factory()\n {\n if (self::$_instance == NULL) {\n self::$_instance = new self();\n }\n return self::$_instance;\n }", "public static function newFactory()\n {\n return ReceiptFactory::new();\n }", "public function loadFactory()\n {\n $this->di = new Di\\FactoryDefault;\n\n return $this;\n }", "public static function factory()\n {\n return new self;\n }", "public static function factory() {\n\t\tstatic $instance;\n\n\t\tif ( ! $instance ) {\n\t\t\t$instance = new self();\n\t\t\t$instance->setup();\n\t\t}\n\n\t\treturn $instance;\n\t}", "protected function getSettingsFormFactory()\n {\n return $this->get('dag.settings.form_factory');\n }", "public function getRepositoryFactory()\n {\n return $this->repositoryFactory;\n }", "protected static function newFactory()\n {\n return MessageFactory::new();\n }", "function getFactory(){\n\treturn $_SESSION[ SESSION_NAME_SPACE ][ 'factory' ];\n}", "protected static function newFactory(): Factory\n {\n return HotelFactory::new();\n }", "protected function getManagerFactory()\n {\n return $this->container->get(ThuataControllerInterface::MANAGER_FACTORY_ID);\n }", "public static function newFactory()\n {\n return TaxCollectionFactory::new();\n }", "protected function getResourceFactory(): ResourceFactory\n {\n return $this->getService(ResourceFactory::class);\n }", "protected function getServiceFactory()\n {\n return $this->container->get(ThuataControllerInterface::SERVICE_FACTORY_ID);\n }", "public static function newFactory()\n {\n return ReturnOrderLineFactory::new();\n }", "public static function i(): ServicesFactory\n {\n return parent::getInstance();\n }", "protected static function newFactory(): Factory\n {\n return ProductInventoryFactory::new();\n }", "protected static function newFactory()\n {\n return LoanFactory::new();\n }", "public function getQomFactory() {}", "public function getConnectFactory()\n {\n $this->registerMyLibrary();\n\n if (!$this->connectFactory) {\n $this->connectFactory = new ConnectFactory($this->getVersion());\n }\n\n return $this->connectFactory;\n }", "final protected function getMigrationFactory()\n {\n return $this->factory;\n }", "protected static function newFactory()\n {\n return RoleFactory::new();\n }", "protected static function newFactory()\n {\n return RoleFactory::new();\n }", "public function getFormFactory(): FormFactoryInterface;", "public function getRenderFactory()\n {\n return $this->render_factory;\n }", "public function modelFactory()\n {\n if (!isset($this->modelFactory)) {\n throw new RuntimeException(\n sprintf('Model Factory is not defined for \"%s\"', get_class($this))\n );\n }\n\n return $this->modelFactory;\n }", "protected static function newFactory(): Factory\n {\n return BookingProductEventTicketFactory::new();\n }", "private function getCookieMetadataFactory()\n {\n if (!$this->cookieMetadataFactory) {\n $this->cookieMetadataFactory = \\Magento\\Framework\\App\\ObjectManager::getInstance()->get(\n \\Magento\\Framework\\Stdlib\\Cookie\\CookieMetadataFactory::class\n );\n }\n return $this->cookieMetadataFactory;\n }", "protected static function newFactory(): CollectionGroupFactory\n {\n return CollectionGroupFactory::new();\n }", "public function trophies(): TrophyFactory\n {\n return new TrophyFactory($this);\n }", "function getLayoutFactory()\n {\n $factory = new \\Layout\\Core\\Factory(\n app('layout.event'),\n app('layout.config'),\n app('layout.profile')\n );\n\n $factory->setLayout(\n new \\Layout\\Core\\Layout(\n app('layout.event'),\n new \\Layout\\Core\\Update(app('layout.cache'), app('layout.config'), app('layout.profile')),\n app('layout.config'),\n app('layout.profile')\n )\n );\n\n return $factory;\n }", "protected function getKnpMenu_FactoryService()\n {\n $this->services['knp_menu.factory'] = $instance = new \\Knp\\Menu\\MenuFactory();\n\n $instance->addExtension(new \\Knp\\Menu\\Integration\\Symfony\\RoutingExtension($this->get('router')), 0);\n\n return $instance;\n }", "public function getFactory(): InfluxDBFactory\n {\n return $this->factory;\n }", "public function getFactory(array $params = array())\n\t{\n\t\t$factory = clone $this;\n\t\t$factory->params = $params;\n\t\treturn $factory;\n\t}", "public function getNodeFactory();", "public function getFactory(): CustomLightUserPreferencesApiFactory\n {\n if (null === $this->factory) {\n $this->factory = new CustomLightUserPreferencesApiFactory();\n $this->factory->setContainer($this->container);\n $this->factory->setPdoWrapper($this->container->get(\"database\"));\n }\n return $this->factory;\n }", "function hook_get_builder_factory($hook, array $args = array()) {\n require_once 'src/classes/factories/EntityToolboxDependentHookBuilderFactory.inc';\n $args += array('hook' => $hook);\n $hook_info = entity_toolbox_hook_get_info($hook);\n $factoryClass = $hook_info['factory class'];\n $factory = new $factoryClass($args);\n\n return $factory;\n}", "public function getQueryFactory()\n {\n return $this->qbFactory;\n }", "protected function createFactory()\n {\n $factory = Str::studly(class_basename($this->argument('name')));\n\n $this->call('make:factory', [\n 'name' => \"{$factory}Factory\",\n '--model' => $this->qualifyClass($this->getNameInput()),\n ]);\n }", "protected static function newFactory()\n {\n return StateFactory::new();\n }", "public function setFactory($factory)\n\t{\n\t\t$this->factory = $factory;\n\t\t\n\t\treturn $this;\n\t}", "static public function getInstance() {\n\t\treturn GeneralUtility::makeInstance('Fab\\Media\\ObjectFactory');\n\t}", "private static function engine(): Factory\n {\n if (!(self::$engine instanceof Factory)) {\n $loader = new FileLoader(new Filesystem(), self::$translationFolderPath);\n $translator = new Translator($loader, self::$lang);\n self::$engine = new Factory($translator, new Container());\n }\n\n return self::$engine;\n }", "protected static function newFactory(): CustomerFactory\n {\n return CustomerFactory::new();\n }", "public function getTransformFactory()\n {\n return $this->transform_factory;\n }", "public function getMailFactory()\n {\n return $this->mailFactory;\n }", "public function getFactoryPostfix();", "public function getSolrDocumentFactory() {\n return $this->solrDocumentFactory ?: \\Drupal::getContainer()->get($this->solr_document . '.factory');\n }", "protected static function newFactory()\n {\n return UserFactory::new();\n }", "protected static function newFactory()\n {\n return UserFactory::new();\n }", "public function getObjectFactory(): ObjectFactoryInterface;", "protected function getFactoryGenerator(): FactoryGeneratorInterface {\n\t\tif (!isset($this->factoryGenerator)) $this->factoryGenerator =\n\t\t\tnew static::$factoryGeneratorClass($this->factories, $this->cacheDirectoryPath);\n\t\treturn $this->factoryGenerator;\n\t}", "public static function factory() {\n\t\tstatic $instance = false;\n\t\tif ( ! $instance ) {\n\t\t\t$instance = new self();\n\t\t\t$instance->setup();\n\t\t}\n\t\treturn $instance;\n\t}" ]
[ "0.7693869", "0.7693869", "0.7693869", "0.7693869", "0.7693869", "0.7693869", "0.7693869", "0.7693869", "0.7649631", "0.74463373", "0.7389895", "0.7234871", "0.720906", "0.6984701", "0.69841456", "0.69690585", "0.69393927", "0.6776916", "0.6644534", "0.6637834", "0.6576368", "0.65117586", "0.64983594", "0.63496447", "0.633377", "0.6288347", "0.62803006", "0.6266761", "0.6266596", "0.62605083", "0.6249816", "0.6247971", "0.62430537", "0.6230222", "0.6226777", "0.6226399", "0.62157524", "0.62084717", "0.6206961", "0.6191777", "0.6180036", "0.6177977", "0.6177775", "0.6163391", "0.61541855", "0.61436594", "0.6134395", "0.6120263", "0.6113537", "0.60978466", "0.60881287", "0.60585594", "0.6044335", "0.6042986", "0.6036251", "0.6035395", "0.6030443", "0.6023849", "0.60131735", "0.60083395", "0.5994138", "0.5990287", "0.59863085", "0.5981953", "0.59798735", "0.5951774", "0.5932035", "0.5928472", "0.59271467", "0.59271467", "0.59185785", "0.5900558", "0.5877934", "0.5875159", "0.587201", "0.5855389", "0.585522", "0.58363026", "0.5830442", "0.58285993", "0.5815645", "0.5811347", "0.5809913", "0.5790215", "0.5778615", "0.57745415", "0.5769095", "0.5755093", "0.57430583", "0.5742898", "0.57416964", "0.573706", "0.57186395", "0.5718154", "0.5705405", "0.56984603", "0.56984603", "0.5688144", "0.5682784", "0.56677157" ]
0.710972
13
Retrieves configuration that can be used to make a child instance with a factory.
abstract protected function _getChildConfig($child, $config);
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "abstract protected function _getChildFactory($child, $config);", "public function makeConfig() : Config\n {\n if($this->makeConfig) {\n return $this->makeConfig;\n }\n return $this->makeConfig = factory(Config::class)->make();\n }", "protected function getConfiguration() {}", "public function getConfiguration();", "public function getConfiguration();", "public function getConfiguration();", "abstract public function getConfig();", "public function getConfiguration() {}", "public function getConfiguration() {}", "public function getConfigurarion()\n {\n return $this->configuration;\n }", "abstract protected function getConfig();", "public static function getConfiguration();", "public function getConfiguration()\n {\n return $this->_config;\n }", "public function get() {\n return new ConfigurationObject($this->config);\n }", "protected static function configFactory() {\n return \\Drupal::configFactory();\n }", "public static function getConfig()\n {\n return new Config(self::$config);\n }", "abstract public static function createConfig(): Config;", "public function getConfiguration()\n {\n $configuration = parent::getConfiguration();\n $configuration['debug'] = isset($configuration['debug']) ? $configuration['debug'] : false;\n $configuration['fileUri'] = $this->container->getParameter(\"mapbender.uploads_dir\") . \"/data-store\";\n\n if (isset($configuration[\"schemes\"]) && is_array($configuration[\"schemes\"])) {\n foreach ($configuration[\"schemes\"] as $key => &$scheme) {\n if (is_string($scheme['dataStore'])) {\n $storeId = $scheme['dataStore'];\n $dataStore = $this->container->getParameter('dataStores');\n $scheme['dataStore'] = $dataStore[ $storeId ];\n $scheme['dataStore'][\"id\"] = $storeId;\n //$dataStore = new DataStore($this->container, $configuration['source']);\n }\n if (isset($scheme['formItems'])) {\n $scheme['formItems'] = $this->prepareItems($scheme['formItems']);\n }\n }\n }\n return $configuration;\n }", "public function getDependencyConfig()\n {\n return [\n 'factories' => [\n ],\n ];\n }", "public function getConfiguration()\n\t{\n\t\treturn $this->configuration;\n\t}", "public function getConfig(): Configuration;", "public function getConfiguration() {\n return $this->configuration;\n }", "public function getConfiguration()\n {\n return $this->configuration;\n }", "public function getConfig()\n {\n return $this->get('config');\n }", "public function getConfig()\n {\n $provider = new ConfigProvider();\n return [\n 'service_manager' => $provider->getDependencyConfig(),\n ];\n }", "public function getConfig()\n {\n $provider = new ConfigProvider();\n return [\n 'service_manager' => $provider->getDependencyConfig(),\n ];\n }", "public function getConfig()\n {\n return $this['config'];\n }", "public function get() {\n return $this->_configuration;\n }", "protected function _get_configuration(){\n\n return new Payment_Configuration();\n\n }", "protected function create_worker_config() {\n return $this->config;\n }", "public function getConfiguration() {\n return $this->configuration;\n }", "protected function _getConfiguration() {\n if (!$this->_configuration) {\n $this->_configuration = $this->config(static::CONFIGURATION_NAME);\n }\n\n return $this->_configuration;\n }", "public function get()\r\n {\r\n $this->ensureLoaded();\r\n return $this->config;\r\n }", "public function createLocalConfigurationFromFactoryConfiguration() {}", "public function getConfigurator();", "protected function config()\n {\n return $this->make('config');\n }", "public function config()\n {\n return $this->context->getConfig();\n }", "public static function getInstance() {\n return self::getConfig();\n }", "protected function getConfiguration()\n {\n $container = new ContainerBuilder();\n\n $container->register('vivait_delayed_event.queue.test_queue');\n $container->register('doctrine_cache.providers.test_storage_cache');\n\n return new Configuration($container);\n }", "static function getConfig() {\n\t\treturn self::getRegistry()->get(self::REGISTRY_CONFIG);\n\t}", "public function getConfig()\n {\n return $this->config;\n }", "public function getConfiguration()\n {\n if (is_null($this->_configuration)) {\n $this->_configuration = Configuration::get('config');\n }\n return $this->_configuration;\n }", "public function getConfig() : ContainerConfig\n {\n return $this->config;\n }", "public function getConfig()\n {\n return $this->config;\n }", "public function getConfig()\n {\n return $this->config;\n }", "public function getConfig()\n {\n return $this->config;\n }", "public function getConfig()\n {\n return $this->config;\n }", "public function getConfig()\n {\n return $this->config;\n }", "public function getConfig()\n {\n return $this->config;\n }", "public function getConfig()\n {\n return $this->config;\n }", "public function getConfig()\n {\n return $this->config;\n }", "public function getConfig()\n {\n return $this->config;\n }", "public function getConfig()\n {\n return $this->config;\n }", "public function getConfig()\n {\n return $this->config;\n }", "public function getConfig()\n {\n return $this->config;\n }", "public function getConfig()\n {\n return $this->config;\n }", "public function getConfig()\n {\n return $this->config;\n }", "public function getConfig()\n {\n return $this->config;\n }", "public function getConfig(){\n\n $config = $this->propToConfig();\n return $config;\n\n }", "public function getConfiguration() {\n return $this->__configuration;\n }", "public function getConfig() \n {\n return $this->config;\n }", "public function getConfig() : Config\n {\n return $this->config;\n }", "public function getConfiguration(): Configuration {\n }", "public function getConfig()\n {\n if (!$this->configuration) {\n $this->getDatabaseConfiguration();\n }\n\n return $this->configuration;\n }", "function getConfig()\n {\n return $this->config;\n }", "public function getConfig()\n\t{\n\t\treturn $this->config;\n\t}", "public function getConfig()\n\t{\n\t\treturn $this->config;\n\t}", "public function getConfig()\n\t{\n\t\treturn $this->config;\n\t}", "public function getConfig()\n\t{\n\t\treturn $this->config;\n\t}", "public static function getConf(){\n $conf = Configuration::first();\n return $conf;\n }", "public function getConfig() : \\codename\\core\\config {\r\n return $this->config;\r\n }", "private function getBaseConfig() {\n return \\Drupal::getContainer()->get('itkore_admin.itkore_config');\n }", "private function getProxyFactoryConfiguration()\n {\n $configuration = new Configuration();\n\n if ($this->proxyCacheDirectory) {\n $this->ensureDirectoryExists($this->proxyCacheDirectory);\n $configuration->setProxiesTargetDir($this->proxyCacheDirectory);\n }\n\n return $configuration;\n }", "public static function getConfig()\n {\n return self::$config;\n }", "protected function getExtbaseConfiguration() {}", "protected function &getConfig(){\n \n if( is_null($this->config) ){\n $this->config = new \\stdClass();\n }\n \n return $this->config;\n \n }", "public function getConfig()\n {\n return $this->_config;\n }", "public function getConfig()\n {\n return $this->_config;\n }", "public function getConfig()\n {\n return $this->traitGetConfig();\n }", "private function createConfigurationDefinition()\n {\n $id = $this->getServiceId('configuration');\n if (!$this->container->has($id)) {\n $definition = new Definition(self::CONFIGURATION);\n $definition\n ->setFactory([new Reference('ekyna_admin.pool_factory'), 'createConfiguration'])\n// ->setFactoryService('ekyna_admin.pool_factory')\n// ->setFactoryMethod('createConfiguration')\n ->setArguments([\n $this->prefix,\n $this->resourceName,\n $this->options['entity'],\n $this->buildTemplateList($this->options['templates']),\n $this->options['event'],\n $this->options['parent']\n ])\n ->addTag('ekyna_admin.configuration', [\n 'alias' => sprintf('%s_%s', $this->prefix, $this->resourceName)]\n )\n ;\n $this->container->setDefinition($id, $definition);\n }\n }", "public function runConfig():Create {\n\n # Set config\n Config::setup();\n\n # Return instance\n return $this;\n\n }", "public function getConfig()\n {\n return $this->config ?: $this->setConfig()->getConfig();\n }", "public function getConfig(): Config\n {\n return $this->config;\n }", "public function getConfig();", "public function getConfig();", "public function getConfig();", "public function getConfig();", "public function getConfig();", "public function getConfig();", "public function getConfig();", "public function getConfig();", "public function getConfig()\n {\n /** @var WebApplication|ConsoleApplication $this */\n return $this->get('config');\n }", "public static function getConfigInstance()\n {\n if (!static::$config) {\n static::$config = new Config\\NativeConfig;\n }\n\n return static::$config;\n }", "public function getConfig() {\n if (is_null($this->getData(\"config\"))) {\n $this->setData(\"config\", Mage::getModel(\"cloudiq_callme/config\"));\n }\n\n return $this->getData(\"config\");\n }", "public function config()\n\t{\n\t\treturn $this->config;\n\t}", "public function config()\n\t{\n\t\treturn $this->config;\n\t}", "protected function _getConfig()\n {\n $bootstrap = Zend_Controller_Front::getInstance()->getParam('bootstrap');\n $configArray = $bootstrap->getOptions();\n return $config = new Zend_Config($configArray);\n }", "public function getConfig(){\n return $this->config;\n }", "public function getConfig() {\n \t\n \t// Return our configuration\n \treturn $this->aConfig;\n }", "public function getConf() {\n if (is_null($this->conf)) {\n\n require_once sfConfig::get('sf_root_dir') . '/../lib/confs/Conf.php';\n $this->conf = new Conf();\n }\n\n return $this->conf;\n }" ]
[ "0.6683842", "0.6337842", "0.63298315", "0.6319361", "0.6319361", "0.6319361", "0.62551767", "0.623221", "0.62321466", "0.62004864", "0.61985964", "0.61840636", "0.617275", "0.61574715", "0.6112023", "0.61086655", "0.6069647", "0.6059253", "0.60442185", "0.60094297", "0.60064423", "0.6000968", "0.598136", "0.59808004", "0.5960582", "0.5960582", "0.5959842", "0.5957669", "0.5951482", "0.59461004", "0.59366363", "0.5930744", "0.59257287", "0.5921076", "0.59105295", "0.59044564", "0.59026635", "0.5898374", "0.5893291", "0.5890053", "0.58803576", "0.58723027", "0.5863236", "0.5860845", "0.5860845", "0.5860845", "0.5860845", "0.5860845", "0.5860845", "0.5860845", "0.5860845", "0.5860845", "0.5860845", "0.5860845", "0.5860845", "0.5860845", "0.5860845", "0.5860845", "0.5855525", "0.5854768", "0.5854307", "0.5844987", "0.5844485", "0.5841795", "0.5838319", "0.58348155", "0.58348155", "0.58348155", "0.58348155", "0.58183074", "0.58156765", "0.5805191", "0.5798019", "0.5787852", "0.5781774", "0.57773644", "0.5776541", "0.5776541", "0.57738537", "0.5769985", "0.5769049", "0.5765443", "0.5755696", "0.575256", "0.575256", "0.575256", "0.575256", "0.575256", "0.575256", "0.575256", "0.575256", "0.5745108", "0.5725286", "0.5724714", "0.57243484", "0.57243484", "0.5716441", "0.5715711", "0.5715251", "0.5707184" ]
0.6719752
0
muestra el listado de los reportes
function Cuerpo($acceso,$id_contrato) { //echo "SELECT *FROM vista_contrato where id_contrato='$id_contrato'"; $acceso->objeto->ejecutarSql("SELECT tarifa_ser FROM vista_tarifa where id_serv='BM00001'"); if($row=row($acceso)){ $costo_inst=utf8_decode(trim($row['tarifa_ser'])); } //echo "update contrato set contrato_imp='SI' where id_contrato='$id_contrato'"; $acceso->objeto->ejecutarSql("update contrato set contrato_imp='SI' where id_contrato='$id_contrato'"); $acceso->objeto->ejecutarSql("SELECT *FROM vista_contrato where id_contrato='$id_contrato'"); if($row=row($acceso)){ $observacion=utf8_decode(trim($row['observacion'])); $costo_contrato=utf8_decode(trim($row['costo_contrato'])); $tipo_cliente=utf8_decode(trim($row['tipo_cliente'])); $nombrecli=utf8_decode(trim($row['nombrecli'])); $apellidocli=utf8_decode(trim($row['apellido'])); $nombrecli=utf8_decode(trim($row['nombre'])); $etiqueta=utf8_decode(trim($row['etiqueta'])); $cedulacli=utf8_decode(trim($row['cedula'])); $fecha=formatofecha(trim($row["fecha_contrato"])); $fecha_nac=formatofecha(trim($row["fecha_nac"])); $nro_contrato=trim($row['nro_contrato']); $id_contrato=trim($row['id_contrato']); $puntos=utf8_decode(trim($row['puntos'])); $deuda=utf8_decode(trim($row['deuda'])); if($deuda==""){ $deuda=0; } $deuda=number_format($deuda, 2, ',', '.'); $nombre_zona=utf8_decode(trim($row['nombre_zona'])); $nombre_sector=utf8_decode(trim($row['nombre_sector'])); $nombre_calle=utf8_decode(trim($row['nombre_calle'])); $numero_casa=utf8_decode(trim($row['numero_casa'])); $telefono=utf8_decode(trim($row['telefono'])); $telf_casa=utf8_decode(trim($row['telf_casa'])); $telf_adic=utf8_decode(trim($row['telf_adic'])); $email=utf8_decode(trim($row['email'])); $direc_adicional=utf8_decode(trim($row['direc_adicional'])); $id_persona=utf8_decode(trim($row['id_persona'])); $postel=utf8_decode(trim($row['postel'])); $taps=utf8_decode(trim($row['taps'])); $pto=utf8_decode(trim($row['pto'])); $edificio=utf8_decode(trim($row['edificio'])); $numero_piso=utf8_decode(trim($row['numero_piso'])); } $acceso->objeto->ejecutarSql("SELECT nombre,apellido FROM persona where id_persona='$id_persona' LIMIT 1 offset 0 "); if($row=row($acceso)){ $vendedor=utf8_decode(trim($row['nombre']))." ".utf8_decode(trim($row['apellido'])); } if($tipo_cliente=='JURIDICO'){ $rif=$cedulacli; $cedulacli=''; } $this->Ln(); $this->SetFont('times','B',11); $this->SetXY(10,35); $this->Cell(195,10,"Abonado: $nro_contrato","0",0,"R"); $this->SetXY(40,50); $this->Ln(); $this->SetFont('times','B',11); $this->SetX(10); $this->Cell(195,6,"PERSONA JURIDICA.","1",0,"J"); $this->Ln(); $this->SetFont('times','',11); $this->SetX(10); $this->Cell(195,6,"Razón Social.","1",0,"J"); $this->Ln(); $this->SetFont('times','',12); $this->SetX(10); $this->Cell(98,6,"Actividad.","1",0,"J"); $this->Cell(97,6,"RIF. $rif","1",0,"J"); $this->Ln(); $this->SetFont('times','',12); $this->SetX(10); $this->Cell(98,6,"E-mail.","1",0,"J"); $this->Cell(97,6,"Telef.","1",0,"J"); $this->Ln(); $this->SetFont('times','',11); $this->SetX(10); $this->Cell(195,6,"Representante Legal","1",0,"J"); $this->Ln(); $this->SetFont('times','',12); $this->SetX(10); $this->Cell(98,6,"C.I: ","1",0,"J"); $this->Cell(97,6,"Cargo en la Empresa.","1",0,"J"); $this->Ln(); $this->SetFont('times','B',11); $this->SetX(10); $this->Cell(195,6,"PERSONA NATURAL.","1",0,"J"); $this->Ln(); $this->SetFont('times','',12); $this->SetX(10); $this->Cell(195,6,"Apellidos y Nombres: $nombrecli $apellidocli","1",0,"J"); $this->Ln(); $this->SetFont('times','',12); $this->SetX(10); $this->Cell(65,6,"Cédula: $cedulacli","1",0,"J"); $this->Cell(65,6,"Fecha de Nac: $fecha_nac","1",0,"J"); $this->Cell(65,6,"Profesión u Oficio: ","1",0,"J"); $this->Ln(); $this->SetFont('times','',12); $this->SetX(10); $this->Cell(65,6,"Telf. Hab: $telf_casa","1",0,"J"); $this->Cell(65,6,"Celular: $telefono","1",0,"J"); $this->Cell(65,6,"Telef Ofic: $telf_adic","1",0,"J"); $this->Ln(); $this->SetFont('times','',12); $this->SetX(10); $this->Cell(65,6,"E-mail: $email","1",0,"J"); $this->Cell(65,6,"Ingreso Mensual: ","1",0,"J"); $this->Cell(65,6,"Deposito en Garantia: ","1",0,"J"); $this->Ln(); $this->SetFont('times','',12); $this->SetX(10); $this->Cell(130,6,"Tipo Vivienda: Propia ___ Alquilado ___ Canon Mensual: ____","1",0,"J"); $this->Cell(65,6,"Vencimiento del Contrato: / / ","1",0,"J"); $this->Ln(); $this->SetFont('times','B',11); $this->SetX(10); $this->Cell(195,6,"DATOS DEL CONYUGUE.","1",0,"J"); $this->Ln(); $this->SetFont('times','',12); $this->SetX(10); $this->Cell(195,6,"Apellidos y Nombres: ","1",0,"J"); $this->Ln(); $this->SetFont('times','',12); $this->SetX(10); $this->Cell(65,6,"Cédula: ","1",0,"J"); $this->Cell(65,6,"Fecha de Nac: ","1",0,"J"); $this->Cell(65,6,"Profesión u Oficio: ","1",0,"J"); $this->Ln(); $this->SetFont('times','',12); $this->SetX(10); $this->Cell(65,6,"Telf. Hab: ","1",0,"J"); $this->Cell(65,6,"Celular: ","1",0,"J"); $this->Cell(65,6,"Telef Ofic: ","1",0,"J"); $this->Ln(); $this->SetFont('times','',12); $this->SetX(10); $this->Cell(98,6,"E-mail: ","1",0,"J"); $this->Cell(97,6,"Ingreso Mensual.","1",0,"J"); $this->Ln(); $this->SetFont('times','B',11); $this->SetX(10); $this->Cell(195,6,"DOMICILIO DEL SERVICIO","1",0,"C"); /*$this->Ln(); $this->SetFont('times','',12); $this->SetX(10); $this->Cell(98,6,"Apellidos: $apellidocli","1",0,"J"); $this->Cell(97,6,"Vendedor: $vendedor","1",0,"J"); $this->Ln(); $this->SetFont('times','',12); $this->SetX(10); $this->Cell(98,6,"Suscriptor Nº: $nro_contrato","1",0,"J"); $this->Cell(97,6,"Fecha: $fecha","1",0,"J");*/ /*if($tipo_cliente=='JURIDICO'){ $rif=$cedulacli; $cedulacli=''; }*/ /*$this->Ln(); $this->SetFont('times','',12); $this->SetX(10); $this->Cell(98,6,"C.I. $cedulacli","1",0,"J"); $this->Cell(97,6,"RIF. $rif","1",0,"J");*/ /*$this->Ln(); $this->SetFont('times','',12); $this->SetX(10); $this->Cell(65,6,"Ocupación: ","1",0,"J"); $this->Cell(65,6,"Grupo Familiar Nº:","1",0,"J"); if($fecha_nac=='11/11/1111'){ $fecha_nac=''; } $this->Cell(65,6,"Fecha de Nacimiento : $fecha_nac","1",0,"J"); $this->Ln(); $this->SetFont('times','B',12); $this->SetX(10); $this->SetFillColor(76,136,206); $this->SetTextColor(255,255,255); $this->Cell(195,6,"DOMICILIO DE SERVICIO","1",0,"C",'1'); $this->SetTextColor(0,0,0);*/ $this->Ln(); $this->SetFont('times','',12); $this->SetX(10); $this->Cell(98,6,"Urb o Sector: $nombre_sector","1",0,"J"); $this->Cell(97,6,"Calle n°: ","1",0,"J"); $this->Ln(); $this->SetFont('times','',12); $this->SetX(10); $this->Cell(98,6,"Avenida o Calle: $nombre_calle","1",0,"J"); $this->Cell(97,6,"Vereda : ","1",0,"J"); if($edificio!='') $apto=$numero_casa; $this->Ln(); $this->SetFont('times','',12); $this->SetX(10); $this->Cell(65,6,"Edificio: $edificio","1",0,"J"); $this->Cell(65,6,"Piso:","1",0,"J"); $this->Cell(65,6,"N° de Casa o Apto: $numero_casa $apto","1",0,"J"); $this->Ln(); $this->SetFont('times','',12); $this->SetX(10); $this->Cell(130,6,"Referencia o Zona: $nombre_zona N°Poste:$postel","1",0,"J"); //$this->Cell(65,6,"N° de Poste: $postel","0",0,"J"); $this->Cell(65,6,"Ruta Cuenta: ","1",0,"J"); /*$this->Ln(); $this->SetFont('times','',12); $this->SetX(10); $this->Cell(98,6,"Zona: $nombre_zona","1",0,"J"); $this->Cell(97,6,"Manzana: ","1",0,"J"); $this->Ln(); $this->SetFont('times','',12); $this->SetX(10); $this->Cell(98,6,"Urb.: $nombre_sector","1",0,"J");*/ /*if($edificio!='') $apto=$numero_casa; $this->Cell(97,6,"Apto.: $apto","1",0,"J");*/ /*$this->Ln(); $this->SetFont('times','',12); $this->SetX(10); $this->Cell(98,6,"Edificio: $edificio","1",0,"J"); $this->Cell(97,6,"Cod. Postal: ","1",0,"J"); $this->Ln(); $this->SetFont('times','',12); $this->SetX(10); $this->Cell(65,6,"Telf. Hab: $telf_casa","1",0,"J"); $this->Cell(65,6,"Celular: $telefono","1",0,"J"); $this->Cell(65,6,"Telef Ofic: $telf_adic","1",0,"J"); $this->Ln(); $this->SetFont('times','',12); $this->SetX(10); //Rect( float x, float y, float w, float h [, string style]) $this->Cell(98,6,"Vivienda Alquilada: SI ____ NO ____","1",0,"J"); $this->Cell(97,6,"Fecha de Vencimineto de Alquiler: ","1",0,"J"); $this->Ln(); $this->SetFont('times','',12); $this->SetX(10); $this->Cell(98,6,"E-mail: $email","1",0,"J"); $this->Cell(97,6,"Proveedor de Internet: ","1",0,"J");*/ /*$this->Ln(); $this->SetFont('times','B',12); $this->SetX(10); $this->SetFillColor(76,136,206); $this->SetTextColor(255,255,255); $this->Cell(195,6,"SERVICIOS CONTRATADOS","1",0,"C",'1'); $this->SetTextColor(0,0,0);*/ $this->Ln(); $this->SetFont('times','B',11); $this->SetX(10); $this->Cell(195,6,"SERVICIOS CONTRATADOS","1",0,"C"); $this->Ln(); $this->SetFont('times','',12); $this->SetX(10); $this->Cell(100,6,"SERVICIOS ","1",0,"J"); $this->Cell(30,6,"CANT.","1",0,"C"); $this->Cell(30,6,"P. UNITARIO ","1",0,"C"); $this->Cell(35,6,"P. TOTAL ","1",0,"C"); $this->Ln(); $this->SetFont('times','',12); $this->SetX(10); $this->Cell(100,5,"Instalación Principal","1",0,"J"); $this->Cell(30,5,"1","1",0,"C"); $this->Cell(30,5,"$costo_inst","1",0,"C"); $this->Cell(35,5,"$costo_inst","1",0,"C"); $this->Ln(); $this->SetFont('times','',12); $this->SetX(10); $this->Cell(100,5,"Tomas Adicionales","1",0,"J"); $this->Cell(30,5,"","1",0,"C"); $this->Cell(30,5,"","1",0,"C"); $this->Cell(35,5,"","1",0,"C"); $this->Ln(); $this->SetFont('times','',12); $this->SetX(10); $this->Cell(100,5,"Cable Coaxial","1",0,"J"); $this->Cell(30,5,"","1",0,"C"); $this->Cell(30,5,"","1",0,"C"); $this->Cell(35,5,"","1",0,"C"); $this->Ln(); $this->SetFont('times','',12); $this->SetX(10); $this->Cell(100,5,"Conectores","1",0,"J"); $this->Cell(30,5,"","1",0,"C"); $this->Cell(30,5,"","1",0,"C"); $this->Cell(35,5,"","1",0,"C"); $this->Ln(); $this->SetFont('times','',12); $this->SetX(10); $this->Cell(100,5,"Espliter","1",0,"J"); $this->Cell(30,5,"","1",0,"C"); $this->Cell(30,5,"","1",0,"C"); $this->Cell(35,5,"","1",0,"C"); $this->Ln(); $this->SetFont('times','',12); $this->SetX(10); $this->Cell(100,5," ","1",0,"J"); $this->Cell(60,5,"TOTAL A PAGAR BS","1",0,"R"); $this->Cell(35,5,"$costo_inst","1",0,"C"); /*$this->Ln(); $this->SetFont('times','',12); $this->SetX(10); $this->SetTextColor(255,255,255); $this->Cell(50,5,"FECHA ESTIMADA","LRT",0,"C",'1'); $this->SetTextColor(0,0,0); $this->Cell(25,5,"","LRT",0,"C"); $this->SetTextColor(255,255,255); $this->Cell(25,5,"HORA","LRT",0,"C",'1'); $this->SetTextColor(0,0,0); $this->Cell(30,5,"","LRT",0,"C"); $this->SetTextColor(255,255,255); $this->Cell(30,5,"TOTAL A","LRT",0,"C",'1'); $this->SetTextColor(0,0,0); $this->Cell(35,5,"$costo_contrato","LRT",0,"C"); $this->Ln(); $this->SetFont('times','',12); $this->SetX(10); $this->SetTextColor(255,255,255); $this->Cell(50,5,"DE INSTALACION","LRB",0,"C",'1'); $this->SetTextColor(0,0,0); $this->Cell(25,5,"","LRB",0,"C"); $this->SetTextColor(255,255,255); $this->Cell(25,5,"SUGERIDA","LRB",0,"C",'1'); $this->SetTextColor(0,0,0); $this->Cell(30,5,"","LRB",0,"C"); $this->SetTextColor(255,255,255); $this->Cell(30,5,"PAGAR Bs.","LRB",0,"C",'1'); $this->SetTextColor(0,0,0); $this->Cell(35,5,"","LRB",0,"C");*/ $this->Ln(); $this->SetFont('times','B',11); $this->SetX(10); $this->Cell(195,6,"PROGRAMACIÓN","1",0,"C"); $this->Ln(); $this->SetFont('times','',10); $this->SetX(10); $this->Cell(45,6,"Descripción.","1",0,"C"); $this->Cell(25,6,"Monto","1",0,"C"); $this->Cell(30,6,"Firma Abonado","1",0,"C"); $this->Cell(40,6,"Descripción","1",0,"C"); $this->Cell(25,6,"Monto","1",0,"C"); $this->Cell(30,6,"Firma Abonado","1",0,"C"); $this->Ln(); $this->SetFont('times','',10); $this->SetX(10); $this->Cell(45,6,"Paquete Familiar Bs","1",0,"C"); $this->Cell(25,6," ","1",0,"C"); $this->Cell(30,6," ","1",0,"C"); $this->Cell(40,6,"Paquete Extendido Bs ","1",0,"C"); $this->Cell(25,6," ","1",0,"C"); $this->Cell(30,6," ","1",0,"C"); $this->Ln(); $this->SetFont('times','',10); $this->SetX(10); $this->Cell(45,6,"Paquete Premium I Bs","1",0,"C"); $this->Cell(25,6," ","1",0,"C"); $this->Cell(30,6," ","1",0,"C"); $this->Cell(40,6,"Paquete Premium I Bs","1",0,"C"); $this->Cell(25,6," ","1",0,"C"); $this->Cell(30,6," ","1",0,"C"); $this->Ln(); $this->SetFont('times','',10); $this->SetX(10); $this->Cell(45,6,"Paquete Adulto Bs","1",0,"C"); $this->Cell(25,6," ","1",0,"C"); $this->Cell(30,6," ","1",0,"C"); $this->Cell(40,6,"Paquete Comercial I Bs","1",0,"C"); $this->Cell(25,6," ","1",0,"C"); $this->Cell(30,6," ","1",0,"C"); $this->Ln(); $this->SetFont('times','',12); $this->SetX(10); $this->Cell(100,6,"Monto de Contrato: Bs. $costo_inst","1",0,"J"); $this->Cell(95,6,"Firma del Abonado:_________________________ ","1",0,"J"); $this->Ln(); $this->SetFont('times','',12); $this->SetX(10); $this->Cell(100,6,"Puntos Adicionales:_________________________","1",0,"J"); $this->Cell(95,6,"Costo Punto Adicional:_______________________","1",0,"J"); $this->Ln(); $this->SetFont('times','',12); $this->SetX(10); $this->Cell(65,6,"Tiempo de Instalación:","1",0,"J"); $this->Cell(65,6,"Total a Cancelar Mensual:","1",0,"J"); $this->Cell(30,6,"Total:","1",0,"J"); $this->Cell(35,6,"Contrato:","1",0,"J"); $this->Ln(); $this->SetFont('times','',11); $this->SetX(10); $this->Cell(195,6,"Observaciones.","1",0,"J"); /*$this->Ln(); $this->SetFont('times','',12); $this->SetX(10); $this->Cell(195,6,"$observacion","1",0,"J");*/ /* $this->Ln(); $this->SetFont('times','',12); $this->SetX(10); $this->Cell(98,6,"RECIBO DE PAGO","1",0,"J"); $this->Cell(97,6,"*EL PRECIO INCLUYE EL IMPUESTO DE LEY","1",0,"J"); $this->Ln(); $this->SetFont('times','',12); $this->SetX(10); $this->Cell(35,6,"Efectivo","1",0,"C"); $this->Cell(35,6,"Cheque","1",0,"C"); $this->Cell(65,6,"Cargo Cta. Cte.","1",0,"C"); $this->Cell(60,6,"Tarjeta de Credito:","1",0,"C"); $this->Ln(); $this->SetFont('times','',12); $this->SetX(10); $this->Cell(35,6,"Bs. $costo_contrato","1",0,"L"); $this->Cell(35,6,"Nº.","1",0,"L"); $this->Cell(65,6,"Cta. Nº Bco.","1",0,"L"); $this->Cell(60,6,"Nombre:","1",0,"L"); $this->Ln(15); $this->SetFont('times','',9); $this->SetX(10); $this->Cell(13,5,"Nota:","0",0,"L"); $this->MultiCell(164,5,"En caso de que el televisor no acepte la señal de todos los canales del cable, es posible que amerite la instalación de un amplificador de sintonia, el cual deberá ser adquirido por el SUSCRIPTOR","0","J"); $this->SetFont('times','',9); $this->SetX(10); $this->Cell(13,5,"Atención: ","0",0,"L"); $this->MultiCell(164,5,"La Empresa. No autoriza el retiro de televisores y/o VHS por el personal de la empresa. El SUSCRIPTOR conoce y acepta las condiciones del contrato del servicio que apacen al dorso del presente","0","J"); $this->SetFont('times','',9); $this->SetX(10); $this->Cell(13,5,"Aviso: ","0",0,"L"); $this->MultiCell(164,5,"Se le informa a todos los suscriptores y publico en general de acuerdo a la Ley Orgánica de Telecomunicaciones, en el Artículo 189, Literal 2: será penado con prisión de uno (1) a cuatro (4) años, el que utilizando equipos o tecnologías de cualquier tipo, proporciones a un tercero el acceso o disfrute en forma fraudulenta o indebida de un serbicio o facilidad de telecomunicaciones ","0","J"); $this->Ln(10); $this->SetFont('times','',10); $this->SetX(10); $this->Cell(65,5,"________________________","0",0,"C"); $this->Cell(65,5,"_________________________________","0",0,"C"); $this->Cell(65,5,"__________________________","0",0,"C"); $this->Ln(); $this->SetX(10); $this->Cell(65,6,"Firma del Vendedor","0",0,"C"); $this->Cell(65,6,"Nombre y Apellido del Suscriptor","0",0,"C"); $this->Cell(65,6,"Firma del Suscriptor","0",0,"C");*/ /*$this->Ln(4); $this->SetDrawColor(76,136,206); $this->SetLineWidth(.4); $this->SetFont('times','I',12); $this->SetX(10); $this->MultiCell(195,5,'Av. Perimetral, Centro Comercial Residencial Central. P.B. Local Nº 07. Cúa, Edo. Miranda. [email protected] / [email protected]',"TB","C");*/ //$this->clausulas(); return $cad; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function reportListing()\n {\n\t$strsql = \"SELECT r.*,rs.* FROM \" . TBL_REPORTS . \" r inner join \" . TBL_REPORTS_SUBMISSION . \" rs on r.report_id=rs.report_id where r.site_id='\" . $_SESSION['site_id'] . \"' and r.report_id='\".$_GET['rid'].\"'\";\n\t$objRs = $this->objDatabase->dbQuery($strsql);\n\tparent:: reportListing($objRs);\n }", "public function reportListing_default()\n {\n\t$defaultreportnames = $this->reportNames(); $rid = $defaultreportnames->fetch_object();\n\t$strsql = \"SELECT r.*,rs.* FROM \" . TBL_REPORTS . \" r inner join \" . TBL_REPORTS_SUBMISSION . \" rs on r.report_id=rs.report_id where r.site_id='\" . $_SESSION['site_id'] . \"' and r.report_id='\".$rid->report_id.\"'\";\n\t$objRs = $this->objDatabase->dbQuery($strsql);\n\treturn $objRs;\n }", "function getReport() ;", "public function getReports()\n\t{\n\t\t$this->load->model('admin/inceptra_admin_model');\n\t\t$res=$this->inceptra_admin_model->get_report();\n\t\t\n\t\t$this->load->helper('file'); \n\t\t$this->load->helper(array('dompdf', 'file'));\n\t\t$head=\"LIST OF Candidates and there Marks\";\n\t\t$html=\"<center><h3>\".$head.\"</h3></center><br/>\";\n\t\t\t\t\n\t\t$html.='<center><table width=\"600\">';\n\t\t$html.='<tr><th align=\"left\">Username</th><th align=\"left\">Multichoice</th><th align=\"left\">Pickup1</th><th align=\"left\">Pickup2</th><th align=\"left\">Match Catch</th><th align=\"left\">Toal Marks</th></tr>';\n\t\tforeach($res as $r)\n\t\t{\n\t\t$html.='<tr><td>'.$r->r_id.'</td><td>'.$r->username.'</td><td>'.$r->multichoice.'</td><td>'.$r->pickup1marks.'</td><td>'.$r->pickup2marks.'</td><td>'.$r->matchcatch.'</td><td>'.$r->totalmarks.'</td></tr>';\n\t\t\n\t\t}\n\t\t$html.='</table></center>';\n\t\t\t\t\n \tpdf_create($html, 'pdfreport');\n write_file('name', $data);\n\t}", "public function report_list()\n\t{\n\t\t$this->data['record'] = $this->reports->getReports();\n\t\tif($this->data['record'])\n\t\t{\n\t\t\t$this->load->view('app/reports/employee/employee_report_list',$this->data);\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$this->session->set_flashdata('error_message', 'Please add report to get data');\n\t\t\t$this->load->view('app/reports/employee/employee_report_list',$this->data);\n\t\t}\n\t\t\n\t}", "public function getReport() {}", "public function getReport() {}", "public function get_reports() {\n $data['results'] = $this->Report_Model->get_membership_payments();\n // print_r($data['results']);\n $this->render('list', $data);\n }", "public function _getReporteAll()\n {\n $proyecto = new Admin_Model_DbTable_Proyecto();\n $lista = $proyecto->_getAllExtendido('A');\n\n $respuesta = [];\n $data = [];\n $i = 0;\n foreach ($lista as $item) {\n $data['codigo'] = $item['proyectoid'];\n $data['cliente'] = $item['nombre_comercial'];\n $data['nombre'] = $item['nombre_proyecto'];\n $data['gerente'] = $item['gerente_proyecto'];\n $data['control_proyecto'] = $item['control_proyecto'];\n $data['control_documentario'] = $item['control_documentario'];\n $data['estado'] = $item['estado'];\n\n $respuesta[$i]['proyecto'] = $data;\n\n $rows = $this->_getLEReporte($data['codigo']);\n\n $respuesta[$i]['entregables'] = $rows;\n\n $i++;\n }\n\n $envio = [];\n $j = 0;\n\n for ($i=0; $i < sizeof($respuesta); $i++) {\n if (sizeof($respuesta[$i]['entregables']) != 0) {\n $envio[$j] = $respuesta[$i];\n $j++;\n }\n }\n\n return $envio;\n }", "private function getItems()\n\t{\n\t\tJLoader::import('components.com_reports.models.reports', JPATH_SITE);\n\t\t$reportModel = new TjreportsModelReports;\n\t\t$input = JFactory::getApplication()->input;\n\t\t$this->limitStart = $input->get('limitstart');\n\t\t$this->limit = $reportModel->getState('list.limit');\n\t\t$reportId = $input->post->get('reportId');\n\n\t\t$reportData = $reportModel->getReportNameById($reportId);\n\t\t$pluginName = $reportData->plugin;\n\n\t\tJModelLegacy::addIncludePath(JPATH_SITE . '/plugins/tjreports/' . $pluginName);\n\t\t$model = JModelLegacy::getInstance($pluginName, 'TjreportsModel');\n\n\t\t$model->loadLanguage($pluginName);\n\n\t\t$input->set('limit', $this->limit);\n\t\t$input->set('limitstart', $this->limitStart);\n\n\t\t$this->recordCnt = $model->getTotal();\n\t\t$items = $model->getItems();\n\t\t$columns = $model->columns;\n\t\t$colToshow = $model->getState('colToshow');\n\t\t$colTitleArray = array();\n\n\t\tforeach ($colToshow as $index => $detail)\n\t\t{\n\t\t\tif (strpos($index, '::'))\n\t\t\t{\n\t\t\t\t$indexArray = explode('::', $index);\n\t\t\t\t$contentTitle = $indexArray[1];\n\t\t\t\t$contentId = $indexArray[0];\n\n\t\t\t\tforeach ($detail as $subKey => $subDetail)\n\t\t\t\t{\n\t\t\t\t\t$keyDetails = explode('::', $subKey);\n\n\t\t\t\t\tif (!isset($columns[$subKey]['title']))\n\t\t\t\t\t{\n\t\t\t\t\t\t$subTextTitle = 'PLG_TJREPORTS_' . strtoupper($pluginName . '_' . $keyDetails[0] . '_' . $keyDetails[1] . '_TITLE');\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$subTextTitle = $columns[$subKey]['title'];\n\t\t\t\t\t}\n\n\t\t\t\t\t$colTitleArray[] = $contentTitle . ' ' . JText::sprintf($subTextTitle, $contentTitle, $contentId);\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$colKey = $detail;\n\n\t\t\t\tif (!isset($columns[$colKey]['title']))\n\t\t\t\t{\n\t\t\t\t\t$colTitle = 'PLG_TJREPORTS_' . strtoupper($pluginName . '_' . $colKey . '_TITLE');\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t$colTitle = $columns[$colKey]['title'];\n\t\t\t\t}\n\n\t\t\t\t$colTitleArray[] = JText::_($colTitle);\n\t\t\t}\n\t\t}\n\n\t\t$this->headers = $colTitleArray;\n\t\t$pluginTitle = str_replace(\" \", \"_\", $reportData->title);\n\n\t\t// Remove special character from plugin name\n\t\t$pluginTitle = preg_replace('/[^A-Za-z0-9\\-]/', '', $pluginTitle);\n\t\t$this->fileName = rtrim(strtolower($pluginTitle)) . \"_report_\" . date(\"Y-m-d_H-i\", time());\n\n\t\t// Loop through items\n\t\t// foreach ((array) $items as $itemKey => &$item)\n\t\tforeach ($items as &$item)\n\t\t{\n\t\t\t$itemCSV = array();\n\n\t\t\tforeach ($colToshow as $arrayKey => $key)\n\t\t\t{\n\t\t\t\tif (is_array($key))\n\t\t\t\t{\n\t\t\t\t\tforeach ($key as $subkey => $subVal)\n\t\t\t\t\t{\n\t\t\t\t\t\t$final_text_value = $this->filterValue($item[$arrayKey][$subkey]);\n\t\t\t\t\t\t$itemCSV[] = $final_text_value;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t$final_text_value = $this->filterValue($item[$key]);\n\t\t\t\t\t$itemCSV[] = $final_text_value;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t$item = $itemCSV;\n\t\t}\n\n\t\t$this->data = $items;\n\t}", "abstract public function extractReportDatas();", "public function getList()\n {\n if ($_SERVER[\"REQUEST_METHOD\"] != \"GET\")\n {\n echo $this->encodeJson(\"Wrong resource call\", 0xDEAD, NULL);\n\n return;\n }\n\n $report_arr = $this->inspection->readAllReport();\n\n if (count($report_arr) > 0)\n {\n echo $this->encodeJson(\"Inspections found.\", 0x00, $report_arr);\n }\n else\n {\n echo $this->encodeJson(\"No inspections found.\", 0xD1ED, NULL);\n }\n }", "public function processReports();", "public function index() {\n $this->auth->checkIfOperationIsAllowed('report_list');\n $data = getUserContext($this);\n $this->lang->load('datatable', $this->language);\n \n $reports = array();\n //List all the available reports\n $files = glob(FCPATH . '/local/reports/*.ini');\n foreach($files as $file) {\n $ini_array = parse_ini_file($file, TRUE);\n //Test if the report is available for the language being used\n if (array_key_exists($this->language_code, $ini_array)) {\n //If available, push the report into the list to be displayed with a description\n $reports[$ini_array[$this->language_code]['name']] = array(\n basename($file),\n $ini_array[$this->language_code]['description'],\n $ini_array['configuration']['path'],\n );\n }\n }\n \n $data['title'] = lang('reports_index_title');\n $data['reports'] = $reports;\n $this->load->view('templates/header', $data);\n $this->load->view('menu/index', $data);\n $this->load->view('reports/index', $data);\n $this->load->view('templates/footer'); \n }", "public function index()\n\t{\n\t\t$reports = Report::with('report_type')->orderBy('created_at','desc')->get();\n return $reports;\n\t}", "function get_all_reports()\r\n {\r\n return $this->db->get('reports')->result_array();\r\n }", "public function index()\n {\n return Report::all();\n }", "public function getReport(){\n\t\tglobal $db;\n\t\t$sql = $db->prepare(\"SELECT * FROM project01_report ORDER BY id DESC;\");\n\t\t$sql->execute();\n\t\tif ($sql->rowCount()>0) {\n\t\t\t$report = $sql->fetchAll();\n\t\t\treturn $report;\n\t\t}\n\t}", "function getReport($table_selector = '.rptTable', $title_selector = '.search-result')\n\t{\n\t\t$report = array();\n\t\t$titles = $this->getTitles($title_selector);\n\t\t$tables = $this->getTables($table_selector);\n\n\t\tfor ($i = 0, $n = count($tables); $i < $n; $i++)\n\t\t{\n\t\t\t$title = isset($titles[$i]) ? $titles[$i] : '';\n\t\t\t$report[] = array(\n\t\t\t\t'title' => $title,\n\t\t\t\t'table' => $tables[$i]\n\t\t\t);\n\t\t}\n\n\t\treturn $report;\n\t}", "public function getAllCommentsReport() {\n $req = $this->db->query('SELECT id, pseudo, content, date_publication, report, moderation\n FROM comment WHERE report = true ORDER BY date_publication DESC');\n $data = $req->fetchAll();\n return $data;\n }", "public function getReports()\n {\n return $this->reports;\n }", "public function getAllReports(){\n $table = \"LITS_Stack_Reports\";\n\n try {\n $conn = $this->connect();\n $stmt = $conn->prepare(\"SELECT report, tag FROM $table\");\n $stmt->execute();\n $result = $stmt->setFetchMode(PDO::FETCH_ASSOC);\n $result = $stmt->fetchAll();\n $conn = null;\n\n return $result;\n }\n catch(PDOException $e){\n echo $e;\n return null;\n }\n }", "public function actionCollectorReport() {\n /*Get result using model method*/\n $result = [\n ['a', 'b', 'c',],\n [1, 2, 3,],\n ];\n\n $fileName = 'debtorList' . date('Y-m-d');\n $this->createCSV($result, $fileName);\n\n //$subscribers = Subscriber::getSubscribers('collector');\n //$this->actionSendReport($fileName, $subscribers);\n\n }", "static function get_all_reports($includeDeleted=false)\n {\n global $DB;\n\n static $r;\n\n if(isset($r))\n return $r;\n\n $r = array();\n\n foreach($DB->get_fieldset_select('block_ilp_report','id','1 = 1 ') as $rid)\n {\n $report=static::from_id($rid);\n if(!$report->deleted or $includeDeleted)\n $r[$rid]=$report;\n }\n\n return $r;\n }", "public function getReports()\n {\n return RoadDamageReport::where('roaddamage_id', $this->id)->get();\n }", "public function getReports()\n {\n return $this->_getChildrenByName('report');\n }", "public function getReports() {\n return $this->model->all()->toArray();\n }", "public function reports()\n {\n $registeredReports = new ReportFullCollection([\n 'console' => new PrintableReport(new LogOutputReport()),\n 'teamcity' => new PrintableReport(\n new TeamcityBuiltImageVersionReport(\n new TeamcityVariableCollection()\n )\n ),\n 'index' => new SavableReport(\n new HTMLReport(new Engine(HTMLReport::REPORT_TEMPLATE_PATH))\n )\n ]);\n\n return $registeredReports;\n }", "public function historics_reports()\n {\n set_time_limit(3000000);\n $params = Request::all();\n $conditions = [];\n if(!empty($params['type_transaction'])){\n $conditions['type_transaction'] = $params['type_transaction'];\n }\n if(!empty($params['date_operation'])){\n $conditions['date_operation'] = $params['date_operation'];\n }\n if(count($params) > 1){\n $accounts_historical = AccountsHistorical::where($conditions)->orderBy('id','DESC')->get();\n } else {\n $accounts_historical = AccountsHistorical::orderBy('id','DESC')->get();\n }\n $pdf = PDF::loadView('reports.historics',compact('accounts_historical'))->setOrientation('landscape')->setOption('encoding', 'utf-8')->setOption('footer-center', 'Página [page] de [topage]');\n return $pdf->stream('reports.pdf');\n }", "public function action_list() {\n global $CFG;\n require_once($CFG->dirroot . '/blocks/php_report/sharedlib.php');\n\n //import necessary CSS\n $stylesheet_web_path = $CFG->wwwroot . '/blocks/php_report/styles.php';\n echo '<style>@import url(\"' . $stylesheet_web_path . '\");</style>';\n\n $category_members = block_php_report_get_names_by_category(true, NULL, php_report::EXECUTION_MODE_SCHEDULED);\n\n //set up the basics of our table\n $table = new stdClass;\n $table->head = array(get_string('list_report_name_header', 'block_php_report'),\n get_string('list_schedule_header', 'block_php_report'));\n $table->align = array('left',\n 'left');\n $table->rowclass = array();\n $table->data = array();\n\n $categories = block_php_report_get_category_mapping();\n\n //go through categories and append items\n foreach ($categories as $category_key => $category_display) {\n if (!empty($category_members[$category_key])) {\n\n //set up a row for the category header\n $table->data[] = array($category_display, '');\n //cass class for specially styling the category header row\n $table->rowclass[] = 'php_report_scheduling_list_category';\n\n //go through and add all report entries below the category header\n foreach ($category_members[$category_key] as $member_shortname => $member_display) {\n //set up a link for executing the report\n $execute_report_url = $CFG->wwwroot . '/blocks/php_report/render_report_page.php?report=' . $member_shortname;\n\n $execute_report_link = php_report::get_default_instance($member_shortname)\n ? '<a href=\"' . $execute_report_url . '\">' . $member_display . '</a>'\n : $member_display;\n\n //set up a link for scheduling the report\n $execute_report_url_params = array('action' => 'listinstancejobs',\n 'report' => $member_shortname);\n $execute_report_url = $this->get_url($execute_report_url_params);\n $schedule_report_link = '';\n if (php_report::get_default_instance($member_shortname, NULL, php_report::EXECUTION_MODE_SCHEDULED)) {\n $schedule_report_link = '<a href=\"' . $execute_report_url . '\">\n <img src=\"' . $CFG->wwwroot . '/blocks/php_report/pix/schedule.png\"/>\n </a>';\n }\n\n //append info to the row\n $table->data[] = array($execute_report_link, $schedule_report_link);\n $table->rowclass[] = '';\n }\n }\n }\n\n if (count($table->data > 0)) {\n print_table($table);\n } else {\n //error case\n }\n }", "function getReportsMenu(){\r\n $level=2;\r\n $hr=new HabilitationReport();\r\n $user=getSessionUser();\r\n //$allowedReport=array();\r\n $allowedCategory=array();\r\n $lst=$hr->getSqlElementsFromCriteria(array('idProfile'=>$user->idProfile, 'allowAccess'=>'1'), false);\r\n $res=array();\r\n $listCateg=SqlList::getList('ReportCategory');\r\n $idMenuReport=SqlElement::getSingleSqlElementFromCriteria('Navigation', array('name'=>'navReports'));\r\n $menuReport=SqlElement::getSingleSqlElementFromCriteria('Menu', array('name'=>'menuReports'));\r\n foreach ($lst as $h) {\r\n $report=$h->idReport;\r\n $nameReport=SqlList::getNameFromId('Report', $report, false);\r\n if (! Module::isReportActive($nameReport)) continue;\r\n //$allowedReport[$report]=$report;\r\n $category=SqlList::getFieldFromId('Report', $report, 'idReportCategory',false);\r\n $allowedCategory[$category]=$category;\r\n }\r\n $c=1;\r\n $lstIdCate=array();\r\n $idReportMenu=$idMenuReport->id.$level.$menuReport->id;\r\n $menuReportKey=$level.'-'.numericFixLengthFormatter($idMenuReport->id,5).'-'.numericFixLengthFormatter($c,5);\r\n $object= array('id'=>$idReportMenu,'name'=>$menuReport->name,'idParent'=>$idMenuReport->id,'idMenu'=>$menuReport->id);\r\n $res[$menuReportKey]=array('level'=>$level,'objectType'=>'reportDirect','object'=>$object);\r\n foreach ($listCateg as $id=>$name) {\r\n if (isset($allowedCategory[$id])) {\r\n $c++;\r\n $cat=new ReportCategory($id);\r\n $lstIdCate[]=$id;\r\n $idReport=$idMenuReport->id.$level.$id;\r\n $key=$level.'-'.numericFixLengthFormatter($idMenuReport->id,5).'-'.numericFixLengthFormatter($c,5);\r\n $obj= array('id'=>$idReport,'name'=>$cat->name,'idParent'=>$idMenuReport->id);\r\n $res[$key]=array('level'=>$level,'objectType'=>'report','object'=>$obj);\r\n }\r\n }\r\n //===================\r\n //=================== lis of all report dependant of this categoryies\r\n\r\n $level++;\r\n $reportDirect= new Report();\r\n $lstCatId=(empty($lstIdCate))?\"0\":\"0\".implode(\",\", $lstIdCate);\r\n $where=\" idReportCategory in (\".$lstCatId.\")\";\r\n $reportList= $reportDirect->getSqlElementsFromCriteria(null,false,$where,\"file\");\r\n $nameFile=SqlList::getList('Report','file');\r\n $lstReportName=array();\r\n $lstNewNavMenu=array();\r\n foreach ($nameFile as $idN=>$nameFile){\r\n $lstReportName[]=substr($nameFile, 0,strpos($nameFile, '.php'));\r\n }\r\n $countNameFil=array_count_values($lstReportName);\r\n foreach ($countNameFil as $name=>$val){\r\n if($val==1)unset($countNameFil[$name]);\r\n else $lstNewNavMenu[]=$name;\r\n }\r\n storReports($reportList,$res, $lstNewNavMenu,$idMenuReport, $level);\r\n return $res;\r\n \r\n}", "public function list() {\n\t\t$company_db = $this->load->database($this->session->userdata('user_db'), TRUE);\n\t\t// Attempt to load list of all active Reports that are public or owned by the User\n\t\t$company_db->where('active', 1)\n\t\t\t\t ->group_start()\n\t\t\t\t ->where('private', 0)\n\t\t\t\t ->or_where('creator', $this->session->userdata('user_id'))\n\t\t\t\t ->group_end();\n\t\t$data['reports'] = $company_db->get('reports')->result();\n\t\t// Set the flash data error message if there is an error\n\t\t$data['message'] = validation_errors()\n\t\t\t? validation_errors()\n\t\t\t: $this->session->flashdata('message');\n\t\t// Provide non-loaded data for views\n\t\t$data['title'] = \"Reports List\";\n\t\t// Load views\n\t\t$this->load->view('includes/header', $data);\n\t\t$this->load->view('reports/list', $data);\n\t\t$this->load->view('includes/footer', $data);\n\t}", "public function getReporteClientes()\n\t{\n\t\t$spreadsheet = new Spreadsheet();\n\t\t$sheet = $spreadsheet->getActiveSheet();\n\t\t$sql = (\"SELECT \n\t\tclientes.nombre,\n\t\trazonsocial,\n\t\tagentes.codagente AS codigo_agente,\n\t\tagentes.nombre AS agente,\n\t\tclientes.telefono1 AS telefono_cliente,\n\t\tclientes.telefono2 AS telefono_cliente_secundario,\n\t\tdirclientes.direccion,\n\t\tdirclientes.provincia,\n\t\tdirclientes.ciudad\n\tFROM\n\t\t`clientes`\n\t\t\tLEFT JOIN\n\t\tagentes ON agentes.codagente = clientes.codagente\n\t\t\tINNER JOIN\n\t\tdirclientes ON dirclientes.codcliente = clientes.codcliente\n\t\twhere clientes.debaja = 0;\");\n\t\t$this->consulta('SET NAMES utf8');\n\t\t# Escribir encabezado de los productos\n\t\t$encabezado = [\"nombre\",\"razonsocial\",\"codigo_agente\",\"agente\",\"telefono_cliente\",\"telefono_cliente_secundario\",\"direccion\",\"provincia\",\"ciudad\"];\n\t\t# El último argumento es por defecto A1 pero lo pongo para que se explique mejor\n\t\t$sheet->fromArray($encabezado, null, 'A1');\n\n\t\t$resultado = $this->consulta($sql);\n\t\t$res = $resultado->fetchAll(PDO::FETCH_ASSOC);\n\t\t$numeroDeFila = 2;\n\t\tforeach ($res as $data ) {\n\t\t\t# Obtener los datos de la base de datos\n\t\t\t$nombre = $data['nombre'];\n\t\t\t$razonsocial = $data['razonsocial'];\n\t\t\t$codigo_agente = $data['codigo_agente'];\n\t\t\t$agente = $data['agente'];\n\t\t\t$telefono_cliente = $data['telefono_cliente'];\n\t\t\t$telefono_cliente_secundario = $data['telefono_cliente_secundario'];\n\t\t\t$direccion = $data['direccion'];\n\t\t\t$provincia = $data['provincia'];\n\t\t\t$ciudad = $data['ciudad'];\n\t\t\t# Escribirlos en el documento\n\t\t\t$sheet->setCellValueByColumnAndRow(1, $numeroDeFila, $nombre);\n\t\t\t$sheet->setCellValueByColumnAndRow(2, $numeroDeFila, $razonsocial);\n\t\t\t$sheet->setCellValueByColumnAndRow(3, $numeroDeFila, $codigo_agente);\n\t\t\t$sheet->setCellValueByColumnAndRow(4, $numeroDeFila, $agente);\n\t\t\t$sheet->setCellValueByColumnAndRow(5, $numeroDeFila, $telefono_cliente);\n\t\t\t$sheet->setCellValueByColumnAndRow(6, $numeroDeFila, $telefono_cliente_secundario);\n\t\t\t$sheet->setCellValueByColumnAndRow(7, $numeroDeFila, $direccion);\n\t\t\t$sheet->setCellValueByColumnAndRow(8, $numeroDeFila, $provincia);\n\t\t\t$sheet->setCellValueByColumnAndRow(9, $numeroDeFila, $ciudad);\n\t\t\t$numeroDeFila++;\n\t\t}\n\t\t$writer = new Xlsx($spreadsheet);\n\t\t$writer->save('../../reporte/reporte.xlsx');\n\t\techo \"true\";\n\t}", "public function index()\n {\n $reports = Report::orderBy('finished')\n ->orderBy('updated_at','desc')\n ->paginate(10);\n\n $data = [\n 'viewname' => 'Denúncias',\n 'viewtitle' => 'Denúncias',\n 'reports' => $reports,\n 'profileView' => False,\n ];\n\n return view('report.list',$data);\n }", "public function todos()\n {\n // Comprobar si esta logeado como admin\n if( isset($_SESSION['admin']) ){\n\n // La cantidad de tipos de reporte que va a mostrar\n $numeroTiposReporte = 5;\n\n // Obtener que numero de pagina es\n $pagina = ( isset($_GET['pagina']) ? $_GET['pagina'] : 1 );\n\n // Conocer el inicio de la consulta\n $inicioConsulta = ( ($pagina == 1) ? 0 : (($numeroTiposReporte * $pagina) - $numeroTiposReporte) );\n\n // Contar la cantidad de tipos de reporte\n $totalTiposReporte = count(TipoReporte::todos());\n\n // El numero de paginas que salen en total\n $cantidadDePaginas = ( ($totalTiposReporte == 0) ? 1 : ceil($totalTiposReporte / $numeroTiposReporte) );\n\n\n // Peticion al modelo para recuperar todos los tipos de reporte de la bd y guardarlos en una variable\n $tiposReporte = TipoReporte::limite($inicioConsulta, $numeroTiposReporte)\n ->resultado();\n\n\n\n // Mensaje\n $msg = ( isset($_COOKIE['mensaje']) ? $_COOKIE['mensaje'] : null);\n\n // Mensaje Error\n $msgError = ( isset($_COOKIE['mensaje_error']) ? $_COOKIE['mensaje_error'] : null);\n\n\n // Requerir la vista que muestra todos los usuarios registrados\n include '../vistas/tipos_reporte/index.php';\n\n } else {\n\n // Redirigir al login\n header('Location: ../login');\n }\n }", "function quiz_report_list($context) {\n global $DB;\n static $reportlist = null;\n if (!is_null($reportlist)){\n return $reportlist;\n }\n $reports = $DB->get_records('quiz_report', null, 'displayorder DESC', 'name, capability');\n $reportdirs = get_plugin_list('quiz');\n\n // Order the reports tab in descending order of displayorder\n $reportcaps = array();\n foreach ($reports as $key => $obj) {\n if (array_key_exists($obj->name, $reportdirs)) {\n $reportcaps[$obj->name] = $obj->capability;\n }\n }\n\n // Add any other reports on the end\n foreach ($reportdirs as $reportname => $notused) {\n if (!isset($reportcaps[$reportname])) {\n $reportcaps[$reportname] = null;\n }\n }\n $reportlist = array();\n foreach ($reportcaps as $name => $capability){\n if (empty($capability)){\n $capability = 'mod/ipal/quiz:viewreports';\n }\n if (has_capability($capability, $context)){\n $reportlist[] = $name;\n }\n }\n return $reportlist;\n}", "function woocommerce_admin_reports( $reports ) {\n $reports[ 'customers' ][ 'reports' ][ 'customer-serial-numbers' ] = array(\n 'title' => __( 'Customer Serial Numbers', 'serial-numbers' ),\n 'description' => '',\n 'hide_title' => true,\n 'callback' => array( 'WC_Admin_Reports', 'get_report' )\n );\n $reports[ 'orders' ][ 'reports' ][ 'product-serial-numbers' ] = array(\n 'title' => __( 'Product Serial Numbers', 'serial-numbers' ),\n 'description' => '',\n 'hide_title' => true,\n 'callback' => array( 'WC_Admin_Reports', 'get_report' )\n );\n $reports[ 'stock' ][ 'reports' ][ 'serial-numbers' ] = array(\n 'title' => __( 'Serial Numbers', 'serial-numbers' ),\n 'description' => '',\n 'hide_title' => true,\n 'callback' => array( 'WC_Admin_Reports', 'get_report' )\n );\n return $reports;\n }", "public function get_reporte_polizas()\n {\n\t\tif($this->input->post('ci_rif_ajaxreporte'))\n\t\t{\n\t\t\t$this->db->like('ci_rif', $this->input->post('ci_rif_ajaxreporte', TRUE));\n\t\t}\n\t\tif($this->input->post('nombres_ajaxreporte'))\n\t\t{\n\t\t\t$this->db->like('nombres', $this->input->post('nombres_ajaxreporte', TRUE));\n\t\t}\n\t\tif($this->input->post('apellidos_ajaxreporte'))\n\t\t{\n\t\t\t$this->db->like('apellidos', $this->input->post('apellidos_ajaxreporte', TRUE));\n\t\t}\n\t\tif($this->input->post('fecha_corte_ajaxreporte'))\n\t\t{\n\t\t\t$this->db->like('fecha_corte', $this->input->post('fecha_corte_ajaxreporte', TRUE));\n\t\t}\n\t\tif($this->input->post('tipo_poliza_ajaxreporte'))\n\t\t{\n\t\t\t$this->db->like('tipo_poliza', $this->input->post('tipo_poliza_ajaxreporte', TRUE));\n\t\t}\n\t\t\n\t\t\n\t\t$this->db->from(\"poliza_comprada\");\n\n\t\t$query = $this->db->get();\n\t\treturn $query->result();\n }", "public function index()\n {\n //\n \n return view('reports.reportlist',['title'=>'Report List','menu'=>'']);\n }", "abstract public function grabReportList( $quantity );", "public function reports(){\n $reports = DB::table('reports')->paginate(25);\n $suggestions = DB::table('category_suggestion')->paginate(25);\n $categories = DB::table('categories')->paginate(25);\n return view('admin.reports')->with('reports', $reports)\n ->with('suggestions', $suggestions)\n ->with('categories', $categories);\n }", "public function getReportContent() {\n // Get content\n $slugSql = $this->slug ? 'slug = ?' : '1';\n $sql = \"\n\t\tSELECT *\n\t\tFROM VContent\n\t\tWHERE\n\t\ttype = 'report' AND\n\t\t$slugSql\n\t\tORDER BY id ASC;\";\n $res = $this->getContent($sql, array($this->slug));\n foreach ($res as $value) {\n $value->data = $this->textfilter->doFilter($value->data, \"{$value->filter},purify,typography\");\n }\n $reportcontent = $this->buildHTML($res);\n return $reportcontent;\n }", "public function getListadoEspeciesUbicacion($especies_ids,$reportado)\n {\n $especies = Array();\n $total = 0;\n\n foreach ($especies_ids as $especie) {\n\n if($especie->catalogo==true){\n\n $datos = $this->especieDatos($especie, null, false);\n array_push($especies, $datos);\n $total++;\n }\n }\n $especies = collect($especies)->sortBy('nombre');\n\n $i=1;\n $contenido=\"<h3>Número de <b>Especies</b> reportadas para \".$reportado.\": <b>\".$total.\"</b></h3>\";\n $head=\"<thead><tr><th style='text-align:center; width: 5%'>#</th><th style='padding-left: 10px;'>Nombre de la especie</th></tr></thead>\";\n $body=\"\";\n foreach ($especies as $especie) {\n $sombra=\"\";\n if ($i % 2 == 0) $sombra=\"class='sombra'\";\n $body.=\"<tr \".$sombra.\"><td style='text-align:center;'>\".$i.\"</td><td><h3><em>\".$especie['nombre'].\"</em> <span class='mutted'>\".$especie['autor'].\"</span></h3></td></tr>\";\n $i++;\n }\n $contenido .= \"<table class='listados'>\".$head.\"<tbody>\".$body.\"</tbody></table>\";\n\n return $contenido;\n }", "public function index()\n {\n $datos['reportes'] = Reporte::paginate(5);\n return view('reporte/index', $datos);\n }", "public function listAllCCO( Request $request ) \n {\n\n $reportes = $this->reportaDao->listAll();\n \n $arregloReporta = array();\n foreach( $reportes as $indice => $reporta ){\n\n $arreglo = array( \n \"id\" => $reporta->getId(), \n \"etiqueta\" => $reporta->getEtiqueta()\n );\n $arregloReporta[] = $arreglo;\n }\n \n return response( $arregloReporta , 200)->header('Content-Type', 'application/json'); \n \n\n \n}", "abstract public function buildReport();", "public static function getReports()\n {\n return ReportServices::getReports();\n }", "function get_list()\n\t{\n\t\t$type = $this->uri->segment(3);\n\t\t$key = $this->uri->segment(4);\n\t\t$data[\"student_report\"] = STUDENT_REPORT;\n\n\t\tif($type && $key){\n\t\t\t$data[\"report_key\"] = $key;\n\t\t\t$data[\"report_type\"] = $type;\n\t\t\tswitch($type){\n\t\t\t\tcase \"student\":\n\t\t\t\t\t$this->load->model(\"student_model\",\"student\");\n\t\t\t\t\t$person = $this->student->get($key,\"stuFirst,stuLast,stuNickname,student.*,(`baseGrade`+\" . get_current_year() . \"-`baseYear`) as stuGrade\");\n\t\t\t\t\t$title = sprintf(\"for %s\" , format_name($person->stuFirst,$person->stuLast, $person->stuNickname));\n\t\t\t\t\t$data[\"kStudent\"] = $key;\n\n\t\t\t\t\t//$data[\"target\"] = \"report/\" . $type . \"_list\";\n\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"teacher\":\n\t\t\t\t\t$this->load->model(\"teacher_model\",\"teacher\");\n\t\t\t\t\t$person = $this->teacher->get($key,\"teachFirst,teachLast,dbRole,isAdvisor,gradeStart,gradeEnd,kTeach\");\n\t\t\t\t\t$title = sprintf(\"by %s %s\", $person->teachFirst,$person->teachLast);\n\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"advisor\":\n\t\t\t\t\t$this->load->model(\"teacher_model\",\"teacher\");\n\t\t\t\t\t$person = $this->teacher->get($key,\"teachFirst as advisorFirst,teachLast as advisorLast,dbRole,isAdvisor,gradeStart,gradeEnd,kTeach\");\n\t\t\t\t\t$title = sprintf(\"to %s %s\",$person->advisorFirst,$person->advisorLast);\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\t$options = array();\n\t\t\tif($this->input->get(\"date_start\") && $this->input->get(\"date_end\")){\n\t\t\t\t$date_start = $this->input->get(\"date_start\");\n\t\t\t\t$date_end = $this->input->get(\"date_end\");\n\t\t\t\t$options[\"date_range\"][\"date_start\"] = $date_start;\n\t\t\t\t$options[\"date_range\"][\"date_end\"] = $date_end;\n\n\t\t\t\t//$this->session->set_userdata(\"date_start\",$date_start);\n\t\t\t\t//$this->session->set_userdata(\"date_end\",$date_end);\n\t\t\t\tbake_cookie(\"date_start\", $date_start);\n\t\t\t\tbake_cookie(\"date_end\", $date_end);\n\t\t\t}\n\n\t\t\tif($this->input->get(\"category\")){\n\t\t\t\t$options[\"category\"] = $this->input->get(\"category\");\n\t\t\t}\n\n\t\t\t$data[\"options\"] = $options;\n\t\t\t$data[\"target\"] = \"report/list\";\n\t\t\t$data[\"person\"] = $person;\n\n\t\t\t$data[\"reports\"] = $this->report->get_list($type,$key,$options);\n\t\t\t$data[\"type\"] = $type;\n\t\t\t$data[\"title\"] = sprintf(\"%ss Submitted %s\", $data[\"student_report\"], $title);\n\t\t\t$this->load->view(\"page/index\",$data);\n\n\n\t\t}\n\t}", "public function Comissions_report_list() {\n\n theme('Comissions_report_list');\n }", "function uploadedreportlist(){\r\n $select = \"SELECT * FROM reports ORDER BY date_published DESC\";\r\n global $pdo;\r\n $res = $pdo->query($select);\r\n return $res->fetchAll(PDO::FETCH_ASSOC);\r\n }", "public function getTareas_reporte2($lista_solictudes,$fecha_mes_contratos)\n{\n\t$this->Solicitudes();\n\t$obj=new Conn();\n\t$sql=\"select ta.idso as idso,ta.idtareas as tarea,usuarios.name as tecnico_tarea,ta.tiempo_efectivo as tiempo_efectivo,ta.valor_facturar as tarea_valor_facturar, ta.tiempo_facturar as tarea_tiempo_facturar,TIMESTAMPDIFF (MINUTE, Timestamp\n\t\t(ta.fecha_inicio, ta.hora_inicio ) ,Timestamp(ta.fecha_inicio,ta.hora_fin)) as tiempo_real,ca.descripcion as categoria,se.Sede as sede,ta.fecha_inicio as fecha_inicio,ta.hora_inicio as hora_inicio,ta.hora_fin as hora_fin,ta.observaciones as detalles from tbltareas ta inner join tblcategoria ca on ta.idcategoria=ca.categoriaid\n\tinner join sec_users usuarios on usuarios.login=ta.propietario\n\tinner join tblsolicitudes so on so.id = ta.idso\n\tinner join tblfecha_contratos fechac on fechac.idcontra = so.idcontra\n\tinner join tblsede se on se.id=ta.idsitio \n\twhere ta.idso in($lista_solictudes) and date_format(ta.fecha_inicio,'%Y-%m') = date_format('$fecha_mes_contratos','%Y-%m')\n\tgroup by ta.idtareas\";\n\t$this->tareas_reporte=$obj->megaShot($sql);\n\t$obj=\"\";\n\treturn $this->tareas_reporte;\n}", "public function all() {\n $trackings = [];\n foreach (glob('./.time-tracking/report-*') as $report):\n $tracking_id = str_replace('report-', '', \\basename($report));\n $tracking_id = str_replace('.json', '', $tracking_id);\n \n $tracking = new TrackingEntity();\n $tracking->id = $tracking_id;\n \n $report = new Report($tracking);\n $tracking = $report->read($report->file);\n // Informations\n $trackings[] = $tracking->getInformations();\n endforeach;\n\n // Order by date\n usort($trackings, function($a, $b) {\n $ad = strtotime($a['date']);\n $bd = strtotime($b['date']);\n if ($ad == $bd): return 0; endif;\n return $ad < $bd ? -1 : 1;\n });\n \n return $trackings;\n }", "public function getPostReport()\n {\n return post_report::all();\n }", "public function makeReport()\n {\n }", "public function index()\n {\n return JournalEntry::currentReport()->orderByDesc('created_at')->get();\n }", "function getListOfRecords(){\n // the orders will be display and the receipts from there \n \n $element = new Order();\n \n $receipts_filter_orders = cisess(\"receipts_filter_orders\");\n \n if ($receipts_filter_orders===FALSE){\n $receipts_filter_orders = \"Abierta\"; // default to abiertas\n }\n \n if (!empty($receipts_filter_orders))\n {\n $element->where(\"status\",$receipts_filter_orders);\n }\n \n \n $element->order_by(\"id\",\"desc\");\n \n $all = $element->get()->all;\n //echo $element->check_last_query();\n ///die();\n $table = $this->entable($all);\n \n return $table;\n \n \n }", "public function ReportesHoy()\r\n {\r\n $objetoBD = new Conexion();\r\n $objetoBD->conectar();\r\n $mysqli = $objetoBD->cadenaconexion();\r\n $consulta = \"SELECT COUNT(rep_id) AS Reportes from reporte where rep_fecha=CURDATE()\";\r\n $resultado = $mysqli->query($consulta);\r\n return $resultado;\r\n }", "public function ReportesHoy()\r\n {\r\n $objetoBD = new Conexion();\r\n $objetoBD->conectar();\r\n $mysqli = $objetoBD->cadenaconexion();\r\n $consulta = \"SELECT COUNT(rep_id) AS Reportes from reporte where rep_fecha=CURDATE()\";\r\n $resultado = $mysqli->query($consulta);\r\n return $resultado;\r\n }", "public static function exportGiudeReport()\n {\n /**\n * TODO\n */\n }", "public function buscarReporte($clNumReporte)\n {\n $sentencia = \"SELECT * from tsreportebocadetubo rp join tsimgbocadetubo using(id) WHERE rp.clNumReporte = :clNumReporte\";\n try {\n $stm = $this->db->prepare($sentencia);\n $stm->bindValue(':clNumReporte', $clNumReporte);\n $stm->execute();\n $registros = $stm->fetchAll(PDO::FETCH_OBJ);\n\n return $registros;\n } catch (Exception $e) {\n echo \"$e->getMessage()\";\n }\n }", "public static function getPrints() {\n \n $con = new _Conexao();\n \n if( !empty(\\Auth::user()->USUARIO) ) {\n \n $codigo = Auth::user()->CODIGO; \n\n $sql = \"SELECT I.ID, I.DESCRICAO, I.CODIGO,iif( coalesce(u.impessora_id,0) = I.id, 1,0 ) as FLAG FROM TBIMPRESSORAS I, tbusuario u where u.codigo = \" . $codigo;\n\n return $con->query($sql);\n \n }else{\n \n return [];\n \n }\n \n \n\t\t\n\t}", "public function reporteServiciosPDF(){\n $datos=TablaSimulacion::all();\n $serv = Servicio::all();\n $servicios=[];\n $gananciaServicio=0;\n $indice = 0;\n foreach ($serv as $ser) {\n $count = 0;\n foreach ($datos as $dato) {\n if (strpos($dato->servicios,$ser->servicio) !== false ) {\n $count++;\n }\n }\n $gananciaServicio=$count*$ser->costo;\n $servicios[$indice] = [$ser->servicio,$count,$ser->costo,$gananciaServicio];\n $indice++;\n }\n $pdf=PDF::loadView('servicio/reporteServicioPdf',compact('servicios'));\n return $pdf->stream();\n }", "function GetAllReportTypes()\n {\n $reportTypeModel = new ReportTypeModel();\n return $reportTypeModel->GetAllReportTypes();\n }", "public function index()\n {\n $inc_reports = Report::paginate(15);\n return view('report.index')->with('inc_reports', $inc_reports);\n }", "function createReportAllProducts($dataMatrix){\n $this->AliasNbPages();\n $this->AddPage();\n\n // Título del reporte\n $this->SetFont($this->font,'B',$this->fontSize - 1);\n $this->Cell(0,$this->fontSize / 2,'Reporte de todos los productos',1,0,'C');\n $this->Ln();\n $this->Ln(3);\n\n //Variables\n $this->font = 'Arial';\n $this->fontSize = 8;\n\n $this->SetFont($this->font,'B',$this->fontSize);\n\n //Body Format\n $header = array( \"ID Inventario\",\n \"No. Serial\",\n \"Color\",\n \"Marca\",\n \"Modelo\",\n \"ID Area\",\n \"ID Ubicacion\",\n \"Estado\"\n );\n\n\n $this->printMatrix($header,$dataMatrix);\n $this->putWaterMarkIMG();\n $this->Output();\n }", "public function Reporte(){\r\n\t\t$roles=new RolesModel();\r\n\t\t//Conseguimos todos los usuarios\r\n\t\t\r\n\t\r\n\t\r\n\t\tsession_start();\r\n\t\r\n\t\r\n\t\tif (isset( $_SESSION['usuario']) )\r\n\t\t{\r\n\t\t\t$resultRep = $roles->getByPDF(\"id_rol, nombre_rol\", \" nombre_rol != '' \");\r\n\t\t\t$this->report(\"Roles\",array(\t\"resultRep\"=>$resultRep));\r\n\t\r\n\t\t}\r\n\t\t\t\t\t\r\n\t\r\n\t}", "abstract protected function get_reports( $args = array() );", "public function mostrarReporte(Request $request)\n\t{\n\t\t$semana = $request->input(\"semana\");\n\t\t$year = $request->input(\"year\"); //en ingles para no sonar obsceno\n\n\t\t//Obtener la fecha en la que inicia y termina la semana seleccionada\n\t\t$fecha1 = new DateTime();\n\t\t$fecha1->setISODate($year,$semana,1);\n\t\t$fecha1 = $fecha1->format('Y-m-d');\n\n\t\t$fecha2 = new DateTime();\n\t\t$fecha2->setISODate($year,$semana,7);\n\t\t$fecha2 = $fecha2->format('Y-m-d');\n\n\t\t//declarar el query en formato SQL para cada uno de los parametros, como un string\n\t\t//el string siguiente seria \"fecha BETWEEN CAST('{fecha1}' AS DATE) AND CAST('{fecha2}' AS DATE)\"\n\t\t$queryFechas = \"fecha BETWEEN CAST('\" . $fecha1 . \"' AS DATE) AND CAST('\" . $fecha2 . \"' AS DATE)\";\n\n\t\t//crear el query para el numero de empleado y designar la etiqueta del filtro\n\t\tif($request->input('empleado') == 'null') $queryEmpleado = \"\"; //string vacio si no se define un empleado\n\t\telse {\n\t\t\t$empleado = EmpleadoCt::find($request->input('empleado'));\n\t\t\t$queryEmpleado = \" AND idEmpleado = '\" . $request->input('empleado') . \"'\";\n\t\t}\n\n\t\t$query = $queryFechas . $queryEmpleado;\n\n\t\t$checadas = ChecadaCt::whereRaw($query)->get();\n\n\t\t$empleados = array();\n\n\t\t$reporte = [\n\t\t'empleados' => array(),\n\t\t'dias' => array(),\n\t\t'total_dias' => 0,\n\t\t'total_horas' => 0,\n\t\t'total_horas_extra' => 0,\n\t\t'total_prestamos' => 0,\n\t\t'total_descuentos' => 0\n\t\t];\n\n\t\tfor($i = 1; $i <= 7; $i++){ //obtener el dia del mes en el que cae cada dia de la semana\n\t\t\t$fecha = new DateTime();\n\t\t\t$fecha->setISODate($year,$semana,$i);\n\t\t\t$reporte['dias'][$i]['dia'] = $fecha->format('d');\n\t\t\t$reporte['dias'][$i]['personas'] = 0;\n\t\t}\n\n\t\tforeach($checadas as $checada){\n\t\t\t$empleado = EmpleadoCt::where('idEmpleadoCt', $checada->idEmpleadoCt)->first(); //obtener al empleado\n\t\t\tarray_push($empleados, $empleado);\n\t\t}\n\n\t\t$empleados = array_unique($empleados); //eliminar empleados repetidos\n\n\t\tforeach($empleados as $empleado){\n\t\t\t$reporte['empleados'][$empleado->idEmpleadoCt] = [\n\t\t\t'ap_paterno' => $empleado->ap_paterno,\n\t\t\t'ap_materno' => $empleado->ap_materno,\n\t\t\t'nombre' => $empleado->nombres,\n\t\t\t'area' => AreaCt::where('idAreaCt', $empleado->area)->first()->nombre,\n\t\t\t'no_cuenta' => $empleado->no_cuenta,\n\t\t\t'checadas' => array(),\n\t\t\t'horas_extra' => 0,\n\t\t\t'horas_ordinarias' => 0,\n\t\t\t'descuentos' => 0,\n\t\t\t'prestamos' => 0];\n\n\t\t\t//obtener todas las checadas correspondientes al empleado\n\t\t\tfor($i = 1; $i <= 7; $i++){ //agregar todas las checadas de la semana\n\t\t\t\t$fecha = new DateTime();\n\t\t\t\t$fecha->setISODate($year,$semana,$i);\n\t\t\t\t$fecha = $fecha->format('Y-m-d');\n\t\t\t\t$checadasDelDia = ChecadaCt::where('fecha',$fecha)->where('idEmpleadoCt',$empleado->idEmpleadoCt)->get();\n\t\t\t\t//generar nueva checada que no se guarda en BD pero se envia a la vista\n\t\t\t\t$checadaDelDia = new ChecadaCt([\n\t\t\t\t\t'idEmpleadoCt' => $empleado->idEmpleadoCt,\n\t\t\t\t\t'fecha' => $fecha,]);\n\n\t\t\t\t//obtener los descuentos y prestamos de cada empleado\n\t\t\t\t$descuentos = DescuentoCt::where('empleado',$empleado->idEmpleadoCt)->where('fecha',$fecha)->get();\n\t\t\t\tforeach($descuentos as $descuento){\n\t\t\t\t\t$reporte['empleados'][$empleado->idEmpleadoCt]['descuentos'] += $descuento->monto;\n\t\t\t\t\t$reporte['total_descuentos'] += $descuento->monto;\n\t\t\t\t}\n\n\t\t\t\t$prestamos = Prestamo::where('empleado',$empleado->idEmpleadoCt)->where('fecha',$fecha)->get();\n\t\t\t\tforeach($prestamos as $prestamo){\n\t\t\t\t\t$reporte['empleados'][$empleado->idEmpleadoCt]['prestamos'] += $prestamo->monto;\n\t\t\t\t\t$reporte['total_prestamos'] += $prestamo->monto;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t//sumarle las horas de todas las checadas de ese dia\n\t\t\t\tforeach($checadasDelDia as $ch){\n\t\t\t\t\t$checadaDelDia->hora_entrada += $ch->hora_entrada;\n\t\t\t\t\t$checadaDelDia->hora_salida += $ch->hora_salida;\n\t\t\t\t\t$checadaDelDia->horas_ordinarias += $ch->horas_ordinarias;\n\t\t\t\t\t$checadaDelDia->horas_extra += $ch->horas_extra;\n\t\t\t\t}\n\n\t\t\t\t//enviar un valor nulo si no nhay checada en ese dia\n\t\t\t\tif(ChecadaCt::where('fecha',$fecha)->where('idEmpleadoCt',$empleado->idEmpleadoCt)->first() == null){\n\t\t\t\t\t$checadaDelDia = null;\n\t\t\t\t}\n\n\t\t\t\t$reporte['empleados'][$empleado->idEmpleadoCt]['checadas'][$i] = $checadaDelDia;\n\n\t\t\t\t//sumar las horas trabajadas por cada checada\n\t\t\t\tif($checadaDelDia != null){\n\t\t\t\t\t$reporte['empleados'][$empleado->idEmpleadoCt]['horas_extra'] += $checadaDelDia->horas_extra;\n\t\t\t\t\t$reporte['empleados'][$empleado->idEmpleadoCt]['horas_ordinarias'] += $checadaDelDia->horas_ordinarias;\n\t\t\t\t\t$reporte['dias'][$i]['personas'] += 1;\n\t\t\t\t\t$reporte['total_horas'] += $checadaDelDia->horas_ordinarias;\n\t\t\t\t\t$reporte['total_horas_extra'] =+ $checadaDelDia->horas_extra;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t$empleados = EmpleadoCt::all();\n\t\t$parametros = ['empleados' => $empleados, \"reporte\" => $reporte, 'semana' => $request->input('semana'), 'fecha1' => $fecha1, 'fecha2' => $fecha2];\n\t\treturn view('empleados_ct/reporte_ct')->with('parametros',$parametros);\n\t}", "public function getReport() {\r\n\t\t\t$body = false;\r\n if ( isset($this->parts[1]) && $this->getPartContentType($this->parts[1]) === 'multipart/report' ) {\r\n $body = array();\r\n foreach ( $this->parts as $id => $part ) {\r\n if ( preg_match('/^1\\.[0-9]+$/', $id) ) {\r\n\t\t\t\t\t\t$headers = $this->getPartHeaders($part);\r\n\r\n\t\t\t\t\t\t$decoded_body = $this->decode($this->getPartBody($part), array_key_exists('content-transfer-encoding', $headers) ? $this->pickOne($headers['content-transfer-encoding']) : '');\r\n\t\t\t\t\t\tif ( $decoded_body === false ) {\r\n\t\t\t\t\t\t\tcontinue;\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t$content_type = $this->getPartContentType($part);\r\n\t\t\t\t\t\t$prefix = '';\r\n\t\t\t\t\t\tif ( $content_type !== 'text/plain' ) {\r\n\t\t\t\t\t\t\t$prefix = \"----------------------------------------------\\n\";\r\n\t\t\t\t\t\t\t$prefix .= ( $content_type . \"\\n\" );\r\n\t\t\t\t\t\t\t$prefix .= \"----------------------------------------------\\n\";\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t$body[] =array('body' => $prefix.$decoded_body,\r\n\t\t\t\t\t\t'encoding' => isset($part['content-charset']) ? $part['content-charset'] : '');\r\n }\r\n }\r\n }\r\n return $body;\r\n\t}", "public static function getReports($currentPage = 1)\n {\n // Set the output array.\n $reports = [];\n\n // First part. Get the reports in the BOT_OUTPUT_PATH environment variable.\n foreach (scandir(getenv(\"BOT_OUTPUT_PATH\")) as $file) {\n if ($file === \".\" || $file === \"..\") {\n // Skip directories \".\" and \"..\"\n continue;\n }\n\n if (preg_match(\"/^\\..*/\", $file)) {\n // Skip dotfiles\n continue;\n }\n\n // Extract the report date from the filename.\n $reportDate = pathinfo($file, PATHINFO_FILENAME);\n\n // Push it to the output array.\n array_push($reports, $reportDate);\n }\n\n // Second part. Sort the reports according to the date.\n usort($reports, function ($a, $b) {\n return strtotime($a) - strtotime($b);\n });\n\n // Third part. Add pagination to the reports, showing 10 reports by page (by default).\n $offset = ($currentPage - 1) * self::$perPage;\n $totalReports = sizeof($reports);\n $totalPages = ceil($totalReports / self::$perPage);\n $reports = array_slice($reports, $offset, self::$perPage);\n\n return [\n \"reports\" => $reports,\n \"pagination\" => [\n \"currentPage\" => $currentPage,\n \"totalReports\" => $totalReports,\n \"totalPages\" => $totalPages,\n ],\n ];\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}", "public function index()\n {\n $data = $this->Invoice_model->where(array('piutang >'=>0))->order_by('no_invoice','DESC')->find_all();\n $cabang = $this->Cabang_model->order_by('kdcab','ASC')->find_all();\n $this->template->title('Report Piutang');\n $this->template->set('cabang', $cabang);\n $this->template->set('results', $data);\n $this->template->render('list');\n }", "public function actionIndex($report=null)\n {\n $searchModel = new ReestrSearch();\n $dataProvider = $searchModel->search(Yii::$app->request->queryParams);\n\t\n if ($report!==null)\n {\n \tob_end_clean();\n \t\n \theader('Content-Type: application/vnd.ms-excel');\n \theader('Content-Disposition: attachment;filename=\"DM_'.date('d.m.Y').'.xls\"');\n \theader('Cache-Control: max-age=0');\n \techo $this->renderPartial('index', [\n\t 'searchModel' => $searchModel,\n\t 'dataProvider' => $dataProvider,\n\t ]);\n \t\n \t\\Yii::$app->end();\n \t\n } \n \n return $this->render('index', [\n 'searchModel' => $searchModel,\n 'dataProvider' => $dataProvider,\n ]);\n }", "private function showAllReportData($reportType){\n\n \t$sensorData = array();\n \t$reportList = array();\n \t$data = json_encode(0);\n \t$provinces = DB::table('tbl_provinces')->get();\n \t$landslides = DB::table('tbl_landslide')->get();\n \t$floods = DB::table('tbl_flood')->get();\n \t$roadNetworks = DB::table('tbl_roadnetworks')->get();\n\n \tswitch ($reportType) {\n\n \t\tcase '2':\n \t\t\t\n \t\t\tforeach ($landslides as $landslide) {\n\n \t\t\t\t$tempStr = strip_tags($landslide->description);\n\t\t\t\t\t$tempProvince = \"\";\n\n\t\t\t\t\tforeach ($provinces as $province) {\n\t\t\t\t\t\t\n\t\t\t\t\t\tif ($landslide->province_id == $province->id){\n\n\t\t\t\t\t\t\t$tempProvince = $province->name;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n \t\t\t\t$reportList[] = array(\"date_time\" => $landslide->date,\n \t\t\t\t\t\t\t\t\t \"province\" => $tempProvince,\n \t\t\t\t\t\t\t\t\t \"location\" => $landslide->location,\n \t\t\t\t\t\t\t\t\t \"description\" => $tempStr);\n\n\t\t\t\t}\n\n \t\t\tbreak;\n\n \t\tcase '3':\n \t\t\t\n \t\t\tforeach ($floods as $flood) {\n\n \t\t\t\t$tempStr = strip_tags($flood->description);\n \t\t\t\t$tempProvince = \"\";\n\n\t\t\t\t\tforeach ($provinces as $province) {\n\t\t\t\t\t\t\n\t\t\t\t\t\tif ($flood->province_id == $province->id){\n\n\t\t\t\t\t\t\t$tempProvince = $province->name;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\n\t\t\t\t\t$reportList[] = array(\"date_time\" => $flood->date,\n\t\t\t\t\t\t\t\t\t\t \"province\" => $tempProvince,\n \t\t\t\t\t\t\t\t\t \"location\" => $flood->location,\n \t\t\t\t\t\t\t\t\t \"description\" => $tempStr);\n\t\t\t\n\t\t\t\t}\n\n \t\t\tbreak;\n\n \t\tcase '4':\n \t\t\t\n \t\t\tforeach ($roadNetworks as $roadNetwork) {\n\n \t\t\t\t$tempStr = strip_tags($roadNetwork->description);\n\n\t\t\t\t\t$reportList[] = array(\"date_time\" => $roadNetwork->date,\n \t\t\t\t\t\t\t\t\t \"location\" => $roadNetwork->location,\n \t\t\t\t\t\t\t\t\t \"status\" => $roadNetwork->status,\n \t\t\t\t\t\t\t\t\t \"description\" => $tempStr);\n\t\t\t\n\t\t\t\t}\n\n \t\t\tbreak;\n \t\t\n \t}\n \t\n \t$data = json_encode($reportList);\n\t\treturn $data;\n\n }", "function mostrarReporte($reporte) {\n $i=1;\n ?>\n <hr>\n <?\n $this->encabezadoReporte();\n $this->reporteNoExito($reporte,$i);\n $this->reporteExito($reporte,$i);\n ?>\n <hr>\n <?\n }", "function report()\n {\n if ($this->acl->otentikasi2($this->title) == TRUE){\n $cur = $this->input->post('ccurrency');\n $start = $this->input->post('start');\n $end = $this->input->post('end');\n\n $data['currency'] = $cur;\n $data['start'] = tglin($start);\n $data['end'] = tglin($end);\n $data['rundate'] = tglin(date('Y-m-d'));\n $data['log'] = $this->decodedd->log;\n\n // Property Details\n $data['company'] = $this->properti['name'];\n\n $result = null;\n foreach ($this->model->report($cur,$start,$end)->result() as $res) {\n $result[] = array (\"id\"=>$res->id, \"no\"=>$res->no, \"notes\"=>$res->notes, \"dates\"=>tglin($res->dates), \n \"currency\"=>$res->currency, \"from\"=>$this->get_acc($res->from), \"to\"=>$this->get_acc($res->to), \n \"posted\"=>$res->approved, \"amount\"=>$res->amount);\n }\n $data['result'] = $result; $this->output = $data;\n }else { $this->reject_token(); }\n $this->response('content');\n }", "public function getReports(Request $request)\n\t\t{\n\n\t\t\t$reportContent = $this->service->getReports($request->input());\n\n\t\t\tif ($reportContent) {\n\t\t\t\t$filename = 'report-' . time() . '.csv';\n\n\t\t\t\t$arrayList = $reportContent['report'];\n\n\t\t\t\ttouch($filename);\n\t\t\t\tchmod($filename, 0775);\n\n\t\t\t\t$fp = fopen($filename, 'w');\n\n\t\t\t\t/**\n\t\t\t\t * Write custom heading in the excel\n\t\t\t\t */\n\t\t\t\tfputcsv($fp, $reportContent['columns']);\n\n\t\t\t\tforeach ($arrayList as $line) {\n\n\n\t\t\t\t\t/**\n\t\t\t\t\t * Key comparison if key matches then write in excel else remove that particular key & value from the list\n\t\t\t\t\t */\n\n\t\t\t\t\tforeach ($line as $key => $columnset) {\n\t\t\t\t\t\tif (!in_array($key, array_keys($reportContent['columns']))) {\n\t\t\t\t\t\t\tunset($line[ $key ]);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tfputcsv($fp, $line);\n\n\t\t\t\t}\n\n\t\t\t\tfclose($fp);\n\n\n\t\t\t}\n\t\t\telse {\n\t\t\t\treturn $this->respondWithError('no file name provided');\n\t\t\t}\n\n\t\t\treturn $this->respond(['data' => 'created file successfully', 'filename' => $filename]);\n\n\t\t}", "public function run()\n {\n $data_check = Report::all()->first();\n if ($data_check != null) {\n Schema::disableForeignKeyConstraints();\n Report::query()->truncate();\n Schema::enableForeignKeyConstraints();\n }\n $reports = array(\n array(\n 'FullName' => 'Nguyễn Đức Trung',\n 'PhoneNumber' => '0583973384',\n 'Address' => 'Ở khu số 2 ! Ngõ 157 Đường Mai Quốc Việt',\n 'Thumbnails' => \"\",\n 'Content' => \"Có 1 ổ mèo con bị thương \",\n 'Status' => 0,\n 'created_at' => \\Carbon\\Carbon::now()->addDays(rand(-30, 30)),\n 'updated_at' => \\Carbon\\Carbon::now(),\n ),\n array(\n 'FullName' => 'Nguyễn Đức Trung',\n 'PhoneNumber' => '0583973384',\n 'Address' => 'Ở khu số 11 ! Ngõ 33/22/1 Đường Mai Quốc Việt',\n 'Thumbnails' => \"\",\n 'Content' => \"Ở khu số 5 ! Ngõ 159 Đường Mai Quốc Việt\",\n 'Status' => 1,\n 'created_at' => \\Carbon\\Carbon::now()->addDays(rand(-30, 30)),\n 'updated_at' => \\Carbon\\Carbon::now(),\n ),\n array(\n 'FullName' => 'Nguyễn Đức Trung',\n 'PhoneNumber' => '0583973384',\n 'Address' => 'Ở khu số 2 ! Ngõ 90 Đường Mai Quốc Việt',\n 'Thumbnails' => \"\",\n 'Content' => \"Ở khu số 10 ! Ngõ 157 Đường Mai Quốc Việt\",\n 'Status' => 2,\n 'created_at' => \\Carbon\\Carbon::now()->addDays(rand(-30, 30)),\n 'updated_at' => \\Carbon\\Carbon::now(),\n ),\n array(\n 'FullName' => 'Nguyễn Đức Trung',\n 'PhoneNumber' => '0583973384',\n 'Address' => 'Ở khu số 2 ! Ngõ 90 Đường Mai Quốc Việt',\n 'Thumbnails' => \"\",\n 'Content' => \"Ở khu số 10 ! Ngõ 157 Đường Mai Quốc Việt\",\n 'Status' => 3,\n 'created_at' => \\Carbon\\Carbon::now()->addDays(rand(-30, 30)),\n 'updated_at' => \\Carbon\\Carbon::now(),\n ),\n array(\n 'FullName' => 'Nguyễn Đức Trung',\n 'PhoneNumber' => '0583973384',\n 'Address' => 'Ở khu số 2 ! Ngõ 157 Đường Mai Quốc Việt',\n 'Thumbnails' => \"#\",\n 'Content' => \"Có 1 ổ mèo con bị thương \",\n 'Status' => 0,\n 'created_at' => \\Carbon\\Carbon::now()->addDays(rand(-30, 30)),\n 'updated_at' => \\Carbon\\Carbon::now(),\n ),\n array(\n 'FullName' => 'Nguyễn Đức Trung',\n 'PhoneNumber' => '0583973384',\n 'Address' => 'Ở khu số 11 ! Ngõ 33/22/1 Đường Mai Quốc Việt',\n 'Thumbnails' => \"\",\n 'Content' => \"Ở khu số 5 ! Ngõ 159 Đường Mai Quốc Việt\",\n 'Status' => 1,\n 'created_at' => \\Carbon\\Carbon::now()->addDays(rand(-30, 30)),\n 'updated_at' => \\Carbon\\Carbon::now(),\n ),\n array(\n 'FullName' => 'Nguyễn Đức Trung',\n 'PhoneNumber' => '0583973384',\n 'Address' => 'Ở khu số 2 ! Ngõ 90 Đường Mai Quốc Việt',\n 'Thumbnails' => \"\",\n 'Content' => \"Ở khu số 10 ! Ngõ 157 Đường Mai Quốc Việt\",\n 'Status' => 2,\n 'created_at' => \\Carbon\\Carbon::now()->addDays(rand(-30, 30)),\n 'updated_at' => \\Carbon\\Carbon::now(),\n ),\n array(\n 'FullName' => 'Nguyễn Đức Trung',\n 'PhoneNumber' => '0583973384',\n 'Address' => 'Ở khu số 2 ! Ngõ 90 Đường Mai Quốc Việt',\n 'Thumbnails' => \"\",\n 'Content' => \"Ở khu số 10 ! Ngõ 157 Đường Mai Quốc Việt\",\n 'Status' => 3,\n 'created_at' => \\Carbon\\Carbon::now()->addDays(rand(-30, 30)),\n 'updated_at' => \\Carbon\\Carbon::now(),\n ),\n );\n Report::insert($reports);\n }", "public function recharge_list(){\n $recharge_log_where['user_id'] = ['eq',$this->user_id];\n $p = I('p/d',1);\n $page_last = 7;\n $count = M('recharge')->where($recharge_log_where)->count();\n $withdrawals_log = M('recharge')->where($recharge_log_where)\n ->order('order_id desc')\n ->page(\"{$p},{$page_last}\")\n ->select();\n $Page = new Page($count,$page_last);\n $Page->rollPage = 2;\n $page = $Page->show(); \n $this->assign('lists',$withdrawals_log);\n $this->assign('page', $page);\n \treturn $this->fetch();\n }", "public function reportExport()\n {\n \t$report = Report::join('report_natures', 'reports.report_nature', '=', 'report_natures.id')\n ->join('residents', 'reports.submitted_by', '=', 'user_id')\n ->select('reports.*', 'residents.name_first', 'residents.name_middle', 'residents.name_last', 'report_natures.nature_name')\n ->get();\n\n \t$pdf = PDF::loadView('exporttopdf');\n\n \t$html = '<html>' . \n\t\t\t\t\t'<style>' .\n\t\t \t\t\t'table {\n\t\t\t\t\t\t border-collapse: collapse;\n\t\t\t\t\t\t align: center;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\ttable, th, td {\n\t\t\t\t\t\t\tpadding-left: 5px;\n\t\t\t\t\t\t\tpadding-right: 5px;\n\t\t\t\t\t\t border: 1px solid black;\n\t\t\t\t\t\t text-align: center;\n\t\t\t\t\t\t}' .\n 'h3 {\n text-align: center;\n }' .\n\t\t\t\t\t'</style>' .\n \t\t\t\t'<body>' .\n '<h3> Reports List </h3><br>' .\n \t\t\t\t\t'<table>' . \n \t\t\t\t\t\t'<thead>' .\n \t\t\t\t\t\t\t'<tr>' .\n \t\t\t\t\t\t\t\t'<th><b>Report Nature</b></th>' .\n \t\t\t\t\t\t\t\t'<th><b>Description</b></th>' . \n \t\t\t\t\t\t\t\t'<th><b>Location</b></th>' . \n \t\t\t\t\t\t\t\t'<th><b>Time Submitted</b></th>' .\n \t\t\t\t\t\t\t\t'<th><b>Submitted By</b></th>' .\n \t\t\t\t\t\t\t'</tr>' .\n \t\t\t\t\t\t'</thead>' .\n \t\t\t\t\t\t'<tbody>'; \n\n \tforeach ($report as $details) \n \t{ \n \t\t$html .= \t\"<tr>\" .\n \t\t\t\t\t\"<td>\" . $details->nature_name . \"</td>\" .\n \t\t\t\t\t\"<td>\" . $details->description . \"</td>\" . \n \t\t\t\t\t\"<td>\" . $details->location . \"</td>\" . \n \t\t\t\t\t\"<td>\" . $details->created_at . \"</td>\" .\n \t\t\t\t\t\"<td>\" . $details->name_first . \" \" . $details->name_middle . \" \" . $details->name_last . \"</td>\" .\n \t\t\t\t\t\"</tr>\"; \n \t} \n \t\t$html .= \t'</tbody>' . \n \t\t\t\t\t\t'</table>' .\n \t\t\t\t\t\t\t'</body>' . \n \t\t\t\t\t\t\t\t'</html>'; \n\n \t\t$pdf->loadHTML($html); \n\n \t\treturn $pdf->stream('Report List');\n }", "public static function get_new_comments_report() {\n\t\t$result = CommentsReportQModel::get_comments_report_new();\n\t\t// dd($result);\n\t\tforeach ($result as $comment) {\n\t\t\t$user = UsersQModel::get_user_by_id($comment->id_user);\n\t\t\t$cmd = CommentsQModel::get_comment_by_id($comment->id_comment);\n\t\t\t$comment->user_report = $user->name;\n\t\t\t$comment->user_reported = $cmd->name;\n\t\t\t$comment->comment = $cmd->content;\n\t\t\t$comment->user_image = $cmd->image;\n\t\t\t//get page name\n\t\t\tif ($comment->page == 'book') {\n\t\t\t\t$book = BooksQModel::get_book_by_id($comment->id_page);\n\t\t\t\t$comment->page_name = $book->name;\n\t\t\t} else if ($comment->page == 'character') {\n\t\t\t\t$character = CharactersQModel::get_character_by_id($comment->id_page);\n\t\t\t\t$comment->page_name = $character->name;\n\t\t\t} else if ($comment->page == 'author') {\n\t\t\t\t$author = AuthorsQModel::get_author_by_id($comment->id_page);\n\t\t\t\t$comment->page_name = $author->name;\n\t\t\t} else if ($comment->page == 'trans') {\n\t\t\t\t$trans = TransQModel::get_trans_by_id($comment->id_page);\n\t\t\t\t$comment->page_name = $trans->name;\n\t\t\t} else if ($comment->page == 'user') {\n\t\t\t\t$user = UsersQModel::get_user_by_id($comment->id_page);\n\t\t\t\t$comment->page_name = $user->name;\n\t\t\t} else if ($comment->page == 'read') {\n\t\t\t\t$chap = ChapsQModel::get_chap_by_id($comment->id_page);\n\t\t\t\t$comment->page_name = $chap->book_name;\n\t\t\t\t$comment->chap_name = $chap->name;\n\t\t\t}\n\t\t}\n\n\t\treturn $result;\n\t}", "function runReport (){\n\t\tif(!empty($this->params['form']))\n\t\t{\n\t\t\tif($this->params['form']=='allData'){\n\t\t\t\tindex();\n\t\t\t}else {\n\t\t\t\tindex();\n\t\t\t}\n\t\t\t\t\n\t\t\t\t\n\t\t}\n\t}", "function runReport (){\n\t\tif(!empty($this->params['form']))\n\t\t{\n\t\t\tif($this->params['form']=='allData'){\n\t\t\t\tindex();\n\t\t\t}else {\n\t\t\t\tindex();\n\t\t\t}\n\t\t\t\t\n\t\t\t\t\n\t\t}\n\t}", "public function reports()\n {\n return $this->morphMany(Report::class, 'reported');\n }", "public function getDriverReportList() {\n\n $driverReportListQuery = \"select id,driver_id,vehicle_id from dlvry_trans_driver_allocation_to_vehicle where status!='Delete' and driver_id != '0'\";\n $driverReportListData = $this->db->query($driverReportListQuery);\n $driverReportListResult = $driverReportListData->result_array();\n\n foreach ($driverReportListResult as $key => $vehicleId) {\n\n $vehicleid = $vehicleId['vehicle_id'];\n $getVehicleNumQuery = \"SELECT tr_transport_name,tr_transport_type,tr_vehicle_no from `dlvry_trans_vehicle` where status!='Delete' and es_transportid='$vehicleid'\";\n $vehicleNumData = $this->db->query($getVehicleNumQuery);\n $vehicleNumResult = $vehicleNumData->result_array();\n foreach ($vehicleNumResult as $vehicle_num) {\n $driverReportListResult[$key]['vehicle_no'] = [];\n $driverReportListResult[$key]['vehicle_name'] = [];\n $driverReportListResult[$key]['vehicle_type'] = [];\n array_push($driverReportListResult[$key]['vehicle_no'], $vehicle_num['tr_vehicle_no']);\n array_push($driverReportListResult[$key]['vehicle_name'], $vehicle_num['tr_transport_name']);\n array_push($driverReportListResult[$key]['vehicle_type'], $vehicle_num['tr_transport_type']);\n }\n }\n\n foreach ($driverReportListResult as $key => $driverId) {\n\n $driverid = $driverId['driver_id'];\n $getDriverNameQuery = \"SELECT driver_name,diver_mobile,driver_license,issuing_authority,valid_date from `dlvry_trans_driver_details` where status!='Delete' and id='$driverid'\";\n $driverNameData = $this->db->query($getDriverNameQuery);\n $driverNameResult = $driverNameData->result_array();\n foreach ($driverNameResult as $driver_name) {\n $driverReportListResult[$key]['driver_name'] = [];\n $driverReportListResult[$key]['driver_mobile'] = [];\n $driverReportListResult[$key]['driver_license'] = [];\n $driverReportListResult[$key]['issuing_authority'] = [];\n $driverReportListResult[$key]['valid_date'] = [];\n array_push($driverReportListResult[$key]['driver_name'], $driver_name['driver_name']);\n array_push($driverReportListResult[$key]['driver_mobile'], $driver_name['diver_mobile']);\n array_push($driverReportListResult[$key]['driver_license'], $driver_name['driver_license']);\n array_push($driverReportListResult[$key]['issuing_authority'], $driver_name['issuing_authority']);\n array_push($driverReportListResult[$key]['valid_date'], $driver_name['valid_date']);\n }\n }\n\n return $driverReportListResult;\n }", "function consultarCitasReportes($idEspecie) {\n\t\t \n\t$query = \"SELECT reportes \n\t\t\t\t\t\tFROM colecciones_especies \n\t\t\t\t\t\tWHERE especies_id = $idEspecie\"; \t\t\t\t\t\t\t\n\t$res = ejecutarQuerySQL($query);\n\t$total = getNumFilas($res);\n\t$citas=\"<b>No hay reportes para la especie.</b>\";\n\t\n\t$citas=\"\";\t\n\tif ($total > 0 ) {\n\t\t \t$actual = getFila($res);\n\t\t\t$citas = $actual['reportes'];\n\t}\n\t\nreturn $citas;\n}", "public function ctrDescargarReporte(){\n\n\t\tif(isset($_GET[\"reporte\"])){\n\n\t\t\t$tabla = \"ventas\";\n\n\t\t\tif(isset($_GET[\"fechaInicial\"]) && isset($_GET[\"fechaFinal\"])){\n\n\t\t\t\t$ventas = ModeloVentas::mdlRangoFechasVentas($tabla, $_GET[\"fechaInicial\"], $_GET[\"fechaFinal\"]);\n\n\t\t\t}else{\n\n\t\t\t\t$item = null;\n\t\t\t\t$valor = null;\n\n\t\t\t\t$ventas = ModeloVentas::mdlMostrarVentas($tabla, $item, $valor);\n\n\t\t\t}\n\n\n\t\t\t/*=============================================\n\t\t\tCREAMOS EL ARCHIVO DE EXCEL\n\t\t\t=============================================*/\n\n\t\t\t$Name = $_GET[\"reporte\"].'.xls';\n\n\t\t\theader('Expires: 0');\n\t\t\theader('Cache-control: private');\n\t\t\theader(\"Content-type: application/vnd.ms-excel\"); // Archivo de Excel\n\t\t\theader(\"Cache-Control: cache, must-revalidate\"); \n\t\t\theader('Content-Description: File Transfer');\n\t\t\theader('Last-Modified: '.date('D, d M Y H:i:s'));\n\t\t\theader(\"Pragma: public\"); \n\t\t\theader('Content-Disposition:; filename=\"'.$Name.'\"');\n\t\t\theader(\"Content-Transfer-Encoding: binary\");\n\n\t\t\techo utf8_decode(\"<table border='0'> \n\n\t\t\t\t\t<tr> \n\t\t\t\t\t<td style='font-weight:bold; border:1px solid #eee;'>CÓDIGO</td> \n\t\t\t\t\t<td style='font-weight:bold; border:1px solid #eee;'>CLIENTE</td>\n\t\t\t\t\t<td style='font-weight:bold; border:1px solid #eee;'>VENDEDOR</td>\n\t\t\t\t\t<td style='font-weight:bold; border:1px solid #eee;'>CANTIDAD</td>\n\t\t\t\t\t<td style='font-weight:bold; border:1px solid #eee;'>PRODUCTOS</td>\n\t\t\t\t\t<td style='font-weight:bold; border:1px solid #eee;'>IMPUESTO</td>\n\t\t\t\t\t<td style='font-weight:bold; border:1px solid #eee;'>NETO</td>\t\t\n\t\t\t\t\t<td style='font-weight:bold; border:1px solid #eee;'>TOTAL</td>\t\t\n\t\t\t\t\t<td style='font-weight:bold; border:1px solid #eee;'>METODO DE PAGO</td\t\n\t\t\t\t\t<td style='font-weight:bold; border:1px solid #eee;'>FECHA</td>\t\t\n\t\t\t\t\t</tr>\");\n\n\t\t\tforeach ($ventas as $row => $item){\n\n\t\t\t\t$cliente = ControladorClientes::ctrMostrarClientes(\"id\", $item[\"id_cliente\"]);\n\t\t\t\t$vendedor = ControladorUsuarios::ctrMostrarUsuarios(\"id\", $item[\"id_vendedor\"]);\n\n\t\t\t echo utf8_decode(\"<tr>\n\t\t\t \t\t\t<td style='border:1px solid #eee;'>\".$item[\"codigo\"].\"</td> \n\t\t\t \t\t\t<td style='border:1px solid #eee;'>\".$cliente[\"nombre\"].\"</td>\n\t\t\t \t\t\t<td style='border:1px solid #eee;'>\".$vendedor[\"nombre\"].\"</td>\n\t\t\t \t\t\t<td style='border:1px solid #eee;'>\");\n\n\t\t\t \t$productos = json_decode($item[\"productos\"], true);\n\n\t\t\t \tforeach ($productos as $key => $valueProductos) {\n\t\t\t \t\t\t\n\t\t\t \t\t\techo utf8_decode($valueProductos[\"cantidad\"].\"<br>\");\n\t\t\t \t\t}\n\n\t\t\t \techo utf8_decode(\"</td><td style='border:1px solid #eee;'>\");\t\n\n\t\t \t\tforeach ($productos as $key => $valueProductos) {\n\t\t\t \t\t\t\n\t\t \t\t\techo utf8_decode($valueProductos[\"descripcion\"].\"<br>\");\n\t\t \t\t\n\t\t \t\t}\n\n\t\t \t\techo utf8_decode(\"</td>\n\t\t\t\t\t<td style='border:1px solid #eee;'>$ \".number_format($item[\"impuesto\"],2).\"</td>\n\t\t\t\t\t<td style='border:1px solid #eee;'>$ \".number_format($item[\"neto\"],2).\"</td>\t\n\t\t\t\t\t<td style='border:1px solid #eee;'>$ \".number_format($item[\"total\"],2).\"</td>\n\t\t\t\t\t<td style='border:1px solid #eee;'>\".$item[\"metodo_pago\"].\"</td>\n\t\t\t\t\t<td style='border:1px solid #eee;'>\".substr($item[\"fecha\"],0,10).\"</td>\t\t\n\t\t \t\t\t</tr>\");\n\n\n\t\t\t}\n\n\n\t\t\techo \"</table>\";\n\n\t\t}\n\n\t}", "public function actionReportkeluarindex(){\n\t\t//$model->search($date);\n\n\t\t$this->layout= $this->CheckSession();\n\t\t$model = new Report();\n\t\tif($model->load(Yii::$app->request->post())){\n\t\t\treturn $this->render('report/indexkeluar',['hasil'=>$model->searchKeluar($model->date)]);\n\t\t}else{\n\t\t\treturn $this->render('report/indexkeluar',['hasil'=>$model->findReportBarangKeluar()]);\n\t\t}\n\t}", "function writeReportForAll()\t{\n\t\tGLOBAL $LANG;\n\n\t\t@ob_end_clean();\n\t\tob_start();\n\t\t$startTime = time();\n\t\techo '<h2>'.$LANG->getLL('report_translation_status').' '.t3lib_BEfunc::dateTime(time()).'</h2>';\n\n\t\t$details = $header = '';\n\n\t\t$header.= '<tr>\n\t\t<td><b>'.$LANG->getLL('report_language').'</b></td>\n\t\t<td><b>'.$LANG->getLL('report_langkey').'</b></td>\n\t\t<td><b>'.$LANG->getLL('report_label_mising').'</b></td\n\t\t<td><b>'.$LANG->getLL('report_complete').'</b></td>\n\t\t<td><b>'.$LANG->getLL('report_missing').'</b></td>\n\t\t<td><b>'.$LANG->getLL('report_download').'</b></td>\n\t\t</tr>';\n\t\t\t// Find all files:\n\t\t$files = array();\n\t\tforeach($this->extPathList as $path)\t{\n\t\t\t$files = array_merge($files, $this->getllxmlFiles(PATH_site . $path));\n\t\t}\n\n\t\tt3lib_div::loadTCA('be_users');\n\t\tforeach($GLOBALS['TCA']['be_users']['columns']['lang']['config']['items'] as $pair)\t{\n\t\t\tif ($pair[1])\t{\n\t\t\t\t\t// Re-generate status\n\t\t\t\t$this->MOD_SETTINGS['editLang'] = $pair[1];\n\t\t\t\t$statInfo = $this->loadTranslationStatus($files, true);\n\n\t\t\t\t$header.= '<tr>\n\t\t\t\t<td><a href=\"#'.$pair[1].'\">'.$pair[0].'</a></td>\n\t\t\t\t<td>'.$pair[1].'</td>\n\t\t\t\t<td>'.$statInfo['Labels missing translation'].'</td>\n\t\t\t\t<td>'.round(100-$statInfo['Labels missing translation']/($statInfo['Labels missing translation']+$statInfo['labels']['ok'])*100).'%</td>\n\t\t\t\t<td>'.($statInfo['csh']['new']+$statInfo['csh']['changed']+$statInfo['csh']['unknown']).'</td>\n\t\t\t\t<td>'.\n\t\t\t\t\t(@is_file(PATH_site.'typo3conf/l10n/'.$pair[1].'.zip') ? '<a href=\"'.$pair[1].'.zip\">'.$pair[1].'.zip</a> ' : '').\n\t\t\t\t\t(@is_file(PATH_site.'typo3conf/l10n/'.$pair[1].'.tgz') ? '<a href=\"'.$pair[1].'.tgz\">'.$pair[1].'.tgz</a> ' : '').\n\t\t\t\t\t'</td>\n\t\t\t\t</tr>';\n\n\n\t\t\t\t$details.= '<h3 id=\"'.$pair[1].'\">'.$pair[0].' ('.$pair[1].')</h3>';\n\n\t\t\t\tif (class_exists('t3lib_utility_Debug')) {\n\t\t\t\t\t$details .= t3lib_utility_Debug::viewArray($statInfo);\n\t\t\t\t} else {\n\t\t\t\t\t$details .= t3lib_div::view_array($statInfo);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t\t// Output:\n\t\techo '<table border=\"1\">'.$header.'</table>';\n\t\techo '<h3>'.$LANG->getLL('report_files').'</h3>';\n\t\tt3lib_utility_Debug::debug($files);\n\t\techo $details;\n\n\t\techo '<hr>'.sprintf($LANG->getLL('report_files'),floor((time()-$startTime)/60),((time()-$startTime)%60));\n\n\t\t// Output:\n\t\t$output = ob_get_contents().chr(10);\n\t\tob_end_clean();\n\n\t\treturn $output;\n\t}", "public function listadoConsultasSinPagar(){\n\t\t$resultado = array();\n\t\t\n\t\t$query = \"SELECT C.idConsulta, C.fecha, DATE_FORMAT(C.hora, '%H:%i') as hora,\n\t\t\n\t\t\t\t\t\tP.nombre AS nombrePaciente,\n\t\t\t\t\t\t\n\t\t\t\t\t\tPP.idPropietario, PP.identificacion, PP.nombre AS nombre, PP.apellido,\n\t\t\t\t\t\t\n\t\t\t\t\t\tU.nombre AS nombreMedico, U.apellido AS apellidoMedico\n\t\t\n\t\t\t\t\t\tFROM tb_consultas AS C \n\t\t\t\t\t\t\n\t\t\t\t\t\tINNER JOIN tb_mascotas AS P ON P.idMascota = C.idMascota\n\t\t\t\t\t\tINNER JOIN tb_propietarios AS PP ON PP.idPropietario = P.idPropietario\n\t\t\t\t\t\tINNER JOIN tb_usuarios AS U ON U.idUsuario = C.idUsuario\n\t\t\t\t\t\t\n \t\t\t\tWHERE Not C.idConsulta IN (SELECT idTipoDetalle FROM tb_pago_factura_caja_detalle WHERE tipoDetalle = 'Consulta' AND estado = 'Activo' )\n \t\t\t\torder by C.fecha desc, C.hora \";\n\t\t\n\t\t$conexion = parent::conexionCliente();\n\t\t\n\t\tif($res = $conexion->query($query)){\n \n /* obtener un array asociativo */\n while ($filas = $res->fetch_assoc()) {\n $resultado[] = $filas;\n }\n \n /* liberar el conjunto de resultados */\n $res->free();\n \n }\n\n return $resultado;\t\t\n\t}", "function print_custom_report_option_list( $p_selected_report = null, $p_all_custom_reports = null ) {\n\t$t_custom_reports = $p_all_custom_reports;\n\tif ( is_null( $t_custom_reports ) ) {\n\t\t$t_custom_reports = custom_reports_get_all();\n\t}\n\n\tif ( count( $t_custom_reports ) > 0 ) {\n\t\tforeach ( $t_custom_reports as $t_custom_report ) {\n\t\t\techo '<option value=\"' . $t_custom_report['id'] . '\"';\n\t\t\tcheck_selected( $t_custom_report['id'], $p_selected_report );\n\t\t\techo '>' . $t_custom_report['name'] . '</option>';\n\t\t}\n\t}\n}", "function GenerarReporteOficinas(){\t//consultar estudiantes registrados por municipio\t\n\n\t\t\t$html=\"\";\n\t\t\t$strsql=\"SELECT pasantias.departamento.estado, pasantias.oficina.nombre_oficina, pasantias.departamento.descripcion FROM pasantias.oficina , pasantias.departamento WHERE\n\n \t\t\t\t\toficina.id_departamento = departamento.id_departamento\";\t \n\t\t\t\t \n\t\t\t$rs=pg_query($strsql);\n\t\t\t$num=0;\n\t\t\t$num=pg_num_rows($rs);\n\t\t\n\n\n\t\t\t$html=$html.'<div align=\"center\">\n\t\t\t<h2>Reporte De Especialidades</h2>\n\t\t\t<h3>Total de registros: &nbsp; <i>'.$num.'</i></h3>\n\t\t\t\n\t\t\t<br><br>\n\t\t\t';\n\t\t\t/*$html=$html.'&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \n\t\t\t<table style=\"border-spacing: 2px;\" align=\"center\" >\n\t\t\t<tr align=\"center\" bgcolor=\"#011137\" border=\"1\" style=\"color: #000000;\">\n\t\t\t\t<td width=\"100\"><font color=\"#FFFFFF\">Id</font></td>\n\t\t\t\t<td width=\"100\"><font color=\"#FFFFFF\">Nombre</font></td>\n\t\t\t\t\n\t\t\t\t</tr>';*/\n\n\n\t\t\t\t$html=$html.'<div align=\"center\">\t\t\t\n\t\t\t<table border=\"0\" bordercolor=\"#0000CC\" bordercolordark=\"#FF0000\">';\t\n\t\t\t$html=$html.'<tr bgcolor=\"#0B3861\">\n\t\t\t<td><font color=\"#FFFFFF\" size=\"10\"><b> N&oacute;mbre Oficina </b></font></td>\n\t\n\t\t\t<td><font color=\"#FFFFFF\" size=\"10\"><b> Descripción </b></font></td>\n\t\t\t<td><font color=\"#FFFFFF\" size=\"10\"><b> Estado </b></font></td>\n\t\t\t</tr>';\n\n\t\t\t\n\t\t\t\t\n\t\t\t\twhile ($row = pg_fetch_array($rs)){\n\n\t\t\t\t\n\t\t\t\tif($i%2==0){\n\t\t\t\t\t$html= $html.'<tr bgcolor=\"#58ACFA\">';\n\t\t\t\t}else{\n\t\t\t\t\t$html=$html.'<tr>';\n\t\t\t\t}\n\t\t\t\t$html = $html.'<td>';\n\t\t\t\t$html = $html. $row[\"nombre_oficina\"];\n\t\t\t\t$html = $html.'</td><td>';\n\t\t\t\t$html = $html. $row[\"descripcion\"];\n\t\t\t\t$html = $html.'</td><td>';\n\t\t\t\t$html = $html. $row[\"estado\"];\n\t\t\t\t$html = $html.'</td></tr>';\t\t\n\t\t\t\t$i++;\n\t\t\t}\t\t\t\n\t\t\t$html=$html.'</table></div>';\t\t\t\n \t\t return ($html);\n\t\t}", "function GenerarReporteOficinas(){\t//consultar estudiantes registrados por municipio\t\n\n\t\t\t$html=\"\";\n\t\t\t$strsql=\"SELECT pasantias.departamento.estado, pasantias.oficina.nombre_oficina, pasantias.departamento.descripcion FROM pasantias.oficina , pasantias.departamento WHERE\n\n \t\t\t\t\toficina.id_departamento = departamento.id_departamento\";\t \n\t\t\t\t \n\t\t\t$rs=pg_query($strsql);\n\t\t\t$num=0;\n\t\t\t$num=pg_num_rows($rs);\n\t\t\n\n\n\t\t\t$html=$html.'<div align=\"center\">\n\t\t\t<h2>Reporte De Especialidades</h2>\n\t\t\t<h3>Total de registros: &nbsp; <i>'.$num.'</i></h3>\n\t\t\t\n\t\t\t<br><br>\n\t\t\t';\n\t\t\t/*$html=$html.'&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \n\t\t\t<table style=\"border-spacing: 2px;\" align=\"center\" >\n\t\t\t<tr align=\"center\" bgcolor=\"#011137\" border=\"1\" style=\"color: #000000;\">\n\t\t\t\t<td width=\"100\"><font color=\"#FFFFFF\">Id</font></td>\n\t\t\t\t<td width=\"100\"><font color=\"#FFFFFF\">Nombre</font></td>\n\t\t\t\t\n\t\t\t\t</tr>';*/\n\n\n\t\t\t\t$html=$html.'<div align=\"center\">\t\t\t\n\t\t\t<table border=\"0\" bordercolor=\"#0000CC\" bordercolordark=\"#FF0000\">';\t\n\t\t\t$html=$html.'<tr bgcolor=\"#0B3861\">\n\t\t\t<td><font color=\"#FFFFFF\" size=\"10\"><b> N&oacute;mbre Oficina </b></font></td>\n\t\n\t\t\t<td><font color=\"#FFFFFF\" size=\"10\"><b> Descripción </b></font></td>\n\t\t\t<td><font color=\"#FFFFFF\" size=\"10\"><b> Estado </b></font></td>\n\t\t\t</tr>';\n\n\t\t\t\n\t\t\t\t\n\t\t\t\twhile ($row = pg_fetch_array($rs)){\n\n\t\t\t\t\n\t\t\t\tif($i%2==0){\n\t\t\t\t\t$html= $html.'<tr bgcolor=\"#58ACFA\">';\n\t\t\t\t}else{\n\t\t\t\t\t$html=$html.'<tr>';\n\t\t\t\t}\n\t\t\t\t$html = $html.'<td>';\n\t\t\t\t$html = $html. $row[\"nombre_oficina\"];\n\t\t\t\t$html = $html.'</td><td>';\n\t\t\t\t$html = $html. $row[\"descripcion\"];\n\t\t\t\t$html = $html.'</td><td>';\n\t\t\t\t$html = $html. $row[\"estado\"];\n\t\t\t\t$html = $html.'</td></tr>';\t\t\n\t\t\t\t$i++;\n\t\t\t}\t\t\t\n\t\t\t$html=$html.'</table></div>';\t\t\t\n \t\t return ($html);\n\t\t}", "function getAllReports(){\n global $errors;\n\tif (in_array($_SESSION['user']['role'], ['admin'])) {\n\t\tglobal $conn, $roles, $keyword;\n\t\t$sql = \"SELECT * FROM reportedusers WHERE U_name like '%$keyword%' or rptr_u_name like '%$keyword%' or reason like '%$keyword%' order by timestamp desc \"; \n\t\tif($result = mysqli_query($conn, $sql)){\n $users = mysqli_fetch_all($result, MYSQLI_ASSOC);\n\n return $users;\n }else{\n array_push($errors, \"there was a problem fetching Records\");\n }\n\n\t} else {\n\t\treturn null;\n\t}\n}", "public function crearReporteFechas() {\r\n $datos = $this->factura->listarFacturasFechas($this->input->post(\"fechaInicio\"), $this->input->post(\"fechaFinal\"));\r\n $this->load->view(\"reporte\", $datos);\r\n }", "function get_export_list(){\n\n\t\t$output = array();\n\n\t\t$query = \"SELECT lead_id FROM leads_pending\n\t\tWHERE sent_fes = 0\n\t\tLIMIT 60000; \";\n\n\t\tif ($result = mysql_query($query, $this->conn)){\n\t\t\twhile($row = mysql_fetch_assoc($result)){\n\t\t\t\t$output[] = $row['lead_id'];\n\t\t\t}\n\t\t}else{\n\t\t\t$this->display(\"Query failed: $query\" . mysql_error($this->conn));\n\t\t}\n\n\t\treturn $output;\n\t}", "private function initReport()\n {\n $this->report = new \\stdClass();\n\n $this->searchDiffs();\n }", "function listaPrint()\n\t{\n\t\t$dg = new DataGrid(array(\"style\" => \"width:98%;margin:0px auto;\" , \"border\" => \"1\", \"id\" => \"tbl_\". $this -> tbl .\"\", \"cellpadding\" => \"0\", \"cellspacing\" => \"0\"));\n\t\t$nr_r = count($this);\n\t\tif($nr_r) {\n\t\t\t$dg -> addHeadColumn(\"Produs\");\n\t\t\t$dg -> addHeadColumn(\"UM\");\n\t\t\t$dg -> addHeadColumn(\"Cant\");\n\t\t\t$dg -> setHeadAttributes(array());\n\t\t\t\n\t\t\tfor($i=0;$i<$nr_r;$i++)\n\t\t\t\t{\n\t\t\t\t$this -> fromDataSource($i);\n\t\t\t\t$dg -> addColumn($this -> produs -> denumire);\n\t\t\t\t$dg -> addColumn($this -> produs -> unitate_masura -> denumire);\n\t\t\t\t$dg -> addColumn($this -> cantitate);\n\t\t\t\tif($this -> id == $selected) $class=\"rowclick\";\n\t\t\t\telse $class=\"\";\n\t\t\t\t$ck = $this -> stringReplace($click);\n\t\t\t\t$dck = $this -> stringReplace($dblClick);\n\t\t\t\t$dg -> index();\n\t\t\t\t}\n\t\t}\n\t\t$out .= $dg -> getDataGrid();\n\t\treturn $out;\t\n\t}", "function scheduledreporting_component_get_all_reports()\n{\n $scheduled_reports = array();\n\n // Get all the users and grab their reports\n $users = get_users();\n foreach ($users as $user) {\n $tmp = scheduledreporting_component_get_reports($user['user_id']);\n foreach ($tmp as $i => $t) {\n $tmp[$i]['user_id'] = $user['user_id'];\n }\n $scheduled_reports = array_merge($scheduled_reports, $tmp);\n }\n\n return $scheduled_reports;\n}", "final protected function _getScanListForMail()\n\t{\n\t\t$summary = array(\n\t\t\t'ids' => array(),\n\t\t\t'errors' => 0,\n\t\t\t'fileChanges' => 0,\n\t\t\t'fileDateOnlyChanges' => 0,\n\t\t\t'directoryChanges' => 0,\n\t\t\t'directoryDateOnlyChanges' => 0,\n\t\t);\n\n\t\t$list = array();\n\n\t\tforeach ($this->_db->query(\"\n\t\t\tSELECT\n\t\t\t\t`scanID`,\n\t\t\t\t`startDate`,\n\t\t\t\t`endDate`,\n\t\t\t\t`errors`,\n\t\t\t\t`fileChanges`,\n\t\t\t\t`fileDateOnlyChanges`,\n\t\t\t\t`directoryChanges`,\n\t\t\t\t`directoryDateOnlyChanges`\n\t\t\tFROM `scan`\n\t\t\tWHERE `status` = 'done'\n\t\t\t\tAND `mailSent` = 'no'\n\t\t\")->fetchAll(PDO::FETCH_ASSOC) as $row)\n\t\t{\n\t\t\t// Result\n\t\t\t$summary['ids'][] = $row['scanID'];\n\t\t\t$summary['errors'] += $row['errors'];\n\t\t\t$summary['fileChanges'] += $row['fileChanges'];\n\t\t\t$summary['fileDateOnlyChanges'] += $row['fileDateOnlyChanges'];\n\t\t\t$summary['directoryChanges'] += $row['directoryChanges'];\n\t\t\t$summary['directoryDateOnlyChanges'] += $row['directoryDateOnlyChanges'];\n\n\t\t\t// Date\n\t\t\t$row['startDate'] = $this->_formatMailDate($row['startDate']);\n\t\t\t$end = explode(' ', $this->_formatMailDate($row['endDate']));\n\t\t\t$row['endDate'] = $end[1];\n\n\t\t\t// Numeric values\n\t\t\tforeach ($row as $key => $value)\n\t\t\t{\n\t\t\t\tif (is_numeric($value) && $value != 0)\n\t\t\t\t{\n\t\t\t\t\t$row[$key] = array(\n\t\t\t\t\t\t'class' => 'Highlight',\n\t\t\t\t\t\t'value' => $value,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t$list[] = $row;\n\t\t}\n\n\t\t// Footer data\n\t\t$footer = array_merge(array(\n\t\t\t'scanID' => null,\n\t\t\t'startDate' => null,\n\t\t\t'endDate' => null,\n\t\t), $summary);\n\n\t\t// Numeric values\n\t\tforeach ($footer as $key => $value)\n\t\t{\n\t\t\tif (is_numeric($value) && $value != 0)\n\t\t\t{\n\t\t\t\t$footer[$key] = array(\n\t\t\t\t\t'class' => 'Highlight',\n\t\t\t\t\t'value' => $value,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\t// Generate content\n\t\t$summary['content'] = $this->_table('Scans', $this->_scanListColumns, $list, array($footer));\n\n\t\treturn $summary;\n\t}", "static public function ctrDescargarReporte(){\n\n\t\tif(isset($_GET[\"reporte\"])){\n\n\t\t\t$tabla = \"ventas\";\n\n\t\t\t$fechaInicial = null;\n $fechaFinal = null;\n\n \t$respuesta = ControladorVentas::ctrRangoFechasVentasCtaCorriente($fechaInicial, $fechaFinal);\n\n \t\n\t\t\t/*=============================================\n\t\t\tCREAMOS EL ARCHIVO DE EXCEL\n\t\t\t=============================================*/\n\n\t\t\t$Name = $_GET[\"reporte\"].'.xls';\n\n\t\t\theader('Expires: 0');\n\t\t\theader('Cache-control: private');\n\t\t\theader(\"Content-type: application/vnd.ms-excel\"); // Archivo de Excel\n\t\t\theader(\"Cache-Control: cache, must-revalidate\"); \n\t\t\theader('Content-Description: File Transfer');\n\t\t\theader('Last-Modified: '.date('D, d M Y H:i:s'));\n\t\t\theader(\"Pragma: public\"); \n\t\t\theader('Content-Disposition:; filename=\"'.$Name.'\"');\n\t\t\theader(\"Content-Transfer-Encoding: binary\");\n\n\t\t\techo utf8_decode(\"<table border='0'> \n\n\t\t\t\t\t<tr>\n\t\t\t\t\t<td style='font-weight:bold; border:1px solid #eee;'>FECHA</td>\t\n\t\t\t\t\t<td style='font-weight:bold; border:1px solid #eee;'>CODIGO</td>\n\t\t\t\t\t<td style='font-weight:bold; border:1px solid #eee;'>CLIENTE</td>\n\t\t\t\t\t<td style='font-weight:bold; border:1px solid #eee;'>TOTAL</td>\n\t\t\t\t\t\n\t\t\t\t\t<td style='font-weight:bold; border:1px solid #eee;'>REPUESTO</td>\n\t\t\t\t\t<td style='font-weight:bold; border:1px solid #eee;'>GABRIEL</td>\n\t\t\t\t\t<td style='font-weight:bold; border:1px solid #eee;'>GANANCIA</td>\n\t\t\t\t\t\n\t\t\t\t\t<td style='font-weight:bold; border:1px solid #eee;'></td>\n\t\t\t\t\t<td style='font-weight:bold; border:1px solid #eee;'>VALIDACION</td>\n\t\t\t\t\t\t\n\t\t\t\t\t</tr>\");\n\t\t\t$i=2;\n\t\t\tforeach ($respuesta as $row => $item){\n\t\t\t\t$i++;\n\t\t\t\t$cliente = ControladorClientes::ctrMostrarClientes(\"id\", $item[\"id_cliente\"]);\n\t\t\t\t$vendedor = ControladorUsuarios::ctrMostrarUsuarios(\"id\", $item[\"id_vendedor\"]);\n\t\t\t\t\n\t\t\t echo utf8_decode(\"<tr>\n\t\t\t \t\t\t<td style='border:1px solid #eee;'>\".$item[\"fecha\"].\"</td> \n\t\t\t \t\t\t<td style='border:1px solid #eee;'>\".$item[\"codigo\"].\"</td>\n\t\t\t \t\t\t<td style='border:1px solid #eee;'>\".$cliente[\"nombre\"].\"</td>\n\t\t\t \t\t\t<td style='border:1px solid #eee;'>\".$item[\"total\"].\"</td>\");\n\n\t\t\t \t$productos = json_decode($item[\"productos\"], true);\n\t\t\t \t\n\t\t\t \t$gp = 0;\n\t\t\t \t$servicioLocal = 0;\n\t\t\t \t$repuesto = 0;\n\t\t\t \t\n\t\t\t \tforeach ($productos as $key => $valueProductos) {\n\n\t\t\t \t\tswitch ($valueProductos['id']) {\n\t\t\t \t\t\tcase 23:\n\t\t\t \t\t\t\t# code...\n\t\t\t \t\t\t $gp += intval($valueProductos['total']);\n\t\t\t \t\t\t\tbreak;\n\t\t\t \t\t\tcase 22:\n\t\t\t \t\t\t\t# code...\n\t\t\t \t\t\t $servicioLocal += intval($valueProductos['total']);\n\t\t\t \t\t\t\tbreak;\n\t\t\t \t\t\tdefault:\n\t\t\t \t\t\t\t# code...\n\t\t\t \t\t\t\t$repuesto += intval($valueProductos['total']);\n\t\t\t \t\t\t\tbreak;\n\t\t\t \t\t}\n\t\t\t \t\t\t\n\t\t \t\t\n\t\t \t\t\t\n\t\t\t \t}\n\t\t\t \t$validacion = $item[\"total\"] - $repuesto - $servicioLocal - $gp;\n\n\t\t\t \techo utf8_decode(\"<td style='border:1px solid #eee;'>\".$repuesto.\"</td><td style='border:1px solid #eee;'>\".$gp.\"</td><td style='border:1px solid #eee;'>\".$servicioLocal.\"</td><td style='border:1px solid #eee;'> </td><td style='border:1px solid #eee;'>\".$validacion.\"</td>\n\t\t\t\t\t\t\n\t\t \t\t\t</tr>\n\t\t\t\t\t\n\t\t \t\t\t\");\n\n\n\t\t\t}\n\t\t\n\t\t\techo utf8_decode(\"<tr></tr>\n\t\t\t\t\t\t\t \n\t\t\t\t\t<tr>\n\t\t\t\t\t<td style='font-weight:bold; border:1px solid #eee;'></td>\t\n\t\t\t\t\t<td style='font-weight:bold; border:1px solid #eee;'></td>\n\t\t\t\t\t<td style='font-weight:bold; border:1px solid #eee;'></td>\n\t\t\t\t\t<td style='font-weight:bold; border:1px solid #eee;'>TOTAL</td>\n\t\t\t\t\t\n\t\t\t\t\t<td style='font-weight:bold; border:1px solid #eee;'>REPUESTO</td>\n\t\t\t\t\t<td style='font-weight:bold; border:1px solid #eee;'>GABRIEL</td>\n\t\t\t\t\t<td style='font-weight:bold; border:1px solid #eee;'>GANANCIA</td>\n\t\t\t\t\t\n\t\t\t\t\t<td style='font-weight:bold; border:1px solid #eee;'></td>\n\t\t\t\t\t<td style='font-weight:bold; border:1px solid #eee;'>VALIDACION</td>\n\t\t\t\t\t\t\n\t\t\t\t\t</tr>\t\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td colspan='2' style='font-weight:bold;pull-right'>SUBTOTALES<td>\n\t\t\t\t\t\t\n\t\t\t\t\t\t<td style='font-weight:bold;'>=SUMA(D2:D$i)</td>\n\t\t\t\t\t\t<td style='font-weight:bold;'>=SUMA(E2:E$i)</td>\n\t\t\t\t\t\t<td style='font-weight:bold;'>=SUMA(F2:F$i)</td>\n\t\t\t\t\t\t<td style='font-weight:bold;'>=SUMA(G2:G$i)</td>\n\t\t\t\t\t\t<td><td>\n\t\t\t\t\t\t<td style='font-weight:bold;'>=SUMA(I2:I$i)</td>\n\t\t\t\t\t</tr>\n\n\t\t\t\t\t\");\n\n\t\t\techo utf8_decode(\"<tr></tr>\");\n\n \t$item = null;\n $valor = null;\n\n $gastos = ControladorVentas::ctrMostrarGastitos($item, $valor);\n \t$p=$i+2;\n $g=$i+5;\n foreach ($gastos as $key => $value2) {\n\n \tswitch ($value2['nombre']) {\n \t\tcase 'COMPRA':\n \t\t\t# code...\n \t\t\t$compra = $value2['importe'];\n \t\t\t$ariel = 0;\n \t\t\t$gabriel = 0;\n \t\t\tbreak;\n \t\tcase 'ARIEL':\n \t\t\t# code...\n \t\t\t$compra = 0;\n \t\t\t$ariel = $value2['importe'];\n \t\t\t$gabriel = 0;\n \t\t\tbreak;\n \t\tcase 'GABRIEL':\n \t\t\t# code...\n \t\t\t$compra = 0;\n \t\t\t$ariel = 0;\n \t\t\t$gabriel = $value2['importe'];\n \t\t\tbreak;\n \t\t\n \t\t\n \t}\n \t\t\n \t\t$g++;\n\t\t echo utf8_decode(\"<tr>\n\t\t\t\t\t\t\t<td style='font-weight:bold; border:1px solid #eee;'></td>\t\n\t\t\t\t\t\t\t<td style='font-weight:bold; border:1px solid #eee;'>\".$value2['nombre'].\"</td>\n\t\t\t\t\t\t\t<td style='font-weight:bold; border:1px solid #eee;'>\".$value2['obs'].\"</td>\n\t\t\t\t\t\t\t<td style='font-weight:bold; border:1px solid #eee;'>\".(-1)*$value2['importe'].\"</td>\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t<td style='font-weight:bold; border:1px solid #eee;'>\".(-1)*$compra.\"</td>\n\t\t\t\t\t\t\t<td style='font-weight:bold; border:1px solid #eee;'>\".(-1)*$gabriel.\"</td>\n\t\t\t\t\t\t\t<td style='font-weight:bold; border:1px solid #eee;'>\".(-1)*$ariel.\"</td>\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t<td style='font-weight:bold; border:1px solid #eee;'></td>\n\t\t\t\t\t\t\t<td style='font-weight:bold; border:1px solid #eee;'></td></tr>\");\n\t\t }\n\n\t\t\techo utf8_decode(\"<tr></tr>\n\t\t\t\t\t\t\t <tr></tr>\n\t\t\t\t\t\t\t <tr></tr>\n\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td colspan='2'><td>\n\t\t\t\t\t\t\n\t\t\t\t\t\t<td style='font-weight:bold;color:red'>=SUMA(D$p:D$g)</td>\n\t\t\t\t\t\t<td style='font-weight:bold;color:red'>=SUMA(E$p:E$g)</td>\n\t\t\t\t\t\t<td style='font-weight:bold;color:red'>=SUMA(F$p:F$g)</td>\n\t\t\t\t\t\t<td style='font-weight:bold;color:red'>=SUMA(G$p:G$g)</td>\n\t\t\t\t\t\t<td style='font-weight:bold;color:red'><td>\n\t\t\t\t\t\t<td style='font-weight:bold;color:red'>=SUMA(I$p:I$g)</td>\n\t\t\t\t\t</tr>\n\n\t\t\t\t\t<tr>\n\t\t\t\t\t<td border:1px solid #eee;'>FECHA</td>\t\n\t\t\t\t\t<td style='font-weight:bold; border:1px solid #eee;'>CODIGO</td>\n\t\t\t\t\t<td style='font-weight:bold; border:1px solid #eee;'>CLIENTE</td>\n\t\t\t\t\t<td style='font-weight:bold; border:1px solid #eee;'>TOTAL</td>\n\t\t\t\t\t\n\t\t\t\t\t<td style='font-weight:bold; border:1px solid #eee;'>REPUESTO</td>\n\t\t\t\t\t<td style='font-weight:bold; border:1px solid #eee;'>GABRIEL</td>\n\t\t\t\t\t<td style='font-weight:bold; border:1px solid #eee;'>GANANCIA</td>\n\t\t\t\t\t\n\t\t\t\t\t<td style='font-weight:bold; border:1px solid #eee;'></td>\n\t\t\t\t\t<td style='font-weight:bold; border:1px solid #eee;'>VALIDACION</td>\n\t\t\t\t\t\t\n\t\t\t\t\t</tr>\");\n\t\t\techo \"</table>\";\n\n\t\t}\n\n\t}" ]
[ "0.7506851", "0.71718085", "0.6984069", "0.6956974", "0.6848039", "0.6838734", "0.6838734", "0.68365294", "0.6823726", "0.66108", "0.6557674", "0.6552452", "0.652683", "0.65086526", "0.64521295", "0.64486414", "0.64432704", "0.6418458", "0.6354913", "0.63485414", "0.63212156", "0.6315009", "0.6281835", "0.62748283", "0.6266518", "0.62583613", "0.624426", "0.6239807", "0.6227983", "0.6218642", "0.6202823", "0.6200235", "0.6200226", "0.6180076", "0.6174574", "0.61603177", "0.61532855", "0.61457115", "0.61369383", "0.61331815", "0.6120924", "0.6105807", "0.6089107", "0.6083308", "0.60830057", "0.6079573", "0.60737884", "0.6053479", "0.604553", "0.6039987", "0.60371876", "0.6029875", "0.6021654", "0.6020852", "0.6010152", "0.6009379", "0.59950733", "0.59950733", "0.5991157", "0.5979249", "0.59730136", "0.59649426", "0.59628755", "0.5950347", "0.59452003", "0.5933568", "0.5930792", "0.5929214", "0.5918071", "0.59176886", "0.5914214", "0.5913572", "0.5904116", "0.58947086", "0.58882916", "0.58768064", "0.5876608", "0.5856076", "0.5855169", "0.5852104", "0.58484685", "0.58408165", "0.58408165", "0.5839189", "0.58380973", "0.5834818", "0.5825957", "0.5824503", "0.58203274", "0.5815966", "0.5815142", "0.5809975", "0.5809975", "0.5807271", "0.58062035", "0.5802923", "0.58017606", "0.58006203", "0.57987165", "0.57966745", "0.57934386" ]
0.0
-1
Json encode tools array before save
public function setToolsAttribute($value) { $this->attributes['tools'] = json_encode($value); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function jsonize()\n {\n return json_encode($this->toArray());\n }", "public function jsonSerialize();", "public function jsonSerialize();", "public function jsonSerialize();", "public function jsonSerialize();", "public function jsonSerialize();", "public function jsonSerialize();", "public function jsonSerialize();", "public function jsonSerialize();", "public function jsonSerialize() : array {\n\t\t$fields = get_object_vars($this);\n\t\t$fields[\"saveJobPostingId\"] = $this->savedJobPostingId->toString();\n\t}", "public function _jsonSerialize();", "public function json(){ return json_encode( $this->objectify() ); }", "public function Encode()\r\n {\r\n if (!is_array($this->data))\r\n {\r\n $this->data = array();\r\n }\r\n return json_encode($this->data);\r\n }", "public function toJson(){\n\t\t$array = $this->toArray();\n\t\treturn json_encode($array);\n\t}", "public function saveAsJson($array)\n {\n return Tools::jsonEncode($array);\n }", "function asJSON(){\n\t\t\treturn json_encode($this->asArray());\n\t\t}", "private function encode($array) {\n return json_encode($array);\n }", "public function jsonSerialize(): array;", "public function toJSONString(){\n $this->buildArray();\n return json_encode($this->array);\n }", "public function serialize()\n\t{\n\t\treturn json_encode(array(\n\t\t\t'data' => $this->data,\n\t\t\t'this' => $this->getArrayCopy(),\n\t\t\t'name' => $this->name,\n\t\t\t'merged' => $this->merged,\n\t\t));\n\t}", "public function jsonSerialize()\n {\n return array_merge(parent::jsonSerialize(),[]);\n }", "public function toJson();", "public function toJson();", "final public function jsonSerialize() {}", "function JEncode($arr){\r\n\t\tif (version_compare(PHP_VERSION,\"5.2\",\"<\"))\r\n\t\t{ \r\n\t\t\trequire_once(\"./JSON.php\"); //if php<5.2 need JSON class\r\n\t\t\t$json = new Services_JSON();//instantiate new json object\r\n\t\t\t$data=$json->encode($arr); //encode the data in json format\r\n\t\t} else {\r\n\t\t\t$data = json_encode($arr); //encode the data in json format\r\n\t\t}\r\n\t\treturn $data;\r\n\t}", "function JEncode($arr){\r\n\t\tif (version_compare(PHP_VERSION,\"5.2\",\"<\"))\r\n\t\t{ \r\n\t\t\trequire_once(\"./JSON.php\"); //if php<5.2 need JSON class\r\n\t\t\t$json = new Services_JSON();//instantiate new json object\r\n\t\t\t$data=$json->encode($arr); //encode the data in json format\r\n\t\t} else {\r\n\t\t\t$data = json_encode($arr); //encode the data in json format\r\n\t\t}\r\n\t\treturn $data;\r\n\t}", "function JEncode($arr){\r\n\t\tif (version_compare(PHP_VERSION,\"5.2\",\"<\"))\r\n\t\t{ \r\n\t\t\trequire_once(\"./JSON.php\"); //if php<5.2 need JSON class\r\n\t\t\t$json = new Services_JSON();//instantiate new json object\r\n\t\t\t$data=$json->encode($arr); //encode the data in json format\r\n\t\t} else {\r\n\t\t\t$data = json_encode($arr); //encode the data in json format\r\n\t\t}\r\n\t\treturn $data;\r\n\t}", "function JEncode($arr){\r\n\t\tif (version_compare(PHP_VERSION,\"5.2\",\"<\"))\r\n\t\t{ \r\n\t\t\trequire_once(\"./JSON.php\"); //if php<5.2 need JSON class\r\n\t\t\t$json = new Services_JSON();//instantiate new json object\r\n\t\t\t$data=$json->encode($arr); //encode the data in json format\r\n\t\t} else {\r\n\t\t\t$data = json_encode($arr); //encode the data in json format\r\n\t\t}\r\n\t\treturn $data;\r\n\t}", "function JEncode($arr){\r\n\t\tif (version_compare(PHP_VERSION,\"5.2\",\"<\"))\r\n\t\t{ \r\n\t\t\trequire_once(\"./JSON.php\"); //if php<5.2 need JSON class\r\n\t\t\t$json = new Services_JSON();//instantiate new json object\r\n\t\t\t$data=$json->encode($arr); //encode the data in json format\r\n\t\t} else {\r\n\t\t\t$data = json_encode($arr); //encode the data in json format\r\n\t\t}\r\n\t\treturn $data;\r\n\t}", "function JEncode($arr){\r\n\t\tif (version_compare(PHP_VERSION,\"5.2\",\"<\"))\r\n\t\t{ \r\n\t\t\trequire_once(\"./JSON.php\"); //if php<5.2 need JSON class\r\n\t\t\t$json = new Services_JSON();//instantiate new json object\r\n\t\t\t$data=$json->encode($arr); //encode the data in json format\r\n\t\t} else {\r\n\t\t\t$data = json_encode($arr); //encode the data in json format\r\n\t\t}\r\n\t\treturn $data;\r\n\t}", "function JEncode($arr){\r\n\t\tif (version_compare(PHP_VERSION,\"5.2\",\"<\"))\r\n\t\t{ \r\n\t\t\trequire_once(\"./JSON.php\"); //if php<5.2 need JSON class\r\n\t\t\t$json = new Services_JSON();//instantiate new json object\r\n\t\t\t$data=$json->encode($arr); //encode the data in json format\r\n\t\t} else {\r\n\t\t\t$data = json_encode($arr); //encode the data in json format\r\n\t\t}\r\n\t\treturn $data;\r\n\t}", "function JEncode($arr){\r\n\t\tif (version_compare(PHP_VERSION,\"5.2\",\"<\"))\r\n\t\t{ \r\n\t\t\trequire_once(\"./JSON.php\"); //if php<5.2 need JSON class\r\n\t\t\t$json = new Services_JSON();//instantiate new json object\r\n\t\t\t$data=$json->encode($arr); //encode the data in json format\r\n\t\t} else {\r\n\t\t\t$data = json_encode($arr); //encode the data in json format\r\n\t\t}\r\n\t\treturn $data;\r\n\t}", "function JEncode($arr){\r\n\t\tif (version_compare(PHP_VERSION,\"5.2\",\"<\"))\r\n\t\t{ \r\n\t\t\trequire_once(\"./JSON.php\"); //if php<5.2 need JSON class\r\n\t\t\t$json = new Services_JSON();//instantiate new json object\r\n\t\t\t$data=$json->encode($arr); //encode the data in json format\r\n\t\t} else {\r\n\t\t\t$data = json_encode($arr); //encode the data in json format\r\n\t\t}\r\n\t\treturn $data;\r\n\t}", "public function json_encode() {\n try{\n return json_encode((array)array_values(self::get_items()));\n }catch(Exception $e){\n throw $e;\n }\n }", "function jsonSerialize()\r\n {\r\n return $this->to_array();\r\n }", "public function jsonSerialize()\n {\n return array_merge(parent::jsonSerialize(), [\n 'fields' => $this->structure()->fields(),\n 'data' => $this->data,\n 'actionText' => $this->actionText ?? __('Add row'),\n ]);\n }", "public function jsonSerialize()\n {\n }", "public function jsonSerialize()\n {\n }", "public function jsonSerialize() {\n\t\treturn $this->toArray();\n\t}", "public function func_json_builder () {\n return json_encode ($this -> raw_data);\n }", "public function jsonSerialize()\r\n {\r\n return array_merge(parent::jsonSerialize(), []);\r\n }", "function jsonSerialize()\n {\n return $this->toArray();\n }", "function jsonSerialize()\n {\n return $this->toArray();\n }", "public function serialize() {\r\n return json_encode($this);\r\n }", "public function makeJSON()\n {\n return(json_encode($this));\n }", "public function makeJSON()\n {\n return(json_encode($this));\n }", "function jsonSerialize()\n {\n return $this->to_array();\n }", "function jsonSerialize() {\n return $this->asArray();\n }", "public function jsonSerialize()\n {\n return parent::jsonSerialize() + ['text' => $this->text];\n }", "public function jsonSerialize()\n {\n $json = array();\n $json['id'] = $this->id;\n $json['name'] = $this->name;\n $json['voa'] = $this->voa;\n $json['voi'] = $this->voi;\n $json['stateAgg'] = $this->stateAgg;\n $json['ach'] = $this->ach;\n $json['transAgg'] = $this->transAgg;\n $json['aha'] = $this->aha;\n $json['accountTypeDescription'] = $this->accountTypeDescription;\n $json['phone'] = $this->phone;\n $json['urlHomeApp'] = $this->urlHomeApp;\n $json['urlLogonApp'] = $this->urlLogonApp;\n $json['oauthEnabled'] = $this->oauth_Enabled;\n $json['urlForgotPassword'] = $this->urlForgotPassword;\n $json['urlOnlineRegistration'] = $this->urlOnlineRegistration;\n $json['class'] = $this->mclass;\n $json['specialText'] = $this->specialText;\n $json['specialInstructions'] = $this->specialInstructions;\n $json['address'] = $this->address;\n $json['currency'] = $this->currency;\n $json['email'] = $this->email;\n $json['status'] = $this->status;\n $json['newInstitutionId'] = $this->newInstitutionId;\n $json['branding'] = $this->branding;\n $json['oauthInstitutionId'] = $this->oauth_InstitutionId;\n\n return array_merge($json, $this->additionalProperties);\n }", "public static function eJson($array=array()) { \n return json_encode($array, JSON_BIGINT_AS_STRING | JSON_UNESCAPED_UNICODE); \n }", "public function jsonSerialize()\r\n {\r\n return $this->toArray();\r\n }", "protected function getSaveData(): array\n {\n $data = parent::getSaveData();\n if ( !empty( $data['furniture'] ) ) {\n foreach ( $data['furniture'] as $furniture ) {\n $dataFurniture[][$furniture->id] = $furniture->quantity;\n }\n $data['furniture'] = json_encode( $dataFurniture ?? null, JSON_THROW_ON_ERROR );\n }\n if ( !empty( $data['status'] ) ) { //We want string for DB column, not id integer\n $data['status'] = $this->status->name;\n }\n return $data;\n }", "public function jsonEncode($array)\n\t{\n\t\treturn json_encode($array);\n\t}", "public function jsonSerialize()\n {\n return $this->tinydb_get_serializable_data();\n }", "public function jsonSerialize() {\n return $this->toArray();\n }", "public function jsonSerialize(): array\n {\n return array_merge([\n 'sendTrytesResult' => $this->sendTrytesResult->serialize(),\n 'bundle' => $this->bundle->serialize(),\n ], parent::serialize());\n }", "public function asJson($content=[])\n{\n self::$stored['json'][] = $content;\n return json_encode($content);\n}", "public function jsonSerialize() {\n return json_encode($this->value);\n }", "public function serialize()\n {\n return json_encode($this);\n }", "function jsonSerialize();", "function h_json_encode($arr)\n{\n\tarray_walk_recursive($arr, function (&$item, $key) {\n\t\tif (is_string($item)) $item = mb_encode_numericentity($item, array (0x80, 0xffff, 0, 0xffff), 'UTF-8');\n\t});\n\t$arrReturn = str_replace(\"\\'\", \"'\", mb_decode_numericentity(json_encode($arr), array (0x80, 0xffff, 0, 0xffff), 'UTF-8'));\n\treturn $arrReturn;\n}", "public function jsonSerialize()\n {\n return array_merge([\n 'settings' => $this->settings(),\n 'actions' => $this->actions(),\n 'columns' => $this->columns(),\n 'filters' => $this->filters(),\n 'cacheKey' => $this->generateCacheKey()\n ], parent::jsonSerialize());\n }", "public function jsonSerialize()\n {\n return $this->toArray();\n }", "public function jsonSerialize()\n {\n return $this->toArray();\n }", "public function jsonSerialize()\n {\n return $this->toArray();\n }", "public function jsonSerialize()\n {\n return $this->toArray();\n }", "public function jsonSerialize()\n {\n return $this->toArray();\n }", "public function jsonSerialize()\n {\n return $this->toArray();\n }", "public function jsonSerialize()\n {\n return $this->toArray();\n }", "public function jsonSerialize()\n {\n return $this->toArray();\n }", "public function jsonSerialize()\n {\n return $this->toArray();\n }", "public function jsonSerialize()\n {\n return $this->toArray();\n }", "public function jsonSerialize()\n {\n return $this->toArray();\n }", "public function jsonSerialize()\n {\n return $this->toArray();\n }", "public function jsonSerialize()\n {\n return $this->toArray();\n }", "public function jsonSerialize()\n {\n return $this->toArray();\n }", "public function jsonSerialize()\n {\n return $this->toArray();\n }", "public function jsonSerialize()\n {\n return $this->toArray();\n }", "public function jsonSerialize()\n {\n return $this->toArray();\n }", "public function jsonSerialize()\n {\n return $this->toArray();\n }", "public function jsonSerialize()\n {\n return $this->toArray();\n }", "public function jsonSerialize()\n {\n return $this->toArray();\n }", "public function jsonSerialize()\n {\n return $this->toArray();\n }", "public function jsonSerialize()\n {\n return $this->toArray();\n }", "public function jsonEncode()\n {\n return json_encode($this->activeValue);\n }", "public function jsonSerialize() {\n\n return ['id' => $this->id,\n 'name' => $this->name,\n 'author' => $this->author,\n 'description' => $this->description];\n \n \n }", "public function jsonSerialize()\n {\n return ObjectSerializer::sanitizeForSerialization($this);\n }", "public function jsonSerialize()\n {\n return ObjectSerializer::sanitizeForSerialization($this);\n }", "public function jsonSerialize()\n {\n return ObjectSerializer::sanitizeForSerialization($this);\n }", "public function jsonSerialize()\n {\n return ObjectSerializer::sanitizeForSerialization($this);\n }", "public function jsonSerialize()\n {\n return ObjectSerializer::sanitizeForSerialization($this);\n }", "public function jsonSerialize()\n {\n return ObjectSerializer::sanitizeForSerialization($this);\n }", "public function jsonSerialize()\n {\n return ObjectSerializer::sanitizeForSerialization($this);\n }", "public function jsonSerialize()\n {\n return ObjectSerializer::sanitizeForSerialization($this);\n }", "public function jsonSerialize()\n {\n return ObjectSerializer::sanitizeForSerialization($this);\n }", "public function jsonSerialize()\n {\n return ObjectSerializer::sanitizeForSerialization($this);\n }", "public function jsonSerialize()\n {\n return ObjectSerializer::sanitizeForSerialization($this);\n }", "public function jsonSerialize()\n {\n return ObjectSerializer::sanitizeForSerialization($this);\n }", "public function jsonSerialize()\n {\n return ObjectSerializer::sanitizeForSerialization($this);\n }", "public function jsonSerialize()\n {\n return ObjectSerializer::sanitizeForSerialization($this);\n }" ]
[ "0.71102834", "0.7034995", "0.7034995", "0.7034995", "0.7034995", "0.7034995", "0.7034995", "0.7034995", "0.7034995", "0.69466186", "0.6874731", "0.68540716", "0.6840318", "0.6829259", "0.680217", "0.677923", "0.666676", "0.6623648", "0.6618", "0.65998065", "0.65962064", "0.65695274", "0.65695274", "0.6547022", "0.65371907", "0.65371907", "0.65371907", "0.65371907", "0.65371907", "0.65371907", "0.65371907", "0.65371907", "0.65371907", "0.6519237", "0.6506557", "0.6504694", "0.65027034", "0.65027034", "0.650172", "0.6488451", "0.6476843", "0.6474037", "0.6474037", "0.6453678", "0.6451961", "0.6451961", "0.6442456", "0.64326966", "0.64285994", "0.64236945", "0.6421351", "0.64088255", "0.63945544", "0.6393441", "0.6385508", "0.6384092", "0.6369615", "0.6364131", "0.63534766", "0.63432735", "0.63394606", "0.63317376", "0.6323779", "0.63237184", "0.63237184", "0.63237184", "0.63237184", "0.63237184", "0.63237184", "0.63237184", "0.63237184", "0.63237184", "0.63237184", "0.63237184", "0.63237184", "0.63237184", "0.63237184", "0.63237184", "0.63237184", "0.63237184", "0.63237184", "0.63237184", "0.63237184", "0.63237184", "0.63237184", "0.6300273", "0.629355", "0.6289106", "0.6289106", "0.6289106", "0.6289106", "0.6289106", "0.6289106", "0.6289106", "0.6289106", "0.6289106", "0.6289106", "0.6289106", "0.6289106", "0.6289106", "0.6289106" ]
0.0
-1
Json encode filters array before save
public function setFiltersAttribute($value) { $this->attributes['filters'] = json_encode($value); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function postSavefilters()\n {\n if (Request::ajax())\n {\n\t\t\t$datatoblob = json_decode(Input::get('selectedvalues'), true);\n //serialization\n $checkuserid = Auth::id();\n $autheduser = User::find(Auth::id());\n $objforuser = new stdClass;\n $objforuser->data = json_encode($datatoblob);\n $objforuser->is_array = is_array($datatoblob); // doing this for proper deserialize\n $objforuser_json = json_encode($objforuser);\n $autheduser->filters_patient = json_encode($objforuser);\n if ($autheduser->forceSave())\n {\n return 'success';\n }else\n {\n return 'nope';\n }\n } else\n {\n return false;\n }\n }", "public function jsonSerialize()\n {\n return array_filter([\n 'site_id' => $this->site_id,\n 'title' => $this->title,\n 'seller_id' => $this->seller_id,\n 'category_id' => $this->category_id,\n 'price' => $this->price,\n 'currency_id' => $this->currency_id,\n 'available_quantity' => $this->available_quantity,\n 'buying_mode' => $this->buying_mode,\n 'listing_type_id' => $this->listing_type_id,\n 'condition' => $this->condition,\n 'description' => $this->description,\n 'seller_custom_field' => $this->seller_custom_field,\n 'status' => $this->status\n ], function ($val) {\n return null !== $val;\n });\n }", "function add_json_filter()\n{\n add_filter( 'json_prepare_post', 'apply_json_filter', 10, 3 );\n}", "protected function setFilterArray() {\n $primary_keys = getPrimaryKeys($this->table_name);\n foreach ($primary_keys as $pk) {\n if (isset($_GET[$pk])) {\n $this->filter[$pk] = Mysql::SQLValue($_GET[$pk]);\n }\n }\n }", "public function jsonize()\n {\n return json_encode($this->toArray());\n }", "public function testBeforeSaveWithAlreadyEncodedValue()\n {\n $product = new \\Magento\\Framework\\DataObject(\n [\n 'json_encoded' => [1, 2, 3]\n ]\n );\n\n // save twice\n $this->model->beforeSave($product);\n $this->model->beforeSave($product);\n \n // check it is encoded only once\n $this->assertEquals(json_encode([1, 2, 3]), $product->getData('json_encoded'));\n }", "public function jsonSerialize(): array\n {\n return array_merge(parent::jsonSerialize(), [\n 'multiple' => $this->multiple,\n ]);\n }", "function apply_json_filter( $_post, $post, $context )\n{\n $_post['meta'] = array_merge($_post['meta'],get_fields($post['ID']));\n return $_post;\n}", "public function jsonSerialize()\n {\n $json = [];\n $json['name'] = $this->name;\n $json['selection_type'] = $this->selectionType;\n\n return array_filter($json, function ($val) {\n return $val !== null;\n });\n }", "public function jsonSerialize()\n {\n return $this->all();\n }", "public function jsonSerialize()\n {\n return $this->all();\n }", "public function jsonSerialize()\n {\n return $this->all();\n }", "public function filters()\n {\n return array(\n 'value' => array(\n array(array($this, 'check_for_array_or_object')),\n )\n );\n }", "protected function getSaveData(): array\n {\n $data = parent::getSaveData();\n if ( !empty( $data['furniture'] ) ) {\n foreach ( $data['furniture'] as $furniture ) {\n $dataFurniture[][$furniture->id] = $furniture->quantity;\n }\n $data['furniture'] = json_encode( $dataFurniture ?? null, JSON_THROW_ON_ERROR );\n }\n if ( !empty( $data['status'] ) ) { //We want string for DB column, not id integer\n $data['status'] = $this->status->name;\n }\n return $data;\n }", "public function jsonSerialize()\n {\n return array_merge(parent::jsonSerialize(),[]);\n }", "static function json_encode(array $input) {\n\n\t\t$replaced = array();\n\n\t\tforeach ($input as $key => $value) {\n\t\t\tif (is_array($value)) {\n\t\t\t\t$replaced['\"%'.$key.'%\"'] = self::json_encode($value);\n\t\t\t\t$input[$key] = '%'.$key.'%';\n\t\t\t} else if (strpos($value, 'function(') === 0) {\n\t\t\t\t$replaced['\"%'.$key.'%\"'] = $value;\n\t\t\t\t$input[$key] = '%'.$key.'%';\n\t\t\t}\n\t\t}\n\n\t\t$output = json_encode($input);\n\n\n\t\t$output = str_replace(array_keys($replaced), $replaced, $output);\n\n\t\treturn $output;\n\t}", "public function Encode()\r\n {\r\n if (!is_array($this->data))\r\n {\r\n $this->data = array();\r\n }\r\n return json_encode($this->data);\r\n }", "protected function prepForSave()\n\t{\n\t\t$array = array();\n\t\tforeach( static::$schema AS $field => $type )\n\t\t{\n\t\t\tif ( is_array( $type ) )\n\t\t\t{\n\t\t\t\t$type = $type[ 'type' ];\n\t\t\t}\n\t\t\t\n\t\t\t$array[ $field ] = $this->sanitize( $type, $this->data[ $field ], true );\n\t\t}\n\n\t\tif ( isset( $this->data[ 'updated_at' ] ) )\n\t\t{\n\t\t\t$array[ 'updated_at' ] = date( 'Y-m-d H:i:s' );\n\t\t}\n\t\tif ( ! $this->loaded && isset( $this->data[ 'created_at' ] ) )\n\t\t{\n\t\t\t$array[ 'created_at' ] = date( 'Y-m-d H:i:s' );\n\t\t}\n\t\t\n\t\treturn $array;\n\t}", "public function jsonSerialize()\n {\n return ObjectSerializer::sanitizeForSerialization($this);\n }", "public function jsonSerialize()\n {\n return ObjectSerializer::sanitizeForSerialization($this);\n }", "public function jsonSerialize()\n {\n return ObjectSerializer::sanitizeForSerialization($this);\n }", "public function jsonSerialize()\n {\n return ObjectSerializer::sanitizeForSerialization($this);\n }", "public function jsonSerialize()\n {\n return ObjectSerializer::sanitizeForSerialization($this);\n }", "public function jsonSerialize()\n {\n return ObjectSerializer::sanitizeForSerialization($this);\n }", "public function jsonSerialize()\n {\n return ObjectSerializer::sanitizeForSerialization($this);\n }", "public function jsonSerialize()\n {\n return ObjectSerializer::sanitizeForSerialization($this);\n }", "public function jsonSerialize()\n {\n return ObjectSerializer::sanitizeForSerialization($this);\n }", "public function jsonSerialize()\n {\n return ObjectSerializer::sanitizeForSerialization($this);\n }", "public function jsonSerialize()\n {\n return ObjectSerializer::sanitizeForSerialization($this);\n }", "public function jsonSerialize()\n {\n return ObjectSerializer::sanitizeForSerialization($this);\n }", "public function jsonSerialize()\n {\n return ObjectSerializer::sanitizeForSerialization($this);\n }", "public function jsonSerialize()\n {\n return ObjectSerializer::sanitizeForSerialization($this);\n }", "public function jsonSerialize()\n {\n return ObjectSerializer::sanitizeForSerialization($this);\n }", "public function jsonSerialize()\n {\n return ObjectSerializer::sanitizeForSerialization($this);\n }", "public function jsonSerialize()\n {\n return ObjectSerializer::sanitizeForSerialization($this);\n }", "public function jsonSerialize()\n {\n return ObjectSerializer::sanitizeForSerialization($this);\n }", "public function jsonSerialize()\n {\n return ObjectSerializer::sanitizeForSerialization($this);\n }", "public function jsonSerialize()\n {\n return ObjectSerializer::sanitizeForSerialization($this);\n }", "public function jsonSerialize()\n {\n return ObjectSerializer::sanitizeForSerialization($this);\n }", "public function jsonSerialize()\n {\n return ObjectSerializer::sanitizeForSerialization($this);\n }", "public function jsonSerialize()\n {\n return ObjectSerializer::sanitizeForSerialization($this);\n }", "public function jsonSerialize()\n {\n return ObjectSerializer::sanitizeForSerialization($this);\n }", "public function jsonSerialize()\n {\n return ObjectSerializer::sanitizeForSerialization($this);\n }", "public function jsonSerialize()\n {\n return ObjectSerializer::sanitizeForSerialization($this);\n }", "public function jsonSerialize()\n {\n return ObjectSerializer::sanitizeForSerialization($this);\n }", "public function jsonSerialize()\n {\n return ObjectSerializer::sanitizeForSerialization($this);\n }", "public function jsonSerialize()\n {\n return ObjectSerializer::sanitizeForSerialization($this);\n }", "public function jsonSerialize()\n {\n return ObjectSerializer::sanitizeForSerialization($this);\n }", "public function jsonSerialize()\n {\n return ObjectSerializer::sanitizeForSerialization($this);\n }", "public function jsonSerialize()\n {\n return ObjectSerializer::sanitizeForSerialization($this);\n }", "public function jsonSerialize()\n {\n return ObjectSerializer::sanitizeForSerialization($this);\n }", "public function jsonSerialize()\n {\n return ObjectSerializer::sanitizeForSerialization($this);\n }", "public function jsonSerialize()\n {\n return ObjectSerializer::sanitizeForSerialization($this);\n }", "public function jsonSerialize()\n {\n return ObjectSerializer::sanitizeForSerialization($this);\n }", "public function jsonSerialize()\n {\n return ObjectSerializer::sanitizeForSerialization($this);\n }", "public function jsonSerialize()\n {\n $json = [];\n $json['order'] = $this->order;\n $json['limit'] = $this->limit;\n $json['batch_token'] = $this->batchToken;\n\n return array_filter($json, function ($val) {\n return $val !== null;\n });\n }", "public function testBeforeSave()\n {\n $product = new \\Magento\\Framework\\DataObject(\n [\n 'json_encoded' => [1, 2, 3]\n ]\n );\n $this->model->beforeSave($product);\n $this->assertEquals(json_encode([1, 2, 3]), $product->getData('json_encoded'));\n }", "public function jsonSerialize();", "public function jsonSerialize();", "public function jsonSerialize();", "public function jsonSerialize();", "public function jsonSerialize();", "public function jsonSerialize();", "public function jsonSerialize();", "public function jsonSerialize();", "public function jsonSerialize()\r\n {\r\n return array_merge(parent::jsonSerialize(), []);\r\n }", "public function jsonSerialize()\n {\n return array_merge([\n 'settings' => $this->settings(),\n 'actions' => $this->actions(),\n 'columns' => $this->columns(),\n 'filters' => $this->filters(),\n 'cacheKey' => $this->generateCacheKey()\n ], parent::jsonSerialize());\n }", "private function encode($array) {\n return json_encode($array);\n }", "protected function createEntityPOST() {\n\n $jsonFieldsToProcess = array('last_login_filter', 'receipt_type_filter', 'open_type_filter', 'page_visit_filter');\n\n $this->savedBroadcastTypes = !empty($_POST['broadcast_types']) ? $_POST['broadcast_types'] : null;\n unset($_POST['broadcast_types']);\n\n $savedJsonFieldsData = array();\n foreach ($jsonFieldsToProcess as $f) {\n if ($f == 'last_login_filter') {\n $savedJsonFieldsData[$f] = !empty($_POST[$f]['operator']) ? $_POST[$f] : null;\n } else {\n $savedJsonFieldsData[$f] = !empty($_POST[$f]) ? $_POST[$f] : null;\n }\n unset($_POST[$f]);\n }\n\n $entity = parent::createEntityPOST();\n\n foreach ($jsonFieldsToProcess as $f) {\n $entity[$f] = !empty($savedJsonFieldsData[$f]) ? json_encode($savedJsonFieldsData[$f], JSON_FORCE_OBJECT) : null;\n }\n\n return $entity;\n }", "public function toArray(): array\n {\n return [\n 'type' => 'not',\n 'field' => $this->filter->toArray(),\n ];\n }", "public function toJson(bool $filterEmpty = false): string\n {\n return JsonHelper::enc($this->toArray($filterEmpty));\n }", "public function encode()\n {\n return [\n '__op' => 'Remove',\n 'objects' => Encoder::encode($this->objects, true),\n ];\n }", "public function jsonSerialize()\n {\n $json = [];\n $json['id'] = $this->id;\n $json['name'] = $this->name;\n $json['rate'] = $this->rate;\n $json['amount_money'] = $this->amountMoney;\n $json['discount_type'] = $this->discountType;\n $json['pin_required'] = $this->pinRequired;\n $json['color'] = $this->color;\n $json['v2_id'] = $this->v2Id;\n\n return array_filter($json, function ($val) {\n return $val !== null;\n });\n }", "public function jsonSerialize() : array {\n\t\t$fields = get_object_vars($this);\n\t\t$fields[\"saveJobPostingId\"] = $this->savedJobPostingId->toString();\n\t}", "public function _jsonSerialize();", "public function jsonEncode()\n {\n return json_encode($this->activeValue);\n }", "public function jsonSerialize()\n {\n $json = [];\n $json['id'] = $this->id;\n $json['name'] = $this->name;\n $json['rate'] = $this->rate;\n $json['calculation_phase'] = $this->calculationPhase;\n $json['adjustment_type'] = $this->adjustmentType;\n $json['applies_to_custom_amounts'] = $this->appliesToCustomAmounts;\n $json['enabled'] = $this->enabled;\n $json['inclusion_type'] = $this->inclusionType;\n $json['type'] = $this->type;\n $json['v2_id'] = $this->v2Id;\n\n return array_filter($json, function ($val) {\n return $val !== null;\n });\n }", "public function saveItemFilters()\n {\n $variables = $this->getAllSubmittedVariablesByName();\n\n $categories = array();\n\n foreach ($variables as $key => $value) {\n if (strstr($key, 'category|') && !empty($value)) {\n $categories[] = $value;\n }\n }\n\n $filter = ItemFilterModel::model()->find('play_id = :playId', array(\n ':playId' => $this->playid\n ));\n $method = 'update';\n\n if (empty($filter)) {\n $filter = new ItemFilterModel();\n $method = 'insert';\n }\n\n $filter->play_id = $this->playid;\n $filter->price_from = $variables['price_from'];\n $filter->price_to = $variables['price_to'];\n $filter->tags = json_encode($this->sessionGet('filter_tags'));\n $filter->categories = json_encode($categories);\n $filter->$method();\n\n if (isset($variables['filter_distance'])) {\n $this->saveVariable('filter_distance', $variables['filter_distance']);\n }\n\n return $filter;\n }", "public function jsonSerialize()\n {\n $params = [\n 'field' => $this->field,\n 'operator' => $this->operator,\n ];\n\n if ($this->value !== null) {\n $params['value'] = $this->value;\n }\n\n return $params;\n }", "public function jsonSerialize() {\n\n $res = NULL;\n if ((isset($this->integerArray)) and (!empty($this->integerArray))) {\n $res[integer_array] = $this->getIntegerArray();\n \n }\n if ((isset($this->booleanArray)) and (!empty($this->booleanArray))) {\n $res[boolean_array] = $this->getBooleanArray();\n \n }\n if ((isset($this->stringArray)) and (!empty($this->stringArray))) {\n $res[string_array] = $this->getStringArray();\n \n }\n\n if (isset($res)){\n $res= array_filter($res, function ($value) {\n return !is_null($value) and !empty($value) && null !=value;\n });\n return $res ;\n }\n\n }", "public function jsonSerialize()\n {\n return array_merge(parent::jsonSerialize(), [\n 'fields' => $this->structure()->fields(),\n 'data' => $this->data,\n 'actionText' => $this->actionText ?? __('Add row'),\n ]);\n }", "public function beforeSave()\n {\n if ($this->fixResultSets)\n {\n foreach ($this->fixResultSets as $property => $__)\n {\n if (isset($this->$property) && ($value = $this->$property) instanceof \\Phalcon\\Mvc\\Model\\ResultSetInterface)\n {\n unset($this->fixResultSets[$property]);\n $this->$property = $value->filter(function($r) {\n return $r;\n });\n }\n }\n }\n }", "private function convertSerializedData()\n {\n $layoutUpdateQueryModifier = $this->queryModifierFactory->create(\n 'like',\n [\n 'values' => [\n 'xml' => '%conditions_encoded%'\n ]\n ]\n );\n $this->aggregatedFieldDataConverter->convert(\n [\n new FieldToConvert(\n SerializedToJson::class,\n $this->moduleDataSetup->getTable('widget_instance'),\n 'instance_id',\n 'widget_parameters'\n ),\n new FieldToConvert(\n LayoutUpdateConverter::class,\n $this->moduleDataSetup->getTable('layout_update'),\n 'layout_update_id',\n 'xml',\n $layoutUpdateQueryModifier\n ),\n ],\n $this->moduleDataSetup->getConnection()\n );\n }", "public function beforeSave()\n {\n $value = $this->getValue();\n $value = $this->makeStorableArrayFieldValue($value);\n $this->setValue($value);\n }", "public function toJson(){\n\t\t$array = $this->toArray();\n\t\treturn json_encode($array);\n\t}", "public function toJson();", "public function toJson();", "public function prepare_json() { \n return json_encode($this->get_settings()); \n }", "function array_encode($array, $mysqli){\r\n\t\t$result = gzcompress(json_encode($array));\r\n\t\tif ($mysqli) {\r\n\t\t\tmysqli_real_escape_string($mysqli,$result);\r\n\t\t}\r\n\t\treturn $result;\r\n\t}", "public function json(){ return json_encode( $this->objectify() ); }", "public function json_encode() {\n try{\n return json_encode((array)array_values(self::get_items()));\n }catch(Exception $e){\n throw $e;\n }\n }", "public function saveAsJson($array)\n {\n return Tools::jsonEncode($array);\n }", "function acf_json_encode($json)\n{\n}", "public function transformAll(){\n $genres = $this->entityManager->getRepository(Genre::class)->findAll();\n $genreArray = [];\n\n foreach ($genres as $genre){\n $genreArray[$genre->getId()]= $this->transformSingleGenre($genre);\n }\n\n return new JsonResponse($genreArray);\n\n }", "function _prepareFilter(&$controller){\n \t\n\t\t$filter = array();\n if(isset($controller->data)){\n foreach($controller->data as $model=>$fields){\n foreach($fields as $key=>$field){\n if($field == ''){\n unset($controller->data[$model][$key]);\n }\n }\n }\n \n App::import('Sanitize');\n $sanit = new Sanitize();\n $controller->data = $sanit->clean($controller->data);\n $filter = $controller->data;\n }\n \n if (empty($filter)){\n \t\t$filter = $this->_checkParams($controller); \t\n }\n $controller->data = $filter;\n }", "public function jsonSerialize(): array;", "public function jsonSerialize()\n {\n return ObjectSerializer::sanitizeForSerialization($this);\n }", "public function jsonSerialize()\n {\n return ObjectSerializer::sanitizeForSerialization($this);\n }", "public function setFilter($arrFilter);", "public function jsonSerialize() : array\n {\n return $this->all();\n }" ]
[ "0.65192896", "0.5964755", "0.59322846", "0.57538986", "0.5747806", "0.5672656", "0.560113", "0.55765325", "0.55708426", "0.55369717", "0.55369717", "0.55369717", "0.55143344", "0.5481404", "0.5476864", "0.54701316", "0.5456691", "0.5436292", "0.5411539", "0.5411539", "0.5411539", "0.5411539", "0.5411539", "0.5411539", "0.5411539", "0.5411539", "0.5411539", "0.5411539", "0.5411539", "0.5411539", "0.5411539", "0.5411539", "0.5411539", "0.5411539", "0.5411539", "0.5411539", "0.5411539", "0.5411539", "0.5411539", "0.5411539", "0.5411539", "0.5411539", "0.5411539", "0.5411539", "0.5411539", "0.5411539", "0.5411539", "0.5411539", "0.5411539", "0.5411539", "0.5411539", "0.5411539", "0.5411539", "0.5411539", "0.5411539", "0.5410951", "0.54038495", "0.54017234", "0.54017234", "0.54017234", "0.54017234", "0.54017234", "0.54017234", "0.54017234", "0.54017234", "0.53731287", "0.53660655", "0.53610426", "0.5349379", "0.53407377", "0.53376937", "0.53148997", "0.530673", "0.5297153", "0.52960014", "0.5275641", "0.5268062", "0.5267968", "0.5257303", "0.52538526", "0.5253177", "0.5236087", "0.5231385", "0.52273107", "0.52271277", "0.5218717", "0.5218717", "0.5204952", "0.52012414", "0.5197912", "0.5197398", "0.5193454", "0.5185518", "0.51704943", "0.51649606", "0.51629907", "0.51563525", "0.51563525", "0.51506984", "0.5144244" ]
0.5244955
81
Decode filters from db
public function getToolsAttribute($value) { return json_decode($value, true); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected function decodeFilters()\n {\n if (empty($this->options['filters'])) {\n $this->options['filters'] = [];\n }\n\n $this->options['filters'] = json_decode(base64_decode($this->options['filters']), true);\n\n return $this;\n }", "abstract public function prepareFilters();", "abstract protected function getFilters();", "function _get_filters(){\n $flt = array();\n $filters = array();\n\n if(!isset($_REQUEST['dataflt'])){\n $flt = array();\n }elseif(!is_array($_REQUEST['dataflt'])){\n $flt = (array) $_REQUEST['dataflt'];\n }else{\n $flt = $_REQUEST['dataflt'];\n }\n foreach($flt as $key => $line){\n // we also take the column and filtertype in the key:\n if(!is_numeric($key)) $line = $key.$line;\n $f = $this->_parse_filter($line);\n if(is_array($f)){\n $f['logic'] = 'AND';\n $filters[] = $f;\n }\n }\n return $filters;\n }", "private static function _getFilter() {}", "private function filters() {\n\n\n\t}", "private function fetchFilterTypes()\n {\n $sql = '\n SELECT * FROM Rm_Filters;\n ';\n\n $res = $this->db->executeSelectQueryAndFetchAll($sql);\n\n $filterTypesArray = array();\n foreach ($res as $key => $row) {\n $name = htmlentities($row->name);\n $filterTypesArray[] = $name;\n }\n\n return $filterTypesArray;\n }", "public function GetFilters ();", "public function getFilters();", "public function getFilter();", "public function getFilter();", "abstract public function filters();", "function translate_filter ($filter,$dir='db') \n{ \n $url = array(\"category\", \"location\", \"start_date\", \"end_date\");\n $db = array(\"categories\", \"locations\", \"startDate\", \"endDate\");\n $return = array();\n \n foreach ($filter as $key=>$val) {\n if ($dir == 'db') \n $key = str_replace($url,$db,$key);\n if ($dir == 'url') \n $key = str_replace($db,$url,$key);\n $return[$key] = $val;\n }\n \n return $return;\n}", "protected static function loadFiltersData()\n {\n self::$filtersData = (array) $GLOBALS['TSFE']->fe_user->getKey('ses', 'filters');\n }", "abstract function get_sql_filter($data);", "function xh_fetchFilter($filter_name)\r\n\t{\r\n\t}", "public function getStrFilters($filters)\n\t{\n\t\t//traemos el cliente ?\n\t\t$empresa \t= $this->empresasRepo->getEmpresaById($filters['idEmpresa'])['nombre'];\n\t\t$temas \t\t= ($filters['firstTheme']==0)\n\t\t\t\t\t\t\t\t\t? 'Todos'\n\t\t\t\t\t\t\t\t\t:$this->temaRepo->get($filters['firstTheme'])['nombre'];\n\t\t$tipoFuente = ($filters['tipo_fuente']==0)\n\t\t\t\t\t\t\t\t\t? 'Todos'\n\t\t\t\t\t\t\t\t\t: $this->tipoFuenteRepo->get($filters['tipo_fuente'])['descripcion'];\n\t\t$fuente \t= ($filters['fuente']==0)\n\t\t\t\t\t\t\t\t\t? 'Todos'\n\t\t\t\t\t\t\t\t\t: $this->fuentesRepo->getFontById($filters['fuente'])['nombre'];\n\t\t$seccion \t= ($filters['seccion']==0)\n\t\t\t\t\t\t\t\t\t? 'Todos'\n\t\t\t\t\t\t\t\t\t: $this->seccionRepo->getSeccionById($filters['seccion'])['nombre'];\n\t\t$sector \t= ($filters['sector']==0)\n\t\t\t\t\t\t\t\t\t? \"Todos\"\n\t\t\t\t\t\t\t\t\t: $this->sectorRepo->findById($filters['sector'])['nombre'];\n\t\t$genero \t= ($filters['genero']==0)\n\t\t\t\t\t\t\t\t\t? \"Todos\"\n\t\t\t\t\t\t\t\t\t: $this->generoRepo->findById($filters['genero'])['descripcion'];\n\t\t$tipoAutor \t= ($filters['tipoAutor']==0)\n\t\t\t\t\t\t\t\t\t? \"Todos\"\n\t\t\t\t\t\t\t\t\t: $this->tipoAutorRepo->get($filters['tipoAutor'])['descripcion'];\n\t\t$tendencia \t= ($filters['tendencia']==0)\n\t\t\t\t\t\t\t\t\t? \"Todos\"\n\t\t\t\t\t\t\t\t\t: Util::getTipoTendencia($filters['tendencia']);\n\t\t$fechasQry \t= [\"fecha_inicio\" => $filters['fecha_inicio'],\n\t\t\t\t\t\t\"fecha_fin\" => $filters['fecha_fin']\n\t\t\t\t\t];\t\t\t\t\t\t\t\n\t\treturn ['empresa' => $empresa,'tema' => $temas , 'tipo_fuente' => $tipoFuente, 'fuente' => $fuente, 'seccion' => $seccion,\n\t\t\t\t'sector' => $sector, 'genero' => $genero,\n\t\t\t\t'tipo_autor' => $tipoAutor, 'tendencia' => $tendencia, \n\t\t\t\t'fechas_reporte' => $fechasQry, 'link' => '' ];\n\t}", "function readfilter()\n\t{\n\t\t$field = $this->input->post(\"namafield\");\n\t\t$value = $this->input->post(\"valfilter\");\n\n\t\treturn array(\n\t\t\t\t\"field\" => $field,\n\t\t\t\t\"value\" => $value\n\t\t\t);\n\t}", "public function formatFilters($rawFilters){\n $filters = array();\n \n //LIBRARIAN NAME\n if(array_key_exists('librarian', $rawFilters)){ \n if($rawFilters['librarian'] != ''){\n $filters['librarian'] = $this->__getStaffById($rawFilters['librarian']);\n }\n } \n \n //PROGRAM NAME\n if(array_key_exists('program', $rawFilters)){ \n if($rawFilters['program'] != ''){\n $filters['program'] = $this->__getProgramById($rawFilters['program']);\n }\n } \n \n //INSTRUCTION TYPE\n if(array_key_exists('instructionType', $rawFilters)){ \n $instructionType = $this->formatInstructionType($rawFilters['instructionType']);\n $filters['instructionType'] = $instructionType;\n } \n \n //FILTER CRITERIA (academic, fiscal, calendar, semester, custom)\n if(array_key_exists('filterCriteria', $rawFilters)){ \n $instructionType = $this->formatInstructionType($rawFilters['instructionType']);\n $filters['instructionType'] = $instructionType;\n \n switch($rawFilters['filterCriteria']){\n case 'academic':\n array_key_exists('academicYear', $rawFilters) ? $year = $rawFilters['academicYear'] . '-' . ($rawFilters['academicYear'] + 1) : $year = '';\n $criteriaYear = \"Academic Year \" . $year;\n break;\n case 'calendar':\n array_key_exists('calendarYear', $rawFilters) ? $year = $rawFilters['calendarYear'] : $year = '';\n $criteriaYear = \"Calendar Year \" . $year;\n break;\n case 'fiscal':\n array_key_exists('fiscalYear', $rawFilters) ? $year = $rawFilters['fiscalYear'] . '-' . ($rawFilters['fiscalYear'] + 1) : $year = '';\n $criteriaYear = \"Fiscal Year \" . $year;\n break;\n case 'semester':\n array_key_exists('year', $rawFilters) ? $year = $rawFilters['year'] : $year = '';\n $criteriaYear = ucfirst($rawFilters['semester']) . ' ' . $year;\n break;\n case 'custom':\n array_key_exists('startDate', $rawFilters) ? $startDate = $rawFilters['startDate'] : $startDate = '';\n array_key_exists('endDate', $rawFilters) ? $endDate = $rawFilters['endDate'] : $endDate = '';\n $criteriaYear = 'Date Range: ' . $startDate . ' to ' . $endDate;\n break;\n }\n \n $filters['year'] = $criteriaYear;\n } \n \n //LEVEL \n if(array_key_exists('level', $rawFilters)){ \n $filters['level'] = ucfirst($rawFilters['level']);\n } \n \n //LAST n MONTHS\n if(array_key_exists('lastmonths', $rawFilters)){ \n $filters['lastmonths'] = 'Last '.$rawFilters['lastmonths'].' months';\n } \n \n return $filters;\n }", "function _prepare_filter_data () {\n\t\t// Filter session array name\n\t\t$this->_filter_name\t= $_GET[\"object\"].\"_filter\";\n\t\t// Connect common used arrays\n\t\tif (file_exists(INCLUDE_PATH.\"common_code.php\")) {\n\t\t\tinclude (INCLUDE_PATH.\"common_code.php\");\n\t\t}\n\t\t// Fields in the filter\n\t\t$this->_fields_in_filter = array(\n\t\t\t\"engine\",\n\t\t\t\"text\",\n\t\t);\n\t}", "public function createFilter();", "public function getFilters(): array;", "public function getFilter(){ }", "protected function processFilters()\n {\n $this->filters = [];\n foreach ($this->params as $key => $value) {\n $this->parser->setAlias('_' . $this->contentType);\n $filter = $this->parser->getFilter($key, $value);\n if ($filter) {\n $this->addFilter($filter);\n }\n }\n }", "function xh_listFilters()\r\n\t{\r\n\t}", "public function & GetFilters () {\n\t\t$filters = [];\n\t\tforeach ($this->filters as $direction => $handler) \n\t\t\t$filters[$direction] = $handler[1];\n\t\treturn $filters;\n\t}", "private function _parseBFilterParam()\n\t{\n $map = array('a' => 'attribute', 'm' => 'manufacturer', 's' => 'stock_status', 'f' => 'filter', 'o' => 'option', 'r' => 'rating', 'c' => 'category');\n \n if (!isset($this->request->get['bfilter'])) {\n \n return;\n }\n\t\t$bfilter = $this->request->get['bfilter'];\n\n\t\t$params = explode(';', $bfilter);\n \n\t\tforeach ($params as $param) \n {\n if (!empty($param)) \n {\n $p = explode(':', $param);\n $pName = $p[0];\n $pValue = $p[1];\n if ($pName === 'price') \n {\n $p = explode('-', $pValue);\n if ((int)$p[0] > 0 || (int)$p[1] > 0) {\n $this->conditions->price = new stdClass();\n $this->conditions->price->min = null;\n $this->conditions->price->max = null;\n $this->conditions->price->inputMin = null;\n $this->conditions->price->inputMax = null;\n }\n if ((int)$p[0] > 0) {\n $this->conditions->price->min = $this->currency->convert($p[0], $this->currency->getCode(), $this->config->get('config_currency'));\n $this->conditions->price->inputMin = $p[0];\n }\n if ((int)$p[1] > 0) {\n $this->conditions->price->max = $this->currency->convert($p[1], $this->currency->getCode(), $this->config->get('config_currency'));\n $this->conditions->price->inputMax = $p[1];\n }\n } \n elseif ($pName === 'rating') \n {\n $this->conditions->rating = explode(',', $pValue);\n } \n elseif ($pName === 'search')\n {\n $this->conditions->search = $pValue;\n $this->searchNameString = $pValue;\n $this->searchTagString = $pValue;\n $this->searchDescriptionString = $pValue;\n }\n else \n {\n $type = $map[substr($pName, 0, 1)];\n $groupId = (int)substr($pName, 1);\n if ($type) {\n if (strpos($pValue, '-') !== false) {\n $p = explode('-', $pValue);\n if (isset($p[0]) && isset($p[1])) {\n $this->conditions->{$type}[$groupId] = array('min' => $p[0], 'max' => $p[1]);\n }\n } else {\n $this->conditions->{$type}[$groupId] = explode(',', $pValue);\n }\n\n if ($type !== 'rating') {\n $type = strtoupper($type);\n if (!isset($this->aggregate[$type])) {\n $this->aggregate[$type] = array();\n }\n if (strpos($pValue, '-') !== false) {\n $p = explode('-', $pValue);\n $range = $this->_getSliderIntermediateValues($type, $groupId, $p[0], $p[1]);\n if (!empty($range)) {\n $this->aggregate[$type][$groupId] = $range;\n }\n } else {\n $this->aggregate[$type][$groupId] = explode(',', $pValue);\n }\n }\n }\n }\n }\n\t\t}\n\t}", "public function register_filters() {\n\n\t\t}", "private function prepareFilters($filters) {\n\n if(isset($filters['tags'])){\n $filters['tags'] = implode(',', $filters['tags']);\n }\n\n if(isset($filters['exclude_tags'])){\n $filters['exclude_tags'] = implode(',', $filters['exclude_tags']);\n }\n\n return $filters;\n }", "private function prepareFilters($filters) {\n\n if(isset($filters['tags'])){\n $filters['tags'] = implode(',', $filters['tags']);\n }\n\n if(isset($filters['exclude_tags'])){\n $filters['exclude_tags'] = implode(',', $filters['exclude_tags']);\n }\n\n return $filters;\n }", "public function getFilter(): string;", "public function getFilters(): array;", "public function getFilter() :array;", "public function select_filters($db, $filters)\n {\n $sql = \" SELECT * FROM products $filters order by count_view desc\";\n $stmt = $db->ejecutar($sql);\n return $db->listar($stmt);\n }", "function get_filters($init_data = true) {\n //no filters by default\n return array();\n }", "function _dotgo_filter_prepare() {\n\n}", "public function getFilters(): FilterCollection;", "public function buildFilters()\n {\n $this->addFilter('name', new ORM\\StringFilterType('name'), 'media.adminlist.configurator.filter.name');\n $this->addFilter('contentType', new ORM\\StringFilterType('contentType'), 'media.adminlist.configurator.filter.type');\n $this->addFilter('updatedAt', new ORM\\NumberFilterType('updatedAt'), 'media.adminlist.configurator.filter.updated_at');\n $this->addFilter('filesize', new ORM\\NumberFilterType('filesize'), 'media.adminlist.configurator.filter.filesize');\n }", "public function filter( )\n {\n global $UNDERQL;\n $l_args_num = func_num_args( );\n if ( $l_args_num < 3 )\n return false;\n $filter_name = func_get_arg( 0 );\n\n $l_filter_callback = $UNDERQL['filter']['prefix'] . $filter_name;\n\n if ( !function_exists( $l_filter_callback ))\n return false;\n\n switch(func_get_arg(1))\n {\n case UQL_FILTER_IN:\n\n for ( $i = 2; $i < $l_args_num; $i++ )\n {\n if(!isset($this->in_filters[$this->table_name][func_get_arg( $i )]))\n $this->in_filters[$this->table_name][func_get_arg( $i )] = array($filter_name);\n else\n {\n $_temp = $this->in_filters[$this->table_name][func_get_arg( $i )];\n $_temp[@count($_temp)] = $filter_name;\n\n $this->in_filters[$this->table_name][func_get_arg( $i )] = $_temp;\n }\n }\n return true;\n\n case UQL_FILTER_OUT:\n for ( $i = 2; $i < $l_args_num; $i++ )\n {\n if(!isset($this->out_filters[$this->table_name][func_get_arg( $i )]))\n {\n $this->out_filters[$this->table_name][func_get_arg( $i )] = array($filter_name);\n }\n else\n {\n $_temp = $this->out_filters[$this->table_name][func_get_arg( $i )];\n $_temp[@count($_temp)] = $filter_name;\n\n $this->out_filters[$this->table_name][func_get_arg( $i )] = $_temp;\n\n }\n }\n return true;\n default : return false;\n }\n }", "public function getAllFilters();", "function filters($filter)\n{\n\tglobal $con;\n\t\n\t$query_ConsultaFuncion = sprintf(\"SELECT * FROM appearance WHERE id_appearance = %s\",\n\t\t\t\t\t\t\t\t\t\t GetSQLValueString($filter, \"int\"));\n\t//echo $query_ConsultaFuncion;\n\t$ConsultaFuncion = mysqli_query($con, $query_ConsultaFuncion) or die(mysqli_error($con));\n\t$row_ConsultaFuncion = mysqli_fetch_assoc($ConsultaFuncion);\n\t$totalRows_ConsultaFuncion = mysqli_num_rows($ConsultaFuncion);\n\t\n\treturn $row_ConsultaFuncion[\"filters\"];\n\t\n\tmysqli_free_result($ConsultaFuncion);\n}", "protected function applyFiltering()\n\t{\n\t\tif (!$this->hasFilters()) return;\n\n\t\tparse_str($this->filters, $list);\n\t\tforeach ($list as $column => $value) {\n\t\t\tif ($value !== '') {\n\t\t\t\t$this[$column]->applyFilter($value);\n\t\t\t}\n\t\t}\n\t}", "public function parseFilters(array $params = array())\n {\n if (empty($params)) {\n $params = $this->_params;\n }\n\n if (!array_key_exists(self::FILTER, $params)) {\n return $this->_selectStatement;\n }\n\n $filters = Zend_Json::decode($params[self::FILTER]);\n\n foreach ($filters as $filter) {\n\n if (empty($filter['field'])\n || empty($filter['type'])\n || (empty($filter['value'])) && $filter['value'] !== 0 && $filter['value'] !== false) {\n continue;\n }\n\n $value = $filter['value'];\n\n if ('search' != $filter['type']) {\n if (!in_array($filter['field'], $this->_fields)) {\n continue;\n }\n $filter['field'] = $this->getAlias($filter['field']);\n }\n\n switch($filter['type']) {\n\n case 'string':\n $this->_selectStatement->where($filter['field']\n . $this->_adapter->quoteInto(' LIKE ?', '%' . $filter['value']. '%'));\n break;\n\n case 'stringstrict':\n $this->_selectStatement->where($filter['field'] . ' = ?', $filter['value']);\n break;\n\n case 'search':\n $fields = explode(',', $filter['field']);\n if (empty($fields)) {\n continue;\n }\n\n $collection = array();\n foreach ($fields as $field) {\n $field = trim($field);\n if (!in_array($field, $this->_fields)) {\n continue;\n }\n\n $field = $this->getAlias($field);\n\t\t\t\t\t\tif (preg_match('!^(\\d{2})[.\\/-](\\d{2})[.\\/-](\\d{2,4})$!', $filter['value'], $matches)) {\n $value = $matches[3] . '-' . $matches[2] . '-' . $matches[1];\n\t\t\t\t\t\t}\n\n $collection[] = $this->_adapter->quoteInto($field . ' LIKE ?', '%' . $value . '%');\n }\n\n if (!empty($collection)) {\n $this->_selectStatement->where(join(' OR ', $collection));\n }\n break;\n\n case 'list' :\n if (false !== strpos($filter['value'], ',')) {\n $value = explode(',', $filter['value']);\n } else {\n $value = (array) $filter['value'];\n }\n\n $this->_selectStatement->where($filter['field']\n . ' IN (' . $this->_adapter->quote($value) . ')');\n break;\n\n case 'boolean':\n $this->_selectStatement->where($filter['field'] . ' = ?', $filter['value']);\n break;\n\n case 'numeric' :\n if (empty($filter['comparison'])) {\n continue;\n }\n\n switch ($filter['comparison']) {\n case 'eq':\n $this->_selectStatement->where($filter['field'] . ' = ?', $filter['value']);\n break;\n\n case 'lt':\n $this->_selectStatement->where($filter['field'] . ' < ?', $filter['value']);\n break;\n\n case 'gt':\n $this->_selectStatement->where($filter['field'] . ' > ?', $filter['value']);\n break;\n\n case 'neq':\n $this->_selectStatement->where($filter['field'] . ' != ?', $filter['value']);\n break;\n }\n break;\n\n case 'date':\n if (empty($filter['comparison'])) {\n continue;\n }\n\n switch ($filter['comparison']) {\n case 'eq':\n $this->_selectStatement->where($filter['field'] . ' = ?', date('Y-m-d', strtotime($filter['value'])));\n break;\n\n case 'lt':\n $this->_selectStatement->where($filter['field'] . ' < ?', date('Y-m-d', strtotime($filter['value'])));\n break;\n\n case 'gt':\n $this->_selectStatement->where($filter['field'] . ' > ?', date('Y-m-d', strtotime($filter['value'])));\n break;\n }\n break;\n\n default:\n break;\n }\n }\n return $this->_selectStatement;\n }", "function prepareFilters($dbhandle){\n $filterItems = array();\n\n //Get all the currently defined tags\n $q = \"SELECT CodeID, Name FROM Code\";\n $result_id = doQuery($q,$dbhandle);\n\n //For each tag build the query that returns the nodes tagged by the tag including the map they are in\n while($row = mysql_fetch_row($result_id)) {\n\n //$d = getTagName($dbhandle,$activeFilter);\n\n $q = \"SELECT DISTINCT n2.Label AS Map, tmp.Label AS 'Issue', tmp.Author FROM \".\n\t \"(\" .\n\t \"SELECT n.Author, n.Label, vn.ViewID, vn.CurrentStatus FROM Node n \" .\n\t \"JOIN ViewNode vn ON n.NodeID = vn.NodeID \" .\n\t \"JOIN NodeCode nc ON n.NodeID = nc.NodeID \" .\n\t \"WHERE nc.CodeID='\" . $row[0] . \"' AND vn.CurrentStatus != 3\" . //currentstatus -> dont show deleted nodes\n\t \") AS tmp \" .\n\t \"JOIN Node n2 ON tmp.ViewID = n2.NodeID \" .\n\t \"ORDER BY Map\";\n\n $filterItems[$row[0]] = new FilterItem($row[0],$row[1],$q);\n }\n\n //Add some custom ones\n\n //Which decisions dont have evidence (detail)\n $i = 'DecisionsNoEvidence';\n $d = 'Decisions without evidence';\n $q = \"SELECT DISTINCT n2.Label AS Map, tmp.Label AS 'Issue', tmp.Author FROM \".\n\t\"(\" .\n\t \"SELECT n.Author, n.Label, n.Detail, vn.ViewID, vn.CurrentStatus FROM Node n \" .\n\t \"JOIN ViewNode vn ON n.NodeID = vn.NodeID \" .\n\t \"WHERE n.NodeType = 8 AND n.Detail = '' AND vn.CurrentStatus != 3\" . \n\t\") AS tmp \" .\n\t\"JOIN Node n2 ON tmp.ViewID = n2.NodeID \" .\n\t\"ORDER BY Map\";\n $filterItems[$i] = new FilterItem($i,$d,$q);\n\n //select all questions that do not have any nodes pointing to them\n $i = 'QuestionsNoAnswer';\n $d = 'Unanswered Questions';\n $q = \"SELECT DISTINCT n2.Label AS Map, tmp.Label AS 'Issue', tmp.Author FROM \" .\n\t\"(\" .\n\t \"SELECT n.Author, n.Label, vn.ViewID, vn.CurrentStatus FROM Node n \" .\n\t \"JOIN ViewNode vn ON n.NodeID = vn.NodeID \" .\n\t \"WHERE n.NodeType = 3 AND n.NodeID NOT IN (SELECT ToNode FROM Link) AND vn.CurrentStatus != 3\" .\n\t\") AS tmp \" .\n\t\"JOIN Node n2 ON tmp.ViewID = n2.NodeID \" .\n\t\"ORDER BY Map\";\n $filterItems[$i] = new FilterItem($i,$d,$q);\n\n //select all orphaned (disconnected) nodes\n $i = 'Orphans';\n $d = 'Orphaned nodes';\n $q = \"SELECT DISTINCT n2.Label AS Map, tmp.Label AS 'Issue', tmp.Author FROM \" .\n\t\"(\" .\n\t \"SELECT n.Author, n.Label, vn.ViewID, vn.CurrentStatus FROM Node n \" .\n\t \"JOIN ViewNode vn ON n.NodeID = vn.NodeID \" .\n\t \"WHERE n.NodeID NOT IN (SELECT ToNode FROM Link) AND n.NodeID NOT IN (SELECT FromNode FROM Link) AND vn.CurrentStatus != 3\" .\n\t\") AS tmp \" .\n\t\"JOIN Node n2 ON tmp.ViewID = n2.NodeID \" .\n\t\"WHERE n2.NodeType != 1 AND tmp.Author != 'Administrator' AND n2.Label != 'Home Window' AND n2.Label != 'Decode'\" . //ignore nodes in lists and nodes in welcome/intro/top level maps\n\t\"ORDER BY Map\";\n $filterItems[$i] = new FilterItem($i,$d,$q);\n\n //foreach ($filterItems as $key => $value){\n // $it = $filterItems[$key];\n // print $it . \"<br><br>\\n\\n\";\n //}\n\n return $filterItems;\n}", "public function filters(){\r\r\n\t\treturn CMap::mergeArray(parent::filters(),array(\r\r\n\t\t\t\r\r\n\t\t));\r\r\n\t}", "protected function initializeFilters()\r\n\t{\r\n\t\t$this->iso_filterFields = deserialize($this->iso_filterFields, true);\r\n\t\t\r\n\t\tif(!empty($this->iso_filterFields))\r\n\t\t{\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\t\r\n\t\tif ($this->iso_filterTpl)\r\n\t\t{\r\n\t\t\t$this->strTemplate = $this->iso_filterTpl;\r\n\t\t}\r\n\t\t\r\n\t\treturn false;\r\n\t}", "function acf_get_filters()\n{\n}", "private function _setupFiltering()\n\t{\n\t\tglobal $txt;\n\n\t\t// We'll escape some strings...\n\t\t$db = database();\n\n\t\t// You can filter by any of the following columns:\n\t\t$filters = array(\n\t\t\t'id_member' => $txt['username'],\n\t\t\t'ip' => $txt['ip_address'],\n\t\t\t'session' => $txt['session'],\n\t\t\t'url' => $txt['error_url'],\n\t\t\t'message' => $txt['error_message'],\n\t\t\t'error_type' => $txt['error_type'],\n\t\t\t'file' => $txt['file'],\n\t\t\t'line' => $txt['line'],\n\t\t);\n\n\t\t$filter = $this->_req->getQuery('filter', 'trim', null);\n\t\t$value = $this->_req->getQuery('value', 'trim', null);\n\n\t\t// Set up the filtering...\n\t\tif (isset($value, $filters[$filter]))\n\t\t{\n\t\t\t$filter = array(\n\t\t\t\t'variable' => $filter,\n\t\t\t\t'value' => array(\n\t\t\t\t\t'sql' => in_array($filter, array('message', 'url', 'file'))\n\t\t\t\t\t\t? base64_decode(strtr($value, array(' ' => '+')))\n\t\t\t\t\t\t: $db->escape_wildcard_string($value),\n\t\t\t\t),\n\t\t\t\t'href' => ['filter' => $filter, 'value' => $value],\n\t\t\t\t'entity' => $filters[$filter]\n\t\t\t);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif (isset($filter, $value))\n\t\t\t{\n\t\t\t\tunset($this->_req->query->filter, $this->_req->query->value);\n\t\t\t}\n\n\t\t\t$filter = [];\n\t\t}\n\n\t\treturn $filter;\n\t}", "protected static function filtes()\n {\n /*\n * The filters fetches are transported\n * to router Bus calls\n **/\n }", "function _parse_filter($filterline){\n if(preg_match('/^(.*?)([\\*=<>!~]{1,2})(.*)$/',$filterline,$matches)){\n $column = $this->_column(trim($matches[1]));\n\n $com = $matches[2];\n $aliasses = array('<>' => '!=', '=!' => '!=', '~!' => '!~',\n '==' => '=', '~=' => '~', '=~' => '~');\n\n if (isset($aliasses[$com])) {\n $com = $aliasses[$com];\n } elseif (!preg_match('/(!?[=~])|([<>]=?)|(\\*~)/', $com)) {\n msg('Failed to parse comparison \"'.hsc($com).'\"',-1);\n return false;\n }\n\n $val = trim($matches[3]);\n\n if(strpos($com, '~') !== false) {\n if ($com === '*~') {\n $val = '*' . $val . '*';\n $com = '~';\n }\n $val = str_replace('*','%',$val);\n if ($com == '!~'){\n $com = 'NOT LIKE';\n } else {\n $com = 'LIKE';\n }\n } else {\n // Clean if there are no asterisks I could kill\n $val = $this->_cleanData($val, $column['type']);\n }\n $val = sqlite_escape_string($val); //pre escape\n\n return array('key' => $column['key'],\n 'value' => $val,\n 'compare' => $com,\n 'colname' => $column['colname'],\n 'type' => $column['type']\n );\n }\n msg('Failed to parse filter \"'.hsc($filterline).'\"',-1);\n return false;\n }", "private function setFilter()\n\t{\n\t\t// get filter values\n\t\t$this->filter['language'] = ($this->getParameter('language', 'array') != '') ? $this->getParameter('language', 'array') : BL::getWorkingLanguage();\n\t\t$this->filter['application'] = $this->getParameter('application');\n\t\t$this->filter['module'] = $this->getParameter('module');\n\t\t$this->filter['type'] = $this->getParameter('type', 'array');\n\t\t$this->filter['name'] = $this->getParameter('name');\n\t\t$this->filter['value'] = $this->getParameter('value');\n\n\t\t// build query for filter\n\t\t$this->filterQuery = BackendLocaleModel::buildURLQueryByFilter($this->filter);\n\t}", "function _create_filter_sql () {\n\t\t$SF = &$_SESSION[$this->_filter_name];\n\t\tforeach ((array)$SF as $k => $v) $SF[$k] = trim($v);\n\t\t// Generate filter for the common fileds\n\t\tif ($SF[\"id_min\"]) \t\t\t\t$sql .= \" AND id >= \".intval($SF[\"id_min\"]).\" \\r\\n\";\n\t\tif ($SF[\"id_max\"])\t\t\t \t$sql .= \" AND id <= \".intval($SF[\"id_max\"]).\" \\r\\n\";\n\t\tif ($SF[\"date_min\"]) \t\t\t$sql .= \" AND add_date >= \".strtotime($SF[\"date_min\"]).\" \\r\\n\";\n\t\tif ($SF[\"date_max\"])\t\t\t$sql .= \" AND add_date <= \".strtotime($SF[\"date_max\"]).\" \\r\\n\";\n\t\tif ($SF[\"user_id\"])\t\t\t \t$sql .= \" AND user_id = \".intval($SF[\"user_id\"]).\" \\r\\n\";\n\t\tif ($SF[\"cat_id\"])\t\t\t \t$sql .= \" AND cat_id = \".intval($SF[\"cat_id\"]).\" \\r\\n\";\n\t\tif (strlen($SF[\"title\"]))\t\t$sql .= \" AND title LIKE '\"._es($SF[\"title\"]).\"%' \\r\\n\";\n\t\tif (strlen($SF[\"summary\"]))\t\t$sql .= \" AND summary LIKE '\"._es($SF[\"summary\"]).\"%' \\r\\n\";\n\t\tif (strlen($SF[\"text\"]))\t\t$sql .= \" AND full_text LIKE '\"._es($SF[\"text\"]).\"%' \\r\\n\";\n\t\tif (!empty($SF[\"status\"]) && isset($this->_articles_statuses[$SF[\"status\"]])) {\n\t\t \t$sql .= \" AND status = '\"._es($SF[\"status\"]).\"' \\r\\n\";\n\t\t}\n\t\tif (strlen($SF[\"nick\"]) || strlen($SF[\"account_type\"])) {\n\t\t\tif (strlen($SF[\"nick\"])) \t$users_sql .= \" AND nick LIKE '\"._es($SF[\"nick\"]).\"%' \\r\\n\";\n\t\t\tif ($SF[\"account_type\"])\t$users_sql .= \" AND `group` = \".intval($SF[\"account_type\"]).\" \\r\\n\";\n\t\t}\n\t\t// Add subquery to users table\n\t\tif (!empty($users_sql)) {\n\t\t\t$sql .= \" AND user_id IN( SELECT id FROM \".db('user').\" WHERE 1=1 \".$users_sql.\") \\r\\n\";\n\t\t}\n\t\t// Sorting here\n\t\tif ($SF[\"sort_by\"])\t\t\t \t$sql .= \" ORDER BY \".$this->_sort_by[$SF[\"sort_by\"]].\" \\r\\n\";\n\t\tif ($SF[\"sort_by\"] && strlen($SF[\"sort_order\"])) \t$sql .= \" \".$SF[\"sort_order\"].\" \\r\\n\";\n\t\treturn substr($sql, 0, -3);\n\t}", "protected function rawFilter($filter) {\n //Log::debug('query: ',$filter);\n\t\t// Build a query based on filter $filter\n\t\t$query = Pallet::query()\n ->select('Pallet.objectID', 'Pallet.Pallet_ID', 'Pallet.x', 'Pallet.y', 'Pallet.z', 'Pallet.Status')\n ->orderBy('Pallet_ID', 'asc');\n if(isset($filter['Pallet_ID']) && strlen($filter['Pallet_ID']) > 2) {\n $query->where('Pallet_ID', 'like', ltrim($filter['Pallet_ID'],'0') . '%');\n\t\t}\n\t\tif(isset($filter['Pallet_ID.prefix']) && is_array($filter['Pallet_ID.prefix'])) {\n $query->whereRaw(\"substring(Pallet_ID,1,3) in ('\".implode(\"','\", $filter['Pallet_ID.prefix']).\"')\");\n\t\t}\n if(isset($filter['Status']) && is_array($filter['Status'])) {\n $query->whereRaw(\"Status in ('\".implode(\"','\", $filter['Status']).\"')\");\n }\n elseif(isset($filter['Status']) && strlen($filter['Status']) > 3) {\n $query->where('Status', '=', $filter['Status']);\n }\n /*\n * container.parent should generate this sql request\n * select Pallet.* from Pallet join container plt on plt.objectID = Pallet.objectID where plt.parentID = 6213292055;\n */\n if(isset($filter['container.parent']) && strlen($filter['container.parent']) > 3) {\n $query\n ->join('container as plt', 'plt.objectID', '=', 'Pallet.objectID')\n ->where('plt.parentID',$filter['container.parent']);\n }\n /*\n * container.child should generate this sql request\n * select Pallet.* from Pallet join container gc on gc.parentID = Pallet.objectID where gc.objectID = 6226111054;\n */\n if(isset($filter['container.child']) && strlen($filter['container.child']) > 3) {\n $query\n ->join('container as gc', 'gc.parentID', '=', 'Pallet.objectID')\n ->where('gc.objectID',$filter['container.child']);\n }\n return $query;\n }", "function RestoreFilterList() {\n\n\t\t// Return if not reset filter\n\t\tif (@$_POST[\"cmd\"] <> \"resetfilter\")\n\t\t\treturn FALSE;\n\t\t$filter = json_decode(@$_POST[\"filter\"], TRUE);\n\t\t$this->Command = \"search\";\n\n\t\t// Field tanggal\n\t\t$this->tanggal->AdvancedSearch->SearchValue = @$filter[\"x_tanggal\"];\n\t\t$this->tanggal->AdvancedSearch->SearchOperator = @$filter[\"z_tanggal\"];\n\t\t$this->tanggal->AdvancedSearch->SearchCondition = @$filter[\"v_tanggal\"];\n\t\t$this->tanggal->AdvancedSearch->SearchValue2 = @$filter[\"y_tanggal\"];\n\t\t$this->tanggal->AdvancedSearch->SearchOperator2 = @$filter[\"w_tanggal\"];\n\t\t$this->tanggal->AdvancedSearch->Save();\n\n\t\t// Field auc_number\n\t\t$this->auc_number->AdvancedSearch->SearchValue = @$filter[\"x_auc_number\"];\n\t\t$this->auc_number->AdvancedSearch->SearchOperator = @$filter[\"z_auc_number\"];\n\t\t$this->auc_number->AdvancedSearch->SearchCondition = @$filter[\"v_auc_number\"];\n\t\t$this->auc_number->AdvancedSearch->SearchValue2 = @$filter[\"y_auc_number\"];\n\t\t$this->auc_number->AdvancedSearch->SearchOperator2 = @$filter[\"w_auc_number\"];\n\t\t$this->auc_number->AdvancedSearch->Save();\n\n\t\t// Field start_bid\n\t\t$this->start_bid->AdvancedSearch->SearchValue = @$filter[\"x_start_bid\"];\n\t\t$this->start_bid->AdvancedSearch->SearchOperator = @$filter[\"z_start_bid\"];\n\t\t$this->start_bid->AdvancedSearch->SearchCondition = @$filter[\"v_start_bid\"];\n\t\t$this->start_bid->AdvancedSearch->SearchValue2 = @$filter[\"y_start_bid\"];\n\t\t$this->start_bid->AdvancedSearch->SearchOperator2 = @$filter[\"w_start_bid\"];\n\t\t$this->start_bid->AdvancedSearch->Save();\n\n\t\t// Field close_bid\n\t\t$this->close_bid->AdvancedSearch->SearchValue = @$filter[\"x_close_bid\"];\n\t\t$this->close_bid->AdvancedSearch->SearchOperator = @$filter[\"z_close_bid\"];\n\t\t$this->close_bid->AdvancedSearch->SearchCondition = @$filter[\"v_close_bid\"];\n\t\t$this->close_bid->AdvancedSearch->SearchValue2 = @$filter[\"y_close_bid\"];\n\t\t$this->close_bid->AdvancedSearch->SearchOperator2 = @$filter[\"w_close_bid\"];\n\t\t$this->close_bid->AdvancedSearch->Save();\n\n\t\t// Field lot_number\n\t\t$this->lot_number->AdvancedSearch->SearchValue = @$filter[\"x_lot_number\"];\n\t\t$this->lot_number->AdvancedSearch->SearchOperator = @$filter[\"z_lot_number\"];\n\t\t$this->lot_number->AdvancedSearch->SearchCondition = @$filter[\"v_lot_number\"];\n\t\t$this->lot_number->AdvancedSearch->SearchValue2 = @$filter[\"y_lot_number\"];\n\t\t$this->lot_number->AdvancedSearch->SearchOperator2 = @$filter[\"w_lot_number\"];\n\t\t$this->lot_number->AdvancedSearch->Save();\n\n\t\t// Field chop\n\t\t$this->chop->AdvancedSearch->SearchValue = @$filter[\"x_chop\"];\n\t\t$this->chop->AdvancedSearch->SearchOperator = @$filter[\"z_chop\"];\n\t\t$this->chop->AdvancedSearch->SearchCondition = @$filter[\"v_chop\"];\n\t\t$this->chop->AdvancedSearch->SearchValue2 = @$filter[\"y_chop\"];\n\t\t$this->chop->AdvancedSearch->SearchOperator2 = @$filter[\"w_chop\"];\n\t\t$this->chop->AdvancedSearch->Save();\n\n\t\t// Field grade\n\t\t$this->grade->AdvancedSearch->SearchValue = @$filter[\"x_grade\"];\n\t\t$this->grade->AdvancedSearch->SearchOperator = @$filter[\"z_grade\"];\n\t\t$this->grade->AdvancedSearch->SearchCondition = @$filter[\"v_grade\"];\n\t\t$this->grade->AdvancedSearch->SearchValue2 = @$filter[\"y_grade\"];\n\t\t$this->grade->AdvancedSearch->SearchOperator2 = @$filter[\"w_grade\"];\n\t\t$this->grade->AdvancedSearch->Save();\n\n\t\t// Field estate\n\t\t$this->estate->AdvancedSearch->SearchValue = @$filter[\"x_estate\"];\n\t\t$this->estate->AdvancedSearch->SearchOperator = @$filter[\"z_estate\"];\n\t\t$this->estate->AdvancedSearch->SearchCondition = @$filter[\"v_estate\"];\n\t\t$this->estate->AdvancedSearch->SearchValue2 = @$filter[\"y_estate\"];\n\t\t$this->estate->AdvancedSearch->SearchOperator2 = @$filter[\"w_estate\"];\n\t\t$this->estate->AdvancedSearch->Save();\n\n\t\t// Field sack\n\t\t$this->sack->AdvancedSearch->SearchValue = @$filter[\"x_sack\"];\n\t\t$this->sack->AdvancedSearch->SearchOperator = @$filter[\"z_sack\"];\n\t\t$this->sack->AdvancedSearch->SearchCondition = @$filter[\"v_sack\"];\n\t\t$this->sack->AdvancedSearch->SearchValue2 = @$filter[\"y_sack\"];\n\t\t$this->sack->AdvancedSearch->SearchOperator2 = @$filter[\"w_sack\"];\n\t\t$this->sack->AdvancedSearch->Save();\n\n\t\t// Field netto\n\t\t$this->netto->AdvancedSearch->SearchValue = @$filter[\"x_netto\"];\n\t\t$this->netto->AdvancedSearch->SearchOperator = @$filter[\"z_netto\"];\n\t\t$this->netto->AdvancedSearch->SearchCondition = @$filter[\"v_netto\"];\n\t\t$this->netto->AdvancedSearch->SearchValue2 = @$filter[\"y_netto\"];\n\t\t$this->netto->AdvancedSearch->SearchOperator2 = @$filter[\"w_netto\"];\n\t\t$this->netto->AdvancedSearch->Save();\n\n\t\t// Field open_bid\n\t\t$this->open_bid->AdvancedSearch->SearchValue = @$filter[\"x_open_bid\"];\n\t\t$this->open_bid->AdvancedSearch->SearchOperator = @$filter[\"z_open_bid\"];\n\t\t$this->open_bid->AdvancedSearch->SearchCondition = @$filter[\"v_open_bid\"];\n\t\t$this->open_bid->AdvancedSearch->SearchValue2 = @$filter[\"y_open_bid\"];\n\t\t$this->open_bid->AdvancedSearch->SearchOperator2 = @$filter[\"w_open_bid\"];\n\t\t$this->open_bid->AdvancedSearch->Save();\n\n\t\t// Field last_bid\n\t\t$this->last_bid->AdvancedSearch->SearchValue = @$filter[\"x_last_bid\"];\n\t\t$this->last_bid->AdvancedSearch->SearchOperator = @$filter[\"z_last_bid\"];\n\t\t$this->last_bid->AdvancedSearch->SearchCondition = @$filter[\"v_last_bid\"];\n\t\t$this->last_bid->AdvancedSearch->SearchValue2 = @$filter[\"y_last_bid\"];\n\t\t$this->last_bid->AdvancedSearch->SearchOperator2 = @$filter[\"w_last_bid\"];\n\t\t$this->last_bid->AdvancedSearch->Save();\n\n\t\t// Field highest_bid\n\t\t$this->highest_bid->AdvancedSearch->SearchValue = @$filter[\"x_highest_bid\"];\n\t\t$this->highest_bid->AdvancedSearch->SearchOperator = @$filter[\"z_highest_bid\"];\n\t\t$this->highest_bid->AdvancedSearch->SearchCondition = @$filter[\"v_highest_bid\"];\n\t\t$this->highest_bid->AdvancedSearch->SearchValue2 = @$filter[\"y_highest_bid\"];\n\t\t$this->highest_bid->AdvancedSearch->SearchOperator2 = @$filter[\"w_highest_bid\"];\n\t\t$this->highest_bid->AdvancedSearch->Save();\n\n\t\t// Field enter_bid\n\t\t$this->enter_bid->AdvancedSearch->SearchValue = @$filter[\"x_enter_bid\"];\n\t\t$this->enter_bid->AdvancedSearch->SearchOperator = @$filter[\"z_enter_bid\"];\n\t\t$this->enter_bid->AdvancedSearch->SearchCondition = @$filter[\"v_enter_bid\"];\n\t\t$this->enter_bid->AdvancedSearch->SearchValue2 = @$filter[\"y_enter_bid\"];\n\t\t$this->enter_bid->AdvancedSearch->SearchOperator2 = @$filter[\"w_enter_bid\"];\n\t\t$this->enter_bid->AdvancedSearch->Save();\n\n\t\t// Field auction_status\n\t\t$this->auction_status->AdvancedSearch->SearchValue = @$filter[\"x_auction_status\"];\n\t\t$this->auction_status->AdvancedSearch->SearchOperator = @$filter[\"z_auction_status\"];\n\t\t$this->auction_status->AdvancedSearch->SearchCondition = @$filter[\"v_auction_status\"];\n\t\t$this->auction_status->AdvancedSearch->SearchValue2 = @$filter[\"y_auction_status\"];\n\t\t$this->auction_status->AdvancedSearch->SearchOperator2 = @$filter[\"w_auction_status\"];\n\t\t$this->auction_status->AdvancedSearch->Save();\n\n\t\t// Field gross\n\t\t$this->gross->AdvancedSearch->SearchValue = @$filter[\"x_gross\"];\n\t\t$this->gross->AdvancedSearch->SearchOperator = @$filter[\"z_gross\"];\n\t\t$this->gross->AdvancedSearch->SearchCondition = @$filter[\"v_gross\"];\n\t\t$this->gross->AdvancedSearch->SearchValue2 = @$filter[\"y_gross\"];\n\t\t$this->gross->AdvancedSearch->SearchOperator2 = @$filter[\"w_gross\"];\n\t\t$this->gross->AdvancedSearch->Save();\n\n\t\t// Field row_id\n\t\t$this->row_id->AdvancedSearch->SearchValue = @$filter[\"x_row_id\"];\n\t\t$this->row_id->AdvancedSearch->SearchOperator = @$filter[\"z_row_id\"];\n\t\t$this->row_id->AdvancedSearch->SearchCondition = @$filter[\"v_row_id\"];\n\t\t$this->row_id->AdvancedSearch->SearchValue2 = @$filter[\"y_row_id\"];\n\t\t$this->row_id->AdvancedSearch->SearchOperator2 = @$filter[\"w_row_id\"];\n\t\t$this->row_id->AdvancedSearch->Save();\n\t\t$this->BasicSearch->setKeyword(@$filter[EW_TABLE_BASIC_SEARCH]);\n\t\t$this->BasicSearch->setType(@$filter[EW_TABLE_BASIC_SEARCH_TYPE]);\n\t}", "public function filtering();", "function _prepareFilter(&$controller){\n \t\n\t\t$filter = array();\n if(isset($controller->data)){\n foreach($controller->data as $model=>$fields){\n foreach($fields as $key=>$field){\n if($field == ''){\n unset($controller->data[$model][$key]);\n }\n }\n }\n \n App::import('Sanitize');\n $sanit = new Sanitize();\n $controller->data = $sanit->clean($controller->data);\n $filter = $controller->data;\n }\n \n if (empty($filter)){\n \t\t$filter = $this->_checkParams($controller); \t\n }\n $controller->data = $filter;\n }", "private function loadFiltersFromQuery(): void\n {\n $request = RequestUtil::getMainRequest($this->requestStack) ?? Request::createFromGlobals();\n $requestFilters = $request->query->all('filter');\n\n if (is_array($requestFilters)) {\n foreach ($requestFilters as $name => $limitations) {\n foreach ($limitations as $comparison => $value) {\n $filterField = new FilterField();\n $filterField->setName($name)\n ->setValue($value)\n ->setComparison($comparison)\n ->setFilter($this->getFilterByName($name));\n\n $this->filterFields[] = $filterField;\n }\n }\n }\n }", "public function getFilterParameters(): array;", "public function getFiltersAttribute($value) {\n return json_decode($value, true);\n }", "function _create_filter_sql () {\n\t\t$SF = &$_SESSION[$this->_filter_name];\n\t\tforeach ((array)$SF as $k => $v) $SF[$k] = trim($v);\n\t\t// Generate filter for the common fileds\n\t\tif (strlen($SF[\"text\"]))\t\t$sql .= \" AND text LIKE '%\"._es($SF[\"text\"]).\"%' \\r\\n\";\n\t\tif (strlen($SF[\"engine\"]))\t\t$sql .= \" AND engine=\".intval($SF[\"engine\"]).\" \\r\\n\";\n\t\treturn substr($sql, 0, -3);\n\t}", "function initDataFilters() {\n try {\n $engine = defined('DB_CAN_TRANSACT') && DB_CAN_TRANSACT ? 'InnoDB' : 'MyISAM';\n\n DB::execute(\"CREATE TABLE \" . TABLE_PREFIX . \"data_filters (\n id int unsigned NOT NULL auto_increment,\n type varchar(150) NOT NULL DEFAULT 'DataFilter',\n name varchar(50) DEFAULT NULL,\n raw_additional_properties longtext ,\n created_on datetime DEFAULT NULL,\n created_by_id int(10) unsigned NULL DEFAULT NULL,\n created_by_name varchar(100) DEFAULT NULL,\n created_by_email varchar(150) DEFAULT NULL,\n is_private tinyint(1) unsigned NOT NULL DEFAULT '0',\n PRIMARY KEY (id),\n INDEX type (type),\n INDEX created_by_id (created_by_id),\n INDEX name (name)\n ) ENGINE=$engine DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;\");\n } catch(Exception $e) {\n return $e->getMessage();\n } // try\n\n return true;\n }", "public function decode($data) {}", "public function decode($data) {}", "public function decode($data) {}", "public function decode($data) {}", "public function decode($data) {}", "public static function _tableFilters($filters) {\n\t\t$advansed_filters = array();\n\t\t$show_advansed_filters = false;\n\n\t\tforeach ($filters as $key => $filter) {\n\n\t\t\tif ($filter->hidden) {\n\t\t\t\tunset($filters[$key]);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t\n\t\t\tif ($filter->advansed == true) {\n\t\t\t\t// Show advansed filters if there have input values\n\t\t\t\tif (!empty($filter->value)) $show_advansed_filters = true;\t\t\t\t\n\t\t\t\t// Copy filter to advansed array\n\t\t\t\t$advansed_filters[] = $filter;\n\t\t\t\t// Delete this filter from main array\n\t\t\t\tunset($filters[$key]);\n\t\t\t}\n\n\t\t}\n\t\t\n\t\tif (!count($filters)) {\n\t\t\treturn '';\n\t\t}\n\n\t\t$result = '<div class=\"block-filters\">';\t\t\n\t\t$result .= '<div class=\"block-title\">Фильтры</div>';\n\t\t$result .= '<form method=\"post\" name=\"filtersForm\" id=\"filtersForm\" action=\"'.$_SERVER['SCRIPT_URL'].'\">';\n\n\t\t// Main filters array\n\t\tforeach ($filters as $filter) {\n\n\t\t\t$result .= '<div class=\"block-item\">';\n\n\t\t\tif (count($filter->values)) {\n\n\t\t\t\t$result .= '<label>'.$filter->title.':</label><br />';\n\t\t\t\t$result .= '<select name=\"filters['.$filter->name.']\" onchange=\"filtersForm.submit()\">';\t\t\t\t\n\n\t\t\t\t\tif ($filter->first_empty_value)\n\t\t\t\t\t\t$result .= '<option value=\"\">Все</option>';\t\t\t\t\t\n\n\t\t\t\t\tforeach ($filter->values as $key => $value) {\n\n\t\t\t\t\t\t$selected = '';\n\n\t\t\t\t\t\tif ($filter->value == $key) {\n\t\t\t\t\t\t\t$selected = 'selected';\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t$result .= '<option value=\"'.$key.'\" '.$selected.'>'.$value.'</option>';\n\t\t\t\t\t}\t\t\t\t\t\n\n\t\t\t\t$result .= '</select>';\n\n\t\t\t} else {\n\t\t\t\t\n\t\t\t\t$result .= '<label>'.$filter->title.':</label><br />';\n\t\t\t\t$result .= '<input type=\"text\" name=\"filters['.$filter->name.']\" value=\"'.$filter->value.'\" />';\n\n\t\t\t}\n\n\t\t\t$result .= '</div>'; #block-item\n\n\t\t}\n\n\t\t$result .= '<div class=\"clr\"></div>';\n\n\t\t// Advansed filters array\n\t\tif ($show_advansed_filters) {\n\t\t\t$result .= '<div class=\"advansed_filters\" style=\"display:block;\">';\t\n\t\t} else {\n\t\t\t$result .= '<div class=\"advansed_filters\" style=\"display:none;\">';\t\n\t\t}\t\t\n\t\t\n\t\tforeach ($advansed_filters as $filter) {\n\n\t\t\t$result .= '<div class=\"block-item\">'; #block-item \n\n\t\t\tif (count($filter->values)) {\n\n\t\t\t\t$result .= '<label>'.$filter->title.':</label><br />';\n\t\t\t\t$result .= '<select name=\"filters['.$filter->name.']\" onchange=\"filtersForm.submit()\">';\t\t\t\t\n\n\t\t\t\t\tif ($filter->first_empty_value)\n\t\t\t\t\t\t$result .= '<option value=\"\">Все</option>';\t\t\t\t\t\n\n\t\t\t\t\tforeach ($filter->values as $key => $value) {\n\n\t\t\t\t\t\t$selected = '';\n\n\t\t\t\t\t\tif ($filter->value == $key) {\n\t\t\t\t\t\t\t$selected = 'selected';\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t$result .= '<option value=\"'.$key.'\" '.$selected.'>'.$value.'</option>';\n\t\t\t\t\t}\t\t\t\t\t\n\n\t\t\t\t$result .= '</select>';\n\n\t\t\t} else {\n\t\t\t\t\n\t\t\t\t$result .= '<label>'.$filter->title.':</label><br />';\n\t\t\t\t$result .= '<input type=\"text\" name=\"filters['.$filter->name.']\" value=\"'.$filter->value.'\" />';\n\n\t\t\t}\n\n\t\t\t$result .= '</div>'; #block-item\n\n\t\t}\n\n\t\t$result .= '</div>';\n\n\t\t$result .= '<div class=\"clr\"></div>';\t\n\n\t\t$result .= '<input type=\"hidden\" name=\"limitstart\" value=\"0\" />';\t\n\t\t$result .= '<input type=\"submit\" value=\"Искать\" />';\t\t\n\t\t$result .= '<input type=\"button\" value=\"Очистить\" class=\"form-reset\" />';\n\n\t\tif (count($advansed_filters)) {\n\t\t\t$result .= '<input type=\"button\" value=\"Расширенный фильтр\" class=\"toggle_advansed_filters\" />';\t\n\t\t}\t\n\t\t\n\t\t$result .= '</form>';\n\t\t$result .= '</div>';\n\n\t\treturn $result;\t\t\n\n\t}", "public static function alm_get_all_filters(){\n global $wpdb;\n \t$prefix = esc_sql( ALM_FILTERS_PREFIX );\n \t$options = $wpdb->options;\n \t$t = esc_sql( \"$prefix%\" );\n \t$sql = $wpdb -> prepare ( \"SELECT option_name FROM $options WHERE option_name LIKE '%s'\", $t );\n \t$filters = $wpdb -> get_col( $sql );\n\n \t$filters = ALMFilters::alm_remove_filter_license_options($filters);\n\n \treturn $filters;\n }", "public function get_filters() {\n $filters = new stdClass();\n\n $filters->path = $this->path;\n $filters->column = $this->column;\n $filters->direction = $this->direction;\n $filters->page = $this->page;\n\n return $filters;\n }", "public function getFilters() \n {\n return $this->filters;\n }", "function kses_init_filters()\n {\n }", "function RestoreFilterList() {\n\n\t\t// Return if not reset filter\n\t\tif (@$_POST[\"cmd\"] <> \"resetfilter\")\n\t\t\treturn FALSE;\n\t\t$filter = json_decode(@$_POST[\"filter\"], TRUE);\n\t\t$this->Command = \"search\";\n\n\t\t// Field id\n\t\t$this->id->AdvancedSearch->SearchValue = @$filter[\"x_id\"];\n\t\t$this->id->AdvancedSearch->SearchOperator = @$filter[\"z_id\"];\n\t\t$this->id->AdvancedSearch->SearchCondition = @$filter[\"v_id\"];\n\t\t$this->id->AdvancedSearch->SearchValue2 = @$filter[\"y_id\"];\n\t\t$this->id->AdvancedSearch->SearchOperator2 = @$filter[\"w_id\"];\n\t\t$this->id->AdvancedSearch->Save();\n\n\t\t// Field fecha_tamizaje\n\t\t$this->fecha_tamizaje->AdvancedSearch->SearchValue = @$filter[\"x_fecha_tamizaje\"];\n\t\t$this->fecha_tamizaje->AdvancedSearch->SearchOperator = @$filter[\"z_fecha_tamizaje\"];\n\t\t$this->fecha_tamizaje->AdvancedSearch->SearchCondition = @$filter[\"v_fecha_tamizaje\"];\n\t\t$this->fecha_tamizaje->AdvancedSearch->SearchValue2 = @$filter[\"y_fecha_tamizaje\"];\n\t\t$this->fecha_tamizaje->AdvancedSearch->SearchOperator2 = @$filter[\"w_fecha_tamizaje\"];\n\t\t$this->fecha_tamizaje->AdvancedSearch->Save();\n\n\t\t// Field id_centro\n\t\t$this->id_centro->AdvancedSearch->SearchValue = @$filter[\"x_id_centro\"];\n\t\t$this->id_centro->AdvancedSearch->SearchOperator = @$filter[\"z_id_centro\"];\n\t\t$this->id_centro->AdvancedSearch->SearchCondition = @$filter[\"v_id_centro\"];\n\t\t$this->id_centro->AdvancedSearch->SearchValue2 = @$filter[\"y_id_centro\"];\n\t\t$this->id_centro->AdvancedSearch->SearchOperator2 = @$filter[\"w_id_centro\"];\n\t\t$this->id_centro->AdvancedSearch->Save();\n\n\t\t// Field apellidopaterno\n\t\t$this->apellidopaterno->AdvancedSearch->SearchValue = @$filter[\"x_apellidopaterno\"];\n\t\t$this->apellidopaterno->AdvancedSearch->SearchOperator = @$filter[\"z_apellidopaterno\"];\n\t\t$this->apellidopaterno->AdvancedSearch->SearchCondition = @$filter[\"v_apellidopaterno\"];\n\t\t$this->apellidopaterno->AdvancedSearch->SearchValue2 = @$filter[\"y_apellidopaterno\"];\n\t\t$this->apellidopaterno->AdvancedSearch->SearchOperator2 = @$filter[\"w_apellidopaterno\"];\n\t\t$this->apellidopaterno->AdvancedSearch->Save();\n\n\t\t// Field apellidomaterno\n\t\t$this->apellidomaterno->AdvancedSearch->SearchValue = @$filter[\"x_apellidomaterno\"];\n\t\t$this->apellidomaterno->AdvancedSearch->SearchOperator = @$filter[\"z_apellidomaterno\"];\n\t\t$this->apellidomaterno->AdvancedSearch->SearchCondition = @$filter[\"v_apellidomaterno\"];\n\t\t$this->apellidomaterno->AdvancedSearch->SearchValue2 = @$filter[\"y_apellidomaterno\"];\n\t\t$this->apellidomaterno->AdvancedSearch->SearchOperator2 = @$filter[\"w_apellidomaterno\"];\n\t\t$this->apellidomaterno->AdvancedSearch->Save();\n\n\t\t// Field nombre\n\t\t$this->nombre->AdvancedSearch->SearchValue = @$filter[\"x_nombre\"];\n\t\t$this->nombre->AdvancedSearch->SearchOperator = @$filter[\"z_nombre\"];\n\t\t$this->nombre->AdvancedSearch->SearchCondition = @$filter[\"v_nombre\"];\n\t\t$this->nombre->AdvancedSearch->SearchValue2 = @$filter[\"y_nombre\"];\n\t\t$this->nombre->AdvancedSearch->SearchOperator2 = @$filter[\"w_nombre\"];\n\t\t$this->nombre->AdvancedSearch->Save();\n\n\t\t// Field ci\n\t\t$this->ci->AdvancedSearch->SearchValue = @$filter[\"x_ci\"];\n\t\t$this->ci->AdvancedSearch->SearchOperator = @$filter[\"z_ci\"];\n\t\t$this->ci->AdvancedSearch->SearchCondition = @$filter[\"v_ci\"];\n\t\t$this->ci->AdvancedSearch->SearchValue2 = @$filter[\"y_ci\"];\n\t\t$this->ci->AdvancedSearch->SearchOperator2 = @$filter[\"w_ci\"];\n\t\t$this->ci->AdvancedSearch->Save();\n\n\t\t// Field fecha_nacimiento\n\t\t$this->fecha_nacimiento->AdvancedSearch->SearchValue = @$filter[\"x_fecha_nacimiento\"];\n\t\t$this->fecha_nacimiento->AdvancedSearch->SearchOperator = @$filter[\"z_fecha_nacimiento\"];\n\t\t$this->fecha_nacimiento->AdvancedSearch->SearchCondition = @$filter[\"v_fecha_nacimiento\"];\n\t\t$this->fecha_nacimiento->AdvancedSearch->SearchValue2 = @$filter[\"y_fecha_nacimiento\"];\n\t\t$this->fecha_nacimiento->AdvancedSearch->SearchOperator2 = @$filter[\"w_fecha_nacimiento\"];\n\t\t$this->fecha_nacimiento->AdvancedSearch->Save();\n\n\t\t// Field dias\n\t\t$this->dias->AdvancedSearch->SearchValue = @$filter[\"x_dias\"];\n\t\t$this->dias->AdvancedSearch->SearchOperator = @$filter[\"z_dias\"];\n\t\t$this->dias->AdvancedSearch->SearchCondition = @$filter[\"v_dias\"];\n\t\t$this->dias->AdvancedSearch->SearchValue2 = @$filter[\"y_dias\"];\n\t\t$this->dias->AdvancedSearch->SearchOperator2 = @$filter[\"w_dias\"];\n\t\t$this->dias->AdvancedSearch->Save();\n\n\t\t// Field semanas\n\t\t$this->semanas->AdvancedSearch->SearchValue = @$filter[\"x_semanas\"];\n\t\t$this->semanas->AdvancedSearch->SearchOperator = @$filter[\"z_semanas\"];\n\t\t$this->semanas->AdvancedSearch->SearchCondition = @$filter[\"v_semanas\"];\n\t\t$this->semanas->AdvancedSearch->SearchValue2 = @$filter[\"y_semanas\"];\n\t\t$this->semanas->AdvancedSearch->SearchOperator2 = @$filter[\"w_semanas\"];\n\t\t$this->semanas->AdvancedSearch->Save();\n\n\t\t// Field meses\n\t\t$this->meses->AdvancedSearch->SearchValue = @$filter[\"x_meses\"];\n\t\t$this->meses->AdvancedSearch->SearchOperator = @$filter[\"z_meses\"];\n\t\t$this->meses->AdvancedSearch->SearchCondition = @$filter[\"v_meses\"];\n\t\t$this->meses->AdvancedSearch->SearchValue2 = @$filter[\"y_meses\"];\n\t\t$this->meses->AdvancedSearch->SearchOperator2 = @$filter[\"w_meses\"];\n\t\t$this->meses->AdvancedSearch->Save();\n\n\t\t// Field sexo\n\t\t$this->sexo->AdvancedSearch->SearchValue = @$filter[\"x_sexo\"];\n\t\t$this->sexo->AdvancedSearch->SearchOperator = @$filter[\"z_sexo\"];\n\t\t$this->sexo->AdvancedSearch->SearchCondition = @$filter[\"v_sexo\"];\n\t\t$this->sexo->AdvancedSearch->SearchValue2 = @$filter[\"y_sexo\"];\n\t\t$this->sexo->AdvancedSearch->SearchOperator2 = @$filter[\"w_sexo\"];\n\t\t$this->sexo->AdvancedSearch->Save();\n\n\t\t// Field discapacidad\n\t\t$this->discapacidad->AdvancedSearch->SearchValue = @$filter[\"x_discapacidad\"];\n\t\t$this->discapacidad->AdvancedSearch->SearchOperator = @$filter[\"z_discapacidad\"];\n\t\t$this->discapacidad->AdvancedSearch->SearchCondition = @$filter[\"v_discapacidad\"];\n\t\t$this->discapacidad->AdvancedSearch->SearchValue2 = @$filter[\"y_discapacidad\"];\n\t\t$this->discapacidad->AdvancedSearch->SearchOperator2 = @$filter[\"w_discapacidad\"];\n\t\t$this->discapacidad->AdvancedSearch->Save();\n\n\t\t// Field id_tipodiscapacidad\n\t\t$this->id_tipodiscapacidad->AdvancedSearch->SearchValue = @$filter[\"x_id_tipodiscapacidad\"];\n\t\t$this->id_tipodiscapacidad->AdvancedSearch->SearchOperator = @$filter[\"z_id_tipodiscapacidad\"];\n\t\t$this->id_tipodiscapacidad->AdvancedSearch->SearchCondition = @$filter[\"v_id_tipodiscapacidad\"];\n\t\t$this->id_tipodiscapacidad->AdvancedSearch->SearchValue2 = @$filter[\"y_id_tipodiscapacidad\"];\n\t\t$this->id_tipodiscapacidad->AdvancedSearch->SearchOperator2 = @$filter[\"w_id_tipodiscapacidad\"];\n\t\t$this->id_tipodiscapacidad->AdvancedSearch->Save();\n\n\t\t// Field resultado\n\t\t$this->resultado->AdvancedSearch->SearchValue = @$filter[\"x_resultado\"];\n\t\t$this->resultado->AdvancedSearch->SearchOperator = @$filter[\"z_resultado\"];\n\t\t$this->resultado->AdvancedSearch->SearchCondition = @$filter[\"v_resultado\"];\n\t\t$this->resultado->AdvancedSearch->SearchValue2 = @$filter[\"y_resultado\"];\n\t\t$this->resultado->AdvancedSearch->SearchOperator2 = @$filter[\"w_resultado\"];\n\t\t$this->resultado->AdvancedSearch->Save();\n\n\t\t// Field resultadotamizaje\n\t\t$this->resultadotamizaje->AdvancedSearch->SearchValue = @$filter[\"x_resultadotamizaje\"];\n\t\t$this->resultadotamizaje->AdvancedSearch->SearchOperator = @$filter[\"z_resultadotamizaje\"];\n\t\t$this->resultadotamizaje->AdvancedSearch->SearchCondition = @$filter[\"v_resultadotamizaje\"];\n\t\t$this->resultadotamizaje->AdvancedSearch->SearchValue2 = @$filter[\"y_resultadotamizaje\"];\n\t\t$this->resultadotamizaje->AdvancedSearch->SearchOperator2 = @$filter[\"w_resultadotamizaje\"];\n\t\t$this->resultadotamizaje->AdvancedSearch->Save();\n\n\t\t// Field tapon\n\t\t$this->tapon->AdvancedSearch->SearchValue = @$filter[\"x_tapon\"];\n\t\t$this->tapon->AdvancedSearch->SearchOperator = @$filter[\"z_tapon\"];\n\t\t$this->tapon->AdvancedSearch->SearchCondition = @$filter[\"v_tapon\"];\n\t\t$this->tapon->AdvancedSearch->SearchValue2 = @$filter[\"y_tapon\"];\n\t\t$this->tapon->AdvancedSearch->SearchOperator2 = @$filter[\"w_tapon\"];\n\t\t$this->tapon->AdvancedSearch->Save();\n\n\t\t// Field tipo\n\t\t$this->tipo->AdvancedSearch->SearchValue = @$filter[\"x_tipo\"];\n\t\t$this->tipo->AdvancedSearch->SearchOperator = @$filter[\"z_tipo\"];\n\t\t$this->tipo->AdvancedSearch->SearchCondition = @$filter[\"v_tipo\"];\n\t\t$this->tipo->AdvancedSearch->SearchValue2 = @$filter[\"y_tipo\"];\n\t\t$this->tipo->AdvancedSearch->SearchOperator2 = @$filter[\"w_tipo\"];\n\t\t$this->tipo->AdvancedSearch->Save();\n\n\t\t// Field repetirprueba\n\t\t$this->repetirprueba->AdvancedSearch->SearchValue = @$filter[\"x_repetirprueba\"];\n\t\t$this->repetirprueba->AdvancedSearch->SearchOperator = @$filter[\"z_repetirprueba\"];\n\t\t$this->repetirprueba->AdvancedSearch->SearchCondition = @$filter[\"v_repetirprueba\"];\n\t\t$this->repetirprueba->AdvancedSearch->SearchValue2 = @$filter[\"y_repetirprueba\"];\n\t\t$this->repetirprueba->AdvancedSearch->SearchOperator2 = @$filter[\"w_repetirprueba\"];\n\t\t$this->repetirprueba->AdvancedSearch->Save();\n\n\t\t// Field observaciones\n\t\t$this->observaciones->AdvancedSearch->SearchValue = @$filter[\"x_observaciones\"];\n\t\t$this->observaciones->AdvancedSearch->SearchOperator = @$filter[\"z_observaciones\"];\n\t\t$this->observaciones->AdvancedSearch->SearchCondition = @$filter[\"v_observaciones\"];\n\t\t$this->observaciones->AdvancedSearch->SearchValue2 = @$filter[\"y_observaciones\"];\n\t\t$this->observaciones->AdvancedSearch->SearchOperator2 = @$filter[\"w_observaciones\"];\n\t\t$this->observaciones->AdvancedSearch->Save();\n\n\t\t// Field id_apoderado\n\t\t$this->id_apoderado->AdvancedSearch->SearchValue = @$filter[\"x_id_apoderado\"];\n\t\t$this->id_apoderado->AdvancedSearch->SearchOperator = @$filter[\"z_id_apoderado\"];\n\t\t$this->id_apoderado->AdvancedSearch->SearchCondition = @$filter[\"v_id_apoderado\"];\n\t\t$this->id_apoderado->AdvancedSearch->SearchValue2 = @$filter[\"y_id_apoderado\"];\n\t\t$this->id_apoderado->AdvancedSearch->SearchOperator2 = @$filter[\"w_id_apoderado\"];\n\t\t$this->id_apoderado->AdvancedSearch->Save();\n\n\t\t// Field id_referencia\n\t\t$this->id_referencia->AdvancedSearch->SearchValue = @$filter[\"x_id_referencia\"];\n\t\t$this->id_referencia->AdvancedSearch->SearchOperator = @$filter[\"z_id_referencia\"];\n\t\t$this->id_referencia->AdvancedSearch->SearchCondition = @$filter[\"v_id_referencia\"];\n\t\t$this->id_referencia->AdvancedSearch->SearchValue2 = @$filter[\"y_id_referencia\"];\n\t\t$this->id_referencia->AdvancedSearch->SearchOperator2 = @$filter[\"w_id_referencia\"];\n\t\t$this->id_referencia->AdvancedSearch->Save();\n\t}", "function RestoreFilterList() {\n\n\t\t// Return if not reset filter\n\t\tif (@$_POST[\"cmd\"] <> \"resetfilter\")\n\t\t\treturn FALSE;\n\t\t$filter = json_decode(ew_StripSlashes(@$_POST[\"filter\"]), TRUE);\n\t\t$this->Command = \"search\";\n\n\t\t// Field tgl\n\t\t$this->tgl->AdvancedSearch->SearchValue = @$filter[\"x_tgl\"];\n\t\t$this->tgl->AdvancedSearch->SearchOperator = @$filter[\"z_tgl\"];\n\t\t$this->tgl->AdvancedSearch->SearchCondition = @$filter[\"v_tgl\"];\n\t\t$this->tgl->AdvancedSearch->SearchValue2 = @$filter[\"y_tgl\"];\n\t\t$this->tgl->AdvancedSearch->SearchOperator2 = @$filter[\"w_tgl\"];\n\t\t$this->tgl->AdvancedSearch->Save();\n\n\t\t// Field no_spp\n\t\t$this->no_spp->AdvancedSearch->SearchValue = @$filter[\"x_no_spp\"];\n\t\t$this->no_spp->AdvancedSearch->SearchOperator = @$filter[\"z_no_spp\"];\n\t\t$this->no_spp->AdvancedSearch->SearchCondition = @$filter[\"v_no_spp\"];\n\t\t$this->no_spp->AdvancedSearch->SearchValue2 = @$filter[\"y_no_spp\"];\n\t\t$this->no_spp->AdvancedSearch->SearchOperator2 = @$filter[\"w_no_spp\"];\n\t\t$this->no_spp->AdvancedSearch->Save();\n\n\t\t// Field jns_spp\n\t\t$this->jns_spp->AdvancedSearch->SearchValue = @$filter[\"x_jns_spp\"];\n\t\t$this->jns_spp->AdvancedSearch->SearchOperator = @$filter[\"z_jns_spp\"];\n\t\t$this->jns_spp->AdvancedSearch->SearchCondition = @$filter[\"v_jns_spp\"];\n\t\t$this->jns_spp->AdvancedSearch->SearchValue2 = @$filter[\"y_jns_spp\"];\n\t\t$this->jns_spp->AdvancedSearch->SearchOperator2 = @$filter[\"w_jns_spp\"];\n\t\t$this->jns_spp->AdvancedSearch->Save();\n\n\t\t// Field kd_mata\n\t\t$this->kd_mata->AdvancedSearch->SearchValue = @$filter[\"x_kd_mata\"];\n\t\t$this->kd_mata->AdvancedSearch->SearchOperator = @$filter[\"z_kd_mata\"];\n\t\t$this->kd_mata->AdvancedSearch->SearchCondition = @$filter[\"v_kd_mata\"];\n\t\t$this->kd_mata->AdvancedSearch->SearchValue2 = @$filter[\"y_kd_mata\"];\n\t\t$this->kd_mata->AdvancedSearch->SearchOperator2 = @$filter[\"w_kd_mata\"];\n\t\t$this->kd_mata->AdvancedSearch->Save();\n\n\t\t// Field urai\n\t\t$this->urai->AdvancedSearch->SearchValue = @$filter[\"x_urai\"];\n\t\t$this->urai->AdvancedSearch->SearchOperator = @$filter[\"z_urai\"];\n\t\t$this->urai->AdvancedSearch->SearchCondition = @$filter[\"v_urai\"];\n\t\t$this->urai->AdvancedSearch->SearchValue2 = @$filter[\"y_urai\"];\n\t\t$this->urai->AdvancedSearch->SearchOperator2 = @$filter[\"w_urai\"];\n\t\t$this->urai->AdvancedSearch->Save();\n\n\t\t// Field jmlh\n\t\t$this->jmlh->AdvancedSearch->SearchValue = @$filter[\"x_jmlh\"];\n\t\t$this->jmlh->AdvancedSearch->SearchOperator = @$filter[\"z_jmlh\"];\n\t\t$this->jmlh->AdvancedSearch->SearchCondition = @$filter[\"v_jmlh\"];\n\t\t$this->jmlh->AdvancedSearch->SearchValue2 = @$filter[\"y_jmlh\"];\n\t\t$this->jmlh->AdvancedSearch->SearchOperator2 = @$filter[\"w_jmlh\"];\n\t\t$this->jmlh->AdvancedSearch->Save();\n\n\t\t// Field jmlh1\n\t\t$this->jmlh1->AdvancedSearch->SearchValue = @$filter[\"x_jmlh1\"];\n\t\t$this->jmlh1->AdvancedSearch->SearchOperator = @$filter[\"z_jmlh1\"];\n\t\t$this->jmlh1->AdvancedSearch->SearchCondition = @$filter[\"v_jmlh1\"];\n\t\t$this->jmlh1->AdvancedSearch->SearchValue2 = @$filter[\"y_jmlh1\"];\n\t\t$this->jmlh1->AdvancedSearch->SearchOperator2 = @$filter[\"w_jmlh1\"];\n\t\t$this->jmlh1->AdvancedSearch->Save();\n\n\t\t// Field jmlh2\n\t\t$this->jmlh2->AdvancedSearch->SearchValue = @$filter[\"x_jmlh2\"];\n\t\t$this->jmlh2->AdvancedSearch->SearchOperator = @$filter[\"z_jmlh2\"];\n\t\t$this->jmlh2->AdvancedSearch->SearchCondition = @$filter[\"v_jmlh2\"];\n\t\t$this->jmlh2->AdvancedSearch->SearchValue2 = @$filter[\"y_jmlh2\"];\n\t\t$this->jmlh2->AdvancedSearch->SearchOperator2 = @$filter[\"w_jmlh2\"];\n\t\t$this->jmlh2->AdvancedSearch->Save();\n\n\t\t// Field jmlh3\n\t\t$this->jmlh3->AdvancedSearch->SearchValue = @$filter[\"x_jmlh3\"];\n\t\t$this->jmlh3->AdvancedSearch->SearchOperator = @$filter[\"z_jmlh3\"];\n\t\t$this->jmlh3->AdvancedSearch->SearchCondition = @$filter[\"v_jmlh3\"];\n\t\t$this->jmlh3->AdvancedSearch->SearchValue2 = @$filter[\"y_jmlh3\"];\n\t\t$this->jmlh3->AdvancedSearch->SearchOperator2 = @$filter[\"w_jmlh3\"];\n\t\t$this->jmlh3->AdvancedSearch->Save();\n\n\t\t// Field jmlh4\n\t\t$this->jmlh4->AdvancedSearch->SearchValue = @$filter[\"x_jmlh4\"];\n\t\t$this->jmlh4->AdvancedSearch->SearchOperator = @$filter[\"z_jmlh4\"];\n\t\t$this->jmlh4->AdvancedSearch->SearchCondition = @$filter[\"v_jmlh4\"];\n\t\t$this->jmlh4->AdvancedSearch->SearchValue2 = @$filter[\"y_jmlh4\"];\n\t\t$this->jmlh4->AdvancedSearch->SearchOperator2 = @$filter[\"w_jmlh4\"];\n\t\t$this->jmlh4->AdvancedSearch->Save();\n\n\t\t// Field nm_perus\n\t\t$this->nm_perus->AdvancedSearch->SearchValue = @$filter[\"x_nm_perus\"];\n\t\t$this->nm_perus->AdvancedSearch->SearchOperator = @$filter[\"z_nm_perus\"];\n\t\t$this->nm_perus->AdvancedSearch->SearchCondition = @$filter[\"v_nm_perus\"];\n\t\t$this->nm_perus->AdvancedSearch->SearchValue2 = @$filter[\"y_nm_perus\"];\n\t\t$this->nm_perus->AdvancedSearch->SearchOperator2 = @$filter[\"w_nm_perus\"];\n\t\t$this->nm_perus->AdvancedSearch->Save();\n\n\t\t// Field alamat\n\t\t$this->alamat->AdvancedSearch->SearchValue = @$filter[\"x_alamat\"];\n\t\t$this->alamat->AdvancedSearch->SearchOperator = @$filter[\"z_alamat\"];\n\t\t$this->alamat->AdvancedSearch->SearchCondition = @$filter[\"v_alamat\"];\n\t\t$this->alamat->AdvancedSearch->SearchValue2 = @$filter[\"y_alamat\"];\n\t\t$this->alamat->AdvancedSearch->SearchOperator2 = @$filter[\"w_alamat\"];\n\t\t$this->alamat->AdvancedSearch->Save();\n\n\t\t// Field npwp\n\t\t$this->npwp->AdvancedSearch->SearchValue = @$filter[\"x_npwp\"];\n\t\t$this->npwp->AdvancedSearch->SearchOperator = @$filter[\"z_npwp\"];\n\t\t$this->npwp->AdvancedSearch->SearchCondition = @$filter[\"v_npwp\"];\n\t\t$this->npwp->AdvancedSearch->SearchValue2 = @$filter[\"y_npwp\"];\n\t\t$this->npwp->AdvancedSearch->SearchOperator2 = @$filter[\"w_npwp\"];\n\t\t$this->npwp->AdvancedSearch->Save();\n\n\t\t// Field pimpinan\n\t\t$this->pimpinan->AdvancedSearch->SearchValue = @$filter[\"x_pimpinan\"];\n\t\t$this->pimpinan->AdvancedSearch->SearchOperator = @$filter[\"z_pimpinan\"];\n\t\t$this->pimpinan->AdvancedSearch->SearchCondition = @$filter[\"v_pimpinan\"];\n\t\t$this->pimpinan->AdvancedSearch->SearchValue2 = @$filter[\"y_pimpinan\"];\n\t\t$this->pimpinan->AdvancedSearch->SearchOperator2 = @$filter[\"w_pimpinan\"];\n\t\t$this->pimpinan->AdvancedSearch->Save();\n\n\t\t// Field bank\n\t\t$this->bank->AdvancedSearch->SearchValue = @$filter[\"x_bank\"];\n\t\t$this->bank->AdvancedSearch->SearchOperator = @$filter[\"z_bank\"];\n\t\t$this->bank->AdvancedSearch->SearchCondition = @$filter[\"v_bank\"];\n\t\t$this->bank->AdvancedSearch->SearchValue2 = @$filter[\"y_bank\"];\n\t\t$this->bank->AdvancedSearch->SearchOperator2 = @$filter[\"w_bank\"];\n\t\t$this->bank->AdvancedSearch->Save();\n\n\t\t// Field rek\n\t\t$this->rek->AdvancedSearch->SearchValue = @$filter[\"x_rek\"];\n\t\t$this->rek->AdvancedSearch->SearchOperator = @$filter[\"z_rek\"];\n\t\t$this->rek->AdvancedSearch->SearchCondition = @$filter[\"v_rek\"];\n\t\t$this->rek->AdvancedSearch->SearchValue2 = @$filter[\"y_rek\"];\n\t\t$this->rek->AdvancedSearch->SearchOperator2 = @$filter[\"w_rek\"];\n\t\t$this->rek->AdvancedSearch->Save();\n\n\t\t// Field nospm\n\t\t$this->nospm->AdvancedSearch->SearchValue = @$filter[\"x_nospm\"];\n\t\t$this->nospm->AdvancedSearch->SearchOperator = @$filter[\"z_nospm\"];\n\t\t$this->nospm->AdvancedSearch->SearchCondition = @$filter[\"v_nospm\"];\n\t\t$this->nospm->AdvancedSearch->SearchValue2 = @$filter[\"y_nospm\"];\n\t\t$this->nospm->AdvancedSearch->SearchOperator2 = @$filter[\"w_nospm\"];\n\t\t$this->nospm->AdvancedSearch->Save();\n\n\t\t// Field tglspm\n\t\t$this->tglspm->AdvancedSearch->SearchValue = @$filter[\"x_tglspm\"];\n\t\t$this->tglspm->AdvancedSearch->SearchOperator = @$filter[\"z_tglspm\"];\n\t\t$this->tglspm->AdvancedSearch->SearchCondition = @$filter[\"v_tglspm\"];\n\t\t$this->tglspm->AdvancedSearch->SearchValue2 = @$filter[\"y_tglspm\"];\n\t\t$this->tglspm->AdvancedSearch->SearchOperator2 = @$filter[\"w_tglspm\"];\n\t\t$this->tglspm->AdvancedSearch->Save();\n\n\t\t// Field ppn\n\t\t$this->ppn->AdvancedSearch->SearchValue = @$filter[\"x_ppn\"];\n\t\t$this->ppn->AdvancedSearch->SearchOperator = @$filter[\"z_ppn\"];\n\t\t$this->ppn->AdvancedSearch->SearchCondition = @$filter[\"v_ppn\"];\n\t\t$this->ppn->AdvancedSearch->SearchValue2 = @$filter[\"y_ppn\"];\n\t\t$this->ppn->AdvancedSearch->SearchOperator2 = @$filter[\"w_ppn\"];\n\t\t$this->ppn->AdvancedSearch->Save();\n\n\t\t// Field ps21\n\t\t$this->ps21->AdvancedSearch->SearchValue = @$filter[\"x_ps21\"];\n\t\t$this->ps21->AdvancedSearch->SearchOperator = @$filter[\"z_ps21\"];\n\t\t$this->ps21->AdvancedSearch->SearchCondition = @$filter[\"v_ps21\"];\n\t\t$this->ps21->AdvancedSearch->SearchValue2 = @$filter[\"y_ps21\"];\n\t\t$this->ps21->AdvancedSearch->SearchOperator2 = @$filter[\"w_ps21\"];\n\t\t$this->ps21->AdvancedSearch->Save();\n\n\t\t// Field ps22\n\t\t$this->ps22->AdvancedSearch->SearchValue = @$filter[\"x_ps22\"];\n\t\t$this->ps22->AdvancedSearch->SearchOperator = @$filter[\"z_ps22\"];\n\t\t$this->ps22->AdvancedSearch->SearchCondition = @$filter[\"v_ps22\"];\n\t\t$this->ps22->AdvancedSearch->SearchValue2 = @$filter[\"y_ps22\"];\n\t\t$this->ps22->AdvancedSearch->SearchOperator2 = @$filter[\"w_ps22\"];\n\t\t$this->ps22->AdvancedSearch->Save();\n\n\t\t// Field ps23\n\t\t$this->ps23->AdvancedSearch->SearchValue = @$filter[\"x_ps23\"];\n\t\t$this->ps23->AdvancedSearch->SearchOperator = @$filter[\"z_ps23\"];\n\t\t$this->ps23->AdvancedSearch->SearchCondition = @$filter[\"v_ps23\"];\n\t\t$this->ps23->AdvancedSearch->SearchValue2 = @$filter[\"y_ps23\"];\n\t\t$this->ps23->AdvancedSearch->SearchOperator2 = @$filter[\"w_ps23\"];\n\t\t$this->ps23->AdvancedSearch->Save();\n\n\t\t// Field ps4\n\t\t$this->ps4->AdvancedSearch->SearchValue = @$filter[\"x_ps4\"];\n\t\t$this->ps4->AdvancedSearch->SearchOperator = @$filter[\"z_ps4\"];\n\t\t$this->ps4->AdvancedSearch->SearchCondition = @$filter[\"v_ps4\"];\n\t\t$this->ps4->AdvancedSearch->SearchValue2 = @$filter[\"y_ps4\"];\n\t\t$this->ps4->AdvancedSearch->SearchOperator2 = @$filter[\"w_ps4\"];\n\t\t$this->ps4->AdvancedSearch->Save();\n\n\t\t// Field kodespm\n\t\t$this->kodespm->AdvancedSearch->SearchValue = @$filter[\"x_kodespm\"];\n\t\t$this->kodespm->AdvancedSearch->SearchOperator = @$filter[\"z_kodespm\"];\n\t\t$this->kodespm->AdvancedSearch->SearchCondition = @$filter[\"v_kodespm\"];\n\t\t$this->kodespm->AdvancedSearch->SearchValue2 = @$filter[\"y_kodespm\"];\n\t\t$this->kodespm->AdvancedSearch->SearchOperator2 = @$filter[\"w_kodespm\"];\n\t\t$this->kodespm->AdvancedSearch->Save();\n\n\t\t// Field nambud\n\t\t$this->nambud->AdvancedSearch->SearchValue = @$filter[\"x_nambud\"];\n\t\t$this->nambud->AdvancedSearch->SearchOperator = @$filter[\"z_nambud\"];\n\t\t$this->nambud->AdvancedSearch->SearchCondition = @$filter[\"v_nambud\"];\n\t\t$this->nambud->AdvancedSearch->SearchValue2 = @$filter[\"y_nambud\"];\n\t\t$this->nambud->AdvancedSearch->SearchOperator2 = @$filter[\"w_nambud\"];\n\t\t$this->nambud->AdvancedSearch->Save();\n\n\t\t// Field nppk\n\t\t$this->nppk->AdvancedSearch->SearchValue = @$filter[\"x_nppk\"];\n\t\t$this->nppk->AdvancedSearch->SearchOperator = @$filter[\"z_nppk\"];\n\t\t$this->nppk->AdvancedSearch->SearchCondition = @$filter[\"v_nppk\"];\n\t\t$this->nppk->AdvancedSearch->SearchValue2 = @$filter[\"y_nppk\"];\n\t\t$this->nppk->AdvancedSearch->SearchOperator2 = @$filter[\"w_nppk\"];\n\t\t$this->nppk->AdvancedSearch->Save();\n\n\t\t// Field nipppk\n\t\t$this->nipppk->AdvancedSearch->SearchValue = @$filter[\"x_nipppk\"];\n\t\t$this->nipppk->AdvancedSearch->SearchOperator = @$filter[\"z_nipppk\"];\n\t\t$this->nipppk->AdvancedSearch->SearchCondition = @$filter[\"v_nipppk\"];\n\t\t$this->nipppk->AdvancedSearch->SearchValue2 = @$filter[\"y_nipppk\"];\n\t\t$this->nipppk->AdvancedSearch->SearchOperator2 = @$filter[\"w_nipppk\"];\n\t\t$this->nipppk->AdvancedSearch->Save();\n\n\t\t// Field prog\n\t\t$this->prog->AdvancedSearch->SearchValue = @$filter[\"x_prog\"];\n\t\t$this->prog->AdvancedSearch->SearchOperator = @$filter[\"z_prog\"];\n\t\t$this->prog->AdvancedSearch->SearchCondition = @$filter[\"v_prog\"];\n\t\t$this->prog->AdvancedSearch->SearchValue2 = @$filter[\"y_prog\"];\n\t\t$this->prog->AdvancedSearch->SearchOperator2 = @$filter[\"w_prog\"];\n\t\t$this->prog->AdvancedSearch->Save();\n\n\t\t// Field prog1\n\t\t$this->prog1->AdvancedSearch->SearchValue = @$filter[\"x_prog1\"];\n\t\t$this->prog1->AdvancedSearch->SearchOperator = @$filter[\"z_prog1\"];\n\t\t$this->prog1->AdvancedSearch->SearchCondition = @$filter[\"v_prog1\"];\n\t\t$this->prog1->AdvancedSearch->SearchValue2 = @$filter[\"y_prog1\"];\n\t\t$this->prog1->AdvancedSearch->SearchOperator2 = @$filter[\"w_prog1\"];\n\t\t$this->prog1->AdvancedSearch->Save();\n\n\t\t// Field bayar\n\t\t$this->bayar->AdvancedSearch->SearchValue = @$filter[\"x_bayar\"];\n\t\t$this->bayar->AdvancedSearch->SearchOperator = @$filter[\"z_bayar\"];\n\t\t$this->bayar->AdvancedSearch->SearchCondition = @$filter[\"v_bayar\"];\n\t\t$this->bayar->AdvancedSearch->SearchValue2 = @$filter[\"y_bayar\"];\n\t\t$this->bayar->AdvancedSearch->SearchOperator2 = @$filter[\"w_bayar\"];\n\t\t$this->bayar->AdvancedSearch->Save();\n\t\t$this->BasicSearch->setKeyword(@$filter[EW_TABLE_BASIC_SEARCH]);\n\t\t$this->BasicSearch->setType(@$filter[EW_TABLE_BASIC_SEARCH_TYPE]);\n\t}", "function RestoreFilterList() {\n\n\t\t// Return if not reset filter\n\t\tif (@$_POST[\"cmd\"] <> \"resetfilter\")\n\t\t\treturn FALSE;\n\t\t$filter = json_decode(ew_StripSlashes(@$_POST[\"filter\"]), TRUE);\n\t\t$this->Command = \"search\";\n\n\t\t// Field id\n\t\t$this->id->AdvancedSearch->SearchValue = @$filter[\"x_id\"];\n\t\t$this->id->AdvancedSearch->SearchOperator = @$filter[\"z_id\"];\n\t\t$this->id->AdvancedSearch->SearchCondition = @$filter[\"v_id\"];\n\t\t$this->id->AdvancedSearch->SearchValue2 = @$filter[\"y_id\"];\n\t\t$this->id->AdvancedSearch->SearchOperator2 = @$filter[\"w_id\"];\n\t\t$this->id->AdvancedSearch->Save();\n\n\t\t// Field name\n\t\t$this->name->AdvancedSearch->SearchValue = @$filter[\"x_name\"];\n\t\t$this->name->AdvancedSearch->SearchOperator = @$filter[\"z_name\"];\n\t\t$this->name->AdvancedSearch->SearchCondition = @$filter[\"v_name\"];\n\t\t$this->name->AdvancedSearch->SearchValue2 = @$filter[\"y_name\"];\n\t\t$this->name->AdvancedSearch->SearchOperator2 = @$filter[\"w_name\"];\n\t\t$this->name->AdvancedSearch->Save();\n\n\t\t// Field email\n\t\t$this->_email->AdvancedSearch->SearchValue = @$filter[\"x__email\"];\n\t\t$this->_email->AdvancedSearch->SearchOperator = @$filter[\"z__email\"];\n\t\t$this->_email->AdvancedSearch->SearchCondition = @$filter[\"v__email\"];\n\t\t$this->_email->AdvancedSearch->SearchValue2 = @$filter[\"y__email\"];\n\t\t$this->_email->AdvancedSearch->SearchOperator2 = @$filter[\"w__email\"];\n\t\t$this->_email->AdvancedSearch->Save();\n\n\t\t// Field companyname\n\t\t$this->companyname->AdvancedSearch->SearchValue = @$filter[\"x_companyname\"];\n\t\t$this->companyname->AdvancedSearch->SearchOperator = @$filter[\"z_companyname\"];\n\t\t$this->companyname->AdvancedSearch->SearchCondition = @$filter[\"v_companyname\"];\n\t\t$this->companyname->AdvancedSearch->SearchValue2 = @$filter[\"y_companyname\"];\n\t\t$this->companyname->AdvancedSearch->SearchOperator2 = @$filter[\"w_companyname\"];\n\t\t$this->companyname->AdvancedSearch->Save();\n\n\t\t// Field servicetime\n\t\t$this->servicetime->AdvancedSearch->SearchValue = @$filter[\"x_servicetime\"];\n\t\t$this->servicetime->AdvancedSearch->SearchOperator = @$filter[\"z_servicetime\"];\n\t\t$this->servicetime->AdvancedSearch->SearchCondition = @$filter[\"v_servicetime\"];\n\t\t$this->servicetime->AdvancedSearch->SearchValue2 = @$filter[\"y_servicetime\"];\n\t\t$this->servicetime->AdvancedSearch->SearchOperator2 = @$filter[\"w_servicetime\"];\n\t\t$this->servicetime->AdvancedSearch->Save();\n\n\t\t// Field country\n\t\t$this->country->AdvancedSearch->SearchValue = @$filter[\"x_country\"];\n\t\t$this->country->AdvancedSearch->SearchOperator = @$filter[\"z_country\"];\n\t\t$this->country->AdvancedSearch->SearchCondition = @$filter[\"v_country\"];\n\t\t$this->country->AdvancedSearch->SearchValue2 = @$filter[\"y_country\"];\n\t\t$this->country->AdvancedSearch->SearchOperator2 = @$filter[\"w_country\"];\n\t\t$this->country->AdvancedSearch->Save();\n\n\t\t// Field phone\n\t\t$this->phone->AdvancedSearch->SearchValue = @$filter[\"x_phone\"];\n\t\t$this->phone->AdvancedSearch->SearchOperator = @$filter[\"z_phone\"];\n\t\t$this->phone->AdvancedSearch->SearchCondition = @$filter[\"v_phone\"];\n\t\t$this->phone->AdvancedSearch->SearchValue2 = @$filter[\"y_phone\"];\n\t\t$this->phone->AdvancedSearch->SearchOperator2 = @$filter[\"w_phone\"];\n\t\t$this->phone->AdvancedSearch->Save();\n\n\t\t// Field skype\n\t\t$this->skype->AdvancedSearch->SearchValue = @$filter[\"x_skype\"];\n\t\t$this->skype->AdvancedSearch->SearchOperator = @$filter[\"z_skype\"];\n\t\t$this->skype->AdvancedSearch->SearchCondition = @$filter[\"v_skype\"];\n\t\t$this->skype->AdvancedSearch->SearchValue2 = @$filter[\"y_skype\"];\n\t\t$this->skype->AdvancedSearch->SearchOperator2 = @$filter[\"w_skype\"];\n\t\t$this->skype->AdvancedSearch->Save();\n\n\t\t// Field website\n\t\t$this->website->AdvancedSearch->SearchValue = @$filter[\"x_website\"];\n\t\t$this->website->AdvancedSearch->SearchOperator = @$filter[\"z_website\"];\n\t\t$this->website->AdvancedSearch->SearchCondition = @$filter[\"v_website\"];\n\t\t$this->website->AdvancedSearch->SearchValue2 = @$filter[\"y_website\"];\n\t\t$this->website->AdvancedSearch->SearchOperator2 = @$filter[\"w_website\"];\n\t\t$this->website->AdvancedSearch->Save();\n\n\t\t// Field linkedin\n\t\t$this->linkedin->AdvancedSearch->SearchValue = @$filter[\"x_linkedin\"];\n\t\t$this->linkedin->AdvancedSearch->SearchOperator = @$filter[\"z_linkedin\"];\n\t\t$this->linkedin->AdvancedSearch->SearchCondition = @$filter[\"v_linkedin\"];\n\t\t$this->linkedin->AdvancedSearch->SearchValue2 = @$filter[\"y_linkedin\"];\n\t\t$this->linkedin->AdvancedSearch->SearchOperator2 = @$filter[\"w_linkedin\"];\n\t\t$this->linkedin->AdvancedSearch->Save();\n\n\t\t// Field facebook\n\t\t$this->facebook->AdvancedSearch->SearchValue = @$filter[\"x_facebook\"];\n\t\t$this->facebook->AdvancedSearch->SearchOperator = @$filter[\"z_facebook\"];\n\t\t$this->facebook->AdvancedSearch->SearchCondition = @$filter[\"v_facebook\"];\n\t\t$this->facebook->AdvancedSearch->SearchValue2 = @$filter[\"y_facebook\"];\n\t\t$this->facebook->AdvancedSearch->SearchOperator2 = @$filter[\"w_facebook\"];\n\t\t$this->facebook->AdvancedSearch->Save();\n\n\t\t// Field twitter\n\t\t$this->twitter->AdvancedSearch->SearchValue = @$filter[\"x_twitter\"];\n\t\t$this->twitter->AdvancedSearch->SearchOperator = @$filter[\"z_twitter\"];\n\t\t$this->twitter->AdvancedSearch->SearchCondition = @$filter[\"v_twitter\"];\n\t\t$this->twitter->AdvancedSearch->SearchValue2 = @$filter[\"y_twitter\"];\n\t\t$this->twitter->AdvancedSearch->SearchOperator2 = @$filter[\"w_twitter\"];\n\t\t$this->twitter->AdvancedSearch->Save();\n\n\t\t// Field active_code\n\t\t$this->active_code->AdvancedSearch->SearchValue = @$filter[\"x_active_code\"];\n\t\t$this->active_code->AdvancedSearch->SearchOperator = @$filter[\"z_active_code\"];\n\t\t$this->active_code->AdvancedSearch->SearchCondition = @$filter[\"v_active_code\"];\n\t\t$this->active_code->AdvancedSearch->SearchValue2 = @$filter[\"y_active_code\"];\n\t\t$this->active_code->AdvancedSearch->SearchOperator2 = @$filter[\"w_active_code\"];\n\t\t$this->active_code->AdvancedSearch->Save();\n\n\t\t// Field identification\n\t\t$this->identification->AdvancedSearch->SearchValue = @$filter[\"x_identification\"];\n\t\t$this->identification->AdvancedSearch->SearchOperator = @$filter[\"z_identification\"];\n\t\t$this->identification->AdvancedSearch->SearchCondition = @$filter[\"v_identification\"];\n\t\t$this->identification->AdvancedSearch->SearchValue2 = @$filter[\"y_identification\"];\n\t\t$this->identification->AdvancedSearch->SearchOperator2 = @$filter[\"w_identification\"];\n\t\t$this->identification->AdvancedSearch->Save();\n\n\t\t// Field link_expired\n\t\t$this->link_expired->AdvancedSearch->SearchValue = @$filter[\"x_link_expired\"];\n\t\t$this->link_expired->AdvancedSearch->SearchOperator = @$filter[\"z_link_expired\"];\n\t\t$this->link_expired->AdvancedSearch->SearchCondition = @$filter[\"v_link_expired\"];\n\t\t$this->link_expired->AdvancedSearch->SearchValue2 = @$filter[\"y_link_expired\"];\n\t\t$this->link_expired->AdvancedSearch->SearchOperator2 = @$filter[\"w_link_expired\"];\n\t\t$this->link_expired->AdvancedSearch->Save();\n\n\t\t// Field isactive\n\t\t$this->isactive->AdvancedSearch->SearchValue = @$filter[\"x_isactive\"];\n\t\t$this->isactive->AdvancedSearch->SearchOperator = @$filter[\"z_isactive\"];\n\t\t$this->isactive->AdvancedSearch->SearchCondition = @$filter[\"v_isactive\"];\n\t\t$this->isactive->AdvancedSearch->SearchValue2 = @$filter[\"y_isactive\"];\n\t\t$this->isactive->AdvancedSearch->SearchOperator2 = @$filter[\"w_isactive\"];\n\t\t$this->isactive->AdvancedSearch->Save();\n\n\t\t// Field pio\n\t\t$this->pio->AdvancedSearch->SearchValue = @$filter[\"x_pio\"];\n\t\t$this->pio->AdvancedSearch->SearchOperator = @$filter[\"z_pio\"];\n\t\t$this->pio->AdvancedSearch->SearchCondition = @$filter[\"v_pio\"];\n\t\t$this->pio->AdvancedSearch->SearchValue2 = @$filter[\"y_pio\"];\n\t\t$this->pio->AdvancedSearch->SearchOperator2 = @$filter[\"w_pio\"];\n\t\t$this->pio->AdvancedSearch->Save();\n\n\t\t// Field google\n\t\t$this->google->AdvancedSearch->SearchValue = @$filter[\"x_google\"];\n\t\t$this->google->AdvancedSearch->SearchOperator = @$filter[\"z_google\"];\n\t\t$this->google->AdvancedSearch->SearchCondition = @$filter[\"v_google\"];\n\t\t$this->google->AdvancedSearch->SearchValue2 = @$filter[\"y_google\"];\n\t\t$this->google->AdvancedSearch->SearchOperator2 = @$filter[\"w_google\"];\n\t\t$this->google->AdvancedSearch->Save();\n\n\t\t// Field instagram\n\t\t$this->instagram->AdvancedSearch->SearchValue = @$filter[\"x_instagram\"];\n\t\t$this->instagram->AdvancedSearch->SearchOperator = @$filter[\"z_instagram\"];\n\t\t$this->instagram->AdvancedSearch->SearchCondition = @$filter[\"v_instagram\"];\n\t\t$this->instagram->AdvancedSearch->SearchValue2 = @$filter[\"y_instagram\"];\n\t\t$this->instagram->AdvancedSearch->SearchOperator2 = @$filter[\"w_instagram\"];\n\t\t$this->instagram->AdvancedSearch->Save();\n\n\t\t// Field account_type\n\t\t$this->account_type->AdvancedSearch->SearchValue = @$filter[\"x_account_type\"];\n\t\t$this->account_type->AdvancedSearch->SearchOperator = @$filter[\"z_account_type\"];\n\t\t$this->account_type->AdvancedSearch->SearchCondition = @$filter[\"v_account_type\"];\n\t\t$this->account_type->AdvancedSearch->SearchValue2 = @$filter[\"y_account_type\"];\n\t\t$this->account_type->AdvancedSearch->SearchOperator2 = @$filter[\"w_account_type\"];\n\t\t$this->account_type->AdvancedSearch->Save();\n\n\t\t// Field logo\n\t\t$this->logo->AdvancedSearch->SearchValue = @$filter[\"x_logo\"];\n\t\t$this->logo->AdvancedSearch->SearchOperator = @$filter[\"z_logo\"];\n\t\t$this->logo->AdvancedSearch->SearchCondition = @$filter[\"v_logo\"];\n\t\t$this->logo->AdvancedSearch->SearchValue2 = @$filter[\"y_logo\"];\n\t\t$this->logo->AdvancedSearch->SearchOperator2 = @$filter[\"w_logo\"];\n\t\t$this->logo->AdvancedSearch->Save();\n\n\t\t// Field profilepic\n\t\t$this->profilepic->AdvancedSearch->SearchValue = @$filter[\"x_profilepic\"];\n\t\t$this->profilepic->AdvancedSearch->SearchOperator = @$filter[\"z_profilepic\"];\n\t\t$this->profilepic->AdvancedSearch->SearchCondition = @$filter[\"v_profilepic\"];\n\t\t$this->profilepic->AdvancedSearch->SearchValue2 = @$filter[\"y_profilepic\"];\n\t\t$this->profilepic->AdvancedSearch->SearchOperator2 = @$filter[\"w_profilepic\"];\n\t\t$this->profilepic->AdvancedSearch->Save();\n\n\t\t// Field mailref\n\t\t$this->mailref->AdvancedSearch->SearchValue = @$filter[\"x_mailref\"];\n\t\t$this->mailref->AdvancedSearch->SearchOperator = @$filter[\"z_mailref\"];\n\t\t$this->mailref->AdvancedSearch->SearchCondition = @$filter[\"v_mailref\"];\n\t\t$this->mailref->AdvancedSearch->SearchValue2 = @$filter[\"y_mailref\"];\n\t\t$this->mailref->AdvancedSearch->SearchOperator2 = @$filter[\"w_mailref\"];\n\t\t$this->mailref->AdvancedSearch->Save();\n\n\t\t// Field deleted\n\t\t$this->deleted->AdvancedSearch->SearchValue = @$filter[\"x_deleted\"];\n\t\t$this->deleted->AdvancedSearch->SearchOperator = @$filter[\"z_deleted\"];\n\t\t$this->deleted->AdvancedSearch->SearchCondition = @$filter[\"v_deleted\"];\n\t\t$this->deleted->AdvancedSearch->SearchValue2 = @$filter[\"y_deleted\"];\n\t\t$this->deleted->AdvancedSearch->SearchOperator2 = @$filter[\"w_deleted\"];\n\t\t$this->deleted->AdvancedSearch->Save();\n\n\t\t// Field deletefeedback\n\t\t$this->deletefeedback->AdvancedSearch->SearchValue = @$filter[\"x_deletefeedback\"];\n\t\t$this->deletefeedback->AdvancedSearch->SearchOperator = @$filter[\"z_deletefeedback\"];\n\t\t$this->deletefeedback->AdvancedSearch->SearchCondition = @$filter[\"v_deletefeedback\"];\n\t\t$this->deletefeedback->AdvancedSearch->SearchValue2 = @$filter[\"y_deletefeedback\"];\n\t\t$this->deletefeedback->AdvancedSearch->SearchOperator2 = @$filter[\"w_deletefeedback\"];\n\t\t$this->deletefeedback->AdvancedSearch->Save();\n\n\t\t// Field account_id\n\t\t$this->account_id->AdvancedSearch->SearchValue = @$filter[\"x_account_id\"];\n\t\t$this->account_id->AdvancedSearch->SearchOperator = @$filter[\"z_account_id\"];\n\t\t$this->account_id->AdvancedSearch->SearchCondition = @$filter[\"v_account_id\"];\n\t\t$this->account_id->AdvancedSearch->SearchValue2 = @$filter[\"y_account_id\"];\n\t\t$this->account_id->AdvancedSearch->SearchOperator2 = @$filter[\"w_account_id\"];\n\t\t$this->account_id->AdvancedSearch->Save();\n\n\t\t// Field start_date\n\t\t$this->start_date->AdvancedSearch->SearchValue = @$filter[\"x_start_date\"];\n\t\t$this->start_date->AdvancedSearch->SearchOperator = @$filter[\"z_start_date\"];\n\t\t$this->start_date->AdvancedSearch->SearchCondition = @$filter[\"v_start_date\"];\n\t\t$this->start_date->AdvancedSearch->SearchValue2 = @$filter[\"y_start_date\"];\n\t\t$this->start_date->AdvancedSearch->SearchOperator2 = @$filter[\"w_start_date\"];\n\t\t$this->start_date->AdvancedSearch->Save();\n\n\t\t// Field end_date\n\t\t$this->end_date->AdvancedSearch->SearchValue = @$filter[\"x_end_date\"];\n\t\t$this->end_date->AdvancedSearch->SearchOperator = @$filter[\"z_end_date\"];\n\t\t$this->end_date->AdvancedSearch->SearchCondition = @$filter[\"v_end_date\"];\n\t\t$this->end_date->AdvancedSearch->SearchValue2 = @$filter[\"y_end_date\"];\n\t\t$this->end_date->AdvancedSearch->SearchOperator2 = @$filter[\"w_end_date\"];\n\t\t$this->end_date->AdvancedSearch->Save();\n\n\t\t// Field year_moth\n\t\t$this->year_moth->AdvancedSearch->SearchValue = @$filter[\"x_year_moth\"];\n\t\t$this->year_moth->AdvancedSearch->SearchOperator = @$filter[\"z_year_moth\"];\n\t\t$this->year_moth->AdvancedSearch->SearchCondition = @$filter[\"v_year_moth\"];\n\t\t$this->year_moth->AdvancedSearch->SearchValue2 = @$filter[\"y_year_moth\"];\n\t\t$this->year_moth->AdvancedSearch->SearchOperator2 = @$filter[\"w_year_moth\"];\n\t\t$this->year_moth->AdvancedSearch->Save();\n\n\t\t// Field registerdate\n\t\t$this->registerdate->AdvancedSearch->SearchValue = @$filter[\"x_registerdate\"];\n\t\t$this->registerdate->AdvancedSearch->SearchOperator = @$filter[\"z_registerdate\"];\n\t\t$this->registerdate->AdvancedSearch->SearchCondition = @$filter[\"v_registerdate\"];\n\t\t$this->registerdate->AdvancedSearch->SearchValue2 = @$filter[\"y_registerdate\"];\n\t\t$this->registerdate->AdvancedSearch->SearchOperator2 = @$filter[\"w_registerdate\"];\n\t\t$this->registerdate->AdvancedSearch->Save();\n\n\t\t// Field login_type\n\t\t$this->login_type->AdvancedSearch->SearchValue = @$filter[\"x_login_type\"];\n\t\t$this->login_type->AdvancedSearch->SearchOperator = @$filter[\"z_login_type\"];\n\t\t$this->login_type->AdvancedSearch->SearchCondition = @$filter[\"v_login_type\"];\n\t\t$this->login_type->AdvancedSearch->SearchValue2 = @$filter[\"y_login_type\"];\n\t\t$this->login_type->AdvancedSearch->SearchOperator2 = @$filter[\"w_login_type\"];\n\t\t$this->login_type->AdvancedSearch->Save();\n\n\t\t// Field accountstatus\n\t\t$this->accountstatus->AdvancedSearch->SearchValue = @$filter[\"x_accountstatus\"];\n\t\t$this->accountstatus->AdvancedSearch->SearchOperator = @$filter[\"z_accountstatus\"];\n\t\t$this->accountstatus->AdvancedSearch->SearchCondition = @$filter[\"v_accountstatus\"];\n\t\t$this->accountstatus->AdvancedSearch->SearchValue2 = @$filter[\"y_accountstatus\"];\n\t\t$this->accountstatus->AdvancedSearch->SearchOperator2 = @$filter[\"w_accountstatus\"];\n\t\t$this->accountstatus->AdvancedSearch->Save();\n\n\t\t// Field ispay\n\t\t$this->ispay->AdvancedSearch->SearchValue = @$filter[\"x_ispay\"];\n\t\t$this->ispay->AdvancedSearch->SearchOperator = @$filter[\"z_ispay\"];\n\t\t$this->ispay->AdvancedSearch->SearchCondition = @$filter[\"v_ispay\"];\n\t\t$this->ispay->AdvancedSearch->SearchValue2 = @$filter[\"y_ispay\"];\n\t\t$this->ispay->AdvancedSearch->SearchOperator2 = @$filter[\"w_ispay\"];\n\t\t$this->ispay->AdvancedSearch->Save();\n\n\t\t// Field profilelink\n\t\t$this->profilelink->AdvancedSearch->SearchValue = @$filter[\"x_profilelink\"];\n\t\t$this->profilelink->AdvancedSearch->SearchOperator = @$filter[\"z_profilelink\"];\n\t\t$this->profilelink->AdvancedSearch->SearchCondition = @$filter[\"v_profilelink\"];\n\t\t$this->profilelink->AdvancedSearch->SearchValue2 = @$filter[\"y_profilelink\"];\n\t\t$this->profilelink->AdvancedSearch->SearchOperator2 = @$filter[\"w_profilelink\"];\n\t\t$this->profilelink->AdvancedSearch->Save();\n\n\t\t// Field source\n\t\t$this->source->AdvancedSearch->SearchValue = @$filter[\"x_source\"];\n\t\t$this->source->AdvancedSearch->SearchOperator = @$filter[\"z_source\"];\n\t\t$this->source->AdvancedSearch->SearchCondition = @$filter[\"v_source\"];\n\t\t$this->source->AdvancedSearch->SearchValue2 = @$filter[\"y_source\"];\n\t\t$this->source->AdvancedSearch->SearchOperator2 = @$filter[\"w_source\"];\n\t\t$this->source->AdvancedSearch->Save();\n\n\t\t// Field agree\n\t\t$this->agree->AdvancedSearch->SearchValue = @$filter[\"x_agree\"];\n\t\t$this->agree->AdvancedSearch->SearchOperator = @$filter[\"z_agree\"];\n\t\t$this->agree->AdvancedSearch->SearchCondition = @$filter[\"v_agree\"];\n\t\t$this->agree->AdvancedSearch->SearchValue2 = @$filter[\"y_agree\"];\n\t\t$this->agree->AdvancedSearch->SearchOperator2 = @$filter[\"w_agree\"];\n\t\t$this->agree->AdvancedSearch->Save();\n\n\t\t// Field balance\n\t\t$this->balance->AdvancedSearch->SearchValue = @$filter[\"x_balance\"];\n\t\t$this->balance->AdvancedSearch->SearchOperator = @$filter[\"z_balance\"];\n\t\t$this->balance->AdvancedSearch->SearchCondition = @$filter[\"v_balance\"];\n\t\t$this->balance->AdvancedSearch->SearchValue2 = @$filter[\"y_balance\"];\n\t\t$this->balance->AdvancedSearch->SearchOperator2 = @$filter[\"w_balance\"];\n\t\t$this->balance->AdvancedSearch->Save();\n\n\t\t// Field job_title\n\t\t$this->job_title->AdvancedSearch->SearchValue = @$filter[\"x_job_title\"];\n\t\t$this->job_title->AdvancedSearch->SearchOperator = @$filter[\"z_job_title\"];\n\t\t$this->job_title->AdvancedSearch->SearchCondition = @$filter[\"v_job_title\"];\n\t\t$this->job_title->AdvancedSearch->SearchValue2 = @$filter[\"y_job_title\"];\n\t\t$this->job_title->AdvancedSearch->SearchOperator2 = @$filter[\"w_job_title\"];\n\t\t$this->job_title->AdvancedSearch->Save();\n\n\t\t// Field projects\n\t\t$this->projects->AdvancedSearch->SearchValue = @$filter[\"x_projects\"];\n\t\t$this->projects->AdvancedSearch->SearchOperator = @$filter[\"z_projects\"];\n\t\t$this->projects->AdvancedSearch->SearchCondition = @$filter[\"v_projects\"];\n\t\t$this->projects->AdvancedSearch->SearchValue2 = @$filter[\"y_projects\"];\n\t\t$this->projects->AdvancedSearch->SearchOperator2 = @$filter[\"w_projects\"];\n\t\t$this->projects->AdvancedSearch->Save();\n\n\t\t// Field opportunities\n\t\t$this->opportunities->AdvancedSearch->SearchValue = @$filter[\"x_opportunities\"];\n\t\t$this->opportunities->AdvancedSearch->SearchOperator = @$filter[\"z_opportunities\"];\n\t\t$this->opportunities->AdvancedSearch->SearchCondition = @$filter[\"v_opportunities\"];\n\t\t$this->opportunities->AdvancedSearch->SearchValue2 = @$filter[\"y_opportunities\"];\n\t\t$this->opportunities->AdvancedSearch->SearchOperator2 = @$filter[\"w_opportunities\"];\n\t\t$this->opportunities->AdvancedSearch->Save();\n\n\t\t// Field isconsaltant\n\t\t$this->isconsaltant->AdvancedSearch->SearchValue = @$filter[\"x_isconsaltant\"];\n\t\t$this->isconsaltant->AdvancedSearch->SearchOperator = @$filter[\"z_isconsaltant\"];\n\t\t$this->isconsaltant->AdvancedSearch->SearchCondition = @$filter[\"v_isconsaltant\"];\n\t\t$this->isconsaltant->AdvancedSearch->SearchValue2 = @$filter[\"y_isconsaltant\"];\n\t\t$this->isconsaltant->AdvancedSearch->SearchOperator2 = @$filter[\"w_isconsaltant\"];\n\t\t$this->isconsaltant->AdvancedSearch->Save();\n\n\t\t// Field isagent\n\t\t$this->isagent->AdvancedSearch->SearchValue = @$filter[\"x_isagent\"];\n\t\t$this->isagent->AdvancedSearch->SearchOperator = @$filter[\"z_isagent\"];\n\t\t$this->isagent->AdvancedSearch->SearchCondition = @$filter[\"v_isagent\"];\n\t\t$this->isagent->AdvancedSearch->SearchValue2 = @$filter[\"y_isagent\"];\n\t\t$this->isagent->AdvancedSearch->SearchOperator2 = @$filter[\"w_isagent\"];\n\t\t$this->isagent->AdvancedSearch->Save();\n\n\t\t// Field isinvestor\n\t\t$this->isinvestor->AdvancedSearch->SearchValue = @$filter[\"x_isinvestor\"];\n\t\t$this->isinvestor->AdvancedSearch->SearchOperator = @$filter[\"z_isinvestor\"];\n\t\t$this->isinvestor->AdvancedSearch->SearchCondition = @$filter[\"v_isinvestor\"];\n\t\t$this->isinvestor->AdvancedSearch->SearchValue2 = @$filter[\"y_isinvestor\"];\n\t\t$this->isinvestor->AdvancedSearch->SearchOperator2 = @$filter[\"w_isinvestor\"];\n\t\t$this->isinvestor->AdvancedSearch->Save();\n\n\t\t// Field isbusinessman\n\t\t$this->isbusinessman->AdvancedSearch->SearchValue = @$filter[\"x_isbusinessman\"];\n\t\t$this->isbusinessman->AdvancedSearch->SearchOperator = @$filter[\"z_isbusinessman\"];\n\t\t$this->isbusinessman->AdvancedSearch->SearchCondition = @$filter[\"v_isbusinessman\"];\n\t\t$this->isbusinessman->AdvancedSearch->SearchValue2 = @$filter[\"y_isbusinessman\"];\n\t\t$this->isbusinessman->AdvancedSearch->SearchOperator2 = @$filter[\"w_isbusinessman\"];\n\t\t$this->isbusinessman->AdvancedSearch->Save();\n\n\t\t// Field isprovider\n\t\t$this->isprovider->AdvancedSearch->SearchValue = @$filter[\"x_isprovider\"];\n\t\t$this->isprovider->AdvancedSearch->SearchOperator = @$filter[\"z_isprovider\"];\n\t\t$this->isprovider->AdvancedSearch->SearchCondition = @$filter[\"v_isprovider\"];\n\t\t$this->isprovider->AdvancedSearch->SearchValue2 = @$filter[\"y_isprovider\"];\n\t\t$this->isprovider->AdvancedSearch->SearchOperator2 = @$filter[\"w_isprovider\"];\n\t\t$this->isprovider->AdvancedSearch->Save();\n\n\t\t// Field isproductowner\n\t\t$this->isproductowner->AdvancedSearch->SearchValue = @$filter[\"x_isproductowner\"];\n\t\t$this->isproductowner->AdvancedSearch->SearchOperator = @$filter[\"z_isproductowner\"];\n\t\t$this->isproductowner->AdvancedSearch->SearchCondition = @$filter[\"v_isproductowner\"];\n\t\t$this->isproductowner->AdvancedSearch->SearchValue2 = @$filter[\"y_isproductowner\"];\n\t\t$this->isproductowner->AdvancedSearch->SearchOperator2 = @$filter[\"w_isproductowner\"];\n\t\t$this->isproductowner->AdvancedSearch->Save();\n\n\t\t// Field states\n\t\t$this->states->AdvancedSearch->SearchValue = @$filter[\"x_states\"];\n\t\t$this->states->AdvancedSearch->SearchOperator = @$filter[\"z_states\"];\n\t\t$this->states->AdvancedSearch->SearchCondition = @$filter[\"v_states\"];\n\t\t$this->states->AdvancedSearch->SearchValue2 = @$filter[\"y_states\"];\n\t\t$this->states->AdvancedSearch->SearchOperator2 = @$filter[\"w_states\"];\n\t\t$this->states->AdvancedSearch->Save();\n\n\t\t// Field cities\n\t\t$this->cities->AdvancedSearch->SearchValue = @$filter[\"x_cities\"];\n\t\t$this->cities->AdvancedSearch->SearchOperator = @$filter[\"z_cities\"];\n\t\t$this->cities->AdvancedSearch->SearchCondition = @$filter[\"v_cities\"];\n\t\t$this->cities->AdvancedSearch->SearchValue2 = @$filter[\"y_cities\"];\n\t\t$this->cities->AdvancedSearch->SearchOperator2 = @$filter[\"w_cities\"];\n\t\t$this->cities->AdvancedSearch->Save();\n\n\t\t// Field offers\n\t\t$this->offers->AdvancedSearch->SearchValue = @$filter[\"x_offers\"];\n\t\t$this->offers->AdvancedSearch->SearchOperator = @$filter[\"z_offers\"];\n\t\t$this->offers->AdvancedSearch->SearchCondition = @$filter[\"v_offers\"];\n\t\t$this->offers->AdvancedSearch->SearchValue2 = @$filter[\"y_offers\"];\n\t\t$this->offers->AdvancedSearch->SearchOperator2 = @$filter[\"w_offers\"];\n\t\t$this->offers->AdvancedSearch->Save();\n\t\t$this->BasicSearch->setKeyword(@$filter[EW_TABLE_BASIC_SEARCH]);\n\t\t$this->BasicSearch->setType(@$filter[EW_TABLE_BASIC_SEARCH_TYPE]);\n\t}", "public function saveItemFilters()\n {\n $variables = $this->getAllSubmittedVariablesByName();\n\n $categories = array();\n\n foreach ($variables as $key => $value) {\n if (strstr($key, 'category|') && !empty($value)) {\n $categories[] = $value;\n }\n }\n\n $filter = ItemFilterModel::model()->find('play_id = :playId', array(\n ':playId' => $this->playid\n ));\n $method = 'update';\n\n if (empty($filter)) {\n $filter = new ItemFilterModel();\n $method = 'insert';\n }\n\n $filter->play_id = $this->playid;\n $filter->price_from = $variables['price_from'];\n $filter->price_to = $variables['price_to'];\n $filter->tags = json_encode($this->sessionGet('filter_tags'));\n $filter->categories = json_encode($categories);\n $filter->$method();\n\n if (isset($variables['filter_distance'])) {\n $this->saveVariable('filter_distance', $variables['filter_distance']);\n }\n\n return $filter;\n }", "public function decode($data);", "private function convertSerializedData()\n {\n $layoutUpdateQueryModifier = $this->queryModifierFactory->create(\n 'like',\n [\n 'values' => [\n 'xml' => '%conditions_encoded%'\n ]\n ]\n );\n $this->aggregatedFieldDataConverter->convert(\n [\n new FieldToConvert(\n SerializedToJson::class,\n $this->moduleDataSetup->getTable('widget_instance'),\n 'instance_id',\n 'widget_parameters'\n ),\n new FieldToConvert(\n LayoutUpdateConverter::class,\n $this->moduleDataSetup->getTable('layout_update'),\n 'layout_update_id',\n 'xml',\n $layoutUpdateQueryModifier\n ),\n ],\n $this->moduleDataSetup->getConnection()\n );\n }", "function _prepare_filter_data () {\n\t\t// Filter session array name\n\t\t$this->_filter_name\t= $_GET[\"object\"].\"_filter\";\n\t\t// Prepare boxes\n\t\t$this->_boxes = array_merge((array)$this->_boxes, array(\n\t\t\t\"status\"\t\t=> 'select_box(\"status\",\t\t$this->_articles_statuses2,\t$selected, 0, 2, \"\", false)',\n\t\t\t\"account_type\"\t=> 'select_box(\"account_type\",\t$this->_account_types2,\t\t$selected, 0, 2, \"\", false)',\n\t\t\t\"sort_by\"\t\t=> 'select_box(\"sort_by\",\t\t$this->_sort_by,\t\t\t$selected, 0, 2, \"\", false)',\n\t\t\t\"sort_order\"\t=> 'select_box(\"sort_order\",\t$this->_sort_orders,\t\t$selected, 0, 2, \"\", false)',\n\t\t));\n\t\t// Connect common used arrays\n\t\tif (file_exists(INCLUDE_PATH.\"common_code.php\")) {\n\t\t\tinclude (INCLUDE_PATH.\"common_code.php\");\n\t\t}\n\t\t// Get user account type\n\t\t$this->_account_types2[\" \"]\t= t(\"-- All --\");\n\t\tforeach ((array)$this->_account_types as $k => $v) {\n\t\t\t$this->_account_types2[$k]\t= $v;\n\t\t}\n\t\t// Get user account type\n\t\t$this->_articles_statuses2[\" \"]\t= t(\"-- All --\");\n\t\tforeach ((array)$this->_articles_statuses as $k => $v) {\n\t\t\t$this->_articles_statuses2[$k]\t= $v;\n\t\t}\n\t\t// Sort orders\n\t\t$this->_sort_orders = array(\"DESC\" => \"Descending\", \"ASC\" => \"Ascending\");\n\t\t// Sort fields\n\t\t$this->_sort_by = array(\n\t\t\t\"\",\n\t\t\t\"id\",\n\t\t\t\"cat_id\",\n\t\t\t\"user_id\",\n\t\t\t\"add_date\",\n\t\t);\n\t\t// Fields in the filter\n\t\t$this->_fields_in_filter = array(\n\t\t\t\"id_min\",\n\t\t\t\"id_max\",\n\t\t\t\"date_min\",\n\t\t\t\"date_max\",\n\t\t\t\"nick\",\n\t\t\t\"user_id\",\n\t\t\t\"title\",\n\t\t\t\"summary\",\n\t\t\t\"text\",\n\t\t\t\"account_type\",\n\t\t\t\"status\",\n\t\t\t\"cat_id\",\n\t\t\t\"sort_by\",\n\t\t\t\"sort_order\",\n\t\t);\n\t}", "protected function _decodeFilter($_filter, $_filterModel, $_throwExceptionIfEmpty = FALSE)\n {\n if ($_filter instanceof FilterGroup) {\n return $_filter;\n }\n\n $filterModel = $this->_getPluginForFilterModel($_filterModel);\n $decodedFilter = is_array($_filter) || strlen($_filter) == 40 ? $_filter : $this->_prepareParameter($_filter);\n\n if (is_array($decodedFilter)) {\n $filter = FilterGroup::getFilterForModel($filterModel);\n $filter->setFromArrayInUsersTimezone($decodedFilter);\n } else if (!empty($decodedFilter) && strlen($decodedFilter) == 40) {\n $filter = PersistentFilter::getFilterById($decodedFilter);\n } else if ($_throwExceptionIfEmpty) {\n throw new InvalidArgument('Filter must not be empty!');\n } else {\n $filter = FilterGroup::getFilterForModel($filterModel);\n }\n\n return $filter;\n }", "public function getFilterValues()\n {\n return $this->filter_values;\n }", "function getArrayListFilterCol() {\n\t\t\t$data['kodeunit'] = 'u.kodeunit';\n\t\t\t\n\t\t\treturn $data;\n\t\t}", "function mFILTER(){\n try {\n $_type = Erfurt_Sparql_Parser_Sparql11_Update_Tokenizer11::$FILTER;\n $_channel = Erfurt_Sparql_Parser_Sparql11_Update_Tokenizer11::$DEFAULT_TOKEN_CHANNEL;\n // Tokenizer11.g:211:3: ( 'filter' ) \n // Tokenizer11.g:212:3: 'filter' \n {\n $this->matchString(\"filter\"); \n\n\n }\n\n $this->state->type = $_type;\n $this->state->channel = $_channel;\n }\n catch(Exception $e){\n throw $e;\n }\n }", "public function decode($in) {}", "public function getFilter(): array\n {\n return $this->model->getFilter();\n }", "public function getPreparedFieldFilterValues () {\n return MLI18n::gi()->get(ucfirst(MLModul::gi()->getMarketPlaceName()).'_Productlist_Filter_aPreparedStatus');\n }", "function get_current_filters () \n{\n if (count($_GET) < 1) \n return array();\n \n foreach ($_GET as $field_name => $value) {\n if (strlen($value) < 1) continue;\n $filters[$field_name] = addslashes($value);\n }\n \n unset($filters[w]);\n \n return $filters;\n}", "function dblog_filters() {\n $filters = array();\n\n foreach (_dblog_get_message_types() as $type) {\n $types[$type] = t($type);\n }\n\n if (!empty($types)) {\n $filters['type'] = array(\n 'title' => t('Type'),\n 'where' => \"w.type = ?\",\n 'options' => $types,\n );\n }\n\n $filters['severity'] = array(\n 'title' => t('Severity'),\n 'where' => 'w.severity = ?',\n 'options' => watchdog_severity_levels(),\n );\n\n return $filters;\n}", "public function filters()\n {\n return [\n \n ];\n }", "function OnlineSQLdecode($strPass){\n //\tstrPass = Replace(strPass, \"'%'\", \"%\")\n //\tstrPass = Replace(strPass, \"''\", \"'\")\n //\tstrPass = Replace(strPass, \"'|'\", \"|\")\n //\tOnlineSQLdecode = strPass\n //End If\n return $strPass;\n}", "public function decode($raw);", "public function filters()\n {\n $filters = [];\n $filters['name'] = ['trim', 'empty_string_to_null', 'capitalize'];\n $filters['email'] = ['trim', 'empty_string_to_null', 'lowercase'];\n return $filters;\n }", "public function filterByEncryptionType($collection, $filterList, $nestedFilters)\n {\n foreach(array('normal', 'hashed') as $encType)\n {\n if(isset($filterList[$encType]))\n {\n $filterTypes = $filterList[$encType];\n\n foreach($filterTypes as $type => $filters)\n {\n foreach($filters as $key => $filter)\n {\n if($encType == 'hashed')\n {\n $decoded = hasher()->decode($filter);\n }\n\n $filter = ((isset($decoded) && $decoded) ? $decoded : $filter);\n\n if($filter !== '' && $filter !== null)\n {\n if(Schema::hasColumn($this->getTable(), $key))\n {\n switch($type)\n {\n case 'text':\n\n $collection->where($key, 'LIKE', \"%\".$filter.\"%\");\n\n break;\n\n case 'data':\n\n if(isset($filter['operator']))\n {\n if($filter['operator'] == 'NOT IN')\n {\n $collection->whereNotIn($key, $filter['value']);\n }\n else if($filter['operator'] == 'IN')\n {\n $collection->whereIn($key, $filter['value']);\n }\n else\n {\n $collection->where($key, $filter['operator'], $filter['value']);\n }\n }\n else\n {\n $collection->where($key, '=', $filter);\n }\n\n break;\n\n case 'model':\n\n $collection->where($key, '=', $filter);\n\n break;\n }\n }\n\n if($nestedFilters)\n {\n $nestedFilter = $this->getNestedFilterByKey($key, $nestedFilters);\n\n if($nestedFilter)\n {\n if($parent = $nestedFilter['model']->find($filter))\n {\n $children = $parent->getDescendants();\n\n if(!empty($children) && count($children) > 0)\n {\n foreach($children as $child)\n {\n $collection->orWhere($key, '=', $child->id);\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n\n return $collection;\n }", "public function CleanFilter(){\n\t\t$this->_objectFilter = new Model_Aclusuariosonline();\n\t}", "protected function prepareFilters()\n {\n if(count($this->api_query) === 0){\n return;\n }\n\n // Matched WHERE filters would be all\n // that are not KEYWORDS (count, page, embed...)\n foreach($this->api_query as $column => $value) {\n if(in_array($column, $this->api_keyword_filters)){\n continue;\n }\n\n $this->where_filters[$column]= $value;\n }\n }", "public function getFilters()\n {\n return array();\n }", "public static function apply_filters($filters, $data) {\n\t\t// 'boolean,encrypt,htmlspecialchars,strip_tags,int,lower,upper,strip_newlines,nl2br,function_reference,regex,trim'\n\t\tpreg_match_all('/\\%(.*?)\\=\\\"(.*?)\\\"/', $filters, $filters_array);\n\t\tif (count($filters_array[1]) == 0 || count($filters_array[2]) == 0) {\n\t\t\treturn $data;\n\t\t}\n\t\t$filters = array_combine($filters_array[1], $filters_array[2]);\n\t\t$allowed_filters = explode(',', self::filters_array);\n\t\tforeach ($filters as $filter => $value) {\n\t\t\tif (in_array($filter, $allowed_filters)) { \n\t\t\t\tswitch ($filter) {\n\t\t\t\t\tcase 'boolean':\n\t\t\t\t\t\t$data = (boolean) $data;\n\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'encrypt':\n\t\t\t\t\t\t$data = Encryption::encrypt($data);\n\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'htmlspecialchars':\n\t\t\t\t\t\t$data = htmlspecialchars($data);\n\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'strip_tags':\n\t\t\t\t\t\t$data = strip_tags($data, $value);\n\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'int':\n\t\t\t\t\t\t$data = (int) $data;\n\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'lower':\n\t\t\t\t\t\t$data = strtolower($data);\n\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'upper':\n\t\t\t\t\t\t$data = strtoupper($data);\n\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'strip_newlines':\n\t\t\t\t\t\t$data = str_replace(array('<br>', '<br />', '<br/>'), '', nl2br($data));\n\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'nl2br':\n\t\t\t\t\t\t$data = nl2br($data);\n\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'function':\n\t\t\t\t\t\t$data = call_user_func($value, $data);\n\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'function_reference':\n\t\t\t\t\t\tcall_user_func($value, $data);\n\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'regex':\n\t\t\t\t\t\t\n\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'trim':\n\t\t\t\t\t\t$data = trim($data);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn $data;\n\t}", "function genesisawesome_custom_filters( $filters ) {\n\n\t$filters['email'] = 'sanitize_email';\n\t$filters['integer'] = 'genesisawesome_intval';\n\n\treturn $filters;\n\n}", "private static function decodeFilterRunLengthDecode($data){\n\t\t$decoded = '';\n\t\t// data length\n\t\t$data_length = strlen($data);\n\t\t$i = 0;\n\t\twhile($i < $data_length){\n\t\t\t// get current byte value\n\t\t\t$byte = ord($data{$i});\n\t\t\tif($byte == 128){\n\t\t\t\t// a length value of 128 denote EOD\n\t\t\t\tbreak;\n\t\t\t} elseif($byte < 128){\n\t\t\t\t// if the length byte is in the range 0 to 127\n\t\t\t\t// the following length + 1 (1 to 128) bytes shall be copied literally during decompression\n\t\t\t\t$decoded .= substr($data, ($i + 1), ($byte + 1));\n\t\t\t\t// move to next block\n\t\t\t\t$i += ($byte + 2);\n\t\t\t} else {\n\t\t\t\t// if length is in the range 129 to 255,\n\t\t\t\t// the following single byte shall be copied 257 - length (2 to 128) times during decompression\n\t\t\t\t$decoded .= str_repeat($data{($i + 1)}, (257 - $byte));\n\t\t\t\t// move to next block\n\t\t\t\t$i += 2;\n\t\t\t}\n\t\t}\n\t\treturn $decoded;\n\t}", "protected function prepareFilter()\n\t{\n\t\tglobal $USER;\n\t\tglobal $DB;\n\n\t\t$arFilter = array();\n\t\t$arFilter[\"USER_ID\"] = $USER->GetID();\n\t\t$arFilter[\"LID\"] = SITE_ID;\n\n\t\tif (strlen($_REQUEST[\"filter_id\"]))\n\t\t{\n\t\t\tif ($this->options['USE_ACCOUNT_NUMBER'])\n\t\t\t\t$arFilter[\"ACCOUNT_NUMBER\"] = $_REQUEST[\"filter_id\"];\n\t\t\telse\n\t\t\t\t$arFilter[\"ID\"] = intval($_REQUEST[\"filter_id\"]);\n\t\t}\n\n\t\tif (strlen($_REQUEST[\"filter_date_from\"]))\n\t\t\t$arFilter[\"DATE_FROM\"] = trim($_REQUEST[\"filter_date_from\"]);\n\t\tif (strlen($_REQUEST[\"filter_date_to\"]))\n\t\t{\n\t\t\t$arFilter[\"DATE_TO\"] = trim($_REQUEST[\"filter_date_to\"]);\n\n\t\t\tif ($arDate = ParseDateTime(trim($_REQUEST[\"filter_date_to\"]), $this->dateFormat))\n\t\t\t{\n\t\t\t\tif (StrLen(trim($_REQUEST[\"filter_date_to\"])) < 11)\n\t\t\t\t{\n\t\t\t\t\t$arDate[\"HH\"] = 23;\n\t\t\t\t\t$arDate[\"MI\"] = 59;\n\t\t\t\t\t$arDate[\"SS\"] = 59;\n\t\t\t\t}\n\n\t\t\t\t$arFilter[\"DATE_TO\"] = date($DB->DateFormatToPHP($this->dateFormat), mktime($arDate[\"HH\"], $arDate[\"MI\"], $arDate[\"SS\"], $arDate[\"MM\"], $arDate[\"DD\"], $arDate[\"YYYY\"]));\n\t\t\t}\n\t\t}\n\n\t\tif (strlen($_REQUEST[\"filter_status\"]))\n\t\t\t$arFilter[\"STATUS_ID\"] = trim($_REQUEST[\"filter_status\"]);\n\n\t\tif (strlen($_REQUEST[\"filter_payed\"]))\n\t\t\t$arFilter[\"PAYED\"] = trim($_REQUEST[\"filter_payed\"]);\n\n\t\tif(!isset($_REQUEST['show_all']) || $_REQUEST['show_all'] == 'N')\n\t\t{\n\t\t\tif($_REQUEST[\"filter_history\"]!=\"Y\")\n\t\t\t\t$arFilter[\"!@COMPLETE_ORDERS\"] = $this->arParams['HISTORIC_STATUSES'];\n\n\t\t\tif(isset($_REQUEST[\"filter_history\"]) && $_REQUEST[\"filter_history\"] == \"Y\")\n\t\t\t\t$arFilter[\"@COMPLETE_ORDERS\"] = $this->arParams['HISTORIC_STATUSES'];\n\t\t}\n\n\t\tif (strlen($_REQUEST[\"filter_canceled\"]))\n\t\t\t$arFilter[\"CANCELED\"] = trim($_REQUEST[\"filter_canceled\"]);\n\n\t\t$this->filter = $arFilter;\n\t}", "function get_form_filter() {\n\n $val_ = new OrSysvalue();\n if (!is_null($var_)) {\n foreach ($val_->filter AS $id => $value) {\n //echo '$id [ ' . $id . ' ] = [ ' . $value . ' ] <br>' ;\n if ($id != 'filter_by') {\n if (!$this->filter_use[$id]) {\n $my_filter = new OrFieldHidden($id, 'val_filter[' . $id . ']');\n $my_filter->OP_[auto_post]->set(true);\n $my_filter_tag .= $my_filter->get_tag();\n\n if ($val_->compare[$id] == 'BETWEEN' OR $val_->message[$id . '_II'] != '') {\n $my_filter = new OrFieldHidden($id . '_II', 'val_msg[' . $id . '_II]');\n $my_filter->OP_[auto_post]->set(true);\n $my_filter_tag .= $my_filter->get_tag();\n }\n }\n $my_compare = new OrFieldHidden('val_compare_' . $id . '_', 'val_compare[' . $id . ']');\n $my_compare->OP_[auto_post]->set(true);\n $my_filter_tag .= $my_compare->get_tag();\n }\n }\n }\n\n\n /* $my_table = new OrTable('table_query');\n $my_table->OP_[align_table]->set('center');\n $my_table->OP_[class_name]->set('tbl_body');\n $my_table->set_col(' ค้นหา ' . $this->get_control_filter() . ' เรียง ' . $this->get_control_order() . ' ' . $this->get_button_filter() . $my_filter_tag );\n $my_table->set_row(); */\n $my_table = (' ค้นหา ' . $this->get_control_filter() . ' เรียง ' . $this->get_control_order() . ' ' . $this->get_button_filter() . $my_filter_tag );\n return $my_table;\n }", "private function prepare_filter(array $filter=array(), $to_sql) {\n\t\t\t$filter_array = array();\n\n\t\t\t$fields = self::$db->table_info($this->table_name);\n\n\t\t\t$table_name_i18n = $this->table_name.$this->i18n_table_suffix;\n\t\t\tif($is_18n=($this->is_i18n && self::$db->table_exists($table_name_i18n))) {\n\t\t\t\t$fields_i18n = self::$db->table_info($table_name_i18n);\n\t\t\t\t$fields = array_merge($fields, $fields_i18n);\n\t\t\t}\n\t\t\tforeach($fields AS $field) {\n\t\t\t\tif(isset($filter[$field[\"name\"]]) && !empty($filter[$field[\"name\"]]) && $to_sql) {\n\t\t\t\t\tif($field[\"real_type\"] == 'varchar') {\n\t\t\t\t\t\t$filter_array[] = \"{$field[\"name\"]} LIKE '\".self::$db->escape($filter[$field[\"name\"]]).\"'\";\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\t$filter_array[] = \"{$field[\"name\"]}='\".self::$db->escape($filter[$field[\"name\"]]).\"'\";\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (!$to_sql) {\n\t\t\t\tforeach($_GET AS $key=>$val) {\n\t\t\t\t\tif ($key == 'order' || $key == 'page' || empty($val)) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\t$filter_array[] = \"{$key}=\".urlencode($val);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn $filter_array;\n\t\t}" ]
[ "0.60707563", "0.5913808", "0.5892162", "0.5891308", "0.5822298", "0.5666523", "0.56428933", "0.56378585", "0.56014407", "0.55968046", "0.55968046", "0.55639064", "0.5507471", "0.5504322", "0.5494961", "0.54437804", "0.5417486", "0.54147184", "0.54120755", "0.5400004", "0.5362783", "0.53559536", "0.53502935", "0.5336389", "0.5310968", "0.5309491", "0.5296523", "0.5295674", "0.5294177", "0.5294177", "0.52929604", "0.5279104", "0.5275061", "0.52708095", "0.5261514", "0.5255593", "0.5250756", "0.522878", "0.52259123", "0.52252686", "0.52239954", "0.522123", "0.5220843", "0.5218953", "0.5199615", "0.5199594", "0.5153971", "0.51522726", "0.5149235", "0.5142509", "0.5141586", "0.51282614", "0.5122035", "0.512049", "0.5088666", "0.50884956", "0.5065624", "0.50643694", "0.5063454", "0.50591886", "0.50573444", "0.5052422", "0.5052422", "0.5052422", "0.5052422", "0.5052422", "0.50503486", "0.5050322", "0.50398654", "0.5037563", "0.5032172", "0.50267255", "0.5015629", "0.50039864", "0.49999943", "0.49946374", "0.49872136", "0.4986706", "0.4978228", "0.4977772", "0.49746442", "0.49678844", "0.49622208", "0.49507958", "0.4948157", "0.49448898", "0.49399135", "0.49221638", "0.49172297", "0.49120218", "0.4908437", "0.49063608", "0.48976234", "0.48946458", "0.48941493", "0.4893347", "0.48898196", "0.48874822", "0.4884468", "0.48809195", "0.48661724" ]
0.0
-1
Decode filters from db
public function getFiltersAttribute($value) { return json_decode($value, true); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected function decodeFilters()\n {\n if (empty($this->options['filters'])) {\n $this->options['filters'] = [];\n }\n\n $this->options['filters'] = json_decode(base64_decode($this->options['filters']), true);\n\n return $this;\n }", "abstract public function prepareFilters();", "abstract protected function getFilters();", "function _get_filters(){\n $flt = array();\n $filters = array();\n\n if(!isset($_REQUEST['dataflt'])){\n $flt = array();\n }elseif(!is_array($_REQUEST['dataflt'])){\n $flt = (array) $_REQUEST['dataflt'];\n }else{\n $flt = $_REQUEST['dataflt'];\n }\n foreach($flt as $key => $line){\n // we also take the column and filtertype in the key:\n if(!is_numeric($key)) $line = $key.$line;\n $f = $this->_parse_filter($line);\n if(is_array($f)){\n $f['logic'] = 'AND';\n $filters[] = $f;\n }\n }\n return $filters;\n }", "private static function _getFilter() {}", "private function filters() {\n\n\n\t}", "private function fetchFilterTypes()\n {\n $sql = '\n SELECT * FROM Rm_Filters;\n ';\n\n $res = $this->db->executeSelectQueryAndFetchAll($sql);\n\n $filterTypesArray = array();\n foreach ($res as $key => $row) {\n $name = htmlentities($row->name);\n $filterTypesArray[] = $name;\n }\n\n return $filterTypesArray;\n }", "public function GetFilters ();", "public function getFilters();", "public function getFilter();", "public function getFilter();", "abstract public function filters();", "function translate_filter ($filter,$dir='db') \n{ \n $url = array(\"category\", \"location\", \"start_date\", \"end_date\");\n $db = array(\"categories\", \"locations\", \"startDate\", \"endDate\");\n $return = array();\n \n foreach ($filter as $key=>$val) {\n if ($dir == 'db') \n $key = str_replace($url,$db,$key);\n if ($dir == 'url') \n $key = str_replace($db,$url,$key);\n $return[$key] = $val;\n }\n \n return $return;\n}", "protected static function loadFiltersData()\n {\n self::$filtersData = (array) $GLOBALS['TSFE']->fe_user->getKey('ses', 'filters');\n }", "abstract function get_sql_filter($data);", "function xh_fetchFilter($filter_name)\r\n\t{\r\n\t}", "public function getStrFilters($filters)\n\t{\n\t\t//traemos el cliente ?\n\t\t$empresa \t= $this->empresasRepo->getEmpresaById($filters['idEmpresa'])['nombre'];\n\t\t$temas \t\t= ($filters['firstTheme']==0)\n\t\t\t\t\t\t\t\t\t? 'Todos'\n\t\t\t\t\t\t\t\t\t:$this->temaRepo->get($filters['firstTheme'])['nombre'];\n\t\t$tipoFuente = ($filters['tipo_fuente']==0)\n\t\t\t\t\t\t\t\t\t? 'Todos'\n\t\t\t\t\t\t\t\t\t: $this->tipoFuenteRepo->get($filters['tipo_fuente'])['descripcion'];\n\t\t$fuente \t= ($filters['fuente']==0)\n\t\t\t\t\t\t\t\t\t? 'Todos'\n\t\t\t\t\t\t\t\t\t: $this->fuentesRepo->getFontById($filters['fuente'])['nombre'];\n\t\t$seccion \t= ($filters['seccion']==0)\n\t\t\t\t\t\t\t\t\t? 'Todos'\n\t\t\t\t\t\t\t\t\t: $this->seccionRepo->getSeccionById($filters['seccion'])['nombre'];\n\t\t$sector \t= ($filters['sector']==0)\n\t\t\t\t\t\t\t\t\t? \"Todos\"\n\t\t\t\t\t\t\t\t\t: $this->sectorRepo->findById($filters['sector'])['nombre'];\n\t\t$genero \t= ($filters['genero']==0)\n\t\t\t\t\t\t\t\t\t? \"Todos\"\n\t\t\t\t\t\t\t\t\t: $this->generoRepo->findById($filters['genero'])['descripcion'];\n\t\t$tipoAutor \t= ($filters['tipoAutor']==0)\n\t\t\t\t\t\t\t\t\t? \"Todos\"\n\t\t\t\t\t\t\t\t\t: $this->tipoAutorRepo->get($filters['tipoAutor'])['descripcion'];\n\t\t$tendencia \t= ($filters['tendencia']==0)\n\t\t\t\t\t\t\t\t\t? \"Todos\"\n\t\t\t\t\t\t\t\t\t: Util::getTipoTendencia($filters['tendencia']);\n\t\t$fechasQry \t= [\"fecha_inicio\" => $filters['fecha_inicio'],\n\t\t\t\t\t\t\"fecha_fin\" => $filters['fecha_fin']\n\t\t\t\t\t];\t\t\t\t\t\t\t\n\t\treturn ['empresa' => $empresa,'tema' => $temas , 'tipo_fuente' => $tipoFuente, 'fuente' => $fuente, 'seccion' => $seccion,\n\t\t\t\t'sector' => $sector, 'genero' => $genero,\n\t\t\t\t'tipo_autor' => $tipoAutor, 'tendencia' => $tendencia, \n\t\t\t\t'fechas_reporte' => $fechasQry, 'link' => '' ];\n\t}", "function readfilter()\n\t{\n\t\t$field = $this->input->post(\"namafield\");\n\t\t$value = $this->input->post(\"valfilter\");\n\n\t\treturn array(\n\t\t\t\t\"field\" => $field,\n\t\t\t\t\"value\" => $value\n\t\t\t);\n\t}", "public function formatFilters($rawFilters){\n $filters = array();\n \n //LIBRARIAN NAME\n if(array_key_exists('librarian', $rawFilters)){ \n if($rawFilters['librarian'] != ''){\n $filters['librarian'] = $this->__getStaffById($rawFilters['librarian']);\n }\n } \n \n //PROGRAM NAME\n if(array_key_exists('program', $rawFilters)){ \n if($rawFilters['program'] != ''){\n $filters['program'] = $this->__getProgramById($rawFilters['program']);\n }\n } \n \n //INSTRUCTION TYPE\n if(array_key_exists('instructionType', $rawFilters)){ \n $instructionType = $this->formatInstructionType($rawFilters['instructionType']);\n $filters['instructionType'] = $instructionType;\n } \n \n //FILTER CRITERIA (academic, fiscal, calendar, semester, custom)\n if(array_key_exists('filterCriteria', $rawFilters)){ \n $instructionType = $this->formatInstructionType($rawFilters['instructionType']);\n $filters['instructionType'] = $instructionType;\n \n switch($rawFilters['filterCriteria']){\n case 'academic':\n array_key_exists('academicYear', $rawFilters) ? $year = $rawFilters['academicYear'] . '-' . ($rawFilters['academicYear'] + 1) : $year = '';\n $criteriaYear = \"Academic Year \" . $year;\n break;\n case 'calendar':\n array_key_exists('calendarYear', $rawFilters) ? $year = $rawFilters['calendarYear'] : $year = '';\n $criteriaYear = \"Calendar Year \" . $year;\n break;\n case 'fiscal':\n array_key_exists('fiscalYear', $rawFilters) ? $year = $rawFilters['fiscalYear'] . '-' . ($rawFilters['fiscalYear'] + 1) : $year = '';\n $criteriaYear = \"Fiscal Year \" . $year;\n break;\n case 'semester':\n array_key_exists('year', $rawFilters) ? $year = $rawFilters['year'] : $year = '';\n $criteriaYear = ucfirst($rawFilters['semester']) . ' ' . $year;\n break;\n case 'custom':\n array_key_exists('startDate', $rawFilters) ? $startDate = $rawFilters['startDate'] : $startDate = '';\n array_key_exists('endDate', $rawFilters) ? $endDate = $rawFilters['endDate'] : $endDate = '';\n $criteriaYear = 'Date Range: ' . $startDate . ' to ' . $endDate;\n break;\n }\n \n $filters['year'] = $criteriaYear;\n } \n \n //LEVEL \n if(array_key_exists('level', $rawFilters)){ \n $filters['level'] = ucfirst($rawFilters['level']);\n } \n \n //LAST n MONTHS\n if(array_key_exists('lastmonths', $rawFilters)){ \n $filters['lastmonths'] = 'Last '.$rawFilters['lastmonths'].' months';\n } \n \n return $filters;\n }", "function _prepare_filter_data () {\n\t\t// Filter session array name\n\t\t$this->_filter_name\t= $_GET[\"object\"].\"_filter\";\n\t\t// Connect common used arrays\n\t\tif (file_exists(INCLUDE_PATH.\"common_code.php\")) {\n\t\t\tinclude (INCLUDE_PATH.\"common_code.php\");\n\t\t}\n\t\t// Fields in the filter\n\t\t$this->_fields_in_filter = array(\n\t\t\t\"engine\",\n\t\t\t\"text\",\n\t\t);\n\t}", "public function createFilter();", "public function getFilters(): array;", "public function getFilter(){ }", "protected function processFilters()\n {\n $this->filters = [];\n foreach ($this->params as $key => $value) {\n $this->parser->setAlias('_' . $this->contentType);\n $filter = $this->parser->getFilter($key, $value);\n if ($filter) {\n $this->addFilter($filter);\n }\n }\n }", "function xh_listFilters()\r\n\t{\r\n\t}", "public function & GetFilters () {\n\t\t$filters = [];\n\t\tforeach ($this->filters as $direction => $handler) \n\t\t\t$filters[$direction] = $handler[1];\n\t\treturn $filters;\n\t}", "private function _parseBFilterParam()\n\t{\n $map = array('a' => 'attribute', 'm' => 'manufacturer', 's' => 'stock_status', 'f' => 'filter', 'o' => 'option', 'r' => 'rating', 'c' => 'category');\n \n if (!isset($this->request->get['bfilter'])) {\n \n return;\n }\n\t\t$bfilter = $this->request->get['bfilter'];\n\n\t\t$params = explode(';', $bfilter);\n \n\t\tforeach ($params as $param) \n {\n if (!empty($param)) \n {\n $p = explode(':', $param);\n $pName = $p[0];\n $pValue = $p[1];\n if ($pName === 'price') \n {\n $p = explode('-', $pValue);\n if ((int)$p[0] > 0 || (int)$p[1] > 0) {\n $this->conditions->price = new stdClass();\n $this->conditions->price->min = null;\n $this->conditions->price->max = null;\n $this->conditions->price->inputMin = null;\n $this->conditions->price->inputMax = null;\n }\n if ((int)$p[0] > 0) {\n $this->conditions->price->min = $this->currency->convert($p[0], $this->currency->getCode(), $this->config->get('config_currency'));\n $this->conditions->price->inputMin = $p[0];\n }\n if ((int)$p[1] > 0) {\n $this->conditions->price->max = $this->currency->convert($p[1], $this->currency->getCode(), $this->config->get('config_currency'));\n $this->conditions->price->inputMax = $p[1];\n }\n } \n elseif ($pName === 'rating') \n {\n $this->conditions->rating = explode(',', $pValue);\n } \n elseif ($pName === 'search')\n {\n $this->conditions->search = $pValue;\n $this->searchNameString = $pValue;\n $this->searchTagString = $pValue;\n $this->searchDescriptionString = $pValue;\n }\n else \n {\n $type = $map[substr($pName, 0, 1)];\n $groupId = (int)substr($pName, 1);\n if ($type) {\n if (strpos($pValue, '-') !== false) {\n $p = explode('-', $pValue);\n if (isset($p[0]) && isset($p[1])) {\n $this->conditions->{$type}[$groupId] = array('min' => $p[0], 'max' => $p[1]);\n }\n } else {\n $this->conditions->{$type}[$groupId] = explode(',', $pValue);\n }\n\n if ($type !== 'rating') {\n $type = strtoupper($type);\n if (!isset($this->aggregate[$type])) {\n $this->aggregate[$type] = array();\n }\n if (strpos($pValue, '-') !== false) {\n $p = explode('-', $pValue);\n $range = $this->_getSliderIntermediateValues($type, $groupId, $p[0], $p[1]);\n if (!empty($range)) {\n $this->aggregate[$type][$groupId] = $range;\n }\n } else {\n $this->aggregate[$type][$groupId] = explode(',', $pValue);\n }\n }\n }\n }\n }\n\t\t}\n\t}", "public function register_filters() {\n\n\t\t}", "private function prepareFilters($filters) {\n\n if(isset($filters['tags'])){\n $filters['tags'] = implode(',', $filters['tags']);\n }\n\n if(isset($filters['exclude_tags'])){\n $filters['exclude_tags'] = implode(',', $filters['exclude_tags']);\n }\n\n return $filters;\n }", "private function prepareFilters($filters) {\n\n if(isset($filters['tags'])){\n $filters['tags'] = implode(',', $filters['tags']);\n }\n\n if(isset($filters['exclude_tags'])){\n $filters['exclude_tags'] = implode(',', $filters['exclude_tags']);\n }\n\n return $filters;\n }", "public function getFilter(): string;", "public function getFilters(): array;", "public function getFilter() :array;", "public function select_filters($db, $filters)\n {\n $sql = \" SELECT * FROM products $filters order by count_view desc\";\n $stmt = $db->ejecutar($sql);\n return $db->listar($stmt);\n }", "function get_filters($init_data = true) {\n //no filters by default\n return array();\n }", "function _dotgo_filter_prepare() {\n\n}", "public function getFilters(): FilterCollection;", "public function buildFilters()\n {\n $this->addFilter('name', new ORM\\StringFilterType('name'), 'media.adminlist.configurator.filter.name');\n $this->addFilter('contentType', new ORM\\StringFilterType('contentType'), 'media.adminlist.configurator.filter.type');\n $this->addFilter('updatedAt', new ORM\\NumberFilterType('updatedAt'), 'media.adminlist.configurator.filter.updated_at');\n $this->addFilter('filesize', new ORM\\NumberFilterType('filesize'), 'media.adminlist.configurator.filter.filesize');\n }", "public function filter( )\n {\n global $UNDERQL;\n $l_args_num = func_num_args( );\n if ( $l_args_num < 3 )\n return false;\n $filter_name = func_get_arg( 0 );\n\n $l_filter_callback = $UNDERQL['filter']['prefix'] . $filter_name;\n\n if ( !function_exists( $l_filter_callback ))\n return false;\n\n switch(func_get_arg(1))\n {\n case UQL_FILTER_IN:\n\n for ( $i = 2; $i < $l_args_num; $i++ )\n {\n if(!isset($this->in_filters[$this->table_name][func_get_arg( $i )]))\n $this->in_filters[$this->table_name][func_get_arg( $i )] = array($filter_name);\n else\n {\n $_temp = $this->in_filters[$this->table_name][func_get_arg( $i )];\n $_temp[@count($_temp)] = $filter_name;\n\n $this->in_filters[$this->table_name][func_get_arg( $i )] = $_temp;\n }\n }\n return true;\n\n case UQL_FILTER_OUT:\n for ( $i = 2; $i < $l_args_num; $i++ )\n {\n if(!isset($this->out_filters[$this->table_name][func_get_arg( $i )]))\n {\n $this->out_filters[$this->table_name][func_get_arg( $i )] = array($filter_name);\n }\n else\n {\n $_temp = $this->out_filters[$this->table_name][func_get_arg( $i )];\n $_temp[@count($_temp)] = $filter_name;\n\n $this->out_filters[$this->table_name][func_get_arg( $i )] = $_temp;\n\n }\n }\n return true;\n default : return false;\n }\n }", "public function getAllFilters();", "function filters($filter)\n{\n\tglobal $con;\n\t\n\t$query_ConsultaFuncion = sprintf(\"SELECT * FROM appearance WHERE id_appearance = %s\",\n\t\t\t\t\t\t\t\t\t\t GetSQLValueString($filter, \"int\"));\n\t//echo $query_ConsultaFuncion;\n\t$ConsultaFuncion = mysqli_query($con, $query_ConsultaFuncion) or die(mysqli_error($con));\n\t$row_ConsultaFuncion = mysqli_fetch_assoc($ConsultaFuncion);\n\t$totalRows_ConsultaFuncion = mysqli_num_rows($ConsultaFuncion);\n\t\n\treturn $row_ConsultaFuncion[\"filters\"];\n\t\n\tmysqli_free_result($ConsultaFuncion);\n}", "protected function applyFiltering()\n\t{\n\t\tif (!$this->hasFilters()) return;\n\n\t\tparse_str($this->filters, $list);\n\t\tforeach ($list as $column => $value) {\n\t\t\tif ($value !== '') {\n\t\t\t\t$this[$column]->applyFilter($value);\n\t\t\t}\n\t\t}\n\t}", "public function parseFilters(array $params = array())\n {\n if (empty($params)) {\n $params = $this->_params;\n }\n\n if (!array_key_exists(self::FILTER, $params)) {\n return $this->_selectStatement;\n }\n\n $filters = Zend_Json::decode($params[self::FILTER]);\n\n foreach ($filters as $filter) {\n\n if (empty($filter['field'])\n || empty($filter['type'])\n || (empty($filter['value'])) && $filter['value'] !== 0 && $filter['value'] !== false) {\n continue;\n }\n\n $value = $filter['value'];\n\n if ('search' != $filter['type']) {\n if (!in_array($filter['field'], $this->_fields)) {\n continue;\n }\n $filter['field'] = $this->getAlias($filter['field']);\n }\n\n switch($filter['type']) {\n\n case 'string':\n $this->_selectStatement->where($filter['field']\n . $this->_adapter->quoteInto(' LIKE ?', '%' . $filter['value']. '%'));\n break;\n\n case 'stringstrict':\n $this->_selectStatement->where($filter['field'] . ' = ?', $filter['value']);\n break;\n\n case 'search':\n $fields = explode(',', $filter['field']);\n if (empty($fields)) {\n continue;\n }\n\n $collection = array();\n foreach ($fields as $field) {\n $field = trim($field);\n if (!in_array($field, $this->_fields)) {\n continue;\n }\n\n $field = $this->getAlias($field);\n\t\t\t\t\t\tif (preg_match('!^(\\d{2})[.\\/-](\\d{2})[.\\/-](\\d{2,4})$!', $filter['value'], $matches)) {\n $value = $matches[3] . '-' . $matches[2] . '-' . $matches[1];\n\t\t\t\t\t\t}\n\n $collection[] = $this->_adapter->quoteInto($field . ' LIKE ?', '%' . $value . '%');\n }\n\n if (!empty($collection)) {\n $this->_selectStatement->where(join(' OR ', $collection));\n }\n break;\n\n case 'list' :\n if (false !== strpos($filter['value'], ',')) {\n $value = explode(',', $filter['value']);\n } else {\n $value = (array) $filter['value'];\n }\n\n $this->_selectStatement->where($filter['field']\n . ' IN (' . $this->_adapter->quote($value) . ')');\n break;\n\n case 'boolean':\n $this->_selectStatement->where($filter['field'] . ' = ?', $filter['value']);\n break;\n\n case 'numeric' :\n if (empty($filter['comparison'])) {\n continue;\n }\n\n switch ($filter['comparison']) {\n case 'eq':\n $this->_selectStatement->where($filter['field'] . ' = ?', $filter['value']);\n break;\n\n case 'lt':\n $this->_selectStatement->where($filter['field'] . ' < ?', $filter['value']);\n break;\n\n case 'gt':\n $this->_selectStatement->where($filter['field'] . ' > ?', $filter['value']);\n break;\n\n case 'neq':\n $this->_selectStatement->where($filter['field'] . ' != ?', $filter['value']);\n break;\n }\n break;\n\n case 'date':\n if (empty($filter['comparison'])) {\n continue;\n }\n\n switch ($filter['comparison']) {\n case 'eq':\n $this->_selectStatement->where($filter['field'] . ' = ?', date('Y-m-d', strtotime($filter['value'])));\n break;\n\n case 'lt':\n $this->_selectStatement->where($filter['field'] . ' < ?', date('Y-m-d', strtotime($filter['value'])));\n break;\n\n case 'gt':\n $this->_selectStatement->where($filter['field'] . ' > ?', date('Y-m-d', strtotime($filter['value'])));\n break;\n }\n break;\n\n default:\n break;\n }\n }\n return $this->_selectStatement;\n }", "function prepareFilters($dbhandle){\n $filterItems = array();\n\n //Get all the currently defined tags\n $q = \"SELECT CodeID, Name FROM Code\";\n $result_id = doQuery($q,$dbhandle);\n\n //For each tag build the query that returns the nodes tagged by the tag including the map they are in\n while($row = mysql_fetch_row($result_id)) {\n\n //$d = getTagName($dbhandle,$activeFilter);\n\n $q = \"SELECT DISTINCT n2.Label AS Map, tmp.Label AS 'Issue', tmp.Author FROM \".\n\t \"(\" .\n\t \"SELECT n.Author, n.Label, vn.ViewID, vn.CurrentStatus FROM Node n \" .\n\t \"JOIN ViewNode vn ON n.NodeID = vn.NodeID \" .\n\t \"JOIN NodeCode nc ON n.NodeID = nc.NodeID \" .\n\t \"WHERE nc.CodeID='\" . $row[0] . \"' AND vn.CurrentStatus != 3\" . //currentstatus -> dont show deleted nodes\n\t \") AS tmp \" .\n\t \"JOIN Node n2 ON tmp.ViewID = n2.NodeID \" .\n\t \"ORDER BY Map\";\n\n $filterItems[$row[0]] = new FilterItem($row[0],$row[1],$q);\n }\n\n //Add some custom ones\n\n //Which decisions dont have evidence (detail)\n $i = 'DecisionsNoEvidence';\n $d = 'Decisions without evidence';\n $q = \"SELECT DISTINCT n2.Label AS Map, tmp.Label AS 'Issue', tmp.Author FROM \".\n\t\"(\" .\n\t \"SELECT n.Author, n.Label, n.Detail, vn.ViewID, vn.CurrentStatus FROM Node n \" .\n\t \"JOIN ViewNode vn ON n.NodeID = vn.NodeID \" .\n\t \"WHERE n.NodeType = 8 AND n.Detail = '' AND vn.CurrentStatus != 3\" . \n\t\") AS tmp \" .\n\t\"JOIN Node n2 ON tmp.ViewID = n2.NodeID \" .\n\t\"ORDER BY Map\";\n $filterItems[$i] = new FilterItem($i,$d,$q);\n\n //select all questions that do not have any nodes pointing to them\n $i = 'QuestionsNoAnswer';\n $d = 'Unanswered Questions';\n $q = \"SELECT DISTINCT n2.Label AS Map, tmp.Label AS 'Issue', tmp.Author FROM \" .\n\t\"(\" .\n\t \"SELECT n.Author, n.Label, vn.ViewID, vn.CurrentStatus FROM Node n \" .\n\t \"JOIN ViewNode vn ON n.NodeID = vn.NodeID \" .\n\t \"WHERE n.NodeType = 3 AND n.NodeID NOT IN (SELECT ToNode FROM Link) AND vn.CurrentStatus != 3\" .\n\t\") AS tmp \" .\n\t\"JOIN Node n2 ON tmp.ViewID = n2.NodeID \" .\n\t\"ORDER BY Map\";\n $filterItems[$i] = new FilterItem($i,$d,$q);\n\n //select all orphaned (disconnected) nodes\n $i = 'Orphans';\n $d = 'Orphaned nodes';\n $q = \"SELECT DISTINCT n2.Label AS Map, tmp.Label AS 'Issue', tmp.Author FROM \" .\n\t\"(\" .\n\t \"SELECT n.Author, n.Label, vn.ViewID, vn.CurrentStatus FROM Node n \" .\n\t \"JOIN ViewNode vn ON n.NodeID = vn.NodeID \" .\n\t \"WHERE n.NodeID NOT IN (SELECT ToNode FROM Link) AND n.NodeID NOT IN (SELECT FromNode FROM Link) AND vn.CurrentStatus != 3\" .\n\t\") AS tmp \" .\n\t\"JOIN Node n2 ON tmp.ViewID = n2.NodeID \" .\n\t\"WHERE n2.NodeType != 1 AND tmp.Author != 'Administrator' AND n2.Label != 'Home Window' AND n2.Label != 'Decode'\" . //ignore nodes in lists and nodes in welcome/intro/top level maps\n\t\"ORDER BY Map\";\n $filterItems[$i] = new FilterItem($i,$d,$q);\n\n //foreach ($filterItems as $key => $value){\n // $it = $filterItems[$key];\n // print $it . \"<br><br>\\n\\n\";\n //}\n\n return $filterItems;\n}", "public function filters(){\r\r\n\t\treturn CMap::mergeArray(parent::filters(),array(\r\r\n\t\t\t\r\r\n\t\t));\r\r\n\t}", "protected function initializeFilters()\r\n\t{\r\n\t\t$this->iso_filterFields = deserialize($this->iso_filterFields, true);\r\n\t\t\r\n\t\tif(!empty($this->iso_filterFields))\r\n\t\t{\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\t\r\n\t\tif ($this->iso_filterTpl)\r\n\t\t{\r\n\t\t\t$this->strTemplate = $this->iso_filterTpl;\r\n\t\t}\r\n\t\t\r\n\t\treturn false;\r\n\t}", "function acf_get_filters()\n{\n}", "private function _setupFiltering()\n\t{\n\t\tglobal $txt;\n\n\t\t// We'll escape some strings...\n\t\t$db = database();\n\n\t\t// You can filter by any of the following columns:\n\t\t$filters = array(\n\t\t\t'id_member' => $txt['username'],\n\t\t\t'ip' => $txt['ip_address'],\n\t\t\t'session' => $txt['session'],\n\t\t\t'url' => $txt['error_url'],\n\t\t\t'message' => $txt['error_message'],\n\t\t\t'error_type' => $txt['error_type'],\n\t\t\t'file' => $txt['file'],\n\t\t\t'line' => $txt['line'],\n\t\t);\n\n\t\t$filter = $this->_req->getQuery('filter', 'trim', null);\n\t\t$value = $this->_req->getQuery('value', 'trim', null);\n\n\t\t// Set up the filtering...\n\t\tif (isset($value, $filters[$filter]))\n\t\t{\n\t\t\t$filter = array(\n\t\t\t\t'variable' => $filter,\n\t\t\t\t'value' => array(\n\t\t\t\t\t'sql' => in_array($filter, array('message', 'url', 'file'))\n\t\t\t\t\t\t? base64_decode(strtr($value, array(' ' => '+')))\n\t\t\t\t\t\t: $db->escape_wildcard_string($value),\n\t\t\t\t),\n\t\t\t\t'href' => ['filter' => $filter, 'value' => $value],\n\t\t\t\t'entity' => $filters[$filter]\n\t\t\t);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif (isset($filter, $value))\n\t\t\t{\n\t\t\t\tunset($this->_req->query->filter, $this->_req->query->value);\n\t\t\t}\n\n\t\t\t$filter = [];\n\t\t}\n\n\t\treturn $filter;\n\t}", "protected static function filtes()\n {\n /*\n * The filters fetches are transported\n * to router Bus calls\n **/\n }", "function _parse_filter($filterline){\n if(preg_match('/^(.*?)([\\*=<>!~]{1,2})(.*)$/',$filterline,$matches)){\n $column = $this->_column(trim($matches[1]));\n\n $com = $matches[2];\n $aliasses = array('<>' => '!=', '=!' => '!=', '~!' => '!~',\n '==' => '=', '~=' => '~', '=~' => '~');\n\n if (isset($aliasses[$com])) {\n $com = $aliasses[$com];\n } elseif (!preg_match('/(!?[=~])|([<>]=?)|(\\*~)/', $com)) {\n msg('Failed to parse comparison \"'.hsc($com).'\"',-1);\n return false;\n }\n\n $val = trim($matches[3]);\n\n if(strpos($com, '~') !== false) {\n if ($com === '*~') {\n $val = '*' . $val . '*';\n $com = '~';\n }\n $val = str_replace('*','%',$val);\n if ($com == '!~'){\n $com = 'NOT LIKE';\n } else {\n $com = 'LIKE';\n }\n } else {\n // Clean if there are no asterisks I could kill\n $val = $this->_cleanData($val, $column['type']);\n }\n $val = sqlite_escape_string($val); //pre escape\n\n return array('key' => $column['key'],\n 'value' => $val,\n 'compare' => $com,\n 'colname' => $column['colname'],\n 'type' => $column['type']\n );\n }\n msg('Failed to parse filter \"'.hsc($filterline).'\"',-1);\n return false;\n }", "private function setFilter()\n\t{\n\t\t// get filter values\n\t\t$this->filter['language'] = ($this->getParameter('language', 'array') != '') ? $this->getParameter('language', 'array') : BL::getWorkingLanguage();\n\t\t$this->filter['application'] = $this->getParameter('application');\n\t\t$this->filter['module'] = $this->getParameter('module');\n\t\t$this->filter['type'] = $this->getParameter('type', 'array');\n\t\t$this->filter['name'] = $this->getParameter('name');\n\t\t$this->filter['value'] = $this->getParameter('value');\n\n\t\t// build query for filter\n\t\t$this->filterQuery = BackendLocaleModel::buildURLQueryByFilter($this->filter);\n\t}", "function _create_filter_sql () {\n\t\t$SF = &$_SESSION[$this->_filter_name];\n\t\tforeach ((array)$SF as $k => $v) $SF[$k] = trim($v);\n\t\t// Generate filter for the common fileds\n\t\tif ($SF[\"id_min\"]) \t\t\t\t$sql .= \" AND id >= \".intval($SF[\"id_min\"]).\" \\r\\n\";\n\t\tif ($SF[\"id_max\"])\t\t\t \t$sql .= \" AND id <= \".intval($SF[\"id_max\"]).\" \\r\\n\";\n\t\tif ($SF[\"date_min\"]) \t\t\t$sql .= \" AND add_date >= \".strtotime($SF[\"date_min\"]).\" \\r\\n\";\n\t\tif ($SF[\"date_max\"])\t\t\t$sql .= \" AND add_date <= \".strtotime($SF[\"date_max\"]).\" \\r\\n\";\n\t\tif ($SF[\"user_id\"])\t\t\t \t$sql .= \" AND user_id = \".intval($SF[\"user_id\"]).\" \\r\\n\";\n\t\tif ($SF[\"cat_id\"])\t\t\t \t$sql .= \" AND cat_id = \".intval($SF[\"cat_id\"]).\" \\r\\n\";\n\t\tif (strlen($SF[\"title\"]))\t\t$sql .= \" AND title LIKE '\"._es($SF[\"title\"]).\"%' \\r\\n\";\n\t\tif (strlen($SF[\"summary\"]))\t\t$sql .= \" AND summary LIKE '\"._es($SF[\"summary\"]).\"%' \\r\\n\";\n\t\tif (strlen($SF[\"text\"]))\t\t$sql .= \" AND full_text LIKE '\"._es($SF[\"text\"]).\"%' \\r\\n\";\n\t\tif (!empty($SF[\"status\"]) && isset($this->_articles_statuses[$SF[\"status\"]])) {\n\t\t \t$sql .= \" AND status = '\"._es($SF[\"status\"]).\"' \\r\\n\";\n\t\t}\n\t\tif (strlen($SF[\"nick\"]) || strlen($SF[\"account_type\"])) {\n\t\t\tif (strlen($SF[\"nick\"])) \t$users_sql .= \" AND nick LIKE '\"._es($SF[\"nick\"]).\"%' \\r\\n\";\n\t\t\tif ($SF[\"account_type\"])\t$users_sql .= \" AND `group` = \".intval($SF[\"account_type\"]).\" \\r\\n\";\n\t\t}\n\t\t// Add subquery to users table\n\t\tif (!empty($users_sql)) {\n\t\t\t$sql .= \" AND user_id IN( SELECT id FROM \".db('user').\" WHERE 1=1 \".$users_sql.\") \\r\\n\";\n\t\t}\n\t\t// Sorting here\n\t\tif ($SF[\"sort_by\"])\t\t\t \t$sql .= \" ORDER BY \".$this->_sort_by[$SF[\"sort_by\"]].\" \\r\\n\";\n\t\tif ($SF[\"sort_by\"] && strlen($SF[\"sort_order\"])) \t$sql .= \" \".$SF[\"sort_order\"].\" \\r\\n\";\n\t\treturn substr($sql, 0, -3);\n\t}", "protected function rawFilter($filter) {\n //Log::debug('query: ',$filter);\n\t\t// Build a query based on filter $filter\n\t\t$query = Pallet::query()\n ->select('Pallet.objectID', 'Pallet.Pallet_ID', 'Pallet.x', 'Pallet.y', 'Pallet.z', 'Pallet.Status')\n ->orderBy('Pallet_ID', 'asc');\n if(isset($filter['Pallet_ID']) && strlen($filter['Pallet_ID']) > 2) {\n $query->where('Pallet_ID', 'like', ltrim($filter['Pallet_ID'],'0') . '%');\n\t\t}\n\t\tif(isset($filter['Pallet_ID.prefix']) && is_array($filter['Pallet_ID.prefix'])) {\n $query->whereRaw(\"substring(Pallet_ID,1,3) in ('\".implode(\"','\", $filter['Pallet_ID.prefix']).\"')\");\n\t\t}\n if(isset($filter['Status']) && is_array($filter['Status'])) {\n $query->whereRaw(\"Status in ('\".implode(\"','\", $filter['Status']).\"')\");\n }\n elseif(isset($filter['Status']) && strlen($filter['Status']) > 3) {\n $query->where('Status', '=', $filter['Status']);\n }\n /*\n * container.parent should generate this sql request\n * select Pallet.* from Pallet join container plt on plt.objectID = Pallet.objectID where plt.parentID = 6213292055;\n */\n if(isset($filter['container.parent']) && strlen($filter['container.parent']) > 3) {\n $query\n ->join('container as plt', 'plt.objectID', '=', 'Pallet.objectID')\n ->where('plt.parentID',$filter['container.parent']);\n }\n /*\n * container.child should generate this sql request\n * select Pallet.* from Pallet join container gc on gc.parentID = Pallet.objectID where gc.objectID = 6226111054;\n */\n if(isset($filter['container.child']) && strlen($filter['container.child']) > 3) {\n $query\n ->join('container as gc', 'gc.parentID', '=', 'Pallet.objectID')\n ->where('gc.objectID',$filter['container.child']);\n }\n return $query;\n }", "function RestoreFilterList() {\n\n\t\t// Return if not reset filter\n\t\tif (@$_POST[\"cmd\"] <> \"resetfilter\")\n\t\t\treturn FALSE;\n\t\t$filter = json_decode(@$_POST[\"filter\"], TRUE);\n\t\t$this->Command = \"search\";\n\n\t\t// Field tanggal\n\t\t$this->tanggal->AdvancedSearch->SearchValue = @$filter[\"x_tanggal\"];\n\t\t$this->tanggal->AdvancedSearch->SearchOperator = @$filter[\"z_tanggal\"];\n\t\t$this->tanggal->AdvancedSearch->SearchCondition = @$filter[\"v_tanggal\"];\n\t\t$this->tanggal->AdvancedSearch->SearchValue2 = @$filter[\"y_tanggal\"];\n\t\t$this->tanggal->AdvancedSearch->SearchOperator2 = @$filter[\"w_tanggal\"];\n\t\t$this->tanggal->AdvancedSearch->Save();\n\n\t\t// Field auc_number\n\t\t$this->auc_number->AdvancedSearch->SearchValue = @$filter[\"x_auc_number\"];\n\t\t$this->auc_number->AdvancedSearch->SearchOperator = @$filter[\"z_auc_number\"];\n\t\t$this->auc_number->AdvancedSearch->SearchCondition = @$filter[\"v_auc_number\"];\n\t\t$this->auc_number->AdvancedSearch->SearchValue2 = @$filter[\"y_auc_number\"];\n\t\t$this->auc_number->AdvancedSearch->SearchOperator2 = @$filter[\"w_auc_number\"];\n\t\t$this->auc_number->AdvancedSearch->Save();\n\n\t\t// Field start_bid\n\t\t$this->start_bid->AdvancedSearch->SearchValue = @$filter[\"x_start_bid\"];\n\t\t$this->start_bid->AdvancedSearch->SearchOperator = @$filter[\"z_start_bid\"];\n\t\t$this->start_bid->AdvancedSearch->SearchCondition = @$filter[\"v_start_bid\"];\n\t\t$this->start_bid->AdvancedSearch->SearchValue2 = @$filter[\"y_start_bid\"];\n\t\t$this->start_bid->AdvancedSearch->SearchOperator2 = @$filter[\"w_start_bid\"];\n\t\t$this->start_bid->AdvancedSearch->Save();\n\n\t\t// Field close_bid\n\t\t$this->close_bid->AdvancedSearch->SearchValue = @$filter[\"x_close_bid\"];\n\t\t$this->close_bid->AdvancedSearch->SearchOperator = @$filter[\"z_close_bid\"];\n\t\t$this->close_bid->AdvancedSearch->SearchCondition = @$filter[\"v_close_bid\"];\n\t\t$this->close_bid->AdvancedSearch->SearchValue2 = @$filter[\"y_close_bid\"];\n\t\t$this->close_bid->AdvancedSearch->SearchOperator2 = @$filter[\"w_close_bid\"];\n\t\t$this->close_bid->AdvancedSearch->Save();\n\n\t\t// Field lot_number\n\t\t$this->lot_number->AdvancedSearch->SearchValue = @$filter[\"x_lot_number\"];\n\t\t$this->lot_number->AdvancedSearch->SearchOperator = @$filter[\"z_lot_number\"];\n\t\t$this->lot_number->AdvancedSearch->SearchCondition = @$filter[\"v_lot_number\"];\n\t\t$this->lot_number->AdvancedSearch->SearchValue2 = @$filter[\"y_lot_number\"];\n\t\t$this->lot_number->AdvancedSearch->SearchOperator2 = @$filter[\"w_lot_number\"];\n\t\t$this->lot_number->AdvancedSearch->Save();\n\n\t\t// Field chop\n\t\t$this->chop->AdvancedSearch->SearchValue = @$filter[\"x_chop\"];\n\t\t$this->chop->AdvancedSearch->SearchOperator = @$filter[\"z_chop\"];\n\t\t$this->chop->AdvancedSearch->SearchCondition = @$filter[\"v_chop\"];\n\t\t$this->chop->AdvancedSearch->SearchValue2 = @$filter[\"y_chop\"];\n\t\t$this->chop->AdvancedSearch->SearchOperator2 = @$filter[\"w_chop\"];\n\t\t$this->chop->AdvancedSearch->Save();\n\n\t\t// Field grade\n\t\t$this->grade->AdvancedSearch->SearchValue = @$filter[\"x_grade\"];\n\t\t$this->grade->AdvancedSearch->SearchOperator = @$filter[\"z_grade\"];\n\t\t$this->grade->AdvancedSearch->SearchCondition = @$filter[\"v_grade\"];\n\t\t$this->grade->AdvancedSearch->SearchValue2 = @$filter[\"y_grade\"];\n\t\t$this->grade->AdvancedSearch->SearchOperator2 = @$filter[\"w_grade\"];\n\t\t$this->grade->AdvancedSearch->Save();\n\n\t\t// Field estate\n\t\t$this->estate->AdvancedSearch->SearchValue = @$filter[\"x_estate\"];\n\t\t$this->estate->AdvancedSearch->SearchOperator = @$filter[\"z_estate\"];\n\t\t$this->estate->AdvancedSearch->SearchCondition = @$filter[\"v_estate\"];\n\t\t$this->estate->AdvancedSearch->SearchValue2 = @$filter[\"y_estate\"];\n\t\t$this->estate->AdvancedSearch->SearchOperator2 = @$filter[\"w_estate\"];\n\t\t$this->estate->AdvancedSearch->Save();\n\n\t\t// Field sack\n\t\t$this->sack->AdvancedSearch->SearchValue = @$filter[\"x_sack\"];\n\t\t$this->sack->AdvancedSearch->SearchOperator = @$filter[\"z_sack\"];\n\t\t$this->sack->AdvancedSearch->SearchCondition = @$filter[\"v_sack\"];\n\t\t$this->sack->AdvancedSearch->SearchValue2 = @$filter[\"y_sack\"];\n\t\t$this->sack->AdvancedSearch->SearchOperator2 = @$filter[\"w_sack\"];\n\t\t$this->sack->AdvancedSearch->Save();\n\n\t\t// Field netto\n\t\t$this->netto->AdvancedSearch->SearchValue = @$filter[\"x_netto\"];\n\t\t$this->netto->AdvancedSearch->SearchOperator = @$filter[\"z_netto\"];\n\t\t$this->netto->AdvancedSearch->SearchCondition = @$filter[\"v_netto\"];\n\t\t$this->netto->AdvancedSearch->SearchValue2 = @$filter[\"y_netto\"];\n\t\t$this->netto->AdvancedSearch->SearchOperator2 = @$filter[\"w_netto\"];\n\t\t$this->netto->AdvancedSearch->Save();\n\n\t\t// Field open_bid\n\t\t$this->open_bid->AdvancedSearch->SearchValue = @$filter[\"x_open_bid\"];\n\t\t$this->open_bid->AdvancedSearch->SearchOperator = @$filter[\"z_open_bid\"];\n\t\t$this->open_bid->AdvancedSearch->SearchCondition = @$filter[\"v_open_bid\"];\n\t\t$this->open_bid->AdvancedSearch->SearchValue2 = @$filter[\"y_open_bid\"];\n\t\t$this->open_bid->AdvancedSearch->SearchOperator2 = @$filter[\"w_open_bid\"];\n\t\t$this->open_bid->AdvancedSearch->Save();\n\n\t\t// Field last_bid\n\t\t$this->last_bid->AdvancedSearch->SearchValue = @$filter[\"x_last_bid\"];\n\t\t$this->last_bid->AdvancedSearch->SearchOperator = @$filter[\"z_last_bid\"];\n\t\t$this->last_bid->AdvancedSearch->SearchCondition = @$filter[\"v_last_bid\"];\n\t\t$this->last_bid->AdvancedSearch->SearchValue2 = @$filter[\"y_last_bid\"];\n\t\t$this->last_bid->AdvancedSearch->SearchOperator2 = @$filter[\"w_last_bid\"];\n\t\t$this->last_bid->AdvancedSearch->Save();\n\n\t\t// Field highest_bid\n\t\t$this->highest_bid->AdvancedSearch->SearchValue = @$filter[\"x_highest_bid\"];\n\t\t$this->highest_bid->AdvancedSearch->SearchOperator = @$filter[\"z_highest_bid\"];\n\t\t$this->highest_bid->AdvancedSearch->SearchCondition = @$filter[\"v_highest_bid\"];\n\t\t$this->highest_bid->AdvancedSearch->SearchValue2 = @$filter[\"y_highest_bid\"];\n\t\t$this->highest_bid->AdvancedSearch->SearchOperator2 = @$filter[\"w_highest_bid\"];\n\t\t$this->highest_bid->AdvancedSearch->Save();\n\n\t\t// Field enter_bid\n\t\t$this->enter_bid->AdvancedSearch->SearchValue = @$filter[\"x_enter_bid\"];\n\t\t$this->enter_bid->AdvancedSearch->SearchOperator = @$filter[\"z_enter_bid\"];\n\t\t$this->enter_bid->AdvancedSearch->SearchCondition = @$filter[\"v_enter_bid\"];\n\t\t$this->enter_bid->AdvancedSearch->SearchValue2 = @$filter[\"y_enter_bid\"];\n\t\t$this->enter_bid->AdvancedSearch->SearchOperator2 = @$filter[\"w_enter_bid\"];\n\t\t$this->enter_bid->AdvancedSearch->Save();\n\n\t\t// Field auction_status\n\t\t$this->auction_status->AdvancedSearch->SearchValue = @$filter[\"x_auction_status\"];\n\t\t$this->auction_status->AdvancedSearch->SearchOperator = @$filter[\"z_auction_status\"];\n\t\t$this->auction_status->AdvancedSearch->SearchCondition = @$filter[\"v_auction_status\"];\n\t\t$this->auction_status->AdvancedSearch->SearchValue2 = @$filter[\"y_auction_status\"];\n\t\t$this->auction_status->AdvancedSearch->SearchOperator2 = @$filter[\"w_auction_status\"];\n\t\t$this->auction_status->AdvancedSearch->Save();\n\n\t\t// Field gross\n\t\t$this->gross->AdvancedSearch->SearchValue = @$filter[\"x_gross\"];\n\t\t$this->gross->AdvancedSearch->SearchOperator = @$filter[\"z_gross\"];\n\t\t$this->gross->AdvancedSearch->SearchCondition = @$filter[\"v_gross\"];\n\t\t$this->gross->AdvancedSearch->SearchValue2 = @$filter[\"y_gross\"];\n\t\t$this->gross->AdvancedSearch->SearchOperator2 = @$filter[\"w_gross\"];\n\t\t$this->gross->AdvancedSearch->Save();\n\n\t\t// Field row_id\n\t\t$this->row_id->AdvancedSearch->SearchValue = @$filter[\"x_row_id\"];\n\t\t$this->row_id->AdvancedSearch->SearchOperator = @$filter[\"z_row_id\"];\n\t\t$this->row_id->AdvancedSearch->SearchCondition = @$filter[\"v_row_id\"];\n\t\t$this->row_id->AdvancedSearch->SearchValue2 = @$filter[\"y_row_id\"];\n\t\t$this->row_id->AdvancedSearch->SearchOperator2 = @$filter[\"w_row_id\"];\n\t\t$this->row_id->AdvancedSearch->Save();\n\t\t$this->BasicSearch->setKeyword(@$filter[EW_TABLE_BASIC_SEARCH]);\n\t\t$this->BasicSearch->setType(@$filter[EW_TABLE_BASIC_SEARCH_TYPE]);\n\t}", "public function filtering();", "function _prepareFilter(&$controller){\n \t\n\t\t$filter = array();\n if(isset($controller->data)){\n foreach($controller->data as $model=>$fields){\n foreach($fields as $key=>$field){\n if($field == ''){\n unset($controller->data[$model][$key]);\n }\n }\n }\n \n App::import('Sanitize');\n $sanit = new Sanitize();\n $controller->data = $sanit->clean($controller->data);\n $filter = $controller->data;\n }\n \n if (empty($filter)){\n \t\t$filter = $this->_checkParams($controller); \t\n }\n $controller->data = $filter;\n }", "private function loadFiltersFromQuery(): void\n {\n $request = RequestUtil::getMainRequest($this->requestStack) ?? Request::createFromGlobals();\n $requestFilters = $request->query->all('filter');\n\n if (is_array($requestFilters)) {\n foreach ($requestFilters as $name => $limitations) {\n foreach ($limitations as $comparison => $value) {\n $filterField = new FilterField();\n $filterField->setName($name)\n ->setValue($value)\n ->setComparison($comparison)\n ->setFilter($this->getFilterByName($name));\n\n $this->filterFields[] = $filterField;\n }\n }\n }\n }", "public function getFilterParameters(): array;", "function _create_filter_sql () {\n\t\t$SF = &$_SESSION[$this->_filter_name];\n\t\tforeach ((array)$SF as $k => $v) $SF[$k] = trim($v);\n\t\t// Generate filter for the common fileds\n\t\tif (strlen($SF[\"text\"]))\t\t$sql .= \" AND text LIKE '%\"._es($SF[\"text\"]).\"%' \\r\\n\";\n\t\tif (strlen($SF[\"engine\"]))\t\t$sql .= \" AND engine=\".intval($SF[\"engine\"]).\" \\r\\n\";\n\t\treturn substr($sql, 0, -3);\n\t}", "function initDataFilters() {\n try {\n $engine = defined('DB_CAN_TRANSACT') && DB_CAN_TRANSACT ? 'InnoDB' : 'MyISAM';\n\n DB::execute(\"CREATE TABLE \" . TABLE_PREFIX . \"data_filters (\n id int unsigned NOT NULL auto_increment,\n type varchar(150) NOT NULL DEFAULT 'DataFilter',\n name varchar(50) DEFAULT NULL,\n raw_additional_properties longtext ,\n created_on datetime DEFAULT NULL,\n created_by_id int(10) unsigned NULL DEFAULT NULL,\n created_by_name varchar(100) DEFAULT NULL,\n created_by_email varchar(150) DEFAULT NULL,\n is_private tinyint(1) unsigned NOT NULL DEFAULT '0',\n PRIMARY KEY (id),\n INDEX type (type),\n INDEX created_by_id (created_by_id),\n INDEX name (name)\n ) ENGINE=$engine DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;\");\n } catch(Exception $e) {\n return $e->getMessage();\n } // try\n\n return true;\n }", "public function decode($data) {}", "public function decode($data) {}", "public function decode($data) {}", "public function decode($data) {}", "public function decode($data) {}", "public static function _tableFilters($filters) {\n\t\t$advansed_filters = array();\n\t\t$show_advansed_filters = false;\n\n\t\tforeach ($filters as $key => $filter) {\n\n\t\t\tif ($filter->hidden) {\n\t\t\t\tunset($filters[$key]);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t\n\t\t\tif ($filter->advansed == true) {\n\t\t\t\t// Show advansed filters if there have input values\n\t\t\t\tif (!empty($filter->value)) $show_advansed_filters = true;\t\t\t\t\n\t\t\t\t// Copy filter to advansed array\n\t\t\t\t$advansed_filters[] = $filter;\n\t\t\t\t// Delete this filter from main array\n\t\t\t\tunset($filters[$key]);\n\t\t\t}\n\n\t\t}\n\t\t\n\t\tif (!count($filters)) {\n\t\t\treturn '';\n\t\t}\n\n\t\t$result = '<div class=\"block-filters\">';\t\t\n\t\t$result .= '<div class=\"block-title\">Фильтры</div>';\n\t\t$result .= '<form method=\"post\" name=\"filtersForm\" id=\"filtersForm\" action=\"'.$_SERVER['SCRIPT_URL'].'\">';\n\n\t\t// Main filters array\n\t\tforeach ($filters as $filter) {\n\n\t\t\t$result .= '<div class=\"block-item\">';\n\n\t\t\tif (count($filter->values)) {\n\n\t\t\t\t$result .= '<label>'.$filter->title.':</label><br />';\n\t\t\t\t$result .= '<select name=\"filters['.$filter->name.']\" onchange=\"filtersForm.submit()\">';\t\t\t\t\n\n\t\t\t\t\tif ($filter->first_empty_value)\n\t\t\t\t\t\t$result .= '<option value=\"\">Все</option>';\t\t\t\t\t\n\n\t\t\t\t\tforeach ($filter->values as $key => $value) {\n\n\t\t\t\t\t\t$selected = '';\n\n\t\t\t\t\t\tif ($filter->value == $key) {\n\t\t\t\t\t\t\t$selected = 'selected';\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t$result .= '<option value=\"'.$key.'\" '.$selected.'>'.$value.'</option>';\n\t\t\t\t\t}\t\t\t\t\t\n\n\t\t\t\t$result .= '</select>';\n\n\t\t\t} else {\n\t\t\t\t\n\t\t\t\t$result .= '<label>'.$filter->title.':</label><br />';\n\t\t\t\t$result .= '<input type=\"text\" name=\"filters['.$filter->name.']\" value=\"'.$filter->value.'\" />';\n\n\t\t\t}\n\n\t\t\t$result .= '</div>'; #block-item\n\n\t\t}\n\n\t\t$result .= '<div class=\"clr\"></div>';\n\n\t\t// Advansed filters array\n\t\tif ($show_advansed_filters) {\n\t\t\t$result .= '<div class=\"advansed_filters\" style=\"display:block;\">';\t\n\t\t} else {\n\t\t\t$result .= '<div class=\"advansed_filters\" style=\"display:none;\">';\t\n\t\t}\t\t\n\t\t\n\t\tforeach ($advansed_filters as $filter) {\n\n\t\t\t$result .= '<div class=\"block-item\">'; #block-item \n\n\t\t\tif (count($filter->values)) {\n\n\t\t\t\t$result .= '<label>'.$filter->title.':</label><br />';\n\t\t\t\t$result .= '<select name=\"filters['.$filter->name.']\" onchange=\"filtersForm.submit()\">';\t\t\t\t\n\n\t\t\t\t\tif ($filter->first_empty_value)\n\t\t\t\t\t\t$result .= '<option value=\"\">Все</option>';\t\t\t\t\t\n\n\t\t\t\t\tforeach ($filter->values as $key => $value) {\n\n\t\t\t\t\t\t$selected = '';\n\n\t\t\t\t\t\tif ($filter->value == $key) {\n\t\t\t\t\t\t\t$selected = 'selected';\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t$result .= '<option value=\"'.$key.'\" '.$selected.'>'.$value.'</option>';\n\t\t\t\t\t}\t\t\t\t\t\n\n\t\t\t\t$result .= '</select>';\n\n\t\t\t} else {\n\t\t\t\t\n\t\t\t\t$result .= '<label>'.$filter->title.':</label><br />';\n\t\t\t\t$result .= '<input type=\"text\" name=\"filters['.$filter->name.']\" value=\"'.$filter->value.'\" />';\n\n\t\t\t}\n\n\t\t\t$result .= '</div>'; #block-item\n\n\t\t}\n\n\t\t$result .= '</div>';\n\n\t\t$result .= '<div class=\"clr\"></div>';\t\n\n\t\t$result .= '<input type=\"hidden\" name=\"limitstart\" value=\"0\" />';\t\n\t\t$result .= '<input type=\"submit\" value=\"Искать\" />';\t\t\n\t\t$result .= '<input type=\"button\" value=\"Очистить\" class=\"form-reset\" />';\n\n\t\tif (count($advansed_filters)) {\n\t\t\t$result .= '<input type=\"button\" value=\"Расширенный фильтр\" class=\"toggle_advansed_filters\" />';\t\n\t\t}\t\n\t\t\n\t\t$result .= '</form>';\n\t\t$result .= '</div>';\n\n\t\treturn $result;\t\t\n\n\t}", "public static function alm_get_all_filters(){\n global $wpdb;\n \t$prefix = esc_sql( ALM_FILTERS_PREFIX );\n \t$options = $wpdb->options;\n \t$t = esc_sql( \"$prefix%\" );\n \t$sql = $wpdb -> prepare ( \"SELECT option_name FROM $options WHERE option_name LIKE '%s'\", $t );\n \t$filters = $wpdb -> get_col( $sql );\n\n \t$filters = ALMFilters::alm_remove_filter_license_options($filters);\n\n \treturn $filters;\n }", "public function get_filters() {\n $filters = new stdClass();\n\n $filters->path = $this->path;\n $filters->column = $this->column;\n $filters->direction = $this->direction;\n $filters->page = $this->page;\n\n return $filters;\n }", "public function getFilters() \n {\n return $this->filters;\n }", "function kses_init_filters()\n {\n }", "function RestoreFilterList() {\n\n\t\t// Return if not reset filter\n\t\tif (@$_POST[\"cmd\"] <> \"resetfilter\")\n\t\t\treturn FALSE;\n\t\t$filter = json_decode(@$_POST[\"filter\"], TRUE);\n\t\t$this->Command = \"search\";\n\n\t\t// Field id\n\t\t$this->id->AdvancedSearch->SearchValue = @$filter[\"x_id\"];\n\t\t$this->id->AdvancedSearch->SearchOperator = @$filter[\"z_id\"];\n\t\t$this->id->AdvancedSearch->SearchCondition = @$filter[\"v_id\"];\n\t\t$this->id->AdvancedSearch->SearchValue2 = @$filter[\"y_id\"];\n\t\t$this->id->AdvancedSearch->SearchOperator2 = @$filter[\"w_id\"];\n\t\t$this->id->AdvancedSearch->Save();\n\n\t\t// Field fecha_tamizaje\n\t\t$this->fecha_tamizaje->AdvancedSearch->SearchValue = @$filter[\"x_fecha_tamizaje\"];\n\t\t$this->fecha_tamizaje->AdvancedSearch->SearchOperator = @$filter[\"z_fecha_tamizaje\"];\n\t\t$this->fecha_tamizaje->AdvancedSearch->SearchCondition = @$filter[\"v_fecha_tamizaje\"];\n\t\t$this->fecha_tamizaje->AdvancedSearch->SearchValue2 = @$filter[\"y_fecha_tamizaje\"];\n\t\t$this->fecha_tamizaje->AdvancedSearch->SearchOperator2 = @$filter[\"w_fecha_tamizaje\"];\n\t\t$this->fecha_tamizaje->AdvancedSearch->Save();\n\n\t\t// Field id_centro\n\t\t$this->id_centro->AdvancedSearch->SearchValue = @$filter[\"x_id_centro\"];\n\t\t$this->id_centro->AdvancedSearch->SearchOperator = @$filter[\"z_id_centro\"];\n\t\t$this->id_centro->AdvancedSearch->SearchCondition = @$filter[\"v_id_centro\"];\n\t\t$this->id_centro->AdvancedSearch->SearchValue2 = @$filter[\"y_id_centro\"];\n\t\t$this->id_centro->AdvancedSearch->SearchOperator2 = @$filter[\"w_id_centro\"];\n\t\t$this->id_centro->AdvancedSearch->Save();\n\n\t\t// Field apellidopaterno\n\t\t$this->apellidopaterno->AdvancedSearch->SearchValue = @$filter[\"x_apellidopaterno\"];\n\t\t$this->apellidopaterno->AdvancedSearch->SearchOperator = @$filter[\"z_apellidopaterno\"];\n\t\t$this->apellidopaterno->AdvancedSearch->SearchCondition = @$filter[\"v_apellidopaterno\"];\n\t\t$this->apellidopaterno->AdvancedSearch->SearchValue2 = @$filter[\"y_apellidopaterno\"];\n\t\t$this->apellidopaterno->AdvancedSearch->SearchOperator2 = @$filter[\"w_apellidopaterno\"];\n\t\t$this->apellidopaterno->AdvancedSearch->Save();\n\n\t\t// Field apellidomaterno\n\t\t$this->apellidomaterno->AdvancedSearch->SearchValue = @$filter[\"x_apellidomaterno\"];\n\t\t$this->apellidomaterno->AdvancedSearch->SearchOperator = @$filter[\"z_apellidomaterno\"];\n\t\t$this->apellidomaterno->AdvancedSearch->SearchCondition = @$filter[\"v_apellidomaterno\"];\n\t\t$this->apellidomaterno->AdvancedSearch->SearchValue2 = @$filter[\"y_apellidomaterno\"];\n\t\t$this->apellidomaterno->AdvancedSearch->SearchOperator2 = @$filter[\"w_apellidomaterno\"];\n\t\t$this->apellidomaterno->AdvancedSearch->Save();\n\n\t\t// Field nombre\n\t\t$this->nombre->AdvancedSearch->SearchValue = @$filter[\"x_nombre\"];\n\t\t$this->nombre->AdvancedSearch->SearchOperator = @$filter[\"z_nombre\"];\n\t\t$this->nombre->AdvancedSearch->SearchCondition = @$filter[\"v_nombre\"];\n\t\t$this->nombre->AdvancedSearch->SearchValue2 = @$filter[\"y_nombre\"];\n\t\t$this->nombre->AdvancedSearch->SearchOperator2 = @$filter[\"w_nombre\"];\n\t\t$this->nombre->AdvancedSearch->Save();\n\n\t\t// Field ci\n\t\t$this->ci->AdvancedSearch->SearchValue = @$filter[\"x_ci\"];\n\t\t$this->ci->AdvancedSearch->SearchOperator = @$filter[\"z_ci\"];\n\t\t$this->ci->AdvancedSearch->SearchCondition = @$filter[\"v_ci\"];\n\t\t$this->ci->AdvancedSearch->SearchValue2 = @$filter[\"y_ci\"];\n\t\t$this->ci->AdvancedSearch->SearchOperator2 = @$filter[\"w_ci\"];\n\t\t$this->ci->AdvancedSearch->Save();\n\n\t\t// Field fecha_nacimiento\n\t\t$this->fecha_nacimiento->AdvancedSearch->SearchValue = @$filter[\"x_fecha_nacimiento\"];\n\t\t$this->fecha_nacimiento->AdvancedSearch->SearchOperator = @$filter[\"z_fecha_nacimiento\"];\n\t\t$this->fecha_nacimiento->AdvancedSearch->SearchCondition = @$filter[\"v_fecha_nacimiento\"];\n\t\t$this->fecha_nacimiento->AdvancedSearch->SearchValue2 = @$filter[\"y_fecha_nacimiento\"];\n\t\t$this->fecha_nacimiento->AdvancedSearch->SearchOperator2 = @$filter[\"w_fecha_nacimiento\"];\n\t\t$this->fecha_nacimiento->AdvancedSearch->Save();\n\n\t\t// Field dias\n\t\t$this->dias->AdvancedSearch->SearchValue = @$filter[\"x_dias\"];\n\t\t$this->dias->AdvancedSearch->SearchOperator = @$filter[\"z_dias\"];\n\t\t$this->dias->AdvancedSearch->SearchCondition = @$filter[\"v_dias\"];\n\t\t$this->dias->AdvancedSearch->SearchValue2 = @$filter[\"y_dias\"];\n\t\t$this->dias->AdvancedSearch->SearchOperator2 = @$filter[\"w_dias\"];\n\t\t$this->dias->AdvancedSearch->Save();\n\n\t\t// Field semanas\n\t\t$this->semanas->AdvancedSearch->SearchValue = @$filter[\"x_semanas\"];\n\t\t$this->semanas->AdvancedSearch->SearchOperator = @$filter[\"z_semanas\"];\n\t\t$this->semanas->AdvancedSearch->SearchCondition = @$filter[\"v_semanas\"];\n\t\t$this->semanas->AdvancedSearch->SearchValue2 = @$filter[\"y_semanas\"];\n\t\t$this->semanas->AdvancedSearch->SearchOperator2 = @$filter[\"w_semanas\"];\n\t\t$this->semanas->AdvancedSearch->Save();\n\n\t\t// Field meses\n\t\t$this->meses->AdvancedSearch->SearchValue = @$filter[\"x_meses\"];\n\t\t$this->meses->AdvancedSearch->SearchOperator = @$filter[\"z_meses\"];\n\t\t$this->meses->AdvancedSearch->SearchCondition = @$filter[\"v_meses\"];\n\t\t$this->meses->AdvancedSearch->SearchValue2 = @$filter[\"y_meses\"];\n\t\t$this->meses->AdvancedSearch->SearchOperator2 = @$filter[\"w_meses\"];\n\t\t$this->meses->AdvancedSearch->Save();\n\n\t\t// Field sexo\n\t\t$this->sexo->AdvancedSearch->SearchValue = @$filter[\"x_sexo\"];\n\t\t$this->sexo->AdvancedSearch->SearchOperator = @$filter[\"z_sexo\"];\n\t\t$this->sexo->AdvancedSearch->SearchCondition = @$filter[\"v_sexo\"];\n\t\t$this->sexo->AdvancedSearch->SearchValue2 = @$filter[\"y_sexo\"];\n\t\t$this->sexo->AdvancedSearch->SearchOperator2 = @$filter[\"w_sexo\"];\n\t\t$this->sexo->AdvancedSearch->Save();\n\n\t\t// Field discapacidad\n\t\t$this->discapacidad->AdvancedSearch->SearchValue = @$filter[\"x_discapacidad\"];\n\t\t$this->discapacidad->AdvancedSearch->SearchOperator = @$filter[\"z_discapacidad\"];\n\t\t$this->discapacidad->AdvancedSearch->SearchCondition = @$filter[\"v_discapacidad\"];\n\t\t$this->discapacidad->AdvancedSearch->SearchValue2 = @$filter[\"y_discapacidad\"];\n\t\t$this->discapacidad->AdvancedSearch->SearchOperator2 = @$filter[\"w_discapacidad\"];\n\t\t$this->discapacidad->AdvancedSearch->Save();\n\n\t\t// Field id_tipodiscapacidad\n\t\t$this->id_tipodiscapacidad->AdvancedSearch->SearchValue = @$filter[\"x_id_tipodiscapacidad\"];\n\t\t$this->id_tipodiscapacidad->AdvancedSearch->SearchOperator = @$filter[\"z_id_tipodiscapacidad\"];\n\t\t$this->id_tipodiscapacidad->AdvancedSearch->SearchCondition = @$filter[\"v_id_tipodiscapacidad\"];\n\t\t$this->id_tipodiscapacidad->AdvancedSearch->SearchValue2 = @$filter[\"y_id_tipodiscapacidad\"];\n\t\t$this->id_tipodiscapacidad->AdvancedSearch->SearchOperator2 = @$filter[\"w_id_tipodiscapacidad\"];\n\t\t$this->id_tipodiscapacidad->AdvancedSearch->Save();\n\n\t\t// Field resultado\n\t\t$this->resultado->AdvancedSearch->SearchValue = @$filter[\"x_resultado\"];\n\t\t$this->resultado->AdvancedSearch->SearchOperator = @$filter[\"z_resultado\"];\n\t\t$this->resultado->AdvancedSearch->SearchCondition = @$filter[\"v_resultado\"];\n\t\t$this->resultado->AdvancedSearch->SearchValue2 = @$filter[\"y_resultado\"];\n\t\t$this->resultado->AdvancedSearch->SearchOperator2 = @$filter[\"w_resultado\"];\n\t\t$this->resultado->AdvancedSearch->Save();\n\n\t\t// Field resultadotamizaje\n\t\t$this->resultadotamizaje->AdvancedSearch->SearchValue = @$filter[\"x_resultadotamizaje\"];\n\t\t$this->resultadotamizaje->AdvancedSearch->SearchOperator = @$filter[\"z_resultadotamizaje\"];\n\t\t$this->resultadotamizaje->AdvancedSearch->SearchCondition = @$filter[\"v_resultadotamizaje\"];\n\t\t$this->resultadotamizaje->AdvancedSearch->SearchValue2 = @$filter[\"y_resultadotamizaje\"];\n\t\t$this->resultadotamizaje->AdvancedSearch->SearchOperator2 = @$filter[\"w_resultadotamizaje\"];\n\t\t$this->resultadotamizaje->AdvancedSearch->Save();\n\n\t\t// Field tapon\n\t\t$this->tapon->AdvancedSearch->SearchValue = @$filter[\"x_tapon\"];\n\t\t$this->tapon->AdvancedSearch->SearchOperator = @$filter[\"z_tapon\"];\n\t\t$this->tapon->AdvancedSearch->SearchCondition = @$filter[\"v_tapon\"];\n\t\t$this->tapon->AdvancedSearch->SearchValue2 = @$filter[\"y_tapon\"];\n\t\t$this->tapon->AdvancedSearch->SearchOperator2 = @$filter[\"w_tapon\"];\n\t\t$this->tapon->AdvancedSearch->Save();\n\n\t\t// Field tipo\n\t\t$this->tipo->AdvancedSearch->SearchValue = @$filter[\"x_tipo\"];\n\t\t$this->tipo->AdvancedSearch->SearchOperator = @$filter[\"z_tipo\"];\n\t\t$this->tipo->AdvancedSearch->SearchCondition = @$filter[\"v_tipo\"];\n\t\t$this->tipo->AdvancedSearch->SearchValue2 = @$filter[\"y_tipo\"];\n\t\t$this->tipo->AdvancedSearch->SearchOperator2 = @$filter[\"w_tipo\"];\n\t\t$this->tipo->AdvancedSearch->Save();\n\n\t\t// Field repetirprueba\n\t\t$this->repetirprueba->AdvancedSearch->SearchValue = @$filter[\"x_repetirprueba\"];\n\t\t$this->repetirprueba->AdvancedSearch->SearchOperator = @$filter[\"z_repetirprueba\"];\n\t\t$this->repetirprueba->AdvancedSearch->SearchCondition = @$filter[\"v_repetirprueba\"];\n\t\t$this->repetirprueba->AdvancedSearch->SearchValue2 = @$filter[\"y_repetirprueba\"];\n\t\t$this->repetirprueba->AdvancedSearch->SearchOperator2 = @$filter[\"w_repetirprueba\"];\n\t\t$this->repetirprueba->AdvancedSearch->Save();\n\n\t\t// Field observaciones\n\t\t$this->observaciones->AdvancedSearch->SearchValue = @$filter[\"x_observaciones\"];\n\t\t$this->observaciones->AdvancedSearch->SearchOperator = @$filter[\"z_observaciones\"];\n\t\t$this->observaciones->AdvancedSearch->SearchCondition = @$filter[\"v_observaciones\"];\n\t\t$this->observaciones->AdvancedSearch->SearchValue2 = @$filter[\"y_observaciones\"];\n\t\t$this->observaciones->AdvancedSearch->SearchOperator2 = @$filter[\"w_observaciones\"];\n\t\t$this->observaciones->AdvancedSearch->Save();\n\n\t\t// Field id_apoderado\n\t\t$this->id_apoderado->AdvancedSearch->SearchValue = @$filter[\"x_id_apoderado\"];\n\t\t$this->id_apoderado->AdvancedSearch->SearchOperator = @$filter[\"z_id_apoderado\"];\n\t\t$this->id_apoderado->AdvancedSearch->SearchCondition = @$filter[\"v_id_apoderado\"];\n\t\t$this->id_apoderado->AdvancedSearch->SearchValue2 = @$filter[\"y_id_apoderado\"];\n\t\t$this->id_apoderado->AdvancedSearch->SearchOperator2 = @$filter[\"w_id_apoderado\"];\n\t\t$this->id_apoderado->AdvancedSearch->Save();\n\n\t\t// Field id_referencia\n\t\t$this->id_referencia->AdvancedSearch->SearchValue = @$filter[\"x_id_referencia\"];\n\t\t$this->id_referencia->AdvancedSearch->SearchOperator = @$filter[\"z_id_referencia\"];\n\t\t$this->id_referencia->AdvancedSearch->SearchCondition = @$filter[\"v_id_referencia\"];\n\t\t$this->id_referencia->AdvancedSearch->SearchValue2 = @$filter[\"y_id_referencia\"];\n\t\t$this->id_referencia->AdvancedSearch->SearchOperator2 = @$filter[\"w_id_referencia\"];\n\t\t$this->id_referencia->AdvancedSearch->Save();\n\t}", "function RestoreFilterList() {\n\n\t\t// Return if not reset filter\n\t\tif (@$_POST[\"cmd\"] <> \"resetfilter\")\n\t\t\treturn FALSE;\n\t\t$filter = json_decode(ew_StripSlashes(@$_POST[\"filter\"]), TRUE);\n\t\t$this->Command = \"search\";\n\n\t\t// Field tgl\n\t\t$this->tgl->AdvancedSearch->SearchValue = @$filter[\"x_tgl\"];\n\t\t$this->tgl->AdvancedSearch->SearchOperator = @$filter[\"z_tgl\"];\n\t\t$this->tgl->AdvancedSearch->SearchCondition = @$filter[\"v_tgl\"];\n\t\t$this->tgl->AdvancedSearch->SearchValue2 = @$filter[\"y_tgl\"];\n\t\t$this->tgl->AdvancedSearch->SearchOperator2 = @$filter[\"w_tgl\"];\n\t\t$this->tgl->AdvancedSearch->Save();\n\n\t\t// Field no_spp\n\t\t$this->no_spp->AdvancedSearch->SearchValue = @$filter[\"x_no_spp\"];\n\t\t$this->no_spp->AdvancedSearch->SearchOperator = @$filter[\"z_no_spp\"];\n\t\t$this->no_spp->AdvancedSearch->SearchCondition = @$filter[\"v_no_spp\"];\n\t\t$this->no_spp->AdvancedSearch->SearchValue2 = @$filter[\"y_no_spp\"];\n\t\t$this->no_spp->AdvancedSearch->SearchOperator2 = @$filter[\"w_no_spp\"];\n\t\t$this->no_spp->AdvancedSearch->Save();\n\n\t\t// Field jns_spp\n\t\t$this->jns_spp->AdvancedSearch->SearchValue = @$filter[\"x_jns_spp\"];\n\t\t$this->jns_spp->AdvancedSearch->SearchOperator = @$filter[\"z_jns_spp\"];\n\t\t$this->jns_spp->AdvancedSearch->SearchCondition = @$filter[\"v_jns_spp\"];\n\t\t$this->jns_spp->AdvancedSearch->SearchValue2 = @$filter[\"y_jns_spp\"];\n\t\t$this->jns_spp->AdvancedSearch->SearchOperator2 = @$filter[\"w_jns_spp\"];\n\t\t$this->jns_spp->AdvancedSearch->Save();\n\n\t\t// Field kd_mata\n\t\t$this->kd_mata->AdvancedSearch->SearchValue = @$filter[\"x_kd_mata\"];\n\t\t$this->kd_mata->AdvancedSearch->SearchOperator = @$filter[\"z_kd_mata\"];\n\t\t$this->kd_mata->AdvancedSearch->SearchCondition = @$filter[\"v_kd_mata\"];\n\t\t$this->kd_mata->AdvancedSearch->SearchValue2 = @$filter[\"y_kd_mata\"];\n\t\t$this->kd_mata->AdvancedSearch->SearchOperator2 = @$filter[\"w_kd_mata\"];\n\t\t$this->kd_mata->AdvancedSearch->Save();\n\n\t\t// Field urai\n\t\t$this->urai->AdvancedSearch->SearchValue = @$filter[\"x_urai\"];\n\t\t$this->urai->AdvancedSearch->SearchOperator = @$filter[\"z_urai\"];\n\t\t$this->urai->AdvancedSearch->SearchCondition = @$filter[\"v_urai\"];\n\t\t$this->urai->AdvancedSearch->SearchValue2 = @$filter[\"y_urai\"];\n\t\t$this->urai->AdvancedSearch->SearchOperator2 = @$filter[\"w_urai\"];\n\t\t$this->urai->AdvancedSearch->Save();\n\n\t\t// Field jmlh\n\t\t$this->jmlh->AdvancedSearch->SearchValue = @$filter[\"x_jmlh\"];\n\t\t$this->jmlh->AdvancedSearch->SearchOperator = @$filter[\"z_jmlh\"];\n\t\t$this->jmlh->AdvancedSearch->SearchCondition = @$filter[\"v_jmlh\"];\n\t\t$this->jmlh->AdvancedSearch->SearchValue2 = @$filter[\"y_jmlh\"];\n\t\t$this->jmlh->AdvancedSearch->SearchOperator2 = @$filter[\"w_jmlh\"];\n\t\t$this->jmlh->AdvancedSearch->Save();\n\n\t\t// Field jmlh1\n\t\t$this->jmlh1->AdvancedSearch->SearchValue = @$filter[\"x_jmlh1\"];\n\t\t$this->jmlh1->AdvancedSearch->SearchOperator = @$filter[\"z_jmlh1\"];\n\t\t$this->jmlh1->AdvancedSearch->SearchCondition = @$filter[\"v_jmlh1\"];\n\t\t$this->jmlh1->AdvancedSearch->SearchValue2 = @$filter[\"y_jmlh1\"];\n\t\t$this->jmlh1->AdvancedSearch->SearchOperator2 = @$filter[\"w_jmlh1\"];\n\t\t$this->jmlh1->AdvancedSearch->Save();\n\n\t\t// Field jmlh2\n\t\t$this->jmlh2->AdvancedSearch->SearchValue = @$filter[\"x_jmlh2\"];\n\t\t$this->jmlh2->AdvancedSearch->SearchOperator = @$filter[\"z_jmlh2\"];\n\t\t$this->jmlh2->AdvancedSearch->SearchCondition = @$filter[\"v_jmlh2\"];\n\t\t$this->jmlh2->AdvancedSearch->SearchValue2 = @$filter[\"y_jmlh2\"];\n\t\t$this->jmlh2->AdvancedSearch->SearchOperator2 = @$filter[\"w_jmlh2\"];\n\t\t$this->jmlh2->AdvancedSearch->Save();\n\n\t\t// Field jmlh3\n\t\t$this->jmlh3->AdvancedSearch->SearchValue = @$filter[\"x_jmlh3\"];\n\t\t$this->jmlh3->AdvancedSearch->SearchOperator = @$filter[\"z_jmlh3\"];\n\t\t$this->jmlh3->AdvancedSearch->SearchCondition = @$filter[\"v_jmlh3\"];\n\t\t$this->jmlh3->AdvancedSearch->SearchValue2 = @$filter[\"y_jmlh3\"];\n\t\t$this->jmlh3->AdvancedSearch->SearchOperator2 = @$filter[\"w_jmlh3\"];\n\t\t$this->jmlh3->AdvancedSearch->Save();\n\n\t\t// Field jmlh4\n\t\t$this->jmlh4->AdvancedSearch->SearchValue = @$filter[\"x_jmlh4\"];\n\t\t$this->jmlh4->AdvancedSearch->SearchOperator = @$filter[\"z_jmlh4\"];\n\t\t$this->jmlh4->AdvancedSearch->SearchCondition = @$filter[\"v_jmlh4\"];\n\t\t$this->jmlh4->AdvancedSearch->SearchValue2 = @$filter[\"y_jmlh4\"];\n\t\t$this->jmlh4->AdvancedSearch->SearchOperator2 = @$filter[\"w_jmlh4\"];\n\t\t$this->jmlh4->AdvancedSearch->Save();\n\n\t\t// Field nm_perus\n\t\t$this->nm_perus->AdvancedSearch->SearchValue = @$filter[\"x_nm_perus\"];\n\t\t$this->nm_perus->AdvancedSearch->SearchOperator = @$filter[\"z_nm_perus\"];\n\t\t$this->nm_perus->AdvancedSearch->SearchCondition = @$filter[\"v_nm_perus\"];\n\t\t$this->nm_perus->AdvancedSearch->SearchValue2 = @$filter[\"y_nm_perus\"];\n\t\t$this->nm_perus->AdvancedSearch->SearchOperator2 = @$filter[\"w_nm_perus\"];\n\t\t$this->nm_perus->AdvancedSearch->Save();\n\n\t\t// Field alamat\n\t\t$this->alamat->AdvancedSearch->SearchValue = @$filter[\"x_alamat\"];\n\t\t$this->alamat->AdvancedSearch->SearchOperator = @$filter[\"z_alamat\"];\n\t\t$this->alamat->AdvancedSearch->SearchCondition = @$filter[\"v_alamat\"];\n\t\t$this->alamat->AdvancedSearch->SearchValue2 = @$filter[\"y_alamat\"];\n\t\t$this->alamat->AdvancedSearch->SearchOperator2 = @$filter[\"w_alamat\"];\n\t\t$this->alamat->AdvancedSearch->Save();\n\n\t\t// Field npwp\n\t\t$this->npwp->AdvancedSearch->SearchValue = @$filter[\"x_npwp\"];\n\t\t$this->npwp->AdvancedSearch->SearchOperator = @$filter[\"z_npwp\"];\n\t\t$this->npwp->AdvancedSearch->SearchCondition = @$filter[\"v_npwp\"];\n\t\t$this->npwp->AdvancedSearch->SearchValue2 = @$filter[\"y_npwp\"];\n\t\t$this->npwp->AdvancedSearch->SearchOperator2 = @$filter[\"w_npwp\"];\n\t\t$this->npwp->AdvancedSearch->Save();\n\n\t\t// Field pimpinan\n\t\t$this->pimpinan->AdvancedSearch->SearchValue = @$filter[\"x_pimpinan\"];\n\t\t$this->pimpinan->AdvancedSearch->SearchOperator = @$filter[\"z_pimpinan\"];\n\t\t$this->pimpinan->AdvancedSearch->SearchCondition = @$filter[\"v_pimpinan\"];\n\t\t$this->pimpinan->AdvancedSearch->SearchValue2 = @$filter[\"y_pimpinan\"];\n\t\t$this->pimpinan->AdvancedSearch->SearchOperator2 = @$filter[\"w_pimpinan\"];\n\t\t$this->pimpinan->AdvancedSearch->Save();\n\n\t\t// Field bank\n\t\t$this->bank->AdvancedSearch->SearchValue = @$filter[\"x_bank\"];\n\t\t$this->bank->AdvancedSearch->SearchOperator = @$filter[\"z_bank\"];\n\t\t$this->bank->AdvancedSearch->SearchCondition = @$filter[\"v_bank\"];\n\t\t$this->bank->AdvancedSearch->SearchValue2 = @$filter[\"y_bank\"];\n\t\t$this->bank->AdvancedSearch->SearchOperator2 = @$filter[\"w_bank\"];\n\t\t$this->bank->AdvancedSearch->Save();\n\n\t\t// Field rek\n\t\t$this->rek->AdvancedSearch->SearchValue = @$filter[\"x_rek\"];\n\t\t$this->rek->AdvancedSearch->SearchOperator = @$filter[\"z_rek\"];\n\t\t$this->rek->AdvancedSearch->SearchCondition = @$filter[\"v_rek\"];\n\t\t$this->rek->AdvancedSearch->SearchValue2 = @$filter[\"y_rek\"];\n\t\t$this->rek->AdvancedSearch->SearchOperator2 = @$filter[\"w_rek\"];\n\t\t$this->rek->AdvancedSearch->Save();\n\n\t\t// Field nospm\n\t\t$this->nospm->AdvancedSearch->SearchValue = @$filter[\"x_nospm\"];\n\t\t$this->nospm->AdvancedSearch->SearchOperator = @$filter[\"z_nospm\"];\n\t\t$this->nospm->AdvancedSearch->SearchCondition = @$filter[\"v_nospm\"];\n\t\t$this->nospm->AdvancedSearch->SearchValue2 = @$filter[\"y_nospm\"];\n\t\t$this->nospm->AdvancedSearch->SearchOperator2 = @$filter[\"w_nospm\"];\n\t\t$this->nospm->AdvancedSearch->Save();\n\n\t\t// Field tglspm\n\t\t$this->tglspm->AdvancedSearch->SearchValue = @$filter[\"x_tglspm\"];\n\t\t$this->tglspm->AdvancedSearch->SearchOperator = @$filter[\"z_tglspm\"];\n\t\t$this->tglspm->AdvancedSearch->SearchCondition = @$filter[\"v_tglspm\"];\n\t\t$this->tglspm->AdvancedSearch->SearchValue2 = @$filter[\"y_tglspm\"];\n\t\t$this->tglspm->AdvancedSearch->SearchOperator2 = @$filter[\"w_tglspm\"];\n\t\t$this->tglspm->AdvancedSearch->Save();\n\n\t\t// Field ppn\n\t\t$this->ppn->AdvancedSearch->SearchValue = @$filter[\"x_ppn\"];\n\t\t$this->ppn->AdvancedSearch->SearchOperator = @$filter[\"z_ppn\"];\n\t\t$this->ppn->AdvancedSearch->SearchCondition = @$filter[\"v_ppn\"];\n\t\t$this->ppn->AdvancedSearch->SearchValue2 = @$filter[\"y_ppn\"];\n\t\t$this->ppn->AdvancedSearch->SearchOperator2 = @$filter[\"w_ppn\"];\n\t\t$this->ppn->AdvancedSearch->Save();\n\n\t\t// Field ps21\n\t\t$this->ps21->AdvancedSearch->SearchValue = @$filter[\"x_ps21\"];\n\t\t$this->ps21->AdvancedSearch->SearchOperator = @$filter[\"z_ps21\"];\n\t\t$this->ps21->AdvancedSearch->SearchCondition = @$filter[\"v_ps21\"];\n\t\t$this->ps21->AdvancedSearch->SearchValue2 = @$filter[\"y_ps21\"];\n\t\t$this->ps21->AdvancedSearch->SearchOperator2 = @$filter[\"w_ps21\"];\n\t\t$this->ps21->AdvancedSearch->Save();\n\n\t\t// Field ps22\n\t\t$this->ps22->AdvancedSearch->SearchValue = @$filter[\"x_ps22\"];\n\t\t$this->ps22->AdvancedSearch->SearchOperator = @$filter[\"z_ps22\"];\n\t\t$this->ps22->AdvancedSearch->SearchCondition = @$filter[\"v_ps22\"];\n\t\t$this->ps22->AdvancedSearch->SearchValue2 = @$filter[\"y_ps22\"];\n\t\t$this->ps22->AdvancedSearch->SearchOperator2 = @$filter[\"w_ps22\"];\n\t\t$this->ps22->AdvancedSearch->Save();\n\n\t\t// Field ps23\n\t\t$this->ps23->AdvancedSearch->SearchValue = @$filter[\"x_ps23\"];\n\t\t$this->ps23->AdvancedSearch->SearchOperator = @$filter[\"z_ps23\"];\n\t\t$this->ps23->AdvancedSearch->SearchCondition = @$filter[\"v_ps23\"];\n\t\t$this->ps23->AdvancedSearch->SearchValue2 = @$filter[\"y_ps23\"];\n\t\t$this->ps23->AdvancedSearch->SearchOperator2 = @$filter[\"w_ps23\"];\n\t\t$this->ps23->AdvancedSearch->Save();\n\n\t\t// Field ps4\n\t\t$this->ps4->AdvancedSearch->SearchValue = @$filter[\"x_ps4\"];\n\t\t$this->ps4->AdvancedSearch->SearchOperator = @$filter[\"z_ps4\"];\n\t\t$this->ps4->AdvancedSearch->SearchCondition = @$filter[\"v_ps4\"];\n\t\t$this->ps4->AdvancedSearch->SearchValue2 = @$filter[\"y_ps4\"];\n\t\t$this->ps4->AdvancedSearch->SearchOperator2 = @$filter[\"w_ps4\"];\n\t\t$this->ps4->AdvancedSearch->Save();\n\n\t\t// Field kodespm\n\t\t$this->kodespm->AdvancedSearch->SearchValue = @$filter[\"x_kodespm\"];\n\t\t$this->kodespm->AdvancedSearch->SearchOperator = @$filter[\"z_kodespm\"];\n\t\t$this->kodespm->AdvancedSearch->SearchCondition = @$filter[\"v_kodespm\"];\n\t\t$this->kodespm->AdvancedSearch->SearchValue2 = @$filter[\"y_kodespm\"];\n\t\t$this->kodespm->AdvancedSearch->SearchOperator2 = @$filter[\"w_kodespm\"];\n\t\t$this->kodespm->AdvancedSearch->Save();\n\n\t\t// Field nambud\n\t\t$this->nambud->AdvancedSearch->SearchValue = @$filter[\"x_nambud\"];\n\t\t$this->nambud->AdvancedSearch->SearchOperator = @$filter[\"z_nambud\"];\n\t\t$this->nambud->AdvancedSearch->SearchCondition = @$filter[\"v_nambud\"];\n\t\t$this->nambud->AdvancedSearch->SearchValue2 = @$filter[\"y_nambud\"];\n\t\t$this->nambud->AdvancedSearch->SearchOperator2 = @$filter[\"w_nambud\"];\n\t\t$this->nambud->AdvancedSearch->Save();\n\n\t\t// Field nppk\n\t\t$this->nppk->AdvancedSearch->SearchValue = @$filter[\"x_nppk\"];\n\t\t$this->nppk->AdvancedSearch->SearchOperator = @$filter[\"z_nppk\"];\n\t\t$this->nppk->AdvancedSearch->SearchCondition = @$filter[\"v_nppk\"];\n\t\t$this->nppk->AdvancedSearch->SearchValue2 = @$filter[\"y_nppk\"];\n\t\t$this->nppk->AdvancedSearch->SearchOperator2 = @$filter[\"w_nppk\"];\n\t\t$this->nppk->AdvancedSearch->Save();\n\n\t\t// Field nipppk\n\t\t$this->nipppk->AdvancedSearch->SearchValue = @$filter[\"x_nipppk\"];\n\t\t$this->nipppk->AdvancedSearch->SearchOperator = @$filter[\"z_nipppk\"];\n\t\t$this->nipppk->AdvancedSearch->SearchCondition = @$filter[\"v_nipppk\"];\n\t\t$this->nipppk->AdvancedSearch->SearchValue2 = @$filter[\"y_nipppk\"];\n\t\t$this->nipppk->AdvancedSearch->SearchOperator2 = @$filter[\"w_nipppk\"];\n\t\t$this->nipppk->AdvancedSearch->Save();\n\n\t\t// Field prog\n\t\t$this->prog->AdvancedSearch->SearchValue = @$filter[\"x_prog\"];\n\t\t$this->prog->AdvancedSearch->SearchOperator = @$filter[\"z_prog\"];\n\t\t$this->prog->AdvancedSearch->SearchCondition = @$filter[\"v_prog\"];\n\t\t$this->prog->AdvancedSearch->SearchValue2 = @$filter[\"y_prog\"];\n\t\t$this->prog->AdvancedSearch->SearchOperator2 = @$filter[\"w_prog\"];\n\t\t$this->prog->AdvancedSearch->Save();\n\n\t\t// Field prog1\n\t\t$this->prog1->AdvancedSearch->SearchValue = @$filter[\"x_prog1\"];\n\t\t$this->prog1->AdvancedSearch->SearchOperator = @$filter[\"z_prog1\"];\n\t\t$this->prog1->AdvancedSearch->SearchCondition = @$filter[\"v_prog1\"];\n\t\t$this->prog1->AdvancedSearch->SearchValue2 = @$filter[\"y_prog1\"];\n\t\t$this->prog1->AdvancedSearch->SearchOperator2 = @$filter[\"w_prog1\"];\n\t\t$this->prog1->AdvancedSearch->Save();\n\n\t\t// Field bayar\n\t\t$this->bayar->AdvancedSearch->SearchValue = @$filter[\"x_bayar\"];\n\t\t$this->bayar->AdvancedSearch->SearchOperator = @$filter[\"z_bayar\"];\n\t\t$this->bayar->AdvancedSearch->SearchCondition = @$filter[\"v_bayar\"];\n\t\t$this->bayar->AdvancedSearch->SearchValue2 = @$filter[\"y_bayar\"];\n\t\t$this->bayar->AdvancedSearch->SearchOperator2 = @$filter[\"w_bayar\"];\n\t\t$this->bayar->AdvancedSearch->Save();\n\t\t$this->BasicSearch->setKeyword(@$filter[EW_TABLE_BASIC_SEARCH]);\n\t\t$this->BasicSearch->setType(@$filter[EW_TABLE_BASIC_SEARCH_TYPE]);\n\t}", "function RestoreFilterList() {\n\n\t\t// Return if not reset filter\n\t\tif (@$_POST[\"cmd\"] <> \"resetfilter\")\n\t\t\treturn FALSE;\n\t\t$filter = json_decode(ew_StripSlashes(@$_POST[\"filter\"]), TRUE);\n\t\t$this->Command = \"search\";\n\n\t\t// Field id\n\t\t$this->id->AdvancedSearch->SearchValue = @$filter[\"x_id\"];\n\t\t$this->id->AdvancedSearch->SearchOperator = @$filter[\"z_id\"];\n\t\t$this->id->AdvancedSearch->SearchCondition = @$filter[\"v_id\"];\n\t\t$this->id->AdvancedSearch->SearchValue2 = @$filter[\"y_id\"];\n\t\t$this->id->AdvancedSearch->SearchOperator2 = @$filter[\"w_id\"];\n\t\t$this->id->AdvancedSearch->Save();\n\n\t\t// Field name\n\t\t$this->name->AdvancedSearch->SearchValue = @$filter[\"x_name\"];\n\t\t$this->name->AdvancedSearch->SearchOperator = @$filter[\"z_name\"];\n\t\t$this->name->AdvancedSearch->SearchCondition = @$filter[\"v_name\"];\n\t\t$this->name->AdvancedSearch->SearchValue2 = @$filter[\"y_name\"];\n\t\t$this->name->AdvancedSearch->SearchOperator2 = @$filter[\"w_name\"];\n\t\t$this->name->AdvancedSearch->Save();\n\n\t\t// Field email\n\t\t$this->_email->AdvancedSearch->SearchValue = @$filter[\"x__email\"];\n\t\t$this->_email->AdvancedSearch->SearchOperator = @$filter[\"z__email\"];\n\t\t$this->_email->AdvancedSearch->SearchCondition = @$filter[\"v__email\"];\n\t\t$this->_email->AdvancedSearch->SearchValue2 = @$filter[\"y__email\"];\n\t\t$this->_email->AdvancedSearch->SearchOperator2 = @$filter[\"w__email\"];\n\t\t$this->_email->AdvancedSearch->Save();\n\n\t\t// Field companyname\n\t\t$this->companyname->AdvancedSearch->SearchValue = @$filter[\"x_companyname\"];\n\t\t$this->companyname->AdvancedSearch->SearchOperator = @$filter[\"z_companyname\"];\n\t\t$this->companyname->AdvancedSearch->SearchCondition = @$filter[\"v_companyname\"];\n\t\t$this->companyname->AdvancedSearch->SearchValue2 = @$filter[\"y_companyname\"];\n\t\t$this->companyname->AdvancedSearch->SearchOperator2 = @$filter[\"w_companyname\"];\n\t\t$this->companyname->AdvancedSearch->Save();\n\n\t\t// Field servicetime\n\t\t$this->servicetime->AdvancedSearch->SearchValue = @$filter[\"x_servicetime\"];\n\t\t$this->servicetime->AdvancedSearch->SearchOperator = @$filter[\"z_servicetime\"];\n\t\t$this->servicetime->AdvancedSearch->SearchCondition = @$filter[\"v_servicetime\"];\n\t\t$this->servicetime->AdvancedSearch->SearchValue2 = @$filter[\"y_servicetime\"];\n\t\t$this->servicetime->AdvancedSearch->SearchOperator2 = @$filter[\"w_servicetime\"];\n\t\t$this->servicetime->AdvancedSearch->Save();\n\n\t\t// Field country\n\t\t$this->country->AdvancedSearch->SearchValue = @$filter[\"x_country\"];\n\t\t$this->country->AdvancedSearch->SearchOperator = @$filter[\"z_country\"];\n\t\t$this->country->AdvancedSearch->SearchCondition = @$filter[\"v_country\"];\n\t\t$this->country->AdvancedSearch->SearchValue2 = @$filter[\"y_country\"];\n\t\t$this->country->AdvancedSearch->SearchOperator2 = @$filter[\"w_country\"];\n\t\t$this->country->AdvancedSearch->Save();\n\n\t\t// Field phone\n\t\t$this->phone->AdvancedSearch->SearchValue = @$filter[\"x_phone\"];\n\t\t$this->phone->AdvancedSearch->SearchOperator = @$filter[\"z_phone\"];\n\t\t$this->phone->AdvancedSearch->SearchCondition = @$filter[\"v_phone\"];\n\t\t$this->phone->AdvancedSearch->SearchValue2 = @$filter[\"y_phone\"];\n\t\t$this->phone->AdvancedSearch->SearchOperator2 = @$filter[\"w_phone\"];\n\t\t$this->phone->AdvancedSearch->Save();\n\n\t\t// Field skype\n\t\t$this->skype->AdvancedSearch->SearchValue = @$filter[\"x_skype\"];\n\t\t$this->skype->AdvancedSearch->SearchOperator = @$filter[\"z_skype\"];\n\t\t$this->skype->AdvancedSearch->SearchCondition = @$filter[\"v_skype\"];\n\t\t$this->skype->AdvancedSearch->SearchValue2 = @$filter[\"y_skype\"];\n\t\t$this->skype->AdvancedSearch->SearchOperator2 = @$filter[\"w_skype\"];\n\t\t$this->skype->AdvancedSearch->Save();\n\n\t\t// Field website\n\t\t$this->website->AdvancedSearch->SearchValue = @$filter[\"x_website\"];\n\t\t$this->website->AdvancedSearch->SearchOperator = @$filter[\"z_website\"];\n\t\t$this->website->AdvancedSearch->SearchCondition = @$filter[\"v_website\"];\n\t\t$this->website->AdvancedSearch->SearchValue2 = @$filter[\"y_website\"];\n\t\t$this->website->AdvancedSearch->SearchOperator2 = @$filter[\"w_website\"];\n\t\t$this->website->AdvancedSearch->Save();\n\n\t\t// Field linkedin\n\t\t$this->linkedin->AdvancedSearch->SearchValue = @$filter[\"x_linkedin\"];\n\t\t$this->linkedin->AdvancedSearch->SearchOperator = @$filter[\"z_linkedin\"];\n\t\t$this->linkedin->AdvancedSearch->SearchCondition = @$filter[\"v_linkedin\"];\n\t\t$this->linkedin->AdvancedSearch->SearchValue2 = @$filter[\"y_linkedin\"];\n\t\t$this->linkedin->AdvancedSearch->SearchOperator2 = @$filter[\"w_linkedin\"];\n\t\t$this->linkedin->AdvancedSearch->Save();\n\n\t\t// Field facebook\n\t\t$this->facebook->AdvancedSearch->SearchValue = @$filter[\"x_facebook\"];\n\t\t$this->facebook->AdvancedSearch->SearchOperator = @$filter[\"z_facebook\"];\n\t\t$this->facebook->AdvancedSearch->SearchCondition = @$filter[\"v_facebook\"];\n\t\t$this->facebook->AdvancedSearch->SearchValue2 = @$filter[\"y_facebook\"];\n\t\t$this->facebook->AdvancedSearch->SearchOperator2 = @$filter[\"w_facebook\"];\n\t\t$this->facebook->AdvancedSearch->Save();\n\n\t\t// Field twitter\n\t\t$this->twitter->AdvancedSearch->SearchValue = @$filter[\"x_twitter\"];\n\t\t$this->twitter->AdvancedSearch->SearchOperator = @$filter[\"z_twitter\"];\n\t\t$this->twitter->AdvancedSearch->SearchCondition = @$filter[\"v_twitter\"];\n\t\t$this->twitter->AdvancedSearch->SearchValue2 = @$filter[\"y_twitter\"];\n\t\t$this->twitter->AdvancedSearch->SearchOperator2 = @$filter[\"w_twitter\"];\n\t\t$this->twitter->AdvancedSearch->Save();\n\n\t\t// Field active_code\n\t\t$this->active_code->AdvancedSearch->SearchValue = @$filter[\"x_active_code\"];\n\t\t$this->active_code->AdvancedSearch->SearchOperator = @$filter[\"z_active_code\"];\n\t\t$this->active_code->AdvancedSearch->SearchCondition = @$filter[\"v_active_code\"];\n\t\t$this->active_code->AdvancedSearch->SearchValue2 = @$filter[\"y_active_code\"];\n\t\t$this->active_code->AdvancedSearch->SearchOperator2 = @$filter[\"w_active_code\"];\n\t\t$this->active_code->AdvancedSearch->Save();\n\n\t\t// Field identification\n\t\t$this->identification->AdvancedSearch->SearchValue = @$filter[\"x_identification\"];\n\t\t$this->identification->AdvancedSearch->SearchOperator = @$filter[\"z_identification\"];\n\t\t$this->identification->AdvancedSearch->SearchCondition = @$filter[\"v_identification\"];\n\t\t$this->identification->AdvancedSearch->SearchValue2 = @$filter[\"y_identification\"];\n\t\t$this->identification->AdvancedSearch->SearchOperator2 = @$filter[\"w_identification\"];\n\t\t$this->identification->AdvancedSearch->Save();\n\n\t\t// Field link_expired\n\t\t$this->link_expired->AdvancedSearch->SearchValue = @$filter[\"x_link_expired\"];\n\t\t$this->link_expired->AdvancedSearch->SearchOperator = @$filter[\"z_link_expired\"];\n\t\t$this->link_expired->AdvancedSearch->SearchCondition = @$filter[\"v_link_expired\"];\n\t\t$this->link_expired->AdvancedSearch->SearchValue2 = @$filter[\"y_link_expired\"];\n\t\t$this->link_expired->AdvancedSearch->SearchOperator2 = @$filter[\"w_link_expired\"];\n\t\t$this->link_expired->AdvancedSearch->Save();\n\n\t\t// Field isactive\n\t\t$this->isactive->AdvancedSearch->SearchValue = @$filter[\"x_isactive\"];\n\t\t$this->isactive->AdvancedSearch->SearchOperator = @$filter[\"z_isactive\"];\n\t\t$this->isactive->AdvancedSearch->SearchCondition = @$filter[\"v_isactive\"];\n\t\t$this->isactive->AdvancedSearch->SearchValue2 = @$filter[\"y_isactive\"];\n\t\t$this->isactive->AdvancedSearch->SearchOperator2 = @$filter[\"w_isactive\"];\n\t\t$this->isactive->AdvancedSearch->Save();\n\n\t\t// Field pio\n\t\t$this->pio->AdvancedSearch->SearchValue = @$filter[\"x_pio\"];\n\t\t$this->pio->AdvancedSearch->SearchOperator = @$filter[\"z_pio\"];\n\t\t$this->pio->AdvancedSearch->SearchCondition = @$filter[\"v_pio\"];\n\t\t$this->pio->AdvancedSearch->SearchValue2 = @$filter[\"y_pio\"];\n\t\t$this->pio->AdvancedSearch->SearchOperator2 = @$filter[\"w_pio\"];\n\t\t$this->pio->AdvancedSearch->Save();\n\n\t\t// Field google\n\t\t$this->google->AdvancedSearch->SearchValue = @$filter[\"x_google\"];\n\t\t$this->google->AdvancedSearch->SearchOperator = @$filter[\"z_google\"];\n\t\t$this->google->AdvancedSearch->SearchCondition = @$filter[\"v_google\"];\n\t\t$this->google->AdvancedSearch->SearchValue2 = @$filter[\"y_google\"];\n\t\t$this->google->AdvancedSearch->SearchOperator2 = @$filter[\"w_google\"];\n\t\t$this->google->AdvancedSearch->Save();\n\n\t\t// Field instagram\n\t\t$this->instagram->AdvancedSearch->SearchValue = @$filter[\"x_instagram\"];\n\t\t$this->instagram->AdvancedSearch->SearchOperator = @$filter[\"z_instagram\"];\n\t\t$this->instagram->AdvancedSearch->SearchCondition = @$filter[\"v_instagram\"];\n\t\t$this->instagram->AdvancedSearch->SearchValue2 = @$filter[\"y_instagram\"];\n\t\t$this->instagram->AdvancedSearch->SearchOperator2 = @$filter[\"w_instagram\"];\n\t\t$this->instagram->AdvancedSearch->Save();\n\n\t\t// Field account_type\n\t\t$this->account_type->AdvancedSearch->SearchValue = @$filter[\"x_account_type\"];\n\t\t$this->account_type->AdvancedSearch->SearchOperator = @$filter[\"z_account_type\"];\n\t\t$this->account_type->AdvancedSearch->SearchCondition = @$filter[\"v_account_type\"];\n\t\t$this->account_type->AdvancedSearch->SearchValue2 = @$filter[\"y_account_type\"];\n\t\t$this->account_type->AdvancedSearch->SearchOperator2 = @$filter[\"w_account_type\"];\n\t\t$this->account_type->AdvancedSearch->Save();\n\n\t\t// Field logo\n\t\t$this->logo->AdvancedSearch->SearchValue = @$filter[\"x_logo\"];\n\t\t$this->logo->AdvancedSearch->SearchOperator = @$filter[\"z_logo\"];\n\t\t$this->logo->AdvancedSearch->SearchCondition = @$filter[\"v_logo\"];\n\t\t$this->logo->AdvancedSearch->SearchValue2 = @$filter[\"y_logo\"];\n\t\t$this->logo->AdvancedSearch->SearchOperator2 = @$filter[\"w_logo\"];\n\t\t$this->logo->AdvancedSearch->Save();\n\n\t\t// Field profilepic\n\t\t$this->profilepic->AdvancedSearch->SearchValue = @$filter[\"x_profilepic\"];\n\t\t$this->profilepic->AdvancedSearch->SearchOperator = @$filter[\"z_profilepic\"];\n\t\t$this->profilepic->AdvancedSearch->SearchCondition = @$filter[\"v_profilepic\"];\n\t\t$this->profilepic->AdvancedSearch->SearchValue2 = @$filter[\"y_profilepic\"];\n\t\t$this->profilepic->AdvancedSearch->SearchOperator2 = @$filter[\"w_profilepic\"];\n\t\t$this->profilepic->AdvancedSearch->Save();\n\n\t\t// Field mailref\n\t\t$this->mailref->AdvancedSearch->SearchValue = @$filter[\"x_mailref\"];\n\t\t$this->mailref->AdvancedSearch->SearchOperator = @$filter[\"z_mailref\"];\n\t\t$this->mailref->AdvancedSearch->SearchCondition = @$filter[\"v_mailref\"];\n\t\t$this->mailref->AdvancedSearch->SearchValue2 = @$filter[\"y_mailref\"];\n\t\t$this->mailref->AdvancedSearch->SearchOperator2 = @$filter[\"w_mailref\"];\n\t\t$this->mailref->AdvancedSearch->Save();\n\n\t\t// Field deleted\n\t\t$this->deleted->AdvancedSearch->SearchValue = @$filter[\"x_deleted\"];\n\t\t$this->deleted->AdvancedSearch->SearchOperator = @$filter[\"z_deleted\"];\n\t\t$this->deleted->AdvancedSearch->SearchCondition = @$filter[\"v_deleted\"];\n\t\t$this->deleted->AdvancedSearch->SearchValue2 = @$filter[\"y_deleted\"];\n\t\t$this->deleted->AdvancedSearch->SearchOperator2 = @$filter[\"w_deleted\"];\n\t\t$this->deleted->AdvancedSearch->Save();\n\n\t\t// Field deletefeedback\n\t\t$this->deletefeedback->AdvancedSearch->SearchValue = @$filter[\"x_deletefeedback\"];\n\t\t$this->deletefeedback->AdvancedSearch->SearchOperator = @$filter[\"z_deletefeedback\"];\n\t\t$this->deletefeedback->AdvancedSearch->SearchCondition = @$filter[\"v_deletefeedback\"];\n\t\t$this->deletefeedback->AdvancedSearch->SearchValue2 = @$filter[\"y_deletefeedback\"];\n\t\t$this->deletefeedback->AdvancedSearch->SearchOperator2 = @$filter[\"w_deletefeedback\"];\n\t\t$this->deletefeedback->AdvancedSearch->Save();\n\n\t\t// Field account_id\n\t\t$this->account_id->AdvancedSearch->SearchValue = @$filter[\"x_account_id\"];\n\t\t$this->account_id->AdvancedSearch->SearchOperator = @$filter[\"z_account_id\"];\n\t\t$this->account_id->AdvancedSearch->SearchCondition = @$filter[\"v_account_id\"];\n\t\t$this->account_id->AdvancedSearch->SearchValue2 = @$filter[\"y_account_id\"];\n\t\t$this->account_id->AdvancedSearch->SearchOperator2 = @$filter[\"w_account_id\"];\n\t\t$this->account_id->AdvancedSearch->Save();\n\n\t\t// Field start_date\n\t\t$this->start_date->AdvancedSearch->SearchValue = @$filter[\"x_start_date\"];\n\t\t$this->start_date->AdvancedSearch->SearchOperator = @$filter[\"z_start_date\"];\n\t\t$this->start_date->AdvancedSearch->SearchCondition = @$filter[\"v_start_date\"];\n\t\t$this->start_date->AdvancedSearch->SearchValue2 = @$filter[\"y_start_date\"];\n\t\t$this->start_date->AdvancedSearch->SearchOperator2 = @$filter[\"w_start_date\"];\n\t\t$this->start_date->AdvancedSearch->Save();\n\n\t\t// Field end_date\n\t\t$this->end_date->AdvancedSearch->SearchValue = @$filter[\"x_end_date\"];\n\t\t$this->end_date->AdvancedSearch->SearchOperator = @$filter[\"z_end_date\"];\n\t\t$this->end_date->AdvancedSearch->SearchCondition = @$filter[\"v_end_date\"];\n\t\t$this->end_date->AdvancedSearch->SearchValue2 = @$filter[\"y_end_date\"];\n\t\t$this->end_date->AdvancedSearch->SearchOperator2 = @$filter[\"w_end_date\"];\n\t\t$this->end_date->AdvancedSearch->Save();\n\n\t\t// Field year_moth\n\t\t$this->year_moth->AdvancedSearch->SearchValue = @$filter[\"x_year_moth\"];\n\t\t$this->year_moth->AdvancedSearch->SearchOperator = @$filter[\"z_year_moth\"];\n\t\t$this->year_moth->AdvancedSearch->SearchCondition = @$filter[\"v_year_moth\"];\n\t\t$this->year_moth->AdvancedSearch->SearchValue2 = @$filter[\"y_year_moth\"];\n\t\t$this->year_moth->AdvancedSearch->SearchOperator2 = @$filter[\"w_year_moth\"];\n\t\t$this->year_moth->AdvancedSearch->Save();\n\n\t\t// Field registerdate\n\t\t$this->registerdate->AdvancedSearch->SearchValue = @$filter[\"x_registerdate\"];\n\t\t$this->registerdate->AdvancedSearch->SearchOperator = @$filter[\"z_registerdate\"];\n\t\t$this->registerdate->AdvancedSearch->SearchCondition = @$filter[\"v_registerdate\"];\n\t\t$this->registerdate->AdvancedSearch->SearchValue2 = @$filter[\"y_registerdate\"];\n\t\t$this->registerdate->AdvancedSearch->SearchOperator2 = @$filter[\"w_registerdate\"];\n\t\t$this->registerdate->AdvancedSearch->Save();\n\n\t\t// Field login_type\n\t\t$this->login_type->AdvancedSearch->SearchValue = @$filter[\"x_login_type\"];\n\t\t$this->login_type->AdvancedSearch->SearchOperator = @$filter[\"z_login_type\"];\n\t\t$this->login_type->AdvancedSearch->SearchCondition = @$filter[\"v_login_type\"];\n\t\t$this->login_type->AdvancedSearch->SearchValue2 = @$filter[\"y_login_type\"];\n\t\t$this->login_type->AdvancedSearch->SearchOperator2 = @$filter[\"w_login_type\"];\n\t\t$this->login_type->AdvancedSearch->Save();\n\n\t\t// Field accountstatus\n\t\t$this->accountstatus->AdvancedSearch->SearchValue = @$filter[\"x_accountstatus\"];\n\t\t$this->accountstatus->AdvancedSearch->SearchOperator = @$filter[\"z_accountstatus\"];\n\t\t$this->accountstatus->AdvancedSearch->SearchCondition = @$filter[\"v_accountstatus\"];\n\t\t$this->accountstatus->AdvancedSearch->SearchValue2 = @$filter[\"y_accountstatus\"];\n\t\t$this->accountstatus->AdvancedSearch->SearchOperator2 = @$filter[\"w_accountstatus\"];\n\t\t$this->accountstatus->AdvancedSearch->Save();\n\n\t\t// Field ispay\n\t\t$this->ispay->AdvancedSearch->SearchValue = @$filter[\"x_ispay\"];\n\t\t$this->ispay->AdvancedSearch->SearchOperator = @$filter[\"z_ispay\"];\n\t\t$this->ispay->AdvancedSearch->SearchCondition = @$filter[\"v_ispay\"];\n\t\t$this->ispay->AdvancedSearch->SearchValue2 = @$filter[\"y_ispay\"];\n\t\t$this->ispay->AdvancedSearch->SearchOperator2 = @$filter[\"w_ispay\"];\n\t\t$this->ispay->AdvancedSearch->Save();\n\n\t\t// Field profilelink\n\t\t$this->profilelink->AdvancedSearch->SearchValue = @$filter[\"x_profilelink\"];\n\t\t$this->profilelink->AdvancedSearch->SearchOperator = @$filter[\"z_profilelink\"];\n\t\t$this->profilelink->AdvancedSearch->SearchCondition = @$filter[\"v_profilelink\"];\n\t\t$this->profilelink->AdvancedSearch->SearchValue2 = @$filter[\"y_profilelink\"];\n\t\t$this->profilelink->AdvancedSearch->SearchOperator2 = @$filter[\"w_profilelink\"];\n\t\t$this->profilelink->AdvancedSearch->Save();\n\n\t\t// Field source\n\t\t$this->source->AdvancedSearch->SearchValue = @$filter[\"x_source\"];\n\t\t$this->source->AdvancedSearch->SearchOperator = @$filter[\"z_source\"];\n\t\t$this->source->AdvancedSearch->SearchCondition = @$filter[\"v_source\"];\n\t\t$this->source->AdvancedSearch->SearchValue2 = @$filter[\"y_source\"];\n\t\t$this->source->AdvancedSearch->SearchOperator2 = @$filter[\"w_source\"];\n\t\t$this->source->AdvancedSearch->Save();\n\n\t\t// Field agree\n\t\t$this->agree->AdvancedSearch->SearchValue = @$filter[\"x_agree\"];\n\t\t$this->agree->AdvancedSearch->SearchOperator = @$filter[\"z_agree\"];\n\t\t$this->agree->AdvancedSearch->SearchCondition = @$filter[\"v_agree\"];\n\t\t$this->agree->AdvancedSearch->SearchValue2 = @$filter[\"y_agree\"];\n\t\t$this->agree->AdvancedSearch->SearchOperator2 = @$filter[\"w_agree\"];\n\t\t$this->agree->AdvancedSearch->Save();\n\n\t\t// Field balance\n\t\t$this->balance->AdvancedSearch->SearchValue = @$filter[\"x_balance\"];\n\t\t$this->balance->AdvancedSearch->SearchOperator = @$filter[\"z_balance\"];\n\t\t$this->balance->AdvancedSearch->SearchCondition = @$filter[\"v_balance\"];\n\t\t$this->balance->AdvancedSearch->SearchValue2 = @$filter[\"y_balance\"];\n\t\t$this->balance->AdvancedSearch->SearchOperator2 = @$filter[\"w_balance\"];\n\t\t$this->balance->AdvancedSearch->Save();\n\n\t\t// Field job_title\n\t\t$this->job_title->AdvancedSearch->SearchValue = @$filter[\"x_job_title\"];\n\t\t$this->job_title->AdvancedSearch->SearchOperator = @$filter[\"z_job_title\"];\n\t\t$this->job_title->AdvancedSearch->SearchCondition = @$filter[\"v_job_title\"];\n\t\t$this->job_title->AdvancedSearch->SearchValue2 = @$filter[\"y_job_title\"];\n\t\t$this->job_title->AdvancedSearch->SearchOperator2 = @$filter[\"w_job_title\"];\n\t\t$this->job_title->AdvancedSearch->Save();\n\n\t\t// Field projects\n\t\t$this->projects->AdvancedSearch->SearchValue = @$filter[\"x_projects\"];\n\t\t$this->projects->AdvancedSearch->SearchOperator = @$filter[\"z_projects\"];\n\t\t$this->projects->AdvancedSearch->SearchCondition = @$filter[\"v_projects\"];\n\t\t$this->projects->AdvancedSearch->SearchValue2 = @$filter[\"y_projects\"];\n\t\t$this->projects->AdvancedSearch->SearchOperator2 = @$filter[\"w_projects\"];\n\t\t$this->projects->AdvancedSearch->Save();\n\n\t\t// Field opportunities\n\t\t$this->opportunities->AdvancedSearch->SearchValue = @$filter[\"x_opportunities\"];\n\t\t$this->opportunities->AdvancedSearch->SearchOperator = @$filter[\"z_opportunities\"];\n\t\t$this->opportunities->AdvancedSearch->SearchCondition = @$filter[\"v_opportunities\"];\n\t\t$this->opportunities->AdvancedSearch->SearchValue2 = @$filter[\"y_opportunities\"];\n\t\t$this->opportunities->AdvancedSearch->SearchOperator2 = @$filter[\"w_opportunities\"];\n\t\t$this->opportunities->AdvancedSearch->Save();\n\n\t\t// Field isconsaltant\n\t\t$this->isconsaltant->AdvancedSearch->SearchValue = @$filter[\"x_isconsaltant\"];\n\t\t$this->isconsaltant->AdvancedSearch->SearchOperator = @$filter[\"z_isconsaltant\"];\n\t\t$this->isconsaltant->AdvancedSearch->SearchCondition = @$filter[\"v_isconsaltant\"];\n\t\t$this->isconsaltant->AdvancedSearch->SearchValue2 = @$filter[\"y_isconsaltant\"];\n\t\t$this->isconsaltant->AdvancedSearch->SearchOperator2 = @$filter[\"w_isconsaltant\"];\n\t\t$this->isconsaltant->AdvancedSearch->Save();\n\n\t\t// Field isagent\n\t\t$this->isagent->AdvancedSearch->SearchValue = @$filter[\"x_isagent\"];\n\t\t$this->isagent->AdvancedSearch->SearchOperator = @$filter[\"z_isagent\"];\n\t\t$this->isagent->AdvancedSearch->SearchCondition = @$filter[\"v_isagent\"];\n\t\t$this->isagent->AdvancedSearch->SearchValue2 = @$filter[\"y_isagent\"];\n\t\t$this->isagent->AdvancedSearch->SearchOperator2 = @$filter[\"w_isagent\"];\n\t\t$this->isagent->AdvancedSearch->Save();\n\n\t\t// Field isinvestor\n\t\t$this->isinvestor->AdvancedSearch->SearchValue = @$filter[\"x_isinvestor\"];\n\t\t$this->isinvestor->AdvancedSearch->SearchOperator = @$filter[\"z_isinvestor\"];\n\t\t$this->isinvestor->AdvancedSearch->SearchCondition = @$filter[\"v_isinvestor\"];\n\t\t$this->isinvestor->AdvancedSearch->SearchValue2 = @$filter[\"y_isinvestor\"];\n\t\t$this->isinvestor->AdvancedSearch->SearchOperator2 = @$filter[\"w_isinvestor\"];\n\t\t$this->isinvestor->AdvancedSearch->Save();\n\n\t\t// Field isbusinessman\n\t\t$this->isbusinessman->AdvancedSearch->SearchValue = @$filter[\"x_isbusinessman\"];\n\t\t$this->isbusinessman->AdvancedSearch->SearchOperator = @$filter[\"z_isbusinessman\"];\n\t\t$this->isbusinessman->AdvancedSearch->SearchCondition = @$filter[\"v_isbusinessman\"];\n\t\t$this->isbusinessman->AdvancedSearch->SearchValue2 = @$filter[\"y_isbusinessman\"];\n\t\t$this->isbusinessman->AdvancedSearch->SearchOperator2 = @$filter[\"w_isbusinessman\"];\n\t\t$this->isbusinessman->AdvancedSearch->Save();\n\n\t\t// Field isprovider\n\t\t$this->isprovider->AdvancedSearch->SearchValue = @$filter[\"x_isprovider\"];\n\t\t$this->isprovider->AdvancedSearch->SearchOperator = @$filter[\"z_isprovider\"];\n\t\t$this->isprovider->AdvancedSearch->SearchCondition = @$filter[\"v_isprovider\"];\n\t\t$this->isprovider->AdvancedSearch->SearchValue2 = @$filter[\"y_isprovider\"];\n\t\t$this->isprovider->AdvancedSearch->SearchOperator2 = @$filter[\"w_isprovider\"];\n\t\t$this->isprovider->AdvancedSearch->Save();\n\n\t\t// Field isproductowner\n\t\t$this->isproductowner->AdvancedSearch->SearchValue = @$filter[\"x_isproductowner\"];\n\t\t$this->isproductowner->AdvancedSearch->SearchOperator = @$filter[\"z_isproductowner\"];\n\t\t$this->isproductowner->AdvancedSearch->SearchCondition = @$filter[\"v_isproductowner\"];\n\t\t$this->isproductowner->AdvancedSearch->SearchValue2 = @$filter[\"y_isproductowner\"];\n\t\t$this->isproductowner->AdvancedSearch->SearchOperator2 = @$filter[\"w_isproductowner\"];\n\t\t$this->isproductowner->AdvancedSearch->Save();\n\n\t\t// Field states\n\t\t$this->states->AdvancedSearch->SearchValue = @$filter[\"x_states\"];\n\t\t$this->states->AdvancedSearch->SearchOperator = @$filter[\"z_states\"];\n\t\t$this->states->AdvancedSearch->SearchCondition = @$filter[\"v_states\"];\n\t\t$this->states->AdvancedSearch->SearchValue2 = @$filter[\"y_states\"];\n\t\t$this->states->AdvancedSearch->SearchOperator2 = @$filter[\"w_states\"];\n\t\t$this->states->AdvancedSearch->Save();\n\n\t\t// Field cities\n\t\t$this->cities->AdvancedSearch->SearchValue = @$filter[\"x_cities\"];\n\t\t$this->cities->AdvancedSearch->SearchOperator = @$filter[\"z_cities\"];\n\t\t$this->cities->AdvancedSearch->SearchCondition = @$filter[\"v_cities\"];\n\t\t$this->cities->AdvancedSearch->SearchValue2 = @$filter[\"y_cities\"];\n\t\t$this->cities->AdvancedSearch->SearchOperator2 = @$filter[\"w_cities\"];\n\t\t$this->cities->AdvancedSearch->Save();\n\n\t\t// Field offers\n\t\t$this->offers->AdvancedSearch->SearchValue = @$filter[\"x_offers\"];\n\t\t$this->offers->AdvancedSearch->SearchOperator = @$filter[\"z_offers\"];\n\t\t$this->offers->AdvancedSearch->SearchCondition = @$filter[\"v_offers\"];\n\t\t$this->offers->AdvancedSearch->SearchValue2 = @$filter[\"y_offers\"];\n\t\t$this->offers->AdvancedSearch->SearchOperator2 = @$filter[\"w_offers\"];\n\t\t$this->offers->AdvancedSearch->Save();\n\t\t$this->BasicSearch->setKeyword(@$filter[EW_TABLE_BASIC_SEARCH]);\n\t\t$this->BasicSearch->setType(@$filter[EW_TABLE_BASIC_SEARCH_TYPE]);\n\t}", "public function saveItemFilters()\n {\n $variables = $this->getAllSubmittedVariablesByName();\n\n $categories = array();\n\n foreach ($variables as $key => $value) {\n if (strstr($key, 'category|') && !empty($value)) {\n $categories[] = $value;\n }\n }\n\n $filter = ItemFilterModel::model()->find('play_id = :playId', array(\n ':playId' => $this->playid\n ));\n $method = 'update';\n\n if (empty($filter)) {\n $filter = new ItemFilterModel();\n $method = 'insert';\n }\n\n $filter->play_id = $this->playid;\n $filter->price_from = $variables['price_from'];\n $filter->price_to = $variables['price_to'];\n $filter->tags = json_encode($this->sessionGet('filter_tags'));\n $filter->categories = json_encode($categories);\n $filter->$method();\n\n if (isset($variables['filter_distance'])) {\n $this->saveVariable('filter_distance', $variables['filter_distance']);\n }\n\n return $filter;\n }", "public function decode($data);", "private function convertSerializedData()\n {\n $layoutUpdateQueryModifier = $this->queryModifierFactory->create(\n 'like',\n [\n 'values' => [\n 'xml' => '%conditions_encoded%'\n ]\n ]\n );\n $this->aggregatedFieldDataConverter->convert(\n [\n new FieldToConvert(\n SerializedToJson::class,\n $this->moduleDataSetup->getTable('widget_instance'),\n 'instance_id',\n 'widget_parameters'\n ),\n new FieldToConvert(\n LayoutUpdateConverter::class,\n $this->moduleDataSetup->getTable('layout_update'),\n 'layout_update_id',\n 'xml',\n $layoutUpdateQueryModifier\n ),\n ],\n $this->moduleDataSetup->getConnection()\n );\n }", "function _prepare_filter_data () {\n\t\t// Filter session array name\n\t\t$this->_filter_name\t= $_GET[\"object\"].\"_filter\";\n\t\t// Prepare boxes\n\t\t$this->_boxes = array_merge((array)$this->_boxes, array(\n\t\t\t\"status\"\t\t=> 'select_box(\"status\",\t\t$this->_articles_statuses2,\t$selected, 0, 2, \"\", false)',\n\t\t\t\"account_type\"\t=> 'select_box(\"account_type\",\t$this->_account_types2,\t\t$selected, 0, 2, \"\", false)',\n\t\t\t\"sort_by\"\t\t=> 'select_box(\"sort_by\",\t\t$this->_sort_by,\t\t\t$selected, 0, 2, \"\", false)',\n\t\t\t\"sort_order\"\t=> 'select_box(\"sort_order\",\t$this->_sort_orders,\t\t$selected, 0, 2, \"\", false)',\n\t\t));\n\t\t// Connect common used arrays\n\t\tif (file_exists(INCLUDE_PATH.\"common_code.php\")) {\n\t\t\tinclude (INCLUDE_PATH.\"common_code.php\");\n\t\t}\n\t\t// Get user account type\n\t\t$this->_account_types2[\" \"]\t= t(\"-- All --\");\n\t\tforeach ((array)$this->_account_types as $k => $v) {\n\t\t\t$this->_account_types2[$k]\t= $v;\n\t\t}\n\t\t// Get user account type\n\t\t$this->_articles_statuses2[\" \"]\t= t(\"-- All --\");\n\t\tforeach ((array)$this->_articles_statuses as $k => $v) {\n\t\t\t$this->_articles_statuses2[$k]\t= $v;\n\t\t}\n\t\t// Sort orders\n\t\t$this->_sort_orders = array(\"DESC\" => \"Descending\", \"ASC\" => \"Ascending\");\n\t\t// Sort fields\n\t\t$this->_sort_by = array(\n\t\t\t\"\",\n\t\t\t\"id\",\n\t\t\t\"cat_id\",\n\t\t\t\"user_id\",\n\t\t\t\"add_date\",\n\t\t);\n\t\t// Fields in the filter\n\t\t$this->_fields_in_filter = array(\n\t\t\t\"id_min\",\n\t\t\t\"id_max\",\n\t\t\t\"date_min\",\n\t\t\t\"date_max\",\n\t\t\t\"nick\",\n\t\t\t\"user_id\",\n\t\t\t\"title\",\n\t\t\t\"summary\",\n\t\t\t\"text\",\n\t\t\t\"account_type\",\n\t\t\t\"status\",\n\t\t\t\"cat_id\",\n\t\t\t\"sort_by\",\n\t\t\t\"sort_order\",\n\t\t);\n\t}", "protected function _decodeFilter($_filter, $_filterModel, $_throwExceptionIfEmpty = FALSE)\n {\n if ($_filter instanceof FilterGroup) {\n return $_filter;\n }\n\n $filterModel = $this->_getPluginForFilterModel($_filterModel);\n $decodedFilter = is_array($_filter) || strlen($_filter) == 40 ? $_filter : $this->_prepareParameter($_filter);\n\n if (is_array($decodedFilter)) {\n $filter = FilterGroup::getFilterForModel($filterModel);\n $filter->setFromArrayInUsersTimezone($decodedFilter);\n } else if (!empty($decodedFilter) && strlen($decodedFilter) == 40) {\n $filter = PersistentFilter::getFilterById($decodedFilter);\n } else if ($_throwExceptionIfEmpty) {\n throw new InvalidArgument('Filter must not be empty!');\n } else {\n $filter = FilterGroup::getFilterForModel($filterModel);\n }\n\n return $filter;\n }", "public function getFilterValues()\n {\n return $this->filter_values;\n }", "function getArrayListFilterCol() {\n\t\t\t$data['kodeunit'] = 'u.kodeunit';\n\t\t\t\n\t\t\treturn $data;\n\t\t}", "function mFILTER(){\n try {\n $_type = Erfurt_Sparql_Parser_Sparql11_Update_Tokenizer11::$FILTER;\n $_channel = Erfurt_Sparql_Parser_Sparql11_Update_Tokenizer11::$DEFAULT_TOKEN_CHANNEL;\n // Tokenizer11.g:211:3: ( 'filter' ) \n // Tokenizer11.g:212:3: 'filter' \n {\n $this->matchString(\"filter\"); \n\n\n }\n\n $this->state->type = $_type;\n $this->state->channel = $_channel;\n }\n catch(Exception $e){\n throw $e;\n }\n }", "public function decode($in) {}", "public function getFilter(): array\n {\n return $this->model->getFilter();\n }", "public function getPreparedFieldFilterValues () {\n return MLI18n::gi()->get(ucfirst(MLModul::gi()->getMarketPlaceName()).'_Productlist_Filter_aPreparedStatus');\n }", "function get_current_filters () \n{\n if (count($_GET) < 1) \n return array();\n \n foreach ($_GET as $field_name => $value) {\n if (strlen($value) < 1) continue;\n $filters[$field_name] = addslashes($value);\n }\n \n unset($filters[w]);\n \n return $filters;\n}", "function dblog_filters() {\n $filters = array();\n\n foreach (_dblog_get_message_types() as $type) {\n $types[$type] = t($type);\n }\n\n if (!empty($types)) {\n $filters['type'] = array(\n 'title' => t('Type'),\n 'where' => \"w.type = ?\",\n 'options' => $types,\n );\n }\n\n $filters['severity'] = array(\n 'title' => t('Severity'),\n 'where' => 'w.severity = ?',\n 'options' => watchdog_severity_levels(),\n );\n\n return $filters;\n}", "public function filters()\n {\n return [\n \n ];\n }", "function OnlineSQLdecode($strPass){\n //\tstrPass = Replace(strPass, \"'%'\", \"%\")\n //\tstrPass = Replace(strPass, \"''\", \"'\")\n //\tstrPass = Replace(strPass, \"'|'\", \"|\")\n //\tOnlineSQLdecode = strPass\n //End If\n return $strPass;\n}", "public function decode($raw);", "public function filters()\n {\n $filters = [];\n $filters['name'] = ['trim', 'empty_string_to_null', 'capitalize'];\n $filters['email'] = ['trim', 'empty_string_to_null', 'lowercase'];\n return $filters;\n }", "public function filterByEncryptionType($collection, $filterList, $nestedFilters)\n {\n foreach(array('normal', 'hashed') as $encType)\n {\n if(isset($filterList[$encType]))\n {\n $filterTypes = $filterList[$encType];\n\n foreach($filterTypes as $type => $filters)\n {\n foreach($filters as $key => $filter)\n {\n if($encType == 'hashed')\n {\n $decoded = hasher()->decode($filter);\n }\n\n $filter = ((isset($decoded) && $decoded) ? $decoded : $filter);\n\n if($filter !== '' && $filter !== null)\n {\n if(Schema::hasColumn($this->getTable(), $key))\n {\n switch($type)\n {\n case 'text':\n\n $collection->where($key, 'LIKE', \"%\".$filter.\"%\");\n\n break;\n\n case 'data':\n\n if(isset($filter['operator']))\n {\n if($filter['operator'] == 'NOT IN')\n {\n $collection->whereNotIn($key, $filter['value']);\n }\n else if($filter['operator'] == 'IN')\n {\n $collection->whereIn($key, $filter['value']);\n }\n else\n {\n $collection->where($key, $filter['operator'], $filter['value']);\n }\n }\n else\n {\n $collection->where($key, '=', $filter);\n }\n\n break;\n\n case 'model':\n\n $collection->where($key, '=', $filter);\n\n break;\n }\n }\n\n if($nestedFilters)\n {\n $nestedFilter = $this->getNestedFilterByKey($key, $nestedFilters);\n\n if($nestedFilter)\n {\n if($parent = $nestedFilter['model']->find($filter))\n {\n $children = $parent->getDescendants();\n\n if(!empty($children) && count($children) > 0)\n {\n foreach($children as $child)\n {\n $collection->orWhere($key, '=', $child->id);\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n\n return $collection;\n }", "public function CleanFilter(){\n\t\t$this->_objectFilter = new Model_Aclusuariosonline();\n\t}", "protected function prepareFilters()\n {\n if(count($this->api_query) === 0){\n return;\n }\n\n // Matched WHERE filters would be all\n // that are not KEYWORDS (count, page, embed...)\n foreach($this->api_query as $column => $value) {\n if(in_array($column, $this->api_keyword_filters)){\n continue;\n }\n\n $this->where_filters[$column]= $value;\n }\n }", "public function getFilters()\n {\n return array();\n }", "public static function apply_filters($filters, $data) {\n\t\t// 'boolean,encrypt,htmlspecialchars,strip_tags,int,lower,upper,strip_newlines,nl2br,function_reference,regex,trim'\n\t\tpreg_match_all('/\\%(.*?)\\=\\\"(.*?)\\\"/', $filters, $filters_array);\n\t\tif (count($filters_array[1]) == 0 || count($filters_array[2]) == 0) {\n\t\t\treturn $data;\n\t\t}\n\t\t$filters = array_combine($filters_array[1], $filters_array[2]);\n\t\t$allowed_filters = explode(',', self::filters_array);\n\t\tforeach ($filters as $filter => $value) {\n\t\t\tif (in_array($filter, $allowed_filters)) { \n\t\t\t\tswitch ($filter) {\n\t\t\t\t\tcase 'boolean':\n\t\t\t\t\t\t$data = (boolean) $data;\n\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'encrypt':\n\t\t\t\t\t\t$data = Encryption::encrypt($data);\n\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'htmlspecialchars':\n\t\t\t\t\t\t$data = htmlspecialchars($data);\n\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'strip_tags':\n\t\t\t\t\t\t$data = strip_tags($data, $value);\n\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'int':\n\t\t\t\t\t\t$data = (int) $data;\n\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'lower':\n\t\t\t\t\t\t$data = strtolower($data);\n\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'upper':\n\t\t\t\t\t\t$data = strtoupper($data);\n\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'strip_newlines':\n\t\t\t\t\t\t$data = str_replace(array('<br>', '<br />', '<br/>'), '', nl2br($data));\n\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'nl2br':\n\t\t\t\t\t\t$data = nl2br($data);\n\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'function':\n\t\t\t\t\t\t$data = call_user_func($value, $data);\n\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'function_reference':\n\t\t\t\t\t\tcall_user_func($value, $data);\n\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'regex':\n\t\t\t\t\t\t\n\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'trim':\n\t\t\t\t\t\t$data = trim($data);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn $data;\n\t}", "function genesisawesome_custom_filters( $filters ) {\n\n\t$filters['email'] = 'sanitize_email';\n\t$filters['integer'] = 'genesisawesome_intval';\n\n\treturn $filters;\n\n}", "private static function decodeFilterRunLengthDecode($data){\n\t\t$decoded = '';\n\t\t// data length\n\t\t$data_length = strlen($data);\n\t\t$i = 0;\n\t\twhile($i < $data_length){\n\t\t\t// get current byte value\n\t\t\t$byte = ord($data{$i});\n\t\t\tif($byte == 128){\n\t\t\t\t// a length value of 128 denote EOD\n\t\t\t\tbreak;\n\t\t\t} elseif($byte < 128){\n\t\t\t\t// if the length byte is in the range 0 to 127\n\t\t\t\t// the following length + 1 (1 to 128) bytes shall be copied literally during decompression\n\t\t\t\t$decoded .= substr($data, ($i + 1), ($byte + 1));\n\t\t\t\t// move to next block\n\t\t\t\t$i += ($byte + 2);\n\t\t\t} else {\n\t\t\t\t// if length is in the range 129 to 255,\n\t\t\t\t// the following single byte shall be copied 257 - length (2 to 128) times during decompression\n\t\t\t\t$decoded .= str_repeat($data{($i + 1)}, (257 - $byte));\n\t\t\t\t// move to next block\n\t\t\t\t$i += 2;\n\t\t\t}\n\t\t}\n\t\treturn $decoded;\n\t}", "protected function prepareFilter()\n\t{\n\t\tglobal $USER;\n\t\tglobal $DB;\n\n\t\t$arFilter = array();\n\t\t$arFilter[\"USER_ID\"] = $USER->GetID();\n\t\t$arFilter[\"LID\"] = SITE_ID;\n\n\t\tif (strlen($_REQUEST[\"filter_id\"]))\n\t\t{\n\t\t\tif ($this->options['USE_ACCOUNT_NUMBER'])\n\t\t\t\t$arFilter[\"ACCOUNT_NUMBER\"] = $_REQUEST[\"filter_id\"];\n\t\t\telse\n\t\t\t\t$arFilter[\"ID\"] = intval($_REQUEST[\"filter_id\"]);\n\t\t}\n\n\t\tif (strlen($_REQUEST[\"filter_date_from\"]))\n\t\t\t$arFilter[\"DATE_FROM\"] = trim($_REQUEST[\"filter_date_from\"]);\n\t\tif (strlen($_REQUEST[\"filter_date_to\"]))\n\t\t{\n\t\t\t$arFilter[\"DATE_TO\"] = trim($_REQUEST[\"filter_date_to\"]);\n\n\t\t\tif ($arDate = ParseDateTime(trim($_REQUEST[\"filter_date_to\"]), $this->dateFormat))\n\t\t\t{\n\t\t\t\tif (StrLen(trim($_REQUEST[\"filter_date_to\"])) < 11)\n\t\t\t\t{\n\t\t\t\t\t$arDate[\"HH\"] = 23;\n\t\t\t\t\t$arDate[\"MI\"] = 59;\n\t\t\t\t\t$arDate[\"SS\"] = 59;\n\t\t\t\t}\n\n\t\t\t\t$arFilter[\"DATE_TO\"] = date($DB->DateFormatToPHP($this->dateFormat), mktime($arDate[\"HH\"], $arDate[\"MI\"], $arDate[\"SS\"], $arDate[\"MM\"], $arDate[\"DD\"], $arDate[\"YYYY\"]));\n\t\t\t}\n\t\t}\n\n\t\tif (strlen($_REQUEST[\"filter_status\"]))\n\t\t\t$arFilter[\"STATUS_ID\"] = trim($_REQUEST[\"filter_status\"]);\n\n\t\tif (strlen($_REQUEST[\"filter_payed\"]))\n\t\t\t$arFilter[\"PAYED\"] = trim($_REQUEST[\"filter_payed\"]);\n\n\t\tif(!isset($_REQUEST['show_all']) || $_REQUEST['show_all'] == 'N')\n\t\t{\n\t\t\tif($_REQUEST[\"filter_history\"]!=\"Y\")\n\t\t\t\t$arFilter[\"!@COMPLETE_ORDERS\"] = $this->arParams['HISTORIC_STATUSES'];\n\n\t\t\tif(isset($_REQUEST[\"filter_history\"]) && $_REQUEST[\"filter_history\"] == \"Y\")\n\t\t\t\t$arFilter[\"@COMPLETE_ORDERS\"] = $this->arParams['HISTORIC_STATUSES'];\n\t\t}\n\n\t\tif (strlen($_REQUEST[\"filter_canceled\"]))\n\t\t\t$arFilter[\"CANCELED\"] = trim($_REQUEST[\"filter_canceled\"]);\n\n\t\t$this->filter = $arFilter;\n\t}", "function get_form_filter() {\n\n $val_ = new OrSysvalue();\n if (!is_null($var_)) {\n foreach ($val_->filter AS $id => $value) {\n //echo '$id [ ' . $id . ' ] = [ ' . $value . ' ] <br>' ;\n if ($id != 'filter_by') {\n if (!$this->filter_use[$id]) {\n $my_filter = new OrFieldHidden($id, 'val_filter[' . $id . ']');\n $my_filter->OP_[auto_post]->set(true);\n $my_filter_tag .= $my_filter->get_tag();\n\n if ($val_->compare[$id] == 'BETWEEN' OR $val_->message[$id . '_II'] != '') {\n $my_filter = new OrFieldHidden($id . '_II', 'val_msg[' . $id . '_II]');\n $my_filter->OP_[auto_post]->set(true);\n $my_filter_tag .= $my_filter->get_tag();\n }\n }\n $my_compare = new OrFieldHidden('val_compare_' . $id . '_', 'val_compare[' . $id . ']');\n $my_compare->OP_[auto_post]->set(true);\n $my_filter_tag .= $my_compare->get_tag();\n }\n }\n }\n\n\n /* $my_table = new OrTable('table_query');\n $my_table->OP_[align_table]->set('center');\n $my_table->OP_[class_name]->set('tbl_body');\n $my_table->set_col(' ค้นหา ' . $this->get_control_filter() . ' เรียง ' . $this->get_control_order() . ' ' . $this->get_button_filter() . $my_filter_tag );\n $my_table->set_row(); */\n $my_table = (' ค้นหา ' . $this->get_control_filter() . ' เรียง ' . $this->get_control_order() . ' ' . $this->get_button_filter() . $my_filter_tag );\n return $my_table;\n }", "private function prepare_filter(array $filter=array(), $to_sql) {\n\t\t\t$filter_array = array();\n\n\t\t\t$fields = self::$db->table_info($this->table_name);\n\n\t\t\t$table_name_i18n = $this->table_name.$this->i18n_table_suffix;\n\t\t\tif($is_18n=($this->is_i18n && self::$db->table_exists($table_name_i18n))) {\n\t\t\t\t$fields_i18n = self::$db->table_info($table_name_i18n);\n\t\t\t\t$fields = array_merge($fields, $fields_i18n);\n\t\t\t}\n\t\t\tforeach($fields AS $field) {\n\t\t\t\tif(isset($filter[$field[\"name\"]]) && !empty($filter[$field[\"name\"]]) && $to_sql) {\n\t\t\t\t\tif($field[\"real_type\"] == 'varchar') {\n\t\t\t\t\t\t$filter_array[] = \"{$field[\"name\"]} LIKE '\".self::$db->escape($filter[$field[\"name\"]]).\"'\";\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\t$filter_array[] = \"{$field[\"name\"]}='\".self::$db->escape($filter[$field[\"name\"]]).\"'\";\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (!$to_sql) {\n\t\t\t\tforeach($_GET AS $key=>$val) {\n\t\t\t\t\tif ($key == 'order' || $key == 'page' || empty($val)) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\t$filter_array[] = \"{$key}=\".urlencode($val);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn $filter_array;\n\t\t}" ]
[ "0.60707563", "0.5913808", "0.5892162", "0.5891308", "0.5822298", "0.5666523", "0.56428933", "0.56378585", "0.56014407", "0.55968046", "0.55968046", "0.55639064", "0.5507471", "0.5504322", "0.5494961", "0.54437804", "0.5417486", "0.54147184", "0.54120755", "0.5400004", "0.5362783", "0.53559536", "0.53502935", "0.5336389", "0.5310968", "0.5309491", "0.5296523", "0.5295674", "0.5294177", "0.5294177", "0.52929604", "0.5279104", "0.5275061", "0.52708095", "0.5261514", "0.5255593", "0.5250756", "0.522878", "0.52259123", "0.52252686", "0.52239954", "0.522123", "0.5220843", "0.5218953", "0.5199615", "0.5199594", "0.5153971", "0.51522726", "0.5149235", "0.5142509", "0.5141586", "0.51282614", "0.5122035", "0.512049", "0.5088666", "0.50884956", "0.5065624", "0.50643694", "0.50591886", "0.50573444", "0.5052422", "0.5052422", "0.5052422", "0.5052422", "0.5052422", "0.50503486", "0.5050322", "0.50398654", "0.5037563", "0.5032172", "0.50267255", "0.5015629", "0.50039864", "0.49999943", "0.49946374", "0.49872136", "0.4986706", "0.4978228", "0.4977772", "0.49746442", "0.49678844", "0.49622208", "0.49507958", "0.4948157", "0.49448898", "0.49399135", "0.49221638", "0.49172297", "0.49120218", "0.4908437", "0.49063608", "0.48976234", "0.48946458", "0.48941493", "0.4893347", "0.48898196", "0.48874822", "0.4884468", "0.48809195", "0.48661724" ]
0.5063454
58
n1 relationship The user added the tutorial
public function addedBy() { return $this->belongsTo(User::class, 'added_by'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function specialists() {\n return $this->belongsToMany('App\\User', 'user_specialization', 'topic_id', 'user_id')->withTimestamps();\n }", "public function addUser(){\n\t}", "public function addUser(){}", "public function isAddToRelationship();", "public function tutorial(){\n\t\t//pr($this->data);\n\n\t\t$teachersTutorial = $this->Teacher->find('first',array('fields' => 'id,istutorial','conditions' => array(\n\t\t\t'id' => $this->Session->read('User.id')\n\t\t\t),'recursive' => -1));\n\t\t//pr($teachersTutorial);\n\n\t\t$arr = array(\n\t\t\t\t'id' => $teachersTutorial['Teacher']['id'],\n\t\t\t\t'istutorial' => $this->data['isTutorial']\n\t\t\t);\n\t\t//pr($arr);\n\n\t\tif($this->Teacher->save($arr)){\n\t\t\t//activity logs start here\n\t\t\t\t$id = $this->Session->read('User.id');\n\t\t\t\t$name = $this->Session->read('User.wholename');\n\t\t\t\t$activity = 'Finished a tutorial';\n\t\t\t\t$this->createLogs($id,0,$name,$activity);\n\t\t\t//end logs\n\t\t\t$this->Session->setFlash(__('Cogratulations! The tutorial was successful. You may now help the students by sharing your knowledge and skills.'), 'default', array('class' => 'alert alert-success'));\n\t\t\treturn $this->redirect(array('controller' => 'teachers','action' => 'dashboard'));\n\t\t}else{\n\n\t\t}\n\t}", "public static function addUser()\n {\n // ADD NEW DATA TO A TABLE\n // MAKE SURE TO SEND USERS TO THE /users page when a user is added\n }", "public function teacher()\n {\n \treturn $this->belongsTo(User::class);\n }", "public function teacher(){\n return $this->belongsTo('App\\Models\\User', 'user_id');\n }", "function project_project_modifier(&$node)\n {\n userelation(\"atkonetomanyrelation\");\n $node->add(new atkOneToManyRelation(\"user_stories\", \"xp.story\", \"project\", AF_HIDE_LIST), \"user_stories\");\n }", "public function teacher() {\n return $this->belongsTo('App\\Models\\User', 'user_id');\n }", "public function createdbyuser() {\n # Define an inverse one-to-many relationship.\n return $this->belongsTo('\\dsa\\User');\n }", "public function testCreateUser()\n {\n /** @var Role $role */\n// $role = Role::query()->where('name', 'root')->get();\n// $user = User::query()->create([\n// 'name' => 'white',\n// 'email' => '[email protected]',\n// 'password' => '123456',\n// ]);\n// $role = Role::query()->where('id', 1)->get();\n// /** @var Permission $permission */\n// $permission = Permission::query()->where('name','edit articles')->get();\n// /** @var User $user */\n// $user = User::query()->where('name', 'white')->get();\n// $role->givePermissionTo('edit articles');\n// $setRoot = $permission->assignRole('whitess');\n// dd($setRoot);\n }", "public function teacher(){\n return $this->belongsTo(User::class);\n }", "public function actionAdd() {\n\t\treturn $this->txSave ( \"app\\models\\User\" );\n\t}", "function addUser()\n {\n $this->db->trans_begin();\n\n $table = ( $this->input->post('user_level') != \"parent\" )? \"teacher\":\"parent\";\n \n $IDuser = $this->model->addUser();\n $this->model->saveUserInfo( $IDuser, $table );\n\n if ( $this->db->trans_status() === FALSE ) $this->db->trans_rollback();\n else $this->db->trans_commit();\n\n redirect( 'guidance_user' );\n }", "public function create(){\n $tutorial = Input::get('user_id');\n $tutorial = Input::get('tutorial_slug');\n $tutorial = Input::get('tutorial_notes');\n $tutorial = Input::get('tutorial_language');\n $tutorial = Input::get('tutorial_url');\n $tutorial->save();\n return $tutorial;\n\n }", "public function author()\n {\n /// ManyToMany\n }", "function user_tutors ($target_user = \"\") {\n if (!$target_user) {\n global $user;\n $target_user = $user;\n } else {\n $target_user = eto_user_load(array('name' => $target_user));\n }\n\n if (!$target_user) {\n drupal_not_found();\n exit;\n }\n\n if ($target_user->uid != $user->uid) {\n if (! user_acccess('administer the site')) {\n drupal_access_denied();\n exit;\n }\n }\n\n\n $title = \"My Tutors\";\n drupal_set_title($title);\n\n $output .= user_tutors_block($target_user);\n\n return $output;\n}", "public function user()\n {\n return $this->belongsTo(User::class);//relacionamento da ordem 1\n }", "public function created(User $user)\n {\n $user->createUserRelationships();\n }", "function tutor_assignment_add($username, $type) {\n $type = rtrim($type, \"s\");\n\n $title = \"Add a $type to $username\";\n drupal_set_title($title);\n $output = \"<h2>$title</h2>\";\n\n $user = eto_user_load(array('name' => $username));\n\n $node = (object) array ('uid' => $user->uid,\n\t\t\t 'type' => $type);\n\n $output .= drupal_get_form('add_assignment_form', $node);\n\n return $output;\n}", "public function demo()\n\t{\n\t\t$ugelId=1;\n\t\t$ugel = $this->Ugel->find('first', array('conditions' => array('id' => $ugelId), 'recursive' => 2));\n\t\t$this->set('ugel', $ugel);\n\n\t\t// Let's use bindModel() to add a new association\n\t // to the Leader model:\n\t /*\n\t $this->Leader->bindModel(\n\t array('hasMany' => array(\n\t 'Principle' => array(\n\t 'className' => 'Principle'\n\t )\n\t )\n\t )\n\t );\n\t\t// Let's remove the hasMany...\n\t\t$this->Leader->unbindModel(\n\t\t\tarray('hasMany' => array('Follower'))\n\t\t);\n\t\t*/\n\t}", "public function testShouldCreateANewUser()\n {\n $user = factory(User::class)->create();\n\n $role = Role::where(\"name\", \"admin\")->first();\n $user->attachRole($role);\n\n $this->actingAs($user);\n\n $invitationLink = (new CreateInvitationLinkService($user))->execute([\n \"type\" => \"STUDENT\",\n ]);\n\n $createdUser = (new CreateUserService())->execute([\n \"name\" => $this->faker->name,\n \"email\" => $this->faker->unique()->safeEmail,\n \"password\" => \"12345678\",\n \"hash\" => $invitationLink->hash,\n ]);\n\n $this->assertTrue(is_numeric($createdUser->id));\n }", "public function add_user($id) {\n UserToPres::create_entry($id,$this->id);\n }", "public function topic()\n {\n return $this->belongsTo('App\\User');\n }", "public function creating(User $user)\n {\n\n }", "public function getAuthor() \n {\n return $this->hasOne(User::className(), ['id' => 'user_id']); \n }", "public function teachers(){\n return $this->hasMany(TeacherProfile::class,'academy_id','user_id');\n }", "public function add()\n\t{\n\t\t// TODO\n\t\t// if(user has permissions){}\n\t\t$this -> loadModel('User');\n\t\tif($this -> request -> is('post') && !$this -> User -> exists($this -> request -> data['SgaPerson']['user_id']))\n\t\t{\n\t\t\t$this -> Session -> setFlash(\"Please select a valid JacketPages user to add.\");\n\t\t\t$this -> redirect(array('action' => 'index',$id));\n\t\t}\n\t\t$this -> loadModel('User');\n\t\tif ($this -> request -> is('post'))\n\t\t{\n\t\t\t$this -> SgaPerson -> create();\n\t\t\tif ($this -> SgaPerson -> save($this -> data))\n\t\t\t{\n\t\t\t\t$user = $this -> User -> read(null, $this -> data['SgaPerson']['user_id']);\n\t\t\t\t$this -> User -> set('level', 'sga_user');\n\t\t\t\t$this -> User -> set('sga_id', $this -> SgaPerson -> getInsertID());\n\t\t\t\t$this -> User -> save();\n\t\t\t\t$this -> Session -> setFlash(__('The user has been added to SGA.', true));\n\t\t\t\t$this -> redirect(array('action' => 'index'));\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$this -> Session -> setFlash(__('Invalid user. User may already be assigned a role in SGA. Please try again.', true));\n\t\t\t}\n\t\t}\n\t}", "function addNew()\n {\n if($this->isAdmin() == TRUE)\n {\n $this->loadThis();\n }\n else\n {\n $this->load->model('user_model');\n $data['roles'] = $this->user_model->getUserRoles();\n \n $this->global['pageTitle'] = 'Garuda Informatics : Add New User';\n\n $this->loadViews($this->view.\"addNew\", $this->global, $data, NULL);\n }\n }", "public function teachers()\n {\n return $this->hasMany('App\\Models\\Person');\n }", "public function add()\n\t{\n\t\tif (! $this->is_admin) {\n\t\t\t$this->redirect('admin/error/deny');\n\t\t}\n\n\t\t$authModel = M('auth');\n\t\t$userModel = M('user');\n\n\t\t$authArr = $authModel->field('user_id')->where(array('level' => 1))->select();\n\t\t$leaderUids = makeImplode($authArr, 'user_id');\n\n\t\t$userArr = $userModel\n\t\t\t->field('id, truename')\n\t\t\t->where(array('id' => array('IN', \"$leaderUids\")))\n\t\t\t->select();\n\n\t\t$leaderIdsList = makeIndex($userArr, 'id');\n\n\t\t$this->assign('leader_list', $userArr);\n\t\t$this->display();\n\t}", "public function adminTeacher(){\n\n }", "function relUser(){\n return $this->hasOne('App\\User', 'id', 'id_user');\n }", "public function participants()\n{\n\treturn $this->belongsToMany(User::class);\n}", "public function follows(){\n\n return $this->belongsToMany(Question::class,'user_question')->withTimestamps();\n }", "public function teacher()\n {\n return $this->belongsTo(User::class,'teacher_id', 'id');\n }", "public function initiator()\n{\n return $this->belongsTo('App\\User', 'user_id', 'id');\n}", "public function addedBy()\n {\n return $this->belongsTo(User::class);\n }", "public function user(): BelongsTo;", "public function run()\n {\n $user = User::find(2); //expert\n $user->expert()->create([\n 'mobile' => '01199493929',\n 'is_active' => true,\n 'status' => 'approved',\n 'slug' => str_slug($user->name, '-'),\n 'profile_picture_url' => 'images/expert.jpg',\n 'cost_per_minute' => 10,\n 'bio' => 'This is a short bio',\n 'current_occupation' => 'Engineer',\n ]);\n\n }", "function addnewuser() {\n \t\t\t$this->set('GetUserQ', $this->Users->GetUsers(0));\n \t\t\t$this->set('GetLevelsQ', $this->AccessLevels->index());\n \t\t}", "public function post_add_users() {\n\t}", "public function create(User $user)\n {\n return $user->hasAnyRole(['Teacher']);\n }", "public function testAddUser()\n {\n }", "public function addAction()\n {\n \n $post = new \\Thami\\Bundle\\ExerciseBundle\\Entity\\Posts();\n \n $post->setTitle('title3');\n $post->setBody('bla bla added the body');\n $post->setCreated(new \\DateTime);\n $post->setUpdated(new \\DateTime);\n \n // Pour l'auteur\n // 1. On utilise doctrine;\n $doctrine = $this->getDoctrine();\n\n // 2. On récupére le dêpot des utilisateurs\n $entityRepository = $doctrine->getRepository('ThamiExerciseBundle:Users');\n\n // 3. On récupére l'utilisateur avec l'id 1\n $user = $entityRepository->find(1);\n\n // 4. On renseigne la propriété concernant l'auteur\n $post->setUser($user);\n\n // Enfin, on récupére le gestionnaire d'entités de doctrine\n $entityManager = $doctrine->getManager();\n // Voir : http://www.doctrine-project.org/api/orm/2.5/class-Doctrine.ORM.EntityManager.html\n\n // On ajouter cet article à la liste des entités à créer/modifier\n $entityManager->persist($post);\n\n\n // On \"demande\" à doctrine de repércuter sur la base de données\n $entityManager->flush();\n\n\n //return $this->render('SamisoftExercice1Bundle:Default:add.html.twig');\n \n return $this->render('ThamiExerciseBundle:Default:add.html.twig');\n }", "public function run()\n {\n $user = User::find(1);\n $user->roles()->attach(1);\n\n $user2 = User::find(2);\n $user2->roles()->attach(2);\n }", "public function author(){\n \treturn $this->belongsTo('App\\User', 'user_id');\n }", "public function run()\n {\n $u = User::create([\n 'name' => 'Mary Grace L. Perocho',\n 'email' => '[email protected]',\n 'email_verified_at' => now(),\n 'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi'\n ]);\n $u->roles()->attach(Role::find(3));\n $u->teacher()->create(['college_id' => 2, 'department_id' => random_int(4, 6)]);\n $u = User::create([\n 'name' => 'Cyrus B. Rael',\n 'email' => '[email protected]',\n 'email_verified_at' => now(),\n 'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi'\n ]);\n $u->roles()->attach(Role::find(3));\n $u->teacher()->create(['college_id' => 2, 'department_id' => random_int(4, 6)]);\n $u = User::create([\n 'name' => 'Cecilia E. Gener',\n 'email' => '[email protected]',\n 'email_verified_at' => now(),\n 'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi'\n ]);\n $u->roles()->attach(Role::find(3));\n $u->teacher()->create(['college_id' => 2, 'department_id' => random_int(4, 6)]);\n $u = User::create([\n 'name' => 'Florlyn Remegio',\n 'email' => '[email protected]',\n 'email_verified_at' => now(),\n 'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi'\n ]);\n $u->roles()->attach(Role::find(3));\n $u->teacher()->create(['college_id' => 2, 'department_id' => random_int(4, 6)]);\n $u = User::create([\n 'name' => 'Mark Ian Orcajada',\n 'email' => '[email protected]',\n 'email_verified_at' => now(),\n 'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi'\n ]);\n $u->roles()->attach(Role::find(3));\n $u->teacher()->create(['college_id' => 2, 'department_id' => random_int(4, 6)]);\n }", "public function userCreation()\n {\n return $this->belongsTo('App\\User', 'created_by_id');\n }", "public function author(){\n return $this->belongsTo(User::class);\n }", "public function technician1(){\n return $this->hasOne(User::class,'id','tech1_id');\n }", "function first_user_as_teacher()\n {\n initialize_forge_management_permissions();\n $user = User::all()->first();\n $user->assignRole('teacher');\n }", "public function add()\n {\n if($this->Auth->user('level') != \"Officer\" && $this->Auth->user('level') != \"Admin\")\n $this->redirect(\n array('controller' => 'Users', 'action' => 'profilehub/' . $this->Auth->user('id')));\n \n if($this->request->is('post'))\n {\n $this->Event->create();\n \n if($this->Event->save($this->request->data))\n {\n $this->redirect('announcements');\n }\n }\n \n $this->loadModel('User');\n $users = $this->User->find('all');\n\n $this->set('user', $users);\n \n $this->layout = 'hero-ish';\n $this->Session->write('Page', 'Hub');\n }", "public function students(){\n return $this->belongsToMany('App\\Models\\User');\n }", "public function testCreateUser()\n {\n }", "public function run()\n {\n factory(App\\Models\\v1\\User::class, 'admin')->create()->each(function($user) {\n $user->slug()\n ->save(factory(App\\Models\\v1\\Slug::class)\n ->make(['url' => str_slug($user->name)]));\n $user->assign('admin');\n $user->links()->saveMany([\n factory(App\\Models\\v1\\Link::class)->make(['name' => 'facebook', 'url' => 'https://facebook.com']),\n factory(App\\Models\\v1\\Link::class)->make(['name' => 'twitter', 'url' => 'https://twitter.com']),\n factory(App\\Models\\v1\\Link::class)->make()\n ]);\n $user->stories()->saveMany(factory(App\\Models\\v1\\Story::class, 3)->make(['author_id' => $user->id, 'author_type' => 'users']));\n $user->accolades()->save(factory(App\\Models\\v1\\Accolade::class)->make());\n $user->accolades()->save(factory(App\\Models\\v1\\Accolade::class, 'trip_history')->make());\n $user->essays()->save(factory(App\\Models\\v1\\Essay::class)->make());\n $user->passports()->save(factory(App\\Models\\v1\\Passport::class)->make());\n $user->visas()->save(factory(App\\Models\\v1\\Visa::class)->make());\n $user->referrals()->save(factory(App\\Models\\v1\\Referral::class)->make());\n $user->medicalReleases()->save(factory(App\\Models\\v1\\MedicalRelease::class)->make());\n });\n // factory(App\\Models\\v1\\User::class, config('seeders.users'))->create()->each(function($user) {\n // $user->slug()\n // ->save(factory(App\\Models\\v1\\Slug::class)\n // ->make(['url' => str_slug($user->name)]));\n // $user->stories()->saveMany(factory(App\\Models\\v1\\Story::class, 2)->make(['author_id' => $user->id, 'author_type' => 'users']));\n // $user->accolades()->save(factory(App\\Models\\v1\\Accolade::class)->make());\n // $user->accolades()->save(factory(App\\Models\\v1\\Accolade::class, 'trip_history')->make());\n // $user->essays()->save(factory(App\\Models\\v1\\Essay::class)->make());\n // $user->passports()->save(factory(App\\Models\\v1\\Passport::class)->make());\n // $user->visas()->save(factory(App\\Models\\v1\\Visa::class)->make());\n // $user->referrals()->save(factory(App\\Models\\v1\\Referral::class)->make());\n // $user->medicalReleases()->save(factory(App\\Models\\v1\\MedicalRelease::class)->make());\n // });\n }", "protected function addRelation()\n {\n $fromTable = $this->ask('Enter the name of the parent table');\n $this->checkInput($fromTable);\n $toTable = $this->ask('Enter the name of the child table');\n $this->checkInput($toTable);\n $relationColumn = $this->ask('Enter the column which is going to be referenced (default is \\'id\\')', 'id');\n $action = $this->choice('Action to be taken for column (default is \\'cascade\\')', ['cascade', 'restrict', 'set null'], 'cascade');\n $this->service->addRelation($fromTable, $toTable, $relationColumn, $action);\n }", "public function getAdd()\n {\n \treturn view(\"admin.user.add\");\n }", "public function run()\n {\n //Role Admin Utama\n $adminRole = new Role();\n $adminRole->name=\"admin\";\n $adminRole->display_name=\"Admin\";\n $adminRole->save();\n\n //Role Author Fasilitas\n $fasilitasRole = new Role();\n $fasilitasRole->name=\"fasilitas\";\n $fasilitasRole->display_name=\"Author Fasilitas\";\n $fasilitasRole->save();\n\n //Role Author Artikel\n $artikelRole = new Role();\n $artikelRole->name=\"artikel\";\n $artikelRole->display_name=\"Author Artikel\";\n $artikelRole->save();\n\n //Role Author Ekskul\n $ekskulRole = new Role();\n $ekskulRole->name=\"ekskul\";\n $ekskulRole->display_name=\"Author Ekstrakurikuler\";\n $ekskulRole->save();\n\n //Role Author Kejuruan\n $kejuruanRole = new Role();\n $kejuruanRole->name=\"kejuruan\";\n $kejuruanRole->display_name=\"Author Kejuruan\";\n $kejuruanRole->save();\n\n //Sampel Admin Utama \n $admin = new User();\n $admin->name=\"Admin Assalaam\";\n $admin->email=\"[email protected]\";\n $admin->password=bcrypt('rahasia');\n $admin->save();\n $admin->attachRole($adminRole);\n\n //Sampel Author Kejuruan \n $kejuruan = new User();\n $kejuruan->name=\"Author Kejuruan\";\n $kejuruan->email=\"[email protected]\";\n $kejuruan->password=bcrypt('rahasia');\n $kejuruan->save();\n $kejuruan->attachRole($kejuruanRole);\n\n //Sampel Author Fasilitas \n $fasilitas = new User();\n $fasilitas->name=\"Author Fasilitas\";\n $fasilitas->email=\"[email protected]\";\n $fasilitas->password=bcrypt('rahasia');\n $fasilitas->save();\n $fasilitas->attachRole($fasilitasRole);\n\n //Sampel Author Ekstrakurikuler \n $ekskul = new User();\n $ekskul->name=\"Author Ekstrakurikuler\";\n $ekskul->email=\"[email protected]\";\n $ekskul->password=bcrypt('rahasia');\n $ekskul->save();\n $ekskul->attachRole($ekskulRole);\n\n //Sampel Author Artikel \n $artikel = new User();\n $artikel->name=\"Author Artikel\";\n $artikel->email=\"[email protected]\";\n $artikel->password=bcrypt('rahasia');\n $artikel->save();\n $artikel->attachRole($artikelRole);\n }", "public function author()\n {\n return $this->belongsTo(User::class, 'author_id');\n }", "public function creating(User $user): void\n {\n \n }", "public function run()\n {\n $role_user = new Role();\n $role_user->name = 'user';\n $role_user->display_name = 'User'; // optional\n $role_user->description = 'Usuario para navegar'; // optional\n $role_user->save();\n\n $user = new User();\n $user->name = 'test';\n $user->email ='[email protected]';\n $user->password = Hash::make('abc123');\n $user->save();\n $user->attachRole($role_user);\n\n $role_root = new Role();\n $role_root->name = 'root';\n $role_root->display_name = 'root'; // optional\n $role_root->description = 'Control total del sitio'; // optional\n $role_root->save();\n\n $root = new User();\n $root->name = 'root';\n $root->email ='[email protected]';\n $root->password = Hash::make('rootmi2018');\n $root->save();\n $root->attachRole($role_root);\n\n $role_admin = new Role();\n $role_admin->name = 'admin';\n $role_admin->display_name = 'Admin'; // optional\n $role_admin->description = 'Administrador del portal'; // optional\n $role_admin->save();\n\n $admin = new User();\n $admin->name = 'admin';\n $admin->email ='[email protected]';\n $admin->password = Hash::make('abc123');\n $admin->save();\n $admin->attachRole($role_admin);\n }", "public function noteUser()\n {\n return $this->belongsTo('App\\User',\"user_id\");\n }", "public function students() {\n return $this->belongsToMany('App\\Models\\User');\n }", "public function lessons()\n {\n return $this->belongsToMany(Lesson::class, 'lesson_users', 'user_id', 'lesson_id');\n }", "public function user(){\n return $this->hasMany('App\\User');//un rol puede pertenecer a varios usuarios\n }", "public function creat_new_user()\n {\n \n factory(User::class)->create();\n $respone=$this->post('/admin/category/create',[\n 'name' => 'Tuan',\n 'email' => '[email protected]',\n 'email_verified_at' => now(),\n 'active'=>1,\n 'password' => '2', // password\n 'remember_token' => Str::random(10),\n ]);\n // $this->assertCount(8,User::all());\n }", "public function newUserAction()\n {\n $user = (new UserModel())->createUser();\n echo (new View('userCreated'))\n ->addData('user', $user)\n ->render();\n }", "private function relationshipWasCreated()\n {\n $this->info(\"The relationship \\\"{$this->type}\\\" was created\");\n }", "public function run()\n {\n factory('App\\Relationship', 3)->create();\n }", "public function createUser()\n {\n }", "public function created(User $user)\n {\n //\n }", "public function actionCreate()\n\t{\n\t\t$model=new User;\n\t\t$guide = new Guide;\n\t\t\n\t\t$model->setScenario('common');\n\n\t\t// Uncomment the following line if AJAX validation is needed\n\t\t// $this->performAjaxValidation($model);\n\n\t\tif(isset($_POST['User']))\n\t\t{\n\t\t\t$model->attributes=$_POST['User'];\n\t\t\t$model->created_on = date('Y-m-d H:i:s');\n\t\t\t\n\t\t\tif(isset($_POST['User']['social_identifier']) && trim($_POST['User']['social_identifier']) != '')\n\t\t\t$model->setScenario('social');\n\t\t\telse\n\t\t\t$model->setScenario('normal');\n\t\t\tif($model->validate()){\n\t\t\t \n\t\t\t if($model->save()){\n\t\t\t\t\t if($model->role == '3')\n\t\t\t\t\t $this->redirect(array('guidedetails','id'=>$model->user_id));\n\t\t\t\t\t else if($model->role == '4')\n\t\t\t\t\t $this->redirect(array('iyerdetails','id'=>$model->user_id));\n\t\t\t\t\t else if($model->role == '2'){\n\t\t\t\t\t\t\t $this->redirect(array('regsuccesss','id'=>$model->user_id));\n\t\t\t\t }\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t$this->render('create',array(\n\t\t\t'model'=>$model,\n\t\t\t'guide'=>$guide,\n\t\t));\n\t}", "public function created(User $user)\n {\n //\n }", "public function created(User $user)\n {\n //\n }", "public function created(User $user)\n {\n //\n }", "public function created(User $user)\n {\n //\n }", "public function created(User $user)\n {\n //\n }", "public function run()\n {\n \t$juiciouser = new Juiciouser();\n\t\t$juiciouser->juicio_id = 1;\n\t\t$juiciouser->user_id = 2;\n\t\t$juiciouser->role_id = 2;\n\t\t$juiciouser->save();\n\n\t\t$juiciouser = new Juiciouser();\n\t\t$juiciouser->juicio_id = 1;\n\t\t$juiciouser->user_id = 3;\n\t\t$juiciouser->role_id = 3;\n\t\t$juiciouser->save();\n\n\t\t$juiciouser = new Juiciouser();\n\t\t$juiciouser->juicio_id = 1;\n\t\t$juiciouser->user_id = 4;\n\t\t$juiciouser->role_id = 4;\n\t\t$juiciouser->save();\n\n\t\t$juiciouser = new Juiciouser();\n\t\t$juiciouser->juicio_id = 2;\n\t\t$juiciouser->user_id = 2;\n\t\t$juiciouser->role_id = 2;\n\t\t$juiciouser->save();\n\n\t\t$juiciouser = new Juiciouser();\n\t\t$juiciouser->juicio_id = 2;\n\t\t$juiciouser->user_id = 3;\n\t\t$juiciouser->role_id = 3;\n\t\t$juiciouser->save();\n\n\t\t$juiciouser = new Juiciouser();\n\t\t$juiciouser->juicio_id = 2;\n\t\t$juiciouser->user_id = 4;\n\t\t$juiciouser->role_id = 4;\n\t\t$juiciouser->save();\n\n\t\t$juiciouser = new Juiciouser();\n\t\t$juiciouser->juicio_id = 3;\n\t\t$juiciouser->user_id = 2;\n\t\t$juiciouser->role_id = 2;\n\t\t$juiciouser->save();\n\n\t\t$juiciouser = new Juiciouser();\n\t\t$juiciouser->juicio_id = 3;\n\t\t$juiciouser->user_id = 3;\n\t\t$juiciouser->role_id = 3;\n\t\t$juiciouser->save();\n\n\t\t$juiciouser = new Juiciouser();\n\t\t$juiciouser->juicio_id = 3;\n\t\t$juiciouser->user_id = 4;\n\t\t$juiciouser->role_id = 4;\n\t\t$juiciouser->save();\n\n\t\t$juiciouser = new Juiciouser();\n\t\t$juiciouser->juicio_id = 4;\n\t\t$juiciouser->user_id = 2;\n\t\t$juiciouser->role_id = 2;\n\t\t$juiciouser->save();\n\n\t\t$juiciouser = new Juiciouser();\n\t\t$juiciouser->juicio_id = 4;\n\t\t$juiciouser->user_id = 3;\n\t\t$juiciouser->role_id = 3;\n\t\t$juiciouser->save();\n\n\t\t$juiciouser = new Juiciouser();\n\t\t$juiciouser->juicio_id = 4;\n\t\t$juiciouser->user_id = 4;\n\t\t$juiciouser->role_id = 4;\n\t\t$juiciouser->save();\n\n }", "public function following()\n {\n return $this->belongsTo(User::class);\n }", "private function addTestUser(): void\n {\n $this->terminus(sprintf('site:team:add %s %s', $this->getSiteName(), $this->getUserEmail()));\n }", "function a_user_can_be_created(){\n\n $profession = factory(Profession::class)->create([\n 'title' => 'Web Developer'\n ]);\n $skillA = factory(Skill::class)->create([\n 'description' => 'CSS'\n ]);\n $skillB = factory(Skill::class)->create([\n 'description' => 'HTML'\n ]);\n\n $this->browse(function(Browser $browser) use ($profession,$skillA,$skillB){\n $browser->visit('users/create')\n ->assertSeeIn('h5','Create User')\n ->type('name','Yariel Gordillo')\n ->type('email','[email protected]')\n ->type('password','secret')\n ->type('bio','This a small bio')\n ->select('profession_id',$profession->id)\n ->type('twitter' ,'https://twitter.com/yariko')\n ->check(\"skills[{$skillA->id}]\")\n ->check(\"skills[{$skillB->id}]\")\n ->radio('role', 'user')\n ->press('Create User')\n ->assertPathIs('/users')\n ->assertSee('Yariel Gordillo')\n ->assertSee('[email protected]');\n });\n\n }", "public function testCreateUser()\n {\n $this->visit('/Users/create')\n\t ->type('1', 'role_id')\n\t ->type('Daniel', 'firstname')\n\t ->type('Becerra', 'lastname')\n\t ->type('[email protected]', 'email')\n\t ->type('danielbecerrao', 'user')\n\t ->type('12345678', 'password')\n\t ->type('12345678', 'register')\n\t ->press('Crear')\n\t ->seePageIs('/Users');\n\n }", "public function author () {\n return $this->belongsTo(User::class);\n }", "protected function add_sample_users(){\n // a non-admin user\n factory(User::class,1)->create();\n\n $this->non_admin = User::where('superuser',0)->first();\n $this->admin = User::where('superuser',1)->first();\n }", "public function run()\n {\n $simp = Role::where('slug','simpatizante')->first();\n $user = Role::where('slug', 'user')->first();\n\n $admin = new User();\n $admin->name = 'José António';\n $admin->email = '[email protected]';\n $admin->password = bcrypt('secret');\n $admin->email_verified_at = Carbon::now();\n $admin->save();\n $admin->roles()->attach($simp);\n\n\n $utilizador = new User();\n $utilizador->name = 'João Miguel';\n $utilizador->email = '[email protected]';\n $utilizador->password = bcrypt('secret');\n $utilizador->email_verified_at = Carbon::now();\n $utilizador->save();\n $utilizador->roles()->attach($user);\n }", "public function author()\n {\n return $this->belongsTo(User::class,'user_id');\n }", "public function creator()\n {\n return $this->belongsTo(User::class);\n }", "public function run()\n {\n $role_admin = Role::where('name','admin')->first();\n $role_estudiante = Role::where('name','estudiante')->first();\n $role_profe = Role::where('name','profe')->first();\n\n\n $admin = new User();\n $admin->rut = \"19386\";\n $admin->name = \"admin\";\n $admin->email = \"[email protected]\";\n $admin->password = bcrypt('admin');\n $admin->tipo = \"admin\";\n $admin->save();\n $admin->roles()->attach($role_admin);\n\n $estudiante = new User();\n $estudiante->rut = \"19111\";\n $estudiante->name = \"estudiante1\";\n $estudiante->email = \"[email protected]\";\n $estudiante->password = bcrypt('est1');\n $estudiante->tipo = \"estudiante\";\n $estudiante->save();\n $estudiante->roles()->attach($role_estudiante);\n\n $estudiante = new User();\n $estudiante->rut = \"19222\";\n $estudiante->name = \"estudiante2\";\n $estudiante->email = \"[email protected]\";\n $estudiante->password = bcrypt('est2');\n $estudiante->tipo = \"estudiante\";\n $estudiante->save();\n $estudiante->roles()->attach($role_estudiante);\n\n $profe = new User();\n $profe->rut = \"20111\";\n $profe->name = \"profesor1\";\n $profe->email = \"[email protected]\";\n $profe->password = bcrypt('prof1');\n $profe->tipo = \"profe\";\n $profe->save();\n $profe->roles()->attach($role_profe);\n\n $profe = new User();\n $profe->rut = \"20222\";\n $profe->name = \"profesor2\";\n $profe->email = \"[email protected]\";\n $profe->password = bcrypt('prof2');\n $profe->tipo = \"profe\";\n $profe->save();\n $profe->roles()->attach($role_profe);\n }", "public function student()\n {\n return $this->belongsTo('App\\Models\\User');\n }", "public function run()\n {\n $c = Campus::find(2);\n $u = User::create([\n 'campus_id' => $c->id,\n 'name' => 'Cecilia E. Gener',\n 'email' => '[email protected]',\n 'password' => bcrypt('password'),\n ]);\n\n Dean::create([\n 'user_id' => $u->id,\n 'college_id' => 2\n ]);\n // ProgramHead::create([\n // 'user_id' => $u->id,\n // 'college_id' => 2\n // ]);\n $u->roles()->attach(Role::find(5));\n // $u->roles()->attach(Role::find(4));\n Teacher::create([\n 'user_id' => $u->id,\n 'college_id' => 2\n ]);\n $u->roles()->attach(Role::find(3));\n $u = User::create([\n 'campus_id' => $c->id,\n 'name' => 'Elmer C. Buenavides',\n 'email' => '[email protected]',\n 'password' => bcrypt('password'),\n ]);\n Teacher::create([\n 'user_id' => $u->id,\n 'college_id' => 2\n ]);\n $u->roles()->attach(Role::find(3));\n\n $u = User::create([\n 'campus_id' => $c->id,\n 'name' => 'Mary Grace L. Perocho',\n 'email' => '[email protected]',\n 'password' => bcrypt('password'),\n ]);\n Teacher::create([\n 'user_id' => $u->id,\n 'college_id' => 2\n ]);\n $u->roles()->attach(Role::find(3));\n $u = User::create([\n 'campus_id' => $c->id,\n 'name' => 'Cyrus B. Rael',\n 'email' => '[email protected]',\n 'password' => bcrypt('password'),\n ]);\n Teacher::create([\n 'user_id' => $u->id,\n 'college_id' => 2\n ]);\n $u->roles()->attach(Role::find(3));\n $u = User::create([\n 'campus_id' => $c->id,\n 'name' => 'Roma Amor C. Castromayor',\n 'email' => '[email protected]',\n 'password' => bcrypt('password'),\n ]);\n Teacher::create([\n 'user_id' => $u->id,\n 'college_id' => 2\n ]);\n $u->roles()->attach(Role::find(3));\n $u = User::create([\n 'campus_id' => $c->id,\n 'name' => 'Elbren O. Antonio',\n 'email' => '[email protected]',\n 'password' => bcrypt('password'),\n ]);\n Teacher::create([\n 'user_id' => $u->id,\n 'college_id' => 2\n ]);\n $u->roles()->attach(Role::find(3));\n $u = User::create([\n 'campus_id' => $c->id,\n 'name' => 'Velessa Dulin',\n 'email' => '[email protected]',\n 'password' => bcrypt('password'),\n ]);\n Teacher::create([\n 'user_id' => $u->id,\n 'college_id' => 2\n ]);\n $u->roles()->attach(Role::find(3));\n $u = User::create([\n 'campus_id' => $c->id,\n 'name' => 'Kyrene L. Dizon',\n 'email' => '[email protected]',\n 'password' => bcrypt('password'),\n ]);\n Teacher::create([\n 'user_id' => $u->id,\n 'college_id' => 2\n ]);\n $u->roles()->attach(Role::find(3));\n $u = User::create([\n 'campus_id' => $c->id,\n 'name' => 'Joe H. Selayro',\n 'email' => '[email protected]',\n 'password' => bcrypt('password'),\n ]);\n Teacher::create([\n 'user_id' => $u->id,\n 'college_id' => 2\n ]);\n $u->roles()->attach(Role::find(3));\n $u = User::create([\n 'campus_id' => $c->id,\n 'name' => 'Mark Ian Orcajada',\n 'email' => '[email protected]',\n 'password' => bcrypt('password'),\n ]);\n Teacher::create([\n 'user_id' => $u->id,\n 'college_id' => 2\n ]);\n $u->roles()->attach(Role::find(3));\n $u = User::create([\n 'campus_id' => $c->id,\n 'name' => 'Alexis D. Apresto',\n 'email' => '[email protected]',\n 'password' => bcrypt('password'),\n ]);\n Teacher::create([\n 'user_id' => $u->id,\n 'college_id' => 2\n ]);\n $u->roles()->attach(Role::find(3));\n $u = User::create([\n 'campus_id' => $c->id,\n 'name' => 'Florlyn Remegio',\n 'email' => '[email protected]',\n 'password' => bcrypt('password'),\n ]);\n Teacher::create([\n 'user_id' => $u->id,\n 'college_id' => 2\n ]);\n $u->roles()->attach(Role::find(3));\n $u = User::create([\n 'campus_id' => $c->id,\n 'name' => 'Ivy Lynn Madriaga',\n 'email' => '[email protected]',\n 'password' => bcrypt('password'),\n ]);\n Teacher::create([\n 'user_id' => $u->id,\n 'college_id' => 2\n ]);\n $u->roles()->attach(Role::find(3));\n $u = User::create([\n 'campus_id' => $c->id,\n 'name' => 'Esnehara Bagundang',\n 'email' => '[email protected]',\n 'password' => bcrypt('password'),\n ]);\n Teacher::create([\n 'user_id' => $u->id,\n 'college_id' => 2\n ]);\n $u->roles()->attach(Role::find(3));\n $u = User::create([\n 'campus_id' => $c->id,\n 'name' => 'Kristine Mae Ampas',\n 'email' => '[email protected]',\n 'password' => bcrypt('password'),\n ]);\n Teacher::create([\n 'user_id' => $u->id,\n 'college_id' => 2\n ]);\n $u->roles()->attach(Role::find(3));\n $u = User::create([\n 'campus_id' => $c->id,\n 'name' => 'Edmarlyn Porras',\n 'email' => '[email protected]',\n 'password' => bcrypt('password'),\n ]);\n Teacher::create([\n 'user_id' => $u->id,\n 'college_id' => 2\n ]);\n $u->roles()->attach(Role::find(3));\n $u = User::create([\n 'campus_id' => $c->id,\n 'name' => 'Cerilo Rubin',\n 'email' => '[email protected]',\n 'password' => bcrypt('password'),\n ]);\n Teacher::create([\n 'user_id' => $u->id,\n 'college_id' => 2\n ]);\n $u->roles()->attach(Role::find(3));\n Student::factory()->count(99)->create()->each(function ($s) {\n $s->user->roles()->attach(Role::find(2));\n });\n $students = [];\n // $handle = fopen(storage_path(\"app/emails.csv\"), \"r\");\n // while (($data = fgetcsv($handle)) !== FALSE) {\n // array_push($students, $data);\n // }\n foreach ($students as $key => $student) {\n $u = User::create([\n 'campus_id' => Campus::get()->random()->id,\n 'name' => ucwords($student[0]),\n 'email' => strtolower($student[1]),\n 'email_verified_at' => now(),\n 'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password\n 'remember_token' => Str::random(10),\n ]);\n $u->roles()->attach(Role::find(2));\n $u->student()->create([\n 'college_id' => 2,\n 'department_id' => 5,\n ]);\n }\n }", "public function author()\n\t{\n\n\n\t\treturn $this->belongsTo('App\\User','author_id');\n\n\t}", "public function testAddUser()\n {\n\n }", "function addNew()\n {\n if ($this->isAdmin() == TRUE) {\n $this->loadThis();\n } else {\n $data['roles'] = $this->user_model->getUserRoles();\n\n $this->global['pageTitle'] = '添加人员';\n\n $this->loadViews(\"addNew\", $this->global, $data, NULL);\n }\n }", "public function create()\n {\n $data['id'] = $this->db->order_by('id', 'desc')->get($this->User->table)->row()->id + 1;\n \n $this->Helper->view('user/create', $data);\n }", "public function addTutorial(){\r\n\t\t$languages\t\t\t=\tDB::select(\"CALL GetAcitveLanguages(1)\");\r\n\t\t$language_code\t\t=\tConfig::get('default_language.language_code');\r\n\t\treturn View::make(\"admin.$this->model.add\",compact('languages' ,'language_code'));\r\n\t}", "public function actionCreate() {\n $test = $this->tests->add($this->user->id);\n $values['test_id'] = $test->id;\n $this->questions->add($values);\n $this->redirect('Test:edit', $test->id);\n }", "public function test_rel(){\n\t\t//$data1 = array('name'=>'jack','age'=>24);\n\t\t//$a->data($data1)->save();\n\n\t\t//$a = new article();\n\t\t//$a->data(array('title'=>'art1','content'=>'test'))->save();\n\t\t//$a = new user_article_author();\n\t\t//$a->data(array('user_id'=>1,'article_id'=>1,'status'=>'open'))->save();\n\t\t$a = new user_article_author();\n\t\t$b = $a->rel();\n\t\tdump ($b->where('user.user_id = 1')->select());\n\t\tdump($b->sql);\n\t}", "public function run()\n {\n \t\n \t$role_user = Role::where('name','User')->first();\n \t$role_admin = Role::where('name','Admin')->first();\n \t$role_author = Role::where('name','Author')->first();\n \t//1\n \t$user = new User();\n \t$user->name \t\t= \"Andres Romero\";\n \t$user->email \t\t\t= \"[email protected]\";\n \t$user->password \t\t= \"secret\";\n \t$user->address \t\t\t= \"Region 99 Mza 9 Lte 9 Entre calle 8 y 6 sobre la 133\";\n \t$user->image \t\t\t= \"user1.png\";\n \t$user->cp \t\t\t\t= \"77536\";\n \t$user->cel \t\t\t\t= \"529988417622\";\n \t$user->addressdetails \t= \"Casa blanca con patio de puras flores\";\n \t$user->type \t\t\t= \"User\";\n \t$user->save();\n \t$user->roles()->attach($role_user);\n\n //2\n \t$admin = new User();\n \t$admin->name \t\t= \"Jose Ramirez\";\n \t$admin->email \t\t\t= \"[email protected]\";\n \t$admin->password \t\t= \"secret\";\n \t$admin->address \t\t= \"Region 95 Mza 9 Lte 9 Entre calle 5 y 6 sobre la 135\";\n \t$admin->image \t\t\t= \"user1.png\";\n \t$admin->cp \t\t\t\t= \"77537\";\n \t$admin->cel \t\t\t= \"529988417623\";\n \t$admin->addressdetails \t= \"Casa con rejas negras\";\n \t$admin->type \t\t\t= \"Admin\";\n \t$admin->save();\n \t$admin->roles()->attach($role_admin);\n\n \t/**\n \t * EMPLEADOS \n \t * @var User\n \t */\n //3\n \t$author1 = new User();\n \t$author1->name \t\t= \"Katherine Felix\";\n \t$author1->email \t\t\t= \"[email protected]\";\n \t$author1->password \t\t= \"secret\";\n \t$author1->address \t\t\t= \"Privadas Turquesa\";\n \t$author1->image \t\t\t= \"user2.jpg\";\n \t$author1->cp \t\t\t\t= \"77537\";\n \t$author1->cel \t\t\t\t= \"529988417626\";\n \t$author1->addressdetails \t= \"Casa rosa\";\n \t$author1->type \t\t\t\t= \"Author\";\n \t$author1->save();\n \t$author1->roles()->attach($role_author);\n\n //4\n \t$author2 = new User();\n \t$author2->name \t\t= \"Angel Baez\";\n \t$author2->email \t\t\t= \"[email protected]\";\n \t$author2->password \t\t= \"secret\";\n \t$author2->address \t\t\t= \"Playa del Carmen casa en la playa\";\n \t$author2->image \t\t\t= \"user3.jpg\";\n \t$author2->cp \t\t\t\t= \"77537\";\n \t$author2->cel \t\t\t\t= \"529988417626\";\n \t$author2->addressdetails \t= \"Junto a la playa\";\n \t$author2->type \t\t\t\t= \"Author\";\n \t$author2->save();\n \t$author2->roles()->attach($role_author);\n\n //5\n \t$author3 = new User();\n \t$author3->name \t\t= \"Daniel Lozano\";\n \t$author3->email \t\t\t= \"[email protected]\";\t\n \t$author3->password \t\t= \"secret\";\n \t$author3->address \t\t\t= \"Playa del Carmen casa en la playa\";\n \t$author3->image \t\t\t= \"user4.jpg\";\n \t$author3->cp \t\t\t\t= \"77537\";\n \t$author3->cel \t\t\t\t= \"529988417626\";\n \t$author3->addressdetails \t= \"Junto a la playa\";\n \t$author3->type \t\t\t\t= \"Author\";\n \t$author3->save();\n \t$author3->roles()->attach($role_author);\n\n\n\n }", "function _add_user()\n {\n if (!$this->has_arg('PROJECTID'))\n $this->_error('No project id specified');\n if (!$this->has_arg('PERSONID'))\n $this->_error('No user specified');\n\n $proj = $this->db->pq(\"SELECT p.projectid FROM project p WHERE p.personid LIKE :1 AND p.projectid=:2\", array($this->user->personId, $this->arg('PROJECTID')));\n\n if (!sizeof($proj))\n $this->_error('No such project');\n $proj = $proj[0];\n\n $person = $this->db->pq(\"SELECT CONCAT(CONCAT(givenname, ' '), familyname) as fullname FROM person WHERE personid=:1\", array($this->arg('PERSONID')));\n if (!sizeof($person))\n $this->_error('No such person');\n $person = $person[0];\n\n $this->db->pq(\"INSERT INTO project_has_person (projectid, personid) VALUES (:1, :2)\", array($this->arg('PROJECTID'), $this->arg('PERSONID')));\n\n $this->_output(array('FULLNAME' => $person['FULLNAME']));\n }" ]
[ "0.601793", "0.5963386", "0.59406364", "0.5921073", "0.5892967", "0.5847614", "0.5828972", "0.57468295", "0.57149374", "0.57142615", "0.57027155", "0.56918955", "0.56679946", "0.5666162", "0.5621427", "0.56005454", "0.5598707", "0.55926085", "0.55687124", "0.55633694", "0.556248", "0.5553838", "0.5552143", "0.5551446", "0.5548408", "0.5547144", "0.55468875", "0.55375594", "0.5511065", "0.5506081", "0.5499514", "0.54924643", "0.54850477", "0.54836065", "0.54647964", "0.54602724", "0.54567176", "0.54466367", "0.542788", "0.54258776", "0.54209244", "0.5411891", "0.540583", "0.5402447", "0.5401816", "0.53994834", "0.5396349", "0.5392955", "0.53928703", "0.5392477", "0.53817564", "0.53815526", "0.53735685", "0.5371671", "0.5367239", "0.5364937", "0.5363111", "0.5361533", "0.53601676", "0.53529644", "0.5352512", "0.53398716", "0.53383976", "0.5338082", "0.5334048", "0.53268695", "0.5321422", "0.5315233", "0.53064543", "0.5305046", "0.5301231", "0.5294957", "0.5292094", "0.5291498", "0.52913547", "0.52913547", "0.52913547", "0.52913547", "0.52913547", "0.5286559", "0.5285588", "0.52832246", "0.52791876", "0.52769816", "0.5276137", "0.5275874", "0.5273607", "0.5267343", "0.52658683", "0.5265029", "0.5264156", "0.5262981", "0.5257313", "0.52566135", "0.52556396", "0.52508414", "0.52421933", "0.5241716", "0.5238041", "0.5236099", "0.5232748" ]
0.0
-1
Register Custom Post Type
function chris_custom_post_type() { $labels = array( 'name' => _x( 'Trainings', 'Post Type General Name', 'chris' ), 'singular_name' => _x( 'Training', 'Post Type Singular Name', 'chris' ), 'menu_name' => __( 'Library', 'chris' ), 'parent_item_colon' => __( 'Parent Library:', 'chris' ), 'all_items' => __( 'All Training', 'chris' ), 'view_item' => __( 'View Training', 'chris' ), 'add_new_item' => __( 'Add New Training', 'chris' ), 'add_new' => __( 'Add Training', 'chris' ), 'edit_item' => __( 'Edit Training', 'chris' ), 'update_item' => __( 'Update Training', 'chris' ), 'search_items' => __( 'Search Training', 'chris' ), 'not_found' => __( 'Not found', 'chris' ), 'not_found_in_trash' => __( 'Not found in Trash', 'chris' ), ); $args = array( 'label' => __( 'training', 'chris' ), 'description' => __( 'trainings', 'chris' ), 'labels' => $labels, 'supports' => array( 'title', 'editor'), 'taxonomies' => array( 'training_category','training_tags'), 'hierarchical' => false, 'public' => true, 'show_ui' => true, 'show_in_menu' => true, 'show_in_nav_menus' => true, 'show_in_admin_bar' => true, 'menu_position' => 5, // 'rewrite' => array('slug' => 'training'), 'can_export' => true, 'has_archive' => false, 'exclude_from_search' => false, 'publicly_queryable' => true, 'capability_type' => 'page', ); register_post_type( 'training', $args ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function register_post_type() {\n\t\tadd_action( 'init', array( $this, 'post_registration_callback' ), 0, 0 );\n\t}", "public function registerCustomPostType()\n {\n if (!post_type_exists($this->slug)) {\n register_post_type($this->slug, $this->arguments);\n }\n }", "public function registerCustomPostTypes() {\n\n\n }", "public function flo_reg_custom_post_type(){\n\t\t// call the methods that are registering the post types\n\t\t$this->flo_reg_forms_post_type();\n\t\t$this->flo_reg_entrie_post_type();\n\n\t\t$this->flo_register_form_entries_taxonomy();\n\t}", "public function register_custom_post() {\n foreach ( $this->posts as $key => $value ) {\n register_post_type( $key, $value );\n }\n }", "function wpbm_register_post_type(){\n include('inc/admin/register/wpbm-register-post.php');\n register_post_type( 'WP Blog Manager', $args );\n }", "public function register()\n {\n $args = apply_filters( $this->name.'_post_type_config', $this->config );\n $args['labels'] = apply_filters( $this->name.'_post_type_labels', $this->labels);\n\n register_post_type( $this->name, $args );\n }", "function register_post_types(){\n }", "function register_post_types(){\n }", "public function register_post(): void\n {\n $args = $this->register_post_type_args();\n register_post_type($this->post_type, $args);\n }", "public static function register_post_types() {}", "function register_post_types(){\n\t\t\trequire('lib/custom-types.php');\n\t\t}", "public function register_post_types() {\n\n\t}", "public function register_qmgt_custom_post() {\r\n\t\trequire_once( QMGT_ROOT . '/qmgt-custom-post-type.php');\r\n\t}", "function bf_register_custom_post_type() {\r\n /* Añado las etiquetas que aparecerán en el escritorio de WordPress */\r\n\t$labels = array(\r\n\t\t'name' => _x( 'Ponentes', 'post type general name', 'text-domain' ),\r\n\t\t'singular_name' => _x( 'Ponente', 'post type singular name', 'text-domain' ),\r\n\t\t'menu_name' => _x( 'Ponentes', 'admin menu', 'text-domain' ),\r\n\t\t'add_new' => _x( 'Añadir nuevo', 'ponente', 'text-domain' ),\r\n\t\t'add_new_item' => __( 'Añadir nuevo ponente', 'text-domain' ),\r\n\t\t'new_item' => __( 'Nuevo Ponente', 'text-domain' ),\r\n\t\t'edit_item' => __( 'Editar Ponente', 'text-domain' ),\r\n\t\t'view_item' => __( 'Ver ponente', 'text-domain' ),\r\n\t\t'all_items' => __( 'Todos los ponentes', 'text-domain' ),\r\n\t\t'search_items' => __( 'Buscar ponentes', 'text-domain' ),\r\n\t\t'not_found' => __( 'No hay ponentes.', 'text-domain' ),\r\n\t\t'not_found_in_trash' => __( 'No hay ponentes en la papelera.', 'text-domain' )\r\n\t);\r\n\r\n /* Configuro el comportamiento y funcionalidades del nuevo custom post type */\r\n\t$args = array(\r\n\t\t'labels' => $labels,\r\n\t\t'description' => __( 'Descripción.', 'text-domain' ),\r\n\t\t'public' => true,\r\n\t\t'publicly_queryable' => true,\r\n\t\t'show_ui' => true,\r\n\t\t'show_in_menu' => true,\r\n\t\t'show_in_nav_menus' => true,\r\n\t\t'query_var' => true,\r\n\t\t'rewrite' => array( 'slug' => 'ponente' ),\r\n\t\t'capability_type' => 'post',\r\n\t\t'hierarchical' => false,\r\n\t\t'menu_position' => null,\r\n 'menu_icon' => 'dashicons-businessman',\r\n\t\t'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments' ),\r\n\t\t'show_in_rest'\t \t => true,\r\n\t\t'public' \t\t\t => true,\r\n\t\t'has_archive' \t\t => true,\r\n\t\t'taxonomies' => array('category','categoria-conferencias')\r\n\t);\r\n\r\n\tregister_post_type('ponentes', $args );\r\n}", "public function register_post_type() {\n\t $args = array(\n\t\t\t'public' => true,\n\t\t\t'label' => 'Questions'\n\t\t);\n\t register_post_type( 'questions', $args );\n\t}", "function register_post_types()\n {\n }", "function register_post_types(){\n\t\trequire('lib/custom-types.php');\n\t}", "public function register_post_type()\n {\n $labels = [\n 'name' => _x('Chiro Quizzes', 'post type general name', $this->token),\n 'singular_name' => _x('Chiro Quiz', 'post type singular name', $this->token),\n 'add_new' => _x('Add New', $this->token, $this->token),\n 'add_new_item' => sprintf(__('Add New %s', $this->token), __('Chiro Quiz', $this->token)),\n 'edit_item' => sprintf(__('Edit %s', $this->token), __('Chiro Quiz', $this->token)),\n 'new_item' => sprintf(__('New %s', $this->token), __('Chiro Quiz', $this->token)),\n 'all_items' => sprintf(__('All %s', $this->token), __('Chiro Quizzes', $this->token)),\n 'view_item' => sprintf(__('View %s', $this->token), __('Chiro Quiz', $this->token)),\n 'search_items' => sprintf(__('Search %a', $this->token), __('Chiro Quizzes', $this->token)),\n 'not_found' => sprintf(__('No %s Found', $this->token), __('Chiro Quizzes', $this->token)),\n 'not_found_in_trash' => sprintf(__('No %s Found In Trash', $this->token), __('Chiro Quizzes', $this->token)),\n 'parent_item_colon' => '',\n 'menu_name' => __('Chiro Quizzes', $this->token)\n ];\n\n $slug = __('chiro-quiz', 'pf_chiro_quiz');\n $custom_slug = get_option('pf_chiro_quiz_slug');\n if ($custom_slug && strlen($custom_slug) > 0 && $custom_slug != '') {\n $slug = $custom_slug;\n }\n\n $args = [\n 'labels' => $labels,\n 'public' => true,\n 'publicly_queryable' => true,\n 'exclude_from_search' => true,\n 'show_ui' => true,\n 'show_in_menu' => true,\n 'query_var' => true,\n 'rewrite' => ['slug' => $slug],\n 'capability_type' => 'post',\n 'has_archive' => false,\n 'hierarchical' => false,\n 'supports' => ['title'],\n 'menu_position' => 5,\n 'menu_icon' => 'dashicons-admin-quiz'\n ];\n\n register_post_type($this->token, $args);\n }", "public function register_custom_post_type() {\n $labels = array (\n 'name' => __('Custom', self::$plugin_obj->class_name ),\n 'singular_name' => __('item', self::$plugin_obj->class_name ),\n 'add_new' => __('new item', self::$plugin_obj->class_name ),\n 'add_new_item' => __('new item', self::$plugin_obj->class_name ),\n 'new_item' => __('new item', self::$plugin_obj->class_name ),\n 'edit' => __('edit item', self::$plugin_obj->class_name ),\n 'edit_item' => __('edit item', self::$plugin_obj->class_name ),\n 'view' => __('view item', self::$plugin_obj->class_name ),\n 'view_item' => __('view item', self::$plugin_obj->class_name ),\n 'search_items' => __('search item', self::$plugin_obj->class_name ),\n 'not_found' => __('no item found', self::$plugin_obj->class_name ),\n 'not_found_in_trash' => __('no item in trash', self::$plugin_obj->class_name ),\n 'parent' => __('parent item', self::$plugin_obj->class_name )\n );\n\n $args = array(\n 'labels' => $labels,\n 'public' => TRUE,\n 'publicly_queryable' => TRUE,\n 'show_ui' => TRUE,\n 'show_in_menu' => TRUE,\n 'query_var' => TRUE,\n 'capability_type' => 'page',\n 'has_archive' => TRUE,\n 'hierarchical' => TRUE,\n 'exclude_from_search' => FALSE,\n 'menu_position' => 100 ,\n 'supports' => array('title','editor','excerpt','custom-fields','revisions','thumbnail','page-attributes'),\n 'taxonomies' => array('category','post_tag')\n );\n\n register_post_type('custom', $args);\n }", "public function register_post_type(){\r\n //Capitilize the words and make it plural\r\n $name = ucwords( str_replace( '_', ' ', $this->post_type_name ) );\r\n $plural = $name . 's';\r\n $menupos = $this->post_type_pos;\r\n\r\n // We set the default labels based on the post type name and plural. We overwrite them with the given labels.\r\n $labels = array_merge(\r\n\r\n // Default\r\n array(\r\n 'name' => _x( $plural, 'post type general name' ),\r\n 'singular_name' => _x( $name, 'post type singular name' ),\r\n 'add_new' => _x( 'Add New', strtolower( $name ) ),\r\n 'add_new_item' => __( 'Add New ' . $name ),\r\n 'edit_item' => __( 'Edit ' . $name ),\r\n 'new_item' => __( 'New ' . $name ),\r\n 'all_items' => __( 'All ' . $plural ),\r\n 'view_item' => __( 'View ' . $name ),\r\n 'search_items' => __( 'Search ' . $plural ),\r\n 'not_found' => __( 'No ' . strtolower( $plural ) . ' found'),\r\n 'not_found_in_trash' => __( 'No ' . strtolower( $plural ) . ' found in Trash'),\r\n 'parent_item_colon' => '',\r\n 'menu_name' => $plural\r\n ),\r\n\r\n // Given labels\r\n $this->post_type_labels\r\n\r\n );\r\n\r\n // Same principle as the labels. We set some defaults and overwrite them with the given arguments.\r\n $args = array_merge(\r\n\r\n // Default\r\n array(\r\n 'capability_type' => 'post',\r\n 'hierarchical' => false,\r\n 'label' => $plural,\r\n 'labels' => $labels,\r\n 'menu_position' => $menupos,\r\n 'public' => true,\r\n 'publicly_queryable' => true,\r\n 'query_var' => true,\r\n 'rewrite' => array('slug' => $plural),\r\n 'show_in_nav_menus' => true,\r\n 'show_ui' => true,\r\n 'supports' => array( 'title', 'editor'),\r\n '_builtin' => false,\r\n ),\r\n\r\n // Given args\r\n $this->post_type_args\r\n\r\n );\r\n\r\n // Register the post type\r\n register_post_type( $this->post_type_name, $args );\r\n }", "function thirdtheme_custom_post_type()\n {\n $args = array(\n 'labels' => array('name' =>__(' my custom post'),\n 'singular name' =>__('my custom post')),\n 'public' => true,\n 'show_in_menu' => true,\n 'has_archive' => true,\n 'supports' => array( 'title', 'editor', 'author', 'thumbnail'));\n register_post_type('custompost',$args);\n \n }", "function carbon_register_post_types(){\n\n // carbon_register_post_type(array(\n // 'singular' => 'Type', // required\n // 'plural' => 'Types', // required\n // 'type' => 'type', // required\n // 'slug' => 'types/type',\n // 'menu_icon' => 'dashicons-admin-post',\n // 'has_archive' => true,\n // 'exclude_from_search' => true,\n // ));\n }", "function tower_custom_post_types() {\n foreach (TOWER_CUSTOM_POSTS as $key => $custom_type) {\n register_post_type($key, $custom_type['config']);\n }\n}", "function register_post_types() {\n\t}", "function register_post_types() {\n\t}", "public function register_post_type(){\n\t\tif(!class_exists('CPT')) return;\n\t\n\t\t$this->post_type = new CPT(\n\t\t\tarray(\n\t\t\t 'post_type_name' => 'slide',\n\t\t\t 'singular' => 'Slide',\n\t\t\t 'plural' => 'Slides',\n\t\t\t 'slug' => 'slide'\n\t\t\t),\n\t\t\tarray(\n\t\t\t\t'has_archive' \t\t\t=> \ttrue,\n\t\t\t\t'menu_position' \t\t=> \t8,\n\t\t\t\t'menu_icon' \t\t\t=> \t'dashicons-layout',\n\t\t\t\t'supports' \t\t\t\t=> \tarray('title', 'excerpt', 'content','thumbnail', 'post-formats', 'custom-fields')\n\t\t\t)\n\t\t);\n\t\t\n\t\t$labels = array('menu_name'=>'Types');\n\t\t$this->post_type->register_taxonomy('type',array(\n\t\t\t'hierarchical' => true,\n\t\t\t'public' => true,\n\t\t\t'show_ui' => true,\n\t\t\t'show_admin_column' => true,\n\t\t\t'show_in_nav_menus' => true,\n\t\t\t'show_tagcloud' => true,\n\t\t),$labels);\n\t}", "public function add_custom_post_types() {\n //\n }", "public static function register_post_type()\n {\n\n \t register_post_type( 'books',\n\t\t array(\n\t\t 'labels' => array(\n\t\t 'name' => __( 'Books' ),\n\t\t 'singular_name' => __( 'Books' )\n\t\t ),\n\t\t 'public' => true,\n\t\t 'has_archive' => false,\n\t\t )\n\t\t );\n\n }", "protected function register_post_type() {\n\t\t$labels = array(\n\t\t\t'name' => __( 'geopin', 'geopin-post-type' ),\n\t\t\t'singular_name' => __( 'geopin Member', 'geopin-post-type' ),\n\t\t\t'add_new' => __( 'Add geopin', 'geopin-post-type' ),\n\t\t\t'add_new_item' => __( 'Add geopin', 'geopin-post-type' ),\n\t\t\t'edit_item' => __( 'Edit geopin', 'geopin-post-type' ),\n\t\t\t'new_item' => __( 'New geopin', 'geopin-post-type' ),\n\t\t\t'view_item' => __( 'View geopin', 'geopin-post-type' ),\n\t\t\t'search_items' => __( 'Search geopin', 'geopin-post-type' ),\n\t\t\t'not_found' => __( 'No geopins found', 'geopin-post-type' ),\n\t\t\t'not_found_in_trash' => __( 'No geopins in the trash', 'geopin-post-type' ),\n\t\t);\n\n\t\t$supports = array(\n\t\t\t'title',\n\t\t\t// 'editor',\n\t\t\t'thumbnail',\n\t\t\t// 'custom-fields',\n\t\t\t// 'revisions',\n\t\t);\n\n\t\t$args = array(\n\t\t\t'labels' => $labels,\n\t\t\t'supports' => $supports,\n\t\t\t'public' => true,\n\t\t\t'capability_type' => 'post',\n\t\t\t'rewrite' => array( 'slug' => 'geopin', ), \n\t\t\t'menu_position' => 5,\n\t\t\t'menu_icon' => 'dashicons-admin-site',\n\t\t);\n\n\t\t$args = apply_filters( 'geoPin_post_type_args', $args );\n\n\t\tregister_post_type( $this->post_type, $args );\n\t}", "private function register_post_type() {\n\t\t\t// register the post type\n\t\t\t$args = array('label' => __('Options Pages', $this->text_domain),\n\t\t\t\t\t\t\t\t\t\t'description' => '',\n\t\t\t\t\t\t\t\t\t\t'public' => false,\n\t\t\t\t\t\t\t\t\t\t'show_ui' => true,\n\t\t\t\t\t\t\t\t\t\t'show_in_menu' => true,\n\t\t\t\t\t\t\t\t\t\t'capability_type' => 'post',\n\t\t\t\t\t\t\t\t\t\t'map_meta_cap' => true,\n\t\t\t\t\t\t\t\t\t\t'hierarchical' => false,\n\t\t\t\t\t\t\t\t\t\t'rewrite' => array('slug' => $this->post_type, 'with_front' => false),\n\t\t\t\t\t\t\t\t\t\t'query_var' => true,\n\t\t\t\t\t\t\t\t\t\t'exclude_from_search' => true,\n\t\t\t\t\t\t\t\t\t\t'menu_position' => 100,\n\t\t\t\t\t\t\t\t\t\t'menu_icon' => 'dashicons-admin-generic',\n\t\t\t\t\t\t\t\t\t\t'supports' => array('title','custom-fields','revisions'),\n\t\t\t\t\t\t\t\t\t\t'labels' => array('name' => __('Options Pages', $this->text_domain),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'singular_name' => __('Options Page', $this->text_domain),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'menu_name' =>\t__('Options Pages', $this->text_domain),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'add_new' => __('Add Options Page', $this->text_domain),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'add_new_item' => __('Add New Options Page', $this->text_domain),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'edit' => __('Edit', $this->text_domain),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'edit_item' => __('Edit Options Page', $this->text_domain),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'new_item' => __('New Options Page', $this->text_domain),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'view' => __('View Options Page', $this->text_domain),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'view_item' => __('View Options Page', $this->text_domain),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'search_items' => __('Search Options Pages', $this->text_domain),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'not_found' => __('No Options Pages Found', $this->text_domain),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'not_found_in_trash' => __('No Options Pages Found in Trash', $this->text_domain),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'parent' => __('Parent Options Page', $this->text_domain)));\n\t\t\tregister_post_type($this->post_type, $args);\n\t\t}", "public function create_post_types() {\n }", "function registerPostTypes()\n{\n register_post_type('destination', [\n 'public' => true,\n 'label' => 'Destinations',\n 'supports' => ['title', 'editor', 'thumbnail']\n ]);\n register_post_type('review', [\n 'public' => true,\n 'label' => 'Reviews',\n 'supports' => ['title', 'editor']\n ]);\n}", "public static function register_post_type() {\n\t\t$labels = array(\n\t\t\t'name' => _x( 'Collections', 'post type general name', 'wp-recipe-maker-premium' ),\n\t\t\t'singular_name' => _x( 'Collection', 'post type singular name', 'wp-recipe-maker-premium' ),\n\t\t);\n\n\t\t$args = apply_filters( 'wprm_recipe_collections_post_type_arguments', array(\n\t\t\t'labels' \t=> $labels,\n\t\t\t'public' \t=> false,\n\t\t\t'rewrite' \t=> false,\n\t\t\t'capability_type' \t=> 'post',\n\t\t\t'query_var' \t=> false,\n\t\t\t'has_archive' \t=> false,\n\t\t\t'supports' \t\t\t\t=> array( 'title', 'author' ),\n\t\t\t'show_in_rest'\t\t\t=> true,\n\t\t\t'rest_base'\t\t\t\t=> WPRMPRC_POST_TYPE,\n\t\t\t'rest_controller_class' => 'WP_REST_Posts_Controller',\n\t\t));\n\n\t\tregister_post_type( WPRMPRC_POST_TYPE, $args );\n\t}", "static function register_post_type ()\n {\n register_post_type(\n 'person',\n array(\n 'labels' => array(\n 'name' => __x( 'People', 'post type general name' ),\n 'singular_name' => __x( 'Person', 'post type singular name' ),\n 'menu_name' => __x( 'People', 'admin menu' ),\n 'name_admin_bar' => __x( 'Person', 'add new on admin bar' ),\n 'add_new' => __x( 'Add New', 'book' ),\n 'add_new_item' => ___( 'Add New Person' ),\n 'new_item' => ___( 'New Person' ),\n 'edit_item' => ___( 'Edit Person' ),\n 'view_item' => ___( 'View Person' ),\n 'all_items' => ___( 'All People' ),\n 'search_items' => ___( 'Search People' ),\n 'parent_item_colon' => ___( 'Parent People:' ),\n 'not_found' => ___( 'No persons found.' ),\n 'not_found_in_trash' => ___( 'No persons found in Trash.' )\n ),\n 'description' => ___( 'Noteworthy people' ),\n 'public' => true,\n 'publicly_queryable' => true,\n 'show_ui' => true,\n 'show_in_menu' => true,\n 'query_var' => true,\n 'rewrite' => array( 'slug' => 'people' ),\n 'capability_type' => 'post',\n 'has_archive' => true,\n 'hierarchical' => false,\n 'menu_position' => null,\n 'menu_icon' => 'dashicons-welcome-learn-more',\n 'supports' => array( 'title', 'editor', 'thumbnail' )\n ));\n }", "public function create_post_type() {\n\t\t\n \t\tregister_post_type(self::POST_TYPE,\n \t\t\tarray(\n \t\t\t\t'labels' => array(\n \t\t\t\t\t'name' => \"Custom\",\n \t\t\t\t\t'singular_name' => __(ucwords(str_replace(\"_\", \" \", self::POST_TYPE)))\n \t\t\t\t),\n \t\t\t\t'public' => true,\n \t\t\t\t'has_archive' => true,\n \t\t\t\t'description' => __(\"This is WP Custom Post Type\"),\n \t\t\t\t'supports' => array('title', 'editor', 'excerpt','thumbnail','custom-fields'),\n \t\t\t)\n \t\t);\n\n\t\t\tregister_taxonomy(\n\t\t\t\t'custom-category',\n\t\t\t\tself::POST_TYPE,\n\t\t\t\tarray(\n\t\t\t\t\t'label' => __( 'Category' ),\n\t\t\t\t\t'rewrite' => array( 'slug' => 'custom-category' ),\n\t\t\t\t\t'hierarchical' => true,\n\t\t\t\t)\n\t\t\t);\n\t\t}", "function compendium_register_type($slug, $name, $pname, $dicon) {\n $pt_slug = $slug;\n $tax_slug = $slug . '-category';\n\n register_post_type($pt_slug, array(\n 'labels' => array(\n 'name' => $pname,\n 'singular_name' => $name,\n 'add_new' => 'Add New',\n 'add_new_item' => 'Add New '.$name,\n 'edit_item' => 'Edit '.$name,\n 'new_item' => 'New '.$name,\n 'view_item' => 'View '.$name,\n 'search_items' => 'Search '.$pname,\n 'not_found' => 'No '.$pname.' found',\n 'not_found_in_trash' => 'No '.$pname.' found in trash',\n ),\n 'public' => true,\n 'menu_position' => 35,\n 'supports' => array('title','editor','thumbnail','excerpt'),\n 'menu_icon' => $dicon,\n 'rewrite' => array(\n 'slug' => 'resource-center/' . $pt_slug,\n 'with_front' => true\n ),\n ));\n\n register_taxonomy($tax_slug, $pt_slug, array(\n 'labels' => array(\n 'name' => 'Categories',\n 'singular_name' => 'Category',\n ),\n 'hierarchical' => true,\n ));\n}", "public static function register_post_type() {\n\t\tregister_post_type( 'drsa_ad', self::arguments() );\n\t}", "function register_post_type(){\n \n $capability = acf_get_setting('capability');\n \n if(!acf_get_setting('show_admin'))\n $capability = false;\n \n register_post_type($this->post_type, array(\n 'label' => 'Options Page',\n 'description' => 'Options Page',\n 'labels' => array(\n 'name' => 'Options Pages',\n 'singular_name' => 'Options Page',\n 'menu_name' => 'Options Pages',\n 'edit_item' => 'Edit Options Page',\n 'add_new_item' => 'New Options Page',\n ),\n 'supports' => array('title'),\n 'hierarchical' => true,\n 'public' => false,\n 'show_ui' => true,\n 'show_in_menu' => 'edit.php?post_type=acf-field-group',\n 'menu_icon' => 'dashicons-layout',\n 'show_in_admin_bar' => false,\n 'show_in_nav_menus' => false,\n 'can_export' => false,\n 'has_archive' => false,\n 'rewrite' => false,\n 'exclude_from_search' => true,\n 'publicly_queryable' => false,\n 'capabilities' => array(\n 'publish_posts' => $capability,\n 'edit_posts' => $capability,\n 'edit_others_posts' => $capability,\n 'delete_posts' => $capability,\n 'delete_others_posts' => $capability,\n 'read_private_posts' => $capability,\n 'edit_post' => $capability,\n 'delete_post' => $capability,\n 'read_post' => $capability,\n ),\n 'acfe_admin_orderby' => 'title',\n 'acfe_admin_order' => 'ASC',\n 'acfe_admin_ppp' => 999,\n ));\n \n }", "static function register_post_type() {\n\n $args = array(\n 'labels' => array(\n\t\t'name' => __( 'Forms', 'pwp' ),\n\t\t'singular_name' => __( 'Form', 'pwp' ),\n\t\t'add_new' => __( 'Add New', 'pwp' ),\n\t\t'add_new_item' => __( 'Add New Form', 'pwp' ),\n\t\t'edit_item' => __( 'Edit Form', 'pwp' ),\n\t\t'new_item' => __( 'New Form', 'pwp' ),\n\t\t'all_items' => __( 'All Forms', 'pwp' ),\n\t\t'view_item' => __( 'View Form', 'pwp' ),\n\t\t'search_items' => __( 'Search Forms', 'pwp' ),\n\t\t'not_found' => __( 'No forms found', 'pwp' ),\n\t\t'not_found_in_trash' => __( 'No forms found in Trash', 'pwp' ),\n\t\t'parent_item_colon' => __( ':', 'pwp' ),\n\t\t'menu_name' => __( 'Forms', 'pwp' )\n\t ),\n 'public' => false,\n 'show_ui' => true,\n 'query_var' => false,\n 'supports' => array( 'title', 'custom-fields', 'editor' )\n );\n\tregister_post_type( 'form', $args );\n }", "function theme_custom_post_type() {\n\tregister_post_type( 'custom_type',\n\n\t\t// Array with all the options for the custom post type\n\t\tarray( 'labels' => array(\n\t\t\t'name'\t\t\t\t\t=> __( 'Custom Types' ), // Name of the custom post type group\n\t\t\t'singular_name'\t\t\t=> __( 'Custom Post' ), // Name of the custom post type singular\n\t\t\t'all_items'\t\t\t\t=> __( 'All Custom Posts' ),\n\t\t\t'add_new' \t\t\t\t=> __( 'Add New' ),\n\t\t\t'add_new_item' \t\t\t=> __( 'Add New Custom Type' ),\n\t\t\t'edit'\t\t\t\t\t=> __( 'Edit' ),\n\t\t\t'edit_item'\t\t\t\t=> __( 'Edit Post Types' ),\n\t\t\t'new_item'\t\t\t\t=> __( 'New Post Type' ),\n\t\t\t'view_item'\t\t\t\t=> __( 'View Post Type' ),\n\t\t\t'search_items'\t\t\t=> __( 'Search Post Type' ),\n\t\t\t'not_found'\t\t\t\t=> __( 'Nothing found in the Database.' ),\n\t\t\t'not_found_in_trash'\t=> __( 'Nothing found in Trash' ),\n\t\t\t'parent_item_colon' \t=> ''\n\t\t\t),\n\n\t\t\t'description' \t\t\t=> __( 'This is the example custom post type' ), // Custom post type description\n\t\t\t'public' \t\t\t\t=> true,\n\t\t\t'publicly_queryable' \t=> true,\n\t\t\t'exclude_from_search' \t=> false,\n\t\t\t'show_ui' \t\t\t\t=> true,\n\t\t\t'query_var' \t\t\t=> true,\n\t\t\t'menu_position' \t\t=> 5, // The order the custom post type appears on the admin menu\n\t\t\t// 'menu_icon' \t\t\t=> get_stylesheet_directory_uri() . '/assets/images/custom-post-icon.png',\n\t\t\t'rewrite'\t\t\t\t=> array( 'slug' => 'custom_type', 'with_front' => false ), // You may specify its url slug\n\t\t\t'has_archive' \t\t\t=> 'custom_type', // You mary rename the slug here\n\t\t\t'capability_type' \t\t=> 'post',\n\t\t\t'hierarchical' \t\t\t=> false,\n\n\t\t\t// Enable post editor support\n\t\t\t'supports' => array(\n\t\t\t\t'title',\n\t\t\t\t'editor',\n\t\t\t\t'author',\n\t\t\t\t'thumbnail',\n\t\t\t\t'excerpt',\n\t\t\t\t'trackbacks',\n\t\t\t\t'custom-fields',\n\t\t\t\t'comments',\n\t\t\t\t'revisions',\n\t\t\t\t'sticky'\n\t\t\t)\n\t\t)\n\t);\n\n\t// This adds your post categories to your custom post type\n\tregister_taxonomy_for_object_type( 'category', 'custom_type' );\n\n\t// This adds your post tags to your custom post type\n\tregister_taxonomy_for_object_type( 'post_tag', 'custom_type' );\n\n}", "function add_custom_post_type() \n {\n // add custom type evenementen\n $labels = array(\n 'name' => _x('Quotes', 'post type general name', $this->localization_domain),\n 'singular_name' => _x('Quote', 'post type singular name', $this->localization_domain),\n 'add_new' => _x('Add Quote', 'event', $this->localization_domain),\n 'add_new_item' => __('Add New Quote', $this->localization_domain),\n 'edit_item' => __('Edit Quote', $this->localization_domain),\n 'new_item' => __('New Quote', $this->localization_domain),\n 'view_item' => __('View Quote', $this->localization_domain),\n 'search_items' => __('Search Quotes', $this->localization_domain),\n 'not_found' => __('No Quotes found', $this->localization_domain),\n 'not_found_in_trash' => __('No Quotes found in Trash', $this->localization_domain), \n 'parent_item_colon' => ''\n );\n $type_args = array(\n 'labels' => $labels,\n 'description' => __('bbQuotations offers a simple quotes custom post type. Useful for pull quotes or just random quotes on your site.',\n $this->localization_domain),\n 'public' => false,\n 'publicly_queryable' => false,\n 'show_ui' => true, \n 'query_var' => true,\n 'rewrite' => array('slug' => $this->options['bbquotations-slug']),\n 'capability_type' => 'post',\n 'hierarchical' => false,\n 'menu_position' => 5,\n 'supports' => array('title','editor','author')\n ); \n register_post_type( $this->custom_post_type_name, $type_args);\n }", "private function initCustomPostType(){\n //Instantiate our custom post type object\n $this->cptWPDS = new PostType($this->wpdsPostType);\n \n //Set our custom post type properties\n $this->cptWPDS->setSingularName($this->wpdsPostTypeName);\n $this->cptWPDS->setPluralName($this->wpdsPostTypeNamePlural);\n $this->cptWPDS->setMenuName($this->wpdsPostTypeNamePlural);\n $this->cptWPDS->setLabels('Add New', 'Add New '.$this->wpdsPostTypeName, 'Edit '.$this->wpdsPostTypeName, 'New '.$this->wpdsPostTypeName, 'All '.$this->wpdsPostTypeNamePlural, 'View '.$this->wpdsPostTypeNamePlural, 'Search '.$this->wpdsPostTypeNamePlural, 'No '.strtolower($this->wpdsPostTypeNamePlural).' found', 'No '.strtolower($this->wpdsPostTypeNamePlural).' found in the trash');\n $this->cptWPDS->setMenuIcon('dashicons-welcome-write-blog');\n $this->cptWPDS->setSlug($this->wpdsPostType);\n $this->cptWPDS->setDescription('Writings from the universe');\n $this->cptWPDS->setShowInMenu(true);\n $this->cptWPDS->setPublic(true);\n $this->cptWPDS->setTaxonomies([$this->wpdsPostType]);\n $this->cptWPDS->removeSupports(['title']);\n \n //Register custom post type\n $this->cptWPDS->register();\n }", "function carbon_register_post_type($settings){\n\n $labels = array(\n 'name' => _x($settings['plural'],'post type plural name','carbon'),\n 'singular_name' => _x($settings['singular'],'post type singular name','carbon'),\n 'add_new' => _x('Add New',$settings['singular'],'carbon'),\n 'add_new_item' => __('Add New ' .$settings['singular']),\n 'edit_item' => __('Edit ' .$settings['singular']),\n 'new_item' => __('New ' .$settings['singular']),\n 'all_items' => __('All ' .$settings['plural']),\n 'view_item' => __('View ' .$settings['singular']),\n 'search_items' => __('Search ' .$settings['plural']),\n 'not_found' => __('No ' .$settings['plural'].' found'),\n 'not_found_in_trash' => __('No ' .$settings['plural'].' found in Trash'),\n 'parent_item_colon' => ':',\n 'menu_name' => $settings['plural'],\n );\n\n $args = array(\n 'labels' => $labels,\n 'can_export' => (isset($settings['can_export']) ? $settings['can_export'] : true), // defaults true\n 'capability_type' => (isset($settings['capability_type']) ? $settings['behavior'] : 'post'), // default post\n // 'capabilities' // default capability_type\n 'exclude_from_search' => (isset($settings['exclude_from_search']) ? $settings['exclude_from_search'] : false), // default opposite of public\n 'hierarchical' => (isset($settings['hierarchical']) ? $settings['hierarchical'] : false), // default false\n 'has_archive' => (isset($settings['has_archive']) ? $settings['has_archive'] : false), // default false\n // 'permalink_epmask' // default EP_PERMALINK\n 'public' => (isset($settings['public']) ? $settings['public'] : true), // default false\n 'publicly_queryable' => (isset($settings['publicly_queryable']) ? $settings['publicly_queryable'] : true), // default public\n 'query_var' => (isset($settings['query_var']) ? $settings['query_var'] : true), // default true type\n 'show_ui' => (isset($settings['show_ui']) ? $settings['show_ui'] : true), // default public\n 'show_in_menu' => (isset($settings['show_in_menu']) ? $settings['show_in_menu'] : true), // default public\n 'show_in_admin_bar' => (isset($settings['show_in_admin_bar']) ? $settings['show_in_admin_bar'] : true), // default show_in_menu\n 'menu_position' => (isset($settings['menu_position']) ? $settings['menu_position'] : null), // default null\n 'menu_icon' => (isset($settings['menu_icon']) ? $settings['menu_icon'] : 'dashicons-admin-post'),\n 'supports' => (isset($settings['supports']) ? $settings['supports'] : array('title', 'editor', 'excerpt', 'thumbnail', 'revisions', 'page-attributes')), // default title editor\n 'taxonomies' => (isset($settings['taxonomies']) ? $settings['taxonomies'] : array()), // default none\n // 'register_meta_box_cb' // default none\n 'rewrite' => (isset($settings['rewrite']) ? $settings['rewrite'] : array( // default true name\n 'slug' => (isset($settings['slug']) ? $settings['slug'] : $settings['type']), // default type\n 'with_front' => (isset($settings['with_front']) ? $settings['with_front'] : false), // default true\n 'feeds' => (isset($settings['feeds']) ? $settings['feeds'] : false), // default has_archive\n 'pages' => (isset($settings['pages']) ? $settings['pages'] : true), // defaults true\n // 'ep_mask' // default permalink_epmask EP_PERMALINK\n )),\n );\n register_post_type($settings['type'], $args);\n }", "function create_post_type() {\r\n\r\n\tregister_post_type( 'Editorials',\r\n\t// CPT Options\r\n\t\tarray(\r\n\t\t\t'labels' => array(\r\n\t\t\t\t'name' => __( 'Editorials' ),\r\n\t\t\t\t'singular_name' => __( 'Editorial' )\r\n\t\t\t),\r\n\t\t\t'public' => true,\r\n\t\t\t'has_archive' => true,\r\n\t\t\t'rewrite' => array('slug' => 'editorials'),\r\n\t\t\t'supports' => array( 'title', 'editor', 'thumbnail', 'revisions', 'comments' ),\r\n \t'show_ui' => true,\r\n\t\t)\r\n\t);\r\n\tregister_post_type( 'Local news',\r\n\t// CPT Options\r\n\t\tarray(\r\n\t\t\t'labels' => array(\r\n\t\t\t\t\r\n\t\t\t\t'name' => __( 'Local news' ),\r\n\t\t\t\t'singular_name' => __( 'Local new' )\r\n\t\t\t),\r\n\t\t\t'public' => true,\r\n\t\t\t'has_archive' => true,\r\n\t\t\t'rewrite' => array('slug' => 'local news'),\r\n\t\t\t'supports' => array( 'title', 'editor', 'thumbnail', 'revisions', 'comments' ),\r\n \t'show_ui' => true,\r\n\t\t)\r\n\t);\r\n}", "function food_specials_custompost() {\r\n\t$args = array(\r\n\t\t'label' => 'Daily Food Specials',\r\n\t\t'public' => true,\r\n\t\t'show_ui' => true,\r\n\t\t'capability_type' => 'post',\r\n\t\t'rewrite' => array('slug' => 'food_specials'),\r\n\t\t'query_var' => true,\r\n\t\t'supports' => array(\r\n\t\t\t'title', 'editor', 'excerpt', 'comments', 'thumbnail', 'author',)\r\n\t\t);\r\n\tregister_post_type('food_specials', $args);\r\n}", "public function register_post_type() {\n\t\t$labels = array(\n\t\t\t'name' => _x( 'Movies', 'Post type general name', 'plugintest' ),\n\t\t\t'singular_name' => _x( 'Movie', 'Post type singular name', 'plugintest' ),\n\t\t\t'menu_name' => _x( 'Movies', 'Admin Menu text', 'plugintest' ),\n\t\t\t'name_admin_bar' => _x( 'Movie', 'Admin Menu Toolbar text', 'plugintest' ),\n\t\t\t'add_new' => __( 'Add New', 'plugintest' ),\n\t\t\t'add_new_item' => __( 'Add New Movie', 'plugintest' ),\n\t\t\t'new_item' => __( 'Aaaaaa', 'plugintest' ),\n\t\t\t'view_item' => __( 'View Movie', 'plugintest' ),\n\t\t\t'edit_item' => __( 'Edit Movie', 'plugintest' ),\n\t\t\t'all_items' => __( 'All Movies', 'plugintest' ),\n\t\t\t'search_items' => __( 'Search Movies', 'plugintest' ),\n\t\t\t'parent_item_colon' => __( 'Parent Movies', 'plugintest' ),\n\t\t\t'not_found' => __( 'No Movies found.', 'plugintest' ),\n\t\t\t'not_found_in_trash' => __( 'No Movies found in Trash.', 'plugintest' ),\n\t\t\t'featured_image' => _x( 'Movie Cover Image', 'Overrides the “Featured Image” phrase for this post type. Added in 4.3', 'plugintest' ),\n\t\t\t'set_featured_image' => _x( 'Set cover image', 'Overrides the “Set featured image” phrase for this post type. Added in 4.3', 'plugintest' ),\n\t\t\t'remove_featured_image' => _x( 'Remove cover image', 'Overrides the “Remove featured image” phrase for this post type. Added in 4.3', 'plugintest' ),\n\t\t\t'use_featured_image' => _x( 'Use as cover image', 'Overrides the “Use as featured image” phrase for this post type. Added in 4.3', 'plugintest' ),\n\t\t\t'item_published' => __( 'New Movie Published.', 'plugintest' ),\n\t\t\t'item_updated' => __( 'Movie post updated.', 'plugintest' ),\n\t\t);\n\n\t\t$args = array(\n\t\t\t'labels' => $labels,\n\t\t\t'public' => true,\n\t\t\t'publicly_queryable' => true,\n\t\t\t'show_ui' => true,\n\t\t\t'show_in_menu' => true,\n\t\t\t'query_var' => true,\n\t\t\t'rewrite' => array( 'slug' => 'movie' ),\n\t\t\t'capability_type' => 'post',\n\t\t\t'hierarchical' => false,\n\t\t\t'has_archive' => true,\n\t\t\t'menu_position' => null,\n\t\t\t'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments' ),\n\t\t\t'taxonomies' => array( 'category', 'post_tag' ), // Using wordpess category and tags.\n\t\t);\n\n\t\tregister_post_type( 'movie', $args );\n\t\tflush_rewrite_rules();\n\n\t\t$category_labels = array(\n\t\t\t'name' => esc_html__( 'Movies Categories', 'plugintest' ),\n\t\t\t'singular_name' => esc_html__( 'Movie Category', 'plugintest' ),\n\t\t\t'all_items' => esc_html__( 'Movies Categories', 'plugintest' ),\n\t\t\t'parent_item' => null,\n\t\t\t'parent_item_colon' => null,\n\t\t\t'edit_item' => esc_html__( 'Edit Category', 'plugintest' ),\n\t\t\t'update_item' => esc_html__( 'Update Category', 'plugintest' ),\n\t\t\t'add_new_item' => esc_html__( 'Add New Movie Category', 'plugintest' ),\n\t\t\t'new_item_name' => esc_html__( 'New Movie Name', 'plugintest' ),\n\t\t\t'menu_name' => esc_html__( 'Genre', 'plugintest' ),\n\t\t\t'search_items' => esc_html__( 'Search Categories', 'plugintest' ),\n\t\t);\n\n\t\t$category_args = array(\n\t\t\t'hierarchical' => false,\n\t\t\t'public' => true,\n\t\t\t'labels' => $category_labels,\n\t\t\t'show_ui' => true,\n\t\t\t'show_admin_column' => true,\n\t\t\t'rewrite' => array( 'slug' => 'genre' ),\n\t\t);\n\n\t\tregister_taxonomy( 'genre', array( self::$post_type ), $category_args );\n\t}", "public function register_post_type()\n\t{\n\n\t\tregister_post_type( 'partner', array(\n\t\t\t'labels' => array(\n\t\t\t\t'name' => _x( 'Partners', 'post type general name', 'custom-post-type-partners' ),\n\t\t\t\t'singular_name' => _x( 'Partner', 'post type singular name', 'custom-post-type-partners' ),\n\t\t\t\t'add_new' => _x( 'Add New', 'Partner', 'custom-post-type-partners' ),\n\t\t\t\t'add_new_item' => __( 'Add New Partner', 'custom-post-type-partners' ),\n\t\t\t\t'edit_item' => __( 'Edit Partner', 'custom-post-type-partners' ),\n\t\t\t\t'new_item' => __( 'New Partner', 'custom-post-type-partners' ),\n\t\t\t\t'all_items' => __( 'All Partners', 'custom-post-type-partners' ),\n\t\t\t\t'view_item' => __( 'View Partner', 'custom-post-type-partners' ),\n\t\t\t\t'search_items' => __( 'Search Partners', 'custom-post-type-partners' ),\n\t\t\t\t'not_found' => __( 'No Partners found', 'custom-post-type-partners' ),\n\t\t\t\t'not_found_in_trash' => __( 'No Partners found in Trash', 'custom-post-type-partners' ),\n\t\t\t\t'parent_item_colon' => '',\n\t\t\t\t'menu_name' => __( 'Partners', 'custom-post-type-partners' )\n\t\t\t),\n\t\t\t'public' => TRUE,\n\t\t\t'publicly_queryable' => TRUE,\n\t\t\t'show_ui' => TRUE,\n\t\t\t'show_in_menu' => TRUE,\n\t\t\t'query_var' => TRUE,\n\t\t\t'rewrite' => TRUE,\n\t\t\t'capability_type' => 'post',\n\t\t\t'has_archive' => FALSE,\n\t\t\t'hierarchical' => FALSE,\n\t\t\t'menu_position' => NULL,\n\t\t\t'menu_icon' => 'dashicons-admin-links',\n\t\t\t'supports' => array( 'title', 'editor', 'thumbnail', 'page-attributes' )\n\t\t) );\n\n\t}", "public function customPostType()\n {\n\n if (empty($this->custom_post_types)) {\n return;\n }\n\n foreach ($this->custom_post_types as $post_type) {\n register_post_type(\n $post_type['post_type'],\n [\n 'labels' => [\n 'name' => __($post_type['name'], 'vrcoder'),\n 'singular_name' => __($post_type['singular_name'], 'vrcoder'),\n 'menu_name' => __($post_type['name'], 'vrcoder'),\n 'name_admin_bar' => __($post_type['singular_name'], 'vrcoder'),\n 'archives' => __($post_type['singular_name'] . ' Archives', 'vrcoder'),\n 'attributes' => __($post_type['singular_name'] . ' Attributes', 'vrcoder'), \n 'parent_item_colon' => __('Parent ' . $post_type['singular_name'], 'vrcoder'),\n 'all_items' => __('All ' . $post_type['name'], 'vrcoder'),\n 'add_new_item' => __('Add new ' . $post_type['singular_name'], 'vrcoder'),\n 'add_new' => __('Add new', 'vrcoder'),\n 'new_item' => __('New ' . $post_type['singular_name'], 'vrcoder'),\n 'edit_item' => __('Edit ' . $post_type['singular_name'], 'vrcoder'),\n 'update_item' => __('Update' . $post_type['singular_name'], 'vrcoder'),\n 'view_item' => __('View' . $post_type['singular_name'], 'vrcoder'),\n 'view_items' => __('View' . $post_type['name'], 'vrcoder'),\n 'search_items' => __('Search' . $post_type['name'], 'vrcoder'),\n 'not_found' => __('No' . $post_type['singular_name'] . ' Found', 'vrcoder'),\n 'not_found_in_trash' => __('No' . $post_type['singular_name'] . ' Found in Trash', 'vrcoder'),\n 'featured_image' => __('Featured Image', 'vrcoder'),\n 'set_featured_image' => __('Set Featured Image', 'vrcoder'),\n 'remove_featured_image' => __('Remove Featured Image', 'vrcoder'),\n 'use_featured_image' => __('Use Featured Image', 'vrcoder'),\n 'insert_into_item' => __('Insert into' . $post_type['singular_name'], 'vrcoder'),\n 'uploaded_to_this_item' => __('Upload to this' . $post_type['singular_name'], 'vrcoder'),\n 'items_list' => __($post_type['name'] . ' List', 'vrcoder'),\n 'items_list_navigation' => __($post_type['name'] . ' List Navigation', 'vrcoder'),\n 'filter_items_list' => __('Filter' . $post_type['name'] . ' List', 'vrcoder'),\n ],\n 'label' => __($post_type['singular_name'], 'vrcoder'),\n 'description' => __($post_type['name'] . ' Custom Post Type', 'vrcoder'),\n 'supports' => $post_type['supports'],\n 'show_in_rest' => $post_type['show_in_rest'],\n 'taxonomies' => $post_type['taxonomies'],\n 'hierarchical' => $post_type['hierarchical'],\n 'public' => $post_type['public'],\n 'show_ui' => $post_type['show_ui'],\n 'show_in_menu' => $post_type['show_in_menu'],\n 'menu_position' => $post_type['menu_position'],\n 'show_in_admin_bar' => $post_type['show_in_admin_bar'],\n 'show_in_nav_menus' => $post_type['show_in_nav_menus'],\n 'can_export' => $post_type['can_export'],\n 'has_archive' => $post_type['has_archive'],\n 'exclude_from_search' => $post_type['exclude_from_search'],\n 'publicly_queryable' => $post_type['publicly_queryable'],\n 'capability_type' => $post_type['capability_type'],\n 'menu_icon' => $post_type['menu_icon']\n ]\n );\n }\n\n }", "public static function registerWPPostType()\n {\n register_post_type\n (\n 'fs_feed_entry',\n array\n (\n 'label' => 'Feed Entries',\n 'labels' => array\n (\n 'name' => 'Feed Entries',\n 'singular_name' => 'Feed Entry',\n 'add_new' => 'Add New',\n 'add_new_item' => 'Add New Feed Entry',\n 'edit_item' => 'Edit Feed Entry',\n 'new_item' => 'New Feed Entry',\n 'view_item' => 'View Feed Entry',\n 'search_items' => 'Search Feed Entries',\n 'not_found' => 'No Feed Entries Found',\n 'not_found_in_trash' => 'No Feed Entries Found In Trash',\n 'parent_item_colon' => 'Parent Feed Entries:',\n 'edit' => 'Edit',\n 'view' => 'View Feed Entry'\n ),\n 'public' => false,\n 'show_ui' => true\n )\n );\n }", "function pluginprefix_setup_post_type()\n{\n register_post_type('post-nasa-gallery', [\n 'label' => 'Nasa Images Posts',\n 'public' => true\n ]);\n}", "public function cws_register_cpt() {\n\n\t\tforeach ( $this->cpts as $key => $value ) {\n\n\t\t\tregister_post_type( $key, $value );\n\n\t\t}\n\n\t}", "public function register_post_types() {\n require_once('includes/post-types.php');\n }", "function my_custom_post_registry() {\n\t$registry_labels = array(\n\t\t'name' => 'Registrations',\n\t\t'singular_name' => 'Cozmeena Shawl Registration',\n\t\t'add_new' => 'Add New',\n\t\t'all_items' => 'All Registrations',\n\t\t'add_new_item' => 'Add New Registration',\n\t\t'edit_item' => 'Edit Registration',\n\t\t'new_item' => 'New Registration',\n\t\t'view_item' => 'View Registration',\n\t\t'search_items' => 'Search Registrations',\n\t\t'not_found' => 'No Registrations found',\n\t\t'not_found_in_trash' => 'No Registrations found in trash',\n\t\t'parent_item_colon' => '',\n\t\t'menu_name' => 'Cozmeena Shawl Registrations'\n\t);\n\t$registry_args = array(\n\t\t'labels' => $registry_labels,\n\t\t'description' => \"The International Cozmeena Registry is the official record of Cozmeena Shawls\",\n\t\t'public' => true,\n\t\t'menu_position' => 5,\n\t\t'menu_icon' => '',\n\t\t'supports' => array('title','author', 'editor','thumbnail'),\n\t\t'capability_type' => 'coz_registry', // need to assign capabilities via plugin\n\t\t'map_meta_cap' => true,\n\t\t'has_archive' => true,\n\t); \n\tregister_post_type('coz_registry',$registry_args);\n}", "public static function register_type() {\n\t\tregister_graphql_object_type(\n\t\t\t'PostTypeLabelDetails',\n\t\t\t[\n\t\t\t\t'description' => __( 'Details for labels of the PostType', 'wp-graphql' ),\n\t\t\t\t'fields' => [\n\t\t\t\t\t'name' => [\n\t\t\t\t\t\t'type' => 'String',\n\t\t\t\t\t\t'description' => __( 'General name for the post type, usually plural.', 'wp-graphql' ),\n\t\t\t\t\t],\n\t\t\t\t\t'singularName' => [\n\t\t\t\t\t\t'type' => 'String',\n\t\t\t\t\t\t'description' => __( 'Name for one object of this post type.', 'wp-graphql' ),\n\t\t\t\t\t\t'resolve' => function( $labels ) {\n\t\t\t\t\t\t\treturn ! empty( $labels->singular_name ) ? $labels->singular_name : null;\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\t'addNew' => [\n\t\t\t\t\t\t'type' => 'String',\n\t\t\t\t\t\t'description' => __( 'Default is ‘Add New’ for both hierarchical and non-hierarchical types.', 'wp-graphql' ),\n\t\t\t\t\t\t'resolve' => function( $labels ) {\n\t\t\t\t\t\t\treturn ! empty( $labels->add_new ) ? $labels->add_new : null;\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\t'addNewItem' => [\n\t\t\t\t\t\t'type' => 'String',\n\t\t\t\t\t\t'description' => __( 'Label for adding a new singular item.', 'wp-graphql' ),\n\t\t\t\t\t\t'resolve' => function( $labels ) {\n\t\t\t\t\t\t\treturn ! empty( $labels->add_new_item ) ? $labels->add_new_item : null;\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\t'editItem' => [\n\t\t\t\t\t\t'type' => 'String',\n\t\t\t\t\t\t'description' => __( 'Label for editing a singular item.', 'wp-graphql' ),\n\t\t\t\t\t\t'resolve' => function( $labels ) {\n\t\t\t\t\t\t\treturn ! empty( $labels->edit_item ) ? $labels->edit_item : null;\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\t'newItem' => [\n\t\t\t\t\t\t'type' => 'String',\n\t\t\t\t\t\t'description' => __( 'Label for the new item page title.', 'wp-graphql' ),\n\t\t\t\t\t\t'resolve' => function( $labels ) {\n\t\t\t\t\t\t\treturn ! empty( $labels->new_item ) ? $labels->new_item : null;\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\t'viewItem' => [\n\t\t\t\t\t\t'type' => 'String',\n\t\t\t\t\t\t'description' => __( 'Label for viewing a singular item.', 'wp-graphql' ),\n\t\t\t\t\t\t'resolve' => function( $labels ) {\n\t\t\t\t\t\t\treturn ! empty( $labels->view_item ) ? $labels->view_item : null;\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\t'viewItems' => [\n\t\t\t\t\t\t'type' => 'String',\n\t\t\t\t\t\t'description' => __( 'Label for viewing post type archives.', 'wp-graphql' ),\n\t\t\t\t\t\t'resolve' => function( $labels ) {\n\t\t\t\t\t\t\treturn ! empty( $labels->view_items ) ? $labels->view_items : null;\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\t'searchItems' => [\n\t\t\t\t\t\t'type' => 'String',\n\t\t\t\t\t\t'description' => __( 'Label for searching plural items.', 'wp-graphql' ),\n\t\t\t\t\t\t'resolve' => function( $labels ) {\n\t\t\t\t\t\t\treturn ! empty( $labels->search_items ) ? $labels->search_items : null;\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\t'notFound' => [\n\t\t\t\t\t\t'type' => 'String',\n\t\t\t\t\t\t'description' => __( 'Label used when no items are found.', 'wp-graphql' ),\n\t\t\t\t\t\t'resolve' => function( $labels ) {\n\t\t\t\t\t\t\treturn ! empty( $labels->not_found ) ? $labels->not_found : null;\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\t'notFoundInTrash' => [\n\t\t\t\t\t\t'type' => 'String',\n\t\t\t\t\t\t'description' => __( 'Label used when no items are in the trash.', 'wp-graphql' ),\n\t\t\t\t\t\t'resolve' => function( $labels ) {\n\t\t\t\t\t\t\treturn ! empty( $labels->not_found_in_trash ) ? $labels->not_found_in_trash : null;\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\t'parentItemColon' => [\n\t\t\t\t\t\t'type' => 'String',\n\t\t\t\t\t\t'description' => __( 'Label used to prefix parents of hierarchical items.', 'wp-graphql' ),\n\t\t\t\t\t\t'resolve' => function( $labels ) {\n\t\t\t\t\t\t\treturn ! empty( $labels->parent_item_colon ) ? $labels->parent_item_colon : null;\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\t'allItems' => [\n\t\t\t\t\t\t'type' => 'String',\n\t\t\t\t\t\t'description' => __( 'Label to signify all items in a submenu link.', 'wp-graphql' ),\n\t\t\t\t\t\t'resolve' => function( $labels ) {\n\t\t\t\t\t\t\treturn ! empty( $labels->all_items ) ? $labels->all_items : null;\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\t'archives' => [\n\t\t\t\t\t\t'type' => 'String',\n\t\t\t\t\t\t'description' => __( 'Label for archives in nav menus', 'wp-graphql' ),\n\t\t\t\t\t],\n\t\t\t\t\t'attributes' => [\n\t\t\t\t\t\t'type' => 'String',\n\t\t\t\t\t\t'description' => __( 'Label for the attributes meta box.', 'wp-graphql' ),\n\t\t\t\t\t],\n\t\t\t\t\t'insertIntoItem' => [\n\t\t\t\t\t\t'type' => 'String',\n\t\t\t\t\t\t'description' => __( 'Label for the media frame button.', 'wp-graphql' ),\n\t\t\t\t\t\t'resolve' => function( $labels ) {\n\t\t\t\t\t\t\treturn ! empty( $labels->insert_into_item ) ? $labels->insert_into_item : null;\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\t'uploadedToThisItem' => [\n\t\t\t\t\t\t'type' => 'String',\n\t\t\t\t\t\t'description' => __( 'Label for the media frame filter.', 'wp-graphql' ),\n\t\t\t\t\t\t'resolve' => function( $labels ) {\n\t\t\t\t\t\t\treturn ! empty( $labels->uploaded_to_this_item ) ? $labels->uploaded_to_this_item : null;\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\t'featuredImage' => [\n\t\t\t\t\t\t'type' => 'String',\n\t\t\t\t\t\t'description' => __( 'Label for the Featured Image meta box title.', 'wp-graphql' ),\n\t\t\t\t\t\t'resolve' => function( $labels ) {\n\t\t\t\t\t\t\treturn ! empty( $labels->featured_image ) ? $labels->featured_image : null;\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\t'setFeaturedImage' => [\n\t\t\t\t\t\t'type' => 'String',\n\t\t\t\t\t\t'description' => __( 'Label for setting the featured image.', 'wp-graphql' ),\n\t\t\t\t\t\t'resolve' => function( $labels ) {\n\t\t\t\t\t\t\treturn ! empty( $labels->set_featured_image ) ? $labels->set_featured_image : null;\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\t'removeFeaturedImage' => [\n\t\t\t\t\t\t'type' => 'String',\n\t\t\t\t\t\t'description' => __( 'Label for removing the featured image.', 'wp-graphql' ),\n\t\t\t\t\t\t'resolve' => function( $labels ) {\n\t\t\t\t\t\t\treturn ! empty( $labels->remove_featured_image ) ? $labels->remove_featured_image : null;\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\t'useFeaturedImage' => [\n\t\t\t\t\t\t'type' => 'String',\n\t\t\t\t\t\t'description' => __( 'Label in the media frame for using a featured image.', 'wp-graphql' ),\n\t\t\t\t\t\t'resolve' => function( $labels ) {\n\t\t\t\t\t\t\treturn ! empty( $labels->use_featured_item ) ? $labels->use_featured_item : null;\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\t'menuName' => [\n\t\t\t\t\t\t'type' => 'String',\n\t\t\t\t\t\t'description' => __( 'Label for the menu name.', 'wp-graphql' ),\n\t\t\t\t\t\t'resolve' => function( $labels ) {\n\t\t\t\t\t\t\treturn ! empty( $labels->menu_name ) ? $labels->menu_name : null;\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\t'filterItemsList' => [\n\t\t\t\t\t\t'type' => 'String',\n\t\t\t\t\t\t'description' => __( 'Label for the table views hidden heading.', 'wp-graphql' ),\n\t\t\t\t\t\t'resolve' => function( $labels ) {\n\t\t\t\t\t\t\treturn ! empty( $labels->filter_items_list ) ? $labels->filter_items_list : null;\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\t'itemsListNavigation' => [\n\t\t\t\t\t\t'type' => 'String',\n\t\t\t\t\t\t'description' => __( 'Label for the table pagination hidden heading.', 'wp-graphql' ),\n\t\t\t\t\t\t'resolve' => function( $labels ) {\n\t\t\t\t\t\t\treturn ! empty( $labels->items_list_navigation ) ? $labels->items_list_navigation : null;\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\t'itemsList' => [\n\t\t\t\t\t\t'type' => 'String',\n\t\t\t\t\t\t'description' => __( 'Label for the table hidden heading.', 'wp-graphql' ),\n\t\t\t\t\t\t'resolve' => function( $labels ) {\n\t\t\t\t\t\t\treturn ! empty( $labels->items_list ) ? $labels->items_list : null;\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\n\t}", "function tt_register_cpt($single, $plural = '') {\n if (empty($plural)) {\n $plural = $single.'s';\n }\n register_post_type(\n strtolower($single),\n array(\n 'label' => $plural,\n 'labels' => array(\n 'add_new_item' => \"Add New $single\",\n 'edit_item' => \"Edit $single\",\n 'new_item' => \"New $single\",\n 'view_item' => \"View $single\",\n 'search_items' => \"Search $plural\",\n 'not_found' => \"No $plural found\",\n 'not_found_in_trash' => \"No $plural found in Trash\",\n ),\n 'public' => true,\n 'has_archive' => true,\n 'supports' => array(\n 'title',\n 'editor',\n 'thumbnail',\n 'custom-fields',\n 'excerpt',\n ),\n 'taxonomies' => array('category'),\n )\n );\n}", "function cptui_register_my_cpts_how_it_works() {\n\n\t$labels = array(\n\t\t\"name\" => __( \"How It Works\", \"esoftkulo\" ),\n\t\t\"singular_name\" => __( \"How it Work\", \"esoftkulo\" ),\n\t);\n\n\t$args = array(\n\t\t\"label\" => __( \"How It Works\", \"esoftkulo\" ),\n\t\t\"labels\" => $labels,\n\t\t\"description\" => \"\",\n\t\t\"public\" => true,\n\t\t\"publicly_queryable\" => true,\n\t\t\"show_ui\" => true,\n\t\t\"delete_with_user\" => false,\n\t\t\"show_in_rest\" => true,\n\t\t\"rest_base\" => \"\",\n\t\t\"rest_controller_class\" => \"WP_REST_Posts_Controller\",\n\t\t\"has_archive\" => false,\n\t\t\"show_in_menu\" => true,\n\t\t\"show_in_nav_menus\" => true,\n\t\t\"exclude_from_search\" => false,\n\t\t\"capability_type\" => \"post\",\n\t\t\"map_meta_cap\" => true,\n\t\t\"hierarchical\" => false,\n\t\t\"rewrite\" => array( \"slug\" => \"how_it_works\", \"with_front\" => true ),\n\t\t\"query_var\" => true,\n\t\t\"supports\" => array( \"title\", \"editor\", \"thumbnail\" ),\n\t);\n\n\tregister_post_type( \"how_it_works\", $args );\n}", "function add_my_custom_posttype_waarden(){\n //LABELS DIFINIËREN\n $labels = array(\n 'add_new' => 'Voeg nieuwe waarde toe',\n 'add_new_item' => 'Voeg nieuwe waarde toe',\n 'name' => 'waarden',\n 'singular_name' => 'waarden',\n );\n //ARGUMENTEN DIFINIËREN\n $args = array(\n 'labels' => $labels, // de array labels van hier boven linken aan het argument labels\n 'Description' => 'waarden van Ben & Jerry',\n 'public' => true,\n 'menu_position' => 6,\n 'menu_icon' => 'dashicons-layout', //Een icoon kiezen\n 'supports' => array('title', 'editor', 'thumbnail'), \n 'has_archive' => true, //Maak een archief aan (opsomming van alle elementen), anders gaan we archive-waarden.php nooit kunnen aanspreken.\n 'show_in_nav_menus' => TRUE,\n \n );\n register_post_type( 'waarden', $args ); \n }", "function custom_post_type() {\n $labels = array(\n 'name' => _x( 'Ort', 'Post Type General Name', 'twentythirteen' ),\n 'singular_name' => _x( 'Ort', 'Post Type Singular Name', 'twentythirteen' ),\n 'menu_name' => __( 'Orter', 'twentythirteen' ),\n 'all_items' => __( 'Alla Orter', 'twentythirteen' ),\n 'view_item' => __( 'View Ort', 'twentythirteen' ),\n 'add_new_item' => __( 'Skapa ny Ort', 'twentythirteen' ),\n 'add_new' => __( 'Skapa ny Ort', 'twentythirteen' ),\n 'edit_item' => __( 'Redigera Ort', 'twentythirteen' ),\n 'update_item' => __( 'Upddatera Ort', 'twentythirteen' ),\n 'search_items' => __( 'Sök Ort', 'twentythirteen' ),\n 'not_found' => __( 'Not Found', 'twentythirteen' ),\n 'not_found_in_trash' => __( 'Not found in Trash', 'twentythirteen' ),\n );\n \n $args = array(\n 'label' => __( 'cities', 'twentythirteen' ),\n 'description' => __( 'City Post Page', 'twentythirteen' ),\n 'labels' => $labels,\n 'supports' => array('title','thumbnail',),\n 'hierarchical' => false,\n 'public' => true,\n 'show_ui' => true,\n 'show_in_menu' => true,\n 'show_in_nav_menus' => true,\n 'show_in_admin_bar' => true,\n 'menu_position' => 5,\n 'can_export' => true,\n 'has_archive' => true,\n 'exclude_from_search' => false,\n 'publicly_queryable' => true,\n 'capability_type' => 'page',\n );\n \n register_post_type( 'cities', $args );\n\n }", "function wpmudev_create_post_type() {\n\t$labels = array(\n \t\t'name' => 'Actividades',\n \t'singular_name' => 'Actividad',\n \t'add_new' => 'Añade Nueva Actividad',\n \t'add_new_item' => 'Añade una nueva Actividad',\n \t'edit_item' => 'Edita la Actividad',\n \t'new_item' => 'Nueva Actividad',\n \t'all_items' => 'Todas las Actividades',\n \t'view_item' => 'Ver Actividad',\n \t'search_items' => 'Buscar Actividades',\n \t'not_found' => 'No se han encontrado Actividades',\n \t'not_found_in_trash' => 'No se han encontrado Actividades en la Papelera', \n \t'parent_item_colon' => '',\n \t'menu_name' => 'Actividades',\n );\n \n $args = array(\n\t\t'labels' => $labels,\n\t\t'has_archive' => true,\n \t\t'public' => true,\n\t\t'supports' => array( 'title', 'custom-fields', 'thumbnail', 'comments', 'page-attributes', 'author' ),\n\t\t'exclude_from_search' => false,\n\t\t'capability_type' => 'post',\n\t\t//'map_meta_caps' => true,\n\t\t'rewrite' => array( 'slug' => 'actividades' ),\n\t);\n\t\n\tregister_post_type( 'actividad', $args );\n}", "function add_custom_post_type() {\n\tregister_post_type( 'learning_resource',\n array(\n 'labels' => array(\n 'name' => __( 'Learning Resources' ),\n 'singular_name' => __( 'Learning Resource' )\n ),\n 'public' => true,\n 'has_archive' => true,\n )\n );\n}", "static function register() {\n // register the post type\n register_post_type('sale-flat', array(\n\t\t\n\t\t\t'labels'=> array(\n\t\t\t\t'name' => _x( 'Eladó ingatlanok', 'theme-phrases' ),\n\t\t\t\t'singular_name' => _x( 'Eladó ingatlan', 'theme-phrases' ),\n\t\t\t\t'menu_name' => _x( 'Eladó ingatlanok', 'theme-phrases' ),\n\t\t\t\t'name_admin_bar' => _x( 'Eladó ingatlan', 'theme-phrases' ),\n\t\t\t\t'add_new' => _x( 'Új eladó ingatlan', 'theme-phrases' ),\n\t\t\t\t'add_new_item' => __( 'Új eladó ingatlan hozzáadása', 'theme-phrases' ),\n\t\t\t\t'new_item' => __( 'Új eladó ingatlan', 'theme-phrases' ),\n\t\t\t\t'edit_item' => __( 'Eladó ingatlan szerkesztése', 'theme-phrases' ),\n\t\t\t\t'view_item' => __( 'Eladó ingatlan megtekintése', 'theme-phrases' ),\n\t\t\t\t'all_items' => __( 'Összes eladó ingatlan', 'theme-phrases' ),\n\t\t\t\t'search_items' => __( 'Eladó ingatlan keresése', 'theme-phrases' ),\n\t\t\t\t'parent_item_colon' => __( 'Parent eladó ingatlan:', 'theme-phrases' ),\n\t\t\t\t'not_found' => __( 'Nincsenek eladó ingatlanok.', 'theme-phrases' ),\n\t\t\t\t'not_found_in_trash' => __( 'Nincsenek eladó ingatlanok a kukában.', 'theme-phrases' )\n\t\t\t),\n 'description' => __('Eladó ingatlanok', 'theme-phrases'),\n 'exclude_from_search' => true,\n 'publicly_queryable' => true,\n 'public' => true,\n 'show_ui' => true,\n 'auto-draft' => false,\n 'show_in_admin_bar' => true,\n 'show_in_nav_menus' => true,\n 'menu_position' => 4,\n 'menu_icon'\t=> 'dashicons-tag',\n 'revisions' => false,\n 'hierarchical' => true,\n 'has_archive' => true,\n\t\t\t'supports' => array('title','editor','thumbnail'),\n 'rewrite' => false,\n 'can_export' => false,\n 'capabilities' => array (\n 'create_posts' => 'edit_posts',\n 'edit_post' => 'edit_posts',\n 'read_post' => 'edit_posts',\n 'delete_posts' => 'edit_posts',\n 'delete_post' => 'edit_posts',\n 'edit_posts' => 'edit_posts',\n 'edit_others_posts' => 'edit_posts',\n 'publish_posts' => 'edit_posts',\n 'read_private_posts' => 'edit_posts',\n ),\n 'register_meta_box_cb' => array('SaleFlatPostType', 'add_metabox') \n ));\n }", "public function register_content_type() {\n\t\t$labels = array(\n\t\t\t'name' => 'Honor Rolls',\n\t\t\t'singular_name' => 'Honor Roll',\n\t\t\t'add_new' => 'Add New',\n\t\t\t'add_new_item' => 'Add New Honor Roll',\n\t\t\t'edit_item' => 'Edit Honor Roll',\n\t\t\t'new_item' => 'New Honor Roll',\n\t\t\t'all_items' => 'All Honor Rolls',\n\t\t\t'view_item' => 'View Honor Rolls',\n\t\t\t'search_items' => 'Search Honor Rolls',\n\t\t\t'not_found' => 'No Honor Rolls found',\n\t\t\t'not_found_in_trash' => 'No Honor Rolls found in Trash',\n\t\t\t'menu_name' => 'Honor Rolls',\n\t\t);\n\n\t\t$args = array(\n\t\t\t'labels' => $labels,\n\t\t\t'public' => false,\n\t\t\t'publicly_queryable' => false,\n\t\t\t'show_ui' => true,\n\t\t\t'show_in_menu' => true,\n\t\t\t'query_var' => true,\n\t\t\t'rewrite' => false,\n\t\t\t'has_archive' => false,\n\t\t\t'hierarchical' => false,\n\t\t\t'supports' => array( 'title' ),\n\t\t);\n\t\tregister_post_type( $this::$content_type_slug, $args );\n\t}", "public function create_post_type() {\n\n register_post_type( self::POST_TYPE,\n array(\n\n 'labels' => array(\n 'name' => __( 'Fundraisers' ),\n 'singular_name' => __( 'Fundraiser' )\n ),\n 'description' => 'Fundraisers that allow users to purchase items through the WooCommerce Stores',\n 'menu_icon' => 'dashicons-chart-line',\n 'supports' => array( 'title', 'editor', 'thumbnail', 'excerpt',\n 'revisions' ),\n 'public' => true,\n 'has_archive' => true,\n 'rewrite' => array(\n 'slug' => __( 'fundraisers' ),\n 'with_front' => false\n )\n )\n );\n }", "function wpcp_custom_post_type()\n{\n register_post_type('wpcp_server',\n array(\n 'labels' => array(\n 'name' => __('Servers', 'textdomain'),\n 'singular_name' => __('Server', 'textdomain'),\n ),\n 'public' => true,\n 'has_archive' => false,\n 'delete_with_user' => false,\n \"supports\" => array(\"customer\", \"author\"),\n 'menu_icon' => 'dashicons-cloud'\n )\n );\n}", "function create_post_type(){\n register_post_type('recipes', [ \n 'labels' => [\n 'name' => 'Recipes', //Etikett i plural Etikett i singular\n 'singular_name' => 'Recipe', //Vad som ska stå i ”Lägg till...” knappen\n 'add_new' => 'New Recipe', //Vad som ska stå i ”Lägg till ny...” knappen\n 'add_new_item' => 'New Recipe', //Vad som ska stå i ”Ny...” länken\n 'edit_item' => 'Edit Recipe', //Vad som ska stå i ”Redigera...” länken\n 'new_item' => 'New Recipe', //Vad som ska stå i ”Ny...” länken\n 'search_items' => 'Search for Recipe', //Vad som ska stå i sökrutan i listningen\n 'not_found' => 'No Recipe Found', \n 'all_items' => 'All Recipes', //Vad som ska stå i ”Alla...” länken\n ],\n 'supports' => array( 'thumbnail' ),\n 'description' => 'The Big Tasty!', //En kort beskrivning av posttypen\n 'public' => true, //Om och hur posttypen ska visas för olika användare\n 'exclude_from_search' => false, //Om posttypens poster ska exkluderas vid sökning\n 'show_ui' => true, //Om posttypen ska kunna hanteras från admin\n 'show_in_nav_menus' => true, //Om poster av posttypen ska kunna läggas till i menyer\n 'show_in_menu' => true, //Vart posttypen ska listas i admin (vänster eller topp)\n 'show_in_admin_bar' => true, //Om posttypen ska visas i toppbar’en\n 'menu_position' => 10, //Vart i vänstermenyn posttypen ska visas\n 'hierarchical' => false, //Om poster i posttypen ska kunna ha föräldrar, likt Sidor\n 'menu_icon' => 'dashicons-food', //Ikon för posttypen\n 'supports' => array('title' , 'editor'), //Vad som ska synas när man skapar/redigerar en post \n 'taxonomies' => array('category'), //Vilka taxonomier som ska tillhöra posttypen\n 'has_archive' => true, //Om posttypen ska ha arkivsida\n 'rewrite' => [ //Hur posttypens rewrites ska hanteras...\n 'slug' => 'recipe', //Permalänkstrukturen för posttypen\n 'with_front' => true //Om permalänkarna ska låta föregås av sluggen\n ] \n ]);\n\n}", "function create_post_type() {\n\n // register external_post as a Custom Post Type\n register_post_type( 'external_post', \n array( \n 'labels' => array( \n 'name' => __('External Posts'), \n 'singular_name' => __('External Post') \n ),\n 'public' => true,\n 'menu_position' => 5,\n 'supports' => array('title', 'excerpt'),\n 'rewrite' => array('slug' => 'external','with_front' => false) \n ) \n ); \n\n // connect external_post to category taxonomy\n register_taxonomy_for_object_type('category', 'external_post');\n register_taxonomy_for_object_type('post_tag', 'external_post');\n\n\n // register wp_tool as a Custom Post Type\n register_post_type('wp_tool',\n array( \n 'labels' => array( \n 'name' => __('WordPress Tools'), \n 'singular_name' => __('WordPress Tool') \n ), \n 'public' => true, \n 'menu_position' => 5, \n 'supports' => array('title', 'author', 'editor', 'excerpt', 'thumbnail', 'post-formats', 'revisions', 'meta_info'),\n 'rewrite' => array('slug' => 'tool','with_front' => false) \n ) \n );\n\n // connect wp_tool to category taxonomy\n register_taxonomy_for_object_type('meta_info', 'wp_tool');\n register_taxonomy_for_object_type('category', 'wp_tool');\n\n\n // reregister default post so we can set a custom slug\n register_post_type('post', array(\n 'labels' => array(\n 'name_admin_bar' => _x('Post', 'add new on admin bar' ),\n ),\n 'public' => true,\n '_builtin' => false, \n '_edit_link' => 'post.php?post=%d', \n 'capability_type' => 'post',\n 'map_meta_cap' => true,\n 'show_in_menu' => false,\n 'hierarchical' => false,\n 'rewrite' => array('slug' => 'article'),\n 'query_var' => false,\n 'supports' => array('title', 'editor', 'author', 'thumbnail', 'excerpt', 'trackbacks', 'custom-fields', 'comments', 'revisions', 'post-formats', 'column_info'),\n )); \n\n // register external_tool as a Custom Post Type\n register_post_type('external_tool',\n array(\n 'labels' => array( \n 'name' => __('External Tools'), \n 'singular_name' => __('External Tool') \n ), \n 'public' => true, \n 'menu_position' => 5, \n 'supports' => array('title', 'author', 'excerpt', 'thumbnail', 'revisions', 'meta_info'),\n 'rewrite' => array('slug' => 'special','with_front' => false) \n ) \n ); \n\n // connect external_tool to category taxonomy\n register_taxonomy_for_object_type('category', 'external_tool');\n register_taxonomy_for_object_type('meta_info', 'external_tool');\n\n\n // register city_journal as a Custom Post Type\n register_post_type('city_journal',\n array(\n 'labels' => array( \n 'name' => __('CityJournal Entry'),\n 'singular_name' => __('CityJournal Entry')\n ), \n 'public' => true, \n 'menu_position' => 5, \n 'supports' => array('title', 'editor', 'author', 'excerpt', 'thumbnail', 'revisions', 'meta_info', 'comments'),\n 'rewrite' => array('slug' => 'cityjournal','with_front' => false) \n ) \n ); \n\n // connect city_journal to category taxonomy\n register_taxonomy_for_object_type('category', 'city_journal');\n register_taxonomy_for_object_type('meta_info', 'city_journal'); \n\n\n // register people_project as a Custom Post Type\n register_post_type('people_project',\n array(\n 'labels' => array( \n 'name' => __('People & Projects'),\n 'singular_name' => __('People & Project')\n ), \n 'public' => true, \n 'menu_position' => 5, \n 'supports' => array('title', 'excerpt', 'thumbnail', 'meta_info'),\n ) \n ); \n\n // connect people_project to category taxonomy\n register_taxonomy_for_object_type('meta_info', 'people_project'); \n\n\n register_post_type('discussion',\n array( \n 'labels' => array( \n 'name' => __('Discussions'), \n 'singular_name' => __('Discussion') \n ), \n 'public' => true, \n 'menu_position' => 5, \n 'supports' => array('title', 'editor', 'excerpt', 'thumbnail', 'post-formats', 'revisions', 'meta_info', 'comments'),\n 'rewrite' => array('slug' => 'discussion','with_front' => false) \n ) \n );\n\n // connect discussion to category taxonomy\n register_taxonomy_for_object_type('meta_info', 'discussion');\n register_taxonomy_for_object_type('category', 'discussion');\n\n}", "function bs_configure_custom_post_types($args)\n{\n function bs_custom_post_types()\n {\n global $bs_config;\n\n foreach ($bs_config[\"custom-post-types\"] as $key => $type) {\n $type = bs_defaults($type, [\n \"public\" => true,\n ]);\n\n if (isset($type[\"name\"])) {\n $type[\"labels\"][\"name\"] = $type[\"name\"];\n }\n\n if (isset($type[\"slug\"])) {\n $type[\"rewrite\"][\"slug\"] = $type[\"slug\"];\n }\n\n if (isset($type[\"admin_only\"]) && $type[\"admin_only\"]) {\n $type[\"public\"] = false;\n $type[\"show_ui\"] = true;\n }\n\n register_post_type($key, bs_array_omit($type, [\"slug\", \"name\", \"admin_only\"]));\n }\n }\n add_action(\"init\", \"bs_custom_post_types\");\n}", "function add_my_custom_posttype_recepten(){\n //LABELS DIFINIËREN\n $labels = array(\n 'add_new' => 'Voeg nieuw recept toe',\n 'add_new_item' => 'Voeg nieuw recept toe',\n 'name' => 'Recepten',\n 'singular_name' => 'recept',\n );\n //ARGUMENTEN DIFINIËREN\n $args = array(\n 'labels' => $labels, // de array labels van hier boven linken aan het argument labels\n 'Description' => 'Lactosevrije recepten van B & J',\n 'public' => true,\n 'menu_position' => 4,\n 'menu_icon' => 'dashicons-book-alt', //Een icoon kiezen\n 'supports' => array('title', 'editor', 'thumbnail', 'page-attributes', 'comments'), \n 'has_archive' => true, //Maak een archief aan (opsomming van alle elementen), anders gaan we archive-recepten.php nooit kunnen aanspreken.\n 'show_in_nav_menus' => TRUE,\n\n );\n\n register_post_type( 'recepten', $args ); \n \n }", "function create_post_type() {\r\n register_post_type( 'nyheter',\r\n array(\r\n 'labels' => array(\r\n 'name' => __( 'Nyheter' ),\r\n 'singular_name' => __( 'Nyheter' )\r\n ),\r\n 'public' => true,\r\n 'has_archive' => true,\r\n 'supports' => array('title', 'editor', 'thumbnail')\r\n )\r\n );\r\n}", "function zmpm_register_post_type() {\n\t\n\t$labels = array(\n\t\t'name' => 'Permissions',\n\t\t'singular_name' => 'Permission',\n\t\t'menu_name' => 'Permissions',\n\t\t'name_admin_bar' => 'Permission',\n\t\t'archives' => 'Permission Archives',\n\t\t'attributes' => 'Permission Attributes',\n\t\t'parent_item_colon' => 'Parent Permission:',\n\t\t'all_items' => 'Permissions',\n\t\t'add_new_item' => 'Add New Permission',\n\t\t'add_new' => 'Add New',\n\t\t'new_item' => 'New Permission',\n\t\t'edit_item' => 'Edit Permission',\n\t\t'update_item' => 'Update Permission',\n\t\t'view_item' => 'View Permission',\n\t\t'view_items' => 'View Permissions',\n\t\t'search_items' => 'Search Permission',\n\t\t'not_found' => 'Not found',\n\t\t'not_found_in_trash' => 'Not Found in Trash',\n\t\t'featured_image' => 'Featured Image',\n\t\t'set_featured_image' => 'Set featured image',\n\t\t'remove_featured_image' => 'Remove featured image',\n\t\t'use_featured_image' => 'Use as featured image',\n\t\t'insert_into_item' => 'Insert into permission',\n\t\t'uploaded_to_this_item' => 'Uploaded to this permission',\n\t\t'items_list' => 'Permissions list',\n\t\t'items_list_navigation' => 'Permissions list navigation',\n\t\t'filter_items_list' => 'Filter permissions list',\n\t);\n\t$args = array(\n\t\t'label' => 'Permission',\n\t\t'description' => 'ZingMap permissions',\n\t\t'labels' => $labels,\n\t\t'supports' => array( 'title' ),\n\t\t'hierarchical' => false,\n\t\t'public' => false,\n\t\t'show_ui' => true,\n\t\t'show_in_menu' => 'users.php',\n\t\t'menu_position' => 5,\n\t\t'menu_icon' => 'dashicons-lock',\n\t\t'show_in_admin_bar' => true,\n\t\t'show_in_nav_menus' => false,\n\t\t'can_export' => true,\n\t\t'has_archive' => false,\n\t\t'exclude_from_search' => true,\n\t\t'publicly_queryable' => true,\n\t\t'capability_type' => 'page',\n\t);\n\tregister_post_type( 'zmpm_permission', $args );\n\t\n}", "public function register_estate_post_type() {\r\n $options = get_option( 'myhome_redux' );\r\n // define post type slug\r\n if ( ! empty( $options['mh-estate-slug'] ) ) {\r\n $slug = $options['mh-estate-slug'];\r\n } else {\r\n $slug = 'properties';\r\n }\r\n\r\n register_post_type( 'estate', array(\r\n 'labels' => array(\r\n 'name'\t\t\t => esc_html__( 'Properties', 'myhome-core' ),\r\n 'singular_name'\t => esc_html__( 'Property', 'myhome-core' ),\r\n 'menu_name' => esc_html__( 'Properties', 'myhome-core' ),\r\n 'name_admin_bar' => esc_html__( 'Add New Property', 'myhome-core' ),\r\n 'add_new' => esc_html__( 'Add New Property', 'myhome-core' ),\r\n 'add_new_item' => esc_html__( 'Add New Property', 'myhome-core' ),\r\n 'new_item' => esc_html__( 'New Property', 'myhome-core' ),\r\n 'edit_item' => esc_html__( 'Edit Property', 'myhome-core' ),\r\n 'view_item' => esc_html__( 'View Property', 'myhome-core' ),\r\n 'all_items' => esc_html__( 'Properties', 'myhome-core' ),\r\n 'search_items' => esc_html__( 'Search property', 'myhome-core' ),\r\n 'not_found' => esc_html__( 'No Property Found found.', 'myhome-core' ),\r\n 'not_found_in_trash' => esc_html__( 'No Property found in Trash.', 'myhome-core' )\r\n ),\r\n 'show_in_rest' => true,\r\n 'query_var' => true,\r\n 'public'\t\t => true,\r\n 'has_archive'\t => true,\r\n 'menu_position' => 21,\r\n 'menu_icon' => 'dashicons-admin-home',\r\n 'capability_type' => array( 'estate', 'estates' ),\r\n 'map_meta_cap' => true,\r\n 'rewrite'\t\t => array( 'slug' => $slug ),\r\n 'supports'\t\t => array(\r\n 'title',\r\n 'author',\r\n 'editor',\r\n 'thumbnail',\r\n )\r\n ) );\r\n }", "function create_volunteer_custom_post() {\n register_post_type( 'volunteers',\n array(\n 'labels' => array(\n 'name' => __( 'Board Members' ),\n 'singular_name' => __( 'Board Member' ),\n ),\n 'public' => true,\n 'has_archive' => true,\n 'supports' => array(\n 'title',\n 'editor',\n 'thumbnail',\n 'custom-fields'\n )\n ));\n}", "public function registerPostTypes()\n {\n $projectLabels = array(\n 'name' => __( 'Projects'),\n 'singular_name' => __( 'Project'),\n 'menu_name' => __( 'Projects'),\n 'parent_item_colon' => __( 'Parent Project'),\n 'all_items' => __( 'All Projects'),\n 'view_item' => __( 'View Project'),\n 'add_new_item' => __( 'Add New Project'),\n 'add_new' => __( 'Add New'),\n 'edit_item' => __( 'Edit Project'),\n 'update_item' => __( 'Update Project'),\n 'search_items' => __( 'Search Project'),\n 'not_found' => __( 'Not Found'),\n 'not_found_in_trash' => __( 'Not found in Trash'),\n );\n $componentLabels = array(\n 'name' => __( 'Components'),\n 'singular_name' => __( 'Component'),\n 'menu_name' => __( 'Components'),\n 'parent_item_colon' => __( 'Parent Component'),\n 'all_items' => __( 'All Components'),\n 'view_item' => __( 'View Component'),\n 'add_new_item' => __( 'Add New Component'),\n 'add_new' => __( 'Add New'),\n 'edit_item' => __( 'Edit Component'),\n 'update_item' => __( 'Update Component'),\n 'search_items' => __( 'Search Component'),\n 'not_found' => __( 'Not Found'),\n 'not_found_in_trash' => __( 'Not found in Trash'),\n );\n $componentTypeTaxLabels = array(\n 'name' => __('Component types'),\n 'singular_name' => __('Component type'),\n 'search_items' => __( 'Search Component types' ),\n 'popular_items' => __( 'Popular Component types' ),\n 'all_items' => __( 'All Component types' ),\n 'parent_item' => null,\n 'parent_item_colon' => null,\n 'edit_item' => __( 'Edit Component type' ),\n 'update_item' => __( 'Update Component type' ),\n 'add_new_item' => __( 'Add New Component type' ),\n 'new_item_name' => __( 'New Component type Name' ),\n 'separate_items_with_commas' => __( 'Separate component types with commas' ),\n 'add_or_remove_items' => __( 'Add or remove component types' ),\n 'choose_from_most_used' => __( 'Choose from the most used ones' ),\n 'menu_name' => __( 'Component types' ),\n ); \n \n // Set other options for custom post types\n $projectArgs = array(\n 'label' => __( 'projects'),\n 'description' => __( 'Stuff that you have done or used'),\n 'labels' => $projectLabels,\n 'supports' => array( 'title', 'editor', 'excerpt', 'author', 'thumbnail', 'comments', 'revisions', 'custom-fields'),\n 'hierarchical' => false,\n 'public' => true,\n 'show_ui' => true,\n 'show_in_menu' => true,\n 'show_in_nav_menus' => true,\n 'show_in_admin_bar' => true,\n 'menu_position' => 6,\n 'can_export' => true,\n 'has_archive' => true,\n 'exclude_from_search' => false,\n 'publicly_queryable' => true,\n 'capability_type' => 'page',\n );\n \n $componentArgs = array(\n 'label' => __( 'components'),\n 'description' => __( 'Things used in projects'),\n 'labels' => $componentLabels,\n 'supports' => array( 'title', 'editor', 'excerpt', 'author', 'thumbnail', 'comments', 'revisions', 'custom-fields'),\n 'taxonomies' => array('components'),\n 'hierarchical' => false,\n 'public' => true,\n 'show_ui' => true,\n 'show_in_menu' => true,\n 'show_in_nav_menus' => true,\n 'show_in_admin_bar' => true,\n 'menu_position' => 7,\n 'can_export' => true,\n 'has_archive' => true,\n 'exclude_from_search' => false,\n 'publicly_queryable' => true,\n 'capability_type' => 'page',\n );\n \n $componentTypeTaxArgs = array(\n 'hierarchical' => false,\n 'labels' => $componentTypeTaxLabels,\n 'show_ui' => true,\n 'show_admin_column' => true,\n 'update_count_callback' => '_update_post_term_count',\n 'query_var' => true,\n 'rewrite' => array( 'slug' => 'type' ),\n );\n \n // Registering your Custom Post Type\n register_taxonomy('component_type', 'component', $componentTypeTaxArgs);\n register_post_type('component', $componentArgs);\n register_post_type( 'project', $projectArgs );\n }", "public function register_post_type()\n\t{\n\n\t\tregister_taxonomy( $this->post_type_name . '_words', $this->post_type_name, array(\n\t\t\t'label' => 'Words',\n\t\t\t'labels' => array(\n\t\t\t\t'singular_name' => 'Word',\n\t\t\t\t'menu_name' => 'Words',\n\t\t\t\t'all_items' => 'All words',\n\t\t\t\t'edit_item' => 'Edit word',\n\t\t\t\t'view_item' => 'View word',\n\t\t\t\t'update_item' => 'View word',\n\t\t\t\t'add_new_item' => 'Add word',\n\t\t\t\t'new_item_name' => 'New word',\n\t\t\t\t'search_items' => 'Search words',\n\t\t\t\t'popular_items' => 'Popular words',\n\t\t\t\t'separate_items_with_commas' => 'Separate words with commas',\n\t\t\t\t'add_or_remove_items' => 'Add or remove words',\n\t\t\t\t'choose_from_most_used' => 'Choose from most used words',\n\t\t\t\t'not_found' => 'No words found',\n\t\t\t),\n\t\t\t'show_ui' => FALSE,\n\t\t\t'show_admin_column' => FALSE,\n\t\t\t'query_var' => TRUE,\n\t\t\t'rewrite' => array(\n\t\t\t\t'slug' => 'word',\n\t\t\t\t'with_front' => FALSE,\n\t\t\t),\n\t\t));\n\n\t\tregister_taxonomy( $this->post_type_name . '_partsofspeech', $this->post_type_name, array(\n\t\t\t'label' => 'Parts of Speech',\n\t\t\t'labels' => array(\n\t\t\t\t'singular_name' => 'Part of Speech',\n\t\t\t\t'menu_name' => 'Parts of Speech',\n\t\t\t\t'all_items' => 'All parts of speech',\n\t\t\t\t'edit_item' => 'Edit part of speech',\n\t\t\t\t'view_item' => 'View part of speech',\n\t\t\t\t'update_item' => 'View part of speech',\n\t\t\t\t'add_new_item' => 'Add part of speech',\n\t\t\t\t'new_item_name' => 'New part of speech',\n\t\t\t\t'search_items' => 'Search parts of speech',\n\t\t\t\t'popular_items' => 'Popular parts of speech',\n\t\t\t\t'separate_items_with_commas' => 'Separate parts of speech with commas',\n\t\t\t\t'add_or_remove_items' => 'Add or remove parts of speech',\n\t\t\t\t'choose_from_most_used' => 'Choose from most used parts of speech',\n\t\t\t\t'not_found' => 'No parts of speech found',\n\t\t\t),\n\t\t\t'show_ui' => FALSE,\n\t\t\t'show_admin_column' => TRUE,\n\t\t\t'query_var' => TRUE,\n\t\t\t'rewrite' => array(\n\t\t\t\t'slug' => 'partofspeech',\n\t\t\t\t'with_front' => FALSE,\n\t\t\t),\n\t\t));\n\n\t\t// register the damn post type already\n\t\tregister_post_type( \n\t\t\t$this->post_type_name,\n\t\t\tarray(\n\t\t\t\t'labels' => array(\n\t\t\t\t\t'name' => 'Definitions',\n\t\t\t\t\t'singular_name' => 'Definition',\n\t\t\t\t\t'add_new' => 'Add New',\n\t\t\t\t\t'add_new_item' => 'Add New Definition',\n\t\t\t\t\t'edit_item' => 'Edit Definition',\n\t\t\t\t\t'new_item' => 'New Definition',\n\t\t\t\t\t'all_items' => 'All Definitions',\n\t\t\t\t\t'view_item' => 'View Definitions',\n\t\t\t\t\t'search_items' => 'Search Definitions',\n\t\t\t\t\t'not_found' => 'No definitions found',\n\t\t\t\t\t'not_found_in_trash' => 'No definitions found in Trash',\n\t\t\t\t\t'parent_item_colon' => '',\n\t\t\t\t\t'menu_name' => 'Definitions',\n\t\t\t\t),\n\t\t\t\t'supports' => array(\n\t\t\t\t\t'title',\n\t\t\t\t\t'editor',\n\t\t\t\t\t'thumbnail',\n\t\t\t\t\t'trackbacks',\n\t\t\t\t\t'comments',\n\t\t\t\t\t'revisions',\n\t\t\t\t),\n\t\t\t\t'public' => TRUE,\n\t\t\t\t'has_archive' => 'definitions',\n\t\t\t\t'rewrite' => array(\n\t\t\t\t\t'slug' => 'define',\n\t\t\t\t\t'with_front' => FALSE,\n\t\t\t\t),\n\t\t\t\t'register_meta_box_cb' => array( $this, 'metaboxes' ),\n\t\t\t\t'public' => TRUE,\n\t\t\t\t'taxonomies' => array(\n\t\t\t\t\t$this->post_type_name . '_partsofspeech',\n\t\t\t\t\t$this->post_type_name . '_words',\n\t\t\t\t),\n\t\t\t\t'menu_position' => 5,\n\t\t\t)\n\t\t);\n\t}", "function BH_register_posttypes() {\r\n\r\n\tBH_register_posttype_event();\r\n\tBH_register_posttype_gallery();\r\n\r\n}", "public function createPostTypes()\n {\n }", "function register_content_type( $singular, $plural, $type, $ns = 'theme' )\n{\n // Hook into the 'init' action\n add_action( 'init', function() use ( $singular, $plural, $type, $ns ) {\n\n $labels = [\n 'name' => _x( $plural, 'Post Type General Name', $ns ),\n 'singular_name' => _x( $singular, 'Post Type Singular Name', $ns ),\n 'menu_name' => __( $plural, $ns ),\n 'parent_item_colon' => __( 'Parent ' . $singular . ':', $ns ),\n 'all_items' => __( 'All ' . $plural, $ns ),\n 'view_item' => __( 'View ' . $singular, $ns ),\n 'add_new_item' => __( 'Add New ' . $singular, $ns ),\n 'add_new' => __( 'Add New', $ns ),\n 'edit_item' => __( 'Edit ' . $singular, $ns ),\n 'update_item' => __( 'Update ' . $singular, $ns ),\n 'search_items' => __( 'Search ' . $plural, $ns ),\n 'not_found' => __( 'Not found', $ns ),\n 'not_found_in_trash' => __( 'Not found in Trash', $ns ),\n ];\n $args = [\n 'label' => __( $singular, $ns ),\n 'description' => __( $plural, $ns ),\n 'labels' => $labels,\n 'supports' => [ 'title', 'editor', 'custom-fields', 'thumbnail' ],\n 'taxonomies' => [ 'category', 'post_tag' ],\n 'hierarchical' => false,\n 'public' => true,\n 'show_ui' => true,\n 'show_in_nav_menus' => true,\n 'show_in_admin_bar' => true,\n 'menu_position' => 5,\n 'can_export' => true,\n 'has_archive' => true,\n 'exclude_from_search' => false,\n 'publicly_queryable' => true,\n 'capability_type' => 'page',\n ];\n register_post_type( $type, $args );\n\n }, 0 );\n}", "protected function addPostType()\n {\n WordPress::registerType('lbwp-nl', 'Newsletter', 'Newsletter', array(\n 'show_in_menu' => 'newsletter',\n 'publicly_queryable' => false,\n 'exclude_from_search' => true,\n 'supports' => array('title')\n ), 'n');\n }", "function register_type( $post_type_singular, $post_type_plural, $options = array() ) {\n\n\t$text_domain = 'sgdf';\n\n\t$labels = array(\n\t\t'name' => _x( ucwords( $post_type_plural ), 'post type general name', $text_domain ),\n\t\t'singular_name' => _x( ucwords( $post_type_singular ), 'post type singular name', $text_domain ),\n\t\t'menu_name' => _x( ucwords( $post_type_plural ), 'admin menu', $text_domain ),\n\t\t'name_admin_bar' => _x( ucwords( $post_type_singular ), 'add new on admin bar', $text_domain ),\n\t\t'add_new' => _x( 'Add New', 'book', $text_domain ),\n\t\t'add_new_item' => __( 'Add New ' . ucwords( $post_type_singular ), $text_domain ),\n\t\t'new_item' => __( 'New ' . ucwords( $post_type_singular ), $text_domain ),\n\t\t'edit_item' => __( 'Edit ' . ucwords( $post_type_singular ), $text_domain ),\n\t\t'view_item' => __( 'View ' . ucwords( $post_type_singular ), $text_domain ),\n\t\t'all_items' => __( 'All ' . ucwords( $post_type_plural ), $text_domain ),\n\t\t'search_items' => __( 'Search ' . ucwords( $post_type_plural ), $text_domain ),\n\t\t'parent_item_colon' => __( 'Parent ' . ucwords( $post_type_plural ) . ':', $text_domain ),\n\t\t'not_found' => __( 'No ' . $post_type_plural . ' found.', $text_domain ),\n\t\t'not_found_in_trash' => __( 'No ' . $post_type_plural . ' found in Trash.', $text_domain )\n\t);\n\n\t$args = array(\n\t\t'labels' => $labels,\n\t\t'public' => true,\n\t\t'publicly_queryable' => true,\n\t\t'show_ui' => true,\n\t\t'show_in_menu' => true,\n\t\t'query_var' => true,\n\t\t'rewrite' => array( 'slug' => $post_type_singular ),\n\t\t'capability_type' => 'post',\n\t\t'has_archive' => true,\n\t\t'hierarchical' => false,\n\t\t'menu_position' => null,\n\t\t'menu_icon' \t => null,\n\t\t'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments' )\n\t);\n\n\tforeach ($options as $key => $option) {\n\t\t$args[$key] = $option;\n\t}\n\n\treturn register_post_type( $post_type_singular, $args );\n}", "public function register() {\r\n add_action('post_updated', array($this, 'save_meta'), null, 2 );\r\n\r\n $original_config = $this->get_config();\r\n // push it through a filter so a theme can change the terminology\r\n $filtered_config = apply_filters('ah-wp-dl-res-config',$original_config);\r\n register_post_type(self::POST_TYPE, $filtered_config);\r\n\r\n register_taxonomy(self::POST_TYPE . '_cat',\r\n array(self::POST_TYPE),\r\n array('hierarchical' => true,\r\n 'labels' => array(\r\n 'name' => __( 'Categories' ),\r\n 'singular_name' => __( 'Category' ),\r\n 'search_items' => __( 'Search Categories' ),\r\n 'all_items' => __( 'All Categories' ),\r\n 'parent_item' => __( 'Parent Category' ),\r\n 'parent_item_colon' => __( 'Parent Category:' ),\r\n 'edit_item' => __( 'Edit Category' ),\r\n 'update_item' => __( 'Update Category' ),\r\n 'add_new_item' => __( 'Add New Category' ),\r\n 'new_item_name' => __( 'New Category Name')\r\n ),\r\n 'show_ui' => true,\r\n 'query_var' => true,\r\n 'rewrite' => array( 'slug' => 'documents/categories' ),\r\n )\r\n );\r\n }", "function stock_toolkit_custom_post()\n\t{\n\tregister_post_type('slide', array(\n\t\t'labels' => array(\n\t\t\t'name' => __('Slides') ,\n\t\t\t'singular_name' => __('Slide')\n\t\t) ,\n\t\t'supports' => array(\n\t\t\t'title',\n\t\t\t'editor',\n\t\t\t'custom-fields',\n\t\t\t'thumbnail',\n\t\t\t'page-attributes'\n\t\t) ,\n\t\t'public' => false,\n\t\t'show_ui' => true\n\t));\n\t}", "function testimonials_register_post_type() {\n\n $labels = [\n 'name' => __('Testimonials'),\n 'singular_name' => __('Testimonial'),\n 'add_new' => __('Add new', 'Testimonials'),\n 'add_new_item' => __('Add new Testimonial'),\n 'edit_item' => __('Edit Testimonial'),\n 'new_item' => __('New Testimonial'),\n 'view_item' => __('View Testimonial'),\n 'search_item' => __('Search Testimonials'),\n 'not_found' => __('No Testimonial found'),\n 'not_found_in_trash' => __('No Testimonial found in trash'),\n 'parent_item_colon' => ''\n ];\n\n register_post_type(TESTIMONIAL_TYPE, [\n 'labels' => $labels,\n 'public' => true,\n 'exclude_from_search' => true,\n 'has_archive' => true,\n 'hierarchical' => false,\n 'supports' => ['title', 'editor', 'custom-fields']\n ]);\n\n register_taxonomy_for_object_type(CRAFT_TAX_NAME, TESTIMONIAL_TYPE);\n}", "public function post_type() {\n\t\t$labels = array(\n\t\t\t'name' => __( 'Departamentos'),\n\t\t\t'singular_name' => __( 'Departamento' ),\n\t\t\t'add_new' => __('Añadir nuevo'),\n\t\t\t'add_new_item' => __('Añadir nuevo Departamento'),\n\t\t\t'edit_item' => __('Editar Departamento'),\n\t\t\t'new_item' => __('Nuevo Departamento'),\n\t\t\t'view_item' => __('Ver Departamento'),\n\t\t\t'search_items' => __('Buscar'),\n\t\t\t'not_found' => __('No se encontraron Departamentos'),\n\t\t\t'not_found_in_trash' => __('No se encontraron Departamentos en la Papelera'), \n\t\t\t'parent_item_colon' => ''\n\t\t );\n\t\t \n\t\t $args = array(\n\t\t\t'labels' => $labels,\n\t\t\t'public' => true,\n\t\t\t'publicly_queryable' => true,\n\t\t\t'show_ui' => true, \n\t\t\t'query_var' => true,\n\t 'has_archive' => true,\n\t\t\t'capability_type' => 'post',\n\t\t\t'hierarchical' => true,\n\t\t 'show_ui' => true,\n\t\t\t'show_in_nav_menus' => true,\n\t\t 'show_in_menu' => 'bn_config',\n\t\t\t'menu_position' => 57,\n\t\t\t'menu_icon' => 'dashicons-clipboard',\n\t\t\t'rewrite' => array('slug' => __( $this->post_type )),\n\t\t\t'supports' => array('title', 'excerpt', 'page-attributes') //,'editor'\n\t\t );\n\t\t \n\t\t register_post_type(__( $this->post_type ), $args);\n\t}", "public function register_location_content_type(){\n\t\t //Labels for post type\n\t\t $labels = array(\n 'name' => 'Add Portfolio',\n 'singular_name' => 'Portfolio',\n 'menu_name' => 'Add Portfolio',\n 'name_admin_bar' => 'Add Portfolio',\n 'add_new' => 'Add New', \n 'add_new_item' => 'Add New Portfolio Item',\n 'new_item' => 'New Portfolio Item', \n 'edit_item' => 'Edit Portfolio Item',\n 'view_item' => 'View Portfolio Item',\n 'all_items' => 'All Portfolio Items',\n 'search_items' => 'Search Portfolio Items',\n 'parent_item_colon' => 'Parent Portfolio Item: ', \n 'not_found' => 'No Portfolio Items found.', \n 'not_found_in_trash' => 'No Portfolio Items found in Trash.',\n );\n //arguments for post type\n $args = array(\n 'labels' => $labels,\n 'public' => true,\n 'publicly_queryable'=> true,\n 'show_ui' => true,\n 'show_in_nav' => true,\n 'query_var' => true,\n 'hierarchical' => false,\n 'supports' => array('title','thumbnail','editor'),\n 'has_archive' => true,\n 'menu_position' => 20,\n 'show_in_admin_bar' => true,\n 'menu_icon' => 'dashicons-location-alt',\n 'rewrite'\t\t\t=> array('slug' => 'locations', 'with_front' => 'true')\n );\n //register post type\n register_post_type('wp_locations', $args);\n\t}", "function custom_post_type() {\n\n// Set UI labels for Custom Post Type\n\t$labels = array(\n\t\t'name' => _x( 'Новости', 'Новости сайта', 'p1atform' ),\n\t\t'singular_name' => _x( 'Новость', 'Post Type Singular Name', 'p1atform' ),\n\t\t'menu_name' => __( 'Новости', 'p1atform' ),\n\t\t'parent_item_colon' => __( 'Parent Новость', 'p1atform' ),\n\t\t'all_items' => __( 'Все новости', 'p1atform' ),\n\t\t'view_item' => __( 'Просмотреть новость', 'p1atform' ),\n\t\t'add_new_item' => __( 'Добавить новость', 'p1atform' ),\n\t\t'add_new' => __( 'Добавить новость', 'p1atform' ),\n\t\t'edit_item' => __( 'Редактировать новость', 'p1atform' ),\n\t\t'update_item' => __( 'Обновить новость', 'p1atform' ),\n\t\t'search_items' => __( 'Поиск новости', 'p1atform' ),\n\t);\n\n\t$args = array(\n\t\t'label' => __( 'Отзывы', 'p1atform' ),\n\t\t'description' => __( 'Отзывы', 'p1atform' ),\n\t\t'labels' => $labels,\n\t\t'supports' => array(\n\t\t\t'title',\n\t\t\t'editor',\n\t\t\t'excerpt',\n\t\t\t'author',\n\t\t\t'thumbnail',\n\t\t\t'comments',\n\t\t\t'revisions',\n\t\t\t'custom-fields'\n\t\t),\n\t\t'hierarchical' => false,\n\t\t'public' => true,\n\t\t'show_ui' => true,\n\t\t'show_in_menu' => true,\n\t\t'show_in_nav_menus' => true,\n\t\t'show_in_admin_bar' => true,\n\t\t'menu_position' => 5,\n\t\t'menu_icon' => 'dashicons-format-aside',\n\t\t'can_export' => true,\n\t\t'has_archive' => true,\n\t\t'exclude_from_search' => false,\n\t\t'publicly_queryable' => true,\n\t\t'capability_type' => 'post',\n\t);\n\n\tregister_post_type( 'news', $args );\n\n\t$labels = array(\n\t\t'name' => _x( 'Клиенты', 'Новости сайта', 'p1atform' ),\n\t\t'singular_name' => _x( 'Клиент', 'Post Type Singular Name', 'p1atform' ),\n\t\t'menu_name' => __( 'Клиенты', 'p1atform' ),\n\t\t'parent_item_colon' => __( 'Парент Клиент', 'p1atform' ),\n\t\t'all_items' => __( 'Все клиенты', 'p1atform' ),\n\t\t'view_item' => __( 'Просмотреть клиента', 'p1atform' ),\n\t\t'add_new_item' => __( 'Добавить клиента', 'p1atform' ),\n\t\t'add_new' => __( 'Добавить клиента', 'p1atform' ),\n\t\t'edit_item' => __( 'Редактировать клиента', 'p1atform' ),\n\t\t'update_item' => __( 'Обновить клиента', 'p1atform' ),\n\t\t'search_items' => __( 'Поиск клиента', 'p1atform' ),\n\t);\n\n\t$args = array(\n\t\t'labels' => $labels,\n\t\t'supports' => array(\n\t\t\t'title',\n\t\t\t'editor',\n\t\t\t'excerpt',\n\t\t\t'author',\n\t\t\t'thumbnail',\n\t\t\t'comments',\n\t\t\t'revisions',\n\t\t\t'custom-fields',\n\t\t),\n\t\t'hierarchical' => false,\n\t\t'public' => true,\n\t\t'show_ui' => true,\n\t\t'show_in_menu' => true,\n\t\t'show_in_nav_menus' => true,\n\t\t'show_in_admin_bar' => true,\n\t\t'menu_position' => 6,\n\t\t'menu_icon' => 'dashicons-admin-users',\n\t\t'can_export' => true,\n\t\t'has_archive' => true,\n\t\t'exclude_from_search' => false,\n\t\t'publicly_queryable' => true,\n\t\t'capability_type' => 'post',\n\t);\n\n\tregister_post_type( 'clients', $args );\n\n\tregister_post_type( 'reviews', array(\n\t\t'labels' => array(\n\t\t\t'name' => 'Отзывы', // Основное название типа записи\n\t\t\t'singular_name' => 'Отзыв', // отдельное название записи типа Book\n\t\t\t'add_new' => 'Добавить Отзыв',\n\t\t\t'add_new_item' => 'Добавить Отзыв',\n\t\t\t'edit_item' => 'Редактировать Отзыв',\n\t\t\t'new_item' => 'Новая Отзыв',\n\t\t\t'view_item' => 'Посмотреть Отзыв',\n\t\t\t'search_items' => 'Найти Отзыв',\n\t\t\t'not_found' => 'Книг не найдено',\n\t\t\t'not_found_in_trash' => 'В корзине книг не найдено',\n\t\t\t'parent_item_colon' => '',\n\t\t\t'menu_name' => 'Отзывы'\n\n\t\t),\n\t\t'public' => true,\n\t\t'publicly_queryable' => true,\n\t\t'show_ui' => true,\n\t\t'show_in_menu' => true,\n\t\t'query_var' => true,\n\t\t'rewrite' => true,\n\t\t'capability_type' => 'post',\n\t\t'has_archive' => true,\n\t\t'menu_position' => 5,\n\t\t'menu_icon' => 'dashicons-format-chat',\n\t\t'hierarchical' => false,\n\t\t'menu_position' => null,\n\t\t'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments' )\n\t) );\n\n}", "function humcore_register_post_type() {\n\n\t// Define the labels to be used by the post type humcore_deposits.\n\t$labels = array(\n\t\t// 'name' => _x( 'HumCORE Deposits', 'post type general name', 'humcore_domain' ),\n\t\t'singular_name' => _x( 'Deposit', 'post type singular name', 'humcore_domain' ),\n\t\t'menu_name' => _x( 'HumCORE Deposits', 'admin menu', 'humcore_domain' ),\n\t\t'name_admin_bar' => _x( 'Deposit', 'add new on admin bar', 'humcore_domain' ),\n\t\t'add_new' => _x( 'Add New', 'add new', 'humcore_domain' ),\n\t\t'add_new_item' => __( 'Add New Deposits', 'humcore_domain' ),\n\t\t'new_item' => __( 'New Deposit', 'humcore_domain' ),\n\t\t'edit_item' => __( 'Edit Deposit', 'humcore_domain' ),\n\t\t'view_item' => __( 'View Deposit', 'humcore_domain' ),\n\t\t'all_items' => __( 'All Deposits', 'humcore_domain' ),\n\t\t'search_items' => __( 'Search Deposits', 'humcore_domain' ),\n\t\t'not_found' => __( 'No Deposits found', 'humcore_domain' ),\n\t\t'not_found_in_trash' => __( 'No Deposits found in Trash', 'humcore_domain' ),\n\t\t'parent_item_colon' => '',\n\t);\n\n\t$post_type_args = array(\n\t\t'label' => __( 'HumCORE Deposits', 'humcore_domain' ),\n\t\t'labels' => $labels,\n\t\t'public' => false,\n\t\t'show_ui' => true,\n\t\t'show_in_menu' => true,\n\t\t'show_in_admin_bar' => false,\n\t\t'query_var' => false,\n\t\t'rewrite' => array(\n\t\t\t'slug' => 'humcore_deposit',\n\t\t\t'with_front' => true,\n\t\t),\n\t\t'capability_type' => 'post',\n\t\t'has_archive' => false,\n\t\t'hierarchical' => true,\n\t\t'menu_position' => null,\n\t\t'supports' => array( 'title', 'author', 'excerpt' ),\n\t\t// 'supports' => array( 'title', 'author', 'excerpt', 'custom-fields', revisions', 'page-attributes' ),\n\t\t'register_meta_box_cb' => 'humcore_add_post_type_metabox',\n\t);\n\n\tregister_post_type( 'humcore_deposit', $post_type_args );\n}", "public static function register_type() {\n\n\t\tregister_graphql_enum_type(\n\t\t\t'ContentNodeIdTypeEnum',\n\t\t\t[\n\t\t\t\t'description' => __( 'The Type of Identifier used to fetch a single resource. Default is ID.', 'wp-graphql' ),\n\t\t\t\t'values' => self::get_values(),\n\t\t\t]\n\t\t);\n\n\t\t$allowed_post_types = \\WPGraphQL::get_allowed_post_types();\n\t\tif ( ! empty( $allowed_post_types ) && is_array( $allowed_post_types ) ) {\n\t\t\tforeach ( $allowed_post_types as $post_type ) {\n\t\t\t\t$post_type_object = get_post_type_object( $post_type );\n\n\t\t\t\tif ( empty( $post_type_object ) ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t$values = self::get_values();\n\t\t\t\tif ( ! $post_type_object->hierarchical ) {\n\t\t\t\t\t$values['slug'] = [\n\t\t\t\t\t\t'name' => 'SLUG',\n\t\t\t\t\t\t'value' => 'slug',\n\t\t\t\t\t\t'description' => __( 'Identify a resource by the slug. Available to non-hierarchcial Types where the slug is a unique identifier.', 'wp-graphql' ),\n\t\t\t\t\t];\n\t\t\t\t}\n\n\t\t\t\tif ( 'attachment' === $post_type_object->name ) {\n\t\t\t\t\t$values['source_url'] = [\n\t\t\t\t\t\t'name' => 'SOURCE_URL',\n\t\t\t\t\t\t'value' => 'source_url',\n\t\t\t\t\t\t'description' => __( 'Identify a media item by its source url', 'wp-graphql' ),\n\t\t\t\t\t];\n\t\t\t\t}\n\n\t\t\t\t/**\n\t\t\t\t * Register a unique Enum per Post Type. This allows for granular control\n\t\t\t\t * over filtering and customizing the values available per Post Type.\n\t\t\t\t */\n\t\t\t\tregister_graphql_enum_type(\n\t\t\t\t\t$post_type_object->graphql_single_name . 'IdType',\n\t\t\t\t\t[\n\t\t\t\t\t\t'description' => __( 'The Type of Identifier used to fetch a single resource. Default is ID.', 'wp-graphql' ),\n\t\t\t\t\t\t'values' => $values,\n\t\t\t\t\t]\n\t\t\t\t);\n\n\t\t\t}\n\t\t}\n\n\t}", "public function registerPostTypes()\n {\n // Get the post types from the config.\n $postTypes = config('post-types');\n\n $translater = new Translater($postTypes, 'post-types');\n $postTypes = $translater->translate([\n '*.label',\n '*.labels.*',\n '*.names.singular',\n '*.names.plural',\n ]);\n\n // Iterate over each post type.\n collect($postTypes)->each(function ($item, $key) {\n\n // Check if names are set, if not keep it as an empty array\n $names = $item['names'] ?? [];\n\n // Unset names from item\n unset($item['names']);\n\n // Register the extended post type.\n register_extended_post_type($key, $item, $names);\n });\n }", "function rawlins_register_post_types() {\n\t$rawlins_magic_post_type_maker_array = array(\n\t\t/*array(\n\t\t\t'cpt_single' => 'Resource',\n\t\t\t'cpt_plural' => 'Resources',\n\t\t\t'slug' => 'resource',\n\t\t\t'cpt_icon' => 'dashicons-index-card',\n\t\t\t'exclude_from_search' => false,\n\t\t),*/\n\n\t);\n\n\tforeach( $rawlins_magic_post_type_maker_array as $post_type ){\n\t\t$cpt_single = $post_type['cpt_single'];\n\t\t$cpt_plural = $post_type['cpt_plural'];\n\t\t$slug = $post_type['slug'];\n\t\t$cpt_icon = $post_type['cpt_icon'];\n\t\t$exclude_from_search = $post_type['exclude_from_search'];\n\n\t\t// Admin Labels\n\t \t$labels = rawlins_generate_label_array($cpt_plural, $cpt_single);\n\n\t \t// Arguments\n\t\t$args = rawlins_generate_post_type_args($labels, $cpt_plural, $cpt_icon, $exclude_from_search);\n\n\t\t// Just do it\n\t\tregister_post_type( $slug, $args );\n\t}\n\n}", "function rng_create_post_type() {\n\n\t$labels = array(\n\t\t'name' => _x( 'Post Types Plural', 'Post Type General Name', 'translate_name' ),\n\t\t'singular_name' => _x( 'Post Type Singular', 'Post Type Singular Name', 'translate_name' ),\n\t\t'menu_name' => __( 'Post Types', 'translate_name' ),\n\t\t'name_admin_bar' => __( 'Post Type', 'translate_name' ),\n\t\t'archives' => __( 'Item Archives', 'translate_name' ),\n\t\t'attributes' => __( 'Item Attributes', 'translate_name' ),\n\t\t'parent_item_colon' => __( 'Parent Item:', 'translate_name' ),\n\t\t'all_items' => __( 'All Items', 'translate_name' ),\n\t\t'add_new_item' => __( 'Add New Item', 'translate_name' ),\n\t\t'add_new' => __( 'Add New', 'translate_name' ),\n\t\t'new_item' => __( 'New Item', 'translate_name' ),\n\t\t'edit_item' => __( 'Edit Item', 'translate_name' ),\n\t\t'update_item' => __( 'Update Item', 'translate_name' ),\n\t\t'view_item' => __( 'View Item', 'translate_name' ),\n\t\t'view_items' => __( 'View Items', 'translate_name' ),\n\t\t'search_items' => __( 'Search Item', 'translate_name' ),\n\t\t'not_found' => __( 'Not found', 'translate_name' ),\n\t\t'not_found_in_trash' => __( 'Not found in Trash', 'translate_name' ),\n\t\t'featured_image' => __( 'Featured Image', 'translate_name' ),\n\t\t'set_featured_image' => __( 'Set featured image', 'translate_name' ),\n\t\t'remove_featured_image' => __( 'Remove featured image', 'translate_name' ),\n\t\t'use_featured_image' => __( 'Use as featured image', 'translate_name' ),\n\t\t'insert_into_item' => __( 'Insert into item', 'translate_name' ),\n\t\t'uploaded_to_this_item' => __( 'Uploaded to this item', 'translate_name' ),\n\t\t'items_list' => __( 'Items list', 'translate_name' ),\n\t\t'items_list_navigation' => __( 'Items list navigation', 'translate_name' ),\n\t\t'filter_items_list' => __( 'Filter items list', 'translate_name' ),\n\t);\n\t$args = array(\n 'public' => true,\n\t\t'label' => __( 'Post Type Singular', 'translate_name' ),\n\t\t'description' => __( 'Post Type Description', 'translate_name' ),\n 'labels' => $labels,\n 'exclude_from_search' => true,\n 'publicly_queryable' => true,\n 'show_ui' => true,\n\t\t'show_in_nav_menus' => true,\n\t\t'show_in_menu'\t\t\t=> true,\n\t\t'show_in_admin_bar'\t\t=> true,\n\t\t'menu_position'\t\t\t=> 5,\n\t\t// 'menu_icon' \t\t\t=> get_bloginfo('template_directory') . '/images/portfolio-icon.png',\n\t\t'menu_icon'\t\t\t\t=> 'dashicon-groups',\n\t\t'has_archive'\t\t\t=> true,\n\t\t'capability_type'\t\t=> array('book','books'),\n\t\t'capabilities' \t\t\t=> array(\n\t\t\t'edit_post' => 'edit_book', \n\t\t\t'read_post' => 'read_book', \n\t\t\t'delete_post' => 'delete_book', \n\t\t\t'edit_posts' => 'edit_books', \n\t\t\t'edit_others_posts' => 'edit_others_books', \n\t\t\t'publish_posts' => 'publish_books', \n\t\t\t'read_private_posts' => 'read_private_books', \n\t\t\t'create_posts' => 'edit_books', \n\t\t),\n\t\t'supports' => array( 'title', 'editor', 'thumbnail', 'page-attributes', 'post-formats' ),\n\t\t'taxonomies' => array( 'category', 'post_tag' ),\n\t\t'hierarchical' => true,\n\t);\n\tregister_post_type( 'book', $args );\n\n}", "function create_custom_post_types(){\n\t/**\n\t * Arguments for company labels\n\t */\n\t$args_labels_company = array(\n\t\t'name' => __('Companies', 'threedee-expo'),\n\t\t'singular_name' => __('Company', 'threedee-expo'),\n\t\t'add_new_item' => __('Add New Company', 'threedee-expo'),\n\t\t'edit_item' => __('Edit Company', 'threedee-expo'),\n\t\t'new_item' => __('New Company', 'threedee-expo'),\n\t\t'view_item' => __('View Company', 'threedee-expo'),\n\t\t'search_items' => __('Search Companies', 'threedee-expo'),\n\t\t'not_found' => __('No companies found', 'threedee-expo'),\n\t\t'not_found_in_trash'=> __('No companies found in Trash', 'threedee-expo'),\n\t\t'all_items' => __('All Companies', 'threedee-expo'),\n\t\t'archives' => __('Company Archives', 'threedee-expo'),\n\t);\n\t/**\n\t * Arguments for company capabilities\n\t */\n\t$args_capabilities_company = array(\n\t\t'publish_posts' => 'publish_companies',\n\t\t'edit_posts' => 'edit_companies',\n\t\t'edit_others_posts' => 'edit_others_companies',\n\t\t'delete_posts' => 'delete_companies',\n\t\t'delete_others_posts' => 'delete_others_companies',\n\t\t'read_private_posts' => 'read_private_companies',\n\t\t'edit_post' => 'edit_company',\n\t\t'delete_post' => 'delete_company',\n\t\t'read_post' => 'read_company',\n\t);\n\t/**\n\t * Arguments for register companies\n\t */\n\t$args_company = array(\n\t\t'labels' => $args_labels_company,\n\t\t'description' => 'Companies.',\n\t\t'public' => true,\n\t\t'has_archive' => true,\n\t\t'rewrite'\t => array('slug' => 'company'),\n\t\t'menu_icon' => 'dashicons-businessman',\n\t\t'capability_type' => 'companies',\n\t\t'capabilities' => $args_capabilities_company,\n\t\t'map_meta_cap' => true,\n\t\t'supports' => array('author','title')\n\t);\n\t/**\n\t * Arguments for company labels\n\t */\n\t$args_labels_group_of_companies = array(\n\t\t'name' => __('Group of Companies', 'threedee-expo'),\n\t\t'singular_name' => __('Group of Company', 'threedee-expo'),\n\t\t'add_new_item' => __('Add New Group of Companies', 'threedee-expo'),\n\t\t'edit_item' => __('Edit Group of Companies', 'threedee-expo'),\n\t\t'new_item' => __('New Group of Companies', 'threedee-expo'),\n\t\t'view_item' => __('View Group of Companies', 'threedee-expo'),\n\t\t'search_items' => __('Search Group of Companies', 'threedee-expo'),\n\t\t'not_found' => __('No Group of Companies found', 'threedee-expo'),\n\t\t'not_found_in_trash'=> __('No Group of Companies found in Trash', 'threedee-expo'),\n\t\t'all_items' => __('All Group of Companies', 'threedee-expo'),\n\t\t'archives' => __('Group of Companies Archives', 'threedee-expo'),\n\t);\n\t/**\n\t * Arguments for company capabilities\n\t */\n\t$args_capabilities_group_of_companies = array(\n\t\t'publish_posts' => 'publish_group_of_companies',\n\t\t'edit_posts' => 'edit_group_of_companies',\n\t\t'edit_others_posts' => 'edit_others_group_of_companies',\n\t\t'delete_posts' => 'delete_group_of_companies',\n\t\t'delete_others_posts' => 'delete_others_group_of_companies',\n\t\t'read_private_posts' => 'read_private_group_of_companies',\n\t\t'edit_post' => 'edit_group_of_company',\n\t\t'delete_post' => 'delete_group_of_company',\n\t\t'read_post' => 'read_group_of_company',\n\t);\n\t/**\n\t * Arguments for register companies\n\t */\n\t$args_group_of_companies = array(\n\t\t'labels' => $args_labels_group_of_companies,\n\t\t'description' => 'Group of Companies.',\n\t\t'public' => true,\n\t\t'has_archive' => true,\n\t\t'rewrite'\t => array('slug' => 'group_of_companies'),\n\t\t'menu_icon' => 'dashicons-groups',\n\t\t'capability_type' => 'group_of_companies',\n\t\t'capabilities' => $args_capabilities_group_of_companies,\n\t\t'map_meta_cap' => true,\n\t\t'supports' => array('author','title')\n\t);\n\tregister_post_type( 'companies', $args_company);\n\tregister_post_type( 'group_of_companies',$args_group_of_companies);\n}", "function news_custom_post() {\n $args = array(\n 'public' => true,\n 'label' => 'News',\n 'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments' ),\n 'show_ui' => true,\n 'publicly_queryable' => true,\n 'taxonomies' => array('category', 'post_tag'),\n 'rewrite' => array( 'slug' => 'news' )\n\t\n );\n register_post_type('news', $args);\n}", "function cadastrando_post_type_clientes() {\n\n $nomeSingular = 'Cliente';\n $nomePlural = 'Clientes';\n $descricao = 'Clientes da minha empresa';\n\n $labels = array(\n 'name' => $nomePlural,\n 'name_singular' => $nomeSingular,\n 'add_new_item' => 'Adicionar novo ' . $nomeSingular,\n 'edit_item' => 'Editar ' . $nomeSingular\n );\n\n $supports = array(\n 'title',\n 'editor',\n 'thumbnail'\n );\n\n $args = array(\n 'labels' => $labels,\n 'description' => $descricao,\n 'public' => true,\n 'menu_icon' => 'dashicons-id-alt',\n 'supports' => $supports\n );\n\n register_post_type( 'cliente', $args);\n}", "function register_fablabs_post_type () {\n\t$labels = array(\n 'name' => _x( 'Fab Labs', 'post type general name', 'additive_tcp' ),\n 'singular_name' => _x( 'Fab Lab', 'post type singular name', 'additive_tcp' ),\n 'menu_name' => _x( 'Fab Labs', 'admin menu', 'additive_tcp' ),\n 'name_admin_bar' => _x( 'Fab Lab', 'add new on admin bar', 'additive_tcp' ),\n 'add_new' => _x( 'Add New', 'fablab', 'additive_tcp' ),\n 'add_new_item' => __( 'Add New Fab Lab', 'additive_tcp' ),\n 'new_item' => __( 'New Fab Lab', 'additive_tcp' ),\n 'edit_item' => __( 'Edit Fab Lab', 'additive_tcp' ),\n 'view_item' => __( 'View Fab Lab', 'additive_tcp' ),\n 'all_items' => __( 'All Fab Labs', 'additive_tcp' ),\n 'search_items' => __( 'Search Fab Labs', 'additive_tcp' ),\n 'parent_item_colon' => __( 'Parent Fab Lab:', 'additive_tcp' ),\n 'not_found' => __( 'No fab labs found.', 'additive_tcp' ),\n 'not_found_in_trash' => __( 'No fab labs found in Trash.', 'additive_tcp' )\n );\n\tregister_post_type('additive_fab_lab', array(\n\t\t'labels' => $labels,\n\t\t'description' => 'Fab Labs which will appear on the Fab Labs page.',\n\t\t'public' => true,\n\t\t'hierarchical' => false,\n\t\t'capability_type' => 'post',\n\t\t'supports' => array('title', 'editor', 'custom-fields', 'thumbnail')\n\t));\n}", "public static function init() {\n\t\tadd_action( 'init', array( __CLASS__, 'register_post_type' ), 1 );\n\t}", "function create_posttype() \n {\n register_post_type( 'mist_employee',\n array(\n 'labels' => array(\n 'name' => __( 'Employees' ),\n 'singular_name' => __( 'Employee' )\n ),\n \n 'public' => true,\n 'has_archive' => true,\n 'rewrite' => array('slug' => 'employees'),\n 'supports' => array('title','editor','thumbnail','excerpt'),\n 'menu_icon' => 'dashicons-businessman'\n )\n );\n register_post_type( 'mist_message',\n array(\n 'labels' => array(\n 'name' => __( 'Person Messages' ),\n 'singular_name' => __( 'Message' ),\n ),\n \n 'public' => true,\n 'has_archive' => true,\n 'rewrite' => array('slug' => 'message'),\n 'supports' => array('title','editor','thumbnail','excerpt'),\n 'menu_icon' => 'dashicons-testimonial'\n )\n );\n add_post_type_support('mist_message', 'excerpt');\n \n }", "function planoType() {\r\n\t$labels = array(\r\n\t\t'name' => _x('Planos', 'post type general name'),\r\n\t 'singular_name' => _x('Plano', 'post type singular name'),\r\n\t 'add_new' => _x('Adicionar Novo', 'slideshow item'),\r\n\t 'add_new_item' => __('Adicionar Novo Plano'),\r\n\t 'edit_item' => __('Editar Plano'),\r\n\t 'new_item' => __('Novo Plano'),\r\n\t 'view_item' => __('Ver Plano'),\r\n\t 'search_items' => __('Procurar Plano'),\r\n\t 'not_found' => __('Nenhum Plano Encontrado'),\r\n\t 'not_found_in_trash' => __('Nenhum Plano na Lixeira'),\r\n\t 'parent_item_colon' => ''\r\n\t);\r\n\r\n $args = array(\r\n 'labels' => $labels,\r\n 'public' => true,\r\n 'publicly_queryable' => true,\r\n 'show_ui' => true,\r\n 'query_var' => true,\r\n 'rewrite' => true,\r\n 'capability_type' => 'post',\r\n 'hierarchical' => false,\r\n 'menu_position' => 4,\r\n 'supports' => array('title','editor'),\r\n 'rewrite' => array('slug' => 'plano')\r\n );\r\n\r\n register_post_type( 'plano' , $args ); # registering the new post type\r\n}", "function products_type() {\n\n $labels = array(\n 'name' => 'Productos',\n 'singular_name' => 'Producto',\n 'menu_name' => 'Productos',\n );\n\n $args = array(\n 'label' => 'Productos',\n 'description' => 'Productos de Platzi',\n 'labels' => $labels,\n 'supports' => array('title', 'editor', 'thumbnail', 'revisions'),\n 'public' => true,\n 'show_in_menu' => true,\n 'menu_position' => 5,\n 'menu_icon' => 'dashicons-cart',\n 'can_export' => true,\n 'publicly' => true,\n 'rewrite' => true,\n 'show_in_rest' => true,\n );\n\n register_post_type('producto', $args);\n}", "function add_my_custom_posttype_smaken(){\n //LABELS DIFINIËREN\n $labels = array(\n 'add_new' => 'Voeg nieuwe smaak toe',\n 'add_new_item' => 'Voeg nieuwe smaak toe',\n 'name' => 'Smaken',\n 'singular_name' => 'Smaak',\n );\n //ARGUMENTEN DIFINIËREN\n $args = array(\n 'labels' => $labels, // de array labels van hier boven linken aan het argument labels\n 'Description' => 'Lactosevrije smaken van B & J',\n 'public' => true,\n 'menu_position' => 4,\n 'menu_icon' => 'dashicons-carrot', //Een icoon kiezen\n 'supports' => array('title', 'editor', 'thumbnail', 'page-attributes'), \n 'has_archive' => true, //Maak een archief aan (opsomming van alle elementen), anders gaan we archive-waarden.php nooit kunnen aanspreken.\n 'show_in_nav_menus' => TRUE,\n );\n register_post_type( 'smaken', $args ); \n }", "private static function register_form_post_type() {\n\t\tif ( post_type_exists( self::$forms_post_type ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\t$post_type_args = apply_filters(\n\t\t\t'wphf_register_post_type_' . self::$forms_post_type,\n\t\t\tarray(\n\t\t\t\t'labels' => array(\n\t\t\t\t\t'name' => __( 'Forms', 'fff-rest-contact-form' ),\n\t\t\t\t\t'singular_name' => __( 'Form', 'fff-rest-contact-form' ),\n\t\t\t\t),\n\t\t\t\t'public' => true,\n\t\t\t\t'supports' => array( 'title' ),\n\t\t\t)\n\t\t);\n\n\t\tregister_post_type( self::$forms_post_type, $post_type_args );\n\t}" ]
[ "0.85713065", "0.8507504", "0.8346772", "0.8311665", "0.8260396", "0.82509744", "0.8213945", "0.8198455", "0.8182247", "0.8178489", "0.8175288", "0.8116956", "0.8096055", "0.8095977", "0.80908006", "0.8090349", "0.80708134", "0.80631447", "0.8057007", "0.804112", "0.80282766", "0.80076975", "0.8003802", "0.8001489", "0.7976903", "0.7976903", "0.7976467", "0.794635", "0.7901641", "0.7810948", "0.7798417", "0.77755654", "0.77747816", "0.7771966", "0.77656025", "0.7754728", "0.77172256", "0.769398", "0.7686712", "0.76841015", "0.76800853", "0.76573", "0.7633265", "0.76286715", "0.76250696", "0.7621496", "0.7616436", "0.7600351", "0.7597508", "0.7552298", "0.7548145", "0.7533635", "0.75291395", "0.7515946", "0.7513173", "0.7506658", "0.75009054", "0.7499127", "0.7484695", "0.7472208", "0.7467623", "0.74574304", "0.74550474", "0.7454685", "0.7451049", "0.7449392", "0.74448353", "0.7439846", "0.7438957", "0.7434441", "0.74327123", "0.7431696", "0.7423696", "0.7419655", "0.74125296", "0.7403553", "0.7400346", "0.73923665", "0.7377957", "0.7354617", "0.73505706", "0.7337408", "0.7315919", "0.73057175", "0.73050237", "0.73009634", "0.72950935", "0.7281986", "0.72763866", "0.7274012", "0.72658783", "0.7265073", "0.7263839", "0.7262491", "0.72480756", "0.7246405", "0.7240788", "0.7238302", "0.72336066", "0.72323775", "0.72236764" ]
0.0
-1
Register Custom Post Type
function rolodex_custom_post_type() { $labels = array( 'name' => _x( 'Rolodexes', 'Post Type General Name', 'text_domain' ), 'singular_name' => _x( 'Rolodex', 'Post Type Singular Name', 'text_domain' ), 'menu_name' => __( 'Rolodexes', 'text_domain' ), 'parent_item_colon' => __( 'Parent Rolodex:', 'text_domain' ), 'all_items' => __( 'All Rolodexes', 'text_domain' ), 'view_item' => __( 'View Rolodex', 'text_domain' ), 'add_new_item' => __( 'Add New Rolodex', 'text_domain' ), 'add_new' => __( 'Add Rolodex', 'text_domain' ), 'edit_item' => __( 'Edit Rolodex', 'text_domain' ), 'update_item' => __( 'Update Rolodex', 'text_domain' ), 'search_items' => __( 'Search Rolodex', 'text_domain' ), 'not_found' => __( 'Not found', 'text_domain' ), 'not_found_in_trash' => __( 'Not found in Trash', 'text_domain' ), ); $args = array( 'label' => __( 'rolodex', 'text_domain' ), 'description' => __( 'Rolodex', 'text_domain' ), 'labels' => $labels, 'taxonomies' => array( 'rolodex_category','rolodex_tags'), 'hierarchical' => false, 'public' => true, 'show_ui' => true, 'show_in_menu' => true, 'show_in_nav_menus' => true, 'show_in_admin_bar' => true, 'menu_position' => 5, 'can_export' => true, 'has_archive' => true, 'exclude_from_search' => false, 'publicly_queryable' => true, 'capability_type' => 'page', ); register_post_type( 'rolodex', $args ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function register_post_type() {\n\t\tadd_action( 'init', array( $this, 'post_registration_callback' ), 0, 0 );\n\t}", "public function registerCustomPostType()\n {\n if (!post_type_exists($this->slug)) {\n register_post_type($this->slug, $this->arguments);\n }\n }", "public function registerCustomPostTypes() {\n\n\n }", "public function flo_reg_custom_post_type(){\n\t\t// call the methods that are registering the post types\n\t\t$this->flo_reg_forms_post_type();\n\t\t$this->flo_reg_entrie_post_type();\n\n\t\t$this->flo_register_form_entries_taxonomy();\n\t}", "public function register_custom_post() {\n foreach ( $this->posts as $key => $value ) {\n register_post_type( $key, $value );\n }\n }", "function wpbm_register_post_type(){\n include('inc/admin/register/wpbm-register-post.php');\n register_post_type( 'WP Blog Manager', $args );\n }", "public function register()\n {\n $args = apply_filters( $this->name.'_post_type_config', $this->config );\n $args['labels'] = apply_filters( $this->name.'_post_type_labels', $this->labels);\n\n register_post_type( $this->name, $args );\n }", "function register_post_types(){\n }", "function register_post_types(){\n }", "public function register_post(): void\n {\n $args = $this->register_post_type_args();\n register_post_type($this->post_type, $args);\n }", "public static function register_post_types() {}", "function register_post_types(){\n\t\t\trequire('lib/custom-types.php');\n\t\t}", "public function register_post_types() {\n\n\t}", "public function register_qmgt_custom_post() {\r\n\t\trequire_once( QMGT_ROOT . '/qmgt-custom-post-type.php');\r\n\t}", "function bf_register_custom_post_type() {\r\n /* Añado las etiquetas que aparecerán en el escritorio de WordPress */\r\n\t$labels = array(\r\n\t\t'name' => _x( 'Ponentes', 'post type general name', 'text-domain' ),\r\n\t\t'singular_name' => _x( 'Ponente', 'post type singular name', 'text-domain' ),\r\n\t\t'menu_name' => _x( 'Ponentes', 'admin menu', 'text-domain' ),\r\n\t\t'add_new' => _x( 'Añadir nuevo', 'ponente', 'text-domain' ),\r\n\t\t'add_new_item' => __( 'Añadir nuevo ponente', 'text-domain' ),\r\n\t\t'new_item' => __( 'Nuevo Ponente', 'text-domain' ),\r\n\t\t'edit_item' => __( 'Editar Ponente', 'text-domain' ),\r\n\t\t'view_item' => __( 'Ver ponente', 'text-domain' ),\r\n\t\t'all_items' => __( 'Todos los ponentes', 'text-domain' ),\r\n\t\t'search_items' => __( 'Buscar ponentes', 'text-domain' ),\r\n\t\t'not_found' => __( 'No hay ponentes.', 'text-domain' ),\r\n\t\t'not_found_in_trash' => __( 'No hay ponentes en la papelera.', 'text-domain' )\r\n\t);\r\n\r\n /* Configuro el comportamiento y funcionalidades del nuevo custom post type */\r\n\t$args = array(\r\n\t\t'labels' => $labels,\r\n\t\t'description' => __( 'Descripción.', 'text-domain' ),\r\n\t\t'public' => true,\r\n\t\t'publicly_queryable' => true,\r\n\t\t'show_ui' => true,\r\n\t\t'show_in_menu' => true,\r\n\t\t'show_in_nav_menus' => true,\r\n\t\t'query_var' => true,\r\n\t\t'rewrite' => array( 'slug' => 'ponente' ),\r\n\t\t'capability_type' => 'post',\r\n\t\t'hierarchical' => false,\r\n\t\t'menu_position' => null,\r\n 'menu_icon' => 'dashicons-businessman',\r\n\t\t'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments' ),\r\n\t\t'show_in_rest'\t \t => true,\r\n\t\t'public' \t\t\t => true,\r\n\t\t'has_archive' \t\t => true,\r\n\t\t'taxonomies' => array('category','categoria-conferencias')\r\n\t);\r\n\r\n\tregister_post_type('ponentes', $args );\r\n}", "public function register_post_type() {\n\t $args = array(\n\t\t\t'public' => true,\n\t\t\t'label' => 'Questions'\n\t\t);\n\t register_post_type( 'questions', $args );\n\t}", "function register_post_types()\n {\n }", "function register_post_types(){\n\t\trequire('lib/custom-types.php');\n\t}", "public function register_post_type()\n {\n $labels = [\n 'name' => _x('Chiro Quizzes', 'post type general name', $this->token),\n 'singular_name' => _x('Chiro Quiz', 'post type singular name', $this->token),\n 'add_new' => _x('Add New', $this->token, $this->token),\n 'add_new_item' => sprintf(__('Add New %s', $this->token), __('Chiro Quiz', $this->token)),\n 'edit_item' => sprintf(__('Edit %s', $this->token), __('Chiro Quiz', $this->token)),\n 'new_item' => sprintf(__('New %s', $this->token), __('Chiro Quiz', $this->token)),\n 'all_items' => sprintf(__('All %s', $this->token), __('Chiro Quizzes', $this->token)),\n 'view_item' => sprintf(__('View %s', $this->token), __('Chiro Quiz', $this->token)),\n 'search_items' => sprintf(__('Search %a', $this->token), __('Chiro Quizzes', $this->token)),\n 'not_found' => sprintf(__('No %s Found', $this->token), __('Chiro Quizzes', $this->token)),\n 'not_found_in_trash' => sprintf(__('No %s Found In Trash', $this->token), __('Chiro Quizzes', $this->token)),\n 'parent_item_colon' => '',\n 'menu_name' => __('Chiro Quizzes', $this->token)\n ];\n\n $slug = __('chiro-quiz', 'pf_chiro_quiz');\n $custom_slug = get_option('pf_chiro_quiz_slug');\n if ($custom_slug && strlen($custom_slug) > 0 && $custom_slug != '') {\n $slug = $custom_slug;\n }\n\n $args = [\n 'labels' => $labels,\n 'public' => true,\n 'publicly_queryable' => true,\n 'exclude_from_search' => true,\n 'show_ui' => true,\n 'show_in_menu' => true,\n 'query_var' => true,\n 'rewrite' => ['slug' => $slug],\n 'capability_type' => 'post',\n 'has_archive' => false,\n 'hierarchical' => false,\n 'supports' => ['title'],\n 'menu_position' => 5,\n 'menu_icon' => 'dashicons-admin-quiz'\n ];\n\n register_post_type($this->token, $args);\n }", "public function register_custom_post_type() {\n $labels = array (\n 'name' => __('Custom', self::$plugin_obj->class_name ),\n 'singular_name' => __('item', self::$plugin_obj->class_name ),\n 'add_new' => __('new item', self::$plugin_obj->class_name ),\n 'add_new_item' => __('new item', self::$plugin_obj->class_name ),\n 'new_item' => __('new item', self::$plugin_obj->class_name ),\n 'edit' => __('edit item', self::$plugin_obj->class_name ),\n 'edit_item' => __('edit item', self::$plugin_obj->class_name ),\n 'view' => __('view item', self::$plugin_obj->class_name ),\n 'view_item' => __('view item', self::$plugin_obj->class_name ),\n 'search_items' => __('search item', self::$plugin_obj->class_name ),\n 'not_found' => __('no item found', self::$plugin_obj->class_name ),\n 'not_found_in_trash' => __('no item in trash', self::$plugin_obj->class_name ),\n 'parent' => __('parent item', self::$plugin_obj->class_name )\n );\n\n $args = array(\n 'labels' => $labels,\n 'public' => TRUE,\n 'publicly_queryable' => TRUE,\n 'show_ui' => TRUE,\n 'show_in_menu' => TRUE,\n 'query_var' => TRUE,\n 'capability_type' => 'page',\n 'has_archive' => TRUE,\n 'hierarchical' => TRUE,\n 'exclude_from_search' => FALSE,\n 'menu_position' => 100 ,\n 'supports' => array('title','editor','excerpt','custom-fields','revisions','thumbnail','page-attributes'),\n 'taxonomies' => array('category','post_tag')\n );\n\n register_post_type('custom', $args);\n }", "public function register_post_type(){\r\n //Capitilize the words and make it plural\r\n $name = ucwords( str_replace( '_', ' ', $this->post_type_name ) );\r\n $plural = $name . 's';\r\n $menupos = $this->post_type_pos;\r\n\r\n // We set the default labels based on the post type name and plural. We overwrite them with the given labels.\r\n $labels = array_merge(\r\n\r\n // Default\r\n array(\r\n 'name' => _x( $plural, 'post type general name' ),\r\n 'singular_name' => _x( $name, 'post type singular name' ),\r\n 'add_new' => _x( 'Add New', strtolower( $name ) ),\r\n 'add_new_item' => __( 'Add New ' . $name ),\r\n 'edit_item' => __( 'Edit ' . $name ),\r\n 'new_item' => __( 'New ' . $name ),\r\n 'all_items' => __( 'All ' . $plural ),\r\n 'view_item' => __( 'View ' . $name ),\r\n 'search_items' => __( 'Search ' . $plural ),\r\n 'not_found' => __( 'No ' . strtolower( $plural ) . ' found'),\r\n 'not_found_in_trash' => __( 'No ' . strtolower( $plural ) . ' found in Trash'),\r\n 'parent_item_colon' => '',\r\n 'menu_name' => $plural\r\n ),\r\n\r\n // Given labels\r\n $this->post_type_labels\r\n\r\n );\r\n\r\n // Same principle as the labels. We set some defaults and overwrite them with the given arguments.\r\n $args = array_merge(\r\n\r\n // Default\r\n array(\r\n 'capability_type' => 'post',\r\n 'hierarchical' => false,\r\n 'label' => $plural,\r\n 'labels' => $labels,\r\n 'menu_position' => $menupos,\r\n 'public' => true,\r\n 'publicly_queryable' => true,\r\n 'query_var' => true,\r\n 'rewrite' => array('slug' => $plural),\r\n 'show_in_nav_menus' => true,\r\n 'show_ui' => true,\r\n 'supports' => array( 'title', 'editor'),\r\n '_builtin' => false,\r\n ),\r\n\r\n // Given args\r\n $this->post_type_args\r\n\r\n );\r\n\r\n // Register the post type\r\n register_post_type( $this->post_type_name, $args );\r\n }", "function thirdtheme_custom_post_type()\n {\n $args = array(\n 'labels' => array('name' =>__(' my custom post'),\n 'singular name' =>__('my custom post')),\n 'public' => true,\n 'show_in_menu' => true,\n 'has_archive' => true,\n 'supports' => array( 'title', 'editor', 'author', 'thumbnail'));\n register_post_type('custompost',$args);\n \n }", "function carbon_register_post_types(){\n\n // carbon_register_post_type(array(\n // 'singular' => 'Type', // required\n // 'plural' => 'Types', // required\n // 'type' => 'type', // required\n // 'slug' => 'types/type',\n // 'menu_icon' => 'dashicons-admin-post',\n // 'has_archive' => true,\n // 'exclude_from_search' => true,\n // ));\n }", "function tower_custom_post_types() {\n foreach (TOWER_CUSTOM_POSTS as $key => $custom_type) {\n register_post_type($key, $custom_type['config']);\n }\n}", "function register_post_types() {\n\t}", "function register_post_types() {\n\t}", "public function register_post_type(){\n\t\tif(!class_exists('CPT')) return;\n\t\n\t\t$this->post_type = new CPT(\n\t\t\tarray(\n\t\t\t 'post_type_name' => 'slide',\n\t\t\t 'singular' => 'Slide',\n\t\t\t 'plural' => 'Slides',\n\t\t\t 'slug' => 'slide'\n\t\t\t),\n\t\t\tarray(\n\t\t\t\t'has_archive' \t\t\t=> \ttrue,\n\t\t\t\t'menu_position' \t\t=> \t8,\n\t\t\t\t'menu_icon' \t\t\t=> \t'dashicons-layout',\n\t\t\t\t'supports' \t\t\t\t=> \tarray('title', 'excerpt', 'content','thumbnail', 'post-formats', 'custom-fields')\n\t\t\t)\n\t\t);\n\t\t\n\t\t$labels = array('menu_name'=>'Types');\n\t\t$this->post_type->register_taxonomy('type',array(\n\t\t\t'hierarchical' => true,\n\t\t\t'public' => true,\n\t\t\t'show_ui' => true,\n\t\t\t'show_admin_column' => true,\n\t\t\t'show_in_nav_menus' => true,\n\t\t\t'show_tagcloud' => true,\n\t\t),$labels);\n\t}", "public function add_custom_post_types() {\n //\n }", "public static function register_post_type()\n {\n\n \t register_post_type( 'books',\n\t\t array(\n\t\t 'labels' => array(\n\t\t 'name' => __( 'Books' ),\n\t\t 'singular_name' => __( 'Books' )\n\t\t ),\n\t\t 'public' => true,\n\t\t 'has_archive' => false,\n\t\t )\n\t\t );\n\n }", "protected function register_post_type() {\n\t\t$labels = array(\n\t\t\t'name' => __( 'geopin', 'geopin-post-type' ),\n\t\t\t'singular_name' => __( 'geopin Member', 'geopin-post-type' ),\n\t\t\t'add_new' => __( 'Add geopin', 'geopin-post-type' ),\n\t\t\t'add_new_item' => __( 'Add geopin', 'geopin-post-type' ),\n\t\t\t'edit_item' => __( 'Edit geopin', 'geopin-post-type' ),\n\t\t\t'new_item' => __( 'New geopin', 'geopin-post-type' ),\n\t\t\t'view_item' => __( 'View geopin', 'geopin-post-type' ),\n\t\t\t'search_items' => __( 'Search geopin', 'geopin-post-type' ),\n\t\t\t'not_found' => __( 'No geopins found', 'geopin-post-type' ),\n\t\t\t'not_found_in_trash' => __( 'No geopins in the trash', 'geopin-post-type' ),\n\t\t);\n\n\t\t$supports = array(\n\t\t\t'title',\n\t\t\t// 'editor',\n\t\t\t'thumbnail',\n\t\t\t// 'custom-fields',\n\t\t\t// 'revisions',\n\t\t);\n\n\t\t$args = array(\n\t\t\t'labels' => $labels,\n\t\t\t'supports' => $supports,\n\t\t\t'public' => true,\n\t\t\t'capability_type' => 'post',\n\t\t\t'rewrite' => array( 'slug' => 'geopin', ), \n\t\t\t'menu_position' => 5,\n\t\t\t'menu_icon' => 'dashicons-admin-site',\n\t\t);\n\n\t\t$args = apply_filters( 'geoPin_post_type_args', $args );\n\n\t\tregister_post_type( $this->post_type, $args );\n\t}", "private function register_post_type() {\n\t\t\t// register the post type\n\t\t\t$args = array('label' => __('Options Pages', $this->text_domain),\n\t\t\t\t\t\t\t\t\t\t'description' => '',\n\t\t\t\t\t\t\t\t\t\t'public' => false,\n\t\t\t\t\t\t\t\t\t\t'show_ui' => true,\n\t\t\t\t\t\t\t\t\t\t'show_in_menu' => true,\n\t\t\t\t\t\t\t\t\t\t'capability_type' => 'post',\n\t\t\t\t\t\t\t\t\t\t'map_meta_cap' => true,\n\t\t\t\t\t\t\t\t\t\t'hierarchical' => false,\n\t\t\t\t\t\t\t\t\t\t'rewrite' => array('slug' => $this->post_type, 'with_front' => false),\n\t\t\t\t\t\t\t\t\t\t'query_var' => true,\n\t\t\t\t\t\t\t\t\t\t'exclude_from_search' => true,\n\t\t\t\t\t\t\t\t\t\t'menu_position' => 100,\n\t\t\t\t\t\t\t\t\t\t'menu_icon' => 'dashicons-admin-generic',\n\t\t\t\t\t\t\t\t\t\t'supports' => array('title','custom-fields','revisions'),\n\t\t\t\t\t\t\t\t\t\t'labels' => array('name' => __('Options Pages', $this->text_domain),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'singular_name' => __('Options Page', $this->text_domain),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'menu_name' =>\t__('Options Pages', $this->text_domain),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'add_new' => __('Add Options Page', $this->text_domain),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'add_new_item' => __('Add New Options Page', $this->text_domain),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'edit' => __('Edit', $this->text_domain),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'edit_item' => __('Edit Options Page', $this->text_domain),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'new_item' => __('New Options Page', $this->text_domain),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'view' => __('View Options Page', $this->text_domain),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'view_item' => __('View Options Page', $this->text_domain),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'search_items' => __('Search Options Pages', $this->text_domain),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'not_found' => __('No Options Pages Found', $this->text_domain),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'not_found_in_trash' => __('No Options Pages Found in Trash', $this->text_domain),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'parent' => __('Parent Options Page', $this->text_domain)));\n\t\t\tregister_post_type($this->post_type, $args);\n\t\t}", "public function create_post_types() {\n }", "function registerPostTypes()\n{\n register_post_type('destination', [\n 'public' => true,\n 'label' => 'Destinations',\n 'supports' => ['title', 'editor', 'thumbnail']\n ]);\n register_post_type('review', [\n 'public' => true,\n 'label' => 'Reviews',\n 'supports' => ['title', 'editor']\n ]);\n}", "public static function register_post_type() {\n\t\t$labels = array(\n\t\t\t'name' => _x( 'Collections', 'post type general name', 'wp-recipe-maker-premium' ),\n\t\t\t'singular_name' => _x( 'Collection', 'post type singular name', 'wp-recipe-maker-premium' ),\n\t\t);\n\n\t\t$args = apply_filters( 'wprm_recipe_collections_post_type_arguments', array(\n\t\t\t'labels' \t=> $labels,\n\t\t\t'public' \t=> false,\n\t\t\t'rewrite' \t=> false,\n\t\t\t'capability_type' \t=> 'post',\n\t\t\t'query_var' \t=> false,\n\t\t\t'has_archive' \t=> false,\n\t\t\t'supports' \t\t\t\t=> array( 'title', 'author' ),\n\t\t\t'show_in_rest'\t\t\t=> true,\n\t\t\t'rest_base'\t\t\t\t=> WPRMPRC_POST_TYPE,\n\t\t\t'rest_controller_class' => 'WP_REST_Posts_Controller',\n\t\t));\n\n\t\tregister_post_type( WPRMPRC_POST_TYPE, $args );\n\t}", "static function register_post_type ()\n {\n register_post_type(\n 'person',\n array(\n 'labels' => array(\n 'name' => __x( 'People', 'post type general name' ),\n 'singular_name' => __x( 'Person', 'post type singular name' ),\n 'menu_name' => __x( 'People', 'admin menu' ),\n 'name_admin_bar' => __x( 'Person', 'add new on admin bar' ),\n 'add_new' => __x( 'Add New', 'book' ),\n 'add_new_item' => ___( 'Add New Person' ),\n 'new_item' => ___( 'New Person' ),\n 'edit_item' => ___( 'Edit Person' ),\n 'view_item' => ___( 'View Person' ),\n 'all_items' => ___( 'All People' ),\n 'search_items' => ___( 'Search People' ),\n 'parent_item_colon' => ___( 'Parent People:' ),\n 'not_found' => ___( 'No persons found.' ),\n 'not_found_in_trash' => ___( 'No persons found in Trash.' )\n ),\n 'description' => ___( 'Noteworthy people' ),\n 'public' => true,\n 'publicly_queryable' => true,\n 'show_ui' => true,\n 'show_in_menu' => true,\n 'query_var' => true,\n 'rewrite' => array( 'slug' => 'people' ),\n 'capability_type' => 'post',\n 'has_archive' => true,\n 'hierarchical' => false,\n 'menu_position' => null,\n 'menu_icon' => 'dashicons-welcome-learn-more',\n 'supports' => array( 'title', 'editor', 'thumbnail' )\n ));\n }", "public function create_post_type() {\n\t\t\n \t\tregister_post_type(self::POST_TYPE,\n \t\t\tarray(\n \t\t\t\t'labels' => array(\n \t\t\t\t\t'name' => \"Custom\",\n \t\t\t\t\t'singular_name' => __(ucwords(str_replace(\"_\", \" \", self::POST_TYPE)))\n \t\t\t\t),\n \t\t\t\t'public' => true,\n \t\t\t\t'has_archive' => true,\n \t\t\t\t'description' => __(\"This is WP Custom Post Type\"),\n \t\t\t\t'supports' => array('title', 'editor', 'excerpt','thumbnail','custom-fields'),\n \t\t\t)\n \t\t);\n\n\t\t\tregister_taxonomy(\n\t\t\t\t'custom-category',\n\t\t\t\tself::POST_TYPE,\n\t\t\t\tarray(\n\t\t\t\t\t'label' => __( 'Category' ),\n\t\t\t\t\t'rewrite' => array( 'slug' => 'custom-category' ),\n\t\t\t\t\t'hierarchical' => true,\n\t\t\t\t)\n\t\t\t);\n\t\t}", "function compendium_register_type($slug, $name, $pname, $dicon) {\n $pt_slug = $slug;\n $tax_slug = $slug . '-category';\n\n register_post_type($pt_slug, array(\n 'labels' => array(\n 'name' => $pname,\n 'singular_name' => $name,\n 'add_new' => 'Add New',\n 'add_new_item' => 'Add New '.$name,\n 'edit_item' => 'Edit '.$name,\n 'new_item' => 'New '.$name,\n 'view_item' => 'View '.$name,\n 'search_items' => 'Search '.$pname,\n 'not_found' => 'No '.$pname.' found',\n 'not_found_in_trash' => 'No '.$pname.' found in trash',\n ),\n 'public' => true,\n 'menu_position' => 35,\n 'supports' => array('title','editor','thumbnail','excerpt'),\n 'menu_icon' => $dicon,\n 'rewrite' => array(\n 'slug' => 'resource-center/' . $pt_slug,\n 'with_front' => true\n ),\n ));\n\n register_taxonomy($tax_slug, $pt_slug, array(\n 'labels' => array(\n 'name' => 'Categories',\n 'singular_name' => 'Category',\n ),\n 'hierarchical' => true,\n ));\n}", "public static function register_post_type() {\n\t\tregister_post_type( 'drsa_ad', self::arguments() );\n\t}", "function register_post_type(){\n \n $capability = acf_get_setting('capability');\n \n if(!acf_get_setting('show_admin'))\n $capability = false;\n \n register_post_type($this->post_type, array(\n 'label' => 'Options Page',\n 'description' => 'Options Page',\n 'labels' => array(\n 'name' => 'Options Pages',\n 'singular_name' => 'Options Page',\n 'menu_name' => 'Options Pages',\n 'edit_item' => 'Edit Options Page',\n 'add_new_item' => 'New Options Page',\n ),\n 'supports' => array('title'),\n 'hierarchical' => true,\n 'public' => false,\n 'show_ui' => true,\n 'show_in_menu' => 'edit.php?post_type=acf-field-group',\n 'menu_icon' => 'dashicons-layout',\n 'show_in_admin_bar' => false,\n 'show_in_nav_menus' => false,\n 'can_export' => false,\n 'has_archive' => false,\n 'rewrite' => false,\n 'exclude_from_search' => true,\n 'publicly_queryable' => false,\n 'capabilities' => array(\n 'publish_posts' => $capability,\n 'edit_posts' => $capability,\n 'edit_others_posts' => $capability,\n 'delete_posts' => $capability,\n 'delete_others_posts' => $capability,\n 'read_private_posts' => $capability,\n 'edit_post' => $capability,\n 'delete_post' => $capability,\n 'read_post' => $capability,\n ),\n 'acfe_admin_orderby' => 'title',\n 'acfe_admin_order' => 'ASC',\n 'acfe_admin_ppp' => 999,\n ));\n \n }", "static function register_post_type() {\n\n $args = array(\n 'labels' => array(\n\t\t'name' => __( 'Forms', 'pwp' ),\n\t\t'singular_name' => __( 'Form', 'pwp' ),\n\t\t'add_new' => __( 'Add New', 'pwp' ),\n\t\t'add_new_item' => __( 'Add New Form', 'pwp' ),\n\t\t'edit_item' => __( 'Edit Form', 'pwp' ),\n\t\t'new_item' => __( 'New Form', 'pwp' ),\n\t\t'all_items' => __( 'All Forms', 'pwp' ),\n\t\t'view_item' => __( 'View Form', 'pwp' ),\n\t\t'search_items' => __( 'Search Forms', 'pwp' ),\n\t\t'not_found' => __( 'No forms found', 'pwp' ),\n\t\t'not_found_in_trash' => __( 'No forms found in Trash', 'pwp' ),\n\t\t'parent_item_colon' => __( ':', 'pwp' ),\n\t\t'menu_name' => __( 'Forms', 'pwp' )\n\t ),\n 'public' => false,\n 'show_ui' => true,\n 'query_var' => false,\n 'supports' => array( 'title', 'custom-fields', 'editor' )\n );\n\tregister_post_type( 'form', $args );\n }", "function theme_custom_post_type() {\n\tregister_post_type( 'custom_type',\n\n\t\t// Array with all the options for the custom post type\n\t\tarray( 'labels' => array(\n\t\t\t'name'\t\t\t\t\t=> __( 'Custom Types' ), // Name of the custom post type group\n\t\t\t'singular_name'\t\t\t=> __( 'Custom Post' ), // Name of the custom post type singular\n\t\t\t'all_items'\t\t\t\t=> __( 'All Custom Posts' ),\n\t\t\t'add_new' \t\t\t\t=> __( 'Add New' ),\n\t\t\t'add_new_item' \t\t\t=> __( 'Add New Custom Type' ),\n\t\t\t'edit'\t\t\t\t\t=> __( 'Edit' ),\n\t\t\t'edit_item'\t\t\t\t=> __( 'Edit Post Types' ),\n\t\t\t'new_item'\t\t\t\t=> __( 'New Post Type' ),\n\t\t\t'view_item'\t\t\t\t=> __( 'View Post Type' ),\n\t\t\t'search_items'\t\t\t=> __( 'Search Post Type' ),\n\t\t\t'not_found'\t\t\t\t=> __( 'Nothing found in the Database.' ),\n\t\t\t'not_found_in_trash'\t=> __( 'Nothing found in Trash' ),\n\t\t\t'parent_item_colon' \t=> ''\n\t\t\t),\n\n\t\t\t'description' \t\t\t=> __( 'This is the example custom post type' ), // Custom post type description\n\t\t\t'public' \t\t\t\t=> true,\n\t\t\t'publicly_queryable' \t=> true,\n\t\t\t'exclude_from_search' \t=> false,\n\t\t\t'show_ui' \t\t\t\t=> true,\n\t\t\t'query_var' \t\t\t=> true,\n\t\t\t'menu_position' \t\t=> 5, // The order the custom post type appears on the admin menu\n\t\t\t// 'menu_icon' \t\t\t=> get_stylesheet_directory_uri() . '/assets/images/custom-post-icon.png',\n\t\t\t'rewrite'\t\t\t\t=> array( 'slug' => 'custom_type', 'with_front' => false ), // You may specify its url slug\n\t\t\t'has_archive' \t\t\t=> 'custom_type', // You mary rename the slug here\n\t\t\t'capability_type' \t\t=> 'post',\n\t\t\t'hierarchical' \t\t\t=> false,\n\n\t\t\t// Enable post editor support\n\t\t\t'supports' => array(\n\t\t\t\t'title',\n\t\t\t\t'editor',\n\t\t\t\t'author',\n\t\t\t\t'thumbnail',\n\t\t\t\t'excerpt',\n\t\t\t\t'trackbacks',\n\t\t\t\t'custom-fields',\n\t\t\t\t'comments',\n\t\t\t\t'revisions',\n\t\t\t\t'sticky'\n\t\t\t)\n\t\t)\n\t);\n\n\t// This adds your post categories to your custom post type\n\tregister_taxonomy_for_object_type( 'category', 'custom_type' );\n\n\t// This adds your post tags to your custom post type\n\tregister_taxonomy_for_object_type( 'post_tag', 'custom_type' );\n\n}", "function add_custom_post_type() \n {\n // add custom type evenementen\n $labels = array(\n 'name' => _x('Quotes', 'post type general name', $this->localization_domain),\n 'singular_name' => _x('Quote', 'post type singular name', $this->localization_domain),\n 'add_new' => _x('Add Quote', 'event', $this->localization_domain),\n 'add_new_item' => __('Add New Quote', $this->localization_domain),\n 'edit_item' => __('Edit Quote', $this->localization_domain),\n 'new_item' => __('New Quote', $this->localization_domain),\n 'view_item' => __('View Quote', $this->localization_domain),\n 'search_items' => __('Search Quotes', $this->localization_domain),\n 'not_found' => __('No Quotes found', $this->localization_domain),\n 'not_found_in_trash' => __('No Quotes found in Trash', $this->localization_domain), \n 'parent_item_colon' => ''\n );\n $type_args = array(\n 'labels' => $labels,\n 'description' => __('bbQuotations offers a simple quotes custom post type. Useful for pull quotes or just random quotes on your site.',\n $this->localization_domain),\n 'public' => false,\n 'publicly_queryable' => false,\n 'show_ui' => true, \n 'query_var' => true,\n 'rewrite' => array('slug' => $this->options['bbquotations-slug']),\n 'capability_type' => 'post',\n 'hierarchical' => false,\n 'menu_position' => 5,\n 'supports' => array('title','editor','author')\n ); \n register_post_type( $this->custom_post_type_name, $type_args);\n }", "private function initCustomPostType(){\n //Instantiate our custom post type object\n $this->cptWPDS = new PostType($this->wpdsPostType);\n \n //Set our custom post type properties\n $this->cptWPDS->setSingularName($this->wpdsPostTypeName);\n $this->cptWPDS->setPluralName($this->wpdsPostTypeNamePlural);\n $this->cptWPDS->setMenuName($this->wpdsPostTypeNamePlural);\n $this->cptWPDS->setLabels('Add New', 'Add New '.$this->wpdsPostTypeName, 'Edit '.$this->wpdsPostTypeName, 'New '.$this->wpdsPostTypeName, 'All '.$this->wpdsPostTypeNamePlural, 'View '.$this->wpdsPostTypeNamePlural, 'Search '.$this->wpdsPostTypeNamePlural, 'No '.strtolower($this->wpdsPostTypeNamePlural).' found', 'No '.strtolower($this->wpdsPostTypeNamePlural).' found in the trash');\n $this->cptWPDS->setMenuIcon('dashicons-welcome-write-blog');\n $this->cptWPDS->setSlug($this->wpdsPostType);\n $this->cptWPDS->setDescription('Writings from the universe');\n $this->cptWPDS->setShowInMenu(true);\n $this->cptWPDS->setPublic(true);\n $this->cptWPDS->setTaxonomies([$this->wpdsPostType]);\n $this->cptWPDS->removeSupports(['title']);\n \n //Register custom post type\n $this->cptWPDS->register();\n }", "function carbon_register_post_type($settings){\n\n $labels = array(\n 'name' => _x($settings['plural'],'post type plural name','carbon'),\n 'singular_name' => _x($settings['singular'],'post type singular name','carbon'),\n 'add_new' => _x('Add New',$settings['singular'],'carbon'),\n 'add_new_item' => __('Add New ' .$settings['singular']),\n 'edit_item' => __('Edit ' .$settings['singular']),\n 'new_item' => __('New ' .$settings['singular']),\n 'all_items' => __('All ' .$settings['plural']),\n 'view_item' => __('View ' .$settings['singular']),\n 'search_items' => __('Search ' .$settings['plural']),\n 'not_found' => __('No ' .$settings['plural'].' found'),\n 'not_found_in_trash' => __('No ' .$settings['plural'].' found in Trash'),\n 'parent_item_colon' => ':',\n 'menu_name' => $settings['plural'],\n );\n\n $args = array(\n 'labels' => $labels,\n 'can_export' => (isset($settings['can_export']) ? $settings['can_export'] : true), // defaults true\n 'capability_type' => (isset($settings['capability_type']) ? $settings['behavior'] : 'post'), // default post\n // 'capabilities' // default capability_type\n 'exclude_from_search' => (isset($settings['exclude_from_search']) ? $settings['exclude_from_search'] : false), // default opposite of public\n 'hierarchical' => (isset($settings['hierarchical']) ? $settings['hierarchical'] : false), // default false\n 'has_archive' => (isset($settings['has_archive']) ? $settings['has_archive'] : false), // default false\n // 'permalink_epmask' // default EP_PERMALINK\n 'public' => (isset($settings['public']) ? $settings['public'] : true), // default false\n 'publicly_queryable' => (isset($settings['publicly_queryable']) ? $settings['publicly_queryable'] : true), // default public\n 'query_var' => (isset($settings['query_var']) ? $settings['query_var'] : true), // default true type\n 'show_ui' => (isset($settings['show_ui']) ? $settings['show_ui'] : true), // default public\n 'show_in_menu' => (isset($settings['show_in_menu']) ? $settings['show_in_menu'] : true), // default public\n 'show_in_admin_bar' => (isset($settings['show_in_admin_bar']) ? $settings['show_in_admin_bar'] : true), // default show_in_menu\n 'menu_position' => (isset($settings['menu_position']) ? $settings['menu_position'] : null), // default null\n 'menu_icon' => (isset($settings['menu_icon']) ? $settings['menu_icon'] : 'dashicons-admin-post'),\n 'supports' => (isset($settings['supports']) ? $settings['supports'] : array('title', 'editor', 'excerpt', 'thumbnail', 'revisions', 'page-attributes')), // default title editor\n 'taxonomies' => (isset($settings['taxonomies']) ? $settings['taxonomies'] : array()), // default none\n // 'register_meta_box_cb' // default none\n 'rewrite' => (isset($settings['rewrite']) ? $settings['rewrite'] : array( // default true name\n 'slug' => (isset($settings['slug']) ? $settings['slug'] : $settings['type']), // default type\n 'with_front' => (isset($settings['with_front']) ? $settings['with_front'] : false), // default true\n 'feeds' => (isset($settings['feeds']) ? $settings['feeds'] : false), // default has_archive\n 'pages' => (isset($settings['pages']) ? $settings['pages'] : true), // defaults true\n // 'ep_mask' // default permalink_epmask EP_PERMALINK\n )),\n );\n register_post_type($settings['type'], $args);\n }", "function create_post_type() {\r\n\r\n\tregister_post_type( 'Editorials',\r\n\t// CPT Options\r\n\t\tarray(\r\n\t\t\t'labels' => array(\r\n\t\t\t\t'name' => __( 'Editorials' ),\r\n\t\t\t\t'singular_name' => __( 'Editorial' )\r\n\t\t\t),\r\n\t\t\t'public' => true,\r\n\t\t\t'has_archive' => true,\r\n\t\t\t'rewrite' => array('slug' => 'editorials'),\r\n\t\t\t'supports' => array( 'title', 'editor', 'thumbnail', 'revisions', 'comments' ),\r\n \t'show_ui' => true,\r\n\t\t)\r\n\t);\r\n\tregister_post_type( 'Local news',\r\n\t// CPT Options\r\n\t\tarray(\r\n\t\t\t'labels' => array(\r\n\t\t\t\t\r\n\t\t\t\t'name' => __( 'Local news' ),\r\n\t\t\t\t'singular_name' => __( 'Local new' )\r\n\t\t\t),\r\n\t\t\t'public' => true,\r\n\t\t\t'has_archive' => true,\r\n\t\t\t'rewrite' => array('slug' => 'local news'),\r\n\t\t\t'supports' => array( 'title', 'editor', 'thumbnail', 'revisions', 'comments' ),\r\n \t'show_ui' => true,\r\n\t\t)\r\n\t);\r\n}", "function food_specials_custompost() {\r\n\t$args = array(\r\n\t\t'label' => 'Daily Food Specials',\r\n\t\t'public' => true,\r\n\t\t'show_ui' => true,\r\n\t\t'capability_type' => 'post',\r\n\t\t'rewrite' => array('slug' => 'food_specials'),\r\n\t\t'query_var' => true,\r\n\t\t'supports' => array(\r\n\t\t\t'title', 'editor', 'excerpt', 'comments', 'thumbnail', 'author',)\r\n\t\t);\r\n\tregister_post_type('food_specials', $args);\r\n}", "public function register_post_type() {\n\t\t$labels = array(\n\t\t\t'name' => _x( 'Movies', 'Post type general name', 'plugintest' ),\n\t\t\t'singular_name' => _x( 'Movie', 'Post type singular name', 'plugintest' ),\n\t\t\t'menu_name' => _x( 'Movies', 'Admin Menu text', 'plugintest' ),\n\t\t\t'name_admin_bar' => _x( 'Movie', 'Admin Menu Toolbar text', 'plugintest' ),\n\t\t\t'add_new' => __( 'Add New', 'plugintest' ),\n\t\t\t'add_new_item' => __( 'Add New Movie', 'plugintest' ),\n\t\t\t'new_item' => __( 'Aaaaaa', 'plugintest' ),\n\t\t\t'view_item' => __( 'View Movie', 'plugintest' ),\n\t\t\t'edit_item' => __( 'Edit Movie', 'plugintest' ),\n\t\t\t'all_items' => __( 'All Movies', 'plugintest' ),\n\t\t\t'search_items' => __( 'Search Movies', 'plugintest' ),\n\t\t\t'parent_item_colon' => __( 'Parent Movies', 'plugintest' ),\n\t\t\t'not_found' => __( 'No Movies found.', 'plugintest' ),\n\t\t\t'not_found_in_trash' => __( 'No Movies found in Trash.', 'plugintest' ),\n\t\t\t'featured_image' => _x( 'Movie Cover Image', 'Overrides the “Featured Image” phrase for this post type. Added in 4.3', 'plugintest' ),\n\t\t\t'set_featured_image' => _x( 'Set cover image', 'Overrides the “Set featured image” phrase for this post type. Added in 4.3', 'plugintest' ),\n\t\t\t'remove_featured_image' => _x( 'Remove cover image', 'Overrides the “Remove featured image” phrase for this post type. Added in 4.3', 'plugintest' ),\n\t\t\t'use_featured_image' => _x( 'Use as cover image', 'Overrides the “Use as featured image” phrase for this post type. Added in 4.3', 'plugintest' ),\n\t\t\t'item_published' => __( 'New Movie Published.', 'plugintest' ),\n\t\t\t'item_updated' => __( 'Movie post updated.', 'plugintest' ),\n\t\t);\n\n\t\t$args = array(\n\t\t\t'labels' => $labels,\n\t\t\t'public' => true,\n\t\t\t'publicly_queryable' => true,\n\t\t\t'show_ui' => true,\n\t\t\t'show_in_menu' => true,\n\t\t\t'query_var' => true,\n\t\t\t'rewrite' => array( 'slug' => 'movie' ),\n\t\t\t'capability_type' => 'post',\n\t\t\t'hierarchical' => false,\n\t\t\t'has_archive' => true,\n\t\t\t'menu_position' => null,\n\t\t\t'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments' ),\n\t\t\t'taxonomies' => array( 'category', 'post_tag' ), // Using wordpess category and tags.\n\t\t);\n\n\t\tregister_post_type( 'movie', $args );\n\t\tflush_rewrite_rules();\n\n\t\t$category_labels = array(\n\t\t\t'name' => esc_html__( 'Movies Categories', 'plugintest' ),\n\t\t\t'singular_name' => esc_html__( 'Movie Category', 'plugintest' ),\n\t\t\t'all_items' => esc_html__( 'Movies Categories', 'plugintest' ),\n\t\t\t'parent_item' => null,\n\t\t\t'parent_item_colon' => null,\n\t\t\t'edit_item' => esc_html__( 'Edit Category', 'plugintest' ),\n\t\t\t'update_item' => esc_html__( 'Update Category', 'plugintest' ),\n\t\t\t'add_new_item' => esc_html__( 'Add New Movie Category', 'plugintest' ),\n\t\t\t'new_item_name' => esc_html__( 'New Movie Name', 'plugintest' ),\n\t\t\t'menu_name' => esc_html__( 'Genre', 'plugintest' ),\n\t\t\t'search_items' => esc_html__( 'Search Categories', 'plugintest' ),\n\t\t);\n\n\t\t$category_args = array(\n\t\t\t'hierarchical' => false,\n\t\t\t'public' => true,\n\t\t\t'labels' => $category_labels,\n\t\t\t'show_ui' => true,\n\t\t\t'show_admin_column' => true,\n\t\t\t'rewrite' => array( 'slug' => 'genre' ),\n\t\t);\n\n\t\tregister_taxonomy( 'genre', array( self::$post_type ), $category_args );\n\t}", "public function register_post_type()\n\t{\n\n\t\tregister_post_type( 'partner', array(\n\t\t\t'labels' => array(\n\t\t\t\t'name' => _x( 'Partners', 'post type general name', 'custom-post-type-partners' ),\n\t\t\t\t'singular_name' => _x( 'Partner', 'post type singular name', 'custom-post-type-partners' ),\n\t\t\t\t'add_new' => _x( 'Add New', 'Partner', 'custom-post-type-partners' ),\n\t\t\t\t'add_new_item' => __( 'Add New Partner', 'custom-post-type-partners' ),\n\t\t\t\t'edit_item' => __( 'Edit Partner', 'custom-post-type-partners' ),\n\t\t\t\t'new_item' => __( 'New Partner', 'custom-post-type-partners' ),\n\t\t\t\t'all_items' => __( 'All Partners', 'custom-post-type-partners' ),\n\t\t\t\t'view_item' => __( 'View Partner', 'custom-post-type-partners' ),\n\t\t\t\t'search_items' => __( 'Search Partners', 'custom-post-type-partners' ),\n\t\t\t\t'not_found' => __( 'No Partners found', 'custom-post-type-partners' ),\n\t\t\t\t'not_found_in_trash' => __( 'No Partners found in Trash', 'custom-post-type-partners' ),\n\t\t\t\t'parent_item_colon' => '',\n\t\t\t\t'menu_name' => __( 'Partners', 'custom-post-type-partners' )\n\t\t\t),\n\t\t\t'public' => TRUE,\n\t\t\t'publicly_queryable' => TRUE,\n\t\t\t'show_ui' => TRUE,\n\t\t\t'show_in_menu' => TRUE,\n\t\t\t'query_var' => TRUE,\n\t\t\t'rewrite' => TRUE,\n\t\t\t'capability_type' => 'post',\n\t\t\t'has_archive' => FALSE,\n\t\t\t'hierarchical' => FALSE,\n\t\t\t'menu_position' => NULL,\n\t\t\t'menu_icon' => 'dashicons-admin-links',\n\t\t\t'supports' => array( 'title', 'editor', 'thumbnail', 'page-attributes' )\n\t\t) );\n\n\t}", "public function customPostType()\n {\n\n if (empty($this->custom_post_types)) {\n return;\n }\n\n foreach ($this->custom_post_types as $post_type) {\n register_post_type(\n $post_type['post_type'],\n [\n 'labels' => [\n 'name' => __($post_type['name'], 'vrcoder'),\n 'singular_name' => __($post_type['singular_name'], 'vrcoder'),\n 'menu_name' => __($post_type['name'], 'vrcoder'),\n 'name_admin_bar' => __($post_type['singular_name'], 'vrcoder'),\n 'archives' => __($post_type['singular_name'] . ' Archives', 'vrcoder'),\n 'attributes' => __($post_type['singular_name'] . ' Attributes', 'vrcoder'), \n 'parent_item_colon' => __('Parent ' . $post_type['singular_name'], 'vrcoder'),\n 'all_items' => __('All ' . $post_type['name'], 'vrcoder'),\n 'add_new_item' => __('Add new ' . $post_type['singular_name'], 'vrcoder'),\n 'add_new' => __('Add new', 'vrcoder'),\n 'new_item' => __('New ' . $post_type['singular_name'], 'vrcoder'),\n 'edit_item' => __('Edit ' . $post_type['singular_name'], 'vrcoder'),\n 'update_item' => __('Update' . $post_type['singular_name'], 'vrcoder'),\n 'view_item' => __('View' . $post_type['singular_name'], 'vrcoder'),\n 'view_items' => __('View' . $post_type['name'], 'vrcoder'),\n 'search_items' => __('Search' . $post_type['name'], 'vrcoder'),\n 'not_found' => __('No' . $post_type['singular_name'] . ' Found', 'vrcoder'),\n 'not_found_in_trash' => __('No' . $post_type['singular_name'] . ' Found in Trash', 'vrcoder'),\n 'featured_image' => __('Featured Image', 'vrcoder'),\n 'set_featured_image' => __('Set Featured Image', 'vrcoder'),\n 'remove_featured_image' => __('Remove Featured Image', 'vrcoder'),\n 'use_featured_image' => __('Use Featured Image', 'vrcoder'),\n 'insert_into_item' => __('Insert into' . $post_type['singular_name'], 'vrcoder'),\n 'uploaded_to_this_item' => __('Upload to this' . $post_type['singular_name'], 'vrcoder'),\n 'items_list' => __($post_type['name'] . ' List', 'vrcoder'),\n 'items_list_navigation' => __($post_type['name'] . ' List Navigation', 'vrcoder'),\n 'filter_items_list' => __('Filter' . $post_type['name'] . ' List', 'vrcoder'),\n ],\n 'label' => __($post_type['singular_name'], 'vrcoder'),\n 'description' => __($post_type['name'] . ' Custom Post Type', 'vrcoder'),\n 'supports' => $post_type['supports'],\n 'show_in_rest' => $post_type['show_in_rest'],\n 'taxonomies' => $post_type['taxonomies'],\n 'hierarchical' => $post_type['hierarchical'],\n 'public' => $post_type['public'],\n 'show_ui' => $post_type['show_ui'],\n 'show_in_menu' => $post_type['show_in_menu'],\n 'menu_position' => $post_type['menu_position'],\n 'show_in_admin_bar' => $post_type['show_in_admin_bar'],\n 'show_in_nav_menus' => $post_type['show_in_nav_menus'],\n 'can_export' => $post_type['can_export'],\n 'has_archive' => $post_type['has_archive'],\n 'exclude_from_search' => $post_type['exclude_from_search'],\n 'publicly_queryable' => $post_type['publicly_queryable'],\n 'capability_type' => $post_type['capability_type'],\n 'menu_icon' => $post_type['menu_icon']\n ]\n );\n }\n\n }", "public static function registerWPPostType()\n {\n register_post_type\n (\n 'fs_feed_entry',\n array\n (\n 'label' => 'Feed Entries',\n 'labels' => array\n (\n 'name' => 'Feed Entries',\n 'singular_name' => 'Feed Entry',\n 'add_new' => 'Add New',\n 'add_new_item' => 'Add New Feed Entry',\n 'edit_item' => 'Edit Feed Entry',\n 'new_item' => 'New Feed Entry',\n 'view_item' => 'View Feed Entry',\n 'search_items' => 'Search Feed Entries',\n 'not_found' => 'No Feed Entries Found',\n 'not_found_in_trash' => 'No Feed Entries Found In Trash',\n 'parent_item_colon' => 'Parent Feed Entries:',\n 'edit' => 'Edit',\n 'view' => 'View Feed Entry'\n ),\n 'public' => false,\n 'show_ui' => true\n )\n );\n }", "function pluginprefix_setup_post_type()\n{\n register_post_type('post-nasa-gallery', [\n 'label' => 'Nasa Images Posts',\n 'public' => true\n ]);\n}", "public function cws_register_cpt() {\n\n\t\tforeach ( $this->cpts as $key => $value ) {\n\n\t\t\tregister_post_type( $key, $value );\n\n\t\t}\n\n\t}", "public function register_post_types() {\n require_once('includes/post-types.php');\n }", "function my_custom_post_registry() {\n\t$registry_labels = array(\n\t\t'name' => 'Registrations',\n\t\t'singular_name' => 'Cozmeena Shawl Registration',\n\t\t'add_new' => 'Add New',\n\t\t'all_items' => 'All Registrations',\n\t\t'add_new_item' => 'Add New Registration',\n\t\t'edit_item' => 'Edit Registration',\n\t\t'new_item' => 'New Registration',\n\t\t'view_item' => 'View Registration',\n\t\t'search_items' => 'Search Registrations',\n\t\t'not_found' => 'No Registrations found',\n\t\t'not_found_in_trash' => 'No Registrations found in trash',\n\t\t'parent_item_colon' => '',\n\t\t'menu_name' => 'Cozmeena Shawl Registrations'\n\t);\n\t$registry_args = array(\n\t\t'labels' => $registry_labels,\n\t\t'description' => \"The International Cozmeena Registry is the official record of Cozmeena Shawls\",\n\t\t'public' => true,\n\t\t'menu_position' => 5,\n\t\t'menu_icon' => '',\n\t\t'supports' => array('title','author', 'editor','thumbnail'),\n\t\t'capability_type' => 'coz_registry', // need to assign capabilities via plugin\n\t\t'map_meta_cap' => true,\n\t\t'has_archive' => true,\n\t); \n\tregister_post_type('coz_registry',$registry_args);\n}", "public static function register_type() {\n\t\tregister_graphql_object_type(\n\t\t\t'PostTypeLabelDetails',\n\t\t\t[\n\t\t\t\t'description' => __( 'Details for labels of the PostType', 'wp-graphql' ),\n\t\t\t\t'fields' => [\n\t\t\t\t\t'name' => [\n\t\t\t\t\t\t'type' => 'String',\n\t\t\t\t\t\t'description' => __( 'General name for the post type, usually plural.', 'wp-graphql' ),\n\t\t\t\t\t],\n\t\t\t\t\t'singularName' => [\n\t\t\t\t\t\t'type' => 'String',\n\t\t\t\t\t\t'description' => __( 'Name for one object of this post type.', 'wp-graphql' ),\n\t\t\t\t\t\t'resolve' => function( $labels ) {\n\t\t\t\t\t\t\treturn ! empty( $labels->singular_name ) ? $labels->singular_name : null;\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\t'addNew' => [\n\t\t\t\t\t\t'type' => 'String',\n\t\t\t\t\t\t'description' => __( 'Default is ‘Add New’ for both hierarchical and non-hierarchical types.', 'wp-graphql' ),\n\t\t\t\t\t\t'resolve' => function( $labels ) {\n\t\t\t\t\t\t\treturn ! empty( $labels->add_new ) ? $labels->add_new : null;\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\t'addNewItem' => [\n\t\t\t\t\t\t'type' => 'String',\n\t\t\t\t\t\t'description' => __( 'Label for adding a new singular item.', 'wp-graphql' ),\n\t\t\t\t\t\t'resolve' => function( $labels ) {\n\t\t\t\t\t\t\treturn ! empty( $labels->add_new_item ) ? $labels->add_new_item : null;\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\t'editItem' => [\n\t\t\t\t\t\t'type' => 'String',\n\t\t\t\t\t\t'description' => __( 'Label for editing a singular item.', 'wp-graphql' ),\n\t\t\t\t\t\t'resolve' => function( $labels ) {\n\t\t\t\t\t\t\treturn ! empty( $labels->edit_item ) ? $labels->edit_item : null;\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\t'newItem' => [\n\t\t\t\t\t\t'type' => 'String',\n\t\t\t\t\t\t'description' => __( 'Label for the new item page title.', 'wp-graphql' ),\n\t\t\t\t\t\t'resolve' => function( $labels ) {\n\t\t\t\t\t\t\treturn ! empty( $labels->new_item ) ? $labels->new_item : null;\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\t'viewItem' => [\n\t\t\t\t\t\t'type' => 'String',\n\t\t\t\t\t\t'description' => __( 'Label for viewing a singular item.', 'wp-graphql' ),\n\t\t\t\t\t\t'resolve' => function( $labels ) {\n\t\t\t\t\t\t\treturn ! empty( $labels->view_item ) ? $labels->view_item : null;\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\t'viewItems' => [\n\t\t\t\t\t\t'type' => 'String',\n\t\t\t\t\t\t'description' => __( 'Label for viewing post type archives.', 'wp-graphql' ),\n\t\t\t\t\t\t'resolve' => function( $labels ) {\n\t\t\t\t\t\t\treturn ! empty( $labels->view_items ) ? $labels->view_items : null;\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\t'searchItems' => [\n\t\t\t\t\t\t'type' => 'String',\n\t\t\t\t\t\t'description' => __( 'Label for searching plural items.', 'wp-graphql' ),\n\t\t\t\t\t\t'resolve' => function( $labels ) {\n\t\t\t\t\t\t\treturn ! empty( $labels->search_items ) ? $labels->search_items : null;\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\t'notFound' => [\n\t\t\t\t\t\t'type' => 'String',\n\t\t\t\t\t\t'description' => __( 'Label used when no items are found.', 'wp-graphql' ),\n\t\t\t\t\t\t'resolve' => function( $labels ) {\n\t\t\t\t\t\t\treturn ! empty( $labels->not_found ) ? $labels->not_found : null;\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\t'notFoundInTrash' => [\n\t\t\t\t\t\t'type' => 'String',\n\t\t\t\t\t\t'description' => __( 'Label used when no items are in the trash.', 'wp-graphql' ),\n\t\t\t\t\t\t'resolve' => function( $labels ) {\n\t\t\t\t\t\t\treturn ! empty( $labels->not_found_in_trash ) ? $labels->not_found_in_trash : null;\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\t'parentItemColon' => [\n\t\t\t\t\t\t'type' => 'String',\n\t\t\t\t\t\t'description' => __( 'Label used to prefix parents of hierarchical items.', 'wp-graphql' ),\n\t\t\t\t\t\t'resolve' => function( $labels ) {\n\t\t\t\t\t\t\treturn ! empty( $labels->parent_item_colon ) ? $labels->parent_item_colon : null;\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\t'allItems' => [\n\t\t\t\t\t\t'type' => 'String',\n\t\t\t\t\t\t'description' => __( 'Label to signify all items in a submenu link.', 'wp-graphql' ),\n\t\t\t\t\t\t'resolve' => function( $labels ) {\n\t\t\t\t\t\t\treturn ! empty( $labels->all_items ) ? $labels->all_items : null;\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\t'archives' => [\n\t\t\t\t\t\t'type' => 'String',\n\t\t\t\t\t\t'description' => __( 'Label for archives in nav menus', 'wp-graphql' ),\n\t\t\t\t\t],\n\t\t\t\t\t'attributes' => [\n\t\t\t\t\t\t'type' => 'String',\n\t\t\t\t\t\t'description' => __( 'Label for the attributes meta box.', 'wp-graphql' ),\n\t\t\t\t\t],\n\t\t\t\t\t'insertIntoItem' => [\n\t\t\t\t\t\t'type' => 'String',\n\t\t\t\t\t\t'description' => __( 'Label for the media frame button.', 'wp-graphql' ),\n\t\t\t\t\t\t'resolve' => function( $labels ) {\n\t\t\t\t\t\t\treturn ! empty( $labels->insert_into_item ) ? $labels->insert_into_item : null;\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\t'uploadedToThisItem' => [\n\t\t\t\t\t\t'type' => 'String',\n\t\t\t\t\t\t'description' => __( 'Label for the media frame filter.', 'wp-graphql' ),\n\t\t\t\t\t\t'resolve' => function( $labels ) {\n\t\t\t\t\t\t\treturn ! empty( $labels->uploaded_to_this_item ) ? $labels->uploaded_to_this_item : null;\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\t'featuredImage' => [\n\t\t\t\t\t\t'type' => 'String',\n\t\t\t\t\t\t'description' => __( 'Label for the Featured Image meta box title.', 'wp-graphql' ),\n\t\t\t\t\t\t'resolve' => function( $labels ) {\n\t\t\t\t\t\t\treturn ! empty( $labels->featured_image ) ? $labels->featured_image : null;\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\t'setFeaturedImage' => [\n\t\t\t\t\t\t'type' => 'String',\n\t\t\t\t\t\t'description' => __( 'Label for setting the featured image.', 'wp-graphql' ),\n\t\t\t\t\t\t'resolve' => function( $labels ) {\n\t\t\t\t\t\t\treturn ! empty( $labels->set_featured_image ) ? $labels->set_featured_image : null;\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\t'removeFeaturedImage' => [\n\t\t\t\t\t\t'type' => 'String',\n\t\t\t\t\t\t'description' => __( 'Label for removing the featured image.', 'wp-graphql' ),\n\t\t\t\t\t\t'resolve' => function( $labels ) {\n\t\t\t\t\t\t\treturn ! empty( $labels->remove_featured_image ) ? $labels->remove_featured_image : null;\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\t'useFeaturedImage' => [\n\t\t\t\t\t\t'type' => 'String',\n\t\t\t\t\t\t'description' => __( 'Label in the media frame for using a featured image.', 'wp-graphql' ),\n\t\t\t\t\t\t'resolve' => function( $labels ) {\n\t\t\t\t\t\t\treturn ! empty( $labels->use_featured_item ) ? $labels->use_featured_item : null;\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\t'menuName' => [\n\t\t\t\t\t\t'type' => 'String',\n\t\t\t\t\t\t'description' => __( 'Label for the menu name.', 'wp-graphql' ),\n\t\t\t\t\t\t'resolve' => function( $labels ) {\n\t\t\t\t\t\t\treturn ! empty( $labels->menu_name ) ? $labels->menu_name : null;\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\t'filterItemsList' => [\n\t\t\t\t\t\t'type' => 'String',\n\t\t\t\t\t\t'description' => __( 'Label for the table views hidden heading.', 'wp-graphql' ),\n\t\t\t\t\t\t'resolve' => function( $labels ) {\n\t\t\t\t\t\t\treturn ! empty( $labels->filter_items_list ) ? $labels->filter_items_list : null;\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\t'itemsListNavigation' => [\n\t\t\t\t\t\t'type' => 'String',\n\t\t\t\t\t\t'description' => __( 'Label for the table pagination hidden heading.', 'wp-graphql' ),\n\t\t\t\t\t\t'resolve' => function( $labels ) {\n\t\t\t\t\t\t\treturn ! empty( $labels->items_list_navigation ) ? $labels->items_list_navigation : null;\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\t'itemsList' => [\n\t\t\t\t\t\t'type' => 'String',\n\t\t\t\t\t\t'description' => __( 'Label for the table hidden heading.', 'wp-graphql' ),\n\t\t\t\t\t\t'resolve' => function( $labels ) {\n\t\t\t\t\t\t\treturn ! empty( $labels->items_list ) ? $labels->items_list : null;\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\n\t}", "function tt_register_cpt($single, $plural = '') {\n if (empty($plural)) {\n $plural = $single.'s';\n }\n register_post_type(\n strtolower($single),\n array(\n 'label' => $plural,\n 'labels' => array(\n 'add_new_item' => \"Add New $single\",\n 'edit_item' => \"Edit $single\",\n 'new_item' => \"New $single\",\n 'view_item' => \"View $single\",\n 'search_items' => \"Search $plural\",\n 'not_found' => \"No $plural found\",\n 'not_found_in_trash' => \"No $plural found in Trash\",\n ),\n 'public' => true,\n 'has_archive' => true,\n 'supports' => array(\n 'title',\n 'editor',\n 'thumbnail',\n 'custom-fields',\n 'excerpt',\n ),\n 'taxonomies' => array('category'),\n )\n );\n}", "function cptui_register_my_cpts_how_it_works() {\n\n\t$labels = array(\n\t\t\"name\" => __( \"How It Works\", \"esoftkulo\" ),\n\t\t\"singular_name\" => __( \"How it Work\", \"esoftkulo\" ),\n\t);\n\n\t$args = array(\n\t\t\"label\" => __( \"How It Works\", \"esoftkulo\" ),\n\t\t\"labels\" => $labels,\n\t\t\"description\" => \"\",\n\t\t\"public\" => true,\n\t\t\"publicly_queryable\" => true,\n\t\t\"show_ui\" => true,\n\t\t\"delete_with_user\" => false,\n\t\t\"show_in_rest\" => true,\n\t\t\"rest_base\" => \"\",\n\t\t\"rest_controller_class\" => \"WP_REST_Posts_Controller\",\n\t\t\"has_archive\" => false,\n\t\t\"show_in_menu\" => true,\n\t\t\"show_in_nav_menus\" => true,\n\t\t\"exclude_from_search\" => false,\n\t\t\"capability_type\" => \"post\",\n\t\t\"map_meta_cap\" => true,\n\t\t\"hierarchical\" => false,\n\t\t\"rewrite\" => array( \"slug\" => \"how_it_works\", \"with_front\" => true ),\n\t\t\"query_var\" => true,\n\t\t\"supports\" => array( \"title\", \"editor\", \"thumbnail\" ),\n\t);\n\n\tregister_post_type( \"how_it_works\", $args );\n}", "function add_my_custom_posttype_waarden(){\n //LABELS DIFINIËREN\n $labels = array(\n 'add_new' => 'Voeg nieuwe waarde toe',\n 'add_new_item' => 'Voeg nieuwe waarde toe',\n 'name' => 'waarden',\n 'singular_name' => 'waarden',\n );\n //ARGUMENTEN DIFINIËREN\n $args = array(\n 'labels' => $labels, // de array labels van hier boven linken aan het argument labels\n 'Description' => 'waarden van Ben & Jerry',\n 'public' => true,\n 'menu_position' => 6,\n 'menu_icon' => 'dashicons-layout', //Een icoon kiezen\n 'supports' => array('title', 'editor', 'thumbnail'), \n 'has_archive' => true, //Maak een archief aan (opsomming van alle elementen), anders gaan we archive-waarden.php nooit kunnen aanspreken.\n 'show_in_nav_menus' => TRUE,\n \n );\n register_post_type( 'waarden', $args ); \n }", "function custom_post_type() {\n $labels = array(\n 'name' => _x( 'Ort', 'Post Type General Name', 'twentythirteen' ),\n 'singular_name' => _x( 'Ort', 'Post Type Singular Name', 'twentythirteen' ),\n 'menu_name' => __( 'Orter', 'twentythirteen' ),\n 'all_items' => __( 'Alla Orter', 'twentythirteen' ),\n 'view_item' => __( 'View Ort', 'twentythirteen' ),\n 'add_new_item' => __( 'Skapa ny Ort', 'twentythirteen' ),\n 'add_new' => __( 'Skapa ny Ort', 'twentythirteen' ),\n 'edit_item' => __( 'Redigera Ort', 'twentythirteen' ),\n 'update_item' => __( 'Upddatera Ort', 'twentythirteen' ),\n 'search_items' => __( 'Sök Ort', 'twentythirteen' ),\n 'not_found' => __( 'Not Found', 'twentythirteen' ),\n 'not_found_in_trash' => __( 'Not found in Trash', 'twentythirteen' ),\n );\n \n $args = array(\n 'label' => __( 'cities', 'twentythirteen' ),\n 'description' => __( 'City Post Page', 'twentythirteen' ),\n 'labels' => $labels,\n 'supports' => array('title','thumbnail',),\n 'hierarchical' => false,\n 'public' => true,\n 'show_ui' => true,\n 'show_in_menu' => true,\n 'show_in_nav_menus' => true,\n 'show_in_admin_bar' => true,\n 'menu_position' => 5,\n 'can_export' => true,\n 'has_archive' => true,\n 'exclude_from_search' => false,\n 'publicly_queryable' => true,\n 'capability_type' => 'page',\n );\n \n register_post_type( 'cities', $args );\n\n }", "function wpmudev_create_post_type() {\n\t$labels = array(\n \t\t'name' => 'Actividades',\n \t'singular_name' => 'Actividad',\n \t'add_new' => 'Añade Nueva Actividad',\n \t'add_new_item' => 'Añade una nueva Actividad',\n \t'edit_item' => 'Edita la Actividad',\n \t'new_item' => 'Nueva Actividad',\n \t'all_items' => 'Todas las Actividades',\n \t'view_item' => 'Ver Actividad',\n \t'search_items' => 'Buscar Actividades',\n \t'not_found' => 'No se han encontrado Actividades',\n \t'not_found_in_trash' => 'No se han encontrado Actividades en la Papelera', \n \t'parent_item_colon' => '',\n \t'menu_name' => 'Actividades',\n );\n \n $args = array(\n\t\t'labels' => $labels,\n\t\t'has_archive' => true,\n \t\t'public' => true,\n\t\t'supports' => array( 'title', 'custom-fields', 'thumbnail', 'comments', 'page-attributes', 'author' ),\n\t\t'exclude_from_search' => false,\n\t\t'capability_type' => 'post',\n\t\t//'map_meta_caps' => true,\n\t\t'rewrite' => array( 'slug' => 'actividades' ),\n\t);\n\t\n\tregister_post_type( 'actividad', $args );\n}", "function add_custom_post_type() {\n\tregister_post_type( 'learning_resource',\n array(\n 'labels' => array(\n 'name' => __( 'Learning Resources' ),\n 'singular_name' => __( 'Learning Resource' )\n ),\n 'public' => true,\n 'has_archive' => true,\n )\n );\n}", "static function register() {\n // register the post type\n register_post_type('sale-flat', array(\n\t\t\n\t\t\t'labels'=> array(\n\t\t\t\t'name' => _x( 'Eladó ingatlanok', 'theme-phrases' ),\n\t\t\t\t'singular_name' => _x( 'Eladó ingatlan', 'theme-phrases' ),\n\t\t\t\t'menu_name' => _x( 'Eladó ingatlanok', 'theme-phrases' ),\n\t\t\t\t'name_admin_bar' => _x( 'Eladó ingatlan', 'theme-phrases' ),\n\t\t\t\t'add_new' => _x( 'Új eladó ingatlan', 'theme-phrases' ),\n\t\t\t\t'add_new_item' => __( 'Új eladó ingatlan hozzáadása', 'theme-phrases' ),\n\t\t\t\t'new_item' => __( 'Új eladó ingatlan', 'theme-phrases' ),\n\t\t\t\t'edit_item' => __( 'Eladó ingatlan szerkesztése', 'theme-phrases' ),\n\t\t\t\t'view_item' => __( 'Eladó ingatlan megtekintése', 'theme-phrases' ),\n\t\t\t\t'all_items' => __( 'Összes eladó ingatlan', 'theme-phrases' ),\n\t\t\t\t'search_items' => __( 'Eladó ingatlan keresése', 'theme-phrases' ),\n\t\t\t\t'parent_item_colon' => __( 'Parent eladó ingatlan:', 'theme-phrases' ),\n\t\t\t\t'not_found' => __( 'Nincsenek eladó ingatlanok.', 'theme-phrases' ),\n\t\t\t\t'not_found_in_trash' => __( 'Nincsenek eladó ingatlanok a kukában.', 'theme-phrases' )\n\t\t\t),\n 'description' => __('Eladó ingatlanok', 'theme-phrases'),\n 'exclude_from_search' => true,\n 'publicly_queryable' => true,\n 'public' => true,\n 'show_ui' => true,\n 'auto-draft' => false,\n 'show_in_admin_bar' => true,\n 'show_in_nav_menus' => true,\n 'menu_position' => 4,\n 'menu_icon'\t=> 'dashicons-tag',\n 'revisions' => false,\n 'hierarchical' => true,\n 'has_archive' => true,\n\t\t\t'supports' => array('title','editor','thumbnail'),\n 'rewrite' => false,\n 'can_export' => false,\n 'capabilities' => array (\n 'create_posts' => 'edit_posts',\n 'edit_post' => 'edit_posts',\n 'read_post' => 'edit_posts',\n 'delete_posts' => 'edit_posts',\n 'delete_post' => 'edit_posts',\n 'edit_posts' => 'edit_posts',\n 'edit_others_posts' => 'edit_posts',\n 'publish_posts' => 'edit_posts',\n 'read_private_posts' => 'edit_posts',\n ),\n 'register_meta_box_cb' => array('SaleFlatPostType', 'add_metabox') \n ));\n }", "public function register_content_type() {\n\t\t$labels = array(\n\t\t\t'name' => 'Honor Rolls',\n\t\t\t'singular_name' => 'Honor Roll',\n\t\t\t'add_new' => 'Add New',\n\t\t\t'add_new_item' => 'Add New Honor Roll',\n\t\t\t'edit_item' => 'Edit Honor Roll',\n\t\t\t'new_item' => 'New Honor Roll',\n\t\t\t'all_items' => 'All Honor Rolls',\n\t\t\t'view_item' => 'View Honor Rolls',\n\t\t\t'search_items' => 'Search Honor Rolls',\n\t\t\t'not_found' => 'No Honor Rolls found',\n\t\t\t'not_found_in_trash' => 'No Honor Rolls found in Trash',\n\t\t\t'menu_name' => 'Honor Rolls',\n\t\t);\n\n\t\t$args = array(\n\t\t\t'labels' => $labels,\n\t\t\t'public' => false,\n\t\t\t'publicly_queryable' => false,\n\t\t\t'show_ui' => true,\n\t\t\t'show_in_menu' => true,\n\t\t\t'query_var' => true,\n\t\t\t'rewrite' => false,\n\t\t\t'has_archive' => false,\n\t\t\t'hierarchical' => false,\n\t\t\t'supports' => array( 'title' ),\n\t\t);\n\t\tregister_post_type( $this::$content_type_slug, $args );\n\t}", "public function create_post_type() {\n\n register_post_type( self::POST_TYPE,\n array(\n\n 'labels' => array(\n 'name' => __( 'Fundraisers' ),\n 'singular_name' => __( 'Fundraiser' )\n ),\n 'description' => 'Fundraisers that allow users to purchase items through the WooCommerce Stores',\n 'menu_icon' => 'dashicons-chart-line',\n 'supports' => array( 'title', 'editor', 'thumbnail', 'excerpt',\n 'revisions' ),\n 'public' => true,\n 'has_archive' => true,\n 'rewrite' => array(\n 'slug' => __( 'fundraisers' ),\n 'with_front' => false\n )\n )\n );\n }", "function wpcp_custom_post_type()\n{\n register_post_type('wpcp_server',\n array(\n 'labels' => array(\n 'name' => __('Servers', 'textdomain'),\n 'singular_name' => __('Server', 'textdomain'),\n ),\n 'public' => true,\n 'has_archive' => false,\n 'delete_with_user' => false,\n \"supports\" => array(\"customer\", \"author\"),\n 'menu_icon' => 'dashicons-cloud'\n )\n );\n}", "function create_post_type(){\n register_post_type('recipes', [ \n 'labels' => [\n 'name' => 'Recipes', //Etikett i plural Etikett i singular\n 'singular_name' => 'Recipe', //Vad som ska stå i ”Lägg till...” knappen\n 'add_new' => 'New Recipe', //Vad som ska stå i ”Lägg till ny...” knappen\n 'add_new_item' => 'New Recipe', //Vad som ska stå i ”Ny...” länken\n 'edit_item' => 'Edit Recipe', //Vad som ska stå i ”Redigera...” länken\n 'new_item' => 'New Recipe', //Vad som ska stå i ”Ny...” länken\n 'search_items' => 'Search for Recipe', //Vad som ska stå i sökrutan i listningen\n 'not_found' => 'No Recipe Found', \n 'all_items' => 'All Recipes', //Vad som ska stå i ”Alla...” länken\n ],\n 'supports' => array( 'thumbnail' ),\n 'description' => 'The Big Tasty!', //En kort beskrivning av posttypen\n 'public' => true, //Om och hur posttypen ska visas för olika användare\n 'exclude_from_search' => false, //Om posttypens poster ska exkluderas vid sökning\n 'show_ui' => true, //Om posttypen ska kunna hanteras från admin\n 'show_in_nav_menus' => true, //Om poster av posttypen ska kunna läggas till i menyer\n 'show_in_menu' => true, //Vart posttypen ska listas i admin (vänster eller topp)\n 'show_in_admin_bar' => true, //Om posttypen ska visas i toppbar’en\n 'menu_position' => 10, //Vart i vänstermenyn posttypen ska visas\n 'hierarchical' => false, //Om poster i posttypen ska kunna ha föräldrar, likt Sidor\n 'menu_icon' => 'dashicons-food', //Ikon för posttypen\n 'supports' => array('title' , 'editor'), //Vad som ska synas när man skapar/redigerar en post \n 'taxonomies' => array('category'), //Vilka taxonomier som ska tillhöra posttypen\n 'has_archive' => true, //Om posttypen ska ha arkivsida\n 'rewrite' => [ //Hur posttypens rewrites ska hanteras...\n 'slug' => 'recipe', //Permalänkstrukturen för posttypen\n 'with_front' => true //Om permalänkarna ska låta föregås av sluggen\n ] \n ]);\n\n}", "function create_post_type() {\n\n // register external_post as a Custom Post Type\n register_post_type( 'external_post', \n array( \n 'labels' => array( \n 'name' => __('External Posts'), \n 'singular_name' => __('External Post') \n ),\n 'public' => true,\n 'menu_position' => 5,\n 'supports' => array('title', 'excerpt'),\n 'rewrite' => array('slug' => 'external','with_front' => false) \n ) \n ); \n\n // connect external_post to category taxonomy\n register_taxonomy_for_object_type('category', 'external_post');\n register_taxonomy_for_object_type('post_tag', 'external_post');\n\n\n // register wp_tool as a Custom Post Type\n register_post_type('wp_tool',\n array( \n 'labels' => array( \n 'name' => __('WordPress Tools'), \n 'singular_name' => __('WordPress Tool') \n ), \n 'public' => true, \n 'menu_position' => 5, \n 'supports' => array('title', 'author', 'editor', 'excerpt', 'thumbnail', 'post-formats', 'revisions', 'meta_info'),\n 'rewrite' => array('slug' => 'tool','with_front' => false) \n ) \n );\n\n // connect wp_tool to category taxonomy\n register_taxonomy_for_object_type('meta_info', 'wp_tool');\n register_taxonomy_for_object_type('category', 'wp_tool');\n\n\n // reregister default post so we can set a custom slug\n register_post_type('post', array(\n 'labels' => array(\n 'name_admin_bar' => _x('Post', 'add new on admin bar' ),\n ),\n 'public' => true,\n '_builtin' => false, \n '_edit_link' => 'post.php?post=%d', \n 'capability_type' => 'post',\n 'map_meta_cap' => true,\n 'show_in_menu' => false,\n 'hierarchical' => false,\n 'rewrite' => array('slug' => 'article'),\n 'query_var' => false,\n 'supports' => array('title', 'editor', 'author', 'thumbnail', 'excerpt', 'trackbacks', 'custom-fields', 'comments', 'revisions', 'post-formats', 'column_info'),\n )); \n\n // register external_tool as a Custom Post Type\n register_post_type('external_tool',\n array(\n 'labels' => array( \n 'name' => __('External Tools'), \n 'singular_name' => __('External Tool') \n ), \n 'public' => true, \n 'menu_position' => 5, \n 'supports' => array('title', 'author', 'excerpt', 'thumbnail', 'revisions', 'meta_info'),\n 'rewrite' => array('slug' => 'special','with_front' => false) \n ) \n ); \n\n // connect external_tool to category taxonomy\n register_taxonomy_for_object_type('category', 'external_tool');\n register_taxonomy_for_object_type('meta_info', 'external_tool');\n\n\n // register city_journal as a Custom Post Type\n register_post_type('city_journal',\n array(\n 'labels' => array( \n 'name' => __('CityJournal Entry'),\n 'singular_name' => __('CityJournal Entry')\n ), \n 'public' => true, \n 'menu_position' => 5, \n 'supports' => array('title', 'editor', 'author', 'excerpt', 'thumbnail', 'revisions', 'meta_info', 'comments'),\n 'rewrite' => array('slug' => 'cityjournal','with_front' => false) \n ) \n ); \n\n // connect city_journal to category taxonomy\n register_taxonomy_for_object_type('category', 'city_journal');\n register_taxonomy_for_object_type('meta_info', 'city_journal'); \n\n\n // register people_project as a Custom Post Type\n register_post_type('people_project',\n array(\n 'labels' => array( \n 'name' => __('People & Projects'),\n 'singular_name' => __('People & Project')\n ), \n 'public' => true, \n 'menu_position' => 5, \n 'supports' => array('title', 'excerpt', 'thumbnail', 'meta_info'),\n ) \n ); \n\n // connect people_project to category taxonomy\n register_taxonomy_for_object_type('meta_info', 'people_project'); \n\n\n register_post_type('discussion',\n array( \n 'labels' => array( \n 'name' => __('Discussions'), \n 'singular_name' => __('Discussion') \n ), \n 'public' => true, \n 'menu_position' => 5, \n 'supports' => array('title', 'editor', 'excerpt', 'thumbnail', 'post-formats', 'revisions', 'meta_info', 'comments'),\n 'rewrite' => array('slug' => 'discussion','with_front' => false) \n ) \n );\n\n // connect discussion to category taxonomy\n register_taxonomy_for_object_type('meta_info', 'discussion');\n register_taxonomy_for_object_type('category', 'discussion');\n\n}", "function bs_configure_custom_post_types($args)\n{\n function bs_custom_post_types()\n {\n global $bs_config;\n\n foreach ($bs_config[\"custom-post-types\"] as $key => $type) {\n $type = bs_defaults($type, [\n \"public\" => true,\n ]);\n\n if (isset($type[\"name\"])) {\n $type[\"labels\"][\"name\"] = $type[\"name\"];\n }\n\n if (isset($type[\"slug\"])) {\n $type[\"rewrite\"][\"slug\"] = $type[\"slug\"];\n }\n\n if (isset($type[\"admin_only\"]) && $type[\"admin_only\"]) {\n $type[\"public\"] = false;\n $type[\"show_ui\"] = true;\n }\n\n register_post_type($key, bs_array_omit($type, [\"slug\", \"name\", \"admin_only\"]));\n }\n }\n add_action(\"init\", \"bs_custom_post_types\");\n}", "function add_my_custom_posttype_recepten(){\n //LABELS DIFINIËREN\n $labels = array(\n 'add_new' => 'Voeg nieuw recept toe',\n 'add_new_item' => 'Voeg nieuw recept toe',\n 'name' => 'Recepten',\n 'singular_name' => 'recept',\n );\n //ARGUMENTEN DIFINIËREN\n $args = array(\n 'labels' => $labels, // de array labels van hier boven linken aan het argument labels\n 'Description' => 'Lactosevrije recepten van B & J',\n 'public' => true,\n 'menu_position' => 4,\n 'menu_icon' => 'dashicons-book-alt', //Een icoon kiezen\n 'supports' => array('title', 'editor', 'thumbnail', 'page-attributes', 'comments'), \n 'has_archive' => true, //Maak een archief aan (opsomming van alle elementen), anders gaan we archive-recepten.php nooit kunnen aanspreken.\n 'show_in_nav_menus' => TRUE,\n\n );\n\n register_post_type( 'recepten', $args ); \n \n }", "function create_post_type() {\r\n register_post_type( 'nyheter',\r\n array(\r\n 'labels' => array(\r\n 'name' => __( 'Nyheter' ),\r\n 'singular_name' => __( 'Nyheter' )\r\n ),\r\n 'public' => true,\r\n 'has_archive' => true,\r\n 'supports' => array('title', 'editor', 'thumbnail')\r\n )\r\n );\r\n}", "function zmpm_register_post_type() {\n\t\n\t$labels = array(\n\t\t'name' => 'Permissions',\n\t\t'singular_name' => 'Permission',\n\t\t'menu_name' => 'Permissions',\n\t\t'name_admin_bar' => 'Permission',\n\t\t'archives' => 'Permission Archives',\n\t\t'attributes' => 'Permission Attributes',\n\t\t'parent_item_colon' => 'Parent Permission:',\n\t\t'all_items' => 'Permissions',\n\t\t'add_new_item' => 'Add New Permission',\n\t\t'add_new' => 'Add New',\n\t\t'new_item' => 'New Permission',\n\t\t'edit_item' => 'Edit Permission',\n\t\t'update_item' => 'Update Permission',\n\t\t'view_item' => 'View Permission',\n\t\t'view_items' => 'View Permissions',\n\t\t'search_items' => 'Search Permission',\n\t\t'not_found' => 'Not found',\n\t\t'not_found_in_trash' => 'Not Found in Trash',\n\t\t'featured_image' => 'Featured Image',\n\t\t'set_featured_image' => 'Set featured image',\n\t\t'remove_featured_image' => 'Remove featured image',\n\t\t'use_featured_image' => 'Use as featured image',\n\t\t'insert_into_item' => 'Insert into permission',\n\t\t'uploaded_to_this_item' => 'Uploaded to this permission',\n\t\t'items_list' => 'Permissions list',\n\t\t'items_list_navigation' => 'Permissions list navigation',\n\t\t'filter_items_list' => 'Filter permissions list',\n\t);\n\t$args = array(\n\t\t'label' => 'Permission',\n\t\t'description' => 'ZingMap permissions',\n\t\t'labels' => $labels,\n\t\t'supports' => array( 'title' ),\n\t\t'hierarchical' => false,\n\t\t'public' => false,\n\t\t'show_ui' => true,\n\t\t'show_in_menu' => 'users.php',\n\t\t'menu_position' => 5,\n\t\t'menu_icon' => 'dashicons-lock',\n\t\t'show_in_admin_bar' => true,\n\t\t'show_in_nav_menus' => false,\n\t\t'can_export' => true,\n\t\t'has_archive' => false,\n\t\t'exclude_from_search' => true,\n\t\t'publicly_queryable' => true,\n\t\t'capability_type' => 'page',\n\t);\n\tregister_post_type( 'zmpm_permission', $args );\n\t\n}", "public function register_estate_post_type() {\r\n $options = get_option( 'myhome_redux' );\r\n // define post type slug\r\n if ( ! empty( $options['mh-estate-slug'] ) ) {\r\n $slug = $options['mh-estate-slug'];\r\n } else {\r\n $slug = 'properties';\r\n }\r\n\r\n register_post_type( 'estate', array(\r\n 'labels' => array(\r\n 'name'\t\t\t => esc_html__( 'Properties', 'myhome-core' ),\r\n 'singular_name'\t => esc_html__( 'Property', 'myhome-core' ),\r\n 'menu_name' => esc_html__( 'Properties', 'myhome-core' ),\r\n 'name_admin_bar' => esc_html__( 'Add New Property', 'myhome-core' ),\r\n 'add_new' => esc_html__( 'Add New Property', 'myhome-core' ),\r\n 'add_new_item' => esc_html__( 'Add New Property', 'myhome-core' ),\r\n 'new_item' => esc_html__( 'New Property', 'myhome-core' ),\r\n 'edit_item' => esc_html__( 'Edit Property', 'myhome-core' ),\r\n 'view_item' => esc_html__( 'View Property', 'myhome-core' ),\r\n 'all_items' => esc_html__( 'Properties', 'myhome-core' ),\r\n 'search_items' => esc_html__( 'Search property', 'myhome-core' ),\r\n 'not_found' => esc_html__( 'No Property Found found.', 'myhome-core' ),\r\n 'not_found_in_trash' => esc_html__( 'No Property found in Trash.', 'myhome-core' )\r\n ),\r\n 'show_in_rest' => true,\r\n 'query_var' => true,\r\n 'public'\t\t => true,\r\n 'has_archive'\t => true,\r\n 'menu_position' => 21,\r\n 'menu_icon' => 'dashicons-admin-home',\r\n 'capability_type' => array( 'estate', 'estates' ),\r\n 'map_meta_cap' => true,\r\n 'rewrite'\t\t => array( 'slug' => $slug ),\r\n 'supports'\t\t => array(\r\n 'title',\r\n 'author',\r\n 'editor',\r\n 'thumbnail',\r\n )\r\n ) );\r\n }", "function create_volunteer_custom_post() {\n register_post_type( 'volunteers',\n array(\n 'labels' => array(\n 'name' => __( 'Board Members' ),\n 'singular_name' => __( 'Board Member' ),\n ),\n 'public' => true,\n 'has_archive' => true,\n 'supports' => array(\n 'title',\n 'editor',\n 'thumbnail',\n 'custom-fields'\n )\n ));\n}", "public function registerPostTypes()\n {\n $projectLabels = array(\n 'name' => __( 'Projects'),\n 'singular_name' => __( 'Project'),\n 'menu_name' => __( 'Projects'),\n 'parent_item_colon' => __( 'Parent Project'),\n 'all_items' => __( 'All Projects'),\n 'view_item' => __( 'View Project'),\n 'add_new_item' => __( 'Add New Project'),\n 'add_new' => __( 'Add New'),\n 'edit_item' => __( 'Edit Project'),\n 'update_item' => __( 'Update Project'),\n 'search_items' => __( 'Search Project'),\n 'not_found' => __( 'Not Found'),\n 'not_found_in_trash' => __( 'Not found in Trash'),\n );\n $componentLabels = array(\n 'name' => __( 'Components'),\n 'singular_name' => __( 'Component'),\n 'menu_name' => __( 'Components'),\n 'parent_item_colon' => __( 'Parent Component'),\n 'all_items' => __( 'All Components'),\n 'view_item' => __( 'View Component'),\n 'add_new_item' => __( 'Add New Component'),\n 'add_new' => __( 'Add New'),\n 'edit_item' => __( 'Edit Component'),\n 'update_item' => __( 'Update Component'),\n 'search_items' => __( 'Search Component'),\n 'not_found' => __( 'Not Found'),\n 'not_found_in_trash' => __( 'Not found in Trash'),\n );\n $componentTypeTaxLabels = array(\n 'name' => __('Component types'),\n 'singular_name' => __('Component type'),\n 'search_items' => __( 'Search Component types' ),\n 'popular_items' => __( 'Popular Component types' ),\n 'all_items' => __( 'All Component types' ),\n 'parent_item' => null,\n 'parent_item_colon' => null,\n 'edit_item' => __( 'Edit Component type' ),\n 'update_item' => __( 'Update Component type' ),\n 'add_new_item' => __( 'Add New Component type' ),\n 'new_item_name' => __( 'New Component type Name' ),\n 'separate_items_with_commas' => __( 'Separate component types with commas' ),\n 'add_or_remove_items' => __( 'Add or remove component types' ),\n 'choose_from_most_used' => __( 'Choose from the most used ones' ),\n 'menu_name' => __( 'Component types' ),\n ); \n \n // Set other options for custom post types\n $projectArgs = array(\n 'label' => __( 'projects'),\n 'description' => __( 'Stuff that you have done or used'),\n 'labels' => $projectLabels,\n 'supports' => array( 'title', 'editor', 'excerpt', 'author', 'thumbnail', 'comments', 'revisions', 'custom-fields'),\n 'hierarchical' => false,\n 'public' => true,\n 'show_ui' => true,\n 'show_in_menu' => true,\n 'show_in_nav_menus' => true,\n 'show_in_admin_bar' => true,\n 'menu_position' => 6,\n 'can_export' => true,\n 'has_archive' => true,\n 'exclude_from_search' => false,\n 'publicly_queryable' => true,\n 'capability_type' => 'page',\n );\n \n $componentArgs = array(\n 'label' => __( 'components'),\n 'description' => __( 'Things used in projects'),\n 'labels' => $componentLabels,\n 'supports' => array( 'title', 'editor', 'excerpt', 'author', 'thumbnail', 'comments', 'revisions', 'custom-fields'),\n 'taxonomies' => array('components'),\n 'hierarchical' => false,\n 'public' => true,\n 'show_ui' => true,\n 'show_in_menu' => true,\n 'show_in_nav_menus' => true,\n 'show_in_admin_bar' => true,\n 'menu_position' => 7,\n 'can_export' => true,\n 'has_archive' => true,\n 'exclude_from_search' => false,\n 'publicly_queryable' => true,\n 'capability_type' => 'page',\n );\n \n $componentTypeTaxArgs = array(\n 'hierarchical' => false,\n 'labels' => $componentTypeTaxLabels,\n 'show_ui' => true,\n 'show_admin_column' => true,\n 'update_count_callback' => '_update_post_term_count',\n 'query_var' => true,\n 'rewrite' => array( 'slug' => 'type' ),\n );\n \n // Registering your Custom Post Type\n register_taxonomy('component_type', 'component', $componentTypeTaxArgs);\n register_post_type('component', $componentArgs);\n register_post_type( 'project', $projectArgs );\n }", "public function register_post_type()\n\t{\n\n\t\tregister_taxonomy( $this->post_type_name . '_words', $this->post_type_name, array(\n\t\t\t'label' => 'Words',\n\t\t\t'labels' => array(\n\t\t\t\t'singular_name' => 'Word',\n\t\t\t\t'menu_name' => 'Words',\n\t\t\t\t'all_items' => 'All words',\n\t\t\t\t'edit_item' => 'Edit word',\n\t\t\t\t'view_item' => 'View word',\n\t\t\t\t'update_item' => 'View word',\n\t\t\t\t'add_new_item' => 'Add word',\n\t\t\t\t'new_item_name' => 'New word',\n\t\t\t\t'search_items' => 'Search words',\n\t\t\t\t'popular_items' => 'Popular words',\n\t\t\t\t'separate_items_with_commas' => 'Separate words with commas',\n\t\t\t\t'add_or_remove_items' => 'Add or remove words',\n\t\t\t\t'choose_from_most_used' => 'Choose from most used words',\n\t\t\t\t'not_found' => 'No words found',\n\t\t\t),\n\t\t\t'show_ui' => FALSE,\n\t\t\t'show_admin_column' => FALSE,\n\t\t\t'query_var' => TRUE,\n\t\t\t'rewrite' => array(\n\t\t\t\t'slug' => 'word',\n\t\t\t\t'with_front' => FALSE,\n\t\t\t),\n\t\t));\n\n\t\tregister_taxonomy( $this->post_type_name . '_partsofspeech', $this->post_type_name, array(\n\t\t\t'label' => 'Parts of Speech',\n\t\t\t'labels' => array(\n\t\t\t\t'singular_name' => 'Part of Speech',\n\t\t\t\t'menu_name' => 'Parts of Speech',\n\t\t\t\t'all_items' => 'All parts of speech',\n\t\t\t\t'edit_item' => 'Edit part of speech',\n\t\t\t\t'view_item' => 'View part of speech',\n\t\t\t\t'update_item' => 'View part of speech',\n\t\t\t\t'add_new_item' => 'Add part of speech',\n\t\t\t\t'new_item_name' => 'New part of speech',\n\t\t\t\t'search_items' => 'Search parts of speech',\n\t\t\t\t'popular_items' => 'Popular parts of speech',\n\t\t\t\t'separate_items_with_commas' => 'Separate parts of speech with commas',\n\t\t\t\t'add_or_remove_items' => 'Add or remove parts of speech',\n\t\t\t\t'choose_from_most_used' => 'Choose from most used parts of speech',\n\t\t\t\t'not_found' => 'No parts of speech found',\n\t\t\t),\n\t\t\t'show_ui' => FALSE,\n\t\t\t'show_admin_column' => TRUE,\n\t\t\t'query_var' => TRUE,\n\t\t\t'rewrite' => array(\n\t\t\t\t'slug' => 'partofspeech',\n\t\t\t\t'with_front' => FALSE,\n\t\t\t),\n\t\t));\n\n\t\t// register the damn post type already\n\t\tregister_post_type( \n\t\t\t$this->post_type_name,\n\t\t\tarray(\n\t\t\t\t'labels' => array(\n\t\t\t\t\t'name' => 'Definitions',\n\t\t\t\t\t'singular_name' => 'Definition',\n\t\t\t\t\t'add_new' => 'Add New',\n\t\t\t\t\t'add_new_item' => 'Add New Definition',\n\t\t\t\t\t'edit_item' => 'Edit Definition',\n\t\t\t\t\t'new_item' => 'New Definition',\n\t\t\t\t\t'all_items' => 'All Definitions',\n\t\t\t\t\t'view_item' => 'View Definitions',\n\t\t\t\t\t'search_items' => 'Search Definitions',\n\t\t\t\t\t'not_found' => 'No definitions found',\n\t\t\t\t\t'not_found_in_trash' => 'No definitions found in Trash',\n\t\t\t\t\t'parent_item_colon' => '',\n\t\t\t\t\t'menu_name' => 'Definitions',\n\t\t\t\t),\n\t\t\t\t'supports' => array(\n\t\t\t\t\t'title',\n\t\t\t\t\t'editor',\n\t\t\t\t\t'thumbnail',\n\t\t\t\t\t'trackbacks',\n\t\t\t\t\t'comments',\n\t\t\t\t\t'revisions',\n\t\t\t\t),\n\t\t\t\t'public' => TRUE,\n\t\t\t\t'has_archive' => 'definitions',\n\t\t\t\t'rewrite' => array(\n\t\t\t\t\t'slug' => 'define',\n\t\t\t\t\t'with_front' => FALSE,\n\t\t\t\t),\n\t\t\t\t'register_meta_box_cb' => array( $this, 'metaboxes' ),\n\t\t\t\t'public' => TRUE,\n\t\t\t\t'taxonomies' => array(\n\t\t\t\t\t$this->post_type_name . '_partsofspeech',\n\t\t\t\t\t$this->post_type_name . '_words',\n\t\t\t\t),\n\t\t\t\t'menu_position' => 5,\n\t\t\t)\n\t\t);\n\t}", "function BH_register_posttypes() {\r\n\r\n\tBH_register_posttype_event();\r\n\tBH_register_posttype_gallery();\r\n\r\n}", "public function createPostTypes()\n {\n }", "function register_content_type( $singular, $plural, $type, $ns = 'theme' )\n{\n // Hook into the 'init' action\n add_action( 'init', function() use ( $singular, $plural, $type, $ns ) {\n\n $labels = [\n 'name' => _x( $plural, 'Post Type General Name', $ns ),\n 'singular_name' => _x( $singular, 'Post Type Singular Name', $ns ),\n 'menu_name' => __( $plural, $ns ),\n 'parent_item_colon' => __( 'Parent ' . $singular . ':', $ns ),\n 'all_items' => __( 'All ' . $plural, $ns ),\n 'view_item' => __( 'View ' . $singular, $ns ),\n 'add_new_item' => __( 'Add New ' . $singular, $ns ),\n 'add_new' => __( 'Add New', $ns ),\n 'edit_item' => __( 'Edit ' . $singular, $ns ),\n 'update_item' => __( 'Update ' . $singular, $ns ),\n 'search_items' => __( 'Search ' . $plural, $ns ),\n 'not_found' => __( 'Not found', $ns ),\n 'not_found_in_trash' => __( 'Not found in Trash', $ns ),\n ];\n $args = [\n 'label' => __( $singular, $ns ),\n 'description' => __( $plural, $ns ),\n 'labels' => $labels,\n 'supports' => [ 'title', 'editor', 'custom-fields', 'thumbnail' ],\n 'taxonomies' => [ 'category', 'post_tag' ],\n 'hierarchical' => false,\n 'public' => true,\n 'show_ui' => true,\n 'show_in_nav_menus' => true,\n 'show_in_admin_bar' => true,\n 'menu_position' => 5,\n 'can_export' => true,\n 'has_archive' => true,\n 'exclude_from_search' => false,\n 'publicly_queryable' => true,\n 'capability_type' => 'page',\n ];\n register_post_type( $type, $args );\n\n }, 0 );\n}", "protected function addPostType()\n {\n WordPress::registerType('lbwp-nl', 'Newsletter', 'Newsletter', array(\n 'show_in_menu' => 'newsletter',\n 'publicly_queryable' => false,\n 'exclude_from_search' => true,\n 'supports' => array('title')\n ), 'n');\n }", "function register_type( $post_type_singular, $post_type_plural, $options = array() ) {\n\n\t$text_domain = 'sgdf';\n\n\t$labels = array(\n\t\t'name' => _x( ucwords( $post_type_plural ), 'post type general name', $text_domain ),\n\t\t'singular_name' => _x( ucwords( $post_type_singular ), 'post type singular name', $text_domain ),\n\t\t'menu_name' => _x( ucwords( $post_type_plural ), 'admin menu', $text_domain ),\n\t\t'name_admin_bar' => _x( ucwords( $post_type_singular ), 'add new on admin bar', $text_domain ),\n\t\t'add_new' => _x( 'Add New', 'book', $text_domain ),\n\t\t'add_new_item' => __( 'Add New ' . ucwords( $post_type_singular ), $text_domain ),\n\t\t'new_item' => __( 'New ' . ucwords( $post_type_singular ), $text_domain ),\n\t\t'edit_item' => __( 'Edit ' . ucwords( $post_type_singular ), $text_domain ),\n\t\t'view_item' => __( 'View ' . ucwords( $post_type_singular ), $text_domain ),\n\t\t'all_items' => __( 'All ' . ucwords( $post_type_plural ), $text_domain ),\n\t\t'search_items' => __( 'Search ' . ucwords( $post_type_plural ), $text_domain ),\n\t\t'parent_item_colon' => __( 'Parent ' . ucwords( $post_type_plural ) . ':', $text_domain ),\n\t\t'not_found' => __( 'No ' . $post_type_plural . ' found.', $text_domain ),\n\t\t'not_found_in_trash' => __( 'No ' . $post_type_plural . ' found in Trash.', $text_domain )\n\t);\n\n\t$args = array(\n\t\t'labels' => $labels,\n\t\t'public' => true,\n\t\t'publicly_queryable' => true,\n\t\t'show_ui' => true,\n\t\t'show_in_menu' => true,\n\t\t'query_var' => true,\n\t\t'rewrite' => array( 'slug' => $post_type_singular ),\n\t\t'capability_type' => 'post',\n\t\t'has_archive' => true,\n\t\t'hierarchical' => false,\n\t\t'menu_position' => null,\n\t\t'menu_icon' \t => null,\n\t\t'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments' )\n\t);\n\n\tforeach ($options as $key => $option) {\n\t\t$args[$key] = $option;\n\t}\n\n\treturn register_post_type( $post_type_singular, $args );\n}", "public function register() {\r\n add_action('post_updated', array($this, 'save_meta'), null, 2 );\r\n\r\n $original_config = $this->get_config();\r\n // push it through a filter so a theme can change the terminology\r\n $filtered_config = apply_filters('ah-wp-dl-res-config',$original_config);\r\n register_post_type(self::POST_TYPE, $filtered_config);\r\n\r\n register_taxonomy(self::POST_TYPE . '_cat',\r\n array(self::POST_TYPE),\r\n array('hierarchical' => true,\r\n 'labels' => array(\r\n 'name' => __( 'Categories' ),\r\n 'singular_name' => __( 'Category' ),\r\n 'search_items' => __( 'Search Categories' ),\r\n 'all_items' => __( 'All Categories' ),\r\n 'parent_item' => __( 'Parent Category' ),\r\n 'parent_item_colon' => __( 'Parent Category:' ),\r\n 'edit_item' => __( 'Edit Category' ),\r\n 'update_item' => __( 'Update Category' ),\r\n 'add_new_item' => __( 'Add New Category' ),\r\n 'new_item_name' => __( 'New Category Name')\r\n ),\r\n 'show_ui' => true,\r\n 'query_var' => true,\r\n 'rewrite' => array( 'slug' => 'documents/categories' ),\r\n )\r\n );\r\n }", "function stock_toolkit_custom_post()\n\t{\n\tregister_post_type('slide', array(\n\t\t'labels' => array(\n\t\t\t'name' => __('Slides') ,\n\t\t\t'singular_name' => __('Slide')\n\t\t) ,\n\t\t'supports' => array(\n\t\t\t'title',\n\t\t\t'editor',\n\t\t\t'custom-fields',\n\t\t\t'thumbnail',\n\t\t\t'page-attributes'\n\t\t) ,\n\t\t'public' => false,\n\t\t'show_ui' => true\n\t));\n\t}", "function testimonials_register_post_type() {\n\n $labels = [\n 'name' => __('Testimonials'),\n 'singular_name' => __('Testimonial'),\n 'add_new' => __('Add new', 'Testimonials'),\n 'add_new_item' => __('Add new Testimonial'),\n 'edit_item' => __('Edit Testimonial'),\n 'new_item' => __('New Testimonial'),\n 'view_item' => __('View Testimonial'),\n 'search_item' => __('Search Testimonials'),\n 'not_found' => __('No Testimonial found'),\n 'not_found_in_trash' => __('No Testimonial found in trash'),\n 'parent_item_colon' => ''\n ];\n\n register_post_type(TESTIMONIAL_TYPE, [\n 'labels' => $labels,\n 'public' => true,\n 'exclude_from_search' => true,\n 'has_archive' => true,\n 'hierarchical' => false,\n 'supports' => ['title', 'editor', 'custom-fields']\n ]);\n\n register_taxonomy_for_object_type(CRAFT_TAX_NAME, TESTIMONIAL_TYPE);\n}", "public function post_type() {\n\t\t$labels = array(\n\t\t\t'name' => __( 'Departamentos'),\n\t\t\t'singular_name' => __( 'Departamento' ),\n\t\t\t'add_new' => __('Añadir nuevo'),\n\t\t\t'add_new_item' => __('Añadir nuevo Departamento'),\n\t\t\t'edit_item' => __('Editar Departamento'),\n\t\t\t'new_item' => __('Nuevo Departamento'),\n\t\t\t'view_item' => __('Ver Departamento'),\n\t\t\t'search_items' => __('Buscar'),\n\t\t\t'not_found' => __('No se encontraron Departamentos'),\n\t\t\t'not_found_in_trash' => __('No se encontraron Departamentos en la Papelera'), \n\t\t\t'parent_item_colon' => ''\n\t\t );\n\t\t \n\t\t $args = array(\n\t\t\t'labels' => $labels,\n\t\t\t'public' => true,\n\t\t\t'publicly_queryable' => true,\n\t\t\t'show_ui' => true, \n\t\t\t'query_var' => true,\n\t 'has_archive' => true,\n\t\t\t'capability_type' => 'post',\n\t\t\t'hierarchical' => true,\n\t\t 'show_ui' => true,\n\t\t\t'show_in_nav_menus' => true,\n\t\t 'show_in_menu' => 'bn_config',\n\t\t\t'menu_position' => 57,\n\t\t\t'menu_icon' => 'dashicons-clipboard',\n\t\t\t'rewrite' => array('slug' => __( $this->post_type )),\n\t\t\t'supports' => array('title', 'excerpt', 'page-attributes') //,'editor'\n\t\t );\n\t\t \n\t\t register_post_type(__( $this->post_type ), $args);\n\t}", "public function register_location_content_type(){\n\t\t //Labels for post type\n\t\t $labels = array(\n 'name' => 'Add Portfolio',\n 'singular_name' => 'Portfolio',\n 'menu_name' => 'Add Portfolio',\n 'name_admin_bar' => 'Add Portfolio',\n 'add_new' => 'Add New', \n 'add_new_item' => 'Add New Portfolio Item',\n 'new_item' => 'New Portfolio Item', \n 'edit_item' => 'Edit Portfolio Item',\n 'view_item' => 'View Portfolio Item',\n 'all_items' => 'All Portfolio Items',\n 'search_items' => 'Search Portfolio Items',\n 'parent_item_colon' => 'Parent Portfolio Item: ', \n 'not_found' => 'No Portfolio Items found.', \n 'not_found_in_trash' => 'No Portfolio Items found in Trash.',\n );\n //arguments for post type\n $args = array(\n 'labels' => $labels,\n 'public' => true,\n 'publicly_queryable'=> true,\n 'show_ui' => true,\n 'show_in_nav' => true,\n 'query_var' => true,\n 'hierarchical' => false,\n 'supports' => array('title','thumbnail','editor'),\n 'has_archive' => true,\n 'menu_position' => 20,\n 'show_in_admin_bar' => true,\n 'menu_icon' => 'dashicons-location-alt',\n 'rewrite'\t\t\t=> array('slug' => 'locations', 'with_front' => 'true')\n );\n //register post type\n register_post_type('wp_locations', $args);\n\t}", "function custom_post_type() {\n\n// Set UI labels for Custom Post Type\n\t$labels = array(\n\t\t'name' => _x( 'Новости', 'Новости сайта', 'p1atform' ),\n\t\t'singular_name' => _x( 'Новость', 'Post Type Singular Name', 'p1atform' ),\n\t\t'menu_name' => __( 'Новости', 'p1atform' ),\n\t\t'parent_item_colon' => __( 'Parent Новость', 'p1atform' ),\n\t\t'all_items' => __( 'Все новости', 'p1atform' ),\n\t\t'view_item' => __( 'Просмотреть новость', 'p1atform' ),\n\t\t'add_new_item' => __( 'Добавить новость', 'p1atform' ),\n\t\t'add_new' => __( 'Добавить новость', 'p1atform' ),\n\t\t'edit_item' => __( 'Редактировать новость', 'p1atform' ),\n\t\t'update_item' => __( 'Обновить новость', 'p1atform' ),\n\t\t'search_items' => __( 'Поиск новости', 'p1atform' ),\n\t);\n\n\t$args = array(\n\t\t'label' => __( 'Отзывы', 'p1atform' ),\n\t\t'description' => __( 'Отзывы', 'p1atform' ),\n\t\t'labels' => $labels,\n\t\t'supports' => array(\n\t\t\t'title',\n\t\t\t'editor',\n\t\t\t'excerpt',\n\t\t\t'author',\n\t\t\t'thumbnail',\n\t\t\t'comments',\n\t\t\t'revisions',\n\t\t\t'custom-fields'\n\t\t),\n\t\t'hierarchical' => false,\n\t\t'public' => true,\n\t\t'show_ui' => true,\n\t\t'show_in_menu' => true,\n\t\t'show_in_nav_menus' => true,\n\t\t'show_in_admin_bar' => true,\n\t\t'menu_position' => 5,\n\t\t'menu_icon' => 'dashicons-format-aside',\n\t\t'can_export' => true,\n\t\t'has_archive' => true,\n\t\t'exclude_from_search' => false,\n\t\t'publicly_queryable' => true,\n\t\t'capability_type' => 'post',\n\t);\n\n\tregister_post_type( 'news', $args );\n\n\t$labels = array(\n\t\t'name' => _x( 'Клиенты', 'Новости сайта', 'p1atform' ),\n\t\t'singular_name' => _x( 'Клиент', 'Post Type Singular Name', 'p1atform' ),\n\t\t'menu_name' => __( 'Клиенты', 'p1atform' ),\n\t\t'parent_item_colon' => __( 'Парент Клиент', 'p1atform' ),\n\t\t'all_items' => __( 'Все клиенты', 'p1atform' ),\n\t\t'view_item' => __( 'Просмотреть клиента', 'p1atform' ),\n\t\t'add_new_item' => __( 'Добавить клиента', 'p1atform' ),\n\t\t'add_new' => __( 'Добавить клиента', 'p1atform' ),\n\t\t'edit_item' => __( 'Редактировать клиента', 'p1atform' ),\n\t\t'update_item' => __( 'Обновить клиента', 'p1atform' ),\n\t\t'search_items' => __( 'Поиск клиента', 'p1atform' ),\n\t);\n\n\t$args = array(\n\t\t'labels' => $labels,\n\t\t'supports' => array(\n\t\t\t'title',\n\t\t\t'editor',\n\t\t\t'excerpt',\n\t\t\t'author',\n\t\t\t'thumbnail',\n\t\t\t'comments',\n\t\t\t'revisions',\n\t\t\t'custom-fields',\n\t\t),\n\t\t'hierarchical' => false,\n\t\t'public' => true,\n\t\t'show_ui' => true,\n\t\t'show_in_menu' => true,\n\t\t'show_in_nav_menus' => true,\n\t\t'show_in_admin_bar' => true,\n\t\t'menu_position' => 6,\n\t\t'menu_icon' => 'dashicons-admin-users',\n\t\t'can_export' => true,\n\t\t'has_archive' => true,\n\t\t'exclude_from_search' => false,\n\t\t'publicly_queryable' => true,\n\t\t'capability_type' => 'post',\n\t);\n\n\tregister_post_type( 'clients', $args );\n\n\tregister_post_type( 'reviews', array(\n\t\t'labels' => array(\n\t\t\t'name' => 'Отзывы', // Основное название типа записи\n\t\t\t'singular_name' => 'Отзыв', // отдельное название записи типа Book\n\t\t\t'add_new' => 'Добавить Отзыв',\n\t\t\t'add_new_item' => 'Добавить Отзыв',\n\t\t\t'edit_item' => 'Редактировать Отзыв',\n\t\t\t'new_item' => 'Новая Отзыв',\n\t\t\t'view_item' => 'Посмотреть Отзыв',\n\t\t\t'search_items' => 'Найти Отзыв',\n\t\t\t'not_found' => 'Книг не найдено',\n\t\t\t'not_found_in_trash' => 'В корзине книг не найдено',\n\t\t\t'parent_item_colon' => '',\n\t\t\t'menu_name' => 'Отзывы'\n\n\t\t),\n\t\t'public' => true,\n\t\t'publicly_queryable' => true,\n\t\t'show_ui' => true,\n\t\t'show_in_menu' => true,\n\t\t'query_var' => true,\n\t\t'rewrite' => true,\n\t\t'capability_type' => 'post',\n\t\t'has_archive' => true,\n\t\t'menu_position' => 5,\n\t\t'menu_icon' => 'dashicons-format-chat',\n\t\t'hierarchical' => false,\n\t\t'menu_position' => null,\n\t\t'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments' )\n\t) );\n\n}", "function humcore_register_post_type() {\n\n\t// Define the labels to be used by the post type humcore_deposits.\n\t$labels = array(\n\t\t// 'name' => _x( 'HumCORE Deposits', 'post type general name', 'humcore_domain' ),\n\t\t'singular_name' => _x( 'Deposit', 'post type singular name', 'humcore_domain' ),\n\t\t'menu_name' => _x( 'HumCORE Deposits', 'admin menu', 'humcore_domain' ),\n\t\t'name_admin_bar' => _x( 'Deposit', 'add new on admin bar', 'humcore_domain' ),\n\t\t'add_new' => _x( 'Add New', 'add new', 'humcore_domain' ),\n\t\t'add_new_item' => __( 'Add New Deposits', 'humcore_domain' ),\n\t\t'new_item' => __( 'New Deposit', 'humcore_domain' ),\n\t\t'edit_item' => __( 'Edit Deposit', 'humcore_domain' ),\n\t\t'view_item' => __( 'View Deposit', 'humcore_domain' ),\n\t\t'all_items' => __( 'All Deposits', 'humcore_domain' ),\n\t\t'search_items' => __( 'Search Deposits', 'humcore_domain' ),\n\t\t'not_found' => __( 'No Deposits found', 'humcore_domain' ),\n\t\t'not_found_in_trash' => __( 'No Deposits found in Trash', 'humcore_domain' ),\n\t\t'parent_item_colon' => '',\n\t);\n\n\t$post_type_args = array(\n\t\t'label' => __( 'HumCORE Deposits', 'humcore_domain' ),\n\t\t'labels' => $labels,\n\t\t'public' => false,\n\t\t'show_ui' => true,\n\t\t'show_in_menu' => true,\n\t\t'show_in_admin_bar' => false,\n\t\t'query_var' => false,\n\t\t'rewrite' => array(\n\t\t\t'slug' => 'humcore_deposit',\n\t\t\t'with_front' => true,\n\t\t),\n\t\t'capability_type' => 'post',\n\t\t'has_archive' => false,\n\t\t'hierarchical' => true,\n\t\t'menu_position' => null,\n\t\t'supports' => array( 'title', 'author', 'excerpt' ),\n\t\t// 'supports' => array( 'title', 'author', 'excerpt', 'custom-fields', revisions', 'page-attributes' ),\n\t\t'register_meta_box_cb' => 'humcore_add_post_type_metabox',\n\t);\n\n\tregister_post_type( 'humcore_deposit', $post_type_args );\n}", "public static function register_type() {\n\n\t\tregister_graphql_enum_type(\n\t\t\t'ContentNodeIdTypeEnum',\n\t\t\t[\n\t\t\t\t'description' => __( 'The Type of Identifier used to fetch a single resource. Default is ID.', 'wp-graphql' ),\n\t\t\t\t'values' => self::get_values(),\n\t\t\t]\n\t\t);\n\n\t\t$allowed_post_types = \\WPGraphQL::get_allowed_post_types();\n\t\tif ( ! empty( $allowed_post_types ) && is_array( $allowed_post_types ) ) {\n\t\t\tforeach ( $allowed_post_types as $post_type ) {\n\t\t\t\t$post_type_object = get_post_type_object( $post_type );\n\n\t\t\t\tif ( empty( $post_type_object ) ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t$values = self::get_values();\n\t\t\t\tif ( ! $post_type_object->hierarchical ) {\n\t\t\t\t\t$values['slug'] = [\n\t\t\t\t\t\t'name' => 'SLUG',\n\t\t\t\t\t\t'value' => 'slug',\n\t\t\t\t\t\t'description' => __( 'Identify a resource by the slug. Available to non-hierarchcial Types where the slug is a unique identifier.', 'wp-graphql' ),\n\t\t\t\t\t];\n\t\t\t\t}\n\n\t\t\t\tif ( 'attachment' === $post_type_object->name ) {\n\t\t\t\t\t$values['source_url'] = [\n\t\t\t\t\t\t'name' => 'SOURCE_URL',\n\t\t\t\t\t\t'value' => 'source_url',\n\t\t\t\t\t\t'description' => __( 'Identify a media item by its source url', 'wp-graphql' ),\n\t\t\t\t\t];\n\t\t\t\t}\n\n\t\t\t\t/**\n\t\t\t\t * Register a unique Enum per Post Type. This allows for granular control\n\t\t\t\t * over filtering and customizing the values available per Post Type.\n\t\t\t\t */\n\t\t\t\tregister_graphql_enum_type(\n\t\t\t\t\t$post_type_object->graphql_single_name . 'IdType',\n\t\t\t\t\t[\n\t\t\t\t\t\t'description' => __( 'The Type of Identifier used to fetch a single resource. Default is ID.', 'wp-graphql' ),\n\t\t\t\t\t\t'values' => $values,\n\t\t\t\t\t]\n\t\t\t\t);\n\n\t\t\t}\n\t\t}\n\n\t}", "public function registerPostTypes()\n {\n // Get the post types from the config.\n $postTypes = config('post-types');\n\n $translater = new Translater($postTypes, 'post-types');\n $postTypes = $translater->translate([\n '*.label',\n '*.labels.*',\n '*.names.singular',\n '*.names.plural',\n ]);\n\n // Iterate over each post type.\n collect($postTypes)->each(function ($item, $key) {\n\n // Check if names are set, if not keep it as an empty array\n $names = $item['names'] ?? [];\n\n // Unset names from item\n unset($item['names']);\n\n // Register the extended post type.\n register_extended_post_type($key, $item, $names);\n });\n }", "function rawlins_register_post_types() {\n\t$rawlins_magic_post_type_maker_array = array(\n\t\t/*array(\n\t\t\t'cpt_single' => 'Resource',\n\t\t\t'cpt_plural' => 'Resources',\n\t\t\t'slug' => 'resource',\n\t\t\t'cpt_icon' => 'dashicons-index-card',\n\t\t\t'exclude_from_search' => false,\n\t\t),*/\n\n\t);\n\n\tforeach( $rawlins_magic_post_type_maker_array as $post_type ){\n\t\t$cpt_single = $post_type['cpt_single'];\n\t\t$cpt_plural = $post_type['cpt_plural'];\n\t\t$slug = $post_type['slug'];\n\t\t$cpt_icon = $post_type['cpt_icon'];\n\t\t$exclude_from_search = $post_type['exclude_from_search'];\n\n\t\t// Admin Labels\n\t \t$labels = rawlins_generate_label_array($cpt_plural, $cpt_single);\n\n\t \t// Arguments\n\t\t$args = rawlins_generate_post_type_args($labels, $cpt_plural, $cpt_icon, $exclude_from_search);\n\n\t\t// Just do it\n\t\tregister_post_type( $slug, $args );\n\t}\n\n}", "function rng_create_post_type() {\n\n\t$labels = array(\n\t\t'name' => _x( 'Post Types Plural', 'Post Type General Name', 'translate_name' ),\n\t\t'singular_name' => _x( 'Post Type Singular', 'Post Type Singular Name', 'translate_name' ),\n\t\t'menu_name' => __( 'Post Types', 'translate_name' ),\n\t\t'name_admin_bar' => __( 'Post Type', 'translate_name' ),\n\t\t'archives' => __( 'Item Archives', 'translate_name' ),\n\t\t'attributes' => __( 'Item Attributes', 'translate_name' ),\n\t\t'parent_item_colon' => __( 'Parent Item:', 'translate_name' ),\n\t\t'all_items' => __( 'All Items', 'translate_name' ),\n\t\t'add_new_item' => __( 'Add New Item', 'translate_name' ),\n\t\t'add_new' => __( 'Add New', 'translate_name' ),\n\t\t'new_item' => __( 'New Item', 'translate_name' ),\n\t\t'edit_item' => __( 'Edit Item', 'translate_name' ),\n\t\t'update_item' => __( 'Update Item', 'translate_name' ),\n\t\t'view_item' => __( 'View Item', 'translate_name' ),\n\t\t'view_items' => __( 'View Items', 'translate_name' ),\n\t\t'search_items' => __( 'Search Item', 'translate_name' ),\n\t\t'not_found' => __( 'Not found', 'translate_name' ),\n\t\t'not_found_in_trash' => __( 'Not found in Trash', 'translate_name' ),\n\t\t'featured_image' => __( 'Featured Image', 'translate_name' ),\n\t\t'set_featured_image' => __( 'Set featured image', 'translate_name' ),\n\t\t'remove_featured_image' => __( 'Remove featured image', 'translate_name' ),\n\t\t'use_featured_image' => __( 'Use as featured image', 'translate_name' ),\n\t\t'insert_into_item' => __( 'Insert into item', 'translate_name' ),\n\t\t'uploaded_to_this_item' => __( 'Uploaded to this item', 'translate_name' ),\n\t\t'items_list' => __( 'Items list', 'translate_name' ),\n\t\t'items_list_navigation' => __( 'Items list navigation', 'translate_name' ),\n\t\t'filter_items_list' => __( 'Filter items list', 'translate_name' ),\n\t);\n\t$args = array(\n 'public' => true,\n\t\t'label' => __( 'Post Type Singular', 'translate_name' ),\n\t\t'description' => __( 'Post Type Description', 'translate_name' ),\n 'labels' => $labels,\n 'exclude_from_search' => true,\n 'publicly_queryable' => true,\n 'show_ui' => true,\n\t\t'show_in_nav_menus' => true,\n\t\t'show_in_menu'\t\t\t=> true,\n\t\t'show_in_admin_bar'\t\t=> true,\n\t\t'menu_position'\t\t\t=> 5,\n\t\t// 'menu_icon' \t\t\t=> get_bloginfo('template_directory') . '/images/portfolio-icon.png',\n\t\t'menu_icon'\t\t\t\t=> 'dashicon-groups',\n\t\t'has_archive'\t\t\t=> true,\n\t\t'capability_type'\t\t=> array('book','books'),\n\t\t'capabilities' \t\t\t=> array(\n\t\t\t'edit_post' => 'edit_book', \n\t\t\t'read_post' => 'read_book', \n\t\t\t'delete_post' => 'delete_book', \n\t\t\t'edit_posts' => 'edit_books', \n\t\t\t'edit_others_posts' => 'edit_others_books', \n\t\t\t'publish_posts' => 'publish_books', \n\t\t\t'read_private_posts' => 'read_private_books', \n\t\t\t'create_posts' => 'edit_books', \n\t\t),\n\t\t'supports' => array( 'title', 'editor', 'thumbnail', 'page-attributes', 'post-formats' ),\n\t\t'taxonomies' => array( 'category', 'post_tag' ),\n\t\t'hierarchical' => true,\n\t);\n\tregister_post_type( 'book', $args );\n\n}", "function create_custom_post_types(){\n\t/**\n\t * Arguments for company labels\n\t */\n\t$args_labels_company = array(\n\t\t'name' => __('Companies', 'threedee-expo'),\n\t\t'singular_name' => __('Company', 'threedee-expo'),\n\t\t'add_new_item' => __('Add New Company', 'threedee-expo'),\n\t\t'edit_item' => __('Edit Company', 'threedee-expo'),\n\t\t'new_item' => __('New Company', 'threedee-expo'),\n\t\t'view_item' => __('View Company', 'threedee-expo'),\n\t\t'search_items' => __('Search Companies', 'threedee-expo'),\n\t\t'not_found' => __('No companies found', 'threedee-expo'),\n\t\t'not_found_in_trash'=> __('No companies found in Trash', 'threedee-expo'),\n\t\t'all_items' => __('All Companies', 'threedee-expo'),\n\t\t'archives' => __('Company Archives', 'threedee-expo'),\n\t);\n\t/**\n\t * Arguments for company capabilities\n\t */\n\t$args_capabilities_company = array(\n\t\t'publish_posts' => 'publish_companies',\n\t\t'edit_posts' => 'edit_companies',\n\t\t'edit_others_posts' => 'edit_others_companies',\n\t\t'delete_posts' => 'delete_companies',\n\t\t'delete_others_posts' => 'delete_others_companies',\n\t\t'read_private_posts' => 'read_private_companies',\n\t\t'edit_post' => 'edit_company',\n\t\t'delete_post' => 'delete_company',\n\t\t'read_post' => 'read_company',\n\t);\n\t/**\n\t * Arguments for register companies\n\t */\n\t$args_company = array(\n\t\t'labels' => $args_labels_company,\n\t\t'description' => 'Companies.',\n\t\t'public' => true,\n\t\t'has_archive' => true,\n\t\t'rewrite'\t => array('slug' => 'company'),\n\t\t'menu_icon' => 'dashicons-businessman',\n\t\t'capability_type' => 'companies',\n\t\t'capabilities' => $args_capabilities_company,\n\t\t'map_meta_cap' => true,\n\t\t'supports' => array('author','title')\n\t);\n\t/**\n\t * Arguments for company labels\n\t */\n\t$args_labels_group_of_companies = array(\n\t\t'name' => __('Group of Companies', 'threedee-expo'),\n\t\t'singular_name' => __('Group of Company', 'threedee-expo'),\n\t\t'add_new_item' => __('Add New Group of Companies', 'threedee-expo'),\n\t\t'edit_item' => __('Edit Group of Companies', 'threedee-expo'),\n\t\t'new_item' => __('New Group of Companies', 'threedee-expo'),\n\t\t'view_item' => __('View Group of Companies', 'threedee-expo'),\n\t\t'search_items' => __('Search Group of Companies', 'threedee-expo'),\n\t\t'not_found' => __('No Group of Companies found', 'threedee-expo'),\n\t\t'not_found_in_trash'=> __('No Group of Companies found in Trash', 'threedee-expo'),\n\t\t'all_items' => __('All Group of Companies', 'threedee-expo'),\n\t\t'archives' => __('Group of Companies Archives', 'threedee-expo'),\n\t);\n\t/**\n\t * Arguments for company capabilities\n\t */\n\t$args_capabilities_group_of_companies = array(\n\t\t'publish_posts' => 'publish_group_of_companies',\n\t\t'edit_posts' => 'edit_group_of_companies',\n\t\t'edit_others_posts' => 'edit_others_group_of_companies',\n\t\t'delete_posts' => 'delete_group_of_companies',\n\t\t'delete_others_posts' => 'delete_others_group_of_companies',\n\t\t'read_private_posts' => 'read_private_group_of_companies',\n\t\t'edit_post' => 'edit_group_of_company',\n\t\t'delete_post' => 'delete_group_of_company',\n\t\t'read_post' => 'read_group_of_company',\n\t);\n\t/**\n\t * Arguments for register companies\n\t */\n\t$args_group_of_companies = array(\n\t\t'labels' => $args_labels_group_of_companies,\n\t\t'description' => 'Group of Companies.',\n\t\t'public' => true,\n\t\t'has_archive' => true,\n\t\t'rewrite'\t => array('slug' => 'group_of_companies'),\n\t\t'menu_icon' => 'dashicons-groups',\n\t\t'capability_type' => 'group_of_companies',\n\t\t'capabilities' => $args_capabilities_group_of_companies,\n\t\t'map_meta_cap' => true,\n\t\t'supports' => array('author','title')\n\t);\n\tregister_post_type( 'companies', $args_company);\n\tregister_post_type( 'group_of_companies',$args_group_of_companies);\n}", "function news_custom_post() {\n $args = array(\n 'public' => true,\n 'label' => 'News',\n 'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments' ),\n 'show_ui' => true,\n 'publicly_queryable' => true,\n 'taxonomies' => array('category', 'post_tag'),\n 'rewrite' => array( 'slug' => 'news' )\n\t\n );\n register_post_type('news', $args);\n}", "function cadastrando_post_type_clientes() {\n\n $nomeSingular = 'Cliente';\n $nomePlural = 'Clientes';\n $descricao = 'Clientes da minha empresa';\n\n $labels = array(\n 'name' => $nomePlural,\n 'name_singular' => $nomeSingular,\n 'add_new_item' => 'Adicionar novo ' . $nomeSingular,\n 'edit_item' => 'Editar ' . $nomeSingular\n );\n\n $supports = array(\n 'title',\n 'editor',\n 'thumbnail'\n );\n\n $args = array(\n 'labels' => $labels,\n 'description' => $descricao,\n 'public' => true,\n 'menu_icon' => 'dashicons-id-alt',\n 'supports' => $supports\n );\n\n register_post_type( 'cliente', $args);\n}", "function register_fablabs_post_type () {\n\t$labels = array(\n 'name' => _x( 'Fab Labs', 'post type general name', 'additive_tcp' ),\n 'singular_name' => _x( 'Fab Lab', 'post type singular name', 'additive_tcp' ),\n 'menu_name' => _x( 'Fab Labs', 'admin menu', 'additive_tcp' ),\n 'name_admin_bar' => _x( 'Fab Lab', 'add new on admin bar', 'additive_tcp' ),\n 'add_new' => _x( 'Add New', 'fablab', 'additive_tcp' ),\n 'add_new_item' => __( 'Add New Fab Lab', 'additive_tcp' ),\n 'new_item' => __( 'New Fab Lab', 'additive_tcp' ),\n 'edit_item' => __( 'Edit Fab Lab', 'additive_tcp' ),\n 'view_item' => __( 'View Fab Lab', 'additive_tcp' ),\n 'all_items' => __( 'All Fab Labs', 'additive_tcp' ),\n 'search_items' => __( 'Search Fab Labs', 'additive_tcp' ),\n 'parent_item_colon' => __( 'Parent Fab Lab:', 'additive_tcp' ),\n 'not_found' => __( 'No fab labs found.', 'additive_tcp' ),\n 'not_found_in_trash' => __( 'No fab labs found in Trash.', 'additive_tcp' )\n );\n\tregister_post_type('additive_fab_lab', array(\n\t\t'labels' => $labels,\n\t\t'description' => 'Fab Labs which will appear on the Fab Labs page.',\n\t\t'public' => true,\n\t\t'hierarchical' => false,\n\t\t'capability_type' => 'post',\n\t\t'supports' => array('title', 'editor', 'custom-fields', 'thumbnail')\n\t));\n}", "public static function init() {\n\t\tadd_action( 'init', array( __CLASS__, 'register_post_type' ), 1 );\n\t}", "function create_posttype() \n {\n register_post_type( 'mist_employee',\n array(\n 'labels' => array(\n 'name' => __( 'Employees' ),\n 'singular_name' => __( 'Employee' )\n ),\n \n 'public' => true,\n 'has_archive' => true,\n 'rewrite' => array('slug' => 'employees'),\n 'supports' => array('title','editor','thumbnail','excerpt'),\n 'menu_icon' => 'dashicons-businessman'\n )\n );\n register_post_type( 'mist_message',\n array(\n 'labels' => array(\n 'name' => __( 'Person Messages' ),\n 'singular_name' => __( 'Message' ),\n ),\n \n 'public' => true,\n 'has_archive' => true,\n 'rewrite' => array('slug' => 'message'),\n 'supports' => array('title','editor','thumbnail','excerpt'),\n 'menu_icon' => 'dashicons-testimonial'\n )\n );\n add_post_type_support('mist_message', 'excerpt');\n \n }", "function planoType() {\r\n\t$labels = array(\r\n\t\t'name' => _x('Planos', 'post type general name'),\r\n\t 'singular_name' => _x('Plano', 'post type singular name'),\r\n\t 'add_new' => _x('Adicionar Novo', 'slideshow item'),\r\n\t 'add_new_item' => __('Adicionar Novo Plano'),\r\n\t 'edit_item' => __('Editar Plano'),\r\n\t 'new_item' => __('Novo Plano'),\r\n\t 'view_item' => __('Ver Plano'),\r\n\t 'search_items' => __('Procurar Plano'),\r\n\t 'not_found' => __('Nenhum Plano Encontrado'),\r\n\t 'not_found_in_trash' => __('Nenhum Plano na Lixeira'),\r\n\t 'parent_item_colon' => ''\r\n\t);\r\n\r\n $args = array(\r\n 'labels' => $labels,\r\n 'public' => true,\r\n 'publicly_queryable' => true,\r\n 'show_ui' => true,\r\n 'query_var' => true,\r\n 'rewrite' => true,\r\n 'capability_type' => 'post',\r\n 'hierarchical' => false,\r\n 'menu_position' => 4,\r\n 'supports' => array('title','editor'),\r\n 'rewrite' => array('slug' => 'plano')\r\n );\r\n\r\n register_post_type( 'plano' , $args ); # registering the new post type\r\n}", "function products_type() {\n\n $labels = array(\n 'name' => 'Productos',\n 'singular_name' => 'Producto',\n 'menu_name' => 'Productos',\n );\n\n $args = array(\n 'label' => 'Productos',\n 'description' => 'Productos de Platzi',\n 'labels' => $labels,\n 'supports' => array('title', 'editor', 'thumbnail', 'revisions'),\n 'public' => true,\n 'show_in_menu' => true,\n 'menu_position' => 5,\n 'menu_icon' => 'dashicons-cart',\n 'can_export' => true,\n 'publicly' => true,\n 'rewrite' => true,\n 'show_in_rest' => true,\n );\n\n register_post_type('producto', $args);\n}", "function add_my_custom_posttype_smaken(){\n //LABELS DIFINIËREN\n $labels = array(\n 'add_new' => 'Voeg nieuwe smaak toe',\n 'add_new_item' => 'Voeg nieuwe smaak toe',\n 'name' => 'Smaken',\n 'singular_name' => 'Smaak',\n );\n //ARGUMENTEN DIFINIËREN\n $args = array(\n 'labels' => $labels, // de array labels van hier boven linken aan het argument labels\n 'Description' => 'Lactosevrije smaken van B & J',\n 'public' => true,\n 'menu_position' => 4,\n 'menu_icon' => 'dashicons-carrot', //Een icoon kiezen\n 'supports' => array('title', 'editor', 'thumbnail', 'page-attributes'), \n 'has_archive' => true, //Maak een archief aan (opsomming van alle elementen), anders gaan we archive-waarden.php nooit kunnen aanspreken.\n 'show_in_nav_menus' => TRUE,\n );\n register_post_type( 'smaken', $args ); \n }", "private static function register_form_post_type() {\n\t\tif ( post_type_exists( self::$forms_post_type ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\t$post_type_args = apply_filters(\n\t\t\t'wphf_register_post_type_' . self::$forms_post_type,\n\t\t\tarray(\n\t\t\t\t'labels' => array(\n\t\t\t\t\t'name' => __( 'Forms', 'fff-rest-contact-form' ),\n\t\t\t\t\t'singular_name' => __( 'Form', 'fff-rest-contact-form' ),\n\t\t\t\t),\n\t\t\t\t'public' => true,\n\t\t\t\t'supports' => array( 'title' ),\n\t\t\t)\n\t\t);\n\n\t\tregister_post_type( self::$forms_post_type, $post_type_args );\n\t}" ]
[ "0.85713065", "0.8507504", "0.8346772", "0.8311665", "0.8260396", "0.82509744", "0.8213945", "0.8198455", "0.8182247", "0.8178489", "0.8175288", "0.8116956", "0.8096055", "0.8095977", "0.80908006", "0.8090349", "0.80708134", "0.80631447", "0.8057007", "0.804112", "0.80282766", "0.80076975", "0.8003802", "0.8001489", "0.7976903", "0.7976903", "0.7976467", "0.794635", "0.7901641", "0.7810948", "0.7798417", "0.77755654", "0.77747816", "0.7771966", "0.77656025", "0.7754728", "0.77172256", "0.769398", "0.7686712", "0.76841015", "0.76800853", "0.76573", "0.7633265", "0.76286715", "0.76250696", "0.7621496", "0.7616436", "0.7600351", "0.7597508", "0.7552298", "0.7548145", "0.7533635", "0.75291395", "0.7515946", "0.7513173", "0.7506658", "0.75009054", "0.7499127", "0.7484695", "0.7472208", "0.7467623", "0.74574304", "0.74550474", "0.7454685", "0.7451049", "0.7449392", "0.74448353", "0.7439846", "0.7438957", "0.7434441", "0.74327123", "0.7431696", "0.7423696", "0.7419655", "0.74125296", "0.7403553", "0.7400346", "0.73923665", "0.7377957", "0.7354617", "0.73505706", "0.7337408", "0.7315919", "0.73057175", "0.73050237", "0.73009634", "0.72950935", "0.7281986", "0.72763866", "0.7274012", "0.72658783", "0.7265073", "0.7263839", "0.7262491", "0.72480756", "0.7246405", "0.7240788", "0.7238302", "0.72336066", "0.72323775", "0.72236764" ]
0.0
-1
Restrict Access To Page: Grant or deny access to this page
function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) { // For security, start by assuming the visitor is NOT authorized. $isValid = False; // When a visitor has logged into this site, the Session variable MM_Username set equal to their username. // Therefore, we know that a user is NOT logged in if that Session variable is blank. if (!empty($UserName)) { // Besides being logged in, you may restrict access to only certain users based on an ID established when they login. // Parse the strings into arrays. $arrUsers = Explode(",", $strUsers); $arrGroups = Explode(",", $strGroups); if (in_array($UserName, $arrUsers)) { $isValid = true; } // Or, you may restrict access to only certain users based on their username. if (in_array($UserGroup, $arrGroups)) { $isValid = true; } if (($strUsers == "") && false) { $isValid = true; } } return $isValid; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private function checkPageAllowed() {\n\n if (!$this->user->isPersonnalManager()) {\n\n header('Location: ./index.php');\n exit();\n }\n }", "public function restricted()\n {\n $site = new SiteContainer($this->db);\n\n $site->printHeader();\n if (isset($_SESSION['type']))\n $site->printNav($_SESSION['type']);\n echo \"You are not allowed to access this resource. Return <a href=\\\"index.php\\\">Home</a>\";\n $site->printFooter();\n\n }", "function user_can_access_admin_page()\n {\n }", "public function restrict() {\n\t\tif (!$this->is_logged_in()) {\n\t\t\tredirect('login', 'refresh');\n\t\t}\n\t}", "function isRestricted() {\t\n\n\t\tif (isset($_SESSION['logged-in']) && $_SESSION['isAdmin']) {\n\t\t}\n\t\telse\n\t\t{\n\t\t\theader(\"Location: restricted.php\");//Instant Re direct to Restricted due to lack of permissions.\n\t\t}\t\t\t\n\t}", "public function manage_comments_page_access() {\n\t\tif ( ! current_user_can( 'moderate_comments' ) ) {\n\t\t\twp_die(\n\t\t\t\t__( 'You do not have permission to moderate comments.', 'wpcampus-network' ),\n\t\t\t\t__( 'Moderating Comments', 'wpcampus-network' ),\n\t\t\t\t[ 'back_link' => true ]\n\t\t\t);\n\t\t}\n\t}", "public function canManagePages();", "function show_deny() {\n\t\t\tshow_error(\n\t\t\t\t'403 Forbidden',\n\t\t\t\t'You do not have sufficient clearance to view this page.'\n\t\t\t);\n\t\t}", "public function checkAccessToPage($path){\n\t\t//Get current authenticated user data\n\t\t$admin = Auth::user();\n\t\t//Get user role\n\t\t$admin_roles = Roles::select('slug', 'access_pages')->where('slug', '=', $admin['role'])->first();\n\t\t//Check for Grant-access rules\n\t\tif($admin_roles->access_pages == 'grant_access'){\n\t\t\treturn true;\n\t\t}\n\n\t\t//Get accesses list for current role (access_pages is forbidden pages list)\n\t\t$forbidden_pages = (array)json_decode($admin_roles->access_pages);\n\t\t//get path for current page\n\t\t$natural_path = $this->getNaturalPath($path);\n\t\t//Get current page data\n\t\t$current_page = AdminMenu::select('id', 'slug')->where('slug', '=', $natural_path)->first();\n\n\t\t//if there is no id of current page in forbidden pages list\n\t\tif(!in_array($current_page->id, array_keys($forbidden_pages))){\n\t\t\treturn true;\n\t\t}else{\n\t\t\t//Check for CRUD restrictions\n\t\t\t$forbidden_pages = json_decode($admin_roles->access_pages);\n\t\t\t$current_page_id = $current_page->id;\n\n\t\t\t//convert current page path to full-slash view\n\t\t\t$path = (substr($path, 0,1) != '/')? '/'.$path: $path;\n\t\t\t//create path to links array\n\t\t\t$path_array = array_values(array_diff(explode('/',$path), ['']));\n\t\t\t//check for action-path\n\t\t\tswitch($path_array[count($path_array) -1]){\n\t\t\t\tcase 'edit':\n\t\t\t\tcase 'update':\n\t\t\t\t\tif(strpos($forbidden_pages->$current_page_id, 'u') !== false){\n\t\t\t\t\t\treturn abort(503);\n\t\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t\tcase 'create':\n\t\t\t\tcase 'store':\n\t\t\t\t\tif(strpos($forbidden_pages->$current_page_id, 'c') !== false){\n\t\t\t\t\t\treturn abort(503);\n\t\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tif(strpos($forbidden_pages->$current_page_id, 'r') !== false){\n\t\t\t\t\t\treturn abort(503);\n\t\t\t\t\t}\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\t}", "public function responsableDashboard()\n{\n $this->denyAccessUnlessGranted('ROLE_RESPONSABLE');\n\n // or add an optional message - seen by developers\n $this->denyAccessUnlessGranted('ROLE_RESPONSABLE', null, 'User tried to access a page without having ROLE_RESPONSABLE');\n}", "public function testRestrictPage()\n {\n $this->assertTrue(true);\n }", "function require_permission($required)\n{\n require_login();\n\n // owners have full access\n if ($_SESSION['permission'] == OWN) {\n return;\n }\n\n if ($required != $_SESSION['permission']) {\n redirect_to(url_for(\"/index.php\"));\n }\n}", "abstract public function require_access();", "function allow_user_privileges() {\n\tif(!$_SESSION['role']):\n\t\theader('Location: ?q=start');\n\tendif;\n}", "protected function restrict() {\n $this->restrict_to_permission('blog');\n }", "public function veterinaireDashboard()\n{\n $this->denyAccessUnlessGranted('ROLE_VETERINAIRE');\n\n // or add an optional message - seen by developers\n $this->denyAccessUnlessGranted('ROLE_VETERINAIRE', null, 'User tried to access a page without having ROLE_VETERINAIRE');\n}", "public function check_access() {\n\n\t\tif (isset($this->current_entity_allowed)) {\n\t\t\treturn apply_filters('minerva_restrict_access_allowed', $this->current_entity_allowed);\n\t\t}\n\n\t\t$this->current_entity_allowed = MKB_Options::option('restrict_on') ?\n\t\t\t(bool) $this->check_entity_access($this->get_current_entity()) :\n\t\t\ttrue; // always allowed if restriction is off\n\n\t\treturn apply_filters('minerva_restrict_access_allowed', $this->current_entity_allowed);\n\t}", "public static function denyAccess()\n {\n static::redirect(static::adminPath(), cbTrans('denied_access'));\n }", "public function page_test() {\n\n\t\tprint_r($this->permissions->check(\"can_view_admin\"));\n\t}", "function restrictedToAdmin(\n $redirectPage\n) {\n restrictedToAuthorized($redirectPage);\n $authUser = Authorizer::getAuthorizedUser();\n if ($authUser == null || ! $authUser->isAdmin()) {\n header(\"Location: \" . $redirectPage);\n exit();\n }\n}", "protected function _isAllowed()\n {\n \treturn true;\n }", "public function index()\n {\n if (Gate::allows('admin-only', auth()->user())) {\n \n return view('page.page01');\n\n }else if(Gate::allows('about-page', auth()->user())){\n\n return view('page.page01');\n\n }else{\n \n return redirect('/denied')->with('error','You dont have access to page -ABOUT- ! Your Admin Premission without page access!'); \n }\n }", "abstract protected function canAccess();", "public function restrict($url){\n if($this->session->get('auth') == null){\n header(\"Location : $url\");\n exit();\n }\n }", "function page_allowed($conn,$conn_admin,$id,$page)\n {\n $sql=\"select cn.id from customer_navbar cn left outer join customer_navbar_corresponding_pages cncp on cn.id=cncp.navbar_id where cn.link='$page' or cncp.link='$page' \";\n $res=$conn_admin->query($sql);\n if($res->num_rows>0)\n {\n $row=$res->fetch_assoc();\n $nid=$row['id'];\n $sql=\"select access from navbar_access where navbar_id=$nid and staff_id=$id\";\n \t\tif($res=$conn->query($sql))\n \t\t{\n \t\t\tif($res->num_rows>0)\n \t\t\t{\n \t\t\t\t$row=$res->fetch_assoc();\n \t\t\t\tif($row['access']!=0)\n \t\t\t\t\treturn true;\n \t\t\t\telse\n \t\t\t\t\treturn false;\n \t\t\t}\n \t\t}\n \t\telse\n \t\t{\n \t\t\t$sql=\"\";\n \t\t\treturn false;\n \t\t}\n }\n\t\telse\n\t\t{\n\t\t\t$sql=\"\";\n\t\t\treturn false;\n\t\t} \n }", "public function authorize()\n {\n return auth()->user()->ability('admin','update_pages');\n }", "function admEnforceAccess()\n{\n if( !admCheckAccess() ) {\n // no access. stop right now.\n\n // should print error message, but hey. let's just dump back to homepage\n header( \"Location: /\" ); \n exit;\n }\n}", "public function livreurDashboard()\n{\n $this->denyAccessUnlessGranted('ROLE_LIVREUR');\n\n // or add an optional message - seen by developers\n $this->denyAccessUnlessGranted('ROLE_LIVREUR', null, 'User tried to access a page without having ROLE_LIVREUR');\n}", "public function adminDashboard()\n{\n $this->denyAccessUnlessGranted('ROLE_ADMINISTRATEUR');\n\n // or add an optional message - seen by developers\n $this->denyAccessUnlessGranted('ROLE_ADMINISTRATEUR', null, 'User tried to access a page without having ROLE_ADMINISTRATEUR');\n}", "function authorizedAdminOnly(){\n global $authenticatedUser;\n if(!$authenticatedUser['admin']){\n header(\"HTTP/1.1 403 Forbidden\");\n header(\"Location: https://eso.vse.cz/~frim00/marvelous-movies/error-403\");\n exit();\n }\n }", "function securePage($uri) {\n\n //Separate document name from uri\n $tokens = explode('/', $uri);\n $page = $tokens[sizeof($tokens) - 1];\n global $mysqli, $db_table_prefix, $loggedInUser;\n //retrieve page details\n $stmt = $mysqli->prepare(\"SELECT \n\t\tid,\n\t\tpage,\n\t\tprivate\n\t\tFROM \" . $db_table_prefix . \"pages\n\t\tWHERE\n\t\tpage = ?\n\t\tLIMIT 1\");\n $stmt->bind_param(\"s\", $page);\n $stmt->execute();\n $stmt->bind_result($id, $page, $private);\n while ($stmt->fetch()) {\n $pageDetails = array('id' => $id, 'page' => $page, 'private' => $private);\n }\n $stmt->close();\n //If page does not exist in DB, allow access\n if (empty($pageDetails)) {\n return true;\n }\n //If page is public, allow access\n elseif ($pageDetails['private'] == 0) {\n return true;\n }\n //If user is not logged in, deny access\n elseif (!isUserLoggedIn()) {\n header(\"Location: index.php\");\n return false;\n } else {\n //Retrieve list of permission levels with access to page\n $stmt = $mysqli->prepare(\"SELECT\n\t\t\tpermission_id\n\t\t\tFROM \" . $db_table_prefix . \"permission_page_matches\n\t\t\tWHERE page_id = ?\n\t\t\t\");\n $stmt->bind_param(\"i\", $pageDetails['id']);\n $stmt->execute();\n $stmt->bind_result($permission);\n while ($stmt->fetch()) {\n $pagePermissions[] = $permission;\n }\n $stmt->close();\n //Check if user's permission levels allow access to page\n if ($loggedInUser->checkPermission($pagePermissions)) {\n return true;\n }\n //Grant access if master user\n elseif ($loggedInUser->user_id == $master_account) {\n return true;\n } else {\n header(\"Location: account.php\");\n return false;\n }\n }\n}", "public function denyAccess(): AccessResultInterface;", "function userCanEditPage()\n\t{\n\t\t// use Yawp::authUsername() instead of $this->username because\n\t\t// we need to know if the user is authenticated or not.\n\t\treturn $this->acl->pageEdit(Yawp::authUsername(), $this->area, \n\t\t\t$this->page);\n\t}", "public function checkAccess() {\n // if the user is not allowed access to the ACL, then redirect him\n if (!$this->user->isAllowed(ACL_RESOURCE, ACL_PRIVILEGE)) {\n // @todo change redirect to login page\n $this->redirect('Denied:');\n }\n }", "function restrict($id_module='0', $teh=null)\r\n\t{\r\n\t\tif($this->is_logged_in() === FALSE) {\r\n\r\n\t\t\tredirect(base_url());\r\n\r\n\t\t} else if($id_module != 0 && $this->izin($id_module, $teh) === FALSE) {\r\n\r\n\t\t\tredirect(base_url('admin/access_forbidden'));\r\n\r\n\t\t\tdie();\r\n\r\n\t\t}\r\n\t}", "public function denyLink()\n {\n }", "function userCanViewPage()\n\t{\n\t\t// use Yawp::authUsername() instead of $this->username because\n\t\t// we need to know if the user is authenticated or not.\n\t\treturn $this->acl->pageView(Yawp::authUsername(), $this->area, \n\t\t\t$this->page);\n\t}", "public function authorize()\n {\n abort_if(Gate::denies('permission_edit'), Response::HTTP_FORBIDDEN, '403 Forbidden');\n\n return true;\n }", "function restrictedToAuthorized(\n $redirectPage = null\n) {\n if ($redirectPage == null) {\n $redirectPage = $GLOBALS[\"pagelink\"][\"register\"];\n }\n if (!Authorizer::userIsAuthorized()) {\n $_SESSION['redirect_url'] = \\Web\\Framework\\Request\\getSubUrl();\n header(\"Location: \" . $redirectPage);\n exit();\n }\n}", "public function checkAccess()\n {\n // need to be modified for security\n }", "function deny($message = null) {\n // Ignore soft 403 for ajax requests as redirections is transparent.\n if (config\\SOFT_403 != false && !\\melt\\request\\is_ajax()) {\n $user = get_user();\n if ($user === null) {\n if (config\\LAST_DENY_AUTOREDIRECT)\n $_SESSION['userx\\LAST_DENY_PATH'] = APP_ROOT_URL . \\substr(REQ_URL, 1);\n if ($message === null)\n $message = _(\"Access denied. You are not logged in.\");\n \\melt\\messenger\\redirect_message(config\\SOFT_403, $message, \"bad\");\n } else {\n if ($message === null)\n $message = _(\"Access denied. Insufficient permissions.\");\n \\melt\\messenger\\redirect_message(config\\SOFT_403, $message, \"bad\");\n }\n } else\n \\melt\\request\\show_xyz(403);\n exit;\n}", "function allow_admin_privileges() {\n\tif($_SESSION['role']!=='administrator'):\n\t\theader('Location: ?q=start');\n\tendif;\n}", "function checkAccess() ;", "function securePage($uri){\r\n\t\r\n\t//Separate document name from uri\r\n\t$tokens = explode('/', $uri);\r\n\t$page = $tokens[sizeof($tokens)-1];\r\n\tglobal $mysqli,$db_table_prefix,$loggedInUser;\r\n\t//retrieve page details\r\n\t$stmt = $mysqli->prepare(\"SELECT \r\n\t\tid,\r\n\t\tpage,\r\n\t\tprivate\r\n\t\tFROM \".$db_table_prefix.\"pages\r\n\t\tWHERE\r\n\t\tpage = ?\r\n\t\tLIMIT 1\");\r\n\t$stmt->bind_param(\"s\", $page);\r\n\t$stmt->execute();\r\n\t$stmt->bind_result($id, $page, $private);\r\n\twhile ($stmt->fetch()){\r\n\t\t$pageDetails = array('id' => $id, 'page' => $page, 'private' => $private);\r\n\t}\r\n\t$stmt->close();\r\n\t//If page does not exist in DB, allow access\r\n\tif (empty($pageDetails)){\r\n\t\treturn true;\r\n\t}\r\n\t//If page is public, allow access\r\n\telseif ($pageDetails['private'] == 0) {\r\n\t\treturn true;\t\r\n\t}\r\n\t//If user is not logged in, deny access\r\n\telseif(!isUserLoggedIn()) \r\n\t{\r\n\t\theader(\"Location: login.php\");\r\n\t\treturn false;\r\n\t}\r\n\telse {\r\n\t\t//Retrieve list of permission levels with access to page\r\n\t\t$stmt = $mysqli->prepare(\"SELECT\r\n\t\t\tpermission_id\r\n\t\t\tFROM \".$db_table_prefix.\"permission_page_matches\r\n\t\t\tWHERE page_id = ?\r\n\t\t\t\");\r\n\t\t$stmt->bind_param(\"i\", $pageDetails['id']);\t\r\n\t\t$stmt->execute();\r\n\t\t$stmt->bind_result($permission);\r\n\t\twhile ($stmt->fetch()){\r\n\t\t\t$pagePermissions[] = $permission;\r\n\t\t}\r\n\t\t$stmt->close();\r\n\t\t//Check if user's permission levels allow access to page\r\n\t\tif ($loggedInUser->checkPermission($pagePermissions)){ \r\n\t\t\treturn true;\r\n\t\t}\r\n\t\t//Grant access if master user\r\n\t\telseif ($loggedInUser->user_id == $master_account){\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\telse {\r\n\t\t\theader(\"Location: account.php\");\r\n\t\t\treturn false;\t\r\n\t\t}\r\n\t}\r\n}", "public function isForbidden();", "private function authorize()\n {\n $authorized = FALSE;\n\n if ( in_array(ee()->session->userdata['group_id'], ee()->publisher_setting->can_admin_publisher()))\n {\n $authorized = TRUE;\n }\n\n if (ee()->session->userdata['group_id'] == 1)\n {\n $authorized = TRUE;\n }\n\n if ( !$authorized)\n {\n ee()->publisher_helper_url->redirect(ee()->publisher_helper_cp->mod_link('view_unauthorized'));\n }\n }", "function AllowAnonymousUser() {\n\t\tswitch (EW_PAGE_ID) {\n\t\t\tcase \"add\":\n\t\t\tcase \"register\":\n\t\t\tcase \"addopt\":\n\t\t\t\treturn FALSE;\n\t\t\tcase \"edit\":\n\t\t\tcase \"update\":\n\t\t\t\treturn FALSE;\n\t\t\tcase \"delete\":\n\t\t\t\treturn FALSE;\n\t\t\tcase \"view\":\n\t\t\t\treturn FALSE;\n\t\t\tcase \"search\":\n\t\t\t\treturn FALSE;\n\t\t\tdefault:\n\t\t\t\treturn FALSE;\n\t\t}\n\t}", "public function customAccessPage() {\r\n return [\r\n '#markup' => $this->t('This menu entry will not be visible and access will result\r\n in a 403 error unless the user has the \"authenticated\" role. This is\r\n accomplished with a custom access check plugin.'),\r\n ];\r\n }", "public function authorize() {\n\t\treturn false;\n }", "public function authorize()\n {\n if ($this->user && ($this->user->hasPermission('manage_pages_contents') ) ) {\n return true;\n }\n\n return false;\n }", "public function authorize()\n {\n //Get the 'mark' id\n switch ((int) request()->segment(6)) {\n case 0:\n return access()->allow('deactivate-users');\n break;\n\n case 1:\n return access()->allow('reactivate-users');\n break;\n }\n\n return false;\n }", "function protect_page() {\n if(!logged_in()) {\n header('Location: protected.php');\n exit();\n }\n }", "abstract public function url_authorize();", "private function prepareForViewing($pagename) {\n Wi3::inst()->sitearea->setpage($pagename); // Will also execute the \"wi3.init.sitearea.page.loaded\" event\n // Now check the rights for this page\n // Pages can only be viewed if the page has not set any 'viewright' or if the user that requests the page is logged in and has that required viewright\n $page = Wi3::inst()->sitearea->page;\n // TODO: rewrite with ACL, see adminarea\n if (!empty($page->viewright))\n {\n // Check for required role\n $requiredrole = $page->viewright;\n $hasrequiredrole = false;\n // Check if there is a logged-in user for this site at all\n $user = Wi3::inst()->sitearea->auth->user;\n if (is_object($user))\n {\n // Check user rights\n $roles = $user->roles;\n foreach($roles as $role)\n {\n if (strtolower($role->name) === strtolower($requiredrole) OR $role->name === strtolower(\"admin\"))\n {\n $hasrequiredrole = true;\n break;\n }\n }\n }\n // Check\n if (!$hasrequiredrole)\n {\n // Redirect to the loginpage of the site (if known, that is)\n $site = Wi3::inst()->sitearea->site;\n if(strlen($site->loginpage) > 0)\n {\n Request::instance()->redirect(Wi3::inst()->urlof->page($site->loginpage));\n }\n else\n {\n throw(new ACL_Exception_403()); // Permission denied\n exit;\n }\n }\n }\n // Caching is per user\n Wi3::inst()->cache->requireCacheParameter(\"user\");\n $user = Wi3::inst()->sitearea->auth->user;\n if (is_object($user)) {\n $userid = $user->id;\n } else {\n $userid = \"\";\n }\n //Wi3::inst()->cache->doRemoveCacheWhenAllRequiredCacheParametersAreFilled();\n Wi3::inst()->cache->fillCacheParameter(\"user\", $userid);\n // By default, don't cache pages\n // This can be overridden in the user template, if desired\n Wi3::inst()->cache->doNotCache();\n }", "public function getExplicitlyAllowAndDeny() {}", "public function allow()\n {\n ++$this->allowed;\n\n if (NODE_ACCESS_DENY !== $this->result) {\n $this->result = NODE_ACCESS_ALLOW;\n }\n }", "private function userNotPermit(){\n throw new \\Symfony\\Component\\HttpKernel\\Exception\\AccessDeniedHttpException('Bad user',null, 403);\n }", "private function userHasAccessToPages() {\n\t\t$configurationProxy = tx_oelib_configurationProxy::getInstance('realty');\n\n\t\t$objectsPid = $configurationProxy->getAsInteger(\n\t\t\t'pidForRealtyObjectsAndImages'\n\t\t);\n\t\t$canWriteObjectsPage = $GLOBALS['BE_USER']->doesUserHaveAccess(\n\t\t\tt3lib_BEfunc::getRecord('pages', $objectsPid), 16\n\t\t);\n\n\t\t$auxiliaryPid = $configurationProxy->getAsInteger(\n\t\t\t'pidForAuxiliaryRecords'\n\t\t);\n\t\t$canWriteAuxiliaryPage = $GLOBALS['BE_USER']->doesUserHaveAccess(\n\t\t\tt3lib_BEfunc::getRecord('pages', $auxiliaryPid), 16\n\t\t);\n\n\t\tif (!$canWriteObjectsPage) {\n\t\t\t$this->storeErrorMessage('objects_pid', $objectsPid);\n\t\t}\n\t\tif (!$canWriteAuxiliaryPage) {\n\t\t\t$this->storeErrorMessage('auxiliary_pid', $auxiliaryPid);\n\t\t}\n\n\t\treturn $canWriteObjectsPage && $canWriteAuxiliaryPage;\n\t}", "function plasso_protect_pages() {\n\t$options = get_theme_mod('plasso');\n\t$protected = $options['space_page'];\n\n\t// If we are on a protected page.\n if(is_page($protected)) {\n $plassoBilling = new PlassoBilling((isset($_GET['__logout']))?'logout':(isset($_GET['_plasso_token'])?$_GET['_plasso_token']:NULL));\n\t}\n}", "function securePage($uri){ // every file in the framework uses this\r\n\t//Separate document name from uri\r\n\r\n\t$tokens = explode('/', $uri);\r\n\r\n\t$page = $tokens[sizeof($tokens)-1];\r\n\r\n\tglobal $mysqli,$db_table_prefix,$loggedInUser;\r\n\r\n\t//retrieve page details\r\n\r\n\t$stmt = $mysqli->prepare(\"SELECT \r\n\r\n\t\tid,\r\n\r\n\t\tpage,\r\n\r\n\t\tprivate\r\n\r\n\t\tFROM \".$db_table_prefix.\"pages\r\n\r\n\t\tWHERE\r\n\r\n\t\tpage = ?\r\n\r\n\t\tLIMIT 1\");\r\n\r\n\t$stmt->bind_param(\"s\", $page);\r\n\r\n\t$stmt->execute();\r\n\r\n\t$stmt->bind_result($id, $page, $private);\r\n\r\n\twhile ($stmt->fetch()){\r\n\r\n\t\t$pageDetails = array('id' => $id, 'page' => $page, 'private' => $private);\r\n\r\n\t}\r\n\r\n\t$stmt->close();\r\n\r\n\t//If page does not exist in DB, allow access\r\n\r\n\tif (empty($pageDetails)){\r\n\r\n\t\treturn true;\r\n\r\n\t}\r\n\r\n\t//If page is public, allow access\r\n\r\n\telseif ($pageDetails['private'] == 0) {\r\n\r\n\t\treturn true;\r\n\r\n\t}\r\n\r\n\t//If user is not logged in, deny access and prompt them to log in\r\n\r\n\telseif(!isUserLoggedIn()) \r\n\r\n\t{\t\r\n\t\theader(\"Location: login.php\"); exit();\r\n\t\t\r\n\t}\r\n\r\n\telse {\r\n\r\n\t\t// The page exists, it is private, and user is logged in, so...\r\n\t\t//Retrieve list of permission levels with access to page\r\n\r\n\t\t$stmt = $mysqli->prepare(\"SELECT\r\n\r\n\t\t\tpermission_id\r\n\r\n\t\t\tFROM \".$db_table_prefix.\"permission_page_matches\r\n\r\n\t\t\tWHERE page_id = ?\r\n\r\n\t\t\t\");\r\n\r\n\t\t$stmt->bind_param(\"i\", $pageDetails['id']);\t\r\n\r\n\t\t$stmt->execute();\r\n\r\n\t\t$stmt->bind_result($permission);\r\n\r\n\t\twhile ($stmt->fetch()){\r\n\r\n\t\t\t$pagePermissions[] = $permission;\r\n\r\n\t\t}\r\n\r\n\t\t$stmt->close();\r\n\r\n\t\t//Check if user's permission levels allow access to page\r\n\r\n\t\tif ($loggedInUser->checkPermission($pagePermissions)){ \r\n\r\n\t\t\treturn true;\r\n\r\n\t\t}\r\n\r\n\t\t//Grant access if master user\r\n\r\n\t\telseif ($loggedInUser->user_id == $master_account){\r\n\r\n\t\t\treturn true;\r\n\r\n\t\t}\r\n\r\n\t\telse {\r\n\r\n\t\t\theader(\"Location: account.php\"); // why here? User is logged in, but can't get to the requested page. Dump them to account\r\n\r\n\t\t\treturn false;\t\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}", "protected function restrict() {\n $this->restrict_to_permission('manage_products');\n }", "public function action_access_denied()\r\n\t{\r\n\t\t$this->title = \"Access Denied\";\r\n\t\t$this->template->content = View::factory('access_denied');\r\n\t}", "public function checkAccess() {}", "public function checkAccess() {}", "public function checkAccess() {}", "public function checkAccess() {}", "public function checkAccess() {}", "public function checkAccess() {}", "public function checkAccess() {}", "public function checkAccess() {}", "function applies() {\n\t\t$context =& $this->_router->getContext($this->_request);\n\t\treturn ( $context && $context->getSetting('restrictSiteAccess'));\n\t}", "function chekPrivies($privReq = '0', $privChek = '0'){\n\n\t// Get User Privilege from session\n\n\t$privChek = (int)$_SESSION['Privilege']; //Cast as int\n\n\t//if Priv less then access required redirect to main index.\n\tif ($privChek < $privReq){\n\t\t$myURL = VIRTUAL_PATH;\n\t\tmyRedirect($myURL);\n\t}\n}", "function admin_protect() {\n global $user_data;\n if($user_data['type'] != 1) {\n header(\"location: index.php\");\n exit();\n }\n }", "public function claimPageAction() {\n\n //CHECK USER VALIDATION\n if (!$this->_helper->requireUser()->isValid())\n return;\n\n //GET LOGGED IN USER INFORMATION \n $viewer = Engine_Api::_()->user()->getViewer();\n $viewer_id = $viewer->getIdentity();\n\n //GET LEVEL ID\n if (!empty($viewer_id)) {\n $level_id = $viewer->level_id;\n } else {\n $authorizationTable = Engine_Api::_()->getItemTable('authorization_level');\n $authorization = $authorizationTable->fetchRow(array('type = ?' => 'public', 'flag = ?' => 'public'));\n if (!empty($authorization))\n $level_id = $authorization->level_id;\n }\n\n $getPackageClaim = Engine_Api::_()->sitepage()->getPackageAuthInfo('sitepage');\n $this->_helper->layout->setLayout('default-simple');\n\n //GET PAGE ID\n $page_id = $this->_getParam('page_id', null);\n\n //SET PARAMS\n $paramss = array();\n $paramss['page_id'] = $page_id;\n $paramss['viewer_id'] = $viewer_id;\n $inforow = Engine_Api::_()->getDbtable('claims', 'sitepage')->getClaimStatus($paramss);\n\n $this->view->status = 0;\n if (!empty($inforow)) {\n $this->view->status = $inforow->status;\n }\n\n\t\t//GET ADMIN EMAIL\n\t\t$coreApiSettings = Engine_Api::_()->getApi('settings', 'core');\n\t\t$adminEmail = $coreApiSettings->getSetting('core.mail.contact', $coreApiSettings->getSetting('core.mail.from', \"[email protected]\"));\n\t\tif(!$adminEmail) $adminEmail = $coreApiSettings->getSetting('core.mail.from', \"[email protected]\");\n \n //CHECK STATUS\n if ($this->view->status == 2) {\n echo '<div class=\"global_form\" style=\"margin:15px 0 0 15px;\"><div><div><h3>' . $this->view->translate(\"Alert!\") . '</h3>';\n echo '<div class=\"form-elements\" style=\"margin-top:10px;\"><div class=\"form-wrapper\" style=\"margin-bottom:10px;\">' . $this->view->translate(\"You have already send a request to claim for this page which has been declined by the site admin.\") . '</div>';\n echo '<div class=\"form-wrapper\"><button onclick=\"parent.Smoothbox.close()\">' . $this->view->translate(\"Close\") . '</button></div></div></div></div></div>';\n }\n\n $this->view->claimoption = $claimoption = Engine_Api::_()->authorization()->getPermission($level_id, 'sitepage_page', 'claim');\n\n //FETCH\n $paramss = array();\n $this->view->userclaim = $userclaim = 0;\n $paramss['page_id'] = $page_id;\n $paramss['limit'] = 1;\n $pageclaiminfo = Engine_Api::_()->getDbtable('pages', 'sitepage')->getSuggestClaimPage($paramss);\n\n if (!$claimoption || !$pageclaiminfo[0]['userclaim'] || !Engine_Api::_()->getApi('settings', 'core')->getSetting('sitepage.claimlink', 1)) {\n return $this->_forward('requireauth', 'error', 'core');\n }\n\n if (isset($pageclaiminfo[0]['userclaim'])) {\n $this->view->userclaim = $userclaim = $pageclaiminfo[0]['userclaim'];\n }\n\n if ($inforow['status'] == 3 || $inforow['status'] == 4) {\n echo '<div class=\"global_form\" style=\"margin:15px 0 0 15px;\"><div><div><h3>' . $this->view->translate(\"Alert!\") . '</h3>';\n echo '<div class=\"form-elements\" style=\"margin-top:10px;\"><div class=\"form-wrapper\" style=\"margin-bottom:10px;\">' . $this->view->translate(\"You have already filed a claim for this page: \\\"%s\\\", which is either on hold or is awaiting action by administration.\", Engine_Api::_()->getItem('sitepage_page', $page_id)->title) . '</div>';\n echo '<div class=\"form-wrapper\"><button onclick=\"parent.Smoothbox.close()\">' . $this->view->translate(\"Close\") . '</button></div></div></div></div></div>';\n }\n\n if (!$inforow['status'] && $claimoption && $userclaim) {\n //GET FORM \n $this->view->form = $form = new Sitepage_Form_Claimpage();\n\n //POPULATE FORM\n if (!empty($viewer_id)) {\n $value['email'] = $viewer->email;\n $value['nickname'] = $viewer->displayname;\n $form->populate($value);\n }\n\n if ($this->getRequest()->isPost() && $form->isValid($this->getRequest()->getPost())) {\n //GET FORM VALUES\n $values = $form->getValues();\n\n //GET EMAIL\n $email = $values['email'];\n\n //CHECK EMAIL VALIDATION\n $validator = new Zend_Validate_EmailAddress();\n if (!$validator->isValid($email)) {\n $form->addError(Zend_Registry::get('Zend_Translate')->_('Please enter a valid email address.'));\n return;\n }\n\n //GET CLAIM TABLE\n $tableClaim = Engine_Api::_()->getDbTable('claims', 'sitepage');\n $db = Engine_Db_Table::getDefaultAdapter();\n $db->beginTransaction();\n try {\n //SAVE VALUES\n if (!empty($getPackageClaim)) {\n\n //GET SITEPAGE ITEM\n $sitepage = Engine_Api::_()->getItem('sitepage_page', $page_id);\n\n //GET PAGE URL\n $page_url = Engine_Api::_()->sitepage()->getPageUrl($page_id);\n\n //SEND SITEPAGE TITLE TO THE TPL\n $page_title = $sitepage->title;\n\n //SEND CHANGE OWNER EMAIL\n\t\t\t\t\t\tif(Engine_Api::_()->getApi('settings', 'core')->getSetting('sitepage.claim.email', 1) && Engine_Api::_()->getApi('settings', 'core')->getSetting('sitepage.claimlink', 1)) {\n\t\t\t\t\t\t\tEngine_Api::_()->getApi('mail', 'core')->sendSystem($adminEmail, 'SITEPAGE_CLAIMOWNER_EMAIL', array(\n\t\t\t\t\t\t\t\t\t'page_title' => $page_title,\n\t\t\t\t\t\t\t\t\t'page_title_with_link' => '<a href=\"' . 'http://' . $_SERVER['HTTP_HOST'] .\n\t\t\t\t\t\t\t\t\tZend_Controller_Front::getInstance()->getRouter()->assemble(array('page_url' => $page_url), 'sitepage_entry_view', true) . '\" >' . $page_title . ' </a>',\n\t\t\t\t\t\t\t\t\t'object_link' => 'http://' . $_SERVER['HTTP_HOST'] .\n\t\t\t\t\t\t\t\t\tZend_Controller_Front::getInstance()->getRouter()->assemble(array('page_url' => $page_url), 'sitepage_entry_view', true),\n\t\t\t\t\t\t\t\t\t'email' => $coreApiSettings->getSetting('core.mail.from', \"[email protected]\"),\n\t\t\t\t\t\t\t\t\t'queue' => true\n\t\t\t\t\t\t\t));\n\t\t\t\t\t\t}\n\n $row = $tableClaim->createRow();\n $row->page_id = $page_id;\n $row->user_id = $viewer_id;\n $row->about = $values['about'];\n $row->nickname = $values['nickname'];\n $row->email = $email;\n $row->contactno = $values['contactno'];\n $row->usercomments = $values['usercomments'];\n $row->status = 3;\n $row->save();\n }\n $db->commit();\n } catch (Exception $e) {\n $db->rollBack();\n throw $e;\n }\n $this->_forward('success', 'utility', 'core', array(\n 'smoothboxClose' => true,\n 'parentRefreshTime' => '60',\n 'parentRefresh' => 'true',\n 'format' => 'smoothbox',\n 'messages' => array(Zend_Registry::get('Zend_Translate')->_('Your request has been send successfully. You will now receive an email confirming Admin approval of your request.'))\n ));\n }\n }\n }", "public static function refererProtect() {\r\n\r\n $referer = Environment::get(\"HTTP_REFERER\");\r\n\r\n $match = preg_match(VALID_REFERER, $referer);\r\n\r\n if ($match === 1) {\r\n return true;\r\n } else {\r\n\r\n $template = Template::init('v_403_forbidden');\r\n $template->render(403);\r\n\r\n exit();\r\n }\r\n\r\n }", "function accessPage($con, $accID)\n\t{\n\t\t$accountAccess = allowAccess($con, $accID);\n\n\t\tif($accountAccess == 1 || $accountAccess == 2)\n\t\t{\n\t\t\t\n\t\t}\n\t\telse\n\t\t{\n\t\t\theader('location: error.php');\n\t\t}\n\n\t\t#return $accessPage;\n\t}", "protected function _isAllowed() {\r\n return Mage::getSingleton('admin/session')->isAllowed('sales/bookme/reseauchx_reservationreseau/siege');\r\n }", "public function notAllowedDeliverHook()\n {\n if (CHAMELEON_CHECK_VALID_USER_SESSION_ON_PROTECTED_DOWNLOADS) {\n throw new AccessDeniedHttpException('Access denied.');\n }\n }", "function effect() {\n\t\t// Get the user\n\t\t$user =& $this->_request->getUser();\n\t\tif (!is_a($user, 'PKPUser')) return AUTHORIZATION_DENY;\n\n\t\t// Get the copyeditor submission\n\t\t$copyeditorSubmission =& $this->getAuthorizedContextObject(ASSOC_TYPE_ARTICLE);\n\t\tif (!is_a($copyeditorSubmission, 'CopyeditorSubmission')) return AUTHORIZATION_DENY;\n\n\t\t// Copyeditors can only access submissions\n\t\t// they have been explicitly assigned to.\n\t\tif ($copyeditorSubmission->getUserIdBySignoffType('SIGNOFF_COPYEDITING_INITIAL') != $user->getId()) return AUTHORIZATION_DENY;\n\n\t\treturn AUTHORIZATION_PERMIT;\n\t}", "public function verifyAccess (\n\t)\t\t\t\t\t// RETURNS <void> redirects if user is not allowed editing access.\n\t\n\t// $contentForm->verifyAccess();\n\t{\n\t\tif(Me::$clearance >= 6) { return; }\n\t\t\n\t\t// Check if guest users are allowed to post on this site\n\t\tif(!$this->guestPosts) { $this->redirect(); }\n\t\t\n\t\t// Make sure you own this content\n\t\tif($this->contentData['uni_id'] != Me::$id)\n\t\t{\n\t\t\tAlert::error(\"Invalid User\", \"You do not have permissions to edit this content.\", 7);\n\t\t\t\n\t\t\t$this->redirect();\n\t\t}\n\t\t\n\t\t// If this entry is set to official, guest submitters cannot change it any longer\n\t\tif($this->contentData['status'] >= Content::STATUS_OFFICIAL)\n\t\t{\n\t\t\tAlert::saveInfo(\"Editing Disabled\", \"This entry is now an official live post, and cannot be edited.\");\n\t\t\t\n\t\t\t$this->redirect();\n\t\t}\n\t}", "function btwp_restrict_admin_access() {\n\t\n\tglobal $current_user;\n\tget_currentuserinfo();\n\t\n\tif( !array_key_exists( 'administrator', $current_user->caps ) ) {\n\t\twp_redirect( get_bloginfo( 'url' ) );\n\t\texit;\n\t}\n\n}", "public function indexAction()\n {\n echo 'Forbidden access';\n }", "private function _limited_access_by_page($page, $global = FALSE) {\n\t\t// Let's check the page variable, because\n\t\t// we don't want to show anything if we're\n\t\t// not on the right page.\n\t\t// \n\t\t// ignore this if it's global.\n\t\tif ($global !== 'yes') {\n\t\t\tif ($page) {\n\t\t\t\t// Allow for bar|separated|pages\n\t\t\t\tif (strpos($page, '|')) {\n\t\t\t\t\t$pages = explode('|', $page);\n\t\t\t\t} else {\n\t\t\t\t\t$pages = array($page);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t// Let's use a boolean to check for permissions\n\t\t\t\t$yo_brother_can_i_access_your_blog = FALSE;\n\t\t\t\t$default_page = $this->mojo->site_model->default_page();\n\t\t\t\t\n\t\t\t\t// Loop through the pages and check\n\t\t\t\tforeach ($pages as $possible_page) {\n\t\t\t\t\t$url = implode('/', $this->mojo->uri->rsegments);\n\t\t\t\t\t\n\t\t\t\t\tif ('page/content/' . $possible_page == $url || $possible_page == $default_page) {\n\t\t\t\t\t\t$yo_brother_can_i_access_your_blog = TRUE;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t// Are we on the right page? No? Well leave!\n\t\t\t\tif (!$yo_brother_can_i_access_your_blog) {\n\t\t\t\t\treturn FALSE;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\t// I'm glad we got that over with\n\t\treturn TRUE;\n\t}", "function restrict_menus() {\n if (!current_user_can('manage_options') && is_user_logged_in()) {\n $path = get_site_url();\n $screen = get_current_screen();\n $base = $screen->id;\n\n if( 'profile' == $base || 'edit-contact' == $base || 'contact' == $base || 'edit-category' == $base ) {\n // only load these pages\n } else {\n wp_redirect($path.'/wp-admin/edit.php?post_type=contact');\n }\n }\n}", "function can_access($group_id = FALSE, $page = FALSE)\n {\n $count = $this->db\n ->from('group_permission')\n ->where('group_id', $group_id)\n ->where('module_id', '0')\n ->count_all_results();\n if ($count) {\n return TRUE;\n }\n\n // if not allowed to access everything\n // check if allowed to access requested page\n return $this->db\n ->from('module')\n ->join('group_permission', 'group_permission.module_id = module.module_id')\n ->where('group_permission.group_id', $group_id)\n ->where('module.url', $page)\n ->count_all_results();\n }", "public function checkPermission()\n\t{\n\t\tif ($this->User->isAdmin)\n\t\t{\n\t\t\treturn;\n\t\t}\n\n\t\t$this->redirect('contao/main.php?act=error');\n\t}", "public function authorize()\n {\n //return false;\n\t\treturn true;\n }", "public function authorize()\n {\n //return false;\n\t\treturn true;\n }", "public function authorize()\n {\n //return false;\n\t\treturn true;\n }", "function failed_access_blocker_adminGate($allow, $page) {\n\t//\tclean out expired attempts\n\t$sql = 'DELETE FROM '.prefix('plugin_storage').' WHERE `type`=\"failed_access\" AND `aux` < \"'.(time()-getOption('failed_access_blocker_timeout')*60).'\"';\n\tquery($sql);\n\t//\tadd this attempt\n\t$sql = 'INSERT INTO '.prefix('plugin_storage').' (`type`, `aux`,`data`) VALUES (\"failed_access\", \"'.time().'\",\"'.getUserIP().'\")';\n\tquery($sql);\n\t//\tcheck how many times this has happened recently\n\t$sql = 'SELECT COUNT(*) FROM '.prefix('plugin_storage'). 'WHERE `type`=\"failed_access\" AND `data`=\"'.getUserIP().'\"';\n\t$result = query($sql);\n\t$count = db_result($result, 0);\n\tif ($count >= getOption('failed_access_blocker_attempt_threshold')) {\n\t\t$block = getOption('failed_access_blocker_forbidden');\n\t\tif ($block) {\n\t\t\t$block = unserialize($block);\n\t\t} else {\n\t\t\t$block = array();\n\t\t}\n\t\t$block[getUserIP()] = time();\n\t\tsetOption('failed_access_blocker_forbidden',serialize($block));\n\t}\n\treturn $allow;\n}", "public function authorize()\n {\n return true; //admin guard\n }", "public function deny()\n {\n ++$this->denied;\n\n $this->result = NODE_ACCESS_DENY;\n\n // Where the actual magic happens please read the README.md file.\n if (!$this->byVote) {\n $this->stopPropagation();\n }\n }", "public function privacy_policy()\n {\n $url = array('url' => current_url());\n\n $this->session->set_userdata($url);\n\n $this->data['privacy'] = $this->home_m->get_data('privacy')->row_array();\n\n\n $body = 'privacy' ;\n\n $this->load_pages($body,$this->data);\n }", "public function authorize() {\n\t\tif (Auth::user()->user_type == \"S\" || Auth::user()->user_type == \"O\") {\n\t\t\treturn true;\n\t\t} else {\n\t\t\tabort(404);\n\t\t}\n\t}", "public function authorize()\n {\n //Check if user is authorized to access this page\n if($this->user()->authorizeRoles(['admin'])) {\n return true;\n } else {\n return false;\n }\n }", "function verify_access($user_access){\n\n switch($user_access){\n case \"ADMIN\":\n break;\n default:\n header('Location:index.php?error=0000000001');\n }\n}", "public function is_allowed_to_set_content_object_rights();", "public static function protect(){\n\t\tif(!(isset($_SESSION[\"user\"]) && isset($_SESSION[\"user\"]['userId']))){\n\t\t\theader(\"location: \".$GLOBALS['web_root']);\n\t\t\texit();\n\t\t}\n\n\t}", "function beforeFilter() {\n\t\t//parent::beforeFilter(); \n\t\t//$this->Auth->allow('*');\n\t\tif( $this->Session->read('Auth.User.status') == 0 ) // status means admin\n\t\t\t$this->redirect( array('controller'=>'pages') );\n\t}", "public function authorize()\n {\n abort_if(Gate::denies('comment_delete'), Response::HTTP_FORBIDDEN, '403 Forbidden');\n return false;\n }", "function chksecurity($page,$type=0,$redirect=0){\n $checkAll\t = false;\n $Secure\t = false;\n $obj_kind\t = $type;\n $operator\t = getUser();\n $otherRight = \"\";\n switch($type){\n\tcase 0://SYSTEM CHECK\n\t\t$objectParam=0;\n\tbreak;\n\tcase 1:// GROUP CHECK\n\t\t$objectParam=get_param(\"group\");\n\tbreak;\n\tcase 2:// SHOP CHECK\n\t\t$objectParam=get_param(\"group\").\";\".get_param(\"shop\");\n\tbreak;\n\tcase 3:// TERMINAL CHECK\n\t\t$objectParam=get_param(\"group\").\";\".get_param(\"shop\").\";\".get_param(\"term\");\n //$otherRight=\"_term\";\n\tbreak;\n\tcase 99: //CHECK IN ALL OPERATOR'S RIGHTS.\n\t\t$checkAll=true;\n\tbreak;\n }\n $pageRight =get_db_value(\"select mask from webpages where name='$page'\");\n if(!$checkAll){\n\t//take Operator's rights.\n\t$operRights=get_db_value(\"select rights$otherRight from obj_rights where op_kind=0 and obj_kind=$obj_kind and operator='$operator' and object='$objectParam;'\");\n\t//take page's security\n\tif (( (abs($pageRight) & abs($operRights)) == abs($pageRight))&& (!($pageRight==\"\")))\n\t\t$Secure=true;\n }//IF ! CHECK ALL\n else{ // -=check all=-\n\t $Secure=(get_db_value(\"select count(*) from obj_rights where operator='$operator' and (rights$otherRight|'$pageRight') = rights$otherRight\" )>0);\n\t }//end else check all\nif ($Secure&&(strlen($pageRight)))\n\treturn true;\nelse\n if ($redirect)\n \t header(\"Location: norights.php\");\n else\n return false;\n\n\n}" ]
[ "0.7619632", "0.7072883", "0.6896645", "0.68458045", "0.67869216", "0.67810124", "0.6758489", "0.6695543", "0.66813356", "0.66748095", "0.6660849", "0.66419417", "0.66035354", "0.6597928", "0.65839565", "0.6561224", "0.6559891", "0.6547126", "0.6542498", "0.654157", "0.65374285", "0.6510251", "0.6503634", "0.6488583", "0.6481371", "0.6481033", "0.6461588", "0.64409184", "0.6408593", "0.639587", "0.63882416", "0.6376586", "0.6367722", "0.6365693", "0.63590765", "0.6345976", "0.6312543", "0.63119256", "0.62939626", "0.6293003", "0.62697554", "0.62571824", "0.6252476", "0.62506735", "0.6249124", "0.62476355", "0.62416345", "0.62395346", "0.62347794", "0.6223548", "0.62130183", "0.62100637", "0.62006515", "0.6175869", "0.61735314", "0.616581", "0.61515886", "0.614226", "0.61223227", "0.6121973", "0.6090235", "0.6089613", "0.60849833", "0.60849833", "0.60841084", "0.60841084", "0.60841084", "0.60828453", "0.60828453", "0.60828453", "0.60805935", "0.60798395", "0.60769314", "0.60737383", "0.60648197", "0.60587317", "0.6045292", "0.6039892", "0.6034163", "0.6022825", "0.6022147", "0.60191447", "0.6017539", "0.6016024", "0.6008946", "0.6007557", "0.60060716", "0.60060716", "0.60060716", "0.6003628", "0.599973", "0.59893143", "0.5988885", "0.5979292", "0.5976822", "0.5975322", "0.59720373", "0.5970474", "0.59683084", "0.5959371", "0.59488744" ]
0.0
-1
Returns list of advertisements
public function get() { $this->_access("get"); $data = $this->Assets_model->getAdList(Assets_model::FULL_LIST); $this->_returnAjax(true, $data); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getAds() {\n return $this->getAdsFromSettings($this->getSettings());\n }", "public function getAds(){\n return $this->ifsp->getAds();\n }", "public function iN_ShowAds() {\n\t\t$query = mysqli_query($this->db, \"SELECT * FROM i_advertisements WHERE ads_status = '1' ORDER BY RAND() LIMIT 2\") or die(mysqli_error($this->db));\n\t\twhile ($row = mysqli_fetch_array($query)) {\n\t\t\t$data[] = $row;\n\t\t}\n\t\tif (!empty($data)) {\n\t\t\treturn $data;\n\t\t}\n\t}", "public function advertisingItems()\n {\n return $this->hasMany(AdvertisingItem::class, 'advertising_id');\n }", "public function getAdvertisers(Request $request){\n return $this->repository->getAdvertisers($request->input('limit', env('PAGINATION_LIMIT', 10)));\n }", "private function getTodayAdvertisements() {\n \treturn AdvertisementQuery::create()\n\t\t\t\t->filterByCurrent()\n\t\t\t\t->filterByBillboard($this)\n\t\t\t\t->find();\n }", "public function index()\n {\n $ads = Advertisement::all();\n\n return view('admin.advertisements.index', compact('ads'));\n }", "public function get_all_ads_data()\n\t{\n\t\treturn $this->db->get('ads')->result();\n\t}", "public function advertisers()\n {\n return $this->morphedByMany('App\\Advertiser', 'bucketable')\n ->withoutGlobalScope(MarketScope::class)\n ->withTimestamps()\n ->withPivot([\n 'notes',\n 'completed',\n ])\n ->using(BucketItem::class);\n }", "function loadAds(){\n\t\t$adsStmt = $this->dbc->query('SELECT id FROM items');\n\t\t//creates new array $ads\n\t\t$ads = [];\n\n\t\t//calls fetch and stores new ad as a new row\n\t\twhile($row = $adsStmt->fetch(PDO::FETCH_ASSOC)){\n\n\t\t\t$ad = new Ad($this->dbc, $row['id']);\n\t\t\t//stores the row into new array\n\t\t\t$ads[] = $ad;\n\t\t}\n\t\treturn $ads;\n\t}", "public function listAction(){\n\n $listAdverts = $this\n ->getDoctrine()\n ->getManager()\n ->getRepository('OCPlatformBundle:Advert')\n ->getAdvertWithApplications()\n ;\n\n foreach ($listAdverts as $advert) {\n // Ne déclenche pas de requête : les candidatures sont déjà chargées !\n // Vous pourriez faire une boucle dessus pour les afficher toutes\n $advert->getApplications();\n }\n }", "public function getAds(): string\n {\n $html = '';\n\n\n $adsService = new AdsService();\n $ads = $adsService->getAds();\n\n foreach ($ads as $ad) {\n $html .=\n '#' . $ad->getId() . ' ' .\n $ad->getTitle() . ' ' .\n $ad->getDescription() . ' ' .\n $ad->getUserId() . ' ' .\n $ad->getCarId() . '<br />';\n }\n\n return $html;\n }", "public function provides()\n {\n return array('bannersAds');\n }", "public function get_all_ads($limit, $offset) {\n $data = $this->db->get('advertisement', $limit, $offset);\n return $data->result();\n // $sql = \"select * from advertisement\";\n // $data = $this->db->query($sql);\n // return $data->result();\n }", "public function index()\n {\n $advertisements = Advertisement::all();\n return view('advertisement.index',compact('advertisements'));\n }", "public function provides()\n {\n return [\n 'ads',\n ];\n }", "public function invokeAdvertisements()\r\n {\r\n if (!isset($_GET['adverisements'])) {\r\n\r\n $advertisements = $this->model->getAdvertisements();\r\n include 'view/advertisements.php';\r\n }\r\n }", "protected abstract function loadAvailableAds();", "public function getAdsPlans()\r\n {\r\n /*$content_type = [];\r\n $objectManager = $this->blockObjectManager();\r\n $customerSession = $objectManager->create('Magento\\Customer\\Model\\Session');\r\n $customerid = $customerSession->getCustomerId();\r\n $model = $objectManager->create('Webkul\\MpAdvertisementManager\\Model\\Block')->getCollection();\r\n $data = $model->addFieldToFilter('seller_id', array('eq'=> $customerid));\r\n foreach ($data as $collections) {\r\n $content_type[] = $collections->getContentType();\r\n }\r\n $dataCollection = $this->_adsHelper->getAdsPlans()->addFieldToFilter('content_type', array('in'=> array_unique($content_type)));*/\r\n return $this->_adsHelper->getAdsPlans();\r\n // return $dataCollection;\r\n }", "public function getAnnouncements()\r\n {\r\n $sql = \"SELECT * FROM announcements\";\r\n $query=$this->db->query($sql);\r\n return $query->result_array();\r\n }", "public function get_all_ads($status = \"active\")\t{\n\n\t}", "public function agencyList() {\n\t\t$station = \\Auth::User()->station;\n\t\t$agencyList = ConnectContentAgency::where('station_id', '=', $station->id)->get();\n\t\t$agencies = array();\n\t\tforeach($agencyList as $agency) {\n\t\t\t$agencies[] = $agency->agency_name;\n\t\t}\n\t\ttry {\n\n\t\t\treturn response()->json(array('code' => 0, 'msg' => 'Success', 'data' => $agencies));\n\n\t\t} catch(\\Exception $ex) {\n\t\t\t\\Log::error($ex);\n\t\t\treturn response()->json(array('code' => -1, 'msg' => $ex->getMessage()));\n\t\t}\n\t}", "public function getAll()\n {\n $announcements = [];\n\n $select = \"SELECT * FROM announcements ORDER BY announced DESC\";\n\n $statement = $this->db->prepare($select);\n\n $statement->execute();\n\n $data = $statement->fetchAll(\\PDO::FETCH_ASSOC);\n\n foreach ($data as $row) {\n $announcements[] = new Announcement($row['site'], $row['filename'], $row['size'], $row['tth'], new\\DateTime($row['announced']));\n }\n\n return $announcements;\n\n }", "Public Function getAllAccountsAdwords()\n\t{\n\t\t$AcctAdwords = new Accounts_Adwords($this->id);\n\t\treturn $AcctAdwords->GetAllAccounts();\n\t}", "public function advertisement()\n\t{\n\t\treturn $this->belogsTo('App\\Models\\Advertisement');\n\t}", "function getbanners()\n\t\t{\n\t\t\t$banners = $this->manage_content->getValue('banner_info','*');\n\t\t\techo '<div id=\"add_space\">';\n\t\t\tforeach($banners as $banner)\n\t\t\t{\n\t\t\t\tif($banner['banner_status'] == 1)\n\t\t\t\t{\n\t\t\t\t\techo '<a href=\"'.$banner['banner_link'].'\">';\n\t\t\t\t\techo '<div class=\"add_section\"><img src=\"images/'.$banner['banner_image'].'\" style=\"height:'.$banner['banner_height'].'px;width:'.$banner['banner_width'].'px;float:left;\"/></div></a>';\n\t\t\t\t}\n\t\t\t}\n\t\t\techo '</div>';\n\t\t}", "public function getListBanner()\n {\n\n $BannerModel = new Banner();\n $Banners = $BannerModel->getListBanner();\n $this->data['newss'] = $Banners;\n\n return view('admin.banner_list', $this->data);\n }", "public function index()\n {\n $ads = Advertisement::latest()->paginate(2);\n return view('admin.advertisement.index',compact('ads'));\n }", "public function index()\n {\n $adverts = Advert::orderBy('updated_at', 'desc')->paginate(15);\n //->get();\n //->paginate(15);\n\n // Palauta kaikki resurssina\n return IlmoitusResource::collection($adverts);\n }", "public function getAdvertisingCampaigns()\n {\n $rs = $this->db->query(\"Select c.*, s.name from Sponsor_Advertising_Campaigns c\n Inner join Sponsors s on s.id = c.utm_source\n Order by c.created DESC\");\n return $rs->result();\n }", "public function index()\n {\n return new BannerCollection(Banner::orderBy('created_at', 'desc')->get());\n }", "public function get_domains_list() {\n \n }", "private function _getAdvertTypes() \n {\n $advertTypes = AdvertType::join(\n 'advert_type_translations as t', \n function ($join) {\n $join->on('advert_types.id', '=', 't.advert_type_id')\n ->where('t.locale', '=', Lang::getLocale());\n }\n ) \n ->groupBy('advert_types.id')\n ->orderBy('t.name', 'asc')\n ->select('advert_types.*')\n ->with('translations')\n ->get();\n\n return $advertTypes;\n }", "public function getAliasList();", "public static function getLiveBannerCampaigns()\n {\n return self::resultSetToObjArray(\n self::$db->fetchColumn(\n 'SELECT website.banner_campaign.banner_campaign_id FROM website.banner_campaign, website.banner_timeslot\n WHERE website.banner_campaign.banner_campaign_id = website.banner_timeslot.banner_campaign_id\n AND effective_from < now()\n AND (effective_to IS NULL\n OR effective_to > now())\n AND day = EXTRACT(ISODOW FROM now())\n AND start_time < localtime\n AND end_time > localtime\n ORDER BY \"order\" ASC'\n )\n );\n }", "public function index()\n {\n $data = array();\n $data['records'] = BeAdvertiserModel::getAdvertisers();\n $data['actives'] = array('xhbd-ads', 'list-advertiser');\n $data['action_controller'] = 'list_advertiser';\n return view('backend.advertisers.be_advertisers_view', compact('data'));\n }", "public function getAllWithUsers()\n {\n $sql = \"SELECT \n a.id as 'adid',\n a.userid as 'userid',\n a.title as 'adtitle',\n u.name as 'username'\n from advertisements a \n left join users u ON a.userid = u.id;\";\n\n $conn = $this->dbc->Get();\n $statement = $conn->prepare($sql);\n $statement->execute();\n $data = $statement->fetchAll();\n $conn = null;\n\n return $data;\n }", "public function index(){\n $leads = Lead::getAllLead();\n\n return $leads;\n }", "public function index()\n {\n $data['advertisementInfo'] = Advertisement::all();\n return view('admin.advertisement.index', $data);\n }", "public function getBannersArhived($searchText = NULL) {\n return $this->where('archive', 1)\n ->orderBy('id', 'DESC')\n ->paginate(10);\n }", "public function get()\n {\n $q = 'SELECT * FROM `affiliate`';\n \n // Sending data to the function select in dal\n $results = $this->getDal()->select($q);\n $resultsArray = [];\n\n while ($row = $results->fetch()) {\n array_push($resultsArray, new ModelWordsA($row));\n }\n\n return $resultsArray;\n\n }", "public function index()\n {\n $ads = Ads::all();\n return view('ads.index', compact('ads'));\n }", "public static function getAllBannerCampaigns()\n {\n return self::resultSetToObjArray(\n self::$db->fetchColumn('SELECT banner_campaign_id FROM website.banner_campaign')\n );\n }", "public function list(Request $request): Response\n {\n $filters = $request->input('filters') ?? [];\n $query = Advert::on();\n\n // Filter per advertiser\n if (array_key_exists('advertiser', $filters)) {\n $query = $query->where('poster', '=', $filters['advertiser']);\n }\n\n // Filter by search terms\n if (array_key_exists('search_terms', $filters)) {\n foreach ($filters['search_terms'] as $term) {\n $term = '%' . $term . '%';\n $query = $query->where('heading', 'like', $term)->orWhere('body', 'like', $term);\n }\n }\n\n // Paginate by number of items per page\n if (array_key_exists('page_number', $filters)) {\n $query = $query->forPage($filters['page_number'], $filters['per_page']);\n }\n\n return new Response($query->get()->toArray(), 200);\n }", "protected function getBannerItems()\n {\n $self = $this;\n\n return Cache::remember(\n 'home_banner_items',\n config('kosher.cache_expiration_time'),\n function () use ($self) {\n $recipes = Recipe::banner()->with('categories')->get();\n $articles = Article::banner()->published()->with('category')->get();\n $shows = Show::banner()->get();\n\n $banner = $recipes->merge($articles)\n ->merge($shows)\n ->shuffle()\n ->take(config('kosher.pagination.home_banner_items'));\n\n if (0 == $banner->count()) {\n $recipes = Recipe::featured()->with('categories')->get();\n $articles = Article::featured()->published()->with('category')->get();\n $shows = Show::featured()->get();\n\n $banner = $recipes->merge($articles)\n ->merge($shows)\n ->shuffle()\n ->take(config('kosher.pagination.home_banner_items'));\n }\n\n if (0 == $banner->count()) {\n $banner = Recipe::published()\n ->with('categories')\n ->take(config('kosher.pagination.home_banner_items'))\n ->get();\n $self->mergeReceivedRecipes($banner);\n } else {\n $recipes = collect();\n foreach ($banner as $item) {\n if ($item->isRecipe()) {\n $recipes->push($item);\n }\n }\n $self->mergeReceivedRecipes($recipes);\n }\n\n return $banner;\n }\n );\n }", "public function getAggsByList() {\n return $this->_get(6);\n }", "function getCampaignList() {\n\t\treturn $this->gateway->execCommad('getCampaignList',\"\");\n\t}", "public function getAggsList() {\n return $this->_get(1);\n }", "public function index()\n {\n $ds = Ads::orderby('ads_id','desc')->get();\n return view('BE.ads.show', compact('ds'));\n }", "public function getAdViews(){\n return $this->hasMany(AdsView::class, 'ads_id');\n }", "public function index()\n {\n $title = trans('app.all_ads');\n $ads = Ad::with('city', 'country', 'state')->whereStatus('1')->orderBy('id', 'desc')->paginate(20);\n\n return view('admin.all_ads', compact('title', 'ads'));\n }", "function _nbabanner_get_banners($randomise = false)\n{\n $banners = nbacontent_get_vocabulary('nbabanner', true);\n \n $filteredBanners = array_filter($banners, function($ele) {\n return $ele->nbabanner_link_live['und'][0]['value'] == 1;\n });\n \n if ($randomise === true) {\n shuffle($filteredBanners);\n }\n \n return $filteredBanners;\n}", "public function index()\n\t{\n $ads = Ad::orderBy('created_at', 'DESC')->published()->get();\n $user_ads = Auth::user()->ads()->published()->get();\n\n $tagads = Tagad::all();\n return view ('ads.index', compact('ads', 'user_ads', 'tagads'));\n\t}", "function getAgencyListForDropdownCom() {\n\t\tglobal $dbh;\n\t\t$agencies = array();\n\t\t\n\t\t$sql = \"SELECT AgentId, AgncyCity FROM Agencies\";\n\t\ttry {\n\t\t\tgetDBConnection();\n\t\t\t\n\t\t\t$result = mysqli_query($dbh, $sql);\n\t\t\t\n\t\t\tif(!$result) {\n\t\t\t\tprint(\"Query failed: \" . mysqli_errno($dbh) . \"--\" . mysqli_error($dbh) . \"<br/>\");\n\t\t\t\texit();\n\t\t\t}\n\t\t\t\n\t\t\twhile ($values = mysqli_fetch_object($result)) {\n\t\t\t\t$agency = new Agency();\n\t\t\t\t$agency -> setAgency($values);\n\t\t\t\tarray_push($agencies, $agency);\n\t\t\t}\n\n\t\t\treturn $agencies;\n\t\t\t\n\t\t} catch (Exception $e){\n\t\t\tprint \"<br/> $e\";\n\t\t} finally {\n\t\t\tcloseDBConnection();\n\t\t}\n\t}", "public static function buyerlist()\n {\n\n $get_buyer_list = DB::table('intra_hp_buyer_posts')\n ->select('intra_hp_buyer_posts.*')\n ->where('is_active', 1)\n ->orderBy('id', 'DESC')\n ->get();\n\n return $get_buyer_list;\n\n }", "public function getAdvisors()\n {\n return $this->hasMany(Advisor::className(), ['i_ID' => 'ID']);\n }", "public function getAggsList() {\n return $this->_get(3);\n }", "function getAdvSearchList()\r\n {\r\n $log = FezLog::get();\r\n $db = DB_API::get();\r\n\r\n $stmt = \"SELECT\r\n *\r\n FROM\r\n \" . APP_TABLE_PREFIX . \"search_key\r\n\t\t\t\t WHERE sek_adv_visible = TRUE\r\n ORDER BY\r\n sek_order ASC\";\r\n try {\r\n $res = $db->fetchAll($stmt, array(), Zend_Db::FETCH_ASSOC);\r\n }\r\n catch (Exception $ex) {\r\n $log->err($ex);\r\n return '';\r\n }\r\n\r\n if (empty($res)) {\r\n return array();\r\n } else {\r\n for ($i = 0; $i < count($res); $i++) {\r\n $res[$i][\"field_options\"] = Search_Key::getOptions($res[$i][\"sek_smarty_variable\"]);\r\n }\r\n return $res;\r\n }\r\n }", "public function get_allBanners($where_banner)\t\n\t{\n\t\t$query = $this->db->get_where('announcement',$where_banner);\n\n\t\t$result = $query->result_array();\n\n\t\tif(!empty($result))\n\t\t{\n\t\t\treturn $result;\n\t\t}\n\t\telse\n\t\t\t{\n\t\t\t\treturn false;\n\t\t\t}\n\t}", "public function index()\n {\n $banners = Banner::all();\n return view('admin.banners.list_banner')->withBanners($banners);\n }", "public function getAvailableAdTypes()\n {\n $query = \"SELECT ALL FROM adv_type WHERE is_available = 'y'\";\n return $this->getQueryData($query, $this->getConnection());\n }", "public function actionIndex()\n {\n $searchModel = new AdvertiserApiSearch();\n $dataProvider = $searchModel->search(Yii::$app->request->queryParams);\n\n return $this->render('index', [\n 'searchModel' => $searchModel,\n 'dataProvider' => $dataProvider,\n ]);\n }", "public function index() {\n return 'List all the ads';\n }", "public function index()\n {\n $agencies = Agency::all();\n\n return AgencyResource::collection($agencies);\n }", "public function getTagList();", "public function load_banner_ids_by_adzone( $aid ) \n\t{\t\n\t\t$args = array(\n\t\t\t'numberposts' => -1,\n\t\t\t'post_type' => 'banners'\n\t\t );\t\t\n\t\t$banners = get_posts( $args );\n\t\t$ids = array();\n\t\t\n\t\tforeach( $banners as $banner)\n\t\t{\n\t\t\t$links = get_post_meta($banner->ID, \"linked_adzones\", true);\n\t\t\t$res = !empty($links) ? in_array( $aid, $links ) ? $banner->ID : '' : '';\n\t\t\tif( !empty($res) )\n\t\t\t{\n\t\t\t\t$ids[] = $res;\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn $ids;\n\t}", "public function getAds()\n {\n $ads = Ad::with('store')->where('company_id',Auth::id())->get();\n return Datatables::of($ads)\n ->addColumn('store_name', function ($ad) {\n return $ad->store->name;\n })\n ->addColumn('time', function ($ad) {\n return $ad->time.' seconds';\n })\n ->addColumn('preview', function ($ad) {\n if($ad->media_type == 'image') {\n return '<img width=\"100\" src=\"'.checkImage('ads/'. $ad->media).'\" /> <span style=\"padding-left: 30px\">(Image)</span>';\n }\n else {\n //return '<embed src=\"'.checkImage('ads/'. $ad->media).'\" autostart=\"false\" height=\"30\" width=\"50\" />';\n return '<video width=\"100\" ><source src=\"'.checkImage('ads/'. $ad->media).'\" type=\"video/mp4\"></video> <span style=\"padding-left: 30px\">(Video)</span>';\n }\n })\n ->addColumn('action', function ($ad) {\n return '\n <a href=\"ads/'. Hashids::encode($ad->id).'/edit\" class=\"text-primary\" data-toggle=\"tooltip\" title=\"Edit Ad\"><i class=\"fa fa-edit action-padding\"></i> </a> \n <a href=\"javascript:void(0)\" class=\"text-danger btn-delete\" data-toggle=\"tooltip\" title=\"Delete Ad\" id=\"'.Hashids::encode($ad->id).'\"><i class=\"fa fa-trash action-padding\"></i></a>';\n })\n ->rawColumns(['action','store_name','preview'])\n ->editColumn('id', 'ID: {{$id}}')\n ->make(true);\n }", "function gatherResults($conn, $advert_id)\n {\n $query = \"SELECT whwp_Advert.* FROM whwp_Advert \"\n . \"WHERE whwp_Advert.advert_id = :advert_id \";\n $conn->prepQuery($query);\n $conn->bind('advert_id', $advert_id);\n $advert=[];\n $advert = $conn->single();\n return $advert;\n }", "function getAgenciesInfo() {\n\t\tglobal $dbh;\n\t\t$agencies = array();\n\t\t\n\t\t$sql = \"SELECT * FROM Agencies\";\n\t\ttry {\n\t\t\tgetDBConnection();\n\t\t\t\n\t\t\t$result = mysqli_query($dbh, $sql);\n\t\t\t\n\t\t\tif(!$result) {\n\t\t\t\tprint(\"Query failed: \" . mysqli_errno($dbh) . \"--\" . mysqli_error($dbh) . \"<br/>\");\n\t\t\t\texit();\n\t\t\t}\n\t\t\t\n\t\t\twhile ($values = mysqli_fetch_object($result)) {\n\t\t\t\t$agency = new Agency();\n\t\t\t\t$agency -> setAgency($values);\n\t\t\t\tarray_push($agencies, $agency);\n\t\t\t}\n\n\t\t\treturn $agencies;\n\t\t\t\n\t\t} catch (Exception $e){\n\t\t\tprint \"<br/> $e\";\n\t\t} finally {\n\t\t\tcloseDBConnection();\n\t\t}\n\t}", "public function getLinksList()\n {\n $sql = 'SELECT bwl.*, bwll.`title`, bwll.`url`\n FROM `'._DB_PREFIX_.'bwcatbanner_link` bwl\n LEFT JOIN `'._DB_PREFIX_.'bwcatbanner_link_lang` bwll\n ON (bwl.`id_item` = bwll.`id_item`)\n WHERE bwl.`id_shop` = '.(int)Context::getContext()->shop->id.'\n AND bwll.`id_lang` = '.(int)Context::getContext()->language->id;\n\n return Db::getInstance()->executeS($sql);\n }", "public function getInfosAdhesion() {\n $listeInfos = $this->getInfos(\"adhesion\");\n return $listeInfos;\n }", "function getAgencies() {\n $query = \"SELECT * FROM `agencies`\";\n $return = Database::selectQuery($query);\n if ($return != null) { \n return $return;\n } else {\n return null;\n }\n }", "public function banners()\n {\n $banners = DB::table('banners')->latest('created_at')->limit(5)->get();\n\n return response()->json($banners);\n }", "public function index()\n {\n return $this->bannerService->index();\n }", "public function getAudiences()\n {\n return new Audiences(array('order_name' => true));\n }", "public function actionIndex()\n {\n $searchModel = new BJobAdvertisementSearch();\n $dataProvider = $searchModel->search(Yii::$app->request->queryParams);\n\n return $this->render('index', [\n 'searchModel' => $searchModel,\n 'dataProvider' => $dataProvider,\n ]);\n }", "public function adproviderList()\n {\n \t$adproviders = Adprovider::paginate(10);\n\n \treturn view('Backend.Admin.adproviders.adprovider_list',compact('adproviders'));\n }", "public function _list($adId) {\n return $this->run('list', array($adId));\n }", "public static function getActiveBannerCampaigns()\n {\n return self::resultSetToObjArray(\n self::$db->fetchColumn(\n 'SELECT banner_campaign_id FROM website.banner_campaign\n WHERE effective_from < now()\n AND (effective_to IS NULL\n OR effective_to > now())'\n )\n );\n }", "public static function All()\n {\n $result = &get_instance()->db->order_by(\"posted_on\", \"DESC\")->get_where(\"Announcements\", array());\n $ret = array();\n foreach($result->result() as $r)\n $ret[] = Announcement_model::LoadWithData($r);\n return $ret;\n }", "public function get_banners($offset = 0, $limit = LIST_LIMIT) {\n $this->db->limit($limit, $offset);\n $query = $this->db->get('banners');\n return $query->result_array();\n }", "public function index()\n {\n $adverts = Advert::paginate(10);\n return view('admin.adverts.index', compact('adverts'));\n }", "abstract protected function getAdapters(): array;", "public function getBanners()\n {\n $rows = $this->iaDb->all(iaDb::ALL_COLUMNS_SELECTION, \"`status` = 'active'\", null, null, self::getTable());\n\n if (is_array($rows) && $rows) {\n $banners = [];\n foreach ($rows as $entry) {\n $banners[$entry['position']][] = $entry;\n }\n\n return $banners;\n }\n\n return false;\n }", "function getAffiliatesList($aff_id='')\n\t\t{\n\t\t\t\n\t\t\t$query = \"select a.affiliate_id, concat(m.first_name,' ', m.last_name) as name, a.organisation_name, m.reg_date, a.banner, a.description \n\t\t\tfrom tbl_member m \n\t\t\tleft join tbl_affiliate a \n\t\t\ton m.member_id = a.affiliate_id \n\t\t\twhere m.member_type = 'affiliate' and m.member_id!=$aff_id and isActive <> 'd'\";\n\n\t\t\t$rs = $this->Execute($query);\n\t\t return $this->_getPageArray($rs, 'Affiliate');\n\t\t}", "public function info()\n {\n if (!addon_installed('banners')) {\n return array();\n }\n\n if (get_option('is_on_banner_buy') == '1') {\n $banner_url = build_url(array('page' => '_SELF', 'type' => 'bannerinfo', 'id' => 'banners'), get_module_zone('banners'));\n\n return array(do_template('POINTSTORE_BANNERS_2', array('_GUID' => '0b34fc7675b4a71fd6e530ad43213e70', 'BANNER_URL' => $banner_url)));\n }\n return array();\n }", "public function index()\n {\n $user = Auth::user();\n\n $paginate = 5;\n $orderBy = 'DESC';\n $ads = $user->ads();\n\n if (request()->get('q') != null) {\n $q = request()->get('q');\n $ads->where(\"id\", \"LIKE\", \"%\" . $q . \"%\");\n }\n\n if (request()->get('paginate') != null) {\n $paginate = request()->get('paginate');\n }\n\n if (request()->get('orderBy') != null) {\n $orderBy = request()->get('orderBy');\n }\n\n $ads = $ads->orderBy('created_at', $orderBy)->paginate($paginate);\n\n return view('company.ads.list')->with(['ads' => $ads]);\n }", "public function getAllApplicants();", "public function advertisement()\n {\n return $this->hasOne(Advertisement::class);\n }", "public function getAdapters()\n {\n return $this->adapters;\n }", "function getTopAdvertisements() {\t\t\t\t\n\t$advs = \\App\\SearchModel::where('views','>',0)->orderBy(\"views\",'desc')->limit(10)->get();\n\t\t\t\n\t\treturn view('home',['advs'=>$advs]);\n\t}", "public function index()\n {\n $adverts = Advert::all();\n $categories = Category::all();\n $products = Product::orderBy('updated_at', 'desc')->take(15)->get();\n return response()->json([\n \"adverts\" => $adverts,\n \"categories\" => $categories,\n \"products\" => $products\n ]);\n }", "public function ads($fields = [])\n {\n $ads = $this->facebookAdAccount->getAds($fields);\n\n return $this->format($ads);\n }", "public function getAllPapers() {\r\n $papers = Mage::getModel('giftwrap/giftwrap')\r\n ->getCollection()\r\n ->addFieldToFilter(\r\n 'store_id', Mage::app()->getStore()->getId())\r\n ->addFieldToFilter('status', 1)\r\n ;\r\n $list = array();\r\n foreach ($papers as $paper) {\r\n $list[] = $paper;\r\n }\r\n return $list;\r\n }", "public function index()\n {\n $ads = Ad::paginate(15);\n return view('admin.ads.index',['title'=>$this->title,'ads'=>$ads]);\n }", "function getARecords() {\n\t\t$arecords = array();\n\t\tif ( isset( $this->hostInfo[0]['arecord'] ) ) {\n\t\t\t$arecords = $this->hostInfo[0]['arecord'];\n\t\t\tarray_shift( $arecords );\n\t\t}\n\n\t\treturn $arecords;\n\t}", "public function index()\n {\n $webpages = Webpage::pluck('name', 'id');\n\n return view('admin.site_admin.admin.ads')->with([\n 'url'=>'ads',\n 'webpages'=>$webpages\n ]);\n }", "public function alimentos() {\n $listaAlim = $this->alimModel->carregaAlimentosSite2App();\n echo json_encode($listaAlim);\n }", "public function toSearchableArray() {\n return $this->only('battletag');\n }", "public function show($id)\n {\n $banners = Banner::find($id);\n return $banners;\n }" ]
[ "0.7152385", "0.7147864", "0.69743204", "0.6758144", "0.6615171", "0.65573615", "0.65280724", "0.6485346", "0.64453346", "0.63983893", "0.63850963", "0.631851", "0.6297464", "0.6192183", "0.6191075", "0.6120291", "0.6105555", "0.6042099", "0.6016627", "0.60152864", "0.60120374", "0.5945661", "0.5928969", "0.5896781", "0.5894243", "0.5831076", "0.5749718", "0.57396084", "0.5732852", "0.5732636", "0.5717713", "0.57125753", "0.56964517", "0.5672642", "0.5658882", "0.5641144", "0.5625333", "0.5613648", "0.56044614", "0.5597445", "0.5567665", "0.556307", "0.55547124", "0.5549363", "0.55465436", "0.5539093", "0.5534703", "0.55272824", "0.552423", "0.55133945", "0.55123574", "0.5509805", "0.5501388", "0.55006075", "0.5497605", "0.54904324", "0.54891306", "0.54854", "0.5479723", "0.54767686", "0.5476727", "0.5476581", "0.547391", "0.5466397", "0.54581445", "0.5452016", "0.5449186", "0.5447516", "0.54468286", "0.54354316", "0.5429424", "0.5426077", "0.5402376", "0.538752", "0.53626674", "0.53565633", "0.53551704", "0.5337106", "0.53276044", "0.5307722", "0.5306555", "0.5304403", "0.530401", "0.5301812", "0.5294492", "0.5284637", "0.5283031", "0.52762735", "0.5266625", "0.52664363", "0.52624154", "0.5261412", "0.525859", "0.5251016", "0.52437747", "0.52391386", "0.5230371", "0.5222667", "0.5211323", "0.5209248" ]
0.5321271
79
Enable / selected ad
public function enable() { $this->_access("put"); $status = $this->Assets_model->enable($this->input->post()); $this->_returnAjax($status); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static function enable(){\n self::$enabled = true; \n self::$disabled=false;\n }", "public function enable();", "public function enable();", "public function enable()\n {\n $this->enabled = true;\n }", "public function enable($id)\n {\n }", "public function enable() {\n\t\t$this->update(FALSE);\n\t}", "function enableAccount($accountId)\n\t\t{\n\t\t\tmysql_query(\"UPDATE argus_accounts SET status = 'ENABLED' WHERE account_id = '\".$accountId.\"' AND status = 'DISABLED'\") or die(mysql_error());\n\t\t\t\n\t\t\treturn;\n\t\t}", "public static function enable() {\n\t\tself::$enabled = true;\n\t}", "function showAd()\r\n {\r\n }", "public function enable()\n {\n add_settings_field(\n 'enable',\n apply_filters($this->plugin_name . 'label-enable', esc_html__('Enable', $this->plugin_name)),\n [$this->builder, 'checkbox'],\n $this->plugin_name,\n $this->plugin_name . '-general',\n [\n 'description' => 'Serve ' . get_site_url() . '/.well-known/security.txt on your WordPress site.',\n 'id' => 'enable',\n 'value' => isset($this->options['enable']) ? $this->options['enable'] : false,\n ]\n );\n }", "public static function enable(): void\n {\n self::$isEnabled = true;\n }", "public function enable() {}", "public function enable()\n\t{\n\t\t$this->disabled_at = null;\n\t\t$this->disabled_by_user_id = null;\n\t\t$this->save();\n\t}", "public function enable()\n {\n try {\n $sql = \"SELECT value FROM s_core_config_values WHERE element_id = '\" .\n $this->getElementId('BACKEND_CH_CC_ACTIVE').\"'\";\n Shopware()->Db()->query($sql);\n $query = Shopware()->Db()->query($sql);\n $data = $query->fetchAll();\n if (!isset($data[0]['value'])) {\n $sql = \"UPDATE s_core_paymentmeans SET active = '1' WHERE name = 'vrpay_cc'\";\n Shopware()->Db()->query($sql);\n }\n\n $sql = \"SELECT value FROM s_core_config_values WHERE element_id = '\" .\n $this->getElementId('BACKEND_CH_CCSAVED_ACTIVE').\"'\";\n Shopware()->Db()->query($sql);\n $query = Shopware()->Db()->query($sql);\n $data = $query->fetchAll();\n if (!isset($data[0]['value'])) {\n $sql = \"UPDATE s_core_paymentmeans SET active = '1' WHERE name = 'vrpay_ccsaved'\";\n Shopware()->Db()->query($sql);\n }\n\n $sql = \"SELECT value FROM s_core_config_values WHERE element_id = '\" .\n $this->getElementId('BACKEND_CH_DD_ACTIVE').\"'\";\n Shopware()->Db()->query($sql);\n $query = Shopware()->Db()->query($sql);\n $data = $query->fetchAll();\n if (!isset($data[0]['value'])) {\n $sql = \"UPDATE s_core_paymentmeans SET active = '1' WHERE name = 'vrpay_dd'\";\n Shopware()->Db()->query($sql);\n }\n\n $sql = \"SELECT value FROM s_core_config_values WHERE element_id = '\" .\n $this->getElementId('BACKEND_CH_DDSAVED_ACTIVE').\"'\";\n Shopware()->Db()->query($sql);\n $query = Shopware()->Db()->query($sql);\n $data = $query->fetchAll();\n if (!isset($data[0]['value'])) {\n $sql = \"UPDATE s_core_paymentmeans SET active = '1' WHERE name = 'vrpay_ddsaved'\";\n Shopware()->Db()->query($sql);\n }\n\n $sql = \"SELECT value FROM s_core_config_values WHERE element_id = '\" .\n $this->getElementId('BACKEND_CH_GIROPAY_ACTIVE').\"'\";\n Shopware()->Db()->query($sql);\n $query = Shopware()->Db()->query($sql);\n $data = $query->fetchAll();\n if (!isset($data[0]['value'])) {\n $sql = \"UPDATE s_core_paymentmeans SET active = '1' WHERE name = 'vrpay_giropay'\";\n Shopware()->Db()->query($sql);\n }\n\n $sql = \"SELECT value FROM s_core_config_values WHERE element_id = '\" .\n $this->getElementId('BACKEND_CH_KLARNAPAYLATER_ACTIVE').\"'\";\n Shopware()->Db()->query($sql);\n $query = Shopware()->Db()->query($sql);\n $data = $query->fetchAll();\n if (!isset($data[0]['value'])) {\n $sql = \"UPDATE s_core_paymentmeans SET active = '1' WHERE name = 'vrpay_klarnapaylater'\";\n Shopware()->Db()->query($sql);\n }\n\n $sql = \"SELECT value FROM s_core_config_values WHERE element_id = '\" .\n $this->getElementId('BACKEND_CH_KLARNASLICEIT_ACTIVE').\"'\";\n Shopware()->Db()->query($sql);\n $query = Shopware()->Db()->query($sql);\n $data = $query->fetchAll();\n if (!isset($data[0]['value'])) {\n $sql = \"UPDATE s_core_paymentmeans SET active = '1' WHERE name = 'vrpay_klarnasliceit'\";\n Shopware()->Db()->query($sql);\n }\n\n $sql = \"SELECT value FROM s_core_config_values WHERE element_id = '\" .\n $this->getElementId('BACKEND_CH_PAYPAL_ACTIVE').\"'\";\n Shopware()->Db()->query($sql);\n $query = Shopware()->Db()->query($sql);\n $data = $query->fetchAll();\n if (!isset($data[0]['value'])) {\n $sql = \"UPDATE s_core_paymentmeans SET active = '1' WHERE name = 'vrpay_paypal'\";\n Shopware()->Db()->query($sql);\n }\n\n $sql = \"SELECT value FROM s_core_config_values WHERE element_id = '\" .\n $this->getElementId('BACKEND_CH_PAYPALSAVED_ACTIVE').\"'\";\n Shopware()->Db()->query($sql);\n $query = Shopware()->Db()->query($sql);\n $data = $query->fetchAll();\n if (!isset($data[0]['value'])) {\n $sql = \"UPDATE s_core_paymentmeans SET active = '1' WHERE name = 'vrpay_paypalsaved'\";\n Shopware()->Db()->query($sql);\n }\n\n $sql = \"SELECT value FROM s_core_config_values WHERE element_id = '\" .\n $this->getElementId('BACKEND_CH_PAYDIREKT_ACTIVE').\"'\";\n Shopware()->Db()->query($sql);\n $query = Shopware()->Db()->query($sql);\n $data = $query->fetchAll();\n if (!isset($data[0]['value'])) {\n $sql = \"UPDATE s_core_paymentmeans SET active = '1' WHERE name = 'vrpay_paydirekt'\";\n Shopware()->Db()->query($sql);\n }\n\n $sql = \"SELECT value FROM s_core_config_values WHERE element_id = '\" .\n $this->getElementId('BACKEND_CH_KLARNAOBT_ACTIVE').\"'\";\n Shopware()->Db()->query($sql);\n $query = Shopware()->Db()->query($sql);\n $data = $query->fetchAll();\n if (!isset($data[0]['value'])) {\n $sql = \"UPDATE s_core_paymentmeans SET active = '1' WHERE name = 'vrpay_klarnaobt'\";\n Shopware()->Db()->query($sql);\n }\n\n $sql = \"SELECT value FROM s_core_config_values WHERE element_id = '\" .\n $this->getElementId('BACKEND_CH_EASYCREDIT_ACTIVE').\"'\";\n Shopware()->Db()->query($sql);\n $query = Shopware()->Db()->query($sql);\n $data = $query->fetchAll();\n if (!isset($data[0]['value'])) {\n $sql = \"UPDATE s_core_paymentmeans SET active = '1' WHERE name = 'vrpay_easycredit'\";\n Shopware()->Db()->query($sql);\n }\n return $result['success'] = true;\n } catch (Exception $e) {\n return $result['success'] = false;\n }\n }", "function enable ($enabled = true);", "public function enable( $name );", "function do_ad_switch() {\n if (isset($this->html->noise) && is_array($this->html->noise)) {\n foreach ($this->html->noise as $key => $value) {\n if (strpos($value, 'google_ad_client') !== false) {\n $publoc = strpos($value, 'pub-');\n $sufloc = strpos($value, '\"', $publoc);\n if (!$sufloc)\n $sufloc = strpos($value, \"'\", $publoc);\n echo $publoc . ' ' . $sufloc;\n if ($publoc && $sufloc)\n $this->html->noise[$key] = substr($value, 0, $publoc) . 'pub-7523823497771676' . substr($value, $sufloc);\n }\n }\n }\n // INS TAGS\n foreach ($this->html->find('ins') as $e) {\n $e->{'data-ad-client'} = 'ca-pub-7523823497771676';\n }\n }", "function enableAdministrator($id) {\r\n\r\n\t\t$this->query('UPDATE admins SET `enabled` = 1 WHERE id= '. $id .';');\r\n\r\n\t}", "public static function enable()\n {\n self::$_enabled = TRUE;\n }", "public function enable($enable) {\n\t\tself::$isEnable = $bool;\n\t}", "public function admin_enable($id = null) {\n\n\t\t\t/*disable rendering of view*/\n\t\t\t$this->autoRender = false;\n\n\t\t\t/*set activity as \"Enable\"*/\n\t\t\t$act=array('activ'=>'1');\n\n\t\t\t/*save activity parameter to table \"modules\"*/\n\t\t\t$this->Module->id=$id;\n\t\t\t$this->Module->save($act);\n\n\t\t\t/*back to method \"admin_index\"*/\n\t\t\t$this->redirect(array('action' => 'admin_index'));\n\t\t\t}", "public static function enable(): void\n {\n static::$_enabled = true;\n }", "public function enabled();", "public function enabled();", "public function enabled();", "public function enabled();", "public function setEnabled($enabled);", "public function setEnabled($enabled);", "public function enable( $id ){\n\t\t$response = $this->curl->put( $this->api_url . '/' . $id . '/enable', [ \n\t\t\t'access_token' => $this->token\n\t\t]);\n\n\t\treturn $response;\n\t}", "function admin_enable($id = null) {\n\n\t\t$subdomain = $this->Subdomain->read(null, $id);\n\n\t\t/**\n\t\t * Read the \"Status\" component for more informations.\n\t\t * Dir : controllers/components/status.php\n\t\t */\n\t\tif (!empty($subdomain)) {\n\n\t\t\t$subdomain['Subdomain']['status'] = 0;\n\n\t\t\t/**\n\t\t\t * Select the subdomain name with the ID.\n\t\t\t * It's necessary for the insert in the \"robot\" table.\n\t\t\t * @var string\n\t\t\t */\n\t\t\t$data = $this->Robot->search($id, 'Subdomain');\n\t\t\t\n\t\t\t/**\n\t\t\t * Change the subdomain status.\n\t\t\t * Redirect the administrator to index page.\n\t\t\t */\n\t\t\tif ($this->Subdomain->save($subdomain)) {\n\t\t\t\t\n\t\t\t\t/**\n\t\t\t\t * Insert the delete action in the \"robot\" table.\n\t\t\t\t * The Perl robot will check in this table.\n\t\t\t\t */\n\t\t\t\t$this->Robot->insert($data['Subdomain']['name'], 'SUBDOMAIN', $data['User']['name'], NULL, $data['Subdomain']['domain_id'], NULL, 5);\n\n\t\t\t\t/**\n\t\t\t\t * Insert the enable action in the \"logs\" table.\n\t\t\t\t */\n\t\t\t\t$this->Logs->insert($this->Auth->user('id'), '<strong>[ ' . $data['Subdomain']['name'] . ' ]</strong> ' . __d('domain', 'Subdomain enabled by (' . $this->Auth->user('name') . ').', true) , 'DNS', $_SERVER[\"REMOTE_ADDR\"]);\n\t\t\t\t\n\t\t\t\t$this->Session->setFlash(__d('domain', 'The subdomain has been enabled.', true));\n\t\t\t\t$this->redirect(array('action' => 'index'));\n\n\t\t\t}\n\t\t}\n\n\t}", "public function actionEnable()\n\t{\n\t\t// can be requested over GET, so check for the token manually\n\t\t$this->_checkCsrfFromToken($this->_input->filterSingle('_xfToken', XenForo_Input::STRING));\n\t\n\t\t$fieldId = $this->_input->filterSingle('field_id', XenForo_Input::UINT);\n\t\treturn $this->_switchFormActiveStateAndGetResponse($fieldId, 1);\n\t}", "function enable($target = 'core');", "protected function enabled()\n {\n }", "function cm_widget_adinclude() {\n\t$ads = get_option('cm_show_ads'); // Gets the option from theme options page\n\t\tif($ads == 'Yes') { ?>\n\t\t\t<div class=\"widget\">\n\t\t\t\t<?php include (TEMPLATEPATH . \"/ads.php\"); ?>\n\t\t\t</div> <?php\n\t\t}\n}", "function enable($id=null) {\n $db = GetGlobal('db');\t\n\t $id = GetReq('id');//is the recid of rcbrowser call\n\t \n\t //get ctgid (negative number)\n\t $sSQL = \"select ctgid from categories where id=\" . $id; \n\t $result = $db->Execute($sSQL,2);\t\n\t if ($result) { \n\t while(!$result->EOF) {\t \n\t\t $ctgid = $result->fields[0];\n\t\t $result->MoveNext();\t\t\t \t\t \n\t\t }\n }\t\n\t //make ctgid negative number\t\n\t $sSQL = \"update categories set ctgid=\" . abs($ctgid) . \" where id=\" . $id; \n\t $result = $db->Execute($sSQL,2);\n \t if ($result) { \n\t $ret = ' enabled!';\n\t }\n\t \n\t return ($ret); \n\t\t\t\t\t\t \t\t \n }", "public function enable_powered_by() {\n\t\tupdate_option( 'algolia_powered_by_enabled', 'yes' );\n\t}", "Public Function enableUser($ID)\n\t{\n\t\t$this->_db->exec(\"UPDATE bevomedia_user SET enabled = 1 WHERE id = $ID\");\n\t\t\n\t}", "public function setEnabled( $enabled ){\r\n $this->enabled = $enabled;\r\n \r\n $sqlQuery = \"UPDATE users SET enable = \" . $enabled . \" WHERE user_id = \" . $this->getID() . \" AND role = '\" . AGENT_ROLE_ID . \"';\";;\r\n $result = $this->dbcomm->executeQuery($sqlQuery);\r\n\r\n if ($result != true)\r\n {\r\n echo \"<br><b>\" . $this->dbcomm->giveError() . \"</b>\";\r\n return 0;\r\n }\r\n else\r\n {\r\n if ( $this->dbcomm->affectedRows() == 1) \r\n {\r\n return 1;\r\n }\r\n else\r\n {\r\n return 0;\r\n }\r\n\r\n } \r\n }", "function affiliatewp_dlt_plugin_activate() {\n\tadd_option( 'affwp_dlt_activated', true );\n}", "public function enable(string $slug);", "public static function enable($enable = true) : void\n {\n }", "public function testEnableLink() {\n $enabledLink = $this->Links->find('all')\n ->where(['title' => 'Enabled link'])\n ->toArray()[0];\n $result = $this->Links->enable($enabledLink);\n $this->assertEquals(false, $result);\n }", "public function activate_banner($smart_banner_website)\n\t{\n\t\t$data = array('smart_banner_status' => 1);\n\t\t\n\t\t$this->db->where(array('smart_banner_website' => $smart_banner_website, 'customer_id' => $this->session->userdata('customer_id')));\n\t\t\n\t\tif($this->db->update('smart_banner', $data))\n\t\t{\n\t\t\treturn TRUE;\n\t\t}\n\t\telse\n\t\t{\n\t\t\treturn FALSE;\n\t\t}\n\t}", "function advertising()\n\t{\n\t\t$this->viewdata[\"function_title\"] = __(\"Advertising\");\n\n\t\t$form = array();\n\n\t\t$form['open'] = array(\n\t\t\t'type' => 'open'\n\t\t);\n\n\t\t$form['fs_ads_top_banner'] = array(\n\t\t\t'type' => 'textarea',\n\t\t\t'label' => __('Top banner'),\n\t\t\t'help' => __('Insert the HTML code provided by your advertiser.'),\n\t\t\t'preferences' => TRUE,\n\t\t\t'validation' => 'trim',\n\t\t\t'class' => 'span5'\n\t\t);\n\n\t\t$form['fs_ads_top_banner_active'] = array(\n\t\t\t'type' => 'checkbox',\n\t\t\t'preferences' => TRUE,\n\t\t\t'help' => __('Enable top banner')\n\t\t);\n\n\t\t$form['fs_ads_bottom_banner'] = array(\n\t\t\t'type' => 'textarea',\n\t\t\t'label' => __('Bottom banner'),\n\t\t\t'help' => __('Insert the HTML code provided by your advertiser.'),\n\t\t\t'preferences' => TRUE,\n\t\t\t'validation' => 'trim',\n\t\t\t'class' => 'span5'\n\t\t);\n\n\t\t$form['fs_ads_bottom_banner_active'] = array(\n\t\t\t'type' => 'checkbox',\n\t\t\t'preferences' => TRUE,\n\t\t\t'help' => __('Enable bottom banner')\n\t\t);\n\n\t\t$form['separator'] = array(\n\t\t\t'type' => 'separator'\n\t\t);\n\n\t\t$form['submit'] = array(\n\t\t\t'type' => 'submit',\n\t\t\t'value' => __('Submit'),\n\t\t\t'class' => 'btn btn-primary'\n\t\t);\n\n\t\t$form['close'] = array(\n\t\t\t'type' => 'close'\n\t\t);\n\n\t\t$this->preferences->submit_auto($form);\n\n\t\t$data['form'] = $form;\n\n\t\t// create a form\n\t\t$this->viewdata[\"main_content_view\"] = $this->load->view(\"admin/form_creator\",\n\t\t\t$data, TRUE);\n\t\t$this->load->view(\"admin/default\", $this->viewdata);\n\t}", "public function enable(): bool {}", "private function SetRequestEnableSettings() { \n if($_GET[\"enable\"] == '1') {\n $query = \"update [|PREFIX|]order_review_config set `sendrequest`= '1' where id = '1' \";\n $GLOBALS['ISC_CLASS_DB']->Query($query);\n echo \"1\";\n exit;\n }\n else {\n $query = \"update [|PREFIX|]order_review_config set `sendrequest`= '0' where id = '1' \";\n $GLOBALS['ISC_CLASS_DB']->Query($query);\n echo \"0\";\n exit;\n }\n }", "public function enablecounter($id){\n \t\t// $counters = $counter->fetchArray();\n \t\t// if ($counters['keyenabled'] == 1) {\n \t\t// \t echo json_encode(['success'=>False,'msg'=>'Someone Enabled this Counter Just Now...']);\n \t\t// \texit;\n \t\t// }\n \t\t// else{\n\n \t\t// \t$okay = $this->db->query(\"UPDATE tblcountersettings SET keyenabled = 1 WHERE counterid =\".$id);\n \t\t// \tif ($okay) {\n \t\t\t echo json_encode(['success'=>TRUE,'msg'=>'Successfully Enabled']);\n \t\t\t exit;\n \t\t// \t}\n \t\t// \t echo json_encode(['success'=>False,'msg'=>'Something Went Wrong...']);\n\n \t\t// \texit;\n \t\t// }\n \t}", "function cm_widget_ads() {\n?>\n<?php\n\t$ads = get_option('cm_show_ads'); // Gets the option from theme options page\n\t\tif($ads == 'No') { }\n\t\tif($ads == 'Yes') { \n\t\t\t$ad1_image = get_option('cm_ad_image_one');\n\t\t\t$ad1_url = get_option('cm_ad_url_one'); \n\t\t\t$ad2_image = get_option('cm_ad_image_two');\n\t\t\t$ad2_url = get_option('cm_ad_url_two');\n\t\t\t$ad3_image = get_option('cm_ad_image_three');\n\t\t\t$ad3_url = get_option('cm_ad_url_three');\n\t\t\t?>\n\t\t\n\t\t\t<div class=\"ads clearfix\">\n\t\t\t\t<a href=\"<?php echo $ad1_url; ?>\"><img src=\"<?php echo $ad1_image; ?>\" /></a>\n\t\t\t\t<a href=\"<?php echo $ad2_url; ?>\"><img src=\"<?php echo $ad2_image; ?>\" /></a>\n\t\t\t\t<a href=\"<?php echo $ad3_url; ?>\"><img src=\"<?php echo $ad3_image; ?>\" /></a>\n\t\t\t</div>\n\t\t<?php } ?>\n<?php\n}", "public function enablePost($id) {\n $activ = 0;\n $db = $this->dbConnect();\n $req = $db->prepare('UPDATE p5_posts SET ART_DESACTIVE = ? WHERE ART_ID= ?');\n $req->execute(array($activ, $id));\n return $req;\n }", "function Enable() {\n\n\t\t\t//add_action('load-categories.php', array(\"TreBiMeteo\",'SetAdminConfiguration'));\n\t\t\t//add_action('load-edit-tags.php', array(\"TreBiMeteo\",'SetAdminConfiguration'));\n\t\t\t// Aggiungiamo la pagina delle opzioni\n\t\t\tadd_action('admin_menu', array(\"TreBiMeteo\",'SetAdminConfiguration'));\n\t\t\t//add_action('widgets_init', array(\"TreBiMeteo\",'SetWidget'));\t\t\t\n\n\t\t}", "public function plugin_activate() {\r\n\t\tupdate_option( $this->options_name, $this->options);\r\n\t}", "function admin_enable($id = null) {\n\n\t\t$user = $this->User->read(null, $id);\n\n\t\t/**\n\t\t * Read the \"Status\" component for more informations.\n\t\t * Dir : controllers/components/status.php\n\t\t */\n\t\tif (!empty($user)) {\n\n\t\t\t$user['User']['status'] = 0;\n\n\t\t\t/**\n\t\t\t * Change the user status.\n\t\t\t * Redirect the administrator to index page.\n\t\t\t */\n\t\t\tif ($this->User->save($user)) {\n\t\t\t\t$this->Session->setFlash(__d('core', 'The user has been enabled.', true));\n\t\t\t\t$this->redirect(array('action' => 'index'));\n\t\t\t}\n\t\t}\n\n\t}", "public function setEnabled($enabled)\n {\n $this->enabled = (int) $enabled;\n }", "public function enable()\r\n {\r\n $this->enabled = true;\r\n\r\n if (!$this->booted) {\r\n $this->boot();\r\n }\r\n }", "public function enableProduct( $id ) {\n\t\treturn $this->requester->request('PUT', $this->url . '/' . $id . '/enable');\n\t}", "public static function enableAll($linkIDs) {\n\t\tif (empty($linkIDs)) return;\n\t\t\n\t\t// enable the links\n\t\t$sql = \"UPDATE \twcf\".WCF_N.\"_linklist_link\n\t\t\tSET\tisDisabled = 0,\n\t\t\t\teverEnabled = 1\n\t\t\tWHERE \tlinkID IN (\".$linkIDs.\")\";\n\t\tWCF::getDB()->sendQuery($sql);\n\t\t\n\t}", "function editads() \n\t{\n\t\t$view = $this->getView('ads');\n\t\t// Get/Create the model\n\t\tif ($model = $this->getModel('editads'))\n\t\t{\n\t\t\t//Push the model into the view (as default)\n\t\t\t//Second parameter indicates that it is the default model for the view\n\t\t\t$view->setModel($model, true);\n\t\t}\n\t\t$view->setLayout('adslayout');\n\t\t$view->editads();\n\t}", "public function hookEnable(): void\n {\n $this->say(\"Executing the Plugin's enable hook...\");\n $this->_exec(\"php ./src/hook_enable.php\");\n }", "public function setRequiresAzureAd(?bool $value): void {\n $this->getBackingStore()->set('requiresAzureAd', $value);\n }", "public function enable($id)\n {\n $user = User::find($id);\n $user->is_enable = 1;\n $user->save();\n\n return redirect()->route('user.index');\n }", "public function enable($onclick, $id='', $isEnabled=false, $params=array()) {\n $params['onclick'] = $onclick;\n if ($isEnabled)\n return '<img src=\"'.$this->cfg()->get('url','img').'ok.png\" id=\"isActive_'.$id.'\" title=\"'.$this->_i18n->getContent('Enabled').'\" alt=\"'.$this->_i18n->getContent('Enabled').'\"' . $this->_prepareParams('', $params) . ' class=\"controlIcon\">';\n else\n return '<img src=\"'.$this->cfg()->get('url','img').'locked.png\" id=\"isActive_'.$id.'\" title=\"'.$this->_i18n->getContent('Disabled').'\" alt=\"'.$this->_i18n->getContent('Disabled').'\"' . $this->_prepareParams('', $params) . ' class=\"controlIcon\">';\n }", "public function handleEnableListing($id){ \n $login = $this->hlp->logn();\n \n if ($this->listings->isListingAuthor($id, $login)){ \n if (!empty($this->listings->getPostageOptions($id))){\n $this->listings->enable($id);\n } else {\n $this->flashMessage(\"Prosím přidejte poštovní možnosti před \"\n .\"zveřejněním Vašeho listingu.\");\n }\n } \n $this->redirect(\"Listings:in\");\n }", "public function setEnabled($enabled) {\n $this->enabled = $enabled;\n }", "public function enable($id)\n\t{\n\t\t$blog=Blog::withTrashed()->find($id);\n\t\tif($blog){\n\t\t\t$blogDisabled=Blog::onlyTrashed()->find($id);\n\t\t\tif($blogDisabled){\n\t\t\t\t$blogDisabled->restore();\n\t\t\t\treturn redirect()->back()->with('success',trans('blog.enabled'));\n\t\t\t}\n\t\t\telse{\n\t\t\t\treturn redirect()->back()->with('failure',trans('blog.enable_failed'));\n\t\t\t}\n\t\t}\n\t\telse\n\t\t\treturn redirect()->back()->with('failure',trans('blog.not_exist'));\n\t}", "function ad_activate(){\n\trequire_once(dirname(__FILE__).'/installer.php');\n}", "function isEnabled ();", "public function enableBuyerByID( $buyerID, $enabled ) {\r\n {\r\n if ($enabled == 0 || $enabled == 1){\r\n $buyer = new Buyer();\r\n if ($buyer->loadBuyerByID($buyerID)){\r\n $buyer->setEnabled($enabled);\r\n return 1;\r\n }\r\n else {\r\n return 0;\r\n }\r\n }\r\n else {\r\n return 0;\r\n }\r\n }\r\n }", "public function comment_flag_enable() {\n\t\t\t$enabled = $this->is_enabled();\n\t\t\t?>\n\t\t\t<label for=\"<?php echo esc_attr( $this->_plugin_prefix ); ?>_enabled\">\n\t\t\t\t<input name=\"<?php echo esc_attr( $this->_plugin_prefix ); ?>_enabled\" id=\"<?php echo esc_attr( $this->_plugin_prefix ); ?>_enabled\" type=\"checkbox\" value=\"1\" <?php checked( $enabled ); ?> />\n\t\t\t\t<?php esc_html_e( \"Allow your visitors to flag a comment as inappropriate.\" ); ?>\n\t\t\t</label>\n\t\t\t<?php\n\t\t}", "public function enablePlugin($args){\n\n // Note the ID and the name attribute of the element match that of the ID in the call to add_settings_field\n echo '<input type=\"checkbox\" id=\"'. $this->htmlName .'\" name=\"'. $this->htmlName .'\" value=\"1\" ' . checked(1, get_option($this->htmlName), false) . '/>'; \n \n echo'<label for=\"'. $this->htmlName .'\"> ' . $args[0] . '</label>'; \n }", "public function enabled($store = null);", "public function activate() {\n global $wp_roles;\n\n if ( class_exists( 'WP_Roles' ) && ! isset( $wp_roles ) ) {\n // @codingStandardsIgnoreLine\n $wp_roles = new \\WP_Roles();\n }\n\n $all_cap = array(\n 'dokan_view_booking_menu',\n 'dokan_add_booking_product',\n 'dokan_edit_booking_product',\n 'dokan_delete_booking_product',\n 'dokan_manage_booking_products',\n 'dokan_manage_booking_calendar',\n 'dokan_manage_bookings',\n 'dokan_manage_booking_resource',\n );\n\n foreach ( $all_cap as $key => $cap ) {\n $wp_roles->add_cap( 'seller', $cap );\n $wp_roles->add_cap( 'administrator', $cap );\n $wp_roles->add_cap( 'shop_manager', $cap );\n }\n\n // flush rewrite rules after plugin is activate\n $this->flush_rewrite_rules();\n }", "public function enable($actions) {\n\t\tforeach ((array)$actions as $action) {\n\t\t\t$this->action($action)->enable();\n\t\t}\n\t}", "public function enable(OvalSourceDef &$ovalSourceDef) {\n \t$this->db->query(\n \"update OvalSourceDef set enabled=\".Constants::$ENABLED.\" where id=\".mysql_real_escape_string($ovalSourceDef->getId()));\n }", "function isEnabled();", "function isEnabled();", "public function toggleEnabled(){\n \n global $DB;\n \n $obj = new \\stdClass();\n $obj->id = $this->id;\n $obj->enabled = !$this->enabled;\n $DB->update_record(\"bcgt_crit_award_structures\", $obj);\n \n // If this is a Build grading structure, disable all the others first\n // Removed this, as now GCSE have different grading structures for different assessments\n// if ($this->qualBuildID > 0)\n// {\n// \n// $DB->execute(\"UPDATE {bcgt_crit_award_structures} \n// SET enabled = 0\n// WHERE buildid = ?\n// AND id <> ?\n// AND deleted = 0\", array($this->qualBuildID, $this->id));\n// \n// }\n \n }", "function enable_salesperson($user_id) {\n \n $conn = db_connect();\n\n // Prepared statement for selecting salesperson dropdown options\n $enable_salesperson_stmt = pg_prepare(\n $conn,\n \"enable_salesperson_stmt\",\n \"UPDATE users SET enabled = true, type = 'a' WHERE id = $user_id;\"\n );\n\n $result = pg_execute($conn, \"enable_salesperson_stmt\", array());\n}", "function warquest_home_ad() {\r\n\r\n\t/* input */\r\n\tglobal $config;\r\n\tglobal $player;\r\n\r\n\t/* output */\r\n\tglobal $page;\r\n\t\r\n\t$page .= '<div class=\"subparagraph\">'.t('HOME_ANNOUNCEMENTS').'</div>';\r\n\t\t\t\r\n\t$page .= '<a href=\"javascript:link(\\''.warquest_token('mid='.MENU_HELP.'&sid='.PAGE_DONATE).'\\')\">';\t\t\t\r\n\t$page .= warquest_image('other/ad1.png', 'width=\"510\" height=\"75\" id=\"ad\" ');\r\n\t$page .= '</a>';\r\n\t\t\r\n\t$page .= '<script language=\"JavaScript\" type=\"text/javascript\">';\r\n\t$page .= 'var AdCount=1; ';\r\n\t$page .= 'var filename=\"\"; ';\r\n\t$page .= 'function StartAd() { ';\r\n\t$page .= ' if (++AdCount>3) { AdCount=1; } ';\r\n\t$page .= ' filename = \"'.$config[\"content_url\"].'images/other/ad\" + AdCount + \".png\"; ';\r\n\t$page .= ' document.getElementById(\"ad\").src = filename; ';\r\n\t$page .= ' setTimeout(\"StartAd()\", 3000); ';\r\n\t$page .= '} ';\r\n\t$page .= 'StartAd();';\r\n\t$page .= '</script>'; \r\n}", "public static function Allow_optin() {\n\t\tupdate_option( 'xlp_is_opted', 'yes', false );\n\n\t\t//try to push data for once\n\t\t$data = self::collect_data();\n\n\t\t//posting data to api\n\t\tXL_API::post_tracking_data( $data );\n\t}", "public function activateFeature($EncryptFeaturedID = null, $status = 0) {\n $this->autoRender = false;\n $data['StoreFeaturedSection']['id'] = $this->Encryption->decode($EncryptFeaturedID);\n $data['StoreFeaturedSection']['is_active'] = $status;\n if ($this->StoreFeaturedSection->save($data)) {\n if ($status) {\n $SuccessMsg = \"Featured Section Activated\";\n } else {\n $SuccessMsg = \"Featured Section Deactivated\";\n }\n $this->Session->setFlash(__($SuccessMsg), 'alert_success');\n $this->redirect($this->referer());\n } else {\n $this->Session->setFlash(__(\"Some problem occured\"), 'alert_failed');\n $this->redirect($this->referer());\n }\n }", "public function setAdTypeAvailable($id)\n {\n $query = \"UPDATE adv_type SET is_available = 'y' WHERE id = $id\";\n return $this->getQueryResult($query, $this->getConnection());\n }", "public function activate() {\n\t\t/**\n\t\t * Fires when the plugin is being activated.\n\t\t *\n\t\t * @since 7.0\n\t\t */\n\t\tdo_action('audition_activate');\n\t}", "public function doEnableDb() {\r\n\t\t$this->db = xn(\"db\");\r\n\t\t\r\n\t\t$ret = $this->_mongo->selectDB(\"admin\")->command(array(\r\n\t\t\t\"enablesharding\" => $this->db\r\n\t\t));\r\n\t\t\r\n\t\t$this->ret = $this->_highlight($ret, \"json\");\r\n\t\t\r\n\t\t$this->display();\r\n\t}", "public function enable($id)\n {\n $sentence = new SentenceUtil();\n $sentence->addCommand(\"/ip/address/enable\");\n $sentence->where(\".id\", \"=\", $id);\n $enable = $this->talker->send($sentence);\n return \"Sucsess\";\n }", "public function setEnabled(string $enabled): void\n {\n $this->enabled = $enabled;\n }", "public function enablePlan($id) \n {\n try {\n\n $plan = Plan::find($id);\n $plan->active = 1;\n $plan->save();\n\n return response(['message' => 'The plan has been enabled'], 200);\n \n } catch (Exception $e) {\n return response(['message' => $e->getMessage()], 500);\n }\n }", "public static function activate() {\n $random = substr(str_shuffle(MD5(microtime())), 0, 16);\n\n add_option('haa_admin_area', 'hidden-admin');\n add_option('haa_secret_key', $random);\n }", "public function setDisabledYes()\n\t{\n\t\t$this->setAttribute( \"disabled\");\n\t}", "function enableclient()\n {\n exec('ifconfig ' . escapeshellarg($this->interface) . ' up');\n exec($this->arfilelocation['iwpriv'] . ' ' . escapeshellarg($this->interface) . ' set SiteSurvey=1');\n }", "public function enable()\n {\n $sql = \"UPDATE s_core_menu SET active = 1 WHERE controller = 'CustomSort';\";\n Shopware()->Db()->query($sql);\n\n return ['success' => true, 'invalidateCache' => ['backend']];\n }", "function activate()\n {\n $aData = array( 'SIZE_AVATAR' => 50,\n 'NUMERO_POST' => 5 );\n\n // Comprobamos si existe opciones para este Widget, si no existe las creamos por el contrario actualizamos\n if( ! get_option( 'ultimosPostPorAutor' ) )\n add_option( 'ultimosPostPorAutor' , $aData );\n else\n update_option( 'ultimosPostPorAutor' , $data);\n }", "public function setAlwaysDisplay( $ad = true )\n\t\t{\n\t\t\t$this->_alwaysDisplay = $ad;\n\t\t}", "public function activate()\n {\n $license = Licenses::find($this->key);\n $license->school_id = $this->auth_school_id;\n $license->activated_at = Carbon::now();\n $license->used=LICENCE_KEY_USED;\n if($license->save()){\n return $this->duration($license->duration);\n }\n return FALSE;\n }", "public function enableCredential($id): void;", "public function enableAlert(DataContainer $dc)\n\t{\n\t\tif (!$this->Input->get('pid') && $this->Input->get('act') == 'edit' && $this->Input->get('id'))\n\t\t{\n\t\t\t$this->Input->setGet('pid', $this->Database->prepare(\"SELECT pid FROM tl_news WHERE id=?\")->execute($this->Input->get('id'))->pid);\n\t\t}\n\t\t\n\t\tif ($this->Input->get('act') != '' && $this->Input->get('act') != 'delete' && $this->Input->get('act') != 'paste' && $this->Database->prepare(\"SELECT newsalert FROM tl_news_archive WHERE id=?\")->execute($this->Input->get('pid'))->newsalert)\n\t\t{\n\t\t\t\t$GLOBALS['TL_DCA']['tl_news']['palettes']['default'] = str_replace('published,', 'published,newsalert,', $GLOBALS['TL_DCA']['tl_news']['palettes']['default']);\n\t\t}\n\t}", "private function setEnableReviews() {\n $this->product->set_reviews_allowed($this->wcData->isEnableReviews());\n }", "function enable($bool, $precision)\n {\n $this->enabled = $bool;\n $this->precision = $precision;\n }", "public static function enableIntegration(\\pm_Domain $domain)\n {\n $source = \\Phlesk\\Context::getModuleId();\n\n \\pm_Log::debug(\"Triggering event 'enable_domain'\");\n \\pm_ActionLog::submit('enable_domain', $domain->getId(), [], [$source]);\n }", "public function inject_banner() {\n\t\t$this->banner_settings = get_option( 'cookieproCCPASettings' );\n\t\t$this->behavior_settings = get_option( 'cookieproCCPABehaviorSettings' );\n\t\t$this->floatingdata = get_option( 'CookieProCCPAButtonFloatings' );\n\t\tif( ! empty( $this->floatingdata ) ){\n\t\t\t$this->linkenable = $this->floatingdata;\n\t\t} else {\n\t\t\t$this->linkenable = $this->banner_settings;\n\t\t}\n\t\tinclude_once WP_PLUGIN_DIR . '/' . $this->plugin->name . '/assets/html/banner.php';\n\t}", "function addads() \n\t{\n\t\t$view = $this->getView('ads');\n\t\t// Get/Create the model\n\t\tif ($model = $this->getModel('addads'))\n\t\t{\n\t\t\t//Push the model into the view (as default)\n\t\t\t//Second parameter indicates that it is the default model for the view\n\t\t\t$view->setModel($model, true);\n\t\t}\n\t\t$view->setLayout('adslayout');\n\t\t$view->ads();\n\t}" ]
[ "0.6452728", "0.6431711", "0.6431711", "0.62657654", "0.6232522", "0.6152717", "0.614125", "0.6082993", "0.6075986", "0.60622406", "0.6043429", "0.6025881", "0.60234344", "0.600189", "0.5922936", "0.59054965", "0.58908147", "0.58877134", "0.5878262", "0.5758668", "0.57314956", "0.5678668", "0.5663855", "0.5663855", "0.5663855", "0.5663855", "0.56284314", "0.56284314", "0.56080776", "0.5568166", "0.5552003", "0.5539566", "0.5538602", "0.5522462", "0.5512799", "0.54556704", "0.5442813", "0.5438775", "0.5433533", "0.54180855", "0.53776264", "0.5356281", "0.53493744", "0.5300091", "0.52880013", "0.52867675", "0.5284553", "0.52590585", "0.52526474", "0.52506965", "0.52504116", "0.52484524", "0.52429485", "0.522158", "0.52142406", "0.52083963", "0.5202226", "0.5190212", "0.51811117", "0.5175832", "0.517375", "0.51611996", "0.51525533", "0.5147326", "0.5146706", "0.51465225", "0.5137575", "0.51222956", "0.5116348", "0.51158774", "0.5113947", "0.5112755", "0.5108147", "0.5107933", "0.5107933", "0.5105532", "0.5090256", "0.5088913", "0.5081971", "0.50709015", "0.5067987", "0.50679344", "0.5058857", "0.50499415", "0.50473404", "0.50439954", "0.50400215", "0.5038158", "0.5037663", "0.50369346", "0.5036542", "0.5029741", "0.5019376", "0.5016755", "0.5016185", "0.50055784", "0.5003227", "0.49956715", "0.49951187", "0.49909708" ]
0.609854
7
Bootstrap the application services.
public function boot() { $this->publishes([ __DIR__.'/assets/js' => public_path('/js/tchoblond59/sscompteur'), ], 'larahome-package'); $this->loadRoutesFrom(__DIR__.'/routes.php'); $this->loadViewsFrom(__DIR__.'/views', 'sscompteur'); $this->loadMigrationsFrom(__DIR__.'/migrations'); Event::listen('App\Events\MSMessageEvent', '\Tchoblond59\SSCompteur\EventListener\SSCompteurEventListener'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function boot()\n {\n // Boot here application\n }", "public function boot()\n {\n $configuration = [];\n\n if (file_exists($file = getcwd() . '/kaleo.config.php')) {\n $configuration = include_once $file;\n }\n\n $this->app->singleton('kaleo', function () use ($configuration) {\n return new KaleoService($configuration);\n });\n }", "public function boot()\n {\n $this->app->singleton('LaraCurlService', function ($app) {\n return new LaraCurlService();\n });\n\n $this->loadRoutesFrom(__DIR__.'/routes/web.php');\n }", "public function boot()\n {\n //\n }", "public function boot()\n {\n //\n }", "public function boot()\n {\n //\n }", "public function boot()\n {\n //\n }", "public function boot()\n {\n //\n }", "public function boot()\n {\n //\n }", "public function boot()\n {\n //\n }", "public function boot()\n {\n //\n }", "public function boot()\n {\n //\n }", "public function boot()\n {\n //\n }", "public function boot()\n {\n //\n }", "public function boot()\n {\n //\n }", "public function boot()\n {\n //\n }", "public function boot()\n {\n //\n }", "public function boot()\n {\n //\n }", "public function boot()\n {\n //\n }", "public function boot()\n {\n //\n }", "public function boot()\n {\n //\n }", "public function boot()\n {\n //\n }", "public function boot()\n {\n //\n }", "public function boot()\n {\n //\n }", "public function boot()\n {\n //\n }", "public function boot()\n {\n //\n }", "public function boot()\n {\n //\n }", "public function boot()\n {\n //\n }", "public function boot()\n {\n //\n }", "public function boot()\n {\n //\n }", "public function boot()\n {\n //\n }", "public function boot()\n {\n //\n }", "public function boot()\n {\n //\n }", "public function boot()\n {\n //\n }", "public function boot()\n {\n //\n }", "public function boot()\n {\n //\n }", "public function boot()\n {\n //\n }", "public function boot()\n {\n //\n }", "public function boot()\n {\n //\n }", "public function boot()\n {\n //\n }", "public function boot()\n {\n //\n }", "public function boot()\n {\n //\n }", "public function boot()\n {\n //\n }", "public function boot()\n {\n //\n }", "public function boot()\n {\n //\n }", "public function boot()\n {\n //\n }", "public function boot()\n {\n //\n }", "public function boot()\n {\n //\n }", "public function boot()\n {\n //\n }", "public function boot()\n {\n //\n }", "public function boot()\n {\n //\n }", "public function boot()\n {\n //\n }", "public function boot()\n {\n //\n }", "public function boot()\n {\n //\n }", "public function boot()\n {\n //\n }", "public function boot()\n {\n //\n }", "public function boot()\n {\n //\n }", "public function boot()\n {\n //\n }", "public function boot()\n {\n //\n }", "public function boot()\n {\n //\n }", "public function boot()\n {\n //\n }", "public function boot()\n {\n //\n }", "public function boot()\n {\n //\n }", "public function boot()\n {\n //\n }", "public function boot()\n {\n //\n }", "public function boot()\n {\n //\n }", "public function boot()\n {\n //\n }", "public function boot()\n {\n //\n }", "public function boot()\n {\n //\n }", "public function boot()\n {\n //\n }", "public function boot()\n {\n //\n }", "public function boot()\n {\n //\n }", "public function boot()\n {\n //\n }", "public function boot()\n {\n //\n }", "public function boot()\n {\n //\n }", "public function boot()\n {\n //\n }", "public function boot()\n {\n //\n }", "public function boot()\n {\n //\n }", "public function boot()\n {\n //\n }", "public function boot()\n {\n //\n }", "public function boot()\n {\n //\n }", "public function boot()\n {\n //\n }", "public function boot()\n {\n //\n }", "public function boot()\n {\n //\n }", "public function boot()\n {\n //\n }", "public function boot()\n {\n //\n }", "public function boot()\n {\n //\n }", "public function boot()\n {\n //\n }", "public function boot()\n {\n //\n }", "public function boot()\n {\n //\n }", "public function boot()\n {\n //\n }", "public function boot()\n {\n //\n }", "public function boot()\n {\n //\n }", "public function boot()\n {\n //\n }", "public function boot()\n {\n //\n }", "public function boot()\n {\n //\n }", "public function boot()\n {\n //\n }", "public function boot()\n {\n //\n }", "public function boot()\n {\n //\n }", "public function boot()\n {\n //\n }", "public function boot()\n {\n //\n }" ]
[ "0.7218277", "0.7040664", "0.7003676", "0.69654787", "0.69654787", "0.69654787", "0.69654787", "0.69654787", "0.69654787", "0.69654787", "0.69654787", "0.69654787", "0.69654787", "0.69654787", "0.69654787", "0.69654787", "0.69654787", "0.69654787", "0.69654787", "0.69654787", "0.69654787", "0.69654787", "0.69654787", "0.69654787", "0.69654787", "0.69654787", "0.69654787", "0.69654787", "0.69654787", "0.69654787", "0.69654787", "0.69654787", "0.69654787", "0.69654787", "0.69654787", "0.69654787", "0.69654787", "0.69654787", "0.69654787", "0.69654787", "0.69654787", "0.69654787", "0.69654787", "0.69654787", "0.69654787", "0.69654787", "0.69654787", "0.69654787", "0.69654787", "0.69654787", "0.69654787", "0.69654787", "0.69654787", "0.69654787", "0.69654787", "0.69654787", "0.69654787", "0.69654787", "0.69654787", "0.69654787", "0.69654787", "0.69654787", "0.69654787", "0.69654787", "0.69654787", "0.69654787", "0.69654787", "0.69654787", "0.69654787", "0.69654787", "0.69654787", "0.69654787", "0.69654787", "0.69654787", "0.69654787", "0.69654787", "0.69654787", "0.69654787", "0.69654787", "0.69654787", "0.69654787", "0.69654787", "0.69654787", "0.69654787", "0.69654787", "0.69654787", "0.69654787", "0.69654787", "0.69654787", "0.69654787", "0.69654787", "0.69654787", "0.69654787", "0.69654787", "0.69654787", "0.69654787", "0.69654787", "0.69654787", "0.69654787", "0.69654787", "0.69654787" ]
0.0
-1
Register the application services.
public function register() { }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function register()\n {\n $this->registerServices();\n }", "public function register()\n {\n $this->registerAssets();\n $this->registerServices();\n }", "public function register()\n\t{\n\n $this->registerUserService();\n $this->registerCountryService();\n $this->registerMetaService();\n $this->registerLabelService();\n $this->registerTypeService();\n $this->registerGroupeService();\n $this->registerActiviteService();\n $this->registerRiiinglinkService();\n $this->registerInviteService();\n $this->registerTagService();\n $this->registerAuthService();\n $this->registerChangeService();\n $this->registerRevisionService();\n $this->registerUploadService();\n //$this->registerTransformerService();\n }", "public function register()\n { \n // User Repository\n $this->app->bind('App\\Contracts\\Repository\\User', 'App\\Repositories\\User');\n \n // JWT Token Repository\n $this->app->bind('App\\Contracts\\Repository\\JSONWebToken', 'App\\Repositories\\JSONWebToken');\n \n $this->registerClearSettleApiLogin();\n \n $this->registerClearSettleApiClients();\n \n \n }", "public function register()\n {\n $this->app->bind(\n 'Uhmane\\Repositories\\ContatosRepository', \n 'Uhmane\\Repositories\\ContatosRepositoryEloquent'\n );\n }", "public function register()\n {\n // $this->app->make('CheckStructureService');\n }", "public function register()\n {\n $this->mergeConfigFrom(\n __DIR__.'/../config/telescope-error-service-client.php', 'telescope-error-service-client'\n );\n\n $this->registerStorageDriver();\n\n $this->commands([\n Console\\InstallCommand::class,\n Console\\PublishCommand::class,\n ]);\n }", "public function register()\n\t{\n\t\t$this->registerPasswordBroker();\n\n\t\t$this->registerTokenRepository();\n\t}", "public function register()\n {\n $this->registerRepositories();\n }", "public function register()\n {\n $this->registerFacades();\n $this->registerRespository();\n }", "public function register()\n {\n App::bind('App\\Repositories\\UserRepositoryInterface','App\\Repositories\\UserRepository');\n App::bind('App\\Repositories\\AnimalRepositoryInterface','App\\Repositories\\AnimalRepository');\n App::bind('App\\Repositories\\DonationTypeRepositoryInterface','App\\Repositories\\DonationTypeRepository');\n App::bind('App\\Repositories\\NewsAniRepositoryInterface','App\\Repositories\\NewsAniRepository');\n App::bind('App\\Repositories\\DonationRepositoryInterface','App\\Repositories\\DonationRepository');\n App::bind('App\\Repositories\\ProductRepositoryInterface','App\\Repositories\\ProductRepository');\n App::bind('App\\Repositories\\CategoryRepositoryInterface','App\\Repositories\\CategoryRepository');\n App::bind('App\\Repositories\\TransferMoneyRepositoryInterface','App\\Repositories\\TransferMoneyRepository');\n App::bind('App\\Repositories\\ShippingRepositoryInterface','App\\Repositories\\ShippingRepository');\n App::bind('App\\Repositories\\ReserveProductRepositoryInterface','App\\Repositories\\ReserveProductRepository');\n App::bind('App\\Repositories\\Product_reserveRepositoryInterface','App\\Repositories\\Product_reserveRepository');\n App::bind('App\\Repositories\\Ordering_productRepositoryInterface','App\\Repositories\\Ordering_productRepository');\n App::bind('App\\Repositories\\OrderingRepositoryInterface','App\\Repositories\\OrderingRepository');\n App::bind('App\\Repositories\\UserUpdateSlipRepositoryInterface','App\\Repositories\\UserUpdateSlipRepository');\n }", "public function register()\n {\n // Automatically apply the package configuration\n $this->mergeConfigFrom(__DIR__.'/config.php', 'laragle.authorization');\n }", "public function register()\n {\n //\n if ($this->app->environment() !== 'production') {\n $this->app->register(\\Barryvdh\\LaravelIdeHelper\\IdeHelperServiceProvider::class);\n }\n\n\n\n\n $this->app->register(ResponseMacroServiceProvider::class);\n $this->app->register(TwitterServiceProvider::class);\n }", "public function register()\n {\n $this->app->bind(\n 'Toyopecas\\Repositories\\TopoRepository',\n 'Toyopecas\\Repositories\\TopoRepositoryEloquent'\n );\n\n $this->app->bind(\n 'Toyopecas\\Repositories\\ServicesRepository',\n 'Toyopecas\\Repositories\\ServicesRepositoryEloquent'\n );\n\n $this->app->bind(\n 'Toyopecas\\Repositories\\SobreRepository',\n 'Toyopecas\\Repositories\\SobreRepositoryEloquent'\n );\n\n $this->app->bind(\n 'Toyopecas\\Repositories\\ProdutosRepository',\n 'Toyopecas\\Repositories\\ProdutosRepositoryEloquent'\n );\n }", "public function register()\n {\n $this->registerOtherProviders()->registerAliases();\n $this->loadViewsFrom(__DIR__.'/../../resources/views', 'jarvisPlatform');\n $this->app->bind('jarvis.auth.provider', AppAuthenticationProvider::class);\n $this->loadRoutes();\n }", "public function register()\n {\n include __DIR__.'/routes.php';\n\n $this->app->make('Jlopezcur\\MediaManager\\MediaManagerController');\n }", "public function register()\n {\n // $this->app->bind('AuthService', AuthService::class);\n }", "public function register()\n {\n $this->app->bind(\n PegawaiServiceContract::class,\n PegawaiService::class \n );\n\n $this->app->bind(\n RiwayatPendidikanServiceContract::class,\n RiwayatPendidikanService::class \n );\n\n $this->app->bind(\n ProductionHouseServiceContract::class,\n ProductionHouseService::class\n );\n\n $this->app->bind(\n MovieServiceContract::class,\n MovieService::class\n );\n\n $this->app->bind(\n PangkatServiceContract::class,\n PangkatService::class \n );\n\n }", "public function register()\n {\n $this->registerAccountService();\n\n $this->registerCurrentAccount();\n\n //$this->registerMenuService();\n\n //$this->registerReplyService();\n }", "public function register()\n {\n $this->mergeConfigFrom(__DIR__.'/../config/awesio-auth.php', 'awesio-auth');\n\n $this->app->singleton(AuthContract::class, Auth::class);\n\n $this->registerRepositories();\n\n $this->registerServices();\n\n $this->registerHelpers();\n }", "public function register()\n {\n $this->registerRequestHandler();\n $this->registerAuthorizationService();\n $this->registerServices();\n }", "public function register()\r\n {\r\n $this->mergeConfigFrom(__DIR__.'/../config/colissimo.php', 'colissimo');\r\n $this->mergeConfigFrom(__DIR__.'/../config/rules.php', 'colissimo.rules');\r\n $this->mergeConfigFrom(__DIR__.'/../config/prices.php', 'colissimo.prices');\r\n $this->mergeConfigFrom(__DIR__.'/../config/zones.php', 'colissimo.zones');\r\n $this->mergeConfigFrom(__DIR__.'/../config/insurances.php', 'colissimo.insurances');\r\n $this->mergeConfigFrom(__DIR__.'/../config/supplements.php', 'colissimo.supplements');\r\n // Register the service the package provides.\r\n $this->app->singleton('colissimo', function ($app) {\r\n return new Colissimo;\r\n });\r\n }", "public function register()\n {\n\n\n\n $this->app->bind(\n 'Onlinecorrection\\Repositories\\UserRepository',\n 'Onlinecorrection\\Repositories\\UserRepositoryEloquent'\n );\n\n $this->app->bind(\n 'Onlinecorrection\\Repositories\\ClientRepository',\n 'Onlinecorrection\\Repositories\\ClientRepositoryEloquent'\n );\n\n $this->app->bind(\n 'Onlinecorrection\\Repositories\\ProjectRepository',\n 'Onlinecorrection\\Repositories\\ProjectRepositoryEloquent'\n );\n\n $this->app->bind(\n 'Onlinecorrection\\Repositories\\DocumentRepository',\n 'Onlinecorrection\\Repositories\\DocumentRepositoryEloquent'\n );\n\n $this->app->bind(\n 'Onlinecorrection\\Repositories\\OrderRepository',\n 'Onlinecorrection\\Repositories\\OrderRepositoryEloquent'\n );\n\n $this->app->bind(\n 'Onlinecorrection\\Repositories\\OrderItemRepository',\n 'Onlinecorrection\\Repositories\\OrderItemRepositoryEloquent'\n );\n\n $this->app->bind(\n 'Onlinecorrection\\Repositories\\DocumentImageRepository',\n 'Onlinecorrection\\Repositories\\DocumentImageRepositoryEloquent'\n );\n $this->app->bind(\n 'Onlinecorrection\\Repositories\\PackageRepository',\n 'Onlinecorrection\\Repositories\\PackageRepositoryEloquent'\n );\n $this->app->bind(\n 'Onlinecorrection\\Repositories\\StatusRepository',\n 'Onlinecorrection\\Repositories\\StatusRepositoryEloquent'\n );\n\n }", "public function register()\n {\n\n $this->app->register(RepositoryServiceProvider::class);\n }", "public function register()\n {\n $this->registerInertia();\n $this->registerLengthAwarePaginator();\n }", "public function register()\n {\n $this->registerConfig();\n\n $this->app->register('Arcanedev\\\\LogViewer\\\\Providers\\\\UtilitiesServiceProvider');\n $this->registerLogViewer();\n $this->app->register('Arcanedev\\\\LogViewer\\\\Providers\\\\CommandsServiceProvider');\n }", "public function register()\n {\n include __DIR__.'/routes.php';\n $this->app->make('Unrulynatives\\Attitudes\\AttitudesController');\n }", "public function register()\n\t{\n\t\t$this->app->bind(\n\t\t\t'Illuminate\\Contracts\\Auth\\Registrar',\n\t\t\t'APIcoLAB\\Services\\Registrar'\n\t\t);\n\n $this->app->bind(\n 'APIcoLAB\\Repositories\\Flight\\FlightRepository',\n 'APIcoLAB\\Repositories\\Flight\\SkyScannerFlightRepository'\n );\n\n $this->app->bind(\n 'APIcoLAB\\Repositories\\Place\\PlaceRepository',\n 'APIcoLAB\\Repositories\\Place\\SkyScannerPlaceRepository'\n );\n\t}", "public function register()\n {\n $this->app->bind('App\\Services\\UserService');\n $this->app->bind('App\\Services\\PostService');\n $this->app->bind('App\\Services\\MyPickService');\n $this->app->bind('App\\Services\\FacebookService');\n $this->app->bind('App\\Services\\LikeService');\n }", "public function register()\r\n {\r\n $this->mergeConfigFrom(__DIR__ . '/../config/laravel-base.php', 'laravel-base');\r\n\r\n $this->app->bind(UuidGenerator::class, UuidGeneratorService::class);\r\n\r\n }", "public function register()\n {\n $this->app->bind('tochka', function () {\n return new Tochka();\n });\n $this->mergeConfigFrom(__DIR__.'/../config/tochka.php', 'tochka');\n }", "public function register()\n {\n $this->app->bind(\n 'Larafolio\\Http\\HttpValidator\\HttpValidator',\n 'Larafolio\\Http\\HttpValidator\\CurlValidator'\n );\n\n $this->app->register(ImageServiceProvider::class);\n }", "public function register()\n\t{\n\t\t$this->app->bind('Mosaiqo\\OptimusPrime\\Contracts\\Transformer', 'Mosaiqo\\OptimusPrime\\Transformer');\n\t\t$this->registerArtisanCommand();\n\t}", "public function register()\n {\n $this->mergeConfigFrom(\n __DIR__.'/../config/services.php', 'services'\n );\n }", "public function register()\n {\n include __DIR__.'/routes.php';\n $this->app->make('YigitCukuren\\Optimum7\\Controllers\\Optimum7Controller');\n $this->commands($this->commands);\n }", "public function register()\n {\n $this->mergeConfigFrom(__DIR__.'/Config/user-role-and-permission.php', 'user-role-and-permission');\n\n $this->app->register('Caffeinated\\Shinobi\\ShinobiServiceProvider');\n\n $this->app->register(RouteServiceProvider::class);\n $this->app->register(ExceptionServiceProvider::class);\n $this->app->register(ViewComposerServiceProvider::class);\n\n $loader = \\Illuminate\\Foundation\\AliasLoader::getInstance();\n $loader->alias('Shinobi', \\Caffeinated\\Shinobi\\Facades\\Shinobi::class);\n }", "public function register()\n {\n $this->app->bind('App\\Services\\TripService.php', function ($app) {\n return new TripService();\n });\n }", "public function register()\n {\n $this->app->bind(\\Cookiesoft\\Repositories\\CategoryRepository::class, \\Cookiesoft\\Repositories\\CategoryRepositoryEloquent::class);\n $this->app->bind(\\Cookiesoft\\Repositories\\BillpayRepository::class, \\Cookiesoft\\Repositories\\BillpayRepositoryEloquent::class);\n $this->app->bind(\\Cookiesoft\\Repositories\\UserRepository::class, \\Cookiesoft\\Repositories\\UserRepositoryEloquent::class);\n //:end-bindings:\n }", "public function register()\n {\n $this->registerRepository();\n $this->registerMigrator();\n $this->registerArtisanCommands();\n }", "public function register()\n {\n $this->app->bind(\n 'App\\Repositories\\PessoaRepositoryInterface', 'App\\Repositories\\PessoaRepositoryEloquent'\n );\n $this->app->bind(\n 'App\\Repositories\\PerfilRepositoryInterface', 'App\\Repositories\\PerfilRepositoryEloquent'\n );\n $this->app->bind(\n 'App\\Repositories\\AplicativoRepositoryInterface', 'App\\Repositories\\AplicativoRepositoryEloquent'\n );\n $this->app->bind(\n 'App\\Repositories\\UsuarioRepositoryInterface', 'App\\Repositories\\UsuarioRepositoryEloquent'\n );\n $this->app->bind(\n 'App\\Repositories\\AcessoRepositoryInterface', 'App\\Repositories\\AcessoRepositoryEloquent'\n );\n }", "public function register()\n {\n $this->registerRepositories();\n\n $this->pushMiddleware();\n }", "public function register()\r\n {\r\n Passport::ignoreMigrations();\r\n\r\n $this->app->singleton(\r\n CityRepositoryInterface::class,\r\n CityRepository::class\r\n );\r\n\r\n $this->app->singleton(\r\n BarangayRepositoryInterface::class,\r\n BarangayRepository::class\r\n );\r\n }", "public function register()\n {\n // service 由各个应用在 AppServiceProvider 单独绑定对应实现\n }", "public function register()\n {\n //\n $this->app->bind(\n 'App\\Repositories\\Interfaces\\CompanyInterface', \n 'App\\Repositories\\CompanyRepo'\n );\n $this->app->bind(\n 'App\\Repositories\\Interfaces\\UtilityInterface', \n 'App\\Repositories\\UtilityRepo'\n );\n }", "public function register()\n {\n // Merge configs\n $this->mergeConfigFrom(\n __DIR__ . '/../config/songyz_validator.php',\n 'songyz_validator'\n );\n\n $this->app->singleton('songyz.validator.generator', function ($app) {\n return new GeneratorValidatorRequestCommand();\n });\n $this->commands([\n 'songyz.validator.generator'\n ]);\n\n }", "public function register()\n {\n $this->mergeConfigFrom(__DIR__.'/../config/config.php', 'meilisearch');\n\n $this->app->singleton(Client::class, function () {\n return new Client(config('meilisearch.host'), config('meilisearch.key'));\n });\n }", "public function register()\n {\n //\n include __DIR__.'/routes.php';\n $this->app->make('Hulucat\\WechatCorp\\CorpController');\n $this->app->singleton('CorpApi', function($app){\n \treturn new CorpApi(new HttpClient());\n });\n }", "public function register()\n {\n $this->app->bind(VehicleRepository::class, GuzzleVehicleRepository::class);\n }", "public function register()\n {\n $this->app->register(\\Maatwebsite\\Excel\\ExcelServiceProvider::class);\n $this->app->register(\\Intervention\\Image\\ImageServiceProvider::class);\n $this->app->register(\\Rap2hpoutre\\LaravelLogViewer\\LaravelLogViewerServiceProvider::class);\n $this->app->register(\\Yajra\\Datatables\\DatatablesServiceProvider::class);\n $this->app->register(\\Yajra\\Datatables\\ButtonsServiceProvider::class);\n\n $loader = null;\n if (class_exists('Illuminate\\Foundation\\AliasLoader')) {\n $loader = \\Illuminate\\Foundation\\AliasLoader::getInstance();\n }\n\n // Facades\n if ($loader != null) {\n $loader->alias('Image', \\Intervention\\Image\\Facades\\Image::class);\n $loader->alias('Excel', \\Maatwebsite\\Excel\\Facades\\Excel::class);\n\n }\n\n if (app()->environment() != 'production') {\n // Service Providers\n $this->app->register(\\Barryvdh\\LaravelIdeHelper\\IdeHelperServiceProvider::class);\n $this->app->register(\\Barryvdh\\Debugbar\\ServiceProvider::class);\n\n // Facades\n if ($loader != null) {\n $loader->alias('Debugbar', \\Barryvdh\\Debugbar\\Facade::class);\n }\n }\n\n if ($this->app->environment('local', 'testing')) {\n $this->app->register(\\Laravel\\Dusk\\DuskServiceProvider::class);\n }\n }", "public function register()\n {\n $this->registerUserComponent();\n $this->registerLocationComponent();\n\n }", "public function register()\n {\n\n\n $this->app->bind(\n 'App\\Repositories\\RepositoryInterface','App\\Repositories\\ORM\\CsvRepository'\n );\n\n $this->app->bind(\n 'App\\Strategy\\StrategyDataSource','App\\Strategy\\CsvDataSource'\n );\n\n\n }", "public function register()\n {\n // Default configuration file\n $this->mergeConfigFrom(\n __DIR__.'/Config/auzo_tools.php', 'auzoTools'\n );\n\n $this->registerModelBindings();\n $this->registerFacadesAliases();\n }", "public function register()\n {\n $this->app->bind(\n 'App\\\\Repositories\\\\Tournaments\\\\ITournamentsRepository',\n 'App\\\\Repositories\\\\Tournaments\\\\TournamentsRepository'\n );\n }", "public function register()\n {\n $this->app->register(RouteServiceProvider::class);\n\n $this->registerCommand();\n $this->registerSchedule();\n $this->registerDev();\n\n }", "public function register()\n {\n $this->registerDomainLocalization();\n $this->registerDomainLocaleFilter();\n }", "public function register()\n {\n $this->registerBrowser();\n\n $this->registerViewFinder();\n }", "public function register() {\n /**\n * Load default configurations.\n */\n $this->mergeConfigFrom(\n __DIR__.'/../../config/problem.php', 'problem'\n );\n\n /**\n * Bind to service container.\n */\n $this->app->singleton(\n \\Illuminate\\Contracts\\Debug\\ExceptionHandler::class,\n ProblemAlertExceptionHandler::class\n );\n }", "public function register()\n\t{\n $this->app->bind(\n 'Commuttr\\Repositories\\Coordinates\\CoordinatesRepositoryInterface',\n 'Commuttr\\Repositories\\Coordinates\\DbCoordinatesRepository');\n\n $this->app->bind(\n 'Commuttr\\Repositories\\Route\\RouteRepositoryInterface',\n 'Commuttr\\Repositories\\Route\\DbRouteRepository');\n\n $this->app->bind(\n 'Commuttr\\Repositories\\Review\\ReviewRepositoryInterface',\n 'Commuttr\\Repositories\\Review\\DbReviewRepository');\n\n\t\t$this->app->bind(\n 'Commuttr\\Repositories\\User\\UserRepositoryInterface',\n 'Commuttr\\Repositories\\User\\DbUserRepository');\n\t}", "public function register()\n {\n $this->app->make('Furqank786\\Multitenancy\\Controllers\\SiteController');\n //$this->loadViewsFrom(__DIR__.'/views', 'multitenancy');\n\n }", "public function register()\n {\n $this->registerGraphQL();\n\n $this->registerConsole();\n }", "public function register()\n {\n $this->registerPayment();\n\n $this->app->alias('image', 'App\\Framework\\Image\\ImageService');\n }", "public function register()\n {\n $this->registerRollbar();\n }", "public function register()\n {\n $this->app->bindShared(ElasticsearchNedvizhimostsObserver::class, function($app){\n return new ElasticsearchNedvizhimostsObserver(new Client());\n });\n\n // $this->app->bindShared(ElasticsearchNedvizhimostsObserver::class, function()\n // {\n // return new ElasticsearchNedvizhimostsObserver(new Client());\n // });\n }", "public function register()\n {\n $this->app->bind(TelescopeRouteServiceContract::class, TelescopeRouteService::class);\n }", "public function register()\n {\n\n // 將config/config.php裡的設定跟原有的結合起來\n $this->mergeConfigFrom(\n __DIR__.'/config/config.php', 'es_config'\n );\n\n // 登入elasticsearch\n $this->app->singleton('Elasticsearch\\Client', function($app){\n\n return ClientBuilder::create()->build(config('es_config'));\n\n });\n\n $this->app->instance('qelastic', new Qelastic($this->app));\n\n\n\n }", "public function register()\n {\n $this->mergeConfigFrom(__DIR__.'/../config/faithgen-events.php', 'faithgen-events');\n\n $this->app->singleton(EventsService::class);\n $this->app->singleton(GuestService::class);\n }", "public function register()\n {\n $this->app->bind('gameService', 'App\\Service\\GameService');\n }", "public function register()\n {\n $this->app->bind(\n \\App\\Services\\UserCertificate\\IUserCertificateService::class,\n \\App\\Services\\UserCertificate\\UserCertificateService::class\n );\n }", "public function register()\n {\n // Register the app\n $this->registerApp();\n\n // Register Commands\n $this->registerCommands();\n }", "public function register() {\n $this->app->bind(\n 'Illuminate\\Contracts\\Auth\\Registrar' , 'App\\Services\\Registrar'\n );\n\n $this->app->bind(PostRepositoryContract::class, PostRepository::class);\n }", "public function register()\n {\n $this->app->bind('ResponseFormat',ResponseFormat::class);\n $this->app->bind('AdminUserService',AdminUserService::class);\n $this->app->bind('GenresService', GenresService::class);\n $this->app->bind('ContentService', ContentService::class);\n $this->app->bind(AudioBookRepository::class,function($app){\n return new AudioBookRepository(new AudioBook);\n });\n $this->app->bind(PodcastRepository::class,function($app){\n return new PodcastRepository(new Podcast);\n });\n $this->app->bind(AudioBookGenreRepository::class,function($app){\n return new AudioBookGenreRepository(new AudioBookGenre); \n });\n $this->app->bind(PodcastGenreRepository::class,function($app){\n return new PodcastGenreRepository(new PodcastGenre);\n });\n $this->app->bind(TrainingGenreRepository::class,function($app){\n return new TrainingGenreRepository(new TrainingGenre);\n });\n $this->app->bind(TrainingRepository::class,function($app){\n return new TrainingRepository(new Training);\n });\n $this->app->bind(UserRepository::class,function($app){\n return new UserRepository(new User);\n });\n $this->app->bind(RegisterApplicationRepository::class,function($app){\n return new RegisterApplicationRepository(new RegisterApplication);\n });\n $this->app->bind(AdminUserRepository::class,function($app){\n return new AdminUserRepository(new AdminUser);\n });\n $this->app->bind(VolunteerApplicationRepository::class,function($app){\n return new VolunteerApplicationRepository(new VolunteerApplication);\n });\n \n }", "public function register()\n {\n //\n if (env('APP_DEBUG', false) && $this->app->isLocal()) {\n $this->app->register(\\Laravel\\Telescope\\TelescopeServiceProvider::class);\n $this->app->register(TelescopeServiceProvider::class);\n }\n }", "public function register()\n {\n //\n $this->app->bind(\n 'App\\Repositories\\Address\\IAddressRepository',\n 'App\\Repositories\\Address\\AddressRepository'\n );\n\n $this->app->bind(\n 'App\\Repositories\\College\\ICollegeRepository',\n 'App\\Repositories\\College\\CollegeRepository'\n );\n\n $this->app->bind(\n 'App\\Repositories\\Course\\ICourseRepository',\n 'App\\Repositories\\Course\\CourseRepository'\n );\n\n $this->app->bind(\n 'App\\Repositories\\Favorites\\IFavoritesRepository',\n 'App\\Repositories\\Favorites\\FavoritesRepository'\n );\n\n $this->app->bind(\n 'App\\Repositories\\Images\\IImageRepository',\n 'App\\Repositories\\Images\\ImageRepository'\n );\n\n $this->app->bind(\n 'App\\Repositories\\Place\\IPlaceRepository',\n 'App\\Repositories\\Place\\PlaceRepository'\n );\n\n $this->app->bind(\n 'App\\Repositories\\PlaceType\\IPlaceTypeRepository',\n 'App\\Repositories\\PlaceType\\PlaceTypeRepository'\n );\n\n $this->app->bind(\n 'App\\Repositories\\City\\ICityRepository',\n 'App\\Repositories\\City\\CityRepository'\n );\n }", "public function register()\n {\n $this->app->bind(\n 'App\\Repositories\\Customer\\CustomerRepository',\n 'App\\Repositories\\Customer\\DbCustomerRepository'\n );\n\n $this->app->bind(\n 'App\\Repositories\\Flight\\FlightRepository',\n 'App\\Repositories\\Flight\\DbFlightRepository'\n );\n\n $this->app->bind(\n 'App\\Repositories\\Booking\\BookingRepository',\n 'App\\Repositories\\Booking\\DbBookingRepository'\n );\n\n $this->app->bind(\n 'App\\Repositories\\Passenger\\PassengerRepository',\n 'App\\Repositories\\Passenger\\DbPassengerRepository'\n );\n\n $this->app->bind(\n 'App\\Repositories\\Outbound\\OutboundRepository',\n 'App\\Repositories\\Outbound\\DbOutboundRepository'\n );\n\n $this->app->bind(\n 'App\\Repositories\\Cost\\CostRepository',\n 'App\\Repositories\\Cost\\DbCostRepository'\n );\n }", "public function register() {\n $this->registerProviders();\n $this->registerFacades();\n }", "public function register()\n {\n $this->registerGuard();\n $this->registerBladeDirectives();\n }", "public function register()\n {\n $this->app->singleton(ThirdPartyAuthService::class, function ($app) {\n return new ThirdPartyAuthService(\n config('settings.authentication_services'),\n $app['Laravel\\Socialite\\Contracts\\Factory'],\n $app['Illuminate\\Contracts\\Auth\\Factory']\n );\n });\n\n $this->app->singleton(ImageValidator::class, function ($app) {\n return new ImageValidator(\n config('settings.image.max_filesize'),\n config('settings.image.mime_types'),\n $app['Intervention\\Image\\ImageManager']\n );\n });\n\n $this->app->singleton(ImageService::class, function ($app) {\n return new ImageService(\n config('settings.image.max_width'),\n config('settings.image.max_height'),\n config('settings.image.folder')\n );\n });\n\n $this->app->singleton(RandomWordService::class, function ($app) {\n return new RandomWordService(\n $app['App\\Repositories\\WordRepository'],\n $app['Illuminate\\Session\\SessionManager'],\n config('settings.number_of_words_to_remember')\n );\n });\n\n $this->app->singleton(WordRepository::class, function ($app) {\n return new WordRepository(config('settings.min_number_of_chars_per_one_mistake_in_search'));\n });\n\n $this->app->singleton(CheckAnswerService::class, function ($app) {\n return new CheckAnswerService(\n $app['Illuminate\\Session\\SessionManager'],\n config('settings.min_number_of_chars_per_one_mistake')\n );\n });\n\n if ($this->app->environment() !== 'production') {\n $this->app->register(\\Barryvdh\\LaravelIdeHelper\\IdeHelperServiceProvider::class);\n }\n }", "public function register()\n {\n $this->registerRepository();\n $this->registerParser();\n }", "public function register()\n {\n $this->registerJWT();\n $this->registerJWSProxy();\n $this->registerJWTAlgoFactory();\n $this->registerPayload();\n $this->registerPayloadValidator();\n $this->registerPayloadUtilities();\n\n // use this if your package has a config file\n // config([\n // 'config/JWT.php',\n // ]);\n }", "public function register()\n {\n $this->app->bind(CertificationService::class, function($app){\n return new CertificationService();\n });\n }", "public function register()\n {\n $this->mergeConfigFrom(\n __DIR__.'/config/config.php', 'monobank'\n );\n\n $this->app->make('Karpovigorok\\MonobankStatement\\Controllers\\MainpageController');\n\n }", "public function register()\n {\n $this->registerConfig();\n\n $this->app->register(Providers\\ManagerServiceProvider::class);\n $this->app->register(Providers\\ValidationServiceProvider::class);\n }", "public function register()\n {\n\n\n\n $this->mergeConfigFrom(__DIR__ . '/../config/counter.php', 'counter');\n\n $this->app->register(RouteServiceProvider::class);\n\n\n }", "public function register()\n {\n $this->mergeConfigFrom(__DIR__.'/../config/exposable.php', 'exposable');\n\n $this->registerMiddleware();\n\n $this->registerRoutes();\n\n $this->app->make(ExposableController::class);\n\n $this->app->bind('exposable.signer', function () {\n return new ExposableSigner(config('exposable.key'));\n });\n }", "public function register()\n {\n $this->registerConfig();\n $this->registerView();\n $this->registerMessage();\n $this->registerMenu();\n $this->registerOutput();\n $this->registerCommands();\n require __DIR__ . '/Service/ServiceProvider.php';\n require __DIR__ . '/Service/RegisterRepoInterface.php';\n require __DIR__ . '/Service/ErrorHandling.php';\n $this->registerExportDompdf();\n $this->registerExtjs();\n }", "public function register()\n {\n $this->app->bind(\n 'App\\Contracts\\UsersInterface',\n 'App\\Services\\UsersService'\n );\n $this->app->bind(\n 'App\\Contracts\\CallsInterface',\n 'App\\Services\\CallsService'\n );\n $this->app->bind(\n 'App\\Contracts\\ContactsInterface',\n 'App\\Services\\ContactsService'\n );\n $this->app->bind(\n 'App\\Contracts\\EmailsInterface',\n 'App\\Services\\EmailsService'\n );\n $this->app->bind(\n 'App\\Contracts\\PhoneNumbersInterface',\n 'App\\Services\\PhoneNumbersService'\n );\n $this->app->bind(\n 'App\\Contracts\\NumbersInterface',\n 'App\\Services\\NumbersService'\n );\n $this->app->bind(\n 'App\\Contracts\\UserNumbersInterface',\n 'App\\Services\\UserNumbersService'\n );\n }", "public function register()\n {\n $this->app->bind(ReverseEncoder::class, function () {\n return new ReverseEncoder;\n });\n }", "public function register()\n {\n Schema::defaultStringLength(199);\n\n $this->app->bind(\n 'App\\Helper\\ICheckAction',\n 'App\\Helper\\CheckAction'\n );\n\n $this->app->bind(\n 'App\\Helper\\IGetDateTime',\n 'App\\Helper\\GetDateTime'\n );\n\n $this->app->bind(\n 'App\\Repositories\\AnnouceRepository\\IAnnouceRepository',\n 'App\\Repositories\\AnnouceRepository\\AnnouceRepository'\n );\n\n $this->app->bind(\n 'App\\Repositories\\AjaxRepository\\IAjaxRepository',\n 'App\\Repositories\\AjaxRepository\\AjaxRepository'\n );\n\n $this->app->bind(\n 'App\\Repositories\\UserRepository\\IUserRepository',\n 'App\\Repositories\\UserRepository\\UserRepository'\n );\n\n $this->app->bind(\n 'App\\Repositories\\PermissionRepository\\IPermissionRepository',\n 'App\\Repositories\\PermissionRepository\\PermissionRepository'\n );\n\n $this->app->bind(\n 'App\\Repositories\\PermissionDetailRepository\\IPermissionDetailRepository',\n 'App\\Repositories\\PermissionDetailRepository\\PermissionDetailRepository'\n );\n\n $this->app->bind(\n 'App\\Repositories\\AreaRepository\\IAreaRepository',\n 'App\\Repositories\\AreaRepository\\AreaRepository'\n );\n\n $this->app->bind(\n 'App\\Repositories\\TableRepository\\ITableRepository',\n 'App\\Repositories\\TableRepository\\TableRepository'\n );\n\n $this->app->bind(\n 'App\\Repositories\\GroupMenuRepository\\IGroupMenuRepository',\n 'App\\Repositories\\GroupMenuRepository\\GroupMenuRepository'\n );\n\n $this->app->bind(\n 'App\\Repositories\\ToppingRepository\\IToppingRepository',\n 'App\\Repositories\\ToppingRepository\\ToppingRepository'\n );\n\n $this->app->bind(\n 'App\\Repositories\\MaterialRepository\\IMaterialRepository',\n 'App\\Repositories\\MaterialRepository\\MaterialRepository'\n );\n\n $this->app->bind(\n 'App\\Repositories\\MaterialDetailRepository\\IMaterialDetailRepository',\n 'App\\Repositories\\MaterialDetailRepository\\MaterialDetailRepository'\n );\n\n $this->app->bind(\n 'App\\Repositories\\MaterialActionRepository\\IMaterialActionRepository',\n 'App\\Repositories\\MaterialActionRepository\\MaterialActionRepository'\n );\n\n $this->app->bind(\n 'App\\Repositories\\SupplierRepository\\ISupplierRepository',\n 'App\\Repositories\\SupplierRepository\\SupplierRepository'\n );\n\n $this->app->bind(\n 'App\\Repositories\\CookRepository\\ICookRepository',\n 'App\\Repositories\\CookRepository\\CookRepository'\n );\n\n $this->app->bind(\n 'App\\Repositories\\CookScreenRepository\\ICookScreenRepository',\n 'App\\Repositories\\CookScreenRepository\\CookScreenRepository'\n );\n\n $this->app->bind(\n 'App\\Repositories\\DishRepository\\IDishRepository',\n 'App\\Repositories\\DishRepository\\DishRepository'\n );\n\n $this->app->bind(\n 'App\\Repositories\\OrderRepository\\IOrderRepository',\n 'App\\Repositories\\OrderRepository\\OrderRepository'\n );\n\n $this->app->bind(\n 'App\\Repositories\\PayRepository\\IPayRepository',\n 'App\\Repositories\\PayRepository\\PayRepository'\n );\n\n $this->app->bind(\n 'App\\Repositories\\WarehouseRepository\\IWarehouseRepository',\n 'App\\Repositories\\WarehouseRepository\\WarehouseRepository'\n );\n\n $this->app->bind(\n 'App\\Repositories\\WarehouseCookRepository\\IWarehouseCookRepository',\n 'App\\Repositories\\WarehouseCookRepository\\WarehouseCookRepository'\n );\n\n $this->app->bind(\n 'App\\Repositories\\ImportCouponRepository\\IImportCouponRepository',\n 'App\\Repositories\\ImportCouponRepository\\ImportCouponRepository'\n );\n\n $this->app->bind(\n 'App\\Repositories\\ExportCouponRepository\\IExportCouponRepository',\n 'App\\Repositories\\ExportCouponRepository\\ExportCouponRepository'\n );\n\n $this->app->bind(\n 'App\\Repositories\\ShiftRepository\\IShiftRepository',\n 'App\\Repositories\\ShiftRepository\\ShiftRepository'\n );\n\n $this->app->bind(\n 'App\\Repositories\\PositionRepository\\IPositionRepository',\n 'App\\Repositories\\PositionRepository\\PositionRepository'\n );\n\n $this->app->bind(\n 'App\\Repositories\\ReportRepository\\IReportRepository',\n 'App\\Repositories\\ReportRepository\\ReportRepository'\n );\n\n $this->app->bind(\n 'App\\Repositories\\BookingRepository\\IBookingRepository',\n 'App\\Repositories\\BookingRepository\\BookingRepository'\n );\n\n $this->app->bind(\n 'App\\Repositories\\DayRepository\\IDayRepository',\n 'App\\Repositories\\DayRepository\\DayRepository'\n );\n\n $this->app->bind(\n 'App\\Repositories\\VoucherRepository\\IVoucherRepository',\n 'App\\Repositories\\VoucherRepository\\VoucherRepository'\n );\n\n $this->app->bind(\n 'App\\Repositories\\MethodRepository\\IMethodRepository',\n 'App\\Repositories\\MethodRepository\\MethodRepository'\n );\n\n $this->app->bind(\n 'App\\Repositories\\PlanRepository\\IPlanRepository',\n 'App\\Repositories\\PlanRepository\\PlanRepository'\n );\n }", "public function register()\n\t{\n\t\t$this->app->bind(\n\t\t\t'Illuminate\\Contracts\\Auth\\Registrar',\n\t\t\t'App\\Services\\Registrar'\n\t\t);\n \n $this->app->bind(\"App\\\\Services\\\\ILoginService\",\"App\\\\Services\\\\LoginService\");\n \n $this->app->bind(\"App\\\\Repositories\\\\IItemRepository\",\"App\\\\Repositories\\\\ItemRepository\");\n $this->app->bind(\"App\\\\Repositories\\\\IOutletRepository\",\"App\\\\Repositories\\\\OutletRepository\");\n $this->app->bind(\"App\\\\Repositories\\\\IInventoryRepository\",\"App\\\\Repositories\\\\InventoryRepository\");\n\t}", "public function register()\n {\n $this->mergeConfigFrom(\n __DIR__ . '/../config/config.php',\n 'iyzipay'\n );\n\n $this->app->bind('iyzipay-laravel', function () {\n return new IyzipayLaravel();\n });\n }", "public function register()\n {\n $this->mergeConfigFrom(\n __DIR__.'/../config/wortmann-soap-api.php',\n 'wortmann-soap-api',\n );\n\n $this->app->singleton(WortmannSoapApi::class, function () {\n return new Api(config('wortmann-soap-api'));\n });\n }", "public function register()\n {\n $this->app->bind(ReviewService::class, function ($app) {\n return new ReviewService();\n });\n }", "public function register()\n {\n include __DIR__.'/Http/routes.php';\n\n // For LAEditor\n if(file_exists(__DIR__.'/../../laeditor')) {\n include __DIR__.'/../../laeditor/src/routes.php';\n }\n \n /*\n |--------------------------------------------------------------------------\n | Providers\n |--------------------------------------------------------------------------\n */\n \n // Collective HTML & Form Helper\n $this->app->register(\\Collective\\Html\\HtmlServiceProvider::class);\n // For Datatables\n $this->app->register(\\Yajra\\Datatables\\DatatablesServiceProvider::class);\n // For Gravatar\n $this->app->register(\\Creativeorange\\Gravatar\\GravatarServiceProvider::class);\n // For Entrust\n $this->app->register(\\Zizaco\\Entrust\\EntrustServiceProvider::class);\n // For Spatie Backup\n $this->app->register(\\Spatie\\Backup\\BackupServiceProvider::class);\n \n /*\n |--------------------------------------------------------------------------\n | Register the Alias\n |--------------------------------------------------------------------------\n */\n \n $loader = AliasLoader::getInstance();\n \n // Collective HTML & Form Helper\n $loader->alias('Form', \\Collective\\Html\\FormFacade::class);\n $loader->alias('HTML', \\Collective\\Html\\HtmlFacade::class);\n \n // For Gravatar User Profile Pics\n $loader->alias('Gravatar', \\Creativeorange\\Gravatar\\Facades\\Gravatar::class);\n \n // For LaraAdmin Code Generation\n $loader->alias('CodeGenerator', \\Dwij\\Laraadmin\\CodeGenerator::class);\n \n // For LaraAdmin Form Helper\n $loader->alias('LAFormMaker', \\Dwij\\Laraadmin\\LAFormMaker::class);\n \n // For LaraAdmin Helper\n $loader->alias('LAHelper', \\Dwij\\Laraadmin\\Helpers\\LAHelper::class);\n \n // LaraAdmin Module Model \n $loader->alias('Module', \\Dwij\\Laraadmin\\Models\\Module::class);\n\n // For LaraAdmin Configuration Model\n $loader->alias('LAConfigs', \\Dwij\\Laraadmin\\Models\\LAConfigs::class);\n \n // For Entrust\n $loader->alias('Entrust', \\Zizaco\\Entrust\\EntrustFacade::class);\n $loader->alias('role', \\Zizaco\\Entrust\\Middleware\\EntrustRole::class);\n $loader->alias('permission', \\Zizaco\\Entrust\\Middleware\\EntrustPermission::class);\n $loader->alias('ability', \\Zizaco\\Entrust\\Middleware\\EntrustAbility::class);\n \n /*\n |--------------------------------------------------------------------------\n | Register the Controllers\n |--------------------------------------------------------------------------\n */\n $this->app->make('App\\Http\\Controllers\\Auth\\AuthController');\n $this->app->make('Dwij\\Laraadmin\\Controllers\\ModuleController');\n $this->app->make('Dwij\\Laraadmin\\Controllers\\FieldController');\n $this->app->make('Dwij\\Laraadmin\\Controllers\\MenuController');\n \n // For LAEditor\n if(file_exists(__DIR__.'/../../laeditor')) {\n $this->app->make('Dwij\\Laeditor\\Controllers\\CodeEditorController');\n }\n\n }", "public function register()\n {\n $this->registerConfig();\n\n $this->registerDataStore();\n\n $this->registerStorageFactory();\n\n $this->registerStorageManager();\n\n $this->registerSimplePhoto();\n }", "public function register()\n {\n\n $config = $this->app['config']['cors'];\n\n $this->app->bind('Yocome\\Cors\\CorsService', function() use ($config){\n return new CorsService($config);\n });\n\n }", "public function register()\n {\n // register its dependencies\n $this->app->register(\\Cviebrock\\EloquentSluggable\\ServiceProvider::class);\n }", "public function register()\n {\n $this->app->bind(\n 'auditor',\n Auditor::class\n );\n }", "public function register()\n {\n\n //include (__DIR__.\"/../../vendor/autoload.php\");\n\n // Blog Repositories\n $this->app->singleton(\n \\Ridwanpandi\\Blog\\Repositories\\BlogRepository::class,\n \\Ridwanpandi\\Blog\\Repositories\\BlogEloquent::class\n );\n // end Blog Repositories\n\n $this->loadMigrationsFrom(__DIR__.'/../Database');\n\n $this->app->make('Ridwanpandi\\Blog\\Http\\Controllers\\BlogController');\n $this->app->make('Ridwanpandi\\Blog\\Http\\Controllers\\TokenController');\n $this->app->make('Ridwanpandi\\Blog\\Http\\Middleware\\JWTMiddleware');\n $this->app->make('Ridwanpandi\\Blog\\Models\\Blog');\n $this->app->make('Ridwanpandi\\Blog\\Models\\Meta');\n\n $this->publishes([\n __DIR__.'/../Database' => base_path('database/migrations'),\n ]);\n\n $this->app->routeMiddleware([\n 'jwt' => \\Ridwanpandi\\Blog\\Http\\Middleware\\JWTMiddleware::class,\n ]);\n }", "public function register()\n {\n $this->registerServiceProviders();\n $this->registerSettingsService();\n $this->registerHelpers();\n }", "public function register()\n {\n $this->app->bind(UserRepositoryContract::class, UserRepository::class);\n\n $this->app->register(UserRouteServiceProvider::class);\n }", "public function register()\n {\n $this->app->register(RouterServiceProvider::class);\n }" ]
[ "0.72834975", "0.7129936", "0.7108755", "0.70365775", "0.69857496", "0.6981425", "0.69721615", "0.6920895", "0.69191223", "0.6882845", "0.6881585", "0.6819491", "0.6818964", "0.68054336", "0.68047476", "0.6799833", "0.6794076", "0.679339", "0.6788445", "0.67767453", "0.67700595", "0.67683184", "0.67680913", "0.67643136", "0.6759103", "0.67554945", "0.6752813", "0.6750741", "0.6746924", "0.67453396", "0.674472", "0.6736895", "0.67368203", "0.6736107", "0.6732007", "0.6730551", "0.67287403", "0.672675", "0.67204756", "0.6715763", "0.6714403", "0.6708389", "0.6705731", "0.67022485", "0.6701995", "0.67011917", "0.6697624", "0.66935164", "0.6693066", "0.6691179", "0.6690436", "0.6685918", "0.6683847", "0.6681835", "0.6677354", "0.66759163", "0.66744", "0.6668164", "0.6667953", "0.666673", "0.6666137", "0.6664308", "0.66636014", "0.66625667", "0.6662302", "0.6661477", "0.66603136", "0.6658671", "0.66563946", "0.6656232", "0.66561985", "0.665449", "0.6653904", "0.6652145", "0.66504127", "0.664745", "0.6647391", "0.6647022", "0.6644753", "0.6644314", "0.6643591", "0.66434056", "0.6641648", "0.66351223", "0.6633715", "0.6631681", "0.6631141", "0.6628324", "0.6621463", "0.6619662", "0.661933", "0.6617775", "0.66167384", "0.6614609", "0.661398", "0.66132176", "0.6613193", "0.6613182", "0.6613065", "0.661006", "0.66071045" ]
0.0
-1
/ vim: set tabstop=2 shiftwidth=2 softtabstop=2:
function getXlsArr($nameXls){ global $_tm_, $_g_probe_time; if($_g_probe_time>2) $_tm_[]=array("before getXlsArrFile",microtime(true)); $file=getXlsArrFile($nameXls); if($_g_probe_time>2) $_tm_[]=array("after getXlsArrFile",microtime(true)); require($file); if($_g_probe_time>2) $_tm_[]=array("after require $file",microtime(true)); $rt=$getXlsArrFile_rt;//约定. return $rt; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function readTabStop() {return $this->_tabstop;}", "public function testCorrectTabSpacing() {\n\t\t$code = <<<EOD\narray(\n\t'foobar' => 'bar',\n\t'foo'\t => 'bar',\n);\nEOD;\n\t\t$this->assertRulePass($code, $this->rule);\n\t}", "function infy_tab($spaces = 4)\n {\n return str_repeat(' ', $spaces);\n }", "protected function getTab() {\n return \" \";\n }", "function infy_tabs($tabs, $spaces = 4)\n {\n return str_repeat(infy_tab($spaces), $tabs);\n }", "function setLarguraPadrao() {\n\n parent::addComando(chr(27) . chr(72));\n }", "public function indent($count = 4);", "public function getAlternateSpace() {}", "function remove_tabs($tpl_source, &$smarty)\n{\n\treturn str_replace( '\t', '', $tpl_source );\n}", "function AbbcExpandSelection(&$text, &$startpos, &$endpos, $length = -1)\r\n{\r\n\t// go backward from the beginning on\r\n\twhile ($startpos > 0 &&\r\n\t ($text{$startpos - 1} == ' ' ||\r\n\t $text{$startpos - 1} == \"\\t\" ||\r\n\t $text{$startpos - 1} == \"\\n\"))\r\n\t{\r\n\t\t$startpos--;\r\n\t}\r\n\r\n\t// go forward from the end on\r\n\tif ($length == -1) $length = strlen($text);\r\n\t$end_diff = 0;\r\n\twhile ($endpos < $length &&\r\n\t ($text{$endpos + 1} == ' ' ||\r\n\t $text{$endpos + 1} == \"\\t\" ||\r\n\t $text{$endpos + 1} == \"\\n\"))\r\n\t{\r\n\t\t$endpos++;\r\n\t\t$end_diff++;\r\n\t}\r\n\r\n\treturn $end_diff;\r\n}", "abstract protected function tabs();", "public function detab(string $text): string\n {\n return preg_replace_callback(\n \"/^.*?(?<space_before>[ ]?)\\t.*$/m\",\n function ($matches) {\n $line = $matches[0];\n $blocks = explode(\"\\t\", $line);\n $line = $blocks[0];\n unset($blocks[0]);\n foreach ($blocks as $block) {\n if ($matches['space_before'] === ' ') {\n $amount = 4;\n } else {\n // @todo set tab amount of spaces option\n $amount = 4 - mb_strlen($line, 'UTF-8') % 4;\n }\n $line .= str_repeat(\" \", $amount) . $block;\n }\n\n return $line;\n },\n $text\n );\n }", "function fix_indentation($input) {\n return str_replace(\"\\n * \", \"\\n * \", $input);\n}", "public function getWordSpacing() {}", "public function getWordSpacing() {}", "function EliminarEspaciosInncesarios($str, $bControlTabReturn=false)\n{\n if( $bControlTabReturn ){\n $str = preg_replace('/[\\n\\r\\t]+/', '', $str);\n }\n return preg_replace('/\\s{2,}/', ' ', $str);\n}", "function indentation() {\n echo '<br><br>';\n}", "protected function linear_whitespace()\n {\n }", "function space(){\n return label(satisfy(function($s){\n return $s === ' ' || $s === \"\\t\" || $s === \"\\n\" || $s === \"\\r\";\n }), 'space');\n}", "function tab($texto,$cant){ $i=1;\r\n $a=\"\";\r\n while($i<=$cant){\r\n $a.=\"&nbsp;\";\r\n $i++;\r\n }\r\n return $a.$texto;\r\n }", "function spaces() {\n return str_pad('', $this->currentIndention, ' ', STR_PAD_LEFT);\n }", "function tablerow_close() {\n $this->doc .= DOKU_LF.DOKU_TAB.'</tr>'.DOKU_LF;\n }", "function ncurses_pair_content($pair, &$f, &$b)\n{\n}", "public function getCharSpacing() {}", "function AcceptPageBreak()\n{\n if($this->col<2)\n {\n //Go to next column\n $this->SetCol($this->col+1);\n //Set ordinate to top\n $this->SetY($this->y0);\n //Keep on page\n return false;\n }\n else\n {\n //Go back to first column\n $this->SetCol(0);\n //Page break\n return true;\n }\n}", "protected function tab($repeat = 1)\n {\n return str_repeat(' ', $repeat);\n }", "function f($p1, // NOK {{Either split this list into multiple lines, aligned at column \"4\" or put all arguments on line \"51\".}}\n $p2\n) {\n}", "function setMargemEsquerda($iNumCol = 4) {\n\n $sComando = chr(27) . chr(108) . \" $iNumCol\";\n parent::addComando($sComando);\n }", "function IndentMultiCell($w, $h, $txt, $border=0, $align='J', $fill=false, $indent=0)\n{\n $cw=&$this->CurrentFont['cw'];\n if($w==0)\n $w=$this->w-$this->rMargin-$this->x;\n\n $wFirst = $w-$indent;\n $wOther = $w;\n\n $wmaxFirst=($wFirst-2*$this->cMargin)*1000/$this->FontSize;\n $wmaxOther=($wOther-2*$this->cMargin)*1000/$this->FontSize;\n\n $s=str_replace(\"\\r\",'',$txt);\n $nb=strlen($s);\n if($nb>0 && $s[$nb-1]==\"\\n\")\n $nb--;\n $b=0;\n if($border)\n {\n if($border==1)\n {\n $border='LTRB';\n $b='LRT';\n $b2='LR';\n }\n else\n {\n $b2='';\n if(is_int(strpos($border,'L')))\n $b2.='L';\n if(is_int(strpos($border,'R')))\n $b2.='R';\n $b=is_int(strpos($border,'T')) ? $b2.'T' : $b2;\n }\n }\n $sep=-1;\n $i=0;\n $j=0;\n $l=0;\n $ns=0;\n $nl=1;\n $first=true;\n while($i<$nb)\n {\n //Get next character\n $c=$s[$i];\n if($c==\"\\n\")\n {\n //Explicit line break\n if($this->ws>0)\n {\n $this->ws=0;\n $this->_out('0 Tw');\n }\n $this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill);\n $i++;\n $sep=-1;\n $j=$i;\n $l=0;\n $ns=0;\n $nl++;\n if($border && $nl==2)\n $b=$b2;\n continue;\n }\n if($c==' ')\n {\n $sep=$i;\n $ls=$l;\n $ns++;\n }\n $l+=$cw[$c];\n\n if ($first)\n {\n $wmax = $wmaxFirst;\n $w = $wFirst;\n }\n else\n {\n $wmax = $wmaxOther;\n $w = $wOther;\n }\n\n if($l>$wmax)\n {\n //Automatic line break\n if($sep==-1)\n {\n if($i==$j)\n $i++;\n if($this->ws>0)\n {\n $this->ws=0;\n $this->_out('0 Tw');\n }\n $SaveX = $this->x; \n if ($first && $indent>0)\n {\n $this->SetX($this->x + $indent);\n $first=false;\n }\n $this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill);\n $this->SetX($SaveX);\n }\n else\n {\n if($align=='J')\n {\n $this->ws=($ns>1) ? ($wmax-$ls)/1000*$this->FontSize/($ns-1) : 0;\n $this->_out(sprintf('%.3f Tw',$this->ws*$this->k));\n }\n $SaveX = $this->x; \n if ($first && $indent>0)\n {\n $this->SetX($this->x + $indent);\n $first=false;\n }\n $this->Cell($w,$h,substr($s,$j,$sep-$j),$b,2,$align,$fill);\n $this->SetX($SaveX);\n $i=$sep+1;\n }\n $sep=-1;\n $j=$i;\n $l=0;\n $ns=0;\n $nl++;\n if($border && $nl==2)\n $b=$b2;\n }\n else\n $i++;\n }\n //Last chunk\n if($this->ws>0)\n {\n $this->ws=0;\n $this->_out('0 Tw');\n }\n if($border && is_int(strpos($border,'B')))\n $b.='B';\n $this->Cell($w,$h,substr($s,$j,$i),$b,2,$align,$fill);\n $this->x=$this->lMargin;\n }", "public function testWhiteSpaceScopeIndent(): void\n {\n // NOT use tabs for indenting.\n\n $foo = 'bar';\n }", "function extra_tablenav( $which ) {\r\n if ( $which == \"top\" ){\r\n //The code that goes before the table is here\r\n }\r\n if ( $which == \"bottom\" ){\r\n //The code that goes after the table is there\r\n }\r\n }", "function space1_6(&$fp) {\n\n fwrite($fp, chr(27).\"2\");\n }", "public function testNormalizeTabsInText()\n {\n $markdown = new Markdown();\n\n $this->assertEquals(\"<p>Some te xt!</p>\\n\", $markdown->parse(\"Some\\t te\\txt!\"));\n }", "function parse_tablumps($data) {\n\n\t$data = str_replace(dAmnPHP::$tablumps['a1'], dAmnPHP::$tablumps['a2'], $data);\n\t$data = preg_replace(dAmnPHP::$tablumps['b1'], dAmnPHP::$tablumps['b2'], $data);\n\treturn preg_replace(\"/<([^>]+) (width|height|title|alt)=\\\"\\\"([^>]*?)>/\", \"<\\\\1\\\\3>\", $data);\n\n}", "public function getIndent()\n {\n }", "function wp_register_spacing_support($block_type)\n {\n }", "function javascriptTabify($text, $tabs) {\n\t\tif($text) {\n\t\t\treturn str_repeat(\" \", $tabs) . preg_replace('/\\n(.)/', \"\\n\" . str_repeat(\" \", $tabs) . \"\\$1\", $text);\n\t\t}\n\t}", "public function getCharacterSpacing() {}", "public function remove_help_tabs()\n {\n }", "function affichagetableau6_12($tab)\n{\n foreach ($tab as $elt) {\n echo \"[\" . $elt . \"]\" . \"\\t\";\n }\n echo \"\\nLes valeurs du tableau ont été incrémentées de 1.\";\n}", "public function getTypoLineGap() {}", "function wp_apply_spacing_support($block_type, $block_attributes)\n {\n }", "function extra_tablenav( $which ) {\n if ( $which == \"top\" ){\n //The code that goes before the table is here\n echo \"<h2>Funny Quotes<a href='admin.php?page=add_funny_quotes' class='add-new-h2'>+ Ajouter une nouvelle citation</a></h2>\";\n }\n }", "function setTabelaCaracteres($iCodigoTabela = 850) {\n\n switch ( $iCodigoTabela) {\n case 850 :\n $sComando = chr(27) . chr(116) . \"2\";\n break;\n case 437 :\n $sComando = chr(27) . chr(116) . \"3\";\n break;\n case 860 :\n $sComando = chr(27) . chr(116) . \"4\";\n break;\n case 858 :\n $sComando = chr(27) . chr(116) . \"5\";\n break;\n }\n \n parent::addComando($sComando);\n }", "function show_lines2($list_lines,$list_numlines,$list_indent,$only_code,$max_lines,$indent_mccount = Array()) {\n\necho \"<table>\\n\";\necho \"<thead><tr><th>Line</th><th>MC count</th><th>Code</th></tr></thead>\\n\";\necho \"<tbody>\\n\";\nfor ($i=0;$i<min(count($list_lines),$max_lines);$i++)\n{\n\techo \"<tr><td>\\n\";\n\n\t$line = htmlentities($list_lines[$i]);\n\t$numline = $list_numlines[$i];\n\t$indent = $list_indent[$i];\n\t\n\t$num_spaces = $indent*8;\n\t$indent_str = str_repeat(':'.str_repeat('&nbsp;',8),$indent); // indentazione\n\t\n\tif (count('indent_mccount') > 0)\n\t{\n\t\t$mc_count = $indent_mccount[$i];\n\t\tif ($mc_count > 0)\n\t\t{\n\t\t\t$ks_mccount = sprintf('(->%1d) </td><td> ', $mc_count);\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$ks_mccount = ' </td><td> ';\n\t\t}\n\t}\n\telse\n\t{\n\t\t$ks_mccount = '';\n\t}\n\t\n\t// function line spacing\n\tif (substr($line,0,8) === 'function')\n\t{\n\t\techo \"&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>\\n<tr><td>\\n\";\n\t}\n\t\n\tif ($only_code)\n\t{\n\t\techo(sprintf('%s%s%s',$ks_mccount,$indent_str,$line));\n\t}\n\telse\n\t{\n\t\techo(sprintf('%3d </td><td> %s%s%s',$numline,$ks_mccount,$indent_str,$line));\n\t}\n\techo \"</td></tr>\\n\";\n} // end for $i\n\necho \"</tbody></table>\\n\";\n// stampa(' ');\n// stampa('------------------------------------------------------------------------------');\n\n}", "private function formatCode($code)\n\t{\n\t\t// keep track of indentation and control state, abstracted through newline/blankline\n\t\t$tabs = 0;\n\t\t$brackets = 0;\n\t\t$lastcontrol = false;\n\t\t$lambda = false;\n\t\t$oneliner = false;\n\t\t$ternary = 0;\n\t\t$newline = function ($char, $before = false) use (&$tabs, &$oneliner) {\n\t\t\treturn function ($requirews = '') use (&$tabs, &$oneliner, $char, $before) {\n\t\t\t\tif ($oneliner)\n\t\t\t\t\treturn $requirews;\n\t\t\t\treturn ($before ? \"\\n\" . str_repeat(\"\\t\", max($tabs, 0)) : '') . $char . \"\\n\" .\n\t\t\t\t\tstr_repeat(\"\\t\", max($tabs, 0));\n\t\t\t};\n\t\t};\n\t\t$blankline = $newline('');\n\t\t\n\t\t// maintain a running stack of curly brackets to know how many control statements to\n\t\t// unindent by on closing brackets.\n\t\t$controls = array(0);\n\t\t$controlbrackets = array();\n\t\t$case = false;\n\t\t$control = function ($keyword) use \n\t\t(&$lastcontrol, &$controls, &$controlbrackets, &$brackets) {\n\t\t\treturn function ($v, $t) use \n\t\t\t(&$lastcontrol, &$controls, &$controlbrackets, &$lambda, &$brackets, $keyword) {\n\t\t\t\t$lastcontrol = $t;\n\t\t\t\t$lambda = false;\n\t\t\t\t$controls[count($controls) - 1]++;\n\t\t\t\t\n\t\t\t\t$controlbrackets[] = $brackets;\n\t\t\t\t\n\t\t\t\treturn $keyword;\n\t\t\t};\n\t\t};\n\t\t$uncontrol = function () use (&$lastcontrol, &$controls, &$controlbrackets, &$tabs) {\n\t\t\t// unindent as many as needed\n\t\t\t$lastcontrol = false;\n\t\t\t\n\t\t\twhile(count($controls) > 1 && $controls[count($controls) - 1] == 0)\n\t\t\t\tarray_pop($controls); // get rid of empty states\n\t\t\t$tabs -= array_pop($controls);\n\t\t\t$controls[] = 0; // re-add the last frame on\n\t\t\tarray_pop($controlbrackets);\n\t\t};\n\t\t\n\t\t// define what each token should be substituted with. $$ represents \"leave as-is\".\n\t\t// alternately a callback function can be specified to offer context-aware replacements\n\t\t$replacements = array(T_ABSTRACT => 'abstract ', T_AND_EQUAL => ' &= ', T_ARRAY =>\n\t\t\t\t'array',\n\t\t\tT_ARRAY_CAST => '(array) ', T_AS => ' as ', T_BAD_CHARACTER => '$$',\n\t\t\tT_BOOLEAN_AND => ' && ',\n\t\t\tT_BOOLEAN_OR => ' || ', T_BOOL_CAST => '(bool) ', T_BREAK => 'break',\n\t\t\tT_CHARACTER => '$$',\n\t\t\tT_CLASS_C => '__CLASS__', T_CLONE => 'clone ', T_CONCAT_EQUAL => ' .= ', T_CONST =>\n\t\t\t\t'const ',\n\t\t\tT_CONSTANT_ENCAPSED_STRING => '$$', T_CONTINUE => 'continue', T_CURLY_OPEN => '$$',\n\t\t\tT_DEC => '--',\n\t\t\tT_DECLARE => 'declare', T_DEFAULT => 'defalt', T_DIR => '__DIR__', T_DIV_EQUAL =>\n\t\t\t\t' /= ',\n\t\t\tT_DNUMBER => ' $$ ', T_DOLLAR_OPEN_CURLY_BRACES => '$$', T_DOUBLE_ARROW => ' => ',\n\t\t\tT_DOUBLE_CAST => '(double) ',\n\t\t\tT_DOUBLE_COLON => '::', T_ECHO => 'echo ', T_EMPTY => 'empty',\n\t\t\tT_ENCAPSED_AND_WHITESPACE => '$$',\n\t\t\tT_ENDDECLARE => 'enddeclare', T_END_HEREDOC => '$$', T_EVAL => '$$', T_EXIT =>\n\t\t\t\t'exit',\n\t\t\tT_EXTENDS => ' extends ', T_FILE => '__FILE__', T_FINAL => 'final ', T_FUNC_C =>\n\t\t\t\t'__FUNCTION__',\n\t\t\tT_GLOBAL => 'global ', T_GOTO => 'goto ', T_HALT_COMPILER => '$$', T_IMPLEMENTS =>\n\t\t\t\t' implements ',\n\t\t\tT_INC => '++', T_INCLUDE => 'include ', T_INCLUDE_ONCE => 'include_once ',\n\t\t\tT_INSTANCEOF => ' instanceof ',\n\t\t\tT_INT_CAST => ' (int) ', T_INTERFACE => 'interface ', T_ISSET => 'isset',\n\t\t\tT_IS_EQUAL => ' == ',\n\t\t\tT_IS_GREATER_OR_EQUAL => ' >= ', T_IS_IDENTICAL => ' === ', T_IS_NOT_EQUAL =>\n\t\t\t\t' != ',\n\t\t\tT_IS_NOT_IDENTICAL => ' !== ', T_IS_SMALLER_OR_EQUAL => ' <= ', T_LINE =>\n\t\t\t\t'__LINE__',\n\t\t\tT_LIST => 'list', T_LNUMBER => '$$', T_LOGICAL_AND => ' and ', T_LOGICAL_OR =>\n\t\t\t\t' or ',\n\t\t\tT_LOGICAL_XOR => ' xor ', T_METHOD_C => '__METHOD__', T_MINUS_EQUAL => ' -= ',\n\t\t\tT_MOD_EQUAL => ' %= ',\n\t\t\tT_MUL_EQUAL => ' *= ', T_NAMESPACE => 'namespace ', T_NS_C => '__NAMESPACE__',\n\t\t\tT_NS_SEPARATOR => '\\\\',\n\t\t\tT_NEW => 'new ', T_NUM_STRING => '$$', T_OBJECT_CAST => '(object) ',\n\t\t\tT_OBJECT_OPERATOR => '->',\n\t\t\tT_OPEN_TAG_WITH_ECHO => '<?=', T_OR_EQUAL => ' |= ', T_PAAMAYIM_NEKUDOTAYIM =>\n\t\t\t\t'::',\n\t\t\tT_PLUS_EQUAL => ' += ', T_PRINT => 'print', T_PRIVATE => 'private ', T_PUBLIC =>\n\t\t\t\t'public ',\n\t\t\tT_PROTECTED => 'protected ', T_REQUIRE => 'require ', T_REQUIRE_ONCE =>\n\t\t\t\t'require_once ',\n\t\t\tT_SL => ' << ', T_SL_EQUAL => ' <<= ', T_SR => ' >> ', T_SR_EQUAL => ' >>= ',\n\t\t\tT_START_HEREDOC => '$$',\n\t\t\tT_STATIC => 'static ', T_STRING_CAST => '(string) ', T_STRING_VARNAME => '$$',\n\t\t\tT_THROW => 'throw ',\n\t\t\tT_UNSET => 'unset', T_UNSET_CAST => '(unset) ', T_USE => ' use ', T_VAR => 'var ',\n\t\t\tT_VARIABLE => '$$',\n\t\t\tT_XOR_EQUAL => ' ^= ', '+' => ' + ', '-' => ' - ', '*' => ' * ', '/' => ' / ',\n\t\t\t'%' => ' % ',\n\t\t\t'.' => ' . ', '>' => ' > ', '<' => ' < ', '=' => ' = ', '!' => '!', '^' => ' ^ ',\n\t\t\t',' => ', ',\n\t\t\tT_STRING => function ($v, $t, $tokens, $i) {\n\t\t\t\t// class type-hinting\n\t\t\t\tif (isset($tokens[$i + 2]) && ($tokens[$i + 1][0] == T_VARIABLE || \n\t\t\t\t\t\t\t\t\t($tokens[$i + 1][0] == T_WHITESPACE &&\n\t\t\t\t\t\t\t\t\t $tokens[$i + 2][0] == T_VARIABLE)))\n\t\t\t\t\treturn $v . ' ';\n\t\t\t\t\n\t\t\t\t// static scope\n\t\t\t\treturn $v;\n\t\t\t}, T_COMMENT => function ($v) use ($blankline) {\n\t\t\t\treturn rtrim($v) . (substr($v, - 2) == '*/' ||\n\t\t\t\t\t\t substr($v, - 1) == \"\\n\" ? $blankline() : '');\n\t\t\t}, T_DOC_COMMENT => function ($v) use ($blankline) {\n\t\t\t\treturn rtrim($v) . $blankline();\n\t\t\t}, T_RETURN => function ($v, $t, $tokens, $i) use (&$tabs) {\n\t\t\t\tif ($tokens[$i + 1][0] == ';')\n\t\t\t\t\treturn 'return';\n\t\t\t\t\n\t\t\t\treturn 'return ';\n\t\t\t}, T_IF => $control('if '), T_ELSE => function ($v, $t, $tokens, $i) use \n\t\t\t\t\t\t(&$lastcontrol, $control, &$tabs, $blankline) {\n\t\t\t\t// if we're followed by an \"if\" (i.e. we're an else-if), don't handle it\n\t\t\t\tif ($tokens[$i + 1][0] == T_IF || \n\t\t\t\t\t\t\t($tokens[$i + 1][0] == T_WHITESPACE && $tokens[$i + 2][0] == T_IF))\n\t\t\t\t\treturn 'else ';\n\t\t\t\t\n\t\t\t\t// normal else, treat it like an immediate control statement\n\t\t\t\t$else = $control('else');\n\t\t\t\t$else($v, $t, $tokens, $i);\n\t\t\t\t\n\t\t\t\t// already \"past\" the condition brackets (so do the ')' handling here)\n\t\t\t\t$lastcontrol = T_ELSE + 200000;\n\t\t\t\t$tabs++;\n\t\t\t\treturn 'else' . $blankline(' ');\n\t\t\t}, T_TRY => function ($v, $t, $tokens, $i) use \n\t\t\t\t\t(&$lastcontrol, $control, &$tabs, $blankline) {\n\t\t\t\t\n\t\t\t\t// immediate control statement\n\t\t\t\t$try = $control('try');\n\t\t\t\t$try($v, $t, $tokens, $i);\n\t\t\t\t\n\t\t\t\t// already \"past\" the condition brackets (so do the ')' handling here)\n\t\t\t\t$lastcontrol = T_TRY + 200000;\n\t\t\t\t$tabs++;\n\t\t\t\treturn 'try' . $blankline(' ');\n\t\t\t}, T_CATCH => $control('catch'), T_DO => function ($v, $t, $tokens, $i) use \n\t\t\t\t\t\t(&$lastcontrol, &$control, &$tabs, $blankline) {\n\t\t\t\t// treat \"do\" just like \"else\"\n\t\t\t\t$do = $control('do');\n\t\t\t\t$do($v, $t, $tokens, $i);\n\t\t\t\t\n\t\t\t\t$lastcontrol = T_DO + 200000;\n\t\t\t\t$tabs++;\n\t\t\t\t\n\t\t\t\treturn 'do ';\n\t\t\t}, T_SWITCH => $control('switch'), T_CASE => function ($v) use (&$case) {\n\t\t\t\t$case = true;\n\t\t\t\treturn 'case ';\n\t\t\t}, T_DEFAULT => function ($v) use (&$case) {\n\t\t\t\t$case = true;\n\t\t\t\treturn 'default';\n\t\t\t}, T_WHILE => $control('while'), T_FOR => $control('for'), T_CLASS => $control(\n\t\t\t\t\t\t'class '),\n\t\t\t\tT_FUNCTION => function ($v, $t, $tokens, $i) use \n\t\t\t\t\t($control, &$lambda, &$brackets, &$controlbrackets) {\n\t\t\t\t$func = $control('function ');\n\t\t\t\t$ret = $func($v, $t, $tokens, $i);\n\t\t\t\t\n\t\t\t\t// need to special-handle lambdas here. if there's anything preceeding this\n\t\t\t\t// function that's a dollar sign, then we need to leave the bracket on us.\n\t\t\t\t$lambda = false;\n\t\t\t\tfor($tempi = $i; $tempi >= 0 && !$lambda; $tempi--)\n\t\t\t\t{\n\t\t\t\t\tlist($tempt, $tempv) = Formatter::Tokenize($tokens[$tempi]);\n\t\t\t\t\t\n\t\t\t\t\tif (strpos($tempv, \"\\n\") !== false)\n\t\t\t\t\t\tbreak;\n\t\t\t\t\telse if (strpos($tempv, \"$\") !== false || strpos($tempv, '(') !== false ||\n\t\t\t\t\t\t strpos($tempv, '=') !== false || $tempt == T_RETURN)\n\t\t\t\t\t\t$lambda = true;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\treturn $ret;\n\t\t\t}, T_FOREACH => $control('foreach'), '{' => function () use \n\t\t\t\t\t(&$lastcontrol, &$controls, &$tabs, &$lambda, $blankline) {\n\t\t\t\t\n\t\t\t\t$pre = '';\n\t\t\t\t// one exception to using the control statement as the indenter is the class\n\t\t\t\t// declaration, where there aren't any normal brackets. so we do it here.\n\t\t\t\tif ($lastcontrol == T_CLASS)\n\t\t\t\t{\n\t\t\t\t\t$tabs++;\n\t\t\t\t\t$pre = $blankline();\n\t\t\t\t}\n\t\t\t\telse if ($lambda)\n\t\t\t\t{\n\t\t\t\t\t$tabs++; // normal control statement\n\t\t\t\t\t$pre = ' ';\n\t\t\t\t\t$lambda = false;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t$lastcontrol = - 1;\n\t\t\t\t$controls[] = 0; // new \"stack\" of control statements at the curly bracket\n\t\t\t\treturn $pre . '{' . $blankline();\n\t\t\t}, '}' => function ($v, $t, $tokens, $i) use ($uncontrol, $blankline) {\n\t\t\t\t$uncontrol();\n\t\t\t\t\n\t\t\t\t// handle brackets in expressions versus in statements\n\t\t\t\tif (isset($tokens[$i + 1]) && ($tokens[$i + 1] == ';' ||\n\t\t\t\t\t\t\t $tokens[$i + 1] == ',' || $tokens[$i + 1] == ')'))\n\t\t\t\t{\n\t\t\t\t\t$lambda = false;\n\t\t\t\t\treturn '}';\n\t\t\t\t}\n\t\t\t\treturn '}' . $blankline();\n\t\t\t}, '(' => function () use (&$brackets, &$tabs) {\n\t\t\t\t$tabs++;\n\t\t\t\t$brackets++;\n\t\t\t\treturn '(';\n\t\t\t}, ')' => function ($v, $t, $tokens, $i) use (&$lastcontrol, &$brackets,\n\t\t\t\t\t\t&$controlbrackets, &$tabs, &$lambda, $blankline) {\n\t\t\t\t$tabs--;\n\t\t\t\t$brackets--;\n\t\t\t\t\n\t\t\t\tif ($brackets == end($controlbrackets) && $lastcontrol > 0 &&\n\t\t\t\t\t $lastcontrol < 200000 && !$lambda)\n\t\t\t\t{\n\t\t\t\t\t$tabs++;\n\t\t\t\t\t$lastcontrol += 200000;\n\t\t\t\t\t\n\t\t\t\t\t// if we're followed by a comment before a newline, do not add a newline.\n\t\t\t\t\t// also, if we're followed by a semicolon, don't add a newline or space.\n\t\t\t\t\tif (isset($tokens[$i + 1]) && $tokens[$i + 1][0] == ';')\n\t\t\t\t\t\treturn ')';\n\t\t\t\t\telse if ((isset($tokens[$i + 1]) && $tokens[$i + 1][0] == T_COMMENT) || \n\t\t\t\t\t\t\t\t(isset($tokens[$i + 2]) && $tokens[$i + 1][0] ==\n\t\t\t\t\t\t\t\t\tT_WHITESPACE && strpos($tokens[$i + 1][1], \"\\n\") ===\n\t\t\t\t\t\t\t\t\tfalse && $tokens[$i + 2][0] == T_COMMENT))\n\t\t\t\t\t\treturn ') ';\n\t\t\t\t\treturn ')' . $blankline();\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\treturn ')';\n\t\t\t}, ';' => function ($v, $t, $tokens, $i) use \n\t\t\t\t\t(&$lastcontrol, $uncontrol, $blankline) {\n\t\t\t\t// if this is a one-line control statement, unindent\n\t\t\t\tif ($lastcontrol >= 200000)\n\t\t\t\t\t$uncontrol();\n\t\t\t\t\n\t\t\t\t// if we're followed by a comment before a newline, do not add a newline.\n\t\t\t\tif ((isset($tokens[$i + 1]) && $tokens[$i + 1][0] == T_COMMENT) || (isset(\n\t\t\t\t\t\t\t\t$tokens[$i + 2]) && $tokens[$i + 1][0] ==\n\t\t\t\t\t\t\t\tT_WHITESPACE && strpos($tokens[$i + 1][1], \"\\n\") === false &&\n\t\t\t\t\t\t\t $tokens[$i + 2][0] == T_COMMENT))\n\t\t\t\t\treturn '; ';\n\t\t\t\t\n\t\t\t\t// for loops are the obvious exception where semicolons are allowed in-line\n\t\t\t\tif ($lastcontrol == T_FOR)\n\t\t\t\t\treturn '; ';\n\t\t\t\t\n\t\t\t\t// otherwise, add a line after this statement\n\t\t\t\treturn ';' . $blankline(' ');\n\t\t\t}, '?' => function () use (&$ternary) {\n\t\t\t\t$ternary++;\n\t\t\t\treturn ' ? ';\n\t\t\t}, ':' => function () use (&$ternary, &$case, $blankline) {\n\t\t\t\t\n\t\t\t\tif ($case)\n\t\t\t\t{\n\t\t\t\t\t$case = false;\n\t\t\t\t\treturn ':' . $blankline();\n\t\t\t\t}\n\t\t\t\tif ($ternary > 0)\n\t\t\t\t{\n\t\t\t\t\t$ternary--;\n\t\t\t\t\treturn ' : ';\n\t\t\t\t}\n\t\t\t\t// not a case, non-ternary, do not pad the colon (e.g. alt control syntax)\n\t\t\t\treturn ': ';\n\t\t\t}, T_OPEN_TAG => function ($v, $t, $tokens, $i) use \n\t\t\t\t\t(&$tabs, &$oneliner, $blankline) {\n\t\t\t\t// unfortunately, the open tag INCLUDES the trailing newline if there is one.\n\t\t\t\t// so we need to look ahead and maintain newlines appropriately\n\t\t\t\t$oneliner = false;\n\t\t\t\tif ($tokens[$i + 1][0] == T_WHITESPACE &&\n\t\t\t\t\t strpos($tokens[$i + 1][1], \"\\n\") !== false && strpos($v, \"\\n\") !== false)\n\t\t\t\t\treturn '<' . '?php' . $blankline() . $blankline();\n\t\t\t\t\n\t\t\t\t$oneliner = true;\n\t\t\t\treturn '<' . '?php ';\n\t\t\t}, T_CLOSE_TAG => function ($v, $t, $tokens, $i) use (&$oneliner, $blankline) {\n\t\t\t\t// as with the open tag, the closing tag includes the trailing newline.\n\t\t\t\tif (strpos($v, \"\\n\") !== false)\n\t\t\t\t\treturn '?>' . $blankline(\"\\n\");\n\t\t\t\t\n\t\t\t\treturn '?>';\n\t\t\t}, T_WHITESPACE => function ($v) use (&$tabs, $blankline) {\n\t\t\t\t\n\t\t\t\t// get rid of all whitespace except for double newlines, which we mark using\n\t\t\t\t// the (now-unused) carriage return and subsequently convert that to properly\n\t\t\t\t// indented lines. we will then re-add all standard whitespace that we actually\n\t\t\t\t// want directly, ensuring consistency\n\t\t\t\treturn str_replace(\"\\r\", $blankline(), str_replace(\"\\n\", '', str_replace(\n\t\t\t\t\t\t\t\"\\n\\n\", \"\\r\", str_replace(array(\"\\t\", ' ', \"\\r\"), '',\n\t\t\t\t\t\t\t\t$v))));\n\t\t\t}, T_INLINE_HTML => '$$',\n\t\t\t\t// handled separately\n\t\t\t);\n\t\t\n\t\t// all set... let's go\n\t\t$tokens = token_get_all($this->code);\n\t\t//array_walk($tokens, array('Formatter', 'PrettyPrint'));\n\t\t$ret = '';\n\t\t$cleanup = function ($v, $token) {\n\t\t\treturn str_replace(\"\\r\", '', $v);\n\t\t};\n\t\tforeach($tokens as $i => $t)\n\t\t{\n\t\t\tlist($token, $val) = self::Tokenize($t);\n\t\t\t$val = $cleanup($val, $token);\n\t\t\t\n\t\t\tif (!isset($replacements[$token]))\n\t\t\t\t$ret .= $val;\n\t\t\telse\n\t\t\t{\n\t\t\t\t$transformation = $replacements[$token];\n\t\t\t\t$ret .= is_callable($transformation) ? $transformation($val, $token, $tokens,\n\t\t\t\t\t\t$i) : str_replace('$$', strval($val), $transformation);\n\t\t\t}\n\t\t}\n\t\t\n\t\t// since we (incorrectly, but conveniently) indent the curly brackets, we need to\n\t\t// remove a single preceeding tab\n\t\t$ret = str_replace(array(\"\\t{\", \"\\t}\"), array('{', '}'), $ret);\n\t\t\n\t\t//\n\t\treturn $ret;\n\t}", "function entab($num)\n{\n\treturn \"\\n\".str_repeat(\"\\t\",$num);\n}", "function yy_r83(){return; }", "public function endTabs() {\n\t\t\treturn \"\"; \n\t\t}", "public function tab_contents() {\n\t\techo 'test';\n\t}", "function wikiplugin_split($data, $params, $pos) {\n\tglobal $tikilib, $tiki_p_admin_wiki, $tiki_p_admin, $section;\n\tglobal $replacement;\n\n // Remove first <ENTER> if exists...\n // it may be here if present after {SPLIT()} in original text\n\tif (substr($data, 0, 2) == \"\\r\\n\")\n\t\t$data2 = substr($data, 2);\n\telse\n\t\t$data2 = $data;\n\t\n\textract ($params, EXTR_SKIP);\n $fixedsize = (!isset($fixedsize) || $fixedsize == 'y' || $fixedsize == 1 ? true : false);\n $joincols = (!isset($joincols) || $joincols == 'y' || $joincols == 1 ? true : false);\n // Split data by rows and cells\n\n $sections = preg_split(\"/@@@+/\", $data2);\n $rows = array();\n $maxcols = 0;\n foreach ($sections as $i)\n {\n \t// split by --- but not by ----\n\t//\t$rows[] = preg_split(\"/([^\\-]---[^\\-]|^---[^\\-]|[^\\-]---$|^---$)+/\", $i);\n\t//\tnot to eat the character close to - and to split on --- and not ----\n\t\t$rows[] = preg_split(\"/(?<!-)---(?!-)/\", $i);\n $maxcols = max($maxcols, count(end($rows)));\n }\n\n // Is there split sections present?\n // Do not touch anything if no... even don't generate <table>\n if (count($rows) <= 1 && count($rows[0]) <= 1)\n return $data;\n\n\t$percent = false;\n\tif (isset($colsize)) {\n\t\t$tdsize= explode(\"|\", $colsize);\n\t\t$tdtotal=0;\n\t\tfor ($i=0;$i<$maxcols;$i++) {\n\t\t if (!isset($tdsize[$i])) {\n\t\t $tdsize[$i]=0;\n\t\t } else {\n\t\t\t$tdsize[$i] = trim($tdsize[$i]);\n\t\t\tif (strstr($tdsize[$i], '%')) {\n\t\t\t\t$percent = true;\n\t\t\t}\n\t\t }\n\t\t $tdtotal+=$tdsize[$i];\n\t\t}\n\t\t$tdtotaltd=floor($tdtotal/100*100);\n\t\tif ($tdtotaltd == 100) // avoir IE to do to far\n\t\t\t$class = 'class=\"normalnoborder split\"';\n\t\telse\n\t\t\t$class = 'class=\"split\" width=\"'.$tdtotaltd.'%\"';\n\t} elseif ($fixedsize) {\n\t\t$columnSize = floor(100 / $maxcols);\n\t\t$class = 'class=\"normalnoborder split\"';\n\t\t$percent = true;\t\n\t}\n\tif (!isset($edit)) $edit = 'n';\n\t$result = \"<table border='0' cellpadding='0' cellspacing='0' class='wikiplugin-split\".($percent ? \" normalnoborder\" : \"\").( !empty($customclass) ? \" $customclass\" : \"\").\"'>\";\n\n // Attention: Dont forget to remove leading empty line in section ...\n // it should remain from previous '---' line...\n // Attention: origianl text must be placed between \\n's!!!\n if (!isset($first) || $first != 'col') {\n foreach ($rows as $r) {\n $result .= \"<tr>\";\n $idx = 1;\n foreach ($r as $i) {\n\t\t\t\t// Remove first <ENTER> if exists\n if (substr($i, 0, 2) == \"\\r\\n\") $i = substr($i, 2);\n // Generate colspan for last element if needed\n $colspan = ((count($r) == $idx) && (($maxcols - $idx) > 0) ? ' colspan=\"'.($maxcols - $idx + 1).'\"' : '');\n $idx++;\n // Add cell to table\n\t\t\tif (isset($colsize)) {\n\t\t\t\t$width = ' width=\"'.$tdsize[$idx-2].'\"';\n\t\t\t} elseif ($fixedsize) {\n\t\t\t\t$width = ' width=\"'.$columnSize.'%\" ';\n\t\t\t} else {\n\t\t\t\t$width = '';\n\t\t\t}\n \t\t $result .= '<td valign=\"top\"'.$width.$colspan.'>'\n\t\t\t\t// Insert \"\\n\" at data begin (so start-of-line-sensitive syntaxes will be parsed OK)\n\t\t\t\t.\"\\n\"\n\t\t\t\t// now prepend any carriage return and newline char with br\n\t\t\t\t.preg_replace(\"/\\r?\\n/\", \"<br />\\r\\n\", $i)\n . '</td>';\n }\n \n $result .= \"</tr>\";\n }\n } else { // column first\n\tif ($edit == 'y') {\n\t\tglobal $user;\n\t\tif (isset($_REQUEST['page'])) {\n\t\t\t$type = 'wiki page';\n\t\t\t$object = $_REQUEST['page'];\n\t\t\tif ($tiki_p_admin_wiki == 'y' || $tiki_p_admin == 'y')\n\t\t\t\t$perm = true;\n\t\t\telse\n\t\t\t\t$perm = $tikilib->user_has_perm_on_object($user, $object, $type, 'tiki_p_edit');\n\t\t} else { // TODO: other object type\n\t\t\t$perm = false;\n\t\t}\n }\n\t$ind = 0;\n\t$icell = 0;\n\t$result .= '<tr>';\n\tforeach ($rows as $r) {\n\t\t$idx = 0;\n\t\t$result .= '<td valign=\"top\" '.(($fixedsize && isset($tdsize))? ' width=\"'.$tdsize[$idx].'%\"' : '').'>';\n\t\tforeach ($r as $i) {\n\t\t\tif (substr($i, 0, 2) == \"\\r\\n\") {\n\t\t\t\t$i = substr($i, 2);\n\t\t\t\t$ind += 2;\n\t\t\t}\n\t\t\tif ($edit == 'y' && $perm && $section == 'wiki page') {\n\t\t\t\t$result .= '<div class=\"split\"><div style=\"float:right\">';\n$result .= \"$pos-$icell-\".htmlspecialchars(substr($data,$pos, 10));\n \t\t\t\t$result .= '<a href=\"tiki-editpage.php?page='.$object.'&amp;pos='.$pos.'&amp;cell='.$icell.'\">'\n \t .'<img src=\"pics/icons/page_edit.png\" alt=\"'.tra('Edit').'\" title=\"'.tra('Edit').'\" border=\"0\" width=\"16\" height=\"16\" /></a></div><br />';\n \t\t\t\t$ind += strlen($i);\n\t\t\t\twhile (isset($data[$ind]) && ($data[$ind] == '-' || $data[$ind] == '@'))\n\t\t\t\t\t++$ind;\n\t\t\t}\n\t\t\telse\n\t\t\t\t$result .= '<div>';\n\t\t\t$result .= preg_replace(\"/\\r?\\n/\", \"<br />\\r\\n\", $i). '</div>';\n\t\t\t++$idx;\n\t\t\t++$icell;\n\t\t}\n\t\t$result .= '</td>';\n\t}\n\t$result .= '</tr>';\n }\n // Close HTML table (no \\n at end!)\n\t$result .= \"</table>\";\n\n\treturn $result;\n}", "function yy_r153(){ return; }", "function __ommit_nbsp($matches){\n return $matches[1].str_replace('&nbsp;', ' ', $matches[2]).$matches[3];\n}", "function __ommit_nbsp($matches){\n return $matches[1].str_replace('&nbsp;', ' ', $matches[2]).$matches[3];\n}", "function __ommit_nbsp($matches){\n return $matches[1].str_replace('&nbsp;', ' ', $matches[2]).$matches[3];\n}", "function __ommit_nbsp($matches){\n return $matches[1].str_replace('&nbsp;', ' ', $matches[2]).$matches[3];\n}", "function __ommit_nbsp($matches){\n return $matches[1].str_replace('&nbsp;', ' ', $matches[2]).$matches[3];\n}", "function yy_r29(){ $this->_retvalue = $this->yystack[$this->yyidx + 0]->minor->setTableName($this->yystack[$this->yyidx + -1]->minor); }", "public static function whitespace_table(): array\n {\n return self::$WHITESPACE_TABLE;\n }", "function ncurses_mvvline($y, $x, $attrchar, $n)\n{\n}", "private static function tab(int $depth) {\n return str_repeat(\"\\t\", $depth);\n }", "protected function extra_tablenav($which)\n {\n }", "protected function extra_tablenav($which)\n {\n }", "protected function extra_tablenav($which)\n {\n }", "function tagspaces($t)\r\n{\r\n $tolkiens = array(' ', '(', ')', '-', '+');\r\n $result = str_replace($tolkiens, '%', $t);\r\n return $result;\r\n}", "public function setCharacterSpacing($charSpacing = 0) {}", "function wikiplugin_split_cell($data, $pos, $cell) {\n\t$start = $pos;\n\t$end = $pos;\n\t$no_parsed = '~np~|~pp~|\\\\<pre\\\\>|\\\\<PRE\\\\>';\n\t$no_parsed_end = '';\n\t$match = '@@@+|----*|\\{SPLIT\\}|\\{SPLIT\\(|~np~|~pp~|\\\\<pre\\\\>|\\\\<PRE\\\\>';\n\twhile (true) {\n\t\tif (!preg_match(\"#($match)#m\", substr($data, $pos), $matches)) {\n\t\t\tif ($cell)\n\t\t\t\t$end = $start;\n\t\t\tbreak;\n\t\t} else {\n\t\t\t$end = $pos + strpos(substr($data, $pos), $matches[1]);\n\t\t\t$start_next_tag = $end + strlen($matches[1]);\n\t\t\tif (substr($matches[1], 0, 4) == '----') {\n\t\t\t} else if (substr($matches[1], 0, 3) == '@@@' || $matches[1] == '---') {\n\t\t\t\tif (!$cell)\n\t\t\t\t\tbreak;\n\t\t\t\t--$cell;\n\t\t\t\tif (!$cell)\n\t\t\t\t\t$start = $start_next_tag;\n\t\t\t} elseif ($matches[1] == $match) {\n\t\t\t\t$match = '@@@+|----*|\\{SPLIT\\}|\\{SPLIT\\(|~np~|~pp~|\\\\<pre\\\\>|\\\\<PRE\\\\>';\n\t\t\t} elseif ($matches[1] == '{SPLIT}') {\n\t\t\t\tif (!$cell)\n\t\t\t\t\tbreak;\n\t\t\t} elseif ($matches[1] == '{SPLIT(') {\n\t\t\t\t$match = '{SPLIT}';\n\t\t\t} elseif ($matches[1] == '~np~') {\n\t\t\t\t$match = '~/np~';\n\t\t\t} elseif ($matches[1] == '~pp~') {\n\t\t\t\t$match = '~/pp~';\n\t\t\t} elseif ($matches[1] == '<pre>') {\n\t\t\t\t$match = '</pre>';\n\t\t\t} elseif ($matches[1] == '<PRE>') {\n\t\t\t\t$match = '</PRE>';\n\t\t\t}\n\t\t$pos = $start_next_tag;\n\t\t}\n\t}\n\treturn array($start, $end - $start);\n}", "function Latex_Minipage_Old($width,$text,$align='t')\n {\n return\n \"\\\\begin{minipage}[\".$align.\"]{\".$width.\"}\\n\".\n $text.\"\\n\".\n \"\\\\end{minipage}\\n\".\n \"\";\n\n }", "protected function delete_space($start, $size = 2)\n {\n $sql = \"UPDATE $this->_table_name\n SET\n $this->left_column = ($this->left_column - $size)\n WHERE\n $this->left_column >= $start\n AND $this->scope_column = $this->scope\n \";\n $this->_db->exec($sql);\n\n $sql = \"UPDATE $this->_table_name\n SET\n $this->right_column = ($this->right_column - $size)\n WHERE\n $this->right_column >= $start\n AND $this->scope_column = $this->scope\n \";\n $this->_db->exec($sql);\n }", "public function indent(): void\n {\n $this->indent++;\n }", "function print_lf($t) {\n\t\t print($t . \"<br>\");\n}", "function _doLiteralBlock($value,$indent) {\n\t$exploded = explode(\"\\n\",$value);\n\t$newValue = '|';\n\t$indent += $this->_dumpIndent;\n\t$spaces = str_repeat(' ',$indent);\n\tforeach ($exploded as $line) {\n\t\t$newValue .= \"\\n\" . $spaces . trim($line);\n\t}\n\treturn $newValue;\n\t}", "public function copyAndPasteMe()\n\t{\n\t\n\t}", "private function _level_tabs( $level = 1 )\n\t{\n\t\t$tabs = '';\n\t\t\n\t\t$tab_count = 1;\n\t\t\n\t\twhile( $tab_count < $level ):\n\t\t\n\t\t\t$tabs .= \"\\t\";\n\t\t\t\n\t\t\t$tab_count++;\n\t\t\t\n\t\tendwhile;\n\t\t\n\t\treturn $tabs;\n\t}", "public function setCharSpacing($charSpacing) {}", "function fix() ;", "function phppage2readeable($t){\n\n return str_replace(\" \", \"&nbsp;\",preg_replace(\"/\\.php$/\", \"\", str_replace(\"_\", \"&nbsp;\", $t)));\n}", "public function describeTabs();", "function mb_fields()\n {\n }", "public function getLineEndingStyles() {}", "public function getLineEndingStyles() {}", "private function positionAfterWhitespace()\n {\n }", "function print_late_styles()\n {\n }", "public function setWordSpacing($wordSpacing = 0) {}", "public function addCodeSpaceRange($start, $end) {}", "public function __toString(){\r\n return \"DELIMITER \";\r\n }", "function _doFolding($value,$indent) {\n\t// Don't do anything if wordwrap is set to 0\n\tif ($this->_dumpWordWrap === 0) {\n\t\treturn $value;\n\t}\n\n\tif (strlen($value) > $this->_dumpWordWrap) {\n\t\t$indent += $this->_dumpIndent;\n\t\t$indent = str_repeat(' ',$indent);\n\t\t$wrapped = wordwrap($value,$this->_dumpWordWrap,\"\\n$indent\");\n\t\t$value = \">\\n\".$indent.$wrapped;\n\t}\n\treturn $value;\n\t}", "function extra_tablenav( $which ) {\n //if ( $which == \"bottom\" ){\n // //The code that goes after the table is there\n // echo\"Hi, I'm after the table\";\n //}\n }", "function clDisp($str){\r\n\techo '<pre>' . nl2br(str_replace(\"\\t\", '&nbsp;&nbsp;&nbsp;&nbsp;', $str)) . '</pre>';\r\n}", "function clDisp($str){\r\n\techo '<pre>' . nl2br(str_replace(\"\\t\", '&nbsp;&nbsp;&nbsp;&nbsp;', $str)) . '</pre>';\r\n}", "function parseTabs(&$field, &$item) {\r\n\t\t$editorarea_per_tab = $field->parameters->get('editorarea_per_tab', 0);\r\n\r\n\t\t$start_of_tabs_pattern = $field->parameters->get('start_of_tabs_pattern');\r\n\t\t$end_of_tabs_pattern = $field->parameters->get('end_of_tabs_pattern');\r\n\t\t\r\n\t\t$start_of_tabs_default_text = $field->parameters->get('start_of_tabs_default_text'); // Currently unused\r\n\t\t$default_tab_list = $field->parameters->get('default_tab_list'); // Currently unused\r\n\t\t\r\n\t\t$title_tab_pattern = $field->parameters->get('title_tab_pattern');\r\n\t\t$start_of_tab_pattern = $field->parameters->get('start_of_tab_pattern');\r\n\t\t$end_of_tab_pattern = $field->parameters->get('end_of_tab_pattern');\r\n\t\t\r\n\t\t$field_value = & $field->value[0];\r\n\t\t$field->tabs_detected = false;\r\n\t\t\r\n\t\t// MAKE MAIN TEXT FIELD OR TEXTAREAS TABBED\r\n\t\tif ( $editorarea_per_tab ) {\r\n\t\t\t\r\n\t\t\t//echo 'tabs start: ' . preg_match_all('/'.$start_of_tabs_pattern.'/u', $field_value ,$matches) . \"<br />\";\r\n\t\t\t//print_r ($matches); echo \"<br />\";\r\n\t\t\t\r\n\t\t\t//echo 'tabs end: ' . preg_match_all('/'.$end_of_tabs_pattern.'/u', $field_value ,$matches) . \"<br />\";\r\n\t\t\t//print_r ($matches); echo \"<br />\";\r\n\t\t\t\r\n\t\t\t$field->tabs_detected = preg_match('/' .'(.*)('.$start_of_tabs_pattern .')(.*)(' .$end_of_tabs_pattern .')(.*)'. '/su', $field_value ,$matches);\r\n\t\t\t\r\n\t\t\tif ($field->tabs_detected) {\r\n\t\t\t\t$field->tab_info = new stdClass();\r\n\t\t\t\t$field->tab_info->beforetabs = $matches[1];\r\n\t\t\t\t$field->tab_info->tabs_start = $matches[2];\r\n\t\t\t\t$insidetabs = $matches[3];\r\n\t\t\t\t$field->tab_info->tabs_end = $matches[4];\r\n\t\t\t\t$field->tab_info->aftertabs = $matches[5];\r\n\t\t\t\t\r\n\t\t\t\t//echo 'tab start: ' . preg_match_all('/'.$start_of_tab_pattern.'/u', $insidetabs ,$matches) . \"<br />\";\r\n\t\t\t\t//echo \"<pre>\"; print_r ($matches); echo \"</pre><br />\";\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t\t//echo 'tab end: ' . preg_match_all('/'.$end_of_tab_pattern.'/u', $insidetabs ,$matches) . \"<br />\";\r\n\t\t\t\t//print_r ($matches); echo \"<br />\";\r\n\t\t\t\t\r\n\t\t\t\t$tabs_count = preg_match_all('/('.$start_of_tab_pattern .')(.*?)(' .$end_of_tab_pattern .')/su', $insidetabs ,$matches) . \"<br />\";\r\n\t\t\t\t\r\n\t\t\t\tif ($tabs_count) {\r\n\t\t\t\t\t$tab_startings = $matches[1];\r\n\t\t\t\t\t\r\n\t\t\t\t\tforeach ($tab_startings as $i => $v) {\r\n\t\t\t\t\t\t$title_matched = preg_match('/'.$title_tab_pattern.'/su', $tab_startings[$i] ,$title_matches) . \"<br />\";\r\n\t\t\t\t\t\t//echo \"<pre>\"; print_r($title_matches); echo \"</pre>\";\r\n\t\t\t\t\t\t$tab_titles[$i] = $title_matches[1];\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\t$tab_contents = $matches[2];\r\n\t\t\t\t\t$tab_endings = $matches[3];\r\n\t\t\t\t\t//foreach ($tab_titles as $tab_title) echo \"$tab_title &nbsp; &nbsp; &nbsp;\";\r\n\t\t\t\t} else {\r\n\t\t\t\t\techo \"FALIED while parsing tabs<br />\";\r\n\t\t\t\t\t$field->tabs_detected = 0;\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\t$field->tab_info->tab_startings = & $tab_startings;\r\n\t\t\t\t$field->tab_info->tab_titles = & $tab_titles;\r\n\t\t\t\t$field->tab_info->tab_contents = & $tab_contents;\r\n\t\t\t\t$field->tab_info->tab_endings = & $tab_endings;\r\n\t\t\t}\r\n\t\t}\r\n\t}", "public function get_help_tabs()\n {\n }", "function yy_r141(){ $this->_retvalue = ['collate', $this->yystack[$this->yyidx + 0]->minor]; }", "function getTableWrapping($content) {\n }", "private function _indent($amount = 1)\n {\n return str_repeat(' ', $amount);\n }", "public function prettySql() {\n\t\t$sql = $this->sql();\n\t\t$sql = preg_replace(\"#([\\w_\\(\\)]+)([ \\t]+)([\\w_\\(\\)]+)#s\", \"$1 $3\", $sql);\n\t\t$sql = str_replace(\" \", \" \", $sql);\n\t\treturn $sql;\n\t}", "function log_killcursor($server, $info)\n{\n}", "function sql_highlight(&$code)\n\n{\n\n $code = strtr($code, array('\"\"' => get_placeholder(9), \"''\" => get_placeholder(10)));\n\n $blocks = array(\n\n array(\n\n 'pattern' => \"#(['\\\"`])(\\\\\\\\\\\\\\\\|.*?([^\\\\\\\\]|[^\\\\\\\\](\\\\\\\\\\\\\\\\)+)|)\\\\1#se\",\n\n //'replacement' => 'parse_c_string(\\'$0\\', \\'sql\\', \\'|&quot;&quot;|\\\\\\'\\\\\\'\\')'\n\n //'pattern' => \"#(['\\\"])(.*?([^\\\\\\\\]|(\\\\\\\\\\\\\\\\)+)|)\\\\1#s\",\n\n 'prefix' => '<span class=\"sql_string\">', \n\n 'suffix' => '</span>'\n\n ),\n\n array(\n\n 'pattern' => \"#/\\\\*(.*?)\\\\*/#s\",\n\n 'prefix' => '<span class=\"sql_blockcomment\">', \n\n 'suffix' => '</span>'\n\n ),\n\n array(\n\n 'pattern' => \"#--(.*?)[\\n\\r]#\",\n\n 'prefix' => '<span class=\"sql_linecomment\">', \n\n 'suffix' => '</span>'\n\n ),\n\n );\n\n $secondaries = array(\n\n array(\n\n 'pattern' => '#(\\W|^)(\\.?[0-9][0-9a-zA-Z.]*)#i',\n\n 'replacement' => '<span class=\"sql_number\">$2</span>',\n\n 'keepprefix' => 1\n\n ),\n\n array(\n\n 'pattern' => '#([,\\[\\]\\{\\};=\\+\\-!%\\^&*\\(\\)<>|])#',\n\n 'prefix' => '<span class=\"sql_symbol\">',\n\n 'suffix' => '</span>'\n\n ),\n\n );\n\n \n\n $kw = array(\n\n array(\n\n 'prefix' => '<span '.get_placeholder(8).'=\"sql_keyword\">',\n\n 'suffix' => '</span>',\n\n 'keywords' => array('abs','absolute','access','acos','add','add_months','adddate','admin','after','aggregate','all','allocate','alter','and','any','app_name','are','array','as','asc','ascii','asin','assertion','at','atan','atn2','audit','authid','authorization','autonomous_transaction','avg','before','begin','benchmark','between','bfilename','bin','binary','binary_checksum','binary_integer','bit','bit_count','bit_and','bit_or','blob','body','boolean','both','breadth','bulk','by','call','cascade','cascaded','case','cast','catalog','ceil','ceiling','char','char_base','character','charindex','chartorowid','check','checksum','checksum_agg','chr','class','clob','close','cluster','coalesce','col_length','col_name','collate','collation','collect','column','comment','commit','completion','compress','concat','concat_ws','connect','connection','constant','constraint','constraints','constructorcreate','contains','containsable','continue','conv','convert','corr','corresponding','cos','cot','count','count_big','covar_pop','covar_samp','create','cross','cube','cume_dist','current','current_date','current_path','current_role','current_time','current_timestamp','current_user','currval','cursor','cycle','data','datalength','databasepropertyex','date','date_add','date_format','date_sub','dateadd','datediff','datename','datepart','day','db_id','db_name','deallocate','dec','declare','decimal','decode','default','deferrable','deferred','degrees','delete','dense_rank','depth','deref','desc','describe','descriptor','destroy','destructor','deterministic','diagnostics','dictionary','disconnect','difference','distinct','do','domain','double','drop','dump','dynamic','each','else','elsif','empth','encode','encrypt','end','end-exec','equals','escape','every','except','exception','exclusive','exec','execute','exists','exit','exp','export_set','extends','external','extract','false','fetch','first','first_value','file','float','floor','file_id','file_name','filegroup_id','filegroup_name','filegroupproperty','fileproperty','for','forall','foreign','format','formatmessage','found','freetexttable','from','from_days','fulltextcatalog','fulltextservice','function','general','get','get_lock','getdate','getansinull','getutcdate','global','go','goto','grant','greatest','group','grouping','having','heap','hex','hextoraw','host','host_id','host_name','hour','ident_incr','ident_seed','ident_current','identified','identity','if','ifnull','ignore','immediate','in','increment','index','index_col','indexproperty','indicator','initcap','initial','initialize','initially','inner','inout','input','insert','instr','instrb','int','integer','interface','intersect','interval','into','is','is_member','is_srvrolemember','is_null','is_numeric','isdate','isnull','isolation','iterate','java','join','key','lag','language','large','last','last_day','last_value','lateral','lcase','lead','leading','least','left','len','length','lengthb','less','level','like','limit','limited','ln','lpad','local','localtime','localtimestamp','locator','lock','log','log10','long','loop','lower','ltrim','make_ref','map','match','max','maxextents','mid','min','minus','minute','mlslabel','mod','mode','modifies','modify','module','month','months_between','names','national','natural','naturaln','nchar','nclob','new','new_time','newid','next','next_day','nextval','no','noaudit','nocompress','nocopy','none','not','nowait','null','nullif','number','number_base','numeric','nvl','nvl2','object','object_id','object_name','object_property','ocirowid','oct','of','off','offline','old','on','online','only','opaque','open','operator','operation','option','or','ord','order','ordinalityorganization','others','out','outer','output','package','pad','parameter','parameters','partial','partition','path','pctfree','percent_rank','pi','pls_integer','positive','positiven','postfix','pow','power','pragma','precision','prefix','preorder','prepare','preserve','primary','prior','private','privileges','procedure','public','radians','raise','rand','range','rank','ratio_to_export','raw','rawtohex','read','reads','real','record','recursive','ref','references','referencing','reftohex','relative','release','release_lock','rename','repeat','replace','resource','restrict','result','return','returns','reverse','revoke','right','rollback','rollup','round','routine','row','row_number','rowid','rowidtochar','rowlabel','rownum','rows','rowtype','rpad','rtrim','savepoint','schema','scroll','scope','search','second','section','seddev_samp','select','separate','sequence','session','session_user','set','sets','share','sign','sin','sinh','size','smallint','some','soundex','space','specific','specifictype','sql','sqlcode','sqlerrm','sqlexception','sqlstate','sqlwarning','sqrt','start','state','statement','static','std','stddev','stdev_pop','strcmp','structure','subdate','substr','substrb','substring','substring_index','subtype','successful','sum','synonym','sys_context','sys_guid','sysdate','system_user','table','tan','tanh','temporary','terminate','than','then','time','timestamp','timezone_abbr','timezone_minute','timezone_hour','timezone_region','to','to_char','to_date','to_days','to_number','to_single_byte','trailing','transaction','translate','translation','treat','trigger','trim','true','trunc','truncate','type','ucase','uid','under','union','unique','unknown','unnest','update','upper','usage','use','user','userenv','using','validate','value','values','var_pop','var_samp','varchar','varchar2','variable','variance','varying','view','vsize','when','whenever','where','with','without','while','with','work','write','year','zone')\n\n )\n\n );\n\n $code = generic_highlight($code, $blocks, $secondaries, array(), $kw);\n\n // put escapes back in\n\n return strtr($code, array(get_placeholder(9) => '<span class=\"sql_string\">&quot;&quot;</span>', get_placeholder(10) => '<span class=\"sql_string\">\\'\\'</span>'));\n\n}", "function Pragma($dotaz){\n /* metoda vraci strukturu s udaji - napr. struktura tabulky a nebo false v pripade chyby*/\n /* duvodem teto metody je sjednoceni pristupu k datovemu katalogu napric databazemi */\n $m=array(); $struktura=array();\n if (preg_match('/^\\s*table_info\\(\\'(.+)\\'\\)\\s*$/',$dotaz,$m)){\n $table_name=strtoupper($m[1]); \n /* vrat strukturu tabulky $m[1] - generuje se interoperabilni tvar spolecny pro ruzne databaze */\n if (preg_match('/^(\\w+)\\.(\\w+)$/',$table_name,$m)){ \n /* tabulka uvedena jako schema.tabulka */\n\t\t $table_name=strtoupper($m[2]); \n $dodatek=\" and table_schema='$m[1]'\";\n $dodatek2=\" and all_constraints.owner='$m[1]'\"; /* uvodni mezera dulezita */\n\t }else{\n\t /* tabulka s prostym nazvem */\n $dodatek=''; $dodatek2='';\n }\t\n //deb($table_name);\n /* inicializace pole nullable, datalength, colimnid jde od nuly - sjednoceni s ostatnimi DB */ \n\t $this->Sql(\"SELECT ordinal_position as columnid, column_name, is_nullable as nullable, \".\n \"character_maximum_length as data_length, data_type, numeric_precision as data_precision, \".\n \"numeric_scale, column_key, column_comment \".\n \"FROM INFORMATION_SCHEMA.COLUMNS where upper(table_name)='\".$table_name.\"'\".$dodatek.\" order by ordinal_position asc \"); \n $countkey=0;\n while($this->FetchRow()){\n \n $struktura[$this->Data('COLUMNID')]=array(\n 'name'=>$this->Data('COLUMN_NAME'),\n 'type'=>$this->Data('DATA_TYPE'),\n\t\t 'notnull'=>$this->Data('NULLABLE')=='N'?1:0,\n 'default'=>'', /* dopsat */\n 'datalength'=>$this->Data('DATA_LENGTH'),\n 'precision'=>$this->Data('DATA_PRECISION'),\n 'datename'=>($this->Data('DATA_TYPE')=='date'?\n (\"to_char(\".$this->db->Data('COLUMN_NAME').\",'DD.MM.YYYY HH24:MI:SS') as \".$this->db->Data('COLUMN_NAME')):''),\n 'comment'=>$this->Data('COLUM_COMMENT'),\n 'pk'=>'');\n if (strtoupper($this->Data('DATA_LENGTH'))=='NULL'){\n $struktura[$this->Data('COLUMNID')]['datalength']=$this->Data('NUMERIC_SCALE');\n } \n if ($this->Data('COLUMN_KEY')!=''){\n $struktura[$this->Data('COLUMNID')]['pk']=++$countkey;\n } \n /* vazba cislo sloupce nazev pro nasledne doplneni comment */ \n $prevod[$this->Data('COLUMN_NAME')]=$this->Data('COLUMNID'); \t\t \n\t }\n //deb($struktura); \t \n return $struktura;\n }\n \n \n if (preg_match('/^\\s*catalog\\s*$/',$dotaz,$m)){\n /* vraci seznam tabulek - pohledu */\n $this->Sql(\"SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='\".$this->db_schema.\"'\");\n $n=0;\n while ($this->FetchRow()) {\n $struktura[$n++]=array(\n 'name'=>$this->Data('TABLE_NAME'),\n 'type'=>'table'); \n }\n return $struktura;\n } \n \n $this->stav=false;\n return $this->stav;\n }", "public function getLineGap() {}", "public function test_indent(){\n\t\t$listotron = new Listotron();\n\n\t\t$user1 = md5(rand() . md5(rand()));\n\t\t$now = $listotron->getNOW();\n\t\t\n\t\t// modify the List\n\t\t$rows = $listotron->indent(4, $user1);\n\t\t\n\t\t// check the output\n\t\t$this->assertEqual(count($rows), 2);\n\t\t$this->assertEqual($rows[0][\"row_id\"], 4);\n\t\t$this->assertEqual($rows[0][\"par\"], 3);\n\t\t$this->assertEqual($rows[0][\"prev\"], null);\n\t\t$this->assertEqual($rows[0][\"lm\"], $now);\n\t\t$this->assertEqual($rows[0][\"lmb\"], $user1);\n\t\t\n\t\t$this->assertEqual($rows[1][\"row_id\"], 5);\n\t\t$this->assertEqual($rows[1][\"par\"], 1);\n\t\t$this->assertEqual($rows[1][\"prev\"], 3);\n\t\t$this->assertEqual($rows[1][\"lm\"], $now);\n\t\t$this->assertEqual($rows[1][\"lmb\"], $user1);\n\t}" ]
[ "0.60116136", "0.56565726", "0.5637781", "0.54987943", "0.5429083", "0.49544406", "0.4917651", "0.49121222", "0.48988816", "0.4883412", "0.48742136", "0.482298", "0.48212358", "0.47541505", "0.47541505", "0.47305962", "0.47040984", "0.47038862", "0.46846312", "0.46728364", "0.46579093", "0.4639664", "0.4606628", "0.46043015", "0.45885158", "0.45867437", "0.4568671", "0.4566528", "0.45461193", "0.45361573", "0.45032206", "0.44389895", "0.44386864", "0.44344282", "0.44270387", "0.44237825", "0.4419384", "0.4413799", "0.43948102", "0.43892172", "0.43891823", "0.43730187", "0.4367848", "0.43564236", "0.43503046", "0.43403384", "0.43389872", "0.43389484", "0.43381494", "0.43379626", "0.43270928", "0.43255502", "0.4324398", "0.4324398", "0.4324398", "0.4324398", "0.4324398", "0.43139854", "0.43099418", "0.43076408", "0.43052468", "0.43051344", "0.43039265", "0.43039265", "0.43016198", "0.4298591", "0.42975408", "0.429338", "0.42895013", "0.42865446", "0.42862293", "0.4284066", "0.42834425", "0.42779177", "0.42679965", "0.42599806", "0.4259617", "0.42592916", "0.42503282", "0.42491972", "0.4247371", "0.4241926", "0.4239872", "0.42338005", "0.42294928", "0.4228252", "0.42219386", "0.42174795", "0.4212987", "0.4212987", "0.4205331", "0.42049652", "0.4196211", "0.41940695", "0.41910723", "0.41898054", "0.41869158", "0.41782263", "0.41753125", "0.41752025", "0.41703433" ]
0.0
-1
Note: Use `CacheFactory::getHandler()` to instantiate.
public function __construct(Cache $config) { $this->prefix = $config->prefix; if (isset($config->redis)) { $this->config = array_merge($this->config, $config->redis); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function &createCache() {}", "protected function initializeCache() {}", "public static function getCacheControl() {}", "protected function initializeCache() {}", "public function setUpCache();", "public function getFromCache() {}", "protected function initCaches() {}", "public function cacheGet() {\n }", "protected function loadFromCache() {}", "protected function getCacheManager() {}", "protected function getCacheManager() {}", "public function startCache() {}", "protected static function getCacheManager() {}", "public function initializeCachingFramework() {}", "public static function getCache() {}", "private function __construct()\n\t{\n\t\t$this->_loadCacheObj();\n\t\treturn;\n\t}", "public function getCache();", "public function getCacheAdapter();", "abstract protected function getCacheClass();", "protected function getRuntimeCache() {}", "private function setCache()\n\t{\n\t\t$this->_cache = new Cache('./', array('prefix' => 'pageReader'));\n\t}", "function __construct() {\n $this->_cache = [];\n }", "public function get($cache_name);", "private function __construct()\r\r\n\t{\t\t\r\r\n\t\t$class_name = sprintf(CPF_CACHE_STORAGE_CLASS_FORMAT, Cpf_Core_Config::get_instance()->value('CACHE.STORAGE'));\t\t\r\r\n\t\t$this->_storage = new $class_name();\r\r\n\t}", "protected function getCache() {\n\t\t$factory = $this->policy('rate_factoryname');\n\t\t$lifetime = $this->policy('rate_lock_timeout') + 60; // As long as it's longer than the actual timeout\n\t\t$cache = SS_Cache::factory($factory);\n\t\t$cache->setOption('automatic_serialization', true);\n\t\t$cache->setOption('lifetime', $lifetime);\n\t\treturn $cache;\n\t}", "public static function make()\n {\n return new waCache(new waFileCacheAdapter([]), wa()->getConfig()->getApplication());\n }", "protected static function getRuntimeCache() {}", "protected static function getFacadeAccessor() { return 'cache'; }", "function __construct(Cache $cache) {\n// $client = RedisAdapter::createConnection('redis://localhost');\n// $this->cache = new RedisTagAwareAdapter($client);\n $this->cache = $cache->getCache();\n\n }", "function cache();", "public function getCacheInstance($cacheName = null);", "public static function getInstance() {\r\n if (!Website_Service_Cache::$instance instanceof self) {\r\n Website_Service_Cache::$instance = new self();\r\n }\r\n return Website_Service_Cache::$instance;\r\n }", "public function getHandler()\n {\n }", "public function getHandler() {}", "public function initCache() {\n $cacheclass = \"corelib_cache_mongoCache\";\n if (self::$_config['caching']['type']) {\n $cacheclass = \"corelib_cache_\" . self::$_config['caching']['type'] . \"Cache\";\n }\n $this->_cache = new $cacheclass(self::$_config['caching']);\n }", "public static function cache(){\n\n if (!isset(self::$_cache)) {\n if(!GO::isInstalled()){\n self::$_cache=new \\GO\\Base\\Cache\\None();\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\tif(!isset(GO::session()->values['cacheDriver'])){\n\t\t\t\t\t\t\t\t$cachePref = array(\n\t\t\t\t\t\t\t\t\t\t\"\\\\GO\\\\Base\\\\Cache\\\\Apcu\",\n\t\t\t\t\t\t\t\t\t\t\"\\\\GO\\\\Base\\\\Cache\\\\Disk\"\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\tforeach($cachePref as $cacheDriver){\n\t\t\t\t\t\t\t\t\t$cache = new $cacheDriver;\n\t\t\t\t\t\t\t\t\tif($cache->supported()){\n\n\t\t\t\t\t\t\t\t\t\tGO::debug(\"Using $cacheDriver cache\");\n\t\t\t\t\t\t\t\t\t\tGO::session()->values['cacheDriver'] = $cacheDriver;\n\t\t\t\t\t\t\t\t\t\tself::$_cache=$cache;\n\t\t\t\t\t\t\t\t\t\tbreak;\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}else\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$cacheDriver = GO::session()->values['cacheDriver'];\n\t\t\t\t\t\t\t\tGO::debug(\"Using $cacheDriver cache\");\n\t\t\t\t\t\t\t\tself::$_cache = new $cacheDriver;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n }\n return self::$_cache;\n }", "private function _loadCacheObj()\n {\n $cache = new mime_type_cache();\n self::$_mime_type_obj = $cache->getCache();\n\t\treturn;\n }", "public function get_test_page_cache()\n {\n }", "public static function getInstance($handler = 'file', $options = array())\n {\n static $now = null;\n if (is_null($now)) {\n $now = time();\n }\n $options['now'] = $now;\n //We can't cache this since options may change...\n $handler = strtolower(preg_replace('/[^A-Z0-9_\\.-]/i', '', $handler));\n $class = 'CacheStorage' . ucfirst($handler);\n if (!class_exists($class)) {\n $path = dirname(__FILE__) . DS . 'storage' . DS . $handler . '.php';\n require_once($path);\n }\n $return = new $class($options);\n return $return;\n }", "function __construct(\\qio\\Directory\\Cache $cache) {\n $this->cache = $cache;\n }", "public function cache(): object\n {\n return $this->baseApp($this)->loadCache();\n }", "public function getHandler();", "public function getHandler();", "protected function getCacheModule() {}", "public function getObjFromCache($key);", "abstract public function getCache( $cacheID = '', $unserialize = true );", "abstract protected function createHandler();", "static function factory()\n {\n if (function_exists('apc_fetch')) {\n $class = new BaseZF_Framework_Cache_Apc();\n } else {\n $class = new BaseZF_Framework_Cache_Apc_Disable();\n }\n\n return $class;\n }", "public function makeCacheHash() {}", "abstract protected function cacheData();", "public function setCaching($cache);", "public static function setCache($cache) {}", "protected function getCacheService()\n {\n return $this->services['cache'] = new \\phpbb\\cache\\service(${($_ = isset($this->services['cache.driver']) ? $this->services['cache.driver'] : ($this->services['cache.driver'] = new \\phpbb\\cache\\driver\\file())) && false ?: '_'}, ${($_ = isset($this->services['config']) ? $this->services['config'] : $this->getConfigService()) && false ?: '_'}, ${($_ = isset($this->services['dbal.conn']) ? $this->services['dbal.conn'] : ($this->services['dbal.conn'] = new \\phpbb\\db\\driver\\factory($this))) && false ?: '_'}, './../', 'php');\n }", "function wp_cache_init()\n {\n }", "protected function middlewareFactory(array $args = [])\n {\n if (!isset($args['cache'])) {\n $args['cache'] = static::getCachePool();\n $args['processCacheKeyCallback'] = function ($key) {\n return $key;\n };\n }\n\n return new CacheMiddleware($args);\n }", "private function initializeLevel2Cache() {}", "private function registerCache()\n {\n $this->app->singleton('firewall.cache', function () {\n return new Cache(app('cache'));\n });\n }", "private function set_storage() {\r\n if (!is_array($this->cache_handler) && !empty($this->cache_handler)) {\r\n $this->cache_handler = array($this->cache_handler);\r\n }\r\n\r\n foreach ($this->cache_handler as $handler) {\r\n if ((extension_loaded($handler) || $handler == 'File') && class_exists('TS3ViewerStorage' . $handler)) {\r\n $handler = 'TS3ViewerStorage' . $handler;\r\n $this->cache = new $handler;\r\n break;\r\n }\r\n }\r\n\r\n if ($this->cache === null && class_exists('TS3ViewerStorageFile')) {\r\n $this->cache = new TS3ViewerStorageFile;\r\n }\r\n elseif ($this->cache === null) {\r\n $this->errors[] = 'no cache handler found..';\r\n return;\r\n }\r\n $this->cache_handler = get_class($this->cache);\r\n if ($this->cache_handler == 'TS3ViewerStorageFile') {\r\n $this->cache->path = $this->cache_path;\r\n }\r\n\r\n $this->cache->timeout = $this->cache_timeout;\r\n }", "public function __construct(Cache $cache)\n {\n $this->cache = $cache;\n }", "public function __construct(Cache $cache)\n {\n $this->cache = $cache;\n }", "public function realPageCacheContent() {}", "protected function getMemoryCache() {}", "static function getInstance($name){\n\t\tif(! isset( self::$_instances[$name]))\n\t\t\tself::$_instances[$name] = new cacheItem($name);\n\t\treturn self::$_instances[$name];\n\t}", "public static function getInstance()\n {\n if (!isset(self::$instance)) {\n switch (CACHE_TYPE) {\n case CacheType::apc:\n self::$cache = new APC();\n break;\n case CacheType::eaccelerator:\n self::$cache = new eAccelerator;\n break;\n case CacheType::xcache:\n self::$cache = new XCache;\n break;\n case CacheType::file:\n self::$cache = new File;\n break;\n\n case CacheType::none:\n default:\n self::$cache = new NoCache;\n break;\n }\n\n $c = __CLASS__;\n self::$instance = new $c;\n }\n\n return self::$instance;\n }", "public function getCache()\r\n\t{\r\n\t\treturn \\Bitrix\\Main\\Data\\Cache::createInstance();\r\n\t}", "public static function factory($cache, array $options = array())\n\t{\n\t\tif (! $cache instanceof Rest_Cache)\n\t\t{\n\t\t\t$cache = Rest_Cache::instance($cache);\n\t\t}\n\n\t\t$options['cache'] = $cache;\n\n\t\treturn new Rest_HTTP_Cache($options);\n\t}", "public function get_handler()\n {\n }", "protected function getMonolog_Logger_CacheService()\n {\n $this->services['monolog.logger.cache'] = $instance = new \\Symfony\\Bridge\\Monolog\\Logger('cache');\n\n $instance->pushHandler($this->get('monolog.handler.console'));\n $instance->pushHandler($this->get('monolog.handler.main'));\n\n return $instance;\n }", "private function loadCache(): void\n {\n //====================================================================//\n // Safety Check\n if (!is_string($this->cacheKey) || empty($this->cacheKey)) {\n return;\n }\n //====================================================================//\n // Connect to Apcu Cache\n $this->cacheAdapter = new ApcuAdapter();\n //====================================================================//\n // Load Links from Cache\n try {\n /** @var array $cache */\n $cache = $this->cacheAdapter->get($this->cacheKey, function (ItemInterface $item): array {\n $item->expiresAfter(self::$cacheTtl);\n\n return array();\n });\n $this->cache = $cache;\n $this->cacheItem = $this->cacheAdapter->getItem($this->cacheKey);\n } catch (InvalidArgumentException $e) {\n $this->cache = array();\n }\n //====================================================================//\n // Load Empty Value\n if (!isset($this->cache)) {\n $this->cache = array();\n }\n }", "static public function getInstance()\n\t{\n\t\tif (empty(self::$_instance))\n\t\t\tself::$_instance = new CacheFileFactory();\n\t\t\n\t\treturn self::$_instance;\n\t}", "static public function getInstance()\n\t{\n\t\tif (self::$_instance == null)\n\t\t\tself::$_instance = new Ivc_Cache;\n\t\treturn (self::$_instance);\n\t}", "private function readCache(): void{\n //stdClass é uma classe predefinido ou dinamica\n $this->cache = new stdClass();\n if(file_exists('cache.cache')){\n $this->cache = json_decode(file_get_contents('cache.cache'));\n }\n }", "protected function saveToCache() {}", "function wp_cache_init()\n{\n global $wp_object_cache;\n\n if (! ($wp_object_cache instanceof WP_Object_Cache)) {\n $fail_gracefully = ! defined('WP_REDIS_GRACEFUL') || WP_REDIS_GRACEFUL;\n\n $wp_object_cache = new WP_Object_Cache($fail_gracefully);\n }\n}", "function cache_classes_Initialize()\n{\n if ( !core_cache_Has(CACHE_CLASSES_KEY) ) {\n core_cache_Set(CACHE_CLASSES_KEY, array(), CACHE_CLASSES_TTL);\n }\n}", "function App_Cache() {\n\t\t\treturn App_Cache::instance()->getAdapter();\n\t\t}", "private function get_cache() {\n exit(file_get_contents($this->cache_file));\n }", "public function cache() {\r\n\t\t$this->resource->cache();\r\n\t}", "public function be_instantiatable() {\n\t\t$this->assertInstanceOf( Cache::class, $this->make_instance() );\n\t}", "function _getStorage()\n {\n if ($this->_handler instanceof CacheStorage) {\n return $this->_handler;\n }\n\n $this->_handler = CacheStorage::getInstance($this->_options['storage'], $this->_options);\n if ($this->_handler != null) {\n if ($this->_handler->test()) {\n return $this->_handler;\n } else {\n $this->_handler = CacheStorage::getInstance('file', $this->_options);\n return $this->_handler;\n }\n } else {\n return null;\n }\n }", "protected static function getCacheIdentifier() {}", "public function getCache()\n\t{\n\t\tif( ! $this->cache_on)\n\t\t{\n\t\t\treturn false;\n\t\t}\n\t\t\n\t\tif(isset($this->cache_obj))\n\t\t{\n\t\t\treturn $this->cache_obj;\n\t\t}\n\t\t\n\t\t$class = 'Db_Cache_'.$this->cachedrv;\n\t\t\n\t\t$this->cache_obj = new $class($this->cacheopt);\n\t\t\n\t\treturn $this->cache_obj;\n\t}", "protected function _initCache() {\n\t\t$options = $this->getOptions();\n\t\tswitch($options['cache']) {\n\t\t\tcase 'apc':\n\t\t\t\t$cache = new \\Doctrine\\Common\\Cache\\ApcCache();\n\t\t\tbreak;\n\n\t\t\tcase 'memcache':\n\t\t\t\t$cache = new \\Doctrine\\Common\\Cache\\MemcacheCache();\n\t\t\tbreak;\n\n\t\t\tcase 'xcache':\n\t\t\t\t$cache = new \\Doctrine\\Common\\Cache\\XcacheCache();\n\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t\t$cache = new \\Doctrine\\Common\\Cache\\ArrayCache();\n\t\t}\n\n// \t\t$this->_config->setMetadataCacheImpl($cache);\n// \t\t$this->_config->setQueryCacheImpl($cache);\n\t}", "private static function cache_init()\n\t{\n\t\tif(function_exists('apc_fetch') && !isset(self::$class_loader_cache))\n\t\t{\n\t\t\tif(function_exists('apc_exists'))\n\t\t\t{\n\t\t\t\tif(apc_exists(self::get_CACHE_KEY()))\n\t\t\t\t\tself::$class_loader_cache = apc_fetch(self::get_CACHE_KEY());\n\t\t\t\telse\n\t\t\t\t\tself::$class_loader_cache = array();\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tself::$class_loader_cache = apc_fetch(self::get_CACHE_KEY());\n\t\t\t\tif(self::$class_loader_cache === false)\n\t\t\t\t\tself::$class_loader_cache = array();\n\t\t\t}\n\t\t}\n\t\telse if(defined('STF_CACHE_PATH'))\n\t\t{\n\t\t\tself::$cache = STF_CACHE_PATH.DIRECTORY_SEPARATOR.self::CACHE_KEY.'_cache.phpserial';\n\t\t\tif(!isset(self::$class_loader_cache))\n\t\t\t{\n\t\t\t\tself::$class_loader_cache = array();\n\t\t\t\tif(!file_exists(self::$cache))\n\t\t\t\t{\n\t\t\t\t\tif(is_writable(STF_CACHE_PATH))\n\t\t\t\t\t\tif(touch(self::$cache))\n\t\t\t\t\t\t\tfile_put_contents(self::$cache, serialize(self::$class_loader_cache));\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tthrow new ClassLoader_Exception('Can not create cache file.');\n\t\t\t\t\telse\n\t\t\t\t\t\tthrow new ClassLoader_Exception('Can not create cache file in cache directory.');\n\t\t\t\t}\n\t\t\t\telse if(!empty(self::$cache))\n\t\t\t\t{\n\t\t\t\t\t$cacheAge = filemtime(self::$cache);\n\t\t\t\t\t$cacheTimeOut = $cacheAge + (defined('STF_CACHE_TIME') ? STF_CACHE_TIME : self::CACHE_TIME);\n\t\t\t\t\t\n\t\t\t\t\tif($cacheTimeOut < time())\n\t\t\t\t\t\tfile_put_contents(self::$cache, self::CACHE_INIT);\n\n\t\t\t\t\tself::$class_loader_cache = unserialize(file_get_contents(self::$cache));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\t// throw new ClassLoader_Exception('STF_CACHE_PATH not defined.');\n\t\t}\n\t}", "protected function _initCache() {\n\trequire_once 'Zend/Cache.php';\n\trequire_once 'Zend/Config/Ini.php';\n\n\t$this->bootstrap('ServerRegistry');\n\t$config = new Zend_Config_Ini(APPLICATION_CONFIG_PATH . '/cache.ini');\n\t$cache = Zend_Cache::factory($config->get('frontend'), $config->get('backend'), $config->get('frontendOption')->toArray(), $config->get('backendOption')->toArray(), TRUE, TRUE);\n\t$cache->cleanByRegistry();\n\tif (isset($_GET ['clear_cache']) && ('all' == $_GET ['clear_cache'])) {\n\t $cache->clean();\n\t}\n\n\treturn $cache;\n }", "private function getFileCache()\n {\n $shopIdCalculatorMock = $this->getMock(ShopIdCalculator::class, array('getShopId'), array(), '', false);\n $shopIdCalculatorMock->method('getShopId')->willReturn(1);\n\n return oxNew(SubShopSpecificFileCache::class, $shopIdCalculatorMock);\n }", "public function init()\n {\n $manager = $this->getCacheManager();\n Ezy_Cache_Manager::setInstance($manager);\n\n if(isset($_GET['CLEAR_CACHE']) && $_GET['allowme'] == 1){\n $cache = Ezy_Cache_Manager::getInstance()->getCache($_GET['CLEAR_CACHE']);\n $cache->clean(Zend_Cache::CLEANING_MODE_ALL);\n }\n \n return $manager;\n }", "function get_handler() {\r\n }", "protected static function getStackCache()\n {\n if (self::$stackCache == null) {\n //Folder save Cache response\n if (isset(self::$configApp['cacheHttp']) && isset(self::$configApp['cacheHttp']['folderCache'])) {\n $folderCache = self::$configApp['cacheHttp']['folderCache'];\n } else {\n $folderCache = __DIR__ . '/../../storage/cacheHttp';\n }\n //Create folder\n if (is_dir($folderCache) == false) {\n mkdir($folderCache, 0777, true);\n chmod($folderCache, 0777);\n }\n\n $localStorage = new Local($folderCache);\n $systemStorage = new FlysystemStorage($localStorage);\n $cacheStrategy = new PrivateCacheStrategy($systemStorage);\n\n $stack = HandlerStack::create();\n $stack->push(new CacheMiddleware($cacheStrategy), 'cache');\n self::$stackCache = $stack;\n }\n return self::$stackCache;\n }", "static function init(){\n\t\tif( ! self::$backend instanceof self::$useBackend){\n\t\t\t$backend = new self::$useBackend();\n\t\t\tself::setBackend($backend);\n\t\t\tif(! $backend instanceof cacheBackend)\n\t\t\t\tthrow new RuntimeException(__class__.'::init() invalid cacheBackend');\n\t\t\tif( self::$autoClear )\n\t\t\t\tself::clear(self::$ttl);\n\t\t}\n\t}", "function getCacheServices();", "protected function initCache()\n {\n $this->di->set('viewCache', function () {\n /** @var DiInterface $this */\n $config = $this->getShared('config');\n\n $frontend = new FrontOutput(['lifetime' => $config->get('viewCache')->lifetime]);\n\n $config = $config->get('viewCache')->toArray();\n $backend = '\\Phalcon\\Cache\\Backend\\\\' . $config['backend'];\n unset($config['backend'], $config['lifetime']);\n\n return new $backend($frontend, $config);\n });\n\n $this->di->setShared('modelsCache', function () {\n /** @var DiInterface $this */\n $config = $this->getShared('config');\n\n $frontend = '\\Phalcon\\Cache\\Frontend\\\\' . $config->get('modelsCache')->frontend;\n $frontend = new $frontend(['lifetime' => $config->get('modelsCache')->lifetime]);\n\n $config = $config->get('modelsCache')->toArray();\n $backend = '\\Phalcon\\Cache\\Backend\\\\' . $config['backend'];\n unset($config['backend'], $config['lifetime'], $config['frontend']);\n\n return new $backend($frontend, $config);\n });\n\n $this->di->setShared('dataCache', function () {\n /** @var DiInterface $this */\n $config = $this->getShared('config');\n\n $frontend = '\\Phalcon\\Cache\\Frontend\\\\' . $config->get('dataCache')->frontend;\n $frontend = new $frontend(['lifetime' => $config->get('dataCache')->lifetime]);\n\n $config = $config->get('dataCache')->toArray();\n $backend = '\\Phalcon\\Cache\\Backend\\\\' . $config['backend'];\n unset($config['backend'], $config['lifetime'], $config['frontend']);\n\n return new $backend($frontend, $config);\n });\n }", "function wp_start_object_cache()\n {\n }", "public function __construct()\n {\n $this->initContrexxCaching();\n $this->initOPCaching();\n $this->initUserCaching();\n $this->getActivatedCacheEngines();\n }", "public function cache() {\r\n\t\t$key = $this->cacher.'.' . $this->hash();\r\n\t\tif (($content = pzk_store($key)) === NULL) {\r\n\t\t\t$content = $this->getContent();\r\n\t\t\tpzk_store($key, $content);\r\n\t\t}\r\n\t\techo $content;\r\n\t}", "protected function _loadCacheFile()\n\t{\n\t\tif ( $this->obj['query_cache_file'] )\n \t{\n \t\trequire_once( $this->obj['query_cache_file'] );/*noLibHook*/\n \t\n\t\t\t$sql_queries_name = $this->sql_queries_name ? $this->sql_queries_name : 'sql_queries';\n\n \t\t$this->sql = new $sql_queries_name( $this );\n \t}\n\t}", "private function registerCache()\n\t{\n\t\t$this->app->singleton('glottos.cache', function($app) {\n\t\t\treturn new Cache();\n\t\t});\n\t}", "public function buildFromCache( $method, $args=array(), $class='sql_queries' );", "static public function getFromUrl(){\n $args = func_get_args();\n\n $cacheIsExpired = true; // By default we assume no cache then never expire (then cache always expire !)\n\n $cache = static::getCache();\n if( !is_null($cache) && isset($args[0]) && is_string($args[0]) ){ // Cache defined ?\n $cacheIsExpired = $cache->setRequest($args[0])->isExpired();\n }\n\n set_error_handler(array('\\Draeli\\RssBridge\\Utils', 'set_error_handler'));\n\n $argsLng = count($args);\n\n if( $cacheIsExpired ){\n if( !isset($args[1]) ){\n $args[1] = false;\n }\n\n if( !isset($args[2]) ){\n $randVersion = rand(23, 30) . '.' . rand(0, 9);\n\n // http://www.php.net/manual/fr/context.http.php\n // http://en.wikipedia.org/wiki/List_of_HTTP_header_fields\n $context = stream_context_create(array(\n 'http' => array(\n 'header' =>\n 'Accept-Charset: utf-8' . \"\\r\\n\" . \n 'User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:' . $randVersion . ') Gecko/' . date('Ymd') . ' Firefox/' . $randVersion . \"\\r\\n\", // À la bourrin ! :)\n )\n ));\n $args[2] = $context;\n }\n\n $argsFileGetContens = $argsLng > 5 ? array_slice($args, 0, 5) : $args;\n /*\n Note : il est possible d'utilisater les options de context, cf. http://www.php.net/manual/fr/context.http.php + http://fr2.php.net/manual/en/function.file-get-contents.php\n */\n $sourceHtml = call_user_func_array('\\file_get_contents', $argsFileGetContens );\n }\n else{ // Cache not expired, we reload stuff\n $sourceHtml = $cache->loadData();\n }\n\n if( $sourceHtml === false ){\n throw new \\Exception('No data to load from this URL');\n }\n\n $argsStrGetContens = $argsLng > 5 ? array_slice($args, 5) : array();\n array_unshift($argsStrGetContens, $sourceHtml);\n\n $result = call_user_func_array( array('\\Sunra\\PhpSimple\\HtmlDomParser', 'str_get_html'), $argsStrGetContens);\n // $result = call_user_func_array( array('\\Sunra\\PhpSimple\\HtmlDomParser', 'file_get_html'), $args );\n restore_error_handler ();\n\n if( !is_null($cache) ){ // Cache expired or not exist, we refresh cache\n $cache->saveData($sourceHtml);\n }\n\n return $result;\n }", "public function test_page_cache()\n {\n }", "public function getCache()\r\n {\r\n \treturn $this->_cache;\r\n }" ]
[ "0.73511887", "0.6797433", "0.67937416", "0.6790449", "0.67158616", "0.67019176", "0.6690711", "0.6687311", "0.6667365", "0.6630004", "0.6629728", "0.6590483", "0.6583984", "0.6583211", "0.65368867", "0.65056866", "0.64941764", "0.64883083", "0.64485466", "0.6367124", "0.63381845", "0.62885773", "0.626078", "0.62271756", "0.62234", "0.62226516", "0.62154555", "0.6206921", "0.6174048", "0.61673975", "0.6154077", "0.61397547", "0.6122386", "0.612165", "0.6097161", "0.60791117", "0.6074889", "0.60696685", "0.60643923", "0.6061528", "0.60563", "0.6056204", "0.6056204", "0.6054453", "0.6047345", "0.6031591", "0.6029339", "0.60034466", "0.5996874", "0.599053", "0.598064", "0.5980213", "0.5978529", "0.59626555", "0.5957292", "0.5936896", "0.59321636", "0.5931036", "0.5921284", "0.5921284", "0.58896303", "0.5886572", "0.5861332", "0.58600974", "0.58567953", "0.5854916", "0.58540297", "0.58360034", "0.5834806", "0.58323705", "0.5827857", "0.5818639", "0.58182025", "0.5809475", "0.58023846", "0.58000785", "0.57841945", "0.5780838", "0.578068", "0.57740355", "0.57653636", "0.5758484", "0.5757357", "0.57567155", "0.57544345", "0.57518375", "0.574706", "0.57307124", "0.57297844", "0.57221764", "0.57099444", "0.5702463", "0.56974787", "0.5684156", "0.5676181", "0.5667524", "0.56656927", "0.56639636", "0.56630266", "0.56617093", "0.5634854" ]
0.0
-1
/ Purpose: Function to validate all the input parameters
function validatePlayer($params) { $error = array(); $validation = new Validation(); if (!empty($params['aita']) && !$validation->validate_digits($params['aita'])) { $error[] = "AITA Number only consists of Numbers."; } else if (empty($params['academy'])) { $error[] = "AITA Number is mandatory."; } if (!empty($params['firstName']) && !$validation->validate_alphanumeric($params['firstName'])) { $error[] = "First Name only consists of Alpha Numeric Characters."; } else if (empty($params['firstName'])) { $error[] = "First Name is mandatory."; } if (!empty($params['lastName']) && !$validation->validate_alphanumeric($params['lastName'])) { $error[] = "Last Name only consists of Alpha Numeric Characters."; } else if (empty($params['lastName'])) { $error[] = "Last Name is mandatory."; } if (!empty($params['birthday']) && !$validation->validate_date($params['birthday'], '/', true)) { $error[] = "Date Of Birth is Invalid."; } else if (empty($params['birthday'])) { $error[] = "Date Of Birth is mandatory."; } if (!empty($params['gender']) && !$validation->validate_gender($params['gender'])) { $error[] = "Invalid Gender selected."; } else if (empty($params['gender'])) { $error[] = "Gender is mandatory."; } if (!empty($params['state']) && !$validation->validate_alpha($params['state'])) { $error[] = "State only consists of Characters."; } else if (empty($params['state'])) { $error[] = "State is mandatory."; } if (!empty($params['mobile']) && !$validation->validate_digits($params['mobile'])) { $error[] = "Mobile only should contain numbers."; } else if (empty($params['mobile'])) { $error[] = "Mobile Number is mandatory."; } if (!empty($params['email']) && !$validation->validate_email_dot_underscore($params['email'])) { $error[] = "Email is Invalid."; } else if (empty($params['email'])) { $error[] = "Email is mandatory."; } if (!empty($params['academyId']) && !$validation->validate_digits($params['academyId'])) { $error[] = "Invalid Academy selected."; } else if (empty($params['email'])) { $error[] = "Academy is mandatory."; } //Non Mandatory field if (!empty($params['facebook_page']) && !$validation->validate_alphanumeric($params['facebook_page'])) { $error[] = "Invalid Facebook ID."; } //Non Mandatory field if (!empty($params['twitter_account']) && !$validation->validate_alphanumeric($params['twitter_account'])) { $error[] = "Invalid Twitter ID."; } if (isset($params['player_photo']) && empty($params['player_photo'])) { $error[] = "Choose an image to upload."; } return $error; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function validateParameters(&$parameters);", "private function validateInputParameters($data)\n {\n }", "public function validateArguments() {}", "abstract public function validate();", "abstract public function validate();", "protected function validateParameters($params) {\n\t\t$this->validateFields($params);\n\t\t$this->validateNoExtraFields($params);\n\t\t$this->validateCardNumber($params);\n\t}", "abstract public function validateData();", "public abstract function validation();", "function validateInput()\r\n\t{\r\n\t\tif(preg_match('/^[a-zA-Z ]*$/', $this->name) != 1)\r\n\t\t{\r\n\t\t\t$this->err = true;\r\n\t\t\t$this->errMsgBeg .= \"-> Error in name $this->name. Only alphabets allowed.<br>\";\r\n\t\t}\r\n\r\n\t\tif(preg_match('/^[a-zA-Z ]*$/', $this->desg) != 1)\r\n\t\t{\r\n\t\t\t$this->err = true;\r\n\t\t\t$this->errMsgBeg .= \"-> Error in designation $this->desg. Only alphabets allowed.<br>\";\r\n\t\t}\r\n\r\n\t\tif(empty($this->addr))\r\n\t\t{\r\n\t\t\t$this->err = true;\r\n\t\t\t$this->errMsgBeg .= \"-> Error in address entered. Please fill correct address field as per gender: Office address for Male user, and Residential address for Female user.<br>\";\t\r\n\t\t}\r\n\r\n\t\tforeach($this->emails as $ele)\r\n\t\t{\r\n\t\t\tif(!filter_var($ele, FILTER_VALIDATE_EMAIL))\r\n\t\t\t{\r\n\t\t\t\t$this->err = true;\r\n\t\t\t\t$this->errMsgBeg .= \"-> Invalid email-id $ele. Enter correctly.<br>\";\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t}", "public function validate($input, $parameters);", "private function validate_input() {\n\t\t$fields = array_merge( array( $this->range_field ), $this->key_fields, $this->checksum_fields );\n\n\t\t$this->validate_fields( $fields );\n\t\t$this->validate_fields_against_table( $fields );\n\t}", "public function validate();", "public function validate();", "public function validate();", "public function validate();", "public function validate();", "public function validate();", "public function validate();", "public function validate();", "public function validate();", "public function validate();", "public function validate();", "public function validate();", "public function cli_validateArgs() {}", "private function validateParams(){\n\t\t$name\t = $this->param['name']; \n\t\t$ic\t\t = $this->param['ic']; \n\t\t$mobile\t= $this->param['mobile']; \n\t\t$email\t= $this->param['email']; \n\t\t$statusCode = array();\n\t\tif(!$name){\n\t\t\t$statusCode[] = 115;\n\t\t}\n\t\tif(!$ic){\n\t\t\t$statusCode[] = 116;\n\t\t}\n\t\tif(!$email){\n\t\t\t$statusCode []= 101;\n\t\t}elseif (!filter_var($email, FILTER_VALIDATE_EMAIL)) {\n\t\t $statusCode[] = 105;\n\t\t}\n\t\treturn $statusCode;\n\t}", "public static function validate() {}", "abstract public function valid();", "public function validation();", "protected function _validate() {\n\t}", "function check_required_vars($params = array())\n\t{\n\t\tglobal $SID, $phpEx, $data;\n\n\t\twhile( list($var, $param) = @each($params) )\n\t\t{\n\t\t\tif (empty($data[$param]))\n\t\t\t{\n\t\t\t\tredirect(append_sid(\"garage.$phpEx?mode=error&EID=3\", true));\n\t\t\t}\n\t\t}\n\n\t\treturn ;\n\t}", "function validateInputs(){\n\tglobal $nric,$firstName,$lastName,$dob,$address1,$address2,$poCode,\n$homeNum,$handphoneNum,$email,$description;\n\tglobal $faID;\n\tif(!matchRegex($nric,'/^[a-zA-Z0-9]*$/')) { return false; }\n\tif(!matchRegex($firstName,'/^[a-zA-Z0-9 ]*$/')) { return false; }\n\tif(!matchRegex($lastName,'/^[a-zA-Z0-9 ]*$/')) { return false; }\n\tif(!matchRegex($dob,'/^[0-9-]*$/')) { return false; }\n\tif(!matchRegex($address1,'/^[a-zA-Z0-9 -_.,#]*$/')) { return false; }\n\tif(!matchRegex($address2,'/^[a-zA-Z0-9 -_.,#]*$/')) { return false; }\n\tif(!matchRegex($poCode,'/^[0-9]*$/')) { return false; }\n\tif(!matchRegex($homeNum,'/^[0-9]*$/')) { return false; }\n\tif(!matchRegex($handphoneNum,'/^[0-9]*$/')) { return false; }\n\tif(!matchRegex($email,'/^[a-zA-Z0-9@._-]*$/')) { return false; }\n\tif(!matchRegex($description,'/^[a-zA-Z0-9 -_.,#]*$/')) { return false; }\n\t\n\treturn true;\n}", "protected function validateParameters($params) {\n return true;\n }", "public function validate($input);", "public function validateCallParameter() {\n if ($this->call_asset['parameter']) {\n // Validate parameters to a call.\n // Array, defining each parameter allowed in a call with the expected\n // data type of the value.\n $call_parameter = $this->call_parameter;\n // Parameters of the call request as seen in the request call.\n $call_request_parameter = $this->call_asset['parameter'];\n\n // Validate each parameter.\n foreach($call_request_parameter as $key => $value) {\n if (array_key_exists($key, $call_parameter)) {\n // Key in the request matches predefined parameter of the call.\n $is_valid = $this->matchDataType($value, $call_parameter[ $key ]);\n \n // Value should only match the enumerated value.\n if (is_array($call_parameter[ $key ])) {\n $call_parameter[ $key ] = 'one: ' . implode(',', $call_parameter[ $key ]) . ' - list';\n }\n\n if (!$is_valid) {\n // Data type mismatch.\n $response = [\n 'code' => 400, // Bad Request.\n 'message' => 'Call: Parameter ' . $key . ' expects ' . $call_parameter[ $key ] . ' type.'\n ];\n TripalWebServiceResponse::errorResponse($response);\n\n // Error will exit, but break here to be clear that loop should halt on error.\n break;\n }\n }\n else {\n // Undefined parameter to this call.\n $response = [\n 'code' => 400, // Bad Request.\n 'message' => 'Call: Parameter ' . $key . ' not expected for this call.'\n ];\n TripalWebServiceResponse::errorResponse($response);\n\n // Error will exit, but break here to be clear that loop should halt on error.\n break;\n }\n }\n }\n }", "function validate(array $data)\n\t{\n\t}", "public function validateRequest();", "function checkAllParams(){\n\t\tif(isset($_REQUEST['appid'][100]) || isset($ref[1000]) || isset($_REQUEST['uid'][200]) ){\n\t\t\tthrow new Exception('paramater length error',10001);\n\t\t}\n\t\tif(isset($_REQUEST['ref']))$_REQUEST['ref']=substr($_REQUEST['ref'], 0,990);\n\t\t\n\t\tif(!$this->check(\"appid\",$_REQUEST['appid']) && !isset($_REQUEST['json'])){\n\t\t\t//ea_write_log(APP_ROOT.\"/error_log/\".date('Y-m-d').\".log\", \"error_appid=\".$_REQUEST['appid'].\" \".$_REQUEST['event'].\" \".$_REQUEST['logs'].\" \\n\");\n\t\t\tthrow new Exception('appid error',10001);\n\t\t}\n\t\t\n\t\t$_REQUEST['appid']=strtolower($_REQUEST['appid']);\n\t\t$this->appidmap();\n\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 }", "function validate()\n\t{\n\t}", "public function checkRequiredParamsSet() : bool {\n }", "abstract public function validateData($data);", "public function Valid();", "abstract function validate(): void;", "abstract protected function validate($data);", "function validate_all($required, $data)\n{\n $result = array();\n $result['code'] = 1;\n $result['error'] = \"All OK!\";\n if (count(array_intersect_key($required, $data)) != count($required)) {\n $result['code'] = 0;\n $result['error'] = \"Fields Mismatch!\";\n return $result;\n }\n foreach ($required as $field => $rules) {\n $value = trim($data[$field]);\n $code = 0;\n $error = \"\";\n switch ($rules['type']) {\n case 'numeric':\n if ($rules['required'] && empty($value)) {\n $error = $field . \" is empty.\";\n } else if (!is_numeric($value)) {\n $error = $field . \" is not numeric.\";\n } else if (isset($rules['min'])) {\n if ($value < $rules['min']) {\n $error = $field . \" min error.\";\n } else {\n $code = 1;\n $error = \"All OK!\";\n }\n } else if (isset($rules['max'])) {\n if ($value > $rules['max']) {\n $error = $field . \" max error.\";\n } else {\n $code = 1;\n $error = \"All OK!\";\n }\n } else {\n $code = 1;\n $error = \"All OK!\";\n }\n break;\n case 'alpha':\n if ($rules['required'] && empty($value)) {\n $error = $field . \" is empty.\";\n } else if (!preg_match('/^[a-zA-Z]+$/', $value)) {\n $error = $field . \" is invalid.\";\n } else {\n $code = 1;\n $error = \"All OK!\";\n }\n break;\n case 'alpha_space':\n if ($rules['required'] && empty($value)) {\n $error = $field . \" is empty.\";\n } else if (!preg_match('/^[a-zA-Z ]+$/', $value)) {\n $error = $field . \" is invalid.\";\n } else {\n $code = 1;\n $error = \"All OK!\";\n }\n break;\n case 'alphanumeric':\n if ($rules['required'] && empty($value)) {\n $error = $field . \" is empty.\";\n } else if (!preg_match('/^[a-zA-Z0-9]+$/', $value)) {\n $error = $field . \" is invalid.\";\n } else {\n $code = 1;\n $error = \"All OK!\";\n }\n break;\n case 'alphanumeric_space':\n if ($rules['required'] && empty($value)) {\n $error = $field . \" is empty.\";\n } else if (!preg_match('/^[a-zA-Z0-9 ]+$/', $value)) {\n $error = $field . \" is invalid.\";\n } else {\n $code = 1;\n $error = \"All OK!\";\n }\n break;\n case 'email':\n if ($rules['required'] && empty($value)) {\n $error = $field . \" is empty.\";\n } else if (!preg_match($rules['pattern'], $value)) {\n $error = $field . \" is invalid.\";\n } else {\n $code = 1;\n $error = \"All OK!\";\n }\n break;\n case 'pattern':\n if ($rules['required'] && empty($value)) {\n $error = $field . \" is empty.\";\n } else if (!preg_match($rules['pattern'], $value)) {\n $error = $field . \" is invalid.\";\n } else {\n $code = 1;\n $error = \"All OK!\";\n }\n break;\n case 'any':\n # code...\n if ($rules['required'] && empty($value)) {\n $error = $field . \" is empty.\";\n } else {\n $code = 1;\n $error = \"All OK!\";\n }\n break;\n }\n $result['fields'][$field] = array('code' => $code, 'error' => $error, 'value' => $value, 'field' => $field);\n }\n foreach ($result['fields'] as $row) {\n if ($row[\"code\"] == 0) {\n $result['code'] = 0;\n $result['error'] = $row['error'];\n break;\n }\n }\n return $result;\n}", "abstract public function validate(&$params=array(), $flowId=null);", "function checkMandatoryArguments()\n \t{\n \t\tif($this->mStrAdGUID == \"\" || $this->mStrAdGUID == null)\n \t\t\treturn false;\n \t\telse if($this->mStrQuantity == \"\" || $this->mStrQuantity == null)\n \t\t\treturn false;\n \t\telse\n \t\t\treturn true;\n \t}", "public function validate_fields() {\n \n\t\t\n \n\t\t}", "function isValid() ;", "function required_params()\n {\n $params = func_get_args();\n foreach ($params as $value) {\n if (is_array($value)) {\n if (empty($value)) {\n return false;\n }\n } else {\n if ($value === null || strlen(trim($value)) == 0) {\n return false;\n }\n }\n }\n\n return true;\n }", "private function checkRequiredParameters()\n {\n $missingParameters = array();\n\n foreach ($this->parameters as $name => $properties) {\n $required = $properties['required'];\n $value = $properties['value'];\n if ($required && is_null($value)) {\n $missingParameters[] = $name;\n }\n }\n\n if (count($missingParameters) > 0) {\n $missingParametersList = implode(', ', $missingParameters);\n throw new IndexParameterException('The following required\n parameters were not set: '.$missingParametersList.'.');\n }\n }", "public function valid();", "public function valid();", "public function valid();", "public function valid();", "static public function checkParams($params=null)\n\t{\n\t\tif (!isset($params['min']) && !isset($params['max'])) {\n\t\t\treturn 'One of \"min\" or \"max\" must be set';\n\t\t}\n\t\tif (isset($params['min']) && !preg_match('/^\\d+$/', $params['min'])) {\n\t\t\treturn 'min must be an int';\n\t\t}\n\t\tif (isset($params['max']) && !preg_match('/^\\d+$/', $params['max'])) {\n\t\t\treturn 'max must be an int';\n\t\t}\n\t\tif (isset($params['min']) && isset($params['max']) && $params['min']>$params['max']) {\n\t\t\treturn 'max must be the same or greater than min';\n\t\t}\n\t\treturn true;\n\t}", "protected function validate()\n {\n }", "abstract public function validate_request(array $params):bool;", "protected function verifyParams() {\n\t\t\treturn true;\n\t\t}", "private function validate_params( & $params )\n {\n if (!isset($params['id_item'])) {\n throw new \\Exception('id_item field isnt defined');\n }\n\n $val_digits = new \\Zend\\Validator\\Digits();\n\n if (false === $val_digits->isValid($params['id_item'])) {\n throw new \\Exception('id_item isnt from type bigint');\n }\n\n if (isset($params['preferred'])) {\n if (!in_array($params['preferred'], array(\"t\",\"f\"))) {\n throw new \\Exception('preferred field must be \"t\" or \"f\"');\n }\n }\n }", "private function validate_params( & $params )\n {\n if (!isset($params['search'])) {\n throw new \\Exception('search field isnt defined');\n } else {\n $this->search = $params['search'];\n }\n\n if (isset($params['default_display'])) {\n if (false === is_bool($params['default_display'])) {\n throw new \\Exception('default_display isnt from type boolean');\n }\n }\n\n if (isset($params['no_transform_attributes'])) {\n if (false === is_bool($params['no_transform_attributes'])) {\n throw new \\Exception('no_transform_attributes isnt from type boolean');\n }\n }\n\n\n }", "public function validate()\n {\n $requiredArguments = $this->getRequiredArguments();\n \n foreach ($requiredArguments as $arg) {\n if ( ! isset($this->arguments[$arg])) {\n return false;\n }\n }\n \n return true;\n }", "public function testIsValidPassing()\n {\n $this->assertTrue($this->helper->isValid('s1', 'wala wala bing bang'));\n $this->assertTrue($this->helper->isValid('s2', 'wala wala bing bang'));\n $this->assertTrue($this->helper->isValid('i1', 12));\n $this->assertTrue($this->helper->isValid('i2', -11));\n $this->assertTrue($this->helper->isValid('i3', 116));\n $this->assertTrue($this->helper->isValid('i4', 916));\n $this->assertTrue($this->helper->isValid('i5', -83));\n $this->assertTrue($this->helper->isValid('i6', -99));\n $this->assertTrue($this->helper->isValid('f1', 12.53));\n $this->assertTrue($this->helper->isValid('f2', 1.5e5));\n $this->assertTrue($this->helper->isValid('f3', -22.79));\n $this->assertTrue($this->helper->isValid('b', true));\n $this->assertTrue($this->helper->isValid('b', false));\n $this->assertTrue($this->helper->isValid('a', [1, 2, 3]));\n $this->assertTrue($this->helper->isValid('m', true));\n $this->assertTrue($this->helper->isValid('m', 'false'));\n $this->assertTrue($this->helper->isValid('r', 'memberType'));\n }", "abstract function validator();", "public function validate()\n\t{\n\t\t$errors = array();\n\t\t\n\t\t//make sure user is logged in\n\t\tif (empty($this->userid)) \n\t\t{\n\t\t\t$errors['userid'] = true;\n\t\t}\n\t\t\n\t\t//verify all info is provided\n\t\tif (isset($this->title))\n\t\t\t$this->title = strip_tags($this->title);\n\t\telse\n\t\t\t$errors['title'] = true;\n\t\t\t\n\t\tif (isset($this->description))\n\t\t\t$this->description = strip_tags($this->description);\n\t\telse\n\t\t\t$errors['description'] = true;\n\t\t\t\n\t\tif (isset($this->content))\n\t\t\t$this->content = strip_tags($this->content, \"<br><b>\");\n\t\telse\n\t\t\t$errors['content'] = true;\n\t\t\t\n\t\tif (isset($this->location))\n\t\t\t$this->location = strip_tags($this->location);\n\t\telse\n\t\t\t$errors['location'] = true;\n\t\t\n\t\tif (!isset($this->category))\n\t\t\t$errors['category'] = true;\n\t\t\t\n\t\tif (!isset($this->enddatetime))\n\t\t\t$errors['enddatetime'] = true;\n\t\t\n\t\t\n\t\t//If we made it here, all is valid\n\t\tif (count($errors) > 0)\n\t\t\treturn $errors;\n\t\telse\n\t\t\treturn NULL;\n\t}", "protected function performValidation()\n {\n // no required arguments\n }", "public function validate_fields() {\n \n\t\t//...\n \n }", "public function validate($data, $param);", "public function validateContactRequest(array $params);", "function validate_all($required,$data){\n\n\t$result = array();\n\t$result['code'] = 1;\n\t$result['error'] = \"All OK!\";\n\n\tif(count(array_intersect_key($required, $data)) != count($required)){\n\t\t$result['code'] = 0;\n\t\t$result['error'] = \"Fields Mismatch!\";\n\t\treturn $result;\n\t}\n\n\t$field_count \t= count($required);\n\n\tforeach ($required as $field => $rules) {\n\t\t$value = $data[$field];\n\n\t\t$code = 0;\n\t\t$error = \"\";\n\n\t\tswitch ($rules['type']) {\n\t\t\tcase 'numeric':\n\t\t\t\tif($rules['required'] && empty($value)){\n\t\t\t\t\t$error = $field.\" is empty.\";\t\n\t\t\t\t}else if(!is_numeric($value)){\n\t\t\t\t\t$error = $field.\" is not numeric.\";\n\t\t\t\t}else if(isset($rules['min'])){\n\t\t\t\t\tif($value < $rules['min']){\n\t\t\t\t\t\t$error = $field.\" min error.\";\n\t\t\t\t\t}else{\n\t\t\t\t\t\t$code = 1;\n\t\t\t\t\t\t$error = \"All OK!\";\n\t\t\t\t\t}\n\t\t\t\t}else if(isset($rules['max'])){\n\t\t\t\t\tif($value > $rules['max']){\n\t\t\t\t\t\t$error = $field.\" max error.\";\n\t\t\t\t\t}else{\n\t\t\t\t\t\t$code = 1;\n\t\t\t\t\t\t$error = \"All OK!\";\n\t\t\t\t\t}\n\t\t\t\t}else{\n\t\t\t\t\t$code = 1;\n\t\t\t\t\t$error = \"All OK!\";\n\t\t\t\t}\t\t\t\t\t\t\n\t\t\t\tbreak;\n\t\t\tcase 'alpha':\n\t\t\t\tif($rules['required'] && empty($value)){\n\t\t\t\t\t$error = $field.\" is empty.\";\t\n\t\t\t\t}else{\n\t\t\t\t\t$code = 1;\n\t\t\t\t\t$error = \"All OK!\";\n\t\t\t\t}\t\t\t\t\t\t\n\t\t\t\tbreak;\n\t\t\tcase 'email':\n\t\t\t\tif($rules['required'] && empty($value)){\n\t\t\t\t\t$error = $field.\" is empty.\";\t\n\t\t\t\t}else if(!preg_match($rules['pattern'], $value)){\n\t\t\t\t\t$error = $field.\" is invalid.\";\n\t\t\t\t}else{\n\t\t\t\t\t$code = 1;\n\t\t\t\t\t$error = \"All OK!\";\n\t\t\t\t}\t\t\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\t# code...\n\t\t\t\tbreak;\n\t\t}\n\n\n\t\t$result['fields'][$field] = array('code' => $code, 'error' => $error, 'value'=>$value, 'field'=>$field );\n\t}\n\n\tforeach ($result['fields'] as $row) {\n\t\tif($row[\"code\"] == 0){\n\t\t\t$result['code'] = 0;\n\t\t\t$result['error'] = \"Invalid Fields!\";\n\t\t\tbreak;\n\t\t}\t\t\n\t}\n\n\treturn $result;\n\n}", "public function validate(array $data = array())\n{ \n\n // Additional validation checks\n\n}", "abstract public function isValid();", "abstract public function isValid();", "public function validation()\n {\n $this->assertFalse($this->denyValidator->validate(123));\n $this->assertFalse($this->denyValidator->validate('1234'));\n $this->assertFalse($this->denyValidator->validate(true));\n $this->assertFalse($this->denyValidator->validate(null));\n $this->assertFalse($this->denyValidator->validate(new stdClass()));\n }", "public function validate(array $data);", "public function validate(array $data);", "protected function checkValidity(array $params)\n\t{\n $this->count($params, 1);\n $this->isDirect($params[0], 0);\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 validate($name,$value,$minlen,$maxlen,$datatype=\"\",$min_val=\"\",$max_val=\"\",$regexp=\"\") {\t//SAT0112:To prevent entering values which is not less than min_val and not greater than max val\n\n\t$resp=true;\n\n\t//echo \"Validating: name=\".$name.\" val=\".$value.\" min=\".$minlen.\" maxlen=\".$maxlen.\" type=\".$datatype.\" regexp=\".$regexp.\"<br>\";\n\n\t// If the value is empty and the field is not mandatory, then return\n\tif ( (!isset($minlen) || $minlen == 0) && $value == \"\" ) {\n\t\treturn true;\n\t}\n\n\t// Empty Check\n\t// Changed to === to ensure 0 does not fail \n\tif ( isset($minlen) && $minlen > 0 && $value === \"\" ) {\n\t\tadd_msg(\"ERROR\",$name.\" cannot be empty. \"); \n\t\treturn false;\n\t}\n\n\t//echo \"count($value)=[\".preg_match(\"/^[0-9]+$/\",\"12344a4\").\"]<br>\";\n\t// MIN LEN check\n\tif ( isset($minlen) && strlen($value) < $minlen ) {\n\t\tadd_msg(\"ERROR\",$name.\" should be atleast \".$minlen.\" characters long. \"); \n\t\treturn false;\n\t}\n\n\t// MAX LEN check\n\tif ( $datatype == 'enum' ) { \n\t\t$enum_str=$maxlen;\n\t\tunset($maxlen);\n\t}\n\n\tif ( isset($maxlen) && strlen($value) > $maxlen ) {\n\t\tadd_msg(\"ERROR\",$name.\" cannot be longer than \".$maxlen.\" characters. \"); \n\t\treturn false;\n\t}\n\n\t// CUSTOM REGEXP check\n\tif ( isset($regexp) && !preg_match(\"/$regexp/\",$value) ) {\n\t\tadd_msg(\"ERROR\",$name.\" is not valid. \"); \n\t\treturn false;\n\t}\n\n\t// MIN value check\n\tif( ($min_val !== '' && $value < $min_val) ) {\n\t\tadd_msg(\"ERROR\",$name.\" cannot be less than \".$min_val.\". \"); \n\t\treturn false;\n\t}\n\n\t// MAX value check\n\tif( ($max_val !== '' && $value > $max_val) ) {\n\t\tadd_msg(\"ERROR\",$name.\" cannot be greater than \".$max_val.\". \"); \n\t\treturn false;\n\t}\n\t// STANDARD DATATYPES check\n\tif ( isset($datatype) ) {\n\t\tswitch ($datatype) {\n\t\t\tcase \"int\":\n\t\t\t\tif ( filter_var($value, FILTER_VALIDATE_INT) === false ) {\n\t\t\t\t\tadd_msg(\"ERROR\",$name.\" should contain only digits. \"); \n\t\t\t\t\treturn false;\n\t\t\t\t} \n\t\t\t\tbreak;\n\t\t\tcase \"decimal\":\n\t\t\t\tif ( filter_var($value, FILTER_VALIDATE_FLOAT) === false ) {\n\t\t\t\t\tadd_msg(\"ERROR\",$name.\" should contain only digits. \"); \n\t\t\t\t\treturn false;\n\t\t\t\t} \n\t\t\t\tbreak;\n\t\t\tcase \"PASSWORD\":\n\t\t\tcase \"char\": // anything\n\t\t\tcase \"varchar\": // anything\n\t\t\tcase \"text\": // anything\n\t\t\t\treturn true;\n\t\t\t\tbreak;\n\t\t\tcase \"bigint\":\n\t\t\tcase \"tinyint\":\n\t\t\t\tif (!preg_match(\"/^[0-9]+$/\",$value)) {\n\t\t\t\t\tadd_msg(\"ERROR\",$name.\" should contain only digits. \"); \n\t\t\t\t\treturn false;\n\t\t\t\t} \n\t\t\t\tbreak;\n\t\t\tcase \"date\":\n\t\t\t\t$arr=preg_split(\"/-/\",$value); // splitting the array\n\t\t\t\t$yy=get_arg($arr,0); // first element of the array is month\n\t\t\t\t$mm=get_arg($arr,1); // second element is date\n\t\t\t\t$dd=get_arg($arr,2); // third element is year\n\t\t\t\tif( $dd == \"\" || $mm == \"\" || $yy == \"\" || !checkdate($mm,$dd,$yy) ){\n\t\t\t\t\tadd_msg(\"ERROR\",$name.\" is not a valid date, should be of the format YYYY-MM-DD \"); \n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t/*case \"PASSWORD\":\n\t\t\t\tif (!preg_match(\"/^[a-zA-Z\\-_0-9]+$/\",$value)) {\n\t\t\t\t\tadd_msg(\"ERROR\",$name.\" can contain only alphabets,numbers,'-' and '_'. <br/>\"); \n\t\t\t\t\treturn false;\n\t\t\t\t} \n\t\t\t\tbreak;\t\t\n\t\t\t*/\n\t\t\tcase \"SIMPLE_STRING\": // can only have alphabets, spaces, dots, -'s or +\n\t\t\t\tif (!preg_match(\"/^[a-zA-Z0-9\\.\\s\\-\\+]+$/\",$value)) {\n\t\t\t\t\tadd_msg(\"ERROR\",$name.\" should contain only alphabets, numbers, spaces '.', '-' or '+'. \"); \n\t\t\t\t\treturn false;\n\t\t\t\t} \n\t\t\t\tbreak;\n\t\t\tcase \"EMAIL\":\n\t\t\t\tif ( filter_var($value, FILTER_VALIDATE_EMAIL) == false ) {\n\t\t\t\t\tadd_msg(\"ERROR\",$name.\" is not valid, should be of the format [email protected]. \"); \n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase \"MOBILE\":\n\t\t\t\tif (!preg_match(\"/^[0-9]+$/\",$value)) {\n\t\t\t\t\tadd_msg(\"ERROR\",$name.\" is not valid, should be of the format 919123456789 \"); \n\t\t\t\t\treturn false;\n\t\t\t\t} \n\t\t\t\tbreak;\n\t\t\tcase 'FILENAME':\n\t\t\t\tif ($value != basename($value) || !preg_match(\"/^[a-zA-Z0-9_\\.-]+$/\",$value) || !preg_match('/^(?:[a-z0-9_-]|\\.(?!\\.))+$/iD', $value)) {\n\t\t\t\t\tadd_msg('ERROR', \"Invalid $name. \");\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'enum':\n\t\t\t\t$enum_arr=explode(',',$enum_str);\n\t\t\t\tif ( in_array($value, $enum_arr) ) {\n\t\t\t\t\tadd_msg('ERROR', \"Invalid $name.\");\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tadd_msg(\"ERROR\",$name.\" is not valid. Please re enter.\"); \n\t\t\t\treturn false;\n\t\t}\n\t}\n\n\treturn true;\n}", "function _verify_user_values(&$values)\r\n\t{\r\n\t\tif ($this->_dumb_mode)\r\n\t\t{\r\n\t\t\treturn true;\r\n\t\t} \r\n\t\tforeach($values as $field => $value)\r\n\t\t{\r\n\t\t\tif (!isset($this->_params[$field]))\r\n\t\t\t{\n\t \tdebug :: write_error(NESE_ERROR_WRONG_MPARAM,\r\n\t \t\t __FILE__ . ' : ' . __LINE__ . ' : ' . __FUNCTION__, \n\t \t\t array('param' => $field)\r\n\t \t);\r\n\t\t\t\tunset($values[$field]);\r\n\t\t\t} \r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tif (in_array($this->_params[$field], $this->_required_params))\r\n\t\t\t\t{\n\t\t \tdebug :: write_error(NESE_ERROR_WRONG_MPARAM,\r\n\t\t \t\t __FILE__ . ' : ' . __LINE__ . ' : ' . __FUNCTION__, \n\t \t\t array('param is autogenerated and can\\'t be passed' => $field)\r\n\t\t \t);\r\n\r\n\t\t\t\t\tunset($values[$field]);\r\n\t\t\t\t} \r\n\t\t\t} \r\n\t\t} \r\n\t}", "public function validateRules();", "protected function validateParams() {\r\n $ads = $this->ads;\r\n $adsId = $this->adsId;\r\n $lang = $this->getLanguage();\r\n if ($ads === NULL) {\r\n // the ads must exist\r\n $this->addErrorMessage($lang->getMessage('error.adsNotFound', htmlspecialchars($adsId)));\r\n return FALSE;\r\n }\r\n return TRUE;\r\n }", "public function validated();", "function validateInput() {\n $validationSuccessful = true;\n $errorMessage = \"\";\n\n\n //Validate title\n if (!preg_match(\"/^.{1,250}$/\", $_POST['title'])) {\n $validationSuccessful = false;\n $errorMessage .= \"Title is invalid.\". $_POST['title'];\n }\n\n //Validate date\n if (!preg_match(\"/^(\\d{4})-(\\d{2})-(\\d{2}) (\\d{2}):(\\d{2}):(\\d{2})$/\", $_POST['date'])) {\n $validationSuccessful = false;\n $errorMessage .= \"Date is invalid.\" . $_POST['date'];\n }\n\n //Validate location\n if (!preg_match(\"/^.{1,250}$/\", $_POST['location'])) {\n $validationSuccessful = false;\n $errorMessage .= \"Max_players is invalid.\" . $_POST['location'];\n }\n\n if($validationSuccessful == true) {\n return true;\n } else {\n echo $errorMessage;\n return false;\n }\n }", "abstract protected function validate(): bool;", "private function checkParams($params){\n\n if(count($params) == 3)\n return true;\n else\n return false;\n }", "private function validateParameters(array $arrData)\n\t{\n\t\tforeach ($arrData as $key => $value)\n\t\t{\n\t\t\tif ($this->Input->post($key) != $value)\n\t\t\t{\n\t\t\t\t$this->log('Wrong data for parameter \"' . $key . '\" (Order ID \"' . $this->Input->post('refno') . ').', __METHOD__, TL_ERROR);\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn true;\n\t}", "public function valid() {}", "public function valid() {}", "public function valid() {}", "public function valid() {}", "public function valid() {}", "public function valid() {}", "public function valid() {}", "public function valid() {}", "function validateData($array){\n\t\t$errorFlag=true;\n\t\t$currentDate = getdate(); //get current date\n\t\tif (trim($array['FName'])==''){\n\t\t\t$this->appendErrorMsg(\"First Name is required\");\n\t\t\t$errorFlag = false;\n\t\t}\n\t\tif (trim($array['LName'])==''){\n\t\t\t$this->appendErrorMsg(\"Last Name is required\");\n\t\t\t$errorFlag = false;\n\t\t}\n\t\tif (trim($array['License_No'])==''){\n\t\t\t$this->appendErrorMsg(\"License number is required\");\n\t\t\t$errorFlag = false;\n\t\t}\n\t\tif (trim($array['Birthdate'])==''){\n\t\t\t$this->appendErrorMsg(\"Birthdate cannot be blank\");\n\t\t\t$errorFlag = false;\n\t\t} else if (!preg_match(\"/^[0-9]{4,4}[-][0-1]{1,2}?[0-9]{1,2}[-][0-3]{1,2}?[0-9]{1,2}$/\", $array['Birthdate'])){\n\t\t\t$this->appendErrorMsg(\"Date should be in the format yyyy-mm-dd\");\n\t\t\t$errorFlag = false;\n\t\t} else if (getAge($array['Birthdate'])<16 || getAge($array['Birthdate'])> 100){\n\t\t\t$this->appendErrorMsg(\"Sorry, we do not provide coverage to drivers under the age of 16 or over the age of 100\");\n\t\t\t$errorFlag = false;\n\t\t}\n\t\tif (trim($array['PostalCode'])==''){\n\t\t\t$this->appendErrorMsg(\"Postal Code is required\");\n\t\t\t$errorFlag = false;\n\t\t} else if (!preg_match(\"/^[A-Za-z]{1}\\d{1}[A-Za-z]{1}\\d{1}[A-Za-z]{1}\\d{1}$/\",$array['PostalCode'])){\n\t\t\t$this->appendErrorMsg(\"Postal Code should be in the format A1B2C3\");\n\t\t\t$errorFlag = false;\n\t\t}\n\t\tif (trim($array['Phone'])==''){\n\t\t\t$this->appendErrorMsg(\"Phone number is required\");\n\t\t\t$errorFlag = false;\n\t\t} else if (!preg_match(\"/^[0-9]{10}$/\",$array['Phone'])){\n\t\t\t$this->appendErrorMsg(\"Phone number must be in the format xxx-xxx-xxxx or xxxxxxxxx\");\n\t\t\t$errorFlag = false;\n\t\t}\n\t\tif (!preg_match(\"/^[0-9]{1,}$/\", $array['Years_Exp'])){\n\t\t\t$this->appendErrorMsg(\"Please input the number of Years of Experience\");\n\t\t\t$errorFlag = false;\n\t\t}\n\t\treturn $errorFlag;\n\t}", "private function verify_parameters(){\n if( empty( $_GET['email'] ) || empty( $_GET['pms_key'] ) || empty( $_GET['subscription_id'] ) )\n return false;\n\n return true;\n }", "abstract protected function validateFilterArguments($filters);", "function validateEdu() {\n for($i=1; $i<=9; $i++) {\n if ( ! isset($_POST['edu_year'.$i]) ) continue;\n\t\t\tif ( ! isset($_POST['edu_school'.$i]) ) continue;\n\n $year = $_POST['edu_year'.$i];\n $school = $_POST['edu_school'.$i];\n\n if ( strlen($year) == 0 || strlen($school) == 0 ) {\n return \"All fields are required\";\n }\n\n if ( ! is_numeric($year) ) {\n return \"Education year must be numeric\";\n }\n }\n return true;\n}", "function validate()\n{\n $check = true;\n\n $v_id_vehicle = $_POST['id_vehicle'];\n $v_marca = $_POST['marca'];\n $v_modelo = $_POST['modelo'];\n $v_HP = $_POST['HP'];\n $v_Km = $_POST['Km'];\n $v_Anyo_produccion = $_POST['Anyo_produccion'];\n $v_color = $_POST['color'];\n $v_precio = $_POST['precio'];\n\n\n $r_id_vehicle = validate_id_vehicle($v_id_vehicle);\n $r_marca = validate_marca($v_marca);\n $r_modelo = validate_modelo($v_modelo);\n $r_HP = validate_HP($v_HP);\n $r_Km = validate_Km($v_Km);\n $r_Anyo_produccion = validate_Anyo_produccion($v_Anyo_produccion);\n $r_color = validate_color($v_color);\n $r_precio = validate_precio($v_precio);\n\n if ($r_id_vehicle !== 1) {\n $error_id_vehicle = \" * El id_vehicle introducido no es valido\";\n $check = false;\n } else {\n $error_id_vehicle = \"\";\n }\n if ($r_marca !== 1) {\n $error_marca = \" * La marca introducida no es valida\";\n $check = false;\n } else {\n $error_marca = \"\";\n }\n if ($r_modelo !== 1) {\n $error_modelo = \" * El modelo introducido no es valido\";\n $check = false;\n } else {\n $error_modelo = \"\";\n }\n if ($r_HP !== 1) {\n $error_HP = \" * El HP introducido no es valido\";\n $check = false;\n } else {\n $error_HP = \"\";\n }\n if (!$r_Km) {\n $error_Km = \" * No has indicado kilometraje\";\n $check = false;\n } else {\n $error_Km = \"\";\n }\n if (!$r_Anyo_produccion) {\n $error_Anyo_produccion = \" * No has introducido ninguna Anyo_produccion\";\n $check = false;\n } else {\n $error_Anyo_produccion = \"\";\n }\n\n if (!$r_color) {\n $error_color = \" * No has seleccionado ningun color\";\n $check = false;\n } else {\n $error_color = \"\";\n }\n if (!$r_precio) {\n $error_precio = \" * El texto introducido no es valido\";\n $check = false;\n } else {\n $error_precio = \"\";\n }\n\n return $check;\n}" ]
[ "0.79774487", "0.77268493", "0.77086437", "0.75449413", "0.75449413", "0.75300187", "0.733063", "0.730267", "0.7245382", "0.7242496", "0.72124666", "0.7168374", "0.7168374", "0.7168374", "0.7168374", "0.7168374", "0.7168374", "0.7168374", "0.7168374", "0.7168374", "0.7168374", "0.7168374", "0.7168374", "0.7164268", "0.71558607", "0.71444434", "0.7076451", "0.70349395", "0.70088005", "0.69795066", "0.6962967", "0.6940448", "0.69278985", "0.6925979", "0.6895181", "0.6891718", "0.6870224", "0.6858228", "0.68570876", "0.6834263", "0.6824932", "0.6822942", "0.6820375", "0.68124956", "0.67667997", "0.67640376", "0.67627966", "0.672121", "0.6718445", "0.6703251", "0.6699406", "0.6698249", "0.6698249", "0.6698249", "0.6698249", "0.6693113", "0.66909635", "0.6689318", "0.6688876", "0.6688812", "0.66875184", "0.6649514", "0.6644794", "0.6644156", "0.66365284", "0.66354895", "0.6632885", "0.6626199", "0.66190827", "0.6615926", "0.6615621", "0.66126025", "0.66126025", "0.65968895", "0.6594149", "0.6594149", "0.6588046", "0.65874135", "0.65764785", "0.65642077", "0.65641433", "0.656088", "0.6560017", "0.6545053", "0.6510469", "0.64996195", "0.6486031", "0.64762616", "0.64762616", "0.64762616", "0.64762616", "0.64762616", "0.64762616", "0.64762616", "0.64762616", "0.64709485", "0.64679015", "0.64659345", "0.6459526", "0.64589816" ]
0.67494035
47
Run the database seeds.
public function run() { \App\Models\MovieTrailer::create([ 'id' => 1000, 'movie_id' => 1000, 'src' => 'https://www.youtube.com/embed/2TAOizOnNPo' ]); \App\Models\MovieTrailer::create([ 'id' => 1001, 'movie_id' => 1001, 'src' => 'https://www.youtube.com/embed/ZZGkV_xWGw4' ]); \App\Models\MovieTrailer::create([ 'id' => 1002, 'movie_id' => 1002, 'src' => 'https://www.youtube.com/embed/_o3DMT3sGJ4' ]); \App\Models\MovieTrailer::create([ 'id' => 1003, 'movie_id' => 1003, 'src' => 'https://www.youtube.com/embed/YXZjANEY6bA' ]); \App\Models\MovieTrailer::create([ 'id' => 1004, 'movie_id' => 1004, 'src' => 'https://www.youtube.com/embed/Zd0mg6YkKVA' ]); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function run()\n {\n // $this->call(UserTableSeeder::class);\n // $this->call(PostTableSeeder::class);\n // $this->call(TagTableSeeder::class);\n // $this->call(PostTagTableSeeder::class);\n\n /*AB - use faker to populate table see file ModelFactory.php */\n factory(App\\Editeur::class, 40) ->create();\n factory(App\\Auteur::class, 40) ->create();\n factory(App\\Livre::class, 80) ->create();\n\n for ($i = 1; $i < 41; $i++) {\n $number = rand(2, 8);\n for ($j = 1; $j <= $number; $j++) {\n DB::table('auteur_livre')->insert([\n 'livre_id' => rand(1, 40),\n 'auteur_id' => $i\n ]);\n }\n }\n }", "public function run()\n {\n DB::statement('SET FOREIGN_KEY_CHECKS=0;');\n // Let's truncate our existing records to start from scratch.\n Assignation::truncate();\n\n $faker = \\Faker\\Factory::create();\n \n // And now, let's create a few articles in our database:\n for ($i = 0; $i < 40; $i++) {\n Assignation::create([\n 'ad_id' => $faker->numberBetween(1,20),\n 'buyer_id' => $faker->numberBetween(1,6),\n 'seller_id' => $faker->numberBetween(6,11),\n 'state' => NULL,\n ]);\n }\n\n DB::statement('SET FOREIGN_KEY_CHECKS=1;');\n }", "public function run()\n {\n \t$faker = Faker::create();\n\n \tfor($i=0; $i<20; $i++) {\n \t\t$post = new Post;\n \t\t$post->title = $faker->sentence();\n \t\t$post->body = $faker->paragraph();\n \t\t$post->category_id = rand(1, 5);\n \t\t$post->save();\n \t}\n\n \t$list = ['General', 'Technology', 'News', 'Internet', 'Mobile'];\n \tforeach($list as $name) {\n \t\t$category = new Category;\n \t\t$category->name = $name;\n \t\t$category->save();\n \t}\n\n \tfor($i=0; $i<20; $i++) {\n \t\t$comment = new Comment;\n \t\t$comment->comment = $faker->paragraph();\n \t\t$comment->post_id = rand(1,20);\n \t\t$comment->save();\n \t}\n // $this->call(UsersTableSeeder::class);\n }", "public function run()\n {\n $this->call(RoleTableSeeder::class);\n $this->call(UserTableSeeder::class);\n \n factory('App\\Cat', 5)->create();\n $tags = factory('App\\Tag', 8)->create();\n\n factory(Post::class, 15)->create()->each(function($post) use ($tags){\n $post->comments()->save(factory(Comment::class)->make());\n $post->tags()->attach( $tags->random(mt_rand(1,4))->pluck('id')->toArray() );\n });\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n DB::table('post')->insert(\n [\n 'title' => 'Test Post1',\n 'desc' => str_random(100).\" post1\",\n 'alias' => 'test1',\n 'keywords' => 'test1',\n ]\n );\n DB::table('post')->insert(\n [\n 'title' => 'Test Post2',\n 'desc' => str_random(100).\" post2\",\n 'alias' => 'test2',\n 'keywords' => 'test2',\n ]\n );\n DB::table('post')->insert(\n [\n 'title' => 'Test Post3',\n 'desc' => str_random(100).\" post3\",\n 'alias' => 'test3',\n 'keywords' => 'test3',\n ]\n );\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n\n \t$faker = Factory::create();\n \t\n \tforeach ($this->departments as $key => $department) {\n \t\tDepartment::create([\n \t\t\t'name' => $department\n \t\t]);\n \t}\n \tforeach ($this->collections as $key => $collection) {\n \t\tCollection::create([\n \t\t\t'name' => $collection\n \t\t]);\n \t}\n \t\n \t\n \tfor ($i=0; $i < 40; $i++) {\n \t\tUser::create([\n \t\t\t'name' \t=>\t$faker->name,\n \t\t\t'email' \t=>\t$faker->email,\n \t\t\t'password' \t=>\tbcrypt('123456'),\n \t\t]);\n \t} \n \t\n \t\n \tforeach ($this->departments as $key => $department) {\n \t\t//echo ($key + 1) . PHP_EOL;\n \t\t\n \t\tfor ($i=0; $i < 10; $i++) { \n \t\t\techo $faker->name . PHP_EOL;\n\n \t\t\tArt::create([\n \t\t\t\t'name'\t\t\t=> $faker->sentence(2),\n \t\t\t\t'img'\t\t\t=> $this->filenames[$i],\n \t\t\t\t'medium'\t\t=> 'canvas',\n \t\t\t\t'department_id'\t=> $key + 1,\n \t\t\t\t'user_id'\t\t=> $this->userIndex,\n \t\t\t\t'dimension'\t\t=> '18.0 x 24.0',\n\t\t\t\t]);\n \t\t\t\t\n \t\t\t\t$this->userIndex ++;\n \t\t}\n \t}\n \t\n \tdd(\"END\");\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n // $this->dataCategory();\n factory(App\\Model\\Category::class, 70)->create();\n factory(App\\Model\\Producer::class, rand(5,10))->create();\n factory(App\\Model\\Provider::class, rand(5,10))->create();\n factory(App\\Model\\Product::class, 100)->create();\n factory(App\\Model\\Album::class, 300)->create();\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n\n\n factory('App\\User', 10 )->create();\n\n $users= \\App\\User::all();\n $users->each(function($user){ factory('App\\Category', 1)->create(['user_id'=>$user->id]); });\n $users->each(function($user){ factory('App\\Tag', 3)->create(['user_id'=>$user->id]); });\n\n\n $users->each(function($user){\n factory('App\\Post', 10)->create([\n 'user_id'=>$user->id,\n 'category_id'=>rand(1,20)\n ]\n );\n });\n\n $posts= \\App\\Post::all();\n $posts->each(function ($post){\n\n $post->tags()->attach(array_unique([rand(1,20),rand(1,20),rand(1,20)]));\n });\n\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n $types = factory(\\App\\Models\\Type::class, 5)->create();\n\n $cities = factory(\\App\\Models\\City::class, 10)->create();\n\n $cities->each(function ($city) {\n $districts = factory(\\App\\Models\\District::class, rand(2, 5))->create([\n 'city_id' => $city->id,\n ]);\n\n $districts->each(function ($district) {\n $properties = factory(\\App\\Models\\Property::class, rand(2, 5))->create([\n 'type_id' => rand(1, 5),\n 'district_id' => $district->id\n ]);\n\n $properties->each(function ($property) {\n $galleries = factory(\\App\\Models\\Gallery::class, rand(3, 10))->create([\n 'property_id' => $property->id\n ]);\n });\n });\n });\n }", "public function run()\n {\n $this->call(UsersTableSeeder::class);\n\n $categories = factory(App\\Models\\Category::class, 10)->create();\n\n $categories->each(function ($category) {\n $category\n ->posts()\n ->saveMany(\n factory(App\\Models\\Post::class, 3)->make()\n );\n });\n }", "public function run()\n {\n $this->call(CategoriesTableSeeder::class);\n\n $users = factory(App\\User::class, 5)->create();\n $recipes = factory(App\\Recipe::class, 30)->create();\n $preparations = factory(App\\Preparation::class, 70)->create();\n $photos = factory(App\\Photo::class, 90)->create();\n $comments = factory(App\\Comment::class, 200)->create();\n $flavours = factory(App\\Flavour::class, 25)->create();\n $flavour_recipe = factory(App\\FlavourRecipe::class, 50)->create();\n $tags = factory(App\\Tag::class, 25)->create();\n $recipe_tag = factory(App\\RecipeTag::class, 50)->create();\n $ingredients = factory(App\\Ingredient::class, 25)->create();\n $ingredient_preparation = factory(App\\IngredientPreparation::class, 300)->create();\n \n \n \n DB::table('users')->insert(['name' => 'SimpleUtilisateur', 'email' => '[email protected]', 'password' => bcrypt('SimpleMotDePasse')]);\n \n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n DB::statement('SET FOREIGN_KEY_CHECKS = 0');\n\n // Sample::truncate();\n // TestItem::truncate();\n // UOM::truncate();\n Role::truncate();\n User::truncate();\n\n // factory(Role::class, 4)->create();\n Role::create([\n 'name'=> 'Director',\n 'description'=> 'Director type'\n ]);\n\n Role::create([\n 'name'=> 'Admin',\n 'description'=> 'Admin type'\n ]);\n Role::create([\n 'name'=> 'Employee',\n 'description'=> 'Employee type'\n ]);\n Role::create([\n 'name'=> 'Technician',\n 'description'=> 'Technician type'\n ]);\n \n factory(User::class, 20)->create()->each(\n function ($user){\n $roles = \\App\\Role::all()->random(mt_rand(1, 2))->pluck('id');\n $user->roles()->attach($roles);\n }\n );\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n UsersLevel::create([\n 'name' => 'Administrator'\n ]);\n\n UsersLevel::create([\n 'name' => 'User'\n ]);\n\n User::create([\n 'username' => 'admin',\n 'password' => bcrypt('admin123'),\n 'level_id' => 1,\n 'fullname' => \"Super Admin\",\n 'email'=> \"[email protected]\"\n ]);\n\n\n \\App\\CategoryPosts::create([\n 'name' =>'Paket Trip'\n ]);\n\n \\App\\CategoryPosts::create([\n 'name' =>'Destinasi Kuliner'\n ]);\n\n \\App\\CategoryPosts::create([\n 'name' => 'Event'\n ]);\n\n \\App\\CategoryPosts::create([\n 'name' => 'Profil'\n ]);\n }", "public function run()\n {\n DB::table('users')->insert([\n 'name' => 'Admin',\n 'email' => '[email protected]',\n 'avatar' => \"avatar\",\n 'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi',\n ]);\n $this->call(CategorySeeder::class);\n // \\App\\Models\\Admin::factory(1)->create();\n \\App\\Models\\User::factory(10)->create();\n // \\App\\Models\\Category::factory(50)->create();\n \\App\\Models\\PetComment::factory(50)->create();\n $pets = \\App\\Models\\Pet::factory(50)->create();\n foreach ($pets as $pet) {\n \\App\\Models\\PetTag::factory(1)->create(['pet_id' => $pet->id]);\n \\App\\Models\\PetPhotoUrl::factory(1)->create(['pet_id' => $pet->id]);\n \\App\\Models\\Order::factory(1)->create(['pet_id' => $pet->id]);\n };\n }", "public function run()\n { \n\n $this->call(RoleSeeder::class);\n \n $this->call(UserSeeder::class);\n\n Storage::deleteDirectory('socials-icon');\n Storage::makeDirectory('socials-icon');\n $socials = Social::factory(7)->create();\n\n Storage::deleteDirectory('countries-flag');\n Storage::deleteDirectory('countries-firm');\n Storage::makeDirectory('countries-flag');\n Storage::makeDirectory('countries-firm');\n $countries = Country::factory(18)->create();\n\n // Se llenan datos de la tabla muchos a muchos - social_country\n foreach ($countries as $country) {\n foreach ($socials as $social) {\n\n $country->socials()->attach($social->id, [\n 'link' => 'https://www.facebook.com/ministeriopalabrayespiritu/'\n ]);\n }\n }\n\n Person::factory(50)->create();\n\n Category::factory(7)->create();\n\n Video::factory(25)->create(); \n\n $this->call(PostSeeder::class);\n\n Storage::deleteDirectory('documents');\n Storage::makeDirectory('documents');\n Document::factory(25)->create();\n\n }", "public function run()\n {\n $faker = Faker::create('id_ID');\n /**\n * Generate fake author data\n */\n for ($i=1; $i<=50; $i++) { \n DB::table('author')->insert([\n 'name' => $faker->name\n ]);\n }\n /**\n * Generate fake publisher data\n */\n for ($i=1; $i<=50; $i++) { \n DB::table('publisher')->insert([\n 'name' => $faker->name\n ]);\n }\n /**\n * Seeding payment method\n */\n DB::table('payment')->insert([\n ['name' => 'Mandiri'],\n ['name' => 'BCA'],\n ['name' => 'BRI'],\n ['name' => 'BNI'],\n ['name' => 'Pos Indonesia'],\n ['name' => 'BTN'],\n ['name' => 'Indomaret'],\n ['name' => 'Alfamart'],\n ['name' => 'OVO'],\n ['name' => 'Cash On Delivery']\n ]);\n }", "public function run()\n {\n DatabaseSeeder::seedLearningStylesProbs();\n DatabaseSeeder::seedCampusProbs();\n DatabaseSeeder::seedGenderProbs();\n DatabaseSeeder::seedTypeStudentProbs();\n DatabaseSeeder::seedTypeProfessorProbs();\n DatabaseSeeder::seedNetworkProbs();\n }", "public function run()\n {\n // Let's truncate our existing records to start from scratch.\n // MyList::truncate();\n\n $faker = \\Faker\\Factory::create();\n\n // And now, let's create a few articles in our database:\n for ($i = 0; $i < 3; $i++) {\n MyList::create([\n 'title' => 'List-'.($i+1),\n 'color' => $faker->sentence,\n 'icon' => $faker->randomDigitNotNull,\n 'index' => $faker->randomDigitNotNull,\n 'user_id' => 1,\n ]);\n }\n }", "public function run()\n {\n // Let's truncate our existing records to start from scratch.\n Products::truncate();\n\n $faker = \\Faker\\Factory::create();\n\n // And now, let's create a few products in our database:\n for ($i = 0; $i < 50; $i++) {\n Products::create([\n 'name' => $faker->word,\n 'sku' => $faker->randomNumber(7, false),\n ]);\n }\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n User::create([\n 'name' => 'Pablo Rosales',\n 'email' => '[email protected]',\n 'password' => bcrypt('admin'),\n 'status' => 1,\n 'role_id' => 1,\n 'movil' => 0\n ]);\n\n User::create([\n 'name' => 'Usuario Movil',\n 'email' => '[email protected]',\n 'password' => bcrypt('secret'),\n 'status' => 1,\n 'role_id' => 3,\n 'movil' => 1\n ]);\n\n Roles::create([\n 'name' => 'Administrador'\n ]);\n Roles::create([\n 'name' => 'Operaciones'\n ]);\n Roles::create([\n 'name' => 'Comercial'\n ]);\n Roles::create([\n 'name' => 'Aseguramiento'\n ]);\n Roles::create([\n 'name' => 'Facturación'\n ]);\n Roles::create([\n 'name' => 'Creditos y Cobros'\n ]);\n\n factory(App\\Customers::class, 100)->create();\n }", "public function run()\n {\n // php artisan db:seed --class=StoreTableSeeder\n\n foreach(range(1,20) as $i){\n $faker = Faker::create();\n Store::create([\n 'name' => $faker->name,\n 'desc' => $faker->text,\n 'tags' => $faker->word,\n 'address' => $faker->address,\n 'longitude' => $faker->longitude($min = -180, $max = 180),\n 'latitude' => $faker->latitude($min = -90, $max = 90),\n 'created_by' => '1'\n ]);\n }\n\n }", "public function run()\n {\n DB::table('users')->insert([\n 'name'=>\"test\",\n 'password' => Hash::make('123'),\n 'email'=>'[email protected]'\n ]);\n DB::table('tags')->insert(['name'=>'tags']);\n $this->call(UserSeed::class);\n $this->call(CategoriesSeed::class);\n $this->call(TopicsSeed::class);\n $this->call(CommentariesSeed::class);\n // $this->call(UsersTableSeeder::class);\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n\n echo 'seeding permission...', PHP_EOL;\n $permissions = [\n 'role-list',\n 'role-create',\n 'role-edit',\n 'role-delete',\n 'formation-list',\n 'formation-create',\n 'formation-edit',\n 'formation-delete',\n 'user-list',\n 'user-create',\n 'user-edit',\n 'user-delete'\n ];\n foreach ($permissions as $permission) {\n Permission::create(['name' => $permission]);\n }\n echo 'seeding users...', PHP_EOL;\n\n $user= User::create(\n [\n 'name' => 'Mr. admin',\n 'email' => '[email protected]',\n 'password' => bcrypt('admin'),\n 'remember_token' => null,\n ]\n );\n echo 'Create Roles...', PHP_EOL;\n Role::create(['name' => 'former']);\n Role::create(['name' => 'learner']);\n Role::create(['name' => 'admin']);\n Role::create(['name' => 'manager']);\n Role::create(['name' => 'user']);\n\n echo 'seeding Role User...', PHP_EOL;\n $user->assignRole('admin');\n $role = $user->assignRole('admin');\n $role->givepermissionTo(Permission::all());\n\n \\DB::table('languages')->insert(['name' => 'English', 'code' => 'en']);\n \\DB::table('languages')->insert(['name' => 'Français', 'code' => 'fr']);\n }", "public function run()\n {\n $this->call(UsersTableSeeder::class);\n $this->call(PermissionsSeeder::class);\n $this->call(RolesSeeder::class);\n $this->call(ThemeSeeder::class);\n\n //\n\n DB::table('paypal_info')->insert([\n 'client_id' => '',\n 'client_secret' => '',\n 'currency' => '',\n ]);\n DB::table('contact_us')->insert([\n 'content' => '',\n ]);\n DB::table('setting')->insert([\n 'site_name' => ' ',\n ]);\n DB::table('terms_and_conditions')->insert(['terms_and_condition' => 'text']);\n }", "public function run()\n {\n $this->call([\n UserSeeder::class,\n ]);\n\n User::factory(20)->create();\n Author::factory(20)->create();\n Book::factory(60)->create();\n }", "public function run()\n {\n // \\App\\Models\\User::factory(10)->create();\n $this->call(UserSeeder::class);\n $this->call(RolePermissionSeeder::class);\n $this->call(AppmodeSeeder::class);\n\n // \\App\\Models\\Appmode::factory(3)->create();\n \\App\\Models\\Doctor::factory(100)->create();\n \\App\\Models\\Unit::factory(50)->create();\n \\App\\Models\\Broker::factory(100)->create();\n \\App\\Models\\Patient::factory(100)->create();\n \\App\\Models\\Expence::factory(100)->create();\n \\App\\Models\\Testcategory::factory(100)->create();\n \\App\\Models\\Test::factory(50)->create();\n \\App\\Models\\Parameter::factory(50)->create();\n \\App\\Models\\Sale::factory(50)->create();\n \\App\\Models\\SaleItem::factory(100)->create();\n \\App\\Models\\Goption::factory(1)->create();\n \\App\\Models\\Pararesult::factory(50)->create();\n\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n // DB::table('roles')->insert(\n // [\n // ['name' => 'admin', 'description' => 'Administrator'],\n // ['name' => 'student', 'description' => 'Student'],\n // ['name' => 'lab_tech', 'description' => 'Lab Tech'],\n // ['name' => 'it_staff', 'description' => 'IT Staff Member'],\n // ['name' => 'it_manager', 'description' => 'IT Manager'],\n // ['name' => 'lab_manager', 'description' => 'Lab Manager'],\n // ]\n // );\n\n // DB::table('users')->insert(\n // [\n // 'username' => 'admin', \n // 'password' => Hash::make('password'), \n // 'active' => 1,\n // 'name' => 'Administrator',\n // 'email' => '[email protected]',\n // 'role_id' => \\App\\Role::where('name', 'admin')->first()->id\n // ]\n // );\n\n DB::table('status')->insert([\n // ['name' => 'Active'],\n // ['name' => 'Cancel'],\n // ['name' => 'Disable'],\n // ['name' => 'Open'],\n // ['name' => 'Closed'],\n // ['name' => 'Resolved'],\n ['name' => 'Used'],\n ]);\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n\n factory(User::class)->create([\n 'name' => 'Qwerty',\n 'email' => '[email protected]',\n 'password' => bcrypt('secretpassw'),\n ]);\n\n factory(User::class, 59)->create([\n 'password' => bcrypt('secretpassw'),\n ]);\n\n for ($i = 1; $i < 11; $i++) {\n factory(Category::class)->create([\n 'name' => 'Category ' . $i,\n ]);\n }\n\n for ($i = 1; $i < 101; $i++) {\n factory(Product::class)->create([\n 'name' => 'Product ' . $i,\n ]);\n }\n }", "public function run()\n {\n\n \t// Making main admin role\n \tDB::table('roles')->insert([\n 'name' => 'Admin',\n ]);\n\n // Making main category\n \tDB::table('categories')->insert([\n 'name' => 'Other',\n ]);\n\n \t// Making main admin account for testing\n \tDB::table('users')->insert([\n 'name' \t\t=> 'Admin',\n 'email' \t=> '[email protected]',\n 'password' => bcrypt('12345'),\n 'role_id' => 1,\n 'created_at' => date('Y-m-d H:i:s' ,time()),\n 'updated_at' => date('Y-m-d H:i:s' ,time())\n ]);\n\n \t// Making random users and posts\n factory(App\\User::class, 10)->create();\n factory(App\\Post::class, 35)->create();\n }", "public function run()\n {\n $faker = Faker::create();\n\n \\DB::table('positions')->insert(array (\n 'codigo' => strtoupper($faker->randomLetter).$faker->postcode,\n 'nombre' => 'Chef',\n 'salario' => '15000.00'\n ));\n\n\t\t \\DB::table('positions')->insert(array (\n 'codigo' => strtoupper($faker->randomLetter).$faker->postcode,\n 'nombre' => 'Mesonero',\n 'salario' => '12000.00'\n ));\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n $faker = \\Faker\\Factory::create();\n\n foreach (range(1,5) as $index) {\n Lista::create([\n 'name' => $faker->sentence(2),\n 'description' => $faker->sentence(10), \n ]);\n } \n\n foreach (range(1,20) as $index) {\n $n = $faker->sentence(2);\n \tTarea::create([\n \t\t'name' => $n,\n \t\t'description' => $faker->sentence(10),\n 'lista_id' => $faker->numberBetween(1,5),\n 'slug' => Str::slug($n),\n \t\t]);\n } \n }", "public function run()\n {\n $faker = Faker::create('lt_LT');\n\n DB::table('users')->insert([\n 'name' => 'user',\n 'email' => '[email protected]',\n 'password' => Hash::make('123')\n ]);\n DB::table('users')->insert([\n 'name' => 'user2',\n 'email' => '[email protected]',\n 'password' => Hash::make('123')\n ]);\n\n foreach (range(1,100) as $val)\n DB::table('authors')->insert([\n 'name' => $faker->firstName(),\n 'surname' => $faker->lastName(),\n \n ]);\n }", "public function run()\n {\n // \\App\\Models\\User::factory(10)->create();\n $this->call(UsersTableSeeder::class);\n\n // DB::table('users')->insert([\n // 'name' => 'User1',\n // 'email' => '[email protected]',\n // 'password' => bcrypt('password'),\n // ]);\n\n\n $faker = Faker::create();\n \n foreach (range(1,10) as $index){\n DB::table('companies')->insert([\n 'name' => $faker->company(),\n 'email' => $faker->email(10).'@gmail.com',\n 'logo' => $faker->image($dir = '/tmp', $width = 640, $height = 480),\n 'webiste' => $faker->domainName(),\n \n ]);\n }\n \n \n foreach (range(1,10) as $index){\n DB::table('employees')->insert([\n 'first_name' => $faker->firstName(),\n 'last_name' => $faker->lastName(),\n 'company' => $faker->company(),\n 'email' => $faker->str_random(10).'@gmail.com',\n 'phone' => $faker->e164PhoneNumber(),\n \n ]);\n }\n\n\n\n }", "public function run()\n {\n DB::statement('SET FOREIGN_KEY_CHECKS=0;');\n Flight::truncate();\n\n $faker = \\Faker\\Factory::create();\n\n // And now, let's create a few articles in our database:\n for ($i = 0; $i < 100; $i++) {\n\n\n Flight::create([\n 'flightNumber' => $faker->randomNumber(5),\n 'depAirport' => $faker->city,\n 'destAirport' => $faker->city,\n 'reservedWeight' => $faker->numberBetween(1000 - 10000),\n 'deptTime' => $faker->dateTime('now'),\n 'arrivalTime' => $faker->dateTime('now'),\n 'reservedVolume' => $faker->numberBetween(1000 - 10000),\n 'airlineName' => $faker->colorName,\n ]);\n }\n DB::statement('SET FOREIGN_KEY_CHECKS=1;');\n }", "public function run()\n {\n // \\App\\Models\\User::factory(10)->create();\n $this->truncteTables([\n 'users',\n 'products'\n ]);\n\n $this->call(UsersSeeder::class);\n $this->call(ProductsSeeder::class);\n\n }", "public function run()\n {\n /**\n * Dummy seeds\n */\n DB::table('metas')->truncate();\n $faker = Faker::create();\n\n for ($i=0; $i < 10; $i++) { \n DB::table('metas')->insert([\n 'id_rel' => $faker->randomNumber(),\n 'titulo' => $faker->sentence,\n 'descricao' => $faker->paragraph,\n 'justificativa' => $faker->paragraph,\n 'valor_inicial' => $faker->numberBetween(0,100),\n 'valor_atual' => $faker->numberBetween(0,100),\n 'valor_final' => $faker->numberBetween(0,10),\n 'regras' => json_encode([$i => [\"values\" => $faker->words(3)]]),\n 'types' => json_encode([$i => [\"values\" => $faker->words(2)]]),\n 'categorias' => json_encode([$i => [\"values\" => $faker->words(4)]]),\n 'tags' => json_encode([$i => [\"values\" => $faker->words(5)]]),\n 'active' => true,\n ]);\n }\n\n\n }", "public function run()\n {\n // $this->call(UserTableSeeder::class);\n\n $faker = Faker::create();\n\n $lessonIds = Lesson::lists('id')->all(); // An array of ID's in that table [1, 2, 3, 4, 5, 7]\n $tagIds = Tag::lists('id')->all();\n\n foreach(range(1, 30) as $index)\n {\n // a real lesson id\n // a real tag id\n DB::table('lesson_tag')->insert([\n 'lesson_id' => $faker->randomElement($lessonIds),\n 'tag_id' => $faker->randomElement($tagIds),\n ]);\n }\n }", "public function run()\n {\n $this->call(CategoriasTableSeeder::class);\n $this->call(UfsTableSeeder::class);\n $this->call(UsersTableSeeder::class);\n $this->call(UserTiposTableSeeder::class);\n factory(App\\User::class, 2)->create();\n/* factory(App\\Models\\Categoria::class, 20)->create();*/\n/* factory(App\\Models\\Anuncio::class, 50)->create();*/\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n DB::statement('SET FOREIGN_KEY_CHECKS = 0');\n\n Language::truncate();\n Reason::truncate();\n Report::truncate();\n Category::truncate();\n Position::truncate();\n\n $languageQuantity = 10;\n $reasonQuantity = 10;\n $reportQuantity = 10;\n $categoryQuantity = 10;\n $positionQuantity = 10;\n\n factory(Language::class,$languageQuantity)->create();\n factory(Reason::class,$reasonQuantity)->create();\n \n factory(Report::class,$reportQuantity)->create();\n \n factory(Category::class,$categoryQuantity)->create();\n \n factory(Position::class,$positionQuantity)->create();\n\n }", "public function run()\n {\n // \\DB::statement('SET_FOREIGN_KEY_CHECKS=0');\n \\DB::table('users')->truncate();\n \\DB::table('posts')->truncate();\n // \\DB::table('category')->truncate();\n \\DB::table('photos')->truncate();\n \\DB::table('comments')->truncate();\n \\DB::table('comment_replies')->truncate();\n\n \\App\\Models\\User::factory()->times(10)->hasPosts(1)->create();\n \\App\\Models\\Role::factory()->times(10)->create();\n \\App\\Models\\Category::factory()->times(10)->create();\n \\App\\Models\\Comment::factory()->times(10)->hasReplies(1)->create();\n \\App\\Models\\Photo::factory()->times(10)->create();\n\n \n // \\App\\Models\\User::factory(10)->create([\n // 'role_id'=>2,\n // 'is_active'=>1\n // ]);\n\n // factory(App\\Models\\Post::class, 10)->create();\n // $this->call(UsersTableSeeder::class);\n }", "public function run()\n {\n $this->call([\n ArticleSeeder::class, \n TagSeeder::class,\n Arttagrel::class\n ]);\n // \\App\\Models\\User::factory(10)->create();\n \\App\\Models\\Article::factory()->count(7)->create();\n \\App\\Models\\Tag::factory()->count(15)->create(); \n \\App\\Models\\Arttagrel::factory()->count(15)->create(); \n }", "public function run()\n {\n $this->call(ArticulosTableSeeder::class);\n /*DB::table('articulos')->insert([\n 'titulo' => str_random(50),\n 'cuerpo' => str_random(200),\n ]);*/\n }", "public function run()\n {\n $this->call(CategoryTableSeeder::class);\n $this->call(ProductTableSeeder::class);\n\n \t\t\n\t\t\tDB::table('users')->insert([\n 'first_name' => 'Ignacio',\n 'last_name' => 'Garcia',\n 'email' => '[email protected]',\n 'password' => bcrypt('123456'),\n 'role' => '1',\n 'avatar' => 'CGnABxNYYn8N23RWlvTTP6C2nRjOLTf8IJcbLqRP.jpeg',\n ]);\n }", "public function run()\n {\n // \\App\\Models\\User::factory(10)->create();\n $this->call(RoleSeeder::class);\n $this->call(UserSeeder::class);\n\n Medicamento::factory(50)->create();\n Reporte::factory(5)->create();\n Cliente::factory(200)->create();\n Asigna_valor::factory(200)->create();\n Carga::factory(200)->create();\n }", "public function run()\n {\n $this->call([\n RoleSeeder::class,\n TicketSeeder::class\n ]);\n\n DB::table('departments')->insert([\n 'abbr' => 'IT',\n 'name' => 'Information Technologies',\n 'created_at' => Carbon::now(),\n 'updated_at' => Carbon::now(),\n ]);\n\n DB::table('users')->insert([\n 'name' => 'admin',\n 'email' => '[email protected]',\n 'email_verified_at' => Carbon::now(),\n 'password' => Hash::make('admin'),\n 'department_id' => 1,\n 'avatar' => 'default.png',\n 'created_at' => Carbon::now(),\n 'updated_at' => Carbon::now(),\n ]);\n\n DB::table('role_user')->insert([\n 'role_id' => 1,\n 'user_id' => 1\n ]);\n }", "public function run()\n {\n \\App\\Models\\Article::factory(20)->create();\n \\App\\Models\\Category::factory(5)->create();\n \\App\\Models\\Comment::factory(40)->create();\n\n \\App\\Models\\User::create([\n \"name\"=>\"Alice\",\n \"email\"=>'[email protected]',\n 'password' => Hash::make('password'),\n ]);\n \\App\\Models\\User::create([\n \"name\"=>\"Bob\",\n \"email\"=>'[email protected]',\n 'password' => Hash::make('password'),\n ]);\n }", "public function run()\n {\n /** \n * Note: You must add these lines to your .env file for this Seeder to work (replace the values, obviously):\n SEEDER_USER_FIRST_NAME = 'Firstname'\n SEEDER_USER_LAST_NAME = 'Lastname'\n\t\tSEEDER_USER_DISPLAY_NAME = 'Firstname Lastname'\n\t\tSEEDER_USER_EMAIL = [email protected]\n SEEDER_USER_PASSWORD = yourpassword\n */\n\t\tDB::table('users')->insert([\n 'user_first_name' => env('SEEDER_USER_FIRST_NAME'),\n 'user_last_name' => env('SEEDER_USER_LAST_NAME'),\n 'user_name' => env('SEEDER_USER_DISPLAY_NAME'),\n\t\t\t'user_email' => env('SEEDER_USER_EMAIL'),\n 'user_status' => 1,\n \t'password' => Hash::make((env('SEEDER_USER_PASSWORD'))),\n 'permission_fk' => 1,\n 'created_at' => Carbon::now()->format('Y-m-d H:i:s'),\n 'updated_at' => Carbon::now()->format('Y-m-d H:i:s')\n ]);\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n factory(App\\User::class,3)->create()->each(\n \tfunction($user)\n \t{\n \t\t$user->questions()\n \t\t->saveMany(\n \t\t\tfactory(App\\Question::class, rand(2,6))->make()\n \t\t)\n ->each(function ($q) {\n $q->answers()->saveMany(factory(App\\Answer::class, rand(1,5))->make());\n })\n \t}\n );\n }\n}", "public function run()\n {\n $faker = Faker::create();\n\n // $this->call(UsersTableSeeder::class);\n\n DB::table('posts')->insert([\n 'id'=>str_random(1),\n 'user_id'=> str_random(1),\n 'title' => $faker->name,\n 'body' => $faker->safeEmail,\n 'created_at' => date('Y-m-d H:i:s'),\n 'updated_at' => date('Y-m-d H:i:s'),\n ]);\n }", "public function run()\n\t{\n\t\tDB::table(self::TABLE_NAME)->delete();\n\n\t\tforeach (seed(self::TABLE_NAME) as $row)\n\t\t\t$records[] = [\n\t\t\t\t'id'\t\t\t\t=> $row->id,\n\t\t\t\t'created_at'\t\t=> $row->created_at ?? Carbon::now(),\n\t\t\t\t'updated_at'\t\t=> $row->updated_at ?? Carbon::now(),\n\n\t\t\t\t'sport_id'\t\t\t=> $row->sport_id,\n\t\t\t\t'gender_id'\t\t\t=> $row->gender_id,\n\t\t\t\t'tournamenttype_id'\t=> $row->tournamenttype_id ?? null,\n\n\t\t\t\t'name'\t\t\t\t=> $row->name,\n\t\t\t\t'external_id'\t\t=> $row->external_id ?? null,\n\t\t\t\t'is_top'\t\t\t=> $row->is_top ?? null,\n\t\t\t\t'logo'\t\t\t\t=> $row->logo ?? null,\n\t\t\t\t'position'\t\t\t=> $row->position ?? null,\n\t\t\t];\n\n\t\tinsert(self::TABLE_NAME, $records ?? []);\n\t}", "public function run()\n\t{\n\t\tDB::table('libros')->truncate();\n\n\t\t$faker = Faker\\Factory::create();\n\n\t\tfor ($i=0; $i < 10; $i++) { \n\t\t\tLibro::create([\n\n\t\t\t\t'titulo'\t\t=> $faker->text(40),\n\t\t\t\t'isbn'\t\t\t=> $faker->numberBetween(100,999),\n\t\t\t\t'precio'\t\t=> $faker->randomFloat(2,3,150),\n\t\t\t\t'publicado'\t\t=> $faker->numberBetween(0,1),\n\t\t\t\t'descripcion'\t=> $faker->text(400),\n\t\t\t\t'autor_id'\t\t=> $faker->numberBetween(1,3),\n\t\t\t\t'categoria_id'\t=> $faker->numberBetween(1,3)\n\n\t\t\t]);\n\t\t}\n\n\t\t// Uncomment the below to run the seeder\n\t\t// DB::table('libros')->insert($libros);\n\t}", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n factory(App\\User::class, 10)->create()->each(function ($user) {\n // Seed the relation with 5 purchases\n // $videos = factory(App\\Video::class, 5)->make();\n // $user->videos()->saveMany($videos);\n // $user->videos()->each(function ($video){\n // \t$video->videometa()->save(factory(App\\VideoMeta::class)->make());\n // \t// :( \n // });\n factory(App\\User::class, 10)->create()->each(function ($user) {\n\t\t\t factory(App\\Video::class, 5)->create(['user_id' => $user->id])->each(function ($video) {\n\t\t\t \tfactory(App\\VideoMeta::class, 1)->create(['video_id' => $video->id]);\n\t\t\t // $video->videometa()->save(factory(App\\VideoMeta::class)->create(['video_id' => $video->id]));\n\t\t\t });\n\t\t\t});\n\n });\n }", "public function run()\n {\n // for($i=1;$i<11;$i++){\n // DB::table('post')->insert(\n // ['title' => 'Title'.$i,\n // 'post' => 'Post'.$i,\n // 'slug' => 'Slug'.$i]\n // );\n // }\n $faker = Faker\\Factory::create();\n \n for($i=1;$i<20;$i++){\n $dname = $faker->name;\n DB::table('post')->insert(\n ['title' => $dname,\n 'post' => $faker->text($maxNbChars = 200),\n 'slug' => str_slug($dname)]\n );\n }\n }", "public function run()\n {\n $this->call([\n CountryTableSeeder::class,\n ProvinceTableSeeder::class,\n TagTableSeeder::class\n ]);\n\n User::factory()->count(10)->create();\n Category::factory()->count(5)->create();\n Product::factory()->count(20)->create();\n Section::factory()->count(5)->create();\n Bundle::factory()->count(20)->create();\n\n $bundles = Bundle::all();\n // populate bundle-product table (morph many-to-many)\n Product::all()->each(function ($product) use ($bundles) {\n $product->bundles()->attach(\n $bundles->random(2)->pluck('id')->toArray(),\n ['default_quantity' => rand(1, 10)]\n );\n });\n // populate bundle-tags table (morph many-to-many)\n Tag::all()->each(function ($tag) use ($bundles) {\n $tag->bundles()->attach(\n $bundles->random(2)->pluck('id')->toArray()\n );\n });\n }", "public function run()\n {\n // Let's truncate our existing records to start from scratch.\n Contract::truncate();\n\n $faker = \\Faker\\Factory::create();\n\n // And now, let's create a few articles in our database:\n for ($i = 0; $i < 50; $i++) {\n Contract::create([\n 'serialnumbers' => $faker->numberBetween($min = 1000000, $max = 2000000),\n 'address' => $faker->address,\n 'landholder' => $faker->lastName,\n 'renter' => $faker->lastName,\n 'price' => $faker->numberBetween($min = 10000, $max = 50000),\n 'rent_start' => $faker->date($format = 'Y-m-d', $max = 'now'),\n 'rent_end' => $faker->date($format = 'Y-m-d', $max = 'now'),\n ]);\n }\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n $faker=Faker\\Factory::create();\n\n for($i=0;$i<100;$i++){\n \tApp\\Blog::create([\n \t\t'title' => $faker->catchPhrase,\n 'description' => $faker->text,\n 'showns' =>true\n \t\t]);\n }\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n DB::statement('SET FOREIGN_KEY_CHECKS = 0'); // TO PREVENT CHECKS FOR foreien key in seeding\n\n User::truncate();\n Category::truncate();\n Product::truncate();\n Transaction::truncate();\n\n DB::table('category_product')->truncate();\n\n User::flushEventListeners();\n Category::flushEventListeners();\n Product::flushEventListeners();\n Transaction::flushEventListeners();\n\n $usersQuantities = 1000;\n $categoriesQuantities = 30;\n $productsQuantities = 1000;\n $transactionsQuantities = 1000;\n\n factory(User::class, $usersQuantities)->create();\n factory(Category::class, $categoriesQuantities)->create();\n\n factory(Product::class, $productsQuantities)->create()->each(\n function ($product) {\n $categories = Category::all()->random(mt_rand(1, 5))->pluck('id');\n $product->categories()->attach($categories);\n });\n\n factory(Transaction::class, $transactionsQuantities)->create();\n }", "public function run()\n {\n // $this->call(UserSeeder::class);\n $this->call(PermissionsTableSeeder::class);\n $this->call(UsersTableSeeder::class);\n\n $this->call(BusinessTableSeeder::class);\n $this->call(PrinterTableSeeder::class);\n factory(App\\Tag::class,10)->create();\n factory(App\\Category::class,10)->create();\n factory(App\\Subcategory::class,50)->create();\n factory(App\\Provider::class,10)->create();\n factory(App\\Product::class,24)->create()->each(function($product){\n\n $product->images()->saveMany(factory(App\\Image::class, 4)->make());\n\n });\n\n\n factory(App\\Client::class,10)->create();\n }", "public function run()\n {\n Article::truncate();\n\n $faker = \\Faker\\Factory::create();\n\n // And now, let's create a few articles in our database:\n for ($i = 0; $i < 50; $i++) {\n Article::create([\n 'name' => $faker->sentence,\n 'sku' => $faker->paragraph,\n 'price' => $faker->number,\n ]);\n }\n }", "public function run()\n {\n Storage::deleteDirectory('public/products');\n Storage::makeDirectory('public/products');\n\n $this->call(UserSeeder::class);\n Category::factory(4)->create();\n $this->call(ProductSeeder::class);\n Order::factory(4)->create();\n Order_Detail::factory(4)->create();\n Size::factory(100)->create();\n }", "public function run()\n {\n $this->call(RolSeeder::class);\n\n $this->call(UserSeeder::class);\n Category::factory(4)->create();\n Doctor::factory(25)->create();\n Patient::factory(50)->create();\n Status::factory(3)->create();\n Appointment::factory(100)->create();\n }", "public function run()\n\t{\n\t\t\n\t\tDB::statement('SET FOREIGN_KEY_CHECKS = 0');\n\n\t\t$faker = \\Faker\\Factory::create();\n\n\t\tTodolist::truncate();\n\n\t\tforeach(range(1, 50) as $index)\n\t\t{\n\n\t\t\t$user = User::create([\n\t\t\t\t'name' => $faker->name,\n\t\t\t\t'email' => $faker->email,\n\t\t\t\t'password' => 'password',\n\t\t\t\t'confirmation_code' => mt_rand(0, 9),\n\t\t\t\t'confirmation' => rand(0,1) == 1\n\t\t\t]);\n\n\t\t\t$list = Todolist::create([\n\t\t\t\t'name' => $faker->sentence(2),\n\t\t\t\t'description' => $faker->sentence(4),\n\t\t\t]);\n\n\t\t\t// BUILD SOME TASKS FOR EACH LIST ITEM\n\t\t\tforeach(range(1, 10) as $index) \n\t\t\t{\n\t\t\t\t$task = new Task;\n\t\t\t\t$task->name = $faker->sentence(2);\n\t\t\t\t$task->description = $faker->sentence(4);\n\t\t\t\t$list->tasks()->save($task);\n\t\t\t}\n\n\t\t}\n\n\t\tDB::statement('SET FOREIGN_KEY_CHECKS = 1'); \n\n\t}", "public function run()\n {\n Campus::truncate();\n Canteen::truncate();\n Dorm::truncate();\n\n $faker = Faker\\Factory::create();\n $schools = School::all();\n foreach ($schools as $school) {\n \tforeach (range(1, 2) as $index) {\n\t \t$campus = Campus::create([\n\t \t\t'school_id' => $school->id,\n\t \t\t'name' => $faker->word . '校区',\n\t \t\t]);\n\n \t$campus->canteens()->saveMany(factory(Canteen::class, mt_rand(2,3))->make());\n $campus->dorms()->saveMany(factory(Dorm::class, mt_rand(2,3))->make());\n\n }\n }\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n DB::table('users')->insert([\n 'name' => 'admin',\n 'email' => '[email protected]',\n 'password' => bcrypt('admin'),\n 'seq_q'=>'1',\n 'seq_a'=>'admin'\n ]);\n\n // DB::table('bloods')->insert([\n // ['name' => 'A+'],\n // ['name' => 'A-'],\n // ['name' => 'B+'],\n // ['name' => 'B-'],\n // ['name' => 'AB+'],\n // ['name' => 'AB-'],\n // ['name' => 'O+'],\n // ['name' => 'O-'],\n // ]);\n\n \n }", "public function run()\n {\n // $this->call(UserTableSeeder::class);\n \\App\\User::create([\n 'name'=>'PAPE SAMBA NDOUR',\n 'email'=>'[email protected]',\n 'password'=>bcrypt('Admin1122'),\n ]);\n\n $faker = Faker::create();\n\n for ($i = 0; $i < 100 ; $i++)\n {\n $firstName = $faker->firstName;\n $lastName = $faker->lastName;\n $niveau = \\App\\Niveau::inRandomOrder()->first();\n \\App\\Etudiant::create([\n 'prenom'=>$firstName,\n 'nom'=>$lastName,\n 'niveau_id'=>$niveau->id\n ]);\n }\n\n\n }", "public function run()\n {\n //\n DB::table('foods')->delete();\n\n Foods::create(array(\n 'name' => 'Chicken Wing',\n 'author' => 'Bambang',\n 'overview' => 'a deep-fried chicken wing, not in spicy sauce'\n ));\n\n Foods::create(array(\n 'name' => 'Beef ribs',\n 'author' => 'Frank',\n 'overview' => 'Slow baked beef ribs rubbed in spices'\n ));\n\n Foods::create(array(\n 'name' => 'Ice cream',\n 'author' => 'Lou',\n 'overview' => ' A sweetened frozen food typically eaten as a snack or dessert.'\n ));\n\n }", "public function run()\n {\n // Let's truncate our existing records to start from scratch.\n News::truncate();\n\n $faker = \\Faker\\Factory::create();\n\n // And now, let's create a few articles in our database:\n for ($i = 0; $i < 10; $i++) {\n News::create([\n 'title' => $faker->sentence,\n 'summary' => $faker->sentence,\n 'content' => $faker->paragraph,\n 'imagePath' => '/img/exclamation_mark.png'\n ]);\n }\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n factory(App\\User::class, 3)->create();\n factory(App\\Models\\Category::class, 3)\n ->create()\n ->each(function ($u) {\n $u->courses()->saveMany(factory(App\\Models\\Course::class,3)->make())->each(function ($c){\n $c->exams()->saveMany(factory(\\App\\Models\\Exam::class,3)->make())->each(function ($e){\n $e->questions()->saveMany(factory(\\App\\Models\\Question::class,4)->make())->each(function ($q){\n $q->answers()->saveMany(factory(\\App\\Models\\Answer::class,4)->make())->each(function ($a){\n $a->correctAnswer()->save(factory(\\App\\Models\\Correct_answer::class)->make());\n });\n });\n });\n });\n\n });\n\n }", "public function run()\n {\n \\DB::table('employees')->delete();\n\n $faker = \\Faker\\Factory::create('ja_JP');\n\n $role_id = ['1','2','3'];\n\n for ($i = 0; $i < 10; $i++) {\n \\App\\Models\\Employee::create([\n 'last_name' =>$faker->lastName() ,\n 'first_name' => $faker->firstName(),\n 'mail' => $faker->email(),\n 'password' => Hash::make( \"password.$i\"),\n 'birthday' => $faker->date($format='Y-m-d',$max='now'),\n 'role_id' => $faker->randomElement($role_id)\n ]);\n }\n }", "public function run()\n {\n\n DB::table('clients')->delete();\n DB::table('trips')->delete();\n error_log('empty tables done.');\n\n $random_cities = City::inRandomOrder()->select('ar_name')->limit(5)->get();\n $GLOBALS[\"random_cities\"] = $random_cities->pluck('ar_name')->toArray();\n\n $random_airlines = Airline::inRandomOrder()->select('code')->limit(5)->get();\n $GLOBALS[\"random_airlines\"] = $random_airlines->pluck('code')->toArray();\n\n factory(App\\Client::class, 5)->create();\n error_log('Client seed done.');\n\n\n factory(App\\Trip::class, 50)->create();\n error_log('Trip seed done.');\n\n\n factory(App\\Quicksearch::class, 10)->create();\n error_log('Quicksearch seed done.');\n }", "public function run()\n {\n // Admins\n User::factory()->create([\n 'name' => 'Zaiman Noris',\n 'username' => 'rognales',\n 'email' => '[email protected]',\n 'active' => true,\n ]);\n\n User::factory()->create([\n 'name' => 'Affiq Rashid',\n 'username' => 'affiqr',\n 'email' => '[email protected]',\n 'active' => true,\n ]);\n\n // Only seed test data in non-prod\n if (! app()->isProduction()) {\n Member::factory()->count(1000)->create();\n Staff::factory()->count(1000)->create();\n\n Participant::factory()\n ->addSpouse()\n ->addChildren()\n ->addInfant()\n ->addOthers()\n ->count(500)\n ->hasUploads(2)\n ->create();\n }\n }", "public function run()\n {\n $this->call([\n RoleSeeder::class,\n UserSeeder::class,\n ]);\n\n \\App\\Models\\Category::factory(4)->create();\n \\App\\Models\\View::factory(6)->create();\n \\App\\Models\\Room::factory(8)->create();\n \n $rooms = \\App\\Models\\Room::all();\n // \\App\\Models\\User::all()->each(function ($user) use ($rooms) { \n // $user->rooms()->attach(\n // $rooms->random(rand(1, \\App\\Models\\Room::max('id')))->pluck('id')->toArray()\n // ); \n // });\n }", "public function run()\n {\n // \\App\\Models\\User::factory(10)->create();\n Employee::factory()->create(['email' => '[email protected]']);\n Brand::factory()->count(3)->create();\n $this->call([\n TagSeeder::class,\n AttributeSeeder::class,\n AttributeValueSeeder::class,\n ProductSeeder::class,\n ]);\n }", "public function run()\n {\n $this->call(RolesTableSeeder::class); // crée les rôles\n $this->call(PermissionsTableSeeder::class); // crée les permissions\n\n factory(Employee::class,3)->create();\n factory(Provider::class,1)->create();\n\n $user = User::create([\n 'name'=>'Alioune Bada Ndoye',\n 'email'=>'[email protected]',\n 'phone'=>'773012470',\n 'password'=>bcrypt('123'),\n ]);\n Employee::create([\n 'job'=>'Informaticien',\n 'user_id'=>User::where('email','[email protected]')->first()->id,\n 'point_id'=>Point::find(1)->id,\n ]);\n $user->assignRole('admin');\n }", "public function run()\n {\n // $this->call(UserSeeder::class);\n factory(User::class, 1)\n \t->create(['email' => '[email protected]']);\n\n factory(Category::class, 5)->create();\n }", "public function run()\n {\n //$this->call(UsersTableSeeder::class);\n $this->call(rootSeed::class);\n factory(App\\Models\\Egresado::class,'hombre',15)->create();\n factory(App\\Models\\Egresado::class,'mujer',15)->create();\n factory(App\\Models\\Administrador::class,5)->create();\n factory(App\\Models\\Notificacion::class,'post',10)->create();\n factory(App\\Models\\Notificacion::class,'mensaje',5)->create();\n factory(App\\Models\\Egresado::class,'bajaM',5)->create();\n factory(App\\Models\\Egresado::class,'bajaF',5)->create();\n factory(App\\Models\\Egresado::class,'suscritam',5)->create();\n factory(App\\Models\\Egresado::class,'suscritaf',5)->create();\n }", "public function run()\n {\n \n User::factory(1)->create([\n 'rol'=>'EPS'\n ]);\n Person::factory(10)->create();\n $this->call(EPSSeeder::class);\n $this->call(OfficialSeeder::class);\n $this->call(VVCSeeder::class);\n $this->call(VaccineSeeder::class);\n }", "public function run()\n {\n // $faker=Faker::create();\n // foreach(range(1,100) as $index)\n // {\n // DB::table('products')->insert([\n // 'name' => $faker->name,\n // 'price' => rand(10,100000)/100\n // ]);\n // }\n }", "public function run()\n {\n $this->call([\n LanguagesTableSeeder::class,\n ListingAvailabilitiesTableSeeder::class,\n ListingTypesTableSeeder::class,\n RoomTypesTableSeeder::class,\n AmenitiesTableSeeder::class,\n UsersTableSeeder::class,\n UserLanguagesTableSeeder::class,\n ListingsTableSeeder::class,\n WishlistsTableSeeder::class,\n StaysTableSeeder::class,\n GuestsTableSeeder::class,\n TripsTableSeeder::class,\n ReviewsTableSeeder::class,\n RatingsTableSeeder::class,\n PopularDestinationsTableSeeder::class,\n ImagesTableSeeder::class,\n ]);\n\n // factory(App\\User::class, 5)->states('host')->create();\n // factory(App\\User::class, 10)->states('hostee')->create();\n\n // factory(App\\User::class, 10)->create();\n // factory(App\\Models\\Listing::class, 30)->create();\n }", "public function run()\n {\n Schema::disableForeignKeyConstraints();\n Grade::truncate();\n Schema::enableForeignKeyConstraints();\n\n $faker = \\Faker\\Factory::create();\n\n for ($i = 0; $i < 10; $i++) {\n Grade::create([\n 'letter' => $faker->randomElement(['а', 'б', 'в']),\n 'school_id' => $faker->unique()->numberBetween(1, School::count()),\n 'level' => 1\n ]);\n }\n }", "public function run()\n {\n // $this->call(UserSeeder::class);\n factory(App\\User::class,5)->create();//5 User created\n factory(App\\Model\\Genre::class,5)->create();//5 genres\n factory(App\\Model\\Film::class,6)->create();//6 films\n factory(App\\Model\\Comment::class, 20)->create();// 20 comments\n }", "public function run()\n {\n\n $this->call(UserSeeder::class);\n factory(Empresa::class,10)->create();\n factory(Empleado::class,50)->create();\n }", "public function run()\n {\n // \\App\\Models\\User::factory(10)->create();\n User::create([\n 'name' => 'jose luis',\n 'email' => '[email protected]',\n 'password' => bcrypt('xxxxxx'),\n 'role' => 'admin',\n ]);\n\n Category::create([\n 'name' => 'inpods',\n 'description' => 'auriculares inalambricos que funcionan con blouthue genial'\n ]);\n\n Category::create([\n 'name' => 'other',\n 'description' => 'otra cosa diferente a un inpods'\n ]);\n\n\n /* Create 10 products */\n Product::factory(10)->create();\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n factory(User::class)->create([\n 'email' => '[email protected]',\n 'name' => 'Russell'\n ]);\n\n factory(User::class)->create([\n 'email' => '[email protected]',\n 'name' => 'Bitfumes'\n ]);\n\n factory(User::class)->create([\n 'email' => '[email protected]',\n 'name' => 'Paul'\n ]);\n }", "public function run()\n {\n $user_ids = [1,2,3];\n $faker = app(\\Faker\\Generator::class);\n $posts = factory(\\App\\Post::class)->times(50)->make()->each(function($post) use ($user_ids,$faker){\n $post->user_id = $faker->randomElement($user_ids);\n });\n \\App\\Post::insert($posts->toArray());\n }", "public function run()\n {\n // Vaciar la tabla.\n Favorite::truncate();\n $faker = \\Faker\\Factory::create();\n // Crear artículos ficticios en la tabla\n\n // factory(App\\Models\\User::class, 2)->create()->each(function ($user) {\n // $user->users()->saveMany(factory(App\\Models\\User::class, 25)->make());\n //});\n }", "public function run()\n\t{\n\t\t$this->call(ProductsTableSeeder::class);\n\t\t$this->call(CategoriesTableSeeder::class);\n\t\t$this->call(BrandsTableSeeder::class);\n\t\t$this->call(ColorsTableSeeder::class);\n\n\t\t$products = \\App\\Product::all();\n \t$categories = \\App\\Category::all();\n \t$brands = \\App\\Brand::all();\n \t$colors = \\App\\Color::all();\n\n\t\tforeach ($products as $product) {\n\t\t\t$product->colors()->sync($colors->random(3));\n\n\t\t\t$product->category()->associate($categories->random(1)->first());\n\t\t\t$product->brand()->associate($brands->random(1)->first());\n\n\t\t\t$product->save();\n\t\t}\n\n\t\t// for ($i = 0; $i < count($products); $i++) {\n\t\t// \t$cat = $categories[rand(0,5)];\n\t\t// \t$bra = $brands[rand(0,7)];\n\t\t// \t$cat->products()->save($products[$i]);\n\t\t// \t$bra->products()->save($products[$i]);\n\t\t// }\n\n\t\t// $products = factory(App\\Product::class)->times(20)->create();\n\t\t// $categories = factory(App\\Category::class)->times(6)->create();\n\t\t// $brands = factory(App\\Brand::class)->times(8)->create();\n\t\t// $colors = factory(App\\Color::class)->times(15)->create();\n\t}", "public function run()\n {\n /*$this->call(UsersTableSeeder::class);\n $this->call(GroupsTableSeeder::class);\n $this->call(TopicsTableSeeder::class);\n $this->call(CommentsTableSeeder::class);*/\n DB::table('users')->insert([\n 'name' => 'pkw',\n 'email' => '[email protected]',\n 'password' => bcrypt('secret'),\n 'type' => '1'\n ]);\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n $faker = Faker::create();\n foreach (range(1,200) as $index) {\n DB::table('users')->insert([\n 'name' => $faker->name,\n 'email' => $faker->email,\n 'phone' => $faker->randomDigitNotNull,\n 'address'=> $faker->streetAddress,\n 'password' => bcrypt('secret'),\n ]);\n }\n }", "public function run()\n {\n $this->call(UsersSeeder::class);\n User::factory(2)->create();\n Company::factory(2)->create();\n\n }", "public function run()\n {\n echo PHP_EOL , 'seeding roles...';\n\n Role::create(\n [\n 'name' => 'Admin',\n 'deletable' => false,\n ]\n );\n Role::create(\n [\n 'name' => 'Principal',\n 'deletable' => false,\n ]\n );\n Role::create(\n [\n 'name' => 'Teacher',\n 'deletable' => false,\n ]\n );\n\n Role::create(\n [\n 'name' => 'Student',\n 'deletable' => false,\n ]\n );\n Role::create(\n [\n 'name' => 'Parents',\n 'deletable' => false,\n ]\n );\n Role::create(\n [\n 'name' => 'Accountant',\n 'deletable' => false,\n ]\n );\n Role::create(\n [\n 'name' => 'Librarian',\n 'deletable' => false,\n ]\n );\n Role::create(\n [\n 'name' => 'Receptionist',\n 'deletable' => false,\n ]\n );\n\n\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n // $this->call(QuestionTableSeed::class);\n\n $this->call([\n QuestionTableSeed::class,\n AlternativeTableSeed::class,\n ScheduleActionTableSeeder::class,\n UserTableSeeder::class,\n CompanyClassificationTableSeed::class,\n ]);\n // DB::table('clients')->insert([\n // 'name' => 'Empresa-02',\n // 'email' => '[email protected]',\n // 'password' => bcrypt('07.052.477/0001-60'),\n // ]);\n }", "public function run()\n {\n $faker = \\Faker\\Factory::create();\n\n // And now, let's create a few articles in our database:\n for ($i = 0; $i < 5; $i++) {\n Runner::create([\n 'external_id' => $faker->uuid,\n 'name' => $faker->name,\n 'race_id' =>rand(1,5),\n 'age' => rand(30, 45),\n 'sex' => $faker->randomElement(['male', 'female']),\n 'color' => $faker->randomElement(['#ecbcb4', '#d1a3a4']),\n ]);\n }\n }", "public function run()\n {\n // \\App\\Models\\User::factory(10)->create();\n\n User::factory()->create([\n 'name' => 'Carlos',\n 'email' => '[email protected]',\n 'email_verified_at' => now(),\n 'password' => bcrypt('123456'), // password\n 'remember_token' => Str::random(10),\n ]);\n \n $this->call([PostsTableSeeder::class]);\n $this->call([TagTableSeeder::class]);\n\n }", "public function run()\n {\n $this->call(AlumnoSeeder::class);\n //Alumnos::factory()->count(30)->create();\n //DB::table('alumnos')->insert([\n // 'dni_al' => '13189079',\n // 'nom_al' => 'Jose',\n // 'ape_al' => 'Araujo',\n // 'rep_al' => 'Principal',\n // 'esp_al' => 'Tecnologia',\n // 'lnac_al' => 'Valencia'\n //]);\n }", "public function run()\n {\n Eloquent::unguard();\n\n DB::statement('SET FOREIGN_KEY_CHECKS=0;');\n\n // $this->call([\n // CountriesTableSeeder::class,\n // ]);\n\n factory(App\\User::class, 100)->create();\n factory(App\\Type::class, 10)->create();\n factory(App\\Item::class, 100)->create();\n factory(App\\Order::class, 1000)->create();\n\n $items = App\\Item::all();\n\n App\\Order::all()->each(function($order) use ($items) {\n\n $n = rand(1, 10);\n\n $order->items()->attach(\n $items->random($n)->pluck('id')->toArray()\n , ['quantity' => $n]);\n\n $order->total = $order->items->sum(function($item) {\n return $item->price * $item->pivot->quantity;\n });\n\n $order->save();\n\n });\n\n DB::statement('SET FOREIGN_KEY_CHECKS=1;');\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n\n factory(User::class)->create(\n [\n 'email'=>'[email protected]',\n 'name'=>'izzanni',\n \n ]\n );\n factory(User::class)->create(\n [\n 'email'=>'[email protected]',\n 'name'=>'aina',\n\n ]\n );\n factory(User::class)->create(\n [\n 'email'=>'[email protected]',\n 'name'=>'sab',\n\n ]\n );\n }", "public function run()\n {\n\n factory('App\\Models\\Pessoa', 60)->create();\n factory('App\\Models\\Profissional', 10)->create();\n factory('App\\Models\\Paciente', 50)->create();\n $this->call(UsersTableSeeder::class);\n $this->call(ProcedimentoTableSeeder::class);\n // $this->call(PessoaTableSeeder::class);\n // $this->call(ProfissionalTableSeeder::class);\n // $this->call(PacienteTableSeeder::class);\n // $this->call(AgendaProfissionalTableSeeder::class);\n }", "public function run()\n {\n //Acá se define lo que el seeder va a hacer.\n //insert() para insertar datos.\n //Array asociativo. La llave es el nombre de la columna.\n// DB::table('users')->insert([\n// //Para un solo usuario.\n// 'name' => 'Pedrito Perez',\n// 'email' => '[email protected]',\n// 'password' => bcrypt('123456')\n// ]);//Se indica el nombre de la tabla.\n\n //Crea 50 usuarios (sin probar)\n// factory(App\\User::class, 50)->create()->each(function($u) {\n// $u->posts()->save(factory(App\\Post::class)->make());\n// });\n\n factory(App\\User::class, 10)->create(); //Así se ejecuta el model factory creado en ModelFactory.php\n\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n //nhập liệu mẫu cho bảng users\n DB::table('users')->insert([\n \t['id'=>'1001', 'name'=>'Phan Thị Hiền', 'email'=>'[email protected]', 'password'=>'123456', 'isadmin'=>1],\n \t['id'=>'1002', 'name'=>'Phan Thị Hà', 'email'=>'[email protected]', 'password'=>'111111', 'isadmin'=>0]\n ]);\n\n\n //nhập liệu mẫu cho bảng suppliers\n DB::table('suppliers')->insert([\n \t['name'=>'FPT', 'address'=>'151 Hùng Vương, TP. Đà Nẵng', 'phonenum'=>'0971455395'],\n \t['name'=>'Điện Máy Xanh', 'address'=>'169 Phan Châu Trinh, TP. Đà Nẵng', 'phonenum'=>'0379456011']\n ]);\n\n\n //Bảng phiếu bảo hành\n }", "public function run()\n {\n \t// DB::table('categories')->truncate();\n // factory(App\\Models\\Category::class, 10)->create();\n Schema::disableForeignKeyConstraints();\n Category::truncate();\n $faker = Faker\\Factory::create();\n\n $categories = ['SAMSUNG','NOKIA','APPLE','BLACK BERRY'];\n foreach ($categories as $key => $value) {\n Category::create([\n 'name'=>$value,\n 'description'=> 'This is '.$value,\n 'markup'=> rand(10,100),\n 'category_id'=> null,\n 'UUID' => $faker->uuid,\n ]);\n }\n }" ]
[ "0.8013876", "0.79804534", "0.7976992", "0.79542726", "0.79511505", "0.7949612", "0.794459", "0.7942486", "0.7938189", "0.79368967", "0.79337025", "0.78924936", "0.78811055", "0.78790957", "0.78787595", "0.787547", "0.7871811", "0.78701615", "0.7851422", "0.7850352", "0.7841468", "0.7834583", "0.7827792", "0.7819104", "0.78088796", "0.7802872", "0.7802348", "0.78006834", "0.77989215", "0.7795819", "0.77903426", "0.77884805", "0.77862066", "0.7778816", "0.7777486", "0.7765202", "0.7762492", "0.77623445", "0.77621746", "0.7761383", "0.77606887", "0.77596676", "0.7757001", "0.7753607", "0.7749522", "0.7749292", "0.77466977", "0.7729947", "0.77289546", "0.772796", "0.77167094", "0.7714503", "0.77140456", "0.77132195", "0.771243", "0.77122366", "0.7711113", "0.77109736", "0.7710777", "0.7710086", "0.7705484", "0.770464", "0.7704354", "0.7704061", "0.77027386", "0.77020216", "0.77008796", "0.7698617", "0.76985973", "0.76973504", "0.7696405", "0.7694293", "0.7692694", "0.7691264", "0.7690576", "0.76882726", "0.7687433", "0.7686844", "0.7686498", "0.7685065", "0.7683827", "0.7679184", "0.7678287", "0.76776296", "0.76767945", "0.76726556", "0.76708084", "0.76690495", "0.766872", "0.76686716", "0.7666299", "0.76625943", "0.7662227", "0.76613766", "0.7659881", "0.7656644", "0.76539344", "0.76535016", "0.7652375", "0.7652313", "0.7652022" ]
0.0
-1
Seed the application's database.
public function run() { DB::table('plans')->insert([ [ 'name' => 'Basic', 'country' => 'LB', 'created_at' => date('Y-m-d H:i:s'), 'updated_at' => date('Y-m-d H:i:s')], [ 'name' => 'Premium', 'country' => 'LB', 'created_at' => date('Y-m-d H:i:s'), 'updated_at' => date('Y-m-d H:i:s') ], [ 'name' => 'Ultimate', 'country' => 'UAE', 'created_at' => date('Y-m-d H:i:s'), 'updated_at' => date('Y-m-d H:i:s') ], [ 'name' => 'UAE Basic', 'country' => 'UAE', 'created_at' => date('Y-m-d H:i:s'), 'updated_at' => date('Y-m-d H:i:s') ], [ 'name' => 'UAE PRO', 'country' => 'UAE', 'created_at' => date('Y-m-d H:i:s'), 'updated_at' => date('Y-m-d H:i:s') ], [ 'name' => 'UAE SUPER PRO', 'country' => 'UAE', 'created_at' => date('Y-m-d H:i:s'), 'updated_at' => date('Y-m-d H:i:s') ], ]); DB::table('services')->insert([ ['name' => 'DSL', 'created_at' => date('Y-m-d H:i:s'), 'updated_at' => date('Y-m-d H:i:s')], ['name' => 'Fiber', 'created_at' => date('Y-m-d H:i:s'), 'updated_at' => date('Y-m-d H:i:s')], ['name' => '3g', 'created_at' => date('Y-m-d H:i:s'), 'updated_at' => date('Y-m-d H:i:s')], ]); DB::table('applicants')->insert([ [ 'phone' => '+961 70 863 993', 'name' => 'Ahmad', 'family' => 'Moussawi', 'address' => 'Beirut', 'type' => 'residential', 'created_at' => date('Y-m-d H:i:s'), 'updated_at' => date('Y-m-d H:i:s') ], [ 'phone' => '+961 70 123456', 'name' => 'Jessica', 'family' => 'Jessica', 'address' => 'Beirut', 'type' => 'residential', 'created_at' => date('Y-m-d H:i:s'), 'updated_at' => date('Y-m-d H:i:s') ], [ 'phone' => '+961 70 123458', 'name' => 'Nadine', 'family' => 'Nadine', 'address' => 'Beirut', 'type' => 'corporate', 'created_at' => date('Y-m-d H:i:s'), 'updated_at' => date('Y-m-d H:i:s') ], ]); DB::table('applications')->insert([ [ 'price' => '100', 'date' => '2017-02-01', 'branch' => 'beirut', 'applicant_id' => 1, 'service_id' => 1, 'plan_id' => 1, 'description' => '', 'created_at' => date('Y-m-d'), 'updated_at' => date('Y-m-d'), ], [ 'price' => '150', 'date' => '2017-02-07', 'branch' => 'beirut', 'applicant_id' => 1, 'service_id' => 2, 'plan_id' => 1, 'description' => '', 'created_at' => date('Y-m-d'), 'updated_at' => date('Y-m-d'), ], [ 'price' => '200', 'date' => '2017-03-02', 'branch' => 'saida', 'applicant_id' => 1, 'service_id' => 2, 'plan_id' => 1, 'description' => '', 'created_at' => date('Y-m-d'), 'updated_at' => date('Y-m-d'), ], [ 'price' => '100', 'date' => '2017-04-05', 'branch' => 'tripoli', 'applicant_id' => 1, 'service_id' => 2, 'plan_id' => 2, 'description' => '', 'created_at' => date('Y-m-d'), 'updated_at' => date('Y-m-d'), ], [ 'price' => '90', 'date' => '2017-05-01', 'branch' => 'tripoli', 'applicant_id' => 1, 'service_id' => 2, 'plan_id' => 3, 'description' => '', 'created_at' => date('Y-m-d'), 'updated_at' => date('Y-m-d'), ], [ 'price' => '0', 'date' => '2017-05-01', 'branch' => 'tyr', 'applicant_id' => 1, 'service_id' => 2, 'plan_id' => 3, 'description' => '', 'created_at' => date('Y-m-d'), 'updated_at' => date('Y-m-d'), ], [ 'price' => '300', 'date' => '2017-05-01', 'branch' => 'saida', 'applicant_id' => 1, 'service_id' => 2, 'plan_id' => 4, 'description' => '', 'created_at' => date('Y-m-d'), 'updated_at' => date('Y-m-d'), ], [ 'price' => '20', 'date' => '2017-05-01', 'branch' => 'tyr', 'applicant_id' => 1, 'service_id' => 2, 'plan_id' => 5, 'description' => '', 'created_at' => date('Y-m-d'), 'updated_at' => date('Y-m-d'), ], ]); DB::table('menu')->insert([ // [ // 'name' => 'Pending Feasibility', // 'path' => '/pending', // 'role' => 'sales', // ], // [ // 'name' => 'Ready for Configuration', // 'path' => '/ready-for-configuration', // 'role' => 'technical', // ], // [ // 'name' => 'Ready for Installation', // 'path' => '/ready-for-installation', // 'role' => 'outdoor', // ], // [ // 'name' => 'Complaints', // 'path' => '/complaints', // 'role' => 'support', // ], [ 'name' => 'Plans', 'path' => '/plans', ], [ 'name' => 'Applications', 'path' => '/applications', ], [ 'name' => 'Support', 'path' => '/support', ], ]); $user = new \App\User(); $user->name = 'Jessica'; $user->email = '[email protected]'; $user->is_admin = true; $user->password = bcrypt('123456'); $user->branch = 'beirut'; $user->save(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static function dbSeed(){\n\t\tif (App::runningUnitTests()) {\n\t\t\t//Turn foreign key checks off\n\t\t\tDB::statement('SET FOREIGN_KEY_CHECKS=0;');// <- USE WITH CAUTION!\n\t\t\t//Seed tables\n\t\t\tArtisan::call('db:seed');\n\t\t\t//Turn foreign key checks on\n\t\t\tDB::statement('SET FOREIGN_KEY_CHECKS=1;');// <- SHOULD RESET ANYWAY BUT JUST TO MAKE SURE!\n\t\t}\n\t}", "protected function seedDB()\n {\n $ans = $this->ask('Seed your database?: ', 'y');\n\n // Check if the answer is true\n if (preg_match('/^y/', $ans))\n {\n $this->call('db:seed');\n $this->comment('');\n $this->comment('Database successfully seeded.');\n $this->comment('=====================================');\n echo \"Your app is now ready!\";\n }\n }", "protected function seedDatabase(): void\n {\n $this->seedProductCategories();\n $this->seedProducts();\n }", "public function setupDatabase()\n {\n Artisan::call('migrate:refresh');\n Artisan::call('db:seed');\n\n self::$setupDatabase = false;\n }", "public function run()\n {\n $this->seed('FormsMenuItemsTableSeeder');\n $this->seed('FormsDataTypesTableSeeder');\n $this->seed('FormsDataRowsTableSeeder');\n $this->seed('FormsPermissionsTableSeeder');\n $this->seed('FormsSettingsTableSeeder');\n $this->seed('FormsTableSeeder');\n }", "public function run()\n {\n if (defined('STDERR')) fwrite(STDERR, print_r(\"\\n--- Seeding ---\\n\", TRUE));\n\n if (App::environment('production')) {\n if (defined('STDERR')) fwrite(STDERR, print_r(\"--- ERROR: Seeding in Production is prohibited ---\\n\", TRUE));\n return;\n }\n\n $this->call(RolesTableSeeder::class);\n $this->call(UsersTableSeeder::class);\n $this->call(ProvincesTableSeeder::class);\n $this->call(CitiesTableSeeder::class);\n $this->call(DistrictsTableSeeder::class);\n $this->call(ConfigsTableSeeder::class);\n $this->call(ConfigContentsTableSeeder::class);\n\n DB::statement('SET FOREIGN_KEY_CHECKS=1;');\n if (defined('STDERR')) fwrite(STDERR, print_r(\"Set FOREIGN_KEY_CHECKS=1 --- DONE\\n\", TRUE));\n\n // \\Artisan::call('command:regenerate-user-feeds');\n\n \\Cache::flush();\n\n if (defined('STDERR')) fwrite(STDERR, print_r(\"--- End Seeding ---\\n\\n\", TRUE));\n }", "protected function setupDatabase()\n {\n $this->call('migrate');\n $this->call('db:seed');\n\n $this->info('Database migrated and seeded.');\n }", "public function run()\n {\n $this->call(UsersTableSeeder::class);\n $this->call(PermissionsSeeder::class);\n $this->call(RolesSeeder::class);\n $this->call(ThemeSeeder::class);\n\n //\n\n DB::table('paypal_info')->insert([\n 'client_id' => '',\n 'client_secret' => '',\n 'currency' => '',\n ]);\n DB::table('contact_us')->insert([\n 'content' => '',\n ]);\n DB::table('setting')->insert([\n 'site_name' => ' ',\n ]);\n DB::table('terms_and_conditions')->insert(['terms_and_condition' => 'text']);\n }", "public function seedDatabase(): void\n {\n echo \"Running seeds\";\n\n // Folder where all the seeds are.\n $folder = __DIR__ . '/../seeds/';\n\n // Scan all files/folders inside database.\n $files = \\scandir($folder);\n\n $seeders = [];\n foreach ($files as $key => $file) {\n\n // All files that don't start with a dot.\n if ($file[0] !== '.') {\n\n // Load the file.\n require_once $folder . $file;\n\n // We have to call the migrations after because\n // some seeds are dependant from other seeds.\n $seeders[] = explode('.', $file)[0];\n }\n }\n\n // Run all seeds.\n foreach ($seeders as $seeder) {\n (new $seeder)->run();\n }\n }", "protected function seedDatabase()\n {\n //$this->app->make('db')->table(static::TABLE_NAME)->delete();\n\n TestExtendedModel::create([\n 'unique_field' => '999',\n 'second_field' => null,\n 'name' => 'unchanged',\n 'active' => true,\n 'hidden' => 'invisible',\n ]);\n\n TestExtendedModel::create([\n 'unique_field' => '1234567',\n 'second_field' => '434',\n 'name' => 'random name',\n 'active' => false,\n 'hidden' => 'cannot see me',\n ]);\n\n TestExtendedModel::create([\n 'unique_field' => '1337',\n 'second_field' => '12345',\n 'name' => 'special name',\n 'active' => true,\n 'hidden' => 'where has it gone?',\n ]);\n }", "public function initDatabase()\n {\n $this->call('migrate');\n\n $userModel = config('admin.database.users_model');\n\n if ($userModel::count() == 0) {\n $this->call('db:seed', ['--class' => AdminSeeder::class]);\n }\n }", "public function run ()\n {\n if (App::environment() === 'production') {\n exit('Seed should be run only in development/debug environment.');\n }\n DB::statement('SET FOREIGN_KEY_CHECKS=0');\n DB::table('role_user')->truncate();\n\n // Root user\n $user = User::find(1);\n $user->assignRole('owner');\n\n $user = User::find(2);\n $user->assignRole('admin');\n\n $user = User::find(3);\n $user->assignRole('admin');\n\n $user = User::find(4);\n $user->assignRole('moderator');\n\n $user = User::find(5);\n $user->assignRole('moderator');\n \n DB::statement('SET FOREIGN_KEY_CHECKS=1');\n }", "public function run()\n {\n Model::unguard();\n\n if (env('DB_CONNECTION') == 'mysql') {\n DB::statement('SET FOREIGN_KEY_CHECKS=0;');\n }\n\n $this->call(RolesTableSeeder::class);\n $this->call(UsersTableSeeder::class);\n $this->call(EntrustTableSeeder::class);\n\n $this->call(AccounttypeSeeder::class);\n $this->call(AppUserTableSeeder::class);\n $this->call(AppEmailUserTableSeeder::class);\n\n\n $this->call(CountryTableSeeder::class);\n $this->call(CityTableSeeder::class);\n\n\n $this->call(PostTypeTableSeeder::class);\n $this->call(PostSubTypeTableSeeder::class);\n // $this->call(PostTableSeeder::class);\n // $this->call(AppPostSolvedTableSeeder::class);\n\n\n $this->call(AppCommentTypeTableSeeder::class);\n // $this->call(AppCommentTableSeeder::class);\n // $this->call(AppSubCommentTableSeeder::class);\n\n\n if (env('DB_CONNECTION') == 'mysql') {\n DB::statement('SET FOREIGN_KEY_CHECKS=1;');\n }\n\n Model::reguard();\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n\n DB::statement('SET FOREIGN_KEY_CHECKS=0;');\n DB::table('users')->truncate();\n DB::table('password_resets')->truncate();\n DB::table('domains')->truncate();\n DB::table('folders')->truncate();\n DB::table('bookmarks')->truncate();\n DB::statement('SET FOREIGN_KEY_CHECKS=1;');\n\n $this->seedUserAccount('[email protected]');\n $this->seedUserAccount('[email protected]');\n }", "public function run()\n {\n DB::statement('SET FOREIGN_KEY_CHECKS = 0');\n // $this->call(UsersTableSeeder::class);\n /* Schema::dropIfExists('employees');\n Schema::dropIfExists('users');\n Schema::dropIfExists('requests');\n Schema::dropIfExists('requeststatus');*/\n User::truncate();\n InstallRequest::truncate();\n RequestStatus::truncate();\n\n $cantidadEmployyes = 20;\n $cantidadUsers = 20;\n $cantidadRequestStatus = 3;\n $cantidadRequests = 200;\n\n factory(User::class, $cantidadUsers)->create();\n factory(RequestStatus::class, $cantidadRequestStatus)->create();\n factory(InstallRequest::class, $cantidadRequests)->create();\n }", "public function run()\n {\n Model::unguard();\n foreach (glob(__DIR__ . '/seeds/*.php') as $filename) {\n require_once($filename);\n }\n // $this->call(UserTableSeeder::class);\n //DB::statement('SET FOREIGN_KEY_CHECKS=0;');\n// $this->call('CustomerTableSeeder');\n $this->call('PhotoTableSeeder');\n// $this->call('ProductTableSeeder');\n// $this->call('StaffTableSeeder');\n// $this->call('PasswordResetsTableSeeder');\n// $this->call('UsersTableSeeder');\n $this->call('CustomersTableSeeder');\n $this->call('EmployeesTableSeeder');\n $this->call('InventoryTransactionTypesTableSeeder');\n $this->call('OrderDetailsTableSeeder');\n $this->call('OrderDetailsStatusTableSeeder');\n $this->call('OrdersTableSeeder');\n $this->call('InvoicesTableSeeder');\n $this->call('OrdersTableSeeder');\n $this->call('OrderDetailsTableSeeder');\n $this->call('OrdersStatusTableSeeder');\n $this->call('OrderDetailsTableSeeder');\n\n $this->call('OrdersTaxStatusTableSeeder');\n $this->call('PrivilegesTableSeeder');\n $this->call('EmployeePrivilegesTableSeeder');\n $this->call('ProductsTableSeeder');\n $this->call('InventoryTransactionsTableSeeder');\n $this->call('PurchaseOrderDetailsTableSeeder');\n\n $this->call('PurchaseOrderStatusTableSeeder');\n $this->call('PurchaseOrdersTableSeeder');\n $this->call('SalesReportsTableSeeder');\n $this->call('ShippersTableSeeder');\n $this->call('StringsTableSeeder');\n $this->call('SuppliersTableSeeder');\n //DB::statement('SET FOREIGN_KEY_CHECKS=1;');\n\n Model::reguard();\n }", "public function run()\n\t{\n $this->cleanDatabase();\n\n Eloquent::unguard();\n\n\t\t$this->call('UsersTableSeeder');\n\t\t$this->call('ProductsTableSeeder');\n\t\t$this->call('CartsTableSeeder');\n $this->call('StoreTableSeeder');\n $this->call('AdvertisementsTableSeeder');\n \n\t}", "public function run()\n {\n \tDB::table('seeds')->truncate();\n\n $seeds = array(\n array(\n 'name' => 'PreferencesTableSeeder_Update_11_18_2013',\n ),\n array(\n 'name' => 'PreferencesTableSeeder_Update_11_20_2013',\n ),\n );\n\n // Uncomment the below to run the seeder\n DB::table('seeds')->insert($seeds);\n }", "public function run()\n {\n $this->createDefaultPermissionSeeder(env('DB_CONNECTION', 'mysql'));\n }", "public function run()\n {\n $this->createDefaultPermissionSeeder(env('DB_CONNECTION', 'mysql'));\n }", "protected function setUp(): void\n {\n $db = new DB;\n\n $db->addConnection([\n 'driver' => 'sqlite',\n 'database' => ':memory:',\n ]);\n\n $db->bootEloquent();\n $db->setAsGlobal();\n\n $this->createSchema();\n }", "public function run()\n {\n //$this->call('UserTableSeeder');\n //$this->call('ProjectTableSeeder');\n //$this->call('TaskTableSeeder');\n\n /**\n * Prepare seeding\n */\n $faker = Faker::create();\n DB::statement('SET FOREIGN_KEY_CHECKS=0');\n Model::unguard();\n\n /**\n * Seeding user table\n */\n App\\User::truncate();\n factory(App\\User::class)->create([\n 'name' => 'KCK',\n 'email' => '[email protected]',\n 'password' => bcrypt('password')\n ]);\n\n /*factory(App\\User::class, 9)->create();\n $this->command->info('users table seeded');*/\n\n /**\n * Seeding roles table\n */\n Spatie\\Permission\\Models\\Role::truncate();\n DB::table('model_has_roles')->truncate();\n $superAdminRole = Spatie\\Permission\\Models\\Role::create([\n 'name' => '최고 관리자'\n ]);\n $adminRole = Spatie\\Permission\\Models\\Role::create([\n 'name' => '관리자'\n ]);\n $regularRole = Spatie\\Permission\\Models\\Role::create([\n 'name' => '정회원'\n ]);\n $associateRole = Spatie\\Permission\\Models\\Role::create([\n 'name' => '준회원'\n ]);\n\n App\\User::where('email', '!=', '[email protected]')->get()->map(function ($user) use ($regularRole) {\n $user->assignRole($regularRole);\n });\n\n App\\User::whereEmail('[email protected]')->get()->map(function ($user) use ($superAdminRole) {\n $user->assignRole($superAdminRole);\n });\n $this->command->info('roles table seeded');\n\n /**\n * Seeding articles table\n */\n App\\Article::truncate();\n $users = App\\User::all();\n\n $users->each(function ($user) use ($faker) {\n $user->articles()->save(\n factory(App\\Article::class)->make()\n );\n });\n $this->command->info('articles table seeded');\n\n /**\n * Seeding comments table\n */\n App\\Comment::truncate();\n $articles = App\\Article::all();\n\n $articles->each(function ($article) use ($faker, $users) {\n for ($i = 0; $i < 10; $i++) {\n $article->comments()->save(\n factory(App\\Comment::class)->make([\n 'author_id' => $faker->randomElement($users->pluck('id')->toArray()),\n //'parent_id' => $article->id\n ])\n );\n };\n });\n $this->command->info('comments table seeded');\n\n /**\n * Seeding tags table\n */\n App\\Tag::truncate();\n DB::table('article_tag')->truncate();\n $articles->each(function ($article) use ($faker) {\n $article->tags()->save(\n factory(App\\Tag::class)->make()\n );\n });\n $this->command->info('tags table seeded');\n\n /**\n * Seeding attachments table\n */\n App\\Attachment::truncate();\n if (!File::isDirectory(attachment_path())) {\n File::deleteDirectory(attachment_path(), true);\n }\n\n $articles->each(function ($article) use ($faker) {\n $article->attachments()->save(\n factory(App\\Attachment::class)->make()\n );\n });\n\n //$files = App\\Attachment::pluck('name');\n\n if (!File::isDirectory(attachment_path())) {\n File::makeDirectory(attachment_path(), 777, true);\n }\n\n /*\n foreach ($files as $file) {\n File::put(attachment_path($file), '');\n }\n */\n\n $this->command->info('attachments table seeded');\n\n /**\n * Close seeding\n */\n Model::reguard();\n DB::statement('SET FOREIGN_KEY_CHECKS=1');\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n\n echo 'seeding permission...', PHP_EOL;\n $permissions = [\n 'role-list',\n 'role-create',\n 'role-edit',\n 'role-delete',\n 'formation-list',\n 'formation-create',\n 'formation-edit',\n 'formation-delete',\n 'user-list',\n 'user-create',\n 'user-edit',\n 'user-delete'\n ];\n foreach ($permissions as $permission) {\n Permission::create(['name' => $permission]);\n }\n echo 'seeding users...', PHP_EOL;\n\n $user= User::create(\n [\n 'name' => 'Mr. admin',\n 'email' => '[email protected]',\n 'password' => bcrypt('admin'),\n 'remember_token' => null,\n ]\n );\n echo 'Create Roles...', PHP_EOL;\n Role::create(['name' => 'former']);\n Role::create(['name' => 'learner']);\n Role::create(['name' => 'admin']);\n Role::create(['name' => 'manager']);\n Role::create(['name' => 'user']);\n\n echo 'seeding Role User...', PHP_EOL;\n $user->assignRole('admin');\n $role = $user->assignRole('admin');\n $role->givepermissionTo(Permission::all());\n\n \\DB::table('languages')->insert(['name' => 'English', 'code' => 'en']);\n \\DB::table('languages')->insert(['name' => 'Français', 'code' => 'fr']);\n }", "public function run()\n {\n $this->call(CountriesTableSeeder::class);\n $this->call(StatesTableSeeder::class);\n $this->call(CitiesTableSeeder::class);\n\n factory(Group::class)->create();\n factory(Contact::class, 5000)->create();\n }", "public function run()\n\t{\n\t\tEloquent::unguard();\n\n\t\t// $this->call('AdminTableSeeder');\n\t\t// $this->call('UserTableSeeder');\n\t\t// $this->call('MenuTableSeeder');\n\t\t// $this->call('ProductTableSeeder');\n\t\t// $this->call('CategoryTableSeeder');\n\t\t// $this->call('OptionTableSeeder');\n\t\t// $this->call('OptionGroupTableSeeder');\n\t\t// $this->call('TypeTableSeeder');\n\t\t// $this->call('LayoutTableSeeder');\n\t\t// $this->call('LayoutDetailTableSeeder');\n\t\t// $this->call('BannerTableSeeder');\n\t\t// $this->call('ConfigureTableSeeder');\n\t\t// $this->call('PageTableSeeder');\n\t\t// $this->call('ImageTableSeeder');\n\t\t// $this->call('ImageableTableSeeder');\n\t\t// ======== new Seed =======\n\t\t$this->call('AdminsTableSeeder');\n\t\t$this->call('BannersTableSeeder');\n\t\t$this->call('CategoriesTableSeeder');\n\t\t$this->call('ConfiguresTableSeeder');\n\t\t$this->call('ImageablesTableSeeder');\n\t\t$this->call('ImagesTableSeeder');\n\t\t$this->call('LayoutsTableSeeder');\n\t\t$this->call('LayoutDetailsTableSeeder');\n\t\t$this->call('MenusTableSeeder');\n\t\t$this->call('OptionablesTableSeeder');\n\t\t$this->call('OptionsTableSeeder');\n\t\t$this->call('OptionGroupsTableSeeder');\n\t\t$this->call('PagesTableSeeder');\n\t\t$this->call('PriceBreaksTableSeeder');\n\t\t$this->call('ProductsTableSeeder');\n\t\t$this->call('ProductsCategoriesTableSeeder');\n\t\t$this->call('SizeListsTableSeeder');\n\t\t$this->call('TypesTableSeeder');\n\t\t$this->call('UsersTableSeeder');\n\t\t$this->call('ContactsTableSeeder');\n\t\t$this->call('RolesTableSeeder');\n\t\t$this->call('PermissionsTableSeeder');\n\t\t$this->call('PermissionRoleTableSeeder');\n\t\t$this->call('AssignedRolesTableSeeder');\n\t\t$this->call('OrdersTableSeeder');\n\t\t$this->call('OrderDetailsTableSeeder');\n\t\tCache::flush();\n\t\t// BackgroundProcess::copyFromVI();\n\t}", "public function run()\n {\n Model::unguard();\n\n User::create([\n 'email' => '[email protected]',\n 'name' => 'admin',\n 'password' => Hash::make('1234'),\n 'email_verified_at' => Carbon::now()\n ]);\n\n factory(User::class, 200)->create();\n\n // $this->call(\"OthersTableSeeder\");\n }", "public function run()\n {\n $this->seedRegularUsers();\n $this->seedAdminUser();\n }", "public function run()\n {\n if (\\App::environment() === 'local') {\n\n // Delete existing data\n\n\n Eloquent::unguard();\n\n //disable foreign key check for this connection before running seeders\n DB::statement('SET FOREIGN_KEY_CHECKS=0;');\n\n // Truncate all tables, except migrations\n $tables = array_except(DB::select('SHOW TABLES'), ['migrations']);\n foreach ($tables as $table) {\n $tables_in_database = \"Tables_in_\" . Config::get('database.connections.mysql.database');\n DB::table($table->$tables_in_database)->truncate();\n }\n\n // supposed to only apply to a single connection and reset it's self\n // but I like to explicitly undo what I've done for clarity\n DB::statement('SET FOREIGN_KEY_CHECKS=1;');\n\n //get roles\n $this->call('AccountSeeder');\n $this->call('CountrySeeder');\n $this->call('StateSeeder');\n $this->call('CitySeeder');\n $this->call('OptionSeeder');\n $this->call('TagSeeder');\n $this->call('PrintTemplateSeeder');\n $this->call('SettingsSeeder');\n\n\n\n if(empty($web_installer)) {\n $admin = Sentinel::registerAndActivate(array(\n 'email' => '[email protected]',\n 'password' => \"admin\",\n 'first_name' => 'Admin',\n 'last_name' => 'Doe',\n ));\n $admin->user_id = $admin->id;\n $admin->save();\n\n $adminRole = Sentinel::findRoleById(1);\n $adminRole->users()->attach($admin);\n }\n else {\n $admin = Sentinel::findById(1);\n }\n\n //add dummy staff and customer\n $staff = Sentinel::registerAndActivate(array(\n 'email' => '[email protected]',\n 'password' => \"staff\",\n 'first_name' => 'Staff',\n 'last_name' => 'Doe',\n ));\n $admin->users()->save($staff);\n\n foreach ($this->getPermissions() as $permission) {\n $staff->addPermission($permission);\n }\n $staff->save();\n\n $customer = Sentinel::registerAndActivate(array(\n 'email' => '[email protected]',\n 'password' => \"customer\",\n 'first_name' => 'Customer',\n 'last_name' => 'Doe',\n ));\n Customer::create(array('user_id' => $customer->id, 'belong_user_id' => $staff->id));\n $staff->users()->save($customer);\n\n //add respective roles\n\n $staffRole = Sentinel::findRoleById(2);\n $staffRole->users()->attach($staff);\n $customerRole = Sentinel::findRoleById(3);\n $customerRole->users()->attach($customer);\n\n\n\n DB::table('sales_teams')->truncate();\n DB::table('opportunities')->truncate();\n\n //Delete existing seeded users except the first 4 users\n User::where('id', '>', 3)->get()->each(function ($user) {\n $user->forceDelete();\n });\n\n //Get the default ADMIN\n $user = User::find(1);\n $staffRole = Sentinel::getRoleRepository()->findByName('staff');\n $customerRole = Sentinel::getRoleRepository()->findByName('customer');\n\n //Seed Sales teams for default ADMIN\n foreach (range(1, 4) as $j) {\n $this->createSalesTeam($user->id, $j, $user);\n $this->createOpportunity($user, $user->id, $j);\n }\n\n\n //Get the default STAFF\n $staff = User::find(2);\n $this->createSalesTeam($staff->id, 1, $staff);\n $this->createSalesTeam($staff->id, 2, $staff);\n\n //Seed Sales teams for each STAFF\n foreach (range(1, 4) as $j) {\n $this->createSalesTeam($staff->id, $j, $staff);\n $this->createOpportunity($staff, $staff->id, $j);\n }\n\n foreach (range(1, 3) as $i) {\n $staff = $this->createStaff($i);\n $user->users()->save($staff);\n $staffRole->users()->attach($staff);\n\n $customer = $this->createCustomer($i);\n $staff->users()->save($customer);\n $customerRole->users()->attach($customer);\n $customer->customer()->save(factory(\\App\\Models\\Customer::class)->make());\n\n\n //Seed Sales teams for each STAFF\n foreach (range(1, 5) as $j) {\n $this->createSalesTeam($staff->id, $j, $staff);\n $this->createOpportunity($staff, $i, $j);\n }\n\n }\n\n //finally call it installation is finished\n file_put_contents(storage_path('installed'), 'Welcome to LCRM');\n }\n }", "public function run()\n {\n if (env('DB_DATABASE') == 'connection') {\n Connection::create([\n \"ruc\" => \"12312312312\",\n \"basedata\" => \"nbdata2018_1\",\n ]);\n \n Connection::create([\n \"ruc\" => \"12312312315\",\n \"basedata\" => \"nbdata2018_2\",\n ]);\n \n $this->call(ConnectionTableSeeder::class);\n } else {\n $this->call(AppSeeder::class);\n }\n }", "public function setupDatabase()\n {\n exec('rm ' . storage_path() . '/testdb.sqlite');\n exec('cp ' . 'database/database.sqlite ' . storage_path() . '/testdb.sqlite');\n }", "public function run()\n {\n DB::statement('SET FOREIGN_KEY_CHECKS=0;');\n // Let's truncate our existing records to start from scratch.\n Assignation::truncate();\n\n $faker = \\Faker\\Factory::create();\n \n // And now, let's create a few articles in our database:\n for ($i = 0; $i < 40; $i++) {\n Assignation::create([\n 'ad_id' => $faker->numberBetween(1,20),\n 'buyer_id' => $faker->numberBetween(1,6),\n 'seller_id' => $faker->numberBetween(6,11),\n 'state' => NULL,\n ]);\n }\n\n DB::statement('SET FOREIGN_KEY_CHECKS=1;');\n }", "public function run()\n {\n # truncates tables before seeding\n foreach ($this->toTruncate as $table) {\n DB::table($table)->delete();\n }\n\n factory(App\\Models\\Product::class, 25)->create();\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n DB::statement('SET FOREIGN_KEY_CHECKS=0');\n Post::truncate();\n Comment::truncate();\n // CommentReply::truncate();\n \n\n\n factory(User::class,10)->create();\n factory(Post::class,20)->create();\n factory(Comment::class,30)->create();\n // factory(CommentReply::class,30)->create();\n }", "public function run()\n\t{\n \n Eloquent::unguard();\n //DB::statement('SET FOREIGN_KEY_CHECKS=0;');\n\t\t$this->call('UserTableSeeder');\n\t $this->call('LayerTableSeeder');\n $this->call('UserLevelTableSeeder');\n $this->call('RoleUserTableSeeder');\n $this->call('RoleLayerTableSeeder');\n $this->call('BookmarkTableSeeder');\n \n //DB::statement('SET FOREIGN_KEY_CHECKS=1;');\n\t}", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n DB::statement('SET FOREIGN_KEY_CHECKS = 0');\n\n // Sample::truncate();\n // TestItem::truncate();\n // UOM::truncate();\n Role::truncate();\n User::truncate();\n\n // factory(Role::class, 4)->create();\n Role::create([\n 'name'=> 'Director',\n 'description'=> 'Director type'\n ]);\n\n Role::create([\n 'name'=> 'Admin',\n 'description'=> 'Admin type'\n ]);\n Role::create([\n 'name'=> 'Employee',\n 'description'=> 'Employee type'\n ]);\n Role::create([\n 'name'=> 'Technician',\n 'description'=> 'Technician type'\n ]);\n \n factory(User::class, 20)->create()->each(\n function ($user){\n $roles = \\App\\Role::all()->random(mt_rand(1, 2))->pluck('id');\n $user->roles()->attach($roles);\n }\n );\n }", "public function run()\n {\n DatabaseSeeder::seedLearningStylesProbs();\n DatabaseSeeder::seedCampusProbs();\n DatabaseSeeder::seedGenderProbs();\n DatabaseSeeder::seedTypeStudentProbs();\n DatabaseSeeder::seedTypeProfessorProbs();\n DatabaseSeeder::seedNetworkProbs();\n }", "public function run()\n {\n /** \n * Note: You must add these lines to your .env file for this Seeder to work (replace the values, obviously):\n SEEDER_USER_FIRST_NAME = 'Firstname'\n SEEDER_USER_LAST_NAME = 'Lastname'\n\t\tSEEDER_USER_DISPLAY_NAME = 'Firstname Lastname'\n\t\tSEEDER_USER_EMAIL = [email protected]\n SEEDER_USER_PASSWORD = yourpassword\n */\n\t\tDB::table('users')->insert([\n 'user_first_name' => env('SEEDER_USER_FIRST_NAME'),\n 'user_last_name' => env('SEEDER_USER_LAST_NAME'),\n 'user_name' => env('SEEDER_USER_DISPLAY_NAME'),\n\t\t\t'user_email' => env('SEEDER_USER_EMAIL'),\n 'user_status' => 1,\n \t'password' => Hash::make((env('SEEDER_USER_PASSWORD'))),\n 'permission_fk' => 1,\n 'created_at' => Carbon::now()->format('Y-m-d H:i:s'),\n 'updated_at' => Carbon::now()->format('Y-m-d H:i:s')\n ]);\n }", "public function run()\n {\n DB::statement('SET foreign_key_checks = 0');\n DB::table('topics')->truncate();\n\n factory(\\App\\Topic::class, 100)->create();\n // ->each(function($topic) {\n\n // // Seed para a relação com group\n // $topic->group()->save(factory(App\\Group::class)->make());\n\n // // Seed para a relação com topicMessages\n // $topic->topicMessages()->save(factory(App\\TopicMessage::class)->make());\n\n // // Seed para a relação com user\n // $topic->user()->save(factory(App\\User::class)->make());\n // });\n \n DB::statement('SET foreign_key_checks = 1');\n }", "public function run()\n {\n\n factory('App\\Models\\Pessoa', 60)->create();\n factory('App\\Models\\Profissional', 10)->create();\n factory('App\\Models\\Paciente', 50)->create();\n $this->call(UsersTableSeeder::class);\n $this->call(ProcedimentoTableSeeder::class);\n // $this->call(PessoaTableSeeder::class);\n // $this->call(ProfissionalTableSeeder::class);\n // $this->call(PacienteTableSeeder::class);\n // $this->call(AgendaProfissionalTableSeeder::class);\n }", "public function run()\n {\n DB::statement('SET FOREIGN_KEY_CHECKS = 0');\n Categoria::truncate();\n Atractivo::truncate();\n Galeria::truncate();\n User::truncate();\n\n $this->call(CategoriasTableSeeder::class);\n $this->call(AtractivosTableSeeder::class);\n $this->call(GaleriasTableSeeder::class);\n $this->call(UsersTableSeeder::class);\n\n }", "public function run(Faker $faker)\n {\n Schema::disableForeignKeyConstraints();\n DB::table('users')->insert([\n 'name' => $faker->name(),\n 'email' => '[email protected]',\n 'password' => Hash::make('12345678'),\n ]);\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n DB::statement('SET FOREIGN_KEY_CHECKS = 0'); // TO PREVENT CHECKS FOR foreien key in seeding\n\n User::truncate();\n Category::truncate();\n Product::truncate();\n Transaction::truncate();\n\n DB::table('category_product')->truncate();\n\n User::flushEventListeners();\n Category::flushEventListeners();\n Product::flushEventListeners();\n Transaction::flushEventListeners();\n\n $usersQuantities = 1000;\n $categoriesQuantities = 30;\n $productsQuantities = 1000;\n $transactionsQuantities = 1000;\n\n factory(User::class, $usersQuantities)->create();\n factory(Category::class, $categoriesQuantities)->create();\n\n factory(Product::class, $productsQuantities)->create()->each(\n function ($product) {\n $categories = Category::all()->random(mt_rand(1, 5))->pluck('id');\n $product->categories()->attach($categories);\n });\n\n factory(Transaction::class, $transactionsQuantities)->create();\n }", "public function run()\n {\n\t $this->call(CategoryTableSeed::class);\n\t $this->call(ProductTableSeed::class);\n\t $this->call(UserTableSeed::class);\n }", "public function run()\n {\n $this->cleanDatabase();\n\n factory(User::class, 50)->create();\n factory(Document::class, 30)->create();\n }", "public function run()\n {\n // \\DB::statement('SET_FOREIGN_KEY_CHECKS=0');\n \\DB::table('users')->truncate();\n \\DB::table('posts')->truncate();\n // \\DB::table('category')->truncate();\n \\DB::table('photos')->truncate();\n \\DB::table('comments')->truncate();\n \\DB::table('comment_replies')->truncate();\n\n \\App\\Models\\User::factory()->times(10)->hasPosts(1)->create();\n \\App\\Models\\Role::factory()->times(10)->create();\n \\App\\Models\\Category::factory()->times(10)->create();\n \\App\\Models\\Comment::factory()->times(10)->hasReplies(1)->create();\n \\App\\Models\\Photo::factory()->times(10)->create();\n\n \n // \\App\\Models\\User::factory(10)->create([\n // 'role_id'=>2,\n // 'is_active'=>1\n // ]);\n\n // factory(App\\Models\\Post::class, 10)->create();\n // $this->call(UsersTableSeeder::class);\n }", "public function run()\n {\n \t// DB::table('webapps')->delete();\n\n $webapps = array(\n\n );\n\n // Uncomment the below to run the seeder\n // DB::table('webapps')->insert($webapps);\n }", "public function run()\n {\n DB::table('users')->insert([\n 'name'=>\"test\",\n 'password' => Hash::make('123'),\n 'email'=>'[email protected]'\n ]);\n DB::table('tags')->insert(['name'=>'tags']);\n $this->call(UserSeed::class);\n $this->call(CategoriesSeed::class);\n $this->call(TopicsSeed::class);\n $this->call(CommentariesSeed::class);\n // $this->call(UsersTableSeeder::class);\n }", "public function run()\n {\n $tables = array(\n 'users',\n 'companies',\n 'stands',\n 'events',\n 'visitors',\n 'api_keys'\n );\n\n if (!App::runningUnitTests()) {\n DB::statement('SET FOREIGN_KEY_CHECKS = 0');\n }\n\n foreach ($tables as $table) {\n DB::table($table)->truncate();\n }\n\n $this->call(UsersTableSeeder::class);\n $this->call(EventsTableSeeder::class);\n $this->call(CompaniesTableSeeder::class);\n $this->call(StandsTableSeeder::class);\n $this->call(VisitorsTableSeeder::class);\n\n if (!App::runningUnitTests()) {\n DB::statement('SET FOREIGN_KEY_CHECKS = 1');\n }\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n DB::statement('SET FOREIGN_KEY_CHECKS = 0');\n\n Language::truncate();\n Reason::truncate();\n Report::truncate();\n Category::truncate();\n Position::truncate();\n\n $languageQuantity = 10;\n $reasonQuantity = 10;\n $reportQuantity = 10;\n $categoryQuantity = 10;\n $positionQuantity = 10;\n\n factory(Language::class,$languageQuantity)->create();\n factory(Reason::class,$reasonQuantity)->create();\n \n factory(Report::class,$reportQuantity)->create();\n \n factory(Category::class,$categoryQuantity)->create();\n \n factory(Position::class,$positionQuantity)->create();\n\n }", "public function run()\n {\n $clear = $this->command->confirm('Wil je de database leegmaken? (Dit haalt alle DATA weg)');\n\n if ($clear):\n $this->command->callSilent('migrate:refresh');\n $this->command->info('Database Cleared, starting seeding');\n endif;\n\n $this->call([\n SeedSeeder::class,\n RoleSeeder::class,\n UserSeeder::class,\n // BoardgameSeeder::class,\n BoardgamesTableSeeder::class,\n StatusSeeder::class,\n TournamentSeeder::class,\n AchievementsSeeder::class,\n TournamentUsersSeeder::class,\n ]);\n }", "public function run()\n {\n DB::statement('SET FOREIGN_KEY_CHECKS = 0');\n $this->call(PaisSeeder::class);\n $this->call(DepartamentoSeeder::class);\n $this->call(MunicipioSeeder::class);\n $this->call(PersonaSeeder::class);\n }", "public function run()\n {\n //\n if (App::environment() === 'production') {\n exit('Do not seed in production environment');\n }\n\n DB::statement('SET FOREIGN_KEY_CHECKS = 0'); // disable foreign key constraints\n\n DB::table('events')->truncate();\n \n Event::create([\n 'id' => 1,\n 'name' => 'Spot Registration For Throat Cancer',\n 'cancerId' => 1,\n 'startDate'\t\t=> Carbon::now(),\n 'endDate'\t\t=> Carbon::now()->addMonths(12),\n 'eventType'\t\t=> 'register',\n 'formId'\t\t=> null,\n ]);\n\n Event::create([\n 'id' => 2,\n 'name' => 'Spot Screening For Throat Cancer',\n 'cancerId' => 1,\n 'startDate'\t\t=> Carbon::now(),\n 'endDate'\t\t=> Carbon::now()->addMonths(12),\n 'eventType'\t\t=> 'screen',\n 'formId'\t\t=> 1,\n ]);\n \n Event::create([\n 'id' => 3,\n 'name' => 'Spot Registration For Skin Cancer',\n 'cancerId' => 2,\n 'startDate'\t\t=> Carbon::now(),\n 'endDate'\t\t=> Carbon::now()->addMonths(12),\n 'eventType'\t\t=> 'register',\n 'formId'\t\t=> null,\n ]);\n\n\n Event::create([\n 'id' => 3,\n 'name' => 'Registration cum Screening camp for Throat Cancer',\n 'cancerId' => 1,\n 'startDate'\t\t=> Carbon::now(),\n 'endDate'\t\t=> Carbon::now()->addWeeks(1),\n 'eventType'\t\t=> 'register_screen',\n 'formId'\t\t=> 1,\n ]);\n \n DB::statement('SET FOREIGN_KEY_CHECKS = 1'); // enable foreign key constraints\n\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n // Para que no verifique el control de claves foráneas al hacer el truncate haremos:\n\t\tDB::statement('SET FOREIGN_KEY_CHECKS=0');\n\n\t\t// Primero hacemos un truncate de las tablas para que no se estén agregando datos\n\t\t// cada vez que ejecutamos el seeder.\n\t\t//Foto::truncate();\n\t\t//Album::truncate();\n\t\t//Usuario::truncate();\n DB::table('users')->delete();\n DB::table('ciudades')->delete();\n DB::table('tiendas')->delete();\n DB::table('ofertas')->delete();\n DB::table('ventas')->delete();\n\n\n\t\t// Es importante el orden de llamada.\n\t\t$this->call('UserSeeder');\n $this->call('CiudadSeeder');\n\t\t$this->call('TiendaSeeder');\n $this->call('OfertaSeeder');\n $this->call('VentaSeeder');\n }", "public function run()\n {\n $this->call(\\Database\\Seeders\\GroupByRecordTableSeeder::class);\n $this->call(\\Database\\Seeders\\SingleIndexRecordTableSeeder::class);\n $this->call(\\Database\\Seeders\\MultiIndexRecordTableSeeder::class);\n $this->call(\\Database\\Seeders\\JoinFiveTablesSeeder::class);\n\n// DB::table('users')->truncate();\n// DB::table('user_details')->truncate();\n//\n// // 試しに一回流す\n// $data = $this->makeData(0, 'userFactory', 1);\n// DB::table('users')->insert($data);\n// $data = $this->makeData(0, 'userDetailFactory', 1);\n// DB::table('user_details')->insert($data);\n//\n// // $this->call(UsersTableSeeder::class);\n// DB::table('users')->truncate();\n// DB::table('user_details')->truncate();\n//\n// for ($i = 0; $i < 40; $i++) {\n// $data = $this->makeData($i, 'userFactory', 2500);\n// DB::table('users')->insert($data);\n// }\n//\n// for ($i = 0; $i < 40; $i++) {\n// $data = $this->makeData($i, 'userDetailFactory', 2500);\n// DB::table('user_details')->insert($data);\n// }\n }", "public function run()\n {\n $this->truncateTables([\n 'users',\n 'categories',\n 'types',\n 'courses',\n 'classrooms',\n 'contents',\n 'companies',\n ]);\n\n $this->call(CompanyTableSeeder::class);\n $this->call(TypeTableSeeder::class);\n $this->call(RoleTableSeeder::class);\n $this->call(CategoryTableSeeder::class);\n $this->call(CoursesTableSeeder::class);\n $this->call(PermissionTableSeeder::class);\n $this->call(ContentTableSeeder::class);\n $this->call(UserTableSeeder::class);\n $this->call(ClassroomTableSeeder::class);\n $this->call(TestTableSeeder::class);\n $this->call(BankTableSeeder::class);\n\n\n // factory(\\App\\User::class, 50)\n // ->create()\n // ->each(function ($user) {\n // // $user->companies()->save();\n // $company = \\App\\Company::inRandomOrder()->first();\n // $user->companies()->attach($company->id);\n // $user->assignRole(['participante']);\n // });\n /*\n factory(\\App\\User::class, 50)\n ->create()\n ->each(function ($user) {\n $user->assignRole(['participante']);\n });*/\n }", "public function run()\n { \n\n $this->call(RoleSeeder::class);\n \n $this->call(UserSeeder::class);\n\n Storage::deleteDirectory('socials-icon');\n Storage::makeDirectory('socials-icon');\n $socials = Social::factory(7)->create();\n\n Storage::deleteDirectory('countries-flag');\n Storage::deleteDirectory('countries-firm');\n Storage::makeDirectory('countries-flag');\n Storage::makeDirectory('countries-firm');\n $countries = Country::factory(18)->create();\n\n // Se llenan datos de la tabla muchos a muchos - social_country\n foreach ($countries as $country) {\n foreach ($socials as $social) {\n\n $country->socials()->attach($social->id, [\n 'link' => 'https://www.facebook.com/ministeriopalabrayespiritu/'\n ]);\n }\n }\n\n Person::factory(50)->create();\n\n Category::factory(7)->create();\n\n Video::factory(25)->create(); \n\n $this->call(PostSeeder::class);\n\n Storage::deleteDirectory('documents');\n Storage::makeDirectory('documents');\n Document::factory(25)->create();\n\n }", "public function run()\n {\n DB::statement('SET FOREIGN_KEY_CHECKS = 0');\n\n User::truncate();\n Question::truncate();\n Option::truncate();\n// Answer::truncate();\n Quiz::truncate();\n QuizQuestion::truncate();\n\n //for admin\n $admin = factory(User::class)->create([\n 'name' => 'Admin',\n 'email' => '[email protected]',\n 'is_admin' => 1,\n ]);\n\n //for user\n $user = factory(User::class)->create([\n 'name' => 'User',\n 'email' => '[email protected]',\n ]);\n\n factory(Question::class, 100)->create()->each(function ($question) {\n factory(Option::class, mt_rand(2, 4))->create([\n 'question_id' => $question->id,\n ]);\n });\n\n factory(Quiz::class, 10)->create()->each(function ($quiz) {\n\n factory(QuizQuestion::class, mt_rand(5, 10))->create();\n });\n\n\n }", "public function run()\n {\n $this->call([\n SiteSettingsSeeder::class,\n LaratrustSeeder::class,\n CountrySeeder::class,\n GovernorateSeeder::class,\n FaqSeeder::class,\n SitePageSeeder::class,\n UsersSeeder::class,\n ]);\n\n Country::whereiso(\"EG\")->update(['enable_shipping' => true]);\n\n factory(User::class, 400)->create();\n\n Category::create([\n 'en' => [\n 'name' => \"cake tools\"\n ]\n ]);\n\n Category::create([\n 'en' => [\n 'name' => \"Party Supplies\"\n ]\n ]);\n\n $this->call([\n ProductCategorySeeder::class,\n ProductSeeder::class\n ]);\n }", "public function run()\n {\n $this->call(PermissionsTableSeeder::class);\n\n if (App::environment('local')) {\n $this->call(FakeUsersTableSeeder::class);\n $this->call(FakeArticlesTableSeeder::class);\n $this->call(FakeEventsTableSeeder::class);\n }\n }", "public function run()\n {\n Model::unguard();\n\n $this->call(CategoryTypesTableSeeder::class);\n $this->call(CategoryTableSeeder::class);\n $this->call(AccountTypesTableSeeder::class);\n $this->call(TransactionTypesTableSeeder::class);\n\n if (App::environment() !== 'production') {\n $this->call(UserTableSeeder::class);\n $this->call(AccountBudgetTableSeeder::class);\n $this->call(TransactionTableSeeder::class);\n }\n\n Model::reguard();\n }", "public function run()\n {\n User::truncate();\n Product::truncate();\n User::forceCreate([\n 'name' => 'foo',\n 'email' => '[email protected]',\n 'password' => bcrypt('password'),\n ]);\n factory(User::class, 5)->create();\n factory(Product::class, 5)->create();\n }", "public function run()\n {\n $faker = Faker::create();\n\n // $this->call(UsersTableSeeder::class);\n\n DB::table('posts')->insert([\n 'id'=>str_random(1),\n 'user_id'=> str_random(1),\n 'title' => $faker->name,\n 'body' => $faker->safeEmail,\n 'created_at' => date('Y-m-d H:i:s'),\n 'updated_at' => date('Y-m-d H:i:s'),\n ]);\n }", "public function run()\n {\n $this->call([UsersTableSeeder::class]);\n $this->call([ContratosTableSeeder::class]);\n $this->call([UsuariosTableSeeder::class]);\n $this->call([UnidadesTableSeeder::class]);\n $this->call([AtestadosTableSeeder::class]);\n }", "public function run()\n {\n Model::unguard();\n\n // $this->call(\"OthersTableSeeder\");\n\n // DB::table('locations')->insert([\n // 'id' => 1,\n // 'name' => 'Default',\n // 'name' => 'district',\n // 'district_id' => 1,\n // 'province_id' => 1,\n // ]);\n }", "public function run()\n {\n $data = include env('DATA_SEED');\n\n \\Illuminate\\Support\\Facades\\DB::table('endpoints')->insert((array)$data);\n }", "public function run()\n {\n DB::statement('SET FOREIGN_KEY_CHECKS=0');\n DB::table('admins')->truncate();\n\n for ($i = 0; $i < 10; $i++)\n {\n $faker = Factory::create('en_US');\n $values = [\n 'name' => $faker->userName,\n 'email' => $faker->freeEmail,\n 'password' => bcrypt($faker->password),\n 'phone' => $faker->phoneNumber,\n 'status' => random_int(0,1)\n ];\n admin::create($values);\n }\n DB::statement('SET FOREIGN_KEY_CHECKS=1');\n }", "public function run()\n {\n DB::statement('SET FOREIGN_KEY_CHECKS=0');\n\n DB::beginTransaction();\n// $this->seed();\n DB::commit();\n\n DB::statement('SET FOREIGN_KEY_CHECKS=1');\n }", "public function run()\n {\n \\DB::table('provinces')->delete();\n \\DB::table('cities')->delete();\n \\DB::table('districts')->delete();\n // import provinces and cities from sql file\n $sqlFile = app_path() . '/../database/raw/administrative_indonesia_without_districts.sql';\n DB::unprepared(file_get_contents($sqlFile));\n $this->command->info('Successfully seed Provinces and Cities!');\n\n // import districts with latitude and longitude from csv file\n $csvFile = app_path() . '/../database/raw/administrative_indonesia_districts_with_lat_lng.csv';\n $districts = $this->csvToArray($csvFile);\n // check if lat lng exists\n foreach ($districts as $i => $d) {\n if ($d['latitude'] == '') $districts[$i]['latitude'] = 0;\n if ($d['longitude'] == '') $districts[$i]['longitude'] = 0;\n }\n // insert it\n $insert = District::insert($districts);\n if ($insert) $this->command->info('Successfully seed Districts!');\n }", "public function run()\n {\n $this->call(UsersTableSeeder::class);\n $this->call(RegionsTableSeeder::class);\n $this->call(ProvincesTableSeeder::class);\n $this->call(DistrictsTableSeeder::class);\n $this->call(SubDistrictsTableSeeder::class);\n $this->call(PostcodesTableSeeder::class);\n\n if (env('APP_ENV') !== 'production') {\n // Wipe up 5 churches, and each church has 5 cells, and each cell has 20 members associated with.\n // In other word, we wipe up 500 church members.\n for ($i = 0; $i < 2; $i++) {\n $church = factory(\\App\\Models\\Church::class)->create();\n\n $church->areas()->saveMany(factory(\\App\\Models\\Area::class, 2)->create([\n 'church_id' => $church->id\n ])->each(function($area) {\n $area->cells()->saveMany(factory(\\App\\Models\\Cell::class, 2)->create([\n 'area_id' => $area->id\n ])->each(function($cell) {\n $cell->members()->saveMany(factory(App\\Models\\Member::class, 10)->create([\n 'cell_id' => $cell\n ]));\n }));\n }));\n }\n }\n }", "public function run()\n {\n User::create([\n 'name' => 'Regynald',\n 'email' => '[email protected]',\n 'password' => Hash::make('123456789'),\n 'url' => 'http://zreyleo-code.com',\n ]);\n\n User::create([\n 'name' => 'Leonardo',\n 'email' => '[email protected]',\n 'password' => Hash::make('123456789')\n ]);\n\n // seed sin model\n /* DB::table('users')->insert([\n 'name' => 'Regynald',\n 'email' => '[email protected]',\n 'password' => Hash::make('123456789'),\n 'url' => 'http://zreyleo-code.com',\n 'created_at' => date('Y-m-d H:i:s'),\n 'updated_at' => date('Y-m-d H:i:s')\n ]); */\n }", "public function run()\n {\n\n DB::table('clients')->delete();\n DB::table('trips')->delete();\n error_log('empty tables done.');\n\n $random_cities = City::inRandomOrder()->select('ar_name')->limit(5)->get();\n $GLOBALS[\"random_cities\"] = $random_cities->pluck('ar_name')->toArray();\n\n $random_airlines = Airline::inRandomOrder()->select('code')->limit(5)->get();\n $GLOBALS[\"random_airlines\"] = $random_airlines->pluck('code')->toArray();\n\n factory(App\\Client::class, 5)->create();\n error_log('Client seed done.');\n\n\n factory(App\\Trip::class, 50)->create();\n error_log('Trip seed done.');\n\n\n factory(App\\Quicksearch::class, 10)->create();\n error_log('Quicksearch seed done.');\n }", "public function run()\n {\n // \\App\\Models\\User::factory(10)->create();\n\n User::factory()->create([\n 'name' => 'Carlos',\n 'email' => '[email protected]',\n 'email_verified_at' => now(),\n 'password' => bcrypt('123456'), // password\n 'remember_token' => Str::random(10),\n ]);\n \n $this->call([PostsTableSeeder::class]);\n $this->call([TagTableSeeder::class]);\n\n }", "public function run()\n {\n $this->environmentPath = env('APP_ENV') === 'production' ||\n env('APP_ENV') === 'qa' ||\n env('APP_ENV') === 'integration' ?\n 'Production':\n 'local';\n //disable FK\n Model::unguard();\n DB::statement(\"SET session_replication_role = 'replica';\");\n\n // $this->call(HrEmployeeTableSeeder::class);\n $this->call(\"Modules\\HR\\Database\\Seeders\\\\$this->environmentPath\\HrEmployeePosTableSeeder\");\n // $this->call(HrEmployeePresetsDiscountTableSeeder::class);\n\n // Enable FK\n DB::statement(\"SET session_replication_role = 'origin';\");\n Model::reguard();\n }", "public function run()\n {\n $this->call(RoleTableSeeder::class);\n $this->call(UserTableSeeder::class);\n \n factory('App\\Cat', 5)->create();\n $tags = factory('App\\Tag', 8)->create();\n\n factory(Post::class, 15)->create()->each(function($post) use ($tags){\n $post->comments()->save(factory(Comment::class)->make());\n $post->tags()->attach( $tags->random(mt_rand(1,4))->pluck('id')->toArray() );\n });\n }", "protected static function seed()\n {\n foreach (self::fetch('database/seeds', false) as $file) {\n Bus::need($file);\n }\n }", "public function run()\n {\n DB::statement('SET FOREIGN_KEY_CHECKS=0;');\n $faker = F::create('App\\Proovedores');\n for($i=0; $i < 10; $i++){\n DB::table('users')->insert([\n 'usuario' => $i,\n 'password' => $i,\n 'email' => $faker->email,\n ]);\n }\n DB::statement('SET FOREIGN_KEY_CHECKS=1;');\n }", "public function run()\n {\n DB::statement('SET FOREIGN_KEY_CHECKS=0;');\n // Delete all records.\n DB::table('users')->delete();\n // Reset AUTO_INCREMENT.\n DB::table('users')->truncate();\n\n // Dev user.\n App\\Models\\User::create([\n 'email' => '[email protected]',\n 'password' => '$2y$10$t6q81nz.XrMrh20NHDvxUu/szwHBwgzPd.01e8uuP0qVy0mPa6H/e',\n 'first_name' => 'L5',\n 'last_name' => 'App',\n 'username' => 'l5-app',\n 'is_email_verified' => 1,\n ]);\n\n // Dummy users.\n TestDummy::times(10)->create('App\\Models\\User');\n }", "public function run()\n {\n // Let's truncate our existing records to start from scratch.\n User::truncate();\n\n $faker = \\Faker\\Factory::create();\n\n // We did this for test purposes. Shouldn't be doing this for production\n $password = Hash::make('123456');\n\n User::create([\n 'name' => 'Administrator',\n 'email' => '[email protected]',\n 'password' => $password,\n ]);\n }", "public function run()\n {\n Model::unguard();\n \n factory('App\\User','admin')->create();\n factory('App\\Evento',100)->create();\n //factory('App\\User','miembro',10)->create();\n factory('App\\Telefono',13)->create();\n factory('App\\Notificacion',10)->create();\n factory('App\\Rubro',10)->create();\n factory('App\\Tecnologia',10)->create();\n factory('App\\Cultivo',10)->create();\n factory('App\\Etapa',10)->create();\n factory('App\\Variedad',10)->create();\n factory('App\\Caracteristica',10)->create();\n factory('App\\Practica',30)->create();\n factory('App\\Tag',15)->create();\n // $this->call(PracticaTableSeeder::class);\n $this->call(TrTableSeeder::class);\n $this->call(MesTableSeeder::class);\n $this->call(SemanasTableSeeder::class);\n $this->call(PsTableSeeder::class);\n $this->call(MsTableSeeder::class);\n $this->call(CeTableSeeder::class);\n $this->call(CvTableSeeder::class);\n $this->call(PtSeeder::class);\n \n\n Model::unguard();\n }", "public function run() {\n $this->call(UserSeeder::class);\n $this->call(PermissionSeeder::class);\n $this->call(CreateAdminUserSeeder::class);\n // $this->call(PhoneSeeder::class);\n // $this->call(AddressSeeder::class);\n\n $this->call(ContactFormSeeder::class);\n //$this->call(ContactSeeder::class);\n\n User::factory()->count(20)->create()->each(function ($user) {\n // Seed the relation with one address\n $address = Address::factory()->make();\n $user->address()->save($address);\n\n // Seed the relation with one phone\n $phone = Phone::factory()->make();\n $user->phone()->save($phone);\n\n // Seed the relation with 15 contacts\n $contact = Contact::factory()->count(25)->make();\n $user->contacts()->saveMany($contact);\n });\n }", "public function run()\n {\n $this->call(UsersSeeder::class);\n User::factory(2)->create();\n Company::factory(2)->create();\n\n }", "public function run()\n {\n DB::statement('SET FOREIGN_KEY_CHECKS=0');\n Activity::truncate();\n User::truncate();\n DB::statement('SET FOREIGN_KEY_CHECKS=1');\n $this->call(UserTableSeeder::class);\n $this->call(ActivityTableSeeder::class);\n }", "public function run()\n {\n $this->call(CategoriasTableSeeder::class);\n $this->call(UfsTableSeeder::class);\n $this->call(UsersTableSeeder::class);\n $this->call(UserTiposTableSeeder::class);\n factory(App\\User::class, 2)->create();\n/* factory(App\\Models\\Categoria::class, 20)->create();*/\n/* factory(App\\Models\\Anuncio::class, 50)->create();*/\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n\n DB::statement('SET FOREIGN_KEY_CHECKS = 0');\n\n \\App\\User::truncate();\n \\App\\Category::truncate();\n \\App\\Product::truncate();\n \\App\\Transaction::truncate();\n DB::table('category_product')->truncate();\n\n \\App\\User::flushEventListeners();\n \\App\\Category::flushEventListeners();\n \\App\\Product::flushEventListeners();\n \\App\\Transaction::flushEventListeners();\n\n\n $usersQuentity = 1000;\n $categoriesQuentity = 30;\n $productsQuentity = 1000;\n $transactionsQuentity = 1000;\n\n factory(\\App\\User::class, $usersQuentity)->create();\n factory(\\App\\Category::class, $categoriesQuentity)->create();\n factory(\\App\\Product::class, $productsQuentity)->create()->each(\n function ($product){\n $categories = \\App\\Category::all()->random(mt_rand(1, 5))->pluck('id');\n\n $product->categories()->attach($categories);\n }\n );\n factory(\\App\\Transaction::class, $transactionsQuentity)->create();\n\n }", "public function run()\n {\n Eloquent::unguard();\n \n $this->call('AdminMemberTableSeeder');\n $this->call('BankInfoTableSeeder');\n $this->call('LocationLookUpTableSeeder');\n $this->call('OrderStatusTableSeeder');\n $this->call('AdminRoleTableSeeder');\n\n }", "public static function setUpBeforeClass()\n {\n parent::setUpBeforeClass();\n $app = require __DIR__ . '/../../bootstrap/app.php';\n /** @var \\Pterodactyl\\Console\\Kernel $kernel */\n $kernel = $app->make(Kernel::class);\n $kernel->bootstrap();\n $kernel->call('migrate:fresh');\n\n \\Artisan::call('db:seed');\n }", "public function run()\n {\n Model::unguard();\n\n if( !User::where('email', '[email protected]')->count() ) {\n User::create([\n 'nombre'=>'Nick'\n ,'apellidos'=>'Palomino'\n ,'email'=>'[email protected]'\n ,'password'=> Hash::make('1234567u')\n ,'celular'=>'966463589'\n ]);\n }\n\n $this->call('CategoriaTableSeeder');\n $this->call('WhateverSeeder');\n $this->call('ProductTableSeeder');\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n // $this->call(QuestionTableSeed::class);\n\n $this->call([\n QuestionTableSeed::class,\n AlternativeTableSeed::class,\n ScheduleActionTableSeeder::class,\n UserTableSeeder::class,\n CompanyClassificationTableSeed::class,\n ]);\n // DB::table('clients')->insert([\n // 'name' => 'Empresa-02',\n // 'email' => '[email protected]',\n // 'password' => bcrypt('07.052.477/0001-60'),\n // ]);\n }", "public function run()\n {\n Model::unguard();\n\n $this->command->info('seed start!');\n\n // 省市县\n $this->call('RegionTableSeeder');\n // 用户、角色\n $this->call('UserTableSeeder');\n // 权限\n $this->call('PurviewTableSeeder');\n // 博文分类\n $this->call('CategoryTableSeeder');\n // 博文、评论、标签\n $this->call('ArticleTableSeeder');\n // 心情\n $this->call('MoodTableSeeder');\n // 留言\n $this->call('MessageTableSeeder');\n // 文件\n $this->call('StorageTableSeeder');\n\n $this->command->info('seed end!');\n }", "public function run()\n {\n DB::table('users')->insert([\n 'name' => 'Admin',\n 'email' => '[email protected]',\n 'avatar' => \"avatar\",\n 'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi',\n ]);\n $this->call(CategorySeeder::class);\n // \\App\\Models\\Admin::factory(1)->create();\n \\App\\Models\\User::factory(10)->create();\n // \\App\\Models\\Category::factory(50)->create();\n \\App\\Models\\PetComment::factory(50)->create();\n $pets = \\App\\Models\\Pet::factory(50)->create();\n foreach ($pets as $pet) {\n \\App\\Models\\PetTag::factory(1)->create(['pet_id' => $pet->id]);\n \\App\\Models\\PetPhotoUrl::factory(1)->create(['pet_id' => $pet->id]);\n \\App\\Models\\Order::factory(1)->create(['pet_id' => $pet->id]);\n };\n }", "public function run()\n {\n $this->call(RolesDatabaseSeeder::class);\n $this->call(UsersDatabaseSeeder::class);\n $this->call(LocalesDatabaseSeeder::class);\n $this->call(MainDatabaseSeeder::class);\n }", "public function run()\n {\n\n Schema::disableForeignKeyConstraints(); //in order to execute truncate before seeding\n\n $this->call(UsersTableSeeder::class);\n $this->call(PostCategoriesSeeder::class);\n $this->call(TagsSeeder::class);\n $this->call(PostsSeeder::class);\n\n Schema::enableForeignKeyConstraints();\n\n\n }", "public function run()\n {\n // DB::table('users')->insert([\n // ['id'=>1, 'email'=>'nhat','password'=>bcrypt(1234), 'lever'=>0]\n // ]);\n // $this->call(UsersTableSeeder::class);\n // $this->call(CatTableSeeder::class);\n // $this->call(TypeTableSeeder::class);\n // $this->call(AppTableSeeder::class);\n // $this->call(GameTableSeeder::class);\n \n \n }", "public function run()\n {\n //$this->call(UsersTableSeeder::class);\n $this->call(rootSeed::class);\n factory(App\\Models\\Egresado::class,'hombre',15)->create();\n factory(App\\Models\\Egresado::class,'mujer',15)->create();\n factory(App\\Models\\Administrador::class,5)->create();\n factory(App\\Models\\Notificacion::class,'post',10)->create();\n factory(App\\Models\\Notificacion::class,'mensaje',5)->create();\n factory(App\\Models\\Egresado::class,'bajaM',5)->create();\n factory(App\\Models\\Egresado::class,'bajaF',5)->create();\n factory(App\\Models\\Egresado::class,'suscritam',5)->create();\n factory(App\\Models\\Egresado::class,'suscritaf',5)->create();\n }", "public function run()\n {\n $this->seedUsers();\n $this->seedAdmins();\n $this->seedMeals();\n\n $this->seedOrder();\n $this->seedOrderlist();\n\n $this->seedReload();\n }", "public function run()\n\t{\n\t\t//composer require fzaninotto/faker\n\t\t\n\t\t$this->call(populateAllSeeder::class);\n\t\t\n\t}", "public function run()\n {\n $this->call([\n UserSeeder::class,\n ]);\n\n User::factory(20)->create();\n Author::factory(20)->create();\n Book::factory(60)->create();\n }", "public function run()\n {\n $this->call(CategoryTableSeeder::class);\n $this->call(ProductTableSeeder::class);\n\n \t\t\n\t\t\tDB::table('users')->insert([\n 'first_name' => 'Ignacio',\n 'last_name' => 'Garcia',\n 'email' => '[email protected]',\n 'password' => bcrypt('123456'),\n 'role' => '1',\n 'avatar' => 'CGnABxNYYn8N23RWlvTTP6C2nRjOLTf8IJcbLqRP.jpeg',\n ]);\n }", "public function run()\n {\n Model::unguard();\n\n $faker =Faker\\Factory::create();\n\n // $this->call(UserTableSeeder::class);\n\n $this->seedTasks($faker);\n $this->seedTags($faker);\n\n Model::reguard($faker);\n }", "public function run()\n {\n $this->call(UsersTableSeeder::class);\n\n $categories = factory(App\\Models\\Category::class, 10)->create();\n\n $categories->each(function ($category) {\n $category\n ->posts()\n ->saveMany(\n factory(App\\Models\\Post::class, 3)->make()\n );\n });\n }", "public function run()\n {\n Schema::disableForeignKeyConstraints();\n\n $this->call([\n CountriesSeeder::class,\n ProvincesSeeder::class,\n SettingsSeeder::class,\n AdminsTableSeeder::class,\n ]);\n }" ]
[ "0.8064933", "0.7848158", "0.7674873", "0.724396", "0.7216743", "0.7132209", "0.70970356", "0.70752203", "0.704928", "0.699208", "0.6987078", "0.69839287", "0.6966499", "0.68990964", "0.6868679", "0.68468624", "0.68307716", "0.68206114", "0.6803113", "0.6803113", "0.6801801", "0.6789746", "0.6788733", "0.6788008", "0.6786291", "0.67765796", "0.67742485", "0.677106", "0.67651874", "0.6761959", "0.675823", "0.67337847", "0.6733437", "0.67295784", "0.67290515", "0.6724652", "0.67226326", "0.6722267", "0.6721339", "0.6715842", "0.67070943", "0.67060536", "0.67031103", "0.6702514", "0.6702361", "0.67017967", "0.6695973", "0.6693496", "0.66868156", "0.66837406", "0.6678434", "0.66755766", "0.66726524", "0.666599", "0.664943", "0.6640641", "0.663921", "0.66387916", "0.6636016", "0.6633116", "0.6629787", "0.6627134", "0.6625862", "0.661699", "0.66093796", "0.6602538", "0.65996546", "0.659914", "0.6596484", "0.6596383", "0.65922767", "0.65922284", "0.65913564", "0.65889347", "0.65812707", "0.65811145", "0.6579546", "0.6578819", "0.6575912", "0.65749073", "0.6574314", "0.657148", "0.65696406", "0.6568972", "0.65624833", "0.6560332", "0.6559092", "0.6557491", "0.65555155", "0.6554255", "0.65509576", "0.6548099", "0.65479296", "0.6545845", "0.65443295", "0.65434265", "0.65432936", "0.654295", "0.65426385", "0.6541781", "0.6539325" ]
0.0
-1
Validate a suite class
final private function _isValidSuiteClass ($class) { $ref = new ReflectionClass($class); if ($class === $this->_baseClass or $ref->isSubclassOf($this->_baseClass)) { return true; } return false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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}", "public function assertValid($classname = NULL);", "public function check_validity($_classname);", "public function testIfClassCanBeCreated()\n {\n $this->assertInstanceOf(Validator::class, $this->_validator);\n }", "protected function checkForValidImplementingClass()\n {\n $this->validateModel();\n $this->validateItemId();\n }", "public function supportsSuite(Suite $suite);", "public function testValidate()\n {\n $this\n ->boolean(TestedClass::validatePattern('raoul'))\n ->isIdenticalTo(true)\n ->boolean(TestedClass::validatePattern('23'))\n ->isIdenticalTo(true)\n ->boolean(TestedClass::validatePattern('raoul.node.raoul'))\n ->isIdenticalTo(true)\n ->boolean(TestedClass::validatePattern('raoul.$\\\\'))\n ->isIdenticalTo(false)\n ->boolean(TestedClass::validatePattern('é'))\n ->isIdenticalTo(false)\n ->boolean(TestedClass::validatePattern('î'))\n ->isIdenticalTo(false)\n ;\n }", "public function testInstantiation()\n {\n $this->fixture = new ValidationReport(\n array( // results\n new ValidationResult(\n $this->nodeFactory->createNamedNode('http://focusNode/'),\n $this->nodeFactory->createNamedNode('http://resultPath/'),\n new Severity('sh:Warning'),\n $this->nodeFactory->createNamedNode('sh:MinMaxCountConstraintComponent'),\n $this->nodeFactory->createNamedNode('http://value')\n )\n )\n );\n\n $this->assertTrue($this->fixture->conforms());\n }", "static public function suite() {\n return Dev_Unit::load_with_prefix('Test.Templates.HTML.Forms.', 'Case');\n }", "public function testIsValid() {\n\n\n\n }", "public function testValidate() \n { \n $tester = new TarTareaProgramada();\n $tester->id_tarea_programada = \"Ingresar valor de pruebas para el campo id_tarea_programada de tipo int4\";\n $tester->nom_tarea_programada = \"Ingresar valor de pruebas para el campo nom_tarea_programada de tipo varchar\";\n $tester->fecha_inicio = \"Ingresar valor de pruebas para el campo fecha_inicio de tipo date\";\n $tester->fecha_termina = \"Ingresar valor de pruebas para el campo fecha_termina de tipo date\";\n $tester->fecha_proxima_eje = \"Ingresar valor de pruebas para el campo fecha_proxima_eje de tipo date\";\n $tester->intervalo_ejecucion = \"Ingresar valor de pruebas para el campo intervalo_ejecucion de tipo int4\";\n $tester->numero_ejecucion = \"Ingresar valor de pruebas para el campo numero_ejecucion de tipo int4\";\n \n expect_that($tester->validate());\n // en caso de incluir valores errados para el modelo: expect_not($model->validate());\n return $tester;\n }", "public function testInvalidClassParam() {\n\t\t$options = $this->_loadOptions;\n\t\t$options['class'] = 'Foo\\bar';\n\t\t$this->expectException('/Unsupported class given/');\n\t\t$posts = Fixture::load('models/Posts', $options);\n\t\t$this->_testLoad($posts);\n\t}", "public function testValidatorSetConstructor()\n\t{\n\t\t$validatorSet = new ValidatorSet();\n\n\t\t$this->assertNotNull($validatorSet);\n\t}", "public static function suite()\n {\n $suite = new PHPUnit_Framework_TestSuite('PHP CodeSniffer Standards');\n $baseDir = pathinfo(getcwd().\"/Ongr\", PATHINFO_DIRNAME);\n\n \\PHP_CodeSniffer::setConfigData('installed_paths', $baseDir);\n $path = pathinfo(\\PHP_CodeSniffer::getInstalledStandardPath('Ongr'), PATHINFO_DIRNAME);\n $testsDir = $path . DIRECTORY_SEPARATOR . 'Tests' . DIRECTORY_SEPARATOR . 'Unit';\n\n $directoryIterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($testsDir));\n\n /** @var \\SplFileInfo $fileinfo */\n foreach ($directoryIterator as $file) {\n // Skip hidden and extension must be php.\n if ($file->getFilename()[0] === '.' || pathinfo($file, PATHINFO_EXTENSION) !== 'php') {\n continue;\n }\n\n $className = str_replace(\n [$baseDir . DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR],\n ['', '\\\\'],\n substr($file, 0, -4)\n );\n\n $suite->addTest(new $className('getErrorList'));\n }\n\n return $suite;\n }", "public function testClassCoversAllDemos()\n {\n $expected = count(glob(DEMO_DIR . '/*.php')) - 1;\n $actual = count(array_keys($this->expectedResults()));\n\n $this->assertEquals($expected, $actual, \"Not all demo's where covered in \" . __CLASS__);\n }", "abstract public function runValidation();", "public function check_installer($installer, $class_name)\n\t{\n\t}", "public function testIsValid()\n {\n $validator = new Idun_Validate_Nand(array(\n new Zend_Validate_StringLength(7, 32),\n new Zend_Validate_EmailAddress\n ));\n file_put_contents('/tmp/debug.log', var_export(get_class_methods($validator), true));\n file_put_contents('/tmp/debug.log', var_export(method_exists($validator, 'isValid'), true), FILE_APPEND);\n $ref = new ReflectionClass($validator);\n file_put_contents('/tmp/debug.log', var_export($ref->getMethods(), true), FILE_APPEND);\n file_put_contents('/tmp/debug.log', var_export($ref->hasMethod('isValid'), true), FILE_APPEND);\n $this->assertTrue($validator->isValid('dummy'));\n }", "public function testClass()\n {\n $uses = class_uses(HordeClient::class);\n $this->assertContains(FilterTrait::class, $uses);\n $this->assertContains(AttributeTrait::class, $uses);\n $this->assertContains(AttachmentTrait::class, $uses);\n\n $client = $this->createClient();\n $this->assertInstanceOf(MailClient::class, $client);\n }", "public function isValidationPassed();", "private function _checkClass()\n {\n if ($this->_useWithoutTypeCheck === true) {\n return true;\n }\n\n $resource = $this->_owApp->selectedResource;\n $rModel = $resource->getMemoryModel();\n\n // search with each expression using the preg matchtype\n foreach ($this->_types as $type) {\n if (isset($type['classUri'])) {\n $classUri = $type['classUri'];\n } else {\n continue;\n }\n if (\n $rModel->hasSPvalue(\n (string) $resource,\n EF_RDF_TYPE,\n $classUri\n )\n ) {\n return true;\n }\n }\n\n // type does not match to one of the expressions\n return false;\n }", "public static function validate() {}", "public function isValid()\r\n {\r\n if (!retGet('class'))\r\n return false;\r\n\r\n if (!in_array(retGet('class'), $this->_available))\r\n return false;\r\n\r\n return true;\r\n }", "public function testAll()\n {\n $this\n ->if($schema_validator = new SchemaValidator())\n ->and($object = new testedClass($schema_validator))\n ->and($config = array(\n '_metadata' => array(),\n '_partial' => 'nom_partial'\n ))\n ->then\n ->object($object)\n ->isInstanceOf('RomaricDrigon\\\\MetaYaml\\\\NodeValidator\\\\PartialNodeValidator')\n ->exception(function() use ($object, $config) { $object->validate('test', $config, array()); })\n ->hasMessage(\"You're using a partial but partial 'nom_partial' is not defined in your schema\")\n ;\n }", "abstract public function validate();", "abstract public function validate();", "public function testValidateDocumentExecutableValidation()\n {\n }", "public function testValidation()\n\t{\n\n\t\t// $this->assertInstanceOf('Model', $depot);\n\n\t\t// $this->specify('\\'depot_id and\\' \\'factory_type_id\\' is required', function() {\n\t\t// \t$factory->depot_id = null;\n\t\t// \t$factory->factory_type_id = null;\n // verify($factory->validate(['depot_id', 'factory_type_id'])->false());\n\t\t// });\n\n\t\t// $this->specify('factory', function() {\n\t\t// \t$factory->depot_id = $this->depot->depot_id;\n\t\t// \t$factory->factory_type_id = $this->factoryType->factory_type_id;\n\t\t// \tverify($factory->validate()->true());\n\t\t// });\n\t}", "public static function suite() {\n\t\t$Suite = new CakeTestSuite('All Tools tests');\n\n\t\t$path = dirname(__FILE__);\n\t\t$Suite->addTestDirectory($path . DS . 'Lib');\n\n\t\t$path = dirname(__FILE__);\n\t\t$Suite->addTestDirectory($path . DS . 'Lib' . DS . 'Utility');\n\n\t\t$path = dirname(__FILE__);\n\t\t$Suite->addTestDirectory($path . DS . 'Lib' . DS . 'Misc');\n\n\t\t$path = dirname(__FILE__);\n\t\t$Suite->addTestDirectory($path . DS . 'View');\n\n\t\t$path = dirname(__FILE__);\n\t\t$Suite->addTestDirectory($path . DS . 'View' . DS . 'Helper');\n\n\t\t$path = dirname(__FILE__);\n\t\t$Suite->addTestDirectory($path . DS . 'Model');\n\n\t\t$path = dirname(__FILE__);\n\t\t$Suite->addTestDirectory($path . DS . 'Model' . DS . 'Behavior');\n\n\t\t$path = dirname(__FILE__);\n\t\t$Suite->addTestDirectory($path . DS . 'Model' . DS . 'Datasource');\n\n\t\t$path = dirname(__FILE__);\n\t\t$Suite->addTestDirectory($path . DS . 'Console' . DS . 'Command');\n\n\t\t$path = dirname(__FILE__);\n\t\t$Suite->addTestDirectory($path . DS . 'Controller' . DS . 'Component');\n\t\t$path = dirname(__FILE__);\n\t\t$Suite->addTestDirectory($path . DS . 'Controller' . DS . 'Component' . DS . 'Auth');\n\n\t\t//$path = dirname(__FILE__);\n\t\t//$Suite->addTestDirectory($path . DS . 'Controller');\n\n\t\t//$path = CakePlugin::path('Tools') . 'Test' . DS . 'Case' . DS;\n\t\t//$Suite->addTestDirectoryRecursive($path);\n\t\treturn $Suite;\n\t}", "public function testRun()\n {\n $scenario = new Hostingcheck_Scenario();\n $scenario->add(\n new Hostingcheck_Scenario_Group(\n 'group1',\n 'Group 1',\n new Hostingcheck_Scenario_Tests()\n )\n );\n $scenario->add(\n new Hostingcheck_Scenario_Group(\n 'group2',\n 'Group 2',\n new Hostingcheck_Scenario_Tests()\n )\n );\n\n $runner = new Hostingcheck_Runner($scenario);\n $results = $runner->run();\n $this->assertCount(2, $results);\n }", "public function testValidateDocumentTxtValidation()\n {\n }", "public function testValidate() \n { \n $tester = new CdaReporteInformacion();\n $tester->sector_solicitado = \"Ingresar valor de pruebas para el campo sector_solicitado de tipo varchar\";\n $tester->institucion_solicitante = \"Ingresar valor de pruebas para el campo institucion_solicitante de tipo varchar\";\n $tester->solicitante = \"Ingresar valor de pruebas para el campo solicitante de tipo varchar\";\n $tester->fuente_solicitada = \"Ingresar valor de pruebas para el campo fuente_solicitada de tipo varchar\";\n $tester->q_solicitado = \"Ingresar valor de pruebas para el campo q_solicitado de tipo numeric\";\n $tester->tiempo_years = \"Ingresar valor de pruebas para el campo tiempo_years de tipo int4\";\n $tester->id_tfuente = \"Ingresar valor de pruebas para el campo id_tfuente de tipo int4\";\n $tester->id_subtfuente = \"Ingresar valor de pruebas para el campo id_subtfuente de tipo int4\";\n $tester->id_caracteristica = \"Ingresar valor de pruebas para el campo id_caracteristica de tipo int4\";\n $tester->id_treporte = \"Ingresar valor de pruebas para el campo id_treporte de tipo int4\";\n $tester->id_destino = \"Ingresar valor de pruebas para el campo id_destino de tipo int4\";\n $tester->id_uso_solicitado = \"Ingresar valor de pruebas para el campo id_uso_solicitado de tipo int4\";\n $tester->id_ubicacion = \"Ingresar valor de pruebas para el campo id_ubicacion de tipo int4\";\n $tester->id_reporte_informacion = \"Ingresar valor de pruebas para el campo id_reporte_informacion de tipo int4\";\n $tester->abscisa = \"Ingresar valor de pruebas para el campo abscisa de tipo numeric\";\n $tester->id_cda = \"Ingresar valor de pruebas para el campo id_cda de tipo int4\";\n $tester->observaciones = \"Ingresar valor de pruebas para el campo observaciones de tipo varchar\";\n $tester->proba_excedencia_obtenida = \"Ingresar valor de pruebas para el campo proba_excedencia_obtenida de tipo numeric\";\n $tester->proba_excedencia_certificado = \"Ingresar valor de pruebas para el campo proba_excedencia_certificado de tipo numeric\";\n $tester->decision = \"Ingresar valor de pruebas para el campo decision de tipo varchar\";\n $tester->observaciones_decision = \"Ingresar valor de pruebas para el campo observaciones_decision de tipo varchar\";\n $tester->id_actividad = \"Ingresar valor de pruebas para el campo id_actividad de tipo int4\";\n $tester->id_cactividad_proceso = \"Ingresar valor de pruebas para el campo id_cactividad_proceso de tipo int4\";\n \n expect_that($tester->validate());\n // en caso de incluir valores errados para el modelo: expect_not($model->validate());\n return $tester;\n }", "public function testValidate() \n { \n $tester = new FdTanquesAlmacenaApscom();\n $tester->id_tanquesalmacena = \"Ingresar valor de pruebas para el campo id_tanquesalmacena de tipo int4\";\n $tester->ubicacion_tanque = \"Ingresar valor de pruebas para el campo ubicacion_tanque de tipo varchar\";\n $tester->capacidad_tanque = \"Ingresar valor de pruebas para el campo capacidad_tanque de tipo numeric\";\n $tester->medicion_entrada = \"Ingresar valor de pruebas para el campo medicion_entrada de tipo int4\";\n $tester->material = \"Ingresar valor de pruebas para el campo material de tipo int4\";\n $tester->frecuencia_mantenimiento = \"Ingresar valor de pruebas para el campo frecuencia_mantenimiento de tipo int4\";\n $tester->estado_tanque = \"Ingresar valor de pruebas para el campo estado_tanque de tipo int4\";\n $tester->problemas = \"Ingresar valor de pruebas para el campo problemas de tipo int4\";\n $tester->id_conjunto_respuesta = \"Ingresar valor de pruebas para el campo id_conjunto_respuesta de tipo int4\";\n $tester->id_junta = \"Ingresar valor de pruebas para el campo id_junta de tipo int4\";\n $tester->id_pregunta = \"Ingresar valor de pruebas para el campo id_pregunta de tipo int4\";\n $tester->id_respuesta = \"Ingresar valor de pruebas para el campo id_respuesta de tipo int4\";\n $tester->id_capitulo = \"Ingresar valor de pruebas para el campo id_capitulo de tipo int4\";\n \n expect_that($tester->validate());\n // en caso de incluir valores errados para el modelo: expect_not($model->validate());\n return $tester;\n }", "protected function checkRegistry()\n {\n foreach ($this->getExpectedClassrooms() as $classId => $classroom) {\n $this->assertTrue(\n $this->registry->offsetExists($classId),\n sprintf('Parser did not add class room \"%s\" to registry', $classId)\n );\n\n $this->assertEquals(\n $classroom,\n $this->registry->offsetGet($classId),\n sprintf('Parser created invalid class room for class \"%s\"', $classId)\n );\n }\n }", "public function assertValid()\n {\n }", "protected function validateModuleClassNames()\n {\n $this->assertModuleName('Booking');\n $this->assertControllerName(BookingController::class);\n $this->assertControllerClass('BookingController');\n $this->assertMatchedRouteName('booking');\n }", "public function testValidateDocumentXlsValidation()\n {\n }", "public function testValidation()\n {\n $this->driver->loadMetadataForClass(new \\ReflectionClass(InvalidExample::class));\n }", "public function testGetClass()\n\t{\n\t\t// check for the correct class name\n\t\t$this->assertEquals(\n\t\t\t'TechDivision_Lang_Boolean',\n\t\t TechDivision_Lang_Boolean::__getClass()\n\t\t);\n\t}", "public function testValidateDocumentDocValidation()\n {\n }", "function _class_check($str){\n }", "public function testValidateDocumentHtmlValidation()\n {\n }", "public function testHasFailedReturnsFalse(): void\n {\n $this->assertFalse($this->class->has_failed());\n }", "public function testHasFailedReturnsFalse(): void\n {\n $this->assertFalse($this->class->has_failed());\n }", "public function testReglas()\n {\n #regla1\n $obj = new Evaluacion();\n $response = $obj->validar(1);\n $this->assertEquals(true,$response);\n\n $response = $obj->validar(0);\n $this->assertEquals(false,$response);\n\n #regla2\n $response = $obj->validar_mecanica(3);\n $this->assertEquals(true,$response);\n\n $response = $obj->validar_mecanica(2);\n $this->assertEquals(true,$response);\n\n $response = $obj->validar_mecanica(1);\n $this->assertEquals(false,$response);\n\n #regla3\n $response = $obj->validar_frecuencia(31);\n $this->assertEquals(true,$response);\n\n $response = $obj->validar_frecuencia(30);\n $this->assertEquals(false,$response);\n\n #regla4\n\n $response = $obj->validar_fecha('2021-12-26');\n $this->assertEquals(true,$response);\n\n $response = $obj->validar_fecha('2020-12-22');\n $this->assertEquals(false,$response);\n\n #regla5\n $response = $obj->validar_oxigeno(92);\n $this->assertEquals(false,$response);\n\n $response = $obj->validar_oxigeno(100);\n $this->assertEquals(false,$response);\n\n $response = $obj->validar_oxigeno(91);\n $this->assertEquals(true,$response);\n\n #regla6\n $response = $obj->validar_porcentaje(12,10);\n $this->assertEquals(false,$response);\n\n $response = $obj->validar_porcentaje(13,10);\n $this->assertEquals(false,$response);\n\n\n }", "public function testIsInstanceOf()\n {\n $myClass = new GenresHasCategoriesRule([]);\n $this->assertInstanceOf(GenresHasCategoriesRule::class, $myClass);\n }", "public function valid(){ }", "public function testAddClass()\n {\n $opts = [\n 'class' => 'class-1',\n ];\n $opts = $this->trait->addClass($opts, ' class-1 class-2 ');\n $this->assertEquals($opts, [\n 'class' => 'class-1 class-2',\n ]);\n // Test with an array\n $opts = $this->trait->addClass($opts, ['class-1', 'class-3']);\n $this->assertEquals($opts, [\n 'class' => 'class-1 class-2 class-3',\n ]);\n }", "public function validTestsProvider()\n\t {\n\t\treturn array(\n\t\t\t\"generating expanded document and validating it\" => array(\"valid-01\"),\n\t\t\t\"adding one hierarchy node\" => array(\"valid-02\"),\n\t\t\t\"adding three hierarchy nodes\" => array(\"valid-03\"),\n\t\t\t\"moving hierarchy node around\" => array(\"valid-04\"),\n\t\t\t\"testing absence of mandatory attribute of one of the hierarchy nodes\" => array(\"valid-05\"),\n\t\t\t\"changing placement of one of the mandatory leaves (for example, in different choice branch)\" => array(\"valid-06\"),\n\t\t\t\"one mandatory leaf element is removed from schema\" => array(\"valid-07\"),\n\t\t\t\"three mandatory leaves are deleted from schema\" => array(\"valid-08\"),\n\t\t\t\"last-level choice is first selected\" => array(\"valid-09\"),\n\t\t\t\"last-level choice is second selected\" => array(\"valid-10\"),\n\t\t\t\"three choices in a row are wrong\" => array(\"valid-11\"),\n\t\t\t\"processing non-DOMElement nodes (for example, DOMComment)\" => array(\"valid-12\"),\n\t\t\t\"two nodes with the same name have attributes with the same name\" => array(\"valid-13\"),\n\t\t\t\"elements with the same name have similar nametrace\" => array(\"valid-14\"),\n\t\t\t\"elements with the same name have similar nametrace, also the choice change occurs\" => array(\"valid-15\"),\n\t\t\t\"one or more elements in inputelements has absolute addressing\" => array(\"valid-16\"),\n\t\t\t\"all elements in inputelements have absolute addressing\" => array(\"valid-17\"),\n\t\t\t\"schema has multiple root elements\" => array(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t \"valid-18\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t 1,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t ),\n\t\t\t\"schema has attribute group for one of nodes\" => array(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t \"valid-19\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t 0,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t ),\n\t\t\t\"inserting two hierarchy levels between two elements\" => array(\"valid-20\"),\n\t\t\t\"root element attributes are processed as regular element attributes\" => array(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t \"valid-21\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t 0,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t ),\n\t\t\t\"choice adjacent to another element which contains another choice\" => array(\"valid-22\"),\n\t\t );\n\t }", "public function testValidate() \n { \n $tester = new Cda();\n $tester->fecha_ingreso = \"Ingresar valor de pruebas para el campo fecha_ingreso de tipo date\";\n $tester->fecha_solicitud = \"Ingresar valor de pruebas para el campo fecha_solicitud de tipo date\";\n $tester->tramite_administrativo = \"Ingresar valor de pruebas para el campo tramite_administrativo de tipo varchar\";\n $tester->id_cproceso_arca = \"Ingresar valor de pruebas para el campo id_cproceso_arca de tipo int4\";\n $tester->id_cproceso_senagua = \"Ingresar valor de pruebas para el campo id_cproceso_senagua de tipo int4\";\n $tester->rol_en_calidad = \"Ingresar valor de pruebas para el campo rol_en_calidad de tipo varchar\";\n $tester->numero_tramites = \"Ingresar valor de pruebas para el campo numero_tramites de tipo int4\";\n $tester->id_cda = \"Ingresar valor de pruebas para el campo id_cda de tipo int4\";\n $tester->id_usuario_enviado_por = \"Ingresar valor de pruebas para el campo id_usuario_enviado_por de tipo numeric\";\n $tester->institucion_solicitante = \"Ingresar valor de pruebas para el campo institucion_solicitante de tipo varchar\";\n $tester->solicitante = \"Ingresar valor de pruebas para el campo solicitante de tipo varchar\";\n $tester->cod_centro_atencion_ciudadano = \"Ingresar valor de pruebas para el campo cod_centro_atencion_ciudadano de tipo int4\";\n $tester->id_demarcacion = \"Ingresar valor de pruebas para el campo id_demarcacion de tipo numeric\";\n \n expect_that($tester->validate());\n // en caso de incluir valores errados para el modelo: expect_not($model->validate());\n return $tester;\n }", "public function getTestCase($class);", "public function testValidateDocumentXlsxValidation()\n {\n }", "private function initSuite(): void\n {\n $suiteNodes = $this->xml->xpath('/testsuites/testsuite/testsuite');\n $this->isSingle = count($suiteNodes) === 0;\n\n $node = $this->xml->xpath('/testsuites/testsuite');\n $node = current($node);\n\n if ($node !== false) {\n $this->suites[] = new TestSuite(\n (string) $node['name'],\n (int) $node['tests'],\n (int) $node['assertions'],\n (int) $node['failures'],\n (int) $node['errors'],\n (int) $node['warnings'],\n (int) $node['skipped'],\n (float) $node['time'],\n (string) $node['file']\n );\n } else {\n $this->suites[] = TestSuite::empty();\n }\n }", "function CheckClass() {\n\t\tforeach ($this->methodArray as $key => $value) {\n\t\t\tforeach ($this->methodArray as $key2 => $value2) {\n\t\t\t\t// Odstraneni prepsane metody\n\t\t\t\tif ($value[\"name\"] == $value2[\"name\"] && $value[\"priority\"] != $value2[\"priority\"]) {\n\t\t\t\t\t//TODO osetrit pokud se nerovnaji argumenty\n\t\t\t\t\tif (!$value[\"priority\"])\n\t\t\t\t\t\tunset($this->methodArray[$key]);\n\t\t\t\t\tif (!$value2[\"priority\"])\n\t\t\t\t\t\tunset($this->methodArray[$key2]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Kontrola zda se neredefinovaly atributy\n\t\tforeach ($this->attributesArray as $key => $value) {\n\t\t\tforeach ($this->attributesArray as $key2 => $value2) {\n\t\t\t\t// Odstraneni prepsane metody\n\t\t\t\tif ($value[\"name\"] == $value2[\"name\"] && $value[\"priority\"] != $value2[\"priority\"]) {\n\t\t\t\t\tif (!$value[\"priority\"])\n\t\t\t\t\t\tunset($this->attributesArray[$key]);\n\t\t\t\t\tif (!$value2[\"priority\"])\n\t\t\t\t\t\tunset($this->attributesArray[$key2]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Jestli se mezi metodami objevi virtual, nastavi se class jako abstraktni\n\t\tforeach ($this->methodArray as $key => $value) {\n\t\t\tif ($value[\"virtualPure\"])\n\t\t\t\t$this->setKind(true);\n\t\t}\n\t\treturn $this->CheckConflict();\n\t}", "public function test_example()\n {\n $this->assertTrue( (new PassPhrase('abcde fghij'))->validate());\n $this->assertTrue( (new PassPhrase('a ab abc abd abf abj'))->validate());\n $this->assertTrue( (new PassPhrase('iiii oiii ooii oooi oooo'))->validate());\n $this->assertFalse( (new PassPhrase('abcde xyz ecdab'))->validate());\n $this->assertFalse( (new PassPhrase('oiii ioii iioi iiio'))->validate());\n }", "public function hasSuites(){\n return $this->_has(1);\n }", "public function testConforms()\n {\n // true\n $this->fixture = new ValidationReport(\n array( // results\n new ValidationResult(\n $this->nodeFactory->createNamedNode('http://focusNode/'),\n $this->nodeFactory->createNamedNode('http://resultPath/'),\n new Severity('sh:Info'),\n $this->nodeFactory->createNamedNode('sh:MinMaxCountConstraintComponent'),\n $this->nodeFactory->createNamedNode('http://value')\n )\n )\n );\n $this->assertTrue($this->fixture->conforms());\n\n // true\n $this->fixture = new ValidationReport(\n array( // results\n new ValidationResult(\n $this->nodeFactory->createNamedNode('http://focusNode/'),\n $this->nodeFactory->createNamedNode('http://resultPath/'),\n new Severity('sh:Warning'),\n $this->nodeFactory->createNamedNode('sh:MinMaxCountConstraintComponent'),\n $this->nodeFactory->createNamedNode('http://value')\n )\n )\n );\n $this->assertTrue($this->fixture->conforms());\n\n // false\n $this->fixture = new ValidationReport(\n array( // results\n new ValidationResult(\n $this->nodeFactory->createNamedNode('http://focusNode/'),\n $this->nodeFactory->createNamedNode('http://resultPath/'),\n new Severity('sh:Violation'),\n $this->nodeFactory->createNamedNode('sh:MinMaxCountConstraintComponent'),\n $this->nodeFactory->createNamedNode('http://value')\n )\n )\n );\n $this->assertFalse($this->fixture->conforms());\n }", "public function testValidateDocumentEmlValidation()\n {\n }", "public function validate()\n {\n }", "public function validate()\n {\n }", "public function testClassesExist() {\n foreach($this->classes as $class) {\n if (class_exists($class)) {\n $this->pass(\"$class was loaded.\");\n }\n else {\n $this->fail(\"$class was not loaded.\");\n }\n }\n }", "public static function suite() {\n\t\t$suite = new CakeTestSuite('All Attempt Plugin Tests');\n\n\t\t$basePath = CakePlugin::path('Attempt') . 'Test' . DS . 'Case' . DS;\n\t\t// controllers\n\t\t$suite->addTestFile($basePath . 'Controller' . DS . 'Component' . DS . 'AttemptComponentTest.php');\n\t\t// models\n\t\t$suite->addTestFile($basePath . 'Model' . DS . 'AttemptTest.php');\n\n\t\treturn $suite;\n\t}", "public function testing(){\n\t\t$this->load->library(\"unit_test\");\n\n\t\t$this->unit->run($this->isValid(\"\"), \"null\", \"Test Validasi Null\");\n\t\t$this->unit->run($this->isValid(\"*&&^^\"), \"symbolerror\", \"Test Validasi Symbol\");\n\t\t$this->unit->run($this->isValidHari(\"Selasa\"), true, \"Test Validasi Hari\");\n\t\t$this->unit->run($this->isValidJam(\"0\"), false, \"Test Validasi Jam\");\n\n\t\techo $this->unit->report();\n\t}", "public function valid()\n {\n }", "public function valid()\n {\n }", "public function valid()\n {\n }", "public function valid()\n {\n }", "public function testValidateDocumentXmlValidation()\n {\n }", "public function testValidateDocumentAutodetectValidation()\n {\n }", "function test_editflow_exists() {\n\t\t \n\t\t$this->assertTrue( class_exists( 'edit_flow' ) );\n\t\t \n\t}", "public abstract function validation();", "public function validate($plugin)\n {\n }", "public function testValidate()\n {\n // Add user to check for the existing user case\n $user = new User(\"[email protected]\", \"Some User\", \"asdfasdf\", \"student\");\n $this->assertNotFalse($user->insert());\n\n // Some basic missing fields\n $errors = User::validate(\"asdf\", \"\", \"aaa\", \"bbb\", \"admin\");\n\n $this->assertContains(\"Invalid email\", $errors);\n $this->assertContains(\"Name cannot be empty\", $errors);\n $this->assertContains(\"Password should be stronger\", $errors);\n $this->assertContains(\"Passwords do not match\", $errors);\n $this->assertContains(\"Invalid user type\", $errors);\n\n // Existing email\n $errors = User::validate($user->getEmail(), \"Some Name\", \"a23456789\", \"a23456789\",\n \"lecturer\");\n $this->assertContains(\"Email already exists\", $errors);\n\n // Successful registration\n $errors = User::validate(\"[email protected]\", \"Some Name\", \"a23456789\", \"a23456789\", \"student\");\n $this->assertEmpty($errors);\n }", "public function isValid() {}", "public function isValid() {}", "public function testCheckIfOverviewContainsSuite()\n {\n $user = factory(App\\User::class)->create();\n\n $this->actingAs($user)\n ->visit('/library')\n ->see('TestSuite1')\n ->assertViewHas('testSuites');\n\n }", "public function isValid() {}", "public function isValid() {}", "public function isValid() {}", "public function isValid() {}", "public function isValid() {}", "public function isValid() {}", "public function testTypeCorrect()\n {\n $validator=new Validator();\n $result=$validator->type(\"2\");\n $this->assertTrue($result[0]);\n }", "public function test_create__invalid_class()\n {\n\n (new ElementFactory())->create(['attributes' => ['type' => ElementFactory::class, 'name' => '']]);\n }", "public function validate();", "public function validate();", "public function validate();", "public function validate();", "public function validate();", "public function validate();", "public function validate();", "public function validate();", "public function validate();", "public function validate();", "public function validate();", "public function validate();", "public function validate() {\n }", "public function validate() {\n }", "public function testValidate()\n {\n $this->todo('stub');\n }", "public function testValidateDocumentTarValidation()\n {\n }" ]
[ "0.64271075", "0.64263386", "0.60432744", "0.60092914", "0.59393984", "0.58977675", "0.5857467", "0.58248943", "0.57671475", "0.56481177", "0.56185144", "0.55800825", "0.547926", "0.54645455", "0.54575545", "0.5451911", "0.54474896", "0.5442635", "0.5427876", "0.5391416", "0.53694916", "0.5316611", "0.5316225", "0.52820545", "0.5271751", "0.5271751", "0.5252784", "0.5234064", "0.52292717", "0.522665", "0.5220312", "0.5219362", "0.5212456", "0.5204548", "0.51980054", "0.51943445", "0.51927274", "0.5192486", "0.5189991", "0.5181889", "0.51811606", "0.5174555", "0.51707727", "0.51707727", "0.5168071", "0.5165229", "0.51533794", "0.51431614", "0.5142894", "0.5139772", "0.5136989", "0.51354915", "0.51218224", "0.51185876", "0.5117832", "0.51168704", "0.51155597", "0.5114108", "0.5113827", "0.5113827", "0.5111936", "0.5110968", "0.51068175", "0.5097855", "0.5097855", "0.5097855", "0.5097855", "0.5097586", "0.5087988", "0.5085325", "0.5084136", "0.50741917", "0.50735533", "0.5073083", "0.5073083", "0.5073009", "0.50728285", "0.50728285", "0.50728285", "0.50728285", "0.50728285", "0.5071632", "0.50702024", "0.5069414", "0.5067938", "0.5067938", "0.5067938", "0.5067938", "0.5067938", "0.5067938", "0.5067938", "0.5067938", "0.5067938", "0.5067938", "0.5067938", "0.5067938", "0.5063678", "0.5063678", "0.5050445", "0.5046694" ]
0.71460056
0
Return the TAN widget as object
protected function getTANWidget($value = null) { $widget = new TextField(); $widget->id = 'nrOfTAN'; $widget->name = 'nrOfTAN'; $widget->mandatory = true; $widget->maxlength = 5; $widget->rgxp = 'digit'; $widget->nospace = true; $widget->value = $value; $widget->required = true; $widget->label = $GLOBALS['TL_LANG']['tl_survey_pin_tan']['nrOfTAN'][0]; if ($GLOBALS['TL_CONFIG']['showHelp'] && strlen($GLOBALS['TL_LANG']['tl_survey_pin_tan']['nrOfTAN'][1])) { $widget->help = $GLOBALS['TL_LANG']['tl_survey_pin_tan']['nrOfTAN'][1]; } // Validate input if ($this->request->getPost('FORM_SUBMIT') == 'tl_export_survey_pin_tan') { $widget->validate(); if ($widget->hasErrors()) { $this->blnSave = false; } } return $widget; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getWidget();", "public function getWidget()\n\t{\n\t\treturn $this->widget;\n\t}", "public function WidgetClass(){\r\n\t\tYii::import(\"application.GWidgets.\".\".W\".$this->widget);\r\n\t\t$cname='W'.$this->widget;\r\n\t\t$widget=new $cname($this->GTemp,$this);\r\n\t\treturn $widget;\r\n\t}", "function getWidget() {\n // just override the template being used.\n $bHasErrors = false; \n \n require_once(KT_LIB_DIR . \"/documentmanagement/MDTree.inc\");\n \n $fieldTree = new MDTree();\n $fieldTree->buildForField($this->iFieldId);\n $fieldTree->setActiveItem($this->value);\n return $fieldTree->_evilTreeRenderer($fieldTree, $this->sName); \n }", "public static function ui() {\n return Yii::createObject(NotifyToolWidget::className()); //, [get_called_class()]\n }", "abstract public function getWidget() : string;", "public function getWidget(): \\WP_Widget{\n return $this->widget;\n }", "public function getWidget($name){\n\t\t\t$class = null;\n\t\t\tif(is_file($this->config['widgetFolder'].$name.'.widget.php')){\n\t\t\t\trequire_once($this->config['widgetFolder'].$name.'.widget.php');\n\t\t\t\t$name = 'UIW_'.$name;\n\t\t\t\t$class = new $name();\n\t\t\t} \n\t\t\treturn $class;\n\t\t}", "function box_widget(){\n\t$CI=& get_instance();\n\treturn $CI->parser->parse('layout/ddi/box_widget.html', $CI->data,true);\n}", "public static function a_widget_init() {\n\t\t\treturn register_widget(__CLASS__);\n\t\t}", "public function tv()\n {\n return new MiTv();\n }", "protected function getWidget()\n {\n $widgets = $this->getPage()->findAll('css', 'body div.filter-container ul.ui-multiselect-checkboxes');\n\n /** @var NodeElement $widget */\n foreach ($widgets as $widget) {\n if ($widget->isVisible()) {\n return $widget;\n }\n }\n\n self::fail('Could not find widget on page or it\\'s not visible');\n }", "public function render_widget() {\n\n return Widget::render($this->settings);\n\n }", "public function getDomObject()\n\t\t{\n\t\t\t$span = $this->createDomObject( 'span' );\n\t\t\t$span->setAttribute('id', $this->getHTMLControlId());\n\t\t\tif($this->errMsg) {\n\t\t\t\t$span->nodeValue = $this->errMsg;\n\t\t\t}\n\t\t\telse {\n\t\t\t\t$span->setAttribute('style', 'display:none;');\n\t\t\t}\n\t\t\treturn $span;\n\t\t}", "public function get_widget_data() {\n\n return Widget::get_widget_data($this->settings);\n\n }", "function getWidget() {\n // just override the template being used.\n $bHasErrors = false; \n if (count($this->aErrors) != 0) { $bHasErrors = true; }\n\n // at this last moment we pick the template to use \n $total = count($this->aVocab);\n if ($this->bUseSimple === true) {\n $this->sTemplate = 'ktcore/forms/widgets/simple_selection'; \n } else if ($this->bUseSimple === false) {\n $this->sTemplate = 'ktcore/forms/widgets/selection'; \n } else if (is_null($this->bUseSimple) && ($total <= $this->USE_SIMPLE)) {\n $this->sTemplate = 'ktcore/forms/widgets/simple_selection';\n } else {\n $this->sTemplate = 'ktcore/forms/widgets/selection';\n }\n \n $oTemplating =& KTTemplating::getSingleton(); \n $oTemplate = $oTemplating->loadTemplate($this->sTemplate);\n\n // have to do this here, and not in \"configure\" since it breaks \n // entity-select.\n $unselected = KTUtil::arrayGet($this->aOptions, 'unselected_label');\n if (!empty($unselected)) {\n // NBM: we get really, really nasty interactions if we try merge\n // NBM: items with numeric (but important) key values and other\n // NBM: numerically / null keyed items\n $vocab = array();\n $vocab[] = $unselected;\n foreach ($this->aVocab as $k => $v) {\n $vocab[$k] = $v;\n }\n \n $this->aVocab = $vocab;\n\n // make sure its the selected one if there's no value specified.\n if (empty($this->value)) {\n $this->value = 0;\n }\n }\n\n // performance optimisation for large selected sets.\n if ($this->bMulti) {\n $this->_valuesearch = array();\n $value = (array) $this->value;\n foreach ($value as $v) {\n $this->_valuesearch[$v] = true;\n }\n }\n \n $aTemplateData = array(\n \"context\" => $this,\n \"name\" => $this->sName,\n \"has_id\" => ($this->sId !== null),\n \"id\" => $this->sId,\n \"has_value\" => ($this->value !== null),\n \"value\" => $this->value,\n \"options\" => $this->aOptions,\n 'vocab' => $this->aVocab,\n );\n return $oTemplate->render($aTemplateData);\n }", "public function getRootWidget()\n {\n return $this->rootWidgetNode;\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 &and;', 'affiliatetheme-backend' ) . '</h4>&nbsp;';\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 }", "public function widget( $args, $instance ){}", "public function get_widget_object($id_base)\n {\n }", "public function __construct() {\n $widget_ops = array(\n 'classname' => 'undergram-box',\n 'description' => 'Exibe as últimas fotos de qualquer perfil do Instagram.',\n );\n\n parent::__construct( 'undergram_widget', 'Instagram Box', $widget_ops );\n}", "protected function getReadSpeakerWidget() {\n\t\t$readSpeakerWidget = $this->getRenderService()->renderWidget(\n\t\t\t$this->getTypoScriptService()->getRenderObjectConfiguration()\n\t\t);\n\n\t\treturn $readSpeakerWidget;\n\t}", "static public function getView() {\n\t\treturn self::$defaultInstance;\n\t}", "function Talemy() {\n\treturn Talemy::instance();\n}", "public function get_widget_control($args)\n {\n }", "function create_triout_widget( $data ) {\n\t\t\t\t\t\t\n\t\t\t$frame .= \"<iframe src='http://trioutnc.com/u/\" . $data['widgettype'] . \".php?user=\" . $data['uid'] . \"&history=\" . $data['number'] . \"&nav=\" . $data['nav'] . \"' \";\n\t\t\t$frame .= \"width='\" . $data['width'] . \"' height='\" . $data['height'] . \"' frameborder='0' style='border:1px solid #\" . $data['border'] . \";' ></iframe>\";\n\t\t\t$frame .= \"<p style='font-family:Arial;font-size: small;padding-top:0;margin-top: 3px;'><a href='http://TriOutNC.com/u/\" . $data['uid'] . \"' target='new' style='text-decoration: none;color: #ED000F;'>Find Me</a> on <a href='http://TriOutNC.com/' target='new' style='text-decoration: none;color: #ED000F;'>TriOut!</a></p>\";\n\t\t\t\n\t\t\treturn $frame;\n\t\t}", "function i4web_toolbox($instance){\n \n $toolbox_info = $instance; \n?>\n <p><?php echo $toolbox_info['toolbox_lead_txt'];?></p>\n <ul class=\"sern-toolbox-list\">\n <li><kbd><?php echo $toolbox_info['toolbox_arr1'];?></kbd></li>\n <li><kbd><?php echo $toolbox_info['toolbox_arr2'];?></kbd></li>\n <li><kbd><?php echo $toolbox_info['toolbox_arr3'];?></kbd></li>\n <li><kbd><?php echo $toolbox_info['toolbox_arr4'];?></kbd></li> \n </ul>\n \n \n\t \n<?php }", "public function getControl()\r\n\t{\r\n\t\t$control=parent::getControl();\r\n\t\t$control->class[]='tag-control';\r\n\r\n\t\tif ($this->delimiter!==NULL && Strings::trim($this->delimiter)!=='') {\r\n\t\t\t$control->attrs['data-tag-delimiter']=$this->delimiter;\r\n\t\t\t}\r\n\r\n\t\tif ($this->joiner!==NULL && Strings::trim($this->joiner)!=='') {\r\n\t\t\t$control->attrs['data-tag-joiner']=$this->joiner;\r\n\t\t\t}\r\n\t\r\n\t\tif ($this->suggestCallback!==NULL) {\r\n\t\t\t$form=$this->getForm();\r\n\t\t\tif (!$form || !$form instanceof Form) {\r\n\t\t\t\tthrow new \\Nette\\InvalidStateException('TagInput supports only Nette\\Application\\UI\\Form.');\r\n\t\t\t\t}\r\n\t\t\t$control->attrs['data-tag-suggest']=$form->presenter->link($this->renderName, array('word_filter' => '%__filter%'));\r\n\t\t\t}\r\n\r\n\t\treturn $control;\r\n\t}", "function bstw() {\n\t\treturn Black_Studio_TinyMCE_Plugin::instance();\n\t}", "public function widget_instance($params) {\n if ($params['widget'] == 'admindelegation' && $this->_userCanViewWidget('admindelegation')) {\n include_once 'AdminDelegation_UserWidget.class.php';\n $params['instance'] = new AdminDelegation_UserWidget($this);\n }\n if ($params['widget'] == 'admindelegation_projects' && $this->_userCanViewWidget('admindelegation_projects')) {\n include_once 'AdminDelegation_ShowProjectWidget.class.php';\n $params['instance'] = new AdminDelegation_ShowProjectWidget($this);\n }\n \n }", "public function get_instance() {\r\n\t\treturn $this->obj;\r\n\t}", "abstract public function widget_markup( $args, $instance );", "public function getButton() {}", "public function MyWidget() {\n\t\t// Instantiate the parent object\n\t\t\n\t\tparent::__construct(\n\t\t\t'show_base_value', // Base ID\n\t\t\t__( 'Visualizza info base', 'Widget che visualizza informazioni base dell\\'azienda' ), // Name\n\t\t\tarray( 'description' => __( 'Visualizza info base', 'Una bella descrizione del mio piccolo widget' ), ) // Args\n\t\t);\n\t\n\t}", "function tomahk_shortcodes() {\n\treturn tomahk_shortcodes::instance();\n}", "public function getRecord()\n {\n return $this->_widget;\n }", "public function get_markup () {\r\n\t\t$data = $this->properties_to_array();\r\n\r\n\t\t// Ensure tab title\r\n\t\t// Do shortcode\r\n\t\tforeach($data['tabs'] as $index=>$tab) {\r\n\t\t\t$ttl = trim(str_replace(\"\\n\", '', $tab['title']));\r\n\t\t\tif (empty($ttl)) {\r\n\t\t\t\t$tab['title'] = 'Tab ' . ($index + 1);\r\n\t\t\t}\r\n\t\t\t$tab['content'] = $this->_do_shortcode($tab['content']);\r\n\t\t\t$data['tabs'][$index] = $tab;\r\n\t\t}\r\n\r\n\t\tif (!$data['preset']) {\r\n\t\t\t$data['preset'] = 'default';\r\n\t\t}\r\n\r\n\t\t$data['wrapper_id'] = str_replace('utabs-object-', 'wrapper-', $data['element_id']);\r\n\r\n\t\t$markup = upfront_get_template('utabs', $data, dirname(dirname(__FILE__)) . '/tpl/utabs.html');\r\n\r\n\t\t// upfront_add_element_style('upfront_tabs', array('css/utabs.css', dirname(__FILE__)));\r\n\t\tupfront_add_element_script('upfront_tabs', array('js/utabs-front.js', dirname(__FILE__)));\r\n\r\n\t\treturn $markup;\r\n\t}", "public static function createInstance()\n {\n return new TextBlock('ISerializable', 'ISerializable');\n }", "public static function createInstance()\n {\n return new Button('ISerializable', 'ISerializable', 'ISerializable');\n }", "public function getWidgetViewHelperClassName() {}", "public function getTwig()\n {\n return TemplateHelper::getRaw($this->_getHtml());\n }", "public function getUI()\n {\n return $this->ui;\n }", "function settingsObject()\n\t{\n\t\tglobal $tpl, $ilCtrl, $lng;\n\t\t\n\t\t$editor = $this->object->_getRichTextEditor();\n\t\t\n\t\tinclude_once(\"Services/Form/classes/class.ilPropertyFormGUI.php\");\n\t\t$this->form = new ilPropertyFormGUI();\n\t\t$this->form->setFormAction($ilCtrl->getFormAction($this));\n\t\t$this->form->setTitle($lng->txt(\"adve_activation\"));\n\t\t$cb = new ilCheckboxInputGUI($this->lng->txt(\"adve_use_tiny_mce\"), \"use_tiny\");\n\t\tif ($editor == \"tinymce\")\n\t\t{\n\t\t\t$cb->setChecked(true);\n\t\t}\n\t\t$this->form->addItem($cb);\n\t\t$this->form->addCommandButton(\"saveSettings\", $lng->txt(\"save\"));\n\t\t\n\t\t$tpl->setContent($this->form->getHTML());\n\t}", "public function widget( $args, $instance ) {\r\n\r\n if ( is_active_widget( false, false, $this->id_base, true ) ) {\r\n\r\n wp_enqueue_style( 'Dancing-Script', BTTK_FILE_URL .'/public/css/dancing-script.min.css', array(), '1.0.0', 'all' );\r\n }\r\n \r\n $obj = new BlossomThemes_Toolkit_Functions();\r\n $title = ! empty( $instance['title'] ) ? $instance['title'] : '';\r\n $name = ! empty( $instance['name'] ) ? $instance['name'] : '';\r\n $email = ! empty( $instance['email'] ) ? $instance['email'] : ''; \r\n $content = ! empty( $instance['content'] ) ? $instance['content'] : '';\r\n $image = ! empty( $instance['image'] ) ? $instance['image'] : '';\r\n $author_image = ! empty( $instance['author-image'] ) ? $instance['author-image'] : '';\r\n $label = ! empty( $instance['label'] ) ? $instance['label'] : '';\r\n $link = ! empty( $instance['link'] ) ? $instance['link'] : '';\r\n $signaturetext = ! empty( $instance['signature-text'] ) ? $instance['signature-text'] : '';\r\n $attachment_id = $image;\r\n $author_image_id = $author_image; \r\n\r\n if ( !filter_var( $image, FILTER_VALIDATE_URL ) === false ) {\r\n $attachment_id = $obj->bttk_get_attachment_id( $image );\r\n }\r\n\r\n if ( !filter_var( $author_image, FILTER_VALIDATE_URL ) === false ) {\r\n $author_image_id = $obj->bttk_get_attachment_id( $author_image );\r\n } \r\n \r\n // $socicon = ! empty( $instance['socicon'] ) ? $instance['socicon'] : ''; \r\n $option = ! empty( $instance['author-image-option'] ) ? $instance['author-image-option'] : 'gravatar';\r\n $signature_option = ! empty( $instance['author-signature-option'] ) ? $instance['author-signature-option'] : 'text';\r\n\r\n \r\n if( $attachment_id )\r\n {\r\n $author_bio_img_size = apply_filters('author_bio_img_size','medium');\r\n }\r\n\r\n if( $author_image_id )\r\n {\r\n $author_img_size = apply_filters('author_bio_img_size','medium');\r\n }\r\n \r\n echo $args['before_widget'];\r\n ob_start();\r\n \r\n if( $title ) echo $args['before_title'] . apply_filters( 'widget_title', $title, $instance, $this->id_base ) . $args['after_title']; \r\n ?>\r\n <div class=\"bttk-author-bio-holder\">\r\n <div class=\"image-holder\">\r\n <?php \r\n if($option=='gravatar'){ \r\n echo get_avatar( $email, 300 ); \r\n }\r\n elseif($option=='photo' && !empty($author_image_id)){ \r\n echo wp_get_attachment_image( $author_image_id, $author_img_size, false, \r\n array( 'alt' => esc_attr( $name ))); \r\n }\r\n ?>\r\n </div> \r\n <div class=\"text-holder\">\r\n <div class=\"title-holder\"><?php echo esc_html($name); ?></div> \r\n <div class=\"author-bio-content\">\r\n <?php echo wpautop( wp_kses_post( $content ) ); ?>\r\n </div>\r\n <?php\r\n if( $signature_option == 'photo' && !empty($attachment_id)){ ?>\r\n <div class=\"signature-holder\">\r\n <?php echo wp_get_attachment_image( $attachment_id, $author_bio_img_size, false, \r\n array( 'alt' => esc_html( $title ))); ?>\r\n </div>\r\n <?php } else{ echo '<div class=\"text-signature\">'.esc_html($signaturetext).'</div>';}?> \r\n <?php if( $link && $label ){ ?>\r\n <a <?php if(isset($instance['target']) && $instance['target']=='1'){ echo \"target=_blank\"; } ?> href=\"<?php echo esc_url( $link ); ?>\" class=\"readmore\"><?php echo esc_html( $label );?></a>\r\n <?php } ?>\r\n \t <div class=\"author-bio-socicons\">\r\n <?php\r\n if( isset( $instance['socicon'] ) && !empty($instance['socicon']) ): \r\n $icons = $instance['socicon']; ?>\r\n <ul class=\"author-socicons\">\r\n \t \t<?php\r\n $arr_keys = array_keys( $icons );\r\n foreach ($arr_keys as $key => $value)\r\n {\r\n if ( array_key_exists( $value,$instance['socicon'] ) )\r\n {\r\n if(isset($instance['socicon'][$value]) && !empty($instance['socicon'][$value]))\r\n { \r\n if(!isset($instance['socicon_profile'][$value]) || (isset($instance['socicon_profile'][$value]) && $instance['socicon_profile'][$value] == ''))\r\n {\r\n $icon = $this->bttk_get_social_icon_name( $instance['socicon'][$value] );\r\n $class = ($icon == 'rss') ? 'fas fa-'.$icon : 'fab fa-'.$icon;\r\n }\r\n elseif(isset($instance['socicon_profile'][$value]) && !empty($instance['socicon_profile'][$value]))\r\n {\r\n $icon = $instance['socicon_profile'][$value] ;\r\n $class = ($icon == 'rss') ? 'fas fa-'.$icon : 'fab fa-'.$icon;\r\n }\r\n ?>\r\n \t\t <li class=\"social-share-list\">\r\n \t\t <a <?php if(isset($instance['target']) && $instance['target']=='1'){ echo \"target=_blank\"; } ?> href=\"<?php echo esc_url($instance['socicon'][$value]);?>\">\r\n <i class=\"<?php echo esc_attr($class);?>\"></i>\r\n </a>\r\n \t\t \r\n \t\t </li>\r\n \t\t <?php\r\n } \r\n }\r\n \t\t }\r\n \t\t ?>\r\n </ul>\r\n <?php endif; ?>\r\n \t </div>\r\n </div>\r\n\t </div>\r\n <?php \r\n $html = ob_get_clean();\r\n echo apply_filters( 'blossom_author_bio_widget_filter', $html, $args, $instance );\r\n echo $args['after_widget']; \r\n \r\n }", "function AviaWidgetLoader()\n\t{\n\t\treturn avia_widget_loader::instance();\n\t}", "public function getTipRtbus() {\n return $this->get(self::TIP_RTBUS);\n }", "function model()\n {\n return Widget::class;\n }", "public function getObjet()\n {\n return $this->objet;\n }", "function WidgetMeteoControl() {\n\t\t\n\t\t\t$options = get_option('widget_trebimeteo');\n\t\t\tif ( !is_array($options) )\t{ $options = array('title' => 'Previsioni Meteo', 'trebiregione' => '1', 'trebilocalita' => '6', 'trebicuno' => 'ffffff','trebicdue' => 'ffffff', 'trebictre' => 'ffffff', 'trebibuno' => '93c1db', 'trebibdue' => '3a8ebd', 'trebibtre' => 'ffffff', 'trebilarghezza' => '190', 'trebialtezza' => '240', 'trebitipo' => 'xssmall'); }\n\n\t\t\tif ( $_POST['trebimeteo-submit'] )\n\t\t\t{\n\t\t\t\t// Remember to sanitize and format use input appropriately.\n\t\t\t\t$options['trebimeteotitle'] = strip_tags(stripslashes($_POST['trebimeteotitle']));\n\t\t\t\t$options['trebiregione'] = strip_tags(stripslashes($_POST['trebiregione']));\n\t\t\t\t$options['trebilocalita'] = strip_tags(stripslashes($_POST['trebilocalita']));\n\t\t\t\t$options['trebicuno'] = strip_tags(stripslashes($_POST['trebicuno']));\n\t\t\t\t$options['trebicdue'] = strip_tags(stripslashes($_POST['trebicdue']));\n\t\t\t\t$options['trebictre'] = strip_tags(stripslashes($_POST['trebictre']));\n\t\t\t\t$options['trebibuno'] = strip_tags(stripslashes($_POST['trebibuno']));\n\t\t\t\t$options['trebibdue'] = strip_tags(stripslashes($_POST['trebibdue']));\n\t\t\t\t$options['trebibtre'] = strip_tags(stripslashes($_POST['trebibtre']));\n\t\t\t\t$options['trebialtezza'] = strip_tags(stripslashes($_POST['trebialtezza']));\n\t\t\t\t$options['trebilarghezza'] = strip_tags(stripslashes($_POST['trebilarghezza']));\n\t\t\t\t$options['trebitipo'] = strip_tags(stripslashes($_POST['trebitipo']));\n\n\t\t\t\tupdate_option('widget_trebimeteo', $options);\n\t\t\t}\n\n\t\t\t$trebimeteotitle = htmlspecialchars($options['trebimeteotitle'], ENT_QUOTES);\n\t\t\t$trebiregione = htmlspecialchars($options['trebiregione'], ENT_QUOTES);\n\t\t\t$trebilocalita = htmlspecialchars($options['trebilocalita'], ENT_QUOTES);\n\t\t\t$trebicuno = htmlspecialchars($options['trebicuno'], ENT_QUOTES);\n\t\t\t$trebicdue = htmlspecialchars($options['trebicdue'], ENT_QUOTES);\n\t\t\t$trebictre = htmlspecialchars($options['trebictre'], ENT_QUOTES);\n\t\t\t$trebibuno = htmlspecialchars($options['trebibuno'], ENT_QUOTES);\n\t\t\t$trebibdue = htmlspecialchars($options['trebibdue'], ENT_QUOTES);\n\t\t\t$trebibtre = htmlspecialchars($options['trebibtre'], ENT_QUOTES);\n\t\t\t$trebialtezza = htmlspecialchars($options['trebialtezza'], ENT_QUOTES);\n\t\t\t$trebilarghezza = htmlspecialchars($options['trebilarghezza'], ENT_QUOTES);\n\t\t\t$trebitipo = htmlspecialchars($options['trebitipo'], ENT_QUOTES);\n\n\t\t\t$xpath = WP_PLUGIN_URL.'/'.str_replace(basename( __FILE__),\"\",plugin_basename(__FILE__));\n\t\t\t\n\t\t\t?>\n \n\t<p style=\"text-align:right;\"><label for=\"trebimeteo-title\">Titolo <input id=\"trebimeteotitle\" name=\"trebimeteotitle\" type=\"text\" value=\"<?php echo $trebimeteotitle;?>\" /></label></p>\n <p style=\"text-align:right;\"><label for=\"trebiregione\">ID Regione (<a target=\"_blank\" href=\"<?php echo home_url().'/wp-admin/options-general.php?page=3bmeteo.php'; ?>\">?</a>) <input id=\"trebiregione\" name=\"trebiregione\" type=\"text\" value=\"<?php echo $trebiregione;?>\"/></label></p>\n\t<p style=\"text-align:right;\"><label for=\"trebilocalita\">ID Localit&agrave; (<a target=\"_blank\" href=\"<?php echo home_url().'/wp-admin/options-general.php?page=3bmeteo.php';?>\">?</a>) <input id=\"trebilocalita\" name=\"trebilocalita\" type=\"text\" value=\"<?php echo $trebilocalita;?>\"/></label></p>\n <p style=\"text-align:right;\"><label for=\"trebialtezza\">Altezza <input id=\"trebialtezza\" name=\"trebialtezza\" type=\"text\" value=\"<?php echo $trebialtezza;?>\"/></label></p>\n <p style=\"text-align:right;\"><label for=\"trebilarghezza\">Larghezza <input id=\"trebilarghezza\" name=\"trebilarghezza\" type=\"text\" value=\"<?php echo $trebilarghezza;?>\"/></label></p>\n <p style=\"text-align:right;\"><label for=\"trebibuno\">B1 <input id=\"trebibuno\" name=\"trebibuno\" type=\"text\" value=\"<?php echo $trebibuno;?>\"/></label></p>\n <p style=\"text-align:right;\"><label for=\"trebibdue\">B2 <input id=\"trebibdue\" name=\"trebibdue\" type=\"text\" value=\"<?php echo $trebibdue;?>\"/></label></p>\n <p style=\"text-align:right;\"><label for=\"trebibtre\">B3 <input id=\"trebibtre\" name=\"trebibtre\" type=\"text\" value=\"<?php echo $trebibtre;?>\"/></label></p>\n <p style=\"text-align:right;\"><label for=\"trebicuno\">C1 <input id=\"trebicuno\" name=\"trebicuno\" type=\"text\" value=\"<?php echo $trebicuno;?>\"/></label></p>\n <p style=\"text-align:right;\"><label for=\"trebicdue\">C2 <input id=\"trebicdue\" name=\"trebicdue\" type=\"text\" value=\"<?php echo $trebicdue;?>\"/></label></p>\n <p style=\"text-align:right;\"><label for=\"trebictre\">C3 <input id=\"trebictre\" name=\"trebictre\" type=\"text\" value=\"<?php echo $trebictre;?>\"/></label></p>\n <p style=\"text-align:right;\"><label for=\"trebitipo\">Tipo\n <select id=\"trebitipo\" name=\"trebitipo\"> \n\t\t<option label=\"Localit&agrave; Compatti 1 giorno\" value=\"xssmall\"<?php if ($trebitipo=='xssmall') echo ' selected=\"selected\"';?>>Localit&agrave; Compatti 1 giorno</option> \n\t\t<option label=\"Localit&agrave; Compatti 6 giorni\" value=\"lsmall\"<?php if ($trebitipo=='lsmall') echo ' selected=\"selected\"';?>>Localit&agrave; Compatti 6 giorni</option> \n\t\t<option label=\"Localit&agrave; Compatti 7 giorni\" value=\"lbigor\"<?php if ($trebitipo=='lbigor') echo ' selected=\"selected\"';?>>Localit&agrave; Compatti 7 giorni</option> \n\t\t<option label=\"Localit&agrave; Dati in Diretta\" value=\"treale\"<?php if ($trebitipo=='treale') echo ' selected=\"selected\"';?>>Localit&agrave; Dati in Diretta</option> \n\t\t<option label=\"Tutte le Localit&agrave;\" value=\"ssmall\"<?php if ($trebitipo=='ssmall') echo ' selected=\"selected\"';?>>Tutte le Localit&agrave;</option> \n\t\t<option label=\"Localit&agrave; estese 7 giorni\" value=\"lbig\"<?php if ($trebitipo=='lbig') echo ' selected=\"selected\"';?>>Localit&agrave; estese 7 giorni</option> \n\t\t<option label=\"Localit&agrave; estese orario\" value=\"oraxora\"<?php if ($trebitipo=='oraxora') echo ' selected=\"selected\"';?>>Localit&agrave; estese orario</option> \n\t\t<option label=\"Regionali compatto\" value=\"msmall\"<?php if ($trebitipo=='msmall') echo ' selected=\"selected\"';?>>Regionali compatto</option> \n\t\t<option label=\"Regionali 7 giorni\" value=\"msmacro\"<?php if ($trebitipo=='msmacro') echo ' selected=\"selected\"';?>>Regionali 7 giorni</option> \n\t\t<option label=\"Localit&agrave; Marine 1 giorno\" value=\"lsmari\"<?php if ($trebitipo=='lsmari') echo ' selected=\"selected\"';?>>Localit&agrave; Marine 1 giorno</option> \n\t\t<option label=\"Localit&agrave; Marine 7 giorno\" value=\"lmari\"<?php if ($trebitipo=='lmari') echo ' selected=\"selected\"';?>>Localit&agrave; Marine 7 giorno</option> \n\t\t<option label=\"Regionali Marine 7 giorni\" value=\"mmari\"<?php if ($trebitipo=='mmari') echo ' selected=\"selected\"';?>>Regionali Marine 7 giorni</option> \n\t\t<option label=\"Neve 1 giorno\" value=\"lsneve\"<?php if ($trebitipo=='lsneve') echo ' selected=\"selected\"';?>>Neve 1 giorno</option> \n\t\t<option label=\"Neve 7 giorni\" value=\"lneve\"<?php if ($trebitipo=='lneve') echo ' selected=\"selected\"';?>>Neve 7 giorni</option>\n\t</select>\n </label>\n\t</p>\n <!--<p style=\"text-align:right;\">\n <select id=\"trebimeteoregione\" name=\"trebimeteoregione\"> \n\t\t<option label=\"Abruzzo (idreg=1)\" value=\"1\">Abruzzo (idreg=1)</option> \n\t\t<option label=\"Basilicata (idreg=2)\" value=\"2\">Basilicata (idreg=2)</option> \n\t\t<option label=\"Calabria (idreg=3)\" value=\"3\">Calabria (idreg=3)</option> \n\t\t<option label=\"Campania (idreg=4)\" value=\"4\">Campania (idreg=4)</option> \n\t\t<option label=\"Emilia (idreg=5)\" value=\"5\">Emilia (idreg=5)</option> \n\t\t<option label=\"Friuli (idreg=6)\" value=\"6\">Friuli (idreg=6)</option> \n\t\t<option label=\"Lazio (idreg=7)\" value=\"7\">Lazio (idreg=7)</option> \n\t\t<option label=\"Liguria (idreg=8)\" value=\"8\">Liguria (idreg=8)</option> \n\t\t<option label=\"Lombardia (idreg=9)\" value=\"9\">Lombardia (idreg=9)</option> \n\t\t<option label=\"Marche (idreg=10)\" value=\"10\">Marche (idreg=10)</option> \n\t\t<option label=\"Molise (idreg=11)\" value=\"11\">Molise (idreg=11)</option> \n\t\t<option label=\"Piemonte (idreg=12)\" value=\"12\">Piemonte (idreg=12)</option> \n\t\t<option label=\"Puglia (idreg=13)\" value=\"13\">Puglia (idreg=13)</option> \n\t\t<option label=\"Sardegna (idreg=14)\" value=\"14\">Sardegna (idreg=14)</option> \n\t\t<option label=\"Sicilia (idreg=15)\" value=\"15\">Sicilia (idreg=15)</option> \n\t\t<option label=\"Toscana (idreg=16)\" value=\"16\">Toscana (idreg=16)</option> \n\t\t<option label=\"Trentino (idreg=17)\" value=\"17\">Trentino (idreg=17)</option> \n\t\t<option label=\"Umbria (idreg=18)\" value=\"18\">Umbria (idreg=18)</option> \n\t\t<option label=\"Valle aosta (idreg=19)\" value=\"19\">Valle d'aosta (idreg=19)</option> \n\t\t<option label=\"Veneto (idreg=20)\" value=\"20\">Veneto (idreg=20)</option> \n\t</select> \n\t</p>-->\n <!-- <p style=\"text-align:right;\"> \n\t<select name=\"trebimeteolocalita\" id=\"trebimeteolocalita\"> \n\t\t<option label=\"Seleziona Localit&agrave;\" value=\"01\">Seleziona Localit&agrave;</option> \n\t</select> \n <p style=\"text-align:right;\"><label for=\"trebiloc\">Localit&agrave; <input style=\"width: 200px;\" id=\"trebiloc\" name=\"trebiloc\" type=\"text\" value=\"<?php //echo $loc;?>\" /></label></p>-->\n <p><input type=\"hidden\" id=\"trebimeteo-submit\" name=\"trebimeteo-submit\" value=\"1\" /></p> \n<?php\n\t\t}", "public function render()\n {\n $boton = '<button type=\"' . $this->_type . '\" value=\"' . $this->_value . '\"';\n if ($this->_form) {\n $boton .= ' form=\"' . $this->_form . '\" ';\n }\n if ($this->_name) {\n $boton .= ' name=\"' . $this->_name. '\" ';\n }\n if ($this->_autoFocus) {\n $boton .= ' autofocus=\"' . $this->_autoFocus. '\" ';\n }\n if ($this->_disabled) {\n $boton .= ' disabled ';\n }\n if ($this->getClass()) {\n $boton .= 'class=\"' . $this->getClass() . '\" ';\n }\n if ($this->_id) {\n $boton .= 'id=\"' . $this->_id . '\" ';\n }\n \n $boton .= '>' . $this->_value . '</button>' . \"\\n\";\n $boton = str_replace(\" \", \" \", $boton);\n return $boton;\n }", "public function getWidgetScript()\n {\n foreach ($this as $channel) {\n if ($channel instanceof Dotpay) {\n return $channel->getScript($this->getChannelIds());\n }\n }\n\n return new Script(new PlainText());\n }", "public static function createInstance()\n {\n return new TextArea('ISerializable', 'ISerializable');\n }", "protected function getTrickTip()\n {\n $element = new Lib_Form_Element_TinyMce('trickTip');\n $element->setLabel(ucfirst(Globals::getTranslate()->_('trickTip')))\n ->addPrefixPath('Lib_Filter', 'Lib/Filter', 'Filter');\n return $element;\n }", "public function init()\n {\n return $this->getView();\n }", "function Get()\r\n\t{\r\n\t\tif (!$this->Active) return;\r\n\r\n\t\t$this->Behavior->Target = $this->Name;\r\n\r\n\t\t$t = new Template();\r\n\t\t$t->ReWrite('forms', array(&$this, 'TagForms'));\r\n\t\t$t->ReWrite('search', array(&$this, 'TagSearch'));\r\n\t\t$t->Set('target', $this->Behavior->Target);\r\n\t\t$t->Set('name', $this->Name);\r\n\t\t$t->Set('plural', Str::Plural($this->ds->Description));\r\n\r\n\t\tif (!empty($this->ds))\r\n\t\t\t$t->Set('table_title', Str::Plural($this->ds->Description));\r\n\r\n\t\t$t->Set('table', $this->GetTable($this->Behavior->Target,\r\n\t\t\tServer::GetState($this->Name.'_ci')));\r\n\r\n\t\t$t->Set($this->View);\r\n\t\t$t->Set('assoc', $this->Name);\r\n\r\n\t\treturn $t->ParseFile(Module::L('editor_data/editor.xml'));\r\n\t}", "public function getBackendWidget()\n {\n return $GLOBALS['BE_FFL']['tableWizard'];\n }", "private function get_widget_obj( $id_base ) {\n\t\tglobal $wp_widget_factory;\n\n\t\t$widget = wp_filter_object_list( $wp_widget_factory->widgets, array( 'id_base' => $id_base ) );\n\t\tif ( empty( $widget ) ) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn array_pop( $widget );\n\t}", "public static function getBlnTemplate()\n {\n return self::$_template;\n }", "protected function createComponentTarifForm()\r\n\t{\r\n\t\t$form = new Form;\r\n\t\t$form->addText('name', 'Jméno:')\r\n\t\t\t->setRequired('Zadej jméno.');\r\n\r\n\t\t$form->addText('apicode', 'API Code:');\r\n\r\n\t\t$form->addText('price', 'Cena:')\r\n\t\t ->addRule(Form::INTEGER, 'Cena musí být číslo')\r\n\t\t\t->setRequired('Zadej cenu.');\r\n\t\t\r\n\t\t$form->addText('description', 'Popis:');\r\n\t\t\t\r\n\t\t$form->addSubmit('save', 'Uložit')\r\n\t\t\t->setAttribute('class', 'default')\r\n\t\t\t->onClick[] = $this->tarifFormSucceeded;\r\n\r\n\t\t$form->addSubmit('cancel', 'Cancel')\r\n\t\t\t->setValidationScope(NULL)\r\n\t\t\t->onClick[] = $this->formCancelled;\r\n\r\n\t\t$form->addProtection();\r\n\t\treturn $form;\r\n\t}", "static public function instance()\n\t\t{\n\t\t\tif( is_null( avia_widget_loader::$_instance ) )\n\t\t\t{\n\t\t\t\tavia_widget_loader::$_instance = new avia_widget_loader();\n\t\t\t}\n\n\t\t\treturn avia_widget_loader::$_instance;\n\t\t}", "public function getTwig()\n {\n return $this->twig;\n }", "public function getTwig()\n {\n return $this->twig;\n }", "public function getWidget() {\n\t\t$sAction = $this->getRequest()->getVal( 'action', 'view' );\n\t\tif( !in_array( $sAction, array( 'view', 'historysubmit' ) ) ) return null;\n\n\t\t$oCurrentTitle = $this->getTitle();\n\t\tif( $oCurrentTitle->quickUserCan( 'universalexport-export' ) === false ) return null;\n\n\t\t$aCurrentQueryParams = $this->getRequest()->getValues();\n\t\t$sTitle = isset($aCurrentQueryParams['title']) ? $aCurrentQueryParams['title'] : \"\";\n\t\t$sSpecialPageParameter = BsCore::sanitize( $sTitle, '', BsPARAMTYPE::STRING );\n\t\t$oSpecialPage = SpecialPage::getTitleFor( 'UniversalExport',$sSpecialPageParameter );\n\t\tif( isset( $aCurrentQueryParams['title'] ) ) unset( $aCurrentQueryParams['title'] );\n\n\t\t$aModules = array();\n\t\twfRunHooks(\n\t\t\t'BSUniversalExportGetWidget',\n\t\t\tarray( $this, &$aModules, $oSpecialPage, $oCurrentTitle, $aCurrentQueryParams )\n\t\t);\n\n\t\tif( empty( $aModules ) ) return null;\n\n\t\t$sList = '';\n\t\tforeach( $aModules as $oModuleView ) {\n\t\t\tif( $oModuleView instanceof ViewBaseElement ) {\n\t\t\t\t$sList .= $oModuleView->execute();\n\t\t\t}\n\t\t\telse {\n\t\t\t\twfDebugLog( 'BS::UniversalExport', 'getWidget: Invalid view.' );\n\t\t\t}\n\t\t}\n\n\t\t$oWidgetView = new ViewWidget();\n\t\t$oWidgetView->setId( 'universalexport' )\n\t\t\t\t\t->setTitle( wfMessage( 'bs-universalexport-widget-title' )->plain() )\n\t\t\t\t\t->setBody( $sList )\n\t\t\t\t\t->setTooltip( wfMessage( 'bs-universalexport-widget-tooltip' )->plain() );\n\n\t\treturn $oWidgetView;\n\t}", "public function getWidget()\n {\n return $this->hasOne(Widgets::className(), ['id' => 'widgetId']);\n }", "public function getRTERootBlockElement()\n\t{\n\t}", "public function get_instance()\n\t{\n\t\treturn $this;\n\t}", "public function get_instance()\n\t{\n\t\treturn $this;\n\t}", "public function getSeoWidget($page_type)\n { \n $widget = HomePageWidget::where('status', HomePageWidget::ACTIVE)->where('type', HomePageWidget::TYPE_OTHERS)->where('page_type',$page_type)->first();\n return $widget;\n }", "function WidgetMeteo($vars) {\n\t\t\tglobal $wpdb;\n\t\t\tglobal $wpdb_query;\n\t\t\tglobal $wp_rewrite;\n\t\t\textract($vars);\n\n\t\t\t$options = get_option('widget_trebimeteo');\n\n\t\t\t$trebimeteotitle = $options['trebimeteotitle'];\n\t\t\t$trebiregione = urlencode($options['trebiregione']);\n\t\t\t$trebilocalita = urlencode($options['trebilocalita']);\n\t\t\t$trebicuno = urlencode($options['trebicuno']);\n\t\t\t$trebicdue = urlencode($options['trebicdue']);\n\t\t\t$trebictre = urlencode($options['trebictre']);\n\t\t\t$trebibuno = urlencode($options['trebibuno']);\n\t\t\t$trebibdue = urlencode($options['trebibdue']);\n\t\t\t$trebibtre = urlencode($options['trebibtre']);\n\t\t\t$trebilarghezza = urlencode($options['trebilarghezza']);\n\t\t\t$trebialtezza = urlencode($options['trebialtezza']);\n\t\t\t$trebitipo = urlencode($options['trebitipo']);\n\t\t\t\n\t\t\t$before_widget='<div class=\"textwidget\">';\n\t\t\t$after_widget='</div>';\n\t\t\techo $before_widget;\n\t\t\techo $before_title; echo $trebimeteotitle; echo $after_title;\n\t\t\t$site_base = get_bloginfo('url');\n\t\n\t\t\tswitch ($trebitipo) {\n\t\t\t\tcase 'xssmall':\n\t\t\t\t\t$trebiurl = 'loc='.$trebilocalita.'&tm=xssmall&c1='.$c1.'&b1='.$trebibuno.'&b2='.$trebibdue;\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'lsmall':\n\t\t\t\t\t$trebiurl = 'loc='.$trebilocalita.'&tm='.$trebitipo.'&new=1&c1='.$trebicuno.'&c2='.$trebicdue.'&b1='.$trebibuno.'&b2='.$trebibdue.'&b3='.$trebibtre;\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'lbigor':\n\t\t\t\t\t$trebiurl = 'loc='.$trebilocalita.'&tm='.$trebitipo.'&new=1&c1='.$trebicuno.'&c2='.$trebicdue.'&b1='.$trebibuno.'&b2='.$trebibdue.'&b3='.$trebibtre;\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'treale':\n\t\t\t\t\t$trebiurl = 'loc='.$trebilocalita.'&tm='.$trebitipo.'&c1='.$trebicuno.'&b1='.$trebibuno.'&b2='.$trebibdue;\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'ssmall':\n\t\t\t\t\t$trebiurl = 'loc='.$trebilocalita.'&p=1&tm='.$trebitipo.'&new=1&c1='.$trebicuno.'&c2='.$trebicdue.'&b1='.$trebibuno.'&b2='.$trebibdue.'&b3='.$trebibtre;\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'lbig':\n\t\t\t\t\t$trebiurl = 'loc='.$trebilocalita.'&tm='.$trebitipo.'&new=1&c1='.$trebicuno.'&c2='.$trebicdue.'&c3='.$trebictre.'&b1='.$trebibuno.'&b2='.$trebibdue;\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'oraxora':\n\t\t\t\t\t$trebiurl = 'loc='.$trebilocalita.'&tm='.$trebitipo.'&c1='.$trebicuno.'&c2='.$trebicdue.'&c3='.$trebictre.'&b1='.$trebibuno.'&b2='.$trebibdue;\n\t\t\t\t\tbreak;\t\n\t\t\t\tcase 'msmall':\n\t\t\t\t\t$trebiurl = 'idreg='.$trebiregione.'&tm='.$trebitipo.'&new=1&c1='.$trebicuno.'&b1='.$trebibuno.'&b2='.$trebibdue;\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'msmacro': \n\t\t\t\t\t$trebiurl = 'idreg='.$trebiregione.'&tm='.$trebitipo.'&c1='.$trebicuno.'&c2='.$trebicdue.'&c3='.$trebictre.'&b1='.$trebibuno.'&b2='.$trebibdue;\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'lsmari':\n\t\t\t\t\t$trebiurl = 'loc='.$trebilocalita.'&tm='.$trebitipo.'&c1='.$trebicuno.'&b1='.$trebibuno.'&b2='.$trebibdue;\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'lmari':\n\t\t\t\t\t$trebiurl = 'loc='.$trebilocalita.'&tm='.$trebitipo.'&c1='.$trebicuno.'&c3='.$trebictre.'&b1='.$trebibuno.'&b2='.$trebibdue;\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'mmari':\n\t\t\t\t\t$trebiurl = 'idreg='.$trebiregione.'&tm='.$trebitipo.'&c1='.$trebicuno.'&c2='.$trebicdue.'&b1='.$trebibuno.'&b2='.$trebibdue.'&c3='.$trebictre;\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'lsneve':\n\t\t\t\t\t$trebiurl = 'loc='.$trebilocalita.'&tm='.$trebitipo.'&c1='.$trebicuno.'&b1='.$trebibuno.'&b2='.$trebibdue;\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'lneve':\n\t\t\t\t\t$trebiurl = 'loc='.$trebilocalita.'&tm='.$trebitipo.'&c1='.$trebicuno.'&c3='.$trebictre.'&b1='.$trebibuno.'&b2='.$trebibdue;\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\t\n\t\t\techo '<iframe src=\"https://portali.3bmeteo.com/3bm_meteo.php?'.$trebiurl.'\" width=\"'.$trebilarghezza.'\" height=\"'.$trebialtezza.'\" frameborder=\"0\"></iframe>';\n\t\t\tif ($trebitipo=='mmari' || $trebitipo=='msmacro' || $trebitipo=='msmall') { echo trebi_getUrlRegione($trebiregione); }\n\t\t\telse { echo trebi_getUrlLoc($trebilocalita); }\n\t\t\t//echo '<br/><a href=\"http://www.3bmeteo.com/meteo/abbateggio\" >Meteo Abbateggio</a>'\n\t\t\techo $after_widget;\n\t\t}", "public function getLibraryWidget($type)\n {\n $library = $this->fetchLibrary();\n return !empty($library['widgets'][$type]) ? $library['widgets'][$type] : null;\n }", "function getTemplate(){\n\t\treturn $this->html_result;\n\t}", "public function getView() {\n\t\treturn $this -> st_view;\n\t}", "function element_type() {\n if (is_a($this->view->display_handler, 'voipviews_views_plugin_display')) {\n return 'voipviews';\n }\n else {\n return 'span';\n }\n }", "function TIL ()\n {\n \n return Tilnet_Blocks::instance();\n }", "public function twitterButtons()\n {\n return $this;\n }", "public function getTreeAdaptor();", "public function getControl()\r\n {\r\n return $this->_checkBoxTreeRender($this->_getTree());\r\n }", "function ApontadorWidget() {\n $widget_ops = array('classname' => 'apontador_widget', 'description' => __( \"Display your reviews from Apontador\", \"wp-apontador\") );\n $control_ops = array('width' => 300, 'height' => 300);\n $this->WP_Widget('apontador', __('Apontador Reviews', \"wp-apontador\"), $widget_ops, $control_ops);\n\n }", "public static function getTerminal()\n {\n return new Terminal(\n self::getRepository(),\n self::getCart(),\n self::getCartTotal()\n );\n }", "function get_teaser() \t{\n \t\treturn $this->teaser;\n \t}", "private function _View() {\n\t \n // $this->_View;\n\t\t\t//$View = ClassRegistry::getObject('');\n\t\treturn $this->_View;\n\t}", "protected function get_widgets()\n {\n }", "public function getRenderer(Widget $widget);", "function getInputElement($alias,$label)\n {\n return new T_Form_Text($alias,$label);\n }", "public function txtCapacidadTanque_Create($strControlId = null) {\n\t\t\t$this->txtCapacidadTanque = new QTextBox($this->objParentObject, $strControlId);\n\t\t\t$this->txtCapacidadTanque->Name = QApplication::Translate('Capacidad Tanque');\n\t\t\t$this->txtCapacidadTanque->Text = $this->objFichas->CapacidadTanque;\n\t\t\t$this->txtCapacidadTanque->MaxLength = Fichas::CapacidadTanqueMaxLength;\n\t\t\treturn $this->txtCapacidadTanque;\n\t\t}", "public function widget( $args, $instance ) {\r\n \r\n $obj = new BlossomThemes_Toolkit_Functions();\r\n $title = ! empty( $instance['title'] ) ? $instance['title'] : '' ; \r\n $content = ! empty( $instance['content'] ) ? $instance['content'] : '';\r\n $icon = ! empty( $instance['icon'] ) ? $instance['icon'] : '';\r\n $image = ! empty( $instance['image'] ) ? $instance['image'] : '';\r\n $link = ! empty( $instance['link'] ) ? $instance['link'] : '';\r\n $more_text = ! empty( $instance['more_text'] ) ? $instance['more_text'] : '';\r\n $target = 'target=\"_blank\"';\r\n if( isset($instance['target']) && $instance['target']!='' )\r\n {\r\n $target = 'target=\"_self\"';\r\n }\r\n\r\n if( $image ){\r\n /** Added to work for demo content compatible */\r\n $attachment_id = $image;\r\n if ( !filter_var( $image, FILTER_VALIDATE_URL ) === false ) {\r\n $attachment_id = $obj->bttk_get_attachment_id( $image );\r\n }\r\n $icon_img_size = apply_filters( 'bttk_icon_img_size', 'thumbnail' );\r\n }\r\n \r\n echo $args['before_widget'];\r\n ob_start(); \r\n ?>\r\n \r\n <div class=\"rtc-itw-holder\">\r\n <div class=\"rtc-itw-inner-holder\">\r\n <div class=\"text-holder\">\r\n <?php \r\n if( $title ) echo $args['before_title'] . apply_filters( 'widget_title', $title, $instance, $this->id_base ) . $args['after_title']; \r\n if( $content ) echo '<div class=\"content\">'.wpautop( wp_kses_post( $content ) ).'</div>';\r\n if( isset( $link ) && $link!='' && isset( $more_text ) && $more_text!='' ){\r\n echo '<a '.$target.' class=\"btn-readmore\" href=\"'.esc_url($link).'\">'.esc_attr($more_text).'</a>';\r\n }\r\n ?> \r\n </div>\r\n <?php if( $image ){ ?>\r\n <div class=\"icon-holder\">\r\n <?php echo wp_get_attachment_image( $attachment_id, $icon_img_size, false, \r\n array( 'alt' => esc_attr( $title )));?>\r\n </div>\r\n <?php }elseif( $icon ){ ?>\r\n <div class=\"icon-holder\">\r\n <span class=\"<?php echo esc_attr( $icon ); ?>\"></span>\r\n </div>\r\n <?php }?>\r\n </div>\r\n </div>\r\n <?php \r\n $html = ob_get_clean();\r\n echo apply_filters( 'blossom_icontext_widget_filter', $html, $args, $instance ); \r\n echo $args['after_widget'];\r\n }", "public static function getClientWidget()\n {\n return \"cool/workflow/taskEditor\";\n }", "function register_btc_widget() {\r\n register_widget( 'BTC_Live_Rate_Widget' );\r\n}", "public function getTreinen()\n {\n return $this->treinen;\n }", "static function get_instance() {\n\t\t\tif (null == VG_Page_Template_Hide_Elements::$instance) {\n\t\t\t\tVG_Page_Template_Hide_Elements::$instance = new VG_Page_Template_Hide_Elements();\n\t\t\t\tVG_Page_Template_Hide_Elements::$instance->init();\n\t\t\t}\n\t\t\treturn VG_Page_Template_Hide_Elements::$instance;\n\t\t}", "function create_object_settings() {\n if (!isset($this->settings)) {\n require_once($this->addon->dir . 'include/class.widget.settings.php');\n $this->settings = new SLPWidget_Legacy_Settings( array( 'addon' => $this->addon ) );\n }\n }", "public function getView()\n\t{\n\t\tif(NULL === $this->_view) {\n\t\t\t$this->_view = agoractu_view::getInstance();\n\t\t}\n\t\treturn $this->_view;\n\t}", "public function getView()\n\t{\n\t\treturn $this->view;\n\t}", "public function getTIPOSANGUINEO()\r\n {\r\n return $this->TIPO_SANGUINEO;\r\n }", "public function visualize()\n {\n \n return new StringWrapper('object('.$this->name().')');\n \n }", "public function getView()\n {\n return $this->cntView;\n }", "public function getView()\r\n {\r\n return $this->view;\r\n }", "public function getControl()\n\t{\n\t\t$control = parent::getControl();\n\t\t$control->addAttributes(array(\n\t\t\t'id' => $this->getHtmlId(),\n\t\t));\n\t\treturn $control;\n\t}", "protected function retrieve_widgets()\n {\n }", "protected function retrieve_widgets()\n {\n }" ]
[ "0.62146896", "0.5792136", "0.57477295", "0.572281", "0.5649977", "0.5632038", "0.554795", "0.54234767", "0.53488743", "0.528985", "0.5289271", "0.51973015", "0.5195279", "0.51777416", "0.51638937", "0.50916487", "0.5074862", "0.5074632", "0.5060148", "0.5051824", "0.5050602", "0.50295514", "0.5017505", "0.50071555", "0.5007042", "0.49978045", "0.4985169", "0.49762252", "0.49628338", "0.49458382", "0.4928491", "0.49023855", "0.48998764", "0.48981437", "0.48883432", "0.48871413", "0.4884811", "0.486622", "0.4853311", "0.48521566", "0.48515928", "0.48511374", "0.48503628", "0.4844457", "0.48345196", "0.4828803", "0.48146608", "0.48134875", "0.480783", "0.48072675", "0.4802092", "0.4793995", "0.47787583", "0.47681358", "0.4767695", "0.47578165", "0.47386047", "0.47328463", "0.47260797", "0.47101906", "0.47050005", "0.47050005", "0.47020137", "0.47004429", "0.46926603", "0.46920168", "0.46920168", "0.46840847", "0.46819544", "0.46633992", "0.4662307", "0.46568114", "0.46545076", "0.464885", "0.46483", "0.46473527", "0.4643761", "0.46372274", "0.46333852", "0.46317166", "0.46288124", "0.4628279", "0.46266174", "0.4621469", "0.46194357", "0.46130478", "0.46002874", "0.459989", "0.4599146", "0.45973468", "0.4594361", "0.45928544", "0.4584976", "0.45846215", "0.45824823", "0.45810148", "0.45785385", "0.45783255", "0.45773333", "0.45773333" ]
0.66951597
0
Create a new command instance.
public function __construct() { parent::__construct(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected function newCommand() {\n return newinstance(Command::class, [], '{\n public static $wasRun= false;\n public function __construct() { self::$wasRun= false; }\n public function run() { self::$wasRun= true; }\n public function wasRun() { return self::$wasRun; }\n }');\n }", "public function createCommand()\r\n\t{\r\n\t\t$obj = new DbCommand($this,$this->dbms);\r\n\t\treturn $obj;\r\n\t}", "public function createCommand() {\n\t\treturn new UnboxedCommand( $this );\n\t}", "protected function createCommand($args) {\n $command = new Command();\n $command->id = ifseta($args, 'id');\n $command->name = ifseta($args, 'name');\n $command->url = ifseta($args, 'url');\n $command->description = ifseta($args, 'description');\n $command->uses = ifseta($args, 'uses');\n $command->creationDate = ifseta($args, 'creation_date');\n $command->lastUseDate = ifseta($args, 'last_use_date');\n $command->goldenEggDate = ifseta($args, 'golden_egg_date');\n return $command;\n }", "static public function create($cmd = null, $args = null)\n {\n return new self($cmd, $args);\n }", "public function createCommand($kernel, string $commandName = null, string $commandDescription = null): Command;", "public function makeCommand() \n {\n if($this->CrontabCommandObject === NULL)\n {\n $this->CrontabCommandObject = new \\root\\library\\Crontab\\CrontabCommand\\CrontabCommand();\n }\n \n return $this->CrontabCommandObject;\n }", "public function testInstantiation()\n {\n $command = new CreateRule('dummy name');\n }", "public function command(Command $command);", "public function __construct($command)\n {\n $this->command = $command;\n }", "public static function create(array $data)\n {\n $command = new static();\n $command->exchangeArray($data);\n return $command;\n }", "protected function getCreateCommand()\n {\n $command = new IndexCreateCommand();\n $command->setContainer($this->getContainer());\n\n return $command;\n }", "public function createCommand($string = '')\n {\n return $this->createStringable($string);\n }", "public function createCommand($type) {\r\n $command = $this->xml->createElement('command');\r\n $command->setAttribute('xsi:type', $type);\r\n $command->setAttribute('xmlns', '');\r\n $this->xmlSchema($command);\r\n return $command;\r\n }", "public function __construct()\n {\n // We will go ahead and set the name, description, and parameters on console\n // commands just to make things a little easier on the developer. This is\n // so they don't have to all be manually specified in the constructors.\n if (isset($this->signature)) {\n $this->configureUsingFluentDefinition();\n } else {\n parent::__construct($this->name);\n }\n\n // Once we have constructed the command, we'll set the description and other\n // related properties of the command. If a signature wasn't used to build\n // the command we'll set the arguments and the options on this command.\n $this->setDescription((string) $this->description);\n\n $this->setHelp((string) $this->help);\n\n $this->setHidden($this->isHidden());\n\n if (! isset($this->signature)) {\n $this->specifyParameters();\n }\n }", "public function make(string $name, PreprocessorInterface $preprocessor = null): CommandInterface;", "private function _getCommandByClassName($className)\n {\n return new $className;\n }", "public function newCommand($regex, $callable) {\n $cmd = new Command();\n $cmd->regex = $regex;\n $cmd->callable = $callable;\n return $this->addCommand($cmd);\n }", "public static function create($commandID, ...$args)\n {\n $arguments = func_get_args();\n\n return new static(array_shift($arguments), $arguments);\n }", "private function __construct($command = null)\n {\n $this->command = $command;\n }", "public static function factory(string $command, string $before = '', string $after = ''): self\n {\n return new self($command, $before, $after);\n }", "public function getCommand() {}", "protected function buildCommand()\n {\n $command = new Command(\\Tivie\\Command\\ESCAPE);\n $command\n ->chdir(realpath($this->repoDir))\n ->setCommand($this->gitDir)\n ->addArgument(new Argument('tag', null, null, false))\n ->addArgument(new Argument($this->tag, null, null, true));\n\n return $command;\n }", "public function testCanBeInstantiated()\n {\n $command = $this->createInstance();\n $this->assertInstanceOf('\\\\Dhii\\\\ShellInterop\\\\CommandInterface', $command, 'Command must be an interoperable command');\n $this->assertInstanceOf('\\\\Dhii\\\\ShellCommandInterop\\\\ConfigurableCommandInterface', $command, 'Command must be a configurable command');\n $this->assertInstanceOf('\\\\Dhii\\\\ShellCommandInterop\\\\MutableCommandInterface', $command, 'Command must be a mutable command');\n }", "public function getCommand();", "protected function createCommand($name, array $parameters = [])\n {\n return new Fluent(\n array_merge(\n compact('name'),\n $parameters)\n );\n }", "public function testCanPassCommandStringToConstructor()\n {\n $command = new Command('/bin/ls -l');\n\n $this->assertEquals('/bin/ls -l', $command->getExecCommand());\n }", "public function makeCommandInstanceByType(...$args): CommandInterface\n {\n $commandType = array_shift($args);\n\n switch ($commandType) {\n case self::PROGRAM_READ_MODEL_FETCH_ONE_COMMAND:\n return $this->makeFetchOneCommand(...$args);\n\n case self::PROGRAM_READ_MODEL_FIND_COMMAND:\n return $this->makeFindCommand(...$args);\n\n case self::PROGRAM_READ_MODEL_FIND_LITE_COMMAND:\n return $this->makeFindLiteCommand(...$args);\n\n case self::PROGRAM_READ_MODEL_CREATE_TASK_COMMAND:\n return $this->makeItemCreateTaskCommand(...$args);\n\n case self::PROGRAM_READ_MODEL_CREATE_COMMAND:\n return $this->makeItemCreateCommand(...$args);\n\n case self::PROGRAM_READ_MODEL_UPDATE_TASK_COMMAND:\n return $this->makeItemUpdateTaskCommand(...$args);\n\n case self::PROGRAM_READ_MODEL_UPDATE_COMMAND:\n return $this->makeItemUpdateCommand(...$args);\n\n case self::PROGRAM_READ_MODEL_DELETE_TASK_COMMAND:\n return $this->makeItemDeleteTaskCommand(...$args);\n\n case self::PROGRAM_READ_MODEL_DELETE_COMMAND:\n return $this->makeItemDeleteCommand(...$args);\n\n case self::PROGRAM_READ_MODEL_ADD_ID_COMMAND:\n return $this->makeItemAddIdCommand(...$args);\n\n default:\n throw new FactoryException(sprintf('Command bus for type `%s` not found!', (string) $commandType));\n }\n }", "public function __construct($cmd)\n {\n $this->cmd = $cmd;\n }", "public function getCommand()\n {\n }", "public function command($class)\n {\n $runnable = $this->resolveClass($class);\n\n if ( ! $runnable instanceof Command) {\n throw new InvalidArgumentException(get_class($runnable).' must be an instance of '.Command::class.'.');\n }\n\n $command = $runnable;\n\n if ($runnable instanceof Taggable) {\n $command = new Cached($command, $this);\n }\n\n if ($runnable instanceof Transactional) {\n $command = new Transaction($command, $this, $this->makeFromContainer(ConnectionInterface::class));\n }\n\n if ($runnable instanceof Eventable) {\n $command = new Evented($command, $this);\n }\n\n return $this->newBuilder($command);\n }", "protected function createCommandFactory(): CommandFactory\n {\n return new CommandFactory([\n 'CLOSE' => Command\\CLOSE::class,\n ]);\n }", "public static function register() {\n\n if ( !defined( 'WP_CLI' ) || !WP_CLI ) {\n return;\n }\n \n $instance = new static;\n if(empty( $instance->namespace )) {\n throw new \\Exception(\"Command namespace not defined\", 1);\n \n }\n\t\t\\WP_CLI::add_command( $instance->namespace, $instance, $instance->args ?? null );\n\t}", "public function addCommand($command);", "public function add(Command $command);", "abstract protected function getCommand();", "public function createCommand()\r\n\t{\r\n\t\t//start the string\r\n\t\t$command = '';\r\n\t\t\r\n\t\t//add the java command or the path to java\r\n\t\t$command .= $this->java_path;\r\n\t\t\r\n\t\t//add the class path\r\n\t\t$command .= ' -cp \"'. $this->stanford_path . $this->seperator . '*\" ';\r\n\t\t\r\n\t\t//add options\r\n\t\t$options = implode(' ', $this->java_options);\r\n\t\t$command .= '-'.$options;\r\n\t\t\r\n\t\t//add the call to the pipeline object\r\n\t\t$command .= ' edu.stanford.nlp.pipeline.StanfordCoreNLP ';\r\n\r\n\t\t//add the annotators\r\n\t\t$command .= '-annotators '. $this->listAnnotators();\r\n\t\t\r\n\t\t//add the input and output directors\r\n\t\t$command .= ' -file '. $this->tmp_file . ' -outputDirectory '. $this->tmp_path;\r\n\t\t\r\n\t\t//this is for testing purposes\r\n\t\t//$command .= ' -file '. $this->tmp_path .'\\\\nlp3F25.tmp' . ' -outputDirectory '. $this->tmp_path;\r\n\t\t\r\n\t\t//if using regexner add this to the command string\r\n\t\tif($this->annotators['regexner'] === true)\r\n\t\t{\r\n\t\t\t$command .=' -regexner.mapping '. $this->regexner_path . $this->seperator . $this->regexner_file;\r\n\t\t}\r\n\t\t\r\n\t\t\r\n\t\treturn $command;\r\n\t}", "protected function createCommand(string $name, array $parameters = []): Fluent\n {\n return new Fluent(array_merge(compact('name'), $parameters));\n }", "public function __construct()\n {\n parent::__construct(static::NAME, static::VERSION);\n $this->add(new DefaultCommand());\n }", "public function __construct()\n {\n parent::__construct();\n\n $this->command_name = config(\"custom-commands.command_name\");\n\n parent::__construct($this->signature = $this->command_name);\n\n $this->commands = (array) config(\"custom-commands.commands\");\n \n $this->table = config(\"custom-commands.table\");\n\n $this->row = config(\"custom-commands.row\");\n\n $this->changeEnv = (boolean) config(\"custom-commands.change_env\");\n\n }", "protected function createCommandFile()\n {\n $command_file_full_path = $this->command_dir_path . DIRECTORY_SEPARATOR . $this->arg->getCommandFileName();\n\n // Check if the command already exists\n if (file_exists($command_file_full_path)) {\n throw new Exception('Command already exists.');\n }\n\n // Create the file for the new command\n $command_file = fopen($command_file_full_path, 'w');\n\n // TODO: Create Script Generator to generate the PHP scripts for the new command.\n\n fclose($command_file);\n\n $this->console->getOutput()->println('File created at: ' . $command_file_full_path);\n $this->console->getOutput()->success('Command ' . $this->arg->getSignature() . ' created successfully.');\n }", "public static function create() {}", "public static function create() {}", "public static function create() {}", "public static function create(InteropContainer $container)\n {\n $middleware = $container->get('cmd.middleware');\n return new CommandBusFactory($middleware);\n }", "private function createCli() {\n $this->cli = new Cli();\n $this->commands = $this->commandParser->getAllCommands();\n\n foreach ($this->commands as $command) {\n if ($command->isDefault()) {\n $this->cli->command(\"*\");\n foreach ($command->getOptions() as $option) {\n $this->cli->opt($option->getName(), $option->getDescription(), $option->isRequired(), $option->getType());\n }\n foreach ($command->getArguments() as $argument) {\n if (!$argument->isVariadic())\n $this->cli->arg($argument->getName(), $argument->getDescription(), $argument->isRequired());\n }\n }\n if ($command->getName() != \"\") {\n $this->cli->command($command->getName())->description($command->getDescription());\n foreach ($command->getOptions() as $option) {\n $this->cli->opt($option->getName(), $option->getDescription(), $option->isRequired(), $option->getType());\n }\n foreach ($command->getArguments() as $argument) {\n if (!$argument->isVariadic())\n $this->cli->arg($argument->getName(), $argument->getDescription(), $argument->isRequired());\n }\n }\n }\n\n\n }", "public function testInstantiation()\n {\n $this->assertInstanceOf('Contao\\ManagerBundle\\Command\\InstallWebDirCommand', $this->command);\n }", "public function command(string $command): self\n {\n $this->addCommands[] = $command;\n\n return $this;\n }", "public function create() {}", "protected function createProcess($cmd)\n {\n return new Process(explode(' ', $cmd));\n }", "public function create(){}", "protected function getCommandFactory(): Command\\Factory\n {\n return new Command\\RedisFactory();\n }", "public function __construct()\n {\n parent::__construct();\n\n $this->commandData = new CommandData($this, CommandData::$COMMAND_TYPE_API);\n }", "public function testNewCommand() : void\n {\n $this->assertFalse($this->command->hasArguments());\n $this->assertEquals(\"\", $this->command->getArguments());\n }", "protected function createCommandBuilder()\n\t{\n\t\treturn new CSqliteCommandBuilder($this);\n\t}", "public function __construct($command, $config = [])\n {\n $this->command = $command;\n $this->_output = $this->getDefaultOutput();\n parent::__construct($config);\n }", "public function __construct(){\n\n global $argv;\n\n if(!isset($argv[1])){\n echo 'You must supply a command!' . PHP_EOL;\n exit;\n }//if\n\n $args = $argv;\n\n $scriptName = array_shift($args);\n $method = array_shift($args);\n\n $method = explode('-',$method);\n foreach($method as $k => $v){\n if($k != 0){\n $method[$k] = ucwords($v);\n }//if\n }//foreach\n\n $method = implode('',$method);\n\n $resolved = false;\n\n if(method_exists($this,$method)){\n call_user_func(Array($this,$method), $args);\n $resolved = true;\n }//if\n else {\n foreach(static::$extendedCommands as $commandClass){\n if(method_exists($commandClass,$method)){\n call_user_func(Array($commandClass,$method), $args);\n $resolved = true;\n break;\n }//if\n }//foreach\n }//el\n\n if(!$resolved){\n echo \"`{$method}` is not a valid CLI command!\";\n }//if\n\n echo PHP_EOL;\n exit;\n\n }", "public function forCommand($command)\n {\n $this->command = $command;\n $this->pipe = new NullPipe();\n $this->manager = new InteractiveProcessManager($this->userInteraction);\n\n return $this;\n }", "public function __construct()\n {\n parent::__construct('pwman', '0.1.0');\n\n $getCommand = new Get();\n $this->add($getCommand);\n\n $setCommand = new Set();\n $this->add($setCommand);\n }", "public function create() {\n $class_name = $this->getOption('className');\n return new $class_name();\n }", "public function createCommand(?string $sql = null, array $params = []): Command;", "public function __construct($command = NULL, $name = NULL)\n {\n $args = func_get_args();\n\n switch ($command) {\n case self::CONSTR_CMD_POPULATE_SYNCED_ARRAY:\n case self::CONSTR_CMD_POP_FROM_ARR:\n case self::CONSTR_CMD_POP_FROM_OBJ:\n case self::CONSTR_CMD_POP_FROM_DB:\n case self::CONSTR_CMD_NEW:\n $this->setup_name = $name;\n\n # shift off known args\n array_shift($args);\n array_shift($args);\n break;\n }\n\n switch ($command) {\n case self::CONSTR_CMD_POP_FROM_ARR:\n $this->applyArray($args[0]);\n break;\n case self::CONSTR_CMD_POP_FROM_OBJ:\n break;\n case self::CONSTR_CMD_POP_FROM_DB:\n break;\n case self::CONSTR_CMD_POPULATE_SYNCED_ARRAY:\n $this->applyArray($args[0]);\n $this->setAllLoaded();\n break;\n default:\n throw new OrmInputException('Guessing not supported, please explicitly specify construction type');\n self::constructGuess($args);\n }\n\n $this->ensureObjectInDb();\n }", "public function generateCommands();", "protected function newInstanceCommand($commandClass)\n {\n $class = new ReflectionClass($commandClass);\n\n return $class->newInstanceArgs($this->resolveCommandParameters($class));\n }", "protected function buildCommand()\n {\n return $this->command;\n }", "public function makeItemCreateCommand(string $processUuid, array $item): ItemCreateCommand\n {\n $processUuid = ProcessUuid::fromNative($processUuid);\n $uuid = Uuid::fromNative(null);\n $item = Item::fromNative($item);\n\n return new ItemCreateCommand($processUuid, $uuid, $item);\n }", "public function __construct($commandName, $args = [], $description = '') {\n if (!$this->setName($commandName)) {\n $this->setName('--new-command');\n }\n $this->addArgs($args);\n\n if (!$this->setDescription($description)) {\n $this->setDescription('<NO DESCRIPTION>');\n }\n }", "public function getCommand($name, array $args = array())\n {\n return parent::getCommand($name, $args)\n ->setRequestSerializer(RequestSerializer::getInstance());\n }", "protected function buildCommand()\n {\n $command = new Command(\\Tivie\\Command\\DONT_ADD_SPACE_BEFORE_VALUE);\n $command\n ->chdir(realpath($this->repoDir))\n ->setCommand($this->gitDir)\n ->addArgument(new Argument('rev-parse'))\n ->addArgument(new Argument('HEAD'));\n\n return $command;\n }", "protected function instantiateCommand(Request $request, $args)\n {\n $command = new DeletePackageCustomerCommand($args);\n\n $requestBody = $request->getParsedBody();\n\n $this->setCommandFields($command, $requestBody);\n\n return $command;\n }", "public function createCommand($sql = null, $params = [])\n {\n $command = new Command([\n 'db' => $this,\n 'sql' => $sql,\n ]);\n\n return $command->bindValues($params);\n }", "protected function setCommand($value) {\n\t\t$this->_command = trim($value);\n\t\treturn $this;\n\t}", "public function setCommand($command)\n {\n $this->command = $command;\n\n return $this;\n }", "public function buildCommand()\n {\n return parent::buildCommand();\n }", "private function registerMakeModuleCommand()\n {\n $this->app->singleton('command.make.module', function($app) {\n return $app['Caffeinated\\Modules\\Console\\Generators\\MakeModuleCommand'];\n });\n\n $this->commands('command.make.module');\n }", "public function __construct()\n {\n parent::__construct();\n\n $this->currentDirectory = getcwd();\n $this->baseIndentLevel = 0;\n $this->registerCommand(\"Ling\\LingTalfi\\Kaos\\Command\\HelpCommand\", \"help\");\n $this->registerCommand(\"Ling\\LingTalfi\\Kaos\\Command\\InitializePlanetCommand\", \"init\");\n $this->registerCommand(\"Ling\\LingTalfi\\Kaos\\Command\\PackAndPushUniToolCommand\", \"packpushuni\");\n $this->registerCommand(\"Ling\\LingTalfi\\Kaos\\Command\\PackLightPluginCommand\", \"packlightmap\");\n $this->registerCommand(\"Ling\\LingTalfi\\Kaos\\Command\\PushCommand\", \"push\");\n $this->registerCommand(\"Ling\\LingTalfi\\Kaos\\Command\\PushUniverseSnapshotCommand\", \"pushuni\");\n $this->registerCommand(\"Ling\\LingTalfi\\Kaos\\Command\\UpdateSubscriberDependenciesCommand\", \"updsd\");\n\n }", "public function getCommand(string $command);", "protected function registerCommand(){\n\t\t$this->app->singleton('fakeid.command.setup', function ($app){\n\t\t\treturn new SetupCommand();\n\t\t});\n\n\t\t$this->commands('fakeid.command.setup');\n\t}", "public function addCommand($command, $args = [], $data = [])\n {\n $item = new ScreenCommand();\n $item->screen_id = $this->id;\n $item->command = $command;\n $item->arguments = $args;\n $item->fill($data);\n $item->save();\n\n return $item;\n }", "public function test_creating_command_from_container()\n {\n $now = new \\DateTime();\n $this->container->add('DateTime', $now);\n $command = 'Spekkionu\\DomainDispatcher\\Test\\Commands\\CommandWithConstructor';\n $result = $this->dispatcher->dispatch($command);\n $this->assertSame($now, $result);\n }", "protected function createProcess(): Process\n {\n $command = [\n $this->settings['executable']\n ];\n\n $command[] = $this->from;\n $command[] = $this->to;\n\n // Set the margins if needed.\n if ($this->settings['marginsType'] !== self::MARGIN_TYPE_NO_MARGINS) {\n $command[] = '--marginsType=' . $this->settings['marginsType'];\n }\n\n // If we need to proxy with node we just need to prepend the $command with `node`.\n if ($this->settings['proxyWithNode']) {\n array_unshift($command, 'node');\n }\n\n // If there's no graphical environment we need to prepend the $command with `xvfb-run\n // --auto-servernum`.\n if (! $this->settings['graphicalEnvironment']) {\n array_unshift($command, '--auto-servernum');\n array_unshift($command, 'xvfb-run');\n }\n\n return new Process($command);\n }", "private function registerCommand()\n {\n $this->app->singleton('command.shenma.push', function () {\n return new \\Larva\\Shenma\\Push\\Commands\\Push();\n });\n\n $this->app->singleton('command.shenma.push.retry', function () {\n return new \\Larva\\Shenma\\Push\\Commands\\PushRetry();\n });\n }", "public function __construct(string $command, string $before = '', string $after = '')\n {\n $this->command = $command;\n $this->before = $before;\n $this->after = $after;\n }", "public function generateCommand($singleCommandDefinition);", "public function create() {\n }", "public function create() {\n }", "public function create() {\r\n }", "public function create() {\n\n\t}", "private function getImportCommand()\n {\n return new IndexImportCommand(self::getContainer());\n }", "public function __construct($command)\n {\n $this->command = $command;\n\n $this->command->line('Installing Images: <info>✔</info>');\n }", "public function __construct()\n {\n self::$instance =& $this;\n\n $commanddir = Config::main('directory');\n $excludes = Config::main('exclude');\n\n if(is_null($commanddir))\n die('Could not find commands directory. It should be specified in the main config.');\n\n //The directory where commands reside should be relative\n //to the directory with the clip executable.\n $dir = realpath(__DIR__.\"/{$commanddir}\");\n\n $cmdfiles = scandir($dir);\n //Loop through each file in the commands directory\n foreach($cmdfiles as $file)\n {\n //Assume that each file uses the standard '.php' file extension.\n $command = substr($file, 0, -4);\n\n //Ignore the unnecessary directories as commands and anything that\n //has been marked for exclusion then attempt to include the valid ones.\n if($file !== '.' && $file !== '..' && array_search($command, $excludes) === false && include(\"{$dir}/{$file}\"))\n {\n if(class_exists($command, false))\n {\n $obj = new $command;\n //Only load commands that use the clip command interface\n if($obj instanceof Command)\n $this->commands[strtolower($command)] = $obj;\n }\n }\n }\n }", "public function __construct($action, $command = null) {\n parent::__construct($action, self::NAME);\n\n $fieldFactory = FieldFactory::getInstance();\n\n $commandField = $fieldFactory->createField(FieldFactory::TYPE_STRING, self::FIELD_COMMAND, $command);\n\n $this->addField($commandField);\n }", "public function createCommand($db = null, $action = 'get')\n {\n if ($db === null) {\n $db = Yii::$app->get(Connection::getDriverName());\n }\n $this->addAction($action);\n $commandConfig = $db->getQueryBuilder()->build($this);\n\n return $db->createCommand($commandConfig);\n }", "public function create();", "public function create();", "public function create();", "public function create();", "public function create();", "public function create();", "public function create();", "public function create();" ]
[ "0.8010746", "0.7333379", "0.72606754", "0.7164165", "0.716004", "0.7137585", "0.6748632", "0.67234164", "0.67178184", "0.6697025", "0.6677973", "0.66454077", "0.65622073", "0.65437883", "0.64838654", "0.64696646", "0.64292693", "0.6382209", "0.6378306", "0.63773245", "0.6315901", "0.6248427", "0.6241929", "0.6194334", "0.6081284", "0.6075819", "0.6069913", "0.60685146", "0.6055616", "0.6027874", "0.60132784", "0.60118896", "0.6011778", "0.5969603", "0.59618074", "0.5954538", "0.59404427", "0.59388787", "0.5929363", "0.5910562", "0.590651", "0.589658", "0.589658", "0.589658", "0.58692765", "0.58665586", "0.5866528", "0.58663124", "0.5852474", "0.5852405", "0.58442044", "0.58391577", "0.58154446", "0.58055794", "0.5795853", "0.5780188", "0.57653266", "0.57640004", "0.57584697", "0.575748", "0.5742612", "0.5739361", "0.5732979", "0.572247", "0.5701043", "0.5686879", "0.5685233", "0.56819254", "0.5675983", "0.56670785", "0.56606543", "0.5659307", "0.56567776", "0.56534046", "0.56343585", "0.56290466", "0.5626615", "0.56255764", "0.5608852", "0.5608026", "0.56063116", "0.56026554", "0.5599553", "0.5599351", "0.55640906", "0.55640906", "0.5561977", "0.5559745", "0.5555084", "0.5551485", "0.5544597", "0.55397296", "0.5529626", "0.552908", "0.552908", "0.552908", "0.552908", "0.552908", "0.552908", "0.552908", "0.552908" ]
0.0
-1
Execute the console command.
public function handle() { //极验验证发布 Artisan::call('vendor:publish', [ '--tag' => 'geetest' ]); //语言包发布 Artisan::call('lang:publish', ['zh-CN,zh-HK,th,tk']); //发布资源包 Artisan::call('vendor:publish', [ '--tag' => 'resource' ]); //发布城市表 Artisan::call('vendor:publish', [ '--tag' => 'resource-example' ]); //发布百度编辑器 Artisan::call('vendor:publish', [ '--provider' => 'Overtrue\LaravelUEditor\UEditorServiceProvider' ]); Artisan::call('storage:link'); //发布LaravelAdmin Artisan::call('vendor:publish', [ '--tag' => 'laravel-admin', '--force' => true ]); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function handle()\n {\n\t\t$this->info('league fetching ..');\n $object = new XmlFeed();\n\t\t$object->fetchLeague($this->argument('sports_id'));\n\t\t$this->info('league saved');\n }", "public function handle()\n {\n //get us the Converter class instance and call the convert() method on it.\n $this->info(\n \\Aregsar\\Converter\\ConverterFacade::convert($this->argument(\"currency\"))\n );\n }", "public function handle()\n {\n $this->locale = $this->argument('locale');\n\n $this->loadGroupLines();\n\n $this->loadNameSpacedLines();\n\n $this->info('Complete');\n }", "public function handle()\n {\n $this->importUser($this->argument('username'));\n $this->call('ldap:show-user', $this->arguments());\n }", "public function handle() {\n $user = User::where('id', $this->argument('userId'))->first();\n $this->info($user->email);\n }", "public function handle()\n {\n $translations = collect(json_decode(file_get_contents('https://raw.githubusercontent.com/getbible/Bibles/master/translations.json')))->flatten();\n switch($this->argument('action')) {\n case 'fetch':\n $this->fetchBibles($translations);\n break;\n case 'convert':\n $this->convertBibles($translations);\n break;\n }\n }", "public function handle()\n {\n try {\n $evalstr = $this->evaluater->evaluate($this->argument('evalString'));\n $this->info($evalstr);\n } catch (ForbiddenSymbolsException $exception) {\n $this->error($exception->getMessage());\n } catch (IncorrectSymbolsException $exception) {\n $this->error($exception->getMessage());\n }\n }", "public function handle()\n {\n\n $settings = Setting::fetch();\n $id = $this->argument('id');\n $this->scrape_game_data($id);\n }", "public function handle()\n {\n // env('CALENDARINDEX_TOKEN', '6f2bd927201ba4b22bb57df08db0c517e51732de')\n $this->getData($this->argument('country'), $this->argument('region'));\n }", "public function handle()\n {\n $email = $this->argument('email');\n $name = $this->argument('name');\n\n $this->info(\"starting to generate users details\");\n\n }", "public function handle()\n {\n\t\t$this->info('Importing translations...');\n\n\t\t$this->manager->importTranslations(true);\n }", "public function handle()\n {\n $user = null;\n\n if ($email = $this->option(\"email\", false)) {\n $user = $this->findByEmail($email);\n }\n\n if ($id = $this->option(\"id\", false)) {\n $user = $this->findById($id);\n }\n\n if (empty($user)) {\n $this->warn(\"User no found\");\n }\n else {\n $this->setRoleToUser($user);\n }\n }", "public function handle()\n {\n $name = ucwords($this->argument('name'));\n $this->call('repository:contract', [ 'name' => $name ]);\n $this->call('repository:class', [ 'name' => $name, '--driver' => $this->option('driver') ]);\n }", "public function handle()\n\t{\n\t\t// Superuser\n\t\tif( ! $this->option('no-superuser'))\n\t\t\t$this->call('setup:superuser');\n\n\t\t// Countries\n\t\tif( ! $this->option('no-countries'))\n\t\t\t$this->call('setup:countries', ['country' => array_filter(explode(',', $this->option('countries')))]);\n\n\t\t// Languages\n\t\tif( ! $this->option('no-languages'))\n\t\t\t$this->call('setup:languages', ['language' => array_filter(explode(',', $this->option('languages')))]);\n\n\t\t// Currencies\n\t\tif( ! $this->option('no-currencies'))\n\t\t\t$this->call('setup:currencies', ['currency' => array_filter(explode(',', $this->option('currencies')))]);\n\n\t\t// Clear cache\n\t\t$this->call('cache:clear');\n\t}", "public function handle()\n\t{\n\t\t$name = $this->argument('name');\n\t\t\n\t\t$this->info(\"Searching eve api for {$name}\");\n\t\t$result = Corporation::searchEVEAPI($name);\n\n\t\t$this->info(\"results\");\n\t\tforeach($result as $corp)\n\t\t{\n\t\t\tprint $corp->name . \" \" . $corp->id . \"\\r\\n\";\n\t\t}\n\t}", "public function handle()\n {\n $user = $this->argument('user');\n $this->info('Display this on the screen, user ' . $user);\n return 0;\n }", "public function handle()\n {\n $this->userVectors->test($this->option('force'));\n }", "public function handle()\n {\n $mapping = $this->formatMappingName((string)$this->argument('mapping'));\n \n $model = $this->option('model') ? $this->formatModelName($this->option('model')) : null;\n \n $this->filesystem->put(\n $this->buildMappingFilePath($mapping),\n $this->buildMapping(\n $this->getDefaultStub(),\n $mapping,\n $model\n )\n );\n \n $this->composer->dumpAutoloads();\n }", "public function handle()\n {\n switch ($this->argument('type')) {\n case 'dns':\n $this->dnscheck->run($this->option('dry-run') ? true : false, $this->argument('domain'));\n break;\n case 'whois':\n $this->whoischeck->run($this->option('dry-run') ? true : false, $this->argument('domain'));\n break;\n }\n }", "public function handle()\n {\n $option = $this->argument('option');\n\n if (! in_array($option, ['expired', 'all'])) {\n return $this->error('Invalid option supplied to command...');\n }\n\n $this->comment('Beginning pruning process...');\n\n $this->comment($this->pruneDatabase($option) . ' deleted from database...');\n\n $this->comment($this->pruneFiles($option) . ' deleted from files...');\n\n $this->info('Nonces pruned successfully!');\n }", "public function handle()\n {\n $subscriptionUpdateService = new SubscriptionUpdateService();\n $subscriptionUpdateService->runUpdates();\n }", "public function handle()\n\t{\n\t\t\n\t\t$source_directory = $this->argument( 'source_directory' );\n\t\t$target_directory = $this->argument( 'target_directory' );\n\t\t$template = (string) $this->option( 'template' );\n\n\t\t$statik = new \\App\\Statik\\Statik;\n\n\t\t$statik->generateHTMLFiles( $this, $source_directory, $target_directory, $template ) && $this->info( \"\\e[1;32mDONE!\" );\n\n\t}", "public function handle()\n {\n if (!$this->argument('file')) {\n $this->info('Please specify file to call.');\n }\n\n $file = $this->argument('file');\n\n if (!$this->fileHandler->exists($file)) {\n $this->info('Wrong path or file not exist.');\n }\n\n $this->executeFile($file);\n }", "public function handle()\n {\n $user = $this->argument('user');\n $this->scanner->setUserName($user);\n $this->scanner->scanUser();\n }", "public function handle()\n {\n if ($this->argument('user')) {\n $userId = $this->argument('user');\n\n $this->info(\"Liquidate affiliate commission for user \" . $userId);\n\n $user = $this->userService->findById($userId);\n\n if ($user) {\n $this->walletService->liquidateUserBalance($user);\n } else {\n $this->error(\"User not found\");\n }\n\n $this->info(\"Done\");\n } else {\n $this->info(\"Liquidate all commissions\");\n\n $this->walletService->liquidateAllUsersBalance();\n\n $this->info(\"Done\");\n }\n }", "public function handle()\n {\n $action = $this->choice('what action do you have on mind', [\n 'add-relation', 'remove-columns', 'column-type', 'rename-column'\n ]);\n switch ($action) {\n case 'add-relation':\n $this->addRelation();\n break;\n\n case 'remove-columns':\n $this->removeColumns();\n break;\n case 'column-type':\n $this->columnType();\n break;\n case 'rename-column':\n $this->renameColumn();\n break;\n default:\n $this->error('Unsupported action requested...');\n }\n $this->info('Command executed successfully');\n }", "public function handle()\n {\n $arguments = $this->arguments();\n $storageDir = $arguments['storageDir'];\n $localStorageDir = $arguments['localStorageDir'];\n $url = $arguments['url'];\n $cmd = sprintf(\"./app/Console/Commands/ShellScripts/screen_shot.sh %s %s %s\", $storageDir, $localStorageDir, $url);\n\n while (true) {\n $result = shell_exec($cmd);\n print_r($result);\n sleep(3);\n }\n }", "public function handle()\n {\n $city = $this->argument('city');\n\n $weatherService = new CurrentWeatherService();\n try {\n $weather = $weatherService->getByCity($city);\n } catch (WeatherException $e) {\n $this->error($e->getMessage());\n return;\n }\n\n $this->info('Weather for city '.$city);\n dump($weather->toArray());\n }", "public function handle()\n {\n $this->getModels($this->argument('model'));\n $this->getLanguages($this->argument('locale'));\n $this->createMultiLanguageRecords();\n }", "public function handle()\n {\n $this->processOptions();\n\n echo json_encode( $this->dateTimeRange ) . \"\\n\";\n\n $this->dispatch( new ProcessNewActionsJob(\n $this->dateTimeRange ,\n str_random( 16 ),\n $this->option('runtime-threshold')\n ) );\n }", "public function handle()\n {\n $fightId = $this->argument('fight_id');\n $metricId = $this->argument('metric_id');\n //$strategyName = 'App\\\\'.$this->argument('metric_name');\n\n $metric = BossMetric::find($metricId);\n if ($metric === null) {\n $this->error(\"Error: no metric with id: $metricId found!\");\n return;\n }\n\n $fight = Fight::find($fightId);\n\n if ($fight === null) {\n $this->error(\"Error: no fight with id: $fightId found!\");\n return;\n }\n\n $strategy = $metric->getStrategy();\n $strategy->setFight($fight);\n $strategy->run();\n }", "public function handle()\n {\n\t\t$this->call('vendor:publish');\n\t\t$this->call('migrate');\n\t\t$this->call('db:seed');\n\t\t$this->call('factotum:storage');\n\t\t$this->call('factotum:storage');\n }", "public function handle()\n {\n $user_id = $this->argument('user') ?? null;\n\n if (is_null($user_id)) {\n $users = User::all();\n\n foreach ($users as $user) {\n $this->showUserBalance($user);\n }\n } else {\n $user = User::find($user_id);\n\n $this->showUserBalance($user);\n }\n }", "public function handle()\n {\n $this->capsuleService->getAll();\n $this->line('Command Worked');\n }", "public function handle()\n {\n $platform_wechat_id = $this->argument('id');\n $customer_id = $this->argument('customer_id');\n $this->info(\"Starting at \".date('Y-m-d H:i:s').\". Running initial for 【{$this->signature}】\");\n $this->getUserInfoList($platform_wechat_id,$customer_id);\n $this->info(\"End at \".date('Y-m-d H:i:s').\". over for 【{$this->signature}】\");\n }", "public function handle()\n {\n $this->publishAssets();\n $this->call('twill:flush-manifest');\n $this->call('view:clear');\n }", "public function handle()\n {\n \n $argument = $this->argument('data');\n \n $this->prepare( $argument );\n \n $this->make();\n \n $this->info( 'migration has been created : '. $this->fileName );\n \n }", "public function handle()\n {\n chdir(resource_path('assets/ts'));\n $path = $this->argument(\"path\");\n if(isset($path))\n {\n Logger::info('execute '.$path);\n Command::executeRaw('tsc', [\"-p\", $path]);\n }else\n Logger::info('execute tsc');\n Command::executeRaw('tsc');\n }", "public function handle()\n {\n $this->info('Starting date change command.');\n\n Word::where('language_id', 1)->update(array('created_at' => '1970-01-01 00:00:01'));\n Word::where('language_id', 2)->update(array('created_at' => '1970-01-01 00:00:01'));\n\n $this->info('Dates have been changed to 1970-01-01 00:00:01');\n }", "public function handle()\n {\n $this->info($this->slugger->encode($this->argument('id')));\n }", "public function handle()\n {\n $this->line(static::$logo);\n $this->line('Neat admin current version:' . Neat::version());\n\n $this->comment('');\n $this->comment('Available commands:');\n\n $this->listAvailableCommands();\n }", "public function handle()\n {\n $this->revisions->updateListFiles();\n }", "public function handle(): void\n {\n // Set argument\n $this->url = $this->argument(self::URL_ARGUMENT);\n\n // Handler takes care of computation\n (new CommandHandler($this))->compute();\n }", "public function handle()\n {\n try\n {\n $filename = $this->argument('filename');\n Excel::import(new ObjectsImport, $filename);\n\n $this->info('Data import is now completed');\n }\n catch(Exception $ex)\n {\n $this->error($ex->getMessage());\n }\n }", "public function handle() {\n $entity = $this->validateEntity($this->argument('entity'));\n $job = new DataProcessingJob($entity, str_random(16));\n $this->dispatch($job);\n }", "public function handle()\n {\n $isProductionMode = 'prod' == $this->argument('mode');\n\n if ($isProductionMode) {\n if (!$this->confirm('Are you sure to run in production mode? Running this command may cause critical issues?')) {\n exit(1);\n }\n }\n\n $this->_recalculate($isProductionMode);\n }", "public function handle()\n {\n if(!$this->verify()) {\n $rank = $this->createRankSuperAdmin();\n $user = $this->createUserSuperAdmin();\n $user->Ranks()->attach($rank);\n $this->line('Felicitaciones');\n } else {\n $this->error('No se puede ejecutar');\n }\n }", "public function handle()\n {\n // Get CLI Input\n $user_id = $this->option(\"uid\");\n\n // User Products\n ( new CommandManager() )->showUserProducts( $user_id );\n }", "public function handle()\n {\n $force = $this->option('force');\n\n if($this->option('without-bulk')){\n $this->withoutBulk = true;\n }\n\n if ($this->generateClass($force)){\n $this->info('Generating permissions for '.$this->modelBaseName.' finished');\n }\n }", "public function handle()\n {\n $tournaments = Tournament::all()->toArray();\n foreach ($tournaments as $tournament) {\n $slug = $this->tournamentRepoObj->generateSlug($tournament['name'].Carbon::createFromFormat('d/m/Y', $tournament['start_date'])->year,'');\n DB::table('tournaments')\n ->where('id', $tournament['id'])\n ->update([\n 'slug' => $slug\n ]);\n }\n $this->info('Script executed.');\n }", "public function handle()\n {\n $userId = $this->argument('user');\n\n /** @var User $user */\n $user = User::findOrFail($userId);\n\n // Get token.\n $info = (new Client())->auth();\n\n // Save to db.\n $user->access_token = $info['access_token'];\n $user->access_secret = $info['access_secret'];\n $user->save();\n\n $this->line(\"Saved access token and secret for user: {$user->email}\");\n }", "public function handle()\n {\n $m = new MemberFromText;\n $m->train();\n $id = $m->predict($this->argument('text'));\n dump(Miembro::find($id)->toArray());\n }", "public function handle()\n {\n $this->generator\n ->setConsole($this)\n ->run();\n }", "public function handle()\n {\n $this->createController();\n $this->createServiceDir();\n\n exit;\n $args = [\n '--provider' => TestProvider::class\n ];\n $className = $this->argument('className');\n if (!$className) {\n $className = 'MethodsList';\n }\n $className = ucwords($className);\n $this->call('vendor:publish', $args);\n $this->info('Display this on the screen ' . $className);\n }", "public function handle()\n {\n $this->createDirectories();\n\n $this->publishTests();\n\n $this->info('Authentication tests generated successfully.');\n }", "public function handle()\n {\n $this->setDbConnection(\n $this->input->getOption('database') ?: config('ghost-database.default_connection')\n );\n\n $native = $this->input->getOption('native-import') ?: config('ghost-database.use_native_importer');\n\n $snapshot = $this->import($native);\n\n $this->info(\"Snapshot `{$snapshot->name}` loaded!\");\n }", "public function handle()\n {\n $exec = $this->argument('exec');\n\n switch ($exec) {\n case 'download' :\n $this->download();\n break;\n\n case 'generate' :\n $this->generate();\n break;\n\n default :\n echo \"Choose 'download' or 'generate' for this command\";\n break;\n }\n }", "public function handle()\n {\n $this->call('ziggy:generate', ['path' => './resources/js/ziggy-admin.js', '--group' => 'admin']);\n $this->call('ziggy:generate', ['path' => './resources/js/ziggy-frontend.js', '--group' => 'frontend']);\n $this->call(TranslationsGenerateCommand::class);\n }", "public function handle()\n {\n $tenantName = $this->argument('tenant');\n\n $tenant = Tenant::where('name', $tenantName)->orWhere('subdomain', $tenantName)->first();\n\n if ($tenant) {\n $tenant->setActive();\n \\Artisan::call('tinker');\n } else {\n $this->error('Error: Tenant not found');\n }\n }", "public function handle()\n {\n try {\n if (!empty($userId = $this->argument('user'))) {\n $user = User::find($userId);\n } else {\n $user = User::inRandomOrder()->first();\n }\n\n if (empty($user)) {\n throw new \\Exception('User not found');\n }\n\n echo JWTAuth::fromUser($user);\n } catch (\\Exception $e) {\n echo $e->getMessage();\n }\n\n }", "public function handle()\n {\n $this->fetchAndSetToken();\n $imagesToDownload = $this->peekImages(WatchedApp::pluck('package_name'));\n $this->fetchImages($imagesToDownload);\n\n if ($this->option('dont-optimize')) {\n return;\n }\n\n $this->runOptimizeCommand();\n }", "public function handle()\n {\n $this->setCryptIVFromUrl($this->argument('url'));\n\n $participant = URLParser::parseByName('santa.index', $this->argument('url'))->participant;\n if($participant) {\n $draw = $participant->draw;\n } else {\n $draw = URLParser::parseByName('organizer.index', $this->argument('url'))->draw;\n }\n\n $this->table(\n ['ID', 'Name', 'Email'],\n $draw->participants()->get(['id', 'name', 'email'])->toArray()\n );\n }", "public function handle()\n {\n // if you are on the local environment\n if (!(app()->isLocal() || app()->runningUnitTests())) {\n $this->error('This command is only available on the local environment.');\n return;\n }\n\n $fqdn = $this->argument('fqdn');\n if ($tenant = Tenant::retrieveBy($fqdn)){\n $tenant->delete($fqdn);\n $this->info(\"Tenant {$fqdn} successfully deleted.\");\n }else {\n $this->error('This fqdn doesn\\'t exist.');\n }\n\n }", "public function handle()\n {\n $user_from = $this->option('from');\n $user_to = $this->option('to');\n $sum = $this->option('sum');\n\n CreateTransaction::dispatch($this->usersRepository->getByID($user_from), $this->usersRepository->getByID($user_to), $sum, true);\n $this->transactionsRepository->getAll()->each(function ($transaction){\n \tExecuteTransaction::dispatch($transaction);\n });\n }", "public function handle()\n {\n $this->warn('Starting Retrieve Data');\n\n PeopleService::retrieveData();\n\n $this->info('Retrieve Data Completed');\n }", "public function handle()\n {\n \n $period = $this->option('period');\n \n switch ($period) {\n\n case 'half_month':\n $this->info('Grabing Half Month Income...');\n $this->halfMonth();\n break;\n\n case 'monthly':\n $this->info('Grabing Monthly Income...');\n $this->monthly();\n break;\n \n default:\n $this->info('Grabing Daily Income...');\n $this->daily();\n break;\n\n }\n\n \n }", "public function handle()\n {\n $countryFiles = $this->getFiles();\n\n foreach ($countryFiles as $fileName) {\n $this->seed($fileName);\n }\n\n $this->info('End.');\n }", "public function fire()\n {\n $entityName = $this->argument('entityName');\n $startEntityId = $this->argument('startEntityId');\n $endEntityId = $this->argument('endEntityId');\n $depth = $this->argument('depth');\n\n $this->fixturePath = $this->option('outputPath');\n\n $this->info(\"Generating fixtures for $entityName in {$this->fixturePath}...\");\n \n $this->generateFixtures($entityName, $startEntityId, $endEntityId, $depth);\n }", "public function handle()\n {\n $check = PublishTraitsService::publishTraits();\n\n if ($check)\n {\n $this->info('All files have been published');\n }\n\n $this->info('Failed to publish');\n }", "public function handle()\n {\n $user = User::where('username', $this->argument('user'))\n ->orWhere('email', $this->argument('user'))\n ->first();\n\n if ($user != null) {\n $user->assign('admin');\n $this->line(\"{$user->email} was successfully made an admin.\");\n } else {\n $this->line(\"No user found where username or email is '{$this->argument('user')}'\");\n }\n }", "public function handle()\n {\n event( 'laraview:compile' );\n $this->checkForSelectedViewGeneration();\n\n app( RegisterBlueprint::class )\n ->console( $this )\n ->generate();\n }", "public function handle()\n {\n $project = Project::with(['team.admins', 'team.members'])->findOrFail($this->option('project-id'));\n $user = User::findOrFail($this->option('user-id'));\n if ($this->option('admin')) {\n $project->team->admins()->syncWithoutDetaching($user);\n } else {\n $project->team->members()->syncWithoutDetaching($user);\n }\n return Command::SUCCESS;\n }", "public function handle() {\n try {\n $this->roomService->loadRoomOccupations();\n Log::notice('untis:occupations executed successfully.');\n $this->line('Loaded room occupations from WebUntis.');\n } catch (Exception $e) {\n Log::error('Error loading room occupations.', ['exception' => $e]);\n $this->error('Error loading room occupations: ' . $e->getMessage());\n }\n }", "public function handle()\n {\n $this->loadIxList();\n $this->loadIxMembersList();\n $this->updateIxInfo();\n $this->updateIxMembersInfo();\n }", "public function handle()\n {\n $this->call('vendor:publish', [\n '--provider' => \"Qoraiche\\MailEclipse\\MailEclipseServiceProvider\",\n ]);\n }", "public function handle()\n\t{\n\t\tif ($this->option('dev')) {\n\t\t\tsystem('php '.base_path('.deploy/deploy-dev.php'));\n\t\t} else {\n\t\t\tsystem('php '.base_path('.deploy/deploy.php'));\n\t\t}\n\t}", "public function handle(Command $command);", "public function handle(Command $command);", "public function handle()\n {\n $date_from = $this->argument('date_from');\n\t\t$date_to = $this->argument('date_to');\n\t\tif(!$date_from) {\n\t\t\t$date_from = Carbon::today()->subDays(5);\n\t\t}\n\t\tif(!$date_to) {\n\t\t\t$date_to = Carbon::yesterday();\n\t\t}\n\t\tStats::computeMembers($this->argument('venue_id'), $date_from, $date_to);\n }", "public function handle()\n {\n switch ($this->argument('type')){\n case 'fih':\n $scrapper = new Scrappers\\FederationScrapper();\n $scrapper->get($this->option('level'));\n print $scrapper->message();\n break;\n }\n }", "public function handle()\n {\n Log::info(\"seed:dash Command is working fine!\");\n $this->info('Dashboard Database seeding completed successfully.');\n }", "public function handle()\n {\n $originalId = $this->argument('original_id');\n\n $status = true;\n if ($this->option('status') === 'false') {\n $status = false;\n }\n\n if ($video = Video::where('original_id', $originalId)->first()) {\n $video->dmca_claim = $status;\n $video->save();\n\n $this->info('Video\\'s dmca_claim set to: ' . json_encode($status));\n return ;\n }\n\n $this->error('No video found with original_id of: ' . $originalId);\n return;\n }", "public function handle()\n {\n $this->call('config:clear');\n\n $this->call('config:update');\n\n $this->info('Configuration cached successfully!');\n }", "public function handle()\n {\n //\n $modelName = $this->argument('model');\n $column = $this->argument('column');\n $this->generateMutation($modelName, $column);\n\n }", "public function handle()\n {\n $filePath = 'public/' . $this->argument('fileName');\n $count = $this->argument('count');\n \n $fileData = array_slice(file($filePath), 0, $count);\n $this->info(implode('', $fileData));\n }", "public function handle()\n {\n $email = $this->argument('email');\n\n Mail::to($email)->send(new SendMailable('Test Mail'));\n\n if (Mail::failures()) {\n $this->info('Email failed to send');\n } else {\n $this->info('Email successfully sent');\n }\n }", "public function handle()\n {\n $this->call('route:trans:clear');\n\n $this->cacheRoutesPerLocale();\n\n $this->info('Routes cached successfully for all locales!');\n }", "public function handle()\n {\n $this->info('Welcome to command for Bantenprov\\WilayahIndonesia package');\n }", "public function handle()\n {\n if($this->hasOption('no_dump') && $this->option('no_dump')){\n $this->composer_dump = false;\n }\n $this->readyDatas();\n $this->datas['startSymbol']='{{';\n $this->datas['endSymbol']='}}';\n $this->create();\n }", "public function handle()\n {\n $repository = new OglasiCrawlerRepository();\n $ads = $repository->getAds();\n $repository->saveAds($ads);\n\n echo 'Ads were successfully retrieved' . PHP_EOL;\n }", "public function handle()\n {\n $this->makeDir($this->basePath . $this->kebabPlural());\n\n $this->exportViews();\n\n $this->info('Resource views generated successfully.');\n }", "public function handle()\n {\n $movies = \\App\\Models\\Movie::whereNull('meta')->take(40)->orderBy('id')->get();\n $movies->each(function($movie){ sleep(1); $movie->getMeta(); });\n return Command::SUCCESS;\n }", "public function handle()\n {\n $this->packageGenerator->setConsole($this)\n ->setPackage($this->argument('package'))\n ->setType('shipping')\n ->setForce($this->option('force'))\n ->generate();\n }", "public function handle()\n {\n $test = $this->argument('test');\n\n $dir = config('speed-test.dir');\n\n $className = ucfirst(\\Str::camel($test));\n\n $namespace = config('speed-test.namespace');\n\n $class = class_entity($className)\n ->namespace($namespace);\n\n $class->method('speed1')\n ->line($this->option('line'))->doc(function ($doc) use ($className) {\n /** @var DocumentorEntity $doc */\n $doc->tagCustom('times', $this->option('times'));\n $doc->description($this->option('description') ?: \"{$className} Speed 1\");\n });\n\n if (! is_dir($dir)) {\n mkdir($dir, 0777, 1);\n }\n\n file_put_contents(\n $dir.'/'.$className.'.php',\n $class->wrap('php')\n );\n\n $this->info('Speed created!');\n\n return 0;\n }", "public function handle()\n {\n $message = $this->GenerateRandomUser($this->argument('count'));\n $this->info($message);\n }", "public function handle()\n {\n $host = Cache::get('executingHost', null);\n $this->info(\"Host: ${host}\");\n\n if ($host === null) {\n $this->info('実行するホストが選択されていません');\n return;\n }\n\n if (Schema::hasTable('companies') && Company::count() !== 0) {\n $this->info('マイグレーションが既に1回以上実行されています');\n return;\n }\n\n $should_execute = $host === $this->argument('executingHost');\n\n if ($should_execute) {\n Artisan::call('migrate:fresh', ['--seed' => true]);\n $this->info('マイグレーションが完了しました');\n\n Cache::forget('executingHost');\n } else {\n $this->info('別ホストにてマイグレーションが行われます');\n }\n }", "public function handle()\n {\n // Configuration...\n $this->callSilent('vendor:publish', ['--tag' => 'model-login-config']);\n\n // Migrations\n $this->callSilent('vendor:publish', ['--tag' => 'model-login-migrations']);\n\n $this->info('Model Login resources published.');\n }", "public function handle()\n {\n if ($this->validation()) {\n $money = $this->argument('money');\n Cache::increment('amount', $money);\n }\n }", "public function handle()\n {\n $this->info('Publishing stuff..');\n\n $this->publishFiles();\n\n $this->info('Setup complete. Enjoy!');\n }", "public function handle()\n {\n $this->publishConfig();\n $this->publishClassStub();\n $this->generateAndStoreKey();\n\n $this->info('Use the details below for your \"Lead delivery options\" in Google Ads.');\n $this->info('Webhook URL: ' . route('GoogleAdsLeadExtensionController@index'));\n $this->info('Key: ' . $this->generated_key);\n }", "public function handle()\n {\n $opts = $this->options();\n $args = $this->arguments();\n #print_r($opts);\n #print_r($args);\n\n # Redundant as argument validation handled by Laravel\n #\n if (!isset($args['destination'])) {\n printf(\"Usage: php artisan %s\\n\", $this->signature);\n exit(1);\n }\n\n # Default to normal message type\n #\n if (!isset($opts['type'])) {\n $opts['type'] = 'normal';\n }\n\n $uac = new UserApiController();\n\n if ($opts['type'] == 'normal') {\n if (!isset($opts['message'])) {\n printf(\"Usage: php artisan %s\\n\\n\", $this->signature);\n printf(\"ERROR: Message must be specified for type 'normal'\\n\");\n exit(1);\n }\n $result = $uac->sendSms(\n $args['destination'],\n $opts['message'],\n $opts['route']\n );\n }\n else if ($opts['type'] == 'otp') {\n $result = $uac->sendVerificationSms(\n $args['destination'],\n '<code>',\n '<name>',\n $opts['route'],\n '<appName>'\n );\n }\n\n if ($result === true) {\n printf(\"INFO: SMS message to %s sent successfully (%s)\\n\",\n $args['destination'], $opts['type']);\n }\n else {\n printf(\"INFO: SMS message to %s failed to send (%s)\\n\", \n $args['destination'], $opts['type']);\n printf(\"ERROR: %s\\n\", $result);\n }\n\n return;\n }" ]
[ "0.6469962", "0.6463639", "0.64271367", "0.635053", "0.63190264", "0.62747604", "0.6261977", "0.6261908", "0.6235821", "0.62248456", "0.62217945", "0.6214421", "0.6193356", "0.61916095", "0.6183878", "0.6177804", "0.61763877", "0.6172579", "0.61497146", "0.6148907", "0.61484164", "0.6146793", "0.6139144", "0.61347336", "0.6131662", "0.61164206", "0.61144686", "0.61109483", "0.61082935", "0.6105106", "0.6103338", "0.6102162", "0.61020017", "0.60962653", "0.6095482", "0.6091584", "0.60885274", "0.6083864", "0.6082142", "0.6077832", "0.60766655", "0.607472", "0.60739267", "0.607275", "0.60699606", "0.6069931", "0.6068753", "0.6067665", "0.6061175", "0.60599935", "0.6059836", "0.605693", "0.60499364", "0.60418284", "0.6039709", "0.6031963", "0.6031549", "0.6027515", "0.60255647", "0.60208166", "0.6018581", "0.60179937", "0.6014668", "0.60145515", "0.60141796", "0.6011772", "0.6008498", "0.6007883", "0.60072047", "0.6006732", "0.60039204", "0.6001778", "0.6000803", "0.59996396", "0.5999325", "0.5992452", "0.5987503", "0.5987503", "0.5987477", "0.5986996", "0.59853584", "0.5983282", "0.59804505", "0.5976757", "0.5976542", "0.5973796", "0.5969228", "0.5968169", "0.59655035", "0.59642595", "0.59635514", "0.59619296", "0.5960217", "0.5955025", "0.5954439", "0.59528315", "0.59513766", "0.5947869", "0.59456027", "0.5945575", "0.5945031" ]
0.0
-1
Build an async daemon
public static function buildAsync( $host, $port, $user, $pass, $queueName, QueueConsumer $consumer, $escapeMode = self::ESCAPE_MODE_SERIALIZE, $requeueOnFailure = true, LoggerInterface $logger = null, $stopOnFailure = false ) { return self::build( $host, $port, $user, $pass, $queueName, $consumer, false, $escapeMode, $requeueOnFailure, $stopOnFailure ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function start() {\n\t\t// Setup\n\t\t$options = array(\n\t\t\t'appName' => 'cakedaemon',\n\t\t\t'appDescription' => 'Runs extended tasks defined in the host app in the background',\n\t\t\t'sysMaxExecutionTime' => '0',\n\t\t\t'sysMaxInputTime' => '0',\n\t\t\t'sysMemoryLimit' => '1024M',\n\t\t\t'logLocation' => TMP . \"logs\" . DS . 'cakedaemon.log',\n\t\t\t'logVerbosity' => System_Daemon::LOG_INFO\n\t\t);\n\t\tSystem_Daemon::setOptions($options);\n\t\tSystem_Daemon::setSigHandler('SIGCHLD', array(&$this, 'handleSIGCHLD'));\n\n\t\t// This program can also be run in the forground with argument no-daemon\n\t\tif (!$this->params['no-daemon']) {\n\t\t\t// Spawn Daemon\n\t\t\tSystem_Daemon::start();\n\t\t}\n\n\t\t$this->__initConfig();\n\n\t\t// Here we have to do several things\n\t\t// 1) Figure out how many stale static nodes we have\n\t\t// 2) Ask the DB for one one job for each node\n\t\t// 3) Start these jobs on each of the corresponding nodes\n\t\t// 4) Wait for a pre-determined amount of time\n\t\t// 5) Check if any children have finished and start again\n\t\twhile (!System_Daemon::isDying()) {\n\t\t\t$taskIds = $this->DaemonRunner->findStaleJobTypes();\n\t\t\t$currentlyRunningJobs = $this->DaemonRunner->findProcessingJobs();\n\n\t\t\tSystem_Daemon::debug(\"Stale Process Types: \" . json_encode($taskIds));\n\t\t\tSystem_Daemon::debug(\"Aware of currently running job ids: \" . json_encode($currentlyRunningJobs));\n\t\t\tforeach ($taskIds as $id) {\n\t\t\t\tif ($job = $this->DaemonQueue->findJob($id, $currentlyRunningJobs)) {\n\t\t\t\t\t$currentlyRunningJobs[] = $job['DaemonQueue']['id'];\n\t\t\t\t\t$this->__spawnChild($job, $this->DaemonRunner->findStaleRunnerByJobType($id));\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Sometimes our sleep is inturrupted\n\t\t\t// This could be by a very noisy owl, or by a completed child process.\n\t\t\t// Either way, we should get our beauty sleep!\n\t\t\t$timeToSleep = $this->config['timeout'];\n\t\t\twhile ($timeToSleep > 0) {\n\t\t\t\t$timeToSleep = sleep($timeToSleep);\n\t\t\t}\n\t\t\tclearstatcache();\n\n\t\t\t$this->__reconnectDB();\n\n\t\t\t// For some reason the whole SIG handle thing doesnt work in\n\t\t\t// foreground mode\n\t\t\tif ($this->params['no-daemon']) {\n\t\t\t\t$this->__mopUp();\n\t\t\t}\n\t\t}\n\n\t\tSystem_Daemon::stop();\n\t}", "protected function _run() {\n // All OK.. Let's go\n declare(ticks = 1);\n\n if (count($this->_tasks->getManagers())==0) {\n Logger::log(\"No daemon tasks found\", \\Zend_Log::INFO);\n $this->_exit();\n }\n Logger::log(\"Found \" . count($this->_tasks->getManagers()) . \" daemon task managers\", \\Zend_Log::NOTICE);\n\n $this->getIpc()->setVar('processes', array());\n $managers = $this->_tasks->getManagers();\n foreach ($managers as $manager) {\n Logger::log(\"Starting manager: \" . $manager->getName(), \\Zend_Log::NOTICE);\n try {\n $this->_forkManager($manager);\n } catch (Exception $e) {\n echo $e->getMessage();\n Logger::log($e->getMessage(), \\Zend_Log::CRIT);\n $this->_exit();\n }\n }\n\n // Default sigHandler\n Logger::log(\"Setting default signal interrupt handler\", \\Zend_Log::DEBUG);\n $this->_sigHandler = new Interrupt\\Signal(\n 'Main Daemon',\n array(&$this, 'sigHandler')\n );\n\n // Write pids to shared memory\n $this->getIpc()->setVar('processes', $this->getPidManager()->getChilds());\n\n // Wait till all childs are done\n Logger::log(\"Waiting for childs to complete\", \\Zend_Log::NOTICE);\n while (pcntl_waitpid(0, $status) != -1) {\n $status = pcntl_wexitstatus($status);\n }\n Logger::log(\"Running done.\", \\Zend_Log::NOTICE);\n\n $this->getPidFile()->unlink();\n\n $this->_exit();\n }", "public function run()\n {\n $this->buildPhpContainers();\n $this->buildNginxContainer();\n $this->buildDockerCompose();\n }", "private function buildDrushTask()\n {\n return $this->taskDrushStack($this::DRUSH_BIN)\n ->drupalRootDirectory((__DIR__) . '/web');\n }", "private function buildDrushTask()\n {\n return $this->taskDrushStack($this::DRUSH_BIN)\n ->drupalRootDirectory((__DIR__) . '/docroot');\n }", "public function run()\n {\n Job::create(['url'=> 'https://proxify.io']);\n\n Job::create(['url'=> 'https://reddit.com']);\n\n Job::factory(1000)->create();\n }", "public function __construct()\n {\n $this->_baseDir = __DIR__;\n\n // Command line parser\n $this->_cmdParser = $parser = Console_CommandLine::fromXmlString($this->_cmdOptionsStructure);\n try {\n $cmdOptions = $parser->parse();\n if ($cmdOptions->command_name) {\n $this->_cmdOptions = $cmdOptions;\n $this->_cmdOptions->command_name = \"_{$this->_cmdOptions->command_name}\";\n } else {\n $parser->displayUsage();\n exit();\n }\n } catch (Exception $e) {\n $parser->displayError($e->getMessage());\n }\n\n // Load Config\n if (!$this->_cfg = $cfg = @json_decode(file_get_contents('config.json'), true)) {\n die($this->_fgColor('bold_red', \"\\nError: Could not read 'config.json'. Aborting.\\n\"));\n }\n\n // Logger\n $this->_log = new Logger('Tasks');\n $handler = new RotatingFileHandler(\"{$this->_baseDir}/log/report.log\", 10, Logger::INFO);\n $handler->setFormatter(new LineFormatter(\"[%datetime%] %level_name%: %message%\\n\"));\n $this->_log->pushHandler($handler);\n\n // Database\n $capsule = new Capsule;\n foreach ($cfg['databases'] as $k => $v) {\n $capsule->addConnection(\n [\n 'driver' => 'mysql',\n 'host' => $v['host'],\n 'database' => $v['database'],\n 'username' => $v['user'],\n 'password' => $v['password'],\n 'charset' => 'utf8',\n 'collation' => 'utf8_general_ci',\n 'prefix' => ''\n ],\n $k\n );\n }\n $capsule->setAsGlobal();\n\n // BitBucket Credentials\n $this->_bbApi = new Bitbucket\\API\\Api();\n $this->_bbApi->getClient()->addListener(\n new \\Bitbucket\\API\\Http\\Listener\\BasicAuthListener(\n $cfg['api']['bitbucket']['users']['admin']['user'],\n $cfg['api']['bitbucket']['users']['admin']['password']\n )\n );\n\n // Phonegap Build\n $this->_pgbApi = new PhonegapBuildApi($cfg['api']['pgb']['token']);\n\n // Stats\n $this->_report = array(\n 'Date & Time' => date('Y-m-d H:i:s'),\n 'Script Time' => 0,\n 'Method' => ''\n );\n }", "public function handle()\n {\n $this->info('workerman client');\n\n $this->action = $this->argument('action');\n\n global $argv;\n// $argv[0] = $argv[1];\n// $argv[1] = $this->action;\n// $argv[2] = $this->option('daemon') ? '-d' : '';\n// $argv[3] = '';\n $argv = [$argv[1], $this->action, '', ''];\n// pr($argv);die;\n\n\n // 实例化 Websocket 服务\n $worker = new Worker();\n\n // 启动 N 个进程\n $worker->count = 1;\n $worker->name = 'Workerman Client';\n\n // 指定缓冲区大小\n TcpConnection::$defaultMaxSendBufferSize = 4096;\n\n $worker->onWorkerStart = function () use ($worker) {\n $this->info($worker->name . ',Start Successfully...');\n\n // 内部连接\n $conn = new AsyncTcpConnection($this->socket);\n $conn->connect();\n\n $conn->onConnect = function () use ($conn) {\n// // 连接属性测试\n// $conn->send($conn->getRemoteAddress());\n $conn->send(time());\n\n // 定时器,发送心跳,防止连接长时间没有交互被断开\n Timer::add(10, function () use ($conn) {\n $conn->send('heart beat');\n });\n };\n\n $conn->onMessage = function ($connection, $data) {\n // 输出返回的数据\n $this->comment('服务消息:');\n $this->line($data . PHP_EOL);\n };\n\n $conn->onError = function ($connection, $code, $msg) {\n $this->error('连接编号[' . $connection->id . \"],内部服务错误:{$msg}\");\n };\n\n $conn->onClose = function ($connection) {\n $this->comment('连接编号[' . $connection->id . '],内部服务关闭');\n // 如果连接断开,则在1秒后重连\n //$conn->reConnect(1);\n };\n };\n\n Worker::runAll();\n }", "public function handle()\n {\n global $argv;\n $action = $this->argument('action');\n if(!in_array($action, ['start', 'stop'])){\n $this->error('Error Argument');exit;\n }\n $argv[0] = 'workerman:wsserver';\n $argv[1] = $action;\n $argv[2] = $this->option('daemonize') ? '-d' : '';\n\n\n //\n $REAL_MYSQL_ADDRESS = 'tcp://127.0.0.1:3306';\n\n $proxy = new Worker('tcp://0.0.0.0:4406');\n\n $proxy->onConnect = function($connection) use ($REAL_MYSQL_ADDRESS){\n //异步建立一个到Mysql服务器的连接\n $connection_to_mysql = new AsyncTcpConnection($REAL_MYSQL_ADDRESS);\n //msyql连接发来数据时,转发给对应的客户端连接\n $connection_to_mysql->onMessage = function ($connection_to_mysql, $buffer) use ($connection) {\n echo \"connection_to_mysql->onMessage \\n\";\n $connection->send($buffer);\n };\n\n //msyql关闭时,关闭对应的代理到客户端的连接\n $connection_to_mysql->onClose = function ($connection_to_mysql) use ($connection)\n {\n echo \"connection->close(1);\\n\";\n $connection->close();\n };\n //\n $connection_to_mysql->onError = function ($connection_to_mysql) use ($connection)\n {\n echo \"connection->close(2); \\n \";\n $connection->close();\n };\n\n //执行异步连接\n $connection_to_mysql->connect();\n\n //客户端发来数据时,转发给对应的数据库连接\n $connection->onMessage = function($connection, $buffer) use ($connection_to_mysql)\n {\n echo \"connection_to_mysql->send \\n\";\n $connection_to_mysql->send($buffer);\n };\n\n //客户端断开连接时,断开对应的Mysql连接\n $connection->onClose = function($connection) use ($connection_to_mysql)\n {\n echo \"connection_to_mysql->close\\n\";\n $connection_to_mysql->close();\n };\n };\n Worker::runAll();\n }", "public function run()\n {\n $serv = new \\swoole_server($this->host, $this->port);\n $serv->set(\n array(\n 'process_name' => 'ershoufang_crawler', //swoole 进程名称\n 'worker_num' => 2,//开启的worker进程数\n 'task_worker_num' => 2,//开启的task进程数\n 'open_cpu_affinity' => true,\n 'daemonize' => false,\n 'max_request' => 10000,\n 'dispatch_mode' => 2,\n 'debug_mode' => 0,\n 'log_file' => 'swoole.log',\n 'open_tcp_nodelay' => true,\n \"task_ipc_mode\" => 2,\n 'task_max_request' => 10000\n )\n );\n\n $serv->on('Start', array($this, 'onStart'));\n $serv->on('Connect', array($this, 'onConnect'));\n $serv->on('Receive', array($this, 'onReceive'));\n $serv->on('WorkerStart', array($this, 'onWorkerStart'));\n $serv->on('Task', array($this, 'onTask'));\n $serv->on('Finish', array($this, 'onFinish'));\n $serv->on('Close', array($this, 'onClose'));\n $serv->start();\n }", "public function setup() {\n $this->socket = socket_create(AF_INET, SOCK_STREAM, 0);\n if (!socket_bind($this->socket, $this->ip, $this->port)) {\n $errno = socket_last_error();\n $this->error(sprintf('Could not bind to address %s:%s [%s] %s', $this->ip, $this->port, $errno, socket_strerror($errno)));\n throw new Exception('Could not start server.');\n }\n\n socket_listen($this->socket);\n $this->daemon->on(Daemon::ON_POSTEXECUTE, array($this, 'run'));\n }", "public function run()\n {\n factory(Ospiti::class, 10) -> create();// create server per INSERIRE I DATI NEL DATABASE\n }", "private function serveStart()\n {\n if (static::$run) {\n return;\n }\n\n static::$run = true;\n\n print \"Running dev/build...\\n\";\n @exec(\"framework/sake dev/build flush=1 > /dev/null 2> /dev/null\");\n\n print \"Finding open port...\\n\";\n\n while (!$this->addressAvailable($this->getHost(), $this->getPort())) {\n $this->setPort($this->getPort() + 1);\n }\n\n if (!$this->running) {\n $host = $this->getHost();\n $port = $this->getPort();\n\n $hash = spl_object_hash($this);\n\n print \"Starting development server...\\n\";\n $command = \"framework/sake dev/tasks/SilverStripe-Serve-Task hash={$hash} host={$host} port={$port} > /dev/null 2> /dev/null &\";\n\n exec($command, $output);\n\n $command = \"ps -o pid,command | grep {$hash}\";\n @exec($command, $output);\n\n if (count($output) > 0) {\n foreach ($output as $line) {\n $parts = explode(\" \", $line);\n $this->pid[] = $parts[0];\n }\n }\n\n sleep(1);\n }\n }", "public function run()\n {\n //['name','code','status',[hd/sd]]\n\n\n {\n $this->createChannel();\n }\n }", "function main() {\n\t\tif (!$this->_registerPid()) {\n\t\t\t$this->out('Unable to register Pid');\n\t\t\t$this->_stop();\n\t\t}\n\t\tif (file_exists($this->params['working'] . DS . '.autotest')) {\n\t\t\tinclude($this->params['working'] . DS . '.autotest');\n\t\t}\n\t\tif (!empty($this->params['notify'])) {\n\t\t\t$this->settings['notify'] = $this->params['notify'];\n\t\t}\n\t\tif (!empty($this->params['mode'])) {\n\t\t\t$this->settings['mode'] = $this->params['mode'];\n\t\t}\n\t\t$suffix = '';\n\t\tif (!empty($this->settings['mode'])) {\n\t\t\t$suffix = ' (' . $this->settings['mode'] . ' mode)';\n\t\t}\n\n\t\tNotify::$method = $this->settings['notify'];\n\t\t$this->addHooks();\n\t\tNotify::message('Autopilot Starting', 'in ' . APP_DIR . $suffix, 0, false);\n\t\t$this->buildPaths();\n\t\t$this->run();\n\t}", "public function run()\n {\n factory(Hosting::class, 3)->create();\n }", "public static function runAll()\n {\n static::checkSapiEnv();\n static::init();\n static::daemonize();\n static::initWorkers();\n static::installSignal();\n static::saveMasterPid();\n static::displayUI();\n static::forkWorkers();\n static::resetStd();\n static::monitorWorkers();\n }", "public function build() {}", "public function build() {}", "public function build() {}", "public function start() {}", "function async_work() {\n\t\t$posix_pid = posix_getpid();\n\t\t$this->predis->sadd('workers', $posix_pid);\n\t\t//set_error_handler('error_as_exception');\n\t\twhile(true) {\n\t\t\tlist($liste, $sdata) = $this->predis->brpop(\"posix_pid:$posix_pid\", 'queue', 300);\n\t\t\tif($sdata != NULL) {\n\t\t\t\t$data = unserialize($sdata);\n\t\t\t\tif(sizeof($data) > 2) {\n\t\t\t\t\t$_PID = $data[2];\n\t\t\t\t\t$_CONTEXT = new Context($_PID);\n\t\t\t\t}\n\t\t\t\ttry {\n\t\t\t\t\t//var_dump($sdata);\n\t\t\t\t\t$result = call_user_func_array($data[0], $data[1]);\n\t\t\t\t\t$msg = array('r', $result);\n\t\t\t\t} catch( Exception $e) {\n\t\t\t\t\t$msg = array('e', $e);\n\t\t\t\t}\n\t\t\t\tif(sizeof($data) > 2) {\n\t\t\t\t\t$this->predis->lpush(\"pid:$data[2]\", serialize($msg));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\trestore_error_handler();\n\t}", "public function start() {}", "public function start() {}", "public function start() {}", "public function start() {}", "public function start() {}", "public function start() {}", "public function start() {}", "public function start() {}", "public function start() {}", "function become_daemon()\n{\n GLOBAL $fh;\n\n\t//printLog($fh, \"pcntl_fork() in\");\n $pid = pcntl_fork();\n\t//printLog($fh, \"pcntl_fork() out\");\n\n if ($pid == -1)\n {\n /* fork failed */\n\t\t//printLog($fh, \"fork failure!\");\n exit();\n } elseif ($pid)\n {\n\t\t//printLog($fh, \"pid: \" . $pid);\n /* close the parent */\n exit();\n } else\n {\n /* child becomes our daemon */\n posix_setsid();\n chdir('/');\n umask(0);\n return posix_getpid();\n }\n\n\t//printLog($fh, \"become_daemon() fim\");\n}", "private function main()\n {\n $this->initDataSource();\n while ($this->running) {\n try {\n $this->eventDispatcher->dispatch(new QueueStatus($this));\n } catch (\\Throwable $e) {\n $this->stdOutLogger->error('Watch coroutine exception, msg:' . $e->getMessage());\n $this->fileLogger->alert('Watch coroutine exception', [\n 'file' => $e->getFile(),\n 'line' => $e->getLine(),\n 'msg' => $e->getMessage(),\n 'trace' => $e->getTraceAsString(),\n ]);\n }\n\n Coroutine::sleep(self::WATCH_COMMAND_TIME);\n }\n $this->stdOutLogger->info('消费进程(' . $this->process->pid . ')退出');\n $this->fileLogger->info('消费进程(' . $this->process->pid . ')退出');\n }", "public function __construct()\n {\n parent::__construct();\n $this->worker = new \\GearmanWorker();\n $this->worker->addServer();\n $this->worker->addFunction(env('QUEUE_SEMANTIC'), sprintf('\\\\%s::%s', __CLASS__, 'start'));\n }", "protected function build()\n {\n // Grab some files from the config settings\n $exchange = $this->exchange;\n $queue = $this->queue;\n $routingKey = $this->routingKey;\n\n\n // Determine the DLX queue info\n $dlxQueue = is_null($this->dlxQueue) ? $queue . '.dlx' : $this->dlxQueue;\n $dlxRoutingKey = is_null($this->dlxRoutingKey) ? 'dlx' : $this->dlxRoutingKey;\n\n // Build the Exchange\n $this->createExchange($exchange);\n\n // Build the Queues\n $this->createQueue($dlxQueue);\n $this->createQueue($queue, [\n 'x-dead-letter-exchange' => $exchange,\n 'x-dead-letter-routing-key' => $dlxRoutingKey,\n ]);\n\n // Bind the Queues to the Exchange\n $this->bind($dlxQueue, $exchange, $dlxRoutingKey);\n $this->bind($queue, $exchange, $routingKey);\n }", "public function run() {\n\n if(!$this->server) {\n\n try {\n\n // initialize socket server\n $this->server = new AppServer($this->config->socket->host, $this->config->socket->port);\n\n // create application with dependencies\n $app = new Sonar(\n new StorageService($this->config->storage),\n new QueueService($this->config->beanstalk),\n new GeoService(),\n new CacheService()\n );\n $this->server->route('/sonar', $app, ['*']);\n }\n catch(QueueServiceException $e) {\n throw new AppServiceException($e->getMessage());\n }\n catch(ConnectionException $e) {\n throw new SocketServiceException($e->getMessage());\n }\n catch(StorageServiceException $e) {\n throw new AppServiceException($e->getMessage());\n }\n catch(CacheServiceException $e) {\n throw new AppServiceException($e->getMessage());\n }\n\n }\n\n if(isset($this->config->storage) === false) {\n throw new AppServiceException('There is no option `storage` in your configurations');\n }\n\n $this->server->run();\n }", "public function handle(): void\n {\n \t$this->task('Setting up', function () {\n return $this->call('create:config');\n\t });\n\t \n\t $this->task('Create directories', function () {\n $this->call('create:directories');\n\t });\n\t \n\t $this->task('Create package.json', function () {\n\t \t$this->call('create:package');\n\t });\n\t \n\t $this->task('Creating WP Required files', function() {\n\t $this->call('create:css:style');\n\t $this->call('create:php:functions');\n\t $this->call('create:php:index');\n\t });\n\n\t $this->task('Creating Composer files', function () {\n\t $this->call('create:composer:json');\n\t shell_exec('composer install');\n });\n\t \n\t $this->task('Setup frontend files', function () {\n\t\t return $this->createBasicLayout();\n\t });\n\n\t\t$this->task('Setup app files', function () {\n\t\t return $this->createBasicClasses();\n\t\t});\n }", "public function __construct()\n {\n $this->loop = Factory::create();//app('eventLoop');\n }", "public function run() {}", "protected function _daemonize ()\n {\n $pid = pcntl_fork();\n \n if ($pid === - 1) {\n throw new \\RuntimeException(\"Failed pcntl_fork\");\n }\n if ($pid) {\n $this->_registerSigHandlers();\n \n $this->_logger->info(\"Started background process:\" . $pid);\n exit(1);\n }\n \n posix_setsid();\n }", "function become_daemon()\n{\n $pid = pcntl_fork();\n \n if ($pid == -1)\n {\n /* fork failed */\n echo \"fork failure!\\n\";\n exit();\n }elseif ($pid)\n {\n /* close the parent */\n exit();\n }else\n {\n /* child becomes our daemon */\n posix_setsid();\n chdir('/');\n umask(0);\n return posix_getpid();\n\n }\n}", "public function build();", "public function build();", "public function build();", "public function build();", "public function build();", "public function build();", "public function build();", "public function run()\n { \n self::create();\n }", "public function run()\n {\n return $this->taskDockerBuild($this->pathToDockerfile)\n ->tag($this->tag)\n ->run();\n }", "public function run()\n {\n factory(OauthClient::class,1)->create();\n }", "private function __construct() {\n\t\t$this->client_ids = array(\n\t\t\t'stolaf' => get_field( $this->service . '_stolaf_client_id', 'option' ),\n\t\t\t'carleton' => get_field( $this->service . '_carleton_client_id', 'option' ),\n\t\t);\n\t\t$this->client_secrets = array(\n\t\t\t'stolaf' => get_field( $this->service . '_stolaf_client_secret', 'option' ),\n\t\t\t'carleton' => get_field( $this->service . '_carleton_client_secret', 'option' ),\n\t\t);\n\n\t\tif ( empty( $this->client_ids ) || empty( $this->client_secrets ) ) {\n\t\t\tadd_action( 'admin_notices', array( $this, 'missing_api_keys' ) );\n\t\t}\n\n\t\trequire_once BL_PLUGIN_DIR . '/inc/class-libguides-11-async-process.php';\n\t\t$this->async = new LibGuides_11_Async_Process();\n\t}", "private function configureDaemonDefinition(): void\n {\n $this->addOption('run-once', null, InputOption::VALUE_NONE, 'Run the command just once.');\n $this->addOption('run-max', null, InputOption::VALUE_OPTIONAL, 'Run the command x time.');\n $this->addOption('memory-max', null, InputOption::VALUE_OPTIONAL, 'Gracefully stop running command when given memory volume, in bytes, is reached.', 0);\n $this->addOption('shutdown-on-exception', null, InputOption::VALUE_NONE, 'Ask for shutdown if an exception is thrown.');\n $this->addOption('show-exceptions', null, InputOption::VALUE_NONE, 'Display exception on command output.');\n }", "public function start();", "public function start();", "public function start();", "public function start();", "public function start();", "public function start();", "public function start();", "public function start();", "public function start();", "public function start();", "public function start();", "public function start();", "public function run()\n {\n prodecyt::factory(50)->create();\n }", "protected static function main()\n\t{\n\t\t// Create a TCP/SSL server socket context\n\t\t$context = MHTTPD::getContext();\n\t\t\n\t\t// Start the listener\n\t\tMHTTPD::createListener($context);\n\n\t\t// Initialize some handy vars\n\t\t$timeout = ini_get('default_socket_timeout');\n\t\t$maxClients = MHTTPD::$config['Server']['max_clients'];\n\t\t$maxHeaderBlockSize = MHTTPD_Message::getMaxHeaderBlockSize();\n\t\tif (MHTTPD::$debug) {\n\t\t\t$listener_name = stream_socket_get_name(MHTTPD::$listener, false);\n\t\t}\n\t\t\n\t\t// Start the browser\n\t\tMHTTPD::launchBrowser();\n\t\t\n\t\t// The main loop\n\t\twhile (MHTTPD::$running) \t{\t\n\t\t\n\t\t\t// Build a list of active streams to monitor\n\t\t\t$read = array('listener' => MHTTPD::$listener);\n\t\t\tforeach (MHTTPD::$clients as $i=>$client) {\n\t\t\t\t\t\t\t\n\t\t\t\t// Add any client sockets\n\t\t\t\tif ($csock = $client->getSocket()) {\n\t\t\t\t\t$read[\"client_$i\"] = $csock;\n\t\t\t\t\t\n\t\t\t\t\t// Add any client FCGI sockets\n\t\t\t\t\tif ($cfsock = $client->getFCGISocket()) {\n\t\t\t\t\t\t$read[\"clfcgi_$i\"] = $cfsock;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t// Add any client file streams\n\t\t\t\t\tif ($client->isStreaming()) {\n\t\t\t\t\t\t$read[\"clstrm_$i\"] = $client->getStream();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t// Add any aborted FCGI requests\n\t\t\tforeach (MHTTPD::$aborted as $aID=>$ab) {\n\t\t\t\t$read['aborted_'.$aID.'_'.$ab['client'].'_'.$ab['pid']] = $ab['socket'];\n\t\t\t}\n\n\t\t\tif (MHTTPD::$debug) {\n\t\t\t\tcecho(\"FCGI scoreboard:\\n\"); cprint_r(MFCGI::getScoreboard(true)); cecho(\"\\n\");\n\t\t\t\tcecho(\"Pre-select:\\n\"); cprint_r($read);\n\t\t\t\tcecho(chrule().\"\\n>>>> Waiting for server activity ($listener_name)\\n\".chrule().\"\\n\\n\");\n\t\t\t}\n\n\t\t\t// Wait for any new activity\n\t\t\tif (!($ready = @stream_select($read, $write=null, $error=null, null))) {\n\t\t\t\ttrigger_error(\"Could not select streams\", E_USER_WARNING);\n\t\t\t}\n\t\t\t\n\t\t\tif (MHTTPD::$debug) {cecho(\"Post-select:\\n\"); cprint_r($read);}\n\t\t\t\t\t\t\n\t\t\t// Check if the listener has a new client connection\n\t\t\tif (in_array(MHTTPD::$listener, $read)) {\n\t\t\t\t\n\t\t\t\t// Search for a free slot to add the new client\n\t\t\t\tfor ($i = 1; $i <= $maxClients; $i++) {\n\t\t\t\t\t\n\t\t\t\t\tif (!isset(MHTTPD::$clients[$i])) {\n\t\t\t\t\t\t\n\t\t\t\t\t\t// This slot is free, so add the new client connection\n\t\t\t\t\t\tif (MHTTPD::$debug) {cecho(\"New client ($i): \");}\n\t\t\t\t\t\tif (!($sock = @stream_socket_accept(MHTTPD::$listener, $timeout, $peername))) {\n\t\t\t\t\t\t\tif (MHTTPD::$debug) {cecho(\"\\nCould not accept client stream\\n\");}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (MHTTPD::$debug) {cecho(\"$peername\\n\");}\n\t\t\t\t\t\t$client = new MHTTPD_Client($i, $sock, $peername);\n\t\t\t\t\t\t$client->debug = MHTTPD::$debug;\n\t\t\t\t\t\tMHTTPD::$clients[$i] = $client;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t\n\t\t\t\t\t} elseif ($i == $maxClients) {\n\t\t\t\t\t\t\n\t\t\t\t\t\t// No free slots, so the request goes to the backlog\n\t\t\t\t\t\tif (MHTTPD::$debug) {cecho(\"No free client slots!\\n\");}\n\t\t\t\t\t\ttrigger_error(\"Too many clients\", E_USER_NOTICE);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t// Return to waiting if only the listener is active\n\t\t\t\tif ($ready == 1) {\n\t\t\t\t\tif (MHTTPD::$debug) {cecho(\"No other connections to handle\\n\\n\");}\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t// Handle any incoming client data on selected sockets\n\t\t\tforeach (MHTTPD::$clients as $i=>$client) {\n\t\t \n\t\t\t\tif (MHTTPD::$debug) {cecho(\"Client ($i) ... \");}\n\t\t\t\t$csock = $client->getSocket();\n\n\t\t\t\t// Handle any new client requests\n\t\t\t\tif ($client->isReady() && $csock && in_array($csock, $read)) {\n\t\t\t\t\n\t\t\t\t\t// Start reading the request\n\t\t\t\t\tif (MHTTPD::$debug) {cecho(\"reading ... \");}\n\t\t\t\t\t$client->setTimeout(10);\n\t\t\t\t\t$input = '';\n\t\t\t\t\t\n\t\t\t\t\t// Get the request header block only\n\t\t\t\t\twhile ($buffer = @fgets($csock, 1024)) {\n\t\t\t\t\t\t$input .= $buffer;\n\t\t\t\t\t\tif ($buffer == '' || substr($input, -4) == \"\\r\\n\\r\\n\" \n\t\t\t\t\t\t\t|| strlen($input) > $maxHeaderBlockSize\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif ($input) {\n\t\t\t\t\t\n\t\t\t\t\t\t// Store the headers and process the request\n\t\t\t\t\t\tif (MHTTPD::$debug) {cecho(\"done\\n\");}\n\t\t\t\t\t\t$client->setInput(trim($input));\n\t\t\t\t\t\tif (!$client->processRequest() && !$client->needsAuthorization()) {\n\t\t\t\t\t\t\tMHTTPD::removeClient($client);\n\t\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t} else {\n\t\t\t\t\t\t\n\t\t\t\t\t\t// No request data, client is disconnecting\n\t\t\t\t\t\tif (MHTTPD::$debug) {cecho(\"disconnected\\n\");}\n\t\t\t\t\t\tMHTTPD::removeClient($client);\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\n\t\t\t\t// Handle any request body data\n\t\t\t\t} elseif ($client->isPosting() && $csock && in_array($csock, $read)) {\n\t\t\t\t\tif (MHTTPD::$debug) {cecho(\"reading body \");}\n\t\t\t\t\t$client->readRequestBody();\n\t\t\t\t\n\t\t\t\t// Handle any disconnects or malformed requests\n\t\t\t\t} elseif ($csock && in_array($csock, $read)) {\n\t\t\t\t\tif (MHTTPD::$debug) {cecho(\"aborted connection\\n\");}\n\t\t\t\t\tMHTTPD::removeClient($client);\n\t\t\t\t\tcontinue;\n\t\t\t\t\n\t\t\t\t// Handle any inactive client connections\n\t\t\t\t} else {\n\t\t\t\t\tif (MHTTPD::$debug) {\n\t\t\t\t\t\tcecho('inactive (');\n\t\t\t\t\t\tcecho('req:'.$client->hasRequest());\n\t\t\t\t\t\tcecho(' resp:'.$client->hasResponse());\n\t\t\t\t\t\tcecho(' fcgi:'.$client->hasFCGI());\n\t\t\t\t\t\tcecho(\")\\n\");\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t// Handle any incoming FCGI responses\n\t\t\t\tif (($clfsock = $client->getFCGISocket()) && in_array($clfsock, $read)) {\n\t\t\t\t\tif (MHTTPD::$debug) {cecho(\"Client ($i) ... reading FCGI socket: {$clfsock}\\n\");}\n\t\t\t\t\tif (!$client->readFCGIResponse()) {\n\t\t\t\t\t\tMHTTPD::removeClient($client); // abort any hanging connections\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Handle any outgoing FCGI requests\n\t\t\tforeach (MHTTPD::$clients as $i=>$client) {\n\t\t\t\tif ($client->hasFCGI() && !$client->hasSentFCGI()\n\t\t\t\t\t&& (!$client->isPosting() || $client->hasFullRequestBuffer())\n\t\t\t\t\t) {\n\t\t\t\t\tif (MHTTPD::$debug){cecho(\"Client ($i) ... sending FCGI request\\n\");}\n\t\t\t\t\tif (!$client->sendFCGIRequest()) {\n\t\t\t\t\t\tMHTTPD::removeClient($client); // abort any failed connections\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t// Handle any outgoing client responses\n\t\t\tforeach (MHTTPD::$clients as $i=>$client) {\n\t\t\t\tif ($client->hasRequest()) {\n\t\t\t\t\tif (!$client->isPosting() && $client->hasSentFCGI() && !$client->hasResponse()) {\n\t\t\t\t\t\tif (MHTTPD::$debug){cecho(\"Client ($i) ... waiting for FCGI response\\n\");}\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t} elseif ($client->needsAuthorization()) {\n\t\t\t\t\t\tif (MHTTPD::$debug){cecho(\"Client ($i) ... waiting for authorization\\n\");}\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t} elseif ($client->hasResponse()) {\n\t\t\t\t\t\tif (MHTTPD::$debug) {cecho(\"Client ($i) ... handling response\\n\");}\n\t\t\t\t\t\tMHTTPD::handleResponse($client);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\n\t\t\t// Handle any aborted FCGI requests\n\t\t\tforeach ($read as $r) {\n\t\t\t\tforeach (MHTTPD::$aborted as $aID=>$ab) {\n\t\t\t\t\tif ($r == $ab['socket']) {\n\t\t\t\t\t\tMFCGI::removeClient($ab['process']);\n\t\t\t\t\t\tMHTTPD::closeSocket($r);\n\t\t\t\t\t\tunset(MHTTPD::$aborted[$aID]);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t// End of main loop\n\t\t\tif (MHTTPD::$debug) {cecho(\"\\n\");}\n\t\t}\n\t\t\n\t\t// Quit the server cleanly\n\t\tMHTTPD::shutdown();\n\t}", "public function main()\n\t{\n\t\t$this->loadConfig();\n\t\t$this->validateProject();\n\t\t$this->cleanConfig();\n\t\t$this->installDependencies();\n\t\t$this->createAutoload();\n\t\t$this->finish();\n\t}", "public function run()\n {\n factory(OauthClients::class,10)->create();\n }", "public function LaunchInjector()\n {\n if(!empty($this->JOBS)){\n $this->Debug('LOW QUEUE JOBS', $this->JOBS);\n foreach ($this->JOBS as $ID => $JOB) {\n $cmd = '/usr/bin/php '.$this->Injector.' \\''.$ID.'\\' \\''.json_encode($JOB, JSON_NUMERIC_CHECK).'\\'';\n $rslt = array();\n exec($cmd, $rslt);\n if(!empty($rslt))\n $this->ALERTS[] = red.implode(\"\\n\",$rslt).white;\n }\n }\n }", "public function run()\n {\n factory(Idiom::class, 50)->create();\n }", "public function run();", "public function run();", "public function run();", "public function run();", "public function run();", "public function run();", "public function run();", "public function run();", "public function run();", "public function run();", "public function run();", "public function run();", "public function run();", "public function run();", "public function run();", "public function run();", "public abstract function build();", "public abstract function build();", "public function run()\n {\n factory(Servicios::class, 10)->create();\n }", "public function __construct() {\n $this->eventManager = new EventManager;\n $this->mh = curl_multi_init();\n }", "private function execRunHandler()\n {\n // guarantee that only one process can be run at one time\n // use socket as lock\n Log::info('Try to start handling process...');\n\n // bounce\n $handlers = BounceHandler::get();\n Log::info(sizeof($handlers).' bounce handlers found');\n $count = 1;\n foreach ($handlers as $handler) {\n Log::info('Starting handler '.$handler->name.\" ($count/\".sizeof($handlers).')');\n $handler->start();\n Log::info('Finish processing handler '.$handler->name);\n $count += 1;\n }\n\n // abuse\n $handlers = FeedbackLoopHandler::get();\n Log::info(sizeof($handlers).' feedback loop handlers found');\n $count = 1;\n foreach ($handlers as $handler) {\n Log::info('Starting handler '.$handler->name.\" ($count/\".sizeof($handlers).')');\n $handler->start();\n Log::info('Finish processing handler '.$handler->name);\n $count += 1;\n }\n }", "public function run() {\n\t\t$this->create_instances();\n\t\t$this->register_hooks();\n\t}", "public function run()\n {\n Mechanic::factory()\n ->count(50)\n ->create();\n }", "public static function daemonize()\n {\n $pid = \\pcntl_fork();\n if ($pid == -1) {\n throw new \\RuntimeException(\"Failed to pcntl_fork()!\");\n } else if ($pid) { // parent process\n exit(0);\n } else { // child\n $sid = \\posix_setsid();\n\n \\fclose(STDIN);\n \\fclose(STDOUT);\n \\fclose(STDERR);\n \\chdir('/');\n\n return \\getmypid();\n }\n }", "public function __invoke()\n {\n if (! Manifest::usesContainerImage($this->environment)) {\n return;\n }\n\n $buildArgs = Collection::make($this->manifestBuildArgs)\n ->merge(Collection::make($this->cliBuildArgs)\n ->mapWithKeys(function ($value) {\n [$key, $value] = explode('=', $value, 2);\n\n return [$key => $value];\n })\n )->toArray();\n\n if (! $this->validateDockerFile($this->environment, $runtime = Manifest::runtime($this->environment), $buildArgs)) {\n Helpers::abort('The base image used in '.Path::dockerfile($this->environment).' is incompatible with the \"'.$runtime.'\" runtime, or you are running an outdated version of Vapor CLI.');\n }\n\n Helpers::step('<options=bold>Building Container Image</>');\n\n Docker::build(\n $this->appPath,\n Manifest::name(),\n $this->environment,\n $this->formatBuildArguments(),\n $this->cliBuildOptions\n );\n }", "public function __construct()\n {\n $this->http = new swoole_http_server(self::HOST, self::PORT);\n\n $this->http->set([\n \"enable_static_handler\" => true,\n \"document_root\" => \"/home/alex/study/thinkphp/public/static/\",\n 'worker_num' => 2,\n 'task_worker_num' => 2,\n\n ]);\n\n $this->http->on(\"WorkerStart\", [$this, 'onWorkerStart']);\n $this->http->on(\"request\", [$this, 'onRequest']);\n $this->http->on(\"task\", [$this, 'onTask']);\n $this->http->on(\"finish\", [$this, 'onFinish']);\n $this->http->on(\"close\", [$this, 'onClose']);\n\n\n $this->http->start();\n }", "public function run()\n {\n $bar = $this->command->getOutput()->createProgressBar(10);\n $this->command->info('Seeding Donor...');\n Donor::factory()->count(20)->create()->each(function () use ($bar) {\n $bar->advance();\n });\n $bar->finish();\n $this->command->info(' Donor Seeded!'); }", "public function run()\n {\n factory(ServiceBay::class, 10)->create();\n }", "public abstract function run();", "public abstract function run();" ]
[ "0.61921877", "0.5489512", "0.5420823", "0.53148186", "0.52343", "0.5137822", "0.5063554", "0.5038117", "0.5034231", "0.5007458", "0.49465534", "0.494175", "0.48992822", "0.48955712", "0.48390567", "0.48154968", "0.4796848", "0.47902066", "0.47895202", "0.47895202", "0.4787157", "0.47866568", "0.4786459", "0.4786459", "0.4785451", "0.47848964", "0.47848964", "0.47848964", "0.47848964", "0.47848964", "0.47848964", "0.47837144", "0.47753027", "0.47527784", "0.47119844", "0.46957746", "0.46832842", "0.46792752", "0.46553737", "0.46547723", "0.4642405", "0.46152508", "0.46152508", "0.46152508", "0.46152508", "0.46152508", "0.46152508", "0.46152508", "0.46065593", "0.4599199", "0.45826623", "0.457656", "0.45761666", "0.4553909", "0.4553909", "0.4553909", "0.4553909", "0.4553909", "0.4553909", "0.4553909", "0.4553909", "0.4553909", "0.4553909", "0.4553909", "0.4553909", "0.45532465", "0.4552045", "0.4550712", "0.45499972", "0.4541182", "0.45366403", "0.45260137", "0.45260137", "0.45260137", "0.45260137", "0.45260137", "0.45260137", "0.45260137", "0.45260137", "0.45260137", "0.45260137", "0.45260137", "0.45260137", "0.45260137", "0.45260137", "0.45260137", "0.45260137", "0.4520781", "0.4520781", "0.45189813", "0.45077425", "0.4505047", "0.4502007", "0.44986385", "0.4494406", "0.44939148", "0.4477333", "0.4475168", "0.4460185", "0.4458845", "0.4458845" ]
0.0
-1
Build a sync daemon
public static function buildSync( $host, $port, $user, $pass, $queueName, QueueConsumer $consumer, $escapeMode = self::ESCAPE_MODE_SERIALIZE, $requeueOnFailure = true, LoggerInterface $logger = null, $stopOnFailure = false ) { return self::build( $host, $port, $user, $pass, $queueName, $consumer, true, $escapeMode, $requeueOnFailure, $stopOnFailure ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function setup_sync()\n {\n }", "private function syncRepository()\n {\n $cwd = '/tmp/'.$this->migrationId;\n (new ProcessBuilder(['mkdir']))->add('-p')->add($cwd)->getProcess()->mustRun();\n\n $cloneSourceCommandBuilder = new ProcessBuilder(['git', 'clone', $this->sourceProject->getSshUrlToRepo(), '.']);\n $cloneSourceCommandBuilder\n ->setWorkingDirectory($cwd)\n ->setTimeout(self::TIMEOUT)\n ->getProcess()\n ->mustRun();\n\n $addNewRemoteBuilder = new ProcessBuilder(['git', 'remote', 'add', 'new']);\n $addNewRemoteBuilder\n ->setWorkingDirectory($cwd)\n ->add($this->targetProject->getSshUrlToRepo())\n ->getProcess()\n ->mustRun();\n\n $pushToRemoteBuilder = new ProcessBuilder(['git', 'push', 'new', '--all']);\n $pushToRemoteBuilder\n ->setWorkingDirectory($cwd)\n ->setTimeout(self::TIMEOUT)\n ->getProcess()\n ->mustRun();\n\n $pushTagsToRemoteBuilder = new ProcessBuilder(['git', 'push', 'new', '--tags']);\n $pushTagsToRemoteBuilder\n ->setWorkingDirectory($cwd)\n ->setTimeout(self::TIMEOUT)\n ->getProcess()\n ->mustRun();\n }", "public function run()\n {\n $items = $this->app->args->getParams('wild');\n list($proj, $env) = SettingFiles::extractProjEnv($items);\n\n $key = $proj . \".\" . $env;\n if (!Check::fileExists($key)) {\n $msg = Facilitator::onNoFileFound($proj, $env);\n \n $this->app->display($msg, 0);\n return;\n }\n\n $settings = SettingFiles::getObject($key);\n $rsync = new Rsync($settings);\n\n $msg = Facilitator::rsyncBanner($proj, $env, $rsync->cmd);\n $this->app->inline($msg);\n\n if ($this->app->args->simulate) {\n $msg = 'Simulation mode' . \"\\n\";\n\n $this->app->display($msg, 0);\n return;\n }\n\n $rsync->run();\n }", "public function start() {\n\t\t// Setup\n\t\t$options = array(\n\t\t\t'appName' => 'cakedaemon',\n\t\t\t'appDescription' => 'Runs extended tasks defined in the host app in the background',\n\t\t\t'sysMaxExecutionTime' => '0',\n\t\t\t'sysMaxInputTime' => '0',\n\t\t\t'sysMemoryLimit' => '1024M',\n\t\t\t'logLocation' => TMP . \"logs\" . DS . 'cakedaemon.log',\n\t\t\t'logVerbosity' => System_Daemon::LOG_INFO\n\t\t);\n\t\tSystem_Daemon::setOptions($options);\n\t\tSystem_Daemon::setSigHandler('SIGCHLD', array(&$this, 'handleSIGCHLD'));\n\n\t\t// This program can also be run in the forground with argument no-daemon\n\t\tif (!$this->params['no-daemon']) {\n\t\t\t// Spawn Daemon\n\t\t\tSystem_Daemon::start();\n\t\t}\n\n\t\t$this->__initConfig();\n\n\t\t// Here we have to do several things\n\t\t// 1) Figure out how many stale static nodes we have\n\t\t// 2) Ask the DB for one one job for each node\n\t\t// 3) Start these jobs on each of the corresponding nodes\n\t\t// 4) Wait for a pre-determined amount of time\n\t\t// 5) Check if any children have finished and start again\n\t\twhile (!System_Daemon::isDying()) {\n\t\t\t$taskIds = $this->DaemonRunner->findStaleJobTypes();\n\t\t\t$currentlyRunningJobs = $this->DaemonRunner->findProcessingJobs();\n\n\t\t\tSystem_Daemon::debug(\"Stale Process Types: \" . json_encode($taskIds));\n\t\t\tSystem_Daemon::debug(\"Aware of currently running job ids: \" . json_encode($currentlyRunningJobs));\n\t\t\tforeach ($taskIds as $id) {\n\t\t\t\tif ($job = $this->DaemonQueue->findJob($id, $currentlyRunningJobs)) {\n\t\t\t\t\t$currentlyRunningJobs[] = $job['DaemonQueue']['id'];\n\t\t\t\t\t$this->__spawnChild($job, $this->DaemonRunner->findStaleRunnerByJobType($id));\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Sometimes our sleep is inturrupted\n\t\t\t// This could be by a very noisy owl, or by a completed child process.\n\t\t\t// Either way, we should get our beauty sleep!\n\t\t\t$timeToSleep = $this->config['timeout'];\n\t\t\twhile ($timeToSleep > 0) {\n\t\t\t\t$timeToSleep = sleep($timeToSleep);\n\t\t\t}\n\t\t\tclearstatcache();\n\n\t\t\t$this->__reconnectDB();\n\n\t\t\t// For some reason the whole SIG handle thing doesnt work in\n\t\t\t// foreground mode\n\t\t\tif ($this->params['no-daemon']) {\n\t\t\t\t$this->__mopUp();\n\t\t\t}\n\t\t}\n\n\t\tSystem_Daemon::stop();\n\t}", "private function buildDrushTask()\n {\n return $this->taskDrushStack($this::DRUSH_BIN)\n ->drupalRootDirectory((__DIR__) . '/web');\n }", "public function sync()\n\t{\n\t\t// Initialize the logger\n\t\t$options['format'] = '{DATE}\\t{TIME}\\t{LEVEL}\\t{CODE}\\t{MESSAGE}';\n\t\t$options['text_file'] = 'gforge_sync.php';\n\t\tJLog::addLogger($options, JLog::INFO);\n\t\tJLog::add('Starting the GForge Sync', JLog::INFO);\n\n\t\t// Log the start time\n\t\t$this->startTime = JFactory::getDate();\n\n\t\t// Initialize variables.\n\t\t$username = JFactory::getConfig()->get('gforgeLogin');\n\t\t$password = JFactory::getConfig()->get('gforgePassword');\n\t\t$project = 5; // Joomla project id.\n\n\t\t// Wrap the processing in try/catch to log errors\n\t\ttry\n\t\t{\n\t\t\t// Connect to the main SOAP interface.\n\t\t\t$this->gforge = new GForge('http://joomlacode.org/gf');\n\t\t\t$this->gforge->login($username, $password);\n\n\t\t\t// Connect to the legacy SOAP interface.\n\t\t\t$this->gforgeLegacy = new GForgeLegacy('http://joomlacode.org/gf');\n\t\t\t$this->gforgeLegacy->login($username, $password);\n\n\t\t\t// Get the tracker data from the SOAP interface.\n\t\t\t$trackers = $this->gforge->getProjectTrackers($project, true);\n\n\t\t\tif (empty($trackers))\n\t\t\t{\n\t\t\t\tthrow new RuntimeException('Unable to get trackers from the server.');\n\t\t\t}\n\n\t\t\t// Sync each tracker.\n\t\t\t$trackers = array_reverse($trackers);\n\n\t\t\tforeach ($trackers as $tracker)\n\t\t\t{\n\t\t\t\t$currentTrackers = array(8103);\n\n\t\t\t\tif (in_array($tracker->tracker_id, $currentTrackers))\n\t\t\t\t{\n\t\t\t\t\t$this->populateTrackerFields($tracker->tracker_id);\n\t\t\t\t\t$this->syncTracker($tracker);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tcatch (RuntimeException $e)\n\t\t{\n\t\t\tvar_dump($e);die;\n\t\t\tJLog::add('An error occurred during the sync: ' . $e->getMessage(), JLog::INFO);\n\n\t\t\t$this->sendEmail();\n\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t}", "protected function _syncCreator() {}", "public function sync();", "public function sync();", "private function buildDrushTask()\n {\n return $this->taskDrushStack($this::DRUSH_BIN)\n ->drupalRootDirectory((__DIR__) . '/docroot');\n }", "function checkmk_sync_on_changes() {\n\tglobal $config;\n\n\tif (is_array($config['installedpackages']['checkmksync']['config'])) {\n\t\t$checkmk_sync = $config['installedpackages']['checkmksync']['config'][0];\n\t\t$synconchanges = $checkmk_sync['synconchanges'];\n\t\t$synctimeout = $checkmk_sync['synctimeout'] ?: '250';\n\t\tswitch ($synconchanges) {\n\t\t\tcase \"manual\":\n\t\t\t\tif (is_array($checkmk_sync['row'])) {\n\t\t\t\t\t$rs = $checkmk_sync['row'];\n\t\t\t\t} else {\n\t\t\t\t\tlog_error(\"[check_mk-agent] XMLRPC sync is enabled but there are no hosts configured as replication targets.\");\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase \"auto\":\n\t\t\t\tif (is_array($config['hasync'])) {\n\t\t\t\t\t$system_carp = $config['hasync'];\n\t\t\t\t\t$rs[0]['ipaddress'] = $system_carp['synchronizetoip'];\n\t\t\t\t\t$rs[0]['username'] = $system_carp['username'];\n\t\t\t\t\t$rs[0]['password'] = $system_carp['password'];\n\t\t\t\t\t$rs[0]['syncdestinenable'] = FALSE;\n\n\t\t\t\t\t// XMLRPC sync is currently only supported over connections using the same protocol and port as this system\n\t\t\t\t\tif ($config['system']['webgui']['protocol'] == \"http\") {\n\t\t\t\t\t\t$rs[0]['syncprotocol'] = \"http\";\n\t\t\t\t\t\t$rs[0]['syncport'] = $config['system']['webgui']['port'] ?: '80';\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$rs[0]['syncprotocol'] = \"https\";\n\t\t\t\t\t\t$rs[0]['syncport'] = $config['system']['webgui']['port'] ?: '443';\n\t\t\t\t\t}\n\t\t\t\t\tif ($system_carp['synchronizetoip'] == \"\") {\n\t\t\t\t\t\tlog_error(\"[check_mk-agent] XMLRPC CARP/HA sync is enabled but there are no system backup hosts configured as replication targets.\");\n\t\t\t\t\t\treturn;\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$rs[0]['syncdestinenable'] = TRUE;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tlog_error(\"[check_mk-agent] XMLRPC CARP/HA sync is enabled but there are no system backup hosts configured as replication targets.\");\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\treturn;\n\t\t\t\tbreak;\n\t\t}\n\t\tif (is_array($rs)) {\n\t\t\tlog_error(\"[check_mk-agent] XMLRPC sync is starting.\");\n\t\t\tforeach ($rs as $sh) {\n\t\t\t\t// Only sync enabled replication targets\n\t\t\t\tif ($sh['syncdestinenable']) {\n\t\t\t\t\t$sync_to_ip = $sh['ipaddress'];\n\t\t\t\t\t$port = $sh['syncport'];\n\t\t\t\t\t$username = $sh['username'] ?: 'admin';\n\t\t\t\t\t$password = $sh['password'];\n\t\t\t\t\t$protocol = $sh['syncprotocol'];\n\n\t\t\t\t\t$error = '';\n\t\t\t\t\t$valid = TRUE;\n\n\t\t\t\t\tif ($password == \"\") {\n\t\t\t\t\t\t$error = \"Password parameter is empty. \";\n\t\t\t\t\t\t$valid = FALSE;\n\t\t\t\t\t}\n\t\t\t\t\tif (!is_ipaddr($sync_to_ip) && !is_hostname($sync_to_ip) && !is_domain($sync_to_ip)) {\n\t\t\t\t\t\t$error .= \"Misconfigured Replication Target IP Address or Hostname. \";\n\t\t\t\t\t\t$valid = FALSE;\n\t\t\t\t\t}\n\t\t\t\t\tif (!is_port($port)) {\n\t\t\t\t\t\t$error .= \"Misconfigured Replication Target Port. \";\n\t\t\t\t\t\t$valid = FALSE;\n\t\t\t\t\t}\n\t\t\t\t\tif ($valid) {\n\t\t\t\t\t\tcheckmk_do_xmlrpc_sync($sync_to_ip, $port, $protocol, $username, $password, $synctimeout);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tlog_error(\"[check_mk-agent] XMLRPC sync with '{$sync_to_ip}' aborted due to the following error(s): {$error}\");\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tlog_error(\"[check_mk-agent] XMLRPC sync completed.\");\n\t\t}\n \t}\n}", "public function sync($syncer, array $options = ['mode' => 'default']) {\n $syncers = \\Drupal::service('ymca_sync.sync_repository')->getSyncers();\n if (!in_array($syncer, $syncers)) {\n $this->logger()->info(sprintf('Syncer %s not exist.', $syncer));\n return;\n }\n $this->logger()->notice(sprintf('Try to start syncer %s', $syncer));\n \\Drupal::service('ymca_sync.syncer')->run($syncer, \"proceed\", $options);\n }", "public function sync() {\n return $this->returnCommand(['SYNC']);\n }", "function _drush_build() {\n drush_invoke('updatedb');\n drush_invoke('features-revert-all', array('force' => TRUE));\n drush_invoke('cc', array('type' => 'all'));\n drush_log(dt('Built!'), 'success');\n}", "function sync() {\n\t\t// TODO\n\t}", "function reload_all_sync() {\n\tglobal $config;\n\n\t/* parse config.xml again */\n\t$config = parse_config(true);\n\n\t/* set up our timezone */\n\tsystem_timezone_configure();\n\n\t/* set up our hostname */\n\tsystem_hostname_configure();\n\n\t/* make hosts file */\n\tsystem_hosts_generate();\n\n\t/* generate resolv.conf */\n\tsystem_resolvconf_generate();\n\n\t/* enable routing */\n\tsystem_routing_enable();\n\n\t/* set up interfaces */\n\tinterfaces_configure();\n\n\t/* start dyndns service */\n\tservices_dyndns_configure();\n\n\t/* configure cron service */\n\tconfigure_cron();\n\n\t/* start the NTP client */\n\tsystem_ntp_configure();\n\n\t/* sync pw database */\n\tunlink_if_exists(\"/etc/spwd.db.tmp\");\n\tmwexec(\"/usr/sbin/pwd_mkdb -d /etc/ /etc/master.passwd\");\n\n\t/* restart sshd */\n\tsend_event(\"service restart sshd\");\n\n\t/* restart webConfigurator if needed */\n\tsend_event(\"service restart webgui\");\n}", "public function run_sync_process(){\n //Verify if module is enabled\n if(Mage::helper('connector')->isEnabled()) {\n\n \t//Set sync type\n \t\t$sync_type = Minematic_Connector_Model_Config::SYNC_TYPE_MAGENTO_SIDE;\n\n //Log Starting sync process msg\n Mage::helper('connector')->logSyncProcess(\"Starting synchronization task job...\", $sync_type);\n\n try {\n\n //Sync all data\n Mage::getModel('connector/synchronization')->sync_data($sync_type, Minematic_Connector_Model_Config::DATA_TYPE_ALL);\n\n } catch (Exception $e) {\n\n \t// Logging Exceptions\n Mage::helper('connector')->logSyncProcess($e->getMessage(), $sync_type, \"ERROR\");\n \t\n }\n\n //Log Finishing sync process msg\n Mage::helper('connector')->logSyncProcess(\"Finishing synchronization task job.\", $sync_type);\n }\n }", "private function githubSync()\n\t{\n\n\t\t$frm = e107::getForm();\n\t\t$mes = e107::getMessage();\n\n\t//\t$message = DBLAN_70;\n\t//\t$message .= \"<br /><a class='e-ajax btn btn-success' data-loading-text='\".DBLAN_71.\"' href='#backupstatus' data-src='\".e_SELF.\"?mode=backup' >\".LAN_CREATE.\"</a>\";\n\n\t\t$message = $frm->open('githubSync');\n\t\t$message .= \"<p>\".DBLAN_116.\" <b>\".e_SYSTEM.\"temp</b> \".DBLAN_117.\" </p>\";\n\t\t$message .= $frm->button('githubSyncProcess',1,'delete', DBLAN_113);\n\t\t$message .= $frm->close();\n\n\n\t\t$mes->addInfo($message);\n\n\t//\t$text = \"<div id='backupstatus' style='margin-top:20px'></div>\";\n\n\n\t\te107::getRender()->tablerender(DBLAN_10.SEP.DBLAN_112, $mes->render());\n\n\n\n\t}", "public function sync()\n {\n $result = '';\n foreach ($this->hosts() as $host) {\n $result .= $host;\n $result .= \"\\n\";\n }\n file_put_contents($this->configFilePath(), $result);\n }", "function cos_build_simple($options = null) {\n\n $dir = getcwd();\n $name = basename($dir);\n\n if (file_exists(\"./build/$name\")) {\n common::execCommand(\"sudo rm -rf ./build/$name*\");\n }\n common::execCommand(\"mkdir ./build/$name\");\n\n $htdocs = \"cp -rf htdocs/* ./build/$name\";\n common::execCommand($htdocs);\n\n $domain = conf::getMainIni('domain');\n if (!$domain) {\n $domain = 'default';\n }\n\n $files_rm = \"sudo rm -rf ./build/$name/files/$domain/*\";\n common::execCommand($files_rm);\n\n $config = \"mkdir ./build/$name/config\";\n common::execCommand($config);\n\n $tmp_dir = \"mkdir ./build/$name/tmp\";\n common::execCommand($tmp_dir);\n \n $profiles = \"cp -rf profiles ./build/$name\";\n common::execCommand($profiles);\n\n $sql_scripts = \"cp -rf scripts ./build/$name\";\n common::execCommand($sql_scripts);\n\n $cli = \"cp -rf coscli.sh ./build/$name\";\n common::execCommand($cli);\n \n $composer = \"cp -rf composer.json ./build/$name\";\n common::execCommand($composer);\n\n // reset database password\n $ary = conf::getIniFileArray(\"./config/config.ini\");\n $profile = new profile();\n\n $ary = $profile->iniArrayPrepare($ary);\n\n // clean ini settings for secrets\n $ini_settings = conf::arrayToIniFile($ary);\n\n // add ini dist file\n file_put_contents(\"./build/$name/config/config.ini-dist\", $ini_settings);\n\n $index = \"cp -rf htdocs/index.php ./build/$name/index.php\";\n common::execCommand($index);\n\n $phar_cli = \"cp -rf phar-cli.php ./build/$name/\";\n common::execCommand($phar_cli);\n \n $phar_web = \"cp -rf phar-web.php ./build/$name/\";\n common::execCommand($phar_web);\n\n $module_dir = conf::pathModules();\n $modules = \"cp -rf $module_dir ./build/$name\";\n common::execCommand($modules);\n\n $vendor = \"cp -rf vendor ./build/$name\";\n common::execCommand($vendor);\n\n $rm_git = \"rm `find ./build/$name -name '.git'` -rf\";\n common::execCommand($rm_git);\n\n $rm_ignore = \"rm `find ./build/$name -name '.gitignore'` -rf\";\n common::execCommand($rm_ignore);\n\n $rm_doc = \"rm -rf ./build/vendor/doc\";\n common::execCommand($rm_doc);\n\n $output = array();\n\n exec('git tag -l', $output);\n $version = array_pop($output);\n\n $command = \"cd ./build && tar -Pczf $name-$version.tar.gz $name \";\n common::execCommand($command);\n}", "function setSyncIdDev()\n {\n }", "public function build()\n {\n $this->taskMirrorDir([\n 'src/modules' => 'web/modules/custom',\n 'src/themes' => 'web/themes/custom',\n ])->run();\n $this->_copy('src/settings.php', 'web/sites/default/settings.php');\n if (getenv('PROD_DEST') == 'pantheon') {\n $this->_copy('src/settings.pantheon.php', 'web/sites/default/settings.pantheon.php');\n }\n $this->_touch(\".built\");\n return $this;\n }", "function checkmk_do_xmlrpc_sync($sync_to_ip, $port, $protocol, $username, $password, $synctimeout) {\n\tglobal $config, $g;\n\n\tif ($username == \"\" || $password == \"\" || $sync_to_ip == \"\" || $port == \"\" || $protocol == \"\") {\n\t\tlog_error(\"[check_mk-agent] A required XMLRPC sync parameter (username, password, replication target, port or protocol) is empty ... aborting pkg sync\");\n\t\treturn;\n\t}\n\n\t// Take care of IPv6 literal address\n\tif (is_ipaddrv6($sync_to_ip)) {\n\t\t$sync_to_ip = \"[{$sync_to_ip}]\";\n\t}\n\n\t$url = \"{$protocol}://{$sync_to_ip}\";\n\n\t/* XML will hold the sections to sync. */\n\t$xml = array();\n\t$xml['checkmk'] = $config['installedpackages']['checkmk'];\n\t/* Assemble XMLRPC payload. */\n\t$params = array(XML_RPC_encode($password), XML_RPC_encode($xml));\n\n\t/* Set a few variables needed for sync code */\n\t$method = 'pfsense.merge_installedpackages_section_xmlrpc';\n\t$msg = new XML_RPC_Message($method, $params);\n\t$cli = new XML_RPC_Client('/xmlrpc.php', $url, $port);\n\t$cli->setCredentials($username, $password);\n\tif ($g['debug']) {\n\t\t$cli->setDebug(1);\n\t}\n\t/* Send our XMLRPC message and timeout after defined sync timeout value */\n\t$resp = $cli->send($msg, $synctimeout);\n\tif (!$resp) {\n\t\t$error = \"A communications error occurred while attempting XMLRPC sync with {$url}:{$port}.\";\n\t\tlog_error(\"[check_mk-agent] {$error}\");\n\t\tfile_notice(\"sync_settings\", $error, \"checkmk Settings Sync\", \"\");\n\t} elseif ($resp->faultCode()) {\n\t\t$cli->setDebug(1);\n\t\t$resp = $cli->send($msg, $synctimeout);\n\t\t$error = \"An error code was received while attempting XMLRPC sync with {$url}:{$port} - Code \" . $resp->faultCode() . \": \" . $resp->faultString();\n\t\tlog_error(\"[check_mk-agent] {$error}\");\n\t\tfile_notice(\"sync_settings\", $error, \"checkmk Settings Sync\", \"\");\n\t} else {\n\t\tlog_error(\"[check_mk-agent] XMLRPC sync successfully completed with {$url}:{$port}.\");\n\t}\n\n\t/* Tell check_mk to reload our settings on the destination sync host. */\n\t$method = 'pfsense.exec_php';\n\t$execcmd = \"require_once('/usr/local/pkg/checkmk.inc');\\n\";\n\t$execcmd .= \"sync_package_checkmk();\";\n\t/* Assemble XMLRPC payload. */\n\t$params = array(XML_RPC_encode($password), XML_RPC_encode($execcmd));\n\n\t$msg = new XML_RPC_Message($method, $params);\n\t$cli = new XML_RPC_Client('/xmlrpc.php', $url, $port);\n\t$cli->setCredentials($username, $password);\n\t$resp = $cli->send($msg, $synctimeout);\n\tif (!$resp) {\n\t\t$error = \"A communications error occurred while attempting XMLRPC sync with {$url}:{$port} (pfsense.exec_php).\";\n\t\tlog_error(\"[check_mk-agent] {$error}\");\n\t\tfile_notice(\"sync_settings\", $error, \"checkmk Settings Sync\", \"\");\n\t} elseif ($resp->faultCode()) {\n\t\t$cli->setDebug(1);\n\t\t$resp = $cli->send($msg, $synctimeout);\n\t\t$error = \"An error code was received while attempting XMLRPC sync with {$url}:{$port} - Code \" . $resp->faultCode() . \": \" . $resp->faultString();\n\t\tlog_error(\"[check_mk-agent] {$error}\");\n\t\tfile_notice(\"sync_settings\", $error, \"checkmk Settings Sync\", \"\");\n\t} else {\n\t\tlog_error(\"[check_mk-agent] XMLRPC reload data success with {$url}:{$port} (pfsense.exec_php).\");\n\t}\n}", "public function __construct()\n {\n $this->_baseDir = __DIR__;\n\n // Command line parser\n $this->_cmdParser = $parser = Console_CommandLine::fromXmlString($this->_cmdOptionsStructure);\n try {\n $cmdOptions = $parser->parse();\n if ($cmdOptions->command_name) {\n $this->_cmdOptions = $cmdOptions;\n $this->_cmdOptions->command_name = \"_{$this->_cmdOptions->command_name}\";\n } else {\n $parser->displayUsage();\n exit();\n }\n } catch (Exception $e) {\n $parser->displayError($e->getMessage());\n }\n\n // Load Config\n if (!$this->_cfg = $cfg = @json_decode(file_get_contents('config.json'), true)) {\n die($this->_fgColor('bold_red', \"\\nError: Could not read 'config.json'. Aborting.\\n\"));\n }\n\n // Logger\n $this->_log = new Logger('Tasks');\n $handler = new RotatingFileHandler(\"{$this->_baseDir}/log/report.log\", 10, Logger::INFO);\n $handler->setFormatter(new LineFormatter(\"[%datetime%] %level_name%: %message%\\n\"));\n $this->_log->pushHandler($handler);\n\n // Database\n $capsule = new Capsule;\n foreach ($cfg['databases'] as $k => $v) {\n $capsule->addConnection(\n [\n 'driver' => 'mysql',\n 'host' => $v['host'],\n 'database' => $v['database'],\n 'username' => $v['user'],\n 'password' => $v['password'],\n 'charset' => 'utf8',\n 'collation' => 'utf8_general_ci',\n 'prefix' => ''\n ],\n $k\n );\n }\n $capsule->setAsGlobal();\n\n // BitBucket Credentials\n $this->_bbApi = new Bitbucket\\API\\Api();\n $this->_bbApi->getClient()->addListener(\n new \\Bitbucket\\API\\Http\\Listener\\BasicAuthListener(\n $cfg['api']['bitbucket']['users']['admin']['user'],\n $cfg['api']['bitbucket']['users']['admin']['password']\n )\n );\n\n // Phonegap Build\n $this->_pgbApi = new PhonegapBuildApi($cfg['api']['pgb']['token']);\n\n // Stats\n $this->_report = array(\n 'Date & Time' => date('Y-m-d H:i:s'),\n 'Script Time' => 0,\n 'Method' => ''\n );\n }", "function sync_database($dir_id)\n\t{\n\t\treturn;\n\t}", "protected function _run() {\n // All OK.. Let's go\n declare(ticks = 1);\n\n if (count($this->_tasks->getManagers())==0) {\n Logger::log(\"No daemon tasks found\", \\Zend_Log::INFO);\n $this->_exit();\n }\n Logger::log(\"Found \" . count($this->_tasks->getManagers()) . \" daemon task managers\", \\Zend_Log::NOTICE);\n\n $this->getIpc()->setVar('processes', array());\n $managers = $this->_tasks->getManagers();\n foreach ($managers as $manager) {\n Logger::log(\"Starting manager: \" . $manager->getName(), \\Zend_Log::NOTICE);\n try {\n $this->_forkManager($manager);\n } catch (Exception $e) {\n echo $e->getMessage();\n Logger::log($e->getMessage(), \\Zend_Log::CRIT);\n $this->_exit();\n }\n }\n\n // Default sigHandler\n Logger::log(\"Setting default signal interrupt handler\", \\Zend_Log::DEBUG);\n $this->_sigHandler = new Interrupt\\Signal(\n 'Main Daemon',\n array(&$this, 'sigHandler')\n );\n\n // Write pids to shared memory\n $this->getIpc()->setVar('processes', $this->getPidManager()->getChilds());\n\n // Wait till all childs are done\n Logger::log(\"Waiting for childs to complete\", \\Zend_Log::NOTICE);\n while (pcntl_waitpid(0, $status) != -1) {\n $status = pcntl_wexitstatus($status);\n }\n Logger::log(\"Running done.\", \\Zend_Log::NOTICE);\n\n $this->getPidFile()->unlink();\n\n $this->_exit();\n }", "function run_maintains() {\r\n\tif (SERIA_INSTALL) {\r\n\t\tif(SERIA_COMPATIBILITY < 3)\r\n\t\t\trequire_once(SERIA_ROOT . '/seria/platform/install/base.php');\r\n\t}\r\n\t\r\n\t/**\r\n\t * Register time of running this service\r\n\t */\r\n\ttry {\r\n\t\tSERIA_Base::setParam(\"maintain_last_run\", time());\r\n\t} catch (Exception $null) {}\r\n\t\r\n\t/**\r\n\t *\tCheck if there is any new files in the seria/platform/install/ that is newer\r\n\t *\tthan the date of base.php\r\n\t */\r\n\ttry\r\n\t{\r\n\t\tif(SERIA_COMPATIBILITY < 3) if(start_maintain(\"install_maintain\", SERIA_INSTALL?1:60))\r\n\t\t{\r\n\t\t\tinclude(dirname(__FILE__).\"/maintain/install_maintain.php\");\r\n\t\t\tSERIA_Base::debug(\"Install maintain: \".install_maintain());\r\n\t\t\tstop_maintain(\"install_maintain\");\r\n\t\t}\r\n\t\r\n\t}\r\n\tcatch (Exception $e)\r\n\t{\r\n\t\tSERIA_Base::debug(\"Error: \".$e->getMessage());\r\n\t\tstop_maintain(\"install_maintain\");\r\n\t\tthrow $e;\r\n\t}\r\n\t\r\n\ttry\r\n\t{\r\n\t\tif(SERIA_COMPATIBILITY < 3) if(start_maintain(\"install_maintain2\", SERIA_INSTALL?1:60))\r\n\t\t{\r\n\t\t\tinclude(dirname(__FILE__).\"/maintain/install_maintain2.php\");\r\n\t\t\tSERIA_Base::debug(\"Install maintain 2: \".install_maintain2());\r\n\t\t\tstop_maintain(\"install_maintain2\");\r\n\t\t}\r\n\t\r\n\t}\r\n\tcatch (Exception $e)\r\n\t{\r\n\t\tSERIA_Base::debug(\"Error: \".$e->getMessage());\r\n\t\tstop_maintain(\"install_maintain2\");\r\n\t\tthrow $e;\r\n\t}\r\n\t\r\n\t\r\n\t/**\r\n\t *\tUpload files to the FTP mirror servers.\r\n\t */\r\n\ttry\r\n\t{\r\n\t\tif(SERIA_COMPATIBILITY < 3) {\r\n\t\t\t$maintainName = 'files_maintain';\r\n\t\t\tif(start_maintain($maintainName, SERIA_INSTALL||SERIA_DEBUG?1:60))\r\n\t\t\t{\r\n\t\t\t\tinclude(dirname(__FILE__).\"/maintain/\" . $maintainName . \".php\");\r\n\t\t\t\tSERIA_Base::debug(\"Files maintain: \".files_maintain());\r\n\t\t\t\tstop_maintain($maintainName);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tcatch (Exception $e)\r\n\t{\r\n\t\tSERIA_Base::debug(\"Error: \".$e->getMessage());\r\n\t\tstop_maintain(\"files_maintain\");\r\n\t\tthrow $e;\r\n\t}\r\n\t\r\n\tif(SERIA_COMPATIBILITY < 3) {\r\n\t\trun_search_maintain();\r\n\t\trun_articles_maintain();\r\n\t\trun_payment_maintain();\r\n\t}\r\n\r\n\tif (SERIA_COMPATIBILITY < 3 && class_exists('SERIA_Janitor'))\r\n\t\trun_janitor_maintain();\r\n\trun_maintain_hooks();\r\n\trun_async_maintain();\r\n}", "public function run()\n {\n if ($this->no_mods === TRUE) {\n return;\n }\n\n //Define the steamapps folder location\n $this->steamapps_location = $this->root_server_files . DIRECTORY_SEPARATOR . 'steamapps';\n\n // Remove the steamapps folder if it exists\n if (file_exists($this->steamapps_location)) {\n HelperService::delTree($this->steamapps_location);\n }\n //Download Each mod\n foreach ($this->mod_list as $mod) {\n $arg = [$this->steam_cmd, \"+login anonymous\", \"+force_install_dir \" . $this->root_server_files, \"+workshop_download_item 346110 \" . $mod, \"+quit\"];\n isset($this->user_console_controller) ? $console_controller = $this->user_console_controller : $console_controller = NULL;\n HelperService::shell_cmd($arg, $console_controller, \"Downloading mod: \" . $mod);\n }\n\n //Find the steamapps folder post mod download if it did not exist before\n empty($this->steamapps_location) ? $this->findSteamApps() : FALSE;\n\n //Compile the list of mod directories that have been downloaded\n $this->compileModDirectoryList();\n\n //Extract the .z files\n $this->zExtraction();\n\n $this->filesystem = new FileSystem();\n foreach ($this->absolute_path_to_mods as $mod_path) {\n $this->mod_map_names = [];\n $this->mod_meta_data = [];\n $base_mod_path = $mod_path . DIRECTORY_SEPARATOR . 'WindowsNoEditor';\n\n $mod_info_path = $base_mod_path . DIRECTORY_SEPARATOR . 'mod.info';\n $this->parseModInfo($mod_info_path);\n\n $mod_meta_data_path = $base_mod_path . DIRECTORY_SEPARATOR . 'modmeta.info';\n $this->parseModMetaData($mod_meta_data_path);\n\n $mod_path_parts = explode(DIRECTORY_SEPARATOR, $mod_path);\n $mod_id = trim(current(array_reverse($mod_path_parts)));\n $mod_file_location = $base_mod_path . DIRECTORY_SEPARATOR . $mod_id . '.mod';\n $this->compileMod($mod_file_location, $mod_id);\n $this->placeMods($mod_id, $base_mod_path);\n }\n \n }", "function main() {\n\t\tif (!$this->_registerPid()) {\n\t\t\t$this->out('Unable to register Pid');\n\t\t\t$this->_stop();\n\t\t}\n\t\tif (file_exists($this->params['working'] . DS . '.autotest')) {\n\t\t\tinclude($this->params['working'] . DS . '.autotest');\n\t\t}\n\t\tif (!empty($this->params['notify'])) {\n\t\t\t$this->settings['notify'] = $this->params['notify'];\n\t\t}\n\t\tif (!empty($this->params['mode'])) {\n\t\t\t$this->settings['mode'] = $this->params['mode'];\n\t\t}\n\t\t$suffix = '';\n\t\tif (!empty($this->settings['mode'])) {\n\t\t\t$suffix = ' (' . $this->settings['mode'] . ' mode)';\n\t\t}\n\n\t\tNotify::$method = $this->settings['notify'];\n\t\t$this->addHooks();\n\t\tNotify::message('Autopilot Starting', 'in ' . APP_DIR . $suffix, 0, false);\n\t\t$this->buildPaths();\n\t\t$this->run();\n\t}", "function serverSync() {\n\n\t\t// check server build\n\t\tif (strlen($this->server->build) == 0 ||\n\t\t ($this->server->getGame() == 'MP' && strcmp($this->server->build, MP_BUILD) < 0)) {\n\t\t\ttrigger_error(\"Obsolete server build '\" . $this->server->build . \"' - must be at least '\" . MP_BUILD . \"' !\", E_USER_ERROR);\n\t\t}\n\n\t\t// get server id, login, nickname, zone & packmask\n\t\t$this->server->isrelay = false;\n\t\t$this->server->relaymaster = null;\n\t\t$this->server->relayslist = array();\n\t\t$this->server->gamestate = Server::RACE;\n\t\t$this->server->packmask = '';\n\t\t$this->client->query('GetSystemInfo');\n\t\t$response['system'] = $this->client->getResponse();\n\t\t$this->server->serverlogin = $response['system']['ServerLogin'];\n\n\t\t$this->client->query('GetDetailedPlayerInfo', $this->server->serverlogin);\n\t\t$response['info'] = $this->client->getResponse();\n\t\t$this->server->id = $response['info']['PlayerId'];\n\t\t$this->server->nickname = $response['info']['NickName'];\n\t\t$this->server->zone = substr($response['info']['Path'], 6); // strip 'World|'\n\n\t\t$this->client->query('GetLadderServerLimits');\n\t\t$response['ladder'] = $this->client->getResponse();\n\t\t$this->server->laddermin = $response['ladder']['LadderServerLimitMin'];\n\t\t$this->server->laddermax = $response['ladder']['LadderServerLimitMax'];\n\n\t\t$this->client->query('IsRelayServer');\n\t\t$this->server->isrelay = ($this->client->getResponse() > 0);\n\t\tif ($this->server->isrelay) {\n\t\t\t$this->client->query('GetMainServerPlayerInfo', 1);\n\t\t\t$this->server->relaymaster = $this->client->getResponse();\n\t\t}\n\n\t\t// get MP packmask\n\t\t$this->client->query('GetServerPackMask');\n\t\t$this->server->packmask = $this->client->getResponse();\n\n\t\t// clear possible leftover ManiaLinks\n\t\t$this->client->query('SendHideManialinkPage');\n\n\t\t// get mode & limits\n\t\t$this->client->query('GetCurrentGameInfo', 1);\n\t\t$response['gameinfo'] = $this->client->getResponse();\n\t\t$this->server->gameinfo = new Gameinfo($response['gameinfo']);\n\n\t\t// get status\n\t\t$this->client->query('GetStatus');\n\t\t$response['status'] = $this->client->getResponse();\n\t\t$this->currstatus = $response['status']['Code'];\n\n\t\t// get game & mapdir\n\t\t$this->client->query('GameDataDirectory');\n\t\t$this->server->gamedir = $this->client->getResponse();\n\t\t$this->client->query('GetTracksDirectory');\n\t\t$this->server->mapdir = $this->client->getResponse();\n\n\t\t// get server name & options\n\t\t$this->getServerOptions();\n\n\t\t// throw 'synchronisation' event\n\t\t$this->releaseEvent('onSync', null);\n\n\t\t// get current players/servers on the server (hardlimited to 300)\n\t\t$this->client->query('GetPlayerList', 300, 0, 2);\n\t\t$response['playerlist'] = $this->client->getResponse();\n\n\t\t// update players/relays lists\n\t\tif (!empty($response['playerlist'])) {\n\t\t\tforeach ($response['playerlist'] as $player) {\n\t\t\t\t// fake it into thinking it's a connecting player:\n\t\t\t\t// it gets team & ladder info this way & will also throw an\n\t\t\t\t// onPlayerConnect event for players (not relays) to all plugins\n\t\t\t\t$this->playerConnect(array($player['Login'], ''));\n\t\t\t}\n\t\t}\n\t}", "private function serveStart()\n {\n if (static::$run) {\n return;\n }\n\n static::$run = true;\n\n print \"Running dev/build...\\n\";\n @exec(\"framework/sake dev/build flush=1 > /dev/null 2> /dev/null\");\n\n print \"Finding open port...\\n\";\n\n while (!$this->addressAvailable($this->getHost(), $this->getPort())) {\n $this->setPort($this->getPort() + 1);\n }\n\n if (!$this->running) {\n $host = $this->getHost();\n $port = $this->getPort();\n\n $hash = spl_object_hash($this);\n\n print \"Starting development server...\\n\";\n $command = \"framework/sake dev/tasks/SilverStripe-Serve-Task hash={$hash} host={$host} port={$port} > /dev/null 2> /dev/null &\";\n\n exec($command, $output);\n\n $command = \"ps -o pid,command | grep {$hash}\";\n @exec($command, $output);\n\n if (count($output) > 0) {\n foreach ($output as $line) {\n $parts = explode(\" \", $line);\n $this->pid[] = $parts[0];\n }\n }\n\n sleep(1);\n }\n }", "function synch($remote, $local)\n{\n\tscan();\n\t$ch = curl_init($remote.\"/myp/index.php?process=synchreq&remote=\".$local);\n curl_setopt($ch, CURLOPT_HEADER, 0);\n curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);\n $result = curl_exec($ch); \n curl_close($ch);\n\t$synch_data=json_decode($result);\n\t\n\t$pdata=json_decode(file_get_contents(\"../.mypfiles\", true));\n\tfclose($mypfiles);\n\t\n\t//create a log variables\n\t$remfiles=0;\n\t$copfiles=0;\n\t\t\n\tforeach($synch_data as $sd)\n\t{\n\t\t$existence=search_loc_index_stdcls($pdata, $sd->loc);\n\t\t\n\t\tif($existence)\n\t\t{\n\t\t\t$index=array_search($sd, $synch_data);\n\t\t\tif(($sd->flag==0) && ($pdata[$existence]->flag==1))\n\t\t\t{\n\t\t\t\tif(is_dir($sd->loc)) rmdir($sd->loc); //{ echo \"Hi\"; die(); }//exec(\"rm -rf \".$sd->loc);\n\t\t\t\telse unlink($sd->loc);\n\t\t\t\t$remfiles++;\n\t\t\t}\n\t\t\t//if exist then check file creation time. if file exists at remote server with different creation date then copy it here. File is newly created.\n\t\t\telseif($sd->flag!=0)\n\t\t\t{\n\t\t\t\tif((($sd->mtime - $pdata[$existence]->mtime)>1) && ($pdata[$existence]->type!='dir'))\n\t\t\t\t{\n\t\t\t\t\tunlink($sd->loc);\n\t\t\t\t\t$remfiles++;\n\t\t\t\t\t\n\t\t\t\t\t$copy[]=$sd->loc;\n\t\t\t\t\t$copfiles++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\t//add the file into copy list\n\t\t\tif(($sd->flag!=0) && (!file_exists($sd->loc))) \n\t\t\t{\n\t\t\t\t$copy[]=$sd->loc;\n\t\t\t\t$copfiles++;\n\t\t\t}\t\t\t\n\t\t}\t\n\t}\n\t\n\tif((isset($copy))&& (count($copy)>0))\n\t{\n\t\t//now sending a file copying request to remote server\n\t\t$copy=json_encode($copy);\n\t\t$url = $remote.\"/myp/?process=copyreq&remote=\".$local;\n\t\t\n\t\t$fields=array('copy'=>$copy, 'process'=>'copyreq'); //current server url should be passed to ensure security\n\t\tforeach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }\n\t\trtrim($fields_string, '&');\n\n\t\t//open connection\n\t\t$ch = curl_init($url);\n\t\tcurl_setopt($ch, CURLOPT_HEADER, 0);\n\t\tcurl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);\n\t\tcurl_setopt($ch,CURLOPT_POST, count($fields));\n\t\tcurl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string);\n\t\t$result = curl_exec($ch);\n\t\tcurl_close($ch);\n\t\t\n\t\t$file_to_dl=$remote.\"/myp/tmp/\".$result.\".zip\";\n\t\texec(\"wget -O tmp/\".$result.\".zip \".$file_to_dl);\t\t\n\t\t\n\t\t//ask remote server to delete it's temp zip file\n\t\t$chd = curl_init($remote.\"/myp/index.php?process=delreq&remote=\".$local.\"&file=\".$result);\n\t\tcurl_setopt($chd, CURLOPT_HEADER, 0);\n\t\tcurl_setopt($chd, CURLOPT_RETURNTRANSFER, 1);\n\t\tcurl_exec($chd);\n\t\tcurl_close($chd);\n\t\t\n\t\texec(\"unzip -B tmp/\".$result.\".zip -d ../\");\n\t\tunlink(\"tmp/\".$result.\".zip\");\n\t}\n\t\n\tif(!file_exists(\".myplog\"))\n\t{\n\t\tfopen(\".myplog\", \"w\");\n\t\t$break=\"\";\n\t}\n\telse $break=\"\\n\";\n\t\n\tif(($remfiles>0) || ($copfiles>0)) \n\t{\n\t\t$logs=file_get_contents(\".myplog\");\n\t\t$logs=$logs.$break.\"Time: \".date(\"Y-m-d H:i:s\").\" Node: \".$remote.\" Removed: \".$remfiles.\" Added: \".$copfiles;\n\t\tfile_put_contents(\".myplog\", $logs);\n\t}\n}", "public function buildDeb(ConsoleIO $io, $options = ['dev-build' => false])\n {\n $this->stopOnFail();\n\n $isDevBuild = (bool) $options['dev-build'];\n\n if (!$this->checkFpmIsInstalled()) {\n return 1;\n }\n\n $packageName = 'vysokeskoly-solr-feeder';\n $packageVersion = $this->assemblePackageVersion($isDevBuild);\n $versionIteration = $this->assembleVersionIteration();\n $composer = $this->parseComposer();\n\n $temporaryBuildDir = $this->_tmpDir();\n $buildRootDir = $temporaryBuildDir . '/root';\n $appInstallDir = $buildRootDir . '/' . self::INSTALL_DIR;\n\n // Create basic filesystem structure\n $this->taskFilesystemStack()\n ->mkdir($appInstallDir)\n ->mkdir($appInstallDir . '/bin')\n ->mkdir($appInstallDir . '/etc')\n ->mkdir($appInstallDir . '/var')\n ->run();\n\n // Generate postinst script\n $postinstResult = $this->taskPostinst($packageName, $appInstallDir, self::INSTALL_DIR)\n ->args([\n 'automat', // runtime files owner\n 'automat', // runtime files group\n ])\n ->run();\n\n $postinstPath = $postinstResult['path'];\n\n // Copy required directories\n foreach (['bin', 'src', 'vendor'] as $directoryToCopy) {\n $this->_copyDir(__DIR__ . '/' . $directoryToCopy, $appInstallDir . '/' . $directoryToCopy);\n }\n\n // Copy required files\n foreach (['bin/robo', 'composer.json', 'composer.lock', 'RoboFile.php'] as $fileToCopy) {\n $this->_copy(__DIR__ . '/' . $fileToCopy, $appInstallDir . '/' . $fileToCopy);\n }\n\n // Generate buildinfo.xml\n $this->taskBuildinfo($appInstallDir . '/buildinfo.xml')\n ->appName($packageName)\n ->version($packageVersion . '-' . $versionIteration)\n ->run();\n\n // Even when packages are installed using `composer install --no-dev`, they often contains unneeded files.\n $vendorDirectoriesToDelete = [\n 'lstrojny/functional-php/tests',\n 'mf/callback-parser/Tests',\n 'mf/collection-php/Tests',\n 'mf/type-validator/Tests',\n 'solarium/solarium/tests',\n ];\n\n // Clean unwanted vendor directories\n foreach ($vendorDirectoriesToDelete as $vendorDirectoryToDelete) {\n $this->_deleteDir($appInstallDir . '/vendor/' . $vendorDirectoryToDelete);\n }\n\n $this->taskFilesystemHelper()\n ->dir($appInstallDir)\n ->removeDirsRecursively('Tests', 'vendor/symfony')// Remove Tests files from Symfony itself\n ->run();\n\n $this->taskExec('fpm')\n ->args(['--description', $composer['description']])// description for `apt search`\n ->args(['-s', 'dir'])// source type\n ->args(['-t', 'deb'])// output type\n ->args(['--name', $packageName])// package name\n ->args(['--vendor', 'VysokeSkoly'])\n ->args(['--architecture', 'all'])\n ->args(['--version', $packageVersion])\n ->args(['--iteration', $versionIteration])\n ->args(['-C', $buildRootDir])// change directory to here before searching for files\n ->args(['--depends', 'php-common'])\n ->args(['--depends', 'php-cli'])\n ->args(['--after-install', $postinstPath])\n // Files placed in /etc wouldn't be overridden on package update without following flag:\n ->arg('--deb-no-default-config-files')\n ->arg('.')\n ->run();\n\n $io->success('Done');\n\n return 0;\n }", "protected function __construct() \n {\n // We want to our daemon to tick once every 1 second.\n $this->loop_interval = 1.00;\n\n // Set our Lock Provider\n $this->plugin('lock', new Core_Lock_File($this));\n $this->lock->daemon_name = __CLASS__;\n $this->lock->ttl = $this->loop_interval;\n $this->lock->path = '/var/run/';\n\n $this->plugin('ini', new Core_Plugin_Ini());\n $this->ini->filename = 'vigu.ini';\n\n parent::__construct();\n }", "public function build()\n {\n $this->taskMirrorDir([\n 'src/modules' => 'docroot/modules/custom',\n 'src/themes' => 'docroot/themes/custom',\n ])->run();\n $this->_copy('src/settings.php', 'docroot/sites/default/settings.php');\n $this->_touch(\".built\");\n return $this;\n }", "function openzwave_install() {\n\tif (config::byKey('jeeNetwork::mode') != 'slave') {\n\t\t$cron = cron::byClassAndFunction('openzwave', 'pull');\n\t\tif (!is_object($cron)) {\n\t\t\t$cron = new cron();\n\t\t\t$cron->setClass('openzwave');\n\t\t\t$cron->setFunction('pull');\n\t\t\t$cron->setEnable(1);\n\t\t\t$cron->setDeamon(1);\n\t\t\t$cron->setDeamonSleepTime(0.5);\n\t\t\t$cron->setTimeout(1440);\n\t\t\t$cron->setSchedule('* * * * *');\n\t\t\t$cron->save();\n\t\t}\n\t}\n}", "private function synchronize() {\n\t\t$response = $this->send(self::$synchronize_uri, self::SYNC_SIZE);\n\t\t$this->_set_sync($response);\n\t}", "public function beforeSyncing() {}", "function syncToAllHosts() {\n $execute = SYNC_COMMAND;\n exec($execute, $output, $retval);\n return implode(\"\\n\", $output);\n}", "function become_daemon()\n{\n GLOBAL $fh;\n\n\t//printLog($fh, \"pcntl_fork() in\");\n $pid = pcntl_fork();\n\t//printLog($fh, \"pcntl_fork() out\");\n\n if ($pid == -1)\n {\n /* fork failed */\n\t\t//printLog($fh, \"fork failure!\");\n exit();\n } elseif ($pid)\n {\n\t\t//printLog($fh, \"pid: \" . $pid);\n /* close the parent */\n exit();\n } else\n {\n /* child becomes our daemon */\n posix_setsid();\n chdir('/');\n umask(0);\n return posix_getpid();\n }\n\n\t//printLog($fh, \"become_daemon() fim\");\n}", "public function run()\n {\n $this->logRun();\n if (in_array('+', $this->config['mysqlbase'])) {\n $this->config['mysqlbase'] = $this->mysqlAllBases($this->mysql['host'], $this->mysql['user'], $this->mysql['pass']);\n }\n $this->mysqlDump($this->mysql['host'], $this->mysql['user'], $this->mysql['pass'], $this->config['filename'], $this->config['local'], $this->config['mysqlbase']);\n $this->deleteOld($this->config['true_filename'], $this->config['local'], $this->config['days']);\n $this->rsync($this->config['local'], $this->config['dstfolder']);\n $this->logEnd();\n }", "public function sync() {\n\t\t# First, set the content of the template with a view file\n\t\t\t$this->template->content = View::instance('v_google_sync');\n\n\t\t# Now set the <title> tag\n\t\t\t$this->template->title = \"Google Sync\"; \n\n\t\t\t$email = $this->user->email;\n\n\t\t# Pass data to the view\n\t\t\t$this->template->content->email = $email;\n\n \t\t$q = \"SELECT user_id\n \t\t FROM users\n \t\t WHERE email = '\".$this->user->email.\"'\";\n\t \n\t $user_id = DB::instance(DB_NAME)->select_field($q);\n\t \n\t # Pass data to the view\n\t\t\t$this->template->content->user_id = $user_id;\n\t \t\t\n\t\t# Render the view\n\t\t\techo $this->template;\n\n\t}", "public function run()\n {\n $this->buildPhpContainers();\n $this->buildNginxContainer();\n $this->buildDockerCompose();\n }", "public static function auth_ldap_sync_cron() {\n $auths = get_records_array('auth_instance', 'authname', 'ldap', 'id', 'id');\n if (!$auths) {\n return;\n }\n foreach ($auths as $auth) {\n /* @var $authobj AuthLdap */\n $authobj = AuthFactory::create($auth->id);\n // Each instance will decide for itself whether it should sync users and/or groups\n // User sync needs to be called before group sync in order for new users to wind\n // up in the correct groups\n $authobj->sync_users();\n $authobj->sync_groups();\n }\n }", "public function sync()\n {\n $this->log(sprintf('%s', __METHOD__), 'debug');\n\n $this->log('Playlist - Synchronizing files...', 'notice');\n\n Rsync::initialize(true, $this->card->getShare(), $this->tempFilesFromFilename);\n Rsync::execute(false);\n }", "function drush_file_sync($source, $destination) {\n\n $only_public = drush_get_option('only-public', FALSE);\n $only_private = drush_get_option('only-private', FALSE);\n\n if ($only_public && $only_private) {\n drush_log(dt('Only one of --only-public or --only-private can be set'), 'error');\n return false;\n }\n\n // drush_unset_option() is needed to prevent the options for file-sync getting\n // passed through to core-rsync.\n // core-rync loads the original command line options to pass to rsync, so some\n // additional context-hacking is needed.\n // see drush_core_rsync() and drush_get_original_cli_args_and_options().\n $args = &drush_get_context('DRUSH_COMMAND_ARGS', array());\n $original_args = $args;\n\n $command = drush_get_command();\n foreach (array_keys($command['options']) as $option) {\n drush_unset_option($option, 'cli');\n\n $arg_index = array_search('--' . $option, $args);\n if ($arg_index !== FALSE) {\n unset($args[$arg_index]);\n }\n }\n $args = array_values($args);\n\n $public_result = FALSE;\n if (!$only_private) {\n drush_log(dt('Syncing public files'), 'status');\n $public_result = _drush_file_sync_path_alias($source, $destination, '%files');\n }\n\n $private_result = FALSE;\n if (!$only_public) {\n drush_log(dt('Syncing private files'), 'status');\n $private_result = _drush_file_sync_path_alias($source, $destination, '%private', $only_private? 'error': 'warning');\n }\n\n // Restore the original arguments just to be safe.\n $args = $original_args;\n\n if (\n (!$only_private && !$public_result)\n ||\n ($only_private && !$private_result)\n ) {\n // If public transfer is attempted but fails, it's always an error.\n // If private transfer is attempted but fails, it's an error if only\n // transferring private files was attempted.\n drush_log(dt('Sync could not complete successfully'), 'error');\n }\n else if (!$only_public && !$only_private && !$private_result) {\n // A private file path may not be defined, so it's only a warning if the\n // private transfer could not be completed while attempting to transfer all\n // files.\n drush_log(dt('Sync partially completed'), 'warning');\n }\n else {\n drush_log(dt('Sync completed successfully'), 'success');\n }\n}", "public function run()\n {\n passthru('cd ' . realpath($this->basedir) . ' && git pull origin master && curl -sS https://getcomposer.org/installer | php && php composer.phar install && git remote update && cd -');\n }", "public function run()\n {\n factory('App\\Doctor', 2)->create();\n\n Doctor::first()->business_days()->sync([\n 1 => [\n 'start_at' => '10:00',\n 'end_at' => '20:00'\n ],\n 3 => [\n 'start_at' => '09:00',\n 'end_at' => '18:00'\n ],\n 5 => [\n 'start_at' => '12:00',\n 'end_at' => '16:00'\n ],\n ]);\n }", "function drush_make_process($directory) {\n // Set the temporary directory.\n make_tmp(TRUE, $directory);\n $projects = drush_get_option('projects', array());\n\n $manifest = drush_get_option('manifest', array());\n\n foreach ($projects as $project) {\n if ($instance = DrushMakeProject::getInstance($project['type'], $project)) {\n $instance->setManifest($manifest);\n $instance->make();\n }\n else {\n make_error('PROJECT-TYPE', dt('Non-existent project type %type on project %project.', array('%type' => $project['type'], '%project' => $project['name'])));\n }\n }\n}", "public function sync( $here = '.', $there = '/local/githubpages/gcal') {\n\t\tif ( $here != '.') chdir( $here); $here = array(); foreach ( flget( '.') as $f) if ( is_file( $f)) $here[ \"$f\"] = true; \n\t\tforeach ( $here as $f => $t) { $c = \"rsync -avz \" . strdblquote( $f) . \" $there/.\"; procpipe( $c); echo \"PUT $c\\n\"; }\n\t\tchdir( $there); foreach ( flget( '.') as $f) if ( is_file( \"$f\") && ! isset( $here[ \"$f\"])) { echo \"delete $there/$f\\n\"; $c = 'rm -Rf ' . strdblquote( $f); procpipe( $c); }\n\t\t`chmod -R 777 *`;\n\t}", "function Sync() {\r\n \tif (count($this->sync) == 0) {\r\n \t$this->RaiseError('No Sync Databases defined. Use AddSyncDatabase() to add Sync Databases.');\r\n }\r\n for ($i = 0; $i < count($this->sync); $i++) {\r\n \t$this->SyncDatabases($this->home, $this->sync[$i]);\r\n }\r\n\r\n return true;\r\n }", "public function daily_sync()\n {\n /** @var $helper Mailigen_Synchronizer_Helper_Data */\n $helper = Mage::helper('mailigen_synchronizer');\n if (!$helper->isEnabled()) {\n return \"Module is disabled\";\n }\n\n /**\n * Synchronize Newsletter\n */\n try {\n if ($helper->canAutoSyncNewsletter()) {\n /** @var $mailigen Mailigen_Synchronizer_Model_Mailigen */\n $mailigen = Mage::getModel('mailigen_synchronizer/mailigen');\n $mailigen->syncNewsletter();\n }\n } catch (Exception $e) {\n Mage::helper('mailigen_synchronizer/log')->logException($e);\n }\n\n /**\n * Synchronize Customers\n */\n try {\n if ($helper->canAutoSyncCustomers() || $helper->getManualSync()) {\n if ($helper->getManualSync()) {\n $helper->setManualSync(0);\n }\n\n /** @var $mailigen Mailigen_Synchronizer_Model_Mailigen */\n $mailigen = Mage::getModel('mailigen_synchronizer/mailigen');\n $mailigen->syncCustomers();\n }\n } catch (Exception $e) {\n Mage::helper('mailigen_synchronizer/log')->logException($e);\n }\n }", "function serverSync() {\n\n\t\t// get current players on the server ...\n\t\t$this->client->query('GetPlayerList', 100, 0);\n\t\t$response['playerlist'] = $this->client->getResponse();\n\n\t\t// get game version the server runs on ...\n\t\t$this->client->query('GetVersion');\n\t\t$response['version'] = $this->client->getResponse();\n\n\t\t$this->client->query('GetCurrentGameInfo');\n\t\t$response['gameinfo'] = $this->client->getResponse();\n\n\t\t$this->client->query('GetStatus');\n\t\t$response['status'] = $this->client->getResponse();\n\n\t\t// update player list ...\n\t\tif (!empty($response['playerlist'])) {\n\t\t\tforeach ($response['playerlist'] as $player) {\n\t\t\t \n\t\t\t\t// PRELOAD\n\t\t\t\t// create player object of every player response ...\n\t\t\t\t$player_item = new Player($player);\n\t\t\t\t$player_item->mistral['displayPlayerInfo']=true;\n\n\t\t\t\t// add player object to player list ...\n\t\t\t\t$this->server->players->addPlayer($player_item);\n\n\t\t\t\t// GET ALL INFOS LATER - wtf no wins \n//\t\t\t\t$this->addCall('GetPlayerInfo', array($player['Login']), '', 'initPlayer');\n\t\t\t \n\t\t\t\t// NO RASPWAY\n//\t\t\t\t$this->playerConnect(array($player['Login'], ''));\t\t\t\t\t// fake it into thinking it's a connecting player, it gets team & ladder info this way\n\t\t\t}\n\t\t}\n\n\t\t// get game ...\n\t\t$this->server->game = $response['version']['Name'];\n\n\t\t// get mode ...\n\t\t$this->server->gameinfo = new Gameinfo($response['gameinfo']);\n\n\t\t// get status ...\n\t\t$this->server->status = $response['getstatus']['Code'];\n\n\t\t// get trackdir\n\t\t$this->client->query('GetTracksDirectory');\n\t\t$this->server->trackdir = $this->client->getResponse();\n\t\t// throw new synchronisation event ...\n\t\t$this->releaseEvent('onSync', array());\n\t}", "public function sync()\n {\n $sql = null;\n $module = new \\ZPM\\Core\\Setup\\Schema();\n $modData = new \\ZPM\\Core\\Setup\\Info();\n\n $module->install();\n }", "public function run(): void\n {\n if (env('APP_ENV') === 'production') {\n return;\n }\n\n foreach (self::$subjects as $subjectInfo) {\n $subject = TestSubject::create(Arr::only($subjectInfo, ['name', 'uri_alias']));\n\n $subject->courses()->sync($subjectInfo['sync_courses']);\n $subject->departments()->sync($subjectInfo['sync_departments']);\n }\n }", "public function sync()\n {\n SyncServer::dispatch($this);\n }", "function become_daemon()\n{\n $pid = pcntl_fork();\n \n if ($pid == -1)\n {\n /* fork failed */\n echo \"fork failure!\\n\";\n exit();\n }elseif ($pid)\n {\n /* close the parent */\n exit();\n }else\n {\n /* child becomes our daemon */\n posix_setsid();\n chdir('/');\n umask(0);\n return posix_getpid();\n\n }\n}", "public function run()\n {\n // Include everything we will potentially run here.\n // To make sure that old code is executed for this instance.\n include_once 'Libs/FileSystem/FileSystem.inc';\n Channels::includeSystem('Patching');\n Channels::includeSystem('SystemConfig');\n\n if (Channels::systemExists('Log') === TRUE) {\n Channels::includeSystem('Log');\n }\n\n if (Channels::systemExists('SystemConfigSplashScreenWidget') === TRUE) {\n Channels::includeSystem('SystemConfigSplashScreenWidget');\n }\n\n // Let it get the up-to-date Bugzilla login info and update the file.\n if (Channels::systemExists('Bugzilla') === TRUE) {\n Channels::includeSystem('Bugzilla');\n Bugzilla::writeBugzillaLoginInfo();\n }\n\n // Find the first scheduled patch and apply it.\n $config = Patching::getPatchingConfig();\n $patches = Patching::getPendingPatches();\n $info = Patching::getPatchingInfo();\n $oldRev = $config['revision'];\n $reboot = FALSE;\n if (empty($patches) === FALSE) {\n $name = array_shift($patches);\n $parts = explode('_', $name);\n $newRev = $parts[2];\n $status = self::applyPatch($name);\n if ($status === TRUE) {\n // Apply ok, archive it and notify central server.\n Patching::archivePatch($name);\n Patching::wsNotifyApplied($newRev, $oldRev);\n foreach ($info as $i) {\n if ($i['name'] === $name) {\n if (isset($i['reboot']) === TRUE) {\n if ($i['reboot'] === TRUE) {\n // Need to issue a system reboot command.\n $reboot = TRUE;\n break;\n }\n }\n }\n }\n\n // Update the patching config.\n $config['revision'] = $newRev;\n $config['last_updated'] = time();\n } else {\n // Apply fail, unschedule all pending patches.\n $pendingPatches = Patching::getPendingPatches();\n foreach ($pendingPatches as $p) {\n Patching::schedulePatch($p, NULL);\n }\n\n // Send error email and notify central server.\n Patching::sendInternalErrorMessage('ERR_PATCH_FAILED', $name);\n Patching::wsNotifyApplied($newRev, $oldRev, 'Failed to apply '.$name);\n }//end if\n } else {\n // Ask the central server for new updates, if any.\n $now = time();\n if ($now > ($config['last_checked'] + $config['check_interval'])) {\n Patching::wsCheckForUpdates();\n $config['last_checked'] = time();\n SystemConfig::setConfig('Patching', $config);\n }\n }//end if\n\n // No more pending patch, turn off the schedule toggle.\n $pendingPatches = Patching::getPendingPatches();\n if (empty($pendingPatches) === TRUE) {\n $config['schedule'] = FALSE;\n }\n\n SystemConfig::setConfig('Patching', $config);\n // Tells debian where to get operating system updates from.\n Channels::includeSystem('SquizSuite');\n $currProduct = SquizSuite::getProduct();\n $status = Patching::wsReleaseStatus();\n if ($status === 'GA') {\n @FileSystem::filePutContents('/etc/apt/sources.list', 'deb http://aptrepo-stable.squiz.net/ stable main');\n } else {\n @FileSystem::filePutContents('/etc/apt/sources.list', 'deb http://aptrepo-beta.squiz.net/ stable main');\n }\n\n // Issues a system reboot command if required.\n if ($reboot === TRUE) {\n exec('/sbin/reboot');\n }\n\n }", "public function check_sync()\n {\n }", "public static function daemonize()\n {\n $pid = \\pcntl_fork();\n if ($pid == -1) {\n throw new \\RuntimeException(\"Failed to pcntl_fork()!\");\n } else if ($pid) { // parent process\n exit(0);\n } else { // child\n $sid = \\posix_setsid();\n\n \\fclose(STDIN);\n \\fclose(STDOUT);\n \\fclose(STDERR);\n \\chdir('/');\n\n return \\getmypid();\n }\n }", "public function run()\n {\n $repo1 = Repo::create([\n 'name' => 'johnbolton/exercitationem',\n 'url' => 'https://github.com/johnbolton/exercitationem',\n 'event_id' => 1,\n ]);\n\n $repo2 = Repo::create([\n 'name' => 'pestrada/voluptatem',\n 'url' => 'https://github.com/pestrada/voluptatem',\n 'event_id' => 2,\n ]);\n }", "public function start()\n\t{\n\t\t// Check for a valid token. If invalid, send a 403 with the error message.\n\t\tJSession::checkToken('request') or $this->sendResponse(new Exception(JText::_('JINVALID_TOKEN'), 403));\n\n\t\t// Put in a buffer to silence noise.\n\t\tob_start();\n\n\t\t// Initiate an empty state\n\t\tCmcSyncerState::resetState();\n\t\t$state = CmcSyncerState::getState();\n\n\t\t$input = JFactory::getApplication()->input;\n\t\t$lists = $input->getString('lists');\n\n\t\t$chimp = new CmcHelperChimp;\n\t\t$listStats = $chimp->lists($lists);\n\t\t$names = array();\n\n\t\tforeach ($listStats as $key => $list)\n\t\t{\n\t\t\t$state->lists[$key] = array();\n\t\t\t$state->lists[$key]['mc_id'] = $list['id'];\n\t\t\t$state->lists[$key]['name'] = $list['name'];\n\t\t\t$state->lists[$key]['toSync'] = $list['stats']['member_count'];\n\n\t\t\t$names[] = $list['name'];\n\n\t\t\t// Delete the old list info\n\t\t\tCmcHelperList::delete($list['id']);\n\n\t\t\t// Add the new list info\n\t\t\t$listModel = $this->getModel('List', 'cmcModel');\n\t\t\t$listModel->save($list);\n\n\t\t\t// Add the joomla list id\n\t\t\t$state->lists[$key]['id'] = $listModel->getState('list.id');\n\n\t\t\t// Delete users in that list\n\t\t\tCmcHelperUsers::delete($list['id']);\n\t\t}\n\n\n\t\t$state->header = JText::sprintf('COM_CMC_LISTS_TO_SYNC', count($state->lists));\n\t\t$state->message = JText::sprintf('COM_CMC_LISTS_TO_SYNC_DESC', '\"' . implode('\", \"', $names) . '\"', $state->lists[0]['name']);\n\n\t\t$state->offset = 0;\n\n\t\tCmcSyncerState::setState($state);\n\n\t\t$this->sendResponse($state);\n\t}", "public function run()\n {\n DLocalConfig::create([\n 'name' => 'api.andeanwide.com',\n 'url' => 'https://dpayout.andeanwide.com/',\n 'grant_type' => 'client_credentials'\n ]);\n }", "public function afterSyncing() {}", "function wg_syncconf($tunnel) {\n\tglobal $wgg;\n\n\t// Assume we have an interface first\n\t$wg_ifname = $tunnel;\n\n\t// Looks like we have a tunnel structure\n\tif (is_array($tunnel) && isset($tunnel['name'])) {\n\n\t\t// Transform to an interface name\n\t\t$wg_ifname = $tunnel['name'];\n\n\t}\n\n\t// Escape the inner arguments\n\t$wg_ifname = escapeshellarg($wg_ifname);\n\n\t// Pass the stripped configuration to wg(8)\n\t$syncconf_command =\"{$wgg['wg']} syncconf {$wg_ifname} <({$wgg['wg_quick']} strip {$wg_ifname})\";\n\n\t// Escape the outer arguments\n\t$syncconf_command = escapeshellarg($syncconf_command);\n\n\texec(\"{$wgg['bash']} -c {$syncconf_command}\");\n\n}", "protected function syncSharedFolders()\n\t{\n\t\t$shared = (array) $this->rocketeer->getOption('remote.shared');\n\t\tforeach ($shared as $file) {\n\t\t\t$this->share($file);\n\t\t}\n\t}", "public function manualSync()\n {\n // Only run Auto Sync Jobs\n \n $job = Mage::getModel('mailup/job');\n /* @var $job MailUp_MailUpSync_Model_Job */\n \n foreach($job->fetchManualSyncQueuedJobsCollection() as $job) {\n \n }\n }", "function pico_sync_all($mydirname)\n{\n\t$db = XoopsDatabaseFactory::getDatabaseConnection();\n\n\t$module_handler = xoops_gethandler('module');\n\t$module = &$module_handler->getByDirname($mydirname);\n\t$config_handler = xoops_gethandler('config');\n\t$configs = $config_handler->getConfigList($module->mid());\n\n\t// sync contents <- content_votes\n\t$result = $db->query('SELECT content_id FROM ' . $db->prefix($mydirname . '_contents'));\n\twhile (list($content_id) = $db->fetchRow($result)) {\n\t\tpico_sync_content_votes($mydirname, (int)$content_id);\n\t\t//pico_sync_content( $mydirname , intval( $content_id ) ) ;\n\t}\n\n\t// sync tags\n\tpico_sync_tags($mydirname);\n\n\t// d3forum comment integration\n\tif (!empty($configs['comment_dirname']) && $configs['comment_forum_id'] > 0) {\n\t\t$target_module = &$module_handler->getByDirname($configs['comment_dirname']);\n\t\tif (is_object($target_module)) {\n\t\t\t$target_dirname = $target_module->getVar('dirname');\n\t\t\t$forum_id = (int)$configs['comment_forum_id'];\n\t\t\t$result = $db->query('SELECT topic_external_link_id,COUNT(*) FROM ' . $db->prefix($target_dirname . '_topics') . \" WHERE topic_external_link_id>0 AND forum_id=$forum_id AND ! topic_invisible GROUP BY topic_external_link_id\");\n\t\t\twhile (list($content_id, $comments_count) = $db->fetchRow($result)) {\n\t\t\t\t$db->queryF('UPDATE ' . $db->prefix($mydirname . '_contents') . \" SET comments_count=$comments_count WHERE content_id=$content_id\");\n\t\t\t}\n\t\t}\n\t}\n\n\t// fix null and '' confusion\n\t$db->queryF('UPDATE ' . $db->prefix($mydirname . '_categories') . \" SET cat_vpath=null WHERE cat_vpath=''\");\n\t$db->queryF('UPDATE ' . $db->prefix($mydirname . '_contents') . \" SET vpath=null WHERE vpath=''\");\n\n\t// serialize_type conversion from PHP built-in serialize() to var_export()\n\tpico_convert_serialized_data($mydirname);\n\n\t// sync category's tree\n\tpico_sync_cattree($mydirname);\n}", "private function githubSyncProcess()\n\t{\n\n\t\t// Delete any existing file.\n\t\tif(file_exists(e_TEMP.\"e107-master.zip\"))\n\t\t{\n\t\t\tunlink(e_TEMP.\"e107-master.zip\");\n\t\t}\n\n\t\t$result = e107::getFile()->getRemoteFile('https://codeload.github.com/e107inc/e107/zip/master', 'e107-master.zip', 'temp');\n\n\t\tif($result == false)\n\t\t{\n\t\t\te107::getMessage()->addError( DBLAN_118 );\n\t\t}\n\n\n\t\t$localfile = 'e107-master.zip';\n\n\t\tchmod(e_TEMP.$localfile, 0755);\n\t\trequire_once(e_HANDLER.\"pclzip.lib.php\");\n\n//\t$base = realpath(dirname(__FILE__));\n\n\n\t\t$newFolders = array(\n\t\t\t'e107-master/e107_admin/' => e_BASE.e107::getFolder('ADMIN'),\n\t\t\t'e107-master/e107_core/' => e_BASE.e107::getFolder('CORE'),\n\t\t\t'e107-master/e107_docs/' => e_BASE.e107::getFolder('DOCS'),\n\t\t\t'e107-master/e107_handlers/' => e_BASE.e107::getFolder('HANDLERS'),\n\t\t\t'e107-master/e107_images/' => e_BASE.e107::getFolder('IMAGES'),\n\t\t\t'e107-master/e107_languages/' => e_BASE.e107::getFolder('LANGUAGES'),\n\t\t\t'e107-master/e107_media/' => e_BASE.e107::getFolder('MEDIA'),\n\t\t\t'e107-master/e107_plugins/' => e_BASE.e107::getFolder('PLUGINS'),\n\t\t\t'e107-master/e107_system/' => e_BASE.e107::getFolder('SYSTEM'),\n\t\t\t'e107-master/e107_themes/' => e_BASE.e107::getFolder('THEMES'),\n\t\t\t'e107-master/e107_web/' => e_BASE.e107::getFolder('WEB'),\n\t\t\t'e107-master/' => e_BASE\n\t\t);\n\n\t\t$srch = array_keys($newFolders);\n\t\t$repl = array_values($newFolders);\n\n\t\t$archive \t= new PclZip(e_TEMP.$localfile);\n\t\t$unarc \t\t= ($fileList = $archive -> extract(PCLZIP_OPT_PATH, e_TEMP, PCLZIP_OPT_SET_CHMOD, 0755)); // Store in TEMP first.\n\n\t\t$error = array();\n\t\t$success = array();\n\t\t$skipped = array();\n//\tprint_a($unarc);\n\n\n\t\t$excludes = array('e107-master/','e107-master/install.php','e107-master/favicon.ico');\n\n\t\tforeach($unarc as $k=>$v)\n\t\t{\n\t\t\tif(in_array($v['stored_filename'],$excludes))\n\t\t\t{\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t$oldPath = $v['filename'];\n\t\t\t$newPath = str_replace($srch,$repl, $v['stored_filename']);\n\n\t\t\t$message = e107::getParser()->lanVars(DBLAN_121, array('x'=>$oldPath, 'y'=>$newPath));\n\n\t\t\tif($v['folder'] ==1 && is_dir($newPath))\n\t\t\t{\n\t\t\t\t// $skipped[] = $newPath. \" (already exists)\";\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif(!rename($oldPath,$newPath))\n\t\t\t{\n\t\t\t\t$error[] = $message;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$success[] = $message;\n\t\t\t}\n\n\n\t\t\t//\techo $message.\"<br />\";\n\n\t\t}\n\n\t\tif(!empty($success))\n\t\t{\n\t\t\te107::getMessage()->addSuccess(print_a($success,true));\n\t\t}\n\n\t\tif(!empty($skipped))\n\t\t{\n\t\t\te107::getMessage()->setTitle(\"Skipped\",E_MESSAGE_INFO)->addInfo(print_a($skipped,true));\n\t\t}\n\n\t\tif(!empty($error))\n\t\t{\n\t\t\te107::getMessage()->addError(print_a($error,true));\n\t\t}\n\n\n\n\n\t\te107::getRender()->tablerender(DBLAN_10.SEP.DBLAN_112, e107::getMessage()->render());\n\n\t}", "public function produceSyncJob()\n {\n for ($i = 0; $i < 5; $i++) {\n $result = $this->client->doHigh($this->server->getSyncQueue(), $this->generateWorkload(3));\n echo \"*** Result is: \" . $result . PHP_EOL;\n }\n }", "public function run()\n {\n // Save the current working directory\n $this->savedWorkingDirectory = getcwd();\n foreach ($this->dirs as $dir) {\n $this->fs->mkdir($dir);\n $this->printTaskInfo(\"Created {dir}...\", ['dir' => $dir]);\n\n // Change the current working directory, if requested\n if ($this->cwd) {\n chdir($dir);\n }\n }\n\n return Result::success($this, '', ['path' => $this->getPath()]);\n }", "public function make()\n {\n // prepare configurations to save\n /** @var array $cfg */\n $cfg = App::$Properties->getAll('default');\n $this->before();\n $cfg['baseDomain'] = $this->baseDomain;\n $cfg['database'] = $this->db;\n $cfg['singleLanguage'] = $this->singleLanguage;\n $cfg['multiLanguage'] = (bool)$this->multiLanguage;\n $cfg['debug']['cookie']['key'] = 'fdebug_' . Crypt::randomString(mt_rand(4, 16));\n $cfg['debug']['cookie']['value'] = Crypt::randomString(mt_rand(32, 128));\n $cfg['mail'] = $this->mail;\n\n // initialize migrations table\n App::$Database->getConnection('install')->getSchemaBuilder()->create('migrations', function ($table) {\n $table->increments('id');\n $table->string('migration', 128)->unique();\n $table->timestamps();\n });\n\n // import migrations\n $manager = new MigrationsManager(null, 'install');\n $search = $manager->search(null, false);\n $manager->makeUp($search);\n\n // insert admin user\n $user = new User();\n $user->setConnection('install');\n $user->email = $this->user['email'];\n $user->role_id = 4;\n $user->password = Crypt::passwordHash($this->user['password']);\n $user->save();\n\n $profile = new Profile();\n $profile->setConnection('install');\n $profile->user_id = $user->id;\n $profile->save();\n\n // set installation version\n $system = new System();\n $system->setConnection('install');\n $system->var = 'version';\n $system->data = Version::VERSION;\n $system->save();\n\n // write config data\n App::$Properties->writeConfig('default', $cfg);\n // make routing configs based on preset property\n $routing = [];\n switch ($this->mainpage) {\n case 'news':\n $routing = [\n 'Alias' => [\n 'Front' => [\n '/' => '/content/list/news',\n '/about' => '/content/read/page/about-page'\n ]\n ]\n ];\n break;\n case 'about':\n $routing = [\n 'Alias' => [\n 'Front' => [\n '/' => '/content/read/page/about-page'\n ]\n ]\n ];\n break;\n }\n // write routing configurations\n App::$Properties->writeConfig('routing', $routing);\n // write installer lock\n File::write('/Private/Install/install.lock', 'Installation is locked!');\n }", "public function set_sync($sync) {\n\t\t$this->sync = $sync;\n\t}", "protected function syncSharedFolders()\n\t{\n\t\t$currentRelease = $this->releasesManager->getCurrentReleasePath();\n\t\tforeach ($this->rocketeer->getShared() as $file) {\n\t\t\t$this->share($currentRelease.'/'.$file);\n\t\t}\n\t}", "public function sync($args)\n {\n $ztable = DBUtil::getTables();\n switch ($args['type'])\n {\n case 'forum':\n $f['forum_id'] = $args['id'];\n $f['forum_last_post_id'] = DBUtil::selectFieldMax('dizkus_posts', 'post_id', 'MAX', 'forum_id='.DataUtil::formatForStore($args['id']));\n $f['forum_posts'] = DBUtil::selectObjectCount('dizkus_posts', 'forum_id='.DataUtil::formatForStore($args['id']));\n $f['forum_topics'] = DBUtil::selectObjectCount('dizkus_topics', 'forum_id='.DataUtil::formatForStore($args['id']));\n \n DBUtil::updateObject($f, 'dizkus_forums', null, 'forum_id');\n break;\n case 'topic':\n $t['topic_id'] = $args['id'];\n $t['topic_last_post_id'] = DBUtil::selectFieldMax('dizkus_posts', 'post_id', 'MAX', 'topic_id='.DataUtil::formatForStore($args['id']));\n $t['topic_replies'] = DBUtil::selectObjectCount('dizkus_posts', 'topic_id='.DataUtil::formatForStore($args['id'])) -1;\n \n DBUtil::updateObject($t, 'dizkus_topics', null, 'topic_id');\n break;\n case 'all forums':\n $forums = $this->readforums();\n foreach ($forums as $forum) {\n $this->sync(array('id' => $forum['forum_id'], 'type' => 'forum'));\n }\n break;\n \n case 'all topics':\n $topics = DBUtil::selectObjectArray('dizkus_topics');\n foreach ($topics as $topic) {\n $this->sync(array('id' => $topic['topic_id'], 'type' => 'topic'));\n }\n break;\n \n case 'all posts':\n ModUtil::dbInfoLoad('Settings');\n $tables = DBUtil::getTables();\n \n $objtable = $tables['objectdata_attributes'];\n $objcolumn = $tables['objectdata_attributes_column'];\n $poststable = $tables['dizkus_posts'];\n $postscolumn = $tables['dizkus_posts_column'];\n \n // drop all attributes 'dizkus_user_posts'\n DBUtil::deleteWhere('objectdata_attributes', $objcolumn['attribute_name'] . \"='dizkus_user_posts'\");\n \n // re-insert from scratch\n $timestring = DataUtil::formatForStore(date('Y-m-d H:i:s'));\n $this_uid = DataUtil::formatForStore(UserUtil::getVar('uid'));\n $sql = \"INSERT INTO \" . $objtable . \" (\" . $objcolumn['attribute_name'] . \",\n \" . $objcolumn['object_type'] . \",\n \" . $objcolumn['object_id'] . \",\n \" . $objcolumn['value'] . \",\n \" . $objcolumn['cr_date'] . \",\n \" . $objcolumn['cr_uid'] . \",\n \" . $objcolumn['lu_date'] . \",\n \" . $objcolumn['lu_uid'] . \")\n SELECT 'dizkus_users_posts',\n 'users',\n \" . $postscolumn['poster_id'] . \",\n COUNT(\" . $postscolumn['poster_id'] . \") as total_posts,\n '\" . $timestring . \"',\n \" . $this_uid . \",\n '\" . $timestring . \"',\n \" . $this_uid . \"\n FROM \" . $poststable . \"\n GROUP BY \" . $postscolumn['poster_id'];\n DBUtil::executeSQL($sql);\n break;\n default:\n return LogUtil::registerError('Error! Bad parameter in synchronisation:', null, ModUtil::url('Dizkus', 'admin', 'main'));\n }\n \n return true;\n }", "public function main()\n\t{\n\t\t$this->loadConfig();\n\t\t$this->validateProject();\n\t\t$this->cleanConfig();\n\t\t$this->installDependencies();\n\t\t$this->createAutoload();\n\t\t$this->finish();\n\t}", "function setSyncUrl()\n {\n }", "public function run()\n {\n factory(App\\GuideSadt::class, 62)->create()->each(function ($guide) {\n $guide->procedures()->sync([\n 4 => [\n 'execution_date' => now()->format('Y-m-d'),\n 'request_amount' => 1,\n 'permission_amount' => 1,\n 'unity_price' => 24.02\n ]\n ]);\n });\n }", "function tcupdate(){\n $settings = $this->get_settings();\n exec( $settings['CMD_SUDO'].' /usr/local/pia/include/transmission-config.sh');\n}", "public function run()\n {\n //['name','code','status',[hd/sd]]\n\n\n {\n $this->createChannel();\n }\n }", "public function sync( $args = array(), $assoc_args = array() ) {\n\n\t\t\t// Start Sync.\n\t\t\tWP_CLI::line( 'Sync Started' );\n\n\t\t\t// Check sync status.\n\t\t\tAst_Block_Templates_Sync_Library::get_instance()->check_sync_status();\n\n\t\t\t// Get Blocks Count.\n\t\t\t$total_blocks_requests = Ast_Block_Templates_Sync_Library::get_instance()->get_total_blocks_requests();\n\t\t\tif ( $total_blocks_requests ) {\n\t\t\t\tfor ( $page_no = 1; $page_no <= $total_blocks_requests; $page_no++ ) {\n\n\t\t\t\t\t// Import Blocks.\n\t\t\t\t\tAst_Block_Templates_Sync_Library::get_instance()->import_blocks( $page_no );\n\t\t\t\t\tWP_CLI::line( 'BLOCK: Importing blocks from page ' . $page_no );\n\t\t\t\t}\n\t\t\t\tWP_CLI::line( 'BLOCK: Importd blocks from ' . $total_blocks_requests . ' pages.' );\n\t\t\t} else {\n\t\t\t\tWP_CLI::line( 'BLOCK: No block requests found' );\n\t\t\t}\n\n\t\t\t// Get Sites Count.\n\t\t\t$total_sites_requests = Ast_Block_Templates_Sync_Library::get_instance()->get_total_sites_count();\n\t\t\tif ( $total_sites_requests ) {\n\t\t\t\tfor ( $page_no = 1; $page_no <= $total_sites_requests; $page_no++ ) {\n\n\t\t\t\t\t// Import Sites.\n\t\t\t\t\tAst_Block_Templates_Sync_Library::get_instance()->import_sites( $page_no );\n\t\t\t\t\tWP_CLI::line( 'SITE: Importing sites from page ' . $page_no );\n\t\t\t\t}\n\t\t\t\tWP_CLI::line( 'SITE: Importd sites from ' . $total_sites_requests . ' pages.' );\n\t\t\t} else {\n\t\t\t\tWP_CLI::line( 'SITE: No sites requests found' );\n\t\t\t}\n\n\t\t\t// Sync Complete.\n\t\t\tAst_Block_Templates_Sync_Library::get_instance()->update_library_complete();\n\n\t\t\t// Start Sync.\n\t\t\tWP_CLI::line( 'Sync Completed' );\n\t\t}", "function backup_install_command() {\n\tsafe_mkdir(\"/root/backup/\");\n\tbackup_sync_package();\n}", "function profile_sync_init() {\n\t\t\n\telgg_extend_view('css/admin', 'css/profile_sync/admin');\n\t\n\t// register ajax views\n\telgg_register_ajax_view('profile_sync/forms/datasource');\n\telgg_register_ajax_view('profile_sync/forms/sync_config');\n\telgg_register_ajax_view('profile_sync/sync_logs');\n\telgg_register_ajax_view('profile_sync/view_log');\n\telgg_register_ajax_view('profile_sync/sync_config/run');\n\t\n\telgg_register_admin_menu_item('configure', 'profile_sync', 'configure_utilities');\n\t\n\t// register hooks\n\telgg_register_plugin_hook_handler('register', 'menu:entity', '\\ColdTrick\\ProfileSync\\EntityMenu::addDataSourceMenus');\n\telgg_register_plugin_hook_handler('register', 'menu:entity', '\\ColdTrick\\ProfileSync\\EntityMenu::addSyncConfigMenus');\n\telgg_register_plugin_hook_handler('cron', 'all', '\\ColdTrick\\ProfileSync\\Cron::runSyncs');\n\telgg_register_plugin_hook_handler('permissions_check:comment', 'object', '\\ColdTrick\\ProfileSync\\Comments::disallowComments');\n\t\n\t// register actions\n\telgg_register_action('profile_sync/datasource/edit', dirname(__FILE__) . '/actions/datasource/edit.php', 'admin');\n\telgg_register_action('profile_sync/datasource/delete', elgg_get_root_path() . '/actions/entities/delete.php', 'admin');\n\telgg_register_action('profile_sync/sync_config', dirname(__FILE__) . '/actions/sync_config/edit.php', 'admin');\n\telgg_register_action('profile_sync/sync_config/delete', elgg_get_root_path() . '/actions/entities/delete.php', 'admin');\n\telgg_register_action('profile_sync/sync_config/run', dirname(__FILE__) . '/actions/sync_config/run.php', 'admin');\n\t\n}", "public function execute()\n {\n // and create a new one.\n\n $this->cleanLassoDirectory();\n\n $this->console->info('⏳ Reading Bundle meta file...');\n\n $bundle_info = $this->retrieveLatestBundleMeta();\n\n if (!isset($bundle_info['file']) || !isset($bundle_info['checksum'])) {\n $this->rollBack(\n FetchCommandFailed::because('The bundle info was missing the required data.')\n );\n }\n\n $this->console->info('⏳ Downloading bundle...');\n\n // Grab the Zip.\n $bundle = $this->retrieveBundle($bundle_info['file'], $bundle_info['checksum']);\n\n $this->console->info('✅ Successfully downloaded bundle.');\n\n // Now it's time to roll. We should make a backup, so in case\n // anything goes wrong - we can roll back easily.\n\n $this->console->info('⏳ Updating assets...');\n\n try {\n if ($this->backup_service->startBackup()) {\n $public_path = rtrim(config('lasso.public_path'), '/');\n\n // Now it's time to unzip!\n (new ZipExtractor($bundle))\n ->extractTo(base_path('.lasso/bundle'));\n\n $files = (new FileLister(base_path('.lasso/bundle')))\n ->getFinder();\n\n foreach ($files as $file) {\n $source = $file->getRealPath();\n $destination = sprintf('%s/%s', $public_path, $file->getRelativePathName());\n $directory = sprintf('%s/%s', $public_path, $file->getRelativePath());\n\n $this->local_filesystem\n ->ensureDirectoryExists($directory);\n\n $this->local_filesystem\n ->copy($source, $destination);\n }\n }\n } catch (\\Exception $ex) {\n // If anything goes wrong inside this try block,\n // we will \"roll back\" which means we will restore\n // our backup.\n\n $this->rollBack($ex);\n }\n\n $bundle_path = DirectoryHelper::getFileDirectory($bundle_info['file']);\n VersioningService::appendNewVersion($bundle_path);\n\n // If it's all successful, it's time to clean everything up.\n $this->deleteLassoDirectory();\n\n // Done. Send webhooks\n $this->sendWebhooks();\n }", "public function run() {\n $this->cleanupFilesystem();\n $this->downloadCommunityRegistry();\n $this->downloadAllCommunityDefinitions();\n $this->saveCommunicationDetails();\n }", "function drush_make($makefile = NULL, $build_path = NULL) {\n // If --version option is supplied, print it and bail.\n if (drush_get_option('version', FALSE)) {\n drush_print(dt('Drush make API version !version', array('!version' => MAKE_API)));\n drush_print_pipe(MAKE_API);\n return;\n }\n\n if (!($build_path = make_build_path($build_path))) {\n return FALSE;\n }\n\n $info = make_parse_info_file($makefile);\n\n // Support making just a portion of a make file.\n $include_only = array(\n 'projects' => array_filter(drush_get_option_list('projects')),\n 'libraries' => array_filter(drush_get_option_list('libraries')),\n );\n $info = make_prune_info_file($info, $include_only);\n\n if ($info === FALSE || ($info = make_validate_info_file($info)) === FALSE) {\n return FALSE;\n }\n\n drush_log(dt('Beginning to build !makefile.', array('!makefile' => $makefile)), 'ok');\n\n $make_dir = realpath(dirname($makefile));\n $core_version = str_replace('.x', '', $info['core'][0]);\n $sitewide = drush_drupal_sitewide_directory($core_version);\n if (make_projects(FALSE, drush_get_option('contrib-destination', $sitewide), $info, $build_path, $make_dir)) {\n make_libraries(drush_get_option('contrib-destination', $sitewide), $info, $build_path, $make_dir);\n\n if (drush_get_option('prepare-install')) {\n make_prepare_install($build_path);\n }\n }\n return $info;\n}", "public function run()\n {\n $client=new ClientSetting;\n $client->client_name='app1';\n $client->client_token='123456';\n $client->client_service='helpdesk';\n $client->client_db_connection='mysql';\n $client->client_db_driver='mysql';\n $client->client_db_host='127.0.0.1';\n $client->client_db_port='3306';\n $client->client_db_database='helpdesk';\n $client->client_db_username='forethought';\n $client->client_db_password='123456';\n $client->client_db_prefix='';\n $client->save();\n // $client->client_='';\n \n\n // $client->secondary_logo_url='www.Mastechsecondrylogo.com';\n // $client->mnemonic_url='www.mnemonic_url.com';\n // $client->logo_usage='The Mastech Digital Logo is primary symbol which represents the Mastech Digital Brand and its subdiaries. The logotype is stylized to represent our modern take on the rapidly-evolving digital landscape.';\n // $logos->save();\n\n \n \n }", "function migrate_govcms_drush_command() {\n $items = [];\n\n $items['migrate-govcms-migrate-build'] = [\n 'description' => 'Creates the WordPress migrations',\n 'examples' => array(\n 'migrate-govcms-migrate-build' => 'Creates the WordPress migrations',\n ),\n 'drupal dependencies' => array('migrate_govcms'),\n 'aliases' => array('mgmb'),\n ];\n\n return $items;\n}", "public function run() {\n \n // Require the base class\n $this->load->file(APPPATH . '/base/main.php');\n\n // List all user's apps\n foreach (glob(APPPATH . 'base/user/apps/collection/*', GLOB_ONLYDIR) as $directory) {\n\n // Get the directory's name\n $app = trim(basename($directory) . PHP_EOL);\n\n // Verify if the app is enabled\n if (!get_option('app_' . $app . '_enable')) {\n continue;\n }\n\n // Create an array\n $array = array(\n 'MidrubBase',\n 'User',\n 'Apps',\n 'Collection',\n ucfirst($app),\n 'Main'\n );\n\n // Implode the array above\n $cl = implode('\\\\', $array);\n\n // Run cron job commands\n (new $cl())->cron_jobs();\n }\n \n // Prepare allowed files\n $allowed_files = array(\n 'cron.php',\n 'index.php',\n 'ipn-listener.php',\n 'update.php'\n );\n \n // List all files\n foreach (glob(FCPATH . '/*.php') as $filename) {\n \n $name = str_replace(FCPATH . '/', '', $filename);\n\n if ( !in_array($name, $allowed_files) ) {\n \n $msg = 'Was detected and deleted the file ' . $filename . '. Please contact support if you don\\'t know this file.';\n \n $this->send_warning_message($msg);\n unlink($filename);\n \n } else {\n \n if ( $this->check_for_malware($filename) ) {\n \n $msg = 'Was detected malware in the file ' . $filename . ' and was deleted.';\n\n $this->send_warning_message($msg);\n unlink($filename);\n \n }\n \n }\n \n }\n \n $extensions = array(\n '.php3',\n '.php4',\n '.php5',\n '.php7',\n '.phtml',\n '.pht'\n );\n\n foreach ( $extensions as $ext ) {\n $this->delete_files_by_extension(FCPATH, $ext); \n }\n \n $extensions[] = '.php';\n \n foreach ( $extensions as $ext ) {\n $this->delete_files_by_extension(FCPATH . 'assets', $ext); \n }\n \n $this->check_for_non_midrub_files(FCPATH . 'assets');\n \n }", "function semirand_build($action, $settings) {\n\t\tglobal $config;\n\n\t\tif ($action !== 'all' && $action !== 'post' && $action !== 'post-thread' &&\n\t\t\t$action !== 'post-delete')\n\t\t{\n\t\t\treturn;\n\t\t}\n\n\t\tif ($config['smart_build']) {\n\t\t\tfile_unlink($settings['uri'] . '/index.html');\n\t\t} else {\n\t\t\t$semirand = new semirand($settings);\n\n\t\t\t// Copy the generated board HTML to its place\n\t\t\tfile_write($settings['uri'] . '/index.html', $semirand->build());\n\t\t\tfile_write($settings['uri'] . '/semirand.js',\n\t\t\t\tElement('themes/semirand/semirand.js', []));\n\t\t}\n\t}", "public function sync($directory, $clean_up_hours = 2) {\n\t\t$directory .= '/IDR' . $this->radar_id;\n\t\tif (!file_exists($directory)) {\n\t\t\tmkdir($directory, 0755, true);\n\t\t}\n\t\t$connection = new \\Touki\\FTP\\Connection\\AnonymousConnection($this->host, $this->port, $this->timeout, $this->passive);\n\t\t$connection->open();\n\n\t\t$factory = new \\Touki\\FTP\\FTPFactory;\n\t\t$ftp = $factory->build($connection);\n\n\t\t// Sync background images\n\t\t$files_to_sync = array(\n\t\t\t'IDR' . $this->radar_id . '.background.png',\n\t\t\t'IDR' . $this->radar_id . '.locations.png',\n\t\t\t'IDR' . $this->radar_id . '.range.png',\n\t\t\t'IDR' . $this->radar_id . '.topography.png',\n\t\t);\n\n\t\tforeach ($files_to_sync as $file_to_sync) {\n\t\t\tif (file_exists($directory . '/' . $file_to_sync)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t$file = $ftp->findFileByName('/anon/gen/radar_transparencies/' . $file_to_sync);\n\n\t\t\tif (!$file) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t$ftp->download($directory . '/' . $file_to_sync, $file);\n\t\t}\n\n\t\t// Sync today's images\n\n\t\t$radar_images = new \\Touki\\FTP\\Model\\Directory('/anon/gen/radar/');\n\t\t$imgfiles = $ftp->findFiles($radar_images);\n\t\tforeach ($imgfiles as $imgfile) {\n\t\t\t$filepath = $imgfile->getRealpath();\n\t\t\tif (strpos($filepath, 'IDR' . $this->radar_id . '.T') === FALSE) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t$filename = basename($filepath);\n\n\t\t\tif (file_exists($directory . '/' . $filename)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t$ftp->download($directory . '/' . $filename, $imgfile);\n\t\t}\n\n\t\tif (!$clean_up_hours) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Find all files\n\t\t$files_to_clean = glob($directory . '/IDR' . $this->radar_id . '.T*');\n\t\t$now = new \\DateTime('NOW');\n\t\tforeach ($files_to_clean as $file_to_clean) {\n\t\t\t// parse date string\n\n\t\t\t$date = \\DateTime::createFromFormat('YmdHi', substr(basename($file_to_clean), strlen('IDR' . $this->radar_id . '.T.'), 12));\n\t\t\t$age_in_hours = $date->diff($now)->h;\n\t\t\tif ($age_in_hours > $clean_up_hours) {\n\t\t\t\tunlink($file_to_clean);\n\t\t\t}\n\t\t}\n\t}", "public function run()\n {\n $this->createSettings($this->settings());\n }", "public function sync_data($sync_type, $data_type=NULL){\n //Verify if module is enabled (just in case). If module is not enabled, Magento won't never come here..\n if(!Mage::helper('connector')->isEnabled()) {\n \n //Throw Exception\n throw new Exception(\"Minematic Module is disabled but Cron Jobs are still running. Disable Module in System > Configuration > Advanced > Advanced OR edit Minematic_Connect.xml in app/etc/modules/.\");\n }\n\n //Set last_sync_datetime\n $last_sync_datetime = date('Y-m-d H:i:s');\n\n /* SYNCING ITEMS */\n try {\n //Get information about the last synchronization process\n $items_last_sync_datetime = $this->_get_connector_config_value(Minematic_Connector_Model_Config::ITEMS_LAST_SYNC_DATETIME);\n $items_last_sync_datetime = $items_last_sync_datetime ? strtotime($items_last_sync_datetime) : NULL; //Convert to timestamp\n\n //Call ITEMS sync method\n $this->sync_items_data($sync_type, $items_last_sync_datetime, NULL, NULL, $last_sync_datetime);\n \n //If something goes wrong, catch the exception, log it and continue the synchronization\n } catch (Exception $e) {\n // Log exception\n Mage::helper('connector')->logSyncProcess($e->getMessage(), $sync_type, \"ERROR\");\n }\n\n \n /* SYNCING USERS */\n try {\n //Get information about the last synchronization process\n $users_last_sync_datetime = $this->_get_connector_config_value(Minematic_Connector_Model_Config::USERS_LAST_SYNC_DATETIME);\n $users_last_sync_datetime = $users_last_sync_datetime ? strtotime($users_last_sync_datetime) : NULL; //Convert to timestamp\n\n //Call USERS sync method\n $this->sync_users_data($sync_type, $users_last_sync_datetime, NULL, $last_sync_datetime);\n \n } catch (Exception $e) {\n // Log exception\n Mage::helper('connector')->logSyncProcess($e->getMessage(), $sync_type, \"ERROR\");\n }\n\n /* SYNCING EVENTS */\n try {\n //Get information about the last synchronization process\n $events_last_sync_datetime = $this->_get_connector_config_value(Minematic_Connector_Model_Config::EVENTS_LAST_SYNC_DATETIME);\n $events_last_sync_datetime = $events_last_sync_datetime ? strtotime($events_last_sync_datetime) : 978310861; //(Set date 2001-01-01 01:01:01 for migration)\n\n //Call EVENTS sync method\n $this->sync_events_data($sync_type, Minematic_Connector_Model_Config::EVENT_TYPE_ALL, $events_last_sync_datetime, NULL, $last_sync_datetime);\n \n } catch (Exception $e) {\n // Log exception\n Mage::helper('connector')->logSyncProcess($e->getMessage(), $sync_type, \"ERROR\");\n }\n\n }", "public static function getSync() {\n $directory = Settings::get('config_sync_directory', FALSE);\n if ($directory === FALSE) {\n // @todo: throw a more specific exception.\n // @see https://www.drupal.org/node/2696103\n throw new \\Exception('The config sync directory is not defined in $settings[\"config_sync_directory\"]');\n }\n return new FileStorage($directory);\n }", "function rdeploy() {\n\t\techo BR, TAB, TAB, '### checkOnce', BR;\n\t\t$this->checkOnce();\n\n\t\techo BR, TAB, TAB, '### pushAll', BR;\n\t\t$this->pushAll();\n\t\ttry {\n\t\t\t$exists = $this->rexists();\n\t\t} catch (\\SystemCommandException $e) {\n\t\t\t$exists = false;\n\t\t}\n\n\t\techo 'The destination folder ', $this->getVersionPath() . ($exists ? ' exists' : 'does not exist'), BR, BR;\n\t\tif ($exists) {\n\t\t\techo BR, TAB, TAB, '### rpull', BR;\n\t\t\t$this->rpull();\n\t\t\t$this->rcomposer();\n\t\t\t$this->postinstall();\n\t\t\t$this->rinstall();\n\t\t} else {\n\t\t\techo BR, TAB, TAB, '### mkdir', BR;\n\t\t\t$this->mkdir();\n\n\t\t\techo BR, TAB, TAB, '### rclone', BR;\n\t\t\t$this->rclone();\n\t\t}\n\n\t\techo BR, TAB, TAB, '### rupdate', BR;\n\t\t$this->rupdate();\n\n\t\techo BR, TAB, TAB, '### rcomposer', BR;\n\t\t$this->rcp('composer.json');\n\t\t$this->rcp('composer.lock');\n\t\t$this->rcomposer();\n\n\t\techo BR, TAB, TAB, '### postinstall', BR;\n\t\t$this->rpostinstall();\n\n\t\techo BR, TAB, TAB, '### rinstall', BR;\n\t\t$this->rinstall();\n\n\t\techo BR, TAB, TAB, '### rstatus', BR;\n\t\t$this->rstatus();\n\n\t\techo BR, TAB, TAB, '### deployDependencies', BR;\n\t\t$this->deployDependencies();\n\t\t$nr = $this->getMain()->nr();\n\t\t$this->exec('start http://'.$this->liveServer.'/v'.$nr);\n\t}", "public function main() {\n\n $fs = new Filesystem();\n\n $fs->touch($this->getTargetFile());\n\n $seedProperties = Yaml::parse(file_get_contents($this->getSeedFile()));\n $generatedProperties = [];\n\n $generatedProperties['label'] = $seedProperties['project_label'];\n $generatedProperties['machineName'] = $seedProperties['project_name'];\n $generatedProperties['group'] = $seedProperties['project_group'];\n $generatedProperties['basePath'] = '${current.basePath}';\n $generatedProperties['type'] = $seedProperties['project_type'];\n $generatedProperties['repository']['main'] = $seedProperties['project_git_repository'];\n $generatedProperties['php'] = $seedProperties['project_php_version'];\n\n // Add platform information.\n if (isset($generatedProperties['platform'])) {\n $generatedProperties['platform'] = $seedProperties['platform'];\n }\n\n $fs->dumpFile($this->getTargetFile(), Yaml::dump($generatedProperties, 5, 2));\n }", "public function generate()\n {\n if (!file_exists(SSG_OUTPUT_DIR)) {\n if (!mkdir($concurrentDirectory = SSG_OUTPUT_DIR) && !is_dir($concurrentDirectory)) {\n throw new \\RuntimeException(sprintf('Directory \"%s\" was not created', $concurrentDirectory));\n }\n }\n\n //Empty output dir\n $this->emptyBuildFolder();\n\n //Create needed directories in build folder\n if (!mkdir($concurrentDirectory = SSG_OUTPUT_DIR . TEMPLATE_URI) && !is_dir($concurrentDirectory)) {\n throw new \\RuntimeException(sprintf('Directory \"%s\" was not created', $concurrentDirectory));\n }\n\n //If we are running on Netlify and Mix wasn't triggered we get the Mix assets from the live site, meaning the last build\n if (getenv('NETLIFY') && USE_MIX && !defined('NETLIFY_MIX_TRIGGERED')) {\n $rootUrl = getenv('URL');\n $manifest = @file_get_contents($rootUrl . TEMPLATE_URI . '/dist/mix-manifest.json');\n if($manifest) {\n if (!mkdir($concurrentDirectory = APP_ROOT . TEMPLATE_DIR . '/dist') && !is_dir($concurrentDirectory)) {\n throw new \\RuntimeException(sprintf('Directory \"%s\" was not created', $concurrentDirectory));\n }\n file_put_contents(APP_ROOT . TEMPLATE_DIR . '/dist/mix-manifest.json', $manifest);\n foreach (json_decode($manifest) ?? [] as $filename => $hash) {\n $file = file_get_contents($rootUrl . TEMPLATE_URI . '/dist' . $filename);\n file_put_contents(APP_ROOT . TEMPLATE_DIR . '/dist' . $filename, $file);\n }\n }\n\n }\n\n $sitemapCreated = (new Sitemap)->createSitemap();\n if ($sitemapCreated) {\n copy(APP_ROOT . PUBLIC_DIR . '/sitemap.xml', SSG_OUTPUT_DIR . '/sitemap.xml');\n }\n\n //Create blog home\n if (file_exists(POSTS_DIR)) {\n $this->renderBlogHome();\n }\n\n //TODO: Support for CPT here\n //Scan trough content types and render HTML\n $collections = $this->router->getKnownCollections();\n foreach ($collections as $collection) {\n $pages = $this->getDirContents(APP_ROOT . CONTENT_DIR . '/' . $collection);\n foreach ($pages as $page) {\n $this->renderContentJsonToHtml($page, $collection);\n }\n }\n\n //Copy theme images to build directory\n $this->syncDirectoryToBuild('uploads');\n $this->syncDirectoryToBuild('theme/img');\n $this->syncDirectoryToBuild('theme/dist');\n $this->syncDirectoryToBuild('theme/fonts');\n\n //If redirect file exists, move it over\n if(file_exists(APP_ROOT . '/_redirects')) {\n copy(APP_ROOT . '/_redirects', SSG_OUTPUT_DIR . '/_redirects');\n }\n\n //Create Netlify CMS admin index file from dynamic json config\n $this->createNetlifyCmsAdminFolder();\n }", "protected function _daemon($period='any') {\n return true;\n }", "function oinkmaster_run($id, $if_real, $iface_uuid)\n{\n\tglobal $config, $g, $snortdir_wan, $snortdir, $snort_md5_check_ok, $emerg_md5_check_ok, $pfsense_md5_check_ok;\n\n\tif ($snort_md5_check_ok != 'on' || $emerg_md5_check_ok != 'on' || $pfsense_md5_check_ok != 'on') {\n\t\tif (empty($config['installedpackages']['snortglobal']['rule'][$id]['rule_sid_on']) && empty($config['installedpackages']['snortglobal']['rule'][$id]['rule_sid_off'])) { \n\t\t\tupdate_status(gettext(\"Your first set of rules are being copied...\"));\n\t\t\tupdate_output_window(gettext(\"May take a while...\"));\n\t\t\texec(\"/bin/cp {$snortdir}/rules/* {$snortdir_wan}/snort_{$iface_uuid}_{$if_real}/rules/\");\n\t\t\texec(\"/bin/cp {$snortdir}/classification.config {$snortdir_wan}/snort_{$iface_uuid}_{$if_real}\");\n\t\t\texec(\"/bin/cp {$snortdir}/gen-msg.map {$snortdir_wan}/snort_{$iface_uuid}_{$if_real}\");\n\t\t\texec(\"/bin/cp {$snortdir}/generators {$snortdir_wan}/snort_{$iface_uuid}_{$if_real}\");\n\t\t\texec(\"/bin/cp {$snortdir}/reference.config {$snortdir_wan}/snort_{$iface_uuid}_{$if_real}\");\n\t\t\texec(\"/bin/cp {$snortdir}/sid {$snortdir_wan}/snort_{$iface_uuid}_{$if_real}\");\n\t\t\texec(\"/bin/cp {$snortdir}/sid-msg.map {$snortdir_wan}/snort_{$iface_uuid}_{$if_real}\");\n\t\t\texec(\"/bin/cp {$snortdir}/unicode.map {$snortdir_wan}/snort_{$iface_uuid}_{$if_real}\");\n\t\t} else {\n\t\t\tupdate_status(gettext(\"Your enable and disable changes are being applied to your fresh set of rules...\"));\n\t\t\tupdate_output_window(gettext(\"May take a while...\"));\n\t\t\texec(\"/bin/cp {$snortdir}/rules/* {$snortdir_wan}/snort_{$iface_uuid}_{$if_real}/rules/\");\n\t\t\texec(\"/bin/cp {$snortdir}/classification.config {$snortdir_wan}/snort_{$iface_uuid}_{$if_real}\");\n\t\t\texec(\"/bin/cp {$snortdir}/gen-msg.map {$snortdir_wan}/snort_{$iface_uuid}_{$if_real}\");\n\t\t\texec(\"/bin/cp {$snortdir}/generators {$snortdir_wan}/snort_{$iface_uuid}_{$if_real}\");\n\t\t\texec(\"/bin/cp {$snortdir}/reference.config {$snortdir_wan}/snort_{$iface_uuid}_{$if_real}\");\n\t\t\texec(\"/bin/cp {$snortdir}/sid {$snortdir_wan}/snort_{$iface_uuid}_{$if_real}\");\n\t\t\texec(\"/bin/cp {$snortdir}/sid-msg.map {$snortdir_wan}/snort_{$iface_uuid}_{$if_real}\");\n\t\t\texec(\"/bin/cp {$snortdir}/unicode.map {$snortdir_wan}/snort_{$iface_uuid}_{$if_real}\");\n\n\t\t\t/* might have to add a sleep for 3sec for flash drives or old drives */\n\t\t\texec(\"/usr/local/bin/perl /usr/local/bin/oinkmaster.pl -C /usr/local/etc/snort/snort_{$iface_uuid}_{$if_real}/oinkmaster_{$iface_uuid}_{$if_real}.conf -o /usr/local/etc/snort/snort_{$iface_uuid}_{$if_real}/rules > /usr/local/etc/snort/oinkmaster_{$iface_uuid}_{$if_real}.log\");\n\n\t\t}\n\t}\n}", "function start()\n{\n global $ipfsutils, $staticFile, $urlpath, $avahi_type, $avahi_port, $avahi_desc;\n $ret = execute_program_detached($ipfsutils.\" startDaemon $avahi_port $avahi_type\");\n //$output = ptxt(\" \". print_r($ret['output'][0],1));\n\n // Announce the IPFS instance to the community cloud via any of the\n // available methods -including IPFS itself, if enabled-\n $pub_res = avahi_publish($avahi_type, $avahi_desc, $avahi_port, null);\n\n setFlash(txt(t('ipfs_flash_publish')) . ptxt($pub_res));\n return(array('type'=>'redirect','url'=>$staticFile.$urlpath));\n}", "public static function runAll()\n {\n static::checkSapiEnv();\n static::init();\n static::daemonize();\n static::initWorkers();\n static::installSignal();\n static::saveMasterPid();\n static::displayUI();\n static::forkWorkers();\n static::resetStd();\n static::monitorWorkers();\n }" ]
[ "0.5545277", "0.5340688", "0.52795166", "0.5278157", "0.52003", "0.5169718", "0.5128938", "0.51262146", "0.51262146", "0.51077634", "0.5069991", "0.50614566", "0.5036797", "0.5033497", "0.49394903", "0.49231923", "0.49219832", "0.49059486", "0.4901447", "0.48842013", "0.4834861", "0.4823204", "0.48148185", "0.47956684", "0.47732344", "0.47728863", "0.47511446", "0.471843", "0.4713551", "0.47026557", "0.47019938", "0.46713462", "0.46618724", "0.46497503", "0.46436894", "0.4635319", "0.46349266", "0.4630062", "0.46252108", "0.46243683", "0.46205416", "0.4618447", "0.46181303", "0.45685735", "0.45647535", "0.45436853", "0.4537532", "0.45341933", "0.4529082", "0.45289254", "0.45282593", "0.45136288", "0.45043895", "0.4503861", "0.44927034", "0.44846472", "0.4476379", "0.44534364", "0.44233814", "0.44207466", "0.4411271", "0.4407456", "0.44038677", "0.44025284", "0.43684956", "0.43662113", "0.43603638", "0.43452", "0.4338619", "0.43386164", "0.43333006", "0.43326476", "0.43294632", "0.43176025", "0.43150312", "0.43051434", "0.43032694", "0.42993757", "0.4299072", "0.42974207", "0.42965865", "0.4287878", "0.428168", "0.4280694", "0.42791164", "0.42776507", "0.42728025", "0.42709294", "0.4265901", "0.42602226", "0.42561477", "0.42371613", "0.42343625", "0.42263123", "0.42210838", "0.42124692", "0.42114654", "0.42067897", "0.42039716", "0.4203705", "0.41932997" ]
0.0
-1
Add product to order
public function addToOrder($product, $currency = '') { $params = $this->getOrder(); $prod = is_object($product) ? $product->getData() : $product; if (!isset($prod['product'])) { $prod['product'] = $prod; } $prod['quantity'] = isset($prod['quantity']) ? $prod['quantity'] : 1; $merge = false; $ignore_service = array(); // Проверяем есть ли такой товар в корзине, если имеется, то увеличиваем количество foreach ($params['order']['items'] as $k => $item) { if ($item['sku_id'] == $prod['sku_id']) { $params['order']['items'][$k]['quantity'] += $prod['quantity']; $merge = true; $item_id = $k; } // Если в заказе имеется услуга и, мы ее же пытаемся добавить с новым товаром, // устанавливаем флаг, чтобы игнорировать повторное добавление услуги if ($item['type'] == 'service' && $prod['sku_id'] == $item['sku_id'] && isset($prod['services'][$item['service_variant_id']])) { $ignore_service[$item['service_variant_id']] = true; } } $prod['currency'] = $currency ? $currency : $params['order']['currency']; if (!$merge) { $params['order']['items'][] = $prod; end($params['order']['items']); $item_id = key($params['order']['items']); reset($params['order']['items']); } // Добавляем услуги к заказу if (!empty($prod['services'])) { foreach ($prod['services'] as $variant_id => $variant) { if (empty($ignore_service[$variant_id])) { $params['order']['items'][] = array( 'type' => 'service', 'service_id' => $variant['service_id'], 'service_variant_id' => $variant_id, 'parent_id' => $item_id, 'price' => $variant['price'], 'currency' => $variant['currency'] ); } // Изменяем общую цену заказа $params['order']['total'] += (float) $variant['price'] * $prod['quantity']; } } // Добавляем товары в общую выборку при динамическом обновлении информационных блоков if (waRequest::isXMLHttpRequest()) { $data_class = new shopFlexdiscountData(); $data_class->setShopProducts($params['order']['items']); } // Изменяем общую цену заказа $product_price = (float) shop_currency((float) $prod['price'] * $prod['quantity'], $prod['currency'], $params['order']['currency'], false); $params['order']['total'] += shopRounding::roundCurrency($product_price, $params['order']['currency']); return $params; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function uc_order_edit_products_add($form, &$form_state) {\n $form_state['products_action'] = 'products_select';\n $form_state['refresh_products'] = TRUE;\n $form_state['rebuild'] = TRUE;\n $order = $form_state['build_info']['args'][0];\n\n $data = module_invoke_all('uc_add_to_cart_data', $form_state['values']['product_controls']);\n $product = uc_product_load_variant(intval($form_state['values']['product_controls']['nid']), $data);\n $product->qty = isset($form_state['values']['product_controls']['qty']) ? $form_state['values']['product_controls']['qty'] : $product->default_qty;\n\n drupal_alter('uc_order_product', $product, $order);\n uc_order_product_save($order->order_id, $product);\n $order->products[] = $product;\n\n uc_order_log_changes($order->order_id, array('add' => t('Added (@qty) @title to order.', array('@qty' => $product->qty, '@title' => $product->title))));\n\n // Decrement stock.\n if (module_exists('uc_stock')) {\n uc_stock_adjust_product_stock($product, 0, $order);\n }\n\n // Add this product to the form values for accurate tax calculations.\n $form_state['values']['products'][] = (array) $product;\n}", "function add_product_to_order($id_order,$id_product,$sauce){\r\n $bdd = Database3Splus::getinstance();//connexion();\r\n $amount = 1;\r\n $req = \"INSERT INTO order_details VALUES (:id_order, :id_product, :amount, :sauce)\";\r\n $result = $bdd->prepare($req);\r\n $result->bindParam(':id_order', $id_order);\r\n $result->bindParam(':id_product', $id_product);\r\n $result->bindParam(':amount', $amount);\r\n $result->bindParam(':sauce', $sauce);\r\n $result->execute();\r\n $count = $result->rowCount();\r\n\t\tif($count != 0){return TRUE;}\r\n\t\telse{return FALSE;}\r\n\t}", "function addProduct(Product $product){\n \t$this->myCart ->add($product);\n }", "private function add($product){\n $cart = ['qty'=>0,'price' => 0, 'product' => $product];\n if($this->items){\n if(array_key_exists($product->prod_id, $this->items)){\n $cart = $this->items[$product->prod_id];\n }\n }\n $cart['qty']++;\n $cart['price'] += $product->price;\n $this->items[$product->prod_id] = $cart;\n $this->totalQty++;\n $this->totalPrice += $product->price;\n }", "public function add($orderedProduct){\n\t\twhile(array_key_exists($orderedProduct->getId(), $this->Contents)){\n\t\t\t$orderedProduct->regenerateId();\n\t\t}\n\t\t$this->Contents[$orderedProduct->getId()] = $orderedProduct;\n\t\t$this->cleanUp();\n\t}", "public function addAction()\n {\n $cart = $this->_getCart();\n $params = $this->getRequest()->getParams();\n// qq($params);\n try {\n if (isset($params['qty'])) {\n $filter = new Zend_Filter_LocalizedToNormalized(\n array('locale' => Mage::app()->getLocale()->getLocaleCode())\n );\n $params['qty'] = $filter->filter($params['qty']);\n }\n\n $product = $this->_initProduct();\n $related = $this->getRequest()->getParam('related_product');\n $related_products = $this->getRequest()->getParam('related_products');\n $related_qty = $this->getRequest()->getParam('related_qty');\n /**\n * Check product availability\n */\n if (!$product) {\n $this->_goBack();\n return;\n }\n \n $in_cart = $cart->getQuoteProductIds();\n if($product->getTypeId() == 'cartproduct') {\n $cart_product_id = $product->getId();\n if(in_array($cart_product_id, $in_cart)) {\n $this->_goBack();\n return;\n }\n }\n\n if($params['qty']) $cart->addProduct($product, $params);\n \n if (!empty($related_qty)) {\n foreach($related_qty as $pid=>$qty){\n if(intval($qty)>0){\n $product = $this->_initProduct(intval($pid));\n $related_params['qty'] = $filter->filter($qty);\n if(isset($related_products[$pid])){\n if($product->getTypeId() == 'bundle') {\n $related_params['bundle_option'] = $related_products[$pid]['bundle_option'];\n// qq($related_params);\n// die('test');\n } else {\n $related_params['super_attribute'] = $related_products[$pid]['super_attribute'];\n }\n }\n $cart->addProduct($product, $related_params);\n }\n }\n }\n \n $collection = Mage::getModel('cartproducts/products')->getCollection()\n ->addAttributeToFilter('type_id', 'cartproduct')\n ->addAttributeToFilter('cartproducts_selected', 1)\n ;\n \n foreach($collection as $p)\n {\n $id = $p->getId();\n if(isset($in_cart[$id])) continue;\n \n $cart = Mage::getSingleton('checkout/cart');\n $quote_id = $cart->getQuote()->getId();\n \n if(Mage::getSingleton('core/session')->getData(\"cartproducts-$quote_id-$id\")) continue;\n \n $p->load($id);\n $cart->getQuote()->addProduct($p, 1);\n }\n \n if($cart->getQuote()->getShippingAddress()->getCountryId() == '') $cart->getQuote()->getShippingAddress()->setCountryId('US');\n $cart->getQuote()->setCollectShippingRates(true);\n $cart->getQuote()->getShippingAddress()->setShippingMethod('maxshipping_standard')->collectTotals()->save();\n \n $cart->save();\n \n Mage::getSingleton('checkout/session')->resetCheckout();\n\n\n $this->_getSession()->setCartWasUpdated(true);\n\n /**\n * @todo remove wishlist observer processAddToCart\n */\n Mage::dispatchEvent('checkout_cart_add_product_complete',\n array('product' => $product, 'request' => $this->getRequest(), 'response' => $this->getResponse())\n );\n\n if (!$this->_getSession()->getNoCartRedirect(true)) {\n if (!$cart->getQuote()->getHasError() && $params['qty'] ){\n $message = $this->__('%s was added to your shopping cart.', Mage::helper('core')->htmlEscape($product->getName()));\n $this->_getSession()->addSuccess($message);\n }\n $this->_goBack();\n }\n } catch (Mage_Core_Exception $e) {\n if ($this->_getSession()->getUseNotice(true)) {\n $this->_getSession()->addNotice($e->getMessage());\n } else {\n $messages = array_unique(explode(\"\\n\", $e->getMessage()));\n foreach ($messages as $message) {\n $this->_getSession()->addError($message);\n }\n }\n\n $url = $this->_getSession()->getRedirectUrl(true);\n if ($url) {\n $this->getResponse()->setRedirect($url);\n } else {\n $this->_redirectReferer(Mage::helper('checkout/cart')->getCartUrl());\n }\n } catch (Exception $e) {\n $this->_getSession()->addException($e, $this->__('Cannot add the item to shopping cart.'));\n Mage::logException($e);\n $this->_goBack();\n }\n }", "function add() {\n\t\tif (True) {\n\n\t\t\t// create an empty product.\n\t\t\t$o =& new ufo_product(0);\n\t\t\t$this->addedObject =& $o;\n\t\t\n\t\t\t// create an entry in the db.\n\t\t\t$o->initialize();\n\t\t\t$o->create();\n\t\t\t$o->edit();\n\n\t\t\t// add it to the product array.\n\t\t\t$this->product[] = $o;\n\t\t}\n\t}", "public function addProduct(Product $product, $quantity);", "public function actionAddProduct()\n\t{\n\t\tif(Yii::app()->request->isPostRequest)\n\t\t{\n\t\t\t$order = $this->_loadModel($_POST['order_id']);\n\t\t\t$product = StoreProduct::model()->findByPk($_POST['product_id']);\n\n\t\t\tif(!$product)\n\t\t\t\tthrow new CHttpException(404, Yii::t('OrdersModule.admin', 'Ошибка. Продукт не найден.'));\n\n\t\t\t$ordered_product = new OrderProduct;\n\t\t\t$ordered_product->order_id = $order->id;\n\t\t\t$ordered_product->product_id = $product->id;\n\t\t\t$ordered_product->name = $product->name;\n\t\t\t$ordered_product->quantity = $_POST['quantity'];\n\t\t\t$ordered_product->sku = $product->sku;\n\t\t\t$ordered_product->price = $_POST['price'];\n\t\t\t//$ordered_product->price = StoreProduct::calculatePrices($product, array(), 0);\n\t\t\t$ordered_product->save();\n\t\t}\n\t}", "private function inserOrderproduct($orderId){\n\t\t$this->load->library(\"cart\");\n\t\tforeach($this->cart->contents() as $items){\n\t\t\t$object=array(\n\t\t\t\t'OrdId' => $orderId,\n\t\t\t\t'ItemId' => $items['id'],\n\t\t\t\t'ItemName' => $items['name'],\n\t\t\t\t'ItemEdition' => $items['options']['BookEdition'],\n\t\t\t\t'ItemAuther' => $items['options']['Author'],\n\t\t\t\t'ItemQuantity' => $items['qty'],\n\t\t\t\t'ItemRetailPrice' => $items['options']['RetailPrice'],\n\t\t\t\t'ItemSellingPrice' => $items['price'],\n\t\t\t\t'ItemDiscount' => $items['options']['Discount']\n\t\t\t);\n\t\t\t$this->db->insert('tbl_order_lineitems', $object);\n\t\t}\n\t}", "private function addProduct($product) \r\n\t{\r\n\t\t$this->newProducts[] = $product;\r\n\t}", "function uc_order_edit_products_add_blank($form, &$form_state) {\n $form_state['refresh_products'] = TRUE;\n $form_state['rebuild'] = TRUE;\n\n $order = $form_state['build_info']['args'][0];\n\n $product = new stdClass();\n $product->qty = 1;\n $product->order_id = $order->order_id;\n uc_order_product_save($order->order_id, $product);\n\n $order->products[] = $product;\n\n uc_order_log_changes($order->order_id, array('add' => t('Added new product line to order.')));\n}", "public function __invoke(AddProductToOrderCommand $command)\n {\n // TODO: sprawdź czy jest dorossly customer->isAdult()\n // TODO: utwórz Zamówienie (Order)\n // TODO: pobierz product z repozytorium\n // TODO: sprawdź czy jest dostępny product->isAvailable()\n // TODO: utwórz quantitty = Quantity::unique(ilość)\n // TODO: dodaj do zamówienia Order->addLine(Identtifier::fromString(prduct->getId()), quantitty)\n\n // TODO: zmień dostępność produktu product->unavailable()\n // TODO: zapisz product do repozytorium productRepository->save(product)\n // TODO: albo wykorzystaj listenera nasłuchującego eventu UniqueProductWasOrdered i w nim zmień dostępność produktu\n }", "public function addProduct($prod) {\n\t\t\t$this->products[$this->pid] = $prod;\n\t\t\t$this->pid ++;\n\t\t}", "public function addAction() {\r\n $cart = $this->_getCart();\r\n $params = $this->getRequest()->getParams();\r\n try {\r\n if (isset($params['qty'])) {\r\n $filter = new Zend_Filter_LocalizedToNormalized(\r\n array('locale' => Mage::app()->getLocale()->getLocaleCode())\r\n );\r\n $params['qty'] = $filter->filter($params['qty']);\r\n }\r\n\r\n $product = $this->_initProduct();\r\n $related = $this->getRequest()->getParam('related_product');\r\n\r\n /**\r\n * Check product availability\r\n */\r\n if (!$product) {\r\n $this->_goBack();\r\n return;\r\n }\r\n\r\n $cart->addProduct($product, $params);\r\n if (!empty($related)) {\r\n $cart->addProductsByIds(explode(',', $related));\r\n }\r\n\r\n $cart->save();\r\n\r\n $this->_getSession()->setCartWasUpdated(true);\r\n\r\n /**\r\n * @todo remove wishlist observer processAddToCart\r\n */\r\n $this->getLayout()->getUpdate()->addHandle('ajaxcart');\r\n $this->loadLayout();\r\n\r\n Mage::dispatchEvent('checkout_cart_add_product_complete', array('product' => $product, 'request' => $this->getRequest(), 'response' => $this->getResponse())\r\n );\r\n\r\n if (!$this->_getSession()->getNoCartRedirect(true)) {\r\n if (!$cart->getQuote()->getHasError()) {\r\n $message = $this->__('%s was added to your shopping cart.', Mage::helper('core')->escapeHtml($product->getName()));\r\n $this->_getSession()->addSuccess($message);\r\n }\r\n $this->_goBack();\r\n }\r\n } catch (Mage_Core_Exception $e) {\r\n $_response = Mage::getModel('ajaxcart/response');\r\n $_response->setError(true);\r\n\r\n $messages = array_unique(explode(\"\\n\", $e->getMessage()));\r\n $json_messages = array();\r\n foreach ($messages as $message) {\r\n $json_messages[] = Mage::helper('core')->escapeHtml($message);\r\n }\r\n\r\n $_response->setMessages($json_messages);\r\n\r\n $url = $this->_getSession()->getRedirectUrl(true);\r\n\r\n $_response->send();\r\n } catch (Exception $e) {\r\n $this->_getSession()->addException($e, $this->__('Cannot add the item to shopping cart.'));\r\n Mage::logException($e);\r\n\r\n $_response = Mage::getModel('ajaxcart/response');\r\n $_response->setError(true);\r\n $_response->setMessage($this->__('Cannot add the item to shopping cart.'));\r\n $_response->send();\r\n }\r\n }", "function uc_order_pane_products_add($form, &$form_state) {\n $form_state['products_action'] = 'add_product';\n $form_state['node'] = node_load($form_state['values']['product_controls']['nid']);\n unset($form_state['refresh_products']);\n $form_state['rebuild'] = TRUE;\n}", "public function addproducttopoAction() {\n $id = $this->getRequest()->getParam('id');\n $sku = $this->getRequest()->getParam('sku');\n $model = Mage::getModel('inventorypurchasing/purchaseorder_draftpo')->load($id);\n try {\n $productId = Mage::getModel('catalog/product')->getIdBySku($sku);\n if (!$productId) {\n throw new Exception($this->helper()->__('Not found sku: %s', \"<i>$sku</i>\"));\n }\n $model->addProduct($productId);\n Mage::getSingleton('vendors/session')->addSuccess(\n $this->helper()->__('Product %s has been added.', \"<i>$sku</i>\")\n );\n $this->_redirect('*/*/view', array('id' => $id));\n } catch (Exception $e) {\n Mage::getSingleton('vendors/session')->addError($this->helper()->__('There is error while adding product.'));\n Mage::getSingleton('vendors/session')->addError($e->getMessage());\n $this->_redirect('*/*/view', array('id' => $id));\n }\n }", "public function addProduct(ProductElementInterface $product);", "public function actionAddProduct()\n {\n if (Yii::app()->request->isPostRequest) {\n if (Yii::app()->request->isAjaxRequest) {\n $order = $this->_loadModel($_POST['order_id']);\n $product = ShopProduct::model()->findByPk($_POST['product_id']);\n\n $find = OrderProduct::model()->findByAttributes(array('order_id' => $order->id, 'product_id' => $product->id));\n\n if ($find) {\n if (Yii::app()->request->isAjaxRequest) {\n $this->setJson(array(\n 'success' => false,\n 'message' => Yii::t('CartModule.admin', 'ERR_ORDER_PRODUCT_EXISTS'),\n ));\n } else {\n throw new CHttpException(400, Yii::t('CartModule.admin', 'ERR_ORDER_PRODUCT_EXISTS'));\n }\n }\n if (!$product) {\n if (Yii::app()->request->isAjaxRequest) {\n $this->setJson(array(\n 'success' => false,\n 'message' => Yii::t('CartModule.default', 'ERROR_PRODUCT_NO_FIND'),\n ));\n } else {\n throw new CHttpException(404, Yii::t('CartModule.default', 'ERROR_PRODUCT_NO_FIND'));\n }\n }\n\n $order->addProduct($product, $_POST['quantity'], $_POST['price']);\n $this->setJson(array(\n 'success' => true,\n 'message' => Yii::t('CartModule.admin', 'SUCCESS_ADD_PRODUCT_ORDER'),\n ));\n } else {\n throw new CHttpException(500, Yii::t('error', '500'));\n }\n } else {\n throw new CHttpException(500, Yii::t('error', '500'));\n }\n }", "public function addOrderProduct($post)\r\n\t{\r\n\t\t$this->db->insert('tbl_order_product', $post);\r\n\t\t$this->result = $this->db->insert_id() ; \r\n\t\treturn $this->result;\r\n\t}", "public function add()\n\t{\n\t\t$product = ORM::factory('product', $this->input->post('product_id'));\n\t\t$quantity = $this->input->post('quantity', 1);\n\t\t$variant = ORM::factory('variant', $this->input->post('variant_id'));\n\t\t\n\t\t$this->cart->add_product($product, $variant, $quantity);\n\t\t\n\t\turl::redirect('cart');\n\t}", "public function add(Product $product) {\n\t\t$this->products[] = $product;\n\t}", "public function addProduct($product)\n {\n \n $cart = $product->cart()->where('cart_id',$this->id)->wherePivot('deleted_at',null)->first();\n\n if(is_null($cart))\n {\n $this->product()->save($product);\n }\n else\n {\n\n $quantity = $cart->pivot->quantity;\n\n $quantity++;\n\n $cart->pivot->update(compact('quantity'));\n }\n\n }", "public function AddProduct () {\n $piece1 = '(';\n \t$piece2 = '';\n\t\t\n\t\tif(isset($SKU)) {\n\t\t\t$piece1 .= 'ProductSKU,';\n\t\t\t$piece2 .= \"'\" . $this->SKU . \"'\";\n $piece2 .= ',';\n\t\t}\n\t\telse {\n\t\t\techo \" \\n Error: SKU Field Empty \\n \";\n\t\t\treturn false;\n }\n\t\t\n\t\t$productTable = 'Products';\n\t\t$productPiece = \" (SKU) VALUES ('\" . $this->SKU . \"')\";\n\t\t\n\t\n $productResults = OrderData::InsertData($productTable, $productPiece);\n\t\t\n\t\tif($productResults === false)\n\t\t\treturn false;\n\t\t\n\t\t\n\t\tif(isset($Qty)) {\n\t\t\t$piece1 .= 'TotalAMT,';\n\t\t\t$piece2 .= \"\" . $this->initialquantityStock . \"\";\n $piece2 .= ',';\n\t\t}\n\t\telse {\n\t\t\techo \" \\n Error: Quantity Field Empty \\n \";\n\t\t\treturn false;\n }\n\t\t\n\t\t$piece1 .= 'CommittedAMT,';\n\t\t$piece2 .= $this->committedStock . ',';\n\n \t\t$piece1 .= 'AvailableAMT';\n $piece2 .= $this->availableStock . ')';\n\t\t\n\t\t$piece1 .= ') VALUES (';\n\n $inventoryPiece = $piece1 . $piece2;\n\t\t\n\t\t$inventoryTable = 'Inventory';\n\t\t$productPiece = \" (SKU) VALUES ('\" . $this->SKU . \"')\";\n\t\t\n\t\n $inventoryResults = OrderData::InsertData($inventoryTable, $inventoryPiece);\n\t\t\n\t\tif($inventoryResults === false)\n\t\t\treturn false;\n\t\t\t\n\t\treturn true;\n\t}", "public function addProduct(Product $product)\n {\n $this->products[] = $product;\n $this->price += $product->getPrice();\n if($this->hasPromotion()){\n $this->applyPromotion();\n }\n }", "public static function addProductsFromOrder($orderId = 0)\n\t{\n\t\t$orderId = (int)$orderId;\n\n\t\tif (Sale\\OrderProcessingTable::hasAddedProducts($orderId))\n\t\t\treturn;\n\n\t\t$connection = Main\\Application::getConnection();\n\t\t$type = $connection->getType();\n\n\t\t// Update existing\n\t\tif ($type == \"mysql\" && $connection->isTableExists('b_sale_order_product_stat'))\n\t\t{\n\t\t\t$sqlUpdate = \"\n\t\t\t\tINSERT INTO b_sale_order_product_stat (PRODUCT_ID, RELATED_PRODUCT_ID, ORDER_DATE) \n\t\t\t\tSELECT b.PRODUCT_ID, b1.PRODUCT_ID, DATE(b.DATE_INSERT)\n\t\t\t\tFROM b_sale_basket b, b_sale_basket b1\n\t\t\t\tWHERE b.ORDER_ID = b1.ORDER_ID AND\n\t\t\t\t\tb.ORDER_ID = $orderId AND\n\t\t\t\t\tb.ID <> b1.ID \n \t\t\t\tON DUPLICATE KEY UPDATE CNT = CNT + 1;\n\t\t\t\";\n\t\t\t$connection->query($sqlUpdate);\n\n\t\t\t$sqlUpdate = \"UPDATE b_sale_product2product p2p, b_sale_basket b, b_sale_basket b1\n\t\t\t\tSET p2p.CNT = p2p.CNT + 1\n\t\t\t\tWHERE b.ORDER_ID = b1.ORDER_ID AND\n\t\t\t\t\tb.ID <> b1.ID AND\n\t\t\t\t\tb.ORDER_ID = $orderId AND\n\t\t\t\t\tp2p.PRODUCT_ID = b.PRODUCT_ID AND\n\t\t\t\t\tp2p.PARENT_PRODUCT_ID = b1.PRODUCT_ID\";\n\t\t}\n\t\telseif ($type == \"mssql\")\n\t\t{\n\t\t\t$sqlUpdate = \"UPDATE b_sale_product2product\n\t\t\t\tSET CNT = CNT + 1\n\t\t\t\tFROM b_sale_product2product p2p, b_sale_basket b, b_sale_basket b1\n\t\t\t\tWHERE b.ORDER_ID = b1.ORDER_ID AND\n\t\t\t\t\tb.ID <> b1.ID AND\n\t\t\t\t\tb.ORDER_ID = $orderId AND\n\t\t\t\t\tp2p.PRODUCT_ID = b.PRODUCT_ID AND\n\t\t\t\t\tp2p.PARENT_PRODUCT_ID = b1.PRODUCT_ID\";\n\t\t}\n\t\telse // Oracle\n\t\t{\n\t\t\t$sqlUpdate = \"UPDATE b_sale_product2product\n\t\t\t\tSET CNT = CNT + 1\n\t\t\t\tWHERE ID IN (\n\t\t\t\t\tSELECT p2p.ID FROM b_sale_product2product p2p, b_sale_basket b, b_sale_basket b1\n\t\t\t\t\tWHERE b.ORDER_ID = b1.ORDER_ID AND\n\t\t\t\t\t\tb.ID <> b1.ID AND\n\t\t\t\t\t\tb.ORDER_ID = $orderId AND\n\t\t\t\t\t\tp2p.PRODUCT_ID = b.PRODUCT_ID AND\n\t\t\t\t\t\tp2p.PARENT_PRODUCT_ID = b1.PRODUCT_ID\n\t\t\t\t\t)\";\n\t\t}\n\n\t\t$connection->query($sqlUpdate);\n\n\t\t// Insert new\n\t\t$sqlInsert = \"INSERT INTO b_sale_product2product (PRODUCT_ID, PARENT_PRODUCT_ID, CNT)\n\t\t\tSELECT b.PRODUCT_ID, b1.PRODUCT_ID, 1\n\t\t\tFROM b_sale_basket b, b_sale_basket b1\n\t\t\tWHERE b.ORDER_ID = b1.ORDER_ID AND\n\t\t\t\tb.ORDER_ID = $orderId AND\n\t\t\t\tb.ID <> b1.ID AND\n\t\t\t\tNOT EXISTS (SELECT 1 FROM b_sale_product2product d WHERE d.PRODUCT_ID = b.PRODUCT_ID AND d.PARENT_PRODUCT_ID = b1.PRODUCT_ID)\";\n\n\t\t$connection->query($sqlInsert);\n\n\t\tSale\\OrderProcessingTable::markProductsAdded($orderId);\n\n\t\tif (defined(\"BX_COMP_MANAGED_CACHE\"))\n\t\t{\n\t\t\t$app = Main\\Application::getInstance();\n\t\t\t$app->getTaggedCache()->clearByTag('sale_product_buy');\n\t\t}\n\t}", "public function add(ProductInterface $product, $quantity = 1);", "public function add(\\Webshop\\Products\\Product $product)\n {\n $this->redis->zAdd('prd', $product->getId(), serialize($product));\n }", "public static function add($product)\n {\n session()->push('cart', $product);\n }", "public function add_to_cart() {\n if ( ! is_single() ) {\n return;\n }\n\n global $product;\n\n WC_Gokeep_JS::get_instance()->add_to_cart( $product , '.single_add_to_cart_button' );\n }", "public function add($product) {\n $ajout = false;\n if ($this->products_id) {\n if (array_key_exists($product->id,$this->products_id)) {\n if ($product->quantity >= $this->products_id[\"$product->id\"]++){\n $this->products_id[\"$product->id\"]++;\n $ajout = true;\n }\n }else {\n if($product->quantity >= 1){\n $this->products_id += [\"$product->id\"=>1];\n $ajout = true;\n }\n }\n }else {\n if($product->quantity >= 1){\n $this->products_id = [\"$product->id\"=>1];\n $ajout = true;\n }\n }\n if($ajout){\n $this->total_product ++;\n if($this->discountisused){\n $this->total_price += ($product->price - $product->price * $this->discounts[$this->discountused]/100);\n $this->discountamount += $product->price*$this->discounts[$this->discountused]/100;\n }\n\n else\n $this->total_price += $product->price;\n }\n}", "public function addOrderedItemsToStock($order)\r\n {\r\n \t$nVersion = Mage::getModel('paymentsensegateway/direct')->getVersion();\r\n \t$isCustomStockManagementEnabled = Mage::getModel('paymentsensegateway/direct')->getConfigData('customstockmanagementenabled');\r\n\t\t\r\n \tif($nVersion >= 1410 &&\r\n \t\t$isCustomStockManagementEnabled)\r\n \t{\r\n\t \t$items = $order->getAllItems();\r\n\t\t\tforeach ($items as $itemId => $item)\r\n\t\t\t{\r\n\t\t\t\t// ordered quantity of the item from stock\r\n\t\t\t\t$quantity = $item->getQtyOrdered();\r\n\t\t\t\t$productId = $item->getProductId();\r\n\t\t\t\t\r\n\t\t\t\t$stock = Mage::getModel('cataloginventory/stock_item')->loadByProduct($productId);\r\n\t\t\t\t$stockManagement = $stock->getManageStock();\r\n\t\t\t\t\r\n\t\t\t\tif($stockManagement)\r\n\t\t\t\t{\r\n\t\t\t\t\t$stock->setQty($stock->getQty() + $quantity);\r\n\t\t\t\t\t$stock->save();\r\n\t\t\t\t}\r\n\t\t\t}\r\n \t}\r\n }", "public function addOrder(Order $order);", "function AddToCart($token, $product_name, $product_id, $purchased_amount)\n {\n $order_number = $this->GetOrderNumber();\n $id = $this->GetUserId($token);\n // die();\n $order_number = md5($order_number . $id);\n $this->AddOrdertoCart($id, $order_number);\n $product_data = $this->CheckProductAvailability($product_name, $product_id, $purchased_amount);\n $product_remain = $product_data[0];\n $product_id = $product_data[1];\n if ($product_remain > -1) {\n $this->AddProducttoCart($order_number, $product_id, $purchased_amount, $product_remain, $token);\n } else {\n echo \" Required product is not available!\";\n }\n }", "public function addToOrder($productId, $insertId, $quantity){\n\t\t// papares the request\n\t\t$ch = curl_init();\n\t\tcurl_setopt($ch, CURLOPT_URL, \"http://\" . IP . \"/bde_site/api/contain/\" . $productId);\n\t\tcurl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);\n\t\tcurl_setopt($ch, CURLOPT_POST, true);\n\t\tcurl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json', 'Authorization: ' . TOKEN));\n\t\tcurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['id_product' => $productId,'id_purchase' => $insertId,'quantity' => $quantity]));\n\n\t\t// send the request\n\t\t$output = curl_exec($ch);\n\t\t$info = curl_getinfo($ch);\n\t\tcurl_close($ch);\n\n\n\t}", "public function addProduct(Mage_Catalog_Model_Product $product)\n {\n $this->_products[$product->getId()] = $product;\n }", "function add($product_id)\n\t{\n\t\t$product = $this->database->getProductbyId($product_id);\n\n\t\tif($product)\n\t\t{\n\t\t\t$this->_add_to_cart($product);\n\t\t}\n\t\t\n\t\t$this->_show_add_to_cart_comment($product['add_to_cart_comment']);\n\t\t\n\t\tredirect('cart');\n\t}", "private function attach_order($request,$client){\n $order=$client->orders()->create([]);\n $order->products()->attach($request->products);\n $total_price=0;\n foreach ($request->products as $id=>$quantity){\n $product=Product::findOrFail($id);\n $total_price+=$quantity['quantity'] * $product->sale_price;\n $product->update([\n 'stock'=>$product->stock - $quantity['quantity']\n ]);\n }\n\n $order->update([\n 'total_price'=>$total_price\n ]);\n\n }", "function add_product($voucher_id, $prod_id, $seq=NULL)\n\t{\n\t\t// get the next seq\n\t\tif(is_null($seq))\n\t\t{\n\t\t\t$seq = $this->get_next_sequence($voucher_id);\n\t\t}\n\t\t\t\n\t\t\t\n\t\t$this->db->insert('vouchers_products', array('voucher_id'=>$voucher_id, 'product_id'=>$prod_id, 'sequence'=>$seq));\t\n\t}", "public function addToCart(): void\n {\n //añadimos un Item con la cantidad indicada al Carrito\n Cart::add($this->oferta->id, $this->product->name, $this->oferta->getRawOriginal('offer_prize'), $this->quantity);\n //emite al nav-cart el dato para que lo actualize\n $this->emitTo('nav-cart', 'refresh');\n }", "function add_product($product){\n if($this->_check_product_in_db($product)){\n return False; // Product already in database\n }else{\n array_push($this->db, $product);\n return True;\n }\n }", "public function store(Request $request)\n {\n $user = Auth::User();\n $cart = DB::table('orders')\n ->select('id')\n ->where('status_id', '=', 1)\n ->where('user_id', '=', $user->id)\n ->value('id');\n\n if(empty($cart)) {\n $order = new Order;\n $order->user_id = $user->id;\n $order->status_id = 1;\n $order->save();\n\n $orderProduct = new OrderProduct;\n $orderProduct->order_id = $order->id;\n $orderProduct->product_id = $request->product_id;\n $orderProduct->quantity = $request->quantity;\n $orderProduct->save();\n } else {\n // if you already have this product in your cart just add the next quantity to the same line item\n if (OrderProduct::where('order_id', $cart)->where('product_id', $request->product_id)->exists() ){\n $repeatOrderProduct = OrderProduct::where('order_id', $cart)->where('product_id', $request->product_id)->first();\n $orderProduct = OrderProduct::find($repeatOrderProduct->id);\n $orderProduct->product_id = $request->product_id;\n $orderProduct->quantity = $request->quantity + $orderProduct->quantity;\n $orderProduct->save();\n }\n // else make a new line item for this new item\n else {\n $orderProduct = new OrderProduct;\n $orderProduct->order_id = $cart;\n $orderProduct->product_id = $request->product_id;\n $orderProduct->quantity = $request->quantity;\n $orderProduct->save();\n }\n }\n\n Activity::log('Saved an item to their cart.', $user->id);\n\n $request->session()->flash('status', 'Product was saved to cart.');\n\n return Redirect::action('CartController@index');\n\n }", "public function addProductLine( $product_id, $combination_id = null, $quantity = 1.0, $params = [] )\n {\n // Do the Mambo!\n $line_type = 'product';\n\n // Customer\n $customer = $this->customer;\n $salesrep = array_key_exists('sales_rep_id', $params) \n ? SalesRep::find( (int) $params['sales_rep_id'] ) \n : $customer->salesrep;\n \n // Currency\n $currency = $this->document_currency;\n\n // Product\n if ($combination_id>0) {\n $combination = Combination::with('product')->with('product.tax')->findOrFail(intval($combination_id));\n $product = $combination->product;\n $product->reference = $combination->reference;\n $product->name = $product->name.' | '.$combination->name;\n } else {\n $product = Product::with('tax')->findOrFail(intval($product_id));\n }\n\n $reference = $product->reference;\n $name = array_key_exists('name', $params) \n ? $params['name'] \n : $product->name;\n\n $measure_unit_id = $product->measure_unit_id;\n\n $package_measure_unit_id = array_key_exists('package_measure_unit_id', $params) \n ? $params['package_measure_unit_id'] \n : $product->measure_unit_id;\n\n $pmu_conversion_rate = 1.0; // Temporarily default\n\n $pmu_label = ''; // Temporarily default\n\n // Measure unit stuff...\n if ( $package_measure_unit_id != $measure_unit_id )\n {\n $mu = $product->measureunits->where('id', $measure_unit_id )->first();\n $pmu = $product->measureunits->where('id', $package_measure_unit_id)->first();\n\n $pmu_conversion_rate = $pmu->conversion_rate;\n\n $quantity = $quantity * $pmu_conversion_rate;\n\n $pmu_label = array_key_exists('pmu_label', $params) && $params['pmu_label']\n ? $params['pmu_label'] \n : $pmu->name.' : '.(int) $pmu_conversion_rate.'x'.$mu->name;\n \n }\n\n // $cost_price = $product->cost_price;\n // Do this ( because of getCostPriceAttribute($value) ):\n $cost_price = $product->getOriginal('cost_price');\n $cost_average = $product->cost_average;\n\n // Tax\n $tax = $product->tax;\n $taxing_address = $this->taxingaddress;\n $tax_percent = $tax->getTaxPercent( $taxing_address );\n $sales_equalization = array_key_exists('sales_equalization', $params) \n ? $params['sales_equalization'] \n : $customer->sales_equalization;\n\n // Product Price\n $price = $product->getPrice();\n// if ( $price->currency->id != $currency->id ) {\n// $price = $price->convert( $currency );\n// }\n $unit_price = $price->getPrice();\n\n // Calculate price per $customer_id now!\n // $customer_price = $product->getPriceByCustomer( $customer, $quantity, $currency );\n $customer_price = $product->getPriceByCustomerPriceList( $customer, $quantity, $currency );\n\n // Is there a Price for this Customer?\n if (!$customer_price) return null; // Product not allowed for this Customer\n\n $customer_price->applyTaxPercent( $tax_percent );\n $unit_customer_price = $customer_price->getPrice();\n\n // Still with me? \n if ( $package_measure_unit_id != $measure_unit_id &&\n \n // Is there any package rule?\n $pack_rule = $customer->getPackageRule( $product, $package_measure_unit_id, $currency ) )\n {\n // Calculate quantity conversion\n $pmu_conversion_rate = $pack_rule->conversion_rate;\n $pmu_label = $pack_rule->name;\n\n // Assumes $pack_rule is not null\n // $package_price = $pack_rule->price;\n $customer_final_price = new Price( $pack_rule->getUnitPrice() );\n $customer_final_price->applyTaxPercent( $tax_percent );\n\n // Still one thing left: rule_type = 'promo' (avoid)\n $promo_rule = null;\n \n\n } else {\n //\n $customer_final_price = $product->getPriceByCustomerPriceRules( $customer, $quantity, $currency );\n\n // Still one thing left: rule_type = 'promo'\n $promo_rule = $customer->getExtraQuantityRule( $product, $currency );\n }\n\n\n\n \n if ( !$customer_final_price )\n $customer_final_price = clone $customer_price; // No price Rules available\n \n // Better price?\n if ( $customer_final_price->getPrice() > $unit_customer_price )\n {\n $customer_final_price = clone $customer_price;\n }\n $unit_customer_final_price = $customer_final_price->getPrice();\n\n\n // Still one thing left: rule_type = 'promo'\n $extra_quantity = 0.0;\n $extra_quantity_label = '';\n\n if ($promo_rule)\n {\n // First: Does it apply?\n if ( $unit_customer_final_price == $unit_customer_price ) // No price rule has been applied\n {\n $extra_quantity = floor( $quantity / $promo_rule->from_quantity ) * $promo_rule->extra_quantity;\n $extra_quantity_label = $extra_quantity > 0 ? $promo_rule->name : '';\n }\n }\n\n\n\n // Price Policy\n $pricetaxPolicy = array_key_exists('prices_entered_with_tax', $params) \n ? $params['prices_entered_with_tax'] \n : $customer_price->price_is_tax_inc;\n/*\n // Customer Final Price\n if ( array_key_exists('prices_entered_with_tax', $params) && array_key_exists('unit_customer_final_price', $params) )\n {\n $unit_customer_final_price = new Price( $params['unit_customer_final_price'], $pricetaxPolicy, $currency );\n\n $unit_customer_final_price->applyTaxPercent( $tax_percent );\n\n } else {\n\n $unit_customer_final_price = clone $customer_price;\n }\n*/\n // Discount\n $discount_percent = array_key_exists('discount_percent', $params) \n ? $params['discount_percent'] \n : 0.0;\n\n // Final Price\n $final_price = clone $customer_final_price;\n// if ( $discount_percent ) \n// $unit_final_price->applyDiscountPercent( $discount_percent );\n\n // Sales Rep\n $sales_rep_id = array_key_exists('sales_rep_id', $params) \n ? $params['sales_rep_id'] \n : optional($salesrep)->id;\n \n $commission_percent = array_key_exists('sales_rep_id', $params) && array_key_exists('commission_percent', $params) \n ? $params['commission_percent'] \n : optional($salesrep)->getCommission( $product, $customer ) ?? 0.0;\n\n\n\n // Misc\n $line_sort_order = array_key_exists('line_sort_order', $params) \n ? $params['line_sort_order'] \n : $this->getNextLineSortOrder();\n/*\n $extra_quantity = array_key_exists('extra_quantity', $params) \n ? $params['extra_quantity'] \n : 0.0;\n\n $extra_quantity_label = array_key_exists('extra_quantity_label', $params) \n ? $params['extra_quantity_label'] \n : '';\n*/\n $notes = array_key_exists('notes', $params) \n ? $params['notes'] \n : '';\n\n\n // Build OrderLine Object\n $data = [\n 'line_sort_order' => $line_sort_order,\n 'line_type' => $line_type,\n 'product_id' => $product_id,\n 'combination_id' => $combination_id,\n 'reference' => $reference,\n 'name' => $name,\n 'quantity' => $quantity,\n 'measure_unit_id' => $measure_unit_id,\n 'extra_quantity' => $extra_quantity,\n 'extra_quantity_label' => $extra_quantity_label,\n\n 'package_measure_unit_id' => $package_measure_unit_id,\n 'pmu_conversion_rate' => $pmu_conversion_rate,\n 'pmu_label' => $pmu_label,\n\n 'prices_entered_with_tax' => $pricetaxPolicy,\n \n 'cost_price' => $cost_price,\n 'cost_average' => $cost_average,\n 'unit_price' => $unit_price,\n 'unit_customer_price' => $unit_customer_price,\n 'unit_customer_final_price' => $customer_final_price->getPrice(),\n 'unit_customer_final_price_tax_inc' => $customer_final_price->getPriceWithTax(),\n 'unit_final_price' => $final_price->getPrice(),\n 'unit_final_price_tax_inc' => $final_price->getPriceWithTax(), \n 'sales_equalization' => $sales_equalization,\n 'discount_percent' => $discount_percent,\n 'discount_amount_tax_incl' => 0.0, // floatval( $request->input('discount_amount_tax_incl', 0.0) ),\n 'discount_amount_tax_excl' => 0.0, // floatval( $request->input('discount_amount_tax_excl', 0.0) ),\n\n 'total_tax_incl' => $quantity * $final_price->getPriceWithTax(),\n 'total_tax_excl' => $quantity * $final_price->getPrice(),\n\n 'tax_percent' => $tax_percent,\n 'commission_percent' => $commission_percent,\n 'notes' => $notes,\n 'locked' => 0,\n \n // 'customer_order_id',\n 'tax_id' => $tax->id,\n 'sales_rep_id' => $sales_rep_id,\n ];\n\n $extra_data = [];\n\n // Ecotaxes stuff\n if ( Configuration::isTrue('ENABLE_ECOTAXES') && ($product->ecotax_id>0) )\n {\n //\n $extra_data = [\n 'ecotax_id' => $product->ecotax_id,\n 'ecotax_amount' => $product->ecotax->amount,\n 'ecotax_total_amount' => $quantity * $product->ecotax->amount,\n ];\n }\n\n $data += $extra_data;\n\n\n // Finishing touches\n $lineClass = $this->getClassName().'Line';\n $document_line = ( new $lineClass() )->create( $data );\n\n $this->lines()->save($document_line);\n\n\n // Let's deal with taxes\n $product->sales_equalization = $sales_equalization;\n $rules = $product->getTaxRules( $this->taxingaddress, $this->customer );\n\n $document_line->applyTaxRules( $rules );\n\n // Hummm! What about extra units (quantity at no cost)?\n if ( $extra_quantity > 0.0 )\n {\n // Re-Build OrderLine Object\n $data['line_sort_order'] = $line_sort_order + 1; // Stay close to previous line, because this line \"is a child of\" previous line\n $data['quantity'] = $extra_quantity;\n\n $data['extra_quantity'] = 0.0;\n $data['extra_quantity_label'] = '';\n\n $data['unit_customer_final_price'] = 0.0;\n $data['unit_customer_final_price_tax_inc'] = 0.0;\n\n $data['unit_final_price'] = 0.0;\n $data['unit_final_price_tax_inc'] = 0.0;\n\n $data['total_tax_incl'] = 0.0;\n $data['total_tax_excl'] = 0.0;\n\n $data['notes'] = $extra_quantity_label;\n\n // Add extra line\n $document_extra_line = ( new $lineClass() )->create( $data );\n\n $this->lines()->save($document_extra_line);\n\n\n // Let's deal with taxes\n $document_extra_line->applyTaxRules( $rules );\n }\n\n\n // Now, update Document Totals\n $this->makeTotals();\n\n\n // Good boy, bye then\n return $document_line;\n\n }", "public function store(StoreOrderProductRequest $request)\n {\n $orderId = $request->get('order_id');\n $order = $this->order->newQuery()->with('user')->findOrFail($orderId);\n\n $this->authorize('update', $order);\n\n $productId = $request->get('product_id');\n $product = $this->product->newQuery()->findOrFail($productId);\n\n $userPriceColumn = 'price' . $order->user->price_group;\n\n $count = 1;\n $price = $product->$userPriceColumn * $this->exchangeRates->getRate();\n\n if (!$price){\n return back()->withErrors([trans('validation.product_has_not_price')]);\n }\n\n DB::beginTransaction();\n $order->products()->attach($productId, compact('count', 'price'));\n $this->updateOrder($order, $count * $price);\n DB::commit();\n\n event(new OrderUpdatedByManager($order));\n\n return redirect(route('admin.order.show', ['order_id' => $orderId]));\n }", "private function addProduct($productData){\n if( $this->model_extension_module_export_yml->isProductExist($productData['model']) ) {\n $this->model_extension_module_export_yml->updateProduct($productData);\n }else {\n $this->model_extension_module_export_yml->insertProduct($productData);\n }\n }", "public function add_product_to_basket_post() {\n $user_id = $this -> post('user_id') ? $this -> post('user_id') : \"\";\n $special_id = (int) $this -> post('special_id') ? (int) $this -> post('special_id') : 0;\n $product_id = $this -> post('product_id') ? $this -> post('product_id') : \"\";\n $product_count = (int) $this -> post('product_count') ? (int) $this -> post('product_count') : \"1\";\n $addToShoppingList = trim($this -> post('add_to_shopping_list')) ? strtolower($this -> post('add_to_shopping_list')) : \"no\";\n $retailer_id = $this -> post('retailer_id') ? $this -> post('retailer_id') : \"\";\n $store_id = $this -> post('store_id') ? $this -> post('store_id') : \"\";\n $remove_previous = trim($this -> post('remove_previous')) ? trim( strtolower($this -> post('remove_previous'))) : \"no\";\n \n $allToAdd = \"No\";\n $isProductExist = \"No\";\n \n # Get Store details\n $storeDetails = $this -> basketmodel ->get_store_details($store_id);\n if($storeDetails)\n {\n $storeTypeId = $storeDetails['StoreTypeId'];\n \n # Get products StorePrice \n $productStorePrice = $this -> productmodel ->get_product_store_price($product_id,$retailer_id,$storeTypeId,$store_id);\n \n if($productStorePrice > 0 )\n {\n $allToAdd = \"Yes\"; \n }\n }\n \n if($allToAdd == \"Yes\")\n {\n # Remove all products from user's basket\n if( $remove_previous == 'yes')\n {\n $isRemoved = $this -> basketmodel -> remove_user_basket($user_id); \n }\n \n $result = $this -> basketmodel -> add_product_to_basket($special_id, $product_id, $user_id, $product_count,$retailer_id,$store_id);\n \n # Add to shopping list starts\n if($addToShoppingList == 'yes'){ \n \n # Get shopping list\n $shopping_list = $this -> quickshoppingmodel -> get_list($user_id);\n\n $shopping_list_array = array();\n if (!empty($shopping_list['ShoppingList'])) {\n $shopping_list_array = explode(\",\", $shopping_list['ShoppingList']);\n }\n\n $item_details = array();\n if (!empty($shopping_list_array)) {\n foreach ($shopping_list_array as $item) {\n $item = str_replace('|||', ',', $item);\n $item_array = explode(':::', $item);\n\n $item_array['name'] = $item_array[0];\n $item_array['product_id'] = $item_array[1];\n $item_array['retailer_id'] = $item_array[2];\n $item_array['store_type_id'] = $item_array[3];\n $item_array['store_id'] = $item_array[4];\n \n if( $item_array['product_id'] == $product_id){\n $item_array['count'] = $product_count;\n $isProductExist = \"Yes\";\n }else{\n $item_array['count'] = $item_array[5];\n }\n \n $item_array['bought'] = isset($item_array[6]) ? $item_array[6] : '0';\n\n unset($item_array[0], $item_array[1], $item_array[2], $item_array[3], $item_array[4], $item_array[5], $item_array[6]);\n $item_array['is_special'] = \"0\";\n\n $user_pref_retailer = $this -> basketmodel -> get_user_preferred_retailer($user_id);\n $product = $this -> productmodel -> product_details($item_array['product_id'], $user_pref_retailer -> Id, $user_id,$special_id);\n\n $product_price = $product['store_price'];\n if ($product['SpecialPrice'] > 0) {\n $product_price = $product['SpecialPrice'];\n $item_array['is_special'] = \"1\";\n }\n if ($product['SpecialPrice'] > 0 && $product['SpecialQty'] > 1) {\n $product_price = $product['SpecialPrice'] / $product['SpecialQty'];\n }\n if ($item_array['count'] > 1) {\n $product_price = $product_price * $item_array['count'];\n }\n $prod_price_arr = explode('.', $product_price);\n if (!isset($prod_price_arr[1])) {\n\n if ($product_price <= 0) {\n $product_price = '0.00';\n }\n else {\n $product_price = $product_price . '.00';\n }\n $item_array['price'] = $product_price;\n }\n else {\n $product_price = round($product_price, 2);\n $prod_price_arr = explode('.', $product_price);\n if (!isset($prod_price_arr[1])) {\n $product_price = $product_price . '.00';\n }\n elseif(strlen($prod_price_arr[1]) === 1){\n $product_price = $prod_price_arr[0].'.'.$prod_price_arr[1].'0';\n }\n $item_array['price'] = $product_price.'';\n }\n\n $item_details[] = $item_array;\n }\n }\n \n # Add new Item\n if( $isProductExist == \"No\" )\n { \n $userPreferrences = $this -> basketmodel -> get_user_preferred_retailer($user_id);\n $productDetails = $this -> productmodel -> product_details($product_id, $userPreferrences -> Id, $user_id,$special_id);\n\n $new_item_array = array ();\n $new_item_array['name'] = $productDetails['ProductName'];\n $new_item_array['product_id'] = $product_id;\n $new_item_array['retailer_id'] = $userPreferrences -> Id;\n $new_item_array['store_type_id'] = $userPreferrences -> StoreTypeId;\n $new_item_array['store_id'] = $userPreferrences -> StoreId;\n $new_item_array['count'] = $product_count;\n $new_item_array['bought'] = '0';\n $new_item_array['is_special'] = '0';\n\n $product_price = $productDetails['store_price'];\n if ($productDetails['SpecialPrice'] > 0) {\n $product_price = $productDetails['SpecialPrice'];\n $new_item_array['is_special'] = \"1\";\n }\n if ($productDetails['SpecialPrice'] > 0 && $productDetails['SpecialQty'] > 0) {\n $product_price = $productDetails['SpecialPrice'] / $productDetails['SpecialQty'];\n }\n if ($new_item_array['count'] > 1) {\n $product_price = $product_price * $new_item_array['count'];\n }\n $prod_price_arr = explode('.', $product_price);\n if (!isset($prod_price_arr[1])) {\n if ($product_price <= 0) {\n $product_price = '0.00';\n }\n else {\n $product_price = $product_price . '.00';\n }\n $new_item_array['price'] = $product_price;\n }\n else {\n $product_price = round($product_price, 2);\n $prod_price_arr = explode('.', $product_price);\n if (!isset($prod_price_arr[1])) {\n $product_price = $product_price . '.00';\n }\n elseif(strlen($prod_price_arr[1]) === 1){\n $product_price = $prod_price_arr[0].'.'.$prod_price_arr[1].'0';\n }\n $new_item_array['price'] = $product_price.'';\n }\n $item_details[] = $new_item_array;\n }//if( $isProductExist = \"No\" )\n\n $shopping_list_string = '';\n $i = 0;\n foreach($item_details as $singleItem)\n {\n if ($i == 0) {\n $shopping_list_string .= $singleItem['name'] . ':::' . $singleItem['product_id'] . ':::' . $singleItem['retailer_id'] . ':::' . $singleItem['store_type_id'] . ':::' . $singleItem['store_id'] . ':::' . $singleItem['count'] . ':::' . $singleItem['bought'];\n }\n else {\n $shopping_list_string .= ',' . $singleItem['name'] . ':::' . $singleItem['product_id'] . ':::' . $singleItem['retailer_id'] . ':::' . $singleItem['store_type_id'] . ':::' . $singleItem['store_id'] . ':::' . $singleItem['count'] . ':::' . $singleItem['bought'];\n }\n $i++; \n }\n\n $shoppingListData = array(\n 'UserId' => $user_id,\n 'ShoppingList' => $shopping_list_string,\n 'CreatedOn' => date('Y-m-d H:i:s'),\n );\n //Save the user shopping list\n $resultShoppingList = $this -> quickshoppingmodel -> save_list($user_id, $shoppingListData);\n \n } //if($addToShoppingList == 'yes')\n # Add product to shopping list ends\n \n //$basket_count = $this -> basketmodel -> get_basket_count($user_id);\n $basket_count = $this -> basketmodel -> get_user_basket_count($user_id,$retailer_id,$store_id);\n \n if ($result == 'duplicate') {\n $message = \"Product already added to basket\";\n $result = 0;\n }\n else {\n $message = \"Product added to basket successfully\";\n }\n\n if ($result) {\n $retArr['status'] = SUCCESS;\n $retArr['message'] = $message;\n $retArr['basket_count'] = $basket_count;\n $this -> response($retArr, 200); // 200 being the HTTP response code\n die;\n }\n else {\n $retArr['status'] = FAIL;\n $retArr['message'] = $message;\n $this -> response($retArr, 200); // 200 being the HTTP response code\n die;\n }\n \n }else{\n $retArr['status'] = FAIL;\n $retArr['message'] = \"Not allow to add this product.\";\n $this -> response($retArr, 200); // 200 being the HTTP response code\n die; \n }\n }", "public static function placeOrder($dbController, $customerId, $productId, $productQuantity) {\n $sql = \"SELECT * FROM order_processing WHERE customerid = $customerId AND processed = '0' \";\n $result = $dbController->conn->query($sql); \n //case of new order \n if ($result->num_rows == 0) {\n $sql = \"INSERT INTO order_processing(customerid,productid,quantity,processed,shipped)\n\t\t\t\t\t\tVALUES ($customerId,$productId,$productQuantity,0,0)\"; \n $dbController->conn->query($sql); \n $transactionId = $dbController->conn->insert_id;; // get last id\n // case of exist order\n } else {\n $row = $result->fetch_assoc();\n $transactionId = $row['transaction_id']; \n \n }\n \n //add product to cart\n $sql = \"SELECT * FROM order_product WHERE transaction_id = $transactionId AND product_id = $productId\";\n $result = $dbController->conn->query($sql);\n //case of new product\n if ($result->num_rows == 0) {\n \n $sql = \"INSERT INTO order_product VALUES ($transactionId,$productId,$productQuantity)\";\n }\n //case of exist product\n else {\n $row = $result->fetch_assoc();\n $productQuantity += $row['product_quantity'];\n $sql = \"UPDATE order_product SET product_quantity = $productQuantity \"\n . \"WHERE transaction_id =$transactionId AND product_id = $productId\";\n }\n \n return $dbController->conn->query($sql);\n \n }", "public function addToCart($product, $qtt){\n $this->lines[] = [\"product\" => $product, \"qtt\" => $qtt];\n }", "public function onFrontendCartAddProduct($observer)\n\t{\n\t\ttry {\n\t\t\t$this->_initObserver($observer);\n\t\t\t$quoteId = Mage::getSingleton(\"checkout/session\")->getQuote()->getId();\n\t\t\t$storeId = Mage::app()->getStore()->getStoreId();\n\t\t\t$product = $observer->getEvent()->getProduct();\n\t\t\t$lastCatId = Mage::helper('combine')->checkCategoryIdSanity($this->_getLastCategory(), $storeId);\n\t\t\t$visitorIp = Mage::helper('core/http')->getRemoteAddr(true);\n\n\t\t\t// Check added qty from request, default to 1\n\t\t\t$qtyAdded = $observer->getEvent()->getRequest()->getParam('qty');\n\t\t\t$qtyAdded = is_numeric($qtyAdded) && $qtyAdded > 0 ? $qtyAdded : 1;\n\n\t\t\tSpringbot_Boss::insertEvent(array(\n\t\t\t\t'type' => 'atc',\n\t\t\t\t'sku' => $this->getTopLevelSku($observer),\n\t\t\t\t'sku_fulfillment' => $product->getSku(),\n\t\t\t\t'quote_id' => $quoteId,\n\t\t\t\t'category_id' => $lastCatId,\n\t\t\t\t'store_id' => $storeId,\n\t\t\t\t'quantity' => $qtyAdded,\n\t\t\t));\n\t\t}\n\t\tcatch (Exception $e) {\n\t\t\tSpringbot_Log::error($e->getMessage());\n\t\t}\n\t}", "public function addProducts(array $products);", "public function addItem($order_id)\n\t{\n\n\n\t\t$order = Order::where('id',$order_id)->first();\n\t\t\n\t\t$product = Product::where('id',Input::get('id'))->first();\n\t\t\n\t\t$item = array(\n\t\t\t\t\t'order_id' => $order_id,\n\t\t\t\t\t'product_id' => Input::get('id'),\n\t\t\t\t\t'quantity' => Input::get('quantity'),\n\t\t\t\t\t'name' => $product['name'],\n\t\t\t\t\t'price' => $product['price'],\n\t\t\t\t\t'cost' => $product['cost']\n\n\t\t\t\t);\n\n\t\t$order_item = OrderItem::create($item);\n\t\t\t$order->sync();\n\t\treturn $order_id;\n\t}", "public function add_product() {\n\t\t$values=array(\"product_name\"=>$_POST['product_name'],\"description\"=>$_POST['description']);\n\t\tif($this->insert(\"products\",$values)) {\t\t\t\n\t\t\t$result=$this->runQuery('getAll','select max(id) as id from products');\n\t\t\techo json_encode($result);\n\t\t}\n\t\telse\n\t\t\techo 'Error while inserting product tbl';\n\t}", "public function insertProduct(Product $product);", "public function addItemToOrder($productId, $quantity = 1)\n {\n $product = Doctrine_Core::getTable('Products')->find($productId);\n if($this->itemExists($productId)) {\n $orderdetail = Doctrine_Query::create()\n ->update('Orderdetail od')\n ->set('od.quantity', 'od.quantity + 1')\n ->where('od.Product = ?', $productId)\n ->execute();\n } else {\n $orderdetail = new Orderdetail();\n $orderdetail->order = $this->getOrderId();\n $orderdetail->price = $product['price'];\n $orderdetail->product = $product['id'];\n $orderdetail->quantity = $quantity;\n $orderdetail->sku = $product['sku'];\n $orderdetail->save();\n }\n }", "public function add()\n {\n // get request\n $request = $this->getRequest()->request;\n // get product ID from request\n $product_id = $request['a'];\n // get product ids from session\n $compareProducts = $this->View()->getSession('compare')?$this->View()->getSession('compare'):array();\n\n if (!in_array($product_id, $compareProducts)) {\n $compareProducts[] = $product_id;\n }\n // set products to session\n $this->View()->setSession('compare', $compareProducts);\n\n // for ajax request\n if ($request['XHR']) {\n die(json_encode([\n 'success' => true,\n 'message' => $this->View()->translating('compare_item_set'),\n 'count' => count($compareProducts),\n ]));\n }\n\n Router::redirect('compare');\n }", "public function productAddOrUpdate(Varien_Event_Observer $observer)\n {\n try \n {\n $helper = Mage::helper('increasingly_analytics');\n\n if ($helper->isEnabled())\n {\n $productId = $observer->getEvent()->getProduct()->getId();\n $product = Mage::getModel('catalog/product')->load($productId);\n\n $productFormatHelper = Mage::helper('increasingly_analytics/ProductFormatter'); \n \n $formattedProductInfo = $productFormatHelper->formatProductInfo($product);\n $helper->increasinglyApi($formattedProductInfo,'product_add_or_update','track',$helper->getApiToken(),$helper->getApiSecret());\n }\n\n }\n catch(Exception $e)\n {\n Mage::log(\"Product Add or Update tracking - \" . $e->getMessage(), null, 'Increasingly_Analytics.log');\n }\n }", "public function addProduct($coupon_id, $prod_id, $seq=NULL)\n {\n // get the next seq\n if(is_null($seq))\n {\n $seq = $this->getNextSequence($coupon_id);\n }\n \n \n CI::db()->insert('coupons_products', array('coupon_id'=>$coupon_id, 'product_id'=>$prod_id, 'sequence'=>$seq)); \n }", "public function actionAdd()\n {\n $product_id = $this->getRequest('post','product_id');\n $image_id = $this->getRequest('post','image_id');\n $product = \\common\\models\\Products::find()->where(['id' => $product_id])->one();\n $total = $product->price;\n $count = $this->getRequest('post','count');\n $cover_id = $this->getRequest('post','cover_id');\n $color_id = $this->getRequest('post','color_id');\n\n $cart = new OrderCart();\n $cart->product_id = $product_id;\n $cart->image_id = $image_id;\n $cart->total = $total;\n $cart->count = $count;\n $cart->cover_id = $cover_id;\n $cart->user_id =$this->getUserId();\n $cart->user_hash = $this->getFromSession('id');\n $cart->color_id = $color_id;\n $cart->save();\n $allCart = (new CartsUtil())->getSelfCart();\n foreach($allCart as $k=> $v) {\n if($v['id'] == $cart->id) {\n $discont = (new SalesUtil())->detectSale($v);\n $cart->total = $cart->total - (($discont && isset($discont['sale_val']))\n ? $discont['sale_val']\n : 0 );\n break;\n }\n }\n return ($cart->save()) ? 200 : 400;\n }", "public function addProducts()\n {\n $this->_rootElement->find($this->addProducts)->click();\n }", "function uc_order_add_product_form($form, &$form_state, $order, $node) {\n $data = array();\n if (isset($form_state['values']['product_controls']['qty'])) {\n $data += module_invoke_all('uc_add_to_cart_data', $form_state['values']['product_controls']);\n }\n if (!empty($node->data) && is_array($node->data)) {\n $data += $node->data;\n }\n $node = uc_product_load_variant(intval($form_state['values']['product_controls']['nid']), $data);\n $form['title'] = array(\n '#markup' => '<h3>' . check_plain($node->title) . '</h3>',\n );\n $form['nid'] = array(\n '#type' => 'hidden',\n '#value' => $node->nid,\n );\n $form['qty'] = array(\n '#type' => 'uc_quantity',\n '#title' => theme('uc_qty_label'),\n '#default_value' => 1,\n );\n $form['actions'] = array('#type' => 'actions');\n $form['actions']['submit'] = array(\n '#type' => 'submit',\n '#value' => t('Add to order'),\n '#submit' => array('uc_order_edit_products_add'),\n '#ajax' => array(\n 'callback' => 'uc_order_pane_products_ajax_callback',\n 'wrapper' => 'product-controls',\n ),\n );\n $form['actions']['cancel'] = array(\n '#type' => 'submit',\n '#value' => t('Cancel'),\n '#submit' => array('uc_order_pane_products_select'),\n '#ajax' => array(\n 'callback' => 'uc_order_pane_products_ajax_callback',\n 'wrapper' => 'product-controls',\n ),\n '#limit_validation_errors' => array(),\n );\n $form['node'] = array(\n '#type' => 'value',\n '#value' => $node,\n );\n\n uc_form_alter($form, $form_state, __FUNCTION__);\n\n return $form;\n}", "function add_product($post_data) {\n $this->db->insert('products', $post_data);\n }", "public function actionAddProductList()\n {\n\n $order_id = Yii::app()->request->getQuery('id');\n $model = $this->_loadModel($order_id);\n if ($order_id) {\n if (!Yii::app()->request->isAjaxRequest) {\n $this->redirect(array('/admin/cart/default/update', 'id' => $order_id));\n }\n }\n if (!Yii::app()->request->isAjaxRequest) {\n $this->redirect(array('/admin/cart/default/index'));\n }\n\n $dataProvider = new ShopProduct('search');\n\n if (isset($_GET['ShopProduct']))\n $dataProvider->attributes = $_GET['ShopProduct'];\n\n $this->renderPartial('_addProduct', array(\n 'dataProvider' => $dataProvider,\n 'order_id' => $order_id,\n 'model' => $model,\n ));\n }", "public function add_order()\n {\n if (isset($_SESSION['cart'])) {\n $total_cost = 0;\n $quantity = 0;\n $quaty = \"\";\n foreach ($_SESSION['cart'] as $id => $quaty) {\n $product = Data::find_by_id($id);\n $cost = $product->price * $quaty; // $quaty is quantity.\n $quantity += $quaty;\n $total_cost = $total_cost + $cost;\n }\n if ($quaty > 0) {\n echo \"<p class='text-light pl-2 pr-2 pb-0 m-0'> $quantity </p>\";\n }\n } else {\n echo \"<p class='text-light pl-2 pr-2 pb-0 m-0'> Empty</p>\";\n }\n }", "public function BuyProduct(Product $product) {\t\t\tif (isset($_SESSION[$this->m_orderIdSessionLocation]) == false) {\n\t\t\t\t//skapa en order och spara orderid\n\t\t\t\t$_SESSION[$this->m_orderIdSessionLocation] = $this->CreateNewOrder();\n\t\t\t}\n\t\t\t//TODO:\n\t\t\t//finns det en orderline för den här produkten redan?\n\t\t\t\t//hämta den och öka antalet\n\t\t\t//annars skapa en orderline\n\t\t\t$orderLine = new OrderLine();\n\t\t\t$orderLine->m_orderId = $_SESSION[$this->m_orderIdSessionLocation];\n\t\t\t$orderLine->m_productId = $product->pk;\n\t\t\t\n\t\t\t//spara till databasen\n\t\t\t$this->SaveOrderLine($orderLine);\n\t\t}", "public function addProductToFeed ($args)\n\t{\n\t\t$product = Mage::getModel('catalog/product')->setData($args['row']);\n\t\t/* @var $product Mage_Catalog_Model_Product */\n\t\t\n\t\t// price\n\t\t$taxHelper = Mage::helper('tax');\n\t\tif ($product->isGrouped()) {\n\t\t\t$price = $finalPrice = $taxHelper->getPrice($product, $product->getMinimalPrice());\n\t\t}\n\t\telse {\n\t\t\t$price = $taxHelper->getPrice($product, $product->getPrice());\n\t\t\t$finalPrice = $taxHelper->getPrice($product, $product->getFinalPrice());\n\t\t}\n\n\t\t// required atts\n\t\t$name = trim($product->getData($this->getAttributeMapping('name')));\n\t\t$shortDescription = trim(strip_tags($product->getData($this->getAttributeMapping('short_description'))));\n\n\t\tif (!$price || !$name || !$shortDescription) {\n\t\t\treturn;\n\t\t}\n\n\t\t// add-to-cart URL\n\t\tif ($product->isSuper()) {\n\t\t\t$buyRedirect = $product->getProductUrl();\n\t\t}\n\t\telse {\n\t\t\t$buyRedirect = Mage::getUrl('checkout/cart');\n\t\t}\n\t\t$buyUrlParams = array(\n\t\t\tMage_Core_Controller_Front_Action::PARAM_NAME_URL_ENCODED => Mage::helper('core')->urlEncode($buyRedirect)\n\t\t);\n\t\t$buyUrl = Mage::helper('checkout/cart')->getAddUrl($product, $buyUrlParams);\n\n\t\t$row = array(\n\t\t\t'product_id' => $product->getEntityId(),\n\t\t\t'name' => $name,\n\t\t\t'sku' => (string)$product->getData($this->getAttributeMapping('sku')),\n\t\t\t'primary_category' => $this->getPrimaryCategory($product),\n\t\t\t'secondary_categories' => $this->getSecondaryCategories($product),\n\t\t\t'product_url' => $product->getProductUrl(),\n\t\t\t'product_image_url' => $this->getImageUrl($product, $this->getAttributeMapping('image')),\n\t\t\t'buy_url' => $buyUrl,\n\t\t\t'short_description' => $shortDescription,\n\t\t\t'description' => strip_tags((string)$product->getData($this->getAttributeMapping('description'))),\n\t\t\t'discount' => '',\n\t\t\t'discount_type' => '',\n\t\t\t'sale_price' => $finalPrice,\n\t\t\t'retail_price' => $price,\n\t\t\t'begin_date' => $this->formatDate($product->getData($this->getAttributeMapping('news_from_date'))),\n\t\t\t'end_date' => '',\n\t\t\t'brand' => (string)$product->getData($this->getAttributeMapping('brand')),\n\t\t\t'shipping' => '',\n\t\t\t'is_deleted_flag' => 'N',\n\t\t\t'keywords' => (string)$product->getData($this->getAttributeMapping('meta_keyword')),\n\t\t\t'is_all_flag' => 'Y',\n\t\t\t'manufacturer_part_number' => (string)$product->getData($this->getAttributeMapping('manufacturer_part_number')),\n\t\t\t'manufacturer' => (string)$product->getData($this->getAttributeMapping('manufacturer')),\n\t\t\t'shipping_info' => (string)$product->getData($this->getAttributeMapping('shipping_info')),\n\t\t\t'stock_status' => $product->getSalable() ? Mage::helper('productfeed')->__('In Stock') : Mage::helper('productfeed')->__('Out of Stock'),\n\t\t\t'upc' => (string)$product->getData($this->getAttributeMapping('upc')),\n\t\t\t'class_id' => '',\n\t\t\t'is_product_link_flag' => 'Y',\n\t\t\t'is_storefront_flag' => 'N',\n\t\t\t'is_merchandise_flag' => 'Y',\n\t\t\t'currency' => Mage::app()->getStore($product->getStoreId())->getCurrentCurrencyCode(),\n\t\t\t'm1' => ''\n\t\t);\n\t\t\n\t\t$this->sanitizeRow($row);\n\n\t\t$row = new Varien_Object($row);\n\t\tMage::dispatchEvent('productfeed_addproducttofeed', array('vendor' => $this, 'row' => $row));\n\n\t\t$args['products'][] = implode(self::DELIMITER, $row->getData());\n\t}", "public function add() {\r\n if(isset($this->data) && isset($this->data['Product'])) {\r\n $product = $this->Product->save($this->data);\r\n $this->set('response', array('Products' => $this->Product->findByProductid($product['Product']['ProductID'])));\r\n $this->Links['self'] = Router::url(array('controller' => $this->name, 'action' => 'view', $product['Product']['ProductID']), true);\r\n } else {\r\n $this->Links['self'] = Router::url(array('controller' => $this->name, 'action' => 'index'), true);\r\n }\r\n }", "public function addProduct($productName)\n {\n $item = urlencode($productName);\n $this->produkty[] = $item;\n }", "public function manageOrderProducts()\n {\n }", "public function addProduct()\n {\n foreach($_POST as $key => $value)\n {\n $product[$key] = filter_var($value, FILTER_SANITIZE_STRING);\n }\n\n $stmt = $this->dsn->prepare(\"SELECT * FROM products WHERE code = ? LIMIT 1\");\n $stmt->execute([$product['product_code']]);\n\n $stmt->bindColumn('name', $this->product_name);\n $stmt->bindColumn('price', $this->product_price);\n $stmt->bindColumn('image', $this->product_image);\n\n while($stmt->fetch())\n {\n $product[\"product_name\"] = $this->product_name;\n $product[\"product_price\"] = $this->product_price;\n $product[\"product_image\"] = $this->product_image;\n\n if(isset($_SESSION[\"products\"]))\n {\n if(isset($_SESSION[\"products\"][$product['product_code']]))\n {\n $_SESSION[\"products\"][$product['product_code']][\"product_qty\"] = $_SESSION[\"products\"][$product['product_code']][\"product_qty\"] + $_POST[\"product_qty\"];\n } else {\n $_SESSION[\"products\"][$product['product_code']] = $product;\n }\n } else {\n $_SESSION[\"products\"][$product['product_code']] = $product;\n }\n }\n\n $total_product = count($_SESSION[\"products\"]);\n\n die(json_encode(array('products'=>$total_product)));\n }", "public function add($product_id)\n {\n $product = Product::find($product_id);\n if(!$product)\n {\n abort(404);\n }\n Cart::associate('Product','App\\Models')->add($product_id, $product->name, 1, $product->price);\n return redirect()->route('cart.index');\n }", "public function addProduct(Cart $cartObj) :bool\n {\n $orderObj = new Order();\n $orderObj->createOrder();\n $query = $this->pdo->prepare(\"SELECT orders_products.id from orders_products\nINNER JOIN orders on orders_products.order_id = orders.id\nWHERE orders.user_id = :user_id AND orders.status='cart' AND orders_products.product_id=:product_id\");\n $query->execute(array('product_id'=>$cartObj->getProductId(),'user_id'=> $orderObj->getUserId()));\n $row = $query->fetchALL(PDO::FETCH_ASSOC);\n if (empty($row)) {\n $query = $this->pdo->prepare(\"\n INSERT INTO orders_products\n SELECT NULL,id,:product_id,:quantity FROM orders WHERE user_id = :user_id AND status ='cart'\");\n $query->execute(array\n (\n 'product_id' => $cartObj->getProductId(),\n 'user_id' => $orderObj->getUserId(),\n 'quantity'=>$cartObj->getQuantity()));\n $product = new Product();\n $product->decreaseQuantity($cartObj->getOrderId(), $cartObj->getQuantity());\n unset($query);\n } else {\n $query = $this->pdo->prepare(\"UPDATE orders_products \n SET quantity = quantity+:quantity WHERE product_id =:product_id;\");\n $query->execute(array\n (\n 'product_id'=>$cartObj->getProductId(),\n 'quantity'=>$cartObj->getQuantity()));\n $product = new Product();\n $product->decreaseQuantity($cartObj->getProductId(), $cartObj->getQuantity());\n unset($query);\n }\n return true;\n }", "public function rapidAdd($id){\n $product=Products::find($id);\n $cart= Cart::add([\n'id'=>$product->id,\n'name'=>$product->pro_name,\n'qty'=>1,\n'price'=>$product->pro_price,\n ]);\n Cart::associate($cart->rowId, 'App\\Models\\Products');\nreturn redirect('/cart')->with('info', 'Product added in cart');\n }", "public function actionAddProductList()\n\t{\n\t\t$order_id=Yii::app()->request->getQuery('id');\n\t\t$model = $this->_loadModel($order_id);\n\t\t$dataProvider = new StoreProduct('search');\n\n\t\tif(isset($_GET['StoreProduct']))\n\t\t\t$dataProvider->attributes = $_GET['StoreProduct'];\n\n\t\t$this->renderPartial('_addProduct', array(\n\t\t\t'dataProvider' => $dataProvider,\n\t\t\t'order_id' => $order_id,\n\t\t\t'model' => $model,\n\t\t));\n\t}", "function productToSale($product_id, $order_id, $product_price, $product_amount, $product_name, $product_description){\n\t\t$conn \t= connectDB();\n\t\t$sth \t= $conn -> prepare('INSERT INTO `order_products` (`product_id`, `order_id`, `product_price`, `product_amount`,`product_name`,`product_description`)\n\t\t\t\t\t\t\t\t\tVALUES (?, ?, ?, ?, ?, ?)');\n\t\t$sth \t-> execute(array($product_id, $order_id, $product_price, $product_amount, $product_name, $product_description));\n\t}", "public function add()\n\t{\n\t\t$app = JFactory::getApplication();\n\t\t$option = JRequest::getVar('option');\n\t\t$post = JRequest::get('post');\n\t\t$parent_accessory_productid = $post['product_id'];\n\t\t$Itemid = JRequest::getVar('Itemid');\n\t\t$producthelper = new producthelper;\n\t\t$redhelper = new redhelper;\n\t\t$Itemid = $redhelper->getCartItemid();\n\t\t$model = $this->getModel('cart');\n\n\t\t// Call add method of modal to store product in cart session\n\t\t$userfiled = JRequest::getVar('userfiled');\n\n\t\tJPluginHelper::importPlugin('redshop_product');\n\t\t$dispatcher = JDispatcher::getInstance();\n\t\t$dispatcher->trigger('onBeforeAddProductToCart', array(&$post));\n\n\t\t$result = $this->_carthelper->addProductToCart($post);\n\n\t\tif (is_bool($result) && $result)\n\t\t{\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$errmsg = ($result) ? $result : JText::_(\"COM_REDSHOP_PRODUCT_NOT_ADDED_TO_CART\");\n\n\t\t\tif (AJAX_CART_BOX == 1)\n\t\t\t{\n\t\t\t\techo \"`0`\" . $errmsg;\n\t\t\t\tdie();\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$ItemData = $producthelper->getMenuInformation(0, 0, '', 'product&pid=' . $post['product_id']);\n\n\t\t\t\tif (count($ItemData) > 0)\n\t\t\t\t{\n\t\t\t\t\t$prdItemid = $ItemData->id;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t$prdItemid = $redhelper->getItemid($post['product_id']);\n\t\t\t\t}\n\n\t\t\t\t$link = JRoute::_(\"index.php?option=\" . $option . \"&view=product&pid=\" . $post[\"product_id\"] . \"&Itemid=\" . $prdItemid, false);\n\t\t\t\t$app->Redirect($link, $errmsg);\n\t\t\t}\n\t\t}\n\n\t\t$session = JFactory::getSession();\n\t\t$cart = $session->get('cart');\n\n\t\tif (isset($cart['AccessoryAsProduct']))\n\t\t{\n\t\t\t$attArr = $cart['AccessoryAsProduct'];\n\n\t\t\tif (ACCESSORY_AS_PRODUCT_IN_CART_ENABLE)\n\t\t\t{\n\t\t\t\t$data['accessory_data'] = $attArr[0];\n\t\t\t\t$data['acc_quantity_data'] = $attArr[1];\n\t\t\t\t$data['acc_attribute_data'] = $attArr[2];\n\t\t\t\t$data['acc_property_data'] = $attArr[3];\n\t\t\t\t$data['acc_subproperty_data'] = $attArr[4];\n\n\t\t\t\tif (isset($data['accessory_data']) && ($data['accessory_data'] != \"\" && $data['accessory_data'] != 0))\n\t\t\t\t{\n\t\t\t\t\t$accessory_data = explode(\"@@\", $data['accessory_data']);\n\t\t\t\t\t$acc_quantity_data = explode(\"@@\", $data['acc_quantity_data']);\n\t\t\t\t\t$acc_attribute_data = explode(\"@@\", $data['acc_attribute_data']);\n\t\t\t\t\t$acc_property_data = explode(\"@@\", $data['acc_property_data']);\n\t\t\t\t\t$acc_subproperty_data = explode(\"@@\", $data['acc_subproperty_data']);\n\n\t\t\t\t\tfor ($i = 0; $i < count($accessory_data); $i++)\n\t\t\t\t\t{\n\t\t\t\t\t\t$accessory = $producthelper->getProductAccessory($accessory_data[$i]);\n\t\t\t\t\t\t$post = array();\n\t\t\t\t\t\t$post['parent_accessory_product_id'] = $parent_accessory_productid;\n\t\t\t\t\t\t$post['product_id'] = $accessory[0]->child_product_id;\n\t\t\t\t\t\t$post['quantity'] = $acc_quantity_data[$i];\n\t\t\t\t\t\t$post['category_id'] = 0;\n\t\t\t\t\t\t$post['sel_wrapper_id'] = 0;\n\t\t\t\t\t\t$post['attribute_data'] = $acc_attribute_data[$i];\n\t\t\t\t\t\t$post['property_data'] = $acc_property_data[$i];\n\t\t\t\t\t\t$post['subproperty_data'] = $acc_subproperty_data[$i];\n\n\t\t\t\t\t\t$result = $this->_carthelper->addProductToCart($post);\n\n\t\t\t\t\t\t$cart = $session->get('cart');\n\n\t\t\t\t\t\tif (is_bool($result) && $result)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$errmsg = ($result) ? $result : JText::_(\"COM_REDSHOP_PRODUCT_NOT_ADDED_TO_CART\");\n\n\t\t\t\t\t\t\tif (JError::isError(JError::getError()))\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$error = JError::getError();\n\t\t\t\t\t\t\t\t$errmsg = $error->message;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif (AJAX_CART_BOX == 1)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\techo \"`0`\" . $errmsg;\n\t\t\t\t\t\t\t\tdie();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$ItemData = $producthelper->getMenuInformation(0, 0, '', 'product&pid=' . $post['product_id']);\n\n\t\t\t\t\t\t\t\tif (count($ItemData) > 0)\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t$prdItemid = $ItemData->id;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t$prdItemid = $redhelper->getItemid($post['product_id']);\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t$link = JRoute::_(\"index.php?option=\" . $option . \"&view=product&pid=\" . $post[\"product_id\"] . \"&Itemid=\" . $prdItemid, false);\n\t\t\t\t\t\t\t\t$app->Redirect($link, $errmsg);\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\n\t\t\tif (!DEFAULT_QUOTATION_MODE || (DEFAULT_QUOTATION_MODE && SHOW_QUOTATION_PRICE))\n\t\t\t{\n\t\t\t\t$this->_carthelper->carttodb();\n\t\t\t}\n\n\t\t\t$this->_carthelper->cartFinalCalculation();\n\t\t\tunset($cart['AccessoryAsProduct']);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif (!DEFAULT_QUOTATION_MODE || (DEFAULT_QUOTATION_MODE && SHOW_QUOTATION_PRICE))\n\t\t\t{\n\t\t\t\t$this->_carthelper->carttodb();\n\t\t\t}\n\n\t\t\t$this->_carthelper->cartFinalCalculation();\n\t\t}\n\n\t\tif (!$userfiled)\n\t\t{\n\t\t\tif (AJAX_CART_BOX == 1 && isset($post['ajax_cart_box']))\n\t\t\t{\n\t\t\t\t$link = JRoute::_('index.php?option=' . $option . '&view=cart&ajax_cart_box=' . $post['ajax_cart_box'] . '&tmpl=component&Itemid=' . $Itemid, false);\n\t\t\t\t$app->Redirect($link);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif (ADDTOCART_BEHAVIOUR == 1)\n\t\t\t\t{\n\t\t\t\t\t$link = JRoute::_('index.php?option=' . $option . '&view=cart&Itemid=' . $Itemid, false);\n\t\t\t\t\t$app->Redirect($link);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t$link = JRoute::_($_SERVER['HTTP_REFERER'], false);\n\n\t\t\t\t\tif ($cart['notice_message'] != \"\")\n\t\t\t\t\t{\n\t\t\t\t\t\t$msg = $cart['notice_message'] . \"<br>\";\n\t\t\t\t\t}\n\n\t\t\t\t\t$msg .= JTEXT::_('COM_REDSHOP_PRODUCT_ADDED_TO_CART');\n\t\t\t\t\t$app->Redirect($link, $msg);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$link = JRoute::_('index.php?option=' . $option . '&view=product&pid=' . $post['p_id'] . '&Itemid=' . $Itemid, false);\n\t\t\t$app->Redirect($link);\n\t\t}\n\t}", "public function addProduct($productInfo, $quantity, $request)\n { \n if (empty($this->cart[$productInfo->id])) {\n $product = ['product_id' => $productInfo->id, 'quantity' => $quantity, 'product_name' => $productInfo->product_name, 'product_desc' => $productInfo->product_description, 'product_price' => $productInfo->product_price];\n $this->cart[$productInfo->id] = $product;\n } else {\n $this->addProductCount($productInfo->id, $quantity);\n }\n\n $this->saveCart($request);\n }", "function gc_template_loop_add_to_cart( $args = array() ) {\n\t\tglobal $product;\n\n\t\tif ( $product ) {\n\t\t\t$defaults = array(\n\t\t\t\t'quantity' => 1,\n\t\t\t\t'class' => implode( ' ', array_filter( array(\n\t\t\t\t\t\t'btn btn-outline-secondary gc-add-to-cart',\n\t\t\t\t\t\t'product_type_' . $product->get_type(),\n\t\t\t\t\t\t$product->is_purchasable() && $product->is_in_stock() ? 'add_to_cart_button' : '',\n\t\t\t\t\t\t$product->supports( 'ajax_add_to_cart' ) ? 'ajax_add_to_cart' : '',\n\t\t\t\t) ) ),\n\t\t\t);\n\n\t\t\t$args = apply_filters( 'woocommerce_loop_add_to_cart_args', wp_parse_args( $args, $defaults ), $product );\n\n\t\t\twc_get_template( 'loop/add-to-cart.php', $args );\n\t\t}\n\t}", "public function add_to_cart(Request $request){\n $product = Product::find($request->input('product_id'));\n //On s'assure qu'il y'a bien un produit qui est retourne\n if($product){\n //On enregistre la session cart dans une variable\n $cart = $request->session()->get('cart');\n //On verifie si la cle du produit est deja dans les produits dans la session avant de l'ajouter\n if(!isset($cart['products'][$product->id])){\n //On prepare comment ajouter le produit dans les sessions. Chaque produit dans la sessoin set enregistre dans une cle cart. cette cle contient un\n $cart['products'][$product->id] = ['name' => $product->name, 'price' => $product->price, 'quantite' => 1, \"total\" => $product->price];\n //On ajoute la variable $cart dans les sessions\n $request->session()->put('cart',$cart);\n }\n }\n return response()->json(['success' => true,], 200);\n }", "public function addOrder($order){\n $this->collection[] = $order;\n }", "public static function addItem($id_product, $id_item, $qty)\n {\n }", "public function storeProduct();", "public function postAdd(Request $request, $product_id) {\n $cart = new Carts();\n $mycart = $cart->getCustomerCarts(Auth::guard('web')->user()->id);\n $data_items['desgin_detail'] = $request->desgin_detail;\n $data_items['desgin_link'] = $request->desgin_link;\n $data_items['spec'] = json_encode($request->spec);\n $data_items['product_width'] = $request->product_width ? $request->product_width : 0;\n $data_items['product_height'] = $request->product_height ? $request->product_height : 0;\n $data_items['qty'] = $request->qty ? $request->qty : 1;\n $data_items['product_id'] = $product_id;\n if ($request->page_no) {\n $data_items['page_no'] = $request->page_no;\n }\n\n if ($mycart) {\n //if yes add to order items\n $data_items['cart_id'] = $mycart->id;\n } else {\n //if no create then add to order items\n $data['customer_id'] = Auth::guard('web')->user()->id;\n $order_id = Carts::create($data)->id;\n $data_items['cart_id'] = $order_id;\n }\n $order_id = CartsItems::create($data_items);\n $request->session()->flash('success', 'تمت اضافة المنتج');\n return redirect('cart');\n }", "public function testAddProductToCart()\n {\n $this->browse(function (Browser $browser) {\n // Home Page\n $browser->visit(new HomePage);\n\n // Get Collection Name\n $collectionName = $browser->text('.thumbnail .caption a');\n\n // Products Page\n $browser->clickLink($collectionName)\n ->assertSee($collectionName);\n\n // Get Product Name\n $productName = $browser->text('.thumbnail .caption a');\n\n $browser->clickLink($productName)\n // Product Page\n ->assertSee($productName)\n ->press('Add To Cart')\n ->assertSee('Product has been added to your cart.')\n // Cart Page\n ->visit('/cart')\n ->assertSee($productName);\n });\n }", "public function addProduct(Product $product): CurrentCart;", "function old_pushCart($product_id,$quantity,$transport) \n {\n $conn=connect();\n $query= \"INSERT INTO shopping_cart(user_id,delivery,product_id,quantity) VALUES (\".$this->user_id.\",\".$transport.\",\".$product_id.\",\".$quantity.\")\"; //obtain information about a product\n if($results = mysqli_query($conn, $query)) //to add to the cart\n {\n $last_id =mysqli_insert_id($conn);\n $this->cart->addProduct($last_id, $product_id,$transport,$quantity);\n }\n mysqli_close($conn);\n \n \n }", "public function store(Request $request)\n {\n //Validate Data\n// $request->validate([\n// 'code' => 'required|string|max:255|unique:products,code,' . $product->id\n// ]);\n $products = json_decode($request->products, true);\n $customer_id = $request->customer_id;\n $user_id = $request->user_id;\n $total_new_price = $request->total_new_price;\n $customer_department = $request->department;\n\n $order = new Order();\n $order->user_id = $user_id;\n $order->customer_id = $customer_id;\n $order->code = 'HW' . strtoupper(Str::random(3)) . date(\"Ymd\");\n $order->total_price = $total_new_price;\n $order->customer_department = $customer_department;\n\n if ($order->save()) {\n $customer = Customer::find($customer_id);\n $product_ids = array_column($products, 'id');\n// $customer->products()->attach($product_ids, ['order_id' => $order->id]);\n $customer->products()->syncWithoutDetaching($product_ids);\n foreach ($products as $product) {\n $order_details = new OrderDetail();\n $order_details->order_id = $order->id;\n $order_details->product_id = $product['id'];\n $order_details->new_price = $product['new_price'];\n $order_details->save();\n }\n\n return response()->json([\n 'status' => 200,\n 'message' => 'Order created successfully!',\n 'order' => Order::with('orderdetails.product')->find($order->id),\n ], 200);\n }\n return response()->json([\n 'status' => 500,\n 'message' => 'Some error occurred. Please try again!',\n ], 500);\n }", "public function add() {\n $page = 'basket';\n $id = $_GET['id'];\n\n $product = $this->productManager->findOne($id);\n\n $productInBasket = $this->inBasket($id); //check if the product is in the basket\n\n if(!empty($product) && isset($_SESSION['user']['basket'])) {\n if ($productInBasket)\n $_SESSION['user']['basket'][$id]['quantity']++;\n else\n $_SESSION['user']['basket'][$id] = array(\"product\" => $product, \"quantity\" => 1);\n }\n\n header(\"Location: ./index.php?ctrl=basket&action=consult\");\n require('./View/default.php');\n }", "private function addToCart () {\n }", "private function addToCart () {\n }", "public function setProduct()\n {\n // get the existing products array\n $products = $this->getProducts();\n // push the new product to the array\n array_push($products, $this);\n $file = fopen($_SERVER['DOCUMENT_ROOT'] . \"/mpm_challenge/problem4/db/db.json\", \"w+\") or die(\"not opened\");\n fwrite($file, json_encode($products));\n fclose($file);\n }", "public function addProduct(){\n\t\t// prepares the request\n\t\t$ch = curl_init();\n\t\tcurl_setopt($ch, CURLOPT_URL, \"http://\" . IP . \"/bde_site/api/product/\");\n\t\tcurl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);\n\t\tcurl_setopt($ch, CURLOPT_POST, true);\n\t\tcurl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json', 'Authorization: ' . TOKEN));\n\n\t\t// unset unused attributes from the variable\n\t\tunset($_POST['_token']);\n\t\t\n\t\tcurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($_POST));\n\n\t\t// send the request\n\t\t$output = curl_exec($ch);\n\t\t$info = curl_getinfo($ch);\n\t\tcurl_close($ch);\n\n\t\treturn redirect('/');\n\t}", "public function addProductToCart(Request $request): JsonResponse\n {\n\n // Check if request includes the product\n $product_id = $request->get('product');\n if (!$product_id) {\n return $this->errorResponse('You need to provide a product!', Response::HTTP_BAD_REQUEST);\n }\n\n // Check if product exists in the db\n $product = Product::find($product_id);\n if (!$product) {\n return $this->errorResponse('Couldnt find product', Response::HTTP_NOT_FOUND);\n }\n\n $this->orderHandler->updateCartProductSession($product_id);\n return $this->successResponse([], Response::HTTP_OK);\n }", "public function addToSession($product)\n {\n $session = $this->session;\n\n if ($session->has('cart')) {\n $products = (array)$session->get('cart');\n array_push($products, $product->getHash());\n $session->set('cart', $products);\n } else {\n $products = array($product->getHash());\n $session->set('cart', $products);\n }\n }", "public function add_to_cart($params) {\n if ($params[0]) {\n $_REQUEST['id_item'] = $params[0];\n $_REQUEST['quantity'] = 1;\n }\n\n $hash = self::getHash();\n $cart = $this->NeoCartModel->getCart($hash);\n\n //hai sa bagam produsul in shopping cart\n $this->NeoCartModel->addToCart($_REQUEST, $cart);\n\n controller::set_alert_message(\"<br/>Produsul a fost adaugat in cos\");\n header(\"Location: \" . $this->getRefPage());\n exit();\n }", "public function create(OrderProduct $item): OrderProduct;", "public function placeorder(Request $request)\n {\n if(!Session::has('customerlogin'))\n {\n return redirect('customer/signup');\n }\n\n $order = new Order;\n $order->customer_id = Session::get('customerid');\n $order->total_quantity = $request->total_quantity;\n $order->total_price = $request->total_price;\n $order->shipping_cost = $request->shipping_cost;\n $order->payment_method = $request->payment_method;\n $order->transaction_no = $request->transaction_no;\n $order->total_amount = $request->total_amount;\n $order->order_billingaddress = Session::get('customer_billing_address');\n $order->order_status = 'pending';\n $order->save();\n\n $lastid = Order::where('order_status', 'pending')->orderBy('id','desc')->limit(1)->get()->toArray();\n $orderproducts = Cart::with(['product'])->get()->toArray();\n foreach ($orderproducts as $orderproduct) {\n $op = new Orderproduct;\n $op->order_id = $lastid[0]['id'];\n $op->product_id = $orderproduct['product_id'];\n $op->quantity = $orderproduct['quantity'];\n $op->price = $orderproduct['product']['sale_price'];\n $op->total_price = $orderproduct['quantity'] * $orderproduct['product']['sale_price'];\n $op->total_amount = $orderproduct['quantity'] * $orderproduct['product']['sale_price'];\n $op->size = 'XL'; //'not dynamic'\n $op->order_pro_status = 'pending';\n $op->save();\n }\n\n $orderdata = Order::where('customer_id',Session::get('customerid'))->orderBy('id','desc')->limit(1)->get()->toArray(); \n //Remove products from cart for specific session and user\n Cart::where('session_key',Session::getId())->delete(); \n Cart::where('customer_id',Session::get('customerid'))->delete(); \n return redirect('order/confirmation/'.$orderdata[0]['id']);\n }", "public function addItem( $variant_id,\\Shop\\Models\\Products $product, array $post )\r\n {\r\n \r\n $wishlistitem = \\Shop\\Models\\Carts::createItem($variant_id, $product, $post);\r\n \r\n // Is the item already in the wishlist?\r\n // if so, inc quantity\r\n // otherwise add the wishlistitem\r\n $exists = false;\r\n foreach ( $this->items as $key => $item )\r\n {\r\n if ($item['hash'] == $wishlistitem->hash)\r\n {\r\n $exists = true;\r\n $wishlistitem->id = $item['id'];\r\n $wishlistitem->quantity = $wishlistitem->quantity + $item['quantity'];\r\n $this->items[$key] = $wishlistitem->cast();\r\n \r\n break;\r\n }\r\n }\r\n \r\n if (! $exists)\r\n {\r\n $this->items[] = $wishlistitem->cast();\r\n }\r\n \r\n return $this->save();\r\n }", "function addToCart(){\n\t\tif(!isset($_POST['id'])) header(sprintf(\"Location: %s\", $this->Files['Cart']));\n\t\t// ---------- These are our posted variables --------------\t\t\n\t\t$TmpCart=array();\n\t\t$TmpCart['type'] \t= 1;\n\t\t$TmpCart['name'] \t= clean_variable($_POST['name'],true);\n\t\t$TmpCart['id']\t \t= clean_variable($_POST['id'],true);\n\t\t$TmpCart['qty'] \t= (is_int($_POST['qty']) && isset($_POST['qty']))?clean_variable($_POST['qty'],true):'1';\n\t\t$TmpCart['price'] = clean_variable($_POST['price'],true);\n\t\t\n\t\t// Process Products Specs and Attributes\n\t\t$SPC = \t\t\t(isset($_POST['spec'])) ? \n\t\t\t\t\t\t\t\t\t((!is_array($_POST['spec'])) ? array( $_POST['spec'] ) : $_POST['spec']):\n\t\t\t\t\t\t\t\tarray();\n\t\tif(is_array($SPC)) foreach($SPC as &$v) clean_variable($v,true);\n\t\t\n\t\t$TmpStrg = '';\n\t\tif(count($SPC) > 0){ /* // Check the Specs of the product and get the price for that spec. If differant use that price\n\t\t\tforeach($SPC as $k => $v){ \n\t\t\t\t$getSpecs = new sql_processor($this->DB,$this->Conn,$this->Gateway);\n\t\t\t\t$getSpecs->mysql(\"SELECT `att_price`, `att_sale`, `att_sale_exp` FROM `prod_link_prod_att` WHERE `att_id` = '$v' AND `prod_id` = '\".$TmpCart['id'].\"';\");\n\t\t\t\t$getSpecs->mssql(\"SELECT att_price, att_sale, att_sale_exp FROM prod_link_prod_att WHERE att_id = '$v' AND prod_id = '\".$TmpCart['id'].\"';\");\n\t\t\t\t$getSpecs = $getSpecs->Rows();\n\t\t\t\tif($getSpecs[0]['att_price'] > 0){\n\t\t\t\t\t$attSaleExp = ereg('[^A-Za-z0-9]', $getSpecs[0]['att_sale_exp']);\n\t\t\t\t\tif($attSaleExp == \"00000000000000\") $attprices += $getSpecs[0]['att_price'];\n\t\t\t\t\telse if ($attSaleExp > date(\"YmdHis\")) $attprices += $getSpecs[0]['att_sale'];\n\t\t\t\t\telse $attprices += $getSpecs[0]['att_price'];\n\t\t\t\t} else { $attprices = 0; }\n\t\t\t\t$TmpStrg .= ($TmpStrg == \"\") ? ($v.\".\".$attprices) : (\":\".$v.\".\".$attprices);\n\t\t\t} */\n\t\t}\n\t\t$TmpCart['spec'] = $TmpStrg;\n\t\t\n\t\t// Process Products Special Options\n\t\t$SPCL = \t\t(isset($_POST['special'])) ?\n\t\t\t\t\t\t\t\t\t((!is_array($_POST['special'])) ? array( $_POST['special'] ) : $_POST['special']):\n\t\t\t\t\t\t\t\tarray();\n\t\tif(is_array($SPCL)) foreach($SPCL as &$v) clean_variable($v,true);\n\t\t$TmpCart['special'] = (is_array($SPCL) && count($SPCL) > 0) ? implode(\":\",$SPCL) : $SPCL;\n\t\t\n\t\t\n\t\t$SLCT = \t\t(isset($_POST['selections'])) ?\n\t\t\t\t\t\t\t\t\t((!is_array($_POST['selections'])) ? array( $_POST['selections'] ) : $_POST['selections']):\n\t\t\t\t\t\t\t\tarray();\n\t\tif(is_array($SLCT)) foreach($SLCT as &$v) clean_variable($v,true);\n\t\t$TmpCart['selections'] = (is_array($SLCT) && count($SLCT) > 0) ? implode(\":\",$SLCT) : $SLCT;\n\t\t\n\t\t// Process Products Messages and Comments, mainly used for gift cards\n\t\t$MSG = \t\t\t(isset($_POST['message'])) \t\t\t? clean_variable($_POST['message'],true):'';\n\t\t$MSGTo = \t\t(isset($_POST['message_to'])) \t? clean_variable($_POST['message_to'],true):'';\n\t\t$MSGFrm = \t(isset($_POST['message_from'])) ? clean_variable($_POST['message_from'],true):'';\n\t\t\n\t\t$MSGEng = \t(isset($_POST['message']))?\n\t\t\t\t\t\t\t\t\t((!is_array($_POST['engraving']))? array( $_POST['engraving'] ) : $_POST['engraving'] ):\n\t\t\t\t\t\t\t\t'';\n\t\tif(is_array($MSGEng)) foreach($MSGEng as &$v) clean_variable($v,true);\n\t\t/*\n\t\t$getMsgs = new sql_processor($this->DB,$this->Conn,$this->Gateway);\n\t\t$getMsgs->mysql(\"SELECT `prod_msg_type` FROM `prod_products` WHERE `prod_id` = '\".$TmpCart['id'].\"';\");\n\t\t$getMsgs->mssql(\"SELECT prod_msg_type FROM prod_products WHERE prod_id = '\".$TmpCart['id'].\"';\");\n\t\t$getMsgs = $getMsgs->Rows();\n\t\t$Msgs = $getMsgs[0]['prod_msg_type'];\n\t\t*/\n\t\t$Msgs='';\n\t\tif(strlen(trim($Msgs)) > 0) $Msgs = unserialize(urldecode($Msgs));\n\t\telse $Msgs = array(); $Tarray = array();\n\t\tif(count($Msgs) > 0){\n\t\t\tforeach($Msgs as $k => $v){\n\t\t\t\tswitch($k){\n\t\t\t\t\tcase \"Cmnts\": if(strlen(trim($MSG)) > 0) $Tarray['Cmnts'][0] = $MSG; break; // Straight Comment for the Product\n\t\t\t\t\tcase \"ToFrm\":\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// To From comments for Gift Cards Ect.\n\t\t\t\t\t\tif(strlen(trim($MSGTo)) > 0){\n\t\t\t\t\t\t\t$Tarray['ToFrm'][0] = $MSGTo;\n\t\t\t\t\t\t\t$Tarray['ToFrm'][1] = $MSGFrm;\n\t\t\t\t\t\t} break;\n\t\t\t\t\tcase \"Engv\":\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// Engravings for the product allows for multiple lines\n\t\t\t\t\t\tif(intval($v)>1){ if(strlen(trim($MSGEng)) > 0) $Tarray['Engv'][0] = $MSGEng;\n\t\t\t\t\t\t} else { $n=0; foreach($MSGEng as $v){\n\t\t\t\t\t\t\t\tif(strlen(trim($v)) > 0) $Tarray['Engv'][$n] = $v; $n++;\n\t\t\t\t\t\t\t} \n\t\t\t\t\t\t} break;\n\t\t\t\t}\n\t\t\t} $TmpCart['msgs'] = $Tarray;\n\t\t} else { $TmpCart['msgs'] = 0; }\n\t\t\n\t\t$TmpCart['attnd']\t= \t(isset($_POST['attendee']))? array(clean_variable($_POST['attendee'],true)) : array(0);\n\t\t\n\t\t$this->updateCart($TmpCart); // Update our cart with our new information\n\t\t\n\t\theader(sprintf(\"Location: %s\", $this->Files['Cart'] )); // Go to page to dispaly Cart -- Do this to prevent double insertion of product via refresh button\n\t}", "public function add(Product $product)\n\t{\t\n\t\t//\tObteniendo los productos del carro.\n\t\t$cart = \\Session::get('cart');\n\t\t//\tSi el producto ya esta en el carro se le suma 1 a la cantidad.\n \tif (array_key_exists($product->id, $cart)){\n \t\t$ops = $cart[$product->id]->cantidad;\n \t\t$product->cantidad = $ops+1;\n \t}\n \t//\tSi el producto no estaba su cantidad es 1.\n \telse{\n \t $product->cantidad = 1;\t\n \t}\n \t$cart[$product->id] = $product;\n \t//\tAgregando el producto.\n\t\t\\Session::put('cart',$cart);\n\n\t\treturn redirect()->route('cart-show');\n\n\t}", "public function addToCart($product_row_id) { \n\t\t//echo date('Y-F/j h:i:s a');\n\t\t\n $tracking_number = Session::getId();\n\t\t\t\n\t\t$data['product_details'] = DB::table('products')->where('product_row_id', $product_row_id)->first();\n\n\t \n\t //$count = DB::table('temp_orders')->where([ ['product_row_id', $product_row_id], ['tracking_number', $tracking_number] ])->count();\n\t\t\n\t\n\t DB::table('temp_orders')->insert([ 'product_row_id' => $data['product_details']->product_row_id, 'tracking_number' => $tracking_number, 'product_price' => $data['product_details']->product_price, 'product_qty' => 1, 'product_total_price' => $data['product_details']->product_price, 'created_at' => date('Y-m-d H:i:s'), ]);\n\t\t\n \n return redirect('/mycart'); \n \n }" ]
[ "0.76151925", "0.75026226", "0.74593294", "0.7322352", "0.72309464", "0.7210516", "0.7182966", "0.71815604", "0.7161715", "0.7155723", "0.71552414", "0.7151305", "0.69715744", "0.6949428", "0.6938073", "0.6927607", "0.68773943", "0.6870195", "0.6849754", "0.6826369", "0.6810053", "0.68089575", "0.67730075", "0.67700577", "0.674885", "0.67353886", "0.67287505", "0.6695368", "0.6678713", "0.667521", "0.6645306", "0.662651", "0.6612863", "0.65723056", "0.65678245", "0.65591973", "0.6558015", "0.65577346", "0.65520394", "0.6547388", "0.65366924", "0.65065825", "0.64969635", "0.64966494", "0.649246", "0.6491012", "0.6487197", "0.6473682", "0.64644396", "0.6460855", "0.64607626", "0.6454741", "0.6452109", "0.6449206", "0.6444882", "0.6431889", "0.6418189", "0.6417206", "0.6413073", "0.64024127", "0.64008474", "0.6389796", "0.63873404", "0.6358885", "0.63580394", "0.6354492", "0.63284636", "0.631214", "0.63115656", "0.6303135", "0.6300479", "0.62992036", "0.6278", "0.62750876", "0.6272448", "0.62696284", "0.6264864", "0.6257002", "0.6255147", "0.6249876", "0.62441146", "0.62415576", "0.62146854", "0.62116635", "0.6209311", "0.6206696", "0.6206471", "0.6204952", "0.6204952", "0.6201471", "0.61977607", "0.6187943", "0.61827385", "0.6177662", "0.6171078", "0.61610204", "0.61596346", "0.61577404", "0.6153247", "0.61418056" ]
0.72163934
5
Get available discounts for product
public static function getAvailableDiscounts(&$product, $sku_id = 0, $filter_by = array()) { $filter_type = 'discount'; // Если требуется показать все правила скидок, невзирая на условия if ($product === 'all' || $product === null || !$product) { $product = self::getAbstractProduct(); $sku_id = 0; $filter_type = 'all'; } $instance = get_class(); // Получаем обработанные товары $cache_work = new waRuntimeCache('flexdiscount_product_workflows'); $workflows = $cache_work->get(); // Получаем товар if (is_int($product)) { $product = new shopProduct($product); } $product = ($product instanceof shopProduct) ? $product->getData() : $product; if (!$product) { return array(); } if (!$sku_id) { $sku_id = $product['sku_id']; } else { $find_sku = $sku_id; } $product = self::prepareProduct($product, isset($find_sku) ? $find_sku : 0); // Если товар уже обрабатывался, то возвращаем его данные if (isset(self::$available_products[$sku_id])) { return self::$available_products[$sku_id]; } else { // Правила скидок $discount_groups = shopFlexdiscountHelper::getDiscounts(); if (!$discount_groups) { return array(); } $sku_id = $product['sku_id']; // Добавляем товар к заказу $order_params = (new shopFlexdiscountWorkflow())->addToOrder($product); self::$user = $order_params['contact']; self::setOrderInfo($order_params['order']); $items = $order_params['order']['items']; // Выполняем предварительную обработку товаров shopFlexdiscountHelper::workupProducts($items); // Получаем информацию о купонах $coupon_info = shopFlexdiscountCouponPluginModel::couponCheck(); // Фильтруем правила запрета $deny_rules = self::prepareDenyRules($discount_groups, 'deny'); $deny_rules = self::getDenyRules($deny_rules, $items); // Выполняем перебор групп скидок foreach ($discount_groups as $group_id => $group) { $rules = $group_id === 0 ? $group : $group['items']; foreach ($rules as $rule) { if ($rule['status'] && empty($rule['hide_storefront']) && !$rule['deny']) { // Проверяем наличие купонов у правил скидок if (!empty($rule['enable_coupon']) || !empty($rule['rule_has_coupon'])) { $coupon_not_found = 1; // Если купон не введен, то прерываем обработку правила if (!$coupon_info && !empty($rule['enable_coupon'])) { self::$available_products[$sku_id][$rule['id']] = array(); continue; } if ($coupon_info) { // Сохраняем купоны, которые сработали для правила скидок foreach ($coupon_info as $c_id => $c) { if (isset($c['coupon_rules'][$rule['id']])) { $coupon_not_found = 0; } } // Если не сработало ни одного купона, прерываем обработку правила if ($coupon_not_found) { continue; } } } // Если правило было обработано в действующих скидках, запоминаем его и исключаем из дальнейшей работы if (!empty($workflows[$sku_id]['items'][$rule['id']])) { $r = $workflows[$sku_id]['items'][$rule['id']]; self::$available_products[$sku_id][$rule['id']] = array( 'rule' => array( "id" => $rule['id'], "sort" => $rule['frontend_sort'], "name" => $r['name'], "description" => $rule['description'], "code" => $r['params']['code'], "discount" => $r['params']['discount'], "discount_percentage" => $r['params']['discount_percentage'], "affiliate" => $r['params']['affiliate'], "affiliate_percentage" => $r['params']['affiliate_percentage'] ), 'quantity' => $r['quantity'], 'discount' => $r['clear_discount'] * $r['quantity'], 'affiliate' => $r['affiliate'] * $r['quantity'], ); continue; } $all_items = $items; // Проверяем наличие запрещающих правил, которые выбрасывают товары из расчетов if (!empty($deny_rules[$group_id]['drop_from_calc'])) { $all_items = self::dropDenyItems($all_items, $deny_rules[$group_id]['drop_from_calc'], $group_id); } if ($group_id !== 0 && !empty($deny_rules[0]['drop_from_calc'])) { // Применяем общее правило запрета $all_items = self::dropDenyItems($all_items, $deny_rules[0]['drop_from_calc']); } // Проверяем, остался ли товар после запретов if (!$item = self::productInArray($sku_id, $all_items)) { self::$available_products[$sku_id][$rule['id']] = array(); continue; } // Цели $target = self::decode($rule['target']); // Если почему-то целей не оказалось, прерываем обработку этого правила if (!$target) { continue; } // Запоминаем, обрабатывается комплект или нет shopFlexdiscountData::isBundle($rule); // Условия скидок $conditions = self::decode($rule['conditions']); /* * Выполняем анализ целей и фильтрацию условий. * * Суть: Если у правила скидок имеются условия, то нам необходимо согласно фильтрам * в настройках (фильтры по дате, пользователю и тд) удалить лишние условия для показа доступных скидок. * * Важные моменты! * - Если в целях имеются "Все товары, удовлетворяющие условиям" или "Все товары, не удовлетворяющие условиям", * тогда для них мы должны учитывать и не удалять условия со старшинством 1 (группа условий для Товара). * - Если перечисленных выше целей нет, тогда мы можем игнорировать условия со старшинством 1. * * Примеры: * а) Условие - категория 1, цель - категория 2. Если не удалить все условия со старшинством 1, тогда у товаров из * категории 2 не будет блока доступных скидок. * б) Условие - категория 1, цель - Все товары, удовл условиям. Если удалить все условия со старшинством 1, * тогда у всех товаров будет лишний блок доступных скидок. */ // Определяем какие цели используются, чтобы сформировать массивы, содержащие условия со старшинством 1 и не содержащие $conditions_with_precedence = $conditions_without_precedence = null; if (!empty($conditions->conditions)) { // Подготавливаем фильтры условий $filter_by = !empty($rule['available']['status']) ? (!empty($rule['available']['filter_by']) ? $rule['available']['filter_by'] : array()) : $filter_by; if ($filter_by) { if (in_array('user_group', $filter_by)) { $filter_by[] = 'user'; $filter_by[] = 'ucat'; $filter_by[] = 'user_date'; $filter_by[] = 'user_data'; $filter_by[] = 'user_birthday'; } if (in_array('date_group', $filter_by)) { $filter_by[] = 'date'; $filter_by[] = 'week'; $filter_by[] = 'time'; } if (in_array('properties_group', $filter_by)) { $filter_by = array_merge($filter_by, array('product_name', 'product_sku', 'product_sku_name', 'product_summary', 'product_mt', 'product_mk', 'product_md', 'product_description', 'product_create', 'product_edit', 'product_video', 'product_image', 'product_rating', 'product_rating_count', 'product_price', 'product_margin', 'product_margin_comp', 'product_margin_perc', 'product_margin_comp_perc', 'product_compare_price', 'product_purchase_price', 'product_min_price', 'product_margin_trade_perc', 'product_margin_comp_trade_perc', 'product_max_price', 'product_stock', 'product_stock_total', 'product_total_sales', 'product_services', 'product_tags')); } if (in_array('numsum_group', $filter_by)) { $filter_by['numsum_group'] = array('num_cat' => 1, 'num_cat_all' => 1, 'num_set' => 1, 'num_type' => 1, 'num_all_cat' => 2, 'num_all_cat_all' => 2, 'num_all_set' => 2, 'num_all_type' => 2, 'sum_cat' => 2, 'sum_cat_all' => 2, 'num_feat' => 3, 'sum_feat' => 3); } } foreach ($target as $t) { // Игнорируем цели по доставке if ($t->target == 'shipping' && empty($rule['prod_meet_cond'])) { continue; } if ($conditions_with_precedence === null && (in_array($t->target, array('all', 'all_true', 'all_false')) || !empty($rule['prod_meet_cond']))) { $conditions_with_precedence = clone $conditions; $conditions_with_precedence->conditions = self::filter_conditions($conditions->conditions, $filter_by, $filter_type); } if ($conditions_without_precedence === null && !in_array($t->target, array('all', 'all_true', 'all_false'))) { $conditions_without_precedence = clone $conditions; $conditions_without_precedence->conditions = self::filter_conditions($conditions->conditions, $filter_by, $filter_type, true); } // Когда все нужные условия собраны, прерываем перебор целей if ($conditions_with_precedence !== null && $conditions_without_precedence !== null) { break; } } } self::getAllItems($all_items); // Товары, удовлетворяющие условиям $filter_items_with_precedence = $conditions_with_precedence ? self::filter_items($all_items, $conditions_with_precedence->group_op, $conditions_with_precedence->conditions, 0, 1) : $all_items; $filter_items_without_precedence = $conditions_without_precedence ? self::filter_items($all_items, $conditions_without_precedence->group_op, $conditions_without_precedence->conditions, 0, 1) : $all_items; // Проверяем наличие запрещающих правил if (!empty($deny_rules[$group_id])) { $all_items = self::dropDenyItems($all_items, $deny_rules[$group_id]['all'], $group_id); if ($conditions_with_precedence) { $filter_items_with_precedence = self::dropDenyItems($filter_items_with_precedence, $deny_rules[$group_id]['all'], $group_id); } if ($conditions_without_precedence) { $filter_items_without_precedence = self::dropDenyItems($filter_items_without_precedence, $deny_rules[$group_id]['all'], $group_id); } } if ($group_id !== 0 && !empty($deny_rules[0])) { // Применяем общее правило запрета $all_items = self::dropDenyItems($all_items, $deny_rules[0]['all']); if ($conditions_with_precedence) { $filter_items_with_precedence = self::dropDenyItems($filter_items_with_precedence, $deny_rules[0]['all']); } if ($conditions_without_precedence) { $filter_items_without_precedence = self::dropDenyItems($filter_items_without_precedence, $deny_rules[0]['all']); } } // Назначаем скидки на выбранные объекты foreach ($target as $t) { if ($t->target == 'shipping' && empty($rule['show_shipping'])) { continue; } $function_name = 'avail_target_' . $t->target; if (method_exists($instance, $function_name)) { // Общее значение скидки и бонусов для правила $result = self::$function_name((in_array($t->target, array('all', 'all_true', 'all_false')) || !empty($rule['prod_meet_cond'])) ? $filter_items_with_precedence : $filter_items_without_precedence, $all_items, $t, $rule, $product['sku_id']); if ($result === false) { continue; } } } // Опция "Отображать доступные скидки для товаров, которые удовлетворяют условиям" if (!empty($rule['prod_meet_cond']) && empty(self::$available_products[$sku_id][$rule['id']]) && self::productInArray($sku_id, $filter_items_with_precedence)) { self::initAvailableProduct($rule, $sku_id, array('prod_meet_cond' => 1)); } // Ограничение для правила self::limitAvailableDiscountValue($rule, $item); } } } } return isset(self::$available_products[$sku_id]) ? self::$available_products[$sku_id] : array(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function discounts()\n {\n $products = $this->productRepository->discounts();\n\n return $this->sendResponse(ProductResource::toArray($products, $this->language), trans('product.messages.retrieved'));\n }", "public function getIncludedDiscounts();", "function get_discounts()\n\t\t{\n\t\t\tglobal $db;\n\t\t\t$query = \" SELECT a.*\n\t\t\t\t\t\t FROM \n\t\t\t\t\t\t \t\".$this -> table_discount.\" AS a\n\t\t\t\t\t\t \tORDER BY ordering \";\n\t\t\t$sql = $db->query($query);\n\t\t\t$list = $db->getObjectList();\n\t\t\treturn $list;\n\t\t}", "public function getDiscounts()\n {\n return $this->discounts;\n }", "public function getDiscounts(): array;", "public function getDiscounts()\r\n {\r\n return $this->_discounts;\r\n }", "public function providerDiscountPurchases()\r\n\t{\r\n\t\t$appleProduct = $this->getAppleProduct(self::PRODUCT_WITH_DISCOUNT_PRICE);\r\n\t\t$lightProduct = $this->getLightProduct(self::PRODUCT_WITH_DISCOUNT_PRICE);\r\n\t\t$starshipProduct = $this->getStarshipProduct(self::PRODUCT_WITH_DISCOUNT_PRICE);\r\n\r\n\t\treturn array(\r\n\t\t\tarray(\r\n\t\t\t\t7.0 * self::PRODUCT_APPLE_DISCOUNT_PRICE,\r\n\t\t\t\tarray(\r\n\t\t\t\t\tnew ProductToPurchase($appleProduct, 7.0),\r\n\t\t\t\t),\r\n\t\t\t),\r\n\t\t\tarray(\r\n\t\t\t\t5 * self::PRODUCT_LIGHT_PRICE + 8.0 * self::PRODUCT_APPLE_DISCOUNT_PRICE,\r\n\t\t\t\tarray(\r\n\t\t\t\t\tnew ProductToPurchase($lightProduct, 5),\r\n\t\t\t\t\tnew ProductToPurchase($appleProduct, 8.0),\r\n\t\t\t\t),\r\n\t\t\t),\r\n\t\t\tarray(\r\n\t\t\t\t4 * self::PRODUCT_STARSHIP_PRICE,\r\n\t\t\t\tarray(\r\n\t\t\t\t\tnew ProductToPurchase($starshipProduct, 6)\r\n\t\t\t\t),\r\n\t\t\t),\r\n\t\t);\r\n\t}", "public function listDiscounts()\n {\n return $this->correct(Discount::orderBy('created_at','desc')->get());\n }", "public function getDiscounts() {\n return $this->_discounts;\n }", "public function getDiscountInvoiced();", "function getDiscountFor($product) {\n\t\treturn 30;\n\t}", "public function discounts()\n {\n return [\n new Discount(101, 0.06, Discount::MORE_THAN_EQUAL_TO),\n new Discount(100, 0.04),\n new Discount(20, 0.02)\n ];\n }", "public function getDiscounts()\n {\n return $this->hasMany(Discount::class, ['discount_unit_id' => 'id']);\n }", "public function get_non_group_discounts()\r\n\t{\r\n\t\t// Check the discount tables exist in the config file and are enabled.\r\n\t\tif ($this->get_enabled_status('discounts'))\r\n\t\t{\r\n\t\t\t// Set aliases of discount table data.\r\n\t\t\t$tbl_cols_discounts = $this->flexi->cart_database['discounts']['columns'];\r\n\t\t\t$tbl_cols_discount_columns = $this->flexi->cart_database['discount_columns']['columns'];\r\n\r\n\t\t\t$sql_select = array(\r\n\t\t\t\t$tbl_cols_discounts['item'].' AS item_id'\r\n\t\t\t);\r\n\t\t\t\t\r\n\t\t\t// Get all summary discounts.\r\n\t\t\t// Lookup item id from item data array and add to SQL WHERE string.\r\n\t\t\t$sql_where = \" AND \".$tbl_cols_discounts['group'].\" = '0' AND ((\"\r\n\t\t\t\t.$tbl_cols_discount_columns['id'].\" IN (3,4,5) AND \".$tbl_cols_discounts['code'].\" = '') OR (\"; \r\n\t\t\tforeach($this->flexi->cart_contents['items'] as $item)\r\n\t\t\t{\r\n\t\t\t\t$sql_where .= $tbl_cols_discounts['item'].\" = '\".$item[$this->flexi->cart_columns['item_id']].\"' OR \";\r\n\t\t\t}\r\n\t\t\t$sql_where = rtrim($sql_where,' OR ').\")\";\r\n\t\t\t\r\n\t\t\t// Lookup discounts matching submitted discount codes and add to SQL WHERE string.\r\n\t\t\tif (! empty($this->flexi->cart_contents['settings']['discounts']['codes']))\r\n\t\t\t{\r\n\t\t\t\t$sql_where .= \" OR (\";\r\n\t\t\t\tforeach($this->flexi->cart_contents['settings']['discounts']['codes'] as $code => $discount_data)\r\n\t\t\t\t{\r\n\t\t\t\t\t$sql_where .= $tbl_cols_discounts['code'].\" = \".$this->db->escape($code).\" OR \"; \r\n\t\t\t\t}\r\n\t\t\t\t$sql_where = rtrim($sql_where,' OR ').\")\";\r\n\t\t\t}\r\n\t\t\t$sql_where .= \")\";\r\n\t\t\t\r\n\t\t\tif ($item_discount_data = $this->get_database_discount_data($sql_select, $sql_where, 'non_group_discounts'))\r\n\t\t\t{\r\n\t\t\t\treturn $this->sort_discount_data($item_discount_data);\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\treturn FALSE;\r\n\t}", "public function get_all_discounts()\r\n\t{\r\n\t\t// Set default discount target column data.\r\n\t\t$discounts = array(\r\n\t\t\t'item_price' => array(),\r\n\t\t\t'item_shipping' => array(),\r\n\t\t\t'item_summary_total' => array(),\r\n\t\t\t'shipping_total' => array(),\r\n\t\t\t'total' => array(),\r\n\t\t\t'reward_vouchers' => array()\r\n\t\t);\r\n\t\t\r\n\t\t// Get all available discounts.\r\n\t\t$unsorted_discount_data['manual_discount'] = $this->get_manual_discounts();\r\n\t\t$unsorted_discount_data['non_group_discount'] = $this->get_non_group_discounts();\r\n\t\t$unsorted_discount_data['group_discounts'] = $this->get_group_discounts();\r\n\t\t\r\n\t\tif (! empty($unsorted_discount_data['manual_discount']) || ! empty($unsorted_discount_data['non_group_discount']) || ! empty($unsorted_discount_data['group_discounts']))\r\n\t\t{\r\n\t\t\t// Loop through and group discounts.\r\n\t\t\tforeach($unsorted_discount_data as $discount_type)\r\n\t\t\t{\r\n\t\t\t\tif (! empty($discount_type))\r\n\t\t\t\t{\r\n\t\t\t\t\t// Loop through the discount target columns 'item_price', 'item_shipping', 'item_summary_total', 'shipping_total', 'total' and 'reward_vouchers'.\r\n\t\t\t\t\tforeach($discount_type as $target_column => $target_data)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tforeach($target_data as $discount_id => $discount_data)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t$discounts[$target_column][$discount_id] = $discount_data;\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\t\r\n\t\t\t###+++++++++++++++++++++++++++++++++###\r\n\r\n\t\t\t### Validate and Sort Item Discounts.\r\n\r\n\t\t\t$item_discount_data = $this->validate_item_discounts($discounts);\r\n\t\t\t\r\n\t\t\t// Merge item discount data.\r\n\t\t\t$discounts['item_price'] = (! empty($item_discount_data['discounts']['item_price'])) ? $item_discount_data['discounts']['item_price'] : array();\r\n\t\t\t$discounts['item_shipping'] = (! empty($item_discount_data['discounts']['item_shipping'])) ? $item_discount_data['discounts']['item_shipping'] : array();\r\n\t\t\t\r\n\t\t\t###+++++++++++++++++++++++++++++++++###\r\n\t\t\t\r\n\t\t\t// If a 'Non-combinable' item discount has been set, remove all other summary discount data.\r\n\t\t\tif ($item_discount_data['non_combinable_discount'])\r\n\t\t\t{\r\n\t\t\t\t$discounts = array(\r\n\t\t\t\t\t'item_price' => $discounts['item_price'],\r\n\t\t\t\t\t'item_shipping' => $discounts['item_shipping'],\r\n\t\t\t\t\t'item_summary_total' => array(),\r\n\t\t\t\t\t'shipping_total' => array(),\r\n\t\t\t\t\t'total' => array()\r\n\t\t\t\t);\r\n\t\t\t}\r\n\r\n\t\t\t###+++++++++++++++++++++++++++++++++###\r\n\r\n\t\t\t// Sort discount data.\r\n\t\t\tforeach($discounts as $target_column => $discount_data) \r\n\t\t\t{\r\n\t\t\t\t$sorted_discounts[$target_column] = $target_column;\r\n\t\t\t}\r\n\t\t\tarray_multisort($sorted_discounts, SORT_ASC, $discounts);\r\n\t\t}\r\n\r\n\t\treturn $discounts;\r\n\t}", "public function get_manual_discounts()\r\n\t{\r\n\t\t// Set aliases of discount table data.\r\n\t\t$tbl_cols_discounts = $this->flexi->cart_database['discounts']['columns'];\r\n\t\t$tbl_cols_discount_calculations = $this->flexi->cart_database['discount_calculation']['columns'];\r\n\r\n\t\t$manual_set_discounts = $this->flexi->cart_contents['settings']['discounts']['manual'];\r\n\r\n\t\t$discounts = array();\t\r\n\t\tif (! empty($manual_set_discounts))\r\n\t\t{\r\n\t\t\tforeach($manual_set_discounts as $column)\r\n\t\t\t{\t\t\t\r\n\t\t\t\t$discounts[$column['column']][] = array(\r\n\t\t\t\t\t'id' => $column['id'],\r\n\t\t\t\t\t'calculation_id' => $column['calculation'],\r\n\t\t\t\t\t'code' => FALSE,\r\n\t\t\t\t\t'description' => $column['description'],\r\n\t\t\t\t\t'quantity_required' => 1,\r\n\t\t\t\t\t'quantity_discounted' => 1,\r\n\t\t\t\t\t'value_required' => 0,\r\n\t\t\t\t\t'value_discounted' => $column['value'],\r\n\t\t\t\t\t'recursive' => 0,\r\n\t\t\t\t\t'non_combinable' => FALSE,\r\n\t\t\t\t\t'void_reward_points' => (bool)$column['void_reward_points'],\r\n\t\t\t\t\t'force_shipping_discount' => FALSE,\r\n\t\t\t\t\t'tax_method' => $column['tax_method']\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\treturn $discounts;\r\n\t}", "public function getDiscounts($filter = array())\n {\n $sql = \"SELECT f.*,\";\n $sql .= \" IF(f.frontend_sort='-1', f.sort, f.frontend_sort) as frontend_sort FROM {$this->table} f\";\n $sql .= \" WHERE 1\";\n if (isset($filter['status'])) {\n $sql .= \" AND status = '\" . (int) $filter['status'] . \"'\";\n }\n if (isset($filter['deny'])) {\n $sql .= \" AND deny = '\" . (int) $filter['deny'] . \"'\";\n }\n if (isset($filter['ids'])) {\n $sql .= \" AND id \";\n if (is_array($filter['ids'])) {\n $sql .= \"IN ('\" . implode(\"','\", $this->escape($filter['ids'], 'int')) . \"')\";\n } else {\n $sql .= \"= '\" . (int) $filter['ids'] . \"'\";\n }\n }\n $sql .= \" ORDER BY sort ASC\";\n // Выбираем определенное количество записей\n if (!empty($filter['limit'])) {\n $sql .= \" LIMIT \" . (int) $filter['limit']['offset'] . \",\" . (int) $filter['limit']['length'];\n }\n $result = $this->query($sql)->fetchAll('id');\n\n // Получаем параметры скидок\n $params_model = new shopFlexdiscountParamsPluginModel();\n $ids = $result ? array_keys($result) : array();\n $params = $params_model->getParams($ids);\n\n // Купоны\n if (isset($filter['coupons'])) {\n $sfcdm = new shopFlexdiscountCouponDiscountPluginModel();\n foreach ($sfcdm->query(\"SELECT COUNT(*) as count, fl_id FROM {$sfcdm->getTableName()} WHERE fl_id IN ('\" . implode(\"','\", $ids) . \"') GROUP BY fl_id\") as $r) {\n $result[$r['fl_id']]['coupons'] = $r['count'];\n }\n }\n\n // Группируем скидки\n $group_model = new shopFlexdiscountGroupPluginModel();\n $groups = $group_model->getGroups();\n $return = $groups;\n if ($groups) {\n foreach ($groups as $group_id => $gr) {\n if (!empty($gr['items'])) {\n $return[$group_id]['items'] = array();\n foreach ($gr['items'] as $gi) {\n if (isset($result[$gi])) {\n $key = (!empty($filter['id_as_key']) ? $result[$gi]['id'] : $result[$gi]['sort']);\n $return[$group_id]['items'][$key] = $result[$gi];\n if (isset($params[$gi])) {\n $return[$group_id]['items'][$key] += $params[$gi];\n }\n unset($result[$gi]);\n }\n }\n ksort($return[$group_id]['items']);\n }\n }\n }\n if ($result) {\n $return[0] = array();\n foreach ($result as $r) {\n $key = (!empty($filter['id_as_key']) ? $r['id'] : $r['sort']);\n\n while (isset($return[0][$key])) {\n $key = uniqid();\n }\n\n $return[0][$key] = $r;\n if (isset($params[$r['id']])) {\n $return[0][$key] += $params[$r['id']];\n }\n }\n }\n\n return $return;\n }", "function get_discount_info($product) {\r\n $response_arr = array(); \r\n if ($this->total_level_1 > 0) {\r\n $h_exp = $this->get_level_policy($this->total_discount_1, $this->total_level_1); \r\n $response_arr[] = $h_exp; \r\n }\r\n\r\n if ($this->total_level_2 > 0) {\r\n $h_exp = $this->get_level_policy($this->total_discount_2, $this->total_level_2); \r\n $response_arr[] = $h_exp; \r\n }\r\n\r\n if ($this->total_level_3 > 0) {\r\n $h_exp = $this->get_level_policy($this->total_discount_3, $this->total_level_3); \r\n $response_arr[] = $h_exp; \r\n }\r\n\r\n if ($this->total_level_4 > 0) {\r\n $h_exp = $this->get_level_policy($this->total_discount_4, $this->total_level_4); \r\n $response_arr[] = $h_exp; \r\n }\r\n\r\n if ($this->total_level_5 > 0) {\r\n $h_exp = $this->get_level_policy($this->total_discount_5, $this->total_level_5); \r\n $response_arr[] = $h_exp; \r\n }\r\n\r\n for ($i = 0, $n=sizeof($this->extra_levels); $i < $n; $i++) {\r\n $h_exp = $this->get_level_policy( $this->extra_discounts[$i], $this->extra_levels[$i]);\r\n $response_arr[] = $h_exp; \r\n }\r\n return $response_arr; \r\n }", "public function getDiscountRefunded();", "public function getCartDiscounts()\n {\n if (is_null($this->cartDiscounts)) {\n /** @psalm-var ?list<stdClass> $data */\n $data = $this->raw(self::FIELD_CART_DISCOUNTS);\n if (is_null($data)) {\n return null;\n }\n $this->cartDiscounts = CartDiscountReferenceCollection::fromArray($data);\n }\n\n return $this->cartDiscounts;\n }", "public function getQueryActiveDiscounts() {\n return $this->createQuery('d')\n ->select('d.*')\n ->where('d.status = ?', array(Companies_Model_Discount::STATUS_ACTIVE))\n ->orderBy('d.id DESC');\n }", "public function get_group_discounts()\r\n\t{\r\n\t\t// Check the discount tables exist in the config file and are enabled.\r\n\t\tif ($this->get_enabled_status('discounts'))\r\n\t\t{\r\n\t\t\t// Set aliases of discount table data.\r\n\t\t\t$tbl_cols_discounts = $this->flexi->cart_database['discounts']['columns'];\r\n\t\t\t$tbl_cols_group_discounts = $this->flexi->cart_database['discount_groups']['columns'];\r\n\t\t\t$tbl_cols_group_item_discounts = $this->flexi->cart_database['discount_group_items']['columns'];\r\n\t\t\r\n\t\t\t$sql_select = array(\r\n\t\t\t\t$tbl_cols_group_item_discounts['item'].' AS item_id',\r\n\t\t\t\t$tbl_cols_discounts['group'].' AS group_id'\r\n\t\t\t);\r\n\r\n\t\t\t// Lookup item id from item data array and add to SQL WHERE string\r\n\t\t\t$sql_where = ' AND ('.$tbl_cols_group_item_discounts['item'].' IN (';\r\n\t\t\tforeach($this->flexi->cart_contents['items'] as $item)\r\n\t\t\t{\r\n\t\t\t\t$sql_where .= $item[$this->flexi->cart_columns['item_id']].',';\r\n\t\t\t}\r\n\t\t\t$sql_where = rtrim($sql_where,',').') AND '.$tbl_cols_group_discounts['status'].' = 1)';\r\n\t\t\t\r\n\t\t\tif ($group_item_discount_data = $this->get_database_discount_data($sql_select, $sql_where, 'group_discounts'))\r\n\t\t\t{\r\n\t\t\t\treturn $this->sort_discount_data($group_item_discount_data);\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\treturn FALSE;\r\n\t}", "public function getCharges();", "public function index(){\n $discounts = Discount::where('estado', 1)->paginate(10);\n\n return view('admin.product.discount', compact('discounts'));\n }", "public function getProductOffers($productId);", "public function getDiscountList()\r\n\t{\r\n\t\t$this->db->select('*');\r\n\t\t$this->db->from('tbl_discount');\r\n\t\t$this->db->where('discount_status', '1');\t\t\r\n\t\t$this->db->where('discount_end_date >=', date('Y-m-d'));\t\r\n\t\t$query = $this->db->get();\r\n\t\treturn $query->result() ;\r\n\t}", "public function getDiscountData() {\n return array(\n 'discValue' => $this->discValue,\n 'discValueCode' => $this->discValueCode,\n 'minPurchaseVal' => $this->minPurchaseVal,\n 'receiptDisc' => $this->receiptDisc,\n 'maxreceDisc' => $this->maxreceDisc\n );\n }", "public function getDiscount()\n\t{\n\t\treturn $this->getKeyValue('Discount'); \n\n\t}", "public function purchase_discounts() \n {\n return $this->hasMany('App\\Client\\Purchase\\Discount');\n\n }", "public function purchase_discounts() \n {\n return $this->hasMany('App\\Client\\Purchase\\Discount');\n\n }", "function getDiscounts($filters = [], $max = null, $offset = 0, $order_by = [], &$total = false)\n\t{\n\t\tif(!is_null($v = $this->getId())){\n\t\t\t$filters['order_discount_order_id'] = $v;\n\t\t}\n\t\tif (empty($filters)){\n\t\t\treturn [];\n\t\t}\n\n\t\t$ctrl = new DYOrderDiscountsControllerRealR();\n\n\t\treturn $ctrl->getAllItems($filters, $max, $offset, $order_by, $total);\n\t}", "public function getDiscountCanceled();", "public function getProductBudgets()\n {\n return $this->productBudgets;\n }", "public function discounts()\n {\n return $this->hasMany('App\\Discount', 'restaurant_id');\n }", "function ppt_resources_get_consumptions_stocks_per_product($data)\n{\n if (!isset($data['year']) || (!isset($data['uid']))) {\n return services_error('Year or UID are not defined!', 500);\n }\n\n global $user;\n $year = $data['year'];\n $accounts = [];\n // If there is no uid sent with the api so get the current user id.\n if (isset($data['uid']) && !empty($data['uid'])) {\n $uid = $data['uid'];\n } else {\n $uid = $user->uid;\n }\n $countries = array();\n if (isset($data['countries'])) {\n $countries = $data['countries'];\n }\n $reps = array();\n if (isset($data['reps'])) {\n $reps = $data['reps'];\n } else {\n $is_rep = FALSE;\n if (is_rep($user)) {\n $is_rep = TRUE;\n }\n $reps = ppt_resources_get_sales_manager_reps($uid, $countries, $is_rep);\n }\n\n $user = user_load($uid);\n\n // Check if user selected accounts.\n if (isset($data['accounts'])) {\n $accounts = $data['accounts'];\n } else {\n $accounts = ppt_resources_get_role_accounts($user, $countries);\n }\n\n $products = [];\n // Check if user selected products.\n if (isset($data['products'])) {\n $products = get_products_dosages($data['products']);\n } else {\n // If the user is rep.\n if (is_rep($user)) {\n $products = get_products_for_current_user($uid);\n } else {\n $products = get_products_for_accounts($accounts);\n }\n }\n\n $entries = get_entries($accounts, $products, NULL, $reps);\n $entries_records = get_entries_records_for_year($entries, $year, 'consumption_stock_entry');\n $consumptions = sum_records_per_field_grouped_by_account($entries_records, 'field_product');\n\n return $consumptions;\n}", "function getPromoList()\n {\n return array(array('reason'=>'test_discount','amount'=>3.5));\n }", "public function getDiscountDescription();", "public function getShippingInvoiced();", "public function get_total_discapacitados(){\n\t\t$sql = mysqli_query(Conecta::conx(),\"SELECT COUNT(DISCAPACIDAD) AS discapacitados FROM datos_salud WHERE DISCAPACIDAD = 'SI'\") or die('error en la consulta:' .$sql. mysqli_errno(Conecta::conx()));\n\t\t//$sql .= \"\";\n\t\tif($reg=mysqli_fetch_array($sql)){\n\t\t\t$this->discapacitados=$reg[\"discapacitados\"];\n\t\t}\n\t\treturn $this->discapacitados;\n\n\t\tmysqli_close(Conecta::conx());\n\t\n\t}", "function get_discounts_after_tax() {\n\t\t\tif ($this->discount_total) :\n\t\t\t\treturn cmdeals_price($this->discount_total); \n\t\t\tendif;\n\t\t\treturn false;\n\t\t}", "public function getOtherCharges() { \n \n $result = 0;\n $purchaseIds = !empty($_GET['purchaseIds']) ? $_GET['purchaseIds'] : '';\n $purchaseData = DB::select('SELECT * FROM purchase_master WHERE is_deleted_status = \"N\" AND id = '.$purchaseIds.'');\n if (!empty($purchaseData)) {\n $otherCharges = !empty($purchaseData[0]->other_charges) ? $purchaseData[0]->other_charges : '0.00'; \n echo $otherCharges;\n }\n\n }", "public function discounts()\n {\n return $this->hasMany('App\\Discount','subscription_id');\n }", "function get_discount($total = 0)\n{\n global $config, $db_prefix, $sql_today, $current_user_id;\n\n $discount = array('self_gift_code' => '', 'gift_code' => '', 'gift_flat' => 0, 'gift_pct' => 0);\n $gift_discount = false;\n\n // get gift\n $gift = sql_qquery(\"SELECT * FROM \".$db_prefix.\"gift WHERE redeem_user_id='$current_user_id' AND redeem_order_id='' AND valid_date >= '$sql_today' LIMIT 1\");\n if (!empty($gift) && ($total >= $gift['min_purchase'])) {\n $gift_discount = true;\n $g = explode('.', $gift['gift_code']);\n $discount['self_gift_code'] = $gift['gift_code'];\n $discount['gift_code'] = $gift['gift_code'] = $g[0];\n if ($gift['gift_pct']) {\n $discount['gift_pct'] = $gift['gift_value'];\n } else {\n $discount['gift_flat'] = $gift['gift_value'];\n }\n }\n\n return $discount;\n}", "public function hasDiscount(){\n return $this->_has(9);\n }", "public function getDiscountAmount();", "public function getCurrencies();", "function ppt_resources_get_usd_stocks($data)\n{\n// return $data;\n if (!isset($data['year'])) {\n return services_error('Year is not defined!', 500);\n }\n\n $year = $data['year'];\n $accounts = [];\n // If there is no uid sent with the api so get the current user id.\n if (isset($data['uid'])) {\n $uid = $data['uid'];\n } else {\n global $user;\n $uid = $user->uid;\n }\n $countries = array();\n if (isset($data['countries'])) {\n $countries = $data['countries'];\n }\n $reps = array();\n if (isset($data['reps'])) {\n $reps = $data['reps'];\n }\n\n $user = user_load($uid);\n\n // Check if user selected accounts.\n if (isset($data['accounts'])) {\n $accounts = $data['accounts'];\n } else {\n $accounts = ppt_resources_get_role_accounts($user, $countries);\n }\n\n $products = [];\n // Check if user selected products.\n if (isset($data['products'])) {\n $products = get_products_dosages($data['products']);\n } else {\n // If the user is rep.\n if (is_rep($user)) {\n $products = get_products_for_current_user($uid);\n } else {\n $products = get_products_for_accounts($accounts);\n }\n }\n//return entity_metadata_wrapper('field_collection_item', 18045);\n $entries = get_entries($accounts, $products, NULL, $reps);\n $entries_records = get_entries_records_for_year($entries, $year, 'consumption_stock_entry');\n $reports = sum_records_per_field($entries_records, 'field_product', TRUE);\n return $reports;\n}", "public function applyCartDiscount(Varien_Event_Observer $observer)\n { \n try\n { \n $bundle_product_ids = [];\n $quote_product_ids = [];\n $cookieValue = Mage::getModel('core/cookie')->get('ivid');\n $userBundleCollection = Mage::getModel('increasingly_analytics/bundle')->getCollection()->addFieldToFilter('increasingly_visitor_id',$cookieValue);\n $items = $observer->getEvent()->getQuote()->getAllItems();\n $eligibleProducts = [];\n $discount = 0;\n foreach ($items as $item) {\n array_push($quote_product_ids, $item->getProductId());\n }\n foreach ($userBundleCollection as $bundle) {\n //First Bundle products\n $bundle_product_ids = explode(',', $bundle->getProductIds()); \n $productsIds = array_intersect($quote_product_ids, $bundle_product_ids);\n if(count($productsIds) == count($bundle_product_ids) )\n $discount += $bundle->getDiscountPrice();\n }\n\n if($discount > 0){\n $quote=$observer->getEvent()->getQuote();\n $quoteid=$quote->getId();\n $discountAmount=$discount;\n if($quoteid) { \n if($discountAmount>0) {\n $total=$quote->getBaseSubtotal();\n $quote->setSubtotal(0);\n $quote->setBaseSubtotal(0);\n\n $quote->setSubtotalWithDiscount(0);\n $quote->setBaseSubtotalWithDiscount(0);\n\n $quote->setGrandTotal(0);\n $quote->setBaseGrandTotal(0);\n \n\n $canAddItems = $quote->isVirtual()? ('billing') : ('shipping'); \n foreach ($quote->getAllAddresses() as $address) {\n\n $address->setSubtotal(0);\n $address->setBaseSubtotal(0);\n\n $address->setGrandTotal(0);\n $address->setBaseGrandTotal(0);\n\n $address->collectTotals();\n\n $quote->setSubtotal((float) $quote->getSubtotal() + $address->getSubtotal());\n $quote->setBaseSubtotal((float) $quote->getBaseSubtotal() + $address->getBaseSubtotal());\n\n $quote->setSubtotalWithDiscount(\n (float) $quote->getSubtotalWithDiscount() + $address->getSubtotalWithDiscount()\n );\n $quote->setBaseSubtotalWithDiscount(\n (float) $quote->getBaseSubtotalWithDiscount() + $address->getBaseSubtotalWithDiscount()\n );\n\n $quote->setGrandTotal((float) $quote->getGrandTotal() + $address->getGrandTotal());\n $quote->setBaseGrandTotal((float) $quote->getBaseGrandTotal() + $address->getBaseGrandTotal());\n\n $quote ->save(); \n\n $quote->setGrandTotal($quote->getBaseSubtotal()-$discountAmount)\n ->setBaseGrandTotal($quote->getBaseSubtotal()-$discountAmount)\n ->setSubtotalWithDiscount($quote->getBaseSubtotal()-$discountAmount)\n ->setBaseSubtotalWithDiscount($quote->getBaseSubtotal()-$discountAmount)\n ->save(); \n\n\n if($address->getAddressType()==$canAddItems) {\n //echo $address->setDiscountAmount; exit;\n $address->setSubtotalWithDiscount((float) $address->getSubtotalWithDiscount()-$discountAmount);\n $address->setGrandTotal((float) $address->getGrandTotal()-$discountAmount);\n $address->setBaseSubtotalWithDiscount((float) $address->getBaseSubtotalWithDiscount()-$discountAmount);\n $address->setBaseGrandTotal((float) $address->getBaseGrandTotal()-$discountAmount);\n if($address->getDiscountDescription()){\n $address->setDiscountAmount(-($address->getDiscountAmount()-$discountAmount));\n $address->setDiscountDescription($address->getDiscountDescription().', Custom Discount');\n $address->setBaseDiscountAmount(-($address->getBaseDiscountAmount()-$discountAmount));\n }else {\n $address->setDiscountAmount(-($discountAmount));\n $address->setDiscountDescription('Custom Discount');\n $address->setBaseDiscountAmount(-($discountAmount));\n }\n $address->save();\n }//end: if\n } //end: foreach\n //echo $quote->getGrandTotal();\n\n foreach($quote->getAllItems() as $item){\n //We apply discount amount based on the ratio between the GrandTotal and the RowTotal\n $rat=$item->getPriceInclTax()/$total;\n $ratdisc=$discountAmount*$rat;\n $item->setDiscountAmount(($item->getDiscountAmount()+$ratdisc) * $item->getQty());\n $item->setBaseDiscountAmount(($item->getBaseDiscountAmount()+$ratdisc) * $item->getQty())->save(); \n }\n } \n }\n }\n }\n catch(Exception $e)\n {\n Mage::log(\"Remove from cart tracking - \" . $e->getMessage(), null, 'Increasingly_Analytics.log');\n }\n\n }", "public static function getAllSellPro()\n {\n return DB::table(static::$table)\n ->select('sell_product.*')\n ->where('is_deleted', ACTIVE)\n ->where('display', 0)\n ->where('display_top', 1)\n ->paginate(LIMIT_ITEM_PAGE); \n }", "public function getDiscount()\r\n {\r\n return $this->discount;\r\n }", "function getDeliveryCharges($product_id = null, $seller_id = null, $condition_id = null) {\n\t\tif(empty($product_id) && is_null($seller_id) ){\n\t\t}\n\t\tApp::import('Model','ProductSeller');\n\t\t$this->ProductSeller = & new ProductSeller();\n\t\t$prodSellerInfo = $this->ProductSeller->find('first', array('conditions'=>array('ProductSeller.product_id'=>$product_id ,'ProductSeller.seller_id'=>$seller_id , 'ProductSeller.condition_id'=>$condition_id ),'fields'=>array('ProductSeller.standard_delivery_price')));\n\t\t//pr($prodSellerInfo);\n\t\tif(is_array($prodSellerInfo)){\n\t\t\treturn $prodSellerInfo['ProductSeller']['standard_delivery_price'];\n\t\t}else{\n\t\t\treturn false;\n\t\t}\n\t}", "public function getDiscount()\n {\n if ($this->hasDiscount() === false) {\n return false;\n }\n\n $time = new \\DateTime('now');\n $today = $time->format('Y-m-d');\n\n $discount = \\common\\models\\Discounts::find()\n ->where(['iid' => $this->id])\n ->andWhere(['<=', 'start_at', $today])\n ->andWhere(['>', 'stop_at', $today])\n ->one();\n\n return $discount->discount;\n }", "public function getDiscount($str)\r\n\t{\r\n\t\t$query = 'SELECT * FROM marketplaceDiscounts\r\n\t\t\tWHERE code = \"'.Database::escape($str).'\"';\r\n\t\t$this->_db->setQuery($query, 0, 1);\r\n\t\treturn $this->_db->loadAssoc();\r\n\t}", "public function getProduct();", "function customerDiscount()\r\n\t{\r\n\t\t$sql = $GLOBALS['db']->Query(\"SELECT Wert FROM \" . PREFIX . \"_modul_shop_kundenrabatte WHERE GruppenId = '\".UGROUP.\"' LIMIT 1\");\r\n\t\t$row = $sql->fetchrow();\r\n\t\t$sql->close();\r\n\t\tif(is_object($row))\r\n\t\t\treturn $row->Wert;\r\n\t}", "protected function getDiscounts( $language_id, $min_id=null, $max_id=null ) {\n\t\t$exist_table_user_group_description = false;\n\t\t$query = $this->db->query( \"SHOW TABLES LIKE '\".DB_PREFIX.\"user_group_description'\" );\n\t\t$exist_table_user_group_description = ($query->num_rows > 0);\n\n\t\t// get the instrument discounts\n\t\t$sql = \"SELECT pd.*, \";\n\t\t$sql .= ($exist_table_user_group_description) ? \"cgd.name \" : \"cg.name \";\n\t\t$sql .= \"FROM `\".DB_PREFIX.\"instrument_discount` pd \";\n\t\tif ($exist_table_user_group_description) {\n\t\t\t$sql .= \"LEFT JOIN `\".DB_PREFIX.\"user_group_description` cgd ON cgd.user_group_id=pd.user_group_id \";\n\t\t\t$sql .= \" AND cgd.language_id=$language_id \";\n\t\t} else {\n\t\t\t$sql .= \"LEFT JOIN `\".DB_PREFIX.\"user_group` cg ON cg.user_group_id=pd.user_group_id \";\n\t\t}\n\t\tif (isset($min_id) && isset($max_id)) {\n\t\t\t$sql .= \"WHERE pd.instrument_id BETWEEN $min_id AND $max_id \";\n\t\t}\n\t\t$sql .= \"ORDER BY pd.instrument_id ASC, name ASC, pd.quantity ASC\";\n\t\t$result = $this->db->query( $sql );\n\t\treturn $result->rows;\n\t}", "public function index($productId)\n\t{\n\t\t$suppliers = Product::findOrFail($productId)->suppliers;\n\t\treturn Response::json($suppliers);\n\t}", "public function getDiscount()\n {\n return $this->discount;\n }", "public function getDiscount()\n {\n return $this->discount;\n }", "public function getDiscount()\n {\n return $this->discount;\n }", "public function getDiscount()\n {\n return $this->discount;\n }", "public function getDiscount()\n {\n return $this->discount;\n }", "public function getDiscount()\n {\n return $this->discount;\n }", "public function get_discount($dealer_id) {\r\n $fields = array('discount');\r\n $criteria = array('id' => $dealer_id);\r\n $data = $this->dealer_model->get_dealer($fields,$criteria);\r\n //var_dump($data);\r\n echo json_encode($data);\r\n\r\n }", "protected function selectDiscount($orderDetails) {\n\n //Total order value \n $orderValue = $orderDetails->total;\n $this->logger->info(\"Select discount based on order value\");\n\n //Query for product to get product categoryId\n $productDetails = $this->assignProductCategoryId($orderDetails);\n\n foreach($productDetails->items as $key => $values) {\n \n if($values->category == 2 && $values->quantity >= 5) { \n $discountsDetail = $this->computeDiscounts(2, $orderValue, $values);\n $values->discountType = $discountsDetail[\"discountType\"];\n $values->discountQuantity = $discountsDetail[\"discountQuantity\"];\n $values->quantity = $values->quantity + $discountsDetail[\"discountQuantity\"];\n } else if($values->category == 1 && $values->quantity >= 2) { \n $discountsDetail = $this->computeDiscounts(3, $orderValue, $productDetails); \n $orderDetails = $discountsDetail[\"productDetails\"];\n $orderValue = $orderDetails->total - $discountsDetail[\"discountPrice\"]; \n }\n }\n \n $discountPrice = 0;\n $discountType = \"\"; \n $customerId = $orderDetails->{'customer-id'}; \n $customerDetail = $this->discountsRepository->findCustomerById($customerId);\n $customerRevenue = (count($customerDetail) > 0) ? $customerDetail[0]['revenue'] : 0; \n if($customerRevenue >= 1000) {\n $discountsDetail = $this->computeDiscounts(1, $orderValue, []);\n $discountPrice = $discountsDetail[\"discountPrice\"];\n $discountType = $discountsDetail[\"discountType\"]; \n }\n \n $responseData = $orderDetails;\n $responseData->discountPrice = $discountPrice;\n $responseData->discountType = $discountType; \n $responseData->payableAmount = $orderValue - $discountPrice; \n return $responseData;\n \n }", "function cartTotal ($cartItems) {\n\n$grouped = $cartItems->groupBy(\"product_id\");\n$product_quantities = $grouped->map(function ($item, $key) {\n return [$key => $item->sum(\"qty\")];\n});\n$products_ids = array_keys($product_quantities->all());\n$products = Product::whereIn(\"id\", $products_ids)->select([\"price\", \"name\", \"id\", \"item_value_discount\", \"items_value_discount\", \"items_items_discount\"])->get();\n$products = $products->groupBy(\"id\");\n\n$item_value_discounts = collect([]);\n$items_value_discounts = collect([]);\n$items_items_discounts = collect([]);\n\nforeach ($products as $product) {\n if ($product[0]->item_value_discount) {\n \n $item_value_discounts->put($product[0]->id, $product[0]->getActiveItemValueDiscount());\n\n // $item_value_discounts = item_value_discount::where(function ($query) {\n // $query->whereDate(\"starts_at\", \"<=\", date(\"Y-m-d\"))\n // ->whereDate(\"ends_at\", \">=\", date(\"Y-m-d\"));\n // })->orWhere(function ($query) {\n // $query->whereDate(\"starts_at\", \"<=\", date(\"Y-m-d\"))\n // ->whereNull(\"ends_at\");\n // })->get();\n }\n if ($product[0]->items_value_discounts) {\n $items_value_discounts->put($product[0]->id, $product[0]->getActiveItemsValueDiscount());\n // $items_value_discounts = items_value_discount::where(function ($query) {\n // $query->whereDate(\"starts_at\", \"<=\", date(\"Y-m-d\"))\n // ->whereDate(\"ends_at\", \">=\", date(\"Y-m-d\"));\n // })->orWhere(function ($query) {\n // $query->whereDate(\"starts_at\", \"<=\", date(\"Y-m-d\"))\n // ->whereNull(\"ends_at\");\n // })->get();\n }\n if ($product[0]->items_items_discounts) {\n $items_items_discounts->put($product[0]->id, $product[0]->getActiveItemsItemsDiscount());\n // $items_items_discounts = items_items_discount::where(function ($query) {\n // $query->whereDate(\"starts_at\", \"<=\", date(\"Y-m-d\"))\n // ->whereDate(\"ends_at\", \">=\", date(\"Y-m-d\"));\n // })->orWhere(function ($query) {\n // $query->whereDate(\"starts_at\", \"<=\", date(\"Y-m-d\"))\n // ->whereNull(\"ends_at\");\n // })->get();\n }\n}\n// return $item_value_discounts;\n// return $items_value_discounts;\n// return $items_items_discounts;\n\n// if ($item_value_discounts)\n// $item_value_discounts = $item_value_discounts->groupBy(\"product_id\");\n// if ($items_value_discounts)\n// $items_value_discounts = $items_value_discounts->groupBy(\"product_id\");\n// if ($items_items_discounts)\n// $items_items_discounts = $items_items_discounts->groupBy(\"product_id\");\n// return $item_value_discounts;\n\n// return $items_value_discounts;\n// return $items_items_discounts;\n$product_prices_qty = collect([]);\n$product_present = collect([]);\nforeach ($products_ids as $products_id) {\n $product_qty = $product_quantities[$products_id][$products_id];\n $items_items_discounts_product_qty = $product_quantities[$products_id][$products_id];\n if (isset($items_value_discounts[$products_id])) {\n if ($items_value_discounts[$products_id] !== []) {\n foreach ($items_value_discounts[$products_id] as $discount) {\n $count = floor($product_qty / $discount->items_count);\n if ($count) {\n $product_prices_qty->push([\n \"product_id\" => $products_id,\n \"product_name\" => $products[$products_id][0]->name,\n \"qty\" => $discount->items_count * $count,\n \"price\" => $count*$discount->items_value,\n ]);\n $product_qty = $product_qty - ($count * $discount->items_count);\n }\n }\n }\n }\n if (isset($item_value_discounts[$products_id])) {\n if ($item_value_discounts[$products_id] !== []) {\n foreach ($item_value_discounts[$products_id] as $discount) {\n if ($product_qty) {\n $price = $products[$products_id][0]->price;\n $value = $discount->value;\n $percent = $discount->percent;\n \n if ($value && $percent) {\n $price = $price - $value;\n } else if ($value && !$percent) {\n $price = $price - $value;\n } else {\n $price = $price - (($percent / 100) * $price);\n }\n $total = $price*$product_qty;\n $product_prices_qty->push([\n \"product_id\" => $products_id,\n \"product_name\" => $products[$products_id][0]->name,\n \"qty\" => $product_qty,\n \"price\" => $total,\n ]);\n }\n }\n }\n }\n if (isset($items_items_discounts[$products_id])) {\n if ($items_items_discounts[$products_id] !== []) {\n $items_number = $items_items_discounts_product_qty;\n $max_get_number = 0;\n // $product_present = collect([]);\n foreach ($items_items_discounts[$products_id] as $discount) {\n $count = floor($items_number / $discount->buy_items_count);\n if (!$product_prices_qty->contains('product_id', $products_id)){\n $price = $products[$products_id][0]->price;\n $total = $price * $items_items_discounts_product_qty;\n $product_prices_qty->push([\n \"product_id\" => $products_id,\n \"qty\" => $items_items_discounts_product_qty,\n \"product_name\" => $products[$products_id][0]->name,\n \"price\" => $total,\n ]);\n }\n if ($count) {\n if ($discount->get_items_count > $max_get_number) {\n $max_get_number = $discount->get_items_count * $count;\n \n $offer = [\n \"product_id\" => $products_id,\n \"buy_items_count\" => $discount->buy_items_count,\n \"presents_count\" => $max_get_number,\n \"present_product_id\" => $discount->present_product_id,\n ];\n }\n }\n }\n $product_present->push($offer);\n }\n }\n}\n$data = [\"totals\" => $product_prices_qty, \"presents\" => $product_present];\nreturn $data;\n}", "public function index()\n {\n $data=Discount::with('product')->get();\n return view ('discount.discount',compact(['data']));\n }", "public function getDiscountInvoiced() {\n return $this->item->getDiscountInvoiced();\n }", "static function getRestaurantReservationRevenue($id)\n {\n //lay ra cac san pham trong mot bar reservation\n $product_items =RestaurantTotalReportDB::get_reservation_product($id);\n //System::debug($product_items);\n $total_discount = 0;\n\t\t$total_price = 0;\n $product_for_report = array();\n $product_for_report['product']['original_price'] = 0;\n $product_for_report['product']['real_price'] = 0;\n $product_for_report['is_processed']['real_price'] = 0;\n $product_for_report['is_processed']['original_price'] = 0;\n $product_for_report['service']['real_price'] = 0;\n $product_for_report['service']['original_price'] = 0;\n foreach($product_items as $key=>$value)\n\t\t{\n\t\t\tif($value['is_processed'] == 1 and $value['type'] != 'SERVICE')\n {\n\t\t\t\t$ttl = $value['price']*($value['quantity'] - $value['quantity_discount']);\n\t\t\t\t$discnt = ($ttl*$value['discount_category']/100) + (($ttl*(100-$value['discount_category'])/100)*$value['discount_rate']/100);\n\t\t\t\t$total_discount += $discnt;\n\t\t\t\tif($ttl<0)\n {\n\t\t\t\t\t$ttl = 0;\n\t\t\t\t}\n\t\t\t\t$total_price += $ttl-$discnt;\n $product_for_report['is_processed']['original_price'] += $value['original_price'];\n $product_for_report['is_processed']['real_price'] += $ttl-$discnt;\n\t\t\t}\n if($value['is_processed'] == 0 and $value['type'] != 'SERVICE')\n {\n\t\t\t\t$ttl = $value['price']*($value['quantity'] - $value['quantity_discount']);\n\t\t\t\t$discnt = ($ttl*$value['discount_category']/100) + (($ttl*(100-$value['discount_category'])/100)*$value['discount_rate']/100);\n\t\t\t\t$total_discount += $discnt;\n\t\t\t\tif($ttl<0)\n {\n\t\t\t\t\t$ttl = 0;\n\t\t\t\t}\n\t\t\t\t$total_price += $ttl-$discnt;\n $product_for_report['product']['original_price'] += $value['original_price'];\n $product_for_report['product']['real_price'] += $ttl-$discnt;\t\n\t\t\t}\n if($value['type'] == 'SERVICE')\n {\n $ttl = $value['price']*($value['quantity'] - $value['quantity_discount']);\n\t\t\t\t$discnt = ($ttl*$value['discount_category']/100) + (($ttl*(100-$value['discount_category'])/100)*$value['discount_rate']/100);\n\t\t\t\t$total_discount += $discnt;\n\t\t\t\tif($ttl<0)\n {\n\t\t\t\t\t$ttl = 0;\n\t\t\t\t}\n\t\t\t\t$total_price += $ttl-$discnt;\n $product_for_report['service']['original_price'] += $value['original_price'];\n $product_for_report['service']['real_price'] += $ttl-$discnt;\t\n }\n\t\t}\n return $product_for_report;\n }", "public function getDiscountPriceInfo()\n {\n return $this->discountPriceInfo;\n }", "public function getBaseDiscountInvoiced();", "public function getPrices()\n {\n }", "public function getTonicDiscount()\n {\n }", "protected function calculateDiscount() : void{\r\n $percentage = ($this->discounted_value * 100) / $this->order->getTrueTotal();\r\n $new_total = $this->order->getTrueTotal() - $this->discounted_value;\r\n\r\n $this->order_discount_value = $this->discounted_value;\r\n $this->order_discount_percentage = $percentage;\r\n $this->order_discount_reason = \"For every \" . $this->products_nr . \" products from category #\" . $this->category_id . \" you get one free. You got: \";\r\n foreach($this->items_matching as $item){\r\n $this->order_discount_reason .= floor($item[\"qty\"] / $this->products_nr) . \" x '\" . $item[\"description\"] . \"' (€\". $item[\"price\"] .\" each) ; \";\r\n }\r\n $this->order_new_total = $new_total;\r\n }", "function getSessionCoupons_discountOnly() {\r\n\t\tif($couponsArray = $this->getSessionCoupons()) {\r\n\t\t\tforeach($couponsArray as $couponId => $coupon) {\r\n\t\t\t\tif(!$coupon['has_articles']) $outArray[$couponId] = $coupon;\r\n\t\t\t}\r\n\t\t\treturn $outArray;\r\n\t\t} else {\r\n\t\t\treturn false;\r\n\t\t}\r\n\t}", "public function getSubtotalDiscount()\n {\n $this->initializeSubtotals();\n\n return $this->getIfSet('discount', $this->data->amount->subtotals);\n }", "function GetDiscountsForm()\n\t{\n\t\t// We do not need to authorise the user as this only draws a subsection of one of the forms\n\n\t\tif (!DBO()->RatePlan->ServiceType->Value)\n\t\t{\n\t\t\t// A service type was not actually chosen\n\t\t\tAjax()->RenderHtmlTemplate(\"PlanAdd\", HTML_CONTEXT_DISCOUNTS_EMPTY, \"DiscountsDiv\");\n\t\t\treturn TRUE;\n\t\t}\n\n\t\t// Find all RecordTypes belonging to this ServiceType\n\t\tDBL()->RecordType->ServiceType = DBO()->RatePlan->ServiceType->Value;\n\t\tDBL()->RecordType->OrderBy(\"Name\");\n\t\tDBL()->RecordType->Load();\n\n\t\t// If a RatePlan.Id xor BaseRatePlan.Id has been specified then we want to mark which of these Discounts belong to it\n\t\tif (DBO()->RatePlan->Id->Value)\n\t\t{\n\t\t\t$intRatePlanId = DBO()->RatePlan->Id->Value;\n\t\t}\n\t\telseif (DBO()->BaseRatePlan->Id->Value)\n\t\t{\n\t\t\t$intRatePlanId = DBO()->BaseRatePlan->Id->Value;\n\t\t}\n\t\tif (isset($intRatePlanId))\n\t\t{\n\t\t\t// Find all the Discounts currently used by this RatePlan\n\t\t\tDBL()->rate_plan_discount->rate_plan_id = $intRatePlanId;\n\t\t\tDBL()->rate_plan_discount->Load();\n\n\t\t\tforeach (DBL()->rate_plan_discount as $dboRatePlanDiscount)\n\t\t\t{\n\t\t\t\tDBL()->discount_record_type->discount_id\t= $dboRatePlanDiscount->discount_id->Value;\n\t\t\t\tDBL()->discount_record_type->Load();\n\n\n\t\t\t\tforeach (DBL()->discount_record_type as $dboDiscountRecordType)\n\t\t\t\t{\n\t\t\t\t\tforeach (DBL()->RecordType as $dboRecordType)\n\t\t\t\t\t{\n\t\t\t\t\t\tif ($dboRecordType->Id->Value === $dboDiscountRecordType->record_type_id->Value)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$dboRecordType->discount_id\t= $dboDiscountRecordType->discount_id->Value;\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\n\t\t// Render the html template\n\t\tAjax()->RenderHtmlTemplate(\"PlanAdd\", HTML_CONTEXT_DISCOUNTS, \"DiscountsDiv\");\n\n\t\t// Set the focus to the Rate Group combobox of the first RecordType to display\n\t\t/* This is not done anymore and can be removed\n\t\tif (DBL()->RecordType->RecordCount() > 0)\n\t\t{\n\t\t\tDBL()->RecordType->rewind();\n\t\t\t$dboFirstRecordType = DBL()->RecordType->current();\n\t\t\t$strElement = \"RateGroup\" . $dboFirstRecordType->Id->Value . \".RateGroupId\";\n\t\t\tAjax()->AddCommand(\"SetFocus\", $strElement);\n\t\t}\n\t\t*/\n\t\treturn TRUE;\n\t}", "function edd_social_discounts() {\n\treturn EDD_Social_Discounts::get_instance();\n}", "public static function getDeals() {\n\t\t\tglobal $dealofday;\n\t\t\t$args = array();\n\t\t\t$args['post_type'] = 'product';\n\t\t\t$args['meta_key'] = 'dod_is_in_dod';\n\t\t\t$args['meta_value'] = 'on';\n\t\t\t$args['orderby'] = \"menu_order\";\n\t\t\t$args['order'] = 'ASC';\n\t\t\tadd_filter('posts_results', array(&$dealofday, 'order_by_featured'), PHP_INT_MAX, 2);\n\t\t\treturn new WP_Query($args);\n\t\t}", "public function index()\n {\n //\n $discounts = Discount::with([\"category\",\"offer\"])->get();\n return view('discount.index')->with([\"discounts\"=>$discounts]);\n }", "private function queryDepositsAndWithdrawals() {\r\n return $this->queryAPI( 'returnDepositsWithdrawals', //\r\n [\r\n 'start' => time() - 14 * 24 * 3600,\r\n 'end' => time() + 3600\r\n ]\r\n );\r\n\r\n }", "public function purchasedBooks()\n { \n return $this->orders();\n }", "function calculateDiscount( $ammount, $discounts ) {\r\n\t\r\n\tforeach ( $discounts as $idx=>$item ) {\r\n\t\tif ( $ammount >= $item[0] && $item[1] > $percent ) {\r\n\t\t\t$percent = $item[1];\r\n\t\t\t$price = $ammount*$percent/100;\r\n\t\t}\r\n\t}\r\n\t\r\n\treturn array( intval($price), intval($percent) );\r\n}", "function get_discounts_before_tax() {\n\t\t\tif ($this->discount_cart) :\n\t\t\t\treturn cmdeals_price($this->discount_cart); \n\t\t\tendif;\n\t\t\treturn false;\n\t\t}", "public function setDiscounts($v)\n {\n if ($v !== null) {\n $v = (string) $v;\n }\n\n if ($this->discounts !== $v) {\n $this->discounts = $v;\n $this->modifiedColumns[KluBillTableMap::COL_DISCOUNTS] = true;\n }\n\n return $this;\n }", "public function getShippingDiscountAmount();", "public function getCompetitivePricingForSKU($request);", "public function getDiscount($uuid) {\n return $this->_discounts[$uuid]??null;\n }", "public function hasDiscounts()\n {\n return !empty($this->discounts);\n }", "public function index()\n {\n $patientDiscounts = PatientDiscount::all();\n return $patientDiscounts;\n }", "public function discounts()\n {\n $discount = 0;\n foreach ($this->coupons as $coupon) {\n $discount += $coupon->getDiscountApplied($this);\n }\n return $discount;\n }", "function get_discounted_price( $values, $price, $add_totals = false ) {\n\t\n\t\t\tif ($this->applied_coupons) foreach ($this->applied_coupons as $code) :\n\t\t\t\t$coupon = new cmdeals_coupon( $code );\n\t\t\t\t\n\t\t\t\tif ( $coupon->apply_before_tax() && $coupon->is_valid() ) :\n\t\t\t\t\t\n\t\t\t\t\tswitch ($coupon->type) :\n\t\t\t\t\t\n\t\t\t\t\t\tcase \"fixed_deals\" :\n\t\t\t\t\t\tcase \"percent_deals\" :\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t$this_item_is_discounted = false;\n\t\t\t\t\n\t\t\t\t\t\t\t// Specific deals ID's get the discount\n\t\t\t\t\t\t\tif (sizeof($coupon->deal_ids)>0) :\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tif ((in_array($values['deal_id'], $coupon->deal_ids) || in_array($values['variation_id'], $coupon->deal_ids))) :\n\t\t\t\t\t\t\t\t\t$this_item_is_discounted = true;\n\t\t\t\t\t\t\t\tendif;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\telse :\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t// No deals ids - all items discounted\n\t\t\t\t\t\t\t\t$this_item_is_discounted = true;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tendif;\n\t\t\t\t\n\t\t\t\t\t\t\t// Specific deals ID's excluded from the discount\n\t\t\t\t\t\t\tif (sizeof($coupon->exclude_deals_ids)>0) :\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tif ((in_array($values['deal_id'], $coupon->exclude_deals_ids) || in_array($values['variation_id'], $coupon->exclude_deals_ids))) :\n\t\t\t\t\t\t\t\t\t$this_item_is_discounted = false;\n\t\t\t\t\t\t\t\tendif;\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tendif;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Apply filter\n\t\t\t\t\t\t\t$this_item_is_discounted = apply_filters( 'cmdeals_item_is_discounted', $this_item_is_discounted, $values, $before_tax = true );\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Apply the discount\n\t\t\t\t\t\t\tif ($this_item_is_discounted) :\n\t\t\t\t\t\t\t\tif ($coupon->type=='fixed_deals') :\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tif ($price < $coupon->amount) :\n\t\t\t\t\t\t\t\t\t\t$discount_amount = $price;\n\t\t\t\t\t\t\t\t\telse :\n\t\t\t\t\t\t\t\t\t\t$discount_amount = $coupon->amount;\n\t\t\t\t\t\t\t\t\tendif;\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t$price = $price - $coupon->amount;\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tif ($price<0) $price = 0;\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tif ($add_totals) :\n\t\t\t\t\t\t\t\t\t\t$this->discount_cart = $this->discount_cart + ( $discount_amount * $values['quantity'] );\n\t\t\t\t\t\t\t\t\tendif;\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\telseif ($coupon->type=='percent_deals') :\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t$percent_discount = ( $values['data']->get_price( false ) / 100 ) * $coupon->amount;\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tif ($add_totals) $this->discount_cart = $this->discount_cart + ( $percent_discount * $values['quantity'] );\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t$price = $price - $percent_discount;\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tendif;\n\t\t\t\t\t\t\tendif;\n\t\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\n\t\t\t\t\t\tcase \"fixed_cart\" :\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t/** \n\t\t\t\t\t\t\t * This is the most complex discount - we need to divide the discount between rows based on their price in\n\t\t\t\t\t\t\t * proportion to the subtotal. This is so rows with different tax rates get a fair discount, and so rows\n\t\t\t\t\t\t\t * with no price (free) don't get discount too.\n\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Get item discount by dividing item cost by subtotal to get a %\n\t\t\t\t\t\t\t$discount_percent = ($values['data']->get_price( false )*$values['quantity']) / $this->subtotal_ex_tax;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Use pence to help prevent rounding errors\n\t\t\t\t\t\t\t$coupon_amount_pence = $coupon->amount * 100;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Work out the discount for the row\n\t\t\t\t\t\t\t$item_discount = $coupon_amount_pence * $discount_percent;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Work out discount per item\n\t\t\t\t\t\t\t$item_discount = $item_discount / $values['quantity'];\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Pence\n\t\t\t\t\t\t\t$price = ( $price * 100 );\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Check if discount is more than price\n\t\t\t\t\t\t\tif ($price < $item_discount) :\n\t\t\t\t\t\t\t\t$discount_amount = $price;\n\t\t\t\t\t\t\telse :\n\t\t\t\t\t\t\t\t$discount_amount = $item_discount;\n\t\t\t\t\t\t\tendif;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Take discount off of price (in pence)\n\t\t\t\t\t\t\t$price = $price - $discount_amount;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Back to pounds\n\t\t\t\t\t\t\t$price = $price / 100; \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Cannot be below 0\n\t\t\t\t\t\t\tif ($price<0) $price = 0;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Add coupon to discount total (once, since this is a fixed cart discount and we don't want rounding issues)\n\t\t\t\t\t\t\tif ($add_totals) $this->discount_cart = $this->discount_cart + (($discount_amount*$values['quantity']) / 100);\n\t\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\n\t\t\t\t\t\tcase \"percent\" :\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Get % off each item - this works out the same as doing the whole cart\n\t\t\t\t\t\t\t//$percent_discount = ( $values['data']->get_price( false ) / 100 ) * $coupon->amount;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t$percent_discount = ( $values['data']->get_price( ) / 100 ) * $coupon->amount;\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tif ($add_totals) $this->discount_cart = $this->discount_cart + ( $percent_discount * $values['quantity'] );\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t$price = $price - $percent_discount;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\n\t\t\t\t\tendswitch;\n\t\t\t\t\t\n\t\t\t\tendif;\n\t\t\tendforeach;\n\t\t\t\n\t\t\treturn apply_filters( 'cmdeals_get_discounted_price_', $price, $values, $this );\n\t\t}", "public function providerNormalPurchases()\r\n\t{\r\n\t\t$appleProduct = $this->getAppleProduct();\r\n\t\t$lightProduct = $this->getLightProduct();\r\n\t\t$starshipProduct = $this->getStarshipProduct();\r\n\r\n\t\treturn array(\r\n\t\t\tarray(\r\n\t\t\t\t2.0 * self::PRODUCT_APPLE_PRICE,\r\n\t\t\t\tarray(\r\n\t\t\t\t\tnew ProductToPurchase($appleProduct, 2.0),\r\n\t\t\t\t),\r\n\t\t\t),\r\n\t\t\tarray(\r\n\t\t\t\t5 * self::PRODUCT_LIGHT_PRICE + 1.0 * self::PRODUCT_APPLE_PRICE,\r\n\t\t\t\tarray(\r\n\t\t\t\t\tnew ProductToPurchase($lightProduct, 5),\r\n\t\t\t\t\tnew ProductToPurchase($appleProduct, 1.0),\r\n\t\t\t\t),\r\n\t\t\t),\r\n\t\t\tarray(\r\n\t\t\t\t1 * self::PRODUCT_STARSHIP_PRICE,\r\n\t\t\t\tarray(\r\n\t\t\t\t\tnew ProductToPurchase($starshipProduct, 1),\r\n\t\t\t\t),\r\n\t\t\t),\r\n\t\t);\r\n\t}", "public function getDiscounted()\n {\n if (is_null($this->discounted)) {\n /** @psalm-var stdClass|array<string, mixed>|null $data */\n $data = $this->raw(self::FIELD_DISCOUNTED);\n if (is_null($data)) {\n return null;\n }\n\n $this->discounted = DiscountedPriceModel::of($data);\n }\n\n return $this->discounted;\n }", "public function getNoDiscount() {\n return $this->item->getNoDiscount();\n }", "function thrive_dashboard_get_licensed_products()\n{\n $products = array();\n\n $products = apply_filters('thrive_dashboard_licensed_products', $products);\n\n return $products;\n}", "public function getDiscounted()\n {\n return $this->discounted instanceof DiscountedPriceDraftBuilder ? $this->discounted->build() : $this->discounted;\n }", "private function getPurchases()\n {\n try {\n $items = [];\n $collection = $this->checkoutSession->getLastRealOrder()->getAllVisibleItems();\n $store = $this->storeManager->getStore();\n foreach ($collection as $product) {\n $formatted_price = $product->getRowTotal() - $product->getDiscountAmount() + $product->getTaxAmount();\n $prod = [\n 'item_id' => $product->getProductId(),\n 'quantity' => $product->getQtyOrdered(),\n 'price' => $product->getPrice(),\n 'properties' => [\n 'formatted_price' => $formatted_price,\n 'sku' => $product->getSku(),\n 'tax_amount' => $product->getTaxAmount(),\n 'currency' => $this->environment->getCurrencyCode(),\n 'current_crcy' => $store->getCurrentCurrencyCode(),\n 'lang' => $store->getCode()\n ]\n ];\n $items[] = $prod;\n }\n\n return $items;\n } catch (\\Exception $exception) {\n $this->logger\n ->critical(\n \"Observer/Purchase->getPurchases() Exception: \",\n [\n get_class($exception),\n $exception->getMessage(),\n $exception->getCode()\n ]\n );\n return [];\n }\n }", "public function getDocumentProductDiscount()\n {\n return (string) $this->document_product_discount;\n }", "public function getBaseDiscountRefunded();" ]
[ "0.7438757", "0.72354126", "0.71589047", "0.6997837", "0.6935469", "0.6924665", "0.6901722", "0.68864363", "0.6780065", "0.6496116", "0.6439145", "0.6363786", "0.62761253", "0.62736195", "0.6267608", "0.62268347", "0.62102467", "0.610163", "0.60943395", "0.60367244", "0.5967959", "0.5920464", "0.59109", "0.59078", "0.58777887", "0.5824816", "0.5809528", "0.58060634", "0.57607967", "0.57607967", "0.5752221", "0.5744593", "0.57336354", "0.5725123", "0.5700267", "0.56993186", "0.56927794", "0.568361", "0.56685746", "0.5666067", "0.5643766", "0.562603", "0.56104684", "0.5595688", "0.55672556", "0.55658966", "0.5557672", "0.55502355", "0.55472404", "0.5531326", "0.5529338", "0.5529291", "0.5511008", "0.55072594", "0.5494494", "0.5492705", "0.5489481", "0.54887396", "0.54887396", "0.54887396", "0.54887396", "0.54887396", "0.54887396", "0.5477752", "0.54728794", "0.5472641", "0.54703534", "0.54638064", "0.5457053", "0.545686", "0.54547405", "0.54474133", "0.5445815", "0.544396", "0.5441704", "0.54407346", "0.5431082", "0.54300565", "0.5420798", "0.54204375", "0.54106885", "0.53887343", "0.5382293", "0.53643215", "0.53634346", "0.5361783", "0.5350528", "0.53482443", "0.53439796", "0.5338341", "0.5337841", "0.53315413", "0.5328539", "0.5318814", "0.53004414", "0.5288643", "0.527749", "0.52673763", "0.5259908", "0.5248466" ]
0.6859741
8
Get all deny rules for product
public static function getAllDenyRules($product, $sku_id = 0) { // Если требуется показать все правила скидок, невзирая на условия if ($product === null || !$product) { $product = self::getAbstractProduct(); $sku_id = 0; } $instance = get_class(); // Получаем товар if (is_int($product)) { $product = new shopProduct($product); } $product = ($product instanceof shopProduct) ? $product->getData() : $product; if (!$product) { return array(); } // Правила скидок $discount_groups = shopFlexdiscountHelper::getDiscounts(); if (!$discount_groups) { return array(); } $product = self::prepareProduct($product, $sku_id); $sku_id = $product['sku_id']; // Добавляем товар к заказу $order_params = (new shopFlexdiscountWorkflow())->addToOrder($product); self::$user = $order_params['contact']; self::setOrderInfo($order_params['order']); $items = $order_params['order']['items']; // Выполняем предварительную обработку товаров shopFlexdiscountHelper::workupProducts($items); self::getAllItems($items); $deny_rules = array(); // Фильтруем правила запрета foreach ($discount_groups as $group_id => $group) { $rules = $group_id === 0 ? $group : $group['items']; foreach ($rules as $rule) { if ($rule['deny'] && $rule['status']) { // Условия $conditions = self::decode($rule['conditions']); // Товары, удовлетворяющие условиям $result_items = $conditions ? self::filter_items($items, $conditions->group_op, $conditions->conditions) : $items; if ($result_items) { $target = self::decode($rule['target']); foreach ($target as $t) { $function_name = 'avail_target_' . $t->target; if (method_exists($instance, $function_name)) { // Товары, на которые скидка не распространяется $deny_items = self::$function_name($result_items, $items, $t, $rule, $sku_id); if ($deny_items || !$sku_id) { $deny_rules[$rule['id']] = $rule; } } } } } } } return $deny_rules; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function accessRules() {\n return array(\n array(\n 'deny',\n 'actions' => array('oauthadmin'),\n ),\n );\n }", "public function policy()\n {\n $return = array();\n\n // Itterate over policy rules\n foreach( $this->rules as $k => $v )\n {\n // If rule is enabled, add string to array\n $string = $this->get_rule_error($k);\n if( $string ) $return[$k] = $string;\n }\n\n return $return;\n }", "public function accessRules()\n\t{\n\t\t$route = Yii::app()->controller->getRoute();\n\t\t$operation = str_replace('/', '.', $route);\n\t\t\n\t\t$rulesArr = array();\n\t\t$rulesArr[] = array('allow',\n\t\t\t\t'actions'=>array($this->getAction()->id),\n\t\t\t\t'roles'=>array($operation), \n\t\t\t);\n\t\t$rulesArr[] = array('deny', // deny all users\n\t\t\t\t'users'=>array('*'),\n\t\t\t);\n\t\t\n\t\treturn $rulesArr;\n\t}", "function getDenyReasons() {\n return $this->denied_reasons;\n }", "public function getRulesList(){\n return $this->_get(3);\n }", "public function getRules();", "public function accessRules() {\n return array(\n array('allow',\n 'expression' => 'Yii::app()->user->isAdmin()',\n ),\n array('deny', // deny all users\n 'users' => array('*'),\n ),\n );\n }", "public function getRules() {}", "public function get_all_rules()\n {\n }", "public function accessRules()\n\t{\n\t\treturn array(\n\t\t\tarray('allow', \n\t\t\t\t'actions'=>array('new','edit','delete','save'),\n\t\t\t\t'expression'=>array('ProductsrateController','allowReadWrite'),\n\t\t\t),\n\t\t\tarray('allow', \n\t\t\t\t'actions'=>array('index','view'),\n\t\t\t\t'expression'=>array('ProductsrateController','allowReadOnly'),\n\t\t\t),\n\t\t\tarray('deny', // deny all users\n\t\t\t\t'users'=>array('*'),\n\t\t\t),\n\t\t);\n\t}", "public function accessRules()\n {\n $acl = $this->acl;\n\n return [\n ['allow', // allow all users to perform 'index' and 'view' actions\n 'actions' => ['index', 'view'],\n 'users' => ['@'],\n ],\n ['allow', // allow authenticated user to perform 'create' and 'update' actions\n 'actions' => ['create', 'getLoadingAddressList'],\n 'expression' => function() use ($acl) {\n return $acl->canCreateOrder();\n },\n ],\n ['allow', // allow to perform 'accomplish' action\n 'actions' => ['update'],\n 'expression' => function() use ($acl) {\n return $acl->canUpdateOrder();\n },\n ],\n ['allow', // allow to perform 'accomplish' action\n 'actions' => ['withdraw'],\n 'expression' => function() use ($acl) {\n return $acl->canWithdrawOrder();\n },\n ],\n ['allow', // allow to perform 'accomplish' action\n 'actions' => ['restore'],\n 'expression' => function() use ($acl) {\n return $acl->canRestoreOrder();\n },\n ],\n ['allow', // allow to perform 'accomplish' action\n 'actions' => ['accomplish'],\n 'expression' => function() use ($acl) {\n return $acl->canAccomplishOrder();\n },\n ],\n ['allow', // allow to perform 'accomplish' action\n 'actions' => ['reopen'],\n 'expression' => function() use ($acl) {\n return $acl->canReopenOrder();\n },\n ],\n ['allow', // allow to perform 'loadCargo' action\n 'actions' => ['loadCargo'],\n 'expression' => function() use ($acl) {\n return $acl->canAccessLoadCargo();\n },\n ],\n ['allow', // allow to perform 'delete' action\n 'actions' => ['delete', 'softDelete'],\n 'expression' => function() use ($acl) {\n return $acl->canDeleteOrder();\n },\n ],\n ['allow', // allow admin user to perform 'admin' action\n 'actions' => ['admin'],\n 'expression' => function() use ($acl) {\n return $acl->getUser()->isAdmin();\n },\n ],\n ['deny', // deny all users\n 'users' => ['*'],\n ],\n ];\n }", "public function accessRules()\n {\n return array(\n array('allow',\n 'expression' => 'Yii::app()->user->isAdmin()',\n ),\n array('deny', // deny all users\n 'users' => array('*'),\n ),\n );\n }", "public function accessRules()\n {\n return array(\n array('allow',\n 'expression' => 'Yii::app()->user->isAdmin()',\n ),\n array('deny', // deny all users\n 'users' => array('*'),\n ),\n );\n }", "public function accessRules() {\n // en este array colocar solo los action de consulta\n return array(\n array('allow',\n 'actions' => array(),\n 'pbac' => array('write', 'admin'),\n ),\n array('allow',\n 'actions' => array(),\n 'pbac' => array('read'),\n ),\n // este array siempre va asì para delimitar el acceso a todos los usuarios que no tienen permisologia de read o write sobre el modulo\n array('deny', // deny all users\n 'users' => array('*'),\n ),\n );\n }", "private static function getProductRules() {\n return array(\n 'price' => 'required',\n 'original_price' => 'required',\n 'quantity' => 'required',\n );\n }", "public function accessRules() {\n return VAuth::getAccessRules('package', array('getCity', 'clear', 'export', 'entry', 'input', 'childUpdate', 'index'));\n }", "public function accessRules()\r\n\t{\r\n\t\t$rules = array(\r\n\t\t\tarray( 'allow', // allow authenticated user to...\r\n\t\t\t\t'actions' => array( 'index' ),\r\n\t\t\t\t'roles' => array('question')\r\n\t\t\t),\r\n\t\t\tarray('deny',\r\n\t\t\t\t'users'=>array('*')\r\n\t\t\t\t)\r\n\t\t);\r\n\t\treturn $rules;\r\n\t}", "public function getRules(): array\n {\n if (Auth::id()==1){\n return [\n ['disk' => 'projects', 'path' => '*', 'access' => 2],\n ];\n }\n return \\DB::table('acl_rules')\n ->where('user_id', $this->getUserID())\n ->get(['disk', 'path', 'access'])\n ->map(function ($item) {\n return get_object_vars($item);\n })\n ->all();\n }", "public function accessRules(){// правила доступа к ресурсам контроллера\n $f=array();\n if(!Yii::app()->user->getState('sup')){\n $f=$this->ActionsForUser(__CLASS__);\n }\n return array(\n array('allow', // список разрешений\n 'actions'=>$f,\n 'users'=>array(Yii::app()->user->id),\n ),\n array('deny', // список запрещений\n 'users'=>array('*','$'),\n ),\n );\n }", "public function accessRules() {\n return array(\n array('allow',\n 'actions' => array('morecomments', 'approve', 'dashboard', 'create', 'list', 'update', 'delete', 'deleteall', 'index', 'view', 'replay', 'message.msg'),\n 'expression' => '$user->isAdministrator()',\n ),\n array('deny',\n 'users' => array('*'),\n )\n// array('allow', // allow all users to perform 'index' and 'view' actions\n// 'actions' => array('index', 'view'),\n// 'users' => array('*'),\n// ),\n// array('allow', // allow authenticated user to perform 'create' and 'update' actions\n// 'actions' => array('create', 'update'),\n// 'users' => array('@'),\n// ),\n// array('allow', // allow dashboard user to perform 'dashboard' and 'delete' actions\n// 'actions' => array('dashboard', 'delete'),\n// 'users' => array('dashboard'),\n// ),\n// array('deny', // deny all users\n// 'users' => array('*'),\n// ),\n );\n }", "public function accessRules()\n {\n return array(\n array('allow',\n 'roles' => array('admin'),\n ),\n array('deny',\n 'users' => array('*'),\n ),\n );\n }", "public function getRules()\n {\n return $this->get(self::_RULES);\n }", "public function getRules(): Collection;", "public function accessRules()\n\t{\n\t\treturn array(\n\t\t\tarray('deny', // deny not login users\n\t\t\t\t'users'=>array('?'),\n\t\t\t),\n\t\t);\n\t}", "public function getAllowSpecific();", "public function accessRules()\n {\n \treturn array (\n \t\t\tarray (\n \t\t\t\t\t'allow',\n \t\t\t\t\t//'actions' => array ('*'),\n \t\t\t\t\t'roles' => array ('admin')\n \t\t\t),\n \t\t\tarray (\n \t\t\t\t\t'deny', // deny all users\n \t\t\t\t\t'users' => array ('*')\n \t\t\t)\n \t);\n }", "public function getAvailableRules()\n {\n return null;\n }", "public function accessRules() {\n\n // en este array colocar solo los action de consulta\n return array(\n array('allow',\n 'actions' => array('index', 'EstadisticoDirectoresDiario','ReporteDetalladoDirectoresDiario'),\n 'pbac' => array( 'write','admin'),\n ),\n array('allow',\n 'actions' => array('index', 'EstadisticoDirectoresDiario','ReporteDetalladoDirectoresDiario'),\n 'pbac' => array('read'),\n ),\n // este array siempre va asì para delimitar el acceso a todos los usuarios que no tienen permisologia de read o write sobre el modulo\n array('deny', // deny all users\n 'users' => array('*'),\n ),\n );\n }", "public function accessRules()\n {\n return array(\n array('allow',\n 'actions' => array(\n 'GetAssignedAdminNoteGridView',\n 'GetAdminNoteDialog',\n 'GetAdminGridView',\n 'GetProjectsGridView',\n 'GetNoteExternalUsersGridView',\n 'GetAdminUsers',\n 'GetProjectsDialog',\n 'GetExternalUsersDialog',\n 'GetAppInfoToShowAssignedAdmins',\n 'CopyNoteForSelectedProjects',\n 'GetAllowNoteLanguages',\n 'GetAllowNoteServices',\n 'GetNoteAsAdmin',\n 'SaveAdminNote',\n 'RemoveNote',\n 'GetNoteStatus',\n 'ChangeStatus',\n 'MarkNoteAsReadByAssignee', \n 'AddComment',\n 'ExcelExport',\n ),\n 'roles' => array('admin', 'super_admin', 'operations_admin', 'limited_admin', 'client')\n ),\n array('allow',\n 'actions' => array(\n 'GetUserGridView',\n 'MarkNoteAsReadByExternalUser',\n ),\n 'users' => array('@')\n ),\n array('deny',\n 'users' => array('*')\n )\n );\n }", "public function rules()\n\t{\n\t\t[$productType]\t= Arr::divide(config('products.products'));\n\t\treturn PaginateHelper::getRules([\n\t\t\t'product_id'\t\t=> 'array',\n\t\t\t'product_id.*'\t\t=> 'integer',\n\t\t\t'title'\t\t\t\t=> 'nullable|string|max:255',\n\t\t\t'description'\t\t=> 'nullable|string',\n\t\t\t'product_type'\t\t=> 'array',\n\t\t\t'product_type.*'\t=> 'in:'.Str::implode(',', $productType),\n\t\t\t'product_cat'\t\t=> 'array',\n\t\t\t'product_cat.*'\t\t=> 'in:'.Str::implode(',', config('products.product_cats')),\n\t\t\t'entity_id'\t\t\t=> 'array'\n\t\t],\n\t\t[\n\t\t\t'product_id',\n\t\t\t'title',\n\t\t\t'description',\n\t\t\t'product_type',\n\t\t\t'product_cat'\n\t\t],\n\t\t[\n\t\t\t'product_id',\n\t\t\t'title'\n\t\t]);\n\t}", "public static function getAllRules($type) {\n $rules = self::getProductRules();\n\n switch($type) {\n case 'rim':\n $rules = self::setRimRules($rules);\n break;\n case 'tire':\n $rules = self::setTireRules($rules);\n break;\n }\n return $rules;\n }", "public function accessRules()\n\t{\n\t\treturn array(\n\t\t\tarray('allow', // allow admins only\n\t\t\t\t'users'=>Yii::app()->getModule('user')->getAdmins(),\n\t\t\t),\n\t\t\tarray('allow',\n\t\t\t\t\t\t/*'users' => array(\"?\"),*/\n 'expression' => array($this,'isLogedInOrHasKey'),\n ),\n\t\t\tarray('deny', // deny all users\n\t\t\t\t'users'=>array('*'),\n\t\t\t),\n\t\t);\n\t}", "public function accessRules() {\n return array(\n /* array('allow', \n 'actions'=>array('*'),\n 'roles'=>array('events'),\n ), */\n array('deny', // deny all users\n 'actions'=>array( 'negotiatingAdd'),\n 'users'=>array('?'),\n ),\n \n array('allow', // deny all users\n 'users'=>array('*'),\n ),\n );\n }", "static function getrules_block_wp_file_access()\r\n {\r\n global $aio_wp_security;\r\n $rules = '';\r\n if ($aio_wp_security->configs->get_value('aiowps_prevent_default_wp_file_access') == '1') {\r\n $rules .= AIOWPSecurity_Utility_Htaccess::$prevent_wp_file_access_marker_start . PHP_EOL; //Add feature marker start\r\n $rules .= self::create_apache2_access_denied_rule('license.txt');\r\n $rules .= self::create_apache2_access_denied_rule('wp-config-sample.php');\r\n $rules .= self::create_apache2_access_denied_rule('readme.html');\r\n $rules .= AIOWPSecurity_Utility_Htaccess::$prevent_wp_file_access_marker_end . PHP_EOL; //Add feature marker end\r\n }\r\n\r\n return $rules;\r\n }", "public function retrievePasswordValidationRules()\n {\n return $this->startAnonymous()->uri(\"/api/tenant/password-validation-rules\")\n ->get()\n ->go();\n }", "public function getTaxRulesByProduct()\n {\n return collect([]);\n }", "public function getValidatedProducts(): array;", "public function getRules(): array;", "public function getRules(): array;", "public function accessRules()\n\t{\n\t\treturn array(\n\t\t\tarray('allow', // allow admin \n\t\t\t\t'actions' => array('customize'),\n\t\t\t\t'users' => array('@'),\n\t\t\t\t'expression' => '$user->isAdmin',\n\t\t\t),\n\t\t\tarray('deny', // deny all users\n\t\t\t\t'users' => array('*'),\n\t\t\t),\n\t\t);\n\t}", "public function accessRules()\n\t{\n\t\treturn array( \n\t\t\tarray('deny', // deny all users\n\t\t\t\t'users'=>array('*'),\n\t\t\t),\n );\n\t}", "public function accessRules()\n {\n return false;\n /* return array(\n array('allow',\n 'actions' => array(\n 'getforum',\n 'ajaxSort',\n 'changeModerator',\n 'deleteForum',\n 'deleteMembergroup',\n 'deleteSpider',\n 'getMembergroup',\n 'getSpider',\n 'index',\n 'layout',\n 'moderator',\n 'update',\n 'saveForum',\n 'saveMembergroup',\n 'saveSpider',\n 'spider',\n\n 'updateForum',\n\n 'createmembergroup',\n 'updateMembergroup',\n\n 'createspider',\n 'updatespider'\n ),\n 'expression' => ($this->isAdmin())?'true':'false',\n 'users' => array('@'),\n ),\n array('deny', // deny all users\n 'users' => array('*'),\n ),\n ); */\n }", "static public function getAllowedDisciplines() {\n\t\t$userTSConfig_all = $GLOBALS[\"TSFE\"]->fe_user->getUserTSconf();\n\t\t$allowedDisciplines = $userTSConfig_all['tx_vsoevvscout_pi1.']['discipline.'];\n\t\treturn $allowedDisciplines;\n\t}", "public function rules()\n {\n return [\n 'limit' => ['sometimes', 'numeric', 'min:1', 'max:500'],\n 'filter' => ['sometimes', 'in:asc,desc'],\n 'sort_by' => ['sometimes', new InTableColumnsRule(with(new Product())->getTable())]\n ];\n }", "public function accessRules() {\n return array(\n array('allow',\n 'actions' => array(\n 'index',\n 'dadcDelivery',\n ),\n 'roles' => array('admin', 'super_admin',)\n ),\n array('deny',\n 'users' => array('*')\n )\n );\n }", "public function getRules()\n {\n }", "public function getRules()\n {\n }", "public function getRules()\n {\n }", "public function accessRules() {\n return array(\n array('allow',\n 'actions' => array(\n 'popup',\n 'gridView',\n 'excel',\n ),\n 'roles' => array('admin', 'super_admin', 'operations_admin', 'limited_admin')\n ),\n array('allow',\n 'actions' => array(\n 'updateStatus',\n 'list',\n 'update',\n 'delete',\n 'count',\n 'excelSummary',\n ),\n 'users' => array('@')\n ),\n array('deny',\n 'users' => array('*')\n )\n );\n }", "public function getRules() : array\n {\n return $this->getDaoRepository()->getRules();\n }", "abstract protected function getRules();", "public function accessRules() {\n return array(\n array('allow',\n 'actions' => array(\n 'Index',\n 'GetModeratorsCascade',\n ),\n 'roles' => array('admin', 'super_admin', 'operations_admin')\n ),\n array('deny',\n 'users' => array('*')\n )\n );\n }", "public function accessRules()\n {\n return array(\n array('deny',\n 'actions'=>array('login', 'register'),\n 'users'=>array('@'),\n ),\n array('deny',\n 'actions'=>array('customer', 'history', 'historyItem'),\n 'users'=>array('?'),\n ),\n array('allow',\n 'users'=>array('*'),\n ),\n );\n }", "public function accessRules() {\n\t\treturn array(\n\t\t\tarray(\n\t\t\t\t'allow', 'roles' => array($this->getModule()->getName())\n\t\t\t),\n\t\t\tarray(\n\t\t\t\t'deny', 'users'=>array('*'),\n\t\t\t),\n\t\t);\n\t}", "public function accessRules() {\n return array(\n array('allow',\n 'actions' => array('bind', 'merge', 'index'),\n 'users' => array('@'),\n ),\n array('allow',\n 'actions' => array('list'),\n 'expression' => array(__CLASS__, 'allowListOwnAccessRule'),\n 'users' => array('@'),\n ),\n array('allow',\n 'actions' => array('delete', 'edit'),\n 'expression' => array(__CLASS__, 'allowModifyOwnAccessRule'),\n ),\n array('allow',\n 'actions' => array('list', 'delete', 'index', 'edit'),\n 'roles' => array('admin'),\n 'users' => array('@'),\n ),\n array('deny',\n 'actions' => array('bind', 'delete', 'index', 'list', 'merge'),\n ),\n );\n }", "public function accessRules()\n {\n return array(\n array('allow',\n 'actions' => array(\n \t'login', 'registration', 'captcha', \n \t'verify', 'forget'\n ),\n 'users' => array('*'),// для всех\n ),\n array('allow',\n 'actions' => array(\n \t'index', 'range', 'logout', \n \t'file', 'commercial', 'data', \n \t'view', 'payRequest', 'offers',\n 'onOffer', 'offOffer', 'changeOffer', 'change',\n ),\n 'roles' => array('user'),// для авторизованных\n ),\n array('deny', // deny all users\n 'users' => array('*'),\n ),\n );\n }", "public function getRules()\n {\n $rules = [];\n // Default UserAgent\n if (isset($this->rules[self::USER_AGENT])) {\n $rules = array_merge($rules, $this->rules[self::USER_AGENT]);\n }\n // Matching UserAgent\n if (isset($this->rules[$this->userAgentMatch])) {\n $rules = array_merge($rules, $this->rules[$this->userAgentMatch]);\n }\n // Result\n return $rules;\n }", "public function getCatalogRuleProducts($product = null)\n {\n $results = $this->catalogRuleProductRepository->scopeQuery(function($query) use($product) {\n $qb = $query->distinct()\n ->select('catalog_rule_products.*')\n ->leftJoin('products', 'catalog_rule_products.product_id', '=', 'products.id')\n ->orderBy('channel_id', 'asc')\n ->orderBy('customer_group_id', 'asc')\n ->orderBy('product_id', 'asc')\n ->orderBy('sort_order', 'asc')\n ->orderBy('catalog_rule_id', 'asc');\n\n $qb = $this->addAttributeToSelect('price', $qb);\n\n if ($product) {\n if ($product->type == 'configurable') {\n $qb->whereIn('catalog_rule_products.product_id', $product->variants()->pluck('id')->toArray());\n } else {\n $qb->where('catalog_rule_products.product_id', $product->id);\n }\n }\n\n return $qb;\n })->get();\n\n return $results;\n }", "public static function getRules(): array;", "public function getRules(): array\n {\n return $this->rules;\n }", "public function accessRules()\n {\n return array(\n array('allow',\n 'actions'=>array('form','save'),\n 'expression'=>array('OrderAccController','allowReadOnly'),\n ),\n array('deny', // deny all users\n 'users'=>array('*'),\n ),\n );\n }", "public function accessRules()\n {\n return array(\n array('allow',\n 'actions' => array('login', 'register', 'error', 'getUrlImage', 'forgot', 'resetPassword'),\n 'users' => array('*'),\n ),\n /*array('allow',\n 'actions' => array('logout', 'image'),\n 'expression' => '$user->isAdmin',\n ),*/\n array('allow',\n 'actions' => array('logout', 'image'),\n 'users' => array('@'),\n ),\n array('deny',\n 'users' => array('*'),\n ),\n );\n }", "public function accessRules()\n {\n return array(\n array('allow', \n 'actions'=>array('del','parse','authorize','operate'),\n 'users'=>array('@'),\n ),\n array('deny', \n 'users'=>array('*'),\n ),\n );\n }", "public function accessRules()\n\t{\n\t\treturn array(\n\t\t\t\t\t\tarray('allow', 'actions' => array('checkout'), 'roles' => array('members')),\n\t\t\t\t\t\tarray('deny', 'actions' => array('checkout'), 'users' => array('*')),\t\t\t\t\t\t\n\t\t\t\t\t);\n\t}", "public function getCriteria()\n {\n $this->assertEquals(array(), $this->denyValidator->getCriteria());\n }", "public function accessRules()\n {\n\t\treturn array(\n\t\t\t\tarray('allow', 'expression'=>array($this, 'authIdentify')), \t\n\t\t\t\tarray('deny', 'users'=>array('*')),\n\t\t);\n\t}", "public function getRules() {\n\t\treturn $this->rules ?? [];\n\t}", "public function accessRules()\n\t{\n\t\t$user = Yii::app()->user;\n\n\t\t//Si c'est un employe :\n\t\t\t//Il a accès à la supression, a l'index, à la vue et la maj\n\t\t\t//Il n'a pas accès à la partie admin\n\t\tif($user->getState('type') == 'employe')\n\t\t{\n\t\t\treturn array(\n\t\t\t\tarray('allow',\n\t\t\t\t\t 'actions'=>['index','view', 'update', 'delete','ajoutinfos'],\n\t\t\t\t\t),\n\t\t\t\tarray('deny',\n\t\t\t\t\t 'actions'=>['admin'],\n\t\t\t\t\t),\n\t\t\t);\n\t\t}\n\n\t\t//Si c'est une entreprise :\n\t\t\t//Il a accès à la vue et à l'index\n\t\t\t//Il n'a pas accès à la maj, à la supression et à la partie admin\n\t\tif($user->getState('type') == 'entreprise')\n\t\t{\n\n\t\t\treturn array(\n\t\t\t\t\tarray('allow',\n\t\t\t\t\t\t 'actions'=>['view', 'index'],\n\t\t\t\t\t\t),\n\t\t\t\t\tarray('deny',\n\t\t\t\t\t\t 'actions'=>['update','admin', 'delete'],\n\t\t\t\t\t\t),\n\t\t\t);\n\t\t}\t\n\n\t\t//Si c'est un utilisateur non connecté\n\t\t\t//Il a juste accès à l'index et à la vues\n\t\tif($user->getState('type') == NULL)\n\t\t{\n\t\t\treturn array(\n\t\t\t\t\tarray('allow',\n\t\t\t\t\t\t 'actions'=>['index', 'view'],\n\t\t\t\t\t\t ),\n\t\t\t\t\t);\n\t\t}\n\t}", "public function accessRules() {\n return array(\n array('allow', // allow all users to perform 'index' and 'view' actions\n 'actions' => array('index', 'view'),\n 'users' => array('*'),\n ),\n array('allow', // allow authenticated user to perform 'create' and 'update' actions\n 'actions' => array('create', 'update', 'saveproduct', 'getsubproduct', 'getproductinsubtype',\n 'getdatastockproduct', 'searchproduct', 'datasearchproduct', 'deleteproductlot', 'moveproduct'),\n 'users' => array('@'),\n ),\n array('allow', // allow admin user to perform 'admin' and 'delete' actions\n 'actions' => array('admin', 'delete', 'getdatastockproduct'),\n 'users' => array('admin'),\n ),\n array('deny', // deny all users\n 'users' => array('*'),\n ),\n );\n }", "private static function getRules() {\n return [\n 'imeArtikla' => FILTER_SANITIZE_SPECIAL_CHARS,\n 'cenaArtikla' => FILTER_VALIDATE_FLOAT,\n 'opisArtikla' => FILTER_SANITIZE_SPECIAL_CHARS,\n 'kategorijaArtikla' => FILTER_SANITIZE_SPECIAL_CHARS,\n 'zalogaArtikla' => FILTER_VALIDATE_FLOAT,\n \n /*'year' => [\n 'filter' => FILTER_VALIDATE_INT,\n 'options' => [\n 'min_range' => 1800,\n 'max_range' => date(\"Y\")\n ]\n ]*/\n ];\n \n }", "public function accessRules()\n\t{\n\t\treturn array(\n array('allow',\n 'actions'=>array('index','delete','create', 'update','view'),\n 'expression'=>'($user->rule===\"admin\")'\n ),\n\t\t\tarray('deny',\n 'users'=>array('*'),\n ),\n\t\t);\n\t}", "public function accessRules()\n\t{\n\t\treturn array(\n array('allow',\n 'actions'=>array('index','delete','create', 'update','view'),\n 'expression'=>'($user->rule===\"admin\")'\n ),\n\t\t\tarray('deny',\n 'users'=>array('*'),\n ),\n\t\t);\n\t}", "public function get_available_rights();", "public function accessRules() {\n\t\treturn array();\n\t}", "public function accessRules()\n {\n return array(\n array(\n 'allow',\n 'actions' => array('create'),\n 'roles' => array(Rbac::OP_QA_QUESTION_CREATE),\n ),\n array(\n 'deny',\n 'actions' => array('create'),\n ),\n array(\n 'allow',\n 'actions' => array('update'),\n 'roles' => array(Rbac::OP_QA_QUESTION_UPDATE),\n ),\n array(\n 'deny',\n 'actions' => array('update'),\n ),\n array(\n 'allow',\n 'actions' => array('saveAnswer'),\n 'roles' => array(Rbac::OP_QA_ANSWER_CREATE),\n ),\n array(\n 'deny',\n 'actions' => array('saveAnswer'),\n ),\n );\n }", "public function accessRules()\n\t{\n if(yii::app()->user->getState('role')==='super-admin')\n {\n\t\treturn array(\n\t\t\tarray('allow', // allow all users to perform 'index' and 'view' actions\n\t\t\t\t'actions'=>array(),\n\t\t\t\t'users'=>array('*'),\n\t\t\t),\n\t\t\tarray('allow', // allow authenticated user to perform 'create' and 'update' actions\n\t\t\t\t'actions'=>array('index','reportAllAdmission','getBatch','AllAdmissionPDF','reportTabulation','TabulationPDF','attandance','ReportAttandance','AttendanceExcel','GetSection','YearlyReportAdmission','YearlyReportAdmissionGraph','YearlyReportAdmissionPDF','PerformanceReport','AdmissionYearlyBasis','YearlyBasisProgrammeWise','YearlyReportAdmissionTermwise','AdmittedStudentByInstitution','termwiseReportAdmission','studentsConsecutiveCGPA','studentsConsecutiveCGPAXLS','studentsConsecutiveCGPALessThan2','studentsConsecutiveCGPALessThan2XLS','CopyInstitute','UpdateInstitute','generateStudentsMobileNo','studentsMobileNoXLS','reportPassingOut','passingOutReportXLS','MahmudurRahmanScholarship','batchWiseTotalStudent'),\n\t\t\t\t'users'=>array('@'),\n\t\t\t),\n\t\t\tarray('allow', // allow admin user to perform 'admin' and 'delete' actions\n\t\t\t\t'actions'=>array('admin','delete','update','getBatch'),\n\t\t\t\t'users'=>array('admin'),\n\t\t\t),\n /* array('allow', // allow admin user to perform 'admin' and 'delete' actions\n\t\t\t\t'actions'=>array('jhuman','AttendanceExcel','GetSection'),\n\t\t\t\t'users'=>array('jhuman'),\n\t\t\t),*/\n\t\t\tarray('deny', // deny all users\n\t\t\t\t'users'=>array('*'),\n\t\t\t),\n\t\t);\n }\n elseif(yii::app()->user->getState('role')==='admin')\n {\n\t\treturn array(\n\t\t\tarray('allow', // allow all users to perform 'index' and 'view' actions\n\t\t\t\t'actions'=>array(),\n\t\t\t\t'users'=>array('*'),\n\t\t\t),\n\t\t\tarray('allow', // allow authenticated user to perform 'create' and 'update' actions\n\t\t\t\t'actions'=>array('index','reportAllAdmission','getBatch','AllAdmissionPDF','reportTabulation','TabulationPDF','attandance','ReportAttandance','AttendanceExcel','GetSection','YearlyReportAdmission','YearlyReportAdmissionGraph','YearlyReportAdmissionPDF','PerformanceReport','AdmissionYearlyBasis','YearlyBasisProgrammeWise','YearlyReportAdmissionTermwise','AdmittedStudentByInstitution','termwiseReportAdmission','studentsConsecutiveCGPA','studentsConsecutiveCGPAXLS','studentsConsecutiveCGPALessThan2','studentsConsecutiveCGPALessThan2XLS','CopyInstitute','UpdateInstitute','generateStudentsMobileNo','studentsMobileNoXLS','reportPassingOut','passingOutReportXLS','MahmudurRahmanScholarship'),\n\t\t\t\t'users'=>array('@'),\n\t\t\t),\n\t\t\tarray('allow', // allow admin user to perform 'admin' and 'delete' actions\n\t\t\t\t'actions'=>array('admin','delete','update','getBatch'),\n\t\t\t\t'users'=>array('admin'),\n\t\t\t),\n /* array('allow', // allow admin user to perform 'admin' and 'delete' actions\n\t\t\t\t'actions'=>array('jhuman','AttendanceExcel','GetSection'),\n\t\t\t\t'users'=>array('jhuman'),\n\t\t\t),*/\n\t\t\tarray('deny', // deny all users\n\t\t\t\t'users'=>array('*'),\n\t\t\t),\n\t\t);\n }\n elseif (yii::app()->user->getState('role')==='exam')\n {\n\t\treturn array(\n\t\t\tarray('allow', // allow all users to perform 'index' and 'view' actions\n\t\t\t\t'actions'=>array(''),\n\t\t\t\t'users'=>array('*'),\n\t\t\t),\n array('allow', // allow authenticated user to perform 'create' and 'update' actions\n\t\t\t\t'actions'=>array('reportPassingOut','passingOutReportXLS','getBatch','GetSection'),\n\t\t\t\t'users'=>array('@'),\n\t\t\t),\n\t\t\tarray('allow', // allow admin user to perform 'admin' and 'delete' actions\n\t\t\t\t'actions'=>array(''),\n\t\t\t\t'users'=>array(Yii::app()->user->id),\n\t\t\t),\n\t\t\tarray('deny', // deny all users\n\t\t\t\t'users'=>array('*'),\n\t\t\t),\n\t\t);\n }\n else\n {\n return array(\n\t\t\tarray('deny', // deny all users\n\t\t\t\t'users'=>array('*'),\n\t\t\t),\n\t\t);\n }\n \t\n\t}", "public function accessRules()\n\t{\n\t\treturn array(\n\t\t\tarray('allow', // allow admin user to perform 'admin' and 'delete' actions\n\t\t\t\t'expression'=>'helpers::isadmin()',\n\t\t\t),\n\t\t\tarray('deny', // deny all users\n\t\t\t\t'users'=>array('*'),\n\t\t\t),\n\t\t);\n\t}", "public function accessRules()\n\t{\n\t\t return array(\n array('allow',\n 'actions'=>array(),\n 'roles'=>array('admin'),\n ),\n array('deny', // deny all users\n 'users'=>array('*'),\n ),\n );\n\t}", "public function accessRules() {\n return array(\n array('allow',\n 'actions' => array(\n 'setInvoiceId',\n 'previewInvoice',\n 'createInvoice',\n 'downloadInvoice',\n ),\n 'roles' => array('super_admin', 'admin'),\n 'expression' => 'UserB::hasBillingAccess()',\n ),\n array('deny',\n 'users' => array('*')\n )\n );\n }", "public function accessRules() {\n return array(\n array('allow',\n 'actions' => array(\n 'index',\n ),\n 'roles' => array('super_admin', 'admin', 'operations_admin'),\n ),\n array('allow',\n 'users' => array(\"*\"),\n ),\n /*array('deny', // deny all users\n 'users' => array('*'),\n ),*/\n );\n }", "public function accessRules() {\n return array(\n array(\n 'allow',\n 'actions' => array('index', 'archive', 'view', 'read', 'userListResults'),\n 'users' => array('@')\n ),\n array('allow', // allow admin user to perform 'admin' and 'delete' actions\n 'actions' => array('create','admin', 'update'),\n 'expression' => 'Yii::app()->user->isAdmin()',\n ),\n array(\n 'deny', // deny all users\n 'users' => array('*')\n )\n );\n }", "public function get_global_availability_rules(): array {\n\t\tif ( version_compare( WC_BOOKINGS_VERSION, '1.13.0', '<' ) ) {\n\t\t\t$global_rules = get_option( 'wc_global_booking_availability', array() );\n\t\t} else {\n\t\t\t$global_rules = WC_Data_Store::load( 'booking-global-availability' )->get_all_as_array();\n\t\t}\n\n\t\tif ( empty( $global_rules ) ) {\n\t\t\tthrow new RuntimeException( __( 'There are no rules to export.', 'bookings-helper' ) );\n\t\t}\n\n\t\treturn $global_rules;\n\t}", "public function accessRules() {\n return array(\n array('allow', // allow all users to perform 'index' and 'view' actions\n 'actions' => array('index', 'view', 'admin', 'mappedProduct', 'listallproduct', 'Updatebaseproducrt', 'test', 'test2'),\n 'users' => array('*'),\n ),\n array('allow', // allow authenticated user to perform 'create' and 'update' actions\n 'actions' => array('create', 'update', 'admin', 'mappedProduct', 'listallproduct', 'Updatebaseproducrt'),\n 'users' => array('@'),\n ),\n array('allow', // allow admin user to perform 'admin' and 'delete' actions\n 'actions' => array('admin', 'delete', 'mappedProduct', 'listallproduct', 'Updatebaseproducrt'),\n 'users' => array('admin'),\n ),\n array('deny', // deny all users\n 'users' => array('*'),\n ),\n );\n }", "public function accessRules() {\t\n\t\t$contentmn_name = (!empty(Yii::app()->user->content_man_un) ? Yii::app()->user->content_man_un : \"\" );\n\t\tif (Yii::app()->user->isGuest) {\n\t\t\treturn array(\n\t\t\t\tarray('deny', // deny all users\n\t\t\t\t\t'users'=>array('*'),\n\t\t\t\t),\n\t\t\t);\n\t\t}\n\t\telse {\n\t\t\treturn array(\n\t\t\t\tarray('allow', // allow all users to perform 'changepassword' action\n\t\t\t\t\t'actions'=>array('changepassword'),\n\t\t\t\t\t'users'=>array('*'),\n\t\t\t\t),\n\t\t\t\tarray('deny', // deny\n\t\t\t\t\t'users'=>array($contentmn_name),\n\t\t\t\t),\n\t\t\t);\n\t\t}\n\t}", "public function accessRules()\n {\n return array(\n array('allow', // @代表有角色的\n 'actions'=>array('view','change','see'),\n 'users'=>array('@'),\n ),\n array('allow', // allow admin user to perform 'admin' and 'delete' actions\n 'actions'=>array('create','see','update','delete'),\n 'expression'=>'$user->getState(\"info\")->authority >= 1',//,array($this,\"isSuperUser\"),\n ),\n array('deny', // *代表所有的用户\n 'users'=>array('*'),\n ),\n );\n }", "public function rules()\n {\n $rules = [\n 'src' => \"required|min:2|max:190|image\"\n ];\n\n Log::debug($this->route('idProduct'));\n return $rules;\n }", "protected function getDisallowedItems ()\n\t{\n\t\t// get disallowed based on scope\n\t\t$disallowedItemsByScope = $this->getDisallowedItemsByScope();\n\t\t// get disallowed based on client\n\t\t$disallowedItemsByClient = $this->getDisallowedItemsByClient();\n\n\t\t// merge the 2 disallowed arrays together and unique them\n\t\t$disallowedItems = array_unique(array_merge($disallowedItemsByScope, $disallowedItemsByClient));\n\t\treturn $disallowedItems;\n\t}", "public static function getRules() {\n return [\n 'title' => FILTER_SANITIZE_SPECIAL_CHARS,\n 'author' => FILTER_SANITIZE_SPECIAL_CHARS,\n 'description' => FILTER_SANITIZE_SPECIAL_CHARS,\n 'price' => FILTER_VALIDATE_FLOAT,\n 'year' => [\n 'filter' => FILTER_VALIDATE_INT,\n 'options' => [\n 'min_range' => 1800,\n 'max_range' => date(\"Y\")\n ]\n ]\n ];\n }", "public function accessRules()\r\n\t{\r\n\t\treturn array(\r\n\t\t\tarray('allow', \r\n\t\t\t\t'actions'=>array(\r\n 'admin',\r\n\r\n //Users\r\n\r\n 'users',\r\n 'checkstatus',\r\n 'activate',\r\n\r\n //Drivers\r\n 'drivers',\r\n 'loaddriverform',\r\n 'validatedriver',\r\n 'driverstatus',\r\n 'savedriverstatus',\r\n\r\n //Cars\r\n 'cars',\r\n 'loadcarform',\r\n 'validatecar',\r\n 'carstatus',\r\n 'savecarstatus',\r\n 'repairlogform',\r\n 'saverepairlog',\r\n ),\r\n\t\t\t\t'roles'=>array('rxAdmin'),\r\n\t\t\t),\r\n\r\n\t\t\tarray('deny', \r\n\t\t\t\t'actions'=>array(\r\n 'admin',\r\n 'users',\r\n 'checkstatus',\r\n 'activate',\r\n 'drivers',\r\n 'loaddriverform',\r\n 'validatedriver',\r\n 'driverstatus',\r\n 'savedriverstatus',\r\n 'cars',\r\n 'loadcarform',\r\n 'validatecar',\r\n 'carstatus',\r\n 'savecarstatus',\r\n 'repairlogform',\r\n 'saverepairlog',\r\n ),\r\n\t\t\t\t'roles'=>array('rxClient'),\r\n\t\t\t),\r\n \r\n array('allow', \r\n\t\t\t\t'actions'=>array(\r\n ),\r\n\t\t\t\t'roles'=>array('rxClient'),\r\n\t\t\t),\r\n\t\t\t\r\n\t\t\tarray('deny', // deny all other users\r\n\t\t\t\t'users'=>array('*'),\r\n\t\t\t),\r\n\t\t\t\r\n\t\t);\r\n\t}", "public function getRules(): array\n {\n if (Auth::user()->role === \"admin\") {\n return [\n ['disk' => 'public', 'path' => '*', 'access' => 2],\n ];\n }\n\n // 0 - no access; 1 - read only; 2 - read and write\n return [\n ['disk' => 'public', 'path' => '/', 'access' => 1],\n ['disk' => 'public', 'path' => 'users', 'access' => 1],\n ['disk' => 'public', 'path' => 'users/' . Auth::user()->name, 'access' => 2],\n ['disk' => 'public', 'path' => 'users/' . Auth::user()->name . '/', 'access' => 2],\n ['disk' => 'public', 'path' => 'users/' . Auth::user()->name . '/*', 'access' => 2],\n ['disk' => 'public', 'path' => 'users/*', 'access' => 0],\n ['disk' => 'public', 'path' => 'shared', 'access' => 2],\n ['disk' => 'public', 'path' => 'shared/*', 'access' => 2],\n ];\n }", "public function accessRules()\n {\n return array(\n array('allow',\n 'actions' => array('view', 'updateAttribute', 'createContact', 'deleteContact'),\n 'users' => array('@'),\n ),\n/* array('allow',\n 'actions' => array('create', 'update', 'index', 'admin', 'delete'),\n 'roles' => array('ApplicationAdministrator'),\n ),*/\n array('deny',\n 'users' => array('*'),\n ),\n );\n }", "function GetAllDeniedPlacedOffers()\n {\n $placedOffersModel = new PlacedOffersModel();\n $placedOffersModel->GetAllDeniedPlacedOffers();\n }", "public function rules()\n {\n $subscriptionLevel = auth()->user()->account->level;\n if ($subscriptionLevel === 'Free') {\n return $this->primaryRules;\n }\n if ($subscriptionLevel === 'Premium') {\n return $this->getPremiumRules();\n }\n\n return $this->getPremiumPlusRules();\n }", "public function accessRules()\n {\n return array(\n array('deny', \n 'actions' => array('upload'),\n 'users' => array('?'),\n ),\n array('allow', \n 'users' => array('*'),\n ),\n );\n }", "public function rules()\n {\n $commons = [\n\n ];\n return get_request_rules($this, $commons);\n }", "public function accessRules()\n {\n return array(\n // allow all authenticated users on all actions\n array('allow', 'users' => array('@')),\n // deny all rule.\n array('deny'),\n );\n }", "public function accessRules() {\n return array(\n array('allow', // allow authenticated users to access all actions\n 'users' => array(Yii::app()->user->name),\n ),\n array('deny'),\n );\n }", "public function accessRules()\n\t{\n\t\treturn array(\n\t\t\tarray('allow', // allow authenticated user\n\t\t\t\t'roles'=>array('arckanto-admin'),\n\t\t\t),\n\t\t\tarray('deny', // deny all users\n\t\t\t\t'users'=>array('*'),\n\t\t\t),\n\t\t);\n\t}", "public function rules()\n {\n return (new Role)\n ->attachPermissionRules();\n }", "public function accessRules()\n {\n return array(\n array('allow', // allow authenticated user to perform 'create' and 'update' actions\n 'actions' => array('banbandynamic', 'banbanactivity','banbannews','dynamicdetail'),\n 'users' => array('*'),\n ),\n array('allow', // allow admin user to perform 'admin' and 'delete' actions\n 'actions' => array(),\n 'users' => array('@'),\n //'expression'=>array($this,'loginAndNotDeleted'),\n ),\n array('deny', // deny all users\n 'users' => array('*'),\n ),\n );\n }" ]
[ "0.62747824", "0.61449367", "0.6049338", "0.60105056", "0.595904", "0.590118", "0.5839226", "0.58275163", "0.5824314", "0.5819507", "0.58173406", "0.5816028", "0.5816028", "0.5793534", "0.57879716", "0.57848406", "0.57720983", "0.57696295", "0.576035", "0.57250845", "0.57121223", "0.57112116", "0.5704775", "0.5704271", "0.56917495", "0.5687037", "0.56720424", "0.56490016", "0.5646516", "0.5637094", "0.5634959", "0.56312805", "0.56282175", "0.56268597", "0.56264466", "0.5622139", "0.5615961", "0.56111366", "0.56111366", "0.5597788", "0.5597088", "0.5596641", "0.55897075", "0.55893743", "0.55811536", "0.5580865", "0.5580865", "0.5580865", "0.557193", "0.5571439", "0.55687857", "0.5558054", "0.55538315", "0.5552576", "0.55483514", "0.554661", "0.5534231", "0.55282474", "0.55029416", "0.55026484", "0.54992133", "0.5498212", "0.5497957", "0.5497726", "0.5486682", "0.54836273", "0.54836273", "0.5464673", "0.54433835", "0.54373556", "0.5436484", "0.5436484", "0.54314005", "0.5431071", "0.5426938", "0.5425413", "0.5423558", "0.54124844", "0.5409014", "0.54087013", "0.5407162", "0.53974134", "0.53931564", "0.53823364", "0.5380773", "0.5375188", "0.5364894", "0.5362156", "0.53605616", "0.53591305", "0.5357315", "0.5356775", "0.53535634", "0.53493875", "0.53457105", "0.53437656", "0.5319417", "0.5319355", "0.5317954", "0.5306436" ]
0.7084203
0
Filter deny rules by precedence 2
private static function prepareDenyRules($groups, $type) { $settings = shopFlexdiscountHelper::getSettings(); // Получаем условия, которые необходимо игнорировать в правилах запрета при показе доступных скидок $filter_by = !empty($settings['flexdiscount_avail_discounts']['ignore_deny']) ? $settings['flexdiscount_avail_discounts']['ignore_deny'] : array(); foreach ($groups as $group_id => $group) { $rules = $group_id === 0 ? $group : $group['items']; foreach ($rules as $k => $rule) { if ($rule['deny'] && $rule['status']) { // Условия $rules[$k]['conditions'] = self::decode($rule['conditions']); // Удаляем все условия со определенным старшинством в зависимости от типа скидки if ($rules[$k]['conditions']) { $filter_by = !empty($rules[$k]['available']['status']) ? (!empty($rules[$k]['available']['ignore_deny']) ? $rules[$k]['available']['ignore_deny'] : array()) : $filter_by; $rules[$k]['conditions']->conditions = self::filter_conditions($rules[$k]['conditions']->conditions, $filter_by, $type); // Если правило запрета осталось без условий, удаляем его, чтобы не оказалось так, что все товары попали под запрет if (empty($rules[$k]['conditions']->conditions)) { unset($rules[$k]); } } } } if (!$rules) { unset($groups[$group_id]); continue; } if ($group_id === 0) { $groups[$group_id] = $rules; } else { $groups[$group_id]['items'] = $rules; } } return $groups; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getExplicitlyAllowAndDeny() {}", "public function testStopChainOnFirstDeny() {\n $rule1 = $this->createMock('Drupal\\Core\\PageCache\\RequestPolicyInterface');\n $rule1->expects($this->once())\n ->method('check')\n ->with($this->request)\n ->will($this->returnValue(RequestPolicyInterface::ALLOW));\n $this->policy->addPolicy($rule1);\n\n $deny_rule = $this->createMock('Drupal\\Core\\PageCache\\RequestPolicyInterface');\n $deny_rule->expects($this->once())\n ->method('check')\n ->with($this->request)\n ->will($this->returnValue(RequestPolicyInterface::DENY));\n $this->policy->addPolicy($deny_rule);\n\n $ignored_rule = $this->createMock('Drupal\\Core\\PageCache\\RequestPolicyInterface');\n $ignored_rule->expects($this->never())\n ->method('check');\n $this->policy->addPolicy($ignored_rule);\n\n $actual_result = $this->policy->check($this->request);\n $this->assertSame(RequestPolicyInterface::DENY, $actual_result);\n }", "protected function matchHideForNonAdminsCondition() {}", "public function accessRules() {\n return array(\n array(\n 'deny',\n 'actions' => array('oauthadmin'),\n ),\n );\n }", "public function testDeny()\n {\n $this->assertTrue($this->Acl->check('stan', 'controllers/baz/manager_foo'));\n\n $this->Acl->deny('stan', 'controllers/baz/manager_foo');\n\n $this->assertFalse($this->Acl->check('stan', 'controllers/baz/manager_foo'));\n $this->assertTrue($this->Acl->check('Role/manager', 'controllers/baz/manager_foo'));\n $this->assertTrue($this->Acl->check('stan', 'controllers/baz/manager_bar'));\n $this->assertTrue($this->Acl->check('stan', 'controllers/baz/manager_foooooo'));\n }", "public function getAllowSpecific();", "public function testDenyRuleIsStrongerThanAllowRule()\n {\n $this->assertFalse($this->Acl->check('peter', 'baz/bam'));\n $this->Acl->allow('peter', 'baz/bam');\n $this->assertTrue($this->Acl->check('peter', 'baz/bam'));\n $this->Acl->deny('peter', 'baz/bam');\n $this->assertFalse($this->Acl->check('peter', 'baz/bam'));\n\n $this->assertTrue($this->Acl->check('stan', 'controllers/reports/foo'));\n // stan is denied as he's sales and sales is denied /controllers/*/delete\n $this->assertFalse($this->Acl->check('stan', 'controllers/reports/delete'));\n $this->Acl->allow('stan', 'controllers/reports/delete');\n $this->assertFalse($this->Acl->check('Role/sales', 'controllers/reports/delete'));\n $this->assertTrue($this->Acl->check('stan', 'controllers/reports/delete'));\n $this->Acl->deny('stan', 'controllers/reports/delete');\n $this->assertFalse($this->Acl->check('stan', 'controllers/reports/delete'));\n\n // there is already an equally specific deny rule that will win\n $this->Acl->allow('stan', 'controllers/reports/delete');\n $this->assertFalse($this->Acl->check('stan', 'controllers/reports/delete'));\n }", "public function testRejectDenyNotHrAndAdmin() {\n\t\t$this->setExpectedException('MissingActionException');\n\t\t$userRoles = [\n\t\t\tUSER_ROLE_USER => '',\n\t\t\tUSER_ROLE_USER | USER_ROLE_SECRETARY => 'secret',\n\t\t];\n\t\t$opt = [\n\t\t\t'method' => 'POST',\n\t\t];\n\t\tforeach ($userRoles as $userRole => $userPrefix) {\n\t\t\t$userInfo = [\n\t\t\t\t'role' => $userRole,\n\t\t\t\t'prefix' => $userPrefix,\n\t\t\t];\n\t\t\t$this->applyUserInfo($userInfo);\n\t\t\t$this->generateMockedController();\n\t\t\t$url = [\n\t\t\t\t'controller' => 'deferred',\n\t\t\t\t'action' => 'reject',\n\t\t\t\t'3',\n\t\t\t];\n\t\t\tif (!empty($userPrefix)) {\n\t\t\t\t$url['prefix'] = $userPrefix;\n\t\t\t\t$url[$userPrefix] = true;\n\t\t\t}\n\t\t\t$this->testAction($url, $opt);\n\t\t\t$this->checkIsNotAuthorized();\n\t\t\t$this->checkRedirect(true);\n\t\t}\n\t}", "public function accessRules() {\n return array(\n /* array('allow', \n 'actions'=>array('*'),\n 'roles'=>array('events'),\n ), */\n array('deny', // deny all users\n 'actions'=>array( 'negotiatingAdd'),\n 'users'=>array('?'),\n ),\n \n array('allow', // deny all users\n 'users'=>array('*'),\n ),\n );\n }", "public function accessRules()\n\t{\n\t\treturn array(\n\t\t\tarray('deny', // deny not login users\n\t\t\t\t'users'=>array('?'),\n\t\t\t),\n\t\t);\n\t}", "public function filter() {\n $value = null;\n\n if (func_num_args() > 2) {\n $args = func_get_args();\n $value = array_slice($args, 2)[0];\n }\n\n $userId = $this->getSessionUserId();\n\n if ($this->tokenParam !== false && is_null($userId)) {\n $token = $this->getAccessToken();\n\n if (!empty($token)) {\n $userId = call_user_func($this->getCallback(), $token);\n }\n }\n\n if (!empty($userId)) {\n $ret = $this->acl->isRouteAllowed($userId, $value);\n } else {\n $msg = ($this->tokenParam !== false) ? ' ' . trans('acl-manager-laravel::messages.token_not_found') : '.';\n throw new AclServerErrorException(trans('acl-manager-laravel::messages.userid_not_found') . $msg);\n }\n\n if (!$ret) {\n throw new AclPolicyException($value);\n }\n }", "public function accessRules()\n\t{\n\t\treturn array( \n\t\t\tarray('deny', // deny all users\n\t\t\t\t'users'=>array('*'),\n\t\t\t),\n );\n\t}", "public function accessRules()\n {\n return array(\n array('deny', \n 'actions' => array('upload'),\n 'users' => array('?'),\n ),\n array('allow', \n 'users' => array('*'),\n ),\n );\n }", "public function accessRules()\n {\n return false;\n /* return array(\n array('allow',\n 'actions' => array(\n 'getforum',\n 'ajaxSort',\n 'changeModerator',\n 'deleteForum',\n 'deleteMembergroup',\n 'deleteSpider',\n 'getMembergroup',\n 'getSpider',\n 'index',\n 'layout',\n 'moderator',\n 'update',\n 'saveForum',\n 'saveMembergroup',\n 'saveSpider',\n 'spider',\n\n 'updateForum',\n\n 'createmembergroup',\n 'updateMembergroup',\n\n 'createspider',\n 'updatespider'\n ),\n 'expression' => ($this->isAdmin())?'true':'false',\n 'users' => array('@'),\n ),\n array('deny', // deny all users\n 'users' => array('*'),\n ),\n ); */\n }", "public function filters(){\n\t\treturn array( 'accessControl' );\n\t}", "public function accessRules()\n {\n return array(\n array('allow', \n 'actions'=>array('del','parse','authorize','operate'),\n 'users'=>array('@'),\n ),\n array('deny', \n 'users'=>array('*'),\n ),\n );\n }", "public function providerAllowIfAnyRuleReturnedAllow() {\n return [\n [[RequestPolicyInterface::ALLOW]],\n [[NULL, RequestPolicyInterface::ALLOW]],\n ];\n }", "function getDenyReasons() {\n return $this->denied_reasons;\n }", "public function deny()\n {\n ++$this->denied;\n\n $this->result = NODE_ACCESS_DENY;\n\n // Where the actual magic happens please read the README.md file.\n if (!$this->byVote) {\n $this->stopPropagation();\n }\n }", "public static function deny(Request $request);", "private function filterByPermission(){\n\n }", "public function accessRules(){// правила доступа к ресурсам контроллера\n $f=array();\n if(!Yii::app()->user->getState('sup')){\n $f=$this->ActionsForUser(__CLASS__);\n }\n return array(\n array('allow', // список разрешений\n 'actions'=>$f,\n 'users'=>array(Yii::app()->user->id),\n ),\n array('deny', // список запрещений\n 'users'=>array('*','$'),\n ),\n );\n }", "public function filters()\n\t{\n \treturn array(\n \t\t'accessControl'\n\t\t);\n\t}", "static function getrules_block_wp_file_access()\r\n {\r\n global $aio_wp_security;\r\n $rules = '';\r\n if ($aio_wp_security->configs->get_value('aiowps_prevent_default_wp_file_access') == '1') {\r\n $rules .= AIOWPSecurity_Utility_Htaccess::$prevent_wp_file_access_marker_start . PHP_EOL; //Add feature marker start\r\n $rules .= self::create_apache2_access_denied_rule('license.txt');\r\n $rules .= self::create_apache2_access_denied_rule('wp-config-sample.php');\r\n $rules .= self::create_apache2_access_denied_rule('readme.html');\r\n $rules .= AIOWPSecurity_Utility_Htaccess::$prevent_wp_file_access_marker_end . PHP_EOL; //Add feature marker end\r\n }\r\n\r\n return $rules;\r\n }", "public function filters() {\n\t\treturn array(\n\t\t\t'accessControl', // perform access control for CRUD operations\n\t\t\t'postOnly + delete', // we only allow deletion via POST request\n\t\t);\n\t}", "public function filters() {\n return array(\"accessControl\");\n }", "function show_deny() {\n\t\t\tshow_error(\n\t\t\t\t'403 Forbidden',\n\t\t\t\t'You do not have sufficient clearance to view this page.'\n\t\t\t);\n\t\t}", "public function deny($obj, $actions){\r\n $this->loadAro();\r\n return $this->aro->deny($obj, $actions);\r\n }", "public function accessRules() {\n return array(\n array('allow',\n 'expression' => 'Yii::app()->user->isAdmin()',\n ),\n array('deny', // deny all users\n 'users' => array('*'),\n ),\n );\n }", "public function accessRules() {\t\n\t\t$contentmn_name = (!empty(Yii::app()->user->content_man_un) ? Yii::app()->user->content_man_un : \"\" );\n\t\tif (Yii::app()->user->isGuest) {\n\t\t\treturn array(\n\t\t\t\tarray('deny', // deny all users\n\t\t\t\t\t'users'=>array('*'),\n\t\t\t\t),\n\t\t\t);\n\t\t}\n\t\telse {\n\t\t\treturn array(\n\t\t\t\tarray('allow', // allow all users to perform 'changepassword' action\n\t\t\t\t\t'actions'=>array('changepassword'),\n\t\t\t\t\t'users'=>array('*'),\n\t\t\t\t),\n\t\t\t\tarray('deny', // deny\n\t\t\t\t\t'users'=>array($contentmn_name),\n\t\t\t\t),\n\t\t\t);\n\t\t}\n\t}", "public function accessRules()\n {\n return array(\n array('allow', // allow authenticated user to perform 'create' and 'update' actions\n 'actions' => array('banbandynamic', 'banbanactivity','banbannews','dynamicdetail'),\n 'users' => array('*'),\n ),\n array('allow', // allow admin user to perform 'admin' and 'delete' actions\n 'actions' => array(),\n 'users' => array('@'),\n //'expression'=>array($this,'loginAndNotDeleted'),\n ),\n array('deny', // deny all users\n 'users' => array('*'),\n ),\n );\n }", "public function accessRules()\n {\n $acl = $this->acl;\n\n return [\n ['allow', // allow all users to perform 'index' and 'view' actions\n 'actions' => ['index', 'view'],\n 'users' => ['@'],\n ],\n ['allow', // allow authenticated user to perform 'create' and 'update' actions\n 'actions' => ['create', 'getLoadingAddressList'],\n 'expression' => function() use ($acl) {\n return $acl->canCreateOrder();\n },\n ],\n ['allow', // allow to perform 'accomplish' action\n 'actions' => ['update'],\n 'expression' => function() use ($acl) {\n return $acl->canUpdateOrder();\n },\n ],\n ['allow', // allow to perform 'accomplish' action\n 'actions' => ['withdraw'],\n 'expression' => function() use ($acl) {\n return $acl->canWithdrawOrder();\n },\n ],\n ['allow', // allow to perform 'accomplish' action\n 'actions' => ['restore'],\n 'expression' => function() use ($acl) {\n return $acl->canRestoreOrder();\n },\n ],\n ['allow', // allow to perform 'accomplish' action\n 'actions' => ['accomplish'],\n 'expression' => function() use ($acl) {\n return $acl->canAccomplishOrder();\n },\n ],\n ['allow', // allow to perform 'accomplish' action\n 'actions' => ['reopen'],\n 'expression' => function() use ($acl) {\n return $acl->canReopenOrder();\n },\n ],\n ['allow', // allow to perform 'loadCargo' action\n 'actions' => ['loadCargo'],\n 'expression' => function() use ($acl) {\n return $acl->canAccessLoadCargo();\n },\n ],\n ['allow', // allow to perform 'delete' action\n 'actions' => ['delete', 'softDelete'],\n 'expression' => function() use ($acl) {\n return $acl->canDeleteOrder();\n },\n ],\n ['allow', // allow admin user to perform 'admin' action\n 'actions' => ['admin'],\n 'expression' => function() use ($acl) {\n return $acl->getUser()->isAdmin();\n },\n ],\n ['deny', // deny all users\n 'users' => ['*'],\n ],\n ];\n }", "public function accessRules()\n {\n return array(\n array('allow',\n 'expression' => 'Yii::app()->user->isAdmin()',\n ),\n array('deny', // deny all users\n 'users' => array('*'),\n ),\n );\n }", "public function accessRules()\n {\n return array(\n array('allow',\n 'expression' => 'Yii::app()->user->isAdmin()',\n ),\n array('deny', // deny all users\n 'users' => array('*'),\n ),\n );\n }", "public function filters() {\n\t\treturn array(\n\t\t\t'accessControl',\n\t\t);\n\t}", "public function accessRules()\n {\n return array(\n array('deny',\n 'actions'=>array('login', 'register'),\n 'users'=>array('@'),\n ),\n array('deny',\n 'actions'=>array('customer', 'history', 'historyItem'),\n 'users'=>array('?'),\n ),\n array('allow',\n 'users'=>array('*'),\n ),\n );\n }", "public function accessRules()\n\t{\n\t\treturn array(\n\t\t\tarray('allow', \n\t\t\t\t'actions'=>array('vote'),\n\t\t\t\t'users'=>array('*'),\n\t\t\t),\n\t\t\tarray('deny', // deny all users\n\t\t\t\t'users'=>array('*'),\n\t\t\t),\n\t\t);\n\t}", "public function accessRules()\n {\n return array(\n array('allow', \n 'actions'=>array('userRss','recommendRss','del','parse','newRss'),\n 'users'=>array('@'),\n ),\n array('deny', \n 'users'=>array('*'),\n ),\n );\n }", "public function accessRules() {\n return array(\n array('allow', // allow authenticated users to access all actions\n 'users' => array(Yii::app()->user->name),\n ),\n array('deny'),\n );\n }", "public function accessRules()\n\t{\n\t\treturn array(\n array('allow',\n 'actions'=>array('index','delete','create', 'update','view'),\n 'expression'=>'($user->rule===\"admin\")'\n ),\n\t\t\tarray('deny',\n 'users'=>array('*'),\n ),\n\t\t);\n\t}", "public function accessRules()\n\t{\n\t\treturn array(\n array('allow',\n 'actions'=>array('index','delete','create', 'update','view'),\n 'expression'=>'($user->rule===\"admin\")'\n ),\n\t\t\tarray('deny',\n 'users'=>array('*'),\n ),\n\t\t);\n\t}", "public function filters() {\n\n return array(\n 'accessControl', // perform access control for CRUD operations\n 'postOnly + delete' // we only allow deletion via POST request\n );\n }", "public function accessRules()\n\t{\n\t\treturn array(\n\t\t\tarray('allow',\n\t\t\t\t'actions'=>array('catalogue', 'recherche'),\n\t\t\t\t'users'=>array('*'),\n\t\t\t),\n\t\t\tarray('allow',\n 'actions'=>array('proposer', 'index', 'modifier', 'ajouter'),\n\t\t\t\t'users'=>array('@'),\n\t\t\t),\n\t\t\tarray('deny', // deny all users\n\t\t\t\t'users'=>array('*'),\n\t\t\t),\n\t\t);\n\t}", "public function filters()\n {\n return array(\n 'accessControl', // perform access control for CRUD operations\n 'postOnly + delete', // we only allow deletion via POST request\n );\n }", "public function filters() {\n return array(\n 'accessControl',\n );\n }", "public function beforeFilter() {\n parent::beforeFilter();\n $this->set('group', 'compounds');\n //$this->Auth->deny('addCompound', 'editCompound'); //deny access from addCompound and editCompound by default\n }", "public function filters()\n\t{\n\t\treturn array(\n\t\t\t'rights', // perform access control for CRUD operations\n\t\t);\n\t}", "public function beforeFilter() {\n\t\tparent::beforeFilter();\n\t\tif ($this->request->action == 'admin_toggle' || \n\t\t\t$this->request->action == 'admin_add_smart' ||\n\t\t\t$this->request->action == 'admin_save_condition' ) {\n\t\t\t$this->Components->disable('Security');\n\t\t}\n\t}", "public function forbiddenAction() {\n }", "public function accessRules()\r\n\t{\r\n\t\treturn array(\r\n\t\t\tarray('allow', \r\n\t\t\t\t'actions'=>array(\r\n 'admin',\r\n\r\n //Users\r\n\r\n 'users',\r\n 'checkstatus',\r\n 'activate',\r\n\r\n //Drivers\r\n 'drivers',\r\n 'loaddriverform',\r\n 'validatedriver',\r\n 'driverstatus',\r\n 'savedriverstatus',\r\n\r\n //Cars\r\n 'cars',\r\n 'loadcarform',\r\n 'validatecar',\r\n 'carstatus',\r\n 'savecarstatus',\r\n 'repairlogform',\r\n 'saverepairlog',\r\n ),\r\n\t\t\t\t'roles'=>array('rxAdmin'),\r\n\t\t\t),\r\n\r\n\t\t\tarray('deny', \r\n\t\t\t\t'actions'=>array(\r\n 'admin',\r\n 'users',\r\n 'checkstatus',\r\n 'activate',\r\n 'drivers',\r\n 'loaddriverform',\r\n 'validatedriver',\r\n 'driverstatus',\r\n 'savedriverstatus',\r\n 'cars',\r\n 'loadcarform',\r\n 'validatecar',\r\n 'carstatus',\r\n 'savecarstatus',\r\n 'repairlogform',\r\n 'saverepairlog',\r\n ),\r\n\t\t\t\t'roles'=>array('rxClient'),\r\n\t\t\t),\r\n \r\n array('allow', \r\n\t\t\t\t'actions'=>array(\r\n ),\r\n\t\t\t\t'roles'=>array('rxClient'),\r\n\t\t\t),\r\n\t\t\t\r\n\t\t\tarray('deny', // deny all other users\r\n\t\t\t\t'users'=>array('*'),\r\n\t\t\t),\r\n\t\t\t\r\n\t\t);\r\n\t}", "public function accessRules() {\n return array(\n array('allow',\n 'actions' => array('update'),\n 'users' => array('@'),\n ),\n array('deny',\n 'users' => array('*'),\n ),\n );\n }", "final protected function policy__skip_if_denied($arg, & $conf)\n\t{\n\t\tforeach ((array) $arg as $id) {\n\t\t\t$m = @ $conf['block:'.$id]['.block'];\t// FIXME\n\t\t\tif ($m !== null && !$this->authIsBlockAllowed($m)) {\n\t\t\t\tdebug_msg('Skipping block \"%s\" (%s).', $id, $m);\n\t\t\t\tunset($conf['block:'.$id]);\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}", "public function filters()\n\t{\n\t\treturn array(\n\t\t\t'accessControl', // perform access control for CRUD operations\n\t\t\t'postOnly + delete', // we only allow deletion via POST request\n\t\t);\n\t}", "public function denyAccess(): AccessResultInterface;", "function PMA_allowDeny($type)\n{\n global $cfg;\n\n // Grabs true IP of the user and returns if it can't be found\n $remote_ip = PMA_getIp();\n if (empty($remote_ip)) {\n return false;\n }\n\n // copy username\n $username = $cfg['Server']['user'];\n\n // copy rule database\n $rules = $cfg['Server']['AllowDeny']['rules'];\n\n // lookup table for some name shortcuts\n $shortcuts = array(\n 'all' => '0.0.0.0/0',\n 'localhost' => '127.0.0.1/8'\n );\n\n // Provide some useful shortcuts if server gives us address:\n if (PMA_getenv('SERVER_ADDR')) {\n $shortcuts['localnetA'] = PMA_getenv('SERVER_ADDR') . '/8';\n $shortcuts['localnetB'] = PMA_getenv('SERVER_ADDR') . '/16';\n $shortcuts['localnetC'] = PMA_getenv('SERVER_ADDR') . '/24';\n }\n\n foreach ($rules as $rule) {\n // extract rule data\n $rule_data = explode(' ', $rule);\n\n // check for rule type\n if ($rule_data[0] != $type) {\n continue;\n }\n\n // check for username\n if (($rule_data[1] != '%') //wildcarded first\n && ($rule_data[1] != $username)) {\n continue;\n }\n\n // check if the config file has the full string with an extra\n // 'from' in it and if it does, just discard it\n if ($rule_data[2] == 'from') {\n $rule_data[2] = $rule_data[3];\n }\n\n // Handle shortcuts with above array\n if (isset($shortcuts[$rule_data[2]])) {\n $rule_data[2] = $shortcuts[$rule_data[2]];\n }\n\n // Add code for host lookups here\n // Excluded for the moment\n\n // Do the actual matching now\n if (PMA_ipMaskTest($rule_data[2], $remote_ip)) {\n return true;\n }\n } // end while\n\n return false;\n}", "public function accessRules()\n {\n return array(\n array('allow',\n 'actions'=>array('form','save'),\n 'expression'=>array('OrderAccController','allowReadOnly'),\n ),\n array('deny', // deny all users\n 'users'=>array('*'),\n ),\n );\n }", "public function accessRules()\r\n\t{\r\n\t\treturn array(\r\n\t\t\tarray('allow',\r\n\t\t\t\t'actions'=>array('nombres'),\r\n\t\t\t\t'users'=>array('*'),\r\n\t\t\t),\r\n\t\t);\r\n\t}", "public function accessRules()\r\n\t{\r\n\t\treturn array(\r\n\t\t\tarray('allow', // allow authenticated admins to perform any action\r\n\t\t\t\t'users'=>array('@'),\r\n\t\t\t\t'expression'=>'Yii::app()->user->role>=5'\r\n\t\t\t),\r\n\t\t\tarray('deny', // deny all users\r\n\t\t\t\t'users'=>array('*'),\r\n\t\t\t\t'deniedCallback' => array($this, 'actionError')\r\n\t\t\t),\r\n\t\t);\r\n\t}", "public function testApproveDenyNotHrAndAdmin() {\n\t\t$this->setExpectedException('MissingActionException');\n\t\t$userRoles = [\n\t\t\tUSER_ROLE_USER => '',\n\t\t\tUSER_ROLE_USER | USER_ROLE_SECRETARY => 'secret',\n\t\t];\n\t\t$opt = [\n\t\t\t'method' => 'POST',\n\t\t];\n\t\tforeach ($userRoles as $userRole => $userPrefix) {\n\t\t\t$userInfo = [\n\t\t\t\t'role' => $userRole,\n\t\t\t\t'prefix' => $userPrefix,\n\t\t\t];\n\t\t\t$this->applyUserInfo($userInfo);\n\t\t\t$this->generateMockedController();\n\t\t\t$url = [\n\t\t\t\t'controller' => 'deferred',\n\t\t\t\t'action' => 'approve',\n\t\t\t\t'3',\n\t\t\t];\n\t\t\tif (!empty($userPrefix)) {\n\t\t\t\t$url['prefix'] = $userPrefix;\n\t\t\t\t$url[$userPrefix] = true;\n\t\t\t}\n\t\t\t$this->testAction($url, $opt);\n\t\t\t$this->checkIsNotAuthorized();\n\t\t\t$this->checkRedirect(true);\n\t\t}\n\t}", "static function getrules_enable_brute_force_prevention()\r\n {\r\n global $aio_wp_security;\r\n $rules = '';\r\n if ($aio_wp_security->configs->get_value('aiowps_enable_brute_force_attack_prevention') == '1') {\r\n $cookie_name = $aio_wp_security->configs->get_value('aiowps_brute_force_secret_word');\r\n $test_cookie_name = $aio_wp_security->configs->get_value('aiowps_cookie_brute_test');\r\n $redirect_url = $aio_wp_security->configs->get_value('aiowps_cookie_based_brute_force_redirect_url');\r\n $rules .= AIOWPSecurity_Utility_Htaccess::$enable_brute_force_attack_prevention_marker_start . PHP_EOL; //Add feature marker start\r\n $rules .= 'RewriteEngine On' . PHP_EOL;\r\n $rules .= 'RewriteCond %{REQUEST_URI} (wp-admin|wp-login)' . PHP_EOL;// If URI contains wp-admin or wp-login\r\n if ($aio_wp_security->configs->get_value('aiowps_brute_force_attack_prevention_ajax_exception') == '1') {\r\n $rules .= 'RewriteCond %{REQUEST_URI} !(wp-admin/admin-ajax.php)' . PHP_EOL; // To allow ajax requests through\r\n }\r\n if ($aio_wp_security->configs->get_value('aiowps_brute_force_attack_prevention_pw_protected_exception') == '1') {\r\n $rules .= 'RewriteCond %{QUERY_STRING} !(action\\=postpass)' . PHP_EOL; // Possible workaround for people usign the password protected page/post feature\r\n }\r\n $rules .= 'RewriteCond %{HTTP_COOKIE} !' . $cookie_name . '= [NC]' . PHP_EOL;\r\n $rules .= 'RewriteCond %{HTTP_COOKIE} !' . $test_cookie_name . '= [NC]' . PHP_EOL;\r\n $rules .= 'RewriteRule .* ' . $redirect_url . ' [L]' . PHP_EOL;\r\n $rules .= AIOWPSecurity_Utility_Htaccess::$enable_brute_force_attack_prevention_marker_end . PHP_EOL; //Add feature marker end\r\n }\r\n\r\n return $rules;\r\n }", "public function accessRules()\n\t{\n\t\treturn array(\n\t\t\tarray('allow', \n\t\t\t\t'actions'=>array('allotMore','allotOne'),\n\t\t\t\t'expression'=>array('PlaneAllotController','allowReadWrite'),\n\t\t\t),\n\t\t\tarray('allow', \n\t\t\t\t'actions'=>array('index'),\n\t\t\t\t'expression'=>array('PlaneAllotController','allowReadOnly'),\n\t\t\t),\n\t\t\tarray('deny', // deny all users\n\t\t\t\t'users'=>array('*'),\n\t\t\t),\n\t\t);\n\t}", "public function filters()\r\n\t{\r\n\t\treturn array(\r\n\t\t\t'rights', // perform access control for CRUD operations\r\n\t\t);\r\n\t}", "public function accessRules() {\n return [\n ['allow', // allow all users to perform 'index' and 'view' and 'download' actions\n 'actions' => ['view', 'dashboard', 'index', 'getGridView', 'getPie', 'wordCloud'],\n 'users' => [Yii::app()->user->name],\n 'expression' => 'Yii::app()->controller->allowUser([ROLE_ADMIN, ROLE_USER, ROLE_CLIENT])',\n ],\n ['allow', // allow users and admins to perform 'create' and 'update' actions\n 'actions' => ['update', 'sphinxConf'],\n 'users' => [Yii::app()->user->name],\n 'expression' => 'Yii::app()->controller->allowUser([ROLE_ADMIN, ROLE_USER])',\n ],\n ['allow', // allow admin user to perform 'admin' and 'delete' actions\n 'actions' => ['admin', 'delete', 'create', 'addPersonToProject', 'searchAndReplace', 'removePersonFromProject', 'اختبار', 'nuclearOption', 'duplicate'],\n 'users' => [Yii::app()->user->name],\n 'expression' => 'Yii::app()->controller->allowUser([ROLE_ADMIN])',\n ],\n ['deny'],\n ];\n }", "public function accessRules()\n\t{\n\t\treturn array(\n\t\t\tarray('allow', // allow admins only\n\t\t\t\t'users'=>Yii::app()->getModule('user')->getAdmins(),\n\t\t\t),\n\t\t\tarray('allow',\n\t\t\t\t\t\t/*'users' => array(\"?\"),*/\n 'expression' => array($this,'isLogedInOrHasKey'),\n ),\n\t\t\tarray('deny', // deny all users\n\t\t\t\t'users'=>array('*'),\n\t\t\t),\n\t\t);\n\t}", "public function accessRules()\n\t{\n\t\treturn array(\n\t\t\t\n\t\t\tarray('allow', // allow all users to perform 'index' and 'view' actions\n\t\t\t\t'actions'=>array('marketSegmentFilter','marketSegmentFilter2','categoryFilter','officerFilter','decisionFilter','subCategoryFilter'),\n\t\t\t\t'users'=>array('@'),\n\t\t\t),\n\t\t\t\n\t\t\t/*array('allow', \n\t\t\t\t'users'=>array('@'),\n\t\t\t\t//'expression'=>'Yii::app()->user->permission',\n\t\t\t),*/\n\t\t\tarray('allow', \n\t\t\t\t'users'=>array('@'),\n\t\t\t\t'actions'=>array('approvalList','approval'),\n\t\t\t\t'expression'=>'Yii::app()->user->getPermission(\"licenceApplicationApproval\")',\n\t\t\t),\n\t\t\tarray('allow', \n\t\t\t\t'users'=>array('@'),\n\t\t\t\t'actions'=>array('editList','edit','editCommunication','editContent','editCourier','editInstallation','editImportation','editVsat'),\n\t\t\t\t'expression'=>'Yii::app()->user->getPermission(\"licenceApplicationEdit\")',\n\t\t\t),\n\t\t\tarray('allow', \n\t\t\t\t'users'=>array('@'),\n\t\t\t\t'actions'=>array('evaluationList','evaluation','businessPlan','checkResources'),\n\t\t\t\t'expression'=>'Yii::app()->user->getPermission(\"licenceApplicationEvaluation\")',\n\t\t\t),\n\t\t\tarray('allow', \n\t\t\t\t'users'=>array('@'),\n\t\t\t\t'actions'=>array('printList','print'),\n\t\t\t\t'expression'=>'Yii::app()->user->getPermission(\"licenceApplicationPrint\")',\n\t\t\t),\n\t\t\tarray('allow', \n\t\t\t\t'users'=>array('@'),\n\t\t\t\t'actions'=>array('prepareList','prepare'),\n\t\t\t\t'expression'=>'Yii::app()->user->getPermission(\"licenceApplicationPrepare\")',\n\t\t\t),\n\t\t\tarray('allow', \n\t\t\t\t'users'=>array('@'),\n\t\t\t\t'actions'=>array('issueList','issue'),\n\t\t\t\t'expression'=>'Yii::app()->user->getPermission(\"licenceApplicationIssue\")',\n\t\t\t),\n\t\t\tarray('allow', \n\t\t\t\t'users'=>array('@'),\n\t\t\t\t'actions'=>array('viewList','view'),\n\t\t\t\t'expression'=>'Yii::app()->user->getPermission(\"licenceApplicationView\")',\n\t\t\t),\n\t\t\tarray('allow', \n\t\t\t\t'users'=>array('@'),\n\t\t\t\t'actions'=>array('licenceList','licenceeList','licenceView','licenceeView'),\n\t\t\t\t'expression'=>'Yii::app()->user->getPermission(\"licenceView\")',\n\t\t\t),\n\t\t\tarray('allow', \n\t\t\t\t'users'=>array('@'),\n\t\t\t\t'actions'=>array('cancelView','cancelList'),\n\t\t\t\t'expression'=>'Yii::app()->user->getPermission(\"licenceCancel\")',\n\t\t\t),\n\t\t\tarray('allow', \n\t\t\t\t'users'=>array('@'),\n\t\t\t\t'actions'=>array('admin','renewList','renewView','annualFeeList','annualFeeView'),\n\t\t\t),\n\t\t\tarray('allow', \n\t\t\t\t'users'=>array('@'),\n\t\t\t\t'actions'=>array('new','newCommunication','newContent','newCourier','newInstallation','newImportation','newDistribution','editDistribution','newSelling','editSelling','newVsat','editVsat'),\n\t\t\t\t'expression'=>'Yii::app()->user->getPermission(\"licenceApplicationNew\")',\n\t\t\t),\n\t\t\tarray('deny', // deny all users\n\t\t\t\t'users'=>array('*'),\n\t\t\t),\n\t\t);\n\t}", "public function deny($obj, $actions){\r\n $this->_type = NULL;\r\n $this->loadObject();\r\n $suc = $this->_obj->deny($obj, $actions);\r\n \r\n return $suc;\r\n }", "public function filter()\n {\n\n if ( func_num_args() > 2 ) {\n\n $args = func_get_args();\n $roles = array_slice( $args, 2 );\n\n Role::isOrFail( $roles );\n\n }\n }", "public function beforeFilter() {\n parent::beforeFilter();\n $this->Auth->allow(array('explore','get_map_init','get_map','get_experiences','search')); //actions that anyone is allowed to call\n }", "public function accessRules()\n {\n\t\treturn array(\n\t\t\t\tarray('allow', 'expression'=>array($this, 'authIdentify')), \t\n\t\t\t\tarray('deny', 'users'=>array('*')),\n\t\t);\n\t}", "public function accessRules()\n\t{\n\t\treturn array(\n\t\t\tarray('allow',\n\t\t\t\t'actions'=>array('index', 'importar', 'update'),\n\t\t\t\t'users'=>array('@'),\n\t\t\t\t'expression'=>'!$user->isGuest && $user->verifyRole(Usuarios::ADMIN)'\n\t\t\t),\n\t\t\tarray('deny',\n\t\t\t\t'users'=>array('*')\n\t\t\t)\n\t\t);\n\t}", "public function accessRules() {\n return array(\n array('allow',\n 'actions' => array(\n 'setInvoiceId',\n 'previewInvoice',\n 'createInvoice',\n 'downloadInvoice',\n ),\n 'roles' => array('super_admin', 'admin'),\n 'expression' => 'UserB::hasBillingAccess()',\n ),\n array('deny',\n 'users' => array('*')\n )\n );\n }", "public function accessRules()\n\t{\n\t\treturn array(\n\t\t\t\t\t\tarray('allow', 'actions' => array('checkout'), 'roles' => array('members')),\n\t\t\t\t\t\tarray('deny', 'actions' => array('checkout'), 'users' => array('*')),\t\t\t\t\t\t\n\t\t\t\t\t);\n\t}", "public function accessRules()\n\t{\n\t\t return array(\n array('allow',\n 'actions'=>array(),\n 'roles'=>array('admin'),\n ),\n array('deny', // deny all users\n 'users'=>array('*'),\n ),\n );\n\t}", "public function accessRules() {\n return array(\n array('allow',\n 'actions' => array('*'),\n 'users' => array('@'),\n ),\n );\n }", "public function accessRules() {\n return array(\n array('allow',\n 'actions' => array('*'),\n 'users' => array('@'),\n ),\n );\n }", "public function accessRules() {\n return array(\n array('allow',\n 'actions' => array('*'),\n 'users' => array('@'),\n ),\n );\n }", "public function accessRules() {\n return array(\n array(\n 'allow',\n 'actions' => array('index', 'archive', 'view', 'read', 'userListResults'),\n 'users' => array('@')\n ),\n array('allow', // allow admin user to perform 'admin' and 'delete' actions\n 'actions' => array('create','admin', 'update'),\n 'expression' => 'Yii::app()->user->isAdmin()',\n ),\n array(\n 'deny', // deny all users\n 'users' => array('*')\n )\n );\n }", "protected function denyRequest()\n {\n $this->loginAction();\n }", "public function veterinaireDashboard()\n{\n $this->denyAccessUnlessGranted('ROLE_VETERINAIRE');\n\n // or add an optional message - seen by developers\n $this->denyAccessUnlessGranted('ROLE_VETERINAIRE', null, 'User tried to access a page without having ROLE_VETERINAIRE');\n}", "public function accessRules()\n {\n return array(\n array('allow',\n 'roles' => array('admin'),\n ),\n array('deny',\n 'users' => array('*'),\n ),\n );\n }", "public function accessRules()\n {\n return array(\n array('allow',\n 'actions' => array('index', 'create', 'update', 'delete', 'ajaxUpload', 'preview', 'ajaxBgUpload', 'ediType'),\n 'users' => array('@'),\n ),\n array('deny', // deny all users\n 'users' => array('*'),\n ),\n );\n }", "public function accessRules()\n\t{\n\t\treturn array( \t\t\t \n\t\t\tarray('allow',\n\t\t\t\t'actions'=>array('delete', 'update', 'createTask'),\n\t\t\t\t'users'=>array('@'),\t\t\t\t\n\t\t\t),\n\t\t\tarray('deny', // deny all users\n\t\t\t\t'users'=>array('*'),\n\t\t\t),\n\t\t);\n\t}", "public function accessRules()\n {\n return array(\n array('allow',\n 'actions'=>array('list','show','captcha','PostedInMonth','PostedOnDate', 'search'),\n 'users'=>array('*'),\n ),\n array('allow',\n 'actions'=>array('ajaxBookmark','create'),\n 'users'=>array('@'),\n ),\n array('allow',\n 'expression'=>'Yii::app()->user->status=='.User::STATUS_ADMIN.\n '||Yii::app()->user->status=='.User::STATUS_WRITER,\n ),\n array('deny', // deny all users\n 'users'=>array('*'),\n ),\n );\n }", "protected function processDeny($data) {\n \t$s = new Zend_Session_Namespace('lastRequest');\n \tunset($s->hasRequested);\n $state = isset($data[STATE]) ? $data[STATE] : NULL;\n $urlHelper = $this->_helper->RedirectUriFormatter;\n\n $url = $urlHelper->errorRedirect($data[REDIRECT_URI], $state);\n\tZend_Auth::getInstance()->clearIdentity();\n $this->_helper->redirector->gotoUrl($url);\n }", "public function accessRules() {\n // en este array colocar solo los action de consulta\n return array(\n array('allow',\n 'actions' => array(),\n 'pbac' => array('write', 'admin'),\n ),\n array('allow',\n 'actions' => array(),\n 'pbac' => array('read'),\n ),\n // este array siempre va asì para delimitar el acceso a todos los usuarios que no tienen permisologia de read o write sobre el modulo\n array('deny', // deny all users\n 'users' => array('*'),\n ),\n );\n }", "public function accessRules()\n\t{\n\t\t return array(\n array('allow', // allow all users to perform 'index' and 'view' actions\n 'actions' => array('index', 'view'),\n 'expression' => 'Yii::app()->user->isAdmin()',\n ),\n array('deny', // deny all users\n 'expression' => '!Yii::app()->user->isAdmin()',\n ),\n );\n\t}", "public function accessRules()\n\t{\n return array(\n array('allow',\n 'actions'=>array('skillsbyajax', 'create', 'update', 'delete'),\n 'users'=>Users::Admins(),\n ),\n array('deny', // deny all users\n 'users'=>array('*'),\n ),\n );\n\t}", "public function accessRules()\n {\n return array(\n array('allow',\n 'actions' => array('login', 'register', 'error', 'getUrlImage', 'forgot', 'resetPassword'),\n 'users' => array('*'),\n ),\n /*array('allow',\n 'actions' => array('logout', 'image'),\n 'expression' => '$user->isAdmin',\n ),*/\n array('allow',\n 'actions' => array('logout', 'image'),\n 'users' => array('@'),\n ),\n array('deny',\n 'users' => array('*'),\n ),\n );\n }", "protected function getFileDenyPatternStatus() {}", "public function testIndexDenyNotHrAndAdmin() {\n\t\t$this->setExpectedException('MissingActionException');\n\t\t$userRoles = [\n\t\t\tUSER_ROLE_USER => '',\n\t\t\tUSER_ROLE_USER | USER_ROLE_SECRETARY => 'secret',\n\t\t];\n\t\t$opt = [\n\t\t\t'method' => 'GET',\n\t\t];\n\t\tforeach ($userRoles as $userRole => $userPrefix) {\n\t\t\t$userInfo = [\n\t\t\t\t'role' => $userRole,\n\t\t\t\t'prefix' => $userPrefix,\n\t\t\t];\n\t\t\t$this->applyUserInfo($userInfo);\n\t\t\t$this->generateMockedController();\n\t\t\t$url = [\n\t\t\t\t'controller' => 'deferred',\n\t\t\t\t'action' => 'index',\n\t\t\t];\n\t\t\tif (!empty($userPrefix)) {\n\t\t\t\t$url['prefix'] = $userPrefix;\n\t\t\t\t$url[$userPrefix] = true;\n\t\t\t}\n\t\t\t$this->testAction($url, $opt);\n\t\t\t$this->checkIsNotAuthorized();\n\t\t\t$this->checkRedirect(true);\n\t\t}\n\t}", "public function accessRules()\n\t{\n\t\treturn array(\n\t\t\tarray('allow',\n\t\t\t\t'actions' => array('index', 'worldMap', 'ownIslands', 'research', 'highscore', 'enterWorld', 'playWorld'),\n\t\t\t\t'users' => array('@'),\n\t\t\t),\n\t\t\tarray('deny',\n\t\t\t\t'users' => array('*'),\n\t\t\t),\n\t\t);\n\t}", "public function accessRules()\r\n {\r\n return array(\r\n array('allow',\r\n 'actions'=>array('index','create','update','delete','ajaxUpload','_status_update'),\r\n 'users'=>array('@'),\r\n ),\r\n array('deny', // deny all users\r\n 'users'=>array('*'),\r\n ),\r\n );\r\n }", "public function accessRules()\n\t{\n\t\treturn array(\n\t\t\tarray('allow', // allow admin user to perform 'admin' and 'delete' actions\n\t\t\t\t'expression'=>'helpers::isadmin()',\n\t\t\t),\n\t\t\tarray('deny', // deny all users\n\t\t\t\t'users'=>array('*'),\n\t\t\t),\n\t\t);\n\t}", "public function accessRules()\n\t{\n\t\treturn array(\n\t\t\tarray('allow', \n\t\t\t\t'actions'=>array('new','edit','delete','save','submit','request','cancel','fileupload','fileremove'),\n\t\t\t\t'expression'=>array('PayreqController','allowReadWrite'),\n\t\t\t),\n\t\t\tarray('allow', \n\t\t\t\t'actions'=>array('index','view','check','filedownload','void','listtax','Listfile'),\n\t\t\t\t'expression'=>array('PayreqController','allowReadOnly'),\n\t\t\t),\n\t\t\tarray('deny', // deny all users\n\t\t\t\t'users'=>array('*'),\n\t\t\t),\n\t\t);\n\t}", "public function accessRules()\n\t{\n\t\treturn array(\n\t\t\tarray('allow',\n\t\t\t\t'actions'=>array('state', 'ajaxStateReload'),\n\t\t\t\t'users'=>array('@'),\n\t\t\t),\n\t\t\tarray('deny',\n\t\t\t\t'users'=>array('*'),\n\t\t\t),\n\t\t);\n\t}", "public function accessRules()\n\t{\n\t\treturn array(\n\t\t\tarray('allow',\n\t\t\t\t'actions'=>array('viciUser'),\n\t\t\t\t'users'=>array('@'),\n\t\t\t),\n\t\t\tarray('deny',\n\t\t\t\t'users'=>array('*'),\n\t\t\t),\n\t\t);\n\t}", "public function accessRules() {\n return array(\n array('allow',\n 'actions' => array('morecomments', 'approve', 'dashboard', 'create', 'list', 'update', 'delete', 'deleteall', 'index', 'view', 'replay', 'message.msg'),\n 'expression' => '$user->isAdministrator()',\n ),\n array('deny',\n 'users' => array('*'),\n )\n// array('allow', // allow all users to perform 'index' and 'view' actions\n// 'actions' => array('index', 'view'),\n// 'users' => array('*'),\n// ),\n// array('allow', // allow authenticated user to perform 'create' and 'update' actions\n// 'actions' => array('create', 'update'),\n// 'users' => array('@'),\n// ),\n// array('allow', // allow dashboard user to perform 'dashboard' and 'delete' actions\n// 'actions' => array('dashboard', 'delete'),\n// 'users' => array('dashboard'),\n// ),\n// array('deny', // deny all users\n// 'users' => array('*'),\n// ),\n );\n }", "public function accessRules()\n\t{\n\t\treturn array(\n array('allow',\n 'actions'=>array('send', 'my'),\n 'users'=>array('@')),\n array('allow',\n 'actions'=>array('validate','validateIt'),\n 'roles'=>array('administrator')),\n\t\t\tarray('deny', // deny all users\n\t\t\t\t'users'=>array('*'),\n\t\t\t),\n\t\t);\n\t}", "public function accessRules()\n {\n return array(\n array('allow',\n 'actions'=>array('edit','draft','save','down','fileupload','fileRemove'),\n 'expression'=>array('SignContractController','allowReadWrite'),\n ),\n array('allow',\n 'actions'=>array('delete'),\n 'expression'=>array('SignContractController','allowDelete'),\n ),\n array('allow',\n 'actions'=>array('index','view','fileDownload'),\n 'expression'=>array('SignContractController','allowReadOnly'),\n ),\n array('deny', // deny all users\n 'users'=>array('*'),\n ),\n );\n }", "public function beforeFilter() {\n parent::beforeFilter();\n\n if ($this->Auth->user('role') == 'admin') {\n \t$this->Auth->allow('index', 'add', 'edit', 'delete', 'logout');\t\n }\n elseif ($this->Auth->user('role') == 'user') {\n \t$this->Auth->allow('add', 'logout');\t\n }\n }", "public function allowedFilters()\n {\n return [];\n }" ]
[ "0.6492461", "0.6367166", "0.6363863", "0.6278832", "0.62267214", "0.6211203", "0.62081724", "0.61121035", "0.5976451", "0.5968584", "0.59037304", "0.5892038", "0.5812412", "0.58011407", "0.5790746", "0.57741034", "0.57702214", "0.5754712", "0.5754588", "0.5752555", "0.5714393", "0.57080525", "0.57053155", "0.56950915", "0.5680646", "0.5668968", "0.56624", "0.56474894", "0.56351125", "0.562587", "0.5615298", "0.5602092", "0.5600822", "0.5600822", "0.55997956", "0.5593178", "0.5582724", "0.5577776", "0.55702996", "0.5560839", "0.5560839", "0.55562836", "0.5555369", "0.55538744", "0.55530995", "0.55528325", "0.55471784", "0.554554", "0.55447125", "0.5530422", "0.55289173", "0.5518569", "0.55180115", "0.5515434", "0.55098796", "0.55076355", "0.5505062", "0.550181", "0.54974884", "0.5492504", "0.5490096", "0.548405", "0.54682267", "0.54638517", "0.5461316", "0.5460869", "0.54508805", "0.5447491", "0.54466444", "0.5446121", "0.54336697", "0.54329824", "0.5430047", "0.54237306", "0.54237306", "0.54237306", "0.5422148", "0.54158896", "0.5415752", "0.5414259", "0.54132086", "0.5411304", "0.54042524", "0.53957766", "0.53920025", "0.53883356", "0.5382761", "0.53752404", "0.537242", "0.53707033", "0.536558", "0.53643966", "0.53607476", "0.5357252", "0.5354214", "0.53508884", "0.5350389", "0.53460157", "0.53458476", "0.5344403", "0.5341495" ]
0.0
-1
Init discount and affiliate product
private static function initAvailableProduct($rule, $sku_id, $params = array()) { if (!isset(self::$available_products[$sku_id][$rule['id']]) || (isset(self::$available_products[$sku_id][$rule['id']]) && !isset(self::$available_products[$sku_id][$rule['id']]['quantity']))) { self::$available_products[$sku_id][$rule['id']] = array( 'quantity' => 0, 'discount' => 0, 'affiliate' => 0, ); // Если у данного товара не было скидок, и мы были вынуждены проверить его из-за опции // "Отображать доступные скидки для товаров, которые удовлетворяют условиям", ставим флаг, что для данного товара можно не просчитывать // скидки. Вывод скидок следует регулировать в типах отображения if (!empty($params['prod_meet_cond'])) { self::$available_products[$sku_id][$rule['id']]['without_discount'] = 1; } } self::$available_products[$sku_id][$rule['id']]['rule'] = array( "id" => $rule['id'], "sort" => $rule['frontend_sort'], "name" => $rule['name'] ? $rule['name'] : _wp("Discount #") . $rule['id'], "description" => $rule['description'] ? $rule['description'] : '', "code" => $rule['code'], "discount" => !empty($rule['discount']) ? shop_currency($rule['discount'], !empty($rule['discount_currency']) ? $rule['discount_currency'] : wa('shop')->getConfig()->getCurrency(true), wa('shop')->getConfig()->getCurrency(false), false) : 0, "discount_percentage" => !empty($rule['discount_percentage']) ? $rule['discount_percentage'] : 0, "affiliate" => !empty($rule['affiliate']) ? $rule['affiliate'] : 0, "affiliate_percentage" => !empty($rule['affiliate_percentage']) ? $rule['affiliate_percentage'] : 0 ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function AssignDiscount()\n\t{\t\n\t}", "protected function _construct()\r\n {\r\n $this->_init('ss_price', 'price_id');\r\n }", "public function _construct()\n {\n parent::_construct();\n $this->_init('wholesale/product');\n }", "public function init() {\n\t\t$this->store_url = 'https://getblocklab.com';\n\t\t$this->product_slug = 'block-lab-pro';\n\t}", "public function _construct()\n {\n $this->_init('inwardproduct/inwardproduct', 'inwardproduct_id');\n }", "public function __construct() {\n\t\t$this->model = new Discounts();\n\t}", "protected function _construct()\n {\n $this->_init(\\MagentoCoders\\CustomCatalog\\Model\\Product::class, Product::class);\n }", "function __construct()\n\t{\n\t\t//$this->PaypalAdaptivePayments = Paypaladaptive::initialize();\n\t\t$this->paypal_transaction = Paypaladaptive::initializePaypalTransaction();\n\t\t$this->shop_order_obj = Webshoporder::initialize();\n\t\t$this->invoice_obj = Webshoporder::initializeInvoice();\n\t\t$this->product_obj = Products::initialize();\n\t\t$this->common_invoice_obj = Products::initializeCommonInvoice();\n\t\t$this->manage_credits_obj = Products::initializeManageCredits();\n\t}", "public function __construct()\n {\n $this->sale_account = config('global.sale');\n $this->cash_sale = config('global.cash_sale');\n $this->sale_advance = config('global.sale_advance');\n $this->discount_allowed = config('global.discount_allowed');\n $this->credit_collection = config('global.credit_collection');\n // sub account for purcahse\n $this->purchase_account = config('global.purchase');\n $this->cash_purchase = config('global.cash_purchase');\n $this->purchase_advance = config('global.purchase_advance');\n $this->discount_received = config('global.discount_received');\n $this->credit_payment = config('global.credit_payment');\n $this->opening_balance=null;\n }", "public function __construct(Product $product, $amount)\n {\n //\n }", "public function __construct()\n {\n \ttry\n \t{\n \t\t$this->_main = Mage::helper('shoptimally_upsalecoupons/main');\n \t\t$this->_main->runFeature();\n \t}\n \tcatch (Exception $e)\n \t{\n \t\tMage::helper('shoptimally_core/log')->warn(\"Unexpected exception while getting upsale coupon!\", $e);\n \t}\n }", "public function _construct() {\n parent::_construct();\n\n $product = $this->getProduct();\n\n $this->setTemplate('globallink/catalog/product/adaptor.phtml');\n $this->setProduct($product);\n }", "private function prepareSimpleProduct() {\n if ($this->getSaverData()->isFirstPage()) {\n $this->setPrice();\n $this->setDownloadOptions();\n $this->setSKU();\n $this->setStockOptions();\n $this->setSoldIndividually();\n $this->setShippingOptions();\n $this->setPurchaseNote();\n $this->setEnableReviews();\n $this->setMenuOrder();\n }\n\n $this->setTags();\n $this->setAttributes();\n }", "private function prepareExternalProduct() {\n if ($this->getSaverData()->isFirstPage()) {\n $this->setPrice();\n $this->setSKU();\n $this->setEnableReviews();\n $this->setMenuOrder();\n $this->setExternalProductDetails();\n }\n\n $this->setTags();\n $this->setAttributes();\n }", "function __construct($id, $label, $price, $nbSame, $listProvConcern){\n \n parent::__construct($id, $label, $price);\n $this->nbSame = $nbSame;\n // $this->provInfo = $this->getProvInfo();\n // $this->totalPrice = $this->getTotalPrice();\n \n \n }", "function DiscountLoggedInConstruct()\n\t{\t$this->AssignDiscount();\n\t\t$this->DiscountConstructFunctions();\n\t\t$this->breadcrumbs->AddCrumb('discounts.php', 'Discount codes');\n\t}", "public function __construct(Ex_product $product, $ratio, $margin_rate, $base_price_changable)\n {\n $this->product = $product;\n $this->ratio = $ratio;\n $this->margin_rate = $margin_rate;\n $this->base_price_changable = $base_price_changable;\n }", "function pricing() {\n\t\t\tparent::controller();\n\t\t\t\n\t\t}", "public function applyCartDiscount(Varien_Event_Observer $observer)\n { \n try\n { \n $bundle_product_ids = [];\n $quote_product_ids = [];\n $cookieValue = Mage::getModel('core/cookie')->get('ivid');\n $userBundleCollection = Mage::getModel('increasingly_analytics/bundle')->getCollection()->addFieldToFilter('increasingly_visitor_id',$cookieValue);\n $items = $observer->getEvent()->getQuote()->getAllItems();\n $eligibleProducts = [];\n $discount = 0;\n foreach ($items as $item) {\n array_push($quote_product_ids, $item->getProductId());\n }\n foreach ($userBundleCollection as $bundle) {\n //First Bundle products\n $bundle_product_ids = explode(',', $bundle->getProductIds()); \n $productsIds = array_intersect($quote_product_ids, $bundle_product_ids);\n if(count($productsIds) == count($bundle_product_ids) )\n $discount += $bundle->getDiscountPrice();\n }\n\n if($discount > 0){\n $quote=$observer->getEvent()->getQuote();\n $quoteid=$quote->getId();\n $discountAmount=$discount;\n if($quoteid) { \n if($discountAmount>0) {\n $total=$quote->getBaseSubtotal();\n $quote->setSubtotal(0);\n $quote->setBaseSubtotal(0);\n\n $quote->setSubtotalWithDiscount(0);\n $quote->setBaseSubtotalWithDiscount(0);\n\n $quote->setGrandTotal(0);\n $quote->setBaseGrandTotal(0);\n \n\n $canAddItems = $quote->isVirtual()? ('billing') : ('shipping'); \n foreach ($quote->getAllAddresses() as $address) {\n\n $address->setSubtotal(0);\n $address->setBaseSubtotal(0);\n\n $address->setGrandTotal(0);\n $address->setBaseGrandTotal(0);\n\n $address->collectTotals();\n\n $quote->setSubtotal((float) $quote->getSubtotal() + $address->getSubtotal());\n $quote->setBaseSubtotal((float) $quote->getBaseSubtotal() + $address->getBaseSubtotal());\n\n $quote->setSubtotalWithDiscount(\n (float) $quote->getSubtotalWithDiscount() + $address->getSubtotalWithDiscount()\n );\n $quote->setBaseSubtotalWithDiscount(\n (float) $quote->getBaseSubtotalWithDiscount() + $address->getBaseSubtotalWithDiscount()\n );\n\n $quote->setGrandTotal((float) $quote->getGrandTotal() + $address->getGrandTotal());\n $quote->setBaseGrandTotal((float) $quote->getBaseGrandTotal() + $address->getBaseGrandTotal());\n\n $quote ->save(); \n\n $quote->setGrandTotal($quote->getBaseSubtotal()-$discountAmount)\n ->setBaseGrandTotal($quote->getBaseSubtotal()-$discountAmount)\n ->setSubtotalWithDiscount($quote->getBaseSubtotal()-$discountAmount)\n ->setBaseSubtotalWithDiscount($quote->getBaseSubtotal()-$discountAmount)\n ->save(); \n\n\n if($address->getAddressType()==$canAddItems) {\n //echo $address->setDiscountAmount; exit;\n $address->setSubtotalWithDiscount((float) $address->getSubtotalWithDiscount()-$discountAmount);\n $address->setGrandTotal((float) $address->getGrandTotal()-$discountAmount);\n $address->setBaseSubtotalWithDiscount((float) $address->getBaseSubtotalWithDiscount()-$discountAmount);\n $address->setBaseGrandTotal((float) $address->getBaseGrandTotal()-$discountAmount);\n if($address->getDiscountDescription()){\n $address->setDiscountAmount(-($address->getDiscountAmount()-$discountAmount));\n $address->setDiscountDescription($address->getDiscountDescription().', Custom Discount');\n $address->setBaseDiscountAmount(-($address->getBaseDiscountAmount()-$discountAmount));\n }else {\n $address->setDiscountAmount(-($discountAmount));\n $address->setDiscountDescription('Custom Discount');\n $address->setBaseDiscountAmount(-($discountAmount));\n }\n $address->save();\n }//end: if\n } //end: foreach\n //echo $quote->getGrandTotal();\n\n foreach($quote->getAllItems() as $item){\n //We apply discount amount based on the ratio between the GrandTotal and the RowTotal\n $rat=$item->getPriceInclTax()/$total;\n $ratdisc=$discountAmount*$rat;\n $item->setDiscountAmount(($item->getDiscountAmount()+$ratdisc) * $item->getQty());\n $item->setBaseDiscountAmount(($item->getBaseDiscountAmount()+$ratdisc) * $item->getQty())->save(); \n }\n } \n }\n }\n }\n catch(Exception $e)\n {\n Mage::log(\"Remove from cart tracking - \" . $e->getMessage(), null, 'Increasingly_Analytics.log');\n }\n\n }", "public function init() {\n $this->initContent(\"Product\");\n $this->loadSession();\n }", "function uds_pricing_init()\n{\n\tglobal $uds_errors;\n\t// Basic init\n\t$dir = UDS_PRICING_URL;\n\tif(is_admin()) {\n\t\t$error = uds_pricing_process_products();\n\t\tif(is_wp_error($error)) {\n\t\t\t$uds_errors[] = $error;\n\t\t}\n\t\t\n\t\t$error = uds_pricing_process();\n\t\tif(is_wp_error($error)) {\n\t\t\t$uds_errors[] = $error;\n\t\t}\n\t}\n}", "public function __construct(){\n parent::__construct();\n $this->load->library('services/Product_services');\n $this->services = new Product_services;\n \n $this->load->model( array(\n\t\t\t'category_model',\n\t\t\t'product_model' ,\n\t\t\t'store_model' ,\n ));\n $this->product_model->set_message_delimiters( '', '' );\n $this->product_model->set_error_delimiters( '', '' );\n }", "protected function _initTotals()\r\n {\r\n parent::_initTotals();\r\n $orderId = $this->getSource()->getId();\r\n\t\t//$base_orderId = 34243;\r\n\t\t$discount = $this->helper('auction')->getDiscountByOrderId($orderId);\r\n if (0) {\r\n $this->addTotalBefore(new Varien_Object(array(\r\n 'code' => 'auction',\r\n 'value' => $amount,\r\n 'base_value'=> $amount,\r\n 'label' => $this->helper('auction')->__('Auction Product Discount ').$amount.$this->helper('auction')->__('%'),\r\n ), array('shipping', 'tax')));\r\n }\r\n\r\n return $this;\r\n }", "public function _construct()\n {\n $this->_init('configbox_magento_xref_mprod_cbprod', 'id');\n }", "public function _construct()\n {\n $this->_init('productshowrule/productshowrule', 'productshowrule_id');\n }", "public function __construct(){\n\t\t$this->numberOfFelineCPTsAuthoredByCurrentUserWithSubscriptions = 0;\n\t\n\t\t//calculate the product IDs. Text must match $title strings.\n\t\t$title =\"Single Cat Monthly Food Subscription (recurring)\";\n\t\t$page = get_page_by_title($title, $output = OBJECT, $post_type = 'product');\n\t\t$this->firstCatSubscriptionProductID = $page->ID;\n\t\t\n\t\t$title = \"Additional Cats Monthly Food Subscription (recurring)\";\n\t\t$page = get_page_by_title($title, $output = OBJECT, $post_type = 'product');\n\t\t$this->additionalCatSubscriptionProductID = $page->ID;\n\t}", "public function __construct()\n {\n $this->type = 'percentage';\n $this->amount = 20;\n $this->end_date = strtotime(\"+1 day\");\n $this->minimum_amount = 100;\n $this->free_shipping = false;\n $this->included_categories = [10, 20];\n $this->excluded_categories = [50];\n $this->included_products = [3];\n $this->excluded_products = [4, 1];\n }", "protected function initializeBenefit ()\n {\n if ( !isset($this->request->coupon_benefits[ $this->offerNature ]) )\n $this->request->coupon_benefits[ $this->offerNature ] = 0;\n }", "public function __construct(){\n\t\t\t$this->productoDetalleModelo = new productoDetalleModelo;\n\t\t\t$this->productoFavoritoControlador = new productoFavoritoControlador();\n\t\t\t$this->productoEstrellaControlador = new productoEstrellaControlador();\n\t\t\t$this->productoCarritoControlador = new productoCarritoControlador();\n\t\t}", "protected function _construct()\n\t{\n\t\t$this->_init('affiliate/withdrawal', 'id');\n\t}", "public function __construct($_quantity, $_productName, $_price, $_type, $_duty)\n {\n //variabili uguali all'input\n $this->quantity = $_quantity;\n $this->productName = $_productName;\n $this->price = $_price;\n\n //usando le funzioni del trait taxes mi trovo le tassazioni e i totali\n $this->salesTax = $this->findTax($_type);\n $this->dutyTax = $this->imported($_duty);\n $this->addNet($this->quantity * $this->price);\n $this->addTaxes($this->computeTaxes($this->quantity, $this->price, $this->salesTax, $this->dutyTax));\n $this->getTotal();\n\n \n }", "public function init()\n {\n $this->addComponent(CartComponent::class, 'cart', ['showDiscountApplier' => false]);\n $this->addComponent(AddressSelector::class, 'billingAddressSelector', ['type' => 'billing']);\n $this->addComponent(AddressSelector::class, 'shippingAddressSelector', ['type' => 'shipping']);\n $this->addComponent(ShippingMethodSelector::class, 'shippingMethodSelector', ['skipIfOnlyOneAvailable' => true]);\n $this->addComponent(PaymentMethodSelector::class, 'paymentMethodSelector', []);\n $this->setData();\n }", "public function __construct()\n {\n $this->mapper = \\Lib\\DataMapper::instance();\n $this->product = new Product();\n }", "function setup() {\r\n // \"Buy more than 100 items, get 50 (% or $, as per admin) off\" \r\n // $this->add_extra_level_discount(100, 50);\r\n }", "public function create() {\n\t\tupdate_option( 'woocommerce_calc_taxes', 'yes' );\n\t\tupdate_option( 'woocommerce_prices_include_tax', 'yes' );\n\n\t\t// Create tax rates.\n\t\t$this->tax_rate_ids[] = $this->create_tax_rate( '25' );\n\t\t$this->tax_rate_ids[] = $this->create_tax_rate( '12' );\n\t\t$this->tax_rate_ids[] = $this->create_tax_rate( '6' );\n\t\t$this->product = ( new Krokedil_Simple_Product() )->create();\n\t}", "public function _construct()\n {\n $this->_initProductCollection();\n parent::_construct();\n }", "function learndash_coupons_init() {\n\t\tadd_action( 'wp_ajax_learndash_apply_coupon', 'learndash_apply_coupon' );\n\t\tadd_action( 'wp_ajax_learndash_remove_coupon', 'learndash_remove_coupon' );\n\t\tadd_action( 'wp_ajax_learndash_enroll_with_zero_price', 'learndash_enroll_with_zero_price' );\n\t\tadd_action( 'learndash_transaction_created', 'learndash_process_coupon_after_transaction' );\n\t\tadd_filter( 'learndash_get_price_by_coupon', 'learndash_get_price_by_coupon', 10, 3 );\n\t}", "function init(&$pObj){\r\n\t\t$this->pObj = &$pObj;\r\n\t\t$this->basket = &$GLOBALS['TSFE']->fe_user->tx_commerce_basket;\r\n\r\n\t\t// do some clean up:\r\n\t\t$this->removeInvalidCouponsFromSession();\r\n\t\t$this->removeArticlesAddedByInvalidCoupon();\r\n\t\t$this->regenerateCouponArticle();\r\n\t\t$this->reduceAddedByCouponsValueIfQuantityIsLess();\r\n\t\t#$this->reduceRelatedCouponsValueIfQuantityIsLess();\r\n\t}", "function getDiscountFor($product) {\n\t\treturn 30;\n\t}", "function init() {\r\n\r\n\t\t\tadd_filter( 'woocommerce_get_settings_pages', array( &$this, 'settings_tfls' ) );\r\n\r\n\t\t\t// Add wholesale price field to product\r\n\t\t\tadd_action( 'woocommerce_product_options_general_product_data', array(\r\n\t\t\t\t&$this,\r\n\t\t\t\t'product_options_wholesale_price'\r\n\t\t\t));\r\n\r\n\t\t\t// Save wholesale prices\r\n\t\t\tadd_action( 'woocommerce_process_product_meta', array(\r\n\t\t\t\t&$this,\r\n\t\t\t\t'process_product_simple_wholesale_price'\r\n\t\t\t));\r\n\r\n\t\t\t// Add international and wholesale prices to products\r\n\t\t\tadd_action( 'woocommerce_product_options_general_product_data', array(\r\n\t\t\t\t&$this,\r\n\t\t\t\t'product_options_countries_prices'\r\n\t\t\t) );\r\n\r\n\t\t\tadd_action( 'woocommerce_process_product_meta_simple', array(\r\n\t\t\t\t&$this,\r\n\t\t\t\t'process_product_simple_countries_prices'\r\n\t\t\t) );\r\n\r\n\t\t\tif ( WC()->version < '2.3' ) {\r\n\t\t\t\t//Deprecated\r\n\t\t\t\tadd_action( 'woocommerce_product_after_variable_attributes', array(\r\n\t\t\t\t\t&$this,\r\n\t\t\t\t\t'product_variable_attributes_countries_prices_wc2_2'\r\n\t\t\t\t), 10, 3 );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tadd_action( 'woocommerce_product_after_variable_attributes', array(\r\n\t\t\t\t\t&$this,\r\n\t\t\t\t\t'product_variable_attributes_countries_prices'\r\n\t\t\t\t), 10, 3 );\r\n\t\t\t}\r\n\r\n\r\n\t\t\tadd_action( 'woocommerce_process_product_meta_variable', array(\r\n\t\t\t\t&$this,\r\n\t\t\t\t'process_product_variable_countries_prices'\r\n\t\t\t) );\r\n\r\n\t\t\tadd_action( 'woocommerce_save_product_variation', array(\r\n\t\t\t\t&$this,\r\n\t\t\t\t'save_product_variation_countries_prices'\r\n\t\t\t), 10, 2 );\r\n\r\n\t\t\tadd_filter( 'woocommerce_currency', array( &$this, 'order_currency' ) );\r\n\r\n\t\t\tadd_action( 'admin_notices', array( &$this, 'check_database_file' ) );\r\n\r\n\t\t}", "public function __construct()\n {\n $this->cart = Cart::content();\n $this->checkStock();\n }", "public function discountBifurcation(Varien_Event_Observer $observer)\n {\n $rule = $observer->getEvent()->getRule();\n $result = $observer->getEvent()->getResult();\n $itemId = $observer->getEvent()->getItem()->getItemId();\n //set Unique key\n $curUnique= $rule->getRuleId().'_'.$itemId;\n //check if Mage registry unique call set\n if(Mage::registry('uniqueCall')!==null){\n //if check in array\n $uniqueCalls = Mage::registry('uniqueCall');\n if( in_array($curUnique,$uniqueCalls)){\n return;\n }else{\n //unset existing registry. also take existing array in variable\n Mage::unregister('uniqueCall');\n $uniqueCalls[]= $curUnique ;\n //set registry again with new array include $uniqueCall into it\n Mage::register('uniqueCall',$uniqueCalls);\n }\n }else{\n //set registry again with new array include $uniqueCall into it\n $array = array();\n $array[]=$rule->getRuleId().'_'.$itemId;\n Mage::register('uniqueCall',$array);\n\n } \n\n //condition for the Promotional coupons\n if ( $rule->getCouponType() == Mage_SalesRule_Model_Rule::COUPON_TYPE_NO_COUPON ) {\n $promotionDiscount = 0;\n $promotionDiscount = Mage::registry('promotion');\n if (Mage::registry('promotion')!==null){\n Mage::unregister('promotion');\n }\n if (Mage::registry('promo_lable')!==null){\n Mage::unregister('promo_lable');\n }\n $promotionDiscount += $result->getDiscountAmount();\n Mage::register('promotion', $promotionDiscount);\n Mage::register('promo_lable',$rule->getName());\n } elseif ( $rule->getCouponType() == self::COUPON_TYPE_FUE_GENERATED ) {\n $couponDiscount = 0;\n $couponDiscount = Mage::registry('coupon');\n if(Mage::registry('coupon')!==null){\n Mage::unregister('coupon');\n }\n //sum up all the values of discounted coupons\n $couponDiscount += $result->getDiscountAmount();\n Mage::register('coupon',$couponDiscount);\n }\n $quote = $observer->getEvent()->getQuote();\n $quoteAddress = $observer->getEvent()->getAddress();\n //set discounted coupons and promotional coupons amount in quote\n $quote->setCouponDiscount(Mage::registry('coupon'));\n $quote->setPromotionalDiscount(Mage::registry('promotion'));\n\n if (Mage::getStoreConfig('promodiscount/promodiscount/use_default')) {\n $quote->setPromoLable(Mage::getStoreConfig('promodiscount/promodiscount/default_lable'));\n } else {\n if (Mage::registry('promo_lable')) {\n $quote->setPromoLable(Mage::registry('promo_lable'));\n } else {\n $quote->setPromoLable(Mage::getStoreConfig('promodiscount/promodiscount/default_lable'));\n }\n }\n \n $quoteAddress->setCouponDiscount(Mage::registry('coupon'));\n $quoteAddress->setPromotionalDiscount(Mage::registry('promotion'));\n if (Mage::registry('promo_lable')) {\n $quoteAddress->setPromoLable(Mage::registry('promo_lable'));\n } else {\n $quoteAddress->setPromoLable(Mage::getStoreConfig('promodiscount/promodiscount/default_lable'));\n }\n }", "function init() {\n \t\t$this->applied_coupons = array();\n\t\t$this->get_cart_from_session();\n\t\tif ( isset($_SESSION['coupons']) ) $this->applied_coupons = $_SESSION['coupons'];\n\t\tadd_action('cmdeals_check_cart_items', array(&$this, 'check_cart_items'), 1);\n }", "public function __construct()\n\t{\n\t \t//$this->ecommerceClient = new ecommerceClient();\n\t\t\n\t}", "function set_discount($discount_id = FALSE)\n\t\t{\n\t\t\t$this->load->model('demo_cart_model');\n\t\t\t\n\t\t\t$this->demo_cart_model->demo_set_discount($discount_id);\n\t\t\t\n\t\t\tredirect('cart');\n\t\t}", "public function __construct() {\n trace('[METHOD] '.__METHOD__);\n $this->classConfigArr = $GLOBALS['TSFE']->tmpl->setup['config.']['tx_ptgsaaccounting.'];\n $this->shopConfigArr = $GLOBALS['TSFE']->tmpl->setup['config.']['tx_ptgsashop.']; \n \n if($this->shopConfigArr['usePricesWithMoreThanTwoDecimals'] == 1) {\n $this->precision = 4;\n } else {\n $this->precision = 2;\n } \n trace($this->classConfigArr,0,'classConfigArr');\n trace($this->shopConfigArr,0,'shopConfigArr');\n }", "private function setRecountProduct() {\n\n //$this->model->setDocumentNumber($this->getDocumentNumber);\n $sql = null;\n if ($this->getVendor() == self::MYSQL) {\n $sql = \"\n INSERT INTO `productrecount` \n (\n `companyId`,\n `warehouseId`,\n `productCode`,\n `productDescription`,\n `productRecountDate`,\n `productRecountSystemQuantity`,\n `productRecountPhysicalQuantity`,\n `isDefault`,\n `isNew`,\n `isDraft`,\n `isUpdate`,\n `isDelete`,\n `isActive`,\n `isApproved`,\n `isReview`,\n `isPost`,\n `executeBy`,\n `executeTime`\n ) VALUES ( \n '\" . $this->getCompanyId() . \"',\n '\" . $this->model->getWarehouseId() . \"',\n '\" . $this->model->getProductCode() . \"',\n '\" . $this->model->getProductDescription() . \"',\n '\" . $this->model->getProductRecountDate() . \"',\n '\" . $this->model->getProductRecountSystemQuantity() . \"',\n '\" . $this->model->getProductRecountPhysicalQuantity() . \"',\n '\" . $this->model->getIsDefault(0, 'single') . \"',\n '\" . $this->model->getIsNew(0, 'single') . \"',\n '\" . $this->model->getIsDraft(0, 'single') . \"',\n '\" . $this->model->getIsUpdate(0, 'single') . \"',\n '\" . $this->model->getIsDelete(0, 'single') . \"',\n '\" . $this->model->getIsActive(0, 'single') . \"',\n '\" . $this->model->getIsApproved(0, 'single') . \"',\n '\" . $this->model->getIsReview(0, 'single') . \"',\n '\" . $this->model->getIsPost(0, 'single') . \"',\n '\" . $this->model->getExecuteBy() . \"',\n \" . $this->model->getExecuteTime() . \"\n );\";\n } else {\n if ($this->getVendor() == self::MSSQL) {\n $sql = \"\n INSERT INTO [productRecount]\n (\n [productRecountId],\n [companyId],\n [warehouseId],\n [productCode],\n [productDescription],\n [productRecountDate],\n [productRecountSystemQuantity],\n [productRecountPhysicalQuantity],\n [isDefault],\n [isNew],\n [isDraft],\n [isUpdate],\n [isDelete],\n [isActive],\n [isApproved],\n [isReview],\n [isPost],\n [executeBy],\n [executeTime]\n) VALUES (\n '\" . $this->getCompanyId() . \"',\n '\" . $this->model->getWarehouseId() . \"',\n '\" . $this->model->getProductCode() . \"',\n '\" . $this->model->getProductDescription() . \"',\n '\" . $this->model->getProductRecountDate() . \"',\n '\" . $this->model->getProductRecountSystemQuantity() . \"',\n '\" . $this->model->getProductRecountPhysicalQuantity() . \"',\n '\" . $this->model->getIsDefault(0, 'single') . \"',\n '\" . $this->model->getIsNew(0, 'single') . \"',\n '\" . $this->model->getIsDraft(0, 'single') . \"',\n '\" . $this->model->getIsUpdate(0, 'single') . \"',\n '\" . $this->model->getIsDelete(0, 'single') . \"',\n '\" . $this->model->getIsActive(0, 'single') . \"',\n '\" . $this->model->getIsApproved(0, 'single') . \"',\n '\" . $this->model->getIsReview(0, 'single') . \"',\n '\" . $this->model->getIsPost(0, 'single') . \"',\n '\" . $this->model->getExecuteBy() . \"',\n \" . $this->model->getExecuteTime() . \"\n );\";\n } else {\n if ($this->getVendor() == self::ORACLE) {\n $sql = \"\n INSERT INTO PRODUCTRECOUNT\n (\n COMPANYID,\n WAREHOUSEID,\n PRODUCTCODE,\n PRODUCTDESCRIPTION,\n PRODUCTRECOUNTDATE,\n PRODUCTRECOUNTSYSTEMQUANTITY,\n PRODUCTRECOUNTPHYSICALQUANTITY,\n ISDEFAULT,\n ISNEW,\n ISDRAFT,\n ISUPDATE,\n ISDELETE,\n ISACTIVE,\n ISAPPROVED,\n ISREVIEW,\n ISPOST,\n EXECUTEBY,\n EXECUTETIME\n ) VALUES (\n '\" . $this->getCompanyId() . \"',\n '\" . $this->model->getWarehouseId() . \"',\n '\" . $this->model->getProductCode() . \"',\n '\" . $this->model->getProductDescription() . \"',\n '\" . $this->model->getProductRecountDate() . \"',\n '\" . $this->model->getProductRecountSystemQuantity() . \"',\n '\" . $this->model->getProductRecountPhysicalQuantity() . \"',\n '\" . $this->model->getIsDefault(0, 'single') . \"',\n '\" . $this->model->getIsNew(0, 'single') . \"',\n '\" . $this->model->getIsDraft(0, 'single') . \"',\n '\" . $this->model->getIsUpdate(0, 'single') . \"',\n '\" . $this->model->getIsDelete(0, 'single') . \"',\n '\" . $this->model->getIsActive(0, 'single') . \"',\n '\" . $this->model->getIsApproved(0, 'single') . \"',\n '\" . $this->model->getIsReview(0, 'single') . \"',\n '\" . $this->model->getIsPost(0, 'single') . \"',\n '\" . $this->model->getExecuteBy() . \"',\n \" . $this->model->getExecuteTime() . \"\n );\";\n }\n }\n }\n try {\n $this->q->create($sql);\n } catch (\\Exception $e) {\n $this->q->rollback();\n echo json_encode(array(\"success\" => false, \"message\" => $e->getMessage()));\n exit();\n }\n }", "private function updateProductDiscount(\n ProductInterface $product,\n Request $request\n ): void {\n $discountPercent = $request->request->get('discount_percent') !== '' ? (float) $request->request->get('discount_percent') : null;\n $discountLimitType = $request->request->get('discount_limit_type') !== '' ? $request->request->get('discount_limit_type') : null;\n $discountFromDate = $request->request->get('discount_from_date') !== '' ? $request->request->get('discount_from_date') : null;\n $discountToDate = $request->request->get('discount_to_date') !== '' ? $request->request->get('discount_to_date') : null;\n\n $variants = $product->getVariants();\n foreach ($variants as $variant) {\n // Variant to change\n $variantPricing = $variant->getChannelPricings()->first();\n\n // Change percent\n if ($discountPercent !== null) {\n $variantPricing->setDiscount($discountPercent / 100);\n }\n\n // Continue if no change type\n if ($discountLimitType === self::LIMIT_NO_CHANGE) {\n continue;\n }\n // Discount type\n $variantPricing->setDiscountLimitType($discountLimitType === self::LIMIT_NONE ? null : $discountLimitType);\n\n // Date type discount\n if ($discountLimitType === self::LIMIT_DATETIME) {\n if ($discountFromDate && $discountToDate) {\n $dateFrom = \\DateTime::createFromFormat('Y-m-d', $discountFromDate);\n $dateTo = \\DateTime::createFromFormat('Y-m-d', $discountToDate);\n\n $variantPricing->setDiscountFrom($dateFrom);\n $variantPricing->setDiscountTo($dateTo);\n }\n\n if ($discountFromDate && !$discountToDate) {\n $dateFrom = \\DateTime::createFromFormat('Y-m-d', $discountFromDate);\n\n $variantPricing->setDiscountFrom($dateFrom);\n $variantPricing->setDiscountTo(null);\n }\n\n if (!$discountFromDate && $discountToDate) {\n $dateTo = \\DateTime::createFromFormat('Y-m-d', $discountToDate);\n\n $variantPricing->setDiscountFrom(null);\n $variantPricing->setDiscountTo($dateTo);\n }\n }\n }\n }", "public function __construct()\n\t{\n\t\t$this->helper = new Aurednik_Integration_Helper_Service_In_Catalog_Product_Images_Import ();\n\t}", "function __construct($purchase_Id = \"\", \n $customer_Id =\"\", \n $product_Id =\"\",\n $purchaseQuantitySold =\"\",\n $purchaseProdPrice =\"\",\n $purchaseComments =\"\",\n $purchaseSubtotal = \"\",\n $purchaseTaxes =\"\",\n $purchaseGrandtotal = \"\") {\n $this->purchase_Id =$product_Id;\n $this->customer_Id=$customer_Id;\n $this->product_Id =$product_Id;\n $this->purchaseQuantitySold = $purchaseQuantitySold;\n $this->purchaseProdPrice=$purchaseProdPrice;\n $this->purchaseComments = $purchaseComments;\n $this->purchaseSubtotal = $purchaseSubtotal;\n $this->purchaseTaxes = $purchaseTaxes;\n $this->purchaseGrandtotal = $purchaseGrandtotal;\n }", "public function init() {\r\n //AUTHORIZATION CHECK\r\n if (!$this->_helper->requireAuth()->setAuthParams('sitestore_store', null, \"view\")->isValid())\r\n return;\r\n\r\n if (!$this->_helper->requireAuth()->setAuthParams('sitestoreproduct_product', null, \"view\")->isValid())\r\n return;\r\n\r\n $product_id = $this->_getParam('product_id');\r\n if (!empty($product_id)) {\r\n\r\n //AUTHORIZATION CHECK\r\n if (!$this->_helper->requireAuth()->setAuthParams('sitestore_store', null, \"view\")->isValid())\r\n return;\r\n\r\n if (!$this->_helper->requireAuth()->setAuthParams('sitestoreproduct_product', null, \"view\")->isValid())\r\n return;\r\n }\r\n\r\n $sitestoreproductWishlistView = Zend_Registry::isRegistered('sitestoreproductWishlistView') ? Zend_Registry::get('sitestoreproductWishlistView') : null;\r\n if (empty($sitestoreproductWishlistView))\r\n $this->_setParam('product_id', 0);\r\n\r\n //AUTHORIZATION CHECK\r\n if (!$this->_helper->requireAuth()->setAuthParams('sitestoreproduct_wishlist', null, \"view\")->isValid())\r\n return;\r\n }", "public function __construct()\n {\n add_filter('woocommerce_dev_product_data', array($this, 'filter_product_data'), 10, 2);\n\n // Add Custom Query Params\n add_filter('woocommerce_product_data_store_cpt_get_products_query', array($this, 'handle_custom_query_var'), 10, 2);\n\n // Clear Cache Product After Update\n if (self::$enable_cache) {\n add_action('woocommerce_update_product', array($this, 'remove_cache_after_update_product'), 10, 2);\n add_action('woocommerce_delete_product', array($this, 'remove_cache_after_delete_product'));\n add_action('woocommerce_delete_product_variation', array($this, 'remove_cache_after_delete_product'));\n }\n }", "public function init()\n\t{\n\t\t$this->dictionary = new Dictionary($this->iblockId);\n\t\t$this->storage = new Storage($this->iblockId);\n\t\tif (self::$catalog === null)\n\t\t{\n\t\t\tself::$catalog = \\Bitrix\\Main\\Loader::includeModule(\"catalog\");\n\t\t}\n\n\t\tif (self::$catalog)\n\t\t{\n\t\t\t$catalog = \\CCatalogSKU::getInfoByProductIBlock($this->iblockId);\n\t\t\tif (!empty($catalog) && is_array($catalog))\n\t\t\t{\n\t\t\t\t$this->skuIblockId = $catalog[\"IBLOCK_ID\"];\n\t\t\t\t$this->skuPropertyId = $catalog[\"SKU_PROPERTY_ID\"];\n\t\t\t}\n\t\t}\n\t}", "public function __construct() {\n\t\t\t\t\t$this->id = 'lalamove_rate_reg'; // Id for your shipping method. Should be uunique.\n\t\t\t\t\t$this->method_title = __( 'Shipping Price' ); // Title shown in admin\n\t\t\t\t\t$this->method_description = __( 'Price base on shipping adress and weight delivery via motorcycle.' ); // Description shown in admin\n \n\t\t\t\t\t$this->enabled = \"yes\"; // This can be added as an setting but for this example its forced enabled\n\t\t\t\t\t$this->title = \"LALAMOVE Rate\"; // This can be added as an setting but for this example its forced.\n \n\t\t\t\t\t$this->init();\n\t\t\t\t}", "public function __construct() \n\t{\n\t\t$strSqlModel = \n\t\t'SELECT cat.*, prd.* \n\t\tFROM \n\t\t(\n\t\t\t(\n\t\t\t\t(\n\t\t\t\t\t(\n\t\t\t\t\t\tproducts prd INNER JOIN categories cat ON (prd.prd_cat_id = cat.cat_id)\n\t\t\t\t\t) INNER JOIN prices pri ON (prd.prd_id = pri.pri_prd_id)\n\t\t\t\t) INNER JOIN countries cnt ON (pri.pri_cnt_id = cnt.cnt_id)\n\t\t\t) INNER JOIN currencies cur ON (cnt.cnt_cur_id = cur.cur_id)\n\t\t)\n\t\tINNER JOIN stocks stk ON (prd.prd_id = stk.stk_prd_id) \n\t\t'.CONF_TAG_LIST_SQL_CRITERIA.' \n\t\tGROUP BY prd.prd_id \n\t\tORDER BY cat.cat_id ASC, prd.prd_id ASC \n\t\t'.CONF_TAG_LIST_SQL_LIMIT.'';\n\t\t\n\t\t$intPageNbRow = CONF_LIST_PAGE_COUNT_ROW_PROD;\n\t\t\n\t\t$tabCritOperation = array();\n\t\t$tabCritOperation['cur_id'] = \"(cur.cur_id = \".CONF_TAG_LIST_SQL_OPE_VALUE.\")\";\n\t\t\n\t\tparent::__construct($strSqlModel, $tabCritOperation, $intPageNbRow);\n\t}", "public function __construct(){\r\n\t\t\trequire_once(\"conectar_bd.php\");\r\n\t\t\t$this->db=Conectar::conexion();\r\n\t\t\t$this->productos=array();\r\n\t\t}", "function __construct() \n\t{\n\t\tparent::__construct( 'rt_products', 'id', 'prd' );\n\t}", "public function __construct()\n {\n // $this->storeNumber = RequestFacade::segment(1);\n // $storeInfo = StoreInfo::getStoreInfoByStoreId($this->storeNumber);\n // $this->storeBanner = $storeInfo->banner_id;\n \n // $this->skin = Skin::getSkin($this->storeBanner);\n \n }", "public function set_discount_defaults()\r\n\t{\r\n\t\t// Set array placeholders.\r\n\t\tif (! isset($this->flexi->cart_contents['settings']['discounts']['codes']))\r\n\t\t{\r\n\t\t\t$this->flexi->cart_contents['settings']['discounts']['codes'] = array();\r\n\t\t}\r\n\t\tif (! isset($this->flexi->cart_contents['settings']['discounts']['manual']))\r\n\t\t{\r\n\t\t\t$this->flexi->cart_contents['settings']['discounts']['manual'] = array();\r\n\t\t}\t\r\n\t\r\n\t\t// Reset other discount data.\r\n\t\t$this->flexi->cart_contents['settings']['discounts']['active_items'] = array();\r\n\t\t$this->flexi->cart_contents['settings']['discounts']['active_summary'] = array();\r\n\t\t$this->flexi->cart_contents['settings']['discounts']['reward_vouchers'] = array();\r\n\t\t$this->flexi->cart_contents['settings']['discounts']['data']['item_discount_savings'] = 0;\r\n\t\t$this->flexi->cart_contents['settings']['discounts']['data']['summary_discount_savings'] = 0;\r\n\t\t$this->flexi->cart_contents['settings']['discounts']['data']['reward_vouchers'] = 0;\r\n\t\t$this->flexi->cart_contents['settings']['discounts']['data']['void_reward_point_items'] = array();\r\n\r\n\t\tif (! isset($this->flexi->cart_contents['settings']['discounts']['data']['excluded_discounts']))\r\n\t\t{\r\n\t\t\t$this->flexi->cart_contents['settings']['discounts']['data']['excluded_discounts'] = array();\r\n\t\t}\t\r\n\t\t\r\n\t\treturn TRUE;\r\n\t}", "public function __construct()\n {\n $this->profil = new ProfilModel();\n /* Catatan:\n Apa yang ada di dalam function construct ini nantinya bisa digunakan\n pada function di dalam class Product \n */\n }", "public function __construct()\n\t{\n\t\t/*if (!$measureCommodity)\n\t\t{\n\t\t\t$measureCommodity = CommodityFactory::build('FRN');\n\t\t}\n\n\t\t$this->measureCommodity = $measureCommodity;\n\t\t*/\n\t\t$this->measureCommodity = CommodityFactory::build('FRN');\n\t}", "public function __construct()\n {\n $this->_policyModel = new Datasource_Insurance_LegacyPolicies();\n $this->_enquiryModel = new Datasource_ReferencingLegacy_Enquiry();\n \n $this->_declinerenewalModel = new Datasource_Insurance_Policy_DeclineRenewal();\n $this->_declinerenewalquestionsModel = new Datasource_Insurance_Policy_DeclineRenewalQuestions();\n $this->_declinerenewalresponsesModel = new Datasource_Insurance_Policy_DeclineRenewalResponses();\n }", "function initialize($data)\n\t{\n\t\t$this->book_id = $data['txnid'];\n\t\t$this->pgi_amount = 1.00; //$data['pgi_amount'];\n\t\t$this->firstname = $data['firstname'];\n\t\t$this->email = $data['email'];\n\t\t$this->phone = $data['phone'];\n\t\tif(isset($data['txn_type']) && $data['txn_type'] == 'REFUND')\n\t\t{\n\t\t\t$this->txn_type = $data['txn_type'];\n\t\t\t$this->pg_txn_id = $data['pg_txnid'];\n\t\t\t$this->refund_amt = $data['refund_amt'];\n\t\t\t$this->m_refund_id = \"R-\".time(); //We generate this\n\t\t}\n\t\tif(isset($data['txn_type']) && $data['txn_type'] == 'INSTANT_RECHARGE')\n\t\t{\n\t\t\t$this->txn_type = $data['txn_type'];\n\t\t\t$this->payment_mode_only = $data[\"payment_mode_only\"];\n\t\t\t$this->payment_type_id = $data[\"payment_type_id\"];\n\t\t}\n\n\t\t/*We need to store product info value in session as Paytm does have param to send/receive this as request/response respectively.*/\n\t\t$GLOBALS[\"CI\"]->session->set_userdata(\"paytm_productinfo\", $data['productinfo']);\n\t}", "function tx_commercecoupons_lib(&$pObj){\r\n\t\t$this->init($pObj);\r\n\t}", "protected function init()\n {\n $this->totais = [\n 'liquidados' => 0,\n 'entradas' => 0,\n 'baixados' => 0,\n 'protestados' => 0,\n 'erros' => 0,\n 'alterados' => 0,\n ];\n }", "protected function calculateDiscount() : void{\r\n $percentage = ($this->discounted_value * 100) / $this->order->getTrueTotal();\r\n $new_total = $this->order->getTrueTotal() - $this->discounted_value;\r\n\r\n $this->order_discount_value = $this->discounted_value;\r\n $this->order_discount_percentage = $percentage;\r\n $this->order_discount_reason = \"For every \" . $this->products_nr . \" products from category #\" . $this->category_id . \" you get one free. You got: \";\r\n foreach($this->items_matching as $item){\r\n $this->order_discount_reason .= floor($item[\"qty\"] / $this->products_nr) . \" x '\" . $item[\"description\"] . \"' (€\". $item[\"price\"] .\" each) ; \";\r\n }\r\n $this->order_new_total = $new_total;\r\n }", "function pp_edd_auto_apply_discount() {\n\n\tif ( function_exists( 'edd_is_checkout' ) && edd_is_checkout() ) {\n\n\t\tif ( ! edd_cart_has_discounts() && edd_is_discount_valid( 'BFCM2016', '', false ) ) {\n\t\t\tedd_set_cart_discount( 'BFCM2016' );\n\t\t}\n\n\t}\n\n}", "public function __construct()\n {\n $this->pelanggan = new PelangganModel();\n /* Catatan:\n Apa yang ada di dalam function construct ini nantinya bisa digunakan\n pada function di dalam class Product \n */\n }", "protected function _construct()\n {\n \t$this->_isEnabled = Mage::getStoreConfig('ceesenco_maattabel/configuration/enabled');\n \t$this->_accountid = Mage::getStoreConfig('ceesenco_maattabel/configuration/accountid');\n \t$this->_width = Mage::getStoreConfig('ceesenco_maattabel/configuration/width');\n \t$this->_height = Mage::getStoreConfig('ceesenco_maattabel/configuration/height');\n \t$this->_label = Mage::getStoreConfig('ceesenco_maattabel/configuration/label');\n \t$this->_lang = Mage::getStoreConfig('ceesenco_maattabel/configuration/lang');\n\n \t$this->_categorie = Mage::getSingleton(\"eav/config\")->getAttribute(\"catalog_category\", 'maattabel_categorie')->getSource()->getOptionText(Mage::getSingleton('catalog/layer')->getCurrentCategory()->getData('maattabel_categorie'));\n \tif ($this->_categorie == \"\") {\n\t\t $current_product = Mage::registry('current_product');\n\t\t if(is_object($current_product))\n\t\t {\n\t\t $categories = $current_product->load($current_product->getId())->getCategoryIds();\n\t\t if (is_array($categories) and count($categories))\n\t\t {\n \t\t\t\t\t$this->_categorie = Mage::getSingleton(\"eav/config\")->getAttribute(\"catalog_category\", 'maattabel_categorie')->getSource()->getOptionText(Mage::getModel('catalog/category')->load($categories[count($categories)-1])->getData('maattabel_categorie'));\n\t\t }\n\t\t }\n \t}\n \t$temp = explode(\" - \", $this->_categorie);\n \t$this->_categorie = $temp[0];\n }", "public function __construct() {\n\t\t$this->model = new Model();\n\t\t$this->view = new View();\n\t\t$this->cart = array();\n\t\t$this->productArray = array();\n\t\t$this->productVar = array();\n\t\t\n\t}", "private function createInitialProducts()\n {\n $this->product = $this->createProduct();\n $this->product2 = $this->createProduct();\n\n $this->category = $this->createCategory();\n $this->product->addCategory($this->category);\n $this->product2->addCategory($this->category);\n }", "protected function init()\n {\n $this->totais = [\n 'liquidados' => 0,\n 'entradas' => 0,\n 'baixados' => 0,\n 'protestados' => 0,\n 'erros' => 0,\n 'alterados' => 0,\n ];\n }", "function applyDiscountOnSubscription($subscriptionId = null)\n {\n $db = new db();\n $db->makeConnection();\n\n if($subscriptionId != null)\n {\n \t\\Stripe\\Stripe::setApiKey(STRPIE_CLIENT_SECRET);\n\n $date = date('Y-m-d 00:00:00');\n $discountTotal = 0;\n\n // Select plan having trial periods on\n // $query = \"SELECT price FROM billing_products BP INNER JOIN user_subscription_items USI ON BP.plan_id = USI.plan_id WHERE BP.trial_period != 0 AND USI.subscription_id = '{$subscriptionId}' AND USI.coupon_trial_from <= '{$date}' AND USI.coupon_trial_to >= '{$date}'\";\n $query = \"SELECT price FROM billing_products BP INNER JOIN user_subscription_items USI ON BP.plan_id = USI.plan_id WHERE BP.trial_period != 0 AND USI.subscription_id = '{$subscriptionId}' AND USI.coupon_trial_from <= '{$date}' AND USI.coupon_trial_to > '{$date}' AND USI.status = '1'\";\n $res = $db->query($query);\n\n if($db->numRows($res))\n {\n while ($rs = mysqli_fetch_array($res))\n {\n $discountTotal += $rs['price'];\n }\n\n //\n if($discountTotal)\n {\n // Fetch if coupon exist, otherwise create\n $couponId = 'OFF-'.$discountTotal;\n\n try {\n // Retrieve coupon\n $coupon = \\Stripe\\Coupon::retrieve($couponId);\n } catch (\\Stripe\\Error\\Base $e) {\n // Create coupon\n $coupon = \\Stripe\\Coupon::create([\n 'id' => $couponId,\n 'amount_off' => ($discountTotal*100),\n 'currency' => 'SEK',\n 'duration' => 'once',\n // 'duration' => 'repeating',\n // 'duration_in_months' => 3,\n ]);\n }\n\n // Apply coupon on subscription\n if($coupon)\n {\n try {\n // Update subscription\n \\Stripe\\Subscription::update(\n $subscriptionId,\n ['coupon' => $coupon->id]\n );\n } catch (\\Stripe\\Error\\Base $e) {}\n }\n }\n else\n {\n \ttry {\n $sub = \\Stripe\\Subscription::retrieve($subscriptionId);\n\n if( isset($sub->discount) && ($sub->discount != null) )\n {\n $sub->deleteDiscount();\n }\n } catch (\\Stripe\\Error\\Base $e) {}\n }\n }\n else\n {\n \ttry {\n $sub = \\Stripe\\Subscription::retrieve($subscriptionId);\n\n if( isset($sub->discount) && ($sub->discount != null) )\n {\n $sub->deleteDiscount();\n }\n } catch (\\Stripe\\Error\\Base $e) {}\n }\n }\n }", "public function __construct()\n {\n $this->productList = new ProductList();\n }", "public function __construct($cost, $isbn)\n {\n //assigning the instance variables using constructor\n $this->price = $cost;\n $this->isbnNumber = $isbn;\n }", "public function __construct() {\n $this->pengguna = new MsPenggunaModel();\n /* Catatan:\n Apa yang ada di dalam function construct ini nantinya bisa digunakan\n pada function di dalam class Product \n */\n }", "public static function init(){\n self::items_needed_for_brands();\n self::brand_for_product_post_type_metabox();\n }", "public function __construct()\n\t{\n\t\t$this->product = new Product();\n\t\t$this->validate = new Validate();\n\t}", "public function __construct()\n {\n parent::__construct();\n // check if user has products capability\n if(User::userCan('products') === false)\n {\n abort(403, 'Unauthorized action.');\n }\n $this->product \t\t= new Products;\n $this->category \t= new Categories;\n $this->att \t = new ProductAttributes;\n }", "public function __construct(Product $product) {\n $this->product = $product;\n }", "public static function ppInit()\n\t{\n\t\tself::$definition['fields'] = array_merge(self::$definition['fields'], array(\n\t\t\t'minimal_quantity' => array('type' => self::TYPE_INT, 'shop' => true, 'validate' => 'validateProductQuantity'), \t\t\t'minimal_quantity_fractional' => array('type' => self::TYPE_FLOAT, 'shop' => true, 'validate' => 'isUnsignedFloat')\n\t\t));\n\t}", "public function __construct() {\n\t\t$this->session = new WC_Cart_Session( $this );\n\t\t$this->fees_api = new WC_Cart_Fees( $this );\n\t\t$this->tax_display_cart = get_option( 'woocommerce_tax_display_cart' );\n\n\t\t// Register hooks for the objects.\n\t\t$this->session->init();\n\n\t\tadd_action( 'woocommerce_add_to_cart', array( $this, 'calculate_totals' ), 20, 0 );\n\t\tadd_action( 'woocommerce_applied_coupon', array( $this, 'calculate_totals' ), 20, 0 );\n\t\tadd_action( 'woocommerce_cart_item_removed', array( $this, 'calculate_totals' ), 20, 0 );\n\t\tadd_action( 'woocommerce_cart_item_restored', array( $this, 'calculate_totals' ), 20, 0 );\n\t\tadd_action( 'woocommerce_check_cart_items', array( $this, 'check_cart_items' ), 1 );\n\t\tadd_action( 'woocommerce_check_cart_items', array( $this, 'check_cart_coupons' ), 1 );\n\t\tadd_action( 'woocommerce_after_checkout_validation', array( $this, 'check_customer_coupons' ), 1 );\n\t}", "public function __construct(Product $product,\n ProductCategory $productCategory,\n Appearance $appearance,\n Orders $order,\n Deals $deal,\n ProductDeals $productDeals,\n OrderDetail $orderDetail)\n {\n $this->product = $product;\n $this->productCategory = $productCategory;\n $this->appearance = $appearance;\n $this->order = $order;\n $this->orderDetail = $orderDetail;\n $this->deal = $deal;\n $this->productDeals = $productDeals;\n }", "protected function calculatePrices()\n {\n }", "public function __construct()\n {\n // Dependencies automatically resolved by service container...\n $user = \\Auth::user();\n $store = $user->StoreDetails;\n $orders = orders::where(['store_id'=>$store->id])->count();\n $requestCount = ProductRequest::where(['store_id'=>$store->id])->where(['status'=>1])->count();\n $ratingCount = Ratings::where(['store_id'=>$store->id])->count();\n $this->counters = [\n 'orders'=>$orders,\n 'requestCount'=>$requestCount,\n 'ratingCount'=>$ratingCount,\n ];\n }", "public function __construct()\n {\n $this->wrapper = 'col-md-3 col-sm-6 ';\n $this->link = 'chi-tiet-sp.php';\n $this->shop_item = array(\n 'img1',\n 'img1',\n 'img1',\n 'img1',\n 'img1',\n 'img1',\n 'img1',\n 'img1',\n );\n\n }", "public function __construct($product_item)\n {\n $this->product_item = $product_item;\n }", "public function init()\n {\n\n // initialize the prepared statements\n $this->addFinder($this->finderFactory->createFinder($this, SqlStatementKeys::PRODUCT_MEDIA_GALLERIES));\n $this->addFinder($this->finderFactory->createFinder($this, SqlStatementKeys::PRODUCT_MEDIA_GALLERY));\n $this->addFinder($this->finderFactory->createFinder($this, SqlStatementKeys::PRODUCT_MEDIA_GALLERIES_BY_SKU));\n }", "function init() {\r\n\t\t$this->instance_form_fields = include( 'settings/settings-custom-shipping.php' );\r\n\t\t$this->title = $this->get_option( 'title' );\r\n\t\t$this->express_title\t\t\t\t\t\t=\t$this->get_option( 'express_title' );\r\n\t\t$this->conditional_cost\t\t\t\t\t= $this->get_option( 'conditional_cost' );\r\n\t\t$this->express_delivery_status\t= $this->get_option( 'express_delivery_status' );\r\n\t\t$this->express_delivery_price\t\t= $this->get_option( 'express_delivery_price' );\r\n\r\n\t\t$weight_steps_arr = explode( ', ', $this->weight_steps );\r\n\r\n\t\tforeach ( $weight_steps_arr as $weight_step ) {\r\n\t\t\t$this->{'price_below_'.\"{$weight_step}\".'_kg'} = $this->get_option( 'price_below_'.$weight_step.'_kg', 0 );\r\n\r\n\t\t\t$this->weight_based_cost[$weight_step] = $this->get_option( 'price_below_'.$weight_step.'_kg', 0 );\r\n\t\t}\r\n\t}", "public function __construct(){\n $this->productos = new Producto();\n }", "public function __construct() {\n\t\tparent::__construct();\n\t\t$this->dados = $this->funcoes_gerais->getConstantes($this->dados);\n\n $this->load->model('produto_model', 'produto'); \n $this->load->model('categoria_model', 'categoria'); \n\t}", "private function initPromoItem()\n {\n $this->promoItem = $this->createPartialMock(\n \\Amasty\\Promo\\Model\\ItemRegistry\\PromoItemData::class,\n []\n );\n $this->promoItem->setSku('test_sku')->setRuleId(1);\n }", "private function __construct() {\n\n\t\t// Load plugin text domain\n\t\tadd_action( 'init', array( $this, 'load_plugin_textdomain' ) );\n\t\t\n\n\t\t// Checks if WC Vendors Pro is installed \n\t\tif ( class_exists( 'WCVendors_Pro' ) ) {\n\n\t\t\t// Checks that Simple Auctions is active \n\t\t\tif ( class_exists( 'WooCommerce_simple_auction' ) ){ \n\n\t\t\t\tadd_action( 'wcv_save_product_meta', array( $this, 'auctions_meta_save' ) ); \n\t\t\t\tadd_filter( 'wcv_product_type_selector', array( $this, 'auction_product_type' ) ); \n\t\t\t\tadd_filter( 'wcv_product_meta_tabs', array( $this, 'auction_meta_tab' ) );\n\t\t\t\tadd_action( 'wcv_after_shipping_tab', array( $this, 'auctions_form' ) ); \n\t\t\t\tadd_filter( 'wcv_product_table_rows', array( $this, 'product_rows' ) ); \n\n\t\t\t} else { \n\t\t\t\tadd_action( 'admin_notices', array( $this, 'simple_auctions_missing_notice' ) );\n\t\t\t}\n\n\t\t\t\n\t\t} else {\n\n\t\t\tadd_action( 'admin_notices', array( $this, 'wcvendors_pro_missing_notice' ) );\n\t\t}\n\n\t}", "public function __construct(Product $product)\n {\n $this->product = $product;\n }", "public function __construct(Product $product)\n {\n $this->product = $product;\n }", "public function __construct(Product $product)\n {\n $this->product = $product;\n }", "public static function init(){\n\t\t$instance = self::get_instance();\n\t\tadd_filter( 'acf/save_post', array($instance,'manualCreation') );\n\t\tadd_filter( 'acf/update_value/name=order_products', array($instance,'datesChanged'), 9999, 3 );\n\n\t\t//add_filter('fwpr/payment/order-data', array($instance,'orderData'), 10, 1);\n\t}", "public function __construct()\n\n {\n parent::__construct();\n\n $this->tablename=\"produit\";\n $this->idp = 'null' ;\n $this->idc = 0 ;\n $this->id_cat = 0 ;\n $this->desi = \"\" ;\n $this->photo = \"\" ;\n $this->prixa = 0 ;\n $this->prixv = 0 ;\n $this->qnt = 0 ;\n $this->composer = 0 ;\n $this->ftech = \"\" ;\n $this->flag = 0 ;\n }", "function __construct() {\r\n\t\t$this->production_total = \"0\";\r\n\t\t$this->id_state = 1;\r\n\t}", "public function initialize()\n {\n $this->setSchema(\"atiempo_prod\");\n $this->hasMany('id', 'AcCartaAvalDetalle', 'id_carta', ['alias' => 'AcCartaAvalDetalle']);\n }" ]
[ "0.67394286", "0.6541406", "0.6430667", "0.6289182", "0.6272508", "0.61671406", "0.61211604", "0.6087672", "0.6069683", "0.60665345", "0.6025382", "0.6021449", "0.6012524", "0.5970208", "0.59439516", "0.59254545", "0.59131736", "0.59022164", "0.58996004", "0.58980376", "0.5883999", "0.58772993", "0.58713484", "0.5862472", "0.58555585", "0.5850767", "0.5842441", "0.58380723", "0.5830393", "0.5798085", "0.5797619", "0.578663", "0.5786461", "0.5779349", "0.57712674", "0.57698894", "0.5760297", "0.57574874", "0.57456875", "0.56978285", "0.5681433", "0.56814283", "0.5678091", "0.5676354", "0.567339", "0.5670295", "0.56689876", "0.56449556", "0.56352025", "0.56295615", "0.56195384", "0.5612544", "0.5611168", "0.56103086", "0.5602165", "0.56020606", "0.55986357", "0.5582389", "0.55667496", "0.5565428", "0.55562097", "0.5554641", "0.5553924", "0.5537812", "0.55328906", "0.55308837", "0.55250585", "0.55217904", "0.5516522", "0.5515574", "0.55144066", "0.55102044", "0.5507912", "0.55039716", "0.55023223", "0.5493451", "0.5483059", "0.54801995", "0.5476759", "0.5461613", "0.5452263", "0.5452062", "0.5449279", "0.5447329", "0.54419595", "0.5440372", "0.5439158", "0.5436164", "0.5426225", "0.54096687", "0.54068893", "0.54066104", "0.54010767", "0.5397631", "0.5397631", "0.5397631", "0.5396499", "0.5395294", "0.539285", "0.5391847" ]
0.58666885
23
Limit available discount value
private static function limitAvailableDiscountValue($rule, $item) { // Ограничение скидки для товара if (!empty($rule['limit']['status']) && !empty($rule['limit']['value']) && $rule['limit']['value'] >= 0) { $limit = $rule['limit']; // Собираем минимальное значение цены товара $product_price_minimum = 0; switch ($limit['price1']) { case "purchase": $product_price_minimum += $item['purchase_price']; break; case "compare_price": $product_price_minimum += $item['compare_price']; break; } if ($limit['currency'] == '%') { $price2 = 0; switch ($limit['price2']) { case "purchase": $price2 += $item['purchase_price']; break; case "price": $price2 += $item['price']; break; case "compare_price": $price2 += $item['compare_price']; break; } $product_price_minimum += max(0.0, min(100.0, (float) $limit['value'])) * $price2 / 100; } else { $product_price_minimum += (float) shop_currency((float) $limit['value'], $limit['currency'], self::getOrderInfo('currency'), false); } // Если товар участвовал в скидках if (!empty(self::$available_products[$item['sku_id']][$rule['id']])) { // Размер скидки для одной единицы товара $product_discount = self::$available_products[$item['sku_id']][$rule['id']]['discount'] / self::$available_products[$item['sku_id']][$rule['id']]['quantity']; // Если размер скидки для товара больше, чем установлено ограничением if ($item['price'] - $product_discount < $product_price_minimum) { // Меняем скидку для товара self::$available_products[$item['sku_id']][$rule['id']]['discount'] = shopFlexdiscountHelper::round($item['price'] - $product_price_minimum) * self::$available_products[$item['sku_id']][$rule['id']]['quantity']; // Если скидка товара ниже 0, это означает, что минимальная цена товара получилась выше самой цены товара. // Удаляем товар из массива скидок if (self::$available_products[$item['sku_id']][$rule['id']]['discount'] <= 0) { unset(self::$available_products[$item['sku_id']][$rule['id']]); } } } } // Максимальное значение бонусов для товара $maximum_product_affiliate = (isset($rule['maximum_product_affiliate']) && $rule['maximum_product_affiliate'] !== '') ? shopFlexdiscountHelper::floatVal($rule['maximum_product_affiliate']) : null; if ($maximum_product_affiliate !== null && !empty(self::$available_products[$item['sku_id']][$rule['id']])) { // Размер бонусов для одной единицы товара $product_affiliate = self::$available_products[$item['sku_id']][$rule['id']]['affiliate'] / self::$available_products[$item['sku_id']][$rule['id']]['quantity']; // Если размер бонусов для товара больше, чем установлено ограничением if ($product_affiliate > $maximum_product_affiliate) { // Меняем бонусы для товара self::$available_products[$item['sku_id']][$rule['id']]['affiliate'] = $maximum_product_affiliate * self::$available_products[$item['sku_id']][$rule['id']]['quantity']; } } }
{ "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 }", "function apply_special_item_discount($id, $count, &$disc_amount) {\r\n switch($id) {\r\n case 99999:\r\n case 99998:\r\n if ($count > 100) {\r\n $disc_amount = 50; \r\n }\r\n break; \r\n case 99997:\r\n $disc_amount = 75;\r\n break; \r\n }\r\n }", "public function AssignDiscount()\n\t{\t\n\t}", "public function setDiscount(int $discount): void\n {\n $this->discount = ($discount > 0 && $discount <= 50) ? $discount : 0;\n\n }", "function apply_special_category_discount($category, $count, &$disc_amount) {\r\n switch($category) {\r\n case 99999:\r\n case 99998:\r\n if ($count > 100) {\r\n $disc_amount = 50; \r\n }\r\n break; \r\n case 99997:\r\n $disc_amount = 75;\r\n break;\r\n }\r\n }", "public function getDiscountAmount();", "function getDiscountFor($product) {\n\t\treturn 30;\n\t}", "function _apply_auto_disc()\n\t{\n\t\t$num_items = $this->cart->total_items();\n\t\t$auto_disc_info = null;\n\n\t\tforeach ($this->auto_disc_array as $cart_items => $disc_info)\n\t\t{\n\t\t\tif($num_items >= $cart_items)\n\t\t\t{\n\t\t\t\t$auto_disc_info = $disc_info;\n\t\t\t}\n\t\t}\n\n\t\t$applied_disc = $this->cart->discount_info();\n\n\t\t//auto discount should be more than the applied disc (if any)\n\t\tif($applied_disc['percentage'] < $auto_disc_info['percentage'])\n\t\t{\n\t\t\t$this->_apply_discount( $auto_disc_info['coupon'] );\n\t\t}\t\t\n\t}", "public function setDiscountAmount($value){\n return $this->setParameter('discount_amount', $value);\n }", "function fuc_discount($product, $percentage){\r\n $discountValue = $product / 100 * $percentage;\r\n $totalValue = $product - $discountValue; \r\n return $totalValue;\r\n\r\n}", "public function getDiscountInvoiced();", "function course_discounted_amount($price, $coupon)\n{\n $return_val = $price;\n if (!empty($coupon)) {\n $coupon_details = CourseCoupon::where('code', $coupon)->first();\n if (!empty($coupon_details)) {\n if ($coupon_details->discount_type === 'percentage') {\n $discount_bal = ($price / 100) * (int)$coupon_details->discount;\n $return_val = $price - $discount_bal;\n } elseif ($coupon_details->discount_type === 'amount') {\n $return_val = $price - (int)$coupon_details->discount;\n }\n }\n }\n\n return $return_val;\n}", "public function hasDiscountmax(){\n return $this->_has(33);\n }", "public function getDiscount(): int\n {\n return $this->discount;\n }", "public function getTotalDiscount(): float;", "public function getTotalDiscountAmount();", "public function getDiscountCanceled();", "public function getTonicDiscount()\n {\n }", "function calc_extra_sp_cost($Discount = 1){\r\n\t$list = array('D','E','A');\r\n\tforeach($list as $v){\r\n\t\tif(preg_match('/CostSP<([0-9]+)>/',$this->Eq[$v]['spec'],$array)){\r\n\t\t\t$a = intval($array[1]);\r\n\t\t\t$this->SP_Cost += ceil($a * $Discount);\r\n\t\t}\r\n\t}\r\n}", "public function getDiscountPriceAttribute(){\n\n if (!empty($this->discount)) {\n\n if ($this->discount->type == 'percentage') {\n $discount = ($this->price * $this->discount->discount) / 100;\n\n return round($this->price - $discount, 2);\n\n }else {\n\n return round($this->price - $this->discount->discount, 2);\n\n }\n\n }\n }", "public function discountOrChargeValueBoleta()\n {\n if($this->discount_or_charge_value > 0)\n return $this->discount_or_charge_value;\n else if ($this->discount_or_charge_percentage > 0)\n return (int) round( ($this->discount_or_charge_percentage / 100) * ($this->price * $this->quantity));\n else //pos sale without discount\n return 0;\n }", "public function getDiscount()\r\n {\r\n return $this->discount;\r\n }", "public function setDiscount(int $discount): self\n {\n $this->discount = $discount;\n return $this;\n }", "public function getBaseDiscountAmount();", "protected function calculateDiscount() : void{\r\n $percentage = ($this->discounted_value * 100) / $this->order->getTrueTotal();\r\n $new_total = $this->order->getTrueTotal() - $this->discounted_value;\r\n\r\n $this->order_discount_value = $this->discounted_value;\r\n $this->order_discount_percentage = $percentage;\r\n $this->order_discount_reason = \"For every \" . $this->products_nr . \" products from category #\" . $this->category_id . \" you get one free. You got: \";\r\n foreach($this->items_matching as $item){\r\n $this->order_discount_reason .= floor($item[\"qty\"] / $this->products_nr) . \" x '\" . $item[\"description\"] . \"' (€\". $item[\"price\"] .\" each) ; \";\r\n }\r\n $this->order_new_total = $new_total;\r\n }", "public function getDiscountAmount(){\n return $this->getParameter('discount_amount');\n }", "public function getDiscount()\n {\n return $this->discount;\n }", "public function getDiscount()\n {\n return $this->discount;\n }", "public function getDiscount()\n {\n return $this->discount;\n }", "public function getDiscount()\n {\n return $this->discount;\n }", "public function getDiscount()\n {\n return $this->discount;\n }", "public function getDiscount()\n {\n return $this->discount;\n }", "public function setDiscountRate($value){\n return $this->setParameter('discount_rate', $value);\n }", "public function getDiscount()\n\t{\n\t\treturn $this->getKeyValue('Discount'); \n\n\t}", "function getDiscountedPrice()\n {\n if (!$this->hasDiscount()) return null;\n $price = $this->price;\n if ($this->discount_active) {\n $price = $this->discountprice;\n }\n// NOTE: Add more conditions and rules as desired, i.e.\n// if ($this->testFlag('Outlet')) {\n// $discountRate = $this->getOutletDiscountRate();\n// $price = number_format(\n// $price * (100 - $discountRate) / 100,\n// 2, '.', '');\n// }\n return $price;\n }", "function calculatePrice($price, $discount){\n\t$DollarsOFF = $price * ($discount/100);\n\t$finalPrice = $price - $DollarsOFF;\n\treturn $finalPrice;\n}", "public function setDiscountAttribute($val)\n {\n return (int)$this->attributes['discount'] = $val;\n }", "public function applyGlobalDiscount($discount_rate)\n {\n }", "public function getDiscountRefunded();", "public function getDiscountRate(){\n return $this->getParameter('discount_rate');\n }", "public function get_limit();", "public function getBaseDiscountCanceled();", "function customerDiscount()\r\n\t{\r\n\t\t$sql = $GLOBALS['db']->Query(\"SELECT Wert FROM \" . PREFIX . \"_modul_shop_kundenrabatte WHERE GruppenId = '\".UGROUP.\"' LIMIT 1\");\r\n\t\t$row = $sql->fetchrow();\r\n\t\t$sql->close();\r\n\t\tif(is_object($row))\r\n\t\t\treturn $row->Wert;\r\n\t}", "public function getPriceDiscount()\n\t{\n\t\treturn $this->priceDiscount;\n\t}", "public function setDiscount(?float $discount): self\n {\n $this->initialized['discount'] = true;\n $this->discount = $discount;\n\n return $this;\n }", "public function setMaxPrice($maxPrice);", "private function discountOrChargePercetageBoleta()\n {\n if($this->discount_or_charge_percentage > 0)\n return $this->discount_or_charge_percentage;\n else if ($this->discount_or_charge_value > 0)\n return round(\n $this->discount_or_charge_value * 100 /\n ($this->price * $this->quantity)\n , 2); // 2 => decimal precition\n else //pos sale without discount\n return 0;\n }", "public function getBaseDiscountInvoiced();", "public function limit() : float;", "private function calcDiscountPercent()\n\t{\n\t if( $this->db->table_exists($this->c_table)) $record = $this->db->query(\"select * from {$this->c_table} where products_count<=? and order_amount<=? order by discount_percent desc\",array($this->products_count,$this->order_amount))->row_array();\n\t if(!@$record) return 0;\n\t return $record['discount_percent'];\n\t}", "public function setDiscountAmount($amount);", "function pp_edd_auto_apply_discount() {\n\n\tif ( function_exists( 'edd_is_checkout' ) && edd_is_checkout() ) {\n\n\t\tif ( ! edd_cart_has_discounts() && edd_is_discount_valid( 'BFCM2016', '', false ) ) {\n\t\t\tedd_set_cart_discount( 'BFCM2016' );\n\t\t}\n\n\t}\n\n}", "public function applyDiscount()\n {\n if (request('discountType') == 1) {\n cart()->applyDiscount($percentage = request('red'));\n return $this->getCartDetails();\n }\n cart()->applyFlatDiscount($amount = request('discountInput'));\n\n return redirect()->route('cart');\n }", "public function calculateDiscount(): ?float;", "public function getShippingDiscountAmount();", "private function updateProductDiscount(\n ProductInterface $product,\n Request $request\n ): void {\n $discountPercent = $request->request->get('discount_percent') !== '' ? (float) $request->request->get('discount_percent') : null;\n $discountLimitType = $request->request->get('discount_limit_type') !== '' ? $request->request->get('discount_limit_type') : null;\n $discountFromDate = $request->request->get('discount_from_date') !== '' ? $request->request->get('discount_from_date') : null;\n $discountToDate = $request->request->get('discount_to_date') !== '' ? $request->request->get('discount_to_date') : null;\n\n $variants = $product->getVariants();\n foreach ($variants as $variant) {\n // Variant to change\n $variantPricing = $variant->getChannelPricings()->first();\n\n // Change percent\n if ($discountPercent !== null) {\n $variantPricing->setDiscount($discountPercent / 100);\n }\n\n // Continue if no change type\n if ($discountLimitType === self::LIMIT_NO_CHANGE) {\n continue;\n }\n // Discount type\n $variantPricing->setDiscountLimitType($discountLimitType === self::LIMIT_NONE ? null : $discountLimitType);\n\n // Date type discount\n if ($discountLimitType === self::LIMIT_DATETIME) {\n if ($discountFromDate && $discountToDate) {\n $dateFrom = \\DateTime::createFromFormat('Y-m-d', $discountFromDate);\n $dateTo = \\DateTime::createFromFormat('Y-m-d', $discountToDate);\n\n $variantPricing->setDiscountFrom($dateFrom);\n $variantPricing->setDiscountTo($dateTo);\n }\n\n if ($discountFromDate && !$discountToDate) {\n $dateFrom = \\DateTime::createFromFormat('Y-m-d', $discountFromDate);\n\n $variantPricing->setDiscountFrom($dateFrom);\n $variantPricing->setDiscountTo(null);\n }\n\n if (!$discountFromDate && $discountToDate) {\n $dateTo = \\DateTime::createFromFormat('Y-m-d', $discountToDate);\n\n $variantPricing->setDiscountFrom(null);\n $variantPricing->setDiscountTo($dateTo);\n }\n }\n }\n }", "function apply_15_percent_coupon() {\n\t\tglobal $woocommerce;\n\n\t\t$coupon_code = '15percent'; // your coupon code here\n\t\tif ( $_POST['coupon_code'] != '' ) {\n\t\t\t$woocommerce->cart->remove_coupon( $coupon_code );\n\n\t\t\treturn;\n\t\t}\n\t\tif ( $woocommerce->cart->has_discount( $coupon_code ) ) {\n\t\t\treturn;\n\t\t}\n\t\tif ( count( $woocommerce->cart->get_applied_coupons() ) == 0 ) {\n\t\t\t$woocommerce->cart->add_discount( $coupon_code );\n\t\t}\n\t}", "function getPriceWithDiscount($price)\n {\n if($price<1000) {\n return ($price*0.90);\n }\n else {\n return ($price*0.95);\n }\n }", "public function setDiscount($discount)\r\n {\r\n $this->discount = $discount;\r\n\r\n return $this;\r\n }", "function get_discount($total_qty){\r\n\t\tif($total_qty>35){\r\n\t\t\t$order_discount = 3;\r\n\t\t}else{\r\n\t\t\t$order_discount = 0;\r\n\t\t}\r\n\t\t$_SESSION[\"order_discount\"] = $order_discount;\r\n\t\treturn $order_discount;\r\n\t}", "public function getDiscountDescription();", "function get_discount($total = 0)\n{\n global $config, $db_prefix, $sql_today, $current_user_id;\n\n $discount = array('self_gift_code' => '', 'gift_code' => '', 'gift_flat' => 0, 'gift_pct' => 0);\n $gift_discount = false;\n\n // get gift\n $gift = sql_qquery(\"SELECT * FROM \".$db_prefix.\"gift WHERE redeem_user_id='$current_user_id' AND redeem_order_id='' AND valid_date >= '$sql_today' LIMIT 1\");\n if (!empty($gift) && ($total >= $gift['min_purchase'])) {\n $gift_discount = true;\n $g = explode('.', $gift['gift_code']);\n $discount['self_gift_code'] = $gift['gift_code'];\n $discount['gift_code'] = $gift['gift_code'] = $g[0];\n if ($gift['gift_pct']) {\n $discount['gift_pct'] = $gift['gift_value'];\n } else {\n $discount['gift_flat'] = $gift['gift_value'];\n }\n }\n\n return $discount;\n}", "public function getRemainingAttribute()\n {\n return $this->basePrice*(100-$this->discount)/100.0 - $this->deposit;\n }", "public function getTotaldiscount()\n {\n return $this->totaldiscount;\n }", "public function getDiscount(): ?float\n {\n return $this->discount;\n }", "public function hasDiscount(){\n return $this->_has(9);\n }", "function discount_rate($discount_rate=null)\n {\n if (isset($discount_rate)) $this->discount_rate = $discount_rate;\n return $this->discount_rate;\n }", "public function smanjiCenu(){\n if($this->getGodiste() < 2010){\n $discount=$this->cenapolovnogauta*0.7;\n return $this->cenapolovnogauta=$discount;\n }\n return $this->cenapolovnogauta; \n }", "public function getMaxPrice();", "public function moreDiscount($quantity)\n\t{\n\t\tif ($quantity == 1) {\n\t\t\treturn 10;\n \t}\n\t\tif ($quantity == 2) {\n\t\t\treturn 20;\n\t\t}\n\t\tif ($quantity == 3) {\n\t\t\treturn 30;\n\t\t}\n\t\tif ($quantity >= 4 && $quantity < 10) {\n\t\t\treturn 40;\n\t\t}\n\t\tif ($quantity >= 10) {\n\t\t\treturn 50;\n\t\t}\n\t\treturn false;\n\t}", "function getLimit() ;", "public function deleteDiscount();", "public function getDiscountAmountAttribute()\n\t{\n\t\treturn max($this->price - $this->sale_price, 0);\n\t}", "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 getBaseShippingDiscountAmount();", "public function getItemDiscountAmount()\n {\n return $this->itemDiscountAmount;\n }", "public function getLimit();", "public function getLimit();", "public function getLimit();", "public function getLimit();", "public function getLimit();", "public function discountBifurcation(Varien_Event_Observer $observer)\n {\n $rule = $observer->getEvent()->getRule();\n $result = $observer->getEvent()->getResult();\n $itemId = $observer->getEvent()->getItem()->getItemId();\n //set Unique key\n $curUnique= $rule->getRuleId().'_'.$itemId;\n //check if Mage registry unique call set\n if(Mage::registry('uniqueCall')!==null){\n //if check in array\n $uniqueCalls = Mage::registry('uniqueCall');\n if( in_array($curUnique,$uniqueCalls)){\n return;\n }else{\n //unset existing registry. also take existing array in variable\n Mage::unregister('uniqueCall');\n $uniqueCalls[]= $curUnique ;\n //set registry again with new array include $uniqueCall into it\n Mage::register('uniqueCall',$uniqueCalls);\n }\n }else{\n //set registry again with new array include $uniqueCall into it\n $array = array();\n $array[]=$rule->getRuleId().'_'.$itemId;\n Mage::register('uniqueCall',$array);\n\n } \n\n //condition for the Promotional coupons\n if ( $rule->getCouponType() == Mage_SalesRule_Model_Rule::COUPON_TYPE_NO_COUPON ) {\n $promotionDiscount = 0;\n $promotionDiscount = Mage::registry('promotion');\n if (Mage::registry('promotion')!==null){\n Mage::unregister('promotion');\n }\n if (Mage::registry('promo_lable')!==null){\n Mage::unregister('promo_lable');\n }\n $promotionDiscount += $result->getDiscountAmount();\n Mage::register('promotion', $promotionDiscount);\n Mage::register('promo_lable',$rule->getName());\n } elseif ( $rule->getCouponType() == self::COUPON_TYPE_FUE_GENERATED ) {\n $couponDiscount = 0;\n $couponDiscount = Mage::registry('coupon');\n if(Mage::registry('coupon')!==null){\n Mage::unregister('coupon');\n }\n //sum up all the values of discounted coupons\n $couponDiscount += $result->getDiscountAmount();\n Mage::register('coupon',$couponDiscount);\n }\n $quote = $observer->getEvent()->getQuote();\n $quoteAddress = $observer->getEvent()->getAddress();\n //set discounted coupons and promotional coupons amount in quote\n $quote->setCouponDiscount(Mage::registry('coupon'));\n $quote->setPromotionalDiscount(Mage::registry('promotion'));\n\n if (Mage::getStoreConfig('promodiscount/promodiscount/use_default')) {\n $quote->setPromoLable(Mage::getStoreConfig('promodiscount/promodiscount/default_lable'));\n } else {\n if (Mage::registry('promo_lable')) {\n $quote->setPromoLable(Mage::registry('promo_lable'));\n } else {\n $quote->setPromoLable(Mage::getStoreConfig('promodiscount/promodiscount/default_lable'));\n }\n }\n \n $quoteAddress->setCouponDiscount(Mage::registry('coupon'));\n $quoteAddress->setPromotionalDiscount(Mage::registry('promotion'));\n if (Mage::registry('promo_lable')) {\n $quoteAddress->setPromoLable(Mage::registry('promo_lable'));\n } else {\n $quoteAddress->setPromoLable(Mage::getStoreConfig('promodiscount/promodiscount/default_lable'));\n }\n }", "public function checkCreditLimit() {\n \n Mage::getModel('storesms/apiClient')->checkCreditLimit(); \n \n }", "function discount_amount($discount_amount=null)\n {\n if (isset($discount_amount)) $this->discount_amount = $discount_amount;\n return $this->discount_amount;\n }", "public function setDiscount(string $discount)\n\t{\n\t\t$this->addKeyValue('Discount', $discount); \n\n\t}", "function get_discounted_price( $values, $price, $add_totals = false ) {\n\t\n\t\t\tif ($this->applied_coupons) foreach ($this->applied_coupons as $code) :\n\t\t\t\t$coupon = new cmdeals_coupon( $code );\n\t\t\t\t\n\t\t\t\tif ( $coupon->apply_before_tax() && $coupon->is_valid() ) :\n\t\t\t\t\t\n\t\t\t\t\tswitch ($coupon->type) :\n\t\t\t\t\t\n\t\t\t\t\t\tcase \"fixed_deals\" :\n\t\t\t\t\t\tcase \"percent_deals\" :\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t$this_item_is_discounted = false;\n\t\t\t\t\n\t\t\t\t\t\t\t// Specific deals ID's get the discount\n\t\t\t\t\t\t\tif (sizeof($coupon->deal_ids)>0) :\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tif ((in_array($values['deal_id'], $coupon->deal_ids) || in_array($values['variation_id'], $coupon->deal_ids))) :\n\t\t\t\t\t\t\t\t\t$this_item_is_discounted = true;\n\t\t\t\t\t\t\t\tendif;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\telse :\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t// No deals ids - all items discounted\n\t\t\t\t\t\t\t\t$this_item_is_discounted = true;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tendif;\n\t\t\t\t\n\t\t\t\t\t\t\t// Specific deals ID's excluded from the discount\n\t\t\t\t\t\t\tif (sizeof($coupon->exclude_deals_ids)>0) :\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tif ((in_array($values['deal_id'], $coupon->exclude_deals_ids) || in_array($values['variation_id'], $coupon->exclude_deals_ids))) :\n\t\t\t\t\t\t\t\t\t$this_item_is_discounted = false;\n\t\t\t\t\t\t\t\tendif;\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tendif;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Apply filter\n\t\t\t\t\t\t\t$this_item_is_discounted = apply_filters( 'cmdeals_item_is_discounted', $this_item_is_discounted, $values, $before_tax = true );\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Apply the discount\n\t\t\t\t\t\t\tif ($this_item_is_discounted) :\n\t\t\t\t\t\t\t\tif ($coupon->type=='fixed_deals') :\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tif ($price < $coupon->amount) :\n\t\t\t\t\t\t\t\t\t\t$discount_amount = $price;\n\t\t\t\t\t\t\t\t\telse :\n\t\t\t\t\t\t\t\t\t\t$discount_amount = $coupon->amount;\n\t\t\t\t\t\t\t\t\tendif;\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t$price = $price - $coupon->amount;\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tif ($price<0) $price = 0;\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tif ($add_totals) :\n\t\t\t\t\t\t\t\t\t\t$this->discount_cart = $this->discount_cart + ( $discount_amount * $values['quantity'] );\n\t\t\t\t\t\t\t\t\tendif;\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\telseif ($coupon->type=='percent_deals') :\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t$percent_discount = ( $values['data']->get_price( false ) / 100 ) * $coupon->amount;\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tif ($add_totals) $this->discount_cart = $this->discount_cart + ( $percent_discount * $values['quantity'] );\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t$price = $price - $percent_discount;\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tendif;\n\t\t\t\t\t\t\tendif;\n\t\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\n\t\t\t\t\t\tcase \"fixed_cart\" :\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t/** \n\t\t\t\t\t\t\t * This is the most complex discount - we need to divide the discount between rows based on their price in\n\t\t\t\t\t\t\t * proportion to the subtotal. This is so rows with different tax rates get a fair discount, and so rows\n\t\t\t\t\t\t\t * with no price (free) don't get discount too.\n\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Get item discount by dividing item cost by subtotal to get a %\n\t\t\t\t\t\t\t$discount_percent = ($values['data']->get_price( false )*$values['quantity']) / $this->subtotal_ex_tax;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Use pence to help prevent rounding errors\n\t\t\t\t\t\t\t$coupon_amount_pence = $coupon->amount * 100;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Work out the discount for the row\n\t\t\t\t\t\t\t$item_discount = $coupon_amount_pence * $discount_percent;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Work out discount per item\n\t\t\t\t\t\t\t$item_discount = $item_discount / $values['quantity'];\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Pence\n\t\t\t\t\t\t\t$price = ( $price * 100 );\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Check if discount is more than price\n\t\t\t\t\t\t\tif ($price < $item_discount) :\n\t\t\t\t\t\t\t\t$discount_amount = $price;\n\t\t\t\t\t\t\telse :\n\t\t\t\t\t\t\t\t$discount_amount = $item_discount;\n\t\t\t\t\t\t\tendif;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Take discount off of price (in pence)\n\t\t\t\t\t\t\t$price = $price - $discount_amount;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Back to pounds\n\t\t\t\t\t\t\t$price = $price / 100; \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Cannot be below 0\n\t\t\t\t\t\t\tif ($price<0) $price = 0;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Add coupon to discount total (once, since this is a fixed cart discount and we don't want rounding issues)\n\t\t\t\t\t\t\tif ($add_totals) $this->discount_cart = $this->discount_cart + (($discount_amount*$values['quantity']) / 100);\n\t\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\n\t\t\t\t\t\tcase \"percent\" :\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Get % off each item - this works out the same as doing the whole cart\n\t\t\t\t\t\t\t//$percent_discount = ( $values['data']->get_price( false ) / 100 ) * $coupon->amount;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t$percent_discount = ( $values['data']->get_price( ) / 100 ) * $coupon->amount;\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tif ($add_totals) $this->discount_cart = $this->discount_cart + ( $percent_discount * $values['quantity'] );\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t$price = $price - $percent_discount;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\n\t\t\t\t\tendswitch;\n\t\t\t\t\t\n\t\t\t\tendif;\n\t\t\tendforeach;\n\t\t\t\n\t\t\treturn apply_filters( 'cmdeals_get_discounted_price_', $price, $values, $this );\n\t\t}", "public function discountOrChargeValue()\n {\n return $this->discountOrChargeValueBoleta();\n }", "public function getLimit() {}", "public function getDiscountTaxCompensationAmount();", "public function getDiscountCode()\n {\n return $this->discountCode;\n }", "public function applyDiscount(Discount $discount){\n\t\tif($this->discount == NULL){\n\t\t\t$this->finalPrice = $this->price*(100-$discount->percent/100);\n\t\t\t$this->discount = $discount;\n\t\t}\n\t\treturn $this;\n\t}", "public function getBaseDiscountRefunded();", "public function getDiscountAttribute()\n {\n if (isset($this->attributes['discount'])) {\n return $this->attributes['discount'];\n }\n return (int)$this->vouchers()->sum('discount');\n }", "private function get_discount_percentage() : float {\n\t\tpreg_match( '/runParams\\.discount=\"(.*?)\";/si', $this->request, $matches );\n\t\tif ( empty( $matches[1] ) ) {\n\t\t\treturn 0.0;\n\t\t}\n\t\treturn floatval( $matches[1] );\n\t}", "function TaxExclusivePrice(){\n\t\tuser_error(\"to be completed\");\n\t}", "function ihc_dont_pay_after_discount($level_id, $coupon, $level_arr, $update_coupon_count=FALSE){\n\tif (!empty($coupon)){\n\t\tif (isset($level_arr['access_type']) && $level_arr['access_type']!='regular_period'){\n\t\t\t//not reccurence\n\t\t\t$coupon_data = ihc_check_coupon($coupon, $level_id);\n\t\t\t$level_arr['price'] = ihc_coupon_return_price_after_decrease($level_arr['price'], $coupon_data, FALSE);\n\t\t\tif ($level_arr['price']==0){\n\t\t\t\tif ($update_coupon_count){\n\t\t\t\t\t//update coupon count\n\t\t\t\t\tihc_submit_coupon($coupon);\n\t\t\t\t}\n\t\t\t\treturn TRUE;\n\t\t\t}\n\t\t}\n\t}\n\treturn FALSE;\n}", "function TaxInclusivePrice(){\n\t\tuser_error(\"to be completed\");\n\t}", "public function setDiscount($value)\n {\n $this->data->amount->subtotals->discount = (float) $value;\n\n return $this;\n }", "public function updatePercentage(Discount $discount)\n {\n }", "public function setDiscount($var)\n {\n GPBUtil::checkDouble($var);\n $this->discount = $var;\n\n return $this;\n }" ]
[ "0.6956106", "0.69308144", "0.6767918", "0.6580458", "0.65567744", "0.65539926", "0.63872296", "0.63313067", "0.6296522", "0.6245726", "0.62429285", "0.6229825", "0.6217605", "0.6197916", "0.6190034", "0.61757344", "0.6168497", "0.6162909", "0.61515903", "0.61427647", "0.6128894", "0.6107512", "0.6082442", "0.6074335", "0.60737115", "0.6032997", "0.603127", "0.603127", "0.603127", "0.603127", "0.603127", "0.603127", "0.60312295", "0.6011558", "0.60027784", "0.6001271", "0.59575146", "0.59326506", "0.5884513", "0.5882461", "0.588087", "0.58790797", "0.5878134", "0.5866197", "0.585366", "0.5833488", "0.5821368", "0.581551", "0.5785578", "0.5773788", "0.5773753", "0.5759184", "0.5748674", "0.57385075", "0.57331526", "0.571225", "0.5710781", "0.5697783", "0.5693836", "0.5677778", "0.5675581", "0.56685436", "0.5656661", "0.5653994", "0.5651572", "0.5629009", "0.56255776", "0.5600511", "0.5599046", "0.5594261", "0.5592497", "0.5582946", "0.55713826", "0.55578744", "0.5555454", "0.55506164", "0.5549495", "0.5549495", "0.5549495", "0.5549495", "0.5549495", "0.5545243", "0.5539306", "0.55390036", "0.5535503", "0.5532312", "0.55283666", "0.55180925", "0.55150735", "0.55141246", "0.5505863", "0.5483711", "0.548361", "0.5483514", "0.5482095", "0.5480342", "0.54798746", "0.5479232", "0.547016", "0.54600686" ]
0.69675756
0
Target: All. "Set discount to all products"
protected static function avail_target_all($filter_items, $items, $target, $rule, $sku_id) { if (!$filter_items) { if (!isset(self::$available_products[$sku_id][$rule['id']])) { self::$available_products[$sku_id][$rule['id']] = array(); } return false; } return self::calculate_target_discount($target, $items, $rule, $sku_id); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function AssignDiscount()\n\t{\t\n\t}", "public function set_discount_defaults()\r\n\t{\r\n\t\t// Set array placeholders.\r\n\t\tif (! isset($this->flexi->cart_contents['settings']['discounts']['codes']))\r\n\t\t{\r\n\t\t\t$this->flexi->cart_contents['settings']['discounts']['codes'] = array();\r\n\t\t}\r\n\t\tif (! isset($this->flexi->cart_contents['settings']['discounts']['manual']))\r\n\t\t{\r\n\t\t\t$this->flexi->cart_contents['settings']['discounts']['manual'] = array();\r\n\t\t}\t\r\n\t\r\n\t\t// Reset other discount data.\r\n\t\t$this->flexi->cart_contents['settings']['discounts']['active_items'] = array();\r\n\t\t$this->flexi->cart_contents['settings']['discounts']['active_summary'] = array();\r\n\t\t$this->flexi->cart_contents['settings']['discounts']['reward_vouchers'] = array();\r\n\t\t$this->flexi->cart_contents['settings']['discounts']['data']['item_discount_savings'] = 0;\r\n\t\t$this->flexi->cart_contents['settings']['discounts']['data']['summary_discount_savings'] = 0;\r\n\t\t$this->flexi->cart_contents['settings']['discounts']['data']['reward_vouchers'] = 0;\r\n\t\t$this->flexi->cart_contents['settings']['discounts']['data']['void_reward_point_items'] = array();\r\n\r\n\t\tif (! isset($this->flexi->cart_contents['settings']['discounts']['data']['excluded_discounts']))\r\n\t\t{\r\n\t\t\t$this->flexi->cart_contents['settings']['discounts']['data']['excluded_discounts'] = array();\r\n\t\t}\t\r\n\t\t\r\n\t\treturn TRUE;\r\n\t}", "protected function calculateDiscount() : void{\r\n $percentage = ($this->discounted_value * 100) / $this->order->getTrueTotal();\r\n $new_total = $this->order->getTrueTotal() - $this->discounted_value;\r\n\r\n $this->order_discount_value = $this->discounted_value;\r\n $this->order_discount_percentage = $percentage;\r\n $this->order_discount_reason = \"For every \" . $this->products_nr . \" products from category #\" . $this->category_id . \" you get one free. You got: \";\r\n foreach($this->items_matching as $item){\r\n $this->order_discount_reason .= floor($item[\"qty\"] / $this->products_nr) . \" x '\" . $item[\"description\"] . \"' (€\". $item[\"price\"] .\" each) ; \";\r\n }\r\n $this->order_new_total = $new_total;\r\n }", "function set_discount($discount_id = FALSE)\n\t\t{\n\t\t\t$this->load->model('demo_cart_model');\n\t\t\t\n\t\t\t$this->demo_cart_model->demo_set_discount($discount_id);\n\t\t\t\n\t\t\tredirect('cart');\n\t\t}", "function pp_edd_auto_apply_discount() {\n\n\tif ( function_exists( 'edd_is_checkout' ) && edd_is_checkout() ) {\n\n\t\tif ( ! edd_cart_has_discounts() && edd_is_discount_valid( 'BFCM2016', '', false ) ) {\n\t\t\tedd_set_cart_discount( 'BFCM2016' );\n\t\t}\n\n\t}\n\n}", "public function applyCartDiscount(Varien_Event_Observer $observer)\n { \n try\n { \n $bundle_product_ids = [];\n $quote_product_ids = [];\n $cookieValue = Mage::getModel('core/cookie')->get('ivid');\n $userBundleCollection = Mage::getModel('increasingly_analytics/bundle')->getCollection()->addFieldToFilter('increasingly_visitor_id',$cookieValue);\n $items = $observer->getEvent()->getQuote()->getAllItems();\n $eligibleProducts = [];\n $discount = 0;\n foreach ($items as $item) {\n array_push($quote_product_ids, $item->getProductId());\n }\n foreach ($userBundleCollection as $bundle) {\n //First Bundle products\n $bundle_product_ids = explode(',', $bundle->getProductIds()); \n $productsIds = array_intersect($quote_product_ids, $bundle_product_ids);\n if(count($productsIds) == count($bundle_product_ids) )\n $discount += $bundle->getDiscountPrice();\n }\n\n if($discount > 0){\n $quote=$observer->getEvent()->getQuote();\n $quoteid=$quote->getId();\n $discountAmount=$discount;\n if($quoteid) { \n if($discountAmount>0) {\n $total=$quote->getBaseSubtotal();\n $quote->setSubtotal(0);\n $quote->setBaseSubtotal(0);\n\n $quote->setSubtotalWithDiscount(0);\n $quote->setBaseSubtotalWithDiscount(0);\n\n $quote->setGrandTotal(0);\n $quote->setBaseGrandTotal(0);\n \n\n $canAddItems = $quote->isVirtual()? ('billing') : ('shipping'); \n foreach ($quote->getAllAddresses() as $address) {\n\n $address->setSubtotal(0);\n $address->setBaseSubtotal(0);\n\n $address->setGrandTotal(0);\n $address->setBaseGrandTotal(0);\n\n $address->collectTotals();\n\n $quote->setSubtotal((float) $quote->getSubtotal() + $address->getSubtotal());\n $quote->setBaseSubtotal((float) $quote->getBaseSubtotal() + $address->getBaseSubtotal());\n\n $quote->setSubtotalWithDiscount(\n (float) $quote->getSubtotalWithDiscount() + $address->getSubtotalWithDiscount()\n );\n $quote->setBaseSubtotalWithDiscount(\n (float) $quote->getBaseSubtotalWithDiscount() + $address->getBaseSubtotalWithDiscount()\n );\n\n $quote->setGrandTotal((float) $quote->getGrandTotal() + $address->getGrandTotal());\n $quote->setBaseGrandTotal((float) $quote->getBaseGrandTotal() + $address->getBaseGrandTotal());\n\n $quote ->save(); \n\n $quote->setGrandTotal($quote->getBaseSubtotal()-$discountAmount)\n ->setBaseGrandTotal($quote->getBaseSubtotal()-$discountAmount)\n ->setSubtotalWithDiscount($quote->getBaseSubtotal()-$discountAmount)\n ->setBaseSubtotalWithDiscount($quote->getBaseSubtotal()-$discountAmount)\n ->save(); \n\n\n if($address->getAddressType()==$canAddItems) {\n //echo $address->setDiscountAmount; exit;\n $address->setSubtotalWithDiscount((float) $address->getSubtotalWithDiscount()-$discountAmount);\n $address->setGrandTotal((float) $address->getGrandTotal()-$discountAmount);\n $address->setBaseSubtotalWithDiscount((float) $address->getBaseSubtotalWithDiscount()-$discountAmount);\n $address->setBaseGrandTotal((float) $address->getBaseGrandTotal()-$discountAmount);\n if($address->getDiscountDescription()){\n $address->setDiscountAmount(-($address->getDiscountAmount()-$discountAmount));\n $address->setDiscountDescription($address->getDiscountDescription().', Custom Discount');\n $address->setBaseDiscountAmount(-($address->getBaseDiscountAmount()-$discountAmount));\n }else {\n $address->setDiscountAmount(-($discountAmount));\n $address->setDiscountDescription('Custom Discount');\n $address->setBaseDiscountAmount(-($discountAmount));\n }\n $address->save();\n }//end: if\n } //end: foreach\n //echo $quote->getGrandTotal();\n\n foreach($quote->getAllItems() as $item){\n //We apply discount amount based on the ratio between the GrandTotal and the RowTotal\n $rat=$item->getPriceInclTax()/$total;\n $ratdisc=$discountAmount*$rat;\n $item->setDiscountAmount(($item->getDiscountAmount()+$ratdisc) * $item->getQty());\n $item->setBaseDiscountAmount(($item->getBaseDiscountAmount()+$ratdisc) * $item->getQty())->save(); \n }\n } \n }\n }\n }\n catch(Exception $e)\n {\n Mage::log(\"Remove from cart tracking - \" . $e->getMessage(), null, 'Increasingly_Analytics.log');\n }\n\n }", "public function applyGlobalDiscount($discount_rate)\n {\n }", "function setup() {\r\n // \"Buy more than 100 items, get 50 (% or $, as per admin) off\" \r\n // $this->add_extra_level_discount(100, 50);\r\n }", "private function updateProductDiscount(\n ProductInterface $product,\n Request $request\n ): void {\n $discountPercent = $request->request->get('discount_percent') !== '' ? (float) $request->request->get('discount_percent') : null;\n $discountLimitType = $request->request->get('discount_limit_type') !== '' ? $request->request->get('discount_limit_type') : null;\n $discountFromDate = $request->request->get('discount_from_date') !== '' ? $request->request->get('discount_from_date') : null;\n $discountToDate = $request->request->get('discount_to_date') !== '' ? $request->request->get('discount_to_date') : null;\n\n $variants = $product->getVariants();\n foreach ($variants as $variant) {\n // Variant to change\n $variantPricing = $variant->getChannelPricings()->first();\n\n // Change percent\n if ($discountPercent !== null) {\n $variantPricing->setDiscount($discountPercent / 100);\n }\n\n // Continue if no change type\n if ($discountLimitType === self::LIMIT_NO_CHANGE) {\n continue;\n }\n // Discount type\n $variantPricing->setDiscountLimitType($discountLimitType === self::LIMIT_NONE ? null : $discountLimitType);\n\n // Date type discount\n if ($discountLimitType === self::LIMIT_DATETIME) {\n if ($discountFromDate && $discountToDate) {\n $dateFrom = \\DateTime::createFromFormat('Y-m-d', $discountFromDate);\n $dateTo = \\DateTime::createFromFormat('Y-m-d', $discountToDate);\n\n $variantPricing->setDiscountFrom($dateFrom);\n $variantPricing->setDiscountTo($dateTo);\n }\n\n if ($discountFromDate && !$discountToDate) {\n $dateFrom = \\DateTime::createFromFormat('Y-m-d', $discountFromDate);\n\n $variantPricing->setDiscountFrom($dateFrom);\n $variantPricing->setDiscountTo(null);\n }\n\n if (!$discountFromDate && $discountToDate) {\n $dateTo = \\DateTime::createFromFormat('Y-m-d', $discountToDate);\n\n $variantPricing->setDiscountFrom(null);\n $variantPricing->setDiscountTo($dateTo);\n }\n }\n }\n }", "public function set_manual_discount($discount_data = FALSE)\r\n\t{\r\n\t\tif (is_array($discount_data) && ! empty($discount_data))\r\n\t\t{\r\n\t\t\t// Check that any submitted 'New value' discounts are only applied to the shipping total. \r\n\t\t\tif (isset($discount_data['column']) && isset($discount_data['calculation']) && ($discount_data['column'] != 'shipping_total') && ($discount_data['calculation'] == 3))\r\n\t\t\t{\r\n\t\t\t\treturn FALSE;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t// Merge the code and manual discounts together, then loop through data and compile an array of all discount ids currently in use.\r\n\t\t\t$existing_discounts = array_merge($this->flexi->cart_contents['settings']['discounts']['manual'], $this->flexi->cart_contents['settings']['discounts']['codes']);\r\n\t\t\t$existing_ids = array();\r\n\t\t\t\t\r\n\t\t\tforeach($existing_discounts as $existing_discount)\r\n\t\t\t{\r\n\t\t\t\t$existing_ids[] = $existing_discount['id'];\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t// If an id is not set in the submitted '$discount_data', or if a discount with a matching id already exists, set a new id. \r\n\t\t\tif (! isset($discount_data['id']) || in_array($discount_data['id'], $existing_ids))\r\n\t\t\t{\r\n\t\t\t\t$id = 0;\r\n\t\t\t\twhile (in_array('manual_'.$id, $existing_ids))\r\n\t\t\t\t{\r\n\t\t\t\t\t$id++; \r\n\t\t\t\t}\r\n\t\t\t\t$id = $discount_data['id'] = 'manual_'.$id;\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\t$id = $discount_data['id'];\r\n\t\t\t}\r\n\t\t\r\n\t\t\t// Set default values if not submitted.\r\n\t\t\t$discount_data['description'] = (! isset($discount_data['description'])) ? FALSE : $discount_data['description'];\r\n\t\t\t$discount_data['value'] = (! isset($discount_data['value'])) ? 0 : $discount_data['value'];\r\n\t\t\t$discount_data['column'] = (! isset($discount_data['column'])) ? 'total' : $discount_data['column'];\r\n\t\t\t$discount_data['calculation'] = (! isset($discount_data['calculation'])) ? 1 : $discount_data['calculation'];\r\n\t\t\t$discount_data['tax_method'] = (! isset($discount_data['tax_method'])) ? FALSE : $discount_data['tax_method'];\r\n\t\t\t$discount_data['void_reward_points'] = (! isset($discount_data['void_reward_points'])) ? FALSE : $discount_data['void_reward_points'];\r\n\t\t\t\r\n\t\t\t// Set the cart column the discount is targeting and use the value to act as the discounts array key. \r\n\t\t\t// This prevents multiple discounts being applied to the same cart column.\r\n\t\t\t$target_column = $discount_data['column'];\r\n\t\t\t\r\n\t\t\t// Loop through data and set to cart session summary.\r\n\t\t\tforeach($discount_data as $column => $column_value)\r\n\t\t\t{\r\n\t\t\t\tif ($column == 'value')\r\n\t\t\t\t{\r\n\t\t\t\t\t// If a valid discount value is not set, set the default value as zero. \r\n\t\t\t\t\t$column_value = ($this->non_negative($column_value)) ? $this->format_calculation($column_value, 2, TRUE) : 0;\r\n\t\t\t\t}\r\n\t\t\t\telse if ($column == 'column')\r\n\t\t\t\t{\r\n\t\t\t\t\t// If a valid column is not set, discount the 'total' column by default. \r\n\t\t\t\t\t$column_value = (in_array($column_value, array('item_summary_total', 'shipping_total', 'total'))) ? $column_value : 'total';\r\n\t\t\t\t}\r\n\t\t\t\telse if ($column == 'calculation') \r\n\t\t\t\t{\r\n\t\t\t\t\t// If a valid calculation method is not set, a 'percentage' based calculation is set by default.\r\n\t\t\t\t\t// 1 = Percentage Based, 2 = Flat Fee, 3 = New Value.\r\n\t\t\t\t\t$column_value = (in_array($column_value, array(1,2,3))) ? $column_value : 1;\r\n\t\t\t\t}\r\n\t\t\t\telse if ($column == 'tax_method')\r\n\t\t\t\t{\r\n\t\t\t\t\t// If a valid tax method is not set, the tax method is defined by whether cart prices ex/include taxes by default.\r\n\t\t\t\t\t// 0 = Carts Default Tax Method, 1 = Apply Tax Before Discount, 2 = Apply Discount Before Tax, 3 = Apply Discount Before Tax, Add Original Tax.\r\n\t\t\t\t\t$column_value = (in_array($column_value, array(0, 1,2,3))) ? $column_value : 0;\r\n\t\t\t\t}\r\n\t\t\t\telse if ($column == 'void_reward_points')\r\n\t\t\t\t{\r\n\t\t\t\t\t$column_value = (bool)$column_value;\r\n\t\t\t\t}\r\n\t\t\t\telse if (! in_array($column, array('id', 'description')))\r\n\t\t\t\t{\r\n\t\t\t\t\tcontinue;\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\t$this->flexi->cart_contents['settings']['discounts']['manual'][$target_column][$column] = $column_value;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\treturn TRUE;\r\n\t\t}\r\n\t\t\r\n\t\treturn FALSE;\r\n\t}", "public function updateAffectedPlans(Discount $discount)\n {\n }", "private function setSoldIndividually() {\n $this->product->set_sold_individually($this->wcData->isSoldIndividually());\n }", "public function setDiscount(int $discount): void\n {\n $this->discount = ($discount > 0 && $discount <= 50) ? $discount : 0;\n\n }", "function apply_special_item_discount($id, $count, &$disc_amount) {\r\n switch($id) {\r\n case 99999:\r\n case 99998:\r\n if ($count > 100) {\r\n $disc_amount = 50; \r\n }\r\n break; \r\n case 99997:\r\n $disc_amount = 75;\r\n break; \r\n }\r\n }", "function remove_all_discounts()\n\t\t{\n\t\t\t// The 'unset_discount()' function can accept an array of either discount ids or codes to delete more than one discount at a time.\n\t\t\t// Alternatively, if no data is submitted, the function will delete all discounts that are applied to the cart.\n\t\t\t// This example removes all discount data.\n\t\t\t// $this->flexi_cart->unset_userdata_discount(); // Can't remeber why this 'stock code' didn't work - said 'undefined method' or something\t\t\n\t\t\t$this->flexi_cart->unset_discount();\n\t\t\t\n\t\t\t// Set a message to the CI flashdata so that it is available after the page redirect.\n\t\t\t$this->session->set_flashdata('message', $this->flexi_cart->get_messages());\n\n\t\t\tredirect('cart');\n\t\t}", "public function discountBifurcation(Varien_Event_Observer $observer)\n {\n $rule = $observer->getEvent()->getRule();\n $result = $observer->getEvent()->getResult();\n $itemId = $observer->getEvent()->getItem()->getItemId();\n //set Unique key\n $curUnique= $rule->getRuleId().'_'.$itemId;\n //check if Mage registry unique call set\n if(Mage::registry('uniqueCall')!==null){\n //if check in array\n $uniqueCalls = Mage::registry('uniqueCall');\n if( in_array($curUnique,$uniqueCalls)){\n return;\n }else{\n //unset existing registry. also take existing array in variable\n Mage::unregister('uniqueCall');\n $uniqueCalls[]= $curUnique ;\n //set registry again with new array include $uniqueCall into it\n Mage::register('uniqueCall',$uniqueCalls);\n }\n }else{\n //set registry again with new array include $uniqueCall into it\n $array = array();\n $array[]=$rule->getRuleId().'_'.$itemId;\n Mage::register('uniqueCall',$array);\n\n } \n\n //condition for the Promotional coupons\n if ( $rule->getCouponType() == Mage_SalesRule_Model_Rule::COUPON_TYPE_NO_COUPON ) {\n $promotionDiscount = 0;\n $promotionDiscount = Mage::registry('promotion');\n if (Mage::registry('promotion')!==null){\n Mage::unregister('promotion');\n }\n if (Mage::registry('promo_lable')!==null){\n Mage::unregister('promo_lable');\n }\n $promotionDiscount += $result->getDiscountAmount();\n Mage::register('promotion', $promotionDiscount);\n Mage::register('promo_lable',$rule->getName());\n } elseif ( $rule->getCouponType() == self::COUPON_TYPE_FUE_GENERATED ) {\n $couponDiscount = 0;\n $couponDiscount = Mage::registry('coupon');\n if(Mage::registry('coupon')!==null){\n Mage::unregister('coupon');\n }\n //sum up all the values of discounted coupons\n $couponDiscount += $result->getDiscountAmount();\n Mage::register('coupon',$couponDiscount);\n }\n $quote = $observer->getEvent()->getQuote();\n $quoteAddress = $observer->getEvent()->getAddress();\n //set discounted coupons and promotional coupons amount in quote\n $quote->setCouponDiscount(Mage::registry('coupon'));\n $quote->setPromotionalDiscount(Mage::registry('promotion'));\n\n if (Mage::getStoreConfig('promodiscount/promodiscount/use_default')) {\n $quote->setPromoLable(Mage::getStoreConfig('promodiscount/promodiscount/default_lable'));\n } else {\n if (Mage::registry('promo_lable')) {\n $quote->setPromoLable(Mage::registry('promo_lable'));\n } else {\n $quote->setPromoLable(Mage::getStoreConfig('promodiscount/promodiscount/default_lable'));\n }\n }\n \n $quoteAddress->setCouponDiscount(Mage::registry('coupon'));\n $quoteAddress->setPromotionalDiscount(Mage::registry('promotion'));\n if (Mage::registry('promo_lable')) {\n $quoteAddress->setPromoLable(Mage::registry('promo_lable'));\n } else {\n $quoteAddress->setPromoLable(Mage::getStoreConfig('promodiscount/promodiscount/default_lable'));\n }\n }", "function _apply_auto_disc()\n\t{\n\t\t$num_items = $this->cart->total_items();\n\t\t$auto_disc_info = null;\n\n\t\tforeach ($this->auto_disc_array as $cart_items => $disc_info)\n\t\t{\n\t\t\tif($num_items >= $cart_items)\n\t\t\t{\n\t\t\t\t$auto_disc_info = $disc_info;\n\t\t\t}\n\t\t}\n\n\t\t$applied_disc = $this->cart->discount_info();\n\n\t\t//auto discount should be more than the applied disc (if any)\n\t\tif($applied_disc['percentage'] < $auto_disc_info['percentage'])\n\t\t{\n\t\t\t$this->_apply_discount( $auto_disc_info['coupon'] );\n\t\t}\t\t\n\t}", "function setSyncItemsPriceAction()\n {\n }", "function apply_deals_discounts_after_tax( $values, $price ) {\n\t\t\t\n\t\t\tif ($this->applied_coupons) foreach ($this->applied_coupons as $code) :\n\t\t\t\t$coupon = new cmdeals_coupon( $code );\n\t\t\t\t\n\t\t\t\tdo_action( 'cmdeals_deals_discount_after_tax_' . $coupon->type, $coupon );\n\t\t\t\t\n\t\t\t\tif ($coupon->type!='fixed_deals' && $coupon->type!='percent_deals') continue;\n\t\t\t\t\n\t\t\t\tif ( !$coupon->apply_before_tax() && $coupon->is_valid() ) :\n\t\t\t\t\t\n\t\t\t\t\t$this_item_is_discounted = false;\n\t\t\n\t\t\t\t\t// Specific deals ID's get the discount\n\t\t\t\t\tif (sizeof($coupon->deal_ids)>0) :\n\t\t\t\t\t\t\n\t\t\t\t\t\tif ((in_array($values['deal_id'], $coupon->deal_ids) || in_array($values['variation_id'], $coupon->deal_ids))) :\n\t\t\t\t\t\t\t$this_item_is_discounted = true;\n\t\t\t\t\t\tendif;\n\t\t\t\t\t\n\t\t\t\t\telse :\n\t\t\t\t\t\t\n\t\t\t\t\t\t// No deals ids - all items discounted\n\t\t\t\t\t\t$this_item_is_discounted = true;\n\t\t\t\t\t\n\t\t\t\t\tendif;\n\t\t\n\t\t\t\t\t// Specific deals ID's excluded from the discount\n\t\t\t\t\tif (sizeof($coupon->exclude_deals_ids)>0) :\n\t\t\t\t\t\t\n\t\t\t\t\t\tif ((in_array($values['deal_id'], $coupon->exclude_deals_ids) || in_array($values['variation_id'], $coupon->exclude_deals_ids))) :\n\t\t\t\t\t\t\t$this_item_is_discounted = false;\n\t\t\t\t\t\tendif;\n\t\t\t\t\t\t\n\t\t\t\t\tendif;\n\t\t\t\t\t\n\t\t\t\t\t// Apply filter\n\t\t\t\t\t$this_item_is_discounted = apply_filters( 'cmdeals_item_is_discounted', $this_item_is_discounted, $values, $before_tax = false );\n\t\t\t\t\t\n\t\t\t\t\t// Apply the discount\n\t\t\t\t\tif ($this_item_is_discounted) :\n\t\t\t\t\t\tif ($coupon->type=='fixed_deals') :\n\t\t\t\t\t\t\n\t\t\t\t\t\t\tif ($price < $coupon->amount) :\n\t\t\t\t\t\t\t\t$discount_amount = $price;\n\t\t\t\t\t\t\telse :\n\t\t\t\t\t\t\t\t$discount_amount = $coupon->amount;\n\t\t\t\t\t\t\tendif;\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t$this->discount_total = $this->discount_total + ( $discount_amount * $values['quantity'] );\n\t\t\t\t\t\t\t\n\t\t\t\t\t\telseif ($coupon->type=='percent_deals') :\n\t\t\t\t\t\t\t$this->discount_total = $this->discount_total + ( $price / 100 ) * $coupon->amount;\n\t\t\t\t\t\tendif;\n\t\t\t\t\tendif;\n\t\t\t\t\t\n\t\t\t\tendif;\n\t\t\tendforeach;\n\t\t}", "function apply_cart_discounts_after_tax() {\t\n\t\t\t\n\t\t\tif ($this->applied_coupons) foreach ($this->applied_coupons as $code) :\n\t\t\t\t$coupon = new cmdeals_coupon( $code );\n\t\t\t\t\n\t\t\t\tdo_action( 'cmdeals_cart_discount_after_tax_' . $coupon->type, $coupon );\n\t\t\t\t\n\t\t\t\tif ( !$coupon->apply_before_tax() && $coupon->is_valid() ) :\n\t\t\t\t\t\n\t\t\t\t\tswitch ($coupon->type) :\n\t\t\t\t\t\n\t\t\t\t\t\tcase \"fixed_cart\" :\n\t\n\t\t\t\t\t\t\t$this->discount_total = $this->discount_total + $coupon->amount;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\n\t\t\t\t\t\tcase \"percent\" :\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t$percent_discount = (round( $this->cart_contents_total + $this->tax_total , 2) / 100 ) * $coupon->amount;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t$this->discount_total = $this->discount_total + $percent_discount;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\n\t\t\t\t\tendswitch;\n\t\n\t\t\t\tendif;\n\t\t\tendforeach;\n\t\t}", "public function set_coupon_discount_totals( $value = array() ) {\n\t\t$this->coupon_discount_totals = (array) $value;\n\t}", "protected function _applyObjectProperty()\n\t{\n\t\tparent::_applyObjectProperty();\n\n\t\t$modelName = $this->_object->getModelName();\n\n\t\tswitch ($modelName)\n\t\t{\n\t\t\tcase 'shop_discount':\n\t\t\t\t// Скидка не может быть больше 100%\n\t\t\t\tif ($this->_object->type == 0 && $this->_object->value > 100)\n\t\t\t\t{\n\t\t\t\t\t$this->_object->value = 0;\n\t\t\t\t\t$this->_object->save();\n\n\t\t\t\t\t$this->addMessage(\n\t\t\t\t\t\tCore_Message::get(Core::_('Shop_Discount.percent_error'), 'error')\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\t// Группа доступа\n\t\t\t\t$aSiteuser_Groups = array(0 => Core::_('Structure.all'));\n\n\t\t\t\tif (Core::moduleIsActive('siteuser'))\n\t\t\t\t{\n\t\t\t\t\t$oSiteuser_Controller_Edit = new Siteuser_Controller_Edit($this->_Admin_Form_Action);\n\t\t\t\t\t$aSiteuser_Groups = $aSiteuser_Groups + $oSiteuser_Controller_Edit->fillSiteuserGroups($this->_object->Shop->site_id);\n\t\t\t\t}\n\n\t\t\t\t$aTmp = array();\n\n\t\t\t\t$aShop_Discount_Siteuser_Groups = $this->_object->Shop_Discount_Siteuser_Groups->findAll(FALSE);\n\t\t\t\tforeach ($aShop_Discount_Siteuser_Groups as $oShop_Discount_Siteuser_Group)\n\t\t\t\t{\n\t\t\t\t\t!in_array($oShop_Discount_Siteuser_Group->siteuser_group_id, $aTmp)\n\t\t\t\t\t\t&& $aTmp[] = $oShop_Discount_Siteuser_Group->siteuser_group_id;\n\t\t\t\t}\n\n\t\t\t\tforeach ($aSiteuser_Groups as $siteuser_group_id => $name)\n\t\t\t\t{\n\t\t\t\t\t$bSiteuserGroupChecked = Core_Array::getPost('siteuser_group_' . $siteuser_group_id);\n\n\t\t\t\t\tif ($bSiteuserGroupChecked)\n\t\t\t\t\t{\n\t\t\t\t\t\tif (!in_array($siteuser_group_id, $aTmp))\n\t\t\t\t\t\t{\n\n\t\t\t\t\t\t\t$oShop_Discount_Siteuser_Group = Core_Entity::factory('Shop_Discount_Siteuser_Group');\n\t\t\t\t\t\t\t$oShop_Discount_Siteuser_Group->siteuser_group_id = $siteuser_group_id;\n\t\t\t\t\t\t\t$this->_object->add($oShop_Discount_Siteuser_Group);\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 (in_array($siteuser_group_id, $aTmp))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$oShop_Discount_Siteuser_Group = $this->_object->Shop_Discount_Siteuser_Groups->getObject($this->_object, $siteuser_group_id);\n\n\t\t\t\t\t\t\t!is_null($oShop_Discount_Siteuser_Group)\n\t\t\t\t\t\t\t\t&& $oShop_Discount_Siteuser_Group->delete();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\tbreak;\n\t\t}\n\n\t\tCore_Event::notify(get_class($this) . '.onAfterRedeclaredApplyObjectProperty', $this, array($this->_Admin_Form_Controller));\n\n\t\treturn $this;\n\t}", "public function setDiscountAmount($amount);", "public function setAttributes_discounted( $attributes_discounted ) {\n\t\t$this->attributes_discounted = $attributes_discounted;\n\t}", "public function updateProductStyleOptionPricingAll(){\n\t\t$all_products = $this->getAll();\n\t\t$this->load->model('catalog/product');\n\t\t$this->load->model('tshirtgang/pricing');\n\t\t$this->load->model('catalog/option');\n\t\t$tshirt_option_names = array('Tshirt Color', 'Tshirt Style', 'Tshirt Size');\n\t\t$tshirt_colored = array(\n\t\t\t\"Black\",\n\t\t\t\"Charcoal Grey\",\n\t\t\t\"Daisy\",\n\t\t\t\"Dark Chocolate\",\n\t\t\t\"Forest Green\",\n\t\t\t\"Gold\",\n\t\t\t\"Irish Green\",\n\t\t\t\"Light Blue\",\n\t\t\t\"Light Pink\",\n\t\t\t\"Military Green\",\n\t\t\t\"Navy\",\n\t\t\t\"Orange\",\n\t\t\t\"Purple\",\n\t\t\t\"Red\",\n\t\t\t\"Royal Blue\",\n\t\t\t\"Sport Grey\",\n\t\t\t\"Tan\",\n\t\t\t\"Burgundy\"\n\t\t);\n\t\t$tshirt_ringer = array(\n\t\t\t\"Navy Ringer\",\n\t\t\t\"Black Ringer\",\n\t\t\t\"Red Ringer\"\n\t\t);\n\t\t$tshirt_options = array();\n\t\t$tshirt_options_price = array();\n\t\t$options = $this->model_catalog_option->getOptions();\n\t\t$temp_price = 0.0;\n\t\tforeach($options as $option){\n\t\t\t//if($option['name'] == 'Tshirt Color'){\n\t\t\t//\t$tshirtcolor_option_id = $option['option_id'];\n\t\t\t//}\n\t\t\t//if($option['name'] == 'Tshirt Style'){\n\t\t\t//\t$tshirtstyle_option_id = $option['option_id'];\n\t\t\t//}\n\t\t\t//if($option['name'] == 'Tshirt Size'){\n\t\t\t//\t$tshirtsize_option_id = $option['option_id'];\n\t\t\t//}\n\t\t\tif(in_array($option['name'], $tshirt_option_names)){\n\t\t\t\t$tshirt_options[$option['name']] = array();\n\t\t\t\t$tshirt_options[$option['name']]['option_id'] = $option['option_id'];\n\t\t\t\t$tshirt_options[$option['name']]['prices'] = array();\n\t\t\t}\n\t\t}\n\t\tforeach($tshirt_option_names as $tshirt_option_name){\n\t\t\t$option_value_descriptions = $this->model_catalog_option->getOptionValueDescriptions($tshirt_options[$tshirt_option_name]['option_id']);\n\t\t\tforeach($option_value_descriptions as $opv){\n\t\t\t\t$temp_price = 0.0;\n\t\t\t\tif($tshirt_option_name=='Tshirt Color'){\n\t\t\t\t\tif( in_array($opv['option_value_description'][1]['name'], $tshirt_colored )){\n\t\t\t\t\t\t$temp_price = $this->model_tshirtgang_pricing->get(array( 'code' => 'ColorShirt' ));\n\t\t\t\t\t} elseif( in_array($opv['option_value_description'][1]['name'], $tshirt_ringer )){\n\t\t\t\t\t\t$temp_price = $this->model_tshirtgang_pricing->get(array( 'code' => 'RingerShirt' ));\n\t\t\t\t\t} else { // white\n\t\t\t\t\t\t$temp_price = $this->model_tshirtgang_pricing->get(array( 'code' => 'WhiteShirt' ));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif($tshirt_option_name=='Tshirt Style'){\n\t\t\t\t\tif($opv['option_value_description'][1]['name'] == \"Mens Fitted\" ) $temp_price = $this->model_tshirtgang_pricing->get(array( 'code' => 'MensFittedIncremental' ));\n\t\t\t\t\tif($opv['option_value_description'][1]['name'] == \"Ladies\" ) $temp_price = $this->model_tshirtgang_pricing->get(array( 'code' => 'LadiesIncremental' ));\n\t\t\t\t\tif($opv['option_value_description'][1]['name'] == \"Hooded Pullover\" ) $temp_price = $this->model_tshirtgang_pricing->get(array( 'code' => 'HoodieIncremental' ));\n\t\t\t\t\tif($opv['option_value_description'][1]['name'] == \"Apron\" ) $temp_price = $this->model_tshirtgang_pricing->get(array( 'code' => 'ApronIncremental' ));\n\t\t\t\t\tif($opv['option_value_description'][1]['name'] == \"Vneck\" ) $temp_price = $this->model_tshirtgang_pricing->get(array( 'code' => 'VneckIncremental' ));\n\t\t\t\t\tif($opv['option_value_description'][1]['name'] == \"Tanktop\" ) $temp_price = $this->model_tshirtgang_pricing->get(array( 'code' => 'TanktopIncremental' ));\n\t\t\t\t\tif($opv['option_value_description'][1]['name'] == \"Baby One Piece\" ) $temp_price = $this->model_tshirtgang_pricing->get(array( 'code' => 'BabyOnePieceIncremental' ));\n\t\t\t\t}\n\t\t\t\tif($tshirt_option_name=='Tshirt Size'){\n\t\t\t\t\tif($opv['option_value_description'][1]['name'] == \"2 X-Large\" ) $temp_price = $this->model_tshirtgang_pricing->get(array( 'code' => 'Shirt_2XL_Incremental' ));\n\t\t\t\t\tif($opv['option_value_description'][1]['name'] == \"3 X-Large\" ) $temp_price = $this->model_tshirtgang_pricing->get(array( 'code' => 'Shirt_3XL6XL_Incremental' ));\n\t\t\t\t\tif($opv['option_value_description'][1]['name'] == \"4 X-Large\" ) $temp_price = $this->model_tshirtgang_pricing->get(array( 'code' => 'Shirt_3XL6XL_Incremental' ));\n\t\t\t\t\tif($opv['option_value_description'][1]['name'] == \"5 X-Large\" ) $temp_price = $this->model_tshirtgang_pricing->get(array( 'code' => 'Shirt_3XL6XL_Incremental' ));\n\t\t\t\t\tif($opv['option_value_description'][1]['name'] == \"6 X-Large\" ) $temp_price = $this->model_tshirtgang_pricing->get(array( 'code' => 'Shirt_3XL6XL_Incremental' ));\n\t\t\t\t}\n\t\t\t\tif($temp_price != 0.0){\n\t\t\t\t\t$tshirt_options_price = array(\n\t\t\t\t\t\t'option_value_id' => $opv['option_value_id'],\n\t\t\t\t\t\t'name' => $opv['option_value_description'][1]['name'],\n\t\t\t\t\t\t'price' => $temp_price\n\t\t\t\t\t);\n\t\t\t\t\t$tshirt_options[$tshirt_option_name]['prices'][] = $tshirt_options_price;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tforeach($tshirt_options as $tso1){\n\t\t\tforeach($tso1['prices'] as $tso2){\n\t\t\t\t$sql = \"UPDATE \" . DB_PREFIX . \"product_option_value ocpov \";\n\t\t\t\t$sql .= \"LEFT JOIN \" . DB_PREFIX . \"product ocp \";\n\t\t\t\t$sql .= \" ON ocp.product_id = ocpov.product_id \";\n\t\t\t\t$sql .= \"LEFT JOIN \" . DB_PREFIX . \"tshirtgang_products tsgp \";\n\t\t\t\t$sql .= \" ON tsgp.product_id = ocp.product_id \";\n\t\t\t\t$sql .= \"SET ocpov.price=\". (float)$tso2['price'] . \" \";\n\t\t\t\t$sql .= \"WHERE \";\n\t\t\t\t$sql .= \" ocpov.option_value_id = \" . (int)$tso2['option_value_id'] . \" \";\n\t\t\t\t//$sql .= \" AND \";\n\t\t\t\t//$sql .= \" tsgp.id IS NOT NULL \";\n\t\t\t\t$this->db->query($sql);\n\t\t\t}\n\t\t}\n\t}", "public function testSetGetDiscount()\n {\n $this->item->setPrice(85.00);\n $this->item->setQuantity(1);\n $this->item->addDiscount(\n (new FlatDiscount())\n ->setFigure(15.00)\n );\n\n $this->assertEquals($this->item->getPriceTotal(), 85.00);\n $this->assertEquals($this->item->getNetTotal(), 70.00);\n $this->assertEquals($this->item->getDiscount(), 15.00);\n }", "function setSyncItemsPriceStandard()\n {\n }", "private function setEnableReviews() {\n $this->product->set_reviews_allowed($this->wcData->isEnableReviews());\n }", "protected function calculatePrices()\n {\n }", "function get_discounted_price( $values, $price, $add_totals = false ) {\n\t\n\t\t\tif ($this->applied_coupons) foreach ($this->applied_coupons as $code) :\n\t\t\t\t$coupon = new cmdeals_coupon( $code );\n\t\t\t\t\n\t\t\t\tif ( $coupon->apply_before_tax() && $coupon->is_valid() ) :\n\t\t\t\t\t\n\t\t\t\t\tswitch ($coupon->type) :\n\t\t\t\t\t\n\t\t\t\t\t\tcase \"fixed_deals\" :\n\t\t\t\t\t\tcase \"percent_deals\" :\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t$this_item_is_discounted = false;\n\t\t\t\t\n\t\t\t\t\t\t\t// Specific deals ID's get the discount\n\t\t\t\t\t\t\tif (sizeof($coupon->deal_ids)>0) :\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tif ((in_array($values['deal_id'], $coupon->deal_ids) || in_array($values['variation_id'], $coupon->deal_ids))) :\n\t\t\t\t\t\t\t\t\t$this_item_is_discounted = true;\n\t\t\t\t\t\t\t\tendif;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\telse :\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t// No deals ids - all items discounted\n\t\t\t\t\t\t\t\t$this_item_is_discounted = true;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tendif;\n\t\t\t\t\n\t\t\t\t\t\t\t// Specific deals ID's excluded from the discount\n\t\t\t\t\t\t\tif (sizeof($coupon->exclude_deals_ids)>0) :\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tif ((in_array($values['deal_id'], $coupon->exclude_deals_ids) || in_array($values['variation_id'], $coupon->exclude_deals_ids))) :\n\t\t\t\t\t\t\t\t\t$this_item_is_discounted = false;\n\t\t\t\t\t\t\t\tendif;\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tendif;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Apply filter\n\t\t\t\t\t\t\t$this_item_is_discounted = apply_filters( 'cmdeals_item_is_discounted', $this_item_is_discounted, $values, $before_tax = true );\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Apply the discount\n\t\t\t\t\t\t\tif ($this_item_is_discounted) :\n\t\t\t\t\t\t\t\tif ($coupon->type=='fixed_deals') :\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tif ($price < $coupon->amount) :\n\t\t\t\t\t\t\t\t\t\t$discount_amount = $price;\n\t\t\t\t\t\t\t\t\telse :\n\t\t\t\t\t\t\t\t\t\t$discount_amount = $coupon->amount;\n\t\t\t\t\t\t\t\t\tendif;\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t$price = $price - $coupon->amount;\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tif ($price<0) $price = 0;\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tif ($add_totals) :\n\t\t\t\t\t\t\t\t\t\t$this->discount_cart = $this->discount_cart + ( $discount_amount * $values['quantity'] );\n\t\t\t\t\t\t\t\t\tendif;\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\telseif ($coupon->type=='percent_deals') :\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t$percent_discount = ( $values['data']->get_price( false ) / 100 ) * $coupon->amount;\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tif ($add_totals) $this->discount_cart = $this->discount_cart + ( $percent_discount * $values['quantity'] );\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t$price = $price - $percent_discount;\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tendif;\n\t\t\t\t\t\t\tendif;\n\t\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\n\t\t\t\t\t\tcase \"fixed_cart\" :\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t/** \n\t\t\t\t\t\t\t * This is the most complex discount - we need to divide the discount between rows based on their price in\n\t\t\t\t\t\t\t * proportion to the subtotal. This is so rows with different tax rates get a fair discount, and so rows\n\t\t\t\t\t\t\t * with no price (free) don't get discount too.\n\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Get item discount by dividing item cost by subtotal to get a %\n\t\t\t\t\t\t\t$discount_percent = ($values['data']->get_price( false )*$values['quantity']) / $this->subtotal_ex_tax;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Use pence to help prevent rounding errors\n\t\t\t\t\t\t\t$coupon_amount_pence = $coupon->amount * 100;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Work out the discount for the row\n\t\t\t\t\t\t\t$item_discount = $coupon_amount_pence * $discount_percent;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Work out discount per item\n\t\t\t\t\t\t\t$item_discount = $item_discount / $values['quantity'];\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Pence\n\t\t\t\t\t\t\t$price = ( $price * 100 );\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Check if discount is more than price\n\t\t\t\t\t\t\tif ($price < $item_discount) :\n\t\t\t\t\t\t\t\t$discount_amount = $price;\n\t\t\t\t\t\t\telse :\n\t\t\t\t\t\t\t\t$discount_amount = $item_discount;\n\t\t\t\t\t\t\tendif;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Take discount off of price (in pence)\n\t\t\t\t\t\t\t$price = $price - $discount_amount;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Back to pounds\n\t\t\t\t\t\t\t$price = $price / 100; \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Cannot be below 0\n\t\t\t\t\t\t\tif ($price<0) $price = 0;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Add coupon to discount total (once, since this is a fixed cart discount and we don't want rounding issues)\n\t\t\t\t\t\t\tif ($add_totals) $this->discount_cart = $this->discount_cart + (($discount_amount*$values['quantity']) / 100);\n\t\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\n\t\t\t\t\t\tcase \"percent\" :\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Get % off each item - this works out the same as doing the whole cart\n\t\t\t\t\t\t\t//$percent_discount = ( $values['data']->get_price( false ) / 100 ) * $coupon->amount;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t$percent_discount = ( $values['data']->get_price( ) / 100 ) * $coupon->amount;\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tif ($add_totals) $this->discount_cart = $this->discount_cart + ( $percent_discount * $values['quantity'] );\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t$price = $price - $percent_discount;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\n\t\t\t\t\tendswitch;\n\t\t\t\t\t\n\t\t\t\tendif;\n\t\t\tendforeach;\n\t\t\t\n\t\t\treturn apply_filters( 'cmdeals_get_discounted_price_', $price, $values, $this );\n\t\t}", "public function get_manual_discounts()\r\n\t{\r\n\t\t// Set aliases of discount table data.\r\n\t\t$tbl_cols_discounts = $this->flexi->cart_database['discounts']['columns'];\r\n\t\t$tbl_cols_discount_calculations = $this->flexi->cart_database['discount_calculation']['columns'];\r\n\r\n\t\t$manual_set_discounts = $this->flexi->cart_contents['settings']['discounts']['manual'];\r\n\r\n\t\t$discounts = array();\t\r\n\t\tif (! empty($manual_set_discounts))\r\n\t\t{\r\n\t\t\tforeach($manual_set_discounts as $column)\r\n\t\t\t{\t\t\t\r\n\t\t\t\t$discounts[$column['column']][] = array(\r\n\t\t\t\t\t'id' => $column['id'],\r\n\t\t\t\t\t'calculation_id' => $column['calculation'],\r\n\t\t\t\t\t'code' => FALSE,\r\n\t\t\t\t\t'description' => $column['description'],\r\n\t\t\t\t\t'quantity_required' => 1,\r\n\t\t\t\t\t'quantity_discounted' => 1,\r\n\t\t\t\t\t'value_required' => 0,\r\n\t\t\t\t\t'value_discounted' => $column['value'],\r\n\t\t\t\t\t'recursive' => 0,\r\n\t\t\t\t\t'non_combinable' => FALSE,\r\n\t\t\t\t\t'void_reward_points' => (bool)$column['void_reward_points'],\r\n\t\t\t\t\t'force_shipping_discount' => FALSE,\r\n\t\t\t\t\t'tax_method' => $column['tax_method']\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\treturn $discounts;\r\n\t}", "protected function applyDiscounts()\n {\n $discounts = $this->booking->bookingDiscounts;\n $this->discountedPeriodsTotal = $this->periodsTotal;\n $discountedTotal = $this->periodsTotal;\n\n if (!$discounts) return;\n\n // Apply discounts based on the order of discount sequence.\n foreach ($this->discountSequence as $sequence) {\n // Filter discounts so that we don't have to loop through all of them.\n $filteredDiscounts = $discounts->where('type', $sequence);\n\n $methodName = \"apply\" . Str::studly($sequence) . \"Discount\";\n\n // Apply and store discount information.\n foreach ($filteredDiscounts as $filteredDiscount) {\n $discountInformation = ['beforeDiscount' => $discountedTotal];\n $discountedTotal = $this->$methodName($discountedTotal, $filteredDiscount);\n $discountInformation['afterDiscount'] = $discountedTotal;\n\n if (!$this->discountApplied($discountInformation['beforeDiscount'], $discountInformation['afterDiscount'])) {\n continue;\n }\n\n $discountInformation['discount'] = $filteredDiscount;\n $this->appliedDiscounts[] = $discountInformation;\n }\n }\n\n $this->discountedPeriodsTotal = $discountedTotal;\n }", "function getDiscountFor($product) {\n\t\treturn 30;\n\t}", "public function detectCombos()\n {\n foreach ($this->order->getProducts() as $k => $product) {\n if ($product->getCategory() == 'Shampoo') {\n foreach ($this->order->getProducts() as $key => $productB) {\n if ($productB->getCategory() == 'Conditioner') {\n $productB->setDiscount(0.5);\n }\n }\n }\n }\n }", "public function setBaseDiscountAmount($amount);", "public function smart_coupons_discount_total_filters() {\n\t\t\tif ( WCS_SC_Compatibility::is_cart_contains_subscription() && WCS_SC_Compatibility::is_wcs_gte( '2.0.0' ) ) {\n\t\t\t\tadd_action( 'woocommerce_after_calculate_totals', array( $this, 'smart_coupons_after_calculate_totals' ), 999 );\n\t\t\t} else {\n\t\t\t\tadd_action( 'woocommerce_after_calculate_totals', array( $this, 'smart_coupons_after_calculate_totals' ), 999 );\n\t\t\t\tglobal $current_screen;\n\t\t\t\tif ( ! empty( $current_screen ) && 'edit-shop_order' !== $current_screen ) {\n\t\t\t\t\tadd_filter( 'woocommerce_order_get_total', array( $this, 'smart_coupons_order_discounted_total' ), 10, 2 );\n\t\t\t\t}\n\t\t\t}\n\t\t}", "function fuc_discount($product, $percentage){\r\n $discountValue = $product / 100 * $percentage;\r\n $totalValue = $product - $discountValue; \r\n return $totalValue;\r\n\r\n}", "function apply_special_category_discount($category, $count, &$disc_amount) {\r\n switch($category) {\r\n case 99999:\r\n case 99998:\r\n if ($count > 100) {\r\n $disc_amount = 50; \r\n }\r\n break; \r\n case 99997:\r\n $disc_amount = 75;\r\n break;\r\n }\r\n }", "private function setRecountProduct() {\n\n //$this->model->setDocumentNumber($this->getDocumentNumber);\n $sql = null;\n if ($this->getVendor() == self::MYSQL) {\n $sql = \"\n INSERT INTO `productrecount` \n (\n `companyId`,\n `warehouseId`,\n `productCode`,\n `productDescription`,\n `productRecountDate`,\n `productRecountSystemQuantity`,\n `productRecountPhysicalQuantity`,\n `isDefault`,\n `isNew`,\n `isDraft`,\n `isUpdate`,\n `isDelete`,\n `isActive`,\n `isApproved`,\n `isReview`,\n `isPost`,\n `executeBy`,\n `executeTime`\n ) VALUES ( \n '\" . $this->getCompanyId() . \"',\n '\" . $this->model->getWarehouseId() . \"',\n '\" . $this->model->getProductCode() . \"',\n '\" . $this->model->getProductDescription() . \"',\n '\" . $this->model->getProductRecountDate() . \"',\n '\" . $this->model->getProductRecountSystemQuantity() . \"',\n '\" . $this->model->getProductRecountPhysicalQuantity() . \"',\n '\" . $this->model->getIsDefault(0, 'single') . \"',\n '\" . $this->model->getIsNew(0, 'single') . \"',\n '\" . $this->model->getIsDraft(0, 'single') . \"',\n '\" . $this->model->getIsUpdate(0, 'single') . \"',\n '\" . $this->model->getIsDelete(0, 'single') . \"',\n '\" . $this->model->getIsActive(0, 'single') . \"',\n '\" . $this->model->getIsApproved(0, 'single') . \"',\n '\" . $this->model->getIsReview(0, 'single') . \"',\n '\" . $this->model->getIsPost(0, 'single') . \"',\n '\" . $this->model->getExecuteBy() . \"',\n \" . $this->model->getExecuteTime() . \"\n );\";\n } else {\n if ($this->getVendor() == self::MSSQL) {\n $sql = \"\n INSERT INTO [productRecount]\n (\n [productRecountId],\n [companyId],\n [warehouseId],\n [productCode],\n [productDescription],\n [productRecountDate],\n [productRecountSystemQuantity],\n [productRecountPhysicalQuantity],\n [isDefault],\n [isNew],\n [isDraft],\n [isUpdate],\n [isDelete],\n [isActive],\n [isApproved],\n [isReview],\n [isPost],\n [executeBy],\n [executeTime]\n) VALUES (\n '\" . $this->getCompanyId() . \"',\n '\" . $this->model->getWarehouseId() . \"',\n '\" . $this->model->getProductCode() . \"',\n '\" . $this->model->getProductDescription() . \"',\n '\" . $this->model->getProductRecountDate() . \"',\n '\" . $this->model->getProductRecountSystemQuantity() . \"',\n '\" . $this->model->getProductRecountPhysicalQuantity() . \"',\n '\" . $this->model->getIsDefault(0, 'single') . \"',\n '\" . $this->model->getIsNew(0, 'single') . \"',\n '\" . $this->model->getIsDraft(0, 'single') . \"',\n '\" . $this->model->getIsUpdate(0, 'single') . \"',\n '\" . $this->model->getIsDelete(0, 'single') . \"',\n '\" . $this->model->getIsActive(0, 'single') . \"',\n '\" . $this->model->getIsApproved(0, 'single') . \"',\n '\" . $this->model->getIsReview(0, 'single') . \"',\n '\" . $this->model->getIsPost(0, 'single') . \"',\n '\" . $this->model->getExecuteBy() . \"',\n \" . $this->model->getExecuteTime() . \"\n );\";\n } else {\n if ($this->getVendor() == self::ORACLE) {\n $sql = \"\n INSERT INTO PRODUCTRECOUNT\n (\n COMPANYID,\n WAREHOUSEID,\n PRODUCTCODE,\n PRODUCTDESCRIPTION,\n PRODUCTRECOUNTDATE,\n PRODUCTRECOUNTSYSTEMQUANTITY,\n PRODUCTRECOUNTPHYSICALQUANTITY,\n ISDEFAULT,\n ISNEW,\n ISDRAFT,\n ISUPDATE,\n ISDELETE,\n ISACTIVE,\n ISAPPROVED,\n ISREVIEW,\n ISPOST,\n EXECUTEBY,\n EXECUTETIME\n ) VALUES (\n '\" . $this->getCompanyId() . \"',\n '\" . $this->model->getWarehouseId() . \"',\n '\" . $this->model->getProductCode() . \"',\n '\" . $this->model->getProductDescription() . \"',\n '\" . $this->model->getProductRecountDate() . \"',\n '\" . $this->model->getProductRecountSystemQuantity() . \"',\n '\" . $this->model->getProductRecountPhysicalQuantity() . \"',\n '\" . $this->model->getIsDefault(0, 'single') . \"',\n '\" . $this->model->getIsNew(0, 'single') . \"',\n '\" . $this->model->getIsDraft(0, 'single') . \"',\n '\" . $this->model->getIsUpdate(0, 'single') . \"',\n '\" . $this->model->getIsDelete(0, 'single') . \"',\n '\" . $this->model->getIsActive(0, 'single') . \"',\n '\" . $this->model->getIsApproved(0, 'single') . \"',\n '\" . $this->model->getIsReview(0, 'single') . \"',\n '\" . $this->model->getIsPost(0, 'single') . \"',\n '\" . $this->model->getExecuteBy() . \"',\n \" . $this->model->getExecuteTime() . \"\n );\";\n }\n }\n }\n try {\n $this->q->create($sql);\n } catch (\\Exception $e) {\n $this->q->rollback();\n echo json_encode(array(\"success\" => false, \"message\" => $e->getMessage()));\n exit();\n }\n }", "function changeCartSpecial(){\n\t\t$this->getCart();\n\t\t\n\t\t$key = \t\t\tclean_variable($_POST['key'],true);\n\t\t$PRC = \t\t\tclean_variable($_POST['price'],true);\n\t\t$SLCT = \t\t(isset($_POST['selections']))?\n\t\t\t\t\t\t\t\t\t((!is_array($_POST['selections'])) ? array ($_POST['selections'] ) : $_POST['selections']):\n\t\t\t\t\t\t\t\tarray();\n\t\tif(is_array($SLCT)) foreach($SLCT as &$v) clean_variable($v,true);\n\t\t\n\t\tif(count($this->Cart) == 0) header(sprintf(\"Location: %s\", $this->Files['Cart'] ));\n\t\t\n\t\t$this->Cart[$key]['price'] = $PRC;\n\t\tif(is_array($SLCT) && count($SLCT) > 0) $TmpStrg = implode(\":\",$SLCT); else $TmpStrg = $SLCT;\n\t\t$this->Cart[$key][\"selections\"] = $TmpStrg;\n\t\t\n\t\t$this->setCart();\n\t\t\n\t\theader(sprintf(\"Location: %s\", $this->Files['Cart']));\n\t}", "public function set_credits_discountamount($observer)\n {\n$array2 = Mage::helper('kartparadigm_storecredit')->getCreditRates();\n//Mage::log(Mage::helper('kartparadigm_storecredit')->getRefundDeductConfig() . \" configuration settings \");\n//Mage::log($array2);\n $session = Mage::getSingleton('checkout/session');\n if(Mage::helper('customer')->isLoggedIn()) {\n $customer = Mage::getSingleton('customer/session')->getCustomer();\n $customer_group=Mage::getModel('customer/group')->load(Mage::getSingleton('customer/session')->getCustomerGroupId())->getCustomerGroupCode();\n}\n \n$val1 = Mage::getSingleton('adminhtml/session')->getValue();\nif(isset($val1))\n{\n$amt1 = array();\n$amt1 = Mage::getSingleton('checkout/session')->getCredits();\n$amt = $amt1['totalCredits'];\n$quote = Mage::getSingleton('adminhtml/session_quote')->getQuote();\n}\nelse{\n$amt1 = array();\n $quote = Mage::getModel('checkout/cart')->getQuote();\n$amt1 = Mage::getSingleton('checkout/session')->getCredits();\n$amt = $amt1['discountCredits'];\n}\n $isvirtual=0;\n foreach($quote->getAllItems() as $item){\n if($item->getIsVirtual()==1) {\n $isvirtual=1;\n }\n if(Mage::getModel('catalog/product')->load($item->getProductId())->getTypeId()=='customproduct'){\n $isvirtual=1;\n }\n }\n$total=$quote->getGrandTotal(); \n\n$subTotal = $quote->getSubtotal();\n//Mage::log($quote->getGrandTotal().\"this is grand total store credit\");\n//Mage::log($quote->getSubtotal().\"this is sub total\");\n\n if (!Mage::helper('kartparadigm_storecredit')->getTaxEnabled()){\n$tax = $quote->getShippingAddress()->getData('tax_amount');\n}\n if(!Mage::helper('kartparadigm_storecredit')->getIsShippingEnabled()){\n$shippingPrice = $quote->getShippingAddress()->getShippingAmount();\n}\n$totalCredits1 = array();\n$totalCredits1 = Mage::getSingleton('checkout/session')->getCredits();\n$totalCredits = $totalCredits1['totalCredits'];\n\n$currentTimestamp = Mage::getModel('core/date')->timestamp(time()); \n$nowdate = date('Y-m-d H:m:s', $currentTimestamp); \n//echo $expirydate;\n//echo $nowdate;\n$balance;\n//echo $amt;\n$amt2;\n $amt1;\n \n\nif(isset($amt)){\n/*---------------------Calculating Default Currency Value----------------------- */\n$amt1 = ($array2['basevalue'] * $amt) / $array2['credits'];\n $baseCurrencyCode = Mage::app()->getStore()->getBaseCurrencyCode();\n $currentCurrencyCode = Mage::app()->getStore()->getCurrentCurrencyCode();\n if ($baseCurrencyCode != $currentCurrencyCode) {\n $amt2 = Mage::helper('directory')->currencyConvert($amt1, $baseCurrencyCode, $currentCurrencyCode);\n }\n else{\n $amt2 = $amt1; \n }\n // $amt2 = Mage::helper('core')->currency($amt1, true, false);\n//Mage::log($amt1.\" = amount = \".$amt2 );\n//----------------------------------------------------------------\nif($total > $amt2) {\nif(($total - $tax - $shippingPrice) > $amt2){\n$discountAmount = $amt2;\n$balance = $totalCredits - $amt;\n}else{\n $discountAmount = $subTotal;\n$points = round(($discountAmount * $amt)/$amt2);\n//Mage::log($points.\"Conver Points\");\n$balance = $totalCredits - $points;\n}\n}\nelse {\n$discountAmount = $total - $tax - $shippingPrice;\n$points = round(($discountAmount * $amt)/$amt2);\n//Mage::log($points.\"Conver Points\");\n$balance = $totalCredits - $points;\n}\nMage::getSingleton('core/session')->setBalance($balance);\n\nMage::getSingleton('checkout/session')->setDiscount($totalCredits - $balance);\n$msg = \"Current Credits In Your Account : \" . $balance;\nMage::getSingleton('core/session')->setCredits($msg);\n if ($discountAmount > 0) {\n\n\nif ($baseCurrencyCode != $currentCurrencyCode) {\n \n$allowedCurrencies = Mage::getModel('directory/currency')->getConfigAllowCurrencies();\n$rates = Mage::getModel('directory/currency')->getCurrencyRates($baseCurrencyCode, array_values($allowedCurrencies));\n\n$baseDiscount = $discountAmount/$rates[$currentCurrencyCode];\n\n }\nelse{\n $baseDiscount = $discountAmount;\n } \n $total = $quote->getBaseSubtotal();\n $data1 = $quote->getData();\n // Mage::log($data1['entity_id'].\"quote id\");\n $quote->setSubtotal(0);\n $quote->setBaseSubtotal(0);\n $quote->setSubtotalWithDiscount(0);\n $quote->setBaseSubtotalWithDiscount(0);\n $quote->setGrandTotal(0);\n $quote->setBaseGrandTotal(0);\n $canAddItems = $quote->isVirtual() ? ('billing') : ('shipping');\n foreach($quote->getAllAddresses() as $address) {\n $data = $address->getData();\n $address->setSubtotal(0);\n $address->setBaseSubtotal(0);\n $address->setGrandTotal(0);\n $address->setBaseGrandTotal(0);\n $address->collectTotals();\n $quote->setSubtotal((float)$quote->getSubtotal() + $address->getSubtotal());\n $quote->setBaseSubtotal((float)$quote->getBaseSubtotal() + $address->getBaseSubtotal());\n $quote->setSubtotalWithDiscount((float)$quote->getSubtotalWithDiscount() + $address->getSubtotalWithDiscount());\n $quote->setBaseSubtotalWithDiscount((float)$quote->getBaseSubtotalWithDiscount() + $address->getBaseSubtotalWithDiscount());\n $quote->setGrandTotal((float)$quote->getGrandTotal() + $address->getGrandTotal());\n $quote->setBaseGrandTotal((float)$quote->getBaseGrandTotal() + $address->getBaseGrandTotal());\n $quote->setEntityId($data1['entity_id'])->save();\n $quote->setSubtotalWithDiscount($quote->getSubtotal() - $discountAmount)->setBaseSubtotalWithDiscount($quote->getBaseSubtotal() - $baseDiscount)->setEntityId($data1['entity_id'])->save();\n if ($address->getAddressType() == $canAddItems) {\n $address->setSubtotalWithDiscount((float)$data['subtotal_with_discount'] - $discountAmount);\n $address->setGrandTotal((float)$data['grand_total'] - $discountAmount);\n $address->setBaseSubtotalWithDiscount((float)$data['base_subtotal_with_discount'] - $baseDiscount);\n $address->setBaseGrandTotal((float)$data['base_grand_total'] - $baseDiscount);\n if ($data['discount_description']) {\n $address->setDiscountAmount(($data['discount_amount'] - $discountAmount));\n $address->setDiscountDescription($data['discount_description'] . ', Store Credits');\n $address->setBaseDiscountAmount(($data['base_discount_amount'] - $baseDiscount));\n }\n else {\n $address->setDiscountAmount(-($discountAmount));\n $address->setDiscountDescription('Store Credits');\n $address->setBaseDiscountAmount(-($baseDiscount));\n }\n $address->setAddressId($data['address_id'])->save();\n }\n }\n foreach($quote->getAllItems() as $item) {\n\n // We apply discount amount based on the ratio between the GrandTotal and the RowTotal\n $rat = $item->getPriceInclTax() / $quote->getSubtotal();\n $rat1 = $item->getBasePriceInclTax() / $quote->getBaseSubtotal();\n $ratdisc = $discountAmount * $rat;\n $ratdisc1 = $baseDiscount * $rat1;\n//Mage::log($item->getDiscountAmount().\"include tax\".$item->getBaseDiscountAmount());\n // Mage::log($item->getDiscountAmount().\"discount storecredit\");\n$idata = $item->getData();\n Mage::log($item->getDiscountAmount().\"discount amount credit\");\n $item->setDiscountAmount(($item->getDiscountAmount() + $ratdisc) * $item->getQty());\n $item->setBaseDiscountAmount(($item->getBaseDiscountAmount() + $ratdisc1) * $item->getQty())->save();\n }\n }else if($totalCredits == 0){\n\n$msg = \"Sorry You Have No Credits In Your Account\";\nMage::getSingleton('core/session')->setCredits($msg);\n}\n \n \n } \n }", "function update_discount_codes()\n\t\t{\n\t\t\t// Get the discount codes from the submitted POST data.\n\t\t\t$discount_data = $this->input->post('discount');\n\t\t\t\n\t\t\t// The 'update_discount_codes()' function will validate each submitted code and apply the discounts that have activated their quantity and value requirements.\n\t\t\t// Any previously set codes that have now been set as blank (i.e. no longer present) will be removed.\n\t\t\t// Note: Only 1 discount can be applied per item and per summary column. \n\t\t\t// For example, 2 discounts cannot be applied to the summary total, but 1 discount could be applied to the shipping total, and another to the summary total.\n\t\t\t$this->flexi_cart->update_discount_codes($discount_data);\n\t\t\t\n\t\t\t// Set a message to the CI flashdata so that it is available after the page redirect.\n\t\t\t$this->session->set_flashdata('message', $this->flexi_cart->get_messages());\n\n\t\t\tredirect('cart');\n\t\t}", "public function setBaseShippingDiscountAmount($amount);", "public function setDiscountAmount($value){\n return $this->setParameter('discount_amount', $value);\n }", "public function setNoMultiShipping(){\n $emptyCache = false;\n $db = JFactory::getDBO();\n if (JeproshopSettingModelSetting::getValue('allow_multi_shipping')){\n // Upgrading quantities\n $query = \"SELECT sum(\" . $db->quoteName('quantity') . \") AS quantity, product_id, product_attribute_id, count(*) as count FROM \";\n $query .= $db->quoteName('#__jeproshop_cart_product') . \" WHERE \" . $db->quoteName('cart_id') . \" = \" . (int)$this->cart_id . \" AND \" ;\n $query .= $db->quoteName('shop_id') . \" = \" . (int)$this->shop_id . \" GROUP BY product_id, product_attribute_id HAVING count > 1\";\n\n $db->setQuery($query);\n $products = $db->loadObjectList();\n\n foreach ($products as $product){\n $query = \"UPDATE \" . $db->quoteName('#__jeproshop_cart_product') . \" SET \" . $db->quoteName('quantity') . \" = \" . $product->quantity;\n $query .= \"\tWHERE \" . $db->quoteName('cart_id') . \" = \".(int)$this->cart_id . \" AND \" . $db->quoteName('shop_id') . \" = \" . (int)$this->shop_id ;\n $query .= \" AND product_id = \" . $product->product_id . \" AND product_attribute_id = \" . $product->product_attribute_id;\n $db->setQuery($query);\n if ($db->query())\n $emptyCache = true;\n }\n\n // Merging multiple lines\n $query = \"DELETE cart_product_1 FROM \" . $db->quoteName('#__jeproshop_cart_product') . \" AS cart_product_1 INNER JOIN \";\n $query .= $db->quoteName('#__jeproshop_cart_product') . \" AS cart_product_2 ON ((cart_product_1.cart_id = cart_product_2.\";\n $query .= \"cart_id) AND (cart_product_1.product_id = cart_product_2.product_id) AND (cart_product_1.product_attribute_id = \";\n $query .= \"cart_product_2.product_attribute_id) AND (cart_product_1.address_delivery_id <> cart_product_2.address_delivery_id) \";\n $query .= \" AND (cart_product_1.date_add > cart_product_2.date_add) )\";\n $db->setQuery($query);\n $db->query();\n }\n\n // Update delivery address for each product line\n $query = \"UPDATE \" . $db->quoteName('#__jeproshop_cart_product') . \" SET \" . $db->quoteName('address_delivery_id') . \" = ( SELECT \";\n $query .= $db->quoteName('address_delivery_id') . \" FROM \" . $db->quoteName('#__jeproshop_cart') . \" WHERE \" . $db->quoteName('cart_id');\n $query .= \" = \" . (int)$this->cart_id . \" AND \" . $db->quoteName('shop_id') . \" = \" . (int)$this->shop_id . \") WHERE \" . $db->quoteName('cart_id');\n $query .= \" = \" . (int)$this->cart_id . (JeproshopSettingModelSetting::getValue('allow_multi_shipping') ? \" AND \" . $db->quoteName('shop_id') . \" = \" .(int)$this->shop_id : \"\");\n\n $db->setQuery($query);\n\n $cache_id = 'jeproshop_cart_set_no_multi_shipping'.(int)$this->cart_id.'_'.(int)$this->shop_id .((isset($this->address_delivery_id) && $this->address_delivery_id) ? '-'.(int)$this->address_delivery_id : '');\n if (!JeproshopCache::isStored($cache_id)){\n $db->setQuery($query);\n if ($result = (bool)$db->query())\n $emptyCache = true;\n JeproshopCache::store($cache_id, $result);\n }\n\n if (JeproshopCustomization::isFeaturePublished()){\n //Db::getInstance()->execute(\n\t\t\t$query = \" UPDATE \" . $db->quoteName('#__jeproshop_customization') . \" SET \" . $db->quoteName('address_delivery_id') . \" = ( SELECT \";\n $query .= $db->quoteName('address_delivery_id') . \" FROM \" . $db->quoteName('#__jeproshop_cart') . \" WHERE \" . $db->quoteName('cart_id');\n $query .= \" = \" . (int)$this->cart_id . \" ) WHERE \" . $db->quoteName('cart_id') . \" = \" .(int)$this->cart_id;\n\n $db->setQuery($query);\n $db->query();\n }\n if ($emptyCache){\n $this->_products = null;\n }\n }", "public function applyDefaults()\n {\n $addressInfo = $this->_getDefaultAddress();\n $this->saveBilling(\n $addressInfo['billing'],\n $addressInfo['billing']['customer_address_id'],\n false\n );\n if (!$addressInfo['billing']['use_for_shipping']) {\n $this->saveShipping(\n $addressInfo['shipping'],\n $addressInfo['shipping']['customer_address_id'],\n false\n );\n }\n\n /**\n * @var Mage_Sales_Model_Quote\n */\n $quote = $this->getQuote();\n $shippingAddress = $quote->getShippingAddress();\n\n // weight vs destination fix\n $weight = 0;\n foreach($quote->getAllItems() as $item) {\n $weight += ($item->getWeight() * $item->getQty()) ;\n }\n $shippingAddress->setFreeMethodWeight($weight)->setWeight($weight);\n\n $shippingAddress->collectTotals()->collectShippingRates()->save();\n $this->applyShippingMethod();\n // shipping method may affect the total in both sides (discount on using shipping address)\n $quote->collectTotals();\n\n $ajaxHelper = Mage::helper('firecheckout/ajax');\n if ($ajaxHelper->getIsShippingMethodDependsOn('total')) {\n // changing total by shipping price may affect the shipping prices theoretically\n // (free shipping may be canceled or added)\n $shippingAddress->setCollectShippingRates(true)->collectShippingRates();\n // if shipping price was changed, we need to recalculate totals again.\n // Example: SELECTED SHIPPING METHOD NOW BECOMES FREE\n // previous method added a discount and selected shipping method wasn't free\n // but removing the previous shipping method removes the discount also\n // and selected shipping method is now free\n $quote->setTotalsCollectedFlag(false)->collectTotals();\n }\n\n $this->applyPaymentMethod();\n if ($ajaxHelper->getIsTotalDependsOn('payment-method')) { // @todo && method is changed\n // recollect totals again because adding/removing payment\n // method may add/remove some discounts in the order\n\n // to recollect discount rules need to clear previous discount\n // descriptions and mark address as modified\n // see _canProcessRule in Mage_SalesRule_Model_Validator\n $shippingAddress->setDiscountDescriptionArray(array())->isObjectNew(true);\n\n $quote->setTotalsCollectedFlag(false)->collectTotals();\n }\n\n $quote->save();\n\n return $this;\n }", "public function applyPromotion()\n {\n $this->promotion->setOrder($this);\n }", "public function setDiscount(string $discount)\n\t{\n\t\t$this->addKeyValue('Discount', $discount); \n\n\t}", "public function update_all()\n\t{\n\t\t$option = JRequest::getVar('option');\n\t\t$post = JRequest::get('post');\n\t\t$Itemid = JRequest::getVar('Itemid');\n\t\t$redhelper = new redhelper;\n\t\t$Itemid = $redhelper->getCartItemid();\n\t\t$model = $this->getModel('cart');\n\n\t\t// Call update_all method of model to update all products info of cart\n\t\t$model->update_all($post);\n\t\t$this->_carthelper->cartFinalCalculation();\n\t\t$this->_carthelper->carttodb();\n\t\t$link = JRoute::_('index.php?option=' . $option . '&view=cart&Itemid=' . $Itemid, false);\n\t\t$this->setRedirect($link);\n\t}", "function pricing() {\n\t\t\tparent::controller();\n\t\t\t\n\t\t}", "public function setShippingDiscountAmount($amount);", "public function applyDiscount()\n {\n if (request('discountType') == 1) {\n cart()->applyDiscount($percentage = request('red'));\n return $this->getCartDetails();\n }\n cart()->applyFlatDiscount($amount = request('discountInput'));\n\n return redirect()->route('cart');\n }", "public function magicMethod(){\n $cart = $this->_getCart();\n $quoteArrayFreeProducts = array();\n $quoteArrayNonFreeProducts = array();\n $AddThisInCart = array();\n $finalAdd = array();\n\n // finding both free and non free products and saving them in array\n $quote = Mage::getSingleton('checkout/session')->getQuote();\n foreach($quote->getAllVisibleItems() as $item) {\n if($item->getData('price') == 0){\n $quoteArrayFreeProducts['item_id'][] = $item->getData('product_id');\n $quoteArrayFreeProducts['qty'][] = $item->getData('qty');\n }else{\n $quoteArrayNonFreeProducts['item_id'][] = $item->getData('product_id');\n $quoteArrayNonFreeProducts['qty'][] = $item->getData('qty');\n }\n }\n \n // print_r($quoteArrayFreeProducts);die;\n // finding free associatied produts and adding them in another array\n for($i = 0; $i < count($quoteArrayNonFreeProducts['item_id']) ;$i++){\n $product = Mage::getModel('catalog/product')->load($quoteArrayNonFreeProducts['item_id'][$i]);\n // print_r($product->getAttributeText('buyxgety'));die;\n if($product->getAttributeText('buyxgety') == 'Enable'){\n $Buyxgety_xqty = $product->getBuyxgety_xqty();\n $Buyxgety_ysku = $product->getBuyxgety_ysku();\n $Buyxgety_yqty = $product->getBuyxgety_yqty();\n\n // $Buyxgety_ydiscount = $product->getBuyxgety_ydiscount();\n if(!empty($Buyxgety_xqty) && !empty($Buyxgety_ysku) && !empty($Buyxgety_yqty) ){\n // die($Buyxgety_ysku);\n $AddThisInCart['item_id'][] = Mage::getModel('catalog/product')->getIdBySku($Buyxgety_ysku);\n $AddThisInCart['qty'][] = (int)($quoteArrayNonFreeProducts['qty'][$i]/$Buyxgety_xqty)*$Buyxgety_yqty;\n }\n }\n }\n for($i = 0; $i < count($AddThisInCart['item_id']) ;$i++){\n if(isset($quoteArrayFreeProducts['item_id'])){\n for($j = 0; $j < count($quoteArrayFreeProducts['item_id']) ;$j++){\n if($AddThisInCart['item_id'][$i] == $quoteArrayFreeProducts['item_id'][$j]){\n $finalAdd['item_id'][] = $AddThisInCart['item_id'][$i];\n $finalAdd['qty'][] = $AddThisInCart['qty'][$i] - $quoteArrayFreeProducts['qty'][$j];\n }else{\n $finalAdd['item_id'][] = $AddThisInCart['item_id'][$i];\n $finalAdd['qty'][] = $AddThisInCart['qty'][$i];\n }\n }\n }else{\n $finalAdd['item_id'][] = $AddThisInCart['item_id'][$i];\n $finalAdd['qty'][] = $AddThisInCart['qty'][$i];\n }\n }\n\n for($i = 0; $i < count($finalAdd['item_id']) ;$i++){\n for($j = 0; $j < count($quoteArrayNonFreeProducts['item_id']); $j++){\n if($finalAdd['item_id'][$i] == $quoteArrayNonFreeProducts['item_id'][$j]){\n foreach ($quoteArrayFreeProducts['item_id'] as $value) {\n if($value == $finalAdd['item_id'][$i]){\n $flag = 1;\n }else{\n $flag = 0;\n }\n }\n if($flag == 1){\n $finalAdd['new_row'][] = 0;\n }else{\n $finalAdd['new_row'][] = 1;\n }\n }\n }\n if(!empty($quoteArrayFreeProducts['item_id'])){\n for($j = 0; $j < count($quoteArrayFreeProducts['item_id']); $j++){\n if($finalAdd['item_id'][$i] == $quoteArrayFreeProducts['item_id'][$j]){\n $finalAdd['new_row'][] = 0;\n }else{\n $finalAdd['new_row'][] = 1;\n }\n }\n }else{\n $finalAdd['new_row'][] = 1;\n } \n }\n\n // print_r($finalAdd);die;\n\n if(isset($finalAdd['item_id'])){\n for($i = 0; $i < count($finalAdd['item_id']) ;$i++){\n if($finalAdd['qty'][$i] > 0){\n Mage::getSingleton('core/session')->setMultilineAddingObserver($finalAdd['new_row'][$i]);\n Mage::getSingleton('core/session')->setZeroSettingObserver(1);\n if($finalAdd['new_row'][$i] == 0){\n $cartHelper = Mage::helper('checkout/cart');\n $items = $cartHelper->getCart()->getItems(); \n foreach ($items as $item) \n {\n $itemId = $item->getItemId();\n if($item->getProductId() == $finalAdd['item_id'][$i] && $item->getPrice() == 0){\n $cartHelper->getCart()->removeItem($itemId)->save();\n $this->magicMethod();\n }\n }\n }else{\n $productToAdd = $product->load($finalAdd['item_id'][$i]);\n $params['qty'] = $finalAdd['qty'][$i];\n $params['product'] = $finalAdd['item_id'][$i];\n $cart->addProduct($productToAdd, $params);\n $cart->save();\n }\n }else if($finalAdd['qty'][$i] < 0){\n $cartHelper = Mage::helper('checkout/cart');\n $items = $cartHelper->getCart()->getItems(); \n foreach ($items as $item) \n {\n $itemId = $item->getItemId();\n if($item->getProductId() == $finalAdd['item_id'][$i] && $item->getPrice() == 0){\n $cartHelper->getCart()->removeItem($itemId)->save();\n $this->_updateShoppingCart();\n }\n } \n }\n }\n }\n }", "function applyDiscountOnSubscription($subscriptionId = null)\n {\n $db = new db();\n $db->makeConnection();\n\n if($subscriptionId != null)\n {\n \t\\Stripe\\Stripe::setApiKey(STRPIE_CLIENT_SECRET);\n\n $date = date('Y-m-d 00:00:00');\n $discountTotal = 0;\n\n // Select plan having trial periods on\n // $query = \"SELECT price FROM billing_products BP INNER JOIN user_subscription_items USI ON BP.plan_id = USI.plan_id WHERE BP.trial_period != 0 AND USI.subscription_id = '{$subscriptionId}' AND USI.coupon_trial_from <= '{$date}' AND USI.coupon_trial_to >= '{$date}'\";\n $query = \"SELECT price FROM billing_products BP INNER JOIN user_subscription_items USI ON BP.plan_id = USI.plan_id WHERE BP.trial_period != 0 AND USI.subscription_id = '{$subscriptionId}' AND USI.coupon_trial_from <= '{$date}' AND USI.coupon_trial_to > '{$date}' AND USI.status = '1'\";\n $res = $db->query($query);\n\n if($db->numRows($res))\n {\n while ($rs = mysqli_fetch_array($res))\n {\n $discountTotal += $rs['price'];\n }\n\n //\n if($discountTotal)\n {\n // Fetch if coupon exist, otherwise create\n $couponId = 'OFF-'.$discountTotal;\n\n try {\n // Retrieve coupon\n $coupon = \\Stripe\\Coupon::retrieve($couponId);\n } catch (\\Stripe\\Error\\Base $e) {\n // Create coupon\n $coupon = \\Stripe\\Coupon::create([\n 'id' => $couponId,\n 'amount_off' => ($discountTotal*100),\n 'currency' => 'SEK',\n 'duration' => 'once',\n // 'duration' => 'repeating',\n // 'duration_in_months' => 3,\n ]);\n }\n\n // Apply coupon on subscription\n if($coupon)\n {\n try {\n // Update subscription\n \\Stripe\\Subscription::update(\n $subscriptionId,\n ['coupon' => $coupon->id]\n );\n } catch (\\Stripe\\Error\\Base $e) {}\n }\n }\n else\n {\n \ttry {\n $sub = \\Stripe\\Subscription::retrieve($subscriptionId);\n\n if( isset($sub->discount) && ($sub->discount != null) )\n {\n $sub->deleteDiscount();\n }\n } catch (\\Stripe\\Error\\Base $e) {}\n }\n }\n else\n {\n \ttry {\n $sub = \\Stripe\\Subscription::retrieve($subscriptionId);\n\n if( isset($sub->discount) && ($sub->discount != null) )\n {\n $sub->deleteDiscount();\n }\n } catch (\\Stripe\\Error\\Base $e) {}\n }\n }\n }", "public function isApplicable() : bool{\r\n $items = $this->order->getOrderItems();\r\n foreach($items as $item){\r\n // checks every item for order if the quantity is >= $products_nr\r\n if($item[\"quantity\"] >= $this->products_nr){\r\n $tmp_item = $this->order->getProductById($item[\"product-id\"]);\r\n\r\n // checks if product category equals $category_id \r\n if((int)$tmp_item[\"category\"] === $this->category_id){\r\n $tmp_item[\"qty\"] = $item[\"quantity\"];\r\n\r\n // saves the discounted items in a temporary array\r\n $this->items_matching[] = $tmp_item;\r\n\r\n // stores the total cost of the discount\r\n $this->discounted_value += $tmp_item[\"price\"] * floor($item[\"quantity\"] / $this->products_nr);\r\n }\r\n }\r\n }\r\n\r\n if($this->discounted_value > 0){\r\n $this->is_applicable = true;\r\n $this->calculateDiscount();\r\n return true; \r\n }\r\n return false;\r\n }", "public function setDiscountDescription($description);", "public function deleteDiscount();", "private function setPremiumCode(){\n for($i = 0; $i < 7; $i++) {\n $this->premiumCode .= rand(1,9);\n };\n $this->discount = 10;\n }", "public function setDiscounts(array $discounts)\r\n {\r\n $this->_discounts = $discounts;\r\n }", "public function setDiscount(?float $discount): self\n {\n $this->initialized['discount'] = true;\n $this->discount = $discount;\n\n return $this;\n }", "function beforeSave(){\n\t\t\t// Get the rate\n\t\t\t$rate = 1 / $this->_getRate();\n\n\t\t\t// Convert it back to USD\n\t\t\tif(!empty($this->data['Product']['rrp'])){\n\t\t\t\t$this->data['Product']['rrp'] = $this->data['Product']['rrp'] * $rate;\n\t\t\t}\n\n\t\t\tif(!empty($this->data['Product']['start_price'])){\n\t\t\t\t$this->data['Product']['start_price'] \t= $this->data['Product']['start_price'] * $rate;\n\t\t\t}\n\n\t\t\tif(!empty($this->data['Product']['delivery_cost'])){\n\t\t\t\t$this->data['Product']['delivery_cost'] = $this->data['Product']['delivery_cost'] * $rate;\n\t\t\t}\n\n\t\t\tif(!empty($this->data['Product']['fixed_price'])){\n\t\t\t\t$this->data['Product']['fixed_price'] \t= $this->data['Product']['fixed_price'] * $rate;\n\t\t\t}\n\n\t\t\tif(!empty($this->data['Product']['minimum_price'])){\n\t\t\t\t$this->data['Product']['minimum_price'] = $this->data['Product']['minimum_price'] * $rate;\n\t\t\t}\n\n\t\t\treturn true;\n\t\t}", "function applyCouponDiscounts($coupons, $shippingType = null, $cartItems){\n\t\t\t$allTotals = array();\n\t\t\t$allTotals['shippingPrice'] = $this->totals['shippingPrice'];\n\t\t\t$allTotals['giftWrapTotal'] = $this->totals['giftWrapTotal'];\n\t\t\t$allTotals['noTaxNoShipping'] = $this->totals['noTaxNoShipping'];\n\t\t\t$this->totals['discount'] = $this->Coupon->applyCoupons($coupons, $shippingType, $cartItems, $allTotals);\n\t\t\t\n\t\t\t//recalculate grandtotal:\n\t\t\t$grandTotal = 0;\n\t\t\tif(array_sum($allTotals) - $this->totals['discount'] > 0){\n\t\t\t\t$grandTotal = array_sum($allTotals) - $this->totals['discount'];\n\t\t\t}else{\n\t\t\t\t//if discounts are greater than grand total, then change discount to difference:\n\t\t\t\t$this->totals['discount'] = $this->totals['discount'] + (array_sum($allTotals) - $this->totals['discount']);\n\t\t\t}\n\t\t\t$this->totals['total'] = $grandTotal;\n\t\t}", "public function productDisableStatus($customerId){\n $productCollections = Mage::getModel ( 'catalog/product' )->getCollection ()->addAttributeToFilter ( 'userid', $customerId)->addAttributeToFilter ( 'type_id', array (\n 'eq' => 'property'\n ) );\n /**\n * Iterating the loop\n */\n foreach ( $productCollections as $product ) {\n /**\n * Get Product Id\n */\n $productId = $product->getEntityId ();\n $data = array (\n 'propertyapproved' => 0,\n 'status' => 0\n );\n $model = Mage::getModel ( 'catalog/product' )->load ( $productId )->addData ( $data );\n $model->setId ( $productId )->save ();\n }\n }", "function new_customers_discount( $cart ) {\n // Only for logged in users\n // if ( ! is_user_logged_in() ) return; // We exit\n\n // Only for new customers without orders\n // if ( wc_get_customer_order_count( get_current_user_id() ) != 0 ) return; // We exit\n\n // Set HERE your categories (can be term IDs, slugs or names) in a coma separated array\n // $product = array('', '', '', '', '', '');\n\n $fee_amount = 0;\n\n $discount = 0;\n // Loop through cart items\n\n\n foreach( $cart->get_cart() as $cart_item ){\n \tswitch ($cart_item['product_id']) {\n \t\tcase 2582:\n \t\t$fee_amount = 10;\n \t\t$discount += $cart_item['line_subtotal']*$fee_amount/100;\n \t\tbreak;\n \t\tcase 2591:\n \t\t$fee_amount = 10;\n \t\t$discount += $cart_item['line_subtotal']*$fee_amount/100;\n \t\tbreak;\n \t}\n }\n\n $chosen_gateway = WC()->session->chosen_payment_method;\n \n if ( $chosen_gateway == 'cod' ) {\n \tif ( $fee_amount > 0 ){\n \t\t// $discount = $cart->cart_contents_total * ($fee_amount / 100);\n \t\t$cart->add_fee( __( 'Discount On EasyPaisa Mobile Account', 'woocommerce'), -$discount );\n \t}\n }\n}", "protected function doActionSetSalePrice()\n {\n $form = new \\XLite\\Module\\CDev\\Sale\\View\\Form\\SaleSelectedDialog();\n $form->getRequestData();\n\n if ($form->getValidationMessage()) {\n \\XLite\\Core\\TopMessage::addError($form->getValidationMessage());\n } elseif (!$this->getSelected() && $ids = $this->getActionProductsIds()) {\n $qb = \\XLite\\Core\\Database::getRepo('XLite\\Model\\Product')->createQueryBuilder();\n $alias = $qb->getMainAlias();\n $qb->update('\\XLite\\Model\\Product', $alias)\n ->andWhere($qb->expr()->in(\"{$alias}.product_id\", $ids));\n\n foreach ($this->getUpdateInfoElement() as $key => $value) {\n $qb->set(\"{$alias}.{$key}\", \":{$key}\")\n ->setParameter($key, $value);\n }\n\n $qb->execute();\n\n \\XLite\\Core\\TopMessage::addInfo('Products information has been successfully updated');\n } else {\n \\XLite\\Core\\Database::getRepo('\\XLite\\Model\\Product')->updateInBatchById($this->getUpdateInfo());\n \\XLite\\Core\\TopMessage::addInfo('Products information has been successfully updated');\n }\n\n $this->setReturnURL($this->buildURL('product_list', '', ['mode' => 'search']));\n }", "public function discountCalculator()\n\t{\n\t\tob_clean();\n\t\t$get = JRequest::get('GET');\n\t\t$this->_carthelper->discountCalculator($get);\n\t\texit;\n\t}", "public function setDiscountPercent(?string $value): void {\n $this->getBackingStore()->set('discountPercent', $value);\n }", "public static function setUseCoupons($discountList, $use)\n\t{\n\t\tif (!is_array($discountList))\n\t\t\t$discountList = array($discountList);\n\t\t$use = (string)$use;\n\t\tif ($use !== 'Y' && $use !== 'N')\n\t\t\treturn;\n\t\tMain\\Type\\Collection::normalizeArrayValuesByInt($discountList);\n\t\tif (empty($discountList))\n\t\t\treturn;\n\t\t$conn = Main\\Application::getConnection();\n\t\t$helper = $conn->getSqlHelper();\n\t\t$conn->queryExecute(\n\t\t\t'update '.$helper->quote(self::getTableName()).\n\t\t\t' set '.$helper->quote('USE_COUPONS').' = \\''.$use.'\\' where '.\n\t\t\t$helper->quote('ID').' in ('.implode(',', $discountList).')'\n\t\t);\n\t\tunset($helper, $conn);\n\t}", "public function setCalculateDiscountOnCreditMemos(?bool $value): void {\n $this->getBackingStore()->set('calculateDiscountOnCreditMemos', $value);\n }", "protected function setOfferApplicablePricing ()\n {\n $offerApplicableAccountHeads = $this->getOfferApplicableAccountHeads();\n\n foreach ( $this->request->pricing as $accountHead => $amount ) {\n if ( in_array($accountHead, $offerApplicableAccountHeads) ) {\n $this->offerApplicablePricing[ $accountHead ] = $amount;\n $this->offerApplicableAmount += $amount;\n }\n }\n }", "public function apply()\n {\n /** @var EavSetup $eavSetup */\n $eavSetup = $this->eavSetupFactory->create(['setup' => $this->moduleDataSetup]);\n\n if (!$eavSetup->getAttribute(Product::ENTITY, 'am_shipping_type')) {\n $eavSetup->addAttribute(\n Product::ENTITY,\n 'am_shipping_type',\n [\n 'type' => 'varchar',\n 'backend' => '',\n 'frontend' => '',\n 'label' => 'Shipping Type',\n 'input' => 'select',\n 'class' => '',\n 'source' => '',\n 'global' => ScopedAttributeInterface::SCOPE_STORE,\n 'visible' => true,\n 'required' => false,\n 'user_defined' => false,\n 'default' => 0,\n 'searchable' => false,\n 'filterable' => false,\n 'comparable' => false,\n 'visible_on_front' => false,\n 'used_in_product_listing' => true,\n 'unique' => false,\n 'apply_to' => ''\n ]\n );\n }\n }", "protected function _initTotals()\r\n {\r\n parent::_initTotals();\r\n $orderId = $this->getSource()->getId();\r\n\t\t//$base_orderId = 34243;\r\n\t\t$discount = $this->helper('auction')->getDiscountByOrderId($orderId);\r\n if (0) {\r\n $this->addTotalBefore(new Varien_Object(array(\r\n 'code' => 'auction',\r\n 'value' => $amount,\r\n 'base_value'=> $amount,\r\n 'label' => $this->helper('auction')->__('Auction Product Discount ').$amount.$this->helper('auction')->__('%'),\r\n ), array('shipping', 'tax')));\r\n }\r\n\r\n return $this;\r\n }", "public static function bogo_apply_disc($order_id,$promotion_id,$prmdisc_id,$prmdisc_bogo_sbmnu,$prmdisc_bogo_sbmnu_dish,$prmdisc_bogo_qty,$disc_amt_type,$disc_amt){\r \t//echo \"$order_id,$promotion_id,$prmdisc_id,$prmdisc_bogo_sbmnu,$prmdisc_bogo_sbmnu_dish,$prmdisc_bogo_qty,$disc_amt_type,$disc_amt\";\r\t\t//..Check if discount is with sub menu item is selected\r\t\tif(is_gt_zero_num($prmdisc_bogo_sbmnu_dish)){\r\t\t\t//..do nothing..because we already ahve submenudishid\r\t\t}else{\r\t\t //..Get all submenu dish ids from submenu..\r\t\t\t$rs_apl_disc_items= tbl_submenu_dishes::getSubMenuItems($prmdisc_bogo_sbmnu);\r\t\t\tif(is_not_empty($rs_apl_disc_items)){\r\t\t\t\t$prmdisc_bogo_sbmnu_dish=$rs_apl_disc_items;\r\t\t\t}else{\r\t\t\t\t$strOpMsg= \"No items found to apply discount\" ;\r\t\t\t\treturn 0;\r\t\t\t}\r\t\t}\t\t\r \t\t//...Check if the item is in the order detail\r\t\t$tmp_fnd=0;\r\t\t$ord_det_items=tbl_order_details::readArray(array(ORD_DTL_ORDER_ID=>$order_id,ORD_DTL_SBMENU_DISH_ID=>$prmdisc_bogo_sbmnu_dish,ORDPROM_DISCOUNT_AMT=>0),$tmp_fnd,1,0);\t\t\t\t\t\t\t\r\t\tif($tmp_fnd>0){\t\t \r\t\t\t//..item presents in order detail wihtout disocunt\r\t\t\t//..loop through the all the order items records\r\t\t\tforeach($ord_det_items as $order_itm){\r\t\t\t\t //..now check if the quantity >= disc qty\t\t\t\t\t \r\t\t\t\t if($order_itm[ORD_DTL_QUANTITY]>=$prmdisc_bogo_qty){\r\t\t\t\t \t //..Right item to apply discount\r\t\t\t\t\t //..Calculate discount amount\t\r\t\t\t\t\t$discount_amount=tbl_order_details::getDiscountAmnt($disc_amt_type,$disc_amt,$order_itm[ORD_DTL_PRICE]);\r\t\t\t\t\t//..Update the order detail with discount and promot\r\t\t\t\t\t$success=tbl_order_details::update_item_with_discount($order_itm[ORD_DTL_ID],$promotion_id,$prmdisc_id,$discount_amount);\t\r\t\t\t\t\t\t\t\t\t\t\t \r\t\t\t\t }\r\t\t\t}\r\t\t\tunset($ord_det_items);\t\r\t\t}else{\r\t\t\t$strOpMsg= \"Item not present in your order or alreday discounted\" ;\r\t\t}\t\r\t\treturn 1;\r }", "private function resetSkus()\n {\n foreach ($this->options as $op=>$junk) {\n if (preg_match('#SellerSKUList#', $op)) {\n unset($this->options[$op]);\n }\n }\n }", "function ycb_add_discount_badge($content, $post, $product){\r\n global $ycb_using_flatsome;\r\n\r\n $ycb_settings = ycb_get_settings();\r\n\r\n //var_dump(get_class_methods($product));\r\n $base_price = $product->get_regular_price();\r\n $discount_price = $product->get_sale_price();\r\n\r\n if($product->is_type( 'variable' )){\r\n $variations = $product->get_available_variations();\r\n if(isset($variations[0])){\r\n $variation = $variations[0];\r\n $base_price = $variation[\"display_regular_price\"];\r\n $discount_price = $variation[\"display_price\"];\r\n }\r\n }\r\n\r\n if(class_exists(\"WC_Dynamic_Pricing\")){\r\n $discount_price = apply_filters(\"woocommerce_product_get_price\", $base_price, $product, false);\r\n }\r\n\r\n $percentage = round( ( ( floatval($base_price) - floatval($discount_price) ) / (floatval($base_price) > 0 ? floatval($base_price) : 1) ) * 100 );\r\n\r\n $sale_style = ycb_get_styles($ycb_settings, $percentage);\r\n $inner_content = \"-\" . $percentage . \"%\";\r\n $filtered_content = apply_filters('ycb_discount_badge_override_hook', $inner_content);\r\n $sale_tag = \"<span class='onsale ycb_on_sale yoohoo_badge \".ycb_get_badge_shape_class(false, $ycb_settings).\"' style='$sale_style'>\" . $filtered_content . \"</span>\";\r\n\r\n $force_remove_internal_tag = apply_filters('ycb_hide_internal_sale_tag', true, $ycb_settings);\r\n if(!$force_remove_internal_tag){\r\n $sale_tag = \"\";\r\n }\r\n\r\n $hide_sale_tag = isset($ycb_settings['ycb_hide_default_sale_tag']) && $ycb_settings['ycb_hide_default_sale_tag'] === \"true\" ? true : false;\r\n\r\n if($hide_sale_tag){\r\n $content = $sale_tag;\r\n } else {\r\n $content .= $sale_tag;\r\n }\r\n\r\n if($percentage > 0){\r\n if($hide_sale_tag){\r\n if($ycb_using_flatsome){\r\n ycb_custom_badge_hide_woo_sales_badge_on_page(true);\r\n $content .= $sale_tag;\r\n } else {\r\n $content = $sale_tag;\r\n }\r\n } else {\r\n $content .= $sale_tag;\r\n }\r\n }\r\n\r\n //$content = apply_filters(\"ycb_discount_badge_internal_filter\", $content, $product, $hide_sale_tag, $ycb_settings);\r\n\r\n return $content;\r\n}", "public function setAllUncostedAudits() {\n\t\t$uncosted_audits = $this->getAllUncostedAudits();\n\t\t\n\t\tforeach($uncosted_audits as $uncosted_audit) {\n\t\t\t$this->setAuditCost($uncosted_audit->audit_id);\n\t\t}\n\t\t\n\t\treturn;\n\t}", "public function setEmptyProducts(){\n foreach ($this->products as $i => $product) {\n $counts = $product->variant->maxCounts;\n //print_R($product);\n $allCount=0;\n foreach ($counts as $count){\n $allCount = $allCount+$count->count;\n }\n if($allCount<=0 || $product->variant->status==0 || $product->product->status==0 ){\n $product->status=0;\n $product->save(true);\n }\n if($product->count > $allCount){\n $product->count = $allCount;\n $product->save(true);\n }\n if($product->count==0){\n\n //unset($this->products[$i]);\n //$product->status=0;\n //$product->save(true);\n $this->removeProduct($product->id);\n }\n }\n foreach ($this->emptyProducts as $i => $emptyProduct) {\n $emptyCounts = $emptyProduct->variant->maxCounts;\n $emptyAllCount=0;\n foreach ($emptyCounts as $emptyCount){\n $emptyAllCount = $emptyAllCount+$emptyCount->count;\n }\n if($emptyAllCount>0 && $emptyProduct->variant->status==1 && $emptyProduct->product->status==1){\n $emptyProduct->status=1;\n $emptyProduct->save(true);\n }\n }\n }", "function _apply_discount($coupon)\n\t{\n\t\t$this->database->SaveCheatCode($coupon);\n\t\t$discount_percentage = 0;\n\t\t$coupon_info = $this->database->GetDiscountCoupon($coupon);\n\n\t\t//Run some conditional-check for code\n\t\tif($this->_can_apply_code($coupon_info))\n\t\t{\n\t\t\t$discount_percentage = $this->_getDiscount($coupon);\n\t\t\t$this->cart->apply_discount($coupon, $discount_percentage);\n\t\t}\n\n\t\t$this->_notify_discount_applied($discount_percentage, $coupon_info);\n\n\t}", "function unset_discount($discount_id = FALSE)\n\t\t{\n\t\t\t// The 'unset_discount()' function can accept an array of either discount ids or codes to delete more than one discount at a time.\n\t\t\t// Alternatively, if no data is submitted, the function will delete all discounts that are applied to the cart.\n\t\t\t// This example uses the 1 discount id that was supplied via the url link.\n\t\t\t// $this->flexi_cart->unset_userdata_discount($discount_id); // Can't remeber why this 'stock code' didn't work - said 'undefined method' or something\t\t\n\t\t\t$this->flexi_cart->unset_discount($discount_code);\n\n\t\t\t// Set a message to the CI flashdata so that it is available after the page redirect.\n\t\t\t$this->session->set_flashdata('message', $this->flexi_cart->get_messages());\n\t\t\t\n\t\t\tredirect('cart');\n\t\t}", "public function setAmount()\n {\n $exact = $this->getOriginalPurgeValue('amount_exact');\n $percentage = $this->getOriginalPurgeValue('amount_percentage');\n\n $this->amount = $this->is_percentage\n ? $percentage\n : $exact;\n }", "function es_set_sale_price( $price, $product ) {\n\t\n\t$exclude_skus = array( 'COEBRCE', 'COEPOSTER', 'PUB41' );\n\t$exclude_cats = array( 'specials', 'clearance' );\n\t$date_now = new DateTime();\n\t$start_dtm = new DateTime( '2016-10-03' );\n\t$end_dtm = new DateTime( '2016-10-11' );\n\t\n\t// exclude SKUs\n\tif ( in_array( $product->sku, $exclude_skus ) )\n\t\treturn $price;\n\t\n\t// exclude specials category\n\t$product_cat = wp_get_post_terms( $product->id, 'product_cat' );\n\t\n\tforeach ( $product_cat as $term ){\n\t\tif( in_array( $term->slug, $exclude_cats ) ){\n\t\t\treturn $price;\n\t\t}\n\t}\t\n\t\n\tif ( ! $product->is_virtual() AND ( $date_now >= $start_dtm AND $date_now <= $end_dtm ) ) {\n\t\t$member_exists = es_check_membership_held();\n\t\t$member_price = get_post_meta($product->id, 'member_price', true);\n\t\t$price = $product->get_regular_price() * ( 0.9 );\n\t\t\n\t\tif ( ! empty( $member_price ) AND $member_exists ) {\n\t\t\t$product->set_price( $member_price );\n\t\t\t$product->sale_price = $price;\n\t\t\t$price = $member_price;\t\t\n\t\t}\n\t\telse {\n\t\t\t$product->set_price( $price );\n\t\t\t$product->sale_price = $price;\t\n\t\t}\n\t\t\n\t}\n\t\n\treturn $price;\n}", "public function setDiscountUid(?string $discountUid): void\n {\n $this->discountUid = $discountUid;\n }", "public function discount(Request $request)\n {\n // dd($request->all());\n\n try {\n $cart = Cart::name('shopping');\n\n $cart->applyAction([\n 'group' => 'Discount',\n 'id' => 1,\n 'title' => 'Sale 10%',\n 'value' => '-10%',\n ]);\n\n return redirect()->route('cart.index')->withSuccess('Thêm vào giỏ thành công');\n } catch (\\Exception $e) {\n return redirect()->route('cart.index')->withError('Thêm vào giỏ thất bại');\n }\n }", "public function get_all_discounts()\r\n\t{\r\n\t\t// Set default discount target column data.\r\n\t\t$discounts = array(\r\n\t\t\t'item_price' => array(),\r\n\t\t\t'item_shipping' => array(),\r\n\t\t\t'item_summary_total' => array(),\r\n\t\t\t'shipping_total' => array(),\r\n\t\t\t'total' => array(),\r\n\t\t\t'reward_vouchers' => array()\r\n\t\t);\r\n\t\t\r\n\t\t// Get all available discounts.\r\n\t\t$unsorted_discount_data['manual_discount'] = $this->get_manual_discounts();\r\n\t\t$unsorted_discount_data['non_group_discount'] = $this->get_non_group_discounts();\r\n\t\t$unsorted_discount_data['group_discounts'] = $this->get_group_discounts();\r\n\t\t\r\n\t\tif (! empty($unsorted_discount_data['manual_discount']) || ! empty($unsorted_discount_data['non_group_discount']) || ! empty($unsorted_discount_data['group_discounts']))\r\n\t\t{\r\n\t\t\t// Loop through and group discounts.\r\n\t\t\tforeach($unsorted_discount_data as $discount_type)\r\n\t\t\t{\r\n\t\t\t\tif (! empty($discount_type))\r\n\t\t\t\t{\r\n\t\t\t\t\t// Loop through the discount target columns 'item_price', 'item_shipping', 'item_summary_total', 'shipping_total', 'total' and 'reward_vouchers'.\r\n\t\t\t\t\tforeach($discount_type as $target_column => $target_data)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tforeach($target_data as $discount_id => $discount_data)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t$discounts[$target_column][$discount_id] = $discount_data;\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\t\r\n\t\t\t###+++++++++++++++++++++++++++++++++###\r\n\r\n\t\t\t### Validate and Sort Item Discounts.\r\n\r\n\t\t\t$item_discount_data = $this->validate_item_discounts($discounts);\r\n\t\t\t\r\n\t\t\t// Merge item discount data.\r\n\t\t\t$discounts['item_price'] = (! empty($item_discount_data['discounts']['item_price'])) ? $item_discount_data['discounts']['item_price'] : array();\r\n\t\t\t$discounts['item_shipping'] = (! empty($item_discount_data['discounts']['item_shipping'])) ? $item_discount_data['discounts']['item_shipping'] : array();\r\n\t\t\t\r\n\t\t\t###+++++++++++++++++++++++++++++++++###\r\n\t\t\t\r\n\t\t\t// If a 'Non-combinable' item discount has been set, remove all other summary discount data.\r\n\t\t\tif ($item_discount_data['non_combinable_discount'])\r\n\t\t\t{\r\n\t\t\t\t$discounts = array(\r\n\t\t\t\t\t'item_price' => $discounts['item_price'],\r\n\t\t\t\t\t'item_shipping' => $discounts['item_shipping'],\r\n\t\t\t\t\t'item_summary_total' => array(),\r\n\t\t\t\t\t'shipping_total' => array(),\r\n\t\t\t\t\t'total' => array()\r\n\t\t\t\t);\r\n\t\t\t}\r\n\r\n\t\t\t###+++++++++++++++++++++++++++++++++###\r\n\r\n\t\t\t// Sort discount data.\r\n\t\t\tforeach($discounts as $target_column => $discount_data) \r\n\t\t\t{\r\n\t\t\t\t$sorted_discounts[$target_column] = $target_column;\r\n\t\t\t}\r\n\t\t\tarray_multisort($sorted_discounts, SORT_ASC, $discounts);\r\n\t\t}\r\n\r\n\t\treturn $discounts;\r\n\t}", "function ycb_setup_flatsome_hooks(){\r\n add_filter(\"woocommerce_sale_flash\", \"ycb_add_discount_badge\", 1, 3);\r\n\r\n add_action('woocommerce_before_shop_loop_item', 'ycb_custom_badge_shop_loop_opened', 15 );\r\n add_action('woocommerce_before_single_product_summary', 'ycb_custom_badge_shop_loop_opened', 15);\r\n}", "public function setShippingPrice() {\n if ($this->price > 200) {\n $this->shippingPrice = 0;\n }\n }", "public function applyProductCategoryWholesaleDiscount( $wholesalePrice , $productID , $userWholesaleRole ) {\n\n if ( empty( $wholesalePrice ) && !empty( $userWholesaleRole ) ) {\n\n $product = wc_get_product( $productID );\n $product_price = get_option( 'wwpp_settings_explicitly_use_product_regular_price_on_discount_calc' ) == 'yes' ? $product->get_regular_price() : $product->get_price();\n $post_id = ( WWP_Helper_Functions::wwp_get_product_type( $product ) === 'variation' ) ? WWP_Helper_Functions::wwp_get_parent_variable_id( $product ) : $productID;\n\n if ( !is_null( $post_id ) ) {\n\n $terms = get_the_terms( $post_id , 'product_cat' );\n if ( !is_array( $terms ) )\n $terms = array();\n\n $lowest_discount = null;\n $highest_discount = null;\n\n foreach ( $terms as $term ) {\n\n $category_wholesale_prices = get_option( 'taxonomy_' . $term->term_id );\n\n if ( is_array( $category_wholesale_prices ) && array_key_exists( $userWholesaleRole[ 0 ] . '_wholesale_discount' , $category_wholesale_prices ) ) {\n\n $curr_discount = $category_wholesale_prices[ $userWholesaleRole[ 0 ] . '_wholesale_discount' ];\n\n if ( !empty( $curr_discount ) ) {\n\n if ( is_null( $lowest_discount ) || $curr_discount < $lowest_discount )\n $lowest_discount = $curr_discount;\n\n if ( is_null( $highest_discount ) || $curr_discount > $highest_discount )\n $highest_discount = $curr_discount;\n\n }\n\n }\n\n }\n\n $category_wholsale_price_logic = get_option( 'wwpp_settings_multiple_category_wholesale_discount_logic' );\n\n if ( $category_wholsale_price_logic == 'highest' ) {\n\n if ( !is_null( $highest_discount ) )\n $wholesalePrice = round( $product_price - ( $product_price * ( $highest_discount / 100 ) ) , 2 );\n\n } else {\n\n if ( !is_null( $lowest_discount ) )\n $wholesalePrice = round( $product_price - ( $product_price * ( $lowest_discount / 100 ) ) , 2 );\n\n }\n\n if ( $wholesalePrice < 0 )\n $wholesalePrice = 0;\n\n }\n\n }\n\n return $wholesalePrice;\n\n }", "protected function setProductivity()\n {\n $this->productivity = random_int(8, 12);\n }", "public function providerDiscountPurchases()\r\n\t{\r\n\t\t$appleProduct = $this->getAppleProduct(self::PRODUCT_WITH_DISCOUNT_PRICE);\r\n\t\t$lightProduct = $this->getLightProduct(self::PRODUCT_WITH_DISCOUNT_PRICE);\r\n\t\t$starshipProduct = $this->getStarshipProduct(self::PRODUCT_WITH_DISCOUNT_PRICE);\r\n\r\n\t\treturn array(\r\n\t\t\tarray(\r\n\t\t\t\t7.0 * self::PRODUCT_APPLE_DISCOUNT_PRICE,\r\n\t\t\t\tarray(\r\n\t\t\t\t\tnew ProductToPurchase($appleProduct, 7.0),\r\n\t\t\t\t),\r\n\t\t\t),\r\n\t\t\tarray(\r\n\t\t\t\t5 * self::PRODUCT_LIGHT_PRICE + 8.0 * self::PRODUCT_APPLE_DISCOUNT_PRICE,\r\n\t\t\t\tarray(\r\n\t\t\t\t\tnew ProductToPurchase($lightProduct, 5),\r\n\t\t\t\t\tnew ProductToPurchase($appleProduct, 8.0),\r\n\t\t\t\t),\r\n\t\t\t),\r\n\t\t\tarray(\r\n\t\t\t\t4 * self::PRODUCT_STARSHIP_PRICE,\r\n\t\t\t\tarray(\r\n\t\t\t\t\tnew ProductToPurchase($starshipProduct, 6)\r\n\t\t\t\t),\r\n\t\t\t),\r\n\t\t);\r\n\t}", "public function setDiscountRate($value){\n return $this->setParameter('discount_rate', $value);\n }", "public function salesQuoteProductAddAfter($observer)\r\n\t{\r\n\t\t$items = $observer['items'];\t\t\r\n\t\tif(Mage::getModel('checkout/session')->getData('shoppingcart_gift_item')\r\n\t\t ||Mage::getModel('checkout/session')->getData('free_gift_item') \r\n\t\t || Mage::getModel('checkout/session')->getData('promotionalgift_bundle')){\r\n\t\t\tforeach($items as $item){\r\n\t\t\t\t$item->setCustomPrice(0);\r\n\t\t\t\t$item->setOriginalCustomPrice(0);\r\n\t\t\t\t$item->getProduct()->setIsSuperMode(true);\t\r\n\t\t\t}\r\n\t\t\treturn $this;\r\n\t\t}\t\t\t\r\n\t}", "public function custom_query()\n {\n $query = $this->db->get(\"products\");\n foreach($query->result() as $row) {\n $data = [\"price\" => $row->price*100];\n $this->db->where('id', $row->id);\n $this->db->update('products', $data);\n }\n die;\n }", "function getPromoList()\n {\n return array(array('reason'=>'test_discount','amount'=>3.5));\n }", "public function applyDiscount(Discount $discount){\n\t\tif($this->discount == NULL){\n\t\t\t$this->finalPrice = $this->price*(100-$discount->percent/100);\n\t\t\t$this->discount = $discount;\n\t\t}\n\t\treturn $this;\n\t}", "public function change()\n {\n $sellersTable = TableRegistry::get('Sellers');\n $sellerDataTable = TableRegistry::get('ProductSellerData');\n $sellers = $sellersTable->find()->toArray();\n foreach($sellers as $seller){\n\n $sellerData = $sellerDataTable->find()->where(['seller_id'=>$seller['id']])->order(['updated_on'=>'DESC'])->first();\n\n $query = $sellersTable->query();\n $query->update()\n ->set(['rating' => $sellerData->rating,'rating_count' => $sellerData->rating_count])\n ->where(['id' => $seller['id']])\n ->execute();\n }\n\n }", "public function updateProduct()\n {\n \t$quote=$this->getQuote();\n \tif($quote)\n \t{\n \t\t$detailproduct=$this->getProduct();\n \t\t$quoteproduct=$quote->getProduct();\n \t\tif(\n\t\t\t\t$quote->getPrice()!=$this->getPrice() or\n\t\t\t\t$quote->getDiscrate()!=$this->getDiscrate() or\n\t\t\t\t$quote->getDiscamt()!=$this->getDiscamt() or\n\t\t\t\t$quote->getProductId()!=$this->getProductId()\n\t\t\t)\n\t\t\t{\n\t\t\t\t$quote->setPrice($this->getPrice());\n\t\t\t\t$quote->setDiscrate($this->getDiscrate());\n\t\t\t\t$quote->setDiscamt($this->getDiscamt());\n\t\t\t\t$quote->setProductId($this->getProductId());\n\t\t\t\t$quote->calc(); //auto save\n\t\t\t\t$detailproduct->calcSalePrices();\n\t\t\t\t\n\t\t\t\t//if product changed, calc old product\n\t\t\t\tif($quoteproduct->getId()!=$detailproduct->getId())\n\t\t\t\t\t$quoteproduct->calcSalePrices();\n\t\t\t}\n \t}\n \telse\n \t{\n\t\t\t//if none, see if product quote by vendor with similar pricing exists. \n\t\t\t$quote=Fetcher::fetchOne(\"Quote\",array('total'=>$this->getUnittotal(),'vendor_id'=>SettingsTable::fetch(\"me_vendor_id\"),'product_id'=>$this->getProductId()));\n\n\t\t\t//if it doesn't exist, create it, and product->calc()\n\t\t\tif(!$quote)\n\t\t\t{\n\t\t\t\tQuoteTable::createOne(array(\n\t\t\t\t\t'date'=>$this->getInvoice()->getDate(),\n\t\t\t\t\t'price'=>$this->getPrice(),\n\t\t\t\t\t'discrate'=>$this->getDiscrate(),\n\t\t\t\t\t'discamt'=>$this->getDiscamt(),\n\t\t\t\t\t'vendor_id'=>SettingsTable::fetch(\"me_vendor_id\"),\n\t\t\t\t\t'product_id'=>$this->getProductId(),\n\t\t\t\t\t'ref_class'=>\"Invoicedetail\",\n\t\t\t\t\t'ref_id'=>$this->getId(),\n\t\t\t\t\t'mine'=>1,\n\t\t\t\t\t));\n\t\t\t\t$this->getProduct()->calcSalePrices();\n\t\t\t}\n \t}\n }", "public function setDiscountSequence()\n {\n $this->discountSequence = [\n (string)DiscountType::LIMITED_TIME(),\n (string)DiscountType::PERIOD(),\n (string)DiscountType::QUANTITY(),\n ];\n }", "public function execute(\\Magento\\Framework\\Event\\Observer $observer)\n {\n $product = $observer->getProduct();\n $_pricePerPound = $product->getPricePerPound();\n if($_pricePerPound > 0){\n $weight = $product->getWeight() ? $product->getWeight() : 1;\n $_pricePerPound = str_replace(',', '', $_pricePerPound);\n $price = $_pricePerPound * $weight;\n $product->setPrice($price);\n }\n }", "public function setDiscount($discount)\r\n {\r\n $this->discount = $discount;\r\n\r\n return $this;\r\n }", "function TaxExclusivePrice(){\n\t\tuser_error(\"to be completed\");\n\t}", "function changeProduct($cart_table_id,$true_or_false)\n {\n $this->pdelivery[$cart_table_id]=$true_or_false; //change product group delivery\n }" ]
[ "0.6696506", "0.6468505", "0.6425978", "0.64248306", "0.6372037", "0.63055074", "0.63022995", "0.62782574", "0.60953486", "0.6092482", "0.59653115", "0.5959322", "0.5929388", "0.5919434", "0.578675", "0.57706153", "0.576795", "0.57485366", "0.57166594", "0.56155443", "0.5595862", "0.554314", "0.5540166", "0.55138487", "0.5476629", "0.5476562", "0.54744583", "0.54654855", "0.5465484", "0.54526746", "0.544818", "0.54150164", "0.5412209", "0.54057276", "0.5378433", "0.53779006", "0.53672105", "0.53617424", "0.53562665", "0.535145", "0.534335", "0.5334251", "0.5318649", "0.5305827", "0.53055215", "0.53050256", "0.5303451", "0.5283891", "0.5282474", "0.5278296", "0.5270219", "0.5259711", "0.52582467", "0.52563715", "0.5248133", "0.5240435", "0.5226194", "0.52206045", "0.5212401", "0.5211764", "0.5208389", "0.52067196", "0.51949096", "0.5186322", "0.51841825", "0.517694", "0.5167802", "0.51613057", "0.5155457", "0.5153246", "0.5140136", "0.51395565", "0.5134478", "0.5132347", "0.5131691", "0.51283103", "0.51281106", "0.51269466", "0.51210135", "0.5117122", "0.51056206", "0.51043564", "0.5103178", "0.50980294", "0.5094244", "0.5093482", "0.50714827", "0.5069481", "0.505864", "0.50567955", "0.5054545", "0.5043329", "0.50415844", "0.5030699", "0.5027999", "0.50247234", "0.50164515", "0.5012548", "0.500793", "0.50004315", "0.49996498" ]
0.0
-1
Target: All true. "Set discount to all products that meet conditions"
protected static function avail_target_all_true($filter_items, $items, $target, $rule, $sku_id) { return self::avail_target_all($filter_items, $filter_items, $target, $rule, $sku_id); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected function calculateDiscount() : void{\r\n $percentage = ($this->discounted_value * 100) / $this->order->getTrueTotal();\r\n $new_total = $this->order->getTrueTotal() - $this->discounted_value;\r\n\r\n $this->order_discount_value = $this->discounted_value;\r\n $this->order_discount_percentage = $percentage;\r\n $this->order_discount_reason = \"For every \" . $this->products_nr . \" products from category #\" . $this->category_id . \" you get one free. You got: \";\r\n foreach($this->items_matching as $item){\r\n $this->order_discount_reason .= floor($item[\"qty\"] / $this->products_nr) . \" x '\" . $item[\"description\"] . \"' (€\". $item[\"price\"] .\" each) ; \";\r\n }\r\n $this->order_new_total = $new_total;\r\n }", "public function AssignDiscount()\n\t{\t\n\t}", "public function isApplicable() : bool{\r\n $items = $this->order->getOrderItems();\r\n foreach($items as $item){\r\n // checks every item for order if the quantity is >= $products_nr\r\n if($item[\"quantity\"] >= $this->products_nr){\r\n $tmp_item = $this->order->getProductById($item[\"product-id\"]);\r\n\r\n // checks if product category equals $category_id \r\n if((int)$tmp_item[\"category\"] === $this->category_id){\r\n $tmp_item[\"qty\"] = $item[\"quantity\"];\r\n\r\n // saves the discounted items in a temporary array\r\n $this->items_matching[] = $tmp_item;\r\n\r\n // stores the total cost of the discount\r\n $this->discounted_value += $tmp_item[\"price\"] * floor($item[\"quantity\"] / $this->products_nr);\r\n }\r\n }\r\n }\r\n\r\n if($this->discounted_value > 0){\r\n $this->is_applicable = true;\r\n $this->calculateDiscount();\r\n return true; \r\n }\r\n return false;\r\n }", "public function applyCartDiscount(Varien_Event_Observer $observer)\n { \n try\n { \n $bundle_product_ids = [];\n $quote_product_ids = [];\n $cookieValue = Mage::getModel('core/cookie')->get('ivid');\n $userBundleCollection = Mage::getModel('increasingly_analytics/bundle')->getCollection()->addFieldToFilter('increasingly_visitor_id',$cookieValue);\n $items = $observer->getEvent()->getQuote()->getAllItems();\n $eligibleProducts = [];\n $discount = 0;\n foreach ($items as $item) {\n array_push($quote_product_ids, $item->getProductId());\n }\n foreach ($userBundleCollection as $bundle) {\n //First Bundle products\n $bundle_product_ids = explode(',', $bundle->getProductIds()); \n $productsIds = array_intersect($quote_product_ids, $bundle_product_ids);\n if(count($productsIds) == count($bundle_product_ids) )\n $discount += $bundle->getDiscountPrice();\n }\n\n if($discount > 0){\n $quote=$observer->getEvent()->getQuote();\n $quoteid=$quote->getId();\n $discountAmount=$discount;\n if($quoteid) { \n if($discountAmount>0) {\n $total=$quote->getBaseSubtotal();\n $quote->setSubtotal(0);\n $quote->setBaseSubtotal(0);\n\n $quote->setSubtotalWithDiscount(0);\n $quote->setBaseSubtotalWithDiscount(0);\n\n $quote->setGrandTotal(0);\n $quote->setBaseGrandTotal(0);\n \n\n $canAddItems = $quote->isVirtual()? ('billing') : ('shipping'); \n foreach ($quote->getAllAddresses() as $address) {\n\n $address->setSubtotal(0);\n $address->setBaseSubtotal(0);\n\n $address->setGrandTotal(0);\n $address->setBaseGrandTotal(0);\n\n $address->collectTotals();\n\n $quote->setSubtotal((float) $quote->getSubtotal() + $address->getSubtotal());\n $quote->setBaseSubtotal((float) $quote->getBaseSubtotal() + $address->getBaseSubtotal());\n\n $quote->setSubtotalWithDiscount(\n (float) $quote->getSubtotalWithDiscount() + $address->getSubtotalWithDiscount()\n );\n $quote->setBaseSubtotalWithDiscount(\n (float) $quote->getBaseSubtotalWithDiscount() + $address->getBaseSubtotalWithDiscount()\n );\n\n $quote->setGrandTotal((float) $quote->getGrandTotal() + $address->getGrandTotal());\n $quote->setBaseGrandTotal((float) $quote->getBaseGrandTotal() + $address->getBaseGrandTotal());\n\n $quote ->save(); \n\n $quote->setGrandTotal($quote->getBaseSubtotal()-$discountAmount)\n ->setBaseGrandTotal($quote->getBaseSubtotal()-$discountAmount)\n ->setSubtotalWithDiscount($quote->getBaseSubtotal()-$discountAmount)\n ->setBaseSubtotalWithDiscount($quote->getBaseSubtotal()-$discountAmount)\n ->save(); \n\n\n if($address->getAddressType()==$canAddItems) {\n //echo $address->setDiscountAmount; exit;\n $address->setSubtotalWithDiscount((float) $address->getSubtotalWithDiscount()-$discountAmount);\n $address->setGrandTotal((float) $address->getGrandTotal()-$discountAmount);\n $address->setBaseSubtotalWithDiscount((float) $address->getBaseSubtotalWithDiscount()-$discountAmount);\n $address->setBaseGrandTotal((float) $address->getBaseGrandTotal()-$discountAmount);\n if($address->getDiscountDescription()){\n $address->setDiscountAmount(-($address->getDiscountAmount()-$discountAmount));\n $address->setDiscountDescription($address->getDiscountDescription().', Custom Discount');\n $address->setBaseDiscountAmount(-($address->getBaseDiscountAmount()-$discountAmount));\n }else {\n $address->setDiscountAmount(-($discountAmount));\n $address->setDiscountDescription('Custom Discount');\n $address->setBaseDiscountAmount(-($discountAmount));\n }\n $address->save();\n }//end: if\n } //end: foreach\n //echo $quote->getGrandTotal();\n\n foreach($quote->getAllItems() as $item){\n //We apply discount amount based on the ratio between the GrandTotal and the RowTotal\n $rat=$item->getPriceInclTax()/$total;\n $ratdisc=$discountAmount*$rat;\n $item->setDiscountAmount(($item->getDiscountAmount()+$ratdisc) * $item->getQty());\n $item->setBaseDiscountAmount(($item->getBaseDiscountAmount()+$ratdisc) * $item->getQty())->save(); \n }\n } \n }\n }\n }\n catch(Exception $e)\n {\n Mage::log(\"Remove from cart tracking - \" . $e->getMessage(), null, 'Increasingly_Analytics.log');\n }\n\n }", "public function set_manual_discount($discount_data = FALSE)\r\n\t{\r\n\t\tif (is_array($discount_data) && ! empty($discount_data))\r\n\t\t{\r\n\t\t\t// Check that any submitted 'New value' discounts are only applied to the shipping total. \r\n\t\t\tif (isset($discount_data['column']) && isset($discount_data['calculation']) && ($discount_data['column'] != 'shipping_total') && ($discount_data['calculation'] == 3))\r\n\t\t\t{\r\n\t\t\t\treturn FALSE;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t// Merge the code and manual discounts together, then loop through data and compile an array of all discount ids currently in use.\r\n\t\t\t$existing_discounts = array_merge($this->flexi->cart_contents['settings']['discounts']['manual'], $this->flexi->cart_contents['settings']['discounts']['codes']);\r\n\t\t\t$existing_ids = array();\r\n\t\t\t\t\r\n\t\t\tforeach($existing_discounts as $existing_discount)\r\n\t\t\t{\r\n\t\t\t\t$existing_ids[] = $existing_discount['id'];\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t// If an id is not set in the submitted '$discount_data', or if a discount with a matching id already exists, set a new id. \r\n\t\t\tif (! isset($discount_data['id']) || in_array($discount_data['id'], $existing_ids))\r\n\t\t\t{\r\n\t\t\t\t$id = 0;\r\n\t\t\t\twhile (in_array('manual_'.$id, $existing_ids))\r\n\t\t\t\t{\r\n\t\t\t\t\t$id++; \r\n\t\t\t\t}\r\n\t\t\t\t$id = $discount_data['id'] = 'manual_'.$id;\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\t$id = $discount_data['id'];\r\n\t\t\t}\r\n\t\t\r\n\t\t\t// Set default values if not submitted.\r\n\t\t\t$discount_data['description'] = (! isset($discount_data['description'])) ? FALSE : $discount_data['description'];\r\n\t\t\t$discount_data['value'] = (! isset($discount_data['value'])) ? 0 : $discount_data['value'];\r\n\t\t\t$discount_data['column'] = (! isset($discount_data['column'])) ? 'total' : $discount_data['column'];\r\n\t\t\t$discount_data['calculation'] = (! isset($discount_data['calculation'])) ? 1 : $discount_data['calculation'];\r\n\t\t\t$discount_data['tax_method'] = (! isset($discount_data['tax_method'])) ? FALSE : $discount_data['tax_method'];\r\n\t\t\t$discount_data['void_reward_points'] = (! isset($discount_data['void_reward_points'])) ? FALSE : $discount_data['void_reward_points'];\r\n\t\t\t\r\n\t\t\t// Set the cart column the discount is targeting and use the value to act as the discounts array key. \r\n\t\t\t// This prevents multiple discounts being applied to the same cart column.\r\n\t\t\t$target_column = $discount_data['column'];\r\n\t\t\t\r\n\t\t\t// Loop through data and set to cart session summary.\r\n\t\t\tforeach($discount_data as $column => $column_value)\r\n\t\t\t{\r\n\t\t\t\tif ($column == 'value')\r\n\t\t\t\t{\r\n\t\t\t\t\t// If a valid discount value is not set, set the default value as zero. \r\n\t\t\t\t\t$column_value = ($this->non_negative($column_value)) ? $this->format_calculation($column_value, 2, TRUE) : 0;\r\n\t\t\t\t}\r\n\t\t\t\telse if ($column == 'column')\r\n\t\t\t\t{\r\n\t\t\t\t\t// If a valid column is not set, discount the 'total' column by default. \r\n\t\t\t\t\t$column_value = (in_array($column_value, array('item_summary_total', 'shipping_total', 'total'))) ? $column_value : 'total';\r\n\t\t\t\t}\r\n\t\t\t\telse if ($column == 'calculation') \r\n\t\t\t\t{\r\n\t\t\t\t\t// If a valid calculation method is not set, a 'percentage' based calculation is set by default.\r\n\t\t\t\t\t// 1 = Percentage Based, 2 = Flat Fee, 3 = New Value.\r\n\t\t\t\t\t$column_value = (in_array($column_value, array(1,2,3))) ? $column_value : 1;\r\n\t\t\t\t}\r\n\t\t\t\telse if ($column == 'tax_method')\r\n\t\t\t\t{\r\n\t\t\t\t\t// If a valid tax method is not set, the tax method is defined by whether cart prices ex/include taxes by default.\r\n\t\t\t\t\t// 0 = Carts Default Tax Method, 1 = Apply Tax Before Discount, 2 = Apply Discount Before Tax, 3 = Apply Discount Before Tax, Add Original Tax.\r\n\t\t\t\t\t$column_value = (in_array($column_value, array(0, 1,2,3))) ? $column_value : 0;\r\n\t\t\t\t}\r\n\t\t\t\telse if ($column == 'void_reward_points')\r\n\t\t\t\t{\r\n\t\t\t\t\t$column_value = (bool)$column_value;\r\n\t\t\t\t}\r\n\t\t\t\telse if (! in_array($column, array('id', 'description')))\r\n\t\t\t\t{\r\n\t\t\t\t\tcontinue;\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\t$this->flexi->cart_contents['settings']['discounts']['manual'][$target_column][$column] = $column_value;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\treturn TRUE;\r\n\t\t}\r\n\t\t\r\n\t\treturn FALSE;\r\n\t}", "public function set_discount_defaults()\r\n\t{\r\n\t\t// Set array placeholders.\r\n\t\tif (! isset($this->flexi->cart_contents['settings']['discounts']['codes']))\r\n\t\t{\r\n\t\t\t$this->flexi->cart_contents['settings']['discounts']['codes'] = array();\r\n\t\t}\r\n\t\tif (! isset($this->flexi->cart_contents['settings']['discounts']['manual']))\r\n\t\t{\r\n\t\t\t$this->flexi->cart_contents['settings']['discounts']['manual'] = array();\r\n\t\t}\t\r\n\t\r\n\t\t// Reset other discount data.\r\n\t\t$this->flexi->cart_contents['settings']['discounts']['active_items'] = array();\r\n\t\t$this->flexi->cart_contents['settings']['discounts']['active_summary'] = array();\r\n\t\t$this->flexi->cart_contents['settings']['discounts']['reward_vouchers'] = array();\r\n\t\t$this->flexi->cart_contents['settings']['discounts']['data']['item_discount_savings'] = 0;\r\n\t\t$this->flexi->cart_contents['settings']['discounts']['data']['summary_discount_savings'] = 0;\r\n\t\t$this->flexi->cart_contents['settings']['discounts']['data']['reward_vouchers'] = 0;\r\n\t\t$this->flexi->cart_contents['settings']['discounts']['data']['void_reward_point_items'] = array();\r\n\r\n\t\tif (! isset($this->flexi->cart_contents['settings']['discounts']['data']['excluded_discounts']))\r\n\t\t{\r\n\t\t\t$this->flexi->cart_contents['settings']['discounts']['data']['excluded_discounts'] = array();\r\n\t\t}\t\r\n\t\t\r\n\t\treturn TRUE;\r\n\t}", "function pp_edd_auto_apply_discount() {\n\n\tif ( function_exists( 'edd_is_checkout' ) && edd_is_checkout() ) {\n\n\t\tif ( ! edd_cart_has_discounts() && edd_is_discount_valid( 'BFCM2016', '', false ) ) {\n\t\t\tedd_set_cart_discount( 'BFCM2016' );\n\t\t}\n\n\t}\n\n}", "private function updateProductDiscount(\n ProductInterface $product,\n Request $request\n ): void {\n $discountPercent = $request->request->get('discount_percent') !== '' ? (float) $request->request->get('discount_percent') : null;\n $discountLimitType = $request->request->get('discount_limit_type') !== '' ? $request->request->get('discount_limit_type') : null;\n $discountFromDate = $request->request->get('discount_from_date') !== '' ? $request->request->get('discount_from_date') : null;\n $discountToDate = $request->request->get('discount_to_date') !== '' ? $request->request->get('discount_to_date') : null;\n\n $variants = $product->getVariants();\n foreach ($variants as $variant) {\n // Variant to change\n $variantPricing = $variant->getChannelPricings()->first();\n\n // Change percent\n if ($discountPercent !== null) {\n $variantPricing->setDiscount($discountPercent / 100);\n }\n\n // Continue if no change type\n if ($discountLimitType === self::LIMIT_NO_CHANGE) {\n continue;\n }\n // Discount type\n $variantPricing->setDiscountLimitType($discountLimitType === self::LIMIT_NONE ? null : $discountLimitType);\n\n // Date type discount\n if ($discountLimitType === self::LIMIT_DATETIME) {\n if ($discountFromDate && $discountToDate) {\n $dateFrom = \\DateTime::createFromFormat('Y-m-d', $discountFromDate);\n $dateTo = \\DateTime::createFromFormat('Y-m-d', $discountToDate);\n\n $variantPricing->setDiscountFrom($dateFrom);\n $variantPricing->setDiscountTo($dateTo);\n }\n\n if ($discountFromDate && !$discountToDate) {\n $dateFrom = \\DateTime::createFromFormat('Y-m-d', $discountFromDate);\n\n $variantPricing->setDiscountFrom($dateFrom);\n $variantPricing->setDiscountTo(null);\n }\n\n if (!$discountFromDate && $discountToDate) {\n $dateTo = \\DateTime::createFromFormat('Y-m-d', $discountToDate);\n\n $variantPricing->setDiscountFrom(null);\n $variantPricing->setDiscountTo($dateTo);\n }\n }\n }\n }", "public function updateAffectedPlans(Discount $discount)\n {\n }", "function set_discount($discount_id = FALSE)\n\t\t{\n\t\t\t$this->load->model('demo_cart_model');\n\t\t\t\n\t\t\t$this->demo_cart_model->demo_set_discount($discount_id);\n\t\t\t\n\t\t\tredirect('cart');\n\t\t}", "public function applyGlobalDiscount($discount_rate)\n {\n }", "public function discountBifurcation(Varien_Event_Observer $observer)\n {\n $rule = $observer->getEvent()->getRule();\n $result = $observer->getEvent()->getResult();\n $itemId = $observer->getEvent()->getItem()->getItemId();\n //set Unique key\n $curUnique= $rule->getRuleId().'_'.$itemId;\n //check if Mage registry unique call set\n if(Mage::registry('uniqueCall')!==null){\n //if check in array\n $uniqueCalls = Mage::registry('uniqueCall');\n if( in_array($curUnique,$uniqueCalls)){\n return;\n }else{\n //unset existing registry. also take existing array in variable\n Mage::unregister('uniqueCall');\n $uniqueCalls[]= $curUnique ;\n //set registry again with new array include $uniqueCall into it\n Mage::register('uniqueCall',$uniqueCalls);\n }\n }else{\n //set registry again with new array include $uniqueCall into it\n $array = array();\n $array[]=$rule->getRuleId().'_'.$itemId;\n Mage::register('uniqueCall',$array);\n\n } \n\n //condition for the Promotional coupons\n if ( $rule->getCouponType() == Mage_SalesRule_Model_Rule::COUPON_TYPE_NO_COUPON ) {\n $promotionDiscount = 0;\n $promotionDiscount = Mage::registry('promotion');\n if (Mage::registry('promotion')!==null){\n Mage::unregister('promotion');\n }\n if (Mage::registry('promo_lable')!==null){\n Mage::unregister('promo_lable');\n }\n $promotionDiscount += $result->getDiscountAmount();\n Mage::register('promotion', $promotionDiscount);\n Mage::register('promo_lable',$rule->getName());\n } elseif ( $rule->getCouponType() == self::COUPON_TYPE_FUE_GENERATED ) {\n $couponDiscount = 0;\n $couponDiscount = Mage::registry('coupon');\n if(Mage::registry('coupon')!==null){\n Mage::unregister('coupon');\n }\n //sum up all the values of discounted coupons\n $couponDiscount += $result->getDiscountAmount();\n Mage::register('coupon',$couponDiscount);\n }\n $quote = $observer->getEvent()->getQuote();\n $quoteAddress = $observer->getEvent()->getAddress();\n //set discounted coupons and promotional coupons amount in quote\n $quote->setCouponDiscount(Mage::registry('coupon'));\n $quote->setPromotionalDiscount(Mage::registry('promotion'));\n\n if (Mage::getStoreConfig('promodiscount/promodiscount/use_default')) {\n $quote->setPromoLable(Mage::getStoreConfig('promodiscount/promodiscount/default_lable'));\n } else {\n if (Mage::registry('promo_lable')) {\n $quote->setPromoLable(Mage::registry('promo_lable'));\n } else {\n $quote->setPromoLable(Mage::getStoreConfig('promodiscount/promodiscount/default_lable'));\n }\n }\n \n $quoteAddress->setCouponDiscount(Mage::registry('coupon'));\n $quoteAddress->setPromotionalDiscount(Mage::registry('promotion'));\n if (Mage::registry('promo_lable')) {\n $quoteAddress->setPromoLable(Mage::registry('promo_lable'));\n } else {\n $quoteAddress->setPromoLable(Mage::getStoreConfig('promodiscount/promodiscount/default_lable'));\n }\n }", "function apply_special_item_discount($id, $count, &$disc_amount) {\r\n switch($id) {\r\n case 99999:\r\n case 99998:\r\n if ($count > 100) {\r\n $disc_amount = 50; \r\n }\r\n break; \r\n case 99997:\r\n $disc_amount = 75;\r\n break; \r\n }\r\n }", "public function testConditionOverride() {\n\t\t$products = $this->productsManager->filter(Attr::id()->lt(3))->find(Attr::category()->eq('Clothes'));\n\t\t$this->assertCount(3, $products);\n\t}", "function _apply_auto_disc()\n\t{\n\t\t$num_items = $this->cart->total_items();\n\t\t$auto_disc_info = null;\n\n\t\tforeach ($this->auto_disc_array as $cart_items => $disc_info)\n\t\t{\n\t\t\tif($num_items >= $cart_items)\n\t\t\t{\n\t\t\t\t$auto_disc_info = $disc_info;\n\t\t\t}\n\t\t}\n\n\t\t$applied_disc = $this->cart->discount_info();\n\n\t\t//auto discount should be more than the applied disc (if any)\n\t\tif($applied_disc['percentage'] < $auto_disc_info['percentage'])\n\t\t{\n\t\t\t$this->_apply_discount( $auto_disc_info['coupon'] );\n\t\t}\t\t\n\t}", "function setup() {\r\n // \"Buy more than 100 items, get 50 (% or $, as per admin) off\" \r\n // $this->add_extra_level_discount(100, 50);\r\n }", "public function detectCombos()\n {\n foreach ($this->order->getProducts() as $k => $product) {\n if ($product->getCategory() == 'Shampoo') {\n foreach ($this->order->getProducts() as $key => $productB) {\n if ($productB->getCategory() == 'Conditioner') {\n $productB->setDiscount(0.5);\n }\n }\n }\n }\n }", "public function setDiscount(int $discount): void\n {\n $this->discount = ($discount > 0 && $discount <= 50) ? $discount : 0;\n\n }", "private function setSoldIndividually() {\n $this->product->set_sold_individually($this->wcData->isSoldIndividually());\n }", "function apply_deals_discounts_after_tax( $values, $price ) {\n\t\t\t\n\t\t\tif ($this->applied_coupons) foreach ($this->applied_coupons as $code) :\n\t\t\t\t$coupon = new cmdeals_coupon( $code );\n\t\t\t\t\n\t\t\t\tdo_action( 'cmdeals_deals_discount_after_tax_' . $coupon->type, $coupon );\n\t\t\t\t\n\t\t\t\tif ($coupon->type!='fixed_deals' && $coupon->type!='percent_deals') continue;\n\t\t\t\t\n\t\t\t\tif ( !$coupon->apply_before_tax() && $coupon->is_valid() ) :\n\t\t\t\t\t\n\t\t\t\t\t$this_item_is_discounted = false;\n\t\t\n\t\t\t\t\t// Specific deals ID's get the discount\n\t\t\t\t\tif (sizeof($coupon->deal_ids)>0) :\n\t\t\t\t\t\t\n\t\t\t\t\t\tif ((in_array($values['deal_id'], $coupon->deal_ids) || in_array($values['variation_id'], $coupon->deal_ids))) :\n\t\t\t\t\t\t\t$this_item_is_discounted = true;\n\t\t\t\t\t\tendif;\n\t\t\t\t\t\n\t\t\t\t\telse :\n\t\t\t\t\t\t\n\t\t\t\t\t\t// No deals ids - all items discounted\n\t\t\t\t\t\t$this_item_is_discounted = true;\n\t\t\t\t\t\n\t\t\t\t\tendif;\n\t\t\n\t\t\t\t\t// Specific deals ID's excluded from the discount\n\t\t\t\t\tif (sizeof($coupon->exclude_deals_ids)>0) :\n\t\t\t\t\t\t\n\t\t\t\t\t\tif ((in_array($values['deal_id'], $coupon->exclude_deals_ids) || in_array($values['variation_id'], $coupon->exclude_deals_ids))) :\n\t\t\t\t\t\t\t$this_item_is_discounted = false;\n\t\t\t\t\t\tendif;\n\t\t\t\t\t\t\n\t\t\t\t\tendif;\n\t\t\t\t\t\n\t\t\t\t\t// Apply filter\n\t\t\t\t\t$this_item_is_discounted = apply_filters( 'cmdeals_item_is_discounted', $this_item_is_discounted, $values, $before_tax = false );\n\t\t\t\t\t\n\t\t\t\t\t// Apply the discount\n\t\t\t\t\tif ($this_item_is_discounted) :\n\t\t\t\t\t\tif ($coupon->type=='fixed_deals') :\n\t\t\t\t\t\t\n\t\t\t\t\t\t\tif ($price < $coupon->amount) :\n\t\t\t\t\t\t\t\t$discount_amount = $price;\n\t\t\t\t\t\t\telse :\n\t\t\t\t\t\t\t\t$discount_amount = $coupon->amount;\n\t\t\t\t\t\t\tendif;\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t$this->discount_total = $this->discount_total + ( $discount_amount * $values['quantity'] );\n\t\t\t\t\t\t\t\n\t\t\t\t\t\telseif ($coupon->type=='percent_deals') :\n\t\t\t\t\t\t\t$this->discount_total = $this->discount_total + ( $price / 100 ) * $coupon->amount;\n\t\t\t\t\t\tendif;\n\t\t\t\t\tendif;\n\t\t\t\t\t\n\t\t\t\tendif;\n\t\t\tendforeach;\n\t\t}", "protected function applyDiscounts()\n {\n $discounts = $this->booking->bookingDiscounts;\n $this->discountedPeriodsTotal = $this->periodsTotal;\n $discountedTotal = $this->periodsTotal;\n\n if (!$discounts) return;\n\n // Apply discounts based on the order of discount sequence.\n foreach ($this->discountSequence as $sequence) {\n // Filter discounts so that we don't have to loop through all of them.\n $filteredDiscounts = $discounts->where('type', $sequence);\n\n $methodName = \"apply\" . Str::studly($sequence) . \"Discount\";\n\n // Apply and store discount information.\n foreach ($filteredDiscounts as $filteredDiscount) {\n $discountInformation = ['beforeDiscount' => $discountedTotal];\n $discountedTotal = $this->$methodName($discountedTotal, $filteredDiscount);\n $discountInformation['afterDiscount'] = $discountedTotal;\n\n if (!$this->discountApplied($discountInformation['beforeDiscount'], $discountInformation['afterDiscount'])) {\n continue;\n }\n\n $discountInformation['discount'] = $filteredDiscount;\n $this->appliedDiscounts[] = $discountInformation;\n }\n }\n\n $this->discountedPeriodsTotal = $discountedTotal;\n }", "function beforeSave(){\n\t\t\t// Get the rate\n\t\t\t$rate = 1 / $this->_getRate();\n\n\t\t\t// Convert it back to USD\n\t\t\tif(!empty($this->data['Product']['rrp'])){\n\t\t\t\t$this->data['Product']['rrp'] = $this->data['Product']['rrp'] * $rate;\n\t\t\t}\n\n\t\t\tif(!empty($this->data['Product']['start_price'])){\n\t\t\t\t$this->data['Product']['start_price'] \t= $this->data['Product']['start_price'] * $rate;\n\t\t\t}\n\n\t\t\tif(!empty($this->data['Product']['delivery_cost'])){\n\t\t\t\t$this->data['Product']['delivery_cost'] = $this->data['Product']['delivery_cost'] * $rate;\n\t\t\t}\n\n\t\t\tif(!empty($this->data['Product']['fixed_price'])){\n\t\t\t\t$this->data['Product']['fixed_price'] \t= $this->data['Product']['fixed_price'] * $rate;\n\t\t\t}\n\n\t\t\tif(!empty($this->data['Product']['minimum_price'])){\n\t\t\t\t$this->data['Product']['minimum_price'] = $this->data['Product']['minimum_price'] * $rate;\n\t\t\t}\n\n\t\t\treturn true;\n\t\t}", "public function setEmptyProducts(){\n foreach ($this->products as $i => $product) {\n $counts = $product->variant->maxCounts;\n //print_R($product);\n $allCount=0;\n foreach ($counts as $count){\n $allCount = $allCount+$count->count;\n }\n if($allCount<=0 || $product->variant->status==0 || $product->product->status==0 ){\n $product->status=0;\n $product->save(true);\n }\n if($product->count > $allCount){\n $product->count = $allCount;\n $product->save(true);\n }\n if($product->count==0){\n\n //unset($this->products[$i]);\n //$product->status=0;\n //$product->save(true);\n $this->removeProduct($product->id);\n }\n }\n foreach ($this->emptyProducts as $i => $emptyProduct) {\n $emptyCounts = $emptyProduct->variant->maxCounts;\n $emptyAllCount=0;\n foreach ($emptyCounts as $emptyCount){\n $emptyAllCount = $emptyAllCount+$emptyCount->count;\n }\n if($emptyAllCount>0 && $emptyProduct->variant->status==1 && $emptyProduct->product->status==1){\n $emptyProduct->status=1;\n $emptyProduct->save(true);\n }\n }\n }", "protected function setOfferApplicablePricing ()\n {\n $offerApplicableAccountHeads = $this->getOfferApplicableAccountHeads();\n\n foreach ( $this->request->pricing as $accountHead => $amount ) {\n if ( in_array($accountHead, $offerApplicableAccountHeads) ) {\n $this->offerApplicablePricing[ $accountHead ] = $amount;\n $this->offerApplicableAmount += $amount;\n }\n }\n }", "public function is_valid_for_product( $product, $values = array() ) {\n\t\tif ( ! $this->is_type( wc_get_product_coupon_types() ) ) {\n\t\t\treturn apply_filters( 'woocommerce_coupon_is_valid_for_product', false, $product, $this, $values );\n\t\t}\n\n\t\t$valid = false;\n\t\t$product_cats = wc_get_product_cat_ids( $product->id );\n\n\t\t// Specific products get the discount\n\t\tif ( sizeof( $this->product_ids ) > 0 ) {\n\t\t\tif ( in_array( $product->id, $this->product_ids ) || ( isset( $product->variation_id ) && in_array( $product->variation_id, $this->product_ids ) ) || in_array( $product->get_parent(), $this->product_ids ) ) {\n\t\t\t\t$valid = true;\n\t\t\t}\n\t\t}\n\n\t\t// Category discounts\n\t\tif ( sizeof( $this->product_categories ) > 0 ) {\n\t\t\tif ( sizeof( array_intersect( $product_cats, $this->product_categories ) ) > 0 ) {\n\t\t\t\t$valid = true;\n\t\t\t}\n\t\t}\n\n\t\tif ( ! sizeof( $this->product_ids ) && ! sizeof( $this->product_categories ) ) {\n\t\t\t// No product ids - all items discounted\n\t\t\t$valid = true;\n\t\t}\n\n\t\t// Specific product ID's excluded from the discount\n\t\tif ( sizeof( $this->exclude_product_ids ) > 0 ) {\n\t\t\tif ( in_array( $product->id, $this->exclude_product_ids ) || ( isset( $product->variation_id ) && in_array( $product->variation_id, $this->exclude_product_ids ) ) || in_array( $product->get_parent(), $this->exclude_product_ids ) ) {\n\t\t\t\t$valid = false;\n\t\t\t}\n\t\t}\n\n\t\t// Specific categories excluded from the discount\n\t\tif ( sizeof( $this->exclude_product_categories ) > 0 ) {\n\t\t\tif ( sizeof( array_intersect( $product_cats, $this->exclude_product_categories ) ) > 0 ) {\n\t\t\t\t$valid = false;\n\t\t\t}\n\t\t}\n\n\t\t// Sale Items excluded from discount\n\t\tif ( $this->exclude_sale_items == 'yes' ) {\n\t\t\t$product_ids_on_sale = wc_get_product_ids_on_sale();\n\n\t\t\tif ( isset( $product->variation_id ) ) {\n\t\t\t\tif ( in_array( $product->variation_id, $product_ids_on_sale, true ) ) {\n\t\t\t\t\t$valid = false;\n\t\t\t\t}\n\t\t\t} elseif ( in_array( $product->id, $product_ids_on_sale, true ) ) {\n\t\t\t\t$valid = false;\n\t\t\t}\n\t\t}\n\n\t\treturn apply_filters( 'woocommerce_coupon_is_valid_for_product', $valid, $product, $this, $values );\n\t}", "function get_discounted_price( $values, $price, $add_totals = false ) {\n\t\n\t\t\tif ($this->applied_coupons) foreach ($this->applied_coupons as $code) :\n\t\t\t\t$coupon = new cmdeals_coupon( $code );\n\t\t\t\t\n\t\t\t\tif ( $coupon->apply_before_tax() && $coupon->is_valid() ) :\n\t\t\t\t\t\n\t\t\t\t\tswitch ($coupon->type) :\n\t\t\t\t\t\n\t\t\t\t\t\tcase \"fixed_deals\" :\n\t\t\t\t\t\tcase \"percent_deals\" :\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t$this_item_is_discounted = false;\n\t\t\t\t\n\t\t\t\t\t\t\t// Specific deals ID's get the discount\n\t\t\t\t\t\t\tif (sizeof($coupon->deal_ids)>0) :\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tif ((in_array($values['deal_id'], $coupon->deal_ids) || in_array($values['variation_id'], $coupon->deal_ids))) :\n\t\t\t\t\t\t\t\t\t$this_item_is_discounted = true;\n\t\t\t\t\t\t\t\tendif;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\telse :\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t// No deals ids - all items discounted\n\t\t\t\t\t\t\t\t$this_item_is_discounted = true;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tendif;\n\t\t\t\t\n\t\t\t\t\t\t\t// Specific deals ID's excluded from the discount\n\t\t\t\t\t\t\tif (sizeof($coupon->exclude_deals_ids)>0) :\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tif ((in_array($values['deal_id'], $coupon->exclude_deals_ids) || in_array($values['variation_id'], $coupon->exclude_deals_ids))) :\n\t\t\t\t\t\t\t\t\t$this_item_is_discounted = false;\n\t\t\t\t\t\t\t\tendif;\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tendif;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Apply filter\n\t\t\t\t\t\t\t$this_item_is_discounted = apply_filters( 'cmdeals_item_is_discounted', $this_item_is_discounted, $values, $before_tax = true );\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Apply the discount\n\t\t\t\t\t\t\tif ($this_item_is_discounted) :\n\t\t\t\t\t\t\t\tif ($coupon->type=='fixed_deals') :\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tif ($price < $coupon->amount) :\n\t\t\t\t\t\t\t\t\t\t$discount_amount = $price;\n\t\t\t\t\t\t\t\t\telse :\n\t\t\t\t\t\t\t\t\t\t$discount_amount = $coupon->amount;\n\t\t\t\t\t\t\t\t\tendif;\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t$price = $price - $coupon->amount;\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tif ($price<0) $price = 0;\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tif ($add_totals) :\n\t\t\t\t\t\t\t\t\t\t$this->discount_cart = $this->discount_cart + ( $discount_amount * $values['quantity'] );\n\t\t\t\t\t\t\t\t\tendif;\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\telseif ($coupon->type=='percent_deals') :\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t$percent_discount = ( $values['data']->get_price( false ) / 100 ) * $coupon->amount;\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tif ($add_totals) $this->discount_cart = $this->discount_cart + ( $percent_discount * $values['quantity'] );\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t$price = $price - $percent_discount;\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tendif;\n\t\t\t\t\t\t\tendif;\n\t\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\n\t\t\t\t\t\tcase \"fixed_cart\" :\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t/** \n\t\t\t\t\t\t\t * This is the most complex discount - we need to divide the discount between rows based on their price in\n\t\t\t\t\t\t\t * proportion to the subtotal. This is so rows with different tax rates get a fair discount, and so rows\n\t\t\t\t\t\t\t * with no price (free) don't get discount too.\n\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Get item discount by dividing item cost by subtotal to get a %\n\t\t\t\t\t\t\t$discount_percent = ($values['data']->get_price( false )*$values['quantity']) / $this->subtotal_ex_tax;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Use pence to help prevent rounding errors\n\t\t\t\t\t\t\t$coupon_amount_pence = $coupon->amount * 100;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Work out the discount for the row\n\t\t\t\t\t\t\t$item_discount = $coupon_amount_pence * $discount_percent;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Work out discount per item\n\t\t\t\t\t\t\t$item_discount = $item_discount / $values['quantity'];\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Pence\n\t\t\t\t\t\t\t$price = ( $price * 100 );\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Check if discount is more than price\n\t\t\t\t\t\t\tif ($price < $item_discount) :\n\t\t\t\t\t\t\t\t$discount_amount = $price;\n\t\t\t\t\t\t\telse :\n\t\t\t\t\t\t\t\t$discount_amount = $item_discount;\n\t\t\t\t\t\t\tendif;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Take discount off of price (in pence)\n\t\t\t\t\t\t\t$price = $price - $discount_amount;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Back to pounds\n\t\t\t\t\t\t\t$price = $price / 100; \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Cannot be below 0\n\t\t\t\t\t\t\tif ($price<0) $price = 0;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Add coupon to discount total (once, since this is a fixed cart discount and we don't want rounding issues)\n\t\t\t\t\t\t\tif ($add_totals) $this->discount_cart = $this->discount_cart + (($discount_amount*$values['quantity']) / 100);\n\t\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\n\t\t\t\t\t\tcase \"percent\" :\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Get % off each item - this works out the same as doing the whole cart\n\t\t\t\t\t\t\t//$percent_discount = ( $values['data']->get_price( false ) / 100 ) * $coupon->amount;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t$percent_discount = ( $values['data']->get_price( ) / 100 ) * $coupon->amount;\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tif ($add_totals) $this->discount_cart = $this->discount_cart + ( $percent_discount * $values['quantity'] );\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t$price = $price - $percent_discount;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\n\t\t\t\t\tendswitch;\n\t\t\t\t\t\n\t\t\t\tendif;\n\t\t\tendforeach;\n\t\t\t\n\t\t\treturn apply_filters( 'cmdeals_get_discounted_price_', $price, $values, $this );\n\t\t}", "public function set_credits_discountamount($observer)\n {\n$array2 = Mage::helper('kartparadigm_storecredit')->getCreditRates();\n//Mage::log(Mage::helper('kartparadigm_storecredit')->getRefundDeductConfig() . \" configuration settings \");\n//Mage::log($array2);\n $session = Mage::getSingleton('checkout/session');\n if(Mage::helper('customer')->isLoggedIn()) {\n $customer = Mage::getSingleton('customer/session')->getCustomer();\n $customer_group=Mage::getModel('customer/group')->load(Mage::getSingleton('customer/session')->getCustomerGroupId())->getCustomerGroupCode();\n}\n \n$val1 = Mage::getSingleton('adminhtml/session')->getValue();\nif(isset($val1))\n{\n$amt1 = array();\n$amt1 = Mage::getSingleton('checkout/session')->getCredits();\n$amt = $amt1['totalCredits'];\n$quote = Mage::getSingleton('adminhtml/session_quote')->getQuote();\n}\nelse{\n$amt1 = array();\n $quote = Mage::getModel('checkout/cart')->getQuote();\n$amt1 = Mage::getSingleton('checkout/session')->getCredits();\n$amt = $amt1['discountCredits'];\n}\n $isvirtual=0;\n foreach($quote->getAllItems() as $item){\n if($item->getIsVirtual()==1) {\n $isvirtual=1;\n }\n if(Mage::getModel('catalog/product')->load($item->getProductId())->getTypeId()=='customproduct'){\n $isvirtual=1;\n }\n }\n$total=$quote->getGrandTotal(); \n\n$subTotal = $quote->getSubtotal();\n//Mage::log($quote->getGrandTotal().\"this is grand total store credit\");\n//Mage::log($quote->getSubtotal().\"this is sub total\");\n\n if (!Mage::helper('kartparadigm_storecredit')->getTaxEnabled()){\n$tax = $quote->getShippingAddress()->getData('tax_amount');\n}\n if(!Mage::helper('kartparadigm_storecredit')->getIsShippingEnabled()){\n$shippingPrice = $quote->getShippingAddress()->getShippingAmount();\n}\n$totalCredits1 = array();\n$totalCredits1 = Mage::getSingleton('checkout/session')->getCredits();\n$totalCredits = $totalCredits1['totalCredits'];\n\n$currentTimestamp = Mage::getModel('core/date')->timestamp(time()); \n$nowdate = date('Y-m-d H:m:s', $currentTimestamp); \n//echo $expirydate;\n//echo $nowdate;\n$balance;\n//echo $amt;\n$amt2;\n $amt1;\n \n\nif(isset($amt)){\n/*---------------------Calculating Default Currency Value----------------------- */\n$amt1 = ($array2['basevalue'] * $amt) / $array2['credits'];\n $baseCurrencyCode = Mage::app()->getStore()->getBaseCurrencyCode();\n $currentCurrencyCode = Mage::app()->getStore()->getCurrentCurrencyCode();\n if ($baseCurrencyCode != $currentCurrencyCode) {\n $amt2 = Mage::helper('directory')->currencyConvert($amt1, $baseCurrencyCode, $currentCurrencyCode);\n }\n else{\n $amt2 = $amt1; \n }\n // $amt2 = Mage::helper('core')->currency($amt1, true, false);\n//Mage::log($amt1.\" = amount = \".$amt2 );\n//----------------------------------------------------------------\nif($total > $amt2) {\nif(($total - $tax - $shippingPrice) > $amt2){\n$discountAmount = $amt2;\n$balance = $totalCredits - $amt;\n}else{\n $discountAmount = $subTotal;\n$points = round(($discountAmount * $amt)/$amt2);\n//Mage::log($points.\"Conver Points\");\n$balance = $totalCredits - $points;\n}\n}\nelse {\n$discountAmount = $total - $tax - $shippingPrice;\n$points = round(($discountAmount * $amt)/$amt2);\n//Mage::log($points.\"Conver Points\");\n$balance = $totalCredits - $points;\n}\nMage::getSingleton('core/session')->setBalance($balance);\n\nMage::getSingleton('checkout/session')->setDiscount($totalCredits - $balance);\n$msg = \"Current Credits In Your Account : \" . $balance;\nMage::getSingleton('core/session')->setCredits($msg);\n if ($discountAmount > 0) {\n\n\nif ($baseCurrencyCode != $currentCurrencyCode) {\n \n$allowedCurrencies = Mage::getModel('directory/currency')->getConfigAllowCurrencies();\n$rates = Mage::getModel('directory/currency')->getCurrencyRates($baseCurrencyCode, array_values($allowedCurrencies));\n\n$baseDiscount = $discountAmount/$rates[$currentCurrencyCode];\n\n }\nelse{\n $baseDiscount = $discountAmount;\n } \n $total = $quote->getBaseSubtotal();\n $data1 = $quote->getData();\n // Mage::log($data1['entity_id'].\"quote id\");\n $quote->setSubtotal(0);\n $quote->setBaseSubtotal(0);\n $quote->setSubtotalWithDiscount(0);\n $quote->setBaseSubtotalWithDiscount(0);\n $quote->setGrandTotal(0);\n $quote->setBaseGrandTotal(0);\n $canAddItems = $quote->isVirtual() ? ('billing') : ('shipping');\n foreach($quote->getAllAddresses() as $address) {\n $data = $address->getData();\n $address->setSubtotal(0);\n $address->setBaseSubtotal(0);\n $address->setGrandTotal(0);\n $address->setBaseGrandTotal(0);\n $address->collectTotals();\n $quote->setSubtotal((float)$quote->getSubtotal() + $address->getSubtotal());\n $quote->setBaseSubtotal((float)$quote->getBaseSubtotal() + $address->getBaseSubtotal());\n $quote->setSubtotalWithDiscount((float)$quote->getSubtotalWithDiscount() + $address->getSubtotalWithDiscount());\n $quote->setBaseSubtotalWithDiscount((float)$quote->getBaseSubtotalWithDiscount() + $address->getBaseSubtotalWithDiscount());\n $quote->setGrandTotal((float)$quote->getGrandTotal() + $address->getGrandTotal());\n $quote->setBaseGrandTotal((float)$quote->getBaseGrandTotal() + $address->getBaseGrandTotal());\n $quote->setEntityId($data1['entity_id'])->save();\n $quote->setSubtotalWithDiscount($quote->getSubtotal() - $discountAmount)->setBaseSubtotalWithDiscount($quote->getBaseSubtotal() - $baseDiscount)->setEntityId($data1['entity_id'])->save();\n if ($address->getAddressType() == $canAddItems) {\n $address->setSubtotalWithDiscount((float)$data['subtotal_with_discount'] - $discountAmount);\n $address->setGrandTotal((float)$data['grand_total'] - $discountAmount);\n $address->setBaseSubtotalWithDiscount((float)$data['base_subtotal_with_discount'] - $baseDiscount);\n $address->setBaseGrandTotal((float)$data['base_grand_total'] - $baseDiscount);\n if ($data['discount_description']) {\n $address->setDiscountAmount(($data['discount_amount'] - $discountAmount));\n $address->setDiscountDescription($data['discount_description'] . ', Store Credits');\n $address->setBaseDiscountAmount(($data['base_discount_amount'] - $baseDiscount));\n }\n else {\n $address->setDiscountAmount(-($discountAmount));\n $address->setDiscountDescription('Store Credits');\n $address->setBaseDiscountAmount(-($baseDiscount));\n }\n $address->setAddressId($data['address_id'])->save();\n }\n }\n foreach($quote->getAllItems() as $item) {\n\n // We apply discount amount based on the ratio between the GrandTotal and the RowTotal\n $rat = $item->getPriceInclTax() / $quote->getSubtotal();\n $rat1 = $item->getBasePriceInclTax() / $quote->getBaseSubtotal();\n $ratdisc = $discountAmount * $rat;\n $ratdisc1 = $baseDiscount * $rat1;\n//Mage::log($item->getDiscountAmount().\"include tax\".$item->getBaseDiscountAmount());\n // Mage::log($item->getDiscountAmount().\"discount storecredit\");\n$idata = $item->getData();\n Mage::log($item->getDiscountAmount().\"discount amount credit\");\n $item->setDiscountAmount(($item->getDiscountAmount() + $ratdisc) * $item->getQty());\n $item->setBaseDiscountAmount(($item->getBaseDiscountAmount() + $ratdisc1) * $item->getQty())->save();\n }\n }else if($totalCredits == 0){\n\n$msg = \"Sorry You Have No Credits In Your Account\";\nMage::getSingleton('core/session')->setCredits($msg);\n}\n \n \n } \n }", "function apply_special_category_discount($category, $count, &$disc_amount) {\r\n switch($category) {\r\n case 99999:\r\n case 99998:\r\n if ($count > 100) {\r\n $disc_amount = 50; \r\n }\r\n break; \r\n case 99997:\r\n $disc_amount = 75;\r\n break;\r\n }\r\n }", "public function testSetGetDiscount()\n {\n $this->item->setPrice(85.00);\n $this->item->setQuantity(1);\n $this->item->addDiscount(\n (new FlatDiscount())\n ->setFigure(15.00)\n );\n\n $this->assertEquals($this->item->getPriceTotal(), 85.00);\n $this->assertEquals($this->item->getNetTotal(), 70.00);\n $this->assertEquals($this->item->getDiscount(), 15.00);\n }", "private function setRecountProduct() {\n\n //$this->model->setDocumentNumber($this->getDocumentNumber);\n $sql = null;\n if ($this->getVendor() == self::MYSQL) {\n $sql = \"\n INSERT INTO `productrecount` \n (\n `companyId`,\n `warehouseId`,\n `productCode`,\n `productDescription`,\n `productRecountDate`,\n `productRecountSystemQuantity`,\n `productRecountPhysicalQuantity`,\n `isDefault`,\n `isNew`,\n `isDraft`,\n `isUpdate`,\n `isDelete`,\n `isActive`,\n `isApproved`,\n `isReview`,\n `isPost`,\n `executeBy`,\n `executeTime`\n ) VALUES ( \n '\" . $this->getCompanyId() . \"',\n '\" . $this->model->getWarehouseId() . \"',\n '\" . $this->model->getProductCode() . \"',\n '\" . $this->model->getProductDescription() . \"',\n '\" . $this->model->getProductRecountDate() . \"',\n '\" . $this->model->getProductRecountSystemQuantity() . \"',\n '\" . $this->model->getProductRecountPhysicalQuantity() . \"',\n '\" . $this->model->getIsDefault(0, 'single') . \"',\n '\" . $this->model->getIsNew(0, 'single') . \"',\n '\" . $this->model->getIsDraft(0, 'single') . \"',\n '\" . $this->model->getIsUpdate(0, 'single') . \"',\n '\" . $this->model->getIsDelete(0, 'single') . \"',\n '\" . $this->model->getIsActive(0, 'single') . \"',\n '\" . $this->model->getIsApproved(0, 'single') . \"',\n '\" . $this->model->getIsReview(0, 'single') . \"',\n '\" . $this->model->getIsPost(0, 'single') . \"',\n '\" . $this->model->getExecuteBy() . \"',\n \" . $this->model->getExecuteTime() . \"\n );\";\n } else {\n if ($this->getVendor() == self::MSSQL) {\n $sql = \"\n INSERT INTO [productRecount]\n (\n [productRecountId],\n [companyId],\n [warehouseId],\n [productCode],\n [productDescription],\n [productRecountDate],\n [productRecountSystemQuantity],\n [productRecountPhysicalQuantity],\n [isDefault],\n [isNew],\n [isDraft],\n [isUpdate],\n [isDelete],\n [isActive],\n [isApproved],\n [isReview],\n [isPost],\n [executeBy],\n [executeTime]\n) VALUES (\n '\" . $this->getCompanyId() . \"',\n '\" . $this->model->getWarehouseId() . \"',\n '\" . $this->model->getProductCode() . \"',\n '\" . $this->model->getProductDescription() . \"',\n '\" . $this->model->getProductRecountDate() . \"',\n '\" . $this->model->getProductRecountSystemQuantity() . \"',\n '\" . $this->model->getProductRecountPhysicalQuantity() . \"',\n '\" . $this->model->getIsDefault(0, 'single') . \"',\n '\" . $this->model->getIsNew(0, 'single') . \"',\n '\" . $this->model->getIsDraft(0, 'single') . \"',\n '\" . $this->model->getIsUpdate(0, 'single') . \"',\n '\" . $this->model->getIsDelete(0, 'single') . \"',\n '\" . $this->model->getIsActive(0, 'single') . \"',\n '\" . $this->model->getIsApproved(0, 'single') . \"',\n '\" . $this->model->getIsReview(0, 'single') . \"',\n '\" . $this->model->getIsPost(0, 'single') . \"',\n '\" . $this->model->getExecuteBy() . \"',\n \" . $this->model->getExecuteTime() . \"\n );\";\n } else {\n if ($this->getVendor() == self::ORACLE) {\n $sql = \"\n INSERT INTO PRODUCTRECOUNT\n (\n COMPANYID,\n WAREHOUSEID,\n PRODUCTCODE,\n PRODUCTDESCRIPTION,\n PRODUCTRECOUNTDATE,\n PRODUCTRECOUNTSYSTEMQUANTITY,\n PRODUCTRECOUNTPHYSICALQUANTITY,\n ISDEFAULT,\n ISNEW,\n ISDRAFT,\n ISUPDATE,\n ISDELETE,\n ISACTIVE,\n ISAPPROVED,\n ISREVIEW,\n ISPOST,\n EXECUTEBY,\n EXECUTETIME\n ) VALUES (\n '\" . $this->getCompanyId() . \"',\n '\" . $this->model->getWarehouseId() . \"',\n '\" . $this->model->getProductCode() . \"',\n '\" . $this->model->getProductDescription() . \"',\n '\" . $this->model->getProductRecountDate() . \"',\n '\" . $this->model->getProductRecountSystemQuantity() . \"',\n '\" . $this->model->getProductRecountPhysicalQuantity() . \"',\n '\" . $this->model->getIsDefault(0, 'single') . \"',\n '\" . $this->model->getIsNew(0, 'single') . \"',\n '\" . $this->model->getIsDraft(0, 'single') . \"',\n '\" . $this->model->getIsUpdate(0, 'single') . \"',\n '\" . $this->model->getIsDelete(0, 'single') . \"',\n '\" . $this->model->getIsActive(0, 'single') . \"',\n '\" . $this->model->getIsApproved(0, 'single') . \"',\n '\" . $this->model->getIsReview(0, 'single') . \"',\n '\" . $this->model->getIsPost(0, 'single') . \"',\n '\" . $this->model->getExecuteBy() . \"',\n \" . $this->model->getExecuteTime() . \"\n );\";\n }\n }\n }\n try {\n $this->q->create($sql);\n } catch (\\Exception $e) {\n $this->q->rollback();\n echo json_encode(array(\"success\" => false, \"message\" => $e->getMessage()));\n exit();\n }\n }", "public function setAttributes_discounted( $attributes_discounted ) {\n\t\t$this->attributes_discounted = $attributes_discounted;\n\t}", "public function applyDiscount()\n {\n if (request('discountType') == 1) {\n cart()->applyDiscount($percentage = request('red'));\n return $this->getCartDetails();\n }\n cart()->applyFlatDiscount($amount = request('discountInput'));\n\n return redirect()->route('cart');\n }", "protected function calculatePrices()\n {\n }", "function applyDiscountOnSubscription($subscriptionId = null)\n {\n $db = new db();\n $db->makeConnection();\n\n if($subscriptionId != null)\n {\n \t\\Stripe\\Stripe::setApiKey(STRPIE_CLIENT_SECRET);\n\n $date = date('Y-m-d 00:00:00');\n $discountTotal = 0;\n\n // Select plan having trial periods on\n // $query = \"SELECT price FROM billing_products BP INNER JOIN user_subscription_items USI ON BP.plan_id = USI.plan_id WHERE BP.trial_period != 0 AND USI.subscription_id = '{$subscriptionId}' AND USI.coupon_trial_from <= '{$date}' AND USI.coupon_trial_to >= '{$date}'\";\n $query = \"SELECT price FROM billing_products BP INNER JOIN user_subscription_items USI ON BP.plan_id = USI.plan_id WHERE BP.trial_period != 0 AND USI.subscription_id = '{$subscriptionId}' AND USI.coupon_trial_from <= '{$date}' AND USI.coupon_trial_to > '{$date}' AND USI.status = '1'\";\n $res = $db->query($query);\n\n if($db->numRows($res))\n {\n while ($rs = mysqli_fetch_array($res))\n {\n $discountTotal += $rs['price'];\n }\n\n //\n if($discountTotal)\n {\n // Fetch if coupon exist, otherwise create\n $couponId = 'OFF-'.$discountTotal;\n\n try {\n // Retrieve coupon\n $coupon = \\Stripe\\Coupon::retrieve($couponId);\n } catch (\\Stripe\\Error\\Base $e) {\n // Create coupon\n $coupon = \\Stripe\\Coupon::create([\n 'id' => $couponId,\n 'amount_off' => ($discountTotal*100),\n 'currency' => 'SEK',\n 'duration' => 'once',\n // 'duration' => 'repeating',\n // 'duration_in_months' => 3,\n ]);\n }\n\n // Apply coupon on subscription\n if($coupon)\n {\n try {\n // Update subscription\n \\Stripe\\Subscription::update(\n $subscriptionId,\n ['coupon' => $coupon->id]\n );\n } catch (\\Stripe\\Error\\Base $e) {}\n }\n }\n else\n {\n \ttry {\n $sub = \\Stripe\\Subscription::retrieve($subscriptionId);\n\n if( isset($sub->discount) && ($sub->discount != null) )\n {\n $sub->deleteDiscount();\n }\n } catch (\\Stripe\\Error\\Base $e) {}\n }\n }\n else\n {\n \ttry {\n $sub = \\Stripe\\Subscription::retrieve($subscriptionId);\n\n if( isset($sub->discount) && ($sub->discount != null) )\n {\n $sub->deleteDiscount();\n }\n } catch (\\Stripe\\Error\\Base $e) {}\n }\n }\n }", "public function smart_coupons_discount_total_filters() {\n\t\t\tif ( WCS_SC_Compatibility::is_cart_contains_subscription() && WCS_SC_Compatibility::is_wcs_gte( '2.0.0' ) ) {\n\t\t\t\tadd_action( 'woocommerce_after_calculate_totals', array( $this, 'smart_coupons_after_calculate_totals' ), 999 );\n\t\t\t} else {\n\t\t\t\tadd_action( 'woocommerce_after_calculate_totals', array( $this, 'smart_coupons_after_calculate_totals' ), 999 );\n\t\t\t\tglobal $current_screen;\n\t\t\t\tif ( ! empty( $current_screen ) && 'edit-shop_order' !== $current_screen ) {\n\t\t\t\t\tadd_filter( 'woocommerce_order_get_total', array( $this, 'smart_coupons_order_discounted_total' ), 10, 2 );\n\t\t\t\t}\n\t\t\t}\n\t\t}", "private function setEnableReviews() {\n $this->product->set_reviews_allowed($this->wcData->isEnableReviews());\n }", "public function updateProductAdvance(Request $request){\n $productId = $request->productId;\n if (isset($productId)) {\n $product = Product::find($productId);\n $proSection = ProductSections::where('productId',$productId)->first();\n\n if ($request->section) {\n $section = implode(',', $request->section);\n $product->update( [\n 'productSection' => @$section,\n \n ]);\n }\n\n if (@$proSection->productId) {\n $productSection = ProductSections::find($proSection->id);\n\n if ($request->related_product) {\n $allproduct = implode(',', $request->related_product);\n $productSection->update( [\n 'related_product' => $allproduct,\n ]);\n }\n\n if ($request->customerGroupId != '') {\n $customerGroupId = implode(',', @$request->customerGroupId); \n }\n $productSection->update( [\n 'free_shipping' => $request->free_shipping,\n 'pre_order' => $request->pre_order,\n 'pre_orderDuration' => $request->pre_orderDuration, \n 'customerGroupId' => @$customerGroupId, \n 'customerGroupPrice' => @$request->customerGroupPrice, \n ]);\n \n if ($request->hotDeal && $request->hotDiscount && $request->hotDate) {\n $productSection->update( [\n 'hotDiscount' => $request->hotDiscount,\n 'hotDate' => $request->hotDate,\n /* 'specialDiscount' => '',\n 'specialDate' => '',*/\n ]);\n }else{\n $productSection->update( [\n 'hotDiscount' => '',\n 'hotDate' => '',\n \n ]);\n }\n\n if ($request->specialDeal && $request->specialDiscount && $request->specialDate) {\n $productSection->update( [\n /* 'hotDiscount' => '',\n 'hotDate' => '',*/\n 'specialDiscount' => $request->specialDiscount,\n 'specialDate' => $request->specialDate,\n\n ]);\n\n }else{\n $productSection->update( [\n 'specialDiscount' => '',\n 'specialDate' => '',\n\n ]);\n }\n\n $countGroup = count($request->customerGroupPrice);\n DB::table('customer_group_sections')->where('productId', $productId)->delete();\n if($request->customerGroupPrice){\n $postData = [];\n for ($i=0; $i <$countGroup ; $i++) { \n $postData[] = [\n 'productId' => $productId,\n 'customerGroupId' => $request->customerGroupId[$i], \n 'customerGroupPrice' => $request->customerGroupPrice[$i]\n ];\n }\n \n CustomerGroupSections::insert($postData);\n }\n\n return redirect(route('product.edit',$productId))->with('msg','Advance Information Save Successfully')->withInput();\n }else{\n if ($request->related_product) {\n $allproduct = implode(',', $request->related_product);\n }\n $productSections = ProductSections::create( [\n 'productId' => $productId,\n 'hotDiscount' => $request->hotDiscount,\n 'hotDate' => $request->hotDate,\n 'specialDiscount' => $request->specialDiscount,\n 'specialDate' => $request->specialDate,\n 'related_product' => @$allproduct,\n ]);\n \n return redirect(route('product.edit',$productId))->with('msg','Advance Information Save Successfully')->withInput();\n }\n }else{\n return redirect(route('product.edit',$productId))->with('error_msg','Please Complete Basic Information ')->withInput(); \n } \n }", "protected function _applyObjectProperty()\n\t{\n\t\tparent::_applyObjectProperty();\n\n\t\t$modelName = $this->_object->getModelName();\n\n\t\tswitch ($modelName)\n\t\t{\n\t\t\tcase 'shop_discount':\n\t\t\t\t// Скидка не может быть больше 100%\n\t\t\t\tif ($this->_object->type == 0 && $this->_object->value > 100)\n\t\t\t\t{\n\t\t\t\t\t$this->_object->value = 0;\n\t\t\t\t\t$this->_object->save();\n\n\t\t\t\t\t$this->addMessage(\n\t\t\t\t\t\tCore_Message::get(Core::_('Shop_Discount.percent_error'), 'error')\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\t// Группа доступа\n\t\t\t\t$aSiteuser_Groups = array(0 => Core::_('Structure.all'));\n\n\t\t\t\tif (Core::moduleIsActive('siteuser'))\n\t\t\t\t{\n\t\t\t\t\t$oSiteuser_Controller_Edit = new Siteuser_Controller_Edit($this->_Admin_Form_Action);\n\t\t\t\t\t$aSiteuser_Groups = $aSiteuser_Groups + $oSiteuser_Controller_Edit->fillSiteuserGroups($this->_object->Shop->site_id);\n\t\t\t\t}\n\n\t\t\t\t$aTmp = array();\n\n\t\t\t\t$aShop_Discount_Siteuser_Groups = $this->_object->Shop_Discount_Siteuser_Groups->findAll(FALSE);\n\t\t\t\tforeach ($aShop_Discount_Siteuser_Groups as $oShop_Discount_Siteuser_Group)\n\t\t\t\t{\n\t\t\t\t\t!in_array($oShop_Discount_Siteuser_Group->siteuser_group_id, $aTmp)\n\t\t\t\t\t\t&& $aTmp[] = $oShop_Discount_Siteuser_Group->siteuser_group_id;\n\t\t\t\t}\n\n\t\t\t\tforeach ($aSiteuser_Groups as $siteuser_group_id => $name)\n\t\t\t\t{\n\t\t\t\t\t$bSiteuserGroupChecked = Core_Array::getPost('siteuser_group_' . $siteuser_group_id);\n\n\t\t\t\t\tif ($bSiteuserGroupChecked)\n\t\t\t\t\t{\n\t\t\t\t\t\tif (!in_array($siteuser_group_id, $aTmp))\n\t\t\t\t\t\t{\n\n\t\t\t\t\t\t\t$oShop_Discount_Siteuser_Group = Core_Entity::factory('Shop_Discount_Siteuser_Group');\n\t\t\t\t\t\t\t$oShop_Discount_Siteuser_Group->siteuser_group_id = $siteuser_group_id;\n\t\t\t\t\t\t\t$this->_object->add($oShop_Discount_Siteuser_Group);\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 (in_array($siteuser_group_id, $aTmp))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$oShop_Discount_Siteuser_Group = $this->_object->Shop_Discount_Siteuser_Groups->getObject($this->_object, $siteuser_group_id);\n\n\t\t\t\t\t\t\t!is_null($oShop_Discount_Siteuser_Group)\n\t\t\t\t\t\t\t\t&& $oShop_Discount_Siteuser_Group->delete();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\tbreak;\n\t\t}\n\n\t\tCore_Event::notify(get_class($this) . '.onAfterRedeclaredApplyObjectProperty', $this, array($this->_Admin_Form_Controller));\n\n\t\treturn $this;\n\t}", "function _apply_discount($coupon)\n\t{\n\t\t$this->database->SaveCheatCode($coupon);\n\t\t$discount_percentage = 0;\n\t\t$coupon_info = $this->database->GetDiscountCoupon($coupon);\n\n\t\t//Run some conditional-check for code\n\t\tif($this->_can_apply_code($coupon_info))\n\t\t{\n\t\t\t$discount_percentage = $this->_getDiscount($coupon);\n\t\t\t$this->cart->apply_discount($coupon, $discount_percentage);\n\t\t}\n\n\t\t$this->_notify_discount_applied($discount_percentage, $coupon_info);\n\n\t}", "public function magicMethod(){\n $cart = $this->_getCart();\n $quoteArrayFreeProducts = array();\n $quoteArrayNonFreeProducts = array();\n $AddThisInCart = array();\n $finalAdd = array();\n\n // finding both free and non free products and saving them in array\n $quote = Mage::getSingleton('checkout/session')->getQuote();\n foreach($quote->getAllVisibleItems() as $item) {\n if($item->getData('price') == 0){\n $quoteArrayFreeProducts['item_id'][] = $item->getData('product_id');\n $quoteArrayFreeProducts['qty'][] = $item->getData('qty');\n }else{\n $quoteArrayNonFreeProducts['item_id'][] = $item->getData('product_id');\n $quoteArrayNonFreeProducts['qty'][] = $item->getData('qty');\n }\n }\n \n // print_r($quoteArrayFreeProducts);die;\n // finding free associatied produts and adding them in another array\n for($i = 0; $i < count($quoteArrayNonFreeProducts['item_id']) ;$i++){\n $product = Mage::getModel('catalog/product')->load($quoteArrayNonFreeProducts['item_id'][$i]);\n // print_r($product->getAttributeText('buyxgety'));die;\n if($product->getAttributeText('buyxgety') == 'Enable'){\n $Buyxgety_xqty = $product->getBuyxgety_xqty();\n $Buyxgety_ysku = $product->getBuyxgety_ysku();\n $Buyxgety_yqty = $product->getBuyxgety_yqty();\n\n // $Buyxgety_ydiscount = $product->getBuyxgety_ydiscount();\n if(!empty($Buyxgety_xqty) && !empty($Buyxgety_ysku) && !empty($Buyxgety_yqty) ){\n // die($Buyxgety_ysku);\n $AddThisInCart['item_id'][] = Mage::getModel('catalog/product')->getIdBySku($Buyxgety_ysku);\n $AddThisInCart['qty'][] = (int)($quoteArrayNonFreeProducts['qty'][$i]/$Buyxgety_xqty)*$Buyxgety_yqty;\n }\n }\n }\n for($i = 0; $i < count($AddThisInCart['item_id']) ;$i++){\n if(isset($quoteArrayFreeProducts['item_id'])){\n for($j = 0; $j < count($quoteArrayFreeProducts['item_id']) ;$j++){\n if($AddThisInCart['item_id'][$i] == $quoteArrayFreeProducts['item_id'][$j]){\n $finalAdd['item_id'][] = $AddThisInCart['item_id'][$i];\n $finalAdd['qty'][] = $AddThisInCart['qty'][$i] - $quoteArrayFreeProducts['qty'][$j];\n }else{\n $finalAdd['item_id'][] = $AddThisInCart['item_id'][$i];\n $finalAdd['qty'][] = $AddThisInCart['qty'][$i];\n }\n }\n }else{\n $finalAdd['item_id'][] = $AddThisInCart['item_id'][$i];\n $finalAdd['qty'][] = $AddThisInCart['qty'][$i];\n }\n }\n\n for($i = 0; $i < count($finalAdd['item_id']) ;$i++){\n for($j = 0; $j < count($quoteArrayNonFreeProducts['item_id']); $j++){\n if($finalAdd['item_id'][$i] == $quoteArrayNonFreeProducts['item_id'][$j]){\n foreach ($quoteArrayFreeProducts['item_id'] as $value) {\n if($value == $finalAdd['item_id'][$i]){\n $flag = 1;\n }else{\n $flag = 0;\n }\n }\n if($flag == 1){\n $finalAdd['new_row'][] = 0;\n }else{\n $finalAdd['new_row'][] = 1;\n }\n }\n }\n if(!empty($quoteArrayFreeProducts['item_id'])){\n for($j = 0; $j < count($quoteArrayFreeProducts['item_id']); $j++){\n if($finalAdd['item_id'][$i] == $quoteArrayFreeProducts['item_id'][$j]){\n $finalAdd['new_row'][] = 0;\n }else{\n $finalAdd['new_row'][] = 1;\n }\n }\n }else{\n $finalAdd['new_row'][] = 1;\n } \n }\n\n // print_r($finalAdd);die;\n\n if(isset($finalAdd['item_id'])){\n for($i = 0; $i < count($finalAdd['item_id']) ;$i++){\n if($finalAdd['qty'][$i] > 0){\n Mage::getSingleton('core/session')->setMultilineAddingObserver($finalAdd['new_row'][$i]);\n Mage::getSingleton('core/session')->setZeroSettingObserver(1);\n if($finalAdd['new_row'][$i] == 0){\n $cartHelper = Mage::helper('checkout/cart');\n $items = $cartHelper->getCart()->getItems(); \n foreach ($items as $item) \n {\n $itemId = $item->getItemId();\n if($item->getProductId() == $finalAdd['item_id'][$i] && $item->getPrice() == 0){\n $cartHelper->getCart()->removeItem($itemId)->save();\n $this->magicMethod();\n }\n }\n }else{\n $productToAdd = $product->load($finalAdd['item_id'][$i]);\n $params['qty'] = $finalAdd['qty'][$i];\n $params['product'] = $finalAdd['item_id'][$i];\n $cart->addProduct($productToAdd, $params);\n $cart->save();\n }\n }else if($finalAdd['qty'][$i] < 0){\n $cartHelper = Mage::helper('checkout/cart');\n $items = $cartHelper->getCart()->getItems(); \n foreach ($items as $item) \n {\n $itemId = $item->getItemId();\n if($item->getProductId() == $finalAdd['item_id'][$i] && $item->getPrice() == 0){\n $cartHelper->getCart()->removeItem($itemId)->save();\n $this->_updateShoppingCart();\n }\n } \n }\n }\n }\n }", "function commerce_store_commerce_entity_access_condition_commerce_product_alter(&$conditions, $context) {\n // Make sure that a merchant (a user which owns at least one store) has\n // access to all products belonging to their store. This is used for\n // \"Merchant products\" view in user profile (/user/%/merchant/products).\n if (user_access('view any ' . $context['entity_type'] . ' entity in own store', $context['account'])) {\n // Actually this condition already is in the query, but we need to add\n // something to avoid commerce_entity_access_query_alter() adding default\n // \"where('1 = 0')\" condition if no other conditions are defined.\n $conditions->condition('commerce_store_field_data_commerce_store.uid', $context['account']->uid, '=');\n }\n // TODO: add access check for specific product types.\n}", "function changeProduct($cart_table_id,$true_or_false)\n {\n $this->pdelivery[$cart_table_id]=$true_or_false; //change product group delivery\n }", "private function calculate_summary_discount($discount_data, $taxable_value_ex_tax = 0, $non_taxable_value = 0, $tax_value = 0, $tax_rate = FALSE, \r\n\t\t$append_values = TRUE, $target_column = FALSE)\r\n\t{\r\n\t\t// Only allow 'New Value' discounts to be applied to the shipping rate, otherwise a cart of unlimited items could be sold for the 'New Value'.\r\n\t\tif (empty($discount_data) || (isset($discount_data['calculation_id']) && $discount_data['calculation_id'] == 3 && $target_column != 'shipping')\r\n\t\t)\r\n\t\t{\r\n\t\t\treturn FALSE;\r\n\t\t}\r\n\t\t\r\n\t\t// Calculate the non discounted summary total.\r\n\t\t$non_discounted_total = ($this->flexi_cart->cart_prices_inc_tax()) ? \r\n\t\t\tround(($taxable_value_ex_tax + $non_taxable_value + $tax_value), 2) : round(($taxable_value_ex_tax + $non_taxable_value), 2);\r\n\r\n\t\t// Calculate discount value.\r\n\t\t$discount = $this->calculate_discount(\r\n\t\t\t$discount_data['value_discounted'], $taxable_value_ex_tax, $non_taxable_value, $tax_value, $tax_rate,\r\n\t\t\t$discount_data['calculation_id'], $discount_data['tax_method']\r\n\t\t);\r\n\t\t\r\n\t\t// If a 'new value' shipping discount has been set that costs more than the original value, recalculate the 'new value' to equal the original value.\r\n\t\tif (($target_column == 'shipping' && $discount_data['calculation_id'] == 3) && ($discount['total'] > $non_discounted_total))\r\n\t\t{\r\n\t\t\t$discount = $this->calculate_discount(\r\n\t\t\t\t$non_discounted_total, $taxable_value_ex_tax, $non_taxable_value, $tax_value, $tax_rate,\r\n\t\t\t\t$discount_data['calculation_id'], $discount_data['tax_method']\r\n\t\t\t);\r\n\t\t}\r\n\t\t\t\t\r\n\t\t// Check discount value is set and is not more than the target column value, else it would result in a negative value.\r\n\t\tif ($discount && ($non_discounted_total >= $discount['total']))\r\n\t\t{\r\n\t\t\t$discount['non_combinable'] = (bool)$discount_data['non_combinable'];\r\n\t\t\t$discount['void_reward_points'] = (bool)$discount_data['void_reward_points'];\r\n\t\t\t\t\r\n\t\t\t// Calculate discount value and discount tax.\r\n\t\t\t$discount['value'] = ($discount['tax_method'] == 1) ? ($non_discounted_total - $discount['total']) : \r\n\t\t\t\t(($taxable_value_ex_tax + $non_taxable_value) - ($discount['taxable_value'] + $discount['non_taxable_value']));\r\n\t\t\t$discount['discount_tax'] = ($discount['value'] - ($taxable_value_ex_tax - $discount['taxable_value']) > 0) ?\r\n\t\t\t\t($discount['value'] - ($taxable_value_ex_tax - $discount['taxable_value'])) : 0;\r\n\r\n\t\t\tif ($target_column != 'reward_vouchers')\r\n\t\t\t{\r\n\t\t\t\t// Update summary discount data.\r\n\t\t\t\t$this->flexi->cart_contents['settings']['discounts']['data']['summary_discount_savings'] += $discount['value'];\t\r\n\t\t\t\t$this->flexi->cart_contents['settings']['tax']['data']['summary_discount_tax'] += $discount['discount_tax'];\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\t// Update reward voucher data.\r\n\t\t\t\t$this->flexi->cart_contents['settings']['discounts']['data']['reward_vouchers'] += $discount['value'];\t\r\n\t\t\t\t$this->flexi->cart_contents['settings']['tax']['data']['reward_voucher_tax'] += $discount['discount_tax'];\r\n\t\t\t}\t\t\t\t\r\n\t\t\t\r\n\t\t\t// Update tax columns.\r\n\t\t\tif ($append_values)\r\n\t\t\t{\r\n\t\t\t\t$this->flexi->cart_contents['settings']['tax']['data']['cart_tax'] += $discount['tax_value'];\r\n\t\t\t\t$this->flexi->cart_contents['settings']['tax']['data']['cart_taxable_value'] += $discount['taxable_value'];\r\n\t\t\t\t$this->flexi->cart_contents['settings']['tax']['data']['cart_non_taxable_value'] += $discount['non_taxable_value'];\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\t$this->flexi->cart_contents['settings']['tax']['data']['cart_tax'] = $discount['tax_value'];\r\n\t\t\t\t$this->flexi->cart_contents['settings']['tax']['data']['cart_taxable_value'] = $discount['taxable_value'];\r\n\t\t\t\t$this->flexi->cart_contents['settings']['tax']['data']['cart_non_taxable_value'] = $discount['non_taxable_value'];\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\treturn $discount;\r\n\t\t}\r\n\t\t\r\n\t\treturn FALSE;\r\n\t}", "function is_filter_discount( $conds )\n\t{\n\t\treturn ( isset( $conds['is_discount'] ) && $conds['is_discount'] == 1 );\n\t}", "public function productDisableStatus($customerId){\n $productCollections = Mage::getModel ( 'catalog/product' )->getCollection ()->addAttributeToFilter ( 'userid', $customerId)->addAttributeToFilter ( 'type_id', array (\n 'eq' => 'property'\n ) );\n /**\n * Iterating the loop\n */\n foreach ( $productCollections as $product ) {\n /**\n * Get Product Id\n */\n $productId = $product->getEntityId ();\n $data = array (\n 'propertyapproved' => 0,\n 'status' => 0\n );\n $model = Mage::getModel ( 'catalog/product' )->load ( $productId )->addData ( $data );\n $model->setId ( $productId )->save ();\n }\n }", "function update_discount_codes()\n\t\t{\n\t\t\t// Get the discount codes from the submitted POST data.\n\t\t\t$discount_data = $this->input->post('discount');\n\t\t\t\n\t\t\t// The 'update_discount_codes()' function will validate each submitted code and apply the discounts that have activated their quantity and value requirements.\n\t\t\t// Any previously set codes that have now been set as blank (i.e. no longer present) will be removed.\n\t\t\t// Note: Only 1 discount can be applied per item and per summary column. \n\t\t\t// For example, 2 discounts cannot be applied to the summary total, but 1 discount could be applied to the shipping total, and another to the summary total.\n\t\t\t$this->flexi_cart->update_discount_codes($discount_data);\n\t\t\t\n\t\t\t// Set a message to the CI flashdata so that it is available after the page redirect.\n\t\t\t$this->session->set_flashdata('message', $this->flexi_cart->get_messages());\n\n\t\t\tredirect('cart');\n\t\t}", "private function validate_item_discounts($item_discount_data)\r\n\t{\r\n\t\t// Check the discount tables exist in the config file and are enabled.\r\n\t\tif ($this->get_enabled_status('discounts'))\r\n\t\t{\r\n\t\t\t// Set an array to hold the ids of all items that have had a discount applied.\r\n\t\t\t$valid_item_discount_data = array('item_price' => array(), 'item_shipping' => array());\r\n\t\t\t$discounted_items = array();\r\n\t\t\t$discounted_cart_value = 0;\r\n\t\t\t$non_combinable_discount = FALSE;\r\n\t\t\t\r\n\t\t\t// Loop through submitted discount data and remove all non item discounts.\r\n\t\t\tforeach($item_discount_data as $target_column => $discount_data)\r\n\t\t\t{\r\n\t\t\t\tif (! in_array($target_column, array('item_price', 'item_shipping')))\r\n\t\t\t\t{\r\n\t\t\t\t\tunset($item_discount_data[$target_column]);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t// All discounts are applied to the cheapest applicable items first, to enforce this, sort items by price, cheapest to most expensive.\r\n\t\t\t$items = $this->flexi->cart_contents['items'];\r\n\t\t\tforeach ($items as $row_id => $column) \r\n\t\t\t{\t\r\n\t\t\t\t$items_sorted[$row_id] = $column[$this->flexi->cart_columns['item_price']];\r\n\t\t\t}\r\n\t\t\tarray_multisort($items_sorted, SORT_ASC, $items);\r\n\t\t\t\r\n\t\t\t// Get array of current user submitted discount codes.\r\n\t\t\t$discount_codes = $this->flexi->cart_contents['settings']['discounts']['codes'];\r\n\t\t\t\r\n\t\t\t// Start looping through each item based discount and calculate the discount value.\r\n\t\t\tforeach($item_discount_data as $target_column => $discount_data)\r\n\t\t\t{\r\n\t\t\t\t// Loop through all discounts for current target column.\r\n\t\t\t\tforeach($discount_data as $discount_id => $discount_cols)\r\n\t\t\t\t{\r\n\t\t\t\t\t// If an item discount is activated via a user submitted code, ensure the discount code has been entered.\r\n\t\t\t\t\t// Or if a discount is 'Non-Combinable' (i.e. There can be no other cart discounts), check no other discounts have been set.\r\n\t\t\t\t\tif ((strlen($discount_cols['code']) > 0 && ! array_key_exists($discount_cols['code'], $discount_codes)) ||\r\n\t\t\t\t\t\t($discount_cols['non_combinable'] == 1 && ! empty($discounted_items)))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tcontinue;\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\t// Tally discount data to check if discount has a valid minimum quantity and value of items to activate discount.\r\n\t\t\t\t\t$applicable_item_quantity = $applicable_item_value = 0;\r\n\t\t\t\t\t$applicable_items = array();\r\n\t\t\t\t\t\r\n\t\t\t\t\t// Loop through cart items and tally the quantity and value of items applicable to the discount.\r\n\t\t\t\t\tforeach($items as $row_id => $column)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tif (in_array($column[$this->flexi->cart_columns['item_id']], $discount_cols['item_ids']) && \r\n\t\t\t\t\t\t\t! in_array($column[$this->flexi->cart_columns['item_id']], $discounted_items))\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t$applicable_item_quantity += $column[$this->flexi->cart_columns['item_quantity']];\r\n\t\t\t\t\t\t\t$applicable_item_value += ($column[$this->flexi->cart_columns['item_price']] * $column[$this->flexi->cart_columns['item_quantity']]);\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t$applicable_items[$row_id] = array(\r\n\t\t\t\t\t\t\t\t'id' => $discount_id,\r\n\t\t\t\t\t\t\t\t'item_id' => $column[$this->flexi->cart_columns['item_id']],\r\n\t\t\t\t\t\t\t\t'description' => $discount_cols['description'],\r\n\t\t\t\t\t\t\t\t'discount_quantity' => 0,\r\n\t\t\t\t\t\t\t\t'non_discount_quantity' => $column[$this->flexi->cart_columns['item_quantity']],\r\n\t\t\t\t\t\t\t\t'item_value' => $column[$this->flexi->cart_columns['item_price']],\r\n\t\t\t\t\t\t\t\t'item_discount' => 0,\r\n\t\t\t\t\t\t\t\t'taxable_value' => 0,\r\n\t\t\t\t\t\t\t\t'non_taxable_value' => 0,\r\n\t\t\t\t\t\t\t\t'tax_value' => 0,\r\n\t\t\t\t\t\t\t\t'void_reward_points' => (bool)$discount_cols['void_reward_points'],\r\n\t\t\t\t\t\t\t\t'force_shipping_discount' => (bool)$discount_cols['force_shipping_discount']\r\n\t\t\t\t\t\t\t);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t// Check that the total quantity and value of items has activated the discounted.\r\n\t\t\t\t\tif (! empty($applicable_items) && \r\n\t\t\t\t\t\t$applicable_item_quantity >= $discount_cols['quantity_required'] && \r\n\t\t\t\t\t\t$applicable_item_value >= $discount_cols['value_required']\r\n\t\t\t\t\t)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t// Calculate the quantity of items that the discount will apply to.\r\n\t\t\t\t\t\t// Set default quantity values incase they equal zero.\r\n\t\t\t\t\t\t$quantity_discounted = ($discount_cols['quantity_discounted'] >= 1) ? $discount_cols['quantity_discounted'] : 1;\r\n\t\t\t\t\t\t$quantity_required = ($discount_cols['quantity_required'] >= 1) ? $discount_cols['quantity_required'] : 1;\r\n\t\t\t\t\t\r\n\t\t\t\t\t\t// If the discount is recursive, calculate number of times the discount needs to be applied.\r\n\t\t\t\t\t\t// Example: Buy 2, Get 1 @ 50% off, and 7 items are added to the cart.\r\n\t\t\t\t\t\t// If 'recursive' = TRUE (1), 2 items will have 50% off, and 5 at normal price, if FALSE (0), 1 item will have 50% off, and 6 at normal price.\r\n\t\t\t\t\t\t$repeat_discount = ($discount_cols['recursive'] == 1) ? floor($applicable_item_quantity / $quantity_required) : 1;\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t// Calculate the number of items to be discounted.\r\n\t\t\t\t\t\t$discounted_quantity = ($repeat_discount * $quantity_discounted);\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t// Loop through applicable items and apply discount values.\r\n\t\t\t\t\t\tforeach($applicable_items as $row_id => $item_data)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tif ($discounted_quantity > 0)\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t// Calculate the quantity of items that the discount can and cannot be applied to.\r\n\t\t\t\t\t\t\t\t$applicable_items[$row_id]['discount_quantity'] = ($discounted_quantity >= $item_data['non_discount_quantity']) ? \r\n\t\t\t\t\t\t\t\t\t$item_data['non_discount_quantity'] : $discounted_quantity;\r\n\t\t\t\t\t\t\t\t$applicable_items[$row_id]['non_discount_quantity'] = ($item_data['non_discount_quantity'] - $applicable_items[$row_id]['discount_quantity']);\r\n\r\n\t\t\t\t\t\t\t\t// Calculate the number of items discounted by the loop so far.\r\n\t\t\t\t\t\t\t\t$discounted_quantity = ($discounted_quantity >= $item_data['non_discount_quantity']) ? \r\n\t\t\t\t\t\t\t\t\t($discounted_quantity - $item_data['non_discount_quantity']) : 0;\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t// Calculate item tax data.\r\n\t\t\t\t\t\t\t\t$item_tax_rate = $this->get_item_tax_rate($row_id, TRUE);\r\n\t\t\t\t\t\t\t\t$item_tax_data = $this->calculate_tax($applicable_items[$row_id]['item_value'], $item_tax_rate);\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t// Calculate item discount data.\r\n\t\t\t\t\t\t\t\t$discount_calculation_data = $this->calculate_discount(\r\n\t\t\t\t\t\t\t\t\t$discount_cols['value_discounted'], \r\n\t\t\t\t\t\t\t\t\t$item_tax_data['taxable_value'], $item_tax_data['non_taxable_value'], $item_tax_data['tax_value'], $item_tax_rate, \r\n\t\t\t\t\t\t\t\t\t$discount_cols['calculation_id'], $discount_cols['tax_method']\r\n\t\t\t\t\t\t\t\t);\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\tif (! empty($discount_calculation_data))\r\n\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\tforeach($discount_calculation_data as $column => $discount_data)\r\n\t\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\t\tif ($column == 'total')\r\n\t\t\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\t\t\t// Calculate discount value per quantity.\r\n\t\t\t\t\t\t\t\t\t\t\t$applicable_items[$row_id]['item_discount'] = $this->format_calculation(\r\n\t\t\t\t\t\t\t\t\t\t\t\t($applicable_items[$row_id]['item_value'] - $discount_data)\r\n\t\t\t\t\t\t\t\t\t\t\t);\r\n\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t$applicable_items[$row_id]['item_value'] = $discount_data;\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\telse\r\n\t\t\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\t\t\t$applicable_items[$row_id][$column] = $discount_data;\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\telse\r\n\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\tunset($applicable_items[$row_id]);\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\telse\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t// Loop through items discount has been applied to.\r\n\t\t\t\t\t\tforeach($applicable_items as $row_id => $item_data)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t// Save item discount data to an array of valid item discounts.\r\n\t\t\t\t\t\t\t$valid_item_discount_data[$target_column][$row_id] = $item_data;\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t// Add discounted item ids to the discounted item array to prevent it being included in another discount.\r\n\t\t\t\t\t\t\t$discounted_items[] = $item_data['item_id'];\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t// If the discount is 'Non-Combinable' (i.e. There can be no other cart discounts), set var to indicate discount is non-combinable.\r\n\t\t\t\t\t\t\t// Stop all further item discount loops. \r\n\t\t\t\t\t\t\tif ($discount_cols['non_combinable'] == 1)\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t$non_combinable_discount = TRUE;\r\n\t\t\t\t\t\t\t\tbreak 3;\r\n\t\t\t\t\t\t\t}\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\t\r\n\t\t\treturn array(\r\n\t\t\t\t'discounts' => $valid_item_discount_data,\r\n\t\t\t\t'non_combinable_discount' => $non_combinable_discount\r\n\t\t\t);\r\n\t\t}\r\n\t\t\r\n\t\treturn FALSE;\r\n\t}", "public function hasDiscount(){\n return $this->_has(9);\n }", "public function hasActdiscount(){\n return $this->_has(34);\n }", "function fuc_discount($product, $percentage){\r\n $discountValue = $product / 100 * $percentage;\r\n $totalValue = $product - $discountValue; \r\n return $totalValue;\r\n\r\n}", "private static function limitAvailableDiscountValue($rule, $item)\n {\n // Ограничение скидки для товара\n if (!empty($rule['limit']['status']) && !empty($rule['limit']['value']) && $rule['limit']['value'] >= 0) {\n $limit = $rule['limit'];\n // Собираем минимальное значение цены товара\n $product_price_minimum = 0;\n switch ($limit['price1']) {\n case \"purchase\":\n $product_price_minimum += $item['purchase_price'];\n break;\n case \"compare_price\":\n $product_price_minimum += $item['compare_price'];\n break;\n }\n if ($limit['currency'] == '%') {\n $price2 = 0;\n switch ($limit['price2']) {\n case \"purchase\":\n $price2 += $item['purchase_price'];\n break;\n case \"price\":\n $price2 += $item['price'];\n break;\n case \"compare_price\":\n $price2 += $item['compare_price'];\n break;\n }\n $product_price_minimum += max(0.0, min(100.0, (float) $limit['value'])) * $price2 / 100;\n } else {\n $product_price_minimum += (float) shop_currency((float) $limit['value'], $limit['currency'], self::getOrderInfo('currency'), false);\n }\n\n // Если товар участвовал в скидках\n if (!empty(self::$available_products[$item['sku_id']][$rule['id']])) {\n // Размер скидки для одной единицы товара\n $product_discount = self::$available_products[$item['sku_id']][$rule['id']]['discount'] / self::$available_products[$item['sku_id']][$rule['id']]['quantity'];\n // Если размер скидки для товара больше, чем установлено ограничением\n if ($item['price'] - $product_discount < $product_price_minimum) {\n // Меняем скидку для товара\n self::$available_products[$item['sku_id']][$rule['id']]['discount'] = shopFlexdiscountHelper::round($item['price'] - $product_price_minimum) * self::$available_products[$item['sku_id']][$rule['id']]['quantity'];\n // Если скидка товара ниже 0, это означает, что минимальная цена товара получилась выше самой цены товара.\n // Удаляем товар из массива скидок\n if (self::$available_products[$item['sku_id']][$rule['id']]['discount'] <= 0) {\n unset(self::$available_products[$item['sku_id']][$rule['id']]);\n }\n }\n }\n }\n\n // Максимальное значение бонусов для товара\n $maximum_product_affiliate = (isset($rule['maximum_product_affiliate']) && $rule['maximum_product_affiliate'] !== '') ? shopFlexdiscountHelper::floatVal($rule['maximum_product_affiliate']) : null;\n if ($maximum_product_affiliate !== null && !empty(self::$available_products[$item['sku_id']][$rule['id']])) {\n // Размер бонусов для одной единицы товара\n $product_affiliate = self::$available_products[$item['sku_id']][$rule['id']]['affiliate'] / self::$available_products[$item['sku_id']][$rule['id']]['quantity'];\n // Если размер бонусов для товара больше, чем установлено ограничением\n if ($product_affiliate > $maximum_product_affiliate) {\n // Меняем бонусы для товара\n self::$available_products[$item['sku_id']][$rule['id']]['affiliate'] = $maximum_product_affiliate * self::$available_products[$item['sku_id']][$rule['id']]['quantity'];\n }\n }\n }", "public function setNoMultiShipping(){\n $emptyCache = false;\n $db = JFactory::getDBO();\n if (JeproshopSettingModelSetting::getValue('allow_multi_shipping')){\n // Upgrading quantities\n $query = \"SELECT sum(\" . $db->quoteName('quantity') . \") AS quantity, product_id, product_attribute_id, count(*) as count FROM \";\n $query .= $db->quoteName('#__jeproshop_cart_product') . \" WHERE \" . $db->quoteName('cart_id') . \" = \" . (int)$this->cart_id . \" AND \" ;\n $query .= $db->quoteName('shop_id') . \" = \" . (int)$this->shop_id . \" GROUP BY product_id, product_attribute_id HAVING count > 1\";\n\n $db->setQuery($query);\n $products = $db->loadObjectList();\n\n foreach ($products as $product){\n $query = \"UPDATE \" . $db->quoteName('#__jeproshop_cart_product') . \" SET \" . $db->quoteName('quantity') . \" = \" . $product->quantity;\n $query .= \"\tWHERE \" . $db->quoteName('cart_id') . \" = \".(int)$this->cart_id . \" AND \" . $db->quoteName('shop_id') . \" = \" . (int)$this->shop_id ;\n $query .= \" AND product_id = \" . $product->product_id . \" AND product_attribute_id = \" . $product->product_attribute_id;\n $db->setQuery($query);\n if ($db->query())\n $emptyCache = true;\n }\n\n // Merging multiple lines\n $query = \"DELETE cart_product_1 FROM \" . $db->quoteName('#__jeproshop_cart_product') . \" AS cart_product_1 INNER JOIN \";\n $query .= $db->quoteName('#__jeproshop_cart_product') . \" AS cart_product_2 ON ((cart_product_1.cart_id = cart_product_2.\";\n $query .= \"cart_id) AND (cart_product_1.product_id = cart_product_2.product_id) AND (cart_product_1.product_attribute_id = \";\n $query .= \"cart_product_2.product_attribute_id) AND (cart_product_1.address_delivery_id <> cart_product_2.address_delivery_id) \";\n $query .= \" AND (cart_product_1.date_add > cart_product_2.date_add) )\";\n $db->setQuery($query);\n $db->query();\n }\n\n // Update delivery address for each product line\n $query = \"UPDATE \" . $db->quoteName('#__jeproshop_cart_product') . \" SET \" . $db->quoteName('address_delivery_id') . \" = ( SELECT \";\n $query .= $db->quoteName('address_delivery_id') . \" FROM \" . $db->quoteName('#__jeproshop_cart') . \" WHERE \" . $db->quoteName('cart_id');\n $query .= \" = \" . (int)$this->cart_id . \" AND \" . $db->quoteName('shop_id') . \" = \" . (int)$this->shop_id . \") WHERE \" . $db->quoteName('cart_id');\n $query .= \" = \" . (int)$this->cart_id . (JeproshopSettingModelSetting::getValue('allow_multi_shipping') ? \" AND \" . $db->quoteName('shop_id') . \" = \" .(int)$this->shop_id : \"\");\n\n $db->setQuery($query);\n\n $cache_id = 'jeproshop_cart_set_no_multi_shipping'.(int)$this->cart_id.'_'.(int)$this->shop_id .((isset($this->address_delivery_id) && $this->address_delivery_id) ? '-'.(int)$this->address_delivery_id : '');\n if (!JeproshopCache::isStored($cache_id)){\n $db->setQuery($query);\n if ($result = (bool)$db->query())\n $emptyCache = true;\n JeproshopCache::store($cache_id, $result);\n }\n\n if (JeproshopCustomization::isFeaturePublished()){\n //Db::getInstance()->execute(\n\t\t\t$query = \" UPDATE \" . $db->quoteName('#__jeproshop_customization') . \" SET \" . $db->quoteName('address_delivery_id') . \" = ( SELECT \";\n $query .= $db->quoteName('address_delivery_id') . \" FROM \" . $db->quoteName('#__jeproshop_cart') . \" WHERE \" . $db->quoteName('cart_id');\n $query .= \" = \" . (int)$this->cart_id . \" ) WHERE \" . $db->quoteName('cart_id') . \" = \" .(int)$this->cart_id;\n\n $db->setQuery($query);\n $db->query();\n }\n if ($emptyCache){\n $this->_products = null;\n }\n }", "function apply_cart_discounts_after_tax() {\t\n\t\t\t\n\t\t\tif ($this->applied_coupons) foreach ($this->applied_coupons as $code) :\n\t\t\t\t$coupon = new cmdeals_coupon( $code );\n\t\t\t\t\n\t\t\t\tdo_action( 'cmdeals_cart_discount_after_tax_' . $coupon->type, $coupon );\n\t\t\t\t\n\t\t\t\tif ( !$coupon->apply_before_tax() && $coupon->is_valid() ) :\n\t\t\t\t\t\n\t\t\t\t\tswitch ($coupon->type) :\n\t\t\t\t\t\n\t\t\t\t\t\tcase \"fixed_cart\" :\n\t\n\t\t\t\t\t\t\t$this->discount_total = $this->discount_total + $coupon->amount;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\n\t\t\t\t\t\tcase \"percent\" :\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t$percent_discount = (round( $this->cart_contents_total + $this->tax_total , 2) / 100 ) * $coupon->amount;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t$this->discount_total = $this->discount_total + $percent_discount;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\n\t\t\t\t\tendswitch;\n\t\n\t\t\t\tendif;\n\t\t\tendforeach;\n\t\t}", "public static function bogo_apply_disc($order_id,$promotion_id,$prmdisc_id,$prmdisc_bogo_sbmnu,$prmdisc_bogo_sbmnu_dish,$prmdisc_bogo_qty,$disc_amt_type,$disc_amt){\r \t//echo \"$order_id,$promotion_id,$prmdisc_id,$prmdisc_bogo_sbmnu,$prmdisc_bogo_sbmnu_dish,$prmdisc_bogo_qty,$disc_amt_type,$disc_amt\";\r\t\t//..Check if discount is with sub menu item is selected\r\t\tif(is_gt_zero_num($prmdisc_bogo_sbmnu_dish)){\r\t\t\t//..do nothing..because we already ahve submenudishid\r\t\t}else{\r\t\t //..Get all submenu dish ids from submenu..\r\t\t\t$rs_apl_disc_items= tbl_submenu_dishes::getSubMenuItems($prmdisc_bogo_sbmnu);\r\t\t\tif(is_not_empty($rs_apl_disc_items)){\r\t\t\t\t$prmdisc_bogo_sbmnu_dish=$rs_apl_disc_items;\r\t\t\t}else{\r\t\t\t\t$strOpMsg= \"No items found to apply discount\" ;\r\t\t\t\treturn 0;\r\t\t\t}\r\t\t}\t\t\r \t\t//...Check if the item is in the order detail\r\t\t$tmp_fnd=0;\r\t\t$ord_det_items=tbl_order_details::readArray(array(ORD_DTL_ORDER_ID=>$order_id,ORD_DTL_SBMENU_DISH_ID=>$prmdisc_bogo_sbmnu_dish,ORDPROM_DISCOUNT_AMT=>0),$tmp_fnd,1,0);\t\t\t\t\t\t\t\r\t\tif($tmp_fnd>0){\t\t \r\t\t\t//..item presents in order detail wihtout disocunt\r\t\t\t//..loop through the all the order items records\r\t\t\tforeach($ord_det_items as $order_itm){\r\t\t\t\t //..now check if the quantity >= disc qty\t\t\t\t\t \r\t\t\t\t if($order_itm[ORD_DTL_QUANTITY]>=$prmdisc_bogo_qty){\r\t\t\t\t \t //..Right item to apply discount\r\t\t\t\t\t //..Calculate discount amount\t\r\t\t\t\t\t$discount_amount=tbl_order_details::getDiscountAmnt($disc_amt_type,$disc_amt,$order_itm[ORD_DTL_PRICE]);\r\t\t\t\t\t//..Update the order detail with discount and promot\r\t\t\t\t\t$success=tbl_order_details::update_item_with_discount($order_itm[ORD_DTL_ID],$promotion_id,$prmdisc_id,$discount_amount);\t\r\t\t\t\t\t\t\t\t\t\t\t \r\t\t\t\t }\r\t\t\t}\r\t\t\tunset($ord_det_items);\t\r\t\t}else{\r\t\t\t$strOpMsg= \"Item not present in your order or alreday discounted\" ;\r\t\t}\t\r\t\treturn 1;\r }", "public function setDiscountAmount($amount);", "public static function update_item_with_discount($detail_id,$order_promotion,$order_discount_id,$order_discount_amt){\r\tif(is_gt_zero_num($detail_id)){\r\t\t$objtbl_order_details=new tbl_order_details();\r\t\tif($objtbl_order_details->readObject(array(ORD_DTL_ID=>$detail_id))){\r\t\t\t$objtbl_order_details->setordprom_promotion($order_promotion);\r\t\t\t$objtbl_order_details->setordprom_discount_id($order_discount_id);\r\t\t\t$objtbl_order_details->setordprom_discount_amt($order_discount_amt);\r\t\t\t$objtbl_order_details->insert();\r\t\t\treturn 1;\r\t\t}\r\t\tunset($objtbl_order_details);\t\r\t} \r\treturn 0;\t\r }", "function cartTotal ($cartItems) {\n\n$grouped = $cartItems->groupBy(\"product_id\");\n$product_quantities = $grouped->map(function ($item, $key) {\n return [$key => $item->sum(\"qty\")];\n});\n$products_ids = array_keys($product_quantities->all());\n$products = Product::whereIn(\"id\", $products_ids)->select([\"price\", \"name\", \"id\", \"item_value_discount\", \"items_value_discount\", \"items_items_discount\"])->get();\n$products = $products->groupBy(\"id\");\n\n$item_value_discounts = collect([]);\n$items_value_discounts = collect([]);\n$items_items_discounts = collect([]);\n\nforeach ($products as $product) {\n if ($product[0]->item_value_discount) {\n \n $item_value_discounts->put($product[0]->id, $product[0]->getActiveItemValueDiscount());\n\n // $item_value_discounts = item_value_discount::where(function ($query) {\n // $query->whereDate(\"starts_at\", \"<=\", date(\"Y-m-d\"))\n // ->whereDate(\"ends_at\", \">=\", date(\"Y-m-d\"));\n // })->orWhere(function ($query) {\n // $query->whereDate(\"starts_at\", \"<=\", date(\"Y-m-d\"))\n // ->whereNull(\"ends_at\");\n // })->get();\n }\n if ($product[0]->items_value_discounts) {\n $items_value_discounts->put($product[0]->id, $product[0]->getActiveItemsValueDiscount());\n // $items_value_discounts = items_value_discount::where(function ($query) {\n // $query->whereDate(\"starts_at\", \"<=\", date(\"Y-m-d\"))\n // ->whereDate(\"ends_at\", \">=\", date(\"Y-m-d\"));\n // })->orWhere(function ($query) {\n // $query->whereDate(\"starts_at\", \"<=\", date(\"Y-m-d\"))\n // ->whereNull(\"ends_at\");\n // })->get();\n }\n if ($product[0]->items_items_discounts) {\n $items_items_discounts->put($product[0]->id, $product[0]->getActiveItemsItemsDiscount());\n // $items_items_discounts = items_items_discount::where(function ($query) {\n // $query->whereDate(\"starts_at\", \"<=\", date(\"Y-m-d\"))\n // ->whereDate(\"ends_at\", \">=\", date(\"Y-m-d\"));\n // })->orWhere(function ($query) {\n // $query->whereDate(\"starts_at\", \"<=\", date(\"Y-m-d\"))\n // ->whereNull(\"ends_at\");\n // })->get();\n }\n}\n// return $item_value_discounts;\n// return $items_value_discounts;\n// return $items_items_discounts;\n\n// if ($item_value_discounts)\n// $item_value_discounts = $item_value_discounts->groupBy(\"product_id\");\n// if ($items_value_discounts)\n// $items_value_discounts = $items_value_discounts->groupBy(\"product_id\");\n// if ($items_items_discounts)\n// $items_items_discounts = $items_items_discounts->groupBy(\"product_id\");\n// return $item_value_discounts;\n\n// return $items_value_discounts;\n// return $items_items_discounts;\n$product_prices_qty = collect([]);\n$product_present = collect([]);\nforeach ($products_ids as $products_id) {\n $product_qty = $product_quantities[$products_id][$products_id];\n $items_items_discounts_product_qty = $product_quantities[$products_id][$products_id];\n if (isset($items_value_discounts[$products_id])) {\n if ($items_value_discounts[$products_id] !== []) {\n foreach ($items_value_discounts[$products_id] as $discount) {\n $count = floor($product_qty / $discount->items_count);\n if ($count) {\n $product_prices_qty->push([\n \"product_id\" => $products_id,\n \"product_name\" => $products[$products_id][0]->name,\n \"qty\" => $discount->items_count * $count,\n \"price\" => $count*$discount->items_value,\n ]);\n $product_qty = $product_qty - ($count * $discount->items_count);\n }\n }\n }\n }\n if (isset($item_value_discounts[$products_id])) {\n if ($item_value_discounts[$products_id] !== []) {\n foreach ($item_value_discounts[$products_id] as $discount) {\n if ($product_qty) {\n $price = $products[$products_id][0]->price;\n $value = $discount->value;\n $percent = $discount->percent;\n \n if ($value && $percent) {\n $price = $price - $value;\n } else if ($value && !$percent) {\n $price = $price - $value;\n } else {\n $price = $price - (($percent / 100) * $price);\n }\n $total = $price*$product_qty;\n $product_prices_qty->push([\n \"product_id\" => $products_id,\n \"product_name\" => $products[$products_id][0]->name,\n \"qty\" => $product_qty,\n \"price\" => $total,\n ]);\n }\n }\n }\n }\n if (isset($items_items_discounts[$products_id])) {\n if ($items_items_discounts[$products_id] !== []) {\n $items_number = $items_items_discounts_product_qty;\n $max_get_number = 0;\n // $product_present = collect([]);\n foreach ($items_items_discounts[$products_id] as $discount) {\n $count = floor($items_number / $discount->buy_items_count);\n if (!$product_prices_qty->contains('product_id', $products_id)){\n $price = $products[$products_id][0]->price;\n $total = $price * $items_items_discounts_product_qty;\n $product_prices_qty->push([\n \"product_id\" => $products_id,\n \"qty\" => $items_items_discounts_product_qty,\n \"product_name\" => $products[$products_id][0]->name,\n \"price\" => $total,\n ]);\n }\n if ($count) {\n if ($discount->get_items_count > $max_get_number) {\n $max_get_number = $discount->get_items_count * $count;\n \n $offer = [\n \"product_id\" => $products_id,\n \"buy_items_count\" => $discount->buy_items_count,\n \"presents_count\" => $max_get_number,\n \"present_product_id\" => $discount->present_product_id,\n ];\n }\n }\n }\n $product_present->push($offer);\n }\n }\n}\n$data = [\"totals\" => $product_prices_qty, \"presents\" => $product_present];\nreturn $data;\n}", "public function termsAndConditionAccpeted()\n\t{\n\n\t}", "function updateAmazonProductsOfferingConditionNotes($items)\n{\n\tif (sizeof($items) > 0) {\n\t\t$data = array();\n\t\t$data['submitedPrice'] = 0;\n\t\t$caseOfferingConditionNote = \"OfferingConditionNote = CASE\";\n\t\tforeach($items as $key => $item)\n\t\t{\t\n\t\t\tif ($items[$key]['OfferingConditionNote'] != null) {\n\t\t\t\t$caseOfferingConditionNote.= \"\\n WHEN id_product = \" . $items[$key]['id_product'] . \" THEN '\" . $items[$key]['OfferingConditionNote'] . \"'\";\n\t\t\t\t$productsIds[] = $items[$key]['id_product'];\n\t\t\t}\t\t\t\n\t\t}\n\t\tif (count($productsIds) > 0) {\n\t\t\t$caseOfferingConditionNote.= \"\n\t\t\t\tEND\n\t\t\t\tWHERE id_product IN (\" . implode(\", \", $productsIds) . \")\n\t\t\t\";\n\t\t\t$addWhere = $caseOfferingConditionNote;\n\t\t\tSQLUpdate('amazon_products', $data, $addWhere, 'shop', __FILE__, __LINE__);\n\t\t}\n\t}\n}", "public function createRule($rand_code, $expiration_time, $discount_type, $discount_amount, $allow_free_shipping, $stop_further_discount)\n {\n try {\n $customer_groups = $this->getCustomerGroups(); //get through functions\n\n $from_date = date('Y-m-d');\n if ($expiration_time > 1) {\n $to_date = date('Y-m-d', strtotime($from_date . ' + ' . $expiration_time . ' days'));\n } else {\n $to_date = date('Y-m-d', strtotime($from_date . ' + 1 day'));\n }\n$from_date = date('Y-m-d', strtotime($from_date . ' -1 day'));\n $rule = Mage::getModel('salesrule/rule');\n $rule->setName($rand_code);\n $rule->setDescription('Coupon Created By Spin and Win (Knowband)');\n $rule->setFromDate($from_date); //starting today\n $rule->setToDate($to_date); //if you need an expiration date\n $rule->setCouponType(2);\n $rule->setCouponCode($rand_code);\n $rule->setUsesPerCoupon(1); //number of allowed uses for this coupon\n $rule->setUsesPerCustomer(1); //number of allowed uses for this coupon for each customer\n $rule->setCustomerGroupIds($customer_groups); //if you want only certain groups replace getAllCustomerGroups() with an array of desired ids \n $rule->setIsActive(1);\n\n $rule->setStopRulesProcessing($stop_further_discount); //set to 1 if you want all other rules after this to not be processed\n $rule->setIsRss(0); //set to 1 if you want this rule to be public in rss\n $rule->setIsAdvanced(1); //have no idea what it means :)\n $rule->setProductIds('');\n $rule->setSortOrder(0); // order in which the rules will be applied\n $rule->setWebsiteIds(array(Mage::app()->getWebsite()->getId())); // order in which the rules will be applied\n\n if ($discount_type == 'fixed') {\n $rule->setSimpleAction('by_fixed');\n } else {\n $rule->setSimpleAction('by_percent');\n }\n\n //all available discount types\n //by_percent - Percent of product price discount\n //by_fixed - Fixed amount discount\n //cart_fixed - Fixed amount discount for whole cart\n //buy_x_get_y - Buy X get Y free (discount amount is Y)\n\n $rule->setDiscountAmount($discount_amount); //the discount amount/percent. if SimpleAction is by_percent this value must be <= 100\n $rule->setDiscountQty(0); //Maximum Qty Discount is Applied to\n $rule->setDiscountStep(0); //used for buy_x_get_y; This is X\n if ($allow_free_shipping) {\n $rule->setSimpleFreeShipping(Mage_SalesRule_Model_Rule::FREE_SHIPPING_ADDRESS); //set to 1 for Free shipping\n $rule->setApplyToShipping(1); //set to 1 for Free shipping\n } else {\n $rule->setSimpleFreeShipping(0); //set to 1 for Free shipping\n $rule->setApplyToShipping(0); //set to 1 for Free shipping\n }\n\n// $rule->setApplyToShipping(0); //set to 0 if you don't want the rule to be applied to shipping\n// $rule->setWebsiteIds(array(1));//if you want only certain websites replace getAllWbsites() with an array of desired ids\n\n $conditions = array();\n $conditions[1] = array(\n 'type' => 'salesrule/rule_condition_combine',\n 'aggregator' => 'all',\n 'value' => \"1\", //[UPDATE] added quotes on the value. Thanks Aziz Rattani [/UPDATE]\n 'new_child' => ''\n );\n //the conditions above are for 'if all of these conditions are true'\n //for if any one of the conditions is true set 'aggregator' to 'any'\n //for if all of the conditions are false set 'value' to 0.\n //for if any one of the conditions is false set 'aggregator' to 'any' and 'value' to 0\n $conditions['1--1'] = Array\n (\n 'type' => 'salesrule/rule_condition_address',\n 'attribute' => 'base_subtotal',\n 'operator' => '>=',\n 'value' => 1\n );\n //the constraints above are for 'Subtotal is equal or grater than 200'\n //for 'equal or less than' set 'operator' to '<='... You get the idea other operators for numbers: '==', '!=', '>', '<'\n //for 'is one of' set operator to '()';\n //for 'is not one of' set operator to '!()';\n //in this example the constraint is on the subtotal\n //for other attributes you can change the value for 'attribute' to: 'total_qty', 'weight', 'payment_method', 'shipping_method', 'postcode', 'region', 'region_id', 'country_id'\n //to add an other constraint on product attributes (not cart attributes like above) uncomment and change the following:\n /*\n $conditions['1--2'] = array\n (\n 'type' => 'salesrule/rule_condition_product_found',//-> means 'if all of the following are true' - same rules as above for 'aggregator' and 'value'\n //other values for type: 'salesrule/rule_condition_product_subselect' 'salesrule/rule_condition_combine'\n 'value' => 1,\n 'aggregator' => 'all',\n 'new_child' => '',\n );\n\n $conditions['1--2--1'] = array\n (\n 'type' => 'salesrule/rule_condition_product',\n 'attribute' => 'sku',\n 'operator' => '==',\n 'value' => '12',\n );\n */\n //$conditions['1--2--1'] means sku equals 12. For other constraints change 'attribute', 'operator'(see list above), 'value'\n\n $rule->setData('conditions', $conditions);\n $rule->loadPost($rule->getData());\n $rule->save();\n return true;\n } catch (Exception $e) {\n Mage::logException($e);\n return false;\n }\n }", "function calc_extra_sp_cost($Discount = 1){\r\n\t$list = array('D','E','A');\r\n\tforeach($list as $v){\r\n\t\tif(preg_match('/CostSP<([0-9]+)>/',$this->Eq[$v]['spec'],$array)){\r\n\t\t\t$a = intval($array[1]);\r\n\t\t\t$this->SP_Cost += ceil($a * $Discount);\r\n\t\t}\r\n\t}\r\n}", "protected static function avail_target_all($filter_items, $items, $target, $rule, $sku_id)\n {\n if (!$filter_items) {\n if (!isset(self::$available_products[$sku_id][$rule['id']])) {\n self::$available_products[$sku_id][$rule['id']] = array();\n }\n return false;\n }\n return self::calculate_target_discount($target, $items, $rule, $sku_id);\n }", "public function applyProductCategoryWholesaleDiscount( $wholesalePrice , $productID , $userWholesaleRole ) {\n\n if ( empty( $wholesalePrice ) && !empty( $userWholesaleRole ) ) {\n\n $product = wc_get_product( $productID );\n $product_price = get_option( 'wwpp_settings_explicitly_use_product_regular_price_on_discount_calc' ) == 'yes' ? $product->get_regular_price() : $product->get_price();\n $post_id = ( WWP_Helper_Functions::wwp_get_product_type( $product ) === 'variation' ) ? WWP_Helper_Functions::wwp_get_parent_variable_id( $product ) : $productID;\n\n if ( !is_null( $post_id ) ) {\n\n $terms = get_the_terms( $post_id , 'product_cat' );\n if ( !is_array( $terms ) )\n $terms = array();\n\n $lowest_discount = null;\n $highest_discount = null;\n\n foreach ( $terms as $term ) {\n\n $category_wholesale_prices = get_option( 'taxonomy_' . $term->term_id );\n\n if ( is_array( $category_wholesale_prices ) && array_key_exists( $userWholesaleRole[ 0 ] . '_wholesale_discount' , $category_wholesale_prices ) ) {\n\n $curr_discount = $category_wholesale_prices[ $userWholesaleRole[ 0 ] . '_wholesale_discount' ];\n\n if ( !empty( $curr_discount ) ) {\n\n if ( is_null( $lowest_discount ) || $curr_discount < $lowest_discount )\n $lowest_discount = $curr_discount;\n\n if ( is_null( $highest_discount ) || $curr_discount > $highest_discount )\n $highest_discount = $curr_discount;\n\n }\n\n }\n\n }\n\n $category_wholsale_price_logic = get_option( 'wwpp_settings_multiple_category_wholesale_discount_logic' );\n\n if ( $category_wholsale_price_logic == 'highest' ) {\n\n if ( !is_null( $highest_discount ) )\n $wholesalePrice = round( $product_price - ( $product_price * ( $highest_discount / 100 ) ) , 2 );\n\n } else {\n\n if ( !is_null( $lowest_discount ) )\n $wholesalePrice = round( $product_price - ( $product_price * ( $lowest_discount / 100 ) ) , 2 );\n\n }\n\n if ( $wholesalePrice < 0 )\n $wholesalePrice = 0;\n\n }\n\n }\n\n return $wholesalePrice;\n\n }", "public function setDiscount(?float $discount): self\n {\n $this->initialized['discount'] = true;\n $this->discount = $discount;\n\n return $this;\n }", "public function get_manual_discounts()\r\n\t{\r\n\t\t// Set aliases of discount table data.\r\n\t\t$tbl_cols_discounts = $this->flexi->cart_database['discounts']['columns'];\r\n\t\t$tbl_cols_discount_calculations = $this->flexi->cart_database['discount_calculation']['columns'];\r\n\r\n\t\t$manual_set_discounts = $this->flexi->cart_contents['settings']['discounts']['manual'];\r\n\r\n\t\t$discounts = array();\t\r\n\t\tif (! empty($manual_set_discounts))\r\n\t\t{\r\n\t\t\tforeach($manual_set_discounts as $column)\r\n\t\t\t{\t\t\t\r\n\t\t\t\t$discounts[$column['column']][] = array(\r\n\t\t\t\t\t'id' => $column['id'],\r\n\t\t\t\t\t'calculation_id' => $column['calculation'],\r\n\t\t\t\t\t'code' => FALSE,\r\n\t\t\t\t\t'description' => $column['description'],\r\n\t\t\t\t\t'quantity_required' => 1,\r\n\t\t\t\t\t'quantity_discounted' => 1,\r\n\t\t\t\t\t'value_required' => 0,\r\n\t\t\t\t\t'value_discounted' => $column['value'],\r\n\t\t\t\t\t'recursive' => 0,\r\n\t\t\t\t\t'non_combinable' => FALSE,\r\n\t\t\t\t\t'void_reward_points' => (bool)$column['void_reward_points'],\r\n\t\t\t\t\t'force_shipping_discount' => FALSE,\r\n\t\t\t\t\t'tax_method' => $column['tax_method']\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\treturn $discounts;\r\n\t}", "public function testPOSTPromotionRules()\n {\n // TODO: implement\n $this->markTestIncomplete('Not implemented');\n }", "function getDiscountFor($product) {\n\t\treturn 30;\n\t}", "function applyCouponDiscounts($coupons, $shippingType = null, $cartItems){\n\t\t\t$allTotals = array();\n\t\t\t$allTotals['shippingPrice'] = $this->totals['shippingPrice'];\n\t\t\t$allTotals['giftWrapTotal'] = $this->totals['giftWrapTotal'];\n\t\t\t$allTotals['noTaxNoShipping'] = $this->totals['noTaxNoShipping'];\n\t\t\t$this->totals['discount'] = $this->Coupon->applyCoupons($coupons, $shippingType, $cartItems, $allTotals);\n\t\t\t\n\t\t\t//recalculate grandtotal:\n\t\t\t$grandTotal = 0;\n\t\t\tif(array_sum($allTotals) - $this->totals['discount'] > 0){\n\t\t\t\t$grandTotal = array_sum($allTotals) - $this->totals['discount'];\n\t\t\t}else{\n\t\t\t\t//if discounts are greater than grand total, then change discount to difference:\n\t\t\t\t$this->totals['discount'] = $this->totals['discount'] + (array_sum($allTotals) - $this->totals['discount']);\n\t\t\t}\n\t\t\t$this->totals['total'] = $grandTotal;\n\t\t}", "public function continue_checkout($Recipt,$ShoppingCart,$discount)\n {\n $Recipt->update([\n 'is_init_for_card_payment' => null\n ]);\n\n Recipt::where('member_id',$Recipt->member_id)->where('is_init_for_card_payment','1')->delete();\n\n $ReciptProducts = [];\n //--for create Recipt Products--\n foreach ($ShoppingCart as $key => $Cart)\n {\n $this_product = Product::find($Cart->product_id);\n if( $this_product->quantity > 0 || !$this_product)\n {\n //check if selected quantity is not bigger than the stock quantity\n $required_quantity = ($Cart->quantity < $this_product->quantity) ? $Cart->quantity : $this_product->quantity;\n $produ = null;\n $produ = [\n 'recipt_id' => $Recipt->id,\n 'quantity' => $required_quantity ,\n 'product_name_en' => $this_product->name_en ,\n 'product_name_ar' => $this_product->name_ar,\n 'product_id' => $this_product->id ,\n 'cheese_type' => $Cart->cheese_type,\n 'cheese_weight' => $Cart->cheese_weight,\n 'bundle_products_ids' => $this_product->bundle_products_ids,\n 'single_price' => $this_product->price,\n 'total_price' => $this_product->price * $Cart->quantity\n ];\n array_push($ReciptProducts, $produ);\n\n //---decrease the quantity from the product---\n $this_product->update([\n 'quantity' => $this_product->quantity - $required_quantity\n ]);\n }//End if\n }//End foreach\n ReciptProducts::insert($ReciptProducts);\n ShoppingCart::where( 'member_id',$Recipt->member_id )->delete();\n if($discount)\n {\n $myPromo = MemberPromo::where( 'member_id',$Recipt->member_id )->where('is_used',0)->first();\n $myPromo->update([\n 'is_used' => 1,\n 'used_date' => \\Carbon\\Carbon::now()\n ]);\n }\n\n $member = \\App\\Member::find($Recipt->member_id);\n\n $member->update([\n // 'reward_points' => ( $member->reward_points + ceil($Recipt->total_price / 20) ) - $Recipt->points_deduction_price\n 'reward_points' => $member->reward_points - $Recipt->points_deduction_price\n ]);\n\n if($Recipt->payment_method == 'creadit_card')\n {\n $Recipt->update([\n 'payment_method' => 'creadit_card' ,\n 'is_piad' => 1 ,\n ]);\n\n try {\n \\Mail::to($member->email)\n ->send(new \\App\\Mail\\ConfirmOrder($Recipt,$member));\n } catch (\\Exception $e) {\n\n }\n }\n else {\n try {\n \\Mail::to($member->email)\n ->send(new \\App\\Mail\\ConfirmOrder($Recipt,$member));\n }catch (\\Exception $e) {\n\n }\n }\n return response()->json([\n 'status' => 'success',\n 'status_message' => __('page.Thank you for purchasing from us'),\n ]);\n }", "function remove_all_discounts()\n\t\t{\n\t\t\t// The 'unset_discount()' function can accept an array of either discount ids or codes to delete more than one discount at a time.\n\t\t\t// Alternatively, if no data is submitted, the function will delete all discounts that are applied to the cart.\n\t\t\t// This example removes all discount data.\n\t\t\t// $this->flexi_cart->unset_userdata_discount(); // Can't remeber why this 'stock code' didn't work - said 'undefined method' or something\t\t\n\t\t\t$this->flexi_cart->unset_discount();\n\t\t\t\n\t\t\t// Set a message to the CI flashdata so that it is available after the page redirect.\n\t\t\t$this->session->set_flashdata('message', $this->flexi_cart->get_messages());\n\n\t\t\tredirect('cart');\n\t\t}", "public function setDiscounted($s)\n\t{\n\t\t$this->discounted = (bool) $s;\n\n\t\treturn $this;\n\t}", "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 }", "protected static function avail_target_set($filter_items, $items, $target, $rule, $sku_id)\n {\n// Если условие не задано, прерываем обработку\n if (empty($target->condition) || !$filter_items) {\n return false;\n }\n\n $discount_items = self::filter_by_set($items, (array) $target->condition);\n\n return self::calculate_target_discount($target, $discount_items, $rule, $sku_id);\n }", "public static function setUseCoupons($discountList, $use)\n\t{\n\t\tif (!is_array($discountList))\n\t\t\t$discountList = array($discountList);\n\t\t$use = (string)$use;\n\t\tif ($use !== 'Y' && $use !== 'N')\n\t\t\treturn;\n\t\tMain\\Type\\Collection::normalizeArrayValuesByInt($discountList);\n\t\tif (empty($discountList))\n\t\t\treturn;\n\t\t$conn = Main\\Application::getConnection();\n\t\t$helper = $conn->getSqlHelper();\n\t\t$conn->queryExecute(\n\t\t\t'update '.$helper->quote(self::getTableName()).\n\t\t\t' set '.$helper->quote('USE_COUPONS').' = \\''.$use.'\\' where '.\n\t\t\t$helper->quote('ID').' in ('.implode(',', $discountList).')'\n\t\t);\n\t\tunset($helper, $conn);\n\t}", "public function applyDefaults()\n {\n $addressInfo = $this->_getDefaultAddress();\n $this->saveBilling(\n $addressInfo['billing'],\n $addressInfo['billing']['customer_address_id'],\n false\n );\n if (!$addressInfo['billing']['use_for_shipping']) {\n $this->saveShipping(\n $addressInfo['shipping'],\n $addressInfo['shipping']['customer_address_id'],\n false\n );\n }\n\n /**\n * @var Mage_Sales_Model_Quote\n */\n $quote = $this->getQuote();\n $shippingAddress = $quote->getShippingAddress();\n\n // weight vs destination fix\n $weight = 0;\n foreach($quote->getAllItems() as $item) {\n $weight += ($item->getWeight() * $item->getQty()) ;\n }\n $shippingAddress->setFreeMethodWeight($weight)->setWeight($weight);\n\n $shippingAddress->collectTotals()->collectShippingRates()->save();\n $this->applyShippingMethod();\n // shipping method may affect the total in both sides (discount on using shipping address)\n $quote->collectTotals();\n\n $ajaxHelper = Mage::helper('firecheckout/ajax');\n if ($ajaxHelper->getIsShippingMethodDependsOn('total')) {\n // changing total by shipping price may affect the shipping prices theoretically\n // (free shipping may be canceled or added)\n $shippingAddress->setCollectShippingRates(true)->collectShippingRates();\n // if shipping price was changed, we need to recalculate totals again.\n // Example: SELECTED SHIPPING METHOD NOW BECOMES FREE\n // previous method added a discount and selected shipping method wasn't free\n // but removing the previous shipping method removes the discount also\n // and selected shipping method is now free\n $quote->setTotalsCollectedFlag(false)->collectTotals();\n }\n\n $this->applyPaymentMethod();\n if ($ajaxHelper->getIsTotalDependsOn('payment-method')) { // @todo && method is changed\n // recollect totals again because adding/removing payment\n // method may add/remove some discounts in the order\n\n // to recollect discount rules need to clear previous discount\n // descriptions and mark address as modified\n // see _canProcessRule in Mage_SalesRule_Model_Validator\n $shippingAddress->setDiscountDescriptionArray(array())->isObjectNew(true);\n\n $quote->setTotalsCollectedFlag(false)->collectTotals();\n }\n\n $quote->save();\n\n return $this;\n }", "public function set_coupon_discount_totals( $value = array() ) {\n\t\t$this->coupon_discount_totals = (array) $value;\n\t}", "public function updateProduct()\n {\n \t$quote=$this->getQuote();\n \tif($quote)\n \t{\n \t\t$detailproduct=$this->getProduct();\n \t\t$quoteproduct=$quote->getProduct();\n \t\tif(\n\t\t\t\t$quote->getPrice()!=$this->getPrice() or\n\t\t\t\t$quote->getDiscrate()!=$this->getDiscrate() or\n\t\t\t\t$quote->getDiscamt()!=$this->getDiscamt() or\n\t\t\t\t$quote->getProductId()!=$this->getProductId()\n\t\t\t)\n\t\t\t{\n\t\t\t\t$quote->setPrice($this->getPrice());\n\t\t\t\t$quote->setDiscrate($this->getDiscrate());\n\t\t\t\t$quote->setDiscamt($this->getDiscamt());\n\t\t\t\t$quote->setProductId($this->getProductId());\n\t\t\t\t$quote->calc(); //auto save\n\t\t\t\t$detailproduct->calcSalePrices();\n\t\t\t\t\n\t\t\t\t//if product changed, calc old product\n\t\t\t\tif($quoteproduct->getId()!=$detailproduct->getId())\n\t\t\t\t\t$quoteproduct->calcSalePrices();\n\t\t\t}\n \t}\n \telse\n \t{\n\t\t\t//if none, see if product quote by vendor with similar pricing exists. \n\t\t\t$quote=Fetcher::fetchOne(\"Quote\",array('total'=>$this->getUnittotal(),'vendor_id'=>SettingsTable::fetch(\"me_vendor_id\"),'product_id'=>$this->getProductId()));\n\n\t\t\t//if it doesn't exist, create it, and product->calc()\n\t\t\tif(!$quote)\n\t\t\t{\n\t\t\t\tQuoteTable::createOne(array(\n\t\t\t\t\t'date'=>$this->getInvoice()->getDate(),\n\t\t\t\t\t'price'=>$this->getPrice(),\n\t\t\t\t\t'discrate'=>$this->getDiscrate(),\n\t\t\t\t\t'discamt'=>$this->getDiscamt(),\n\t\t\t\t\t'vendor_id'=>SettingsTable::fetch(\"me_vendor_id\"),\n\t\t\t\t\t'product_id'=>$this->getProductId(),\n\t\t\t\t\t'ref_class'=>\"Invoicedetail\",\n\t\t\t\t\t'ref_id'=>$this->getId(),\n\t\t\t\t\t'mine'=>1,\n\t\t\t\t\t));\n\t\t\t\t$this->getProduct()->calcSalePrices();\n\t\t\t}\n \t}\n }", "public function setCalculateDiscountOnCreditMemos(?bool $value): void {\n $this->getBackingStore()->set('calculateDiscountOnCreditMemos', $value);\n }", "function es_set_sale_price( $price, $product ) {\n\t\n\t$exclude_skus = array( 'COEBRCE', 'COEPOSTER', 'PUB41' );\n\t$exclude_cats = array( 'specials', 'clearance' );\n\t$date_now = new DateTime();\n\t$start_dtm = new DateTime( '2016-10-03' );\n\t$end_dtm = new DateTime( '2016-10-11' );\n\t\n\t// exclude SKUs\n\tif ( in_array( $product->sku, $exclude_skus ) )\n\t\treturn $price;\n\t\n\t// exclude specials category\n\t$product_cat = wp_get_post_terms( $product->id, 'product_cat' );\n\t\n\tforeach ( $product_cat as $term ){\n\t\tif( in_array( $term->slug, $exclude_cats ) ){\n\t\t\treturn $price;\n\t\t}\n\t}\t\n\t\n\tif ( ! $product->is_virtual() AND ( $date_now >= $start_dtm AND $date_now <= $end_dtm ) ) {\n\t\t$member_exists = es_check_membership_held();\n\t\t$member_price = get_post_meta($product->id, 'member_price', true);\n\t\t$price = $product->get_regular_price() * ( 0.9 );\n\t\t\n\t\tif ( ! empty( $member_price ) AND $member_exists ) {\n\t\t\t$product->set_price( $member_price );\n\t\t\t$product->sale_price = $price;\n\t\t\t$price = $member_price;\t\t\n\t\t}\n\t\telse {\n\t\t\t$product->set_price( $price );\n\t\t\t$product->sale_price = $price;\t\n\t\t}\n\t\t\n\t}\n\t\n\treturn $price;\n}", "public function update($id, array $data) {\n\t\t$discount = $this->model->findFirst(\"id = '$id'\");\n\t\tif (!$discount) {\n\t\t\treturn false;\n\t\t}\n\t\tif (!$discount->update($data, $this->model->getWhiteList())) {\n\t\t\treturn false;\n\t\t}\n\t\tif (count($data['brandIds'])) {\n $discountBrands = DiscountBrand::find(\"discountId = '$id'\");\n foreach($discountBrands as $temp){\n $temp->delete();\n }\n foreach($data['brandIds'] as $brandId){\n $discountBrand = new DiscountBrand();\n $discountBrand->discountId = $id;\n $discountBrand->brandId = $brandId;\n $discountBrand->save();\n }\n\t\t}\n\t\tif (count($data['categoryIds'])) {\n $discountCategories = DiscountCategory::find(\"discountId = '$id'\");\n foreach($discountCategories as $temp){\n $temp->delete();\n }\n foreach($data['categoryIds'] as $categoryId){\n $discountCategory = new DiscountCategory();\n $discountCategory->discountId = $id;\n $discountCategory->categoryId = $categoryId;\n $discountCategory->save();\n }\n\t\t}\n\t\treturn true;\n\t}", "function ihc_dont_pay_after_discount($level_id, $coupon, $level_arr, $update_coupon_count=FALSE){\n\tif (!empty($coupon)){\n\t\tif (isset($level_arr['access_type']) && $level_arr['access_type']!='regular_period'){\n\t\t\t//not reccurence\n\t\t\t$coupon_data = ihc_check_coupon($coupon, $level_id);\n\t\t\t$level_arr['price'] = ihc_coupon_return_price_after_decrease($level_arr['price'], $coupon_data, FALSE);\n\t\t\tif ($level_arr['price']==0){\n\t\t\t\tif ($update_coupon_count){\n\t\t\t\t\t//update coupon count\n\t\t\t\t\tihc_submit_coupon($coupon);\n\t\t\t\t}\n\t\t\t\treturn TRUE;\n\t\t\t}\n\t\t}\n\t}\n\treturn FALSE;\n}", "protected static function avail_target_cat_all($filter_items, $items, $target, $rule, $sku_id)\n {\n// Если условие не задано, прерываем обработку \n if (empty($target->condition) || !$filter_items) {\n return false;\n }\n\n $discount_items = self::filter_by_cat_all($items, (array) $target->condition);\n\n return self::calculate_target_discount($target, $discount_items, $rule, $sku_id);\n }", "public function define_dish_price() {\n\t\t\t$res = $this->Restaurant_model->define_price();\n\t\t\tif($res == 'suc_def') {\n\t\t\t\techo 'suc_def';\n\t\t\t}\n\t\t}", "private function setPremiumCode(){\n for($i = 0; $i < 7; $i++) {\n $this->premiumCode .= rand(1,9);\n };\n $this->discount = 10;\n }", "function TaxExclusivePrice(){\n\t\tuser_error(\"to be completed\");\n\t}", "public function updateProductStyleOptionPricingAll(){\n\t\t$all_products = $this->getAll();\n\t\t$this->load->model('catalog/product');\n\t\t$this->load->model('tshirtgang/pricing');\n\t\t$this->load->model('catalog/option');\n\t\t$tshirt_option_names = array('Tshirt Color', 'Tshirt Style', 'Tshirt Size');\n\t\t$tshirt_colored = array(\n\t\t\t\"Black\",\n\t\t\t\"Charcoal Grey\",\n\t\t\t\"Daisy\",\n\t\t\t\"Dark Chocolate\",\n\t\t\t\"Forest Green\",\n\t\t\t\"Gold\",\n\t\t\t\"Irish Green\",\n\t\t\t\"Light Blue\",\n\t\t\t\"Light Pink\",\n\t\t\t\"Military Green\",\n\t\t\t\"Navy\",\n\t\t\t\"Orange\",\n\t\t\t\"Purple\",\n\t\t\t\"Red\",\n\t\t\t\"Royal Blue\",\n\t\t\t\"Sport Grey\",\n\t\t\t\"Tan\",\n\t\t\t\"Burgundy\"\n\t\t);\n\t\t$tshirt_ringer = array(\n\t\t\t\"Navy Ringer\",\n\t\t\t\"Black Ringer\",\n\t\t\t\"Red Ringer\"\n\t\t);\n\t\t$tshirt_options = array();\n\t\t$tshirt_options_price = array();\n\t\t$options = $this->model_catalog_option->getOptions();\n\t\t$temp_price = 0.0;\n\t\tforeach($options as $option){\n\t\t\t//if($option['name'] == 'Tshirt Color'){\n\t\t\t//\t$tshirtcolor_option_id = $option['option_id'];\n\t\t\t//}\n\t\t\t//if($option['name'] == 'Tshirt Style'){\n\t\t\t//\t$tshirtstyle_option_id = $option['option_id'];\n\t\t\t//}\n\t\t\t//if($option['name'] == 'Tshirt Size'){\n\t\t\t//\t$tshirtsize_option_id = $option['option_id'];\n\t\t\t//}\n\t\t\tif(in_array($option['name'], $tshirt_option_names)){\n\t\t\t\t$tshirt_options[$option['name']] = array();\n\t\t\t\t$tshirt_options[$option['name']]['option_id'] = $option['option_id'];\n\t\t\t\t$tshirt_options[$option['name']]['prices'] = array();\n\t\t\t}\n\t\t}\n\t\tforeach($tshirt_option_names as $tshirt_option_name){\n\t\t\t$option_value_descriptions = $this->model_catalog_option->getOptionValueDescriptions($tshirt_options[$tshirt_option_name]['option_id']);\n\t\t\tforeach($option_value_descriptions as $opv){\n\t\t\t\t$temp_price = 0.0;\n\t\t\t\tif($tshirt_option_name=='Tshirt Color'){\n\t\t\t\t\tif( in_array($opv['option_value_description'][1]['name'], $tshirt_colored )){\n\t\t\t\t\t\t$temp_price = $this->model_tshirtgang_pricing->get(array( 'code' => 'ColorShirt' ));\n\t\t\t\t\t} elseif( in_array($opv['option_value_description'][1]['name'], $tshirt_ringer )){\n\t\t\t\t\t\t$temp_price = $this->model_tshirtgang_pricing->get(array( 'code' => 'RingerShirt' ));\n\t\t\t\t\t} else { // white\n\t\t\t\t\t\t$temp_price = $this->model_tshirtgang_pricing->get(array( 'code' => 'WhiteShirt' ));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif($tshirt_option_name=='Tshirt Style'){\n\t\t\t\t\tif($opv['option_value_description'][1]['name'] == \"Mens Fitted\" ) $temp_price = $this->model_tshirtgang_pricing->get(array( 'code' => 'MensFittedIncremental' ));\n\t\t\t\t\tif($opv['option_value_description'][1]['name'] == \"Ladies\" ) $temp_price = $this->model_tshirtgang_pricing->get(array( 'code' => 'LadiesIncremental' ));\n\t\t\t\t\tif($opv['option_value_description'][1]['name'] == \"Hooded Pullover\" ) $temp_price = $this->model_tshirtgang_pricing->get(array( 'code' => 'HoodieIncremental' ));\n\t\t\t\t\tif($opv['option_value_description'][1]['name'] == \"Apron\" ) $temp_price = $this->model_tshirtgang_pricing->get(array( 'code' => 'ApronIncremental' ));\n\t\t\t\t\tif($opv['option_value_description'][1]['name'] == \"Vneck\" ) $temp_price = $this->model_tshirtgang_pricing->get(array( 'code' => 'VneckIncremental' ));\n\t\t\t\t\tif($opv['option_value_description'][1]['name'] == \"Tanktop\" ) $temp_price = $this->model_tshirtgang_pricing->get(array( 'code' => 'TanktopIncremental' ));\n\t\t\t\t\tif($opv['option_value_description'][1]['name'] == \"Baby One Piece\" ) $temp_price = $this->model_tshirtgang_pricing->get(array( 'code' => 'BabyOnePieceIncremental' ));\n\t\t\t\t}\n\t\t\t\tif($tshirt_option_name=='Tshirt Size'){\n\t\t\t\t\tif($opv['option_value_description'][1]['name'] == \"2 X-Large\" ) $temp_price = $this->model_tshirtgang_pricing->get(array( 'code' => 'Shirt_2XL_Incremental' ));\n\t\t\t\t\tif($opv['option_value_description'][1]['name'] == \"3 X-Large\" ) $temp_price = $this->model_tshirtgang_pricing->get(array( 'code' => 'Shirt_3XL6XL_Incremental' ));\n\t\t\t\t\tif($opv['option_value_description'][1]['name'] == \"4 X-Large\" ) $temp_price = $this->model_tshirtgang_pricing->get(array( 'code' => 'Shirt_3XL6XL_Incremental' ));\n\t\t\t\t\tif($opv['option_value_description'][1]['name'] == \"5 X-Large\" ) $temp_price = $this->model_tshirtgang_pricing->get(array( 'code' => 'Shirt_3XL6XL_Incremental' ));\n\t\t\t\t\tif($opv['option_value_description'][1]['name'] == \"6 X-Large\" ) $temp_price = $this->model_tshirtgang_pricing->get(array( 'code' => 'Shirt_3XL6XL_Incremental' ));\n\t\t\t\t}\n\t\t\t\tif($temp_price != 0.0){\n\t\t\t\t\t$tshirt_options_price = array(\n\t\t\t\t\t\t'option_value_id' => $opv['option_value_id'],\n\t\t\t\t\t\t'name' => $opv['option_value_description'][1]['name'],\n\t\t\t\t\t\t'price' => $temp_price\n\t\t\t\t\t);\n\t\t\t\t\t$tshirt_options[$tshirt_option_name]['prices'][] = $tshirt_options_price;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tforeach($tshirt_options as $tso1){\n\t\t\tforeach($tso1['prices'] as $tso2){\n\t\t\t\t$sql = \"UPDATE \" . DB_PREFIX . \"product_option_value ocpov \";\n\t\t\t\t$sql .= \"LEFT JOIN \" . DB_PREFIX . \"product ocp \";\n\t\t\t\t$sql .= \" ON ocp.product_id = ocpov.product_id \";\n\t\t\t\t$sql .= \"LEFT JOIN \" . DB_PREFIX . \"tshirtgang_products tsgp \";\n\t\t\t\t$sql .= \" ON tsgp.product_id = ocp.product_id \";\n\t\t\t\t$sql .= \"SET ocpov.price=\". (float)$tso2['price'] . \" \";\n\t\t\t\t$sql .= \"WHERE \";\n\t\t\t\t$sql .= \" ocpov.option_value_id = \" . (int)$tso2['option_value_id'] . \" \";\n\t\t\t\t//$sql .= \" AND \";\n\t\t\t\t//$sql .= \" tsgp.id IS NOT NULL \";\n\t\t\t\t$this->db->query($sql);\n\t\t\t}\n\t\t}\n\t}", "function setSyncItemsPriceAction()\n {\n }", "public function providerDiscountPurchases()\r\n\t{\r\n\t\t$appleProduct = $this->getAppleProduct(self::PRODUCT_WITH_DISCOUNT_PRICE);\r\n\t\t$lightProduct = $this->getLightProduct(self::PRODUCT_WITH_DISCOUNT_PRICE);\r\n\t\t$starshipProduct = $this->getStarshipProduct(self::PRODUCT_WITH_DISCOUNT_PRICE);\r\n\r\n\t\treturn array(\r\n\t\t\tarray(\r\n\t\t\t\t7.0 * self::PRODUCT_APPLE_DISCOUNT_PRICE,\r\n\t\t\t\tarray(\r\n\t\t\t\t\tnew ProductToPurchase($appleProduct, 7.0),\r\n\t\t\t\t),\r\n\t\t\t),\r\n\t\t\tarray(\r\n\t\t\t\t5 * self::PRODUCT_LIGHT_PRICE + 8.0 * self::PRODUCT_APPLE_DISCOUNT_PRICE,\r\n\t\t\t\tarray(\r\n\t\t\t\t\tnew ProductToPurchase($lightProduct, 5),\r\n\t\t\t\t\tnew ProductToPurchase($appleProduct, 8.0),\r\n\t\t\t\t),\r\n\t\t\t),\r\n\t\t\tarray(\r\n\t\t\t\t4 * self::PRODUCT_STARSHIP_PRICE,\r\n\t\t\t\tarray(\r\n\t\t\t\t\tnew ProductToPurchase($starshipProduct, 6)\r\n\t\t\t\t),\r\n\t\t\t),\r\n\t\t);\r\n\t}", "function changeCartSpecial(){\n\t\t$this->getCart();\n\t\t\n\t\t$key = \t\t\tclean_variable($_POST['key'],true);\n\t\t$PRC = \t\t\tclean_variable($_POST['price'],true);\n\t\t$SLCT = \t\t(isset($_POST['selections']))?\n\t\t\t\t\t\t\t\t\t((!is_array($_POST['selections'])) ? array ($_POST['selections'] ) : $_POST['selections']):\n\t\t\t\t\t\t\t\tarray();\n\t\tif(is_array($SLCT)) foreach($SLCT as &$v) clean_variable($v,true);\n\t\t\n\t\tif(count($this->Cart) == 0) header(sprintf(\"Location: %s\", $this->Files['Cart'] ));\n\t\t\n\t\t$this->Cart[$key]['price'] = $PRC;\n\t\tif(is_array($SLCT) && count($SLCT) > 0) $TmpStrg = implode(\":\",$SLCT); else $TmpStrg = $SLCT;\n\t\t$this->Cart[$key][\"selections\"] = $TmpStrg;\n\t\t\n\t\t$this->setCart();\n\t\t\n\t\theader(sprintf(\"Location: %s\", $this->Files['Cart']));\n\t}", "public static function applyForAll($id)\n {\n self::where('id', $id)->update(['is_for_all'=>self::IS_FOR_ALL]);\n }", "public function setDiscountAmount($value){\n return $this->setParameter('discount_amount', $value);\n }", "protected function setProductivity()\n {\n $this->productivity = random_int(8, 12);\n }", "private function sort_discount_data($discount_data = FALSE)\r\n\t{\r\n\t\t// Check the discount tables exist in the config file and are enabled.\r\n\t\tif ($this->get_enabled_status('discounts') && ! empty($discount_data))\r\n\t\t{\t\t\t\r\n\t\t\t$sorted_data = FALSE;\r\n\t\t\t\r\n\t\t\t// Get miscellaneous status settings.\r\n\t\t\t$custom_status_1 = $this->flexi_cart->custom_status_1();\r\n\t\t\t$custom_status_2 = $this->flexi_cart->custom_status_2();\r\n\t\t\t$custom_status_3 = $this->flexi_cart->custom_status_3();\r\n\t\t\t\r\n\t\t\t// Loop through query rows and separate discount data from discounted item ids.\t\t\t\r\n\t\t\tforeach($discount_data as $row_data)\r\n\t\t\t{\r\n\t\t\t\t// Check discount is applicable to the current miscellaneous status settings, else do not include the discount.\r\n\t\t\t\t/*\r\n\t\t\t\tif (($row_data['custom_status_1'] == 1 && ! $custom_status_1) || ($row_data['custom_status_2'] == 1 && ! $custom_status_2) \r\n\t\t\t\t\t|| ($row_data['custom_status_3'] == 1 && ! $custom_status_3))\r\n\t\t\t\t{\r\n\t\t\t\t\tcontinue;\r\n\t\t\t\t}\r\n\t\t\t\t*/\r\n\t\t\t\t\r\n\t\t\t\tif (($row_data['custom_status_1'] != '' && $row_data['custom_status_1'] != $custom_status_1) || \r\n\t\t\t\t\t($row_data['custom_status_2'] != '' && $row_data['custom_status_2'] != $custom_status_2) ||\r\n\t\t\t\t\t($row_data['custom_status_3'] != '' && $row_data['custom_status_3'] != $custom_status_3))\r\n\t\t\t\t{\r\n\t\t\t\t\tcontinue;\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// Set aliases for discount and item id.\r\n\t\t\t\t$discount_id = $row_data['id'];\r\n\t\t\t\t$item_id = $row_data['item_id'];\r\n\t\t\t\t\r\n\t\t\t\t// Get discount target column name.\r\n\t\t\t\t$target_column_ids = array(1 => 'item_price', 2 => 'item_shipping', 3 => 'item_summary_total', 4 => 'shipping_total', 5 => 'total', 6 => 'reward_vouchers');\r\n\t\t\t\tforeach($target_column_ids as $column_id => $column)\r\n\t\t\t\t{\r\n\t\t\t\t\tif ($row_data['column_id'] == $column_id)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t$target_column = $column;\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\t// Remove non-required discount data.\t\t\t\t\r\n\t\t\t\t$remove_discount_keys = array('item_id', 'column_id', 'group_id', 'custom_status_1', 'custom_status_2', 'custom_status_3');\r\n\t\t\t\tforeach($remove_discount_keys as $column)\r\n\t\t\t\t{\r\n\t\t\t\t\tunset($row_data[$column]);\r\n\t\t\t\t}\r\n\t\t\t\r\n\t\t\t\t// Set discount data if not already set.\r\n\t\t\t\tif (! isset($sorted_data[$target_column][$discount_id]))\r\n\t\t\t\t{\r\n\t\t\t\t\t$sorted_data[$target_column][$discount_id] = $row_data;\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\t// Add item id to discount data if applicable.\r\n\t\t\t\tif ($item_id > 0)\r\n\t\t\t\t{\r\n\t\t\t\t\t$sorted_data[$target_column][$discount_id]['item_ids'][] = $item_id;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\treturn $sorted_data;\r\n\t\t}\r\n\t\t\r\n\t\treturn FALSE;\r\n\t}", "public function define_price() {\n\t\t\t$area_id = $this->input->post('area_id');\n\t\t\t$price \t= $this->input->post('price');\n\t\t\t$dish_id = $this->input->post('dish_id');\n\t\t\t$val\t = $this->input->post('val');\n\t\t\t\n\t\t\tif($val == 1) {\n\t\t\t\t$this->db->select('*');\n\t\t\t\t$this->db->where(\"dish_id = '$dish_id' AND brd_area_id='$area_id'\");\n\t\t\t\t$this->db->update('build_restaurant_dishes', array('br_dish_price'=>$price));\n\t\t\t\treturn 'suc_def';\n\t\t\t} else {\n\t\t\t\tredirect(base_url());\n\t\t\t}\n\t\t}", "function new_customers_discount( $cart ) {\n // Only for logged in users\n // if ( ! is_user_logged_in() ) return; // We exit\n\n // Only for new customers without orders\n // if ( wc_get_customer_order_count( get_current_user_id() ) != 0 ) return; // We exit\n\n // Set HERE your categories (can be term IDs, slugs or names) in a coma separated array\n // $product = array('', '', '', '', '', '');\n\n $fee_amount = 0;\n\n $discount = 0;\n // Loop through cart items\n\n\n foreach( $cart->get_cart() as $cart_item ){\n \tswitch ($cart_item['product_id']) {\n \t\tcase 2582:\n \t\t$fee_amount = 10;\n \t\t$discount += $cart_item['line_subtotal']*$fee_amount/100;\n \t\tbreak;\n \t\tcase 2591:\n \t\t$fee_amount = 10;\n \t\t$discount += $cart_item['line_subtotal']*$fee_amount/100;\n \t\tbreak;\n \t}\n }\n\n $chosen_gateway = WC()->session->chosen_payment_method;\n \n if ( $chosen_gateway == 'cod' ) {\n \tif ( $fee_amount > 0 ){\n \t\t// $discount = $cart->cart_contents_total * ($fee_amount / 100);\n \t\t$cart->add_fee( __( 'Discount On EasyPaisa Mobile Account', 'woocommerce'), -$discount );\n \t}\n }\n}", "public function setBaseDiscountAmount($amount);", "function es_product_bulk_price($price, $quantity, $sku) {\n\t/*\n\t* PUB41 - Your child’s first year at school Bulk discount\n\t* For orders of x >= 20 $12.95, x >= 50 $9.90\n\t*/\n\tif ($sku == 'PUB41') {\n\t\tif ($quantity >= 20 AND $quantity < 50) {\n\t\t\t$price = 12.95;\n\t\t}\n\t\telseif ($quantity >= 50) {\n\t\t\t$price = 9.95;\n\t\t}\n\t}\n\telseif($sku == 'SUND507') {\n\t\tif ($quantity >= 3)\n\t\t\t$price = 10.95;\n\t}\n\telseif($sku == 'SUND621') {\n\t\tif ($quantity >= 3)\n\t\t\t$price = 16.95;\n\t}\n\telseif($sku == 'SUND620') {\n\t\tif ($quantity >= 5)\n\t\t\t$price = 14.95;\n\t}\n\t\n\treturn $price;\n}", "public function custom_query()\n {\n $query = $this->db->get(\"products\");\n foreach($query->result() as $row) {\n $data = [\"price\" => $row->price*100];\n $this->db->where('id', $row->id);\n $this->db->update('products', $data);\n }\n die;\n }", "protected function set_filters() {\n\t\t# Ignore all items with undefined price\n\t\t$this->generator->addFilter(\n\t\t\tfunction (\n\t\t\t\tarray $sf_product\n\t\t\t) {\n\t\t\t\t$sf_product = reset( $sf_product );\n\n\t\t\t\t/** @var Product $sf_product */\n\t\t\t\treturn ! empty( $sf_product->get_price() );\n\t\t\t}\n\t\t);\n\t}", "public function payMultipleSuppliers($attributes);", "private function _recalcCampaign() {\n $this->_recalcEntity($this->campaign, $this->advGroup->click_price); // @TODO Price is on advGroup. But this can be in the near future on every adv\n }" ]
[ "0.6392092", "0.6196369", "0.6155742", "0.6114832", "0.6113617", "0.6065358", "0.6046206", "0.59823906", "0.59511465", "0.59465647", "0.59372675", "0.59100026", "0.58893204", "0.5762994", "0.57619953", "0.57266164", "0.571822", "0.5673993", "0.56546307", "0.5587549", "0.5564413", "0.5534173", "0.5439321", "0.5427747", "0.5426774", "0.5402117", "0.53753775", "0.53591806", "0.53581405", "0.5349541", "0.5346842", "0.5343546", "0.5343298", "0.5327327", "0.5304697", "0.5304678", "0.52984464", "0.5272289", "0.52694833", "0.52574414", "0.52563524", "0.5253218", "0.52531", "0.52437115", "0.52418745", "0.52333486", "0.52264684", "0.52262646", "0.52003735", "0.51958996", "0.5191287", "0.51794446", "0.517788", "0.5170715", "0.5167606", "0.51675355", "0.51613176", "0.51588434", "0.5156506", "0.51544124", "0.5142817", "0.5141672", "0.51328844", "0.5132252", "0.51276845", "0.51156723", "0.51126045", "0.51035553", "0.5102262", "0.5096434", "0.5081158", "0.5078991", "0.5061642", "0.50612193", "0.505568", "0.50524575", "0.5047992", "0.50381273", "0.50336677", "0.5028873", "0.5021909", "0.5020547", "0.5018798", "0.5016246", "0.5016027", "0.50140613", "0.4994983", "0.49917418", "0.49848032", "0.49788058", "0.496936", "0.49646717", "0.49640542", "0.4959981", "0.49574527", "0.49546856", "0.49522808", "0.494075", "0.4923974", "0.49209052", "0.4919298" ]
0.0
-1
Target: All false. "Set discount to all products that failed conditions"
protected static function avail_target_all_false($filter_items, $items, $target, $rule, $sku_id) { $false_items = array_diff_key($items, $filter_items); return self::avail_target_all($false_items, $false_items, $target, $rule, $sku_id); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected function calculateDiscount() : void{\r\n $percentage = ($this->discounted_value * 100) / $this->order->getTrueTotal();\r\n $new_total = $this->order->getTrueTotal() - $this->discounted_value;\r\n\r\n $this->order_discount_value = $this->discounted_value;\r\n $this->order_discount_percentage = $percentage;\r\n $this->order_discount_reason = \"For every \" . $this->products_nr . \" products from category #\" . $this->category_id . \" you get one free. You got: \";\r\n foreach($this->items_matching as $item){\r\n $this->order_discount_reason .= floor($item[\"qty\"] / $this->products_nr) . \" x '\" . $item[\"description\"] . \"' (€\". $item[\"price\"] .\" each) ; \";\r\n }\r\n $this->order_new_total = $new_total;\r\n }", "public function set_discount_defaults()\r\n\t{\r\n\t\t// Set array placeholders.\r\n\t\tif (! isset($this->flexi->cart_contents['settings']['discounts']['codes']))\r\n\t\t{\r\n\t\t\t$this->flexi->cart_contents['settings']['discounts']['codes'] = array();\r\n\t\t}\r\n\t\tif (! isset($this->flexi->cart_contents['settings']['discounts']['manual']))\r\n\t\t{\r\n\t\t\t$this->flexi->cart_contents['settings']['discounts']['manual'] = array();\r\n\t\t}\t\r\n\t\r\n\t\t// Reset other discount data.\r\n\t\t$this->flexi->cart_contents['settings']['discounts']['active_items'] = array();\r\n\t\t$this->flexi->cart_contents['settings']['discounts']['active_summary'] = array();\r\n\t\t$this->flexi->cart_contents['settings']['discounts']['reward_vouchers'] = array();\r\n\t\t$this->flexi->cart_contents['settings']['discounts']['data']['item_discount_savings'] = 0;\r\n\t\t$this->flexi->cart_contents['settings']['discounts']['data']['summary_discount_savings'] = 0;\r\n\t\t$this->flexi->cart_contents['settings']['discounts']['data']['reward_vouchers'] = 0;\r\n\t\t$this->flexi->cart_contents['settings']['discounts']['data']['void_reward_point_items'] = array();\r\n\r\n\t\tif (! isset($this->flexi->cart_contents['settings']['discounts']['data']['excluded_discounts']))\r\n\t\t{\r\n\t\t\t$this->flexi->cart_contents['settings']['discounts']['data']['excluded_discounts'] = array();\r\n\t\t}\t\r\n\t\t\r\n\t\treturn TRUE;\r\n\t}", "public function set_manual_discount($discount_data = FALSE)\r\n\t{\r\n\t\tif (is_array($discount_data) && ! empty($discount_data))\r\n\t\t{\r\n\t\t\t// Check that any submitted 'New value' discounts are only applied to the shipping total. \r\n\t\t\tif (isset($discount_data['column']) && isset($discount_data['calculation']) && ($discount_data['column'] != 'shipping_total') && ($discount_data['calculation'] == 3))\r\n\t\t\t{\r\n\t\t\t\treturn FALSE;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t// Merge the code and manual discounts together, then loop through data and compile an array of all discount ids currently in use.\r\n\t\t\t$existing_discounts = array_merge($this->flexi->cart_contents['settings']['discounts']['manual'], $this->flexi->cart_contents['settings']['discounts']['codes']);\r\n\t\t\t$existing_ids = array();\r\n\t\t\t\t\r\n\t\t\tforeach($existing_discounts as $existing_discount)\r\n\t\t\t{\r\n\t\t\t\t$existing_ids[] = $existing_discount['id'];\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t// If an id is not set in the submitted '$discount_data', or if a discount with a matching id already exists, set a new id. \r\n\t\t\tif (! isset($discount_data['id']) || in_array($discount_data['id'], $existing_ids))\r\n\t\t\t{\r\n\t\t\t\t$id = 0;\r\n\t\t\t\twhile (in_array('manual_'.$id, $existing_ids))\r\n\t\t\t\t{\r\n\t\t\t\t\t$id++; \r\n\t\t\t\t}\r\n\t\t\t\t$id = $discount_data['id'] = 'manual_'.$id;\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\t$id = $discount_data['id'];\r\n\t\t\t}\r\n\t\t\r\n\t\t\t// Set default values if not submitted.\r\n\t\t\t$discount_data['description'] = (! isset($discount_data['description'])) ? FALSE : $discount_data['description'];\r\n\t\t\t$discount_data['value'] = (! isset($discount_data['value'])) ? 0 : $discount_data['value'];\r\n\t\t\t$discount_data['column'] = (! isset($discount_data['column'])) ? 'total' : $discount_data['column'];\r\n\t\t\t$discount_data['calculation'] = (! isset($discount_data['calculation'])) ? 1 : $discount_data['calculation'];\r\n\t\t\t$discount_data['tax_method'] = (! isset($discount_data['tax_method'])) ? FALSE : $discount_data['tax_method'];\r\n\t\t\t$discount_data['void_reward_points'] = (! isset($discount_data['void_reward_points'])) ? FALSE : $discount_data['void_reward_points'];\r\n\t\t\t\r\n\t\t\t// Set the cart column the discount is targeting and use the value to act as the discounts array key. \r\n\t\t\t// This prevents multiple discounts being applied to the same cart column.\r\n\t\t\t$target_column = $discount_data['column'];\r\n\t\t\t\r\n\t\t\t// Loop through data and set to cart session summary.\r\n\t\t\tforeach($discount_data as $column => $column_value)\r\n\t\t\t{\r\n\t\t\t\tif ($column == 'value')\r\n\t\t\t\t{\r\n\t\t\t\t\t// If a valid discount value is not set, set the default value as zero. \r\n\t\t\t\t\t$column_value = ($this->non_negative($column_value)) ? $this->format_calculation($column_value, 2, TRUE) : 0;\r\n\t\t\t\t}\r\n\t\t\t\telse if ($column == 'column')\r\n\t\t\t\t{\r\n\t\t\t\t\t// If a valid column is not set, discount the 'total' column by default. \r\n\t\t\t\t\t$column_value = (in_array($column_value, array('item_summary_total', 'shipping_total', 'total'))) ? $column_value : 'total';\r\n\t\t\t\t}\r\n\t\t\t\telse if ($column == 'calculation') \r\n\t\t\t\t{\r\n\t\t\t\t\t// If a valid calculation method is not set, a 'percentage' based calculation is set by default.\r\n\t\t\t\t\t// 1 = Percentage Based, 2 = Flat Fee, 3 = New Value.\r\n\t\t\t\t\t$column_value = (in_array($column_value, array(1,2,3))) ? $column_value : 1;\r\n\t\t\t\t}\r\n\t\t\t\telse if ($column == 'tax_method')\r\n\t\t\t\t{\r\n\t\t\t\t\t// If a valid tax method is not set, the tax method is defined by whether cart prices ex/include taxes by default.\r\n\t\t\t\t\t// 0 = Carts Default Tax Method, 1 = Apply Tax Before Discount, 2 = Apply Discount Before Tax, 3 = Apply Discount Before Tax, Add Original Tax.\r\n\t\t\t\t\t$column_value = (in_array($column_value, array(0, 1,2,3))) ? $column_value : 0;\r\n\t\t\t\t}\r\n\t\t\t\telse if ($column == 'void_reward_points')\r\n\t\t\t\t{\r\n\t\t\t\t\t$column_value = (bool)$column_value;\r\n\t\t\t\t}\r\n\t\t\t\telse if (! in_array($column, array('id', 'description')))\r\n\t\t\t\t{\r\n\t\t\t\t\tcontinue;\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\t$this->flexi->cart_contents['settings']['discounts']['manual'][$target_column][$column] = $column_value;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\treturn TRUE;\r\n\t\t}\r\n\t\t\r\n\t\treturn FALSE;\r\n\t}", "function pp_edd_auto_apply_discount() {\n\n\tif ( function_exists( 'edd_is_checkout' ) && edd_is_checkout() ) {\n\n\t\tif ( ! edd_cart_has_discounts() && edd_is_discount_valid( 'BFCM2016', '', false ) ) {\n\t\t\tedd_set_cart_discount( 'BFCM2016' );\n\t\t}\n\n\t}\n\n}", "public function AssignDiscount()\n\t{\t\n\t}", "function set_discount($discount_id = FALSE)\n\t\t{\n\t\t\t$this->load->model('demo_cart_model');\n\t\t\t\n\t\t\t$this->demo_cart_model->demo_set_discount($discount_id);\n\t\t\t\n\t\t\tredirect('cart');\n\t\t}", "public function isApplicable() : bool{\r\n $items = $this->order->getOrderItems();\r\n foreach($items as $item){\r\n // checks every item for order if the quantity is >= $products_nr\r\n if($item[\"quantity\"] >= $this->products_nr){\r\n $tmp_item = $this->order->getProductById($item[\"product-id\"]);\r\n\r\n // checks if product category equals $category_id \r\n if((int)$tmp_item[\"category\"] === $this->category_id){\r\n $tmp_item[\"qty\"] = $item[\"quantity\"];\r\n\r\n // saves the discounted items in a temporary array\r\n $this->items_matching[] = $tmp_item;\r\n\r\n // stores the total cost of the discount\r\n $this->discounted_value += $tmp_item[\"price\"] * floor($item[\"quantity\"] / $this->products_nr);\r\n }\r\n }\r\n }\r\n\r\n if($this->discounted_value > 0){\r\n $this->is_applicable = true;\r\n $this->calculateDiscount();\r\n return true; \r\n }\r\n return false;\r\n }", "public function applyCartDiscount(Varien_Event_Observer $observer)\n { \n try\n { \n $bundle_product_ids = [];\n $quote_product_ids = [];\n $cookieValue = Mage::getModel('core/cookie')->get('ivid');\n $userBundleCollection = Mage::getModel('increasingly_analytics/bundle')->getCollection()->addFieldToFilter('increasingly_visitor_id',$cookieValue);\n $items = $observer->getEvent()->getQuote()->getAllItems();\n $eligibleProducts = [];\n $discount = 0;\n foreach ($items as $item) {\n array_push($quote_product_ids, $item->getProductId());\n }\n foreach ($userBundleCollection as $bundle) {\n //First Bundle products\n $bundle_product_ids = explode(',', $bundle->getProductIds()); \n $productsIds = array_intersect($quote_product_ids, $bundle_product_ids);\n if(count($productsIds) == count($bundle_product_ids) )\n $discount += $bundle->getDiscountPrice();\n }\n\n if($discount > 0){\n $quote=$observer->getEvent()->getQuote();\n $quoteid=$quote->getId();\n $discountAmount=$discount;\n if($quoteid) { \n if($discountAmount>0) {\n $total=$quote->getBaseSubtotal();\n $quote->setSubtotal(0);\n $quote->setBaseSubtotal(0);\n\n $quote->setSubtotalWithDiscount(0);\n $quote->setBaseSubtotalWithDiscount(0);\n\n $quote->setGrandTotal(0);\n $quote->setBaseGrandTotal(0);\n \n\n $canAddItems = $quote->isVirtual()? ('billing') : ('shipping'); \n foreach ($quote->getAllAddresses() as $address) {\n\n $address->setSubtotal(0);\n $address->setBaseSubtotal(0);\n\n $address->setGrandTotal(0);\n $address->setBaseGrandTotal(0);\n\n $address->collectTotals();\n\n $quote->setSubtotal((float) $quote->getSubtotal() + $address->getSubtotal());\n $quote->setBaseSubtotal((float) $quote->getBaseSubtotal() + $address->getBaseSubtotal());\n\n $quote->setSubtotalWithDiscount(\n (float) $quote->getSubtotalWithDiscount() + $address->getSubtotalWithDiscount()\n );\n $quote->setBaseSubtotalWithDiscount(\n (float) $quote->getBaseSubtotalWithDiscount() + $address->getBaseSubtotalWithDiscount()\n );\n\n $quote->setGrandTotal((float) $quote->getGrandTotal() + $address->getGrandTotal());\n $quote->setBaseGrandTotal((float) $quote->getBaseGrandTotal() + $address->getBaseGrandTotal());\n\n $quote ->save(); \n\n $quote->setGrandTotal($quote->getBaseSubtotal()-$discountAmount)\n ->setBaseGrandTotal($quote->getBaseSubtotal()-$discountAmount)\n ->setSubtotalWithDiscount($quote->getBaseSubtotal()-$discountAmount)\n ->setBaseSubtotalWithDiscount($quote->getBaseSubtotal()-$discountAmount)\n ->save(); \n\n\n if($address->getAddressType()==$canAddItems) {\n //echo $address->setDiscountAmount; exit;\n $address->setSubtotalWithDiscount((float) $address->getSubtotalWithDiscount()-$discountAmount);\n $address->setGrandTotal((float) $address->getGrandTotal()-$discountAmount);\n $address->setBaseSubtotalWithDiscount((float) $address->getBaseSubtotalWithDiscount()-$discountAmount);\n $address->setBaseGrandTotal((float) $address->getBaseGrandTotal()-$discountAmount);\n if($address->getDiscountDescription()){\n $address->setDiscountAmount(-($address->getDiscountAmount()-$discountAmount));\n $address->setDiscountDescription($address->getDiscountDescription().', Custom Discount');\n $address->setBaseDiscountAmount(-($address->getBaseDiscountAmount()-$discountAmount));\n }else {\n $address->setDiscountAmount(-($discountAmount));\n $address->setDiscountDescription('Custom Discount');\n $address->setBaseDiscountAmount(-($discountAmount));\n }\n $address->save();\n }//end: if\n } //end: foreach\n //echo $quote->getGrandTotal();\n\n foreach($quote->getAllItems() as $item){\n //We apply discount amount based on the ratio between the GrandTotal and the RowTotal\n $rat=$item->getPriceInclTax()/$total;\n $ratdisc=$discountAmount*$rat;\n $item->setDiscountAmount(($item->getDiscountAmount()+$ratdisc) * $item->getQty());\n $item->setBaseDiscountAmount(($item->getBaseDiscountAmount()+$ratdisc) * $item->getQty())->save(); \n }\n } \n }\n }\n }\n catch(Exception $e)\n {\n Mage::log(\"Remove from cart tracking - \" . $e->getMessage(), null, 'Increasingly_Analytics.log');\n }\n\n }", "function _apply_auto_disc()\n\t{\n\t\t$num_items = $this->cart->total_items();\n\t\t$auto_disc_info = null;\n\n\t\tforeach ($this->auto_disc_array as $cart_items => $disc_info)\n\t\t{\n\t\t\tif($num_items >= $cart_items)\n\t\t\t{\n\t\t\t\t$auto_disc_info = $disc_info;\n\t\t\t}\n\t\t}\n\n\t\t$applied_disc = $this->cart->discount_info();\n\n\t\t//auto discount should be more than the applied disc (if any)\n\t\tif($applied_disc['percentage'] < $auto_disc_info['percentage'])\n\t\t{\n\t\t\t$this->_apply_discount( $auto_disc_info['coupon'] );\n\t\t}\t\t\n\t}", "public function updateAffectedPlans(Discount $discount)\n {\n }", "function apply_special_item_discount($id, $count, &$disc_amount) {\r\n switch($id) {\r\n case 99999:\r\n case 99998:\r\n if ($count > 100) {\r\n $disc_amount = 50; \r\n }\r\n break; \r\n case 99997:\r\n $disc_amount = 75;\r\n break; \r\n }\r\n }", "function fail_arrangement_discount($parameters) \n\t{\n\t\t$discounts = array();\n\t\t//get_log('scheduling')->Write(print_r($parameters->schedule, true));\n\t\tforeach ($parameters->schedule as $e) \n\t\t{\n\t\t\tif (($e->context == 'arrangement' || $e->context == 'partial') && \n\t\t\t (in_array($e->type, array('adjustment_internal', 'adjustment_internal_fees', 'adjustment_internal_princ')))) {\n\t\t\t \tif ($e->status == 'scheduled') \n\t\t\t\t{\n\t\t\t \t\tRecord_Scheduled_Event_To_Register_Pending($e->date_event, $parameters->application_id, $e->event_schedule_id);\n\t\t\t \t\tRecord_Event_Failure($parameters->application_id, $e->event_schedule_id);\n\t\t\t \t} \n\t\t\t\telseif ($e->status != 'failed') \n\t\t\t\t{\n\t\t\t\t\tRecord_Transaction_Failure($parameters->application_id, $e->transaction_register_id);\n\t\t\t \t}\n\t\t\t}\n\t\t}\n\t}", "public function discountBifurcation(Varien_Event_Observer $observer)\n {\n $rule = $observer->getEvent()->getRule();\n $result = $observer->getEvent()->getResult();\n $itemId = $observer->getEvent()->getItem()->getItemId();\n //set Unique key\n $curUnique= $rule->getRuleId().'_'.$itemId;\n //check if Mage registry unique call set\n if(Mage::registry('uniqueCall')!==null){\n //if check in array\n $uniqueCalls = Mage::registry('uniqueCall');\n if( in_array($curUnique,$uniqueCalls)){\n return;\n }else{\n //unset existing registry. also take existing array in variable\n Mage::unregister('uniqueCall');\n $uniqueCalls[]= $curUnique ;\n //set registry again with new array include $uniqueCall into it\n Mage::register('uniqueCall',$uniqueCalls);\n }\n }else{\n //set registry again with new array include $uniqueCall into it\n $array = array();\n $array[]=$rule->getRuleId().'_'.$itemId;\n Mage::register('uniqueCall',$array);\n\n } \n\n //condition for the Promotional coupons\n if ( $rule->getCouponType() == Mage_SalesRule_Model_Rule::COUPON_TYPE_NO_COUPON ) {\n $promotionDiscount = 0;\n $promotionDiscount = Mage::registry('promotion');\n if (Mage::registry('promotion')!==null){\n Mage::unregister('promotion');\n }\n if (Mage::registry('promo_lable')!==null){\n Mage::unregister('promo_lable');\n }\n $promotionDiscount += $result->getDiscountAmount();\n Mage::register('promotion', $promotionDiscount);\n Mage::register('promo_lable',$rule->getName());\n } elseif ( $rule->getCouponType() == self::COUPON_TYPE_FUE_GENERATED ) {\n $couponDiscount = 0;\n $couponDiscount = Mage::registry('coupon');\n if(Mage::registry('coupon')!==null){\n Mage::unregister('coupon');\n }\n //sum up all the values of discounted coupons\n $couponDiscount += $result->getDiscountAmount();\n Mage::register('coupon',$couponDiscount);\n }\n $quote = $observer->getEvent()->getQuote();\n $quoteAddress = $observer->getEvent()->getAddress();\n //set discounted coupons and promotional coupons amount in quote\n $quote->setCouponDiscount(Mage::registry('coupon'));\n $quote->setPromotionalDiscount(Mage::registry('promotion'));\n\n if (Mage::getStoreConfig('promodiscount/promodiscount/use_default')) {\n $quote->setPromoLable(Mage::getStoreConfig('promodiscount/promodiscount/default_lable'));\n } else {\n if (Mage::registry('promo_lable')) {\n $quote->setPromoLable(Mage::registry('promo_lable'));\n } else {\n $quote->setPromoLable(Mage::getStoreConfig('promodiscount/promodiscount/default_lable'));\n }\n }\n \n $quoteAddress->setCouponDiscount(Mage::registry('coupon'));\n $quoteAddress->setPromotionalDiscount(Mage::registry('promotion'));\n if (Mage::registry('promo_lable')) {\n $quoteAddress->setPromoLable(Mage::registry('promo_lable'));\n } else {\n $quoteAddress->setPromoLable(Mage::getStoreConfig('promodiscount/promodiscount/default_lable'));\n }\n }", "public function applyGlobalDiscount($discount_rate)\n {\n }", "private function updateProductDiscount(\n ProductInterface $product,\n Request $request\n ): void {\n $discountPercent = $request->request->get('discount_percent') !== '' ? (float) $request->request->get('discount_percent') : null;\n $discountLimitType = $request->request->get('discount_limit_type') !== '' ? $request->request->get('discount_limit_type') : null;\n $discountFromDate = $request->request->get('discount_from_date') !== '' ? $request->request->get('discount_from_date') : null;\n $discountToDate = $request->request->get('discount_to_date') !== '' ? $request->request->get('discount_to_date') : null;\n\n $variants = $product->getVariants();\n foreach ($variants as $variant) {\n // Variant to change\n $variantPricing = $variant->getChannelPricings()->first();\n\n // Change percent\n if ($discountPercent !== null) {\n $variantPricing->setDiscount($discountPercent / 100);\n }\n\n // Continue if no change type\n if ($discountLimitType === self::LIMIT_NO_CHANGE) {\n continue;\n }\n // Discount type\n $variantPricing->setDiscountLimitType($discountLimitType === self::LIMIT_NONE ? null : $discountLimitType);\n\n // Date type discount\n if ($discountLimitType === self::LIMIT_DATETIME) {\n if ($discountFromDate && $discountToDate) {\n $dateFrom = \\DateTime::createFromFormat('Y-m-d', $discountFromDate);\n $dateTo = \\DateTime::createFromFormat('Y-m-d', $discountToDate);\n\n $variantPricing->setDiscountFrom($dateFrom);\n $variantPricing->setDiscountTo($dateTo);\n }\n\n if ($discountFromDate && !$discountToDate) {\n $dateFrom = \\DateTime::createFromFormat('Y-m-d', $discountFromDate);\n\n $variantPricing->setDiscountFrom($dateFrom);\n $variantPricing->setDiscountTo(null);\n }\n\n if (!$discountFromDate && $discountToDate) {\n $dateTo = \\DateTime::createFromFormat('Y-m-d', $discountToDate);\n\n $variantPricing->setDiscountFrom(null);\n $variantPricing->setDiscountTo($dateTo);\n }\n }\n }\n }", "public function setDiscount(int $discount): void\n {\n $this->discount = ($discount > 0 && $discount <= 50) ? $discount : 0;\n\n }", "private function validate_item_discounts($item_discount_data)\r\n\t{\r\n\t\t// Check the discount tables exist in the config file and are enabled.\r\n\t\tif ($this->get_enabled_status('discounts'))\r\n\t\t{\r\n\t\t\t// Set an array to hold the ids of all items that have had a discount applied.\r\n\t\t\t$valid_item_discount_data = array('item_price' => array(), 'item_shipping' => array());\r\n\t\t\t$discounted_items = array();\r\n\t\t\t$discounted_cart_value = 0;\r\n\t\t\t$non_combinable_discount = FALSE;\r\n\t\t\t\r\n\t\t\t// Loop through submitted discount data and remove all non item discounts.\r\n\t\t\tforeach($item_discount_data as $target_column => $discount_data)\r\n\t\t\t{\r\n\t\t\t\tif (! in_array($target_column, array('item_price', 'item_shipping')))\r\n\t\t\t\t{\r\n\t\t\t\t\tunset($item_discount_data[$target_column]);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t// All discounts are applied to the cheapest applicable items first, to enforce this, sort items by price, cheapest to most expensive.\r\n\t\t\t$items = $this->flexi->cart_contents['items'];\r\n\t\t\tforeach ($items as $row_id => $column) \r\n\t\t\t{\t\r\n\t\t\t\t$items_sorted[$row_id] = $column[$this->flexi->cart_columns['item_price']];\r\n\t\t\t}\r\n\t\t\tarray_multisort($items_sorted, SORT_ASC, $items);\r\n\t\t\t\r\n\t\t\t// Get array of current user submitted discount codes.\r\n\t\t\t$discount_codes = $this->flexi->cart_contents['settings']['discounts']['codes'];\r\n\t\t\t\r\n\t\t\t// Start looping through each item based discount and calculate the discount value.\r\n\t\t\tforeach($item_discount_data as $target_column => $discount_data)\r\n\t\t\t{\r\n\t\t\t\t// Loop through all discounts for current target column.\r\n\t\t\t\tforeach($discount_data as $discount_id => $discount_cols)\r\n\t\t\t\t{\r\n\t\t\t\t\t// If an item discount is activated via a user submitted code, ensure the discount code has been entered.\r\n\t\t\t\t\t// Or if a discount is 'Non-Combinable' (i.e. There can be no other cart discounts), check no other discounts have been set.\r\n\t\t\t\t\tif ((strlen($discount_cols['code']) > 0 && ! array_key_exists($discount_cols['code'], $discount_codes)) ||\r\n\t\t\t\t\t\t($discount_cols['non_combinable'] == 1 && ! empty($discounted_items)))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tcontinue;\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\t// Tally discount data to check if discount has a valid minimum quantity and value of items to activate discount.\r\n\t\t\t\t\t$applicable_item_quantity = $applicable_item_value = 0;\r\n\t\t\t\t\t$applicable_items = array();\r\n\t\t\t\t\t\r\n\t\t\t\t\t// Loop through cart items and tally the quantity and value of items applicable to the discount.\r\n\t\t\t\t\tforeach($items as $row_id => $column)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tif (in_array($column[$this->flexi->cart_columns['item_id']], $discount_cols['item_ids']) && \r\n\t\t\t\t\t\t\t! in_array($column[$this->flexi->cart_columns['item_id']], $discounted_items))\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t$applicable_item_quantity += $column[$this->flexi->cart_columns['item_quantity']];\r\n\t\t\t\t\t\t\t$applicable_item_value += ($column[$this->flexi->cart_columns['item_price']] * $column[$this->flexi->cart_columns['item_quantity']]);\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t$applicable_items[$row_id] = array(\r\n\t\t\t\t\t\t\t\t'id' => $discount_id,\r\n\t\t\t\t\t\t\t\t'item_id' => $column[$this->flexi->cart_columns['item_id']],\r\n\t\t\t\t\t\t\t\t'description' => $discount_cols['description'],\r\n\t\t\t\t\t\t\t\t'discount_quantity' => 0,\r\n\t\t\t\t\t\t\t\t'non_discount_quantity' => $column[$this->flexi->cart_columns['item_quantity']],\r\n\t\t\t\t\t\t\t\t'item_value' => $column[$this->flexi->cart_columns['item_price']],\r\n\t\t\t\t\t\t\t\t'item_discount' => 0,\r\n\t\t\t\t\t\t\t\t'taxable_value' => 0,\r\n\t\t\t\t\t\t\t\t'non_taxable_value' => 0,\r\n\t\t\t\t\t\t\t\t'tax_value' => 0,\r\n\t\t\t\t\t\t\t\t'void_reward_points' => (bool)$discount_cols['void_reward_points'],\r\n\t\t\t\t\t\t\t\t'force_shipping_discount' => (bool)$discount_cols['force_shipping_discount']\r\n\t\t\t\t\t\t\t);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t// Check that the total quantity and value of items has activated the discounted.\r\n\t\t\t\t\tif (! empty($applicable_items) && \r\n\t\t\t\t\t\t$applicable_item_quantity >= $discount_cols['quantity_required'] && \r\n\t\t\t\t\t\t$applicable_item_value >= $discount_cols['value_required']\r\n\t\t\t\t\t)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t// Calculate the quantity of items that the discount will apply to.\r\n\t\t\t\t\t\t// Set default quantity values incase they equal zero.\r\n\t\t\t\t\t\t$quantity_discounted = ($discount_cols['quantity_discounted'] >= 1) ? $discount_cols['quantity_discounted'] : 1;\r\n\t\t\t\t\t\t$quantity_required = ($discount_cols['quantity_required'] >= 1) ? $discount_cols['quantity_required'] : 1;\r\n\t\t\t\t\t\r\n\t\t\t\t\t\t// If the discount is recursive, calculate number of times the discount needs to be applied.\r\n\t\t\t\t\t\t// Example: Buy 2, Get 1 @ 50% off, and 7 items are added to the cart.\r\n\t\t\t\t\t\t// If 'recursive' = TRUE (1), 2 items will have 50% off, and 5 at normal price, if FALSE (0), 1 item will have 50% off, and 6 at normal price.\r\n\t\t\t\t\t\t$repeat_discount = ($discount_cols['recursive'] == 1) ? floor($applicable_item_quantity / $quantity_required) : 1;\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t// Calculate the number of items to be discounted.\r\n\t\t\t\t\t\t$discounted_quantity = ($repeat_discount * $quantity_discounted);\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t// Loop through applicable items and apply discount values.\r\n\t\t\t\t\t\tforeach($applicable_items as $row_id => $item_data)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tif ($discounted_quantity > 0)\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t// Calculate the quantity of items that the discount can and cannot be applied to.\r\n\t\t\t\t\t\t\t\t$applicable_items[$row_id]['discount_quantity'] = ($discounted_quantity >= $item_data['non_discount_quantity']) ? \r\n\t\t\t\t\t\t\t\t\t$item_data['non_discount_quantity'] : $discounted_quantity;\r\n\t\t\t\t\t\t\t\t$applicable_items[$row_id]['non_discount_quantity'] = ($item_data['non_discount_quantity'] - $applicable_items[$row_id]['discount_quantity']);\r\n\r\n\t\t\t\t\t\t\t\t// Calculate the number of items discounted by the loop so far.\r\n\t\t\t\t\t\t\t\t$discounted_quantity = ($discounted_quantity >= $item_data['non_discount_quantity']) ? \r\n\t\t\t\t\t\t\t\t\t($discounted_quantity - $item_data['non_discount_quantity']) : 0;\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t// Calculate item tax data.\r\n\t\t\t\t\t\t\t\t$item_tax_rate = $this->get_item_tax_rate($row_id, TRUE);\r\n\t\t\t\t\t\t\t\t$item_tax_data = $this->calculate_tax($applicable_items[$row_id]['item_value'], $item_tax_rate);\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t// Calculate item discount data.\r\n\t\t\t\t\t\t\t\t$discount_calculation_data = $this->calculate_discount(\r\n\t\t\t\t\t\t\t\t\t$discount_cols['value_discounted'], \r\n\t\t\t\t\t\t\t\t\t$item_tax_data['taxable_value'], $item_tax_data['non_taxable_value'], $item_tax_data['tax_value'], $item_tax_rate, \r\n\t\t\t\t\t\t\t\t\t$discount_cols['calculation_id'], $discount_cols['tax_method']\r\n\t\t\t\t\t\t\t\t);\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\tif (! empty($discount_calculation_data))\r\n\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\tforeach($discount_calculation_data as $column => $discount_data)\r\n\t\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\t\tif ($column == 'total')\r\n\t\t\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\t\t\t// Calculate discount value per quantity.\r\n\t\t\t\t\t\t\t\t\t\t\t$applicable_items[$row_id]['item_discount'] = $this->format_calculation(\r\n\t\t\t\t\t\t\t\t\t\t\t\t($applicable_items[$row_id]['item_value'] - $discount_data)\r\n\t\t\t\t\t\t\t\t\t\t\t);\r\n\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t$applicable_items[$row_id]['item_value'] = $discount_data;\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\telse\r\n\t\t\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\t\t\t$applicable_items[$row_id][$column] = $discount_data;\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\telse\r\n\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\tunset($applicable_items[$row_id]);\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\telse\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t// Loop through items discount has been applied to.\r\n\t\t\t\t\t\tforeach($applicable_items as $row_id => $item_data)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t// Save item discount data to an array of valid item discounts.\r\n\t\t\t\t\t\t\t$valid_item_discount_data[$target_column][$row_id] = $item_data;\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t// Add discounted item ids to the discounted item array to prevent it being included in another discount.\r\n\t\t\t\t\t\t\t$discounted_items[] = $item_data['item_id'];\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t// If the discount is 'Non-Combinable' (i.e. There can be no other cart discounts), set var to indicate discount is non-combinable.\r\n\t\t\t\t\t\t\t// Stop all further item discount loops. \r\n\t\t\t\t\t\t\tif ($discount_cols['non_combinable'] == 1)\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t$non_combinable_discount = TRUE;\r\n\t\t\t\t\t\t\t\tbreak 3;\r\n\t\t\t\t\t\t\t}\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\t\r\n\t\t\treturn array(\r\n\t\t\t\t'discounts' => $valid_item_discount_data,\r\n\t\t\t\t'non_combinable_discount' => $non_combinable_discount\r\n\t\t\t);\r\n\t\t}\r\n\t\t\r\n\t\treturn FALSE;\r\n\t}", "function TaxExclusivePrice(){\n\t\tuser_error(\"to be completed\");\n\t}", "public function productDisableStatus($customerId){\n $productCollections = Mage::getModel ( 'catalog/product' )->getCollection ()->addAttributeToFilter ( 'userid', $customerId)->addAttributeToFilter ( 'type_id', array (\n 'eq' => 'property'\n ) );\n /**\n * Iterating the loop\n */\n foreach ( $productCollections as $product ) {\n /**\n * Get Product Id\n */\n $productId = $product->getEntityId ();\n $data = array (\n 'propertyapproved' => 0,\n 'status' => 0\n );\n $model = Mage::getModel ( 'catalog/product' )->load ( $productId )->addData ( $data );\n $model->setId ( $productId )->save ();\n }\n }", "function setup() {\r\n // \"Buy more than 100 items, get 50 (% or $, as per admin) off\" \r\n // $this->add_extra_level_discount(100, 50);\r\n }", "function update_discount_codes()\n\t\t{\n\t\t\t// Get the discount codes from the submitted POST data.\n\t\t\t$discount_data = $this->input->post('discount');\n\t\t\t\n\t\t\t// The 'update_discount_codes()' function will validate each submitted code and apply the discounts that have activated their quantity and value requirements.\n\t\t\t// Any previously set codes that have now been set as blank (i.e. no longer present) will be removed.\n\t\t\t// Note: Only 1 discount can be applied per item and per summary column. \n\t\t\t// For example, 2 discounts cannot be applied to the summary total, but 1 discount could be applied to the shipping total, and another to the summary total.\n\t\t\t$this->flexi_cart->update_discount_codes($discount_data);\n\t\t\t\n\t\t\t// Set a message to the CI flashdata so that it is available after the page redirect.\n\t\t\t$this->session->set_flashdata('message', $this->flexi_cart->get_messages());\n\n\t\t\tredirect('cart');\n\t\t}", "private function calculate_summary_discount($discount_data, $taxable_value_ex_tax = 0, $non_taxable_value = 0, $tax_value = 0, $tax_rate = FALSE, \r\n\t\t$append_values = TRUE, $target_column = FALSE)\r\n\t{\r\n\t\t// Only allow 'New Value' discounts to be applied to the shipping rate, otherwise a cart of unlimited items could be sold for the 'New Value'.\r\n\t\tif (empty($discount_data) || (isset($discount_data['calculation_id']) && $discount_data['calculation_id'] == 3 && $target_column != 'shipping')\r\n\t\t)\r\n\t\t{\r\n\t\t\treturn FALSE;\r\n\t\t}\r\n\t\t\r\n\t\t// Calculate the non discounted summary total.\r\n\t\t$non_discounted_total = ($this->flexi_cart->cart_prices_inc_tax()) ? \r\n\t\t\tround(($taxable_value_ex_tax + $non_taxable_value + $tax_value), 2) : round(($taxable_value_ex_tax + $non_taxable_value), 2);\r\n\r\n\t\t// Calculate discount value.\r\n\t\t$discount = $this->calculate_discount(\r\n\t\t\t$discount_data['value_discounted'], $taxable_value_ex_tax, $non_taxable_value, $tax_value, $tax_rate,\r\n\t\t\t$discount_data['calculation_id'], $discount_data['tax_method']\r\n\t\t);\r\n\t\t\r\n\t\t// If a 'new value' shipping discount has been set that costs more than the original value, recalculate the 'new value' to equal the original value.\r\n\t\tif (($target_column == 'shipping' && $discount_data['calculation_id'] == 3) && ($discount['total'] > $non_discounted_total))\r\n\t\t{\r\n\t\t\t$discount = $this->calculate_discount(\r\n\t\t\t\t$non_discounted_total, $taxable_value_ex_tax, $non_taxable_value, $tax_value, $tax_rate,\r\n\t\t\t\t$discount_data['calculation_id'], $discount_data['tax_method']\r\n\t\t\t);\r\n\t\t}\r\n\t\t\t\t\r\n\t\t// Check discount value is set and is not more than the target column value, else it would result in a negative value.\r\n\t\tif ($discount && ($non_discounted_total >= $discount['total']))\r\n\t\t{\r\n\t\t\t$discount['non_combinable'] = (bool)$discount_data['non_combinable'];\r\n\t\t\t$discount['void_reward_points'] = (bool)$discount_data['void_reward_points'];\r\n\t\t\t\t\r\n\t\t\t// Calculate discount value and discount tax.\r\n\t\t\t$discount['value'] = ($discount['tax_method'] == 1) ? ($non_discounted_total - $discount['total']) : \r\n\t\t\t\t(($taxable_value_ex_tax + $non_taxable_value) - ($discount['taxable_value'] + $discount['non_taxable_value']));\r\n\t\t\t$discount['discount_tax'] = ($discount['value'] - ($taxable_value_ex_tax - $discount['taxable_value']) > 0) ?\r\n\t\t\t\t($discount['value'] - ($taxable_value_ex_tax - $discount['taxable_value'])) : 0;\r\n\r\n\t\t\tif ($target_column != 'reward_vouchers')\r\n\t\t\t{\r\n\t\t\t\t// Update summary discount data.\r\n\t\t\t\t$this->flexi->cart_contents['settings']['discounts']['data']['summary_discount_savings'] += $discount['value'];\t\r\n\t\t\t\t$this->flexi->cart_contents['settings']['tax']['data']['summary_discount_tax'] += $discount['discount_tax'];\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\t// Update reward voucher data.\r\n\t\t\t\t$this->flexi->cart_contents['settings']['discounts']['data']['reward_vouchers'] += $discount['value'];\t\r\n\t\t\t\t$this->flexi->cart_contents['settings']['tax']['data']['reward_voucher_tax'] += $discount['discount_tax'];\r\n\t\t\t}\t\t\t\t\r\n\t\t\t\r\n\t\t\t// Update tax columns.\r\n\t\t\tif ($append_values)\r\n\t\t\t{\r\n\t\t\t\t$this->flexi->cart_contents['settings']['tax']['data']['cart_tax'] += $discount['tax_value'];\r\n\t\t\t\t$this->flexi->cart_contents['settings']['tax']['data']['cart_taxable_value'] += $discount['taxable_value'];\r\n\t\t\t\t$this->flexi->cart_contents['settings']['tax']['data']['cart_non_taxable_value'] += $discount['non_taxable_value'];\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\t$this->flexi->cart_contents['settings']['tax']['data']['cart_tax'] = $discount['tax_value'];\r\n\t\t\t\t$this->flexi->cart_contents['settings']['tax']['data']['cart_taxable_value'] = $discount['taxable_value'];\r\n\t\t\t\t$this->flexi->cart_contents['settings']['tax']['data']['cart_non_taxable_value'] = $discount['non_taxable_value'];\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\treturn $discount;\r\n\t\t}\r\n\t\t\r\n\t\treturn FALSE;\r\n\t}", "public function is_valid_for_product( $product, $values = array() ) {\n\t\tif ( ! $this->is_type( wc_get_product_coupon_types() ) ) {\n\t\t\treturn apply_filters( 'woocommerce_coupon_is_valid_for_product', false, $product, $this, $values );\n\t\t}\n\n\t\t$valid = false;\n\t\t$product_cats = wc_get_product_cat_ids( $product->id );\n\n\t\t// Specific products get the discount\n\t\tif ( sizeof( $this->product_ids ) > 0 ) {\n\t\t\tif ( in_array( $product->id, $this->product_ids ) || ( isset( $product->variation_id ) && in_array( $product->variation_id, $this->product_ids ) ) || in_array( $product->get_parent(), $this->product_ids ) ) {\n\t\t\t\t$valid = true;\n\t\t\t}\n\t\t}\n\n\t\t// Category discounts\n\t\tif ( sizeof( $this->product_categories ) > 0 ) {\n\t\t\tif ( sizeof( array_intersect( $product_cats, $this->product_categories ) ) > 0 ) {\n\t\t\t\t$valid = true;\n\t\t\t}\n\t\t}\n\n\t\tif ( ! sizeof( $this->product_ids ) && ! sizeof( $this->product_categories ) ) {\n\t\t\t// No product ids - all items discounted\n\t\t\t$valid = true;\n\t\t}\n\n\t\t// Specific product ID's excluded from the discount\n\t\tif ( sizeof( $this->exclude_product_ids ) > 0 ) {\n\t\t\tif ( in_array( $product->id, $this->exclude_product_ids ) || ( isset( $product->variation_id ) && in_array( $product->variation_id, $this->exclude_product_ids ) ) || in_array( $product->get_parent(), $this->exclude_product_ids ) ) {\n\t\t\t\t$valid = false;\n\t\t\t}\n\t\t}\n\n\t\t// Specific categories excluded from the discount\n\t\tif ( sizeof( $this->exclude_product_categories ) > 0 ) {\n\t\t\tif ( sizeof( array_intersect( $product_cats, $this->exclude_product_categories ) ) > 0 ) {\n\t\t\t\t$valid = false;\n\t\t\t}\n\t\t}\n\n\t\t// Sale Items excluded from discount\n\t\tif ( $this->exclude_sale_items == 'yes' ) {\n\t\t\t$product_ids_on_sale = wc_get_product_ids_on_sale();\n\n\t\t\tif ( isset( $product->variation_id ) ) {\n\t\t\t\tif ( in_array( $product->variation_id, $product_ids_on_sale, true ) ) {\n\t\t\t\t\t$valid = false;\n\t\t\t\t}\n\t\t\t} elseif ( in_array( $product->id, $product_ids_on_sale, true ) ) {\n\t\t\t\t$valid = false;\n\t\t\t}\n\t\t}\n\n\t\treturn apply_filters( 'woocommerce_coupon_is_valid_for_product', $valid, $product, $this, $values );\n\t}", "function ihc_dont_pay_after_discount($level_id, $coupon, $level_arr, $update_coupon_count=FALSE){\n\tif (!empty($coupon)){\n\t\tif (isset($level_arr['access_type']) && $level_arr['access_type']!='regular_period'){\n\t\t\t//not reccurence\n\t\t\t$coupon_data = ihc_check_coupon($coupon, $level_id);\n\t\t\t$level_arr['price'] = ihc_coupon_return_price_after_decrease($level_arr['price'], $coupon_data, FALSE);\n\t\t\tif ($level_arr['price']==0){\n\t\t\t\tif ($update_coupon_count){\n\t\t\t\t\t//update coupon count\n\t\t\t\t\tihc_submit_coupon($coupon);\n\t\t\t\t}\n\t\t\t\treturn TRUE;\n\t\t\t}\n\t\t}\n\t}\n\treturn FALSE;\n}", "function _reconfirm_cheat_code()\n\t{\n\t\t//If discount is applied, do a conditional-check again\n\t\tif($this->cart->is_discount_applied())\n\t\t{\n\t\t\t$coupon = $this->cart->discount_info();\n\t\t\tif($this->_can_apply_code($coupon) == false)\n\t\t\t{\n\t\t\t\t$this->cart->remove_discount();\n\t\t\t}\n\t\t}\n\t}", "protected function applyDiscounts()\n {\n $discounts = $this->booking->bookingDiscounts;\n $this->discountedPeriodsTotal = $this->periodsTotal;\n $discountedTotal = $this->periodsTotal;\n\n if (!$discounts) return;\n\n // Apply discounts based on the order of discount sequence.\n foreach ($this->discountSequence as $sequence) {\n // Filter discounts so that we don't have to loop through all of them.\n $filteredDiscounts = $discounts->where('type', $sequence);\n\n $methodName = \"apply\" . Str::studly($sequence) . \"Discount\";\n\n // Apply and store discount information.\n foreach ($filteredDiscounts as $filteredDiscount) {\n $discountInformation = ['beforeDiscount' => $discountedTotal];\n $discountedTotal = $this->$methodName($discountedTotal, $filteredDiscount);\n $discountInformation['afterDiscount'] = $discountedTotal;\n\n if (!$this->discountApplied($discountInformation['beforeDiscount'], $discountInformation['afterDiscount'])) {\n continue;\n }\n\n $discountInformation['discount'] = $filteredDiscount;\n $this->appliedDiscounts[] = $discountInformation;\n }\n }\n\n $this->discountedPeriodsTotal = $discountedTotal;\n }", "public function testConditionOverride() {\n\t\t$products = $this->productsManager->filter(Attr::id()->lt(3))->find(Attr::category()->eq('Clothes'));\n\t\t$this->assertCount(3, $products);\n\t}", "public function getDiscountCanceled();", "public function setEmptyProducts(){\n foreach ($this->products as $i => $product) {\n $counts = $product->variant->maxCounts;\n //print_R($product);\n $allCount=0;\n foreach ($counts as $count){\n $allCount = $allCount+$count->count;\n }\n if($allCount<=0 || $product->variant->status==0 || $product->product->status==0 ){\n $product->status=0;\n $product->save(true);\n }\n if($product->count > $allCount){\n $product->count = $allCount;\n $product->save(true);\n }\n if($product->count==0){\n\n //unset($this->products[$i]);\n //$product->status=0;\n //$product->save(true);\n $this->removeProduct($product->id);\n }\n }\n foreach ($this->emptyProducts as $i => $emptyProduct) {\n $emptyCounts = $emptyProduct->variant->maxCounts;\n $emptyAllCount=0;\n foreach ($emptyCounts as $emptyCount){\n $emptyAllCount = $emptyAllCount+$emptyCount->count;\n }\n if($emptyAllCount>0 && $emptyProduct->variant->status==1 && $emptyProduct->product->status==1){\n $emptyProduct->status=1;\n $emptyProduct->save(true);\n }\n }\n }", "function apply_deals_discounts_after_tax( $values, $price ) {\n\t\t\t\n\t\t\tif ($this->applied_coupons) foreach ($this->applied_coupons as $code) :\n\t\t\t\t$coupon = new cmdeals_coupon( $code );\n\t\t\t\t\n\t\t\t\tdo_action( 'cmdeals_deals_discount_after_tax_' . $coupon->type, $coupon );\n\t\t\t\t\n\t\t\t\tif ($coupon->type!='fixed_deals' && $coupon->type!='percent_deals') continue;\n\t\t\t\t\n\t\t\t\tif ( !$coupon->apply_before_tax() && $coupon->is_valid() ) :\n\t\t\t\t\t\n\t\t\t\t\t$this_item_is_discounted = false;\n\t\t\n\t\t\t\t\t// Specific deals ID's get the discount\n\t\t\t\t\tif (sizeof($coupon->deal_ids)>0) :\n\t\t\t\t\t\t\n\t\t\t\t\t\tif ((in_array($values['deal_id'], $coupon->deal_ids) || in_array($values['variation_id'], $coupon->deal_ids))) :\n\t\t\t\t\t\t\t$this_item_is_discounted = true;\n\t\t\t\t\t\tendif;\n\t\t\t\t\t\n\t\t\t\t\telse :\n\t\t\t\t\t\t\n\t\t\t\t\t\t// No deals ids - all items discounted\n\t\t\t\t\t\t$this_item_is_discounted = true;\n\t\t\t\t\t\n\t\t\t\t\tendif;\n\t\t\n\t\t\t\t\t// Specific deals ID's excluded from the discount\n\t\t\t\t\tif (sizeof($coupon->exclude_deals_ids)>0) :\n\t\t\t\t\t\t\n\t\t\t\t\t\tif ((in_array($values['deal_id'], $coupon->exclude_deals_ids) || in_array($values['variation_id'], $coupon->exclude_deals_ids))) :\n\t\t\t\t\t\t\t$this_item_is_discounted = false;\n\t\t\t\t\t\tendif;\n\t\t\t\t\t\t\n\t\t\t\t\tendif;\n\t\t\t\t\t\n\t\t\t\t\t// Apply filter\n\t\t\t\t\t$this_item_is_discounted = apply_filters( 'cmdeals_item_is_discounted', $this_item_is_discounted, $values, $before_tax = false );\n\t\t\t\t\t\n\t\t\t\t\t// Apply the discount\n\t\t\t\t\tif ($this_item_is_discounted) :\n\t\t\t\t\t\tif ($coupon->type=='fixed_deals') :\n\t\t\t\t\t\t\n\t\t\t\t\t\t\tif ($price < $coupon->amount) :\n\t\t\t\t\t\t\t\t$discount_amount = $price;\n\t\t\t\t\t\t\telse :\n\t\t\t\t\t\t\t\t$discount_amount = $coupon->amount;\n\t\t\t\t\t\t\tendif;\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t$this->discount_total = $this->discount_total + ( $discount_amount * $values['quantity'] );\n\t\t\t\t\t\t\t\n\t\t\t\t\t\telseif ($coupon->type=='percent_deals') :\n\t\t\t\t\t\t\t$this->discount_total = $this->discount_total + ( $price / 100 ) * $coupon->amount;\n\t\t\t\t\t\tendif;\n\t\t\t\t\tendif;\n\t\t\t\t\t\n\t\t\t\tendif;\n\t\t\tendforeach;\n\t\t}", "public function applyDiscount()\n {\n if (request('discountType') == 1) {\n cart()->applyDiscount($percentage = request('red'));\n return $this->getCartDetails();\n }\n cart()->applyFlatDiscount($amount = request('discountInput'));\n\n return redirect()->route('cart');\n }", "function apply_special_category_discount($category, $count, &$disc_amount) {\r\n switch($category) {\r\n case 99999:\r\n case 99998:\r\n if ($count > 100) {\r\n $disc_amount = 50; \r\n }\r\n break; \r\n case 99997:\r\n $disc_amount = 75;\r\n break;\r\n }\r\n }", "private static function limitAvailableDiscountValue($rule, $item)\n {\n // Ограничение скидки для товара\n if (!empty($rule['limit']['status']) && !empty($rule['limit']['value']) && $rule['limit']['value'] >= 0) {\n $limit = $rule['limit'];\n // Собираем минимальное значение цены товара\n $product_price_minimum = 0;\n switch ($limit['price1']) {\n case \"purchase\":\n $product_price_minimum += $item['purchase_price'];\n break;\n case \"compare_price\":\n $product_price_minimum += $item['compare_price'];\n break;\n }\n if ($limit['currency'] == '%') {\n $price2 = 0;\n switch ($limit['price2']) {\n case \"purchase\":\n $price2 += $item['purchase_price'];\n break;\n case \"price\":\n $price2 += $item['price'];\n break;\n case \"compare_price\":\n $price2 += $item['compare_price'];\n break;\n }\n $product_price_minimum += max(0.0, min(100.0, (float) $limit['value'])) * $price2 / 100;\n } else {\n $product_price_minimum += (float) shop_currency((float) $limit['value'], $limit['currency'], self::getOrderInfo('currency'), false);\n }\n\n // Если товар участвовал в скидках\n if (!empty(self::$available_products[$item['sku_id']][$rule['id']])) {\n // Размер скидки для одной единицы товара\n $product_discount = self::$available_products[$item['sku_id']][$rule['id']]['discount'] / self::$available_products[$item['sku_id']][$rule['id']]['quantity'];\n // Если размер скидки для товара больше, чем установлено ограничением\n if ($item['price'] - $product_discount < $product_price_minimum) {\n // Меняем скидку для товара\n self::$available_products[$item['sku_id']][$rule['id']]['discount'] = shopFlexdiscountHelper::round($item['price'] - $product_price_minimum) * self::$available_products[$item['sku_id']][$rule['id']]['quantity'];\n // Если скидка товара ниже 0, это означает, что минимальная цена товара получилась выше самой цены товара.\n // Удаляем товар из массива скидок\n if (self::$available_products[$item['sku_id']][$rule['id']]['discount'] <= 0) {\n unset(self::$available_products[$item['sku_id']][$rule['id']]);\n }\n }\n }\n }\n\n // Максимальное значение бонусов для товара\n $maximum_product_affiliate = (isset($rule['maximum_product_affiliate']) && $rule['maximum_product_affiliate'] !== '') ? shopFlexdiscountHelper::floatVal($rule['maximum_product_affiliate']) : null;\n if ($maximum_product_affiliate !== null && !empty(self::$available_products[$item['sku_id']][$rule['id']])) {\n // Размер бонусов для одной единицы товара\n $product_affiliate = self::$available_products[$item['sku_id']][$rule['id']]['affiliate'] / self::$available_products[$item['sku_id']][$rule['id']]['quantity'];\n // Если размер бонусов для товара больше, чем установлено ограничением\n if ($product_affiliate > $maximum_product_affiliate) {\n // Меняем бонусы для товара\n self::$available_products[$item['sku_id']][$rule['id']]['affiliate'] = $maximum_product_affiliate * self::$available_products[$item['sku_id']][$rule['id']]['quantity'];\n }\n }\n }", "public function get_manual_discounts()\r\n\t{\r\n\t\t// Set aliases of discount table data.\r\n\t\t$tbl_cols_discounts = $this->flexi->cart_database['discounts']['columns'];\r\n\t\t$tbl_cols_discount_calculations = $this->flexi->cart_database['discount_calculation']['columns'];\r\n\r\n\t\t$manual_set_discounts = $this->flexi->cart_contents['settings']['discounts']['manual'];\r\n\r\n\t\t$discounts = array();\t\r\n\t\tif (! empty($manual_set_discounts))\r\n\t\t{\r\n\t\t\tforeach($manual_set_discounts as $column)\r\n\t\t\t{\t\t\t\r\n\t\t\t\t$discounts[$column['column']][] = array(\r\n\t\t\t\t\t'id' => $column['id'],\r\n\t\t\t\t\t'calculation_id' => $column['calculation'],\r\n\t\t\t\t\t'code' => FALSE,\r\n\t\t\t\t\t'description' => $column['description'],\r\n\t\t\t\t\t'quantity_required' => 1,\r\n\t\t\t\t\t'quantity_discounted' => 1,\r\n\t\t\t\t\t'value_required' => 0,\r\n\t\t\t\t\t'value_discounted' => $column['value'],\r\n\t\t\t\t\t'recursive' => 0,\r\n\t\t\t\t\t'non_combinable' => FALSE,\r\n\t\t\t\t\t'void_reward_points' => (bool)$column['void_reward_points'],\r\n\t\t\t\t\t'force_shipping_discount' => FALSE,\r\n\t\t\t\t\t'tax_method' => $column['tax_method']\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\treturn $discounts;\r\n\t}", "public function setAttributes_discounted( $attributes_discounted ) {\n\t\t$this->attributes_discounted = $attributes_discounted;\n\t}", "private function setEnableReviews() {\n $this->product->set_reviews_allowed($this->wcData->isEnableReviews());\n }", "function beforeSave(){\n\t\t\t// Get the rate\n\t\t\t$rate = 1 / $this->_getRate();\n\n\t\t\t// Convert it back to USD\n\t\t\tif(!empty($this->data['Product']['rrp'])){\n\t\t\t\t$this->data['Product']['rrp'] = $this->data['Product']['rrp'] * $rate;\n\t\t\t}\n\n\t\t\tif(!empty($this->data['Product']['start_price'])){\n\t\t\t\t$this->data['Product']['start_price'] \t= $this->data['Product']['start_price'] * $rate;\n\t\t\t}\n\n\t\t\tif(!empty($this->data['Product']['delivery_cost'])){\n\t\t\t\t$this->data['Product']['delivery_cost'] = $this->data['Product']['delivery_cost'] * $rate;\n\t\t\t}\n\n\t\t\tif(!empty($this->data['Product']['fixed_price'])){\n\t\t\t\t$this->data['Product']['fixed_price'] \t= $this->data['Product']['fixed_price'] * $rate;\n\t\t\t}\n\n\t\t\tif(!empty($this->data['Product']['minimum_price'])){\n\t\t\t\t$this->data['Product']['minimum_price'] = $this->data['Product']['minimum_price'] * $rate;\n\t\t\t}\n\n\t\t\treturn true;\n\t\t}", "public static function bogo_apply_disc($order_id,$promotion_id,$prmdisc_id,$prmdisc_bogo_sbmnu,$prmdisc_bogo_sbmnu_dish,$prmdisc_bogo_qty,$disc_amt_type,$disc_amt){\r \t//echo \"$order_id,$promotion_id,$prmdisc_id,$prmdisc_bogo_sbmnu,$prmdisc_bogo_sbmnu_dish,$prmdisc_bogo_qty,$disc_amt_type,$disc_amt\";\r\t\t//..Check if discount is with sub menu item is selected\r\t\tif(is_gt_zero_num($prmdisc_bogo_sbmnu_dish)){\r\t\t\t//..do nothing..because we already ahve submenudishid\r\t\t}else{\r\t\t //..Get all submenu dish ids from submenu..\r\t\t\t$rs_apl_disc_items= tbl_submenu_dishes::getSubMenuItems($prmdisc_bogo_sbmnu);\r\t\t\tif(is_not_empty($rs_apl_disc_items)){\r\t\t\t\t$prmdisc_bogo_sbmnu_dish=$rs_apl_disc_items;\r\t\t\t}else{\r\t\t\t\t$strOpMsg= \"No items found to apply discount\" ;\r\t\t\t\treturn 0;\r\t\t\t}\r\t\t}\t\t\r \t\t//...Check if the item is in the order detail\r\t\t$tmp_fnd=0;\r\t\t$ord_det_items=tbl_order_details::readArray(array(ORD_DTL_ORDER_ID=>$order_id,ORD_DTL_SBMENU_DISH_ID=>$prmdisc_bogo_sbmnu_dish,ORDPROM_DISCOUNT_AMT=>0),$tmp_fnd,1,0);\t\t\t\t\t\t\t\r\t\tif($tmp_fnd>0){\t\t \r\t\t\t//..item presents in order detail wihtout disocunt\r\t\t\t//..loop through the all the order items records\r\t\t\tforeach($ord_det_items as $order_itm){\r\t\t\t\t //..now check if the quantity >= disc qty\t\t\t\t\t \r\t\t\t\t if($order_itm[ORD_DTL_QUANTITY]>=$prmdisc_bogo_qty){\r\t\t\t\t \t //..Right item to apply discount\r\t\t\t\t\t //..Calculate discount amount\t\r\t\t\t\t\t$discount_amount=tbl_order_details::getDiscountAmnt($disc_amt_type,$disc_amt,$order_itm[ORD_DTL_PRICE]);\r\t\t\t\t\t//..Update the order detail with discount and promot\r\t\t\t\t\t$success=tbl_order_details::update_item_with_discount($order_itm[ORD_DTL_ID],$promotion_id,$prmdisc_id,$discount_amount);\t\r\t\t\t\t\t\t\t\t\t\t\t \r\t\t\t\t }\r\t\t\t}\r\t\t\tunset($ord_det_items);\t\r\t\t}else{\r\t\t\t$strOpMsg= \"Item not present in your order or alreday discounted\" ;\r\t\t}\t\r\t\treturn 1;\r }", "function remove_all_discounts()\n\t\t{\n\t\t\t// The 'unset_discount()' function can accept an array of either discount ids or codes to delete more than one discount at a time.\n\t\t\t// Alternatively, if no data is submitted, the function will delete all discounts that are applied to the cart.\n\t\t\t// This example removes all discount data.\n\t\t\t// $this->flexi_cart->unset_userdata_discount(); // Can't remeber why this 'stock code' didn't work - said 'undefined method' or something\t\t\n\t\t\t$this->flexi_cart->unset_discount();\n\t\t\t\n\t\t\t// Set a message to the CI flashdata so that it is available after the page redirect.\n\t\t\t$this->session->set_flashdata('message', $this->flexi_cart->get_messages());\n\n\t\t\tredirect('cart');\n\t\t}", "public function detectCombos()\n {\n foreach ($this->order->getProducts() as $k => $product) {\n if ($product->getCategory() == 'Shampoo') {\n foreach ($this->order->getProducts() as $key => $productB) {\n if ($productB->getCategory() == 'Conditioner') {\n $productB->setDiscount(0.5);\n }\n }\n }\n }\n }", "private function setRecountProduct() {\n\n //$this->model->setDocumentNumber($this->getDocumentNumber);\n $sql = null;\n if ($this->getVendor() == self::MYSQL) {\n $sql = \"\n INSERT INTO `productrecount` \n (\n `companyId`,\n `warehouseId`,\n `productCode`,\n `productDescription`,\n `productRecountDate`,\n `productRecountSystemQuantity`,\n `productRecountPhysicalQuantity`,\n `isDefault`,\n `isNew`,\n `isDraft`,\n `isUpdate`,\n `isDelete`,\n `isActive`,\n `isApproved`,\n `isReview`,\n `isPost`,\n `executeBy`,\n `executeTime`\n ) VALUES ( \n '\" . $this->getCompanyId() . \"',\n '\" . $this->model->getWarehouseId() . \"',\n '\" . $this->model->getProductCode() . \"',\n '\" . $this->model->getProductDescription() . \"',\n '\" . $this->model->getProductRecountDate() . \"',\n '\" . $this->model->getProductRecountSystemQuantity() . \"',\n '\" . $this->model->getProductRecountPhysicalQuantity() . \"',\n '\" . $this->model->getIsDefault(0, 'single') . \"',\n '\" . $this->model->getIsNew(0, 'single') . \"',\n '\" . $this->model->getIsDraft(0, 'single') . \"',\n '\" . $this->model->getIsUpdate(0, 'single') . \"',\n '\" . $this->model->getIsDelete(0, 'single') . \"',\n '\" . $this->model->getIsActive(0, 'single') . \"',\n '\" . $this->model->getIsApproved(0, 'single') . \"',\n '\" . $this->model->getIsReview(0, 'single') . \"',\n '\" . $this->model->getIsPost(0, 'single') . \"',\n '\" . $this->model->getExecuteBy() . \"',\n \" . $this->model->getExecuteTime() . \"\n );\";\n } else {\n if ($this->getVendor() == self::MSSQL) {\n $sql = \"\n INSERT INTO [productRecount]\n (\n [productRecountId],\n [companyId],\n [warehouseId],\n [productCode],\n [productDescription],\n [productRecountDate],\n [productRecountSystemQuantity],\n [productRecountPhysicalQuantity],\n [isDefault],\n [isNew],\n [isDraft],\n [isUpdate],\n [isDelete],\n [isActive],\n [isApproved],\n [isReview],\n [isPost],\n [executeBy],\n [executeTime]\n) VALUES (\n '\" . $this->getCompanyId() . \"',\n '\" . $this->model->getWarehouseId() . \"',\n '\" . $this->model->getProductCode() . \"',\n '\" . $this->model->getProductDescription() . \"',\n '\" . $this->model->getProductRecountDate() . \"',\n '\" . $this->model->getProductRecountSystemQuantity() . \"',\n '\" . $this->model->getProductRecountPhysicalQuantity() . \"',\n '\" . $this->model->getIsDefault(0, 'single') . \"',\n '\" . $this->model->getIsNew(0, 'single') . \"',\n '\" . $this->model->getIsDraft(0, 'single') . \"',\n '\" . $this->model->getIsUpdate(0, 'single') . \"',\n '\" . $this->model->getIsDelete(0, 'single') . \"',\n '\" . $this->model->getIsActive(0, 'single') . \"',\n '\" . $this->model->getIsApproved(0, 'single') . \"',\n '\" . $this->model->getIsReview(0, 'single') . \"',\n '\" . $this->model->getIsPost(0, 'single') . \"',\n '\" . $this->model->getExecuteBy() . \"',\n \" . $this->model->getExecuteTime() . \"\n );\";\n } else {\n if ($this->getVendor() == self::ORACLE) {\n $sql = \"\n INSERT INTO PRODUCTRECOUNT\n (\n COMPANYID,\n WAREHOUSEID,\n PRODUCTCODE,\n PRODUCTDESCRIPTION,\n PRODUCTRECOUNTDATE,\n PRODUCTRECOUNTSYSTEMQUANTITY,\n PRODUCTRECOUNTPHYSICALQUANTITY,\n ISDEFAULT,\n ISNEW,\n ISDRAFT,\n ISUPDATE,\n ISDELETE,\n ISACTIVE,\n ISAPPROVED,\n ISREVIEW,\n ISPOST,\n EXECUTEBY,\n EXECUTETIME\n ) VALUES (\n '\" . $this->getCompanyId() . \"',\n '\" . $this->model->getWarehouseId() . \"',\n '\" . $this->model->getProductCode() . \"',\n '\" . $this->model->getProductDescription() . \"',\n '\" . $this->model->getProductRecountDate() . \"',\n '\" . $this->model->getProductRecountSystemQuantity() . \"',\n '\" . $this->model->getProductRecountPhysicalQuantity() . \"',\n '\" . $this->model->getIsDefault(0, 'single') . \"',\n '\" . $this->model->getIsNew(0, 'single') . \"',\n '\" . $this->model->getIsDraft(0, 'single') . \"',\n '\" . $this->model->getIsUpdate(0, 'single') . \"',\n '\" . $this->model->getIsDelete(0, 'single') . \"',\n '\" . $this->model->getIsActive(0, 'single') . \"',\n '\" . $this->model->getIsApproved(0, 'single') . \"',\n '\" . $this->model->getIsReview(0, 'single') . \"',\n '\" . $this->model->getIsPost(0, 'single') . \"',\n '\" . $this->model->getExecuteBy() . \"',\n \" . $this->model->getExecuteTime() . \"\n );\";\n }\n }\n }\n try {\n $this->q->create($sql);\n } catch (\\Exception $e) {\n $this->q->rollback();\n echo json_encode(array(\"success\" => false, \"message\" => $e->getMessage()));\n exit();\n }\n }", "public function simulateDisabledMatchAllConditionsFailsOnFaultyExpression() {}", "public function hasActdiscount(){\n return $this->_has(34);\n }", "public function simulateDisabledMatchAllConditionsFailsOnFaultyExpression() {}", "function apply_cart_discounts_after_tax() {\t\n\t\t\t\n\t\t\tif ($this->applied_coupons) foreach ($this->applied_coupons as $code) :\n\t\t\t\t$coupon = new cmdeals_coupon( $code );\n\t\t\t\t\n\t\t\t\tdo_action( 'cmdeals_cart_discount_after_tax_' . $coupon->type, $coupon );\n\t\t\t\t\n\t\t\t\tif ( !$coupon->apply_before_tax() && $coupon->is_valid() ) :\n\t\t\t\t\t\n\t\t\t\t\tswitch ($coupon->type) :\n\t\t\t\t\t\n\t\t\t\t\t\tcase \"fixed_cart\" :\n\t\n\t\t\t\t\t\t\t$this->discount_total = $this->discount_total + $coupon->amount;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\n\t\t\t\t\t\tcase \"percent\" :\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t$percent_discount = (round( $this->cart_contents_total + $this->tax_total , 2) / 100 ) * $coupon->amount;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t$this->discount_total = $this->discount_total + $percent_discount;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\n\t\t\t\t\tendswitch;\n\t\n\t\t\t\tendif;\n\t\t\tendforeach;\n\t\t}", "function _apply_discount($coupon)\n\t{\n\t\t$this->database->SaveCheatCode($coupon);\n\t\t$discount_percentage = 0;\n\t\t$coupon_info = $this->database->GetDiscountCoupon($coupon);\n\n\t\t//Run some conditional-check for code\n\t\tif($this->_can_apply_code($coupon_info))\n\t\t{\n\t\t\t$discount_percentage = $this->_getDiscount($coupon);\n\t\t\t$this->cart->apply_discount($coupon, $discount_percentage);\n\t\t}\n\n\t\t$this->_notify_discount_applied($discount_percentage, $coupon_info);\n\n\t}", "public function createRule($rand_code, $expiration_time, $discount_type, $discount_amount, $allow_free_shipping, $stop_further_discount)\n {\n try {\n $customer_groups = $this->getCustomerGroups(); //get through functions\n\n $from_date = date('Y-m-d');\n if ($expiration_time > 1) {\n $to_date = date('Y-m-d', strtotime($from_date . ' + ' . $expiration_time . ' days'));\n } else {\n $to_date = date('Y-m-d', strtotime($from_date . ' + 1 day'));\n }\n$from_date = date('Y-m-d', strtotime($from_date . ' -1 day'));\n $rule = Mage::getModel('salesrule/rule');\n $rule->setName($rand_code);\n $rule->setDescription('Coupon Created By Spin and Win (Knowband)');\n $rule->setFromDate($from_date); //starting today\n $rule->setToDate($to_date); //if you need an expiration date\n $rule->setCouponType(2);\n $rule->setCouponCode($rand_code);\n $rule->setUsesPerCoupon(1); //number of allowed uses for this coupon\n $rule->setUsesPerCustomer(1); //number of allowed uses for this coupon for each customer\n $rule->setCustomerGroupIds($customer_groups); //if you want only certain groups replace getAllCustomerGroups() with an array of desired ids \n $rule->setIsActive(1);\n\n $rule->setStopRulesProcessing($stop_further_discount); //set to 1 if you want all other rules after this to not be processed\n $rule->setIsRss(0); //set to 1 if you want this rule to be public in rss\n $rule->setIsAdvanced(1); //have no idea what it means :)\n $rule->setProductIds('');\n $rule->setSortOrder(0); // order in which the rules will be applied\n $rule->setWebsiteIds(array(Mage::app()->getWebsite()->getId())); // order in which the rules will be applied\n\n if ($discount_type == 'fixed') {\n $rule->setSimpleAction('by_fixed');\n } else {\n $rule->setSimpleAction('by_percent');\n }\n\n //all available discount types\n //by_percent - Percent of product price discount\n //by_fixed - Fixed amount discount\n //cart_fixed - Fixed amount discount for whole cart\n //buy_x_get_y - Buy X get Y free (discount amount is Y)\n\n $rule->setDiscountAmount($discount_amount); //the discount amount/percent. if SimpleAction is by_percent this value must be <= 100\n $rule->setDiscountQty(0); //Maximum Qty Discount is Applied to\n $rule->setDiscountStep(0); //used for buy_x_get_y; This is X\n if ($allow_free_shipping) {\n $rule->setSimpleFreeShipping(Mage_SalesRule_Model_Rule::FREE_SHIPPING_ADDRESS); //set to 1 for Free shipping\n $rule->setApplyToShipping(1); //set to 1 for Free shipping\n } else {\n $rule->setSimpleFreeShipping(0); //set to 1 for Free shipping\n $rule->setApplyToShipping(0); //set to 1 for Free shipping\n }\n\n// $rule->setApplyToShipping(0); //set to 0 if you don't want the rule to be applied to shipping\n// $rule->setWebsiteIds(array(1));//if you want only certain websites replace getAllWbsites() with an array of desired ids\n\n $conditions = array();\n $conditions[1] = array(\n 'type' => 'salesrule/rule_condition_combine',\n 'aggregator' => 'all',\n 'value' => \"1\", //[UPDATE] added quotes on the value. Thanks Aziz Rattani [/UPDATE]\n 'new_child' => ''\n );\n //the conditions above are for 'if all of these conditions are true'\n //for if any one of the conditions is true set 'aggregator' to 'any'\n //for if all of the conditions are false set 'value' to 0.\n //for if any one of the conditions is false set 'aggregator' to 'any' and 'value' to 0\n $conditions['1--1'] = Array\n (\n 'type' => 'salesrule/rule_condition_address',\n 'attribute' => 'base_subtotal',\n 'operator' => '>=',\n 'value' => 1\n );\n //the constraints above are for 'Subtotal is equal or grater than 200'\n //for 'equal or less than' set 'operator' to '<='... You get the idea other operators for numbers: '==', '!=', '>', '<'\n //for 'is one of' set operator to '()';\n //for 'is not one of' set operator to '!()';\n //in this example the constraint is on the subtotal\n //for other attributes you can change the value for 'attribute' to: 'total_qty', 'weight', 'payment_method', 'shipping_method', 'postcode', 'region', 'region_id', 'country_id'\n //to add an other constraint on product attributes (not cart attributes like above) uncomment and change the following:\n /*\n $conditions['1--2'] = array\n (\n 'type' => 'salesrule/rule_condition_product_found',//-> means 'if all of the following are true' - same rules as above for 'aggregator' and 'value'\n //other values for type: 'salesrule/rule_condition_product_subselect' 'salesrule/rule_condition_combine'\n 'value' => 1,\n 'aggregator' => 'all',\n 'new_child' => '',\n );\n\n $conditions['1--2--1'] = array\n (\n 'type' => 'salesrule/rule_condition_product',\n 'attribute' => 'sku',\n 'operator' => '==',\n 'value' => '12',\n );\n */\n //$conditions['1--2--1'] means sku equals 12. For other constraints change 'attribute', 'operator'(see list above), 'value'\n\n $rule->setData('conditions', $conditions);\n $rule->loadPost($rule->getData());\n $rule->save();\n return true;\n } catch (Exception $e) {\n Mage::logException($e);\n return false;\n }\n }", "public function hasDiscount(){\n return $this->_has(9);\n }", "public function set_credits_discountamount($observer)\n {\n$array2 = Mage::helper('kartparadigm_storecredit')->getCreditRates();\n//Mage::log(Mage::helper('kartparadigm_storecredit')->getRefundDeductConfig() . \" configuration settings \");\n//Mage::log($array2);\n $session = Mage::getSingleton('checkout/session');\n if(Mage::helper('customer')->isLoggedIn()) {\n $customer = Mage::getSingleton('customer/session')->getCustomer();\n $customer_group=Mage::getModel('customer/group')->load(Mage::getSingleton('customer/session')->getCustomerGroupId())->getCustomerGroupCode();\n}\n \n$val1 = Mage::getSingleton('adminhtml/session')->getValue();\nif(isset($val1))\n{\n$amt1 = array();\n$amt1 = Mage::getSingleton('checkout/session')->getCredits();\n$amt = $amt1['totalCredits'];\n$quote = Mage::getSingleton('adminhtml/session_quote')->getQuote();\n}\nelse{\n$amt1 = array();\n $quote = Mage::getModel('checkout/cart')->getQuote();\n$amt1 = Mage::getSingleton('checkout/session')->getCredits();\n$amt = $amt1['discountCredits'];\n}\n $isvirtual=0;\n foreach($quote->getAllItems() as $item){\n if($item->getIsVirtual()==1) {\n $isvirtual=1;\n }\n if(Mage::getModel('catalog/product')->load($item->getProductId())->getTypeId()=='customproduct'){\n $isvirtual=1;\n }\n }\n$total=$quote->getGrandTotal(); \n\n$subTotal = $quote->getSubtotal();\n//Mage::log($quote->getGrandTotal().\"this is grand total store credit\");\n//Mage::log($quote->getSubtotal().\"this is sub total\");\n\n if (!Mage::helper('kartparadigm_storecredit')->getTaxEnabled()){\n$tax = $quote->getShippingAddress()->getData('tax_amount');\n}\n if(!Mage::helper('kartparadigm_storecredit')->getIsShippingEnabled()){\n$shippingPrice = $quote->getShippingAddress()->getShippingAmount();\n}\n$totalCredits1 = array();\n$totalCredits1 = Mage::getSingleton('checkout/session')->getCredits();\n$totalCredits = $totalCredits1['totalCredits'];\n\n$currentTimestamp = Mage::getModel('core/date')->timestamp(time()); \n$nowdate = date('Y-m-d H:m:s', $currentTimestamp); \n//echo $expirydate;\n//echo $nowdate;\n$balance;\n//echo $amt;\n$amt2;\n $amt1;\n \n\nif(isset($amt)){\n/*---------------------Calculating Default Currency Value----------------------- */\n$amt1 = ($array2['basevalue'] * $amt) / $array2['credits'];\n $baseCurrencyCode = Mage::app()->getStore()->getBaseCurrencyCode();\n $currentCurrencyCode = Mage::app()->getStore()->getCurrentCurrencyCode();\n if ($baseCurrencyCode != $currentCurrencyCode) {\n $amt2 = Mage::helper('directory')->currencyConvert($amt1, $baseCurrencyCode, $currentCurrencyCode);\n }\n else{\n $amt2 = $amt1; \n }\n // $amt2 = Mage::helper('core')->currency($amt1, true, false);\n//Mage::log($amt1.\" = amount = \".$amt2 );\n//----------------------------------------------------------------\nif($total > $amt2) {\nif(($total - $tax - $shippingPrice) > $amt2){\n$discountAmount = $amt2;\n$balance = $totalCredits - $amt;\n}else{\n $discountAmount = $subTotal;\n$points = round(($discountAmount * $amt)/$amt2);\n//Mage::log($points.\"Conver Points\");\n$balance = $totalCredits - $points;\n}\n}\nelse {\n$discountAmount = $total - $tax - $shippingPrice;\n$points = round(($discountAmount * $amt)/$amt2);\n//Mage::log($points.\"Conver Points\");\n$balance = $totalCredits - $points;\n}\nMage::getSingleton('core/session')->setBalance($balance);\n\nMage::getSingleton('checkout/session')->setDiscount($totalCredits - $balance);\n$msg = \"Current Credits In Your Account : \" . $balance;\nMage::getSingleton('core/session')->setCredits($msg);\n if ($discountAmount > 0) {\n\n\nif ($baseCurrencyCode != $currentCurrencyCode) {\n \n$allowedCurrencies = Mage::getModel('directory/currency')->getConfigAllowCurrencies();\n$rates = Mage::getModel('directory/currency')->getCurrencyRates($baseCurrencyCode, array_values($allowedCurrencies));\n\n$baseDiscount = $discountAmount/$rates[$currentCurrencyCode];\n\n }\nelse{\n $baseDiscount = $discountAmount;\n } \n $total = $quote->getBaseSubtotal();\n $data1 = $quote->getData();\n // Mage::log($data1['entity_id'].\"quote id\");\n $quote->setSubtotal(0);\n $quote->setBaseSubtotal(0);\n $quote->setSubtotalWithDiscount(0);\n $quote->setBaseSubtotalWithDiscount(0);\n $quote->setGrandTotal(0);\n $quote->setBaseGrandTotal(0);\n $canAddItems = $quote->isVirtual() ? ('billing') : ('shipping');\n foreach($quote->getAllAddresses() as $address) {\n $data = $address->getData();\n $address->setSubtotal(0);\n $address->setBaseSubtotal(0);\n $address->setGrandTotal(0);\n $address->setBaseGrandTotal(0);\n $address->collectTotals();\n $quote->setSubtotal((float)$quote->getSubtotal() + $address->getSubtotal());\n $quote->setBaseSubtotal((float)$quote->getBaseSubtotal() + $address->getBaseSubtotal());\n $quote->setSubtotalWithDiscount((float)$quote->getSubtotalWithDiscount() + $address->getSubtotalWithDiscount());\n $quote->setBaseSubtotalWithDiscount((float)$quote->getBaseSubtotalWithDiscount() + $address->getBaseSubtotalWithDiscount());\n $quote->setGrandTotal((float)$quote->getGrandTotal() + $address->getGrandTotal());\n $quote->setBaseGrandTotal((float)$quote->getBaseGrandTotal() + $address->getBaseGrandTotal());\n $quote->setEntityId($data1['entity_id'])->save();\n $quote->setSubtotalWithDiscount($quote->getSubtotal() - $discountAmount)->setBaseSubtotalWithDiscount($quote->getBaseSubtotal() - $baseDiscount)->setEntityId($data1['entity_id'])->save();\n if ($address->getAddressType() == $canAddItems) {\n $address->setSubtotalWithDiscount((float)$data['subtotal_with_discount'] - $discountAmount);\n $address->setGrandTotal((float)$data['grand_total'] - $discountAmount);\n $address->setBaseSubtotalWithDiscount((float)$data['base_subtotal_with_discount'] - $baseDiscount);\n $address->setBaseGrandTotal((float)$data['base_grand_total'] - $baseDiscount);\n if ($data['discount_description']) {\n $address->setDiscountAmount(($data['discount_amount'] - $discountAmount));\n $address->setDiscountDescription($data['discount_description'] . ', Store Credits');\n $address->setBaseDiscountAmount(($data['base_discount_amount'] - $baseDiscount));\n }\n else {\n $address->setDiscountAmount(-($discountAmount));\n $address->setDiscountDescription('Store Credits');\n $address->setBaseDiscountAmount(-($baseDiscount));\n }\n $address->setAddressId($data['address_id'])->save();\n }\n }\n foreach($quote->getAllItems() as $item) {\n\n // We apply discount amount based on the ratio between the GrandTotal and the RowTotal\n $rat = $item->getPriceInclTax() / $quote->getSubtotal();\n $rat1 = $item->getBasePriceInclTax() / $quote->getBaseSubtotal();\n $ratdisc = $discountAmount * $rat;\n $ratdisc1 = $baseDiscount * $rat1;\n//Mage::log($item->getDiscountAmount().\"include tax\".$item->getBaseDiscountAmount());\n // Mage::log($item->getDiscountAmount().\"discount storecredit\");\n$idata = $item->getData();\n Mage::log($item->getDiscountAmount().\"discount amount credit\");\n $item->setDiscountAmount(($item->getDiscountAmount() + $ratdisc) * $item->getQty());\n $item->setBaseDiscountAmount(($item->getBaseDiscountAmount() + $ratdisc1) * $item->getQty())->save();\n }\n }else if($totalCredits == 0){\n\n$msg = \"Sorry You Have No Credits In Your Account\";\nMage::getSingleton('core/session')->setCredits($msg);\n}\n \n \n } \n }", "public function setFailures()\n {\n \t$criteria = new CDbCriteria;\n \t$criteria->addColumnCondition(array('userId' => Yii::app()->user->id));\n \t$criteria->addCondition(array('condition' => 'NOW() > DATE_ADD(op_date,INTERVAL 4 MONTH)'));\n \t$criteria->addCondition(array('condition' => 'fu_date IS NULL'));\n\t\t$this->updateAll(array('fu_primary_success' => 'Failure'), $criteria, array());\n }", "protected function _applyObjectProperty()\n\t{\n\t\tparent::_applyObjectProperty();\n\n\t\t$modelName = $this->_object->getModelName();\n\n\t\tswitch ($modelName)\n\t\t{\n\t\t\tcase 'shop_discount':\n\t\t\t\t// Скидка не может быть больше 100%\n\t\t\t\tif ($this->_object->type == 0 && $this->_object->value > 100)\n\t\t\t\t{\n\t\t\t\t\t$this->_object->value = 0;\n\t\t\t\t\t$this->_object->save();\n\n\t\t\t\t\t$this->addMessage(\n\t\t\t\t\t\tCore_Message::get(Core::_('Shop_Discount.percent_error'), 'error')\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\t// Группа доступа\n\t\t\t\t$aSiteuser_Groups = array(0 => Core::_('Structure.all'));\n\n\t\t\t\tif (Core::moduleIsActive('siteuser'))\n\t\t\t\t{\n\t\t\t\t\t$oSiteuser_Controller_Edit = new Siteuser_Controller_Edit($this->_Admin_Form_Action);\n\t\t\t\t\t$aSiteuser_Groups = $aSiteuser_Groups + $oSiteuser_Controller_Edit->fillSiteuserGroups($this->_object->Shop->site_id);\n\t\t\t\t}\n\n\t\t\t\t$aTmp = array();\n\n\t\t\t\t$aShop_Discount_Siteuser_Groups = $this->_object->Shop_Discount_Siteuser_Groups->findAll(FALSE);\n\t\t\t\tforeach ($aShop_Discount_Siteuser_Groups as $oShop_Discount_Siteuser_Group)\n\t\t\t\t{\n\t\t\t\t\t!in_array($oShop_Discount_Siteuser_Group->siteuser_group_id, $aTmp)\n\t\t\t\t\t\t&& $aTmp[] = $oShop_Discount_Siteuser_Group->siteuser_group_id;\n\t\t\t\t}\n\n\t\t\t\tforeach ($aSiteuser_Groups as $siteuser_group_id => $name)\n\t\t\t\t{\n\t\t\t\t\t$bSiteuserGroupChecked = Core_Array::getPost('siteuser_group_' . $siteuser_group_id);\n\n\t\t\t\t\tif ($bSiteuserGroupChecked)\n\t\t\t\t\t{\n\t\t\t\t\t\tif (!in_array($siteuser_group_id, $aTmp))\n\t\t\t\t\t\t{\n\n\t\t\t\t\t\t\t$oShop_Discount_Siteuser_Group = Core_Entity::factory('Shop_Discount_Siteuser_Group');\n\t\t\t\t\t\t\t$oShop_Discount_Siteuser_Group->siteuser_group_id = $siteuser_group_id;\n\t\t\t\t\t\t\t$this->_object->add($oShop_Discount_Siteuser_Group);\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 (in_array($siteuser_group_id, $aTmp))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$oShop_Discount_Siteuser_Group = $this->_object->Shop_Discount_Siteuser_Groups->getObject($this->_object, $siteuser_group_id);\n\n\t\t\t\t\t\t\t!is_null($oShop_Discount_Siteuser_Group)\n\t\t\t\t\t\t\t\t&& $oShop_Discount_Siteuser_Group->delete();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\tbreak;\n\t\t}\n\n\t\tCore_Event::notify(get_class($this) . '.onAfterRedeclaredApplyObjectProperty', $this, array($this->_Admin_Form_Controller));\n\n\t\treturn $this;\n\t}", "public function testSetGetDiscount()\n {\n $this->item->setPrice(85.00);\n $this->item->setQuantity(1);\n $this->item->addDiscount(\n (new FlatDiscount())\n ->setFigure(15.00)\n );\n\n $this->assertEquals($this->item->getPriceTotal(), 85.00);\n $this->assertEquals($this->item->getNetTotal(), 70.00);\n $this->assertEquals($this->item->getDiscount(), 15.00);\n }", "public function testDeclined(){ \n\n $unBuyableProduct = Product::where('price', '>', 75)\n ->where('quantity','>',10)\n ->first();\n\n //test card 1\n $response = $this->checkoutAction($unBuyableProduct, $this->testVisaPan);\n $response->assertSee(\"Declined\");\n\n\n //test card 2\n $response = $this->checkoutAction($unBuyableProduct, $this->testMasterCardPan);\n $response->assertSee(\"Declined\"); \n \n }", "function fuc_discount($product, $percentage){\r\n $discountValue = $product / 100 * $percentage;\r\n $totalValue = $product - $discountValue; \r\n return $totalValue;\r\n\r\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 testPOSTPromotionRules()\n {\n // TODO: implement\n $this->markTestIncomplete('Not implemented');\n }", "function applyDiscountOnSubscription($subscriptionId = null)\n {\n $db = new db();\n $db->makeConnection();\n\n if($subscriptionId != null)\n {\n \t\\Stripe\\Stripe::setApiKey(STRPIE_CLIENT_SECRET);\n\n $date = date('Y-m-d 00:00:00');\n $discountTotal = 0;\n\n // Select plan having trial periods on\n // $query = \"SELECT price FROM billing_products BP INNER JOIN user_subscription_items USI ON BP.plan_id = USI.plan_id WHERE BP.trial_period != 0 AND USI.subscription_id = '{$subscriptionId}' AND USI.coupon_trial_from <= '{$date}' AND USI.coupon_trial_to >= '{$date}'\";\n $query = \"SELECT price FROM billing_products BP INNER JOIN user_subscription_items USI ON BP.plan_id = USI.plan_id WHERE BP.trial_period != 0 AND USI.subscription_id = '{$subscriptionId}' AND USI.coupon_trial_from <= '{$date}' AND USI.coupon_trial_to > '{$date}' AND USI.status = '1'\";\n $res = $db->query($query);\n\n if($db->numRows($res))\n {\n while ($rs = mysqli_fetch_array($res))\n {\n $discountTotal += $rs['price'];\n }\n\n //\n if($discountTotal)\n {\n // Fetch if coupon exist, otherwise create\n $couponId = 'OFF-'.$discountTotal;\n\n try {\n // Retrieve coupon\n $coupon = \\Stripe\\Coupon::retrieve($couponId);\n } catch (\\Stripe\\Error\\Base $e) {\n // Create coupon\n $coupon = \\Stripe\\Coupon::create([\n 'id' => $couponId,\n 'amount_off' => ($discountTotal*100),\n 'currency' => 'SEK',\n 'duration' => 'once',\n // 'duration' => 'repeating',\n // 'duration_in_months' => 3,\n ]);\n }\n\n // Apply coupon on subscription\n if($coupon)\n {\n try {\n // Update subscription\n \\Stripe\\Subscription::update(\n $subscriptionId,\n ['coupon' => $coupon->id]\n );\n } catch (\\Stripe\\Error\\Base $e) {}\n }\n }\n else\n {\n \ttry {\n $sub = \\Stripe\\Subscription::retrieve($subscriptionId);\n\n if( isset($sub->discount) && ($sub->discount != null) )\n {\n $sub->deleteDiscount();\n }\n } catch (\\Stripe\\Error\\Base $e) {}\n }\n }\n else\n {\n \ttry {\n $sub = \\Stripe\\Subscription::retrieve($subscriptionId);\n\n if( isset($sub->discount) && ($sub->discount != null) )\n {\n $sub->deleteDiscount();\n }\n } catch (\\Stripe\\Error\\Base $e) {}\n }\n }\n }", "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 setNoMultiShipping(){\n $emptyCache = false;\n $db = JFactory::getDBO();\n if (JeproshopSettingModelSetting::getValue('allow_multi_shipping')){\n // Upgrading quantities\n $query = \"SELECT sum(\" . $db->quoteName('quantity') . \") AS quantity, product_id, product_attribute_id, count(*) as count FROM \";\n $query .= $db->quoteName('#__jeproshop_cart_product') . \" WHERE \" . $db->quoteName('cart_id') . \" = \" . (int)$this->cart_id . \" AND \" ;\n $query .= $db->quoteName('shop_id') . \" = \" . (int)$this->shop_id . \" GROUP BY product_id, product_attribute_id HAVING count > 1\";\n\n $db->setQuery($query);\n $products = $db->loadObjectList();\n\n foreach ($products as $product){\n $query = \"UPDATE \" . $db->quoteName('#__jeproshop_cart_product') . \" SET \" . $db->quoteName('quantity') . \" = \" . $product->quantity;\n $query .= \"\tWHERE \" . $db->quoteName('cart_id') . \" = \".(int)$this->cart_id . \" AND \" . $db->quoteName('shop_id') . \" = \" . (int)$this->shop_id ;\n $query .= \" AND product_id = \" . $product->product_id . \" AND product_attribute_id = \" . $product->product_attribute_id;\n $db->setQuery($query);\n if ($db->query())\n $emptyCache = true;\n }\n\n // Merging multiple lines\n $query = \"DELETE cart_product_1 FROM \" . $db->quoteName('#__jeproshop_cart_product') . \" AS cart_product_1 INNER JOIN \";\n $query .= $db->quoteName('#__jeproshop_cart_product') . \" AS cart_product_2 ON ((cart_product_1.cart_id = cart_product_2.\";\n $query .= \"cart_id) AND (cart_product_1.product_id = cart_product_2.product_id) AND (cart_product_1.product_attribute_id = \";\n $query .= \"cart_product_2.product_attribute_id) AND (cart_product_1.address_delivery_id <> cart_product_2.address_delivery_id) \";\n $query .= \" AND (cart_product_1.date_add > cart_product_2.date_add) )\";\n $db->setQuery($query);\n $db->query();\n }\n\n // Update delivery address for each product line\n $query = \"UPDATE \" . $db->quoteName('#__jeproshop_cart_product') . \" SET \" . $db->quoteName('address_delivery_id') . \" = ( SELECT \";\n $query .= $db->quoteName('address_delivery_id') . \" FROM \" . $db->quoteName('#__jeproshop_cart') . \" WHERE \" . $db->quoteName('cart_id');\n $query .= \" = \" . (int)$this->cart_id . \" AND \" . $db->quoteName('shop_id') . \" = \" . (int)$this->shop_id . \") WHERE \" . $db->quoteName('cart_id');\n $query .= \" = \" . (int)$this->cart_id . (JeproshopSettingModelSetting::getValue('allow_multi_shipping') ? \" AND \" . $db->quoteName('shop_id') . \" = \" .(int)$this->shop_id : \"\");\n\n $db->setQuery($query);\n\n $cache_id = 'jeproshop_cart_set_no_multi_shipping'.(int)$this->cart_id.'_'.(int)$this->shop_id .((isset($this->address_delivery_id) && $this->address_delivery_id) ? '-'.(int)$this->address_delivery_id : '');\n if (!JeproshopCache::isStored($cache_id)){\n $db->setQuery($query);\n if ($result = (bool)$db->query())\n $emptyCache = true;\n JeproshopCache::store($cache_id, $result);\n }\n\n if (JeproshopCustomization::isFeaturePublished()){\n //Db::getInstance()->execute(\n\t\t\t$query = \" UPDATE \" . $db->quoteName('#__jeproshop_customization') . \" SET \" . $db->quoteName('address_delivery_id') . \" = ( SELECT \";\n $query .= $db->quoteName('address_delivery_id') . \" FROM \" . $db->quoteName('#__jeproshop_cart') . \" WHERE \" . $db->quoteName('cart_id');\n $query .= \" = \" . (int)$this->cart_id . \" ) WHERE \" . $db->quoteName('cart_id') . \" = \" .(int)$this->cart_id;\n\n $db->setQuery($query);\n $db->query();\n }\n if ($emptyCache){\n $this->_products = null;\n }\n }", "public function setDiscountAmount($amount);", "function getDiscountFor($product) {\n\t\treturn 30;\n\t}", "public function continue_checkout($Recipt,$ShoppingCart,$discount)\n {\n $Recipt->update([\n 'is_init_for_card_payment' => null\n ]);\n\n Recipt::where('member_id',$Recipt->member_id)->where('is_init_for_card_payment','1')->delete();\n\n $ReciptProducts = [];\n //--for create Recipt Products--\n foreach ($ShoppingCart as $key => $Cart)\n {\n $this_product = Product::find($Cart->product_id);\n if( $this_product->quantity > 0 || !$this_product)\n {\n //check if selected quantity is not bigger than the stock quantity\n $required_quantity = ($Cart->quantity < $this_product->quantity) ? $Cart->quantity : $this_product->quantity;\n $produ = null;\n $produ = [\n 'recipt_id' => $Recipt->id,\n 'quantity' => $required_quantity ,\n 'product_name_en' => $this_product->name_en ,\n 'product_name_ar' => $this_product->name_ar,\n 'product_id' => $this_product->id ,\n 'cheese_type' => $Cart->cheese_type,\n 'cheese_weight' => $Cart->cheese_weight,\n 'bundle_products_ids' => $this_product->bundle_products_ids,\n 'single_price' => $this_product->price,\n 'total_price' => $this_product->price * $Cart->quantity\n ];\n array_push($ReciptProducts, $produ);\n\n //---decrease the quantity from the product---\n $this_product->update([\n 'quantity' => $this_product->quantity - $required_quantity\n ]);\n }//End if\n }//End foreach\n ReciptProducts::insert($ReciptProducts);\n ShoppingCart::where( 'member_id',$Recipt->member_id )->delete();\n if($discount)\n {\n $myPromo = MemberPromo::where( 'member_id',$Recipt->member_id )->where('is_used',0)->first();\n $myPromo->update([\n 'is_used' => 1,\n 'used_date' => \\Carbon\\Carbon::now()\n ]);\n }\n\n $member = \\App\\Member::find($Recipt->member_id);\n\n $member->update([\n // 'reward_points' => ( $member->reward_points + ceil($Recipt->total_price / 20) ) - $Recipt->points_deduction_price\n 'reward_points' => $member->reward_points - $Recipt->points_deduction_price\n ]);\n\n if($Recipt->payment_method == 'creadit_card')\n {\n $Recipt->update([\n 'payment_method' => 'creadit_card' ,\n 'is_piad' => 1 ,\n ]);\n\n try {\n \\Mail::to($member->email)\n ->send(new \\App\\Mail\\ConfirmOrder($Recipt,$member));\n } catch (\\Exception $e) {\n\n }\n }\n else {\n try {\n \\Mail::to($member->email)\n ->send(new \\App\\Mail\\ConfirmOrder($Recipt,$member));\n }catch (\\Exception $e) {\n\n }\n }\n return response()->json([\n 'status' => 'success',\n 'status_message' => __('page.Thank you for purchasing from us'),\n ]);\n }", "public function define_dish_price() {\n\t\t\t$res = $this->Restaurant_model->define_price();\n\t\t\tif($res == 'suc_def') {\n\t\t\t\techo 'suc_def';\n\t\t\t}\n\t\t}", "private function calculate_discount(\r\n\t\t$discount_value = 0, $taxable_value_ex_tax = 0, $non_taxable_value = 0, $tax_value = 0, $tax_rate = FALSE, $calculation_method = FALSE, $discount_tax_method = FALSE)\r\n\t{\r\n\t\t// Check sufficient discount data has been submitted.\r\n\t\tif (($calculation_method != 3 && $discount_value <= 0) || ($taxable_value_ex_tax == 0 && $non_taxable_value == 0) || ($taxable_value_ex_tax > 0 && $tax_value == 0))\r\n\t\t{\r\n\t\t\treturn FALSE;\r\n\t\t}\r\n\r\n\t\t// Set default calculation and tax application methods if not set.\r\n\t\t// By default, the discount calculation method is a percentage discount.\r\n\t\tif (! in_array($calculation_method, array(1,2,3)))\r\n\t\t{\r\n\t\t\t$calculation_method = 1;\r\n\t\t}\r\n\t\t\r\n\t\t// Check if a discount method has been set, else, use the carts default tax setting to apply tax to the discount in the same way it is applied to item pricing.\r\n\t\tif (! in_array($discount_tax_method, array(1,2,3)))\r\n\t\t{\r\n\t\t\t$discount_tax_method = ($this->flexi_cart->cart_prices_inc_tax()) ? 1 : 2;\r\n\t\t}\r\n\t\t\r\n\t\t// Start discount calculations.\r\n\t\t// Calculate the current 'to-be-discounted' total.\r\n\t\t$current_total = ($discount_tax_method == 1) ? ($taxable_value_ex_tax + $non_taxable_value + $tax_value) : ($taxable_value_ex_tax + $non_taxable_value);\t\t\t\r\n\t\t\r\n\t\t// Calculate the discounted total in accordance to the specified discount method.\r\n\t\tif ($calculation_method == 1)\r\n\t\t{\r\n\t\t\t$discounted_total = $this->format_calculation($current_total - ($current_total * ($discount_value / 100)));\r\n\t\t}\r\n\t\telse if ($calculation_method == 2)\r\n\t\t{\r\n\t\t\t$discounted_total = $this->format_calculation($current_total - $discount_value);\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t$discounted_total = $this->format_calculation($discount_value);\r\n\t\t}\r\n\t\t\r\n\t\t// Check if the new discounted total is more the zero.\r\n\t\tif ($discounted_total > 0)\r\n\t\t{\r\n\t\t\t// Calculate value discount factor that can then be used to calculate the newly discounted taxed and non-taxed applicable values.\r\n\t\t\t$value_discount_factor = ($current_total / $discounted_total);\r\n\t\t\t$taxable_value_ex_tax = ($taxable_value_ex_tax / $value_discount_factor);\r\n\t\t\t$non_taxable_value = ($non_taxable_value / $value_discount_factor);\r\n\t\t\t\r\n\t\t\tif ($tax_value > 0 && $discount_tax_method != 3)\r\n\t\t\t{\r\n\t\t\t\t$tax_value = ($tax_value / $value_discount_factor);\r\n\t\t\t}\r\n\t\t}\r\n\t\t// Else, a 'New Value' discount may be set with the item value as zero (Or free).\r\n\t\telse \r\n\t\t{\r\n\t\t\t$taxable_value_ex_tax = $non_taxable_value = 0;\r\n\t\t\t$tax_value = ($tax_value > 0 && $discount_tax_method == 3) ? ($tax_value) : 0;\r\n\t\t}\r\n\t\t\t\t\r\n\t\t// Calculate discounted total and return total value either ex/including tax depending on the carts tax inclusion setting.\r\n\t\t$item_total = ($taxable_value_ex_tax + $non_taxable_value);\r\n\t\t$total = ($this->flexi_cart->cart_prices_inc_tax()) ? ($item_total + $tax_value) : $item_total;\r\n\r\n\t\t// Set and format return values.\r\n\t\t$discount['tax_method'] = $discount_tax_method;\r\n\t\t$discount['taxable_value'] = $this->format_calculation($taxable_value_ex_tax, 4);\r\n\t\t$discount['non_taxable_value'] = $this->format_calculation($non_taxable_value, 4);\r\n\t\t$discount['tax_value'] = $this->format_calculation($tax_value, 4);\r\n\t\t$discount['total'] = $this->format_calculation($total);\r\n\t\t\r\n\t\treturn $discount;\r\n\t}", "function get_discounted_price( $values, $price, $add_totals = false ) {\n\t\n\t\t\tif ($this->applied_coupons) foreach ($this->applied_coupons as $code) :\n\t\t\t\t$coupon = new cmdeals_coupon( $code );\n\t\t\t\t\n\t\t\t\tif ( $coupon->apply_before_tax() && $coupon->is_valid() ) :\n\t\t\t\t\t\n\t\t\t\t\tswitch ($coupon->type) :\n\t\t\t\t\t\n\t\t\t\t\t\tcase \"fixed_deals\" :\n\t\t\t\t\t\tcase \"percent_deals\" :\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t$this_item_is_discounted = false;\n\t\t\t\t\n\t\t\t\t\t\t\t// Specific deals ID's get the discount\n\t\t\t\t\t\t\tif (sizeof($coupon->deal_ids)>0) :\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tif ((in_array($values['deal_id'], $coupon->deal_ids) || in_array($values['variation_id'], $coupon->deal_ids))) :\n\t\t\t\t\t\t\t\t\t$this_item_is_discounted = true;\n\t\t\t\t\t\t\t\tendif;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\telse :\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t// No deals ids - all items discounted\n\t\t\t\t\t\t\t\t$this_item_is_discounted = true;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tendif;\n\t\t\t\t\n\t\t\t\t\t\t\t// Specific deals ID's excluded from the discount\n\t\t\t\t\t\t\tif (sizeof($coupon->exclude_deals_ids)>0) :\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tif ((in_array($values['deal_id'], $coupon->exclude_deals_ids) || in_array($values['variation_id'], $coupon->exclude_deals_ids))) :\n\t\t\t\t\t\t\t\t\t$this_item_is_discounted = false;\n\t\t\t\t\t\t\t\tendif;\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tendif;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Apply filter\n\t\t\t\t\t\t\t$this_item_is_discounted = apply_filters( 'cmdeals_item_is_discounted', $this_item_is_discounted, $values, $before_tax = true );\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Apply the discount\n\t\t\t\t\t\t\tif ($this_item_is_discounted) :\n\t\t\t\t\t\t\t\tif ($coupon->type=='fixed_deals') :\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tif ($price < $coupon->amount) :\n\t\t\t\t\t\t\t\t\t\t$discount_amount = $price;\n\t\t\t\t\t\t\t\t\telse :\n\t\t\t\t\t\t\t\t\t\t$discount_amount = $coupon->amount;\n\t\t\t\t\t\t\t\t\tendif;\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t$price = $price - $coupon->amount;\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tif ($price<0) $price = 0;\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tif ($add_totals) :\n\t\t\t\t\t\t\t\t\t\t$this->discount_cart = $this->discount_cart + ( $discount_amount * $values['quantity'] );\n\t\t\t\t\t\t\t\t\tendif;\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\telseif ($coupon->type=='percent_deals') :\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t$percent_discount = ( $values['data']->get_price( false ) / 100 ) * $coupon->amount;\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tif ($add_totals) $this->discount_cart = $this->discount_cart + ( $percent_discount * $values['quantity'] );\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t$price = $price - $percent_discount;\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tendif;\n\t\t\t\t\t\t\tendif;\n\t\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\n\t\t\t\t\t\tcase \"fixed_cart\" :\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t/** \n\t\t\t\t\t\t\t * This is the most complex discount - we need to divide the discount between rows based on their price in\n\t\t\t\t\t\t\t * proportion to the subtotal. This is so rows with different tax rates get a fair discount, and so rows\n\t\t\t\t\t\t\t * with no price (free) don't get discount too.\n\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Get item discount by dividing item cost by subtotal to get a %\n\t\t\t\t\t\t\t$discount_percent = ($values['data']->get_price( false )*$values['quantity']) / $this->subtotal_ex_tax;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Use pence to help prevent rounding errors\n\t\t\t\t\t\t\t$coupon_amount_pence = $coupon->amount * 100;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Work out the discount for the row\n\t\t\t\t\t\t\t$item_discount = $coupon_amount_pence * $discount_percent;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Work out discount per item\n\t\t\t\t\t\t\t$item_discount = $item_discount / $values['quantity'];\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Pence\n\t\t\t\t\t\t\t$price = ( $price * 100 );\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Check if discount is more than price\n\t\t\t\t\t\t\tif ($price < $item_discount) :\n\t\t\t\t\t\t\t\t$discount_amount = $price;\n\t\t\t\t\t\t\telse :\n\t\t\t\t\t\t\t\t$discount_amount = $item_discount;\n\t\t\t\t\t\t\tendif;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Take discount off of price (in pence)\n\t\t\t\t\t\t\t$price = $price - $discount_amount;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Back to pounds\n\t\t\t\t\t\t\t$price = $price / 100; \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Cannot be below 0\n\t\t\t\t\t\t\tif ($price<0) $price = 0;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Add coupon to discount total (once, since this is a fixed cart discount and we don't want rounding issues)\n\t\t\t\t\t\t\tif ($add_totals) $this->discount_cart = $this->discount_cart + (($discount_amount*$values['quantity']) / 100);\n\t\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\n\t\t\t\t\t\tcase \"percent\" :\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Get % off each item - this works out the same as doing the whole cart\n\t\t\t\t\t\t\t//$percent_discount = ( $values['data']->get_price( false ) / 100 ) * $coupon->amount;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t$percent_discount = ( $values['data']->get_price( ) / 100 ) * $coupon->amount;\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tif ($add_totals) $this->discount_cart = $this->discount_cart + ( $percent_discount * $values['quantity'] );\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t$price = $price - $percent_discount;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\n\t\t\t\t\tendswitch;\n\t\t\t\t\t\n\t\t\t\tendif;\n\t\t\tendforeach;\n\t\t\t\n\t\t\treturn apply_filters( 'cmdeals_get_discounted_price_', $price, $values, $this );\n\t\t}", "public function magicMethod(){\n $cart = $this->_getCart();\n $quoteArrayFreeProducts = array();\n $quoteArrayNonFreeProducts = array();\n $AddThisInCart = array();\n $finalAdd = array();\n\n // finding both free and non free products and saving them in array\n $quote = Mage::getSingleton('checkout/session')->getQuote();\n foreach($quote->getAllVisibleItems() as $item) {\n if($item->getData('price') == 0){\n $quoteArrayFreeProducts['item_id'][] = $item->getData('product_id');\n $quoteArrayFreeProducts['qty'][] = $item->getData('qty');\n }else{\n $quoteArrayNonFreeProducts['item_id'][] = $item->getData('product_id');\n $quoteArrayNonFreeProducts['qty'][] = $item->getData('qty');\n }\n }\n \n // print_r($quoteArrayFreeProducts);die;\n // finding free associatied produts and adding them in another array\n for($i = 0; $i < count($quoteArrayNonFreeProducts['item_id']) ;$i++){\n $product = Mage::getModel('catalog/product')->load($quoteArrayNonFreeProducts['item_id'][$i]);\n // print_r($product->getAttributeText('buyxgety'));die;\n if($product->getAttributeText('buyxgety') == 'Enable'){\n $Buyxgety_xqty = $product->getBuyxgety_xqty();\n $Buyxgety_ysku = $product->getBuyxgety_ysku();\n $Buyxgety_yqty = $product->getBuyxgety_yqty();\n\n // $Buyxgety_ydiscount = $product->getBuyxgety_ydiscount();\n if(!empty($Buyxgety_xqty) && !empty($Buyxgety_ysku) && !empty($Buyxgety_yqty) ){\n // die($Buyxgety_ysku);\n $AddThisInCart['item_id'][] = Mage::getModel('catalog/product')->getIdBySku($Buyxgety_ysku);\n $AddThisInCart['qty'][] = (int)($quoteArrayNonFreeProducts['qty'][$i]/$Buyxgety_xqty)*$Buyxgety_yqty;\n }\n }\n }\n for($i = 0; $i < count($AddThisInCart['item_id']) ;$i++){\n if(isset($quoteArrayFreeProducts['item_id'])){\n for($j = 0; $j < count($quoteArrayFreeProducts['item_id']) ;$j++){\n if($AddThisInCart['item_id'][$i] == $quoteArrayFreeProducts['item_id'][$j]){\n $finalAdd['item_id'][] = $AddThisInCart['item_id'][$i];\n $finalAdd['qty'][] = $AddThisInCart['qty'][$i] - $quoteArrayFreeProducts['qty'][$j];\n }else{\n $finalAdd['item_id'][] = $AddThisInCart['item_id'][$i];\n $finalAdd['qty'][] = $AddThisInCart['qty'][$i];\n }\n }\n }else{\n $finalAdd['item_id'][] = $AddThisInCart['item_id'][$i];\n $finalAdd['qty'][] = $AddThisInCart['qty'][$i];\n }\n }\n\n for($i = 0; $i < count($finalAdd['item_id']) ;$i++){\n for($j = 0; $j < count($quoteArrayNonFreeProducts['item_id']); $j++){\n if($finalAdd['item_id'][$i] == $quoteArrayNonFreeProducts['item_id'][$j]){\n foreach ($quoteArrayFreeProducts['item_id'] as $value) {\n if($value == $finalAdd['item_id'][$i]){\n $flag = 1;\n }else{\n $flag = 0;\n }\n }\n if($flag == 1){\n $finalAdd['new_row'][] = 0;\n }else{\n $finalAdd['new_row'][] = 1;\n }\n }\n }\n if(!empty($quoteArrayFreeProducts['item_id'])){\n for($j = 0; $j < count($quoteArrayFreeProducts['item_id']); $j++){\n if($finalAdd['item_id'][$i] == $quoteArrayFreeProducts['item_id'][$j]){\n $finalAdd['new_row'][] = 0;\n }else{\n $finalAdd['new_row'][] = 1;\n }\n }\n }else{\n $finalAdd['new_row'][] = 1;\n } \n }\n\n // print_r($finalAdd);die;\n\n if(isset($finalAdd['item_id'])){\n for($i = 0; $i < count($finalAdd['item_id']) ;$i++){\n if($finalAdd['qty'][$i] > 0){\n Mage::getSingleton('core/session')->setMultilineAddingObserver($finalAdd['new_row'][$i]);\n Mage::getSingleton('core/session')->setZeroSettingObserver(1);\n if($finalAdd['new_row'][$i] == 0){\n $cartHelper = Mage::helper('checkout/cart');\n $items = $cartHelper->getCart()->getItems(); \n foreach ($items as $item) \n {\n $itemId = $item->getItemId();\n if($item->getProductId() == $finalAdd['item_id'][$i] && $item->getPrice() == 0){\n $cartHelper->getCart()->removeItem($itemId)->save();\n $this->magicMethod();\n }\n }\n }else{\n $productToAdd = $product->load($finalAdd['item_id'][$i]);\n $params['qty'] = $finalAdd['qty'][$i];\n $params['product'] = $finalAdd['item_id'][$i];\n $cart->addProduct($productToAdd, $params);\n $cart->save();\n }\n }else if($finalAdd['qty'][$i] < 0){\n $cartHelper = Mage::helper('checkout/cart');\n $items = $cartHelper->getCart()->getItems(); \n foreach ($items as $item) \n {\n $itemId = $item->getItemId();\n if($item->getProductId() == $finalAdd['item_id'][$i] && $item->getPrice() == 0){\n $cartHelper->getCart()->removeItem($itemId)->save();\n $this->_updateShoppingCart();\n }\n } \n }\n }\n }\n }", "public function getBaseDiscountCanceled();", "public function get_non_group_discounts()\r\n\t{\r\n\t\t// Check the discount tables exist in the config file and are enabled.\r\n\t\tif ($this->get_enabled_status('discounts'))\r\n\t\t{\r\n\t\t\t// Set aliases of discount table data.\r\n\t\t\t$tbl_cols_discounts = $this->flexi->cart_database['discounts']['columns'];\r\n\t\t\t$tbl_cols_discount_columns = $this->flexi->cart_database['discount_columns']['columns'];\r\n\r\n\t\t\t$sql_select = array(\r\n\t\t\t\t$tbl_cols_discounts['item'].' AS item_id'\r\n\t\t\t);\r\n\t\t\t\t\r\n\t\t\t// Get all summary discounts.\r\n\t\t\t// Lookup item id from item data array and add to SQL WHERE string.\r\n\t\t\t$sql_where = \" AND \".$tbl_cols_discounts['group'].\" = '0' AND ((\"\r\n\t\t\t\t.$tbl_cols_discount_columns['id'].\" IN (3,4,5) AND \".$tbl_cols_discounts['code'].\" = '') OR (\"; \r\n\t\t\tforeach($this->flexi->cart_contents['items'] as $item)\r\n\t\t\t{\r\n\t\t\t\t$sql_where .= $tbl_cols_discounts['item'].\" = '\".$item[$this->flexi->cart_columns['item_id']].\"' OR \";\r\n\t\t\t}\r\n\t\t\t$sql_where = rtrim($sql_where,' OR ').\")\";\r\n\t\t\t\r\n\t\t\t// Lookup discounts matching submitted discount codes and add to SQL WHERE string.\r\n\t\t\tif (! empty($this->flexi->cart_contents['settings']['discounts']['codes']))\r\n\t\t\t{\r\n\t\t\t\t$sql_where .= \" OR (\";\r\n\t\t\t\tforeach($this->flexi->cart_contents['settings']['discounts']['codes'] as $code => $discount_data)\r\n\t\t\t\t{\r\n\t\t\t\t\t$sql_where .= $tbl_cols_discounts['code'].\" = \".$this->db->escape($code).\" OR \"; \r\n\t\t\t\t}\r\n\t\t\t\t$sql_where = rtrim($sql_where,' OR ').\")\";\r\n\t\t\t}\r\n\t\t\t$sql_where .= \")\";\r\n\t\t\t\r\n\t\t\tif ($item_discount_data = $this->get_database_discount_data($sql_select, $sql_where, 'non_group_discounts'))\r\n\t\t\t{\r\n\t\t\t\treturn $this->sort_discount_data($item_discount_data);\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\treturn FALSE;\r\n\t}", "public function testSetNotForPaymentDisabledFields()\n {\n $this->slipData->setWithReferenceNumber(false);\n $this->slipData->setWithBankingCustomerId(false);\n\n $this->slipData->setNotForPayment(true);\n }", "public function updateProductAdvance(Request $request){\n $productId = $request->productId;\n if (isset($productId)) {\n $product = Product::find($productId);\n $proSection = ProductSections::where('productId',$productId)->first();\n\n if ($request->section) {\n $section = implode(',', $request->section);\n $product->update( [\n 'productSection' => @$section,\n \n ]);\n }\n\n if (@$proSection->productId) {\n $productSection = ProductSections::find($proSection->id);\n\n if ($request->related_product) {\n $allproduct = implode(',', $request->related_product);\n $productSection->update( [\n 'related_product' => $allproduct,\n ]);\n }\n\n if ($request->customerGroupId != '') {\n $customerGroupId = implode(',', @$request->customerGroupId); \n }\n $productSection->update( [\n 'free_shipping' => $request->free_shipping,\n 'pre_order' => $request->pre_order,\n 'pre_orderDuration' => $request->pre_orderDuration, \n 'customerGroupId' => @$customerGroupId, \n 'customerGroupPrice' => @$request->customerGroupPrice, \n ]);\n \n if ($request->hotDeal && $request->hotDiscount && $request->hotDate) {\n $productSection->update( [\n 'hotDiscount' => $request->hotDiscount,\n 'hotDate' => $request->hotDate,\n /* 'specialDiscount' => '',\n 'specialDate' => '',*/\n ]);\n }else{\n $productSection->update( [\n 'hotDiscount' => '',\n 'hotDate' => '',\n \n ]);\n }\n\n if ($request->specialDeal && $request->specialDiscount && $request->specialDate) {\n $productSection->update( [\n /* 'hotDiscount' => '',\n 'hotDate' => '',*/\n 'specialDiscount' => $request->specialDiscount,\n 'specialDate' => $request->specialDate,\n\n ]);\n\n }else{\n $productSection->update( [\n 'specialDiscount' => '',\n 'specialDate' => '',\n\n ]);\n }\n\n $countGroup = count($request->customerGroupPrice);\n DB::table('customer_group_sections')->where('productId', $productId)->delete();\n if($request->customerGroupPrice){\n $postData = [];\n for ($i=0; $i <$countGroup ; $i++) { \n $postData[] = [\n 'productId' => $productId,\n 'customerGroupId' => $request->customerGroupId[$i], \n 'customerGroupPrice' => $request->customerGroupPrice[$i]\n ];\n }\n \n CustomerGroupSections::insert($postData);\n }\n\n return redirect(route('product.edit',$productId))->with('msg','Advance Information Save Successfully')->withInput();\n }else{\n if ($request->related_product) {\n $allproduct = implode(',', $request->related_product);\n }\n $productSections = ProductSections::create( [\n 'productId' => $productId,\n 'hotDiscount' => $request->hotDiscount,\n 'hotDate' => $request->hotDate,\n 'specialDiscount' => $request->specialDiscount,\n 'specialDate' => $request->specialDate,\n 'related_product' => @$allproduct,\n ]);\n \n return redirect(route('product.edit',$productId))->with('msg','Advance Information Save Successfully')->withInput();\n }\n }else{\n return redirect(route('product.edit',$productId))->with('error_msg','Please Complete Basic Information ')->withInput(); \n } \n }", "function woocommerce_rrp_add_bulk_admin_notices() {\n\t\t\tglobal $post_type, $pagenow;\n\t\t\t\n\t\t\tif($pagenow == 'edit.php' && $post_type == 'product' && isset($_REQUEST['price_setted_to_rrp']) && (int) $_REQUEST['price_setted_to_rrp']) {\n\t\t\t\t$message = sprintf( _n( 'Product price setted to RRP.', '%s product prices setted to RRP.', $_REQUEST['price_setted_to_rrp'] ), number_format_i18n( $_REQUEST['price_setted_to_rrp'] ) );\n\t\t\t\techo \"<div class=\\\"updated\\\"><p>{$message}</p></div>\";\n\t\t\t}\n\t\t}", "public function setDiscountCanceled($discountCanceled);", "public function testInvalidDiscount() {\n\n // create new discount and set end time to now - 10 minutes, so it's not valid\n $discount = $this->createNewCustomerDiscount(array('type' => 1, 'end' => date('Y-m-d H:i:s', strtotime('-10 minutes'))));\n $this->bootstrap();\n\n $request = $this->getRequest();\n $this->dispatch($discount->getReferer());\n $this->assertController('discount');\n $this->assertAction('index');\n\n //test redirection, so no action shall be done on the discount page\n $this->assertResponseCode(302);\n\n $htmlBody = $this->getResponse()->getBody();\n\n //must not be on the discount page\n $this->assertEquals(strpos($htmlBody, 'name=\"referer\" value=\"' . $discount->getReferer() . '\"'), false);\n }", "public function setDiscountDescription($description);", "public function setDiscounted($s)\n\t{\n\t\t$this->discounted = (bool) $s;\n\n\t\treturn $this;\n\t}", "protected function calculatePrices()\n {\n }", "public static function getAllDenyRules($product, $sku_id = 0)\n {\n // Если требуется показать все правила скидок, невзирая на условия\n if ($product === null || !$product) {\n $product = self::getAbstractProduct();\n $sku_id = 0;\n }\n\n $instance = get_class();\n\n // Получаем товар\n if (is_int($product)) {\n $product = new shopProduct($product);\n }\n $product = ($product instanceof shopProduct) ? $product->getData() : $product;\n if (!$product) {\n return array();\n }\n\n // Правила скидок\n $discount_groups = shopFlexdiscountHelper::getDiscounts();\n if (!$discount_groups) {\n return array();\n }\n\n $product = self::prepareProduct($product, $sku_id);\n $sku_id = $product['sku_id'];\n\n // Добавляем товар к заказу\n $order_params = (new shopFlexdiscountWorkflow())->addToOrder($product);\n\n self::$user = $order_params['contact'];\n self::setOrderInfo($order_params['order']);\n\n $items = $order_params['order']['items'];\n // Выполняем предварительную обработку товаров\n shopFlexdiscountHelper::workupProducts($items);\n self::getAllItems($items);\n\n $deny_rules = array();\n // Фильтруем правила запрета\n foreach ($discount_groups as $group_id => $group) {\n $rules = $group_id === 0 ? $group : $group['items'];\n foreach ($rules as $rule) {\n if ($rule['deny'] && $rule['status']) {\n // Условия\n $conditions = self::decode($rule['conditions']);\n\n // Товары, удовлетворяющие условиям\n $result_items = $conditions ? self::filter_items($items, $conditions->group_op, $conditions->conditions) : $items;\n if ($result_items) {\n $target = self::decode($rule['target']);\n foreach ($target as $t) {\n $function_name = 'avail_target_' . $t->target;\n if (method_exists($instance, $function_name)) {\n // Товары, на которые скидка не распространяется\n $deny_items = self::$function_name($result_items, $items, $t, $rule, $sku_id);\n if ($deny_items || !$sku_id) {\n $deny_rules[$rule['id']] = $rule;\n }\n }\n }\n }\n }\n }\n }\n return $deny_rules;\n }", "function is_filter_discount( $conds )\n\t{\n\t\treturn ( isset( $conds['is_discount'] ) && $conds['is_discount'] == 1 );\n\t}", "function getDiscount($type, $userid,$formid, $table_prefix = '')\n{\n if (!is_numeric($userid)) die(\"getDiscountPercentage: userid must be numeric.\");\n if (!is_numeric($formid)) die(\"getDiscountPercentage: formid must be numeric.\");\n if ($type != 'discount' && $type != 'freight' && $type != 'markup' && $type != 'tier') die(\"getDiscountPercentage: type must be discount, markup, tier or freight.\");\n\n // First Check if User has something special\n $disc = loadDiscount($type,array(\"form_id\" => $formid,\"user_id\"=>$userid),\"user\");\n if ($disc)\n return $disc;\n if ($type != 'markup' && $type != 'tier') {\n // Then Check Overall Form Discount\n $disc = loadDiscount($type,array(\"form_id\" => $formid),$table_prefix.\"form\");\n if ($disc)\n return $disc;\n // Last Resort Check Vendor Discount\n $sql = \"SELECT vendor FROM forms WHERE ID = $formid\";\n $query = mysql_query($sql);\n checkDBError($sql);\n if ($result = mysql_fetch_array($query)) {\n return loadDiscount($type,array(\"vendor_id\" => $result['vendor']),\"vendor\");\n }\n }\n // Nothing else, Discount must be 0\n return 0;\n}", "public function applyProductCategoryWholesaleDiscount( $wholesalePrice , $productID , $userWholesaleRole ) {\n\n if ( empty( $wholesalePrice ) && !empty( $userWholesaleRole ) ) {\n\n $product = wc_get_product( $productID );\n $product_price = get_option( 'wwpp_settings_explicitly_use_product_regular_price_on_discount_calc' ) == 'yes' ? $product->get_regular_price() : $product->get_price();\n $post_id = ( WWP_Helper_Functions::wwp_get_product_type( $product ) === 'variation' ) ? WWP_Helper_Functions::wwp_get_parent_variable_id( $product ) : $productID;\n\n if ( !is_null( $post_id ) ) {\n\n $terms = get_the_terms( $post_id , 'product_cat' );\n if ( !is_array( $terms ) )\n $terms = array();\n\n $lowest_discount = null;\n $highest_discount = null;\n\n foreach ( $terms as $term ) {\n\n $category_wholesale_prices = get_option( 'taxonomy_' . $term->term_id );\n\n if ( is_array( $category_wholesale_prices ) && array_key_exists( $userWholesaleRole[ 0 ] . '_wholesale_discount' , $category_wholesale_prices ) ) {\n\n $curr_discount = $category_wholesale_prices[ $userWholesaleRole[ 0 ] . '_wholesale_discount' ];\n\n if ( !empty( $curr_discount ) ) {\n\n if ( is_null( $lowest_discount ) || $curr_discount < $lowest_discount )\n $lowest_discount = $curr_discount;\n\n if ( is_null( $highest_discount ) || $curr_discount > $highest_discount )\n $highest_discount = $curr_discount;\n\n }\n\n }\n\n }\n\n $category_wholsale_price_logic = get_option( 'wwpp_settings_multiple_category_wholesale_discount_logic' );\n\n if ( $category_wholsale_price_logic == 'highest' ) {\n\n if ( !is_null( $highest_discount ) )\n $wholesalePrice = round( $product_price - ( $product_price * ( $highest_discount / 100 ) ) , 2 );\n\n } else {\n\n if ( !is_null( $lowest_discount ) )\n $wholesalePrice = round( $product_price - ( $product_price * ( $lowest_discount / 100 ) ) , 2 );\n\n }\n\n if ( $wholesalePrice < 0 )\n $wholesalePrice = 0;\n\n }\n\n }\n\n return $wholesalePrice;\n\n }", "public function unset_session_discount($discount_data = FALSE)\r\n\t{\r\n\t\t// Loop through submitted discount data and remove each one.\r\n\t\tif ($discount_data !== FALSE)\r\n\t\t{\r\n\t\t\tforeach((array)$discount_data as $identifier)\r\n\t\t\t{\r\n\t\t\t\t// Ensure the discount is removed from any 'admin data' discounts that are present.\r\n\t\t\t\tunset($this->flexi->cart_contents['settings']['admin_data']['discounts']['active'][$identifier]);\r\n\r\n\t\t\t\t// Loop through all set discount codes and try to match either the code or the id.\r\n\t\t\t\tforeach($this->flexi->cart_contents['settings']['discounts']['codes'] as $code => $discount)\r\n\t\t\t\t{\r\n\t\t\t\t\tif ($identifier == $code || $identifier == $discount['id'])\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tunset($this->flexi->cart_contents['settings']['discounts']['codes'][$code]);\r\n\t\t\t\t\t\tunset($identifier);\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// Check if a manual discount exists with the same id.\r\n\t\t\t\tif (isset($identifier))\r\n\t\t\t\t{\r\n\t\t\t\t\tforeach($this->flexi->cart_contents['settings']['discounts']['manual'] as $column => $discount)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tif ($identifier == $discount['id'])\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tunset($this->flexi->cart_contents['settings']['discounts']['manual'][$column]);\r\n\t\t\t\t\t\t\tunset($identifier);\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// Check if a reward voucher exists with the same id.\r\n\t\t\t\tif (isset($identifier))\r\n\t\t\t\t{\r\n\t\t\t\t\tforeach($this->flexi->cart_contents['settings']['discounts']['reward_vouchers'] as $id => $voucher)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tif ($identifier == $id || $identifier == $voucher['id'])\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tunset($this->flexi->cart_contents['settings']['discounts']['reward_vouchers'][$id]);\r\n\t\t\t\t\t\t\tunset($identifier);\r\n\t\t\t\t\t\t\tbreak;\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\t\r\n\t\t\t\t// If no discount has been found, its assumed its an 'auto' discount that is automatically applied when a value in the cart exceeds \r\n\t\t\t\t// the required quantity and value needed to activate a database discount.\r\n\t\t\t\tif (isset($identifier) && ! in_array($identifier, $this->flexi->cart_contents['settings']['discounts']['data']['excluded_discounts']))\r\n\t\t\t\t{\r\n\t\t\t\t\t$this->flexi->cart_contents['settings']['discounts']['data']['excluded_discounts'][$identifier] = $identifier;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\t// Remove all discount codes, manual discounts and reward vouchers if nothing is submitted.\r\n\t\telse\r\n\t\t{\r\n\t\t\t$this->flexi->cart_contents['settings']['discounts']['codes'] = array();\r\n\t\t\t$this->flexi->cart_contents['settings']['discounts']['manual'] = array();\r\n\t\t\t$this->flexi->cart_contents['settings']['discounts']['reward_vouchers'] = array();\r\n\t\t\t\r\n\t\t\t// Reset 'admin data' discounts if they are set.\r\n\t\t\tif (isset($this->flexi->cart_contents['settings']['admin_data']['discounts']['active']))\r\n\t\t\t{\r\n\t\t\t\t$this->flexi->cart_contents['settings']['admin_data']['discounts']['active'] = array();\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn TRUE;\r\n\t}", "public function getDiscountRefunded();", "public function testInvalidFurPrice(){\n\t\t\t$furVars =[\n\t\t\t\t'name' => 'White Dresser',\n\t\t\t\t'description' => 'Nice Dresser',\n\t\t\t\t'price' => '',\n\t\t\t\t'categoryId' => '5',\n\t\t\t\t'fur_condition' => 'NEW'\n\t\t\t];\n\t\t\t$properTest = saveFuncFurniture($furVars);\n\t\t\t$this->assertFalse($properTest);\n\t\t}", "private function sort_discount_data($discount_data = FALSE)\r\n\t{\r\n\t\t// Check the discount tables exist in the config file and are enabled.\r\n\t\tif ($this->get_enabled_status('discounts') && ! empty($discount_data))\r\n\t\t{\t\t\t\r\n\t\t\t$sorted_data = FALSE;\r\n\t\t\t\r\n\t\t\t// Get miscellaneous status settings.\r\n\t\t\t$custom_status_1 = $this->flexi_cart->custom_status_1();\r\n\t\t\t$custom_status_2 = $this->flexi_cart->custom_status_2();\r\n\t\t\t$custom_status_3 = $this->flexi_cart->custom_status_3();\r\n\t\t\t\r\n\t\t\t// Loop through query rows and separate discount data from discounted item ids.\t\t\t\r\n\t\t\tforeach($discount_data as $row_data)\r\n\t\t\t{\r\n\t\t\t\t// Check discount is applicable to the current miscellaneous status settings, else do not include the discount.\r\n\t\t\t\t/*\r\n\t\t\t\tif (($row_data['custom_status_1'] == 1 && ! $custom_status_1) || ($row_data['custom_status_2'] == 1 && ! $custom_status_2) \r\n\t\t\t\t\t|| ($row_data['custom_status_3'] == 1 && ! $custom_status_3))\r\n\t\t\t\t{\r\n\t\t\t\t\tcontinue;\r\n\t\t\t\t}\r\n\t\t\t\t*/\r\n\t\t\t\t\r\n\t\t\t\tif (($row_data['custom_status_1'] != '' && $row_data['custom_status_1'] != $custom_status_1) || \r\n\t\t\t\t\t($row_data['custom_status_2'] != '' && $row_data['custom_status_2'] != $custom_status_2) ||\r\n\t\t\t\t\t($row_data['custom_status_3'] != '' && $row_data['custom_status_3'] != $custom_status_3))\r\n\t\t\t\t{\r\n\t\t\t\t\tcontinue;\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// Set aliases for discount and item id.\r\n\t\t\t\t$discount_id = $row_data['id'];\r\n\t\t\t\t$item_id = $row_data['item_id'];\r\n\t\t\t\t\r\n\t\t\t\t// Get discount target column name.\r\n\t\t\t\t$target_column_ids = array(1 => 'item_price', 2 => 'item_shipping', 3 => 'item_summary_total', 4 => 'shipping_total', 5 => 'total', 6 => 'reward_vouchers');\r\n\t\t\t\tforeach($target_column_ids as $column_id => $column)\r\n\t\t\t\t{\r\n\t\t\t\t\tif ($row_data['column_id'] == $column_id)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t$target_column = $column;\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\t// Remove non-required discount data.\t\t\t\t\r\n\t\t\t\t$remove_discount_keys = array('item_id', 'column_id', 'group_id', 'custom_status_1', 'custom_status_2', 'custom_status_3');\r\n\t\t\t\tforeach($remove_discount_keys as $column)\r\n\t\t\t\t{\r\n\t\t\t\t\tunset($row_data[$column]);\r\n\t\t\t\t}\r\n\t\t\t\r\n\t\t\t\t// Set discount data if not already set.\r\n\t\t\t\tif (! isset($sorted_data[$target_column][$discount_id]))\r\n\t\t\t\t{\r\n\t\t\t\t\t$sorted_data[$target_column][$discount_id] = $row_data;\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\t// Add item id to discount data if applicable.\r\n\t\t\t\tif ($item_id > 0)\r\n\t\t\t\t{\r\n\t\t\t\t\t$sorted_data[$target_column][$discount_id]['item_ids'][] = $item_id;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\treturn $sorted_data;\r\n\t\t}\r\n\t\t\r\n\t\treturn FALSE;\r\n\t}", "private function unbalancedSupply() {\n $rapporto = $_POST['quantitaCercata'] / $_POST['quantitaOfferta'];\n if ($rapporto >= 0.5 && $rapporto <= 2)\n return false;\n return true;\n }", "public function applyDefaults()\n {\n $addressInfo = $this->_getDefaultAddress();\n $this->saveBilling(\n $addressInfo['billing'],\n $addressInfo['billing']['customer_address_id'],\n false\n );\n if (!$addressInfo['billing']['use_for_shipping']) {\n $this->saveShipping(\n $addressInfo['shipping'],\n $addressInfo['shipping']['customer_address_id'],\n false\n );\n }\n\n /**\n * @var Mage_Sales_Model_Quote\n */\n $quote = $this->getQuote();\n $shippingAddress = $quote->getShippingAddress();\n\n // weight vs destination fix\n $weight = 0;\n foreach($quote->getAllItems() as $item) {\n $weight += ($item->getWeight() * $item->getQty()) ;\n }\n $shippingAddress->setFreeMethodWeight($weight)->setWeight($weight);\n\n $shippingAddress->collectTotals()->collectShippingRates()->save();\n $this->applyShippingMethod();\n // shipping method may affect the total in both sides (discount on using shipping address)\n $quote->collectTotals();\n\n $ajaxHelper = Mage::helper('firecheckout/ajax');\n if ($ajaxHelper->getIsShippingMethodDependsOn('total')) {\n // changing total by shipping price may affect the shipping prices theoretically\n // (free shipping may be canceled or added)\n $shippingAddress->setCollectShippingRates(true)->collectShippingRates();\n // if shipping price was changed, we need to recalculate totals again.\n // Example: SELECTED SHIPPING METHOD NOW BECOMES FREE\n // previous method added a discount and selected shipping method wasn't free\n // but removing the previous shipping method removes the discount also\n // and selected shipping method is now free\n $quote->setTotalsCollectedFlag(false)->collectTotals();\n }\n\n $this->applyPaymentMethod();\n if ($ajaxHelper->getIsTotalDependsOn('payment-method')) { // @todo && method is changed\n // recollect totals again because adding/removing payment\n // method may add/remove some discounts in the order\n\n // to recollect discount rules need to clear previous discount\n // descriptions and mark address as modified\n // see _canProcessRule in Mage_SalesRule_Model_Validator\n $shippingAddress->setDiscountDescriptionArray(array())->isObjectNew(true);\n\n $quote->setTotalsCollectedFlag(false)->collectTotals();\n }\n\n $quote->save();\n\n return $this;\n }", "function get_discount($total = 0)\n{\n global $config, $db_prefix, $sql_today, $current_user_id;\n\n $discount = array('self_gift_code' => '', 'gift_code' => '', 'gift_flat' => 0, 'gift_pct' => 0);\n $gift_discount = false;\n\n // get gift\n $gift = sql_qquery(\"SELECT * FROM \".$db_prefix.\"gift WHERE redeem_user_id='$current_user_id' AND redeem_order_id='' AND valid_date >= '$sql_today' LIMIT 1\");\n if (!empty($gift) && ($total >= $gift['min_purchase'])) {\n $gift_discount = true;\n $g = explode('.', $gift['gift_code']);\n $discount['self_gift_code'] = $gift['gift_code'];\n $discount['gift_code'] = $gift['gift_code'] = $g[0];\n if ($gift['gift_pct']) {\n $discount['gift_pct'] = $gift['gift_value'];\n } else {\n $discount['gift_flat'] = $gift['gift_value'];\n }\n }\n\n return $discount;\n}", "function get_discounts_before_tax() {\n\t\t\tif ($this->discount_cart) :\n\t\t\t\treturn cmdeals_price($this->discount_cart); \n\t\t\tendif;\n\t\t\treturn false;\n\t\t}", "public static function update_item_with_discount($detail_id,$order_promotion,$order_discount_id,$order_discount_amt){\r\tif(is_gt_zero_num($detail_id)){\r\t\t$objtbl_order_details=new tbl_order_details();\r\t\tif($objtbl_order_details->readObject(array(ORD_DTL_ID=>$detail_id))){\r\t\t\t$objtbl_order_details->setordprom_promotion($order_promotion);\r\t\t\t$objtbl_order_details->setordprom_discount_id($order_discount_id);\r\t\t\t$objtbl_order_details->setordprom_discount_amt($order_discount_amt);\r\t\t\t$objtbl_order_details->insert();\r\t\t\treturn 1;\r\t\t}\r\t\tunset($objtbl_order_details);\t\r\t} \r\treturn 0;\t\r }", "public function disable()\n {\n try {\n $sql = \"UPDATE s_core_paymentmeans SET active = '0' WHERE name = 'vrpay_cc'\";\n Shopware()->Db()->query($sql);\n $sql = \"UPDATE s_core_paymentmeans SET active = '0' WHERE name = 'vrpay_ccsaved'\";\n Shopware()->Db()->query($sql);\n $sql = \"UPDATE s_core_paymentmeans SET active = '0' WHERE name = 'vrpay_dd'\";\n Shopware()->Db()->query($sql);\n $sql = \"UPDATE s_core_paymentmeans SET active = '0' WHERE name = 'vrpay_ddsaved'\";\n Shopware()->Db()->query($sql);\n $sql = \"UPDATE s_core_paymentmeans SET active = '0' WHERE name = 'vrpay_giropay'\";\n Shopware()->Db()->query($sql);\n $sql = \"UPDATE s_core_paymentmeans SET active = '0' WHERE name = 'vrpay_klarnapaylater'\";\n Shopware()->Db()->query($sql);\n $sql = \"UPDATE s_core_paymentmeans SET active = '0' WHERE name = 'vrpay_klarnasliceit'\";\n Shopware()->Db()->query($sql);\n $sql = \"UPDATE s_core_paymentmeans SET active = '0' WHERE name = 'vrpay_paypal'\";\n Shopware()->Db()->query($sql);\n $sql = \"UPDATE s_core_paymentmeans SET active = '0' WHERE name = 'vrpay_paypalsaved'\";\n Shopware()->Db()->query($sql);\n $sql = \"UPDATE s_core_paymentmeans SET active = '0' WHERE name = 'vrpay_paydirekt'\";\n Shopware()->Db()->query($sql);\n $sql = \"UPDATE s_core_paymentmeans SET active = '0' WHERE name = 'vrpay_klarnaobt'\";\n Shopware()->Db()->query($sql);\n $sql = \"UPDATE s_core_paymentmeans SET active = '0' WHERE name = 'vrpay_easycredit'\";\n Shopware()->Db()->query($sql);\n return $result['success'] = true;\n } catch (Exception $e) {\n return $result['success'] = false;\n }\n }", "public function setCalculateDiscountOnCreditMemos(?bool $value): void {\n $this->getBackingStore()->set('calculateDiscountOnCreditMemos', $value);\n }", "private function setSoldIndividually() {\n $this->product->set_sold_individually($this->wcData->isSoldIndividually());\n }", "public function setAllUncostedAudits() {\n\t\t$uncosted_audits = $this->getAllUncostedAudits();\n\t\t\n\t\tforeach($uncosted_audits as $uncosted_audit) {\n\t\t\t$this->setAuditCost($uncosted_audit->audit_id);\n\t\t}\n\t\t\n\t\treturn;\n\t}", "function learndash_enroll_with_zero_price(): void {\n\tif (\n\t\tempty( $_POST['nonce'] ) ||\n\t\t! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['nonce'] ) ), 'learndash-coupon-nonce' ) ||\n\t\tempty( (int) $_POST['post_id'] ) ||\n\t\t! is_user_logged_in()\n\t) {\n\t\twp_send_json_error(\n\t\t\tarray(\n\t\t\t\t'message' => __( 'Invalid request.', 'learndash' ),\n\t\t\t)\n\t\t);\n\t}\n\n\t// Check if we are processing a course/group.\n\n\t$product = Product::find( (int) $_POST['post_id'] );\n\n\tif ( ! $product ) {\n\t\twp_send_json_error(\n\t\t\tarray(\n\t\t\t\t'message' => __( 'Product not found.', 'learndash' ),\n\t\t\t)\n\t\t);\n\t}\n\n\t// Check if the price by coupon is 0.\n\n\ttry {\n\t\t$product_pricing = $product->get_pricing();\n\t} catch ( Learndash_DTO_Validation_Exception $e ) {\n\t\twp_send_json_error(\n\t\t\tarray(\n\t\t\t\t'message' => __( 'Something went wrong.', 'learndash' ),\n\t\t\t)\n\t\t);\n\t}\n\n\t$user = wp_get_current_user();\n\t$price = learndash_get_price_by_coupon( $product_pricing->price, $product->get_id(), $user->ID );\n\n\tif ( $price > 0 ) {\n\t\twp_send_json_error(\n\t\t\tarray(\n\t\t\t\t'message' => __( 'You have to pay for access.', 'learndash' ),\n\t\t\t)\n\t\t);\n\t}\n\n\t// Attach a coupon.\n\n\t$coupon_data = learndash_get_attached_coupon_data( $product->get_id(), $user->ID );\n\n\tif ( empty( $coupon_data ) ) {\n\t\twp_send_json_error(\n\t\t\tarray(\n\t\t\t\t'message' => __( 'Something went wrong.', 'learndash' ),\n\t\t\t)\n\t\t);\n\t}\n\n\tlearndash_attach_coupon( $product->get_id(), $coupon_data->coupon_id, $product_pricing->price, 0 );\n\n\t// Create a transaction.\n\n\t$transaction_id = learndash_transaction_create(\n\t\tarray(\n\t\t\tTransaction::$meta_key_is_free => true,\n\t\t),\n\t\t$product->get_post(),\n\t\t$user\n\t);\n\n\t$transaction = Transaction::find( $transaction_id );\n\n\tif ( ! $transaction ) {\n\t\twp_send_json_error(\n\t\t\tarray(\n\t\t\t\t'message' => __( 'Something went wrong.', 'learndash' ),\n\t\t\t)\n\t\t);\n\t}\n\n\t// Enroll.\n\n\t$product->enroll( $user );\n\n\t// Redirect.\n\n\twp_send_json_success(\n\t\tarray(\n\t\t\t'redirect_url' => Learndash_Unknown_Gateway::get_url_success(\n\t\t\t\tarray( $product )\n\t\t\t),\n\t\t)\n\t);\n}", "function unset_discount($discount_id = FALSE)\n\t\t{\n\t\t\t// The 'unset_discount()' function can accept an array of either discount ids or codes to delete more than one discount at a time.\n\t\t\t// Alternatively, if no data is submitted, the function will delete all discounts that are applied to the cart.\n\t\t\t// This example uses the 1 discount id that was supplied via the url link.\n\t\t\t// $this->flexi_cart->unset_userdata_discount($discount_id); // Can't remeber why this 'stock code' didn't work - said 'undefined method' or something\t\t\n\t\t\t$this->flexi_cart->unset_discount($discount_code);\n\n\t\t\t// Set a message to the CI flashdata so that it is available after the page redirect.\n\t\t\t$this->session->set_flashdata('message', $this->flexi_cart->get_messages());\n\t\t\t\n\t\t\tredirect('cart');\n\t\t}", "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 deleteDiscount();", "function ycb_add_discount_badge($content, $post, $product){\r\n global $ycb_using_flatsome;\r\n\r\n $ycb_settings = ycb_get_settings();\r\n\r\n //var_dump(get_class_methods($product));\r\n $base_price = $product->get_regular_price();\r\n $discount_price = $product->get_sale_price();\r\n\r\n if($product->is_type( 'variable' )){\r\n $variations = $product->get_available_variations();\r\n if(isset($variations[0])){\r\n $variation = $variations[0];\r\n $base_price = $variation[\"display_regular_price\"];\r\n $discount_price = $variation[\"display_price\"];\r\n }\r\n }\r\n\r\n if(class_exists(\"WC_Dynamic_Pricing\")){\r\n $discount_price = apply_filters(\"woocommerce_product_get_price\", $base_price, $product, false);\r\n }\r\n\r\n $percentage = round( ( ( floatval($base_price) - floatval($discount_price) ) / (floatval($base_price) > 0 ? floatval($base_price) : 1) ) * 100 );\r\n\r\n $sale_style = ycb_get_styles($ycb_settings, $percentage);\r\n $inner_content = \"-\" . $percentage . \"%\";\r\n $filtered_content = apply_filters('ycb_discount_badge_override_hook', $inner_content);\r\n $sale_tag = \"<span class='onsale ycb_on_sale yoohoo_badge \".ycb_get_badge_shape_class(false, $ycb_settings).\"' style='$sale_style'>\" . $filtered_content . \"</span>\";\r\n\r\n $force_remove_internal_tag = apply_filters('ycb_hide_internal_sale_tag', true, $ycb_settings);\r\n if(!$force_remove_internal_tag){\r\n $sale_tag = \"\";\r\n }\r\n\r\n $hide_sale_tag = isset($ycb_settings['ycb_hide_default_sale_tag']) && $ycb_settings['ycb_hide_default_sale_tag'] === \"true\" ? true : false;\r\n\r\n if($hide_sale_tag){\r\n $content = $sale_tag;\r\n } else {\r\n $content .= $sale_tag;\r\n }\r\n\r\n if($percentage > 0){\r\n if($hide_sale_tag){\r\n if($ycb_using_flatsome){\r\n ycb_custom_badge_hide_woo_sales_badge_on_page(true);\r\n $content .= $sale_tag;\r\n } else {\r\n $content = $sale_tag;\r\n }\r\n } else {\r\n $content .= $sale_tag;\r\n }\r\n }\r\n\r\n //$content = apply_filters(\"ycb_discount_badge_internal_filter\", $content, $product, $hide_sale_tag, $ycb_settings);\r\n\r\n return $content;\r\n}", "public function hasDiscountmax(){\n return $this->_has(33);\n }", "function generate_price_refined($prod_arr,$row_price,$row_settings,$tax_val,$return_price_withouttax=0)\n\t{\n\t\tglobal $db,$ecom_siteid,$ecom_allpricewithtax;\n\t\t\n\t\t$webprice \t\t\t= $prod_arr['product_webprice'];\n\t\t$disc_asval\t\t\t= $prod_arr['product_discount_enteredasval'];\n\t\t$tax_before_disc\t= $row_settings['saletax_before_discount'];\n\t\t$discount\t\t\t= 0;\n\t\t$additional_price = 0;\n\t\tif($prod_arr['cur_var_value_id'] and $prod_arr['product_variablecomboprice_allowed']=='N')\n\t\t{\n\t\t\t$additional_price = calculat_special_price_new($prod_arr);\n\t\t\n\t\t\t$webprice = $webprice + $additional_price; // done to add the additional price for variable for special cases\n\t\t}\t\n\t\t\n\t\tif($prod_arr['product_discount']>0)\n\t\t{\n\t\t\tif($disc_asval==2) // For Exact Discount Price \n\t\t\t\t$discount\t= $webprice-($prod_arr['product_discount']+$additional_price); \t\n\t\t\telse\n\t\t\t\t$discount\t= $prod_arr['product_discount'];\n\t\t}\n\t\t//if($ecom_siteid==70 or $ecom_siteid==104) // bypassed tax calculation for nationwide fireextinguisher and discount mobility\n\t\t\n\t\tif($ecom_siteid==104) // bypassed tax calculation for discount mobility and puregusto\n\t\t\t$apply_tax = 'Y';\n\t\telse\t\n\t\t\t$apply_tax\t\t= $prod_arr['product_applytax'];\n\t\t\t\n\t\t\n\t\tif($return_price_withouttax==1)\n\t\t{\n\t\t\t$apply_tax = 'N';\n\t\t}\n\t\t\n\t\t\t\t\t\n\t\t/*switch($row_price['price_displaytype'])\n\t\t{\n\t\t\tcase 'show_price_only':\t\t\t\t\t\n\t\t\tcase 'show_price_plus_tax':\n\t\t\t\tif($discount>0)\n\t\t\t\t{\n\t\t\t\t\tif($disc_asval==1) // If discount is specified as value\n\t\t\t\t\t{\n\t\t\t\t\t\t$disc_price = $webprice - $discount;\n\t\t\t\t\t}\t\n\t\t\t\t\telse if($disc_asval==2) \n\t\t\t\t\t{ // For Exact Discount Price \n\t\t\t\t\t\t$disc_price\t= $webprice-$discount; \t// For Exact Discount Price \n\t\t\t\t\t}\t\n\t\t\t\t\telse // case if discount is given as percentage\n\t\t\t\t\t{\n\t\t\t\t\t\t$disc_price = $webprice - ($webprice * $discount/100);\n\t\t\t\t\t}\n\t\t\t\t}\t\n\t\t\tbreak;\n\t\t\tcase 'show_price_inc_tax': // Show price including tax\n\t\t\tcase 'show_both':*/\n\t\t\t\tif ($apply_tax=='Y' and $ecom_allpricewithtax==0)\t\n\t\t\t\t{\n\t\t\t\t\t$disc_price\t= $webprice + ($webprice * $tax_val/100);\n\t\t\t\t\t$disc_price = sprintf('%0.2f',$disc_price);\n\t\t\t\t}\t\n\t\t\t\telse\n\t\t\t\t\t$disc_price = $webprice;\n\t\t\t\tif ($discount>0)\n\t\t\t\t{\n\t\t\t\t\tif($disc_asval==1) // If discount is specified as value\n\t\t\t\t\t{\n\t\t\t\t\t\t$disc_price \t\t\t= $webprice - $discount; // calculate the original discount\n\t\t\t\t\t\tif ($apply_tax=='Y')\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif($tax_before_disc==1)// case of apply tax before discount\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$disc_price_with_tax \t= $disc_price + ($webprice * $tax_val/100); // apply tax to it\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$disc_price_with_tax \t= $disc_price + ($disc_price * $tax_val/100); // apply tax to it\n\t\t\t\t\t\t\t}\t\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\t$disc_price_with_tax = $disc_price;\n\n\t\t\t\t\t}\t\n\t\t\t\t\telse if($disc_asval==2) // For Exact Discount Price \n\t\t\t\t\t{\n\t\t\t\t\t\t$disc_price = $webprice - $discount;\n\t\t\t\t\t\t//$disc_price = $discount;\n\t\t\t\t\t\tif ($apply_tax=='Y')\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif($tax_before_disc==1)// case of apply tax before discount\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$disc_price_with_tax \t= $disc_price + ($webprice * $tax_val/100); // apply tax to it\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$disc_price_with_tax \t= $disc_price + ($disc_price * $tax_val/100); // apply tax to it\n\t\t\t\t\t\t\t}\t\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\t$disc_price_with_tax = $disc_price;\n\t\t\t\t\t}\t\n\t\t\t\t\telse // case if discount is given as percentage\n\t\t\t\t\t{\n\t\t\t\t\t\t$disc_price \t\t\t\t= $webprice - ($webprice * $discount/100);// calculate the original discount\n\t\t\t\t\t\t$disc_price = sprintf('%0.2f',$disc_price);\n\t\t\t\t\t\tif ($apply_tax=='Y')\n\t\t\t\t\t\t{\t\t\t\t\t\t\n\t\t\t\t\t\t\tif($tax_before_disc==1)// case of apply tax before discount\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$disc_price_with_tax \t\t= $disc_price + ($webprice * $tax_val/100); // apply tax to it\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$disc_price_with_tax \t\t= $disc_price + ($disc_price * $tax_val/100); // apply tax to it\n\t\t\t\t\t\t\t}\t\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\t$disc_price_with_tax = $disc_price;\n\t\t\t\t\t}\n\t\t\t\t\t$disc_price = $disc_price_with_tax;\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t/*break;\n\t\t};\t*/\n\t\tif($disc_price>0)\n\t\t\treturn $disc_price;\n\t\telse\n\t\t\treturn $webprice;\n\t}", "public function setDiscount(?float $discount): self\n {\n $this->initialized['discount'] = true;\n $this->discount = $discount;\n\n return $this;\n }" ]
[ "0.67020065", "0.6405413", "0.6284878", "0.6276455", "0.62241805", "0.60894865", "0.59977823", "0.59686935", "0.58890367", "0.58320373", "0.58054847", "0.5772422", "0.5771132", "0.57018864", "0.5660918", "0.5649346", "0.56402653", "0.56272924", "0.55680895", "0.5541475", "0.55392176", "0.54813546", "0.5467351", "0.54559666", "0.5438247", "0.5437029", "0.54202145", "0.5420112", "0.5419402", "0.54188883", "0.54184085", "0.54060996", "0.5371379", "0.5361872", "0.5359591", "0.533849", "0.53329295", "0.53321457", "0.53317535", "0.5294337", "0.52871245", "0.5286758", "0.5285007", "0.52841574", "0.52759707", "0.52512825", "0.52392423", "0.5235733", "0.5228939", "0.5228488", "0.5227378", "0.5225424", "0.5222852", "0.5220021", "0.5218643", "0.52115154", "0.5210869", "0.5207085", "0.5205184", "0.51680076", "0.5161306", "0.5153581", "0.5142227", "0.5141874", "0.5136639", "0.51356554", "0.5118624", "0.51166105", "0.5116207", "0.5115474", "0.5102488", "0.51021856", "0.5100318", "0.5089308", "0.50844884", "0.50760084", "0.50732154", "0.50638443", "0.50536776", "0.5048347", "0.50477684", "0.5045635", "0.5045086", "0.5041748", "0.5038873", "0.5038379", "0.5033654", "0.50287145", "0.50275785", "0.5026933", "0.50187993", "0.5002709", "0.4996505", "0.4992833", "0.49908522", "0.49873662", "0.49705857", "0.4970366", "0.49694628", "0.49677715", "0.49581906" ]
0.0
-1
Target: Category. "Set discount to category"
protected static function avail_target_cat($filter_items, $items, $target, $rule, $sku_id) { // Если условие не задано, прерываем обработку if (empty($target->condition) || !$filter_items) { return false; } $discount_items = self::filter_by_cat($items, (array) $target->condition); return self::calculate_target_discount($target, $discount_items, $rule, $sku_id); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function AssignDiscount()\n\t{\t\n\t}", "function apply_special_category_discount($category, $count, &$disc_amount) {\r\n switch($category) {\r\n case 99999:\r\n case 99998:\r\n if ($count > 100) {\r\n $disc_amount = 50; \r\n }\r\n break; \r\n case 99997:\r\n $disc_amount = 75;\r\n break;\r\n }\r\n }", "function set_discount($discount_id = FALSE)\n\t\t{\n\t\t\t$this->load->model('demo_cart_model');\n\t\t\t\n\t\t\t$this->demo_cart_model->demo_set_discount($discount_id);\n\t\t\t\n\t\t\tredirect('cart');\n\t\t}", "public function setDiscount(int $discount): void\n {\n $this->discount = ($discount > 0 && $discount <= 50) ? $discount : 0;\n\n }", "public function setDiscount(string $discount)\n\t{\n\t\t$this->addKeyValue('Discount', $discount); \n\n\t}", "function apply_special_item_discount($id, $count, &$disc_amount) {\r\n switch($id) {\r\n case 99999:\r\n case 99998:\r\n if ($count > 100) {\r\n $disc_amount = 50; \r\n }\r\n break; \r\n case 99997:\r\n $disc_amount = 75;\r\n break; \r\n }\r\n }", "public function setDiscountDescription($description);", "public function setDiscountUid(?string $discountUid): void\n {\n $this->discountUid = $discountUid;\n }", "public function setDiscountAttribute($val)\n {\n return (int)$this->attributes['discount'] = $val;\n }", "public function setDiscountAmount($amount);", "protected function calculateDiscount() : void{\r\n $percentage = ($this->discounted_value * 100) / $this->order->getTrueTotal();\r\n $new_total = $this->order->getTrueTotal() - $this->discounted_value;\r\n\r\n $this->order_discount_value = $this->discounted_value;\r\n $this->order_discount_percentage = $percentage;\r\n $this->order_discount_reason = \"For every \" . $this->products_nr . \" products from category #\" . $this->category_id . \" you get one free. You got: \";\r\n foreach($this->items_matching as $item){\r\n $this->order_discount_reason .= floor($item[\"qty\"] / $this->products_nr) . \" x '\" . $item[\"description\"] . \"' (€\". $item[\"price\"] .\" each) ; \";\r\n }\r\n $this->order_new_total = $new_total;\r\n }", "public function setDiscount($discount)\r\n {\r\n $this->discount = $discount;\r\n\r\n return $this;\r\n }", "function sensible_category() {\n wp_update_term(1, 'category', array(\n 'name' => 'News',\n 'slug' => 'news', \n 'description' => 'News'\n ));\n }", "public function setDiscount($value)\n {\n $this->data->amount->subtotals->discount = (float) $value;\n\n return $this;\n }", "public function applyGlobalDiscount($discount_rate)\n {\n }", "public function setDiscount(int $discount): self\n {\n $this->discount = $discount;\n return $this;\n }", "public function setDiscount(?float $discount): self\n {\n $this->initialized['discount'] = true;\n $this->discount = $discount;\n\n return $this;\n }", "public function testSetGetDiscount()\n {\n $this->item->setPrice(85.00);\n $this->item->setQuantity(1);\n $this->item->addDiscount(\n (new FlatDiscount())\n ->setFigure(15.00)\n );\n\n $this->assertEquals($this->item->getPriceTotal(), 85.00);\n $this->assertEquals($this->item->getNetTotal(), 70.00);\n $this->assertEquals($this->item->getDiscount(), 15.00);\n }", "function setup() {\r\n // \"Buy more than 100 items, get 50 (% or $, as per admin) off\" \r\n // $this->add_extra_level_discount(100, 50);\r\n }", "function es_cart_change_coupon_label( $html , $coupon){\n\n$html='Discount:';\n\nreturn $html;\n\n}", "public function setDiscount($var)\n {\n GPBUtil::checkDouble($var);\n $this->discount = $var;\n\n return $this;\n }", "function pp_edd_auto_apply_discount() {\n\n\tif ( function_exists( 'edd_is_checkout' ) && edd_is_checkout() ) {\n\n\t\tif ( ! edd_cart_has_discounts() && edd_is_discount_valid( 'BFCM2016', '', false ) ) {\n\t\t\tedd_set_cart_discount( 'BFCM2016' );\n\t\t}\n\n\t}\n\n}", "public function setDiscountAmount($value){\n return $this->setParameter('discount_amount', $value);\n }", "public function addDietaryCategory(){\n \t$id = $this->formValueForKey(\"dietaryCategorySelection\");\n \t \n \t$foundDietaryCategory = BLGenericRecord::recordMatchingKeyAndValue(\"DietaryCategory\", \"id\", $id);\n \t$this->currentRecipe()->addDietaryCategory($foundDietaryCategory);\n }", "public function setCategory($value)\n {\n $this->setItemValue('category', ['id' => (int)$value]);\n }", "public function setDiscount($discount)\n {\n $this->discount = $discount;\n\n return $this;\n }", "public function setDiscount($discount)\n {\n $this->discount = $discount;\n\n return $this;\n }", "private function setDiscount( string $type, float $amount, float $discount ): float\n {\n switch( $type ) {\n case 'absolute' :\n $price = $amount - $discount;\n break;\n case 'percent' :\n $price = $amount - ($amount / 100 * $discount);\n break;\n case 'wholesale' :\n $price = $amount;\n break;\n default :\n $price = $amount;\n break;\n }\n\n $price = round(sprintf(\"%01.2f\", ceil($price * 100) / 100), 2);\n\n return $price;\n }", "public function deleteDiscount();", "public function testUpdateItemSubCategory()\n {\n }", "public function applyDiscount(Discount $discount){\n\t\tif($this->discount == NULL){\n\t\t\t$this->finalPrice = $this->price*(100-$discount->percent/100);\n\t\t\t$this->discount = $discount;\n\t\t}\n\t\treturn $this;\n\t}", "public function updateAffectedPlans(Discount $discount)\n {\n }", "public function getDiscount()\n\t{\n\t\treturn $this->getKeyValue('Discount'); \n\n\t}", "public function setDiscountPercent(?string $value): void {\n $this->getBackingStore()->set('discountPercent', $value);\n }", "function setCategory($value) \n {\n return $this->instance->setcategory($value);\n }", "function sos_chapter_change_cat_object() {\n global $wp_taxonomies;\n $labels = &$wp_taxonomies['product_cat']->labels;\n $labels->name = 'Topic';\n $labels->singular_name = 'Topic';\n $labels->add_new = 'Add Topic';\n $labels->add_new_item = 'Add Topic';\n $labels->edit_item = 'Edit Topic';\n $labels->new_item = 'Topic';\n $labels->view_item = 'View Topic';\n $labels->search_items = 'Search Topics';\n $labels->not_found = 'No Topics found';\n $labels->not_found_in_trash = 'No Topics found in Trash';\n $labels->all_items = 'All Topics';\n $labels->menu_name = 'Topic';\n $labels->name_admin_bar = 'Topic';\n}", "public function getDiscount()\r\n {\r\n return $this->discount;\r\n }", "function setCategory($object) { \n /* you can itentify the item with $object->Item->ShopId */ \n}", "function apply_cart_discounts_after_tax() {\t\n\t\t\t\n\t\t\tif ($this->applied_coupons) foreach ($this->applied_coupons as $code) :\n\t\t\t\t$coupon = new cmdeals_coupon( $code );\n\t\t\t\t\n\t\t\t\tdo_action( 'cmdeals_cart_discount_after_tax_' . $coupon->type, $coupon );\n\t\t\t\t\n\t\t\t\tif ( !$coupon->apply_before_tax() && $coupon->is_valid() ) :\n\t\t\t\t\t\n\t\t\t\t\tswitch ($coupon->type) :\n\t\t\t\t\t\n\t\t\t\t\t\tcase \"fixed_cart\" :\n\t\n\t\t\t\t\t\t\t$this->discount_total = $this->discount_total + $coupon->amount;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\n\t\t\t\t\t\tcase \"percent\" :\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t$percent_discount = (round( $this->cart_contents_total + $this->tax_total , 2) / 100 ) * $coupon->amount;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t$this->discount_total = $this->discount_total + $percent_discount;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\n\t\t\t\t\tendswitch;\n\t\n\t\t\t\tendif;\n\t\t\tendforeach;\n\t\t}", "public function addDiscount(DiscountInterface $discount);", "public function getTonicDiscount()\n {\n }", "public function getDiscount(): int\n {\n return $this->discount;\n }", "public function setDiscount($discount)\n {\n $this->discount = $this->db->real_escape_string($discount);\n\n return $this;\n }", "public function getDiscount()\n {\n return $this->discount;\n }", "public function getDiscount()\n {\n return $this->discount;\n }", "public function getDiscount()\n {\n return $this->discount;\n }", "public function getDiscount()\n {\n return $this->discount;\n }", "public function getDiscount()\n {\n return $this->discount;\n }", "public function getDiscount()\n {\n return $this->discount;\n }", "public function updateCategory()\n {\n Category::findOrFail($this->category_id)->update([\n 'category_name' => $this->categoryName,\n 'slug' => Str::slug($this->categoryName),\n 'class' => $this->class,\n\n ]);\n }", "public function addDiscountToOrder($ord_dtl_id,$discount){\r\t\tif(is_gt_zero_num($ord_dtl_id) && is_gt_zero_num($discount)){\r\t\t\tif ($this->readObject(array(ORD_DTL_ID=>$ord_dtl_id))){\r\t\t\t\t//..get the discount value\r\t\t\t\t$discount_val=0;\r\t\t\t\t$discount_detail=tbl_discounts::GetInfo($discount);\r\t\t\t\t\r\t\t\t\tif(is_not_empty($discount_detail)){\r\t\t\t\t\t\tif($discount_detail[DISCOUNT_TYPE]=='PERCENT'){\r\t\t\t\t\t\t\t$discount_val=($this->getord_dtl_price()*($discount_detail[DISCOUNT_PERCENT]/100));\r\t\t\t\t\t\t}else{\r\t\t\t\t\t\t\t$discount_val=($discount_detail[DISCOUNT_PERCENT]);\r\t\t\t\t\t\t}\r\t\t\t\t}\t\t\t\t\r\t\t\t\t\r\t\t\t\t$qry = \"UPDATE \".TBL_ORDER_DETAILS.RET.\"SET\".RET.\"\r\t\t\t\".ORD_DTL_DISCOUNT.\" = \".$discount_val.\" WHERE \".ORD_DTL_ID.\"={$ord_dtl_id}\";\r\t\t\t\t$res = mysql_query($qry);\r\t\t\t\tif($res){\r\t\t\t\t\treturn 1;\r\t\t\t\t}\r\t\t\t}\r\t\t}\r\t\treturn 0;\r\t}", "public function setCategory($module = '')\n {\n $expenseList = $this->loadModel('tree')->getOptionMenu('out', 0, true);\n $expenseIdList = array_keys($expenseList);\n\n if($_POST)\n {\n $this->refund->setCategory($expenseIdList);\n if(dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError()));\n $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess));\n }\n\n if($module)\n {\n $this->lang->menuGroups->refund = $module;\n $this->lang->refund->menu = $this->lang->$module->menu;\n }\n\n $refundCategories = $this->dao->select('*')->from(TABLE_CATEGORY)->where('type')->eq('out')->andWhere('refund')->eq(1)->fetchAll('id');\n $refundCategories = array_keys($refundCategories);\n $refundCategories = implode($refundCategories, ',');\n\n $this->view->title = $this->lang->refund->setCategory;\n $this->view->expenseList = $expenseList;\n $this->view->refundCategories = $refundCategories;\n $this->view->module = $module;\n $this->display();\n }", "function getDiscountFor($product) {\n\t\treturn 30;\n\t}", "public function discountBifurcation(Varien_Event_Observer $observer)\n {\n $rule = $observer->getEvent()->getRule();\n $result = $observer->getEvent()->getResult();\n $itemId = $observer->getEvent()->getItem()->getItemId();\n //set Unique key\n $curUnique= $rule->getRuleId().'_'.$itemId;\n //check if Mage registry unique call set\n if(Mage::registry('uniqueCall')!==null){\n //if check in array\n $uniqueCalls = Mage::registry('uniqueCall');\n if( in_array($curUnique,$uniqueCalls)){\n return;\n }else{\n //unset existing registry. also take existing array in variable\n Mage::unregister('uniqueCall');\n $uniqueCalls[]= $curUnique ;\n //set registry again with new array include $uniqueCall into it\n Mage::register('uniqueCall',$uniqueCalls);\n }\n }else{\n //set registry again with new array include $uniqueCall into it\n $array = array();\n $array[]=$rule->getRuleId().'_'.$itemId;\n Mage::register('uniqueCall',$array);\n\n } \n\n //condition for the Promotional coupons\n if ( $rule->getCouponType() == Mage_SalesRule_Model_Rule::COUPON_TYPE_NO_COUPON ) {\n $promotionDiscount = 0;\n $promotionDiscount = Mage::registry('promotion');\n if (Mage::registry('promotion')!==null){\n Mage::unregister('promotion');\n }\n if (Mage::registry('promo_lable')!==null){\n Mage::unregister('promo_lable');\n }\n $promotionDiscount += $result->getDiscountAmount();\n Mage::register('promotion', $promotionDiscount);\n Mage::register('promo_lable',$rule->getName());\n } elseif ( $rule->getCouponType() == self::COUPON_TYPE_FUE_GENERATED ) {\n $couponDiscount = 0;\n $couponDiscount = Mage::registry('coupon');\n if(Mage::registry('coupon')!==null){\n Mage::unregister('coupon');\n }\n //sum up all the values of discounted coupons\n $couponDiscount += $result->getDiscountAmount();\n Mage::register('coupon',$couponDiscount);\n }\n $quote = $observer->getEvent()->getQuote();\n $quoteAddress = $observer->getEvent()->getAddress();\n //set discounted coupons and promotional coupons amount in quote\n $quote->setCouponDiscount(Mage::registry('coupon'));\n $quote->setPromotionalDiscount(Mage::registry('promotion'));\n\n if (Mage::getStoreConfig('promodiscount/promodiscount/use_default')) {\n $quote->setPromoLable(Mage::getStoreConfig('promodiscount/promodiscount/default_lable'));\n } else {\n if (Mage::registry('promo_lable')) {\n $quote->setPromoLable(Mage::registry('promo_lable'));\n } else {\n $quote->setPromoLable(Mage::getStoreConfig('promodiscount/promodiscount/default_lable'));\n }\n }\n \n $quoteAddress->setCouponDiscount(Mage::registry('coupon'));\n $quoteAddress->setPromotionalDiscount(Mage::registry('promotion'));\n if (Mage::registry('promo_lable')) {\n $quoteAddress->setPromoLable(Mage::registry('promo_lable'));\n } else {\n $quoteAddress->setPromoLable(Mage::getStoreConfig('promodiscount/promodiscount/default_lable'));\n }\n }", "public function set_discount_defaults()\r\n\t{\r\n\t\t// Set array placeholders.\r\n\t\tif (! isset($this->flexi->cart_contents['settings']['discounts']['codes']))\r\n\t\t{\r\n\t\t\t$this->flexi->cart_contents['settings']['discounts']['codes'] = array();\r\n\t\t}\r\n\t\tif (! isset($this->flexi->cart_contents['settings']['discounts']['manual']))\r\n\t\t{\r\n\t\t\t$this->flexi->cart_contents['settings']['discounts']['manual'] = array();\r\n\t\t}\t\r\n\t\r\n\t\t// Reset other discount data.\r\n\t\t$this->flexi->cart_contents['settings']['discounts']['active_items'] = array();\r\n\t\t$this->flexi->cart_contents['settings']['discounts']['active_summary'] = array();\r\n\t\t$this->flexi->cart_contents['settings']['discounts']['reward_vouchers'] = array();\r\n\t\t$this->flexi->cart_contents['settings']['discounts']['data']['item_discount_savings'] = 0;\r\n\t\t$this->flexi->cart_contents['settings']['discounts']['data']['summary_discount_savings'] = 0;\r\n\t\t$this->flexi->cart_contents['settings']['discounts']['data']['reward_vouchers'] = 0;\r\n\t\t$this->flexi->cart_contents['settings']['discounts']['data']['void_reward_point_items'] = array();\r\n\r\n\t\tif (! isset($this->flexi->cart_contents['settings']['discounts']['data']['excluded_discounts']))\r\n\t\t{\r\n\t\t\t$this->flexi->cart_contents['settings']['discounts']['data']['excluded_discounts'] = array();\r\n\t\t}\t\r\n\t\t\r\n\t\treturn TRUE;\r\n\t}", "public function setDiscountRate($value){\n return $this->setParameter('discount_rate', $value);\n }", "public function setCategory($userId, $category)\n {\n $User = $this->find()->select(['id' => $userId])->first();\n if (!$User) {\n throw new \\InvalidArgumentException(\n \"Can't find user with id $userId.\",\n 1420807691\n );\n }\n\n if ($category === 'all') {\n //=if show all cateogries\n $active = -1;\n } elseif (is_array($category)) {\n //=if set a custom set of categories\n $active = 0;\n\n $availableCats = $this->Entries->Categories->find('list')->toArray(\n );\n $categories = array_intersect_key($category, $availableCats);\n if (count($categories) === 0) {\n throw new \\InvalidArgumentException();\n }\n $newCats = [];\n foreach ($categories as $cat => $v) {\n $newCats[$cat] = ($v === true || $v === 1 || $v === '1');\n }\n $User->set('user_category_custom', $newCats);\n } else {\n //=if set a single category\n $category = (int)$category;\n if (\n $category > 0 && $this->Entries->Categories->exists((int)$category)\n ) {\n $active = $category;\n } else {\n throw new \\InvalidArgumentException();\n }\n }\n\n $User->set('user_category_active', $active);\n $this->save($User);\n }", "function addCategory($object) {\n $object->Item->ShopId = 'yourReturnedCategoryIdOnMarketplace_'.rand(1000, 9999); \n}", "function apply_deals_discounts_after_tax( $values, $price ) {\n\t\t\t\n\t\t\tif ($this->applied_coupons) foreach ($this->applied_coupons as $code) :\n\t\t\t\t$coupon = new cmdeals_coupon( $code );\n\t\t\t\t\n\t\t\t\tdo_action( 'cmdeals_deals_discount_after_tax_' . $coupon->type, $coupon );\n\t\t\t\t\n\t\t\t\tif ($coupon->type!='fixed_deals' && $coupon->type!='percent_deals') continue;\n\t\t\t\t\n\t\t\t\tif ( !$coupon->apply_before_tax() && $coupon->is_valid() ) :\n\t\t\t\t\t\n\t\t\t\t\t$this_item_is_discounted = false;\n\t\t\n\t\t\t\t\t// Specific deals ID's get the discount\n\t\t\t\t\tif (sizeof($coupon->deal_ids)>0) :\n\t\t\t\t\t\t\n\t\t\t\t\t\tif ((in_array($values['deal_id'], $coupon->deal_ids) || in_array($values['variation_id'], $coupon->deal_ids))) :\n\t\t\t\t\t\t\t$this_item_is_discounted = true;\n\t\t\t\t\t\tendif;\n\t\t\t\t\t\n\t\t\t\t\telse :\n\t\t\t\t\t\t\n\t\t\t\t\t\t// No deals ids - all items discounted\n\t\t\t\t\t\t$this_item_is_discounted = true;\n\t\t\t\t\t\n\t\t\t\t\tendif;\n\t\t\n\t\t\t\t\t// Specific deals ID's excluded from the discount\n\t\t\t\t\tif (sizeof($coupon->exclude_deals_ids)>0) :\n\t\t\t\t\t\t\n\t\t\t\t\t\tif ((in_array($values['deal_id'], $coupon->exclude_deals_ids) || in_array($values['variation_id'], $coupon->exclude_deals_ids))) :\n\t\t\t\t\t\t\t$this_item_is_discounted = false;\n\t\t\t\t\t\tendif;\n\t\t\t\t\t\t\n\t\t\t\t\tendif;\n\t\t\t\t\t\n\t\t\t\t\t// Apply filter\n\t\t\t\t\t$this_item_is_discounted = apply_filters( 'cmdeals_item_is_discounted', $this_item_is_discounted, $values, $before_tax = false );\n\t\t\t\t\t\n\t\t\t\t\t// Apply the discount\n\t\t\t\t\tif ($this_item_is_discounted) :\n\t\t\t\t\t\tif ($coupon->type=='fixed_deals') :\n\t\t\t\t\t\t\n\t\t\t\t\t\t\tif ($price < $coupon->amount) :\n\t\t\t\t\t\t\t\t$discount_amount = $price;\n\t\t\t\t\t\t\telse :\n\t\t\t\t\t\t\t\t$discount_amount = $coupon->amount;\n\t\t\t\t\t\t\tendif;\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t$this->discount_total = $this->discount_total + ( $discount_amount * $values['quantity'] );\n\t\t\t\t\t\t\t\n\t\t\t\t\t\telseif ($coupon->type=='percent_deals') :\n\t\t\t\t\t\t\t$this->discount_total = $this->discount_total + ( $price / 100 ) * $coupon->amount;\n\t\t\t\t\t\tendif;\n\t\t\t\t\tendif;\n\t\t\t\t\t\n\t\t\t\tendif;\n\t\t\tendforeach;\n\t\t}", "public function updatePercentage(Discount $discount)\n {\n }", "function _apply_auto_disc()\n\t{\n\t\t$num_items = $this->cart->total_items();\n\t\t$auto_disc_info = null;\n\n\t\tforeach ($this->auto_disc_array as $cart_items => $disc_info)\n\t\t{\n\t\t\tif($num_items >= $cart_items)\n\t\t\t{\n\t\t\t\t$auto_disc_info = $disc_info;\n\t\t\t}\n\t\t}\n\n\t\t$applied_disc = $this->cart->discount_info();\n\n\t\t//auto discount should be more than the applied disc (if any)\n\t\tif($applied_disc['percentage'] < $auto_disc_info['percentage'])\n\t\t{\n\t\t\t$this->_apply_discount( $auto_disc_info['coupon'] );\n\t\t}\t\t\n\t}", "private function storeDiscount(SlCustomer $customer, $discount) {\n $slCustomerPresetsDiscount = SlCustomerPresetsDiscount::where('sl_customer_id', $customer->id)->where('flag_delete', false)->first();\n if (!$slCustomerPresetsDiscount) {\n $slCustomerPresetsDiscount = new SlCustomerPresetsDiscount();\n $slCustomerPresetsDiscount->sl_customer_id = $customer->id;\n $slCustomerPresetsDiscount->flag_delete = false;\n }\n $slCustomerPresetsDiscount->discount_percentage = $discount;\n $slCustomerPresetsDiscount->save();\n }", "public function getDiscountCode()\n {\n return $this->discountCode;\n }", "public function store(DiscountRequest $request)\n {\n if (!userHasPermission('add-discount')) return permissionsException();\n\n $languages = $this->language->findAll();\n if ($request->discount_type == 1) {\n foreach ($languages as $language) {\n $request->request->remove('title:' . $language->code);\n $request->request->remove('description:' . $language->code);\n }\n }\n $this->discount->store($request);\n Session::flash('toast_success', 'Discount Add Successfully!');\n return redirect('admin/discount/create');\n }", "function new_customers_discount( $cart ) {\n // Only for logged in users\n // if ( ! is_user_logged_in() ) return; // We exit\n\n // Only for new customers without orders\n // if ( wc_get_customer_order_count( get_current_user_id() ) != 0 ) return; // We exit\n\n // Set HERE your categories (can be term IDs, slugs or names) in a coma separated array\n // $product = array('', '', '', '', '', '');\n\n $fee_amount = 0;\n\n $discount = 0;\n // Loop through cart items\n\n\n foreach( $cart->get_cart() as $cart_item ){\n \tswitch ($cart_item['product_id']) {\n \t\tcase 2582:\n \t\t$fee_amount = 10;\n \t\t$discount += $cart_item['line_subtotal']*$fee_amount/100;\n \t\tbreak;\n \t\tcase 2591:\n \t\t$fee_amount = 10;\n \t\t$discount += $cart_item['line_subtotal']*$fee_amount/100;\n \t\tbreak;\n \t}\n }\n\n $chosen_gateway = WC()->session->chosen_payment_method;\n \n if ( $chosen_gateway == 'cod' ) {\n \tif ( $fee_amount > 0 ){\n \t\t// $discount = $cart->cart_contents_total * ($fee_amount / 100);\n \t\t$cart->add_fee( __( 'Discount On EasyPaisa Mobile Account', 'woocommerce'), -$discount );\n \t}\n }\n}", "public function setCmsCategoryId($val){\n $this->CmsCategoryId=$val;\n }", "public function setDiscountSequence()\n {\n $this->discountSequence = [\n (string)DiscountType::LIMITED_TIME(),\n (string)DiscountType::PERIOD(),\n (string)DiscountType::QUANTITY(),\n ];\n }", "function _apply_discount($coupon)\n\t{\n\t\t$this->database->SaveCheatCode($coupon);\n\t\t$discount_percentage = 0;\n\t\t$coupon_info = $this->database->GetDiscountCoupon($coupon);\n\n\t\t//Run some conditional-check for code\n\t\tif($this->_can_apply_code($coupon_info))\n\t\t{\n\t\t\t$discount_percentage = $this->_getDiscount($coupon);\n\t\t\t$this->cart->apply_discount($coupon, $discount_percentage);\n\t\t}\n\n\t\t$this->_notify_discount_applied($discount_percentage, $coupon_info);\n\n\t}", "public function HM_CategoCuentas()\n {\n }", "public function setCategoryAttribute($value)\n {\n $this->attributes['category'] = strtoupper($value);\n }", "public function getDiscountDescription();", "public function applyDiscount()\n {\n if (request('discountType') == 1) {\n cart()->applyDiscount($percentage = request('red'));\n return $this->getCartDetails();\n }\n cart()->applyFlatDiscount($amount = request('discountInput'));\n\n return redirect()->route('cart');\n }", "function my_separate_category() {\n return 1;\n }", "public function setCategory($category)\n {\n if(strlen($category) <= 25 && strlen($category) > 0 && preg_match('#^[a-zA-Z- ]*$#', $category)) {\n $this->category = $category;\n }\n }", "public function setCategory() {\n /**\n *\n * @todo make a separate config file for the default category ?!\n */\n $defaultCategory = 1;\n $category = Category::find()->all();\n $newCat = $this->strProcessing($this->category);\n $k = NULL;\n if (!empty($newCat)) {\n foreach ($category as $value) {\n $cat = explode(',', $value['synonyms']);\n $cat = array_map(array($this, 'strProcessing'), $cat);\n $k = array_search($newCat, $cat);\n if ($k !== NULL && $k !== FALSE) {\n $k = $value['id'];\n break;\n }\n }\n }\n if ($k) {\n $this->category = $k;\n } else {\n $this->category = $defaultCategory;\n }\n return TRUE;\n }", "public function update(Tax $category): void\n {\n }", "public function withDiscountAmount($discount)\n {\n $this->_model['discount'] = $discount;\n return $this;\n }", "public function setPriceDiscount($priceDiscount)\n\t{\n\t\t$this->priceDiscount = $priceDiscount;\n\n\t\treturn $this;\n\t}", "function add_category($name, $price, $discount){\n\tglobal $db;\n\t$query = \n ' INSERT INTO categories\n (cat_categoryID, cat_categoryName, cat_price, cat_discount)\n VALUES\n (null, :name, :cat_price, :cat_discount)';\n $statement = $db->prepare($query);\n $statement->bindValue(':name', $name);\n $statement->bindValue(':cat_price', $price);\n $statement->bindValue(':cat_discount', $discount);\n $statement->execute();\n $statement->closeCursor();\n}", "public function set_coupon_discount_totals( $value = array() ) {\n\t\t$this->coupon_discount_totals = (array) $value;\n\t}", "function set_acl_category($category)\n {\n $this->acl_category = $category;\n foreach ($this->plugins as $name => $obj) {\n $this->plugins[$name]->set_acl_category($category);\n }\n }", "public function setDiscont($value)\n {\n $this->setDiscount($value);\n\n return $this;\n }", "public function setBaseDiscountAmount($amount);", "function fuc_discount($product, $percentage){\r\n $discountValue = $product / 100 * $percentage;\r\n $totalValue = $product - $discountValue; \r\n return $totalValue;\r\n\r\n}", "public function addDiscount($id_discount, $name, $value)\n\t{\n\t\treturn Db::getInstance()->AutoExecute(_DB_PREFIX_.'order_discount', array('id_order' => (int)($this->id), 'id_discount' => (int)($id_discount), 'name' => pSQL($name), 'value' => (float)($value)), 'INSERT');\n\t}", "public function set_category_id($category)\n {\n parent::set_category(0);\n }", "public function setDiscountDateCalculation(?string $value): void {\n $this->getBackingStore()->set('discountDateCalculation', $value);\n }", "public function setPricecomparisonCategoryView(Varien_Event_Observer $observer)\n\t{\n\t\t$cookieKey = Mage::helper('pricecomparison')->getCookieKey();\n\t\t$pcsCookie = Mage::getModel('core/cookie')->get($cookieKey);\n\t\t// $pcsId = Mage::app()->getRequest()->getParam('pcs', false);\n\t\t\n\t\t// if ($pcsCookie && !$pcsId) {\n\t\tif ($pcsCookie) {\n\t\t\t$productCollection = $observer->getEvent()->getCollection();\n\t\t\t$cookieData = explode('|', $pcsCookie);\n\t\t\t$pcsId = $cookieData[0];\n\t\t\t$pcsProductId = $cookieData[1];\n\t\t\t\n\t\t\tforeach ($productCollection as $product) {\n\t\t\t\t$productId = $product->getId();\n\t\t\t\t\n\t\t\t\tif ($productId === $pcsProductId) {\n\t\t\t\t\t$loadedProduct = Mage::getModel('catalog/product')->load($productId);\n\t\t\t\t\t\n\t\t\t\t\tif ($pcsPrice = $loadedProduct->getData($pcsId)) {\n\t\t\t\t\t\t$product->setFinalPrice($pcsPrice);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "public function setAttributes_discounted( $attributes_discounted ) {\n\t\t$this->attributes_discounted = $attributes_discounted;\n\t}", "public function getDiscountAmount();", "public function set_manual_discount($discount_data = FALSE)\r\n\t{\r\n\t\tif (is_array($discount_data) && ! empty($discount_data))\r\n\t\t{\r\n\t\t\t// Check that any submitted 'New value' discounts are only applied to the shipping total. \r\n\t\t\tif (isset($discount_data['column']) && isset($discount_data['calculation']) && ($discount_data['column'] != 'shipping_total') && ($discount_data['calculation'] == 3))\r\n\t\t\t{\r\n\t\t\t\treturn FALSE;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t// Merge the code and manual discounts together, then loop through data and compile an array of all discount ids currently in use.\r\n\t\t\t$existing_discounts = array_merge($this->flexi->cart_contents['settings']['discounts']['manual'], $this->flexi->cart_contents['settings']['discounts']['codes']);\r\n\t\t\t$existing_ids = array();\r\n\t\t\t\t\r\n\t\t\tforeach($existing_discounts as $existing_discount)\r\n\t\t\t{\r\n\t\t\t\t$existing_ids[] = $existing_discount['id'];\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t// If an id is not set in the submitted '$discount_data', or if a discount with a matching id already exists, set a new id. \r\n\t\t\tif (! isset($discount_data['id']) || in_array($discount_data['id'], $existing_ids))\r\n\t\t\t{\r\n\t\t\t\t$id = 0;\r\n\t\t\t\twhile (in_array('manual_'.$id, $existing_ids))\r\n\t\t\t\t{\r\n\t\t\t\t\t$id++; \r\n\t\t\t\t}\r\n\t\t\t\t$id = $discount_data['id'] = 'manual_'.$id;\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\t$id = $discount_data['id'];\r\n\t\t\t}\r\n\t\t\r\n\t\t\t// Set default values if not submitted.\r\n\t\t\t$discount_data['description'] = (! isset($discount_data['description'])) ? FALSE : $discount_data['description'];\r\n\t\t\t$discount_data['value'] = (! isset($discount_data['value'])) ? 0 : $discount_data['value'];\r\n\t\t\t$discount_data['column'] = (! isset($discount_data['column'])) ? 'total' : $discount_data['column'];\r\n\t\t\t$discount_data['calculation'] = (! isset($discount_data['calculation'])) ? 1 : $discount_data['calculation'];\r\n\t\t\t$discount_data['tax_method'] = (! isset($discount_data['tax_method'])) ? FALSE : $discount_data['tax_method'];\r\n\t\t\t$discount_data['void_reward_points'] = (! isset($discount_data['void_reward_points'])) ? FALSE : $discount_data['void_reward_points'];\r\n\t\t\t\r\n\t\t\t// Set the cart column the discount is targeting and use the value to act as the discounts array key. \r\n\t\t\t// This prevents multiple discounts being applied to the same cart column.\r\n\t\t\t$target_column = $discount_data['column'];\r\n\t\t\t\r\n\t\t\t// Loop through data and set to cart session summary.\r\n\t\t\tforeach($discount_data as $column => $column_value)\r\n\t\t\t{\r\n\t\t\t\tif ($column == 'value')\r\n\t\t\t\t{\r\n\t\t\t\t\t// If a valid discount value is not set, set the default value as zero. \r\n\t\t\t\t\t$column_value = ($this->non_negative($column_value)) ? $this->format_calculation($column_value, 2, TRUE) : 0;\r\n\t\t\t\t}\r\n\t\t\t\telse if ($column == 'column')\r\n\t\t\t\t{\r\n\t\t\t\t\t// If a valid column is not set, discount the 'total' column by default. \r\n\t\t\t\t\t$column_value = (in_array($column_value, array('item_summary_total', 'shipping_total', 'total'))) ? $column_value : 'total';\r\n\t\t\t\t}\r\n\t\t\t\telse if ($column == 'calculation') \r\n\t\t\t\t{\r\n\t\t\t\t\t// If a valid calculation method is not set, a 'percentage' based calculation is set by default.\r\n\t\t\t\t\t// 1 = Percentage Based, 2 = Flat Fee, 3 = New Value.\r\n\t\t\t\t\t$column_value = (in_array($column_value, array(1,2,3))) ? $column_value : 1;\r\n\t\t\t\t}\r\n\t\t\t\telse if ($column == 'tax_method')\r\n\t\t\t\t{\r\n\t\t\t\t\t// If a valid tax method is not set, the tax method is defined by whether cart prices ex/include taxes by default.\r\n\t\t\t\t\t// 0 = Carts Default Tax Method, 1 = Apply Tax Before Discount, 2 = Apply Discount Before Tax, 3 = Apply Discount Before Tax, Add Original Tax.\r\n\t\t\t\t\t$column_value = (in_array($column_value, array(0, 1,2,3))) ? $column_value : 0;\r\n\t\t\t\t}\r\n\t\t\t\telse if ($column == 'void_reward_points')\r\n\t\t\t\t{\r\n\t\t\t\t\t$column_value = (bool)$column_value;\r\n\t\t\t\t}\r\n\t\t\t\telse if (! in_array($column, array('id', 'description')))\r\n\t\t\t\t{\r\n\t\t\t\t\tcontinue;\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\t$this->flexi->cart_contents['settings']['discounts']['manual'][$target_column][$column] = $column_value;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\treturn TRUE;\r\n\t\t}\r\n\t\t\r\n\t\treturn FALSE;\r\n\t}", "function update_category_cache()\n {\n }", "private function updateProductDiscount(\n ProductInterface $product,\n Request $request\n ): void {\n $discountPercent = $request->request->get('discount_percent') !== '' ? (float) $request->request->get('discount_percent') : null;\n $discountLimitType = $request->request->get('discount_limit_type') !== '' ? $request->request->get('discount_limit_type') : null;\n $discountFromDate = $request->request->get('discount_from_date') !== '' ? $request->request->get('discount_from_date') : null;\n $discountToDate = $request->request->get('discount_to_date') !== '' ? $request->request->get('discount_to_date') : null;\n\n $variants = $product->getVariants();\n foreach ($variants as $variant) {\n // Variant to change\n $variantPricing = $variant->getChannelPricings()->first();\n\n // Change percent\n if ($discountPercent !== null) {\n $variantPricing->setDiscount($discountPercent / 100);\n }\n\n // Continue if no change type\n if ($discountLimitType === self::LIMIT_NO_CHANGE) {\n continue;\n }\n // Discount type\n $variantPricing->setDiscountLimitType($discountLimitType === self::LIMIT_NONE ? null : $discountLimitType);\n\n // Date type discount\n if ($discountLimitType === self::LIMIT_DATETIME) {\n if ($discountFromDate && $discountToDate) {\n $dateFrom = \\DateTime::createFromFormat('Y-m-d', $discountFromDate);\n $dateTo = \\DateTime::createFromFormat('Y-m-d', $discountToDate);\n\n $variantPricing->setDiscountFrom($dateFrom);\n $variantPricing->setDiscountTo($dateTo);\n }\n\n if ($discountFromDate && !$discountToDate) {\n $dateFrom = \\DateTime::createFromFormat('Y-m-d', $discountFromDate);\n\n $variantPricing->setDiscountFrom($dateFrom);\n $variantPricing->setDiscountTo(null);\n }\n\n if (!$discountFromDate && $discountToDate) {\n $dateTo = \\DateTime::createFromFormat('Y-m-d', $discountToDate);\n\n $variantPricing->setDiscountFrom(null);\n $variantPricing->setDiscountTo($dateTo);\n }\n }\n }\n }", "public function getDiscountId()\n\t{\n\t\treturn $this->discountId;\n\t}", "public function usediscount()\n {\n $this->extend(\"onBeforeUseDiscount\");\n\n $code_to_search = $this->request->param(\"ID\");\n $code = false;\n\n if (!$code_to_search) {\n return $this->httpError(404, \"Page not found\");\n }\n\n // First check if the discount is already added (so we don't\n // query the DB if we don't have to).\n if (!$this->discount || ($this->discount && $this->discount->Code != $code_to_search)) {\n $codes = Discount::get()\n ->filter(\"Code\", $code_to_search)\n ->exclude(\"Expires:LessThan\", date(\"Y-m-d\"));\n\n if ($codes->exists()) {\n $code = $codes->first();\n $this->discount = $code;\n $this->save();\n }\n } elseif ($this->discount && $this->discount->Code == $code_to_search) {\n $code = $this->discount;\n }\n\n return $this\n ->customise(array(\n \"Discount\" => $code\n ))->renderWith(array(\n 'ShoppingCart_discount',\n 'Checkout',\n 'Page'\n ));\n }", "public function updateCate()\n\t{\n\t\tif (cookie('staffAccount') != '') {\n\t\t\t$category = $_POST['upcategory'];\n\t\t\t$category_id = $_POST['upcategory_id'];\n\t\t\t$sql = \" update lib_book_species set category = '{$category}' where category in \n\t\t\t\t\t(select category from lib_category where category_id = {$category_id});\n\t\t\t\t\tupdate lib_category set category='\" . $category . \"' where category_id='\" . $category_id . \"';\n\t\t\t\t\t\";\n\t\t\t$cate = D('Category');\n\t\t\t$return = $cate->execute($sql);\n\n\t\t\tif ($return) {\n\t\t\t\t$json = json_encode(array(\n\t\t\t\t\t'code' => 'fail',\n\t\t\t\t\t'msg' => 'Modify successfully!'\n\t\t\t\t));\n\t\t\t\techo $json;\n\n\t\t\t} else {\n\t\t\t\t$json = json_encode(array(\n\t\t\t\t\t'code' => 'fail',\n\t\t\t\t\t'msg' => 'SQL Error!'\n\t\t\t\t));\n\t\t\t\techo $json;\n\t\t\t}\n\n\t\t} else {\n\t\t\t$json = json_encode(array(\n\t\t\t\t'code' => 'fail',\n\t\t\t\t'msg' => 'Please Login!'\n\t\t\t));\n\t\t\techo $json;\n\t\t}\n\t}", "public function setCategoryIdAttribute($value)\n\t{\n\t\t$this->attributes['category_id'] = ($value) ? $value : null;\n\t}", "public function adddiscountAction() {\n $request = $this->getRequest();\n\n if ( $request->isPost() ){\n $post = $request->getPost();\n\n $discountCodeId = $post['discountId'];\n\n if(!is_null($discountCodeId)) {\n\n //create discount object\n try {\n $rabatt = new Yourdelivery_Model_Rabatt_Code(null, $discountCodeId);\n\n $count = 0;\n foreach ($this->company->getEmployees() as $employeer) {\n $t = $employeer;\n\n //create customer object\n try {\n //$customer = new Yourdelivery_Model_Customer(1123);\n\n //add discount to the customer\n if (!$employeer->setDiscount($rabatt)) {\n $this->error(__b(\"Discount code could not associated to customer \") . $customer->getPrename() . ' ' . $customer->getName() . '(#' . $customer->getId());\n }\n\n }\n catch ( Yourdelivery_Exception_Database_Inconsistency $e ){\n $this->error(__b(\"Customer %s %s (#%s) is non-existant\", $customer->getPrename(), $customer->getName(), $customer->getId()));\n }\n \n $count++;\n }\n\n if ($count == 0) {\n $this->success(__b(\"Company doesn't have employees. Discount code could not be associated to anyone\"));\n }\n else {\n $this->success(__b(\"Discount code %s was successfully associated to %s employees\", $rabatt->getName(), $count));\n $this->logger->adminInfo(sprintf(\"Discount code %s (#%d) was assigned to %d employeers of company #%d\",\n $rabatt->getName(), $rabatt->getId(), $count, $this->company->getId()));\n }\n }\n catch ( Yourdelivery_Exception_Database_Inconsistency $e ){\n $this->error(__b(\"This discount code is non-existant\"));\n }\n\n }\n }\n\n return $this->_redirect('/administration_company_edit/assoc/companyid/' . $this->company->getId());\n }", "public function setUpdateCategory(?UpdateCategory $value): void {\n $this->getBackingStore()->set('updateCategory', $value);\n }", "public function setID($cid) { if($cid == faq_build_clean_input($cid,\"id\")) $this->category_id = $cid; }", "public function addItemDiscountAmount($amount)\n {\n $this->itemDiscountAmount += $amount;\n }" ]
[ "0.7282492", "0.70448494", "0.64966077", "0.63974935", "0.6353954", "0.6159483", "0.61584276", "0.6015278", "0.59932464", "0.59490824", "0.59362257", "0.5879625", "0.5874608", "0.5854056", "0.58503777", "0.58468616", "0.58161867", "0.5776116", "0.5737397", "0.5733235", "0.5696709", "0.5679949", "0.5661583", "0.5645561", "0.55803055", "0.5562256", "0.5562256", "0.55408406", "0.5540782", "0.55387175", "0.5527404", "0.5518022", "0.55164546", "0.5514214", "0.5512048", "0.5509866", "0.55076146", "0.5477153", "0.54571915", "0.54417616", "0.5415187", "0.5413841", "0.540983", "0.5407894", "0.5407894", "0.5407894", "0.5407894", "0.5407894", "0.5407894", "0.54064494", "0.540593", "0.54032105", "0.53950274", "0.538385", "0.538189", "0.5378826", "0.53787696", "0.53736013", "0.5367586", "0.5361189", "0.5342051", "0.5341378", "0.5339855", "0.5331618", "0.5331134", "0.5326258", "0.5317567", "0.53166944", "0.5311924", "0.530284", "0.52904433", "0.5285896", "0.52744263", "0.52670753", "0.5263623", "0.5258391", "0.5257036", "0.5248951", "0.52470076", "0.52461594", "0.5226407", "0.5214597", "0.52114284", "0.5193184", "0.51918375", "0.5188797", "0.5187767", "0.5178408", "0.51687235", "0.51682055", "0.5156097", "0.5155241", "0.5146601", "0.51394117", "0.5134064", "0.513325", "0.5119928", "0.51094556", "0.5107951", "0.51073724", "0.51046216" ]
0.0
-1
Target: Category and subcategories. "Set discount to category and subcategories"
protected static function avail_target_cat_all($filter_items, $items, $target, $rule, $sku_id) { // Если условие не задано, прерываем обработку if (empty($target->condition) || !$filter_items) { return false; } $discount_items = self::filter_by_cat_all($items, (array) $target->condition); return self::calculate_target_discount($target, $discount_items, $rule, $sku_id); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function apply_special_category_discount($category, $count, &$disc_amount) {\r\n switch($category) {\r\n case 99999:\r\n case 99998:\r\n if ($count > 100) {\r\n $disc_amount = 50; \r\n }\r\n break; \r\n case 99997:\r\n $disc_amount = 75;\r\n break;\r\n }\r\n }", "public function AssignDiscount()\n\t{\t\n\t}", "public function testUpdateItemSubCategory()\n {\n }", "public function setDiscount($value)\n {\n $this->data->amount->subtotals->discount = (float) $value;\n\n return $this;\n }", "function apply_special_item_discount($id, $count, &$disc_amount) {\r\n switch($id) {\r\n case 99999:\r\n case 99998:\r\n if ($count > 100) {\r\n $disc_amount = 50; \r\n }\r\n break; \r\n case 99997:\r\n $disc_amount = 75;\r\n break; \r\n }\r\n }", "protected function calculateDiscount() : void{\r\n $percentage = ($this->discounted_value * 100) / $this->order->getTrueTotal();\r\n $new_total = $this->order->getTrueTotal() - $this->discounted_value;\r\n\r\n $this->order_discount_value = $this->discounted_value;\r\n $this->order_discount_percentage = $percentage;\r\n $this->order_discount_reason = \"For every \" . $this->products_nr . \" products from category #\" . $this->category_id . \" you get one free. You got: \";\r\n foreach($this->items_matching as $item){\r\n $this->order_discount_reason .= floor($item[\"qty\"] / $this->products_nr) . \" x '\" . $item[\"description\"] . \"' (€\". $item[\"price\"] .\" each) ; \";\r\n }\r\n $this->order_new_total = $new_total;\r\n }", "public function testSetGetDiscount()\n {\n $this->item->setPrice(85.00);\n $this->item->setQuantity(1);\n $this->item->addDiscount(\n (new FlatDiscount())\n ->setFigure(15.00)\n );\n\n $this->assertEquals($this->item->getPriceTotal(), 85.00);\n $this->assertEquals($this->item->getNetTotal(), 70.00);\n $this->assertEquals($this->item->getDiscount(), 15.00);\n }", "public function applyGlobalDiscount($discount_rate)\n {\n }", "function apply_cart_discounts_after_tax() {\t\n\t\t\t\n\t\t\tif ($this->applied_coupons) foreach ($this->applied_coupons as $code) :\n\t\t\t\t$coupon = new cmdeals_coupon( $code );\n\t\t\t\t\n\t\t\t\tdo_action( 'cmdeals_cart_discount_after_tax_' . $coupon->type, $coupon );\n\t\t\t\t\n\t\t\t\tif ( !$coupon->apply_before_tax() && $coupon->is_valid() ) :\n\t\t\t\t\t\n\t\t\t\t\tswitch ($coupon->type) :\n\t\t\t\t\t\n\t\t\t\t\t\tcase \"fixed_cart\" :\n\t\n\t\t\t\t\t\t\t$this->discount_total = $this->discount_total + $coupon->amount;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\n\t\t\t\t\t\tcase \"percent\" :\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t$percent_discount = (round( $this->cart_contents_total + $this->tax_total , 2) / 100 ) * $coupon->amount;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t$this->discount_total = $this->discount_total + $percent_discount;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\n\t\t\t\t\tendswitch;\n\t\n\t\t\t\tendif;\n\t\t\tendforeach;\n\t\t}", "public function discountBifurcation(Varien_Event_Observer $observer)\n {\n $rule = $observer->getEvent()->getRule();\n $result = $observer->getEvent()->getResult();\n $itemId = $observer->getEvent()->getItem()->getItemId();\n //set Unique key\n $curUnique= $rule->getRuleId().'_'.$itemId;\n //check if Mage registry unique call set\n if(Mage::registry('uniqueCall')!==null){\n //if check in array\n $uniqueCalls = Mage::registry('uniqueCall');\n if( in_array($curUnique,$uniqueCalls)){\n return;\n }else{\n //unset existing registry. also take existing array in variable\n Mage::unregister('uniqueCall');\n $uniqueCalls[]= $curUnique ;\n //set registry again with new array include $uniqueCall into it\n Mage::register('uniqueCall',$uniqueCalls);\n }\n }else{\n //set registry again with new array include $uniqueCall into it\n $array = array();\n $array[]=$rule->getRuleId().'_'.$itemId;\n Mage::register('uniqueCall',$array);\n\n } \n\n //condition for the Promotional coupons\n if ( $rule->getCouponType() == Mage_SalesRule_Model_Rule::COUPON_TYPE_NO_COUPON ) {\n $promotionDiscount = 0;\n $promotionDiscount = Mage::registry('promotion');\n if (Mage::registry('promotion')!==null){\n Mage::unregister('promotion');\n }\n if (Mage::registry('promo_lable')!==null){\n Mage::unregister('promo_lable');\n }\n $promotionDiscount += $result->getDiscountAmount();\n Mage::register('promotion', $promotionDiscount);\n Mage::register('promo_lable',$rule->getName());\n } elseif ( $rule->getCouponType() == self::COUPON_TYPE_FUE_GENERATED ) {\n $couponDiscount = 0;\n $couponDiscount = Mage::registry('coupon');\n if(Mage::registry('coupon')!==null){\n Mage::unregister('coupon');\n }\n //sum up all the values of discounted coupons\n $couponDiscount += $result->getDiscountAmount();\n Mage::register('coupon',$couponDiscount);\n }\n $quote = $observer->getEvent()->getQuote();\n $quoteAddress = $observer->getEvent()->getAddress();\n //set discounted coupons and promotional coupons amount in quote\n $quote->setCouponDiscount(Mage::registry('coupon'));\n $quote->setPromotionalDiscount(Mage::registry('promotion'));\n\n if (Mage::getStoreConfig('promodiscount/promodiscount/use_default')) {\n $quote->setPromoLable(Mage::getStoreConfig('promodiscount/promodiscount/default_lable'));\n } else {\n if (Mage::registry('promo_lable')) {\n $quote->setPromoLable(Mage::registry('promo_lable'));\n } else {\n $quote->setPromoLable(Mage::getStoreConfig('promodiscount/promodiscount/default_lable'));\n }\n }\n \n $quoteAddress->setCouponDiscount(Mage::registry('coupon'));\n $quoteAddress->setPromotionalDiscount(Mage::registry('promotion'));\n if (Mage::registry('promo_lable')) {\n $quoteAddress->setPromoLable(Mage::registry('promo_lable'));\n } else {\n $quoteAddress->setPromoLable(Mage::getStoreConfig('promodiscount/promodiscount/default_lable'));\n }\n }", "public function setDiscount(int $discount): void\n {\n $this->discount = ($discount > 0 && $discount <= 50) ? $discount : 0;\n\n }", "function setup() {\r\n // \"Buy more than 100 items, get 50 (% or $, as per admin) off\" \r\n // $this->add_extra_level_discount(100, 50);\r\n }", "public function updateAffectedPlans(Discount $discount)\n {\n }", "function set_discount($discount_id = FALSE)\n\t\t{\n\t\t\t$this->load->model('demo_cart_model');\n\t\t\t\n\t\t\t$this->demo_cart_model->demo_set_discount($discount_id);\n\t\t\t\n\t\t\tredirect('cart');\n\t\t}", "function apply_deals_discounts_after_tax( $values, $price ) {\n\t\t\t\n\t\t\tif ($this->applied_coupons) foreach ($this->applied_coupons as $code) :\n\t\t\t\t$coupon = new cmdeals_coupon( $code );\n\t\t\t\t\n\t\t\t\tdo_action( 'cmdeals_deals_discount_after_tax_' . $coupon->type, $coupon );\n\t\t\t\t\n\t\t\t\tif ($coupon->type!='fixed_deals' && $coupon->type!='percent_deals') continue;\n\t\t\t\t\n\t\t\t\tif ( !$coupon->apply_before_tax() && $coupon->is_valid() ) :\n\t\t\t\t\t\n\t\t\t\t\t$this_item_is_discounted = false;\n\t\t\n\t\t\t\t\t// Specific deals ID's get the discount\n\t\t\t\t\tif (sizeof($coupon->deal_ids)>0) :\n\t\t\t\t\t\t\n\t\t\t\t\t\tif ((in_array($values['deal_id'], $coupon->deal_ids) || in_array($values['variation_id'], $coupon->deal_ids))) :\n\t\t\t\t\t\t\t$this_item_is_discounted = true;\n\t\t\t\t\t\tendif;\n\t\t\t\t\t\n\t\t\t\t\telse :\n\t\t\t\t\t\t\n\t\t\t\t\t\t// No deals ids - all items discounted\n\t\t\t\t\t\t$this_item_is_discounted = true;\n\t\t\t\t\t\n\t\t\t\t\tendif;\n\t\t\n\t\t\t\t\t// Specific deals ID's excluded from the discount\n\t\t\t\t\tif (sizeof($coupon->exclude_deals_ids)>0) :\n\t\t\t\t\t\t\n\t\t\t\t\t\tif ((in_array($values['deal_id'], $coupon->exclude_deals_ids) || in_array($values['variation_id'], $coupon->exclude_deals_ids))) :\n\t\t\t\t\t\t\t$this_item_is_discounted = false;\n\t\t\t\t\t\tendif;\n\t\t\t\t\t\t\n\t\t\t\t\tendif;\n\t\t\t\t\t\n\t\t\t\t\t// Apply filter\n\t\t\t\t\t$this_item_is_discounted = apply_filters( 'cmdeals_item_is_discounted', $this_item_is_discounted, $values, $before_tax = false );\n\t\t\t\t\t\n\t\t\t\t\t// Apply the discount\n\t\t\t\t\tif ($this_item_is_discounted) :\n\t\t\t\t\t\tif ($coupon->type=='fixed_deals') :\n\t\t\t\t\t\t\n\t\t\t\t\t\t\tif ($price < $coupon->amount) :\n\t\t\t\t\t\t\t\t$discount_amount = $price;\n\t\t\t\t\t\t\telse :\n\t\t\t\t\t\t\t\t$discount_amount = $coupon->amount;\n\t\t\t\t\t\t\tendif;\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t$this->discount_total = $this->discount_total + ( $discount_amount * $values['quantity'] );\n\t\t\t\t\t\t\t\n\t\t\t\t\t\telseif ($coupon->type=='percent_deals') :\n\t\t\t\t\t\t\t$this->discount_total = $this->discount_total + ( $price / 100 ) * $coupon->amount;\n\t\t\t\t\t\tendif;\n\t\t\t\t\tendif;\n\t\t\t\t\t\n\t\t\t\tendif;\n\t\t\tendforeach;\n\t\t}", "public function set_coupon_discount_totals( $value = array() ) {\n\t\t$this->coupon_discount_totals = (array) $value;\n\t}", "public static function bogo_apply_disc($order_id,$promotion_id,$prmdisc_id,$prmdisc_bogo_sbmnu,$prmdisc_bogo_sbmnu_dish,$prmdisc_bogo_qty,$disc_amt_type,$disc_amt){\r \t//echo \"$order_id,$promotion_id,$prmdisc_id,$prmdisc_bogo_sbmnu,$prmdisc_bogo_sbmnu_dish,$prmdisc_bogo_qty,$disc_amt_type,$disc_amt\";\r\t\t//..Check if discount is with sub menu item is selected\r\t\tif(is_gt_zero_num($prmdisc_bogo_sbmnu_dish)){\r\t\t\t//..do nothing..because we already ahve submenudishid\r\t\t}else{\r\t\t //..Get all submenu dish ids from submenu..\r\t\t\t$rs_apl_disc_items= tbl_submenu_dishes::getSubMenuItems($prmdisc_bogo_sbmnu);\r\t\t\tif(is_not_empty($rs_apl_disc_items)){\r\t\t\t\t$prmdisc_bogo_sbmnu_dish=$rs_apl_disc_items;\r\t\t\t}else{\r\t\t\t\t$strOpMsg= \"No items found to apply discount\" ;\r\t\t\t\treturn 0;\r\t\t\t}\r\t\t}\t\t\r \t\t//...Check if the item is in the order detail\r\t\t$tmp_fnd=0;\r\t\t$ord_det_items=tbl_order_details::readArray(array(ORD_DTL_ORDER_ID=>$order_id,ORD_DTL_SBMENU_DISH_ID=>$prmdisc_bogo_sbmnu_dish,ORDPROM_DISCOUNT_AMT=>0),$tmp_fnd,1,0);\t\t\t\t\t\t\t\r\t\tif($tmp_fnd>0){\t\t \r\t\t\t//..item presents in order detail wihtout disocunt\r\t\t\t//..loop through the all the order items records\r\t\t\tforeach($ord_det_items as $order_itm){\r\t\t\t\t //..now check if the quantity >= disc qty\t\t\t\t\t \r\t\t\t\t if($order_itm[ORD_DTL_QUANTITY]>=$prmdisc_bogo_qty){\r\t\t\t\t \t //..Right item to apply discount\r\t\t\t\t\t //..Calculate discount amount\t\r\t\t\t\t\t$discount_amount=tbl_order_details::getDiscountAmnt($disc_amt_type,$disc_amt,$order_itm[ORD_DTL_PRICE]);\r\t\t\t\t\t//..Update the order detail with discount and promot\r\t\t\t\t\t$success=tbl_order_details::update_item_with_discount($order_itm[ORD_DTL_ID],$promotion_id,$prmdisc_id,$discount_amount);\t\r\t\t\t\t\t\t\t\t\t\t\t \r\t\t\t\t }\r\t\t\t}\r\t\t\tunset($ord_det_items);\t\r\t\t}else{\r\t\t\t$strOpMsg= \"Item not present in your order or alreday discounted\" ;\r\t\t}\t\r\t\treturn 1;\r }", "function _apply_auto_disc()\n\t{\n\t\t$num_items = $this->cart->total_items();\n\t\t$auto_disc_info = null;\n\n\t\tforeach ($this->auto_disc_array as $cart_items => $disc_info)\n\t\t{\n\t\t\tif($num_items >= $cart_items)\n\t\t\t{\n\t\t\t\t$auto_disc_info = $disc_info;\n\t\t\t}\n\t\t}\n\n\t\t$applied_disc = $this->cart->discount_info();\n\n\t\t//auto discount should be more than the applied disc (if any)\n\t\tif($applied_disc['percentage'] < $auto_disc_info['percentage'])\n\t\t{\n\t\t\t$this->_apply_discount( $auto_disc_info['coupon'] );\n\t\t}\t\t\n\t}", "public function getSubtotalDiscount()\n {\n $this->initializeSubtotals();\n\n return $this->getIfSet('discount', $this->data->amount->subtotals);\n }", "public function SumItemDiscountToSubTotal($request)\n {\n if (empty($request['discount'])) {\n $sub_total = $request['price']*$request['qty'];\n } else {\n $sub_total = ($request['price'] - ($request['discount']/100*$request['price']))*$request['qty'];\n }\n return $sub_total;\n }", "public function detectCombos()\n {\n foreach ($this->order->getProducts() as $k => $product) {\n if ($product->getCategory() == 'Shampoo') {\n foreach ($this->order->getProducts() as $key => $productB) {\n if ($productB->getCategory() == 'Conditioner') {\n $productB->setDiscount(0.5);\n }\n }\n }\n }\n }", "public function createParentDiscount()\n {\n ini_set('max_execution_time', 0);\n\n $doctrine = $this->getDoctrine();\n $entityManager = $doctrine->getManager();\n $discountRepository = $doctrine->getRepository('App:Discount');\n $discounts = $discountRepository->findWithOutParent();\n\n if($discounts) {\n foreach ($discounts as $parent) {\n /**\n * @var Discount $child\n */\n /**\n * @var Discount $parent\n */\n $child = clone $parent;\n\n $child->setParent($parent);\n\n $entityManager->persist($parent);\n $entityManager->persist($child);\n $entityManager->flush();\n }\n\n echo 'done';\n }\n }", "public function applyCartDiscount(Varien_Event_Observer $observer)\n { \n try\n { \n $bundle_product_ids = [];\n $quote_product_ids = [];\n $cookieValue = Mage::getModel('core/cookie')->get('ivid');\n $userBundleCollection = Mage::getModel('increasingly_analytics/bundle')->getCollection()->addFieldToFilter('increasingly_visitor_id',$cookieValue);\n $items = $observer->getEvent()->getQuote()->getAllItems();\n $eligibleProducts = [];\n $discount = 0;\n foreach ($items as $item) {\n array_push($quote_product_ids, $item->getProductId());\n }\n foreach ($userBundleCollection as $bundle) {\n //First Bundle products\n $bundle_product_ids = explode(',', $bundle->getProductIds()); \n $productsIds = array_intersect($quote_product_ids, $bundle_product_ids);\n if(count($productsIds) == count($bundle_product_ids) )\n $discount += $bundle->getDiscountPrice();\n }\n\n if($discount > 0){\n $quote=$observer->getEvent()->getQuote();\n $quoteid=$quote->getId();\n $discountAmount=$discount;\n if($quoteid) { \n if($discountAmount>0) {\n $total=$quote->getBaseSubtotal();\n $quote->setSubtotal(0);\n $quote->setBaseSubtotal(0);\n\n $quote->setSubtotalWithDiscount(0);\n $quote->setBaseSubtotalWithDiscount(0);\n\n $quote->setGrandTotal(0);\n $quote->setBaseGrandTotal(0);\n \n\n $canAddItems = $quote->isVirtual()? ('billing') : ('shipping'); \n foreach ($quote->getAllAddresses() as $address) {\n\n $address->setSubtotal(0);\n $address->setBaseSubtotal(0);\n\n $address->setGrandTotal(0);\n $address->setBaseGrandTotal(0);\n\n $address->collectTotals();\n\n $quote->setSubtotal((float) $quote->getSubtotal() + $address->getSubtotal());\n $quote->setBaseSubtotal((float) $quote->getBaseSubtotal() + $address->getBaseSubtotal());\n\n $quote->setSubtotalWithDiscount(\n (float) $quote->getSubtotalWithDiscount() + $address->getSubtotalWithDiscount()\n );\n $quote->setBaseSubtotalWithDiscount(\n (float) $quote->getBaseSubtotalWithDiscount() + $address->getBaseSubtotalWithDiscount()\n );\n\n $quote->setGrandTotal((float) $quote->getGrandTotal() + $address->getGrandTotal());\n $quote->setBaseGrandTotal((float) $quote->getBaseGrandTotal() + $address->getBaseGrandTotal());\n\n $quote ->save(); \n\n $quote->setGrandTotal($quote->getBaseSubtotal()-$discountAmount)\n ->setBaseGrandTotal($quote->getBaseSubtotal()-$discountAmount)\n ->setSubtotalWithDiscount($quote->getBaseSubtotal()-$discountAmount)\n ->setBaseSubtotalWithDiscount($quote->getBaseSubtotal()-$discountAmount)\n ->save(); \n\n\n if($address->getAddressType()==$canAddItems) {\n //echo $address->setDiscountAmount; exit;\n $address->setSubtotalWithDiscount((float) $address->getSubtotalWithDiscount()-$discountAmount);\n $address->setGrandTotal((float) $address->getGrandTotal()-$discountAmount);\n $address->setBaseSubtotalWithDiscount((float) $address->getBaseSubtotalWithDiscount()-$discountAmount);\n $address->setBaseGrandTotal((float) $address->getBaseGrandTotal()-$discountAmount);\n if($address->getDiscountDescription()){\n $address->setDiscountAmount(-($address->getDiscountAmount()-$discountAmount));\n $address->setDiscountDescription($address->getDiscountDescription().', Custom Discount');\n $address->setBaseDiscountAmount(-($address->getBaseDiscountAmount()-$discountAmount));\n }else {\n $address->setDiscountAmount(-($discountAmount));\n $address->setDiscountDescription('Custom Discount');\n $address->setBaseDiscountAmount(-($discountAmount));\n }\n $address->save();\n }//end: if\n } //end: foreach\n //echo $quote->getGrandTotal();\n\n foreach($quote->getAllItems() as $item){\n //We apply discount amount based on the ratio between the GrandTotal and the RowTotal\n $rat=$item->getPriceInclTax()/$total;\n $ratdisc=$discountAmount*$rat;\n $item->setDiscountAmount(($item->getDiscountAmount()+$ratdisc) * $item->getQty());\n $item->setBaseDiscountAmount(($item->getBaseDiscountAmount()+$ratdisc) * $item->getQty())->save(); \n }\n } \n }\n }\n }\n catch(Exception $e)\n {\n Mage::log(\"Remove from cart tracking - \" . $e->getMessage(), null, 'Increasingly_Analytics.log');\n }\n\n }", "public function applyProductCategoryWholesaleDiscount( $wholesalePrice , $productID , $userWholesaleRole ) {\n\n if ( empty( $wholesalePrice ) && !empty( $userWholesaleRole ) ) {\n\n $product = wc_get_product( $productID );\n $product_price = get_option( 'wwpp_settings_explicitly_use_product_regular_price_on_discount_calc' ) == 'yes' ? $product->get_regular_price() : $product->get_price();\n $post_id = ( WWP_Helper_Functions::wwp_get_product_type( $product ) === 'variation' ) ? WWP_Helper_Functions::wwp_get_parent_variable_id( $product ) : $productID;\n\n if ( !is_null( $post_id ) ) {\n\n $terms = get_the_terms( $post_id , 'product_cat' );\n if ( !is_array( $terms ) )\n $terms = array();\n\n $lowest_discount = null;\n $highest_discount = null;\n\n foreach ( $terms as $term ) {\n\n $category_wholesale_prices = get_option( 'taxonomy_' . $term->term_id );\n\n if ( is_array( $category_wholesale_prices ) && array_key_exists( $userWholesaleRole[ 0 ] . '_wholesale_discount' , $category_wholesale_prices ) ) {\n\n $curr_discount = $category_wholesale_prices[ $userWholesaleRole[ 0 ] . '_wholesale_discount' ];\n\n if ( !empty( $curr_discount ) ) {\n\n if ( is_null( $lowest_discount ) || $curr_discount < $lowest_discount )\n $lowest_discount = $curr_discount;\n\n if ( is_null( $highest_discount ) || $curr_discount > $highest_discount )\n $highest_discount = $curr_discount;\n\n }\n\n }\n\n }\n\n $category_wholsale_price_logic = get_option( 'wwpp_settings_multiple_category_wholesale_discount_logic' );\n\n if ( $category_wholsale_price_logic == 'highest' ) {\n\n if ( !is_null( $highest_discount ) )\n $wholesalePrice = round( $product_price - ( $product_price * ( $highest_discount / 100 ) ) , 2 );\n\n } else {\n\n if ( !is_null( $lowest_discount ) )\n $wholesalePrice = round( $product_price - ( $product_price * ( $lowest_discount / 100 ) ) , 2 );\n\n }\n\n if ( $wholesalePrice < 0 )\n $wholesalePrice = 0;\n\n }\n\n }\n\n return $wholesalePrice;\n\n }", "public function setDiscount(string $discount)\n\t{\n\t\t$this->addKeyValue('Discount', $discount); \n\n\t}", "public function setDiscount($discount)\r\n {\r\n $this->discount = $discount;\r\n\r\n return $this;\r\n }", "function new_customers_discount( $cart ) {\n // Only for logged in users\n // if ( ! is_user_logged_in() ) return; // We exit\n\n // Only for new customers without orders\n // if ( wc_get_customer_order_count( get_current_user_id() ) != 0 ) return; // We exit\n\n // Set HERE your categories (can be term IDs, slugs or names) in a coma separated array\n // $product = array('', '', '', '', '', '');\n\n $fee_amount = 0;\n\n $discount = 0;\n // Loop through cart items\n\n\n foreach( $cart->get_cart() as $cart_item ){\n \tswitch ($cart_item['product_id']) {\n \t\tcase 2582:\n \t\t$fee_amount = 10;\n \t\t$discount += $cart_item['line_subtotal']*$fee_amount/100;\n \t\tbreak;\n \t\tcase 2591:\n \t\t$fee_amount = 10;\n \t\t$discount += $cart_item['line_subtotal']*$fee_amount/100;\n \t\tbreak;\n \t}\n }\n\n $chosen_gateway = WC()->session->chosen_payment_method;\n \n if ( $chosen_gateway == 'cod' ) {\n \tif ( $fee_amount > 0 ){\n \t\t// $discount = $cart->cart_contents_total * ($fee_amount / 100);\n \t\t$cart->add_fee( __( 'Discount On EasyPaisa Mobile Account', 'woocommerce'), -$discount );\n \t}\n }\n}", "public function applyDiscount(Discount $discount){\n\t\tif($this->discount == NULL){\n\t\t\t$this->finalPrice = $this->price*(100-$discount->percent/100);\n\t\t\t$this->discount = $discount;\n\t\t}\n\t\treturn $this;\n\t}", "function get_discounted_price( $values, $price, $add_totals = false ) {\n\t\n\t\t\tif ($this->applied_coupons) foreach ($this->applied_coupons as $code) :\n\t\t\t\t$coupon = new cmdeals_coupon( $code );\n\t\t\t\t\n\t\t\t\tif ( $coupon->apply_before_tax() && $coupon->is_valid() ) :\n\t\t\t\t\t\n\t\t\t\t\tswitch ($coupon->type) :\n\t\t\t\t\t\n\t\t\t\t\t\tcase \"fixed_deals\" :\n\t\t\t\t\t\tcase \"percent_deals\" :\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t$this_item_is_discounted = false;\n\t\t\t\t\n\t\t\t\t\t\t\t// Specific deals ID's get the discount\n\t\t\t\t\t\t\tif (sizeof($coupon->deal_ids)>0) :\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tif ((in_array($values['deal_id'], $coupon->deal_ids) || in_array($values['variation_id'], $coupon->deal_ids))) :\n\t\t\t\t\t\t\t\t\t$this_item_is_discounted = true;\n\t\t\t\t\t\t\t\tendif;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\telse :\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t// No deals ids - all items discounted\n\t\t\t\t\t\t\t\t$this_item_is_discounted = true;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tendif;\n\t\t\t\t\n\t\t\t\t\t\t\t// Specific deals ID's excluded from the discount\n\t\t\t\t\t\t\tif (sizeof($coupon->exclude_deals_ids)>0) :\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tif ((in_array($values['deal_id'], $coupon->exclude_deals_ids) || in_array($values['variation_id'], $coupon->exclude_deals_ids))) :\n\t\t\t\t\t\t\t\t\t$this_item_is_discounted = false;\n\t\t\t\t\t\t\t\tendif;\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tendif;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Apply filter\n\t\t\t\t\t\t\t$this_item_is_discounted = apply_filters( 'cmdeals_item_is_discounted', $this_item_is_discounted, $values, $before_tax = true );\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Apply the discount\n\t\t\t\t\t\t\tif ($this_item_is_discounted) :\n\t\t\t\t\t\t\t\tif ($coupon->type=='fixed_deals') :\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tif ($price < $coupon->amount) :\n\t\t\t\t\t\t\t\t\t\t$discount_amount = $price;\n\t\t\t\t\t\t\t\t\telse :\n\t\t\t\t\t\t\t\t\t\t$discount_amount = $coupon->amount;\n\t\t\t\t\t\t\t\t\tendif;\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t$price = $price - $coupon->amount;\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tif ($price<0) $price = 0;\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tif ($add_totals) :\n\t\t\t\t\t\t\t\t\t\t$this->discount_cart = $this->discount_cart + ( $discount_amount * $values['quantity'] );\n\t\t\t\t\t\t\t\t\tendif;\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\telseif ($coupon->type=='percent_deals') :\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t$percent_discount = ( $values['data']->get_price( false ) / 100 ) * $coupon->amount;\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tif ($add_totals) $this->discount_cart = $this->discount_cart + ( $percent_discount * $values['quantity'] );\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t$price = $price - $percent_discount;\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tendif;\n\t\t\t\t\t\t\tendif;\n\t\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\n\t\t\t\t\t\tcase \"fixed_cart\" :\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t/** \n\t\t\t\t\t\t\t * This is the most complex discount - we need to divide the discount between rows based on their price in\n\t\t\t\t\t\t\t * proportion to the subtotal. This is so rows with different tax rates get a fair discount, and so rows\n\t\t\t\t\t\t\t * with no price (free) don't get discount too.\n\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Get item discount by dividing item cost by subtotal to get a %\n\t\t\t\t\t\t\t$discount_percent = ($values['data']->get_price( false )*$values['quantity']) / $this->subtotal_ex_tax;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Use pence to help prevent rounding errors\n\t\t\t\t\t\t\t$coupon_amount_pence = $coupon->amount * 100;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Work out the discount for the row\n\t\t\t\t\t\t\t$item_discount = $coupon_amount_pence * $discount_percent;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Work out discount per item\n\t\t\t\t\t\t\t$item_discount = $item_discount / $values['quantity'];\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Pence\n\t\t\t\t\t\t\t$price = ( $price * 100 );\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Check if discount is more than price\n\t\t\t\t\t\t\tif ($price < $item_discount) :\n\t\t\t\t\t\t\t\t$discount_amount = $price;\n\t\t\t\t\t\t\telse :\n\t\t\t\t\t\t\t\t$discount_amount = $item_discount;\n\t\t\t\t\t\t\tendif;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Take discount off of price (in pence)\n\t\t\t\t\t\t\t$price = $price - $discount_amount;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Back to pounds\n\t\t\t\t\t\t\t$price = $price / 100; \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Cannot be below 0\n\t\t\t\t\t\t\tif ($price<0) $price = 0;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Add coupon to discount total (once, since this is a fixed cart discount and we don't want rounding issues)\n\t\t\t\t\t\t\tif ($add_totals) $this->discount_cart = $this->discount_cart + (($discount_amount*$values['quantity']) / 100);\n\t\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\n\t\t\t\t\t\tcase \"percent\" :\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Get % off each item - this works out the same as doing the whole cart\n\t\t\t\t\t\t\t//$percent_discount = ( $values['data']->get_price( false ) / 100 ) * $coupon->amount;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t$percent_discount = ( $values['data']->get_price( ) / 100 ) * $coupon->amount;\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tif ($add_totals) $this->discount_cart = $this->discount_cart + ( $percent_discount * $values['quantity'] );\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t$price = $price - $percent_discount;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\n\t\t\t\t\tendswitch;\n\t\t\t\t\t\n\t\t\t\tendif;\n\t\t\tendforeach;\n\t\t\t\n\t\t\treturn apply_filters( 'cmdeals_get_discounted_price_', $price, $values, $this );\n\t\t}", "protected function _initTotals()\r\n {\r\n parent::_initTotals();\r\n $orderId = $this->getSource()->getId();\r\n\t\t//$base_orderId = 34243;\r\n\t\t$discount = $this->helper('auction')->getDiscountByOrderId($orderId);\r\n if (0) {\r\n $this->addTotalBefore(new Varien_Object(array(\r\n 'code' => 'auction',\r\n 'value' => $amount,\r\n 'base_value'=> $amount,\r\n 'label' => $this->helper('auction')->__('Auction Product Discount ').$amount.$this->helper('auction')->__('%'),\r\n ), array('shipping', 'tax')));\r\n }\r\n\r\n return $this;\r\n }", "function fuc_discount($product, $percentage){\r\n $discountValue = $product / 100 * $percentage;\r\n $totalValue = $product - $discountValue; \r\n return $totalValue;\r\n\r\n}", "public function set_discount_defaults()\r\n\t{\r\n\t\t// Set array placeholders.\r\n\t\tif (! isset($this->flexi->cart_contents['settings']['discounts']['codes']))\r\n\t\t{\r\n\t\t\t$this->flexi->cart_contents['settings']['discounts']['codes'] = array();\r\n\t\t}\r\n\t\tif (! isset($this->flexi->cart_contents['settings']['discounts']['manual']))\r\n\t\t{\r\n\t\t\t$this->flexi->cart_contents['settings']['discounts']['manual'] = array();\r\n\t\t}\t\r\n\t\r\n\t\t// Reset other discount data.\r\n\t\t$this->flexi->cart_contents['settings']['discounts']['active_items'] = array();\r\n\t\t$this->flexi->cart_contents['settings']['discounts']['active_summary'] = array();\r\n\t\t$this->flexi->cart_contents['settings']['discounts']['reward_vouchers'] = array();\r\n\t\t$this->flexi->cart_contents['settings']['discounts']['data']['item_discount_savings'] = 0;\r\n\t\t$this->flexi->cart_contents['settings']['discounts']['data']['summary_discount_savings'] = 0;\r\n\t\t$this->flexi->cart_contents['settings']['discounts']['data']['reward_vouchers'] = 0;\r\n\t\t$this->flexi->cart_contents['settings']['discounts']['data']['void_reward_point_items'] = array();\r\n\r\n\t\tif (! isset($this->flexi->cart_contents['settings']['discounts']['data']['excluded_discounts']))\r\n\t\t{\r\n\t\t\t$this->flexi->cart_contents['settings']['discounts']['data']['excluded_discounts'] = array();\r\n\t\t}\t\r\n\t\t\r\n\t\treturn TRUE;\r\n\t}", "function applyCouponDiscounts($coupons, $shippingType = null, $cartItems){\n\t\t\t$allTotals = array();\n\t\t\t$allTotals['shippingPrice'] = $this->totals['shippingPrice'];\n\t\t\t$allTotals['giftWrapTotal'] = $this->totals['giftWrapTotal'];\n\t\t\t$allTotals['noTaxNoShipping'] = $this->totals['noTaxNoShipping'];\n\t\t\t$this->totals['discount'] = $this->Coupon->applyCoupons($coupons, $shippingType, $cartItems, $allTotals);\n\t\t\t\n\t\t\t//recalculate grandtotal:\n\t\t\t$grandTotal = 0;\n\t\t\tif(array_sum($allTotals) - $this->totals['discount'] > 0){\n\t\t\t\t$grandTotal = array_sum($allTotals) - $this->totals['discount'];\n\t\t\t}else{\n\t\t\t\t//if discounts are greater than grand total, then change discount to difference:\n\t\t\t\t$this->totals['discount'] = $this->totals['discount'] + (array_sum($allTotals) - $this->totals['discount']);\n\t\t\t}\n\t\t\t$this->totals['total'] = $grandTotal;\n\t\t}", "function other_product_catalog($cid, $cpath, $COLLAPSABLE) {\n global $categories_string3, $languages_id, $level, $categories;\n\n $selectedPath = array();\n // Get all of the categories on this level\n\n\n /* Added for Discount pharmacy hide and show on 2nd feb 2012 */\n $category_query_raw = \"\";\n\n if(isset($_SESSION['customer_id']) && !empty($_SESSION['customer_id'])) {\t\n \n\t\t$customer_group_id = tep_get_customers_access_group($_SESSION['customer_id']);\t\n\t \n\t //$customer_group_id = array(\"G\",\"0\");\n\t\t\n } else {\n \n\t\t$customer_group_id = array(\"G\",\"0\");\n\t\t\n }\n \n $category_query_raw .= tep_get_access_sql('c.products_group_access', $customer_group_id);\n\n/* Added for Discount pharmacy hide and show on 2nd feb 2012 /end */\n\n \n \n /* Default Modified for Discount pharmacy hide and show on 2nd feb 2012 */\n\n /*if(!$_SESSION['sppc_customer_group_id']) {\n $customer_group_id = 'G';\n } else {\n $customer_group_id = $sppc_customer_group_id;\n }*/\n \n /* Default Modified for Discount pharmacy hide and show on 2nd feb 2012 */\n\n \n \n $categories_query = tep_db_query(\"SELECT c.categories_id, cd.categories_name, c.parent_id \n from \" . TABLE_CATEGORIES . \" c,\n \" . TABLE_CATEGORIES_DESCRIPTION . \" cd \n WHERE c.parent_id = '25' \n and c.categories_id = cd.categories_id \n and cd.language_id='\" . $languages_id .\"' \n $category_query_raw order by sort_order, cd.categories_name\");\n \n while ($categories = tep_db_fetch_array($categories_query)) {\n if ($categories[$level]['parent_id'] == \"\") { $categories[$level]['parent_id'] = 0; }\n $categories[$level]['categories_id'] = $categories[$level]['parent_id'] + 1;\n // Add category link to $categories_string3\n for ($a=1; $a < $level[$categories]['categories_id']; $a++) {\n $categories_string3 .= \"&nbsp;&nbsp;\";\n }\n\t\n $categories_string3 .= '<li><a href=\"';\n $cPath_new = $cpath;\n if ($categories[$level]['parent_id'] > 0) {\n $cPath_new .= \"_\";\n }\n $cPath_new .= $categories['categories_id'];\n // added for CDS CDpath support\n $CDpath = (isset($_SESSION['CDpath'])) ? '&CDpath=' . $_SESSION['CDpath'] : ''; \n $cPath_new_text = \"cPath=\" . $cPath_new . $CDpath;\n $categories_string3 .= tep_href_link(FILENAME_DEFAULT, $cPath_new_text);\n $categories_string3 .= '\">';\n if ($_GET['cPath']) {\n $selectedPath = split(\"_\", $_GET['cPath']);\n }\n if (in_array($categories['categories_id'], $selectedPath)) { $categories_string3 .= '<b>'; }\n //if ($categories[$level]['categories_id'] == 1) { $categories_string3 .= '<u>'; }\n $categories_string3 .= tep_db_output($categories['categories_name']);\n if ($COLLAPSABLE && tep_has_category_subcategories($categories['categories_id'])) { $categories_string3 .= ' ->'; }\n //if ($categories[$level]['categories_id'] == 1) { $categories_string3 .= '</u>'; }\n if (in_array($categories['categories_id'], $selectedPath)) { $categories_string3 .= '</b>'; }\n $categories_string3 .= '</a></li>';\n \n \n // If I have subcategories, get them and show them\n if (tep_has_category_subcategories($categories['categories_id'])) {\n if ($COLLAPSABLE) {\n if (in_array($categories['categories_id'], $selectedPath)) {\n other_product_catalog($categories['categories_id'], $cPath_new, $COLLAPSABLE);\n }\n } else { \n other_product_catalog($categories['categories_id'], $cPath_new, $COLLAPSABLE); \n }\n }\n\t\n }\n \n}", "public function setDiscountDescription($description);", "public function setDiscountAmount($amount);", "public function setDiscount(?float $discount): self\n {\n $this->initialized['discount'] = true;\n $this->discount = $discount;\n\n return $this;\n }", "function setCategory($object) { \n /* you can itentify the item with $object->Item->ShopId */ \n}", "public function setDiscount(int $discount): self\n {\n $this->discount = $discount;\n return $this;\n }", "function calc_extra_sp_cost($Discount = 1){\r\n\t$list = array('D','E','A');\r\n\tforeach($list as $v){\r\n\t\tif(preg_match('/CostSP<([0-9]+)>/',$this->Eq[$v]['spec'],$array)){\r\n\t\t\t$a = intval($array[1]);\r\n\t\t\t$this->SP_Cost += ceil($a * $Discount);\r\n\t\t}\r\n\t}\r\n}", "public function set_manual_discount($discount_data = FALSE)\r\n\t{\r\n\t\tif (is_array($discount_data) && ! empty($discount_data))\r\n\t\t{\r\n\t\t\t// Check that any submitted 'New value' discounts are only applied to the shipping total. \r\n\t\t\tif (isset($discount_data['column']) && isset($discount_data['calculation']) && ($discount_data['column'] != 'shipping_total') && ($discount_data['calculation'] == 3))\r\n\t\t\t{\r\n\t\t\t\treturn FALSE;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t// Merge the code and manual discounts together, then loop through data and compile an array of all discount ids currently in use.\r\n\t\t\t$existing_discounts = array_merge($this->flexi->cart_contents['settings']['discounts']['manual'], $this->flexi->cart_contents['settings']['discounts']['codes']);\r\n\t\t\t$existing_ids = array();\r\n\t\t\t\t\r\n\t\t\tforeach($existing_discounts as $existing_discount)\r\n\t\t\t{\r\n\t\t\t\t$existing_ids[] = $existing_discount['id'];\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t// If an id is not set in the submitted '$discount_data', or if a discount with a matching id already exists, set a new id. \r\n\t\t\tif (! isset($discount_data['id']) || in_array($discount_data['id'], $existing_ids))\r\n\t\t\t{\r\n\t\t\t\t$id = 0;\r\n\t\t\t\twhile (in_array('manual_'.$id, $existing_ids))\r\n\t\t\t\t{\r\n\t\t\t\t\t$id++; \r\n\t\t\t\t}\r\n\t\t\t\t$id = $discount_data['id'] = 'manual_'.$id;\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\t$id = $discount_data['id'];\r\n\t\t\t}\r\n\t\t\r\n\t\t\t// Set default values if not submitted.\r\n\t\t\t$discount_data['description'] = (! isset($discount_data['description'])) ? FALSE : $discount_data['description'];\r\n\t\t\t$discount_data['value'] = (! isset($discount_data['value'])) ? 0 : $discount_data['value'];\r\n\t\t\t$discount_data['column'] = (! isset($discount_data['column'])) ? 'total' : $discount_data['column'];\r\n\t\t\t$discount_data['calculation'] = (! isset($discount_data['calculation'])) ? 1 : $discount_data['calculation'];\r\n\t\t\t$discount_data['tax_method'] = (! isset($discount_data['tax_method'])) ? FALSE : $discount_data['tax_method'];\r\n\t\t\t$discount_data['void_reward_points'] = (! isset($discount_data['void_reward_points'])) ? FALSE : $discount_data['void_reward_points'];\r\n\t\t\t\r\n\t\t\t// Set the cart column the discount is targeting and use the value to act as the discounts array key. \r\n\t\t\t// This prevents multiple discounts being applied to the same cart column.\r\n\t\t\t$target_column = $discount_data['column'];\r\n\t\t\t\r\n\t\t\t// Loop through data and set to cart session summary.\r\n\t\t\tforeach($discount_data as $column => $column_value)\r\n\t\t\t{\r\n\t\t\t\tif ($column == 'value')\r\n\t\t\t\t{\r\n\t\t\t\t\t// If a valid discount value is not set, set the default value as zero. \r\n\t\t\t\t\t$column_value = ($this->non_negative($column_value)) ? $this->format_calculation($column_value, 2, TRUE) : 0;\r\n\t\t\t\t}\r\n\t\t\t\telse if ($column == 'column')\r\n\t\t\t\t{\r\n\t\t\t\t\t// If a valid column is not set, discount the 'total' column by default. \r\n\t\t\t\t\t$column_value = (in_array($column_value, array('item_summary_total', 'shipping_total', 'total'))) ? $column_value : 'total';\r\n\t\t\t\t}\r\n\t\t\t\telse if ($column == 'calculation') \r\n\t\t\t\t{\r\n\t\t\t\t\t// If a valid calculation method is not set, a 'percentage' based calculation is set by default.\r\n\t\t\t\t\t// 1 = Percentage Based, 2 = Flat Fee, 3 = New Value.\r\n\t\t\t\t\t$column_value = (in_array($column_value, array(1,2,3))) ? $column_value : 1;\r\n\t\t\t\t}\r\n\t\t\t\telse if ($column == 'tax_method')\r\n\t\t\t\t{\r\n\t\t\t\t\t// If a valid tax method is not set, the tax method is defined by whether cart prices ex/include taxes by default.\r\n\t\t\t\t\t// 0 = Carts Default Tax Method, 1 = Apply Tax Before Discount, 2 = Apply Discount Before Tax, 3 = Apply Discount Before Tax, Add Original Tax.\r\n\t\t\t\t\t$column_value = (in_array($column_value, array(0, 1,2,3))) ? $column_value : 0;\r\n\t\t\t\t}\r\n\t\t\t\telse if ($column == 'void_reward_points')\r\n\t\t\t\t{\r\n\t\t\t\t\t$column_value = (bool)$column_value;\r\n\t\t\t\t}\r\n\t\t\t\telse if (! in_array($column, array('id', 'description')))\r\n\t\t\t\t{\r\n\t\t\t\t\tcontinue;\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\t$this->flexi->cart_contents['settings']['discounts']['manual'][$target_column][$column] = $column_value;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\treturn TRUE;\r\n\t\t}\r\n\t\t\r\n\t\treturn FALSE;\r\n\t}", "public function setPricecomparisonCategoryView(Varien_Event_Observer $observer)\n\t{\n\t\t$cookieKey = Mage::helper('pricecomparison')->getCookieKey();\n\t\t$pcsCookie = Mage::getModel('core/cookie')->get($cookieKey);\n\t\t// $pcsId = Mage::app()->getRequest()->getParam('pcs', false);\n\t\t\n\t\t// if ($pcsCookie && !$pcsId) {\n\t\tif ($pcsCookie) {\n\t\t\t$productCollection = $observer->getEvent()->getCollection();\n\t\t\t$cookieData = explode('|', $pcsCookie);\n\t\t\t$pcsId = $cookieData[0];\n\t\t\t$pcsProductId = $cookieData[1];\n\t\t\t\n\t\t\tforeach ($productCollection as $product) {\n\t\t\t\t$productId = $product->getId();\n\t\t\t\t\n\t\t\t\tif ($productId === $pcsProductId) {\n\t\t\t\t\t$loadedProduct = Mage::getModel('catalog/product')->load($productId);\n\t\t\t\t\t\n\t\t\t\t\tif ($pcsPrice = $loadedProduct->getData($pcsId)) {\n\t\t\t\t\t\t$product->setFinalPrice($pcsPrice);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "protected function applyDiscounts()\n {\n $discounts = $this->booking->bookingDiscounts;\n $this->discountedPeriodsTotal = $this->periodsTotal;\n $discountedTotal = $this->periodsTotal;\n\n if (!$discounts) return;\n\n // Apply discounts based on the order of discount sequence.\n foreach ($this->discountSequence as $sequence) {\n // Filter discounts so that we don't have to loop through all of them.\n $filteredDiscounts = $discounts->where('type', $sequence);\n\n $methodName = \"apply\" . Str::studly($sequence) . \"Discount\";\n\n // Apply and store discount information.\n foreach ($filteredDiscounts as $filteredDiscount) {\n $discountInformation = ['beforeDiscount' => $discountedTotal];\n $discountedTotal = $this->$methodName($discountedTotal, $filteredDiscount);\n $discountInformation['afterDiscount'] = $discountedTotal;\n\n if (!$this->discountApplied($discountInformation['beforeDiscount'], $discountInformation['afterDiscount'])) {\n continue;\n }\n\n $discountInformation['discount'] = $filteredDiscount;\n $this->appliedDiscounts[] = $discountInformation;\n }\n }\n\n $this->discountedPeriodsTotal = $discountedTotal;\n }", "public function set_credits_discountamount($observer)\n {\n$array2 = Mage::helper('kartparadigm_storecredit')->getCreditRates();\n//Mage::log(Mage::helper('kartparadigm_storecredit')->getRefundDeductConfig() . \" configuration settings \");\n//Mage::log($array2);\n $session = Mage::getSingleton('checkout/session');\n if(Mage::helper('customer')->isLoggedIn()) {\n $customer = Mage::getSingleton('customer/session')->getCustomer();\n $customer_group=Mage::getModel('customer/group')->load(Mage::getSingleton('customer/session')->getCustomerGroupId())->getCustomerGroupCode();\n}\n \n$val1 = Mage::getSingleton('adminhtml/session')->getValue();\nif(isset($val1))\n{\n$amt1 = array();\n$amt1 = Mage::getSingleton('checkout/session')->getCredits();\n$amt = $amt1['totalCredits'];\n$quote = Mage::getSingleton('adminhtml/session_quote')->getQuote();\n}\nelse{\n$amt1 = array();\n $quote = Mage::getModel('checkout/cart')->getQuote();\n$amt1 = Mage::getSingleton('checkout/session')->getCredits();\n$amt = $amt1['discountCredits'];\n}\n $isvirtual=0;\n foreach($quote->getAllItems() as $item){\n if($item->getIsVirtual()==1) {\n $isvirtual=1;\n }\n if(Mage::getModel('catalog/product')->load($item->getProductId())->getTypeId()=='customproduct'){\n $isvirtual=1;\n }\n }\n$total=$quote->getGrandTotal(); \n\n$subTotal = $quote->getSubtotal();\n//Mage::log($quote->getGrandTotal().\"this is grand total store credit\");\n//Mage::log($quote->getSubtotal().\"this is sub total\");\n\n if (!Mage::helper('kartparadigm_storecredit')->getTaxEnabled()){\n$tax = $quote->getShippingAddress()->getData('tax_amount');\n}\n if(!Mage::helper('kartparadigm_storecredit')->getIsShippingEnabled()){\n$shippingPrice = $quote->getShippingAddress()->getShippingAmount();\n}\n$totalCredits1 = array();\n$totalCredits1 = Mage::getSingleton('checkout/session')->getCredits();\n$totalCredits = $totalCredits1['totalCredits'];\n\n$currentTimestamp = Mage::getModel('core/date')->timestamp(time()); \n$nowdate = date('Y-m-d H:m:s', $currentTimestamp); \n//echo $expirydate;\n//echo $nowdate;\n$balance;\n//echo $amt;\n$amt2;\n $amt1;\n \n\nif(isset($amt)){\n/*---------------------Calculating Default Currency Value----------------------- */\n$amt1 = ($array2['basevalue'] * $amt) / $array2['credits'];\n $baseCurrencyCode = Mage::app()->getStore()->getBaseCurrencyCode();\n $currentCurrencyCode = Mage::app()->getStore()->getCurrentCurrencyCode();\n if ($baseCurrencyCode != $currentCurrencyCode) {\n $amt2 = Mage::helper('directory')->currencyConvert($amt1, $baseCurrencyCode, $currentCurrencyCode);\n }\n else{\n $amt2 = $amt1; \n }\n // $amt2 = Mage::helper('core')->currency($amt1, true, false);\n//Mage::log($amt1.\" = amount = \".$amt2 );\n//----------------------------------------------------------------\nif($total > $amt2) {\nif(($total - $tax - $shippingPrice) > $amt2){\n$discountAmount = $amt2;\n$balance = $totalCredits - $amt;\n}else{\n $discountAmount = $subTotal;\n$points = round(($discountAmount * $amt)/$amt2);\n//Mage::log($points.\"Conver Points\");\n$balance = $totalCredits - $points;\n}\n}\nelse {\n$discountAmount = $total - $tax - $shippingPrice;\n$points = round(($discountAmount * $amt)/$amt2);\n//Mage::log($points.\"Conver Points\");\n$balance = $totalCredits - $points;\n}\nMage::getSingleton('core/session')->setBalance($balance);\n\nMage::getSingleton('checkout/session')->setDiscount($totalCredits - $balance);\n$msg = \"Current Credits In Your Account : \" . $balance;\nMage::getSingleton('core/session')->setCredits($msg);\n if ($discountAmount > 0) {\n\n\nif ($baseCurrencyCode != $currentCurrencyCode) {\n \n$allowedCurrencies = Mage::getModel('directory/currency')->getConfigAllowCurrencies();\n$rates = Mage::getModel('directory/currency')->getCurrencyRates($baseCurrencyCode, array_values($allowedCurrencies));\n\n$baseDiscount = $discountAmount/$rates[$currentCurrencyCode];\n\n }\nelse{\n $baseDiscount = $discountAmount;\n } \n $total = $quote->getBaseSubtotal();\n $data1 = $quote->getData();\n // Mage::log($data1['entity_id'].\"quote id\");\n $quote->setSubtotal(0);\n $quote->setBaseSubtotal(0);\n $quote->setSubtotalWithDiscount(0);\n $quote->setBaseSubtotalWithDiscount(0);\n $quote->setGrandTotal(0);\n $quote->setBaseGrandTotal(0);\n $canAddItems = $quote->isVirtual() ? ('billing') : ('shipping');\n foreach($quote->getAllAddresses() as $address) {\n $data = $address->getData();\n $address->setSubtotal(0);\n $address->setBaseSubtotal(0);\n $address->setGrandTotal(0);\n $address->setBaseGrandTotal(0);\n $address->collectTotals();\n $quote->setSubtotal((float)$quote->getSubtotal() + $address->getSubtotal());\n $quote->setBaseSubtotal((float)$quote->getBaseSubtotal() + $address->getBaseSubtotal());\n $quote->setSubtotalWithDiscount((float)$quote->getSubtotalWithDiscount() + $address->getSubtotalWithDiscount());\n $quote->setBaseSubtotalWithDiscount((float)$quote->getBaseSubtotalWithDiscount() + $address->getBaseSubtotalWithDiscount());\n $quote->setGrandTotal((float)$quote->getGrandTotal() + $address->getGrandTotal());\n $quote->setBaseGrandTotal((float)$quote->getBaseGrandTotal() + $address->getBaseGrandTotal());\n $quote->setEntityId($data1['entity_id'])->save();\n $quote->setSubtotalWithDiscount($quote->getSubtotal() - $discountAmount)->setBaseSubtotalWithDiscount($quote->getBaseSubtotal() - $baseDiscount)->setEntityId($data1['entity_id'])->save();\n if ($address->getAddressType() == $canAddItems) {\n $address->setSubtotalWithDiscount((float)$data['subtotal_with_discount'] - $discountAmount);\n $address->setGrandTotal((float)$data['grand_total'] - $discountAmount);\n $address->setBaseSubtotalWithDiscount((float)$data['base_subtotal_with_discount'] - $baseDiscount);\n $address->setBaseGrandTotal((float)$data['base_grand_total'] - $baseDiscount);\n if ($data['discount_description']) {\n $address->setDiscountAmount(($data['discount_amount'] - $discountAmount));\n $address->setDiscountDescription($data['discount_description'] . ', Store Credits');\n $address->setBaseDiscountAmount(($data['base_discount_amount'] - $baseDiscount));\n }\n else {\n $address->setDiscountAmount(-($discountAmount));\n $address->setDiscountDescription('Store Credits');\n $address->setBaseDiscountAmount(-($baseDiscount));\n }\n $address->setAddressId($data['address_id'])->save();\n }\n }\n foreach($quote->getAllItems() as $item) {\n\n // We apply discount amount based on the ratio between the GrandTotal and the RowTotal\n $rat = $item->getPriceInclTax() / $quote->getSubtotal();\n $rat1 = $item->getBasePriceInclTax() / $quote->getBaseSubtotal();\n $ratdisc = $discountAmount * $rat;\n $ratdisc1 = $baseDiscount * $rat1;\n//Mage::log($item->getDiscountAmount().\"include tax\".$item->getBaseDiscountAmount());\n // Mage::log($item->getDiscountAmount().\"discount storecredit\");\n$idata = $item->getData();\n Mage::log($item->getDiscountAmount().\"discount amount credit\");\n $item->setDiscountAmount(($item->getDiscountAmount() + $ratdisc) * $item->getQty());\n $item->setBaseDiscountAmount(($item->getBaseDiscountAmount() + $ratdisc1) * $item->getQty())->save();\n }\n }else if($totalCredits == 0){\n\n$msg = \"Sorry You Have No Credits In Your Account\";\nMage::getSingleton('core/session')->setCredits($msg);\n}\n \n \n } \n }", "function es_cart_change_coupon_label( $html , $coupon){\n\n$html='Discount:';\n\nreturn $html;\n\n}", "public function setDiscount($var)\n {\n GPBUtil::checkDouble($var);\n $this->discount = $var;\n\n return $this;\n }", "function ProcessMultilevelSubCategories()\n {\n if ($this->debug_mode)\n echo $this->ClassName . \"ProcessMultilevelSubCategories();\" . \"<HR>\";\n if ($this->listSettings->HasItem(\"MAIN\", \"SUB_CATEGORIES_COUNT\")) {\n $this->sub_categories_count = $this->listSettings->GetItem(\"MAIN\", \"SUB_CATEGORIES_COUNT\");\n for ($i = 0; $i < $this->sub_categories_count; $i ++) {\n $sub_category = array();\n if ($this->listSettings->HasItem(\"SUB_CATEGORY_\" . $i, \"APPLY_LIBRARY\")) {\n $sub_category[\"library\"] = $this->listSettings->GetItem(\"SUB_CATEGORY_\" . $i, \"APPLY_LIBRARY\");\n }\n else {\n $this->AddEditErrorMessage(\"EMPTY_SUB_CATEGORY_LIBRARY\", array(\n $i), true);\n }\n if ($this->listSettings->HasItem(\"SUB_CATEGORY_\" . $i, \"LINK_FIELD\")) {\n $sub_category[\"link_field\"] = $this->listSettings->GetItem(\"SUB_CATEGORY_\" . $i, \"LINK_FIELD\");\n }\n else {\n $this->AddEditErrorMessage(\"EMPTY_SUB_CATEGORY_LINK_FIELD\", array(\n $i), true);\n }\n $this->sub_categories[] = $sub_category;\n }\n\n }\n else {\n $this->AddEditErrorMessage(\"EMPTY_SUB_CATEGORIES_COUNT\", array(), true);\n }\n\n }", "public function setDiscountAmount($value){\n return $this->setParameter('discount_amount', $value);\n }", "protected function assignCategory() \r\r\n {\r\r\n if (($this->category === false || !Validate::isLoadedObject($this->category) || !$this->category->inShop() || !$this->category->isAssociatedToShop()) && Category::inShopStatic($this->product->id_category_default, $this->context->shop)) {\r\r\n $this->category = new Category((int) $this->product->id_category_default, (int) $this->context->language->id);\r\r\n }\r\r\n\r\r\n $sub_categories = array();\r\r\n if (Validate::isLoadedObject($this->category)) {\r\r\n $sub_categories = $this->category->getSubCategories($this->context->language->id, true);\r\r\n\r\r\n //$rootCategory = $this.category\r\r\n // various assignements before Hook::exec\r\r\n $this->context->smarty->assign(array(\r\r\n 'category' => $this->category,\r\r\n 'rootCategory' => Category::getDepthCategory($this->category->id, 2),\r\r\n 'subCategories' => $sub_categories,\r\r\n 'id_category_current' => (int) $this->category->id,\r\r\n 'id_category_parent' => (int) $this->category->id_parent,\r\r\n 'return_category_name' => Tools::safeOutput($this->category->getFieldByLang('name')),\r\r\n 'categories' => Category::getHomeCategories($this->context->language->id, true, (int) $this->context->shop->id),\r\r\n ));\r\r\n }\r\r\n }", "protected function calculate_discounts() {\n\t\t$this->get_coupons_from_cart();\n\n\t\t$discounts = new WC_Discounts( $this->cart );\n\n\t\t// Set items directly so the discounts class can see any tax adjustments made thus far using subtotals.\n\t\t$discounts->set_items( $this->items );\n\n\t\tforeach ( $this->coupons as $coupon ) {\n\t\t\t$discounts->apply_coupon( $coupon );\n\t\t}\n\n\t\t$coupon_discount_amounts = $discounts->get_discounts_by_coupon( true );\n\t\t$coupon_discount_tax_amounts = array();\n\n\t\t// See how much tax was 'discounted' per item and per coupon.\n\t\tif ( $this->calculate_tax ) {\n\t\t\tforeach ( $discounts->get_discounts( true ) as $coupon_code => $coupon_discounts ) {\n\t\t\t\t$coupon_discount_tax_amounts[ $coupon_code ] = 0;\n\n\t\t\t\tforeach ( $coupon_discounts as $item_key => $coupon_discount ) {\n\t\t\t\t\t$item = $this->items[ $item_key ];\n\n\t\t\t\t\tif ( $item->product->is_taxable() ) {\n\t\t\t\t\t\t// Item subtotals were sent, so set 3rd param.\n\t\t\t\t\t\t$item_tax = wc_round_tax_total( array_sum( WC_Tax::calc_tax( $coupon_discount, $item->tax_rates, $item->price_includes_tax ) ), 0 );\n\n\t\t\t\t\t\t// Sum total tax.\n\t\t\t\t\t\t$coupon_discount_tax_amounts[ $coupon_code ] += $item_tax;\n\n\t\t\t\t\t\t// Remove tax from discount total.\n\t\t\t\t\t\tif ( $item->price_includes_tax ) {\n\t\t\t\t\t\t\t$coupon_discount_amounts[ $coupon_code ] -= $item_tax;\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\n\t\t$this->coupon_discount_totals = (array) $discounts->get_discounts_by_item( true );\n\t\t$this->coupon_discount_tax_totals = $coupon_discount_tax_amounts;\n\n\t\tif ( wc_prices_include_tax() ) {\n\t\t\t$this->set_total( 'discounts_total', array_sum( $this->coupon_discount_totals ) - array_sum( $this->coupon_discount_tax_totals ) );\n\t\t\t$this->set_total( 'discounts_tax_total', array_sum( $this->coupon_discount_tax_totals ) );\n\t\t} else {\n\t\t\t$this->set_total( 'discounts_total', array_sum( $this->coupon_discount_totals ) );\n\t\t\t$this->set_total( 'discounts_tax_total', array_sum( $this->coupon_discount_tax_totals ) );\n\t\t}\n\n\t\t$this->cart->set_coupon_discount_totals( wc_remove_number_precision_deep( $coupon_discount_amounts ) );\n\t\t$this->cart->set_coupon_discount_tax_totals( wc_remove_number_precision_deep( $coupon_discount_tax_amounts ) );\n\n\t\t// Add totals to cart object. Note: Discount total for cart is excl tax.\n\t\t$this->cart->set_discount_total( $this->get_total( 'discounts_total' ) );\n\t\t$this->cart->set_discount_tax( $this->get_total( 'discounts_tax_total' ) );\n\t}", "public function getTonicDiscount()\n {\n }", "public function updatePercentage(Discount $discount)\n {\n }", "public function set_coupon_discount_tax_totals( $value = array() ) {\n\t\t$this->coupon_discount_tax_totals = (array) $value;\n\t}", "function applyDiscountOnSubscription($subscriptionId = null)\n {\n $db = new db();\n $db->makeConnection();\n\n if($subscriptionId != null)\n {\n \t\\Stripe\\Stripe::setApiKey(STRPIE_CLIENT_SECRET);\n\n $date = date('Y-m-d 00:00:00');\n $discountTotal = 0;\n\n // Select plan having trial periods on\n // $query = \"SELECT price FROM billing_products BP INNER JOIN user_subscription_items USI ON BP.plan_id = USI.plan_id WHERE BP.trial_period != 0 AND USI.subscription_id = '{$subscriptionId}' AND USI.coupon_trial_from <= '{$date}' AND USI.coupon_trial_to >= '{$date}'\";\n $query = \"SELECT price FROM billing_products BP INNER JOIN user_subscription_items USI ON BP.plan_id = USI.plan_id WHERE BP.trial_period != 0 AND USI.subscription_id = '{$subscriptionId}' AND USI.coupon_trial_from <= '{$date}' AND USI.coupon_trial_to > '{$date}' AND USI.status = '1'\";\n $res = $db->query($query);\n\n if($db->numRows($res))\n {\n while ($rs = mysqli_fetch_array($res))\n {\n $discountTotal += $rs['price'];\n }\n\n //\n if($discountTotal)\n {\n // Fetch if coupon exist, otherwise create\n $couponId = 'OFF-'.$discountTotal;\n\n try {\n // Retrieve coupon\n $coupon = \\Stripe\\Coupon::retrieve($couponId);\n } catch (\\Stripe\\Error\\Base $e) {\n // Create coupon\n $coupon = \\Stripe\\Coupon::create([\n 'id' => $couponId,\n 'amount_off' => ($discountTotal*100),\n 'currency' => 'SEK',\n 'duration' => 'once',\n // 'duration' => 'repeating',\n // 'duration_in_months' => 3,\n ]);\n }\n\n // Apply coupon on subscription\n if($coupon)\n {\n try {\n // Update subscription\n \\Stripe\\Subscription::update(\n $subscriptionId,\n ['coupon' => $coupon->id]\n );\n } catch (\\Stripe\\Error\\Base $e) {}\n }\n }\n else\n {\n \ttry {\n $sub = \\Stripe\\Subscription::retrieve($subscriptionId);\n\n if( isset($sub->discount) && ($sub->discount != null) )\n {\n $sub->deleteDiscount();\n }\n } catch (\\Stripe\\Error\\Base $e) {}\n }\n }\n else\n {\n \ttry {\n $sub = \\Stripe\\Subscription::retrieve($subscriptionId);\n\n if( isset($sub->discount) && ($sub->discount != null) )\n {\n $sub->deleteDiscount();\n }\n } catch (\\Stripe\\Error\\Base $e) {}\n }\n }\n }", "function _apply_discount($coupon)\n\t{\n\t\t$this->database->SaveCheatCode($coupon);\n\t\t$discount_percentage = 0;\n\t\t$coupon_info = $this->database->GetDiscountCoupon($coupon);\n\n\t\t//Run some conditional-check for code\n\t\tif($this->_can_apply_code($coupon_info))\n\t\t{\n\t\t\t$discount_percentage = $this->_getDiscount($coupon);\n\t\t\t$this->cart->apply_discount($coupon, $discount_percentage);\n\t\t}\n\n\t\t$this->_notify_discount_applied($discount_percentage, $coupon_info);\n\n\t}", "private function updateProductDiscount(\n ProductInterface $product,\n Request $request\n ): void {\n $discountPercent = $request->request->get('discount_percent') !== '' ? (float) $request->request->get('discount_percent') : null;\n $discountLimitType = $request->request->get('discount_limit_type') !== '' ? $request->request->get('discount_limit_type') : null;\n $discountFromDate = $request->request->get('discount_from_date') !== '' ? $request->request->get('discount_from_date') : null;\n $discountToDate = $request->request->get('discount_to_date') !== '' ? $request->request->get('discount_to_date') : null;\n\n $variants = $product->getVariants();\n foreach ($variants as $variant) {\n // Variant to change\n $variantPricing = $variant->getChannelPricings()->first();\n\n // Change percent\n if ($discountPercent !== null) {\n $variantPricing->setDiscount($discountPercent / 100);\n }\n\n // Continue if no change type\n if ($discountLimitType === self::LIMIT_NO_CHANGE) {\n continue;\n }\n // Discount type\n $variantPricing->setDiscountLimitType($discountLimitType === self::LIMIT_NONE ? null : $discountLimitType);\n\n // Date type discount\n if ($discountLimitType === self::LIMIT_DATETIME) {\n if ($discountFromDate && $discountToDate) {\n $dateFrom = \\DateTime::createFromFormat('Y-m-d', $discountFromDate);\n $dateTo = \\DateTime::createFromFormat('Y-m-d', $discountToDate);\n\n $variantPricing->setDiscountFrom($dateFrom);\n $variantPricing->setDiscountTo($dateTo);\n }\n\n if ($discountFromDate && !$discountToDate) {\n $dateFrom = \\DateTime::createFromFormat('Y-m-d', $discountFromDate);\n\n $variantPricing->setDiscountFrom($dateFrom);\n $variantPricing->setDiscountTo(null);\n }\n\n if (!$discountFromDate && $discountToDate) {\n $dateTo = \\DateTime::createFromFormat('Y-m-d', $discountToDate);\n\n $variantPricing->setDiscountFrom(null);\n $variantPricing->setDiscountTo($dateTo);\n }\n }\n }\n }", "public function setDiscountUid(?string $discountUid): void\n {\n $this->discountUid = $discountUid;\n }", "public function store(Request $request)\n {\n if(auth()->user()->isAdmin()){\n\n $this->validate($request,[\n 'dis_user'=>'required'\n ]);\n\n // Get and validate user\n $userID = $request->input('dis_user');\n $user = User::find($userID);\n if($user === null || !($user->isClient() || $user->isNewClient())) abort(404);\n\n // Get client's discounts\n $user_discounts = $user->getAllDiscounts();\n\n $inputs = $request->all();\n foreach($inputs as $key=>$value){\n // Validate inputs\n $subcategory = Subcategory::find($key);\n if($subcategory !== null){\n\n if(!(is_numeric($value) || $value=='')) abort(404); // If value is not valid\n\n // If discount is already set\n if($user_discounts->where('subcategory_id', $key)->first() !== null){\n $discount = $user_discounts->where('subcategory_id', $key)->first();\n if($value > 0){\n $discount->discount = $value;\n $discount->save();\n }\n else{\n $discount->delete();\n }\n }\n // If discount is new\n else{\n if($value > 0){\n $discount = new Discount;\n $discount->user_id = $user->id;\n $discount->subcategory_id = $key;\n $discount->discount = $value;\n $discount->save();\n }\n }\n }\n }\n\n return redirect('/users');\n }\n else abort(404);\n }", "public function getTotalDiscountAmount();", "public function getDiscountedCategory($catId) {\n $trendIds = array ();\n $subCategoryIds = $this->getSubCategories ( $catId );\n if (count ( $subCategoryIds ) > 0) {\n foreach ( $subCategoryIds as $_subCategoryIds ) {\n $categoryData = Mage::getModel ( 'catalog/category' )->load ( $_subCategoryIds );\n if ($categoryData->getDiscountedCategoryListings () == 1) {\n $trendIds [] = $categoryData->getId ();\n }\n }\n \n }\n return $trendIds;\n }", "public function deleteDiscount();", "function pp_edd_auto_apply_discount() {\n\n\tif ( function_exists( 'edd_is_checkout' ) && edd_is_checkout() ) {\n\n\t\tif ( ! edd_cart_has_discounts() && edd_is_discount_valid( 'BFCM2016', '', false ) ) {\n\t\t\tedd_set_cart_discount( 'BFCM2016' );\n\t\t}\n\n\t}\n\n}", "public function setDiscount($discount)\n {\n $this->discount = $discount;\n\n return $this;\n }", "public function setDiscount($discount)\n {\n $this->discount = $discount;\n\n return $this;\n }", "private function setDiscount( string $type, float $amount, float $discount ): float\n {\n switch( $type ) {\n case 'absolute' :\n $price = $amount - $discount;\n break;\n case 'percent' :\n $price = $amount - ($amount / 100 * $discount);\n break;\n case 'wholesale' :\n $price = $amount;\n break;\n default :\n $price = $amount;\n break;\n }\n\n $price = round(sprintf(\"%01.2f\", ceil($price * 100) / 100), 2);\n\n return $price;\n }", "public function getTotalDiscount(): float;", "function getDiscountFor($product) {\n\t\treturn 30;\n\t}", "public static function update_item_with_discount($detail_id,$order_promotion,$order_discount_id,$order_discount_amt){\r\tif(is_gt_zero_num($detail_id)){\r\t\t$objtbl_order_details=new tbl_order_details();\r\t\tif($objtbl_order_details->readObject(array(ORD_DTL_ID=>$detail_id))){\r\t\t\t$objtbl_order_details->setordprom_promotion($order_promotion);\r\t\t\t$objtbl_order_details->setordprom_discount_id($order_discount_id);\r\t\t\t$objtbl_order_details->setordprom_discount_amt($order_discount_amt);\r\t\t\t$objtbl_order_details->insert();\r\t\t\treturn 1;\r\t\t}\r\t\tunset($objtbl_order_details);\t\r\t} \r\treturn 0;\t\r }", "protected function _applyObjectProperty()\n\t{\n\t\tparent::_applyObjectProperty();\n\n\t\t$modelName = $this->_object->getModelName();\n\n\t\tswitch ($modelName)\n\t\t{\n\t\t\tcase 'shop_discount':\n\t\t\t\t// Скидка не может быть больше 100%\n\t\t\t\tif ($this->_object->type == 0 && $this->_object->value > 100)\n\t\t\t\t{\n\t\t\t\t\t$this->_object->value = 0;\n\t\t\t\t\t$this->_object->save();\n\n\t\t\t\t\t$this->addMessage(\n\t\t\t\t\t\tCore_Message::get(Core::_('Shop_Discount.percent_error'), 'error')\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\t// Группа доступа\n\t\t\t\t$aSiteuser_Groups = array(0 => Core::_('Structure.all'));\n\n\t\t\t\tif (Core::moduleIsActive('siteuser'))\n\t\t\t\t{\n\t\t\t\t\t$oSiteuser_Controller_Edit = new Siteuser_Controller_Edit($this->_Admin_Form_Action);\n\t\t\t\t\t$aSiteuser_Groups = $aSiteuser_Groups + $oSiteuser_Controller_Edit->fillSiteuserGroups($this->_object->Shop->site_id);\n\t\t\t\t}\n\n\t\t\t\t$aTmp = array();\n\n\t\t\t\t$aShop_Discount_Siteuser_Groups = $this->_object->Shop_Discount_Siteuser_Groups->findAll(FALSE);\n\t\t\t\tforeach ($aShop_Discount_Siteuser_Groups as $oShop_Discount_Siteuser_Group)\n\t\t\t\t{\n\t\t\t\t\t!in_array($oShop_Discount_Siteuser_Group->siteuser_group_id, $aTmp)\n\t\t\t\t\t\t&& $aTmp[] = $oShop_Discount_Siteuser_Group->siteuser_group_id;\n\t\t\t\t}\n\n\t\t\t\tforeach ($aSiteuser_Groups as $siteuser_group_id => $name)\n\t\t\t\t{\n\t\t\t\t\t$bSiteuserGroupChecked = Core_Array::getPost('siteuser_group_' . $siteuser_group_id);\n\n\t\t\t\t\tif ($bSiteuserGroupChecked)\n\t\t\t\t\t{\n\t\t\t\t\t\tif (!in_array($siteuser_group_id, $aTmp))\n\t\t\t\t\t\t{\n\n\t\t\t\t\t\t\t$oShop_Discount_Siteuser_Group = Core_Entity::factory('Shop_Discount_Siteuser_Group');\n\t\t\t\t\t\t\t$oShop_Discount_Siteuser_Group->siteuser_group_id = $siteuser_group_id;\n\t\t\t\t\t\t\t$this->_object->add($oShop_Discount_Siteuser_Group);\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 (in_array($siteuser_group_id, $aTmp))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$oShop_Discount_Siteuser_Group = $this->_object->Shop_Discount_Siteuser_Groups->getObject($this->_object, $siteuser_group_id);\n\n\t\t\t\t\t\t\t!is_null($oShop_Discount_Siteuser_Group)\n\t\t\t\t\t\t\t\t&& $oShop_Discount_Siteuser_Group->delete();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\tbreak;\n\t\t}\n\n\t\tCore_Event::notify(get_class($this) . '.onAfterRedeclaredApplyObjectProperty', $this, array($this->_Admin_Form_Controller));\n\n\t\treturn $this;\n\t}", "public function createRule($rand_code, $expiration_time, $discount_type, $discount_amount, $allow_free_shipping, $stop_further_discount)\n {\n try {\n $customer_groups = $this->getCustomerGroups(); //get through functions\n\n $from_date = date('Y-m-d');\n if ($expiration_time > 1) {\n $to_date = date('Y-m-d', strtotime($from_date . ' + ' . $expiration_time . ' days'));\n } else {\n $to_date = date('Y-m-d', strtotime($from_date . ' + 1 day'));\n }\n$from_date = date('Y-m-d', strtotime($from_date . ' -1 day'));\n $rule = Mage::getModel('salesrule/rule');\n $rule->setName($rand_code);\n $rule->setDescription('Coupon Created By Spin and Win (Knowband)');\n $rule->setFromDate($from_date); //starting today\n $rule->setToDate($to_date); //if you need an expiration date\n $rule->setCouponType(2);\n $rule->setCouponCode($rand_code);\n $rule->setUsesPerCoupon(1); //number of allowed uses for this coupon\n $rule->setUsesPerCustomer(1); //number of allowed uses for this coupon for each customer\n $rule->setCustomerGroupIds($customer_groups); //if you want only certain groups replace getAllCustomerGroups() with an array of desired ids \n $rule->setIsActive(1);\n\n $rule->setStopRulesProcessing($stop_further_discount); //set to 1 if you want all other rules after this to not be processed\n $rule->setIsRss(0); //set to 1 if you want this rule to be public in rss\n $rule->setIsAdvanced(1); //have no idea what it means :)\n $rule->setProductIds('');\n $rule->setSortOrder(0); // order in which the rules will be applied\n $rule->setWebsiteIds(array(Mage::app()->getWebsite()->getId())); // order in which the rules will be applied\n\n if ($discount_type == 'fixed') {\n $rule->setSimpleAction('by_fixed');\n } else {\n $rule->setSimpleAction('by_percent');\n }\n\n //all available discount types\n //by_percent - Percent of product price discount\n //by_fixed - Fixed amount discount\n //cart_fixed - Fixed amount discount for whole cart\n //buy_x_get_y - Buy X get Y free (discount amount is Y)\n\n $rule->setDiscountAmount($discount_amount); //the discount amount/percent. if SimpleAction is by_percent this value must be <= 100\n $rule->setDiscountQty(0); //Maximum Qty Discount is Applied to\n $rule->setDiscountStep(0); //used for buy_x_get_y; This is X\n if ($allow_free_shipping) {\n $rule->setSimpleFreeShipping(Mage_SalesRule_Model_Rule::FREE_SHIPPING_ADDRESS); //set to 1 for Free shipping\n $rule->setApplyToShipping(1); //set to 1 for Free shipping\n } else {\n $rule->setSimpleFreeShipping(0); //set to 1 for Free shipping\n $rule->setApplyToShipping(0); //set to 1 for Free shipping\n }\n\n// $rule->setApplyToShipping(0); //set to 0 if you don't want the rule to be applied to shipping\n// $rule->setWebsiteIds(array(1));//if you want only certain websites replace getAllWbsites() with an array of desired ids\n\n $conditions = array();\n $conditions[1] = array(\n 'type' => 'salesrule/rule_condition_combine',\n 'aggregator' => 'all',\n 'value' => \"1\", //[UPDATE] added quotes on the value. Thanks Aziz Rattani [/UPDATE]\n 'new_child' => ''\n );\n //the conditions above are for 'if all of these conditions are true'\n //for if any one of the conditions is true set 'aggregator' to 'any'\n //for if all of the conditions are false set 'value' to 0.\n //for if any one of the conditions is false set 'aggregator' to 'any' and 'value' to 0\n $conditions['1--1'] = Array\n (\n 'type' => 'salesrule/rule_condition_address',\n 'attribute' => 'base_subtotal',\n 'operator' => '>=',\n 'value' => 1\n );\n //the constraints above are for 'Subtotal is equal or grater than 200'\n //for 'equal or less than' set 'operator' to '<='... You get the idea other operators for numbers: '==', '!=', '>', '<'\n //for 'is one of' set operator to '()';\n //for 'is not one of' set operator to '!()';\n //in this example the constraint is on the subtotal\n //for other attributes you can change the value for 'attribute' to: 'total_qty', 'weight', 'payment_method', 'shipping_method', 'postcode', 'region', 'region_id', 'country_id'\n //to add an other constraint on product attributes (not cart attributes like above) uncomment and change the following:\n /*\n $conditions['1--2'] = array\n (\n 'type' => 'salesrule/rule_condition_product_found',//-> means 'if all of the following are true' - same rules as above for 'aggregator' and 'value'\n //other values for type: 'salesrule/rule_condition_product_subselect' 'salesrule/rule_condition_combine'\n 'value' => 1,\n 'aggregator' => 'all',\n 'new_child' => '',\n );\n\n $conditions['1--2--1'] = array\n (\n 'type' => 'salesrule/rule_condition_product',\n 'attribute' => 'sku',\n 'operator' => '==',\n 'value' => '12',\n );\n */\n //$conditions['1--2--1'] means sku equals 12. For other constraints change 'attribute', 'operator'(see list above), 'value'\n\n $rule->setData('conditions', $conditions);\n $rule->loadPost($rule->getData());\n $rule->save();\n return true;\n } catch (Exception $e) {\n Mage::logException($e);\n return false;\n }\n }", "public function updateCategories()\n {\n $this->updateCategoriesByType();\n $this->updateCategoriesByParent();\n $this->updateCategoriesByID();\n }", "public function getDiscountAmount();", "public function setPriceDiscount($priceDiscount)\n\t{\n\t\t$this->priceDiscount = $priceDiscount;\n\n\t\treturn $this;\n\t}", "public function setDiscountAttribute($val)\n {\n return (int)$this->attributes['discount'] = $val;\n }", "public function setBaseDiscountAmount($amount);", "protected function _applyCoupon($coupon, $price)\n {\n\n $db = & JFactory::getDBO();\n $user = & JFactory::getUser();\n $sid = JRequest::getInt('sid');\n\n // Update used time for this coupon\n $sql = 'UPDATE #__jms_coupons' .\n ' SET used_time = used_time + 1' .\n ' WHERE code = \"' . $coupon . '\"'\n ;\n $db->setQuery($sql);\n $db->query();\n\n // Get coupon information\n $sql = 'SELECT *' .\n ' FROM #__jms_coupons' .\n ' WHERE code = \"' . $coupon . '\"'\n ;\n $db->setQuery($sql);\n $row = $db->loadObject();\n\n // Make coupon history for this current user\n $sql = 'INSERT INTO #__jms_coupon_subscrs' .\n ' VALUES (\"\", ' . $user->get('id') . ', ' . $row->id . ', ' . $sid . ', NOW(), ' . $price . ', ' . $row->discount . ', ' . $row->discount_type . ', ' . $row->recurring . ', ' . $row->num_recurring . ')'\n ;\n $db->setQuery($sql);\n $db->query();\n\n // Discount based on amount\n if ($row->discount_type == 2)\n {\n $new = round(($row->discount - $price), 2);\n if ($new < 0) $new = 0;\n $sql = 'UPDATE #__jms_coupons' .\n ' SET discount = ' . $new .\n ' WHERE code = \"' . $coupon . '\"'\n ;\n $db->setQuery($sql);\n $db->query();\n\n $out = $price - $row->discount;\n if ($out < 0) $out = 0;\n $out = round($out, 2);\n } else\n {\n $out = $price - ($price * ($row->discount / 100));\n $out = round($out, 2);\n }\n return $out;\n }", "function calculatePrice($price, $discount){\n\t$DollarsOFF = $price * ($discount/100);\n\t$finalPrice = $price - $DollarsOFF;\n\treturn $finalPrice;\n}", "public function HM_CategoCuentas()\n {\n }", "protected function _initTotals()\n\t{\n\t\tparent::_initTotals();\n\t\t$amount = $this->getSource()->getTablepriceDiscountAmount();\n\t\tif ($amount) {\n\t\t\t$this->addTotalBefore(new Varien_Object(array(\n\t\t\t\t'code' => 'fvets_tableprice',\n\t\t\t\t'value' => $amount,\n\t\t\t\t'base_value'=> $amount,\n\t\t\t\t'label' => $this->helper('fvets_tableprice')->__('Table discount'),\n\t\t\t), array('nominal', 'subtotal')));\n\t\t}\n\n\t\treturn $this;\n\t}", "public function applyDiscount()\n {\n if (request('discountType') == 1) {\n cart()->applyDiscount($percentage = request('red'));\n return $this->getCartDetails();\n }\n cart()->applyFlatDiscount($amount = request('discountInput'));\n\n return redirect()->route('cart');\n }", "public function getDiscount()\r\n {\r\n return $this->discount;\r\n }", "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 }", "function sensible_category() {\n wp_update_term(1, 'category', array(\n 'name' => 'News',\n 'slug' => 'news', \n 'description' => 'News'\n ));\n }", "private function calculate_summary_discount($discount_data, $taxable_value_ex_tax = 0, $non_taxable_value = 0, $tax_value = 0, $tax_rate = FALSE, \r\n\t\t$append_values = TRUE, $target_column = FALSE)\r\n\t{\r\n\t\t// Only allow 'New Value' discounts to be applied to the shipping rate, otherwise a cart of unlimited items could be sold for the 'New Value'.\r\n\t\tif (empty($discount_data) || (isset($discount_data['calculation_id']) && $discount_data['calculation_id'] == 3 && $target_column != 'shipping')\r\n\t\t)\r\n\t\t{\r\n\t\t\treturn FALSE;\r\n\t\t}\r\n\t\t\r\n\t\t// Calculate the non discounted summary total.\r\n\t\t$non_discounted_total = ($this->flexi_cart->cart_prices_inc_tax()) ? \r\n\t\t\tround(($taxable_value_ex_tax + $non_taxable_value + $tax_value), 2) : round(($taxable_value_ex_tax + $non_taxable_value), 2);\r\n\r\n\t\t// Calculate discount value.\r\n\t\t$discount = $this->calculate_discount(\r\n\t\t\t$discount_data['value_discounted'], $taxable_value_ex_tax, $non_taxable_value, $tax_value, $tax_rate,\r\n\t\t\t$discount_data['calculation_id'], $discount_data['tax_method']\r\n\t\t);\r\n\t\t\r\n\t\t// If a 'new value' shipping discount has been set that costs more than the original value, recalculate the 'new value' to equal the original value.\r\n\t\tif (($target_column == 'shipping' && $discount_data['calculation_id'] == 3) && ($discount['total'] > $non_discounted_total))\r\n\t\t{\r\n\t\t\t$discount = $this->calculate_discount(\r\n\t\t\t\t$non_discounted_total, $taxable_value_ex_tax, $non_taxable_value, $tax_value, $tax_rate,\r\n\t\t\t\t$discount_data['calculation_id'], $discount_data['tax_method']\r\n\t\t\t);\r\n\t\t}\r\n\t\t\t\t\r\n\t\t// Check discount value is set and is not more than the target column value, else it would result in a negative value.\r\n\t\tif ($discount && ($non_discounted_total >= $discount['total']))\r\n\t\t{\r\n\t\t\t$discount['non_combinable'] = (bool)$discount_data['non_combinable'];\r\n\t\t\t$discount['void_reward_points'] = (bool)$discount_data['void_reward_points'];\r\n\t\t\t\t\r\n\t\t\t// Calculate discount value and discount tax.\r\n\t\t\t$discount['value'] = ($discount['tax_method'] == 1) ? ($non_discounted_total - $discount['total']) : \r\n\t\t\t\t(($taxable_value_ex_tax + $non_taxable_value) - ($discount['taxable_value'] + $discount['non_taxable_value']));\r\n\t\t\t$discount['discount_tax'] = ($discount['value'] - ($taxable_value_ex_tax - $discount['taxable_value']) > 0) ?\r\n\t\t\t\t($discount['value'] - ($taxable_value_ex_tax - $discount['taxable_value'])) : 0;\r\n\r\n\t\t\tif ($target_column != 'reward_vouchers')\r\n\t\t\t{\r\n\t\t\t\t// Update summary discount data.\r\n\t\t\t\t$this->flexi->cart_contents['settings']['discounts']['data']['summary_discount_savings'] += $discount['value'];\t\r\n\t\t\t\t$this->flexi->cart_contents['settings']['tax']['data']['summary_discount_tax'] += $discount['discount_tax'];\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\t// Update reward voucher data.\r\n\t\t\t\t$this->flexi->cart_contents['settings']['discounts']['data']['reward_vouchers'] += $discount['value'];\t\r\n\t\t\t\t$this->flexi->cart_contents['settings']['tax']['data']['reward_voucher_tax'] += $discount['discount_tax'];\r\n\t\t\t}\t\t\t\t\r\n\t\t\t\r\n\t\t\t// Update tax columns.\r\n\t\t\tif ($append_values)\r\n\t\t\t{\r\n\t\t\t\t$this->flexi->cart_contents['settings']['tax']['data']['cart_tax'] += $discount['tax_value'];\r\n\t\t\t\t$this->flexi->cart_contents['settings']['tax']['data']['cart_taxable_value'] += $discount['taxable_value'];\r\n\t\t\t\t$this->flexi->cart_contents['settings']['tax']['data']['cart_non_taxable_value'] += $discount['non_taxable_value'];\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\t$this->flexi->cart_contents['settings']['tax']['data']['cart_tax'] = $discount['tax_value'];\r\n\t\t\t\t$this->flexi->cart_contents['settings']['tax']['data']['cart_taxable_value'] = $discount['taxable_value'];\r\n\t\t\t\t$this->flexi->cart_contents['settings']['tax']['data']['cart_non_taxable_value'] = $discount['non_taxable_value'];\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\treturn $discount;\r\n\t\t}\r\n\t\t\r\n\t\treturn FALSE;\r\n\t}", "public function addDiscountToOrder($ord_dtl_id,$discount){\r\t\tif(is_gt_zero_num($ord_dtl_id) && is_gt_zero_num($discount)){\r\t\t\tif ($this->readObject(array(ORD_DTL_ID=>$ord_dtl_id))){\r\t\t\t\t//..get the discount value\r\t\t\t\t$discount_val=0;\r\t\t\t\t$discount_detail=tbl_discounts::GetInfo($discount);\r\t\t\t\t\r\t\t\t\tif(is_not_empty($discount_detail)){\r\t\t\t\t\t\tif($discount_detail[DISCOUNT_TYPE]=='PERCENT'){\r\t\t\t\t\t\t\t$discount_val=($this->getord_dtl_price()*($discount_detail[DISCOUNT_PERCENT]/100));\r\t\t\t\t\t\t}else{\r\t\t\t\t\t\t\t$discount_val=($discount_detail[DISCOUNT_PERCENT]);\r\t\t\t\t\t\t}\r\t\t\t\t}\t\t\t\t\r\t\t\t\t\r\t\t\t\t$qry = \"UPDATE \".TBL_ORDER_DETAILS.RET.\"SET\".RET.\"\r\t\t\t\".ORD_DTL_DISCOUNT.\" = \".$discount_val.\" WHERE \".ORD_DTL_ID.\"={$ord_dtl_id}\";\r\t\t\t\t$res = mysql_query($qry);\r\t\t\t\tif($res){\r\t\t\t\t\treturn 1;\r\t\t\t\t}\r\t\t\t}\r\t\t}\r\t\treturn 0;\r\t}", "public function setSubCategory($val)\n {\n $this->_propDict[\"subCategory\"] = $val;\n return $this;\n }", "public function addDietaryCategory(){\n \t$id = $this->formValueForKey(\"dietaryCategorySelection\");\n \t \n \t$foundDietaryCategory = BLGenericRecord::recordMatchingKeyAndValue(\"DietaryCategory\", \"id\", $id);\n \t$this->currentRecipe()->addDietaryCategory($foundDietaryCategory);\n }", "public function getDiscount()\n\t{\n\t\treturn $this->getKeyValue('Discount'); \n\n\t}", "public function setDiscountRate($value){\n return $this->setParameter('discount_rate', $value);\n }", "public function addDiscount(DiscountInterface $discount);", "function fillInCategories()\n {\n #echo \"eZNewsFlowerArticleCreator::fillInCategories()<br />\\n\";\n\n $name = $this->IniObject->GlobalIni->read_var( \"eZNewsCustomer\", \"Name\" );\n $itemType = new eZNewsItemType( \"flowercategory\" );\n $changeType = new eZNewsChangeType( \"publish\" );\n \n $categories = new eZNewsItem( $name );\n $categories->getChildren( &$childrenItems, $count );\n\n $canonicalParent = $this->Item->getIsCanonical();\n\n $i = 0;\n foreach( $childrenItems as $child )\n {\n $child->get( $outID );\n if( $child->ItemTypeID() == $itemType->ID() && $changeType->ID() == $child->status() )\n {\n $this->IniObject->set_var( \"item_id\", $child->ID() );\n $this->IniObject->set_var( \"item_name\", $child->name() );\n $this->IniObject->set_var( \"Selected\", \"\" );\n if( $i == 0 && empty( $canonicalParent ) )\n {\n $this->IniObject->set_var( \"Selected\", \"selected\" );\n }\n\n if( $child->ID() == $canonicalParent || $child->Name() == $canonicalParent ) \n {\n $this->IniObject->set_var( \"Selected\", \"selected\" );\n }\n \n $this->IniObject->parse( \"item\", \"item_template\", true );\n \n $i++;\n }\n }\n }", "protected function _initTotals() {\n parent::_initTotals();\n $order = $this->getOrder();\n $payment = $order->getPayment();\n $paymentMethodCode = $payment->getMethodInstance()->getCode();\n\n if (Mage::helper('ipgbase')->isIpagarePaymentMethod($paymentMethodCode)) {\n $amount = Mage::getModel($paymentMethodCode . '/discount')->getIpgDiscount($order);\n if (abs($amount) > 0) {\n $baseAmount = Mage::getModel($paymentMethodCode . '/discount')->getIpgBaseDiscount($order);\n $code = Mage::getModel($paymentMethodCode . '/discount')->getIpgDiscountCode();\n $this->addTotal(new Varien_Object(array(\n 'code' => $code,\n 'value' => $amount,\n 'base_value' => $baseAmount,\n 'label' => Mage::helper($paymentMethodCode)->__('Payment Discount'),\n )));\n }\n }\n return $this;\n }", "public function setSubtotal($amount);", "public function withDiscountAmount($discount)\n {\n $this->_model['discount'] = $discount;\n return $this;\n }", "function convert_sub_category( &$obj )\n\t{\n\t\t\n\t\t// added_date timestamp string\n\t\t$obj->added_date_str = ago( $obj->added_date );\n\t\t\n\t\t// set default photo\n\t\t$obj->default_photo = $this->get_default_photo( $obj->id, 'sub_category' );\n\n\t\t// set default icon \n\t\t$obj->default_icon = $this->get_default_photo( $obj->id, 'subcat_icon' );\n\t}", "public function postProcess() {\n if ($this->_action & CRM_Core_Action::DELETE) {\n CRM_CiviDiscount_BAO_Item::del($this->_id);\n CRM_Core_Session::setStatus(ts('Selected Discount has been deleted.'));\n return;\n }\n\n if ($this->_action & CRM_Core_Action::COPY) {\n $params = $this->exportValues();\n $newCode = CRM_CiviDiscount_Utils::randomString('abcdefghjklmnpqrstwxyz23456789', 8);\n CRM_CiviDiscount_BAO_Item::copy($this->_cloneID, $params, $newCode);\n CRM_Core_Session::setStatus(ts('Selected Discount has been duplicated.'));\n return;\n }\n\n $params = $this->exportValues();\n\n if ($this->_action & CRM_Core_Action::UPDATE) {\n $params['id'] = $this->_id;\n }\n $params['multi_valued'] = $this->_multiValued;\n\n if(in_array(0, $params['events']) && count($params['events']) > 1) {\n CRM_Core_Session::setStatus(ts('You selected `any event` and specific events, specific events have been unset'));\n $params['events'] = array(0);\n }\n\n $params['filters'] = $this->getFiltersFromParams($params);\n $item = CRM_CiviDiscount_BAO_Item::add($params);\n\n CRM_Core_Session::setStatus(ts('The discount \\'%1\\' has been saved.',\n array(1 => $item->description ? $item->description : $item->code)));\n }", "public function setOrderSubtotals($data, $order)\n {\n $couponAmount = $this->_getMultiCardValue($data, 'coupon_amount');\n $transactionAmount = $this->_getMultiCardValue($data, 'transaction_amount');\n \n if (isset($data['total_paid_amount'])) {\n $paidAmount = $this->_getMultiCardValue($data, 'total_paid_amount');\n } else {\n $paidAmount = $data['transaction_details']['total_paid_amount'];\n }\n\n $shippingCost = $this->_getMultiCardValue($data, 'shipping_cost');\n $originalAmount = $transactionAmount + $shippingCost;\n\n if ($couponAmount\n && $this->_scopeConfig->isSetFlag(self::XML_PATH_CONSIDER_DISCOUNT,\\Magento\\Store\\Model\\ScopeInterface::SCOPE_STORE)) {\n $order->setDiscountCouponAmount($couponAmount * -1);\n $order->setBaseDiscountCouponAmount($couponAmount * -1);\n $financingCost = $paidAmount + $couponAmount - $originalAmount;\n } else {\n //if a discount was applied and should not be considered\n $paidAmount += $couponAmount;\n $financingCost = $paidAmount - $originalAmount;\n }\n\n if ($shippingCost > 0) {\n $order->setBaseShippingAmount($shippingCost);\n $order->setShippingAmount($shippingCost);\n }\n\n\n if (\\Zend_Locale_Math::round($financingCost, 4) > 0) {\n $order->setFinanceCostAmount($financingCost);\n $order->setBaseFinanceCostAmount($financingCost);\n }\n\n $order->save();\n }", "public function getDiscount()\n {\n return $this->discount;\n }", "public function getDiscount()\n {\n return $this->discount;\n }", "public function getDiscount()\n {\n return $this->discount;\n }", "public function getDiscount()\n {\n return $this->discount;\n }" ]
[ "0.6628278", "0.6484172", "0.60541254", "0.59014237", "0.5898293", "0.5874136", "0.5737775", "0.56895816", "0.5566527", "0.55375", "0.5516662", "0.54981357", "0.5479552", "0.54725415", "0.54580194", "0.5446289", "0.5420454", "0.5390007", "0.53735644", "0.53536946", "0.5344253", "0.5319163", "0.5313117", "0.5309974", "0.52917176", "0.52913517", "0.5284635", "0.5269505", "0.52363515", "0.5218649", "0.52127016", "0.5202079", "0.51946384", "0.51830983", "0.51790863", "0.5156427", "0.5150687", "0.5148715", "0.5109052", "0.5105115", "0.5100257", "0.5086179", "0.50806785", "0.50710213", "0.5066681", "0.50624347", "0.5040771", "0.5031654", "0.5025964", "0.5021446", "0.50200003", "0.501385", "0.50125444", "0.4993896", "0.49931693", "0.49921006", "0.49876407", "0.49788135", "0.4971215", "0.49684548", "0.4964408", "0.49625003", "0.49436533", "0.49436533", "0.49424663", "0.4935191", "0.4934289", "0.49304292", "0.49255428", "0.48970115", "0.4890278", "0.48753667", "0.48732018", "0.48677573", "0.48560137", "0.48524693", "0.48520204", "0.48480275", "0.48465407", "0.48453286", "0.4837324", "0.48354578", "0.4834757", "0.4830767", "0.48297775", "0.48270977", "0.48209137", "0.48197362", "0.48026326", "0.4788986", "0.47860408", "0.47793248", "0.47763714", "0.47718516", "0.47688764", "0.4768457", "0.47565678", "0.4750386", "0.4750386", "0.4750386", "0.4750386" ]
0.0
-1
Target: Set. "Set discount to set"
protected static function avail_target_set($filter_items, $items, $target, $rule, $sku_id) { // Если условие не задано, прерываем обработку if (empty($target->condition) || !$filter_items) { return false; } $discount_items = self::filter_by_set($items, (array) $target->condition); return self::calculate_target_discount($target, $discount_items, $rule, $sku_id); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function AssignDiscount()\n\t{\t\n\t}", "function set_discount($discount_id = FALSE)\n\t\t{\n\t\t\t$this->load->model('demo_cart_model');\n\t\t\t\n\t\t\t$this->demo_cart_model->demo_set_discount($discount_id);\n\t\t\t\n\t\t\tredirect('cart');\n\t\t}", "public function setDiscount(int $discount): void\n {\n $this->discount = ($discount > 0 && $discount <= 50) ? $discount : 0;\n\n }", "public function setDiscount(string $discount)\n\t{\n\t\t$this->addKeyValue('Discount', $discount); \n\n\t}", "public function setDiscountPercent(?string $value): void {\n $this->getBackingStore()->set('discountPercent', $value);\n }", "public function set_manual_discount($discount_data = FALSE)\r\n\t{\r\n\t\tif (is_array($discount_data) && ! empty($discount_data))\r\n\t\t{\r\n\t\t\t// Check that any submitted 'New value' discounts are only applied to the shipping total. \r\n\t\t\tif (isset($discount_data['column']) && isset($discount_data['calculation']) && ($discount_data['column'] != 'shipping_total') && ($discount_data['calculation'] == 3))\r\n\t\t\t{\r\n\t\t\t\treturn FALSE;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t// Merge the code and manual discounts together, then loop through data and compile an array of all discount ids currently in use.\r\n\t\t\t$existing_discounts = array_merge($this->flexi->cart_contents['settings']['discounts']['manual'], $this->flexi->cart_contents['settings']['discounts']['codes']);\r\n\t\t\t$existing_ids = array();\r\n\t\t\t\t\r\n\t\t\tforeach($existing_discounts as $existing_discount)\r\n\t\t\t{\r\n\t\t\t\t$existing_ids[] = $existing_discount['id'];\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t// If an id is not set in the submitted '$discount_data', or if a discount with a matching id already exists, set a new id. \r\n\t\t\tif (! isset($discount_data['id']) || in_array($discount_data['id'], $existing_ids))\r\n\t\t\t{\r\n\t\t\t\t$id = 0;\r\n\t\t\t\twhile (in_array('manual_'.$id, $existing_ids))\r\n\t\t\t\t{\r\n\t\t\t\t\t$id++; \r\n\t\t\t\t}\r\n\t\t\t\t$id = $discount_data['id'] = 'manual_'.$id;\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\t$id = $discount_data['id'];\r\n\t\t\t}\r\n\t\t\r\n\t\t\t// Set default values if not submitted.\r\n\t\t\t$discount_data['description'] = (! isset($discount_data['description'])) ? FALSE : $discount_data['description'];\r\n\t\t\t$discount_data['value'] = (! isset($discount_data['value'])) ? 0 : $discount_data['value'];\r\n\t\t\t$discount_data['column'] = (! isset($discount_data['column'])) ? 'total' : $discount_data['column'];\r\n\t\t\t$discount_data['calculation'] = (! isset($discount_data['calculation'])) ? 1 : $discount_data['calculation'];\r\n\t\t\t$discount_data['tax_method'] = (! isset($discount_data['tax_method'])) ? FALSE : $discount_data['tax_method'];\r\n\t\t\t$discount_data['void_reward_points'] = (! isset($discount_data['void_reward_points'])) ? FALSE : $discount_data['void_reward_points'];\r\n\t\t\t\r\n\t\t\t// Set the cart column the discount is targeting and use the value to act as the discounts array key. \r\n\t\t\t// This prevents multiple discounts being applied to the same cart column.\r\n\t\t\t$target_column = $discount_data['column'];\r\n\t\t\t\r\n\t\t\t// Loop through data and set to cart session summary.\r\n\t\t\tforeach($discount_data as $column => $column_value)\r\n\t\t\t{\r\n\t\t\t\tif ($column == 'value')\r\n\t\t\t\t{\r\n\t\t\t\t\t// If a valid discount value is not set, set the default value as zero. \r\n\t\t\t\t\t$column_value = ($this->non_negative($column_value)) ? $this->format_calculation($column_value, 2, TRUE) : 0;\r\n\t\t\t\t}\r\n\t\t\t\telse if ($column == 'column')\r\n\t\t\t\t{\r\n\t\t\t\t\t// If a valid column is not set, discount the 'total' column by default. \r\n\t\t\t\t\t$column_value = (in_array($column_value, array('item_summary_total', 'shipping_total', 'total'))) ? $column_value : 'total';\r\n\t\t\t\t}\r\n\t\t\t\telse if ($column == 'calculation') \r\n\t\t\t\t{\r\n\t\t\t\t\t// If a valid calculation method is not set, a 'percentage' based calculation is set by default.\r\n\t\t\t\t\t// 1 = Percentage Based, 2 = Flat Fee, 3 = New Value.\r\n\t\t\t\t\t$column_value = (in_array($column_value, array(1,2,3))) ? $column_value : 1;\r\n\t\t\t\t}\r\n\t\t\t\telse if ($column == 'tax_method')\r\n\t\t\t\t{\r\n\t\t\t\t\t// If a valid tax method is not set, the tax method is defined by whether cart prices ex/include taxes by default.\r\n\t\t\t\t\t// 0 = Carts Default Tax Method, 1 = Apply Tax Before Discount, 2 = Apply Discount Before Tax, 3 = Apply Discount Before Tax, Add Original Tax.\r\n\t\t\t\t\t$column_value = (in_array($column_value, array(0, 1,2,3))) ? $column_value : 0;\r\n\t\t\t\t}\r\n\t\t\t\telse if ($column == 'void_reward_points')\r\n\t\t\t\t{\r\n\t\t\t\t\t$column_value = (bool)$column_value;\r\n\t\t\t\t}\r\n\t\t\t\telse if (! in_array($column, array('id', 'description')))\r\n\t\t\t\t{\r\n\t\t\t\t\tcontinue;\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\t$this->flexi->cart_contents['settings']['discounts']['manual'][$target_column][$column] = $column_value;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\treturn TRUE;\r\n\t\t}\r\n\t\t\r\n\t\treturn FALSE;\r\n\t}", "public function setDiscountAmount($amount);", "public function set_discount_defaults()\r\n\t{\r\n\t\t// Set array placeholders.\r\n\t\tif (! isset($this->flexi->cart_contents['settings']['discounts']['codes']))\r\n\t\t{\r\n\t\t\t$this->flexi->cart_contents['settings']['discounts']['codes'] = array();\r\n\t\t}\r\n\t\tif (! isset($this->flexi->cart_contents['settings']['discounts']['manual']))\r\n\t\t{\r\n\t\t\t$this->flexi->cart_contents['settings']['discounts']['manual'] = array();\r\n\t\t}\t\r\n\t\r\n\t\t// Reset other discount data.\r\n\t\t$this->flexi->cart_contents['settings']['discounts']['active_items'] = array();\r\n\t\t$this->flexi->cart_contents['settings']['discounts']['active_summary'] = array();\r\n\t\t$this->flexi->cart_contents['settings']['discounts']['reward_vouchers'] = array();\r\n\t\t$this->flexi->cart_contents['settings']['discounts']['data']['item_discount_savings'] = 0;\r\n\t\t$this->flexi->cart_contents['settings']['discounts']['data']['summary_discount_savings'] = 0;\r\n\t\t$this->flexi->cart_contents['settings']['discounts']['data']['reward_vouchers'] = 0;\r\n\t\t$this->flexi->cart_contents['settings']['discounts']['data']['void_reward_point_items'] = array();\r\n\r\n\t\tif (! isset($this->flexi->cart_contents['settings']['discounts']['data']['excluded_discounts']))\r\n\t\t{\r\n\t\t\t$this->flexi->cart_contents['settings']['discounts']['data']['excluded_discounts'] = array();\r\n\t\t}\t\r\n\t\t\r\n\t\treturn TRUE;\r\n\t}", "public function testSetGetDiscount()\n {\n $this->item->setPrice(85.00);\n $this->item->setQuantity(1);\n $this->item->addDiscount(\n (new FlatDiscount())\n ->setFigure(15.00)\n );\n\n $this->assertEquals($this->item->getPriceTotal(), 85.00);\n $this->assertEquals($this->item->getNetTotal(), 70.00);\n $this->assertEquals($this->item->getDiscount(), 15.00);\n }", "public function setDiscountUid(?string $discountUid): void\n {\n $this->discountUid = $discountUid;\n }", "function setup() {\r\n // \"Buy more than 100 items, get 50 (% or $, as per admin) off\" \r\n // $this->add_extra_level_discount(100, 50);\r\n }", "public function setDiscount(?float $discount): self\n {\n $this->initialized['discount'] = true;\n $this->discount = $discount;\n\n return $this;\n }", "function pp_edd_auto_apply_discount() {\n\n\tif ( function_exists( 'edd_is_checkout' ) && edd_is_checkout() ) {\n\n\t\tif ( ! edd_cart_has_discounts() && edd_is_discount_valid( 'BFCM2016', '', false ) ) {\n\t\t\tedd_set_cart_discount( 'BFCM2016' );\n\t\t}\n\n\t}\n\n}", "public function setDiscountAttribute($val)\n {\n return (int)$this->attributes['discount'] = $val;\n }", "public function setDiscountAmount($value){\n return $this->setParameter('discount_amount', $value);\n }", "protected function setOfferValue ()\n {\n $this->request->coupon_benefits[ $this->offerNature ] = $this->offer->rate;\n }", "protected function calculateDiscount() : void{\r\n $percentage = ($this->discounted_value * 100) / $this->order->getTrueTotal();\r\n $new_total = $this->order->getTrueTotal() - $this->discounted_value;\r\n\r\n $this->order_discount_value = $this->discounted_value;\r\n $this->order_discount_percentage = $percentage;\r\n $this->order_discount_reason = \"For every \" . $this->products_nr . \" products from category #\" . $this->category_id . \" you get one free. You got: \";\r\n foreach($this->items_matching as $item){\r\n $this->order_discount_reason .= floor($item[\"qty\"] / $this->products_nr) . \" x '\" . $item[\"description\"] . \"' (€\". $item[\"price\"] .\" each) ; \";\r\n }\r\n $this->order_new_total = $new_total;\r\n }", "public function setDiscountRate($value){\n return $this->setParameter('discount_rate', $value);\n }", "public function applyGlobalDiscount($discount_rate)\n {\n }", "public function updateAffectedPlans(Discount $discount)\n {\n }", "public function setCalculateDiscountOnCreditMemos(?bool $value): void {\n $this->getBackingStore()->set('calculateDiscountOnCreditMemos', $value);\n }", "public function setAttributes_discounted( $attributes_discounted ) {\n\t\t$this->attributes_discounted = $attributes_discounted;\n\t}", "public function setBaseDiscountAmount($amount);", "public function set_credits_discountamount($observer)\n {\n$array2 = Mage::helper('kartparadigm_storecredit')->getCreditRates();\n//Mage::log(Mage::helper('kartparadigm_storecredit')->getRefundDeductConfig() . \" configuration settings \");\n//Mage::log($array2);\n $session = Mage::getSingleton('checkout/session');\n if(Mage::helper('customer')->isLoggedIn()) {\n $customer = Mage::getSingleton('customer/session')->getCustomer();\n $customer_group=Mage::getModel('customer/group')->load(Mage::getSingleton('customer/session')->getCustomerGroupId())->getCustomerGroupCode();\n}\n \n$val1 = Mage::getSingleton('adminhtml/session')->getValue();\nif(isset($val1))\n{\n$amt1 = array();\n$amt1 = Mage::getSingleton('checkout/session')->getCredits();\n$amt = $amt1['totalCredits'];\n$quote = Mage::getSingleton('adminhtml/session_quote')->getQuote();\n}\nelse{\n$amt1 = array();\n $quote = Mage::getModel('checkout/cart')->getQuote();\n$amt1 = Mage::getSingleton('checkout/session')->getCredits();\n$amt = $amt1['discountCredits'];\n}\n $isvirtual=0;\n foreach($quote->getAllItems() as $item){\n if($item->getIsVirtual()==1) {\n $isvirtual=1;\n }\n if(Mage::getModel('catalog/product')->load($item->getProductId())->getTypeId()=='customproduct'){\n $isvirtual=1;\n }\n }\n$total=$quote->getGrandTotal(); \n\n$subTotal = $quote->getSubtotal();\n//Mage::log($quote->getGrandTotal().\"this is grand total store credit\");\n//Mage::log($quote->getSubtotal().\"this is sub total\");\n\n if (!Mage::helper('kartparadigm_storecredit')->getTaxEnabled()){\n$tax = $quote->getShippingAddress()->getData('tax_amount');\n}\n if(!Mage::helper('kartparadigm_storecredit')->getIsShippingEnabled()){\n$shippingPrice = $quote->getShippingAddress()->getShippingAmount();\n}\n$totalCredits1 = array();\n$totalCredits1 = Mage::getSingleton('checkout/session')->getCredits();\n$totalCredits = $totalCredits1['totalCredits'];\n\n$currentTimestamp = Mage::getModel('core/date')->timestamp(time()); \n$nowdate = date('Y-m-d H:m:s', $currentTimestamp); \n//echo $expirydate;\n//echo $nowdate;\n$balance;\n//echo $amt;\n$amt2;\n $amt1;\n \n\nif(isset($amt)){\n/*---------------------Calculating Default Currency Value----------------------- */\n$amt1 = ($array2['basevalue'] * $amt) / $array2['credits'];\n $baseCurrencyCode = Mage::app()->getStore()->getBaseCurrencyCode();\n $currentCurrencyCode = Mage::app()->getStore()->getCurrentCurrencyCode();\n if ($baseCurrencyCode != $currentCurrencyCode) {\n $amt2 = Mage::helper('directory')->currencyConvert($amt1, $baseCurrencyCode, $currentCurrencyCode);\n }\n else{\n $amt2 = $amt1; \n }\n // $amt2 = Mage::helper('core')->currency($amt1, true, false);\n//Mage::log($amt1.\" = amount = \".$amt2 );\n//----------------------------------------------------------------\nif($total > $amt2) {\nif(($total - $tax - $shippingPrice) > $amt2){\n$discountAmount = $amt2;\n$balance = $totalCredits - $amt;\n}else{\n $discountAmount = $subTotal;\n$points = round(($discountAmount * $amt)/$amt2);\n//Mage::log($points.\"Conver Points\");\n$balance = $totalCredits - $points;\n}\n}\nelse {\n$discountAmount = $total - $tax - $shippingPrice;\n$points = round(($discountAmount * $amt)/$amt2);\n//Mage::log($points.\"Conver Points\");\n$balance = $totalCredits - $points;\n}\nMage::getSingleton('core/session')->setBalance($balance);\n\nMage::getSingleton('checkout/session')->setDiscount($totalCredits - $balance);\n$msg = \"Current Credits In Your Account : \" . $balance;\nMage::getSingleton('core/session')->setCredits($msg);\n if ($discountAmount > 0) {\n\n\nif ($baseCurrencyCode != $currentCurrencyCode) {\n \n$allowedCurrencies = Mage::getModel('directory/currency')->getConfigAllowCurrencies();\n$rates = Mage::getModel('directory/currency')->getCurrencyRates($baseCurrencyCode, array_values($allowedCurrencies));\n\n$baseDiscount = $discountAmount/$rates[$currentCurrencyCode];\n\n }\nelse{\n $baseDiscount = $discountAmount;\n } \n $total = $quote->getBaseSubtotal();\n $data1 = $quote->getData();\n // Mage::log($data1['entity_id'].\"quote id\");\n $quote->setSubtotal(0);\n $quote->setBaseSubtotal(0);\n $quote->setSubtotalWithDiscount(0);\n $quote->setBaseSubtotalWithDiscount(0);\n $quote->setGrandTotal(0);\n $quote->setBaseGrandTotal(0);\n $canAddItems = $quote->isVirtual() ? ('billing') : ('shipping');\n foreach($quote->getAllAddresses() as $address) {\n $data = $address->getData();\n $address->setSubtotal(0);\n $address->setBaseSubtotal(0);\n $address->setGrandTotal(0);\n $address->setBaseGrandTotal(0);\n $address->collectTotals();\n $quote->setSubtotal((float)$quote->getSubtotal() + $address->getSubtotal());\n $quote->setBaseSubtotal((float)$quote->getBaseSubtotal() + $address->getBaseSubtotal());\n $quote->setSubtotalWithDiscount((float)$quote->getSubtotalWithDiscount() + $address->getSubtotalWithDiscount());\n $quote->setBaseSubtotalWithDiscount((float)$quote->getBaseSubtotalWithDiscount() + $address->getBaseSubtotalWithDiscount());\n $quote->setGrandTotal((float)$quote->getGrandTotal() + $address->getGrandTotal());\n $quote->setBaseGrandTotal((float)$quote->getBaseGrandTotal() + $address->getBaseGrandTotal());\n $quote->setEntityId($data1['entity_id'])->save();\n $quote->setSubtotalWithDiscount($quote->getSubtotal() - $discountAmount)->setBaseSubtotalWithDiscount($quote->getBaseSubtotal() - $baseDiscount)->setEntityId($data1['entity_id'])->save();\n if ($address->getAddressType() == $canAddItems) {\n $address->setSubtotalWithDiscount((float)$data['subtotal_with_discount'] - $discountAmount);\n $address->setGrandTotal((float)$data['grand_total'] - $discountAmount);\n $address->setBaseSubtotalWithDiscount((float)$data['base_subtotal_with_discount'] - $baseDiscount);\n $address->setBaseGrandTotal((float)$data['base_grand_total'] - $baseDiscount);\n if ($data['discount_description']) {\n $address->setDiscountAmount(($data['discount_amount'] - $discountAmount));\n $address->setDiscountDescription($data['discount_description'] . ', Store Credits');\n $address->setBaseDiscountAmount(($data['base_discount_amount'] - $baseDiscount));\n }\n else {\n $address->setDiscountAmount(-($discountAmount));\n $address->setDiscountDescription('Store Credits');\n $address->setBaseDiscountAmount(-($baseDiscount));\n }\n $address->setAddressId($data['address_id'])->save();\n }\n }\n foreach($quote->getAllItems() as $item) {\n\n // We apply discount amount based on the ratio between the GrandTotal and the RowTotal\n $rat = $item->getPriceInclTax() / $quote->getSubtotal();\n $rat1 = $item->getBasePriceInclTax() / $quote->getBaseSubtotal();\n $ratdisc = $discountAmount * $rat;\n $ratdisc1 = $baseDiscount * $rat1;\n//Mage::log($item->getDiscountAmount().\"include tax\".$item->getBaseDiscountAmount());\n // Mage::log($item->getDiscountAmount().\"discount storecredit\");\n$idata = $item->getData();\n Mage::log($item->getDiscountAmount().\"discount amount credit\");\n $item->setDiscountAmount(($item->getDiscountAmount() + $ratdisc) * $item->getQty());\n $item->setBaseDiscountAmount(($item->getBaseDiscountAmount() + $ratdisc1) * $item->getQty())->save();\n }\n }else if($totalCredits == 0){\n\n$msg = \"Sorry You Have No Credits In Your Account\";\nMage::getSingleton('core/session')->setCredits($msg);\n}\n \n \n } \n }", "public function setDiscountDescription($description);", "public function setDiscountDateCalculation(?string $value): void {\n $this->getBackingStore()->set('discountDateCalculation', $value);\n }", "function apply_special_item_discount($id, $count, &$disc_amount) {\r\n switch($id) {\r\n case 99999:\r\n case 99998:\r\n if ($count > 100) {\r\n $disc_amount = 50; \r\n }\r\n break; \r\n case 99997:\r\n $disc_amount = 75;\r\n break; \r\n }\r\n }", "public function setDiscount(int $discount): self\n {\n $this->discount = $discount;\n return $this;\n }", "public function setDiscounts(array $discounts)\r\n {\r\n $this->_discounts = $discounts;\r\n }", "public function setDiscount($value)\n {\n $this->data->amount->subtotals->discount = (float) $value;\n\n return $this;\n }", "public function setDiscountSequence()\n {\n $this->discountSequence = [\n (string)DiscountType::LIMITED_TIME(),\n (string)DiscountType::PERIOD(),\n (string)DiscountType::QUANTITY(),\n ];\n }", "public function updatePercentage(Discount $discount)\n {\n }", "function setSyncItemsPriceAction()\n {\n }", "public function setDiscount($discount)\r\n {\r\n $this->discount = $discount;\r\n\r\n return $this;\r\n }", "public function set_coupon_discount_totals( $value = array() ) {\n\t\t$this->coupon_discount_totals = (array) $value;\n\t}", "public function setShippingDiscountAmount($amount);", "private function setPremiumCode(){\n for($i = 0; $i < 7; $i++) {\n $this->premiumCode .= rand(1,9);\n };\n $this->discount = 10;\n }", "function setPrice($price, $taxPercentage = 25)\n {\n $this->taxPercentage = $taxPercentage;\n $this->taxA = $price / 100 * 100;\n $this->price = $price;\n }", "public function setBaseShippingDiscountAmount($amount);", "public function discountBifurcation(Varien_Event_Observer $observer)\n {\n $rule = $observer->getEvent()->getRule();\n $result = $observer->getEvent()->getResult();\n $itemId = $observer->getEvent()->getItem()->getItemId();\n //set Unique key\n $curUnique= $rule->getRuleId().'_'.$itemId;\n //check if Mage registry unique call set\n if(Mage::registry('uniqueCall')!==null){\n //if check in array\n $uniqueCalls = Mage::registry('uniqueCall');\n if( in_array($curUnique,$uniqueCalls)){\n return;\n }else{\n //unset existing registry. also take existing array in variable\n Mage::unregister('uniqueCall');\n $uniqueCalls[]= $curUnique ;\n //set registry again with new array include $uniqueCall into it\n Mage::register('uniqueCall',$uniqueCalls);\n }\n }else{\n //set registry again with new array include $uniqueCall into it\n $array = array();\n $array[]=$rule->getRuleId().'_'.$itemId;\n Mage::register('uniqueCall',$array);\n\n } \n\n //condition for the Promotional coupons\n if ( $rule->getCouponType() == Mage_SalesRule_Model_Rule::COUPON_TYPE_NO_COUPON ) {\n $promotionDiscount = 0;\n $promotionDiscount = Mage::registry('promotion');\n if (Mage::registry('promotion')!==null){\n Mage::unregister('promotion');\n }\n if (Mage::registry('promo_lable')!==null){\n Mage::unregister('promo_lable');\n }\n $promotionDiscount += $result->getDiscountAmount();\n Mage::register('promotion', $promotionDiscount);\n Mage::register('promo_lable',$rule->getName());\n } elseif ( $rule->getCouponType() == self::COUPON_TYPE_FUE_GENERATED ) {\n $couponDiscount = 0;\n $couponDiscount = Mage::registry('coupon');\n if(Mage::registry('coupon')!==null){\n Mage::unregister('coupon');\n }\n //sum up all the values of discounted coupons\n $couponDiscount += $result->getDiscountAmount();\n Mage::register('coupon',$couponDiscount);\n }\n $quote = $observer->getEvent()->getQuote();\n $quoteAddress = $observer->getEvent()->getAddress();\n //set discounted coupons and promotional coupons amount in quote\n $quote->setCouponDiscount(Mage::registry('coupon'));\n $quote->setPromotionalDiscount(Mage::registry('promotion'));\n\n if (Mage::getStoreConfig('promodiscount/promodiscount/use_default')) {\n $quote->setPromoLable(Mage::getStoreConfig('promodiscount/promodiscount/default_lable'));\n } else {\n if (Mage::registry('promo_lable')) {\n $quote->setPromoLable(Mage::registry('promo_lable'));\n } else {\n $quote->setPromoLable(Mage::getStoreConfig('promodiscount/promodiscount/default_lable'));\n }\n }\n \n $quoteAddress->setCouponDiscount(Mage::registry('coupon'));\n $quoteAddress->setPromotionalDiscount(Mage::registry('promotion'));\n if (Mage::registry('promo_lable')) {\n $quoteAddress->setPromoLable(Mage::registry('promo_lable'));\n } else {\n $quoteAddress->setPromoLable(Mage::getStoreConfig('promodiscount/promodiscount/default_lable'));\n }\n }", "public function setAmount()\n {\n $exact = $this->getOriginalPurgeValue('amount_exact');\n $percentage = $this->getOriginalPurgeValue('amount_percentage');\n\n $this->amount = $this->is_percentage\n ? $percentage\n : $exact;\n }", "private function updateProductDiscount(\n ProductInterface $product,\n Request $request\n ): void {\n $discountPercent = $request->request->get('discount_percent') !== '' ? (float) $request->request->get('discount_percent') : null;\n $discountLimitType = $request->request->get('discount_limit_type') !== '' ? $request->request->get('discount_limit_type') : null;\n $discountFromDate = $request->request->get('discount_from_date') !== '' ? $request->request->get('discount_from_date') : null;\n $discountToDate = $request->request->get('discount_to_date') !== '' ? $request->request->get('discount_to_date') : null;\n\n $variants = $product->getVariants();\n foreach ($variants as $variant) {\n // Variant to change\n $variantPricing = $variant->getChannelPricings()->first();\n\n // Change percent\n if ($discountPercent !== null) {\n $variantPricing->setDiscount($discountPercent / 100);\n }\n\n // Continue if no change type\n if ($discountLimitType === self::LIMIT_NO_CHANGE) {\n continue;\n }\n // Discount type\n $variantPricing->setDiscountLimitType($discountLimitType === self::LIMIT_NONE ? null : $discountLimitType);\n\n // Date type discount\n if ($discountLimitType === self::LIMIT_DATETIME) {\n if ($discountFromDate && $discountToDate) {\n $dateFrom = \\DateTime::createFromFormat('Y-m-d', $discountFromDate);\n $dateTo = \\DateTime::createFromFormat('Y-m-d', $discountToDate);\n\n $variantPricing->setDiscountFrom($dateFrom);\n $variantPricing->setDiscountTo($dateTo);\n }\n\n if ($discountFromDate && !$discountToDate) {\n $dateFrom = \\DateTime::createFromFormat('Y-m-d', $discountFromDate);\n\n $variantPricing->setDiscountFrom($dateFrom);\n $variantPricing->setDiscountTo(null);\n }\n\n if (!$discountFromDate && $discountToDate) {\n $dateTo = \\DateTime::createFromFormat('Y-m-d', $discountToDate);\n\n $variantPricing->setDiscountFrom(null);\n $variantPricing->setDiscountTo($dateTo);\n }\n }\n }\n }", "public function setDiscount($var)\n {\n GPBUtil::checkDouble($var);\n $this->discount = $var;\n\n return $this;\n }", "private function setDiscount( string $type, float $amount, float $discount ): float\n {\n switch( $type ) {\n case 'absolute' :\n $price = $amount - $discount;\n break;\n case 'percent' :\n $price = $amount - ($amount / 100 * $discount);\n break;\n case 'wholesale' :\n $price = $amount;\n break;\n default :\n $price = $amount;\n break;\n }\n\n $price = round(sprintf(\"%01.2f\", ceil($price * 100) / 100), 2);\n\n return $price;\n }", "public function deleteDiscount();", "function setSyncWarranty()\n {\n }", "function discount_rate($discount_rate=null)\n {\n if (isset($discount_rate)) $this->discount_rate = $discount_rate;\n return $this->discount_rate;\n }", "function setPrice( $value )\n {\n if ( $this->State_ == \"Dirty\" )\n $this->get( $this->ID );\n\n $this->Price = $value;\n setType( $this->Price, \"double\" );\n }", "function discount_amount($discount_amount=null)\n {\n if (isset($discount_amount)) $this->discount_amount = $discount_amount;\n return $this->discount_amount;\n }", "function unset_discount($discount_id = FALSE)\n\t\t{\n\t\t\t// The 'unset_discount()' function can accept an array of either discount ids or codes to delete more than one discount at a time.\n\t\t\t// Alternatively, if no data is submitted, the function will delete all discounts that are applied to the cart.\n\t\t\t// This example uses the 1 discount id that was supplied via the url link.\n\t\t\t// $this->flexi_cart->unset_userdata_discount($discount_id); // Can't remeber why this 'stock code' didn't work - said 'undefined method' or something\t\t\n\t\t\t$this->flexi_cart->unset_discount($discount_code);\n\n\t\t\t// Set a message to the CI flashdata so that it is available after the page redirect.\n\t\t\t$this->session->set_flashdata('message', $this->flexi_cart->get_messages());\n\t\t\t\n\t\t\tredirect('cart');\n\t\t}", "public function setPromotion($first,$second)\n {\n $this->promotion->setPromotion($first,$second);\n //product Id for identify products\n $this->promotion->setProductId($this->id);\n }", "protected function setTargetAmountAttribute($value)\n {\n $this->attributes['target_amount'] = preg_replace('/[,]/', '', $value);\n }", "public function setDiscountCanceled($discountCanceled);", "function setPrice($new_price)\n {\n $this->price = $new_price;\n }", "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 }", "function es_cart_change_coupon_label( $html , $coupon){\n\n$html='Discount:';\n\nreturn $html;\n\n}", "public function setDiscounted($s)\n\t{\n\t\t$this->discounted = (bool) $s;\n\n\t\treturn $this;\n\t}", "public function getTonicDiscount()\n {\n }", "public function applyDiscount(Discount $discount){\n\t\tif($this->discount == NULL){\n\t\t\t$this->finalPrice = $this->price*(100-$discount->percent/100);\n\t\t\t$this->discount = $discount;\n\t\t}\n\t\treturn $this;\n\t}", "public static function setUseCoupons($discountList, $use)\n\t{\n\t\tif (!is_array($discountList))\n\t\t\t$discountList = array($discountList);\n\t\t$use = (string)$use;\n\t\tif ($use !== 'Y' && $use !== 'N')\n\t\t\treturn;\n\t\tMain\\Type\\Collection::normalizeArrayValuesByInt($discountList);\n\t\tif (empty($discountList))\n\t\t\treturn;\n\t\t$conn = Main\\Application::getConnection();\n\t\t$helper = $conn->getSqlHelper();\n\t\t$conn->queryExecute(\n\t\t\t'update '.$helper->quote(self::getTableName()).\n\t\t\t' set '.$helper->quote('USE_COUPONS').' = \\''.$use.'\\' where '.\n\t\t\t$helper->quote('ID').' in ('.implode(',', $discountList).')'\n\t\t);\n\t\tunset($helper, $conn);\n\t}", "public function setDiscount($discount)\n {\n $this->discount = $discount;\n\n return $this;\n }", "public function setDiscount($discount)\n {\n $this->discount = $discount;\n\n return $this;\n }", "public function setDiscountInvoiced($discountInvoiced);", "public function setDispute(?Dispute $dispute): void\n {\n $this->dispute = $dispute;\n }", "public function setDiscount($discount)\n {\n $this->discount = $this->db->real_escape_string($discount);\n\n return $this;\n }", "public function setPriceAttribute($value)\n {\n $this->attributes['price'] = $value*100;\n }", "function SetAmountSoldOutside ($amount = 0) {\n\t\n}", "public function setPaid()\n {\n $this->update([\n 'status' => self::STATUS_PAID,\n 'paid_date' => Carbon::now(),\n ]);\n }", "private function setSoldIndividually() {\n $this->product->set_sold_individually($this->wcData->isSoldIndividually());\n }", "private function storeDiscount(SlCustomer $customer, $discount) {\n $slCustomerPresetsDiscount = SlCustomerPresetsDiscount::where('sl_customer_id', $customer->id)->where('flag_delete', false)->first();\n if (!$slCustomerPresetsDiscount) {\n $slCustomerPresetsDiscount = new SlCustomerPresetsDiscount();\n $slCustomerPresetsDiscount->sl_customer_id = $customer->id;\n $slCustomerPresetsDiscount->flag_delete = false;\n }\n $slCustomerPresetsDiscount->discount_percentage = $discount;\n $slCustomerPresetsDiscount->save();\n }", "public static function update_item_with_discount($detail_id,$order_promotion,$order_discount_id,$order_discount_amt){\r\tif(is_gt_zero_num($detail_id)){\r\t\t$objtbl_order_details=new tbl_order_details();\r\t\tif($objtbl_order_details->readObject(array(ORD_DTL_ID=>$detail_id))){\r\t\t\t$objtbl_order_details->setordprom_promotion($order_promotion);\r\t\t\t$objtbl_order_details->setordprom_discount_id($order_discount_id);\r\t\t\t$objtbl_order_details->setordprom_discount_amt($order_discount_amt);\r\t\t\t$objtbl_order_details->insert();\r\t\t\treturn 1;\r\t\t}\r\t\tunset($objtbl_order_details);\t\r\t} \r\treturn 0;\t\r }", "public function setMinDamage(){ $this->minDamage = 10; }", "function _apply_auto_disc()\n\t{\n\t\t$num_items = $this->cart->total_items();\n\t\t$auto_disc_info = null;\n\n\t\tforeach ($this->auto_disc_array as $cart_items => $disc_info)\n\t\t{\n\t\t\tif($num_items >= $cart_items)\n\t\t\t{\n\t\t\t\t$auto_disc_info = $disc_info;\n\t\t\t}\n\t\t}\n\n\t\t$applied_disc = $this->cart->discount_info();\n\n\t\t//auto discount should be more than the applied disc (if any)\n\t\tif($applied_disc['percentage'] < $auto_disc_info['percentage'])\n\t\t{\n\t\t\t$this->_apply_discount( $auto_disc_info['coupon'] );\n\t\t}\t\t\n\t}", "public function setPromotion(Promotion $promotion)\n {\n $result = DB::select('SELECT fn_invoice_item_promo_eligible(?,?) AS eligible', [$this->id,\n $promotion->id]);\n\n if (!empty($result) && $result[0]->eligible != null) {\n $this->promotion_id = null;\n } else {\n $this->promotion_id = $promotion->id;\n $this->load('promotion');\n }\n $this->save();\n $this->_calculateTotal();\n }", "public function setDiscont($value)\n {\n $this->setDiscount($value);\n\n return $this;\n }", "public function setTaxInfo(KCommandContext $context)\n\t{\n\t\t$vats = $context->data->federal_tax;\n \n\t\t$this->getItem()->setFederalTax( KConfig::unbox( $vats ) );\n\t}", "function apply_special_category_discount($category, $count, &$disc_amount) {\r\n switch($category) {\r\n case 99999:\r\n case 99998:\r\n if ($count > 100) {\r\n $disc_amount = 50; \r\n }\r\n break; \r\n case 99997:\r\n $disc_amount = 75;\r\n break;\r\n }\r\n }", "public function setPriceAttribute($value)\n {\n $this->attributes['price'] = $value * 100;\n }", "public function define_dish_price() {\n\t\t\t$res = $this->Restaurant_model->define_price();\n\t\t\tif($res == 'suc_def') {\n\t\t\t\techo 'suc_def';\n\t\t\t}\n\t\t}", "function setSyncItemsPriceStandard()\n {\n }", "function setPrice($price)\n {\n $this->price = $price;\n }", "public function applyCartDiscount(Varien_Event_Observer $observer)\n { \n try\n { \n $bundle_product_ids = [];\n $quote_product_ids = [];\n $cookieValue = Mage::getModel('core/cookie')->get('ivid');\n $userBundleCollection = Mage::getModel('increasingly_analytics/bundle')->getCollection()->addFieldToFilter('increasingly_visitor_id',$cookieValue);\n $items = $observer->getEvent()->getQuote()->getAllItems();\n $eligibleProducts = [];\n $discount = 0;\n foreach ($items as $item) {\n array_push($quote_product_ids, $item->getProductId());\n }\n foreach ($userBundleCollection as $bundle) {\n //First Bundle products\n $bundle_product_ids = explode(',', $bundle->getProductIds()); \n $productsIds = array_intersect($quote_product_ids, $bundle_product_ids);\n if(count($productsIds) == count($bundle_product_ids) )\n $discount += $bundle->getDiscountPrice();\n }\n\n if($discount > 0){\n $quote=$observer->getEvent()->getQuote();\n $quoteid=$quote->getId();\n $discountAmount=$discount;\n if($quoteid) { \n if($discountAmount>0) {\n $total=$quote->getBaseSubtotal();\n $quote->setSubtotal(0);\n $quote->setBaseSubtotal(0);\n\n $quote->setSubtotalWithDiscount(0);\n $quote->setBaseSubtotalWithDiscount(0);\n\n $quote->setGrandTotal(0);\n $quote->setBaseGrandTotal(0);\n \n\n $canAddItems = $quote->isVirtual()? ('billing') : ('shipping'); \n foreach ($quote->getAllAddresses() as $address) {\n\n $address->setSubtotal(0);\n $address->setBaseSubtotal(0);\n\n $address->setGrandTotal(0);\n $address->setBaseGrandTotal(0);\n\n $address->collectTotals();\n\n $quote->setSubtotal((float) $quote->getSubtotal() + $address->getSubtotal());\n $quote->setBaseSubtotal((float) $quote->getBaseSubtotal() + $address->getBaseSubtotal());\n\n $quote->setSubtotalWithDiscount(\n (float) $quote->getSubtotalWithDiscount() + $address->getSubtotalWithDiscount()\n );\n $quote->setBaseSubtotalWithDiscount(\n (float) $quote->getBaseSubtotalWithDiscount() + $address->getBaseSubtotalWithDiscount()\n );\n\n $quote->setGrandTotal((float) $quote->getGrandTotal() + $address->getGrandTotal());\n $quote->setBaseGrandTotal((float) $quote->getBaseGrandTotal() + $address->getBaseGrandTotal());\n\n $quote ->save(); \n\n $quote->setGrandTotal($quote->getBaseSubtotal()-$discountAmount)\n ->setBaseGrandTotal($quote->getBaseSubtotal()-$discountAmount)\n ->setSubtotalWithDiscount($quote->getBaseSubtotal()-$discountAmount)\n ->setBaseSubtotalWithDiscount($quote->getBaseSubtotal()-$discountAmount)\n ->save(); \n\n\n if($address->getAddressType()==$canAddItems) {\n //echo $address->setDiscountAmount; exit;\n $address->setSubtotalWithDiscount((float) $address->getSubtotalWithDiscount()-$discountAmount);\n $address->setGrandTotal((float) $address->getGrandTotal()-$discountAmount);\n $address->setBaseSubtotalWithDiscount((float) $address->getBaseSubtotalWithDiscount()-$discountAmount);\n $address->setBaseGrandTotal((float) $address->getBaseGrandTotal()-$discountAmount);\n if($address->getDiscountDescription()){\n $address->setDiscountAmount(-($address->getDiscountAmount()-$discountAmount));\n $address->setDiscountDescription($address->getDiscountDescription().', Custom Discount');\n $address->setBaseDiscountAmount(-($address->getBaseDiscountAmount()-$discountAmount));\n }else {\n $address->setDiscountAmount(-($discountAmount));\n $address->setDiscountDescription('Custom Discount');\n $address->setBaseDiscountAmount(-($discountAmount));\n }\n $address->save();\n }//end: if\n } //end: foreach\n //echo $quote->getGrandTotal();\n\n foreach($quote->getAllItems() as $item){\n //We apply discount amount based on the ratio between the GrandTotal and the RowTotal\n $rat=$item->getPriceInclTax()/$total;\n $ratdisc=$discountAmount*$rat;\n $item->setDiscountAmount(($item->getDiscountAmount()+$ratdisc) * $item->getQty());\n $item->setBaseDiscountAmount(($item->getBaseDiscountAmount()+$ratdisc) * $item->getQty())->save(); \n }\n } \n }\n }\n }\n catch(Exception $e)\n {\n Mage::log(\"Remove from cart tracking - \" . $e->getMessage(), null, 'Increasingly_Analytics.log');\n }\n\n }", "public function setDiscountRate($rate)\n\t{\n\t\treturn $this->set('DiscountRate', (float) $rate);\n\t}", "public function set_coupon_discount_tax_totals( $value = array() ) {\n\t\t$this->coupon_discount_tax_totals = (array) $value;\n\t}", "public function getDiscount()\r\n {\r\n return $this->discount;\r\n }", "public function setPower()\n {\n $this->_role->power = 200;\n }", "function update_discount_codes()\n\t\t{\n\t\t\t// Get the discount codes from the submitted POST data.\n\t\t\t$discount_data = $this->input->post('discount');\n\t\t\t\n\t\t\t// The 'update_discount_codes()' function will validate each submitted code and apply the discounts that have activated their quantity and value requirements.\n\t\t\t// Any previously set codes that have now been set as blank (i.e. no longer present) will be removed.\n\t\t\t// Note: Only 1 discount can be applied per item and per summary column. \n\t\t\t// For example, 2 discounts cannot be applied to the summary total, but 1 discount could be applied to the shipping total, and another to the summary total.\n\t\t\t$this->flexi_cart->update_discount_codes($discount_data);\n\t\t\t\n\t\t\t// Set a message to the CI flashdata so that it is available after the page redirect.\n\t\t\t$this->session->set_flashdata('message', $this->flexi_cart->get_messages());\n\n\t\t\tredirect('cart');\n\t\t}", "public function testSetType()\n {\n $this->todo('stub');\n }", "protected function setOfferNature ()\n {\n $this->offerNature = $this->offer->rate_nature->value;\n }", "function setItem_price($price){\n $this->item_price = $price;\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 setPromotion(?PromotionInterface $promotion): void\n {\n }", "public function setDiscCalc($discCalc) {\n $this->_discCalc = $discCalc;\n }", "function TaxExclusivePrice(){\n\t\tuser_error(\"to be completed\");\n\t}", "public function setDonation($donationCost, $cartId);", "public function setShippingPrice() {\n if ($this->price > 200) {\n $this->shippingPrice = 0;\n }\n }", "public function getDiscount(): int\n {\n return $this->discount;\n }", "public function setPrice()\n {\n $price = $this->price;\n $outFix = $this->outFix;\n $outPer = $this->outPer;\n $inPer = $this->inPer;\n $inFix = $this->inFix;\n $flag = $this->flagInOut;\n if ($price < 1) {\n $sumIn = $outFix > 0 ? 1 + $outFix : 1; //outFix\n $sumIn = $outPer > 0 ? $sumIn + ($sumIn * $outPer / 100) : $sumIn; //outPer\n $sumIn = $sumIn / $price; // price\n $sumIn = $inFix > 0 ? $sumIn + $inFix : $sumIn;// inFix\n $ss = $sumIn * $inPer / 100;\n $sumIn = $inPer > 0 ? $sumIn + $ss : $sumIn;\n $this->in = $this->format_amount($sumIn);\n $this->out = $flag ? 1 : 0;\n } else {\n $val = $inFix > 0 ? 1 - $inFix : 1;\n $val = $inPer > 0 ? $val - $val * ($inPer / 100) : $val;\n $sumOut = $price * $val;\n $sumOut = $outFix > 0 ? $sumOut - $outFix : $sumOut;\n $sumOut = $outPer > 0 ? $sumOut - $outPer / 100 * $sumOut : $sumOut;\n $this->out = $this->format_amount($sumOut);\n $this->in = $flag ? 1 : 0;\n }\n $this->price = (float)$price;\n }", "public function getDiscountAmount();", "public function testSetValue()\n {\n $this->todo('stub');\n }", "public function setPower()\n {\n $this->_role->power = 100;\n }" ]
[ "0.7509371", "0.7138975", "0.6973205", "0.6646451", "0.6436", "0.6403692", "0.63103515", "0.6308686", "0.6281786", "0.6209592", "0.61811215", "0.6164047", "0.60980797", "0.60798293", "0.60465634", "0.6030291", "0.59953934", "0.5987277", "0.59749717", "0.5961326", "0.5947176", "0.59448653", "0.5928216", "0.5927103", "0.5926235", "0.58728737", "0.5869883", "0.58458054", "0.5791159", "0.5786445", "0.5770549", "0.5749113", "0.5728292", "0.5724695", "0.57242787", "0.5664045", "0.5660784", "0.5645551", "0.56452626", "0.5640942", "0.55771255", "0.55594087", "0.55539894", "0.5550416", "0.5530386", "0.55141133", "0.5505011", "0.55000615", "0.548783", "0.5483925", "0.54703057", "0.5452393", "0.5434285", "0.5433121", "0.54324895", "0.542745", "0.5418333", "0.5417429", "0.5408361", "0.5402366", "0.53899586", "0.53899586", "0.53820443", "0.53727645", "0.5369771", "0.5366713", "0.5361186", "0.535974", "0.5357416", "0.53534526", "0.53252304", "0.53227705", "0.5308744", "0.5305986", "0.5302073", "0.529861", "0.5290874", "0.5286161", "0.52791756", "0.52739006", "0.526833", "0.5259803", "0.5254871", "0.52547264", "0.5254593", "0.5227229", "0.5216336", "0.5213926", "0.52002424", "0.51945585", "0.5186835", "0.5180206", "0.5175839", "0.5161413", "0.5161098", "0.5160163", "0.5159702", "0.51591843", "0.515623", "0.51539767", "0.51513" ]
0.0
-1
Target: Type. "Set discount to type"
protected static function avail_target_type($filter_items, $items, $target, $rule, $sku_id) { // Если условие не задано, прерываем обработку if (empty($target->condition) || !$filter_items) { return false; } $discount_items = self::filter_by_type($items, (array) $target->condition); return self::calculate_target_discount($target, $discount_items, $rule, $sku_id); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function AssignDiscount()\n\t{\t\n\t}", "private function setDiscount( string $type, float $amount, float $discount ): float\n {\n switch( $type ) {\n case 'absolute' :\n $price = $amount - $discount;\n break;\n case 'percent' :\n $price = $amount - ($amount / 100 * $discount);\n break;\n case 'wholesale' :\n $price = $amount;\n break;\n default :\n $price = $amount;\n break;\n }\n\n $price = round(sprintf(\"%01.2f\", ceil($price * 100) / 100), 2);\n\n return $price;\n }", "public function getDiscountType()\n {\n return $this->discountType;\n }", "public function setDiscount(string $discount)\n\t{\n\t\t$this->addKeyValue('Discount', $discount); \n\n\t}", "public function setDiscount(int $discount): void\n {\n $this->discount = ($discount > 0 && $discount <= 50) ? $discount : 0;\n\n }", "function set_discount($discount_id = FALSE)\n\t\t{\n\t\t\t$this->load->model('demo_cart_model');\n\t\t\t\n\t\t\t$this->demo_cart_model->demo_set_discount($discount_id);\n\t\t\t\n\t\t\tredirect('cart');\n\t\t}", "public function changeTypeDrink($request);", "public function setType( Quantifier $type ): void {\n\t\t\t$this->type = $type;\n\t\t}", "public function discountType()\n {\n return $this->belongsTo(DiscountType::class);\n }", "private function update_type($new_type) { \n\n\t\tif ($this->_update_item('type',$new_type,'50')) { \n\t\t\t$this->type = $new_type;\n\t\t}\n\n\t}", "public function setDiscountRate($value){\n return $this->setParameter('discount_rate', $value);\n }", "public function setTyp( $type );", "public function setDiscountType($discountType)\n {\n $this->discountType = $discountType;\n\n return $this;\n }", "public function setDiscountAmount($amount);", "public function set_type( $type ) {\n\t\t$this->set_prop( 'type', sanitize_title( $type ) ) ;\n\t}", "public function testSetGetDiscount()\n {\n $this->item->setPrice(85.00);\n $this->item->setQuantity(1);\n $this->item->addDiscount(\n (new FlatDiscount())\n ->setFigure(15.00)\n );\n\n $this->assertEquals($this->item->getPriceTotal(), 85.00);\n $this->assertEquals($this->item->getNetTotal(), 70.00);\n $this->assertEquals($this->item->getDiscount(), 15.00);\n }", "public function setType($type){ }", "function setup() {\r\n // \"Buy more than 100 items, get 50 (% or $, as per admin) off\" \r\n // $this->add_extra_level_discount(100, 50);\r\n }", "public function getTonicDiscount()\n {\n }", "public function setType($type) {}", "public function setDiscountAmount($value){\n return $this->setParameter('discount_amount', $value);\n }", "public function setBaseDiscountAmount($amount);", "function apply_special_item_discount($id, $count, &$disc_amount) {\r\n switch($id) {\r\n case 99999:\r\n case 99998:\r\n if ($count > 100) {\r\n $disc_amount = 50; \r\n }\r\n break; \r\n case 99997:\r\n $disc_amount = 75;\r\n break; \r\n }\r\n }", "public function add_booking_discount( $types ) {\n $types['booking_person'] = __( 'Booking Person Discount (Amount Off Per Person)', 'dokan' );\n\n return $types;\n }", "function setType($type) {\n\t\t$this->_type = $type;\n\t}", "function setType($type) {\n\t\t$this->_type = $type;\n\t}", "public function setType( $type )\n {\n }", "function variant_set_type($variant, $type) {}", "public function setDiscountPercent(?string $value): void {\n $this->getBackingStore()->set('discountPercent', $value);\n }", "public function set_type($type) {\n $this->update([\n 'type' => $type\n ]);\n\n $this->type = $type;\n\n // finish configuring this OrderExchange\n $this->sync();\n }", "function setType($type) {\n $this->type = $type;\n }", "public function setType(?string $type): void;", "public function setType($type)\n{\n$this->type = $type;\n\nreturn $this;\n}", "public function setDiscount(?float $discount): self\n {\n $this->initialized['discount'] = true;\n $this->discount = $discount;\n\n return $this;\n }", "public function setDiscount($discount)\r\n {\r\n $this->discount = $discount;\r\n\r\n return $this;\r\n }", "public function setDiscount(int $discount): self\n {\n $this->discount = $discount;\n return $this;\n }", "public function setType($type);", "public function setType($type);", "public function setType($type);", "public function setType($type);", "public function setType($type);", "public function setType($type);", "public function setType($type);", "public function setType($type);", "public function setDiscountDescription($description);", "private function updateProductDiscount(\n ProductInterface $product,\n Request $request\n ): void {\n $discountPercent = $request->request->get('discount_percent') !== '' ? (float) $request->request->get('discount_percent') : null;\n $discountLimitType = $request->request->get('discount_limit_type') !== '' ? $request->request->get('discount_limit_type') : null;\n $discountFromDate = $request->request->get('discount_from_date') !== '' ? $request->request->get('discount_from_date') : null;\n $discountToDate = $request->request->get('discount_to_date') !== '' ? $request->request->get('discount_to_date') : null;\n\n $variants = $product->getVariants();\n foreach ($variants as $variant) {\n // Variant to change\n $variantPricing = $variant->getChannelPricings()->first();\n\n // Change percent\n if ($discountPercent !== null) {\n $variantPricing->setDiscount($discountPercent / 100);\n }\n\n // Continue if no change type\n if ($discountLimitType === self::LIMIT_NO_CHANGE) {\n continue;\n }\n // Discount type\n $variantPricing->setDiscountLimitType($discountLimitType === self::LIMIT_NONE ? null : $discountLimitType);\n\n // Date type discount\n if ($discountLimitType === self::LIMIT_DATETIME) {\n if ($discountFromDate && $discountToDate) {\n $dateFrom = \\DateTime::createFromFormat('Y-m-d', $discountFromDate);\n $dateTo = \\DateTime::createFromFormat('Y-m-d', $discountToDate);\n\n $variantPricing->setDiscountFrom($dateFrom);\n $variantPricing->setDiscountTo($dateTo);\n }\n\n if ($discountFromDate && !$discountToDate) {\n $dateFrom = \\DateTime::createFromFormat('Y-m-d', $discountFromDate);\n\n $variantPricing->setDiscountFrom($dateFrom);\n $variantPricing->setDiscountTo(null);\n }\n\n if (!$discountFromDate && $discountToDate) {\n $dateTo = \\DateTime::createFromFormat('Y-m-d', $discountToDate);\n\n $variantPricing->setDiscountFrom(null);\n $variantPricing->setDiscountTo($dateTo);\n }\n }\n }\n }", "protected function setType(int $type):void {\r\n\t\t$this->type = $type;\r\n\t}", "public function setType(?string $type): void\n {\n }", "public function set_manual_discount($discount_data = FALSE)\r\n\t{\r\n\t\tif (is_array($discount_data) && ! empty($discount_data))\r\n\t\t{\r\n\t\t\t// Check that any submitted 'New value' discounts are only applied to the shipping total. \r\n\t\t\tif (isset($discount_data['column']) && isset($discount_data['calculation']) && ($discount_data['column'] != 'shipping_total') && ($discount_data['calculation'] == 3))\r\n\t\t\t{\r\n\t\t\t\treturn FALSE;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t// Merge the code and manual discounts together, then loop through data and compile an array of all discount ids currently in use.\r\n\t\t\t$existing_discounts = array_merge($this->flexi->cart_contents['settings']['discounts']['manual'], $this->flexi->cart_contents['settings']['discounts']['codes']);\r\n\t\t\t$existing_ids = array();\r\n\t\t\t\t\r\n\t\t\tforeach($existing_discounts as $existing_discount)\r\n\t\t\t{\r\n\t\t\t\t$existing_ids[] = $existing_discount['id'];\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t// If an id is not set in the submitted '$discount_data', or if a discount with a matching id already exists, set a new id. \r\n\t\t\tif (! isset($discount_data['id']) || in_array($discount_data['id'], $existing_ids))\r\n\t\t\t{\r\n\t\t\t\t$id = 0;\r\n\t\t\t\twhile (in_array('manual_'.$id, $existing_ids))\r\n\t\t\t\t{\r\n\t\t\t\t\t$id++; \r\n\t\t\t\t}\r\n\t\t\t\t$id = $discount_data['id'] = 'manual_'.$id;\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\t$id = $discount_data['id'];\r\n\t\t\t}\r\n\t\t\r\n\t\t\t// Set default values if not submitted.\r\n\t\t\t$discount_data['description'] = (! isset($discount_data['description'])) ? FALSE : $discount_data['description'];\r\n\t\t\t$discount_data['value'] = (! isset($discount_data['value'])) ? 0 : $discount_data['value'];\r\n\t\t\t$discount_data['column'] = (! isset($discount_data['column'])) ? 'total' : $discount_data['column'];\r\n\t\t\t$discount_data['calculation'] = (! isset($discount_data['calculation'])) ? 1 : $discount_data['calculation'];\r\n\t\t\t$discount_data['tax_method'] = (! isset($discount_data['tax_method'])) ? FALSE : $discount_data['tax_method'];\r\n\t\t\t$discount_data['void_reward_points'] = (! isset($discount_data['void_reward_points'])) ? FALSE : $discount_data['void_reward_points'];\r\n\t\t\t\r\n\t\t\t// Set the cart column the discount is targeting and use the value to act as the discounts array key. \r\n\t\t\t// This prevents multiple discounts being applied to the same cart column.\r\n\t\t\t$target_column = $discount_data['column'];\r\n\t\t\t\r\n\t\t\t// Loop through data and set to cart session summary.\r\n\t\t\tforeach($discount_data as $column => $column_value)\r\n\t\t\t{\r\n\t\t\t\tif ($column == 'value')\r\n\t\t\t\t{\r\n\t\t\t\t\t// If a valid discount value is not set, set the default value as zero. \r\n\t\t\t\t\t$column_value = ($this->non_negative($column_value)) ? $this->format_calculation($column_value, 2, TRUE) : 0;\r\n\t\t\t\t}\r\n\t\t\t\telse if ($column == 'column')\r\n\t\t\t\t{\r\n\t\t\t\t\t// If a valid column is not set, discount the 'total' column by default. \r\n\t\t\t\t\t$column_value = (in_array($column_value, array('item_summary_total', 'shipping_total', 'total'))) ? $column_value : 'total';\r\n\t\t\t\t}\r\n\t\t\t\telse if ($column == 'calculation') \r\n\t\t\t\t{\r\n\t\t\t\t\t// If a valid calculation method is not set, a 'percentage' based calculation is set by default.\r\n\t\t\t\t\t// 1 = Percentage Based, 2 = Flat Fee, 3 = New Value.\r\n\t\t\t\t\t$column_value = (in_array($column_value, array(1,2,3))) ? $column_value : 1;\r\n\t\t\t\t}\r\n\t\t\t\telse if ($column == 'tax_method')\r\n\t\t\t\t{\r\n\t\t\t\t\t// If a valid tax method is not set, the tax method is defined by whether cart prices ex/include taxes by default.\r\n\t\t\t\t\t// 0 = Carts Default Tax Method, 1 = Apply Tax Before Discount, 2 = Apply Discount Before Tax, 3 = Apply Discount Before Tax, Add Original Tax.\r\n\t\t\t\t\t$column_value = (in_array($column_value, array(0, 1,2,3))) ? $column_value : 0;\r\n\t\t\t\t}\r\n\t\t\t\telse if ($column == 'void_reward_points')\r\n\t\t\t\t{\r\n\t\t\t\t\t$column_value = (bool)$column_value;\r\n\t\t\t\t}\r\n\t\t\t\telse if (! in_array($column, array('id', 'description')))\r\n\t\t\t\t{\r\n\t\t\t\t\tcontinue;\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\t$this->flexi->cart_contents['settings']['discounts']['manual'][$target_column][$column] = $column_value;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\treturn TRUE;\r\n\t\t}\r\n\t\t\r\n\t\treturn FALSE;\r\n\t}", "public function setType($type)\n {\n parent::setAttr(\"type\", $type);\n }", "public function applyGlobalDiscount($discount_rate)\n {\n }", "public function set_discount_defaults()\r\n\t{\r\n\t\t// Set array placeholders.\r\n\t\tif (! isset($this->flexi->cart_contents['settings']['discounts']['codes']))\r\n\t\t{\r\n\t\t\t$this->flexi->cart_contents['settings']['discounts']['codes'] = array();\r\n\t\t}\r\n\t\tif (! isset($this->flexi->cart_contents['settings']['discounts']['manual']))\r\n\t\t{\r\n\t\t\t$this->flexi->cart_contents['settings']['discounts']['manual'] = array();\r\n\t\t}\t\r\n\t\r\n\t\t// Reset other discount data.\r\n\t\t$this->flexi->cart_contents['settings']['discounts']['active_items'] = array();\r\n\t\t$this->flexi->cart_contents['settings']['discounts']['active_summary'] = array();\r\n\t\t$this->flexi->cart_contents['settings']['discounts']['reward_vouchers'] = array();\r\n\t\t$this->flexi->cart_contents['settings']['discounts']['data']['item_discount_savings'] = 0;\r\n\t\t$this->flexi->cart_contents['settings']['discounts']['data']['summary_discount_savings'] = 0;\r\n\t\t$this->flexi->cart_contents['settings']['discounts']['data']['reward_vouchers'] = 0;\r\n\t\t$this->flexi->cart_contents['settings']['discounts']['data']['void_reward_point_items'] = array();\r\n\r\n\t\tif (! isset($this->flexi->cart_contents['settings']['discounts']['data']['excluded_discounts']))\r\n\t\t{\r\n\t\t\t$this->flexi->cart_contents['settings']['discounts']['data']['excluded_discounts'] = array();\r\n\t\t}\t\r\n\t\t\r\n\t\treturn TRUE;\r\n\t}", "public function setDiscountSequence()\n {\n $this->discountSequence = [\n (string)DiscountType::LIMITED_TIME(),\n (string)DiscountType::PERIOD(),\n (string)DiscountType::QUANTITY(),\n ];\n }", "public function setDiscountUid(?string $discountUid): void\n {\n $this->discountUid = $discountUid;\n }", "public function apply()\n {\n /** @var EavSetup $eavSetup */\n $eavSetup = $this->eavSetupFactory->create(['setup' => $this->moduleDataSetup]);\n\n if (!$eavSetup->getAttribute(Product::ENTITY, 'am_shipping_type')) {\n $eavSetup->addAttribute(\n Product::ENTITY,\n 'am_shipping_type',\n [\n 'type' => 'varchar',\n 'backend' => '',\n 'frontend' => '',\n 'label' => 'Shipping Type',\n 'input' => 'select',\n 'class' => '',\n 'source' => '',\n 'global' => ScopedAttributeInterface::SCOPE_STORE,\n 'visible' => true,\n 'required' => false,\n 'user_defined' => false,\n 'default' => 0,\n 'searchable' => false,\n 'filterable' => false,\n 'comparable' => false,\n 'visible_on_front' => false,\n 'used_in_product_listing' => true,\n 'unique' => false,\n 'apply_to' => ''\n ]\n );\n }\n }", "public function setType($type) {\n $this->type = $type;\n }", "public function setType($type) {\n $this->type = $type;\n }", "public function setType($type) {\n $this->type = $type;\n }", "protected function setOfferValue ()\n {\n $this->request->coupon_benefits[ $this->offerNature ] = $this->offer->rate;\n }", "function setType($type = \"\")\n\t\t{\n\t\t\t$this->type = $type;\n\t\t}", "public function setType($type)\r\n {\r\n $this->type = $type;\r\n }", "public function setTypeAttribute($value)\n\t{\n\t\t$this->attributes['type'] = ($value == 'Part' || $value == 'part') ? 'part' : 'product';\n\t}", "public function setDiscountAttribute($val)\n {\n return (int)$this->attributes['discount'] = $val;\n }", "public function setPromotionType($promotion_type)\n {\n $this->promotion_type = $promotion_type;\n }", "protected function setOfferNature ()\n {\n $this->offerNature = $this->offer->rate_nature->value;\n }", "function apply_special_category_discount($category, $count, &$disc_amount) {\r\n switch($category) {\r\n case 99999:\r\n case 99998:\r\n if ($count > 100) {\r\n $disc_amount = 50; \r\n }\r\n break; \r\n case 99997:\r\n $disc_amount = 75;\r\n break;\r\n }\r\n }", "public function addToDiscount(\\PayPal\\StructType\\DiscountType $item)\n {\n // validation for constraint: itemType\n if (!$item instanceof \\PayPal\\StructType\\DiscountType) {\n throw new \\InvalidArgumentException(sprintf('The Discount property can only contain items of type \\PayPal\\StructType\\DiscountType, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__);\n }\n $this->Discount[] = $item;\n return $this;\n }", "function callbackSetType($value) {\n \n if ($this->type == $value) {\n return;\n }\n $this->widgets['type']->set_text($value);\n $this->type = $value;\n $this->setVisable();\n $this->table->database->dirty=true;\n $this->dirty = true;\n $this->table->database->save();\n \n }", "public function setPrice($type = 'plain', $value, $currency_id = null, $primary = 0, $manual = 1)\n {\n if ( !$currency_id )\n $currency_id = self::getActiveCurrencyId();\n \n \t$money = new Money([\n \t\t'amount' => $value,\n \t\t'type' => $type,\n \t\t'currency_id' => $currency_id,\n 'manual' => $manual,\n 'primary' => $primary\n \t\t]);\n\n \t$this->price()->save($money);\n }", "function setType($a_type)\n\t{\n\t\t$this->il_type = $a_type;\n\t}", "public function getCouponDiscountType()\n {\n $processReaction = $this->couponEngine\n ->prepareDiscountType();\n\n // get engine reaction\n return __processResponse($processReaction, [], $processReaction['data']);\n }", "public function setBaseShippingDiscountAmount($amount);", "public function setType(string $type);", "protected function _applyObjectProperty()\n\t{\n\t\tparent::_applyObjectProperty();\n\n\t\t$modelName = $this->_object->getModelName();\n\n\t\tswitch ($modelName)\n\t\t{\n\t\t\tcase 'shop_discount':\n\t\t\t\t// Скидка не может быть больше 100%\n\t\t\t\tif ($this->_object->type == 0 && $this->_object->value > 100)\n\t\t\t\t{\n\t\t\t\t\t$this->_object->value = 0;\n\t\t\t\t\t$this->_object->save();\n\n\t\t\t\t\t$this->addMessage(\n\t\t\t\t\t\tCore_Message::get(Core::_('Shop_Discount.percent_error'), 'error')\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\t// Группа доступа\n\t\t\t\t$aSiteuser_Groups = array(0 => Core::_('Structure.all'));\n\n\t\t\t\tif (Core::moduleIsActive('siteuser'))\n\t\t\t\t{\n\t\t\t\t\t$oSiteuser_Controller_Edit = new Siteuser_Controller_Edit($this->_Admin_Form_Action);\n\t\t\t\t\t$aSiteuser_Groups = $aSiteuser_Groups + $oSiteuser_Controller_Edit->fillSiteuserGroups($this->_object->Shop->site_id);\n\t\t\t\t}\n\n\t\t\t\t$aTmp = array();\n\n\t\t\t\t$aShop_Discount_Siteuser_Groups = $this->_object->Shop_Discount_Siteuser_Groups->findAll(FALSE);\n\t\t\t\tforeach ($aShop_Discount_Siteuser_Groups as $oShop_Discount_Siteuser_Group)\n\t\t\t\t{\n\t\t\t\t\t!in_array($oShop_Discount_Siteuser_Group->siteuser_group_id, $aTmp)\n\t\t\t\t\t\t&& $aTmp[] = $oShop_Discount_Siteuser_Group->siteuser_group_id;\n\t\t\t\t}\n\n\t\t\t\tforeach ($aSiteuser_Groups as $siteuser_group_id => $name)\n\t\t\t\t{\n\t\t\t\t\t$bSiteuserGroupChecked = Core_Array::getPost('siteuser_group_' . $siteuser_group_id);\n\n\t\t\t\t\tif ($bSiteuserGroupChecked)\n\t\t\t\t\t{\n\t\t\t\t\t\tif (!in_array($siteuser_group_id, $aTmp))\n\t\t\t\t\t\t{\n\n\t\t\t\t\t\t\t$oShop_Discount_Siteuser_Group = Core_Entity::factory('Shop_Discount_Siteuser_Group');\n\t\t\t\t\t\t\t$oShop_Discount_Siteuser_Group->siteuser_group_id = $siteuser_group_id;\n\t\t\t\t\t\t\t$this->_object->add($oShop_Discount_Siteuser_Group);\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 (in_array($siteuser_group_id, $aTmp))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$oShop_Discount_Siteuser_Group = $this->_object->Shop_Discount_Siteuser_Groups->getObject($this->_object, $siteuser_group_id);\n\n\t\t\t\t\t\t\t!is_null($oShop_Discount_Siteuser_Group)\n\t\t\t\t\t\t\t\t&& $oShop_Discount_Siteuser_Group->delete();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\tbreak;\n\t\t}\n\n\t\tCore_Event::notify(get_class($this) . '.onAfterRedeclaredApplyObjectProperty', $this, array($this->_Admin_Form_Controller));\n\n\t\treturn $this;\n\t}", "protected function setTypeName() \n {\n $this->typeName = SpotTypeCategory::find($this->categoryId)->type->name;\n $this->prefix = $this->typeName . '_' . $this->categoryId . '_';\n }", "public function updateAffectedPlans(Discount $discount)\n {\n }", "public function setType($type)\n\t{\n\t\t$this->type = $type;\n\t}", "public function setType($type)\n\t{\n\t\t$this->type = $type;\n\t}", "public function testSetType()\n {\n $this->todo('stub');\n }", "public function setType($type)\n\t{\n\t\t$this->_type = $type;\n\t}", "public function setType($type)\n\t{\n\t\t$this->_type = $type;\n\t}", "function setPrice($price, $taxPercentage = 25)\n {\n $this->taxPercentage = $taxPercentage;\n $this->taxA = $price / 100 * 100;\n $this->price = $price;\n }", "public function setType($t){\n $this->type = $t;\n }", "public function addDiscount(DiscountInterface $discount);", "public function setDiscount($var)\n {\n GPBUtil::checkDouble($var);\n $this->discount = $var;\n\n return $this;\n }", "function discountvoucherpurchase_civicrm_postProcess($formName, &$form ) {\n if($formName == 'CRM_Contribute_Form_Contribution_Confirm' && isset($form->_id) && $form->_id == 24){\n $params = array(\n 'code' => $form->_params['contactID'] . '-' . $form->_params['contributionID'],\n 'description' => 'gift from ' . $form->_params['email-5'],\n 'amount' => 100,\n 'amount_type' => 1,\n 'count_max' => 1,\n 'memberships'=> array(7,22),\n 'version' => 3,\n 'multi_valued' => array('memberships' => 1),\n );\n $code = civicrm_api('DiscountCode', 'create', $params);\n }\n}", "function lb_subscription_set_payment_type($account, $subscription, $payment_type) {\n // The $account that rules passes contains the original information, which may have\n // changed as a result of an action that has run.\n $entity = entity_load_single('user', $account->uid);\n $account_subscription_data = lb_subscription_retrieve_account_subscription_data($entity, $subscription);\n if ($account_subscription_data['delta'] === NULL) {\n lb_subscription_set_subscription($entity, $subscription);\n $entity = entity_load_single('user', $account->uid);\n $account_subscription_data = lb_subscription_retrieve_account_subscription_data($entity, $subscription);\n }\n if ($account_subscription_data['delta'] !== NULL) {\n if ($account_subscription_data['payment_type'] != $payment_type) {\n $entity->field_subscription[LANGUAGE_NONE][$account_subscription_data['delta']]['field_payment_type'] = array(\n LANGUAGE_NONE => array(\n 0 => array(\n 'value' => $payment_type,\n ),\n ),\n );\n entity_save('user', $entity);\n }\n }\n}", "public function saveType()\n {\n }", "public function setType($type)\n {\n $this->type = $type;\n }", "public function setType($type)\n {\n $this->type = $type;\n }", "public function setType($type)\n {\n $this->type = $type;\n }", "public function setType($type)\n {\n $this->type = $type;\n }", "public function setType($type)\n {\n $this->type = $type;\n }", "public function setType($type)\n {\n $this->type = $type;\n }", "public function setType($type)\n {\n $this->type = $type;\n }", "public function setType($type)\n {\n $this->type = $type;\n }", "public function setType($type)\n {\n $this->type = $type;\n }", "function setTaxonomyType($setTaxType) {\n $this->taxonomyType = $setTaxType;\n }", "protected function assignType()\n {\n $this->type = 'master';\n }", "protected function assignType()\n {\n $this->type = 'master';\n }", "public function setType($type) {\n $this->type = $type;\n }" ]
[ "0.6738647", "0.66786844", "0.6372321", "0.61307544", "0.6042361", "0.6018096", "0.58988184", "0.5849456", "0.582633", "0.5781263", "0.5778495", "0.5761762", "0.5753153", "0.5724393", "0.571443", "0.5712071", "0.5711695", "0.5654663", "0.55916756", "0.5580214", "0.5577115", "0.5571209", "0.5555964", "0.55128247", "0.54870844", "0.54870844", "0.54776", "0.5474883", "0.5470842", "0.5468762", "0.5437771", "0.5426261", "0.5426146", "0.5414249", "0.54140204", "0.54052633", "0.53943056", "0.53943056", "0.53943056", "0.53943056", "0.53943056", "0.53943056", "0.53943056", "0.53943056", "0.5389004", "0.53706187", "0.5340592", "0.53352314", "0.5327957", "0.53275293", "0.5313714", "0.5312207", "0.53101075", "0.52981985", "0.5289879", "0.52897227", "0.52897227", "0.52897227", "0.52873105", "0.5277124", "0.5272316", "0.52682155", "0.5262126", "0.52496", "0.5241816", "0.5235789", "0.52330124", "0.52269286", "0.52243125", "0.52207804", "0.521725", "0.52113396", "0.5209553", "0.5207102", "0.52045393", "0.5194422", "0.519402", "0.519402", "0.51885384", "0.5182069", "0.5182069", "0.51793617", "0.5176679", "0.5176236", "0.51674557", "0.51594263", "0.5155452", "0.51546055", "0.5151249", "0.5151249", "0.5151249", "0.5151249", "0.5151249", "0.5151249", "0.5151249", "0.5151249", "0.5151249", "0.51510274", "0.51468426", "0.51468426", "0.5146664" ]
0.0
-1
Target: Product. "Set discount to product"
protected static function avail_target_product($filter_items, $items, $target, $rule, $sku_id) { // Если условие не задано, прерываем обработку if (empty($target->condition) || !$filter_items) { return false; } $discount_items = self::filter_by_product($items, (array) $target->condition); return self::calculate_target_discount($target, $discount_items, $rule, $sku_id); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function AssignDiscount()\n\t{\t\n\t}", "private function updateProductDiscount(\n ProductInterface $product,\n Request $request\n ): void {\n $discountPercent = $request->request->get('discount_percent') !== '' ? (float) $request->request->get('discount_percent') : null;\n $discountLimitType = $request->request->get('discount_limit_type') !== '' ? $request->request->get('discount_limit_type') : null;\n $discountFromDate = $request->request->get('discount_from_date') !== '' ? $request->request->get('discount_from_date') : null;\n $discountToDate = $request->request->get('discount_to_date') !== '' ? $request->request->get('discount_to_date') : null;\n\n $variants = $product->getVariants();\n foreach ($variants as $variant) {\n // Variant to change\n $variantPricing = $variant->getChannelPricings()->first();\n\n // Change percent\n if ($discountPercent !== null) {\n $variantPricing->setDiscount($discountPercent / 100);\n }\n\n // Continue if no change type\n if ($discountLimitType === self::LIMIT_NO_CHANGE) {\n continue;\n }\n // Discount type\n $variantPricing->setDiscountLimitType($discountLimitType === self::LIMIT_NONE ? null : $discountLimitType);\n\n // Date type discount\n if ($discountLimitType === self::LIMIT_DATETIME) {\n if ($discountFromDate && $discountToDate) {\n $dateFrom = \\DateTime::createFromFormat('Y-m-d', $discountFromDate);\n $dateTo = \\DateTime::createFromFormat('Y-m-d', $discountToDate);\n\n $variantPricing->setDiscountFrom($dateFrom);\n $variantPricing->setDiscountTo($dateTo);\n }\n\n if ($discountFromDate && !$discountToDate) {\n $dateFrom = \\DateTime::createFromFormat('Y-m-d', $discountFromDate);\n\n $variantPricing->setDiscountFrom($dateFrom);\n $variantPricing->setDiscountTo(null);\n }\n\n if (!$discountFromDate && $discountToDate) {\n $dateTo = \\DateTime::createFromFormat('Y-m-d', $discountToDate);\n\n $variantPricing->setDiscountFrom(null);\n $variantPricing->setDiscountTo($dateTo);\n }\n }\n }\n }", "function set_discount($discount_id = FALSE)\n\t\t{\n\t\t\t$this->load->model('demo_cart_model');\n\t\t\t\n\t\t\t$this->demo_cart_model->demo_set_discount($discount_id);\n\t\t\t\n\t\t\tredirect('cart');\n\t\t}", "protected function calculateDiscount() : void{\r\n $percentage = ($this->discounted_value * 100) / $this->order->getTrueTotal();\r\n $new_total = $this->order->getTrueTotal() - $this->discounted_value;\r\n\r\n $this->order_discount_value = $this->discounted_value;\r\n $this->order_discount_percentage = $percentage;\r\n $this->order_discount_reason = \"For every \" . $this->products_nr . \" products from category #\" . $this->category_id . \" you get one free. You got: \";\r\n foreach($this->items_matching as $item){\r\n $this->order_discount_reason .= floor($item[\"qty\"] / $this->products_nr) . \" x '\" . $item[\"description\"] . \"' (€\". $item[\"price\"] .\" each) ; \";\r\n }\r\n $this->order_new_total = $new_total;\r\n }", "public function setDiscount(int $discount): void\n {\n $this->discount = ($discount > 0 && $discount <= 50) ? $discount : 0;\n\n }", "public function applyCartDiscount(Varien_Event_Observer $observer)\n { \n try\n { \n $bundle_product_ids = [];\n $quote_product_ids = [];\n $cookieValue = Mage::getModel('core/cookie')->get('ivid');\n $userBundleCollection = Mage::getModel('increasingly_analytics/bundle')->getCollection()->addFieldToFilter('increasingly_visitor_id',$cookieValue);\n $items = $observer->getEvent()->getQuote()->getAllItems();\n $eligibleProducts = [];\n $discount = 0;\n foreach ($items as $item) {\n array_push($quote_product_ids, $item->getProductId());\n }\n foreach ($userBundleCollection as $bundle) {\n //First Bundle products\n $bundle_product_ids = explode(',', $bundle->getProductIds()); \n $productsIds = array_intersect($quote_product_ids, $bundle_product_ids);\n if(count($productsIds) == count($bundle_product_ids) )\n $discount += $bundle->getDiscountPrice();\n }\n\n if($discount > 0){\n $quote=$observer->getEvent()->getQuote();\n $quoteid=$quote->getId();\n $discountAmount=$discount;\n if($quoteid) { \n if($discountAmount>0) {\n $total=$quote->getBaseSubtotal();\n $quote->setSubtotal(0);\n $quote->setBaseSubtotal(0);\n\n $quote->setSubtotalWithDiscount(0);\n $quote->setBaseSubtotalWithDiscount(0);\n\n $quote->setGrandTotal(0);\n $quote->setBaseGrandTotal(0);\n \n\n $canAddItems = $quote->isVirtual()? ('billing') : ('shipping'); \n foreach ($quote->getAllAddresses() as $address) {\n\n $address->setSubtotal(0);\n $address->setBaseSubtotal(0);\n\n $address->setGrandTotal(0);\n $address->setBaseGrandTotal(0);\n\n $address->collectTotals();\n\n $quote->setSubtotal((float) $quote->getSubtotal() + $address->getSubtotal());\n $quote->setBaseSubtotal((float) $quote->getBaseSubtotal() + $address->getBaseSubtotal());\n\n $quote->setSubtotalWithDiscount(\n (float) $quote->getSubtotalWithDiscount() + $address->getSubtotalWithDiscount()\n );\n $quote->setBaseSubtotalWithDiscount(\n (float) $quote->getBaseSubtotalWithDiscount() + $address->getBaseSubtotalWithDiscount()\n );\n\n $quote->setGrandTotal((float) $quote->getGrandTotal() + $address->getGrandTotal());\n $quote->setBaseGrandTotal((float) $quote->getBaseGrandTotal() + $address->getBaseGrandTotal());\n\n $quote ->save(); \n\n $quote->setGrandTotal($quote->getBaseSubtotal()-$discountAmount)\n ->setBaseGrandTotal($quote->getBaseSubtotal()-$discountAmount)\n ->setSubtotalWithDiscount($quote->getBaseSubtotal()-$discountAmount)\n ->setBaseSubtotalWithDiscount($quote->getBaseSubtotal()-$discountAmount)\n ->save(); \n\n\n if($address->getAddressType()==$canAddItems) {\n //echo $address->setDiscountAmount; exit;\n $address->setSubtotalWithDiscount((float) $address->getSubtotalWithDiscount()-$discountAmount);\n $address->setGrandTotal((float) $address->getGrandTotal()-$discountAmount);\n $address->setBaseSubtotalWithDiscount((float) $address->getBaseSubtotalWithDiscount()-$discountAmount);\n $address->setBaseGrandTotal((float) $address->getBaseGrandTotal()-$discountAmount);\n if($address->getDiscountDescription()){\n $address->setDiscountAmount(-($address->getDiscountAmount()-$discountAmount));\n $address->setDiscountDescription($address->getDiscountDescription().', Custom Discount');\n $address->setBaseDiscountAmount(-($address->getBaseDiscountAmount()-$discountAmount));\n }else {\n $address->setDiscountAmount(-($discountAmount));\n $address->setDiscountDescription('Custom Discount');\n $address->setBaseDiscountAmount(-($discountAmount));\n }\n $address->save();\n }//end: if\n } //end: foreach\n //echo $quote->getGrandTotal();\n\n foreach($quote->getAllItems() as $item){\n //We apply discount amount based on the ratio between the GrandTotal and the RowTotal\n $rat=$item->getPriceInclTax()/$total;\n $ratdisc=$discountAmount*$rat;\n $item->setDiscountAmount(($item->getDiscountAmount()+$ratdisc) * $item->getQty());\n $item->setBaseDiscountAmount(($item->getBaseDiscountAmount()+$ratdisc) * $item->getQty())->save(); \n }\n } \n }\n }\n }\n catch(Exception $e)\n {\n Mage::log(\"Remove from cart tracking - \" . $e->getMessage(), null, 'Increasingly_Analytics.log');\n }\n\n }", "function getDiscountFor($product) {\n\t\treturn 30;\n\t}", "public function setDiscount(string $discount)\n\t{\n\t\t$this->addKeyValue('Discount', $discount); \n\n\t}", "public function updateAffectedPlans(Discount $discount)\n {\n }", "function setup() {\r\n // \"Buy more than 100 items, get 50 (% or $, as per admin) off\" \r\n // $this->add_extra_level_discount(100, 50);\r\n }", "public function testSetGetDiscount()\n {\n $this->item->setPrice(85.00);\n $this->item->setQuantity(1);\n $this->item->addDiscount(\n (new FlatDiscount())\n ->setFigure(15.00)\n );\n\n $this->assertEquals($this->item->getPriceTotal(), 85.00);\n $this->assertEquals($this->item->getNetTotal(), 70.00);\n $this->assertEquals($this->item->getDiscount(), 15.00);\n }", "public function discountBifurcation(Varien_Event_Observer $observer)\n {\n $rule = $observer->getEvent()->getRule();\n $result = $observer->getEvent()->getResult();\n $itemId = $observer->getEvent()->getItem()->getItemId();\n //set Unique key\n $curUnique= $rule->getRuleId().'_'.$itemId;\n //check if Mage registry unique call set\n if(Mage::registry('uniqueCall')!==null){\n //if check in array\n $uniqueCalls = Mage::registry('uniqueCall');\n if( in_array($curUnique,$uniqueCalls)){\n return;\n }else{\n //unset existing registry. also take existing array in variable\n Mage::unregister('uniqueCall');\n $uniqueCalls[]= $curUnique ;\n //set registry again with new array include $uniqueCall into it\n Mage::register('uniqueCall',$uniqueCalls);\n }\n }else{\n //set registry again with new array include $uniqueCall into it\n $array = array();\n $array[]=$rule->getRuleId().'_'.$itemId;\n Mage::register('uniqueCall',$array);\n\n } \n\n //condition for the Promotional coupons\n if ( $rule->getCouponType() == Mage_SalesRule_Model_Rule::COUPON_TYPE_NO_COUPON ) {\n $promotionDiscount = 0;\n $promotionDiscount = Mage::registry('promotion');\n if (Mage::registry('promotion')!==null){\n Mage::unregister('promotion');\n }\n if (Mage::registry('promo_lable')!==null){\n Mage::unregister('promo_lable');\n }\n $promotionDiscount += $result->getDiscountAmount();\n Mage::register('promotion', $promotionDiscount);\n Mage::register('promo_lable',$rule->getName());\n } elseif ( $rule->getCouponType() == self::COUPON_TYPE_FUE_GENERATED ) {\n $couponDiscount = 0;\n $couponDiscount = Mage::registry('coupon');\n if(Mage::registry('coupon')!==null){\n Mage::unregister('coupon');\n }\n //sum up all the values of discounted coupons\n $couponDiscount += $result->getDiscountAmount();\n Mage::register('coupon',$couponDiscount);\n }\n $quote = $observer->getEvent()->getQuote();\n $quoteAddress = $observer->getEvent()->getAddress();\n //set discounted coupons and promotional coupons amount in quote\n $quote->setCouponDiscount(Mage::registry('coupon'));\n $quote->setPromotionalDiscount(Mage::registry('promotion'));\n\n if (Mage::getStoreConfig('promodiscount/promodiscount/use_default')) {\n $quote->setPromoLable(Mage::getStoreConfig('promodiscount/promodiscount/default_lable'));\n } else {\n if (Mage::registry('promo_lable')) {\n $quote->setPromoLable(Mage::registry('promo_lable'));\n } else {\n $quote->setPromoLable(Mage::getStoreConfig('promodiscount/promodiscount/default_lable'));\n }\n }\n \n $quoteAddress->setCouponDiscount(Mage::registry('coupon'));\n $quoteAddress->setPromotionalDiscount(Mage::registry('promotion'));\n if (Mage::registry('promo_lable')) {\n $quoteAddress->setPromoLable(Mage::registry('promo_lable'));\n } else {\n $quoteAddress->setPromoLable(Mage::getStoreConfig('promodiscount/promodiscount/default_lable'));\n }\n }", "public function setPromotion($first,$second)\n {\n $this->promotion->setPromotion($first,$second);\n //product Id for identify products\n $this->promotion->setProductId($this->id);\n }", "public function setDiscountDescription($description);", "function apply_special_item_discount($id, $count, &$disc_amount) {\r\n switch($id) {\r\n case 99999:\r\n case 99998:\r\n if ($count > 100) {\r\n $disc_amount = 50; \r\n }\r\n break; \r\n case 99997:\r\n $disc_amount = 75;\r\n break; \r\n }\r\n }", "private function setRecountProduct() {\n\n //$this->model->setDocumentNumber($this->getDocumentNumber);\n $sql = null;\n if ($this->getVendor() == self::MYSQL) {\n $sql = \"\n INSERT INTO `productrecount` \n (\n `companyId`,\n `warehouseId`,\n `productCode`,\n `productDescription`,\n `productRecountDate`,\n `productRecountSystemQuantity`,\n `productRecountPhysicalQuantity`,\n `isDefault`,\n `isNew`,\n `isDraft`,\n `isUpdate`,\n `isDelete`,\n `isActive`,\n `isApproved`,\n `isReview`,\n `isPost`,\n `executeBy`,\n `executeTime`\n ) VALUES ( \n '\" . $this->getCompanyId() . \"',\n '\" . $this->model->getWarehouseId() . \"',\n '\" . $this->model->getProductCode() . \"',\n '\" . $this->model->getProductDescription() . \"',\n '\" . $this->model->getProductRecountDate() . \"',\n '\" . $this->model->getProductRecountSystemQuantity() . \"',\n '\" . $this->model->getProductRecountPhysicalQuantity() . \"',\n '\" . $this->model->getIsDefault(0, 'single') . \"',\n '\" . $this->model->getIsNew(0, 'single') . \"',\n '\" . $this->model->getIsDraft(0, 'single') . \"',\n '\" . $this->model->getIsUpdate(0, 'single') . \"',\n '\" . $this->model->getIsDelete(0, 'single') . \"',\n '\" . $this->model->getIsActive(0, 'single') . \"',\n '\" . $this->model->getIsApproved(0, 'single') . \"',\n '\" . $this->model->getIsReview(0, 'single') . \"',\n '\" . $this->model->getIsPost(0, 'single') . \"',\n '\" . $this->model->getExecuteBy() . \"',\n \" . $this->model->getExecuteTime() . \"\n );\";\n } else {\n if ($this->getVendor() == self::MSSQL) {\n $sql = \"\n INSERT INTO [productRecount]\n (\n [productRecountId],\n [companyId],\n [warehouseId],\n [productCode],\n [productDescription],\n [productRecountDate],\n [productRecountSystemQuantity],\n [productRecountPhysicalQuantity],\n [isDefault],\n [isNew],\n [isDraft],\n [isUpdate],\n [isDelete],\n [isActive],\n [isApproved],\n [isReview],\n [isPost],\n [executeBy],\n [executeTime]\n) VALUES (\n '\" . $this->getCompanyId() . \"',\n '\" . $this->model->getWarehouseId() . \"',\n '\" . $this->model->getProductCode() . \"',\n '\" . $this->model->getProductDescription() . \"',\n '\" . $this->model->getProductRecountDate() . \"',\n '\" . $this->model->getProductRecountSystemQuantity() . \"',\n '\" . $this->model->getProductRecountPhysicalQuantity() . \"',\n '\" . $this->model->getIsDefault(0, 'single') . \"',\n '\" . $this->model->getIsNew(0, 'single') . \"',\n '\" . $this->model->getIsDraft(0, 'single') . \"',\n '\" . $this->model->getIsUpdate(0, 'single') . \"',\n '\" . $this->model->getIsDelete(0, 'single') . \"',\n '\" . $this->model->getIsActive(0, 'single') . \"',\n '\" . $this->model->getIsApproved(0, 'single') . \"',\n '\" . $this->model->getIsReview(0, 'single') . \"',\n '\" . $this->model->getIsPost(0, 'single') . \"',\n '\" . $this->model->getExecuteBy() . \"',\n \" . $this->model->getExecuteTime() . \"\n );\";\n } else {\n if ($this->getVendor() == self::ORACLE) {\n $sql = \"\n INSERT INTO PRODUCTRECOUNT\n (\n COMPANYID,\n WAREHOUSEID,\n PRODUCTCODE,\n PRODUCTDESCRIPTION,\n PRODUCTRECOUNTDATE,\n PRODUCTRECOUNTSYSTEMQUANTITY,\n PRODUCTRECOUNTPHYSICALQUANTITY,\n ISDEFAULT,\n ISNEW,\n ISDRAFT,\n ISUPDATE,\n ISDELETE,\n ISACTIVE,\n ISAPPROVED,\n ISREVIEW,\n ISPOST,\n EXECUTEBY,\n EXECUTETIME\n ) VALUES (\n '\" . $this->getCompanyId() . \"',\n '\" . $this->model->getWarehouseId() . \"',\n '\" . $this->model->getProductCode() . \"',\n '\" . $this->model->getProductDescription() . \"',\n '\" . $this->model->getProductRecountDate() . \"',\n '\" . $this->model->getProductRecountSystemQuantity() . \"',\n '\" . $this->model->getProductRecountPhysicalQuantity() . \"',\n '\" . $this->model->getIsDefault(0, 'single') . \"',\n '\" . $this->model->getIsNew(0, 'single') . \"',\n '\" . $this->model->getIsDraft(0, 'single') . \"',\n '\" . $this->model->getIsUpdate(0, 'single') . \"',\n '\" . $this->model->getIsDelete(0, 'single') . \"',\n '\" . $this->model->getIsActive(0, 'single') . \"',\n '\" . $this->model->getIsApproved(0, 'single') . \"',\n '\" . $this->model->getIsReview(0, 'single') . \"',\n '\" . $this->model->getIsPost(0, 'single') . \"',\n '\" . $this->model->getExecuteBy() . \"',\n \" . $this->model->getExecuteTime() . \"\n );\";\n }\n }\n }\n try {\n $this->q->create($sql);\n } catch (\\Exception $e) {\n $this->q->rollback();\n echo json_encode(array(\"success\" => false, \"message\" => $e->getMessage()));\n exit();\n }\n }", "function pp_edd_auto_apply_discount() {\n\n\tif ( function_exists( 'edd_is_checkout' ) && edd_is_checkout() ) {\n\n\t\tif ( ! edd_cart_has_discounts() && edd_is_discount_valid( 'BFCM2016', '', false ) ) {\n\t\t\tedd_set_cart_discount( 'BFCM2016' );\n\t\t}\n\n\t}\n\n}", "public function updateProduct()\n {\n \t$quote=$this->getQuote();\n \tif($quote)\n \t{\n \t\t$detailproduct=$this->getProduct();\n \t\t$quoteproduct=$quote->getProduct();\n \t\tif(\n\t\t\t\t$quote->getPrice()!=$this->getPrice() or\n\t\t\t\t$quote->getDiscrate()!=$this->getDiscrate() or\n\t\t\t\t$quote->getDiscamt()!=$this->getDiscamt() or\n\t\t\t\t$quote->getProductId()!=$this->getProductId()\n\t\t\t)\n\t\t\t{\n\t\t\t\t$quote->setPrice($this->getPrice());\n\t\t\t\t$quote->setDiscrate($this->getDiscrate());\n\t\t\t\t$quote->setDiscamt($this->getDiscamt());\n\t\t\t\t$quote->setProductId($this->getProductId());\n\t\t\t\t$quote->calc(); //auto save\n\t\t\t\t$detailproduct->calcSalePrices();\n\t\t\t\t\n\t\t\t\t//if product changed, calc old product\n\t\t\t\tif($quoteproduct->getId()!=$detailproduct->getId())\n\t\t\t\t\t$quoteproduct->calcSalePrices();\n\t\t\t}\n \t}\n \telse\n \t{\n\t\t\t//if none, see if product quote by vendor with similar pricing exists. \n\t\t\t$quote=Fetcher::fetchOne(\"Quote\",array('total'=>$this->getUnittotal(),'vendor_id'=>SettingsTable::fetch(\"me_vendor_id\"),'product_id'=>$this->getProductId()));\n\n\t\t\t//if it doesn't exist, create it, and product->calc()\n\t\t\tif(!$quote)\n\t\t\t{\n\t\t\t\tQuoteTable::createOne(array(\n\t\t\t\t\t'date'=>$this->getInvoice()->getDate(),\n\t\t\t\t\t'price'=>$this->getPrice(),\n\t\t\t\t\t'discrate'=>$this->getDiscrate(),\n\t\t\t\t\t'discamt'=>$this->getDiscamt(),\n\t\t\t\t\t'vendor_id'=>SettingsTable::fetch(\"me_vendor_id\"),\n\t\t\t\t\t'product_id'=>$this->getProductId(),\n\t\t\t\t\t'ref_class'=>\"Invoicedetail\",\n\t\t\t\t\t'ref_id'=>$this->getId(),\n\t\t\t\t\t'mine'=>1,\n\t\t\t\t\t));\n\t\t\t\t$this->getProduct()->calcSalePrices();\n\t\t\t}\n \t}\n }", "function fuc_discount($product, $percentage){\r\n $discountValue = $product / 100 * $percentage;\r\n $totalValue = $product - $discountValue; \r\n return $totalValue;\r\n\r\n}", "public function applyGlobalDiscount($discount_rate)\n {\n }", "public function setProduct(Product $product);", "public function setDiscountAttribute($val)\n {\n return (int)$this->attributes['discount'] = $val;\n }", "public function setDiscount(?float $discount): self\n {\n $this->initialized['discount'] = true;\n $this->discount = $discount;\n\n return $this;\n }", "public function setDiscountUid(?string $discountUid): void\n {\n $this->discountUid = $discountUid;\n }", "public function setDiscountAmount($amount);", "public function setDiscount($discount)\r\n {\r\n $this->discount = $discount;\r\n\r\n return $this;\r\n }", "public function set_manual_discount($discount_data = FALSE)\r\n\t{\r\n\t\tif (is_array($discount_data) && ! empty($discount_data))\r\n\t\t{\r\n\t\t\t// Check that any submitted 'New value' discounts are only applied to the shipping total. \r\n\t\t\tif (isset($discount_data['column']) && isset($discount_data['calculation']) && ($discount_data['column'] != 'shipping_total') && ($discount_data['calculation'] == 3))\r\n\t\t\t{\r\n\t\t\t\treturn FALSE;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t// Merge the code and manual discounts together, then loop through data and compile an array of all discount ids currently in use.\r\n\t\t\t$existing_discounts = array_merge($this->flexi->cart_contents['settings']['discounts']['manual'], $this->flexi->cart_contents['settings']['discounts']['codes']);\r\n\t\t\t$existing_ids = array();\r\n\t\t\t\t\r\n\t\t\tforeach($existing_discounts as $existing_discount)\r\n\t\t\t{\r\n\t\t\t\t$existing_ids[] = $existing_discount['id'];\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t// If an id is not set in the submitted '$discount_data', or if a discount with a matching id already exists, set a new id. \r\n\t\t\tif (! isset($discount_data['id']) || in_array($discount_data['id'], $existing_ids))\r\n\t\t\t{\r\n\t\t\t\t$id = 0;\r\n\t\t\t\twhile (in_array('manual_'.$id, $existing_ids))\r\n\t\t\t\t{\r\n\t\t\t\t\t$id++; \r\n\t\t\t\t}\r\n\t\t\t\t$id = $discount_data['id'] = 'manual_'.$id;\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\t$id = $discount_data['id'];\r\n\t\t\t}\r\n\t\t\r\n\t\t\t// Set default values if not submitted.\r\n\t\t\t$discount_data['description'] = (! isset($discount_data['description'])) ? FALSE : $discount_data['description'];\r\n\t\t\t$discount_data['value'] = (! isset($discount_data['value'])) ? 0 : $discount_data['value'];\r\n\t\t\t$discount_data['column'] = (! isset($discount_data['column'])) ? 'total' : $discount_data['column'];\r\n\t\t\t$discount_data['calculation'] = (! isset($discount_data['calculation'])) ? 1 : $discount_data['calculation'];\r\n\t\t\t$discount_data['tax_method'] = (! isset($discount_data['tax_method'])) ? FALSE : $discount_data['tax_method'];\r\n\t\t\t$discount_data['void_reward_points'] = (! isset($discount_data['void_reward_points'])) ? FALSE : $discount_data['void_reward_points'];\r\n\t\t\t\r\n\t\t\t// Set the cart column the discount is targeting and use the value to act as the discounts array key. \r\n\t\t\t// This prevents multiple discounts being applied to the same cart column.\r\n\t\t\t$target_column = $discount_data['column'];\r\n\t\t\t\r\n\t\t\t// Loop through data and set to cart session summary.\r\n\t\t\tforeach($discount_data as $column => $column_value)\r\n\t\t\t{\r\n\t\t\t\tif ($column == 'value')\r\n\t\t\t\t{\r\n\t\t\t\t\t// If a valid discount value is not set, set the default value as zero. \r\n\t\t\t\t\t$column_value = ($this->non_negative($column_value)) ? $this->format_calculation($column_value, 2, TRUE) : 0;\r\n\t\t\t\t}\r\n\t\t\t\telse if ($column == 'column')\r\n\t\t\t\t{\r\n\t\t\t\t\t// If a valid column is not set, discount the 'total' column by default. \r\n\t\t\t\t\t$column_value = (in_array($column_value, array('item_summary_total', 'shipping_total', 'total'))) ? $column_value : 'total';\r\n\t\t\t\t}\r\n\t\t\t\telse if ($column == 'calculation') \r\n\t\t\t\t{\r\n\t\t\t\t\t// If a valid calculation method is not set, a 'percentage' based calculation is set by default.\r\n\t\t\t\t\t// 1 = Percentage Based, 2 = Flat Fee, 3 = New Value.\r\n\t\t\t\t\t$column_value = (in_array($column_value, array(1,2,3))) ? $column_value : 1;\r\n\t\t\t\t}\r\n\t\t\t\telse if ($column == 'tax_method')\r\n\t\t\t\t{\r\n\t\t\t\t\t// If a valid tax method is not set, the tax method is defined by whether cart prices ex/include taxes by default.\r\n\t\t\t\t\t// 0 = Carts Default Tax Method, 1 = Apply Tax Before Discount, 2 = Apply Discount Before Tax, 3 = Apply Discount Before Tax, Add Original Tax.\r\n\t\t\t\t\t$column_value = (in_array($column_value, array(0, 1,2,3))) ? $column_value : 0;\r\n\t\t\t\t}\r\n\t\t\t\telse if ($column == 'void_reward_points')\r\n\t\t\t\t{\r\n\t\t\t\t\t$column_value = (bool)$column_value;\r\n\t\t\t\t}\r\n\t\t\t\telse if (! in_array($column, array('id', 'description')))\r\n\t\t\t\t{\r\n\t\t\t\t\tcontinue;\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\t$this->flexi->cart_contents['settings']['discounts']['manual'][$target_column][$column] = $column_value;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\treturn TRUE;\r\n\t\t}\r\n\t\t\r\n\t\treturn FALSE;\r\n\t}", "public function execute(\\Magento\\Framework\\Event\\Observer $observer)\n {\n $product = $observer->getProduct();\n $_pricePerPound = $product->getPricePerPound();\n if($_pricePerPound > 0){\n $weight = $product->getWeight() ? $product->getWeight() : 1;\n $_pricePerPound = str_replace(',', '', $_pricePerPound);\n $price = $_pricePerPound * $weight;\n $product->setPrice($price);\n }\n }", "public function setDiscount(int $discount): self\n {\n $this->discount = $discount;\n return $this;\n }", "public function setDiscountAmount($value){\n return $this->setParameter('discount_amount', $value);\n }", "public function testSetPriceProduct()\n {\n $product = new Product();\n $value = 10.99;\n $product->setPrice($value);\n $this->assertEquals($value, $product->getPrice());\n }", "function pricing() {\n\t\t\tparent::controller();\n\t\t\t\n\t\t}", "public function setDiscountPercent(?string $value): void {\n $this->getBackingStore()->set('discountPercent', $value);\n }", "private function setSoldIndividually() {\n $this->product->set_sold_individually($this->wcData->isSoldIndividually());\n }", "public function setDiscount($var)\n {\n GPBUtil::checkDouble($var);\n $this->discount = $var;\n\n return $this;\n }", "function setPrice($new_price)\n {\n $this->price = $new_price;\n }", "public function setDocumentProductDiscount(float $document_product_discount)\n {\n $this->collection->put('document_product_discount', (string) $document_product_discount);\n }", "function setItem_price($price){\n $this->item_price = $price;\n }", "public function setDiscountRate($value){\n return $this->setParameter('discount_rate', $value);\n }", "public function catalog_product_save_after($observer)\n {\n $_product = $observer->getProduct();\n $specialPrice = null;\n\n if($_product->getTypeId() == 'grouped') {\n $arrayPrices = array();\n\n $associatedProducts = $_product->getTypeInstance(true)->getAssociatedProducts($_product);\n foreach($associatedProducts as $associatedProduct) {\n $arrayPrices[] = round($associatedProduct->getPrice(), 2);\n }\n asort($arrayPrices);\n $price = array_shift($arrayPrices);\n } else {\n if($_product->getTypeId() == 'bundle') {\n //Zend_Debug::dump($_product->getData());exit;\n $selectionCollection = $_product->getTypeInstance(true)->getSelectionsCollection(\n $_product->getTypeInstance(true)->getOptionsIds($_product), $_product\n );\n\n foreach($selectionCollection as $option) {\n $bundled_prices[]=$option->getPrice();\n }\n\n sort($bundled_prices);\n\n $min_price=$bundled_prices[0];\n $price = $min_price;\n } else {\n $price = $_product->getData('price');\n $specialPrice = $_product->getData('special_price');\n }\n\n }\n\n\n if ($specialPrice != null) {\n $santanderPriceMonth = Mage::helper('santander')->getPricePerMonth($specialPrice);\n } else {\n $santanderPriceMonth = Mage::helper('santander')->getPricePerMonth($price);\n }\n Mage::getSingleton('catalog/product_action')->updateAttributes(array($_product->getEntityId()), array('santanderpricemonth' => \"$santanderPriceMonth\"), 1);\n }", "protected function _applyObjectProperty()\n\t{\n\t\tparent::_applyObjectProperty();\n\n\t\t$modelName = $this->_object->getModelName();\n\n\t\tswitch ($modelName)\n\t\t{\n\t\t\tcase 'shop_discount':\n\t\t\t\t// Скидка не может быть больше 100%\n\t\t\t\tif ($this->_object->type == 0 && $this->_object->value > 100)\n\t\t\t\t{\n\t\t\t\t\t$this->_object->value = 0;\n\t\t\t\t\t$this->_object->save();\n\n\t\t\t\t\t$this->addMessage(\n\t\t\t\t\t\tCore_Message::get(Core::_('Shop_Discount.percent_error'), 'error')\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\t// Группа доступа\n\t\t\t\t$aSiteuser_Groups = array(0 => Core::_('Structure.all'));\n\n\t\t\t\tif (Core::moduleIsActive('siteuser'))\n\t\t\t\t{\n\t\t\t\t\t$oSiteuser_Controller_Edit = new Siteuser_Controller_Edit($this->_Admin_Form_Action);\n\t\t\t\t\t$aSiteuser_Groups = $aSiteuser_Groups + $oSiteuser_Controller_Edit->fillSiteuserGroups($this->_object->Shop->site_id);\n\t\t\t\t}\n\n\t\t\t\t$aTmp = array();\n\n\t\t\t\t$aShop_Discount_Siteuser_Groups = $this->_object->Shop_Discount_Siteuser_Groups->findAll(FALSE);\n\t\t\t\tforeach ($aShop_Discount_Siteuser_Groups as $oShop_Discount_Siteuser_Group)\n\t\t\t\t{\n\t\t\t\t\t!in_array($oShop_Discount_Siteuser_Group->siteuser_group_id, $aTmp)\n\t\t\t\t\t\t&& $aTmp[] = $oShop_Discount_Siteuser_Group->siteuser_group_id;\n\t\t\t\t}\n\n\t\t\t\tforeach ($aSiteuser_Groups as $siteuser_group_id => $name)\n\t\t\t\t{\n\t\t\t\t\t$bSiteuserGroupChecked = Core_Array::getPost('siteuser_group_' . $siteuser_group_id);\n\n\t\t\t\t\tif ($bSiteuserGroupChecked)\n\t\t\t\t\t{\n\t\t\t\t\t\tif (!in_array($siteuser_group_id, $aTmp))\n\t\t\t\t\t\t{\n\n\t\t\t\t\t\t\t$oShop_Discount_Siteuser_Group = Core_Entity::factory('Shop_Discount_Siteuser_Group');\n\t\t\t\t\t\t\t$oShop_Discount_Siteuser_Group->siteuser_group_id = $siteuser_group_id;\n\t\t\t\t\t\t\t$this->_object->add($oShop_Discount_Siteuser_Group);\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 (in_array($siteuser_group_id, $aTmp))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$oShop_Discount_Siteuser_Group = $this->_object->Shop_Discount_Siteuser_Groups->getObject($this->_object, $siteuser_group_id);\n\n\t\t\t\t\t\t\t!is_null($oShop_Discount_Siteuser_Group)\n\t\t\t\t\t\t\t\t&& $oShop_Discount_Siteuser_Group->delete();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\tbreak;\n\t\t}\n\n\t\tCore_Event::notify(get_class($this) . '.onAfterRedeclaredApplyObjectProperty', $this, array($this->_Admin_Form_Controller));\n\n\t\treturn $this;\n\t}", "public static function update_item_with_discount($detail_id,$order_promotion,$order_discount_id,$order_discount_amt){\r\tif(is_gt_zero_num($detail_id)){\r\t\t$objtbl_order_details=new tbl_order_details();\r\t\tif($objtbl_order_details->readObject(array(ORD_DTL_ID=>$detail_id))){\r\t\t\t$objtbl_order_details->setordprom_promotion($order_promotion);\r\t\t\t$objtbl_order_details->setordprom_discount_id($order_discount_id);\r\t\t\t$objtbl_order_details->setordprom_discount_amt($order_discount_amt);\r\t\t\t$objtbl_order_details->insert();\r\t\t\treturn 1;\r\t\t}\r\t\tunset($objtbl_order_details);\t\r\t} \r\treturn 0;\t\r }", "protected function setOfferValue ()\n {\n $this->request->coupon_benefits[ $this->offerNature ] = $this->offer->rate;\n }", "function setSyncItemsPriceAction()\n {\n }", "function setProduct( $product )\n {\n if ( $this->State_ == \"Dirty\" )\n $this->get( $this->ID );\n\n if ( get_class( $product ) == \"ezproduct\" )\n {\n $this->ProductID = $product->id();\n }\n }", "public function execute(Observer $observer)\n {\n $item = $observer->getEvent()->getData('quote_item');\n $item = ($item->getParentItem() ? $item->getParentItem() : $item);\n $price = $item->getProduct()->getPriceInfo()->getPrice('final_price')->getValue();\n $new_price = $price - ($price * 50 / 100); //discount the price of the product to 50%\n $item->setCustomPrice($new_price);\n $item->setOriginalCustomPrice($new_price);\n $item->getProduct()->setIsSuperMode(true);\n }", "public function setAttributes_discounted( $attributes_discounted ) {\n\t\t$this->attributes_discounted = $attributes_discounted;\n\t}", "function setPrice($price, $taxPercentage = 25)\n {\n $this->taxPercentage = $taxPercentage;\n $this->taxA = $price / 100 * 100;\n $this->price = $price;\n }", "function beforeSave(){\n\t\t\t// Get the rate\n\t\t\t$rate = 1 / $this->_getRate();\n\n\t\t\t// Convert it back to USD\n\t\t\tif(!empty($this->data['Product']['rrp'])){\n\t\t\t\t$this->data['Product']['rrp'] = $this->data['Product']['rrp'] * $rate;\n\t\t\t}\n\n\t\t\tif(!empty($this->data['Product']['start_price'])){\n\t\t\t\t$this->data['Product']['start_price'] \t= $this->data['Product']['start_price'] * $rate;\n\t\t\t}\n\n\t\t\tif(!empty($this->data['Product']['delivery_cost'])){\n\t\t\t\t$this->data['Product']['delivery_cost'] = $this->data['Product']['delivery_cost'] * $rate;\n\t\t\t}\n\n\t\t\tif(!empty($this->data['Product']['fixed_price'])){\n\t\t\t\t$this->data['Product']['fixed_price'] \t= $this->data['Product']['fixed_price'] * $rate;\n\t\t\t}\n\n\t\t\tif(!empty($this->data['Product']['minimum_price'])){\n\t\t\t\t$this->data['Product']['minimum_price'] = $this->data['Product']['minimum_price'] * $rate;\n\t\t\t}\n\n\t\t\treturn true;\n\t\t}", "public function setDiscount($value)\n {\n $this->data->amount->subtotals->discount = (float) $value;\n\n return $this;\n }", "public function updatePercentage(Discount $discount)\n {\n }", "protected function doActionSetSalePrice()\n {\n $form = new \\XLite\\Module\\CDev\\Sale\\View\\Form\\SaleSelectedDialog();\n $form->getRequestData();\n\n if ($form->getValidationMessage()) {\n \\XLite\\Core\\TopMessage::addError($form->getValidationMessage());\n } elseif (!$this->getSelected() && $ids = $this->getActionProductsIds()) {\n $qb = \\XLite\\Core\\Database::getRepo('XLite\\Model\\Product')->createQueryBuilder();\n $alias = $qb->getMainAlias();\n $qb->update('\\XLite\\Model\\Product', $alias)\n ->andWhere($qb->expr()->in(\"{$alias}.product_id\", $ids));\n\n foreach ($this->getUpdateInfoElement() as $key => $value) {\n $qb->set(\"{$alias}.{$key}\", \":{$key}\")\n ->setParameter($key, $value);\n }\n\n $qb->execute();\n\n \\XLite\\Core\\TopMessage::addInfo('Products information has been successfully updated');\n } else {\n \\XLite\\Core\\Database::getRepo('\\XLite\\Model\\Product')->updateInBatchById($this->getUpdateInfo());\n \\XLite\\Core\\TopMessage::addInfo('Products information has been successfully updated');\n }\n\n $this->setReturnURL($this->buildURL('product_list', '', ['mode' => 'search']));\n }", "function es_set_sale_price( $price, $product ) {\n\t\n\t$exclude_skus = array( 'COEBRCE', 'COEPOSTER', 'PUB41' );\n\t$exclude_cats = array( 'specials', 'clearance' );\n\t$date_now = new DateTime();\n\t$start_dtm = new DateTime( '2016-10-03' );\n\t$end_dtm = new DateTime( '2016-10-11' );\n\t\n\t// exclude SKUs\n\tif ( in_array( $product->sku, $exclude_skus ) )\n\t\treturn $price;\n\t\n\t// exclude specials category\n\t$product_cat = wp_get_post_terms( $product->id, 'product_cat' );\n\t\n\tforeach ( $product_cat as $term ){\n\t\tif( in_array( $term->slug, $exclude_cats ) ){\n\t\t\treturn $price;\n\t\t}\n\t}\t\n\t\n\tif ( ! $product->is_virtual() AND ( $date_now >= $start_dtm AND $date_now <= $end_dtm ) ) {\n\t\t$member_exists = es_check_membership_held();\n\t\t$member_price = get_post_meta($product->id, 'member_price', true);\n\t\t$price = $product->get_regular_price() * ( 0.9 );\n\t\t\n\t\tif ( ! empty( $member_price ) AND $member_exists ) {\n\t\t\t$product->set_price( $member_price );\n\t\t\t$product->sale_price = $price;\n\t\t\t$price = $member_price;\t\t\n\t\t}\n\t\telse {\n\t\t\t$product->set_price( $price );\n\t\t\t$product->sale_price = $price;\t\n\t\t}\n\t\t\n\t}\n\t\n\treturn $price;\n}", "public function applyDiscount(Discount $discount){\n\t\tif($this->discount == NULL){\n\t\t\t$this->finalPrice = $this->price*(100-$discount->percent/100);\n\t\t\t$this->discount = $discount;\n\t\t}\n\t\treturn $this;\n\t}", "public function setProduct(Product $product)\n {\n $this->product_id = $product->id;\n $this->_calculateTotal();\n }", "public function postProcess() {\n if ($this->_action & CRM_Core_Action::DELETE) {\n CRM_CiviDiscount_BAO_Item::del($this->_id);\n CRM_Core_Session::setStatus(ts('Selected Discount has been deleted.'));\n return;\n }\n\n if ($this->_action & CRM_Core_Action::COPY) {\n $params = $this->exportValues();\n $newCode = CRM_CiviDiscount_Utils::randomString('abcdefghjklmnpqrstwxyz23456789', 8);\n CRM_CiviDiscount_BAO_Item::copy($this->_cloneID, $params, $newCode);\n CRM_Core_Session::setStatus(ts('Selected Discount has been duplicated.'));\n return;\n }\n\n $params = $this->exportValues();\n\n if ($this->_action & CRM_Core_Action::UPDATE) {\n $params['id'] = $this->_id;\n }\n $params['multi_valued'] = $this->_multiValued;\n\n if(in_array(0, $params['events']) && count($params['events']) > 1) {\n CRM_Core_Session::setStatus(ts('You selected `any event` and specific events, specific events have been unset'));\n $params['events'] = array(0);\n }\n\n $params['filters'] = $this->getFiltersFromParams($params);\n $item = CRM_CiviDiscount_BAO_Item::add($params);\n\n CRM_Core_Session::setStatus(ts('The discount \\'%1\\' has been saved.',\n array(1 => $item->description ? $item->description : $item->code)));\n }", "public function setProductPrice($product_price){\n $this->product_price = $product_price;\n }", "public function setPriceAttribute($value)\n {\n $this->attributes['price'] = $value*100;\n }", "public function getDiscount()\r\n {\r\n return $this->discount;\r\n }", "public function product_update_post()\n\t\t\t\t{\n\t\t\t\t}", "public function set_credits_discountamount($observer)\n {\n$array2 = Mage::helper('kartparadigm_storecredit')->getCreditRates();\n//Mage::log(Mage::helper('kartparadigm_storecredit')->getRefundDeductConfig() . \" configuration settings \");\n//Mage::log($array2);\n $session = Mage::getSingleton('checkout/session');\n if(Mage::helper('customer')->isLoggedIn()) {\n $customer = Mage::getSingleton('customer/session')->getCustomer();\n $customer_group=Mage::getModel('customer/group')->load(Mage::getSingleton('customer/session')->getCustomerGroupId())->getCustomerGroupCode();\n}\n \n$val1 = Mage::getSingleton('adminhtml/session')->getValue();\nif(isset($val1))\n{\n$amt1 = array();\n$amt1 = Mage::getSingleton('checkout/session')->getCredits();\n$amt = $amt1['totalCredits'];\n$quote = Mage::getSingleton('adminhtml/session_quote')->getQuote();\n}\nelse{\n$amt1 = array();\n $quote = Mage::getModel('checkout/cart')->getQuote();\n$amt1 = Mage::getSingleton('checkout/session')->getCredits();\n$amt = $amt1['discountCredits'];\n}\n $isvirtual=0;\n foreach($quote->getAllItems() as $item){\n if($item->getIsVirtual()==1) {\n $isvirtual=1;\n }\n if(Mage::getModel('catalog/product')->load($item->getProductId())->getTypeId()=='customproduct'){\n $isvirtual=1;\n }\n }\n$total=$quote->getGrandTotal(); \n\n$subTotal = $quote->getSubtotal();\n//Mage::log($quote->getGrandTotal().\"this is grand total store credit\");\n//Mage::log($quote->getSubtotal().\"this is sub total\");\n\n if (!Mage::helper('kartparadigm_storecredit')->getTaxEnabled()){\n$tax = $quote->getShippingAddress()->getData('tax_amount');\n}\n if(!Mage::helper('kartparadigm_storecredit')->getIsShippingEnabled()){\n$shippingPrice = $quote->getShippingAddress()->getShippingAmount();\n}\n$totalCredits1 = array();\n$totalCredits1 = Mage::getSingleton('checkout/session')->getCredits();\n$totalCredits = $totalCredits1['totalCredits'];\n\n$currentTimestamp = Mage::getModel('core/date')->timestamp(time()); \n$nowdate = date('Y-m-d H:m:s', $currentTimestamp); \n//echo $expirydate;\n//echo $nowdate;\n$balance;\n//echo $amt;\n$amt2;\n $amt1;\n \n\nif(isset($amt)){\n/*---------------------Calculating Default Currency Value----------------------- */\n$amt1 = ($array2['basevalue'] * $amt) / $array2['credits'];\n $baseCurrencyCode = Mage::app()->getStore()->getBaseCurrencyCode();\n $currentCurrencyCode = Mage::app()->getStore()->getCurrentCurrencyCode();\n if ($baseCurrencyCode != $currentCurrencyCode) {\n $amt2 = Mage::helper('directory')->currencyConvert($amt1, $baseCurrencyCode, $currentCurrencyCode);\n }\n else{\n $amt2 = $amt1; \n }\n // $amt2 = Mage::helper('core')->currency($amt1, true, false);\n//Mage::log($amt1.\" = amount = \".$amt2 );\n//----------------------------------------------------------------\nif($total > $amt2) {\nif(($total - $tax - $shippingPrice) > $amt2){\n$discountAmount = $amt2;\n$balance = $totalCredits - $amt;\n}else{\n $discountAmount = $subTotal;\n$points = round(($discountAmount * $amt)/$amt2);\n//Mage::log($points.\"Conver Points\");\n$balance = $totalCredits - $points;\n}\n}\nelse {\n$discountAmount = $total - $tax - $shippingPrice;\n$points = round(($discountAmount * $amt)/$amt2);\n//Mage::log($points.\"Conver Points\");\n$balance = $totalCredits - $points;\n}\nMage::getSingleton('core/session')->setBalance($balance);\n\nMage::getSingleton('checkout/session')->setDiscount($totalCredits - $balance);\n$msg = \"Current Credits In Your Account : \" . $balance;\nMage::getSingleton('core/session')->setCredits($msg);\n if ($discountAmount > 0) {\n\n\nif ($baseCurrencyCode != $currentCurrencyCode) {\n \n$allowedCurrencies = Mage::getModel('directory/currency')->getConfigAllowCurrencies();\n$rates = Mage::getModel('directory/currency')->getCurrencyRates($baseCurrencyCode, array_values($allowedCurrencies));\n\n$baseDiscount = $discountAmount/$rates[$currentCurrencyCode];\n\n }\nelse{\n $baseDiscount = $discountAmount;\n } \n $total = $quote->getBaseSubtotal();\n $data1 = $quote->getData();\n // Mage::log($data1['entity_id'].\"quote id\");\n $quote->setSubtotal(0);\n $quote->setBaseSubtotal(0);\n $quote->setSubtotalWithDiscount(0);\n $quote->setBaseSubtotalWithDiscount(0);\n $quote->setGrandTotal(0);\n $quote->setBaseGrandTotal(0);\n $canAddItems = $quote->isVirtual() ? ('billing') : ('shipping');\n foreach($quote->getAllAddresses() as $address) {\n $data = $address->getData();\n $address->setSubtotal(0);\n $address->setBaseSubtotal(0);\n $address->setGrandTotal(0);\n $address->setBaseGrandTotal(0);\n $address->collectTotals();\n $quote->setSubtotal((float)$quote->getSubtotal() + $address->getSubtotal());\n $quote->setBaseSubtotal((float)$quote->getBaseSubtotal() + $address->getBaseSubtotal());\n $quote->setSubtotalWithDiscount((float)$quote->getSubtotalWithDiscount() + $address->getSubtotalWithDiscount());\n $quote->setBaseSubtotalWithDiscount((float)$quote->getBaseSubtotalWithDiscount() + $address->getBaseSubtotalWithDiscount());\n $quote->setGrandTotal((float)$quote->getGrandTotal() + $address->getGrandTotal());\n $quote->setBaseGrandTotal((float)$quote->getBaseGrandTotal() + $address->getBaseGrandTotal());\n $quote->setEntityId($data1['entity_id'])->save();\n $quote->setSubtotalWithDiscount($quote->getSubtotal() - $discountAmount)->setBaseSubtotalWithDiscount($quote->getBaseSubtotal() - $baseDiscount)->setEntityId($data1['entity_id'])->save();\n if ($address->getAddressType() == $canAddItems) {\n $address->setSubtotalWithDiscount((float)$data['subtotal_with_discount'] - $discountAmount);\n $address->setGrandTotal((float)$data['grand_total'] - $discountAmount);\n $address->setBaseSubtotalWithDiscount((float)$data['base_subtotal_with_discount'] - $baseDiscount);\n $address->setBaseGrandTotal((float)$data['base_grand_total'] - $baseDiscount);\n if ($data['discount_description']) {\n $address->setDiscountAmount(($data['discount_amount'] - $discountAmount));\n $address->setDiscountDescription($data['discount_description'] . ', Store Credits');\n $address->setBaseDiscountAmount(($data['base_discount_amount'] - $baseDiscount));\n }\n else {\n $address->setDiscountAmount(-($discountAmount));\n $address->setDiscountDescription('Store Credits');\n $address->setBaseDiscountAmount(-($baseDiscount));\n }\n $address->setAddressId($data['address_id'])->save();\n }\n }\n foreach($quote->getAllItems() as $item) {\n\n // We apply discount amount based on the ratio between the GrandTotal and the RowTotal\n $rat = $item->getPriceInclTax() / $quote->getSubtotal();\n $rat1 = $item->getBasePriceInclTax() / $quote->getBaseSubtotal();\n $ratdisc = $discountAmount * $rat;\n $ratdisc1 = $baseDiscount * $rat1;\n//Mage::log($item->getDiscountAmount().\"include tax\".$item->getBaseDiscountAmount());\n // Mage::log($item->getDiscountAmount().\"discount storecredit\");\n$idata = $item->getData();\n Mage::log($item->getDiscountAmount().\"discount amount credit\");\n $item->setDiscountAmount(($item->getDiscountAmount() + $ratdisc) * $item->getQty());\n $item->setBaseDiscountAmount(($item->getBaseDiscountAmount() + $ratdisc1) * $item->getQty())->save();\n }\n }else if($totalCredits == 0){\n\n$msg = \"Sorry You Have No Credits In Your Account\";\nMage::getSingleton('core/session')->setCredits($msg);\n}\n \n \n } \n }", "public function testSetWeightProduct()\n {\n $product = new Product();\n $value = 100;\n $product->setWeight($value);\n $this->assertEquals($value, $product->getWeight());\n }", "public function deleteDiscount();", "public function getTonicDiscount()\n {\n }", "public function product($prod) {\n\t\t$this->upsProductCode = $prod;\n\t}", "public function apply(OrderItem $item)\n {\n $product = $item->model;\n $order = $item->order;\n\n $originalPrice = $product->getPrice($order->currency, $item->options);\n\n $discount = 0;\n if ($this->type == self::TYPE_FIXED) {\n $discount = $this->discount;\n } elseif ($this->type == self::TYPE_PERCENTAGE) {\n $discount = ($originalPrice / 100) * $this->discount;\n }\n $item->update([\n 'title' => $product->getTitle(),\n 'price' => $originalPrice,\n 'discount' => $discount,\n ]);\n }", "public function setPriceAttribute($value)\n {\n $this->attributes['price'] = $value * 100;\n }", "public function applyPromotion()\n {\n $this->promotion->setOrder($this);\n }", "function es_cart_change_coupon_label( $html , $coupon){\n\n$html='Discount:';\n\nreturn $html;\n\n}", "public function setPriceOnProductPage(Varien_Event_Observer $observer)\n {\n $moduleName = Mage::app()->getRequest()->getModuleName();\n $actionName = Mage::app()->getRequest()->getActionName();\n $controllerName = Mage::app()->getRequest()->getControllerName();\n\n $frontName = Mage::getConfig()->getNode('frontend/routers/bundlecreatorplus/args/frontName');\n\n // Only for bcp/product/view pages\n if ($frontName != $moduleName || $controllerName != 'product' || $actionName != 'view') {\n return $this;\n }\n\n $item = Mage::helper('bundlecreatorplus')->getPackageSession()->getActiveItem();\n $itemOption = Mage::helper('bundlecreatorplus')->getOptionByProductId(\n $item->getId(),\n $observer->getEvent()->getProduct()->getId()\n );\n $overridePrice = $itemOption->getOverridePrice();\n $price = $item->getPrice();\n\n // Fixed price\n if (Mage::helper('bundlecreatorplus')->isPackagePriceFixed()) {\n if(is_numeric($itemOption->getOverridePrice())) {\n $finalPrice = $overridePrice + $price;\n } else {\n $finalPrice = $price;\n }\n\n $observer->getEvent()->getProduct()->setFinalPrice($finalPrice);\n $observer->getEvent()->getProduct()->setPrice($finalPrice);\n\n } else {\n if(is_numeric($itemOption->getOverridePrice())) {\n $observer->getEvent()->getProduct()->setFinalPrice($overridePrice);\n $observer->getEvent()->getProduct()->setPrice($overridePrice);\n }\n }\n \n return $this;\n }", "public function setShippingDiscountAmount($amount);", "private function SetPricingDetails()\n\t{\n\t\t$product = $this->productClass->getProduct();\n\n\t\t$GLOBALS['PriceLabel'] = GetLang('Price');\n\n\t\tif($this->productClass->GetProductCallForPricingLabel()) {\n\t\t\t$GLOBALS['ProductPrice'] = $GLOBALS['ISC_CLASS_TEMPLATE']->ParseGL($this->productClass->GetProductCallForPricingLabel());\n\t\t}\n\t\t// If prices are hidden, then we don't need to go any further\n\t\telse if($this->productClass->ArePricesHidden()) {\n\t\t\t$GLOBALS['HidePrice'] = \"display: none;\";\n\t\t\t$GLOBALS['HideRRP'] = 'none';\n\t\t\t$GLOBALS['ProductPrice'] = '';\n\t\t\treturn;\n\t\t}\n\t\telse if (!$this->productClass->IsPurchasingAllowed()) {\n\t\t\t$GLOBALS['ProductPrice'] = GetLang('NA');\n\t\t}\n\t\telse {\n\t\t\t$options = array('strikeRetail' => false);\n\t\t\t$GLOBALS['ProductPrice'] = formatProductDetailsPrice($product, $options);\n\t\t}\n\n\t\t// Determine if we need to show the RRP for this product or not\n\t\t// by comparing the price of the product including any taxes if\n\t\t// there are any\n\t\t$GLOBALS['HideRRP'] = \"none\";\n\t\t$productPrice = $product['prodcalculatedprice'];\n\t\t$retailPrice = $product['prodretailprice'];\n\t\tif($retailPrice) {\n\t\t\t// Get the tax display format\n\t\t\t$displayFormat = getConfig('taxDefaultTaxDisplayProducts');\n\t\t\t$options['displayInclusive'] = $displayFormat;\n\n\t\t\t// Convert to the browsing currency, and apply group discounts\n\t\t\t$productPrice = formatProductPrice($product, $productPrice, array(\n\t\t\t\t'localeFormat' => false, 'displayInclusive' => $displayFormat\n\t\t\t));\n\t\t\t$retailPrice = formatProductPrice($product, $retailPrice, array(\n\t\t\t\t'localeFormat' => false, 'displayInclusive' => $displayFormat\n\t\t\t));\n\n\t\t\tif($productPrice < $retailPrice) {\n\t\t\t\t$GLOBALS['HideRRP'] = '';\n\n\t\t\t\t// Showing call for pricing, so just show the RRP and that's all\n\t\t\t\tif($this->productClass->GetProductCallForPricingLabel()) {\n\t\t\t\t\t$GLOBALS['RetailPrice'] = CurrencyConvertFormatPrice($retailPrice);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\t// ISC-1057: do not apply customer discount to RRP in this case\n\t\t\t\t\t$retailPrice = formatProductPrice($product, $product['prodretailprice'], array(\n\t\t\t\t\t\t'localeFormat' => false,\n\t\t\t\t\t\t'displayInclusive' => $displayFormat,\n\t\t\t\t\t\t'customerGroup' => 0,\n\t\t\t\t\t));\n\t\t\t\t\t$GLOBALS['RetailPrice'] = '<strike>' . formatPrice($retailPrice) . '</strike>';\n\t\t\t\t\t$GLOBALS['PriceLabel'] = GetLang('YourPrice');\n\t\t\t\t\t$savings = $retailPrice - $productPrice;\n\t\t\t\t\t$string = sprintf(getLang('YouSave'), '<span class=\"YouSaveAmount\">'.formatPrice($savings).'</span>');\n\t\t\t\t\t$GLOBALS['YouSave'] = '<span class=\"YouSave\">'.$string.'</span>';\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "public function getDiscountAmount();", "function setPrice( $value )\n {\n if ( $this->State_ == \"Dirty\" )\n $this->get( $this->ID );\n\n $this->Price = $value;\n setType( $this->Price, \"double\" );\n }", "public function setDiscount($discount)\n {\n $this->discount = $discount;\n\n return $this;\n }", "public function setDiscount($discount)\n {\n $this->discount = $discount;\n\n return $this;\n }", "public function set_discount_defaults()\r\n\t{\r\n\t\t// Set array placeholders.\r\n\t\tif (! isset($this->flexi->cart_contents['settings']['discounts']['codes']))\r\n\t\t{\r\n\t\t\t$this->flexi->cart_contents['settings']['discounts']['codes'] = array();\r\n\t\t}\r\n\t\tif (! isset($this->flexi->cart_contents['settings']['discounts']['manual']))\r\n\t\t{\r\n\t\t\t$this->flexi->cart_contents['settings']['discounts']['manual'] = array();\r\n\t\t}\t\r\n\t\r\n\t\t// Reset other discount data.\r\n\t\t$this->flexi->cart_contents['settings']['discounts']['active_items'] = array();\r\n\t\t$this->flexi->cart_contents['settings']['discounts']['active_summary'] = array();\r\n\t\t$this->flexi->cart_contents['settings']['discounts']['reward_vouchers'] = array();\r\n\t\t$this->flexi->cart_contents['settings']['discounts']['data']['item_discount_savings'] = 0;\r\n\t\t$this->flexi->cart_contents['settings']['discounts']['data']['summary_discount_savings'] = 0;\r\n\t\t$this->flexi->cart_contents['settings']['discounts']['data']['reward_vouchers'] = 0;\r\n\t\t$this->flexi->cart_contents['settings']['discounts']['data']['void_reward_point_items'] = array();\r\n\r\n\t\tif (! isset($this->flexi->cart_contents['settings']['discounts']['data']['excluded_discounts']))\r\n\t\t{\r\n\t\t\t$this->flexi->cart_contents['settings']['discounts']['data']['excluded_discounts'] = array();\r\n\t\t}\t\r\n\t\t\r\n\t\treturn TRUE;\r\n\t}", "public function getDiscount(): int\n {\n return $this->discount;\n }", "function apply_special_category_discount($category, $count, &$disc_amount) {\r\n switch($category) {\r\n case 99999:\r\n case 99998:\r\n if ($count > 100) {\r\n $disc_amount = 50; \r\n }\r\n break; \r\n case 99997:\r\n $disc_amount = 75;\r\n break;\r\n }\r\n }", "public static function product($product)\n {\n static::$product = $product;\n }", "public function getDiscount()\n {\n return $this->discount;\n }", "public function getDiscount()\n {\n return $this->discount;\n }", "public function getDiscount()\n {\n return $this->discount;\n }", "public function getDiscount()\n {\n return $this->discount;\n }", "public function getDiscount()\n {\n return $this->discount;\n }", "public function getDiscount()\n {\n return $this->discount;\n }", "public function createnewproduct()\n {\n Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);\n $product = Mage::getModel('catalog/product');\n $websiteId = Mage::app()->getWebsite('base')->getId();\n $storeId = Mage::app()->getStore('default')->getId();\n\n //Set SKU dynamically over here\n $collection = Mage::getModel('catalog/product')\n ->getCollection()\n ->addAttributeToSort('created_at', 'desc');\n $collection->getSelect()->limit(1);\n $latestItemId = $collection->getLastItem()->getId();\n if($latestItemId) {\n $nextProid = $latestItemId + 1;\n } else {\n $nextProid = 1;\n }\n $SampleSKU = 'titechPro'.$nextProid;\n\n try {\n $product\n ->setStoreId($storeId) //you can set data in store scope\n ->setWebsiteIds(array($websiteId)) //website ID the product is assigned to, as an array\n ->setAttributeSetId(4) //ID of a attribute set named 'default'\n ->setTypeId('simple') //product type\n ->setCreatedAt(strtotime('now')) //product creation time\n ->setUpdatedAt(strtotime('now')) //product update time\n ->setSku($SampleSKU) //SKU\n ->setName('Titech sample product') //product name\n ->setWeight(4.0000)\n ->setStatus(1) //product status (1 - enabled, 2 - disabled)\n ->setTaxClassId(4) //tax class (0 - none, 1 - default, 2 - taxable, 4 - shipping)\n ->setVisibility(Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH) //catalog and search visibility\n //->setManufacturer(28) //manufacturer id\n //->setColor(24)\n //->setNewsFromDate('06/26/2014') //product set as new from\n //->setNewsToDate('06/30/2014') //product set as new to\n ->setCountryOfManufacture('IN') //country of manufacture (2-letter country code)\n ->setPrice(11.22) //price in form 11.22\n ->setCost(22.33) //price in form 11.22\n //->setSpecialPrice(00.44) //special price in form 11.22\n //->setSpecialFromDate('06/1/2014') //special price from (MM-DD-YYYY)\n //->setSpecialToDate('06/30/2014') //special price to (MM-DD-YYYY)\n ->setMsrpEnabled(1) //enable MAP\n ->setMsrpDisplayActualPriceType(1) //display actual price (1 - on gesture, 2 - in cart, 3 - before order confirmation, 4 - use config)\n ->setMsrp(99.99) //Manufacturer's Suggested Retail Price\n ->setMetaTitle('Sample meta title 2')\n ->setMetaKeyword('Sample meta keyword 2')\n ->setMetaDescription('Sample meta description 2')\n ->setDescription('This is a long description for sample product')\n ->setShortDescription('This is a short description for sample product')\n ->setMediaGallery (array('images'=>array (), 'values'=>array ())) //media gallery initialization\n ->addImageToMediaGallery('media/catalog/product/ti/ti_logo.png', array('image','thumbnail','small_image'), false, false) //assigning image, thumb and small image to media gallery\n ->setStockData(array(\n 'use_config_manage_stock' => 0, //'Use config settings' checkbox\n 'manage_stock'=>1, //manage stock\n 'min_sale_qty'=>1, //Minimum Qty Allowed in Shopping Cart\n 'max_sale_qty'=>2, //Maximum Qty Allowed in Shopping Cart\n 'is_in_stock' => 1, //Stock Availability\n 'qty' => 999 //qty\n )\n )\n ->setCategoryIds(array(2)); //assign product to categories - Set to Default\n\n $product->save();\n return $product->getIdBySku($SampleSKU);\n } catch(Exception $e) {\n Mage::log($e->getMessage());\n }\n }", "public function setBaseDiscountAmount($amount);", "private function makeItemPurchase() : void\n {\n $this->item->available = $this->item->available - 1;\n $this->coinService->setCoinCount(\n $this->coinService->getCurrenCoinCount() - $this->item->cost\n );\n $this->item->save();\n }", "public function getDiscountPriceAttribute(){\n\n if (!empty($this->discount)) {\n\n if ($this->discount->type == 'percentage') {\n $discount = ($this->price * $this->discount->discount) / 100;\n\n return round($this->price - $discount, 2);\n\n }else {\n\n return round($this->price - $this->discount->discount, 2);\n\n }\n\n }\n }", "function ycb_add_discount_badge($content, $post, $product){\r\n global $ycb_using_flatsome;\r\n\r\n $ycb_settings = ycb_get_settings();\r\n\r\n //var_dump(get_class_methods($product));\r\n $base_price = $product->get_regular_price();\r\n $discount_price = $product->get_sale_price();\r\n\r\n if($product->is_type( 'variable' )){\r\n $variations = $product->get_available_variations();\r\n if(isset($variations[0])){\r\n $variation = $variations[0];\r\n $base_price = $variation[\"display_regular_price\"];\r\n $discount_price = $variation[\"display_price\"];\r\n }\r\n }\r\n\r\n if(class_exists(\"WC_Dynamic_Pricing\")){\r\n $discount_price = apply_filters(\"woocommerce_product_get_price\", $base_price, $product, false);\r\n }\r\n\r\n $percentage = round( ( ( floatval($base_price) - floatval($discount_price) ) / (floatval($base_price) > 0 ? floatval($base_price) : 1) ) * 100 );\r\n\r\n $sale_style = ycb_get_styles($ycb_settings, $percentage);\r\n $inner_content = \"-\" . $percentage . \"%\";\r\n $filtered_content = apply_filters('ycb_discount_badge_override_hook', $inner_content);\r\n $sale_tag = \"<span class='onsale ycb_on_sale yoohoo_badge \".ycb_get_badge_shape_class(false, $ycb_settings).\"' style='$sale_style'>\" . $filtered_content . \"</span>\";\r\n\r\n $force_remove_internal_tag = apply_filters('ycb_hide_internal_sale_tag', true, $ycb_settings);\r\n if(!$force_remove_internal_tag){\r\n $sale_tag = \"\";\r\n }\r\n\r\n $hide_sale_tag = isset($ycb_settings['ycb_hide_default_sale_tag']) && $ycb_settings['ycb_hide_default_sale_tag'] === \"true\" ? true : false;\r\n\r\n if($hide_sale_tag){\r\n $content = $sale_tag;\r\n } else {\r\n $content .= $sale_tag;\r\n }\r\n\r\n if($percentage > 0){\r\n if($hide_sale_tag){\r\n if($ycb_using_flatsome){\r\n ycb_custom_badge_hide_woo_sales_badge_on_page(true);\r\n $content .= $sale_tag;\r\n } else {\r\n $content = $sale_tag;\r\n }\r\n } else {\r\n $content .= $sale_tag;\r\n }\r\n }\r\n\r\n //$content = apply_filters(\"ycb_discount_badge_internal_filter\", $content, $product, $hide_sale_tag, $ycb_settings);\r\n\r\n return $content;\r\n}", "private function setPremiumCode(){\n for($i = 0; $i < 7; $i++) {\n $this->premiumCode .= rand(1,9);\n };\n $this->discount = 10;\n }", "function setPrice($price)\n {\n $this->price = $price;\n }", "public function testUpdateProductUsingPOST()\n {\n }", "function applyDiscountOnSubscription($subscriptionId = null)\n {\n $db = new db();\n $db->makeConnection();\n\n if($subscriptionId != null)\n {\n \t\\Stripe\\Stripe::setApiKey(STRPIE_CLIENT_SECRET);\n\n $date = date('Y-m-d 00:00:00');\n $discountTotal = 0;\n\n // Select plan having trial periods on\n // $query = \"SELECT price FROM billing_products BP INNER JOIN user_subscription_items USI ON BP.plan_id = USI.plan_id WHERE BP.trial_period != 0 AND USI.subscription_id = '{$subscriptionId}' AND USI.coupon_trial_from <= '{$date}' AND USI.coupon_trial_to >= '{$date}'\";\n $query = \"SELECT price FROM billing_products BP INNER JOIN user_subscription_items USI ON BP.plan_id = USI.plan_id WHERE BP.trial_period != 0 AND USI.subscription_id = '{$subscriptionId}' AND USI.coupon_trial_from <= '{$date}' AND USI.coupon_trial_to > '{$date}' AND USI.status = '1'\";\n $res = $db->query($query);\n\n if($db->numRows($res))\n {\n while ($rs = mysqli_fetch_array($res))\n {\n $discountTotal += $rs['price'];\n }\n\n //\n if($discountTotal)\n {\n // Fetch if coupon exist, otherwise create\n $couponId = 'OFF-'.$discountTotal;\n\n try {\n // Retrieve coupon\n $coupon = \\Stripe\\Coupon::retrieve($couponId);\n } catch (\\Stripe\\Error\\Base $e) {\n // Create coupon\n $coupon = \\Stripe\\Coupon::create([\n 'id' => $couponId,\n 'amount_off' => ($discountTotal*100),\n 'currency' => 'SEK',\n 'duration' => 'once',\n // 'duration' => 'repeating',\n // 'duration_in_months' => 3,\n ]);\n }\n\n // Apply coupon on subscription\n if($coupon)\n {\n try {\n // Update subscription\n \\Stripe\\Subscription::update(\n $subscriptionId,\n ['coupon' => $coupon->id]\n );\n } catch (\\Stripe\\Error\\Base $e) {}\n }\n }\n else\n {\n \ttry {\n $sub = \\Stripe\\Subscription::retrieve($subscriptionId);\n\n if( isset($sub->discount) && ($sub->discount != null) )\n {\n $sub->deleteDiscount();\n }\n } catch (\\Stripe\\Error\\Base $e) {}\n }\n }\n else\n {\n \ttry {\n $sub = \\Stripe\\Subscription::retrieve($subscriptionId);\n\n if( isset($sub->discount) && ($sub->discount != null) )\n {\n $sub->deleteDiscount();\n }\n } catch (\\Stripe\\Error\\Base $e) {}\n }\n }\n }", "function changeProduct($cart_table_id,$true_or_false)\n {\n $this->pdelivery[$cart_table_id]=$true_or_false; //change product group delivery\n }", "function setSyncItemsCodeProduct()\n {\n }", "function updateTest()\n {\n $this->cD->updateElement(new Product(1, \"Trang\"));\n }", "public function apply()\n {\n /** @var EavSetup $eavSetup */\n $eavSetup = $this->eavSetupFactory->create(['setup' => $this->moduleDataSetup]);\n\n if (!$eavSetup->getAttribute(Product::ENTITY, 'am_shipping_type')) {\n $eavSetup->addAttribute(\n Product::ENTITY,\n 'am_shipping_type',\n [\n 'type' => 'varchar',\n 'backend' => '',\n 'frontend' => '',\n 'label' => 'Shipping Type',\n 'input' => 'select',\n 'class' => '',\n 'source' => '',\n 'global' => ScopedAttributeInterface::SCOPE_STORE,\n 'visible' => true,\n 'required' => false,\n 'user_defined' => false,\n 'default' => 0,\n 'searchable' => false,\n 'filterable' => false,\n 'comparable' => false,\n 'visible_on_front' => false,\n 'used_in_product_listing' => true,\n 'unique' => false,\n 'apply_to' => ''\n ]\n );\n }\n }", "public function setToCart()\n\t{\n\t\t$this->cart->set($this->request->getInteger('record'), $this->request->getInteger('amount', 1), [\n\t\t\t'priceNetto' => (float) $this->request->get('priceNetto', 0.0),\n\t\t\t'priceGross' => (float) $this->request->get('priceGross', 0.0),\n\t\t]);\n\t\t$this->saveCart();\n\t}", "function _apply_auto_disc()\n\t{\n\t\t$num_items = $this->cart->total_items();\n\t\t$auto_disc_info = null;\n\n\t\tforeach ($this->auto_disc_array as $cart_items => $disc_info)\n\t\t{\n\t\t\tif($num_items >= $cart_items)\n\t\t\t{\n\t\t\t\t$auto_disc_info = $disc_info;\n\t\t\t}\n\t\t}\n\n\t\t$applied_disc = $this->cart->discount_info();\n\n\t\t//auto discount should be more than the applied disc (if any)\n\t\tif($applied_disc['percentage'] < $auto_disc_info['percentage'])\n\t\t{\n\t\t\t$this->_apply_discount( $auto_disc_info['coupon'] );\n\t\t}\t\t\n\t}" ]
[ "0.7320002", "0.67875105", "0.6749029", "0.64006", "0.6346011", "0.63334376", "0.6305285", "0.6152022", "0.6128991", "0.61021376", "0.6083712", "0.6057289", "0.60383236", "0.6027863", "0.6025377", "0.60189515", "0.600358", "0.59801716", "0.5962583", "0.59585863", "0.5896409", "0.5893191", "0.58871824", "0.5877366", "0.58394885", "0.5811036", "0.5792779", "0.57908005", "0.5774668", "0.5746757", "0.57365745", "0.57327497", "0.5716643", "0.5714765", "0.57077", "0.5701719", "0.5672958", "0.5661149", "0.56490815", "0.5644882", "0.5637572", "0.56346226", "0.56313425", "0.5626435", "0.5626039", "0.557756", "0.5577172", "0.55747", "0.55619174", "0.55548656", "0.5552548", "0.55446714", "0.5542656", "0.5541749", "0.5537179", "0.55322564", "0.5527892", "0.55266094", "0.5521947", "0.5516641", "0.5510604", "0.5498244", "0.54897994", "0.54861873", "0.54861146", "0.54832613", "0.54645354", "0.54642725", "0.54609185", "0.5451986", "0.54519683", "0.5450025", "0.5449023", "0.5448451", "0.54305995", "0.54305995", "0.54213697", "0.5419919", "0.5419244", "0.5419218", "0.5414014", "0.5414014", "0.5414014", "0.5414014", "0.5414014", "0.5414014", "0.5412442", "0.5406344", "0.54048866", "0.5404746", "0.5400257", "0.53996456", "0.5388921", "0.53883106", "0.5385999", "0.5381075", "0.5371067", "0.5368829", "0.5364954", "0.5361905", "0.535567" ]
0.0
-1
Target: Feature. "Set discount to product feature"
protected static function avail_target_feature($filter_items, $items, $target, $rule, $sku_id) { // Если условие не задано, прерываем обработку if (empty($target->condition) || !$filter_items) { return false; } $discount_items = self::filter_by_feature($items, (array) $target->condition); return self::calculate_target_discount($target, $discount_items, $rule, $sku_id); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function AssignDiscount()\n\t{\t\n\t}", "function set_discount($discount_id = FALSE)\n\t\t{\n\t\t\t$this->load->model('demo_cart_model');\n\t\t\t\n\t\t\t$this->demo_cart_model->demo_set_discount($discount_id);\n\t\t\t\n\t\t\tredirect('cart');\n\t\t}", "function setup() {\r\n // \"Buy more than 100 items, get 50 (% or $, as per admin) off\" \r\n // $this->add_extra_level_discount(100, 50);\r\n }", "private function updateProductDiscount(\n ProductInterface $product,\n Request $request\n ): void {\n $discountPercent = $request->request->get('discount_percent') !== '' ? (float) $request->request->get('discount_percent') : null;\n $discountLimitType = $request->request->get('discount_limit_type') !== '' ? $request->request->get('discount_limit_type') : null;\n $discountFromDate = $request->request->get('discount_from_date') !== '' ? $request->request->get('discount_from_date') : null;\n $discountToDate = $request->request->get('discount_to_date') !== '' ? $request->request->get('discount_to_date') : null;\n\n $variants = $product->getVariants();\n foreach ($variants as $variant) {\n // Variant to change\n $variantPricing = $variant->getChannelPricings()->first();\n\n // Change percent\n if ($discountPercent !== null) {\n $variantPricing->setDiscount($discountPercent / 100);\n }\n\n // Continue if no change type\n if ($discountLimitType === self::LIMIT_NO_CHANGE) {\n continue;\n }\n // Discount type\n $variantPricing->setDiscountLimitType($discountLimitType === self::LIMIT_NONE ? null : $discountLimitType);\n\n // Date type discount\n if ($discountLimitType === self::LIMIT_DATETIME) {\n if ($discountFromDate && $discountToDate) {\n $dateFrom = \\DateTime::createFromFormat('Y-m-d', $discountFromDate);\n $dateTo = \\DateTime::createFromFormat('Y-m-d', $discountToDate);\n\n $variantPricing->setDiscountFrom($dateFrom);\n $variantPricing->setDiscountTo($dateTo);\n }\n\n if ($discountFromDate && !$discountToDate) {\n $dateFrom = \\DateTime::createFromFormat('Y-m-d', $discountFromDate);\n\n $variantPricing->setDiscountFrom($dateFrom);\n $variantPricing->setDiscountTo(null);\n }\n\n if (!$discountFromDate && $discountToDate) {\n $dateTo = \\DateTime::createFromFormat('Y-m-d', $discountToDate);\n\n $variantPricing->setDiscountFrom(null);\n $variantPricing->setDiscountTo($dateTo);\n }\n }\n }\n }", "public function updateAffectedPlans(Discount $discount)\n {\n }", "function getDiscountFor($product) {\n\t\treturn 30;\n\t}", "public function applyGlobalDiscount($discount_rate)\n {\n }", "function fuc_discount($product, $percentage){\r\n $discountValue = $product / 100 * $percentage;\r\n $totalValue = $product - $discountValue; \r\n return $totalValue;\r\n\r\n}", "public function setDiscount(int $discount): void\n {\n $this->discount = ($discount > 0 && $discount <= 50) ? $discount : 0;\n\n }", "public function setDiscount(string $discount)\n\t{\n\t\t$this->addKeyValue('Discount', $discount); \n\n\t}", "public function applyCartDiscount(Varien_Event_Observer $observer)\n { \n try\n { \n $bundle_product_ids = [];\n $quote_product_ids = [];\n $cookieValue = Mage::getModel('core/cookie')->get('ivid');\n $userBundleCollection = Mage::getModel('increasingly_analytics/bundle')->getCollection()->addFieldToFilter('increasingly_visitor_id',$cookieValue);\n $items = $observer->getEvent()->getQuote()->getAllItems();\n $eligibleProducts = [];\n $discount = 0;\n foreach ($items as $item) {\n array_push($quote_product_ids, $item->getProductId());\n }\n foreach ($userBundleCollection as $bundle) {\n //First Bundle products\n $bundle_product_ids = explode(',', $bundle->getProductIds()); \n $productsIds = array_intersect($quote_product_ids, $bundle_product_ids);\n if(count($productsIds) == count($bundle_product_ids) )\n $discount += $bundle->getDiscountPrice();\n }\n\n if($discount > 0){\n $quote=$observer->getEvent()->getQuote();\n $quoteid=$quote->getId();\n $discountAmount=$discount;\n if($quoteid) { \n if($discountAmount>0) {\n $total=$quote->getBaseSubtotal();\n $quote->setSubtotal(0);\n $quote->setBaseSubtotal(0);\n\n $quote->setSubtotalWithDiscount(0);\n $quote->setBaseSubtotalWithDiscount(0);\n\n $quote->setGrandTotal(0);\n $quote->setBaseGrandTotal(0);\n \n\n $canAddItems = $quote->isVirtual()? ('billing') : ('shipping'); \n foreach ($quote->getAllAddresses() as $address) {\n\n $address->setSubtotal(0);\n $address->setBaseSubtotal(0);\n\n $address->setGrandTotal(0);\n $address->setBaseGrandTotal(0);\n\n $address->collectTotals();\n\n $quote->setSubtotal((float) $quote->getSubtotal() + $address->getSubtotal());\n $quote->setBaseSubtotal((float) $quote->getBaseSubtotal() + $address->getBaseSubtotal());\n\n $quote->setSubtotalWithDiscount(\n (float) $quote->getSubtotalWithDiscount() + $address->getSubtotalWithDiscount()\n );\n $quote->setBaseSubtotalWithDiscount(\n (float) $quote->getBaseSubtotalWithDiscount() + $address->getBaseSubtotalWithDiscount()\n );\n\n $quote->setGrandTotal((float) $quote->getGrandTotal() + $address->getGrandTotal());\n $quote->setBaseGrandTotal((float) $quote->getBaseGrandTotal() + $address->getBaseGrandTotal());\n\n $quote ->save(); \n\n $quote->setGrandTotal($quote->getBaseSubtotal()-$discountAmount)\n ->setBaseGrandTotal($quote->getBaseSubtotal()-$discountAmount)\n ->setSubtotalWithDiscount($quote->getBaseSubtotal()-$discountAmount)\n ->setBaseSubtotalWithDiscount($quote->getBaseSubtotal()-$discountAmount)\n ->save(); \n\n\n if($address->getAddressType()==$canAddItems) {\n //echo $address->setDiscountAmount; exit;\n $address->setSubtotalWithDiscount((float) $address->getSubtotalWithDiscount()-$discountAmount);\n $address->setGrandTotal((float) $address->getGrandTotal()-$discountAmount);\n $address->setBaseSubtotalWithDiscount((float) $address->getBaseSubtotalWithDiscount()-$discountAmount);\n $address->setBaseGrandTotal((float) $address->getBaseGrandTotal()-$discountAmount);\n if($address->getDiscountDescription()){\n $address->setDiscountAmount(-($address->getDiscountAmount()-$discountAmount));\n $address->setDiscountDescription($address->getDiscountDescription().', Custom Discount');\n $address->setBaseDiscountAmount(-($address->getBaseDiscountAmount()-$discountAmount));\n }else {\n $address->setDiscountAmount(-($discountAmount));\n $address->setDiscountDescription('Custom Discount');\n $address->setBaseDiscountAmount(-($discountAmount));\n }\n $address->save();\n }//end: if\n } //end: foreach\n //echo $quote->getGrandTotal();\n\n foreach($quote->getAllItems() as $item){\n //We apply discount amount based on the ratio between the GrandTotal and the RowTotal\n $rat=$item->getPriceInclTax()/$total;\n $ratdisc=$discountAmount*$rat;\n $item->setDiscountAmount(($item->getDiscountAmount()+$ratdisc) * $item->getQty());\n $item->setBaseDiscountAmount(($item->getBaseDiscountAmount()+$ratdisc) * $item->getQty())->save(); \n }\n } \n }\n }\n }\n catch(Exception $e)\n {\n Mage::log(\"Remove from cart tracking - \" . $e->getMessage(), null, 'Increasingly_Analytics.log');\n }\n\n }", "protected function calculateDiscount() : void{\r\n $percentage = ($this->discounted_value * 100) / $this->order->getTrueTotal();\r\n $new_total = $this->order->getTrueTotal() - $this->discounted_value;\r\n\r\n $this->order_discount_value = $this->discounted_value;\r\n $this->order_discount_percentage = $percentage;\r\n $this->order_discount_reason = \"For every \" . $this->products_nr . \" products from category #\" . $this->category_id . \" you get one free. You got: \";\r\n foreach($this->items_matching as $item){\r\n $this->order_discount_reason .= floor($item[\"qty\"] / $this->products_nr) . \" x '\" . $item[\"description\"] . \"' (€\". $item[\"price\"] .\" each) ; \";\r\n }\r\n $this->order_new_total = $new_total;\r\n }", "function ycb_add_discount_badge($content, $post, $product){\r\n global $ycb_using_flatsome;\r\n\r\n $ycb_settings = ycb_get_settings();\r\n\r\n //var_dump(get_class_methods($product));\r\n $base_price = $product->get_regular_price();\r\n $discount_price = $product->get_sale_price();\r\n\r\n if($product->is_type( 'variable' )){\r\n $variations = $product->get_available_variations();\r\n if(isset($variations[0])){\r\n $variation = $variations[0];\r\n $base_price = $variation[\"display_regular_price\"];\r\n $discount_price = $variation[\"display_price\"];\r\n }\r\n }\r\n\r\n if(class_exists(\"WC_Dynamic_Pricing\")){\r\n $discount_price = apply_filters(\"woocommerce_product_get_price\", $base_price, $product, false);\r\n }\r\n\r\n $percentage = round( ( ( floatval($base_price) - floatval($discount_price) ) / (floatval($base_price) > 0 ? floatval($base_price) : 1) ) * 100 );\r\n\r\n $sale_style = ycb_get_styles($ycb_settings, $percentage);\r\n $inner_content = \"-\" . $percentage . \"%\";\r\n $filtered_content = apply_filters('ycb_discount_badge_override_hook', $inner_content);\r\n $sale_tag = \"<span class='onsale ycb_on_sale yoohoo_badge \".ycb_get_badge_shape_class(false, $ycb_settings).\"' style='$sale_style'>\" . $filtered_content . \"</span>\";\r\n\r\n $force_remove_internal_tag = apply_filters('ycb_hide_internal_sale_tag', true, $ycb_settings);\r\n if(!$force_remove_internal_tag){\r\n $sale_tag = \"\";\r\n }\r\n\r\n $hide_sale_tag = isset($ycb_settings['ycb_hide_default_sale_tag']) && $ycb_settings['ycb_hide_default_sale_tag'] === \"true\" ? true : false;\r\n\r\n if($hide_sale_tag){\r\n $content = $sale_tag;\r\n } else {\r\n $content .= $sale_tag;\r\n }\r\n\r\n if($percentage > 0){\r\n if($hide_sale_tag){\r\n if($ycb_using_flatsome){\r\n ycb_custom_badge_hide_woo_sales_badge_on_page(true);\r\n $content .= $sale_tag;\r\n } else {\r\n $content = $sale_tag;\r\n }\r\n } else {\r\n $content .= $sale_tag;\r\n }\r\n }\r\n\r\n //$content = apply_filters(\"ycb_discount_badge_internal_filter\", $content, $product, $hide_sale_tag, $ycb_settings);\r\n\r\n return $content;\r\n}", "function pp_edd_auto_apply_discount() {\n\n\tif ( function_exists( 'edd_is_checkout' ) && edd_is_checkout() ) {\n\n\t\tif ( ! edd_cart_has_discounts() && edd_is_discount_valid( 'BFCM2016', '', false ) ) {\n\t\t\tedd_set_cart_discount( 'BFCM2016' );\n\t\t}\n\n\t}\n\n}", "public function testSetGetDiscount()\n {\n $this->item->setPrice(85.00);\n $this->item->setQuantity(1);\n $this->item->addDiscount(\n (new FlatDiscount())\n ->setFigure(15.00)\n );\n\n $this->assertEquals($this->item->getPriceTotal(), 85.00);\n $this->assertEquals($this->item->getNetTotal(), 70.00);\n $this->assertEquals($this->item->getDiscount(), 15.00);\n }", "public function setDiscount(?float $discount): self\n {\n $this->initialized['discount'] = true;\n $this->discount = $discount;\n\n return $this;\n }", "public function setDiscountDescription($description);", "function apply_special_item_discount($id, $count, &$disc_amount) {\r\n switch($id) {\r\n case 99999:\r\n case 99998:\r\n if ($count > 100) {\r\n $disc_amount = 50; \r\n }\r\n break; \r\n case 99997:\r\n $disc_amount = 75;\r\n break; \r\n }\r\n }", "protected function setOfferValue ()\n {\n $this->request->coupon_benefits[ $this->offerNature ] = $this->offer->rate;\n }", "public function setDiscountAmount($amount);", "public function set_credits_discountamount($observer)\n {\n$array2 = Mage::helper('kartparadigm_storecredit')->getCreditRates();\n//Mage::log(Mage::helper('kartparadigm_storecredit')->getRefundDeductConfig() . \" configuration settings \");\n//Mage::log($array2);\n $session = Mage::getSingleton('checkout/session');\n if(Mage::helper('customer')->isLoggedIn()) {\n $customer = Mage::getSingleton('customer/session')->getCustomer();\n $customer_group=Mage::getModel('customer/group')->load(Mage::getSingleton('customer/session')->getCustomerGroupId())->getCustomerGroupCode();\n}\n \n$val1 = Mage::getSingleton('adminhtml/session')->getValue();\nif(isset($val1))\n{\n$amt1 = array();\n$amt1 = Mage::getSingleton('checkout/session')->getCredits();\n$amt = $amt1['totalCredits'];\n$quote = Mage::getSingleton('adminhtml/session_quote')->getQuote();\n}\nelse{\n$amt1 = array();\n $quote = Mage::getModel('checkout/cart')->getQuote();\n$amt1 = Mage::getSingleton('checkout/session')->getCredits();\n$amt = $amt1['discountCredits'];\n}\n $isvirtual=0;\n foreach($quote->getAllItems() as $item){\n if($item->getIsVirtual()==1) {\n $isvirtual=1;\n }\n if(Mage::getModel('catalog/product')->load($item->getProductId())->getTypeId()=='customproduct'){\n $isvirtual=1;\n }\n }\n$total=$quote->getGrandTotal(); \n\n$subTotal = $quote->getSubtotal();\n//Mage::log($quote->getGrandTotal().\"this is grand total store credit\");\n//Mage::log($quote->getSubtotal().\"this is sub total\");\n\n if (!Mage::helper('kartparadigm_storecredit')->getTaxEnabled()){\n$tax = $quote->getShippingAddress()->getData('tax_amount');\n}\n if(!Mage::helper('kartparadigm_storecredit')->getIsShippingEnabled()){\n$shippingPrice = $quote->getShippingAddress()->getShippingAmount();\n}\n$totalCredits1 = array();\n$totalCredits1 = Mage::getSingleton('checkout/session')->getCredits();\n$totalCredits = $totalCredits1['totalCredits'];\n\n$currentTimestamp = Mage::getModel('core/date')->timestamp(time()); \n$nowdate = date('Y-m-d H:m:s', $currentTimestamp); \n//echo $expirydate;\n//echo $nowdate;\n$balance;\n//echo $amt;\n$amt2;\n $amt1;\n \n\nif(isset($amt)){\n/*---------------------Calculating Default Currency Value----------------------- */\n$amt1 = ($array2['basevalue'] * $amt) / $array2['credits'];\n $baseCurrencyCode = Mage::app()->getStore()->getBaseCurrencyCode();\n $currentCurrencyCode = Mage::app()->getStore()->getCurrentCurrencyCode();\n if ($baseCurrencyCode != $currentCurrencyCode) {\n $amt2 = Mage::helper('directory')->currencyConvert($amt1, $baseCurrencyCode, $currentCurrencyCode);\n }\n else{\n $amt2 = $amt1; \n }\n // $amt2 = Mage::helper('core')->currency($amt1, true, false);\n//Mage::log($amt1.\" = amount = \".$amt2 );\n//----------------------------------------------------------------\nif($total > $amt2) {\nif(($total - $tax - $shippingPrice) > $amt2){\n$discountAmount = $amt2;\n$balance = $totalCredits - $amt;\n}else{\n $discountAmount = $subTotal;\n$points = round(($discountAmount * $amt)/$amt2);\n//Mage::log($points.\"Conver Points\");\n$balance = $totalCredits - $points;\n}\n}\nelse {\n$discountAmount = $total - $tax - $shippingPrice;\n$points = round(($discountAmount * $amt)/$amt2);\n//Mage::log($points.\"Conver Points\");\n$balance = $totalCredits - $points;\n}\nMage::getSingleton('core/session')->setBalance($balance);\n\nMage::getSingleton('checkout/session')->setDiscount($totalCredits - $balance);\n$msg = \"Current Credits In Your Account : \" . $balance;\nMage::getSingleton('core/session')->setCredits($msg);\n if ($discountAmount > 0) {\n\n\nif ($baseCurrencyCode != $currentCurrencyCode) {\n \n$allowedCurrencies = Mage::getModel('directory/currency')->getConfigAllowCurrencies();\n$rates = Mage::getModel('directory/currency')->getCurrencyRates($baseCurrencyCode, array_values($allowedCurrencies));\n\n$baseDiscount = $discountAmount/$rates[$currentCurrencyCode];\n\n }\nelse{\n $baseDiscount = $discountAmount;\n } \n $total = $quote->getBaseSubtotal();\n $data1 = $quote->getData();\n // Mage::log($data1['entity_id'].\"quote id\");\n $quote->setSubtotal(0);\n $quote->setBaseSubtotal(0);\n $quote->setSubtotalWithDiscount(0);\n $quote->setBaseSubtotalWithDiscount(0);\n $quote->setGrandTotal(0);\n $quote->setBaseGrandTotal(0);\n $canAddItems = $quote->isVirtual() ? ('billing') : ('shipping');\n foreach($quote->getAllAddresses() as $address) {\n $data = $address->getData();\n $address->setSubtotal(0);\n $address->setBaseSubtotal(0);\n $address->setGrandTotal(0);\n $address->setBaseGrandTotal(0);\n $address->collectTotals();\n $quote->setSubtotal((float)$quote->getSubtotal() + $address->getSubtotal());\n $quote->setBaseSubtotal((float)$quote->getBaseSubtotal() + $address->getBaseSubtotal());\n $quote->setSubtotalWithDiscount((float)$quote->getSubtotalWithDiscount() + $address->getSubtotalWithDiscount());\n $quote->setBaseSubtotalWithDiscount((float)$quote->getBaseSubtotalWithDiscount() + $address->getBaseSubtotalWithDiscount());\n $quote->setGrandTotal((float)$quote->getGrandTotal() + $address->getGrandTotal());\n $quote->setBaseGrandTotal((float)$quote->getBaseGrandTotal() + $address->getBaseGrandTotal());\n $quote->setEntityId($data1['entity_id'])->save();\n $quote->setSubtotalWithDiscount($quote->getSubtotal() - $discountAmount)->setBaseSubtotalWithDiscount($quote->getBaseSubtotal() - $baseDiscount)->setEntityId($data1['entity_id'])->save();\n if ($address->getAddressType() == $canAddItems) {\n $address->setSubtotalWithDiscount((float)$data['subtotal_with_discount'] - $discountAmount);\n $address->setGrandTotal((float)$data['grand_total'] - $discountAmount);\n $address->setBaseSubtotalWithDiscount((float)$data['base_subtotal_with_discount'] - $baseDiscount);\n $address->setBaseGrandTotal((float)$data['base_grand_total'] - $baseDiscount);\n if ($data['discount_description']) {\n $address->setDiscountAmount(($data['discount_amount'] - $discountAmount));\n $address->setDiscountDescription($data['discount_description'] . ', Store Credits');\n $address->setBaseDiscountAmount(($data['base_discount_amount'] - $baseDiscount));\n }\n else {\n $address->setDiscountAmount(-($discountAmount));\n $address->setDiscountDescription('Store Credits');\n $address->setBaseDiscountAmount(-($baseDiscount));\n }\n $address->setAddressId($data['address_id'])->save();\n }\n }\n foreach($quote->getAllItems() as $item) {\n\n // We apply discount amount based on the ratio between the GrandTotal and the RowTotal\n $rat = $item->getPriceInclTax() / $quote->getSubtotal();\n $rat1 = $item->getBasePriceInclTax() / $quote->getBaseSubtotal();\n $ratdisc = $discountAmount * $rat;\n $ratdisc1 = $baseDiscount * $rat1;\n//Mage::log($item->getDiscountAmount().\"include tax\".$item->getBaseDiscountAmount());\n // Mage::log($item->getDiscountAmount().\"discount storecredit\");\n$idata = $item->getData();\n Mage::log($item->getDiscountAmount().\"discount amount credit\");\n $item->setDiscountAmount(($item->getDiscountAmount() + $ratdisc) * $item->getQty());\n $item->setBaseDiscountAmount(($item->getBaseDiscountAmount() + $ratdisc1) * $item->getQty())->save();\n }\n }else if($totalCredits == 0){\n\n$msg = \"Sorry You Have No Credits In Your Account\";\nMage::getSingleton('core/session')->setCredits($msg);\n}\n \n \n } \n }", "public function discountBifurcation(Varien_Event_Observer $observer)\n {\n $rule = $observer->getEvent()->getRule();\n $result = $observer->getEvent()->getResult();\n $itemId = $observer->getEvent()->getItem()->getItemId();\n //set Unique key\n $curUnique= $rule->getRuleId().'_'.$itemId;\n //check if Mage registry unique call set\n if(Mage::registry('uniqueCall')!==null){\n //if check in array\n $uniqueCalls = Mage::registry('uniqueCall');\n if( in_array($curUnique,$uniqueCalls)){\n return;\n }else{\n //unset existing registry. also take existing array in variable\n Mage::unregister('uniqueCall');\n $uniqueCalls[]= $curUnique ;\n //set registry again with new array include $uniqueCall into it\n Mage::register('uniqueCall',$uniqueCalls);\n }\n }else{\n //set registry again with new array include $uniqueCall into it\n $array = array();\n $array[]=$rule->getRuleId().'_'.$itemId;\n Mage::register('uniqueCall',$array);\n\n } \n\n //condition for the Promotional coupons\n if ( $rule->getCouponType() == Mage_SalesRule_Model_Rule::COUPON_TYPE_NO_COUPON ) {\n $promotionDiscount = 0;\n $promotionDiscount = Mage::registry('promotion');\n if (Mage::registry('promotion')!==null){\n Mage::unregister('promotion');\n }\n if (Mage::registry('promo_lable')!==null){\n Mage::unregister('promo_lable');\n }\n $promotionDiscount += $result->getDiscountAmount();\n Mage::register('promotion', $promotionDiscount);\n Mage::register('promo_lable',$rule->getName());\n } elseif ( $rule->getCouponType() == self::COUPON_TYPE_FUE_GENERATED ) {\n $couponDiscount = 0;\n $couponDiscount = Mage::registry('coupon');\n if(Mage::registry('coupon')!==null){\n Mage::unregister('coupon');\n }\n //sum up all the values of discounted coupons\n $couponDiscount += $result->getDiscountAmount();\n Mage::register('coupon',$couponDiscount);\n }\n $quote = $observer->getEvent()->getQuote();\n $quoteAddress = $observer->getEvent()->getAddress();\n //set discounted coupons and promotional coupons amount in quote\n $quote->setCouponDiscount(Mage::registry('coupon'));\n $quote->setPromotionalDiscount(Mage::registry('promotion'));\n\n if (Mage::getStoreConfig('promodiscount/promodiscount/use_default')) {\n $quote->setPromoLable(Mage::getStoreConfig('promodiscount/promodiscount/default_lable'));\n } else {\n if (Mage::registry('promo_lable')) {\n $quote->setPromoLable(Mage::registry('promo_lable'));\n } else {\n $quote->setPromoLable(Mage::getStoreConfig('promodiscount/promodiscount/default_lable'));\n }\n }\n \n $quoteAddress->setCouponDiscount(Mage::registry('coupon'));\n $quoteAddress->setPromotionalDiscount(Mage::registry('promotion'));\n if (Mage::registry('promo_lable')) {\n $quoteAddress->setPromoLable(Mage::registry('promo_lable'));\n } else {\n $quoteAddress->setPromoLable(Mage::getStoreConfig('promodiscount/promodiscount/default_lable'));\n }\n }", "function es_cart_change_coupon_label( $html , $coupon){\n\n$html='Discount:';\n\nreturn $html;\n\n}", "function setPrice($new_price)\n {\n $this->price = $new_price;\n }", "public function set_manual_discount($discount_data = FALSE)\r\n\t{\r\n\t\tif (is_array($discount_data) && ! empty($discount_data))\r\n\t\t{\r\n\t\t\t// Check that any submitted 'New value' discounts are only applied to the shipping total. \r\n\t\t\tif (isset($discount_data['column']) && isset($discount_data['calculation']) && ($discount_data['column'] != 'shipping_total') && ($discount_data['calculation'] == 3))\r\n\t\t\t{\r\n\t\t\t\treturn FALSE;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t// Merge the code and manual discounts together, then loop through data and compile an array of all discount ids currently in use.\r\n\t\t\t$existing_discounts = array_merge($this->flexi->cart_contents['settings']['discounts']['manual'], $this->flexi->cart_contents['settings']['discounts']['codes']);\r\n\t\t\t$existing_ids = array();\r\n\t\t\t\t\r\n\t\t\tforeach($existing_discounts as $existing_discount)\r\n\t\t\t{\r\n\t\t\t\t$existing_ids[] = $existing_discount['id'];\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t// If an id is not set in the submitted '$discount_data', or if a discount with a matching id already exists, set a new id. \r\n\t\t\tif (! isset($discount_data['id']) || in_array($discount_data['id'], $existing_ids))\r\n\t\t\t{\r\n\t\t\t\t$id = 0;\r\n\t\t\t\twhile (in_array('manual_'.$id, $existing_ids))\r\n\t\t\t\t{\r\n\t\t\t\t\t$id++; \r\n\t\t\t\t}\r\n\t\t\t\t$id = $discount_data['id'] = 'manual_'.$id;\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\t$id = $discount_data['id'];\r\n\t\t\t}\r\n\t\t\r\n\t\t\t// Set default values if not submitted.\r\n\t\t\t$discount_data['description'] = (! isset($discount_data['description'])) ? FALSE : $discount_data['description'];\r\n\t\t\t$discount_data['value'] = (! isset($discount_data['value'])) ? 0 : $discount_data['value'];\r\n\t\t\t$discount_data['column'] = (! isset($discount_data['column'])) ? 'total' : $discount_data['column'];\r\n\t\t\t$discount_data['calculation'] = (! isset($discount_data['calculation'])) ? 1 : $discount_data['calculation'];\r\n\t\t\t$discount_data['tax_method'] = (! isset($discount_data['tax_method'])) ? FALSE : $discount_data['tax_method'];\r\n\t\t\t$discount_data['void_reward_points'] = (! isset($discount_data['void_reward_points'])) ? FALSE : $discount_data['void_reward_points'];\r\n\t\t\t\r\n\t\t\t// Set the cart column the discount is targeting and use the value to act as the discounts array key. \r\n\t\t\t// This prevents multiple discounts being applied to the same cart column.\r\n\t\t\t$target_column = $discount_data['column'];\r\n\t\t\t\r\n\t\t\t// Loop through data and set to cart session summary.\r\n\t\t\tforeach($discount_data as $column => $column_value)\r\n\t\t\t{\r\n\t\t\t\tif ($column == 'value')\r\n\t\t\t\t{\r\n\t\t\t\t\t// If a valid discount value is not set, set the default value as zero. \r\n\t\t\t\t\t$column_value = ($this->non_negative($column_value)) ? $this->format_calculation($column_value, 2, TRUE) : 0;\r\n\t\t\t\t}\r\n\t\t\t\telse if ($column == 'column')\r\n\t\t\t\t{\r\n\t\t\t\t\t// If a valid column is not set, discount the 'total' column by default. \r\n\t\t\t\t\t$column_value = (in_array($column_value, array('item_summary_total', 'shipping_total', 'total'))) ? $column_value : 'total';\r\n\t\t\t\t}\r\n\t\t\t\telse if ($column == 'calculation') \r\n\t\t\t\t{\r\n\t\t\t\t\t// If a valid calculation method is not set, a 'percentage' based calculation is set by default.\r\n\t\t\t\t\t// 1 = Percentage Based, 2 = Flat Fee, 3 = New Value.\r\n\t\t\t\t\t$column_value = (in_array($column_value, array(1,2,3))) ? $column_value : 1;\r\n\t\t\t\t}\r\n\t\t\t\telse if ($column == 'tax_method')\r\n\t\t\t\t{\r\n\t\t\t\t\t// If a valid tax method is not set, the tax method is defined by whether cart prices ex/include taxes by default.\r\n\t\t\t\t\t// 0 = Carts Default Tax Method, 1 = Apply Tax Before Discount, 2 = Apply Discount Before Tax, 3 = Apply Discount Before Tax, Add Original Tax.\r\n\t\t\t\t\t$column_value = (in_array($column_value, array(0, 1,2,3))) ? $column_value : 0;\r\n\t\t\t\t}\r\n\t\t\t\telse if ($column == 'void_reward_points')\r\n\t\t\t\t{\r\n\t\t\t\t\t$column_value = (bool)$column_value;\r\n\t\t\t\t}\r\n\t\t\t\telse if (! in_array($column, array('id', 'description')))\r\n\t\t\t\t{\r\n\t\t\t\t\tcontinue;\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\t$this->flexi->cart_contents['settings']['discounts']['manual'][$target_column][$column] = $column_value;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\treturn TRUE;\r\n\t\t}\r\n\t\t\r\n\t\treturn FALSE;\r\n\t}", "public function setDiscount($discount)\r\n {\r\n $this->discount = $discount;\r\n\r\n return $this;\r\n }", "public function Mytestmethod( $observer )\n {\n $item = $observer->getQuoteItem();\n $qty = $item->getQty();\n $productId = $item->getProductId();\n $helper = Mage::helper( 'catalog/product_configuration' );\n $productModel = Mage::getModel( 'catalog/product' );\n //$attr = $productModel->getResource()->getAttribute('Size');\n $maal = $helper->getOptions( $item );\n $attribute_model = Mage::getModel( 'eav/entity_attribute' );\n $superAttr = array();\n $options = array();\n //Mage::log('all options');\n //Mage::log($item->getItemId());\n\n foreach( $maal as $key ) {\n $count = count( $key );\n if( $count < 2 ) {\n //Mage::log( 'fucker' );\n }\n if( $count > 2 ) {\n $labelcode = $key['option_id'];\n $valuecode = $key['value'];\n //$arr =$arrayName = array( $labelcode =>$valuecode);\n //array_push($superAttr,$arr);\n $options[$labelcode] = $valuecode;\n } else {\n $label = $key['label'];\n $labelcode = $attribute_model->getIdByCode( 'catalog_product', $label );\n $value = $key['value'];\n $attr = $productModel->getResource()->getAttribute( $label );\n if( $attr->usesSource() ) {\n $valuecode = $attr->getSource()->getOptionId( $value );\n //$arr =$arrayName = array( $labelcode =>$valuecode);\n //array_push($options,$arr);\n $superAttr[$labelcode] = $valuecode;\n }\n }\n }\n $final = array(\n 'super_attribute' => $superAttr,\n 'options' => $options \n );\n $final2 = http_build_query( $final );\n $coup = Mage::helper( 'webengage_coup' )->couponPost();\n $final3 = 'qty=' . $qty . '&' . 'product=' . $productId . '&' . $final2;\n //$attr = $productModel->getResource()->getAttribute('Test Custom Options');\n //$valuecode = $attr->getSource()->getOptionId('model 2');\n ////Mage::log($valuecode);\n $_SESSION['raku'] = $final3 . '&coup=' . $coup;\n }", "public function setPromotion($first,$second)\n {\n $this->promotion->setPromotion($first,$second);\n //product Id for identify products\n $this->promotion->setProductId($this->id);\n }", "public function setShippingDiscountAmount($amount);", "function wpsp_tour_price( $price, $is_promote = false, $percentage ) {\n \n if ( empty( $price ) ) \n return;\n\n $regular_price = $price;\n printf( '<span class=\"label\">%s</span>', esc_html__( 'Per person', 'discovertravel' ) );\n \n if ( $is_promote == 'on' ) {\n \t$discount_price = ($regular_price / 100) * $percentage;\n \t$sale_price = $regular_price - $discount_price;\n \tprintf('<del><span class=\"amount\"><sup>$</sup>%1$s</span></del><ins><span class=\"on-sale\">%2$s</span></ins><ins><span class=\"amount\"><sup>$</sup>%3$s</span></ins>', \n \t\t\t$regular_price,\n \t\t\t$percentage . esc_html__( '% Off', 'discovertravel' ),\n \t\t\t$sale_price\n \t\t);\n } else {\n \tprintf('<ins><span class=\"amount\"><sup>$</sup>%1$s</span></ins>', \n \t\t\t$regular_price\n \t\t);\n }\n}", "public function setDiscountUid(?string $discountUid): void\n {\n $this->discountUid = $discountUid;\n }", "public function define_dish_price() {\n\t\t\t$res = $this->Restaurant_model->define_price();\n\t\t\tif($res == 'suc_def') {\n\t\t\t\techo 'suc_def';\n\t\t\t}\n\t\t}", "public function setDiscountAmount($value){\n return $this->setParameter('discount_amount', $value);\n }", "public function apply()\n {\n /** @var EavSetup $eavSetup */\n $eavSetup = $this->eavSetupFactory->create(['setup' => $this->moduleDataSetup]);\n\n if (!$eavSetup->getAttribute(Product::ENTITY, 'am_shipping_type')) {\n $eavSetup->addAttribute(\n Product::ENTITY,\n 'am_shipping_type',\n [\n 'type' => 'varchar',\n 'backend' => '',\n 'frontend' => '',\n 'label' => 'Shipping Type',\n 'input' => 'select',\n 'class' => '',\n 'source' => '',\n 'global' => ScopedAttributeInterface::SCOPE_STORE,\n 'visible' => true,\n 'required' => false,\n 'user_defined' => false,\n 'default' => 0,\n 'searchable' => false,\n 'filterable' => false,\n 'comparable' => false,\n 'visible_on_front' => false,\n 'used_in_product_listing' => true,\n 'unique' => false,\n 'apply_to' => ''\n ]\n );\n }\n }", "public function setDiscountAttribute($val)\n {\n return (int)$this->attributes['discount'] = $val;\n }", "private function setPremiumCode(){\n for($i = 0; $i < 7; $i++) {\n $this->premiumCode .= rand(1,9);\n };\n $this->discount = 10;\n }", "function setPrice($price, $taxPercentage = 25)\n {\n $this->taxPercentage = $taxPercentage;\n $this->taxA = $price / 100 * 100;\n $this->price = $price;\n }", "public function setAttributes_discounted( $attributes_discounted ) {\n\t\t$this->attributes_discounted = $attributes_discounted;\n\t}", "public function setDiscountRate($value){\n return $this->setParameter('discount_rate', $value);\n }", "public function setDiscount($var)\n {\n GPBUtil::checkDouble($var);\n $this->discount = $var;\n\n return $this;\n }", "public function updateProduct()\n {\n \t$quote=$this->getQuote();\n \tif($quote)\n \t{\n \t\t$detailproduct=$this->getProduct();\n \t\t$quoteproduct=$quote->getProduct();\n \t\tif(\n\t\t\t\t$quote->getPrice()!=$this->getPrice() or\n\t\t\t\t$quote->getDiscrate()!=$this->getDiscrate() or\n\t\t\t\t$quote->getDiscamt()!=$this->getDiscamt() or\n\t\t\t\t$quote->getProductId()!=$this->getProductId()\n\t\t\t)\n\t\t\t{\n\t\t\t\t$quote->setPrice($this->getPrice());\n\t\t\t\t$quote->setDiscrate($this->getDiscrate());\n\t\t\t\t$quote->setDiscamt($this->getDiscamt());\n\t\t\t\t$quote->setProductId($this->getProductId());\n\t\t\t\t$quote->calc(); //auto save\n\t\t\t\t$detailproduct->calcSalePrices();\n\t\t\t\t\n\t\t\t\t//if product changed, calc old product\n\t\t\t\tif($quoteproduct->getId()!=$detailproduct->getId())\n\t\t\t\t\t$quoteproduct->calcSalePrices();\n\t\t\t}\n \t}\n \telse\n \t{\n\t\t\t//if none, see if product quote by vendor with similar pricing exists. \n\t\t\t$quote=Fetcher::fetchOne(\"Quote\",array('total'=>$this->getUnittotal(),'vendor_id'=>SettingsTable::fetch(\"me_vendor_id\"),'product_id'=>$this->getProductId()));\n\n\t\t\t//if it doesn't exist, create it, and product->calc()\n\t\t\tif(!$quote)\n\t\t\t{\n\t\t\t\tQuoteTable::createOne(array(\n\t\t\t\t\t'date'=>$this->getInvoice()->getDate(),\n\t\t\t\t\t'price'=>$this->getPrice(),\n\t\t\t\t\t'discrate'=>$this->getDiscrate(),\n\t\t\t\t\t'discamt'=>$this->getDiscamt(),\n\t\t\t\t\t'vendor_id'=>SettingsTable::fetch(\"me_vendor_id\"),\n\t\t\t\t\t'product_id'=>$this->getProductId(),\n\t\t\t\t\t'ref_class'=>\"Invoicedetail\",\n\t\t\t\t\t'ref_id'=>$this->getId(),\n\t\t\t\t\t'mine'=>1,\n\t\t\t\t\t));\n\t\t\t\t$this->getProduct()->calcSalePrices();\n\t\t\t}\n \t}\n }", "function atcf_theme_custom_variable_pricing() {\n\tif ( ! current_theme_supports( 'appthemer-crowdfunding' ) )\n\t\treturn;\n\n\tadd_action( 'init', 'atcf_theme_variable_pricing' );\n}", "public function setDiscountPercent(?string $value): void {\n $this->getBackingStore()->set('discountPercent', $value);\n }", "function es_set_sale_price( $price, $product ) {\n\t\n\t$exclude_skus = array( 'COEBRCE', 'COEPOSTER', 'PUB41' );\n\t$exclude_cats = array( 'specials', 'clearance' );\n\t$date_now = new DateTime();\n\t$start_dtm = new DateTime( '2016-10-03' );\n\t$end_dtm = new DateTime( '2016-10-11' );\n\t\n\t// exclude SKUs\n\tif ( in_array( $product->sku, $exclude_skus ) )\n\t\treturn $price;\n\t\n\t// exclude specials category\n\t$product_cat = wp_get_post_terms( $product->id, 'product_cat' );\n\t\n\tforeach ( $product_cat as $term ){\n\t\tif( in_array( $term->slug, $exclude_cats ) ){\n\t\t\treturn $price;\n\t\t}\n\t}\t\n\t\n\tif ( ! $product->is_virtual() AND ( $date_now >= $start_dtm AND $date_now <= $end_dtm ) ) {\n\t\t$member_exists = es_check_membership_held();\n\t\t$member_price = get_post_meta($product->id, 'member_price', true);\n\t\t$price = $product->get_regular_price() * ( 0.9 );\n\t\t\n\t\tif ( ! empty( $member_price ) AND $member_exists ) {\n\t\t\t$product->set_price( $member_price );\n\t\t\t$product->sale_price = $price;\n\t\t\t$price = $member_price;\t\t\n\t\t}\n\t\telse {\n\t\t\t$product->set_price( $price );\n\t\t\t$product->sale_price = $price;\t\n\t\t}\n\t\t\n\t}\n\t\n\treturn $price;\n}", "public function getTonicDiscount()\n {\n }", "private function setRecountProduct() {\n\n //$this->model->setDocumentNumber($this->getDocumentNumber);\n $sql = null;\n if ($this->getVendor() == self::MYSQL) {\n $sql = \"\n INSERT INTO `productrecount` \n (\n `companyId`,\n `warehouseId`,\n `productCode`,\n `productDescription`,\n `productRecountDate`,\n `productRecountSystemQuantity`,\n `productRecountPhysicalQuantity`,\n `isDefault`,\n `isNew`,\n `isDraft`,\n `isUpdate`,\n `isDelete`,\n `isActive`,\n `isApproved`,\n `isReview`,\n `isPost`,\n `executeBy`,\n `executeTime`\n ) VALUES ( \n '\" . $this->getCompanyId() . \"',\n '\" . $this->model->getWarehouseId() . \"',\n '\" . $this->model->getProductCode() . \"',\n '\" . $this->model->getProductDescription() . \"',\n '\" . $this->model->getProductRecountDate() . \"',\n '\" . $this->model->getProductRecountSystemQuantity() . \"',\n '\" . $this->model->getProductRecountPhysicalQuantity() . \"',\n '\" . $this->model->getIsDefault(0, 'single') . \"',\n '\" . $this->model->getIsNew(0, 'single') . \"',\n '\" . $this->model->getIsDraft(0, 'single') . \"',\n '\" . $this->model->getIsUpdate(0, 'single') . \"',\n '\" . $this->model->getIsDelete(0, 'single') . \"',\n '\" . $this->model->getIsActive(0, 'single') . \"',\n '\" . $this->model->getIsApproved(0, 'single') . \"',\n '\" . $this->model->getIsReview(0, 'single') . \"',\n '\" . $this->model->getIsPost(0, 'single') . \"',\n '\" . $this->model->getExecuteBy() . \"',\n \" . $this->model->getExecuteTime() . \"\n );\";\n } else {\n if ($this->getVendor() == self::MSSQL) {\n $sql = \"\n INSERT INTO [productRecount]\n (\n [productRecountId],\n [companyId],\n [warehouseId],\n [productCode],\n [productDescription],\n [productRecountDate],\n [productRecountSystemQuantity],\n [productRecountPhysicalQuantity],\n [isDefault],\n [isNew],\n [isDraft],\n [isUpdate],\n [isDelete],\n [isActive],\n [isApproved],\n [isReview],\n [isPost],\n [executeBy],\n [executeTime]\n) VALUES (\n '\" . $this->getCompanyId() . \"',\n '\" . $this->model->getWarehouseId() . \"',\n '\" . $this->model->getProductCode() . \"',\n '\" . $this->model->getProductDescription() . \"',\n '\" . $this->model->getProductRecountDate() . \"',\n '\" . $this->model->getProductRecountSystemQuantity() . \"',\n '\" . $this->model->getProductRecountPhysicalQuantity() . \"',\n '\" . $this->model->getIsDefault(0, 'single') . \"',\n '\" . $this->model->getIsNew(0, 'single') . \"',\n '\" . $this->model->getIsDraft(0, 'single') . \"',\n '\" . $this->model->getIsUpdate(0, 'single') . \"',\n '\" . $this->model->getIsDelete(0, 'single') . \"',\n '\" . $this->model->getIsActive(0, 'single') . \"',\n '\" . $this->model->getIsApproved(0, 'single') . \"',\n '\" . $this->model->getIsReview(0, 'single') . \"',\n '\" . $this->model->getIsPost(0, 'single') . \"',\n '\" . $this->model->getExecuteBy() . \"',\n \" . $this->model->getExecuteTime() . \"\n );\";\n } else {\n if ($this->getVendor() == self::ORACLE) {\n $sql = \"\n INSERT INTO PRODUCTRECOUNT\n (\n COMPANYID,\n WAREHOUSEID,\n PRODUCTCODE,\n PRODUCTDESCRIPTION,\n PRODUCTRECOUNTDATE,\n PRODUCTRECOUNTSYSTEMQUANTITY,\n PRODUCTRECOUNTPHYSICALQUANTITY,\n ISDEFAULT,\n ISNEW,\n ISDRAFT,\n ISUPDATE,\n ISDELETE,\n ISACTIVE,\n ISAPPROVED,\n ISREVIEW,\n ISPOST,\n EXECUTEBY,\n EXECUTETIME\n ) VALUES (\n '\" . $this->getCompanyId() . \"',\n '\" . $this->model->getWarehouseId() . \"',\n '\" . $this->model->getProductCode() . \"',\n '\" . $this->model->getProductDescription() . \"',\n '\" . $this->model->getProductRecountDate() . \"',\n '\" . $this->model->getProductRecountSystemQuantity() . \"',\n '\" . $this->model->getProductRecountPhysicalQuantity() . \"',\n '\" . $this->model->getIsDefault(0, 'single') . \"',\n '\" . $this->model->getIsNew(0, 'single') . \"',\n '\" . $this->model->getIsDraft(0, 'single') . \"',\n '\" . $this->model->getIsUpdate(0, 'single') . \"',\n '\" . $this->model->getIsDelete(0, 'single') . \"',\n '\" . $this->model->getIsActive(0, 'single') . \"',\n '\" . $this->model->getIsApproved(0, 'single') . \"',\n '\" . $this->model->getIsReview(0, 'single') . \"',\n '\" . $this->model->getIsPost(0, 'single') . \"',\n '\" . $this->model->getExecuteBy() . \"',\n \" . $this->model->getExecuteTime() . \"\n );\";\n }\n }\n }\n try {\n $this->q->create($sql);\n } catch (\\Exception $e) {\n $this->q->rollback();\n echo json_encode(array(\"success\" => false, \"message\" => $e->getMessage()));\n exit();\n }\n }", "public function setDocumentProductDiscount(float $document_product_discount)\n {\n $this->collection->put('document_product_discount', (string) $document_product_discount);\n }", "protected function setProductivity()\n {\n $this->productivity = random_int(8, 12);\n }", "function discountvoucherpurchase_civicrm_postProcess($formName, &$form ) {\n if($formName == 'CRM_Contribute_Form_Contribution_Confirm' && isset($form->_id) && $form->_id == 24){\n $params = array(\n 'code' => $form->_params['contactID'] . '-' . $form->_params['contributionID'],\n 'description' => 'gift from ' . $form->_params['email-5'],\n 'amount' => 100,\n 'amount_type' => 1,\n 'count_max' => 1,\n 'memberships'=> array(7,22),\n 'version' => 3,\n 'multi_valued' => array('memberships' => 1),\n );\n $code = civicrm_api('DiscountCode', 'create', $params);\n }\n}", "function calc_extra_sp_cost($Discount = 1){\r\n\t$list = array('D','E','A');\r\n\tforeach($list as $v){\r\n\t\tif(preg_match('/CostSP<([0-9]+)>/',$this->Eq[$v]['spec'],$array)){\r\n\t\t\t$a = intval($array[1]);\r\n\t\t\t$this->SP_Cost += ceil($a * $Discount);\r\n\t\t}\r\n\t}\r\n}", "function apply_special_category_discount($category, $count, &$disc_amount) {\r\n switch($category) {\r\n case 99999:\r\n case 99998:\r\n if ($count > 100) {\r\n $disc_amount = 50; \r\n }\r\n break; \r\n case 99997:\r\n $disc_amount = 75;\r\n break;\r\n }\r\n }", "function pricing() {\n\t\t\tparent::controller();\n\t\t\t\n\t\t}", "public function deleteDiscount();", "public function updatePercentage(Discount $discount)\n {\n }", "function ycb_custom_badge_shop_loop_opened(){\r\n if(class_exists(\"WC_Product_Factory\")){\r\n $_pf = new WC_Product_Factory();\r\n $product = $_pf->get_product(get_the_ID());\r\n\r\n $base_price = $product->get_regular_price();\r\n $discount_price = $product->get_sale_price();\r\n\r\n if($product->is_type( 'variable' )){\r\n $variations = $product->get_available_variations();\r\n if(isset($variations[0])){\r\n $variation = $variations[0];\r\n $base_price = $variation[\"display_regular_price\"];\r\n $discount_price = $variation[\"display_price\"];\r\n }\r\n }\r\n\r\n if(class_exists(\"WC_Dynamic_Pricing\")){\r\n $discount_price = apply_filters(\"woocommerce_product_get_price\", $base_price, $product, false);\r\n }\r\n\r\n $is_on_sale = true;\r\n if(!isset($discount_price) || floatval($base_price) === floatval($discount_price)){\r\n $is_on_sale = false;\r\n }\r\n\r\n $ycb_settings = ycb_get_settings();\r\n $hide_sale_tag = isset($ycb_settings['ycb_hide_default_sale_tag']) && $ycb_settings['ycb_hide_default_sale_tag'] === \"true\" ? true : false;\r\n\r\n $hide_sale_tag = $is_on_sale !== false ? $hide_sale_tag : false;\r\n\r\n $is_on_sale = apply_filters('ycb_hide_internal_sale_tag', $is_on_sale, $ycb_settings);\r\n\r\n $addition = apply_filters(\"ycb_discount_badge_internal_filter\", \"\", $product, $hide_sale_tag, $ycb_settings, $is_on_sale);\r\n\r\n echo $addition;\r\n }\r\n}", "function updateTest()\n {\n $this->cD->updateElement(new Product(1, \"Trang\"));\n }", "public function setPriceAttribute($value)\n {\n $this->attributes['price'] = $value*100;\n }", "function es_save_custom_quickedit_product( $product ) {\n\tif ( isset( $_REQUEST['member_price'] ) AND ! empty( $_REQUEST['member_price'] ) ) {\n\t\tupdate_post_meta( $product->id, 'member_price', wc_clean( $_REQUEST['member_price'] ) );\n\t}\n\telse \n\t\tdelete_post_meta( $product->id, 'member_price' );\n}", "public static function update_item_with_discount($detail_id,$order_promotion,$order_discount_id,$order_discount_amt){\r\tif(is_gt_zero_num($detail_id)){\r\t\t$objtbl_order_details=new tbl_order_details();\r\t\tif($objtbl_order_details->readObject(array(ORD_DTL_ID=>$detail_id))){\r\t\t\t$objtbl_order_details->setordprom_promotion($order_promotion);\r\t\t\t$objtbl_order_details->setordprom_discount_id($order_discount_id);\r\t\t\t$objtbl_order_details->setordprom_discount_amt($order_discount_amt);\r\t\t\t$objtbl_order_details->insert();\r\t\t\treturn 1;\r\t\t}\r\t\tunset($objtbl_order_details);\t\r\t} \r\treturn 0;\t\r }", "public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context){\n if ($context->getVersion() && version_compare($context->getVersion(), '1.0.1', '<')) {\n $this->eavSetup->addAttribute(\n \\Magento\\Catalog\\Model\\Product::ENTITY,\n 'is_ocean',\n [\n 'input' => 'boolean',\n 'type' => 'int',\n 'label' => 'Is Ocean Product',\n 'visible' => false,\n 'required' => false,\n 'is_used_in_grid' => true,\n 'is_visible_in_grid' => true,\n 'is_filterable_in_grid' => true,\n 'user_defined' => false,\n 'searchable' => false,\n 'filterable' => false,\n 'comparable' => false,\n 'visible_on_front' => false,\n 'visible_in_advanced_search' => false,\n 'is_html_allowed_on_front' => false,\n 'used_for_promo_rules' => true,\n 'source' => \\Magento\\Eav\\Model\\Entity\\Attribute\\Source\\Boolean::class,\n 'default' => \\Magento\\Eav\\Model\\Entity\\Attribute\\Source\\Boolean::VALUE_NO,\n 'global' => \\Magento\\Eav\\Model\\Entity\\Attribute\\ScopedAttributeInterface::SCOPE_GLOBAL,\n 'unique' => false,\n 'apply_to' => 'simple,grouped,configurable,downloadable,virtual,bundle,aw_giftcard'\n ]\n );\n }\n /* Update default value to 0 (NO), begin version 1.0.4 can remove this code */\n if ($context->getVersion() && version_compare($context->getVersion(), '1.0.3', '<')) {\n $attributeId = $this->eavSetup->getAttributeId(\\Magento\\Catalog\\Model\\Product::ENTITY, 'is_ocean');\n $this->eavSetup->updateAttribute(\n \\Magento\\Catalog\\Model\\Product::ENTITY,\n $attributeId,\n array(\n 'default_value' => \\Magento\\Eav\\Model\\Entity\\Attribute\\Source\\Boolean::VALUE_NO,\n 'is_visible' => false,\n 'is_required' => false,\n 'frontend_input' => 'boolean',\n 'source_model' => \\Magento\\Eav\\Model\\Entity\\Attribute\\Source\\Boolean::class,\n 'note' => 'Please choose “No”',\n )\n );\n }\n\n /** Update vendor entity attribute */\n if ($context->getVersion() && version_compare($context->getVersion(), '1.0.5', '<')) {\n $this->eavSetup->addAttribute(\n \\Vnecoms\\Vendors\\Model\\Vendor::ENTITY,\n 'ocean_brand_id',\n [\n 'type' => 'int',\n 'nullable' => true,\n 'length' => 10,\n 'comment' => 'Ocean BrandID as magento vendor_id',\n 'label' => 'Ocean BrandID',\n 'visible' => false,\n 'required' => false,\n 'user_defined' => false,\n 'searchable' => false,\n 'filterable' => false,\n 'comparable' => false,\n 'visible_on_front' => false,\n 'visible_in_advanced_search' => false,\n 'is_html_allowed_on_front' => false,\n ]\n );\n }\n }", "private function setEnableReviews() {\n $this->product->set_reviews_allowed($this->wcData->isEnableReviews());\n }", "function ycb_setup_flatsome_hooks(){\r\n add_filter(\"woocommerce_sale_flash\", \"ycb_add_discount_badge\", 1, 3);\r\n\r\n add_action('woocommerce_before_shop_loop_item', 'ycb_custom_badge_shop_loop_opened', 15 );\r\n add_action('woocommerce_before_single_product_summary', 'ycb_custom_badge_shop_loop_opened', 15);\r\n}", "public function setDiscount($value)\n {\n $this->data->amount->subtotals->discount = (float) $value;\n\n return $this;\n }", "function TaxExclusivePrice(){\n\t\tuser_error(\"to be completed\");\n\t}", "public function catalogProductLoadAfter(Varien_Event_Observer $observer)\n{\n // set the additional options on the product\n if(Mage::getStoreConfigFlag('mycustom_section/mycustom_group2/field1')){\n $action = Mage::app()->getFrontController()->getAction();\n if ($action->getFullActionName() == 'checkout_cart_add')\n {\n\n \n $product = $observer->getProduct();\n // Mage::log($product);\n \n$totalCredits = Mage::getModel('kartparadigm_storecredit/creditinfo')->getCreditsOfProduct($product->getId());\n\n if($totalCredits > 0) {\n\n // if ($options = $action->getRequest()->getParam('extra_option'))\n //{\n //$product = $observer->getProduct();\n // Mage::log($product);\n\n // add to the additional options array\n $additionalOptions = array();\n if ($additionalOption = $product->getCustomOption('additional_options'))\n {\n $additionalOptions = (array) unserialize($additionalOption->getValue());\n }\n\n \n $additionalOptions[] = array(\n 'label' => \"Credits\",\n 'value' => $totalCredits,\n );\n\n \n // add the additional options array with the option code additional_options\n $observer->getProduct()\n ->addCustomOption('additional_options', serialize($additionalOptions));\n //}\n }\n }\n }\n}", "public function getDiscountAmount();", "public function testUpdateProductUsingPOST()\n {\n }", "public function setDiscount(int $discount): self\n {\n $this->discount = $discount;\n return $this;\n }", "public function setProductPrice($product_price){\n $this->product_price = $product_price;\n }", "public function setPriceAttribute($value)\n {\n $this->attributes['price'] = $value * 100;\n }", "public function createnewproduct()\n {\n Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);\n $product = Mage::getModel('catalog/product');\n $websiteId = Mage::app()->getWebsite('base')->getId();\n $storeId = Mage::app()->getStore('default')->getId();\n\n //Set SKU dynamically over here\n $collection = Mage::getModel('catalog/product')\n ->getCollection()\n ->addAttributeToSort('created_at', 'desc');\n $collection->getSelect()->limit(1);\n $latestItemId = $collection->getLastItem()->getId();\n if($latestItemId) {\n $nextProid = $latestItemId + 1;\n } else {\n $nextProid = 1;\n }\n $SampleSKU = 'titechPro'.$nextProid;\n\n try {\n $product\n ->setStoreId($storeId) //you can set data in store scope\n ->setWebsiteIds(array($websiteId)) //website ID the product is assigned to, as an array\n ->setAttributeSetId(4) //ID of a attribute set named 'default'\n ->setTypeId('simple') //product type\n ->setCreatedAt(strtotime('now')) //product creation time\n ->setUpdatedAt(strtotime('now')) //product update time\n ->setSku($SampleSKU) //SKU\n ->setName('Titech sample product') //product name\n ->setWeight(4.0000)\n ->setStatus(1) //product status (1 - enabled, 2 - disabled)\n ->setTaxClassId(4) //tax class (0 - none, 1 - default, 2 - taxable, 4 - shipping)\n ->setVisibility(Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH) //catalog and search visibility\n //->setManufacturer(28) //manufacturer id\n //->setColor(24)\n //->setNewsFromDate('06/26/2014') //product set as new from\n //->setNewsToDate('06/30/2014') //product set as new to\n ->setCountryOfManufacture('IN') //country of manufacture (2-letter country code)\n ->setPrice(11.22) //price in form 11.22\n ->setCost(22.33) //price in form 11.22\n //->setSpecialPrice(00.44) //special price in form 11.22\n //->setSpecialFromDate('06/1/2014') //special price from (MM-DD-YYYY)\n //->setSpecialToDate('06/30/2014') //special price to (MM-DD-YYYY)\n ->setMsrpEnabled(1) //enable MAP\n ->setMsrpDisplayActualPriceType(1) //display actual price (1 - on gesture, 2 - in cart, 3 - before order confirmation, 4 - use config)\n ->setMsrp(99.99) //Manufacturer's Suggested Retail Price\n ->setMetaTitle('Sample meta title 2')\n ->setMetaKeyword('Sample meta keyword 2')\n ->setMetaDescription('Sample meta description 2')\n ->setDescription('This is a long description for sample product')\n ->setShortDescription('This is a short description for sample product')\n ->setMediaGallery (array('images'=>array (), 'values'=>array ())) //media gallery initialization\n ->addImageToMediaGallery('media/catalog/product/ti/ti_logo.png', array('image','thumbnail','small_image'), false, false) //assigning image, thumb and small image to media gallery\n ->setStockData(array(\n 'use_config_manage_stock' => 0, //'Use config settings' checkbox\n 'manage_stock'=>1, //manage stock\n 'min_sale_qty'=>1, //Minimum Qty Allowed in Shopping Cart\n 'max_sale_qty'=>2, //Maximum Qty Allowed in Shopping Cart\n 'is_in_stock' => 1, //Stock Availability\n 'qty' => 999 //qty\n )\n )\n ->setCategoryIds(array(2)); //assign product to categories - Set to Default\n\n $product->save();\n return $product->getIdBySku($SampleSKU);\n } catch(Exception $e) {\n Mage::log($e->getMessage());\n }\n }", "private function setSoldIndividually() {\n $this->product->set_sold_individually($this->wcData->isSoldIndividually());\n }", "function setSyncItemsPriceAction()\n {\n }", "function setPrice( $value )\n {\n if ( $this->State_ == \"Dirty\" )\n $this->get( $this->ID );\n\n $this->Price = $value;\n setType( $this->Price, \"double\" );\n }", "public function addDiscount(DiscountInterface $discount);", "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 getDiscount()\r\n {\r\n return $this->discount;\r\n }", "function setPrice($price)\n {\n $this->price = $price;\n }", "private function SetPricingDetails()\n\t{\n\t\t$product = $this->productClass->getProduct();\n\n\t\t$GLOBALS['PriceLabel'] = GetLang('Price');\n\n\t\tif($this->productClass->GetProductCallForPricingLabel()) {\n\t\t\t$GLOBALS['ProductPrice'] = $GLOBALS['ISC_CLASS_TEMPLATE']->ParseGL($this->productClass->GetProductCallForPricingLabel());\n\t\t}\n\t\t// If prices are hidden, then we don't need to go any further\n\t\telse if($this->productClass->ArePricesHidden()) {\n\t\t\t$GLOBALS['HidePrice'] = \"display: none;\";\n\t\t\t$GLOBALS['HideRRP'] = 'none';\n\t\t\t$GLOBALS['ProductPrice'] = '';\n\t\t\treturn;\n\t\t}\n\t\telse if (!$this->productClass->IsPurchasingAllowed()) {\n\t\t\t$GLOBALS['ProductPrice'] = GetLang('NA');\n\t\t}\n\t\telse {\n\t\t\t$options = array('strikeRetail' => false);\n\t\t\t$GLOBALS['ProductPrice'] = formatProductDetailsPrice($product, $options);\n\t\t}\n\n\t\t// Determine if we need to show the RRP for this product or not\n\t\t// by comparing the price of the product including any taxes if\n\t\t// there are any\n\t\t$GLOBALS['HideRRP'] = \"none\";\n\t\t$productPrice = $product['prodcalculatedprice'];\n\t\t$retailPrice = $product['prodretailprice'];\n\t\tif($retailPrice) {\n\t\t\t// Get the tax display format\n\t\t\t$displayFormat = getConfig('taxDefaultTaxDisplayProducts');\n\t\t\t$options['displayInclusive'] = $displayFormat;\n\n\t\t\t// Convert to the browsing currency, and apply group discounts\n\t\t\t$productPrice = formatProductPrice($product, $productPrice, array(\n\t\t\t\t'localeFormat' => false, 'displayInclusive' => $displayFormat\n\t\t\t));\n\t\t\t$retailPrice = formatProductPrice($product, $retailPrice, array(\n\t\t\t\t'localeFormat' => false, 'displayInclusive' => $displayFormat\n\t\t\t));\n\n\t\t\tif($productPrice < $retailPrice) {\n\t\t\t\t$GLOBALS['HideRRP'] = '';\n\n\t\t\t\t// Showing call for pricing, so just show the RRP and that's all\n\t\t\t\tif($this->productClass->GetProductCallForPricingLabel()) {\n\t\t\t\t\t$GLOBALS['RetailPrice'] = CurrencyConvertFormatPrice($retailPrice);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\t// ISC-1057: do not apply customer discount to RRP in this case\n\t\t\t\t\t$retailPrice = formatProductPrice($product, $product['prodretailprice'], array(\n\t\t\t\t\t\t'localeFormat' => false,\n\t\t\t\t\t\t'displayInclusive' => $displayFormat,\n\t\t\t\t\t\t'customerGroup' => 0,\n\t\t\t\t\t));\n\t\t\t\t\t$GLOBALS['RetailPrice'] = '<strike>' . formatPrice($retailPrice) . '</strike>';\n\t\t\t\t\t$GLOBALS['PriceLabel'] = GetLang('YourPrice');\n\t\t\t\t\t$savings = $retailPrice - $productPrice;\n\t\t\t\t\t$string = sprintf(getLang('YouSave'), '<span class=\"YouSaveAmount\">'.formatPrice($savings).'</span>');\n\t\t\t\t\t$GLOBALS['YouSave'] = '<span class=\"YouSave\">'.$string.'</span>';\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "public function testSetPriceProduct()\n {\n $product = new Product();\n $value = 10.99;\n $product->setPrice($value);\n $this->assertEquals($value, $product->getPrice());\n }", "function setItem_price($price){\n $this->item_price = $price;\n }", "protected function setOfferNature ()\n {\n $this->offerNature = $this->offer->rate_nature->value;\n }", "function setSyncProdWeight()\n {\n }", "public function setBaseShippingDiscountAmount($amount);", "private function calculateFOBPriceAction()\n {\n // than 99, then modify shippingPrice to 0.00 \n \t$price = $this->info['productPrice'];\n if($price <= 99){\n $shippingPrice = $this->info['shippingPrice'];\n }\n else{\n $this->info['shippingPrice'] = 0.0;\n }\n $this->info['fobPrice'] = ($price + $shippingPrice) * 1.07; // It also adds US TAXes\n }", "protected function doActionSetSalePrice()\n {\n $form = new \\XLite\\Module\\CDev\\Sale\\View\\Form\\SaleSelectedDialog();\n $form->getRequestData();\n\n if ($form->getValidationMessage()) {\n \\XLite\\Core\\TopMessage::addError($form->getValidationMessage());\n } elseif (!$this->getSelected() && $ids = $this->getActionProductsIds()) {\n $qb = \\XLite\\Core\\Database::getRepo('XLite\\Model\\Product')->createQueryBuilder();\n $alias = $qb->getMainAlias();\n $qb->update('\\XLite\\Model\\Product', $alias)\n ->andWhere($qb->expr()->in(\"{$alias}.product_id\", $ids));\n\n foreach ($this->getUpdateInfoElement() as $key => $value) {\n $qb->set(\"{$alias}.{$key}\", \":{$key}\")\n ->setParameter($key, $value);\n }\n\n $qb->execute();\n\n \\XLite\\Core\\TopMessage::addInfo('Products information has been successfully updated');\n } else {\n \\XLite\\Core\\Database::getRepo('\\XLite\\Model\\Product')->updateInBatchById($this->getUpdateInfo());\n \\XLite\\Core\\TopMessage::addInfo('Products information has been successfully updated');\n }\n\n $this->setReturnURL($this->buildURL('product_list', '', ['mode' => 'search']));\n }", "public function setProduct(Product $product);", "function action_woocommerce_coupon_options_usage_limit( $coupon_get_id ) {\n\techo '<div id=\"add_free_product\" class=\"freeproductpanel woocommerce_options_panel panel\">\n\t<div class=\"options_group\">\n\t\t<p>'. __( 'Select one of your products. This product will be automatically added to the shopping cart as soon as the corresponding voucher code is used in the shopping cart.', 'woocommerce-freeproduct' ) .'</p>'; ?>\n\t\t<p class=\"form-field\">\n\t\t\t<label for=\"freeproductid\"><?php esc_html_e( 'Product', 'woocommerce' ); ?></label>\n\t\t\t<select class=\"wc-product-search\" style=\"width: 50%;\" id=\"freeproductid\" name=\"freeproduct\" data-placeholder=\"<?php esc_attr_e( 'Search for a product&hellip;', 'woocommerce' ); ?>\" data-action=\"woocommerce_json_search_products_and_variations\">\n\t\t\t\t<?php\n\t\t\t\t$product_ids = array( get_post_meta( $coupon_get_id, 'freeproductid', true ) );\n\t\t\t\tforeach ( $product_ids as $product_id ) {\n\t\t\t\t\t$product = wc_get_product( $product_id );\n\t\t\t\t\tif ( is_object( $product ) ) {\n\t\t\t\t\t\techo '<option value=\"' . esc_attr( $product_id ) . '\" ' . selected( esc_attr( $product_id ), get_post_meta( $coupon_get_id, 'freeproductid', true ), false ) . '>' . wp_kses_post( $product->get_formatted_name( ) ) . '</option>';\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t?>\n\t\t\t</select>\n\t\t\t<span class=\"dashicons dashicons-no-alt deletefreeproduct\"></span>\n\t\t</p>\n\t</div>\n\t<p><?php _e( '<strong>Note:</strong> The selected product is not automatically modified. Make your settings under <a href=\"http://compute.local/wp-admin/edit.php?post_type=product\">Products</a> (Hide in searchresults, set prices to 0...).', 'woocommerce-freeproduct' ); ?></p></div><?php\n}", "function applyDiscountOnSubscription($subscriptionId = null)\n {\n $db = new db();\n $db->makeConnection();\n\n if($subscriptionId != null)\n {\n \t\\Stripe\\Stripe::setApiKey(STRPIE_CLIENT_SECRET);\n\n $date = date('Y-m-d 00:00:00');\n $discountTotal = 0;\n\n // Select plan having trial periods on\n // $query = \"SELECT price FROM billing_products BP INNER JOIN user_subscription_items USI ON BP.plan_id = USI.plan_id WHERE BP.trial_period != 0 AND USI.subscription_id = '{$subscriptionId}' AND USI.coupon_trial_from <= '{$date}' AND USI.coupon_trial_to >= '{$date}'\";\n $query = \"SELECT price FROM billing_products BP INNER JOIN user_subscription_items USI ON BP.plan_id = USI.plan_id WHERE BP.trial_period != 0 AND USI.subscription_id = '{$subscriptionId}' AND USI.coupon_trial_from <= '{$date}' AND USI.coupon_trial_to > '{$date}' AND USI.status = '1'\";\n $res = $db->query($query);\n\n if($db->numRows($res))\n {\n while ($rs = mysqli_fetch_array($res))\n {\n $discountTotal += $rs['price'];\n }\n\n //\n if($discountTotal)\n {\n // Fetch if coupon exist, otherwise create\n $couponId = 'OFF-'.$discountTotal;\n\n try {\n // Retrieve coupon\n $coupon = \\Stripe\\Coupon::retrieve($couponId);\n } catch (\\Stripe\\Error\\Base $e) {\n // Create coupon\n $coupon = \\Stripe\\Coupon::create([\n 'id' => $couponId,\n 'amount_off' => ($discountTotal*100),\n 'currency' => 'SEK',\n 'duration' => 'once',\n // 'duration' => 'repeating',\n // 'duration_in_months' => 3,\n ]);\n }\n\n // Apply coupon on subscription\n if($coupon)\n {\n try {\n // Update subscription\n \\Stripe\\Subscription::update(\n $subscriptionId,\n ['coupon' => $coupon->id]\n );\n } catch (\\Stripe\\Error\\Base $e) {}\n }\n }\n else\n {\n \ttry {\n $sub = \\Stripe\\Subscription::retrieve($subscriptionId);\n\n if( isset($sub->discount) && ($sub->discount != null) )\n {\n $sub->deleteDiscount();\n }\n } catch (\\Stripe\\Error\\Base $e) {}\n }\n }\n else\n {\n \ttry {\n $sub = \\Stripe\\Subscription::retrieve($subscriptionId);\n\n if( isset($sub->discount) && ($sub->discount != null) )\n {\n $sub->deleteDiscount();\n }\n } catch (\\Stripe\\Error\\Base $e) {}\n }\n }\n }", "public function applyDiscount(Discount $discount){\n\t\tif($this->discount == NULL){\n\t\t\t$this->finalPrice = $this->price*(100-$discount->percent/100);\n\t\t\t$this->discount = $discount;\n\t\t}\n\t\treturn $this;\n\t}", "public function setFeature(string $feature): void;", "function save_code( $coupon_get_id ) {\n\t$freeproductid = $_POST['freeproduct'];\n\tupdate_post_meta( $coupon_get_id, 'freeproductid', $freeproductid );\n}", "public function product($prod) {\n\t\t$this->upsProductCode = $prod;\n\t}", "public function setDiscount($discount)\n {\n $this->discount = $discount;\n\n return $this;\n }", "public function setDiscount($discount)\n {\n $this->discount = $discount;\n\n return $this;\n }", "public function setCalculateDiscountOnCreditMemos(?bool $value): void {\n $this->getBackingStore()->set('calculateDiscountOnCreditMemos', $value);\n }", "public function setBaseDiscountAmount($amount);", "function beforeSave(){\n\t\t\t// Get the rate\n\t\t\t$rate = 1 / $this->_getRate();\n\n\t\t\t// Convert it back to USD\n\t\t\tif(!empty($this->data['Product']['rrp'])){\n\t\t\t\t$this->data['Product']['rrp'] = $this->data['Product']['rrp'] * $rate;\n\t\t\t}\n\n\t\t\tif(!empty($this->data['Product']['start_price'])){\n\t\t\t\t$this->data['Product']['start_price'] \t= $this->data['Product']['start_price'] * $rate;\n\t\t\t}\n\n\t\t\tif(!empty($this->data['Product']['delivery_cost'])){\n\t\t\t\t$this->data['Product']['delivery_cost'] = $this->data['Product']['delivery_cost'] * $rate;\n\t\t\t}\n\n\t\t\tif(!empty($this->data['Product']['fixed_price'])){\n\t\t\t\t$this->data['Product']['fixed_price'] \t= $this->data['Product']['fixed_price'] * $rate;\n\t\t\t}\n\n\t\t\tif(!empty($this->data['Product']['minimum_price'])){\n\t\t\t\t$this->data['Product']['minimum_price'] = $this->data['Product']['minimum_price'] * $rate;\n\t\t\t}\n\n\t\t\treturn true;\n\t\t}", "public function setQuantite($quantite)\n{\n$this->quantite = $quantite;\n\nreturn $this;\n}", "public function promo_feature_method()\n {\n \n }", "function pmprowoo_process_product_meta_for_gift_levels() {\r\n\tglobal $post_id, $pmprowoo_gift_codes;\r\n\t// Save gift membership discount\r\n $code = $_POST['_gift_membership_code'];\r\n\r\n // update array of gift codes\r\n if(!empty($code))\r\n\t\t$pmprowoo_gift_codes[$post_id] = $code;\r\n\telseif(isset($pmprowoo_gift_codes[$post_id]))\r\n\t\tunset($pmprowoo_gift_codes[$post_id]);\r\n\r\n if( isset( $code ) ) {\r\n update_post_meta( $post_id, '_gift_membership_code', esc_attr( $code ));\r\n update_option('_pmprowoo_gift_codes', $pmprowoo_gift_codes);\r\n }\r\n\r\n // Save gift membership email option\r\n $email_opt = $_POST['_gift_membership_email_option'];\r\n\r\n if( isset( $email_opt ) ) {\r\n update_post_meta( $post_id, '_gift_membership_email_option', esc_attr( $email_opt ));\r\n }\r\n}" ]
[ "0.70449513", "0.6529873", "0.62827617", "0.6267761", "0.5989304", "0.5965879", "0.59481275", "0.59238577", "0.59236336", "0.5894399", "0.5873016", "0.583383", "0.5831339", "0.5821205", "0.5816552", "0.5806731", "0.57740843", "0.5736456", "0.5728772", "0.5629333", "0.5597933", "0.55935913", "0.5575567", "0.55474406", "0.554713", "0.5543705", "0.55327606", "0.5490842", "0.5476913", "0.54765296", "0.54747784", "0.5471135", "0.5470474", "0.5470293", "0.54646933", "0.5458637", "0.54552436", "0.5433461", "0.5428996", "0.5426024", "0.5422794", "0.541273", "0.5406728", "0.5399284", "0.5394361", "0.53907114", "0.538973", "0.53800833", "0.5373265", "0.537056", "0.53678787", "0.5362712", "0.5346924", "0.5343668", "0.5342161", "0.5314402", "0.5314123", "0.5308124", "0.5306747", "0.52966374", "0.52828366", "0.5282195", "0.52813154", "0.52694714", "0.52686495", "0.52615845", "0.52579594", "0.5256813", "0.52503735", "0.5241275", "0.52377105", "0.5233154", "0.5229893", "0.5222403", "0.5217243", "0.5217228", "0.52127707", "0.5211803", "0.5205823", "0.5205454", "0.5204108", "0.5203562", "0.5199985", "0.51997286", "0.5198344", "0.51958793", "0.5193424", "0.5179428", "0.517716", "0.5166256", "0.51635873", "0.5163088", "0.5155468", "0.5154794", "0.5154794", "0.514701", "0.5144038", "0.51412094", "0.51367736", "0.51320636", "0.51314837" ]
0.0
-1
Target: Product. "Set discount to shipping"
protected static function avail_target_shipping($filter_items, $items, $target, $rule, $sku_id) { if (!$filter_items || ($filter_items && !self::productInArray($sku_id, $filter_items))) { return false; } // Инициализируем скидки для абстрактного товара self::initAvailableProduct($rule, $sku_id); return false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function AssignDiscount()\n\t{\t\n\t}", "public function setShippingDiscountAmount($amount);", "function set_discount($discount_id = FALSE)\n\t\t{\n\t\t\t$this->load->model('demo_cart_model');\n\t\t\t\n\t\t\t$this->demo_cart_model->demo_set_discount($discount_id);\n\t\t\t\n\t\t\tredirect('cart');\n\t\t}", "public function setShippingPrice() {\n if ($this->price > 200) {\n $this->shippingPrice = 0;\n }\n }", "public function setBaseShippingDiscountAmount($amount);", "public function getShippingDiscountAmount();", "public function applyCartDiscount(Varien_Event_Observer $observer)\n { \n try\n { \n $bundle_product_ids = [];\n $quote_product_ids = [];\n $cookieValue = Mage::getModel('core/cookie')->get('ivid');\n $userBundleCollection = Mage::getModel('increasingly_analytics/bundle')->getCollection()->addFieldToFilter('increasingly_visitor_id',$cookieValue);\n $items = $observer->getEvent()->getQuote()->getAllItems();\n $eligibleProducts = [];\n $discount = 0;\n foreach ($items as $item) {\n array_push($quote_product_ids, $item->getProductId());\n }\n foreach ($userBundleCollection as $bundle) {\n //First Bundle products\n $bundle_product_ids = explode(',', $bundle->getProductIds()); \n $productsIds = array_intersect($quote_product_ids, $bundle_product_ids);\n if(count($productsIds) == count($bundle_product_ids) )\n $discount += $bundle->getDiscountPrice();\n }\n\n if($discount > 0){\n $quote=$observer->getEvent()->getQuote();\n $quoteid=$quote->getId();\n $discountAmount=$discount;\n if($quoteid) { \n if($discountAmount>0) {\n $total=$quote->getBaseSubtotal();\n $quote->setSubtotal(0);\n $quote->setBaseSubtotal(0);\n\n $quote->setSubtotalWithDiscount(0);\n $quote->setBaseSubtotalWithDiscount(0);\n\n $quote->setGrandTotal(0);\n $quote->setBaseGrandTotal(0);\n \n\n $canAddItems = $quote->isVirtual()? ('billing') : ('shipping'); \n foreach ($quote->getAllAddresses() as $address) {\n\n $address->setSubtotal(0);\n $address->setBaseSubtotal(0);\n\n $address->setGrandTotal(0);\n $address->setBaseGrandTotal(0);\n\n $address->collectTotals();\n\n $quote->setSubtotal((float) $quote->getSubtotal() + $address->getSubtotal());\n $quote->setBaseSubtotal((float) $quote->getBaseSubtotal() + $address->getBaseSubtotal());\n\n $quote->setSubtotalWithDiscount(\n (float) $quote->getSubtotalWithDiscount() + $address->getSubtotalWithDiscount()\n );\n $quote->setBaseSubtotalWithDiscount(\n (float) $quote->getBaseSubtotalWithDiscount() + $address->getBaseSubtotalWithDiscount()\n );\n\n $quote->setGrandTotal((float) $quote->getGrandTotal() + $address->getGrandTotal());\n $quote->setBaseGrandTotal((float) $quote->getBaseGrandTotal() + $address->getBaseGrandTotal());\n\n $quote ->save(); \n\n $quote->setGrandTotal($quote->getBaseSubtotal()-$discountAmount)\n ->setBaseGrandTotal($quote->getBaseSubtotal()-$discountAmount)\n ->setSubtotalWithDiscount($quote->getBaseSubtotal()-$discountAmount)\n ->setBaseSubtotalWithDiscount($quote->getBaseSubtotal()-$discountAmount)\n ->save(); \n\n\n if($address->getAddressType()==$canAddItems) {\n //echo $address->setDiscountAmount; exit;\n $address->setSubtotalWithDiscount((float) $address->getSubtotalWithDiscount()-$discountAmount);\n $address->setGrandTotal((float) $address->getGrandTotal()-$discountAmount);\n $address->setBaseSubtotalWithDiscount((float) $address->getBaseSubtotalWithDiscount()-$discountAmount);\n $address->setBaseGrandTotal((float) $address->getBaseGrandTotal()-$discountAmount);\n if($address->getDiscountDescription()){\n $address->setDiscountAmount(-($address->getDiscountAmount()-$discountAmount));\n $address->setDiscountDescription($address->getDiscountDescription().', Custom Discount');\n $address->setBaseDiscountAmount(-($address->getBaseDiscountAmount()-$discountAmount));\n }else {\n $address->setDiscountAmount(-($discountAmount));\n $address->setDiscountDescription('Custom Discount');\n $address->setBaseDiscountAmount(-($discountAmount));\n }\n $address->save();\n }//end: if\n } //end: foreach\n //echo $quote->getGrandTotal();\n\n foreach($quote->getAllItems() as $item){\n //We apply discount amount based on the ratio between the GrandTotal and the RowTotal\n $rat=$item->getPriceInclTax()/$total;\n $ratdisc=$discountAmount*$rat;\n $item->setDiscountAmount(($item->getDiscountAmount()+$ratdisc) * $item->getQty());\n $item->setBaseDiscountAmount(($item->getBaseDiscountAmount()+$ratdisc) * $item->getQty())->save(); \n }\n } \n }\n }\n }\n catch(Exception $e)\n {\n Mage::log(\"Remove from cart tracking - \" . $e->getMessage(), null, 'Increasingly_Analytics.log');\n }\n\n }", "function setShipping($ship_key)\n {\n return 4.50;\n }", "public function applyGlobalDiscount($discount_rate)\n {\n }", "public function actionNovaPostaShipping()\n {\n echo 35.46;\n }", "private function updateProductDiscount(\n ProductInterface $product,\n Request $request\n ): void {\n $discountPercent = $request->request->get('discount_percent') !== '' ? (float) $request->request->get('discount_percent') : null;\n $discountLimitType = $request->request->get('discount_limit_type') !== '' ? $request->request->get('discount_limit_type') : null;\n $discountFromDate = $request->request->get('discount_from_date') !== '' ? $request->request->get('discount_from_date') : null;\n $discountToDate = $request->request->get('discount_to_date') !== '' ? $request->request->get('discount_to_date') : null;\n\n $variants = $product->getVariants();\n foreach ($variants as $variant) {\n // Variant to change\n $variantPricing = $variant->getChannelPricings()->first();\n\n // Change percent\n if ($discountPercent !== null) {\n $variantPricing->setDiscount($discountPercent / 100);\n }\n\n // Continue if no change type\n if ($discountLimitType === self::LIMIT_NO_CHANGE) {\n continue;\n }\n // Discount type\n $variantPricing->setDiscountLimitType($discountLimitType === self::LIMIT_NONE ? null : $discountLimitType);\n\n // Date type discount\n if ($discountLimitType === self::LIMIT_DATETIME) {\n if ($discountFromDate && $discountToDate) {\n $dateFrom = \\DateTime::createFromFormat('Y-m-d', $discountFromDate);\n $dateTo = \\DateTime::createFromFormat('Y-m-d', $discountToDate);\n\n $variantPricing->setDiscountFrom($dateFrom);\n $variantPricing->setDiscountTo($dateTo);\n }\n\n if ($discountFromDate && !$discountToDate) {\n $dateFrom = \\DateTime::createFromFormat('Y-m-d', $discountFromDate);\n\n $variantPricing->setDiscountFrom($dateFrom);\n $variantPricing->setDiscountTo(null);\n }\n\n if (!$discountFromDate && $discountToDate) {\n $dateTo = \\DateTime::createFromFormat('Y-m-d', $discountToDate);\n\n $variantPricing->setDiscountFrom(null);\n $variantPricing->setDiscountTo($dateTo);\n }\n }\n }\n }", "public function discountBifurcation(Varien_Event_Observer $observer)\n {\n $rule = $observer->getEvent()->getRule();\n $result = $observer->getEvent()->getResult();\n $itemId = $observer->getEvent()->getItem()->getItemId();\n //set Unique key\n $curUnique= $rule->getRuleId().'_'.$itemId;\n //check if Mage registry unique call set\n if(Mage::registry('uniqueCall')!==null){\n //if check in array\n $uniqueCalls = Mage::registry('uniqueCall');\n if( in_array($curUnique,$uniqueCalls)){\n return;\n }else{\n //unset existing registry. also take existing array in variable\n Mage::unregister('uniqueCall');\n $uniqueCalls[]= $curUnique ;\n //set registry again with new array include $uniqueCall into it\n Mage::register('uniqueCall',$uniqueCalls);\n }\n }else{\n //set registry again with new array include $uniqueCall into it\n $array = array();\n $array[]=$rule->getRuleId().'_'.$itemId;\n Mage::register('uniqueCall',$array);\n\n } \n\n //condition for the Promotional coupons\n if ( $rule->getCouponType() == Mage_SalesRule_Model_Rule::COUPON_TYPE_NO_COUPON ) {\n $promotionDiscount = 0;\n $promotionDiscount = Mage::registry('promotion');\n if (Mage::registry('promotion')!==null){\n Mage::unregister('promotion');\n }\n if (Mage::registry('promo_lable')!==null){\n Mage::unregister('promo_lable');\n }\n $promotionDiscount += $result->getDiscountAmount();\n Mage::register('promotion', $promotionDiscount);\n Mage::register('promo_lable',$rule->getName());\n } elseif ( $rule->getCouponType() == self::COUPON_TYPE_FUE_GENERATED ) {\n $couponDiscount = 0;\n $couponDiscount = Mage::registry('coupon');\n if(Mage::registry('coupon')!==null){\n Mage::unregister('coupon');\n }\n //sum up all the values of discounted coupons\n $couponDiscount += $result->getDiscountAmount();\n Mage::register('coupon',$couponDiscount);\n }\n $quote = $observer->getEvent()->getQuote();\n $quoteAddress = $observer->getEvent()->getAddress();\n //set discounted coupons and promotional coupons amount in quote\n $quote->setCouponDiscount(Mage::registry('coupon'));\n $quote->setPromotionalDiscount(Mage::registry('promotion'));\n\n if (Mage::getStoreConfig('promodiscount/promodiscount/use_default')) {\n $quote->setPromoLable(Mage::getStoreConfig('promodiscount/promodiscount/default_lable'));\n } else {\n if (Mage::registry('promo_lable')) {\n $quote->setPromoLable(Mage::registry('promo_lable'));\n } else {\n $quote->setPromoLable(Mage::getStoreConfig('promodiscount/promodiscount/default_lable'));\n }\n }\n \n $quoteAddress->setCouponDiscount(Mage::registry('coupon'));\n $quoteAddress->setPromotionalDiscount(Mage::registry('promotion'));\n if (Mage::registry('promo_lable')) {\n $quoteAddress->setPromoLable(Mage::registry('promo_lable'));\n } else {\n $quoteAddress->setPromoLable(Mage::getStoreConfig('promodiscount/promodiscount/default_lable'));\n }\n }", "function pp_edd_auto_apply_discount() {\n\n\tif ( function_exists( 'edd_is_checkout' ) && edd_is_checkout() ) {\n\n\t\tif ( ! edd_cart_has_discounts() && edd_is_discount_valid( 'BFCM2016', '', false ) ) {\n\t\t\tedd_set_cart_discount( 'BFCM2016' );\n\t\t}\n\n\t}\n\n}", "public function apply()\n {\n /** @var EavSetup $eavSetup */\n $eavSetup = $this->eavSetupFactory->create(['setup' => $this->moduleDataSetup]);\n\n if (!$eavSetup->getAttribute(Product::ENTITY, 'am_shipping_type')) {\n $eavSetup->addAttribute(\n Product::ENTITY,\n 'am_shipping_type',\n [\n 'type' => 'varchar',\n 'backend' => '',\n 'frontend' => '',\n 'label' => 'Shipping Type',\n 'input' => 'select',\n 'class' => '',\n 'source' => '',\n 'global' => ScopedAttributeInterface::SCOPE_STORE,\n 'visible' => true,\n 'required' => false,\n 'user_defined' => false,\n 'default' => 0,\n 'searchable' => false,\n 'filterable' => false,\n 'comparable' => false,\n 'visible_on_front' => false,\n 'used_in_product_listing' => true,\n 'unique' => false,\n 'apply_to' => ''\n ]\n );\n }\n }", "protected function calculateDiscount() : void{\r\n $percentage = ($this->discounted_value * 100) / $this->order->getTrueTotal();\r\n $new_total = $this->order->getTrueTotal() - $this->discounted_value;\r\n\r\n $this->order_discount_value = $this->discounted_value;\r\n $this->order_discount_percentage = $percentage;\r\n $this->order_discount_reason = \"For every \" . $this->products_nr . \" products from category #\" . $this->category_id . \" you get one free. You got: \";\r\n foreach($this->items_matching as $item){\r\n $this->order_discount_reason .= floor($item[\"qty\"] / $this->products_nr) . \" x '\" . $item[\"description\"] . \"' (€\". $item[\"price\"] .\" each) ; \";\r\n }\r\n $this->order_new_total = $new_total;\r\n }", "public function setDiscount(int $discount): void\n {\n $this->discount = ($discount > 0 && $discount <= 50) ? $discount : 0;\n\n }", "public function setDiscount(string $discount)\n\t{\n\t\t$this->addKeyValue('Discount', $discount); \n\n\t}", "public function updateAffectedPlans(Discount $discount)\n {\n }", "public function setShippingCost($shippingCost);", "function setup() {\r\n // \"Buy more than 100 items, get 50 (% or $, as per admin) off\" \r\n // $this->add_extra_level_discount(100, 50);\r\n }", "private function setShippingOptions() {\n // Reset the settings if this is a recrawl\n if ($this->getSaverData()->isRecrawl()) {\n // Set dimensions and weight\n $this->product->set_weight('');\n $this->product->set_length('');\n $this->product->set_width('');\n $this->product->set_height('');\n\n // Set shipping class\n $this->product->set_shipping_class_id(0);\n }\n\n // No shipping for virtual products.\n if ($this->wcData->isVirtual()) {\n $this->product->set_virtual(true);\n return;\n }\n\n // Not a virtual product.\n $this->product->set_virtual(false);\n\n // Set dimensions and weight\n $this->product->set_weight($this->wcData->getWeight());\n $this->product->set_length($this->wcData->getLength());\n $this->product->set_width($this->wcData->getWidth());\n $this->product->set_height($this->wcData->getHeight());\n\n // Set shipping class\n $this->product->set_shipping_class_id($this->wcData->getShippingClassId());\n }", "public function set_manual_discount($discount_data = FALSE)\r\n\t{\r\n\t\tif (is_array($discount_data) && ! empty($discount_data))\r\n\t\t{\r\n\t\t\t// Check that any submitted 'New value' discounts are only applied to the shipping total. \r\n\t\t\tif (isset($discount_data['column']) && isset($discount_data['calculation']) && ($discount_data['column'] != 'shipping_total') && ($discount_data['calculation'] == 3))\r\n\t\t\t{\r\n\t\t\t\treturn FALSE;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t// Merge the code and manual discounts together, then loop through data and compile an array of all discount ids currently in use.\r\n\t\t\t$existing_discounts = array_merge($this->flexi->cart_contents['settings']['discounts']['manual'], $this->flexi->cart_contents['settings']['discounts']['codes']);\r\n\t\t\t$existing_ids = array();\r\n\t\t\t\t\r\n\t\t\tforeach($existing_discounts as $existing_discount)\r\n\t\t\t{\r\n\t\t\t\t$existing_ids[] = $existing_discount['id'];\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t// If an id is not set in the submitted '$discount_data', or if a discount with a matching id already exists, set a new id. \r\n\t\t\tif (! isset($discount_data['id']) || in_array($discount_data['id'], $existing_ids))\r\n\t\t\t{\r\n\t\t\t\t$id = 0;\r\n\t\t\t\twhile (in_array('manual_'.$id, $existing_ids))\r\n\t\t\t\t{\r\n\t\t\t\t\t$id++; \r\n\t\t\t\t}\r\n\t\t\t\t$id = $discount_data['id'] = 'manual_'.$id;\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\t$id = $discount_data['id'];\r\n\t\t\t}\r\n\t\t\r\n\t\t\t// Set default values if not submitted.\r\n\t\t\t$discount_data['description'] = (! isset($discount_data['description'])) ? FALSE : $discount_data['description'];\r\n\t\t\t$discount_data['value'] = (! isset($discount_data['value'])) ? 0 : $discount_data['value'];\r\n\t\t\t$discount_data['column'] = (! isset($discount_data['column'])) ? 'total' : $discount_data['column'];\r\n\t\t\t$discount_data['calculation'] = (! isset($discount_data['calculation'])) ? 1 : $discount_data['calculation'];\r\n\t\t\t$discount_data['tax_method'] = (! isset($discount_data['tax_method'])) ? FALSE : $discount_data['tax_method'];\r\n\t\t\t$discount_data['void_reward_points'] = (! isset($discount_data['void_reward_points'])) ? FALSE : $discount_data['void_reward_points'];\r\n\t\t\t\r\n\t\t\t// Set the cart column the discount is targeting and use the value to act as the discounts array key. \r\n\t\t\t// This prevents multiple discounts being applied to the same cart column.\r\n\t\t\t$target_column = $discount_data['column'];\r\n\t\t\t\r\n\t\t\t// Loop through data and set to cart session summary.\r\n\t\t\tforeach($discount_data as $column => $column_value)\r\n\t\t\t{\r\n\t\t\t\tif ($column == 'value')\r\n\t\t\t\t{\r\n\t\t\t\t\t// If a valid discount value is not set, set the default value as zero. \r\n\t\t\t\t\t$column_value = ($this->non_negative($column_value)) ? $this->format_calculation($column_value, 2, TRUE) : 0;\r\n\t\t\t\t}\r\n\t\t\t\telse if ($column == 'column')\r\n\t\t\t\t{\r\n\t\t\t\t\t// If a valid column is not set, discount the 'total' column by default. \r\n\t\t\t\t\t$column_value = (in_array($column_value, array('item_summary_total', 'shipping_total', 'total'))) ? $column_value : 'total';\r\n\t\t\t\t}\r\n\t\t\t\telse if ($column == 'calculation') \r\n\t\t\t\t{\r\n\t\t\t\t\t// If a valid calculation method is not set, a 'percentage' based calculation is set by default.\r\n\t\t\t\t\t// 1 = Percentage Based, 2 = Flat Fee, 3 = New Value.\r\n\t\t\t\t\t$column_value = (in_array($column_value, array(1,2,3))) ? $column_value : 1;\r\n\t\t\t\t}\r\n\t\t\t\telse if ($column == 'tax_method')\r\n\t\t\t\t{\r\n\t\t\t\t\t// If a valid tax method is not set, the tax method is defined by whether cart prices ex/include taxes by default.\r\n\t\t\t\t\t// 0 = Carts Default Tax Method, 1 = Apply Tax Before Discount, 2 = Apply Discount Before Tax, 3 = Apply Discount Before Tax, Add Original Tax.\r\n\t\t\t\t\t$column_value = (in_array($column_value, array(0, 1,2,3))) ? $column_value : 0;\r\n\t\t\t\t}\r\n\t\t\t\telse if ($column == 'void_reward_points')\r\n\t\t\t\t{\r\n\t\t\t\t\t$column_value = (bool)$column_value;\r\n\t\t\t\t}\r\n\t\t\t\telse if (! in_array($column, array('id', 'description')))\r\n\t\t\t\t{\r\n\t\t\t\t\tcontinue;\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\t$this->flexi->cart_contents['settings']['discounts']['manual'][$target_column][$column] = $column_value;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\treturn TRUE;\r\n\t\t}\r\n\t\t\r\n\t\treturn FALSE;\r\n\t}", "public function applyDefaults()\n {\n $addressInfo = $this->_getDefaultAddress();\n $this->saveBilling(\n $addressInfo['billing'],\n $addressInfo['billing']['customer_address_id'],\n false\n );\n if (!$addressInfo['billing']['use_for_shipping']) {\n $this->saveShipping(\n $addressInfo['shipping'],\n $addressInfo['shipping']['customer_address_id'],\n false\n );\n }\n\n /**\n * @var Mage_Sales_Model_Quote\n */\n $quote = $this->getQuote();\n $shippingAddress = $quote->getShippingAddress();\n\n // weight vs destination fix\n $weight = 0;\n foreach($quote->getAllItems() as $item) {\n $weight += ($item->getWeight() * $item->getQty()) ;\n }\n $shippingAddress->setFreeMethodWeight($weight)->setWeight($weight);\n\n $shippingAddress->collectTotals()->collectShippingRates()->save();\n $this->applyShippingMethod();\n // shipping method may affect the total in both sides (discount on using shipping address)\n $quote->collectTotals();\n\n $ajaxHelper = Mage::helper('firecheckout/ajax');\n if ($ajaxHelper->getIsShippingMethodDependsOn('total')) {\n // changing total by shipping price may affect the shipping prices theoretically\n // (free shipping may be canceled or added)\n $shippingAddress->setCollectShippingRates(true)->collectShippingRates();\n // if shipping price was changed, we need to recalculate totals again.\n // Example: SELECTED SHIPPING METHOD NOW BECOMES FREE\n // previous method added a discount and selected shipping method wasn't free\n // but removing the previous shipping method removes the discount also\n // and selected shipping method is now free\n $quote->setTotalsCollectedFlag(false)->collectTotals();\n }\n\n $this->applyPaymentMethod();\n if ($ajaxHelper->getIsTotalDependsOn('payment-method')) { // @todo && method is changed\n // recollect totals again because adding/removing payment\n // method may add/remove some discounts in the order\n\n // to recollect discount rules need to clear previous discount\n // descriptions and mark address as modified\n // see _canProcessRule in Mage_SalesRule_Model_Validator\n $shippingAddress->setDiscountDescriptionArray(array())->isObjectNew(true);\n\n $quote->setTotalsCollectedFlag(false)->collectTotals();\n }\n\n $quote->save();\n\n return $this;\n }", "public function testSetGetDiscount()\n {\n $this->item->setPrice(85.00);\n $this->item->setQuantity(1);\n $this->item->addDiscount(\n (new FlatDiscount())\n ->setFigure(15.00)\n );\n\n $this->assertEquals($this->item->getPriceTotal(), 85.00);\n $this->assertEquals($this->item->getNetTotal(), 70.00);\n $this->assertEquals($this->item->getDiscount(), 15.00);\n }", "public function getBaseShippingDiscountAmount();", "public function setDiscountAmount($amount);", "public function setShippingAmount($amount);", "public function calculate_shipping($package){\n \n $calc = $this->distance * $this->priceperkm;\n $cost = round( $calc, 2 );\n \n if($cost < $this->minimumprice) {\n $cost = $this->minimumprice;\n }\n \n// Calculating the % of the unloading variable\n global $woocommerce;\n $cartsubtotal = $woocommerce->cart->cart_contents_total;\n $unloadingtotal = ( $this->unloadingprice / 100 ) * $cartsubtotal;\n \n $cost2 = $cost + $unloadingtotal;\n \n \n \n// Sending the final rate to the user \n $this->add_rate( \n array(\n 'id' => $this->id,\n 'label' => $this->title,\n 'cost' => $cost\n )\n );\n \n $this->add_rate(\n array(\n 'id' => $this->id2,\n 'label' => $this->title2,\n 'cost' => $cost2\n ) \n );\n }", "function setSyncItemsPriceAction()\n {\n }", "public function setDiscountDescription($description);", "private function calculateFOBPriceAction()\n {\n // than 99, then modify shippingPrice to 0.00 \n \t$price = $this->info['productPrice'];\n if($price <= 99){\n $shippingPrice = $this->info['shippingPrice'];\n }\n else{\n $this->info['shippingPrice'] = 0.0;\n }\n $this->info['fobPrice'] = ($price + $shippingPrice) * 1.07; // It also adds US TAXes\n }", "public function set_discount_defaults()\r\n\t{\r\n\t\t// Set array placeholders.\r\n\t\tif (! isset($this->flexi->cart_contents['settings']['discounts']['codes']))\r\n\t\t{\r\n\t\t\t$this->flexi->cart_contents['settings']['discounts']['codes'] = array();\r\n\t\t}\r\n\t\tif (! isset($this->flexi->cart_contents['settings']['discounts']['manual']))\r\n\t\t{\r\n\t\t\t$this->flexi->cart_contents['settings']['discounts']['manual'] = array();\r\n\t\t}\t\r\n\t\r\n\t\t// Reset other discount data.\r\n\t\t$this->flexi->cart_contents['settings']['discounts']['active_items'] = array();\r\n\t\t$this->flexi->cart_contents['settings']['discounts']['active_summary'] = array();\r\n\t\t$this->flexi->cart_contents['settings']['discounts']['reward_vouchers'] = array();\r\n\t\t$this->flexi->cart_contents['settings']['discounts']['data']['item_discount_savings'] = 0;\r\n\t\t$this->flexi->cart_contents['settings']['discounts']['data']['summary_discount_savings'] = 0;\r\n\t\t$this->flexi->cart_contents['settings']['discounts']['data']['reward_vouchers'] = 0;\r\n\t\t$this->flexi->cart_contents['settings']['discounts']['data']['void_reward_point_items'] = array();\r\n\r\n\t\tif (! isset($this->flexi->cart_contents['settings']['discounts']['data']['excluded_discounts']))\r\n\t\t{\r\n\t\t\t$this->flexi->cart_contents['settings']['discounts']['data']['excluded_discounts'] = array();\r\n\t\t}\t\r\n\t\t\r\n\t\treturn TRUE;\r\n\t}", "function es_cart_change_coupon_label( $html , $coupon){\n\n$html='Discount:';\n\nreturn $html;\n\n}", "public function actionUkrainepostShipping()\n {\n echo 20.14;\n }", "public function setPromotion($first,$second)\n {\n $this->promotion->setPromotion($first,$second);\n //product Id for identify products\n $this->promotion->setProductId($this->id);\n }", "public function define_dish_price() {\n\t\t\t$res = $this->Restaurant_model->define_price();\n\t\t\tif($res == 'suc_def') {\n\t\t\t\techo 'suc_def';\n\t\t\t}\n\t\t}", "function apply_cart_discounts_after_tax() {\t\n\t\t\t\n\t\t\tif ($this->applied_coupons) foreach ($this->applied_coupons as $code) :\n\t\t\t\t$coupon = new cmdeals_coupon( $code );\n\t\t\t\t\n\t\t\t\tdo_action( 'cmdeals_cart_discount_after_tax_' . $coupon->type, $coupon );\n\t\t\t\t\n\t\t\t\tif ( !$coupon->apply_before_tax() && $coupon->is_valid() ) :\n\t\t\t\t\t\n\t\t\t\t\tswitch ($coupon->type) :\n\t\t\t\t\t\n\t\t\t\t\t\tcase \"fixed_cart\" :\n\t\n\t\t\t\t\t\t\t$this->discount_total = $this->discount_total + $coupon->amount;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\n\t\t\t\t\t\tcase \"percent\" :\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t$percent_discount = (round( $this->cart_contents_total + $this->tax_total , 2) / 100 ) * $coupon->amount;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t$this->discount_total = $this->discount_total + $percent_discount;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\n\t\t\t\t\tendswitch;\n\t\n\t\t\t\tendif;\n\t\t\tendforeach;\n\t\t}", "function getDiscountFor($product) {\n\t\treturn 30;\n\t}", "public function setShippingDescription($description);", "public function setSameAsBillingShippingAddress()\n {\n $this->_rootElement->find($this->sameAsBilling, Locator::SELECTOR_CSS, 'checkbox')->hover();\n $this->browser->find($this->accountInformationBlock)->hover();\n $this->_rootElement->find($this->sameAsBilling, Locator::SELECTOR_CSS, 'checkbox')->setValue('Yes');\n }", "function apply_special_item_discount($id, $count, &$disc_amount) {\r\n switch($id) {\r\n case 99999:\r\n case 99998:\r\n if ($count > 100) {\r\n $disc_amount = 50; \r\n }\r\n break; \r\n case 99997:\r\n $disc_amount = 75;\r\n break; \r\n }\r\n }", "public function setDiscountAmount($value){\n return $this->setParameter('discount_amount', $value);\n }", "public function set_credits_discountamount($observer)\n {\n$array2 = Mage::helper('kartparadigm_storecredit')->getCreditRates();\n//Mage::log(Mage::helper('kartparadigm_storecredit')->getRefundDeductConfig() . \" configuration settings \");\n//Mage::log($array2);\n $session = Mage::getSingleton('checkout/session');\n if(Mage::helper('customer')->isLoggedIn()) {\n $customer = Mage::getSingleton('customer/session')->getCustomer();\n $customer_group=Mage::getModel('customer/group')->load(Mage::getSingleton('customer/session')->getCustomerGroupId())->getCustomerGroupCode();\n}\n \n$val1 = Mage::getSingleton('adminhtml/session')->getValue();\nif(isset($val1))\n{\n$amt1 = array();\n$amt1 = Mage::getSingleton('checkout/session')->getCredits();\n$amt = $amt1['totalCredits'];\n$quote = Mage::getSingleton('adminhtml/session_quote')->getQuote();\n}\nelse{\n$amt1 = array();\n $quote = Mage::getModel('checkout/cart')->getQuote();\n$amt1 = Mage::getSingleton('checkout/session')->getCredits();\n$amt = $amt1['discountCredits'];\n}\n $isvirtual=0;\n foreach($quote->getAllItems() as $item){\n if($item->getIsVirtual()==1) {\n $isvirtual=1;\n }\n if(Mage::getModel('catalog/product')->load($item->getProductId())->getTypeId()=='customproduct'){\n $isvirtual=1;\n }\n }\n$total=$quote->getGrandTotal(); \n\n$subTotal = $quote->getSubtotal();\n//Mage::log($quote->getGrandTotal().\"this is grand total store credit\");\n//Mage::log($quote->getSubtotal().\"this is sub total\");\n\n if (!Mage::helper('kartparadigm_storecredit')->getTaxEnabled()){\n$tax = $quote->getShippingAddress()->getData('tax_amount');\n}\n if(!Mage::helper('kartparadigm_storecredit')->getIsShippingEnabled()){\n$shippingPrice = $quote->getShippingAddress()->getShippingAmount();\n}\n$totalCredits1 = array();\n$totalCredits1 = Mage::getSingleton('checkout/session')->getCredits();\n$totalCredits = $totalCredits1['totalCredits'];\n\n$currentTimestamp = Mage::getModel('core/date')->timestamp(time()); \n$nowdate = date('Y-m-d H:m:s', $currentTimestamp); \n//echo $expirydate;\n//echo $nowdate;\n$balance;\n//echo $amt;\n$amt2;\n $amt1;\n \n\nif(isset($amt)){\n/*---------------------Calculating Default Currency Value----------------------- */\n$amt1 = ($array2['basevalue'] * $amt) / $array2['credits'];\n $baseCurrencyCode = Mage::app()->getStore()->getBaseCurrencyCode();\n $currentCurrencyCode = Mage::app()->getStore()->getCurrentCurrencyCode();\n if ($baseCurrencyCode != $currentCurrencyCode) {\n $amt2 = Mage::helper('directory')->currencyConvert($amt1, $baseCurrencyCode, $currentCurrencyCode);\n }\n else{\n $amt2 = $amt1; \n }\n // $amt2 = Mage::helper('core')->currency($amt1, true, false);\n//Mage::log($amt1.\" = amount = \".$amt2 );\n//----------------------------------------------------------------\nif($total > $amt2) {\nif(($total - $tax - $shippingPrice) > $amt2){\n$discountAmount = $amt2;\n$balance = $totalCredits - $amt;\n}else{\n $discountAmount = $subTotal;\n$points = round(($discountAmount * $amt)/$amt2);\n//Mage::log($points.\"Conver Points\");\n$balance = $totalCredits - $points;\n}\n}\nelse {\n$discountAmount = $total - $tax - $shippingPrice;\n$points = round(($discountAmount * $amt)/$amt2);\n//Mage::log($points.\"Conver Points\");\n$balance = $totalCredits - $points;\n}\nMage::getSingleton('core/session')->setBalance($balance);\n\nMage::getSingleton('checkout/session')->setDiscount($totalCredits - $balance);\n$msg = \"Current Credits In Your Account : \" . $balance;\nMage::getSingleton('core/session')->setCredits($msg);\n if ($discountAmount > 0) {\n\n\nif ($baseCurrencyCode != $currentCurrencyCode) {\n \n$allowedCurrencies = Mage::getModel('directory/currency')->getConfigAllowCurrencies();\n$rates = Mage::getModel('directory/currency')->getCurrencyRates($baseCurrencyCode, array_values($allowedCurrencies));\n\n$baseDiscount = $discountAmount/$rates[$currentCurrencyCode];\n\n }\nelse{\n $baseDiscount = $discountAmount;\n } \n $total = $quote->getBaseSubtotal();\n $data1 = $quote->getData();\n // Mage::log($data1['entity_id'].\"quote id\");\n $quote->setSubtotal(0);\n $quote->setBaseSubtotal(0);\n $quote->setSubtotalWithDiscount(0);\n $quote->setBaseSubtotalWithDiscount(0);\n $quote->setGrandTotal(0);\n $quote->setBaseGrandTotal(0);\n $canAddItems = $quote->isVirtual() ? ('billing') : ('shipping');\n foreach($quote->getAllAddresses() as $address) {\n $data = $address->getData();\n $address->setSubtotal(0);\n $address->setBaseSubtotal(0);\n $address->setGrandTotal(0);\n $address->setBaseGrandTotal(0);\n $address->collectTotals();\n $quote->setSubtotal((float)$quote->getSubtotal() + $address->getSubtotal());\n $quote->setBaseSubtotal((float)$quote->getBaseSubtotal() + $address->getBaseSubtotal());\n $quote->setSubtotalWithDiscount((float)$quote->getSubtotalWithDiscount() + $address->getSubtotalWithDiscount());\n $quote->setBaseSubtotalWithDiscount((float)$quote->getBaseSubtotalWithDiscount() + $address->getBaseSubtotalWithDiscount());\n $quote->setGrandTotal((float)$quote->getGrandTotal() + $address->getGrandTotal());\n $quote->setBaseGrandTotal((float)$quote->getBaseGrandTotal() + $address->getBaseGrandTotal());\n $quote->setEntityId($data1['entity_id'])->save();\n $quote->setSubtotalWithDiscount($quote->getSubtotal() - $discountAmount)->setBaseSubtotalWithDiscount($quote->getBaseSubtotal() - $baseDiscount)->setEntityId($data1['entity_id'])->save();\n if ($address->getAddressType() == $canAddItems) {\n $address->setSubtotalWithDiscount((float)$data['subtotal_with_discount'] - $discountAmount);\n $address->setGrandTotal((float)$data['grand_total'] - $discountAmount);\n $address->setBaseSubtotalWithDiscount((float)$data['base_subtotal_with_discount'] - $baseDiscount);\n $address->setBaseGrandTotal((float)$data['base_grand_total'] - $baseDiscount);\n if ($data['discount_description']) {\n $address->setDiscountAmount(($data['discount_amount'] - $discountAmount));\n $address->setDiscountDescription($data['discount_description'] . ', Store Credits');\n $address->setBaseDiscountAmount(($data['base_discount_amount'] - $baseDiscount));\n }\n else {\n $address->setDiscountAmount(-($discountAmount));\n $address->setDiscountDescription('Store Credits');\n $address->setBaseDiscountAmount(-($baseDiscount));\n }\n $address->setAddressId($data['address_id'])->save();\n }\n }\n foreach($quote->getAllItems() as $item) {\n\n // We apply discount amount based on the ratio between the GrandTotal and the RowTotal\n $rat = $item->getPriceInclTax() / $quote->getSubtotal();\n $rat1 = $item->getBasePriceInclTax() / $quote->getBaseSubtotal();\n $ratdisc = $discountAmount * $rat;\n $ratdisc1 = $baseDiscount * $rat1;\n//Mage::log($item->getDiscountAmount().\"include tax\".$item->getBaseDiscountAmount());\n // Mage::log($item->getDiscountAmount().\"discount storecredit\");\n$idata = $item->getData();\n Mage::log($item->getDiscountAmount().\"discount amount credit\");\n $item->setDiscountAmount(($item->getDiscountAmount() + $ratdisc) * $item->getQty());\n $item->setBaseDiscountAmount(($item->getBaseDiscountAmount() + $ratdisc1) * $item->getQty())->save();\n }\n }else if($totalCredits == 0){\n\n$msg = \"Sorry You Have No Credits In Your Account\";\nMage::getSingleton('core/session')->setCredits($msg);\n}\n \n \n } \n }", "public function setShipping($shipping);", "public function execute(\\Magento\\Framework\\Event\\Observer $observer)\n {\n $product = $observer->getProduct();\n $_pricePerPound = $product->getPricePerPound();\n if($_pricePerPound > 0){\n $weight = $product->getWeight() ? $product->getWeight() : 1;\n $_pricePerPound = str_replace(',', '', $_pricePerPound);\n $price = $_pricePerPound * $weight;\n $product->setPrice($price);\n }\n }", "public function setDiscountPercent(?string $value): void {\n $this->getBackingStore()->set('discountPercent', $value);\n }", "public function addShippingDiscountAmount($amount)\n {\n $this->shippingDiscountAmount += $amount;\n }", "public function setTaxInfo(KCommandContext $context)\n\t{\n\t\t$vats = $context->data->federal_tax;\n \n\t\t$this->getItem()->setFederalTax( KConfig::unbox( $vats ) );\n\t}", "private function setSoldIndividually() {\n $this->product->set_sold_individually($this->wcData->isSoldIndividually());\n }", "public function setDiscount(?float $discount): self\n {\n $this->initialized['discount'] = true;\n $this->discount = $discount;\n\n return $this;\n }", "function calc_extra_sp_cost($Discount = 1){\r\n\t$list = array('D','E','A');\r\n\tforeach($list as $v){\r\n\t\tif(preg_match('/CostSP<([0-9]+)>/',$this->Eq[$v]['spec'],$array)){\r\n\t\t\t$a = intval($array[1]);\r\n\t\t\t$this->SP_Cost += ceil($a * $Discount);\r\n\t\t}\r\n\t}\r\n}", "public function setDiscountRate($value){\n return $this->setParameter('discount_rate', $value);\n }", "function changeProduct($cart_table_id,$true_or_false)\n {\n $this->pdelivery[$cart_table_id]=$true_or_false; //change product group delivery\n }", "public function getShippingDiscountTaxCompensationAmount();", "public function setShippingAddressAction()\n {\n $data = $this->Request()->getParams();\n //we need to set this because of a bug in the shopware models\n if (!isset($data['stateId'])) {\n $data['stateId'] = 0;\n }\n\n /** @var Shopware\\Models\\Customer\\Customer $customerModel */\n $customerModel = Shopware()->Models()->find('Shopware\\Models\\Customer\\Customer', $data['userId']);\n\n if ($shippingAddressModel = $customerModel->getShipping()) {\n $shippingAddressModel->fromArray($data);\n\n Shopware()->Models()->persist($shippingAddressModel);\n Shopware()->Models()->flush();\n\n $this->view->assign(['shippingAddressId' => $shippingAddressModel->getId()]);\n }\n }", "function custom_template_single_shipping()\n {\n global $product;\n ?>\n <span class=\"shipping-cs-tag\">\n <span>Shipping:</span>\n <span>Free</span>\n </span>\n <?php\n }", "function pricing() {\n\t\t\tparent::controller();\n\t\t\t\n\t\t}", "public function setAttributes_discounted( $attributes_discounted ) {\n\t\t$this->attributes_discounted = $attributes_discounted;\n\t}", "public function update_shipping($shipping_id = FALSE, $location = FALSE, $discount_applied = FALSE)\r\n\t{\r\n\t\t// Check the shipping tables exist in the config file and are enabled.\r\n\t\tif ($this->get_enabled_status('shipping'))\r\n\t\t{\r\n\t\t\t$shipping_data = $this->get_database_shipping_data($shipping_id, $location, FALSE, FALSE, $discount_applied);\t\t\t\r\n\t\t\t\r\n\t\t\t// If a shipping discount is active, only return shipping options that can be discounted.\r\n\t\t\tif ($discount_applied && empty($shipping_data))\r\n\t\t\t{\r\n\t\t\t\treturn FALSE;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t// Set shipping data to cart array.\r\n\t\t\t$this->set_shipping_data($shipping_data);\r\n\t\t}\r\n\t\t\r\n\t\t###+++++++++++++++++++++++++++++++++###\r\n\t\t\r\n\t\t// If any items in the cart are configured to be shipped separately, calculate the additional rate to be added to the shipping rate.\r\n\t\tif (! empty($this->flexi->cart_contents['settings']['shipping']['data']['separate_shipping_items']))\r\n\t\t{\r\n\t\t\t$this->flexi->cart_contents['settings']['shipping']['data']['separate_shipping_value'] = $this->calculate_separate_shipping_items();\r\n\t\t}\r\n\t\t\r\n\t\t###+++++++++++++++++++++++++++++++++###\r\n\r\n\t\t### Calculate Shipping Rate\r\n\t\r\n\t\t// Set aliases of shipping charge values.\r\n\t\t$shipping_value = $this->flexi->cart_contents['settings']['shipping']['value'];\r\n\t\t$shipping_tax_rate = $this->flexi->cart_contents['settings']['shipping']['tax_rate'];\r\n\t\t$shipping_surcharge = $this->flexi->cart_contents['settings']['shipping']['data']['surcharge'];\r\n\t\t$separate_shipping_value = $this->flexi->cart_contents['settings']['shipping']['data']['separate_shipping_value'];\r\n\r\n\t\t// Get total number of cart items, free shipping items and items being shipped separately.\r\n\t\t$total_cart_items = $this->flexi->cart_contents['summary']['total_items'];\r\n\t\t$total_free_items = $this->flexi->cart_contents['settings']['shipping']['data']['free_items'];\r\n\t\t$total_separate_items = $this->flexi->cart_contents['settings']['shipping']['data']['separate_items'];\r\n\t\t\r\n\t\t// Add together relevant shipping charges.\r\n\t\tif ($total_cart_items == $total_free_items)\r\n\t\t{\r\n\t\t\t$shipping_total = 0;\r\n\t\t}\r\n\t\telse if ($total_cart_items == $total_separate_items || $total_cart_items == ($total_separate_items + $total_free_items))\r\n\t\t{\r\n\t\t\t$shipping_total = $separate_shipping_value;\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t$shipping_total = ($shipping_value + $separate_shipping_value);\r\n\t\t}\r\n\t\t\r\n\t\t$shipping_total += $shipping_surcharge;\r\n\r\n\t\t// Calculate shipping rate tax data to obtain the shipping rate excluding tax.\r\n\t\t$shipping_tax_data = $this->calculate_tax($shipping_total, $shipping_tax_rate);\r\n\t\t\r\n\t\t// Set the total shipping rate including any set shipping surcharge.\r\n\t\t$this->flexi->cart_contents['summary']['shipping_total'] = $this->format_calculation($shipping_tax_data['value_ex_tax']);\r\n\t\t\r\n\t\treturn TRUE;\r\n\t}", "public static function update_item_with_discount($detail_id,$order_promotion,$order_discount_id,$order_discount_amt){\r\tif(is_gt_zero_num($detail_id)){\r\t\t$objtbl_order_details=new tbl_order_details();\r\t\tif($objtbl_order_details->readObject(array(ORD_DTL_ID=>$detail_id))){\r\t\t\t$objtbl_order_details->setordprom_promotion($order_promotion);\r\t\t\t$objtbl_order_details->setordprom_discount_id($order_discount_id);\r\t\t\t$objtbl_order_details->setordprom_discount_amt($order_discount_amt);\r\t\t\t$objtbl_order_details->insert();\r\t\t\treturn 1;\r\t\t}\r\t\tunset($objtbl_order_details);\t\r\t} \r\treturn 0;\t\r }", "protected function setOfferValue ()\n {\n $this->request->coupon_benefits[ $this->offerNature ] = $this->offer->rate;\n }", "public function setDiscount($var)\n {\n GPBUtil::checkDouble($var);\n $this->discount = $var;\n\n return $this;\n }", "public function setShippingValues(Order $order): void;", "public function setBaseDiscountAmount($amount);", "function ycb_add_discount_badge($content, $post, $product){\r\n global $ycb_using_flatsome;\r\n\r\n $ycb_settings = ycb_get_settings();\r\n\r\n //var_dump(get_class_methods($product));\r\n $base_price = $product->get_regular_price();\r\n $discount_price = $product->get_sale_price();\r\n\r\n if($product->is_type( 'variable' )){\r\n $variations = $product->get_available_variations();\r\n if(isset($variations[0])){\r\n $variation = $variations[0];\r\n $base_price = $variation[\"display_regular_price\"];\r\n $discount_price = $variation[\"display_price\"];\r\n }\r\n }\r\n\r\n if(class_exists(\"WC_Dynamic_Pricing\")){\r\n $discount_price = apply_filters(\"woocommerce_product_get_price\", $base_price, $product, false);\r\n }\r\n\r\n $percentage = round( ( ( floatval($base_price) - floatval($discount_price) ) / (floatval($base_price) > 0 ? floatval($base_price) : 1) ) * 100 );\r\n\r\n $sale_style = ycb_get_styles($ycb_settings, $percentage);\r\n $inner_content = \"-\" . $percentage . \"%\";\r\n $filtered_content = apply_filters('ycb_discount_badge_override_hook', $inner_content);\r\n $sale_tag = \"<span class='onsale ycb_on_sale yoohoo_badge \".ycb_get_badge_shape_class(false, $ycb_settings).\"' style='$sale_style'>\" . $filtered_content . \"</span>\";\r\n\r\n $force_remove_internal_tag = apply_filters('ycb_hide_internal_sale_tag', true, $ycb_settings);\r\n if(!$force_remove_internal_tag){\r\n $sale_tag = \"\";\r\n }\r\n\r\n $hide_sale_tag = isset($ycb_settings['ycb_hide_default_sale_tag']) && $ycb_settings['ycb_hide_default_sale_tag'] === \"true\" ? true : false;\r\n\r\n if($hide_sale_tag){\r\n $content = $sale_tag;\r\n } else {\r\n $content .= $sale_tag;\r\n }\r\n\r\n if($percentage > 0){\r\n if($hide_sale_tag){\r\n if($ycb_using_flatsome){\r\n ycb_custom_badge_hide_woo_sales_badge_on_page(true);\r\n $content .= $sale_tag;\r\n } else {\r\n $content = $sale_tag;\r\n }\r\n } else {\r\n $content .= $sale_tag;\r\n }\r\n }\r\n\r\n //$content = apply_filters(\"ycb_discount_badge_internal_filter\", $content, $product, $hide_sale_tag, $ycb_settings);\r\n\r\n return $content;\r\n}", "public function setDiscount($discount)\r\n {\r\n $this->discount = $discount;\r\n\r\n return $this;\r\n }", "public function setDiscount($value)\n {\n $this->data->amount->subtotals->discount = (float) $value;\n\n return $this;\n }", "public function calculate_shipping_total($discount_data)\r\n\t{\r\n\t\t// Calculate item shipping rates.\r\n\t\t$item_shipping_discount_status = $this->calculate_shipping_items($discount_data, TRUE);\r\n\t\t\r\n\t\t// Check if there is a valid summary 'shipping total' discount available.\r\n\t\t$ship_discount_data = $this->validate_summary_discount($discount_data['shipping_total'], $this->flexi_cart->item_summary_total(TRUE, FALSE, TRUE));\r\n\t\t\t\t\r\n\t\t// If a discount is set, check whether it is set to 'force' the discount against available shipping options, regardless of if they are set as discountable.\r\n\t\t$force_shipping_discount = (isset($ship_discount_data['force_shipping_discount'])) ? $ship_discount_data['force_shipping_discount'] : FALSE;\r\n\t\t\r\n\t\t// Set a status as whether to lookup only discountable shipping options.\r\n\t\t$shipping_discount_status = (! $force_shipping_discount && ($ship_discount_data || $item_shipping_discount_status));\r\n\t\t\r\n\t\t// Update shipping details in cart session.\r\n\t\t// If a shipping discount is active, try to match a shipping option rate which accepts discounts.\r\n\t\tif (! $this->update_shipping($this->flexi_cart->shipping_id(), $this->flexi_cart->shipping_location_data(), $shipping_discount_status))\r\n\t\t{\r\n\t\t\t// If no discountable shipping options are returned, then the shipping discount cannot be applied, therefore unset any discount data.\r\n\t\t\t$ship_discount_data = FALSE;\r\n\t\t\t\r\n\t\t\t// If item shipping discounts were applied, recalculate the item shipping costs with only 'forced' item shipping discounts applied.\r\n\t\t\tif ($item_shipping_discount_status)\r\n\t\t\t{\t\t\t\r\n\t\t\t\t$this->calculate_shipping_items($discount_data, FALSE);\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t$this->update_shipping($this->flexi_cart->shipping_id(), $this->flexi_cart->shipping_location_data());\r\n\t\t}\r\n\t\t\r\n\t\treturn $ship_discount_data;\r\n\t}", "public function savePostAction() {\n $isNeedCreateLabel = '';\n try {\n $updateOrderId = $this->getRequest ()->getParam ( 'order_id' );\n /**\n * Get marketplace commission details\n */\n $collection = Mage::getModel ( 'marketplace/commission' )->getCollection ()->addFieldToFilter ( 'seller_id', Mage::getSingleton ( 'customer/session' )->getId () )->addFieldToFilter ( 'order_id', $updateOrderId )->getFirstItem ();\n /**\n * Checking manage order enable for seller\n */\n $orderStatusFlag = Mage::getStoreConfig ( 'marketplace/admin_approval_seller_registration/order_manage' );\n /**\n * Checking for seller order management enable or not\n */\n if (count ( $collection ) <= 0 || $orderStatusFlag != 1) {\n $this->_getSession ()->addError ( $this->__ ( 'You do not have permission to access this page' ) );\n $this->_redirect ( 'marketplace/order/vieworder/orderid/' . $updateOrderId );\n return;\n }\n /**\n * Get shipment info\n */\n $data = $this->getRequest ()->getParam ( 'shipment' );\n $shipment = $this->_initShipment ();\n if (! $shipment) {\n $this->_forward ( 'noRoute' );\n return;\n }\n /**\n * Register shipment\n */\n $shipment->register ();\n $comment = '';\n if (! empty ( $data ['comment_text'] )) {\n $shipment->addComment ( $data ['comment_text'], isset ( $data ['comment_customer_notify'] ), isset ( $data ['is_visible_on_front'] ) );\n if (isset ( $data ['comment_customer_notify'] )) {\n $comment = $data ['comment_text'];\n }\n }\n $shipment->setEmailSent ( true );\n /**\n * Set customer notify.\n */\n $shipment->getOrder ()->setCustomerNoteNotify ( true );\n $responseAjax = new Varien_Object ();\n $isNeedCreateLabel = isset ( $data ['create_shipping_label'] ) && $data ['create_shipping_label'];\n if ($isNeedCreateLabel && $this->_createShippingLabel ( $shipment )) {\n $responseAjax->setOk ( true );\n }\n /**\n * Save shipment\n */\n $this->_saveShipment ( $shipment );\n\n /**\n * Send shipment email\n */\n $shipment->sendEmail ( true, $comment );\n /**\n * Initilize shipment label\n */\n $shipmentCreatedMessage = $this->__ ( 'The shipment has been created.' );\n $labelCreatedMessage = $this->__ ( 'The shipping label has been created.' );\n $savedQtys = $this->_getItemQtys ();\n Mage::getModel ( 'marketplace/order' )->updateSellerOrderItemsBasedOnSellerItems ( $savedQtys, $updateOrderId, 0 );\n $this->_getSession ()->addSuccess ( $isNeedCreateLabel ? $shipmentCreatedMessage . ' ' . $labelCreatedMessage : $shipmentCreatedMessage );\n } catch ( Mage_Core_Exception $e ) {\n /**\n * Thorugh the exception error message.\n */\n if ($isNeedCreateLabel) {\n $responseAjax->setError ( true );\n $responseAjax->setMessage ( $e->getMessage () );\n } else {\n /**\n * When error occured, redirect to the view order page.\n */\n $this->_getSession ()->addError ( $e->getMessage () );\n $this->_redirect ( 'marketplace/order/vieworder/orderid/' . $updateOrderId );\n }\n } catch ( Exception $e ) {\n Mage::logException ( $e );\n if ($isNeedCreateLabel) {\n $responseAjax->setError ( true );\n $responseAjax->setMessage ( /**\n * Through error when create shipping label.\n */\n Mage::helper ( 'sales' )->__ ( 'An error occurred while creating shipping label.' ) );\n } else {\n $this->_getSession ()->addError ( $this->__ ( 'Cannot save shipment.' ) );\n $this->_redirect ( 'marketplace/order/vieworder/orderid/' . $updateOrderId );\n }\n }\n if ($isNeedCreateLabel) {\n $this->getResponse ()->setBody ( $responseAjax->toJson () );\n } else {\n /**\n * Redirect to the view order page.\n */\n $this->_redirect ( 'marketplace/order/vieworder/orderid/' . $updateOrderId );\n }\n }", "public function execute(Observer $observer)\n {\n $item = $observer->getEvent()->getData('quote_item');\n $item = ($item->getParentItem() ? $item->getParentItem() : $item);\n $price = $item->getProduct()->getPriceInfo()->getPrice('final_price')->getValue();\n $new_price = $price - ($price * 50 / 100); //discount the price of the product to 50%\n $item->setCustomPrice($new_price);\n $item->setOriginalCustomPrice($new_price);\n $item->getProduct()->setIsSuperMode(true);\n }", "function apply_deals_discounts_after_tax( $values, $price ) {\n\t\t\t\n\t\t\tif ($this->applied_coupons) foreach ($this->applied_coupons as $code) :\n\t\t\t\t$coupon = new cmdeals_coupon( $code );\n\t\t\t\t\n\t\t\t\tdo_action( 'cmdeals_deals_discount_after_tax_' . $coupon->type, $coupon );\n\t\t\t\t\n\t\t\t\tif ($coupon->type!='fixed_deals' && $coupon->type!='percent_deals') continue;\n\t\t\t\t\n\t\t\t\tif ( !$coupon->apply_before_tax() && $coupon->is_valid() ) :\n\t\t\t\t\t\n\t\t\t\t\t$this_item_is_discounted = false;\n\t\t\n\t\t\t\t\t// Specific deals ID's get the discount\n\t\t\t\t\tif (sizeof($coupon->deal_ids)>0) :\n\t\t\t\t\t\t\n\t\t\t\t\t\tif ((in_array($values['deal_id'], $coupon->deal_ids) || in_array($values['variation_id'], $coupon->deal_ids))) :\n\t\t\t\t\t\t\t$this_item_is_discounted = true;\n\t\t\t\t\t\tendif;\n\t\t\t\t\t\n\t\t\t\t\telse :\n\t\t\t\t\t\t\n\t\t\t\t\t\t// No deals ids - all items discounted\n\t\t\t\t\t\t$this_item_is_discounted = true;\n\t\t\t\t\t\n\t\t\t\t\tendif;\n\t\t\n\t\t\t\t\t// Specific deals ID's excluded from the discount\n\t\t\t\t\tif (sizeof($coupon->exclude_deals_ids)>0) :\n\t\t\t\t\t\t\n\t\t\t\t\t\tif ((in_array($values['deal_id'], $coupon->exclude_deals_ids) || in_array($values['variation_id'], $coupon->exclude_deals_ids))) :\n\t\t\t\t\t\t\t$this_item_is_discounted = false;\n\t\t\t\t\t\tendif;\n\t\t\t\t\t\t\n\t\t\t\t\tendif;\n\t\t\t\t\t\n\t\t\t\t\t// Apply filter\n\t\t\t\t\t$this_item_is_discounted = apply_filters( 'cmdeals_item_is_discounted', $this_item_is_discounted, $values, $before_tax = false );\n\t\t\t\t\t\n\t\t\t\t\t// Apply the discount\n\t\t\t\t\tif ($this_item_is_discounted) :\n\t\t\t\t\t\tif ($coupon->type=='fixed_deals') :\n\t\t\t\t\t\t\n\t\t\t\t\t\t\tif ($price < $coupon->amount) :\n\t\t\t\t\t\t\t\t$discount_amount = $price;\n\t\t\t\t\t\t\telse :\n\t\t\t\t\t\t\t\t$discount_amount = $coupon->amount;\n\t\t\t\t\t\t\tendif;\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t$this->discount_total = $this->discount_total + ( $discount_amount * $values['quantity'] );\n\t\t\t\t\t\t\t\n\t\t\t\t\t\telseif ($coupon->type=='percent_deals') :\n\t\t\t\t\t\t\t$this->discount_total = $this->discount_total + ( $price / 100 ) * $coupon->amount;\n\t\t\t\t\t\tendif;\n\t\t\t\t\tendif;\n\t\t\t\t\t\n\t\t\t\tendif;\n\t\t\tendforeach;\n\t\t}", "function wpsp_tour_price( $price, $is_promote = false, $percentage ) {\n \n if ( empty( $price ) ) \n return;\n\n $regular_price = $price;\n printf( '<span class=\"label\">%s</span>', esc_html__( 'Per person', 'discovertravel' ) );\n \n if ( $is_promote == 'on' ) {\n \t$discount_price = ($regular_price / 100) * $percentage;\n \t$sale_price = $regular_price - $discount_price;\n \tprintf('<del><span class=\"amount\"><sup>$</sup>%1$s</span></del><ins><span class=\"on-sale\">%2$s</span></ins><ins><span class=\"amount\"><sup>$</sup>%3$s</span></ins>', \n \t\t\t$regular_price,\n \t\t\t$percentage . esc_html__( '% Off', 'discovertravel' ),\n \t\t\t$sale_price\n \t\t);\n } else {\n \tprintf('<ins><span class=\"amount\"><sup>$</sup>%1$s</span></ins>', \n \t\t\t$regular_price\n \t\t);\n }\n}", "function adjust_shipping_rate($rates)\n{\n foreach ($rates as $rate) {\n if ($rate->id === 'cdek_shipping_method') {\n if (isset($_COOKIE['shipping_city_cost'])) {\n $rate->cost = $_COOKIE['shipping_city_cost'];\n $rate->label = $_COOKIE['shipping_name'];\n }\n }\n }\n return $rates;\n}", "public function salesQuoteProductAddAfter($observer)\r\n\t{\r\n\t\t$items = $observer['items'];\t\t\r\n\t\tif(Mage::getModel('checkout/session')->getData('shoppingcart_gift_item')\r\n\t\t ||Mage::getModel('checkout/session')->getData('free_gift_item') \r\n\t\t || Mage::getModel('checkout/session')->getData('promotionalgift_bundle')){\r\n\t\t\tforeach($items as $item){\r\n\t\t\t\t$item->setCustomPrice(0);\r\n\t\t\t\t$item->setOriginalCustomPrice(0);\r\n\t\t\t\t$item->getProduct()->setIsSuperMode(true);\t\r\n\t\t\t}\r\n\t\t\treturn $this;\r\n\t\t}\t\t\t\r\n\t}", "private function calculate_summary_discount($discount_data, $taxable_value_ex_tax = 0, $non_taxable_value = 0, $tax_value = 0, $tax_rate = FALSE, \r\n\t\t$append_values = TRUE, $target_column = FALSE)\r\n\t{\r\n\t\t// Only allow 'New Value' discounts to be applied to the shipping rate, otherwise a cart of unlimited items could be sold for the 'New Value'.\r\n\t\tif (empty($discount_data) || (isset($discount_data['calculation_id']) && $discount_data['calculation_id'] == 3 && $target_column != 'shipping')\r\n\t\t)\r\n\t\t{\r\n\t\t\treturn FALSE;\r\n\t\t}\r\n\t\t\r\n\t\t// Calculate the non discounted summary total.\r\n\t\t$non_discounted_total = ($this->flexi_cart->cart_prices_inc_tax()) ? \r\n\t\t\tround(($taxable_value_ex_tax + $non_taxable_value + $tax_value), 2) : round(($taxable_value_ex_tax + $non_taxable_value), 2);\r\n\r\n\t\t// Calculate discount value.\r\n\t\t$discount = $this->calculate_discount(\r\n\t\t\t$discount_data['value_discounted'], $taxable_value_ex_tax, $non_taxable_value, $tax_value, $tax_rate,\r\n\t\t\t$discount_data['calculation_id'], $discount_data['tax_method']\r\n\t\t);\r\n\t\t\r\n\t\t// If a 'new value' shipping discount has been set that costs more than the original value, recalculate the 'new value' to equal the original value.\r\n\t\tif (($target_column == 'shipping' && $discount_data['calculation_id'] == 3) && ($discount['total'] > $non_discounted_total))\r\n\t\t{\r\n\t\t\t$discount = $this->calculate_discount(\r\n\t\t\t\t$non_discounted_total, $taxable_value_ex_tax, $non_taxable_value, $tax_value, $tax_rate,\r\n\t\t\t\t$discount_data['calculation_id'], $discount_data['tax_method']\r\n\t\t\t);\r\n\t\t}\r\n\t\t\t\t\r\n\t\t// Check discount value is set and is not more than the target column value, else it would result in a negative value.\r\n\t\tif ($discount && ($non_discounted_total >= $discount['total']))\r\n\t\t{\r\n\t\t\t$discount['non_combinable'] = (bool)$discount_data['non_combinable'];\r\n\t\t\t$discount['void_reward_points'] = (bool)$discount_data['void_reward_points'];\r\n\t\t\t\t\r\n\t\t\t// Calculate discount value and discount tax.\r\n\t\t\t$discount['value'] = ($discount['tax_method'] == 1) ? ($non_discounted_total - $discount['total']) : \r\n\t\t\t\t(($taxable_value_ex_tax + $non_taxable_value) - ($discount['taxable_value'] + $discount['non_taxable_value']));\r\n\t\t\t$discount['discount_tax'] = ($discount['value'] - ($taxable_value_ex_tax - $discount['taxable_value']) > 0) ?\r\n\t\t\t\t($discount['value'] - ($taxable_value_ex_tax - $discount['taxable_value'])) : 0;\r\n\r\n\t\t\tif ($target_column != 'reward_vouchers')\r\n\t\t\t{\r\n\t\t\t\t// Update summary discount data.\r\n\t\t\t\t$this->flexi->cart_contents['settings']['discounts']['data']['summary_discount_savings'] += $discount['value'];\t\r\n\t\t\t\t$this->flexi->cart_contents['settings']['tax']['data']['summary_discount_tax'] += $discount['discount_tax'];\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\t// Update reward voucher data.\r\n\t\t\t\t$this->flexi->cart_contents['settings']['discounts']['data']['reward_vouchers'] += $discount['value'];\t\r\n\t\t\t\t$this->flexi->cart_contents['settings']['tax']['data']['reward_voucher_tax'] += $discount['discount_tax'];\r\n\t\t\t}\t\t\t\t\r\n\t\t\t\r\n\t\t\t// Update tax columns.\r\n\t\t\tif ($append_values)\r\n\t\t\t{\r\n\t\t\t\t$this->flexi->cart_contents['settings']['tax']['data']['cart_tax'] += $discount['tax_value'];\r\n\t\t\t\t$this->flexi->cart_contents['settings']['tax']['data']['cart_taxable_value'] += $discount['taxable_value'];\r\n\t\t\t\t$this->flexi->cart_contents['settings']['tax']['data']['cart_non_taxable_value'] += $discount['non_taxable_value'];\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\t$this->flexi->cart_contents['settings']['tax']['data']['cart_tax'] = $discount['tax_value'];\r\n\t\t\t\t$this->flexi->cart_contents['settings']['tax']['data']['cart_taxable_value'] = $discount['taxable_value'];\r\n\t\t\t\t$this->flexi->cart_contents['settings']['tax']['data']['cart_non_taxable_value'] = $discount['non_taxable_value'];\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\treturn $discount;\r\n\t\t}\r\n\t\t\r\n\t\treturn FALSE;\r\n\t}", "function beforeSave(){\n\t\t\t// Get the rate\n\t\t\t$rate = 1 / $this->_getRate();\n\n\t\t\t// Convert it back to USD\n\t\t\tif(!empty($this->data['Product']['rrp'])){\n\t\t\t\t$this->data['Product']['rrp'] = $this->data['Product']['rrp'] * $rate;\n\t\t\t}\n\n\t\t\tif(!empty($this->data['Product']['start_price'])){\n\t\t\t\t$this->data['Product']['start_price'] \t= $this->data['Product']['start_price'] * $rate;\n\t\t\t}\n\n\t\t\tif(!empty($this->data['Product']['delivery_cost'])){\n\t\t\t\t$this->data['Product']['delivery_cost'] = $this->data['Product']['delivery_cost'] * $rate;\n\t\t\t}\n\n\t\t\tif(!empty($this->data['Product']['fixed_price'])){\n\t\t\t\t$this->data['Product']['fixed_price'] \t= $this->data['Product']['fixed_price'] * $rate;\n\t\t\t}\n\n\t\t\tif(!empty($this->data['Product']['minimum_price'])){\n\t\t\t\t$this->data['Product']['minimum_price'] = $this->data['Product']['minimum_price'] * $rate;\n\t\t\t}\n\n\t\t\treturn true;\n\t\t}", "public function getShippingDiscountAmount()\n {\n return $this->shippingDiscountAmount;\n }", "public function catalog_product_save_after($observer)\n {\n $_product = $observer->getProduct();\n $specialPrice = null;\n\n if($_product->getTypeId() == 'grouped') {\n $arrayPrices = array();\n\n $associatedProducts = $_product->getTypeInstance(true)->getAssociatedProducts($_product);\n foreach($associatedProducts as $associatedProduct) {\n $arrayPrices[] = round($associatedProduct->getPrice(), 2);\n }\n asort($arrayPrices);\n $price = array_shift($arrayPrices);\n } else {\n if($_product->getTypeId() == 'bundle') {\n //Zend_Debug::dump($_product->getData());exit;\n $selectionCollection = $_product->getTypeInstance(true)->getSelectionsCollection(\n $_product->getTypeInstance(true)->getOptionsIds($_product), $_product\n );\n\n foreach($selectionCollection as $option) {\n $bundled_prices[]=$option->getPrice();\n }\n\n sort($bundled_prices);\n\n $min_price=$bundled_prices[0];\n $price = $min_price;\n } else {\n $price = $_product->getData('price');\n $specialPrice = $_product->getData('special_price');\n }\n\n }\n\n\n if ($specialPrice != null) {\n $santanderPriceMonth = Mage::helper('santander')->getPricePerMonth($specialPrice);\n } else {\n $santanderPriceMonth = Mage::helper('santander')->getPricePerMonth($price);\n }\n Mage::getSingleton('catalog/product_action')->updateAttributes(array($_product->getEntityId()), array('santanderpricemonth' => \"$santanderPriceMonth\"), 1);\n }", "protected function setPricing($display) {\r\n\t\t\tswitch($display) {\r\n\t\t\t\tcase 0 : $this->_pricing = 'emptyStore';\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase 1 : $this->_pricing = 'newStore';\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase 2 : $this->_pricing = 'greenStore';\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase 3 : $this->_pricing = 'completeStore';\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tdefault: $this->_pricing = 'emptyStore';\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}", "public function set_coupon_discount_totals( $value = array() ) {\n\t\t$this->coupon_discount_totals = (array) $value;\n\t}", "public function getDiscountAmount();", "public function setDiscountDateCalculation(?string $value): void {\n $this->getBackingStore()->set('discountDateCalculation', $value);\n }", "public function setDiscountUid(?string $discountUid): void\n {\n $this->discountUid = $discountUid;\n }", "public function onCheckoutCartEstimatePost($observer)\n {\n $quote = Mage::helper('shipperhq_shipper')->getQuote();\n $quote->setIsMultiShipping(false);\n $shipping = $quote->getShippingAddress();\n $shipping->setIsCheckout(0);\n $shipping->save();\n }", "public function Mytestmethod( $observer )\n {\n $item = $observer->getQuoteItem();\n $qty = $item->getQty();\n $productId = $item->getProductId();\n $helper = Mage::helper( 'catalog/product_configuration' );\n $productModel = Mage::getModel( 'catalog/product' );\n //$attr = $productModel->getResource()->getAttribute('Size');\n $maal = $helper->getOptions( $item );\n $attribute_model = Mage::getModel( 'eav/entity_attribute' );\n $superAttr = array();\n $options = array();\n //Mage::log('all options');\n //Mage::log($item->getItemId());\n\n foreach( $maal as $key ) {\n $count = count( $key );\n if( $count < 2 ) {\n //Mage::log( 'fucker' );\n }\n if( $count > 2 ) {\n $labelcode = $key['option_id'];\n $valuecode = $key['value'];\n //$arr =$arrayName = array( $labelcode =>$valuecode);\n //array_push($superAttr,$arr);\n $options[$labelcode] = $valuecode;\n } else {\n $label = $key['label'];\n $labelcode = $attribute_model->getIdByCode( 'catalog_product', $label );\n $value = $key['value'];\n $attr = $productModel->getResource()->getAttribute( $label );\n if( $attr->usesSource() ) {\n $valuecode = $attr->getSource()->getOptionId( $value );\n //$arr =$arrayName = array( $labelcode =>$valuecode);\n //array_push($options,$arr);\n $superAttr[$labelcode] = $valuecode;\n }\n }\n }\n $final = array(\n 'super_attribute' => $superAttr,\n 'options' => $options \n );\n $final2 = http_build_query( $final );\n $coup = Mage::helper( 'webengage_coup' )->couponPost();\n $final3 = 'qty=' . $qty . '&' . 'product=' . $productId . '&' . $final2;\n //$attr = $productModel->getResource()->getAttribute('Test Custom Options');\n //$valuecode = $attr->getSource()->getOptionId('model 2');\n ////Mage::log($valuecode);\n $_SESSION['raku'] = $final3 . '&coup=' . $coup;\n }", "public function addBaseShippingDiscountAmount($amount)\n {\n $this->baseShippingDiscountAmount +=$amount;\n }", "public function setNoMultiShipping(){\n $emptyCache = false;\n $db = JFactory::getDBO();\n if (JeproshopSettingModelSetting::getValue('allow_multi_shipping')){\n // Upgrading quantities\n $query = \"SELECT sum(\" . $db->quoteName('quantity') . \") AS quantity, product_id, product_attribute_id, count(*) as count FROM \";\n $query .= $db->quoteName('#__jeproshop_cart_product') . \" WHERE \" . $db->quoteName('cart_id') . \" = \" . (int)$this->cart_id . \" AND \" ;\n $query .= $db->quoteName('shop_id') . \" = \" . (int)$this->shop_id . \" GROUP BY product_id, product_attribute_id HAVING count > 1\";\n\n $db->setQuery($query);\n $products = $db->loadObjectList();\n\n foreach ($products as $product){\n $query = \"UPDATE \" . $db->quoteName('#__jeproshop_cart_product') . \" SET \" . $db->quoteName('quantity') . \" = \" . $product->quantity;\n $query .= \"\tWHERE \" . $db->quoteName('cart_id') . \" = \".(int)$this->cart_id . \" AND \" . $db->quoteName('shop_id') . \" = \" . (int)$this->shop_id ;\n $query .= \" AND product_id = \" . $product->product_id . \" AND product_attribute_id = \" . $product->product_attribute_id;\n $db->setQuery($query);\n if ($db->query())\n $emptyCache = true;\n }\n\n // Merging multiple lines\n $query = \"DELETE cart_product_1 FROM \" . $db->quoteName('#__jeproshop_cart_product') . \" AS cart_product_1 INNER JOIN \";\n $query .= $db->quoteName('#__jeproshop_cart_product') . \" AS cart_product_2 ON ((cart_product_1.cart_id = cart_product_2.\";\n $query .= \"cart_id) AND (cart_product_1.product_id = cart_product_2.product_id) AND (cart_product_1.product_attribute_id = \";\n $query .= \"cart_product_2.product_attribute_id) AND (cart_product_1.address_delivery_id <> cart_product_2.address_delivery_id) \";\n $query .= \" AND (cart_product_1.date_add > cart_product_2.date_add) )\";\n $db->setQuery($query);\n $db->query();\n }\n\n // Update delivery address for each product line\n $query = \"UPDATE \" . $db->quoteName('#__jeproshop_cart_product') . \" SET \" . $db->quoteName('address_delivery_id') . \" = ( SELECT \";\n $query .= $db->quoteName('address_delivery_id') . \" FROM \" . $db->quoteName('#__jeproshop_cart') . \" WHERE \" . $db->quoteName('cart_id');\n $query .= \" = \" . (int)$this->cart_id . \" AND \" . $db->quoteName('shop_id') . \" = \" . (int)$this->shop_id . \") WHERE \" . $db->quoteName('cart_id');\n $query .= \" = \" . (int)$this->cart_id . (JeproshopSettingModelSetting::getValue('allow_multi_shipping') ? \" AND \" . $db->quoteName('shop_id') . \" = \" .(int)$this->shop_id : \"\");\n\n $db->setQuery($query);\n\n $cache_id = 'jeproshop_cart_set_no_multi_shipping'.(int)$this->cart_id.'_'.(int)$this->shop_id .((isset($this->address_delivery_id) && $this->address_delivery_id) ? '-'.(int)$this->address_delivery_id : '');\n if (!JeproshopCache::isStored($cache_id)){\n $db->setQuery($query);\n if ($result = (bool)$db->query())\n $emptyCache = true;\n JeproshopCache::store($cache_id, $result);\n }\n\n if (JeproshopCustomization::isFeaturePublished()){\n //Db::getInstance()->execute(\n\t\t\t$query = \" UPDATE \" . $db->quoteName('#__jeproshop_customization') . \" SET \" . $db->quoteName('address_delivery_id') . \" = ( SELECT \";\n $query .= $db->quoteName('address_delivery_id') . \" FROM \" . $db->quoteName('#__jeproshop_cart') . \" WHERE \" . $db->quoteName('cart_id');\n $query .= \" = \" . (int)$this->cart_id . \" ) WHERE \" . $db->quoteName('cart_id') . \" = \" .(int)$this->cart_id;\n\n $db->setQuery($query);\n $db->query();\n }\n if ($emptyCache){\n $this->_products = null;\n }\n }", "public function setBaseShippingAmount($amount);", "function get_item_shipping() {\n\t}", "public function getCartShippingMethod()\n {\n }", "public function createRule($rand_code, $expiration_time, $discount_type, $discount_amount, $allow_free_shipping, $stop_further_discount)\n {\n try {\n $customer_groups = $this->getCustomerGroups(); //get through functions\n\n $from_date = date('Y-m-d');\n if ($expiration_time > 1) {\n $to_date = date('Y-m-d', strtotime($from_date . ' + ' . $expiration_time . ' days'));\n } else {\n $to_date = date('Y-m-d', strtotime($from_date . ' + 1 day'));\n }\n$from_date = date('Y-m-d', strtotime($from_date . ' -1 day'));\n $rule = Mage::getModel('salesrule/rule');\n $rule->setName($rand_code);\n $rule->setDescription('Coupon Created By Spin and Win (Knowband)');\n $rule->setFromDate($from_date); //starting today\n $rule->setToDate($to_date); //if you need an expiration date\n $rule->setCouponType(2);\n $rule->setCouponCode($rand_code);\n $rule->setUsesPerCoupon(1); //number of allowed uses for this coupon\n $rule->setUsesPerCustomer(1); //number of allowed uses for this coupon for each customer\n $rule->setCustomerGroupIds($customer_groups); //if you want only certain groups replace getAllCustomerGroups() with an array of desired ids \n $rule->setIsActive(1);\n\n $rule->setStopRulesProcessing($stop_further_discount); //set to 1 if you want all other rules after this to not be processed\n $rule->setIsRss(0); //set to 1 if you want this rule to be public in rss\n $rule->setIsAdvanced(1); //have no idea what it means :)\n $rule->setProductIds('');\n $rule->setSortOrder(0); // order in which the rules will be applied\n $rule->setWebsiteIds(array(Mage::app()->getWebsite()->getId())); // order in which the rules will be applied\n\n if ($discount_type == 'fixed') {\n $rule->setSimpleAction('by_fixed');\n } else {\n $rule->setSimpleAction('by_percent');\n }\n\n //all available discount types\n //by_percent - Percent of product price discount\n //by_fixed - Fixed amount discount\n //cart_fixed - Fixed amount discount for whole cart\n //buy_x_get_y - Buy X get Y free (discount amount is Y)\n\n $rule->setDiscountAmount($discount_amount); //the discount amount/percent. if SimpleAction is by_percent this value must be <= 100\n $rule->setDiscountQty(0); //Maximum Qty Discount is Applied to\n $rule->setDiscountStep(0); //used for buy_x_get_y; This is X\n if ($allow_free_shipping) {\n $rule->setSimpleFreeShipping(Mage_SalesRule_Model_Rule::FREE_SHIPPING_ADDRESS); //set to 1 for Free shipping\n $rule->setApplyToShipping(1); //set to 1 for Free shipping\n } else {\n $rule->setSimpleFreeShipping(0); //set to 1 for Free shipping\n $rule->setApplyToShipping(0); //set to 1 for Free shipping\n }\n\n// $rule->setApplyToShipping(0); //set to 0 if you don't want the rule to be applied to shipping\n// $rule->setWebsiteIds(array(1));//if you want only certain websites replace getAllWbsites() with an array of desired ids\n\n $conditions = array();\n $conditions[1] = array(\n 'type' => 'salesrule/rule_condition_combine',\n 'aggregator' => 'all',\n 'value' => \"1\", //[UPDATE] added quotes on the value. Thanks Aziz Rattani [/UPDATE]\n 'new_child' => ''\n );\n //the conditions above are for 'if all of these conditions are true'\n //for if any one of the conditions is true set 'aggregator' to 'any'\n //for if all of the conditions are false set 'value' to 0.\n //for if any one of the conditions is false set 'aggregator' to 'any' and 'value' to 0\n $conditions['1--1'] = Array\n (\n 'type' => 'salesrule/rule_condition_address',\n 'attribute' => 'base_subtotal',\n 'operator' => '>=',\n 'value' => 1\n );\n //the constraints above are for 'Subtotal is equal or grater than 200'\n //for 'equal or less than' set 'operator' to '<='... You get the idea other operators for numbers: '==', '!=', '>', '<'\n //for 'is one of' set operator to '()';\n //for 'is not one of' set operator to '!()';\n //in this example the constraint is on the subtotal\n //for other attributes you can change the value for 'attribute' to: 'total_qty', 'weight', 'payment_method', 'shipping_method', 'postcode', 'region', 'region_id', 'country_id'\n //to add an other constraint on product attributes (not cart attributes like above) uncomment and change the following:\n /*\n $conditions['1--2'] = array\n (\n 'type' => 'salesrule/rule_condition_product_found',//-> means 'if all of the following are true' - same rules as above for 'aggregator' and 'value'\n //other values for type: 'salesrule/rule_condition_product_subselect' 'salesrule/rule_condition_combine'\n 'value' => 1,\n 'aggregator' => 'all',\n 'new_child' => '',\n );\n\n $conditions['1--2--1'] = array\n (\n 'type' => 'salesrule/rule_condition_product',\n 'attribute' => 'sku',\n 'operator' => '==',\n 'value' => '12',\n );\n */\n //$conditions['1--2--1'] means sku equals 12. For other constraints change 'attribute', 'operator'(see list above), 'value'\n\n $rule->setData('conditions', $conditions);\n $rule->loadPost($rule->getData());\n $rule->save();\n return true;\n } catch (Exception $e) {\n Mage::logException($e);\n return false;\n }\n }", "function getDiscountedPrice()\n {\n if (!$this->hasDiscount()) return null;\n $price = $this->price;\n if ($this->discount_active) {\n $price = $this->discountprice;\n }\n// NOTE: Add more conditions and rules as desired, i.e.\n// if ($this->testFlag('Outlet')) {\n// $discountRate = $this->getOutletDiscountRate();\n// $price = number_format(\n// $price * (100 - $discountRate) / 100,\n// 2, '.', '');\n// }\n return $price;\n }", "public function getCalculatedShippingDiscount()\n {\n return $this->calculatedShippingDiscount;\n }", "public function setShippingCode($data)\n {\n parent::setShippingCode($data);\n }", "function fuc_discount($product, $percentage){\r\n $discountValue = $product / 100 * $percentage;\r\n $totalValue = $product - $discountValue; \r\n return $totalValue;\r\n\r\n}", "public function setShippingDiscountTaxCompensationAmount($amount);", "private function SetPricingDetails()\n\t{\n\t\t$product = $this->productClass->getProduct();\n\n\t\t$GLOBALS['PriceLabel'] = GetLang('Price');\n\n\t\tif($this->productClass->GetProductCallForPricingLabel()) {\n\t\t\t$GLOBALS['ProductPrice'] = $GLOBALS['ISC_CLASS_TEMPLATE']->ParseGL($this->productClass->GetProductCallForPricingLabel());\n\t\t}\n\t\t// If prices are hidden, then we don't need to go any further\n\t\telse if($this->productClass->ArePricesHidden()) {\n\t\t\t$GLOBALS['HidePrice'] = \"display: none;\";\n\t\t\t$GLOBALS['HideRRP'] = 'none';\n\t\t\t$GLOBALS['ProductPrice'] = '';\n\t\t\treturn;\n\t\t}\n\t\telse if (!$this->productClass->IsPurchasingAllowed()) {\n\t\t\t$GLOBALS['ProductPrice'] = GetLang('NA');\n\t\t}\n\t\telse {\n\t\t\t$options = array('strikeRetail' => false);\n\t\t\t$GLOBALS['ProductPrice'] = formatProductDetailsPrice($product, $options);\n\t\t}\n\n\t\t// Determine if we need to show the RRP for this product or not\n\t\t// by comparing the price of the product including any taxes if\n\t\t// there are any\n\t\t$GLOBALS['HideRRP'] = \"none\";\n\t\t$productPrice = $product['prodcalculatedprice'];\n\t\t$retailPrice = $product['prodretailprice'];\n\t\tif($retailPrice) {\n\t\t\t// Get the tax display format\n\t\t\t$displayFormat = getConfig('taxDefaultTaxDisplayProducts');\n\t\t\t$options['displayInclusive'] = $displayFormat;\n\n\t\t\t// Convert to the browsing currency, and apply group discounts\n\t\t\t$productPrice = formatProductPrice($product, $productPrice, array(\n\t\t\t\t'localeFormat' => false, 'displayInclusive' => $displayFormat\n\t\t\t));\n\t\t\t$retailPrice = formatProductPrice($product, $retailPrice, array(\n\t\t\t\t'localeFormat' => false, 'displayInclusive' => $displayFormat\n\t\t\t));\n\n\t\t\tif($productPrice < $retailPrice) {\n\t\t\t\t$GLOBALS['HideRRP'] = '';\n\n\t\t\t\t// Showing call for pricing, so just show the RRP and that's all\n\t\t\t\tif($this->productClass->GetProductCallForPricingLabel()) {\n\t\t\t\t\t$GLOBALS['RetailPrice'] = CurrencyConvertFormatPrice($retailPrice);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\t// ISC-1057: do not apply customer discount to RRP in this case\n\t\t\t\t\t$retailPrice = formatProductPrice($product, $product['prodretailprice'], array(\n\t\t\t\t\t\t'localeFormat' => false,\n\t\t\t\t\t\t'displayInclusive' => $displayFormat,\n\t\t\t\t\t\t'customerGroup' => 0,\n\t\t\t\t\t));\n\t\t\t\t\t$GLOBALS['RetailPrice'] = '<strike>' . formatPrice($retailPrice) . '</strike>';\n\t\t\t\t\t$GLOBALS['PriceLabel'] = GetLang('YourPrice');\n\t\t\t\t\t$savings = $retailPrice - $productPrice;\n\t\t\t\t\t$string = sprintf(getLang('YouSave'), '<span class=\"YouSaveAmount\">'.formatPrice($savings).'</span>');\n\t\t\t\t\t$GLOBALS['YouSave'] = '<span class=\"YouSave\">'.$string.'</span>';\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "function discount_rate($discount_rate=null)\n {\n if (isset($discount_rate)) $this->discount_rate = $discount_rate;\n return $this->discount_rate;\n }", "public static function bogo_apply_disc($order_id,$promotion_id,$prmdisc_id,$prmdisc_bogo_sbmnu,$prmdisc_bogo_sbmnu_dish,$prmdisc_bogo_qty,$disc_amt_type,$disc_amt){\r \t//echo \"$order_id,$promotion_id,$prmdisc_id,$prmdisc_bogo_sbmnu,$prmdisc_bogo_sbmnu_dish,$prmdisc_bogo_qty,$disc_amt_type,$disc_amt\";\r\t\t//..Check if discount is with sub menu item is selected\r\t\tif(is_gt_zero_num($prmdisc_bogo_sbmnu_dish)){\r\t\t\t//..do nothing..because we already ahve submenudishid\r\t\t}else{\r\t\t //..Get all submenu dish ids from submenu..\r\t\t\t$rs_apl_disc_items= tbl_submenu_dishes::getSubMenuItems($prmdisc_bogo_sbmnu);\r\t\t\tif(is_not_empty($rs_apl_disc_items)){\r\t\t\t\t$prmdisc_bogo_sbmnu_dish=$rs_apl_disc_items;\r\t\t\t}else{\r\t\t\t\t$strOpMsg= \"No items found to apply discount\" ;\r\t\t\t\treturn 0;\r\t\t\t}\r\t\t}\t\t\r \t\t//...Check if the item is in the order detail\r\t\t$tmp_fnd=0;\r\t\t$ord_det_items=tbl_order_details::readArray(array(ORD_DTL_ORDER_ID=>$order_id,ORD_DTL_SBMENU_DISH_ID=>$prmdisc_bogo_sbmnu_dish,ORDPROM_DISCOUNT_AMT=>0),$tmp_fnd,1,0);\t\t\t\t\t\t\t\r\t\tif($tmp_fnd>0){\t\t \r\t\t\t//..item presents in order detail wihtout disocunt\r\t\t\t//..loop through the all the order items records\r\t\t\tforeach($ord_det_items as $order_itm){\r\t\t\t\t //..now check if the quantity >= disc qty\t\t\t\t\t \r\t\t\t\t if($order_itm[ORD_DTL_QUANTITY]>=$prmdisc_bogo_qty){\r\t\t\t\t \t //..Right item to apply discount\r\t\t\t\t\t //..Calculate discount amount\t\r\t\t\t\t\t$discount_amount=tbl_order_details::getDiscountAmnt($disc_amt_type,$disc_amt,$order_itm[ORD_DTL_PRICE]);\r\t\t\t\t\t//..Update the order detail with discount and promot\r\t\t\t\t\t$success=tbl_order_details::update_item_with_discount($order_itm[ORD_DTL_ID],$promotion_id,$prmdisc_id,$discount_amount);\t\r\t\t\t\t\t\t\t\t\t\t\t \r\t\t\t\t }\r\t\t\t}\r\t\t\tunset($ord_det_items);\t\r\t\t}else{\r\t\t\t$strOpMsg= \"Item not present in your order or alreday discounted\" ;\r\t\t}\t\r\t\treturn 1;\r }", "protected function _beforeToHtml()\n {\n $methodInstance = $this->_quote->getPayment()->getMethodInstance();\n $this->setPaymentMethodTitle($methodInstance->getTitle());\n\n $this->setShippingRateRequired(true);\n if ($this->_quote->getIsVirtual()) {\n $this->setShippingRateRequired(false);\n } else {\n // prepare shipping rates\n $this->_address = $this->_quote->getShippingAddress();\n $groups = $this->_address->getGroupedAllShippingRates();\n if ($groups && $this->_address) {\n $this->setShippingRateGroups($groups);\n // determine current selected code & name\n foreach ($groups as $code => $rates) {\n foreach ($rates as $rate) {\n if ($this->_address->getShippingMethod() == $rate->getCode()) {\n $this->_currentShippingRate = $rate;\n break(2);\n }\n }\n }\n }\n\n $parcelas = $this->_quote->getPayment()->getAdditionalInformation('plots');\n $valorParcela = $this->_quote->getPayment()->getAdditionalInformation('plots_val');\n $this->setParcelas($parcelas);\n $this->setValorParcela($valorParcela);\n\n $canEditShippingAddress = $this->_quote->getMayEditShippingAddress() && $this->_quote->getPayment()\n ->getAdditionalInformation(Mage_Paypal_Model_Express_Checkout::PAYMENT_INFO_BUTTON) == 1;\n // misc shipping parameters\n $this->setShippingMethodSubmitUrl($this->getUrl(\"{$this->_paypalActionPrefix}/express/saveShippingMethod\"))\n ->setCanEditShippingAddress($canEditShippingAddress)\n ->setCanEditShippingMethod($this->_quote->getMayEditShippingMethod())\n ;\n }\n\n $this->setEditUrl($this->getUrl(\"{$this->_paypalActionPrefix}/express/edit\"))\n ->setPlaceOrderUrl($this->getUrl(\"{$this->_paypalActionPrefix}/express/placeOrder\"));\n\n return parent::_beforeToHtml();\n }", "public function handle_shipping() {\n if ( ! is_user_logged_in() ) {\n return;\n }\n\n if ( ! dokan_is_user_seller( get_current_user_id() ) ) {\n return;\n }\n\n if ( isset( $_POST['dokan_update_shipping_options'] ) && wp_verify_nonce( $_POST['dokan_shipping_form_field_nonce'], 'dokan_shipping_form_field' ) ) {\n if ( ! current_user_can( 'dokan_view_store_shipping_menu' ) ) {\n wp_die( __( 'You have no access to save this shipping options', 'dokan' ) );\n }\n\n $user_id = dokan_get_current_user_id();\n $s_rates = array();\n $rates = array();\n\n // Additional extra code\n\n if ( isset( $_POST['dps_enable_shipping'] ) ) {\n update_user_meta( $user_id, '_dps_shipping_enable', $_POST['dps_enable_shipping'] );\n }\n\n if ( isset( $_POST['dokan_shipping_type'] ) ) {\n update_user_meta( $user_id, '_dokan_shipping_type', $_POST['dokan_shipping_type'] );\n }\n\n if ( isset( $_POST['dps_shipping_type_price'] ) ) {\n update_user_meta( $user_id, '_dps_shipping_type_price', $_POST['dps_shipping_type_price'] );\n }\n\n if ( isset( $_POST['dps_additional_product'] ) ) {\n update_user_meta( $user_id, '_dps_additional_product', $_POST['dps_additional_product'] );\n }\n\n if ( isset( $_POST['dps_additional_qty'] ) ) {\n update_user_meta( $user_id, '_dps_additional_qty', $_POST['dps_additional_qty'] );\n }\n\n if ( isset( $_POST['dps_pt'] ) ) {\n update_user_meta( $user_id, '_dps_pt', $_POST['dps_pt'] );\n }\n\n if ( isset( $_POST['dps_ship_policy'] ) ) {\n update_user_meta( $user_id, '_dps_ship_policy', $_POST['dps_ship_policy'] );\n }\n\n if ( isset( $_POST['dps_refund_policy'] ) ) {\n update_user_meta( $user_id, '_dps_refund_policy', $_POST['dps_refund_policy'] );\n }\n\n if ( isset( $_POST['dps_form_location'] ) ) {\n update_user_meta( $user_id, '_dps_form_location', $_POST['dps_form_location'] );\n }\n\n if ( isset( $_POST['dps_country_to'] ) ) {\n foreach ( $_POST['dps_country_to'] as $key => $value ) {\n $country = $value;\n $c_price = wc_format_decimal( $_POST['dps_country_to_price'][ $key ] );\n\n if ( ! $c_price && empty( $c_price ) ) {\n $c_price = 0;\n }\n\n if ( ! empty( $value ) ) {\n $rates[ $country ] = $c_price;\n }\n }\n }\n\n update_user_meta( $user_id, '_dps_country_rates', $rates );\n\n if ( isset( $_POST['dps_state_to'] ) ) {\n foreach ( $_POST['dps_state_to'] as $country_code => $states ) {\n foreach ( $states as $key_val => $name ) {\n $country_c = $country_code;\n $state_code = $name;\n $s_price = wc_format_decimal( $_POST['dps_state_to_price'][ $country_c ][ $key_val ] );\n\n if ( ! $s_price || empty( $s_price ) ) {\n $s_price = 0;\n }\n\n if ( ! empty( $name ) ) {\n $s_rates[ $country_c ][ $state_code ] = $s_price;\n }\n }\n }\n }\n\n update_user_meta( $user_id, '_dps_state_rates', $s_rates );\n\n do_action( 'dokan_after_shipping_options_updated', $rates, $s_rates );\n\n $shipping_url = dokan_get_navigation_url( 'settings/regular-shipping' );\n wp_redirect( add_query_arg( array( 'message' => 'shipping_saved' ), $shipping_url ) );\n exit();\n }\n }" ]
[ "0.69874567", "0.6716272", "0.6618847", "0.63331354", "0.6323606", "0.62711596", "0.62483984", "0.6170293", "0.61409116", "0.6123673", "0.61214644", "0.6114664", "0.6086248", "0.6059916", "0.6031532", "0.6017418", "0.5978849", "0.59741455", "0.5974048", "0.5959973", "0.5896274", "0.5884931", "0.5876827", "0.58673906", "0.583298", "0.57960236", "0.5780711", "0.5768952", "0.5765704", "0.57597554", "0.57440835", "0.5732194", "0.5730176", "0.57237977", "0.5686177", "0.56747067", "0.56631845", "0.56597424", "0.5653839", "0.563709", "0.56267506", "0.562344", "0.56167644", "0.5609894", "0.5586618", "0.5582953", "0.5580172", "0.55627126", "0.55508995", "0.5547509", "0.5539937", "0.55380124", "0.5532537", "0.5522972", "0.55149895", "0.5507249", "0.5482676", "0.54807216", "0.5474015", "0.54734486", "0.54589033", "0.5449549", "0.5444699", "0.54388034", "0.54385924", "0.5436537", "0.5422476", "0.5416429", "0.54153854", "0.54100454", "0.5408099", "0.5400317", "0.5396276", "0.5390986", "0.5387787", "0.5387398", "0.53865325", "0.5384477", "0.53811", "0.53784865", "0.5378103", "0.53741777", "0.53718185", "0.53673804", "0.5364108", "0.53625476", "0.5350293", "0.5345649", "0.5345408", "0.53423125", "0.5336893", "0.5334875", "0.5328286", "0.5307079", "0.53067833", "0.5298905", "0.5295501", "0.5287636", "0.527928", "0.52781194", "0.526948" ]
0.0
-1
Check, if product ID in array of cart items
private static function productInArray($sku_id, $items) { foreach ($items as $it) { if ($it['sku_id'] == $sku_id) { return $it; } } return false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function checkCartForItem($addItem, $cartItems) {\n if (is_array($cartItems) && !(is_null($cartItems)))\n {\n foreach($cartItems as $key => $item) \n {\n if($item['productId'] == $addItem)\n return true;\n }\n }\n return false;\n}", "public function in_cart($product_id = null) {\n\t\tif ($this->total_items() > 0)\n\t\t{\n\t\t\t$in_cart = array();\n\t\t\t// Fetch data for all products in cart\n\t\t\tforeach ($this->contents() AS $item)\n\t\t\t{\n\t\t\t\t$in_cart[$item['id']] = $item['qty'];\n\t\t\t}\n\t\t\tif ($product_id)\n\t\t\t{\n\t\t\t\tif (array_key_exists($product_id, $in_cart))\n\t\t\t\t{\n\t\t\t\t\treturn $in_cart[$product_id];\n\t\t\t\t}\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\treturn $in_cart;\n\t\t\t}\n\t\t}\n\t\treturn null; \n\t}", "function harvest_in_cart() {\n\t\n\tglobal $woocommerce;\n\t\n\t$product_id = 37592;\n\t\n\t$parent_id = wp_get_post_parent_id( $product_id );\n\t\n\t$product_id = $parent_id > 0 ? $parent_id : $product_id;\n\t\n\tforeach ( $woocommerce->cart->get_cart() as $cart_item ) {\n\t \n\t if ( $cart_item['product_id'] === $product_id ) {\n\t \n\t return true;\n\t \n\t } else {\n\t \n\t return false;\n\t \n\t }\n\t\n\t}\n\n}", "function wordimpress_is_conditional_product_in_cart( $product_id ) {\n //Check to see if user has product in cart\n global $woocommerce;\n \n //flag no book in cart\n $book_in_cart = false;\n \n foreach ( $woocommerce->cart->get_cart() as $cart_item_key => $values ) {\n $_product = $values['data'];\n \n if ( in_array($_product->id, $product_id) ) {\n //book is in cart!\n $book_in_cart = true;\n \n }\n }\n \n return $book_in_cart;\n \n}", "private function validate_product_ids() {\n\t\tif ( sizeof( $this->product_ids ) > 0 ) {\n\t\t\t$valid_for_cart = false;\n\t\t\tif ( ! WC()->cart->is_empty() ) {\n\t\t\t\tforeach( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {\n\t\t\t\t\tif ( in_array( $cart_item['product_id'], $this->product_ids ) || in_array( $cart_item['variation_id'], $this->product_ids ) || in_array( $cart_item['data']->get_parent(), $this->product_ids ) ) {\n\t\t\t\t\t\t$valid_for_cart = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( ! $valid_for_cart ) {\n\t\t\t\tthrow new Exception( self::E_WC_COUPON_NOT_APPLICABLE );\n\t\t\t}\n\t\t}\n\t}", "function product_exists($pid){\n\t$cart = $_SESSION['custCart_ID']; // the SESSION and COOKIE customer cart items array\n\t$pid=intval($pid);\n\t$max=count($_SESSION[$cart]);\n\t$flag=0;\n\tfor($i=0;$i<$max;$i++){\n\t\tif($pid==$_SESSION[$cart][$i]['bookid']){\n\t\t\t$flag=1;\n\t\t\t// break;\n\t\t}\n\t}\n\treturn $flag;\n}", "public function inBasket($id) {\n foreach ($_SESSION['user']['basket'] as $itemID => $item) {\n if($itemID == $id)\n return true;\n }\n\n return false;\n }", "function check_product_in_the_cart($product){\n if (auth()->check()){\n $cart = Cart::where('user_id', auth()->user()->id)->where('product_id', $product->id)->first();\n }else{\n if(session()->has('carts')){\n $cart = key_exists($product->uuid, session('carts'));\n }else{\n $cart = false;\n }\n }\n\n if ($cart){\n return true;\n }else{\n return false;\n }\n}", "function findByIds($cart_id, $product_id){\n\t\t// zda jsou validni\n\t\t$conditions = array(\n\t\t\t'CartsProduct.cart_id' => $cart_id,\n\t\t\t'CartsProduct.id' => $product_id\n\t\t);\n\t\tif ( $this->find($conditions) ){\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}", "function is_added_to_cart($product_id, $set = '', $op = '')\n {\n $carted = $this->cart->contents();\n //var_dump($carted);\n if (count($carted) > 0) {\n foreach ($carted as $items) {\n if ($items['id'] == $product_id) {\n\n if ($set == '') {\n return true;\n } else {\n if($set == 'option'){\n $option = json_decode($items[$set],true);\n return $option[$op]['value'];\n } else {\n return $items[$set];\n }\n }\n }\n }\n } else {\n return false;\n }\n }", "function is_added_to_cart($product_id, $set = '', $op = '')\n {\n $carted = $this->cart->contents();\n //var_dump($carted);\n if (count($carted) > 0) {\n foreach ($carted as $items) {\n if ($items['id'] == $product_id) {\n \n if ($set == '') {\n return true;\n } else {\n if($set == 'option'){\n $option = json_decode($items[$set],true);\n return $option[$op]['value'];\n } else {\n return $items[$set];\n }\n }\n }\n }\n } else {\n return false;\n }\n }", "public function product_quantity_in_cart( $product_id ) {\n\t\t$cart = WC()->cart->get_cart();\n\t\t// TODO: set $cart as class attribute ass. array and fill once, to improve time complexity, O(kn) -> O(n)\n\t\tforeach ( $cart as $item ) {\n\t\t\tif ( $product_id == $item['product_id'] ) {\n\t\t\t\t$quantity = $item['quantity'];\n\t\t\t\t$cart_item_key = $item['key'];\n\t\t\t\treturn array($quantity, $cart_item_key);\n\t\t\t}\n\t\t}\n\t}", "public function isProductNotAlreadyInTheCart($order_id,$product_id){\n $model = new OrderHasProducts;\n return $model->isProductNotAlreadyInTheCart($order_id,$product_id);\n }", "public function check_cart_id()\n\t{\n\t\tif(isset($_SESSION['cart']->cartID) && isset($_SESSION['cartID']) && $_SESSION['cart']->cartID != $_SESSION['cartID'])\n\t\t{\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t}", "private function checkIfExistsProducts()\n {\n if (isset($_COOKIE['cart-data'])) {\n $productCookie = htmlspecialchars($_COOKIE['cart-data']);\n $products = trim($productCookie, '|');\n $products = explode('|', $products);\n foreach ($products as $product) {\n if (!Product::find($product)) {\n $productCookie = str_replace('|' . $product . '|', '|', $productCookie);\n }\n }\n setcookie('cart-data', $productCookie, time() + (86400 * 365), \"/\");\n }\n }", "function VariationIsInCart() {\r\n\t\t$variations = $this->owner->Variations();\r\n\t\tif($variations) {\r\n\t\t\tforeach($variations as $variation) {\r\n\t\t\t\tif($variation->OrderItem() && $variation->OrderItem()->Quantity > 0) {\r\n\t\t\t\t\treturn true;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn false;\r\n\t}", "function harvest_in_order( $order ) {\n\n\t$items = $order->get_items(); \n\n\tforeach ( $items as $item_id => $item ) {\n\n\t\tif ( $item->get_product_id() === 37592 ) {\n\t\t\t\n\t\t\treturn true;\n\t\t\t\n\t\t}\n\n\t}\n\t\n\treturn false;\n\n}", "public function check_cart_items() {\n\t\t$return = true;\n\t\t$result = $this->check_cart_item_validity();\n\n\t\tif ( is_wp_error( $result ) ) {\n\t\t\twc_add_notice( $result->get_error_message(), 'error' );\n\t\t\t$return = false;\n\t\t}\n\n\t\t$result = $this->check_cart_item_stock();\n\n\t\tif ( is_wp_error( $result ) ) {\n\t\t\twc_add_notice( $result->get_error_message(), 'error' );\n\t\t\t$return = false;\n\t\t}\n\n\t\treturn $return;\n\n\t}", "private function isProductInNotifiyList($productId) {\r\n\r\n $this->bcc = array();\r\n $mailStaus = 'NO';\r\n\r\n $collection = Mage::getModel('outofstocknotification/outofstocknotification')->getCollection()\r\n ->addFieldToFilter('product_id', $productId)\r\n ->addFieldToFilter('status', '1')\r\n ->addFieldToFilter('mailsend_status', $mailStaus);\r\n $collection->getSelect()->group(array(\"email_id\"));\r\n $isArray = $collection->getSize();\r\n if ($isArray) {\r\n foreach ($collection as $productlist) {\r\n $this->bcc[] = $productlist->getEmailId();\r\n }\r\n $this->productUrl = base64_decode($productlist['product_url']);\r\n $this->productName = $productlist['product_name'];\r\n return 1;\r\n } else {\r\n return 0;\r\n }\r\n }", "function basel_is_product_in_compare( $id ) {\n\t\t$list = basel_get_compared_products();\n\n\t\treturn in_array( $id, $list, true );\n\t}", "private function validate_cart_excluded_product_ids() {\n\t\t// Exclude Products\n\t\tif ( sizeof( $this->exclude_product_ids ) > 0 ) {\n\t\t\t$valid_for_cart = true;\n\t\t\tif ( ! WC()->cart->is_empty() ) {\n\t\t\t\tforeach( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {\n\t\t\t\t\tif ( in_array( $cart_item['product_id'], $this->exclude_product_ids ) || in_array( $cart_item['variation_id'], $this->exclude_product_ids ) || in_array( $cart_item['data']->get_parent(), $this->exclude_product_ids ) ) {\n\t\t\t\t\t\t$valid_for_cart = false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( ! $valid_for_cart ) {\n\t\t\t\tthrow new Exception( self::E_WC_COUPON_EXCLUDED_PRODUCTS );\n\t\t\t}\n\t\t}\n\t}", "public function find_product_in_cart( $cart_id = false ) {\n\t\tif ( false !== $cart_id ) {\n\t\t\tif ( is_array( $this->cart_contents ) && isset( $this->cart_contents[ $cart_id ] ) ) {\n\t\t\t\treturn $cart_id;\n\t\t\t}\n\t\t}\n\t\treturn '';\n\t}", "function contained_in_ids($collection, $item)\n {\n foreach($collection as $look)\n {\n if($look->id == $item->id) return true;\n }\n return false;\n }", "public function checkIfItemExists($id, $data) {\n $items = Cart::getCart()->items;\n\n foreach ($items as $item) {\n if ($id == $item->product_id && $item->seller_product_id == $data['seller_info']['product_id']) {\n $product = $this->product->findOnebyField('id', $id);\n\n if ($product->type == 'configurable') {\n $variant = $this->product->findOneByField('id', $data['selected_configurable_option']);\n\n if ($item->child->product_id == $data['selected_configurable_option']) {\n return $item->id;\n }\n } else {\n return $item->id;\n }\n }\n }\n\n return 0;\n }", "public static function check_cart_for_specials() {\n\n $contains_special = false;\n\n foreach ( WC()->cart->get_cart() as $cart_item ) {\n if ( self::is_item_special( $cart_item['data'] ) ) {\n $contains_special = true;\n break;\n }\n }\n\n return $contains_special;\n }", "public function hasItemId(){\n return $this->_has(7);\n }", "function find_deals_in_cart( $cart_id = false ) {\n\t if ($cart_id !== false) foreach ($this->cart_contents as $cart_item_key => $cart_item) if ($cart_item_key == $cart_id) return $cart_item_key;\n\t }", "public function hasProducts($id){\n\t\t$sql = \"SELECT id FROM products WHERE product_material_id = ?\";\n\t\t$products = $this->query($sql, [$id])->results();\n\t\tif(!empty($products)){\n\t\t\treturn true;\n\t\t}else{\n\t\t\treturn false;\n\t\t}\n\t}", "function check_cart_items() {\n\t\t\tglobal $cmdeals;\n\t\t\t\n\t\t\t$result = $this->check_cart_item_stock();\n\t\t\tif (is_wp_error($result)) $cmdeals->add_error( $result->get_error_message() );\n\t\t}", "function checkCart($TmpCart){\n\t\t$result = array();\n\t\tforeach ($this->Cart as $k => $v){ if($v[\"id\"] == $TmpCart[\"id\"]) $result[] = $k; } // Find Elements with the same product Id\n\t\t$unigue = true;\n\t\tif(count($result)>0){\n\t\t\tforeach ($result as $v){ // Check to see if all the data is the same. Messages and Engravins will always add a new item\n\t\t\t\tif($this->Cart[$v][\"spec\"] == $TmpCart[\"spec\"] && \n\t\t\t\t\t $this->Cart[$v][\"special\"] == $TmpCart[\"special\"] && \n\t\t\t\t\t $this->Cart[$v][\"selections\"] == $TmpCart[\"selections\"] && \n\t\t\t\t\t intval($this->Cart[$v][\"msgs\"]) == 0){ $newattnd=true;\n\t\t\t\t\t\t// Lets check our attendee list and make sure we have any new Attendees: this check is for NITA\n\t\t\t\t\t\tif(isset($this->Cart[$v][\"attnd\"]) && count($this->Cart[$v]['attnd']) > 0 && count($TmpCart['attnd']) > 0){\n\t\t\t\t\t\t\tforeach($this->Cart[$v][\"attnd\"] as $attnd){\n\t\t\t\t\t\t\t\tif($TmpCart['attnd'][0]==$attnd) { $newattnd=false; $unigue = false; break; }\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif($newattnd && count($TmpCart['attnd'])>0) $this->Cart[$v][\"attnd\"][]=$TmpCart['attnd'][0]; // Add our new Attendee\n\t\t\t\t\t\t\n\t\t\t\t\t\tif(isset($this->Cart[$v]['attnd']) && count($this->Cart[$v]['attnd'])>0 && $this->Cart[$v]['attnd']!==0){\n\t\t\t\t\t\t\t$FoundNull=true;\n\t\t\t\t\t\t\twhile($FoundNull){ $FoundNull=false;\n\t\t\t\t\t\t\t\tforeach($this->Cart[$v]['attnd'] as $KeyAttnd => $ValAttnd){\n\t\t\t\t\t\t\t\t\tif( (is_int($ValAttnd) && intval($ValAttnd)==0) || is_null($ValAttnd) ){\n\t\t\t\t\t\t\t\t\t\tunset( $this->Cart[$v]['attnd'][$KeyAttnd] ); $FoundNull=true; break;\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\t\t\t\t}\n\t\t\t\t\t\tif(!isset($this->Cart[$v]['attnd']) || $this->Cart[$v]['attnd']===0) $this->Cart[$v]['attnd']=array();\n\t\t\t\t\t\t$this->Cart[$v]['name'] = $TmpCart['name']; // Going to store the name here so we don't have to query the web service for every item in the cart\n\t\t\t\t\t\t$this->Cart[$v][\"type\"] = $TmpCart['type']; // Type 1 = program, Type 2 = product\n\t\t\t\t\t\t//if($TmpCart['type']==1 && count($this->Cart[$v]['attnd'])>0) $this->Cart[$v][\"qty\"]= count($this->Cart[$v]['attnd']); // If product is program quantity equals the number of attendees have a check for zero to allow for item to placed in cart without any attendee's selected\n\t\t\t\t\t\t//else\n\t\t\t\t\t\t$this->Cart[$v][\"qty\"] += $TmpCart[\"qty\"]; $unigue = false; break; // Updates our cart quantitee\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif($unigue) $this->Cart[] = $TmpCart; // If we have a unigue item add it to the cart.\n\t}", "function pewc_get_cart_item_by_extras( $product_id, $variation_id, $cart_item_data ) {\n\n\t$cart = WC()->cart->cart_contents;\n\tif( $cart ) {\n\n\t\tforeach( $cart as $id=>$cart_item ) {\n\n\t\t\t// Check if our parameters exactly match the cart item\n\t\t\tif( ( isset( $cart_item['product_id'] ) && $cart_item['product_id'] == $product_id ) && ( isset( $cart_item['variation_id'] ) && $cart_item['variation_id'] == $variation_id ) ) {\n\t\t\t\treturn $cart_item;\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\treturn false;\n\n}", "function get_deal_ids_from_cart($cart = null)\n\t{\n\t\tif ($cart)\n\t\t{\n\t\t\t$cart_items = $this->cart_item_m->get_many_by('cart_id', $cart->id);\n\t\t\t\n\t\t\tif ($cart_items)\n\t\t\t{\n\t\t\t\t$deal_ids = array();\n\t\t\t\t\n\t\t\t\tforeach ($cart_items as $item)\n\t\t\t\t{\n\t\t\t\t\tif ( ! in_array($item->entry_id, $deal_ids)) $deal_ids[] = (int) $item->entry_id;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\treturn $deal_ids;\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn null;\n\t\t\n\t}", "private function getAlreadyPurchasedProduct()\n {\n // If is Guest then hide the review form\n if (!$this->getCustomerId()) {\n return false;\n }\n try {\n $product = $this->getProductInfo();\n $orders = $this->getCustomerOrders();\n foreach ($orders as $order) {\n // Get all visible items in the order\n /** @var $items \\Magento\\Sales\\Api\\Data\\OrderItemInterface[] **/\n $items = $order->getAllVisibleItems();\n // Loop all items\n foreach ($items as $item) {\n // Check whether the current product exist in the order.\n if ($item->getProductId() == $product->getId()) {\n return true;\n }\n }\n }\n return false;\n } catch (\\Exception $e) {\n return false;\n }\n }", "public function cartExists() {\n\t\t$cart = $this->find('first', array('conditions' => $this->cartConditions(), 'contain' => FALSE));\n\t\treturn !empty($cart);\n\t}", "function cul_find_rayco_product_in_cart_message() {\n\n $products = WC()->cart->cart_contents;\n $term_titles = '';\n foreach ($products as $product) {\n $product_id = get_post_parent($product['data']->get_id())->ID;\n \n \n $term_list = json_encode(wp_get_post_terms($product_id,'product_cat',array('fields'=>'slugs')));\n $term_titles .= $term_list;\n }\n\n if (strpos($term_titles , 'rayco') !== false) {\n return true;\n }\n\n else { \n return false;\n }\n \n}", "function checkCartForItem($item)\n {\n foreach ($_SESSION['cart'] as $key => $value) {\n if ($_SESSION['cart'][$key]['name'] == $item) {\n return $key;\n }\n }\n return -1;\n }", "function add_item_to_cart( $prodId = null ) {\n if ( null != $prodId && is_numeric( $prodId ) ) {\n\n // Probably should sql check database to see\n // if product exisits.\n\n if( $_SESSION[\"cart\"][$prodId] ) {\n $_SESSION[\"cart\"][$prodId]++;\n }\n else {\n $_SESSION[\"cart\"][$prodId] = 1;\n }\n }\n}", "public function getCartItems($cart_id);", "public static function is_item_special( $product_id ){\n $product = wc_get_product( $product_id );\n return $product && $product->get_meta( '_only_item_in_cart' ) == 'yes' ? true : false;\n }", "private function checkProduct($id)\n {\n return $this->productList->getProduct($id) ? true : false;\n }", "function is_compared($product_id)\n {\n if($this->session->userdata('compare') == ''){\n $this->session->set_userdata('compare','[]');\n }\n $compared = json_decode($this->session->userdata('compare'),true);\n foreach ($compared as $row) {\n if($row == $product_id){\n return 'yes';\n }\n }\n return 'no';\n }", "public function containsProduct(Product $product): bool;", "public function hasItem(CartItemInterface $item);", "public function flag_product_in_cart( $cart_item_data ) {\n\n\t\t$cart_item_data['data']->tc_cart_key = $cart_item_data['key'];\n\n\t\treturn $cart_item_data;\n\t}", "function getCartProductsByCartIds() {\n\n if (func_num_args() > 0) {\n $carts = func_get_arg(0);\n $result = array();\n if ($carts) {\n foreach ($carts as $value) {\n $select = $this->select()\n ->setIntegrityCheck(false)\n ->from(array('cr' => 'addtocart'))\n ->joinLeft(array('pr' => 'products'), 'pr.product_id=cr.product_id')\n ->where('cr.id=?', $value)\n ->where('pr.prod_status=?', 1);\n $result[] = $this->getAdapter()->fetchRow($select);\n }\n if ($result) {\n return $result;\n } else {\n return null;\n }\n }\n } else {\n return null;\n }\n }", "function is_in_cart($conditions){\n\t\tunset($conditions['quantity']);\n\t\t// odpojim modely, ktere nepotrebuju\n\t\t$this->unbindModel(\n\t\t\tarray(\n\t\t\t\t'belongsTo' => array('Cart', 'Product')\n\t\t\t)\n\t\t);\n\n\t\t// vyhledam si produkt\n\t\t$data = $this->find($conditions);\n\n\t\t// pokud se mi podarilo nacist jej,\n\t\t// vratim jeho id, ktere se pouzije\n\t\t// pro upravu quantity\n\t\tif ( !empty($data) ){\n\t\t\treturn $data['CartsProduct']['id'];\n\t\t}\n\n\t\t// produkt neexistuje\n\t\treturn false;\n\t}", "function VariationOrProductIsInCart() {\r\n\t\treturn ($this->owner->IsInCart() || $this->VariationIsInCart());\r\n\t}", "public function cart_checkFoodItemAvailability($cart_id){\n $food_items_and_qty = $this->model->getQtywithItemCount_cart($cart_id);\n //print_r($food_items_and_qty['data']);\n if($food_items_and_qty['status'] === \"success\"){\n\n foreach($food_items_and_qty['data'] as $item){\n if($item->Quantity > $item->Current_count){\n return ['status'=>'unavail', 'data'=>$item->FoodName];\n }\n }\n return ['status'=>'avail'];\n }\n }", "public function canItemsAddToCart()\n {\n foreach ($this->getItems() as $item) {\n if (!$item->isComposite() && $item->isSaleable() && !$item->getRequiredOptions()) {\n return true;\n }\n }\n return false;\n }", "public function get_check() {\n\t\tif($id = Input::get('rel_id')) {\n\t\t\tif($id_list = Cookie::get('divec_cart')) {\n\t\t\t\tif(in_array($id, explode('-', $id_list))) {\n\t\t\t\t\t$this->response(array('success' => 'true'));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t$this->response(array('success' => 'false'));\n\t}", "function setProductInCartCount ($id, $amount) {\r\n //ensures that the cart exists within the session\r\n if (checkCart()) {\r\n //checks if the product is actually in the cart\r\n if (array_key_exists($id, $_SESSION['cart'])) {\r\n if ($amount > 0) {\r\n $_SESSION['cart'][$id]['amount'] = $amount;\r\n } else {\r\n //remove product\r\n unset($_SESSION['cart'][$id]);\r\n }\r\n } else {\r\n //if not add the product to the cart\r\n addToCart($id, $amount);\r\n }\r\n }\r\n}", "private function _isCartArray($items = array())\n {\n if (!is_array($items) or count($items) == 0)\n {\n return FALSE;\n }\n return TRUE;\n }", "public function getWalletInCart()\n {\n $walletProductId = $this->_helper->getWalletProductId();\n $cartData = $this->_checkoutSession->getQuote()->getAllVisibleItems();\n foreach ($cartData as $item) {\n if ($item->getProduct()->getId() == $walletProductId) {\n return true;\n }\n }\n return false;\n }", "public function getProductIds()\n {\n $cartItems = $this->session->get('cart');\n if(empty($cartItems)){\n throw new \\Exception('The cart is empty!');\n }\n\n $cartProductIds = [];\n foreach ($cartItems as $cartItem) {\n $cartProductIds[] = $cartItem['product_id'];\n }\n\n return $cartProductIds;\n }", "public function has($key): bool\n {\n return is_object($key)\n ? $this->cart->contains('cartable_id', $key->id) && $this->cart->contains('cartable_type', get_class($key))\n : $this->cart->contains('id', $key);\n }", "function contains_id($id, $data){\n return in_array($id, array_column($data, 'id'));\n}", "function tep_has_product_subproducts($products_id) {\n\t$subproducts_query = tep_db_query(\"select count(*) as count from \" . TABLE_PRODUCTS . \" where products_parent_id = '\" . (int)$products_id . \"'\");\n\t$subproducts = tep_db_fetch_array($subproducts_query);\n\tif ($subproducts['count'] > 0) {\n\t\treturn true;\n\t} else {\n\t\treturn false;\n\t}\n}", "function check_if_added_to_cart($item_id) {\n $user_id = $_SESSION['user_id']; //We'll get the user_id from the session\n $con= mysqli_connect(\"localhost\",\"root\",\"\",\"intern\",\"3309\") or die(mysqli_error($con));\n // connecting to the database\n // We will select all the entries from the user_items table where the item_id is equal to the item_id we passed to this function, user_id is equal to the user_id in the session and status is 'Added to cart'\n \n $query = \"SELECT * FROM users_items WHERE item_id='$item_id' AND user_id ='$user_id' and status='Added to cart'\";\n $result = mysqli_query($con, $query) or die(mysqli_error($con));\n \n// We'll check if the no.of rows in the result and no.of rows returned by the mysqli_num_rows($result) is true. If yes then it return 0 else it returns 0\n if (mysqli_num_rows($result) >= 1) {\n return 1;\n } else {\n return 0;\n }\n}", "public function inventoryCheck($data)\n {\n if (is_array($data) && !empty($data)) {\n foreach ($data as $datum) {\n $product = Product::find($datum['product_id']);\n\n if (!isset($datum['quantity'])) return false;\n\n if ($product->stock < $datum['quantity']) {\n return false;\n }\n }\n }\n\n return true;\n }", "public function exists($key){return array_key_exists($key,$this->items_array);}", "public function checkProId(){\n if($this->check_id()){\n $this->check_branch();\n $sql_check_id_product = \"SELECT * FROM \".USER_PRODUCTS.\"\n WHERE usp_id = \" . $this->id . \"\n AND usp_branch_id = \" . $this->branch_id . \"\n AND usp_use_parent_id = \" . $this->admim_id . \" LIMIT 1\";\n $db_query_check_id_product = new db_query($sql_check_id_product);\n return mysqli_fetch_assoc($db_query_check_id_product->result);\n }\n return array();\n }", "public function has($id)\n {\n foreach (static::$basket[$this->id] as $item) {\n if ($item->id == $id) return true;\n }\n return false;\n }", "function is_cart() {\n\t\treturn is_page( carton_get_page_id( 'cart' ) );\n\t}", "public static function getProducts()\n {\n if (isset($_SESSION['cart'])) {\n $productId = $_SESSION['cart'];\n } else {\n $productId = false;\n }\n \n \n return $productId;\n }", "public function offsetExists($productId)\n {\n return isset($this->_data[$productId]);\n }", "public function checkProductsList() {\n if (!is_array($this->products) || !count($this->products)) {\n $this->logger->info(\"No \".$this->type.\" found in DST.\");\n }\n $this->logger->info(\"Checking products List\");\n foreach ($this->products as $sku => $product) {\n $errors = $this->pimhelper->check_one_reference($this->type, $product->getData());\n if ($errors > 0) {\n $this->logger->info($errors.\" Fields are missing in product : \".$sku);\n die;\n }\n }\n $this->logger->info(\"Fields were created in every products\");\n return true;\n }", "function &get_cart_product($id, $options) {\r\n if (!isset($_SESSION['cart'])) {\r\n return null;\r\n } else {\r\n foreach ($_SESSION['cart'] as &$product) {\r\n if ($product['id'] == $id && $product['options'] == $options) {\r\n return $product;\r\n }\r\n }\r\n }\r\n return null;\r\n}", "function _check_product_in_db($product){\n if (in_array($product, $this->db)){\n // echo 'Product already in the database.';\n return True;\n }\n // echo 'Product not in the database.';\n return False;\n }", "public function hasProduct(){\n return $this->_has(1);\n }", "public function hasProduct(){\n return $this->_has(1);\n }", "public function hasProduct(){\n return $this->_has(1);\n }", "public function hasProduct(){\n return $this->_has(1);\n }", "public function hasProduct(){\n return $this->_has(1);\n }", "public function doesProductsHaveDuplications()\n {\n $productIDs = array();\n foreach ($this->products as $product) {\n $productIDs[] = $product->product_id;\n }\n\n $uniqueProductIDs = array_unique($productIDs);\n return (count($productIDs) != count($uniqueProductIDs));\n }", "public function testIfStockManagementHasProductId()\n {\n $this->assertNotNull($this->stock->getProductId());\n }", "public static function isPack($id_product)\n {\n }", "public static function getCartItemIds()\n\t{\n\t\t$ids = array();\n\n\t\tforeach (Data::getOrderItems(null) as $item) {\n\t\t\t$ids []= $item['PRODUCT_ID'];\n\t\t}\n\n\t\treturn $ids;\n\t}", "public function uniqueCombi() {\n\t\t\n\t\tif (isset($this->data[$this->alias]['cart_id'])) {\n\t\t\t\n\t\t\t$combi = array(\n\t\t\t\t\"{$this->alias}.cart_id\" => $this->data[$this->alias]['cart_id'],\n\t\t\t\t\"{$this->alias}.variant_id\" => $this->data[$this->alias]['variant_id']\n\t\t\t);\n\t\t\t\n\t\t\treturn $this->isUnique($combi, false);\t\t\t\n\t\t}\n\t\t\n\t\treturn true;\n\t}", "public function hasActiveCart();", "public function containsItems(array $items): bool;", "private function validate_cart_excluded_sale_items() {\n\t\tif ( $this->exclude_sale_items == 'yes' ) {\n\t\t\t$valid_for_cart = true;\n\t\t\t$product_ids_on_sale = wc_get_product_ids_on_sale();\n\t\t\tif ( ! WC()->cart->is_empty() ) {\n\t\t\t\tforeach( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {\n\t\t\t\t\tif ( ! empty( $cart_item['variation_id'] ) ) {\n\t\t\t\t\t\tif ( in_array( $cart_item['variation_id'], $product_ids_on_sale, true ) ) {\n\t\t\t\t\t\t\t$valid_for_cart = false;\n\t\t\t\t\t\t}\n\t\t\t\t\t} elseif ( in_array( $cart_item['product_id'], $product_ids_on_sale, true ) ) {\n\t\t\t\t\t\t$valid_for_cart = false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( ! $valid_for_cart ) {\n\t\t\t\tthrow new Exception( self::E_WC_COUPON_NOT_VALID_SALE_ITEMS );\n\t\t\t}\n\t\t}\n\t}", "function is_wished($product_id)\n {\n if ($this->session->userdata('user_login') == 'yes') {\n $user = $this->session->userdata('user_id');\n //$wished = array('0');\n if ($this->get_field('user', $user, 'wishlist') !== '') {\n $wished = json_decode($this->get_field('user', $user, 'wishlist'));\n } else {\n $wished = array(\n '0'\n );\n }\n if (in_array($product_id, $wished)) {\n return 'yes';\n } else {\n return 'no';\n }\n } else {\n return 'no';\n }\n }", "public function getCurrentCart(){\n\n $product_ids = array();\n $cart = Mage::getModel('checkout/cart')->getQuote();\n foreach ($cart->getAllVisibleItems() as $item) {\n\n array_push($product_ids, $item->getProduct()->getId());\n }\n return $product_ids;\n }", "public function deleteCart(){\n $cartItemModel = \\Ccc::objectManager('\\Model\\Item',false);\n\n foreach($this->getCartItems() as $item){\n $ids[] = $item->itemId;\n }\n \n if($cartItemModel->deleteData($ids)){\n return true;\n }\n\n return false;\n }", "function check_cart_item_stock() {\n\t\t\t$error = new WP_Error();\n\t\t\tforeach ($this->cart_contents as $cart_item_key => $values) :\n\t\t\t\t$_deals = $values['data'];\n\t\t\t\tif ($_deals->managing_stock()) :\n\t\t\t\t\tif ($_deals->is_in_stock() && $_deals->has_enough_stock( $values['quantity'] )) :\n\t\t\t\t\t\t// :)\n\t\t\t\t\telse :\n\t\t\t\t\t\t$error->add( 'out-of-stock', sprintf(__('Sorry, we do not have enough \"%s\" in stock to fulfill your order (%s in stock). Please edit your cart and try again. We apologise for any inconvenience caused.', 'cmdeals'), $_deals->get_title(), $_deals->_stock ) );\n\t\t\t\t\t\treturn $error;\n\t\t\t\t\tendif;\n\t\t\t\tendif;\n\t\t\tendforeach;\n\t\t\treturn true;\n\t\t}", "function fetchProductsFromCart () {\r\n if (checkCart()) {\r\n $sql = \"SELECT * FROM stockitems WHERE StockItemID IN (\" . arrayToSQLString(array_keys($_SESSION['cart'])) . \")\";\r\n return runQuery($sql);\r\n }\r\n}", "public function validateCart($cart = null)\n {\n\n $check = true;\n $messages = [];\n\n if(!$cart) {\n $cart = $this->getCart(['cartItems.product']);\n }\n\n // Check we actually have items\n if(count($cart->cartItems) <= 0) {\n $check = false;\n \\Notification::warning('There are no items in your cart.');\n }\n\n\n // Check the validity of all cart items\n $cart->cartItems->each(function($item){\n if (!$item->valid){\n $check = false;\n \\Notification::warning('An item in your cart is invalid. Please either remove or replace it.');\n }\n\n });\n\n foreach($cart->cartItems->groupBy('product_id') as $itemGroup) {\n\n $cartQuantity = 0;\n\n foreach($itemGroup as $item) {\n $cartQuantity += $item->quantity;\n }\n\n $product = $itemGroup->first()->product;\n\n // Check product stock\n if (!$product->checkStock($cartQuantity)) {\n $check = false;\n \\Notification::warning('We don\\'t have enough of this product in stock.');\n }\n\n // Check product extras stock\n// foreach($product->extras as $extra) {\n// if (!$extra->checkStock($cartQuantity)) {\n// $check = false;\n// \\Notification::warning('We don\\'t have enough of this product extra in stock.');\n// }\n// };\n\n };\n\n return [\n 'check' => $check,\n 'messages' => $messages\n ];\n\n\n // Check that item products exist\n\n // Check that item options exist\n\n // Check that item extras exist\n\n\n // Check that item product has stock\n\n\n // Check that item extras have stock\n\n\n\n\n }", "public function getHasCartIdentifier()\n {\n return method_exists($this, 'getKey') ? $this->getKey() : $this->id;\n }", "protected function _checkIfProductIsOnTheList(\\Shop\\Product $product) {\n foreach ($this->workingProductList as $key => $workingProduct) {\n if ($workingProduct->getBarcode() == $product->getBarcode()) {\n unset($this->workingProductList[$key]);\n return true;\n }\n }\n\n return false;\n }", "public function getActiveCartProducts();", "public function checkShipment($items) {\n if (!is_array($items)) {\n return 0;\n }\n $arItems = array();\n $arStockItems = array();\n $orderItems = Mage::getModel('sales/order_item')\n ->getCollection()\n ->addFieldToFilter('item_id', array('in' => array_keys($items)));\n if ($orderItems->getSize()) {\n foreach ($orderItems as $orderItem) {\n $arItems[$orderItem->getId()] = $orderItem;\n $arStockItems[$orderItem->getProductId()] = $orderItem->getProductId();\n }\n }\n\n $stockItems = Mage::getModel('cataloginventory/stock_item')\n ->getCollection()\n ->addFieldToFilter('product_id', array('in' => array_keys($arStockItems)));\n if ($stockItems->getSize()) {\n foreach ($stockItems as $stockItem) {\n $arStockItems[$stockItem->getProductId()] = $stockItem;\n }\n }\n foreach ($items as $item_id => $qty) {\n $item = $arItems[$item_id];\n $stockItem = $arStockItems[$item->getProductId()];\n $manageStock = $stockItem->getManageStock();\n if ($stockItem->getUseConfigManageStock()) {\n $manageStock = Mage::getStoreConfig('cataloginventory/item_options/manage_stock', Mage::app()->getStore()->getStoreId());\n }\n if (!$manageStock) {\n continue;\n }\n if (in_array($item->getProductType(), array('configurable', 'bundle', 'grouped', 'virtual', 'downloadable')))\n continue;\n\n if ($this->selectWarehouseToShip($item->getProductId(), $qty) == 0) {\n return 0;\n };\n }\n return 1;\n }", "public function product_exists($id)\n\t{\n\t\tif($stmt = $this->Database->prepare(\"SELECT id FROM $this->db_table WHERE id = ?\"))\n\t\t{\n\t\t\t$stmt->bind_param('i', $id);\n\t\t\t$stmt->execute();\n\t\t\t$stmt->store_result();\n\t\t\t$stmt->bind_result($prod_id);\n\t\t\t$stmt->fetch();\n\n\t\t\tif($stmt->num_rows > 0)\n\t\t\t{\n\t\t\t\t$stmt->close();\n\t\t\t\treturn TRUE;\n\t\t\t}else\n\t\t\t{\n\t\t\t\t$stmt->close();\n\t\t\t\treturn FALSE;\n\t\t\t}\n\t\t\t\n\t\t}\n\t}", "public function arrayItems() {\r\n $quoteId = Mage::getSingleton('checkout/session')->getQuote()->getId();\r\n $session = Mage::getModel('giftwrap/selection')->getSelectionByQuoteId(\r\n $quoteId);\r\n $productIds = array();\r\n if ($session) {\r\n foreach ($session as $value) {\r\n $productIds[] = $value['itemId'];\r\n }\r\n }\r\n return $productIds;\r\n }", "public function check_bid_already_placed($user_id, $product_id)\n\t{\n\t\t$this->db->where('user_id', $user_id);\n\t\t$this->db->where('product_id', $product_id);\n\t\t$this->db->limit(1);\n\t\t$query = $this->db->get('product_bids');\n\n\t\tif($query->num_rows() > 0)\n\t\t{\n\t\t\treturn $query->row();\n\t\t}\n\t\treturn FALSE;\n\t}", "public function insertUpdateStoreProductsInCart() {\n if (func_num_args() > 0) {\n $user_id = func_get_arg(0);\n $store_id = func_get_arg(1);\n $product_id = func_get_arg(2);\n $quantity = func_get_arg(3);\n $allCartDetail = array();\n $success = null;\n $i = 0;\n $this->getAdapter()->beginTransaction();\n\n try {\n\n foreach ($product_id as $key => $value) {\n $cartId = $this->select()\n ->from($this, array('id'))\n ->where('user_id = ?', $user_id)\n ->where('store_id = ?', $store_id)\n ->where('product_id = ?', $value);\n\n $cartId = $this->getAdapter()->fetchRow($cartId);\n\n $data = null;\n\n if ($cartId) {\n\n $where['id = ?'] = $cartId['id'];\n $data1 = array('quantity' => 0);\n $data2 = array('quantity' => $quantity[$key]);\n $updateQuantity1 = $this->update($data1, $where);\n $updateQuantity2 = $this->update($data2, $where);\n\n if ($updateQuantity1 && $updateQuantity2) {\n\n $allCartDetail[$i]['cartId'] = $cartId['id'];\n $allCartDetail[$i]['productId'] = $value;\n $allCartDetail[$i]['orderedQuantity'] = $quantity[$key];\n $success = true;\n } else {\n $success = false;\n break;\n }\n } else {\n\n $data = array(\n 'product_id' => $value,\n 'user_id' => $user_id,\n 'quantity' => $quantity[$key],\n 'store_id' => $store_id,\n );\n\n $insertedCartId = $this->insert($data);\n\n if ($insertedCartId) {\n $allCartDetail[$i]['cartId'] = $insertedCartId;\n $allCartDetail[$i]['productId'] = $value;\n $allCartDetail[$i]['orderedQuantity'] = $quantity[$key];\n $success = true;\n } else {\n $success = false;\n break;\n }\n }\n\n $i++;\n }\n\n if ($success) {\n $this->getAdapter()->commit();\n return $allCartDetail;\n } else {\n $this->getAdapter()->rollBack();\n return 'fail';\n }\n } catch (Exception $ex) {\n $this->getAdapter()->rollBack();\n throw new Exception(\"Error : \" . $ex);\n }\n } else {\n throw new Exception(\"Argument has not passed\");\n }\n }", "public function getDuplicatedCartItems()\n {\n return DB::table('carts')\n ->rightJoin('product_cart', 'carts.id', '=', 'product_cart.cart_id')\n ->where('user_id', Auth::user()->id)\n ->where('state', 'direct-buy')\n ->get();\n }", "public function contains ($item)\n {\n return in_array($item, $this->data);\n }", "public static function checkForNearProducts() {\n $cartDeliveryPostcodeSessionKey = \\Config::get('appConstants.user_delivery_postcode_session_key');\n $landingPagePostcodeSessionKey = \\Config::get('appConstants.user_landing_postcode_session_key');\n $landingPostcode = session()->get($landingPagePostcodeSessionKey, '');\n $cartPostcode = session()->get($cartDeliveryPostcodeSessionKey, '');\n if (!empty($landingPostcode)\n || !empty($cartPostcode)\n ) {\n return true;\n }\n return false;\n }", "public static function isInCompareList($pid){\n $session = JFactory::getSession();\n $comparelist_ids = $session->get('comparelist');\n $comparelist = explode(\",\",trim($comparelist_ids));\n if(in_array($pid,$comparelist)){\n return true;\n }else{\n return false;\n }\n }", "function checkCart() {\r\n if (! isset($_SESSION['cart'])) {\r\n $_SESSION['cart'] = [];\r\n return true;\r\n } else {\r\n return true;\r\n }\r\n}" ]
[ "0.76885545", "0.72726315", "0.71570605", "0.7062429", "0.70518184", "0.70260215", "0.6801146", "0.67771834", "0.67687976", "0.6692284", "0.6680998", "0.6586269", "0.65501696", "0.64686936", "0.6466079", "0.6434011", "0.6391579", "0.63676953", "0.63592964", "0.6351758", "0.63478047", "0.6312935", "0.6272507", "0.6263646", "0.6227461", "0.6226582", "0.6210878", "0.6200267", "0.61720455", "0.61407864", "0.6137723", "0.61205125", "0.6117385", "0.6086604", "0.6082769", "0.607556", "0.6073426", "0.60398495", "0.60346013", "0.60323703", "0.60288036", "0.6017837", "0.60157055", "0.5989888", "0.59852093", "0.5984494", "0.5966867", "0.5946884", "0.59434825", "0.59397686", "0.5927173", "0.59263164", "0.59178746", "0.59169304", "0.5915791", "0.5885564", "0.5862647", "0.5852369", "0.5849825", "0.5836359", "0.5834778", "0.5824242", "0.58168674", "0.58114725", "0.5803233", "0.5797576", "0.57821167", "0.5780056", "0.57758844", "0.57758844", "0.57758844", "0.57758844", "0.57758844", "0.5760518", "0.57577246", "0.5748076", "0.57462966", "0.5734728", "0.5732762", "0.57233095", "0.5722757", "0.57200795", "0.5713637", "0.5697328", "0.5689734", "0.5687346", "0.5683982", "0.56618416", "0.5653659", "0.5638911", "0.560826", "0.56051075", "0.560016", "0.5597774", "0.5595469", "0.5587668", "0.55800927", "0.5575208", "0.5572572", "0.55721575" ]
0.72413796
2
Prepare product. Convert prices
public static function prepareProduct($product, $sku_id = 0) { // Текущая валюта $current_cur = wa('shop')->getConfig()->getCurrency(false); // Основная валюта $primary_cur = wa('shop')->getConfig()->getCurrency(true); if ($sku_id) { $sku = (new shopProductSkusModel())->getById($sku_id); // Если переданные данные совпадают if ($sku && $sku['product_id'] == $product['id']) { $product_currency = !empty($product['unconverted_currency']) ? $product['unconverted_currency'] : $product['currency']; $currency_rounding = shopFlexdiscountHelper::getSettings('currency_rounding'); // Вызываем хук frontend_products $skus = array($sku['id'] => $sku); $event_params = array("skus" => &$skus); wa('shop')->event('frontend_products', $event_params); $sku = reset($skus); $sku['product'] = $product; $sku['sku_id'] = $sku['id']; $sku['id'] = $sku['product_id']; $sku['quantity'] = !empty($product['quantity']) ? $product['quantity'] : 1; // Переводим цены товара в текущую валюту $sku['price'] = isset($sku['old_price']) ? $sku['old_price'] : $sku['price']; $sku['price'] = shop_currency($sku['price'], $product_currency, $current_cur, false); $sku['compare_price'] = isset($sku['old_compare_price']) ? $sku['old_compare_price'] : $sku['compare_price']; $sku['compare_price'] = shop_currency($sku['compare_price'], $product_currency, $current_cur, false); $sku['purchase_price'] = shop_currency($sku['purchase_price'], $product_currency, $current_cur, false); if (!empty($currency_rounding)) { $sku['price'] = shopRounding::roundCurrency($sku['price'], $current_cur); $sku['compare_price'] = shopRounding::roundCurrency($sku['compare_price'], $current_cur); $sku['purchase_price'] = shopRounding::roundCurrency($sku['purchase_price'], $current_cur); } if ($sku['compare_price'] == $sku['price']) { $sku['compare_price'] = 0; } // Сохраняем услуги, если они имеются if (!empty($product['services'])) { $sku['services'] = $product['services']; } $product = $sku; } } else { // Переводим цены товара в текущую валюту $product['price'] = isset($product['old_price']) ? $product['old_price'] : $product['price']; $product['price'] = shop_currency($product['price'], isset($product['old_price']) ? $current_cur : $primary_cur, $current_cur, false); $product['compare_price'] = isset($product['old_compare_price']) ? $product['old_compare_price'] : $product['compare_price']; $product['compare_price'] = shop_currency($product['compare_price'], isset($product['old_compare_price']) ? $current_cur : $primary_cur, $current_cur, false); if ($product['compare_price'] == $product['price']) { $product['compare_price'] = 0; } if (isset($product['purchase_price'])) { $product['purchase_price'] = shop_currency($product['purchase_price'], $primary_cur, $current_cur, false); } if (!isset($product['unconverted_currency'])) { $product['unconverted_currency'] = $product['currency']; } } $product['type'] = 'product'; $product['currency'] = $current_cur; return $product; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private function prepareSimpleProduct() {\n if ($this->getSaverData()->isFirstPage()) {\n $this->setPrice();\n $this->setDownloadOptions();\n $this->setSKU();\n $this->setStockOptions();\n $this->setSoldIndividually();\n $this->setShippingOptions();\n $this->setPurchaseNote();\n $this->setEnableReviews();\n $this->setMenuOrder();\n }\n\n $this->setTags();\n $this->setAttributes();\n }", "private function prepareExternalProduct() {\n if ($this->getSaverData()->isFirstPage()) {\n $this->setPrice();\n $this->setSKU();\n $this->setEnableReviews();\n $this->setMenuOrder();\n $this->setExternalProductDetails();\n }\n\n $this->setTags();\n $this->setAttributes();\n }", "protected function _prepareProductForResponse(Mage_Catalog_Model_Product $product) {\n $websiteId = ( int ) $this->getRequest ()->getParam ( static::WEBSITE_ID );\n if ($websiteId <= 0) {\n $websiteId = Mage::app ()->getWebsite ( 'base' )->getId ();\n }\n // get store id from request\n $storeId = ( int ) $this->getRequest ()->getParam ( static::STORE_ID );\n if ($storeId <= 0) {\n $storeId = Mage::app ()->getWebsite ( $websiteId )->getDefaultGroup ()->getDefaultStoreId ();\n }\n // get customer id from request\n $customerId = ( int ) $this->getRequest ()->getParam ( 'customer_id' );\n // get image size for resize\n $imageSize = ( int ) $this->getRequest ()->getParam ( 'image_size' );\n \n /**\n *\n * @var $productHelper Mage_Catalog_Helper_Product\n */\n $productHelper = Mage::helper ( static::CAT_PRO );\n \n $productData [static::ENTITYID] = $product->getEntity_id ();\n $productData [static::NAME] = $product->getName ();\n $productData ['type_id'] = $product->getTypeId ();\n $product->setWebsiteId ( $websiteId );\n // customer group is required in product for correct prices calculation\n $product->setCustomerGroupId ( $this->_getCustomerGroupId () );\n // calculate prices\n $finalPrice = $product->getFinalPrice ();\n if ($product->getTypeId () == 'grouped') {\n $productData ['regular_price_with_tax'] = number_format ( $product->getMinimalPrice (), 2, '.', '' );\n $productData ['final_price_with_tax'] = number_format ( $product->getMinimalPrice (), 2, '.', '' );\n } else {\n $productData ['regular_price_with_tax'] = number_format ( $this->_applyTaxToPrice ( $product->getPrice (), true ), 2, '.', '' );\n $productData ['regular_price_without_tax'] = number_format ( $this->_applyTaxToPrice ( $product->getPrice (), false ), 2, '.', '' );\n $productData ['final_price_with_tax'] = number_format ( $this->_applyTaxToPrice ( $finalPrice, true ), 2, '.', '' );\n $productData ['final_price_without_tax'] = number_format ( $this->_applyTaxToPrice ( $finalPrice, false ), 2, '.', '' );\n }\n // get product stock details\n $stockDetail = Mage::getModel ( static::LOGIN_TOKEN )->getStockDetail ( $product );\n $productData [static::IS_SALEABLE] = $stockDetail [static::IS_SALEABLE];\n $productData [static::ISSTOCK] = $stockDetail ['is_stock'];\n // get product image\n if ($imageSize <= 0) {\n $productData [static::IMGURL] = ( string ) Mage::helper ( static::CATIMG )->init ( $product, static::SMALLIMG );\n } else {\n $productData [static::IMGURL] = ( string ) Mage::helper ( static::CATIMG )->init ( $product, static::SMALLIMG )->constrainOnly ( TRUE )->keepAspectRatio ( TRUE )->keepFrame ( FALSE )->resize ( $imageSize, null );\n }\n // get rating\n $productData ['summary_rating'] = Mage::getModel ( static::LOGIN_TOKEN )->rateSummary ( $product->getId (), $storeId ) ? Mage::getModel ( static::LOGIN_TOKEN )->rateSummary ( $product->getId (), $storeId ) : '0';\n // get wishlisted products by customer\n $wishListIds = array ();\n if ($customerId > 0) {\n $wishListIds = Mage::getModel ( static::LOGIN_TOKEN )->getWishlistByCustomer ( $customerId );\n }\n // Check to see the product is in wishlist\n if (in_array ( $product->getId (), $wishListIds )) {\n $productData [static::ISWISHLIST] = true;\n } else {\n $productData [static::ISWISHLIST] = false;\n }\n // get product stock details\n $inventoryDetail = Mage::getModel ( static::LOGIN_FUNCTIONS )->getinventoryDetail ( $product, $storeId );\n // get stock qty\n $productData [static::STOCK_QTY] = $inventoryDetail [static::STOCK_QTY];\n $productData [static::MIN_SALE_QTY] = $inventoryDetail [static::MIN_SALE_QTY];\n $productData [static::MAX_SALE_QTY] = $inventoryDetail [static::MAX_SALE_QTY];\n $productData [static::QTY_INCR] = $inventoryDetail [static::QTY_INCR];\n $productData [static::IS_QTY_DECIMAL] = $inventoryDetail [static::IS_QTY_DECIMAL];\n \n if ($this->getActionType () == static::ACTION_TYPE_ENTITY) {\n // define URLs\n $productData ['url'] = $productHelper->getProductUrl ( $product->getId () );\n if ($imageSize <= 0) {\n $productData [static::IMGURL] = ( string ) Mage::helper ( static::CATIMG )->init ( $product, 'image' );\n } else {\n $productData [static::IMGURL] = ( string ) Mage::helper ( static::CATIMG )->init ( $product, 'image' )->constrainOnly ( TRUE )->keepAspectRatio ( TRUE )->keepFrame ( FALSE )->resize ( $imageSize, null );\n }\n \n // @var $cartHelper Mage_Checkout_Helper_Cart\n $cartHelper = Mage::helper ( 'checkout/cart' );\n $productData ['buy_now_url'] = $cartHelper->getAddUrl ( $product );\n \n /**\n *\n * @var $reviewModel Mage_Review_Model_Review\n */\n $reviewModel = Mage::getModel ( 'review/review' );\n $productData ['total_reviews_count'] = $reviewModel->getTotalReviews ( $product->getId (), true, $storeId );\n $productData [static::TIERPRICE] = number_format ( $this->_getTierPrices (), 2, '.', '' );\n // get product has custom options or not\n $productData ['has_custom_options'] = count ( $product->getOptions () ) > 0;\n } else {\n // remove tier price from response\n $product->unsetData ( static::TIERPRICE );\n unset ( $productData [static::TIERPRICE] );\n }\n return $productData;\n }", "function _prepareGroupedProductPriceData($entityIds = null) {\n\t\t\t$write = $this->_getWriteAdapter( );\n\t\t\t$table = $this->getIdxTable( );\n\t\t\t$select = $write->select( )->from( array( 'e' => $this->getTable( 'catalog/product' ) ), 'entity_id' )->joinLeft( array( 'l' => $this->getTable( 'catalog/product_link' ) ), 'e.entity_id = l.product_id AND l.link_type_id=' . LINK_TYPE_GROUPED, array( ) )->join( array( 'cg' => $this->getTable( 'customer/customer_group' ) ), '', array( 'customer_group_id' ) );\n\t\t\t$this->_addWebsiteJoinToSelect( $select, true );\n\t\t\t$this->_addProductWebsiteJoinToSelect( $select, 'cw.website_id', 'e.entity_id' );\n\n\t\t\tif ($this->getVersionHelper( )->isGe1600( )) {\n\t\t\t\t$minCheckSql = $write->getCheckSql( 'le.required_options = 0', 'i.min_price', 0 );\n\t\t\t\t$maxCheckSql = $write->getCheckSql( 'le.required_options = 0', 'i.max_price', 0 );\n\t\t\t\t$taxClassId = $this->_getReadAdapter( )->getCheckSql( 'MIN(i.tax_class_id) IS NULL', '0', 'MIN(i.tax_class_id)' );\n\t\t\t\t$minPrice = new Zend_Db_Expr( 'MIN(' . $minCheckSql . ')' );\n\t\t\t\t$maxPrice = new Zend_Db_Expr( 'MAX(' . $maxCheckSql . ')' );\n\t\t\t} \nelse {\n\t\t\t\t$taxClassId = new Zend_Db_Expr( 'IFNULL(i.tax_class_id, 0)' );\n\t\t\t\t$minPrice = new Zend_Db_Expr( 'MIN(IF(le.required_options = 0, i.min_price, 0))' );\n\t\t\t\t$maxPrice = new Zend_Db_Expr( 'MAX(IF(le.required_options = 0, i.max_price, 0))' );\n\t\t\t}\n\n\t\t\t$stockId = 'IF (i.stock_id IS NOT NULL, i.stock_id, 1)';\n\t\t\t$select->columns( 'website_id', 'cw' )->joinLeft( array( 'le' => $this->getTable( 'catalog/product' ) ), 'le.entity_id = l.linked_product_id', array( ) );\n\n\t\t\tif ($this->getVersionHelper( )->isGe1700( )) {\n\t\t\t\t$columns = array( 'tax_class_id' => $taxClassId, 'price' => new Zend_Db_Expr( 'NULL' ), 'final_price' => new Zend_Db_Expr( 'NULL' ), 'min_price' => $minPrice, 'max_price' => $maxPrice, 'tier_price' => new Zend_Db_Expr( 'NULL' ), 'group_price' => new Zend_Db_Expr( 'NULL' ), 'stock_id' => $stockId, 'currency' => 'i.currency', 'store_id' => 'i.store_id' );\n\t\t\t} \nelse {\n\t\t\t\t$columns = array( 'tax_class_id' => $taxClassId, 'price' => new Zend_Db_Expr( 'NULL' ), 'final_price' => new Zend_Db_Expr( 'NULL' ), 'min_price' => $minPrice, 'max_price' => $maxPrice, 'tier_price' => new Zend_Db_Expr( 'NULL' ), 'stock_id' => $stockId, 'currency' => 'i.currency', 'store_id' => 'i.store_id' );\n\t\t\t}\n\n\t\t\t$select->joinLeft( array( 'i' => $table ), '(i.entity_id = l.linked_product_id) AND (i.website_id = cw.website_id) AND ' . '(i.customer_group_id = cg.customer_group_id)', $columns );\n\t\t\t$select->group( array( 'e.entity_id', 'cg.customer_group_id', 'cw.website_id', $stockId, 'i.currency', 'i.store_id' ) )->where( 'e.type_id=?', $this->getTypeId( ) );\n\n\t\t\tif (!is_null( $entityIds )) {\n\t\t\t\t$select->where( 'l.product_id IN(?)', $entityIds );\n\t\t\t}\n\n\t\t\t$eventData = array( 'select' => $select, 'entity_field' => new Zend_Db_Expr( 'e.entity_id' ), 'website_field' => new Zend_Db_Expr( 'cw.website_id' ), 'stock_field' => new Zend_Db_Expr( $stockId ), 'currency_field' => new Zend_Db_Expr( 'i.currency' ), 'store_field' => new Zend_Db_Expr( 'cs.store_id' ) );\n\n\t\t\tif (!$this->getWarehouseHelper( )->getConfig( )->isMultipleMode( )) {\n\t\t\t\t$eventData['stock_field'] = new Zend_Db_Expr( 'i.stock_id' );\n\t\t\t}\n\n\t\t\tMage::dispatchEvent( 'catalog_product_prepare_index_select', $eventData );\n\t\t\t$query = $select->insertFromSelect( $table );\n\t\t\t$write->query( $query );\n\t\t\treturn $this;\n\t\t}", "private function SetPricingDetails()\n\t{\n\t\t$product = $this->productClass->getProduct();\n\n\t\t$GLOBALS['PriceLabel'] = GetLang('Price');\n\n\t\tif($this->productClass->GetProductCallForPricingLabel()) {\n\t\t\t$GLOBALS['ProductPrice'] = $GLOBALS['ISC_CLASS_TEMPLATE']->ParseGL($this->productClass->GetProductCallForPricingLabel());\n\t\t}\n\t\t// If prices are hidden, then we don't need to go any further\n\t\telse if($this->productClass->ArePricesHidden()) {\n\t\t\t$GLOBALS['HidePrice'] = \"display: none;\";\n\t\t\t$GLOBALS['HideRRP'] = 'none';\n\t\t\t$GLOBALS['ProductPrice'] = '';\n\t\t\treturn;\n\t\t}\n\t\telse if (!$this->productClass->IsPurchasingAllowed()) {\n\t\t\t$GLOBALS['ProductPrice'] = GetLang('NA');\n\t\t}\n\t\telse {\n\t\t\t$options = array('strikeRetail' => false);\n\t\t\t$GLOBALS['ProductPrice'] = formatProductDetailsPrice($product, $options);\n\t\t}\n\n\t\t// Determine if we need to show the RRP for this product or not\n\t\t// by comparing the price of the product including any taxes if\n\t\t// there are any\n\t\t$GLOBALS['HideRRP'] = \"none\";\n\t\t$productPrice = $product['prodcalculatedprice'];\n\t\t$retailPrice = $product['prodretailprice'];\n\t\tif($retailPrice) {\n\t\t\t// Get the tax display format\n\t\t\t$displayFormat = getConfig('taxDefaultTaxDisplayProducts');\n\t\t\t$options['displayInclusive'] = $displayFormat;\n\n\t\t\t// Convert to the browsing currency, and apply group discounts\n\t\t\t$productPrice = formatProductPrice($product, $productPrice, array(\n\t\t\t\t'localeFormat' => false, 'displayInclusive' => $displayFormat\n\t\t\t));\n\t\t\t$retailPrice = formatProductPrice($product, $retailPrice, array(\n\t\t\t\t'localeFormat' => false, 'displayInclusive' => $displayFormat\n\t\t\t));\n\n\t\t\tif($productPrice < $retailPrice) {\n\t\t\t\t$GLOBALS['HideRRP'] = '';\n\n\t\t\t\t// Showing call for pricing, so just show the RRP and that's all\n\t\t\t\tif($this->productClass->GetProductCallForPricingLabel()) {\n\t\t\t\t\t$GLOBALS['RetailPrice'] = CurrencyConvertFormatPrice($retailPrice);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\t// ISC-1057: do not apply customer discount to RRP in this case\n\t\t\t\t\t$retailPrice = formatProductPrice($product, $product['prodretailprice'], array(\n\t\t\t\t\t\t'localeFormat' => false,\n\t\t\t\t\t\t'displayInclusive' => $displayFormat,\n\t\t\t\t\t\t'customerGroup' => 0,\n\t\t\t\t\t));\n\t\t\t\t\t$GLOBALS['RetailPrice'] = '<strike>' . formatPrice($retailPrice) . '</strike>';\n\t\t\t\t\t$GLOBALS['PriceLabel'] = GetLang('YourPrice');\n\t\t\t\t\t$savings = $retailPrice - $productPrice;\n\t\t\t\t\t$string = sprintf(getLang('YouSave'), '<span class=\"YouSaveAmount\">'.formatPrice($savings).'</span>');\n\t\t\t\t\t$GLOBALS['YouSave'] = '<span class=\"YouSave\">'.$string.'</span>';\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "public function prepareData($collection, $productIds)\n {\n foreach ($collection as &$item) {\n if ($item->getSpecialPrice()) {\n $product = $this->productRepository->get($item->getSku());\n $specialFromDate = $product->getSpecialFromDate();\n $specialToDate = $product->getSpecialToDate();\n\n if ($specialFromDate || $specialToDate) {\n $id = $product->getId();\n $this->effectiveDates[$id] = $this->getSpecialEffectiveDate($specialFromDate, $specialToDate);\n }\n }\n }\n }", "protected function calculatePrices()\n {\n }", "function uds_pricing_process_products()\n{\n\tglobal $uds_pricing_column_options;\n\n\tif(!empty($_POST['uds_pricing_products_nonce']) && wp_verify_nonce($_POST['uds_pricing_products_nonce'], 'uds-pricing-products-nonce')) {\n\t\t//d($_POST);\n\t\t$pricing_tables = maybe_unserialize(get_option(UDS_PRICING_OPTION, array()));\n\t\t$table_name = $_GET['uds_pricing_edit'];\n\t\t$pricing_table = $pricing_tables[$table_name];\n\t\t\n\t\tif(empty($pricing_table)) {\n\t\t\treturn new WP_Error(\"uds_pricing_table_nonexistent\", \"This pricing table does not exist!\");\n\t\t}\n\t\t\n\t\t$pricing_table['no-featured'] = $_POST['uds-no-featured'] == 'on' ? true : false ;\n\t\t\n\t\t$products = $pricing_table['products'];\n\t\tif(empty($products)) $products = array();\n\t\t\n\t\t$options = $uds_pricing_column_options;\n\t\tforeach($options as $option_name => $option) {\n\t\t\tif($option_name == 'uds-featured') continue;\n\t\t\tforeach($_POST[$option_name] as $key => $value) {\n\t\t\t\t$products[$key][$option_name] = $value;\n\t\t\t}\n\t\t}\n\t\t\n\t\t// process featured\n\t\tforeach($products as $key => $product) {\n\t\t\tif($key == $_POST['uds-featured']) {\n\t\t\t\t$products[$key][$option_name] = true;\n\t\t\t} else {\n\t\t\t\t$products[$key][$option_name] = false;\n\t\t\t}\n\t\t}\n\t\t\n\t\t//d($products);\n\t\t$purge = array();\n\t\tforeach($pricing_table['properties'] as $name => $type) {\n\t\t\tforeach($products as $key => $product) {\n\t\t\t\tif($product['uds-name'] == \"\") $purge[] = $key;\n\t\t\t\t//$post_name = str_replace(' ', '_', $name);\n\t\t\t\t$post_name = sanitize_title_with_dashes($name);\n\t\t\t\tif(isset($_POST[$post_name][$key])) {\n\t\t\t\t\t$products[$key]['properties'][$name] = $_POST[$post_name][$key];\n\t\t\t\t} else {\n\t\t\t\t\t$products[$key]['properties'][$name] = '';\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tforeach($purge as $key) {\n\t\t\tunset($products[$key]);\n\t\t}\n\t\t\n\t\t//d($products);\n\t\t$pricing_table['products'] = $products;\n\t\t$pricing_tables[$table_name] = $pricing_table;\n\t\tupdate_option(UDS_PRICING_OPTION, maybe_serialize($pricing_tables));\n\t}\n}", "function es_set_sale_price( $price, $product ) {\n\t\n\t$exclude_skus = array( 'COEBRCE', 'COEPOSTER', 'PUB41' );\n\t$exclude_cats = array( 'specials', 'clearance' );\n\t$date_now = new DateTime();\n\t$start_dtm = new DateTime( '2016-10-03' );\n\t$end_dtm = new DateTime( '2016-10-11' );\n\t\n\t// exclude SKUs\n\tif ( in_array( $product->sku, $exclude_skus ) )\n\t\treturn $price;\n\t\n\t// exclude specials category\n\t$product_cat = wp_get_post_terms( $product->id, 'product_cat' );\n\t\n\tforeach ( $product_cat as $term ){\n\t\tif( in_array( $term->slug, $exclude_cats ) ){\n\t\t\treturn $price;\n\t\t}\n\t}\t\n\t\n\tif ( ! $product->is_virtual() AND ( $date_now >= $start_dtm AND $date_now <= $end_dtm ) ) {\n\t\t$member_exists = es_check_membership_held();\n\t\t$member_price = get_post_meta($product->id, 'member_price', true);\n\t\t$price = $product->get_regular_price() * ( 0.9 );\n\t\t\n\t\tif ( ! empty( $member_price ) AND $member_exists ) {\n\t\t\t$product->set_price( $member_price );\n\t\t\t$product->sale_price = $price;\n\t\t\t$price = $member_price;\t\t\n\t\t}\n\t\telse {\n\t\t\t$product->set_price( $price );\n\t\t\t$product->sale_price = $price;\t\n\t\t}\n\t\t\n\t}\n\t\n\treturn $price;\n}", "protected function _getProductData() {\n\n\n $cat_id = Mage::getModel('catalog/layer')->getCurrentCategory()->getId();\n $category = Mage::getModel('catalog/category')->load($cat_id);\n $data['event'] = 'product';\n\n $finalPrice = $this->getFinalPriceDiscount();\n if($finalPrice):\n $google_tag_params = array();\n $google_tag_params['ecomm_prodid'] = $this->getProduct()->getSku();\n $google_tag_params['name'] = $this->getProduct()->getName();\n $google_tag_params['brand'] = $this->getProduct()->getBrand();\n $google_tag_params['ecomm_pagetype'] = 'product';\n $google_tag_params['ecomm_category'] = $category->getName();\n $google_tag_params['ecomm_totalvalue'] = (float)$this->formatNumber($finalPrice);\n \n $customer = Mage::getSingleton('customer/session');\n if ($customer->getCustomerId()){\n $google_tag_params['user_id'] = (string) $customer->getCustomerId(); \n }\n if($this->IsReturnedCustomer()){\n $google_tag_params['returnCustomer'] = 'true';\n }\n else {\n $google_tag_params['returnCustomer'] = 'false';\n }\n\n $data['google_tag_params'] = $google_tag_params;\n\n /* Facebook Conversion API Code */\n $custom_data = array(\n \"content_name\" => $this->getProduct()->getName(),\n \"content_ids\" => [$this->getProduct()->getSku()],\n \"content_category\" => $category->getName(),\n \"content_type\" => \"product\",\n \"value\" => (float)$this->formatNumber($finalPrice),\n \"currency\" => \"BRL\"\n );\n $this->createFacebookRequest(\"ViewContent\", [], [], $custom_data);\n /* End Facebook Conversion API Code */\n\n endif;\n\n return $data;\n }", "public function scalePrices($product)\n {\n \n // Get the configurable Id\n $configurableId = $this->getConfigurableId($product);\n \n // Check we actually have a configurable product\n if ($configurableId > 0)\n {\n // Get the configurable product and associated base price\n // Please note the price will not be the actual configurable, price but the cheapest price from all the simple products\n $configurableProduct = Mage::getSingleton(\"catalog/Product\")->load($configurableId);\n $configurablePrice = $configurableProduct->getPrice();\n \n // Get current attribute data\n $configurableAttributesData = $configurableProduct->getTypeInstance()->getConfigurableAttributesAsArray();\n $configurableProductsData = array();\n \n // We need to identify the attribute name and Id\n $prodAttrName = $this->getAttributeName($configurableProduct);\n $prodAttrId = $this->getAttributeId($prodAttrName);\n \n // Get associates simple products\n $associatedProducts = $configurableProduct->getTypeInstance()->getUsedProducts();\n foreach ($associatedProducts as $prodList)\n {\n // For each associated simple product gather the data and calculate the extra fixed price\n $prodId = $prodList->getId();\n $prodAttrLabel = $prodList->getAttributeText($prodAttrName);\n $prodAttrValueIndex = $prodList[$prodAttrName];\n $prodScalePrice = $prodList['price'] - $configurablePrice;\n \n $productData = array(\n 'label' => $prodAttrLabel,\n 'attribute_id' => $prodAttrId,\n 'value_index' => $prodAttrValueIndex,\n 'pricing_value' => $prodScalePrice,\n 'is_percent' => '0'\n );\n $configurableProductsData[$prodId] = $productData;\n $configurableAttributesData[0]['values'][] = $productData;\n }\n \n $configurableProduct->setConfigurableProductsData($configurableProductsData);\n $configurableProduct->setConfigurableAttributesData($configurableAttributesData);\n $configurableProduct->setCanSaveConfigurableAttributes(true);\n Mage::log($configurableProductsData, null, 'configurableProductsData.log', true);\n Mage::log($configurableAttributesData, null, 'configurableAttributesData.log', true);\n \n try\n {\n $configurableProduct->save(); \n }\n catch (Exception $e)\n {\n $this->_debug($e->getMessage());\n }\n \n } \n }", "private function _generateProductsData(){\n \n $products = $this->context->cart->getProducts();\n $pagseguro_items = array();\n \n $cont = 1;\n \n foreach ($products as $product) {\n \n $pagSeguro_item = new PagSeguroItem();\n $pagSeguro_item->setId($cont++);\n $pagSeguro_item->setDescription(Tools::truncate($product['name'], 255));\n $pagSeguro_item->setQuantity($product['quantity']);\n $pagSeguro_item->setAmount($product['price_wt']);\n $pagSeguro_item->setWeight($product['weight'] * 1000); // defines weight in gramas\n \n if ($product['additional_shipping_cost'] > 0)\n $pagSeguro_item->setShippingCost($product['additional_shipping_cost']);\n \n array_push($pagseguro_items, $pagSeguro_item);\n }\n \n return $pagseguro_items;\n }", "public function get_prices()\n\t{\n\t\t$product_price_old = 0;\n\t\t$product_price_sale = 0;\n\t\t$price = 0;\n\t\t$eco = 0;\n\t\t$taxes = 0;\n\t\t$dataoc = isset($this->request->post['dataoc']) ? $this->request->post['dataoc'] : '';\n\n\t\tif (!empty($dataoc)) {\n\t\t\t$dataoc = str_replace('&quot;', '\"', $dataoc);\n\t\t\t$json = @json_decode($dataoc, true);\n\t\t\t$product_quantity = isset($json['quantity']) ? $json['quantity'] : 0;\n\t\t\t$product_id_oc = isset($json['product_id_oc']) ? $json['product_id_oc'] : 0;\n\t\t\tif ($product_id_oc == 0) $product_id_oc = isset($json['_product_id_oc']) ? $json['_product_id_oc'] : 0;\n\n\t\t\t// get options\n\t\t\t$options = isset($json['option_oc']) ? $json['option_oc'] : array();\n\t\t\tforeach ($options as $key => $value) {\n\t\t\t\tif ($value == null || empty($value)) unset($options[$key]);\n\t\t\t}\n\n\t\t\t// get all options of product\n\t\t\t$options_temp = $this->get_options_oc($product_id_oc);\n\n\t\t\t// Calc price for ajax\n\t\t\tforeach ($options_temp as $value) {\n\t\t\t\tforeach ($options as $k => $option_val) {\n\t\t\t\t\tif ($k == $value['product_option_id']) {\n\t\t\t\t\t\tif ($value['type'] == 'checkbox' && is_array($option_val) && count($option_val) > 0) {\n\t\t\t\t\t\t\tforeach ($option_val as $val) {\n\t\t\t\t\t\t\t\tforeach ($value['product_option_value'] as $op) {\n\t\t\t\t\t\t\t\t\t// calc price\n\t\t\t\t\t\t\t\t\tif ($val == $op['product_option_value_id']) {\n\t\t\t\t\t\t\t\t\t\tif ($op['price_prefix'] == $this->minus) $price -= isset($op['price_no_tax']) ? $op['price_no_tax'] : 0;\n\t\t\t\t\t\t\t\t\t\telse $price += isset($op['price_no_tax']) ? $op['price_no_tax'] : 0;\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\t\t\t\t} elseif ($value['type'] == 'radio' || $value['type'] == 'select') {\n\t\t\t\t\t\t\tforeach ($value['product_option_value'] as $op) {\n\t\t\t\t\t\t\t\tif ($option_val == $op['product_option_value_id']) {\n\t\t\t\t\t\t\t\t\tif ($op['price_prefix'] == $this->minus) $price -= isset($op['price_no_tax']) ? $op['price_no_tax'] : 0;\n\t\t\t\t\t\t\t\t\telse $price += isset($op['price_no_tax']) ? $op['price_no_tax'] : 0;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// the others have not price, so don't need calc\n\t\t\t\t\t}\n\t\t\t\t\t// if not same -> return.\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t$product_prices = $this->get_product_price($product_id_oc, $product_quantity);\n\t\t\t$product_price_old = isset($product_prices['price_old']) ? $product_prices['price_old'] : 0;\n\t\t\t$product_price_sale = isset($product_prices['price_sale']) ? $product_prices['price_sale'] : 0;\n\t\t\t$enable_taxes = $this->config->get('tshirtecommerce_allow_taxes');\n\t\t\tif ($enable_taxes === null || $enable_taxes == 1) {\n\t\t\t\t$taxes = isset($product_prices['taxes']) ? $product_prices['taxes'] : 0;\n\t\t\t\t$eco = isset($product_prices['eco']) ? $product_prices['eco'] : 0;\n\t\t\t} else {\n\t\t\t\t$taxes = 0;\n\t\t\t\t$eco = 0;\n\t\t\t}\n\t\t\t\n\t\t} // do nothing when empty/blank\n\n\t\t// return price for ajax\n\t\techo @json_encode(array(\n\t\t\t'price' => $price, \n\t\t\t'price_old' => $product_price_old, \n\t\t\t'price_sale' => $product_price_sale, \n\t\t\t'taxes' => $taxes,\n\t\t\t'eco' => $eco\n\t\t));\n\t\treturn;\n\t}", "public function prepareData($collection, $productIds)\n {\n $productCollection = clone $collection;\n $productCollection->addAttributeToFilter('entity_id', ['in' => $productIds]);\n while ($product = $productCollection->fetchItem()) {\n $variations = [];\n $collectionAttr = $this->getWeeAttributeCollection();\n if ($collectionAttr->getSize() > 0) {\n foreach ($collectionAttr as $item) {\n $item->setScopeGlobal(1);\n $tax = $this->getDataTax($product, $item);\n if (!empty($tax)) {\n foreach ($tax as $element) {\n $str = 'name=' . $item->getAttributeCode()\n . Import::DEFAULT_GLOBAL_MULTI_VALUE_SEPARATOR .\n 'country=' . $element['country']\n . Import::DEFAULT_GLOBAL_MULTI_VALUE_SEPARATOR .\n 'state=' . $element['state']\n . Import::DEFAULT_GLOBAL_MULTI_VALUE_SEPARATOR .\n 'value=' . $element['value'];\n if (isset($element['website_id'])) {\n $str .= Import::DEFAULT_GLOBAL_MULTI_VALUE_SEPARATOR .\n 'website_id=' . $element['website_id'];\n }\n $variations[] = $str;\n }\n }\n }\n }\n $result = '';\n if (!empty($variations)) {\n $result = [\n self::WEE_TAX_VARIATIONS_COLUMN => implode(\n ImportProduct::PSEUDO_MULTI_LINE_SEPARATOR,\n $variations\n )\n ];\n }\n $this->weeTaxData[$product->getId()] = $result;\n }\n }", "protected function _prepareCollection()\n {\t\t \n\t\t\n $collection = Mage::getModel('catalog/product')\n \t->getCollection()\n \t->addAttributeToSelect('name')\n \t->addAttributeToSelect('price')\n \t->addAttributeToSelect('special_price')\n \t->addAttributeToSelect('name')\n \t->addAttributeToSelect('manufacturer')\n \t->addFieldToFilter('type_id', array('in' => array(Mage_Catalog_Model_Product_Type::TYPE_SIMPLE, Mage_Catalog_Model_Product_Type::TYPE_VIRTUAL)))\n ->joinField('qty',\n 'cataloginventory/stock_item',\n 'qty',\n 'product_id=entity_id',\n '{{table}}.stock_id=1',\n 'left');\n \t;\n $this->setCollection($collection);\n return parent::_prepareCollection();\n }", "function builder_price() {\n\n $this->Item->recursive = 0;\n\n if( !isset($this->params['named']['limit']) ) {\n $this->paginate['limit'] = REPORT_LIMIT;\n $this->paginate['maxLimit'] = REPORT_LIMIT;\n }\n elseif( isset($this->params['named']['limit']) && $this->params['named']['limit'] != 'All' ) {\n $this->paginate['limit'] = isset($this->params['named']['limit']) ? $this->params['named']['limit'] : REPORT_LIMIT;\n $this->paginate['maxLimit'] = isset($this->params['named']['limit']) ? $this->params['named']['limit'] : REPORT_LIMIT;\n }\n else {\n $this->paginate['limit'] = 0;\n $this->paginate['maxLimit'] = 0;\n }\n $this->Prg->commonProcess();\n $this->paginate['conditions'] = $this->Item->parseCriteria($this->passedArgs);\n $this->paginate['conditions']['Item.base_item']['base_item'] = 0;\n\n $items = $this->paginate();\n $paginate = true;\n $legend = \"Items\";\n\n $this->set(compact('items', 'paginate', 'legend'));\n }", "public function convert(\\Magento\\Catalog\\Model\\Product $product);", "private function setup_products() {\n\t\tglobal $wpdb;\n\n\t\t$ids = [];\n\t\t$d = $wpdb->get_results( \"SELECT distinct `products` FROM `{$wpdb->prefix}thespa_data`\", ARRAY_A );\n\t\tforeach ( $d as $datum ) {\n\t\t\t$prs = explode( \",\", $datum['products'] );\n\t\t\tforeach ( $prs as $pr ) {\n\t\t\t\tif ( !isset( $ids[$pr] ) ) {\n\t\t\t\t\tarray_push($ids, $pr );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t$i = 0;\n\t\tforeach ( $ids as $id ) {\n\t\t\t$product = wc_get_product( $id );\n\t\t\tif ( is_object( $product ) ) {\n\t\t\t\t$this->products[$i] = [\n\t\t\t\t\t'id' => $id,\n\t\t\t\t\t'name' => $product->get_title(),\n\t\t\t\t\t'url' => $product->get_permalink(),\n\t\t\t\t\t'img' => wp_get_attachment_image_src( get_post_thumbnail_id( $id ), 'medium', true )[0],\n\t\t\t\t\t'cost' => $product->get_price_html(),\n\t\t\t\t];\n\t\t\t\t$i++;\n\t\t\t}\n\t\t}\n\t}", "public function testConvertProductPrice()\n {\n $priceEur = 1000;\n $product = new Product();\n $product->setName('Product test');\n $product->setPrice(1000);\n $product->setCurrency('EUR');\n\n //test exchange method\n $conversorManager = new ConversorManager($this->entityManager);\n $response = $conversorManager->convertProductPrice($product, 'USD');\n\n //asserst\n $this->assertGreaterThan($priceEur ,$response);\n }", "public function updateProductStyleOptionPricingAll(){\n\t\t$all_products = $this->getAll();\n\t\t$this->load->model('catalog/product');\n\t\t$this->load->model('tshirtgang/pricing');\n\t\t$this->load->model('catalog/option');\n\t\t$tshirt_option_names = array('Tshirt Color', 'Tshirt Style', 'Tshirt Size');\n\t\t$tshirt_colored = array(\n\t\t\t\"Black\",\n\t\t\t\"Charcoal Grey\",\n\t\t\t\"Daisy\",\n\t\t\t\"Dark Chocolate\",\n\t\t\t\"Forest Green\",\n\t\t\t\"Gold\",\n\t\t\t\"Irish Green\",\n\t\t\t\"Light Blue\",\n\t\t\t\"Light Pink\",\n\t\t\t\"Military Green\",\n\t\t\t\"Navy\",\n\t\t\t\"Orange\",\n\t\t\t\"Purple\",\n\t\t\t\"Red\",\n\t\t\t\"Royal Blue\",\n\t\t\t\"Sport Grey\",\n\t\t\t\"Tan\",\n\t\t\t\"Burgundy\"\n\t\t);\n\t\t$tshirt_ringer = array(\n\t\t\t\"Navy Ringer\",\n\t\t\t\"Black Ringer\",\n\t\t\t\"Red Ringer\"\n\t\t);\n\t\t$tshirt_options = array();\n\t\t$tshirt_options_price = array();\n\t\t$options = $this->model_catalog_option->getOptions();\n\t\t$temp_price = 0.0;\n\t\tforeach($options as $option){\n\t\t\t//if($option['name'] == 'Tshirt Color'){\n\t\t\t//\t$tshirtcolor_option_id = $option['option_id'];\n\t\t\t//}\n\t\t\t//if($option['name'] == 'Tshirt Style'){\n\t\t\t//\t$tshirtstyle_option_id = $option['option_id'];\n\t\t\t//}\n\t\t\t//if($option['name'] == 'Tshirt Size'){\n\t\t\t//\t$tshirtsize_option_id = $option['option_id'];\n\t\t\t//}\n\t\t\tif(in_array($option['name'], $tshirt_option_names)){\n\t\t\t\t$tshirt_options[$option['name']] = array();\n\t\t\t\t$tshirt_options[$option['name']]['option_id'] = $option['option_id'];\n\t\t\t\t$tshirt_options[$option['name']]['prices'] = array();\n\t\t\t}\n\t\t}\n\t\tforeach($tshirt_option_names as $tshirt_option_name){\n\t\t\t$option_value_descriptions = $this->model_catalog_option->getOptionValueDescriptions($tshirt_options[$tshirt_option_name]['option_id']);\n\t\t\tforeach($option_value_descriptions as $opv){\n\t\t\t\t$temp_price = 0.0;\n\t\t\t\tif($tshirt_option_name=='Tshirt Color'){\n\t\t\t\t\tif( in_array($opv['option_value_description'][1]['name'], $tshirt_colored )){\n\t\t\t\t\t\t$temp_price = $this->model_tshirtgang_pricing->get(array( 'code' => 'ColorShirt' ));\n\t\t\t\t\t} elseif( in_array($opv['option_value_description'][1]['name'], $tshirt_ringer )){\n\t\t\t\t\t\t$temp_price = $this->model_tshirtgang_pricing->get(array( 'code' => 'RingerShirt' ));\n\t\t\t\t\t} else { // white\n\t\t\t\t\t\t$temp_price = $this->model_tshirtgang_pricing->get(array( 'code' => 'WhiteShirt' ));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif($tshirt_option_name=='Tshirt Style'){\n\t\t\t\t\tif($opv['option_value_description'][1]['name'] == \"Mens Fitted\" ) $temp_price = $this->model_tshirtgang_pricing->get(array( 'code' => 'MensFittedIncremental' ));\n\t\t\t\t\tif($opv['option_value_description'][1]['name'] == \"Ladies\" ) $temp_price = $this->model_tshirtgang_pricing->get(array( 'code' => 'LadiesIncremental' ));\n\t\t\t\t\tif($opv['option_value_description'][1]['name'] == \"Hooded Pullover\" ) $temp_price = $this->model_tshirtgang_pricing->get(array( 'code' => 'HoodieIncremental' ));\n\t\t\t\t\tif($opv['option_value_description'][1]['name'] == \"Apron\" ) $temp_price = $this->model_tshirtgang_pricing->get(array( 'code' => 'ApronIncremental' ));\n\t\t\t\t\tif($opv['option_value_description'][1]['name'] == \"Vneck\" ) $temp_price = $this->model_tshirtgang_pricing->get(array( 'code' => 'VneckIncremental' ));\n\t\t\t\t\tif($opv['option_value_description'][1]['name'] == \"Tanktop\" ) $temp_price = $this->model_tshirtgang_pricing->get(array( 'code' => 'TanktopIncremental' ));\n\t\t\t\t\tif($opv['option_value_description'][1]['name'] == \"Baby One Piece\" ) $temp_price = $this->model_tshirtgang_pricing->get(array( 'code' => 'BabyOnePieceIncremental' ));\n\t\t\t\t}\n\t\t\t\tif($tshirt_option_name=='Tshirt Size'){\n\t\t\t\t\tif($opv['option_value_description'][1]['name'] == \"2 X-Large\" ) $temp_price = $this->model_tshirtgang_pricing->get(array( 'code' => 'Shirt_2XL_Incremental' ));\n\t\t\t\t\tif($opv['option_value_description'][1]['name'] == \"3 X-Large\" ) $temp_price = $this->model_tshirtgang_pricing->get(array( 'code' => 'Shirt_3XL6XL_Incremental' ));\n\t\t\t\t\tif($opv['option_value_description'][1]['name'] == \"4 X-Large\" ) $temp_price = $this->model_tshirtgang_pricing->get(array( 'code' => 'Shirt_3XL6XL_Incremental' ));\n\t\t\t\t\tif($opv['option_value_description'][1]['name'] == \"5 X-Large\" ) $temp_price = $this->model_tshirtgang_pricing->get(array( 'code' => 'Shirt_3XL6XL_Incremental' ));\n\t\t\t\t\tif($opv['option_value_description'][1]['name'] == \"6 X-Large\" ) $temp_price = $this->model_tshirtgang_pricing->get(array( 'code' => 'Shirt_3XL6XL_Incremental' ));\n\t\t\t\t}\n\t\t\t\tif($temp_price != 0.0){\n\t\t\t\t\t$tshirt_options_price = array(\n\t\t\t\t\t\t'option_value_id' => $opv['option_value_id'],\n\t\t\t\t\t\t'name' => $opv['option_value_description'][1]['name'],\n\t\t\t\t\t\t'price' => $temp_price\n\t\t\t\t\t);\n\t\t\t\t\t$tshirt_options[$tshirt_option_name]['prices'][] = $tshirt_options_price;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tforeach($tshirt_options as $tso1){\n\t\t\tforeach($tso1['prices'] as $tso2){\n\t\t\t\t$sql = \"UPDATE \" . DB_PREFIX . \"product_option_value ocpov \";\n\t\t\t\t$sql .= \"LEFT JOIN \" . DB_PREFIX . \"product ocp \";\n\t\t\t\t$sql .= \" ON ocp.product_id = ocpov.product_id \";\n\t\t\t\t$sql .= \"LEFT JOIN \" . DB_PREFIX . \"tshirtgang_products tsgp \";\n\t\t\t\t$sql .= \" ON tsgp.product_id = ocp.product_id \";\n\t\t\t\t$sql .= \"SET ocpov.price=\". (float)$tso2['price'] . \" \";\n\t\t\t\t$sql .= \"WHERE \";\n\t\t\t\t$sql .= \" ocpov.option_value_id = \" . (int)$tso2['option_value_id'] . \" \";\n\t\t\t\t//$sql .= \" AND \";\n\t\t\t\t//$sql .= \" tsgp.id IS NOT NULL \";\n\t\t\t\t$this->db->query($sql);\n\t\t\t}\n\t\t}\n\t}", "function prepareTemplateVars() {\n\t\t$calcModel = KenedoModel::getModel('ConfigboxModelAdmincalculations');\n\t\t$this->calculations = $calcModel->getRecords(array('admincalculations.product_id'=>$this->productId));\n\n\t\t$this->addViewCssClasses();\n\n\t}", "public function updateProduct()\n {\n \t$quote=$this->getQuote();\n \tif($quote)\n \t{\n \t\t$detailproduct=$this->getProduct();\n \t\t$quoteproduct=$quote->getProduct();\n \t\tif(\n\t\t\t\t$quote->getPrice()!=$this->getPrice() or\n\t\t\t\t$quote->getDiscrate()!=$this->getDiscrate() or\n\t\t\t\t$quote->getDiscamt()!=$this->getDiscamt() or\n\t\t\t\t$quote->getProductId()!=$this->getProductId()\n\t\t\t)\n\t\t\t{\n\t\t\t\t$quote->setPrice($this->getPrice());\n\t\t\t\t$quote->setDiscrate($this->getDiscrate());\n\t\t\t\t$quote->setDiscamt($this->getDiscamt());\n\t\t\t\t$quote->setProductId($this->getProductId());\n\t\t\t\t$quote->calc(); //auto save\n\t\t\t\t$detailproduct->calcSalePrices();\n\t\t\t\t\n\t\t\t\t//if product changed, calc old product\n\t\t\t\tif($quoteproduct->getId()!=$detailproduct->getId())\n\t\t\t\t\t$quoteproduct->calcSalePrices();\n\t\t\t}\n \t}\n \telse\n \t{\n\t\t\t//if none, see if product quote by vendor with similar pricing exists. \n\t\t\t$quote=Fetcher::fetchOne(\"Quote\",array('total'=>$this->getUnittotal(),'vendor_id'=>SettingsTable::fetch(\"me_vendor_id\"),'product_id'=>$this->getProductId()));\n\n\t\t\t//if it doesn't exist, create it, and product->calc()\n\t\t\tif(!$quote)\n\t\t\t{\n\t\t\t\tQuoteTable::createOne(array(\n\t\t\t\t\t'date'=>$this->getInvoice()->getDate(),\n\t\t\t\t\t'price'=>$this->getPrice(),\n\t\t\t\t\t'discrate'=>$this->getDiscrate(),\n\t\t\t\t\t'discamt'=>$this->getDiscamt(),\n\t\t\t\t\t'vendor_id'=>SettingsTable::fetch(\"me_vendor_id\"),\n\t\t\t\t\t'product_id'=>$this->getProductId(),\n\t\t\t\t\t'ref_class'=>\"Invoicedetail\",\n\t\t\t\t\t'ref_id'=>$this->getId(),\n\t\t\t\t\t'mine'=>1,\n\t\t\t\t\t));\n\t\t\t\t$this->getProduct()->calcSalePrices();\n\t\t\t}\n \t}\n }", "protected function findPrice()\n\t{\n\t\trequire_once(TL_ROOT . '/system/modules/isotope/providers/ProductPriceFinder.php');\n\n\t\t$arrPrice = ProductPriceFinder::findPrice($this);\n\n\t\t$this->arrData['price'] = $arrPrice['price'];\n\t\t$this->arrData['tax_class'] = $arrPrice['tax_class'];\n\t\t$this->arrCache['from_price'] = $arrPrice['from_price'];\n\t\t$this->arrCache['minimum_quantity'] = $arrPrice['min'];\n\n\t\t// Add \"price_tiers\" to attributes, so the field is available in the template\n\t\tif ($this->hasAdvancedPrices())\n\t\t{\n\t\t\t$this->arrAttributes[] = 'price_tiers';\n\n\t\t\t// Add \"price_tiers\" to variant attributes, so the field is updated through ajax\n\t\t\tif ($this->hasVariantPrices())\n\t\t\t{\n\t\t\t\t$this->arrVariantAttributes[] = 'price_tiers';\n\t\t\t}\n\n\t\t\t$this->arrCache['price_tiers'] = $arrPrice['price_tiers'];\n\t\t}\n\t}", "public function testProductGetPrices()\n {\n $product = $this->find('product', 1);\n $prices = $product->getPrices();\n $price = $prices[0];\n \n $currencies = $this->findAll('currency');\n $dollarCurrency = $currencies[0];\n \n $money = Money::create(10, $dollarCurrency); \n \n $this->assertEquals(\n $money,\n $price\n );\n }", "public function setBestPrice($product_id) {\n $query = \"SELECT * FROM wp_pwgb_postmeta WHERE post_id=:product_id;\";\n $stm = $this->db->prepare($query);\n $stm->bindValue(\":product_id\", $product_id, PDO::PARAM_INT);\n $stm->execute();\n\n $response = $stm->fetchAll(PDO::FETCH_ASSOC);\n $tag_prices = $this->productPrice();\n $theBest = ['price' => 0];\n $otherPrices = [];\n $hasChanged = false;\n\n // Obtiene el mejor precio anterior\n foreach ($response as $metadata) {\n // Mejor precio\n if (isset($metadata['meta_key']) && $metadata['meta_key'] == 'price_best') {\n $theBest['price'] = $metadata['meta_value'];\n }\n\n // Mejor tienda\n if (isset($metadata['meta_key']) && $metadata['meta_key'] == 'best_shop') {\n $theBest['shop'] = $metadata['meta_value'];\n }\n\n // Obtiene el precio de otras tiendas\n foreach ($tag_prices as $price) {\n if (isset($metadata['meta_key']) && $metadata['meta_key'] == $price) {\n $otherPrices[$price] = (int) $metadata['meta_value'];\n }\n }\n }\n\n $oldPrice = $theBest['price'];\n // Obtiene el nuevo mejor precio\n foreach ($otherPrices as $store => $price) {\n if (($price > 0) && ($price < $theBest['price'])) {\n $theBest['price'] = $price;\n $theBest['shop'] = $store;\n $hasChanged = true;\n }\n }\n\n // Si el mejor precio cambio, lo actualiza y lo guarda en el historial\n if ($hasChanged) {\n $query = \"INSERT INTO dw_historial (product_id, price_old, price_new, created_at) VALUES \n (:product_id, :price_old, :price_new, NOW());\";\n $stm2 = $this->db->prepare($query);\n $stm2->bindValue(\":product_id\", $product_id, PDO::PARAM_INT);\n $stm2->bindValue(\":price_old\", $oldPrice, PDO::PARAM_INT);\n $stm2->bindValue(\":price_new\", $theBest['price'], PDO::PARAM_INT);\n $stm2->execute();\n\n $query = \"UPDATE wp_pwgb_postmeta SET meta_value=:price_new WHERE post_id=:product_id AND meta_key='price_best';\";\n $stm3 = $this->db->prepare($query);\n $stm3->bindValue(\":product_id\", $product_id, PDO::PARAM_INT);\n $stm3->bindValue(\":price_new\", $theBest['price'], PDO::PARAM_INT);\n $stm3->execute();\n\n $query = \"UPDATE wp_pwgb_postmeta SET meta_value=:best_shop WHERE post_id=:product_id AND meta_key='best_shop';\";\n $stm4 = $this->db->prepare($query);\n $stm4->bindValue(\":product_id\", $product_id, PDO::PARAM_INT);\n $stm4->bindValue(\":best_shop\", $theBest['shop'], PDO::PARAM_STR);\n $stm4->execute();\n }\n }", "function beforeSave(){\n\t\t\t// Get the rate\n\t\t\t$rate = 1 / $this->_getRate();\n\n\t\t\t// Convert it back to USD\n\t\t\tif(!empty($this->data['Product']['rrp'])){\n\t\t\t\t$this->data['Product']['rrp'] = $this->data['Product']['rrp'] * $rate;\n\t\t\t}\n\n\t\t\tif(!empty($this->data['Product']['start_price'])){\n\t\t\t\t$this->data['Product']['start_price'] \t= $this->data['Product']['start_price'] * $rate;\n\t\t\t}\n\n\t\t\tif(!empty($this->data['Product']['delivery_cost'])){\n\t\t\t\t$this->data['Product']['delivery_cost'] = $this->data['Product']['delivery_cost'] * $rate;\n\t\t\t}\n\n\t\t\tif(!empty($this->data['Product']['fixed_price'])){\n\t\t\t\t$this->data['Product']['fixed_price'] \t= $this->data['Product']['fixed_price'] * $rate;\n\t\t\t}\n\n\t\t\tif(!empty($this->data['Product']['minimum_price'])){\n\t\t\t\t$this->data['Product']['minimum_price'] = $this->data['Product']['minimum_price'] * $rate;\n\t\t\t}\n\n\t\t\treturn true;\n\t\t}", "public function prepareForValidation(): void\n {\n $products = [];\n foreach ($this->products as $key => $product) {\n $products['products'][$key] = [\n 'id' => $product['id'],\n 'qty' => $product['qty'],\n 'product' => Product::find($product['id']),\n ];\n }\n\n $this->merge($products);\n }", "protected function prepareData()\n {\n parent::prepareData();\n $this->prepareConfigurableProductOptions();\n $this->prepareAttributeSet();\n }", "public function prepare(Request $request, CurService $curService)\n {\n \t// Price modificators can be retrieved in request\n \t// Or can be calculated based on request parameters\n \t$priceMod = $this->modifyPrice(1.0, 0.0);\n\n \t$validator = Validator::make($request->all(), [\n \t\t'cart' => 'required|array',\n \t\t'cart.*' => [ \n 'numeric',\n 'min:1',\n function ($attribute, $value, $fail) {\n \t\t\t$id = explode('.', $attribute)[1];\n \t\t\tif (!Product::where('id', $id)->exists()) {\n \t\t\t\t$fail(\"Product id: {$id} not found\");\n \t\t\t}\n \t\t}, \n ],\n 'address' => 'sometimes|required|string',\n \t]);\n\n \tif ($validator->fails()) {\n \t\treturn response()->json($validator->errors(), 422);\n \t}\n\n \t$validated = $validator->valid();\n\n \t$products = Product::query()\n \t\t->whereIn('id', array_keys($validated['cart']))\n \t\t->get()\n \t\t->map(function ($product) use ($priceMod, $validated) {\n \t\t\t$product->price = $priceMod($product->price);\n \t\t\t$product->quantity = $validated['cart'][$product->id];\n \t\t\treturn $product;\n \t\t});\n\n if (isset($validated['address'])) {\n \t$services = Service::query()\n \t\t->where('id', 1)\n \t\t->get();\n } else {\n $services = collect([]);\n }\n\n \t$total_cost = $products->reduce(function ($sum, $prod) {\n \t\treturn $sum + $prod->quantity * $prod->price;\n \t}) + $services->reduce(function ($sum, $serv) {\n \t\treturn $sum + $serv->price;\n \t});\n\n \treturn response()->json([\n \t\t'products' => $products,\n \t\t'services' => $services,\n \t\t'total_cost' => [\n \t\t\t'EUR' => $total_cost,\n \t\t\t'USD' => $curService->convert('usd', $total_cost),\n \t\t],\n \t], 200);\n }", "function init() {\r\n\r\n\t\t\tadd_filter( 'woocommerce_get_settings_pages', array( &$this, 'settings_tfls' ) );\r\n\r\n\t\t\t// Add wholesale price field to product\r\n\t\t\tadd_action( 'woocommerce_product_options_general_product_data', array(\r\n\t\t\t\t&$this,\r\n\t\t\t\t'product_options_wholesale_price'\r\n\t\t\t));\r\n\r\n\t\t\t// Save wholesale prices\r\n\t\t\tadd_action( 'woocommerce_process_product_meta', array(\r\n\t\t\t\t&$this,\r\n\t\t\t\t'process_product_simple_wholesale_price'\r\n\t\t\t));\r\n\r\n\t\t\t// Add international and wholesale prices to products\r\n\t\t\tadd_action( 'woocommerce_product_options_general_product_data', array(\r\n\t\t\t\t&$this,\r\n\t\t\t\t'product_options_countries_prices'\r\n\t\t\t) );\r\n\r\n\t\t\tadd_action( 'woocommerce_process_product_meta_simple', array(\r\n\t\t\t\t&$this,\r\n\t\t\t\t'process_product_simple_countries_prices'\r\n\t\t\t) );\r\n\r\n\t\t\tif ( WC()->version < '2.3' ) {\r\n\t\t\t\t//Deprecated\r\n\t\t\t\tadd_action( 'woocommerce_product_after_variable_attributes', array(\r\n\t\t\t\t\t&$this,\r\n\t\t\t\t\t'product_variable_attributes_countries_prices_wc2_2'\r\n\t\t\t\t), 10, 3 );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tadd_action( 'woocommerce_product_after_variable_attributes', array(\r\n\t\t\t\t\t&$this,\r\n\t\t\t\t\t'product_variable_attributes_countries_prices'\r\n\t\t\t\t), 10, 3 );\r\n\t\t\t}\r\n\r\n\r\n\t\t\tadd_action( 'woocommerce_process_product_meta_variable', array(\r\n\t\t\t\t&$this,\r\n\t\t\t\t'process_product_variable_countries_prices'\r\n\t\t\t) );\r\n\r\n\t\t\tadd_action( 'woocommerce_save_product_variation', array(\r\n\t\t\t\t&$this,\r\n\t\t\t\t'save_product_variation_countries_prices'\r\n\t\t\t), 10, 2 );\r\n\r\n\t\t\tadd_filter( 'woocommerce_currency', array( &$this, 'order_currency' ) );\r\n\r\n\t\t\tadd_action( 'admin_notices', array( &$this, 'check_database_file' ) );\r\n\r\n\t\t}", "public function item_setprice($item)\n {\n if ($item['product_type'] != 2 || $item['product_payment'] != 'prepay') return;\n\n $db = db(config('db'));\n\n if ($_POST)\n {\n $db -> beginTrans();\n\n switch ($item['objtype'])\n {\n case 'room':\n $data = $this -> _format_room_price($item);\n\n // close old price\n $where = \"`supply`='EBK' AND `supplyid`=:sup AND `payment`=3 AND `hotel`=:hotel AND `room`=:room AND `date`>=:start AND `date`<=:end\";\n $condition = array(':sup'=>$item['pid'], ':hotel'=>$item['objpid'], ':room'=>$item['id'], ':start'=>$_POST['start'], ':end'=>$_POST['end']);\n $rs = $db -> prepare(\"UPDATE `ptc_hotel_price_date` SET `close`=1, `price`=0 WHERE {$where}\") -> execute($condition);\n if ($rs === false)\n json_return(null, 6, '保存失败,请重试');\n\n if ($data)\n {\n $data = array_values($data);\n list($column, $sql, $value) = array_values(insert_array($data));\n\n $_columns = update_column(array_keys($data[0]));\n $rs = $db -> prepare(\"INSERT INTO `ptc_hotel_price_date` {$column} VALUES {$sql} ON DUPLICATE KEY UPDATE {$_columns};\") -> execute($value); //var_dump($rs); exit;\n if (false == $rs)\n {\n $db -> rollback();\n json_return(null, 7, '数据保存失败,请重试~');\n }\n }\n break;\n\n case 'auto':\n $data = $this -> _format_auto_price($item);\n\n // close old price\n $where = \"`auto`=:auto AND `date`>=:start AND `date`<=:end\";\n $condition = array(':auto'=>$item['objpid'], ':start'=>$_POST['start'], ':end'=>$_POST['end']);\n $rs = $db -> prepare(\"UPDATE `ptc_auto_price_date` SET `close`=1, `price`=0 WHERE {$where}\") -> execute($condition);\n if ($rs === false)\n json_return(null, 6, '保存失败,请重试');\n\n if ($data)\n {\n $data = array_values($data);\n list($column, $sql, $value) = array_values(insert_array($data));\n\n $_columns = update_column(array_keys($data[0]));\n $rs = $db -> prepare(\"INSERT INTO `ptc_auto_price_date` {$column} VALUES {$sql} ON DUPLICATE KEY UPDATE {$_columns};\") -> execute($value); //var_dump($rs); exit;\n if (false == $rs)\n {\n $db -> rollback();\n json_return(null, 7, '数据保存失败,请重试~');\n }\n }\n break;\n }\n\n if (false === $db -> commit())\n json_return(null, 9, '数据保存失败,请重试~');\n else\n json_return($rs);\n }\n\n $month = !empty($_GET['month']) ? $_GET['month'] : date('Y-m');\n\n $first = strtotime($month.'-1');\n $first_day = date('N', $first);\n\n $start = $first_day == 7 ? $first : $first - $first_day * 86400;\n $end = $start + 41 * 86400;\n\n switch ($item['objtype'])\n {\n case 'room':\n $_date = $db -> prepare(\"SELECT `key`,`date`,`price`,`breakfast`,`allot`,`sold`,`filled`,`standby`,`close` FROM `ptc_hotel_price_date` WHERE `supply`='EBK' AND `supplyid`=:sup AND `hotel`=:hotel AND `room`=:room AND `date`>=:start AND `date`<=:end AND `close`=0\")\n -> execute(array(':sup'=>$item['pid'], ':hotel'=>$item['objpid'], ':room'=>$item['id'], ':start'=>$start, ':end'=>$end));\n break;\n\n case 'auto':\n $_date = $db -> prepare(\"SELECT `key`,`date`,`price`,`child`,`baby`,`allot`,`sold`,`filled`,`close` FROM `ptc_auto_price_date` WHERE `auto`=:auto AND `date`>=:start AND `date`<=:end AND `close`=0\")\n -> execute(array(':auto'=>$item['objpid'], ':start'=>$start, ':end'=>$end));\n break;\n }\n\n $date = array();\n foreach ($_date as $v)\n {\n $date[$v['date']] = $v;\n }\n unset($_date);\n\n include dirname(__FILE__).'/product/price_'.$item['objtype'].'.tpl.php';\n }", "protected function convertPriceList() {\n\t\t$retArray =array();\n\t\t\n\t\tforeach ($this->DetailPriceList as $name => $nameValue) {\n\t\t\t$description = '';\n\t\t\t$unit = '';\n\t\t\t$price = 0;\n\t\t\t$avgPrice = 0;\n\t\t\tif (is_array($nameValue)) {\n\t\t\t\tforeach ($nameValue as $desc => $prices) {\n\t\t\t\t\tif (is_array($prices)) {\n\t\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t$price = $nameValue;\n\t\t\t\t$avgPrice = $price;\n\t\t\t}\n\t\t\t$retArray[] = array($name,$description, $unit,$price, $avgPrice );\n\t\t}\n\t}", "public function test_comicEntityIsCreated_prices_setPrices()\n {\n $sut = $this->getSUT();\n $prices = $sut->getPrices();\n $expected = [\n Price::create(\n 'printPrice',\n 19.99\n ),\n ];\n\n $this->assertEquals($expected, $prices);\n }", "abstract protected function prepareVendorProductData(int $vendorProductId);", "abstract protected function prepareVendorProductData(int $vendorProductId);", "public function LoadProductsForPrice()\n\t\t{\n\t\t\t$query = \"\n\t\t\t\tSELECT\n\t\t\t\t\tp.*,\n\t\t\t\t\tFLOOR(prodratingtotal / prodnumratings) AS prodavgrating,\n\t\t\t\t\timageisthumb,\n\t\t\t\t\timagefile,\n\t\t\t\t\t\" . GetProdCustomerGroupPriceSQL() . \"\n\t\t\t\tFROM\n\t\t\t\t\t(\n\t\t\t\t\t\tSELECT\n\t\t\t\t\t\t\tDISTINCT ca.productid,\n\t\t\t\t\t\t\tFLOOR(prodratingtotal / prodnumratings) AS prodavgrating\n\t\t\t\t\t\tFROM\n\t\t\t\t\t\t\t[|PREFIX|]categoryassociations ca\n\t\t\t\t\t\t\tINNER JOIN [|PREFIX|]products p ON p.productid = ca.productid\n\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\tp.prodvisible = 1 AND\n\t\t\t\t\t\t\tca.categoryid IN (\" . $this->GetProductCategoryIds() . \") AND\n\t\t\t\t\t\t\tp.prodcalculatedprice >= '\".(int)$this->GetMinPrice().\"' AND\n\t\t\t\t\t\t\tp.prodcalculatedprice <= '\".(int)$this->GetMaxPrice().\"'\n\t\t\t\t\t\tORDER BY\n\t\t\t\t\t\t\t\" . $this->GetSortField() . \", p.prodname ASC\n\t\t\t\t\t\t\" . $GLOBALS['ISC_CLASS_DB']->AddLimit($this->GetStart(), GetConfig('CategoryProductsPerPage')) . \"\n\t\t\t\t\t) AS ca\n\t\t\t\t\tINNER JOIN [|PREFIX|]products p ON p.productid = ca.productid\n\t\t\t\t\tLEFT JOIN [|PREFIX|]product_images pi ON (pi.imageisthumb = 1 AND p.productid = pi.imageprodid)\n\t\t\t\";\n\n\t\t\t//$query .= $GLOBALS['ISC_CLASS_DB']->AddLimit($this->GetStart(), GetConfig('CategoryProductsPerPage'));\n\t\t\t$result = $GLOBALS['ISC_CLASS_DB']->Query($query);\n\t\t\twhile ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {\n\t\t\t\t$row['prodavgrating'] = (int)$row['prodavgrating'];\n\t\t\t\t$this->_priceproducts[] = $row;\n\t\t\t}\n\t\t}", "function get_price_object() {\r\n\t\t$price_obj = array (\r\n\t\t\t\t\"Currency\" => false,\r\n\t\t\t\t\"TotalDisplayFare\" => 0,\r\n\t\t\t\t\"PriceBreakup\" => array (\r\n\t\t\t\t\t\t'BasicFare' => 0,\r\n\t\t\t\t\t\t'Tax' => 0,\r\n\t\t\t\t\t\t'AgentCommission' => 0,\r\n\t\t\t\t\t\t'AgentTdsOnCommision' => 0\r\n\t\t\t\t) \r\n\t\t);\r\n\t\treturn $price_obj;\r\n\t}", "public function getProductPrice()\n {\n }", "function tep_get_productPrice($product_id){\n\tif ($product_id){\n\t\tglobal $languages_id,$pf;\n\t\t$product_query = tep_db_query(\"select p.products_id,p.products_price,products_discount from \" . TABLE_PRODUCTS . \" p where p.products_id=\".(int)$product_id );\n\t\tif (tep_db_num_rows($product_query)) {\n\t\t\t$product = tep_db_fetch_array($product_query);\n\t\t\t$product_price = $product['products_price'];\n\t\t\t$rata = $product['products_discount'] > 0 ? number_format((1/(1-$product['products_discount']/100)),2,'.','') : PRODUCTS_RATE;//( $product['products_discount'] > 0 )? number_format( (1 - ($product['products_discount'] / 100)) , 2) : PRODUCTS_RATE;\n\t\t\t//$retail_price = $product['products_price'] * PRODUCTS_RATE;// * $rata;//\n\t\t\t//echo $rata;\n\t\t\t$pf -> loadProduct($product['products_id'],$languages_id);\n\t\t\t$result = array();\n\t\t\t$result['rsPrice'] = $pf -> getRetailSinglePrice($rata);\n\t\t\t$result['sPrice'] = $pf -> getSinglePrice();\n\t\t\treturn $result;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}else{\n\t\treturn false;\n\t}\n}", "public function setPrice()\n {\n $price = $this->price;\n $outFix = $this->outFix;\n $outPer = $this->outPer;\n $inPer = $this->inPer;\n $inFix = $this->inFix;\n $flag = $this->flagInOut;\n if ($price < 1) {\n $sumIn = $outFix > 0 ? 1 + $outFix : 1; //outFix\n $sumIn = $outPer > 0 ? $sumIn + ($sumIn * $outPer / 100) : $sumIn; //outPer\n $sumIn = $sumIn / $price; // price\n $sumIn = $inFix > 0 ? $sumIn + $inFix : $sumIn;// inFix\n $ss = $sumIn * $inPer / 100;\n $sumIn = $inPer > 0 ? $sumIn + $ss : $sumIn;\n $this->in = $this->format_amount($sumIn);\n $this->out = $flag ? 1 : 0;\n } else {\n $val = $inFix > 0 ? 1 - $inFix : 1;\n $val = $inPer > 0 ? $val - $val * ($inPer / 100) : $val;\n $sumOut = $price * $val;\n $sumOut = $outFix > 0 ? $sumOut - $outFix : $sumOut;\n $sumOut = $outPer > 0 ? $sumOut - $outPer / 100 * $sumOut : $sumOut;\n $this->out = $this->format_amount($sumOut);\n $this->in = $flag ? 1 : 0;\n }\n $this->price = (float)$price;\n }", "private function formatProductArray(array $product) : array\n {\n /** @var array $parameters */\n $parameters = $this->jobParameters->all();\n $parameters['locale'] = $parameters['filters']['structure']['locales'][0];\n unset($parameters['with_media']);\n $newProduct = [];\n foreach ($product as $key => $value) {\n if (!in_array($key, $parameters)) {\n continue;\n }\n $value = $product[$key][0]['data'];\n $product[$key] = $value;\n $newKey = explode('-', $key);\n $newProduct[$newKey[0]] = $product[$key];\n $attribute = $this->attributeRepository->findOneByIdentifier($newKey[0]);\n if ($attribute !== null) {\n switch ($attribute->getAttributeType()) {\n case AttributeTypes::OPTION_MULTI_SELECT:\n case AttributeTypes::OPTION_SIMPLE_SELECT:\n foreach ($attribute->getOptions() as $option) {\n if ($option->getCode() == $value) {\n $newProduct[$newKey[0]] = $option->setLocale($parameters['locale'])->getOptionValue(\n )->getLabel();\n break;\n }\n }\n break;\n case AttributeTypes::TEXTAREA:\n case AttributeTypes::TEXT:\n $newProduct[$newKey[0]] = htmlentities(html_entity_decode($value));\n break;\n case AttributeTypes::PRICE_COLLECTION:\n foreach ($value as $index => $data) {\n if ($data['currency'] == $parameters['currency']) {\n $value = number_format($data['amount'], 2, $parameters['decimalSeparator'], '');\n $newProduct[$newKey[0]] = $value.' '.$parameters['currency'];\n }\n }\n break;\n case AttributeTypes::IMAGE:\n $newProduct[$newKey[0]] = rtrim(\n $parameters['pimMediaUrl'],\n '/'\n ).'/file_storage/catalog/'.$value;\n break;\n }\n }\n }\n $parameters = [\n $parameters['id'] => '',\n $parameters['name'] => '',\n $parameters['description'] => '',\n $parameters['productUrl'] => '',\n $parameters['smallImage'] => '',\n $parameters['bigImage'] => '',\n $parameters['price'] => '',\n $parameters['retailPrice'] => '',\n $parameters['recommendable'] => '',\n ];\n $missingValues = array_diff_key($parameters, $newProduct);\n $newProduct += $missingValues;\n $newProduct[''] = '';\n\n return $newProduct;\n }", "public function getPricing()\n {\n // get current quantity as its the basis for pricing\n $quantity = $this->quantity;\n\n // Get pricing but maintain original unitPrice (only if post-CASS certification quantity drop is less than 10%),\n $adjustments = $this->quantity_adjustment + $this->count_adjustment;\n if ($adjustments < 0) {\n $originalQuantity = 0;\n $originalQuantity = $this->itemAddressFiles()->sum('count');\n $originalQuantity += $this->mail_to_me;\n if ((($originalQuantity + $adjustments) / $originalQuantity) > 0.90) { // (less than 10%)\n $quantity = $originalQuantity;\n }\n }\n\n // Get pricing based on quantity.\n // If quantity is less than minimum quantity required (only if post-CASS certification),\n // then use the minimum quantity required to retrieve pricing\n if ((\n $this->quantity_adjustment != 0 || $this->count_adjustment != 0) &&\n $this->quantity < $this->getMinimumQuantity()\n ) {\n $quantity = $this->getMinimumQuantity();\n }\n\n // Pricing date is based on submission date or now.\n $pricingDate = (!is_null($this->date_submitted) ? $this->date_submitted : time());\n\n if (!is_null($this->product_id) && !is_null($this->product)) {\n $newPricing = $this->product->getPricing(\n $quantity, $pricingDate,\n $this->invoice->getBaseSiteId()\n );\n $oldPricing = $this->getProductPrice();\n // TODO: refactor this pricing history section, it really shouldn't belong in this method\n if (!is_null($newPricing)) {\n $insert = true;\n if (!is_null($oldPricing) && $newPricing->id == $oldPricing->product_price_id) {\n $insert = false;\n }\n if ($insert) {\n try {\n InvoiceItemProductPrice::firstOrCreate(\n [\n 'invoice_item_id' => $this->id,\n 'product_price_id' => $newPricing->id,\n 'date_created' => date('Y-m-d H:i:s', time()),\n 'is_active' => 1\n ]\n );\n } catch (QueryException $e) {\n // TODO: fix this hack (e.g. why do we need integrity constraint on this table )\n if (strpos($e->getMessage(), 'Duplicate entry') === false) {\n throw $e;\n } else {\n Logger::error($e->getMessage());\n }\n }\n\n if (!is_null($oldPricing)) {\n $oldPricing->is_active = 0;\n $oldPricing->save();\n }\n }\n }\n\n return $newPricing;\n }\n if (!is_null($this->data_product_id) && $this->data_product_id != 0) {\n return $this->dataProduct->getPricing($pricingDate, $this->invoice->site_id);\n }\n if (!is_null($this->line_item_id) && $this->line_item_id != 0) {\n return $this->line_item->getPricing($pricingDate, $this->invoice->getBaseSiteId());\n }\n if ($this->isAdHocLineItem() && $this->unit_price) {\n return (object)array('price' => $this->unit_price);\n }\n return null;\n }", "function tep_get_products_special_price($product_id) {\n\t$product_query = tep_db_query(\"select products_price, products_model from \" . TABLE_PRODUCTS . \" where products_id = '\" . (int)$product_id . \"'\");\n\tif (tep_db_num_rows($product_query)) {\n\t\t$product = tep_db_fetch_array($product_query);\n\t\t$product_price = $product['products_price'];\n\t} else {\n\t\treturn false;\n\t}\n\t// Eversun mod for sppc and qty price breaks\n\t// $specials_query = tep_db_query(\"select specials_new_products_price from \" . TABLE_SPECIALS . \" where products_id = '\" . $product_id . \"' and status\");\n\tglobal $sppc_customer_group_id;\n\tif(!tep_session_is_registered('sppc_customer_group_id')) {\n\t\t$customer_group_id = '0';\n\t} else {\n\t\t$customer_group_id = $sppc_customer_group_id;\n\t}\n\t$specials_query = tep_db_query(\"select specials_new_products_price from \" . TABLE_SPECIALS . \" where products_id = '\" . (int)$product_id . \"' and status and customers_group_id = '\" . (int)$customer_group_id . \"'\");\n\t// Eversun mod for sppc and qty price breaks\n\tif (tep_db_num_rows($specials_query)) {\n\t\t$special = tep_db_fetch_array($specials_query);\n\t\t$special_price = $special['specials_new_products_price'];\n\t} else {\n\t\t$special_price = false;\n\t}\n\tif(substr($product['products_model'], 0, 4) == 'GIFT') { //Never apply a salededuction to Ian Wilson's Giftvouchers\n\t\treturn $special_price;\n\t}\n\n\t$product_to_categories_query = tep_db_query(\"select categories_id from \" . TABLE_PRODUCTS_TO_CATEGORIES . \" where products_id = '\" . (int)$product_id . \"'\");\n\t$product_to_categories = tep_db_fetch_array($product_to_categories_query);\n\t$category = $product_to_categories['categories_id'];\n\t\n\t$sale_query = tep_db_query(\"select sale_specials_condition, sale_deduction_value, sale_deduction_type from \" . TABLE_SALEMAKER_SALES . \" where sale_categories_all like '%,\" . $category . \",%' and sale_status = '1' and (sale_date_start <= now() or sale_date_start = '0000-00-00') and (sale_date_end >= now() or sale_date_end = '0000-00-00') and (sale_pricerange_from <= '\" . $product_price . \"' or sale_pricerange_from = '0') and (sale_pricerange_to >= '\" . $product_price . \"' or sale_pricerange_to = '0')\");\n\tif (tep_db_num_rows($sale_query)) {\n\t\t$sale = tep_db_fetch_array($sale_query);\n\t} else {\n\t\treturn $special_price;\n\t}\n\n\t\tif (!$special_price) {\n\t\t\t$tmp_special_price = $product_price;\n\t\t} else {\n\t\t\t$tmp_special_price = $special_price;\n\t\t}\n\n\t\tswitch ($sale['sale_deduction_type']) {\n\t\t\tcase 0:\n\t\t\t\t$sale_product_price = $product_price - $sale['sale_deduction_value'];\n\t\t\t\t$sale_special_price = $tmp_special_price - $sale['sale_deduction_value'];\n\t\t\t\tbreak;\n\t\t\tcase 1:\n\t\t\t\t$sale_product_price = $product_price - (($product_price * $sale['sale_deduction_value']) / 100);\n\t\t\t\t$sale_special_price = $tmp_special_price - (($tmp_special_price * $sale['sale_deduction_value']) / 100);\n\t\t\t\tbreak;\n\t\t\tcase 2:\n\t\t\t\t$sale_product_price = $sale['sale_deduction_value'];\n\t\t\t\t$sale_special_price = $sale['sale_deduction_value'];\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\treturn $special_price;\n\t\t}\n\n\t\tif ($sale_product_price < 0) {\n\t\t\t$sale_product_price = 0;\n\t\t}\n\t\t\n\t\tif ($sale_special_price < 0) {\n\t\t\t$sale_special_price = 0;\n\t\t}\n\t\t\n\t\tif (!$special_price) {\n\t\t\treturn number_format($sale_product_price, 4, '.', '');\n\t\t} else {\n\t\t\tswitch($sale['sale_specials_condition']){\n\t\t\t\tcase 0:\n\t\t\t\t\treturn number_format($sale_product_price, 4, '.', '');\n\t\t\t\t\tbreak;\n\t\t\t\tcase 1:\n\t\t\t\t\treturn number_format($special_price, 4, '.', '');\n\t\t\t\t\tbreak;\n\t\t\t\tcase 2:\n\t\t\t\t\treturn number_format($sale_special_price, 4, '.', '');\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\treturn number_format($special_price, 4, '.', '');\n\t\t\t}\n\t\t}\n}", "public function create() {\n\t\tupdate_option( 'woocommerce_calc_taxes', 'yes' );\n\t\tupdate_option( 'woocommerce_prices_include_tax', 'yes' );\n\n\t\t// Create tax rates.\n\t\t$this->tax_rate_ids[] = $this->create_tax_rate( '25' );\n\t\t$this->tax_rate_ids[] = $this->create_tax_rate( '12' );\n\t\t$this->tax_rate_ids[] = $this->create_tax_rate( '6' );\n\t\t$this->product = ( new Krokedil_Simple_Product() )->create();\n\t}", "function es_save_custom_quickedit_product( $product ) {\n\tif ( isset( $_REQUEST['member_price'] ) AND ! empty( $_REQUEST['member_price'] ) ) {\n\t\tupdate_post_meta( $product->id, 'member_price', wc_clean( $_REQUEST['member_price'] ) );\n\t}\n\telse \n\t\tdelete_post_meta( $product->id, 'member_price' );\n}", "public function create()\n {\n\n /*\n $productPresentationProducts = ProductPresentationProduct::all();\n $final = [];\n $selectProducPresentationProducts = [];\n $hiddenProducPresentationProductPrices = [];\n foreach ($productPresentationProducts as $key => $productPresentationProduct) {\n $final[$key] = (object)[];\n $final[$key]->product_id = $productPresentationProduct->product_id;\n $final[$key]->product_name = $productPresentationProduct->product->itemByLanguage(\\App::getLocale())->name;\n $final[$key]->presentation_name = $productPresentationProduct->productPresentation->itemByLanguage(\\App::getLocale())->name;\n $final[$key]->presentation_id = $productPresentationProduct->id;\n $final[$key]->price = $productPresentationProduct->price;\n $final[$key]->tax = $productPresentationProduct->tax;\n $final[$key]->for_delivery = $productPresentationProduct->for_delivery;\n\n $selectProducPresentationProducts[$final[$key]->presentation_id] = $final[$key]->product_name . ' - ' . $final[$key]->presentation_name . ' (€' . number_format($final[$key]->price, 2) . ')';\n $hiddenProducPresentationProductPrices[$final[$key]->presentation_id] = $final[$key]->price;\n }\n */\n\n $products = Product::all();\n\n $final = [];\n $selectProducts = [];\n $hiddenProductsPrices = [];\n $hiddenProductsIvas = [];\n foreach ($products as $key => $product) {\n $final[$key] = (object)[];\n $final[$key]->product_id = $product->id;\n $final[$key]->product_name = $product->itemByLanguage(\\App::getLocale())->name;\n $final[$key]->presentation_name = ($product->for_delivery==1)?'Delivery':'Store';\n $final[$key]->presentation_id = $product->for_delivery;\n $final[$key]->price = $product->price;\n $final[$key]->tax = $product->tax;\n $final[$key]->for_delivery = $product->for_delivery;\n\n $selectProducts[$final[$key]->product_id] = $final[$key]->product_name . ' - ' . $final[$key]->presentation_name . ' (€' . number_format($final[$key]->price, 2) . ')';\n $hiddenProductsPrices[$final[$key]->product_id] = $final[$key]->price;\n $hiddenProductsIvas[$final[$key]->product_id] = $final[$key]->tax;\n }\n\n // dd($hiddenProductsIvas);\n\n $users = User::pluck('email', 'id');\n\n // dd($final);\n\n return view('admin.products.orders.create', compact('selectProducts', 'hiddenProductsPrices', 'hiddenProductsIvas', 'users'));\n }", "function column_price($item){\n if ( $item['post_id'] && WPLA_ProductWrapper::hasVariations( $item['post_id'] ) ) {\n\n $variations = $this->getProductVariations( $item['post_id'] );\n if ( ! is_array($variations) || ! sizeof($variations) ) return '';\n\n $price_min = PHP_INT_MAX;\n $price_max = 0;\n foreach ($variations as $var) {\n $price = $var['price'];\n if ( $price > $price_max ) $price_max = $price;\n if ( $price < $price_min ) $price_min = $price;\n }\n\n if ( $price_min == $price_max ) {\n return $this->number_format( $price_min, 2 );\n } else {\n return $this->number_format( $price_min, 2 ) . ' - ' . $this->number_format( $price_max, 2 );\n }\n } // parent variation\n\n\n // get prices\n $regular_price = $this->getPriceForItem( $item );\n $sale_price = $this->getSalePriceForItem( $item );\n\n $profile = $this->getProfile( $item['profile_id'] );\n\n // check for profile prices (standard_price or price) and run the prices through WPLA_FeedDataBuilder::parseProfileShortcode()\n // to substitute shortcodes with actual values #20263\n if ( !empty( $profile->fields['standard_price'] ) ) {\n $price = WPLA_FeedDataBuilder::parseProfileShortcode( $profile->fields['standard_price'], $profile->fields['standard_price'], $item, wc_get_product( $item['post_id'] ), $item['post_id'], $profile );\n return $this->number_format( $price, 2 );\n } elseif ( !empty( $profile->fields['price'] ) ) {\n $price = WPLA_FeedDataBuilder::parseProfileShortcode( $profile->fields['price'], $profile->fields['price'], $item, wc_get_product( $item['post_id'] ), $item['post_id'], $profile );\n return $this->number_format( $price, 2 );\n }\n\n // no sale price\n if ( ! $sale_price )\n return $this->number_format( $regular_price, 2 );\n\n // show sale price\n return sprintf('<span style=\"%1$s\">%2$s</span> <br><span style=\"\">%3$s</span>',\n /*$1%s*/ 'text-decoration: line-through;color:silver',\n /*$2%s*/ $this->number_format( $regular_price, 2 ),\n /*$3%s*/ $this->number_format( $sale_price, 2 )\n ); \n\n }", "private function _fillTmpTable()\n {\n $sql = new SqlStatement();\n $sql->select()\n ->from(array('p' => 'product'), array('p.*'));\n \n if ($this->subCategory) \n {\n $sql->innerJoin(array('p2c' => 'product_to_category'), 'p.product_id = p2c.product_id')\n ->innerJoin(array('cp' => 'category_path'), 'cp.category_id = p2c.category_id')\n ->where('cp.path_id = ?', array($this->subCategory));\n }\n elseif ($this->topCategory) \n {\n $sql->innerJoin(array('p2c' => 'product_to_category'), 'p.product_id = p2c.product_id')\n ->where('p2c.category_id = ?', array($this->topCategory));\n }\n \n $searchConditions = $this->_prepareSearchConditions();\n if (count($searchConditions)) {\n $sql->innerJoin(array('pd' => 'product_description'), 'pd.product_id = p.product_id')\n ->multipleWhere($searchConditions, 'OR');\n }\n \n $sql2 = new SqlStatement();\n $sql2->select(array(\n 'p.product_id',\n 'p.price',\n 'discount' => 'MIN(pd2.price)',\n 'special' => 'MIN(ps.price)',\n 'total' => 'AVG(rating)',\n //@fixed_tax\n //@percent_tax\n ))\n ->from(array('p' => $sql))\n ->innerJoin(array('p2s' => 'product_to_store'), 'p.product_id = p2s.product_id')\n ->where('p2s.store_id = ?', (int)$this->config->get('config_store_id'))\n ->where(\"p.status = '1'\")\n ->where('p.date_available <= NOW()')\n ->group(array('p.product_id'));\n \n if (count($this->aggregate)) {\n foreach ($this->aggregate as $type => $group) {\n foreach ($group as $groupId => $values) {\n $tblAlias = strtolower(substr($type, 0, 1)) . $groupId;\n $sql2->innerJoin(array($tblAlias => self::FILTERS_TABLE), 'p.product_id = ' . $tblAlias . '.product_id');\n $sql2->where($tblAlias . '.type = ?', array($type));\n $sql2->where($tblAlias . '.group_id = ?', array($groupId));\n if ($type !== 'STOCK_STATUS') {\n foreach ($values as $k => $val) {\n $values[$k] = '\\'' . $this->db->escape($val) . '\\'';\n }\n $sql2->where($tblAlias . '.value IN (' . implode(', ', $values) . ')');\n } else {\n $terms = array();\n foreach ($values as $stockSt) {\n if ($stockSt == self::$IN_STOCK_STATUS) {\n $terms[] = '(p.quantity > 0 OR p.stock_status_id = ' . self::$IN_STOCK_STATUS . ')';\n } else {\n $terms[] = '(' . $tblAlias . '.value = \\'' . $this->db->escape($stockSt) . '\\' AND p.quantity = 0)';\n }\n }\n\n $sql2->where('(' . implode(' OR ', $terms) . ')');\n }\n }\n }\n }\n \n if ( self::$HIDE_OUT_OF_STOCK ) {\n $vals = array();\n if (isset($this->aggregate['OPTION'])) {\n foreach ($this->aggregate['OPTION'] as $values) {\n $vals = array_merge($vals, $values);\n }\n }\n $on = count($vals) \n ? \"p.product_id = pov.product_id AND pov.option_value_id IN (\" . implode(',', $vals) . \")\" \n : \"p.product_id = pov.product_id\";\n \n $sql2->leftJoin(array('pov' => 'product_option_value'), $on)\n ->where('( (pov.quantity IS NULL AND p.quantity > 0) OR pov.quantity > 0 )');\n }\n \n $sql2->leftJoin(array('pd2' => 'product_discount'), \"pd2.product_id = p.product_id \n AND pd2.quantity = '1'\n AND (pd2.date_start = '0000-00-00' OR pd2.date_start < NOW())\n AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())\n AND pd2.customer_group_id = '{$this->customerGroupId}'\")\n ->leftJoin(array('ps' => 'product_special'), \"ps.product_id = p.product_id \n AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())\n AND (ps.date_start = '0000-00-00' OR ps.date_start < NOW())\n AND ps.customer_group_id = '{$this->customerGroupId}'\")\n ->leftJoin(array('r1' => 'review'), 'r1.product_id = p.product_id AND r1.status = 1');\n\n if ($this->config->get('config_tax')) {\n $sql2->select(array('fixed_tax', 'percent_tax'))\n ->leftJoin(array('tr1' => $this->subquery->fixedTax), 'tr1.tax_class_id = p.tax_class_id')\n ->leftJoin(array('tr2' => $this->subquery->percentTax), 'tr2.tax_class_id = p.tax_class_id');\n } else {\n $sql2->select(array('fixed_tax' => '0', 'percent_tax' => '0'));\n }\n\n $this->db->query('CREATE TEMPORARY TABLE ' . DB_PREFIX . self::RESULTS_TABLE . ' (PRIMARY KEY (`product_id`)) ' . $sql2);\n }", "protected function _prepareCollection() {\r\n $store = $this->_getStore();\r\n $collection = Mage::getModel('catalog/product')->getCollection()\r\n ->addAttributeToSelect('sku')\r\n ->addAttributeToSelect('name')\r\n ->addAttributeToSelect('attribute_set_id')\r\n ->addAttributeToSelect('type_id');\r\n\r\n if (Mage::helper('catalog')->isModuleEnabled('Mage_CatalogInventory')) {\r\n $collection->joinField('qty', 'cataloginventory/stock_item', 'qty', 'product_id=entity_id', '{{table}}.stock_id=1', 'left');\r\n }\r\n if ($store->getId()) {\r\n $adminStore = Mage_Core_Model_App::ADMIN_STORE_ID;\r\n $collection->addStoreFilter($store);\r\n $collection->joinAttribute('name', 'catalog_product/name', 'entity_id', null, 'inner', $adminStore);\r\n $collection->joinAttribute('custom_name', 'catalog_product/name', 'entity_id', null, 'inner', $store->getId());\r\n $collection->joinAttribute('status', 'catalog_product/status', 'entity_id', null, 'inner', $store->getId());\r\n $collection->joinAttribute('visibility', 'catalog_product/visibility', 'entity_id', null, 'inner', $store->getId());\r\n $collection->joinAttribute('price', 'catalog_product/price', 'entity_id', null, 'left', $store->getId());\r\n $collection->joinAttribute('reqcoupon_status', 'catalog_product/reqcoupon_status', 'entity_id', null, 'left');\r\n } else {\r\n $collection->addAttributeToSelect('price');\r\n $collection->joinAttribute('status', 'catalog_product/status', 'entity_id', null, 'inner');\r\n $collection->joinAttribute('visibility', 'catalog_product/visibility', 'entity_id', null, 'inner');\r\n $collection->joinAttribute('reqcoupon_status', 'catalog_product/reqcoupon_status', 'entity_id', null, 'left');\r\n }\r\n\r\n $this->setCollection($collection);\r\n\r\n parent::_prepareCollection();\r\n $this->getCollection()->addWebsiteNamesToResult();\r\n return $this;\r\n }", "private function mapPrices(ProductInterface $magentoProduct, SkyLinkProduct $skyLinkProduct)\n {\n $magentoProduct->setPrice($skyLinkProduct->getPricingStructure()->getRegularPrice()->toNative());\n\n $magentoProduct->unsetData('special_price');\n $magentoProduct->unsetData('special_from_date');\n $magentoProduct->unsetData('special_to_date');\n\n if (false === $skyLinkProduct->getPricingStructure()->hasSpecialPrice()) {\n $this->removeSpecialPrices($magentoProduct);\n return;\n }\n\n $skyLinkSpecialPrice = $skyLinkProduct->getPricingStructure()->getSpecialPrice();\n\n // If the end date is before now, we do not need to put a new special price on at all, as\n // it cannot end in the past. In fact, Magento will let you save it, but won't let\n // subsequent saves from the admin interface occur.\n $now = new DateTimeImmutable();\n if ($skyLinkSpecialPrice->hasEndDate() && $skyLinkSpecialPrice->getEndDate() < $now) {\n $this->removeSpecialPrices($magentoProduct);\n return;\n }\n\n $magentoProduct->setCustomAttribute('special_price', $skyLinkSpecialPrice->getPrice()->toNative());\n\n // If there's a start date at least now or in the future, we'll use that...\n if ($skyLinkSpecialPrice->hasStartDate() && $skyLinkSpecialPrice->getStartDate() >= $now) {\n $magentoProduct->setCustomAttribute(\n 'special_from_date',\n $this->dateTimeToLocalisedAttributeValue($skyLinkSpecialPrice->getStartDate())\n );\n\n // Otherwise, we'll use a start date from now\n } else {\n $magentoProduct->setCustomAttribute('special_from_date', $this->dateTimeToLocalisedAttributeValue($now));\n }\n\n // If there's an end date, we'll just use that\n if ($skyLinkSpecialPrice->hasEndDate()) {\n $magentoProduct->setCustomAttribute(\n 'special_to_date',\n $this->dateTimeToLocalisedAttributeValue($skyLinkSpecialPrice->getEndDate())\n );\n\n // Otherwise, it's indefinite\n } else {\n $distantFuture = new DateTimeImmutable('2099-01-01');\n $magentoProduct->setCustomAttribute('special_to_date', $this->dateTimeToLocalisedAttributeValue($distantFuture));\n }\n }", "public function getProductSaveInfo($product, $data) {\n $product->setColor ( $data [11] );\n $product->setCost ( $data [12] );\n $product->setCountry ( $data [13] );\n $product->setCountryOfManufacture ( $data [14] );\n $product->setCreatedAt ( $data [15] );\n $product->setDescription ( $data [20] );\n $product->setEnableGooglecheckout ( $data [21] );\n $product->setGallery ( $data [22] );\n $product->setGiftMessageAvailable ( $data [23] );\n $product->setHasOptions ( $data [24] );\n $product->setHostemail ( $data [25] );\n $product->setHouserule ( $data [26] );\n $product->setImage ( $data [27] );\n $product->setImageLabel ( $data [28] );\n $product->setMediaGallery ( $data [30] );\n $product->setMinimalPrice ( $data [34] );\n $product->setMsrp ( $data [35] );\n $product->setMsrpDisplayActualPriceType ( $data [36] );\n $product->setMsrpEnabled ( $data [37] );\n $product->setName ( $data [38] );\n $product->setNewsFromDate ( strtotime ( $data [39] ) );\n $product->setNewsToDate ( '' );\n if (isset ( $data [41] )) {\n $product->setOptionsContainer ( $data [41] );\n }\n if (isset ( $data [43] )) {\n $product->setPrice ( $data [43] );\n }\n if (isset ( $data [44] )) {\n $product->setPrivacy ( $data [44] );\n }\n if (isset ( $data [45] )) {\n $product->setPropertyadd ( $data [45] );\n }\n if (isset ( $data [46] )) {\n $product->setPropertytype ( $data [46] );\n }\n if (isset ( $data [47] )) {\n $product->setPropertyWebsite ( $data [47] );\n }\n if (isset ( $data [48] )) {\n $product->setRequiredOptions ( $data [48] );\n }\n if (isset ( $data [49] )) {\n $product->setShortDescription ( $data [49] );\n }\n if (isset ( $data [50] )) {\n $product->setSmallImage ( $data [50] );\n }\n if (isset ( $data [51] )) {\n $product->setSmallImageLabel ( $data [51] );\n }\n if (isset ( $data [52] )) {\n $product->setSpecialFromDate ( $data [52] );\n }\n if (isset ( $data [53] )) {\n $product->setSpecialPrice ( $data [53] );\n }\n if (isset ( $data [54] )) {\n $product->setSpecialToDate ( $data [54] );\n }\n if (isset ( $data [55] )) {\n $product->setStatus ( $data [55] );\n }\n if (isset ( $data [56] )) {\n $product->setTaxClassId ( $data [56] );\n }\n if (isset ( $data [57] )) {\n $product->setThumbnail ( $data [57] );\n } \n return $product;\n }", "protected function _prepareProduct(Varien_Object $buyRequest, $product, $processMode, $fromGrouped = false)\n {\n $attributes = $buyRequest->getSuperAttribute();\n if ($attributes || !$this->_isStrictProcessMode($processMode)) {\n if (!$this->_isStrictProcessMode($processMode)) {\n if (is_array($attributes)) {\n foreach ($attributes as $key => $val) {\n if (empty($val)) {\n unset($attributes[$key]);\n }\n }\n } else {\n $attributes = array();\n }\n }\n\n //Se sono figlio di un raggruppato recupero i super_attributes relativi al prodotto\n if ($fromGrouped == true && isset($attributes[$product->getId()])) {\n $attributes = $attributes[$product->getId()];\n $buyRequest->setSuperAttribute($attributes);\n }\n\n $result = parent::_prepareProduct($buyRequest, $product, $processMode);\n if (is_array($result)) {\n $product = $this->getProduct($product);\n /**\n * $attributes = array($attributeId=>$attributeValue)\n */\n $subProduct = true;\n if ($this->_isStrictProcessMode($processMode)) {\n foreach($this->getConfigurableAttributes($product) as $attributeItem){\n /* @var $attributeItem Varien_Object */\n $attrId = $attributeItem->getData('attribute_id');\n if(!isset($attributes[$attrId]) || empty($attributes[$attrId])) {\n $subProduct = null;\n break;\n }\n }\n }\n\n if( $subProduct ) {\n $subProduct = $this->getProductByAttributes($attributes, $product);\n }\n\n if ($subProduct) {\n $product->addCustomOption('attributes', serialize($attributes));\n $product->addCustomOption('product_qty_'.$subProduct->getId(), 1, $subProduct);\n $product->addCustomOption('simple_product', $subProduct->getId(), $subProduct);\n\n $_result = $subProduct->getTypeInstance(true)->_prepareProduct(\n $buyRequest,\n $subProduct,\n $processMode\n );\n\n if (is_string($_result) && !is_array($_result)) {\n return $_result;\n }\n\n if (!isset($_result[0])) {\n return Mage::helper('checkout')->__('Cannot add the item to shopping cart');\n }\n\n /**\n * Adding parent product custom options to child product\n * to be sure that it will be unique as its parent\n */\n if ($optionIds = $product->getCustomOption('option_ids')) {\n $optionIds = explode(',', $optionIds->getValue());\n foreach ($optionIds as $optionId) {\n if ($option = $product->getCustomOption('option_' . $optionId)) {\n $_result[0]->addCustomOption('option_' . $optionId, $option->getValue());\n }\n }\n }\n\n $_result[0]->setParentProductId($product->getId())\n // add custom option to simple product for protection of process\n //when we add simple product separately\n ->addCustomOption('parent_product_id', $product->getId());\n if ($this->_isStrictProcessMode($processMode)) {\n $_result[0]->setCartQty(1);\n }\n $result[] = $_result[0];\n\n return $result;\n } else if (!$this->_isStrictProcessMode($processMode)) {\n return $result;\n }\n }\n }\n\n return $this->getSpecifyOptionMessage();\n }", "protected function _construct()\r\n {\r\n $this->_init('ss_price', 'price_id');\r\n }", "public function wc_epo_product_price_rules( $price = array(), $product ) {\n\t\tif ( $this->is_elex_dpd_enabled() ) {\n\t\t\t$check_price = apply_filters( 'wc_epo_discounted_price', NULL, $product, NULL );\n\t\t\tif ( $check_price ) {\n\t\t\t\t$price['product'] = array();\n\t\t\t\tif ( $check_price['is_multiprice'] ) {\n\t\t\t\t\tforeach ( $check_price['rules'] as $variation_id => $variation_rule ) {\n\t\t\t\t\t\tforeach ( $variation_rule as $rulekey => $pricerule ) {\n\t\t\t\t\t\t\t$price['product'][ $variation_id ][] = array(\n\t\t\t\t\t\t\t\t\"min\" => $pricerule[\"min\"],\n\t\t\t\t\t\t\t\t\"max\" => $pricerule[\"max\"],\n\t\t\t\t\t\t\t\t\"value\" => ( $pricerule[\"type\"] != \"percentage\" ) ? apply_filters( 'wc_epo_product_price', $pricerule[\"value\"], \"\", FALSE ) : $pricerule[\"value\"],\n\t\t\t\t\t\t\t\t\"type\" => $pricerule[\"type\"],\n\t\t\t\t\t\t\t\t'conditions' => isset( $pricerule[\"conditions\"] ) ? $pricerule[\"conditions\"] : array(),\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} else {\n\t\t\t\t\tforeach ( $check_price['rules'] as $rulekey => $pricerule ) {\n\t\t\t\t\t\t$price['product'][0][] = array(\n\t\t\t\t\t\t\t\"min\" => $pricerule[\"min\"],\n\t\t\t\t\t\t\t\"max\" => $pricerule[\"max\"],\n\t\t\t\t\t\t\t\"value\" => ( $pricerule[\"type\"] != \"percentage\" ) ? apply_filters( 'wc_epo_product_price', $pricerule[\"value\"], \"\", FALSE ) : $pricerule[\"value\"],\n\t\t\t\t\t\t\t\"type\" => $pricerule[\"type\"],\n\t\t\t\t\t\t\t'conditions' => isset( $pricerule[\"conditions\"] ) ? $pricerule[\"conditions\"] : array(),\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\t$price['price'] = apply_filters( 'woocommerce_tm_epo_price_compatibility', apply_filters( 'wc_epo_product_price', $product->get_price(), \"\", FALSE ), $product );\n\t\t}\n\n\t\treturn $price;\n\t}", "protected function _prepareColumns(): Product\r\n {\r\n parent::_prepareColumns();\r\n $this->addColumnAfter(\r\n 'image',\r\n [\r\n 'header' => __('Thumbnail'),\r\n 'index' => 'image',\r\n 'renderer' => Image::class,\r\n 'filter' => false,\r\n 'sortable' => false,\r\n 'column_css_class' => 'data-grid-thumbnail-cell'\r\n ],\r\n 'entity_id'\r\n );\r\n $this->addColumnAfter(\r\n 'url_key',\r\n [\r\n 'header' => __('Product Url'),\r\n 'index' => 'url_key' \r\n ],\r\n 'entity_id'\r\n );\r\n $this->addColumnAfter(\r\n 'meta_title',\r\n [\r\n 'header' => __('Meta Title'),\r\n 'index' => 'meta_title' \r\n ],\r\n 'entity_id'\r\n );\r\n $this->sortColumnsByOrder();\r\n \r\n return $this;\r\n }", "private function createSingleProductPlaceHolders($singleProduct, $translations, &$args)\n\t{\n\t\t$formId = (int) $args['form']->FormId;\n\t\t$properties = RSFormProHelper::getComponentProperties($singleProduct, false);\n\t\t$priceHelper = new Price($this->loadFormSettings($formId));\n\n\t\t$this->translate($properties, $translations);\n\n\t\t$data = $properties[$singleProduct[0]];\n\t\t$price = $data['PRICE'];\n\n\t\t$args['placeholders'][] = '{' . $data['NAME'] . ':price}';\n\t\t$args['values'][] = $priceHelper->getPriceMask($data['CAPTION'], $price, ($data['CURRENCY'] ?? ''));\n\t\t$args['placeholders'][] = '{' . $data['NAME'] . ':amount}';\n\t\t$args['values'][] = $priceHelper->getAmountMask($price, ($data['CURRENCY'] ?? ''));\n\t}", "protected function _prepareData()\n {\n $product = Mage::getModel( 'upsellcategory/product' );\n\n // Pass the product limit set via the layout.xml to the model\n $product->setData( 'product_limit', $this->getData( 'product_limit' ) );\n\n // The custom model has the a function to retrieve the related products\n // by parent category. Pass \"true\" as the first argument to only show\n // related products from the current product's category, not its\n // sibling categories as well\n $this->_itemCollection = $product->getUpSellProductCollection();\n\n // Return\n return $this;\n }", "private function __adjustProduct (&$product, $skipRelations = true) {\n global $app;\n // adjusting\n $productID = intval($product['ID']);\n $product['ID'] = $productID;\n $product['OriginID'] = intval($product['OriginID']);\n $product['CategoryID'] = intval($product['CategoryID']);\n $product['_category'] = API::getAPI('shop:categories')->getCategoryByID($product['CategoryID']);\n $product['_origin'] = API::getAPI('shop:origins')->getOriginByID($product['OriginID']);\n $product['Attributes'] = $this->getProductAttributes($productID);\n $product['IsPromo'] = intval($product['IsPromo']) === 1;\n $product['IsFeatured'] = intval($product['IsFeatured']) === 1;\n $product['IsOffer'] = intval($product['IsOffer']) === 1;\n $product['ShowBanner'] = intval($product['ShowBanner']) === 1;\n\n // create display product title\n $displayName = array();\n if (!empty($product['Name'])) {\n $displayName[] = $product['Name'];\n }\n if (!empty($product['_origin'])) {\n $displayName[] = $product['_origin']['Name'];\n }\n if (!empty($product['Model'])) {\n $displayName[] = $product['Model'];\n }\n $product['_displayNameFull'] = implode(' ', $displayName);\n $product['_displayName'] = implode(' ', array_slice($displayName, 1));\n\n // misc data\n if (!$skipRelations) {\n $product['Relations'] = $this->getProductRelations($productID);\n }\n\n // features\n $product['Features'] = $this->getProductFeatures($productID);\n\n // media\n $product['Images'] = $this->getProductImages($productID);\n $product['Videos'] = $this->getProductVideos($productID);\n $product['Banners'] = $this->getProductBanners($productID);\n\n // Utils\n $product['viewExtrasInWish'] = API::getAPI('shop:wishlists')->productIsInWishList($productID);\n $product['viewExtrasInCompare'] = API::getAPI('shop:comparelists')->productIsInCompareList($productID);\n $product['viewExtrasInCartCount'] = API::getAPI('shop:orders')->productCountInCart($productID);\n\n // is available\n $product['_available'] = in_array($product['Status'], dbquery::getProductStatusesWhenAvailable());\n $product['_archived'] = in_array($product['Status'], dbquery::getProductStatusesWhenDisabled());\n\n // promo\n $promo = API::getAPI('shop:promos')->getSessionPromo();\n $product['_promo'] = $promo;\n\n // prices and actual price\n $price = floatval($product['Price']);\n $prevprice = floatval($product['PrevPrice']);\n $actualPrice = 0;\n $priceHistory = $this->getProductPriceHistory($productID);\n if ($product['IsPromo'] && !empty($promo) && !empty($promo['Discount']) && $promo['Discount'] > 0) {\n $product['_promoIsApplied'] = true;\n $actualPrice = (100 - intval($promo['Discount'])) / 100 * $price;\n } else {\n $product['_promoIsApplied'] = false;\n $actualPrice = $price;\n }\n $actualPrice = floatval($actualPrice);\n $savingValue = $prevprice - $actualPrice;\n unset($product['Price']);\n unset($product['PrevPrice']);\n\n // apply currencies\n $convertedPrices = API::getAPI('shop:exchangerates')->convertToRates($actualPrice);\n $convertedPrevPrices = API::getAPI('shop:exchangerates')->convertToRates($prevprice);\n $convertedSavings = API::getAPI('shop:exchangerates')->convertToRates($savingValue);\n\n // create product prices object\n $product['_prices'] = array(\n 'price' => $price,\n 'previous' => $prevprice,\n 'actual' => $actualPrice,\n 'others' => $convertedPrices,\n 'history' => $priceHistory,\n 'previousothers' => $convertedPrevPrices,\n 'savings' => $savingValue,\n 'savingsothers' => $convertedSavings\n );\n\n $product['ShopDiscount'] = $prevprice > 0 ? 100 - intval($price * 100 / $prevprice) : 0;\n $product['IsBigSavings'] = $product['ShopDiscount'] > 5;\n $product['GoodToShowPreviousPrice'] = $savingValue > 10;\n\n if (!empty($product['Attributes']['PROMO_TEXT'])) {\n $product['Attributes']['PROMO_TEXT'] = str_replace('[DisplayName]', $product['_displayName'], $product['Attributes']['PROMO_TEXT']);\n }\n\n // // save product into recently viewed list\n // $isDirectRequestToProduct = Request::hasInGet('id') || Request::hasInGet('params');\n // if (Request::isGET() && !$app->isToolbox() && !empty($isDirectRequestToProduct)) {\n // $recentProducts = isset($_SESSION[$this->_listKey_Recent]) ? $_SESSION[$this->_listKey_Recent] : array();\n // $recentProducts[] = $productID;\n // $_SESSION[$this->_listKey_Recent] = array_unique($recentProducts);\n // }\n\n // var_dump($product);\n return $product;\n }", "function prepare_price($price_arr,$class_arr,$br)\n\t{\n\t\t\n\t\tglobal $PriceSettings_arr;\n\t\t$retval = '';\n\t\t$retvalue['pdf'] \t\t= array();\n\t\t// Check whether price is to be displayed in a single row or in multiple rows\n\t\tif ($br==1) // case if the seperation character is <br>\n\t\t{ \n\t\t\t// Check whether ul or div is to be used to display the prices\n\t\t\tswitch ($class_arr['class_type'])\n\t\t\t{\n\t\t\t\tcase 'div': // case if div\n\t\t\t\t\t$outer_prefix \t= '';\n\t\t\t\t\t$outer_suffix\t= '';\n\t\t\t\t\t$main_prefix \t= '<div ';\n\t\t\t\t\t$main_suffix \t= '</div>';\n\t\t\t\tbreak;\n\t\t\t\tdefault: // case if any other than div\n\t\t\t\t\tif($class_arr['ul_class'])// place <ul> only if the class for ul is present\n\t\t\t\t\t\t$outer_prefix = '<ul class=\"'.$class_arr['ul_class'].'\">';\n\t\t\t\t\telse\n\t\t\t\t\t\t$outer_prefix = '';\n\t\t\t\t\tif($class_arr['ul_class'])// place <ul> only if the class for ul is present\n\t\t\t\t\t\t$outer_suffix = '</ul>';\n\t\t\t\t\telse\n\t\t\t\t\t\t$outer_suffix = '';\t\n\t\t\t\t\t$main_prefix \t= '<li ';\n\t\t\t\t\t$main_suffix \t= '</li>';\n\t\t\t\tbreak;\n\t\t\t};\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$outer_prefix \t= '<div>';\n\t\t\t$outer_suffix\t= '</div>';\n\t\t\t$main_prefix\t= '<span ';\n\t\t\t$main_suffix\t= '</span>';\n\n\t\t\t// Overriding the classes using the classes for span\n\t\t\t$class_arr['normal_class']\t\t= ($class_arr['normal_span_class']!='')?$class_arr['normal_span_class']:'normal_span_class';\n\t\t\t$class_arr['strike_class']\t\t= ($class_arr['strike_span_class']!='')?$class_arr['strike_span_class']:'strike_span_class';\n\t\t\t$class_arr['yousave_class']\t\t= ($class_arr['yousave_span_class']!='')?$class_arr['yousave_span_class']:'yousave_span_class';\n\t\t\t$class_arr['discount_class']\t= ($class_arr['discount_span_class']!='')?$class_arr['discount_span_class']:'discount_span_class';\n\t\t}\t\n\t\t \n\t\tif ($outer_prefix!='')\n\t\t\t$retval .= $outer_prefix;\n\t\tif ($price_arr['discounted_price']) //Check if discount exists\n\t\t{\n\t\t\tif ($PriceSettings_arr['strike_baseprice']==1) // check whether the base price is to be striked out\n\t\t\t{\n\t\t\t\t$base_class = $class_arr['strike_class'];\n\t\t\t}\t\n\t\t\telse\t\n\t\t\t{\n\t\t\t\t$base_class = $class_arr['normal_class'];\n\t\t\t}\t\n\t\t\t$retval \t\t\t\t\t\t\t.=$main_prefix.' class=\"'.$base_class.'\">'.$price_arr['base_price'].$main_suffix;\n\t\t\t$retvalue['pdf'][] \t\t\t\t\t= $price_arr['base_price'];\n\t\t\t$retvalue['normal']['base_price'] \t= $price_arr['base_price'];\n\t\t\t\n\t\t\tif ($price_arr['base_price_exc'])// show only in exists\n\t\t\t{\n\t\t\t\t$retval \t\t\t\t\t\t.=$main_prefix.' class=\"'.$base_class.'\">'.$price_arr['base_price_exc'].$main_suffix;\n\t\t\t\t$retvalue['pdf'][] \t\t\t\t= $price_arr['base_price_exc'];\n\t\t\t}\t\n\t\t\t$retval \t\t\t\t\t\t\t.=$main_prefix.' class=\"'.$class_arr['normal_class'].'\">'.$price_arr['discounted_price'].$main_suffix;\n\t\t\t$discounted_price_only \t\t\t= $price_arr['discounted_price'];\n\t\t\t$retvalue['pdf'][] \t\t\t\t\t= $price_arr['discounted_price'];\n\t\t\t\n\t\t\tif ($price_arr['discounted_price_exc'])// show only in exists\n\t\t\t{\n\t\t\t\t$retval \t\t\t\t\t\t.=$main_prefix.' class=\"'.$class_arr['normal_class'].'\">'.$price_arr['discounted_price_exc'].$main_suffix;\n\t\t\t\t$retvalue['pdf'][] \t\t\t\t= $price_arr['discounted_price_exc'];\n\t\t\t}\t\n\t\t\tif($price_arr['yousave_price'])// show only in exists\n\t\t\t{\n\t\t\t\t$retval \t\t\t\t\t\t.=$main_prefix.' class=\"'.$class_arr['yousave_class'].'\">'.$price_arr['yousave_price'].$main_suffix;\n\t\t\t\t$retvalue['pdf'][] \t\t\t\t= $price_arr['yousave_price'];\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif($PriceSettings_arr['price_display_discount_with_price']==1)\n\t\t\t\t{\n\t\t\t\t\tif($price_arr['disc_val']) // if discount is entered as val\n\t\t\t\t\t{\n\t\t\t\t\t\t$retval \t\t\t\t.=$main_prefix.' class=\"'.$class_arr['discount_class'].'\">'.$price_arr['disc_val'].$main_suffix;\n\t\t\t\t\t\t$retvalue['pdf'][] \t\t= $price_arr['disc_val'];\n\t\t\t\t\t}\t\n\t\t\t\t\telseif($price_arr['disc_percent']) // if discount is entered as percentage\n\t\t\t\t\t{\n\t\t\t\t\t\t$retval \t\t\t\t.=$main_prefix.' class=\"'.$class_arr['discount_class'].'\">'.$price_arr['disc_percent'].$main_suffix;\n\t\t\t\t\t\t$retvalue['pdf'][] \t\t= $price_arr['disc_val'];\n\t\t\t\t\t}\n\t\t\t\t}\t\t\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{ \n\t\t\t$retval \t\t\t.=$main_prefix.' class=\"'.$class_arr['normal_class'].'\">'.$price_arr['base_price'].$main_suffix;\n\t\t\t$retvalue['pdf'][] \t= $price_arr['base_price'];\n\t\t}\t\n\t\tif ($outer_suffix!='')\n\t\t\t$retval .= $outer_suffix;\n\t\t\n\t\t$returnvalue['html'] = $retval;\n\t\t$returnvalue['values'] = $retvalue['pdf'];\n\t\treturn $returnvalue;\n\t}", "function es_product_bulk_price($price, $quantity, $sku) {\n\t/*\n\t* PUB41 - Your child’s first year at school Bulk discount\n\t* For orders of x >= 20 $12.95, x >= 50 $9.90\n\t*/\n\tif ($sku == 'PUB41') {\n\t\tif ($quantity >= 20 AND $quantity < 50) {\n\t\t\t$price = 12.95;\n\t\t}\n\t\telseif ($quantity >= 50) {\n\t\t\t$price = 9.95;\n\t\t}\n\t}\n\telseif($sku == 'SUND507') {\n\t\tif ($quantity >= 3)\n\t\t\t$price = 10.95;\n\t}\n\telseif($sku == 'SUND621') {\n\t\tif ($quantity >= 3)\n\t\t\t$price = 16.95;\n\t}\n\telseif($sku == 'SUND620') {\n\t\tif ($quantity >= 5)\n\t\t\t$price = 14.95;\n\t}\n\t\n\treturn $price;\n}", "public function setProductPrice($product_price){\n $this->product_price = $product_price;\n }", "private function getPrices () {\n\t\tlibxml_use_internal_errors(true);\n\t\n\t\t$dom = new DOMDocument();\n\n\t\t@$dom->loadHTML( $this->result );\n\t\t$xpath = new DOMXPath( $dom );\n\t\t\n\t\t$this->prices[] = array(\n\t\t\t'station.from' => $this->getPostField('from.searchTerm'),\n\t\t\t'station.to' => $this->getPostField('to.searchTerm'),\n\t\t\t'station.prices' => $xpath->query($this->config['lookupString'])\n\t\t);\n\t}", "public function getPrices()\n {\n }", "function ppom_get_product_price( $product ) {\n\t\n\t$product_price = $product->get_price();\n\t\n\tif( has_filter('woocs_exchange_value') ) {\n\t\tglobal $WOOCS;\n\t\t\n\t\tif($WOOCS->current_currency != $WOOCS->default_currency ) {\n\t\t\tif($WOOCS->is_multiple_allowed) {\n\t\t\t\t$product_price = apply_filters('woocs_raw_woocommerce_price', $product_price);\n\t\t\t} else {\n\t\t\t\t\n\t\t\t\t$product_price = apply_filters('woocs_exchange_value', $product_price);\n\t\t\t}\n\t\t}\n\t}\n\t\n\treturn apply_filters('ppom_product_price', $product_price, $product);\n}", "public static function getPrice(&$products_table = NULL, $uid = NULL) {\n Yii::import('application.controllers.ProfileController');\n\n if (!$products_table) { //if it's cart products table\n $table = 'store_cart';\n } else {\n $table = 'temp_order_product_' . (Yii::app()->user->id ? Yii::app()->user->id : 'exchange');\n $query = \"DROP TABLE IF EXISTS {$table};\";\n $query .= \"CREATE TEMPORARY TABLE {$table} (product_id int(11) unsigned, quantity smallint(5) unsigned);\";\n foreach ($products_table as $item) {\n\n if ($item instanceof OrderProduct || $item instanceof stdClass || $item instanceof Cart) {\n $product = Product::model()->findByAttributes(array('id' => (string) $item->product_id));\n } else {\n $product = Product::model()->findByAttributes(array('code' => (string) $item->code));\n }\n\n if ($product) {\n $query .= \"INSERT INTO {$table} VALUES ({$product->id}, {$item->quantity});\";\n } else {\n throw new Exception('Product not found. Product code: ' . $item->code);\n }\n }\n Yii::app()->db->createCommand($query)->execute();\n }\n $query = Yii::app()->db->createCommand()\n ->select('SUM(c.quantity*round(prices.price*(1-greatest(ifnull(disc.percent,0),ifnull(disc1.percent,0),ifnull(disc2.percent,0))/100))) as c_summ, prices.price_id')\n ->from($table . ' c')\n ->join('store_product product', 'c.product_id=product.id')\n ->join('store_product_price prices', 'product.id=prices.product_id')\n ->join('store_price price', 'price.id=prices.price_id')\n ->leftJoin('store_discount disc', \"disc.product_id=0 and disc.actual=1 and (disc.begin_date='0000-00-00' or disc.begin_date<=CURDATE()) and (disc.end_date='0000-00-00' or disc.end_date>=CURDATE())\")\n ->leftJoin('store_product_category cat', 'cat.product_id=product.id')\n ->leftJoin('store_discount_category discat', 'discat.category_id=cat.category_id')\n ->leftJoin('store_discount disc1', \"disc1.product_id=1 and disc1.id=discat.discount_id and disc1.actual=1 and (disc1.begin_date='0000-00-00' or disc1.begin_date<=CURDATE()) and (disc1.end_date='0000-00-00' or disc1.end_date>=CURDATE())\")\n ->leftJoin('store_discount_product dispro', 'dispro.product_id=product.id')\n ->leftJoin('store_discount disc2', \"disc2.product_id=2 and disc2.id=dispro.discount_id and disc2.actual=1 and (disc2.begin_date='0000-00-00' or disc2.begin_date<=CURDATE()) and (disc2.end_date='0000-00-00' or disc2.end_date>=CURDATE())\")\n ->order('price.summ DESC')\n ->group('prices.price_id, price.summ')\n ->having('c_summ>price.summ');\n\n if (!$products_table){\n $sid = ProfileController::getSession();\n $query->where(\"(session_id=:sid AND :sid<>'') OR (user_id=:uid AND :sid<>'')\", array(\n ':sid' => $sid,\n ':uid' => Yii::app()->user->isGuest ? '' : Yii::app()->user->id,\n ));\n }\n\n// $text = $query->getText();\n $row = $query->queryRow();\n if ($row)\n $price = self::model()->findByPk($row['price_id']);\n else\n $price = self::model()->find(array('order' => 'summ'));\n\n if ($products_table)\n Yii::app()->db->createCommand(\"DROP TABLE IF EXISTS {$table};\")->execute();\n\n if ($uid)\n $profile = CustomerProfile::model()->with('price')->findByAttributes(array('user_id' => $uid));\n else\n $profile = ProfileController::getProfile();\n\n if ($profile && $profile->price_id && $profile->price->summ > $price->summ)\n return $profile->price;\n else\n return $price;\n }", "public function prepare(User $customer, Product $product, User $seller, Order $draftOrder): OrderProduct;", "static function generate_order_prices(Model_Cart $shopping_cart, $shipping_id=false, $payment_id=false, $raw_discount=0)\n {\n\n if($shopping_cart->total_cart_price_with_tax==0) return array();\n \n // nazvy indexu shodne s db tabulkou \"order\"\n \n // inicializace vsech promennych co se budou pocitat v kosiku\n \n $prices[\"order_price_no_vat\"]=0; // soucet cen produktu s nulovou dani\n $prices[\"order_price_lower_vat\"]=0; // soucet cen produktu s nizsi sazbou dane (vcetne dane)\n $prices[\"order_price_higher_vat\"]=0; // soucet cen produktu s vyssi sazbou dane (vcetne dane)\n\n // nasledujici se bude generovat az v create_order:\n $prices[\"order_no_vat_rate\"]=0; // \n $prices[\"order_lower_vat_rate\"]=db::select(\"hodnota\")->from(\"taxes\")->where(\"code\",\"=\",\"lower_vat\")->execute()->get(\"hodnota\"); // hodnota nizsi sazby dane\n $prices[\"order_higher_vat_rate\"]=db::select(\"hodnota\")->from(\"taxes\")->where(\"code\",\"=\",\"higher_vat\")->execute()->get(\"hodnota\"); // hodnota vyssi sazby dane\n \n $prices[\"order_lower_vat\"]=0; // soucet vsech nizsich dani na produktech\n $prices[\"order_higher_vat\"]=0; // soucet vsech vyssich dani na produktech\n \n $prices[\"order_total_without_vat\"]=0; // celkova cena kosiku bez dane\n $prices[\"order_total_with_vat\"]=0; // celkova cena kosiku s dani\n \n $prices[\"order_discount\"]=0; // hodnota slevy na objednavce (vcetne dane)\n \n $prices[\"order_total_with_discount\"]=0;// celkova cena kosiku s dani a zapoctenymi slevami \n \n $prices[\"order_shipping_price\"]=0; // cena dopravy s dani\n $prices[\"order_payment_price\"]=0; // cena platby s dani\n \n $prices[\"order_total\"]=0; // cena celkem po zapocitani dopravy a platby\n $prices[\"order_correction\"]=0; // hodnota zaokrouhleni platby\n $prices[\"order_total_CZK\"]=0; // cena k zaplaceni celkem po zaokrouhleni\n \n // udaje k doprave, ktera byla pouzita k vypoctu objednavky\n $prices[\"order_shipping_id\"]=0;\n $prices[\"order_shipping_nazev\"]=\"\";\n $prices[\"order_shipping_popis\"]=\"\";\n \n // udaje k platbe, ktera byla pouzita k vypoctu objednavky\n $prices[\"order_payment_id\"]=0;\n $prices[\"order_payment_nazev\"]=\"\";\n $prices[\"order_payment_popis\"]=\"\";\n \n \n \n // generovani vyse uvedenych promennych\n \n $prices[\"order_price_no_vat\"] = $shopping_cart->total_cart_price_no_tax;\n $prices[\"order_price_lower_vat\"] = $shopping_cart->total_cart_price_lower_tax;\n $prices[\"order_price_higher_vat\"] = $shopping_cart->total_cart_price_higher_tax;\n \n $prices[\"order_lower_vat\"] = $shopping_cart->total_lower_tax_value; \n $prices[\"order_higher_vat\"] = $shopping_cart->total_higher_tax_value;\n \n $prices[\"order_total_without_vat\"] = $shopping_cart->total_cart_price_without_tax; \n $prices[\"order_total_with_vat\"] = $shopping_cart->total_cart_price_with_tax; \n \n $prices[\"order_shipping_id\"] =$shipping_id;\n $prices[\"order_payment_id\"] =$payment_id;\n \n //////////////////////////////////////// \n // vypocet slev na objednavce TODO podle potreb projektu:\n $prices=static::calculate_order_discount($prices, $shopping_cart, $raw_discount);\n \n // prirazeni voucheru k objednavce\n $voucher=Service_Voucher::get_voucher();\n if($voucher)\n {\n $prices[\"order_voucher_id\"]=$voucher->id;\n $prices[\"order_voucher_discount\"]=$shopping_cart->total_cart_voucher_discount;\n }\n \n ////////////////////////////////////////\n $prices[\"order_total_with_discount\"] = $prices[\"order_total_with_vat\"]-$prices[\"order_discount\"];\n if($prices[\"order_total_with_discount\"]<0) $prices[\"order_total_with_discount\"]=0;\n \n // cena za dopdieravu\n if($shipping_id)\n {\n $shipping = orm::factory(\"shipping\",$shipping_id);\n $prices[\"order_shipping_nazev\"] = $shipping->nazev;\n $prices[\"order_shipping_popis\"] = $shipping->popis;\n // cena dopravy\n if($shipping->cenove_hladiny)\n {\n $prices[\"order_shipping_price\"] = Service_Hana_Shipping::get_level_price($shipping_id, round($prices[\"order_total_with_discount\"]));\n if($prices[\"order_shipping_price\"]==false) $prices[\"order_shipping_price\"]=$shipping->cena;\n }\n else\n { \n $prices[\"order_shipping_price\"] = $shipping->cena;\n } \n\n }\n\n // cena za platbu\n if($payment_id)\n {\n $payment = orm::factory(\"payment\",$payment_id);\n $prices[\"order_payment_nazev\"]=$payment->nazev;\n $prices[\"order_payment_popis\"]=$payment->popis;\n \n // vypocet platby na zaklade typu\n if($payment->typ==2)\n {\n // TODO - platba na zaklade hodnoty objednaneho zbozi \n $prices[\"order_payment_price\"] = $price[\"order_total_with_discount\"]($payment->cena/100); \n }\n else\n {\n $prices[\"order_payment_price\"] = $payment->cena;\n }\n \n $shp=$prices[\"order_shipping_price\"] + $prices[\"order_payment_price\"];\n if($shp<0) $prices[\"order_payment_price\"]=$prices[\"order_shipping_price\"]; // pokud je platba dana slevou, nelze se dostat do zaporu (jeji sleva je ve vysi max ceny dopravy)\n \n }\n \n //////////////////////////////////////////////\n $prices[\"order_total\"] = $prices[\"order_total_with_discount\"] + $prices[\"order_shipping_price\"] + $prices[\"order_payment_price\"];\n $prices[\"order_total_CZK\"] =round($prices[\"order_total\"]); \n $prices[\"order_correction\"] =$prices[\"order_total_CZK\"]-$prices[\"order_total\"]; \n \n return $prices;\n }", "protected function _prepareCollection()\n {\n\n\t\t\n\t\t$collection = Mage::getModel('catalog/product')->getCollection()\n ->addAttributeToSelect('sku')\n ->addAttributeToSelect('name');\n\t\t\t\n\t\t$collection->addAttributeToSelect('thumbnail');\n\t\t\n\t\t$collection->addAttributeToFilter('image', array('eq' => 'no_selection'));\n \n\t\t//$collection->joinAttribute('image', 'catalog_product/image', 'entity_id', null, 'left');\n\n\t\t$this->setCollection($collection);\n\t\treturn parent::_prepareCollection();\n }", "public function __construct(Ex_product $product, $ratio, $margin_rate, $base_price_changable)\n {\n $this->product = $product;\n $this->ratio = $ratio;\n $this->margin_rate = $margin_rate;\n $this->base_price_changable = $base_price_changable;\n }", "protected function _getProductCollection()\n {\n $collection = parent::_getProductCollection();\n\n /*\n * Collections using Product Flat index require different processing.\n */\n if (Mage::getStoreConfigFlag('catalog/frontend/flat_catalog_product')) {\n $collection\n ->getSelect()\n ->where(new Zend_Db_Expr('price_index.final_price < price_index.price'));\n } else {\n $today = date('Y-m-d', time());\n $collection\n ->addAttributeToFilter('special_price', array('is' => new Zend_Db_Expr('not null')))\n ->addAttributeToFilter('special_from_date', array(\n 'or' => array(\n 0 => array('date' => true, 'to' => $today),\n 1 => array('is' => new Zend_Db_Expr('null')),\n )), 'left')\n ->addAttributeToFilter('special_to_date', array(\n 'or' => array(\n 0 => array('date' => true, 'from' => $today),\n 1 => array('is' => new Zend_Db_Expr('null')),\n )), 'left');\n }\n\n return $collection;\n }", "private function createMultipleProductsPlaceHolders($multipleProducts, $translations, &$args)\n\t{\n\t\t$formId = (int) $args['form']->FormId;\n\t\t$submissionId = (int) $args['submission']->SubmissionId;\n\t\t$multipleSeparator = nl2br($args['form']->MultipleSeparator);\n\t\t$properties = RSFormProHelper::getComponentProperties($multipleProducts, false);\n\t\t$priceHelper = new Price($this->loadFormSettings($formId));\n\t\t$this->translate($properties, $translations);\n\n\t\tforeach ($multipleProducts as $product)\n\t\t{\n\t\t\t$data = $properties[$product];\n\t\t\t$value = $this->getSubmissionValue($submissionId, (int) $product);\n\n\t\t\tif ($value === '' || $value === null)\n\t\t\t{\n\t\t\t\t$args['placeholders'][] = '{' . $data['NAME'] . ':amount}';\n\t\t\t\t$args['values'][] = '';\n\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t$values = explode(\"\\n\", $value);\n\n\t\t\t$field = new MultipleProducts(\n\t\t\t\t[\n\t\t\t\t\t'formId' => $formId,\n\t\t\t\t\t'componentId' => $product,\n\t\t\t\t\t'data' => $data,\n\t\t\t\t\t'value' => ['formId' => $formId, $data['NAME'] => $values],\n\t\t\t\t\t'invalid' => false,\n\t\t\t\t]\n\t\t\t);\n\n\t\t\t$replace = '{' . $data['NAME'] . ':price}';\n\t\t\t$with = [];\n\t\t\t$withAmount = [];\n\n\t\t\tif ($items = $field->getItems())\n\t\t\t{\n\t\t\t\tforeach ($items as $item)\n\t\t\t\t{\n\t\t\t\t\tif (empty($item))\n\t\t\t\t\t{\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\n\t\t\t\t\t$item = new RSFormProFieldItem($item);\n\n\t\t\t\t\tforeach ($values as $value)\n\t\t\t\t\t{\n\t\t\t\t\t\tif (stristr($value, $item->label))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$with[] = $priceHelper->getPriceMask(\n\t\t\t\t\t\t\t\t$value, $item->value, ($data['CURRENCY'] ?? '')\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t$quantity = trim(str_ireplace($item->label, '', $value));\n\n\t\t\t\t\t\t\tif (strlen($quantity) === 0)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$quantity = 1;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t$withAmount[] = $quantity * $item->value;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (($position = array_search($replace, $args['placeholders'])) !== false)\n\t\t\t{\n\t\t\t\t$args['placeholders'][$position] = $replace;\n\t\t\t\t$args['values'][$position] = implode($multipleSeparator, $with);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$args['placeholders'][] = $replace;\n\t\t\t\t$args['values'][] = implode($multipleSeparator, $with);\n\t\t\t}\n\n\t\t\t$args['placeholders'][] = '{' . $data['NAME'] . ':amount}';\n\t\t\t$args['values'][] = $priceHelper->getAmountMask(\n\t\t\t\t($withAmount ? array_sum($withAmount) : 0), ($data['CURRENCY'] ?? '')\n\t\t\t);\n\t\t}\n\t}", "public function listProductprices(){\n try{\n $sql = \"Select * from productforsale pr inner join product p on pr.id_product = p.id_product inner join categoryp c on p.id_categoryp = c.id_categoryp inner join medida m on p.product_unid_type = m.medida_id\";\n $stm = $this->pdo->prepare($sql);\n $stm->execute();\n $result = $stm->fetchAll();\n } catch (Exception $e){\n $this->log->insert($e->getMessage(), 'Inventory|listProductprices');\n $result = 2;\n }\n\n return $result;\n }", "abstract protected function prepareProductImagesData(int $vendorProductId);", "public function getProductPrice() {\n\t\t\t$data = request()->all();\n\t\t\t$dataArr = explode('-', $data['idSize']);\n\t\t\t$proAttr = ProductsAttribute::where(['product_id'=>$dataArr[0], 'size'=>$dataArr[1]])->first();\n\t\t\t$productData = [\n\t\t\t\t'sku' \t=> $proAttr->sku, \n\t\t\t\t'price' => $proAttr->price,\n\t\t\t\t'stock' => $proAttr->stock\n\t\t\t]; \n\t\t\treturn $productData;\n\t\t}", "function prepareFields() {\r\n\t\t$data = array_keys($this->modx->getFieldMeta('msProductData'));\r\n\t\tforeach ($this->resourceArray as $k => $v) {\r\n\t\t\tif (is_array($v) && in_array($k, $data)) {\r\n\t\t\t\t$tmp = $this->resourceArray[$k];\r\n\t\t\t\t$this->resourceArray[$k] = array();\r\n\t\t\t\tforeach ($tmp as $v2) {\r\n\t\t\t\t\tif (!empty($v2)) {\r\n\t\t\t\t\t\t$this->resourceArray[$k][] = array('value' => $v2);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif (empty($this->resourceArray['vendor'])) {\r\n\t\t\t$this->resourceArray['vendor'] = '';\r\n\t\t}\r\n\t}", "public function maybe_change_shop_product_display_price($display_price, $product, $filter_name)\n {\n\n // TODO: Implement grouped product handling and possible any type of custom product that has children\n\n // TODO: Probably we should use caching for this\n\n // Check request and product\n if (!RightPress_Help::is_request('frontend') || !subscriptio_is_subscription_product($product)) {\n return $display_price;\n }\n\n // Product does not have children, e.g. simple product\n if (!RightPress_Help::wc_product_has_children($product)) {\n\n // Format subscription product display price\n $display_price = RP_SUB_Pricing::format_subscription_product_display_price($display_price, subscriptio_get_subscription_product($product));\n }\n // Product has children, e.g. variable or grouped product\n else {\n\n // Get visible variation prices\n $prices = RightPress_Product_Price_Shop::get_visible_variations_prices($product);\n\n $min_reference_price = null;\n $max_reference_price = null;\n $selected_variation_id = null;\n $selected_price = null;\n $settings_hashes = array();\n\n // Iterate over visible variations\n foreach ($product->get_visible_children() as $variation_id) {\n\n // Current variation is not subscription product, skip it\n if (!subscriptio_is_subscription_product($variation_id)) {\n continue;\n }\n\n // Load subscription product\n $subscription_product = subscriptio_get_subscription_product($variation_id);\n\n // Calculate reference price per day\n $period_length = $subscription_product->get_billing_cycle_length() . ' ' . $subscription_product->get_billing_cycle_period();\n $reference_price = $prices['price'][$variation_id] / RP_SUB_Time::convert_period_length_to($period_length, 'days');\n\n // Maybe set min price\n if ($min_reference_price === null || RightPress_Product_Price::price_is_smaller_than($reference_price, $min_reference_price)) {\n $selected_variation_id = $variation_id;\n $min_reference_price = $reference_price;\n $selected_price = $prices['price'][$variation_id];\n }\n\n // Maybe set max price\n if ($max_reference_price === null || RightPress_Product_Price::price_is_bigger_than($reference_price, $max_reference_price)) {\n $max_reference_price = $reference_price;\n }\n\n // Add settings hashes for comparison\n $settings_hashes[] = RightPress_Help::get_hash(false, array(\n $subscription_product->get_billing_cycle_length(),\n $subscription_product->get_billing_cycle_period(),\n $subscription_product->get_free_trial_length(),\n $subscription_product->get_free_trial_period(),\n $subscription_product->get_lifespan_length(),\n $subscription_product->get_lifespan_period(),\n $subscription_product->get_signup_fee(),\n ));\n }\n\n // Leave unique settings hashes only\n $settings_hashes = array_unique($settings_hashes);\n\n // Get selected subscription product\n $subscription_product = subscriptio_get_subscription_product($selected_variation_id);\n\n // Prepare selected price for display\n $selected_display_price = wc_price(RightPress_Product_Price_Display::prepare_product_price_for_display($subscription_product->get_wc_product(), $selected_price, false, true));\n\n // Child prices differ\n if (RightPress_Product_Price::prices_differ($min_reference_price, $max_reference_price)) {\n\n // Format recurring amount for display\n $display_price = RP_SUB_Pricing::format_recurring_amount_for_display($selected_display_price, $subscription_product->get_billing_cycle_length(), $subscription_product->get_billing_cycle_period());\n\n // Apply extra formatting and set to main variable\n $display_price = sprintf(__('From %s', 'subscriptio'), $display_price);\n }\n // Child prices do not differ but other settings differ (simplified display price will be used)\n else if (count($settings_hashes) > 1) {\n\n // Format recurring amount for display\n $display_price = RP_SUB_Pricing::format_recurring_amount_for_display($selected_display_price, $subscription_product->get_billing_cycle_length(), $subscription_product->get_billing_cycle_period());\n }\n // Child prices and settings do not differ\n else {\n\n // Format subscription product display price\n $display_price = RP_SUB_Pricing::format_subscription_product_display_price($display_price, $subscription_product);\n }\n\n // Allow developers to override and set new display price\n $display_price = apply_filters('subscriptio_subscription_product_variable_formatted_price', $display_price, $subscription_product);\n }\n\n return $display_price;\n }", "private function createInputProductsPlaceHolders($inputProducts, $translations, &$args)\n\t{\n\t\t$formId = (int) $args['form']->FormId;\n\t\t$submissionId = (int) $args['submission']->SubmissionId;\n\t\t$properties = RSFormProHelper::getComponentProperties($inputProducts, false);\n\t\t$priceHelper = new Price($this->loadFormSettings($formId));\n\t\t$this->translate($properties, $translations);\n\n\t\tforeach ($inputProducts as $componentId)\n\t\t{\n\t\t\t$price = $this->getSubmissionValue($submissionId, $componentId);\n\t\t\t$data = $properties[$componentId];\n\n\t\t\t$args['placeholders'][] = '{' . $data['NAME'] . ':price}';\n\t\t\t$args['values'][] = $priceHelper->getPriceMask($data['CAPTION'], $price, ($data['CURRENCY'] ?? ''));\n\t\t\t$args['placeholders'][] = '{' . $data['NAME'] . ':amount}';\n\t\t\t$args['values'][] = $priceHelper->getAmountMask(($price ?? 0), ($data['CURRENCY'] ?? ''));\n\t\t}\n\t}", "public function prepareVars()\n {\n $this->vars['defaultCurrency'] = $this->defaultCurrency;\n $this->vars['defaultValue'] = $this->getPriceValue($this->defaultCurrency->id);\n $this->vars['currencies'] = Currency::orderBy('sort_order', 'ASC')->get();\n $this->vars['field'] = $this->formField;\n }", "public function getProductPrice(){\n return $this->product_price;\n }", "public function deserialize($param)\n {\n if ($param === null) {\n return;\n }\n if (array_key_exists(\"OriginalDiskPrice\",$param) and $param[\"OriginalDiskPrice\"] !== null) {\n $this->OriginalDiskPrice = $param[\"OriginalDiskPrice\"];\n }\n\n if (array_key_exists(\"OriginalPrice\",$param) and $param[\"OriginalPrice\"] !== null) {\n $this->OriginalPrice = $param[\"OriginalPrice\"];\n }\n\n if (array_key_exists(\"Discount\",$param) and $param[\"Discount\"] !== null) {\n $this->Discount = $param[\"Discount\"];\n }\n\n if (array_key_exists(\"DiscountPrice\",$param) and $param[\"DiscountPrice\"] !== null) {\n $this->DiscountPrice = $param[\"DiscountPrice\"];\n }\n\n if (array_key_exists(\"DetailPrices\",$param) and $param[\"DetailPrices\"] !== null) {\n $this->DetailPrices = [];\n foreach ($param[\"DetailPrices\"] as $key => $value){\n $obj = new DetailPrice();\n $obj->deserialize($value);\n array_push($this->DetailPrices, $obj);\n }\n }\n }", "public function deserialize($param)\n {\n if ($param === null) {\n return;\n }\n if (array_key_exists(\"OriginalDiskPrice\",$param) and $param[\"OriginalDiskPrice\"] !== null) {\n $this->OriginalDiskPrice = $param[\"OriginalDiskPrice\"];\n }\n\n if (array_key_exists(\"OriginalPrice\",$param) and $param[\"OriginalPrice\"] !== null) {\n $this->OriginalPrice = $param[\"OriginalPrice\"];\n }\n\n if (array_key_exists(\"Discount\",$param) and $param[\"Discount\"] !== null) {\n $this->Discount = $param[\"Discount\"];\n }\n\n if (array_key_exists(\"DiscountPrice\",$param) and $param[\"DiscountPrice\"] !== null) {\n $this->DiscountPrice = $param[\"DiscountPrice\"];\n }\n\n if (array_key_exists(\"DetailPrices\",$param) and $param[\"DetailPrices\"] !== null) {\n $this->DetailPrices = [];\n foreach ($param[\"DetailPrices\"] as $key => $value){\n $obj = new DetailPrice();\n $obj->deserialize($value);\n array_push($this->DetailPrices, $obj);\n }\n }\n }", "function generate_price($prod_arr,$row_price,$row_settings,$tax_val,$return_price_withouttax=0)\n\t{\n\t\tglobal $db,$ecom_siteid,$ecom_allpricewithtax;\n\t\t\n\t\t$webprice \t\t\t= $prod_arr['product_webprice'];\n\t\t$disc_asval\t\t\t= $prod_arr['product_discount_enteredasval'];\n\t\t$tax_before_disc\t= $row_settings['saletax_before_discount'];\n\t\t$discount\t\t\t= 0;\n\t\t\n\t\tif($prod_arr['product_discount']>0)\n\t\t{\n\t\t\tif($disc_asval==2) // For Exact Discount Price \n\t\t\t\t$discount\t= $webprice-$prod_arr['product_discount']; \t\n\t\t\telse\n\t\t\t\t$discount\t= $prod_arr['product_discount'];\n\t\t}\n\t\t//if($ecom_siteid==70 or $ecom_siteid==104) // bypassed tax calculation for nationwide fireextinguisher and discount mobility\n\t\t\n\t\tif($ecom_siteid==104) // bypassed tax calculation for discount mobility and puregusto\n\t\t\t$apply_tax = 'Y';\n\t\telse\t\n\t\t\t$apply_tax\t\t= $prod_arr['product_applytax'];\n\t\t\t\n\t\t\n\t\tif($return_price_withouttax==1)\n\t\t{\n\t\t\t$apply_tax = 'N';\n\t\t}\n\t\t\t\n\t\t/*switch($row_price['price_displaytype'])\n\t\t{\n\t\t\tcase 'show_price_only':\t\t\t\t\t\n\t\t\tcase 'show_price_plus_tax':\n\t\t\t\tif($discount>0)\n\t\t\t\t{\n\t\t\t\t\tif($disc_asval==1) // If discount is specified as value\n\t\t\t\t\t{\n\t\t\t\t\t\t$disc_price = $webprice - $discount;\n\t\t\t\t\t}\t\n\t\t\t\t\telse if($disc_asval==2) \n\t\t\t\t\t{ // For Exact Discount Price \n\t\t\t\t\t\t$disc_price\t= $webprice-$discount; \t// For Exact Discount Price \n\t\t\t\t\t}\t\n\t\t\t\t\telse // case if discount is given as percentage\n\t\t\t\t\t{\n\t\t\t\t\t\t$disc_price = $webprice - ($webprice * $discount/100);\n\t\t\t\t\t}\n\t\t\t\t}\t\n\t\t\tbreak;\n\t\t\tcase 'show_price_inc_tax': // Show price including tax\n\t\t\tcase 'show_both':*/\n\t\t\t\tif ($apply_tax=='Y' and $ecom_allpricewithtax==0)\n\t\t\t\t{\t\n\t\t\t\t\t$disc_price\t= $webprice + ($webprice * $tax_val/100);\n\t\t\t\t\t//$disc_price = sprintf('%0.2f',$disc_price);\n\t\t\t\t}\t\n\t\t\t\telse\n\t\t\t\t\t$disc_price = $webprice;\n\t\t\t\tif ($discount>0)\n\t\t\t\t{\n\t\t\t\t\tif($disc_asval==1) // If discount is specified as value\n\t\t\t\t\t{\n\t\t\t\t\t\t$disc_price \t\t\t= $webprice - $discount; // calculate the original discount\n\t\t\t\t\t\tif ($apply_tax=='Y')\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif($tax_before_disc==1)// case of apply tax before discount\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$disc_price_with_tax \t= $disc_price + ($webprice * $tax_val/100); // apply tax to it\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$disc_price_with_tax \t= $disc_price + ($disc_price * $tax_val/100); // apply tax to it\n\t\t\t\t\t\t\t}\t\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\t$disc_price_with_tax = $disc_price;\n\n\t\t\t\t\t}\t\n\t\t\t\t\telse if($disc_asval==2) // For Exact Discount Price \n\t\t\t\t\t{\n\t\t\t\t\t\t$disc_price = $webprice - $discount;\n\t\t\t\t\t\tif ($apply_tax=='Y')\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif($tax_before_disc==1)// case of apply tax before discount\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$disc_price_with_tax \t= $disc_price + ($webprice * $tax_val/100); // apply tax to it\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$disc_price_with_tax \t= $disc_price + ($disc_price * $tax_val/100); // apply tax to it\n\t\t\t\t\t\t\t}\t\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\t$disc_price_with_tax = $disc_price;\n\t\t\t\t\t}\t\n\t\t\t\t\telse // case if discount is given as percentage\n\t\t\t\t\t{\n\t\t\t\t\t\t$disc_price \t\t\t\t= $webprice - ($webprice * $discount/100);// calculate the original discount\n\t\t\t\t\t\t//$disc_price = sprintf('%0.2f',$disc_price);\n\t\t\t\t\t\tif ($apply_tax=='Y')\n\t\t\t\t\t\t{\t\t\t\t\t\t\n\t\t\t\t\t\t\tif($tax_before_disc==1)// case of apply tax before discount\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$disc_price_with_tax \t\t= $disc_price + ($webprice * $tax_val/100); // apply tax to it\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$disc_price_with_tax \t\t= $disc_price + ($disc_price * $tax_val/100); // apply tax to it\n\t\t\t\t\t\t\t}\t\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\t$disc_price_with_tax = $disc_price;\n\t\t\t\t\t}\n\t\t\t\t\t$disc_price = $disc_price_with_tax;\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t/*break;\n\t\t};\t*/\n\t\tif($disc_price>0)\n\t\t\treturn $disc_price;\n\t\telse\n\t\t\treturn $webprice;\n\t}", "public function preparePayment() {\n\n $order = $this->getOrder();\n $payment = $this->getPaymentModule();\n\n $amount = $order->getTotalAmount();\n $amount = (int) round($amount * 100);\n $orderId = $order->get(\"id\");\n\n $payment->setId($orderId);\n $payment->setCurrency($this->modules->get(\"PadCart\")->currency);\n\n $url = $this->page->httpUrl;\n $payment->setProcessUrl($url . \"process/\" . $orderId . \"/\");\n $payment->setFailureUrl($url . \"fail/\");\n $payment->setCancelUrl($url . \"cancel/\");\n\n $customer = Array();\n $customer['givenName'] = $order->pad_firstname;\n $customer['familyName'] = $order->pad_lastname;\n $customer['streetAddress'] = $order->pad_address;\n $customer['streetAddress2'] = $order->pad_address2;\n $customer['locality'] = $order->pad_city;\n $customer['postalCode'] = $order->pad_postcode;\n $customer['country'] = $order->pad_countrycode;\n $customer['email'] = $order->email;\n $payment->setCustomerData($customer);\n\n foreach ($order->pad_products as $p) {\n $amount = $p->pad_price * 100; // Amount in payment modules always in cents\n if ($this->cart->prices_without_tax) $amount = $amount + ($p->pad_tax_amount * 100 / $p->pad_quantity); // TODO: currently we have only\n $payment->addProduct($p->title, $amount, $p->pad_quantity, $p->pad_percentage, $p->pad_product_id);\n }\n }", "private function getProductsData($products_id)\n\t{\n \t$currency = Shopware()->Db()->fetchOne(\"SELECT c.currency FROM s_core_currencies c INNER JOIN s_core_shops s ON c.id = s.currency_id\"); \n\n $product = Shopware()->Modules()->Articles()->sGetArticleById($products_id);\n \n if (is_array($product[sConfigurator]))\n\t\t{\n $variants = Shopware()->Db()->fetchAll(\"SELECT \n\t\t\t\t\t\t\t\t\t\t\t\t\t\taa.id as articledetail, acg.name as groupname, aco.name as valuename, acor.option_id as optionid\n \t\t\t\t\t\t\t\tFROM s_article_configurator_option_relations acor\n \t\t\t\t\t\t\t\tINNER JOIN s_articles_details aa ON acor.article_id = aa.id\n \t\t\t\t\t\t\t\tINNER JOIN s_article_configurator_options aco ON aco.id = acor.option_id\n \t\t\t\t\t\t\t\tINNER JOIN s_article_configurator_groups acg ON acg.id = aco.group_id\n \t\t\t\t\t\t\t\tWHERE aa.articleID =\".$products_id);\n $variant_prods = array();\n\n foreach ($variants as $variantkey => $variantval)\n\t\t\t{\n $variant_prods[$variantval['articledetail']][$variantval['groupname']]=$variantval['valuename'];\n\n $images = Shopware()->Db()->fetchAll(\"SELECT \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tm.* \n \t\t\t\t\t\t\t\tFROM s_articles_img ai\n \t\t\t\t\t\t\t\tINNER JOIN s_media m ON m.id = ai.media_id\n \t\t\t\t\t\t\t\tWHERE ai.id IN (\n \t\t\t\t\t\t\t\tSELECT ai2.parent_id\n \t\t\t\t\t\t\t\tFROM s_articles_img ai2 \n \t\t\t\t\t\t\t\tWHERE ai2.article_detail_id = \".$variantval['articledetail'].\"\n \t\t\t\t\t\t\t)\");\n\t\t\t\t\n if (count($images) > 0)\n\t\t\t\t{\n foreach($images as $imagekey=>$imageval)\n\t\t\t\t\t{\n $imagepath = 'http://'.Shopware()->Shop()->getHost();\n $imagepath .= Shopware()->Shop()->getBaseUrl().'/';\n $variant_prods[$variantval['articledetail']]['image_url'] = $imagepath.$imageval['path'];\n }\n } else {\n $variant_prods[$variantval['articledetail']]['image_url'] = $product['image']['src']['original'];\n }\n }\n\n ksort($variant_prods);\n $variant_prods_array=array();\n\n foreach($variant_prods as $variantprodskey => $variantprodsval)\n\t\t\t{\n foreach($variantprodsval as $ikey => $ival)\n\t\t\t\t{\n if ($ikey != 'image_url')\n\t\t\t\t\t{\n $variant_prods_array_inner[$ikey] = $ival;\n }\n }\n $variant_prods_array_inner['image_url'] = $variantprodsval['image_url'];\n $variant_prods_array[] = $variant_prods_array_inner;\n }\n }\n\n $rewrite_path = Shopware()->Db()->fetchOne(\"SELECT path FROM s_core_rewrite_urls WHERE org_path = 'sViewport=detail&sArticle=\".$products_id.\"'\");\n \n $rewrite_url = $this->Front()->Router()->assemble(array('module' => 'frontend', 'controller' => 'index'));\n $rewrite_url .= $rewrite_path;\n\n if ($product['sUpcoming'] == 0)\n\t\t{\n if ($product['laststock'] == 1)\n\t\t\t{\n if ($product['instock'] <= 0)\n\t\t\t\t{\n $availibility = 'out of stock';\n } elseif($product['instock'] > 0) {\n $availibility = 'in stock';\n }\n\n } else {\n if ($product['instock'] <= 0)\n\t\t\t\t{\n $availibility = 'available for order';\n } elseif($product['instock'] > 0) {\n $availibility = 'in stock';\n }\n }\n } else {\n $availibility = 'preorder';\n }\n\n $prod_cats = Shopware()->Db()->fetchAll(\"SELECT categoryID FROM s_articles_categories WHERE articleID = \".$products_id);\n $prod2cats = array();\n\t\t\n foreach ($prod_cats as $catkey => $catval)\n\t\t{\n $prod2cats[] = $catval['categoryID'];\n }\n\t\t\n\t\t$price = floatval(str_replace(',','.',$product['price']));\n\t\t$pseudoprice = (isset($product['pseudoprice']) && $product['pseudoprice'] > 0) ? floatval(str_replace(',','.',$product['pseudoprice'])) : $price;\n\t\t$discout_absolute = ($pseudoprice > $price) ? ($pseudoprice - $price) : 0;\n\n $prod_shipping_array = $this->getShippingArray($product);\n $jsonproductarray = array(\n 'id' => $product['articleID'],\n 'name' => $product['articleName'],\n 'image_url' => $product['image']['src']['original'],\n 'condition' => 'new',\n 'categories' => $prod2cats,\n 'availability' => $availibility,\n 'price' => $price,\n\t\t\t'rrp' => floatval($pseudoprice),\n\t\t\t'discount_absolute' => $discout_absolute, \n 'url' => $rewrite_url,\n 'description' => $product['description_long'],\n 'currency' => $currency,\n 'shipping' => $prod_shipping_array,\n 'margin' => 0.56,\n 'gtin' => $product['ean'],\n\t\t\t'brand' => $product['supplierName'],\n\t\t\t'mpn' => $product['ordernumber']\n );\n\t\t\n if (count($variant_prods_array) > 0)\n\t\t{\n $jsonproductarray['variants'] = $variant_prods_array;\n }\n\t\t\n $products_data = $jsonproductarray;\n return $products_data;\n }", "public function restore_price_template() {\r\n\t\tadd_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 10 );\r\n\t\tremove_action( 'woocommerce_before_add_to_cart_form', array( $this, 'display_suggested_price' ) );\r\n\t}", "public function prepare($data)\n {\n $response = array('name' => $data['title']);\n \n if (!empty($data['short_description'])) {\n $response['short_description'] = $data['short_description'];\n }\n \n if (!empty($data['description'])) {\n $response['description'] = $data['description'];\n }\n \n if (!empty($data['categories'])) {\n $categories = array();\n foreach ($data['categories'] as $categoryId) {\n $categories[] = array('id' => $categoryId);\n }\n \n $response['categories'] = $categories;\n }\n \n $images = array(); $position = 0;\n foreach ($data['images'] as $image) {\n $images[] = array(\n 'src' => $image,\n 'position' => $position++\n );\n }\n $response['images'] = $images;\n\n \n $isVariable = (!empty($data['variations']));\n $response['type'] = ($isVariable) ? 'variable' : 'simple';\n \n if (!$isVariable) {\n $response['regular_price'] = $data['price_low'];\n if (!empty($data['special_price_low'])) {\n $response['sale_price'] = $data['special_price_low'];\n }\n }\n\n $attributes = $variationAttributeTitles = array(); $position = 0;\n foreach ($data['attributes'] as $attribute) {\n $attributes[] = array(\n 'name' => $attribute['title'],\n 'position' => $position++,\n 'visible' => true,\n 'options' => explode('|', $attribute['value']),\n 'variation' => ($attribute['is_variation'])\n );\n \n if ($attribute['is_variation']) {\n $variationAttributeTitles[] = $attribute['title'];\n }\n }\n $response['attributes'] = $attributes;\n \n if ($isVariable) {\n $variations = array();\n foreach ($data['variations'] as $variation) {\n $newVariation = array(\n 'regular_price' => $variation['advertised'],\n 'image' => array(\n array(\n 'src' => $variation['image'],\n 'position' => 0\n )\n )\n );\n \n if (!empty($variation['final_price'])) {\n $newVariation['sale_price'] = $variation['final_price'];\n }\n \n $attributes = array(); \n $attributeValues = explode('|', $variation['name']);\n foreach ($variationAttributeTitles as $key => $variationAttributeTitle) {\n $attributes[] = array(\n 'name' => $variationAttributeTitle,\n 'option' => $attributeValues[$key]\n );\n }\n \n $newVariation['attributes'] = $attributes;\n $variations[] = $newVariation;\n }\n \n $response['variations'] = $variations;\n }\n \n return $response;\n }", "protected function _getCatalogProductPriceData($productIds = null)\n {\n $connection = $this->getConnection();\n $catalogProductIndexPriceSelect = [];\n\n foreach ($this->dimensionCollectionFactory->create() as $dimensions) {\n if (!isset($dimensions[WebsiteDimensionProvider::DIMENSION_NAME]) ||\n $this->websiteId === null ||\n $dimensions[WebsiteDimensionProvider::DIMENSION_NAME]->getValue() === $this->websiteId) {\n $select = $connection->select()->from(\n $this->tableResolver->resolve('catalog_product_index_price', $dimensions),\n ['entity_id', 'customer_group_id', 'website_id', 'min_price']\n );\n if ($productIds) {\n $select->where('entity_id IN (?)', $productIds);\n }\n $catalogProductIndexPriceSelect[] = $select;\n }\n }\n\n $catalogProductIndexPriceUnionSelect = $connection->select()->union($catalogProductIndexPriceSelect);\n\n $result = [];\n foreach ($connection->fetchAll($catalogProductIndexPriceUnionSelect) as $row) {\n $result[$row['website_id']][$row['entity_id']][$row['customer_group_id']] = round($row['min_price'], 2);\n }\n\n return $result;\n }", "public function productAmazonPriceIsZero( $thisProd ) {\n\t\t\t$multiply_factor = ($this->amz_settings[\"country\"] == 'co.jp') ? 1 : 0.01;\n \n\t\t\t$price_setup = (isset($this->amz_settings[\"price_setup\"]) && $this->amz_settings[\"price_setup\"] == 'amazon_or_sellers' ? 'amazon_or_sellers' : 'only_amazon');\n\t\t\t//$offers_from = ( $price_setup == 'only_amazon' ? 'Amazon' : 'All' );\n\t\t\t\n $prodprice = array('regular_price' => '');\n \n\t\t\t// list price\n\t\t\t$offers = array(\n\t\t\t\t'ListPrice' => isset($thisProd['ItemAttributes']['ListPrice']['Amount']) ? ($thisProd['ItemAttributes']['ListPrice']['Amount'] * $multiply_factor ) : '',\n\t\t\t\t'LowestNewPrice' => isset($thisProd['Offers']['Offer']['OfferListing']['Price']['Amount']) ? ($thisProd['Offers']['Offer']['OfferListing']['Price']['Amount'] * $multiply_factor) : '',\n\t\t\t\t'Offers'\t=> isset($thisProd['Offers']) ? $thisProd['Offers'] : array()\n\t\t\t);\n \n\t\t\tif( $price_setup == 'amazon_or_sellers' && isset($thisProd['OfferSummary']['LowestNewPrice']['Amount']) ) {\n\t\t\t\t$offers['LowestNewPrice'] = ($thisProd['OfferSummary']['LowestNewPrice']['Amount'] * $multiply_factor);\n\t\t\t}\n\n\t\t\t$prodprice['regular_price'] = $offers['ListPrice'];\n\n\t\t\t// if regular price is empty setup offer price as regular price\n\t\t\tif( \n\t\t\t\t(!isset($offers['ListPrice']) || (float)$offers['ListPrice'] == 0.00)\n\t\t\t\t|| (isset($offers['ListPrice']) && $offers['LowestNewPrice'] > $offers['ListPrice'])\n\t\t\t) {\n\t\t\t\t$prodprice['regular_price'] = $offers['LowestNewPrice'];\n\t\t\t}\n\n\t\t\t// if still don't have any regular price, try to get from VariationSummary (ex: Apparel category)\n\t\t\tif( !isset($prodprice['regular_price']) || (float)$prodprice['regular_price'] == 0.00 ) {\n\t\t\t\t$prodprice['regular_price'] = isset($thisProd['VariationSummary']['LowestPrice']['Amount']) ? ( $thisProd['VariationSummary']['LowestPrice']['Amount'] * $multiply_factor ) : '';\n\t\t\t}\n \n\t\t\tif ( empty($prodprice['regular_price']) || (float)$prodprice['regular_price'] <= 0.00 ) return true;\n\t\t\treturn false;\n\t\t}", "private function get_posted_pricing() {\n $post_data = wp_unslash( $_POST ); // phpcs:ignore\n\n $pricing = array();\n $row_size = isset( $post_data['wc_booking_pricing_type'] ) ? count( $post_data['wc_booking_pricing_type'] ) : 0;\n for ( $i = 0; $i < $row_size; $i ++ ) {\n $pricing[ $i ]['type'] = wc_clean( $post_data['wc_booking_pricing_type'][ $i ] );\n $pricing[ $i ]['cost'] = wc_clean( $post_data['wc_booking_pricing_cost'][ $i ] );\n $pricing[ $i ]['modifier'] = wc_clean( $post_data['wc_booking_pricing_cost_modifier'][ $i ] );\n $pricing[ $i ]['base_cost'] = wc_clean( $post_data['wc_booking_pricing_base_cost'][ $i ] );\n $pricing[ $i ]['base_modifier'] = wc_clean( $post_data['wc_booking_pricing_base_cost_modifier'][ $i ] );\n\n switch ( $pricing[ $i ]['type'] ) {\n case 'custom':\n $pricing[ $i ]['from'] = wc_clean( $post_data['wc_booking_pricing_from_date'][ $i ] );\n $pricing[ $i ]['to'] = wc_clean( $post_data['wc_booking_pricing_to_date'][ $i ] );\n break;\n case 'months':\n $pricing[ $i ]['from'] = wc_clean( $post_data['wc_booking_pricing_from_month'][ $i ] );\n $pricing[ $i ]['to'] = wc_clean( $post_data['wc_booking_pricing_to_month'][ $i ] );\n break;\n case 'weeks':\n $pricing[ $i ]['from'] = wc_clean( $post_data['wc_booking_pricing_from_week'][ $i ] );\n $pricing[ $i ]['to'] = wc_clean( $post_data['wc_booking_pricing_to_week'][ $i ] );\n break;\n case 'days':\n $pricing[ $i ]['from'] = wc_clean( $post_data['wc_booking_pricing_from_day_of_week'][ $i ] );\n $pricing[ $i ]['to'] = wc_clean( $post_data['wc_booking_pricing_to_day_of_week'][ $i ] );\n break;\n case 'time':\n case 'time:1':\n case 'time:2':\n case 'time:3':\n case 'time:4':\n case 'time:5':\n case 'time:6':\n case 'time:7':\n $pricing[ $i ]['from'] = wc_booking_sanitize_time( $post_data['wc_booking_pricing_from_time'][ $i ] );\n $pricing[ $i ]['to'] = wc_booking_sanitize_time( $post_data['wc_booking_pricing_to_time'][ $i ] );\n break;\n case 'time:range':\n $pricing[ $i ]['from'] = wc_booking_sanitize_time( $post_data['wc_booking_pricing_from_time'][ $i ] );\n $pricing[ $i ]['to'] = wc_booking_sanitize_time( $post_data['wc_booking_pricing_to_time'][ $i ] );\n\n $pricing[ $i ]['from_date'] = wc_clean( $post_data['wc_booking_pricing_from_date'][ $i ] );\n $pricing[ $i ]['to_date'] = wc_clean( $post_data['wc_booking_pricing_to_date'][ $i ] );\n break;\n default:\n $pricing[ $i ]['from'] = wc_clean( $post_data['wc_booking_pricing_from'][ $i ] );\n $pricing[ $i ]['to'] = wc_clean( $post_data['wc_booking_pricing_to'][ $i ] );\n break;\n }\n }\n return $pricing;\n }", "public function pricing() { \n $data['page'] = 'Pricing';\n $data['page_title'] = 'Pricing';\n $data['page_module'] = 'setting';\n $price_list= $this->Setting_Model-> getPurchaseTransactionById($this->session->userdata('user_id'));\n for($i=0;$i<count($price_list);$i++){\n\t\t\tif($price_list[$i]->stock_group_id == 3){\n\t\t\t\tif($price_list[$i]->category_id == 13){\n\t\t\t\t\t$price_list[$i]->product_name = $this->Masterdata_Model->getFarmImplementsModelById($price_list[$i]->sub_category_id, $price_list[$i]->product_id)->name.\" - \".$price_list[$i]->classification;\n\t\t\t\t} else {\n\t\t\t\t\t$price_list[$i]->product_name = $this->Masterdata_Model->getProductByCategoryAndSubcategory($price_list[$i]->category_id, $price_list[$i]->sub_category_id, $price_list[$i]->product_id)->name.\" - \".$price_list[$i]->classification;\n\t\t\t\t}\t\t\t\t\n\t\t\t} else if($price_list[$i]->stock_group_id == 2){\n $price_list[$i]->product_name = $this->Masterdata_Model->cropNameById($price_list[$i]->category_id, $price_list[$i]->sub_category_id, $price_list[$i]->product_id)->name.\" - \".$price_list[$i]->classification;\n\t\t\t} else {\t\t\t\t\t\t\t\t\n\t\t\t\tif($price_list[$i]->category_id == 3 || $price_list[$i]->category_id == 4 || $price_list[$i]->category_id == 5){\n\t\t\t\t\t$price_list[$i]->product_name = $this->Masterdata_Model->brandListBySuppliersById($price_list[$i]->category_id, $price_list[$i]->sub_category_id, $price_list[$i]->product_id)->name.\" - \".$price_list[$i]->classification;\n\t\t\t\t} else {\n\t\t\t\t\t$price_list[$i]->product_name = $this->Masterdata_Model->getProductByCategoryAndSubcategory($price_list[$i]->category_id, $price_list[$i]->sub_category_id, $price_list[$i]->product_id)->name.\" - \".$price_list[$i]->classification;\n\t\t\t\t}\t\t\t\t\n\t\t\t}\n\t\t}\n $data['price_list']=$price_list;\n $this->load->view('setting/pricinglist', $data); \t \n\t}", "public function computePriceProvider(){\n\n /*Price once a child is < 4 years full day 0€*/\n yield [Booking::TYPE_DAY, '2019-01-01' , false, 0];\n /*Price once a child is < 4 years full day \"reduce\" 0€*/\n yield [Booking::TYPE_DAY, '2019-01-01', true, 0];\n /*Price once a child is < 4 years half day 0€*/\n yield [Booking::TYPE_HALF_DAY, '2019-01-01', false, 0];\n /*Price once a child is < 4 years half day \"reduce\" 0€*/\n yield [Booking::TYPE_HALF_DAY, '2019-01-01', true, 0];\n\n\n /*Price once a child is 4 - 12 years full day 8€*/\n yield [Booking::TYPE_DAY, '2014-01-01', false, 8];\n /*Price once a child is 4 - 12 years full day \"reduce\" 8€*/\n yield [Booking::TYPE_DAY, '2014-01-01', true, 8];\n /*Price once a child is 4 - 12 years half day 4€*/\n yield [Booking::TYPE_HALF_DAY, '2014-01-01', false, 4];\n /*Price once a child is 4 - 12 years half day \"reduce\" 4€*/\n yield [Booking::TYPE_HALF_DAY, '2014-01-01', true, 4];\n\n\n /*Price normal full day 16€*/\n yield [Booking::TYPE_DAY, '1980-01-01', false, 16];\n /*Price normal full day \"reduce\" 10€*/\n yield [Booking::TYPE_DAY, '1980-01-01', true, 10];\n /*Price normal half day 8€*/\n yield [Booking::TYPE_HALF_DAY, '1980-01-01', false, 8];\n /*Price normal half day \"reduce\" 5€*/\n yield [Booking::TYPE_HALF_DAY, '1980-01-01', true, 5];\n\n\n /*Price senior >60 years full day 12€*/\n yield [Booking::TYPE_DAY, '1955-01-01', false, 12];\n /*Price senior >60 years full day \"reduce\" 10€*/\n yield [Booking::TYPE_DAY, '1955-01-01', true, 10];\n /*Price senior >60 years half day 6€*/\n yield [Booking::TYPE_HALF_DAY, '1955-01-01', false, 6];\n /*Price senior >60 years half day \"reduce\" 5€*/\n yield [Booking::TYPE_HALF_DAY, '1955-01-01', true, 5];\n\n }", "function setItem_price($price){\n $this->item_price = $price;\n }", "public function getComparePrice($productId) {\n $productCollection = Mage::getModel ( static::CAT_PRO )->getCollection ()->addAttributeToSelect ( '*' )->addAttributeToFilter ( 'is_assign_product', array (\n 'eq' => 1 \n ) )->addAttributeToFilter ( static::STATUS, array (\n 'eq' => Mage_Catalog_Model_Product_Status::STATUS_ENABLED \n ) );\n \n $productCollection->addFieldToFilter ( 'assign_product_id', array (\n 'eq' => $productId \n ) );\n $productCollection->setOrder ( 'price', 'ASC' );\n return $productCollection;\n }", "public function save($data)\n {\n /* Prices */\n $data['price_low'] = preg_replace(\"/[^0-9\\.]/\", \"\", $data['price_low']);\n $data['special_price_low'] = preg_replace(\"/[^0-9\\.]/\", \"\", $data['special_price_low']);\n\n /* Attributes */\n $attributes = array();\n foreach ($data['attributes']['title'] as $key => $title) {\n $attributes[] = array(\n 'title' => str_replace('\"', '\\\"', $title),\n 'value' => str_replace('\"', '\\\"', $data['attributes']['value'][$key]),\n 'is_variation' => ($data['attributes']['is_variation'][$key] === 'on')\n );\n }\n\n $data['attributes'] = $attributes;\n\n /* Variations */\n if (!empty($data['variations'])) {\n $variations = array();\n foreach ($data['variations']['name'] as $key => $name) {\n $variations[] = array(\n 'name' => str_replace('\"', '\\\"', $name),\n 'available_quantity' => $data['variations']['available_quantity'][$key],\n 'price' => $data['variations']['price'][$key],\n 'special_price' => $data['variations']['special_price'][$key],\n 'advertised' => $data['variations']['advertised'][$key],\n 'final_price' => $data['variations']['final_price'][$key],\n 'image' => $data['variations']['image'][$key]\n );\n }\n\n $data['variations'] = $variations;\n }\n \n $data['short_description'] = str_replace('\"', '\\\"', $data['short_description']);\n $data['description'] = str_replace('\"', '\\\"', $data['description']);\n $data['short_description'] = str_replace(PHP_EOL, '<br />', $data['short_description']);\n $data['description'] = str_replace(PHP_EOL, '<br />', $data['description']);\n \n $productId = $data['product_id'];\n $dataJson = str_replace(\"'\", \"\\'\", json_encode($data));\n \n $query = \"UPDATE products SET processed_data = '{$dataJson}', last_status_change = NOW() WHERE id = {$productId}\";\n $this->query($query);\n\n $errors = $this->getLastError();\n if ($errors) {\n die($errors);\n }\n \n return $this;\n }", "public function catalog_product_save_after($observer)\n {\n $_product = $observer->getProduct();\n $specialPrice = null;\n\n if($_product->getTypeId() == 'grouped') {\n $arrayPrices = array();\n\n $associatedProducts = $_product->getTypeInstance(true)->getAssociatedProducts($_product);\n foreach($associatedProducts as $associatedProduct) {\n $arrayPrices[] = round($associatedProduct->getPrice(), 2);\n }\n asort($arrayPrices);\n $price = array_shift($arrayPrices);\n } else {\n if($_product->getTypeId() == 'bundle') {\n //Zend_Debug::dump($_product->getData());exit;\n $selectionCollection = $_product->getTypeInstance(true)->getSelectionsCollection(\n $_product->getTypeInstance(true)->getOptionsIds($_product), $_product\n );\n\n foreach($selectionCollection as $option) {\n $bundled_prices[]=$option->getPrice();\n }\n\n sort($bundled_prices);\n\n $min_price=$bundled_prices[0];\n $price = $min_price;\n } else {\n $price = $_product->getData('price');\n $specialPrice = $_product->getData('special_price');\n }\n\n }\n\n\n if ($specialPrice != null) {\n $santanderPriceMonth = Mage::helper('santander')->getPricePerMonth($specialPrice);\n } else {\n $santanderPriceMonth = Mage::helper('santander')->getPricePerMonth($price);\n }\n Mage::getSingleton('catalog/product_action')->updateAttributes(array($_product->getEntityId()), array('santanderpricemonth' => \"$santanderPriceMonth\"), 1);\n }", "protected function _saveProducts()\n {\n $priceIsGlobal = $this->_catalogData->isPriceGlobal();\n $productLimit = null;\n $productsQty = null;\n $entityLinkField = $this->getProductEntityLinkField();\n\n while ($bunch = $this->_dataSourceModel->getNextBunch()) {\n $entityRowsIn = [];\n $entityRowsUp = [];\n $attributes = [];\n $this->websitesCache = [];\n $this->categoriesCache = [];\n $tierPrices = [];\n $mediaGallery = [];\n $labelsForUpdate = [];\n $imagesForChangeVisibility = [];\n $uploadedImages = [];\n $previousType = null;\n $prevAttributeSet = null;\n $existingImages = $this->getExistingImages($bunch);\n\n foreach ($bunch as $rowNum => $rowData) {\n // reset category processor's failed categories array\n $this->categoryProcessor->clearFailedCategories();\n\n if (!$this->validateRow($rowData, $rowNum)) {\n continue;\n }\n if ($this->getErrorAggregator()->hasToBeTerminated()) {\n $this->getErrorAggregator()->addRowToSkip($rowNum);\n continue;\n }\n $rowScope = $this->getRowScope($rowData);\n\n $rowData[self::URL_KEY] = $this->getUrlKey($rowData);\n\n $rowSku = $rowData[self::COL_SKU];\n\n if (null === $rowSku) {\n $this->getErrorAggregator()->addRowToSkip($rowNum);\n continue;\n } elseif (self::SCOPE_STORE == $rowScope) {\n // set necessary data from SCOPE_DEFAULT row\n $rowData[self::COL_TYPE] = $this->skuProcessor->getNewSku($rowSku)['type_id'];\n $rowData['attribute_set_id'] = $this->skuProcessor->getNewSku($rowSku)['attr_set_id'];\n $rowData[self::COL_ATTR_SET] = $this->skuProcessor->getNewSku($rowSku)['attr_set_code'];\n }\n\n // 1. Entity phase\n if ($this->isSkuExist($rowSku)) {\n // existing row\n if (isset($rowData['attribute_set_code'])) {\n $attributeSetId = $this->catalogConfig->getAttributeSetId(\n $this->getEntityTypeId(),\n $rowData['attribute_set_code']\n );\n\n // wrong attribute_set_code was received\n if (!$attributeSetId) {\n throw new LocalizedException(\n __(\n 'Wrong attribute set code \"%1\", please correct it and try again.',\n $rowData['attribute_set_code']\n )\n );\n }\n } else {\n $attributeSetId = $this->skuProcessor->getNewSku($rowSku)['attr_set_id'];\n }\n\n $entityRowsUp[] = [\n 'updated_at' => (new \\DateTime())->format(DateTime::DATETIME_PHP_FORMAT),\n 'attribute_set_id' => $attributeSetId,\n $entityLinkField => $this->getExistingSku($rowSku)[$entityLinkField]\n ];\n } else {\n if (!$productLimit || $productsQty < $productLimit) {\n $entityRowsIn[strtolower($rowSku)] = [\n 'attribute_set_id' => $this->skuProcessor->getNewSku($rowSku)['attr_set_id'],\n 'type_id' => $this->skuProcessor->getNewSku($rowSku)['type_id'],\n 'sku' => $rowSku,\n 'has_options' => isset($rowData['has_options']) ? $rowData['has_options'] : 0,\n 'created_at' => (new \\DateTime())->format(DateTime::DATETIME_PHP_FORMAT),\n 'updated_at' => (new \\DateTime())->format(DateTime::DATETIME_PHP_FORMAT),\n ];\n $productsQty++;\n } else {\n $rowSku = null;\n // sign for child rows to be skipped\n $this->getErrorAggregator()->addRowToSkip($rowNum);\n continue;\n }\n }\n\n if (!array_key_exists($rowSku, $this->websitesCache)) {\n $this->websitesCache[$rowSku] = [];\n }\n // 2. Product-to-Website phase\n if (!empty($rowData[self::COL_PRODUCT_WEBSITES])) {\n $websiteCodes = explode($this->getMultipleValueSeparator(), $rowData[self::COL_PRODUCT_WEBSITES]);\n foreach ($websiteCodes as $websiteCode) {\n $websiteId = $this->storeResolver->getWebsiteCodeToId($websiteCode);\n $this->websitesCache[$rowSku][$websiteId] = true;\n }\n }\n\n // 3. Categories phase\n if (!array_key_exists($rowSku, $this->categoriesCache)) {\n $this->categoriesCache[$rowSku] = [];\n }\n $rowData['rowNum'] = $rowNum;\n $categoryIds = $this->processRowCategories($rowData);\n foreach ($categoryIds as $id) {\n $this->categoriesCache[$rowSku][$id] = true;\n }\n unset($rowData['rowNum']);\n\n // 4.1. Tier prices phase\n if (!empty($rowData['_tier_price_website'])) {\n $tierPrices[$rowSku][] = [\n 'all_groups' => $rowData['_tier_price_customer_group'] == self::VALUE_ALL,\n 'customer_group_id' => $rowData['_tier_price_customer_group'] ==\n self::VALUE_ALL ? 0 : $rowData['_tier_price_customer_group'],\n 'qty' => $rowData['_tier_price_qty'],\n 'value' => $rowData['_tier_price_price'],\n 'website_id' => self::VALUE_ALL == $rowData['_tier_price_website'] ||\n $priceIsGlobal ? 0 : $this->storeResolver->getWebsiteCodeToId($rowData['_tier_price_website']),\n ];\n }\n\n if (!$this->validateRow($rowData, $rowNum)) {\n continue;\n }\n\n // 5. Media gallery phase\n list($rowImages, $rowLabels) = $this->getImagesFromRow($rowData);\n $storeId = !empty($rowData[self::COL_STORE])\n ? $this->getStoreIdByCode($rowData[self::COL_STORE])\n : Store::DEFAULT_STORE_ID;\n $imageHiddenStates = $this->getImagesHiddenStates($rowData);\n foreach (array_keys($imageHiddenStates) as $image) {\n if (array_key_exists($rowSku, $existingImages)\n && array_key_exists($image, $existingImages[$rowSku])\n ) {\n $rowImages[self::COL_MEDIA_IMAGE][] = $image;\n $uploadedImages[$image] = $image;\n }\n\n if (empty($rowImages)) {\n $rowImages[self::COL_MEDIA_IMAGE][] = $image;\n }\n }\n\n $rowData[self::COL_MEDIA_IMAGE] = [];\n\n /*\n * Note: to avoid problems with undefined sorting, the value of media gallery items positions\n * must be unique in scope of one product.\n */\n $position = 0;\n foreach ($rowImages as $column => $columnImages) {\n foreach ($columnImages as $columnImageKey => $columnImage) {\n if (!isset($uploadedImages[$columnImage])) {\n $uploadedFile = $this->uploadMediaFiles($columnImage);\n $uploadedFile = $uploadedFile ?: $this->getSystemFile($columnImage);\n if ($uploadedFile) {\n $uploadedImages[$columnImage] = $uploadedFile;\n } else {\n $this->addRowError(\n ValidatorInterface::ERROR_MEDIA_URL_NOT_ACCESSIBLE,\n $rowNum,\n null,\n null,\n ProcessingError::ERROR_LEVEL_NOT_CRITICAL\n );\n }\n } else {\n $uploadedFile = $uploadedImages[$columnImage];\n }\n\n if ($uploadedFile && $column !== self::COL_MEDIA_IMAGE) {\n $rowData[$column] = $uploadedFile;\n }\n\n if ($uploadedFile && !isset($mediaGallery[$storeId][$rowSku][$uploadedFile])) {\n if (isset($existingImages[$rowSku][$uploadedFile])) {\n $currentFileData = $existingImages[$rowSku][$uploadedFile];\n if (isset($rowLabels[$column][$columnImageKey])\n && $rowLabels[$column][$columnImageKey] !=\n $currentFileData['label']\n ) {\n $labelsForUpdate[] = [\n 'label' => $rowLabels[$column][$columnImageKey],\n 'imageData' => $currentFileData\n ];\n }\n\n if (array_key_exists($uploadedFile, $imageHiddenStates)\n && $currentFileData['disabled'] != $imageHiddenStates[$uploadedFile]\n ) {\n $imagesForChangeVisibility[] = [\n 'disabled' => $imageHiddenStates[$uploadedFile],\n 'imageData' => $currentFileData\n ];\n }\n } else {\n if ($column == self::COL_MEDIA_IMAGE) {\n $rowData[$column][] = $uploadedFile;\n }\n $mediaGallery[$storeId][$rowSku][$uploadedFile] = [\n 'attribute_id' => $this->getMediaGalleryAttributeId(),\n 'label' => isset($rowLabels[$column][$columnImageKey])\n ? $rowLabels[$column][$columnImageKey]\n : '',\n 'position' => ++$position,\n 'disabled' => isset($imageHiddenStates[$columnImage])\n ? $imageHiddenStates[$columnImage] : '0',\n 'value' => $uploadedFile,\n ];\n }\n }\n }\n }\n\n // 6. Attributes phase\n $rowStore = (self::SCOPE_STORE == $rowScope)\n ? $this->storeResolver->getStoreCodeToId($rowData[self::COL_STORE])\n : 0;\n $productType = isset($rowData[self::COL_TYPE]) ? $rowData[self::COL_TYPE] : null;\n if ($productType !== null) {\n $previousType = $productType;\n }\n if (isset($rowData[self::COL_ATTR_SET])) {\n $prevAttributeSet = $rowData[self::COL_ATTR_SET];\n }\n if (self::SCOPE_NULL == $rowScope) {\n // for multiselect attributes only\n if ($prevAttributeSet !== null) {\n $rowData[self::COL_ATTR_SET] = $prevAttributeSet;\n }\n if ($productType === null && $previousType !== null) {\n $productType = $previousType;\n }\n if ($productType === null) {\n continue;\n }\n }\n\n $productTypeModel = $this->_productTypeModels[$productType];\n if (!empty($rowData['tax_class_name'])) {\n $rowData['tax_class_id'] =\n $this->taxClassProcessor->upsertTaxClass($rowData['tax_class_name'], $productTypeModel);\n }\n\n if ($this->getBehavior() == Import::BEHAVIOR_APPEND ||\n empty($rowData[self::COL_SKU])\n ) {\n $rowData = $productTypeModel->clearEmptyData($rowData);\n }\n\n $rowData = $productTypeModel->prepareAttributesWithDefaultValueForSave(\n $rowData,\n !$this->isSkuExist($rowSku)\n );\n $product = $this->_proxyProdFactory->create(['data' => $rowData]);\n\n foreach ($rowData as $attrCode => $attrValue) {\n $attribute = $this->retrieveAttributeByCode($attrCode);\n\n if ('multiselect' != $attribute->getFrontendInput() && self::SCOPE_NULL == $rowScope) {\n // skip attribute processing for SCOPE_NULL rows\n continue;\n }\n $attrId = $attribute->getId();\n $backModel = $attribute->getBackendModel();\n $attrTable = $attribute->getBackend()->getTable();\n $storeIds = [0];\n\n if ('datetime' == $attribute->getBackendType()\n && (\n in_array($attribute->getAttributeCode(), $this->dateAttrCodes)\n || $attribute->getIsUserDefined()\n )\n ) {\n $attrValue = $this->dateTime->formatDate($attrValue, false);\n } elseif ('datetime' == $attribute->getBackendType() && strtotime($attrValue)) {\n $attrValue = gmdate(\n 'Y-m-d H:i:s',\n $this->_localeDate->date($attrValue)->getTimestamp()\n );\n } elseif ($backModel) {\n $attribute->getBackend()->beforeSave($product);\n $attrValue = $product->getData($attribute->getAttributeCode());\n }\n if (self::SCOPE_STORE == $rowScope) {\n if (self::SCOPE_WEBSITE == $attribute->getIsGlobal()) {\n // check website defaults already set\n if (!isset($attributes[$attrTable][$rowSku][$attrId][$rowStore])) {\n $storeIds = $this->storeResolver->getStoreIdToWebsiteStoreIds($rowStore);\n }\n } elseif (self::SCOPE_STORE == $attribute->getIsGlobal()) {\n $storeIds = [$rowStore];\n }\n if (!$this->isSkuExist($rowSku)) {\n $storeIds[] = 0;\n }\n }\n foreach ($storeIds as $storeId) {\n if (!isset($attributes[$attrTable][$rowSku][$attrId][$storeId])) {\n $attributes[$attrTable][$rowSku][$attrId][$storeId] = $attrValue;\n }\n }\n // restore 'backend_model' to avoid 'default' setting\n $attribute->setBackendModel($backModel);\n }\n }\n\n foreach ($bunch as $rowNum => $rowData) {\n if ($this->getErrorAggregator()->isRowInvalid($rowNum)) {\n unset($bunch[$rowNum]);\n }\n }\n\n $this->saveProductEntity(\n $entityRowsIn,\n $entityRowsUp\n )->_saveProductWebsites(\n $this->websitesCache\n )->_saveProductCategories(\n $this->categoriesCache\n )->_saveProductTierPrices(\n $tierPrices\n )->_saveMediaGallery(\n $mediaGallery\n )->_saveProductAttributes(\n $attributes\n )->updateMediaGalleryVisibility(\n $imagesForChangeVisibility\n )->updateMediaGalleryLabels(\n $labelsForUpdate\n );\n\n $this->_eventManager->dispatch(\n 'catalog_product_import_bunch_save_after',\n ['adapter' => $this, 'bunch' => $bunch]\n );\n }\n\n return $this;\n }", "private static function initAvailableProduct($rule, $sku_id, $params = array())\n {\n if (!isset(self::$available_products[$sku_id][$rule['id']]) || (isset(self::$available_products[$sku_id][$rule['id']]) && !isset(self::$available_products[$sku_id][$rule['id']]['quantity']))) {\n self::$available_products[$sku_id][$rule['id']] = array(\n 'quantity' => 0,\n 'discount' => 0,\n 'affiliate' => 0,\n );\n // Если у данного товара не было скидок, и мы были вынуждены проверить его из-за опции \n // \"Отображать доступные скидки для товаров, которые удовлетворяют условиям\", ставим флаг, что для данного товара можно не просчитывать\n // скидки. Вывод скидок следует регулировать в типах отображения\n if (!empty($params['prod_meet_cond'])) {\n self::$available_products[$sku_id][$rule['id']]['without_discount'] = 1;\n }\n }\n self::$available_products[$sku_id][$rule['id']]['rule'] = array(\n \"id\" => $rule['id'],\n \"sort\" => $rule['frontend_sort'],\n \"name\" => $rule['name'] ? $rule['name'] : _wp(\"Discount #\") . $rule['id'],\n \"description\" => $rule['description'] ? $rule['description'] : '',\n \"code\" => $rule['code'],\n \"discount\" => !empty($rule['discount']) ? shop_currency($rule['discount'], !empty($rule['discount_currency']) ? $rule['discount_currency'] : wa('shop')->getConfig()->getCurrency(true), wa('shop')->getConfig()->getCurrency(false), false) : 0,\n \"discount_percentage\" => !empty($rule['discount_percentage']) ? $rule['discount_percentage'] : 0,\n \"affiliate\" => !empty($rule['affiliate']) ? $rule['affiliate'] : 0,\n \"affiliate_percentage\" => !empty($rule['affiliate_percentage']) ? $rule['affiliate_percentage'] : 0\n );\n }", "public function replace_price_template() {\r\n\t\tglobal $product;\r\n\t\tif ( WC_Name_Your_Price_Helpers::is_nyp( $product ) && has_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price' ) ) {\r\n\r\n\t\t\t// Move price template to before NYP input.\r\n\t\t\tremove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 10 );\r\n\t\t\tadd_action( 'woocommerce_before_add_to_cart_form', array( $this, 'display_suggested_price' ) );\r\n\r\n\t\t\t// Restore price template to original.\r\n\t\t\tadd_action( 'woocommerce_after_single_product', array( $this, 'restore_price_template' ) );\r\n\r\n\t\t}\r\n\t}", "public function calculatePrices(): void\n {\n $orders = ServiceContainer::orders();\n $pizzaPrice = $orders->calculatePizzaPrice($this->items);\n $deliveryPrice = $orders->calculateDeliveryPrice($pizzaPrice, $this->outside, $this->currency);\n $this->delivery_price = $deliveryPrice;\n $this->total_price = $pizzaPrice + $deliveryPrice;\n }", "protected function _prepareCollection()\n {\n $collection = Mage::getModel('catalog/product')->getCollection()\n ->addAttributeToSelect('name')\n ->addAttributeToSelect('type')\n ->addAttributeToSelect('status')\n ->addAttributeToSelect('visibility')\n ->addAttributeToSelect('sku');\n $this->setCollection($collection);\n return parent::_prepareCollection();\n }" ]
[ "0.66327137", "0.6289904", "0.61399704", "0.6037695", "0.6010517", "0.5978512", "0.59717405", "0.59558374", "0.5904189", "0.5900551", "0.5895005", "0.58685875", "0.5835748", "0.58270043", "0.5826729", "0.5821465", "0.5806658", "0.57961226", "0.5717973", "0.5709714", "0.567082", "0.5668282", "0.5667775", "0.56613076", "0.5653714", "0.56416357", "0.56345683", "0.5631237", "0.5602208", "0.5598897", "0.55726415", "0.5551773", "0.5536852", "0.5532625", "0.5532625", "0.55319005", "0.5531819", "0.55266947", "0.55266255", "0.5519711", "0.55091023", "0.5506239", "0.54742664", "0.543552", "0.5426689", "0.54264075", "0.5426106", "0.5421515", "0.54102", "0.54062533", "0.53945637", "0.5386586", "0.53805226", "0.5375054", "0.5367171", "0.5362849", "0.5355203", "0.53520083", "0.5350689", "0.53406954", "0.53299934", "0.5329186", "0.53210735", "0.5319409", "0.53177595", "0.5316053", "0.53138936", "0.5305377", "0.53001076", "0.5300024", "0.5289212", "0.52857447", "0.5281642", "0.5279572", "0.527469", "0.5272738", "0.5269986", "0.5269355", "0.5268918", "0.5266424", "0.5266424", "0.5261049", "0.52507216", "0.5244135", "0.52351165", "0.5234549", "0.52329606", "0.52279025", "0.5227618", "0.5222333", "0.52209103", "0.5217678", "0.5217651", "0.52157587", "0.5208507", "0.5208095", "0.52071655", "0.5205748", "0.52039534", "0.519785" ]
0.53760904
53
Display a listing of the resource.
public function index(){ return view('events'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function indexAction()\n {\n $limit = $this->Request()->getParam('limit', 1000);\n $offset = $this->Request()->getParam('start', 0);\n $sort = $this->Request()->getParam('sort', array());\n $filter = $this->Request()->getParam('filter', array());\n\n $result = $this->resource->getList($offset, $limit, $filter, $sort);\n\n $this->View()->assign($result);\n $this->View()->assign('success', true);\n }", "public function listing();", "function index() {\n\t\t$this->show_list();\n\t}", "public function actionList() {\n $this->_getList();\n }", "public function listAction()\n {\n $model = $this->_getPhotoModel();\n $entries = $model->fetchEntries($this->_getParam('page', 1));\n\n $this->view->url = 'http://' . $this->_request->getHttpHost() . $this->_request->getBaseUrl(); \n $this->view->paginator = $entries;\n }", "public function index()\n {\n $items = Item::all();\n return ItemForShowResource::collection($items);\n }", "public function index()\n {\n return Resource::collection(($this->getModel())::paginate(10));\n }", "function index()\n\t{\n\t\t$this->_list();\n\t\t$this->display();\n\t}", "public function listingAction(){\n if (!LoginHelper::isAdmin()){\n Router::redirect('home', '<p class=\"alert alert-danger\">Unauthorized</p>');\n }\n $this->view->render('patient/list', Patient::all());\n }", "public function index()\n {\n //\n $list = $this->obj->all();\n\n return $this->render('index', compact('list'));\n }", "public function action_index()\n\t{\n\t\t$this->template->title = 'Resources';\n\t\t$this->view = View::factory('admin/resource/index');\n\t\t$this->template->scripts[] = 'media/js/jquery.tablesorter.min.js';\n\t\t$this->template->scripts[] = 'media/js/admin/resource.js';\n\t\t\n\t\t$resources = Sprig::factory('resource')->load(NULL, FALSE);\n\t\tif (!empty($resources))\n\t\t{\n\t\t\t$this->view->resources = $resources->as_array();\n\t\t}\n\t}", "function listing()\n\t\t{\n\t\t// en $this->_view->_listado para poder acceder a el desde la vista.\n\t\t\t$this->_view->_listado = $listado = $this->_instrumentoModel->getInstrumento();\n\t\t\t$this->_view->render('listing', '', '',$this->_sidebar_menu);\n\t\t}", "public function listAction()\n {\n $em = $this->getDoctrine()->getManager();\n \n $todos = $em->getRepository(Todo::class)->findAll();\n \n return $this->render('todo/index.html.twig', array(\n 'todos' => $todos,\n ));\n }", "public function index()\n\t{\n $this->authorize('list', Instance::class);\n\n\t\treturn $this->ok($this->repo->paginate($this->request->all()));\n\t}", "public function actionRestList() {\n\t $this->doRestList();\n\t}", "public function listing()\n\t{\n\t\t$hospitalID = $this->request->getSession()->read(\"hospital_id\") ? $this->request->getSession()->read(\"hospital_id\") : \"\";\n\t\t\n\t\t$patientMonitored = 1;\n\t\t$patientActive = 1;\n\t\t\n\t\t//GET ALL PATIENTS\n\t\t$patientsData = $this->Patients->allPatients($hospitalID,$patientMonitored,$patientActive);\n\t\t//GET ALL PATIENTS\n\t\t\n\t\t//echo \"<pre>\"; print_r($patientsData);die;\n\t\t$this->set(compact(\"patientsData\"));\n\t}", "public function listAction()\n {\n $htmlpage = '<!DOCTYPE html>\n<html>\n <head>\n <meta charset=\"UTF-8\">\n <title>todos list!</title>\n </head>\n <body>\n <h1>todos list</h1>\n <p>Here are all your todos:</p>\n <ul>';\n \n $em = $this->getDoctrine()->getManager();\n $todos = $em->getRepository(Todo::class)->findAll();\n foreach($todos as $todo) {\n $htmlpage .= '<li>\n <a href=\"/todo/'.$todo->getid().'\">'.$todo->getTitle().'</a></li>';\n }\n $htmlpage .= '</ul>';\n\n $htmlpage .= '</body></html>';\n \n return new Response(\n $htmlpage,\n Response::HTTP_OK,\n array('content-type' => 'text/html')\n );\n }", "public function index()\n {\n // Get Persons\n $person = Person::paginate(10);\n\n //Return collection of person as a resource\n return PersonResource::collection($person);\n }", "public function listAction() {\n\t\t$this->view->title = $this->translator->translate(\"Invoice list\");\n\t\t$this->view->description = $this->translator->translate(\"Here you can see all the invoices.\");\n\t\t$this->view->buttons = array(array(\"url\" => \"/admin/invoices/new/\", \"label\" => $this->translator->translate('New'), \"params\" => array('css' => null)));\r\n\t\t$this->datagrid->setConfig ( Invoices::grid() )->datagrid ();\n\t}", "public function listAll()\n\t{\n\t\t$this->render(self::PATH_VIEWS . '/list', [\n\t\t\t'pages' => $this->pagesDb->findAll('id', 'DESC'),\n\t\t]);\n\t}", "public function list()\n {\n // récupérer les données : toutes les catégories enregistrées\n $productList = Product::findAll();\n\n $this->show('product/list', [\n 'productList' => $productList\n ]);\n }", "public function index()\n {\n // CRUD -> Retrieve --> List\n // BREAD -> Browse Read Edit Add Delete\n // return Item::all();\n return view('list_items',compact('items'));\n }", "public function index()\n {\n // Get manufacturers\n $manufacturers = Manufacturer::orderBy('created_at', 'desc')->paginate(15);\n\n // Return collection of manufacturers as a resource\n return ManufacturerResource::collection($manufacturers);\n }", "public function index()\n {\n return ArtistResource::collection(Artist::orderBy('created_at', 'desc')->get());\n }", "public function indexAction() {\n\t\t$page = intval($this->getInput('page'));\n\t\t$perpage = $this->perpage;\n\t\t\n\t\tlist(,$files) = Lock_Service_FileType::getAllFileType();\n\t\t$data = array();\n\t\tforeach ($files as $key=>$value) {\n\t\t\t$data[$key]['id'] = $value['id'];\n\t\t\t$data[$key]['title'] = $value['name'];\n\t\t}\n\t\tlist($total, $filetype) = Lock_Service_FileType::getList($page, $perpage);\n\t\t$this->assign('filetype', $filetype);\n\t\t$this->assign('pager', Common::getPages($total, $page, $perpage, $this->actions['listUrl'].'/?'));\n\t\t$this->assign('data', json_encode($data));\n\t}", "public function listAction()\n {\n $qb = $this->getRepository()->queryAll();\n\n $view = new ImportListView;\n $view->imports = $qb->getQuery()->execute();\n\n return $this->templating->renderResponse('InfiniteImportBundle:Import:list.html.twig', array(\n 'data' => $view\n ));\n }", "public function index()\n\t{\n\t\t//Return model all()\n\t\t$instances = $this->decorator->getListingModels();\n\n\t\treturn View::make($this->listingView, array(\n\t\t\t'instances' => $instances,\n\t\t\t'controller' => get_class($this), \n\t\t\t'modelName' => class_basename(get_class($this->decorator->getModel())),\n\t\t\t'columns' => $this->getColumnsForInstances($instances),\n\t\t\t'editable' => $this->editable\n\t\t));\n\t}", "public function index()\n {\n return InfografiResources::collection(\n Infografi::orderBy('date', 'desc')->get()\n );\n }", "public function listAction()\n\t {\n\t\t\t$this->_forward('index');\n \n\t\t}", "public function index()\n {\n $this->list_view();\n }", "public function index()\n {\n $this->list_view();\n }", "public function index()\n {\n $this->list_view();\n }", "public function listAction()\n {\n $defaults = array(\n 'page' => null,\n 'order' => null,\n 'limit' => null,\n 'offset' => null,\n 'filter' => array(),\n );\n $body = $this->getRequest()->getBody();\n $options = $body + $defaults;\n\n // Process the options\n if (is_string($options['order'])) {\n $options['order'] = array_map('trim', explode(',', $options['order']));\n }\n if (is_string($options['page'])) {\n $options['page'] = (int)$options['page'];\n }\n if (is_string($options['limit'])) {\n $options['limit'] = (int)$options['limit'];\n }\n if (is_string($options['offset'])) {\n $options['offset'] = (int)$options['offset'];\n }\n $filter = $options['filter'];\n unset($options['filter']);\n\n $options = array_filter($options);\n\n return $this->getBinding()->find($filter, $options);\n }", "public function index()\n {\n /* Check if logged in user is authorized to make this request */\n $this->authorizeAction();\n\n /* Get the resources from the model */\n $resources = $this->resourcesList($this->model);\n\n /* Sets the view */\n if (view()->exists(\"admin.{$this->name}.index\")) {\n $view = \"admin.{$this->name}.index\";\n } else {\n $view = 'admin.includes.actions.index';\n }\n\n /* Display a listing of the resources */\n return view($view)\n ->with('resources', $resources)\n ->with('module', $this->module);\n }", "public function index()\n\t{\n\t\t$data['lists'] = $this->mdl_student->get_all();\n\t\t$this->template->set('title', 'Student Hostel List');\n\t\t$this->template->load('template', 'contents', 'student_hostel/student_hostel_list', $data);\n\t}", "public function index()\n {\n $modules = Module::all();\n return Resource::collection($modules);\n }", "public function index()\n {\n // List all resources from user entity\n $users = User::all();\n\n return $this->showAll($users);\n }", "public function index()\n {\n // Get todos\n $todos = Todo::orderBy('created_at', 'desc')->paginate(3);\n\n // Return collection of articles as a resource\n return TodoResource::collection($todos);\n }", "public function index()\n {\n return Resources::collection(Checking::paginate());\n }", "public function index()\n {\n return CourseListResource::collection(\n Course::query()->withoutGlobalScope('publish')\n ->latest()->paginate()\n );\n }", "public function index()\n {\n $cars = Car::paginate(15);\n return CarResource::collection($cars);\n }", "public function index()\n {\n // Get articles\n $articles = Article::orderBy('created_at', 'desc')->paginate(5);\n\n // Return collection of articles as a resource\n return ArticleResource::collection($articles);\n }", "public function index()\n {\n $authors = Author::paginate(10);\n\n return AuthorResource::collection($authors);\n }", "public function index()\n {\n //Get Books\n $books = Book::paginate(10);\n \n if ($books) {\n return (BookResource::collection($books))->additional([\n 'status_code' => 200,\n 'status' => 'success',\n ]);\n } else {\n return (BookResource::collection([]))->additional([\n 'status_code' => 200,\n 'status' => 'success',\n ]);\n }\n return view('index')->with('data', $books);\n }", "public function view(){\n\t\t$this->buildListing();\n\t}", "public function index()\n {\n $books = Book::latest()\n ->paginate(20);\n\n return BookResource::collection($books);\n }", "public function index()\n {\n $listing = Listing::orderBy('id', 'desc')->paginate(10);\n return view('listings.index')->withListings($listing);\n }", "public function listAction()\n {\n $this->_getSession()->setFormData([]);\n\n $this->_title($this->__('Training Cms'))\n ->_title($this->__('Pages'));\n\n $this->loadLayout();\n\n $this->_setActiveMenu('training_cms');\n $this->_addBreadcrumb($this->__('Training Cms'), $this->__('Training Cms'));\n $this->_addBreadcrumb($this->__('Pages'), $this->__('Pages'));\n\n $this->renderLayout();\n }", "public function index()\n {\n $services = $this->serviceRepository->paginate();\n\n return ServiceResource::collection($services);\n }", "public function index()\n {\n $resources = ResourceManagement::paginate(5);\n $users = User::get();\n\n return view('resources-mgmt/index', ['resources' => $resources, 'users' => $users]);\n }", "public function index()\n {\n $catalogs = Catalog::where('status', '=', Catalog::PUBLICADO)\n ->orderBy('id', 'DESC')->get();\n \n $data = CatalogResource::collection($catalogs);\n\n return [\n 'items' => $data,\n 'mensaje' => ''\n ];\n }", "public function listAction(){\n // In a controller this can be:\n // $this->request->getQuery('page', 'int'); // GET\n $currentPage = $this->request->getPost('pageindex', 'int'); // POST\n $pageNum = ($currentPage == null) ? 1 : $currentPage;\n\n // The data set to paginate\n $message = new Notice();\n $results = $message->getMsg4Admin();\n\n // Create a Model paginator, show 10 rows by page starting from $currentPage\n $paginator = new PaginatorArray(\n array(\n \"data\" => $results,\n \"limit\" => 10,\n \"page\" => $pageNum\n )\n );\n\n // Get the paginated results\n $page = $paginator->getPaginate();\n\n return $this->response->setJsonContent($page);\n\n }", "public function list()\n {\n try {\n return $this->success($this->service->list());\n } catch (\\Exception $exception) {\n return $this->error($exception->getMessage());\n }\n }", "public function index()\n {\n return $this->sendResponse(CrisisResource::collection(Crisis::paginate(10)), 'Data fetched successfully');\n }", "public function index()\n\t{\n\t\t$%Alias = new %Model();\n\t\t$params = array();\n\t\t\n\t\t$Paginator = new Paginator( $%Alias->findSize( $params ), $this->getLimit(), $this->getPage() );\n\t\t$this->getView()->set( '%Aliass', $%Alias->findList( $params, 'Id desc', $this->getOffset(), $this->getLimit() ) );\n\t\t$this->getView()->set( 'Paginator', $Paginator );\n\t\treturn $this->getView()->render();\n\t}", "public function listAction() {}", "public function index()\n {\n\n return RecipeResource::collection(Recipe::all());\n }", "public function index()\n {\n $this->indexPage('list-product', 'List Product');\n }", "public function listAction()\n {\t\n\t\t$this->removeSession();\n\t\t$this->verifySessionRights();\n\t\t$this->setActivity(\"List view\");\n $em = $this->getDoctrine()->getManager();\n $oRepClient = $em->getRepository('BoAdminBundle:Client');\n\t\t$nb_tc = $oRepClient->getTotal();\n\t\t//get page\n\t\t$page = $this->get('session')->get('page');\n\t\tif($page==null){\n\t\t\t$page=1;\n\t\t\t$this->get('session')->set('page',1);\n\t\t}\n\t\t//get number line per page\n\t\t$nb_cpp = $em->getRepository('BoAdminBundle:Param')->getParam(\"display_list_page_number\",1);\n\t\t$nb_pages = ceil($nb_tc/$nb_cpp);\n\t\t$offset = $page>0?($page-1) * $nb_cpp:0;\n\t\t$clients = $em->getRepository('BoAdminBundle:Client')->findBy(array(),array('id' => 'desc'),$nb_cpp,$offset);\n $form = $this->createForm('Bo\\AdminBundle\\Form\\ClientType', new Client());\n return $this->render('client/index.html.twig', array(\n 'clients' => $clients,\n\t\t\t'page' => $page, // forward current page to view,\n\t\t\t'nb_pages' => $nb_pages, //total number page,\n 'form' => $form->createView(),\n\t\t\t'total'=>$nb_tc, // record number.\n\t\t\t'nb_cpp' => $nb_cpp,// line's number to display\n\t\t\t'pm'=>\"contracts\",\n\t\t\t'sm'=>\"client\",\n ));\n }", "public function index()\n {\n return AcResource::collection(Ac::latest()->paginate()); //\n }", "public function executeList()\n {\n $this->setTemplate('list');\n }", "public function indexAction()\n {\n $books = Book::getAll();\n\n View::renderTemplate('Books/index.html', [\n 'books' => $books\n ]);\n }", "function listing() {\r\n\r\n }", "public function listar() {\n $rs = $this->model->listar();\n\n echo $this->toJson($rs);\n }", "public function index()\n {\n return BookResource::collection(Book::orderby('id')->get());\n }", "public function doRestList()\n {\n $this->outputHelper( \n 'Records Retrieved Successfully', \n $this->getModel()->with($this->nestedRelations)->filter($this->restFilter)->orderBy($this->restSort)->limit($this->restLimit)->offset($this->restOffset)->findAll(),\n $this->getModel()->with($this->nestedRelations)->filter($this->restFilter)->count()\n );\n\t}", "public function index()\n {\n $client = Client::paginate();\n return ClientResource::collection($client);\n }", "public function index()\n {\n return TagResource::collection(\n Tag::orderBy('name', 'ASC')->paginate(request('per_page', 10))\n );\n }", "public function _index(){\n\t $this->_list();\n\t}", "public function index()\n\t{\n\t\t$data['lists'] = $this->gallery_mdl->get_all();\n\t\t$this->template->set('title', 'Gallery');\n\t\t$this->template->render('template', 'list', $data);\n\t}", "function drush_restapi_list() {\n\n $resources = restapi_get_resources();\n $last_module = NULL;\n $rows = [\n [dt('Module'), dt('Path'), dt('Class')],\n ];\n\n foreach($resources as $resource) {\n if ($last_module != $resource->getModule()) {\n $module = $last_module = $resource->getModule();\n }\n else {\n $module = '';\n }\n $rows[] = [$module, $resource->getPath(), $resource->getClass()];\n }\n\n drush_print_table($rows, TRUE);\n drush_log(dt('Displaying !count total resources', [\n '!count' => count($resources),\n ]), 'ok');\n\n}", "public function index()\n {\n $this->booklist();\n }", "public function index()\n {\n //\n $accounts = accounts::paginate(15);\n\n //return the collection of employees as a resource\n return accountResource::collection($accounts);\n\n\n }", "public function index()\n {\n $items = Item::all();\n return view('items::list_items',compact('items'));\n }", "public function index()\n {\n // Get houses\n $houses = House::orderBy('created_at', 'desc')->paginate(self::PAGINATE);\n \n // Return collection of houses\n \n return HouseResource::collection($houses);\n }", "public function index()\n {\n $products = Product::paginate(6);\n return ProductResource::collection($products);\n }", "public function index() {\n $this->template->allFoundItems = Found::showAll();\n $this->template->display( 'index.html.php' );\n }", "public function indexAction() {\n $this->_forward('list');\n }", "public function index()\n {\n $data = Productcategory::paginate(10);\n\t\treturn ProductcategoryResource::Collection($data);\n }", "public function index()\n {\n return SongResource::collection(\\App\\Song::orderBy('created_at', 'desc')->get());\n }", "public function ListView()\n\t{\n\t\t\n\t\t// Requer permissão de acesso\n\t\t$this->RequirePermission(Usuario::$P_ADMIN,\n\t\t\t\t'SecureExample.LoginForm',\n\t\t\t\t'Autentique-se para acessar esta página',\n\t\t\t\t'Você não possui permissão para acessar essa página ou sua sessão expirou');\n\t\t\n\t\t//$usuario = Controller::GetCurrentUser();\n\t\t//$this->Assign('usuario',$usuario);\n\t\t$this->Render();\n\t}", "public function index () {\n permiss ( 'role.list' );\n\n $data = $this->entity\n ->orderBy('created_at', 'desc')->get();\n\n return new ModelResource($data);\n }", "public function showResources()\n {\n $resources = Resource::get();\n return view('resources', compact('resources'));\n }", "public function index()\n {\n //get articless\n $articles = Article::paginate(15);\n\n //Return collection of article has a resource\n return ArticleResource::collection($articles);\n\n }", "public function actionList() {\n header(\"Content-type: application/json\");\n $verb = $_SERVER[\"REQUEST_METHOD\"];\n\n if ($verb === 'GET') {\n echo \"{\\\"data\\\":\" . CJSON::encode(Donneur::model()->findAll()) . \"}\";\n } else if ($verb == 'POST') {\n if (Donneur::model()->exists('id' === $_POST['id'])) {\n $this->actionListUpdate($_POST);\n } else {\n $this->actionListPost();\n }\n } else if ($verb == 'DELETE') {\n $this->actionListDelete();\n }\n }", "public function list()\n {\n return $this->http->request(HttpMethods::GET, $this->endpoint);\n }", "public function indexAction(){\n $data = array(\n 'collection' => $this->model->getCollection(),\n \n ); \t\n return $this->getView($data);\n }", "public function indexAction()\n {\n $em = $this->getDoctrine()->getManager();\n\n $entities = $em->getRepository('DiverPriceLisrBundle:Items')->findAll();\n\n return $this->render('DiverPriceLisrBundle:Items:index.html.twig', array(\n 'entities' => $entities,\n ));\n }", "public function actionIndex()\n {\n $dataProvider = new ActiveDataProvider([\n 'query' => Slaves::find(),\n ]);\n\n return $this->render('index', [\n 'dataProvider' => $dataProvider,\n ]);\n }", "public function listAction() {\n\t\t// Recogemos el repositorio\n\t\t$repository = $this->getDoctrine() ->getRepository('AppBundle:Product');\n\t\n\t\t// Recuperamos todos los productos.\n\t\t$products = $repository->findAll();\n\t\t// Pasamos a la plantilla el aray products\n\t\treturn $this->render('product/listActionProduct.html.twig', array( 'products' => $products));\n\t\n\t}", "public function listAction()\n\t {\n\t\t$model = $this->_getModel();\n\t\t$result = $model->getLayouts();\t\n\t\t$page = (int)($this->_request->getParam('page')); \n\t\tif(count($result) > 0)\n\t\t{ \n\t\t\tGlobals::doPaging($result, $page, $this->view);\n\t\t}\n\t\t\t\t\n\t\t$this->view->page = $page;\n\t }", "public function actionList()\n {\n // get model\n $model = new $this->_model('search');\n $model->unsetAttributes();\n\n // set filter\n if (isset($_GET[$this->_model])) {\n $model->attributes = $_GET[$this->_model];\n }\n $model->u_cms_album_id = $_GET['album'];\n\n // search\n $dataProvider = $model->search(Yii::app()->language);\n // sort\n $sort = $dataProvider->getSort();\n // route\n $sort->route = $this->id . '/list';\n\n // pagination parameters\n $pagination = $dataProvider->getPagination();\n $pagination->route = $this->id . '/list';\n $pagination->pageSize = UInterfaceSetting::model()->getSettings($this->id . ':' . $this->module->id, Yii::app()->user->id)->page_size;\n $pagination->itemCount = $dataProvider->totalItemCount;\n\n // datas\n $datas = $dataProvider->getData();\n\n // related datas\n $relatedDatas = $this->_loadRelatedData();\n\n // template\n $template = isset($_REQUEST['partial']) ? 'list/_table' : 'list/main';\n\n $jsonParams = array();\n if (Yii::app()->request->isAjaxRequest) {\n // filters\n $filtersDatas = array();\n if (isset($_GET[$this->_model])) {\n $filtersDatas[$this->_model] = $_GET[$this->_model];\n }\n if (isset($_GET[$sort->sortVar])) {\n $filtersDatas[$sort->sortVar] = $_GET[$sort->sortVar];\n }\n\n $jsonParams = array(\n 'filters' => http_build_query($filtersDatas)\n );\n }\n\n $this->dynamicRender(\n $template,\n array(\n 'dataView' => new $this->crudComponents['listDataView'](\n $datas, $relatedDatas, $model, $sort, $pagination, $this\n )\n ),\n $jsonParams\n );\n }", "public function index()\n {\n return view('listings.index')->with('listings', Listing::all());\n }", "public function get_index()\n\t{\n\t\t$pages = Page::recent_available()->paginate(30);\n\t\t$table = Cello\\Presenter\\Page::table($pages);\n\t\t$data = array(\n\t\t\t'eloquent' => $pages,\n\t\t\t'table' => $table,\n\t\t);\n\n\t\tSite::set('title', __('cello::title.pages.list'));\n\n\t\treturn View::make('cello::api.resources.index', $data);\n\t}", "public function index()\n {\n return ProductResource::collection(Product::latest()->paginate(10));\n }", "public function index()\n {\n $category = GalleryCategory::paginate(15);\n\n // return collection of category as a resource.\n return Resource::collection($category);\n }", "public function index()\n {\n //\n $news = News::latest()->paginate(18);\n\n return NewsResource::collection($news);\n }", "public function indexAction() {\n\t\t$list_info = Zend_Registry::get('list_info');\n if (!Engine_Api::_()->core()->hasSubject('list_listing')) {\n return $this->setNoRender();\n }\n \n $this->view->expiry_setting = Engine_Api::_()->list()->expirySettings();\n\n //GET SUBJECT\n $this->view->list = $list = Engine_Api::_()->core()->getSubject('list_listing');\n\n\t\t//GET CATEGORY TABLE\n\t\t$this->view->tableCategory = Engine_Api::_()->getDbTable('categories', 'list');\n\n //GET CATEGORIES NAME\n\t\t$this->view->category_name = $this->view->subcategory_name = $this->view->subsubcategory_name = '';\n\n\t\tif(!empty($list->category_id)) {\n\t\t\tif($this->view->tableCategory->getCategory($list->category_id))\n\t\t\t$this->view->category_name = $this->view->tableCategory->getCategory($list->category_id)->category_name;\n\n\t\t\tif(!empty($list->subcategory_id)) {\n\t\t\t\tif($this->view->tableCategory->getCategory($list->subcategory_id))\n\t\t\t\t$this->view->subcategory_name = $this->view->tableCategory->getCategory($list->subcategory_id)->category_name;\n\n\t\t\t\tif(!empty($list->subsubcategory_id)) {\n\t\t\t\t\tif($this->view->tableCategory->getCategory($list->subsubcategory_id))\n\t\t\t\t\t$this->view->subsubcategory_name = $this->view->tableCategory->getCategory($list->subsubcategory_id)->category_name;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n //GET LISTING TAGS\n $this->view->listTags = $list->tags()->getTagMaps();\n\n\t\t//GET OTHER DETAILS\n\t\t$this->view->list_description = Zend_Registry::get('list_descriptions');\n $this->view->addHelperPath(APPLICATION_PATH . '/application/modules/Fields/View/Helper', 'Fields_View_Helper');\n $this->view->fieldStructure = Engine_Api::_()->fields()->getFieldsStructurePartial($list);\n\t\tif(empty($list_info)){ return $this->setNoRender(); }\n }", "public function index()\n {\n return $this->service->fetchResources(Author::class, 'authors');\n }", "public function index()\n {\n return view('admin.resources.index');\n }", "public function doRestList() {\n\t\t$this->outputHelper ( 'Collections Retrieved Successfully', $this->getModel ()->with ( $this->nestedRelations )->filter ( $this->restFilter )->orderBy ( $this->restSort )->limit ( $this->restLimit )->offset ( $this->restOffset )->findAll (), $this->getModel ()->with ( $this->nestedRelations )->filter ( $this->restFilter )->count () );\n\t}" ]
[ "0.7446777", "0.736227", "0.73005503", "0.72478926", "0.71631265", "0.71489686", "0.7131636", "0.7105969", "0.71029514", "0.7101372", "0.70508176", "0.6995128", "0.69890636", "0.6934895", "0.6900203", "0.6899281", "0.6891734", "0.6887235", "0.68670005", "0.6849741", "0.6830523", "0.6802689", "0.6797", "0.67957735", "0.67871135", "0.6760129", "0.67427456", "0.6730486", "0.67272323", "0.67255723", "0.67255723", "0.67255723", "0.67177945", "0.6707866", "0.6706713", "0.6704375", "0.6664782", "0.6662871", "0.6660302", "0.6659404", "0.6656656", "0.6653517", "0.6647965", "0.6620322", "0.66185474", "0.6618499", "0.6606105", "0.6600617", "0.65996987", "0.6594775", "0.6587389", "0.6585109", "0.6581641", "0.6581017", "0.6577157", "0.65747666", "0.6572513", "0.65721947", "0.6570553", "0.65646994", "0.6563556", "0.6554194", "0.65529937", "0.65460825", "0.65368485", "0.653429", "0.65328294", "0.6526759", "0.6526695", "0.6526284", "0.65191334", "0.65183175", "0.65174305", "0.651703", "0.65141153", "0.6507088", "0.65061647", "0.6504046", "0.64942145", "0.6491893", "0.64883405", "0.6486392", "0.6485077", "0.64846045", "0.6478858", "0.64756656", "0.64726377", "0.6471126", "0.64701074", "0.6467418", "0.6462195", "0.64618355", "0.6459199", "0.6457831", "0.6454631", "0.64533997", "0.6451915", "0.6450861", "0.6449301", "0.64492667", "0.64469045" ]
0.0
-1
Show the form for creating a new resource.
public function create() { // }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function create()\n {\n return $this->showForm('create');\n }", "public function create()\n {\n return $this->showForm('create');\n }", "public function create()\n {\n return view('admin.resources.create');\n }", "public function create(){\n\n return view('resource.create');\n }", "public function create()\n\t{\n\t\treturn $this->showForm('create');\n\t}", "public function create()\n {\n return \"Display a form for creating a new catalogue\";\n }", "public function newAction()\n {\n $entity = new Resource();\n $current = $this->get('security.context')->getToken()->getUser();\n $entity->setMember($current);\n $form = $this->createCreateForm($entity);\n\n return array(\n 'nav_active'=>'admin_resource',\n 'entity' => $entity,\n 'form' => $form->createView(),\n );\n }", "public function create()\n {\n return view ('forms.create');\n }", "public function create ()\n {\n return view('forms.create');\n }", "public function create()\n\t{\n\t\treturn view('faith.form');\n\t}", "public function create(NebulaResource $resource): View\n {\n $this->authorize('create', $resource->model());\n\n return view('nebula::resources.create', [\n 'resource' => $resource,\n ]);\n }", "public function create()\n {\n return view(\"request_form.form\");\n }", "public function create()\n {\n /* Check if logged in user is authorized to make this request */\n $this->authorizeAction();\n\n /* Sets the view */\n if (view()->exists(\"admin.{$this->name}.create\")) {\n $view = \"admin.{$this->name}.create\";\n } else {\n $view = 'admin.includes.actions.create';\n }\n\n /* Show the form for creating a new resource. */\n return view($view)\n ->with('name', $this->name);\n }", "public function newAction()\n\t{\n\t\t$this->render( View::make( 'schools/form' , array(\n\t\t\t'title' => 'Ajouter une nouvelle &eacute;cole'\n\t\t) ) );\n\t}", "public function create()\n {\n return view($this->forms . '.create');\n }", "public function create()\n {\n return view('restful.add');\n }", "public function create()\n {\n $resource = (new AclResource())->AclResource;\n\n //dd($resource);\n return view('Admin.acl.role.form', [\n 'resource' => $resource\n ]);\n }", "public function create()\n {\n return view('admin.createform');\n }", "public function create()\n {\n return view('admin.forms.create');\n }", "public function create()\n {\n return view('backend.student.form');\n }", "public function newAction()\n {\n $breadcrumbs = $this->get(\"white_october_breadcrumbs\");\n $breadcrumbs->addItem('Inicio', $this->get('router')->generate('admin.homepage'));\n $breadcrumbs->addItem($this->entityDescription, $this->get(\"router\")->generate(\"admin.$this->entityName.index\"));\n $breadcrumbs->addItem('Nuevo');\n\n $entity = $this->getManager()->create();\n $form = $this->getForm($entity);\n\n return $this->render('AdminBundle:Default:new.html.twig', array(\n 'entity' => $entity,\n 'form' => $form->createView(),\n 'metadata' => $this->getMetadata()\n ));\n }", "public function create()\n {\n return view('client.form');\n }", "public function create()\n {\n // Nos regresa la vista del formulario\n return view('project.form');\n }", "public function create()\n {\n return view('Form');\n }", "public function newAction(){\n \n $entity = new Resourceperson();\n $form = $this->createAddForm($entity);\n\n \n return $this->render('ABCRspBundle:rsp:add.html.twig',array('entity'=>$entity,'form'=> $form->createView()));\n }", "public function createForm()\n\t{\n\t\treturn view('post.new');\n\t}", "public function create()\n {\n return view('admin.form.create', ['form' => new Form]);\n }", "public function create()\n {\n return view('form');\n }", "public function create()\n {\n return view('form');\n }", "public function create()\n {\n return view('form');\n }", "public function create()\n {\n $title = $this->title;\n $subtitle = \"Adicionar cliente\";\n\n return view('admin.clients.form', compact('title', 'subtitle'));\n }", "public function create()\n {\n return view('backend.schoolboard.addform');\n }", "public function create()\n\t{\n\t\treturn view('info.forms.createInfo');\n\t}", "public function create()\n {\n return view('rests.create');\n }", "public function create()\n {\n //\n return view('form');\n }", "public function create()\n {\n return $this->showForm();\n }", "public function create()\n {\n return $this->showForm();\n }", "public function create()\n {\n return view(\"Add\");\n }", "public function create()\n {\n // Show the page\n return view('admin.producer.create_edit');\n }", "public function create(){\n return view('form.create');\n }", "public function create()\n {\n\n return view('control panel.student.add');\n\n }", "public function newAction() {\n\t\t\n\t\t$this->view->form = $this->getForm ( \"/admin/invoices/process\" );\n\t\t$this->view->title = $this->translator->translate(\"New Invoice\");\n\t\t$this->view->description = $this->translator->translate(\"Create a new invoice using this form.\");\n\t\t$this->view->buttons = array(array(\"url\" => \"#\", \"label\" => $this->translator->translate('Save'), \"params\" => array('css' => null,'id' => 'submit')),\r\n\t\t\t\t\t\t\t array(\"url\" => \"/admin/invoices/list\", \"label\" => $this->translator->translate('List'), \"params\" => array('css' => null)));\n\t\t$this->render ( 'applicantform' );\n\t}", "public function create()\n {\n $data['action'] = 'pengiriman.store';\n return view('pengiriman.form', $data);\n }", "public function create()\n {\n return $this->cView(\"form\");\n }", "public function newAction()\n {\n // Création de l'entité et du formulaire.\n $client = new Client();\n $formulaire = $this->createForm(new ClientType(), $client);\n \n \n \n // Génération de la vue.\n return $this->render('KemistraMainBundle:Client:new.html.twig',\n array('formulaire' => $formulaire->createView()));\n }", "public function create()\n {\n return view(\"dresses.form\");\n }", "public function create()\n\t{\n\t\treturn View::make('new_entry');\n\t}", "public function createAction()\n {\n// $this->view->form = $form;\n }", "public function create()\n {\n return view('bank_account.form', ['mode' => 'create']);\n }", "public function create()\n {\n return view('fish.form');\n }", "public function create()\n {\n return view('users.forms.create');\n }", "public function create()\n {\n $this->setFormFields($this->getCreateFormFields());\n $form = $this->getCreateForm();\n\n return view($this->getViewName('create'), [\n 'crudSlug' => $this->slug,\n 'form' => $form,\n ]);\n }", "public function create()\n\t{\n\t\treturn view('admin.estadoflete.new');\n\t}", "public function create()\n {\n $person = new Person;\n return view('contents.personform')->with(compact('person') );\n }", "public function createAction(){\n \t$this->view->placeholder('title')->set('Create');\n \t$this->_forward('form');\n }", "public function create()\n {\n Gate::authorize('app.products.create');\n\n return view('backend.products.form');\n }", "public function create()\n {\n return view('essentials::create');\n }", "public function create()\n {\n return view('student.add');\n }", "public function create()\n\t{\n\t\treturn view('loisier/create');\n\t}", "public function create()\n {\n return view('url.form');\n }", "public function newAction()\n {\n $entity = new Facture();\n $factureType = new FactureType();\n\t\t$factureType->setUser($this->get('security.context')->getToken()->getUser());\n $form = $this->createForm($factureType, $entity);\n\n return $this->render('chevPensionBundle:Facture:new.html.twig', array(\n 'entity' => $entity,\n 'form' => $form->createView(),\n ));\n }", "public function newAction()\n {\n $entity = new Chofer();\n $form = $this->createForm(new ChoferType(), $entity, ['user' => $this->getUser()]);\n\n return $this->render('ChoferesBundle:Chofer:new.html.twig', array(\n 'entity' => $entity,\n 'form' => $form->createView(),\n 'css_active' => 'chofer',\n ));\n }", "public function create()\n\t{\n\t\treturn View::make('crebos.create');\n\t}", "public function create() : View\n {\n $fieldset = $this->menuFieldset();\n\n return $this->view('create', [\n 'title' => trans('addons.Aardwolf::titles.create'),\n 'data' => [],\n 'fieldset' => $fieldset->toPublishArray(),\n 'suggestions' => [],\n 'submitUrl' => route('aardwolf.postCreate')\n ]);\n }", "public function create()\n {\n return view('libro.create');\n }", "public function create()\n {\n return view('libro.create');\n }", "public function newAction()\n {\n $entity = new Species();\n $form = $this->createForm(new SpeciesType(), $entity);\n\n return $this->render('InfectBackendBundle:Species:new.html.twig', array(\n 'entity' => $entity,\n 'form' => $form->createView(),\n ));\n }", "public function create()\n {\n return view('crud/add'); }", "public function create()\n\t{\n\t\treturn View::make('supplier.create');\n\t}", "public function newAction()\n {\n $entity = new Company();\n $form = $this->createForm(new CompanyType(), $entity);\n\n return $this->render('SiteSavalizeBundle:Company:new.html.twig', array(\n 'entity' => $entity,\n 'form' => $form->createView(),\n ));\n }", "public function create()\n {\n return view(\"List.form\");\n }", "public function index_onCreateForm()\n\t{\n\t\tparent::create();\n\t\treturn $this->makePartial('create');\n\t}", "public function create()\n {\n //load create form\n return view('products.create');\n }", "public function create()\n {\n return view('article.addform');\n }", "public function create()\n {\n // Mengarahkan ke halaman form\n return view('buku.form');\n }", "public function create()\n\t{\n\t\t// load the create form (app/views/material/create.blade.php)\n\t\t$this->layout->content = View::make('material.create');\n\t}", "public function create()\n {\n return view('saldo.form');\n }", "public function create()\n\t\t{\n\t\t\treturn view('kuesioner.create');\n\t\t}", "public function view_create_questioner_form() {\n \t// show all questioner\n \t// send questioner to form\n \treturn view(\"create_questioner\");\n }", "public function newAction() {\n $entity = new Question();\n $form = $this->createCreateForm($entity);\n\n return $this->render('CdlrcodeBundle:Question:new.html.twig', array(\n 'entity' => $entity,\n 'form' => $form->createView(),\n ));\n }", "public function create()\n {\n $data['companies'] = Company::select('id', 'name')->where('status', 1)->orderBy('id', 'desc')->get();\n return view('admin.outlet.outlet_form', $data);\n }", "public function create()\n {\n return view('admin.inverty.add');\n }", "public function create()\n {\n return view('Libro.create');\n }", "public function create()\n {\n $breadcrumb='car.create';\n return view('admin.partials.cars.form', compact('breadcrumb'));\n }", "public function create()\n {\n $title = trans('entry_mode.new');\n return view('layouts.create', compact('title'));\n }", "public function create()\n {\n return view(\"familiasPrograma.create\");\n }", "public function create()\n {\n return view('admin.car.create');\n }", "public function create()\n {\n return view('admin.car.create');\n }", "public function create()\n\t{\n\t\treturn View::make('perusahaans.create');\n\t}", "public function create()\n {\n return view(\"create\");\n }", "public function create()\n\t{\n //echo 'show form';\n\t\treturn View::make('gaans.create');\n\t}", "public function create()\n {\n $title = trans('dormitorybed.new');\n $this->generateParams();\n\n return view('layouts.create', compact('title'));\n }", "public function create()\n {\n return view('forming');\n }", "public function formNew() {\n $this->data->options = array(\n 'RJ' => 'Rio de Janeiro',\n 'MG' => 'Minas Gerais',\n 'SP' => 'São Paulo',\n 'ES' => 'Espírito Santo',\n 'BA' => 'Bahia',\n 'RS' => 'Rio Grande do Sul'\n );\n $this->data->action = \"@exemplos/pessoa/save\";\n $this->render();\n }", "public function create()\n {\n \t\n \treturn view('supplies.create');\n\n }", "public function create()\n {\n $page_title = \"Add New\";\n return view($this->path.'create', compact('page_title'));\n }", "public function createAction()\n {\n if ($form = $this->processForm()) {\n $this->setPageTitle(sprintf($this->_('New %s...'), $this->getTopic()));\n $this->html[] = $form;\n }\n }", "public function create() {\n\t\t$title = 'Create | Show';\n\n\t\treturn view('admin.show.create', compact('title'));\n\t}", "public function newAction(){\n\t\t$entity = new Reserva();\n\t\t$form = $this->createCreateForm($entity);\n\n\t\treturn $this->render('LIHotelBundle:Reserva:new.html.twig', array(\n\t\t\t'entity' => $entity,\n\t\t\t'form' => $form->createView(),\n\t\t));\n\t}", "public function create()\n {\n // not sure what to do with the form since im\n // using ame partial for both create and edit\n return view('plants.create')->with('plant', new Plant);\n }", "public function create()\n {\n return view('student::students.student.create');\n }" ]
[ "0.7593198", "0.7593198", "0.75881755", "0.75787884", "0.7570936", "0.74992913", "0.7436037", "0.7431172", "0.7386512", "0.7351077", "0.7337819", "0.73100585", "0.7295612", "0.72803086", "0.7272473", "0.72422874", "0.7229479", "0.7224403", "0.7184453", "0.7177193", "0.7173551", "0.71482", "0.71424824", "0.7141885", "0.7135663", "0.7126202", "0.7121413", "0.7113729", "0.7113729", "0.7113729", "0.7110717", "0.7092118", "0.7083616", "0.7080794", "0.7078082", "0.70561296", "0.70561296", "0.7054459", "0.703925", "0.70373696", "0.70346737", "0.70324355", "0.70287114", "0.7025425", "0.7025232", "0.7018496", "0.7016745", "0.7002774", "0.70019513", "0.69991785", "0.69942427", "0.69936013", "0.69929653", "0.6988009", "0.69856364", "0.6965122", "0.6964889", "0.6955187", "0.69511235", "0.69497", "0.6947041", "0.69432163", "0.6940678", "0.6939846", "0.6936846", "0.6936846", "0.6936506", "0.6933589", "0.69309", "0.69273484", "0.6925485", "0.6921386", "0.6917649", "0.6913987", "0.6910826", "0.6909406", "0.69085246", "0.6907409", "0.69021183", "0.6900961", "0.68997645", "0.68991655", "0.6894049", "0.68920606", "0.6892033", "0.6891114", "0.6890811", "0.6890811", "0.6887868", "0.6887327", "0.68854356", "0.688366", "0.68805534", "0.68766564", "0.68753666", "0.6872474", "0.68717086", "0.6869974", "0.6869806", "0.6868809", "0.68685615" ]
0.0
-1
Store a newly created resource in storage.
public function store(Request $request) { $event = new Event; $event->title = $request->title; $event->date = $request->date; $event->city = $request->city; $event->private = $request->private; $event->description = $request->description; $event->items = $request->items; $event->people = $request->people; // Image Upload if($request->hasFile('image') && $request->file('image')->isValid()) { $requestImage = $request->image; $extension = $requestImage->extension(); $imageName = md5($requestImage->getClientOriginalName() . strtotime("now")) . "." . $extension; $requestImage->move(public_path('img/events'), $imageName); $event->image = $imageName; } $user = auth()->user(); $event->user_id = $user->id; $event->save(); return redirect('/')->with('msg', 'Evento criado com sucesso!'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function store($data, Resource $resource);", "public function store()\n {\n /* Check if logged in user is authorized to make this request */\n $this->authorizeAction();\n\n if (method_exists($this, 'storeValidations')) {\n $this->request->validate($this->storeValidations());\n }\n\n /* Create a new resource */\n $resource = $this->model::create(Input::all());\n\n /* Redirect to newly created resource page */\n return redirect()\n ->route($this->name . '.edit', $resource->id)\n ->with(\n 'success',\n Lang::has($this->name . '.resource-created') ?\n $this->name . '.resource-created' :\n 'messages.alert.resource-created'\n );\n }", "public function store(CreateStorageRequest $request)\n {\n $this->storage->create($request->all());\n\n return redirect()->route('admin.product.storage.index')\n ->withSuccess(trans('core::core.messages.resource created', ['name' => trans('product::storages.title.storages')]));\n }", "public function createStorage();", "public function store(StoreStorage $request)\n {\n $storage = Storage::create($request->all());\n $request->session()->flash('alert-success', 'Запись успешно добавлена!');\n return redirect()->route('storage.index');\n }", "public function saveShopifyResource() {\n if (is_null($this->getShopifyId())) { // if there is no id...\n $this->createShopifyResource(); // create a new resource\n } else { // if there is an id...\n $this->updateShopifyResource(); // update the resource\n }\n }", "public function store(Request $request, NebulaResource $resource): RedirectResponse\n {\n $this->authorize('create', $resource->model());\n\n $validated = $request->validate($resource->rules(\n $resource->createFields()\n ));\n\n $resource->storeQuery($resource->model(), $validated);\n\n $this->toast(__(':Resource created', [\n 'resource' => $resource->singularName(),\n ]));\n\n return redirect()->back();\n }", "function storeAndNew() {\n $this->store();\n }", "public function store(Request $request)\n {\n $currentUser = JWTAuth::parseToken()->authenticate();\n $validator = Validator::make($request->all(), [\n 'content' => 'required|string',\n 'image_link' => 'sometimes|url',\n ]);\n\n if ($validator->fails()) {\n return APIHandler::response(0, $validator->errors(), [], 400);\n }\n\n $resource = new Resource;\n $resource->user_id = $currentUser['id'];\n $resource->title = $request->get('title');\n $resource->content = $request->get('content');\n $resource->image_link = $request->get('imageLink');\n $resource->video_link = $request->get('videoLink');\n $resource->file_link = $request->get('fileLink');\n $resource->audio_link = $request->get('audioLink');\n $resource->tags = collect($request->get('tags'))->implode('text', ',');\n $resource->is_public = 0;\n $resource->save();\n $data['resource'] = $resource;\n\n if ($request->get('programId')) {\n $this->addToProgram($resource, $request->programId);\n // event(new NewLearningPathResourcePublished($resource, $invitee));\n }\n\n User::find($currentUser['id'])->increment('points', 2);\n\n return APIHandler::response(1, \"New resource has been created\", $data, 201);\n }", "public function store()\n {\n if (!$this->id) { // Insert\n $this->insertObject();\n } else { // Update\n $this->updateObject();\n }\n }", "public function store()\n\t{\n\t\t\n\t\t//\n\t}", "public function store()\r\n\t{\r\n\t\t//\r\n\t}", "public function store()\r\n\t{\r\n\t\t//\r\n\t}", "public function store()\r\n\t{\r\n\t\t//\r\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}" ]
[ "0.72865677", "0.7145327", "0.71325725", "0.6640912", "0.66209733", "0.65685713", "0.652643", "0.65095705", "0.64490104", "0.637569", "0.63736665", "0.63657933", "0.63657933", "0.63657933", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437" ]
0.0
-1
Display the specified resource.
public function show($id) { $event = Event::findOrFail($id); $eventOwner = User::where('id', $event->user_id)->first()->toArray(); return view ('show' , ['event' => $event, 'eventOwner' => $eventOwner]); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function show(Resource $resource)\n {\n // not available for now\n }", "public function show(Resource $resource)\n {\n //\n }", "function Display($resource_name, $cache_id = null, $compile_id = null)\n {\n $this->_smarty->display($resource_name, $cache_id, $compile_id);\n }", "private function showResourceable($resourceable)\n {\n save_resource_url();\n\n return $this->view('resources.create_edit')\n ->with('resource', $resourceable)\n ->with('photos', $resourceable->photos)\n ->with('videos', $resourceable->videos)\n ->with('documents', $resourceable->documents);\n }", "function display($resource_name, $cache_id = null, $compile_id = null) {\n\t\t$this->_getResourceInfo($resource_name); // Saves resource info to a Smarty class var for debugging\n\t\t$_t3_fetch_result = $this->fetch($resource_name, tx_smarty_div::getCacheID($cache_id), $compile_id);\n if ($this->debugging) { // Debugging will have been evaluated in fetch\n require_once(SMARTY_CORE_DIR . 'core.display_debug_console.php');\n $_t3_fetch_result .= smarty_core_display_debug_console(array(), $this);\n }\n\t\treturn $_t3_fetch_result;\n\t}", "public function show(ResourceSubject $resourceSubject)\n {\n //\n }", "public function show(ResourceManagement $resourcesManagement)\n {\n //\n }", "public function viewEditResources()\n {\n $database = new Database();\n $id = $this->_params['id'];\n\n $resource = $database->getResourceById($id);\n\n $availableResource = new Resource($resource['ResourceID'], $resource['ResourceName'], $resource['Description']\n , $resource['ContactName'] , $resource['ContactEmail'] , $resource['ContactPhone'] ,\n $resource['Link'], $resource['active']);\n $this->_f3->set('Resource', $availableResource);\n\n echo Template::instance()->render('view/include/head.php');\n echo Template::instance()->render('view/include/top-nav.php');\n echo Template::instance()->render('view/edit-resources.php');\n echo Template::instance()->render('view/include/footer.php');\n }", "public function retrieve(Resource $resource);", "public function showResource($resouceable, $id)\n {\n $model_name = str_replace('-', ' ',ucwords($resouceable));\n $model_name = str_replace(' ', '',ucwords($model_name));\n\n $resource_type = 'App\\Models\\\\'.$model_name;\n $model = app($resource_type);\n $model = $model->find($id);\n\n return $this->showResourceable($model);\n }", "public function showAction(Ressource $ressource)\n {\n $deleteForm = $this->createDeleteForm($ressource);\n\n return $this->render('ressource/show.html.twig', array(\n 'ressource' => $ressource,\n 'delete_form' => $deleteForm->createView(),\n ));\n }", "public function show(Dispenser $dispenser)\n {\n //\n }", "public function show($id)\n {\n $resource = Resource::find($id);\n dd($resource);\n }", "public function displayAction() {\n\t\tif(is_numeric($this->req_id)) {\n\t\t\tAPI::DEBUG(\"[DefaultController::displayAction()] Getting \" . $this->req_id, 1);\n\t\t\t$this->_view->data['info'] = $this->_model->get($this->req_id);\n\t\t\t$this->_view->data['action'] = 'edit';\n\n\t\t} else {\n\t\t\t$this->_view->data['action'] = 'new';\n\t\t}\n\t\t// auto call the hooks for this module/action\n\t\terror_log(\"Should Call: \" . $this->module .\"/\".$this->action.\"/\".\"controller.php\");\n\t\tAPI::callHooks($this->module, $this->action, 'controller', $this);\n\n\t\t$this->addModuleTemplate($this->module, 'display');\n\n\t}", "public function show(NebulaResource $resource, $item): View\n {\n $this->authorize('view', $item);\n\n return view('nebula::resources.show', [\n 'resource' => $resource,\n 'item' => $item,\n ]);\n }", "public function resource(string $resource, string $controller): void\n {\n $base = $this->plural($resource);\n $entity = '/{'.$resource.'}';\n\n $this->app->get($base, $controller.'@index');\n $this->app->post($base, $controller.'@store');\n $this->app->get($base.$entity, $controller.'@show');\n $this->app->patch($base.$entity, $controller.'@update');\n $this->app->delete($base.$entity, $controller.'@destroy');\n }", "function displayCustom($resource_name, $cache_id = null, $compile_id = null)\n\t{\n\t return $this->display(DotbAutoLoader::existingCustomOne($resource_name), $cache_id, $compile_id);\n\t}", "public function show($id)\n {\n /* Check if logged in user is authorized to make this request */\n $this->authorizeAction();\n\n /* Get the specified resource */\n $resource = $this->model::findOrFail($id);\n\n /* Sets the view */\n if (view()->exists(\"admin.{$this->name}.show\")) {\n $view = \"admin.{$this->name}.show\";\n } else {\n $view = 'admin.includes.actions.show';\n }\n\n /* Displays the specified resource page */\n return view($view)\n ->with('resource', $resource)\n ->with('name', $this->name);\n }", "public function show($id)\n {\n $currentUser = JWTAuth::parseToken()->authenticate();\n $rules = [\n 'id' => 'required|integer'\n ];\n\n $validator = Validator::make(['id' => $id], $rules);\n if ($validator->fails()) {\n return APIHandler::response(0, $validator->errors(), 400);\n }\n $resource = $this->resourceRepository->fetchResource($id);\n $this->resourceRepository->storeView($id, $currentUser['id']);\n\n $data = [\n 'resource' => $resource,\n 'related_resources' => $this->resourceRepository->getResourcesRelatedTo($resource->id, $resource->mentoring_area_id)\n ];\n\n return APIHandler::response(1, \"Show Resource\", $data);\n }", "public function get(Resource $resource);", "public function showAction()\n {\n $model = $this->_getPhotoModel();\n $photo = $model->fetchEntry($this->getRequest()->getParam('id'));\n\n if (null === $photo) {\n return $this->_forward('notfound', 'error');\n }\n\n $this->view->auth = Zend_Auth::getInstance();\n $this->view->title = $photo->title;\n $this->view->photo = $photo;\n }", "public function show($id)\n {\n //\n $data=Resource::find($id);\n return view('resourceDetails',compact('data'));\n }", "function display() {\n\t\t$view = &$this->getView();\n\t\t$view->display();\n\t}", "public function show(ShowResourceRequest $request, $id)\n {\n // TODO: Implement show() method.\n }", "function show( $resource ){\n\n $where = \"reservation_status <> 'Pending' AND id = {$resource}\";\n $reservation = where( 'reservations', $where );\n $reservation = $reservation[0];\n\n return view('admin/reservation/preview_reservation', compact( 'reservation' ));\n}", "public function show()\n {\n if ($this->twig !== false) {\n $this->twigDefaultContext();\n if ($this->controller) {\n $this->controller->display($this->data);\n }\n echo $this->twig->render($this->twig_template, $this->data);\n } else {\n $filename = $this->findTemplatePath($this->template);\n require($filename);\n }\n }", "public function edit(Resource $resource)\n {\n //\n }", "public function show(rc $rc)\n {\n //\n }", "public function show(Resolucion $resolucion)\n {\n //\n }", "public function showAction(furTexture $furTexture)\n {\n\n return $this->render('furtexture/show.html.twig', array(\n 'furTexture' => $furTexture,\n ));\n }", "public function show()\n\t{\n\t\t//\n\t}", "public function show()\n\t{\n\t\t//\n\t}", "public function show()\n\t{\n\t\t//\n\t}", "public function show(Resena $resena)\n {\n }", "public function edit(Resource $resource)\n {\n return view('admin.resources.edit', compact('resource'));\n }", "public function showAction() {\n $docId = $this->getParam('id');\n\n // TODO verify parameter\n\n $document = new Opus_Document($docId);\n\n $this->_helper->layout()->disableLayout();\n\n $this->view->doc = $document;\n $this->view->document = new Application_Util_DocumentAdapter($this->view, $document);\n }", "public function action_display()\r\n\t{\r\n\t\t$event = ORM::factory('event', array('id' => $this->request->param('id')));\r\n\t\r\n\t\tif ( ! $event->loaded())\r\n\t\t{\r\n\t\t\tNotices::error('event.view.not_found');\r\n\t\t\t$this->request->redirect(Route::url('event'));\r\n\t\t}\r\n\t\t\r\n\t\t// Can user view this event?\r\n\t\tif ( ! $this->user->can('event_view', array('event' => $event)))\r\n\t\t{\r\n\t\t\t// Error notification\r\n\t\t\tNotices::error('event.view.not_allowed');\r\n\t\t\t$this->request->redirect(Route::url('event'));\r\n\t\t}\r\n\t\t\r\n\t\t// Pass event data to the view class\r\n\t\t$this->view->event_data = $event;\r\n\t\t$this->view->user = $this->user;\r\n\t}", "public function execute()\n {\n // HTTP Request Get\n if ($this->type == \"resource\") {\n $action = $this->getResourceAction();\n switch ($action) {\n case \"show\":\n $this->show();\n break;\n case \"create\":\n $this->create();\n break;\n case \"edit\":\n $this->edit();\n break;\n case \"destroy\":\n $this->destroy();\n break;\n default:\n echo $this->render();\n break;\n }\n } else {\n $action = $this->Request->action;\n switch ($action) {\n case \"show\":\n $this->show();\n break;\n case \"create\":\n $this->create();\n break;\n case \"edit\":\n $this->edit();\n break;\n case \"destroy\":\n $this->destroy();\n break;\n default:\n echo $this->render();\n break;\n }\n }\n }", "public function show(Resident $resident)\n {\n $this->authorize('admin.resident.show', $resident);\n\n // TODO your code goes here\n }", "public function display()\n {\n echo $this->getDisplay();\n $this->isDisplayed(true);\n }", "public function display()\n\t{\n\t\tparent::display();\n\t}", "public function get_resource();", "public function show()\n\t{\n\t\t\n\t}", "function display() {\n\n\t\t// Check authorization, abort if negative\n\t\t$this->isAuthorized() or $this->abortUnauthorized();\n\n\t\t// Get the view\n\t\t$view = $this->getDefaultView();\n\n\t\tif ($view == NULL) {\n\t\t\tthrow new Exception('Display task called, but there is no view assigned to that controller. Check method getDefaultView.');\n\t\t}\n\n\t\t$view->listing = true;\n\n\t\t// Wrap the output of the views depending on the way the stuff should be shown\n\t\t$this->wrapViewAndDisplay($view);\n\n\t}", "public function viewResources()\n {\n $database = new Database();\n\n $resources = $database->getAllActiveResourcesNoLimit();\n\n\n $resourceArray = array();\n $i = 1;\n\n foreach ($resources as $resource) {\n $availableResource = new Resource($resource['ResourceID'], $resource['ResourceName'], $resource['Description']\n , $resource['ContactName'] , $resource['ContactEmail'] , $resource['ContactPhone'] ,\n $resource['Link'], $resource['active']);\n array_push($resourceArray, $availableResource);\n $i += 1;\n }\n $resourceSize = sizeof($resourceArray);\n $this->_f3->set('resourcesByActive', $resourceArray);\n $this->_f3->set('resourcesSize', $resourceSize);\n echo Template::instance()->render('view/include/head.php');\n echo Template::instance()->render('view/include/top-nav.php');\n echo Template::instance()->render('view/resources.php');\n echo Template::instance()->render('view/include/footer.php');\n }", "public function show($id)\n {\n $this->title .= ' show';\n $this->one($id);\n }", "public function display($title = null)\n {\n echo $this->fetch($title);\n }", "public function display(){}", "public function show($id)\n\t{\n\t\t//\n\t\t//\n\t\n\t}", "public function viewAction()\n\t{\n\t\t//get Id param from request\n\t\tif (!$id = $this->_getParam('id')) {\n\t\t\t$this->getFlashMessenger()->addMessage('Product ID was not specified');\n\t\t\t$this->getRedirector()->gotoSimple('list');\n\t\t}\n\n\t\t//fetch requested ProductID from DB\n\t\tif (!$this->_model->fetch($id)) {\n\t\t\t$this->render('not-found');\n\t\t} else {\n\t\t\t$this->view->model = $this->_model;\n\t\t}\n\t}", "public function show($id)\n {\n // Get single person\n $person = Person::findOrFail($id);\n\n // Return single person as a resource\n return '<h1>Person Number '.$id.'</h1><br>'.json_encode(new PersonResource($person));\n }", "#[TODO] use self object?\n\tprotected function GET(ResourceObject $resource) {\n#[TODO]\t\tif ($resource->getMTime())\n#[TODO]\t\t\t$this->response->headers->set('Last-modified', gmdate('D, d M Y H:i:s ', $resource->getMTime()) . 'GMT');\n#[TODO]\t\tif ($resource->getCTime())\n#[TODO]\t\t\t$this->response->headers->set('Date', gmdate('D, d M Y H:i:s ', $resource->getCTime()) . 'GMT');\n\n\n#[TODO] handle file streams\n\t\t// get ranges\n#\t\t$ranges = WebDAV::getRanges($this->request, $this->response);\n\n\t\t// set the content of the response\n\t\tif ($resource instanceof ResourceDocument) {\n\t\t\t$this->response->content->set($resource->getContents());\n\t\t\t$this->response->content->setType($resource->getMIMEType());\n\t\t\t$this->response->content->encodeOnSubmit(true);\n\t\t}\n\t}", "public function display() {\n echo $this->render();\n }", "public function show($id)\n\t{\n\t//\n\t}", "public function show($id)\n\t{\n\t//\n\t}", "function Fetch($resource_name, $cache_id = null, $compile_id = null, $display = false)\n {\n return $this->_smarty->fetch($resource_name, $cache_id, $compile_id, $display);\n }", "public function show($id)\n {\n //\n $this->_show($id);\n }", "public function show()\n\t{\n\n\t}", "public function show($id) {\n\t\t//\n\t}", "public function show($id) {\n\t\t//\n\t}", "public function show($id) {\n\t\t//\n\t}", "public function show($id) {\n\t\t//\n\t}", "public function show($id) {\n\t\t//\n\t}", "public function show($id) {\n\t\t//\n\t}", "public function show($id) {\n\t\t//\n\t}", "public function show($id) {\n\t\t//\n\t}", "public function show($id) {\n\t\t//\n\t}", "public function show($id) {\n\t\t//\n\t}", "public function show($id) {}", "static public function showCallback(O_Dao_Renderer_Show_Params $params) {\r\n\t\t/* @var $r R_Mdl_Resource */\r\n\t\t$r = $params->record();\r\n\t\t// Setting layout title\r\n\t\t$params->layout()->setTitle($r->getPageTitle());\r\n\r\n?><h1><?=$r->title?></h1><div id=\"resource\"><?\r\n\t\tif($r->getContent()) {\r\n\t\t\t// page has its own content -- show it\r\n\t\t\t$r->getContent()->show($params->layout(), \"content\");\r\n\t\t} else {\r\n\t\t\t// It is a post unit, show all childs\r\n\t\t\tif($r->is_unit == 1) {\r\n\t\t\t\t$r->addQueryAccessChecks($r->getChilds(1))->show($params->layout(), \"content\");\r\n\r\n\t\t\t// It is a folder with several units, show paginator\r\n\t\t\t} elseif($r->show_def == \"last-units\") {\r\n\t\t\t\tlist($type, $perpage) = explode(\":\", $r->show_def_params);\r\n\t\t\t\t/* @var $p O_Dao_Paginator */\r\n\t\t\t\t$p = $r->addQueryAccessChecks($r->getChilds())->test(\"is_unit\", 1)->getPaginator(array($r, \"getPageUrl\"), $perpage);\r\n\t\t\t\t$p->show($params->layout(), $type);\r\n\t\t\t// It is a folder with subfolders, boxes, contents. Show one childs level\r\n\t\t\t} else {\r\n\t\t\t\t$r->addQueryAccessChecks($r->getChilds(1))->show($params->layout(), \"on-parent-page\");\r\n\t\t\t}\r\n\r\n\t\t}\r\n?></div><?\r\n\t}", "public function show($id)\r\n\t{\r\n\t\t//\r\n\r\n\r\n\r\n\t}", "public function show($resourceId, $eventId)\n {\n $routes = $this->routes;\n\n $eventable = $this->getEventableRepository()->model()->findOrFail($resourceId);\n\n if (method_exists($eventable, 'events')) {\n $event = $eventable->events()->find($eventId);\n\n if ($event) {\n $apiObject = $this->event->findApiObject($event->api_id);\n\n return view('events.eventables.show', compact('routes', 'eventable', 'event', 'apiObject'));\n }\n }\n\n abort(404);\n }", "public abstract function display();", "abstract public function resource($resource);", "public function show($id)\r\r\n\t{\r\r\n\t\t//\r\r\n\t}", "public function show( $id ) {\n\t\t//\n\t}", "public function show( $id ) {\n\t\t//\n\t}", "public function show(Response $response)\n {\n //\n }", "public function show()\n {\n return auth()->user()->getResource();\n }", "public function show($id)\n\t{\n\t\t//\n\t}", "public function show($id)\n\t{\n\t\t//\n\t}", "public function show($id)\n\t{\n\t\t//\n\t}", "public function show($id)\n\t{\n\t\t//\n\t}", "public function show($id)\n\t{\n\t\t//\n\t}", "public function show($id)\n\t{\n\t\t//\n\t}", "public function show($id)\n\t{\n\t\t//\n\t}", "public function show($id)\n\t{\n\t\t//\n\t}", "public function show($id)\n\t{\n\t\t//\n\t}", "public function show($id)\n\t{\n\t\t//\n\t}", "public function show($id)\n\t{\n\t\t//\n\t}", "public function show($id)\n\t{\n\t\t//\n\t}", "public function show($id)\n\t{\n\t\t//\n\t}", "public function show($id)\n\t{\n\t\t//\n\t}", "public function show($id)\n\t{\n\t\t//\n\t}", "public function show($id)\n\t{\n\t\t//\n\t}", "public function show($id)\n\t{\n\t\t//\n\t}", "public function show($id)\n\t{\n\t\t//\n\t}", "public function show($id)\n\t{\n\t\t//\n\t}", "public function show($id)\n\t{\n\t\t//\n\t}", "public function show($id)\n\t{\n\t\t//\n\t}", "public function show($id)\n\t{\n\t\t//\n\t}" ]
[ "0.8233718", "0.8190437", "0.6828712", "0.64986944", "0.6495974", "0.6469629", "0.6462615", "0.6363665", "0.6311607", "0.62817234", "0.6218966", "0.6189695", "0.61804265", "0.6171014", "0.61371076", "0.61207956", "0.61067593", "0.6105954", "0.6094066", "0.6082806", "0.6045245", "0.60389996", "0.6016584", "0.598783", "0.5961788", "0.59606946", "0.5954321", "0.59295714", "0.59182066", "0.5904556", "0.59036547", "0.59036547", "0.59036547", "0.5891874", "0.58688277", "0.5868107", "0.58676815", "0.5851883", "0.58144855", "0.58124036", "0.58112013", "0.5803467", "0.58012545", "0.5791527", "0.57901084", "0.5781528", "0.5779676", "0.5757105", "0.5756208", "0.57561266", "0.57453394", "0.57435393", "0.57422745", "0.5736634", "0.5736634", "0.5730559", "0.57259274", "0.5724891", "0.5722562", "0.5722562", "0.5722562", "0.5722562", "0.5722562", "0.5722562", "0.5722562", "0.5722562", "0.5722562", "0.5722562", "0.5718969", "0.5713412", "0.57091093", "0.5706405", "0.57057405", "0.5704541", "0.5704152", "0.57026845", "0.57026845", "0.56981397", "0.5693083", "0.5684962", "0.5684962", "0.5684962", "0.5684962", "0.5684962", "0.5684962", "0.5684962", "0.5684962", "0.5684962", "0.5684962", "0.5684962", "0.5684962", "0.5684962", "0.5684962", "0.5684962", "0.5684962", "0.5684962", "0.5684962", "0.5684962", "0.5684962", "0.5684962", "0.5684962" ]
0.0
-1
Show the form for editing the specified resource.
public function edit($id) { $event = Event::FindOrFail($id); return view ('edit', ['event' => $event]); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function edit(Resource $resource)\n {\n return view('admin.resources.edit', compact('resource'));\n }", "public function edit(Resource $resource)\n {\n //\n }", "public function edit($id)\n {\n /* Check if logged in user is authorized to make this request */\n $this->authorizeAction();\n\n /* Get the specified resource */\n $resource = $this->model::findOrFail($id);\n\n /* Sets the view */\n if (view()->exists(\"admin.{$this->name}.edit\")) {\n $view = \"admin.{$this->name}.edit\";\n } else {\n $view = 'admin.includes.actions.edit';\n }\n\n /* Displays the edit resource page */\n return view($view)\n ->with('resource', $resource)\n ->with('name', $this->name);\n }", "public function edit(NebulaResource $resource, $item): View\n {\n $this->authorize('update', $item);\n\n return view('nebula::resources.edit', [\n 'resource' => $resource,\n 'item' => $item,\n ]);\n }", "public function edit() {\r\n $id = $this->api->getParam('id');\r\n\r\n if ($id) {\r\n $this->model->id = $id;\r\n $this->checkOwner();\r\n }\r\n $object = $this->model->find_by_id($id);\r\n\r\n $this->api->loadView('contact-form', array('row' => $object));\r\n }", "public function viewEditResources()\n {\n $database = new Database();\n $id = $this->_params['id'];\n\n $resource = $database->getResourceById($id);\n\n $availableResource = new Resource($resource['ResourceID'], $resource['ResourceName'], $resource['Description']\n , $resource['ContactName'] , $resource['ContactEmail'] , $resource['ContactPhone'] ,\n $resource['Link'], $resource['active']);\n $this->_f3->set('Resource', $availableResource);\n\n echo Template::instance()->render('view/include/head.php');\n echo Template::instance()->render('view/include/top-nav.php');\n echo Template::instance()->render('view/edit-resources.php');\n echo Template::instance()->render('view/include/footer.php');\n }", "public function edit()\n {\n return view('hirmvc::edit');\n }", "public function editformAction(){\n\t\t$this->loadLayout();\n $this->renderLayout();\n\t}", "public function edit() {\n $id = $this->parent->urlPathParts[2];\n // pass name and id to view\n $data = $this->parent->getModel(\"fruits\")->select(\"select * from fruit_table where id = :id\", array(\":id\"=>$id));\n $this->getView(\"header\", array(\"pagename\"=>\"about\"));\n $this->getView(\"editForm\", $data);\n $this->getView(\"footer\");\n }", "public function edit($id)\n\t{\n\t\treturn $this->showForm('update', $id);\n\t}", "public function edit($id)\n {\n $model = $this->modelObj;\n $formObj = $model::findOrFail($id);\n $data['formObj'] = $formObj;\n return view($this->veiw_base . '.edit', $data);\n }", "public function createEditForm(Resourceperson $entity){\n \n $form = $this->createForm(new ResourcepersonType(), $entity, array(\n 'action' => $this->generateUrl('rsp_update', array('id' => $entity->getRpId())),\n 'method' => 'PUT',\n ));\n\n $form->add('submit', 'submit', array('label' => 'Update','attr'=> array(\n 'class'=>'btn btn primary'\n )));\n\n return $form;\n }", "private function createEditForm(Resource $entity)\n {\n $form = $this->createForm(new ResourceType(), $entity, array(\n 'action' => $this->generateUrl('social_admin_resource_update', array('id' => $entity->getId())),\n 'method' => 'PUT',\n ));\n\n $form->add('submit', 'submit', array('label' => '保存','attr'=>[\n 'class'=>'btn btn-primary'\n ]));\n\n return $form;\n }", "public function edit($id)\n {\n return $this->showForm('update', $id);\n }", "public function edit($id)\n {\n return $this->showForm('update', $id);\n }", "public function editAction()\n {\n if ($form = $this->processForm()) {\n if ($this->useTabbedForms && method_exists($this, 'getSubject')) {\n $data = $this->getModel()->loadFirst();\n $subject = $this->getSubject($data);\n $this->setPageTitle(sprintf($this->_('Edit %s %s'), $this->getTopic(1), $subject));\n } else {\n $this->setPageTitle(sprintf($this->_('Edit %s'), $this->getTopic(1)));\n }\n $this->html[] = $form;\n }\n }", "public function edit($id)\n {\n $this->data['entity'] = GS_Form::where('id', $id)->firstOrFail();\n return view('admin.pages.forms.edit', $this->data);\n }", "public function edit($id)\n\t{\n\t\t// get the fbf_presenca\n\t\t$fbf_presenca = FbfPresenca::find($id);\n\n\t\t\n\t\t// show the edit form and pass the fbf_presenca\n\t\t$this->layout->content = View::make('fbf_presenca.edit')\n->with('fbf_presenca', $fbf_presenca);\n\t}", "public function edit($id)\n {\n $data = $this->model->find($id);\n\n return view('admin.backends.employee.form.edit',compact('data'));\n }", "public function edit($model, $form);", "function edit() {\n\t\tglobal $tpl;\n\n\t\t$form = $this->initForm();\n\t\t$tpl->setContent($form->getHTML());\n\t}", "public function edit($id)\n\t{\n\t\t$faith = Faith::find($id);\n \n return view('faith.form')->with('faith', $faith);\n\n\t}", "public function edit()\n { \n return view('admin.control.edit');\n }", "public function edit(Form $form)\n {\n //\n }", "public function edit()\n {\n return view('common::edit');\n }", "public function edit($id)\n {\n $resource = (new AclResource())->AclResource;\n $roleResource = AclRole::where('role', $id)->get(['resource'])->toArray();\n $roleResource = Arr::pluck($roleResource, 'resource');\n return view('Admin.acl.role.form', [\n 'role' => $id,\n 'resource' => $resource,\n 'roleResource' => $roleResource,\n ]);\n }", "public function edit()\n {\n return view('admin::edit');\n }", "public function edit()\n {\n return view('admin::edit');\n }", "public function edit()\r\n {\r\n return view('petro::edit');\r\n }", "public function edit($id)\n {\n // show form edit user info\n }", "public function edit()\n {\n return view('escrow::edit');\n }", "public function edit($id)\n {\n $resource = ResourceManagement::find($id);\n\n $users = User::get();\n // Redirect to user list if updating user wasn't existed\n if ($resource == null || $resource->count() == 0) {\n return redirect()->intended('/resource-management');\n }\n\n return view('resources-mgmt/edit', ['resource' => $resource, 'users' => $users]);\n }", "public function edit()\n {\n return view('commonmodule::edit');\n }", "public function editAction()\n\t{\n\t\t$params = $this->data->getParams();\n\t\t$params = $this->valid->clearDataArr($params);\n\t\tif (isset($params['id']))\n\t\t{\n\t\t\t$this->employee->setFlag(true);\n\t\t}\n\t\tif (isset($_POST['submit']))\n\t\t{\n\t\t\t$action = $this->valid->clearDataArr($_POST);\n\t\t\t$this->employee->setDataArray($action);\n\t\t\theader('Location: ' . PATH . 'Employee/index/', true, 303);\n\t\t}\n\t\t$employee = $this->employee->setAction('edit');\n\t\t$this->view->addToReplace($employee);\n\t\t$this->listEmployee();\n\t\t$this->arrayToPrint();\n\t}", "public function edit()\n {\n return view('catalog::edit');\n }", "public function edit()\n {\n return view('catalog::edit');\n }", "public function edit(form $form)\n {\n //\n }", "public function actionEdit($id) { }", "public function edit()\n {\n return view('admincp::edit');\n }", "public function edit()\n {\n return view('scaffold::edit');\n }", "public function edit($id)\n {\n $header = \"Edit\";\n\t\t$data = Penerbit::findOrFail($id);\n\t\treturn view('admin.penerbit.form', compact('data','header'));\n }", "public function edit()\n {\n return view('Person.edit');\n }", "public function edit($id)\n {\n $data = Form::find($id);\n return view('form.edit', compact('data'));\n }", "public function edit($id)\n\t{\n\t\t$career = $this->careers->findById($id);\n\t\treturn View::make('careers._form', array('career' => $career, 'exists' => true));\n\t}", "public function edit(Flight $exercise, FlightResource $resource)\n {\n return $this->viewMake('adm.smartcars.exercise-resources.edit')\n ->with('flight', $exercise)\n ->with('resource', $resource);\n }", "public function edit($id)\n\t{\n\t\t// get the material\n\t\t$material = Material::find($id);\n\n\t\t// show the edit form and pass the material\n\t\t$this->layout->content = View::make('material.edit')\n\t\t\t->with('material', $material);\n\t}", "public function edit($id, Request $request)\n {\n $formObj = $this->modelObj->find($id);\n\n if(!$formObj)\n {\n abort(404);\n } \n\n $data = array();\n $data['formObj'] = $formObj;\n $data['page_title'] = \"Edit \".$this->module;\n $data['buttonText'] = \"Update\";\n\n $data['action_url'] = $this->moduleRouteText.\".update\";\n $data['action_params'] = $formObj->id;\n $data['method'] = \"PUT\"; \n\n return view($this->moduleViewName.'.add', $data);\n }", "public function edit()\n {\n $id = $this->getId();\n return view('panel.user.form', [\n 'user' => $this->userRepository->findById($id),\n 'method' => 'PUT',\n 'routePrefix' => 'profile',\n 'route' => 'profile.update',\n 'parameters' => [$id],\n 'breadcrumbs' => $this->getBreadcrumb('Editar')\n ]);\n }", "public function edit()\r\n {\r\n return view('mpcs::edit');\r\n }", "function edit()\n\t{\n\t\t// hien thi form sua san pham\n\t\t$id = getParameter('id');\n\t\t$product = $this->model->product->find_by_id($id);\n\t\t$this->layout->set('auth_layout');\n\t\t$this->view->load('product/edit', [\n\t\t\t'product' => $product\n\t\t]);\n\t}", "public function edit($id)\n {\n //\n $data = Diskon::find($id);\n\n $form = $this->form;\n $edit = $this->edit;\n $field = $this->field;\n $page = $this->page;\n $id = $id;\n $title = $this->title;\n return view('admin/page/'.$this->page.'/edit',compact('form','edit','data','field','page','id','title'));\n }", "public function edit($id)\n {\n return $this->showForm($id);\n }", "public function edit($id)\n {\n return $this->showForm($id);\n }", "protected function _edit(){\n\t\treturn $this->_editForm();\n\t}", "public function editAction()\n {\n $robot = Robots::findFirst($this->session->get(\"robot-id\"));\n if ($this->request->isGet()) {\n $this->tag->prependTitle(\"Редактировать робота :: \");\n $user = $this->session->get(\"auth-id\");\n if (!$robot) {\n $this->flashSession->error(\n \"Робот не найден\"\n );\n return $this->response->redirect(\"users/usershow/$user->name\");\n }\n\n }\n\n $this->view->form = new RobotForm(\n $robot,\n [\n \"edit\" => true,\n ]\n );\n }", "public function editAction()\n {\n $form = new $this->form();\n\n $request = $this->getRequest();\n $param = $this->params()->fromRoute('id', 0);\n\n $repository = $this->getEm()->getRepository($this->entity);\n $entity = $repository->find($param);\n\n if ($entity) {\n\n $form->setData($entity->toArray());\n\n if ( $request->isPost() ) {\n\n $form->setData($request->getPost());\n\n if ( $form->isValid() ) {\n\n $service = $this->getServiceLocator()->get($this->service);\n $service->update($request->getPost()->toArray());\n\n return $this->redirect()->toRoute($this->route, array('controller' => $this->controller));\n }\n }\n } else {\n return $this->redirect()->toRoute($this->route, array('controller' => $this->controller));\n }\n\n return new ViewModel(array('form' => $form, 'id' => $param));\n\n }", "public function edit($id)\n\t{\n\t\t$SysApplication = \\Javan\\Dynaflow\\Domain\\Model\\SysApplication::find($id);\n\t\t$form = \\FormBuilder::create('Javan\\Dynaflow\\FormBuilder\\SysApplicationForm', [\n \t'method' => 'POST',\n \t'url' => 'sysapplication/update/'.$id,\n \t'model' => $SysApplication,\n \t'data' => [ 'flow_id' => $SysApplication->flow_id]\n \t]);\n\t\treturn View::make('dynaflow::sysapplication.form', compact('form', 'SysApplication'));\n\t}", "public function editAction() {\n\t\t$id = (int) $this->_getParam('id');\n\t\t$modelName = $this->_getParam('model');\n\t\t\n\t\t$model = Marcel_Backoffice_Model::factory($modelName);\n\t\t$item = $model->find($id)->current();\n\t\tif (!$item) {\n\t\t\t$item = $model->createRow();\n\t\t}\n\t\t$form = $item->getForm();\n\t\tif ($this->_request->isPost()) {\n\t\t\t$newId = $form->populate($this->_request->getPost())->save();\n\t\t\tif ($newId) {\n\t\t\t\t$this->_helper->flashMessenger('Saved successfully!');\n\t\t\t\t$this->_helper->redirector('edit', null, null, array('id' => $newId, 'model' => $modelName));\n\t\t\t}\n\t\t}\n\t\t$this->view->form = $form;\n\t\t$this->view->messages = $this->_helper->flashMessenger->getMessages();\n\t}", "public function edit($id)\n {\n return view('models::edit');\n }", "public function edit()\n {\n return view('home::edit');\n }", "public function editAction()\n {\n $id = $this->params()->fromRoute('id');\n $entity = $this->entityManager->find(Entity\\CourtClosing::class, $id);\n if (! $entity) {\n // to do: deal with it\n }\n $form = $this->getForm('update');\n $form->bind($entity);\n if ($this->getRequest()->isPost()) {\n return $this->post();\n }\n\n return new ViewModel(['form' => $form]);\n }", "public function editAction($id)\n {\n $entity = $this->getManager()->find($id);\n\n $breadcrumbs = $this->get(\"white_october_breadcrumbs\");\n $breadcrumbs->addItem('Inicio', $this->get('router')->generate('admin.homepage'));\n $breadcrumbs->addItem($this->entityDescription, $this->get(\"router\")->generate(\"admin.$this->entityName.index\"));\n $breadcrumbs->addItem('Editar');\n\n if (!$entity) {\n throw $this->createNotFoundException('No se ha encontrado el elemento');\n }\n\n $form = $this->getForm($entity);\n\n return $this->render('AdminBundle:Default:edit.html.twig', array(\n 'entity' => $entity,\n 'form' => $form->createView(),\n 'metadata' => $this->getMetadata()\n ));\n }", "public function edit()\n {\n return view('user::edit');\n }", "public function edit()\n {\n return view('user::edit');\n }", "public function edit(Form $form)\n {\n return view('admin.forms.edit', compact('form'));\n }", "public function editAction()\n {\n $form = MediaForm::create($this->get('form.context'), 'media');\n $media = $this->get('media_manager.manager')->findOneById($this->get('request')->get('media_id'));\n \n $form->bind($this->get('request'), $media);\n \n return $this->render('MediaManagerBundle:Admin:form.html.twig', array('form' => $form, 'media' => $media));\n }", "public function editAction($id) {\n $em = $this->getDoctrine()->getManager();\n\n $entity = $em->getRepository('CdlrcodeBundle:Question')->find($id);\n\n if (!$entity) {\n throw $this->createNotFoundException('Unable to find Question entity.');\n }\n\n $editForm = $this->createEditForm($entity);\n $deleteForm = $this->createDeleteForm($id);\n\n return $this->render('CdlrcodeBundle:Question:edit.html.twig', array(\n 'entity' => $entity,\n 'edit_form' => $editForm->createView(),\n 'delete_form' => $deleteForm->createView(),\n ));\n }", "public function edit($id)\n {\n return view('consultas::edit');\n }", "public function edit(DirectorFormBuilder $form, $id)\n {\n return $form->render($id);\n }", "public function edit()\n {\n return view('dashboard::edit');\n }", "public function edit($id){\n $rfid = Rfid::find($id);\n\n //load form view\n return view('rfids.edit', ['rfid' => $rfid]);\n }", "public function edit($id)\n {\n\n // retrieve provider\n $provider = Provider::findOrFail($id);\n\n // return form with provider\n return view('backend.providers.form')->with('provider', $provider);\n }", "public function edit(Question $question)\n {\n $this->employeePermission('application' , 'edit');\n $question->chooses;\n $action = 'edit';\n return view('admin.setting.question_form', compact('action' , 'question'));\n }", "public function edit() {\n return view('routes::edit');\n }", "public function edit($id)\n {\n $this->data['product'] = Product::find($id);\n $this->data['category'] = Category::arrForSelect();\n $this->data['title'] = \" Update Prouct Details\";\n $this->data['mode'] = \"edit\";\n\n return view('product.form', $this->data);\n }", "public function edit(ClueEnFormBuilder $form, $id): Response\n {\n return $form->render($id);\n }", "public function editAction($id)\n {\n $em = $this->getDoctrine()->getManager();\n\n $entity = $em->getRepository('BaseBundle:Feriado')->find($id);\n\n if (!$entity) {\n throw $this->createNotFoundException('Unable to find Feriado entity.');\n }\n\n $editForm = $this->createEditForm($entity);\n $deleteForm = $this->createDeleteForm($id);\n\n return $this->render('BaseBundle:Feriado:edit.html.twig', array(\n 'entity' => $entity,\n 'edit_form' => $editForm->createView(),\n 'delete_form' => $deleteForm->createView(),\n ));\n }", "public function edit($id)\n {\n return view('cataloguemodule::edit');\n }", "public function edit($articulo_id)\n {\n $titulo = \"Editar\";\n return View(\"articulos.formulario\",compact('titulo','articulo_id'));\n }", "public function edit($id)\n {\n $resources = User::find(session('usuario_id'))->resources;\n $languages = Language::pluck('name', 'id');\n $types = Type::pluck('name', 'id');\n $method = 'PATCH';\n\n $recurso = Resource::find($id);\n $url = \"/resource/$recurso->id\";\n\n return view('resources.resources', compact('resources', 'languages', 'types', 'method', 'url', 'recurso'));\n }", "public function edit(Question $question)\n {\n $edit = TRUE;\n return view('questionForm', ['question' => $question, 'edit' => $edit]);\n }", "public function displayEditForm(Employee $employee){\n return view('employee.displayEditForm',['employee'=>$employee]);\n }", "public function edit()\n {\n return view('website::edit');\n }", "public function edit()\n {\n return view('inventory::edit');\n }", "public function edit()\n {\n return view('initializer::edit');\n }", "public function editAction()\n {\n View::renderTemplate('Profile/edit.html', [\n 'user' => $this->user\n ]);\n }", "public function edit($id)\n {\n return view('backend::edit');\n }", "public function edit($id)\n {\n //dd($id);\n $familiaPrograma= FamiliaPrograma::findOrFail($id);\n return view('familiasPrograma.edit', compact('familiaPrograma'));\n }", "public function edit($id)\n {\n return view('crm::edit');\n }", "public function edit($id)\n {\n return view('crm::edit');\n }", "public function edit($id)\n {\n $user = User::where('id', $id)->first();\n\n\n return view('users.forms.update', compact('user'));\n }", "public function editAction($id)\n\t{\n\t\t$school = School::find( $id );\n\t\t$this->render( View::make( 'schools/form' , array(\n\t\t\t'title' => sprintf( 'Modifier \"%s\"', $school->name ),\n\t\t\t'entity' => $school\n\t\t) ) );\n\t}", "public function edit(Question $question)\n {\n $edit = TRUE;\n return view('questionForm', ['question' => $question, 'edit' => $edit ]);\n }", "public function edit(Person $person) {\n\t\t$viewModel = new PersonFormViewModel();\n\t\treturn view('person.form', $viewModel);\n\t}", "public function edit($id)\n {\n \t$product = Product::find($id);\n \treturn view('admin.products.edit')->with(compact('product')); // formulario de actualizacion de datos del producto\n }", "public function edit_person($person_id){\n \t$person = Person::find($person_id);\n \treturn view('resource_detail._basic_info.edit',compact('person'));\n }", "public function edit($id)\n {\n $professor = $this->repository->find($id);\n return view('admin.professores.edit',compact('professor'));\n }", "public function edit($id)\n {\n $data = Restful::find($id);\n return view('restful.edit', compact('data'));\n }", "public function editAction($id)\n {\n $em = $this->getDoctrine()->getManager();\n\n $entity = $em->getRepository('MedecinIBundle:Fichepatient')->find($id);\n\n if (!$entity) {\n throw $this->createNotFoundException('Unable to find Fichepatient entity.');\n }\n\n $editForm = $this->createEditForm($entity);\n $deleteForm = $this->createDeleteForm($id);\n\n return $this->render('MedecinIBundle:Fichepatient:edit.html.twig', array(\n 'entity' => $entity,\n 'edit_form' => $editForm->createView(),\n 'delete_form' => $deleteForm->createView(),\n ));\n }", "public function edit($id)\n {\n return $this->form->render('mconsole::personal.form', [\n 'item' => $this->person->query()->with('uploads')->findOrFail($id),\n ]);\n }", "public function edit($id)\n\t{\n\t\t // get the project\n $project = Project::find($id);\n\n // show the edit form and pass the project\n return View::make('logicViews.projects.edit')->with('project', $project);\n\t}" ]
[ "0.78550774", "0.7692893", "0.7273195", "0.7242132", "0.7170847", "0.70622855", "0.7053459", "0.6982539", "0.69467914", "0.6945275", "0.6941114", "0.6928077", "0.69019294", "0.68976134", "0.68976134", "0.6877213", "0.68636996", "0.68592185", "0.68566656", "0.6844697", "0.68336326", "0.6811471", "0.68060875", "0.68047357", "0.68018645", "0.6795623", "0.6791791", "0.6791791", "0.6787701", "0.67837197", "0.67791027", "0.677645", "0.6768301", "0.6760122", "0.67458534", "0.67458534", "0.67443407", "0.67425704", "0.6739898", "0.6735328", "0.6725465", "0.6712817", "0.6693891", "0.6692419", "0.6688581", "0.66879624", "0.6687282", "0.6684741", "0.6682786", "0.6668777", "0.6668427", "0.6665287", "0.6665287", "0.66610634", "0.6660843", "0.66589665", "0.66567147", "0.66545695", "0.66527975", "0.6642529", "0.6633056", "0.6630304", "0.6627662", "0.6627662", "0.66192114", "0.6619003", "0.66153085", "0.6614968", "0.6609744", "0.66086483", "0.66060555", "0.6596137", "0.65950733", "0.6594648", "0.65902114", "0.6589043", "0.6587102", "0.65799844", "0.65799403", "0.65799177", "0.657708", "0.65760696", "0.65739626", "0.656931", "0.6567826", "0.65663105", "0.65660435", "0.65615267", "0.6561447", "0.6561447", "0.65576506", "0.655686", "0.6556527", "0.6555543", "0.6555445", "0.65552044", "0.65543956", "0.65543705", "0.6548264", "0.65475875", "0.65447706" ]
0.0
-1
Update the specified resource in storage.
public function update(Request $request) { $data = $request->all(); // Image Upload if($request->hasFile('image') && $request->file('image')->isValid()) { $requestImage = $request->image; $extension = $requestImage->extension(); $imageName = md5($requestImage->getClientOriginalName() . strtotime("now")) . "." . $extension; $requestImage->move(public_path('img/events'), $imageName); $data['image'] = $imageName; } Event::findOrFail($request->id)->update($data); return redirect('/dashboard')->with('msg', 'Evento editado com sucesso!'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function updateShopifyResource() {\n $this->saving();\n $this->getShopifyApi()->call([\n 'URL' => API::PREFIX . $this->getApiPathSingleResource(),\n 'METHOD' => 'PUT',\n 'DATA' => [\n static::getResourceSingularName() => $this->shopifyData\n ]\n ]);\n }", "public function update(Request $request, Resource $resource)\n {\n $request->validate([\n 'name' => 'required',\n 'description' => 'required|string',\n 'file' => 'required|mimes:jpg,jpeg,png,doc,docx,pdf,ppt,txt',\n ]);\n\n $resource->update($request->all());\n\n if ( $request->hasFile('file') ) {\n $resource = 'resource-'.time().'.'.$request->file('file')->extension();\n $request->file->storeAs('resources', $resource,'public');\n $resource->file = $resource;\n }\n\n if ( $resource->save() ) {\n return redirect()->route('admin.resources.index')->with('success', 'Resource updated');\n } else {\n return redirect()->route('admin.resources.index')->with('error', 'Something went wrong');\n }\n }", "public function update(Request $request, Resource $resource)\n {\n //\n }", "public function updateStream($resource);", "public function update(Request $request, Storage $storage)\n {\n $storage->product_id = $request->product_id;\n $storage->amount = $request->amount;\n\n $storage->save();\n\n return redirect()->route('storages.index');\n }", "protected function updateImageResource($fileName, $imageId, $storage)\n {\n //Get image name and storage location for image\n $image = Image::where('id', '=', $imageId)->first();\n\n //Delete old image\n $this->deleteResource($image->name, $image->storage);\n\n //Store the new image\n $image->name = $fileName;\n $image->storage = $storage;\n\n $image->save();\n }", "public function update(Storage $storage, UpdateStorageRequest $request)\n {\n $this->storage->update($storage, $request->all());\n\n return redirect()->route('admin.product.storage.index')\n ->withSuccess(trans('core::core.messages.resource updated', ['name' => trans('product::storages.title.storages')]));\n }", "public function update(StoreStorage $request, Storage $storage)\n {\n $storage->fill($request->all())->save();\n $request->session()->flash('alert-success', 'Запись успешно обновлена!');\n return redirect()->route('storage.index');\n }", "public function update_asset($id, Request $request){\n \t\tif(!Auth::user()){\n\t\t\treturn redirect('/');\n\t\t}\n \t\t$asset = Storage::find($id);\n \t\t$asset->name = $request->name;\n \t\t$asset->quantity = $request->quantity;\n \t\t$asset->category_id = $request->category;\n \t\tif($request->file('image') != null){\n\t\t\t$image = $request->file('image');\n\t\t\t$image_name = time(). \".\" . $image->getClientOriginalExtension();\n\t\t\t$destination = \"images/\";\n\t\t\t$image->move($destination, $image_name);\n\t\t\t$asset->image_url = $destination.$image_name;\n\t\t} \n\t\t$asset->save();\n\t\tsession()->flash('success_message', 'Item Updated successfully');\n\t\treturn redirect(\"/storage\");\n \t}", "public function update(Request $request, Flight $exercise, FlightResource $resource)\n {\n $request->validate([\n 'display_name' => 'required|string|max:100',\n 'file' => 'nullable|file|max:10240|mimes:pdf',\n 'uri' => 'nullable|url|max:255',\n ]);\n\n if ($resource->type === 'file' && $request->file('file')) {\n Storage::drive('public')->delete($resource->resource);\n $resource->resource = $request->file('file')->store('smartcars/exercises/resources', ['disk' => 'public']);\n } elseif ($resource->type === 'uri' && $request->input('uri')) {\n $resource->resource = $request->input('uri');\n }\n\n $resource->save();\n\n return redirect()->route('adm.smartcars.exercises.resources.index', $exercise)\n ->with('success', 'Resource edited successfully.');\n }", "public function update(Request $request, $id)\n {\n $validator = Validator::make($request->all(), [\n 'title' => 'required|string',\n 'content' => 'required|string',\n 'mentoring_area_id' => 'required|integer',\n 'featured_image_uri' => 'string',\n ]);\n\n if ($validator->fails()) {\n return APIHandler::response(0, $validator->errors(), 400);\n }\n \n $resource = Resource::find($id);\n $resource->title = $request->get('title');\n $resource->content = $request->get('content');\n $resource->featured_image_uri = $request->get('featured_image_uri');\n $resource->updated_at = \\Carbon\\Carbon::now();\n $resource->mentoring_area_id = $request->get('mentoring_area_id');\n $resource->save();\n $data['resource'] = $resource;\n return APIHandler::response(1, \"Resource has been updated\");\n }", "protected function updateVideoResource($fileName, $videoId, $storage, $premium=1)\n {\n //Get video name and storage location for video\n $video = Video::where('id', '=', $videoId)->first();\n\n //Check the storage medium\n if($storage == 'vimeo' || $storage == 'youtube')\n {\n $video->name = $fileName;\n $video->storage = $storage;\n $video->premium = $premium;\n $video->save();\n }\n else\n {\n if($video['storage'] == 'local' || $video['storage'] == 's3')\n {\n //Delete old video\n $this->deleteResource($video->name, $video->storage);\n }\n \n //Store the new video\n $video->name = $fileName;\n $video->storage = $storage;\n $video->premium = $premium;\n $video->save();\n }\n }", "public function put($resource, $with=[]){\n return $this->fetch($resource, self::PUT, $with);\n }", "public function update($id, $resource) {\n SCA::$logger->log(\"update resource\");\n return $this->orders_service->update($id, $resource);\n }", "public function update($path);", "public function update($id, $resource)\n {\n SCA::$logger->log(\"Entering update()\");\n //check whether it is an sdo or an xml string.\n if ($resource instanceof SDO_DataObjectImpl) {\n //if the thing received is an sdo convert it to xml\n if ($this->xml_das !== null) {\n $xml = SCA_Helper::sdoToXml($this->xml_das, $resource);\n } else {\n throw new SCA_RuntimeException(\n 'Trying to update a resource with SDO but ' .\n 'no types specified for reference'\n );\n }\n } else {\n $xml = $resource;\n }\n\n $slash_if_needed = ('/' === $this->target_url[strlen($this->target_url)-1])?'':'/';\n\n $handle = curl_init($this->target_url.$slash_if_needed.\"$id\");\n curl_setopt($handle, CURLOPT_HEADER, false);\n curl_setopt($handle, CURLOPT_RETURNTRANSFER, true);\n curl_setopt($handle, CURLOPT_CUSTOMREQUEST, \"PUT\");\n curl_setopt($handle, CURLOPT_POSTFIELDS, $xml);\n\n //replace with Content-Type: atom whatever\n $headers = array(\"User-Agent: SCA\",\n \"Content-Type: text/xml;\",\n \"Accept: text/plain\");\n curl_setopt($handle, CURLOPT_HTTPHEADER, $headers);\n\n $result = curl_exec($handle);\n\n $response_http_code = curl_getinfo($handle, CURLINFO_HTTP_CODE);\n\n curl_close($handle);\n\n $response_exception = $this->buildResponseException($response_http_code, '200');\n\n if ($response_exception != null) {\n throw $response_exception;\n } else {\n //update does not return anything in the body\n return true;\n }\n }", "public function update(Request $request, $id)\n {\n $this->validate($request, [\n 'name' => 'required',\n 'link' => 'required',\n 'description' => 'required'\n ]);\n\n $resource = Resource::find($id);\n $resource->name = $request->name;\n $resource->type_id = $request->type_id;\n $resource->has_cost = ($request->has('has_cost')) ? 1 : 0;\n $resource->language_id = $request->language_id;\n $resource->link = $request->link;\n $resource->description = $request->description;\n $resource->tags = '';\n\n $resource->save();\n //return back()->with('success', 'Recurso actualizado satisfactoriamente');\n return redirect('/resource')->with('success', 'Recurso actualizado satisfactoriamente');\n }", "public function update(Request $request, $id)\n {\n $oldProduct = Product::findOrFail($id);\n $data = $request->all();\n if(isset($data['img'])){\n // $file = $request->file('photo');\n // return $file;\n $imgName = time().'.'.$request->img->extension();\n $data['img'] = $imgName;\n // Storage::putFile('spares', $file);\n $path = $request->img->storeAs('public/uploads', $imgName); //in Storage\n\n //delete old file\n if($oldProduct->img != 'product-default.png'){\n Storage::delete(\"public/uploads/\".$oldProduct->img);\n // return 'deleted';\n }\n \n }else{\n $data['img'] = $oldProduct->img;\n }\n $oldProduct->update($data);\n return redirect()->route('product.index'); \n\n }", "public function updateStream($path, $resource, Config $config)\n {\n }", "public function update($request, $id) {\n\t\t\t$image = $request['photo'];\n\t\t\tif($image !== null) {\n\t\t\t\t$name = time().'.' . explode('/', explode(':', substr($image, 0, strpos($image, ';')))[1])[1];\n\t\t\t\t\\Image::make($request['photo'])->save(public_path('storage/products/').$name);\n\t\t\t\t$request['photo'] = $name;\n\t\t\t} else {\n\t\t\t\t$currenPhoto = Product::all()->where('id', $id)->first();\n\t\t\t\t$request['photo'] = $currenPhoto->photo;\n\t\t\t}\n return $this->product->update($id, $request);\n\t}", "public function edit(Resource $resource)\n {\n //\n }", "public function updateResourceIndex(&$resource) {\n if ($this->connector != null) {\n\n // STEP 1: Update or insert this resource as a node:\n $this->logger->addDebug(\"Updating/Inserting Node into Neo4J database\");\n $result = $this->connector->run(\"MATCH (a:Resource {id: {id} }) SET a.title = {title}, a.version = {version}, a.href = {href}\n return a;\",\n [\n 'id' => $resource->getID(),\n 'version' => $resource->getVersion(),\n 'title' => $resource->getTitle(),\n 'href' => $resource->getLink()\n ]\n );\n\n // Check to see if anything was added\n $records = $result->getRecords();\n if (empty($records)) {\n // Must create this record instead\n $result = $this->connector->run(\"CREATE (n:Resource) SET n += {infos};\",\n [\n \"infos\" => [\n 'id' => $resource->getID(),\n 'version' => $resource->getVersion(),\n 'title' => $resource->getTitle(),\n 'href' => $resource->getLink()\n ]\n ]\n );\n }\n\n // STEP 2: Update or insert the resource's link to holding repository\n $result = $this->connector->run(\"MATCH (a:Resource {id: {id} })-[r:HIRELATION]->()\n return r;\",\n [\n 'id' => $resource->getID(),\n ]\n );\n $records = $result->getRecords();\n if (!empty($records)) {\n // delete the one there so that we can add the correct one (just in case)\n $result = $this->connector->run(\"MATCH (a:Resource {id: {id}})-[r:HIRELATION]->() delete r;\",\n [\n 'id' => $resource->getID()\n ]\n );\n\n }\n\n // If resource has a repository, then add a link\n if ($resource->getRepository() != null && $resource->getRepository()->getID() != null) {\n $this->connector->run(\"MATCH (a:Identity {id: {id1} }) MATCH (b:Resource {id: {id2} }) CREATE (b)-[r:HIRELATION]->(a);\",\n [\n 'id1' => (string) $resource->getRepository()->getID(),\n 'id2' => $resource->getID()\n ]);\n }\n }\n }", "public function update($data) {}", "public function update($data) {}", "public function putStream($resource);", "public function update(Request $request, NebulaResource $resource, $item): RedirectResponse\n {\n $this->authorize('update', $item);\n\n $validated = $request->validate($resource->rules(\n $resource->editFields()\n ));\n\n $resource->updateQuery($item, $validated);\n\n $this->toast(__(':Resource updated', [\n 'resource' => $resource->singularName(),\n ]));\n\n return redirect()->back();\n }", "public function saveShopifyResource() {\n if (is_null($this->getShopifyId())) { // if there is no id...\n $this->createShopifyResource(); // create a new resource\n } else { // if there is an id...\n $this->updateShopifyResource(); // update the resource\n }\n }", "public function update($entity);", "public function update($entity);", "public function setResource($resource);", "public function updateStream($path, $resource, Config $config)\n {\n return $this->upload($path, $resource, $config);\n }", "public function isUpdateResource();", "public function update(Request $request, $id)\n {\n $device = Device::findOrFail($id);\n $device->fill($request->all());\n if ($request->hasFile('icon')) {\n if ($device->hasMedia('icon')) {\n $device->deleteMedia($device->getFirstMedia('icon'));\n }\n $device->addMediaFromRequest('icon')->toMediaCollection('icon');\n }\n $device->save();\n return new DeviceResource($device);\n }", "public function update(Request $request, $id)\n {\n //\n $product = Product::findOrFail($id);\n \n $product->update($request->all());\n \n $file = $request->file('url_image')->move('upload', $request->file('url_image')->getClientOriginalName());\n\n Product::where('id',$id)->update(['url_image'=>$file]);\n \n \\Session::flash('flash_message', 'Edit product successfully.'); \n \n //cũ : return redirect('articles');\n return redirect()->route('products.index');\n }", "public function store($data, Resource $resource);", "public function update(Request $request, $id)\n {\n \n $product = Product::find($id);\n\n\n $product->fill($request->all())->save();\n\n //Verificamos que tenemos una imagen\n if($request->file('photo_1')){\n\n\n //En caso de tenerla la guardamos en la clase Storage en la carpeta public en la carpeta image.\n $path = Storage::disk('public')->put('photo_1',$request->file('photo_1'));\n\n //Actualizamos el Post que acabamos de crear\n $product->fill(['photo_1' => asset($path)])->save();\n\n }\n\n\n return redirect()->route('products.index')->with('info', 'Producto actualizado exitosamente!');\n }", "public function update(Request $request, $id)\n {\n $product = Product::find($id);\n\n if (\\Input::hasFile('image')) {\n $this->imgsave($request, $product);\n }\n\n\n if (!empty($request->input('tags'))) {\n $product->tags()->sync($request->input('tags'));\n } else {\n $product->tags()->detach();\n }\n\n $product->update($request->all());\n\n return redirect()->to('dashboard/product')->with('message', 'update success');\n }", "public function put($resource_path, array $variables = array()) {\n return $this->call($resource_path, $variables, 'PUT');\n }", "public function update($id)\n {\n /* Check if logged in user is authorized to make this request */\n $this->authorizeAction();\n\n if (method_exists($this, 'updateValidations')) {\n $this->request->validate($this->updateValidations());\n }\n\n /* Get the specified resource */\n $resource = $this->model::findOrFail($id);\n\n /* Update the specified resource */\n $resource->update(Input::all());\n\n /* Redirect back */\n return redirect()->back()\n ->with(\n 'info',\n Lang::has($this->name . '.resource-updated') ?\n $this->name . '.resource-updated' :\n 'messages.alert.resource-updated'\n );\n }", "public function update(Request $request, $id)\n\n {\n ResourceManagement::findOrFail($id);\n $constraints = [\n 'title' => 'required|max:100',\n 'url'=> 'required|max:191',\n 'content' => 'required'\n ];\n\n $input = [\n 'title' => $request['title'],\n 'url' => $request['url'],\n 'content' => $request['content'],\n 'type' => $request['type'],\n 'level' => $request['level'],\n 'user_id' => $request['user']\n ];\n// $this->validate($input, $constraints);\n ResourceManagement::where('id', $id)\n ->update($input);\n\n return redirect()->intended('/resource-management');\n }", "public function putResponse($request)\n {\n $idSearched = $this->searcher->searchResourceIndex(\n $request, \n $this->db[$request['resource']]\n );\n if ($idSearched) {\n $resource = $this->db[$request['resource']][$idSearched];\n $bodyInput = json_decode($this->standardInput, true);\n $resource = BodyRequest::canApplyBody($bodyInput);\n $resource['id'] = (int)$request['param'];\n foreach($resource as $key => $value) {\n $this->db[$request['resource']][$idSearched][$key] = $value;\n }\n file_put_contents(DB_PATH, json_encode($this->db));\n }\n }", "public function update(Request $request, $id)\n {\n $this->validate($request, [\n 'title' => 'required',\n 'description' => 'required|string',\n 'price' => 'required|numeric',\n 'reference'=>'required'\n ]);\n \n $product = Product::find($id);\n $product->update($request->all());\n \n $im = $request->file('picture');\n \n if (!empty($im)) {\n \n $link = $request->file('picture')->store('images');\n \n \n $product->update([\n 'url_image' => $link,\n ]);\n } \n //dump($request->all());\n return redirect()->route('product.index')->with('message', 'Article modifié avec succès');\n }", "public function update(Storedataset $request, dataset $dataset){\n $dataset->title = $request->input('title');\n $dataset->caption = $request->input('caption');\n $dataset->file_url = $request->input('file_url');\n $dataset->type = $request->input('type');\n $dataset->status = $request->input('status');\n $dataset->publication_id = $request->input('publication_id');\n\n $dataset->save();\n\n return redirect()->route('datasets.show', ['dataset' => $dataset]);\n }", "public function update(StoreOrUpdateAsset $request, Asset $asset)\n {\n if (Storage::exists($asset->path) && !Storage::delete($asset->path)) {\n abort(500);\n }\n\n $file = $request->file('file');\n $path = $file->store('assets');\n\n if (!$path) {\n abort(500);\n }\n\n // We wonder if we should delete the old file or not...\n\n $asset->name = $file->getClientOriginalName();\n $asset->size = $file->getSize();\n $asset->type = $file->getMimeType();\n $asset->path = $path;\n\n if ($asset->save()) {\n flash('The asset has been saved.')->success();\n } else {\n abort(500);\n }\n\n return redirect('/admin/assets');\n }", "public function update(FoodRecipeRequest $request, $id)\n {\n $foodRecipe = FoodRecipe::with('ingredients','cookingProcesses')->findOrFail($id);\n if ($request->input('name')!= null)\n $foodRecipe->name = $request->input('name');\n if ($request->input('detail')!= null)\n $foodRecipe->detail = $request->input('detail');\n if($request->file('photo') != null) {\n $old_file = $foodRecipe->photo;\n if($old_file != null){\n $path = public_path().'/storage/'.$old_file;\n File::delete($path);\n }\n $file = $request->file('photo');\n $name = '/foodRecipe/' . Carbon::now()->format(\"dnY-Hisu\") . \".\" . $file->extension();\n $file->storePubliclyAs('public', $name);\n $foodRecipe->photo = $name;\n }\n $foodRecipe->save();\n return new FoodRecipeResource($foodRecipe);\n }", "public function update(StorageTypeRequest $request, $id)\n {\n try {\n $this->service->updateStorageType($request, $id);\n return $this->NoContent();\n } catch (EntityNotFoundException $e) {\n \\Log::error($e->getMessage());\n return $this->NotFound($e->getMessage());\n } catch(\\QueryException $e) {\n \\Log::error($e->getMessage());\n return $this->ServerError();\n } catch(Exception $e) {\n \\Log::error($e->getMessage());\n return $this->ServerError();\n }\n }", "public function update(Request $request, $id)\n {\n //validation\n $this->validate(request(),[\n 'image' => 'image'\n ]);\n\n $slider = HomeSliders::find($id);\n \n $slider->link = request('link');\n\n //get old image to delete if updated\n $oldImage = request('oldImage');\n //get the new image\n $NewImage=$request->file('image');\n\n if($NewImage)\n {\n $filenameToStore= helpers::updatePhoto('image','homeSliders',$request);\n $slider->image=$filenameToStore;\n\n Storage::delete('public/Images/homeSliders/'.$oldImage);\n }\n\n $slider->save();\n\n Alert::success(config('app.name'), trans('messages.Updated Successfully') );\n return redirect()->route('admin.homeSlider',$slider->type);\n }", "public function update(Qstore $request, $id)\n {\n //\n }", "public function update($request, $id);", "public function update(IEntity $entity);", "protected function performUpdate(): bool\n {\n // Abort if resource does not support update operations\n if (!$this->isUpdatable()) {\n throw new UnsupportedOperation(sprintf('API does not support update operation for %s resources', $this->resourceNameSingular()));\n }\n\n $id = $this->id();\n $prepared = $this->prepareBeforeUpdate($this->toArray());\n\n $payload = [\n $this->resourceNameSingular() => $prepared\n ];\n\n $response = $this\n ->request()\n ->put($this->endpoint($id), $payload);\n\n // Extract and (re)populate resource (if possible)\n // Note: Unlike the \"create\" method, Redmine does NOT\n // appear to send back a full resource when it has been\n // successfully updated.\n $this->fill(\n $this->decodeSingle($response)\n );\n\n return true;\n }", "function put($resource, $data = null) {\r\n\t\t\r\n\t\tif(isset($data)) {\r\n\t\t\t$this->request_body = $data;\r\n\t\t}\r\n\r\n\t\t// make the call chief\r\n\t\t$this->exec ( \"PUT\", '/' . $resource );\r\n\r\n\t\t// check the request status\r\n\t\tif($this->status_code != 200){\r\n\t\t\t$this->Logger->error(\r\n\t\t\t\tsprintf(\r\n\t\t\t\t\t'GET Call for resource \\'%s\\' Failed.\r\n\t\t\t\t\tStatus: %d,\r\n\t\t\t\t\tRequest: %s\r\n\t\t\t\t\tAPI Error Message: \r\n\t\t\t\t\t%s',\r\n\t\t\t\t\t$resource,\r\n\t\t\t\t\t$this->status_code,\r\n\t\t\t\t\t$this->request_body_raw,\r\n\t\t\t\t\t$this->response_body\r\n\t\t\t\t)\r\n\t\t\t);\r\n\t\t\tthrow new Exception($this->response_body);\r\n\t\t} else {\r\n\t\t\treturn $this->response_parsed;\r\n\t\t}\r\n\t}", "public function updateEntities($resource)\n {\n $json = [\n 'resource' => $resource,\n ];\n $request = $this->createRequest('PUT', '/entities', ['json' => $json]);\n $response = $this->send($request);\n return $response;\n }", "public function updateStream($path, $resource, Config $config)\n {\n return $this->writeStream($path, $resource, $config);\n }", "protected function handleUpdate()\n {\n $resource = $this->argument('resource');\n $action = $this->option('action');\n $startPage = (int)$this->option('startPage');\n $perPage = (int)$this->option('perPage');\n\n try {\n $harvest = Harvest::where('resource', $resource)->where('action', $action)->firstOrFail();\n } catch (\\Exception $e) {\n $this->info('There is no existing action for updating ' . ucwords($action) . ' ' . ucwords($resource) . '.');\n exit('Nothing was updated.');\n }\n\n $options = [\n 'startPage' => $startPage,\n 'perPage' => $perPage,\n 'lastRun' => $harvest->last_run_at\n ];\n\n // If a lastRun was given use that\n // OR if this has never been run before use 2001-01-01\n if (!empty($this->option('lastRun'))) {\n $options['lastRun'] = new Carbon($this->option('lastRun'));\n } elseif (is_null($options['lastRun'])) {\n $options['lastRun'] = new Carbon('2001-01-01');\n }\n\n $job = new UpdateResourceJob(\n $harvest,\n $options\n );\n\n $message = 'Updating ' . $action . ' ' . $resource . ' ' . $perPage . ' at a time';\n if (isset($lastRun)) {\n $message .= ' with entries updated since ' . $lastRun->format('r');\n }\n $this->info($message);\n $this->dispatch($job);\n }", "public function update(Request $request, $id)\n {\n\n $product = Product::findOrFail($id);\n $product->name = $request['name'];\n $product->price = $request['price'];\n $product->stock = $request['stock'];\n $product->description = $request['description'];\n\n $file = $request->file('image');\n $fileName = $file->getClientOriginalName();\n if($fileName != $product->image){\n $request->file('image')->move('images/',$fileName);\n $product->image = $fileName;\n }\n\n $product->save();\n\n return redirect()->route('products.show',\n $product->id)->with('flash_message',\n 'Article, '. $product->name.' updated');\n }", "public function update($id, $data);", "public function update($id, $data);", "public function update($id, $data);", "public function update($id, $data);", "public function update($id, $data);", "abstract public function put($data);", "public function update(Request $request, $id)\n {\n $storageplace = Storageplace::findOrFail($id);\n $storageplace->update($request->only(['storageplace']));\n return $storageplace;\n }", "public function testUpdateSupplierUsingPUT()\n {\n }", "public function updateStream($path, $resource, Config $config = null)\n {\n $contents = stream_get_contents($resource);\n\n return $this->write($path, $contents, $config);\n }", "public function update(Request $request, $id)\n {\n $skill = Skill::findOrFail($id);\n\n $skill->skill = $request->skill;\n\n if ($request->hasFile('image')) {\n \\Cloudder::upload($request->file('image'));\n $c=\\Cloudder::getResult();\n // $image = $request->file('image');\n // $filename = time() . '.' . $image->getClientOriginalExtension();\n // $location = public_path('images/' . $filename);\n // Image::make($image)->save($location);\n\n $skill->image = $c['url'];\n }\n\n $skill->save();\n\n Session::flash('success', 'Successsfully updated your skill!');\n return redirect()->route('skills.index');\n }", "public function updateRelatedImage(Request $request, $id)\n {\n // Delete display image in Storage\n Validator::make($request->all(), ['photos' => \"required|file|image|mimes:jpg,png,jpeg|max:5000\"])->validate();\n\n\n if ($request->hasFile(\"photos\")) {\n\n $photo = ProductsPhoto::find($id);\n $imageName = $photo->photos;\n $exists = Storage::disk('local')->exists(\"public/product_images/\" . $photo->photos);\n\n //delete old image\n if ($exists) {\n Storage::delete('public/product_images/' . $imageName);\n }\n\n //upload new image\n $ext = $request->file('photos')->getClientOriginalExtension(); //jpg\n\n $request->photos->storeAs(\"public/product_images/\", $imageName);\n\n $arrayToUpdate = array('photos' => $imageName);\n DB::table('products_photos')->where('id', $id)->update($arrayToUpdate);\n\n return redirect()->route(\"adminDisplayRelatedImageForm\", ['id' => $photo->product_id]);\n } else {\n\n $error = \"NO Image was Selected\";\n return $error;\n }\n }", "public static function update($id, $file)\n {\n Image::delete($id);\n\n Image::save($file);\n }", "public abstract function update($object);", "public function update(Request $request, $id)\n {\n $product = Product::find($id);\n $image = $product->image;\n if($request->hasFile('image')){\n $image = $request->file('image')->store('files');\n \\Storage::delete($product->image);\n } \n $product->name = $request->get('name');\n $product->price = $request->get('price');\n $product->description = $request->get('description');\n $product->additional_info = $request->get('additional_info');\n $product->category_id = $request->get('category');\n $product->subcategory_id = $request->get('subcategory');\n $product->image = $image;\n $product->save();\n return redirect()->back();\n }", "public function update(Request $request, $id)\n {\n $sli=Slider::find($id);\n $sli->sort_order=$request->input('sort_order');\n $image = $request->file('slider');\n if($image == ''){\n $image = $sli->slider;\n }else{\n $image = base64_encode(file_get_contents($request->file('slider')));\n }\n $sli->slider = $image;\n $sli->save();\n return redirect()->back();\n }", "public function update(Request $request, $id)\n {\n $volume = $this->findVolume($id);\n\n if(count($volume) > 0) {\n $volume->str_volume_name = $request->str_volume_name;\n\n $volume->save();\n }\n\n return response()\n ->json(\n array(\n 'message' => 'Volume is successfully updated.',\n 'volume' => $volume\n ),\n 201\n );\n }", "public function update(ProductRequest $request, $id)\n {\n $input = Product::find($id);\n $data = $request->all();\n if ($file = $request->file('product_photo')){\n $name = time().$file->getClientOriginalName();\n $file->move('product_image',$name);\n $data['product_photo']=$name;\n// $input->update($data);\n }\n $input->update($data);\n return redirect('admin/products/');\n }", "public function update(Request $request, $id)\n {\n $product = ProductModel::find($id);\n $product->name = $request->name;\n $product->description = $request->description;\n $product->price = $request->price;\n $product->stock = $request->stock;\n\n if($request->image!=null){\n $imageName = time().'.'.$request->image->extension();\n $request->image->move(public_path('images'), $imageName);\n $product->image = \"/images/\".$imageName;\n }\n $product->save();\n return redirect(\"/products/index\")->with('success','Product has been updated');\n }", "public function update()\n {\n $accessory = Accessories::find(request('id'));\n\n if ($accessory == null) {\n return response()->json([\"error\" => \"aksesuaras nerastas\"], 404);\n }\n\n $this->validateData();\n $path = $accessory->src;\n\n if (request()->hasFile('src')) {\n\n if (Storage::disk('public')->exists($accessory->src)) {\n Storage::disk('public')->delete($accessory->src);\n }\n $path = request()->file('src')->store('accessoriesImages', 'public');\n }\n\n $accessory->update(array_merge($this->validateData(), ['src' => $path]));\n\n return response()->json([\"data\" => $accessory], 200);\n }", "public function update(ProductStoreRequest $request,$id)\n {\n $data = $request->validated();\n $product = Product::where('id',$id);\n $product->update($data);\n return response(\"Producto actualizado con éxito\",200);\n }", "public function update($entity)\n {\n \n }", "public function updateStream($path, $resource, Config $config)\n {\n return $this->write($path,stream_get_contents($resource),$config);\n }", "public function update($id, Request $request)\n {\n date_default_timezone_set('Asia/Taipei');\n $data = $request->all();\n $dbData = Product::find($id);\n $myfile = Storage::disk('local');\n if ($request->hasFile('img')) {\n $file = $request->file('img');\n $path = $myfile->putFile('public', $file);\n $data['img'] = $myfile->url($path);\n File::delete(public_path($dbData->img));\n }\n $dbData->update($data);\n\n if ($request->hasFile('imgs')) {\n // $this->fetchDestroyByProdId($id);\n $localS = Storage::disk('local');\n\n $fileS = $request->file('imgs');\n $imgs = [];\n foreach ($fileS as $i) {\n $pathS = $localS->putFile('public', $i);\n $imgs[] = $localS->url($pathS);\n }\n foreach ($imgs as $img) {\n ProductImg::create([\n 'product_id' => $id,\n 'img' => $img\n ]);\n }\n }\n\n return redirect()->route('admin');\n }", "public function update($id, $input);", "public function update(Request $request, Product $product)\n { $remfile= $product->image;\n if($request->filep){\n $product->image=$request->filep;\n File::delete(storage_path('app/public/products/'.$remfile));\n }else{\n $product->image=$remfile;\n }\n //rmdir(storage_path('app/public/products/'.$remfile));\n $product->name = $request->name;\n $product->description = $request->description;\n $product->price = $request->price;\n $product->save();\n sleep(3);\n toast('Details updated successfully','info');\n return redirect('/products');\n }", "public function update(ProductRequest $request,int $id): ProductResource\n {\n $attributes = $request->only('supplier_id', 'name', 'warehouses');\n\n return new ProductResource($this->productRepository->update($id, $attributes)); }", "public function update(Request $request, $id)\n {/* dd($request->all()); */\n $acheivePic = $this->acheiveRepo->find($id);\n $acheive = $request->except('_method', '_token', 'photo', 'ar', 'en');\n $acheiveTrans = $request->only('ar', 'en');\n\n if ($request->hasFile('icon')) {\n // Delete old image first.\n $oldPic = public_path() . '/images/acheives/' . $acheivePic->icon;\n File::delete($oldPic);\n\n // Save the new one.\n $image = $request->file('icon');\n $imageName = $this->upload($image, 'acheives');\n $acheive['icon'] = $imageName;\n }\n\n $this->acheiveRepo->update($id, $acheive, $acheiveTrans);\n\n return redirect('admin-panel/widgets/acheive')->with('updated', 'updated');\n }", "public function update(Request $request, $id)\n {\n $slider=new Slider;\n $slider=$slider::find($id);\n \n \n if($file =$request->file('slider')){\n if(Storage::delete('public/slider/'.$slider->slider)){\n\n //Get file original name//\n \n$original_name=$file->getClientOriginalName();\n\n //Get just the file name\n$filename=pathinfo($original_name,PATHINFO_FILENAME);\n\n//Create new file name\n$name=$filename.'_'.time().'.'.$file->getClientOriginalExtension();\n\n $destination='public/slider';\n $path=$request->slider->storeAs($destination,$name);\n $slider->slider=$name;\n $slider->save();\n return redirect('Admin/slider');\n\n }\n }\n}", "public function update(Request $request, $id)\n {\n $data = $request->all();\n extract($data);\n\n $productVarient = new ProductVariant();\n $productVarient = $productVarient->find($id);\n $productVarient->vendor_id = auth()->user()->id;\n $productVarient->description = $prod_desc;\n $productVarient->price = $price;\n\n if(request()->hasFile('photo')){\n $image = request()->file('photo')->getClientOriginalName();\n $imageNewName = auth()->user()->id.'-'.$image;\n $file = request()->file('photo');\n $file->storeAs('images/product',$imageNewName, ['disk' => 'public']);\n $productVarient->image = $imageNewName;\n }\n \n $productVarient->save();\n\n return back()->withStatus(__('Product successfully updated.'));\n }", "public function update(Request $request, $id)\n {\n //if upload new image, delete old image\n $myfile=$request->old_photo;\n if($request->hasfile('photo'))\n {\n $imageName=time().'.'.$request->photo->extension();\n $name=$request->old_photo;\n\n if(file_exists(public_path($name))){\n unlink(public_path($name));\n $request->photo->move(public_path('backendtemplate/truefalseimg'),$imageName);\n $myfile='backendtemplate/truefalseimg/'.$imageName;\n }\n }\n //Update Data\n $truefalsequestion=TrueFalseQuestion::find($id);\n $truefalsequestion->name=$request->name;\n $truefalsequestion->photo=$myfile;\n $truefalsequestion->answer = $request->answer;\n $truefalsequestion->question_id = $request->question;\n $truefalsequestion->save();\n\n //Redirect\n return redirect()->route('truefalsequestions.index'); \n }", "public function update($id);", "public function update($id);", "public function put($path, $data = null);", "public function update(Request $request, $id)\n {\n $request->validate([\n 'path_image'=>'image',\n 'status'=>'required|in:0,1'\n ]);\n $slider=Slider::whereId($id)->first();\n if (is_null($slider)){\n return redirect()->route('sliders.index')->with('error','Slider does not exist');\n }\n try {\n if ($request->hasFile('path_image')){\n $file = $request->file('path_image');\n\n $image_path= $file->store('/sliders',[\n 'disk'=>'uploads'\n ]);\n Storage::disk('uploads')->delete($slider->image);\n\n $request->merge([\n 'image'=>$image_path,\n ]);\n }\n\n $slider->update( $request->only(['status','image']));\n return redirect()->route('sliders.index')->with('success','Updated successful');\n }catch (\\Exception $exception){\n return redirect()->route('sliders.index')->with(['error'=>'Something error try again']);\n\n }\n }", "public function update() {\n $this->accessory->update($this->accessory_params());\n\n if ($this->accessory->is_valid()) {\n $this->update_accessory_image($this->accessory);\n redirect('/backend/accessories', ['notice' => 'Successfully updated.']);\n } else {\n redirect(\n '/backend/accessories/edit',\n ['error' => $this->accessory->errors_as_string()],\n ['id' => $this->accessory->id]\n );\n }\n }", "private function update()\n {\n $this->data = $this->updateData($this->data, $this->actions);\n $this->actions = [];\n }", "public function update(Entity $entity);", "public function update(Request $request, $id)\n {\n $icon = SliderIcon::find($id);\n $data = $request->all();\n $data['active'] = $request->has('active') ? 1 : 0;\n if ($request->hasFile('img')) {\n if (Storage::disk('public')->exists(str_replace('storage', '', $icon->img))){\n Storage::disk('public')->delete(str_replace('storage', '', $icon->img));\n }\n $image = $request->file('img');\n $fileName = time().'_'.Str::lower(Str::random(5)).'.'.$image->getClientOriginalExtension();\n $path_to = '/upload/images/'.getfolderName();\n $image->storeAs('public'.$path_to, $fileName);\n $data['img'] = 'storage'.$path_to.'/'.$fileName;\n }\n $icon->update($data);\n return redirect()->route('slider_icons.index')->with('success', 'Данные преимущества обнавлены');\n }", "public function update(Request $request, $id)\n {\n //validate incoming request\n $request->validate([\n 'name' => 'string|max:100|nullable',\n 'picture' => 'max:2000|mimes:jpeg,jpg,png,svg|nullable', //max size 2mb,\n 'total' => 'integer|min:0|nullable', //value must be > 0\n 'selling_price' => 'numeric|min:0|nullable',\n 'cost_price' => 'numeric|min:0|nullable',\n 'category_id' => 'integer|nullable'\n ]);\n\n try {\n $product = Auth::user()->store->product()->findorFail($id);\n } catch (ModelNotFoundException $e) {\n return response()->json([\n \"message\" => \"Forbidden\"\n ], 403);\n }\n\n //if category id isnt null\n if ($category_id = $request->category_id) {\n if (!$this->isCategoryIdValid($category_id))\n return response()->json([\n \"message\" => \"Category Id is not valid\"\n ], 422);\n else\n $product->category_id = $request->category_id;\n }\n\n //if uploaded file exist\n if ($picture = $request->file(\"picture\")) {\n //if product already has logo\n if ($product->picture)\n Storage::delete(Product::$PICTURE_PATH . \"/\" . $product->picture);\n\n $picture_path = $picture->store(Product::$PICTURE_PATH);\n //remove folder name from path\n $product->picture = str_replace(Product::$PICTURE_PATH . \"/\", '', $picture_path);\n }\n\n $this->renewProduct($product, $request);\n $product->save();\n return response()->json(new ProductResource($product), 200);\n }", "public function update() {\n\t $this->layout = false;\n\t \n\t //set default response\n\t $response = array('status'=>'failed', 'message'=>'HTTP method not allowed');\n\t \n\t //check if HTTP method is PUT\n\t if($this->request->is('put')){\n\t //get data from request object\n\t $data = $this->request->input('json_decode', true);\n\t if (empty($data)) {\n\t $data = $this->request->data;\n\t }\n\t \n\t //check if product ID was provided\n\t if (!empty($data['id'])) {\n\t \n\t //set the product ID to update\n\t $this->Player->id = $data['id'];\n\t if ($this->Player->save($data)) {\n\t $response = array('status'=>'success','message'=>'Product successfully updated');\n\t } else {\n\t $response['message'] = \"Failed to update product\";\n\t }\n\t } else {\n\t $response['message'] = 'Please provide product ID';\n\t }\n\t }\n\t \n\t $this->response->type('application/json');\n\t $this->response->body(json_encode($response));\n\n\t return $this->response->send();\n\t}", "public function update(Request $request, $id)\n {\n $request->validate([\n 'name' => 'required | min:3 | string',\n 'type' => 'required',\n 'producer' => 'required',\n 'image' => 'image | mimes:png,jpg,jpeg',\n 'price_input' => 'required | numeric | min:0 | max:300000000',\n 'promotion_price' => 'required | numeric | max:300000000',\n 'description' => 'required | string',\n\n ]);\n $product = Product::withTrashed()->findOrfail($id);\n $product->name = $request->name;\n $product->id_type = $request->type;\n $product->id_producer = $request->producer;\n\n $product->amount = $request->amount;\n if (request('image')) {\n $product->image = base64_encode(file_get_contents($request->file('image')->getRealPath()));\n }\n\n $product->price_input = $request->price_input;\n\n if ( $request->promotion_price >= 0 && $request->promotion_price < $product->price_input) {\n $product->promotion_price = $request->promotion_price;\n }else{\n return back()->with('error', '\n Do not enter a negative number');\n }\n $product->new = $request->new;\n\n $product->description = $request->description;\n\n $product->save();\n $product->size()->sync(request('size'));\n\n return redirect()->route('product.index')->with('success', 'Product Updated successfully');\n }", "public function update(Request $request, $id)\n {\n $product = Product::find($id);\n\n $product->name = $request->input('name');\n $product->description = $request->input('description');\n $product->lastPrice = $product->price !== $request->input('price') ? $product->price : NULL;\n $product->price = $request->input('price');\n\n if ($request->hasFile('image')) { \n $currentImg = $product->image;\n if ($currentImg) {\n Storage::delete('/public/' . $currentImg);\n }\n $image = $request->file('image'); \n $path = $image->store('images','public');\n $product->image = $path;\n };\n\n $product->save(); \n\n $product_promotions = $request->input('promotion');\n\n $product->promotions()->sync($product_promotions);\n\n return redirect()->route('admin.modify');\n }", "public static function updateImage($fileName, $imageId, $storage)\n {\n //Get image name and storage location for image\n $image = Image::where('id', '=', $imageId)->first();\n\n //Delete old image\n ResourceHandler::delete($image->name, $image->storage);\n\n //Store the new image\n $image->name = $fileName;\n $image->storage = $storage;\n\n $image->save();\n }", "public function update($request, $id)\n {\n $this->checkExits($id);\n $data = $request->except(['_method','_token','photo']);\n\n if($request->photo)\n {\n try {\n $this->UploadFile($request);\n } catch (\\Exception $e) {\n //if has exception , don't has action\n }\n if ($this->img !== '') {\n $data['img'] = $this->img;\n }\n }\n\n $this->object->update($data);\n\n }", "public function updateProduct($request, $product)\n {\n $product->update($request->except(['_token', '_method', 'image']));\n if ($request->hasFile('image')) {\n $image = $request->file('image');\n $imageName = time() . '.' . $request->file('image')->extension();\n // $img = Image::make('public/foo.jpg');\n\n $image_resize = Image::make($image->getRealPath());\n $image_resize->resize(500, 500);\n $image_resize->save(public_path('images/') . $imageName, 100);\n $product->gallery = $imageName;\n $product->save();\n }\n $product->getTags()->sync($request->input('tags'));\n }" ]
[ "0.74238616", "0.7062842", "0.7057816", "0.6897868", "0.65820867", "0.64505464", "0.6347915", "0.62114644", "0.6145006", "0.61231726", "0.6115922", "0.6100021", "0.6089019", "0.60542375", "0.60187906", "0.6008231", "0.5974106", "0.5944986", "0.59397626", "0.59393746", "0.58937186", "0.58607864", "0.5853811", "0.5853811", "0.58521867", "0.5815276", "0.58061725", "0.57518756", "0.57518756", "0.5736318", "0.57246256", "0.5715636", "0.5696208", "0.5691033", "0.5687788", "0.56692934", "0.56556624", "0.5652178", "0.56494987", "0.5636202", "0.56355816", "0.5632871", "0.563206", "0.56291884", "0.5621382", "0.56087434", "0.5602465", "0.55928403", "0.55825645", "0.55821884", "0.5581833", "0.5576869", "0.55712104", "0.5568173", "0.55648434", "0.5562885", "0.5560537", "0.5560537", "0.5560537", "0.5560537", "0.5560537", "0.55592597", "0.5556131", "0.5555849", "0.5555397", "0.5553912", "0.55530137", "0.5543831", "0.55430055", "0.5540152", "0.5539437", "0.55359006", "0.5535772", "0.5534487", "0.552458", "0.5518245", "0.5515452", "0.55145514", "0.5509227", "0.55079365", "0.55065364", "0.55039924", "0.5501616", "0.5500345", "0.5499738", "0.54980725", "0.5496017", "0.5496017", "0.5494488", "0.5494334", "0.54936594", "0.54934716", "0.5491019", "0.54835314", "0.54795796", "0.5479442", "0.5478275", "0.54646415", "0.54637444", "0.5461914", "0.54562414" ]
0.0
-1
Remove the specified resource from storage.
public function destroy($id) { Event::findOrFail($id)->delete(); return redirect('/dashboard')->with('msg', 'Evento excluído com sucesso!'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function delete($resource){\n return $this->fetch($resource, self::DELETE);\n }", "public function destroy(Resource $resource)\n {\n //\n }", "public function removeResource($resourceID)\n\t\t{\n\t\t}", "public function unpublishResource(PersistentResource $resource)\n {\n $client = $this->getClient($this->name, $this->options);\n try {\n $client->delete(Path::fromString($this->getRelativePublicationPathAndFilename($resource)));\n } catch (FileDoesNotExistsException $exception) {\n }\n }", "public function deleteResource(&$resource) {\n\n if ($this->connector != null) {\n $this->logger->addDebug(\"Deleting Resource Node from Neo4J database\");\n $result = $this->connector->run(\"MATCH (a:Resource {id: {id}}) detach delete a;\",\n [\n 'id' => $resource->getID()\n ]\n );\n $this->logger->addDebug(\"Updated neo4j to remove resource\");\n }\n\n }", "public function deleteShopifyResource() {\n $this->getShopifyApi()->call([\n 'URL' => API::PREFIX . $this->getApiPathSingleResource(),\n 'METHOD' => 'DELETE',\n ]);\n }", "public function deleteResource()\n {\n $database = new Database();\n $id = $this->_params['id'];\n $database->deleteResource($id);\n $this->_f3->reroute('/Admin');\n }", "protected function deleteResource($fileName, $storage)\n {\n if (Storage::disk($storage)->exists($fileName)) \n {\n return Storage::disk($storage)->delete($fileName);\n }\n }", "public function delete()\n {\n persistableCollection::getInstance($this->resourceName)->deleteObject($this);\n }", "public function remove()\n {\n $this->_getBackend()->remove($this->_id);\n }", "public function remove()\n {\n if (! ftruncate($this->fileHandle, 0)) {\n throw new StorageException(\"Could not truncate $this->path\");\n }\n if (! unlink($this->path)) {\n throw new StorageException(\"Could not delete $this->path\");\n }\n }", "public function delete()\n\t{\n\t\t$s3 = AWS::createClient('s3');\n $s3->deleteObject(\n array(\n 'Bucket' => $this->bucket,\n 'Key' => $this->location\n )\n );\n\t\tif($this->local_file && file_exists($this->local_file)) {\n\t\t\tunlink($this->local_file);\n\t\t}\n $this->local_file = null;\n\t}", "public function delete()\n\t{\n\t\tsfCore::db->query(\"DELETE FROM `swoosh_file_storage` WHERE `id`='%i';\", $this->id);\n\t\t$this->fFile->delete();\n\t}", "public function delete(): void\n {\n unlink($this->getPath());\n }", "public function delete()\n {\n if($this->exists())\n unlink($this->getPath());\n }", "public function remove($path);", "function deleteFileFromStorage($path)\n{\n unlink(public_path($path));\n}", "public function delete(): void\n {\n unlink($this->path);\n }", "private function destroyResource(DrydockResource $resource) {\n $blueprint = $resource->getBlueprint();\n $blueprint->destroyResource($resource);\n\n $resource\n ->setStatus(DrydockResourceStatus::STATUS_DESTROYED)\n ->save();\n }", "public static function delete($fileName, $storage)\n {\n if (Storage::disk($storage)->exists($fileName)) \n {\n return Storage::disk($storage)->delete($fileName);\n }\n }", "public function remove() {}", "public function remove() {}", "public function remove();", "public function remove();", "public function remove();", "public function remove();", "function delete_resource($resource_id, $page)\n\t{\n\t\t//get resource data\n\t\t$table = \"resource\";\n\t\t$where = \"resource_id = \".$resource_id;\n\t\t\n\t\t$this->db->where($where);\n\t\t$resource_query = $this->db->get($table);\n\t\t$resource_row = $resource_query->row();\n\t\t$resource_path = $this->resource_path;\n\t\t\n\t\t$image_name = $resource_row->resource_image_name;\n\t\t\n\t\t//delete any other uploaded image\n\t\t$this->file_model->delete_file($resource_path.\"\\\\\".$image_name, $this->resource_path);\n\t\t\n\t\t//delete any other uploaded thumbnail\n\t\t$this->file_model->delete_file($resource_path.\"\\\\thumbnail_\".$image_name, $this->resource_path);\n\t\t\n\t\tif($this->resource_model->delete_resource($resource_id))\n\t\t{\n\t\t\t$this->session->set_userdata('success_message', 'resource has been deleted');\n\t\t}\n\t\t\n\t\telse\n\t\t{\n\t\t\t$this->session->set_userdata('error_message', 'resource could not be deleted');\n\t\t}\n\t\tredirect('resource/'.$page);\n\t}", "public function deleteImage(){\n\n\n Storage::delete($this->image);\n }", "public function del(string $resource): bool|string\n {\n $json = false;\n $fs = unserialize($_SESSION['rfe'][$this->getRoot()], ['allowed_classes' => false]);\n if (array_key_exists($resource, $fs)) {\n // if $item has children, delete all children too\n if (array_key_exists('dir', $fs[$resource])) {\n foreach ($fs as $key => $file) {\n if (isset($file['parId']) && $file['parId'] == $resource) {\n unset($fs[$key]);\n }\n }\n }\n unset($fs[$resource]);\n $_SESSION['rfe'][$this->getRoot()] = serialize($fs);\n $json = '[{\"msg\": \"item deleted\"}]';\n }\n return $json;\n }", "public function destroy()\n\t{\n\t\treturn unlink(self::filepath($this->name));\n\t}", "public function destroy($id) {\n $book = Book::find($id);\n // return unlink(storage_path(\"public/featured_images/\".$book->featured_image));\n Storage::delete(\"public/featured_images/\" . $book->featured_image);\n if ($book->delete()) {\n return $book;\n }\n\n }", "public function destroy($id)\n {\n Storageplace::findOrFail($id)->delete();\n }", "public function destroyResourceImage(): void\n\t{\n\t\tif (isset($this->image)) {\n\t\t\t@imagedestroy($this->image->getImageResource());\n\t\t}\n\t}", "public function deleteResource(PersistentResource $resource)\n {\n $pathAndFilename = $this->getStoragePathAndFilenameByHash($resource->getSha1());\n if (!file_exists($pathAndFilename)) {\n return true;\n }\n if (unlink($pathAndFilename) === false) {\n return false;\n }\n Files::removeEmptyDirectoriesOnPath(dirname($pathAndFilename));\n return true;\n }", "public function deleteImage(){\n \tStorage::delete($this->image);\n }", "public function destroy()\n {\n $file=public_path(config('larapages.media.folder')).Input::all()['folder'].'/'.Input::all()['file'];\n if (!file_exists($file)) die('File not found '.$file);\n unlink($file);\n }", "public function delete() \r\n {\r\n if($this->exists())\r\n {\r\n unlink($this->fullName());\r\n }\r\n }", "public function destroy($id)\n {\n Myfile::find($id)->delete();\n }", "public function destroy($delete = false)\n {\n if (null !== $this->resource) {\n $this->resource->clear();\n $this->resource->destroy();\n }\n\n $this->resource = null;\n clearstatcache();\n\n // If the $delete flag is passed, delete the image file.\n if (($delete) && file_exists($this->name)) {\n unlink($this->name);\n }\n }", "public static function delete($path){\r\n $currentDir = getcwd();\r\n $storageSubPath = \"/../../\".STORAGE_PATH;\r\n $file = $currentDir . $storageSubPath . '/' . $path;\r\n\r\n unlink($file);\r\n }", "public function destroy(Storage $storage)\n {\n return redirect()->route('storages.index');\n }", "public function remove() {\n //Check if there are thumbs and delete files and db\n foreach ($this->thumbs()->get() as $thumb) {\n $thumb->remove();\n } \n //Delete the attachable itself only if is not default\n if (strpos($this->url, '/defaults/') === false) {\n Storage::disk('public')->delete($this->getPath());\n }\n parent::delete(); //Remove db record\n }", "public function removeFile($uri){\n return Storage::disk('public')->delete($uri);\n }", "public function destroy(Resource $resource)\n {\n if( $resource->delete() ){\n return Response(['status'=>'success','message'=>'Resource deleted']); \n } else {\n return Response(['status'=>'error', 'message'=>'Something went wrong']);\n }\n }", "public function delete($path);", "public function delete($path);", "public function destroy($id)\n { \n File::find($id)->remove();\n \n return redirect()->route('files.index');\n }", "public function destroy($id)\n {\n $supplier = Supplier::find($id);\n $photo = $supplier->photo;\n if ($photo) {\n unlink($photo);\n }\n $supplier->delete();\n }", "public function destroy($id)\n {\n $student = Student::where('id', $id)->first();\n // $path = $student->image;\n unlink($student->image);\n Student::findOrFail($id)->delete();\n return response('Deleted!');\n }", "public function destroy($id)\n {\n $icon = SliderIcon::find($id);\n if (Storage::disk('public')->exists(str_replace('storage', '', $icon->img))){\n Storage::disk('public')->delete(str_replace('storage', '', $icon->img));\n }\n $icon->delete();\n return redirect()->route('slider_icons.index')->with('success', 'Данные преимущества удалёны');\n }", "public function delete($path, $data = null);", "public function destroy($id)\n {\n $items=Items::find($id);\n // delete old file\n if ($items->photo) {\n $str=$items->photo;\n $pos = strpos($str,'/',1);\n $str = substr($str, $pos);\n $oldFile = storage_path('app\\public').$str;\n File::Delete($oldFile); \n }\n $items->delete();\n return redirect()->route('items.index');\n }", "public function destroy($id)\n {\n $carousel = Carousel::find($id);\n $image = $carousel->image;\n\n $basename ='img/carousel/' . basename($image);\n //Delete the file from disk\n if(file_exists($basename)){\n unlink($basename);\n }\n //With softDeletes, this is the way to permanently delete a record\n $carousel->delete();\n Session::flash('success','Product deleted permanently');\n return redirect()->back();\n }", "public function remove()\n {\n $fs = new Filesystem();\n $fs->remove($this->dir());\n }", "public static function destroy(int $resource_id)\n {\n try {\n $image_data = ListingImage::where('id', $resource_id)->first();\n self::delete_image($image_data->name);\n $delete = ListingImage::where('id', $resource_id)->delete();\n\n // activity()\n // ->causedBy(Auth::user()->id)\n // ->performedOn($delete)\n // ->withProperties(['id' => $delete->id])\n // ->log('listing image deleted');\n return response()->json(['status'=> 'ok', 'msg'=> 'Data deleted successfully']);\n } catch (Exception $e) {\n $e->getMessage();\n }\n }", "public function destroy(Storage $storage)\n {\n $this->storage->destroy($storage);\n\n return redirect()->route('admin.product.storage.index')\n ->withSuccess(trans('core::core.messages.resource deleted', ['name' => trans('product::storages.title.storages')]));\n }", "public function del($path){\n\t\treturn $this->remove($path);\n\t}", "public function destroy($id)\n {\n //\n $product = Product::findOrFail($id);\n $product->delete();\n if($product->img != 'product-default.png'){\n Storage::delete(\"public/uploads/\".$product->img);\n // return 'deleted';\n }\n return redirect()->route('product.index'); \n }", "public function removeUpload()\n{\n if ($file = $this->getAbsolutePath()) {\n unlink($file); \n }\n}", "public function destroy($id)\n {\n $image = Images::withTrashed()->find($id);\n\n Storage::disk('uploads')->delete(\"social-media/$image->filename\");\n\n $image->tags()->detach();\n $image->detachMedia(config('constants.media_tags'));\n $image->forceDelete();\n\n return redirect()->back()->with('success', 'The image was successfully deleted');\n }", "public function destroyByResourceId($resource_id)\n {\n// $online_party = $this->onlinetrack->where('resource_id', $resource_id)->get()->first();\n// $online_party->status = \"offline\";\n// $online_party->save();\n// return $online_party;\n return $this->onlinetrack->where('resource_id', $resource_id)->delete();\n }", "public function revoke($resource, $permission = null);", "public function destroy($id)\n {\n $data=Image::find($id);\n $image = $data->img;\n\n\n $filepath= public_path('images/');\n $imagepath = $filepath.$image;\n\n //dd($old_image);\n if (file_exists($imagepath)) {\n @unlink($imagepath);\n }\n\n\n $data->delete();\n\n return redirect()->route('image.index');\n }", "function delete($path);", "public function removeItem(int $id)\n\t{\n\t\t$this->storage->remove($id);\n\t}", "public function destroy(File $file)\n {\n //\n $v = Storage::delete($file->path);\n \n }", "public function destroyResource($resource)\n {\n if (!is_object($resource)) {\n return false;\n }\n\n $resource_type = get_class($resource);\n $resource_id = $resource->getKey();\n\n return Role::where('resource_type', $resource_type)\n ->where('resource_id', $resource_id)\n ->delete();\n }", "public function remove($filePath){\n return Storage::delete($filePath);\n }", "public function remove(): void\n {\n $file = $this->getAbsolutePath();\n if (!is_file($file) || !file_exists($file)) {\n return;\n }\n\n unlink($file);\n }", "public function destroy(Request $request, Storage $storage)\n {\n $storage->delete();\n $request->session()->flash('alert-success', 'Запись успешно удалена!');\n return redirect()->route('storage.index');\n }", "public function remove(Storable $entity): Storable\n {\n $this->getRepository(get_class($entity))->remove($entity);\n $this->detach($entity);\n\n return $entity;\n }", "public function processDeletedResource(EntityResource $resource)\n {\n /** @var AuthorizationRepository $repository */\n $repository = $this->entityManager->getRepository('Edweld\\AclBundle\\Entity\\Authorization');\n\n $repository->removeAuthorizationsForResource($resource);\n }", "function _unlink($resource, $exp_time = null)\n {\n if(file_exists($resource)) {\n return parent::_unlink($resource, $exp_time);\n }\n\n // file wasn't found, so it must be gone.\n return true;\n }", "public function remove($id);", "public function remove($id);", "public function deleted(Storage $storage)\n {\n //\n }", "public function destroy($id)\n {\n $data = Product::findOrFail($id);\n\n if(file_exists('uploads/product/'.$data->image1)){\n unlink('uploads/product/'.$data->image1);\n }\n\n if(file_exists('uploads/product/'.$data->image2)){\n unlink('uploads/product/'.$data->image2);\n }\n\n if(file_exists('uploads/product/'.$data->image3)){\n unlink('uploads/product/'.$data->image3);\n }\n $data->delete();\n }", "public function removeUpload()\n {\n $file = $this->getAbsolutePath();\n if ($file) {\n unlink($file);\n }\n }", "public function resources_delete($resource_id, Request $request) {\n if ($resource_id) {\n $resp = Resources::where('id', '=', $resource_id)->delete();\n if($resp){\n $msg = 'Resource has been deleted successfully.';\n $request->session()->flash('message', $msg);\n }\n }\n //return redirect()->route('admin-factor-list');\n return redirect()->to($_SERVER['HTTP_REFERER']);\n }", "public function delete()\n {\n try\n {\n $thumbnail = $this->getThumbnail();\n if($thumbnail)\n {\n $thumbnail->delete();\n }\n }\n catch(sfException $e){}\n \n // delete current file\n parent::delete();\n }", "function deleteResource($uuid){\n $data = callAPI(\"DELETE\",\"/urest/v1/resource/\".$uuid);\n return $data;\n}", "public function delete();", "public function delete();", "public function delete();", "public function delete();", "public function delete();", "public function delete();", "public function delete();", "public function delete();", "public function delete();", "public function delete();", "public function delete();", "public function delete();", "public function delete();", "public function delete();", "public function delete();", "public function remove_resource($idproject){\n\t\t\n\t\t// Load model and try to get project data\n\t\t$this->load->model('Projects_model', 'projects');\n\t\t\n\t\t// Update\n\t\t$this->projects->save_project(array(\"ext\" => \"\", \"vzaar_idvideo\" => \"0\", \"vzaar_processed\" => \"0\"), $idproject);\n\t}", "public function destroy($id){\n $file_data = Slider::findOrFail($id);\n File::delete(public_path('../storage/app/public/sliders/'.$file_data->path));\n $slider = Slider::destroy($id);\n return response()->json(null, 204);\n }", "public function delete()\n\t{\n\t\t@unlink($this->get_filepath());\n\t\t@unlink($this->get_filepath(true));\n\t\tparent::delete();\n\t}", "public function delete($resource_path, array $variables = array()) {\n return $this->call($resource_path, $variables, 'DELETE');\n }", "public function destroy($id)\n {\n //Find Slider With Id\n $slider = Slider::findOrFail($id);\n // Check If The Image Exist\n if(file_exists('uploads/slider/'.$slider->image)){\n\n unlink( 'uploads/slider/'.$slider->image);\n }\n $slider->delete();\n return redirect()->back()->with('success','Slider Successfully Deleted');\n }" ]
[ "0.6672584", "0.6659381", "0.6635911", "0.6632799", "0.6626075", "0.65424126", "0.65416265", "0.64648265", "0.62882507", "0.6175931", "0.6129922", "0.60893893", "0.6054415", "0.60428125", "0.60064924", "0.59337646", "0.5930772", "0.59199584", "0.5919811", "0.5904504", "0.5897263", "0.58962846", "0.58951396", "0.58951396", "0.58951396", "0.58951396", "0.5880124", "0.58690923", "0.5863659", "0.5809161", "0.57735413", "0.5760811", "0.5753559", "0.57492644", "0.5741712", "0.57334286", "0.5726379", "0.57144034", "0.57096", "0.5707689", "0.5705895", "0.5705634", "0.5703902", "0.5696585", "0.5684331", "0.5684331", "0.56780374", "0.5677111", "0.5657287", "0.5648262", "0.5648085", "0.5648012", "0.5640759", "0.5637738", "0.5629985", "0.5619264", "0.56167465", "0.5606877", "0.56021434", "0.5601949", "0.55992156", "0.5598557", "0.55897516", "0.5581397", "0.5566926", "0.5566796", "0.55642897", "0.55641", "0.5556583", "0.5556536", "0.5550097", "0.5543172", "0.55422723", "0.5540013", "0.5540013", "0.55371785", "0.55365825", "0.55300397", "0.552969", "0.55275744", "0.55272335", "0.55271083", "0.55271083", "0.55271083", "0.55271083", "0.55271083", "0.55271083", "0.55271083", "0.55271083", "0.55271083", "0.55271083", "0.55271083", "0.55271083", "0.55271083", "0.55271083", "0.55271083", "0.5525997", "0.5525624", "0.5523911", "0.5521122", "0.5517412" ]
0.0
-1
echo "SELECT hrc.`room_id`,hrc.`room_no`,hrc.`floor`,hrc.`room_type`,hrc.`adults`,hrc.`child`,hrc.`smoking`,hrtc.`room_type_id`,hrtc.`room_type_name`,hrtc.`facility_id`,hrtc.`bed_size`,hrtc.`charge`,hrtc.`note` FROM " . TABLE_HMS_ROOM_CREATION . " as hrc, " . TABLE_HMS_ROOM_TYPE_CREATION . " as hrtc WHERE hrc.`room_type` = hrtc.`room_type_id` AND hrc.`active` = 'Y' AND hrc.`room_type` = '". $room_type ."' GROUP BY hrc.`room_type`";
function roomFetchAllRecords($room_type){ $hms_info_fetch_allrec_sql = db_query("SELECT hrc.`room_id`,hrc.`room_no`,hrc.`floor`,hrc.`room_type`,hrc.`adults`,hrc.`child`,hrc.`smoking`,hrtc.`room_type_id`,hrtc.`room_type_name`,hrtc.`facility_id`,hrtc.`bed_size`,hrtc.`charge`,hrtc.`note` FROM " . TABLE_HMS_ROOM_CREATION . " as hrc, " . TABLE_HMS_ROOM_TYPE_CREATION . " as hrtc WHERE hrc.`room_type` = hrtc.`room_type_id` AND hrc.`active` = 'Y' AND hrc.`room_type` = '". $room_type ."' GROUP BY hrc.`room_no`"); return $hms_info_fetch_allrec_sql; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function showAllRoom($branch,$username,$module,$desc) {\n\necho \"\n\n<style type='text/css'>\n.head {\ncolor:white;\n}\n\n.roomData {\nfont-size:13px;\n}\n\n#selected:hover {\nbackground-color:yellow;\ncolor:black;\n}\n\n.exceeded {\nborder-color:red;\ncolor:red;\n}\n\n.unExceed {text-decoration:none; color:black; }\n.Exceed {text-decoration:none; color:red; }\n</style>\n\n\";\n\n$con = ($GLOBALS[\"___mysqli_ston\"] = mysqli_connect($this->myHost, $this->username, $this->password));\nif (!$con)\n {\n die('Could not connect: ' . ((is_object($GLOBALS[\"___mysqli_ston\"])) ? mysqli_error($GLOBALS[\"___mysqli_ston\"]) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false)));\n }\n\n((bool)mysqli_query( $con, \"USE \" . $this->database));\n\nif($module == \"BILLING\") {\n$result = mysqli_query($GLOBALS[\"___mysqli_ston\"], \"SELECT * FROM room WHERE branch = '$branch' order by Description asc \");\n}else {\n$result = mysqli_query($GLOBALS[\"___mysqli_ston\"], \"SELECT * FROM room WHERE branch = '$branch' and floor='$desc' order by Description asc \");\n}\necho \"<br><center><font size=2>Admitted Patient in $desc of $branch</font><div style='border:1px solid #000000; width:600px; height:auto; border-color:black black black black;'>\";\necho \"<center><br><table width='75%' border=1 cellpadding=0 cellspacing=0 rules=all>\";\necho \"<tr>\";\necho \"<th bgcolor='#3b5998'>&nbsp;<font class='head'>Room</font>&nbsp;</th>\";\necho \"<th bgcolor='#3b5998'>&nbsp;<font class='head'>Patient</font>&nbsp;</th>\";\necho \"<th bgcolor='#3b5998'>&nbsp;<font class='head'>Credit</font>&nbsp;</th>\";\necho \"</tr>\";\nwhile($row = mysqli_fetch_array($result))\n {\n $patientData = preg_split (\"/\\_/\",$this->getPatientInTheRoom($row['Description'])); //source of data\n\n $credit = $this->getCurrentCredit($patientData[0],\"PATIENT\",\"\") - ($this->getCurrentPaid($patientData[0],\"PATIENT\",\"cashUnpaid\")); //total Credit [cashUnpaid] as PATIENT\n \n $this->viewCreditLimit_setter($patientData[0],\"PATIENT\",\"cashUnpaid\",\"\"); //credit Limit ng Patient..\n $limit = $this->viewCreditLimit_setter_amountLimit(); //amountLimit ng patient from \"viewCreditLimit_setter()\"\n\necho \"<tr id='selected' >\";\n\n/*******start counter****/\n$this->showAllRoom_room++; //count total rooms\n\nif($patientData[0] != \"\") { //check kung may patient\n$this->showAllRoom_occupied+=1; // kung meron +1\n}else {\n$this->showAllRoom_vacant+=1; // kung wLa +1\n}\n\n$this->showAllRoom_credit+=$credit;\n\n/*********end counter************/\n\n\nif($this->checkCreditLimit($patientData[0]) == 0) { //check kung mei credit Limit n nka set sa patient...kpg meron execute code below kung wLa execute notifier\n\necho \"<Td>&nbsp;<font class='roomData'>\".$row['Description'].\"</font>&nbsp;</td>\";\nif($patientData[0] != \"\") {\necho \"<Td>&nbsp;<a href='http://\".$this->getMyUrl().\"/Department/redirect.php?username=$username&registrationNo=\".$this->viewCreditLimit_setter_registrationNo().\"' target='_blank' class='unExceed'><font class='roomData'>\".$patientData[1].\"</font></a>&nbsp;</td>\";\n}else {\necho \"<td>&nbsp;</td>\";\n}\nif($patientData[0] != \"\") {\necho \"<Td>&nbsp;<font class='roomData'>\".number_format($credit,2 ).\"</font>&nbsp;</td>\";\n}else {\necho \"<td>&nbsp;</td>\";\n}\n\n}else { //execute notifier kpg meron credit limit n nka set sa patient as \"PATIENT\"\n\nif($credit > $limit) { //gwen red kpg Lagpas n sa limit\n\necho \"<Td class='exceeded'>&nbsp;<font class='roomData'>\".$row['Description'].\"</font>&nbsp;</td>\";\nif($patientData[0] != \"\") {\necho \"<Td class='exceeded'>&nbsp;<a href='http://\".$this->getMyUrl().\"/Department/redirect.php?username=$username&registrationNo=\".$this->viewCreditLimit_setter_registrationNo().\"' target='_blank' class='Exceed'><font class='roomData'>\".$patientData[1].\"</font></a>&nbsp;</td>\";\n}else {\necho \"<td class='exceeded'>&nbsp;</td>\";\n}\n\nif($patientData[0] != \"\") {\necho \"<Td class='exceeded'>&nbsp;<font class='roomData'>\".number_format($credit,2 ).\"</font>&nbsp;</td>\";\n}else {\necho \"<td class='exceeded'>&nbsp;</td>\";\n}\n\n}else { //gwen black kpg ndi n Lgpas sa limit\n\necho \"<Td>&nbsp;<font class='roomData'>\".$row['Description'].\"</font>&nbsp;</td>\";\nif($patientData[0] != \"\") {\necho \"<Td>&nbsp;<a href='http://\".$this->getMyUrl().\"/Department/redirect.php?username=$username&registrationNo=\".$this->viewCreditLimit_setter_registrationNo().\"' target='_blank' class='unExceed'><font class='roomData'>\".$patientData[1].\"</font></a>&nbsp;</td>\";\n}else {\necho \"<td>&nbsp;</td>\";\n}\nif($patientData[0] != \"\") {\necho \"<Td>&nbsp;<font class='roomData'>\".number_format($credit,2 ).\"</font>&nbsp;</td>\";\n}else {\necho \"<td>&nbsp;</td>\";\n}\n\n}\n\n}\n\necho \"</tr>\";\n }\n\necho \"<tr>\";\necho \"<td>&nbsp;<font size=2><b>\".$this->showAllRoom_room.\" Rooms</b></font>&nbsp;</td>\";\necho \"<td>&nbsp;<font size=2>Occupied&nbsp;<b>\".$this->showAllRoom_occupied.\"</b>&nbsp;|&nbsp;Vacant&nbsp;<b>\".$this->showAllRoom_vacant.\"</b></font>&nbsp;</td>\";\necho \"<td>&nbsp;<font size=2><b>\".number_format($this->showAllRoom_credit,2).\"</b></font>&nbsp;</td>\";\necho \"</tr>\";\necho \"</table>\";\necho \"<br>\";\necho \"</div>\";\n}", "function CNS_Showroom(){\n $this->db->select(\"*\");\n $this->db->from(\"Showroom\"); \n $query = $this->db->get();\n return $query->result_array();\n }", "function load_room_name($conn)\n{\n\t$output='';\n\t$edit_room_id=$_POST['Edit-room'];\n\t\n\t$query1 = \"SELECT * FROM room where ROOM_ID= $edit_room_id \";\n\t$result1 = mysqli_query($conn,$query1);\n\twhile($row = mysqli_fetch_array($result1)) \n\t{\n\t\t\n\t\t$output=$row[\"ROOM_NAME\"];\n\t}\n\treturn $output;\n}", "function getRooms(){\n\t\t$stmt = $this->connect->prepare(\"SELECT id,Name,RoomNo, Description from roominfo\");\n\t\t$stmt->execute();\n\t\t$stmt->bind_result($id, $name, $RoomNo, $Description);\n\t\t\n\t\t$rooms = array(); \n\t\t\n\t\twhile($stmt->fetch()){\n\t\t\t$room = array();\n\t\t\t$room['id'] = $id; \n\t\t\t$room['Name'] = $name; \n\t\t\t$room['RoomNo'] = $RoomNo; \n $room['Description'] = $Description; \n\t\t\tarray_push($rooms, $room); \n\t\t}\n\t\t\n\t\treturn $rooms; \n\t}", "function getRoomtypesDH ($forSelect = false) {\n\t\tglobal $wpdb;\n\t\t$roomtypes = array();\n\t\t$res = mysql_query('SELECT id, name, minimum, capacity, price, discription FROM '.$wpdb->prefix.DATABASE_PREFIX.'roomtypes ORDER by menuorder');\n\t\twhile ($row = mysql_fetch_assoc($res)) {\n\t\t\t$roomtypes[intval($row['id'])] = $forSelect ? \"{$row['name']} ({$row['capacity']})\" : $row;\n\t\t\tif (!$forSelect)\n\t\t\t\tunset($roomtypes[$row['id']]['id']);\n\t\t}\n\t\treturn $roomtypes;\n}", "public function index(){\n // $Room = Room::all();\n // dd($Room);\n // SELECT roomtype FROM `rooms` WHERE roomtype = \"single\"\n // $Room = DB::table('rooms')\n // ->select('rooms.roomType', 'rooms.id')\n // ->get();\n // dd($Room);\n $Rooms = DB::table('rooms')\n ->select('rooms.roomType')\n ->distinct()\n ->get();\n\n\n // dd($Rooms);\n return view('reservation/searchRoomF',['Rooms' => $Rooms]);\n}", "function car_hire(){\n //\n $sql= $this->chk(\n \"SELECT \n vehicle.reg_no,\n vehicle.model,\n vehicle.rate\n FROM \n vehicle \"\n );\n // \n $car_hire= $this->sqlData($sql);\n echo ($car_hire);\n }", "function getRoomType($result){\n\t\t//get record corresponding to that id_vehicle\n\t\t\t\t\t//$data=$this->Common_model->select_fields_where($tbl, '*', array('id_vehicle'=>$result), true);\n\t\t$tbl=$this->session->userdata('prefix').'roomtypes';\n\t\t$where=array($tbl.'.id_room'=>$result);\n\t\t// get the db tables list\n\t\t$tableList=getTables(); // define in custom helper\n\t\t// check if the tbl exist in db \n\t\tif(in_array($tbl, $tableList)){\n\t\t\t$data=$this->Common_model->select_fields_where($tbl, '*', $where, true);\n\t\t\treturn $data;\n\t\t} \n\n\t}", "function createRoomDropDown($dbSelected) {\n $tSQLselect = \"SELECT \";\n $tSQLselect .= \"loc_room \";\n $tSQLselect .= \"FROM \";\n $tSQLselect .= \"nhi_locations \";\n $tSQLselect .= \"order by loc_room \";\n\n\n $tSQLselect_Query = mysqli_query($dbSelected, $tSQLselect);\n\n $DropDown = \"\";\n $DropDown .= \" <option value=\\\"\\\">\\n\";\n while ($row = mysqli_fetch_assoc($tSQLselect_Query)) {\n\n foreach ($row as $idx => $r) {\n $DropDown .= \" <option value=\\\"$r\\\">\\n\";\n }\n }\n mysqli_free_result($tSQLselect_Query);\n\n return $DropDown;\n}", "function getRoomsAvailable(){\n\n global $db;\n\n $stmt= $db->prepare('SELECT room_id,branch\n FROM (\n SELECT room_id,\n room_branch AS branch\n FROM room\n WHERE NOT EXISTS (\n SELECT employee_room_id\n FROM employee\n WHERE employee_room_id = room_id\n )\n )');\n\n $stmt->execute();\n return $stmt->fetchAll();\n \n }", "function find_room1($date='',$pm_id = 0,$propertyroomid=0){\r\n\tglobal $db;\r\n\t$count =0;\r\n\tglobal $tblprefix;\r\n\t$new_date = date(\"m/d/Y\",strtotime($date));\r\n\t$qry_room = \"SELECT no_of_rooms FROM \".$tblprefix.\"advance_date WHERE pm_id=\".$pm_id.\" AND room_type_id=\".$propertyroomid.\" AND advance_date='\".$new_date.\"'\";\r\n \r\n $rs_room = $db->Execute($qry_room);\r\n return $rs_room->fields['no_of_rooms'];\r\n\r\n}", "public function getAllRooms()\n {\n $db = PDOController::getInstance();\n $req = $db->prepare('SELECT roomtypes.name, rooms.id, rooms.name AS roomName, services.name AS serviceName\n FROM rooms JOIN roomtypes ON roomtypes.id= rooms.type_id\n JOIN services ON services.id=rooms.service_id');\n $req->execute([]);\n \n return $req->fetchAll();\n }", "public function getPatientInTheRoom($room) {\n\n$con = ($GLOBALS[\"___mysqli_ston\"] = mysqli_connect($this->myHost, $this->username, $this->password));\nif (!$con)\n {\n die('Could not connect: ' . ((is_object($GLOBALS[\"___mysqli_ston\"])) ? mysqli_error($GLOBALS[\"___mysqli_ston\"]) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false)));\n }\n\n((bool)mysqli_query( $con, \"USE \" . $this->database));\n\n$result = mysqli_query($GLOBALS[\"___mysqli_ston\"], \"SELECT upper(pr.lastName) as lastName,upper(pr.firstName) as firstName,rd.registrationNo FROM patientRecord pr,registrationDetails rd WHERE pr.patientNo = rd.patientNo and rd.room = '$room' and rd.dateUnregistered = '' \");\nwhile($row=mysqli_fetch_array($result)) {\nreturn $row['registrationNo'].\"_\".$row['lastName'].\", \".$row['firstName'];\n}\n\n}", "function get_water_pumped_history($order_id){\r\n $configs = include('config/config.php');\r\n $query = \"SELECT * FROM \" . $vogomo_pump_water_history_table . \" WHERE oid='\" . $order_id . \"' AND action='water_pumped'\";\r\n //echo $query;\r\n $result = $configs->query($query);\r\n return $result;\r\n}", "public function getAllRoom(){\n $query = \"select * from $this->rooms_tableName where 1\";\n $result = $this->dbh->query($query);\n if($result->rowCount() > 0){\n return $result->fetchAll();\n }\n return null;\n }", "function getAvailHistory($conn){\r\n\t$cid = $_SESSION['uid'];\r\n\t$sql = \"SELECT a.aid, a.ato, a.afrom, a.ptype FROM availability a, bid b WHERE a.cid = '$cid' AND a.aid = b.aid AND b.status = 'successful'\";\r\n\t$result = pg_query($conn, $sql);\r\n\twhile ($row = pg_fetch_assoc($result)) {\r\n\t\t\t\techo \"<div class='panel panel-warning'><div class='panel panel-heading'><h3>\";\r\n\t\t\t\techo $row['ptype'];\r\n\t\t\t\techo \"</div><div class='panel panel-body'>\";\r\n\t\t\t\techo \"From \".$row['afrom'].\"</h3>\".\" to \".$row['ato'];\r\n\t\t\tshowSuccessfulBidders($conn, $row['aid']);\r\n\t\techo \"</div></div>\";\r\n\t}\r\n\t\r\n}", "function eateries(){\n $sql= $this->chk(\n \"SELECT \n eatery.name,\n eatery.description,\n eatery.rate\n FROM \n eatery \"\n );\n // \n $eateries= $this->sqlData($sql);\n echo ($eateries);\n }", "static function get_records_from_display_table($camp_id, $type){\n\t\tglobal $wpdb;\n\t\t$tables = self::get_tables_name();\n\t\textract($tables);\n\t\t$camp_id = (int) $camp_id;\n\t\t\n\t\t$sql = \"SELECT content FROM $display WHERE camp_id = $camp_id AND type = '$type'\";\n\t\t\n\t\t$return = $wpdb->get_col($sql);\n\t\tif($return){\n\t\t\treturn implode(', ', $return);\n\t\t}\n\t\t\n\t\treturn '';\n\t\t\n\t}", "function print_Vehicles(){\n $result = $this->query(\"SELECT * FROM VEHICLES\");\n while($row = mysqli_fetch_array($result)) {\n echo $row['TAG'] . \" \" . $row['MODEL'] . \" \" . $row['EMPLOYEE'];\n echo \"<br>\";\n }\n \n $result->close();\n }", "function displayStudy($tpl, $pid){\n $result = db_query(\"select A.begin_course_cd, B.begin_course_name from `take_course` A, `begin_course` B, `lrtunit_basic_` C\n where\n\t A.personal_id=$pid and\n\t\t B.begin_course_cd=A.begin_course_cd and\n\t\t\t C.unit_cd=B.begin_unit_cd and\n\t\t\t\t A.allow_course=1 and\n\t\t\t\t (A.course_end > NOW() or A.course_end is NULL) and\n\t\t\t\t B.note IS NOT NULL order by B.attribute\");\n\nwhile(($row = $result->fetchRow(DB_FETCHMODE_ASSOC)) != false){\n $tpl->append(\"all_course\", $row);\n }\n}", "function load_room_groups($options=array())\n{\n\tglobal $db;\n\n\t$where = \"WHERE 1\";\n\n\tif(isset($options['sort asc']))\n\t\t$sort = \"ORDER BY \".$options['sort asc'];\n\telse if(isset($options['sort desc']))\n\t\t$sort = \"ORDER BY \".$options['sort desc'];\n\telse\n\t\t$sort = \"ORDER BY ordering,name\";\n\n\n\t// load room_groups\n\t$select = \"SELECT * FROM room_groups $where AND active LIKE '1' $sort\";\n\t//print(\"select: $select<br>\\n\");\n\t$res = $db->query($select);\n\t$all_room_groups = array();\n\twhile($res->fetchInto($room_group))\n\t{\n\t\t$all_room_groups[$room_group->id] = $room_group;\n\t}\n\treturn($all_room_groups);\n}", "private function _getBaseQuery($type): string {\n $stmt = 'SELECT ';\n\n switch($type) {\n case 'resources':\n $stmt .= '`basePrice`, `dependantFactories`, `maxRate`';\n break;\n case 'factories':\n $stmt .= '`cashPerHour`, `dependantFactories`, `dependencies`, `scaling`, `requiredAmount`, `upgradeMaterial`, `upgradeMaterialAmount`';\n break;\n case 'loot':\n $stmt .= '`recyclingDivisor`, `recyclingProduct`, `recyclingAmount`';\n break;\n case 'units':\n $stmt .= '`requirements`, `requiredAmount`, `baseStrength`';\n break;\n case 'headquarter':\n $stmt .= '`amount`, `material`, `boost`, `radius`';\n break;\n case 'buildings':\n $stmt .= '`level`, `material`, `materialAmount0`, `materialAmount1`, `materialAmount2`, `materialAmount3`';\n break;\n case 'settings':\n $stmt .= '`setting`, `value`, `description`';\n break;\n }\n\n $stmt .= ' FROM `' . $type . '` ORDER BY `id` ASC';\n\n return $stmt;\n }", "public function sparooms($type=\"sparoom\")\n {\n\n $query=$this->sparoomquery();\n return DB::select(DB::raw($query));\n /*return $sparoom = DB::table(\"opos_ftype\")\n ->leftJoin(\"opos_lockerkeytxnsparoom\",\"opos_lockerkeytxnsparoom.sparoom_ftype_id\",\"=\",\"opos_ftype.id\")\n ->whereNull(\"opos_ftype.deleted_at\")\n \n /* ->whereNull(\"opos_lockerkeytxnsparoom.sparoom_checkout\")*/\n /* ->whereNotNull(\"opos_lockerkeytxnsparoom.sparoom_checkin\")*/\n /*->where(\"opos_ftype.ftype\",$type)\n\n ->orderBy('opos_ftype.fnumber','ASC')\n ->select(\"opos_ftype.*\",\"opos_lockerkeytxnsparoom.sparoom_checkin\",\"opos_lockerkeytxnsparoom.sparoom_checkout\")\n ->get();*/\n }", "function load_rooms($room_ids=null,$options=array())\n{\n\tglobal $db;\n\n\t$room_limiter = \"\";\n\tif($room_ids)\n\t{\n\t\tif(is_array($room_ids))\n\t\t{\n\t\t\tforeach($room_ids as $room_id)\n\t\t\t{\n\t\t\t\t$room_limiter .= \" AND id LIKE '$room_id'\";\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$room_limiter .= \"AND id like '$room_ids'\";\n\t\t}\n\t}\n\n\tif(isset($options['id']))\n\t{\n\t\t$room_limiter .= \"AND id like '\".$options['id'].\"'\";\n\t}\n\n\tif(isset($options['room_number']))\n\t{\n\t\t$room_number_limiter .= \"AND room_number like '\".$options['room_number'].\"'\";\n\t}\n\n\tif(isset($options['out_of_order']))\n\t{\n\t\t$room_number_limiter .= \"AND out_of_order like '\".$options['out_of_order'].\"'\";\n\t}\n\n\tif(isset($options['capacity']))\n\t{\n\t\t// separate capacity range into low-high thresholds\n\t\t$capacity_parts = explode(\"-\",$options['capacity']);\n\t\t$capacity_low = $capacity_parts[0];\n\t\t$capacity_high = $capacity_parts[1];\n\t\t$room_number_limiter .= \"AND capacity >= '$capacity_low' AND capacity <= '$capacity_high'\";\n\t}\n\n\tif(isset($options['capacity gte']))\n\t{\n\t\t$room_number_limiter .= \"AND capacity >= '\".$options['capacity gte'].\"'\";\n\t}\n\n\n\tif(isset($options['sort asc']))\n\t\t$sort = \"ORDER BY \".$options['sort asc'];\n\telse if(isset($options['sort desc']))\n\t\t$sort = \"ORDER BY \".$options['sort desc'];\n\telse\n\t\t$sort = \"ORDER BY capacity,room_number\";\n\n\tif(isset($options['limit']))\n\t\t$limit = \"LIMIT \".$limit;\n\telse\n\t\t$limit = \"\";\n\n\t$select = \"SELECT * FROM study_rooms WHERE 1 $room_limiter $room_number_limiter AND active like '1' $sort $limit\";\n\t//print(\"select: $select<br>\\n\");\n\t$res = $db->query($select);\n\t$all_rooms = array();\n\twhile($res->fetchInto($room))\n\t{\n\t\t$room->amenities = array();\n\t\t$room->keys = array();\n\t\t$room->room_number = ltrim($room->room_number,'0');\n\n\t\t$all_rooms[$room->id] = $room;\n\t}\n\n\tprint(\"select: $select<br>\\n\");\n\n\t$room_limiter = str_replace(\"AND id\",\"AND room_id\",$room_limiter);\n\n\t$all_amenities = load_amenities();\n\n\t// load amenity associations\n\t$select = \"SELECT * FROM study_rooms_amenities WHERE 1 $room_limiter AND active like '1' ORDER BY ordering,id\";\n\t//print(\"select: $select<br>\\n\");\n\t$res = $db->query($select);\n\twhile($res->fetchInto($room_amenity))\n\t{\n\t\tif(isset($all_rooms[$room_amenity->room_id]))\n\t\t{\n\t\t\tif(isset($all_amenities[$room_amenity->amenity_id]))\n\t\t\t{\n\t\t\t\t$amenity = $all_amenities[$room_amenity->amenity_id];\n\t\t\t\t$room_amenity->name = $amenity->name;\n\t\t\t\t$room_amenity->description = $amenity->description;\n\t\t\t\t$room_amenity->search_filter = $amenity->search_filter;\n\t\t\t\t$all_rooms[$room_amenity->room_id]->amenities[] = $room_amenity;\n\t\t\t}\n\t\t}\n\t}\n\n\n\tif(isset($options['amenities and']))\n\t{\n\t\t// remove rooms that don't match all amenity filters\n\t\tforeach($all_rooms as $room_id => $room)\n\t\t{\n\t\t\tforeach($options['amenities and'] as $amenity)\n\t\t\t{\n\t\t\t\t$a_ok = false;\n\t\t\t\tforeach($room->amenities as $ra)\n\t\t\t\t{\n\t\t\t\t\tif($ra->amenity_id == $amenity)\n\t\t\t\t\t{\n\t\t\t\t\t\t$a_ok = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif($a_ok)\n\t\t\t\t\tcontinue;\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t// amenity was not found for this room, remove room from results\n\t\t\t\t\tunset($all_rooms[$room_id]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\n\t// load images\n\t$select = \"select * from room_images where 1 $room_limiter AND active like '1' order by ordering,id\";\n\t$res = $db->query($select);\n\twhile($res->fetchInto($room_image))\n\t{\n\t\tif(isset($all_rooms[$room_image->room_id]))\n\t\t{\n\t\t\t$image_location = \"images/rooms/\".$room_image->room_id.\"/\".$room_image->type.$room_image->room_id.\"_\".$room_image->id;\n\t\t\tswitch($room_image->format)\n\t\t\t{\n\t\t\t\tcase 'image/jpeg': $extension = \"jpg\"; break;\n\t\t\t\tcase 'image/png': $extension = \"png\"; break;\n\t\t\t\tcase 'image/gif': $extension = \"gif\"; break;\n\t\t\t\tdefault: $extension = str_replace(\"images/\",\"\",$room_image->format);\n\t\t\t}\n\t\t\t$image_location .= \".\".$extension;\n\t\t\t$room_image->location = $image_location;\n\t\t\t$all_rooms[$room_image->room_id]->images[$room_image->type][] = $room_image;\n\t\t}\n\t}\n\n\t// load keys\n\t$select = \"select * from rooms_keys where 1 $room_limiter AND active like '1'\";\n\t$res = $db->query($select);\n\twhile($res->fetchInto($key))\n\t{\n\t\tif(isset($all_rooms[$key->room_id]))\n\t\t{\n\t\t\t$all_rooms[$key->room_id]->keys[] = $key;\n\t\t}\n\t}\n\n\t$return = array();\n\tif(isset($options['group_by']))\n\t{\n\t\t$group_by = $options['group_by'];\n\t\tforeach($all_rooms as $room_id => $room)\n\t\t{\n\t\t\t$return[$room->$group_by][$room->id] = $room;\n\t\t}\n\t}\n\telse\n\t{\n\t\t$return = $all_rooms;\n\t}\n\n\treturn($return);\n}", "public function get_rooms()\n\t\t{\n\t\t\t$this->db->where(\"room_active\",1);\n\t\t\t$rooms = $this->db->get(\"rooms\");\n\t\t\treturn $rooms;\n\t\t}", "public function getSQL(){\n $sqlString = \"select \";\n $campos = $this->getCampos();\n //var_dump($campos);\n if (is_array($campos) && empty($campos)) {\n $sqlString .= \" * \";\n } else {\n $campos = \"\";\n foreach ($this->getCampos() as $key => $value) {\n if (!$campos == \"\") { \n $campos.=\" ,\"; \n };\n $campos.=\" \".$value.\" as \".$key.\" \";\n }\n $sqlString .= $campos;\n }\n $sqlString .= \" from \" . $this->getTabla();\n if ( $this->getSQLFilter() != \"\" ) {\n $sqlString .= \" where \" . $this->getSQLFilter();\n }\n \n $sqlString .= $this->getSQLGroupBy();\n $sqlString .= $this->getSQLOrderBy();\n //echo $sqlString.\"\\n\";\n return $sqlString; \n }", "function floorplan_cat_name($field)\n{\n$cms=mysql_fetch_array(mysql_query(\"select floor_catname from manage_floor_category where fcat_id='\".$field.\"'\"));\nreturn $cms['floor_catname'];\n}", "static function getBedcountReport( $selectedDate, $allocJobId ) {\n global $wpdb;\n\n $sql = \"SELECT room, capacity, room_type, \n -- these are the room types in the bedcounts for HSH\n\t\t\t\t\tCASE WHEN capacity = 2 THEN 'Double/Twin'\n\t\t\t\t\tWHEN capacity = 4 THEN 'Quad/4 Bed Dorm'\n\t\t\t\t\tWHEN capacity BETWEEN 16 AND 18 THEN '16-18 Bed Dorm'\n\t\t\t\t\tWHEN capacity BETWEEN 6 AND 12 THEN '6-12 Bed Dorm'\n\t\t\t\t\tELSE 'Unknown' END AS hsh_room_type,\n -- magnify private rooms based on size of room\n IF(room_type IN ('DBL','TRIPLE','QUAD','TWIN'), num_empty * capacity, num_empty) `num_empty`, \n IF(room_type IN ('DBL','TRIPLE','QUAD','TWIN'), num_staff * capacity, num_staff) `num_staff`, \n IF(room_type IN ('DBL','TRIPLE','QUAD','TWIN'), num_paid * capacity, num_paid) `num_paid`, \n IF(room_type IN ('DBL','TRIPLE','QUAD','TWIN'), num_noshow * capacity, num_noshow) `num_noshow`\n FROM (\n -- room 30/paid beds is split into separate rooms for some reason; collapse them\n SELECT IF(p.room_type = 'PAID BEDS', 'PB', p.room) `room`, IF(p.room_type = 'PAID BEDS', 8, p.capacity) `capacity`, p.room_type,\n SUM(IF(p.reservation_id IS NULL AND p.room_type != 'PAID BEDS', 1, 0)) `num_empty`,\n SUM(IF(p.reservation_id = 0, 1, 0)) `num_staff`, \n SUM(IF(p.lh_status IN ('checked-in', 'checked-out', 'checked_in', 'checked_out') AND p.reservation_id > 0, 1, 0)) `num_paid`, \n SUM(IF(IFNULL(p.lh_status, '') NOT IN ('checked-in', 'checked-out', 'checked_in', 'checked_out') AND p.reservation_id > 0, 1, 0)) `num_noshow`\n FROM (\n SELECT rm.room, rm.bed_name, rm.capacity, rm.room_type, c.reservation_id, c.payment_outstanding, c.guest_name, c.notes, c.lh_status\n FROM wp_lh_rooms rm\n LEFT OUTER JOIN \n ( SELECT cal.* FROM wp_lh_calendar cal, (select %s AS selection_date) const\n WHERE cal.job_id = %d -- the job_id to use data for\n AND cal.checkin_date <= const.selection_date\n AND cal.checkout_date > const.selection_date\n ) c \n -- if unallocated (room_id = null), then ignore this join field and match on room_type_id\n ON IFNULL(c.room_id, rm.id) = rm.id AND IFNULL(IF(c.room LIKE 'PB(%', 'PB', c.room), 'Unallocated') = rm.room AND c.room_type_id = rm.room_type_id\n\t\t\t\t\tWHERE rm.active_yn = 'Y' OR rm.room_type = 'PAID BEDS' OR rm.room = 'Unallocated'\n ) p\n GROUP BY IF(p.room_type = 'PAID BEDS', 'PB', p.room), p.capacity, p.room_type\n ) t\n -- only include Unallocated if we have something to report\n WHERE room != 'Unallocated'\n -- 2018-06-17: don't include unallocated anymore; throws off count in cloudbeds\n -- OR ((room_type = 'PAID BEDS' OR room = 'Unallocated') AND (num_staff > 0 OR num_paid > 0 OR num_noshow > 0))\n ORDER BY room\";\n\n // HSH bedcounts are actually by room type\n if( get_option('blogname') == 'High Street Hostel Bookings' ) {\n $sql = \"SELECT GROUP_CONCAT(room ORDER BY room SEPARATOR ', ') AS room,\n hsh_room_type AS room_type, \n SUM(capacity) AS capacity,\n\t\t SUM(num_empty) AS num_empty, SUM(num_staff) AS num_staff, SUM(num_paid) AS num_paid, SUM(num_noshow) AS num_noshow\n FROM ( $sql ) hsh\n GROUP BY CRC32(hsh_room_type) -- some weirdness with MariaDB here\n ORDER BY capacity\";\n }\n else {\n // for paid beds, the \"paid\" category doesn't need to be \"checked-in\"\n $sql = \"SELECT room, capacity, room_type, num_empty, num_staff,\n IF(room = 'PB', num_paid + num_noshow, num_paid) AS num_paid,\n IF(room = 'PB', 0, num_noshow) AS num_noshow\n FROM ( $sql ) bc\";\n }\n\n $resultset = $wpdb->get_results($wpdb->prepare(\n $sql, $selectedDate->format('Y-m-d H:i:s'), $allocJobId ));\n\n if($wpdb->last_error) {\n throw new DatabaseException($wpdb->last_error);\n }\n\n return $resultset;\n }", "function displayOptions(){\n global $dbConn;\n $sql = 'SELECT DISTINCT (category) FROM p1_quotes';\n $statement = $dbConn->prepare($sql); \n $statement->execute();\n $records = $statement->fetchAll();\n foreach ($records as $record) {\n echo '<option>' . $record[\"category\"] . '</option>';\n }\n}", "function get_type_name($type_name) {\nglobal $db;\n$query = 'SELECT * FROM types\n WHERE typeID = :type_id';\n$statement = $db->prepare($query);\n$statement->bindValue(':type_id', $type_id);\n$statement->execute();\n$type = $statement->fetch();\n$type_name = $type['vehicleTypes'];\n$statement->closeCursor();\nreturn $type_name;\n}", "function activities(){\n $sql= $this->chk(\n \"SELECT \n activity.name,\n activity.description,\n activity.rate\n FROM \n activity \"\n );\n // \n $activity= $this->sqlData($sql);\n echo ($activity);\n\n }", "function accommodation(){\n $sql= $this->chk(\n \"SELECT \n accommodation.name,\n accommodation.description,\n acccomodation.rate\n FROM \n accommodation \"\n );\n // \n $accomodation= $this->sqlData($sql);\n echo ($accomodation);\n }", "function show_available_bookings(){\n global $db;\n $sql = \"SELECT * FROM booking_info;\";\n $result = $db->query($sql);\n return $result;\n}", "function select_rollingroad_data($rrid)\n\t{\n\t\tglobal $db;\n\n\t \t$sql = \"SELECT rr.*, images.* , g.made_year, makes.make, models.model, CONCAT_WS(' ', g.made_year, makes.make, models.model) AS vehicle\n \tFROM \" . GARAGE_ROLLINGROAD_TABLE . \" AS rr\n\t\t \tLEFT JOIN \" . GARAGE_TABLE . \" AS g ON rr.garage_id = g.id\n\t\t \tLEFT JOIN \" . GARAGE_MAKES_TABLE . \" AS makes ON g.make_id = makes.id\n \tLEFT JOIN \" . GARAGE_MODELS_TABLE . \" AS models ON g.model_id = models.id\n \t\t\tLEFT JOIN \" . GARAGE_IMAGES_TABLE . \" AS images ON images.attach_id = rr.image_id \n \tWHERE rr.id = $rrid\";\n\n\t\tif ( !($result = $db->sql_query($sql)) )\n \t\t{\n \t\tmessage_die(GENERAL_ERROR, 'Could Not Select Quartermile Data', '', __LINE__, __FILE__, $sql);\n \t\t}\n\n\t\t$row = $db->sql_fetchrow($result);\n\t\t$db->sql_freeresult($result);\n\n\t\treturn $row;\n\t}", "function getcardetails($c_type)\n{\n\t//returns the details of the car\n\t$sql=\"select * from care_detail where c_type='$c_type' and status=0 order by rand() limit 1\";\n\tforeach($GLOBALS['db']->query($sql) as $row);\n\tif(isset($row))\n\t\treturn $row;\n}", "public function equipment_type(){\n\t\t\t$equip_type_qry = $this->db->prepare(\"SELECT * FROM truck_type WHERE status = '1'\");\n\t\t\t$equip_type_qry->execute();\n\t\t\t$fetch= array();\n\t\t\twhile($equip_type_row = $equip_type_qry->fetch(PDO::FETCH_ASSOC)){\n\t\t\t\t$fetch[]=$equip_type_row;\n\t\t\t}\n\t\t\treturn $fetch;\n\t\t}", "function readByCapacityID(){\r\n\t\t\r\n\t\t// select all from roomtype table\r\n\t\t$query=\"Select * from \" . $this->table_name . \"\r\n\t\tWHERE capacityid=?\";\r\n\t\t\r\n\t\t// prepare query statement\r\n\t\t$stmt = $this->conn->prepare( $query );\r\n\t\t\r\n\t\t// bind values\r\n\t\t$stmt->bindParam(1, $this->capacityid);\r\n\t\t\r\n\t\t// execute query\r\n\t\t$stmt->execute();\r\n\t\t\t\t\r\n\t\t// return values\r\n\t\treturn $stmt;\r\n\t}", "public function viewVotingSummary()\r\n{\r\n $query_string = \"SELECT systemid, systemname, systemsummary \";\r\n $query_string .= \"FROM voting_system \";\r\n $query_string .= \"WHERE systemtypeid = :systemtypeid\";\r\n\r\n return $query_string;\r\n}", "public function bring_Function_by_idroom($room)\n { \n try{\n if ($room != null) {\n $sql = \"SELECT * FROM $this->table WHERE room = \\\"$room\\\"\";\n\n $conec = Conection::conection();\n\n $judgment = $conec->prepare($sql);\n\n $judgment->execute();\n\n\n $dataSet = $judgment->fetchAll(\\PDO::FETCH_ASSOC);\n\n $this->mapear($dataSet);\n\n if(!empty($this->list)){\n\n return $this->list;\n }\n }\n\n return null;\n }catch(\\PDOException $e){\n echo $e->getMessage();\n }catch(\\Exception $e){\n echo $e->getMessage();\n }\n }", "function _getCatsoneQuery( $jobType )\n\t{\n\t\t$query = \"Select joborder.*,extra_field.* from joborder,extra_field where field_name LIKE('Job Orders') AND extra_field.data_item_id = joborder.joborder_id\";\n\t\tif($jobType)\n\t\t{\n\t\t\t$query.=\" and extra_field.value like '$jobType'\";\n\t\t}\n\t\treturn $query;\n\t}", "function getinventory_for_hotel($hotel_id){\n $query =\"SELECT inventory.id as id, cast(date as date) as date,(inventory.total_available - inventory.booked - inventory.blocked) as final_available, inventory.category_id, room_categories.category_name, FROM `inventory` \n INNER JOIN room_categories on room_categories.id = inventory.category_id\n WHERE inventory.hotel_id = $hotel_id and date >= CURDATE()\";\n return $this->db->query($query)->result_array();\n }", "function bookingstatus_listdata( $tbl_bookingstatus ){\n\t\t$sql = mysql_query(\"SELECT * FROM $tbl_bookingstatus\");\n\t\treturn $sql;\n}", "static function getLoadQry()\n {\n return \"SELECT `smartukm_band`.*, \n `td`.`td_demand`,\n `td`.`td_konferansier`\n \";\n }", "function show_all()\n\t{\n\t\t$orderBy=\"\";\n\t\t$sql = \"SELECT * \n\t\tFROM umgroup INNER JOIN umsystem \n\t\tON umgroup.GpStID = umsystem.StID\n\t\t$orderBy\";\n\t\t$query = $this->ums->query($sql);\n\t\treturn $query;\n\t}", "function getAllMaterialTypes(){\n\n\t$result = mysqli_query(dbConnection(),\"select *from item_types where status = 1\");\n\treturn $result;\n}", "public function getSystem()\r\n{\r\n $query_string = \"SELECT systemname, systemtypeid, systemsummary, systeminformation FROM voting_system \";\r\n $query_string .= \"WHERE systemid = :systemid\";\r\n\r\n return $query_string;\r\n}", "function select_quartermile_data($qmid)\n\t{\n\t\tglobal $db;\n\t\n\t \t$sql = \"SELECT qm.*, rr.id, rr.bhp, rr.bhp_unit, images.*, g.made_year, makes.make, models.model, CONCAT_WS(' ', g.made_year, makes.make, models.model) AS vehicle\n \tFROM \" . GARAGE_QUARTERMILE_TABLE . \" AS qm\n\t\t \tLEFT JOIN \" . GARAGE_TABLE . \" AS g ON qm.garage_id = g.id\n\t\t \tLEFT JOIN \" . GARAGE_MAKES_TABLE . \" AS makes ON g.make_id = makes.id\n \tLEFT JOIN \" . GARAGE_MODELS_TABLE . \" AS models ON g.model_id = models.id\n \t\t\tLEFT JOIN \" . GARAGE_IMAGES_TABLE . \" AS images ON images.attach_id = qm.image_id \n\t \t\tLEFT JOIN \" . GARAGE_ROLLINGROAD_TABLE . \" AS rr ON rr.id = qm.rr_id \n \tWHERE qm.id = $qmid\";\n\n \t\tif ( !($result = $db->sql_query($sql)) )\n \t\t{\n \t\tmessage_die(GENERAL_ERROR, 'Could Not Select Quartermile Data', '', __LINE__, __FILE__, $sql);\n \t\t}\n\n\t\t$row = $db->sql_fetchrow($result);\n\t\t$db->sql_freeresult($result);\n\n\t\treturn $row;\n\t}", "public function bookroom($filters=array()){\n\n//\t\t debug($filters);\t\n// die();\n////\t\t\n $this->db->select(\"*\"); \n\t\t$this->db->from('hotel_room');\n $this->db->where('booking_status','0');\n if (isset($filters['hotel_id']) && $filters['hotel_id'] != '') {\n $this->db->where(\"hotel_id\" ,$filters['hotel_id']);\n }\n if (isset($filters['bed_type']) && $filters['bed_type'] != '') {\n $this->db->where(\"bed_type\" ,$filters['bed_type']);\n }\n // if (isset($filters['no_of_room']) && $filters['no_of_room'] != '') {\n // $this->db->limit($filters['no_of_room']);\n // }\n $this->db->limit(1);\n \n $return =$this->db->get()->result_array();\n \n return $return;\n\n\t}", "public function showOption_where($table,$cols,$identifier,$identifierData) {\n\n$con = ($GLOBALS[\"___mysqli_ston\"] = mysqli_connect($this->myHost, $this->username, $this->password));\nif (!$con)\n {\n die('Could not connect: ' . ((is_object($GLOBALS[\"___mysqli_ston\"])) ? mysqli_error($GLOBALS[\"___mysqli_ston\"]) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false)));\n }\n\n((bool)mysqli_query( $con, \"USE \" . $this->database));\n\n$result = mysqli_query($GLOBALS[\"___mysqli_ston\"], \"SELECT ($cols) cols FROM $table WHERE $identifier = '$identifierData' order by cols asc \");\n\nwhile($row = mysqli_fetch_array($result))\n {\necho \"<option value='\".$row['cols'].\"'>\".$row['cols'].\"</option>\";\n }\n\n}", "public function actionAmmanShowRooms() {\n $session = Yii::$app->session;\n $lang_id = $session['language_id'];\n $get_make = Make::find()->where(['lang_id' => $lang_id])->all();\n $select_milage = Milage::find()->all();\n $select_colors = Colors::find()->all();\n $select_stores = Stores::find()->where(['location' => 1])->orderBy(['id' => SORT_DESC])->all();\n $select_car_main_features_category = CarsFeaturesMainCategory::find()->where(['lang_id' => $lang_id])->all();\n $select_car_features_category = CarsFeaturesCategory::find()->where(['lang_id' => $lang_id])->all();\n return $this->render('amman-show-rooms', [\n 'make_details' => $get_make,\n 'select_milage' => $select_milage,\n 'select_car_main_features_category' => $select_car_main_features_category,\n 'select_car_features_category' => $select_car_features_category,\n 'select_colors' => $select_colors,\n 'select_stores' => $select_stores,\n ]);\n }", "public function getSystemType()\r\n{\r\n $query_string = \"SELECT systemtypename, systemtypedesc FROM system_type \";\r\n $query_string .= \"WHERE systemtypeid = :systemtypeid\";\r\n\r\n return $query_string;\r\n}", "function get_avaliable_rooms($fromTime, $toTime){\n global $DB, $USER, $CFG;\n\n //reservation starts: Start = S, End = E\n //Location: Above Given Start Time : A, Between given start/end: M, After End Time: E\n\n //Cases:\n //SA EA, --(start above, end above) non useful\n //SA EM, --(start above, end mid)\n //SA EE, -- (Start above, end after)\n //SM EA -- (start mid, end above) -- no useful\n //SM EM -- start mid, end mid\n //SM EE -- start mid, end after\n //SE EA -- non useful\n //SE EM -- non useful\n //SE EE -- non useful\n\n\n $sql = \"SELECT DISTINCT * FROM {roomscheduler_rooms} room \".\n\"WHERE room.active = 1 AND room.id not in ( \". //check which rooms are not avaliable\n\"SELECT DISTINCT rom.id FROM {roomscheduler_reservations} res, {roomscheduler_rooms} rom \".\n\"WHERE rom.id = res.location AND res.active=1 AND ( \".\n\"(res.startdate <= $fromTime AND res.enddate <= $toTime and res.enddate > $fromTime ) OR \". //--(start above, end mid)\n\"(res.startdate <= $fromTime AND res.enddate > $toTime ) OR \". //-- (Start above, end after)\n\"(res.startdate >= $fromTime AND res.startdate < $toTime and res.enddate > $fromTime AND res.enddate <= $toTime ) OR \". //-- start mid, end mid\n\"(res.startdate >= $fromTime AND res.startdate < $toTime AND res.enddate > $toTime )) \".//-- start mid, end after\n\");\";\n\n$rooms = $DB->get_records_sql($sql, array(), $limitfrom=0, $limitnum=0);\n\n\nprint '<center><table id=\"open_rooms_table\">';\nprint '<tr><th>'.get_string('room','block_roomscheduler');\nprint '</th><th>'.get_string('resources','block_roomscheduler');\nprint '</th><th>'.get_string('bookroom','block_roomscheduler').'</th></tr>';\nif($rooms){\n$index = 1;\nforeach($rooms as $room){\n\nprint '<tr onclick=\"\"><td>';\n\nprint \"$index. \".$room->name;\n\nprint '</td><td>';\nprint $room->resources;\nprint '</td><td>';\n\nprint '<form><center>';\nif($room->reservable){\nprint '<input type=\"image\" src=\"img/success.gif\" value=\"Book Room\" onclick=\"book_room('.$room->id.');return false;\" />';\n} else {\n$email = $CFG->roomscheduler_manage_email;\n$subject = get_string('book_room_email_subject','block_roomscheduler');\n\n$information = get_string('email_room','block_roomscheduler').\" \".$room->name . \"%0A\";\n$information .= get_string('email_start','block_roomscheduler').\" \".date( 'F n, Y @ G:i' , $fromTime ). \"%0A\";\n$information .= get_string('email_end','block_roomscheduler').\" \".date( 'F n, Y @ G:i' , $toTime ). \"%0A\";\n$information .= get_string('email_reason','block_roomscheduler').\" _______________________________%0A%0A\";\n\n$body = get_string('book_room_email_body','block_roomscheduler') . $information;\n$body .= get_string('book_room_email_close','block_roomscheduler') . $USER->firstname .\" \".$USER->lastname ;\n\n\nprint '<a href=\"mailto:'.$email.'?subject='.$subject.'&body='.$body.'\" border=\"0\">\n <img src=\"img/email.png\"></a>';\n\n}\nprint '</form></center>';\nprint '</td></tr>';\n\n\n\n\n $index++;\n}\n}\nprint '</table></center>';\n\n}", "public function showRooms()\n {\n $roomModel = new \\BAServer\\Models\\Room();\n $rooms = $roomModel->getRooms();\n\n var_dump($rooms);\n return 'Rooms';\n }", "function getChromosomeName($chrom_id){\n $query=\"select chromosome_name from chromosome where chromosome_id=$chrom_id\";\n global $con;if(!$con)$con=getConnection();\n $result = mysql_query($query,$con);$chr_name=\"\";\n if($result){\n $numRows =mysql_numrows($result);\n if($numRows>0){\n $row = mysql_fetch_assoc($result);\n $chr_name=$row[\"chromosome_name\"];\n }\n }\n return $chr_name;\n}", "function career_view_sql()\n\t{\n\t\t$view_career=mysqli_query($this->con,\"SELECT * FROM career order by career_id desc\");\n\t\treturn $view_career;\n\t}", "function career_view_sql()\n\t{\n\t\t$view_career=mysqli_query($this->con,\"SELECT * FROM career order by career_id desc\");\n\t\treturn $view_career;\n\t}", "function getConstructionInfo($conn, $buildingType){\n\tif($buildingType == \"custom\"){\n\t\t$sql = \"SELECT * FROM constructioninfo ORDER BY InfoType\";\n\t}\n\telse{\n\t\t$sql = \"SELECT * FROM constructioninfo WHERE BuildingType = :buildingType ORDER BY InfoType\";\n\t}\n\t\n\t$sth = $conn->prepare($sql);\n\t$sth->bindParam(':buildingType', $buildingType, PDO::PARAM_STR, 25);\n\t$sth->execute();\n\t\n\t$rows = array();\n\t\n\twhile($r = $sth->fetch(PDO::FETCH_ASSOC)) {\n\t\t$rows[] = $r;\n\t}\n\treturn $rows;\n\n}", "function banner_view_sql()\n {\n \t$banner_view=mysqli_query($this->con,\"SELECT * FROM `banner` where status=1 order by id desc\");\n \treturn $banner_view;\n }", "public function getSystems()\r\n{\r\n $query_string = \"SELECT systemid, systemname \";\r\n $query_string .= \"FROM voting_system\";\r\n\r\n return $query_string;\r\n}", "function fetch($table, $campos=\"*\", $where=\"\", $order=\"\", $tipo=\"\", $limite=\"\"){\n\n\t\t$sql = \"SELECT DISTINCT \";\n\n\t\tif(is_array($campos)){\n\n\t\t\tforeach ($campos as $value){\n\t\t\t\t$sql .= \"'$value' ,\";\n\t\t\t}\n\n\t\t\t$strCut = strlen($sql) -1;\n\t\t\t$sql = substr($sql,0,$strCut);\n\n\t\t}else{\n\n\t\t\t$sql .= \" $campos \";\n\n\t\t}\n\n\t\tif ( strstr($table, \"|\") ) {\n\n\t\t\t$fromTable = substr($table,0,strpos($table,\"|\"));\n\n\t\t\t$leftJoin = substr($table,strpos($table,\"|\"),strlen($table));\n\n\t\t\t$leftJoin = explode(\"|\",$leftJoin);\n\n\t\t\t$sql .= \" FROM \".$fromTable;\n\n\t\t\tforeach ($leftJoin as $ex){\n\n\t\t\t\t$leftEx = explode(\">\", $ex );\n\n\t\t\t\t@list($left_table, $on_condition) = $leftEx;\n\n\t\t\t\tif(!empty($left_table)){\n\t\t\t\t\t$sql .= \" LEFT JOIN \" . $left_table;\n\t\t\t\t}\n\t\t\t\tif(!empty($on_condition)){\n\t\t\t\t\t$sql .= \" ON \" . $on_condition;\n\t\t\t\t}\n\n\n\t\t\t}\n\n\t\t}else{\n\n\t\t\t$sql .= \" FROM $table \";\n\n\t\t}\n\n\n\t\tif(!empty($where)) $sql .= \" WHERE \";\n\n\n\t\tif(is_array($where)){\n\n\t\t\tforeach ($where as $key => $value){\n\n\t\t\t\tif( strstr($value,\"!\") ){\n\t\t\t\t\t\t$value = substr($value, 1);\n\t\t\t\t\t\tif (strtolower($value) == \"empty\"){\n\t\t\t\t\t\t\t\t$sql .= \" $key <> '' OR $key <> 0 OR $key <> NULL AND\";\n\t\t\t\t\t\t}else if(is_int($value)){\n\t\t\t\t\t\t\t\t$sql .= \" $key <> $value OR $key <> 0 OR $key <> NULL AND\";\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t\t$sql .= \" $key <> '$value' OR $key <> 0 OR $key <> NULL AND\";\n\t\t\t\t\t\t}\n\n\t\t\t\t}elseif( strstr($value,\"!<\") ){\n\t\t\t\t\t\t$value = substr($value, 2);\n\t\t\t\t\t\tif (strtolower($value) == \"empty\"){\n\t\t\t\t\t\t\t\t$sql .= \" $key <= '' AND\";\n\t\t\t\t\t\t}else if(is_int($value)){\n\t\t\t\t\t\t\t\t$sql .= \" $key <= $value AND\";\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t\t$sql .= \" $key <= '$value' AND\";\n\t\t\t\t\t\t}\n\n\t\t\t\t}elseif( strstr($value,\"!>\") ){\n\t\t\t\t\t\t$value = substr($value, 2);\n\t\t\t\t\t\tif (strtolower($value) == \"empty\"){\n\t\t\t\t\t\t\t\t$sql .= \" $key >= '' AND\";\n\t\t\t\t\t\t}else if(is_int($value)){\n\t\t\t\t\t\t\t\t$sql .= \" $key >= $value AND\";\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t\t$sql .= \" $key >= '$value' AND\";\n\t\t\t\t\t\t}\n\n\n\t\t\t\t\t}else{\n\t\t\t\t\t\tif(is_int($value)){\n\t\t\t\t\t\t$sql .= \" $key LIKE $value AND\";\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t$sql .= \" $key LIKE '$value' AND\";\n\t\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t$strCut = strlen($sql)-3;\n\t\t\t$sql = substr($sql,0,$strCut);\n\n\t\t}else{\n\n\t\t\t$sql .= \" $where \";\n\n\t\t}\n\n\t\t//envia sql para total rows\n\t\t$this->sql = $sql;\n\n\t\tif(!empty($order)) $sql .= \" ORDER BY \";\n\n\n\t\tif(is_array($order)){\n\n\t\t\tforeach ($order as $value){\n\t\t\t\t$sql .= \"$value ,\";\n\t\t\t}\n\n\t\t\t$strCut = strlen($sql)-1;\n\t\t\t$sql = substr($sql,0,$strCut);\n\n\t\t}else{\n\n\t\t\t$sql .= \" $order \";\n\n\t\t}\n\n\t\tif(!empty($tipo)) $sql .= \" $tipo \";\n\n\t\tif(!empty($limite)) $sql .= \" LIMIT $limite \";\n\n\t\t$qr = mysql_query($sql) or die($sql . \" <hr> \" . mysql_error());\n\t\t$rows = mysql_num_rows($qr);\n\n\t if($rows){\n\n\t\t\twhile ($rs = mysql_fetch_array($qr) ) {\n\n\t\t\t\t$exFetch[] = $rs;\n\n\t\t\t}\n\n\t\t}else{\n\n\t\t\t\t$exFetch = false;\n\t\t}\n\n\t\treturn $exFetch;\n\n\t}", "public function queryMysql($sql){\n\t\t$result = $this->connection->query($sql);\n\t\t//error\n\t\tif($result == false) echo \"<p class=\". self::$p_class3 .\">\" . \"Failed mysql query: \" . \"<b>\". $sql.\"</b> <br>\".\" \".$this->connection->error.\"</p><br>\";\n\t\t//create,drop,delete,insert,update\n\t\tif($result == true) echo \"<p class=\". self::$p_class4 .\">\" . \"Performed mysql query: \" . \"<b>\". $sql.\"</b>\" .\"</p>\";\n\t\t//select\n\t\tif(is_object($result)) {\n\t\t\techo \"<p class=\". self::$p_class4 .\">\" . \"List entries here: \".\"</p>\";\n\t\t\t//\n\t\t\t// table\n\t\t\techo \"<table border='1'>\";\n\t\t\t// table header\n\t\t\techo \"<tr>\";\n\t\t\t$rows = $result->fetch_fields();\n\t\t\t$i = 0;\n\t\t\twhile($i < count($rows) ){\n\t\t\t\techo \"<td><b>\".$rows[$i]->name.\"</b></td>\";\n\t\t\t\t$i++;\n\t\t\t}\n\t\t\techo \"</tr>\";\n\t\t\t// table body\n\t\t\t$j = 0;\n\t\t\twhile($row = $result->fetch_array(MYSQLI_BOTH)){\n\t\t\t\techo \"<tr>\";\n\t\t\t\twhile($j < $this->connection->field_count){\n\t\t\t\t\techo \"<td>\".$row[$j].\"</td>\";\n\t\t\t\t\t$j++;\n\t\t\t\t}\n\t\t\t\techo \"</tr>\";\n\t\t\t\t$j = 0;\n\t\t\t}\n\t\t\techo \"</table><br>\";\n\t\t}\n\t}", "function create_room_description($room_id) {\n$query = \"SELECT * FROM rooms WHERE (id='$room_id')\";\n$result = mysql_query($query) or die(mysql_error());\nwhile($row = mysql_fetch_array($result)) { \n\t$main_room_id = $row['id'];\n\t$main_room_characterid = $row['characterid'];\n\t$north = $row['north'];\n\t$south = $row['south'];\n\t$east = $row['east'];\n\t$west = $row['west'];\n\t$up = $row['up'];\n\t$down = $row['down'];\n\t$main_room_level = $row['level'];\n}\n\n/* Build Room Description */\n\n/* Introductory Statement On Room */\n$what = rand(1, 3);\nif ($what == 1) { $intro = \"The air here is hot, and you can feel it in your lungs; whatever it is floating in the air, it is inside you. \";}\nif ($what == 2) { $intro = \"You see your breath in the air before you even have a chance to shiver. You try rubbing the cold out of your arms, but it's already cut you to the bone. \";}\nif ($what == 3) { $intro = \"This room is filled with a thick cloud of swirling sand, being pushed by a wind you can't find the source of. You have to put a cloth over your mouth to breathe, and squint at your surroundings through pinched fingers. \";}\n\n/* On The Floors */\n$what = rand(0, 3);\nif ($what == 0) { $floor = \"The ground under your feet feels moist and sticky. You think that falling down here would turn into a messy ordeal. \";}\nif ($what == 1) { $floor = \"With every step you take, cockroaches crunch under your feet; countless others race away into the dark corners. \";}\nif ($what == 2) { $floor = \"If you stand in place too long, the sand all over the floor begins to swallow your feet. If you keep moving, you should be fine. \";}\nif ($what == 3) { $floor = \"The ground under your feet is slick with a clear substance. It glistens in what little light there is. It appears to be the trails of several giant snails, but how they came into, and slipped out of, the room isn't apparent to you.\";}\n\n/* On The Walls */\n$what = rand(0, 3);\nif ($what == 0) { $wall = \"Adorning the walls of this room are enormous engravings, depicting the fallen heroes of civilizations long forgotten. \";}\nif ($what == 1) { $wall = \"Hanging on one of the walls of this room is large painting of a horse. The horse is screaming. \";}\nif ($what == 2) { $wall = \"The walls of this room are covered in a beautiful mosaic. The tiles of turquoise, amethyst, and quartz form an elaborate scene of a bustling market place in the city, which stands in sharp contrast to the desolation around you. When you look closer, however, you see that the wears on display in the market are actually desiccated pieces of dismembered corpses. \";}\nif ($what == 3) { $wall = \"Before you, large blood red tapestries hang from the walls, adorned with a strange crest you've never seen before. \";}\n\n/* Over Your Head */\n$what = rand(0, 3);\nif ($what == 0) { $head = \"Suspended over your head by chains, the bodies of the long dead and forgotten sway, as if jostled by someone else who was here just before you. \";}\nif ($what == 1) { $head = \"At first you think the ceiling is pulsating, but you realize that it is home to hundreds of bats. You decide it's best not to disturb them. \";}\nif ($what == 2) { $head = \"From above you can hear the sound of something slowly chewing on something else, but the ceiling is too high and all you can see is darkness. Whatever it making that sound, you hope it's friendly, or at least totally distracted already. \";}\nif ($what == 3) { $head = \"The sound of chains clinking together fills the chamber as you move through it, pushing away the variety of hooks hanging down from above. \";}\n\n/* Special Mythical Features */\n$what = rand(0, 3);\nif ($what == 0) { $special = \"Coming from a hole in the base of one of the walls, a small stream cuts its way through the center of this room. The pebbles at the bottom of the stream have been worn smooth by decades of tumbling water. \";}\nif ($what == 1) { $special = \"Though you can't fathom why, a small crack in the ceiling exposes a little of what must be sunlight. You can feel the warmth of it on your face; taking a moment to enjoy it, you remember something you had forgotten long ago. \";}\nif ($what == 2) { $special = \"You only saw it for a moment when you entered, but you swear there was a faery hovering in the middle of the room, only to vanish into a crack in the wall when it noticed you come in. \";}\nif ($what == 3) { $special = \"A stream of water falls from a hole in the ceiling and into a hole in the floor. Both holes are too precise to be natural. Where is this water going? Where is it from? \";}\n\n/* Describe Exits */\n\n$what = rand(0, 4);\nif ($what == 0) { $room_desc = mysql_real_escape_string($intro); }\nif ($what == 1) { $room_desc = mysql_real_escape_string($floor);}\nif ($what == 2) { $room_desc = mysql_real_escape_string($wall);}\nif ($what == 3) { $room_desc = mysql_real_escape_string($head);}\nif ($what == 4) { $room_desc = mysql_real_escape_string($special);}\n\n/* Write Room Description */\n\n$query = \"UPDATE rooms SET roomDesc='$room_desc' WHERE id='$room_id'\";\nmysql_query($query) or die(mysql_error());\t\n\n}", "function courseDetails($course_number){\n $query=\"SELECT _course_session.course_id,_course.course_title,_course_session.session,_course_session.instructor,_course_session.date_time FROM _course_session,_course WHERE _course.course_id=_course_session.course_id AND _course.course_number=?\";\n $stmt=$this->connection->prepare($query); //Prepared statment start\n $stmt->bind_param(\"i\",$course_number);\n $stmt->execute();\n $stmt->bind_result($course_id,$course_title,$session,$instructor,$date_time);\n //Fetching all rows. \n while($stmt->fetch()){ \n echo \"Course #: \",$course_id,\" \",\"Title: \",$course_title,\" \",\"Session #: \",$session,\" \",\"Instructor: \",$instructor,\" \",\"Date&Time: \",$date_time,\"</br>\",\"</br>\"; \n }\n }", "protected function _buildQuery()\r\n {\r\n \t\r\n $db = JFactory::getDBO();\r\n $query = $db->getQuery(TRUE);\r\n\r\n $query->select('proptype.ddcbookit_proptype_id, proptype.proptype_title, proptype.proptype_description');\r\n $query->from('#__ddcbookit_proptypes as proptype');\r\n return $query;\r\n \r\n }", "public function listRooms()\n\t{\n\t\treturn $this->execute('roomlist', 'roomlist');\n\t}", "function show_railway_booking()\r\n\t{\t\r\n\t\t$dbhandle = $this->mssqldb_connect();\r\n\t\tif($dbhandle != false) {\r\n\t\t\t$myDB = \"PortalDB\";\r\n\t\t\t \r\n\t\t\t //select a database to work with\r\n\t\t\t$selected = mssql_select_db($myDB, $dbhandle)\r\n\t\t\t or die(\"Couldn't open database $myDB\"); \r\n\t\t\t// $query = \"SELECT * FROM xlwp6_RS\";\r\n\t\t\t$query = \"SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'xlwp6_RS'\";\r\n\t\t\t$result = mssql_query($query,$dbhandle);\r\n\t\t\t$numRows = mssql_num_rows($result); \r\n\t\t\t var_dump(mssql_get_last_message());\r\n\t\t\techo \"<h1>\" . $numRows . \" Row\" . ($numRows == 1 ? \"\" : \"s\") . \" Returned </h1>\"; \r\n\t\t\t//display the results \r\n\t\t\twhile($row = mssql_fetch_array($result))\r\n\t\t\t{\r\n\t\t\t debug($row);\r\n\t\t\t}\r\n\t\t\tmssql_close($dbhandle);\r\n\t\t}\r\n\t}", "function select($id){\r\n\t\t$query = \"SELECT *\";\r\n\t\t$query .= \" FROM db_equipment_gen INNER JOIN db_group ON equipment_id_link_group=group_id\";\r\n\t\t$query .= \" INNER JOIN db_equipment_list ON equipment_list_gen_link=equipment_gen_id\";\r\n\t\t$query .= \" INNER JOIN db_equipment_pic ON equipment_id_link_pic=equipment_pic_id\";\r\n\t\t$query .= \" LEFT JOIN db_address ON equipment_list_address_link=address_id\";\r\n\t\t$query .= \" LEFT JOIN db_status ON equipment_list_status_link=status_id WHERE equipment_list_id = :ID LIMIT 1\";\r\n\t\t\r\n\t\t$sth=$this->db->select($query,array(':ID'=>$id));\r\n\t\t\r\n\t\t\t$query = \"SELECT group_id,group_name FROM db_group WHERE group_status=0\";\r\n\t\t\t$group=$this->db->select($query,array());\r\n\t\t\t$query = \"SELECT status_id,status_name FROM db_status WHERE status_status=0\";\r\n\t\t\t$status=$this->db->select($query,array());\r\n\t\t\t$query = \"SELECT address_id,address_name FROM db_address WHERE address_status=0\";\r\n\t\t\t$address=$this->db->select($query,array());\r\n\t\t\r\n\t\t$data = array(\"equipment\",0,10,\"\",1,10,0,0,$sth,$group,$status,$address);\r\n\t\t\r\n\t\treturn $data;\r\n\t\t}", "function buildQuery(){\n\t\t$r = ($this->fieldName == \"\") ? \"SELECT * FROM \" . $this->tableName . \";\" : \"SELECT * FROM \" . $this->tableName . \" WHERE \" . $this->fieldName . \" = \" . $this->fieldValue . \";\";\n\t\t//print \"executing $r <br/>\";\n\t\treturn $r;\n\t}", "function get_cancellation_room1($date='',$pm_id = 0,$propertyroomid=0){\r\n\tglobal $db;\r\n\tglobal $tblprefix;\r\n\t$new_date = date(\"m/d/Y\",strtotime($date));\r\n\t$qry_tbl_cancellation = \"SELECT count(id) as cancelled FROM \".$tblprefix.\"cancellation WHERE pm_id=\".$pm_id.\" AND room_type_id=\".$propertyroomid.\" AND (check_indate='\".$new_date.\"' OR check_outdate='\".$new_date.\"')\";\r\n$rs_tbl_cancellation = $db->Execute($qry_tbl_cancellation);\r\n \r\n\treturn $rs_tbl_cancellation->fields['cancelled'];\r\n\r\n\r\n}", "public function roomList()\n\t{\n\t\techo json_encode($this->room_list->fetchData());\n\t}", "function readAllRooms()\n{\n $pdo = setDBConnection(DBNAME);\n // Pass PDO object, query string, and parameters (for the query string)\n $statement = runQuery($pdo, \"SELECT roomID FROM Room\");\n // Returns array with results\n return $statement;\n}", "function getBookingsByType($type){\r\n \t$inx = 0;\r\n \t$arrbook = array();\r\n \t$conn = getConnection();\r\n\r\n $stmt = $conn->prepare(\"SELECT idreservations, rs_checkin, rs_checkout from booking where rs_checkin > curdate() AND type = ?\");\r\n $stmt->bind_param(\"s\", $type); \r\n $stmt->execute();\r\n\r\n $result = $stmt->get_result();\r\n \r\n\r\n if($result->num_rows > 0){\r\n \twhile($row = $result->fetch_assoc()){\r\n \t\t$arrbook[$inx][0] = $row['idreservations'];\r\n \t\t$arrbook[$inx][1] = $row['rs_checkin'];\r\n \t\t$arrbook[$inx][2] = $row['rs_checkout'];\r\n $inx++;\r\n \t}\r\n }\r\n $conn->close(); \r\n\r\n return $arrbook;\r\n\t}", "function getgridgroups($pgtypechosen)\n\t{\n\t$ggtypes=\"\";\n\t$sql= \"select * from tb_grdgroups where status=1 and pgtypeid LIKE '%\".$pgtypechosen.\"%'\";\n\t$res=mysql_query($sql);\n\t$count=mysql_num_rows($res);\n\t\n\t$temp=\"\";\n\t\tfor($i=0;$i<=$count-1;$i++)\n\t\t{\n\t\t$data=mysql_fetch_assoc($res);\n\t\t$temp=$temp.$data['grdgroupid'].\",\".$data['grdgroup'].\"#\";\n\t\t}\n\t\t\n\t$ggtypes=$ggtypes.$temp;\t\n\treturn $ggtypes;\n\t}", "public function renderRooms()\n {\n //$this->template->rooms = $this->projectManager->getRooms();\n $types=$this->projectManager->getTypesRooms();\n $this->template->type=$types;\n $this->template->test = array();\n foreach ($types as $key) {\n $this->template->test[$key->Typ_izby_id] = $this->projectManager->getRooms($key->Typ_izby_id);\n }\n }", "function get_equipos_cat($where=null){\n \n if(!is_null($where)){\n $where='WHERE '.$where;\n }else{\n $where='';\n }\n\n $sql=\"select sub4.uni_acad,trim(d.apellido)||', '||trim(d.nombre) as docente_nombre,d.nro_docum,d.legajo,d.fec_nacim,coalesce(d.correo_institucional,'')||' '|| coalesce(d.correo_personal,'') as correo,sub4.id_designacion,sub4.cat_est,sub4.carac,sub4.desde,sub4.hasta,t_mo.descripcion as modulo,carga_horaria,observacion,case when trim(rol)='NE' then 'Aux' else 'Resp' end as rol,p.descripcion as periodo, dep.descripcion as dep,ar.descripcion as area,t_o.descripcion as ori,case when materia_conj is not null then materia_conj else m.desc_materia||'('||pl.cod_carrera||' de '||pl.uni_acad|| ')' end as desc_materia\n from(select sub2.id_designacion,sub2.id_materia,sub2.id_docente,sub2.id_periodo,sub2.modulo,sub2.carga_horaria,sub2.rol,sub2.observacion,cat_est,dedic,carac,desde,hasta,uni_acad,sub2.id_departamento,sub2.id_area,sub2.id_orientacion,string_agg(sub4.materia,'/') as materia_conj \n from (select distinct * from (\n select distinct upper(trim(m.desc_materia)) as desc_materia,a.anio,b.id_designacion,b.id_docente,d.legajo,a.id_periodo,a.modulo,a.carga_horaria,a.rol,a.observacion,a.id_materia,b.uni_acad,cat_estat||dedic as cat_est,dedic,carac,b.desde,b.hasta,b.id_departamento,b.id_area,b.id_orientacion,case when lic.id_novedad is null then 0 else 1 end as licencia\n from asignacion_materia a\n INNER JOIN materia m ON (m.id_materia=a.id_materia)\n INNER JOIN designacion b ON (a.id_designacion=b.id_designacion)\n INNER JOIN docente d ON (b.id_docente=d.id_docente)\n --esto para saber si esta de licencia dentro del periodo y anio en el que esta designado. Entonces con el filtro puedo descartar a los que no estan ejerciendo\n INNER JOIN mocovi_periodo_presupuestario p ON (a.anio=p.anio)\n LEFT OUTER JOIN ( select t_n.*,extract(year from t_n.desde) as anio\n from novedad t_n \n where t_n.tipo_nov in (1,4,2,3,5)\n ) lic ON (lic.id_designacion = a.id_designacion \n and lic.anio=a.anio \n and ((lic.tipo_nov in (2,3,5) and\n ((a.id_periodo=1 and lic.desde<=to_date(cast(p.anio as text)||'-07-01','YYYY-MM-DD')and lic.hasta>=p.fecha_inicio) or\n (a.id_periodo=2 and lic.desde<=p.fecha_fin and lic.hasta>=to_date(cast(p.anio as text)||'-07-01','YYYY-MM-DD')) or\n ((a.id_periodo=3 or a.id_periodo=4) and lic.desde<=p.fecha_fin and lic.hasta>=p.fecha_inicio )\n )\n ) or\n (\n lic.tipo_nov in (1,4) and \n ((a.id_periodo=1 and lic.desde<=to_date(cast(p.anio as text)||'-07-01','YYYY-MM-DD')and lic.desde>=p.fecha_inicio) or\n (a.id_periodo=2 and lic.desde<=p.fecha_fin and lic.desde>=to_date(cast(p.anio as text)||'-07-01','YYYY-MM-DD')) or\n ((a.id_periodo=3 or a.id_periodo=4) and lic.desde<=p.fecha_fin and lic.desde>=p.fecha_inicio )\n )\n ) ) \n )\n where not (b.hasta is not null and b.hasta<=b.desde)\n )sub1\n \".$where.\" ) sub2 \n LEFT OUTER JOIN \n ( select t_c.id_conjunto,t_p.anio,t_c.id_periodo,t_c.ua,t_e.id_materia\n from en_conjunto t_e,conjunto t_c, mocovi_periodo_presupuestario t_p\n WHERE t_e.id_conjunto=t_c.id_conjunto and t_p.id_periodo=t_c.id_periodo_pres \n )sub3 ON (sub3.ua=sub2.uni_acad and sub3.id_periodo=sub2.id_periodo and sub3.anio=sub2.anio and sub3.id_materia=sub2.id_materia)\n LEFT OUTER JOIN \n (select t_e.id_conjunto,t_e.id_materia,t_m.desc_materia||'('||t_p.cod_carrera||' de '||t_p.uni_acad||')' as materia from en_conjunto t_e,materia t_m ,plan_estudio t_p\n where t_e.id_materia=t_m.id_materia\n and t_p.id_plan=t_m.id_plan)sub4 ON sub4.id_conjunto=sub3.id_conjunto\n group by sub2.id_designacion,sub2.id_materia,sub2.id_docente,sub2.id_periodo,sub2.modulo,sub2.carga_horaria,sub2.rol,sub2.observacion,cat_est,dedic,carac,desde,hasta,uni_acad,sub2.id_departamento,sub2.id_area,sub2.id_orientacion)sub4\n LEFT OUTER JOIN docente d ON d.id_docente=sub4.id_docente\n LEFT OUTER JOIN periodo p ON p.id_periodo=sub4.id_periodo\n LEFT OUTER JOIN modulo t_mo ON sub4.modulo=t_mo.id_modulo\n LEFT OUTER JOIN departamento dep ON dep.iddepto=sub4.id_departamento\n LEFT OUTER JOIN area ar ON ar.idarea=sub4.id_area\n LEFT OUTER JOIN orientacion t_o ON (sub4.id_orientacion=t_o.idorient and ar.idarea=t_o.idarea)\n LEFT OUTER JOIN materia m ON m.id_materia=sub4.id_materia\n LEFT OUTER JOIN plan_estudio pl ON pl.id_plan=m.id_plan\n \n order by desc_materia,periodo,modulo,rol\";\n return toba::db('designa')->consultar($sql);\n }", "function bookingstatus_viewdetail( $tbl_bookingstatus, $id ){\n\t\t$sql = mysql_query(\"SELECT * FROM $tbl_bookingstatus WHERE id='$id'\");\n\t\treturn $sql;\n}", "public function getSystemTypes()\r\n{\r\n $query_string = \"SELECT systemtypeid, systemtypename, systemtypedesc FROM system_type\";\r\n\r\n return $query_string;\r\n}", "public function ajaxDormitoryRoom() {\n $id = $this->input->get('q');\n $query = $this->common->getWhere('dormitory', 'id', $id);\n foreach ($query as $row) {\n $roomAmount = $row['room_amount'];\n }\n echo '<option value=\"\">' . lang('dorc_1') . '</option>';\n for ($i = 1; $i <= $roomAmount; $i++) {\n echo '<option value=\"Room No: ' . $i . '\">Room No: ' . $i . ' </option>';\n }\n }", "function listQueryBaru() {\n\t\t\t$sql = \"select r.* from \".self::table('v_kelas3new').\" r join gate.ms_unit u on r.kodeunit = u.kodeunit\";\n\t\t\t\n\t\t\treturn $sql;\n\t\t}", "function show_hotel_booking()\r\n\t{\t\r\n\t\t$dbhandle = $this->mssqldb_connect();\r\n\t\tif($dbhandle != false) {\r\n\t\t\t$myDB = \"PortalDB\";\r\n\t\t\t \r\n\t\t\t //select a database to work with\r\n\t\t\t$selected = mssql_select_db($myDB, $dbhandle)\r\n\t\t\t or die(\"Couldn't open database $myDB\"); \r\n\t\t\t$query = \"SELECT * FROM xlwp6_HS\";\r\n\t\t\t// $query = \"SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'xlwp6_IT'\";\r\n\t\t\t$result = mssql_query($query,$dbhandle);\r\n\t\t\t$numRows = mssql_num_rows($result); \r\n\t\t\t var_dump(mssql_get_last_message());\r\n\t\t\techo \"<h1>\" . $numRows . \" Row\" . ($numRows == 1 ? \"\" : \"s\") . \" Returned </h1>\"; \r\n\t\t\t//display the results \r\n\t\t\twhile($row = mssql_fetch_array($result))\r\n\t\t\t{\r\n\t\t\t debug($row);\r\n\t\t\t}\r\n\t\t\tmssql_close($dbhandle);\r\n\t\t}\r\n\t}", "function getAllPatients()\n{\n //get all Patients\n $db = createDBconnection();\n $sql = \"SELECT patients.patient_id, patients.patient_name , clients.client_firstname, clients.client_lastname, species.species_description, patients.patient_gender, patients.patient_status\n FROM ((patients\n INNER JOIN clients ON patients.client_id = clients.client_id)\n INNER JOIN species ON patients.species_id = species.species_id)\n ORDER BY patients.patient_name ASC\";\n $result = $db->query($sql);\n\n return $result;\n}", "function viewCourseMaterial($course_id){\n $query= \"SELECT * From _course_material WHERE course_id=?\";\n $stmt=$this->connection->prepare($query); //Prepared statment start\n $stmt->bind_param(\"i\",$course_id);\n $stmt->execute();\n $stmt->bind_result($course_id,$syllabus,$course_material); \n //Fetching all rows. \n while($stmt->fetch()){\n echo \"Course #: \",$course_id,\" \",\"Material: \",$course_material,\" \",\"Syllabus: \",$syllabus;\n } \n }", "function printsched($index){\n\n\n\n\t$room1s = mysql_fetch_array(mysql_query(\"SELECT * FROM room WHERE ROOM_ID = '\".$_SESSION['room'.$index].\"'\"));\n\n\t$day1s = mysql_fetch_array(mysql_query(\"SELECT * FROM days WHERE DAY_ID = '\".$_SESSION['day'.$index].\"'\"));\n\n\n\n\t$timestart1s = date(\"h:i A\", strtotime($_SESSION['start'.$index]));\n\t$timeend1s = date(\"h:i A\", strtotime($_SESSION['end'.$index]));\n\n\t$sTime1 = strtotime( $_SESSION['start'.$index] );\n\t$eTime1 = strtotime( $_SESSION['end'.$index] );\n\n\techo '<br/><label>ROOM - DAY - TIME</label><input class = \"form-control\" name=\"day\" value=\"'.$room1s['ROOM'].' - '.$day1s['DAY_CODE'].' - '.$timestart1s.'-'.$timeend1s.'\"disabled><br/>';\n\n\treturn 1;\n\n}", "function SelektoDatabasen(){\n global $db;\n $SqlStmt=$db->prepare(\"select * from p149pm_roombook\");\n try{ $SqlStmt->execute(); } catch (PDOException $e) { die(); }\n while($row = $SqlStmt->fetch(PDO::FETCH_ASSOC)) { $smartRs[] = $row; }\n if ($SqlStmt->rowCount() > 0) {return $smartRs; }\n\n}", "function read_roster($roundid) {\n global $db;\n $roster = array();\n $stmt = $db->prepare('SELECT rosterid, Roster.racerid FROM Roster'\n .' INNER JOIN RegistrationInfo'\n .' ON Roster.racerid = RegistrationInfo.racerid'\n .' WHERE roundid = :roundid'\n .' AND passedinspection = 1'\n .' ORDER BY rosterid');\n $stmt->execute(array(':roundid' => $roundid));\n foreach ($stmt as $row) {\n $roster[] = $row['racerid'];\n }\n return $roster;\n}", "function getAllRoomsByBuilding(){\r\n $common = new \\Cars\\Data\\Common($this->app);\r\n $blds = $common->getBuildingAbbreviations();\r\n\r\n $output = array();\r\n foreach ($blds as $bld => $bldData) {\r\n $rooms = $common->getRoomsByBuilding($bldData[\"building_abbreviation\"]);\r\n foreach ($rooms as $room => $val) {\r\n $output[$bldData[\"building_abbreviation\"]][$val[\"room_number\"]] = $val;\r\n }\r\n }\r\n\r\n return $output;\r\n }", "function get_amout_room($date_from,$date_end)\n {\n\t\t$sql1 = '\n\t\t SELECT \n\t\t\t\t\t\trs.id,\n\t\t\t\t\t\trs.change_price,\n\t\t\t\t\t\trr.tax_rate, \n\t\t\t\t\t\tservice_rate,\n\t\t\t\t\t\trs.in_date,\n\t\t\t\t\t\trr.arrival_time,\n rr.net_price,\n\t\t\t\t\t\trr.departure_time,\n\t\t\t\t\t\trr.price,\n\t\t\t\t\t\trs.status,\n\t\t\t\t\t\trr.id as reservation_room_id\n\t\t\t\t\tFROM \n\t\t\t\t\t\troom_status rs \n\t\t\t\t\t\tINNER JOIN reservation_room rr ON rr.id = rs.reservation_room_id \n\t\t\t\t\t\tINNER JOIN reservation r on rr.reservation_id = r.id\n\t\t\t\t\tWHERE \n\t\t\t\t\t\t(rs.status =\\'OCCUPIED\\' OR rs.status =\\'BOOKED\\')\n\t\t\t\t\t\tAND rs.in_date >= \\''.$date_from.'\\' \n\t\t\t\t\t\tAND rs.in_date <= \\''.$date_end.'\\' ';\n\t\t$room_totals = DB::fetch_all($sql1);\n\t\t// tinh tien phong su dung trong ngay\n\t\t$amount_room_days =array();\n\t\tforeach($room_totals as $key=>$value)\n {\n\t\t\t// tinh tien phong va phi dich phong thue cho tung phong rui cong thanh tog tien trong ngay\n\t\t\t$amount_room_days['id'] = $value['in_date'];\n\t\t\t$service_room = 0;\n\t\t\t$pay_room = 0;\n\t\t\t$tax_room = 0;\n\t\t\t$deposit_room = 0;\n\t\t\t$net=0;\n\t\t\t//if(($value['arrival_time'] != $value['departure_time'] \n// and $value['in_date'] < $value['departure_time'] and \n// ($value['status'] == 'OCCUPIED' ||$value['status'] == 'BOOKED')) \n// || ($value['arrival_time'] == $value['in_date']))\n if (1 == 1)\n {\n\t\t\t\t$service_room = ($value['change_price'] * $value['service_rate'])/100;\n\t\t\t\t// tien phong + dv 1 phong\n\t\t\t\t$pay_room = $value['change_price'] + $service_room ;\t\n\t\t\t\t// tinh tien thue cua 1 phong \n\t\t\t\t$tax_room = ($pay_room * $value['tax_rate'])/100;\t\n\t\t\t\t$net = $pay_room + $tax_room;\n\t\t\t}\n\t\t\t$room_totals[$key]['room_total'] = $net;// - $deposit_room;\n\t\t if (User::is_admin() and $value['in_date'] == '31-DEC-13' and $net > 0)\n {\n //echo System::display_number($net).'__'.$value['reservation_room_id'].'<br>';\n }\n\t\t\tif(!isset($amount_room_days[$value['in_date']]['amount_total']))\n {\n $amount_room_days[$value['in_date']]['count'] = 1; \n if ($net == 0)\n {\n $amount_room_days[$value['in_date']]['count'] = 0;\n }\n\t\t\t\t $amount_room_days[$value['in_date']]['amount_total'] = $room_totals[$key]['room_total'];\n\t\t\t}\n else\n {\n $amount_room_days[$value['in_date']]['count'] += 1;\n if ($net == 0)\n {\n $amount_room_days[$value['in_date']]['count'] -= 1;\n }\n\t\t\t\t $amount_room_days[$value['in_date']]['amount_total'] += $room_totals[$key]['room_total'];\n\t\t\t}\n\t\t}\n if (User::is_admin())\n {\n //System::debug($amount_room_days);\n }\n\t\treturn $amount_room_days;\n\t}", "function select_vehicle_data($cid)\n\t{\n\t\tglobal $db;\n\t\t//Select All Vehicle Information\n\t \t$sql = \"SELECT g.*, images.*, makes.make, models.model, CONCAT_WS(' ', g.made_year, makes.make, models.model) AS vehicle, count(mods.id) AS total_mods, ( SUM(mods.price) + SUM(mods.install_price) ) AS total_spent, user.username, user.user_avatar_type, user.user_allowavatar, user.user_avatar, user.user_id\n \tFROM \" . GARAGE_TABLE . \" AS g \n\t\t\t\tLEFT JOIN \" . USERS_TABLE .\" AS user ON g.member_id = user.user_id\n\t \tLEFT JOIN \" . GARAGE_MAKES_TABLE . \" AS makes ON g.make_id = makes.id\n \t LEFT JOIN \" . GARAGE_MODELS_TABLE . \" AS models ON g.model_id = models.id\n\t\t\t\tLEFT JOIN \" . GARAGE_MODS_TABLE . \" AS mods ON g.id = mods.garage_id\n\t\t\t\tLEFT JOIN \" . GARAGE_IMAGES_TABLE . \" AS images ON images.attach_id = g.image_id\n \tWHERE g.id = $cid\n\t GROUP BY g.id\";\n\n \t\tif ( !($result = $db->sql_query($sql)) )\n \t\t{\n \t\tmessage_die(GENERAL_ERROR, 'Could Not Get Vehicle Data', '', __LINE__, __FILE__, $sql);\n \t\t}\n\n\t\t$row = $db->sql_fetchrow($result);\n\t\t$db->sql_freeresult($result);\n\n\t\treturn $row;\n\t}", "public function viewVotingInformation()\r\n{\r\n $query_string = \"SELECT systemname, systeminformation FROM voting_system\";\r\n $query_string .= \"WHERE systemid = :systemid\";\r\n\r\n return $query_string;\r\n}", "function get_laser_labs($conn, $laser_report_id) {\n\t$query_labs = \"SELECT building, room FROM laser_labs WHERE laser_report_id = \" . $laser_report_id;\n\treturn exec_query($conn, $query_labs);\n}", "function stream_results(){\r\n // \r\n //Get all the subjects that this student is taught \r\n $subjects= $this->get_student($stream, $grade, $year);\r\n //\r\n $sql= \"select student.name as name\";\r\n // \r\n //Appends every subjects name\r\n foreach ($subjects as $value) {\r\n //\r\n $sql.\"{$value}.score as $value\"; \r\n }\r\n \r\n }", "function GetBedroomDetailsUnit($filter=false,$languageID=false)\n\t{\n\t\t$query=$this->db->query(\"select rp_property_attribute_values.*,rp_property_attribute_value_details.* from rp_property_attribute_values,rp_property_attribute_value_details where rp_property_attribute_values.propertyID='$filter' and rp_property_attribute_values.attributeID=1 and rp_property_attribute_values.attrValueID=rp_property_attribute_value_details.attrValueID and rp_property_attribute_value_details.languageID=$languageID\");\n\t}", "function getTyp(){\n\tglobal $con;\n\t$get_type = \"select * from types\";\n\t$run_type = mysqli_query($con, $get_type);\n\twhile ($row_type = mysqli_fetch_array($run_type)) {\n\t\t$type_id =$row_type['type_id'];\n\t\t$type_title=$row_type['type_title'];\n\n\t\techo \"<li><a href='home.php?type=$type_id'>$type_title</a></li>\";\n\t}\n\n}", "function showAllSessions(){\n $query=\"SELECT _course_session.course_id,_course.course_number, _course.course_title, _course_session.session FROM _course,_course_session WHERE _course.course_id=_course_session.course_id\";\n $result=$this->connection->query($query);\n while ($row=$result->fetch_assoc()){\n // echo $row[\"course_id\"],$row[\"session\"],$row[\"course_number\"],$row[\"course_title\"],\"</br>\",\"</br>\";\n $course_id= $row[\"course_id\"];\n $session=$row[\"session\"];\n $course_number=$row[\"course_number\"];\n $course_title=$row[\"course_title\"]; \n echo \"<tr>\";\n echo \"<td> $course_id </td>\";\n echo \"<td> $session</td>\";\n echo \"<td> $course_number</td>\";\n echo \"<td> $course_title </td>\";\n echo \"</tr>\";\n\n\n\n }\n }", "public function getInfo($type){\n $sql= \"SELECT * FROM abilities WHERE Type = ? ORDER BY Stars DESC \";\n $ability = $this->database->getAll($sql, array($type));\n //Returns recordID, Name, SubInfo, Stars, Type\n return $ability;\n }", "function getTypeUnits() {\n\tglobal $db;\n\t\n\t$output = $db->query(\"\tSELECT \ttypes.name AS `type_name`,\n\t\t \t\t\t\t\t\t\ttypes.type_id,\n\t\t\t\t\t\t\t\t\tunits.name AS `unit_name`,\n\t\t\t\t\t\t\t\t\tunits.unit_id\n\t\t\t\t\t\t\t\t\tFROM type_units, types, units\n\t\t\t\t\t\t\t\t\tWHERE types.type_id = type_units.type_id\n\t\t\t\t\t\t\t\t\tAND units.unit_id = type_units.unit_id\");\n\t\n\tif($db->numOfRows) {\n\t\treturn $output;\n\t}\n\t\n\treturn false;\n}", "function afficherreservation(){\n\t\t$sql=\"select hotel.nom hotel ,hotel.ville,reservation.* from (reservation inner join hotel on reservation.idhotel=hotel.id) order by idres \";\n\t\t$db = config::getConnexion();\n\t\ttry{\n\t\t$liste=$db->query($sql);\n\t\treturn $liste;\n\t\t}\n catch (Exception $e){\n die('Erreur: '.$e->getMessage());\n }\t\n\t}", "function gallery_view_sql()\n\t{\n\t\t$view_gallery=mysqli_query($this->con,\"SELECT * FROM gallery where status=1 order by id desc\");\n\t\treturn $view_gallery;\n\t}", "function render() {\n\t\t$sql = array();\n\t\tforeach ($this->stmts as $type => $stmts) {\n\t\t\tswitch($type) {\n\t\t\t\tcase \"select\":\n\t\t\t\tcase \"select distinct\":\n\t\t\t\t\t$sql[] = strToUpper($type) . \" \" . implode($stmts, \"\\n\") . \" FROM \".implode($this->from, \", \");\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\t$sql[] = implode($stmts, \"\\n\");\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\treturn implode($sql, \"\\n\").\";\";\n\t}", "function cadena_sql($tipo,$variable=\"\") {\n\n\t\t$prefijo=$this->miConfigurador->getVariableConfiguracion(\"prefijo\");\n\t\t$idSesion=$this->miConfigurador->getVariableConfiguracion(\"id_sesion\");\n\n\t\tswitch($tipo) {\n\n\t\t\t/**\n\t\t\t * Clausulas específicas\n\t\t\t */\n\n\t\t\tcase \"api_key\":\n\t\t\t\t$cadena_sql=\"SELECT \";\n\t\t\t\t$cadena_sql.=\"dbms DBMS, \";\n\t\t\t\t$cadena_sql.=\"id_tipoReserva IDCOMMERCE, \";\n\t\t\t\t$cadena_sql.=\"files_folder FOLDER \";\n\t\t\t\t$cadena_sql.=\"FROM \";\n\t\t\t\t$cadena_sql.=$prefijo.\"commerce \";\n\t\t\t\t$cadena_sql.=\"WHERE estado=1 \";\n\t\t\t\t$cadena_sql.=\"AND api_key='\".$variable.\"'\";\n\t\t\t\tbreak;\n\n\t\t\tcase \"buscarReservablesOcupados\":\n\t\t\t\t$cadena_sql=\"SELECT \";\n\t\t\t\t$cadena_sql.=\"'S' \";\n\t\t\t\t$cadena_sql.=\"FROM \";\n\t\t\t\t$cadena_sql.=$prefijo.\"reservation \";\n\t\t\t\t$cadena_sql.=\"INNER JOIN \";\n\t\t\t\t$cadena_sql.=$prefijo.\"reservation_reservable \";\n\t\t\t\t$cadena_sql.=\"ON (\".$prefijo.\"reservation_reservable.id_reserva = \".$prefijo.\"reservation.id_reserva) \";\n\t\t\t\t$cadena_sql.=\"WHERE \";\n\t\t\t\t$cadena_sql.=\"( \";\n\t\t\t\t$cadena_sql.=$prefijo.\"reservation.fecha_inicio BETWEEN '\".$variable[\"timeStampStart\"].\"' AND '\".$variable[\"timeStampEnd\"].\"' \";\n\t\t\t\t$cadena_sql.=\" OR \";\n\t\t\t\t$cadena_sql.=$prefijo.\"reservation.fecha_fin BETWEEN '\".$variable[\"timeStampStart\"].\"' AND '\".$variable[\"timeStampEnd\"].\"' \";\n\t\t\t\t$cadena_sql.=\" OR \";\n\t\t\t\t$cadena_sql.=\"\t( \";\n\t\t\t\t$cadena_sql.=$prefijo.\"reservation.fecha_inicio < '\".$variable[\"timeStampStart\"].\"' \";\n\t\t\t\t$cadena_sql.=\"\tAND \";\n\t\t\t\t$cadena_sql.=$prefijo.\"reservation.fecha_fin > '\".$variable[\"timeStampEnd\"].\"' \";\n\t\t\t\t$cadena_sql.=\"\t) \";\n\t\t\t\t$cadena_sql.=\") \";\n\t\t\t\t$cadena_sql.=\"AND \";\n\t\t\t\t$cadena_sql.=$prefijo.\"reservation.estado_reserva NOT IN (3,4) \"; //la reservation no contenga los estados FINALIZADO Y CANCELADO\n\t\t\t\t$cadena_sql.=\"AND \";\n\t\t\t\t$cadena_sql.=$prefijo.\"reservation.tipo_reserva='\".$variable[\"commerce\"].\"' \";\n\t\t\t\t$cadena_sql.=\"AND \";\n\t\t\t\t$cadena_sql.=$prefijo.\"reservation_reservable.id_reservable_type='\".$variable[\"groupRoom\"].\"' \";\n\t\t\t\t$cadena_sql.=\"AND \";\n\t\t\t\t$cadena_sql.=$prefijo.\"reservation.estado='1' \";\n\t\t\t\t$cadena_sql.=\"GROUP BY id_reservable \";\n\t\t\t\tbreak;\n\n\t\t\tcase \"getFieldsAdditional\":\n\t\t\t\t$cadena_sql=\"SELECT \";\n\t\t\t\t$cadena_sql.=\"id_field IDFIELD, \";\n\t\t\t\t$cadena_sql.=\"name NAMEFIELD \";\n\t\t\t\t$cadena_sql.=\"FROM \";\n\t\t\t\t$cadena_sql.=$prefijo.\"reserva_fields \";\n\t\t\t\t$cadena_sql.=\"WHERE \";\n\t\t\t\t$cadena_sql.=\" id_commerce='\".$variable[\"commerce\"].\"' \";\n\n\t\t\t\tbreak;\n\n\t\t\tcase \"buscarReservable\":\n\t\t\t\t$cadena_sql=\"SELECT \";\n\t\t\t\t$cadena_sql.=$prefijo.\"reservable.id_reservable ID_RESERVABLE, \";\n\t\t\t\t$cadena_sql.=$prefijo.\"reservable.nombre NOMBRE_RESERVABLE, \";\n\t\t\t\t$cadena_sql.=$prefijo.\"reservable.descripcion DESCRIPCION_RESERVABLE, \";\n\t\t\t\t$cadena_sql.=$prefijo.\"reservable.grupo GRUPO_RESERVABLE \";\n\t\t\t\t$cadena_sql.=\"FROM \";\n\t\t\t\t$cadena_sql.=$prefijo.\"reservable \";\n\t\t\t\t$cadena_sql.=\"WHERE \";\n\t\t\t\t$cadena_sql.=$prefijo.\"reservable.id_reservable = '\".$variable.\"' \";\n\n\t\t\t\tbreak;\n\t\t\tcase \"buscarServiciosAdicionales\":\n\t\t\t\t$cadena_sql=\"SELECT \";\n\t\t\t\t$cadena_sql.=$prefijo.\"adicional.id_adicional ID_ADICIONAL, \";\n\t\t\t\t$cadena_sql.=$prefijo.\"adicional.nombre NOMBRE_ADICIONAL, \";\n\t\t\t\t$cadena_sql.=$prefijo.\"adicional.descripcion DESCRIPCION_ADICIONAL, \";\n\t\t\t\t$cadena_sql.=$prefijo.\"adicional.valor_cargo VALOR_CARGO, \";\n\t\t\t\t$cadena_sql.=$prefijo.\"adicional.moneda_cargo MONEDA_CARGO \";\n\t\t\t\t$cadena_sql.=\"FROM \";\n\t\t\t\t$cadena_sql.=$prefijo.\"adicional \";\n\t\t\t\t$cadena_sql.=\"WHERE \";\n\t\t\t\t$cadena_sql.=$prefijo.\"adicional.tipo_reserva = '\".$variable[\"tipo_reserva\"].\"' \";\n\t\t\t\t$cadena_sql.=\"AND \";\n\t\t\t\t$cadena_sql.=$prefijo.\"adicional.establecimiento >= '\".$variable[\"establecimiento\"].\"' \";\n\t\t\t\t$cadena_sql.=\"AND \";\n\t\t\t\t$cadena_sql.=$prefijo.\"adicional.estado<>0 \";\n\t\t\t\tbreak;\n\n\t\t\tcase \"buscarInformacionReservables\":\n\t\t\t\t$cadena_sql=\"SELECT \";\n\t\t\t\t$cadena_sql.=$prefijo.\"reservable.id_reservable ID_RESERVABLE, \";\n\t\t\t\t$cadena_sql.=$prefijo.\"reservable.nombre NOMBRE_RESERVABLE, \";\n\t\t\t\t$cadena_sql.=$prefijo.\"reservable.descripcion DESCRIPCION_RESERVABLE, \";\n\t\t\t\t$cadena_sql.=$prefijo.\"reservable.grupo GRUPO_RESERVABLE, \";\n\t\t\t\t$cadena_sql.=$prefijo.\"reservable.capacidad CAPACIDAD, \";\n\t\t\t\t$cadena_sql.=$prefijo.\"reservable.valor VALOR, \";\n\t\t\t\t$cadena_sql.=$prefijo.\"reservable.moneda MONEDA, \";\n\t\t\t\t$cadena_sql.=$prefijo.\"reservable.imagen IMAGEN \";\n\t\t\t\t$cadena_sql.=\"FROM \";\n\t\t\t\t$cadena_sql.=$prefijo.\"reservable \";\n\t\t\t\t$cadena_sql.=\"WHERE \";\n\t\t\t\t$cadena_sql.=$prefijo.\"reservable.tipo_reserva = '\".$variable[\"tipo_reserva\"].\"' \";\n\t\t\t\t$cadena_sql.=\"AND \";\n\t\t\t\t$cadena_sql.=$prefijo.\"reservable.id_reservable IN ( \".$variable[\"cadena_reservables\"].\" ) \";\n\t\t\t\t$cadena_sql.=\"AND \";\n\t\t\t\t$cadena_sql.=$prefijo.\"reservable.establecimiento >= '\".$variable[\"establecimiento\"].\"' \";\n\t\t\t\t$cadena_sql.=\"AND \";\n\t\t\t\t$cadena_sql.=$prefijo.\"reservable.estado<>0 \";\n\t\t\t\tbreak;\n\n\t\t\tcase \"insertBooking\":\n\t\t\t\t$cadena_sql=\"INSERT INTO \";\n\t\t\t\t$cadena_sql.=$prefijo.\"reservation \";\n\t\t\t\t$cadena_sql.=\"( \";\n\t\t\t\t$cadena_sql.=\"`fecha_inicio`, \";\n\t\t\t\t$cadena_sql.=\"`fecha_fin`, \";\n\t\t\t\t$cadena_sql.=\"`tipo_reserva`, \";\n\t\t\t\t$cadena_sql.=\"`establecimiento`, \";\n\t\t\t\t$cadena_sql.=\"`cliente`, \";\n\t\t\t\t$cadena_sql.=\"`valor_total`, \";\n\t\t\t\t$cadena_sql.=\"`fecha_registro`, \";\n\t\t\t\t$cadena_sql.=\"`usuario_registro`, \";\n\t\t\t\t$cadena_sql.=\"`sesion_temp`, \";\n\t\t\t\t$cadena_sql.=\"`plugin`, \";\n\t\t\t\t$cadena_sql.=\"`tiempo_expira_temp`, \";\n\t\t\t\t$cadena_sql.=\"`estado_reserva`, \";\n\t\t\t\t$cadena_sql.=\"`estado_pago` \";\n\t\t\t\t$cadena_sql.=\") \";\n\t\t\t\t$cadena_sql.=\"VALUES \";\n\t\t\t\t$cadena_sql.=\"( \";\n\t\t\t\t$cadena_sql.=\"'\".$variable['timeStampStart'].\"', \";\n\t\t\t\t$cadena_sql.=\"'\".$variable['timeStampEnd'].\"', \";\n\t\t\t\t$cadena_sql.=\"'\".$variable['commerce'].\"', \";\n\t\t\t\t$cadena_sql.=\"'\".$variable['company'].\"', \";\n\t\t\t\t$cadena_sql.=\"'\".$variable['user'].\"', \";\n\t\t\t\t$cadena_sql.=\"'0', \";\n\t\t\t\t$cadena_sql.=\"'\".time().\"', \";\n\t\t\t\t$cadena_sql.=\"'\".$variable['user'].\"', \";\n\t\t\t\t$cadena_sql.=\"'\".$variable['session'].\"', \";\n\t\t\t\t$cadena_sql.=\"'\".$variable['plugin'].\"', \";\n\t\t\t\t$cadena_sql.=\"'\".((time())+1800).\"', \"; //POR DEFECTO CADA RESERVA SE GUARDARA 30 MINUTOS SI NO SE FINALIZA CORRECTAMENTE\n\t\t\t\t$cadena_sql.=\"'1', \";\n\t\t\t\t$cadena_sql.=\"'0' \";\n\t\t\t\t$cadena_sql.=\")\";\n\t\t\t\tbreak;\n\n\t\t\tcase \"insertBookingItems\":\n\t\t\t\t$cadena_sql=\"INSERT INTO \";\n\t\t\t\t$cadena_sql.=$prefijo.\"reservation_reservable \";\n\t\t\t\t$cadena_sql.=\"( \";\n\t\t\t\t$cadena_sql.=\"`id_reserva`, \";\n\t\t\t\t$cadena_sql.=\"`id_reservable_type` \";\n\t\t\t\t$cadena_sql.=\") \";\n\t\t\t\t$cadena_sql.=\"VALUES \";\n\t\t\t\t$cadena_sql.=\"( \";\n\t\t\t\t$cadena_sql.=\"'\".$variable['id_reserva'].\"', \";\n\t\t\t\t$cadena_sql.=\"'\".$variable['groupRoom'].\"' \";\n\t\t\t\t$cadena_sql.=\")\";\n\t\t\t\tbreak;\n\n\t\t\tcase \"insertReservables\":\n\t\t\t\t$cadena_sql=\"INSERT INTO \";\n\t\t\t\t$cadena_sql.=$prefijo.\"reservation_reservable \";\n\t\t\t\t$cadena_sql.=\"( \";\n\t\t\t\t$cadena_sql.=\"`id_reserva`, \";\n\t\t\t\t$cadena_sql.=\"`adults`, \";\n\t\t\t\t$cadena_sql.=\"`children`, \";\n\t\t\t\t$cadena_sql.=\"`infants`, \";\n\t\t\t\t$cadena_sql.=\"`id_reservable_type`, \";\n\t\t\t\t$cadena_sql.=\"`id_reservable` \";\n\t\t\t\t$cadena_sql.=\") \";\n\t\t\t\t$cadena_sql.=\"VALUES \";\n\t\t\t\t$cadena_sql.=\"( \";\n\t\t\t\t$cadena_sql.=\"'\".$variable['id_reserva'].\"', \";\n\t\t\t\t$cadena_sql.=\"'\".$variable['adults'].\"', \";\n\t\t\t\t$cadena_sql.=\"'\".$variable['children'].\"', \";\n\t\t\t\t$cadena_sql.=\"'\".$variable['infants'].\"', \";\n\t\t\t\t$cadena_sql.=\"'\".$variable['groupRoom'].\"', \";\n\t\t\t\t$cadena_sql.=\"'\".$variable['idRoom'].\"' \";\n\t\t\t\t$cadena_sql.=\")\";\n\t\t\t\tbreak;\n\n\t\t\tcase \"insertServices\":\n\t\t\t\t$cadena_sql=\"INSERT INTO \";\n\t\t\t\t$cadena_sql.=$prefijo.\"reserva_servicio \";\n\t\t\t\t$cadena_sql.=\"( \";\n\t\t\t\t$cadena_sql.=\"`id_reserva`, \";\n\t\t\t\t$cadena_sql.=\"`id_servicio`, \";\n\t\t\t\t$cadena_sql.=\"`cantidad` \";\n\t\t\t\t$cadena_sql.=\") \";\n\t\t\t\t$cadena_sql.=\"VALUES \";\n\t\t\t\t$cadena_sql.=\"( \";\n\t\t\t\t$cadena_sql.=\"'\".$variable['id_reserva'].\"', \";\n\t\t\t\t$cadena_sql.=\"'\".$variable['id_servicio'].\"', \";\n\t\t\t\t$cadena_sql.=\"'\".$variable['cantidad'].\"' \";\n\t\t\t\t$cadena_sql.=\")\";\n\t\t\t\tbreak;\n\n\t\t\tcase \"dataBookingItems\":\n\t\t\t\t$cadena_sql=\"SELECT \";\n\t\t\t\t$cadena_sql.=\"id_reservable_type IDGROUP, \";\n\t\t\t\t$cadena_sql.=\"adults ADULTS, \";\n\t\t\t\t$cadena_sql.=\"children CHILDREN, \";\n\t\t\t\t$cadena_sql.=\"infants INFANTS \";\n\t\t\t\t$cadena_sql.=\"FROM \";\n\t\t\t\t$cadena_sql.=$prefijo.\"reservation_reservable \";\n\t\t\t\t$cadena_sql.=\"WHERE \";\n\t\t\t\t$cadena_sql.=\"id_reserva ='\".$variable.\"' \";\n\t\t\t\tbreak;\n\n\t\t\tcase \"insertFriend\":\n\t\t\t\t$cadena_sql=\"INSERT INTO \";\n\t\t\t\t$cadena_sql.=$prefijo.\"reserva_guest \";\n\t\t\t\t$cadena_sql.=\"( \";\n\t\t\t\t$cadena_sql.=\"`id_reserva`, \";\n\t\t\t\t$cadena_sql.=\"`id_usuario` \";\n\t\t\t\t$cadena_sql.=\") \";\n\t\t\t\t$cadena_sql.=\"VALUES \";\n\t\t\t\t$cadena_sql.=\"( \";\n\t\t\t\t$cadena_sql.=\"'\".$variable[0].\"', \";\n\t\t\t\t$cadena_sql.=\"'\".$variable[1].\"' \";\n\t\t\t\t$cadena_sql.=\")\";\n\t\t\t\tbreak;\n\n\t\t\tcase \"dataOtherFields\":\n\t\t\t\t$cadena_sql=\"SELECT \";\n\t\t\t\t$cadena_sql.=\"id_field IDFIELD, \";\n\t\t\t\t$cadena_sql.=\"value VALUE \";\n\t\t\t\t$cadena_sql.=\"FROM \";\n\t\t\t\t$cadena_sql.=$prefijo.\"reserva_values \";\n\t\t\t\t$cadena_sql.=\"WHERE \";\n\t\t\t\t$cadena_sql.=\"id_reserva ='\".$variable.\"' \";\n\n\t\t\t\tbreak;\n\n\t\t\tcase \"insertOtherFields\":\n\t\t\t\t$cadena_sql=\"INSERT INTO \";\n\t\t\t\t$cadena_sql.=$prefijo.\"reserva_values \";\n\t\t\t\t$cadena_sql.=\"( \";\n\t\t\t\t$cadena_sql.=\"`id_field`, \";\n\t\t\t\t$cadena_sql.=\"`id_reserva`, \";\n\t\t\t\t$cadena_sql.=\"`value` \";\n\t\t\t\t$cadena_sql.=\") \";\n\t\t\t\t$cadena_sql.=\"VALUES \";\n\t\t\t\t$cadena_sql.=\"( \";\n\t\t\t\t$cadena_sql.=\"'\".$variable['idfield'].\"', \";\n\t\t\t\t$cadena_sql.=\"'\".$variable['idbooking'].\"', \";\n\t\t\t\t$cadena_sql.=\"'\".$variable['value'].\"' \";\n\t\t\t\t$cadena_sql.=\")\";\n\t\t\t\tbreak;\n\n\t\t\tcase \"createFriend\":\n\t\t\t\t$cadena_sql=\"INSERT INTO \";\n\t\t\t\t$cadena_sql.=$prefijo.\"guest \";\n\t\t\t\t$cadena_sql.=\"( \";\n\t\t\t\t$cadena_sql.=\"`identificacion`, \";\n\t\t\t\t$cadena_sql.=\"`nombre`, \";\n\t\t\t\t$cadena_sql.=\"`pais_origen`, \";\n\t\t\t\t$cadena_sql.=\"`estado` \";\n\t\t\t\t$cadena_sql.=\") \";\n\t\t\t\t$cadena_sql.=\"VALUES \";\n\t\t\t\t$cadena_sql.=\"( \";\n\t\t\t\t$cadena_sql.=\"'\".$variable['Id'].\"', \";\n\t\t\t\t$cadena_sql.=\"'\".$variable['name'].\"', \";\n\t\t\t\t$cadena_sql.=\"'\".$variable['country'].\"', \";\n\t\t\t\t$cadena_sql.=\"'1' \";\n\t\t\t\t$cadena_sql.=\")\";\n\t\t\t\tbreak;\n\n\t\t\tcase \"buscarTipoReserva\":\n\t\t\t\t$cadena_sql=\"SELECT DISTINCT \";\n\t\t\t\t$cadena_sql.=$prefijo.\"commerce.id_tipoReserva ID_TIPORESERVA \";\n\t\t\t\t$cadena_sql.=\"FROM \";\n\t\t\t\t$cadena_sql.=$prefijo.\"commerce \";\n\t\t\t\t$cadena_sql.=\"INNER JOIN \";\n\t\t\t\t$cadena_sql.=$prefijo.\"tipo_reserva_filtrador \";\n\t\t\t\t$cadena_sql.=\"ON (\".$prefijo.\"commerce.id_tipoReserva = \".$prefijo.\"commerce_filtrador.id_tipoReserva) \";\n\t\t\t\t$cadena_sql.=\"WHERE \";\n\t\t\t\t$cadena_sql.=$prefijo.\"commerce.estado=1 \";\n\t\t\t\t$cadena_sql.=\"AND \";\n\t\t\t\t$cadena_sql.=$prefijo.\"tipo_reserva_filtrador.estado=1 \";\n\t\t\t\tif($variable['filtros']<>\"\"){\n\t\t\t\t $cadena_sql.=\"AND \";\n\t\t\t\t $cadena_sql.=$prefijo.\"tipo_reserva_filtrador.id_filtroOpcion IN ({$variable['filtros']}) \";\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\n\n\t\t\tcase \"dataGroupReservable\":\n\t\t\t\t$cadena_sql=\"SELECT \";\n\t\t\t\t$cadena_sql.=\"id_reservable_type IDGROUP, \";\n\t\t\t\t$cadena_sql.=\"nombre NAME, \";\n\t\t\t\t$cadena_sql.=\"nombre_maquina MACHINE_NAME, \";\n\t\t\t\t$cadena_sql.=\"capacidad CAPACITY, \";\n\t\t\t\t$cadena_sql.=\"tipo_capacidad CAPACITYTYPE, \";\n\t\t\t\t$cadena_sql.=\"descripcion DESCRIPTION \";\n\t\t\t\t$cadena_sql.=\"FROM \";\n\t\t\t\t$cadena_sql.=$prefijo.\"reservable_type \";\n\t\t\t\t$cadena_sql.=\"WHERE \";\n\t\t\t\t$cadena_sql.=\"id_tipoReserva ='\".$variable[\"commerce\"].\"' \";\n\t\t\t\tif($variable[\"group\"]<>\"\"){\n\t\t\t\t$cadena_sql.=\"AND \";\n\t\t\t\t$cadena_sql.=\"id_reservable_type ='\".$variable[\"group\"].\"' \";\n\t\t\t\t}\n\t\t\t\t$cadena_sql.=\"AND \";\n\t\t\t\t$cadena_sql.=\"estado = 1 \";\n\n\t\t\tbreak;\n\n\t\t\tcase \"dataRoomAvailability\":\n\t\t\t\t$cadena_sql=\"SELECT \";\n\t\t\t\t$cadena_sql.=\"id_reservable_type IDGROUP, \";\n\t\t\t\t$cadena_sql.=\"nombre NAME, \";\n\t\t\t\t$cadena_sql.=\"nombre_maquina MACHINE_NAME, \";\n\t\t\t\t$cadena_sql.=\"capacidad CAPACITY, \";\n\t\t\t\t$cadena_sql.=\"descripcion DESCRIPTION \";\n\t\t\t\t$cadena_sql.=\"FROM \";\n\t\t\t\t$cadena_sql.=$prefijo.\"reservable_type \";\n\t\t\t\t$cadena_sql.=\"WHERE \";\n\t\t\t\t$cadena_sql.=\"id_tipoReserva ='\".$variable[\"commerce\"].\"' \";\n\t\t\t\t$cadena_sql.=\"AND \";\n\t\t\t\t$cadena_sql.=\"capacidad >= '\".$variable[\"guest\"].\"' \";\n\t\t\t\t$cadena_sql.=\"AND \";\n\t\t\t\t$cadena_sql.=\"estado = 1 \";\n\t\t\t\t$cadena_sql.=\"ORDER BY \";\n\t\t\t\t$cadena_sql.=\"capacidad ASC \";\n\n\t\t\tbreak;\n\n\t\t\tcase \"dataUserByID\":\n\t\t\t\t$cadena_sql=\"SELECT \";\n\t\t\t\t$cadena_sql.=\"id_usuario USUARIOID, \";\n\t\t\t\t$cadena_sql.=\"nombre NOMBRE, \";\n\t\t\t\t$cadena_sql.=\"apellido APELLIDO, \";\n\t\t\t\t$cadena_sql.=\"telefono TELEFONO, \";\n\t\t\t\t$cadena_sql.=\"correo EMAIL, \";\n\t\t\t\t$cadena_sql.=\"fecha_nacimiento BIRTHDAY \";\n\t\t\t\t$cadena_sql.=\"FROM \";\n\t\t\t\t$cadena_sql.=$prefijo.\"user \";\n\t\t\t\t$cadena_sql.=\"WHERE \";\n\t\t\t\t$cadena_sql.=\"`id_usuario` ='\".$variable.\"' \";\n\t\t\tbreak;\n\n\t\t\tcase \"dataUserByEmail\":\n\t\t\t\t$cadena_sql=\"SELECT \";\n\t\t\t\t$cadena_sql.=\"id_usuario USERID, \";\n\t\t\t\t$cadena_sql.=\"nombre NAME, \";\n\t\t\t\t$cadena_sql.=\"apellido LASTNAME, \";\n\t\t\t\t$cadena_sql.=\"telefono PHONE, \";\n\t\t\t\t$cadena_sql.=\"correo EMAIL, \";\n\t\t\t\t$cadena_sql.=\"fecha_nacimiento BIRTHDAY \";\n\t\t\t\t$cadena_sql.=\"FROM \";\n\t\t\t\t$cadena_sql.=$prefijo.\"user \";\n\t\t\t\t$cadena_sql.=\"WHERE \";\n\t\t\t\t$cadena_sql.=\"`correo` ='\".$variable.\"' \";\n\t\t\tbreak;\n\n\t\t\tcase \"dataUserById\":\n\t\t\t\t$cadena_sql=\"SELECT \";\n\t\t\t\t$cadena_sql.=\"id_usuario USERID, \";\n\t\t\t\t$cadena_sql.=\"nombre NAME, \";\n\t\t\t\t$cadena_sql.=\"apellido LASTNAME, \";\n\t\t\t\t$cadena_sql.=\"telefono PHONE, \";\n\t\t\t\t$cadena_sql.=\"correo EMAIL, \";\n\t\t\t\t$cadena_sql.=\"fecha_nacimiento BIRTHDAY \";\n\t\t\t\t$cadena_sql.=\"FROM \";\n\t\t\t\t$cadena_sql.=$prefijo.\"user \";\n\t\t\t\t$cadena_sql.=\"WHERE \";\n\t\t\t\t$cadena_sql.=\"`id_usuario` ='\".$variable.\"' \";\n\t\t\tbreak;\n\n\t\t\tcase \"dataUserByIden\":\n\t\t\t\t$cadena_sql=\"SELECT \";\n\t\t\t\t$cadena_sql.=\"id_usuario USUARIOID, \";\n\t\t\t\t$cadena_sql.=\"nombre NOMBRE, \";\n\t\t\t\t$cadena_sql.=\"apellido APELLIDO, \";\n\t\t\t\t$cadena_sql.=\"telefono TELEFONO, \";\n\t\t\t\t$cadena_sql.=\"correo EMAIL, \";\n\t\t\t\t$cadena_sql.=\"fecha_nacimiento BIRTHDAY \";\n\t\t\t\t$cadena_sql.=\"FROM \";\n\t\t\t\t$cadena_sql.=$prefijo.\"user \";\n\t\t\t\t$cadena_sql.=\"WHERE \";\n\t\t\t\t$cadena_sql.=\"`identificacion` ='\".$variable.\"' \";\n\t\t\tbreak;\n\n\t\t\tcase \"dataGuestByIden\":\n\t\t\t\t$cadena_sql=\"SELECT \";\n\t\t\t\t$cadena_sql.=\"id_guest USUARIOID, \";\n\t\t\t\t$cadena_sql.=\"nombre NOMBRE, \";\n\t\t\t\t$cadena_sql.=\"apellido APELLIDO, \";\n\t\t\t\t$cadena_sql.=\"telefono TELEFONO, \";\n\t\t\t\t$cadena_sql.=\"correo EMAIL, \";\n\t\t\t\t$cadena_sql.=\"fecha_nacimiento BIRTHDAY \";\n\t\t\t\t$cadena_sql.=\"FROM \";\n\t\t\t\t$cadena_sql.=$prefijo.\"guest \";\n\t\t\t\t$cadena_sql.=\"WHERE \";\n\t\t\t\t$cadena_sql.=\"`identificacion` ='\".$variable.\"' \";\n\t\t\tbreak;\n\n\t\t\tcase \"priceList\":\n\t\t\t\t$cadena_sql=\"SELECT \";\n\t\t\t\t$cadena_sql.=\"id_reservable_type IDTYPEROOM, \";\n\t\t\t\t$cadena_sql.=\"id_temporada SEASON, \";\n\t\t\t\t$cadena_sql.=\"guest GUEST, \";\n\t\t\t\t$cadena_sql.=\"COP COP, \";\n\t\t\t\t$cadena_sql.=\"USD USD \";\n\t\t\t\t$cadena_sql.=\"FROM \";\n\t\t\t\t$cadena_sql.=$prefijo.\"reservable_valor \";\n\t\t\t\t$cadena_sql.=\"WHERE estado='1' \";\n\t\t\t\t$cadena_sql.=\"AND \";\n\t\t\t\t$cadena_sql.=\"`id_reservable_type` ='\".$variable['idgroup'].\"' \";\n\t\t\t\t$cadena_sql.=\"AND( \";\n\t\t\t\t$cadena_sql.=\"`guest` ='\".$variable['guest'].\"' \";\n\t\t\t\t$cadena_sql.=\"OR \";\n\t\t\t\t$cadena_sql.=\"`guest` = '0' \"; //para incluir niños\n\t\t\t\t$cadena_sql.=\") \";\n\n\t\t\t\tbreak;\n\n\t\t\tcase \"activeBooking\":\n\t\t\t\t$cadena_sql=\"SELECT \";\n\t\t\t\t$cadena_sql.=\"r.id_reserva IDBOOKING, \";\n\t\t\t\t$cadena_sql.=\"r.tipo_reserva IDCOMMERCE, \";\n\t\t\t\t$cadena_sql.=\"r.fecha_inicio STARTBOOKING, \";\n\t\t\t\t$cadena_sql.=\"r.fecha_fin ENDBOOKING, \";\n\t\t\t\t$cadena_sql.=\"DATEDIFF(FROM_UNIXTIME( `fecha_fin` ),FROM_UNIXTIME( `fecha_inicio` )) NUMDAYS \";\n\t\t\t\t$cadena_sql.=\"FROM \";\n\t\t\t\t$cadena_sql.=$prefijo.\"reservation r \";\n\t\t\t\t$cadena_sql.=\"WHERE \";\n\t\t\t\t$cadena_sql.=\"r.sesion_temp ='\".$variable['session'].\"' \";\n\t\t\t\t$cadena_sql.=\"AND \";\n\t\t\t\t$cadena_sql.=\"r.estado_reserva ='1' \";\n\t\t\tbreak;\n\n\t\t\tcase \"bookingByID\":\n\t\t\t\t$cadena_sql=\"SELECT \";\n\t\t\t\t$cadena_sql.=\"r.id_reserva IDBOOKING, \";\n\t\t\t\t$cadena_sql.=\"r.tipo_reserva IDCOMMERCE, \";\n\t\t\t\t$cadena_sql.=\"FROM_UNIXTIME(r.fecha_inicio) CHECKIN, \";\n\t\t\t\t$cadena_sql.=\"r.fecha_inicio STARTBOOKING, \";\n\t\t\t\t$cadena_sql.=\"r.fecha_fin ENDBOOKING, \";\n\t\t\t\t$cadena_sql.=\"FROM_UNIXTIME(r.fecha_fin) CHECKOUT, \";\n\t\t\t\t$cadena_sql.=\"DATEDIFF(FROM_UNIXTIME( `fecha_fin` ),FROM_UNIXTIME( `fecha_inicio` )) NUMDAYS \";\n\t\t\t\t$cadena_sql.=\"FROM \";\n\t\t\t\t$cadena_sql.=$prefijo.\"reservation r \";\n\t\t\t\t$cadena_sql.=\"WHERE \";\n\t\t\t\t$cadena_sql.=\"r.id_reserva ='\".$variable.\"' \";\n\n\n\t\t\tbreak;\n\n\t\t\tcase \"lockedBooking\":\n\t\t\t\t$cadena_sql=\"SELECT \";\n\t\t\t\t$cadena_sql.=\"date \";\n\t\t\t\t$cadena_sql.=\"FROM \";\n\t\t\t\t$cadena_sql.=$prefijo.\"reserva_locked \";\n\t\t\t\t$cadena_sql.=\"WHERE \";\n\t\t\t\t$cadena_sql.=\" date ='\".$variable['date'].\"' \";\n\t\t\t\t$cadena_sql.=\" AND \";\n\t\t\t\t$cadena_sql.=\" id_commerce ='\".$variable['commerce'].\"' \";\n\n\t\t\tbreak;\n\n\t\t\tcase \"searchDay\":\n\t\t\t\t$cadena_sql=\"SELECT \";\n\t\t\t\t$cadena_sql.=\"id_season IDSEASON \";\n\t\t\t\t$cadena_sql.=\"FROM \";\n\t\t\t\t$cadena_sql.=$prefijo.\"season_calendar \";\n\t\t\t\t$cadena_sql.=\"WHERE estado='1' \";\n\t\t\t\t$cadena_sql.=\" AND id_commerce = \".$variable['commerce'];\n\t\t\t\t$cadena_sql.=\" AND time = '\".$variable['day'].\"'\";\n\t\t\t\t//$cadena_sql.=\" AND DATE_FORMAT(FROM_UNIXTIME(time),'%m%d') = DATE_FORMAT(FROM_UNIXTIME('\".$variable['day'].\"'),'%m%d')\";\n\t\t\tbreak;\n\n case \"getTypeRoomSeason\":\n\t\t\t\t$cadena_sql=\"SELECT \";\n\t\t\t\t$cadena_sql.=\"min_days MINIMUN, \";\n\t\t\t\t$cadena_sql.=\"id_reservable_type IDTYPEROOM, \";\n $cadena_sql.=\"DATEDIFF(FROM_UNIXTIME(\".$variable['timeStampEnd'].\"),FROM_UNIXTIME(\".$variable['timeStampStart'].\")) NUMDAYS, \";\n\t\t\t\t$cadena_sql.=\"id_season SEASON \";\n\t\t\t\t$cadena_sql.=\"FROM \";\n\t\t\t\t$cadena_sql.=$prefijo.\"reservable_type_season \";\n $cadena_sql.=\"WHERE \";\n\t\t\t\t$cadena_sql.=\"`id_reservable_type` ='\".$variable['groupRoom'].\"' \";\n\t\t\t\tbreak;\n\n\n\t\t\tcase \"dataBookingByID\":\n\t\t\t\t$cadena_sql=\"SELECT \";\n\t\t\t\t$cadena_sql.=\"r.id_reserva IDBOOKING, \";\n\t\t\t\t$cadena_sql.=\"DATE_FORMAT(FROM_UNIXTIME(r.fecha_inicio),'%d %b %Y') CHECKIN, \";\n\t\t\t\t$cadena_sql.=\"DATE_FORMAT(FROM_UNIXTIME((r.fecha_fin)+2),'%d %b %Y') CHECKOUT, \";\n\t\t\t\t$cadena_sql.=\"r.fecha_inicio CHECKIN_UNIXTIME, \";\n\t\t\t\t$cadena_sql.=\"r.fecha_fin CHECKOUT_UNIXTIME, \";\n\t\t\t\t$cadena_sql.=\"r.observacion_cliente OBSERVATION_CLIENT, \";\n\t\t\t\t$cadena_sql.=\"rr.adults ADULTS, \";\n\t\t\t\t$cadena_sql.=\"rr.children CHILDREN, \";\n\t\t\t\t$cadena_sql.=\"rr.infants INFANTS, \";\n\t\t\t\t$cadena_sql.=\"r.cliente CLIENT, \";\n\t\t\t\t$cadena_sql.=\"r.tipo_reserva COMMERCE, \";\n\t\t\t\t$cadena_sql.=\"r.valor_total VALUE \";\n\t\t\t\t$cadena_sql.=\"FROM \";\n\t\t\t\t$cadena_sql.=$prefijo.\"reservation r \";\n\t\t\t\t$cadena_sql.=\"INNER JOIN \";\n\t\t\t\t$cadena_sql.=$prefijo.\"reservation_reservable rr \";\n\t\t\t\t$cadena_sql.=\"ON r.id_reserva = rr.id_reserva \";\n\t\t\t\t$cadena_sql.=\"WHERE \";\n\t\t\t\t$cadena_sql.=\"r.id_reserva ='\".$variable.\"' \";\n\t\t\tbreak;\n\n\t\t\tcase \"dataBookingBySession\":\n\t\t\t\t$cadena_sql=\"SELECT \";\n\t\t\t\t$cadena_sql.=\"r.id_reserva IDBOOKING, \";\n\t\t\t\t$cadena_sql.=\"DATE_FORMAT(FROM_UNIXTIME(r.fecha_inicio),'%m/%d/%Y') CHECKIN, \";\n\t\t\t\t$cadena_sql.=\"DATE_FORMAT(FROM_UNIXTIME((r.fecha_fin)+2),'%m/%d/%Y') CHECKOUT, \";\n\t\t\t\t$cadena_sql.=\"r.fecha_inicio CHECKIN_UNIXTIME, \";\n\t\t\t\t$cadena_sql.=\"r.fecha_fin CHECKOUT_UNIXTIME, \";\n\t\t\t\t$cadena_sql.=\"'0' INFANTS, \";\n\t\t\t\t$cadena_sql.=\"r.cliente CLIENT, \";\n\t\t\t\t$cadena_sql.=\"r.tipo_reserva COMMERCE, \";\n\t\t\t\t$cadena_sql.=\"r.observacion_cliente OBSERVATION_CLIENT, \";\n\t\t\t\t$cadena_sql.=\"r.valor_total VALUE \";\n\t\t\t\t$cadena_sql.=\"FROM \";\n\t\t\t\t$cadena_sql.=$prefijo.\"reservation r \";\n\t\t\t\t$cadena_sql.=\"WHERE \";\n\t\t\t\t$cadena_sql.=\"r.sesion_temp ='\".$variable.\"' \";\n\t\t\tbreak;\n\n\t\t\tcase \"dataBasicBooking\":\n\t\t\t\t$cadena_sql=\"SELECT \";\n\t\t\t\t$cadena_sql.=\"r.id_reserva IDBOOKING, \";\n\t\t\t\t$cadena_sql.=\"DATE_FORMAT(FROM_UNIXTIME(r.fecha_inicio),'%d/%m/%Y') CHECKIN, \";\n\t\t\t\t$cadena_sql.=\"DATE_FORMAT(FROM_UNIXTIME((r.fecha_fin)+2),'%d/%m/%Y') CHECKOUT, \";\n\t\t\t\t$cadena_sql.=\"r.fecha_inicio CHECKIN_UNIXTIME, \";\n\t\t\t\t$cadena_sql.=\"r.fecha_fin CHECKOUT_UNIXTIME, \";\n\t\t\t\t$cadena_sql.=\"'0' INFANTS, \";\n\t\t\t\t$cadena_sql.=\"r.cliente CLIENT, \";\n\t\t\t\t$cadena_sql.=\"r.tipo_reserva COMMERCE, \";\n\t\t\t\t$cadena_sql.=\"r.observacion_cliente OBSERVATION_CLIENT, \";\n\t\t\t\t$cadena_sql.=\"r.observacion OBSERVATION_HOTEL, \";\n\t\t\t\t$cadena_sql.=\"r.estado_reserva STATUS_CODE, \";\n\t\t\t\t$cadena_sql.=\"r.estado_pago STATUS_PÄYMENT_CODE, \";\n\t\t\t\t$cadena_sql.=\"r.medio ORIGIN, \";\n\t\t\t\t$cadena_sql.=\"r.valor_pagado HOTEL_PAYMENT, \";\n\t\t\t\t$cadena_sql.=\"r.valor_total VALUE \";\n\t\t\t\t$cadena_sql.=\"FROM \";\n\t\t\t\t$cadena_sql.=$prefijo.\"reservation r \";\n\t\t\t\t$cadena_sql.=\"WHERE \";\n\t\t\t\t$cadena_sql.=\"r.id_reserva ='\".$variable.\"' \";\n\t\t\tbreak;\n\n\t\t\tcase \"dataRoomTypeBookingbyID\":\n\t\t\t\t$cadena_sql=\"SELECT \";\n\t\t\t\t$cadena_sql.=\"rg.nombre NAME, \";\n\t\t\t\t$cadena_sql.=\"rg.id_reservable_type IDTYPEROOM \";\n\t\t\t\t$cadena_sql.=\"FROM \";\n\t\t\t\t$cadena_sql.=$prefijo.\"reservation r \";\n\t\t\t\t$cadena_sql.=\"INNER JOIN \";\n\t\t\t\t$cadena_sql.=$prefijo.\"reservation_reservable rr \";\n\t\t\t\t$cadena_sql.=\"ON \";\n\t\t\t\t$cadena_sql.=\"rr.id_reserva = r.id_reserva \";\n\t\t\t\t$cadena_sql.=\"INNER JOIN \";\n\t\t\t\t$cadena_sql.=$prefijo.\"reservable_type rg \";\n\t\t\t\t$cadena_sql.=\"ON \";\n\t\t\t\t$cadena_sql.=\"rr.id_reservable_type = rg.id_reservable_type \";\n\t\t\t\t$cadena_sql.=\"WHERE \";\n\t\t\t\t$cadena_sql.=\"r.id_reserva ='\".$variable.\"' \";\n\t\t\tbreak;\n\n\t\t\tcase \"dataRoomBookingbyID\":\n\t\t\t\t$cadena_sql=\"SELECT \";\n\t\t\t\t$cadena_sql.=\"rs.nombre NAME, \";\n\t\t\t\t$cadena_sql.=\"rs.id_reservable IDROOM \";\n\t\t\t\t$cadena_sql.=\"FROM \";\n\t\t\t\t$cadena_sql.=$prefijo.\"reservation r \";\n\t\t\t\t$cadena_sql.=\"INNER JOIN \";\n\t\t\t\t$cadena_sql.=$prefijo.\"reservation_reservable rr \";\n\t\t\t\t$cadena_sql.=\"ON \";\n\t\t\t\t$cadena_sql.=\"rr.id_reserva = r.id_reserva \";\n\t\t\t\t$cadena_sql.=\"INNER JOIN \";\n\t\t\t\t$cadena_sql.=$prefijo.\"reservable rs \";\n\t\t\t\t$cadena_sql.=\"ON \";\n\t\t\t\t$cadena_sql.=\"rs.id_reservable = rr.id_reservable \";\n\t\t\t\t$cadena_sql.=\"WHERE \";\n\t\t\t\t$cadena_sql.=\"r.id_reserva ='\".$variable.\"' \";\n\t\t\tbreak;\n\n\n\t\t\tcase \"deleteUnconfirmedBookingUser\":\n\t\t\t\t$cadena_sql=\"DELETE \";\n\t\t\t\t$cadena_sql.=\"FROM \";\n\t\t\t\t$cadena_sql.=$prefijo.\"reservation \";\n\t\t\t\t$cadena_sql.=\"WHERE \";\n\t\t\t\t$cadena_sql.=\"`cliente` ='\".$variable.\"' \";\n\t\t\t\t$cadena_sql.=\"AND \";\n\t\t\t\t$cadena_sql.=\"sesion_temp<>'' \";\n\t\t\t\t$cadena_sql.=\"AND \";\n\t\t\t\t$cadena_sql.=\"estado_reserva=1 \";\n\t\t\tbreak;\n\n\t\t\tcase \"deleteUnconfirmedSession\":\n\t\t\t\t$cadena_sql=\"DELETE \";\n\t\t\t\t$cadena_sql.=\"FROM \";\n\t\t\t\t$cadena_sql.=$prefijo.\"reservation \";\n\t\t\t\t$cadena_sql.=\"WHERE \";\n\t\t\t\t$cadena_sql.=\"`sesion_temp` ='\".$variable.\"' \";\n\t\t\t\t$cadena_sql.=\"AND \";\n\t\t\t\t$cadena_sql.=\"`estado_reserva` ='1' \";\n\t\t\tbreak;\n\n\t\t\tcase \"deleteUnconfirmedBookingAll\":\n\t\t\t\t$cadena_sql=\"DELETE \";\n\t\t\t\t$cadena_sql.=\"FROM \";\n\t\t\t\t$cadena_sql.=$prefijo.\"reservation \";\n\t\t\t\t$cadena_sql.=\"WHERE \";\n\t\t\t\t$cadena_sql.=\"sesion_temp<>'' \";\n\t\t\t\t$cadena_sql.=\"AND \";\n\t\t\t\t$cadena_sql.=\"`tiempo_expira_temp` < \".time().\" \";\n\t\t\t\t$cadena_sql.=\"AND \";\n\t\t\t\t$cadena_sql.=\"`estado_reserva` ='1' \";\n\n\t\t\tbreak;\n\n\t\t\tcase \"paymentByBookingID\":\n\t\t\t\t$cadena_sql=\"SELECT \";\n\t\t\t\t$cadena_sql.=\"pp.system_reference SYSTEMREFERENCE, \";\n\t\t\t\t$cadena_sql.=\"pp.description DESCRIPTION, \";\n\t\t\t\t$cadena_sql.=\"pp.id_payu_reference IDPAYMENT, \";\n\t\t\t\t$cadena_sql.=\"pp.value VALUE, \";\n\t\t\t\t$cadena_sql.=\"pp.id_commerce IDCOMMERCE, \";\n\t\t\t\t$cadena_sql.=\"pp.answer ANSWER, \";\n\t\t\t\t$cadena_sql.=\"pp.currency CURRENCY \";\n\t\t\t\t$cadena_sql.=\"FROM \";\n\t\t\t\t$cadena_sql.=$prefijo.\"payu_payment pp \";\n\t\t\t\t$cadena_sql.=\"WHERE \";\n\t\t\t\t$cadena_sql.=\"pp.system_reference='\".$variable.\"' \";\n\t\t\t\t$cadena_sql.=\"AND \";\n\t\t\t\t$cadena_sql.=\"pp.status = 1 \";\n\t\t\t\tbreak;\n\n\t\t\tcase \"countRoomsByGroup\":\n\t\t\t\t$cadena_sql=\"SELECT \";\n\t\t\t\t$cadena_sql.=\"count(id_reservable) \";\n\t\t\t\t$cadena_sql.=\"FROM \";\n\t\t\t\t$cadena_sql.=$prefijo.\"reservable \";\n\t\t\t\t$cadena_sql.=\"WHERE \";\n\t\t\t\t$cadena_sql.=\"id_reservableGrupo ='\".$variable['groupRoom'].\"' \";\n\t\t\t\t$cadena_sql.=\"AND \";\n\t\t\t\t$cadena_sql.=\"tipo_reserva = '\".$variable['commerce'].\"' \";\n\t\t\t\t$cadena_sql.=\"AND \";\n\t\t\t\t$cadena_sql.=\"estado = '1' \";\n\t\t\tbreak;\n\n\t\t\tcase \"updateDataUser\":\n\t\t\t\t$cadena_sql=\"UPDATE \";\n\t\t\t\t$cadena_sql.=$prefijo.\"user \";\n\t\t\t\t$cadena_sql.=\"SET \";\n\t\t\t\tif($variable['country']<>\"\"){\n\t\t\t\t\t$cadena_sql.=\"pais_origen ='\".$variable['country'].\"', \";\n\t\t\t\t}\n\t\t\t\tif($variable['name']<>\"\"){\n\t\t\t\t\t$cadena_sql.=\"nombre ='\".$variable['name'].\"', \";\n\t\t\t\t}\n\t\t\t\tif($variable['lastname']<>\"\"){\n\t\t\t\t\t$cadena_sql.=\"apellido ='\".$variable['lastname'].\"', \";\n\t\t\t\t}\n\t\t\t\tif($variable['dni']<>\"\"){\n\t\t\t\t\t$cadena_sql.=\"identificacion ='\".$variable['dni'].\"', \";\n\t\t\t\t}\n\t\t\t\tif($variable['phone']<>\"\"){\n\t\t\t\t\t$cadena_sql.=\"telefono='\".$variable['phone'].\"', \";\n\t\t\t\t}\n\t\t\t\t$cadena_sql.=\"estado='1' \";\n\t\t\t\t$cadena_sql.=\"WHERE \";\n\t\t\t\t$cadena_sql.=\"correo ='\".$variable['email'].\"' \";\n\t\t\tbreak;\n\n\t\t\tcase \"insertUser\":\n\t\t\t\t$cadena_sql=\"INSERT INTO \";\n\t\t\t\t$cadena_sql.=$prefijo.\"user \";\n\t\t\t\t$cadena_sql.=\"( \";\n\t\t\t\t$cadena_sql.=\"`nombre`, \";\n\t\t\t\t$cadena_sql.=\"`apellido`, \";\n\t\t\t\t$cadena_sql.=\"`correo`, \";\n\t\t\t\t$cadena_sql.=\"`telefono`, \";\n\t\t\t\t$cadena_sql.=\"`usuario`, \";\n\t\t\t\t$cadena_sql.=\"`clave`, \";\n\t\t\t\t$cadena_sql.=\"`identificacion`, \";\n\t\t\t\t$cadena_sql.=\"`pais_origen`, \";\n\t\t\t\t$cadena_sql.=\"`estilo`, \";\n\t\t\t\t$cadena_sql.=\"`idioma`, \";\n\t\t\t\t$cadena_sql.=\"`estado` \";\n\t\t\t\t$cadena_sql.=\") \";\n\t\t\t\t$cadena_sql.=\"VALUES \";\n\t\t\t\t$cadena_sql.=\"( \";\n\t\t\t\t$cadena_sql.=\"'\".$variable['name'].\"', \";\n\t\t\t\t$cadena_sql.=\"'\".$variable['lastname'].\"', \";\n\t\t\t\t$cadena_sql.=\"'\".$variable['email'].\"', \";\n\t\t\t\t$cadena_sql.=\"'\".$variable['phone'].\"', \";\n\t\t\t\t$cadena_sql.=\"'', \";\n\t\t\t\t$cadena_sql.=\"'', \";\n\t\t\t\t$cadena_sql.=\"'\".$variable['dni'].\"', \";\n\t\t\t\t$cadena_sql.=\"'\".$variable['country'].\"', \";\n\t\t\t\t$cadena_sql.=\"'default', \";\n\t\t\t\t$cadena_sql.=\"'es_es', \";\n\t\t\t\t$cadena_sql.=\"'1' \";\n\t\t\t\t$cadena_sql.=\")\";\n\t\t\t\tbreak;\n\n case \"insertRole\":\n\t\t\t\t$cadena_sql=\"INSERT INTO \";\n\t\t\t\t$cadena_sql.=$prefijo.\"user_role \";\n\t\t\t\t$cadena_sql.=\"( \";\n\t\t\t\t$cadena_sql.=\"`id_usuario`, \";\n\t\t\t\t$cadena_sql.=\"`id_subsistema`, \";\n\t\t\t\t$cadena_sql.=\"`estado` \";\n\t\t\t\t$cadena_sql.=\") \";\n\t\t\t\t$cadena_sql.=\"VALUES \";\n\t\t\t\t$cadena_sql.=\"( \";\n\t\t\t\t$cadena_sql.=\"'\".$variable['user'].\"', \";\n\t\t\t\t$cadena_sql.=\"'3', \";\n\t\t\t\t$cadena_sql.=\"'1' \";\n\t\t\t\t$cadena_sql.=\")\";\n\t\t\t\tbreak;\n\n\t\t\tcase \"getAllSession\":\n\t\t\t\t$cadena_sql = \"SELECT valor \";\n\t\t\t\t$cadena_sql.=\"FROM \";\n\t\t\t\t$cadena_sql.=$prefijo.\"session \";\n\t\t\t\t$cadena_sql.=\"WHERE \";\n\t\t\t\t$cadena_sql.=\"sesionId = '\".$variable.\"' \";\n\t\t\t\tbreak;\n\n\t\t\tcase \"setBookingSession\":\n\t\t\t\t$cadena_sql=\"INSERT INTO \";\n\t\t\t\t$cadena_sql.=$prefijo.\"session \";\n\t\t\t\t$cadena_sql.=\"( \";\n\t\t\t\t$cadena_sql.=\"`sesionId`, \";\n\t\t\t\t$cadena_sql.=\"`variable`, \";\n\t\t\t\t$cadena_sql.=\"`valor`, \";\n\t\t\t\t$cadena_sql.=\"`expiracion` \";\n\t\t\t\t$cadena_sql.=\") \";\n\t\t\t\t$cadena_sql.=\"VALUES \";\n\t\t\t\t$cadena_sql.=\"( \";\n\t\t\t\t$cadena_sql.=\"'\".$variable.\"', \";\n\t\t\t\t$cadena_sql.=\"'idUsuario', \";\n\t\t\t\t$cadena_sql.=\"'\".time().\"', \";\n\t\t\t\t$cadena_sql.=\"'\".(time()+86400).\"' \";\n\t\t\t\t$cadena_sql.=\")\";\n\t\t\t\tbreak;\n\n\t\t\tcase \"updateValueBookingbyID\":\n\t\t\t\t$cadena_sql=\"UPDATE \";\n\t\t\t\t$cadena_sql.=$prefijo.\"reservation \";\n\t\t\t\t$cadena_sql.=\"SET \";\n\t\t\t\t$cadena_sql.=\"valor_total ='\".$variable['value'].\"' \";\n\t\t\t\t$cadena_sql.=\"WHERE \";\n\t\t\t\t$cadena_sql.=\"id_reserva ='\".$variable['idbooking'].\"' \";\n\t\t\tbreak;\n\n\n\t\t\tcase \"confirmBookingbyID\":\n\t\t\t\t$cadena_sql=\"UPDATE \";\n\t\t\t\t$cadena_sql.=$prefijo.\"reservation \";\n\t\t\t\t$cadena_sql.=\"SET \";\n\t\t\t\t$cadena_sql.=\"sesion_temp ='', \";\n\t\t\t\t$cadena_sql.=\"tiempo_expira_temp=fecha_fin, \";\n\t\t\t\t$cadena_sql.=\"estado_reserva=2, \";\n\t\t\t\t$cadena_sql.=\"cliente ='\".$variable['customer'].\"', \";\n\t\t\t\t$cadena_sql.=\"valor_total ='\".$variable['valueBooking'].\"' \";\n\t\t\t\t$cadena_sql.=\"WHERE \";\n\t\t\t\t$cadena_sql.=\"id_reserva ='\".$variable['idbooking'].\"' \";\n\t\t\t\t$cadena_sql.=\"AND \";\n\t\t\t\t$cadena_sql.=\"estado_reserva = '1' \";\n\t\t\tbreak;\n\n\t\t\tcase \"confirmBooking\":\n\t\t\t\t$cadena_sql=\"UPDATE \";\n\t\t\t\t$cadena_sql.=$prefijo.\"reservation \";\n\t\t\t\t$cadena_sql.=\"SET \";\n\t\t\t\t$cadena_sql.=\"sesion_temp ='', \";\n\t\t\t\t$cadena_sql.=\"tiempo_expira_temp=fecha_fin, \";\n\t\t\t\tif(isset($variable['user'])){\n\t\t\t\t\t$cadena_sql.=\"cliente ='\".$variable['user'].\"', \";\n\t\t\t\t}\n\t\t\t\tif(isset($variable['observation'])){\n\t\t\t\t\t$cadena_sql.=\"observacion_cliente='\".$variable['observation'].\"', \";\n\t\t\t\t}\n\t\t\t\tif(isset($variable['value'])){\n\t\t\t\t\t$cadena_sql.=\"valor_total ='\".$variable['value'].\"', \";\n\t\t\t\t}\n\t\t\t\t$cadena_sql.=\"estado_reserva=2 \";\n\t\t\t\t$cadena_sql.=\"WHERE \";\n\t\t\t\t$cadena_sql.=\"sesion_temp ='\".$variable['session'].\"' \";\n\t\t\t\t$cadena_sql.=\"AND \";\n\t\t\t\t$cadena_sql.=\"estado_reserva = '1' \";\n\t\t\tbreak;\n\n\t\t\tcase \"updateUserBooking\":\n\t\t\t\t$cadena_sql=\"UPDATE \";\n\t\t\t\t$cadena_sql.=$prefijo.\"reservation \";\n\t\t\t\t$cadena_sql.=\"SET \";\n\t\t\t\t$cadena_sql.=\"cliente ='\".$variable['user'].\"' \";\n\t\t\t\t$cadena_sql.=\"WHERE \";\n\t\t\t\t$cadena_sql.=\"sesion_temp ='\".$variable['session'].\"' \";\n\t\t\t\t$cadena_sql.=\"AND \";\n\t\t\t\t$cadena_sql.=\"estado_reserva = '1' \";\n\t\t\tbreak;\n\n\t\t\tcase \"valFiltersCommerceID\":\n\t\t\t\t$cadena_sql=\"SELECT \";\n\t\t\t\t$cadena_sql.=\"fo.nombre NOMBRE \";\n\t\t\t\t$cadena_sql.=\"FROM \";\n\t\t\t\t$cadena_sql.=$prefijo.\"filtro_opcion fo \";\n\t\t\t\t$cadena_sql.=\"INNER JOIN \";\n\t\t\t\t$cadena_sql.=$prefijo.\"commerce_filtrador trf \";\n\t\t\t\t$cadena_sql.=\"ON (fo.id_filtroOpcion = trf.id_filtroOpcion) \";\n\t\t\t\t$cadena_sql.=\"WHERE \";\n\t\t\t\t$cadena_sql.=\"trf.id_tipoReserva ='\".$variable['commerce'].\"' \";\n\t\t\t\t$cadena_sql.=\"AND \";\n\t\t\t\t$cadena_sql.=\"fo.id_filtroComponente = '\".$variable['component'].\"' \";\n\t\t\tbreak;\n\n\n\t\t\tcase \"iniciarTransaccion\":\n\t\t\t\t$cadena_sql=\"START TRANSACTION\";\n\t\t\t\tbreak;\n\n\t\t\tcase \"finalizarTransaccion\":\n\t\t\t\t$cadena_sql=\"COMMIT\";\n\t\t\t\tbreak;\n\n\t\t\tcase \"cancelarTransaccion\":\n\t\t\t\t$cadena_sql=\"ROLLBACK\";\n\t\t\t\tbreak;\n\n\n\t\t\tcase \"eliminarTemp\":\n\n\t\t\t\t$cadena_sql=\"DELETE \";\n\t\t\t\t$cadena_sql.=\"FROM \";\n\t\t\t\t$cadena_sql.=$prefijo.\"tempFormulario \";\n\t\t\t\t$cadena_sql.=\"WHERE \";\n\t\t\t\t$cadena_sql.=\"id_sesion = '\".$variable.\"' \";\n\t\t\t\tbreak;\n\n\t\t\tcase \"dataAllCommerce\":\n\t\t\t\t$cadena_sql=\"SELECT \";\n\t\t\t\t$cadena_sql.=\" GROUP_CONCAT(\".$prefijo.\"commerce.id_tipoReserva) ID, \";\n\t\t\t\t$cadena_sql.=$prefijo.\"commerce.nombre NAME, \";\n\t\t\t\t$cadena_sql.=$prefijo.\"commerce.url URL, \";\n\t\t\t\t$cadena_sql.=$prefijo.\"commerce.facebook FACEBOOK, \";\n\t\t\t\t$cadena_sql.=$prefijo.\"commerce.correo EMAIL, \";\n\t\t\t\t$cadena_sql.=$prefijo.\"commerce.descripcion DESCRIPTION, \";\n\t\t\t\t$cadena_sql.=$prefijo.\"commerce.id_establecimiento BRANCH, \";\n\t\t\t\t$cadena_sql.=$prefijo.\"commerce.capacidad CAPACITY, \";\n\t\t\t\t$cadena_sql.=$prefijo.\"commerce.files_folder FILESFOLDER, \";\n\t\t\t\t$cadena_sql.=$prefijo.\"commerce.imagen IMAGE, \";\n\t\t\t\t$cadena_sql.=$prefijo.\"commerce.hora_inicio CHECKIN, \";\n\t\t\t\t$cadena_sql.=$prefijo.\"commerce.hora_cierre CHECKOUT, \";\n\t\t\t\t$cadena_sql.=$prefijo.\"commerce.direccion ADDRESS, \";\n\t\t\t\t$cadena_sql.=$prefijo.\"commerce.latitud LATITUDE, \";\n\t\t\t\t$cadena_sql.=$prefijo.\"commerce.longitud LONGITUDE, \";\n\t\t\t\t$cadena_sql.=$prefijo.\"commerce.telefono PHONE \";\n\t\t\t\t$cadena_sql.=\"FROM \";\n\t\t\t\t$cadena_sql.=$prefijo.\"commerce \";\n\t\t\t\t$cadena_sql.=\"WHERE \";\n\t\t\t\t$cadena_sql.=$prefijo.\"commerce.estado=1 \";\n\t\t\t\tif($variable[\"all\"]==\"\"){\n\t\t\t\t\t$cadena_sql.=\"AND \";\n\t\t\t\t\t$cadena_sql.=$prefijo.\"commerce.id_tipoReserva IN ( \".$variable[\"commerces\"].\" ) \";\n\t\t\t\t}\n\t\t\t\tif($variable[\"commerceType\"]<>\"\"){\n\t\t\t\t\t$cadena_sql.=\"AND \";\n\t\t\t\t\t$cadena_sql.=$prefijo.\"commerce.id_claTipoReserva='\".$variable[\"commerceType\"].\"' \";\n\t\t\t\t}\n\t\t\t\tif($variable[\"plan\"]<>\"\"){\n\t\t\t\t\t$cadena_sql.=\"AND \";\n\t\t\t\t\t$cadena_sql.=$prefijo.\"commerce.id_plan='\".$variable[\"plan\"].\"' \";\n\t\t\t\t}\n\t\t\t\t$cadena_sql.=\"GROUP BY `id_establecimiento` \";\n\t\t\t\t$cadena_sql.=\"ORDER BY \".$prefijo.\"commerce.id_plan DESC, \".$prefijo.\"commerce.nombre ASC\";\n\t\t\t\tbreak;\n\n\t\t\tcase \"apiCommerceByID\":\n\t\t\t\t$cadena_sql=\"SELECT \";\n\t\t\t\t$cadena_sql.=$prefijo.\"commerce.api_key APIKEY \";\n\t\t\t\t$cadena_sql.=\"FROM \";\n\t\t\t\t$cadena_sql.=$prefijo.\"commerce \";\n\t\t\t\t$cadena_sql.=\"WHERE \";\n\t\t\t\t$cadena_sql.=$prefijo.\"commerce.id_tipoReserva ='\".$variable.\"' \";\n\t\t\t\tbreak;\n\n\t\t\tcase \"dataCommerceByID\":\n\t\t\t\t$cadena_sql=\"SELECT \";\n\t\t\t\t$cadena_sql.=$prefijo.\"commerce.nombre NAME, \";\n\t\t\t\t$cadena_sql.=$prefijo.\"commerce.descripcion DESCRIPTION, \";\n\t\t\t\t$cadena_sql.=$prefijo.\"commerce.telefono PHONE, \";\n\t\t\t\t$cadena_sql.=$prefijo.\"commerce.longitud LONGITUDE, \";\n\t\t\t\t$cadena_sql.=$prefijo.\"commerce.latitud LATITUDE, \";\n\t\t\t\t$cadena_sql.=$prefijo.\"commerce.facebook FACEBOOK, \";\n\t\t\t\t$cadena_sql.=$prefijo.\"commerce.datos_cuenta BANKACCOUNT, \";\n\t\t\t\t$cadena_sql.=$prefijo.\"commerce.payment_hotel PAYMENTHOTEL, \";\n\t\t\t\t$cadena_sql.=$prefijo.\"commerce.payment_bank PAYMENTBANK, \";\n\t\t\t\t$cadena_sql.=$prefijo.\"commerce.payment_payu PAYMENTPAYU, \";\n\t\t\t\t$cadena_sql.=$prefijo.\"commerce.payment_davivienda PAYMENTDAVIVIENDA, \";\n\t\t\t\t$cadena_sql.=$prefijo.\"commerce.files_folder FOLDER, \";\n\t\t\t\t$cadena_sql.=$prefijo.\"commerce.imagen LOGO, \";\n\t\t\t\t$cadena_sql.=$prefijo.\"commerce.correo EMAIL \";\n\t\t\t\t$cadena_sql.=\"FROM \";\n\t\t\t\t$cadena_sql.=$prefijo.\"commerce \";\n\t\t\t\t$cadena_sql.=\"WHERE \";\n\t\t\t\t$cadena_sql.=$prefijo.\"commerce.id_tipoReserva ='\".$variable.\"' \";\n\t\t\t\tbreak;\n\n case \"getAdditionalFields\":\n\t\t\t\t$cadena_sql=\"SELECT \";\n\t\t\t\t$cadena_sql.=\"id_field IDFIELD, \";\n\t\t\t\t$cadena_sql.=\"name NAME \";\n\t\t\t\t$cadena_sql.=\"FROM \";\n\t\t\t\t$cadena_sql.=$prefijo.\"reserva_fields \";\n\t\t\t\t$cadena_sql.=\"WHERE \";\n\t\t\t\t$cadena_sql.=\" id_commerce='\".$variable[\"commerce\"].\"' \";\n $cadena_sql.=\"ORDER BY id_field ASC \";\n\t\t\t\tbreak;\n\n\t\t}\n\t\t//echo \"<br/><br/><br/>\".$tipo.\"=\".$cadena_sql;\n\t\treturn $cadena_sql;\n\n\t}" ]
[ "0.62165904", "0.6080373", "0.59947807", "0.5870859", "0.5832687", "0.5784368", "0.5756885", "0.57293993", "0.57280064", "0.5640402", "0.55528164", "0.5521277", "0.5479622", "0.5429577", "0.5407253", "0.5391274", "0.5389326", "0.5387009", "0.53830487", "0.53813696", "0.5365722", "0.53620416", "0.53576785", "0.535125", "0.53352773", "0.532297", "0.5320995", "0.5308397", "0.5271498", "0.5269238", "0.52650005", "0.52413815", "0.5240526", "0.5226284", "0.521945", "0.52100575", "0.5196962", "0.5193738", "0.51756805", "0.51754457", "0.51685137", "0.5157028", "0.5145862", "0.51209855", "0.5111652", "0.5107469", "0.5107205", "0.5105561", "0.5099069", "0.50831103", "0.5078742", "0.50687945", "0.5065228", "0.50573045", "0.5051247", "0.5051247", "0.5048952", "0.50481766", "0.50427616", "0.50360715", "0.5025686", "0.50254685", "0.5018522", "0.501514", "0.501245", "0.50082034", "0.5005653", "0.49992013", "0.49978185", "0.4984731", "0.49826002", "0.49821037", "0.49817175", "0.4978152", "0.4978035", "0.4977345", "0.49748862", "0.49727577", "0.49719417", "0.49705404", "0.4968794", "0.49669325", "0.49635553", "0.49577865", "0.49575627", "0.4945612", "0.49331164", "0.49322772", "0.49288744", "0.49279845", "0.49274915", "0.49220765", "0.49173385", "0.49132", "0.4901896", "0.48964816", "0.48962423", "0.489586", "0.48946425", "0.48904726" ]
0.7341497
0
Display a listing of the resource.
public function index() { return View::make('index'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function indexAction()\n {\n $limit = $this->Request()->getParam('limit', 1000);\n $offset = $this->Request()->getParam('start', 0);\n $sort = $this->Request()->getParam('sort', array());\n $filter = $this->Request()->getParam('filter', array());\n\n $result = $this->resource->getList($offset, $limit, $filter, $sort);\n\n $this->View()->assign($result);\n $this->View()->assign('success', true);\n }", "public function listing();", "function index() {\n\t\t$this->show_list();\n\t}", "public function actionList() {\n $this->_getList();\n }", "public function listAction()\n {\n $model = $this->_getPhotoModel();\n $entries = $model->fetchEntries($this->_getParam('page', 1));\n\n $this->view->url = 'http://' . $this->_request->getHttpHost() . $this->_request->getBaseUrl(); \n $this->view->paginator = $entries;\n }", "public function index()\n {\n $items = Item::all();\n return ItemForShowResource::collection($items);\n }", "public function index()\n {\n return Resource::collection(($this->getModel())::paginate(10));\n }", "function index()\n\t{\n\t\t$this->_list();\n\t\t$this->display();\n\t}", "public function listingAction(){\n if (!LoginHelper::isAdmin()){\n Router::redirect('home', '<p class=\"alert alert-danger\">Unauthorized</p>');\n }\n $this->view->render('patient/list', Patient::all());\n }", "public function index()\n {\n //\n $list = $this->obj->all();\n\n return $this->render('index', compact('list'));\n }", "public function action_index()\n\t{\n\t\t$this->template->title = 'Resources';\n\t\t$this->view = View::factory('admin/resource/index');\n\t\t$this->template->scripts[] = 'media/js/jquery.tablesorter.min.js';\n\t\t$this->template->scripts[] = 'media/js/admin/resource.js';\n\t\t\n\t\t$resources = Sprig::factory('resource')->load(NULL, FALSE);\n\t\tif (!empty($resources))\n\t\t{\n\t\t\t$this->view->resources = $resources->as_array();\n\t\t}\n\t}", "function listing()\n\t\t{\n\t\t// en $this->_view->_listado para poder acceder a el desde la vista.\n\t\t\t$this->_view->_listado = $listado = $this->_instrumentoModel->getInstrumento();\n\t\t\t$this->_view->render('listing', '', '',$this->_sidebar_menu);\n\t\t}", "public function listAction()\n {\n $em = $this->getDoctrine()->getManager();\n \n $todos = $em->getRepository(Todo::class)->findAll();\n \n return $this->render('todo/index.html.twig', array(\n 'todos' => $todos,\n ));\n }", "public function index()\n\t{\n $this->authorize('list', Instance::class);\n\n\t\treturn $this->ok($this->repo->paginate($this->request->all()));\n\t}", "public function actionRestList() {\n\t $this->doRestList();\n\t}", "public function listing()\n\t{\n\t\t$hospitalID = $this->request->getSession()->read(\"hospital_id\") ? $this->request->getSession()->read(\"hospital_id\") : \"\";\n\t\t\n\t\t$patientMonitored = 1;\n\t\t$patientActive = 1;\n\t\t\n\t\t//GET ALL PATIENTS\n\t\t$patientsData = $this->Patients->allPatients($hospitalID,$patientMonitored,$patientActive);\n\t\t//GET ALL PATIENTS\n\t\t\n\t\t//echo \"<pre>\"; print_r($patientsData);die;\n\t\t$this->set(compact(\"patientsData\"));\n\t}", "public function listAction()\n {\n $htmlpage = '<!DOCTYPE html>\n<html>\n <head>\n <meta charset=\"UTF-8\">\n <title>todos list!</title>\n </head>\n <body>\n <h1>todos list</h1>\n <p>Here are all your todos:</p>\n <ul>';\n \n $em = $this->getDoctrine()->getManager();\n $todos = $em->getRepository(Todo::class)->findAll();\n foreach($todos as $todo) {\n $htmlpage .= '<li>\n <a href=\"/todo/'.$todo->getid().'\">'.$todo->getTitle().'</a></li>';\n }\n $htmlpage .= '</ul>';\n\n $htmlpage .= '</body></html>';\n \n return new Response(\n $htmlpage,\n Response::HTTP_OK,\n array('content-type' => 'text/html')\n );\n }", "public function index()\n {\n // Get Persons\n $person = Person::paginate(10);\n\n //Return collection of person as a resource\n return PersonResource::collection($person);\n }", "public function listAction() {\n\t\t$this->view->title = $this->translator->translate(\"Invoice list\");\n\t\t$this->view->description = $this->translator->translate(\"Here you can see all the invoices.\");\n\t\t$this->view->buttons = array(array(\"url\" => \"/admin/invoices/new/\", \"label\" => $this->translator->translate('New'), \"params\" => array('css' => null)));\r\n\t\t$this->datagrid->setConfig ( Invoices::grid() )->datagrid ();\n\t}", "public function listAll()\n\t{\n\t\t$this->render(self::PATH_VIEWS . '/list', [\n\t\t\t'pages' => $this->pagesDb->findAll('id', 'DESC'),\n\t\t]);\n\t}", "public function list()\n {\n // récupérer les données : toutes les catégories enregistrées\n $productList = Product::findAll();\n\n $this->show('product/list', [\n 'productList' => $productList\n ]);\n }", "public function index()\n {\n // CRUD -> Retrieve --> List\n // BREAD -> Browse Read Edit Add Delete\n // return Item::all();\n return view('list_items',compact('items'));\n }", "public function index()\n {\n // Get manufacturers\n $manufacturers = Manufacturer::orderBy('created_at', 'desc')->paginate(15);\n\n // Return collection of manufacturers as a resource\n return ManufacturerResource::collection($manufacturers);\n }", "public function index()\n {\n return ArtistResource::collection(Artist::orderBy('created_at', 'desc')->get());\n }", "public function indexAction() {\n\t\t$page = intval($this->getInput('page'));\n\t\t$perpage = $this->perpage;\n\t\t\n\t\tlist(,$files) = Lock_Service_FileType::getAllFileType();\n\t\t$data = array();\n\t\tforeach ($files as $key=>$value) {\n\t\t\t$data[$key]['id'] = $value['id'];\n\t\t\t$data[$key]['title'] = $value['name'];\n\t\t}\n\t\tlist($total, $filetype) = Lock_Service_FileType::getList($page, $perpage);\n\t\t$this->assign('filetype', $filetype);\n\t\t$this->assign('pager', Common::getPages($total, $page, $perpage, $this->actions['listUrl'].'/?'));\n\t\t$this->assign('data', json_encode($data));\n\t}", "public function listAction()\n {\n $qb = $this->getRepository()->queryAll();\n\n $view = new ImportListView;\n $view->imports = $qb->getQuery()->execute();\n\n return $this->templating->renderResponse('InfiniteImportBundle:Import:list.html.twig', array(\n 'data' => $view\n ));\n }", "public function index()\n\t{\n\t\t//Return model all()\n\t\t$instances = $this->decorator->getListingModels();\n\n\t\treturn View::make($this->listingView, array(\n\t\t\t'instances' => $instances,\n\t\t\t'controller' => get_class($this), \n\t\t\t'modelName' => class_basename(get_class($this->decorator->getModel())),\n\t\t\t'columns' => $this->getColumnsForInstances($instances),\n\t\t\t'editable' => $this->editable\n\t\t));\n\t}", "public function index()\n {\n return InfografiResources::collection(\n Infografi::orderBy('date', 'desc')->get()\n );\n }", "public function listAction()\n\t {\n\t\t\t$this->_forward('index');\n \n\t\t}", "public function index()\n {\n $this->list_view();\n }", "public function index()\n {\n $this->list_view();\n }", "public function index()\n {\n $this->list_view();\n }", "public function listAction()\n {\n $defaults = array(\n 'page' => null,\n 'order' => null,\n 'limit' => null,\n 'offset' => null,\n 'filter' => array(),\n );\n $body = $this->getRequest()->getBody();\n $options = $body + $defaults;\n\n // Process the options\n if (is_string($options['order'])) {\n $options['order'] = array_map('trim', explode(',', $options['order']));\n }\n if (is_string($options['page'])) {\n $options['page'] = (int)$options['page'];\n }\n if (is_string($options['limit'])) {\n $options['limit'] = (int)$options['limit'];\n }\n if (is_string($options['offset'])) {\n $options['offset'] = (int)$options['offset'];\n }\n $filter = $options['filter'];\n unset($options['filter']);\n\n $options = array_filter($options);\n\n return $this->getBinding()->find($filter, $options);\n }", "public function index()\n {\n /* Check if logged in user is authorized to make this request */\n $this->authorizeAction();\n\n /* Get the resources from the model */\n $resources = $this->resourcesList($this->model);\n\n /* Sets the view */\n if (view()->exists(\"admin.{$this->name}.index\")) {\n $view = \"admin.{$this->name}.index\";\n } else {\n $view = 'admin.includes.actions.index';\n }\n\n /* Display a listing of the resources */\n return view($view)\n ->with('resources', $resources)\n ->with('module', $this->module);\n }", "public function index()\n\t{\n\t\t$data['lists'] = $this->mdl_student->get_all();\n\t\t$this->template->set('title', 'Student Hostel List');\n\t\t$this->template->load('template', 'contents', 'student_hostel/student_hostel_list', $data);\n\t}", "public function index()\n {\n $modules = Module::all();\n return Resource::collection($modules);\n }", "public function index()\n {\n // List all resources from user entity\n $users = User::all();\n\n return $this->showAll($users);\n }", "public function index()\n {\n // Get todos\n $todos = Todo::orderBy('created_at', 'desc')->paginate(3);\n\n // Return collection of articles as a resource\n return TodoResource::collection($todos);\n }", "public function index()\n {\n return Resources::collection(Checking::paginate());\n }", "public function index()\n {\n return CourseListResource::collection(\n Course::query()->withoutGlobalScope('publish')\n ->latest()->paginate()\n );\n }", "public function index()\n {\n $cars = Car::paginate(15);\n return CarResource::collection($cars);\n }", "public function index()\n {\n // Get articles\n $articles = Article::orderBy('created_at', 'desc')->paginate(5);\n\n // Return collection of articles as a resource\n return ArticleResource::collection($articles);\n }", "public function index()\n {\n $authors = Author::paginate(10);\n\n return AuthorResource::collection($authors);\n }", "public function index()\n {\n //Get Books\n $books = Book::paginate(10);\n \n if ($books) {\n return (BookResource::collection($books))->additional([\n 'status_code' => 200,\n 'status' => 'success',\n ]);\n } else {\n return (BookResource::collection([]))->additional([\n 'status_code' => 200,\n 'status' => 'success',\n ]);\n }\n return view('index')->with('data', $books);\n }", "public function view(){\n\t\t$this->buildListing();\n\t}", "public function index()\n {\n $books = Book::latest()\n ->paginate(20);\n\n return BookResource::collection($books);\n }", "public function index()\n {\n $listing = Listing::orderBy('id', 'desc')->paginate(10);\n return view('listings.index')->withListings($listing);\n }", "public function listAction()\n {\n $this->_getSession()->setFormData([]);\n\n $this->_title($this->__('Training Cms'))\n ->_title($this->__('Pages'));\n\n $this->loadLayout();\n\n $this->_setActiveMenu('training_cms');\n $this->_addBreadcrumb($this->__('Training Cms'), $this->__('Training Cms'));\n $this->_addBreadcrumb($this->__('Pages'), $this->__('Pages'));\n\n $this->renderLayout();\n }", "public function index()\n {\n $services = $this->serviceRepository->paginate();\n\n return ServiceResource::collection($services);\n }", "public function index()\n {\n $resources = ResourceManagement::paginate(5);\n $users = User::get();\n\n return view('resources-mgmt/index', ['resources' => $resources, 'users' => $users]);\n }", "public function index()\n {\n $catalogs = Catalog::where('status', '=', Catalog::PUBLICADO)\n ->orderBy('id', 'DESC')->get();\n \n $data = CatalogResource::collection($catalogs);\n\n return [\n 'items' => $data,\n 'mensaje' => ''\n ];\n }", "public function listAction(){\n // In a controller this can be:\n // $this->request->getQuery('page', 'int'); // GET\n $currentPage = $this->request->getPost('pageindex', 'int'); // POST\n $pageNum = ($currentPage == null) ? 1 : $currentPage;\n\n // The data set to paginate\n $message = new Notice();\n $results = $message->getMsg4Admin();\n\n // Create a Model paginator, show 10 rows by page starting from $currentPage\n $paginator = new PaginatorArray(\n array(\n \"data\" => $results,\n \"limit\" => 10,\n \"page\" => $pageNum\n )\n );\n\n // Get the paginated results\n $page = $paginator->getPaginate();\n\n return $this->response->setJsonContent($page);\n\n }", "public function list()\n {\n try {\n return $this->success($this->service->list());\n } catch (\\Exception $exception) {\n return $this->error($exception->getMessage());\n }\n }", "public function index()\n {\n return $this->sendResponse(CrisisResource::collection(Crisis::paginate(10)), 'Data fetched successfully');\n }", "public function index()\n\t{\n\t\t$%Alias = new %Model();\n\t\t$params = array();\n\t\t\n\t\t$Paginator = new Paginator( $%Alias->findSize( $params ), $this->getLimit(), $this->getPage() );\n\t\t$this->getView()->set( '%Aliass', $%Alias->findList( $params, 'Id desc', $this->getOffset(), $this->getLimit() ) );\n\t\t$this->getView()->set( 'Paginator', $Paginator );\n\t\treturn $this->getView()->render();\n\t}", "public function listAction() {}", "public function index()\n {\n\n return RecipeResource::collection(Recipe::all());\n }", "public function index()\n {\n $this->indexPage('list-product', 'List Product');\n }", "public function listAction()\n {\t\n\t\t$this->removeSession();\n\t\t$this->verifySessionRights();\n\t\t$this->setActivity(\"List view\");\n $em = $this->getDoctrine()->getManager();\n $oRepClient = $em->getRepository('BoAdminBundle:Client');\n\t\t$nb_tc = $oRepClient->getTotal();\n\t\t//get page\n\t\t$page = $this->get('session')->get('page');\n\t\tif($page==null){\n\t\t\t$page=1;\n\t\t\t$this->get('session')->set('page',1);\n\t\t}\n\t\t//get number line per page\n\t\t$nb_cpp = $em->getRepository('BoAdminBundle:Param')->getParam(\"display_list_page_number\",1);\n\t\t$nb_pages = ceil($nb_tc/$nb_cpp);\n\t\t$offset = $page>0?($page-1) * $nb_cpp:0;\n\t\t$clients = $em->getRepository('BoAdminBundle:Client')->findBy(array(),array('id' => 'desc'),$nb_cpp,$offset);\n $form = $this->createForm('Bo\\AdminBundle\\Form\\ClientType', new Client());\n return $this->render('client/index.html.twig', array(\n 'clients' => $clients,\n\t\t\t'page' => $page, // forward current page to view,\n\t\t\t'nb_pages' => $nb_pages, //total number page,\n 'form' => $form->createView(),\n\t\t\t'total'=>$nb_tc, // record number.\n\t\t\t'nb_cpp' => $nb_cpp,// line's number to display\n\t\t\t'pm'=>\"contracts\",\n\t\t\t'sm'=>\"client\",\n ));\n }", "public function index()\n {\n return AcResource::collection(Ac::latest()->paginate()); //\n }", "public function executeList()\n {\n $this->setTemplate('list');\n }", "public function indexAction()\n {\n $books = Book::getAll();\n\n View::renderTemplate('Books/index.html', [\n 'books' => $books\n ]);\n }", "function listing() {\r\n\r\n }", "public function listar() {\n $rs = $this->model->listar();\n\n echo $this->toJson($rs);\n }", "public function index()\n {\n return BookResource::collection(Book::orderby('id')->get());\n }", "public function doRestList()\n {\n $this->outputHelper( \n 'Records Retrieved Successfully', \n $this->getModel()->with($this->nestedRelations)->filter($this->restFilter)->orderBy($this->restSort)->limit($this->restLimit)->offset($this->restOffset)->findAll(),\n $this->getModel()->with($this->nestedRelations)->filter($this->restFilter)->count()\n );\n\t}", "public function index()\n {\n $client = Client::paginate();\n return ClientResource::collection($client);\n }", "public function index()\n {\n return TagResource::collection(\n Tag::orderBy('name', 'ASC')->paginate(request('per_page', 10))\n );\n }", "public function _index(){\n\t $this->_list();\n\t}", "public function index()\n\t{\n\t\t$data['lists'] = $this->gallery_mdl->get_all();\n\t\t$this->template->set('title', 'Gallery');\n\t\t$this->template->render('template', 'list', $data);\n\t}", "function drush_restapi_list() {\n\n $resources = restapi_get_resources();\n $last_module = NULL;\n $rows = [\n [dt('Module'), dt('Path'), dt('Class')],\n ];\n\n foreach($resources as $resource) {\n if ($last_module != $resource->getModule()) {\n $module = $last_module = $resource->getModule();\n }\n else {\n $module = '';\n }\n $rows[] = [$module, $resource->getPath(), $resource->getClass()];\n }\n\n drush_print_table($rows, TRUE);\n drush_log(dt('Displaying !count total resources', [\n '!count' => count($resources),\n ]), 'ok');\n\n}", "public function index()\n {\n $this->booklist();\n }", "public function index()\n {\n //\n $accounts = accounts::paginate(15);\n\n //return the collection of employees as a resource\n return accountResource::collection($accounts);\n\n\n }", "public function index()\n {\n $items = Item::all();\n return view('items::list_items',compact('items'));\n }", "public function index()\n {\n // Get houses\n $houses = House::orderBy('created_at', 'desc')->paginate(self::PAGINATE);\n \n // Return collection of houses\n \n return HouseResource::collection($houses);\n }", "public function index()\n {\n $products = Product::paginate(6);\n return ProductResource::collection($products);\n }", "public function index() {\n $this->template->allFoundItems = Found::showAll();\n $this->template->display( 'index.html.php' );\n }", "public function indexAction() {\n $this->_forward('list');\n }", "public function index()\n {\n $data = Productcategory::paginate(10);\n\t\treturn ProductcategoryResource::Collection($data);\n }", "public function index()\n {\n return SongResource::collection(\\App\\Song::orderBy('created_at', 'desc')->get());\n }", "public function ListView()\n\t{\n\t\t\n\t\t// Requer permissão de acesso\n\t\t$this->RequirePermission(Usuario::$P_ADMIN,\n\t\t\t\t'SecureExample.LoginForm',\n\t\t\t\t'Autentique-se para acessar esta página',\n\t\t\t\t'Você não possui permissão para acessar essa página ou sua sessão expirou');\n\t\t\n\t\t//$usuario = Controller::GetCurrentUser();\n\t\t//$this->Assign('usuario',$usuario);\n\t\t$this->Render();\n\t}", "public function index () {\n permiss ( 'role.list' );\n\n $data = $this->entity\n ->orderBy('created_at', 'desc')->get();\n\n return new ModelResource($data);\n }", "public function showResources()\n {\n $resources = Resource::get();\n return view('resources', compact('resources'));\n }", "public function index()\n {\n //get articless\n $articles = Article::paginate(15);\n\n //Return collection of article has a resource\n return ArticleResource::collection($articles);\n\n }", "public function actionList() {\n header(\"Content-type: application/json\");\n $verb = $_SERVER[\"REQUEST_METHOD\"];\n\n if ($verb === 'GET') {\n echo \"{\\\"data\\\":\" . CJSON::encode(Donneur::model()->findAll()) . \"}\";\n } else if ($verb == 'POST') {\n if (Donneur::model()->exists('id' === $_POST['id'])) {\n $this->actionListUpdate($_POST);\n } else {\n $this->actionListPost();\n }\n } else if ($verb == 'DELETE') {\n $this->actionListDelete();\n }\n }", "public function list()\n {\n return $this->http->request(HttpMethods::GET, $this->endpoint);\n }", "public function indexAction(){\n $data = array(\n 'collection' => $this->model->getCollection(),\n \n ); \t\n return $this->getView($data);\n }", "public function indexAction()\n {\n $em = $this->getDoctrine()->getManager();\n\n $entities = $em->getRepository('DiverPriceLisrBundle:Items')->findAll();\n\n return $this->render('DiverPriceLisrBundle:Items:index.html.twig', array(\n 'entities' => $entities,\n ));\n }", "public function actionIndex()\n {\n $dataProvider = new ActiveDataProvider([\n 'query' => Slaves::find(),\n ]);\n\n return $this->render('index', [\n 'dataProvider' => $dataProvider,\n ]);\n }", "public function listAction() {\n\t\t// Recogemos el repositorio\n\t\t$repository = $this->getDoctrine() ->getRepository('AppBundle:Product');\n\t\n\t\t// Recuperamos todos los productos.\n\t\t$products = $repository->findAll();\n\t\t// Pasamos a la plantilla el aray products\n\t\treturn $this->render('product/listActionProduct.html.twig', array( 'products' => $products));\n\t\n\t}", "public function listAction()\n\t {\n\t\t$model = $this->_getModel();\n\t\t$result = $model->getLayouts();\t\n\t\t$page = (int)($this->_request->getParam('page')); \n\t\tif(count($result) > 0)\n\t\t{ \n\t\t\tGlobals::doPaging($result, $page, $this->view);\n\t\t}\n\t\t\t\t\n\t\t$this->view->page = $page;\n\t }", "public function actionList()\n {\n // get model\n $model = new $this->_model('search');\n $model->unsetAttributes();\n\n // set filter\n if (isset($_GET[$this->_model])) {\n $model->attributes = $_GET[$this->_model];\n }\n $model->u_cms_album_id = $_GET['album'];\n\n // search\n $dataProvider = $model->search(Yii::app()->language);\n // sort\n $sort = $dataProvider->getSort();\n // route\n $sort->route = $this->id . '/list';\n\n // pagination parameters\n $pagination = $dataProvider->getPagination();\n $pagination->route = $this->id . '/list';\n $pagination->pageSize = UInterfaceSetting::model()->getSettings($this->id . ':' . $this->module->id, Yii::app()->user->id)->page_size;\n $pagination->itemCount = $dataProvider->totalItemCount;\n\n // datas\n $datas = $dataProvider->getData();\n\n // related datas\n $relatedDatas = $this->_loadRelatedData();\n\n // template\n $template = isset($_REQUEST['partial']) ? 'list/_table' : 'list/main';\n\n $jsonParams = array();\n if (Yii::app()->request->isAjaxRequest) {\n // filters\n $filtersDatas = array();\n if (isset($_GET[$this->_model])) {\n $filtersDatas[$this->_model] = $_GET[$this->_model];\n }\n if (isset($_GET[$sort->sortVar])) {\n $filtersDatas[$sort->sortVar] = $_GET[$sort->sortVar];\n }\n\n $jsonParams = array(\n 'filters' => http_build_query($filtersDatas)\n );\n }\n\n $this->dynamicRender(\n $template,\n array(\n 'dataView' => new $this->crudComponents['listDataView'](\n $datas, $relatedDatas, $model, $sort, $pagination, $this\n )\n ),\n $jsonParams\n );\n }", "public function index()\n {\n return view('listings.index')->with('listings', Listing::all());\n }", "public function get_index()\n\t{\n\t\t$pages = Page::recent_available()->paginate(30);\n\t\t$table = Cello\\Presenter\\Page::table($pages);\n\t\t$data = array(\n\t\t\t'eloquent' => $pages,\n\t\t\t'table' => $table,\n\t\t);\n\n\t\tSite::set('title', __('cello::title.pages.list'));\n\n\t\treturn View::make('cello::api.resources.index', $data);\n\t}", "public function index()\n {\n return ProductResource::collection(Product::latest()->paginate(10));\n }", "public function index()\n {\n $category = GalleryCategory::paginate(15);\n\n // return collection of category as a resource.\n return Resource::collection($category);\n }", "public function index()\n {\n //\n $news = News::latest()->paginate(18);\n\n return NewsResource::collection($news);\n }", "public function indexAction() {\n\t\t$list_info = Zend_Registry::get('list_info');\n if (!Engine_Api::_()->core()->hasSubject('list_listing')) {\n return $this->setNoRender();\n }\n \n $this->view->expiry_setting = Engine_Api::_()->list()->expirySettings();\n\n //GET SUBJECT\n $this->view->list = $list = Engine_Api::_()->core()->getSubject('list_listing');\n\n\t\t//GET CATEGORY TABLE\n\t\t$this->view->tableCategory = Engine_Api::_()->getDbTable('categories', 'list');\n\n //GET CATEGORIES NAME\n\t\t$this->view->category_name = $this->view->subcategory_name = $this->view->subsubcategory_name = '';\n\n\t\tif(!empty($list->category_id)) {\n\t\t\tif($this->view->tableCategory->getCategory($list->category_id))\n\t\t\t$this->view->category_name = $this->view->tableCategory->getCategory($list->category_id)->category_name;\n\n\t\t\tif(!empty($list->subcategory_id)) {\n\t\t\t\tif($this->view->tableCategory->getCategory($list->subcategory_id))\n\t\t\t\t$this->view->subcategory_name = $this->view->tableCategory->getCategory($list->subcategory_id)->category_name;\n\n\t\t\t\tif(!empty($list->subsubcategory_id)) {\n\t\t\t\t\tif($this->view->tableCategory->getCategory($list->subsubcategory_id))\n\t\t\t\t\t$this->view->subsubcategory_name = $this->view->tableCategory->getCategory($list->subsubcategory_id)->category_name;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n //GET LISTING TAGS\n $this->view->listTags = $list->tags()->getTagMaps();\n\n\t\t//GET OTHER DETAILS\n\t\t$this->view->list_description = Zend_Registry::get('list_descriptions');\n $this->view->addHelperPath(APPLICATION_PATH . '/application/modules/Fields/View/Helper', 'Fields_View_Helper');\n $this->view->fieldStructure = Engine_Api::_()->fields()->getFieldsStructurePartial($list);\n\t\tif(empty($list_info)){ return $this->setNoRender(); }\n }", "public function index()\n {\n return $this->service->fetchResources(Author::class, 'authors');\n }", "public function index()\n {\n return view('admin.resources.index');\n }", "public function doRestList() {\n\t\t$this->outputHelper ( 'Collections Retrieved Successfully', $this->getModel ()->with ( $this->nestedRelations )->filter ( $this->restFilter )->orderBy ( $this->restSort )->limit ( $this->restLimit )->offset ( $this->restOffset )->findAll (), $this->getModel ()->with ( $this->nestedRelations )->filter ( $this->restFilter )->count () );\n\t}" ]
[ "0.7446777", "0.736227", "0.73005503", "0.72478926", "0.71631265", "0.71489686", "0.7131636", "0.7105969", "0.71029514", "0.7101372", "0.70508176", "0.6995128", "0.69890636", "0.6934895", "0.6900203", "0.6899281", "0.6891734", "0.6887235", "0.68670005", "0.6849741", "0.6830523", "0.6802689", "0.6797", "0.67957735", "0.67871135", "0.6760129", "0.67427456", "0.6730486", "0.67272323", "0.67255723", "0.67255723", "0.67255723", "0.67177945", "0.6707866", "0.6706713", "0.6704375", "0.6664782", "0.6662871", "0.6660302", "0.6659404", "0.6656656", "0.6653517", "0.6647965", "0.6620322", "0.66185474", "0.6618499", "0.6606105", "0.6600617", "0.65996987", "0.6594775", "0.6587389", "0.6585109", "0.6581641", "0.6581017", "0.6577157", "0.65747666", "0.6572513", "0.65721947", "0.6570553", "0.65646994", "0.6563556", "0.6554194", "0.65529937", "0.65460825", "0.65368485", "0.653429", "0.65328294", "0.6526759", "0.6526695", "0.6526284", "0.65191334", "0.65183175", "0.65174305", "0.651703", "0.65141153", "0.6507088", "0.65061647", "0.6504046", "0.64942145", "0.6491893", "0.64883405", "0.6486392", "0.6485077", "0.64846045", "0.6478858", "0.64756656", "0.64726377", "0.6471126", "0.64701074", "0.6467418", "0.6462195", "0.64618355", "0.6459199", "0.6457831", "0.6454631", "0.64533997", "0.6451915", "0.6450861", "0.6449301", "0.64492667", "0.64469045" ]
0.0
-1
Show the form for creating a new resource.
public function create() { // }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function create()\n {\n return $this->showForm('create');\n }", "public function create()\n {\n return $this->showForm('create');\n }", "public function create()\n {\n return view('admin.resources.create');\n }", "public function create(){\n\n return view('resource.create');\n }", "public function create()\n\t{\n\t\treturn $this->showForm('create');\n\t}", "public function create()\n {\n return \"Display a form for creating a new catalogue\";\n }", "public function newAction()\n {\n $entity = new Resource();\n $current = $this->get('security.context')->getToken()->getUser();\n $entity->setMember($current);\n $form = $this->createCreateForm($entity);\n\n return array(\n 'nav_active'=>'admin_resource',\n 'entity' => $entity,\n 'form' => $form->createView(),\n );\n }", "public function create()\n {\n return view ('forms.create');\n }", "public function create ()\n {\n return view('forms.create');\n }", "public function create()\n\t{\n\t\treturn view('faith.form');\n\t}", "public function create(NebulaResource $resource): View\n {\n $this->authorize('create', $resource->model());\n\n return view('nebula::resources.create', [\n 'resource' => $resource,\n ]);\n }", "public function create()\n {\n return view(\"request_form.form\");\n }", "public function create()\n {\n /* Check if logged in user is authorized to make this request */\n $this->authorizeAction();\n\n /* Sets the view */\n if (view()->exists(\"admin.{$this->name}.create\")) {\n $view = \"admin.{$this->name}.create\";\n } else {\n $view = 'admin.includes.actions.create';\n }\n\n /* Show the form for creating a new resource. */\n return view($view)\n ->with('name', $this->name);\n }", "public function newAction()\n\t{\n\t\t$this->render( View::make( 'schools/form' , array(\n\t\t\t'title' => 'Ajouter une nouvelle &eacute;cole'\n\t\t) ) );\n\t}", "public function create()\n {\n return view($this->forms . '.create');\n }", "public function create()\n {\n return view('restful.add');\n }", "public function create()\n {\n $resource = (new AclResource())->AclResource;\n\n //dd($resource);\n return view('Admin.acl.role.form', [\n 'resource' => $resource\n ]);\n }", "public function create()\n {\n return view('admin.createform');\n }", "public function create()\n {\n return view('admin.forms.create');\n }", "public function create()\n {\n return view('backend.student.form');\n }", "public function newAction()\n {\n $breadcrumbs = $this->get(\"white_october_breadcrumbs\");\n $breadcrumbs->addItem('Inicio', $this->get('router')->generate('admin.homepage'));\n $breadcrumbs->addItem($this->entityDescription, $this->get(\"router\")->generate(\"admin.$this->entityName.index\"));\n $breadcrumbs->addItem('Nuevo');\n\n $entity = $this->getManager()->create();\n $form = $this->getForm($entity);\n\n return $this->render('AdminBundle:Default:new.html.twig', array(\n 'entity' => $entity,\n 'form' => $form->createView(),\n 'metadata' => $this->getMetadata()\n ));\n }", "public function create()\n {\n return view('client.form');\n }", "public function create()\n {\n // Nos regresa la vista del formulario\n return view('project.form');\n }", "public function create()\n {\n return view('Form');\n }", "public function newAction(){\n \n $entity = new Resourceperson();\n $form = $this->createAddForm($entity);\n\n \n return $this->render('ABCRspBundle:rsp:add.html.twig',array('entity'=>$entity,'form'=> $form->createView()));\n }", "public function createForm()\n\t{\n\t\treturn view('post.new');\n\t}", "public function create()\n {\n return view('admin.form.create', ['form' => new Form]);\n }", "public function create()\n {\n return view('form');\n }", "public function create()\n {\n return view('form');\n }", "public function create()\n {\n return view('form');\n }", "public function create()\n {\n $title = $this->title;\n $subtitle = \"Adicionar cliente\";\n\n return view('admin.clients.form', compact('title', 'subtitle'));\n }", "public function create()\n {\n return view('backend.schoolboard.addform');\n }", "public function create()\n\t{\n\t\treturn view('info.forms.createInfo');\n\t}", "public function create()\n {\n return view('rests.create');\n }", "public function create()\n {\n //\n return view('form');\n }", "public function create()\n {\n return $this->showForm();\n }", "public function create()\n {\n return $this->showForm();\n }", "public function create()\n {\n return view(\"Add\");\n }", "public function create()\n {\n // Show the page\n return view('admin.producer.create_edit');\n }", "public function create(){\n return view('form.create');\n }", "public function create()\n {\n\n return view('control panel.student.add');\n\n }", "public function newAction() {\n\t\t\n\t\t$this->view->form = $this->getForm ( \"/admin/invoices/process\" );\n\t\t$this->view->title = $this->translator->translate(\"New Invoice\");\n\t\t$this->view->description = $this->translator->translate(\"Create a new invoice using this form.\");\n\t\t$this->view->buttons = array(array(\"url\" => \"#\", \"label\" => $this->translator->translate('Save'), \"params\" => array('css' => null,'id' => 'submit')),\r\n\t\t\t\t\t\t\t array(\"url\" => \"/admin/invoices/list\", \"label\" => $this->translator->translate('List'), \"params\" => array('css' => null)));\n\t\t$this->render ( 'applicantform' );\n\t}", "public function create()\n {\n $data['action'] = 'pengiriman.store';\n return view('pengiriman.form', $data);\n }", "public function create()\n {\n return $this->cView(\"form\");\n }", "public function newAction()\n {\n // Création de l'entité et du formulaire.\n $client = new Client();\n $formulaire = $this->createForm(new ClientType(), $client);\n \n \n \n // Génération de la vue.\n return $this->render('KemistraMainBundle:Client:new.html.twig',\n array('formulaire' => $formulaire->createView()));\n }", "public function create()\n {\n return view(\"dresses.form\");\n }", "public function create()\n\t{\n\t\treturn View::make('new_entry');\n\t}", "public function createAction()\n {\n// $this->view->form = $form;\n }", "public function create()\n {\n return view('bank_account.form', ['mode' => 'create']);\n }", "public function create()\n {\n return view('fish.form');\n }", "public function create()\n {\n return view('users.forms.create');\n }", "public function create()\n {\n $this->setFormFields($this->getCreateFormFields());\n $form = $this->getCreateForm();\n\n return view($this->getViewName('create'), [\n 'crudSlug' => $this->slug,\n 'form' => $form,\n ]);\n }", "public function create()\n\t{\n\t\treturn view('admin.estadoflete.new');\n\t}", "public function create()\n {\n $person = new Person;\n return view('contents.personform')->with(compact('person') );\n }", "public function createAction(){\n \t$this->view->placeholder('title')->set('Create');\n \t$this->_forward('form');\n }", "public function create()\n {\n Gate::authorize('app.products.create');\n\n return view('backend.products.form');\n }", "public function create()\n {\n return view('essentials::create');\n }", "public function create()\n {\n return view('student.add');\n }", "public function create()\n\t{\n\t\treturn view('loisier/create');\n\t}", "public function create()\n {\n return view('url.form');\n }", "public function newAction()\n {\n $entity = new Facture();\n $factureType = new FactureType();\n\t\t$factureType->setUser($this->get('security.context')->getToken()->getUser());\n $form = $this->createForm($factureType, $entity);\n\n return $this->render('chevPensionBundle:Facture:new.html.twig', array(\n 'entity' => $entity,\n 'form' => $form->createView(),\n ));\n }", "public function newAction()\n {\n $entity = new Chofer();\n $form = $this->createForm(new ChoferType(), $entity, ['user' => $this->getUser()]);\n\n return $this->render('ChoferesBundle:Chofer:new.html.twig', array(\n 'entity' => $entity,\n 'form' => $form->createView(),\n 'css_active' => 'chofer',\n ));\n }", "public function create()\n\t{\n\t\treturn View::make('crebos.create');\n\t}", "public function create() : View\n {\n $fieldset = $this->menuFieldset();\n\n return $this->view('create', [\n 'title' => trans('addons.Aardwolf::titles.create'),\n 'data' => [],\n 'fieldset' => $fieldset->toPublishArray(),\n 'suggestions' => [],\n 'submitUrl' => route('aardwolf.postCreate')\n ]);\n }", "public function create()\n {\n return view('libro.create');\n }", "public function create()\n {\n return view('libro.create');\n }", "public function newAction()\n {\n $entity = new Species();\n $form = $this->createForm(new SpeciesType(), $entity);\n\n return $this->render('InfectBackendBundle:Species:new.html.twig', array(\n 'entity' => $entity,\n 'form' => $form->createView(),\n ));\n }", "public function create()\n {\n return view('crud/add'); }", "public function create()\n\t{\n\t\treturn View::make('supplier.create');\n\t}", "public function newAction()\n {\n $entity = new Company();\n $form = $this->createForm(new CompanyType(), $entity);\n\n return $this->render('SiteSavalizeBundle:Company:new.html.twig', array(\n 'entity' => $entity,\n 'form' => $form->createView(),\n ));\n }", "public function create()\n {\n return view(\"List.form\");\n }", "public function index_onCreateForm()\n\t{\n\t\tparent::create();\n\t\treturn $this->makePartial('create');\n\t}", "public function create()\n {\n //load create form\n return view('products.create');\n }", "public function create()\n {\n return view('article.addform');\n }", "public function create()\n {\n // Mengarahkan ke halaman form\n return view('buku.form');\n }", "public function create()\n\t{\n\t\t// load the create form (app/views/material/create.blade.php)\n\t\t$this->layout->content = View::make('material.create');\n\t}", "public function create()\n {\n return view('saldo.form');\n }", "public function create()\n\t\t{\n\t\t\treturn view('kuesioner.create');\n\t\t}", "public function view_create_questioner_form() {\n \t// show all questioner\n \t// send questioner to form\n \treturn view(\"create_questioner\");\n }", "public function newAction() {\n $entity = new Question();\n $form = $this->createCreateForm($entity);\n\n return $this->render('CdlrcodeBundle:Question:new.html.twig', array(\n 'entity' => $entity,\n 'form' => $form->createView(),\n ));\n }", "public function create()\n {\n $data['companies'] = Company::select('id', 'name')->where('status', 1)->orderBy('id', 'desc')->get();\n return view('admin.outlet.outlet_form', $data);\n }", "public function create()\n {\n return view('admin.inverty.add');\n }", "public function create()\n {\n return view('Libro.create');\n }", "public function create()\n {\n $breadcrumb='car.create';\n return view('admin.partials.cars.form', compact('breadcrumb'));\n }", "public function create()\n {\n $title = trans('entry_mode.new');\n return view('layouts.create', compact('title'));\n }", "public function create()\n {\n return view(\"familiasPrograma.create\");\n }", "public function create()\n {\n return view('admin.car.create');\n }", "public function create()\n {\n return view('admin.car.create');\n }", "public function create()\n\t{\n\t\treturn View::make('perusahaans.create');\n\t}", "public function create()\n {\n return view(\"create\");\n }", "public function create()\n\t{\n //echo 'show form';\n\t\treturn View::make('gaans.create');\n\t}", "public function create()\n {\n $title = trans('dormitorybed.new');\n $this->generateParams();\n\n return view('layouts.create', compact('title'));\n }", "public function create()\n {\n return view('forming');\n }", "public function formNew() {\n $this->data->options = array(\n 'RJ' => 'Rio de Janeiro',\n 'MG' => 'Minas Gerais',\n 'SP' => 'São Paulo',\n 'ES' => 'Espírito Santo',\n 'BA' => 'Bahia',\n 'RS' => 'Rio Grande do Sul'\n );\n $this->data->action = \"@exemplos/pessoa/save\";\n $this->render();\n }", "public function create()\n {\n \t\n \treturn view('supplies.create');\n\n }", "public function create()\n {\n $page_title = \"Add New\";\n return view($this->path.'create', compact('page_title'));\n }", "public function createAction()\n {\n if ($form = $this->processForm()) {\n $this->setPageTitle(sprintf($this->_('New %s...'), $this->getTopic()));\n $this->html[] = $form;\n }\n }", "public function create() {\n\t\t$title = 'Create | Show';\n\n\t\treturn view('admin.show.create', compact('title'));\n\t}", "public function newAction(){\n\t\t$entity = new Reserva();\n\t\t$form = $this->createCreateForm($entity);\n\n\t\treturn $this->render('LIHotelBundle:Reserva:new.html.twig', array(\n\t\t\t'entity' => $entity,\n\t\t\t'form' => $form->createView(),\n\t\t));\n\t}", "public function create()\n {\n // not sure what to do with the form since im\n // using ame partial for both create and edit\n return view('plants.create')->with('plant', new Plant);\n }", "public function create()\n {\n return view('student::students.student.create');\n }" ]
[ "0.7593198", "0.7593198", "0.75881755", "0.75787884", "0.7570936", "0.74992913", "0.7436037", "0.7431172", "0.7386512", "0.7351077", "0.7337819", "0.73100585", "0.7295612", "0.72803086", "0.7272473", "0.72422874", "0.7229479", "0.7224403", "0.7184453", "0.7177193", "0.7173551", "0.71482", "0.71424824", "0.7141885", "0.7135663", "0.7126202", "0.7121413", "0.7113729", "0.7113729", "0.7113729", "0.7110717", "0.7092118", "0.7083616", "0.7080794", "0.7078082", "0.70561296", "0.70561296", "0.7054459", "0.703925", "0.70373696", "0.70346737", "0.70324355", "0.70287114", "0.7025425", "0.7025232", "0.7018496", "0.7016745", "0.7002774", "0.70019513", "0.69991785", "0.69942427", "0.69936013", "0.69929653", "0.6988009", "0.69856364", "0.6965122", "0.6964889", "0.6955187", "0.69511235", "0.69497", "0.6947041", "0.69432163", "0.6940678", "0.6939846", "0.6936846", "0.6936846", "0.6936506", "0.6933589", "0.69309", "0.69273484", "0.6925485", "0.6921386", "0.6917649", "0.6913987", "0.6910826", "0.6909406", "0.69085246", "0.6907409", "0.69021183", "0.6900961", "0.68997645", "0.68991655", "0.6894049", "0.68920606", "0.6892033", "0.6891114", "0.6890811", "0.6890811", "0.6887868", "0.6887327", "0.68854356", "0.688366", "0.68805534", "0.68766564", "0.68753666", "0.6872474", "0.68717086", "0.6869974", "0.6869806", "0.6868809", "0.68685615" ]
0.0
-1
Store a newly created resource in storage.
public function store() { if(Auth::check()) { // && Request::ajax() $user = Auth::user(); $date = new \DateTime; $score = new Score; $score->score = Input::get('score'); $score->user_id = $user->id; $score->created_at = $date; $score->updated_at = $date; $score->save(); return 1; } return 0; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function store($data, Resource $resource);", "public function store()\n {\n /* Check if logged in user is authorized to make this request */\n $this->authorizeAction();\n\n if (method_exists($this, 'storeValidations')) {\n $this->request->validate($this->storeValidations());\n }\n\n /* Create a new resource */\n $resource = $this->model::create(Input::all());\n\n /* Redirect to newly created resource page */\n return redirect()\n ->route($this->name . '.edit', $resource->id)\n ->with(\n 'success',\n Lang::has($this->name . '.resource-created') ?\n $this->name . '.resource-created' :\n 'messages.alert.resource-created'\n );\n }", "public function store(CreateStorageRequest $request)\n {\n $this->storage->create($request->all());\n\n return redirect()->route('admin.product.storage.index')\n ->withSuccess(trans('core::core.messages.resource created', ['name' => trans('product::storages.title.storages')]));\n }", "public function createStorage();", "public function store(StoreStorage $request)\n {\n $storage = Storage::create($request->all());\n $request->session()->flash('alert-success', 'Запись успешно добавлена!');\n return redirect()->route('storage.index');\n }", "public function saveShopifyResource() {\n if (is_null($this->getShopifyId())) { // if there is no id...\n $this->createShopifyResource(); // create a new resource\n } else { // if there is an id...\n $this->updateShopifyResource(); // update the resource\n }\n }", "public function store(Request $request, NebulaResource $resource): RedirectResponse\n {\n $this->authorize('create', $resource->model());\n\n $validated = $request->validate($resource->rules(\n $resource->createFields()\n ));\n\n $resource->storeQuery($resource->model(), $validated);\n\n $this->toast(__(':Resource created', [\n 'resource' => $resource->singularName(),\n ]));\n\n return redirect()->back();\n }", "function storeAndNew() {\n $this->store();\n }", "public function store(Request $request)\n {\n $currentUser = JWTAuth::parseToken()->authenticate();\n $validator = Validator::make($request->all(), [\n 'content' => 'required|string',\n 'image_link' => 'sometimes|url',\n ]);\n\n if ($validator->fails()) {\n return APIHandler::response(0, $validator->errors(), [], 400);\n }\n\n $resource = new Resource;\n $resource->user_id = $currentUser['id'];\n $resource->title = $request->get('title');\n $resource->content = $request->get('content');\n $resource->image_link = $request->get('imageLink');\n $resource->video_link = $request->get('videoLink');\n $resource->file_link = $request->get('fileLink');\n $resource->audio_link = $request->get('audioLink');\n $resource->tags = collect($request->get('tags'))->implode('text', ',');\n $resource->is_public = 0;\n $resource->save();\n $data['resource'] = $resource;\n\n if ($request->get('programId')) {\n $this->addToProgram($resource, $request->programId);\n // event(new NewLearningPathResourcePublished($resource, $invitee));\n }\n\n User::find($currentUser['id'])->increment('points', 2);\n\n return APIHandler::response(1, \"New resource has been created\", $data, 201);\n }", "public function store()\n {\n if (!$this->id) { // Insert\n $this->insertObject();\n } else { // Update\n $this->updateObject();\n }\n }", "public function store()\n\t{\n\t\t\n\t\t//\n\t}", "public function store()\r\n\t{\r\n\t\t//\r\n\t}", "public function store()\r\n\t{\r\n\t\t//\r\n\t}", "public function store()\r\n\t{\r\n\t\t//\r\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}" ]
[ "0.72865677", "0.7145327", "0.71325725", "0.6640912", "0.66209733", "0.65685713", "0.652643", "0.65095705", "0.64490104", "0.637569", "0.63736665", "0.63657933", "0.63657933", "0.63657933", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437" ]
0.0
-1
Display the specified resource.
public function show($id) { // }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function show(Resource $resource)\n {\n // not available for now\n }", "public function show(Resource $resource)\n {\n //\n }", "function Display($resource_name, $cache_id = null, $compile_id = null)\n {\n $this->_smarty->display($resource_name, $cache_id, $compile_id);\n }", "private function showResourceable($resourceable)\n {\n save_resource_url();\n\n return $this->view('resources.create_edit')\n ->with('resource', $resourceable)\n ->with('photos', $resourceable->photos)\n ->with('videos', $resourceable->videos)\n ->with('documents', $resourceable->documents);\n }", "function display($resource_name, $cache_id = null, $compile_id = null) {\n\t\t$this->_getResourceInfo($resource_name); // Saves resource info to a Smarty class var for debugging\n\t\t$_t3_fetch_result = $this->fetch($resource_name, tx_smarty_div::getCacheID($cache_id), $compile_id);\n if ($this->debugging) { // Debugging will have been evaluated in fetch\n require_once(SMARTY_CORE_DIR . 'core.display_debug_console.php');\n $_t3_fetch_result .= smarty_core_display_debug_console(array(), $this);\n }\n\t\treturn $_t3_fetch_result;\n\t}", "public function show(ResourceSubject $resourceSubject)\n {\n //\n }", "public function show(ResourceManagement $resourcesManagement)\n {\n //\n }", "public function viewEditResources()\n {\n $database = new Database();\n $id = $this->_params['id'];\n\n $resource = $database->getResourceById($id);\n\n $availableResource = new Resource($resource['ResourceID'], $resource['ResourceName'], $resource['Description']\n , $resource['ContactName'] , $resource['ContactEmail'] , $resource['ContactPhone'] ,\n $resource['Link'], $resource['active']);\n $this->_f3->set('Resource', $availableResource);\n\n echo Template::instance()->render('view/include/head.php');\n echo Template::instance()->render('view/include/top-nav.php');\n echo Template::instance()->render('view/edit-resources.php');\n echo Template::instance()->render('view/include/footer.php');\n }", "public function retrieve(Resource $resource);", "public function showResource($resouceable, $id)\n {\n $model_name = str_replace('-', ' ',ucwords($resouceable));\n $model_name = str_replace(' ', '',ucwords($model_name));\n\n $resource_type = 'App\\Models\\\\'.$model_name;\n $model = app($resource_type);\n $model = $model->find($id);\n\n return $this->showResourceable($model);\n }", "public function showAction(Ressource $ressource)\n {\n $deleteForm = $this->createDeleteForm($ressource);\n\n return $this->render('ressource/show.html.twig', array(\n 'ressource' => $ressource,\n 'delete_form' => $deleteForm->createView(),\n ));\n }", "public function show(Dispenser $dispenser)\n {\n //\n }", "public function show($id)\n {\n $resource = Resource::find($id);\n dd($resource);\n }", "public function displayAction() {\n\t\tif(is_numeric($this->req_id)) {\n\t\t\tAPI::DEBUG(\"[DefaultController::displayAction()] Getting \" . $this->req_id, 1);\n\t\t\t$this->_view->data['info'] = $this->_model->get($this->req_id);\n\t\t\t$this->_view->data['action'] = 'edit';\n\n\t\t} else {\n\t\t\t$this->_view->data['action'] = 'new';\n\t\t}\n\t\t// auto call the hooks for this module/action\n\t\terror_log(\"Should Call: \" . $this->module .\"/\".$this->action.\"/\".\"controller.php\");\n\t\tAPI::callHooks($this->module, $this->action, 'controller', $this);\n\n\t\t$this->addModuleTemplate($this->module, 'display');\n\n\t}", "public function show(NebulaResource $resource, $item): View\n {\n $this->authorize('view', $item);\n\n return view('nebula::resources.show', [\n 'resource' => $resource,\n 'item' => $item,\n ]);\n }", "public function resource(string $resource, string $controller): void\n {\n $base = $this->plural($resource);\n $entity = '/{'.$resource.'}';\n\n $this->app->get($base, $controller.'@index');\n $this->app->post($base, $controller.'@store');\n $this->app->get($base.$entity, $controller.'@show');\n $this->app->patch($base.$entity, $controller.'@update');\n $this->app->delete($base.$entity, $controller.'@destroy');\n }", "function displayCustom($resource_name, $cache_id = null, $compile_id = null)\n\t{\n\t return $this->display(DotbAutoLoader::existingCustomOne($resource_name), $cache_id, $compile_id);\n\t}", "public function show($id)\n {\n /* Check if logged in user is authorized to make this request */\n $this->authorizeAction();\n\n /* Get the specified resource */\n $resource = $this->model::findOrFail($id);\n\n /* Sets the view */\n if (view()->exists(\"admin.{$this->name}.show\")) {\n $view = \"admin.{$this->name}.show\";\n } else {\n $view = 'admin.includes.actions.show';\n }\n\n /* Displays the specified resource page */\n return view($view)\n ->with('resource', $resource)\n ->with('name', $this->name);\n }", "public function show($id)\n {\n $currentUser = JWTAuth::parseToken()->authenticate();\n $rules = [\n 'id' => 'required|integer'\n ];\n\n $validator = Validator::make(['id' => $id], $rules);\n if ($validator->fails()) {\n return APIHandler::response(0, $validator->errors(), 400);\n }\n $resource = $this->resourceRepository->fetchResource($id);\n $this->resourceRepository->storeView($id, $currentUser['id']);\n\n $data = [\n 'resource' => $resource,\n 'related_resources' => $this->resourceRepository->getResourcesRelatedTo($resource->id, $resource->mentoring_area_id)\n ];\n\n return APIHandler::response(1, \"Show Resource\", $data);\n }", "public function get(Resource $resource);", "public function showAction()\n {\n $model = $this->_getPhotoModel();\n $photo = $model->fetchEntry($this->getRequest()->getParam('id'));\n\n if (null === $photo) {\n return $this->_forward('notfound', 'error');\n }\n\n $this->view->auth = Zend_Auth::getInstance();\n $this->view->title = $photo->title;\n $this->view->photo = $photo;\n }", "public function show($id)\n {\n //\n $data=Resource::find($id);\n return view('resourceDetails',compact('data'));\n }", "function display() {\n\t\t$view = &$this->getView();\n\t\t$view->display();\n\t}", "public function show(ShowResourceRequest $request, $id)\n {\n // TODO: Implement show() method.\n }", "function show( $resource ){\n\n $where = \"reservation_status <> 'Pending' AND id = {$resource}\";\n $reservation = where( 'reservations', $where );\n $reservation = $reservation[0];\n\n return view('admin/reservation/preview_reservation', compact( 'reservation' ));\n}", "public function show()\n {\n if ($this->twig !== false) {\n $this->twigDefaultContext();\n if ($this->controller) {\n $this->controller->display($this->data);\n }\n echo $this->twig->render($this->twig_template, $this->data);\n } else {\n $filename = $this->findTemplatePath($this->template);\n require($filename);\n }\n }", "public function edit(Resource $resource)\n {\n //\n }", "public function show(rc $rc)\n {\n //\n }", "public function show(Resolucion $resolucion)\n {\n //\n }", "public function showAction(furTexture $furTexture)\n {\n\n return $this->render('furtexture/show.html.twig', array(\n 'furTexture' => $furTexture,\n ));\n }", "public function show()\n\t{\n\t\t//\n\t}", "public function show()\n\t{\n\t\t//\n\t}", "public function show()\n\t{\n\t\t//\n\t}", "public function show(Resena $resena)\n {\n }", "public function edit(Resource $resource)\n {\n return view('admin.resources.edit', compact('resource'));\n }", "public function showAction() {\n $docId = $this->getParam('id');\n\n // TODO verify parameter\n\n $document = new Opus_Document($docId);\n\n $this->_helper->layout()->disableLayout();\n\n $this->view->doc = $document;\n $this->view->document = new Application_Util_DocumentAdapter($this->view, $document);\n }", "public function action_display()\r\n\t{\r\n\t\t$event = ORM::factory('event', array('id' => $this->request->param('id')));\r\n\t\r\n\t\tif ( ! $event->loaded())\r\n\t\t{\r\n\t\t\tNotices::error('event.view.not_found');\r\n\t\t\t$this->request->redirect(Route::url('event'));\r\n\t\t}\r\n\t\t\r\n\t\t// Can user view this event?\r\n\t\tif ( ! $this->user->can('event_view', array('event' => $event)))\r\n\t\t{\r\n\t\t\t// Error notification\r\n\t\t\tNotices::error('event.view.not_allowed');\r\n\t\t\t$this->request->redirect(Route::url('event'));\r\n\t\t}\r\n\t\t\r\n\t\t// Pass event data to the view class\r\n\t\t$this->view->event_data = $event;\r\n\t\t$this->view->user = $this->user;\r\n\t}", "public function execute()\n {\n // HTTP Request Get\n if ($this->type == \"resource\") {\n $action = $this->getResourceAction();\n switch ($action) {\n case \"show\":\n $this->show();\n break;\n case \"create\":\n $this->create();\n break;\n case \"edit\":\n $this->edit();\n break;\n case \"destroy\":\n $this->destroy();\n break;\n default:\n echo $this->render();\n break;\n }\n } else {\n $action = $this->Request->action;\n switch ($action) {\n case \"show\":\n $this->show();\n break;\n case \"create\":\n $this->create();\n break;\n case \"edit\":\n $this->edit();\n break;\n case \"destroy\":\n $this->destroy();\n break;\n default:\n echo $this->render();\n break;\n }\n }\n }", "public function show(Resident $resident)\n {\n $this->authorize('admin.resident.show', $resident);\n\n // TODO your code goes here\n }", "public function display()\n {\n echo $this->getDisplay();\n $this->isDisplayed(true);\n }", "public function display()\n\t{\n\t\tparent::display();\n\t}", "public function get_resource();", "public function show()\n\t{\n\t\t\n\t}", "function display() {\n\n\t\t// Check authorization, abort if negative\n\t\t$this->isAuthorized() or $this->abortUnauthorized();\n\n\t\t// Get the view\n\t\t$view = $this->getDefaultView();\n\n\t\tif ($view == NULL) {\n\t\t\tthrow new Exception('Display task called, but there is no view assigned to that controller. Check method getDefaultView.');\n\t\t}\n\n\t\t$view->listing = true;\n\n\t\t// Wrap the output of the views depending on the way the stuff should be shown\n\t\t$this->wrapViewAndDisplay($view);\n\n\t}", "public function viewResources()\n {\n $database = new Database();\n\n $resources = $database->getAllActiveResourcesNoLimit();\n\n\n $resourceArray = array();\n $i = 1;\n\n foreach ($resources as $resource) {\n $availableResource = new Resource($resource['ResourceID'], $resource['ResourceName'], $resource['Description']\n , $resource['ContactName'] , $resource['ContactEmail'] , $resource['ContactPhone'] ,\n $resource['Link'], $resource['active']);\n array_push($resourceArray, $availableResource);\n $i += 1;\n }\n $resourceSize = sizeof($resourceArray);\n $this->_f3->set('resourcesByActive', $resourceArray);\n $this->_f3->set('resourcesSize', $resourceSize);\n echo Template::instance()->render('view/include/head.php');\n echo Template::instance()->render('view/include/top-nav.php');\n echo Template::instance()->render('view/resources.php');\n echo Template::instance()->render('view/include/footer.php');\n }", "public function show($id)\n {\n $this->title .= ' show';\n $this->one($id);\n }", "public function display($title = null)\n {\n echo $this->fetch($title);\n }", "public function display(){}", "public function show($id)\n\t{\n\t\t//\n\t\t//\n\t\n\t}", "public function viewAction()\n\t{\n\t\t//get Id param from request\n\t\tif (!$id = $this->_getParam('id')) {\n\t\t\t$this->getFlashMessenger()->addMessage('Product ID was not specified');\n\t\t\t$this->getRedirector()->gotoSimple('list');\n\t\t}\n\n\t\t//fetch requested ProductID from DB\n\t\tif (!$this->_model->fetch($id)) {\n\t\t\t$this->render('not-found');\n\t\t} else {\n\t\t\t$this->view->model = $this->_model;\n\t\t}\n\t}", "public function show($id)\n {\n // Get single person\n $person = Person::findOrFail($id);\n\n // Return single person as a resource\n return '<h1>Person Number '.$id.'</h1><br>'.json_encode(new PersonResource($person));\n }", "#[TODO] use self object?\n\tprotected function GET(ResourceObject $resource) {\n#[TODO]\t\tif ($resource->getMTime())\n#[TODO]\t\t\t$this->response->headers->set('Last-modified', gmdate('D, d M Y H:i:s ', $resource->getMTime()) . 'GMT');\n#[TODO]\t\tif ($resource->getCTime())\n#[TODO]\t\t\t$this->response->headers->set('Date', gmdate('D, d M Y H:i:s ', $resource->getCTime()) . 'GMT');\n\n\n#[TODO] handle file streams\n\t\t// get ranges\n#\t\t$ranges = WebDAV::getRanges($this->request, $this->response);\n\n\t\t// set the content of the response\n\t\tif ($resource instanceof ResourceDocument) {\n\t\t\t$this->response->content->set($resource->getContents());\n\t\t\t$this->response->content->setType($resource->getMIMEType());\n\t\t\t$this->response->content->encodeOnSubmit(true);\n\t\t}\n\t}", "public function display() {\n echo $this->render();\n }", "public function show($id)\n\t{\n\t//\n\t}", "public function show($id)\n\t{\n\t//\n\t}", "function Fetch($resource_name, $cache_id = null, $compile_id = null, $display = false)\n {\n return $this->_smarty->fetch($resource_name, $cache_id, $compile_id, $display);\n }", "public function show($id)\n {\n //\n $this->_show($id);\n }", "public function show()\n\t{\n\n\t}", "public function show($id) {\n\t\t//\n\t}", "public function show($id) {\n\t\t//\n\t}", "public function show($id) {\n\t\t//\n\t}", "public function show($id) {\n\t\t//\n\t}", "public function show($id) {\n\t\t//\n\t}", "public function show($id) {\n\t\t//\n\t}", "public function show($id) {\n\t\t//\n\t}", "public function show($id) {\n\t\t//\n\t}", "public function show($id) {\n\t\t//\n\t}", "public function show($id) {\n\t\t//\n\t}", "public function show($id) {}", "static public function showCallback(O_Dao_Renderer_Show_Params $params) {\r\n\t\t/* @var $r R_Mdl_Resource */\r\n\t\t$r = $params->record();\r\n\t\t// Setting layout title\r\n\t\t$params->layout()->setTitle($r->getPageTitle());\r\n\r\n?><h1><?=$r->title?></h1><div id=\"resource\"><?\r\n\t\tif($r->getContent()) {\r\n\t\t\t// page has its own content -- show it\r\n\t\t\t$r->getContent()->show($params->layout(), \"content\");\r\n\t\t} else {\r\n\t\t\t// It is a post unit, show all childs\r\n\t\t\tif($r->is_unit == 1) {\r\n\t\t\t\t$r->addQueryAccessChecks($r->getChilds(1))->show($params->layout(), \"content\");\r\n\r\n\t\t\t// It is a folder with several units, show paginator\r\n\t\t\t} elseif($r->show_def == \"last-units\") {\r\n\t\t\t\tlist($type, $perpage) = explode(\":\", $r->show_def_params);\r\n\t\t\t\t/* @var $p O_Dao_Paginator */\r\n\t\t\t\t$p = $r->addQueryAccessChecks($r->getChilds())->test(\"is_unit\", 1)->getPaginator(array($r, \"getPageUrl\"), $perpage);\r\n\t\t\t\t$p->show($params->layout(), $type);\r\n\t\t\t// It is a folder with subfolders, boxes, contents. Show one childs level\r\n\t\t\t} else {\r\n\t\t\t\t$r->addQueryAccessChecks($r->getChilds(1))->show($params->layout(), \"on-parent-page\");\r\n\t\t\t}\r\n\r\n\t\t}\r\n?></div><?\r\n\t}", "public function show($id)\r\n\t{\r\n\t\t//\r\n\r\n\r\n\r\n\t}", "public function show($resourceId, $eventId)\n {\n $routes = $this->routes;\n\n $eventable = $this->getEventableRepository()->model()->findOrFail($resourceId);\n\n if (method_exists($eventable, 'events')) {\n $event = $eventable->events()->find($eventId);\n\n if ($event) {\n $apiObject = $this->event->findApiObject($event->api_id);\n\n return view('events.eventables.show', compact('routes', 'eventable', 'event', 'apiObject'));\n }\n }\n\n abort(404);\n }", "public abstract function display();", "abstract public function resource($resource);", "public function show($id)\r\r\n\t{\r\r\n\t\t//\r\r\n\t}", "public function show( $id ) {\n\t\t//\n\t}", "public function show( $id ) {\n\t\t//\n\t}", "public function show(Response $response)\n {\n //\n }", "public function show()\n {\n return auth()->user()->getResource();\n }" ]
[ "0.8233718", "0.8190437", "0.6828712", "0.64986944", "0.6495974", "0.6469629", "0.6462615", "0.6363665", "0.6311607", "0.62817234", "0.6218966", "0.6189695", "0.61804265", "0.6171014", "0.61371076", "0.61207956", "0.61067593", "0.6105954", "0.6094066", "0.6082806", "0.6045245", "0.60389996", "0.6016584", "0.598783", "0.5961788", "0.59606946", "0.5954321", "0.59295714", "0.59182066", "0.5904556", "0.59036547", "0.59036547", "0.59036547", "0.5891874", "0.58688277", "0.5868107", "0.58676815", "0.5851883", "0.58144855", "0.58124036", "0.58112013", "0.5803467", "0.58012545", "0.5791527", "0.57901084", "0.5781528", "0.5779676", "0.5757105", "0.5756208", "0.57561266", "0.57453394", "0.57435393", "0.57422745", "0.5736634", "0.5736634", "0.5730559", "0.57259274", "0.5724891", "0.5722562", "0.5722562", "0.5722562", "0.5722562", "0.5722562", "0.5722562", "0.5722562", "0.5722562", "0.5722562", "0.5722562", "0.5718969", "0.5713412", "0.57091093", "0.5706405", "0.57057405", "0.5704541", "0.5704152", "0.57026845", "0.57026845", "0.56981397", "0.5693083" ]
0.0
-1
Show the form for editing the specified resource.
public function edit($id) { // }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function edit(Resource $resource)\n {\n return view('admin.resources.edit', compact('resource'));\n }", "public function edit(Resource $resource)\n {\n //\n }", "public function edit($id)\n {\n /* Check if logged in user is authorized to make this request */\n $this->authorizeAction();\n\n /* Get the specified resource */\n $resource = $this->model::findOrFail($id);\n\n /* Sets the view */\n if (view()->exists(\"admin.{$this->name}.edit\")) {\n $view = \"admin.{$this->name}.edit\";\n } else {\n $view = 'admin.includes.actions.edit';\n }\n\n /* Displays the edit resource page */\n return view($view)\n ->with('resource', $resource)\n ->with('name', $this->name);\n }", "public function edit(NebulaResource $resource, $item): View\n {\n $this->authorize('update', $item);\n\n return view('nebula::resources.edit', [\n 'resource' => $resource,\n 'item' => $item,\n ]);\n }", "public function edit() {\r\n $id = $this->api->getParam('id');\r\n\r\n if ($id) {\r\n $this->model->id = $id;\r\n $this->checkOwner();\r\n }\r\n $object = $this->model->find_by_id($id);\r\n\r\n $this->api->loadView('contact-form', array('row' => $object));\r\n }", "public function viewEditResources()\n {\n $database = new Database();\n $id = $this->_params['id'];\n\n $resource = $database->getResourceById($id);\n\n $availableResource = new Resource($resource['ResourceID'], $resource['ResourceName'], $resource['Description']\n , $resource['ContactName'] , $resource['ContactEmail'] , $resource['ContactPhone'] ,\n $resource['Link'], $resource['active']);\n $this->_f3->set('Resource', $availableResource);\n\n echo Template::instance()->render('view/include/head.php');\n echo Template::instance()->render('view/include/top-nav.php');\n echo Template::instance()->render('view/edit-resources.php');\n echo Template::instance()->render('view/include/footer.php');\n }", "public function edit()\n {\n return view('hirmvc::edit');\n }", "public function editformAction(){\n\t\t$this->loadLayout();\n $this->renderLayout();\n\t}", "public function edit() {\n $id = $this->parent->urlPathParts[2];\n // pass name and id to view\n $data = $this->parent->getModel(\"fruits\")->select(\"select * from fruit_table where id = :id\", array(\":id\"=>$id));\n $this->getView(\"header\", array(\"pagename\"=>\"about\"));\n $this->getView(\"editForm\", $data);\n $this->getView(\"footer\");\n }", "public function edit($id)\n\t{\n\t\treturn $this->showForm('update', $id);\n\t}", "public function edit($id)\n {\n $model = $this->modelObj;\n $formObj = $model::findOrFail($id);\n $data['formObj'] = $formObj;\n return view($this->veiw_base . '.edit', $data);\n }", "public function createEditForm(Resourceperson $entity){\n \n $form = $this->createForm(new ResourcepersonType(), $entity, array(\n 'action' => $this->generateUrl('rsp_update', array('id' => $entity->getRpId())),\n 'method' => 'PUT',\n ));\n\n $form->add('submit', 'submit', array('label' => 'Update','attr'=> array(\n 'class'=>'btn btn primary'\n )));\n\n return $form;\n }", "private function createEditForm(Resource $entity)\n {\n $form = $this->createForm(new ResourceType(), $entity, array(\n 'action' => $this->generateUrl('social_admin_resource_update', array('id' => $entity->getId())),\n 'method' => 'PUT',\n ));\n\n $form->add('submit', 'submit', array('label' => '保存','attr'=>[\n 'class'=>'btn btn-primary'\n ]));\n\n return $form;\n }", "public function edit($id)\n {\n return $this->showForm('update', $id);\n }", "public function edit($id)\n {\n return $this->showForm('update', $id);\n }", "public function editAction()\n {\n if ($form = $this->processForm()) {\n if ($this->useTabbedForms && method_exists($this, 'getSubject')) {\n $data = $this->getModel()->loadFirst();\n $subject = $this->getSubject($data);\n $this->setPageTitle(sprintf($this->_('Edit %s %s'), $this->getTopic(1), $subject));\n } else {\n $this->setPageTitle(sprintf($this->_('Edit %s'), $this->getTopic(1)));\n }\n $this->html[] = $form;\n }\n }", "public function edit($id)\n {\n $this->data['entity'] = GS_Form::where('id', $id)->firstOrFail();\n return view('admin.pages.forms.edit', $this->data);\n }", "public function edit($id)\n\t{\n\t\t// get the fbf_presenca\n\t\t$fbf_presenca = FbfPresenca::find($id);\n\n\t\t\n\t\t// show the edit form and pass the fbf_presenca\n\t\t$this->layout->content = View::make('fbf_presenca.edit')\n->with('fbf_presenca', $fbf_presenca);\n\t}", "public function edit($id)\n {\n $data = $this->model->find($id);\n\n return view('admin.backends.employee.form.edit',compact('data'));\n }", "public function edit($model, $form);", "function edit() {\n\t\tglobal $tpl;\n\n\t\t$form = $this->initForm();\n\t\t$tpl->setContent($form->getHTML());\n\t}", "public function edit($id)\n\t{\n\t\t$faith = Faith::find($id);\n \n return view('faith.form')->with('faith', $faith);\n\n\t}", "public function edit()\n { \n return view('admin.control.edit');\n }", "public function edit(Form $form)\n {\n //\n }", "public function edit()\n {\n return view('common::edit');\n }", "public function edit($id)\n {\n $resource = (new AclResource())->AclResource;\n $roleResource = AclRole::where('role', $id)->get(['resource'])->toArray();\n $roleResource = Arr::pluck($roleResource, 'resource');\n return view('Admin.acl.role.form', [\n 'role' => $id,\n 'resource' => $resource,\n 'roleResource' => $roleResource,\n ]);\n }", "public function edit()\n {\n return view('admin::edit');\n }", "public function edit()\n {\n return view('admin::edit');\n }", "public function edit()\r\n {\r\n return view('petro::edit');\r\n }", "public function edit($id)\n {\n // show form edit user info\n }", "public function edit()\n {\n return view('escrow::edit');\n }", "public function edit($id)\n {\n $resource = ResourceManagement::find($id);\n\n $users = User::get();\n // Redirect to user list if updating user wasn't existed\n if ($resource == null || $resource->count() == 0) {\n return redirect()->intended('/resource-management');\n }\n\n return view('resources-mgmt/edit', ['resource' => $resource, 'users' => $users]);\n }", "public function edit()\n {\n return view('commonmodule::edit');\n }", "public function editAction()\n\t{\n\t\t$params = $this->data->getParams();\n\t\t$params = $this->valid->clearDataArr($params);\n\t\tif (isset($params['id']))\n\t\t{\n\t\t\t$this->employee->setFlag(true);\n\t\t}\n\t\tif (isset($_POST['submit']))\n\t\t{\n\t\t\t$action = $this->valid->clearDataArr($_POST);\n\t\t\t$this->employee->setDataArray($action);\n\t\t\theader('Location: ' . PATH . 'Employee/index/', true, 303);\n\t\t}\n\t\t$employee = $this->employee->setAction('edit');\n\t\t$this->view->addToReplace($employee);\n\t\t$this->listEmployee();\n\t\t$this->arrayToPrint();\n\t}", "public function edit()\n {\n return view('catalog::edit');\n }", "public function edit()\n {\n return view('catalog::edit');\n }", "public function edit(form $form)\n {\n //\n }", "public function actionEdit($id) { }", "public function edit()\n {\n return view('admincp::edit');\n }", "public function edit()\n {\n return view('scaffold::edit');\n }", "public function edit($id)\n {\n $header = \"Edit\";\n\t\t$data = Penerbit::findOrFail($id);\n\t\treturn view('admin.penerbit.form', compact('data','header'));\n }", "public function edit()\n {\n return view('Person.edit');\n }", "public function edit($id)\n {\n $data = Form::find($id);\n return view('form.edit', compact('data'));\n }", "public function edit($id)\n\t{\n\t\t$career = $this->careers->findById($id);\n\t\treturn View::make('careers._form', array('career' => $career, 'exists' => true));\n\t}", "public function edit(Flight $exercise, FlightResource $resource)\n {\n return $this->viewMake('adm.smartcars.exercise-resources.edit')\n ->with('flight', $exercise)\n ->with('resource', $resource);\n }", "public function edit($id)\n\t{\n\t\t// get the material\n\t\t$material = Material::find($id);\n\n\t\t// show the edit form and pass the material\n\t\t$this->layout->content = View::make('material.edit')\n\t\t\t->with('material', $material);\n\t}", "public function edit($id, Request $request)\n {\n $formObj = $this->modelObj->find($id);\n\n if(!$formObj)\n {\n abort(404);\n } \n\n $data = array();\n $data['formObj'] = $formObj;\n $data['page_title'] = \"Edit \".$this->module;\n $data['buttonText'] = \"Update\";\n\n $data['action_url'] = $this->moduleRouteText.\".update\";\n $data['action_params'] = $formObj->id;\n $data['method'] = \"PUT\"; \n\n return view($this->moduleViewName.'.add', $data);\n }", "public function edit()\n {\n $id = $this->getId();\n return view('panel.user.form', [\n 'user' => $this->userRepository->findById($id),\n 'method' => 'PUT',\n 'routePrefix' => 'profile',\n 'route' => 'profile.update',\n 'parameters' => [$id],\n 'breadcrumbs' => $this->getBreadcrumb('Editar')\n ]);\n }", "public function edit()\r\n {\r\n return view('mpcs::edit');\r\n }", "function edit()\n\t{\n\t\t// hien thi form sua san pham\n\t\t$id = getParameter('id');\n\t\t$product = $this->model->product->find_by_id($id);\n\t\t$this->layout->set('auth_layout');\n\t\t$this->view->load('product/edit', [\n\t\t\t'product' => $product\n\t\t]);\n\t}", "public function edit($id)\n {\n //\n $data = Diskon::find($id);\n\n $form = $this->form;\n $edit = $this->edit;\n $field = $this->field;\n $page = $this->page;\n $id = $id;\n $title = $this->title;\n return view('admin/page/'.$this->page.'/edit',compact('form','edit','data','field','page','id','title'));\n }", "public function edit($id)\n {\n return $this->showForm($id);\n }", "public function edit($id)\n {\n return $this->showForm($id);\n }", "protected function _edit(){\n\t\treturn $this->_editForm();\n\t}", "public function editAction()\n {\n $robot = Robots::findFirst($this->session->get(\"robot-id\"));\n if ($this->request->isGet()) {\n $this->tag->prependTitle(\"Редактировать робота :: \");\n $user = $this->session->get(\"auth-id\");\n if (!$robot) {\n $this->flashSession->error(\n \"Робот не найден\"\n );\n return $this->response->redirect(\"users/usershow/$user->name\");\n }\n\n }\n\n $this->view->form = new RobotForm(\n $robot,\n [\n \"edit\" => true,\n ]\n );\n }", "public function editAction()\n {\n $form = new $this->form();\n\n $request = $this->getRequest();\n $param = $this->params()->fromRoute('id', 0);\n\n $repository = $this->getEm()->getRepository($this->entity);\n $entity = $repository->find($param);\n\n if ($entity) {\n\n $form->setData($entity->toArray());\n\n if ( $request->isPost() ) {\n\n $form->setData($request->getPost());\n\n if ( $form->isValid() ) {\n\n $service = $this->getServiceLocator()->get($this->service);\n $service->update($request->getPost()->toArray());\n\n return $this->redirect()->toRoute($this->route, array('controller' => $this->controller));\n }\n }\n } else {\n return $this->redirect()->toRoute($this->route, array('controller' => $this->controller));\n }\n\n return new ViewModel(array('form' => $form, 'id' => $param));\n\n }", "public function edit($id)\n\t{\n\t\t$SysApplication = \\Javan\\Dynaflow\\Domain\\Model\\SysApplication::find($id);\n\t\t$form = \\FormBuilder::create('Javan\\Dynaflow\\FormBuilder\\SysApplicationForm', [\n \t'method' => 'POST',\n \t'url' => 'sysapplication/update/'.$id,\n \t'model' => $SysApplication,\n \t'data' => [ 'flow_id' => $SysApplication->flow_id]\n \t]);\n\t\treturn View::make('dynaflow::sysapplication.form', compact('form', 'SysApplication'));\n\t}", "public function editAction() {\n\t\t$id = (int) $this->_getParam('id');\n\t\t$modelName = $this->_getParam('model');\n\t\t\n\t\t$model = Marcel_Backoffice_Model::factory($modelName);\n\t\t$item = $model->find($id)->current();\n\t\tif (!$item) {\n\t\t\t$item = $model->createRow();\n\t\t}\n\t\t$form = $item->getForm();\n\t\tif ($this->_request->isPost()) {\n\t\t\t$newId = $form->populate($this->_request->getPost())->save();\n\t\t\tif ($newId) {\n\t\t\t\t$this->_helper->flashMessenger('Saved successfully!');\n\t\t\t\t$this->_helper->redirector('edit', null, null, array('id' => $newId, 'model' => $modelName));\n\t\t\t}\n\t\t}\n\t\t$this->view->form = $form;\n\t\t$this->view->messages = $this->_helper->flashMessenger->getMessages();\n\t}", "public function edit($id)\n {\n return view('models::edit');\n }", "public function edit()\n {\n return view('home::edit');\n }", "public function editAction()\n {\n $id = $this->params()->fromRoute('id');\n $entity = $this->entityManager->find(Entity\\CourtClosing::class, $id);\n if (! $entity) {\n // to do: deal with it\n }\n $form = $this->getForm('update');\n $form->bind($entity);\n if ($this->getRequest()->isPost()) {\n return $this->post();\n }\n\n return new ViewModel(['form' => $form]);\n }", "public function editAction($id)\n {\n $entity = $this->getManager()->find($id);\n\n $breadcrumbs = $this->get(\"white_october_breadcrumbs\");\n $breadcrumbs->addItem('Inicio', $this->get('router')->generate('admin.homepage'));\n $breadcrumbs->addItem($this->entityDescription, $this->get(\"router\")->generate(\"admin.$this->entityName.index\"));\n $breadcrumbs->addItem('Editar');\n\n if (!$entity) {\n throw $this->createNotFoundException('No se ha encontrado el elemento');\n }\n\n $form = $this->getForm($entity);\n\n return $this->render('AdminBundle:Default:edit.html.twig', array(\n 'entity' => $entity,\n 'form' => $form->createView(),\n 'metadata' => $this->getMetadata()\n ));\n }", "public function edit()\n {\n return view('user::edit');\n }", "public function edit()\n {\n return view('user::edit');\n }", "public function edit(Form $form)\n {\n return view('admin.forms.edit', compact('form'));\n }", "public function editAction()\n {\n $form = MediaForm::create($this->get('form.context'), 'media');\n $media = $this->get('media_manager.manager')->findOneById($this->get('request')->get('media_id'));\n \n $form->bind($this->get('request'), $media);\n \n return $this->render('MediaManagerBundle:Admin:form.html.twig', array('form' => $form, 'media' => $media));\n }", "public function editAction($id) {\n $em = $this->getDoctrine()->getManager();\n\n $entity = $em->getRepository('CdlrcodeBundle:Question')->find($id);\n\n if (!$entity) {\n throw $this->createNotFoundException('Unable to find Question entity.');\n }\n\n $editForm = $this->createEditForm($entity);\n $deleteForm = $this->createDeleteForm($id);\n\n return $this->render('CdlrcodeBundle:Question:edit.html.twig', array(\n 'entity' => $entity,\n 'edit_form' => $editForm->createView(),\n 'delete_form' => $deleteForm->createView(),\n ));\n }", "public function edit($id)\n {\n return view('consultas::edit');\n }", "public function edit(DirectorFormBuilder $form, $id)\n {\n return $form->render($id);\n }", "public function edit()\n {\n return view('dashboard::edit');\n }", "public function edit($id){\n $rfid = Rfid::find($id);\n\n //load form view\n return view('rfids.edit', ['rfid' => $rfid]);\n }", "public function edit($id)\n {\n\n // retrieve provider\n $provider = Provider::findOrFail($id);\n\n // return form with provider\n return view('backend.providers.form')->with('provider', $provider);\n }", "public function edit(Question $question)\n {\n $this->employeePermission('application' , 'edit');\n $question->chooses;\n $action = 'edit';\n return view('admin.setting.question_form', compact('action' , 'question'));\n }", "public function edit() {\n return view('routes::edit');\n }", "public function edit($id)\n {\n $this->data['product'] = Product::find($id);\n $this->data['category'] = Category::arrForSelect();\n $this->data['title'] = \" Update Prouct Details\";\n $this->data['mode'] = \"edit\";\n\n return view('product.form', $this->data);\n }", "public function edit(ClueEnFormBuilder $form, $id): Response\n {\n return $form->render($id);\n }", "public function editAction($id)\n {\n $em = $this->getDoctrine()->getManager();\n\n $entity = $em->getRepository('BaseBundle:Feriado')->find($id);\n\n if (!$entity) {\n throw $this->createNotFoundException('Unable to find Feriado entity.');\n }\n\n $editForm = $this->createEditForm($entity);\n $deleteForm = $this->createDeleteForm($id);\n\n return $this->render('BaseBundle:Feriado:edit.html.twig', array(\n 'entity' => $entity,\n 'edit_form' => $editForm->createView(),\n 'delete_form' => $deleteForm->createView(),\n ));\n }", "public function edit($id)\n {\n return view('cataloguemodule::edit');\n }", "public function edit($articulo_id)\n {\n $titulo = \"Editar\";\n return View(\"articulos.formulario\",compact('titulo','articulo_id'));\n }", "public function edit($id)\n {\n $resources = User::find(session('usuario_id'))->resources;\n $languages = Language::pluck('name', 'id');\n $types = Type::pluck('name', 'id');\n $method = 'PATCH';\n\n $recurso = Resource::find($id);\n $url = \"/resource/$recurso->id\";\n\n return view('resources.resources', compact('resources', 'languages', 'types', 'method', 'url', 'recurso'));\n }", "public function edit(Question $question)\n {\n $edit = TRUE;\n return view('questionForm', ['question' => $question, 'edit' => $edit]);\n }", "public function displayEditForm(Employee $employee){\n return view('employee.displayEditForm',['employee'=>$employee]);\n }", "public function edit()\n {\n return view('website::edit');\n }", "public function edit()\n {\n return view('inventory::edit');\n }", "public function edit()\n {\n return view('initializer::edit');\n }", "public function editAction()\n {\n View::renderTemplate('Profile/edit.html', [\n 'user' => $this->user\n ]);\n }", "public function edit($id)\n {\n return view('backend::edit');\n }", "public function edit($id)\n {\n //dd($id);\n $familiaPrograma= FamiliaPrograma::findOrFail($id);\n return view('familiasPrograma.edit', compact('familiaPrograma'));\n }", "public function edit($id)\n {\n return view('crm::edit');\n }", "public function edit($id)\n {\n return view('crm::edit');\n }", "public function edit($id)\n {\n $user = User::where('id', $id)->first();\n\n\n return view('users.forms.update', compact('user'));\n }", "public function editAction($id)\n\t{\n\t\t$school = School::find( $id );\n\t\t$this->render( View::make( 'schools/form' , array(\n\t\t\t'title' => sprintf( 'Modifier \"%s\"', $school->name ),\n\t\t\t'entity' => $school\n\t\t) ) );\n\t}", "public function edit(Question $question)\n {\n $edit = TRUE;\n return view('questionForm', ['question' => $question, 'edit' => $edit ]);\n }", "public function edit(Person $person) {\n\t\t$viewModel = new PersonFormViewModel();\n\t\treturn view('person.form', $viewModel);\n\t}", "public function edit($id)\n {\n \t$product = Product::find($id);\n \treturn view('admin.products.edit')->with(compact('product')); // formulario de actualizacion de datos del producto\n }", "public function edit_person($person_id){\n \t$person = Person::find($person_id);\n \treturn view('resource_detail._basic_info.edit',compact('person'));\n }", "public function edit($id)\n {\n $professor = $this->repository->find($id);\n return view('admin.professores.edit',compact('professor'));\n }", "public function edit($id)\n {\n $data = Restful::find($id);\n return view('restful.edit', compact('data'));\n }", "public function editAction($id)\n {\n $em = $this->getDoctrine()->getManager();\n\n $entity = $em->getRepository('MedecinIBundle:Fichepatient')->find($id);\n\n if (!$entity) {\n throw $this->createNotFoundException('Unable to find Fichepatient entity.');\n }\n\n $editForm = $this->createEditForm($entity);\n $deleteForm = $this->createDeleteForm($id);\n\n return $this->render('MedecinIBundle:Fichepatient:edit.html.twig', array(\n 'entity' => $entity,\n 'edit_form' => $editForm->createView(),\n 'delete_form' => $deleteForm->createView(),\n ));\n }", "public function edit($id)\n {\n return $this->form->render('mconsole::personal.form', [\n 'item' => $this->person->query()->with('uploads')->findOrFail($id),\n ]);\n }", "public function edit($id)\n\t{\n\t\t // get the project\n $project = Project::find($id);\n\n // show the edit form and pass the project\n return View::make('logicViews.projects.edit')->with('project', $project);\n\t}" ]
[ "0.78550774", "0.7692893", "0.7273195", "0.7242132", "0.7170847", "0.70622855", "0.7053459", "0.6982539", "0.69467914", "0.6945275", "0.6941114", "0.6928077", "0.69019294", "0.68976134", "0.68976134", "0.6877213", "0.68636996", "0.68592185", "0.68566656", "0.6844697", "0.68336326", "0.6811471", "0.68060875", "0.68047357", "0.68018645", "0.6795623", "0.6791791", "0.6791791", "0.6787701", "0.67837197", "0.67791027", "0.677645", "0.6768301", "0.6760122", "0.67458534", "0.67458534", "0.67443407", "0.67425704", "0.6739898", "0.6735328", "0.6725465", "0.6712817", "0.6693891", "0.6692419", "0.6688581", "0.66879624", "0.6687282", "0.6684741", "0.6682786", "0.6668777", "0.6668427", "0.6665287", "0.6665287", "0.66610634", "0.6660843", "0.66589665", "0.66567147", "0.66545695", "0.66527975", "0.6642529", "0.6633056", "0.6630304", "0.6627662", "0.6627662", "0.66192114", "0.6619003", "0.66153085", "0.6614968", "0.6609744", "0.66086483", "0.66060555", "0.6596137", "0.65950733", "0.6594648", "0.65902114", "0.6589043", "0.6587102", "0.65799844", "0.65799403", "0.65799177", "0.657708", "0.65760696", "0.65739626", "0.656931", "0.6567826", "0.65663105", "0.65660435", "0.65615267", "0.6561447", "0.6561447", "0.65576506", "0.655686", "0.6556527", "0.6555543", "0.6555445", "0.65552044", "0.65543956", "0.65543705", "0.6548264", "0.65475875", "0.65447706" ]
0.0
-1
Update the specified resource in storage.
public function update($id) { // }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function updateShopifyResource() {\n $this->saving();\n $this->getShopifyApi()->call([\n 'URL' => API::PREFIX . $this->getApiPathSingleResource(),\n 'METHOD' => 'PUT',\n 'DATA' => [\n static::getResourceSingularName() => $this->shopifyData\n ]\n ]);\n }", "public function update(Request $request, Resource $resource)\n {\n $request->validate([\n 'name' => 'required',\n 'description' => 'required|string',\n 'file' => 'required|mimes:jpg,jpeg,png,doc,docx,pdf,ppt,txt',\n ]);\n\n $resource->update($request->all());\n\n if ( $request->hasFile('file') ) {\n $resource = 'resource-'.time().'.'.$request->file('file')->extension();\n $request->file->storeAs('resources', $resource,'public');\n $resource->file = $resource;\n }\n\n if ( $resource->save() ) {\n return redirect()->route('admin.resources.index')->with('success', 'Resource updated');\n } else {\n return redirect()->route('admin.resources.index')->with('error', 'Something went wrong');\n }\n }", "public function update(Request $request, Resource $resource)\n {\n //\n }", "public function updateStream($resource);", "public function update(Request $request, Storage $storage)\n {\n $storage->product_id = $request->product_id;\n $storage->amount = $request->amount;\n\n $storage->save();\n\n return redirect()->route('storages.index');\n }", "protected function updateImageResource($fileName, $imageId, $storage)\n {\n //Get image name and storage location for image\n $image = Image::where('id', '=', $imageId)->first();\n\n //Delete old image\n $this->deleteResource($image->name, $image->storage);\n\n //Store the new image\n $image->name = $fileName;\n $image->storage = $storage;\n\n $image->save();\n }", "public function update(Storage $storage, UpdateStorageRequest $request)\n {\n $this->storage->update($storage, $request->all());\n\n return redirect()->route('admin.product.storage.index')\n ->withSuccess(trans('core::core.messages.resource updated', ['name' => trans('product::storages.title.storages')]));\n }", "public function update(StoreStorage $request, Storage $storage)\n {\n $storage->fill($request->all())->save();\n $request->session()->flash('alert-success', 'Запись успешно обновлена!');\n return redirect()->route('storage.index');\n }", "public function update_asset($id, Request $request){\n \t\tif(!Auth::user()){\n\t\t\treturn redirect('/');\n\t\t}\n \t\t$asset = Storage::find($id);\n \t\t$asset->name = $request->name;\n \t\t$asset->quantity = $request->quantity;\n \t\t$asset->category_id = $request->category;\n \t\tif($request->file('image') != null){\n\t\t\t$image = $request->file('image');\n\t\t\t$image_name = time(). \".\" . $image->getClientOriginalExtension();\n\t\t\t$destination = \"images/\";\n\t\t\t$image->move($destination, $image_name);\n\t\t\t$asset->image_url = $destination.$image_name;\n\t\t} \n\t\t$asset->save();\n\t\tsession()->flash('success_message', 'Item Updated successfully');\n\t\treturn redirect(\"/storage\");\n \t}", "public function update(Request $request, Flight $exercise, FlightResource $resource)\n {\n $request->validate([\n 'display_name' => 'required|string|max:100',\n 'file' => 'nullable|file|max:10240|mimes:pdf',\n 'uri' => 'nullable|url|max:255',\n ]);\n\n if ($resource->type === 'file' && $request->file('file')) {\n Storage::drive('public')->delete($resource->resource);\n $resource->resource = $request->file('file')->store('smartcars/exercises/resources', ['disk' => 'public']);\n } elseif ($resource->type === 'uri' && $request->input('uri')) {\n $resource->resource = $request->input('uri');\n }\n\n $resource->save();\n\n return redirect()->route('adm.smartcars.exercises.resources.index', $exercise)\n ->with('success', 'Resource edited successfully.');\n }", "public function update(Request $request, $id)\n {\n $validator = Validator::make($request->all(), [\n 'title' => 'required|string',\n 'content' => 'required|string',\n 'mentoring_area_id' => 'required|integer',\n 'featured_image_uri' => 'string',\n ]);\n\n if ($validator->fails()) {\n return APIHandler::response(0, $validator->errors(), 400);\n }\n \n $resource = Resource::find($id);\n $resource->title = $request->get('title');\n $resource->content = $request->get('content');\n $resource->featured_image_uri = $request->get('featured_image_uri');\n $resource->updated_at = \\Carbon\\Carbon::now();\n $resource->mentoring_area_id = $request->get('mentoring_area_id');\n $resource->save();\n $data['resource'] = $resource;\n return APIHandler::response(1, \"Resource has been updated\");\n }", "protected function updateVideoResource($fileName, $videoId, $storage, $premium=1)\n {\n //Get video name and storage location for video\n $video = Video::where('id', '=', $videoId)->first();\n\n //Check the storage medium\n if($storage == 'vimeo' || $storage == 'youtube')\n {\n $video->name = $fileName;\n $video->storage = $storage;\n $video->premium = $premium;\n $video->save();\n }\n else\n {\n if($video['storage'] == 'local' || $video['storage'] == 's3')\n {\n //Delete old video\n $this->deleteResource($video->name, $video->storage);\n }\n \n //Store the new video\n $video->name = $fileName;\n $video->storage = $storage;\n $video->premium = $premium;\n $video->save();\n }\n }", "public function put($resource, $with=[]){\n return $this->fetch($resource, self::PUT, $with);\n }", "public function update($id, $resource) {\n SCA::$logger->log(\"update resource\");\n return $this->orders_service->update($id, $resource);\n }", "public function update($path);", "public function update($id, $resource)\n {\n SCA::$logger->log(\"Entering update()\");\n //check whether it is an sdo or an xml string.\n if ($resource instanceof SDO_DataObjectImpl) {\n //if the thing received is an sdo convert it to xml\n if ($this->xml_das !== null) {\n $xml = SCA_Helper::sdoToXml($this->xml_das, $resource);\n } else {\n throw new SCA_RuntimeException(\n 'Trying to update a resource with SDO but ' .\n 'no types specified for reference'\n );\n }\n } else {\n $xml = $resource;\n }\n\n $slash_if_needed = ('/' === $this->target_url[strlen($this->target_url)-1])?'':'/';\n\n $handle = curl_init($this->target_url.$slash_if_needed.\"$id\");\n curl_setopt($handle, CURLOPT_HEADER, false);\n curl_setopt($handle, CURLOPT_RETURNTRANSFER, true);\n curl_setopt($handle, CURLOPT_CUSTOMREQUEST, \"PUT\");\n curl_setopt($handle, CURLOPT_POSTFIELDS, $xml);\n\n //replace with Content-Type: atom whatever\n $headers = array(\"User-Agent: SCA\",\n \"Content-Type: text/xml;\",\n \"Accept: text/plain\");\n curl_setopt($handle, CURLOPT_HTTPHEADER, $headers);\n\n $result = curl_exec($handle);\n\n $response_http_code = curl_getinfo($handle, CURLINFO_HTTP_CODE);\n\n curl_close($handle);\n\n $response_exception = $this->buildResponseException($response_http_code, '200');\n\n if ($response_exception != null) {\n throw $response_exception;\n } else {\n //update does not return anything in the body\n return true;\n }\n }", "public function update(Request $request, $id)\n {\n $this->validate($request, [\n 'name' => 'required',\n 'link' => 'required',\n 'description' => 'required'\n ]);\n\n $resource = Resource::find($id);\n $resource->name = $request->name;\n $resource->type_id = $request->type_id;\n $resource->has_cost = ($request->has('has_cost')) ? 1 : 0;\n $resource->language_id = $request->language_id;\n $resource->link = $request->link;\n $resource->description = $request->description;\n $resource->tags = '';\n\n $resource->save();\n //return back()->with('success', 'Recurso actualizado satisfactoriamente');\n return redirect('/resource')->with('success', 'Recurso actualizado satisfactoriamente');\n }", "public function update(Request $request, $id)\n {\n $oldProduct = Product::findOrFail($id);\n $data = $request->all();\n if(isset($data['img'])){\n // $file = $request->file('photo');\n // return $file;\n $imgName = time().'.'.$request->img->extension();\n $data['img'] = $imgName;\n // Storage::putFile('spares', $file);\n $path = $request->img->storeAs('public/uploads', $imgName); //in Storage\n\n //delete old file\n if($oldProduct->img != 'product-default.png'){\n Storage::delete(\"public/uploads/\".$oldProduct->img);\n // return 'deleted';\n }\n \n }else{\n $data['img'] = $oldProduct->img;\n }\n $oldProduct->update($data);\n return redirect()->route('product.index'); \n\n }", "public function updateStream($path, $resource, Config $config)\n {\n }", "public function update($request, $id) {\n\t\t\t$image = $request['photo'];\n\t\t\tif($image !== null) {\n\t\t\t\t$name = time().'.' . explode('/', explode(':', substr($image, 0, strpos($image, ';')))[1])[1];\n\t\t\t\t\\Image::make($request['photo'])->save(public_path('storage/products/').$name);\n\t\t\t\t$request['photo'] = $name;\n\t\t\t} else {\n\t\t\t\t$currenPhoto = Product::all()->where('id', $id)->first();\n\t\t\t\t$request['photo'] = $currenPhoto->photo;\n\t\t\t}\n return $this->product->update($id, $request);\n\t}", "public function edit(Resource $resource)\n {\n //\n }", "public function updateResourceIndex(&$resource) {\n if ($this->connector != null) {\n\n // STEP 1: Update or insert this resource as a node:\n $this->logger->addDebug(\"Updating/Inserting Node into Neo4J database\");\n $result = $this->connector->run(\"MATCH (a:Resource {id: {id} }) SET a.title = {title}, a.version = {version}, a.href = {href}\n return a;\",\n [\n 'id' => $resource->getID(),\n 'version' => $resource->getVersion(),\n 'title' => $resource->getTitle(),\n 'href' => $resource->getLink()\n ]\n );\n\n // Check to see if anything was added\n $records = $result->getRecords();\n if (empty($records)) {\n // Must create this record instead\n $result = $this->connector->run(\"CREATE (n:Resource) SET n += {infos};\",\n [\n \"infos\" => [\n 'id' => $resource->getID(),\n 'version' => $resource->getVersion(),\n 'title' => $resource->getTitle(),\n 'href' => $resource->getLink()\n ]\n ]\n );\n }\n\n // STEP 2: Update or insert the resource's link to holding repository\n $result = $this->connector->run(\"MATCH (a:Resource {id: {id} })-[r:HIRELATION]->()\n return r;\",\n [\n 'id' => $resource->getID(),\n ]\n );\n $records = $result->getRecords();\n if (!empty($records)) {\n // delete the one there so that we can add the correct one (just in case)\n $result = $this->connector->run(\"MATCH (a:Resource {id: {id}})-[r:HIRELATION]->() delete r;\",\n [\n 'id' => $resource->getID()\n ]\n );\n\n }\n\n // If resource has a repository, then add a link\n if ($resource->getRepository() != null && $resource->getRepository()->getID() != null) {\n $this->connector->run(\"MATCH (a:Identity {id: {id1} }) MATCH (b:Resource {id: {id2} }) CREATE (b)-[r:HIRELATION]->(a);\",\n [\n 'id1' => (string) $resource->getRepository()->getID(),\n 'id2' => $resource->getID()\n ]);\n }\n }\n }", "public function update($data) {}", "public function update($data) {}", "public function putStream($resource);", "public function update(Request $request, NebulaResource $resource, $item): RedirectResponse\n {\n $this->authorize('update', $item);\n\n $validated = $request->validate($resource->rules(\n $resource->editFields()\n ));\n\n $resource->updateQuery($item, $validated);\n\n $this->toast(__(':Resource updated', [\n 'resource' => $resource->singularName(),\n ]));\n\n return redirect()->back();\n }", "public function saveShopifyResource() {\n if (is_null($this->getShopifyId())) { // if there is no id...\n $this->createShopifyResource(); // create a new resource\n } else { // if there is an id...\n $this->updateShopifyResource(); // update the resource\n }\n }", "public function update($entity);", "public function update($entity);", "public function setResource($resource);", "public function updateStream($path, $resource, Config $config)\n {\n return $this->upload($path, $resource, $config);\n }", "public function isUpdateResource();", "public function update(Request $request, $id)\n {\n $device = Device::findOrFail($id);\n $device->fill($request->all());\n if ($request->hasFile('icon')) {\n if ($device->hasMedia('icon')) {\n $device->deleteMedia($device->getFirstMedia('icon'));\n }\n $device->addMediaFromRequest('icon')->toMediaCollection('icon');\n }\n $device->save();\n return new DeviceResource($device);\n }", "public function update(Request $request, $id)\n {\n //\n $product = Product::findOrFail($id);\n \n $product->update($request->all());\n \n $file = $request->file('url_image')->move('upload', $request->file('url_image')->getClientOriginalName());\n\n Product::where('id',$id)->update(['url_image'=>$file]);\n \n \\Session::flash('flash_message', 'Edit product successfully.'); \n \n //cũ : return redirect('articles');\n return redirect()->route('products.index');\n }", "public function store($data, Resource $resource);", "public function update(Request $request, $id)\n {\n \n $product = Product::find($id);\n\n\n $product->fill($request->all())->save();\n\n //Verificamos que tenemos una imagen\n if($request->file('photo_1')){\n\n\n //En caso de tenerla la guardamos en la clase Storage en la carpeta public en la carpeta image.\n $path = Storage::disk('public')->put('photo_1',$request->file('photo_1'));\n\n //Actualizamos el Post que acabamos de crear\n $product->fill(['photo_1' => asset($path)])->save();\n\n }\n\n\n return redirect()->route('products.index')->with('info', 'Producto actualizado exitosamente!');\n }", "public function update(Request $request, $id)\n {\n $product = Product::find($id);\n\n if (\\Input::hasFile('image')) {\n $this->imgsave($request, $product);\n }\n\n\n if (!empty($request->input('tags'))) {\n $product->tags()->sync($request->input('tags'));\n } else {\n $product->tags()->detach();\n }\n\n $product->update($request->all());\n\n return redirect()->to('dashboard/product')->with('message', 'update success');\n }", "public function put($resource_path, array $variables = array()) {\n return $this->call($resource_path, $variables, 'PUT');\n }", "public function update($id)\n {\n /* Check if logged in user is authorized to make this request */\n $this->authorizeAction();\n\n if (method_exists($this, 'updateValidations')) {\n $this->request->validate($this->updateValidations());\n }\n\n /* Get the specified resource */\n $resource = $this->model::findOrFail($id);\n\n /* Update the specified resource */\n $resource->update(Input::all());\n\n /* Redirect back */\n return redirect()->back()\n ->with(\n 'info',\n Lang::has($this->name . '.resource-updated') ?\n $this->name . '.resource-updated' :\n 'messages.alert.resource-updated'\n );\n }", "public function update(Request $request, $id)\n\n {\n ResourceManagement::findOrFail($id);\n $constraints = [\n 'title' => 'required|max:100',\n 'url'=> 'required|max:191',\n 'content' => 'required'\n ];\n\n $input = [\n 'title' => $request['title'],\n 'url' => $request['url'],\n 'content' => $request['content'],\n 'type' => $request['type'],\n 'level' => $request['level'],\n 'user_id' => $request['user']\n ];\n// $this->validate($input, $constraints);\n ResourceManagement::where('id', $id)\n ->update($input);\n\n return redirect()->intended('/resource-management');\n }", "public function putResponse($request)\n {\n $idSearched = $this->searcher->searchResourceIndex(\n $request, \n $this->db[$request['resource']]\n );\n if ($idSearched) {\n $resource = $this->db[$request['resource']][$idSearched];\n $bodyInput = json_decode($this->standardInput, true);\n $resource = BodyRequest::canApplyBody($bodyInput);\n $resource['id'] = (int)$request['param'];\n foreach($resource as $key => $value) {\n $this->db[$request['resource']][$idSearched][$key] = $value;\n }\n file_put_contents(DB_PATH, json_encode($this->db));\n }\n }", "public function update(Request $request, $id)\n {\n $this->validate($request, [\n 'title' => 'required',\n 'description' => 'required|string',\n 'price' => 'required|numeric',\n 'reference'=>'required'\n ]);\n \n $product = Product::find($id);\n $product->update($request->all());\n \n $im = $request->file('picture');\n \n if (!empty($im)) {\n \n $link = $request->file('picture')->store('images');\n \n \n $product->update([\n 'url_image' => $link,\n ]);\n } \n //dump($request->all());\n return redirect()->route('product.index')->with('message', 'Article modifié avec succès');\n }", "public function update(Storedataset $request, dataset $dataset){\n $dataset->title = $request->input('title');\n $dataset->caption = $request->input('caption');\n $dataset->file_url = $request->input('file_url');\n $dataset->type = $request->input('type');\n $dataset->status = $request->input('status');\n $dataset->publication_id = $request->input('publication_id');\n\n $dataset->save();\n\n return redirect()->route('datasets.show', ['dataset' => $dataset]);\n }", "public function update(StoreOrUpdateAsset $request, Asset $asset)\n {\n if (Storage::exists($asset->path) && !Storage::delete($asset->path)) {\n abort(500);\n }\n\n $file = $request->file('file');\n $path = $file->store('assets');\n\n if (!$path) {\n abort(500);\n }\n\n // We wonder if we should delete the old file or not...\n\n $asset->name = $file->getClientOriginalName();\n $asset->size = $file->getSize();\n $asset->type = $file->getMimeType();\n $asset->path = $path;\n\n if ($asset->save()) {\n flash('The asset has been saved.')->success();\n } else {\n abort(500);\n }\n\n return redirect('/admin/assets');\n }", "public function update(FoodRecipeRequest $request, $id)\n {\n $foodRecipe = FoodRecipe::with('ingredients','cookingProcesses')->findOrFail($id);\n if ($request->input('name')!= null)\n $foodRecipe->name = $request->input('name');\n if ($request->input('detail')!= null)\n $foodRecipe->detail = $request->input('detail');\n if($request->file('photo') != null) {\n $old_file = $foodRecipe->photo;\n if($old_file != null){\n $path = public_path().'/storage/'.$old_file;\n File::delete($path);\n }\n $file = $request->file('photo');\n $name = '/foodRecipe/' . Carbon::now()->format(\"dnY-Hisu\") . \".\" . $file->extension();\n $file->storePubliclyAs('public', $name);\n $foodRecipe->photo = $name;\n }\n $foodRecipe->save();\n return new FoodRecipeResource($foodRecipe);\n }", "public function update(StorageTypeRequest $request, $id)\n {\n try {\n $this->service->updateStorageType($request, $id);\n return $this->NoContent();\n } catch (EntityNotFoundException $e) {\n \\Log::error($e->getMessage());\n return $this->NotFound($e->getMessage());\n } catch(\\QueryException $e) {\n \\Log::error($e->getMessage());\n return $this->ServerError();\n } catch(Exception $e) {\n \\Log::error($e->getMessage());\n return $this->ServerError();\n }\n }", "public function update(Request $request, $id)\n {\n //validation\n $this->validate(request(),[\n 'image' => 'image'\n ]);\n\n $slider = HomeSliders::find($id);\n \n $slider->link = request('link');\n\n //get old image to delete if updated\n $oldImage = request('oldImage');\n //get the new image\n $NewImage=$request->file('image');\n\n if($NewImage)\n {\n $filenameToStore= helpers::updatePhoto('image','homeSliders',$request);\n $slider->image=$filenameToStore;\n\n Storage::delete('public/Images/homeSliders/'.$oldImage);\n }\n\n $slider->save();\n\n Alert::success(config('app.name'), trans('messages.Updated Successfully') );\n return redirect()->route('admin.homeSlider',$slider->type);\n }", "public function update(Qstore $request, $id)\n {\n //\n }", "public function update($request, $id);", "public function update(IEntity $entity);", "protected function performUpdate(): bool\n {\n // Abort if resource does not support update operations\n if (!$this->isUpdatable()) {\n throw new UnsupportedOperation(sprintf('API does not support update operation for %s resources', $this->resourceNameSingular()));\n }\n\n $id = $this->id();\n $prepared = $this->prepareBeforeUpdate($this->toArray());\n\n $payload = [\n $this->resourceNameSingular() => $prepared\n ];\n\n $response = $this\n ->request()\n ->put($this->endpoint($id), $payload);\n\n // Extract and (re)populate resource (if possible)\n // Note: Unlike the \"create\" method, Redmine does NOT\n // appear to send back a full resource when it has been\n // successfully updated.\n $this->fill(\n $this->decodeSingle($response)\n );\n\n return true;\n }", "function put($resource, $data = null) {\r\n\t\t\r\n\t\tif(isset($data)) {\r\n\t\t\t$this->request_body = $data;\r\n\t\t}\r\n\r\n\t\t// make the call chief\r\n\t\t$this->exec ( \"PUT\", '/' . $resource );\r\n\r\n\t\t// check the request status\r\n\t\tif($this->status_code != 200){\r\n\t\t\t$this->Logger->error(\r\n\t\t\t\tsprintf(\r\n\t\t\t\t\t'GET Call for resource \\'%s\\' Failed.\r\n\t\t\t\t\tStatus: %d,\r\n\t\t\t\t\tRequest: %s\r\n\t\t\t\t\tAPI Error Message: \r\n\t\t\t\t\t%s',\r\n\t\t\t\t\t$resource,\r\n\t\t\t\t\t$this->status_code,\r\n\t\t\t\t\t$this->request_body_raw,\r\n\t\t\t\t\t$this->response_body\r\n\t\t\t\t)\r\n\t\t\t);\r\n\t\t\tthrow new Exception($this->response_body);\r\n\t\t} else {\r\n\t\t\treturn $this->response_parsed;\r\n\t\t}\r\n\t}", "public function updateEntities($resource)\n {\n $json = [\n 'resource' => $resource,\n ];\n $request = $this->createRequest('PUT', '/entities', ['json' => $json]);\n $response = $this->send($request);\n return $response;\n }", "public function updateStream($path, $resource, Config $config)\n {\n return $this->writeStream($path, $resource, $config);\n }", "protected function handleUpdate()\n {\n $resource = $this->argument('resource');\n $action = $this->option('action');\n $startPage = (int)$this->option('startPage');\n $perPage = (int)$this->option('perPage');\n\n try {\n $harvest = Harvest::where('resource', $resource)->where('action', $action)->firstOrFail();\n } catch (\\Exception $e) {\n $this->info('There is no existing action for updating ' . ucwords($action) . ' ' . ucwords($resource) . '.');\n exit('Nothing was updated.');\n }\n\n $options = [\n 'startPage' => $startPage,\n 'perPage' => $perPage,\n 'lastRun' => $harvest->last_run_at\n ];\n\n // If a lastRun was given use that\n // OR if this has never been run before use 2001-01-01\n if (!empty($this->option('lastRun'))) {\n $options['lastRun'] = new Carbon($this->option('lastRun'));\n } elseif (is_null($options['lastRun'])) {\n $options['lastRun'] = new Carbon('2001-01-01');\n }\n\n $job = new UpdateResourceJob(\n $harvest,\n $options\n );\n\n $message = 'Updating ' . $action . ' ' . $resource . ' ' . $perPage . ' at a time';\n if (isset($lastRun)) {\n $message .= ' with entries updated since ' . $lastRun->format('r');\n }\n $this->info($message);\n $this->dispatch($job);\n }", "public function update(Request $request, $id)\n {\n\n $product = Product::findOrFail($id);\n $product->name = $request['name'];\n $product->price = $request['price'];\n $product->stock = $request['stock'];\n $product->description = $request['description'];\n\n $file = $request->file('image');\n $fileName = $file->getClientOriginalName();\n if($fileName != $product->image){\n $request->file('image')->move('images/',$fileName);\n $product->image = $fileName;\n }\n\n $product->save();\n\n return redirect()->route('products.show',\n $product->id)->with('flash_message',\n 'Article, '. $product->name.' updated');\n }", "public function update($id, $data);", "public function update($id, $data);", "public function update($id, $data);", "public function update($id, $data);", "public function update($id, $data);", "abstract public function put($data);", "public function update(Request $request, $id)\n {\n $storageplace = Storageplace::findOrFail($id);\n $storageplace->update($request->only(['storageplace']));\n return $storageplace;\n }", "public function testUpdateSupplierUsingPUT()\n {\n }", "public function updateStream($path, $resource, Config $config = null)\n {\n $contents = stream_get_contents($resource);\n\n return $this->write($path, $contents, $config);\n }", "public function update(Request $request, $id)\n {\n $skill = Skill::findOrFail($id);\n\n $skill->skill = $request->skill;\n\n if ($request->hasFile('image')) {\n \\Cloudder::upload($request->file('image'));\n $c=\\Cloudder::getResult();\n // $image = $request->file('image');\n // $filename = time() . '.' . $image->getClientOriginalExtension();\n // $location = public_path('images/' . $filename);\n // Image::make($image)->save($location);\n\n $skill->image = $c['url'];\n }\n\n $skill->save();\n\n Session::flash('success', 'Successsfully updated your skill!');\n return redirect()->route('skills.index');\n }", "public function updateRelatedImage(Request $request, $id)\n {\n // Delete display image in Storage\n Validator::make($request->all(), ['photos' => \"required|file|image|mimes:jpg,png,jpeg|max:5000\"])->validate();\n\n\n if ($request->hasFile(\"photos\")) {\n\n $photo = ProductsPhoto::find($id);\n $imageName = $photo->photos;\n $exists = Storage::disk('local')->exists(\"public/product_images/\" . $photo->photos);\n\n //delete old image\n if ($exists) {\n Storage::delete('public/product_images/' . $imageName);\n }\n\n //upload new image\n $ext = $request->file('photos')->getClientOriginalExtension(); //jpg\n\n $request->photos->storeAs(\"public/product_images/\", $imageName);\n\n $arrayToUpdate = array('photos' => $imageName);\n DB::table('products_photos')->where('id', $id)->update($arrayToUpdate);\n\n return redirect()->route(\"adminDisplayRelatedImageForm\", ['id' => $photo->product_id]);\n } else {\n\n $error = \"NO Image was Selected\";\n return $error;\n }\n }", "public static function update($id, $file)\n {\n Image::delete($id);\n\n Image::save($file);\n }", "public abstract function update($object);", "public function update(Request $request, $id)\n {\n $product = Product::find($id);\n $image = $product->image;\n if($request->hasFile('image')){\n $image = $request->file('image')->store('files');\n \\Storage::delete($product->image);\n } \n $product->name = $request->get('name');\n $product->price = $request->get('price');\n $product->description = $request->get('description');\n $product->additional_info = $request->get('additional_info');\n $product->category_id = $request->get('category');\n $product->subcategory_id = $request->get('subcategory');\n $product->image = $image;\n $product->save();\n return redirect()->back();\n }", "public function update(Request $request, $id)\n {\n $sli=Slider::find($id);\n $sli->sort_order=$request->input('sort_order');\n $image = $request->file('slider');\n if($image == ''){\n $image = $sli->slider;\n }else{\n $image = base64_encode(file_get_contents($request->file('slider')));\n }\n $sli->slider = $image;\n $sli->save();\n return redirect()->back();\n }", "public function update(Request $request, $id)\n {\n $volume = $this->findVolume($id);\n\n if(count($volume) > 0) {\n $volume->str_volume_name = $request->str_volume_name;\n\n $volume->save();\n }\n\n return response()\n ->json(\n array(\n 'message' => 'Volume is successfully updated.',\n 'volume' => $volume\n ),\n 201\n );\n }", "public function update(ProductRequest $request, $id)\n {\n $input = Product::find($id);\n $data = $request->all();\n if ($file = $request->file('product_photo')){\n $name = time().$file->getClientOriginalName();\n $file->move('product_image',$name);\n $data['product_photo']=$name;\n// $input->update($data);\n }\n $input->update($data);\n return redirect('admin/products/');\n }", "public function update(Request $request, $id)\n {\n $product = ProductModel::find($id);\n $product->name = $request->name;\n $product->description = $request->description;\n $product->price = $request->price;\n $product->stock = $request->stock;\n\n if($request->image!=null){\n $imageName = time().'.'.$request->image->extension();\n $request->image->move(public_path('images'), $imageName);\n $product->image = \"/images/\".$imageName;\n }\n $product->save();\n return redirect(\"/products/index\")->with('success','Product has been updated');\n }", "public function update()\n {\n $accessory = Accessories::find(request('id'));\n\n if ($accessory == null) {\n return response()->json([\"error\" => \"aksesuaras nerastas\"], 404);\n }\n\n $this->validateData();\n $path = $accessory->src;\n\n if (request()->hasFile('src')) {\n\n if (Storage::disk('public')->exists($accessory->src)) {\n Storage::disk('public')->delete($accessory->src);\n }\n $path = request()->file('src')->store('accessoriesImages', 'public');\n }\n\n $accessory->update(array_merge($this->validateData(), ['src' => $path]));\n\n return response()->json([\"data\" => $accessory], 200);\n }", "public function update(ProductStoreRequest $request,$id)\n {\n $data = $request->validated();\n $product = Product::where('id',$id);\n $product->update($data);\n return response(\"Producto actualizado con éxito\",200);\n }", "public function update($entity)\n {\n \n }", "public function updateStream($path, $resource, Config $config)\n {\n return $this->write($path,stream_get_contents($resource),$config);\n }", "public function update($id, Request $request)\n {\n date_default_timezone_set('Asia/Taipei');\n $data = $request->all();\n $dbData = Product::find($id);\n $myfile = Storage::disk('local');\n if ($request->hasFile('img')) {\n $file = $request->file('img');\n $path = $myfile->putFile('public', $file);\n $data['img'] = $myfile->url($path);\n File::delete(public_path($dbData->img));\n }\n $dbData->update($data);\n\n if ($request->hasFile('imgs')) {\n // $this->fetchDestroyByProdId($id);\n $localS = Storage::disk('local');\n\n $fileS = $request->file('imgs');\n $imgs = [];\n foreach ($fileS as $i) {\n $pathS = $localS->putFile('public', $i);\n $imgs[] = $localS->url($pathS);\n }\n foreach ($imgs as $img) {\n ProductImg::create([\n 'product_id' => $id,\n 'img' => $img\n ]);\n }\n }\n\n return redirect()->route('admin');\n }", "public function update($id, $input);", "public function update(Request $request, Product $product)\n { $remfile= $product->image;\n if($request->filep){\n $product->image=$request->filep;\n File::delete(storage_path('app/public/products/'.$remfile));\n }else{\n $product->image=$remfile;\n }\n //rmdir(storage_path('app/public/products/'.$remfile));\n $product->name = $request->name;\n $product->description = $request->description;\n $product->price = $request->price;\n $product->save();\n sleep(3);\n toast('Details updated successfully','info');\n return redirect('/products');\n }", "public function update(ProductRequest $request,int $id): ProductResource\n {\n $attributes = $request->only('supplier_id', 'name', 'warehouses');\n\n return new ProductResource($this->productRepository->update($id, $attributes)); }", "public function update(Request $request, $id)\n {/* dd($request->all()); */\n $acheivePic = $this->acheiveRepo->find($id);\n $acheive = $request->except('_method', '_token', 'photo', 'ar', 'en');\n $acheiveTrans = $request->only('ar', 'en');\n\n if ($request->hasFile('icon')) {\n // Delete old image first.\n $oldPic = public_path() . '/images/acheives/' . $acheivePic->icon;\n File::delete($oldPic);\n\n // Save the new one.\n $image = $request->file('icon');\n $imageName = $this->upload($image, 'acheives');\n $acheive['icon'] = $imageName;\n }\n\n $this->acheiveRepo->update($id, $acheive, $acheiveTrans);\n\n return redirect('admin-panel/widgets/acheive')->with('updated', 'updated');\n }", "public function update(Request $request, $id)\n {\n $slider=new Slider;\n $slider=$slider::find($id);\n \n \n if($file =$request->file('slider')){\n if(Storage::delete('public/slider/'.$slider->slider)){\n\n //Get file original name//\n \n$original_name=$file->getClientOriginalName();\n\n //Get just the file name\n$filename=pathinfo($original_name,PATHINFO_FILENAME);\n\n//Create new file name\n$name=$filename.'_'.time().'.'.$file->getClientOriginalExtension();\n\n $destination='public/slider';\n $path=$request->slider->storeAs($destination,$name);\n $slider->slider=$name;\n $slider->save();\n return redirect('Admin/slider');\n\n }\n }\n}", "public function update(Request $request, $id)\n {\n $data = $request->all();\n extract($data);\n\n $productVarient = new ProductVariant();\n $productVarient = $productVarient->find($id);\n $productVarient->vendor_id = auth()->user()->id;\n $productVarient->description = $prod_desc;\n $productVarient->price = $price;\n\n if(request()->hasFile('photo')){\n $image = request()->file('photo')->getClientOriginalName();\n $imageNewName = auth()->user()->id.'-'.$image;\n $file = request()->file('photo');\n $file->storeAs('images/product',$imageNewName, ['disk' => 'public']);\n $productVarient->image = $imageNewName;\n }\n \n $productVarient->save();\n\n return back()->withStatus(__('Product successfully updated.'));\n }", "public function update(Request $request, $id)\n {\n //if upload new image, delete old image\n $myfile=$request->old_photo;\n if($request->hasfile('photo'))\n {\n $imageName=time().'.'.$request->photo->extension();\n $name=$request->old_photo;\n\n if(file_exists(public_path($name))){\n unlink(public_path($name));\n $request->photo->move(public_path('backendtemplate/truefalseimg'),$imageName);\n $myfile='backendtemplate/truefalseimg/'.$imageName;\n }\n }\n //Update Data\n $truefalsequestion=TrueFalseQuestion::find($id);\n $truefalsequestion->name=$request->name;\n $truefalsequestion->photo=$myfile;\n $truefalsequestion->answer = $request->answer;\n $truefalsequestion->question_id = $request->question;\n $truefalsequestion->save();\n\n //Redirect\n return redirect()->route('truefalsequestions.index'); \n }", "public function update($id);", "public function update($id);", "public function put($path, $data = null);", "public function update(Request $request, $id)\n {\n $request->validate([\n 'path_image'=>'image',\n 'status'=>'required|in:0,1'\n ]);\n $slider=Slider::whereId($id)->first();\n if (is_null($slider)){\n return redirect()->route('sliders.index')->with('error','Slider does not exist');\n }\n try {\n if ($request->hasFile('path_image')){\n $file = $request->file('path_image');\n\n $image_path= $file->store('/sliders',[\n 'disk'=>'uploads'\n ]);\n Storage::disk('uploads')->delete($slider->image);\n\n $request->merge([\n 'image'=>$image_path,\n ]);\n }\n\n $slider->update( $request->only(['status','image']));\n return redirect()->route('sliders.index')->with('success','Updated successful');\n }catch (\\Exception $exception){\n return redirect()->route('sliders.index')->with(['error'=>'Something error try again']);\n\n }\n }", "public function update() {\n $this->accessory->update($this->accessory_params());\n\n if ($this->accessory->is_valid()) {\n $this->update_accessory_image($this->accessory);\n redirect('/backend/accessories', ['notice' => 'Successfully updated.']);\n } else {\n redirect(\n '/backend/accessories/edit',\n ['error' => $this->accessory->errors_as_string()],\n ['id' => $this->accessory->id]\n );\n }\n }", "private function update()\n {\n $this->data = $this->updateData($this->data, $this->actions);\n $this->actions = [];\n }", "public function update(Entity $entity);", "public function update(Request $request, $id)\n {\n $icon = SliderIcon::find($id);\n $data = $request->all();\n $data['active'] = $request->has('active') ? 1 : 0;\n if ($request->hasFile('img')) {\n if (Storage::disk('public')->exists(str_replace('storage', '', $icon->img))){\n Storage::disk('public')->delete(str_replace('storage', '', $icon->img));\n }\n $image = $request->file('img');\n $fileName = time().'_'.Str::lower(Str::random(5)).'.'.$image->getClientOriginalExtension();\n $path_to = '/upload/images/'.getfolderName();\n $image->storeAs('public'.$path_to, $fileName);\n $data['img'] = 'storage'.$path_to.'/'.$fileName;\n }\n $icon->update($data);\n return redirect()->route('slider_icons.index')->with('success', 'Данные преимущества обнавлены');\n }", "public function update(Request $request, $id)\n {\n //validate incoming request\n $request->validate([\n 'name' => 'string|max:100|nullable',\n 'picture' => 'max:2000|mimes:jpeg,jpg,png,svg|nullable', //max size 2mb,\n 'total' => 'integer|min:0|nullable', //value must be > 0\n 'selling_price' => 'numeric|min:0|nullable',\n 'cost_price' => 'numeric|min:0|nullable',\n 'category_id' => 'integer|nullable'\n ]);\n\n try {\n $product = Auth::user()->store->product()->findorFail($id);\n } catch (ModelNotFoundException $e) {\n return response()->json([\n \"message\" => \"Forbidden\"\n ], 403);\n }\n\n //if category id isnt null\n if ($category_id = $request->category_id) {\n if (!$this->isCategoryIdValid($category_id))\n return response()->json([\n \"message\" => \"Category Id is not valid\"\n ], 422);\n else\n $product->category_id = $request->category_id;\n }\n\n //if uploaded file exist\n if ($picture = $request->file(\"picture\")) {\n //if product already has logo\n if ($product->picture)\n Storage::delete(Product::$PICTURE_PATH . \"/\" . $product->picture);\n\n $picture_path = $picture->store(Product::$PICTURE_PATH);\n //remove folder name from path\n $product->picture = str_replace(Product::$PICTURE_PATH . \"/\", '', $picture_path);\n }\n\n $this->renewProduct($product, $request);\n $product->save();\n return response()->json(new ProductResource($product), 200);\n }", "public function update() {\n\t $this->layout = false;\n\t \n\t //set default response\n\t $response = array('status'=>'failed', 'message'=>'HTTP method not allowed');\n\t \n\t //check if HTTP method is PUT\n\t if($this->request->is('put')){\n\t //get data from request object\n\t $data = $this->request->input('json_decode', true);\n\t if (empty($data)) {\n\t $data = $this->request->data;\n\t }\n\t \n\t //check if product ID was provided\n\t if (!empty($data['id'])) {\n\t \n\t //set the product ID to update\n\t $this->Player->id = $data['id'];\n\t if ($this->Player->save($data)) {\n\t $response = array('status'=>'success','message'=>'Product successfully updated');\n\t } else {\n\t $response['message'] = \"Failed to update product\";\n\t }\n\t } else {\n\t $response['message'] = 'Please provide product ID';\n\t }\n\t }\n\t \n\t $this->response->type('application/json');\n\t $this->response->body(json_encode($response));\n\n\t return $this->response->send();\n\t}", "public function update(Request $request, $id)\n {\n $request->validate([\n 'name' => 'required | min:3 | string',\n 'type' => 'required',\n 'producer' => 'required',\n 'image' => 'image | mimes:png,jpg,jpeg',\n 'price_input' => 'required | numeric | min:0 | max:300000000',\n 'promotion_price' => 'required | numeric | max:300000000',\n 'description' => 'required | string',\n\n ]);\n $product = Product::withTrashed()->findOrfail($id);\n $product->name = $request->name;\n $product->id_type = $request->type;\n $product->id_producer = $request->producer;\n\n $product->amount = $request->amount;\n if (request('image')) {\n $product->image = base64_encode(file_get_contents($request->file('image')->getRealPath()));\n }\n\n $product->price_input = $request->price_input;\n\n if ( $request->promotion_price >= 0 && $request->promotion_price < $product->price_input) {\n $product->promotion_price = $request->promotion_price;\n }else{\n return back()->with('error', '\n Do not enter a negative number');\n }\n $product->new = $request->new;\n\n $product->description = $request->description;\n\n $product->save();\n $product->size()->sync(request('size'));\n\n return redirect()->route('product.index')->with('success', 'Product Updated successfully');\n }", "public function update(Request $request, $id)\n {\n $product = Product::find($id);\n\n $product->name = $request->input('name');\n $product->description = $request->input('description');\n $product->lastPrice = $product->price !== $request->input('price') ? $product->price : NULL;\n $product->price = $request->input('price');\n\n if ($request->hasFile('image')) { \n $currentImg = $product->image;\n if ($currentImg) {\n Storage::delete('/public/' . $currentImg);\n }\n $image = $request->file('image'); \n $path = $image->store('images','public');\n $product->image = $path;\n };\n\n $product->save(); \n\n $product_promotions = $request->input('promotion');\n\n $product->promotions()->sync($product_promotions);\n\n return redirect()->route('admin.modify');\n }", "public static function updateImage($fileName, $imageId, $storage)\n {\n //Get image name and storage location for image\n $image = Image::where('id', '=', $imageId)->first();\n\n //Delete old image\n ResourceHandler::delete($image->name, $image->storage);\n\n //Store the new image\n $image->name = $fileName;\n $image->storage = $storage;\n\n $image->save();\n }", "public function update($request, $id)\n {\n $this->checkExits($id);\n $data = $request->except(['_method','_token','photo']);\n\n if($request->photo)\n {\n try {\n $this->UploadFile($request);\n } catch (\\Exception $e) {\n //if has exception , don't has action\n }\n if ($this->img !== '') {\n $data['img'] = $this->img;\n }\n }\n\n $this->object->update($data);\n\n }", "public function updateProduct($request, $product)\n {\n $product->update($request->except(['_token', '_method', 'image']));\n if ($request->hasFile('image')) {\n $image = $request->file('image');\n $imageName = time() . '.' . $request->file('image')->extension();\n // $img = Image::make('public/foo.jpg');\n\n $image_resize = Image::make($image->getRealPath());\n $image_resize->resize(500, 500);\n $image_resize->save(public_path('images/') . $imageName, 100);\n $product->gallery = $imageName;\n $product->save();\n }\n $product->getTags()->sync($request->input('tags'));\n }" ]
[ "0.74238616", "0.7062842", "0.7057816", "0.6897868", "0.65820867", "0.64505464", "0.6347915", "0.62114644", "0.6145006", "0.61231726", "0.6115922", "0.6100021", "0.6089019", "0.60542375", "0.60187906", "0.6008231", "0.5974106", "0.5944986", "0.59397626", "0.59393746", "0.58937186", "0.58607864", "0.5853811", "0.5853811", "0.58521867", "0.5815276", "0.58061725", "0.57518756", "0.57518756", "0.5736318", "0.57246256", "0.5715636", "0.5696208", "0.5691033", "0.5687788", "0.56692934", "0.56556624", "0.5652178", "0.56494987", "0.5636202", "0.56355816", "0.5632871", "0.563206", "0.56291884", "0.5621382", "0.56087434", "0.5602465", "0.55928403", "0.55825645", "0.55821884", "0.5581833", "0.5576869", "0.55712104", "0.5568173", "0.55648434", "0.5562885", "0.5560537", "0.5560537", "0.5560537", "0.5560537", "0.5560537", "0.55592597", "0.5556131", "0.5555849", "0.5555397", "0.5553912", "0.55530137", "0.5543831", "0.55430055", "0.5540152", "0.5539437", "0.55359006", "0.5535772", "0.5534487", "0.552458", "0.5518245", "0.5515452", "0.55145514", "0.5509227", "0.55079365", "0.55065364", "0.55039924", "0.5501616", "0.5500345", "0.5499738", "0.54980725", "0.5496017", "0.5496017", "0.5494488", "0.5494334", "0.54936594", "0.54934716", "0.5491019", "0.54835314", "0.54795796", "0.5479442", "0.5478275", "0.54646415", "0.54637444", "0.5461914", "0.54562414" ]
0.0
-1
Remove the specified resource from storage.
public function destroy($id) { // }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function delete($resource){\n return $this->fetch($resource, self::DELETE);\n }", "public function destroy(Resource $resource)\n {\n //\n }", "public function removeResource($resourceID)\n\t\t{\n\t\t}", "public function unpublishResource(PersistentResource $resource)\n {\n $client = $this->getClient($this->name, $this->options);\n try {\n $client->delete(Path::fromString($this->getRelativePublicationPathAndFilename($resource)));\n } catch (FileDoesNotExistsException $exception) {\n }\n }", "public function deleteResource(&$resource) {\n\n if ($this->connector != null) {\n $this->logger->addDebug(\"Deleting Resource Node from Neo4J database\");\n $result = $this->connector->run(\"MATCH (a:Resource {id: {id}}) detach delete a;\",\n [\n 'id' => $resource->getID()\n ]\n );\n $this->logger->addDebug(\"Updated neo4j to remove resource\");\n }\n\n }", "public function deleteShopifyResource() {\n $this->getShopifyApi()->call([\n 'URL' => API::PREFIX . $this->getApiPathSingleResource(),\n 'METHOD' => 'DELETE',\n ]);\n }", "public function deleteResource()\n {\n $database = new Database();\n $id = $this->_params['id'];\n $database->deleteResource($id);\n $this->_f3->reroute('/Admin');\n }", "protected function deleteResource($fileName, $storage)\n {\n if (Storage::disk($storage)->exists($fileName)) \n {\n return Storage::disk($storage)->delete($fileName);\n }\n }", "public function delete()\n {\n persistableCollection::getInstance($this->resourceName)->deleteObject($this);\n }", "public function remove()\n {\n $this->_getBackend()->remove($this->_id);\n }", "public function remove()\n {\n if (! ftruncate($this->fileHandle, 0)) {\n throw new StorageException(\"Could not truncate $this->path\");\n }\n if (! unlink($this->path)) {\n throw new StorageException(\"Could not delete $this->path\");\n }\n }", "public function delete()\n\t{\n\t\t$s3 = AWS::createClient('s3');\n $s3->deleteObject(\n array(\n 'Bucket' => $this->bucket,\n 'Key' => $this->location\n )\n );\n\t\tif($this->local_file && file_exists($this->local_file)) {\n\t\t\tunlink($this->local_file);\n\t\t}\n $this->local_file = null;\n\t}", "public function delete()\n\t{\n\t\tsfCore::db->query(\"DELETE FROM `swoosh_file_storage` WHERE `id`='%i';\", $this->id);\n\t\t$this->fFile->delete();\n\t}", "public function delete(): void\n {\n unlink($this->getPath());\n }", "public function delete()\n {\n if($this->exists())\n unlink($this->getPath());\n }", "public function remove($path);", "function deleteFileFromStorage($path)\n{\n unlink(public_path($path));\n}", "public function delete(): void\n {\n unlink($this->path);\n }", "private function destroyResource(DrydockResource $resource) {\n $blueprint = $resource->getBlueprint();\n $blueprint->destroyResource($resource);\n\n $resource\n ->setStatus(DrydockResourceStatus::STATUS_DESTROYED)\n ->save();\n }", "public static function delete($fileName, $storage)\n {\n if (Storage::disk($storage)->exists($fileName)) \n {\n return Storage::disk($storage)->delete($fileName);\n }\n }", "public function remove() {}", "public function remove() {}", "public function remove();", "public function remove();", "public function remove();", "public function remove();", "function delete_resource($resource_id, $page)\n\t{\n\t\t//get resource data\n\t\t$table = \"resource\";\n\t\t$where = \"resource_id = \".$resource_id;\n\t\t\n\t\t$this->db->where($where);\n\t\t$resource_query = $this->db->get($table);\n\t\t$resource_row = $resource_query->row();\n\t\t$resource_path = $this->resource_path;\n\t\t\n\t\t$image_name = $resource_row->resource_image_name;\n\t\t\n\t\t//delete any other uploaded image\n\t\t$this->file_model->delete_file($resource_path.\"\\\\\".$image_name, $this->resource_path);\n\t\t\n\t\t//delete any other uploaded thumbnail\n\t\t$this->file_model->delete_file($resource_path.\"\\\\thumbnail_\".$image_name, $this->resource_path);\n\t\t\n\t\tif($this->resource_model->delete_resource($resource_id))\n\t\t{\n\t\t\t$this->session->set_userdata('success_message', 'resource has been deleted');\n\t\t}\n\t\t\n\t\telse\n\t\t{\n\t\t\t$this->session->set_userdata('error_message', 'resource could not be deleted');\n\t\t}\n\t\tredirect('resource/'.$page);\n\t}", "public function deleteImage(){\n\n\n Storage::delete($this->image);\n }", "public function del(string $resource): bool|string\n {\n $json = false;\n $fs = unserialize($_SESSION['rfe'][$this->getRoot()], ['allowed_classes' => false]);\n if (array_key_exists($resource, $fs)) {\n // if $item has children, delete all children too\n if (array_key_exists('dir', $fs[$resource])) {\n foreach ($fs as $key => $file) {\n if (isset($file['parId']) && $file['parId'] == $resource) {\n unset($fs[$key]);\n }\n }\n }\n unset($fs[$resource]);\n $_SESSION['rfe'][$this->getRoot()] = serialize($fs);\n $json = '[{\"msg\": \"item deleted\"}]';\n }\n return $json;\n }", "public function destroy()\n\t{\n\t\treturn unlink(self::filepath($this->name));\n\t}", "public function destroy($id) {\n $book = Book::find($id);\n // return unlink(storage_path(\"public/featured_images/\".$book->featured_image));\n Storage::delete(\"public/featured_images/\" . $book->featured_image);\n if ($book->delete()) {\n return $book;\n }\n\n }", "public function destroy($id)\n {\n Storageplace::findOrFail($id)->delete();\n }", "public function destroyResourceImage(): void\n\t{\n\t\tif (isset($this->image)) {\n\t\t\t@imagedestroy($this->image->getImageResource());\n\t\t}\n\t}", "public function deleteResource(PersistentResource $resource)\n {\n $pathAndFilename = $this->getStoragePathAndFilenameByHash($resource->getSha1());\n if (!file_exists($pathAndFilename)) {\n return true;\n }\n if (unlink($pathAndFilename) === false) {\n return false;\n }\n Files::removeEmptyDirectoriesOnPath(dirname($pathAndFilename));\n return true;\n }", "public function deleteImage(){\n \tStorage::delete($this->image);\n }", "public function destroy()\n {\n $file=public_path(config('larapages.media.folder')).Input::all()['folder'].'/'.Input::all()['file'];\n if (!file_exists($file)) die('File not found '.$file);\n unlink($file);\n }", "public function delete() \r\n {\r\n if($this->exists())\r\n {\r\n unlink($this->fullName());\r\n }\r\n }", "public function destroy($id)\n {\n Myfile::find($id)->delete();\n }", "public function destroy($delete = false)\n {\n if (null !== $this->resource) {\n $this->resource->clear();\n $this->resource->destroy();\n }\n\n $this->resource = null;\n clearstatcache();\n\n // If the $delete flag is passed, delete the image file.\n if (($delete) && file_exists($this->name)) {\n unlink($this->name);\n }\n }", "public static function delete($path){\r\n $currentDir = getcwd();\r\n $storageSubPath = \"/../../\".STORAGE_PATH;\r\n $file = $currentDir . $storageSubPath . '/' . $path;\r\n\r\n unlink($file);\r\n }", "public function destroy(Storage $storage)\n {\n return redirect()->route('storages.index');\n }", "public function remove() {\n //Check if there are thumbs and delete files and db\n foreach ($this->thumbs()->get() as $thumb) {\n $thumb->remove();\n } \n //Delete the attachable itself only if is not default\n if (strpos($this->url, '/defaults/') === false) {\n Storage::disk('public')->delete($this->getPath());\n }\n parent::delete(); //Remove db record\n }", "public function removeFile($uri){\n return Storage::disk('public')->delete($uri);\n }", "public function destroy(Resource $resource)\n {\n if( $resource->delete() ){\n return Response(['status'=>'success','message'=>'Resource deleted']); \n } else {\n return Response(['status'=>'error', 'message'=>'Something went wrong']);\n }\n }", "public function delete($path);", "public function delete($path);", "public function destroy($id)\n { \n File::find($id)->remove();\n \n return redirect()->route('files.index');\n }", "public function destroy($id)\n {\n $supplier = Supplier::find($id);\n $photo = $supplier->photo;\n if ($photo) {\n unlink($photo);\n }\n $supplier->delete();\n }", "public function destroy($id)\n {\n $student = Student::where('id', $id)->first();\n // $path = $student->image;\n unlink($student->image);\n Student::findOrFail($id)->delete();\n return response('Deleted!');\n }", "public function destroy($id)\n {\n $icon = SliderIcon::find($id);\n if (Storage::disk('public')->exists(str_replace('storage', '', $icon->img))){\n Storage::disk('public')->delete(str_replace('storage', '', $icon->img));\n }\n $icon->delete();\n return redirect()->route('slider_icons.index')->with('success', 'Данные преимущества удалёны');\n }", "public function delete($path, $data = null);", "public function destroy($id)\n {\n $items=Items::find($id);\n // delete old file\n if ($items->photo) {\n $str=$items->photo;\n $pos = strpos($str,'/',1);\n $str = substr($str, $pos);\n $oldFile = storage_path('app\\public').$str;\n File::Delete($oldFile); \n }\n $items->delete();\n return redirect()->route('items.index');\n }", "public function destroy($id)\n {\n $carousel = Carousel::find($id);\n $image = $carousel->image;\n\n $basename ='img/carousel/' . basename($image);\n //Delete the file from disk\n if(file_exists($basename)){\n unlink($basename);\n }\n //With softDeletes, this is the way to permanently delete a record\n $carousel->delete();\n Session::flash('success','Product deleted permanently');\n return redirect()->back();\n }", "public function remove()\n {\n $fs = new Filesystem();\n $fs->remove($this->dir());\n }", "public static function destroy(int $resource_id)\n {\n try {\n $image_data = ListingImage::where('id', $resource_id)->first();\n self::delete_image($image_data->name);\n $delete = ListingImage::where('id', $resource_id)->delete();\n\n // activity()\n // ->causedBy(Auth::user()->id)\n // ->performedOn($delete)\n // ->withProperties(['id' => $delete->id])\n // ->log('listing image deleted');\n return response()->json(['status'=> 'ok', 'msg'=> 'Data deleted successfully']);\n } catch (Exception $e) {\n $e->getMessage();\n }\n }", "public function destroy(Storage $storage)\n {\n $this->storage->destroy($storage);\n\n return redirect()->route('admin.product.storage.index')\n ->withSuccess(trans('core::core.messages.resource deleted', ['name' => trans('product::storages.title.storages')]));\n }", "public function del($path){\n\t\treturn $this->remove($path);\n\t}", "public function destroy($id)\n {\n //\n $product = Product::findOrFail($id);\n $product->delete();\n if($product->img != 'product-default.png'){\n Storage::delete(\"public/uploads/\".$product->img);\n // return 'deleted';\n }\n return redirect()->route('product.index'); \n }", "public function removeUpload()\n{\n if ($file = $this->getAbsolutePath()) {\n unlink($file); \n }\n}", "public function destroy($id)\n {\n $image = Images::withTrashed()->find($id);\n\n Storage::disk('uploads')->delete(\"social-media/$image->filename\");\n\n $image->tags()->detach();\n $image->detachMedia(config('constants.media_tags'));\n $image->forceDelete();\n\n return redirect()->back()->with('success', 'The image was successfully deleted');\n }", "public function destroyByResourceId($resource_id)\n {\n// $online_party = $this->onlinetrack->where('resource_id', $resource_id)->get()->first();\n// $online_party->status = \"offline\";\n// $online_party->save();\n// return $online_party;\n return $this->onlinetrack->where('resource_id', $resource_id)->delete();\n }", "public function revoke($resource, $permission = null);", "public function destroy($id)\n {\n $data=Image::find($id);\n $image = $data->img;\n\n\n $filepath= public_path('images/');\n $imagepath = $filepath.$image;\n\n //dd($old_image);\n if (file_exists($imagepath)) {\n @unlink($imagepath);\n }\n\n\n $data->delete();\n\n return redirect()->route('image.index');\n }", "function delete($path);", "public function removeItem(int $id)\n\t{\n\t\t$this->storage->remove($id);\n\t}", "public function destroy(File $file)\n {\n //\n $v = Storage::delete($file->path);\n \n }", "public function destroyResource($resource)\n {\n if (!is_object($resource)) {\n return false;\n }\n\n $resource_type = get_class($resource);\n $resource_id = $resource->getKey();\n\n return Role::where('resource_type', $resource_type)\n ->where('resource_id', $resource_id)\n ->delete();\n }", "public function remove($filePath){\n return Storage::delete($filePath);\n }", "public function remove(): void\n {\n $file = $this->getAbsolutePath();\n if (!is_file($file) || !file_exists($file)) {\n return;\n }\n\n unlink($file);\n }", "public function destroy(Request $request, Storage $storage)\n {\n $storage->delete();\n $request->session()->flash('alert-success', 'Запись успешно удалена!');\n return redirect()->route('storage.index');\n }", "public function remove(Storable $entity): Storable\n {\n $this->getRepository(get_class($entity))->remove($entity);\n $this->detach($entity);\n\n return $entity;\n }", "public function processDeletedResource(EntityResource $resource)\n {\n /** @var AuthorizationRepository $repository */\n $repository = $this->entityManager->getRepository('Edweld\\AclBundle\\Entity\\Authorization');\n\n $repository->removeAuthorizationsForResource($resource);\n }", "function _unlink($resource, $exp_time = null)\n {\n if(file_exists($resource)) {\n return parent::_unlink($resource, $exp_time);\n }\n\n // file wasn't found, so it must be gone.\n return true;\n }", "public function remove($id);", "public function remove($id);", "public function deleted(Storage $storage)\n {\n //\n }", "public function destroy($id)\n {\n $data = Product::findOrFail($id);\n\n if(file_exists('uploads/product/'.$data->image1)){\n unlink('uploads/product/'.$data->image1);\n }\n\n if(file_exists('uploads/product/'.$data->image2)){\n unlink('uploads/product/'.$data->image2);\n }\n\n if(file_exists('uploads/product/'.$data->image3)){\n unlink('uploads/product/'.$data->image3);\n }\n $data->delete();\n }", "public function removeUpload()\n {\n $file = $this->getAbsolutePath();\n if ($file) {\n unlink($file);\n }\n }", "public function resources_delete($resource_id, Request $request) {\n if ($resource_id) {\n $resp = Resources::where('id', '=', $resource_id)->delete();\n if($resp){\n $msg = 'Resource has been deleted successfully.';\n $request->session()->flash('message', $msg);\n }\n }\n //return redirect()->route('admin-factor-list');\n return redirect()->to($_SERVER['HTTP_REFERER']);\n }", "public function delete()\n {\n try\n {\n $thumbnail = $this->getThumbnail();\n if($thumbnail)\n {\n $thumbnail->delete();\n }\n }\n catch(sfException $e){}\n \n // delete current file\n parent::delete();\n }", "function deleteResource($uuid){\n $data = callAPI(\"DELETE\",\"/urest/v1/resource/\".$uuid);\n return $data;\n}", "public function delete();", "public function delete();", "public function delete();", "public function delete();", "public function delete();", "public function delete();", "public function delete();", "public function delete();", "public function delete();", "public function delete();", "public function delete();", "public function delete();", "public function delete();", "public function delete();", "public function delete();", "public function remove_resource($idproject){\n\t\t\n\t\t// Load model and try to get project data\n\t\t$this->load->model('Projects_model', 'projects');\n\t\t\n\t\t// Update\n\t\t$this->projects->save_project(array(\"ext\" => \"\", \"vzaar_idvideo\" => \"0\", \"vzaar_processed\" => \"0\"), $idproject);\n\t}", "public function destroy($id){\n $file_data = Slider::findOrFail($id);\n File::delete(public_path('../storage/app/public/sliders/'.$file_data->path));\n $slider = Slider::destroy($id);\n return response()->json(null, 204);\n }", "public function delete()\n\t{\n\t\t@unlink($this->get_filepath());\n\t\t@unlink($this->get_filepath(true));\n\t\tparent::delete();\n\t}", "public function delete($resource_path, array $variables = array()) {\n return $this->call($resource_path, $variables, 'DELETE');\n }", "public function destroy($id)\n {\n //Find Slider With Id\n $slider = Slider::findOrFail($id);\n // Check If The Image Exist\n if(file_exists('uploads/slider/'.$slider->image)){\n\n unlink( 'uploads/slider/'.$slider->image);\n }\n $slider->delete();\n return redirect()->back()->with('success','Slider Successfully Deleted');\n }" ]
[ "0.6672584", "0.6659381", "0.6635911", "0.6632799", "0.6626075", "0.65424126", "0.65416265", "0.64648265", "0.62882507", "0.6175931", "0.6129922", "0.60893893", "0.6054415", "0.60428125", "0.60064924", "0.59337646", "0.5930772", "0.59199584", "0.5919811", "0.5904504", "0.5897263", "0.58962846", "0.58951396", "0.58951396", "0.58951396", "0.58951396", "0.5880124", "0.58690923", "0.5863659", "0.5809161", "0.57735413", "0.5760811", "0.5753559", "0.57492644", "0.5741712", "0.57334286", "0.5726379", "0.57144034", "0.57096", "0.5707689", "0.5705895", "0.5705634", "0.5703902", "0.5696585", "0.5684331", "0.5684331", "0.56780374", "0.5677111", "0.5657287", "0.5648262", "0.5648085", "0.5648012", "0.5640759", "0.5637738", "0.5629985", "0.5619264", "0.56167465", "0.5606877", "0.56021434", "0.5601949", "0.55992156", "0.5598557", "0.55897516", "0.5581397", "0.5566926", "0.5566796", "0.55642897", "0.55641", "0.5556583", "0.5556536", "0.5550097", "0.5543172", "0.55422723", "0.5540013", "0.5540013", "0.55371785", "0.55365825", "0.55300397", "0.552969", "0.55275744", "0.55272335", "0.55271083", "0.55271083", "0.55271083", "0.55271083", "0.55271083", "0.55271083", "0.55271083", "0.55271083", "0.55271083", "0.55271083", "0.55271083", "0.55271083", "0.55271083", "0.55271083", "0.55271083", "0.5525997", "0.5525624", "0.5523911", "0.5521122", "0.5517412" ]
0.0
-1
/ | | Main Controller | | | This controller handles general requests that are not reflected in other | controllers. | Show the main template view and make all appropriate/needed settings.
public function index() { $imagesArray = glob(config('media.imagesPath').'*.*'); if (count($imagesArray) > 0) { foreach ($imagesArray as $key => $image) { $imagesArray[$key] = substr($image, strlen(config('media.imagesPath'))); } } return view('index', [ 'imagesArray' => $imagesArray ]); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function index() {\n\n\t\t\t$controller = $this->nav->getPageController();\n\t\t\tif(isset($controller) && is_object($controller)) {\n\t\t\t\tassert($controller instanceof \\Toeswade\\IController);\n\n\t\t\t\t$action = $this->nav->getPageAction();\n\t\t\t\t$params = $this->nav->getParams();\n\t\t\t\t\n\t\t\t\tif(isset($action)) {\n\t\t\t\t\t$view = $controller->$action($params);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\t$view = $controller->index();\n\t\t\t\t}\n\n\t\t\t\tassert($view instanceof \\Toeswade\\IView);\n\t\t\t\t$main = $view->getHTML();\n\t\t\t\t$title = $view->getTitle();\n\n\t\t\t}\n\n\t\t\telse {\n\t\t\t\t$main = 'default';\n\t\t\t\t$title = $main;\n\t\t\t}\n\t\t\t$this->view->setTitle($title);\n\t\t\t$this->view->setMain($main);\n\t\t\t$this->view->setNav($this->nav->getMainNavigation());\n\n\t\t\t$this->view->render();\n\t\t}", "protected function main() {\n $this->ControllerView->mainpage();\n }", "public function index() {\n\t $this->registry->template->show();\n\t}", "function index()\n {\n //call some deafaults not to spoil template\n $data=$this->default_data();\n $this->template($data);\n\n }", "function index() {\n\t\t$this->load->view('main_view.php');\n\t}", "function index(){\n\t\t$this->template->run();\n\t}", "public function mainAction() {\n\t\t$this->setView('include/timer-form.php');\n\t\t$this->view();\n\t}", "public function index() {\n // navbar, {body} and footer. NOTE: {body} is the view referenced in $this->uri->segment(1) \n // If no value exists we send dashboard to take us back to the index page\n $this->data['modal'] = TRUE;\n $this->load->library('template',$this->data);\n $this->template->load_page($this->data);\n }", "function index(){\n\n global $wear;\n $template = $this->loadView($wear->front . \"/index\");\n $template->set(\"page\" , SITE_NAME . \" | Home\");\n $template->render(); \n\n }", "function index()\r\n\t{\r\n\t\t$this->view(); \r\n\t}", "public function indexAction()\n {\n // STAGE 3: Choose, create, and optionally update models using business logic.\n if (false === strpos($this->view->baseUrl, '/index.php')) {\n $this->view->baseUrl .= '/index.php';\n }\n // STAGE 4: Apply business logic to create a presentation model for the view.\n // STAGE 5: Choose view and submit presentation model to view.\n\n $this->renderToSegment('body');\n }", "function startup_view()\n\t{\n\t\t$data['error_msg'] = $this->error_msg;\n\t\t$response_body = $this->template_html($this->html_template_path,$data);\n\t\t$this->return_response($response_body);\n\t}", "public function indexAction() {\r\n\r\n// NSP::$app->registry->view->welcome = 'Welcome to NSP MVC';\r\n//\r\n// /*** load the index template ***/\r\n NSP::$app->view->viewVar = 'Rest controller';\r\n NSP::$app->registry->get('view')->show('index');\r\n }", "protected function controller()\n {\n // TODO refactor this into pure Latte\n if (\n array_key_exists('table', $this->get) && !empty($this->get['table']) && (bool) $this->tableAdmin->getTable()\n ) {\n if (!array_key_exists('table', $this->renderParams) || !is_array($this->renderParams['table'])) {\n $this->renderParams['table'] = [];\n }\n if (isset($this->get['where']) && is_array($this->get['where'])) {\n $this->renderParams['table']['outputTableAfterEdit'] = $this->outputTableAfterEdit();\n } elseif (!isset($_POST['edit-selected']) && !isset($_POST['clone-selected'])) {\n $this->renderParams['table']['outputTableBeforeListing'] = $this->outputTableBeforeListing();\n }\n }\n\n // changes of inherited Lattes MUST be done before invoking the parent::controller();\n parent::controller(); // selects $this->template according to $myCmsConfAdmin['get2template']\n if (!isset($_SESSION['user'])) { // todo explore if it is sufficient for auth - consider (bool) $this->authUser\n //$this->template = 'admin-login'; //ready\n //todo MOVE THIS to parent\n// unset($this->get['table'], $this->get['media'], $this->get['user']); // security by design\n $this->get[] = []; // security by design\n $this->renderParams['htmlOutput'] = $this->outputLogin();\n return; //harden auth security TODO explore security that no other conditions will be allowed if !user\n }\n\n // TODO check whether unavailable for anonymous users!\n switch ($this->template) {\n case 'Admin/divisions-products':\n $this->renderParams['pageTitle'] = $this->tableAdmin->translate('Divisions and products');\n if (\n isset($this->featureFlags['legacy_admin_methods_instead_of_admin_models']) &&\n $this->featureFlags['legacy_admin_methods_instead_of_admin_models']\n ) {\n // legacy since 220620\n $this->renderParams['htmlOutput'] = $this->projectSpecificSections(); // in the Admin\n } else {\n $adminModel = new AdminModels\\DivisionsProductsAdminModel(\n $this->MyCMS->dbms,\n $this->tableAdmin\n );\n $this->renderParams['htmlOutput'] = $adminModel->htmlOutput();\n }\n break;\n case 'Admin/pages':\n $this->renderParams['pageTitle'] = $this->tableAdmin->translate('Pages');\n if (\n isset($this->featureFlags['legacy_admin_methods_instead_of_admin_models']) &&\n $this->featureFlags['legacy_admin_methods_instead_of_admin_models']\n ) {\n // legacy since 220620\n $this->renderParams['htmlOutput'] = $this->projectSpecificSections(); // in the Admin\n } else {\n $adminModel = new AdminModels\\PagesAdminModel(\n $this->MyCMS->dbms,\n $this->tableAdmin\n );\n $this->renderParams['htmlOutput'] = $adminModel->htmlOutput();\n }\n break;\n case 'Admin/products':\n $this->renderParams['pageTitle'] = $this->tableAdmin->translate('Products');\n if (\n isset($this->featureFlags['legacy_admin_methods_instead_of_admin_models']) &&\n $this->featureFlags['legacy_admin_methods_instead_of_admin_models']\n ) {\n // legacy since 220620\n $this->renderParams['htmlOutput'] = $this->projectSpecificSections(); // in the Admin\n } else {\n $adminModel = new AdminModels\\ProductsAdminModel(\n $this->MyCMS->dbms,\n $this->tableAdmin,\n $this->MyCMS->logger\n );\n $this->renderParams['htmlOutput'] = $adminModel->htmlOutput();\n }\n break;\n case 'Admin/translations':\n $this->renderParams['pageTitle'] = $this->tableAdmin->translate('Translations');\n if (\n isset($this->featureFlags['legacy_admin_methods_instead_of_admin_models']) &&\n $this->featureFlags['legacy_admin_methods_instead_of_admin_models']\n ) {\n // legacy since 220620\n $this->renderParams['htmlOutput'] = $this->projectSpecificSections(); // in the Admin\n } else {\n $adminModel = new TranslationsAdminModel(\n $this->MyCMS->dbms,\n $this->tableAdmin,\n $this->prefixUiL10n\n );\n $this->renderParams['htmlOutput'] = $adminModel->htmlOutput();\n }\n break;\n case 'Admin/urls':\n $this->renderParams['pageTitle'] = $this->tableAdmin->translate('URL');\n if (\n isset($this->featureFlags['legacy_admin_methods_instead_of_admin_models']) &&\n $this->featureFlags['legacy_admin_methods_instead_of_admin_models']\n ) {\n // legacy since 220620\n $this->renderParams['htmlOutput'] = $this->projectSpecificSections(); // in the Admin\n } else {\n $adminModel = new UrlsAdminModel(\n $this->MyCMS->dbms,\n $this->tableAdmin\n );\n $this->renderParams['htmlOutput'] = $adminModel->htmlOutput();\n }\n break;\n }\n }", "function index() {\n\n $this->view->render();\n\n }", "public function index()\n\t{\n $this->view->render();\n\t}", "public function index() {\n\t\t// render the view (/view/main/index.php)\n\t\t$this->view->render(\"main\", \"index\");\n\t}", "public function Index (){\n $userID = 1;\n\n\t\t$data = [\n 'userID' => $userID,\n 'tasks' => $this->TaskModel->userTasks($userID),\n\t\t\t'exampleVar' => 'I am enexample'\n\t\t];\n\n\t\t//Pulls the view from www/views/main/\n\t\t$this->app->render('mainViews/main.twig', $data);\n $this->app->render('mainViews/login.twig');\n $this->app->render('mainViews/register.twig');\n\t}", "public function mainAction(){\n \n $site = new model\\siteModel();\n $site->set_headerTitle(\"Levi DeHaan\");\n \n $site->set_menu(array(\"Home\"=>\"#/home\", \"Projects\"=>\"#/projects\"));\n $site->set_leftTitle(\"Programmer/Sys Admin\");\n $site->set_leftBody(\"Self taught, motivated, leader of silent ninja code assasins and cats.\");\n $site->set_rightTitle(\"Ninjas and Dragons\");\n $site->set_rightBody(\"The Awesome Starts Here\");\n $site->set_body(\"There are words here\");\n $site->set_footer(\"Levi DeHaan\");\n \n \n $this->headerTitle = $site->get_headerTitle();\n $this->menu = $site->get_menu();\n $this->leftTitle = $site->get_leftTitle();\n $this->leftBody = $site->get_leftBody();\n $this->rightTitle = $site->get_rightTitle();\n $this->rightBody = $site->get_rightBody();\n $this->body = $site->get_body();\n $this->footer = $site->get_footer();\n }", "public function indexAction () {\r\n $this->_helper->viewRenderer->setNoRender(false);\r\n $this->_helper->layout()->enableLayout();\r\n $this->view->assign('controller', $this->_request->getControllerName());\r\n $this->view->assign('module', $this->_request->getModuleName());\r\n }", "function controller()\n\t\t{\t\n\t\t\t$this->admin_page_header();\n\t\t\t$this->admin_menu();\n\t\t}", "public function indexAction() {\n \n $view = new ViewModel(); \n $view->setTemplate('templates/orion/generic.phtml');\n $view->setTerminal(true); \n\n return $view;\n \n \n }", "public function admin_page() {\n echo $this->generateView('main', []);\n }", "public function indexAction()\n {\n// $this->view = 'index';\n }", "function index() {\n \n parent::index();\n\n\t\t$data['user_id'] = $this->tank_auth->get_user_id();\n\t\t$data['username'] = $this->tank_auth->get_username();\n\t\t$data['main_content_view'] = $this->load->view('welcome', $data, true);\n $this->render_template($data);\n\t}", "function __handler()\n {\n $this->view('index')->title('Main page');\n }", "public function index()\n {\n $main_view = 'kelas/index';\n $this->load->view('template',compact('main_view'));\n }", "public function index() {\n\t\t\n\t\tif($this->secureCheck()){\n\t\t\treturn;\n\t\t}\n\t\t\n\t\t\n\t\t$navBar = $this->navBar();\n\n\t\t$this->generateView ( array (\n\t\t\t\t'navBar' => $navBar\n\t\t) );\n\t}", "public function index()\n {\n return view('main');\n }", "public function index()\n {\n return view('main');\n }", "public function index()\n {\n return view('main');\n }", "public function index()\n\t{\n\t\t$this->load->view('common/header');\n\t\t$this->load->view('common/topmenu');\n\t\t$this->load->view('common/content');\n\t\t$this->load->view('common/footer');\n\t}", "public function index()\n {\n $data['main_template'] = 'index';\n $data['page_title'] = 'Refinance Apps (RAPPS)';\n $data['google_adsense'] = 'display'; // null value untuk disable paparan google adsense or Display utk paparkan\n $this->load->view('main_template', $data);\n }", "function Controller()\n\t{\t\t\n\t\t$this->method = \"showView\";\n\t\tif (array_key_exists(\"method\", $_REQUEST))\n\t\t\t$this->method = $_REQUEST[\"method\"];\n\t\t\t\t\n\t\t$this->icfTemplating = new IcfTemplating();\n\t\t$this->tpl =& $this->icfTemplating->getTpl();\n\t\t$this->text =& $this->icfTemplating->getText();\t\t\n\t\t$this->controllerMessageArray = array();\n\t\t$this->pageTitle = \"\";\n\t\t$this->dateFormat = DateFormatFactory::getDateFormat();\n\t\t$this->controllerData =& $this->newControllerData();\n\t}", "public function indexAction()\n {\n $this->render('/views/index.html');\n }", "public function index()\n\t{\n\t\t$data = array();\n\t\t$model_data\t\t\t=\tarray();\n\t\t\n\t\t$model_data['model_list']\t=\t$this->model_model->get_all_models();\n\n $data['navigation'] = $this->load->view('template/navigation','',TRUE);\n $data['content'] = $this->load->view('pages/model/model',$model_data,TRUE);\n $data['footer'] = $this->load->view('template/footer','',TRUE);\n\t\t$this->load->view('template/main_template',$data);\n\t}", "public function index(){\t\n\t\t// var_dump('vchxhh');\n\n\t\t$page_model = new \\Models\\Page;\n\t\t$page_model->cmsPage();\n\t\t$this->data['page_title'] = \\Models\\Page::$pageName;\n\n\t\t$this->data['pagename'] = \\Models\\Page::$pageName;\n\t\t$this->data['subname'] = \\Models\\Page::$subName;\n\t\t$this->data['pagedetails'] = \\Models\\Page::$pagedetails;\n\n\t\tswitch (\\Models\\Page::$controller) {\n\t\t\tcase 'contact-us':\n\t\t\t\tUrl::redirect('page/contact');\n\t\t\t\tbreak;\n\t\t\t\n\t\t\tdefault:\n\t\t\t\t# code...\n\t\t\t\tbreak;\n\t\t}\n\n\t\tView::renderTemplate('header',$this->data);\n\t\tView::render('page/page.index',$this->data);\n\t\tView::renderTemplate('footer',$this->data);\n\t}", "public function index()\n {\n\n\n $this->view->render();\n }", "public function Index()\n\t{\n\t\t$this->views->SetTitle('Index Controller');\n\t\t$this->views->AddView('index/index.tpl.php', array(),'primary');\n\t}", "function index()\n {\n\n //profiling\n $this->data['controller_profiling'][] = __function__;\n\n //login check\n $this->__commonClient_LoggedInCheck();\n\n //uri - action segment\n $action = $this->uri->segment(3);\n\n //default page titles\n $this->data['vars']['main_title'] = '';\n $this->data['vars']['main_title_icon'] = '';\n\n $this->data['vars']['sub_title'] = $this->data['lang']['lang_users'];\n $this->data['vars']['sub_title_icon'] = '<i class=\"icon-group\"></i>';\n\n //re-route to correct method\n switch ($action) {\n\n case 'view':\n $this->__clientUsers();\n break;\n\n case 'add-user':\n $this->__addUser();\n break;\n\n case 'edit-modal':\n $this->__editUserModal();\n break;\n\n default:\n $this->__clientUsers();\n\n }\n\n //load view\n $this->__flmView('admin/main');\n\n }", "public function index()\r\n {\r\n\r\n $template_file = DX_ROOT_DIR . $this->views_dir . 'index.php';\r\n\r\n // include_once DX_ROOT_DIR . '/views/layouts/' . $this->layout;\r\n }", "function index()\n {\n\n //profiling\n $this->data['controller_profiling'][] = __function__;\n\n //login check\n $this->__commonAdmin_LoggedInCheck();\n\n //uri - action segment\n $action = $this->uri->segment(4);\n\n //default page title\n $this->data['vars']['main_title'] = $this->data['lang']['lang_settings_company'];\n\n //re-route to correct method\n switch ($action) {\n case 'edit':\n $this->__editSettings();\n break;\n\n case 'view':\n $this->__viewSettings();\n break;\n\n default:\n $this->__viewSettings();\n }\n\n //css - active tab\n $this->data['vars']['css_active_tab_company'] = 'tab-active';\n\n //load view\n $this->__flmView('admin/main');\n\n }", "public function index()\n\t{\n\n\t$this->load->view('layout/header');\n\t$this->load->view('layout/menu');\n\t$this->load->view('Panel/seo/seo_view');\n\t$this->load->view('layout/footer');\n\n\t}", "public function indexAction()\n\t{\n\t\t$this->view->helloWorld = \"Howdy All!\";\n\t}", "public function mainWindowAction(){\n\t\tView::renderTemplate('MenuGlowne/mainWindow.html');\n\t}", "function index()\n {\n\n /* --------------URI SEGMENTS---------------\n * [segment example]\n * /admin/files/2/view/*.*\n * (2)->controller\n * (3)->project_id\n * (4)->router\n ** -----------------------------------------*/\n\n //profiling\n $this->data['controller_profiling'][] = __function__;\n\n //login check\n $this->__commonAdmin_LoggedInCheck();\n\n //get project id\n $this->project_id = $this->uri->segment(3);\n\n //set project_id for global use in template\n $this->data['vars']['project_id'] = $this->project_id;\n\n //check if project exists & set some basic data\n $this->__commonAll_ProjectBasics($this->project_id);\n\n //get the action from url\n $action = $this->uri->segment(4);\n\n //route the request\n switch ($action) {\n\n case 'view':\n $this->__viewNotes();\n break;\n\n case 'edit':\n $this->__editNotes();\n break;\n\n case 'update':\n $this->__updateNotes();\n break;\n\n default:\n $this->__viewNotes();\n break;\n }\n\n //css - active tab\n $this->data['vars']['css_active_tab_mynotes'] = 'side-menu-main-active';\n\n //load view\n $this->__flmView('admin/main');\n\n }", "public function actionIndex() {\n $view_str = $this->renderView('index.php');\n return $view_str;\n \n //uncomment and edit the line below to incorporate the view above into your app's template\n //return $this->renderLayout( 'main-template.php', ['content'=>$view_str] );\n }", "public function indexAction()\n\t{\n\t\t$this->loadLayout();\n\t\t$this->renderLayout();\n\t\t\n\t}", "public function index() {\n $data['subview'] = 'admin/rfp/index';\n $this->load->view('admin/layouts/layout_main', $data);\n }", "public function view() {\n $this->view->data['view'] = 'hehe';\n /*** load the index template ***/\n $this->view->show('index/view');\n }", "public function index() {\n\n // workflow:\n // load and check whether logged.\n // if logged in: load the console page (need special header?)\n // else load the login page (need separate login page)\n\n\t\tif ($this->_isAuthenticated()) {\n\n \t\t// load the console views\n $this->console();\n\n\t\t} else {\n\n // load the login view\n $this->login();\n\n }\n\n\t}", "public function index()\n {\n $this->view();\n }", "public function index()\n {\n $this->view();\n }", "public function TemplateController($page){\n\t\t\n\t\t//Allow Plugins.\n\t\tObservable::Observable();\n\t\t\n\t\t//Setup basic variables\n\t\t$this->varSetup();\n\t\t\n\t\t//Sets the name of the other classes\n\t\t$this->setSystem(\"Template\");\n\t\t\n\t\t//Setup the page\n\t\t$this->setup(\"Change Your Template\");\n\t\t\n\t\t//Set to Administration template\n\t\t$this->getView()->setTemplate(\"admin\");\n\t\t\n\t\t//Check for Plugins\n\t\t$this->loadPlugins();\n\t\t\n\t\t//Set the requests accepted\n\t\t$this->putRequests();\n\t\t\n\t\t//Process Request\n\t\t$this->processRequest();\n\t\t\n\t\t//Render the page\n\t\t$this->displayPage();\n\t}", "public function indexAction(){\n\t\t$this->loadLayout();\n $this->renderLayout();\r\n\t}", "function viewMain() {\n\t$view = new viewModel();\n\t$view->showMain();\t\n}", "public function index() {\n\n $template['main'] = $this->info->module_menu;\n $template['perm'] = $this->perm;\n $template['sub'] = $this->info->function_menu;\n $template['page'] = 'Banners/banners_view';\n $template['page_title'] = \"View Banners\";\n $template['page_data'] = $this->info;\n $template['data'] = $this->Banners_model->get_banners();\n $this->load->view('template',$template);\n }", "public function index()\n\t{\n\t\t//$this->load->view('partials/header');\n $this->load->view('admin/login');\n //$this->load->view('partials/footer');\n\t}", "public function main()\n\t{\n\t\treturn View::make('aircraft/main')\n\t\t->with('PageName','Aircraft')\n\t\t->with('active','aircraft')\n\t\t->with('personnel', parent::getPersonnelInfo())\n\t\t->with('dates',parent::dates())\n\t\t->with('months',parent::months())\n\t\t->with('years',parent::years())\n\t\t;\n\t}", "public function view()\n {\n $this->processParametersForView();\n \n if ($this->view === 'main/base') { //Legacy and body\n extract($this->data);\n \n include(__DIR__ . '/../View/' . $this->view . '.php');\n \n return;\n }\n \n //Templates\n $this->latteView();\n }", "public function main()\n {\n return view('landing.main');\n }", "public function index()\n {\n $main = Main::first();\n return view('pages.main',compact('main'));\n }", "function index() {\n $this->renderView(\"index\");\n }", "public function indexAction() {\n $this->view->render('home/index'); //path from the view folder\n //we already have view because it's set up in the parent, render is from view\n }", "private static function view(): void\n {\n Debug::setBacklog();\n\n /**\n * Calls the methods to define and validate the template and view files.\n */\n self::viewCheckTemplateFile();\n self::viewDefineViewPath();\n self::viewCheckFileExists();\n\n /**\n * Calls the method that will import the template file to be returned to the request.\n */\n self::viewRequireTemplate(\n new ViewHelper(\n self::$routeController->getResultData(),\n self::$viewPath\n ),\n );\n }", "public function defaultAction()\n {\n $this->templatelang->load($this->_controller.'.'.$this->_action);\n\n // Rendering view page\n $this->_view();\n }", "public function index()\n\t\n\t{\n\t $this->load->view('Head');\n\t $this->load->view('content');\n\t $this->load->view('foot');\n\t}", "public function index_hmvc()\n\t{\n\t\tLoad::template(\"Header\");\n\t\tLoad::view(\"Homepage\", \"Index\");\n\t\tLoad::template(\"Footer\");\n\t}", "function index() {\n $template = $this->loadView(\"home/index\");\n $template->set('name', 'Jonh Doe');\n $template->render();\n }", "public function Index() {\n $content = new CMContent();\n $modules = new CMModules();\n $controllers = $modules->AvailableControllers();\n $this->views->SetTitle('Sida')\n ->AddInclude(__DIR__ . '/index.tpl.php', array(\n 'content' => null,\n ), 'primary')\n ->AddInclude(__DIR__ . '/../adminsidebar.tpl.php', array('is_authenticated'=>$this->user['isAuthenticated'], \n 'user'=>$this->user,'controllers'=>$controllers,'contents'=>$content->ListAll(array('type'=>'post', 'order-by'=>'title', 'order-order'=>'DESC')),), 'sidebar');\n }", "public function index()\n\n {\n $main = Main::first();\n return view('pages.main',compact('main'));\n }", "public function indexAction() {\r\n\r\n $this->loadLayout();\r\n $this->renderLayout();\r\n }", "public static function view() \n {\n $articleDAO = new ArticleDAO();\n $articles = $articleDAO->load();\n\n $dispatch = new Dispatch();\n $dispatch->render(\n 'main_page', [\n 'articles' => $articles\n ]\n );\n }", "function index(){\n\t\t$data['page_name'] = 'An example of bitrix24 cloud application on REST api';\n\t\t$user_name = $this->model->get_current_user_name();\n\t\tif($user_name){\n\t\t\t$data['user_name'] = $user_name;\n\t\t}\n\t\t$this->html = $this->model->load_view('example', $data);\n\t\t$this->output();\n\t}", "public function main()\n {\n return view('layouts.master');\n\n }", "public function defaultView(){\n $this->view->render('index');\n }", "public function index()\n\t{\n\t\t//Default view\n\t\t$this->load->view('index.html');\n\t}", "public function index()\n\t{\t\t\n\t\t$data['title']=\"Welcome to iTEP :: Dashboard Page\";\n\t\tloadtemplate('dashboard_view',$data);\n\t}", "public function index()\n\t{\t\n $page = 'rka/main';\n if ( ! file_exists(APPPATH.'views/pages/'.$page.'.php'))\n {\n // Whoops, we don't have a page for that!\n show_404();\n }\n\n $data['title'] = \"Rencana Kerja Anggaran | MPO 2017\"; // Capitalize the first letter\n\n $this->load->view('templates/header', $data);\n $this->load->view('pages/'.$page, $data);\n $this->load->view('templates/footer', $data);\n\t}", "public function index()\n {\n Template::render();\n }", "public function index()\n {\n Template::render();\n }", "public function index()\n\t{\n\t\n\t\t$data['meta_title'] = \"Clinical\";\n\t\t$data['page'] = \"clinical\";\n\t\t$this->load->view('tpl', $data);\n\t}", "public function index()\n {\n $this->request->getSession()->write('DialogTitle', 'Yeah Man!!');\n\n // Set the layout\n $this->viewBuilder()->setLayout('empty');\n\n $this->set('csrfToken', $this->request->getAttribute('csrfToken'));\n\n $this->set('jaxonCss', $this->Jaxon->css());\n $this->set('jaxonJs', $this->Jaxon->js());\n $this->set('jaxonScript', $this->Jaxon->script());\n $this->set('pageTitle', \"Cake Framework\");\n $this->set('menuEntries', []);\n $this->set('menuSubdir', '');\n // Jaxon request to the Jaxon\\App\\Test\\Bts controller\n $this->set('bts', $this->Jaxon->request(\\Jaxon\\App\\Test\\Bts::class));\n // Jaxon request to the Jaxon\\App\\Test\\Pgw controller\n $this->set('pgw', $this->Jaxon->request(\\Jaxon\\App\\Test\\Pgw::class));\n $this->render('demo');\n }", "public function index()\n\t{\n\t\t$this->loadViews(\"index\");\n\t}", "public function index()\n {\n $content = array();\n\n //default content\n $content['headmenu'] = $this->load->view('template/headmenu', NULL, TRUE);\n $content['footer'] = $this->load->view('template/footer', NULL, TRUE);\n $content['lib_js'] = $this->load->view('template/init_js', $this->active_menu, TRUE);\n\n //content\n $content['page_title'] = 'Master Location';\n $content['content_title'] = 'Master Location';\n if (!$this->check_session->check_module($this->active_menu)) {\n $content['maincontent'] = $this->load->view('template/v_forbidden', NULL, TRUE);\n } else {\n $content['maincontent'] = $this->load->view('v_index', NULL, TRUE);\n $content['maincontent_script'] = $this->load->view('v_script', NULL, TRUE);\n }\n\n $this->load->view('template/v_base', $content);\n }", "function index( $data = array() ) {\n\n/* ... define values for template variables to display on page */\n if (!array_key_exists( \"title\", $data )) {\n $data['title'] = \"Playoffs - \".$this->config->item( 'siteName' );\n }\n\n/* ... set the name of the page to be displayed */\n if (!array_key_exists( \"main\", $data )) {\n $data['main'] = \"schedule/sched_tournamentMaster\";\n }\n\n/* ... determine which view for the small left hand contextual navigation menu */\n if (array_key_exists( 'UserId', $_SESSION )) {\n $data['contextNav'] = \"loggedIn\";\n }\n else {\n $data['contextNav'] = \"loggedOut\";\n }\n\n/* ... enable our template variables and then display the template, as we want it shown */ \n $this->load->vars( $data );\n $this->load->view( \"template\" );\n\n/* ... time to go */\n return;\n }", "public function index() {\n $data = array();\n $data['leftside'] = $this->load->view('template/asideleft', $data, true);\n $this->load->view('template/base', $data);\n }", "public function mainpage()\n {\n return view('admin.adminmainpage');\n }", "public function run()\n {\n $this->runAction();\n\n $this->view->setTemplate($this->request->getRequestedResource() . DIRECTORY_SEPARATOR . $this->getTemplateName() . '.twig');\n }", "public function indexAction()\n {\n $this->loadLayout();\n $this->renderLayout();\n }", "function index()\n {\n $data['_view'] = 'notas/index';\n $this->load->view('layouts/main',$data);\n }", "public function actionIndex()\r\n\t{\r\n\t\t//echo 'domain:' , Ps_Core::$domain, ' mainDomain:', Ps_Core::$mainDomain, ' subDomain:', Ps_Core::$subDomain;\r\n\t\techo $this->makeUrl(), '<br>',\r\n\t\t\t$this->makeUrl('index'), '<br>',\r\n\t\t\t$this->makeUrl('view'), '<br>',\r\n\t\t\t$this->makeUrl('index', 'index'), '<br>',\r\n\t\t\t$this->makeUrl('index', 'view'), '<br>',\r\n\t\t\t$this->makeUrl('view', 'index'), '<br>',\r\n\t\t\t$this->makeUrl('view', 'view'), '<br>',\r\n\t\t\t'----------------------<br>',\r\n\t\t\t$this->makeUrl('index', 'index', 'main'), '<br>',\r\n\t\t\t$this->makeUrl('index', 'view', 'main'), '<br>',\r\n\t\t\t$this->makeUrl('view', 'index', 'main'), '<br>',\r\n\t\t\t$this->makeUrl('view', 'view', 'main'), '<br>',\r\n\t\t\t'----------------------<br>',\r\n\t\t\t$this->makeUrl('index', 'index', 'admin'), '<br>',\r\n\t\t\t$this->makeUrl('index', 'view', 'admin'), '<br>',\r\n\t\t\t$this->makeUrl('view', 'index', 'admin'), '<br>',\r\n\t\t\t$this->makeUrl('view', 'view', 'admin'), '<br>',\r\n\t\t\t'----------------------<br>',\r\n\t\t\t$this->makeUrl('index', 'index', 'blog'), '<br>',\r\n\t\t\t$this->makeUrl('index', 'view', 'blog'), '<br>',\r\n\t\t\t$this->makeUrl('view', 'index', 'blog'), '<br>',\r\n\t\t\t$this->makeUrl('view', 'view', 'blog'), '<br>',\r\n\t\t\t'----------------------<br>',\r\n\t\t\t$this->makeUrl('index', 'index', 'main', array('foo'=>'bar')), '<br>',\r\n\t\t\t$this->makeUrl('index', 'view', 'main', array('foo'=>'bar')), '<br>',\r\n\t\t\t$this->makeUrl('index', 'index', 'user', array('userId'=>'wuyu')), '<br>',\r\n\t\t\t$this->makeUrl('index', 'view', 'user', array('userId'=>'wuyu')), '<br>',\r\n\t\t\t$this->makeUrl('index', 'view', 'user', array('userId'=>'wuyu', 'color'=>'blue', 'bg'=>'&&&')), '<br>',\r\n\t\t\t$this->makeUrl('index', 'view', 'user', array('userId'=>'wu_yu', 'color'=>'blue', 'bg'=>'&&&')), '<br>';\r\n\t\t\t\r\n\t\t\t\r\n\t}", "public function index()\n\t{\n // 'content' => 'content',\n // 'header' => 'header'\n \n // );\n \n\n \n \n \n\t\t$this->load->view('Customer');\n\t}", "public function indexAction()\n\t{\n\t\tif (Engine_Api::_() -> user() -> getViewer() -> getIdentity())\n\t\t{\n\t\t\t$this -> setNoRender();\n\t\t\treturn;\n\t\t}\n\n\t\t// Get Params\n\t\t$this->view->iconsize = $this->_getParam('iconsize', 24);\n\t\t$this->view->margintop = $this->_getParam('margintop', 0);\n\t\t$this->view->marginright = $this->_getParam('marginright', 0);\n\t\t\n\t}", "public static function index()\n {\n self::create_view(\"home.view\", [\n \"user\" => Session::retrieve_object(\"user\")\n ]);\n\n exit;\n }", "public function index()\n {\n //Mostro la pagina da mostrare al primo login\n ViewLoader::load(\"_templates/header_base\");\n ViewLoader::load(\"firstLogin/index\");\n ViewLoader::load(\"_templates/footer\");\n }", "public function actionIndex()\n\t{\n\t\t$this->layout = 'main' ;\n\t\t$this->render('index') ;\n\t}", "public function index()\n {\n $this->load->view('header');\n $this->load->view('machinery/nav');\n $this->load->view('footer');\n }", "public function index()\n\t{\n\n $page_data = array(\n 'title' => SITE_NAME . \" - digital technology specialist\",\n 'meta_description' => \"Dafydd Vaughan - digital teachnology specialist. I advise organisations on replacement of legacy technology, adoption of public cloud services, and how to build strong digital teams.\",\n \"site_section\" => \"home\",\n \"page_title\" => \"Hello, I'm Dafydd Vaughan\"\n );\n\n $this->load->view('templates/header', $page_data);\n\t\t$this->load->view('welcome');\n $this->load->view('templates/footer');\n\t}", "public function IndexAction() {\r\n $this->ExecuteView();\r\n }", "public function index()\n\t{\n\t\t$this->layout->render();\n\t}" ]
[ "0.72325814", "0.7188456", "0.7164774", "0.7030186", "0.698236", "0.6968343", "0.69031227", "0.6900962", "0.6897872", "0.6891407", "0.68603384", "0.68595636", "0.68579334", "0.6855147", "0.68535", "0.68478554", "0.68069875", "0.67892534", "0.67835456", "0.6778123", "0.6771014", "0.6769806", "0.67679834", "0.6759387", "0.67497146", "0.6745887", "0.673791", "0.6731478", "0.6730061", "0.6730061", "0.6730061", "0.6727689", "0.67238575", "0.6717534", "0.67089766", "0.66925496", "0.66686326", "0.66645646", "0.66640216", "0.66461164", "0.6645615", "0.66401875", "0.66300166", "0.66298026", "0.66206783", "0.66147035", "0.66140723", "0.66002536", "0.65980136", "0.65969425", "0.6591132", "0.65899515", "0.65899515", "0.65885955", "0.6575028", "0.65669763", "0.6564292", "0.655295", "0.655127", "0.65457946", "0.65443945", "0.6544146", "0.6535007", "0.65346444", "0.65303576", "0.652368", "0.6518476", "0.6514762", "0.6507448", "0.65073156", "0.65054893", "0.65028685", "0.649722", "0.6496808", "0.6495599", "0.6494825", "0.6494405", "0.6491247", "0.6486428", "0.6481792", "0.6481792", "0.64736944", "0.64736086", "0.64685875", "0.6466724", "0.6460069", "0.64593285", "0.64551735", "0.6454755", "0.64545435", "0.6453913", "0.64507776", "0.64497775", "0.6448218", "0.6445638", "0.644413", "0.6429304", "0.6427389", "0.64225256", "0.6422176", "0.64204067" ]
0.0
-1
FIXME should this be rather protected?
public function __construct() { $this->dokuHTTPClient = new \DokuHTTPClient(); /** @var \helper_plugin_issuelinks_db $db */ $db = plugin_load('helper', 'issuelinks_db'); $jiraUrl = $db->getKeyValue('jira_url'); $this->jiraUrl = $jiraUrl ? trim($jiraUrl, '/') : null; $authToken = $db->getKeyValue('jira_token'); $this->token = $authToken; $jiraUser = $db->getKeyValue('jira_user'); $this->authUser = $jiraUser; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected function __init__() { }", "private function __() {\n }", "protected final function __construct() {}", "final private function __construct() {}", "final private function __construct() {}", "private function __construct()\t{}", "protected function init() {}", "protected function init() {}", "protected function init() {}", "protected function init() {}", "protected function init() {}", "protected function init() {}", "protected function init() {}", "protected function init() {}", "protected function init() {}", "protected function init() {}", "protected function init() {}", "protected function init() {}", "private function __construct () {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "final private function __construct() { }", "final private function __construct() { }", "final private function __construct() { }", "final private function __construct(){\r\r\n\t}", "protected function __construct() {}", "protected function __construct() {}", "protected function __construct() {}", "protected function __construct() {}", "protected function __construct() {}", "protected function __construct() {}", "protected function __construct() {}", "protected function __construct() {}", "protected function __construct() {}", "protected function __construct() {}", "protected function __construct() {}", "protected function __construct() {}", "protected function __construct() {}", "protected function __construct() {}", "protected function __construct() {}", "protected function __construct() {}", "private function __construct() {\r\n\t\r\n\t}", "protected function __construct () {}", "private final function __construct() {}" ]
[ "0.67719644", "0.6483352", "0.64244264", "0.63993806", "0.63993806", "0.63909084", "0.6387948", "0.6387948", "0.6387948", "0.6387948", "0.6387948", "0.6387948", "0.6387848", "0.6387848", "0.6387848", "0.6387848", "0.63869864", "0.63869864", "0.6323846", "0.6309954", "0.6309954", "0.6309954", "0.6309954", "0.6309954", "0.6309954", "0.6309954", "0.6309954", "0.6309954", "0.6309954", "0.6309954", "0.6309954", "0.6309954", "0.6309954", "0.6309954", "0.6309954", "0.6309954", "0.6309954", "0.6309954", "0.6309954", "0.6309954", "0.6309954", "0.6309954", "0.6309954", "0.6309954", "0.6309954", "0.6309954", "0.6309954", "0.6309954", "0.6309954", "0.6309954", "0.6309954", "0.6309954", "0.6309954", "0.6309954", "0.6309954", "0.6309954", "0.6309954", "0.6309954", "0.6309954", "0.6309954", "0.6309954", "0.6309954", "0.6309954", "0.6309954", "0.6309954", "0.6309954", "0.6309954", "0.6309954", "0.6309954", "0.6309954", "0.6309954", "0.6309954", "0.6309954", "0.6309954", "0.6309954", "0.6309363", "0.63069445", "0.63069445", "0.62715524", "0.62715524", "0.62715524", "0.62552357", "0.625208", "0.625208", "0.625208", "0.625208", "0.625208", "0.625208", "0.625208", "0.625208", "0.625208", "0.625208", "0.625208", "0.625208", "0.625208", "0.625208", "0.625208", "0.625208", "0.62054837", "0.620381", "0.6201091" ]
0.0
-1