當前位置: 首頁>>代碼示例>>PHP>>正文


PHP DataTables\Editor類代碼示例

本文整理匯總了PHP中DataTables\Editor的典型用法代碼示例。如果您正苦於以下問題:PHP Editor類的具體用法?PHP Editor怎麽用?PHP Editor使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Editor類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: postData

 /**
  * [postData]
  * @return [type] [description]
  */
 public function postData()
 {
     $Model = $this->modelName;
     // Build our Editor instance and process the data coming from _POST
     global $db;
     $data = Editor::inst($db, 'reminders')->fields(Field::inst('reminders.id'), Field::inst('reminders.project_id'), Field::inst('projects.name'), Field::inst('reminders.user_id'), Field::inst('users.username'), Field::inst('reminders.description'))->leftJoin('users', 'users.id', '=', 'reminders.user_id')->leftJoin('projects', 'projects.id', '=', 'reminders.project_id')->process($_POST)->data();
     //->json;
     $data['projects'] = $db->selectDistinct('projects', 'id as value, name as label')->fetchAll();
     $data['users'] = $db->selectDistinct('users', 'id as value, username as label')->fetchAll();
     //echo json_encode($ret);
     return Response::json($data);
 }
開發者ID:strikles,項目名稱:php,代碼行數:16,代碼來源:AdminReminderController.php

示例2: json_encode

<?php

// DataTables PHP library
include "../../php/DataTables.php";
// Alias Editor classes so they are easy to use
use DataTables\Editor, DataTables\Editor\Field, DataTables\Editor\Format, DataTables\Editor\Join, DataTables\Editor\Validate;
//--- Outsource version of Editor ---//
if (false) {
    //--- Outsource user with his/her assigned group ---//
    $data = Editor::inst($db, 'TestRequestActualSchedule', 'TestRequestNo')->field(Field::inst('TestRequestActualSchedule.TestRequestNo')->set(false), Field::inst('TestRequestMain.POnumber')->set(false), Field::inst('TestRequestMain.ProjectName')->set(false), Field::inst('TestEnvironment.Name')->set(false), Field::inst('TestRequestActualSchedule.ActualDate'), Field::inst('TestRequestActualSchedule.ManHrsNM')->validator('Validate::numeric'), Field::inst('TestRequestActualSchedule.ManHrsOT')->validator('Validate::numeric'), Field::inst('TestRequestActualSchedule.ManHrsOTSunPH')->validator('Validate::numeric'), Field::inst('TestRequestPlannedSchedule.ScheduledManHrsNM')->set(false), Field::inst('TestRequestPlannedSchedule.ScheduledManHrsOT')->set(false), Field::inst('TestRequestPlannedSchedule.ScheduledManHrsOTSunPH')->set(false), Field::inst('TestRequestMain.Status'), Field::inst('StatusMirror.String')->set(false), Field::inst('TestRequestActualSchedule.RazerApproval')->set(false), Field::inst('RazerConfirmationMirror.String')->set(false), Field::inst('TestRequestAdv.RemarksRazer')->set(false), Field::inst('TestRequestMain.AssignedGroupID')->set(false), Field::inst('AssignedGroup.Name')->set(false), Field::inst('TestRequestMain.SWQAEngineerID')->set(false))->leftJoin('TestRequestPlannedSchedule', 'TestRequestPlannedSchedule.TestRequestNo', '=', 'TestRequestActualSchedule.TestRequestNo')->leftJoin('TestRequestAdv', 'TestRequestActualSchedule.TestRequestNo', '=', 'TestRequestAdv.TestRequestNo')->leftJoin('TestRequestMain', 'TestRequestActualSchedule.TestRequestNo', '=', 'TestRequestMain.TestRequestNo')->leftJoin('RazerConfirmationMirror', 'TestRequestActualSchedule.RazerApproval', '=', 'RazerConfirmationMirror.ID')->leftJoin('StatusMirror', 'TestRequestMain.Status', '=', 'StatusMirror.ID')->leftJoin('AssignedGroup', 'TestRequestMain.AssignedGroupID', '=', 'AssignedGroup.ID')->leftJoin('TestEnvironment', 'TestEnvironment.ID', '=', 'TestRequestAdv.TestEnvironmentID')->process($_POST)->data();
    //--- Initialization of dropdown: Outsource  ---//
    if (!isset($_POST['action'])) {
        $data['StatusMirror'] = $db->selectDistinct('StatusMirror', 'ID as value, String as label')->fetchAll();
    }
} else {
    $data = Editor::inst($db, 'TestRequestActualSchedule', 'TestRequestNo')->field(Field::inst('TestRequestActualSchedule.TestRequestNo')->set(false), Field::inst('TestRequestMain.POnumber')->set(false), Field::inst('TestRequestMain.ProjectName')->set(false), Field::inst('TestEnvironment.Name')->set(false), Field::inst('TestRequestActualSchedule.ActualDate'), Field::inst('TestRequestActualSchedule.ManHrsNM')->validator('Validate::numeric'), Field::inst('TestRequestActualSchedule.ManHrsOT')->validator('Validate::numeric'), Field::inst('TestRequestActualSchedule.ManHrsOTSunPH')->validator('Validate::numeric'), Field::inst('TestRequestPlannedSchedule.ScheduledManHrsNM')->set(false), Field::inst('TestRequestPlannedSchedule.ScheduledManHrsOT')->set(false), Field::inst('TestRequestPlannedSchedule.ScheduledManHrsOTSunPH')->set(false), Field::inst('TestRequestMain.Status'), Field::inst('StatusMirror.String')->set(false), Field::inst('TestRequestActualSchedule.RazerApproval'), Field::inst('RazerConfirmationMirror.String')->set(false), Field::inst('TestRequestAdv.RemarksRazer'), Field::inst('TestRequestMain.AssignedGroupID')->set(false), Field::inst('AssignedGroup.Name')->set(false), Field::inst('TestRequestMain.SWQAEngineerID')->set(false))->leftJoin('TestRequestPlannedSchedule', 'TestRequestPlannedSchedule.TestRequestNo', '=', 'TestRequestActualSchedule.TestRequestNo')->leftJoin('TestRequestAdv', 'TestRequestActualSchedule.TestRequestNo', '=', 'TestRequestAdv.TestRequestNo')->leftJoin('TestRequestMain', 'TestRequestActualSchedule.TestRequestNo', '=', 'TestRequestMain.TestRequestNo')->leftJoin('RazerConfirmationMirror', 'TestRequestActualSchedule.RazerApproval', '=', 'RazerConfirmationMirror.ID')->leftJoin('StatusMirror', 'TestRequestMain.Status', '=', 'StatusMirror.ID')->leftJoin('AssignedGroup', 'TestRequestMain.AssignedGroupID', '=', 'AssignedGroup.ID')->leftJoin('TestEnvironment', 'TestEnvironment.ID', '=', 'TestRequestAdv.TestEnvironmentID')->process($_POST)->data();
    //--- Initialization of dropdown: Internal staff ---//
    if (!isset($_POST['action'])) {
        $data['RazerConfirmationMirror'] = $db->selectDistinct('RazerConfirmationMirror', 'ID as value, String as label')->fetchAll();
        $data['StatusMirror'] = $db->selectDistinct('StatusMirror', 'ID as value, String as label')->fetchAll();
    }
}
// Send it back to the client
echo json_encode($data);
開發者ID:juanoh,項目名稱:git-github.com-grupoz-dise-o,代碼行數:24,代碼來源:test.php

