本文整理汇总了PHP中Select类的典型用法代码示例。如果您正苦于以下问题:PHP Select类的具体用法?PHP Select怎么用?PHP Select使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Select类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: GetLanguageSelect
function GetLanguageSelect($FolderName, &$WarningCollector, $SelectedLanguage)
{
$Select = false;
$FolderHandle = @opendir($FolderName);
if (!$FolderHandle) {
$WarningCollector->Add("We had a problem opening the languages folder");
} else {
$Languages = array();
$Key = 0;
// Loop through each file
while (false !== ($Item = readdir($FolderHandle))) {
$RecordItem = true;
if ($Item == "." || $Item == ".." || is_dir($FolderName . $Item)) {
// do nothing
} else {
// Retrieve languages names
$FileParts = explode(".", $Item);
$Languages[] = $FileParts[0];
if ($FileParts[0] == $SelectedLanguage) {
$Key = count($Languages);
}
}
}
$Select = new Select();
$Select->Name = "Language";
for ($i = 0; $i < count($Languages); $i++) {
$Select->AddOption($Languages[$i], $Languages[$i]);
}
$Select->SelectedIndex = $Key;
}
return $Select;
}
开发者ID:BackupTheBerlios,项目名称:milaninegw-svn,代码行数:32,代码来源:installer.php
示例2: loadRandom
public function loadRandom()
{
$select = new Select(self::$db);
$select->from(self::$table, "*")->where("`state` =" . self::$db->getSQ(), array(1))->rand()->limit(1);
$row = self::$db->selectRow($select);
return $this->init($row);
}
开发者ID:trukfit,项目名称:htdocs,代码行数:7,代码来源:polldb_class.php
示例3: getAllOnID
protected static function getAllOnID($table, $id)
{
$select = new Select(self::$db);
$select->from($table, "*")->where("`id` = ?", array($id));
$data = self::$db->select($select);
return $data;
}
开发者ID:kuaa59,项目名称:www,代码行数:7,代码来源:objectdb_class.php
示例4: getPerfil
public function getPerfil()
{
$element = new Select('perfil');
$element->setLabel('Perfil');
$element->setAttributes(array('id' => 'perfil', 'class' => 'form-control'));
return $element;
}
开发者ID:ericoautocad,项目名称:module-security-zf2,代码行数:7,代码来源:Login.php
示例5: testConstructorTableNameSelect
/**
* @covers Select::newSelect
* @uses Select::__construct
* @uses Select::getQuery
*/
public function testConstructorTableNameSelect()
{
$select = new Select('TableName');
$assertSql = 'SELECT * FROM TableName';
// Assert
$this->assertEquals($select->getQuery(), $assertSql);
}
开发者ID:venar,项目名称:select,代码行数:12,代码来源:SelectTest.php
示例6: loadRandom
public function loadRandom()
{
$select = new Select(self::$db);
$select->from(self::$table, "*")->rand()->limit(1);
$row = self::$db->selectRow($select);
return $this->init($row);
}
开发者ID:itservicedv,项目名称:engine_rusakov_source,代码行数:7,代码来源:quotedb_class.php
示例7: 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");
}
}
开发者ID:reekoheek,项目名称:php-fw,代码行数:26,代码来源:LoginAction.php
示例8: __construct
/**
* __construct
*
* @param string $caption caption
* @param string $name name
* @param integer $size size
* @param integer $value value unix timestamp
* @param boolean $showtime true to show time, false for date only
*/
public function __construct($caption, $name, $size = 2, $value = 0, $showtime = true)
{
parent::__construct($caption, '');
$value = (int) $value;
$value = $value > 0 ? $value : time();
$datetime = getdate($value);
$date = new DateSelect('', $name . '[date]', $size, $value);
$date->setAttribute('id', $name . '-date');
$this->addElement($date);
if ($showtime) {
$timearray = array();
for ($i = 0; $i < 24; ++$i) {
for ($j = 0; $j < 60; $j = $j + 10) {
$key = $i * 3600 + $j * 60;
$timearray[$key] = $j != 0 ? $i . ':' . $j : $i . ':0' . $j;
}
}
ksort($timearray);
$timeselect = new Select('', $name . '[time]', $datetime['hours'] * 3600 + 600 * ceil($datetime['minutes'] / 10));
$timeselect->setAttribute('id', $name . '-time');
$timeselect->addOptionArray($timearray);
$timeselect->setClass('span2');
$this->addElement($timeselect);
} else {
$this->addElement(new Hidden($name . '[time]', 0));
}
}
开发者ID:redmexico,项目名称:XoopsCore,代码行数:36,代码来源:DateTime.php
示例9: testCompileWithNumericValue
public function testCompileWithNumericValue()
{
$field = new Select("test", "Test", array("test", "blue"), array("useNumericValue" => true));
$expected = "<label for=\"test\">Test</label><select name=\"test\" ><option value=\"0\" selected=\"selected\">test</option><option value=\"1\">blue</option></select>";
$value = $field->compile(0);
$this->assertEquals($expected, $value);
}
开发者ID:jenwachter,项目名称:html-form,代码行数:7,代码来源:SelectTest.php
示例10: getImgOnID
public static function getImgOnID($id)
{
$select = new Select(self::$db);
$select->from(self::$table, "*")->where("`product_id` = " . self::$db->getSQ(), array($id));
$data = self::$db->select($select);
$images = ObjectDB::buildMultiple(__CLASS__, $data);
return $images;
}
开发者ID:kuaa59,项目名称:www,代码行数:8,代码来源:imgdb_class.php
示例11: it_renders_with_options_the_full_html
/** @test */
public function it_renders_with_options_the_full_html()
{
$field = new Select('test', 'Test', ['values' => ['miro' => 'test']]);
$field->render();
$options = $field->options();
$this->assertCount(1, $options);
$this->assertInstanceOf(Option::class, $options[0]);
}
开发者ID:administrcms,项目名称:form,代码行数:9,代码来源:SelectFieldTest.php
示例12: getElementsCount
/**
* @param Select $select
* @return array
*/
public function getElementsCount(Select $select)
{
$select->setLimit(null);
$select->setOffset(null);
$select->setColumns(array('COUNT(*)'));
$db = new DbGateway();
return $db->execute($select, \PDO::FETCH_COLUMN);
}
开发者ID:breathbath,项目名称:hr-project,代码行数:12,代码来源:Paginator.php
示例13: __listTables
protected function __listTables($cache = TRUE)
{
if ($cache && sizeof($this->tables)) {
return $this->tables;
}
$select = new Select('information_schema.TABLES');
$select->where(array(array('field' => 'TABLE_SCHEMA', 'value' => $this->params['name'])));
return $this->tables = $select->execute('\\apf\\db\\mysql5\\Table', $smart = FALSE);
}
开发者ID:pthreat,项目名称:apf-dev,代码行数:9,代码来源:Adapter.class.php
示例14: getStudentsOnGroupID
public static function getStudentsOnGroupID($group_id)
{
$select = new Select(self::$db);
$select->from(self::$table, "*")->where("`group_id` = ?", array($group_id));
$data = self::$db->select($select);
$students = ObjectDB::buildMultiple(__CLASS__, $data);
//foreach ($groups as $g) $g->postHandling();
return $students;
}
开发者ID:kuaa59,项目名称:www,代码行数:9,代码来源:studentdb_class.php
示例15: render
/**
* render
*
* @return string
*/
public function render()
{
$editor_handler = \XoopsEditorHandler::getInstance();
$editor_handler->allowed_editors = $this->allowed_editors;
$option_select = new Select("", $this->name, $this->value);
$onchangeCode = '"if(this.options[this.selectedIndex].value.length > 0 ){window.document.forms.' . $this->form->getName() . '.submit();}"';
$option_select->set('onchange', $onchangeCode);
$option_select->addOptionArray($editor_handler->getList($this->nohtml));
$this->addElement($option_select);
return parent::render();
}
开发者ID:ming-hai,项目名称:XoopsCore,代码行数:16,代码来源:SelectEditor.php
示例16: getItemsOnView
public static function getItemsOnView($view)
{
$select = new Select(self::$db);
$select->from(self::$table, "*")->where("`view_id` = ?", array($view));
$data = self::$db->select($select);
$items = ObjectDB::buildMultiple(__CLASS__, $data);
foreach ($items as $item) {
$item->postHandling();
}
return $items;
}
开发者ID:kuaa59,项目名称:www,代码行数:11,代码来源:gallerydb_class.php
示例17: getGroupsOnTeacherID
public static function getGroupsOnTeacherID($id)
{
$select = new Select(self::$db);
$select->from(self::$table, "*")->where("`teacher_id` = ?", array($id));
$data = self::$db->select($select);
$groups = ObjectDB::buildMultiple(__CLASS__, $data);
foreach ($groups as $g) {
$g->postHandling();
}
return $groups;
}
开发者ID:kuaa59,项目名称:www,代码行数:11,代码来源:groupdb_class.php
示例18: getItems
public static function getItems()
{
$select = new Select(self::$db);
$select->from(self::$table, array("s.*", "p.img"), "s")->join("INNER", "product", "p", "s.product_id = p.id");
$data = self::$db->select($select);
$slider = ObjectDB::buildMultiple(__CLASS__, $data);
foreach ($slider as $slide) {
$slide->postHandling();
}
return $slider;
}
开发者ID:kuaa59,项目名称:www,代码行数:11,代码来源:sliderdb_class.php
示例19: clearSelect
public function clearSelect()
{
$this->last_select_user_id = $this->select_user_id;
$select = new Select();
$select->day = $this->room->day;
$select->state = $this->state;
$select->selected_mate_id = $this->select_user_id;
$select->save();
$this->select_user_id = null;
$this->save();
}
开发者ID:asdoda,项目名称:wolfer,代码行数:11,代码来源:Mate.php
示例20: testOffset
public function testOffset()
{
$offset = 123;
$table = $this->getMockBuilder(\Sharkodlak\FluentDb\Table::class)->disableOriginalConstructor()->getMock();
$factory = $this->getMockBuilder(\Sharkodlak\FluentDb\Factory\Factory::class)->getMock();
$queryBuilder = $this->getMockBuilder(\Sharkodlak\FluentDb\Query\Builder::class)->setConstructorArgs(['SELECT', 'FROM'])->setMethods(['offset'])->getMock();
$queryBuilder->expects($this->once())->method('offset')->with($this->equalTo($offset));
$factory->expects($this->once())->method('getQueryBuilder')->will($this->returnValue($queryBuilder));
$table->expects($this->once())->method('getFactory')->will($this->returnValue($factory));
$query = new Select($table);
$this->assertInstanceOf(Select::class, $query->offset($offset));
}
开发者ID:sharkodlak,项目名称:fluentdb,代码行数:12,代码来源:SelectTest.php
注:本文中的Select类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论