示例#1
0
 public function beforeAction()
 {
     if (!isset($_SERVER['PHP_AUTH_USER']) || !isset($_SERVER['PHP_AUTH_PW'])) {
         return false;
     }
     $this->_device = Device::model()->findByPk($_SERVER['PHP_AUTH_USER']);
     if ($this->_device === null) {
         return false;
     } else {
         if ($this->_device->token != $_SERVER['PHP_AUTH_PW']) {
             return false;
         }
     }
     return true;
 }
示例#2
0
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'index' page.
  */
 public function actionBuka()
 {
     $this->layout = '//layouts/box_kecil';
     $model = new Kasir();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Kasir'])) {
         $model->attributes = $_POST['Kasir'];
         if ($model->save()) {
             $this->redirect('index');
         }
     }
     $listKasir = CHtml::listData(User::model()->findAll(), 'id', 'nama_lengkap');
     $listPosClient = CHtml::listData(Device::model()->findAll('tipe_id=' . Device::TIPE_POS_CLIENT), 'id', 'nama');
     $this->render('buka', array('model' => $model, 'listKasir' => $listKasir, 'listPosClient' => $listPosClient));
 }
 public static function randomString($count, $isBarcode)
 {
     $chars = '0123456789';
     $numChars = strlen($chars);
     $string = '';
     $isUnique = false;
     while (!$isUnique) {
         for ($i = 0; $i < $count; $i++) {
             $string .= substr($chars, rand(1, $numChars) - 1, 1);
         }
         if ($isBarcode) {
             $records = Device::model()->findAllByAttributes(['barcode' => $string]);
             if (empty($records)) {
                 $isUnique = true;
             }
         } else {
             $records = Company::model()->findAllByAttributes(['ref' => $string]);
             if (empty($records)) {
                 $isUnique = true;
             }
         }
     }
     return $string;
 }
<link rel="stylesheet" type="text/css"
	href="<?php 
echo Yii::app()->request->baseUrl;
?>
/css/users.css" />


<div class="infoblock shadow"><h1 style="color:#20B2AA;">Manage Elements</h1></div>
<HR WIDTH=1180 ALIGN=LEFT >


<?php 
$this->widget('bootstrap.widgets.TbBreadcrumb', array('links' => array('Manage Elements')));
?>
<br/>

<div class="well-button">

<?php 
echo TbHtml::Button('<i class="fa fa-arrow-left"></i> Back', array('onclick' => 'js:document.location.href="/mtcontrool"', 'id' => 'b1', 'title' => 'Back', 'color' => TbHtml::BUTTON_COLOR_DEFAULT, 'size' => TbHtml::BUTTON_SIZE_SMALL, 'style' => 'color: green;'));
?>
            
             
                
        </div>



