Beispiel #1
0
 /**
  * This is the default 'index' action that is invoked
  * when an action is not explicitly requested by users.
  */
 public function actionHome()
 {
     if (Yii::app()->user->isGuest) {
         $this->redirect('/');
     }
     $notify_num = array(0);
     $uid = Yii::app()->user->id;
     //用户信息
     $owner = User::model()->findByPk($uid);
     //8个应用
     $apps = App::model()->findAll();
     //应用的计数
     //$apps_num = $this->api->space_getCount($this->uid);
     $apps_num = array();
     //是否自己的空间
     $mid = Yii::app()->user->id;
     if ($uid == $mid) {
         $is_me = true;
     }
     $notify_num = array('notification' => 0, 'message' => 0, 'friend' => 0, 'wall' => 0);
     $may_users = array();
     //空间主人的好友
     $friend_list = $owner->getUserFriends($uid);
     $visitors = array();
     $data = array('owner' => $owner, 'is_me' => $is_me, 'apps' => $apps, 'apps_num' => $apps_num, 'uid' => $uid, 'mid' => $mid, 'may_users' => $may_users, 'visitors' => $visitors, 'friend_list' => $friend_list, 'notify_num' => $notify_num);
     $this->render('home', $data);
 }
Beispiel #2
0
 public function fetchWidgetByUid($uid)
 {
     $widget = $this->fetch("uid = {$uid}");
     $app = array();
     if (!empty($widget)) {
         $app = App::model()->fetchAll("FIND_IN_SET(`appid`, '{$widget["widget"]}')");
     }
     return $app;
 }
Beispiel #3
0
 /**
  * Validate a session token, returning the user ID
  * @param  string $token
  * @return int|bool FALSE or a User ID
  */
 static function validateToken($tokenString)
 {
     $token = \App::model('user/token');
     $token->load(['token = ?', $tokenString]);
     if ($token->get('id')) {
         if (strtotime($token->get('expires_at')) > time()) {
             return $token->get('user_id');
         } else {
             $token->delete();
         }
     }
     return false;
 }
Beispiel #4
0
 /**
  * DELETE /post/@id.json
  * Delete a post
  * 
  * @param \Base $fw
  * @param array $params
  */
 public function delete(\Base $fw, array $params)
 {
     $userId = self::_requireAuth();
     $post = \App::model('post')->load($params['id']);
     if (!$post->id) {
         \App::error(404);
     }
     if ($post->user_id != $userId && $post->page_id != $userId) {
         \App::error(403);
     }
     $post->erase();
     $this->_json(["success" => true]);
 }
Beispiel #5
0
 public function actionGetApp()
 {
     $catId = intval(EnvUtil::getRequest("catid"));
     $category = AppCategory::model()->fetch("catid = {$catId}");
     $page = intval(EnvUtil::getRequest("page"));
     $limit = ($page - 1) * 18;
     $pageNum = 18;
     if ($catId == 0) {
         $appCount = App::model()->count("appid");
     } else {
         $appCount = App::model()->count("catid = {$catId}");
     }
     $pages = $appCount % $pageNum == 0 ? intval($appCount / $pageNum) : intval($appCount / $pageNum) + 1;
     $condition = $catId == 0 ? "appid LIMIT {$limit},{$pageNum}" : "catid = {$category["catid"]} and appid LIMIT {$limit},{$pageNum}";
     $appList = App::model()->fetchAll($condition);
     $this->ajaxReturn(array("isSuccess" => true, "data" => $appList, "pages" => $pages));
 }
