当前位置: 首页>>代码示例>>PHP>>正文


PHP Files::unsetAttributes方法代码示例

本文整理汇总了PHP中Files::unsetAttributes方法的典型用法代码示例。如果您正苦于以下问题:PHP Files::unsetAttributes方法的具体用法?PHP Files::unsetAttributes怎么用?PHP Files::unsetAttributes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Files的用法示例。


在下文中一共展示了Files::unsetAttributes方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: actionView

 /**
  * Вывод инфы о бане
  * @param integer $id ID бана
  */
 public function actionView($id)
 {
     // Подгружаем комментарии и файлы
     $files = new Files();
     //$this->performAjaxValidation($files);
     $files->unsetAttributes();
     $comments = new Comments();
     $comments->unsetAttributes();
     // Подгружаем баны
     $model = Bans::model()->with('admin')->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     $geo = false;
     // Проверка прав на просмотр IP
     $ipaccess = Webadmins::checkAccess('ip_view');
     if ($ipaccess) {
         $geo = array('city' => 'Н/А', 'region' => 'Не определен', 'country' => 'Не определен', 'lat' => 0, 'lng' => 0);
         $get = @file_get_contents('http://ipgeobase.ru:7020/geo?ip=' . $model->player_ip);
         if ($get) {
             $xml = @simplexml_load_string($get);
             if (!empty($xml->ip)) {
                 $geo['city'] = $xml->ip->city;
                 $geo['region'] = $xml->ip->region;
                 $geo['country'] = $xml->ip->country;
                 $geo['lat'] = $xml->ip->lat;
                 $geo['lng'] = $xml->ip->lng;
             }
         }
     }
     // Добавление файла
     if (isset($_POST['Files'])) {
         // Задаем аттрибуты
         $files->attributes = $_POST['Files'];
         $files->bid = intval($id);
         if ($files->save()) {
             $this->refresh();
         }
     }
     // Добавление комментария
     if (isset($_POST['Comments'])) {
         //exit(print_r($_POST['Comments']));
         $comments->attributes = $_POST['Comments'];
         $comments->bid = $id;
         if ($comments->save()) {
             $this->refresh();
         }
     }
     // Выборка комментариев
     $c = new CActiveDataProvider($comments, array('criteria' => array('condition' => 'bid = :bid', 'params' => array(':bid' => $id))));
     // Выборка файлов
     $f = new CActiveDataProvider(Files::model(), array('criteria' => array('condition' => 'bid = :bid', 'params' => array(':bid' => $id))));
     // История банов
     $history = new CActiveDataProvider('Bans', array('criteria' => array('condition' => '`bid` <> :hbid AND (`player_ip` = :hip OR `player_id` = :hid)', 'params' => array(':hbid' => $id, ':hip' => $model->player_ip, ':hid' => $model->player_id)), 'pagination' => array('pageSize' => 5)));
     // Вывод всего на вьюху
     $this->render('view', array('geo' => $geo, 'ipaccess' => $ipaccess, 'model' => $model, 'files' => $files, 'comments' => $comments, 'f' => $f, 'c' => $c, 'history' => $history));
 }
开发者ID:urichalex,项目名称:CS-Bans,代码行数:61,代码来源:BansController.php

示例2: array

            
        </div>
        <div class="col-md-4 col-sm-6">
            <?php 
$this->beginWidget('TbPanel', array('header' => Yii::t('app', "EAV Fields")));
$this->Widget('application.modules.eav.components.eavProp', array('name' => get_class($model), 'attr' => $model->getEavAttributes()));
$this->endWidget();
?>
            <?php 
?>
            <?php 
if (!$model->isNewRecord) {
    $this->beginWidget('TbPanel', array('header' => Yii::t('app', "Attached files")));
    $this->widget('CMultiFileUpload', array('name' => 'Files', 'model' => $model, 'id' => 'Files', 'accept' => '*', 'duplicate' => 'Duplicate file!', 'denied' => 'Invalid file type'));
    $files = new Files('search');
    $files->unsetAttributes();
    $files->parent_type = get_class($model);
    $files->parent_id = $model->id;
    $this->widget('EExcelView', array('id' => 'itm-file-grid', 'dataProvider' => $files->search(), 'template' => '{items}{pager}', 'ajaxUpdate' => true, 'columns' => array(array('name' => 'name', 'type' => 'raw', 'value' => 'CHtml::link(CHtml::encode($data->name), Yii::app()->createUrl("download/".$data->id))'), array('name' => 'date', 'value' => 'date("' . Yii::app()->locale->getDateFormat('phpdatetime') . '",CDateTimeParser::parse($data->date,"' . Yii::app()->locale->getDateFormat('yiidbdatetime') . '"))'), array('class' => 'CButtonColumn', 'template' => '{delete}', 'buttons' => array('delete' => array('label' => '<i class="glyphicon glyphicon-trash"></i>', 'deleteConfirmation' => true, 'imageUrl' => false, 'url' => 'Yii::app()->createUrl("files/delete", array("id"=>$data->id))'))))));
    $this->endWidget();
}
?>


        </div>
    </div>
    <?php 
//echo $form->labelEx($model,'owner');
?>
    <?php 
//echo $form->dropDownList($model,'owner',CHtml::listData(User::model()->findAll(), 'id', 'username'));
开发者ID:hkhateb,项目名称:linet3,代码行数:30,代码来源:_form.php

示例3: actionAdmin

 /**
  * Manages all models.
  */
 public function actionAdmin()
 {
     $model = new Files('search');
     $model->unsetAttributes();
     // clear any default values
     if (isset($_GET['Files'])) {
         $model->attributes = $_GET['Files'];
     }
     $this->render('admin', array('model' => $model));
 }
开发者ID:evgeny-yakovets,项目名称:book_site,代码行数:13,代码来源:FilesController.php


注:本文中的Files::unsetAttributes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。