public static function searchDataProvider() { $model = new SampleDetected('search'); $model->unsetAttributes(); // clear any default values if (isset($_GET['SampleDetected'])) { $model->attributes = $_GET['SampleDetected']; } return $model->search(); }
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)); }