本文整理汇总了PHP中fRecordSet::buildFromSQL方法的典型用法代码示例。如果您正苦于以下问题:PHP fRecordSet::buildFromSQL方法的具体用法?PHP fRecordSet::buildFromSQL怎么用?PHP fRecordSet::buildFromSQL使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fRecordSet
的用法示例。
在下文中一共展示了fRecordSet::buildFromSQL方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
public function index()
{
$this->articles = fRecordSet::build('Article', array('type=' => 'news', 'visible=' => 1), array('priority' => 'desc', 'created_at' => 'desc'), ACTIVITIES_LIMIT - 2);
$this->posts = fRecordSet::build('Article', array('type=' => 'post', 'visible=' => 1, 'priority<' => 999999), array('priority' => 'desc', 'created_at' => 'desc'), ACTIVITIES_LIMIT - 1);
$this->activities = fRecordSet::buildFromSQL('Activity', 'SELECT activities.* FROM activities GROUP BY realname,type,DATE(timestamp),HOUR(timestamp) ORDER BY timestamp DESC LIMIT ' . ACTIVITIES_LIMIT);
$this->render('home/index');
}
示例2: findActive
/**
* Returns all active checks on the system
*
* @param string $sort_column The column to sort by
* @param string $sort_dir The direction to sort the column
* @return fRecordSet An object containing all meetups
*/
static function findActive()
{
return fRecordSet::buildFromSQL(
__CLASS__,
array("SELECT checks.* FROM checks JOIN subscriptions ON checks.check_id = subscriptions.check_id WHERE enabled = 1;")
);
}
示例3: findByBranch
public static function findByBranch($branch, $doctype)
{
//return fRecordSet::buildFromSQL('Production_issue',
// "SELECT production_issues.* FROM production_issues, (SELECT * FROM users WHERE branch_id = '$branch') AS tbl WHERE production_issues.issuer = tbl.username AND production_issues.doc_type = '$doctype' AND YEAR( production_issues.doc_date ) = YEAR( CURDATE( ) ) AND MONTH( production_issues.doc_date ) = MONTH( CURDATE( ))",
// "SELECT count(*) FROM production_issues"
// );
return fRecordSet::buildFromSQL('Production_issue', "SELECT production_issues.* FROM production_issues WHERE production_issues.doc_number LIKE '" . $doctype . "/" . $branch . "/" . "%" . "' AND YEAR( production_issues.doc_date ) = YEAR( CURDATE( ) ) AND MONTH( production_issues.doc_date ) = MONTH( CURDATE( ) )", "SELECT count(*) FROM production_issues");
}
示例4: findActive
static function findActive($check_id = NULL)
{
if (!is_null($check_id) && is_numeric($check_id)) {
$filter = ' AND check_id=' . $check_id;
} else {
$filter = '';
}
return fRecordSet::buildFromSQL(__CLASS__, array('SELECT subscriptions.* FROM subscriptions WHERE user_id = ' . fSession::get('user_id') . $filter));
}
示例5: findPOByBranch
static function findPOByBranch($branch, $doctype)
{
return fRecordSet::buildFromSQL('Purchase', "SELECT purchases.* FROM purchases WHERE purchases.po_number LIKE '" . "PO" . $doctype . "/" . $branch . "/" . "%" . "' AND YEAR( purchases.doc_date ) = YEAR( CURDATE( ) ) AND MONTH( purchases.doc_date ) = MONTH( CURDATE( ) )", "SELECT count(*) FROM purchases");
/*
return fRecordSet::buildFromSQL('Purchase',
"SELECT purchases.* FROM purchases, (SELECT * FROM users WHERE branch_id = '$branch') AS tbl WHERE purchases.requester = tbl.username AND purchases.doc_tag = 'po' AND purchases.doc_type = '$doctype' AND YEAR( purchases.po_date ) = YEAR( CURDATE( ) ) AND MONTH( purchases.po_date ) = MONTH( CURDATE( ) )",
"SELECT count(*) FROM purchases"
);
*/
}
示例6: findCurrentMonth
static function findCurrentMonth($month, $year)
{
return fRecordSet::buildFromSQL('Currency', "SELECT currencies.* FROM currencies WHERE YEAR(month) = {$year} AND MONTH(month) = {$month}");
}
示例7: getByRoleAndEmail
public static function getByRoleAndEmail($id_role, $email, $region)
{
$region = implode(",", $region);
return fRecordSet::buildFromSQL(__CLASS__, "SELECT * FROM user WHERE id_role = {$id_role} AND id_user IN (SELECT id_user FROM userregion WHERE id_region IN ({$region}))");
}
示例8: testBuildFromSQLNonLimitedCount
public function testBuildFromSQLNonLimitedCount()
{
$set = fRecordSet::buildFromSQL('User', sprintf("SELECT %s.* FROM %s LIMIT 2", fORM::tablize('User'), fORM::tablize('User')), sprintf("SELECT count(*) FROM %s", fORM::tablize('User')));
$this->assertEquals(array(1, 2), $set->getPrimaryKeys());
$this->assertEquals(4, $set->count(TRUE));
}
示例9: count
<?php
$typeOfUser = fAuthorization::checkAuthLevel('super');
//$canEdit = fAuthorization::checkACL('poll', 'edit');
//$canDelete = fAuthorization::checkACL('poll', 'delete');
$where = "";
if (!$typeOfUser) {
$where = " WHERE " . fSession::get('where_at');
}
$limit = fRequest::encode('limit', 'integer');
$page = fRequest::encode('p', 'integer');
if ($page < 1) {
exit;
}
$start = ($page - 1) * $limit;
$sections = fRecordSet::buildFromSQL('BannerSection', "SELECT * FROM bannersection {$where} LIMIT {$start},{$limit}", "SELECT count(*) FROM bannersection {$where}", $limit, $page);
if ($sections->count() == 0) {
echo '<div class="notification information" >
Por el momento no hay registros en <b> Secciones de banners </b>.
</div>';
} else {
$p = new Pagination($sections->getPages(), $sections->getPage(), 3);
$pagination = $p->getPaginationLinks();
?>
<center>
<table class="contenttoc" style="width:auto; float:left">
<tr>
<th> <input type="checkbox" name="check" id="check" /> </th>
<th> Nombre </th>
<th> Editar </th>
<th> Eliminar </th>
示例10: findCurrentMonth
static function findCurrentMonth($branch)
{
return fRecordSet::buildFromSQL('Good_receipt_note', "SELECT good_receipt_notes.* FROM good_receipt_notes WHERE good_receipt_notes.branch_id = '{$branch}' AND good_receipt_notes.doc_type = 'GRN' AND YEAR( good_receipt_notes.doc_date ) = YEAR( CURDATE( )) AND MONTH( good_receipt_notes.doc_date ) = MONTH( CURDATE( ))", "SELECT count(*) FROM good_receipt_notes");
}
示例11: findUsersResults
static public function findUsersResults()
{
return fRecordSet::buildFromSQL(
__CLASS__,
array('SELECT check_results.* FROM check_results JOIN subscriptions ON check_results.check_id = subscriptions.check_id and subscriptions.user_id = ' . fSession::get('user_id')));
}
示例12: IN
$where = " WHERE " . fSession::get('where_at') . " AND ";
}
$section = 'geolocation';
$section_id = 25;
$sub = 'list';
?>
<?php
$query = fRequest::encode('query', 'string');
$limit = fRequest::encode('limit', 'integer');
$page = fRequest::encode('p', 'integer');
if ($page < 1) {
exit;
}
$start = ($page - 1) * $limit;
$av = fRecordSet::buildFromSQL('EconomicUnit', "SELECT * FROM economic_units {$where} ( economic_unit_name LIKE '%{$query}%' OR economic_unit_street_type LIKE '%{$query}%' OR economic_unit_street_name LIKE '%{$query}%' OR economic_unit_phone LIKE '%{$query}%' OR economic_unit_region IN (SELECT id_region FROM region WHERE name LIKE '%{$query}%')) LIMIT {$start},{$limit}", "SELECT count(*) FROM economic_units {$where} ( economic_unit_name LIKE '%{$query}%' OR economic_unit_street_type LIKE '%{$query}%' OR economic_unit_street_name LIKE '%{$query}%' OR economic_unit_phone LIKE '%{$query}%' OR economic_unit_region IN (SELECT id_region FROM region WHERE name LIKE '%{$query}%'))", $limit, $page);
if ($av->count() == 0) {
echo '<div class="notification information" >
Por el momento no hay registros en <b> Observatorio </b>.
</div>';
} else {
$p = new Pagination($av->getPages(), $av->getPage(), 3);
$pagination = $p->getPaginationLinks();
?>
<center>
<table class="contenttoc" style="width:auto; float:none">
<tr>
<th> <input type="checkbox" name="check" id="check" /> </th>
<th> Nombre </th>
示例13: define
<?php
define('MY_ROOT', realpath(dirname(__FILE__) . '/../'));
include MY_ROOT . '/inc/init.php';
include MY_ROOT . '/inc/flourishDB.php';
$output = file_get_contents("daiichi-mp-May-j.csv");
$lines = preg_split('/[\\n\\r]+/', $output);
$headerLine = array_shift($lines);
//waste the header
$headerLine = array_shift($lines);
//there are two lines of header
$lastInserts = fRecordSet::buildFromSQL('Fukushimadata', "SELECT * FROM `fukushimadatas` \nWHERE `station_id` IN (800,801,802,803,804,805,806,807)\nORDER BY `reading_date` DESC \nLIMIT 1");
$lastDate = $lastInserts[0]->getReadingDate();
print_r($lastInserts);
print_r($lastDate);
foreach ($lines as $line) {
$columns = explode(",", $line);
$date = str_replace("/", "-", $columns[0]);
$time = $columns[1];
$datetime = $date . " " . $time . ":00";
$timestamp = new fTimestamp($datetime);
print_r($timestamp);
if ($lastDate->gte($timestamp)) {
echo "skipping row <br />";
continue;
}
echo "successfull Row \n\r";
if ($columns[2] != "" && $columns[2] != "N/A") {
try {
$reading = new Fukushimadata();
$reading->setReadingDate($datetime);
示例14: count
<?php
$limit = fRequest::encode('limit', 'integer');
$page = fRequest::encode('p', 'integer');
if ($page < 1) {
exit;
}
$start = ($page - 1) * $limit;
$typeOfUser = fAuthorization::checkAuthLevel('super');
$where = "";
$users = fRecordSet::buildFromSQL('User', "SELECT * FROM " . TBL_USER . " {$where} LIMIT {$start},{$limit}", "SELECT count(*) FROM " . TBL_USER . " {$where}", $limit, $page);
if ($users->count() == 0) {
echo '<div class="notification information" >
Por el momento no hay registros en <b> Usuarios </b>
</div>';
} else {
$p = new Pagination($users->getPages(), $users->getPage(), 3);
$pagination = $p->getPaginationLinks();
?>
<center>
<table class="contenttoc" style="width:100%;float:none">
<tr>
<th><input type="checkbox" id="check" /></th>
<th>Email</th>
<th>Rol</th>
<th>Nombre</th>
<th>Apellidos</th>
<th>Fecha Nacimiento</th>
<th>Teléfono</th>
<th>Celular</th>
<th>Nextel</th>
示例15: findAllByPassingRespondent
/**
* @param integer $respondentId
* @param array $orderBy
* @return WpTesting_Model_Test[]
*/
public function findAllByPassingRespondent($respondentId, array $orderBy = array('Test.ID'))
{
return fRecordSet::buildFromSQL($this->modelName, array(implode(PHP_EOL, array('SELECT DISTINCT Test.* FROM %r AS Test', 'JOIN %r AS Passing ON Passing.test_id = Test.ID AND Passing.respondent_id = %i', 'WHERE Test.post_type = %s', 'ORDER BY %s')), array($this->tableName, fORM::tablize('WpTesting_Model_Passing'), $respondentId, 'wpt_test', implode(',', $orderBy))));
}