function doLogin() { $this->save("login"); if (empty($this->messages)) { $select = new Select("users"); $select->add(Exp::eq("username", $this->login["username"])); $user = DB::unique($select); if (empty($user)) { $this->addMsgMessage("error.fieldNotFound", "login.username"); Msg::save($this->messages); Apu::redirect("login"); } if ($user["password"] != $this->login["password"]) { $this->addMsgMessage("error.fieldNotFound", "login.password"); Msg::save($this->messages); Apu::redirect("login"); } $date = new Date(); Session::save(LOGIN_SCOPE, $user, "user"); Session::save(LOGIN_SCOPE, $date, "last_access"); $this->remove(); Apu::redirect("frame"); } else { Msg::save($this->messages); Apu::redirect("login"); } }
function sql() { $this->expressions = array(); $this->add(Exp::eq("id", $this->value["__ID__"])); $sql = sprintf("update %s set %s %s", $this->tableString(), $this->valueString(), $this->whereString()); return $sql; }
function sql() { $this->expressions = array(); $this->add(Exp::eq("id", $this->value["__ID__"])); $this->maxResults = 1; $sql = sprintf("delete from %s %s %s", $this->tableString(), $this->whereString(), $this->limitString()); return $sql; }
function doIndex() { $this->fetch("list"); $select = new Select("lookups"); if (!empty($this->list["sort"]["key"])) { $select->addOrder($this->list["sort"]["key"], $this->list["sort"]["order"]); $this->serverDatas["sort"] = $this->list["sort"]; } if (!empty($this->list["filter"])) { $filter = $this->list["filter"]; $select->expressions = array(); $select->add(Exp::like("type", $filter["type"], Exp::MATCH_BOTH)); $select->add(Exp::like("code", $filter["code"], Exp::MATCH_BOTH)); } $this->list["list"] = DB::query($select); Apu::dispatch("/todo/faces/lookup/lookup_list.php"); }
public function showme($data,$row) { $pSum=Exp::model()->with('paySum')->findByPk($data->exp_id)->paySum; return Yii::app()->numberFormatter->formatCurrency($pSum, ''); }
public function loadModel($id) { $model = Exp::model()->with(array('department' => array('departmentProps'), 'client' => array('clientProps'), 'account', 'expd' => array('product0' => array('it0'))))->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
/** * @param mixed $job * @param string $k * @param array $defaults * @throws \axy\errors\InvalidConfig */ private function loadSingleJob($job, $k, array $defaults) { if (!is_array($job)) { $job = ['time' => $job]; } if (!isset($job['command'])) { $job['command'] = $k; } foreach ($defaults as $dk => $dv) { if (array_key_exists($dk, $job)) { if (!is_scalar($job[$dk]) && $job[$dk] !== null) { throw new InvalidConfig('Crontab', 'Job "' . $k . '" field "' . $dk . '" must be a scalar', 0, null, $this); } } else { $job[$dk] = $dv; } } if (!isset($job['time'])) { throw new InvalidConfig('Crontab', 'Job "' . $k . '" has no time', 0, null, $this); } try { $job['time'] = Exp::create($job['time']); } catch (InvalidJobString $e) { throw new InvalidConfig('Crontab', 'Job "' . $k . '" has invalid time', 0, $e, $this); } $job = array_replace($defaults, $job); $this->jobs[$k] = $job; }
private function updatedocs($docs, &$info) { /* * отбор загруженных на этапе считывания документов из tmp_doc */ $sql = "SELECT a.* ," . " c.id AS c_id, d.id AS d_id, t.id AS t_id, m.id AS m_id, b.id AS b_id, bb.id AS bb_id " . " FROM ((((((tmp_doc a LEFT JOIN client_id c ON a.ccli=c.ckey AND c.db=1)" . " LEFT JOIN department_id d ON a.cfir=d.ckey AND c.db=1)" . " LEFT JOIN client_id t ON a.transport=t.ckey AND c.db=1)" . " LEFT JOIN bank b ON a.dbank=b.longname)" . " LEFT JOIN bank bb ON a.cbank=bb.longname)" . " LEFT JOIN account m ON a.man=m.id)" . " WHERE a.user="******"bid:".$value['b_id']."bbid:".$value['bb_id']."re:".$rr."<hr>"; if ($rr) { if ($id > 0) { $jj++; $resdoc[] = array('t' => 0, 's' => 0, 'n' => $group->id); } else { $resdoc[] = array('t' => 0, 's' => 1, 'n' => $group->id); $j++; } $this->updatedocstr($value['id'], $group->id, 0); $this->updatecomment($value['id'], $group->id); } } } else { $oid = (int) $value['expid']; $iid = (int) $value['docid']; $fid = $docs[$value['id']]; if ($fid === null) { $oid = 0; $iid = 0; } else { $iid = $fid[1]; $oid = $fid[0]; } $group = NULL; if ($iid > 0) { $group = Inv::model()->findByPk($iid); if ($group == null) { continue; } Invd::model()->deleteAll('inv=' . $iid); } if ($group === null) { if ($oid > 0) { $group = new Inv(); } else { continue; } } $group->name = $value['tnum']; $group->amount = $value['bsum']; $group->date = $value['ddat']; $group->client_id = $value['t_id']; $group->exp_id = $oid; if ($group->save()) { if ($iid > 0) { $ii++; $resdoc[] = array('t' => 1, 's' => 0, 'n' => $group->id); } else { $resdoc[] = array('t' => 1, 's' => 1, 'n' => $group->id); $i++; } $this->updatedocstr($value['id'], $group->id, 1); } } } } $info[] = 'Создано новых счетов:' . $j; $info[] = 'Создано новых накладных:' . $i; $info[] = 'Отредактикровано счетов:' . $jj; $info[] = 'Отредактикровано накладных:' . $ii; // $info['doc']=$resdoc; }
} } } return $result; } } $a = Exp::Lit("a"); $b = Exp::Lit("b"); $c = Exp::Lit("c"); $aa = Exp::Conj($a, Exp::Many($a)); // one or more 'a' $bb = Exp::Conj($b, Exp::Many($b)); // one or more 'b' $cc = Exp::Conj($c, Exp::Many($c)); // one or more 'c' $regex = Exp::Many(Exp::Conj(Exp::Disj($aa, $bb), $cc)); $string = "acbbccaaacccbbbbaaaaaccccc"; echo "regex = " . $regex . "\n"; echo "string = \"" . $string . "\"\n"; echo "The recognized prefixes are:\n"; $result = []; for ($i = 0; $i <= strlen($string); ++$i) { $test = substr($string, 0, $i); if ($regex->recognize($test)) { $result[] = "\"" . $test . "\""; } } // printing things nicely echo "["; $start = true; foreach ($result as $s) {
/** * Deletes a particular model. * If deletion is successful, the browser will be redirected to the 'admin' page. * @param integer $id the ID of the model to be deleted */ public function actionDelete($id) { $model = $this->loadModel($id); $expid = $model->exp_id; $model->delete(); Exp::model()->findByPk($expid)->doPay(); // if AJAX request (triggered by deletion via admin grid view), we should not redirect the browser if (!isset($_GET['ajax'])) { $this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('admin')); } }
function findAllType() { $select = new Select("lookups"); $select->addField(Exp::raw("distinct `type`")); $result = DB::query($select); return $result; }
function byId($id, $table) { $select = new Select($table); $select->add(Exp::eq("id", $id)); return DB::unique($select); }
function __construct($operand) { parent::__construct($operand, null, "raw"); }