Exemplo n.º 1
0
 /**
  * [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);
 }
Exemplo n.º 2
0
<?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;
$user = Users::model()->findByPk(Yii::app()->user->id);
$client_id = $user->client_id;
function userupdate()
{
    $user_data = Users::model()->findByPk(Yii::app()->user->id);
    $step_completed = $user_data->step_completed;
    if ($user_data->user_role == 2 && $step_completed < 3) {
        $user_data->step_completed = 3;
        $user_data->save();
        //$this->redirect(Yii::app()->baseUrl.'/site/admin');
        $baseUrl = Yii::app()->baseUrl;
        //Yii::app()->request->redirect($baseUrl.'/site/admin');
        //echo "<script>window.location.href ='".$baseUrl."/site/admin';</script>";
        //return false;
    }
    //else{ $this->render('overview', ['user_data' => $user_data]); }
}
//Build our Editor instance and process the data coming from _POST
$time = date("fYhis");
// $extension = end(explode('.', Upload::DB_FILE_NAME));
Editor::inst($db, 'benchmark_components', 'id', $time, $client_id)->fields(Field::inst('benchmark_components.benchmark_id')->validator('Validate::notEmpty'), Field::inst('benchmark_components.instrument_id')->validator('Validate::notEmpty'), Field::inst('benchmark_components.is_instrument_or_portfolio'), Field::inst('benchmark_components.weight'), Field::inst('benchmarks.benchmark_name'), Field::inst('instruments.instrument'))->on('postCreate', function () {
    userupdate();
})->leftJoin('benchmarks', 'benchmarks.id', '=', 'benchmark_components.benchmark_id')->leftJoin('instruments', 'instruments.id', '=', 'benchmark_components.instrument_id')->where('benchmarks.client_id', $client_id)->process($_POST)->json();
Exemplo n.º 3
0
 /**
  * Clean the database
  * @param  Editor $editor Calling Editor instance
  * @param  Field $field   Host field
  * @internal
  */
 public function dbCleanExec($editor, $field)
 {
     // Database and file system clean up BEFORE adding the new file to
     // the db, otherwise it will be removed immediately
     $tables = $editor->table();
     $this->_dbClean($editor->db(), $tables[0], $field->dbField());
 }
Exemplo n.º 4
0
<?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);
Exemplo n.º 5
0
<?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();
Exemplo n.º 6
0
<?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();
Exemplo n.º 7
0
<?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();
Exemplo n.º 8
0
<?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();
Exemplo n.º 9
0
<?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();
Exemplo n.º 10
0
<?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();
Exemplo n.º 11
0
<?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();
Exemplo n.º 12
0
<?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();
Exemplo n.º 13
0
<?php

