9 public $layout =
'//layouts/column2';
29 'actions' => array(
'index',
'view'),
30 'users' => array(
'@'),
33 'actions' => array(
'create',
'update'),
34 'users' => array(
'@'),
37 'actions' => array(
'abc'),
38 'users' => array(
'@'),
41 'actions' => array(
'download'),
42 'users' => array(
'@'),
45 'actions' => array(
'uploadPaper'),
46 'users' => array(
'@'),
49 'actions' => array(
'admin',
'delete'),
50 'users' => array(
'admin'),
53 'users' => array(
'*'),
63 $this->render(
'view', array(
78 if (isset($_POST[
'Paper'])) {
79 $model->attributes = $_POST[
'Paper'];
81 $this->redirect(array(
'view',
'id' => $model->id));
84 $this->render(
'create', array(
100 if (isset($_POST[
'Paper'])) {
101 $model->attributes = $_POST[
'Paper'];
103 $this->redirect(array(
'view',
'id' => $model->id));
106 $this->render(
'update', array(
120 if (!isset($_GET[
'ajax']))
121 $this->redirect(isset($_POST[
'returnUrl']) ? $_POST[
'returnUrl'] : array(
'admin'));
128 $dataProvider =
new CActiveDataProvider(
'Paper');
129 $this->render(
'index', array(
130 'dataProvider' => $dataProvider,
138 $model =
new Paper(
'search');
139 $model->unsetAttributes();
140 if (isset($_GET[
'Paper']))
141 $model->attributes = $_GET[
'Paper'];
143 $this->render(
'admin', array(
156 throw new CHttpException(404,
'The requested page does not exist.');
165 if (isset($_POST[
'ajax']) && $_POST[
'ajax'] ===
'paper-form') {
166 echo CActiveForm::validate($model);
173 $dir = Yii::getPathOfAlias(
'application.uploads');
176 $model =
new Paper();
177 if (isset($_POST[
'Paper'])) {
178 $model->attributes = $_POST[
'Paper'];
180 $file = CUploadedFile::getInstance($model,
'file');
181 if ($model->validate()) {
183 $uploaded = $file->saveAs($dir .
'/' . $file->getName());
191 $this->render(
'UploadPaper', array(
193 'uploaded' => $uploaded,
206 $name = $model->paper_name;
208 $filecontent = file_get_contents(Yii::getPathOfAlias(
'application.uploads') .
'/'.
$name);
209 header(
"Content-Type: application/pdf");
210 header(
"Content-disposition: attachment; filename=$name");
211 header(
"Pragma: no-cache");