示例3: json_encode

<?php

/*
 * Example PHP implementation used for the index.html example
 */
// DataTables PHP library
include "../../php/DataTables.php";
// Alias Editor classes so they are easy to use
use DataTables\Editor, DataTables\Editor\Field, DataTables\Editor\Format, DataTables\Editor\Mjoin, DataTables\Editor\Upload, DataTables\Editor\Validate;
// Build our Editor instance and process the data coming from _POST
$out = Editor::inst($db, 'datatables_demo')->fields(Field::inst('id')->set(false), Field::inst('first_name')->validator('Validate::notEmpty'), Field::inst('last_name')->validator('Validate::notEmpty'), Field::inst('position'), Field::inst('email'), Field::inst('office'), Field::inst('extn')->validator('Validate::numeric'), Field::inst('age')->validator('Validate::numeric'), Field::inst('salary')->validator('Validate::numeric'), Field::inst('start_date')->validator('Validate::dateFormat', array("format" => Format::DATE_ISO_8601, "message" => "Please enter a date in the format yyyy-mm-dd"))->getFormatter('Format::date_sql_to_format', Format::DATE_ISO_8601)->setFormatter('Format::date_format_to_sql', Format::DATE_ISO_8601))->process($_POST)->data();
// On 'read' remove the DT_RowId property so we can see fully how the `idSrc`
// option works on the client-side.
if (Editor::action($_POST) === Editor::ACTION_READ) {
    for ($i = 0, $ien = count($out['data']); $i < $ien; $i++) {
        unset($out['data'][$i]['DT_RowId']);
    }
}
// Send it back to the client
echo json_encode($out);
開發者ID:FaTTeST,項目名稱:billenv,代碼行數:20,代碼來源:jsonId.php

