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


PHP Pagination::getLinks方法代码示例

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


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

示例1: plugins_update

/**
 * function plugins_update to get
 * plugins updates from the Database using pagination object.
 *
 * @author shubham meena mentored by Matthew Lagoe
 */
function plugins_update()
{
    if (Ticket_User::isMod(unserialize($_SESSION['ticket_user']))) {
        $pagination = new Pagination("SELECT * FROM plugins INNER JOIN updates ON plugins.Id=updates.PluginId", "lib", 5, "Plugincache");
        $pageResult['plug'] = Gui_Elements::make_table($pagination->getElements(), array("getId", "getPluginName", "getPluginInfo", "getUpdateInfo"), array("id", "plugin_name", "plugin_info", "update_info"));
        $pageResult['links'] = $pagination->getLinks(5);
        $pageResult['lastPage'] = $pagination->getLast();
        $pageResult['currentPage'] = $pagination->getCurrent();
        global $INGAME_WEBPATH;
        $pageResult['ingame_webpath'] = $INGAME_WEBPATH;
        // check if shard is online
        try {
            $dbs = new DBLayer("shard");
            $pageResult['shard'] = "online";
        } catch (PDOException $e) {
            $pageResult['shard'] = "offline";
        }
        return $pageResult;
    } else {
        // ERROR: No access!
        $_SESSION['error_code'] = "403";
        header("Cache-Control: max-age=1");
        header("Location: index.php?page=error");
        throw new SystemExit();
    }
}
开发者ID:cls1991,项目名称:ryzomcore,代码行数:32,代码来源:plugins_update.php

示例2: userlist

/**
* This function is beign used to load info that's needed for the userlist page.
* this function will return all users by using he pagination class, so that it can be used in the template. Only Mods and Admins can browse this page though.
* @author Daan Janssens, mentored by Matthew Lagoe
*/
function userlist()
{
    if (Ticket_User::isMod(unserialize($_SESSION['ticket_user']))) {
        $pagination = new Pagination(WebUsers::getAllUsersQuery(), "web", 10, "WebUsers");
        $pageResult['userlist'] = Gui_Elements::make_table($pagination->getElements(), array("getUId", "getUsername", "getEmail"), array("id", "username", "email"));
        $pageResult['links'] = $pagination->getLinks(5);
        $pageResult['lastPage'] = $pagination->getLast();
        $pageResult['currentPage'] = $pagination->getCurrent();
        $i = 0;
        foreach ($pageResult['userlist'] as $user) {
            $pageResult['userlist'][$i]['permission'] = Ticket_User::constr_ExternId($pageResult['userlist'][$i]['id'])->getPermission();
            $i++;
        }
        if (Ticket_User::isAdmin(unserialize($_SESSION['ticket_user']))) {
            $pageResult['isAdmin'] = "TRUE";
        }
        global $INGAME_WEBPATH;
        $pageResult['ingame_webpath'] = $INGAME_WEBPATH;
        global $BASE_WEBPATH;
        $pageResult['base_webpath'] = $BASE_WEBPATH;
        return $pageResult;
    } else {
        //ERROR: No access!
        $_SESSION['error_code'] = "403";
        header("Cache-Control: max-age=1");
        header("Location: index.php?page=error");
        throw new SystemExit();
    }
}
开发者ID:cls1991,项目名称:ryzomcore,代码行数:34,代码来源:userlist.php

示例3: syncing

/**
* This function is beign used to load info that's needed for the syncing page.
* this function is used for notifying admins that there are unsynced changes, a brief overview of the non syned changes will be shown. The entries are being loaded here
* so that they can be passed to the template itself. Only admins can browse this page, others will be redirected to an error page.
* @author Daan Janssens, mentored by Matthew Lagoe
*/
function syncing()
{
    if (Ticket_User::isAdmin(unserialize($_SESSION['ticket_user']))) {
        //return a paginated version of all unsynced changes.
        $pagination = new Pagination("SELECT * FROM ams_querycache", "lib", 5, "Querycache");
        $pageResult['liblist'] = Gui_Elements::make_table($pagination->getElements(), array("getSID", "getType"), array("id", "type"));
        $pageResult['links'] = $pagination->getLinks(5);
        $pageResult['lastPage'] = $pagination->getLast();
        $pageResult['currentPage'] = $pagination->getCurrent();
        global $INGAME_WEBPATH;
        $pageResult['ingame_webpath'] = $INGAME_WEBPATH;
        //check if shard is online
        try {
            $dbs = new DBLayer("shard");
            $pageResult['shard'] = "online";
        } catch (PDOException $e) {
            $pageResult['shard'] = "offline";
        }
        return $pageResult;
    } else {
        //ERROR: No access!
        $_SESSION['error_code'] = "403";
        header("Cache-Control: max-age=1");
        header("Location: index.php?page=error");
        throw new SystemExit();
    }
}
开发者ID:cls1991,项目名称:ryzomcore,代码行数:33,代码来源:syncing.php

