当前位置: 首页>>代码示例>>PHP>>正文


PHP DBQuery::loadResult方法代码示例

本文整理汇总了PHP中DBQuery::loadResult方法的典型用法代码示例。如果您正苦于以下问题:PHP DBQuery::loadResult方法的具体用法?PHP DBQuery::loadResult怎么用?PHP DBQuery::loadResult使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DBQuery的用法示例。


在下文中一共展示了DBQuery::loadResult方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setComplete

function setComplete($id)
{
    global $AppUI;
    $task = new CTask();
    if ($task->load($id)) {
        $q = new DBQuery();
        $q->addTable('user_tasks');
        $q->addQuery('user_id');
        $q->addWhere('task_id = ' . $id);
        $q->addWhere('user_id = ' . $AppUI->user_id);
        $r = $q->loadResult();
        if ($r != $AppUI->user_id) {
            $p = new CProject($task->task_project);
            if (!$p->project_id || $p->getManager() != $AppUI->user_id) {
                return 'Error';
            }
        }
        $q->addTable('tasks');
        $q->addUpdate('task_percent_complete', '100');
        $q->addWhere('task_id = ' . $id);
        $q->exec();
        return 'OK';
    }
    return 'Error';
}
开发者ID:n2i,项目名称:xvnkb,代码行数:25,代码来源:complete.php

示例2: store

 function store()
 {
     $msg = $this->check();
     if ($msg) {
         return get_class($this) . "::store-check failed";
     }
     $q = new DBQuery();
     if ($this->user_id) {
         // save the old password
         $perm_func = "updateLogin";
         $q->addTable('users');
         $q->addQuery('user_password');
         $q->addWhere("user_id = {$this->user_id}");
         $pwd = $q->loadResult();
         if ($pwd != $this->user_password) {
             $this->user_password = md5($this->user_password);
             addHistory($this->_tbl, $this->user_id, 'password changed', 'Password changed from IP ' . $_SERVER['REMOTE_ADDR']);
         } else {
             $this->user_password = null;
         }
         $ret = db_updateObject('users', $this, 'user_id', false);
     } else {
         $perm_func = "addLogin";
         $this->user_password = md5($this->user_password);
         $ret = db_insertObject('users', $this, 'user_id');
     }
     if (!$ret) {
         return get_class($this) . "::store failed <br />" . db_error();
     } else {
         $acl =& $GLOBALS['AppUI']->acl();
         $acl->{$perm_func}($this->user_id, $this->user_username);
         return NULL;
     }
 }
开发者ID:illuminate3,项目名称:dotproject,代码行数:34,代码来源:admin.class.php

示例3: store

 function store()
 {
     $msg = $this->check();
     if ($msg) {
         return get_class($this) . "::store-check failed";
     }
     $q = new DBQuery();
     if ($this->user_id) {
         // save the old password
         $perm_func = "updateLogin";
         $q->addTable('users');
         $q->addQuery('user_password');
         $q->addWhere("user_id = {$this->user_id}");
         $pwd = $q->loadResult();
         if ($pwd != $this->user_password) {
             $this->user_password = md5($this->user_password);
         } else {
             $this->user_password = null;
         }
         $ret = db_updateObject('users', $this, 'user_id', false);
     } else {
         $perm_func = "addLogin";
         $this->user_password = md5($this->user_password);
         $ret = db_insertObject('users', $this, 'user_id');
     }
     if (!$ret) {
         return get_class($this) . "::store failed <br />" . db_error();
     } else {
         $acl =& $GLOBALS['AppUI']->acl();
         $acl->{$perm_func}($this->user_id, $this->user_username);
         //Insert Default Preferences
         //Lets check if the user has allready default users preferences set, if not insert the default ones
         $q->addTable('user_preferences', 'upr');
         $q->addWhere("upr.pref_user = {$this->user_id}");
         $uprefs = $q->loadList();
         $q->clear();
         if (!count($uprefs) && $this->user_id > 0) {
             //Lets get the default users preferences
             $q->addTable('user_preferences', 'dup');
             $q->addWhere("dup.pref_user = 0");
             $dprefs = $q->loadList();
             $q->clear();
             foreach ($dprefs as $dprefskey => $dprefsvalue) {
                 $q->addTable('user_preferences', 'up');
                 $q->addInsert('pref_user', $this->user_id);
                 $q->addInsert('pref_name', $dprefsvalue['pref_name']);
                 $q->addInsert('pref_value', $dprefsvalue['pref_value']);
                 $q->exec();
                 $q->clear();
             }
         }
         return NULL;
     }
 }