示例4: array

<?php

/*
 * Example PHP implementation used for the index.html example
 */
// DataTables PHP library
include "../../php/DataTables.php";
// Alias Editor classes so they are easy to use
use DataTables\Editor, DataTables\Editor\Field, DataTables\Editor\Format, DataTables\Editor\Join, DataTables\Editor\Validate;
// Build our Editor instance and process the data coming from _POST
Editor::inst($db, 'datatables_demo')->fields(Field::inst('first_name')->validator('Validate::notEmpty'), Field::inst('last_name')->validator('Validate::notEmpty'), Field::inst('position'), Field::inst('email'), Field::inst('office'), Field::inst('extn')->validator('Validate::numeric'), Field::inst('age')->validator('Validate::numeric'), Field::inst('salary')->validator('Validate::numeric'), Field::inst('start_date')->validator('Validate::dateFormat', array("format" => Format::DATE_ISO_8601, "message" => "Please enter a date in the format yyyy-mm-dd"))->getFormatter('Format::date_sql_to_format', Format::DATE_ISO_8601)->setFormatter('Format::date_format_to_sql', Format::DATE_ISO_8601))->process($_POST)->json();
開發者ID:Symfomany,項目名稱:papsymfony,代碼行數:11,代碼來源:staff.php

示例5: _prep

 /**
  * Prepare the instance to be run.
  *
  * @param  Editor $editor Editor instance
  * @private
  */
 private function _prep($editor)
 {
     $links = $this->_links;
     // Were links used to configure this instance - if so, we need to
     // back them onto the join array
     if ($this->_join['parent'] === null && count($links)) {
         $editorTable = $editor->table();
         $editorTable = $editorTable[0];
         $joinTable = $this->table();
         if ($this->_aliasParentTable) {
             $editorTable = $this->_aliasParentTable;
         }
         if (count($links) === 2) {
             // No link table
             $f1 = explode('.', $links[0]);
             $f2 = explode('.', $links[1]);
             $this->_join['parent'] = $f1[1];
             $this->_join['child'] = $f2[1];
         } else {
             // Link table
             $f1 = explode('.', $links[0]);
             $f2 = explode('.', $links[1]);
             $f3 = explode('.', $links[2]);
             $f4 = explode('.', $links[3]);
             // Discover the name of the link table
             if ($f1[0] !== $editorTable && $f1[0] !== $joinTable) {
                 $this->_join['table'] = $f1[0];
             } else {
                 if ($f2[0] !== $editorTable && $f2[0] !== $joinTable) {
                     $this->_join['table'] = $f2[0];
                 } else {
                     if ($f3[0] !== $editorTable && $f3[0] !== $joinTable) {
                         $this->_join['table'] = $f3[0];
                     } else {
                         $this->_join['table'] = $f2[0];
                     }
                 }
             }
             $this->_join['parent'] = array($f1[1], $f2[1]);
             $this->_join['child'] = array($f3[1], $f4[1]);
         }
     }
 }
開發者ID:FaTTeST,項目名稱:billenv,代碼行數:49,代碼來源:Join.php

示例6: isset

<?php

/*
 * Example PHP implementation used for date examples
 */
// DataTables PHP library
include "../../php/DataTables.php";
// Alias Editor classes so they are easy to use
use DataTables\Editor, DataTables\Editor\Field, DataTables\Editor\Format, DataTables\Editor\Join, DataTables\Editor\Upload, DataTables\Editor\Validate;
// Allow a number of different formats to be submitted for the various demos
$format = isset($_GET['format']) ? $_GET['format'] : '';
if ($format === 'custom') {
    $update = 'n/j/Y';
    $registered = 'l j F Y';
} else {
    $update = Format::DATE_ISO_8601;
    $registered = Format::DATE_ISO_8601;
}
// Build our Editor instance and process the data coming from _POST
Editor::inst($db, 'users')->fields(Field::inst('first_name'), Field::inst('last_name'), Field::inst('updated_date')->validator('Validate::dateFormat', array('empty' => false, 'format' => $update))->getFormatter('Format::date_sql_to_format', $update)->setFormatter('Format::date_format_to_sql', $update), Field::inst('registered_date')->validator('Validate::dateFormat', $registered)->getFormatter('Format::date_sql_to_format', $registered)->setFormatter('Format::date_format_to_sql', $registered))->process($_POST)->json();
開發者ID:kienbk1910,項目名稱:RDCAdmin,代碼行數:20,代碼來源:dates.php

