public function actionReturnForm()
 {
     if (isset($_POST['update_id'])) {
         $model = $this->loadModel($_POST['update_id']);
         $model->setScenario('edit');
     } else {
         $model = new Teasers('create');
     }
     if (isset($_GET['n'])) {
         $model->news_id = $_GET['n'];
     }
     $this->disableClientScripts();
     $this->renderPartial('_form', array('model' => $model, 'platforms' => Platforms::model()->printable()->notDeleted()->active()->with('tags')->findAll('is_external = 0')), false, true);
 }
 public function perform()
 {
     if ($this->canPerform()) {
         //            $this->processGeo();
         $this->addCache();
         $this->updateScore();
         $campaignPlatforms = Platforms::model()->getAllActiveByCampaignId($this->getCampaign()->id);
         $this->updateCampaignCities($campaignPlatforms);
         $this->updateCampaignCountries($campaignPlatforms);
         foreach ($this->getCampaign()->activeNews as $news) {
             $platforms = Platforms::model()->getAllActiveByNewsId($news->id);
             if ($platforms) {
                 $this->updateNewsCities($platforms, $news);
                 $this->updateNewsCountries($platforms, $news);
             }
         }
     }
 }
Exemple #3
0
 /**
  * @param $reportName
  * @param Campaigns $campaign
  * @param integer $platform_id
  * @param $dateFrom
  * @param $dateTo
  * 
  * @return ExcelReport
  * @throws Exception
  */
 public static function create($reportName, Campaigns $campaign, $platform_id, $dateFrom, $dateTo)
 {
     switch ($reportName) {
         case 'ExcelReportByPeriodForClient':
             return new ExcelReportByPeriodForClient($campaign, $dateFrom, $dateTo);
         case 'ExcelReportByPeriod':
             return new ExcelReportByPeriod($campaign, $dateFrom, $dateTo);
         case 'ExcelReportFull':
             return new ExcelReportFull($campaign, $dateFrom, $dateTo);
         case 'ExcelReportForPartner':
             $platform = Platforms::model()->findByPk($platform_id);
             if (!$platform) {
                 throw new Exception('Report not found');
             }
             return new ExcelReportForPartner($campaign, $platform, $dateFrom, $dateTo);
         default:
             throw new Exception('Report not found');
     }
 }
 /**
  * Updates a particular model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id the ID of the model to be updated
  */
 public function actionUpdate($id)
 {
     $model = $this->loadModel($id);
     $modelsBrands = Brand::model()->findAll();
     $brandsArray = CHtml::listData($modelsBrands, 'id', 'brand_name');
     $modelsPlatforms = Platforms::model()->findAll();
     $platformsArray = CHtml::listData($modelsPlatforms, 'id', 'name');
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['buttonCancel'])) {
         $this->redirect(array('admin'));
     }
     if (isset($_POST['Device'])) {
         $model->attributes = $_POST['Device'];
         /*GARENTE QUE O NOME DO DEVICE SEMPRE SEJA SALVO EM MAIÚSCULO*/
         $model->description = strtoupper($model->description);
         if ($model->save()) {
             $this->redirect(array('admin', 'id' => $model->id));
         }
     }
     $this->render('update', array('model' => $model, 'brandsArray' => $brandsArray, 'platformsArray' => $platformsArray));
 }
//array que ir� receber as plataformas selecionadas
$selected_platforms = array();
//para cada plataforma, insere os id_plataforma escolhidos no array
foreach ($model->platforms as $platform) {
    array_push($selected_platforms, $platform->id);
}
?>
			
			<div>
                            	<?php 
echo TbHtml::label($model->getAttributeLabel('platforms'), 'Platforms');
?>
				
				<div class="portlet-content">
				<?php 
echo TbHtml::inlineCheckBoxList('Platforms', $selected_platforms, CHtml::listData(Platforms::model()->findAll(), 'id', 'name'), array('template' => '{input} {label}'));
?>
				<?php 
echo $form->error($model, 'platforms');
?>
				</div>
			</div>
			
			</br></br>
			<?php 