示例4: traerEmprendimiento

function traerEmprendimiento()
{
    $data = Pagination::setLimits();
    $db = Conectar();
    $sql = "SELECT * FROM emprendimientos ORDER BY id_em DESC LIMIT " . $data["offset"] . "," . $data["limit"];
    $resultado = $db->query($sql);
    while ($data = $resultado->fetch_object()) {
        echo '
        <div class="row">
        <h1>' . $data->titulo . '</h1>
        <p>' . $data->detalle . '</p>
        <img src="../upload/' . $data->banner . '">
        ';
        $link = str_replace("watch?v=", "/embed/", $data->video);
        echo "\n        <p>\n        <a class='btn' href='galeria_emprendimiento_add.php?id=" . $data->id_em . "'>Galería</a>\n        <a class='btn' href='delete_emprendimiento.php?id=" . $data->id_em . "' onClick='return confirmar();'>Eliminar</a>\n        <a class='btn' href='edit_emprendimiento.php?id=" . $data->id_em . "'>Editar</a>\n        </p>\n        <hr>\n        </div>\n        ";
    }
    Pagination::getLinks($db, "emprendimientos");
    return $resultado;
}
开发者ID:EzequielDot175,项目名称:muysimple,代码行数:19,代码来源:emprendimiento.inc12-6-15.php

示例5: traerGaleriaTienda

function traerGaleriaTienda()
{
    $data = Pagination::setLimits();
    $db = Conectar();
    $sql = "SELECT * FROM galeria_tienda ORDER BY id_galt DESC";
    $resultado = $db->query($sql);
    while ($data = $resultado->fetch_object()) {
        echo "\n\t\t<div class='row'>\n\t     <img src='../upload/" . $data->imagen . "'>\n\t     <br>\n\t     <p>\n\t     <a class='btn' href='delete_galeria_tienda.php?id=" . $data->id_galt . "' onClick='return confirmar();'>Eliminar</a>\n\t     <a class='btn' href='edit_galeria_tienda.php?id=" . $data->id_galt . "'>Editar</a>\n\t     </p>\n\t     <hr>\n\t     </div>\n\t\t";
    }
    Pagination::getLinks($db, "galeria_tienda");
}
开发者ID:EzequielDot175,项目名称:muysimple,代码行数:11,代码来源:galerias.inc10-06-15.php

示例6: buildCommon

 /**
  * Because this class is extending from SharedFirstLevelController instead of Controller,
  * some modules are executed in first place, like: head, header or footer.
  *
  * See template for inclusion.
  */
 public function buildCommon()
 {
     $filtering_post = \Sifo\FilterPost::getInstance();
     // EXAMPLE OF HOW MODULES WORK. Add an advertising module:
     $this->addModule('ads_google_skyscrapper', 'SharedAdvertising');
     // TEST FORM SENT
     if ($filtering_post->isSent('testform')) {
         $form = \Sifo\Form::getInstance($filtering_post);
         if (!$form->validateElements('forms/example.form')) {
             // Basic validation: The data sent has an invalid form.
             $errors = $form->getErrors();
             \Sifo\FlashMessages::set($errors, \Sifo\FlashMessages::MSG_KO);
         } else {
             \Sifo\FlashMessages::set("Validated data. Mai inglish is parfect!", \Sifo\FlashMessages::MSG_OK);
         }
         $this->assign("form_fields", $form->getFields());
     }
     // INVITE  SENT
     if ($filtering_post->isSent('inviteform')) {
         if (($account_email = $filtering_post->getEmail('account_email')) && ($account_password = $filtering_post->getString('account_password'))) {
             if (strstr($account_email, '@yahoo.') || strstr($account_email, '@ymail.')) {
                 $account_provider = 'yahoo';
             } elseif (strstr($account_email, '@hotmail.') || strstr($account_email, '@live.') || strstr($account_email, '@msn.')) {
                 $account_provider = 'hotmail';
             } else {
                 $account_provider = 'gmail';
             }
         }
     }
     $smileys = array(':-)', ':-(', '¬¬', 'xD', ':_(', ':-0', '=)');
     // Set a system message
     \Sifo\FlashMessages::set('<strong>Installation correct!</strong> <small>(This is an example OK message.)</small>', \Sifo\FlashMessages::MSG_OK);
     //\Sifo\FlashMessages::set( 'Installation failed!', \Sifo\FlashMessages::MSG_KO );
     //\Sifo\FlashMessages::set( 'For your information...!', \Sifo\FlashMessages::MSG_INFO );
     //\Sifo\FlashMessages::set( 'Your account is incomplete', \Sifo\FlashMessages::MSG_WARNING );
     // Same message translated (include the message in messages_xx_XX.config.php first):
     // \Sifo\FlashMessages::set( $this->translate( 'Installation correct!' ) );
     // Same message translated with variable strings
     // \Sifo\FlashMessages::set( $this->translate( 'Installation correct! %1', $var1 ) );
     // Pass to the template a random smiley:
     $rand = array_rand($smileys, 1);
     $this->assign('mood', $smileys[$rand]);
     // Parameters in the application
     // var_dump( $this->getParams() );
     // SAMPLE: Get data from the database without a \SifoModel:
     // $this->assign( 'data', Db::getInstance()->getAll( 'SELECT * FROM accounts where id_account < ?', 20 ) );
     // With a \Sifo\Model
     // $user = new UserDataModel();
     // $user->getMyDataInsideMyClass();
     // Add another module (execute a controller and capture the output)
     // $this->addModule( 'name_used_in_tpl', 'Class' );
     // Add pagination
     // @See:  Quick reference for usage in pagination class.
     $pagination = new Pagination();
     $pagination->setNumTotalResults(2500);
     // Set total number of items
     $pagination->setCurrentPage(5);
     // Set current page.
     $pagination->setUrlBase('http://www.test.com/pag');
     // Set url base & template.
     $pagination->setTemplate('home/pagination.tpl');
     // Set pagination template.
     // Parameters optionals:
     // $pagination->setItemsPerPage(5);									// Set items per page. By default 10.
     // $pagination->setMaxPages(20);									// Set maxim number of pages to show.
     // $pagination->setTemplateParam( 'title', 'pagination test' );		// Set a parameter assigned to the pagination template.
     // $pagination->setSeparatorLink( '-' );							// Set the default separator for the page link.
     // $pagination->setDisplayItemsPerPage( array( 10, 25, 50, 100 ) );	// Set display items per page.
     // $pagination->setWindowPage( 'default', 20 );						// Set page range ( window ). [ 'default'=> 15,	'short'	=> 12,'very_short'	=> 10]
     // Get pagination data and pass data to the template.
     $result = $pagination->getLinks();
     $this->assign('pagination_data', $result);
     // Note: To show the paginator, you should use the following smarty function in your template: {pagination data=$result}
     $this->setLayout('home/index.tpl');
 }