开发者ID:n2i,项目名称:xvnkb,代码行数:54,代码来源:admin.class.php

示例4: load

 function load($oid = null, $strip = true)
 {
     $result = parent::load($oid, $strip);
     if ($result && $oid) {
         $working_hours = dPgetConfig('daily_working_hours') ? dPgetConfig('daily_working_hours') : 8;
         $q = new DBQuery();
         $q->addTable('projects', 'p');
         $q->addQuery(' SUM(t1.task_duration * t1.task_percent_complete' . ' * IF(t1.task_duration_type = 24, ' . $working_hours . ', t1.task_duration_type)) / SUM(t1.task_duration' . ' * IF(t1.task_duration_type = 24, ' . $working_hours . ', t1.task_duration_type)) AS project_percent_complete');
         $q->addJoin('tasks', 't1', 'p.project_id = t1.task_project');
         $q->addWhere('project_id = ' . $oid . ' AND t1.task_id = t1.task_parent');
         $this->project_percent_complete = $q->loadResult();
     }
     return $result;
 }
开发者ID:srinivasulurao,项目名称:jonel,代码行数:14,代码来源:projects.class.php

示例5: load

 function load($oid = null, $strip = true)
 {
     $result = parent::load($oid, $strip);
     if ($result && $oid) {
         $working_hours = dPgetConfig('daily_working_hours') ? dPgetConfig('daily_working_hours') : 8;
         $q = new DBQuery();
         $q->addTable('projects');
         $q->addQuery(" SUM(t1.task_duration * t1.task_percent_complete" . " * IF(t1.task_duration_type = 24, {$working_hours}, t1.task_duration_type))" . " / SUM(t1.task_duration * IF(t1.task_duration_type = 24, {$working_hours}" . ", t1.task_duration_type)) AS project_percent_complete");
         $q->addJoin('tasks', 't1', 'projects.project_id = t1.task_project');
         $q->addWhere(" project_id = {$oid} AND t1.task_id = t1.task_parent");
         $this->project_percent_complete = $q->loadResult();
     }
     return $result;
 }
开发者ID:seatecnologia,项目名称:dotproject_timesheet,代码行数:14,代码来源:projects.class.php

示例6: DBQuery

 function _fetchPreviousData()
 {
     $q = new DBQuery();
     $q->addTable($this->table_name);
     $q->addQuery($this->field_name);
     $q->addWhere("{$this->id_field_name} = {$this->row_id}");
     $previous_data = $q->loadResult();
     if ($previous_data != "") {
         $previous_data = unserialize($previous_data);
         $previous_data = !is_array($previous_data) ? array() : $previous_data;
     } else {
         $previous_data = array();
     }
     $this->previous_data = $previous_data;
 }
开发者ID:Esleelkartea,项目名称:gestion-de-primeras-muestras,代码行数:15,代码来源:customfieldsparser.class.php