示例7: array

<?php

/*
 * Example PHP implementation used for the index.html example
 */
// DataTables PHP library
include "../../php/DataTables.php";
// Alias Editor classes so they are easy to use
use DataTables\Editor, DataTables\Editor\Field, DataTables\Editor\Format, DataTables\Editor\Join, DataTables\Editor\Validate;
// Build our Editor instance and process the data coming from _POST
Editor::inst($db, 'users')->fields(Field::inst('first_name'), Field::inst('last_name'), Field::inst('updated_date')->validator('Validate::dateFormat', array("empty" => false, "format" => Format::DATE_ISO_8601, "message" => "Please enter a date in the format yyyy-mm-dd"))->getFormatter('Format::date_sql_to_format', Format::DATE_ISO_8601)->setFormatter('Format::date_format_to_sql', Format::DATE_ISO_8601), Field::inst('registered_date')->validator('Validate::dateFormat', 'D, d M y')->getFormatter('Format::date_sql_to_format', 'D, d M y')->setFormatter('Format::date_format_to_sql', 'D, d M y'))->process($_POST)->json();
開發者ID:Symfomany,項目名稱:papsymfony,代碼行數:11,代碼來源:dates.php

示例8:

<?php

// DataTables PHP library
include "../../php/DataTables.php";
// Alias Editor classes so they are easy to use
use DataTables\Editor, DataTables\Editor\Field, DataTables\Editor\Format, DataTables\Editor\Mjoin, DataTables\Editor\Upload, DataTables\Editor\Validate;
/*
 * Example PHP implementation used for the join.html example
 */
Editor::inst($db, 'users')->field(Field::inst('users.first_name'), Field::inst('users.last_name'), Field::inst('users.site')->options('sites', 'id', 'name'), Field::inst('sites.name'))->leftJoin('sites', 'sites.id', '=', 'users.site')->join(Mjoin::inst('access')->link('users.id', 'user_access.user_id')->link('access.id', 'user_access.access_id')->fields(Field::inst('id')->validator('Validate::required')->options('access', 'id', 'name'), Field::inst('name')))->process($_POST)->json();
開發者ID:kienbk1910,項目名稱:RDCAdmin,代碼行數:10,代碼來源:joinArray.php

示例9:

<?php

require_once Yii::app()->basePath . '/extensions/editor_datatables/php/DataTables.php';
//Alias Editor classes so they are easy to use
use DataTables\Editor, DataTables\Editor\Field, DataTables\Editor\Format, DataTables\Editor\Join, DataTables\Editor\Upload, DataTables\Editor\Validate;
// Build our Editor instance and process the data coming from _POST
Editor::inst($db, 'trade_types', 'id')->fields(Field::inst('id'), Field::inst('trade_type'))->process($_POST)->json();
開發者ID:artmart,項目名稱:verare,代碼行數:7,代碼來源:tradetypes.php

示例10: array

<?php

// DataTables PHP library
include "../../php/DataTables.php";
// Alias Editor classes so they are easy to use
use DataTables\Editor, DataTables\Editor\Field, DataTables\Editor\Format, DataTables\Editor\Mjoin, DataTables\Editor\Upload, DataTables\Editor\Validate;
/*
 * Example PHP implementation used for the joinSelf.html example - the basic idea
 * here is that the join performed is simply to get extra information about the
 * 'manager' (in this case, the name of the manager). To alter the manager for
 * a user, you would change the 'manager' value in the 'users' table, so the
 * information from the join is read-only.
 */
Editor::inst($db, 'users')->field(Field::inst('users.first_name'), Field::inst('users.last_name'), Field::inst('users.manager')->options('users', 'id', array('first_name', 'last_name')), Field::inst('manager.first_name'), Field::inst('manager.last_name'))->leftJoin('users as manager', 'users.manager', '=', 'manager.id')->process($_POST)->json();
開發者ID:FaTTeST,項目名稱:billenv,代碼行數:14,代碼來源:joinSelf.php

示例11:

<?php

/*
 * Example PHP implementation used for the checkbox.html example
 */
