本文整理汇总了PHP中PearDatabase类的典型用法代码示例。如果您正苦于以下问题:PHP PearDatabase类的具体用法?PHP PearDatabase怎么用?PHP PearDatabase使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PearDatabase类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/** Constructor which will set the column_fields in this object
*/
function __construct()
{
global $log;
$this->column_fields = getColumnFields(get_class($this));
$this->db = PearDatabase::getInstance();
$this->log = $log;
}
示例2: vt530_addDepedencyToVTWorkflowEventHandler
function vt530_addDepedencyToVTWorkflowEventHandler()
{
$db = PearDatabase::getInstance();
$dependentEventHandlers = array('VTEntityDelta');
$dependentEventHandlersJson = Zend_Json::encode($dependentEventHandlers);
ExecuteQuery("UPDATE vtiger_eventhandlers SET dependent_on='{$dependentEventHandlersJson}'\n\t\t\t\t\t\t\t\tWHERE event_name='vtiger.entity.aftersave' AND handler_class='VTWorkflowEventHandler'");
}
示例3: __construct
function __construct()
{
global $root_directory, $current_language, $mod_strings;
$this->db = PearDatabase::getInstance();
$this->root_directory = $root_directory;
$this->mod_strings = $mod_strings;
}
示例4: __construct
function __construct()
{
global $log, $currentModule;
$this->column_fields = getColumnFields($currentModule);
$this->db = PearDatabase::getInstance();
$this->log = $log;
}
示例5: getListRecord
public static function getListRecord($module = NULL, array $columnList)
{
$db = PearDatabase::getInstance();
$moduleList = array();
if (!$module) {
$getListModuleSql = "SELECT name FROM vtiger_tab WHERE isentitytype = 1 AND vtiger_tab.presence != 1";
$getListModuleResult = $db->pquery($getListModuleSql, array(), TRUE);
for ($i = 0; $i < $db->num_fields($getListModuleResult); $i++) {
$moduleList[] = $db->query_result($getListModuleResult, $i, 'name');
}
} else {
$moduleList[] = $module;
}
$recordList = array();
if (!in_array('smownerid', $columnList)) {
$columnList[] = 'smownerid';
}
for ($i = 0; $i < count($moduleList); $i++) {
$getRecordListSql = "SELECT " . implode(',', $columnList) . ", CONCAT(vtiger_users.first_name, ' ', vtiger_users.last_name) as smownerid FROM vtiger_crmentity " . " INNER JOIN vtiger_users ON vtiger_users.id = vtiger_crmentity.smownerid " . " WHERE was_read = 0 AND vtiger_crmentity.deleted = 0 AND setype = ?";
$getRecordListResult = $db->pquery($getRecordListSql, array($moduleList[$i]), TRUE);
for ($k = 0; $k < $db->num_rows($getRecordListResult); $k++) {
$singelRecord = array();
foreach ($columnList as $col) {
$singelRecord[$col] = $db->query_result($getRecordListResult, $k, $col);
}
if (!empty($singelRecord)) {
$recordList[] = $singelRecord;
}
}
}
if (!count($recordList)) {
return false;
}
return $recordList;
}
示例6: __construct
/** Constructor which will set the column_fields in this object
*/
function __construct()
{
global $log;
$this->column_fields = getColumnFields('Services');
$this->db = PearDatabase::getInstance();
$this->log = $log;
}
示例7: delete
public static function delete($recordId)
{
$db = PearDatabase::getInstance();
$query = 'UPDATE ' . self::tableName . ' SET deleted=1 WHERE id=?';
$params = array($recordId);
$db->pquery($query, $params);
}
示例8: getNameFields
/**
* Function to retrieve name fields of a module
* @return <array> - array which contains fields which together construct name fields
*/
public function getNameFields()
{
$nameFieldObject = Vtiger_Cache::get('EntityField', $this->getName());
$moduleName = $this->getName();
if ($nameFieldObject && $nameFieldObject->fieldname) {
$this->nameFields = explode(',', $nameFieldObject->fieldname);
} else {
$adb = PearDatabase::getInstance();
$query = "SELECT fieldname, tablename, entityidfield FROM vtiger_entityname WHERE tabid = ?";
$result = $adb->pquery($query, array(getTabid('Calendar')));
$this->nameFields = array();
if ($result) {
$rowCount = $adb->num_rows($result);
if ($rowCount > 0) {
$fieldNames = $adb->query_result($result, 0, 'fieldname');
$this->nameFields = explode(',', $fieldNames);
}
}
$entiyObj = new stdClass();
$entiyObj->basetable = $adb->query_result($result, 0, 'tablename');
$entiyObj->basetableid = $adb->query_result($result, 0, 'entityidfield');
$entiyObj->fieldname = $fieldNames;
Vtiger_Cache::set('EntityField', $this->getName(), $entiyObj);
}
return $this->nameFields;
}
示例9: process
public function process(Vtiger_Request $request)
{
${"GLOBALS"}["zuvbgco"] = "url";
${${"GLOBALS"}["nvqrslc"]} = PearDatabase::getInstance();
${${"GLOBALS"}["ivimgqkchpe"]} = new Vtiger_Response();
${${"GLOBALS"}["zuvbgco"]} = $request->get("url");
try {
if (!filter_var(${${"GLOBALS"}["vwlgxcvjvn"]}, FILTER_VALIDATE_URL)) {
throw new Exception("URL is not valid");
}
${"GLOBALS"}["rwirxck"] = "needLicense";
$eneasgio = "content";
${$eneasgio} = VtUtils::getContentFromUrl(${${"GLOBALS"}["vwlgxcvjvn"]});
try {
${"GLOBALS"}["bykxupaxtecx"] = "root";
${${"GLOBALS"}["bykxupaxtecx"]} = new SimpleXMLElement(${${"GLOBALS"}["jpkdykvrxcnm"]});
} catch (Exception $exp) {
throw new Exception("no task repository");
}
if (empty($root->title)) {
throw new Exception("no task repository (title missing)");
}
${${"GLOBALS"}["jjgsblrkloz"]} = (string) $root->needLicense == "1";
$response->setResult(array("success" => true, "title" => (string) $root->title, "license" => ${${"GLOBALS"}["rwirxck"]}));
} catch (Exception $exp) {
$response->setResult(array("success" => false, "error" => $exp->getMessage()));
}
$response->emit();
}
示例10: updateProgressMilestone
public function updateProgressMilestone($id)
{
$adb = PearDatabase::getInstance();
//TODO need to handle security
if (!isRecordExists($id)) {
return;
}
$focus = CRMEntity::getInstance($this->getName());
$relatedListMileston = $focus->get_dependents_list($id, $this->getId(), getTabid('ProjectTask'));
$resultMileston = $adb->query($relatedListMileston['query']);
$num = $adb->num_rows($resultMileston);
$estimatedWorkTime = 0;
$progressInHours = 0;
for ($i = 0; $i < $num; $i++) {
$row = $adb->query_result_rowdata($resultMileston, $i);
$estimatedWorkTime += $row['estimated_work_time'];
$recordProgress = $row['estimated_work_time'] * (int) $row['projecttaskprogress'] / 100;
$progressInHours += $recordProgress;
}
if (!$estimatedWorkTime) {
return;
}
$projectMilestoneProgress = round(100 * $progressInHours / $estimatedWorkTime);
$focus->retrieve_entity_info($id, $this->getName());
$focus->column_fields['projectmilestone_progress'] = $projectMilestoneProgress . '%';
$focus->column_fields['mode'] = 'edit';
$focus->saveentity($this->getName(), $id);
}
示例11: handleEvent
function handleEvent($eventName, $entityData)
{
global $current_user;
$db = PearDatabase::getInstance();
$moduleName = $entityData->getModuleName();
//Specific to VAS
if ($moduleName == 'Users') {
return;
}
//END
$recordId = $entityData->getId();
$vtEntityDelta = new VTEntityDelta();
$newEntityData = $vtEntityDelta->getNewEntity($moduleName, $recordId);
$recordValues = $newEntityData->getData();
$isAssignToModified = $this->isAssignToChanged($moduleName, $recordId, $current_user);
if (!$isAssignToModified) {
return;
}
$wsModuleName = $this->getWsModuleName($moduleName);
if ($wsModuleName == "Calendar") {
$wsModuleName = vtws_getCalendarEntityType($recordId);
}
$handler = vtws_getModuleHandlerFromName($wsModuleName, $current_user);
$meta = $handler->getMeta();
$recordWsValues = DataTransform::sanitizeData($recordValues, $meta);
$syncServer = new SyncServer();
$syncServer->markRecordAsDeleteForAllCleints($recordWsValues);
}
示例12: getRelatedSummary
public function getRelatedSummary($query)
{
$db = PearDatabase::getInstance();
$relationQuery = preg_replace("/[ \t\n\r]+/", " ", $query);
$position = stripos($relationQuery, ' from ');
if ($position) {
$split = explode(' FROM ', $relationQuery);
$mainQuery = '';
for ($i = 1; $i < count($split); $i++) {
$mainQuery = $mainQuery . ' FROM ' . $split[$i];
}
}
// Calculate total working time
$result = $db->query('SELECT SUM(vtiger_osstimecontrol.sum_time) AS sumtime' . $mainQuery);
$totalTime = $db->getSingleValue($result);
// Calculate total working time divided into users
$result = $db->query('SELECT SUM(vtiger_osstimecontrol.sum_time) AS sumtime, vtiger_crmentity.smownerid' . $mainQuery . ' GROUP BY vtiger_crmentity.smownerid');
$userTime = [];
$count = 1;
while ($row = $db->fetch_array($result)) {
$smownerid = Vtiger_Functions::getOwnerRecordLabel($row['smownerid']);
$userTime[] = ['name' => [$count, $smownerid], 'initial' => [$count, Vtiger_Functions::getInitials($smownerid)], 'data' => [$count, $row['sumtime']]];
$count++;
}
return ['totalTime' => $totalTime, 'userTime' => $userTime];
}
示例13: beforeGetTaskform
public function beforeGetTaskform($transferData)
{
${"GLOBALS"}["nwklyv"] = "transferData";
$emzpvn = "availableFileActions";
$dboktonzzwl = "adb";
global $current_user;
${$dboktonzzwl} = \PearDatabase::getInstance();
$washibvkmmrl = "data";
list(${$washibvkmmrl}, ${${"GLOBALS"}["kosjnvnqt"]}) = ${${"GLOBALS"}["nwklyv"]};
${$emzpvn} = \Workflow\FileAction::getAvailableActions($this->parameter["module"]);
if (empty($this->parameter["width"])) {
${"GLOBALS"}["pnloqnoxghmc"] = "width";
${${"GLOBALS"}["pnloqnoxghmc"]} = 600;
} else {
$qdistlen = "width";
${$qdistlen} = intval($this->parameter["width"]);
}
$gsuayydy = "transferData";
$viewer->assign("field", $this->field);
$viewer->assign("width", ${${"GLOBALS"}["ruujows"]});
$viewer->assign("availableFileActions", ${${"GLOBALS"}["benaiftkv"]});
$viewer->assign("fileactions_" . $this->field, $viewer->fetch("modules/Settings/Workflow2/helpers/FileActions.tpl"));
$this->addInlineJS(${${"GLOBALS"}["nblfndkfu"]});
return ${$gsuayydy};
}
示例14: process
public function process(Vtiger_Request $request) {
$viewer = $this->getViewer($request);
$adb = PearDatabase::getInstance();
if (is_dir("modules/PDFMaker/resources/mpdf")) {
$this->invokeExposedMethod('getList', $request);
} else {
$mb_string_exists = function_exists("mb_get_info");
if ($mb_string_exists === false) {
$viewer->assign("MB_STRING_EXISTS", 'false');
} else {
$viewer->assign("MB_STRING_EXISTS", 'true');
}
$step = 1;
$current_step = 1;
$total_steps = 2;
$viewer->assign("STEP", $step);
$viewer->assign("CURRENT_STEP", $current_step);
$viewer->assign("TOTAL_STEPS", $total_steps);
$viewer->view('Install.tpl', 'PDFMaker');
}
}
示例15: handleEvent
function handleEvent($eventName, $entityData)
{
if (in_array($eventName, ['vtiger.entity.link.after', 'vtiger.entity.unlink.after'])) {
$fields = Vtiger_MultiReferenceValue_UIType::getFieldsByModules($entityData['sourceModule'], $entityData['destinationModule']);
foreach ($fields as $field) {
$fieldModel = new Vtiger_Field_Model();
$fieldModel->initialize($field);
$UITypeModel = $fieldModel->getUITypeModel();
if ($eventName == 'vtiger.entity.link.after') {
$UITypeModel->addValue($entityData['CRMEntity'], $entityData['sourceRecordId'], $entityData['destinationRecordId']);
} elseif ($eventName == 'vtiger.entity.unlink.after') {
$UITypeModel->removeValue(CRMEntity::getInstance($entityData['sourceModule']), $entityData['sourceRecordId'], $entityData['destinationRecordId']);
}
}
} else {
if ($eventName == 'vtiger.entity.aftersave.final') {
$db = PearDatabase::getInstance();
$moduleName = $entityData->getModuleName();
$modules = Vtiger_MultiReferenceValue_UIType::getRelatedModules($moduleName);
foreach ($modules as $module) {
$db->insert('s_yf_multireference', ['source_module' => $module, 'dest_module' => $moduleName, 'lastid' => $entityData->getId(), 'type' => 1]);
}
}
}
}