/*
 * Example PHP implementation used for date time 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\Mjoin, 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('updated_date')->validator('Validate::dateFormat', array('empty' => false, 'format' => 'm-d-Y g:i A'))->getFormatter('Format::datetime', array('from' => 'Y-m-d H:i:s', 'to' => 'm-d-Y g:i A'))->setFormatter('Format::datetime', array('from' => 'm-d-Y g:i A', 'to' => 'Y-m-d H:i:s')), Field::inst('registered_date')->validator('Validate::dateFormat', array('format' => 'j M Y H:i'))->getFormatter('Format::datetime', array('from' => 'Y-m-d H:i:s', 'to' => 'j M Y H:i'))->setFormatter('Format::datetime', array('from' => 'j M Y H:i', 'to' => 'Y-m-d H:i:s')))->process($_POST)->json();
Exemplo n.º 14
0
<?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
Editor::inst($db, 'audiobooks')->fields(Field::inst('title')->validator('Validate::notEmpty'), Field::inst('author')->validator('Validate::notEmpty'), Field::inst('duration')->validator('Validate::notEmpty'), Field::inst('readingOrder')->validator('Validate::numeric'))->on('preCreate', function ($editor, $values) {
    // On create update all the other records to make room for our new one
    $editor->db()->query('update', 'audiobooks')->set('readingOrder', 'readingOrder+1', false)->where('readingOrder', $values['readingOrder'], '>=')->exec();
})->on('postRemove', function ($editor, $id, $values) {
    // On remove, the sequence needs to be updated to decrement all rows
    // beyond the deleted row
    $editor->db()->query('update', 'audiobooks')->set('readingOrder', 'readingOrder-1', false)->where('readingOrder', $values['readingOrder'], '>')->exec();
})->process($_POST)->json();
Exemplo n.º 15
0
<?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, 'instruments', 'instruments.id')->fields(Field::inst('instrument_types.instrument_type'), Field::inst('instrument_groups.group_name'), Field::inst('instruments.id as id'), Field::inst('instruments.instrument as instrument'), Field::inst('instruments.instrument_type_id'), Field::inst('instruments.is_current'), Field::inst('instruments.created_at'), Field::inst('instruments.isin'), Field::inst('instruments.instrument_group_id'), Field::inst('instruments.currency'))->leftJoin('instrument_types', 'instrument_types.id', '=', 'instruments.instrument_type_id')->leftJoin('instrument_groups', 'instrument_groups.id', '=', 'instruments.instrument_group_id')->process($_POST)->json();
Exemplo n.º 16
0
<?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();
Exemplo n.º 17
0
<?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.phone'), Field::inst('users.site')->options('sites', 'id', 'name')->validator('Validate::dbValues'), Field::inst('sites.name'))->leftJoin('sites', 'sites.id', '=', 'users.site')->process($_POST)->json();
Exemplo n.º 18
0
<?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);
Exemplo n.º 19
0
<?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
Editor::inst($db, 'users')->fields(Field::inst('users.first_name'), Field::inst('users.last_name'), Field::inst('users.phone'), Field::inst('users.site')->options('sites', 'id', 'name'), Field::inst('sites.name'))->join(Mjoin::inst('files')->link('users.id', 'users_files.user_id')->link('files.id', 'users_files.file_id')->fields(Field::inst('id')->upload(Upload::inst($_SERVER['DOCUMENT_ROOT'] . '/upload/__ID__.__EXTN__')->db('files', 'id', array('filename' => Upload::DB_FILE_NAME, 'filesize' => Upload::DB_FILE_SIZE, 'web_path' => Upload::DB_WEB_PATH, 'system_path' => Upload::DB_SYSTEM_PATH))->validator(function ($file) {
    return $file['size'] >= 50000 ? "Files must be smaller than 50K" : null;
})->allowedExtensions(['png', 'jpg'], "Please upload an image"))))->leftJoin('sites', 'sites.id', '=', 'users.site')->process($_POST)->json();
Exemplo n.º 20
0
<?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;
use DataTables\Editor\Field;
// 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')->set(false)->getFormatter('Format::date_sql_to_format', 'D, jS F Y'))->process($_POST)->json();
Exemplo n.º 21
0
<?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, 'CUSTOMER', 'ID_Customer')->fields(Field::inst('ID_Customer'), Field::inst('Name_Customer'), Field::inst('Email_Customer'), Field::inst('Uname_Customer'), Field::inst('PassW_Customer'), Field::inst('Phone_Customer'))->process($_POST)->json();
Exemplo n.º 22
0
<?php

/*
 * Example PHP implementation used for the formOnlyData.html example
 */
// DataTables PHP library
include "../../php/DataTables.php";
// Alias Editor classes so they are easy to use
use DataTables\Editor;
use DataTables\Editor\Field;
// Build our Editor instance and process the data coming from _POST
Editor::inst($db, 'users')->fields(Field::inst('title'), Field::inst('first_name'), Field::inst('last_name'), Field::inst('phone'), Field::inst('city'), Field::inst('zip'), Field::inst('comments'))->process($_POST)->json();
Exemplo n.º 23
0
<?php

