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


PHP Label::model方法代码示例

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


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

示例1: run

 public function run()
 {
     $criteria = new CdbCriteria();
     $criteria->limit = $this->data('limit');
     $criteria->offset = $this->data('offset');
     $criteria->condition = "post_status='publish' AND (post_modified <= '" . date('Y-m-d H:i:s') . "' AND post_modified >= '" . $this->data('time') . "')";
     $criteria->order = 'post_hits DESC';
     if ($this->data('autoByTerm')) {
         if (isset($_GET['id'])) {
             $category = Category::model()->findByPK((int) $_GET['id']);
             $label = Label::model()->findByPK((int) $_GET['id']);
             $topic = Topic::model()->findByPK((int) $_GET['id']);
             $tag = Tag::model()->findByPK((int) $_GET['id']);
             if ($category != null) {
                 $criteria = $this->getCriteriaTerm('categories', $criteria);
             } elseif ($label != null) {
                 $criteria = $this->getCriteriaTerm('labels', $criteria);
             } elseif ($topic != null) {
                 $criteria = $this->getCriteriaTerm('topics', $criteria);
             } elseif ($tag != null) {
                 $criteria = $this->getCriteriaTerm('tags', $criteria);
             }
         }
     }
     $model = Post::model()->findAll($criteria);
     if ($model != null) {
         $this->layout($model);
     }
 }
开发者ID:beckblurry,项目名称:Yii1-Base-Core-V.Alpha.1,代码行数:29,代码来源:widget_terpopuler.php

示例2: loadModel

 private function loadModel($param = '')
 {
     $status = 'publish';
     $criteria = new CDbCriteria();
     $criteria->condition = "parent=0";
     $this->_labels = Label::model()->findAll($criteria);
     $this->_category = Category::model()->findAll($criteria);
     $criteria->condition = "post_status =:status";
     $criteria->params = array(':status' => $status);
     if ($param == 'post') {
         $criteria->order = "ID desc";
     } elseif ($param == 'populer') {
         $criteria->order = "post_hits desc";
     } else {
         $criteria->order = "ID desc";
     }
     foreach ($this->_labels as $label) {
         if ($label->slug == $param) {
             $criteria->with = array("labels");
             $criteria->together = true;
             $criteria->condition = "labels.slug='{$param}'";
             $criteria->order = "ID desc";
         }
     }
     foreach ($this->_category as $cat) {
         if ($cat->slug == $param) {
             $criteria->with = array("categories");
             $criteria->together = true;
             $criteria->condition = "categories.slug='{$param}'";
             $criteria->order = "ID desc";
         }
     }
     $dataProvider = new CActiveDataProvider('Post', array('criteria' => $criteria, 'pagination' => array('pageSize' => 10)));
     return $dataProvider;
 }
开发者ID:beckblurry,项目名称:Yii1-Base-Core-V.Alpha.1,代码行数:35,代码来源:IndeksController.php

