本文整理汇总了PHP中R::loadAll方法的典型用法代码示例。如果您正苦于以下问题:PHP R::loadAll方法的具体用法?PHP R::loadAll怎么用?PHP R::loadAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类R
的用法示例。
在下文中一共展示了R::loadAll方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: view
function view($args)
{
$id = array_shift($args);
$permission = R::load('permission', $id);
if (!is_numeric($id) && !$permission->getID()) {
$this->redirect(PACKAGE_URL);
}
$allgroups = R::findAll('group');
foreach ($allgroups as $key => $group) {
foreach ($permission->sharedGroup as $group_c) {
if ($group->id == $group_c->id) {
$allgroups[$key]->checked = true;
}
}
}
// echo $permission->name;exit;
$view = new G2_TwigView('pages/view');
$view->permission = $permission;
$view->allGroups = $allgroups;
$form = new G2_FormMagic($view->get_render());
if ($form->is_posted()) {
$groups = R::loadAll('group', array_keys($form->data()['groups']));
$permission->sharedGroup = $groups;
R::store($permission);
Admin_Alert::add_message("\"{$permission->name}\" permission was updated");
$this->redirect(PACKAGE_URL);
}
echo $form->parse();
}
示例2: select
public function select($id = null)
{
// no id and no other params
if ($id == null) {
$items = R::loadAll($this->table, array());
return $items;
} else {
$item = R::load($this->table, $id);
return $item;
}
}
示例3: batchFindByIds
public static function batchFindByIds($ids)
{
return $users = R::loadAll('user', $ids);
}
示例4: getUserProgress
static function getUserProgress($id = 0, $complete = 0)
{
$data = R::duplicate($_SESSION['user']);
$out = "<div class='col-sm-12'>\r\n <div class=\"list-group\"><ul style='padding-left:0;'>";
$out .= "<li class=\"list-group-item active\">";
if ($id == 0 && $complete == 0) {
$out .= "<h4 class=\"list-group-item-heading \"><a role='button' href='?ctrl=cabinet&action=GetCabinet' class='btn btn-info back_button'><span class=\"glyphicon glyphicon-arrow-left\" aria-hidden=\"true\"></span></a>В кабинет </h4>";
}
if ($complete == 1) {
$out .= "<h4 class=\"list-group-item-heading \"><a role='button' href='?ctrl=cabinet&action=GetCabinet' class='btn btn-info back_button'><span class=\"glyphicon glyphicon-arrow-left\" aria-hidden=\"true\"></span></a>В кабинет</h4>";
}
if ($id != 0) {
$out .= "<h4 class=\"list-group-item-heading \"><a role='button' href='?ctrl=cabinet&action=GetUserInformation' class='btn btn-info back_button'><span class=\"glyphicon glyphicon-arrow-left\" aria-hidden=\"true\"></span></a>Вернуться к списку</h4>";
}
//?ctrl=cabinet&action=GetUserInformation
$out .= '</li></ul></div>';
if ($id == 0) {
$preWisdom = $data->ownInformation_userList;
$arrayId = array();
foreach ($preWisdom as $value) {
if ($complete == 0) {
if (is_null($value->status) && is_null($value->education_id) && is_null($value->lesson_id)) {
$arrayId[] = $value->information_id;
}
} else {
if (!is_null($value->status) && is_null($value->education_id) && is_null($value->lesson_id)) {
$arrayId[] = $value->information_id;
}
}
}
$wisdom = R::loadAll('information', $arrayId);
} else {
// проверяем записан ли пользователь на данный УМ
$userInfo = $data->ownInformation_userList;
foreach ($userInfo as $value) {
if ($value->information_id == $id) {
$wisdom = R::findAll('information', 'where id = ?', [$id]);
}
}
}
$typeMenu = '6';
$typeMenu1 = '';
if ($complete == 0) {
if ($id === 0) {
switch ($_SESSION['user']->status) {
case "student":
$typeMenu = 3;
$typeMenu1 = '';
break;
case "teacher":
$typeMenu = 7;
$typeMenu1 = 8;
break;
case "moderator":
$typeMenu = 4;
// $typeMenu1=8;
break;
case "admin":
$typeMenu = 9;
$typeMenu1 = 8;
break;
}
}
}
$bigMenu = new menu("SELECT menu_item.*\r\n FROM `menu` , `menu_item`\r\n WHERE menu_item.menu_id = ?\r\n AND menu.menu_id = menu_item.menu_id", [$typeMenu]);
$bigMenu->ul_tpl = "<ul class=\"nav nav-tabs nav-justified menu_heavy\">";
if (!empty($wisdom)) {
foreach ($wisdom as $item) {
$typeData = wisdom::getType($item);
if ($typeData[3]->id == 6 && $id != 0) {
header('Location:?ctrl=wisdom&action=GetWisdomById&id=' . $id);
}
if ($id != 0) {
$itemClone = '';
if ($typeData[3]->id != 1) {
$itemClone = $item;
}
$modul = self::getInfoEducation($item, $itemClone);
}
if ($_SESSION['user']->status !== 'author') {
$autor = wisdom::getAuthorName($item->id);
$author = "<br><a href='?ctrl=cabinet&action=UserInfo&id=" . $autor['id'] . "'>" . $autor['login'] . "</a> |\r\n <a href='?ctrl=cabinet&action=UserInfo&id=" . $autor['id'] . "'> " . $autor['surname'] . " " . $autor['name'] . " " . $autor['andername'] . " </a> ";
}
$short_description = !empty($item->shortdescription) ? $item->shortdescription : 'Краткое описание отсутствует';
$out .= "<li class=\"list-group-item\">\r\n <ol class=\"breadcrumb\">\r\n <li><a href=\"?ctrl=wisdom&action=WisdomType&type=" . $typeData[3]->id . "&page=1\" > " . $typeData[3]->name . "</a></li>\r\n <li><a href=\"?ctrl=wisdom&action=WisdomType&type=" . $typeData[3]->id . "&subtype=" . $typeData[2]->id . "&page=1\" > " . $typeData[2]->name . "</a></li>\r\n <li><a href=\"?ctrl=wisdom&action=WisdomType&type=" . $typeData[3]->id . "&subtype=" . $typeData[2]->id . "&category=" . $typeData[1]->id . "&page=1\" > " . $typeData[1]->name . "</a></li>\r\n <li><a href=\"?ctrl=wisdom&action=WisdomType&type=" . $typeData[3]->id . "&subtype=" . $typeData[2]->id . "&category=" . $typeData[1]->id . "&subcategory=" . $typeData[0]->id . "&page=1\" > " . $typeData[0]->name . "</a></li>\r\n\r\n </ol>\r\n <h4 class=\"list-group-item-heading\"><a href='?ctrl=wisdom&action=GetWisdomById&id=" . $item->id . "'>" . $item->name . "</a></h4><h5>" . $author . "</h5>\r\n <p class=\"list-group-item-text\">" . $short_description . "</p>" . $modul;
if ($id === 0) {
$bigMenu->li_tpl = "<li class=\"dropdown primary\" role=\"presentation\"><a data-toggle=\"tooltip\" href='%s" . $item->id . "'>%s %s</a>%s</li>";
$out .= $bigMenu->render();
}
if ($_SESSION['user']->status !== 'student' && !empty($_SESSION['user']->status) && $id != 0) {
$out .= "<a role='button' href='?ctrl=teacher&action=AddModul&id=" . $id . "' class='btn btn-info btn-block'>Добавить модуль</a>";
}
$out .= "</li>";
$out .= "</ul></div></div></div>";
}
}
if (empty($wisdom)) {
$out .= "Вы не подписанны на данный учебный материал";
}
return $out;
//.........这里部分代码省略.........
示例5: testBatchAliasLoadAll
/**
* Test batch alias loadAll.
*
* @return void
*/
public function testBatchAliasLoadAll()
{
$ids = R::storeAll(R::dispense('page', 2));
$pages = R::loadAll('page', $ids);
asrt(is_array($pages), true);
asrt(count($pages), 2);
asrt($pages[$ids[0]] instanceof RedBean_OODBBean, true);
}