// DataTables PHP library
include "../../php/DataTables.php";
// Alias Editor classes so they are easy to use
use DataTables\Editor, DataTables\Editor\Field, DataTables\Editor\Format, DataTables\Editor\Join, DataTables\Editor\Upload, DataTables\Editor\Validate;
// Build our Editor instance and process the data coming from _POST
Editor::inst($db, 'users')->fields(Field::inst('first_name'), Field::inst('last_name'), Field::inst('phone'), Field::inst('city'), Field::inst('zip'), Field::inst('active')->setFormatter(function ($val, $data, $opts) {
    return !$val ? 0 : 1;
}))->process($_POST)->json();
開發者ID:kienbk1910,項目名稱:RDCAdmin,代碼行數:13,代碼來源:checkbox.php

示例12:

<?php

/*
 * Editor server script for DB table EMPLOYEE
 * Created by http://editor.datatables.net/generator
 */
// DataTables PHP library and database connection
include "lib/DataTables.php";
// Alias Editor classes so they are easy to use
use DataTables\Editor, DataTables\Editor\Field, DataTables\Editor\Format, DataTables\Editor\Mjoin, DataTables\Editor\Upload, DataTables\Editor\Validate;
// Build our Editor instance and process the data coming from _POST
Editor::inst($db, 'RESTAURANT', 'Name_Restaurant')->fields(Field::inst('Name_Restaurant'), Field::inst('Menu_Restaurant'), Field::inst('Price_Restaurant'), Field::inst('Address_Restaurant'), Field::inst('Phone_Restaurant'))->process($_POST)->json();
開發者ID:veltamahesa,項目名稱:GujekWebApp,代碼行數:12,代碼來源:table.RESTAURANT.php

示例13:

<?php

/*
 * Editor server script for DB table EMPLOYEE
 * Created by http://editor.datatables.net/generator
 */
// DataTables PHP library and database connection
include "lib/DataTables.php";
// Alias Editor classes so they are easy to use
use DataTables\Editor, DataTables\Editor\Field, DataTables\Editor\Format, DataTables\Editor\Mjoin, DataTables\Editor\Upload, DataTables\Editor\Validate;
// Build our Editor instance and process the data coming from _POST
Editor::inst($db, 'TR_TRANSPORT', 'T_Trans_No')->fields(Field::inst('T_Trans_No'), Field::inst('T_Destination'))->process($_POST)->json();
開發者ID:veltamahesa,項目名稱:GujekWebApp,代碼行數:12,代碼來源:table.TRANS.php

示例14: validate

 /**
  * Check the validity of the field based on the data submitted. Note that
  * this validation is performed on the wire data - i.e. that which is
  * submitted, before any setFormatter is run
  *
  * Called by the Editor / Join class instances - not expected for general
  * consumption - internal.
  *  @param array $data Data submitted from the client-side 
  *  @param Editor $editor Editor instance
  *  @return boolean Indicate if a field is valid or not.
  *  @internal
  */
 public function validate($data, $editor)
 {
     // Three cases for the validator - closure, string or null
     if (!$this->_validator) {
         return true;
     }
     $val = $this->_readProp($this->name(), $data);
     if (is_string($this->_validator)) {
         $processData = $editor->inData();
         $instances = array('action' => $processData['action'], 'id' => isset($processData['id']) ? str_replace($editor->idPrefix(), '', $processData['id']) : null, 'field' => $this, 'editor' => $editor, 'db' => $editor->db());
         // Don't require the Editor namespace if DataTables validator is given as a string
         if (strpos($this->_validator, "Validate::") === 0) {
             return call_user_func("\\DataTables\\Editor\\" . $this->_validator, $val, $data, $this->_validatorOpts, $instances);
         }
         return call_user_func($this->_validator, $val, $data, $this->_validatorOpts, $instances);
     }
     $validator = $this->_validator;
     return $validator($val, $data, $this);
 }
開發者ID:Symfomany,項目名稱:papsymfony,代碼行數:31,代碼來源:Field.php

示例15:

<?php

/*
 * Editor server script for DB table EMPLOYEE
 * Created by http://editor.datatables.net/generator
 */
// DataTables PHP library and database connection
include "lib/DataTables.php";
// Alias Editor classes so they are easy to use
use DataTables\Editor, DataTables\Editor\Field, DataTables\Editor\Format, DataTables\Editor\Mjoin, DataTables\Editor\Upload, DataTables\Editor\Validate;
// Build our Editor instance and process the data coming from _POST
Editor::inst($db, 'SOFTWARE_ENG', 'ID_SWeng')->fields(Field::inst('ID_SWeng'))->process($_POST)->json();
開發者ID:veltamahesa,項目名稱:GujekWebApp,代碼行數:12,代碼來源:table.SOFTENG.php


注:本文中的DataTables\Editor類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。