Beispiel #6
0
 /**
  * POST /u/@user/posts.json
  */
 public function post($f3, $params)
 {
     $userId = self::_requireAuth();
     if (!$userId) {
         \App::error(401);
     }
     $page = \App::model('user')->load(array('username = ?', $request->username));
     if (!$page->get('id')) {
         \App::error(404);
     }
     // TODO: Throw 403 if attempting to post to page that is not a buddy
     // Create the post
     $post = \App::model('post');
     $post->page_id = $page->id;
     $post->user_id = $userId;
     $post->content = $_POST['content'];
     $post->save();
     $this->_json($post->data());
 }
 public function actionIndex($id_ap)
 {
     $model = new AppUsers();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     // echo "fora post";
     //  var_dump($_POST);
     if (isset($_POST['AppUsers'])) {
         echo "post";
         $model->attributes = $_POST['AppUsers'];
         $nome = $_POST['AppUsers']['id_users'];
         $model->setAttribute('id_users', $nome);
         $model->setAttribute('id_app', $id_ap);
         if ($model->save()) {
             Yii::app()->user->setFlash(TbHtml::ALERT_COLOR_SUCCESS, '<strong>Fine!</strong> Sharing saved with sucess!');
             Yii::app()->controller->refresh();
             // $this->redirect('/mtcontrool/index/appUsers/index.php');
             //$this->refresh;
         }
     }
     $nomeApp = App::model()->findByPk($id_ap);
     $this->render('index', array('id_ap' => $id_ap, 'model' => $model, 'nomeApp' => $nomeApp->name));
 }
Beispiel #8
0
 /**
  * This is the default 'index' action that is invoked
  * when an action is not explicitly requested by users.
  */
 public function actionIndex()
 {
     $uid = Yii::app()->request->getParam('uid');
     //用户信息
     $owner = User::model()->findByPk($uid);
     //8个应用
     $apps = App::model()->findAll();
     //应用的计数
     //$apps_num = $this->api->space_getCount($this->uid);
     $apps_num = array();
     //是否自己的空间
     $mid = Yii::app()->user->id;
     $is_me = false;
     if ($uid == $mid) {
         $is_me = true;
     }
     $may_users = array();
     //空间主人的好友
     $friend_list = $owner->getUserFriends($uid);
     $visitors = array();
     $data = array('owner' => $owner, 'is_me' => $is_me, 'apps' => $apps, 'apps_num' => $apps_num, 'uid' => $uid, 'mid' => $mid, 'may_users' => $may_users, 'visitors' => $visitors, 'friend_list' => $friend_list);
     $this->render('index', $data);
 }
 public function actionRodada($id)
 {
     //$model = $this->loadModel ( $id );
     // echo $id;
     $model = new Runs('rod');
     $model->unsetAttributes();
     // clear any default values
     if (isset($_GET['Runs'])) {
         $model->attributes = $_GET['Runs'];
     }
     $criteria = new CDbCriteria();
     $dataProvider = new CActiveDataProvider('Runs', array('criteria' => $criteria));
     $criteria->addCondition(array("condtion" => "id_app = {$id}"));
     $nomeApp = App::model()->findByPk($id);
     // $criteria->compare('id_app', $id, true, 'OR');
     $this->render('adminRuns', array('id' => $id, 'nomeApp' => $nomeApp->name, 'model' => $model, 'dataProvider' => $dataProvider));
 }
    <?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");
 }
<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}'))));
$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'))))));
<?php

/* @var $this RunsController */
/* @var $data Runs */
?>

<link rel="stylesheet" type="text/css"
	href="<?php 
echo Yii::app()->request->baseUrl;
?>
/css/users.css" />
        
<?php 
$plataforma = Platforms::model()->findByPk($data->id_platform);
$app = App::model()->findByPk($data->id_app);
$userId = Yii::app()->user->id;
?>

<?php 
echo CHtml::encode($app->name);
?>


<div class="well">

	<?php 
echo CHtml::link('View Dashboard', array('view', 'id' => $data->id), array('class' => 'btn'));
?>
	<br />

	<b><?php 
Beispiel #15
0
 protected function renderContent()
 {
     $apps = App::model()->findAll();
     $data = array('apps' => $apps);
     $this->render('userApp', $data);
 }
Beispiel #16
0
 /**
  * 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 the ID of the model to be loaded
  */
 public function loadModel($id)
 {
     $model = App::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
 public static function setModel($model)
 {
     self::$model = $model;
 }