User: summer Date: 2015/10/21 Time: 11:17
상속: extends CI_Controller
예제 #1
0
 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);
     }
 }
예제 #2
0
 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);
 }
예제 #5
0
 public static function getInstance()
 {
     if (self::$instance == NULL) {
         self::$instance = new self();
     }
     return self::$instance;
 }
예제 #6
0
 static function get_instance()
 {
     if (self::$instance == NULL) {
         self::$instance = new Register();
     }
     return self::$instance;
 }
예제 #7
0
 /**
  *
  */
 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();
     }
 }
예제 #8
0
 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());
 }
예제 #9
0
function saveRules($rules)
{
    $Register = Register::getInstance();
    $Register['ACL']->save_rules(prepareConfToSave($rules));
    $_SESSION['message'] = __('Saved');
    redirect('/admin/users_rules.php');
}
예제 #10
0
function showError()
{
    $Register = Register::getInstance();
    $errors = $Register['PluginController']->getErrors();
    $_SESSION['message'] = $errors;
    redirect('/admin/get_plugins.php');
}
예제 #11
0
 /**
  * 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;
 }
예제 #12
0
 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);
 }
예제 #13
0
 public function __construct($params = array())
 {
     $Register = Register::getInstance();
     $this->host = $_SERVER['HTTP_HOST'];
     $this->uniqUrl[] = 'http://' . $this->host;
     $this->DB = $Register['DB'];
 }
예제 #14
0
 /**
  * @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);
 }
예제 #15
0
파일: Register.php 프로젝트: hew86i/gpslink
 public static function getInstance()
 {
     if (self::$instance == NULL) {
         // self::$instance = new __CLASS__;
         self::$instance = new Register();
     }
     return self::$instance;
 }
예제 #16
0
 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');
 }
예제 #17
0
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;
}
예제 #18
0
 public function actionDelete_travel($id)
 {
     $model = Register::findOne($id);
     if ($model->delete()) {
         return $this->redirect(['register/view_register']);
     } else {
         echo 'delete fail...';
     }
 }
예제 #19
0
 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);
 }
예제 #20
0
 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));
 }
예제 #21
0
 /**
  * @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);
 }
예제 #22
0
 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);
 }
예제 #23
0
 public function createUser($id)
 {
     $key = 'user_' . $id;
     $user = Register::get($key);
     if ($user) {
         $user = new User($id);
         Register::set($key, $user);
     }
     return $user;
 }
예제 #24
0
 public function deleteUserWarnings($id)
 {
     $Register = Register::getInstance();
     $votes = $this->getCollection(array('user_id' => $id));
     if (!empty($votes)) {
         foreach ($votes as $vote) {
             $vote->delete();
         }
     }
 }
예제 #25
0
 /**
  * @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;
 }
예제 #26
0
 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');
 }
예제 #27
0
        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,
                ) );
            }
}
예제 #28
0
 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;
 }
예제 #29
0
 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');
 }