public function transactionQueries($arrSql)
 {
     if (!is_array($arrSql)) {
         if (empty($arrSql)) {
             return false;
         }
         $arrSql = array($arrSql);
     }
     if (!$this->transactionBegin()) {
         FC::log_warn('can not begin transaction');
     }
     $ok = true;
     foreach ($arrSql as $sql) {
         if (!$this->query($sql)) {
             $ok = false;
             break;
         }
     }
     if ($ok) {
         return $this->transactionCommit();
     } else {
         $this->transactionRollBack();
         return false;
     }
 }
Пример #2
0
 /**
  * generates a select (drop down)
  */
 public function iSelectTranslate($key, $section, $options = '')
 {
     if (isset($this->obj)) {
         $options = $this->obj->getPropertyOptions($key);
     }
     if (empty($options['options'])) {
         FC::log_warn("iRadio {$key} does not provide options");
         return $key . ' (no option)';
     }
     $str = '<select id="i_' . $key . '" name="' . $key . '">';
     $i = 1;
     foreach ($options['options'] as $val => $lbl) {
         $str .= '<option value="' . $val . '"';
         if ($options['value'] == $val) {
             $str .= ' selected="selected"';
         }
         $str .= ' value="' . $val . '">' . TR::html($section, $lbl) . '</option>';
         $i++;
     }
     return $str . '</select>';
 }