示例#1
0
 public function actionPending()
 {
     $model = new SampleNew('search');
     $model->unsetAttributes();
     // clear any default values
     if (isset($_GET['SampleNew'])) {
         $model->attributes = $_GET['SampleNew'];
     }
     $action = isset($_GET['action']) ? $_GET['action'] : false;
     if ($action == 'delete') {
         Yii::app()->db->createCommand("UPDATE samples_new_sne SET pending_action_sne='Delete' WHERE id_sne=" . (int) $_GET['idf'])->execute();
         Yii::app()->user->setFlash('_success', "Sample file will be deleted soon!");
         header("Location: " . $_SERVER['HTTP_REFERER']);
     } elseif ($action == 'rescan') {
         Yii::app()->db->createCommand("UPDATE samples_new_sne SET pending_action_sne='Rescan' WHERE id_sne=" . (int) $_GET['idf'])->execute();
         Yii::app()->user->setFlash('_success', "Sample file will be rescan soon!");
         header("Location: " . $_SERVER['HTTP_REFERER']);
     }
     $this->render('pending', array('model' => $model, 'status' => 'Pending'));
 }
示例#2
0
 public function actionSamples()
 {
     if (isset($_POST['interval'])) {
         $_SESSION['interval_start'] = $_POST['interval_start'] . ' 00:00:00';
         $_SESSION['interval_end'] = $_POST['interval_end'] . ' 23:59:59';
     } elseif (isset($_POST['interval_reset'])) {
         unset($_SESSION['interval_start']);
         unset($_SESSION['interval_end']);
     }
     if (!isset($_GET['status'])) {
         $status = 'detected';
     } else {
         $status = $_GET['status'];
     }
     switch ($status) {
         case 'detected':
             $model = new SampleDetected('search');
             $model->unsetAttributes();
             // clear any default values
             if (isset($_GET['SampleDetected'])) {
                 $model->attributes = $_GET['SampleDetected'];
             }
             $action = isset($_GET['action']) ? $_GET['action'] : false;
             if ($action == 'rescan') {
                 Yii::app()->db->createCommand("UPDATE samples_detected_sde SET pending_action_sde='Rescan' WHERE id_sde=" . (int) $_GET['idf'])->execute();
                 header("Location: " . $_SERVER['HTTP_REFERER']);
             } elseif ($action == 'delete') {
                 Yii::app()->db->createCommand("UPDATE samples_detected_sde SET pending_action_sde='Delete' WHERE id_sde=" . (int) $_GET['idf'])->execute();
                 header("Location: " . $_SERVER['HTTP_REFERER']);
             } elseif ($action == 'enable') {
                 Yii::app()->db->createCommand("UPDATE samples_detected_sde SET enabled_sde=1 WHERE id_sde=" . (int) $_GET['idf'])->execute();
                 header("Location: " . $_SERVER['HTTP_REFERER']);
             } elseif ($action == 'disable') {
                 Yii::app()->db->createCommand("UPDATE samples_detected_sde SET enabled_sde=0 WHERE id_sde=" . (int) $_GET['idf'])->execute();
                 header("Location: " . $_SERVER['HTTP_REFERER']);
             }
             break;
         case 'clean':
             $model = new SampleClean('search');
             $model->unsetAttributes();
             // clear any default values
             if (isset($_GET['SampleClean'])) {
                 $model->attributes = $_GET['SampleClean'];
             }
             $action = isset($_GET['action']) ? $_GET['action'] : false;
             if ($action == 'rescan') {
                 Yii::app()->db->createCommand("UPDATE samples_clean_scl SET pending_action_scl='Rescan' WHERE id_scl=" . (int) $_GET['idf'])->execute();
                 header("Location: " . $_SERVER['HTTP_REFERER']);
             } elseif ($action == 'delete') {
                 Yii::app()->db->createCommand("UPDATE samples_clean_scl SET pending_action_scl='Delete' WHERE id_scl=" . (int) $_GET['idf'])->execute();
                 header("Location: " . $_SERVER['HTTP_REFERER']);
             } elseif ($action == 'enable') {
                 Yii::app()->db->createCommand("UPDATE samples_clean_scl SET enabled_scl=1 WHERE id_scl=" . (int) $_GET['idf'])->execute();
                 header("Location: " . $_SERVER['HTTP_REFERER']);
             } elseif ($action == 'disable') {
                 Yii::app()->db->createCommand("UPDATE samples_clean_scl SET enabled_scl=0 WHERE id_scl=" . (int) $_GET['idf'])->execute();
                 header("Location: " . $_SERVER['HTTP_REFERER']);
             }
             break;
         case 'pending':
             $model = new SampleNew('search');
             $model->unsetAttributes();
             // clear any default values
             if (isset($_GET['SampleNew'])) {
                 $model->attributes = $_GET['SampleNew'];
             }
             $action = isset($_GET['action']) ? $_GET['action'] : false;
             if ($action == 'delete') {
                 Yii::app()->db->createCommand("UPDATE samples_new_sne SET pending_action_sne='Delete' WHERE id_sne=" . (int) $_GET['idf'])->execute();
                 header("Location: " . $_SERVER['HTTP_REFERER']);
                 die;
             }
             break;
     }
     $this->render('samples', array('status' => $status, 'model' => $model, 'per_page' => isset($_SESSION['files_per_page']) ? $_SESSION['files_per_page'] : 250));
 }