protected function insertRows() { $rowsToInsert = (int) Request::get('rows'); $insertedCnt = 0; for ($i = 0; $i < $rowsToInsert; $i++) { $params = array_merge($this->insDefaults, $this->where); $paramValues = null; if (Cfg::get('jb_db', false)) { $params[$this->primaryKey] = DBMaintenance::dbNextNumber($this->db, $this->tableName); } $sql = 'INSERT INTO ' . $this->tableName; if (count($params) > 0) { $sql .= ' (' . join(',', array_keys($params)) . ') ' . 'VALUES (' . DB::in(array_values($params), $paramValues) . ')'; } $insertedCnt += $this->exec($sql, $paramValues); } if ($insertedCnt > 0) { $this->paginator->setRows($this->getRowCount()); } return 'Inserted ' . $insertedCnt . ' row' . StringUtil::plural($insertedCnt) . Tag::br(); }
public static function secToStr($sec) { $min = intval($sec / 60); $sec %= 60; $hr = intval($min / 60); $min %= 60; $day = intval($hr / 24); $hr %= 60; $msg = ''; if ($day != 0) { $msg = StringUtil::unitsFormat($day, 'day', $msg); } if ($hr != 0) { $msg = StringUtil::unitsFormat($hr, 'hour', $msg); } if ($min != 0) { $msg = StringUtil::unitsFormat($min, 'min', $msg); } if ($sec != 0) { $msg = StringUtil::unitsFormat($sec, 'sec', $msg); } return $msg; }