PHP Method Yii::App Code Examples

This page contains top rated real world PHP examples of method Yii::App extracted from open source projects. You can rate examples to help us improve the quality of examples
Example #1
Show file File: WSphinxResult.php Project: zwq/unpei
0
 protected function fetchData()
 {
     if ($this->criteria->filters["make"]) {
         $make = $this->criteria->filters["make"];
         $make_num = $make / 1000000;
         $search = "search_" . $make_num;
         $this->criteria->from = $this->criteria->from . "_{$make}";
         $search = Yii::app()->{$search};
     } else {
         $search = Yii::App()->search;
     }
     $search->setArrayResult($this->arrayResult);
     $search->setMatchMode($this->matchMode);
     $search->setMaxQueryTime($this->maxQueryTime);
     if (($pagination = $this->getPagination()) !== false) {
         $pagination->setItemCount($this->getTotalItemCount());
         $limit = $pagination->getLimit();
         $offset = $pagination->getOffset();
         $this->criteria->paginator = $pagination;
     }
     $search->SetLimits($offset, $limit);
     $searchCriteria = $this->criteria;
     $rs = $search->searchRaw($searchCriteria);
     if ($rs["total_found"]) {
         $this->totalNum = $rs["total_found"];
     }
     return $rs["matches"];
 }
Example #2
Show file File: UserIdentity.php Project: shobhit6993/Placement-Portal
0
 public function authenticate()
 {
     if ($this->username == 'admin' && $this->password == 'admin') {
         $this->errorCode = self::ERROR_NONE;
         $this->_id = 0;
         Yii::app()->session['role'] = 0;
         return !$this->errorCode;
     }
     $username = $this->username;
     $connection = Yii::App()->db;
     $sql = "select id,level,email_id,password from login where email_id = :email_id";
     $users = $connection->createCommand($sql)->bindValue('email_id', $username)->queryRow();
     $sql = "select email_id,password where `email_id`='" . $username . "';";
     if (!isset($users['email_id'])) {
         $this->errorCode = self::ERROR_USERNAME_INVALID;
     } elseif ($users['password'] !== md5($this->password)) {
         $this->errorCode = self::ERROR_PASSWORD_INVALID;
     } else {
         $this->_id = $users['id'];
         Yii::app()->session['role'] = $users["level"];
         $this->_email_id = $users["email_id"];
         $this->_level = $users["level"];
         $this->errorCode = self::ERROR_NONE;
     }
     return !$this->errorCode;
 }
Example #3
Show file File: CompanyController.php Project: shobhit6993/Placement-Portal
0
 public function actionViewJobProfiles()
 {
     $sqlcount = $count = Yii::app()->db->createCommand("SELECT COUNT(*) FROM job_profile t2 WHERE t2.c_id = " . Yii::App()->user->id)->queryScalar();
     $sql = "SELECT * FROM job_profile t2 WHERE t2.c_id = " . Yii::App()->user->id;
     $dataprovider = new CSqlDataProvider($sql, array('db' => Yii::app()->db, 'keyField' => 'j_id', 'totalItemCount' => $sqlcount));
     $this->render('viewjobprofiles', array('dataprovider' => $dataprovider));
 }
Example #4
Show file File: OrderItemController.php Project: sanggabee/fmi-mini-market
0
 /**
  * Lazy loading of order.
  * Order ID should be passed from a parameter.
  *
  * @return type 
  */
 public function getOrder()
 {
     if ($this->_order === null) {
         $orderId = Yii::App()->request->getParam('order_id');
         $this->_order = Order::model()->findByPk($orderId);
     }
     return $this->_order;
 }
Example #5
Show file File: PageController.php Project: naguale/paradise
0
 public function actionUserpage()
 {
     $criteria = new CDbCriteria();
     $criteria->condition = 'user_id="' . Yii::App()->user->id . '"';
     $criteria->order = 'title ASC';
     $dataProvider = new CActiveDataProvider('Page', array('criteria' => $criteria));
     $this->render('userpage', array('dataProvider' => $dataProvider, 'model' => $model));
 }
