コード例 #1
0
 /**
  * Gets an activerecord object associated to the table.
  * @param iPlugin $plugin
  * @param string $sTableName Name of the table.
  * @param string $bPluginTable True if the table is plugin specific.
  * @return PluginDynamic
  */
 public function getTable(iPlugin $plugin, $sTableName, $bPluginTable = true)
 {
     if ($bPluginTable) {
         $table = $this->getTableName($plugin, $sTableName);
     } else {
         $table = $sTableName;
     }
     if (isset($table)) {
         return PluginDynamic::model($table);
     }
 }
コード例 #2
0
ファイル: dataentry.php プロジェクト: CrandellWS/LimeSurvey
 /**
  * Takes a list of tablenames and creates a nice key value array.
  * @param type $list
  */
 protected function tableList($tables)
 {
     $list = array();
     if (empty($tables)) {
         $list['none'] = gT('No old responses found.');
     }
     foreach ($tables as $table) {
         $count = PluginDynamic::model($table)->count();
         $timestamp = date_format(new DateTime(substr($table, -14)), 'Y-m-d H:i:s');
         $list[$table] = "{$timestamp} ({$count} responses)";
     }
     return $list;
 }
 private function countOldAnswers($sField, $sValue = "")
 {
     $sQuotedField = Yii::app()->db->quoteColumnName($sField);
     if (App()->request->getPost('withuncompleted')) {
         return PluginDynamic::model($this->sTableName)->count("{$sQuotedField}=:field{$sField}", array(":field{$sField}" => $sValue));
     } else {
         return PluginDynamic::model($this->sTableName)->count("submitdate IS NOT NULL AND {$sQuotedField}=:field{$sField}", array(":field{$sField}" => $sValue));
     }
 }