示例3: loadModel

 private function loadModel($id, $slug)
 {
     $models = Label::model()->findByAttributes(array('term_id' => (int) $id, 'slug' => $slug));
     if ($models === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $models;
 }
开发者ID:beckblurry,项目名称:Yii1-Base-Core-V.Alpha.1,代码行数:8,代码来源:LabelController.php

示例4: updateset

function updateset($lid)
{
    $clang = Yii::app()->lang;
    // Get added and deleted languagesid arrays
    if ($_POST['languageids']) {
        $postlanguageids = sanitize_languagecodeS($_POST['languageids']);
    }
    if ($_POST['label_name']) {
        $postlabel_name = sanitize_labelname($_POST['label_name']);
    }
    $newlanidarray = explode(" ", trim($postlanguageids));
    $oldlangidsarray = array();
    $labelset = Labelsets::model()->findByAttributes(array('lid' => $lid));
    $oldlangidsarray = explode(' ', $labelset->languages);
    $addlangidsarray = array_diff($newlanidarray, $oldlangidsarray);
    $dellangidsarray = array_diff($oldlangidsarray, $newlanidarray);
    // If new languages are added, create labels' codes and sortorder for the new languages
    $result = Label::model()->findAllByAttributes(array('lid' => $lid), array('order' => 'code, sortorder, assessment_value'));
    if ($result) {
        foreach ($result as $row) {
            $oldcodesarray[$row['code']] = array('sortorder' => $row['sortorder'], 'assessment_value' => $row['assessment_value']);
        }
    }
    if (isset($oldcodesarray) && count($oldcodesarray) > 0) {
        foreach ($addlangidsarray as $addedlangid) {
            foreach ($oldcodesarray as $oldcode => $olddata) {
                $sqlvalues[] = array('lid' => $lid, 'code' => $oldcode, 'sortorder' => $olddata['sortorder'], 'language' => $addedlangid, 'assessment_value' => $olddata['assessment_value']);
            }
        }
    }
    if (isset($sqlvalues)) {
        foreach ($sqlvalues as $sqlvalue) {
            $label = new Label();
            foreach ($sqlvalue as $name => $value) {
                $label->setAttribute($name, $value);
            }
            $label->save();
        }
    }
    // If languages are removed, delete labels for these languages
    $criteria = new CDbCriteria();
    $criteria->addColumnCondition(array('lid' => $lid));
    $langcriteria = new CDbCriteria();
    foreach ($dellangidsarray as $dellangid) {
        $langcriteria->addColumnCondition(array('language' => $dellangid), 'OR');
    }
    $criteria->mergeWith($langcriteria);
    if (!empty($dellangidsarray)) {
        $result = Label::model()->deleteAll($criteria);
    }
    // Update the label set itself
    $labelset->label_name = $postlabel_name;
    $labelset->languages = $postlanguageids;
    $labelset->save();
}
开发者ID:pmaonline,项目名称:limesurvey-quickstart,代码行数:55,代码来源:label_helper.php

示例5: run

 public function run()
 {
     if ((int) $this->data('label') == 0) {
         $model = Label::model()->find(array('order' => 'term_id DESC'));
     } else {
         $model = Label::model()->findByPk((int) $this->data('label'));
     }
     if ($model !== null) {
         $this->layout($model);
     }
 }
开发者ID:beckblurry,项目名称:Yii1-Base-Core-V.Alpha.1,代码行数:11,代码来源:widget_labels.php

示例6: CSVImportSurvey


//.........这里部分代码省略.........
    }
    $insert = $surveyarray[0];
    $sfieldorders = convertCSVRowToArray($surveyarray[0], ',', '"');
    $sfieldcontents = convertCSVRowToArray($surveyarray[1], ',', '"');
    $surveyrowdata = array_combine($sfieldorders, $sfieldcontents);
    // Set new owner ID
    $surveyrowdata['owner_id'] = Yii::app()->session['loginID'];
    // Set new survey ID
    $surveyrowdata['sid'] = $iNewSID;
    $surveyrowdata['active'] = 'N';
    if (validateTemplateDir($surveyrowdata['template']) !== $surveyrowdata['template']) {
        $importresults['importwarnings'][] = sprintf($clang->gT('Template %s not found, please review when activating.'), $surveyrowdata['template']);
    }
    //if (isset($surveyrowdata['datecreated'])) {$surveyrowdata['datecreated'] = $connect->BindTimeStamp($surveyrowdata['datecreated']);}
    unset($surveyrowdata['expires']);
    unset($surveyrowdata['attribute1']);
    unset($surveyrowdata['attribute2']);
    unset($surveyrowdata['usestartdate']);
    unset($surveyrowdata['notification']);
    unset($surveyrowdata['useexpiry']);
    unset($surveyrowdata['url']);
    unset($surveyrowdata['lastpage']);
    if (isset($surveyrowdata['private'])) {
        $surveyrowdata['anonymized'] = $surveyrowdata['private'];
        unset($surveyrowdata['private']);
    }
    if (isset($surveyrowdata['startdate'])) {
        unset($surveyrowdata['startdate']);
    }
    $surveyrowdata['bounce_email'] = $surveyrowdata['adminemail'];
    if (empty($surveyrowdata['datecreated'])) {
        $surveyrowdata['datecreated'] = new CDbExpression('NOW()');
    }
    $iNewSID = Survey::model()->insertNewSurvey($surveyrowdata) or safeDie("<br />" . $clang->gT("Import of this survey file failed") . "<br />{$surveyarray[0]}<br /><br />\n");
    // Now import the survey language settings
    $fieldorders = convertCSVRowToArray($surveylsarray[0], ',', '"');
    unset($surveylsarray[0]);
    foreach ($surveylsarray as $slsrow) {
        $fieldcontents = convertCSVRowToArray($slsrow, ',', '"');
        $surveylsrowdata = array_combine($fieldorders, $fieldcontents);
        // convert back the '\'.'n' char from the CSV file to true return char "\n"
        $surveylsrowdata = array_map('convertCSVReturnToReturn', $surveylsrowdata);
        // Convert the \n return char from welcometext to <br />
        // translate internal links
        if ($bTranslateLinks) {
            $surveylsrowdata['surveyls_title'] = translateLinks('survey', $iOldSID, $iNewSID, $surveylsrowdata['surveyls_title']);
            $surveylsrowdata['surveyls_description'] = translateLinks('survey', $iOldSID, $iNewSID, $surveylsrowdata['surveyls_description']);
            $surveylsrowdata['surveyls_welcometext'] = translateLinks('survey', $iOldSID, $iNewSID, $surveylsrowdata['surveyls_welcometext']);
            $surveylsrowdata['surveyls_urldescription'] = translateLinks('survey', $iOldSID, $iNewSID, $surveylsrowdata['surveyls_urldescription']);
            $surveylsrowdata['surveyls_email_invite'] = translateLinks('survey', $iOldSID, $iNewSID, $surveylsrowdata['surveyls_email_invite']);
            $surveylsrowdata['surveyls_email_remind'] = translateLinks('survey', $iOldSID, $iNewSID, $surveylsrowdata['surveyls_email_remind']);
            $surveylsrowdata['surveyls_email_register'] = translateLinks('survey', $iOldSID, $iNewSID, $surveylsrowdata['surveyls_email_register']);
            $surveylsrowdata['surveyls_email_confirm'] = translateLinks('survey', $iOldSID, $iNewSID, $surveylsrowdata['surveyls_email_confirm']);
        }
        unset($surveylsrowdata['lastpage']);
        $surveylsrowdata['surveyls_survey_id'] = $iNewSID;
        $lsiresult = Surveys_languagesettings::model()->insertNewSurvey($surveylsrowdata) or safeDie("<br />" . $clang->gT("Import of this survey file failed") . "<br />");
    }
    // The survey languagesettings are imported now
    $aLanguagesSupported = array();
    // this array will keep all the languages supported for the survey
    $sBaseLanguage = Survey::model()->findByPk($iNewSID)->language;
    $aLanguagesSupported[] = $sBaseLanguage;
    // adds the base language to the list of supported languages
    $aLanguagesSupported = array_merge($aLanguagesSupported, Survey::model()->findByPk($iNewSID)->additionalLanguages);
    // DO SURVEY_RIGHTS
