public function performAutoReg($module_status) { require_once 'RegisterModel.php'; $obj_reg = new Register(); $regr = array(); $limit = 50; $regr['referral_name'] = "admin"; $regr['referral_id'] = "12345"; $regr['prodcut_id'] = 1; $regr['full_name'] = "TEST NAME"; $regr['pswd'] = "123"; $regr['cpswd'] = "123"; $regr['fathername'] = "TEST FATHER NAME"; $regr['address'] = "TEST ADDRESS"; $regr['post_office'] = "546537"; $regr['town'] = "TEST TOWN"; $regr['district'] = "TEST DT"; $regr['pin'] = "TEST PIN"; $regr['mobile'] = "TEST MOB"; $regr['land_line'] = "TEST LAND"; $regr['email'] = "*****@*****.**"; $regr['state'] = "TEST ST"; for ($i = 10; $i < $limit; $i++) { $regr['username'] = date("Y-m-d H:i:s") + $i; $fathet_pos_pass_arr = $this->getFatherPositionPassCode(); $regr['fatherid'] = $this->OBJ_VALI->IdToUserName($fathet_pos_pass_arr['father_id']); $regr['position'] = $fathet_pos_pass_arr['position']; $regr['passcode'] = $fathet_pos_pass_arr['passcode']; $regr['joining_date'] = date('Y-m-d H:i:s'); $obj_reg->confirmRegister($regr, $module_status); } }
function delete($id) { if ($id) { $register = new Register($id); $register->delete(); set_notify('success', lang('delete_data_complete')); } redirect($_SERVER['HTTP_REFERER']); }
function test_userType() { $r = new Register(); $r->userTypeError(1, "11", ""); $this->assertTrue(empty($r->noAccessCode)); $r = new Register(); $r->userTypeError(2, "11", "11"); $this->assertTrue(empty($r->noAccessCode)); $r = new Register(); $r->userTypeError(2, "11", ""); $this->assertFalse(empty($r->noAccessCode)); $r = new Register(); $r->userTypeError(2, "", "11"); $this->assertFalse(empty($r->noAccessCode)); }
public function test_splitQty() { /** === Test Data === */ $STORE_ID = 2; $STOCK_ID = 4; $PROD_ID = 32; $ITEM_ID = 64; $QTY = 128; $ORDER = $this->_mock(\Magento\Sales\Api\Data\OrderInterface::class); /** === Setup Mocks === */ // $storeId = $order->getStoreId(); $ORDER->shouldReceive('getStoreId')->once()->andReturn($STORE_ID); // $stockId = $this->_manStock->getStockIdByStoreId($storeId); $this->mManStock->shouldReceive('getStockIdByStoreId')->once()->andReturn($STOCK_ID); // $items = $order->getItems(); $mItem = $this->_mock(\Magento\Sales\Api\Data\OrderItemInterface::class); $ORDER->shouldReceive('getItems')->once()->andReturn([$mItem]); // // FIRST ITERATION // // $prodId = $item->getProductId(); $mItem->shouldReceive('getProductId')->once()->andReturn($PROD_ID); // $itemId = $item->getItemId(); $mItem->shouldReceive('getItemId')->once()->andReturn($ITEM_ID); // $qty = $item->getQtyOrdered(); $mItem->shouldReceive('getQtyOrdered')->once()->andReturn($QTY); // $itemData = $this->_manObj->create(\Praxigento\Warehouse\Service\QtyDistributor\Data\Item::class); $mItemData = $this->_mock(\Praxigento\Warehouse\Service\QtyDistributor\Data\Item::class); $this->mManObj->shouldReceive('create')->once()->andReturn($mItemData); // $itemData->setItemId($itemId); $mItemData->shouldReceive('setItemId')->once()->with($ITEM_ID); // $itemData->setProductId($prodId); $mItemData->shouldReceive('setProductId')->once()->with($PROD_ID); // $itemData->setQuantity($qty); $mItemData->shouldReceive('setQuantity')->once()->with($QTY); // $itemData->setStockId($stockId); $mItemData->shouldReceive('setStockId')->once()->with($STOCK_ID); // // $reqSale = $this->_manObj->create(\Praxigento\Warehouse\Service\QtyDistributor\Request\RegisterSale::class); $mReqSale = $this->_mock(\Praxigento\Warehouse\Service\QtyDistributor\Request\RegisterSale::class); $this->mManObj->shouldReceive('create')->once()->andReturn($mReqSale); // $reqSale->setSaleItems($itemsData); $mReqSale->shouldReceive('setSaleItems')->once(); // $this->_callQtyDistributor->registerSale($reqSale); $this->mCallQtyDistributor->shouldReceive('registerSale')->once()->with($mReqSale); /** === Call and asserts === */ $res = $this->obj->splitQty($ORDER); }
public static function getInstance() { if (self::$instance == NULL) { self::$instance = new self(); } return self::$instance; }
static function get_instance() { if (self::$instance == NULL) { self::$instance = new Register(); } return self::$instance; }
/** * */ public function __construct() { $this->Register = Register::getInstance(); $this->setPhpSettings(); $this->touchStartTime(); $this->Register['Cache'] = new Cache(); $viewerLoader = new Fps_Viewer_Loader(array('template_root' => ROOT . '/template/' . getTemplateName() . '/html/')); $this->Register['Viewer'] = new Fps_Viewer_Manager($viewerLoader); if (isInstall()) { $this->registerCustomTemplateFunctions(); $this->Register['DB'] = class_exists('PDO') && Config::read('use_pdo') ? FpsPDO::get() : FpsDataBase::get(); $this->Register['UserAuth'] = new UserAuth(); $this->Register['Log'] = new Logination(); } $this->Register['DocParser'] = new Document_Parser(); $this->Register['ACL'] = new ACL(ROOT . '/sys/settings/'); $this->Register['PrintText'] = new PrintText(); $this->Register['Validate'] = new Validate(function ($errors) { $Register = Register::getInstance(); return $Register['DocParser']->wrapErrors($errors); }); $this->Register['ModManager'] = new ModulesManager(ROOT . '/sys/settings/modules_access.php'); $this->Register['PluginController'] = new Plugins(); $this->Register['URL'] = new AtmUrl(); $this->Register['Protector'] = new Protect(); if (isInstall()) { $this->inputCheck(); $this->initProtect(); $this->initUser(); $this->loadLanguages(); } }
public function __invoke() { $input = $this->loadInput("Day23/Puzzle1"); $instructionsList = new InstructionsList($input); $a = new Register(1); $b = new Register(); $runner = new InstructionsRunner($instructionsList, $a, $b); $this->write("Executing " . count($instructionsList) . " instructions"); while ($runner->currentInstructionNumber() + 1 <= count($instructionsList)) { $k = $runner->currentInstructionNumber(); $this->write("Executing instruction {$k}: {$instructionsList[$k]}"); $runner->execute(); $this->write("Register a is now " . $a->getValue() . "; register b is now " . $b->getValue(), 2); } $this->write("Value of register b is now " . $b->getValue()); }
function saveRules($rules) { $Register = Register::getInstance(); $Register['ACL']->save_rules(prepareConfToSave($rules)); $_SESSION['message'] = __('Saved'); redirect('/admin/users_rules.php'); }
function showError() { $Register = Register::getInstance(); $errors = $Register['PluginController']->getErrors(); $_SESSION['message'] = $errors; redirect('/admin/get_plugins.php'); }
/** * Retorna a lista de registros adicionado durante a execução do sistema. * * @return String */ public static function getRegister() { if (!empty(self::$Register)) { self::$Register = implode("\n", self::$Register) . " \n"; } echo self::$Register; }
public function common($params) { $Register = Register::getInstance(); $output = ''; if (!strpos($params, '{{ users_rating }}')) { return $params; } $Cache = new Cache(); $Cache->lifeTime = 600; if ($Cache->check('pl_users_rating')) { $users = $Cache->read('pl_users_rating'); $users = json_decode($users, true); } else { $users = $this->DB->select('users', DB_ALL, array('order' => '`rating` DESC', 'limit' => $this->limit)); //$users = $this->DB->query($sql); $Cache->write(json_encode($users), 'pl_users_rating', array()); } if (!empty($users)) { foreach ($users as $key => $user) { $link = get_link($user['name'], getProfileUrl($user['id'])); $ava = file_exists(ROOT . '/sys/avatars/' . $user['id'] . '.jpg') ? get_url('/sys/avatars/' . $user['id'] . '.jpg') : get_url('/sys/img/noavatar.png'); $output .= sprintf($this->wrap, $ava, $link, $user['rating'], $user['posts']); } } $output .= '<div class="etopu">' . get_link('Весь рейтинг', '/users/index?order=rating') . '</div>'; return str_replace('{{ users_rating }}', $output, $params); }
public function __construct($params = array()) { $Register = Register::getInstance(); $this->host = $_SERVER['HTTP_HOST']; $this->uniqUrl[] = 'http://' . $this->host; $this->DB = $Register['DB']; }
/** * @SuppressWarnings(PHPMD.ShortVariable) */ public function test_savePv() { /** === Test Data === */ $id = 4; $state = \Magento\Sales\Model\Order::STATE_PROCESSING; $dateCreated = 'created at'; $order = $this->_mock(\Magento\Sales\Api\Data\OrderInterface::class); /** === Setup Mocks === */ // $orderId = $order->getId(); $order->shouldReceive('getId')->once()->andReturn($id); // $state = $order->getState(); $order->shouldReceive('getState')->once()->andReturn($state); // $dateCreated = $order->getCreatedAt(); $order->shouldReceive('getCreatedAt')->once()->andReturn($dateCreated); // $itemsData = $this->_subCollector->getServiceItemsForMageSaleOrder($order); $mItemsData = []; $this->mSubCollector->shouldReceive('getServiceItemsForMageSaleOrder')->once()->andReturn($mItemsData); // $req = $this->_manObj->create(\Praxigento\Pv\Service\Sale\Request\Save::class); $mReq = $this->_mock(\Praxigento\Pv\Service\Sale\Request\Save::class); $this->mManObj->shouldReceive('create')->once()->andReturn($mReq); // $req->setSaleOrderId($orderId); $mReq->shouldReceive('setSaleOrderId')->once()->with($id); // $req->setOrderItems($itemsData); $mReq->shouldReceive('setOrderItems')->once()->with($mItemsData); // $req->setSaleOrderDatePaid($dateCreated); $mReq->shouldReceive('setSaleOrderDatePaid')->once()->with($dateCreated); // $this->_callSale->save($req); $this->mCallSale->shouldReceive('save')->once()->with($mReq); /** === Call and asserts === */ $this->obj->savePv($order); }
public static function getInstance() { if (self::$instance == NULL) { // self::$instance = new __CLASS__; self::$instance = new Register(); } return self::$instance; }
public function __construct($message_one, $message_two, $minlength, $maxlength) { $this->message_one = $message_one; $this->message_two = $message_two; $this->minlength = $minlength; $this->maxlength = $maxlength; $this->db = Register::get('db'); }
function showInfoMessage($message, $queryString = null) { $Register = Register::getInstance(); header('Refresh: ' . $Register['Config']->read('redirect_delay') . '; url=http://' . $_SERVER['SERVER_NAME'] . get_url($queryString)); $html = file_get_contents(ROOT . '/template/' . getTemplateName() . '/html/default/infomessagegrand.html'); $html = str_replace('{INFO_MESSAGE}', $message, $html); echo $html; die; }
public function actionDelete_travel($id) { $model = Register::findOne($id); if ($model->delete()) { return $this->redirect(['register/view_register']); } else { echo 'delete fail...'; } }
public function save() { $params = array('user_id' => intval($this->user_id), 'admin_id' => intval($this->admin_id), 'cause' => $this->cause, 'date' => $this->date, 'points' => intval($this->points)); if ($this->id) { $params['id'] = $this->id; } $Register = Register::getInstance(); return $Register['DB']->save('users_warnings', $params); }
public function delete() { $path = ROOT . '/sys/files/news/' . $this->filename; if (file_exists($path)) { unlink($path); } $Register = Register::getInstance(); $Register['DB']->delete('news_attaches', array('id' => $this->id)); }
/** * @param string $title */ public function setTitle($title) { $Register = Register::getInstance(); if (!empty($this->title) && $this->title !== $title) { $Register['URL']->saveOldEntryUrl($this, 'foto', $title); } $this->title = $title; $this->clean_url_title = $Register['URL']->getUrlByTitle($title, false); }
public function includeFile($path, array $subcontext) { $context = array_merge($this->context, $subcontext); $Register = Register::getInstance(); $Viewer = clone $Register['Viewer']; $Viewer->setDefaultLayout(''); $Viewer->setLayout(''); echo $Viewer->view($path, $context); }
public function createUser($id) { $key = 'user_' . $id; $user = Register::get($key); if ($user) { $user = new User($id); Register::set($key, $user); } return $user; }
public function deleteUserWarnings($id) { $Register = Register::getInstance(); $votes = $this->getCollection(array('user_id' => $id)); if (!empty($votes)) { foreach ($votes as $vote) { $vote->delete(); } } }
/** * @description Get organizations list * @return array $organizations */ private function organizations() { $searchOrganizationSettings = $_SESSION['covisint_settings']['search_organization']; $url = $searchOrganizationSettings['url']; $method = $searchOrganizationSettings['type']; $headers = $searchOrganizationSettings['header']; $headers['Authorization'] = $_SESSION['covisint']['token']; $organizations = Register::requestApi($headers, $url, $method); return $organizations; }
public function registerAction() { $user = new Register(); $email = $this->request->getPost('email'); $login = $this->request->getPost('login'); $password = md5($this->request->getPost('password')); if ($email == NULL && $login == NULL && $password == NULL) { } else { if ($email == NULL || $login == NULL || $password == NULL) { } else { if ($user->saveUser($email, $login, $password)) { header('location=' . Url::getUrl('login', 'login', array('status' => 4))); } else { header('location=' . Url::getUrl('register', 'register', array('status' => 5))); } } } $this->view->display('register_form'); }
public function actionRegisterwisecollections() { $model = new Register( 'search' ); $model->unsetAttributes(); // clear any default values if ( isset( $_GET['Register'] ) ) $model->attributes = $_GET['Register']; if(!empty( $_GET['actionid'] ) && $_GET['actionid'] == Helper::CONST_PDF) { $html = $this->renderPartial( 'registerwisecollections', array( 'model' => $model, ),true ); $this->writeToPdf( $html ); } else { $this->render( 'registerwisecollections', array( 'model' => $model, ) ); } }
public static function getDataBase() { $db = Register::get('db'); if (!$db) { // 单例模式 $db = new Database\MySQLi(); $db->connect('127.0.0.1', 'root', '123456', 'test'); Register::set('db', $db); } return $db; }
public function getByName($name) { $Register = Register::getInstance(); $entity = $this->getDbDriver()->select($this->Table, DB_FIRST, array('cond' => array('name' => $name))); if (!empty($entity[0])) { $entityClassName = $Register['ModManager']->getEntityNameFromModel(get_class($this)); $entity = new $entityClassName($entity[0]); return !empty($entity) ? $entity : false; } return false; }
public function update($id) { $detail = Register::findOrFail($id); $data = Input::all(); $validator = Validator::make($data, Register::$rules); if ($validator->fails()) { return Redirect::back()->withErrors($validator)->withInput(); } $detail->update($data); return Redirect::to('/postValue'); }