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


PHP R::findAll方法代码示例

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


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

示例1: getCoolUsers

 public static function getCoolUsers($goal)
 {
     $query = 'SELECT id FROM user WHERE cool = 1 ORDER BY RANDOM() LIMIT ?';
     $userIds = array_map(function ($x) {
         return intval($x['id']);
     }, R::getAll($query, [$goal]));
     if (empty($userIds)) {
         return [];
     }
     $query = 'id IN (' . R::genSlots($userIds) . ')';
     $result = R::findAll('user', $query, $userIds);
     return array_map(function ($x) {
         return $x->box();
     }, $result);
 }
开发者ID:jonnyguio,项目名称:graph,代码行数:15,代码来源:Model_User.php

示例2: execute

 static function execute($number = 5)
 {
     if (!is_numeric($number)) {
         throw new Exception('Number must be numeric');
     }
     $callables = R::findAll('queueitem', 'status = "open" ORDER BY id DESC LIMIT ' . $number);
     $c = 0;
     foreach (array_values($callables) as $index => $calleble) {
         $c++;
         if ($calleble->done) {
             $c--;
             continue;
         }
         if ($c >= $number) {
             break;
         }
         $serializer = new Serializer();
         $closure = $serializer->unserialize($calleble->callser);
         ////			$calleble->status = 'busy';
         //			R::store($calleble);
         $closure();
         $calleble->status = 'done';
         $calleble->done = true;
         $calleble->doneat = time();
         R::store($calleble);
     }
     return;
 }
开发者ID:g2design,项目名称:g2-modules,代码行数:28,代码来源:Queuer.php

示例3: countJobs

 public function countJobs($terms)
 {
     $terms = splitTerms($terms);
     $terms = implode('|', $terms);
     $jobs = R::findAll('jobs', " status=1 AND (title REGEXP :title OR description REGEXP :description OR perks REGEXP :perks OR how_to_apply REGEXP :how_to_apply OR company_name REGEXP :company_name)", array(':title' => $terms, ':description' => $terms, ':perks' => $terms, ':how_to_apply' => $terms, ':company_name' => $terms));
     return count($jobs);
 }
开发者ID:aescarcha,项目名称:jobskee-open-source-job-board,代码行数:7,代码来源:Search.php

示例4: getEnviosByPage

function getEnviosByPage($pagenumber)
{
    //$app->get('/envios/page/:pagenumber', function ($pagenumber) use ($app) {
    $app = \Slim\Slim::getInstance();
    // query database for all contactos
    $envios = R::findAll('envios', 'ORDER BY id LIMIT ?,8', array($pagenumber * 8 - 8));
    // send response header for JSON content type
    $app->response()->header('Content-Type: text/html; charset=utf-8');
    $app->response()->header('Content-Type', 'application/json');
    //die(print_r($envios[0]->ubicaciones));
    foreach ($envios as $envio) {
        $envio->clientes = $envio->clientes;
        $envio->segmento = $envio->segmento;
        $envio->subsegmento = $envio->subsegmento;
        $envio->contactos = $envio->contactos;
        $envio->ubicaciones_origen = R::findOne('ubicaciones', 'id=?', array($envio->ubicaciones_origen_id));
        $envio->ubicaciones_destino = R::findOne('ubicaciones', 'id=?', array($envio->ubicaciones_destino_id));
        $envio->vehiculos = $envio->vehiculos;
        $envio->choferes = $envio->choferes;
        $envio->statuses = $envio->statuses;
    }
    // return JSON-encoded response body with query results
    echo json_encode(R::exportAll($envios));
    //});
}
开发者ID:eluar,项目名称:shipping_app,代码行数:25,代码来源:envios.php

示例5: unit

 protected function unit($arguments)
 {
     $request = trim($arguments[0]);
     $request = rtrim($request, '!@#$%^&*()_-+={}[]:;\'"\\|<>,./?');
     foreach ($this->lastRequest as $id => $timeToClear) {
         if (time() - $timeToClear >= self::CLEAR_TIME) {
             unset($this->lastRequest[$id]);
         }
     }
     parent::RedBeanConnect(self::DB_NAME);
     if (preg_match('/^[\\x{30A0}-\\x{30FF}\\x{31F0}-\\x{31FF}]+$/iu', $request)) {
         $units = R::findAll(self::TB_NAME, '`orginal` like ?', ["%{$request}%"]);
     } else {
         $units = R::findAll(self::TB_NAME, '`name` like ?', [$request]);
     }
     if ($units) {
         $linkHolder = [];
         foreach ($units as $unit) {
             if (!$unit->linkgc || isset($linkHolder[$unit->linkgc]) || isset($this->lastRequest[$unit->id])) {
                 continue;
             }
             $linkHolder[$unit->linkgc] = $unit->orginal;
             $this->lastRequest[$unit->id] = time();
             $text = IRCHelper::colorText('Romanji', IRCHelper::COLOR_ORANGE) . ': ' . $unit->orginal;
             $text .= ' ' . IRCHelper::colorText('Link', IRCHelper::COLOR_ORANGE) . ': ' . $unit->linkgc;
             $this->reply($text);
         }
     } else {
         $this->reply('Not found ' . $request);
     }
     R::close();
 }
开发者ID:xandros15,项目名称:Saya-Bot,代码行数:32,代码来源:Aigis.php