Example #6
Show file File: SiteController.php Project: naguale/paradise
0
 /**
  * Displays the login page
  */
 public function actionRegistration()
 {
     $model = new User();
     if (isset($_POST['User'])) {
         $model->attributes = $_POST['User'];
         if ($model->save()) {
             Yii::App()->user->setFlash('registration', '');
             $this->redirect(array('/page/room'));
         }
     }
     $this->render('registration', array('model' => $model));
 }
Example #7
Show file File: OrderController.php Project: sanggabee/fmi-mini-market
0
 public function actionFinish($id)
 {
     if (Yii::App()->request->isPostRequest) {
         $model = $this->loadModel($id);
         if ($model->finish()) {
             echo CJSON::encode(array('error' => 0));
         } else {
             echo CJSON::encode(array('error' => 1, 'message' => Yii::t('app', $model->getError('state'))));
         }
     } else {
         throw new CHttpException(400, 'Invalid page request!');
     }
 }
Example #8
Show file File: Controller.php Project: kostya1017/our
0
 public function init()
 {
     $app = Yii::App();
     // Register dropbox autoload
     spl_autoload_unregister(array('YiiBase', 'autoload'));
     require_once 'protected/vendors/dropbox-sdk-php/lib/Dropbox/autoload.php';
     spl_autoload_register(array('YiiBase', 'autoload'));
     // There are two WebUser to not have conflicts, one for the front-end and one for the back-end, this sets it to the front-end
     if (isset(Yii::app()->userFront)) {
         Yii::app()->setComponent('user', Yii::app()->userFront);
     }
     // Register JS and CSS files
     $app->clientScript->registerCoreScript('jquery');
     $app->clientScript->registerScriptFile('/javascript/bootstrap.min.js', CClientScript::POS_HEAD);
     $app->clientScript->registerScriptFile('/javascript/ie10-viewport-bug-workaround.js', CClientScript::POS_HEAD);
     $app->clientScript->registerScriptFile('/javascript/global.js', CClientScript::POS_HEAD);
     // Makes it so it throws and error if an alias exist for the current route and hasn't been used
     $app->urlManager->forceAliases();
 }
Example #9
Show file File: OfferController.php Project: shobhit6993/Placement-Portal
0
 public function actionAccept($j_id, $c_id)
 {
     if (Yii::app()->session['role'] == 1) {
         $offerAcCount = count(Yii::app()->db->createCommand("select c_id from offers where st_id = " . Yii::app()->user->id . " and ppo <> 'Y' and accepted = 'Y'")->queryAll());
         if ($offerAcCount == 0) {
             $connection = Yii::App()->db;
             $sql = "UPDATE offers set accepted = 'Y' where j_id = :j_id and c_id = :c_id and st_id = " . Yii::app()->user->id;
             $command = $connection->createCommand($sql);
             $command->bindParam(":j_id", $j_id, PDO::PARAM_STR);
             $command->bindParam(":c_id", $c_id, PDO::PARAM_STR);
             $command->execute();
             Yii::app()->user->setFlash('success', 'Accepted');
             $this->redirect(array('student/viewOffers'));
         } else {
             Yii::app()->user->setFlash('error', 'Slow down! You are already placed. Let others have a chance my friend');
             $this->redirect(array('student/viewOffers'));
         }
     }
 }
Example #10
Show file File: RbacBackendController.php Project: sherifflight/yupe
0
 public function actionInlineEdit()
 {
     if (!Yii::app()->request->isPostRequest || !Yii::app()->request->isAjaxRequest) {
         throw new CHttpException(404);
     }
     $pk = Yii::app()->request->getPost('pk');
     $value = Yii::app()->request->getPost('value');
     $name = Yii::app()->request->getPost('name');
     if (!isset($pk, $name)) {
         throw new CHttpException(404);
     }
     $model = AuthItem::model()->find('name = :name', array(':name' => $pk));
     if (null === $model) {
         throw new CHttpException(403);
     }
     $model->{$name} = $value;
     if (!$model->save()) {
         throw new CHttpException(500, $model->getError($name));
     }
     Yii::App()->ajax->success();
 }
