コード例 #1
0
ファイル: system.class.php プロジェクト: magsilva/dotproject
 function install()
 {
     $sql = "SELECT mod_directory FROM modules WHERE mod_directory = '{$this->mod_directory}'";
     if (db_loadHash($sql, $temp)) {
         // the module is already installed
         // TODO: check for older version - upgrade
         return false;
     }
     $sql = 'SELECT max(mod_ui_order)
                     FROM modules';
     // We need to account for "pre-installed" modules that are "UI Inaccessible"
     // in order to make sure we get the "correct" initial value for .
     // mod_ui_order values of "UI Inaccessible" modules are irrelevant
     // and should probably be set to 0 so as not to interfere.
     $sql .= " WHERE mod_name NOT LIKE 'Public'";
     $this->mod_ui_order = db_loadResult($sql) + 1;
     $perms =& $GLOBALS['AppUI']->acl();
     $perms->addModule($this->mod_directory, $this->mod_name);
     // Determine if it is an admin module or not, then add it to the correct set
     if (!isset($this->mod_admin)) {
         $this->mod_admin = 0;
     }
     if ($this->mod_admin) {
         $perms->addGroupItem($this->mod_directory, "admin");
     } else {
         $perms->addGroupItem($this->mod_directory, "non_admin");
     }
     if (isset($this->permissions_item_table) && $this->permissions_item_table) {
         $perms->addModuleSection($this->permissions_item_table);
     }
     $this->store();
     return true;
 }
コード例 #2
0
 function install()
 {
     $sql = "SELECT mod_directory FROM modules WHERE mod_directory = '{$this->mod_directory}'";
     if (db_loadHash($sql, $temp)) {
         // the module is already installed
         // TODO: check for older version - upgrade
         return false;
     }
     $sql = 'SELECT max(mod_ui_order)
                     FROM modules';
     $this->mod_ui_order = db_loadResult($sql) + 1;
     $perms =& $GLOBALS['AppUI']->acl();
     $perms->addModule($this->mod_directory, $this->mod_name);
     // Determine if it is an admin module or not, then add it to the correct set
     if (!isset($this->mod_admin)) {
         $this->mod_admin = 0;
     }
     if ($this->mod_admin) {
         $perms->addGroupItem($this->mod_directory, "admin");
     } else {
         $perms->addGroupItem($this->mod_directory, "non_admin");
     }
     if (isset($this->permissions_item_table) && $this->permissions_item_table) {
         $perms->addModuleSection($this->permissions_item_table);
     }
     $this->store();
     return true;
 }
コード例 #3
0
/**
* This global function loads the first row of a query into an object
*
* If an object is passed to this function, the returned row is bound to the existing elements of <var>object</var>.
* If <var>object</var> has a value of null, then all of the returned query fields returned in the object. 
* @param string The SQL query
* @param object The address of variable
*/
function db_loadObject($sql, &$object, $bindAll = false, $strip = true)
{
    if ($object != null) {
        $hash = array();
        if (!db_loadHash($sql, $hash)) {
            return false;
        }
        bindHashToObject($hash, $object, null, $strip, $bindAll);
        return true;
    } else {
        $cur = db_exec($sql);
        $cur or exit(db_error());
        if ($object = db_fetch_object($cur)) {
            db_free_result($cur);
            return true;
        } else {
            $object = null;
            return false;
        }
    }
}
コード例 #4
0
ファイル: addedit.php プロジェクト: n2i/xvnkb
        }
        $q->addTable('history');
        $q->addUpdate('history_item = history_id');
        $q->addWhere('history_table = \'history\'');
        $okMsg = 'History deleted';
    }
    $q->clear();
    $AppUI->redirect();
}
// pull the history
$q->addTable('history');
$q->addQuery('*');
$q->addWhere('history_id =' . $history_id);
$sql = $q->prepare();
$q->clear();
db_loadHash($sql, $history);
?>

<form name="AddEdit" method="post">				
<table width="100%" border="0" cellpadding="0" cellspacing="1">
<input name="action" type="hidden" value="<?php 
echo $history_id ? "update" : "add";
?>
">
<tr>
	<td><img src="./images/icons/tasks.gif" alt="" border="0"></td>
	<td align="left" nowrap="nowrap" width="100%"><h1><?php 
echo $AppUI->_($history_id ? 'Edit history' : 'New history');
?>
</h1></td>
</tr>
コード例 #5
0
ファイル: vw_logs.php プロジェクト: slawekmikula/dotproject
</th>
	<th width="100%"><?php 
echo $AppUI->_('Comments');
?>
</th>
	<th></th>