开发者ID:rawaludin,项目名称:LimeSurvey,代码行数:67,代码来源:import_helper.php

示例7: array

<?php

/* @var $this LabelController */
/* @var $data Label */
?>

<?php 
$this->widget('application.extensions.print.printWidget', array('cssFile' => 'print.css', 'printedElement' => '#view', 'htmlOptions' => array('style' => 'padding:20px')));
?>
<div id="view">

    <?php 
$labelRow = Label::model()->findByPk(6);
$attributes = str_replace(' ', '_', strtoupper($labelRow['fields']));
$itemId = $_GET['itemId'];
$connection = Yii::app()->db;
$sql = "\n\t\tselect {$attributes}\n\t\tfrom fopen \n\t\twhere ID ={$itemId}";
$command = $connection->createCommand($sql);
$dataReader = $command->queryAll();
$filetypeRow = FileType::model()->findByAttributes(array('name' => $_GET['fileType']));
$w = (int) $filetypeRow['label_width'];
$h = (int) $filetypeRow['label_height'];
?>
    
	<table class="table table-bordered" style='width:<?php 
echo $w . "px";
?>
;height:<?php 
echo $h . "px";
?>
'>
开发者ID:anjanababu,项目名称:Asset-Management,代码行数:31,代码来源:_label.php

示例8: ajaxSets

 public function ajaxSets()
 {
     $lid = Yii::app()->getRequest()->getPost('lid');
     $answers = Yii::app()->getRequest()->getPost('answers');
     $code = Yii::app()->getRequest()->getPost('code');
     $aAssessmentValues = Yii::app()->getRequest()->getPost('assessmentvalues', array());
     //Create new label set
     $language = "";
     foreach ($answers as $lang => $answer) {
         $language .= $lang . " ";
     }
     $language = trim($language);
     if ($lid == 0) {
         $lset = new LabelSet();
         $lset->label_name = Yii::app()->getRequest()->getPost('laname');
         $lset->languages = $language;
         $lset->save();
         $lid = getLastInsertID($lset->tableName());
     } else {
         Label::model()->deleteAll('lid = :lid', array(':lid' => $lid));
     }
     $res = 'ok';
     //optimistic
     foreach ($answers as $lang => $answer) {
         foreach ($answer as $key => $ans) {
             $label = new Label();
             $label->lid = $lid;
             $label->code = $code[$key];
             $label->title = $ans;
             $label->sortorder = $key;
             $label->language = $lang;
             $label->assessment_value = isset($aAssessmentValues[$key]) ? $aAssessmentValues[$key] : 0;
             if (!$label->save()) {
                 $res = 'fail';
             }
         }
     }
     echo ls_json_encode($res);
 }
