本文整理汇总了PHP中Select::add方法的典型用法代码示例。如果您正苦于以下问题:PHP Select::add方法的具体用法?PHP Select::add怎么用?PHP Select::add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Select
的用法示例。
在下文中一共展示了Select::add方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testVerificaInclusaoDeOpcoes
public function testVerificaInclusaoDeOpcoes()
{
$opcao1 = $this->getMock('FT\\Formulario\\Types\\Option', array(), array("valor1", "legenda1", "selected"));
$opcao2 = $this->getMock('FT\\Formulario\\Types\\Option', array(), array("valor2", "legenda2", ""));
$selecao = new Select("id", "nome", "legenda");
$selecao->add($opcao1);
$selecao->add($opcao2);
$this->assertEquals(2, count($selecao->getFields()));
$selecao->resetFields();
$this->assertEquals(0, count($selecao->getFields()));
}
示例2: doIndex
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");
}
示例3: doLogin
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");
}
}
示例4: Form
$form = new Form();
$form->setAction('controller.php');
$form->setJs(' onsubmit="return PSA.indexcol();" ');
$form->build();
// TODO: check if table name already exists
$name = new Input();
$name->setName('idxname');
$name->setSize(50);
$name->setMaxlength(128);
$name->setId('idxname');
$body->line('Name : ' . $name->dump() . ' ' . $cmd->dump() . '<br>');
for ($i = 0; $i < sizeof($fields); ++$i) {
$select = new Select();
$select->setName('col' . $i);
$select->setSize(1);
$select->add('', '-');
for ($j = 0; $j < sizeof($fields); ++$j) {
$select->add($fields[$j], $fields[$j]);
}
$body->line('index on : ' . $select->dump() . '<br>');
}
$submit->build();
$tblname = new Input();
$tblname->setName('tblname');
$tblname->setSize(128);
$tblname->setValue($req->get('table'));
$tblname->setType('hidden');
$tblname->build();
unset($form);
$body->line('</div>');
include_once './inc/footer.php';
示例5: Input
$th->add('type');
$th->add('primary');
$th->add('size');
$th->add('null');
$th->add('default');
$th->build();
$colname = new Input();
$colname->setName('colname');
$colname->setSize(25);
$colname->setMaxlength(128);
$colname->setId('colname');
$coltype = new Select();
$coltype->setName('coltype');
$coltype->setSize(1);
$coltype->setId('coltype');
$coltype->add('VARCHAR', 'VARCHAR');
$coltype->add('INTEGER', 'INTEGER');
$coltype->add('FLOAT', 'FLOAT');
$coltype->add('TEXT', 'TEXT');
$coltype->add('DATETIME', 'DATETIME');
$colprime = new Input();
$colprime->setName('colprime');
$colprime->setType('checkbox');
$colprime->setId('colprime');
$colprime->setJs(' onclick="PSA.checkprimary();" ');
$colsize = new Input();
$colsize->setName('colsize');
$colsize->setSize(7);
$colsize->setMaxlength(7);
$colsize->setId('colsize');
$colsize->setJs(' onblur="PSA.checknumeric();" ');
示例6: byId
function byId($id, $table) {
$select = new Select($table);
$select->add(Exp::eq("id", $id));
return DB::unique($select);
}