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


PHP w2p_Database_Query::setDelete方法代码示例

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


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

示例1: deleteByObject

 public function deleteByObject($object_id)
 {
     $q = new w2p_Database_Query();
     $q->setDelete('custom_fields_values');
     $q->addWhere('value_object_id=' . (int) $object_id);
     $q->exec();
 }
开发者ID:illuminate3,项目名称:web2project,代码行数:7,代码来源:CustomField.class.php

示例2: delete

 public function delete()
 {
     $q = new w2p_Database_Query();
     $q->setDelete('custom_fields_lists');
     $q->addWhere('field_id = ' . (int) $this->field_id);
     $q->addWhere('list_option_id = ' . (int) $this->list_option_id);
     return $q->exec();
 }
开发者ID:illuminate3,项目名称:web2project,代码行数:8,代码来源:CustomOptionList.class.php

示例3: remove

 public function remove()
 {
     $q = new w2p_Database_Query();
     $q->dropTable('links');
     $q->exec();
     $q->clear();
     $q->setDelete('sysvals');
     $q->addWhere('sysval_title = \'LinkType\'');
     $q->exec();
 }
开发者ID:,项目名称:,代码行数:10,代码来源:

示例4: store

 public function store(CAppUI $AppUI = null)
 {
     global $AppUI;
     $perms = $AppUI->acl();
     $stored = false;
     $this->_error = $this->check();
     if (count($this->_error)) {
         return $this->_error;
     }
     $q = new w2p_Database_Query();
     if ($this->message_id && $perms->checkModuleItem('forums', 'edit', $this->forum_id)) {
         $q->setDelete('forum_visits');
         $q->addWhere('visit_message = ' . (int) $this->message_id);
         $q->exec();
         if ($msg = parent::store()) {
             return $msg;
         }
         $stored = true;
     }
     if (0 == $this->message_id && $perms->checkModuleItem('forums', 'add')) {
         $this->message_date = $q->dbfnNowWithTZ();
         if ($msg = parent::store()) {
             return $msg;
         }
         $q->addTable('forum_messages');
         $q->addQuery('count(message_id), MAX(message_date)');
         $q->addWhere('message_forum = ' . (int) $this->message_forum);
         $reply = $q->fetchRow();
         //update forum descriptor
         $forum = new CForum();
         $forum->load($AppUI, $this->message_forum);
         $forum->forum_message_count = $reply[0];
         /*
          * Note: the message_date here has already been adjusted for the
          *    timezone above, so don't do it again!
          */
         $forum->forum_last_date = $this->message_date;
         $forum->forum_last_id = $this->message_id;
         $forum->store($AppUI);
         $this->sendWatchMail(false);
         $stored = true;
     }
     return $stored;
 }
开发者ID:viniciusbudines,项目名称:sisnuss,代码行数:44,代码来源:forummessage.class.php

示例5: unpinUserTask

 public static function unpinUserTask($userId, $taskId)
 {
     $q = new w2p_Database_Query();
     $q->setDelete('user_task_pin');
     $q->addWhere('user_id = ' . (int) $userId);
     $q->addWhere('task_id = ' . (int) $taskId);
     if (!$q->exec()) {
         return 'Error unpinning task';
     } else {
         return true;
     }
 }
开发者ID:eureka2,项目名称:web2project,代码行数:12,代码来源:tasks.class.php

示例6: die