/*
 * Editor server script for DB table expense
 * 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, 'expense', 'exp_no')->fields(Field::inst('id')->set(false), Field::inst('exp_trans')->validator('Validate::notEmpty')->validator('Validate::maxLen', array('max' => 30)), Field::inst('exp_category'), Field::inst('exp_amount')->validator('Validate::numeric'), Field::inst('exp_date'))->process($_POST)->json();
Exemplo n.º 24
0
<?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\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(function () use($db) {
    // Use `selectDistinct` to get the full list of names from the
    // database and then concatenate the first and last names
    $userList = $db->selectDistinct('users', 'id, first_name, last_name', null, 'first_name ASC');
    $out = array();
    while ($row = $userList->fetch()) {
        $out[] = array("value" => $row['id'], "label" => $row['first_name'] . ' ' . $row['last_name']);
    }
    return $out;
}), Field::inst('manager.first_name'), Field::inst('manager.last_name'))->leftJoin('users as manager', 'users.manager', '=', 'manager.id')->process($_POST)->json();
Exemplo n.º 25
0
<?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;
$user = Users::model()->findByPk(Yii::app()->user->id);
$client_id = $user->client_id;
function userupdate()
{
    $user_data = Users::model()->findByPk(Yii::app()->user->id);
    $step_completed = $user_data->step_completed;
    if ($user_data->user_role == 2 && $step_completed < 2) {
        $user_data->step_completed = 2;
        $user_data->save();
        //$this->redirect(Yii::app()->baseUrl.'/site/admin');
        $baseUrl = Yii::app()->baseUrl;
        //Yii::app()->request->redirect($baseUrl.'/site/admin');
        //echo "<script>window.location.href ='".$baseUrl."/site/admin';</script>";
        //return false;
    }
    //else{ $this->render('overview', ['user_data' => $user_data]); }
}
//Build our Editor instance and process the data coming from _POST
$time = date("fYhis");
// $extension = end(explode('.', Upload::DB_FILE_NAME));
Editor::inst($db, 'benchmarks', 'id', $time, $client_id)->fields(Field::inst('benchmarks.client_id'), Field::inst('benchmarks.id as id'), Field::inst('benchmarks.benchmark_name as benchmark_name'), Field::inst('clients.client_name'))->on('postCreate', function () {
    userupdate();
})->leftJoin('clients', 'clients.id', '=', 'benchmarks.client_id')->where('benchmarks.client_id', $client_id)->process($_POST)->json();
Exemplo n.º 26
0
<?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', 0)->validator('Validate::notEmpty'), Field::inst('last_name', 1)->validator('Validate::notEmpty'), Field::inst('position', 2), Field::inst('office', 3), Field::inst('salary', 4)->validator('Validate::numeric')->getFormatter(function ($val) {
    return '$' . number_format($val);
}))->process($_POST)->json();
Exemplo n.º 27
0
<?php

// DataTables PHP library
include "../../php/DataTables2 .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;
/*
 * Example PHP implementation used for the join.html example
 */
$out = Editor::inst($db, 'users')->field(Field::inst('users.id'), Field::inst('users.customer'), Field::inst('users.so_date'), Field::inst('users.site'), Field::inst('sites.name'))->leftJoin('sites', 'sites.id', '=', 'users.site')->join(Join::inst('access', 'array')->join(array('id', 'user_id'), array('id', 'access_id'), 'user_access')->fields(Field::inst('id')->validator('Validate::required'), Field::inst('name'), Field::inst('qty'), Field::inst('price')))->process($_POST)->data();
// When there is no 'action' parameter we are getting data, and in this
// case we want to send extra data back to the client, with the options
// for the 'sites' and 'dept' select lists
if (!isset($_POST['action'])) {
    // Get a list of sites for the `select` list
    $out['sites'] = $db->selectDistinct('sites', 'id as value, name as label')->fetchAll();
    // Get department details
    $out['access'] = $db->select('access', 'id as value, name as label')->fetchAll();
}
// Send it back to the client
echo json_encode($out);
Exemplo n.º 28
0
<?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_FOOD', 'F_Trans_No')->fields(Field::inst('F_Trans_No'), Field::inst('F_Rest_Name'))->process($_POST)->json();
Exemplo n.º 29
0
<?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\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('image')->setFormatter('Format::nullEmpty')->upload(Upload::inst($_SERVER['DOCUMENT_ROOT'] . '/upload/__ID__.__EXTN__')->db('files', 'id', array('filename' => Upload::DB_FILE_NAME, 'filesize' => Upload::DB_FILE_SIZE, 'web_path' => Upload::DB_WEB_PATH, 'system_path' => Upload::DB_SYSTEM_PATH))->validator(function ($file) {
    return $file['size'] >= 50000 ? "Files must be smaller than 50K" : null;
})->allowedExtensions(['png', 'jpg', 'gif'], "Please upload an image")))->process($_POST)->json();
<?php

/*
 * Editor server script for DB table facilities
 * 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, 'facilities', 'id')->fields(Field::inst('facName'), Field::inst('locStr1'), Field::inst('locStr2'), Field::inst('locCity'), Field::inst('locState'), Field::inst('locZip'), Field::inst('locZip4'), Field::inst('phone'), Field::inst('intake1'), Field::inst('intake2'), Field::inst('hotline1'), Field::inst('hotline2'), Field::inst('website'), Field::inst('image1'), Field::inst('image2'), Field::inst('image3'), Field::inst('image4'), Field::inst('image5'), Field::inst('createDate'))->process($_POST)->json();