开发者ID:wrenchpilot,项目名称:LimeSurvey,代码行数:39,代码来源:labels.php

示例9: ajaxlabelsetdetails

 /**
  * This function prepares the data for label set details
  *
  * @access public
  * @return void
  */
 public function ajaxlabelsetdetails()
 {
     $lid = returnglobal('lid');
     Yii::app()->loadHelper('surveytranslator');
     $labelsetdata = Labelsets::model()->find('lid=:lid', array(':lid' => $lid));
     //$connect->GetArray($query);
     $labelsetlanguages = explode(' ', $labelsetdata->languages);
     foreach ($labelsetlanguages as $language) {
         $criteria = new CDbCriteria();
         $criteria->condition = 'lid=:lid and language=:language';
         $criteria->params = array(':lid' => $lid, ':language' => $language);
         $criteria->order = 'sortorder';
         $labelsdata = Label::model()->findAll($criteria);
         $i = 0;
         foreach ($labelsdata as $labeldata) {
             $data[$i]['lid'] = $labeldata->lid;
             $data[$i]['code'] = $labeldata->code;
             $data[$i]['title'] = $labeldata->title;
             $data[$i]['sortorder'] = $labeldata->sortorder;
             $data[$i]['assessment_value'] = $labeldata->assessment_value;
             $data[$i]['language'] = $labeldata->language;
             $i++;
         }
         $labels = $data;
         //$labels=dbExecuteAssoc($query); //Label::model()->find(array('lid' => $lid, 'language' => $language), array('order' => 'sortorder')); //$connect->GetArray($query);
         $resultdata[] = array($language => array($labels, getLanguageNameFromCode($language, false)));
     }
     echo ls_json_encode($resultdata);
 }
开发者ID:ryu1inaba,项目名称:LimeSurvey,代码行数:35,代码来源:question.php

示例10: ajaxchecklabel

 public function ajaxchecklabel()
 {
     $iLabelID = (int) Yii::app()->request->getParam('lid');
     $aNewLanguages = Yii::app()->request->getParam('languages');
     $bCheckAssessments = Yii::app()->request->getParam('bCheckAssessments', 0);
     $arLabelSet = LabelSet::model()->find('lid=:lid', array(':lid' => $iLabelID));
     $iLabelsWithAssessmentValues = Label::model()->count('lid=:lid AND assessment_value<>0', array(':lid' => $iLabelID));
     $aLabelSetLanguages = explode(' ', $arLabelSet->languages);
     $aErrorMessages = array();
     if ($bCheckAssessments && $iLabelsWithAssessmentValues) {
         $aErrorMessages[] = gT('The existing label set has assessment values assigned.') . '<strong>' . gT('If you replace the label set the existing asssessment values will be lost.') . '</strong>';
     }
     if (count(array_diff($aLabelSetLanguages, $aNewLanguages))) {
         $aErrorMessages[] = gT('The existing label set has different/more languages.') . '<strong>' . gT('If you replace the label set these translations will be lost.') . '</strong>';
     }
     if (count($aErrorMessages)) {
         foreach ($aErrorMessages as $sErrorMessage) {
             echo $sErrorMessage . '<br>';
         }
         eT('Do you really want to continue?');
     } else {
         eT('You are about to replace an existing label set with the current answer options.');
         echo '<br>';
         eT('Continue?');
     }
 }
开发者ID:CSCI-462-01-2016,项目名称:LimeSurvey,代码行数:26,代码来源:questions.php

示例11: actionSetLabels

 /**
  * Set label for each tweet based on label definitions
  */
 public function actionSetLabels()
 {
     //step 0: set label weight based on attribute counting
     //$this->actionSetLabelWeight();
     //step 1: get all labels
     $arrLabelList = array();
     $objLabels = Label::model()->findAll(array('order' => 'weight DESC'));
     $objTweet = Tweet::model()->findAll('label_id IS NULL');
     $arrTweetList = array();
     foreach ($objLabels as $label) {
         $labelList = explode(" ", $label->name);
         foreach ($objTweet as $tweet) {
             $arrTweetWords = explode(" ", strtolower($tweet->tweet2));
             asort($arrTweetWords);
             $wordCounter = 0;
             foreach ($labelList as $labelItem) {
                 if (in_array(strtolower($labelItem), $arrTweetWords)) {
                     $wordCounter++;
                 }
             }
             if ($wordCounter > 0) {
                 $arrTweetList[$tweet->id][$label->id] = $wordCounter;
             }
         }
     }
     //step 2: get all tweets and set label
     foreach ($objTweet as $tweet) {
         if (isset($arrTweetList[$tweet->id])) {
             if (count($arrTweetList[$tweet->id]) > 0) {
                 asort($arrTweetList[$tweet->id]);
                 $label_id = end(array_keys($arrTweetList[$tweet->id]));
                 $tweet->label_id = $label_id;
                 $tweet->save();
             }
         }
     }
     //foreach
     print_r($arrTweetList);
     exit;
     //step 3: match tweets with labels
 }