//array que ir� receber os sados selecionados
$selected_languages = array();
//para cada plataforma
foreach ($model->languages as $language) {
    array_push($selected_languages, $language->id);
}
    /**
     * Updates a particular model.
     * If update is successful, the browser will be redirected to the 'view' page.
     * @param integer $id the ID of the model to be updated
     */
    public function actionUpdate($id)
    {
        $model = $this->loadModel($id);
        $modelList = new Element('search');
        $modelsPlatforms = Platforms::model()->findAll();
        $platformsArray = CHtml::listData($modelsPlatforms, 'id', 'name');
        //$modelsDevices= Device::model()->findAll();
        //$devicesArray = CHtml::listData($modelsDevices, 'ID', 'DESCRIPTION');
        $devicesArray = array();
        $devicesObjectsArray = array();
        //$modelInst=new ElementInst('search');
        // Uncomment the following line if AJAX validation is needed
        // $this->performAjaxValidation($model);
        if (isset($_POST['buttonCancel'])) {
            $_SESSION['model-element'] = null;
            $_SESSION['form-element'] = null;
            $this->redirect(array('admin'));
        }
        if (array_key_exists('form-element', $_SESSION)) {
            if ($_SESSION['form-element'] == "p2") {
                $_SESSION['form-element'] = null;
                $model = $_SESSION['model-element'];
                $_SESSION['model-element'] = null;
                //$model->attributes=$_POST['Element'];
                //echo "teste";
                //echo $model->DESCRIPTION;
                //print_r($_POST);
                $arrayIdDevices = array();
                foreach ($_POST as $key => $value) {
                    if ($value == 1) {
                        //echo $key."<br>";
                        array_push($arrayIdDevices, $key);
                    }
                }
                //break;
                $model->setRelationRecords('devices', is_array(@$arrayIdDevices) ? $arrayIdDevices : array());
                //$model->setRelationRecords('devices',is_array(@$_POST['Devices']) ? $_POST['Devices'] : array());
                /*GARENTE QUE O NOME DO ELEMENTO SEMPRE SEJA SALVO EM MAIÚSCULO*/
                $model->description = strtoupper($model->description);
                if ($model->save()) {
                    //$this->redirect(array('admin'/*,'id'=>$model->ID*/));
                    //$this->redirect("/mtcontrool/index.php/elementVar/update?idElement=".$model->ID);
                    $this->redirect('/mtcontrool/index.php/Element/admin');
                }
            }
        }
        if (isset($_POST['Element'])) {
            $model->attributes = $_POST['Element'];
            $model->setRelationRecords('platforms', is_array(@$_POST['Platforms']) ? $_POST['Platforms'] : array());
            if ($_SESSION['form-element'] == "p1") {
                $_SESSION['form-element'] = null;
                //$selected_platforms = array ();
                //para cada plataforma, insere os id_plataforma escolhidos no array
                //var_dump($model->platforms);
                $tempArray = array();
                $count = 0;
                $tempArray = array();
                foreach ($model->platforms as $platform) {
                    $device = Device::model()->findAllBySql('SELECT *
															  FROM device
															  WHERE id_platform=' . $platform->id . ' ORDER BY description');
                    array_push($tempArray, $device);
                    $count++;
                }
                if ($tempArray != null) {
                    if ($tempArray[0]) {
                        foreach ($tempArray as $value) {
                            if ($value) {
                                foreach ($value as $value1) {
                                    $devicesArray[$value1->id] = $value1->description;
                                    array_push($devicesObjectsArray, $value1);
                                }
                            }
                        }
                    }
                }
                $this->render('update_p2', array('model' => $model, 'platformsArray' => $platformsArray, 'devicesArray' => $devicesArray, 'devicesObjectsArray' => $devicesObjectsArray));
                $_SESSION['model-element'] = $model;
            }
            Yii::app()->user->setFlash('error', '');
        } else {
            $this->render('update', array('model' => $model, 'platformsArray' => $platformsArray, 'devicesArray' => $devicesArray));
        }
    }
	</p>

        <?php 
$user_Id = Yii::app()->user->id;
?>
    <?php 
echo $form->errorSummary($model);
?>

     
      <?php 
/*echo $form->dropDownListControlGroup($model,'id_platform',array(),array('id'=>'plat','empty'=>'Choose a platform'));*/
?>
      
     <?php 
echo $form->dropDownListControlGroup($model, 'id_platform', CHtml::listData(Platforms::model()->findAll(), 'id', 'name'), array('prompt' => 'Selected'));
?>
            
              
              
        <?php 
/*echo $form->dropDownListControlGroup($model,'id_app',CHtml::listData(App::model()->findAll(), 'id', 'name'),
  array(
      'prompt'=>'Selected',
  ));*/
?>
        
            <?php 
echo $form->textFieldControlGroup($model, 'version', array('span' => 5, 'maxlength' => 30));
?>
    <?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");
 }