/* $Id: do_watch_forum.php 1595 2011-01-17 07:37:10Z caseydk $ $URL: https://web2project.svn.sourceforge.net/svnroot/web2project/tags/version2.4/modules/forums/do_watch_forum.php $ */
if (!defined('W2P_BASE_DIR')) {
    die('You should not access this file directly.');
}
$perms =& $AppUI->acl();
if (!canView('forums')) {
    $AppUI->redirect('m=public&a=access_denied');
}
##
## Change forum watches
##
$watch = w2PgetParam($_POST, 'watch', '');
if ($watch) {
    // clear existing watches
    $q = new w2p_Database_Query();
    $q->setDelete('forum_watch');
    $q->addWhere('watch_user = ' . (int) $AppUI->user_id);
    $q->addWhere('watch_' . $watch . ' IS NOT NULL');
    if (!$q->exec()) {
        $AppUI->setMsg(db_error(), UI_MSG_ERROR);
        $q->clear();
    } else {
        $q->clear();
        foreach ($_POST as $k => $v) {
            if (strpos($k, 'forum_') !== false) {
                $q->addTable('forum_watch');
                $q->addInsert('watch_user', $AppUI->user_id);
                $q->addInsert('watch_' . $watch, substr($k, 6));
                if (!$q->exec()) {
                    $AppUI->setMsg(db_error(), UI_MSG_ERROR);
                } else {
开发者ID:viniciusbudines,项目名称:sisnuss,代码行数:31,代码来源:do_watch_forum.php

示例7: projects_list_data

function projects_list_data($user_id = false)
{
    global $AppUI, $addPwOiD, $buffer, $company, $company_id, $company_prefix, $deny, $department, $dept_ids, $w2Pconfig, $orderby, $orderdir, $tasks_problems, $owner, $projectTypeId, $search_text, $project_type;
    $addProjectsWithAssignedTasks = $AppUI->getState('addProjWithTasks') ? $AppUI->getState('addProjWithTasks') : 0;
    // get any records denied from viewing
    $obj = new CProject();
    $deny = $obj->getDeniedRecords($AppUI->user_id);
    // Let's delete temproary tables
    $q = new w2p_Database_Query();
    $q->setDelete('tasks_problems');
    $q->exec();
    $q->clear();
    $q->setDelete('tasks_users');
    $q->exec();
    $q->clear();
    // support task problem logs
    $q->addInsertSelect('tasks_problems');
    $q->addTable('tasks');
    $q->addQuery('task_project, task_log_problem');
    $q->addJoin('task_log', 'tl', 'tl.task_log_task = task_id', 'inner');
    $q->addWhere('task_log_problem = 1');
    $q->addGroup('task_project');
    $tasks_problems = $q->exec();
    $q->clear();
    if ($addProjectsWithAssignedTasks) {
        // support users tasks
        $q->addInsertSelect('tasks_users');
        $q->addTable('tasks');
        $q->addQuery('task_project');
        $q->addQuery('ut.user_id');
        $q->addJoin('user_tasks', 'ut', 'ut.task_id = tasks.task_id');
        if ($user_id) {
            $q->addWhere('ut.user_id = ' . (int) $user_id);
        }
        $q->addOrder('task_end_date DESC');
        $q->addGroup('task_project');
        $tasks_users = $q->exec();
        $q->clear();
    }
    // add Projects where the Project Owner is in the given department
    if ($addPwOiD && isset($department)) {
        $owner_ids = array();
        $q->addTable('users');
        $q->addQuery('user_id');
        $q->addJoin('contacts', 'c', 'c.contact_id = user_contact', 'inner');
        $q->addWhere('c.contact_department = ' . (int) $department);
        $owner_ids = $q->loadColumn();
        $q->clear();
    }
    if (isset($department)) {
        //If a department is specified, we want to display projects from the department, and all departments under that, so we need to build that list of departments
        $dept_ids = array();
        $q->addTable('departments');
        $q->addQuery('dept_id, dept_parent');
        $q->addOrder('dept_parent,dept_name');
        $rows = $q->loadList();
        addDeptId($rows, $department);
        $dept_ids[] = isset($department->dept_id) ? $department->dept_id : 0;
        $dept_ids[] = $department > 0 ? $department : 0;
    }
    $q->clear();
    // retrieve list of records
    // modified for speed
    // by Pablo Roca (pabloroca@mvps.org)
    // 16 August 2003
    // get the list of permitted companies
    $obj = new CCompany();
    $companies = $obj->getAllowedRecords($AppUI->user_id, 'companies.company_id,companies.company_name', 'companies.company_name');
    if (count($companies) == 0) {
        $companies = array();
    }
    $q->addTable('projects', 'pr');
    $q->addQuery('pr.project_id, project_status, project_color_identifier,
		project_type, project_name, project_description, project_scheduled_hours as project_duration,
		project_parent, project_original_parent, project_percent_complete,
		project_color_identifier, project_company,
        company_name, project_status, project_last_task as critical_task,
        tp.task_log_problem, user_username, project_active');
    $fields = w2p_Core_Module::getSettings('projects', 'index_list');
    unset($fields['department_list']);
    // added as an alias below
    foreach ($fields as $field => $text) {
        $q->addQuery($field);
    }
    $q->addQuery('CONCAT(ct.contact_first_name, \' \', ct.contact_last_name) AS owner_name');
    $q->addJoin('users', 'u', 'pr.project_owner = u.user_id');
    $q->addJoin('contacts', 'ct', 'ct.contact_id = u.user_contact');
    $q->addJoin('tasks_problems', 'tp', 'pr.project_id = tp.task_project');
    if ($addProjectsWithAssignedTasks) {
        $q->addJoin('tasks_users', 'tu', 'pr.project_id = tu.task_project');
    }
    if (!isset($department) && $company_id && !$addPwOiD) {
        $q->addWhere('pr.project_company = ' . (int) $company_id);
    }
    if ($project_type > -1) {
        $q->addWhere('pr.project_type = ' . (int) $project_type);
    }
    if (isset($department) && !$addPwOiD) {
        $q->addWhere('project_departments.department_id in ( ' . implode(',', $dept_ids) . ' )');
    }
//.........这里部分代码省略.........
开发者ID:viniciusbudines,项目名称:sisnuss,代码行数:101,代码来源:cleanup_functions.php

示例8: delete

 public function delete()
 {
     $q = new w2p_Database_Query();
     if ($this->sysval_title) {
         $q->setDelete('sysvals');
         $q->addWhere('sysval_title = \'' . $this->sysval_title . '\'');
         if (!$q->exec()) {
             $q->clear();
             return get_class($this) . '::delete failed <br />' . db_error();
         }
     }
     return null;
 }
开发者ID:eureka2,项目名称:web2project,代码行数:13,代码来源:syskeys.class.php

示例9: delete

 public function delete(CAppUI $AppUI = null)
 {
     global $AppUI;
     global $helpdesk_available;
     $perms = $AppUI->acl();
     $this->_error = array();
     if ($perms->checkModuleItem('files', 'delete', $this->file_id)) {
         // remove the file from the file system
         if (!$this->deleteFile($AppUI)) {
             return false;
         }
         if ($msg = parent::delete()) {
             return $msg;
         }
         // delete any index entries
         $q = new w2p_Database_Query();
         $q->setDelete('files_index');
         $q->addQuery('*');
         $q->addWhere('file_id = ' . (int) $this->file_id);
         if (!$q->exec()) {
             $q->clear();
             return db_error();
         }
         if ($helpdesk_available && $this->file_helpdesk_item != 0) {
             $this->addHelpDeskTaskLog();
         }
         return true;
     }
     return false;
 }
开发者ID:eureka2,项目名称:web2project,代码行数:30,代码来源:files.class.php

示例10: commit_updates

 public function commit_updates()
 {
     $q = new w2p_Database_Query();
     if (count($this->delete_list)) {
         $q->setDelete($this->table);
         $q->addWhere('queue_id IN (' . implode(',', $this->delete_list) . ')');
         $q->exec();
         $q->clear();
     }
     $this->delete_list = array();
     foreach ($this->update_list as $fields) {
         $q->addTable($this->table);
         $q->addUpdate('queue_repeat_count', $fields['queue_repeat_count']);
         $q->addUpdate('queue_start', $fields['queue_start']);
         $q->addWhere('queue_id = ' . $fields['queue_id']);
         $q->exec();
         $q->clear();
     }
     $this->update_list = array();
 }
开发者ID:viniciusbudines,项目名称:sisnuss,代码行数:20,代码来源:EventQueue.class.php

示例11: updateAssigned

 public function updateAssigned($assigned)
 {
     // First remove the assigned from the user_events table
     global $AppUI;
     $q = new w2p_Database_Query();
     $q->setDelete('user_events');
     $q->addWhere('event_id = ' . (int) $this->event_id);
     $q->exec();
     $q->clear();
     if (is_array($assigned) && count($assigned)) {
         foreach ($assigned as $uid) {
             if ($uid) {
                 $q->addTable('user_events', 'ue');
                 $q->addInsert('event_id', $this->event_id);
                 $q->addInsert('user_id', (int) $uid);
                 $q->exec();
                 $q->clear();
             }
         }
         if ($msg = db_error()) {
             $AppUI->setMsg($msg, UI_MSG_ERROR);
         }
     }
 }
开发者ID:eureka2,项目名称:web2project,代码行数:24,代码来源:calendar.class.php

示例12: delete

 public function delete(CAppUI $AppUI = null)
 {
     global $AppUI;
     $perms = $AppUI->acl();
     $this->_error = array();
     if ($perms->checkModuleItem('forums', 'delete', $this->forum_id)) {
         $q = new w2p_Database_Query();
         $q->setDelete('forum_visits');
         $q->addWhere('visit_forum = ' . (int) $this->forum_id);
         $q->exec();
         // No error if this fails, it is not important.
         $q->clear();
         $q->setDelete('forum_messages');
         $q->addWhere('message_forum = ' . (int) $this->forum_id);
         if (!$q->exec()) {
             return db_error();
         }
         if ($msg = parent::delete()) {
             return $msg;
         }
         return true;
     }
     return false;
 }
开发者ID:eureka2,项目名称:web2project,代码行数:24,代码来源:forums.class.php

示例13: resource_postsave

/**
 * postsave functions are only called after a succesful save.  They are
 * used to perform database operations after the event.
 */
function resource_postsave()
{
    global $other_resources;
    global $obj;
    $task_id = $obj->task_id;
    if (isset($other_resources)) {
        $value = array();
        $reslist = explode(';', $other_resources);
        foreach ($reslist as $res) {
            if ($res) {
                list($resource, $perc) = explode('=', $res);
                $value[] = array($task_id, $resource, $perc);
            }
        }
        // first delete any elements already there, then replace with this
        // list.
        $q = new w2p_Database_Query();
        $q->setDelete('resource_tasks');
        $q->addWhere('task_id = ' . (int) $obj->task_id);
        $q->exec();
        $q->clear();
        if (count($value)) {
            foreach ($value as $v) {
                $q->addTable('resource_tasks');
                $q->addInsert('task_id,resource_id,percent_allocated', $v, true);
                $q->exec();
                $q->clear();
            }
        }
    }
}
开发者ID:eureka2,项目名称:web2project,代码行数:35,代码来源:cleanup_functions.php

示例14: gc

 public function gc()
 {
     global $AppUI;
     $max = $this->convertTime('max_lifetime');
     $idle = $this->convertTime('idle_time');
     // First pass is to kill any users that are logged in at the time of the session.
     $where = 'UNIX_TIMESTAMP() - UNIX_TIMESTAMP(session_updated) > ' . $idle . ' OR UNIX_TIMESTAMP() - UNIX_TIMESTAMP(session_created) > ' . $max;
     $q = new w2p_Database_Query();
     $q->addTable('user_access_log');
     $q->addUpdate('date_time_out', $q->dbfnNowWithTZ());
     $q2 = new w2p_Database_Query();
     $q2->addTable('sessions');
     $q2->addQuery('session_user');
     $q2->addWhere($where);
     $q->addWhere('user_access_log_id IN ( ' . $q2->prepare() . ' )');
     $q->exec();
     $q->clear();
     $q2->clear();
     // Now we simply delete the expired sessions.
     $q->setDelete('sessions');
     $q->addWhere($where);
     $q->exec();
     $q->clear();
     if (w2PgetConfig('session_gc_scan_queue')) {
         // We need to scan the event queue.  If $AppUI isn't created yet
         // And it isn't likely that it will be, we create it and run the
         // queue scanner.
         if (!isset($AppUI)) {
             $AppUI = new w2p_Core_CAppUI();
             $queue = new w2p_System_EventQueue();
             $queue->scan();
         }
     }
     return true;
 }
开发者ID:illuminate3,项目名称:web2project,代码行数:35,代码来源:Session.class.php

示例15: delete

 public function delete(CAppUI $AppUI = null)
 {
     global $AppUI;
     $perms = $AppUI->acl();
     $result = false;
     $this->_error = array();
     if ($perms->checkModuleItem('forums', 'delete', $this->project_id)) {
         $q = new w2p_Database_Query();
         $q->setDelete('forum_visits');
         $q->addWhere('visit_message = ' . (int) $this->message_id);
         $q->exec();
         // No error if this fails, it is not important.
         $q->clear();
         $q->addTable('forum_messages');
         $q->addQuery('message_forum');
         $q->addWhere('message_id = ' . (int) $this->message_id);
         $forumId = $q->loadResult();
         $q->clear();
         $q->setDelete('forum_messages');
         $q->addWhere('message_id = ' . (int) $this->message_id);
         if (!$q->exec()) {
             $result = db_error();
         } else {
             $result = null;
         }
         $q->clear();
         $q->addTable('forum_messages');
         $q->addQuery('COUNT(message_id)');
         $q->addWhere('message_forum = ' . (int) $forumId);
         $messageCount = $q->loadResult();
         $q->clear();
         $q->addTable('forums');
         $q->addUpdate('forum_message_count', $messageCount);
         $q->addWhere('forum_id = ' . (int) $forumId);
         $q->exec();
         $result = true;
     }
     return $result;
 }
开发者ID:eureka2,项目名称:web2project,代码行数:39,代码来源:forummessage.class.php


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