本文整理汇总了PHP中Vtiger_Functions::throwNewException方法的典型用法代码示例。如果您正苦于以下问题:PHP Vtiger_Functions::throwNewException方法的具体用法?PHP Vtiger_Functions::throwNewException怎么用?PHP Vtiger_Functions::throwNewException使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vtiger_Functions
的用法示例。
在下文中一共展示了Vtiger_Functions::throwNewException方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: process
function process(Vtiger_Request $request)
{
$viewer = $this->getViewer($request);
$moduleName = $this->getModule($request);
$template = $request->get('template');
$srcField = $request->get('src_field');
$srcRecord = $request->get('src_record');
if (!empty($template)) {
$recordModel = Settings_TreesManager_Record_Model::getInstanceById($template);
} else {
Vtiger_Functions::throwNewException(vtranslate('ERR_TREE_NOT_FOUND', $moduleName));
}
if (!$recordModel) {
Vtiger_Functions::throwNewException(vtranslate('ERR_TREE_NOT_FOUND', $moduleName));
}
$tree = $recordModel->getTree();
$viewer->assign('TREE', Zend_Json::encode($tree));
$viewer->assign('SRC_RECORD', $srcRecord);
$viewer->assign('SRC_FIELD', $srcField);
$viewer->assign('TEMPLATE', $template);
$viewer->assign('MODULE', $moduleName);
$viewer->assign('TRIGGER_EVENT_NAME', $request->get('triggerEventName'));
$viewer->assign('USER_MODEL', Users_Record_Model::getCurrentUserModel());
$viewer->view('TreePopup.tpl', $moduleName);
}
示例2: showTree
public function showTree(Vtiger_Request $request)
{
$moduleName = $request->getModule();
$sourceModule = $request->get('selectedModule');
$viewer = $this->getViewer($request);
$this->template = $this->getTemplate();
if ($this->template) {
$recordModel = Settings_TreesManager_Record_Model::getInstanceById($this->template);
} else {
Vtiger_Functions::throwNewException(vtranslate('ERR_TREE_NOT_FOUND', $moduleName));
}
if (!$recordModel) {
Vtiger_Functions::throwNewException(vtranslate('ERR_TREE_NOT_FOUND', $moduleName));
}
if (!in_array($sourceModule, $this->modules)) {
Vtiger_Functions::throwNewException(vtranslate('ERR_MODULE_NOT_FOUND', $moduleName));
}
$tree = $this->getCategory();
$treeWithItems = $this->getRecords();
$tree = array_merge($tree, $treeWithItems);
$viewer->assign('TREE', Zend_Json::encode($tree));
$viewer->assign('MODULES', $this->modules);
$viewer->assign('MODULE', $moduleName);
$viewer->assign('SELECTED_MODULE_NAME', $sourceModule);
$viewer->assign('CUSTOM_VIEWS', CustomView_Record_Model::getAllByGroup($moduleName));
$viewer->view('AccountsListTree.tpl', $moduleName);
}
示例3: process
public function process(Vtiger_Request $request)
{
$this->preProcess($request);
$viewer = $this->getViewer($request);
$moduleName = $this->moduleName = $request->getModule();
$srcRecord = $this->src_record = $request->get('src_record');
$srcModule = $this->src_module = $request->get('src_module');
$template = $this->template = $this->getTemplate();
if ($template) {
$recordModel = Settings_TreesManager_Record_Model::getInstanceById($template);
} else {
Vtiger_Functions::throwNewException(vtranslate('ERR_TREE_NOT_FOUND', $moduleName));
}
if (!$recordModel) {
Vtiger_Functions::throwNewException(vtranslate('ERR_TREE_NOT_FOUND', $moduleName));
}
$tree = $this->getCategory();
$treeWithItems = $this->getRecords();
$tree = array_merge($tree, $treeWithItems);
$viewer->assign('TREE', Zend_Json::encode($tree));
$viewer->assign('SRC_RECORD', $srcRecord);
$viewer->assign('SRC_MODULE', $srcModule);
$viewer->assign('TEMPLATE', $template);
$viewer->assign('MODULE', $moduleName);
$viewer->assign('USER_MODEL', Users_Record_Model::getCurrentUserModel());
$viewer->view('TreeCategory.tpl', $moduleName);
$this->postProcess($request);
}
示例4: getTreeField
/**
* Load tree field info
* @return array
*/
public function getTreeField()
{
if ($this->has('fieldTemp')) {
return $this->get('fieldTemp');
}
$db = PearDatabase::getInstance();
$result = $db->pquery('SELECT tablename,columnname,fieldname,fieldparams FROM vtiger_field WHERE uitype = ? AND tabid = ?', [302, Vtiger_Functions::getModuleId($this->getModuleName())]);
if ($db->getRowCount($result) == 0) {
Vtiger_Functions::throwNewException(vtranslate('ERR_TREE_NOT_FOUND', $this->getModuleName()));
}
$fieldTemp = $db->getRow($result);
$this->set('fieldTemp', $fieldTemp);
return $fieldTemp;
}
示例5: process
public function process(Vtiger_Request $request)
{
if (vglobal('systemMode') == 'demo') {
die(Vtiger_Functions::throwNewException('Demo mode is enabled, the installation of modules is disabled'));
}
$mode = $request->getMode();
if (!empty($mode)) {
$this->invokeExposedMethod($mode, $request);
return;
}
$qualifiedModuleName = $request->getModule(false);
$viewer = $this->getViewer($request);
$viewer->assign('QUALIFIED_MODULE', $qualifiedModuleName);
$viewer->view('Step1.tpl', $qualifiedModuleName);
}
示例6: process
public function process(Vtiger_Request $request)
{
$systemMode = vglobal('systemMode');
if ($systemMode == 'demo') {
die(Vtiger_Functions::throwNewException(vtranslate('LBL_ERROR_IMPORT_IN_DEMO')));
}
$mode = $request->getMode();
if (!empty($mode)) {
$this->invokeExposedMethod($mode, $request);
return;
}
$qualifiedModuleName = $request->getModule(false);
$viewer = $this->getViewer($request);
$viewer->assign('QUALIFIED_MODULE', $qualifiedModuleName);
$viewer->view('Step1.tpl', $qualifiedModuleName);
}
示例7: imapThrowError
public static function imapThrowError($error)
{
$log = vglobal('log');
$log->error("Error OSSMail_Record_Model::imapConnect(): " . $error);
Vtiger_Functions::throwNewException(vtranslate('IMAP_ERROR', 'OSSMailScanner') . ': ' . $error);
}
示例8: checkError
function checkError($message, $dieOnError = false, $query = false, $params = false)
{
if ($this->hasActiveTransaction) {
$this->rollbackTransaction();
}
if ($this->dieOnError || $dieOnError) {
if (SysDebug::get('DISPLAY_DEBUG_BACKTRACE')) {
$queryInfo = '';
if ($query !== false) {
$queryInfo .= 'Query: ' . $query . PHP_EOL;
}
if ($params !== false && $params != NULL) {
$queryInfo .= 'Params: ' . implode(',', $params) . PHP_EOL;
}
$backtrace = Vtiger_Functions::getBacktrace();
$trace = '<pre>' . $queryInfo . $backtrace . '</pre>';
}
Vtiger_Functions::throwNewException('Database ERROR: ' . PHP_EOL . $message . PHP_EOL . $trace);
}
}
示例9: checkFileAccess
/** Function to check the file access is made within web root directory. */
static function checkFileAccess($filepath)
{
if (!self::isFileAccessible($filepath)) {
$log = vglobal('log');
$log->error(__CLASS__ . ':' . __FUNCTION__ . '(' . $filepath . ') - Sorry! Attempt to access restricted file. realfilepath: ' . print_r($realfilepath, true));
die(Vtiger_Functions::throwNewException("Sorry! Attempt to access restricted file. '" . htmlspecialchars($realfilepath, ENT_QUOTES, vglobal('default_charset')) . "'"));
}
}
示例10: process
//.........这里部分代码省略.........
$module = $request->getModule();
$qualifiedModuleName = $request->getModule(false);
if ($currentUser && $qualifiedModuleName) {
$moduleLanguageStrings = Vtiger_Language_Handler::getModuleStringsFromFile($currentLanguage, $qualifiedModuleName);
vglobal('mod_strings', $moduleLanguageStrings['languageStrings']);
}
if ($currentUser) {
$moduleLanguageStrings = Vtiger_Language_Handler::getModuleStringsFromFile($currentLanguage);
vglobal('app_strings', $moduleLanguageStrings['languageStrings']);
}
$view = $request->get('view');
$action = $request->get('action');
$response = false;
try {
if ($this->isInstalled() === false && $module != 'Install') {
header('Location:install/Install.php');
exit;
}
if (empty($module)) {
if ($this->hasLogin()) {
$defaultModule = vglobal('default_module');
if (!empty($defaultModule) && $defaultModule != 'Home') {
$module = $defaultModule;
$qualifiedModuleName = $defaultModule;
$view = 'List';
if ($module == 'Calendar') {
// To load MyCalendar instead of list view for calendar
//TODO: see if it has to enhanced and get the default view from module model
$view = 'Calendar';
}
} else {
$module = 'Home';
$qualifiedModuleName = 'Home';
$view = 'DashBoard';
}
} else {
$module = 'Users';
$qualifiedModuleName = 'Settings:Users';
$view = 'Login';
}
$request->set('module', $module);
$request->set('view', $view);
}
if (!empty($action)) {
$componentType = 'Action';
$componentName = $action;
} else {
$componentType = 'View';
if (empty($view)) {
$view = 'Index';
}
$componentName = $view;
}
$handlerClass = Vtiger_Loader::getComponentClassName($componentType, $componentName, $qualifiedModuleName);
$handler = new $handlerClass();
if ($handler) {
vglobal('currentModule', $module);
$csrfProtection = vglobal('csrfProtection');
if ($csrfProtection) {
// Ensure handler validates the request
$handler->validateRequest($request);
}
if ($handler->loginRequired()) {
$this->checkLogin($request);
}
//TODO : Need to review the design as there can potential security threat
$skipList = array('Users', 'Home', 'CustomView', 'Import', 'Export', 'Inventory', 'Vtiger', 'PriceBooks', 'Migration', 'Install');
if (!in_array($module, $skipList) && stripos($qualifiedModuleName, 'Settings') === false) {
$this->triggerCheckPermission($handler, $request);
}
// Every settings page handler should implement this method
if (stripos($qualifiedModuleName, 'Settings') === 0 || $module == 'Users') {
$handler->checkPermission($request);
}
$notPermittedModules = array('ModComments', 'Integration', 'DashBoard');
if (in_array($module, $notPermittedModules) && $view == 'List') {
header('Location:index.php?module=Home&view=DashBoard');
}
$this->triggerPreProcess($handler, $request);
$response = $handler->process($request);
$this->triggerPostProcess($handler, $request);
} else {
throw new AppException(vtranslate('LBL_HANDLER_NOT_FOUND'));
}
} catch (Exception $e) {
if ($view) {
// Log for developement.
error_log($e->getTraceAsString(), E_NOTICE);
Vtiger_Functions::throwNewException($e->getMessage());
} else {
$response = new Vtiger_Response();
$response->setEmitType(Vtiger_Response::$EMIT_JSON);
$response->setError($e->getMessage());
//Vtiger_Functions::throwNewException($e->getMessage());
}
}
if ($response) {
$response->emit();
}
}
示例11: getColumnsListByCvid
/** to get the getModuleColumnsList for the given customview
* @param $cvid :: Type Integer
* @returns $columnlist Array in the following format
* $columnlist = Array( $columnindex => $columnname,
* $columnindex1 => $columnname1,
* |
* $columnindexn => $columnnamen)
*/
function getColumnsListByCvid($cvid)
{
global $adb, $log;
$log->debug("Entering getColumnsListByCvid({$cvid}) method ...");
$sSQL = "select vtiger_cvcolumnlist.* from vtiger_cvcolumnlist";
$sSQL .= " inner join vtiger_customview on vtiger_customview.cvid = vtiger_cvcolumnlist.cvid";
$sSQL .= " where vtiger_customview.cvid =? order by vtiger_cvcolumnlist.columnindex";
$result = $adb->pquery($sSQL, array($cvid));
if ($adb->num_rows($result) == 0 && $this->customviewmodule != 'Users') {
$log->debug("Error !!!: " . vtranslate('LBL_NO_FOUND_VIEW') . " ID: {$cvid}");
die(Vtiger_Functions::throwNewException('LBL_NO_FOUND_VIEW'));
}
while ($columnrow = $adb->fetch_array($result)) {
$columnlist[$columnrow['columnindex']] = $columnrow['columnname'];
}
$log->debug("Exiting getColumnsListByCvid() method ...");
return $columnlist;
}
示例12: save
/** Function to save the user information into the database
* @param $module -- module name:: Type varchar
*
*/
function save($module_name)
{
$adb = PearDatabase::getInstance();
$log = vglobal('log');
//Event triggering code
require_once "include/events/include.inc";
//In Bulk mode stop triggering events
if (!self::isBulkSaveMode()) {
$em = new VTEventsManager($adb);
// Initialize Event trigger cache
$em->initTriggerCache();
$entityData = VTEntityData::fromCRMEntity($this);
$em->triggerEvent("vtiger.entity.beforesave.modifiable", $entityData);
$em->triggerEvent("vtiger.entity.beforesave", $entityData);
$em->triggerEvent("vtiger.entity.beforesave.final", $entityData);
}
if ($this->mode != 'edit') {
$sql = 'SELECT id FROM vtiger_users WHERE user_name = ? OR email1 = ?';
$result = $adb->pquery($sql, array($this->column_fields['user_name'], $this->column_fields['email1']));
if ($adb->num_rows($result) > 0) {
Vtiger_Functions::throwNewException('LBL_USER_EXISTS');
throw new WebServiceException(WebServiceErrorCode::$DATABASEQUERYERROR, vtws_getWebserviceTranslatedString('LBL_USER_EXISTS'));
return false;
}
} else {
$query = 'SELECT `roleid` FROM `vtiger_user2role` WHERE `userid` = ? LIMIT 1;';
$oldRoleResult = $adb->pquery($query, [$this->id]);
$oldRole = $adb->query_result($oldRoleResult, 0, 'roleid');
if ($oldRole != $this->column_fields['roleid']) {
$query = 'DELETE FROM `vtiger_module_dashboard_widgets` WHERE `userid` = ?;';
$adb->pquery($query, [$this->id]);
}
}
//Save entity being called with the modulename as parameter
$this->saveentity($module_name);
if ($em) {
//Event triggering code
$em->triggerEvent("vtiger.entity.aftersave", $entityData);
$em->triggerEvent("vtiger.entity.aftersave.final", $entityData);
//Event triggering code ends
}
// Added for Reminder Popup support
$query_prev_interval = $adb->pquery("SELECT reminder_interval from vtiger_users where id=?", array($this->id));
$prev_reminder_interval = $adb->query_result($query_prev_interval, 0, 'reminder_interval');
//$focus->imagename = $image_upload_array['imagename'];
$this->saveHomeStuffOrder($this->id);
SaveTagCloudView($this->id);
// Added for Reminder Popup support
$this->resetReminderInterval($prev_reminder_interval);
//Creating the Privileges Flat File
if (isset($this->column_fields['roleid'])) {
updateUser2RoleMapping($this->column_fields['roleid'], $this->id);
}
//After adding new user, set the default activity types for new user
Vtiger_Util_Helper::setCalendarDefaultActivityTypesForUser($this->id);
require_once 'modules/Users/CreateUserPrivilegeFile.php';
createUserPrivilegesfile($this->id);
createUserSharingPrivilegesfile($this->id);
}
示例13: getColumnsListByCvid
/** to get the getModuleColumnsList for the given customview
* @param $cvid :: Type Integer
* @returns $columnlist Array in the following format
* $columnlist = Array( $columnindex => $columnname,
* $columnindex1 => $columnname1,
* |
* $columnindexn => $columnnamen)
*/
function getColumnsListByCvid($cvid)
{
$adb = PearDatabase::getInstance();
$log = vglobal('log');
$log->debug("Entering getColumnsListByCvid({$cvid}) method ...");
$sSQL = 'select vtiger_cvcolumnlist.* from vtiger_cvcolumnlist';
$sSQL .= ' inner join vtiger_customview on vtiger_customview.cvid = vtiger_cvcolumnlist.cvid';
$sSQL .= ' where vtiger_customview.cvid =? order by vtiger_cvcolumnlist.columnindex';
$result = $adb->pquery($sSQL, [$cvid]);
if ($adb->num_rows($result) == 0 && is_numeric($cvid) && $this->customviewmodule != 'Users') {
$log->debug("Error !!!: " . vtranslate('LBL_NO_FOUND_VIEW') . " ID: {$cvid}");
die(Vtiger_Functions::throwNewException(vtranslate('LBL_NO_FOUND_VIEW')));
} else {
if (!is_numeric($cvid) && $this->customviewmodule != 'Users') {
$filterDir = 'modules' . DIRECTORY_SEPARATOR . $this->customviewmodule . DIRECTORY_SEPARATOR . 'filters' . DIRECTORY_SEPARATOR . $cvid . '.php';
if (file_exists($filterDir)) {
$handlerClass = Vtiger_Loader::getComponentClassName('Filter', $cvid, $this->customviewmodule);
if (class_exists($handlerClass)) {
$handler = new $handlerClass();
$columnlist = $handler->getColumnList();
}
} else {
$log->debug("Error !!!: " . vtranslate('LBL_NO_FOUND_VIEW') . " Filter: {$cvid}");
die(Vtiger_Functions::throwNewException(vtranslate('LBL_NO_FOUND_VIEW')));
}
} else {
while ($columnrow = $adb->fetch_array($result)) {
$columnlist[$columnrow['columnindex']] = $columnrow['columnname'];
}
}
}
$log->debug("Exiting getColumnsListByCvid() method ...");
return $columnlist;
}
示例14: imap_open_error
public static function imap_open_error($error)
{
global $log;
$log->error("Error OSSMail_Record_Model::imap_connect(): " . $error);
Vtiger_Functions::throwNewException(vtranslate('IMAP_ERROR', 'OSSMailScanner') . ': ' . $error);
}
示例15: checkFileAccess
/** Function to check the file access is made within web root directory. */
static function checkFileAccess($filepath)
{
if (!self::isFileAccessible($filepath)) {
global $log;
$log->error(__CLASS__ . ':' . __FUNCTION__ . '(' . $filepath . ') - Sorry! Attempt to access restricted file. realfilepath: ' . print_r($realfilepath, true));
die(Vtiger_Functions::throwNewException("Sorry! Attempt to access restricted file. '" . $realfilepath . "'"));
}
}