$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'))))));
/css/users.css" />


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

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

<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' => 'runs-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'columns' => array(array('name' => 'id_app', 'value' => '$data->idApp->name'), array('header' => 'Run', 'name' => 'id_order', 'filter' => false), array('name' => 'id_platform', 'value' => 'Platforms::Model()->FindByPk($data->id_platform)->name', 'filter' => CHtml::listData(Platforms::model()->findAll(), 'id', 'name')), 'version', 'changelog', array('header' => 'Passed', 'value' => 'Runs::QuantidadePass($data->id)', 'htmlOptions' => array('style' => 'text-align: center'), 'headerHtmlOptions' => array('style' => 'color: green; text-align: center')), array('header' => 'Failed', 'value' => 'Runs::QuantidadeFail($data->id)', 'htmlOptions' => array('style' => 'text-align: center'), 'headerHtmlOptions' => array('style' => 'color: red; text-align: center')), array('header' => 'Completed (%)', 'headerHtmlOptions' => array('width' => '100'), 'value' => 'Runs::QuantidadeTotal($data->id)', 'htmlOptions' => array('style' => 'text-align: center'), 'headerHtmlOptions' => array('style' => 'text-align: center')), array('class' => 'bootstrap.widgets.TbButtonColumn', 'header' => 'Operations'))));
?>
</div><br/>
<?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 
<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}'))));
<link rel="stylesheet" type="text/css"
	href="<?php 
echo Yii::app()->request->baseUrl;
?>
/css/users.css" />

<?php 
/* @var $this DeviceController */
/* @var $model Device */
?>


<div class="infoblock shadow"><h1 style="color:#20B2AA; font-family: Arial">Manage Devices</h1></div>
<HR WIDTH=1180 ALIGN=LEFT >


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


