/**
  * Lists all models.
  */
 public function actionIndex()
 {
     $model = new Devices('search');
     $model->unsetAttributes();
     // clear any default values
     if (isset($_GET['Devices'])) {
         $model->attributes = $_GET['Devices'];
     }
     //get device status
     $zwDevices = file_get_contents(Yii::app()->params['serverurl'] . "/server.php?command=devices");
     if ($zwDevices == "Error") {
         Yii::app()->user->setFlash('error', "Failed to connect to server!");
     } else {
         $devicelist = explode("#", $zwDevices);
         foreach ($devicelist as $device) {
             $node = explode("~", $device);
             $this->status[$node[1]] = $node[4];
         }
     }
     $this->render('index', array('model' => $model));
 }
 /**
  * Manages all models.
  */
 public function actionAdmin()
 {
     $model = new Devices('search');
     $model->unsetAttributes();
     // clear any default values
     if (isset($_GET['Devices'])) {
         $model->attributes = $_GET['Devices'];
     }
     if ($this->isExportRequest()) {
         $this->exportCSV($model->search(), array('name', 'category_id', 'location.name', 'commodity.name', 'user.name', 'status.status', 'manufacturer.name', 'consumabletype.name', 'managementtype.name', 'brand', 'serial_number', 'documentFileName', 'imageFileName', 'enable_financial', 'available_on_loan'));
     }
     $this->render('admin', array('model' => $model));
 }
 public function actionControl()
 {
     $model = new Devices('search');
     $model->unsetAttributes();
     // clear any default values
     if (isset($_GET['Devices'])) {
         $model->attributes = $_GET['Devices'];
     }
     $this->render('control', array('model' => $model));
 }