[ Index ]

PHP Cross Reference of vtigercrm-6.1.0

title

Body

[close]

/modules/Vtiger/actions/ -> NoteBook.php (source)

   1  <?php
   2  /*+***********************************************************************************
   3   * The contents of this file are subject to the vtiger CRM Public License Version 1.0
   4   * ("License"); You may not use this file except in compliance with the License
   5   * The Original Code is:  vtiger CRM Open Source
   6   * The Initial Developer of the Original Code is vtiger.
   7   * Portions created by vtiger are Copyright (C) vtiger.
   8   * All Rights Reserved.
   9   *************************************************************************************/
  10  
  11  class Vtiger_NoteBook_Action extends Vtiger_Action_Controller {
  12      
  13  	function __construct() {
  14          $this->exposeMethod('NoteBookCreate');
  15      }
  16      
  17  	function process(Vtiger_Request $request) {
  18          $mode = $request->getMode();
  19          
  20          if($mode){
  21              $this->invokeExposedMethod($mode,$request);
  22          }
  23      }
  24      
  25  	function NoteBookCreate(Vtiger_Request $request){
  26          $adb = PearDatabase::getInstance();
  27          
  28          $userModel = Users_Record_Model::getCurrentUserModel();
  29          $linkId = $request->get('linkId');
  30          $noteBookName = $request->get('notePadName');
  31          $noteBookContent = $request->get('notePadContent');
  32          
  33          $date_var = date("Y-m-d H:i:s");
  34          $date = $adb->formatDate($date_var, true);
  35          
  36          $dataValue = array();
  37          $dataValue['contents'] = $noteBookContent;
  38          $dataValue['lastSavedOn'] = $date;
  39          
  40          $data = Zend_Json::encode((object) $dataValue);
  41  
  42          $query="INSERT INTO vtiger_module_dashboard_widgets(linkid, userid, filterid, title, data) VALUES(?,?,?,?,?)";
  43          $params= array($linkId,$userModel->getId(),0,$noteBookName,$data);
  44          $adb->pquery($query, $params);
  45          $id = $adb->getLastInsertID();
  46          
  47          $result = array();
  48          $result['success'] = TRUE;
  49          $result['widgetId'] = $id;
  50          $response = new Vtiger_Response();
  51          $response->setResult($result);
  52          $response->emit();
  53          
  54      }
  55          
  56          public function validateRequest(Vtiger_Request $request) { 
  57              $request->validateWriteAccess(); 
  58          }
  59  }


Generated: Fri Nov 28 20:08:37 2014 Cross-referenced by PHPXref 0.7.1