本文整理汇总了PHP中User_group::multiGet方法的典型用法代码示例。如果您正苦于以下问题:PHP User_group::multiGet方法的具体用法?PHP User_group::multiGet怎么用?PHP User_group::multiGet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类User_group
的用法示例。
在下文中一共展示了User_group::multiGet方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getGroupsWithGrades
static function getGroupsWithGrades()
{
$grade = new Grades();
$qry = 'SELECT gi.group_id as groupsIDs' . ' FROM grades, group_inbox gi WHERE ' . ' gi.notice_id = grades.noticeid' . ' group by gi.group_id';
$grade->query($qry);
// all select fields will
// be written to fields of the Grade object. It is required that
// select fields are named after the Grade fields.
$foundgroups = array();
while ($grade->fetch()) {
$foundgroups[] = $grade->groupsIDs;
}
$grade->free();
return User_group::multiGet('id', $foundgroups);
}
示例2: getGroups
function getGroups()
{
// Don't save groups for repeats
if (!empty($this->repeat_of)) {
return array();
}
if (isset($this->_groups[$this->id])) {
return $this->_groups[$this->id];
}
$gis = Group_inbox::listGet('notice_id', array($this->id));
$ids = array();
foreach ($gis[$this->id] as $gi) {
$ids[] = $gi->group_id;
}
$groups = User_group::multiGet('id', $ids);
$this->_groups[$this->id] = $groups->fetchAll();
return $this->_groups[$this->id];
}
示例3: getGroups
function getGroups($offset = 0, $limit = PROFILES_PER_PAGE)
{
$ids = array();
$keypart = sprintf('profile:groups:%d', $this->id);
$idstring = self::cacheGet($keypart);
if ($idstring !== false) {
$ids = explode(',', $idstring);
} else {
$gm = new Group_member();
$gm->profile_id = $this->id;
if ($gm->find()) {
while ($gm->fetch()) {
$ids[] = $gm->group_id;
}
}
self::cacheSet($keypart, implode(',', $ids));
}
if (!is_null($offset) && !is_null($limit)) {
$ids = array_slice($ids, $offset, $limit);
}
try {
return User_group::multiGet('id', $ids);
} catch (NoResultException $e) {
return null;
// throw exception when we handle it everywhere
}
}
示例4: getGroups
function getGroups()
{
// Don't save groups for repeats
if (!empty($this->repeat_of)) {
return array();
}
if ($this->_groups != -1) {
return $this->_groups;
}
$gis = Memcached_DataObject::listGet('Group_inbox', 'notice_id', array($this->id));
$ids = array();
foreach ($gis[$this->id] as $gi) {
$ids[] = $gi->group_id;
}
$groups = User_group::multiGet('id', $ids);
$this->_groups = $groups->fetchAll();
return $this->_groups;
}
示例5: createTask
function createTask()
{
$groupsIds = Gradesgroup::getGroups($this->user->id);
$groups = User_group::multiGet('id', $groupsIds)->fetchAll();
if (empty($groups)) {
$this->element('p', 'error', 'No tiene ningún grupo asociado.');
} else {
foreach ($groups as $group) {
$this->elementStart('div', array('id' => 'div-group-task-' . $group->id, 'class' => 'group-task-grader'));
$this->element('h2', null, strtoupper($group->getBestName()));
// Comprobamos si la tarea de ese día para ese grupo ya está creada.
$result = Task_Grader::checkTask($this->user->id, $group->id);
// Creamos el form para ese grupo.
$form = new InitForm($this, $group->id, $result);
$form->show();
$this->element('p', null, 'Fecha: ' . strftime('%d-%m-%Y'));
// Cogemos el histórico de tareas de ese grupo y ese profesor.
$historical = Task_Grader::getHistorical($this->user->id, $group->id);
$this->elementStart('div', array('class' => 'wrapper-group-historical'));
// Creamos el título del histórico y un enlace para expandirlo.
$this->elementStart('a', array('class' => 'task-show-historical', 'onclick' => 'showHistorical(' . $group->id . ');'));
$this->raw('Histórico de tareas <span class="show-historical">▸</span>');
$this->elementEnd('a');
$this->elementStart('div', array('id' => 'historical-' . $group->id, 'class' => 'div-group-historical'));
if (count($historical) > 0) {
foreach ($historical as $taskHistory) {
$this->elementStart('div', array('id' => 'task-' . $taskHistory['id'], 'class' => 'div-historical-task'));
if ($taskHistory['status'] == 1) {
$status = 'Iniciada';
} else {
$status = 'Cancelada';
}
if ($taskHistory['tag'] == "") {
$taskHistory['tag'] = '<Ninguno>';
}
$this->elementStart('p');
$this->raw('<span class="historical-bold">' . $status . '</span> ' . '| <span class="historical-bold">Fecha:</span> ' . $taskHistory['cdate'] . ' ' . '| <span class="historical-bold">Tag:</span> ' . $taskHistory['tag'] . ' ' . '| <span class="historical-bold">Completada:</span> ' . $taskHistory['completed'] . '/' . $taskHistory['total']);
$this->elementEnd('p');
if ($taskHistory['completed'] == 0) {
if ($taskHistory['status'] == 1) {
$form = new CancelForm($this, $taskHistory['id']);
$form->show();
} else {
$form = new ReopenForm($this, $taskHistory['id']);
$form->show();
}
}
$this->elementEnd('div');
}
} else {
$this->element('p', null, 'Todavía no ha iniciado ninguna tarea.');
}
$this->elementEnd('div');
$this->elementEnd('div');
$this->element('p', 'task-underline');
$this->elementEnd('div');
}
}
}