本文整理汇总了PHP中dibi::dataSource方法的典型用法代码示例。如果您正苦于以下问题:PHP dibi::dataSource方法的具体用法?PHP dibi::dataSource怎么用?PHP dibi::dataSource使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dibi
的用法示例。
在下文中一共展示了dibi::dataSource方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getDatasourceGroupByKey
static function getDatasourceGroupByKey()
{
$sql = '';
$langs = self::getAll();
foreach ($langs as $l) {
$sql .= '(SELECT translate FROM [lang_translate] WHERE [main].[key] = [lang_translate].[key] AND id_lang = ' . $l['id_lang'] . ') AS ' . $l['iso'] . ',';
}
return dibi::dataSource("\n\t\t\tSELECT\n\t\t\t\t" . $sql . "\n\t\t\t\t[key]\n\t\t\tFROM\n\t\t\t\t[lang_translate] main\n\t\t\tGROUP BY [key]");
}
示例2: getItem
public static function getItem($source, $id)
{
$result = dibi::dataSource('SELECT * FROM %n WHERE id = %i', $source, $id);
$data = $result->fetchAll();
if (count($data) > 0) {
return $data[0];
} else {
return null;
}
}
示例3: showLog
function showLog()
{
$session = NEnvironment::getSession('Log');
if (isset($_GET['order_by'])) {
if ($_GET['order_by'] != "date" and $_GET['order_by'] != "id_user" and $_GET['order_by'] != "description" and $_GET['order_by'] != "value" and $_GET['order_by'] != "value" and $_GET['order_by'] != "id_type_modul" and $_GET['order_by'] != "ip") {
$session['log_order_by'] = "date";
} else {
$session['log_order_by'] = $_GET['order_by'];
}
}
if (!isset($session['log_order_by'])) {
$session['log_order_by'] = "date";
}
$source = dibi::dataSource("\n\t\t\tSELECT log.*, user.login \n\t\t\tFROM log LEFT JOIN user USING(id_user) \n\t\t\tWHERE\n\t\t\t\t%if", @$_GET['input_id_user'] != '', "login LIKE %s", '%' . @$_GET['input_id_user'] . '%', " AND %end\n\t\t \t%if", @$_GET['input_date'] != '', "[date] > %s", @$_GET['input_date'], " AND %end\n\t\t\t %if", @$_GET['input_description'] != '', "description LIKE %s", '%' . @$_GET['input_description'] . '%', " AND %end\n\t\t\t %if", @$_GET['input_value'] != '', "value LIKE %s", '%' . @$_GET['input_value'] . '%', " AND %end\n\t\t\t %if", @$_GET['input_id_type_modul'] != '', "name_modul LIKE %s", '%' . @$_GET['input_id_type_modul'] . '%', " AND %end\n\t\t\t ip LIKE %s", '%' . @$_GET['input_ip'] . '%', " \n\t\t \n\t\t ORDER BY " . $session['log_order_by'] . " DESC");
$p = new MyPaginator($source);
MT::addTemplate(dirname(__FILE__) . '/log.phtml', 'log');
MT::addVar('log', 'paginator', $p);
MT::addVar('log', 'list', $p->getDataSourceItem()->fetchAll());
}
示例4: getDataSource
function getDataSource()
{
return dibi::dataSource("SELECT * FROM log");
}
示例5: getClosedTickets
public static function getClosedTickets($id)
{
$rowset = dibi::dataSource('SELECT id, ticketId, priority, name, subject, status, updated FROM ticket WHERE (departmentId=%i) AND (closed=%i) ORDER BY updated DESC', $id, 1);
return $rowset;
}
示例6: getUsers
public static function getUsers()
{
$rowset = dibi::dataSource('SELECT * FROM user');
return $rowset;
}
示例7: getDatasource
static function getDatasource()
{
return dibi::dataSource("SELECT * FROM [" . TABLE_USERS . "]");
}
示例8: getTreeCheckProduct
static function getTreeCheckProduct($id_product = null)
{
return dibi::dataSource("\n\t\t\tSELECT\n\t\t\t*, id_category AS id\n\t\t\t%if", $id_product, "\n\t\t\t\t,\n\t\t\tIF (\n\t\t\t\t(SELECT\n\t\t\t\t1\n\t\t\t\tFROM\n\t\t\t\t[category_product]\n\t\t\t\tWHERE\n\t\t\t\tid_product = %i", $id_product, "AND category_product.id_category = id LIMIT 1) = 1,\n\t\t\t\t1,\n\t\t\t\t0\n\t\t\t) AS cb\n\t\t\t%end\n\t\t\tFROM\n\t\t\t[category]\n\t\t\tLEFT JOIN [category_lang] USING(id_category)\n\n\n\t\t");
}
示例9: getDatasource
static function getDatasource()
{
return dibi::dataSource("\n\t\t\tSELECT\n\t\t\t\t*\n\t\t\tFROM\n\t\t\t\t[order]\n\t\t\tWHERE \n\t\t\t\tdeleted = 0\n\t\t\t");
}
示例10: getProductParamDatasource
static function getProductParamDatasource($id_product)
{
//POZOR upravi cenu podla zadavania dane SHOW_PRICE_WITH_TAX
$tax_coef = self::getTaxCoefForProduct($id_product);
$product_param_cols = Tools::getCollum('product_param');
unset($product_param_cols['price']);
// dump($product_param_cols);exit;
return dibi::dataSource("\n\t\t\tSELECT \n\t\t\t%sql", implode(',', $product_param_cols), "\n\t\t\t, ROUND((price*" . $tax_coef . "),2) AS price\n\t\t\tFROM \n\t\t\t[product_param] \n\t\t\tWHERE %if", $id_product == null, " id_product IS NULL %else id_product = %i", $id_product);
}