当前位置: 首页>>代码示例>>PHP>>正文


PHP Users::findAll方法代码示例

本文整理汇总了PHP中Users::findAll方法的典型用法代码示例。如果您正苦于以下问题:PHP Users::findAll方法的具体用法?PHP Users::findAll怎么用?PHP Users::findAll使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Users的用法示例。


在下文中一共展示了Users::findAll方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getWhoIsOnline

 /**
  * Return all users that was active in past $active_in minutes (defautl is 15 minutes)
  *
  * @access public
  * @param integer $active_in
  * @return array
  */
 static function getWhoIsOnline($active_in = 15)
 {
     if ((int) $active_in < 1) {
         $active_in = 15;
     }
     $datetime = DateTimeValueLib::now();
     $datetime->advance(-1 * $active_in * 60);
     return Users::findAll(array('conditions' => array('`last_activity` > ?', $datetime)));
     // findAll
 }
开发者ID:bklein01,项目名称:Project-Pier,代码行数:17,代码来源:Users.class.php

示例2: actionIndex

 /**
  * Lists all models.
  */
 public function actionIndex()
 {
     $criteria = new CDbCriteria();
     $criteria->order = 'cTime DESC';
     //$criteria->select = 'id,title';
     $model = new Users();
     $count = $model->count($criteria);
     $pager = new CPagination($count);
     $pager->pageSize = 100;
     $pager->applyLimit($criteria);
     $posts = $model->findAll($criteria);
     $this->render('index', array('pages' => $pager, 'posts' => $posts));
 }
开发者ID:ph7pal,项目名称:mei,代码行数:16,代码来源:UsersController.php

示例3: getUsersByGroup

 /**
  * Returns all User objects that belong to a group
  *
  * @param integer $group_id
  * @return User list
  */
 static function getUsersByGroup($group_id)
 {
     $all = self::findAll(array('conditions' => array('`group_id` = ?', $group_id)));
     $cond = '0';
     if (!$all) {
         return array();
     }
     //empty result, avoid query
     foreach ($all as $usr) {
         $cond .= ',' . $usr->getUserId();
     }
     $cond = '(' . $cond . ') ';
     return Users::findAll(array('conditions' => array('`id` in ' . $cond)));
 }
开发者ID:pnagaraju25,项目名称:fengoffice,代码行数:20,代码来源:GroupUsers.class.php

示例4: array

<?php

require_once '../../bootstrap.php';
use Pop\Db;
/*
 * Placing a class here is highly unorthodox.
 * This is just for example purposes only.
 */
class Users extends Db\Record
{
}
try {
    // Define DB credentials
    $db = Db\Db::factory('Mysqli', array('database' => 'helloworld', 'host' => 'localhost', 'username' => 'hello', 'password' => '12world34'));
    Users::setDb($db);
    $users = Users::findAll('id ASC', array('username' => '%test%'), '3, 4');
    print_r($users->rows);
} catch (\Exception $e) {
    echo $e->getMessage() . PHP_EOL . PHP_EOL;
}
开发者ID:nicksagona,项目名称:PopPHP,代码行数:20,代码来源:record1.php