示例6: enviar

 public static function enviar()
 {
     global $request;
     $request = R::findAll('request', ' ORDER BY name ');
     $user = R::findAll('user');
     $lista = [];
     $subject = "Lista del super";
     $file = fopen('vistas/email/email.ejs', 'r');
     $content = fread($file, filesize('vistas/email/email.ejs'));
     $message = __($content)->template(array('lista' => $request));
     $header = "From:lista@carrito.esy.es\r\n";
     $header .= "MIME-Version: 1.0\r\n";
     $header .= "Content-type: text/html\r\n";
     foreach ($user as $key => $value) {
         if (isset($value->email) && $value->email != "" && $value->rol == 1) {
             $lista[] = $value->email;
             $to = $value->email;
             $retval = mail($to, $subject, $message, $header);
             if ($retval == true) {
                 echo json_encode($lista);
             } else {
                 echo "Message could not be sent...";
             }
         }
     }
 }
开发者ID:arandaschimpf,项目名称:carrito,代码行数:26,代码来源:email.php

示例7: recupWines

function recupWines()
{
    // Récupération sous forme d'un tableau de tous les vins dans la DB au moyen de l'ORM RedBean
    $tabWines = R::findAll('wine');
    // On retourne le tableau "tabWines"
    return $tabWines;
}
开发者ID:BiebuyckSimon,项目名称:caviste,代码行数:7,代码来源:routes.php

示例8: 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();
 }
开发者ID:g2design,项目名称:g2-modules,代码行数:29,代码来源:admin.php

示例9: nav_save

 function nav_save()
 {
     G2_User::init();
     if (G()->logged_in() && !empty($_POST)) {
         if (!empty($_POST['items']) && !empty($_POST['identity'])) {
             // Delete all current navigation details
             $navitems = R::findAll('navitem', 'identity=:id', ['id' => $_POST['identity']]);
             R::trashAll($navitems);
             foreach ($_POST['items'] as $new_item) {
                 $nav = R::dispense('navitem');
                 $nav->identity = $_POST['identity'];
                 $nav->label = $new_item['label'];
                 $nav->href = !$new_item['href'] ? null : $new_item['href'];
                 $nav->order = $new_item['order'];
                 //@todo parent node support
                 R::store($nav);
             }
             echo json_encode(['success' => true, 'message' => 'Content Saved Successfully']);
         } else {
             echo json_encode(['success' => false, 'message' => 'Data sent not correct']);
         }
     } else {
         echo json_encode(['success' => false, 'message' => 'Not Logged in']);
     }
     die;
 }
开发者ID:g2design,项目名称:g2-modules,代码行数:26,代码来源:ajax.php

示例10: process

 public function process(array $documents, &$context)
 {
     $franchiseIds = [];
     $franchiseIds[] = self::mediaToKey($context->media);
     foreach ($context->relationData as $relation) {
         if ($relation['media'] != $context->media->media) {
             continue;
         }
         if ($relation['type'] == MediaRelation::Character) {
             continue;
         }
         if (BanHelper::isFranchiseCouplingBanned($relation['media'], $relation['mal_id'], $context->media->media, $context->media->mal_id)) {
             continue;
         }
         $franchiseIds[] = self::mediaToKey($relation);
     }
     foreach (R::findAll('media', 'media||mal_id IN (' . R::genSlots($franchiseIds) . ')', $franchiseIds) as $relatedMedia) {
         $franchiseIds[] = $relatedMedia->franchise;
     }
     $franchiseId = reset($franchiseIds);
     $media =& $context->media;
     $media->franchise = $franchiseId;
     R::store($media);
     $query = 'UPDATE media SET franchise = ? WHERE franchise IN (' . R::genSlots($franchiseIds) . ')';
     R::exec($query, array_merge([$franchiseId], $franchiseIds));
 }
开发者ID:Lucas8x,项目名称:graph,代码行数:26,代码来源:MediaSubProcessorFranchises.php

示例11: getAll

 public function getAll($isBean = false)
 {
     if ($isBean) {
         return R::findAll('guest', 'ORDER BY modify_date DESC');
     } else {
         return R::getAll('SELECT * FROM guest ORDER BY modify_date DESC');
     }
 }
开发者ID:justanding,项目名称:RedSlim,代码行数:8,代码来源:Model_Guest.php

示例12: getAllSubscriptions

 public function getAllSubscriptions($start)
 {
     $users = R::findAll('subscriptions', ' ORDER BY created DESC LIMIT :start, :limit ', array(':start' => $start, ':limit' => LIMIT));
     if (isset($users)) {
         return $users;
     }
     return false;
 }
开发者ID:florentsuc,项目名称:jobskee-open-source-job-board,代码行数:8,代码来源:Subscriptions.php

示例13: Get

 public function Get()
 {
     $users = R::findAll('user');
     $newUsers = array();
     foreach ($users as $user) {
         $newUsers[] = array("id" => $user->id, "name" => $user->name, "surname" => $user->surname, "email" => $user->email, "isAdmin" => $user->isAdmin === '1' ? true : false, "isTeacher" => $user->isTeacher, "group" => $user->group);
     }
     return $newUsers;
 }
开发者ID:dmitry-radyno,项目名称:one-lib,代码行数:9,代码来源:UserBridge.php

示例14: getUsernames

 public function getUsernames()
 {
     $users = R::findAll('user');
     $usernames = array();
     foreach ($users as $user) {
         array_push($usernames, $user->username);
     }
     return json_encode($usernames);
 }
开发者ID:nebulak,项目名称:PrivateCircle,代码行数:9,代码来源:UserTool.php

示例15: getApplications

 public function getApplications($start)
 {
     if (isset($this->_job_id)) {
         $apps = R::findAll('applications', " job_id=:job_id ORDER BY created DESC LIMIT :start, :limit ", array(':job_id' => $this->_job_id, ':start' => $start, ':limit' => LIMIT));
     } else {
         $apps = R::findAll('applications', " ORDER BY created DESC LIMIT :start, :limit ", array(':start' => $start, ':limit' => LIMIT));
     }
     return $apps;
 }
开发者ID:aescarcha,项目名称:jobskee-open-source-job-board,代码行数:9,代码来源:Applications.php


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