开发者ID:aaronestrada,项目名称:datamining,代码行数:44,代码来源:Lab3Controller.php

示例12: ajaxSets

 public function ajaxSets()
 {
     $lid = Yii::app()->getRequest()->getPost('lid');
     $answers = Yii::app()->getRequest()->getPost('answers');
     $code = Yii::app()->getRequest()->getPost('code');
     //Create new label set
     $language = "";
     foreach ($answers as $lang => $answer) {
         $language .= $lang . " ";
     }
     $language = trim($language);
     if ($lid == 0) {
         $lset = new Labelsets();
         $lset->label_name = sanitize_xss_string(Yii::app()->getRequest()->getPost('laname'));
         $lset->languages = sanitize_xss_string($language);
         $lset->save();
         $lid = Yii::app()->db->getCommandBuilder()->getLastInsertID($lset->tableName());
     } else {
         Label::model()->deleteAll('lid = :lid', array(':lid' => $lid));
     }
     $res = 'ok';
     //optimistic
     foreach ($answers as $lang => $answer) {
         foreach ($answer as $key => $ans) {
             $label = new Label();
             $label->lid = $lid;
             $label->code = $code[$key];
             $label->title = $ans;
             $label->sortorder = $key;
             $label->language = $lang;
             if (!$label->save()) {
                 $res = 'fail';
             }
         }
     }
     echo ls_json_encode($res);
 }
开发者ID:rawaludin,项目名称:LimeSurvey,代码行数:37,代码来源:labels.php

示例13: listLabel

 public function listLabel()
 {
     return CHtml::listData(Label::model()->findAll(array('order' => 'name ASC')), 'term_id', 'name');
 }
开发者ID:beckblurry,项目名称:Yii1-Base-Core-V.Alpha.1,代码行数:4,代码来源:ListController.php

示例14: actionDelete

 public function actionDelete($id)
 {
     Tstage_information::model()->deleteAll('idRider = :id', array('id' => $id));
     Label::model()->deleteAll('id_rider = :id', array('id' => $id));
     Rider::model()->deleteAll('id_rider = :id', array('id' => $id));
     $this->redirect(array('rider'));
 }
开发者ID:srodri31,项目名称:Eafit-PI1-2015-1-Rider-,代码行数:7,代码来源:SiteController.php

示例15: array

   <div class='span6'>
      <?php 
$this->beginWidget('bootstrap.widgets.TbBox', array('title' => 'Kategori'));
$terms = Category::model()->findAll();
$data = array(array('Task', 'From Categories'));
foreach ($terms as $term) {
    $data[] = array($term->name, count($term->postAll));
}
$this->widget('ext.Hzl.google.HzlVisualizationChart', array('visualization' => 'PieChart', 'data' => $data, 'options' => array('style' => array('width' => '100%', 'height' => '100%'), 'is3D' => true, 'title' => 'From Categories')));
$this->endWidget();
?>
   </div>
  <div class='span6'>
      <?php 
$this->beginWidget('bootstrap.widgets.TbBox', array('title' => 'Label'));
$terms = Label::model()->findAll();
$data = array(array('Task', 'From Labels'));
foreach ($terms as $term) {
    $data[] = array($term->name, count($term->postAll));
}
$this->widget('ext.Hzl.google.HzlVisualizationChart', array('visualization' => 'PieChart', 'data' => $data, 'options' => array('style' => array('width' => '100%', 'height' => '100%'), 'is3D' => true, 'title' => 'From Labels')));
$this->endWidget();
?>
   </div>
 </div>
   <div class='row-fluid'>
  
     <div class='span6'>
      <?php 
$this->beginWidget('bootstrap.widgets.TbBox', array('title' => 'Tag'));
$terms = Tag::model()->findAll();
开发者ID:beckblurry,项目名称:Yii1-Base-Core-V.Alpha.1,代码行数:31,代码来源:group.php


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