Example #11
Show file File: SearchController.php Project: porem/yupe-ext
0
 function actionSearch($q = null, $page = 1)
 {
     $pages = new CPagination();
     $pages->pageSize = 50;
     $pages->currentPage = $page;
     $p = new CHtmlPurifier();
     $q = CHtml::encode($p->purify($q));
     $searchCriteria = new stdClass();
     $searchCriteria->select = 'id';
     $searchCriteria->query = $q . '*';
     $searchCriteria->paginator = $pages;
     $searchCriteria->from = join(",", $this->indexes);
     // Получаем данные в виде массива
     $resArray = Yii::App()->search->searchRaw($searchCriteria);
     $news = null;
     if (is_array($resArray['matches'])) {
         $c = new CDbCriteria();
         $c->order = 'FIELD(id,' . join(",", array_keys($resArray['matches'])) . ')';
         $news = News::model()->findAllByPk(array_keys($resArray['matches']), $c);
     }
     $this->render("search_results", array('news' => $news));
 }
Example #12
Show file File: Controller.php Project: jjsub/samesub
0
 /**
  * Log each appropiate request on the application
  *
  */
 private function log_request()
 {
     $command = Yii::app()->db->createCommand();
     //Do NOT log some specific actions in some specific conditions
     //ie:We should not be logging each user subject fetch unless there is a new subject(that would be a line in the log every 10 sec)
     if ($this->action->Id == 'js') {
         $this->no_log = true;
     }
     if (Log::is_bot($_SERVER['HTTP_USER_AGENT'])) {
         $this->no_log = true;
     }
     ///Dont log if its a bot request
     if ($this->no_log == false) {
         try {
             $command->insert('log', array('time' => SiteLibrary::utc_time(), 'session_id' => Yii::app()->getSession()->getSessionID(), 'user_id' => (int) Yii::app()->user->id, 'controller' => $this->id, 'action' => $this->action->Id, 'uri' => Yii::App()->request->getRequestUri(), 'model' => get_class($this->model), 'model_id' => isset($this->model->id) ? (int) $this->model->id : 0, 'theme' => Yii::app()->getTheme() ? strtolower(substr(Yii::app()->getTheme()->getName(), 0, 2)) : 're'));
             //Get real clients ip if from a proxy
             $client_ip = "";
             $client_host = !empty($_SERVER["HTTP_X_FORWARDED_HOST"]) ? $_SERVER["HTTP_X_FORWARDED_HOST"] : "";
             if (!empty($_SERVER["HTTP_CLIENT_IP"])) {
                 $client_ip = $_SERVER["HTTP_CLIENT_IP"];
                 //first verify ip from share internet
             } elseif (!empty($_SERVER["HTTP_X_FORWARDED_FOR"])) {
                 $client_ip = $_SERVER["HTTP_X_FORWARDED_FOR"];
                 //if not then for a proxy user
             } else {
             }
             //Only the first request should go here
             //if(Yii::App()->request->getCookies()->getCount() == 0)//If cookies are not set this might be the first request
             if (Yii::app()->session->get('site_loaded') != "yes") {
                 $command->insert('log_detail', array('log_id' => Yii::app()->db->getLastInsertID(), 'session' => Yii::app()->getSession()->getSessionID(), 'client_ip' => $client_ip, 'client_host' => $client_host, 'request_ip' => $_SERVER['REMOTE_ADDR'], 'request_host' => $_SERVER['REMOTE_HOST'], 'agent' => $_SERVER['HTTP_USER_AGENT'], 'referer' => $_SERVER['HTTP_REFERER'], 'charset' => $_SERVER['HTTP_ACCEPT_CHARSET'], 'language' => $_SERVER['HTTP_ACCEPT_LANGUAGE'], 'device' => substr(SiteLibrary::get_device(), 0, 2)));
             }
         } catch (CException $e) {
             Yii::log($e, 'warning', 'system.web.Controller');
         }
         //'params'=>serialize($this->actionParams)
     }
 }
Example #13
Show file File: list.php Project: std66/de-pti
0
<?php