示例7: load

 function load($oid = null, $strip = true)
 {
     $result = parent::load($oid, $strip);
     if ($result && $oid) {
         $q = new DBQuery();
         $q->addTable('projects');
         $q->addQuery('SUM(t1.task_duration*t1.task_duration_type*t1.task_percent_complete) / 
                                     SUM(t1.task_duration*t1.task_duration_type) 
                                     AS project_percent_complete');
         $q->addJoin('tasks', 't1', 'projects.project_id = t1.task_project');
         $q->addWhere(" project_id = {$oid}");
         $this->project_percent_complete = $q->loadResult();
     }
     return $result;
 }
开发者ID:Esleelkartea,项目名称:gestion-de-primeras-muestras,代码行数:15,代码来源:projects.class.php

示例8: canDelete

 function canDelete(&$msg, $oid = null, $joins = null)
 {
     global $AppUI;
     if ($oid) {
         // Check to see if there is a user
         $q = new DBQuery();
         $q->addTable('users');
         $q->addQuery('count(*) as user_count');
         $q->addWhere('user_contact = ' . (int) $oid);
         $user_count = $q->loadResult();
         if ($user_count > 0) {
             $msg = $AppUI->_('contactsDeleteUserError');
             return false;
         }
     }
     return parent::canDelete($msg, $oid, $joins);
 }
开发者ID:magsilva,项目名称:dotproject,代码行数:17,代码来源:contacts.class.php

示例9: _createProjectSelection

 protected function _createProjectSelection($AppUI, $project_name)
 {
     $output .= '<tr><td align="right">' . $AppUI->_('Project Name') . ':</td>';
     $q = new DBQuery();
     $q->addQuery('project_id');
     $q->addTable('projects');
     $q->addWhere("project_name = '{$project_name}'");
     $project_id = $q->loadResult();
     $output .= '<td>';
     $output .= '<input type="text" name="new_project" value="' . $project_name . '" size="36" />';
     if ($project_id) {
         $output .= '<input type="hidden" name="project_id" value="' . $project_id . '" />';
         $output .= $AppUI->_('pexist');
     }
     $output .= '</td></tr>';
     return $output;
 }
开发者ID:hoodoogurus,项目名称:dotprojecteap,代码行数:17,代码来源:importers.class.php

示例10: sendNewPass

function sendNewPass()
{
    global $AppUI;
    $_live_site = dPgetConfig('base_url');
    $_sitename = dPgetConfig('company_name');
    // ensure no malicous sql gets past
    $checkusername = trim(dPgetParam($_POST, 'checkusername', ''));
    $checkusername = db_escape($checkusername);
    $confirmEmail = trim(dPgetParam($_POST, 'checkemail', ''));
    $confirmEmail = mb_strtolower(db_escape($confirmEmail));
    $q = new DBQuery();
    $q->addTable('users', 'u');
    $q->addQuery('u.user_id');
    $q->addWhere('user_username=\'' . $checkusername . '\' AND LOWER(contact_email)=\'' . $confirmEmail . '\'');
    $q->leftJoin('contacts', 'c', 'u.user_contact = c.contact_id');
    if (!($user_id = $q->loadResult()) || !$checkusername || !$confirmEmail) {
        $AppUI->setMsg('Invalid username or email.', UI_MSG_ERROR);
        $AppUI->redirect();
    }
    $newpass = makePass();
    $message = $AppUI->_('sendpass0', UI_OUTPUT_RAW) . ' ' . $checkusername . ' ' . $AppUI->_('sendpass1', UI_OUTPUT_RAW) . ' ' . $_live_site . ' ' . $AppUI->_('sendpass2', UI_OUTPUT_RAW) . ' ' . $newpass . ' ' . $AppUI->_('sendpass3', UI_OUTPUT_RAW);
    $subject = "{$_sitename} :: " . $AppUI->_('sendpass4', UI_OUTPUT_RAW) . " - {$checkusername}";
    $m = new Mail();
    // create the mail
    $m->From("dotProject@" . dPgetConfig('site_domain'));
    $m->To($confirmEmail);
    $m->Subject($subject);
    $m->Body($message, isset($GLOBALS['locale_char_set']) ? $GLOBALS['locale_char_set'] : "");
    // set the body
    $m->Send();
    // send the mail
    $newpass = md5($newpass);
    $q->clear();
    $q->addTable('users');
    $q->addUpdate('user_password', $newpass, true);
    $q->addWhere('user_id=\'' . $user_id . '\'');
    $cur = $q->exec();
    if (!$cur) {
        die('SQL error' . $database->stderr(true));
    } else {
        $AppUI->setMsg('New User Password created and emailed to you');
        $AppUI->redirect();
    }
}
开发者ID:222elm,项目名称:dotprojectFrame,代码行数:44,代码来源:sendpass.php

示例11: SUM

    $q->addQuery('ut.user_id,	u.user_username');
    $q->addQuery('contact_email, ut.perc_assignment, SUM(ut.perc_assignment) AS assign_extent');
    $q->addQuery('contact_first_name, contact_last_name');
    $q->addTable('user_tasks', 'ut');
    $q->leftJoin('users', 'u', 'u.user_id = ut.user_id');
    $q->leftJoin('contacts', 'c', 'u.user_contact = c.contact_id');
    $q->addWhere('ut.task_id = ' . (int) $row['task_id']);
    $q->addGroup('ut.user_id');
    $q->addOrder('perc_assignment desc, user_username');
    $assigned_users = array();
    $row['task_assigned_users'] = $q->loadList();
    $q->addQuery('count(task_id) as children');
    $q->addTable('tasks');
    $q->addWhere('task_parent = ' . (int) $row['task_id']);
    $q->addWhere('task_id <> task_parent');
    $row['children'] = $q->loadResult();
    $row['style'] = taskstyle_pd($row);
    $i = count($projects[$row['task_project']]['tasks']) + 1;
    $row['task_number'] = $i;
    $row['node_id'] = 'node_' . $i . '-' . $row['task_id'];
    if (strpos($row['task_duration'], '.') && $row['task_duration_type'] == 1) {
        $row['task_duration'] = floor($row['task_duration']) . ':' . round(60 * ($row['task_duration'] - floor($row['task_duration'])));
    }
    //pull the final task row into array
    $projects[$row['task_project']]['tasks'][] = $row;
}
$showEditCheckbox = isset($canEditTasks) && $canEditTasks || $perms->checkModule('admin', 'view');
$durnTypes = w2PgetSysVal('TaskDurationType');
$tempoTask = new CTask();
$userAlloc = $tempoTask->getAllocation('user_id');
?>
开发者ID:joly,项目名称:web2project,代码行数:31,代码来源:vw_projecttask.php

