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


PHP Preference::model方法代码示例

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


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

示例1: getHideArchive

 public function getHideArchive()
 {
     $userId = Yii::app()->user->id;
     if ($userId) {
         $preference = Preference::model()->find("userId = {$userId} AND hideProject = 'archive'");
         if ($preference) {
             return false;
         } else {
             return true;
         }
     }
     return true;
 }
开发者ID:Romandre90,项目名称:vectortraveler,代码行数:13,代码来源:Preference.php

示例2: actionPreferences

 public function actionPreferences()
 {
     $project = $_POST['project'];
     $userId = Yii::app()->user->id;
     $preference = Preference::model()->find("hideProject = '{$project}' AND userId = {$userId}");
     if ($preference) {
         $preference->delete();
         echo "deletion ok";
     } else {
         $model = new Preference();
         $model->hideProject = $_POST['project'];
         if ($model->save()) {
             echo "insertion ok";
         } else {
             throw new CHttpException(404, 'Error.');
         }
     }
 }
开发者ID:Romandre90,项目名称:vectortraveler,代码行数:18,代码来源:EquipmentController.php

示例3: actionPreferences

 public function actionPreferences()
 {
     $project = $_POST['project'];
     $hide = $_POST['hide'];
     $userId = Yii::app()->user->id;
     $preference = Preference::model()->find("hideProject = '{$project}' AND userId = {$userId}");
     if (!isset($hide)) {
         if ($preference) {
             $preference->delete();
             echo "deletion ok";
         } else {
             $model = new Preference();
             $model->hideProject = $_POST['project'];
             if ($model->save()) {
                 echo "insertion ok";
             } else {
                 throw new CHttpException(404, 'Error.');
             }
         }
     } else {
         if ($hide == 0) {
             if ($preference) {
                 $preference->delete();
                 echo "deletion ok";
             }
         } else {
             //throw new CHttpException(666, 'VEDIAMO COSA SCRIVE');
             if (!$preference) {
                 $model = new Preference();
                 $model->hideProject = $project;
                 if ($model->save()) {
                     echo "insertion ok";
                 } else {
                     throw new CHttpException(404, 'Error.');
                 }
             }
         }
     }
 }
开发者ID:Romandre90,项目名称:vectortraveler,代码行数:39,代码来源:TravelerController.php

示例4: array

<?php

/* @var $this Controller */
$this->beginContent('//layouts/main');
Yii::app()->clientScript->registerScriptFile('../../js/filter.js');
?>
<div class="span-5 first">
    <div id="sidebar_left">
        <?php 
$this->beginWidget('zii.widgets.CPortlet', array('title' => Yii::t('default', 'Filter')));
if ($this->uniqueid == 'traveler') {
    echo "<div>" . CHtml::checkBox("archive", Preference::model()->hideArchive, array('onChange' => 'javascript:onChangeFilter(this)')) . " <label for='archive' class='archive'>Deprecated versions</label></div><hr>";
}
echo "<div>" . CHtml::checkBox("selectAll") . " <label for='selectAll' class='selectAll'>Select all</label></div><hr>";
foreach ($this->projects as $project) {
    echo "<script> addProject({$project->id});</script>";
    echo "<div>" . CHtml::checkBox("p" . $project->id, $project->hide, array('class' => 'project')) . " <label for='p{$project->id}'>{$project->identifier}</label></div>";
    if ($this->action->id != "assembly") {
        if ($project->hide) {
            $style = "style='margin-left:10px'";
        } else {
            $style = "style='display:none;margin-left:10px'";
        }
        foreach ($project->components as $component) {
            echo "<div class='p{$component->projectId}' {$style}>" . CHtml::checkBox("c{$component->id}", $component->hide, array('onChange' => 'javascript:onChangeFilter(this)')) . " <label for='c{$component->id}'>{$component->identifier}</label></div>";
        }
    }
}
$this->endWidget();
?>
开发者ID:Romandre90,项目名称:vectortraveler,代码行数:30,代码来源:column3.php

示例5: findByOpenId

 public function findByOpenId($openid)
 {
     return Preference::model()->find('openidurl=:openidurl', array(':openidurl' => $openid));
 }
开发者ID:sljm12,项目名称:TestDrive,代码行数:4,代码来源:Preference.php

示例6: actionPreference

 public function actionPreference()
 {
     $openidurl = Yii::app()->user->id;
     if ($openidurl == null) {
         throw new CHttpException(401, 'Not authorised');
     }
     $model = new Preference();
     $saved_model = Preference::model()->findByOpenId($openidurl);
     if ($saved_model != null) {
         $model =& $saved_model;
     }
     $categories = Category::model()->getAllCategories();
     //$model->email_newsletter=true;
     if (isset($_POST['Preference'])) {
         $model->attributes = $_POST['Preference'];
         $model->openidurl = $openidurl;
         $model->save();
         $this->render('preference', array('model' => $model));
     } else {
         $this->render('preference', array('model' => $model));
     }
 }
开发者ID:sljm12,项目名称:TestDrive,代码行数:22,代码来源:SiteController.php

示例7: foreach

$archive = "";
foreach ($query as $q) {
    $pname = $q['pname'];
    $pid = $q['pid'];
    $cname = $q['cname'];
    $cid = $q['cid'];
    $tname = $q['tname'];
    $tid = $q['tid'];
    $project = Project::model()->findByPk($pid);
    $component = Components::model()->findByPk($cid);
    $traveler = Traveler::model()->findByPk($tid);
    if ($projectId != $pid) {
        $componentId = 0;
        $workId = 0;
        $status = 0;
        if (Preference::model()->hideArchive) {
            $styleA = "";
        } else {
            $styleA = "style='display:none'";
        }
        if ($project->hide) {
            $style = "";
        } else {
            $style = "style='display:none'";
        }
        ?>
            <?php 
        echo "{$archive}{$ul}{$ul}{$ul}";
        $ul = "";
        $archive = "";
        ?>
开发者ID:Romandre90,项目名称:vectortraveler,代码行数:31,代码来源:index.php


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