Flaticon::Register("/css/flaticon");
$this->pageTitle = "Tananyagok";
$this->breadcrumbs = array('Tantárgyak' => array('subject/index'), $data->name => array('subject/details', 'id' => $data->subject_id), 'Fájlok');
$form_target = Yii::App()->createUrl("file/upload", array("id" => $data->subject_id));
function GetMaxUploadFileSize()
{
    $val = trim(ini_get("post_max_size"));
    $last = strtolower($val[strlen($val) - 1]);
    switch ($last) {
        case 'g':
            $val *= 1024;
        case 'm':
            $val *= 1024;
        case 'k':
            $val *= 1024;
    }
    return $val;
}
$formatter = new CFormatter();
$UploadLimit = $formatter->formatSize(GetMaxUploadFileSize());
?>

<div class="container">
	<div class="row">
		<div class="col-xs-12">
			<h2><?php 
print $data->name;
?>
</h2>
Example #14
Show file File: main.php Project: nhuhtlb/linxbooks
0
/js/autosize/jquery.autosize.min.js"></script>
	<script src="<?php 
echo Yii::App()->baseUrl;
?>
/js/bootstrap-hover-dropdown.js"></script>
	<script src="<?php 
echo Yii::App()->baseUrl;
?>
/js/bootstrap-hover-dropdown.min.js"></script>
	
        <script src="<?php 
echo Yii::App()->baseUrl;
?>
/js/jquery.blockUI.js"></script>
	<script src="<?php 
echo Yii::App()->baseUrl;
?>
/js/linxbooks.lbInvoice.js"></script>
	
	<?php 
//Yii::app()->editable->init();
?>
	<script src="<?php 
echo Yii::app()->baseUrl;
?>
/js/application.js"></script>
	<script>hljs.initHighlightingOnLoad();</script>
	<script type="text/javascript" src="<?php 
echo Yii::app()->baseUrl;
?>
/js/jquery.contactable.min.js"></script>
Example #15
Show file File: CreateSitemapCommand.php Project: jessesiu/GigaDBV3
0
 protected function createLink($directory)
 {
     return Yii::App()->params['home_url'] . "/{$directory}";
 }
Example #16
Show file File: welcome.php Project: snapfrozen/boxomatic
0
<?php

$appName = Yii::App()->name;
$adminEmail = SnapUtil::config('boxomatic/adminEmail');
?>
<div class="row">
	<div class="large-8 columns">
		
		<h2>Registration Successful</h2>

		<h4>Hi <?php 
echo $User->first_name;
?>
!</h4>	
 
		<p>Thank you for joining the <?php 
echo $appName;
?>
 project.
		We look forward to supplying you with lots of 
		fresh, local seasonal produce in the future.</p>

		<p>You can check your account status and previous 
		orders <?php 
echo CHtml::link('here', array('extras/order'));
?>
.</p>

		<p>When depositing money via bank transfer, please use your <?php 
echo $appName;
?>
Example #17
Show file File: SubjectController.php Project: std66/de-pti
0
 /**
  * Új előfeltételt vesz fel a megadott tantárgyhoz.
  * @param int $id A tantárgy azonosítója
  */
 public function actionAddDependency($id)
 {
     $model = new SubjectDependencies();
     //TODO: Ellenőrizni kellene, hogy egyáltalán léteznek-e ezek a tantárgyak
     $model->subject_id = (int) $id;
     $model->dependent_subject_id = $_POST["dependency_id"];
     $model->save();
     $this->redirect(Yii::App()->createUrl("subject/details", array("id" => $id)));
 }
Example #18
Show file File: PlacementRepController.php Project: shobhit6993/Placement-Portal
0
 public function actionAfterPost($st_id, $c_id, $j_id, $pr_id)
 {
     $model = new Comments();
     // uncomment the following code to enable ajax-based validation
     /*
     if(isset($_POST['ajax']) && $_POST['ajax']==='job-profile-_form-form')
     {
         echo CActiveForm::validate($model);
         Yii::app()->end();
     }
     */
     if (isset($_POST['Comments'])) {
         $model->txt = $_POST['Comments']['txt'];
         $model->st_id = $st_id;
         $model->c_id = $c_id;
         $model->j_id = $j_id;
         $model->pr_id = Yii::App()->user->id;
         if ($model->validate()) {
             // form inputs are valid, do something here
             $model->save();
             Yii::app()->user->setFlash('success', 'Comment Posted Successfully ');
             $this->redirect(array('index'));
             return;
         } else {
             var_dump($model->getErrors());
             echo 'validation problem';
         }
     }
 }