<?php 
$this->widget('bootstrap.widgets.TbGridView', array('id' => 'device-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'columns' => array(array('header' => 'Model', 'name' => 'DESCRIPTION'), array('header' => 'Brand', 'filter' => CHtml::listData(Brand::model()->findAll(), 'BRAND_NAME', 'BRAND_NAME'), 'name' => 'ID_BRAND', 'value' => '$data->iDBRAND->BRAND_NAME'), array('header' => 'Platform', 'filter' => CHtml::listData(Platforms::model()->findAll(), 'name', 'name'), 'name' => 'ID_PLATFORM', 'value' => '$data->iDPLATFORM->name'), array('class' => 'bootstrap.widgets.TbButtonColumn', 'template' => '{update}&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp{delete}'))));
//var_dump($model->platforms);
foreach ($model->platforms as $platform) {
    array_push($selected_platforms, $platform->id);
}
?>
			
			
			<div>
				<?php 
echo TbHtml::label($model->getAttributeLabel('platforms'), 'Platforms');
?>
				
				<div class="portlet-content">
				<!--echo TbHtml::inlineCheckBoxList('Platforms',/*'', $platformsArray,*/-->
				<?php 
echo TbHtml::CheckBoxList('Platforms', $selected_platforms, CHtml::listData(Platforms::model()->findAll(), 'id', 'name'), array('id' => 'item', 'template' => '{input} {label}', 'onchange' => 'verificaChecks()'));
?>
				<?php 
echo $form->error($model, 'platforms');
?>
				</div>
			</div>



			<!--
			<?php 
//array que ir� receber as plataformas selecionadas
$selected_devices = array();
//para cada plataforma, insere os id_plataforma escolhidos no array
//var_dump($model->platforms);
 /**
  * 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 Platforms the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = Platforms::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
?>


<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 Devices</h1></div>
<HR WIDTH=1180 ALIGN=LEFT >


<?php 
$this->widget('bootstrap.widgets.TbBreadcrumb', array('links' => array('Manage Devices')));
?>
<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' => 'device-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'columns' => array(array('header' => 'Model', 'name' => 'description'), array('header' => 'Brand', 'filter' => CHtml::listData(Brand::model()->findAll(), 'brand_name', 'brand_name'), 'name' => 'id_brand', 'value' => '$data->iDBRAND->brand_name'), array('header' => 'Platform', 'filter' => CHtml::listData(Platforms::model()->findAll(), 'name', 'name'), 'name' => 'id_platform', 'value' => '$data->iDPLATFORM->name'), 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'))))));
 public function actionLista($id, $idPlat)
 {
     $nomePlat = Platforms::model()->findByPk($idPlat);
     $model = new Characteristic('searchLista');
     $model->unsetAttributes();
     // clear any default values
     //if(Yii::app()->request->isAjaxRequest){
     if (isset($_POST['confirm'])) {
         if (isset($_POST['selectedIds'])) {
             // print_r($_POST['selectedIds']);
             foreach ($_POST['selectedIds'] as $idT) {
                 $array1[] = $idT;
             }
             foreach ($array1 as $VETOR) {
                 $connection = Yii::app()->db;
                 //  $querido = "SELECT test_case.id FROM test_case WHERE id_characteristic =" .$VETOR ;
                 $querido = "SELECT TC.id FROM test_case as TC LEFT JOIN test_platform\n                            ON TC.id = test_platform.id_test_case \n                            WHERE test_platform.id_platform = " . $idPlat . " AND TC.id_characteristic = " . $VETOR;
                 $commando = $connection->createCommand($querido);
                 $vetorTesteEscolhido = $commando->query();
                 foreach ($vetorTesteEscolhido as $vetorzinho) {
                     $meuDeus[] = $vetorzinho["id"];
                 }
             }
             $connection = Yii::app()->db;
             $MY = "SELECT test_case.id FROM test_case LEFT JOIN test_platform ON test_case.id = test_platform.id_test_case WHERE test_case.id_characteristic IS NULL AND test_platform.id_platform = " . $idPlat;
             $commando = $connection->createCommand($MY);
             $tentativa = $commando->query();
             foreach ($tentativa as $vamo) {
                 $value[] = $vamo['id'];
             }
             $result = array_merge($value, $meuDeus);
             $test = json_encode($value);
             $que = json_encode($meuDeus);
             $mara = json_encode($result);
             foreach ($result as $key) {
                 if ($key != "") {
                     $id_testcase = $key;
                     $id_runs = $id;
                     $connection = Yii::app()->db;
                     $command = $connection->createCommand("INSERT INTO `test_run`(`id_runs`, `id_test_case`, `status`) VALUES (" . $id_runs . "," . $key . ",0)");
                     $rowCount = $command->execute();
                 }
             }
             $this->redirect(array('runs/view', 'id' => $id));
             // $this->redirect(array("/runs/Teste/","que"=>$que,"test"=>$test, "mara"=>$mara));
         }
     }
     $this->render('lista', array('model' => $model, 'idPlat' => $idPlat, 'nomePlat' => $nomePlat));
 }
<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'))))));
 public function actionListPlatforms()
 {
     if (isset($_POST['categoryid']) && $_POST['categoryid'] != '') {
         $categoryid = $_POST['categoryid'];
         /*   $MY1 = "SELECT DISTINCT p.id, p.name FROM platforms as p LEFT JOIN app_platform
              ON p.id = app_platform.id_platform
              WHERE app_platform.id_app = ;".$categoryid;
              //                $commando1=$connection->createCommand($MY1);
               //               $tentativa1=$commando1->query();
              $command = Yii::app()->createCommand($MY1);
              //  $command->bindValue(':id_cha', $_POST['Runs']['id_app'], PDO::PARAM_INT);
                $data1 = $command->execute();*/
         $categoryid = 22;
         $posts = Platforms::model()->findAllBySql("SELECT DISTINCT p.id, p.name FROM platforms as p LEFT JOIN app_platform\n                        ON p.id = app_platform.id_platform\n                        WHERE app_platform.id_app =" . $categoryid);
         $data = CHtml::listData($posts, 'id', 'name');
         echo CHtml::tag('option', array('value' => ''), CHtml::encode('Choose a platform'), true);
         foreach ($data as $id => $value) {
             echo CHtml::tag('option', array('value' => $id), CHtml::encode($value), true);
         }
     } else {
         echo CHtml::tag('option', array('value' => ''), CHtml::encode('Choose a platform'), true);
     }
 }
 public function actionIndex($id_plat)
 {
     $model = new CharacteristicPlatforms();
     if (isset($_POST['CharacteristicPlatforms'])) {
         //   echo "post";
         $model->attributes = $_POST['CharacteristicPlatforms'];
         $nome = $_POST['CharacteristicPlatforms']['id_characteristic'];
         // var_dump($nome);
         //$str = implode("", $nome);
         // print_r($str);
         $model->setAttribute('id_characteristic', $nome);
         $model->setAttribute('id_platform', $id_plat);
         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;
         }
     }
     $nomePlat = Platforms::model()->findByPk($id_plat);
     $this->render('index', array('id_plat' => $id_plat, 'model' => $model, 'nomePlat' => $nomePlat->name));
 }