示例5: delete

 /**
  * Delete project
  *
  * @param void
  * @return boolean
  */
 function delete()
 {
     $wsIds = $this->getAllSubWorkspacesQuery();
     if ($wsIds) {
         $ws = $this->getSubWorkspaces();
         if (isset($ws) && !is_null($ws)) {
             $wsToDelete = array();
             $wsToMove = array();
             $users = Users::findAll(array("conditions" => "personal_project_id in ({$wsIds})"));
             foreach ($ws as $w) {
                 $canDelete = $w->canDelete(logged_user());
                 if ($users && $canDelete) {
                     foreach ($users as $user) {
                         if ($user->getPersonalProjectId() == $w->getId()) {
                             $canDelete = false;
                             break;
                         }
                     }
                 }
                 if ($canDelete) {
                     $wsToDelete[] = $w;
                 } else {
                     $wsToMove[] = $w;
                 }
             }
             if (count($wsToMove) > 0) {
                 //Find the new parents
                 $moves = array();
                 foreach ($wsToMove as $w) {
                     $parentIds = $w->getParentIds();
                     for ($i = $w->getDepth() - 1; $i > 0; $i--) {
                         if ($parentIds[$i] == $this->getId()) {
                             $moves[] = array($w, $this->getParentWorkspace());
                             break;
                         } else {
                             $found = false;
                             for ($j = 0; $j < count($wsToMove); $j++) {
                                 if ($parentIds[$i] == $wsToMove[$j]->getId()) {
                                     $moves[] = array($w, $wsToMove[$j]);
                                     $found = true;
                                     break;
                                 }
                             }
                             if ($found) {
                                 break;
                             }
                         }
                     }
                 }
             }
             foreach ($wsToDelete as $w) {
                 $w->deleteSingle();
             }
             if (isset($moves)) {
                 foreach ($moves as $move) {
                     $move[0]->setParentWorkspace($move[1]);
                     $move[0]->save();
                 }
             }
         }
     }
     return $this->deleteSingle();
 }
开发者ID:pnagaraju25,项目名称:fengoffice,代码行数:69,代码来源:Project.class.php

示例6: getExternalUsers

 function getExternalUsers()
 {
     return Users::findAll(array('conditions' => '`company_id` IN (SELECT `id` FROM `' . TABLE_PREFIX . 'companies` WHERE `client_of_id` <> 0)'));
 }
开发者ID:pnagaraju25,项目名称:fengoffice,代码行数:4,代码来源:Users.class.php

示例7: system_handle_on_daily

/**
 * Do daily taks
 *
 * @param void
 * @return null
 */