Example #19
Show file File: surveybar_view.php Project: GuillaumeSmaha/LimeSurvey
0
    ?>
" role="button">
                    <span class="icon-import"></span>
                    <?php 
    eT('Import a question');
    ?>
                </a>
            <?php 
}
?>

            <?php 
if (isset($surveybar['importquestiongroup'])) {
    ?>
                <a class="btn btn-default" href="<?php 
    echo Yii::App()->createUrl('admin/questiongroups/sa/importview/surveyid/' . $surveyid);
    ?>
" role="button">
                    <span class="icon-import"></span>
                    <?php 
    eT('Import a group');
    ?>
                </a>
            <?php 
}
?>
        </div>

        <!-- right action buttons -->
        <div class=" col-md-4 text-right">
            <?php 
Example #20
Show file File: SortableCGridView.php Project: Wladimir89/software1grh
0
 /**
  * Returns the javascript code responsable of handling the drag and drop sorting through an Ajax request
  *
  * @return string drag and drop sorting javascript code
  */
 protected function getSortScript()
 {
     return '
      var grid_id = ' . Cjavascript::encode($this->getId()) . ';
      var grid_selector = ' . Cjavascript::encode('#' . $this->getId()) . ';
      var tbody_selector = ' . Cjavascript::encode('#' . $this->getId() . ' tbody') . ';
      /*apply sortable*/
      $(tbody_selector).sortable(' . CJavascript::encode($this->jqueryUiSortableOptions) . ');
      /*helper to keep each table cell width while dragging*/
      $(tbody_selector).sortable("option", "helper", function(e, ui) {
         ui.children().each(function() {
            $(this).width($(this).width());
         });
         return ui;
      });
      /*add dragged row index before moving as an attribute. Used to know if item is moved forward or backward*/
      $(tbody_selector).bind("sortstart", function(event, ui) {
         ui.item.attr("data-prev-index", ui.item.index());
      });
      /*trigger ajax sorting when grid is updated*/
      $(tbody_selector).bind("sortupdate", function(event, ui) {
         $(grid_selector).addClass(' . CJavascript::encode($this->loadingCssClass) . ');
         var data = {};
         data["dragged_item_id"] = parseInt(ui.item.attr("data-id"));
         var prev_index = parseInt(ui.item.attr("data-prev-index"));
         var new_index = parseInt(ui.item.index());
         /*which item place take dragged item*/
         if (prev_index < new_index) {
            data["replacement_item_id"] = ui.item.prev().attr("data-id");
         } else {
            data["replacement_item_id"] = ui.item.next().attr("data-id");
         }
         data["model"] = ' . Cjavascript::encode($this->dataProvider->modelClass) . ';
         data["order_field"] = ' . Cjavascript::encode($this->orderField) . ';
         data["YII_CSRF_TOKEN"] = ' . Cjavascript::encode(Yii::app()->getRequest()->getCsrfToken()) . ';
         ui.item.removeAttr("data-prev-index");
         ' . CHtml::ajax(array('type' => 'POST', 'url' => Yii::App()->controller->createAbsoluteUrl($this->orderUrl), 'data' => 'js:data', 'success' => 'js:function() {
               $(grid_selector).removeClass(' . CJavascript::encode($this->loadingCssClass) . ');
               /*update the whole grid again to update row class values*/
               if ("' . (string) $this->updateAfterSorting . '") {
                  $.fn.yiiGridView.update(grid_id);
               }
               if ("' . (string) $this->successMessage . '") {
                  alert(' . CJavascript::encode($this->successMessage) . ');
               }
             }
            ', 'error' => 'js:function() {
               $(grid_selector).removeClass(' . CJavascript::encode($this->loadingCssClass) . ');
               alert(' . CJavascript::encode($this->errorMessage) . ');
               $.fn.yiiGridView.update(grid_id);
            }
            ')) . '
      });
   ';
 }