<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('submit' => CHttpRequest::getUrlReferrer(), 'id' => 'b1', 'title' => 'Back', 'color' => TbHtml::BUTTON_COLOR_DEFAULT, 'size' => TbHtml::BUTTON_SIZE_SMALL, 'style' => 'color: green;'));
?>
            
            
            
                
        </div>

<div class="group-div">
   <div class="well-cinza">
                      <b><?php 
echo $nomeApp;
?>
</b>
                  </div>
<?php 
$this->widget('bootstrap.widgets.TbGridView', array('id' => 'runs-grid', 'dataProvider' => $model->rod($id), 'filter' => $model, 'columns' => array(array('header' => 'Run', 'name' => 'id_order', 'filter' => false), array('name' => 'id_platform', 'value' => 'Platforms::Model()->FindByPk($data->id_platform)->name', 'filter' => CHtml::listData(Platforms::model()->findAll(), 'id', 'name')), 'version', 'changelog', array('header' => 'Passed', 'value' => 'Runs::QuantidadePass($data->id)', 'htmlOptions' => array('style' => 'text-align: center'), 'headerHtmlOptions' => array('style' => 'color: green; text-align: center')), array('header' => 'Failed', 'value' => 'Runs::QuantidadeFail($data->id)', 'htmlOptions' => array('style' => 'text-align: center'), 'headerHtmlOptions' => array('style' => 'color: red; text-align: center')), array('header' => 'Completed (%)', 'headerHtmlOptions' => array('width' => '100'), 'value' => 'Runs::QuantidadeTotal($data->id)', 'htmlOptions' => array('style' => 'text-align: center'), 'headerHtmlOptions' => array('style' => 'text-align: center')), array('class' => 'bootstrap.widgets.TbButtonColumn', 'header' => 'Operations', 'headerHtmlOptions' => array('width' => '100'), 'template' => '{Dashboard} {update} {delete}', 'buttons' => array('update' => array('icon' => 'fa fa-pencil'), 'delete' => array('icon' => 'fa fa-trash-o'), 'Dashboard' => array('icon' => 'fa fa-tachometer', 'url' => 'Yii::app()->createUrl("runs/view", array("id"=>$data->id))'))))));
?>
</div>
<br/>
		    <?php 
foreach ($devicesObjectsArray as $key => $modelDevice) {
    ?>
		    	<?php 
    if ($modelDevice->id_platform != $anterior) {
        ?>
		    		<div class="table_list_devices" id="table_list_devices<?php 
        echo $modelDevice->id_platform;
        ?>
">

			    		<?php 
        $anterior = $modelDevice->id_platform;
        ?>
			    		<?php 
        $nomePlataforma = Platforms::model()->findByPk($modelDevice->id_platform);
        ?>
			    		<div class="platform_logo">
			    			<?php 
        echo CHtml::image(Yii::app()->request->baseUrl . "/fotos/" . $nomePlataforma->image . "", "kd", array('width' => '40px', 'height' => '40px', 'align' => 'center'));
        ?>
 
			    		</div>
			    		<div class="platform_name">
			    			<p class="label_platform"><?php 
        echo $modelDevice->iDPLATFORM->name;
        ?>
</p>
			    		</div>