<?php 
$this->widget('bootstrap.widgets.TbGridView', array('id' => 'element-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'columns' => array('description', array('header' => 'Platforms', 'filter' => CHtml::listData(Platforms::model()->findAll(), 'id', 'name'), 'name' => 'id_plat', 'value' => '$data->platform_list($data->id)'), array('header' => 'Devices', 'filter' => CHtml::listData(Device::model()->findAll(), 'id', 'description'), 'name' => 'id_dev', 'value' => '$data->device_list($data->id)'), array('class' => 'bootstrap.widgets.TbButtonColumn', 'template' => '{update}&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp{delete}', 'buttons' => array('update' => array('icon' => 'fa fa-pencil'), 'delete' => array('icon' => 'fa fa-trash-o'))))));
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer $id the ID of the model to be loaded
  * @return Device the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = Device::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
    <?php 
}
?>
    
    <?php 
echo TbHtml::Button($textBtn . ' <i class="fa fa-play"></i>', array('submit' => array('/testContext/mef?idTestContext=' . $idTestContext), 'name' => 'del', 'color' => TbHtml::BUTTON_COLOR_INFO, 'size' => TbHtml::BUTTON_SIZE_SMALL));
?>
</div>


<div class="all">

    <div class="round">
        <b>Round of Testing</b>
        <?php 
$this->widget('bootstrap.widgets.TbGridView', array('id' => 'users-grid', 'dataProvider' => $dataProvider, 'summaryText' => '', 'columns' => array('description', array('header' => 'App', 'filter' => CHtml::listData(App::model()->findAll(), 'name', 'name'), 'name' => 'id_app', 'value' => '$data->iDAPP->name'), array('header' => 'Platform', 'filter' => CHtml::listData(Platforms::model()->findAll(), 'name', 'name'), 'name' => 'id_platform', 'value' => '$data->iDPLATFORM->name'), array('header' => 'Device', 'filter' => CHtml::listData(Device::model()->findAll(), 'description', 'description'), 'name' => 'id_device', 'value' => '$data->iDDEVICE->description'), array('header' => 'User', 'name' => 'id_user', 'value' => '$data->iDUSER->name'))));
?>
    </div>
    

    <div class="variations">
        <b>Variations in the Round of Testing</b>
        <br/>
        <br/>
        <?php 
$anterior = "";
?>
        <?php 
$inicio = "sim";
?>
        <?php 
 public function actionInidashboard($idTestContext)
 {
     $sql = 'SELECT * FROM test_context_seq WHERE id_test_context = ' . $idTestContext;
     $arrayModels = TestContextSeq::model()->findAllBySql($sql);
     $modelTestContext = TestContext::model()->findByPk($idTestContext);
     $raw_data_dashboard = array();
     $totalTests = 0;
     $cont = 1;
     foreach ($arrayModels as $model) {
         $row_data_dashboard = array();
         $row_data_dashboard[0] = $cont;
         $row_data_dashboard[1] = $model->variation;
         $row_data_dashboard[2] = $model->behavior;
         $screen = $model->behavior_screen;
         $row_data_dashboard[3] = $screen;
         array_push($raw_data_dashboard, $row_data_dashboard);
         $totalTests++;
     }
     $nomePlataforma = Platforms::model()->findByPk($modelTestContext->id_platform);
     $nomeApp = App::model()->findByPk($modelTestContext->id_app);
     $device = Device::model()->findByPk($modelTestContext->id_device);
     $user = Users::model()->findByPk($modelTestContext->id_user);
     $sql_countElements = "SELECT * FROM test_context JOIN element_inst ON (test_context.id = element_inst.id_test_context)  WHERE test_context.id={$idTestContext} GROUP BY id_element";
     $result_countElements = Yii::app()->db->createCommand($sql_countElements)->queryAll();
     $totalElements = 0;
     foreach ($result_countElements as $item) {
         $totalElements = $totalElements + 1;
     }
     /*$dados_dashboard =  array (
     		'table' => $part4,
     		);*/
     $dados_dashboard = array();
     $dados_dashboard['totalElements'] = null;
     $dados_dashboard['totalElements'] = $totalElements;
     $dados_dashboard['user'] = null;
     $dados_dashboard['user'] = $user->name;
     $dados_dashboard['Image'] = null;
     $dados_dashboard['Image'] = $nomePlataforma->image;
     $dados_dashboard['device'] = null;
     $dados_dashboard['device'] = $device;
     $dados_dashboard['nomePlataforma'] = null;
     $dados_dashboard['nomePlataforma'] = $nomePlataforma->name;
     $dados_dashboard['nomeApp'] = null;
     $dados_dashboard['nomeApp'] = $nomeApp->name;
     $dados_dashboard['model'] = null;
     $dados_dashboard['model'] = $modelTestContext;
     $dados_dashboard['totalTests'] = null;
     $dados_dashboard['totalTests'] = $totalTests;
     $dados_dashboard['dados'] = null;
     $dados_dashboard['dados'] = $raw_data_dashboard;
     $dados_dashboard['json'] = null;
     $dados_dashboard['json'] = json_encode($raw_data_dashboard);
     $dados_dashboard['nome_teste'] = $modelTestContext->description;
     Yii::app()->user->setState('dados_dashbord_final', $dados_dashboard);
     $this->redirect("/mtcontrool/index.php/testContext/dashboard");
 }
//var_dump($model->platforms);
foreach ($model->devices as $device) {
    array_push($selected_devices, $device->ID);
}
?>
			
			
			<br/><br/>
			<div>
				<?php 
echo TbHtml::label($model->getAttributeLabel('devices'), 'Device');
?>
				
				<div class="portlet-content" id="divprincipal">
				<?php 
echo TbHtml::CheckBoxList('Devices', $selected_devices, CHtml::listData(Device::model()->findAll(), 'ID', 'DESCRIPTION'), array('template' => '{input} {label}'));
?>
				<?php 
echo $form->error($model, 'device');
?>
				</div>
			</div>
			-->

    </br>




	<?php 
//echo $form->dropDownListControlGroup($model,'ID_PLATFORM',$platformsArray, array('span'=>5, 'empty' => '--- Escolha uma plataforma ---'));
 public function actionPrintReturPembelian($id)
 {
     if (isset($_GET['printId'])) {
         $device = Device::model()->findByPk($_GET['printId']);
         switch ($device->tipe_id) {
             case Device::TIPE_LPR:
                 $this->printLpr($id, $device);
                 break;
             case Device::TIPE_PDF_PRINTER:
                 /* Ada tambahan parameter kertas untuk tipe pdf */
                 $this->exportPdf($id, $_GET['kertas']);
                 break;
             case Device::TIPE_TEXT_PRINTER:
                 $this->exportText($id, $device);
                 break;
         }
     }
 }
示例#10
0
 public function actionKartuStok()
 {
     $model = new ReportKartuStokForm();
     $report = null;
     if (isset($_POST['ReportKartuStokForm'])) {
         $model->attributes = $_POST['ReportKartuStokForm'];
         $model->sortBy = ReportKartuStokForm::SORT_BY_TANGGAL_ASC;
         if ($model->validate()) {
             $report = $model->reportKartuStok();
         }
     }
     $tipePrinterAvailable = [Device::TIPE_PDF_PRINTER];
     $printers = Device::model()->listDevices($tipePrinterAvailable);
     $kertasUntukPdf = ReportKartuStokForm::listKertas();
     $this->render('kartustok', ['model' => $model, 'report' => $report, 'printers' => $printers, 'kertasPdf' => $kertasUntukPdf]);
 }
    public function actionTeste()
    {
        $model = $this->loadModel(1);
        $modelList = new Element('search');
        $devicesArray = array();
        $count = 0;
        $devicesArray = array();
        foreach ($model->platforms as $platform) {
            echo $platform->id . "<br/>";
            echo $platform->name . "<br/>";
            $device = Device::model()->findAllBySql('SELECT *
													  FROM Device
													  WHERE ID_PLATFORM=' . $platform->id);
            var_dump($device);
            echo "<br/>";
            $devicesArray[$count] = $device;
            $count++;
        }
        echo "<br/>";
        var_dump($devicesArray);
        echo "<br/>";
        foreach ($devicesArray as $key => $value) {
            echo $value[$key]->description;
            echo "<br/>";
        }
        echo "<br/>";
        echo "\n\t\t<a href='http://localhost/mtcontrool/index.php/element/admin'>element/admin</a></br>\n\t\t<a href='http://localhost/mtcontrool/index.php/element/create'>element/create</a></br>\n\t\t<a href='http://localhost/mtcontrool/index.php/device/admin'>device/admin</a></br>\n\t\t<a href='http://localhost/mtcontrool/index.php/device/create'>device/create</a></br>\n\t\t<a href='http://localhost/mtcontrool/index.php/brand/admin'>brand/admin</a></br>\n\t\t<a href='http://localhost/mtcontrool/index.php/brand/create'>brand/create</a></br>\n\t\t";
        echo Yii::app()->user->getId() . "<br/>";
        echo Yii::app()->user->getName();
        $lista = Device::model()->findAll('id_platform  = 3');
        $lista = CHtml::listData($lista, 'ID', 'description');
        //var_dump($lista);
        echo CHtml::tag('option', array('value' => ''), 'Select', TRUE);
        foreach ($lista as $valor => $name) {
            echo CHtml::tag('option', array('value' => $valor), CHtml::encode($name), true);
        }
    }
示例#12
0
 public static function getCompanyID($dev_id)
 {
     $device = Device::model()->findByPk($dev_id);
     return $device->person->company_id;
 }
示例#13
0
 public function actionSync()
 {
     $data = $this->_getData;
     $dataSend = array();
     $deviceID = isset($data->deviceID) ? $data->deviceID : null;
     $device = Device::model()->find('s_deviceID = :s_deviceID', array(':s_deviceID' => $deviceID));
     if ($device == null) {
         $this->sendResponse(null, 1, 'Device not found');
     }
     $manager = $device->getUser();
     if ($manager == null) {
         $this->sendResponse($dataSendToMobile, 0, 'Account not found by deviceID: ' . $deviceID);
     }
     $storeID = $manager->s_store_id;
     if ($data != null) {
         $dataSyncSuccess = array();
         $error = false;
         foreach ($data as $k => $v) {
             $classModel = $this->getModel($k);
             if ($classModel != null) {
                 $success = array();
                 foreach ($v as $record) {
                     $s_id = $record->pk_s_id;
                     $model = $classModel::model()->findBySql("SELECT * FROM `{$k}` WHERE `pk_s_id` = :pk_s_id", array(':pk_s_id' => $s_id));
                     if ($model == null) {
                         $model = new $classModel();
                         $model->i_flag_sync = 0;
                         $model->i_updated = 0;
                     }
                     if ($model->i_updated < $record->i_updated) {
                         foreach ($record as $krecord => $vrecord) {
                             if ($model->hasAttribute($krecord)) {
                                 $model->{$krecord} = $vrecord;
                             }
                             // End if
                         }
                         // End foreach
                         $model->i_flag_sync = 0;
                         if ($model->hasAttribute('s_store_id')) {
                             $model->s_store_id = $storeID;
                         }
                         if ($model->save()) {
                             array_push($success, array('pk_s_id' => $record->pk_s_id));
                         } else {
                             $error = true;
                         }
                     }
                 }
                 if (count($success) > 0) {
                     $dataSyncSuccess[$k] = $success;
                 }
             }
         }
     }
     $dataSend = $this->getDataSyncToMobile($storeID, $device->i_sync_closest);
     if (isset($dataSyncSuccess) && count($dataSyncSuccess) > 0) {
         $dataSend = array_merge_recursive($dataSend, $dataSyncSuccess);
     }
     if ($dataSend != null && (array_key_exists('device', $dataSend) && count($dataSend['device']) > 0 || array_key_exists('store', $dataSend) && count($dataSend['store']) > 0 || array_key_exists('order', $dataSend) && count($dataSend['order']) > 0 || array_key_exists('order_detail', $dataSend) && count($dataSend['order_detail']) > 0 || array_key_exists('user', $dataSend) && count($dataSend['user']) > 0 || array_key_exists('service_type', $dataSend) && count($dataSend['service_type']) > 0 || array_key_exists('service', $dataSend) && count($dataSend['service']) > 0 || array_key_exists('customer', $dataSend) && count($dataSend['customer']) > 0 || array_key_exists('discount', $dataSend) && count($dataSend['discount']) > 0)) {
         $device->i_sync_closest = time() + 1;
         $device->save();
     }
     $this->sendResponse($dataSend, 1);
 }
示例#14
0
$this->widget('bootstrap.widgets.TbBreadcrumb', array('links' => array('Manage TestContext')));
?>
	</div>
	<div class="label_mtc">
	<p class="label_txt">MTContext</p>
	</div>
</div>



<div class="search-form" style="display:none">
<?php 
$this->renderPartial('_search', array('model' => $model));
?>


</div><!-- search-form -->
<br>
<div class="well-button">

<?php 
echo TbHtml::Button('<i class="fa fa-arrow-left"></i> Back', array('onclick' => 'js:document.location.href="/mtcontrool"', 'id' => 'b1', 'title' => 'Back', 'color' => TbHtml::BUTTON_COLOR_DEFAULT, 'size' => TbHtml::BUTTON_SIZE_SMALL, 'style' => 'color: green;'));
?>
            
        </div>
<div class="group-div">


<?php 
$this->widget('bootstrap.widgets.TbGridView', array('id' => 'test-context-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'columns' => array('description', array('header' => 'App', 'filter' => CHtml::listData(App::model()->findAll(), 'name', 'name'), 'name' => 'id_app', 'value' => '$data->iDAPP->name'), array('header' => 'Platform', 'filter' => CHtml::listData(Platforms::model()->findAll(), 'name', 'name'), 'name' => 'id_platform', 'value' => '$data->iDPLATFORM->name'), array('header' => 'Device', 'filter' => CHtml::listData(Device::model()->findAll(), 'description', 'description'), 'name' => 'id_device', 'value' => '$data->iDDEVICE->description'), array('header' => 'User', 'filter' => CHtml::listData(Users::model()->findAll(), 'name', 'name'), 'name' => 'id_user', 'value' => '$data->iDUSER->name'), array('class' => 'bootstrap.widgets.TbButtonColumn', 'template' => '{Resume}&nbsp&nbsp{delete}', 'buttons' => array('Resume' => array('icon' => 'icon-list', 'url' => 'Yii::app()->createUrl("testContext/resume", array("idTestContext"=>$data->id))'), 'delete' => array('icon' => 'fa fa-trash-o'))))));
示例#15
0
 public function actionRegisterApi($aid = NULL, $name, $gender, $age, $type, $u_name, $u_gender, $u_city, $code)
 {
     /*
             if (empty($name)) {
        throw new PException('注册信息不完整');
             }
     */
     $session = Yii::app()->session;
     $session->open();
     $id = $session['id'];
     if (empty($id)) {
         $this->response->setExpired();
         //重新登录
         $this->response->render();
         return;
     }
     $device = Device::model()->findByPk($id);
     if (empty($device)) {
         $this->response->setExpired();
         //重新登录
         $this->response->render();
         return;
     }
     $pattern = '/^[a-zA-Z0-9\\x{30A0}-\\x{30FF}\\x{3040}-\\x{309F}\\x{4E00}-\\x{9FBF}]+$/u';
     if (empty($aid)) {
         //$namelen = (strlen($name)+mb_strlen($name,"UTF8"))/2;
         $namelen = mb_strlen($name, "UTF8");
         if ($namelen > 8) {
             throw new PException('宠物昵称超过最大长度');
         }
         if (!preg_match($pattern, $name)) {
             throw new PException('宠物昵称含有特殊字符');
         }
     }
     //$u_namelen = (strlen($u_name)+mb_strlen($u_name,"UTF8"))/2;
     $u_namelen = mb_strlen($u_name, "UTF8");
     if ($u_namelen > 8) {
         throw new PException('用户名超过最大长度');
     }
     if (User::model()->isNameExist(trim($u_name))) {
         throw new PException('用户名已被注册');
     }
     if (!preg_match($pattern, $u_name)) {
         throw new PException('用户名含有特殊字符');
     }
     if ($code != '') {
         if (!($inviter = User::model()->getUserIdByCode(strtolower(trim($code))))) {
             throw new PException('邀请ID不存在');
         }
     }
     $transaction = Yii::app()->db->beginTransaction();
     try {
         $user = $device->register($aid, trim($name), $gender, $age, $type, trim($u_name), $u_gender, $u_city, empty($invter) ? NULL : $inviter);
         $session['usr_id'] = $device->usr_id;
         $session['not_registered'] = FALSE;
         $user->login();
         Talk::model()->sendMsg(NPC_SYSTEM_USRID, $user->usr_id, "HI~我是的汪汪大使,欢迎来到宠物星球,以后星球上的新鲜事,汪汪会光速传达你,放心交给我吧,汪汪");
         $transaction->commit();
     } catch (Exception $e) {
         $transaction->rollback();
         throw $e;
     }
     $this->echoJsonData(array('isSuccess' => true));
 }
示例#16
0
 public function listPrinter()
 {
     return CHtml::listData(Device::model()->findAll('tipe_id !=' . self::TIPE_POS_CLIENT), 'id', 'nama');
 }
示例#17
0
 public function actionPrintNota($id)
 {
     if (isset($_GET['printId'])) {
         $device = Device::model()->findByPk($_GET['printId']);
         switch ($device->tipe_id) {
             case Device::TIPE_LPR:
                 $this->printLpr($id, $device, self::PRINT_NOTA);
                 break;
                 /*
                  case Device::TIPE_PDF_PRINTER:
                  $this->exportPdf($id);
                  break;
                  case Device::TIPE_CSV_PRINTER:
                  $this->eksporCsv($id);
                  break;
                 */
             /*
              case Device::TIPE_PDF_PRINTER:
              $this->exportPdf($id);
              break;
              case Device::TIPE_CSV_PRINTER:
              $this->eksporCsv($id);
              break;
             */
             case Device::TIPE_TEXT_PRINTER:
                 $this->exportText($id, $device, self::PRINT_NOTA);
                 break;
         }
     }
 }
示例#18
0
<link rel="stylesheet" type="text/css"
	href="<?php 
echo Yii::app()->request->baseUrl;
?>
/css/users.css" />

<?php 
/* @var $this TestContextController */
/* @var $dataProvider CActiveDataProvider */
?>

<?php 
$this->breadcrumbs = array('Test Contexts');
$this->menu = array(array('label' => 'Create TestContext', 'url' => array('create')), array('label' => 'Manage TestContext', 'url' => array('admin')));
?>

<h1>Test Contexts</h1>

<?php 
$this->widget('bootstrap.widgets.TbGridView', array('id' => 'test-context-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'columns' => array(array('header' => 'User', 'filter' => CHtml::listData(Users::model()->findAll(), 'name', 'name'), 'name' => 'id_user', 'value' => '$data->iDUSER->name'), array('header' => 'App', 'filter' => CHtml::listData(App::model()->findAll(), 'name', 'name'), 'name' => 'id_app', 'value' => '$data->iDAPP->name'), array('header' => 'Platform', 'filter' => CHtml::listData(Platforms::model()->findAll(), 'name', 'name'), 'name' => 'id_platform', 'value' => '$data->iDPLATFORM->name'), array('header' => 'Device', 'filter' => CHtml::listData(Device::model()->findAll(), 'description', 'description'), 'name' => 'id_device', 'value' => '$data->iDDEVICE->description'), 'description', array('class' => 'bootstrap.widgets.TbButtonColumn', 'template' => '{update}&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp{delete}'))));