Example #21
Show file File: JobProfileController.php Project: shobhit6993/Placement-Portal
0
 public function actionCreate()
 {
     $model = new JobProfile();
     // uncomment the following code to enable ajax-based validation
     /*
     if(isset($_POST['ajax']) && $_POST['ajax']==='job-profile-_form-form')
     {
         echo CActiveForm::validate($model);
         Yii::app()->end();
     }
     */
     if (isset($_POST['JobProfile'])) {
         $model->attributes = $_POST['JobProfile'];
         echo strtotime($model->deadline);
         /*echo "<pre>";
           print_r($_POST['checkbox_list_name']);
           echo "</pre>";*/
         $model->c_id = Yii::App()->user->id;
         if ($model->validate()) {
             // form inputs are valid, do something here
             $model->save();
             $lastTemp = Yii::app()->db->getLastInsertID();
             echo $lastTemp;
             foreach ($_POST['checkbox_list_name'] as $dept) {
                 $model1 = new JobProfileBranches();
                 $model1->j_id = $lastTemp;
                 $model1->c_id = $model->c_id;
                 $model1->dept = $dept;
                 $model1->save();
             }
             Yii::app()->user->setFlash('success', 'Job Profile Successfully Created. Pending Approval From ADMIN');
             $this->redirect(array('company/viewjobprofiles'));
             return;
         }
     }
     $this->render('_form', array('model' => $model));
 }
Example #22
Show file File: details.php Project: std66/de-pti
0
					</div>
				</div>
			';
}
?>
	
	<div class="row">
		<div class="col-xs-12">
			<h3>Előkövetelmények</h3>
			<?php 