开发者ID:ninodafonte,项目名称:SIFO,代码行数:81,代码来源:index.ctrl.php

示例7: list_users

function list_users($page = 1, $keyword = '')
{
    //Return users list, for admin use
    $output = '';
    $count = 10;
    $users = $keyword != '' ? array_filter(load_all_array('nsh_users'), array(new filter($keyword), 'filter_keyword')) : load_all_array('nsh_users');
    usort($users, 'sort_name_ascend');
    $users_count = count($users);
    $pagination = new Pagination($users, $page, $count, 20);
    $pagination->setShowFirstAndLast(true);
    $pagination->setMainSeperator('');
    $users = $pagination->getResults();
    $output .= '<a class="button right" href="/user/create/">Create user</a>';
    $output .= '<span class="count">' . $users_count . ' user' . ($users_count > 1 ? 's' : '') . '.</span>';
    $output .= '<div class="paging">' . $pagination->getLinks() . '</div>';
    $output .= '<table class="admin">';
    $output .= '<tr><th>ID</th><th>User ID</th><th>Username</th><th>DOB</th><th colspan="2">Operations</th></tr>';
    for ($i = 0; $i < $count; ++$i) {
        if (isset($users[$i])) {
            $class = 'class="' . table_row_class($i) . '"';
            $output .= '<tr ' . $class . '>';
            $output .= '<td>' . (($page - 1) * $count + ($i + 1)) . '</td>';
            $output .= '<td>' . $users[$i]['uid'] . '</td>';
            $output .= '<td><a style="color: black" target="_blank" href="/?fullname=' . str_replace(' ', '+', $users[$i]['name']) . '&dob=' . $users[$i]['dob'] . '">' . $users[$i]['name'] . '</a></td>';
            $output .= '<td>' . $users[$i]['dob'] . '</td>';
            $output .= '<td><form method="POST" action="/user/edit/"><input type="hidden" name="uid" value="' . $users[$i]['uid'] . '" /><input type="hidden" name="old_name" value="' . $users[$i]['name'] . '" /><input type="hidden" name="old_dob" value="' . $users[$i]['dob'] . '" /><input name="user_edit" type="submit" value="Edit"/></form></td>';
            $output .= '<td><form method="POST" action="/user/delete/"><input type="hidden" name="uid" value="' . $users[$i]['uid'] . '" /><input name="user_delete" type="submit" value="Delete"/></form></td>';
            $output .= '</tr>';
        }
    }
    $output .= '</table>';
    $output .= '<div class="paging">' . $pagination->getLinks() . '</div>';
    $output .= '<script>
				function turnPage(page) {
					$("#admin_user").load("/triggers/admin_user.php",{page:page,keyword:"' . $keyword . '"});
				}
				</script>';
    return $output;
}
开发者ID:spiritwild,项目名称:biorhythm,代码行数:39,代码来源:functions.inc.php


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