本文整理汇总了PHP中GO\Base\Db\FindParams类的典型用法代码示例。如果您正苦于以下问题:PHP FindParams类的具体用法?PHP FindParams怎么用?PHP FindParams使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FindParams类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: run
/**
* The code that needs to be called when the cron is running
*
* @param GO\Base\Cron\CronJob $cronJob
* @param GO\Base\Model\User $user
*/
public function run(GO\Base\Cron\CronJob $cronJob, GO\Base\Model\User $user = null)
{
$filesStmt = File::model()->find(FindParams::newInstance()->ignoreAcl()->criteria(FindCriteria::newInstance()->addCondition('expire_time', time(), '<')->addCondition('expire_time', '0', '>')->addCondition('random_code', '', '!=')->addCondition('delete_when_expired', '1')));
foreach ($filesStmt as $fileModel) {
$fileModel->delete();
}
}
开发者ID:ajaboa,项目名称:crmpuan,代码行数:13,代码来源:DeleteExpiredLinks.php
示例2: run
/**
* The code that needs to be called when the cron is running
*
* If $this->enableUserAndGroupSupport() returns TRUE then the run function
* will be called for each $user. (The $user parameter will be given)
*
* If $this->enableUserAndGroupSupport() returns FALSE then the
* $user parameter is null and the run function will be called only once.
*
* @param CronJob $cronJob
* @param \GO\Base\Model\User $user [OPTIONAL]
*/
public function run(CronJob $cronJob, \GO\Base\Model\User $user = null)
{
\GO::session()->runAsRoot();
$usersStmt = \GO\Base\Model\User::model()->findByAttribute('mail_reminders', 1);
while ($userModel = $usersStmt->fetch()) {
\GO::debug("Sending mail reminders to " . $userModel->username);
$remindersStmt = \GO\Base\Model\Reminder::model()->find(\GO\Base\Db\FindParams::newInstance()->joinModel(array('model' => 'GO\\Base\\Model\\ReminderUser', 'localTableAlias' => 't', 'localField' => 'id', 'foreignField' => 'reminder_id', 'tableAlias' => 'ru'))->criteria(\GO\Base\Db\FindCriteria::newInstance()->addCondition('user_id', $userModel->id, '=', 'ru')->addCondition('time', time(), '<', 'ru')->addCondition('mail_sent', '0', '=', 'ru')));
while ($reminderModel = $remindersStmt->fetch()) {
// $relatedModel = $reminderModel->getRelatedModel();
// var_dump($relatedModel->name);
// $modelName = $relatedModel ? $relatedModel->localizedName : \GO::t('unknown');
$subject = \GO::t('reminder') . ': ' . $reminderModel->name;
$time = !empty($reminderModel->vtime) ? $reminderModel->vtime : $reminderModel->time;
date_default_timezone_set($userModel->timezone);
$body = \GO::t('time') . ': ' . date($userModel->completeDateFormat . ' ' . $userModel->time_format, $time) . "\n";
$body .= \GO::t('name') . ': ' . str_replace('<br />', ',', $reminderModel->name) . "\n";
// date_default_timezone_set(\GO::user()->timezone);
$message = \GO\Base\Mail\Message::newInstance($subject, $body);
$message->addFrom(\GO::config()->noreply_email, \GO::config()->title);
$message->addTo($userModel->email, $userModel->name);
\GO\Base\Mail\Mailer::newGoInstance()->send($message, $failedRecipients);
if (!empty($failedRecipients)) {
trigger_error("Reminder mail failed for recipient: " . implode(',', $failedRecipients), E_USER_NOTICE);
}
$reminderUserModelSend = \GO\Base\Model\ReminderUser::model()->findSingleByAttributes(array('user_id' => $userModel->id, 'reminder_id' => $reminderModel->id));
$reminderUserModelSend->mail_sent = 1;
$reminderUserModelSend->save();
}
date_default_timezone_set(\GO::user()->timezone);
}
}
开发者ID:ajaboa,项目名称:crmpuan,代码行数:43,代码来源:EmailReminders.php
示例3: getRows
/**
* Get the table rows that need to be printed in the pdf
*
* @return array
*/
public function getRows()
{
if (empty($this->_rows)) {
foreach ($this->calendars as $calendar) {
$row = array('name' => $calendar->name);
// foreach($this->categories as $category){
$findParams = \GO\Base\Db\FindParams::newInstance()->ignoreAcl()->select('COUNT(*) as count, category_id')->group('category_id');
// $findParams->ignoreAcl(); // Only count items that are visible for this user.
// $findParams->group('calendar_id');
$findCriteria = \GO\Base\Db\FindCriteria::newInstance();
$findCriteria->addCondition('calendar_id', $calendar->id);
$findCriteria->addCondition('start_time', strtotime($this->startDate), '>');
$findCriteria->addCondition('end_time', strtotime($this->endDate), '<');
$findParams->criteria($findCriteria);
$catRecord = array();
foreach (Event::model()->find($findParams) as $record) {
$catRecord[intval($record->category_id)] = $record->count;
}
foreach ($this->categories as $category) {
$row[] = isset($catRecord[$category->id]) ? $catRecord[$category->id] : 0;
}
$this->_rows[] = $row;
}
// }
}
return $this->_rows;
}
开发者ID:ajaboa,项目名称:crmpuan,代码行数:32,代码来源:PrintCategoryCount.php
示例4: processStoreDelete
/**
* processStoreDelete
*
* @param $store
* @param $params
*/
protected function processStoreDelete($store, &$params)
{
if (isset($params['delete_keys'])) {
$deleteRecords = json_decode($params['delete_keys'], true);
$deleteRecords = array_filter($deleteRecords, 'intval');
$criteria = FindCriteria::newInstance();
$criteria->addCondition('default', 0);
$criteria->addInCondition('id', $deleteRecords);
$findParams = FindParams::newInstance()->criteria($criteria);
$stmt = Label::model()->find($findParams);
$deleteRecords = array();
while ($label = $stmt->fetch()) {
$deleteRecords[] = $label->getPk();
}
if (!count($deleteRecords)) {
$params['delete_keys'] = '[]';
} else {
$params['delete_keys'] = json_encode($deleteRecords);
}
}
$store->processDeleteActions($params, $this->model);
if (isset($params['delete_keys']) && !count($params['delete_keys'])) {
$store->response['deleteSuccess'] = true;
}
}
开发者ID:ajaboa,项目名称:crmpuan,代码行数:31,代码来源:LabelController.php
示例5: getStoreParams
protected function getStoreParams($params)
{
$storeParams = \GO\Base\Db\FindParams::newInstance();
$storeParams->getCriteria()->addCondition('model_name', $params['model_name']);
$storeParams->select('t.*');
return $storeParams;
}
开发者ID:ajaboa,项目名称:crmpuan,代码行数:7,代码来源:AdvancedSearchController.php
示例6: checkIpAddress
public static function checkIpAddress(array &$params, array &$response)
{
$oldIgnoreAcl = \GO::setIgnoreAclPermissions();
$userModel = \GO\Base\Model\User::model()->findSingleByAttribute('username', $params['username']);
if (!$userModel) {
return true;
}
$allowedIpAddresses = array();
//"127.0.0.1");
$whitelistIpAddressesStmt = Model\IpAddress::model()->find(\GO\Base\Db\FindParams::newInstance()->select('t.ip_address')->joinModel(array('model' => 'GO\\Ipwhitelist\\Model\\EnableWhitelist', 'localTableAlias' => 't', 'localField' => 'group_id', 'foreignField' => 'group_id', 'tableAlias' => 'ew', 'type' => 'INNER'))->joinModel(array('model' => 'GO\\Base\\Model\\UserGroup', 'localTableAlias' => 'ew', 'localField' => 'group_id', 'foreignField' => 'group_id', 'tableAlias' => 'usergroup', 'type' => 'INNER'))->criteria(\GO\Base\Db\FindCriteria::newInstance()->addCondition('user_id', $userModel->id, '=', 'usergroup')));
if (!empty($whitelistIpAddressesStmt) && $whitelistIpAddressesStmt->rowCount() > 0) {
foreach ($whitelistIpAddressesStmt as $ipAddressModel) {
// $enabledWhitelistModel = Model\EnableWhitelist::model()->findByPk($groupModel->id);
// if (!empty($enabledWhitelistModel)) {
// $ipAddressesStmt = Model\IpAddress::model()->findByAttribute('group_id',$groupModel->id);
// foreach ($ipAddressesStmt as $ipAddressModel) {
if (!in_array($ipAddressModel->ip_address, $allowedIpAddresses)) {
$allowedIpAddresses[] = $ipAddressModel->ip_address;
}
// }
// }
}
}
\GO::setIgnoreAclPermissions($oldIgnoreAcl);
if (count($allowedIpAddresses) > 0 && !in_array($_SERVER['REMOTE_ADDR'], $allowedIpAddresses)) {
$response['feedback'] = sprintf(\GO::t('wrongLocation', 'ipwhitelist'), $_SERVER['REMOTE_ADDR']);
$response['success'] = false;
return false;
}
return true;
}
开发者ID:ajaboa,项目名称:crmpuan,代码行数:31,代码来源:IpwhitelistModule.php
示例7: actionBirthdays
/**
* Get the data for the grid that shows all the tasks from the selected tasklists.
*
* @param Array $params
* @return Array The array with the data for the grid.
*/
protected function actionBirthdays($params)
{
$today = mktime(0, 0, 0);
$next_month = \GO\Base\Util\Date::date_add(mktime(0, 0, 0), 30);
//\GO::debug($yesterday);
$start = date('Y-m-d', $today);
$end = date('Y-m-d', $next_month);
//\GO::debug($start);
$select = "t.id, birthday, first_name, middle_name, last_name, addressbook_id, photo, " . "IF (STR_TO_DATE(CONCAT(YEAR('{$start}'),'/',MONTH(birthday),'/',DAY(birthday)),'%Y/%c/%e') >= '{$start}', " . "STR_TO_DATE(CONCAT(YEAR('{$start}'),'/',MONTH(birthday),'/',DAY(birthday)),'%Y/%c/%e') , " . "STR_TO_DATE(CONCAT(YEAR('{$start}')+1,'/',MONTH(birthday),'/',DAY(birthday)),'%Y/%c/%e')) " . "as upcoming ";
$findCriteria = \GO\Base\Db\FindCriteria::newInstance()->addCondition('birthday', '0000-00-00', '!=')->addRawCondition('birthday', 'NULL', 'IS NOT');
$settings = \GO\Addressbook\Model\BirthdaysPortletSetting::model()->findByAttribute('user_id', \GO::user()->id);
if (count($settings)) {
$abooks = array_map(function ($value) {
return $value->addressbook_id;
}, $settings->fetchAll());
$findCriteria->addInCondition('addressbook_id', $abooks);
}
$having = "upcoming BETWEEN '{$start}' AND '{$end}'";
$findParams = \GO\Base\Db\FindParams::newInstance()->distinct()->select($select)->criteria($findCriteria)->having($having)->order('upcoming');
//$response['data']['original_photo_url']=$model->photoURL;
$columnModel = new \GO\Base\Data\ColumnModel('GO\\Addressbook\\Model\\Contact');
$columnModel->formatColumn('addressbook_id', '$model->addressbook->name');
$columnModel->formatColumn('photo_url', '$model->getPhotoThumbURL()');
$columnModel->formatColumn('age', '($model->upcoming != date("Y-m-d")) ? $model->age+1 : $model->age');
$store = new \GO\Base\Data\DbStore('GO\\Addressbook\\Model\\Contact', $columnModel, $_POST, $findParams);
return $store->getData();
}
开发者ID:ajaboa,项目名称:crmpuan,代码行数:33,代码来源:PortletController.php
示例8: actionGroupsWithResources
protected function actionGroupsWithResources($params)
{
$stmt = \GO\Calendar\Model\Group::model()->find(\GO\Base\Db\FindParams::newInstance()->order('t.name')->criteria(\GO\Base\Db\FindCriteria::newInstance()->addCondition('id', 1, '>')));
$response['results'] = array();
$response['total'] = 0;
while ($group = $stmt->fetch()) {
$record = $group->getAttributes('formatted');
if (\GO::modules()->customfields) {
$record['customfields'] = \GO\Customfields\Controller\CategoryController::getEnabledCategoryData("GO\\Calendar\\Model\\Event", $group->id);
} else {
$record['customfields'] = array();
}
$record['resources'] = array();
$calStmt = \GO\Calendar\Model\Calendar::model()->find(\GO\Base\Db\FindParams::newInstance()->permissionLevel(\GO\Base\Model\Acl::READ_PERMISSION)->joinCustomFields()->order('t.name')->criteria(\GO\Base\Db\FindCriteria::newInstance()->addCondition('group_id', $group->id)));
while ($resource = $calStmt->fetch()) {
$resourceRecord = $resource->getAttributes('formatted');
$record['resources'][] = $resourceRecord;
}
$num_resources = count($record['resources']);
if ($num_resources > 0) {
$response['results'][] = $record;
$response['total'] += $num_resources;
}
}
return $response;
}
开发者ID:ajaboa,项目名称:crmpuan,代码行数:26,代码来源:GroupController.php
示例9: actionDisplay
protected function actionDisplay($params)
{
$findParams = \GO\Base\Db\FindParams::newInstance()->select('count(*) AS count')->join(\GO\Base\Model\ReminderUser::model()->tableName(), \GO\Base\Db\FindCriteria::newInstance()->addModel(\GO\Base\Model\Reminder::model())->addCondition('id', 'ru.reminder_id', '=', 't', true, true), 'ru')->criteria(\GO\Base\Db\FindCriteria::newInstance()->addModel(\GO\Base\Model\ReminderUser::model(), 'ru')->addCondition('user_id', \GO::user()->id, '=', 'ru')->addCondition('time', time(), '<', 'ru'));
$model = \GO\Base\Model\Reminder::model()->findSingle($findParams);
$html = "";
$this->fireEvent('reminderdisplay', array($this, &$html, $params));
$this->render("Reminder", array('count' => intval($model->count), 'html' => $html));
}
开发者ID:ajaboa,项目名称:crmpuan,代码行数:8,代码来源:ReminderController.php
示例10: actionContentStore
/**
* Loads a store of content items of the current website
*
* @param int $id
* @param int $site_id
*/
public function actionContentStore($menu_id)
{
$menu = \GO\Site\Model\Menu::model()->findByPk($menu_id);
$findCriteria = \GO\Base\Db\FindCriteria::newInstance()->addCondition('site_id', $menu->site_id);
$findParams = \GO\Base\Db\FindParams::newInstance()->criteria($findCriteria);
$store = new \GO\Base\Data\DbStore('GO\\Site\\Model\\Content', new \GO\Base\Data\ColumnModel('GO\\Site\\Model\\Content'), $_REQUEST, $findParams);
echo $this->renderStore($store);
}
开发者ID:ajaboa,项目名称:crmpuan,代码行数:14,代码来源:MenuController.php
示例11: actionGetUsage
protected function actionGetUsage($params)
{
$domains = json_decode($params['domains']);
$response['success'] = true;
$record = \GO\Postfixadmin\Model\Mailbox::model()->find(\GO\Base\Db\FindParams::newInstance()->single()->select('SUM(`usage`) AS `usage`')->joinModel(array('model' => 'GO\\Postfixadmin\\Model\\Domain', 'localField' => 'domain_id', 'tableAlias' => 'd'))->criteria(\GO\Base\Db\FindCriteria::newInstance()->addInCondition('domain', $domains, 'd')));
$response['usage'] = $record->usage;
return $response;
}
开发者ID:ajaboa,项目名称:crmpuan,代码行数:8,代码来源:DomainController.php
示例12: actionParentStore
/**
* Loads a store of menu items that can be a parent of the given menu item.
*
* @param int $id
* @param int $site_id
*/
public function actionParentStore($id = false, $menu_id)
{
$findCriteria = \GO\Base\Db\FindCriteria::newInstance()->addCondition('menu_id', $menu_id);
$findCriteria->addCondition('id', $id, '<>');
$findParams = \GO\Base\Db\FindParams::newInstance()->criteria($findCriteria);
$store = new \GO\Base\Data\DbStore('GO\\Site\\Model\\MenuItem', new \GO\Base\Data\ColumnModel('GO\\Site\\Model\\MenuItem'), $_REQUEST, $findParams);
echo $this->renderStore($store);
}
开发者ID:ajaboa,项目名称:crmpuan,代码行数:14,代码来源:MenuItemController.php
示例13: getStoreParams
protected function getStoreParams($params)
{
if (!empty($params['active'])) {
return \GO\Base\Db\FindParams::newInstance()->select('t.*')->criteria(\GO\Base\Db\FindCriteria::newInstance()->addCondition('due_time', 0, '=', 't', false)->addCondition('due_time', mktime(0, 0, 0), '>=', 't', false))->order('id', 'DESC');
} else {
return \GO\Base\Db\FindParams::newInstance()->select('t.*');
}
}
开发者ID:ajaboa,项目名称:crmpuan,代码行数:8,代码来源:AnnouncementController.php
示例14: actionStore
protected function actionStore($params)
{
$groupId = $params['group_id'];
$columnModel = new \GO\Base\Data\ColumnModel(\GO\Ipwhitelist\Model\IpAddress::model());
$storeFindParams = \GO\Base\Db\FindParams::newInstance()->criteria(\GO\Base\Db\FindCriteria::newInstance()->addCondition('group_id', $groupId))->order('ip_address');
$store = new \GO\Base\Data\DbStore('GO\\Ipwhitelist\\Model\\IpAddress', $columnModel, $params, $storeFindParams);
echo $this->renderStore($store);
}
开发者ID:ajaboa,项目名称:crmpuan,代码行数:8,代码来源:IpAddressController.php
示例15: load
/**
* Execute a grouped query and return the statement. This class may be extended
* so you can document loaded properties or implement additional functions.
*
* @param string $modelName
* @param array $groupBy eg array('t.name')
* @param string $selectFields
* @param \GO\Base\Db\FindParams $findParams
* @return \GO\Base\Db\ActiveStatement
*/
public function load($modelName, $groupBy, $selectFields, \GO\Base\Db\FindParams $findParams = null)
{
if (!isset($findParams)) {
$findParams = \GO\Base\Db\FindParams::newInstance();
}
$findParams->ignoreAcl()->select($selectFields)->group($groupBy)->fetchClass(get_class($this));
$stmt = \GO::getModel($modelName)->find($findParams);
return $stmt;
}
开发者ID:ajaboa,项目名称:crmpuan,代码行数:19,代码来源:Grouped.php
示例16: getEnabledIds
/**
* Get enabled categories for a model.
*
* @param string $modelName The name of the model that controls the disabled categories. eg. \GO\Addressbook\Model\Addressbook controls them for \GO\Addressbook\Model\Contact
* @param int $modelId
* @return array
*/
public function getEnabledIds($modelName, $modelId)
{
$stmt = $this->find(\GO\Base\Db\FindParams::newInstance()->criteria(\GO\Base\Db\FindCriteria::newInstance()->addCondition('model_name', $modelName)->addCondition('model_id', $modelId)));
$ids = array();
while ($enabled = $stmt->fetch()) {
$ids[] = $enabled->category_id;
}
return $ids;
}
开发者ID:ajaboa,项目名称:crmpuan,代码行数:16,代码来源:EnabledCategory.php
示例17: actionSelectStore
protected function actionSelectStore($params)
{
$columnModel = new \GO\Base\Data\ColumnModel(\GO\Customfields\Model\Field::model());
$columnModel->formatColumn('extends_model', '$model->category->extends_model', array(), 'category_id');
$columnModel->formatColumn('full_info', '"[".\\GO::t($model->category->extends_model,"customfields")."] ".$model->category->name." : ".$model->name." (col_".$model->id.")"', array(), 'category_id');
$findParams = \GO\Base\Db\FindParams::newInstance()->joinModel(array('model' => 'GO\\Customfields\\Model\\Category', 'localTableAlias' => 't', 'localField' => 'category_id', 'foreignField' => 'id', 'tableAlias' => 'c'))->criteria(\GO\Base\Db\FindCriteria::newInstance()->addInCondition('extends_model', array('GO\\Addressbook\\Model\\Contact', 'GO\\Addressbook\\Model\\Company', 'GO\\Projects2\\Model\\Project', 'GO\\Base\\Model\\User'), 'c')->addInCondition('datatype', array('GO\\Addressbook\\Customfieldtype\\Contact', 'GO\\Addressbook\\Customfieldtype\\Company'), 't'));
$store = new \GO\Base\Data\DbStore('GO\\Customfields\\Model\\Field', $columnModel, $params, $findParams);
echo $this->renderStore($store);
}
开发者ID:ajaboa,项目名称:crmpuan,代码行数:9,代码来源:BlockFieldController.php
示例18: getFullClientState
/**
* Get's the user's client state in a key value array.
*
* @param int $user_id
* @return array
*/
public function getFullClientState($user_id)
{
$state = array();
$stmt = $this->findByAttribute('user_id', $user_id, \GO\Base\Db\FindParams::newInstance()->select('t.*'));
while ($model = $stmt->fetch()) {
$state[$model->name] = $model->value;
}
return $state;
}
开发者ID:ajaboa,项目名称:crmpuan,代码行数:15,代码来源:State.php
示例19: getGroupCalendars
public function getGroupCalendars()
{
$findParams = \GO\Base\Db\FindParams::newInstance()->select('t.*')->criteria(\GO\Base\Db\FindCriteria::newInstance()->addCondition('view_id', $this->id, '=', 'vgr'));
$findParams->joinModel(array('model' => 'GO\\Base\\Model\\User', 'localField' => 'user_id', 'tableAlias' => 'usr'));
$findParams->joinModel(array('model' => 'GO\\Base\\Model\\UserGroup', 'localField' => 'user_id', 'foreignField' => 'user_id', 'tableAlias' => 'usg'));
$findParams->joinModel(array('model' => 'GO\\Base\\Model\\Group', 'localField' => 'group_id', 'localTableAlias' => 'usg', 'tableAlias' => 'grp'));
$findParams->joinModel(array('model' => 'GO\\Calendar\\Model\\ViewGroup', 'localField' => 'id', 'localTableAlias' => 'grp', 'foreignField' => 'group_id', 'tableAlias' => 'vgr', 'criteria' => \GO\Base\Db\FindCriteria::newInstance()->addCondition('view_id', $this->id, '=', 'vgr')));
return Calendar::model()->find($findParams);
}
开发者ID:ajaboa,项目名称:crmpuan,代码行数:9,代码来源:View.php
示例20: actionSavedExportsStore
public function actionSavedExportsStore($className)
{
$columnModel = new ColumnModel(SavedExport::model());
// "t.name as text" needs to be added because this store is also used to create the menu. (And the menu expects the "text" property for it's label)
$findParams = FindParams::newInstance()->select('t.*,t.name as text')->criteria(FindCriteria::newInstance()->addCondition('class_name', $className));
$store = new DbStore('GO\\Base\\Model\\SavedExport', $columnModel, GO::request()->post, $findParams);
$store->defaultSort = 'id';
echo $this->render('store', array('store' => $store));
}
开发者ID:ajaboa,项目名称:crmpuan,代码行数:9,代码来源:ExportController.php
注:本文中的GO\Base\Db\FindParams类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论