if (Yii::app()->user->getId() && Yii::app()->user->level >= 1) {
    ?>
			<p>
				<p>
					<form method="post" action="<?php 
    print Yii::App()->createUrl("subject/adddependency", array("id" => $data->subject_id));
    ?>
">
						Előkövetelmény hozzáadása:<br/>
						<div class="input-group">
							<select name="dependency_id" class="form-control" aria-describedby="subject_add_button">
								<?php 
    foreach (Subject::model()->findAll(array('order' => 'name')) as $CurrentSubject) {
        if ($CurrentSubject->subject_id != $data->subject_id && ($CurrentSubject->semester < $data->semester || $data->semester == null) && $data->semester != 1) {
            print '<option value="' . $CurrentSubject->subject_id . '">' . $CurrentSubject->name . "</option>\n";
        }
    }
    ?>
							</select>
							<span class="input-group-btn" id="subject_add_button">
								<button type="submit" class="btn btn-success">
Example #23
Show file File: surveybar_view.php Project: joaocc/LimeSurvey--LimeSurvey
0
                            <?php eT("List questions");?>
                        </a>
                    </li>
                <?php endif; ?>


            <?php endif;?>
            <?php if(isset($surveybar['importquestion'])):?>
                <a class="btn btn-default" href="<?php echo Yii::App()->createUrl('admin/questions/sa/importview/groupid/'.$groupid.'/surveyid/'.$surveyid);?>" role="button">
                    <span class="icon-import"></span>
                    <?php eT('Import a question'); ?>
                </a>
            <?php endif;?>

            <?php if(isset($surveybar['importquestiongroup'])):?>
                <a class="btn btn-default" href="<?php echo Yii::App()->createUrl('admin/questiongroups/sa/importview/surveyid/'.$surveyid);?>" role="button">
                    <span class="icon-import"></span>
                    <?php eT('Import a group'); ?>
                </a>
            <?php endif;?>
        </div>

        <!-- right action buttons -->
        <div class=" col-md-4 text-right">
            <?php if(isset($surveybar['savebutton']['form'])):?>

                <!-- Save -->
                <a class="btn btn-success" href="#" role="button" id="save-button" >
                    <span class="glyphicon glyphicon-ok"></span>
                    <?php eT("Save");?>
                </a>
Example #24
Show file File: userpage.php Project: naguale/paradise
0
<?php

printf("<h3>Личный кабинет пользователя %s.</h3>", Yii::App()->user->name);
printf("<h3>Баланс: %s\$</h3>", UserCount::getBalance(Yii::app()->user->id));
?>

<?php 
$this->widget('zii.widgets.CMenu', array('items' => array(array('label' => 'Создать статью', 'url' => array('/page/create'), 'visible' => !Yii::app()->user->isGuest), array('label' => 'Просмотр статей', 'url' => array('/page/userpage'), 'visible' => !Yii::app()->user->isGuest), array('label' => 'Выход', 'url' => array('/site/logout'), 'visible' => !Yii::app()->user->isGuest), array('label' => 'Вход', 'url' => array('/site/login'), 'visible' => Yii::app()->user->isGuest))));
?>

<h3>Просмотр статей</h3>

<?php 
$this->widget('zii.widgets.grid.CGridView', array('id' => 'page-grid', 'dataProvider' => $dataProvider, 'columns' => array('title', 'text', 'symbols' => array('name' => 'Количество символов', 'value' => 'UserCount::getSymbols($data->id)'), 'publish' => array('name' => 'Опубликованно', 'value' => '($data->publish == 1)?"Да":"Нет"'), 'coins' => array('name' => 'Вознаграждение', 'value' => 'UserCount::getReward($data->id)."$"'), array('class' => 'CButtonColumn'))));
Example #25
Show file File: FileController.php Project: std66/de-pti
0
 /**
  * Értékelést ad le a megadott fájlra.
  * 
  * @param int $id A fájl azonosítója
  * @param int $useful Hasznos-e a fájl
  * @throws CHttpException Ha a kért fájl nem létezik
  */
 public function actionVote($id, $useful)
 {
     $id = (int) $id;
     $useful = (bool) $useful;
     $model = File::model()->findByPk($id);
     if ($model == null) {
         throw new CHttpException(404, "A kért elem nem található");
     }
     if ($useful) {
         $model->vote_useful++;
     } else {
         $model->vote_useless++;
     }
     $model->save();
     $this->redirect(Yii::App()->createUrl("file/list", array("id" => $model->subject_id)));
 }
Example #26
Show file File: show.php Project: std66/de-pti
0
<?php

/* @var $this SiteController */
$this->pageTitle = $model->title;
$sh = new StringHelper();
FbUtils::AddMetaTags('DE-PTI - ' . $model->title, Yii::app()->params["domain"] . 'de-pti', $sh->substr($model->contents, 0, 60));
$FacebookUrl = Yii::app()->params['domain'] . Yii::App()->createUrl("site/showNews", array("id" => $data->news_id));
?>

<div class="container">
	<div class="row">
		<div class="col-xs-12 text-align-justify">
			<p><?php 
print nl2br($model->contents);
?>
</p>
		</div>
	</div>
	
	<div class="row">
		<div class="col-xs-12">
			<h3>Várjuk a véleményedet!</h3>
			<div class="text-align-center">
				<div class="fb-comments" data-width="690" data-href="<?php 
print $FacebookUrl;
?>
" data-numposts="5" data-colorscheme="light"></div>
			</div>
		</div>
	</div>
</div>
Example #27
Show file File: ApplyController.php Project: shobhit6993/Placement-Portal
0
 public function actionView()
 {
     if (Yii::app()->session['role'] == 1) {
         $sqlcount = Yii::app()->db->createCommand("select count(*) from student as s, apply as a, job_profile as jp\n\t\t\twhere s.st_id=a.st_id and a.j_id = jp.j_id and a.c_id = jp.c_id and s.st_id = " . Yii::App()->user->id)->queryScalar();
         $sql = "select a.cv_id, a.j_id, a.c_id, a.tstamp, c.name as cname, j.description, j.ctc, j.cpi_cutoff, j.approved, j.deadline, s.st_id, s.roll_no, s.name from student as s, apply as a, job_profile as j, company as c\n\t\t\twhere s.st_id=a.st_id and a.j_id = j.j_id and a.c_id = j.c_id and j.c_id = c.c_id and s.st_id = " . Yii::App()->user->id;
         $dataProvider = new CSqlDataProvider($sql, array('db' => Yii::app()->db, 'keyField' => 'j_id', 'totalItemCount' => $sqlcount));
         $this->render('view', array('dataProvider' => $dataProvider));
     } else {
         if (Yii::app()->session['role'] == 2) {
             $sqlcount = Yii::app()->db->createCommand("select count(*) from student as s, apply as a, job_profile as jp\n\t\t\twhere s.st_id=a.st_id and a.j_id = jp.j_id and a.c_id = jp.c_id and jp.c_id = " . Yii::App()->user->id)->queryScalar();
             $sql = "select a.cv_id, a.j_id, a.c_id, a.tstamp, c.name as cname, j.description, j.ctc, j.cpi_cutoff, j.approved, j.deadline, s.st_id, s.roll_no, s.name from student as s, apply as a, job_profile as j, company as c\n\t\t\twhere s.st_id=a.st_id and a.j_id = j.j_id and a.c_id = j.c_id and and j.c_id = c.c_id and j.c_id = " . Yii::App()->user->id;
             $dataProvider = new CSqlDataProvider($sql, array('db' => Yii::app()->db, 'keyField' => 'j_id', 'totalItemCount' => $sqlcount));
             $this->render('view', array('dataProvider' => $dataProvider));
         } else {
             $this->redirect(array('index.php?r=site/index'));
         }
     }
 }
Example #28
Show file File: details.php Project: std66/de-pti
0
<?php

$this->pageTitle = "A tananyagról bővebben";
$this->breadcrumbs = array('Tantárgyak' => array('subject/index'), $data->subject->name => array('subject/details', 'id' => $data->subject_id), 'Fájlok' => array('file/list', 'id' => $data->subject_id), $data->filename_real);
$FacebookUrl = Yii::app()->params['domain'] . Yii::App()->createUrl("file/details", array("id" => $data->file_id));
?>

<div class="container">
	<div class="row">
		<div class="col-xs-12">
			<h2><?php 
print $data->filename_real;
?>
</h2>
		</div>
	</div>
	
	<div class="row">
		<div class="col-xs-12">
			<p>
				<?php 
print CHtml::link('<i class="fa fa-download"></i> Letöltés', array('file/download', 'id' => $data->file_id), array('class' => 'btn btn-md btn-primary'));
?>
					
				<p>
					<?php 
print $data->formattedBytes;
?>
					<br/>
					Eddig <?php 
print $data->downloads;
Example #29
Show file File: SlotsController.php Project: shobhit6993/Placement-Portal
0
 public function actionAllotPptSlots($slot_id, $c_id)
 {
     if (Yii::app()->session['role'] == 0) {
         try {
             $connection = Yii::App()->db;
             $sql = "INSERT INTO ppt_slots (c_id,slot_id) values (:c_id,:slot_id)";
             $command = $connection->createCommand($sql);
             $command->bindParam(":c_id", $c_id, PDO::PARAM_STR);
             $command->bindParam(":slot_id", $slot_id, PDO::PARAM_STR);
             $command->execute();
         } catch (Exception $e) {
             Yii::app()->user->setFlash('error', 'Unable to insert slot');
         }
     } else {
         Yii::app()->user->setFlash('error', 'You are not authorized to perform such actions');
     }
     $this->redirect(array('viewPptSlots'));
 }
Example #30
Show file File: GroupController.php Project: kittolau/gcm
0
 public function actionGroupMemberList($id)
 {
     $this->layout = 'memberCenter';
     $model = $this->loadModel($id);
     $currentUesrId = Yii::App()->user->id;
     if (!$model->isGroupOwners($currentUesrId)) {
         throw new CHttpException(404, "You are not the owner");
     }
     $allMembers = $model->getAllMembers();
     $memberRelationList = $model->getMemberRelation();
     $this->render('groupMemberList', array('model' => $model, 'allMembers' => $allMembers, 'memberRelationList' => $memberRelationList));
 }