function system_handle_on_daily()
{
    ProjectObjectViews::cleanUp();
    $priorities_images = array(PRIORITY_URGENT => 'assets/images/icons/priority/urgent.png', PRIORITY_HIGHEST => 'assets/images/icons/priority/highest.gif', PRIORITY_HIGH => 'assets/images/icons/priority/high.gif', PRIORITY_NORMAL => 'assets/images/icons/priority/normal.gif', PRIORITY_LOW => 'assets/images/icons/priority/low.gif', PRIORITY_LOWEST => 'assets/images/icons/priority/lowest.gif', PRIORITY_HOLD => 'assets/images/icons/priority/hold.png', '-99' => 'assets/images/icons/priority/unknown.png');
    $pages = array();
    $link = mysql_connect(DB_HOST, DB_USER, DB_PASS);
    mysql_select_db(DB_NAME);
    $sql = "select id, name from healingcrystals_project_objects where project_id='" . TASK_LIST_PROJECT_ID . "' and type='Page'";
    $result = mysql_query($sql, $link);
    while ($entry = mysql_fetch_assoc($result)) {
        list($name, ) = explode('-', $entry['name']);
        $name = trim($name);
        $pages[$name] = $entry['id'];
    }
    $current_time = time();
    $users = Users::findAll();
    foreach ($users as $user) {
        $flag = 1;
        $message = '';
        $name = $user->getName();
        if (array_key_exists($name, $pages)) {
            $page = new Page($pages[$name]);
            if ($page) {
                $sql = "select id from healingcrystals_project_objects where parent_id='" . $pages[$name] . "' and parent_type='Page' and type='Task' and completed_on is null and priority is null and created_on>='" . date('Y-m-d H:i:s', $current_time - 1 * 24 * 60 * 60) . "' order by created_on";
                $result = mysql_query($sql, $link);
                if (mysql_num_rows($result)) {
                    $show_task_list = true;
                } else {
                    $show_task_list = false;
                }
                if (date('N') == '1' || $show_task_list) {
                    $message .= '<style>
		.odd {background-color:#ffffff;}
		.even{background-color:#eeeeee;}
	</style>
	<table>
		<tr>
			<td colspan="3">Task List: ' . $name . '</td>
		</tr>
		<tr>
			<td align="center">Priority</td>
			<td>Task</td>
			<td>&nbsp;</td>
		</tr>';
                    $tasks = Tasks::findOpenByObject($page);
                    foreach ($tasks as $task) {
                        $message .= '
		<tr class="' . ($flag % 2 === 1 ? 'odd' : 'even') . '">
			<td valign="top" align="center"><img  src="http://projects.ffbh.org/public/' . $priorities_images[$task->getPriority()] . '"/></td>
			<td valign="top">' . $task->getName() . '</td>
			<td valign="top"><a href="' . $task->getViewUrl() . '">View</a></td>
		</tr>';
                        $flag++;
                    }
                    $message .= '
	</table>';
                    $subject = 'projects: healingcrystals.com Task list';
                    $headers = 'MIME-Version: 1.0' . "\r\n";
                    $headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n";
                    $headers .= 'From: FFBH Reminder <auto@ffbh.org>' . "\r\n";
                    mail($user->getEmail(), $subject, $message, $headers);
                }
            }
        }
    }
    $sql = "select po.id, cast(if( pom.recurring_period_type='D', DATE_ADD(po.due_on, interval pom.recurring_period day), if(pom.recurring_period_type='W', DATE_ADD(po.due_on, interval pom.recurring_period week), if(pom.recurring_period_type='M', DATE_ADD(po.due_on, interval pom.recurring_period month), null ) ) ) as Date) as next_due_date, cast(DATE_ADD(now(), interval 0 day) as Date) as cur_date, cast(if(isnull(pom.email_reminder_unit), null, if( pom.email_reminder_unit='D', DATE_ADD(po.due_on, interval pom.email_reminder_period day), if(pom.email_reminder_unit='W', DATE_ADD(po.due_on, interval pom.email_reminder_period week), if(pom.email_reminder_unit='M', DATE_ADD(po.due_on, interval pom.email_reminder_period month), null ) ) )\t) as Date) as reminder_date from healingcrystals_project_objects po inner join  healingcrystals_project_object_misc pom on po.id=pom.object_id where po.type='Task' and po.due_on is not null and po.due_on<=now() and po.completed_on is null and pom.recurring_period_condition='after_due_date' and if(pom.recurring_end_date is not null and pom.recurring_end_date!='0000-00-00', if(pom.recurring_end_date>=now(), 1, 0), 1)=1 having next_due_date=cur_date";
    $result = mysql_query($sql);
    while ($entry = mysql_fetch_assoc($result)) {
        $task = new Task($entry['id']);
        $action = $task->complete(new AnonymousUser('auto', 'auto@projects.ffbh.org'));
        if (!empty($entry['reminder_date']) && $entry['cur_date'] == $entry['reminder_date']) {
            $sql02 = "select id from " . TABLE_PREFIX . "project_objects where type='Task' and project_id='" . $task->getProjectId() . "' and milestone_id='" . $task->getMilestoneId() . "' and parent_id='" . $task->getParentId() . "' order by id desc limit 0, 1";
            $result02 = mysql_query($sql02);
            if (mysql_num_rows($result02)) {
                $info = mysql_fetch_assoc($result02);
                $recurring_task = new Task($info['id']);
                $parent = $recurring_task->getParent();
                $project = $recurring_task->getProject();
                $assignees = $recurring_task->getAssignees();
                $priorities = array(PRIORITY_HIGHEST => lang('Highest'), PRIORITY_HIGH => lang('High'), PRIORITY_NORMAL => lang('Normal'), PRIORITY_LOW => lang('Low'), PRIORITY_LOWEST => lang('Lowest'), PRIORITY_ONGOING => lang('Ongoing'), PRIORITY_HOLD => lang('Hold'));
                $due_date = $task->getDueOn();
                $due_date = date('m/d/Y', strtotime($due_date));
                $reminder_date = date('m/d/Y', strtotime($entry['reminder_date']));
                foreach ($assignees as $assignee) {
                    $assignees_string .= $assignee->getDisplayName() . ', ';
                }
                if (!empty($assignees_string)) {
                    $assignees_string = substr($assignees_string, 0, -2);
                } else {
                    $assignees_string = '--';
                }
                $reminders_sent = array();
                foreach ($assignees as $user) {
                    //if ($user->getEmail()=='anuj@focusindia.com'){
//.........这里部分代码省略.........
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:101,代码来源:on_daily.php

示例8: add_reminders

 function add_reminders($object)
 {
     if (logged_user()->isGuest()) {
         flash_error(lang('no access permissions'));
         ajx_current("empty");
         return;
     }
     $popup_count = 0;
     $object->clearReminders(logged_user(), true);
     $typesC = array_var($_POST, 'reminder_type');
     if (!is_array($typesC)) {
         return;
     }
     $durationsC = array_var($_POST, 'reminder_duration');
     $duration_typesC = array_var($_POST, 'reminder_duration_type');
     $subscribersC = array_var($_POST, 'reminder_subscribers');
     foreach ($typesC as $context => $types) {
         $durations = $durationsC[$context];
         $duration_types = $duration_typesC[$context];
         $subscribers = $subscribersC[$context];
         for ($i = 0; $i < count($types); $i++) {
             $type = $types[$i];
             $duration = $durations[$i];
             $duration_type = $duration_types[$i];
             $minutes = $duration * $duration_type;
             $reminder = new ObjectReminder();
             $reminder->setMinutesBefore($minutes);
             $reminder->setType($type);
             $reminder->setContext($context);
             $reminder->setObject($object);
             if (isset($subscribers[$i])) {
                 $reminder->setUserId(0);
             } else {
                 $reminder->setUser(logged_user());
             }
             $date = $object->getColumnValue($context);
             if ($date instanceof DateTimeValue) {
                 $rdate = new DateTimeValue($date->getTimestamp() - $minutes * 60);
                 $reminder->setDate($rdate);
             }
             $reminder->save();
             $popup_count = $popup_count + ($type == 'reminder_popup' ? 1 : 0);
         }
     }
     if (count($popup_count) > 0 && GlobalCache::isAvailable()) {
         $user_ids = Users::findAll(array('id' => true));
         foreach ($user_ids as $uid) {
             GlobalCache::update('check_for_popup_reminders_' . $uid, 1);
         }
     }
 }
开发者ID:pnagaraju25,项目名称:fengoffice,代码行数:51,代码来源:ObjectController.class.php

示例9: getAssignableUsers

 function getAssignableUsers($project = null)
 {
     if ($this->isMemberOfOwnerCompany()) {
         return Users::getAll();
     }
     TimeIt::start('get assignable users');
     if ($project instanceof Project) {
         $ws = $project->getAllSubWorkspacesQuery(true);
     }
     $users = $this->getCompany()->getUsers();
     $uid = $this->getId();
     $cid = $this->getCompany()->getId();
     $tp = TABLE_PREFIX;
     $gids = "SELECT `group_id` FROM `{$tp}group_users` WHERE `user_id` = {$uid}";
     $q1 = "SELECT `project_id` FROM `{$tp}project_users` WHERE (`user_id` = {$uid} OR `user_id` IN ({$gids})) AND `can_assign_to_other` = '1'";
     $q2 = "SELECT `project_id` FROM `{$tp}project_users` WHERE (`user_id` = {$uid} OR `user_id` IN ({$gids})) AND `can_assign_to_owners` = '1'";
     if (isset($ws)) {
         $q1 .= " AND `project_id` IN ({$ws})";
         $q2 .= " AND `project_id` IN ({$ws})";
     }
     $query1 = "SELECT `user_id` FROM `{$tp}project_users` WHERE `project_id` IN ({$q1})";
     $query2 = "SELECT `user_id` FROM `{$tp}project_users` WHERE `project_id` IN ({$q2})";
     // get users from other client companies that share workspaces in which the user can assign to other clients' members
     $us1 = Users::findAll(array('conditions' => "`id` IN ({$query1}) AND `company_id` <> 1 AND `company_id` <> {$cid}"));
     // get users from the owner company that share workspaces in which the user can assign to owner company members
     $us2 = Users::findAll(array('conditions' => "`id` IN ({$query2}) AND `company_id` = 1"));
     $users = array_merge($users, $us1);
     $users = array_merge($users, $us2);
     TimeIt::stop();
     return $users;
 }
开发者ID:pnagaraju25,项目名称:fengoffice,代码行数:31,代码来源:User.class.php

示例10: updateBillingValues

 /**
  * This function sets the selected billing values for all timeslots which lack any type of billing values (value set to 0). 
  * This function is used when users start to use billing in the system.
  * 
  * @return unknown_type
  */
 static function updateBillingValues()
 {
     $timeslots = Timeslots::findAll(array('conditions' => '`end_time` > 0 AND billing_id = 0 AND is_fixed_billing = 0 AND (object_manager = \'ProjectTasks\' OR object_manager = \'Projects\')', 'limit' => 500));
     $users = Users::findAll();
     $usArray = array();
     foreach ($users as $u) {
         $usArray[$u->getId()] = $u;
     }
     $pbidCache = array();
     $count = 0;
     foreach ($timeslots as $ts) {
         $user = $usArray[$ts->getUserId()];
         if (isset($user) && $user) {
             $billing_category_id = $user->getDefaultBillingId();
             if ($billing_category_id > 0) {
                 $object = $ts->getObject();
                 //Set billing info
                 if ($object instanceof ProjectDataObject && $object->getProject() instanceof Project || $object instanceof Project) {
                     $hours = $ts->getMinutes() / 60;
                     if ($object instanceof Project) {
                         $project = $object;
                     } else {
                         $project = $object->getProject();
                     }
                     $ts->setBillingId($billing_category_id);
                     if (!isset($pbidCache[$project->getId()])) {
                         $pbidCache[$project->getId()] = array();
                     }
                     if (isset($pbidCache[$project->getId()][$billing_category_id])) {
                         $hourly_billing = $pbidCache[$project->getId()][$billing_category_id];
                     } else {
                         $hourly_billing = $project->getBillingAmount($billing_category_id);
                         $pbidCache[$project->getId()][$billing_category_id] = $hourly_billing;
                     }
                     $ts->setHourlyBilling($hourly_billing);
                     $ts->setFixedBilling(round($hourly_billing * $hours, 2));
                     $ts->setIsFixedBilling(false);
                     $ts->save();
                     $count++;
                 }
             }
         } else {
             $ts->setIsFixedBilling(true);
             $ts->save();
         }
     }
     return $count;
 }
开发者ID:pnagaraju25,项目名称:fengoffice,代码行数:54,代码来源:Timeslots.class.php

示例11: getAutoAssignUsers

 /**
  * Return users that have auto assign value set to true
  *
  * @access public
  * @param void
  * @return array
  */
 function getAutoAssignUsers()
 {
     return Users::findAll(array('conditions' => '`company_id` = ' . DB::escape($this->getId()) . ' AND `auto_assign` > ' . DB::escape(0)));
     // findAll
 }
开发者ID:pnagaraju25,项目名称:fengoffice,代码行数:12,代码来源:Company.class.php

示例12: getCategoryUsers

 function getCategoryUsers()
 {
     return Users::findAll(array('conditions' => 'default_billing_id = ' . $this->getId()));
 }
开发者ID:pnagaraju25,项目名称:fengoffice,代码行数:4,代码来源:BillingCategory.class.php


注:本文中的Users::findAll方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。