</tr>
<?php 
// Pull the task comments
$sql = "\nSELECT task_log.*, user_username\nFROM task_log\nLEFT JOIN users ON user_id = task_log_creator\nWHERE task_log_help_desk_id = {$item_id}\nORDER BY task_log_date\n";
$logs = db_loadList($sql);
$s = '';
$hrs = 0;
// Pull help desk item details
$sql = "SELECT item_company_id,item_created_by\n        FROM helpdesk_items hi\n        WHERE item_id = '{$item_id}'";
db_loadHash($sql, $hditem);
$canEdit = hditemEditable($hditem);
$df = $AppUI->getPref('SHDATEFORMAT');
foreach ($logs as $row) {
    $task_log_date = intval($row['task_log_date']) ? new CDate($row['task_log_date']) : null;
    $s .= '<tr bgcolor="white" valign="top">';
    $s .= "\n\t<td>";
    if ($canEdit) {
        $s .= "\n\t\t<a href=\"?m=helpdesk&a=view&item_id={$item_id}&tab=1&task_log_id=" . @$row['task_log_id'] . "\">" . "\n\t\t\t" . dPshowImage('./images/icons/stock_edit-16.png', 16, 16, '') . "\n\t\t</a>";
    }
    $s .= "\n\t</td>";
    $s .= '<td nowrap="nowrap">' . ($task_log_date ? $task_log_date->format($df) : '-') . '</td>';
    $s .= '<td width="30%">' . @$row["task_log_name"] . '</td>';
    $s .= '<td width="100">' . $row["user_username"] . '</td>';
    $s .= '<td width="100" align="right">' . sprintf("%.2f", $row["task_log_hours"]) . '</td>';
    $s .= '<td width="100">' . $task_log_costcodes[$row["task_log_costcode"]] . '</td>';
コード例 #6
0
if (isset($_GET['tab'])) {
    $AppUI->setState('UserVwTab', $_GET['tab']);
}
$tab = $AppUI->getState('UserVwTab') !== NULL ? $AppUI->getState('UserVwTab') : 0;
// pull data
$q = new DBQuery();
$q->addTable('users', 'u');
$q->addQuery('u.*');
$q->addQuery('con.*, company_id, company_name, dept_name, dept_id');
$q->addJoin('contacts', 'con', 'user_contact = contact_id');
$q->addJoin('companies', 'com', 'contact_company = company_id');
$q->addJoin('departments', 'dep', 'dept_id = contact_department');
$q->addWhere('u.user_id = ' . $user_id);
$sql = $q->prepare();
$q->clear();
if (!db_loadHash($sql, $user)) {
    $titleBlock = new CTitleBlock('Invalid User ID', 'helix-setup-user.png', $m, "{$m}.{$a}");
    $titleBlock->addCrumb('?m=admin', 'users list');
    $titleBlock->show();
} else {
    // setup the title block
    $titleBlock = new CTitleBlock('View User', 'helix-setup-user.png', $m, "{$m}.{$a}");
    if ($canRead) {
        $titleBlock->addCrumb('?m=admin', 'users list');
    }
    if ($canEdit) {
        $titleBlock->addCrumb('?m=admin&amp;a=addedituser&amp;user_id=' . $user_id, 'edit this user');
    }
    if ($canEdit || $user_id == $AppUI->user_id) {
        $titleBlock->addCrumb('?m=system&amp;a=addeditpref&amp;user_id=' . $user_id, 'edit preferences');
        $titleBlock->addCrumbRight('<a href="#" onclick="popChgPwd();return false">' . $AppUI->_('change password') . '</a>');
コード例 #7
0
ファイル: vw_newlog.php プロジェクト: slawekmikula/dotproject
if ($denyEdit) {
    $AppUI->redirect("m=public&a=access_denied");
}
require_once $AppUI->getSystemClass('date');
//***START MOD*** pedroa 20050609
require_once $AppUI->getModuleClass('projects');
global $AppUI;
//***END MOD
$df = $AppUI->getPref('SHDATEFORMAT');
$tid = isset($_GET['tid']) ? $_GET['tid'] : 0;
$winnow_project = getPermsWhereClause("projects", "projects.project_id");
$winnow_tasks = getPermsWhereClause("tasks", "tasks.task_id");
//pull data
// if we have a TID, then we editing an existing row
$sql = " \nSELECT task_log.*, project_name, task_name, task_project, project_company \nFROM task_log\nLEFT JOIN tasks ON task_id = task_log_task\nLEFT JOIN projects ON project_id = task_project\nWHERE  task_log_id = {$tid} \n\tAND {$winnow_project}\n\tAND {$winnow_tasks}\n";
db_loadHash($sql, $task);
$is_new_record = !$tid;
$task_found = $task['project_company'] != FALSE;
$require_task_info = $is_new_record || $task_found;
global $TIMECARD_CONFIG;
//Prevent users from editing other ppls timecards.
$can_edit_other_timesheets = $TIMECARD_CONFIG['minimum_edit_level'] >= $AppUI->user_type;
if (!$can_edit_other_timesheets) {
    if (isset($_GET['tid']) && (isset($v['task_log_creator']) && $task['task_log_creator'] != $AppUI->user_id || !isset($task['task_log_creator']))) {
        $AppUI->redirect("m=public&a=access_denied");
    }
}
$AppUI->savePlace();
if (isset($task['task_log_date'])) {
    $date = new CDate($task['task_log_date']);
} else {
コード例 #8
0
 function getProject()
 {
     $q = new DBQuery();
     $q->addTable('projects');
     $q->addQuery('project_name, project_short_name, project_color_identifier');
     $q->addWhere("project_id = '" . $this->task_project . "'");
     $sql = $q->prepare();
     $q->clear();
     $proj = db_loadHash($sql, $projects);
     return $projects;
 }
コード例 #9
0
if ($filter != null) {
    $q->addWhere($filter);
}
$q->addOrder($name_field);
$company_list = array("0" => "") + $q->loadHashList();
?>

<?php 
if (dPgetParam($_POST, $id_field, 0) != 0) {
    $q = new DBQuery();
    $q->addTable($table_name);
    $q->addQuery('*');
    $q->addWhere("{$id_field}=" . $_POST[$id_field]);
    $sql = $q->prepare();
    $q->clear();
    db_loadHash($sql, $r_data);
    $data_update_script = "";
    $update_address = isset($_POST["overwrite_address"]);
    if ($table_name == "companies") {
        $update_fields = array();
        if ($update_address) {
            $update_fields = array("company_address1" => "contact_address1", "company_address2" => "contact_address2", "company_city" => "contact_city", "company_state" => "contact_state", "company_zip" => "contact_zip", "company_phone1" => "contact_phone", "company_phone2" => "contact_phone2", "company_fax" => "contact_fax");
        }
        $data_update_script = "opener.setCompany('" . $_POST[$id_field] . "', '" . db_escape($r_data[$name_field]) . "');\n";
    } else {
        if ($table_name == "departments") {
            $update_fields = array("dept_id" => "contact_department");
            if ($update_address) {
                $update_fields = array("dept_address1" => "contact_address1", "dept_address2" => "contact_address2", "dept_city" => "contact_city", "dept_state" => "contact_state", "dept_zip" => "contact_zip", "dept_phone" => "contact_phone", "dept_fax" => "contact_fax");
            }
            $data_update_script = "opener.setDepartment('" . $_POST[$id_field] . "', '" . db_escape($r_data[$name_field]) . "');\n";
コード例 #10
0
ファイル: view.php プロジェクト: srinivasulurao/jonel
$item_id = dPgetParam($_GET, 'item_id', 0);
// Get pagination page
if (isset($_GET['page'])) {
    $AppUI->setState('HelpDeskLogPage', $_GET['page']);
} else {
    $AppUI->setState('HelpDeskLogPage', 0);
}
$page = $AppUI->getState('HelpDeskLogPage') ? $AppUI->getState('HelpDeskLogPage') : 0;
// Get tab state
if (isset($_GET['tab'])) {
    $AppUI->setState('HelpLogVwTab', $_GET['tab']);
}
$tab = $AppUI->getState('HelpLogVwTab') !== NULL ? $AppUI->getState('HelpLogVwTab') : 0;
// Pull data
$sql = "SELECT hi.*,\n        CONCAT(co.contact_first_name,' ',co.contact_last_name) assigned_to_fullname,\n        co.contact_email as assigned_email,\n        p.project_id,\n        p.project_name,\n        p.project_color_identifier,\n        c.company_name,\n        d.dept_name\n        FROM helpdesk_items hi\n        LEFT JOIN users u ON u.user_id = hi.item_assigned_to\n        LEFT JOIN contacts co ON co.contact_id = u.user_contact\n        LEFT JOIN projects p ON p.project_id = hi.item_project_id\n        LEFT JOIN companies c ON c.company_id = hi.item_company_id\n        LEFT JOIN departments d ON d.dept_id = hi.item_department_id\n        WHERE item_id = '{$item_id}'";
if (!db_loadHash($sql, $hditem)) {
    $titleBlock = new CTitleBlock($AppUI->_('Invalid item id'), 'helpdesk.png', $m, 'ID_HELP_HELPDESK_VIEW');
    $titleBlock->addCrumb("?m=helpdesk", 'Home');
    $titleBlock->addCrumb("?m=helpdesk&a=list", 'List');
    $titleBlock->show();
} else {
    // Check permissions on this record
    $canRead = hditemReadable($hditem);
    $canEdit = hditemEditable($hditem);
    if (!$canRead && !$canEdit) {
        $AppUI->redirect("m=public&a=access_denied");
    }
    $name = $hditem['item_requestor'];
    $assigned_to_name = $hditem["item_assigned_to"] ? $hditem["assigned_to_fullname"] : "";
    $assigned_email = $hditem["assigned_email"];
    $sql = "\n\tSELECT \n\t\thelpdesk_item_watchers.user_id, \n\t\tCONCAT(contact_first_name, ' ', contact_last_name) as name,\n\t\tcontact_email\n\tFROM \n\t\thelpdesk_item_watchers\n\t\tLEFT JOIN users ON helpdesk_item_watchers.user_id = users.user_id\n\t\tLEFT JOIN contacts ON user_contact = contact_id\n\tWHERE \n\t\titem_id = " . $item_id . "\n\tORDER BY contact_last_name, contact_first_name";
コード例 #11
0
ファイル: addedit.php プロジェクト: slawekmikula/dotproject
$q->addQuery('CONCAT( contact_first_name, \' \', contact_last_name)');
$q->addTable('users');
$q->leftJoin('contacts', 'c', 'user_contact = contact_id');
$q->addOrder('contact_first_name, contact_last_name');
$users = $q->loadHashList();
$q->clear();
$q->addQuery('project_id, project_name');
$q->addTable('projects');
$projects = $q->loadHashList();
$projects[0] = '[All]';
//Pull contact information
$q->clear();
$q->addQuery('*');
$q->addTable('risks');
$q->addWhere('risk_id = ' . $risk_id);
if (!db_loadHash($q->prepare(), $risk) && $risk_id > 0) {
    $titleBlock = new CTitleBlock('Invalid Risk ID', 'folder5.png', $m, "{$m}.{$a}");
    $titleBlock->addCrumb("?m=risks", "Risks list");
    $titleBlock->show();
    $tasks = array();
} else {
    if (isset($risk['risk_project'])) {
        $q->clear();
        $q->addQuery('task_id, task_name');
        $q->addTable('tasks');
        $q->addWhere('task_project = ' . $risk['risk_project']);
        $tasks = $q->loadHashList();
    } else {
        $tasks = array();
    }
    // setup the title block
コード例 #12
0
 function getProject()
 {
     $sql = "SELECT project_name, project_short_name, project_color_identifier FROM projects WHERE project_id = '{$this->task_project}'";
     $proj = db_loadHash($sql, $projects);
     return $projects;
 }
コード例 #13
0
ファイル: addedit.php プロジェクト: slawekmikula/dotproject
        } else {
            if ($action == "del") {
                $sql = "DELETE FROM holiday WHERE holiday_id = " . $holiday_id;
                $okMsg = "Holiday removed";
            }
        }
    }
    if (!db_exec($sql)) {
        $AppUI->setMsg(db_error());
    } else {
        $AppUI->setMsg($okMsg);
    }
    $AppUI->redirect();
}
// pull the holiday from the database
db_loadHash("SELECT * FROM holiday WHERE holiday_id = {$holiday_id}", $holiday);
if ($holiday_white == -1) {
    $holiday_white = $holiday['holiday_white'];
}
?>

<script language="javascript">
var calendarField = '';
function popCalendar( field ){
        calendarField = field;
        idate = eval( 'document.AddEdit.log_' + field + '.value' );
        window.open( 'index.php?m=public&a=calendar&dialog=1&callback=setCalendar&date=' + idate, 'calwin', 'width=250, height=220, scollbars=false' );
}
function setCalendar( idate, fdate ) {
        fld_date = eval( 'document.AddEdit.log_' + calendarField );
        fld_fdate = eval( 'document.AddEdit.' + calendarField );
コード例 #14
0
ファイル: addedit.php プロジェクト: slawekmikula/dotproject
            if ($action == "del") {
                $sql = "DELETE FROM journal WHERE journal_id = {$journal_id}";
                $okMsg = "journal deleted";
            }
        }
    }
    if (!db_exec($sql)) {
        $AppUI->setMsg(db_error());
    } else {
        $AppUI->setMsg($okMsg);
    }
    $AppUI->redirect();
}
// pull the journal
$sql = "SELECT * FROM journal WHERE journal_id = {$journal_id}";
db_loadHash($sql, $journal);
if ($journal["journal_project"]) {
    $project_id = $journal["journal_project"];
}
?>

<form name="AddEdit" method="post">				
<table width="100%" border="0" cellpadding="0" cellspacing="1">
<input name="action" type="hidden" value="<?php 
echo $journal_id ? "update" : "add";
?>
">
<tr>
	<td><img src="./images/icons/notepad.gif" alt="" border="0"></td>
	<td align="left" nowrap="nowrap" width="100%"><h1><?php 
echo $AppUI->_($journal_id ? 'Edit Note' : 'New Note');
コード例 #15
0
ファイル: view.php プロジェクト: srinivasulurao/jonel
if ($dept_id > 0) {
    // pull data
    $q = new DBQuery();
    $q->addTable('companies', 'com');
    $q->addTable('departments', 'dep');
    $q->addQuery('dep.*, company_name');
    $q->addQuery('con.contact_first_name');
    $q->addQuery('con.contact_last_name');
    $q->addJoin('users', 'u', 'u.user_id = dep.dept_owner');
    $q->addJoin('contacts', 'con', 'u.user_contact = con.contact_id');
    $q->addWhere('dep.dept_id = ' . $dept_id);
    $q->addWhere('dep.dept_company = company_id');
    $sql = $q->prepare();
    $q->clear();
}
if (!db_loadHash($sql, $dept)) {
    $titleBlock = new CTitleBlock('Invalid Department ID', 'users.gif', $m, $m . '.' . $a);
    $titleBlock->addCrumb('?m=companies', 'companies list');
    $titleBlock->show();
} else {
    if ($dept_id <= 0) {
        echo $AppUI->_('Please choose a Department first!');
    } else {
        $company_id = $dept['dept_company'];
        if (!$min_view) {
            // setup the title block
            $titleBlock = new CTitleBlock('View Department', 'users.gif', $m, $m . '.' . $a);
            if ($canEdit) {
                $titleBlock->addCell();
                $titleBlock->addCell('<form action="?m=departments&amp;a=addedit&amp;company_id=' . $company_id . '&amp;dept_parent=' . $dept_id . '" method="post">' . '<input type="submit" class="button" value="' . $AppUI->_('new department') . '" />' . '</form>');
            }
コード例 #16
0
 function getDepartmentDetails()
 {
     $result = array('dept_id' => 0, 'dept_name' => '');
     if (!$this->contact_department) {
         return $result;
     }
     $sql = "select dept_id, dept_name from departments";
     $q = new DBQuery();
     $q->addTable('departments');
     $q->addQuery('dept_id, dept_name');
     if ($this->is_alpha($this->contact_department)) {
         $q->addWhere("dept_name = '" . $this->contact_department . "'");
     } else {
         $q->addWhere("dept_id = '" . $this->contact_department . "'");
     }
     $sql = $q->prepare();
     $q->clear();
     db_loadHash($sql, $result);
     return $result;
 }
コード例 #17
0
ファイル: addedituser.php プロジェクト: kaz190/dotproject
$roles_arr = array();
foreach ($roles as $role) {
    $roles_arr[$role['id']] = $role['name'];
}
$roles_arr = arrayMerge(array(0 => ''), $roles_arr);
$q = new DBQuery();
$q->addTable('users', 'u');
$q->addQuery('u.*');
$q->addQuery('con.*, company_id, company_name, dept_name');
$q->addJoin('contacts', 'con', 'user_contact = contact_id');
$q->addJoin('companies', 'com', 'contact_company = company_id');
$q->addJoin('departments', 'dep', 'dept_id = contact_department');
$q->addWhere('u.user_id = ' . $user_id);
$sql = $q->prepare();
$q->clear();
if (!db_loadHash($sql, $user) && $user_id > 0) {
    $titleBlock = new CTitleBlock('Invalid User ID', 'helix-setup-user.png', $m, "{$m}.{$a}");
    $titleBlock->addCrumb("?m=admin", "users list");
    $titleBlock->show();
} else {
    if ($user_id == 0) {
        $user['contact_id'] = 0;
    }
    // pull companies
    $q = new DBQuery();
    $q->addTable('companies');
    $q->addQuery('company_id, company_name');
    $q->addOrder('company_name');
    $companies = arrayMerge(array(0 => ''), $q->loadHashList());
    // setup the title block
    $ttl = $user_id > 0 ? "Edit User" : "Add User";
コード例 #18
0
ファイル: addedit.php プロジェクト: juliogallardo1326/proc
$dept_id = isset($_GET['dept_id']) ? $_GET['dept_id'] : 0;
$company_id = isset($_GET['company_id']) ? $_GET['company_id'] : 0;
// check permissions for this department
$canEdit = !getDenyEdit($m, $dept_id);
if (!$canEdit) {
    $AppUI->redirect("m=public&a=access_denied");
}
// pull data for this department
$q = new DBQuery();
$q->addTable('departments', 'dep');
$q->addQuery('dep.*, company_name');
$q->addJoin('companies', 'com', 'com.company_id = dep.dept_company');
$q->addWhere('dep.dept_id = ' . $dept_id);
$sql = $q->prepare();
$q->clear();
if (!db_loadHash($sql, $drow) && $dept_id > 0) {
    $titleBlock = new CTitleBlock('Invalid Department ID', 'users.gif', $m, "{$m}.{$a}");
    $titleBlock->addCrumb("?m=companies", "companies list");
    if ($company_id) {
        $titleBlock->addCrumb("?m=companies&a=view&company_id={$company_id}", "view this company");
    }
    $titleBlock->show();
} else {
    ##echo $sql.db_error();##
    $company_id = $dept_id ? $drow['dept_company'] : $company_id;
    // check if valid company
    $q = new DBQuery();
    $q->addTable('companies', 'com');
    $q->addQuery('company_name');
    $q->addWhere('com.company_id = ' . $company_id);
    $sql = $q->prepare();
コード例 #19
0
ファイル: vw_newhelpdesklog.php プロジェクト: n2i/xvnkb
$m = $AppUI->checkFileName(dPgetParam($_GET, 'm', getReadableModule()));
$denyEdit = getDenyEdit($m);
if ($denyEdit) {
    $AppUI->setMsg('Access denied', UI_MSG_ERROR);
    $AppUI->redirect();
}
require_once $AppUI->getSystemClass('date');
require_once $AppUI->getModuleClass('helpdesk');
$df = $AppUI->getPref('SHDATEFORMAT');
$tid = isset($_GET['tid']) ? $_GET['tid'] : 0;
//pull data
// if we have a TID, then we editing an existing row
$sql = " \r\nSELECT task_log.*, item_id, item_project_id, item_title, item_company_id \r\nFROM task_log\r\nLEFT JOIN helpdesk_items ON task_log_help_desk_id = item_id\r\nWHERE  task_log_id = {$tid} \r\nAND " . getItemPerms() . "\r\n";
//echo "<pre>$sql</pre>";
//echo '<pre>';print_r($sql);echo '</pre>';
db_loadHash($sql, $helpdeskItemTask);
$is_new_record = !$tid;
$helpdeskItemTask_found = $helpdeskItemTask['item_id'] != FALSE;
$require_task_info = $is_new_record || $helpdeskItemTask_found;
//echo '<pre>';print_r($helpdeskItemTask);echo '</pre>';
global $TIMECARD_CONFIG;
//Prevent users from editing other ppls timecards.
$can_edit_other_timesheets = $TIMECARD_CONFIG['minimum_edit_level'] >= $AppUI->user_type;
if (!$can_edit_other_timesheets) {
    if (isset($_GET['tid']) && (isset($helpdeskItemTask['task_log_creator']) && $helpdeskItemTask['task_log_creator'] != $AppUI->user_id)) {
        $AppUI->setMsg('Access denied', UI_MSG_ERROR);
        $AppUI->redirect();
    }
}
$AppUI->savePlace();
if (isset($helpdeskItemTask['task_log_date'])) {
コード例 #20
0
ファイル: calendar.class.php プロジェクト: klr2003/sourceread
 function notify($assignees, $update = false, $clash = false)
 {
     global $AppUI, $locale_char_set, $dPconfig;
     $mail_owner = $AppUI->getPref('MAILALL');
     $assignee_list = explode(",", $assignees);
     $owner_is_assigned = in_array($this->event_owner, $assignee_list);
     if ($mail_owner && !$owner_is_assigned && $this->event_owner) {
         array_push($assignee_list, $this->event_owner);
     }
     // Remove any empty elements otherwise implode has a problem
     foreach ($assignee_list as $key => $x) {
         if (!$x) {
             unset($assignee_list[$key]);
         }
     }
     if (!count($assignee_list)) {
         return;
     }
     $q = new DBQuery();
     $q->addTable('users', 'u');
     $q->addTable('contacts', 'con');
     $q->addQuery('user_id, contact_first_name,contact_last_name, contact_email');
     $q->addWhere('u.user_contact = con.contact_id');
     $q->addWhere("user_id in (" . implode(',', $assignee_list) . ")");
     $users = $q->loadHashList('user_id');
     $date_format = $AppUI->getPref('SHDATEFORMAT');
     $time_format = $AppUI->getPref('TIMEFORMAT');
     $fmt = $date_format . ' ' . $time_format;
     $start_date =& new CDate($this->event_start_date);
     $end_date =& new CDate($this->event_end_date);
     $mail =& new Mail();
     $type = $update ? $AppUI->_('Updated') : $AppUI->_('New');
     $subject_title = $clash ? $AppUI->_('Requested Event') : $type . " " . $AppUI->_('Event');
     $mail->Subject($subject_title . ": " . $this->event_title, $locale_char_set);
     $mail->From('"' . $AppUI->user_first_name . " " . $AppUI->user_last_name . '" <' . $AppUI->user_email . '>');
     $body = '';
     if ($clash) {
         $body .= 'You have been invited to an event by ' . $AppUI->user_first_name . ' ' . $AppUI->user_last_name . "\n";
         $body .= 'However, either you or another intended invitee has a competing event' . "\n";
         $body .= $AppUI->user_first_name . ' ' . $AppUI->user_last_name . ' has requested that you reply to this message' . "\n";
         $body .= 'and confirm if you can or can not make the requested time.' . "\n\n";
     }
     $body .= $AppUI->_('Event') . ":\t" . $this->event_title . "\n";
     if (!$clash) {
         $body .= $AppUI->_('URL') . ":\t" . $dPconfig['base_url'] . "/index.php?m=calendar&a=view&event_id=" . $this->event_id . "\n";
     }
     $body .= $AppUI->_('Starts') . ":\t" . $start_date->format($fmt) . "\n";
     $body .= $AppUI->_('Ends') . ":\t" . $end_date->format($fmt) . "\n";
     // Find the project name.
     if ($this->event_project) {
         $prj = array();
         $q = new DBQuery();
         $q->addTable('projects', 'p');
         $q->addQuery('project_name');
         $q->addWhere('p.project_id =' . $this->event_project);
         $sql = $q->prepare();
         $q->clear();
         if (db_loadHash($sql, $prj)) {
             $body .= $AppUI->_('Project') . ":\t" . $prj['project_name'] . "\n";
         }
     }
     $types = dPgetSysVal('EventType');
     $body .= $AppUI->_('Type') . ":\t" . $AppUI->_($types[$this->event_type]) . "\n";
     $body .= $AppUI->_('Attendees') . ":\t";
     $body_attend = '';
     foreach ($users as $user) {
         $body_attend .= ($body_attend ? ', ' : '') . $user['contact_first_name'] . ' ' . $user['contact_last_name'];
     }
     $body .= $body_attend . "\n\n" . $this->event_description . "\n";
     $mail->Body($body, $locale_char_set);
     foreach ($users as $user) {
         if (!$mail_owner && $user['user_id'] == $this->event_owner) {
             continue;
         }
         $mail->To($user['contact_email'], true);
         $mail->Send();
     }
 }
コード例 #21
0
 function notify($type, $log_id)
 {
     global $AppUI, $ist, $ict, $isa;
     //    if (!$this->item_notify ||
     //        ($this->item_assigned_to == $AppUI->user_id)) {
     //      return;
     //    }
     // Pull up the email address of everyone on the watch list
     $sql = "SELECT contact_email\n            FROM \n            \thelpdesk_item_watchers\n            \tLEFT JOIN users ON helpdesk_item_watchers.user_id = users.user_id\n\t\tLEFT JOIN contacts ON user_contact = contact_id\n            WHERE \n            \thelpdesk_item_watchers.item_id='{$this->item_id}'";
     //if they choose, along with the person who the ticket is assigned to.
     if ($this->item_notify) {
         $sql .= " or users.user_id='{$this->item_assigned_to}'";
     }
     $email_list = db_loadHashList($sql);
     $email_list = array_keys($email_list);
     //echo $sql."\n";
     //print_r($email_list);
     //if there's no one in the list, skip the rest.
     if (count($email_list) <= 0) {
         return;
     }
     if (is_numeric($log_id)) {
         switch ($type) {
             case STATUS_LOG:
                 $sql = "SELECT status_code, status_comment\n                  FROM helpdesk_item_status\n                  WHERE status_id={$log_id}";
                 break;
             case TASK_LOG:
                 $sql = "SELECT task_log_name,task_log_description\n                  FROM task_log\n                  WHERE task_log_id={$log_id}";
                 break;
         }
         db_loadHash($sql, $log);
     }
     foreach ($email_list as $assigned_to_email) {
         $mail = new Mail();
         if ($mail->ValidEmail($assigned_to_email)) {
             $subject = $AppUI->cfg['page_title'] . " " . $AppUI->_('Help Desk Item') . " #{$this->item_id}";
             switch ($type) {
                 case STATUS_LOG:
                     $body = $AppUI->_('Title') . ": {$this->item_title}\n" . $AppUI->_('Call Type') . ": {$ict[$this->item_calltype]}\n" . $AppUI->_('Status') . ": {$ist[$this->item_status]}\n";
                     if ($log['status_code'] == 0) {
                         $mail->Subject("{$subject} " . $AppUI->_('Created'));
                     } else {
                         $mail->Subject("{$subject} " . $AppUI->_('Updated'));
                         $body .= $AppUI->_('Update') . ": {$isa[$log['status_code']]} {$log['status_comment']}\n";
                     }
                     $body .= $AppUI->_('Link') . ": {$AppUI->cfg['base_url']}/index.php?m=helpdesk&a=view&item_id={$this->item_id}\n" . "\n" . $AppUI->_('Summary') . ":\n" . $this->item_summary;
                     break;
                 case TASK_LOG:
                     $mail->Subject("{$subject} " . $AppUI->_('Task Log') . " " . $AppUI->_('Update'));
                     $body = $AppUI->_('Summary') . ": " . $log['task_log_name'] . "\n" . $AppUI->_('Link') . ": {$AppUI->cfg['base_url']}/index.php?m=helpdesk&a=view&item_id={$this->item_id}\n" . "\n" . $AppUI->_('Comments') . ":\n" . $log['task_log_description'];
                     break;
             }
             $body .= "\n\n-- \n" . $AppUI->_('helpdeskSignature');
             if ($mail->ValidEmail($AppUI->user_email)) {
                 $email = $AppUI->user_email;
             } else {
                 $email = "dotproject@" . $AppUI->cfg['site_domain'];
             }
             $mail->From("\"{$AppUI->user_first_name} {$AppUI->user_last_name}\" <{$email}>");
             $mail->To($assigned_to_email);
             $mail->Body($body, isset($GLOBALS['locale_char_set']) ? $GLOBALS['locale_char_set'] : "");
             $mail->Send();
         }
     }
 }
コード例 #22
0
ファイル: fileviewer.php プロジェクト: 222elm/dotprojectFrame
 $project = new CProject();
 $allowedProjects = $project->getAllowedRecords($AppUI->user_id, 'project_id, project_name');
 $fileclass = new CFile();
 $fileclass->load($file_id);
 $allowedFiles = $fileclass->getAllowedRecords($AppUI->user_id, 'file_id, file_name');
 if (count($allowedFiles) && !array_key_exists($file_id, $allowedFiles)) {
     $AppUI->redirect('m=public&a=access_denied');
 }
 $q = new DBQuery();
 $q->addTable('files');
 if ($fileclass->file_project) {
     $project->setAllowedSQL($AppUI->user_id, $q, 'file_project');
 }
 $q->addWhere('file_id = ' . $file_id);
 $sql = $q->prepare();
 if (!db_loadHash($sql, $file)) {
     $AppUI->redirect('m=public&a=access_denied');
 }
 /*
  * DISABLED LINES TO FIX A NEWER BUG 914075 WITH IE 6 (GREGORERHARDT 20040612)
 
 // BEGIN extra headers to resolve IE caching bug (JRP 9 Feb 2003)
 // [http://bugs.php.net/bug.php?id=16173]
 header('Pragma: ');
 header('Cache-Control: ');
 header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
 header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
 header('Cache-Control: no-store, no-cache, must-revalidate');  //HTTP/1.1
 header('Cache-Control: post-check=0, pre-check=0', false);
 // END extra headers to resolve IE caching bug
 */
コード例 #23
0
ファイル: taskenddate.php プロジェクト: magsilva/dotproject
    $user_filter = "";
    $sql = "select t.*, p.project_name, u.user_username\n            from tasks as t,\n                 users as u,\n                 projects as p";
    if ($user_id > 0) {
        $sql .= ", user_tasks as ut";
        $user_filter = " and ut.user_id = {$user_id}\n                         and ut.task_id = t.task_id ";
    }
    $sql .= " where task_end_date   >= '" . $start_date->format(FMT_DATETIME_MYSQL) . "'\n                and task_end_date <= '" . $end_date->format(FMT_DATETIME_MYSQL) . "'\n                and p.project_id   = t.task_project\n                and t.task_dynamic = '0'\n                and t.task_owner = u.user_id\n                {$projects_filter}\n                {$user_filter}\n            order by project_name asc, task_end_date asc";
    $tasks = db_loadHashList($sql, "task_id");
    $first_task = current($tasks);
    $actual_project_id = 0;
    $first_task = true;
    $task_log = array();
    echo "<table class='tbl' width='80%'>";
    echo "<tr><th>" . $AppUI->_("Task name") . "</th><th>" . $AppUI->_("T.Owner") . "</th><th>" . $AppUI->_("H.Alloc.") . "</th><th>" . $AppUI->_("Task end date") . "</th><th>" . $AppUI->_("Last activity date") . "</th><th>" . $AppUI->_("Done") . "?</th></tr>";
    $hrs = $AppUI->_("hrs");
    // To avoid calling $AppUI each row
    foreach ($tasks as $task) {
        if ($actual_project_id != $task["task_project"]) {
            echo "<tr><td colspan='6'><b>" . $task["project_name"] . "</b></td>";
            $actual_project_id = $task["task_project"];
        }
        $sql = "select *\n                from task_log\n                where task_log_task = " . $task["task_id"] . "\n                order by task_log_date desc\n                limit 1";
        db_loadHash($sql, $task_log);
        $done_img = $task["task_percent_complete"] == 100 ? "Yes" : "No";
        echo "<tr><td>&nbsp;&nbsp;&nbsp;" . $task["task_name"] . "</td><td>" . $task["user_username"] . "</td><td>" . $task["task_duration"] * $task["task_duration_type"] . " {$hrs}</td><td>" . $task["task_end_date"] . "</td><td>" . $task_log["task_log_date"] . "</td><td align='center'>{$done_img}</td></tr>";
    }
}
?>