PClib demo site

  • Basic usage of the grid
    Data for the grid are loaded using sql-query, layout is done with template "basicgrid.tpl". If you don't have template prepared yet, just call $grid = new grid(); and grid will be shown with default template.
    We are using shortcuts and in our template, for convenience, which writes all grid columns at once in simple table layout.
  • E-shop product catalog
    Just another example of datagrid layout. No changes in php code was necessary, only template has been modified.
  • Taskman datagrid
    It's time for more complex grid template. As of php - there is no change compared with basic grid, except using another query and template.
    See how fields can be formatted and configured in <?elements ?> section of the template.
    In this example: Date and number (price) formating, customized pager, binding of lookup fields and so on.
  • Grid with sorting and searching
    Form and grid can works together very nicely. Here, searchform values are used for setting grid->filter property. We enable sorting by adding "sort" attribute to the columns in grid template.
  • Array based grid
    Now, you can read your data from plain php array, instead of database. For that, use method $grid->setarray($dataarray). As you can see, sorting and filtering is possible too.
  • Summarization grid
    With this feature you can place summarization rows into your grid.
    We use two summarizations in the example: A row with vendor name and summary for each productLine. You can use all power of SQL agregate functions here. In code we add only two lines with $grid->summary function. It is connected with corresponding block in template.
  • Gridform
    Class gridform allows using form elements in the grid.
    You can insert or update grid with functions gridform->insert(), gridform->update(). Update is done on primary key, which must be defined in the grid.
  • Bootstrap grid
    Basic usage of the grid and form with twitter bootstrap framework.
  • Pager grid
    Example of tweaking of the grid pager component.
  • Mobile grid
    Grid with ajax-loading of next page.
  • Example of simple form
    Whole thing is really simple: Create form object from some template and populate $form->values with default data. Three lines of php code. Can it be easier?
    Still you have full control of form layout, indeed! Moreover we use shortcut for writing all form fields at once.
    Look at the <?elements ?> section of template, how input, select, textarea etc. fields are build and configured.
  • Javascript validation
    Just put word 'jsvalid' into form template header. No changes in php, considered example above.
    NOTE: You must include script pclib/assets/pclib.js in your html!
  • Simple CRUD: Advanced form usage
    Let's see on most common task in web applications: form management.
    Class form solves a lot of problems and implementation details for you.
    Demo presents editing form, submitting, using default values, form validation, inserting, updating and deleting in database and connection with the grid.
  • AJAX form
    The idea behind this is following:
    1. Invoke ajax request on background.
    2. In your server code create form object. It receives data from form in the browser.
    3. Make any change in your form and call "print $form->ajaxsync();".
    4. Client form is synchronized with your changes, without page reload!
    Note that it uses script assets/pclib.js, which must be included.
  • HTML5 form
    To enable HTML5 support, just type "html5" in form template. Try submit form and see html5 validation!
    Note: HTML5 is currently not fully supported by all browsers, or support can be buggy. Some features may not work in your browser.
  • Orderform
    Some more features of form class.
    Using <button> tag, OPTGROUPs in SELECT, regexp validation and opening popup window.

  • Layout
    Using layout template. Read comments in source code!
  • Authententization and authorization
    $auth->login($user, $password);
    if (! $auth->hasright('mysite/products/edit')) exit();
    It's that simple!
    You can assign any number of roles to the any user. You can delegate all permissions to the, say, "products" module, with wildcard: 'mysite/products/*'.
    - Works fine with thousands users
    - Auth data are stored in database
    - Don't forget check our user management console ATERM! Using console.
  • Class logger
    Log any application event (such as access log or security issue) into database.
    It was designed to be fast and space saving. You can log any defined set of events.
    For more info see source code documentation of this example.
  • Database layer
    Pclib database layer provides (for example):
    - query shortcuts: $row = $db->select('TABLENAME','ID=1').
    - query parameters: $res = $db->query($sql, $params);
    - SQL injection protection
    - Logging of executed SQL queries
    - etc.
    Look into the source code of our example.
  • Class tree
    Pclib treeview will generate tree from text file or from database table.
    Tree is generated as UL-list and can be styled as collapsable tree.
  • Multilanguage support
    Example of pclib multilanguage support. Class Translator helps you with translation of your site to other languages.

Elapsed time: 304.24 ms