示例12: IN

        if ($where == ',') {
            $where = '0';
        }
    }
    $where = $where ? 'contact_company IN(' . $where . ')' : '';
} else {
    if (!$company_id) {
        //  Contacts from all allowed companies
        $where = "contact_company = ''" . " OR (contact_company IN ('" . implode('\',\'', array_values($aCpies_esc)) . "'))" . " OR (contact_company IN ('" . implode('\',\'', array_keys($aCpies_esc)) . "'))";
        $company_name = $AppUI->_('Allowed Companies');
    } else {
        // Contacts for this company only
        $q->addTable('companies', 'c');
        $q->addQuery('c.company_name');
        $q->addWhere('company_id = ' . $company_id);
        $company_name = $q->loadResult();
        $q->clear();
        /*
        	$sql = "select c.company_name from companies as c where company_id = $company_id";
        	$company_name = db_loadResult($sql);
        */
        $company_name_sql = db_escape($company_name);
        $where = " (contact_company = '{$company_name_sql}' or contact_company = '{$company_id}')";
    }
}
// This should now work on company ID, but we need to be able to handle both
$q->addTable('contacts', 'a');
$q->leftJoin('companies', 'b', 'b.company_id = a.contact_company');
$q->leftJoin('departments', 'c', 'c.dept_id = a.contact_department');
$q->leftJoin('users', 'u', 'u.user_contact=a.contact_id');
$q->addQuery('a.contact_id, a.contact_first_name, a.contact_last_name,' . ' a.contact_company, a.contact_department');
开发者ID:222elm,项目名称:dotprojectFrame,代码行数:31,代码来源:contact_selector.php

示例13: dPuserHasRole

function dPuserHasRole($name)
{
    global $AppUI;
    $uid = $AppUI->user_id;
    $sql = "SELECT r.role_id FROM roles AS r,user_roles AS ur WHERE ur.user_id={$uid} AND ur.role_id=r.role_id AND r.role_name='{$name}'";
    $q = new DBQuery();
    $q->addTable('roles', 'r');
    $q->addTable('user_roles', 'ur');
    $q->addQuery('r.role_id');
    $q->addWhere("ur.user_id={$uid} AND ur.role_id=r.role_id AND r.role_name='{$name}'");
    return $q->loadResult();
}
开发者ID:n2i,项目名称:xvnkb,代码行数:12,代码来源:main_functions.php

示例14: updateHoursWorked

 private function updateHoursWorked($task_log_task)
 {
     $q = new DBQuery();
     $q->addQuery('SUM(task_log_hours)');
     $q->addTable('task_log');
     $q->addWhere('task_log_task = ' . (int) $task_log_task);
     $totalHours = $q->loadResult();
     CTask::updateHoursWorked($task_log_task, $totalHours);
 }
开发者ID:joly,项目名称:web2project,代码行数:9,代码来源:tasks.class.php

示例15: dPuserHasRole

function dPuserHasRole($name)
{
    global $AppUI;
    $uid = (int) $AppUI->user_id;
    $q = new DBQuery();
    $q->addTable('roles', 'r');
    $q->innerJoin('user_roles', 'ur', 'ur.role_id=r.role_id');
    $q->addQuery('r.role_id');
    $q->addWhere("ur.user_id={$uid} AND r.role_name='{$name}'");
    return $q->loadResult();
}
开发者ID:hightechcompany,项目名称:dotproject,代码行数:11,代码来源:main_functions.php


注:本文中的DBQuery::loadResult方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。