Ejemplo n.º 1
0
function check_perm(&$var)
{
    global $m;
    if ($var[0] == 0) {
        return true;
    }
    // if folder can be edited, keep in array
    if (!getDenyEdit($m, $var['file_folder_id'])) {
        if (getDenyEdit($m, $var['file_folder_parent'])) {
            $var[2] = 0;
            $var['file_folder_parent'] = 0;
        }
        return true;
    } else {
        return false;
    }
}
Ejemplo n.º 2
0
 public function canUserEditTimeInformation()
 {
     global $AppUI;
     $project = new CProject();
     $project->load($this->task_project);
     // Code to see if the current user is
     // enabled to change time information related to task
     $can_edit_time_information = false;
     // Let's see if all users are able to edit task time information
     if (w2PgetConfig('restrict_task_time_editing') == true && $this->task_id > 0) {
         // Am I the task owner?
         if ($this->task_owner == $AppUI->user_id) {
             $can_edit_time_information = true;
         }
         // Am I the project owner?
         if ($project->project_owner == $AppUI->user_id) {
             $can_edit_time_information = true;
         }
         // Am I sys admin?
         if (!getDenyEdit('admin')) {
             $can_edit_time_information = true;
         }
     } else {
         if (w2PgetConfig('restrict_task_time_editing') == false || $this->task_id == 0) {
             // If all users are able, then don't check anything
             $can_edit_time_information = true;
         }
     }
     return $can_edit_time_information;
 }
Ejemplo n.º 3
0
	</td>
</tr>
<tr>
	<td align="right" valign="top"><?php 
echo $AppUI->_('Message');
?>
:</td>
	<td align="left" valign="top">
       <textarea cols="60" name="message_body" style="height:200px"><?php 
echo ($message_id == 0 and $message_parent != -1) ? "\n>" . $last_message_info["message_body"] . "\n" : $message_info["message_body"];
?>
</textarea>
	</td>
</tr>
<tr>
	<td>
		<input type="button" value="<?php 
echo $AppUI->_('back');
?>
" class=button onclick="javascript:window.location='./index.php?m=forums';">
	</td>
	<td align="right"><?php 
if ($AppUI->user_id == $message_info['message_author'] || $AppUI->user_id == $forum_info["forum_owner"] || $message_id == 0 || !empty($perms['all']) && !getDenyEdit('all')) {
    echo '<input type="button" value="' . $AppUI->_('submit') . '" class=button onclick="submitIt()">';
}
?>
</td>
</tr>
</form>
</table>
Ejemplo n.º 4
0
<?php

/* CONTACTS $Id: vcardimport.php,v 1.4.12.1 2005/10/05 12:47:59 gregorerhardt Exp $ */
$canEdit = !getDenyEdit('contacts');
if (!$canEdit) {
    $AppUI->setMsg('Access denied', UI_MSG_ERROR);
    $AppUI->redirect();
}
// check whether vCard file should be fetched from source or parsed for vCardKeys; criteria: get parameters
if (isset($_FILES['vcf']) && isset($_GET['suppressHeaders']) && $_GET['suppressHeaders'] == 'true') {
    //parse and store vCard file
    $vcf = $_FILES['vcf'];
    // include PEAR vCard class
    require_once $AppUI->getLibraryClass('PEAR/Contact_Vcard_Parse');
    if (is_uploaded_file($vcf['tmp_name'])) {
        // instantiate a parser object
        $parse = new Contact_Vcard_Parse();
        // parse a vCard file and store the data
        // in $cardinfo
        $cardinfo = $parse->fromFile($vcf['tmp_name']);
        // store the card info array
        foreach ($cardinfo as $ci) {
            //one file can contain multiple vCards
            $obj = new CContact();
            //transform the card info array to dP store format
            $contactValues["contact_last_name"] = $ci['N'][0]['value'][0][0];
            $contactValues["contact_first_name"] = $ci['N'][0]['value'][1][0];
            $contactValues["contact_title"] = $ci['N'][0]['value'][3][0];
            $contactValues["contact_birthday"] = $ci['BDAY'][0]['value'][0][0];
            $contactValues["contact_company"] = $ci['UID'][0]['value'][0][0];
            $contactValues["contact_type"] = $ci['N'][0]['value'][2][0];
Ejemplo n.º 5
0
<?php

// check access to files module
if (!defined('DP_BASE_DIR')) {
    die('You should not access this file directly');
}
global $AppUI, $m, $obj, $task_id;
if (!getDenyRead('links')) {
    if (!getDenyEdit('links')) {
        echo '<a href="./index.php?m=links&a=addedit&project_id=' . $obj->task_project . '&link_task=' . $task_id . '">' . $AppUI->_('Attach a link') . '</a>';
    }
    echo dPshowImage(dPfindImage('stock_attach-16.png', $m), 16, 16, '');
    $showProject = false;
    $project_id = $obj->task_project;
    include DP_BASE_DIR . '/modules/links/index_table.php';
}
<?php

// check access to files module
global $AppUI, $m, $company_id, $dPconfig;
if (!getDenyRead('files')) {
    if (!getDenyEdit('files')) {
        echo '<a href="./index.php?m=files&a=addedit">' . $AppUI->_('Attach a file') . '</a>';
    }
    echo dPshowImage(dPfindImage('stock_attach-16.png', $m), 16, 16, '');
    $showProject = true;
    include $dPconfig['root_dir'] . '/modules/files/index_table.php';
}
Ejemplo n.º 7
0
    $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 = ' . $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(*) as children');
    $q->addTable('tasks');
    $q->addWhere('task_parent = ' . $row['task_id']);
    $q->addWhere('task_id <> task_parent');
    $row['children'] = $q->loadResult();
    $row['style'] = taskstyle_pd($row);
    $row['canEdit'] = !getDenyEdit('tasks', $row['task_id']);
    $row['canViewLog'] = $perms->checkModuleItem('task_log', 'view', $row['task_id']);
    $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;
$AppUI->setState('tasks_opened', $tasks_opened);
foreach ($projects as $k => $p) {
    global $done;
    $done = array();
Ejemplo n.º 8
0
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
// one site for both adding and editing timesheet's log items
// besides the following lines show the possiblities of the dPframework
// retrieve GET-Parameters via dPframework
// please always use this way instead of hard code (e.g. there have been some problems with REGISTER_GLOBALS=OFF with hard code)
global $AppUI, $user_id, $percent;
$user_id = $AppUI->user_id;
$task_log_id = intval(dPgetParam($_GET, "task_log_id", 0));
$task_log_name = intval(dPgetParam($_GET, "task_log_name", 0));
// check permissions for this record
$canEdit = !getDenyEdit($m, $task_log_id);
if (!$canEdit) {
    $AppUI->redirect("m=public&a=access_denied");
}
// use the object oriented design of dP for loading the log that should be edited
// therefore create a new instance of the Timesheet Class
$obj = new CTimesheet();
$df = $AppUI->getPref('SHDATEFORMAT');
// pull users
// pull users
$q = new DBQuery();
$q->addTable('tasks', 't');
$q->addTable('projects', 'p');
$q->addTable('user_tasks', 'u');
$q->addQuery('t.task_id');
$q->addQuery('CONCAT_WS(" - ",p.project_short_name, t.task_name)');
Ejemplo n.º 9
0
<?php

/* $Id: viewer.php,v 1.25.6.4 2007/03/28 15:00:52 cyberhorse Exp $ */
if (!defined('DP_BASE_DIR')) {
    die('You should not access this file directly.');
}
//view posts
$forum_id = isset($_GET["forum_id"]) ? (int) $_GET["forum_id"] : 0;
$message_id = isset($_GET["message_id"]) ? (int) $_GET["message_id"] : 0;
$post_message = isset($_GET["post_message"]) ? $_GET["post_message"] : 0;
$f = dpGetParam($_POST, 'f', 0);
// check permissions
$canRead = !getDenyRead($m, $forum_id);
$canEdit = !getDenyEdit($m, $forum_id);
if (!$canRead || $post_message & !$canEdit) {
    $AppUI->redirect("m=public&a=access_denied");
}
$df = $AppUI->getPref('SHDATEFORMAT');
$tf = $AppUI->getPref('TIMEFORMAT');
$q = new DBQuery();
$q->addTable('forums');
$q->addTable('projects', 'p');
$q->addTable('users', 'u');
$q->addQuery('forum_id, forum_project,	forum_description, forum_owner, forum_name,
	forum_create_date, forum_last_date, forum_message_count, forum_moderated,
	user_username, contact_first_name, contact_last_name,
	project_name, project_color_identifier');
$q->addJoin('contacts', 'con', 'contact_id = user_contact');
$q->addWhere("user_id = forum_owner");
$q->addWhere("forum_id = {$forum_id}");
$q->addWhere("forum_project = project_id");
Ejemplo n.º 10
0
<?php

require_once $AppUI->getModuleClass('projects');
// one site for both adding and editing einstein's quote items
// besides the following lines show the possiblities of the dPframework
// retrieve GET-Parameters via dPframework
// please always use this way instead of hard code (e.g. there have been some problems with REGISTER_GLOBALS=OFF with hard code)
$unittest_id = intval(dPgetParam($_GET, "unittest_id", 0));
// check permissions for this record
$canEdit = !getDenyEdit($m, $unittest_id);
if (!$canEdit) {
    $AppUI->redirect("m=public&a=access_denied");
}
// use the object oriented design of dP for loading the quote that should be edited
// therefore create a new instance of the Einstein Class
$obj = new CTesting();
$obj->unittest_lasttested = '2005-07-07';
// format dates
$df = $AppUI->getPref('SHDATEFORMAT');
$lasttested = intval($obj->unittest_lasttested) ? new CDate($obj->unittest_lasttested) : new CDate();
// load the record data in case of that this script is used to edit the quote qith unittest_id (transmitted via GET)
if (!$obj->load($unittest_id, false) && $unittest_id > 0) {
    // show some error messages using the dPFramework if loadOperation failed
    // these error messages are nicely integrated with the frontend of dP
    // use detailed error messages as often as possible
    $AppUI->setMsg('Testing');
    $AppUI->setMsg("invalidID", UI_MSG_ERROR, true);
    $AppUI->redirect();
    // go back to the calling location
}
// check if this record has dependancies to prevent deletion
function showtask_pd(&$a, $level = 0, $is_opened = true, $today_view = false)
{
    global $AppUI, $dPconfig, $done, $query_string, $durnTypes, $userAlloc, $showEditCheckbox;
    global $task_access, $task_priority, $PROJDESIGN_CONFIG;
    $types = dPgetsysval('TaskType');
    $now = new CDate();
    $tf = $AppUI->getPref('TIMEFORMAT');
    $df = $AppUI->getPref('SHDATEFORMAT');
    $fdf = $df . " " . $tf;
    $perms =& $AppUI->acl();
    $show_all_assignees = @$dPconfig['show_all_task_assignees'] ? true : false;
    $done[] = $a['task_id'];
    $start_date = intval($a["task_start_date"]) ? new CDate($a["task_start_date"]) : null;
    $end_date = intval($a["task_end_date"]) ? new CDate($a["task_end_date"]) : null;
    $last_update = isset($a['last_update']) && intval($a['last_update']) ? new CDate($a['last_update']) : null;
    // prepare coloured highlight of task time information
    $sign = 1;
    $style = "";
    if ($start_date) {
        if (!$end_date) {
            /*
             ** end date calc has been moved to calcEndByStartAndDuration()-function
             ** called from array_csort and tasks.php 
             ** perhaps this fallback if-clause could be deleted in the future, 
             ** didn't want to remove it shortly before the 2.0.2
             */
            $end_date = new CDate('0000-00-00 00:00:00');
        }
        if ($now->after($start_date) && $a["task_percent_complete"] == 0) {
            $style = 'background-color:#ffeebb';
        } else {
            if ($now->after($start_date) && $a["task_percent_complete"] < 100) {
                $style = 'background-color:#e6eedd';
            }
        }
        if ($now->after($end_date)) {
            $sign = -1;
            $style = 'background-color:#cc6666;color:#ffffff';
        }
        if ($a["task_percent_complete"] == 100) {
            $style = 'background-color:#aaddaa; color:#00000';
        }
        $days = $now->dateDiff($end_date) * $sign;
    }
    $s = "\n<tr id=\"row" . $a['task_id'] . "\" onmouseover=\"highlight_tds(this, true, " . $a['task_id'] . ")\" onmouseout=\"highlight_tds(this, false, " . $a['task_id'] . ")\" onclick=\"select_box('selected_task', " . $a['task_id'] . ",'frm_tasks')\">";
    // edit icon
    $s .= "\n\t<td>";
    $canEdit = !getDenyEdit('tasks', $a["task_id"]);
    $canViewLog = $perms->checkModuleItem('task_log', 'view', $a['task_id']);
    if ($canEdit) {
        $s .= "\n\t\t<a href=\"?m=tasks&a=addedit&task_id={$a['task_id']}\">" . "\n\t\t\t" . '<img src="./images/icons/pencil.gif" alt="' . $AppUI->_('Edit Task') . '" border="0" width="12" height="12">' . "\n\t\t</a>";
    }
    $s .= "\n\t</td>";
    // pinned
    /*        $pin_prefix = $a['task_pinned']?'':'un';
            $s .= "\n\t<td>";
            $s .= "\n\t\t<a href=\"?m=tasks&pin=" . ($a['task_pinned']?0:1) . "&task_id={$a['task_id']}\">"
                    . "\n\t\t\t".'<img src="./images/icons/' . $pin_prefix . 'pin.gif" alt="'.$AppUI->_( $pin_prefix . 'pin Task' ).'" border="0" width="12" height="12">'
                    . "\n\t\t</a>";
            $s .= "\n\t</td>";*/
    // New Log
    /*        if (@$a['task_log_problem']>0) {
                    $s .= '<td align="center" valign="middle"><a href="?m=tasks&a=view&task_id='.$a['task_id'].'&tab=0&problem=1">';
                    $s .= dPshowImage( './images/icons/dialog-warning5.png', 16, 16, 'Problem', 'Problem!' );
                    $s .='</a></td>';
            } else if ($canViewLog) {
                    $s .= "\n\t<td><a href=\"?m=tasks&a=view&task_id=" . $a['task_id'] . '&tab=1">' . $AppUI->_('Log') . '</a></td>';
            } else {
                    $s .= "\n\t<td></td>";
                                    }*/
    // percent complete
    $s .= "\n\t<td align=\"right\">" . intval($a["task_percent_complete"]) . '%</td>';
    // priority
    $s .= "\n\t<td align='center' nowrap='nowrap'>";
    if ($a["task_priority"] < 0) {
        $s .= "\n\t\t<img src=\"./images/icons/priority-" . -$a["task_priority"] . '.gif" width=13 height=16>';
    } else {
        if ($a["task_priority"] > 0) {
            $s .= "\n\t\t<img src=\"./images/icons/priority+" . $a["task_priority"] . '.gif" width=13 height=16>';
        }
    }
    $s .= @$a["file_count"] > 0 ? "<img src=\"./images/clip.png\" alt=\"F\">" : "";
    $s .= "</td>";
    // access
    $s .= "\n\t<td nowrap='nowrap'>";
    $s .= '<abbr title="' . $task_access[$a['task_access']] . '">' . substr($task_access[$a["task_access"]], 0, 3) . '</abbr>';
    $s .= "</td>";
    // type
    $s .= "\n\t<td nowrap='nowrap'>";
    $s .= '<abbr title="' . $types[$a['task_type']] . '">' . substr($types[$a["task_type"]], 0, 3) . '</abbr>';
    $s .= "</td>";
    // type
    $s .= "\n\t<td nowrap='nowrap'>";
    $s .= $a["queue_id"] ? 'Yes' : '';
    $s .= "</td>";
    // inactive
    $s .= "\n\t<td nowrap='nowrap'>";
    $s .= $a["task_status"] == '-1' ? 'Yes' : '';
    $s .= "</td>";
    // add log
    $s .= "\n\t<td align='center' nowrap='nowrap'>";
    if ($a['task_dynamic'] != 1) {
        $s .= "\n\t\t<a href=\"?m=tasks&a=view&tab=1&project_id={$a['task_project']}&task_id={$a['task_id']}\">" . "\n\t\t\t" . '<img src="./modules/projectdesigner/images/add.png" alt="' . $AppUI->_('Add Work Log') . '" title="' . $AppUI->_('Add Work Log') . '" border="0" width="16" height="16">' . "\n\t\t</a>";
    }
    $s .= "</td>";
    // dots
    if ($today_view) {
        $s .= '<td>';
    } else {
        $s .= '<td width="20%">';
    }
    for ($y = 0; $y < $level; $y++) {
        if ($y + 1 == $level) {
            $s .= '<img src="./images/corner-dots.gif" width="16" height="12" border="0">';
        } else {
            $s .= '<img src="./images/shim.gif" width="16" height="12"  border="0">';
        }
    }
    // name link
    $alt = strlen($a['task_description']) > intval($PROJDESIGN_CONFIG['chars_task_descriptions']) ? substr($a["task_description"], 0, intval($PROJDESIGN_CONFIG['chars_task_descriptions'])) . '...' : $a['task_description'];
    // instead of the statement below
    $alt = str_replace("\"", "&quot;", $alt);
    //        $alt = htmlspecialchars($alt);
    $alt = str_replace("\r", ' ', $alt);
    $alt = str_replace("\n", ' ', $alt);
    $open_link = $is_opened ? "<!--<a href='index.php{$query_string}&close_task_id=" . $a["task_id"] . "'>--><img src='images/icons/collapse.gif' border='0' align='center' /><!--</a>-->" : "<!--<a href='index.php{$query_string}&open_task_id=" . $a["task_id"] . "'>--><img src='images/icons/expand.gif' border='0' /><!--</a>-->";
    if ($a["task_milestone"] > 0) {
        $s .= '&nbsp;<a href="./index.php?m=tasks&a=view&task_id=' . $a["task_id"] . '" title="' . $alt . '"><b>' . $a["task_name"] . '</b></a> <img src="./images/icons/milestone.gif" border="0"></td>';
    } else {
        if ($a["task_dynamic"] == '1') {
            if (!$today_view) {
                $s .= $open_link;
            }
            $s .= '&nbsp;<a href="./index.php?m=tasks&a=view&task_id=' . $a["task_id"] . '" title="' . $alt . '"><b><i>' . $a["task_name"] . '</i></b></a></td>';
        } else {
            $s .= '&nbsp;<a href="./index.php?m=tasks&a=view&task_id=' . $a["task_id"] . '" title="' . $alt . '">' . $a["task_name"] . '</a></td>';
        }
    }
    if ($today_view) {
        // Show the project name
        $s .= '<td>';
        $s .= '<a href="./index.php?m=projects&a=view&project_id=' . $a['task_project'] . '">';
        $s .= '<span style="padding:2px;background-color:#' . $a['project_color_identifier'] . ';color:' . bestColor($a['project_color_identifier']) . '">' . $a['project_name'] . '</span>';
        $s .= '</a></td>';
    }
    // task description
    if ($PROJDESIGN_CONFIG['show_task_descriptions']) {
        $s .= '<td align="justified">' . $a['task_description'] . '</td>';
    }
    // task owner
    $s .= '<td align="center">' . "<a href='?m=admin&a=viewuser&user_id=" . $a['user_id'] . "'>" . $a['contact_first_name'] . ' ' . $a['contact_last_name'] . "</a>" . '</td>';
    if (!$today_view) {
        $s .= '<td  id="ignore_td_' . $a['task_id'] . '" nowrap="nowrap" align="center" style="' . $style . '">' . ($start_date ? $start_date->format($df . ' ' . $tf) : '-') . '</td>';
        //		        $s .= '<td nowrap="nowrap" align="center" style="'.$style.'">'.($start_date ? $start_date->format( $tf ) : '-').'</td>';
    }
    // duration or milestone
    $s .= '<td  id="ignore_td_' . $a['task_id'] . '" align="center" nowrap="nowrap" style="' . $style . '">';
    $s .= $a['task_duration'] . ' ' . $AppUI->_($durnTypes[$a['task_duration_type']]);
    $s .= '</td>';
    $s .= '<td id="ignore_td_' . $a['task_id'] . '" nowrap="nowrap" align="center" style="' . $style . '">' . ($end_date ? $end_date->format($df . ' ' . $tf) : '-') . '</td>';
    if (isset($a['task_assigned_users']) && ($assigned_users = $a['task_assigned_users'])) {
        $a_u_tmp_array = array();
        if ($show_all_assignees) {
            $s .= '<td align="center">';
            foreach ($assigned_users as $val) {
                //$a_u_tmp_array[] = "<A href='mailto:".$val['user_email']."'>".$val['user_username']."</A>";
                $aInfo = "<a href='?m=admin&a=viewuser&user_id=" . $val['user_id'] . "'";
                $aInfo .= 'title="' . $AppUI->_('Extent of Assignment') . ':' . $userAlloc[$val['user_id']]['charge'] . '%; ' . $AppUI->_('Free Capacity') . ':' . $userAlloc[$val['user_id']]['freeCapacity'] . '%' . '">';
                $aInfo .= $val['contact_first_name'] . ' ' . $val['contact_last_name'] . " (" . $val['perc_assignment'] . "%)</a>";
                $a_u_tmp_array[] = $aInfo;
            }
            $s .= join(', ', $a_u_tmp_array);
            $s .= '</td>';
        } else {
            $s .= '<td align="center" nowrap="nowrap">';
            $s .= "<a href='?m=admin&a=viewuser&user_id=" . $assigned_users[0]['user_id'] . "'";
            $s .= 'title="' . $AppUI->_('Extent of Assignment') . ':' . $userAlloc[$assigned_users[0]['user_id']]['charge'] . '%; ' . $AppUI->_('Free Capacity') . ':' . $userAlloc[$assigned_users[0]['user_id']]['freeCapacity'] . '%' . '">';
            $s .= $assigned_users[0]['contact_first_name'] . ' ' . $assigned_users[0]['contact_last_name'] . ' (' . $assigned_users[0]['perc_assignment'] . '%)</a>';
            if ($a['assignee_count'] > 1) {
                $id = $a['task_id'];
                $s .= " <a href=\"javascript: void(0);\"  onClick=\"toggle_users('users_{$id}');\" title=\"" . join(', ', $a_u_tmp_array) . "\">(+" . ($a['assignee_count'] - 1) . ")</a>";
                $s .= '<span style="display: none" id="users_' . $id . '">';
                $a_u_tmp_array[] = $assigned_users[0]['user_username'];
                for ($i = 1; $i < count($assigned_users); $i++) {
                    $a_u_tmp_array[] = $assigned_users[$i]['user_username'];
                    $s .= '<br /><a href="?m=admin&a=viewuser&user_id=';
                    $s .= $assigned_users[$i]['user_id'] . '" title="' . $AppUI->_('Extent of Assignment') . ':' . $userAlloc[$assigned_users[$i]['user_id']]['charge'] . '%; ' . $AppUI->_('Free Capacity') . ':' . $userAlloc[$assigned_users[$i]['user_id']]['freeCapacity'] . '%' . '">';
                    $s .= $assigned_users[$i]['contact_first_name'] . ' ' . $assigned_users[$i]['contact_last_name'] . ' (' . $assigned_users[$i]['perc_assignment'] . '%)</a>';
                }
                $s .= '</span>';
            }
            $s .= '</td>';
        }
    } else {
        if (!$today_view) {
            // No users asigned to task
            $s .= '<td align="center">-</td>';
        }
    }
    // Assignment checkbox
    if ($showEditCheckbox || $perms->checkModule('admin', 'view')) {
        $s .= "\n\t<td align='center'><input type=\"checkbox\" onclick=\"select_box('selected_task', " . $a['task_id'] . ",'frm_tasks')\" onfocus=\"is_check=true;\" onblur=\"is_check=false;\" id=\"selected_task_{$a['task_id']}\" name=\"selected_task[{$a['task_id']}]\" value=\"{$a['task_id']}\"/></td>";
    }
    $s .= '</tr>';
    echo $s;
}
Ejemplo n.º 12
0
<?php

if (!defined('DP_BASE_DIR')) {
    die('You should not access this file directly.');
}
// Add / Edit contact
$risk_id = intval(dPgetParam($_REQUEST, 'risk_id', 0));
// check permissions
$denyEdit = getDenyEdit($m, $risk_id);
if ($denyEdit) {
    $AppUI->redirect("m=help&a=access_denied");
}
$riskProbability = dPgetSysVal('RiskProbability');
$riskStatus = dPgetSysVal('RiskStatus');
$riskImpact = dPgetSysVal('RiskImpact');
$riskDuration = array(1 => 'Hours', 24 => 'Days', 168 => 'Weeks');
$q = new DBQuery();
$q->addQuery('user_id');
$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('*');
Ejemplo n.º 13
0
<?php

/* FILES $Id: addedit_folder.php,v 1.1.2.5 2007/03/29 14:11:53 pedroix Exp $ */
if (!defined('DP_BASE_DIR')) {
    die('You should not access this file directly.');
}
$file_folder_parent = intval(dPgetParam($_GET, 'file_folder_parent', 0));
$folder = intval(dPgetParam($_GET, 'folder', 0));
// add to allow for returning to other modules besides Files
$referrerArray = parse_url($_SERVER['HTTP_REFERER']);
$referrer = $referrerArray['query'] . $referrerArray['fragment'];
// check permissions for this record
if ($folder == 0) {
    $canEdit = true;
} else {
    $canEdit = !getDenyEdit($m, $folder);
}
if (!$canEdit) {
    $AppUI->redirect("m=public&a=access_denied");
}
$q = new DBQuery();
$q->addTable('file_folders');
$q->addQuery('file_folders.*');
$q->addWhere("file_folder_id={$folder}");
$sql = $q->prepare();
// check if this record has dependancies to prevent deletion
$msg = '';
$obj = new CFileFolder();
if ($folder > 0) {
    $canDelete = $obj->canDelete($msg, $folder);
}
Ejemplo n.º 14
0
function displayFiles($folder)
{
    global $m, $a, $tab, $AppUI, $xpg_min, $xpg_pagesize;
    global $deny1, $deny2, $project_id, $task_id, $showProject, $file_types, $cfObj;
    global $xpg_totalrecs, $xpg_total_pages, $page;
    global $company_id, $allowed_companies, $current_uri, $dPconfig;
    $canEdit = !getDenyEdit($m, $folder);
    $canRead = !getDenyRead($m, $folder);
    $df = $AppUI->getPref('SHDATEFORMAT');
    $tf = $AppUI->getPref('TIMEFORMAT');
    // SETUP FOR FILE LIST
    $q = new DBQuery();
    $q->addTable('files');
    $q->addQuery('files.*,count(file_version) as file_versions,round(max(file_version), 2) as file_lastversion,file_folder_id, file_folder_name,project_name, project_color_identifier,contact_first_name, contact_last_name,task_name,task_id');
    $q->addJoin('projects', 'p', 'p.project_id = file_project');
    $q->addJoin('users', 'u', 'u.user_id = file_owner');
    $q->addJoin('contacts', 'c', 'c.contact_id = u.user_contact');
    $q->addJoin('tasks', 't', 't.task_id = file_task');
    $q->addJoin('file_folders', 'ff', 'ff.file_folder_id = file_folder');
    $q->addWhere('file_folder = ' . $folder);
    if (count($deny1) > 0) {
        $q->addWhere('file_project NOT IN (' . implode(',', $deny1) . ')');
    }
    if (count($deny2) > 0) {
        $q->addWhere('file_task NOT IN (' . implode(',', $deny2) . ')');
    }
    if ($project_id) {
        $q->addWhere('file_project = ' . $project_id);
    }
    if ($task_id) {
        $q->addWhere('file_task = ' . $task_id);
    }
    if ($company_id) {
        $q->innerJoin('companies', 'co', 'co.company_id = p.project_company');
        $q->addWhere('company_id = ' . $company_id);
        $q->addWhere('company_id IN (' . $allowed_companies . ')');
    }
    $q->addGroup('file_folder');
    $q->addGroup('project_name');
    $q->addGroup('file_name');
    $q->addOrder('file_folder');
    $q->addOrder('project_name');
    $q->addOrder('file_name');
    $q->setLimit($xpg_pagesize, $xpg_min);
    $files_sql = $q->prepare();
    $q->clear();
    $q = new DBQuery();
    $q->addTable('files');
    $q->addQuery('files.file_id, file_version, file_project, file_name, file_task, file_description, user_username as file_owner, file_size, file_category, file_type, file_date, file_folder_name');
    $q->addJoin('projects', 'p', 'p.project_id = file_project');
    $q->addJoin('users', 'u', 'u.user_id = file_owner');
    $q->addJoin('tasks', 't', 't.task_id = file_task');
    $q->addJoin('file_folders', 'ff', 'ff.file_folder_id = file_folder');
    $q->addWhere('file_folder = ' . $folder);
    if ($project_id) {
        $q->addWhere('file_project = ' . $project_id);
    }
    if ($task_id) {
        $q->addWhere('file_task = ' . $task_id);
    }
    if ($company_id) {
        $q->innerJoin('companies', 'co', 'co.company_id = p.project_company');
        $q->addWhere('company_id = ' . $company_id);
        $q->addWhere('company_id IN (' . $allowed_companies . ')');
    }
    $file_versions_sql = $q->prepare();
    $q->clear();
    $files = array();
    $file_versions = array();
    if ($canRead) {
        $files = db_loadList($files_sql);
        $file_versions = db_loadList($file_versions_sql);
    }
    if ($files === array()) {
        return 0;
    }
    ?>
	<table width="100%" border="0" cellpadding="2" cellspacing="1" class="tbl">
	<tr>
		<th nowrap="nowrap"><?php 
    echo $AppUI->_('File Name');
    ?>
</th>
		<th><?php 
    echo $AppUI->_('Description');
    ?>
</th>
		<th><?php 
    echo $AppUI->_('Versions');
    ?>
</th>
	    <th><?php 
    echo $AppUI->_('Category');
    ?>
</th>
		<th nowrap="nowrap"><?php 
    echo $AppUI->_('Task Name');
    ?>
</th>
		<th><?php 
    echo $AppUI->_('Owner');
    ?>
</th>
		<th><?php 
    echo $AppUI->_('Size');
    ?>
</th>
		<th><?php 
    echo $AppUI->_('Type');
    ?>
</a></th>
		<th><?php 
    echo $AppUI->_('Date');
    ?>
</th>
    	<th nowrap="nowrap"><?php 
    echo $AppUI->_('co Reason');
    ?>
</th>
    	<th><?php 
    echo $AppUI->_('co');
    ?>
</th>
		<th nowrap width="1"></th>
		<th nowrap width="1"></th>
	</tr>
<?php 
    $fp = -1;
    $file_date = new CDate();
    $id = 0;
    foreach ($files as $row) {
        $file_date = new CDate($row['file_date']);
        if ($fp != $row["file_project"]) {
            if (!$row["project_name"]) {
                $row["project_name"] = $AppUI->_('All Projects');
                $row["project_color_identifier"] = 'f4efe3';
            }
            if ($showProject) {
                $s = '<tr>';
                $s .= '<td colspan="20" style="background-color:#' . $row["project_color_identifier"] . '">';
                $s .= '<font color="' . bestColor($row["project_color_identifier"]) . '">';
                if ($row['file_project'] > 0) {
                    $href = './index.php?m=projects&a=view&project_id=' . $row['file_project'];
                } else {
                    $href = './index.php?m=projects';
                }
                $s .= '<a href="' . $href . '">' . $row["project_name"] . '</a>';
                $s .= '</font></td></tr>';
                echo $s;
            }
        }
        $fp = $row["file_project"];
        if ($row['file_versions'] > 1) {
            $file = last_file($file_versions, $row['file_name'], $row['file_project']);
        } else {
            $file = $row;
        }
        ?>
	<form name="frm_remove_file_<?php 
        echo $file['file_id'];
        ?>
" action="?m=files" method="post">
	<input type="hidden" name="dosql" value="do_file_aed" />
	<input type="hidden" name="del" value="1" />
	<input type="hidden" name="file_id" value="<?php 
        echo $file['file_id'];
        ?>
" />
	<input type="hidden" name="redirect" value="<?php 
        echo $current_uri;
        ?>
" />
	</form>		
	<form name="frm_duplicate_file_<?php 
        echo $file['file_id'];
        ?>
" action="?m=files" method="post">
	<input type="hidden" name="dosql" value="do_file_aed" />
	<input type="hidden" name="duplicate" value="1" />
	<input type="hidden" name="file_id" value="<?php 
        echo $file['file_id'];
        ?>
" />
	<input type="hidden" name="redirect" value="<?php 
        echo $current_uri;
        ?>
" />
	</form>		
	<tr>
		<td nowrap="8%">
			<?php 
        $file_icon = getIcon($row['file_type']);
        echo "<a href=\"./fileviewer.php?file_id={$file['file_id']}\" title=\"{$file['file_description']}\"><img border=\"0\" width=\"16\" heigth=\"16\" src=\"" . DP_BASE_URL . "/modules/files/images/{$file_icon}\" />&nbsp;{$row['file_name']}</a>";
        ?>
		</td>
		<td width="20%"><?php 
        echo $file['file_description'];
        ?>
</td>
		<td width="5%" nowrap="nowrap" align="center">
	        <?php 
        $hidden_table = '';
        echo $row['file_lastversion'];
        if ($row['file_versions'] > 1) {
            echo ' <a href="#" onClick="expand(\'versions_' . $file['file_id'] . '\'); ">(' . $row['file_versions'] . ')</a>';
            $hidden_table = '<tr><td colspan="20">
	<table style="display: none" id="versions_' . $file['file_id'] . '" width="100%" border="0" cellpadding="2" cellspacing="1" class="tbl">
	<tr>
	        <th nowrap="nowrap">' . $AppUI->_('File Name') . '</th>
	        <th>' . $AppUI->_('Description') . '</th>
	        <th>' . $AppUI->_('Versions') . '</th>
	        <th>' . $AppUI->_('Category') . '</th>
	        <th nowrap="nowrap">' . $AppUI->_('Task Name') . '</th>
	        <th>' . $AppUI->_('Owner') . '</th>
	        <th>' . $AppUI->_('Size') . '</th>
	        <th>' . $AppUI->_('Type') . '</a></th>
	        <th>' . $AppUI->_('Date') . '</th>
    		<th nowrap="nowrap">' . $AppUI->_('co Reason') . '</th>
    		<th>' . $AppUI->_('co') . '</th>
	        <th nowrap width="1"></th>
	        <th nowrap width="1"></th>
	</tr>
	';
            foreach ($file_versions as $file_row) {
                if ($file_row['file_name'] == $row['file_name'] && $file_row['file_project'] == $row['file_project']) {
                    $file_icon = getIcon($file_row['file_type']);
                    $file_date = new CDate($file_row['file_date']);
                    $hidden_table .= '	
			<form name="frm_delete_sub_file_' . $file_row['file_id'] . '" action="?m=files" method="post">
			<input type="hidden" name="dosql" value="do_file_aed" />
			<input type="hidden" name="del" value="1" />
			<input type="hidden" name="file_id" value="' . $file_row['file_id'] . '" />
			<input type="hidden" name="redirect" value="' . $current_uri . '" />
			</form>';
                    $hidden_table .= '	
			<form name="frm_duplicate_sub_file_' . $file_row['file_id'] . '" action="?m=files" method="post">
			<input type="hidden" name="dosql" value="do_file_aed" />
			<input type="hidden" name="duplicate" value="1" />
			<input type="hidden" name="file_id" value="' . $file_row['file_id'] . '" />
			<input type="hidden" name="redirect" value="' . $current_uri . '" />
			</form>';
                    $hidden_table .= '
	        <tr>
	                <td nowrap="8%"><a href="./fileviewer.php?file_id=' . $file_row['file_id'] . '" 
	                        title="' . $file_row['file_description'] . '">' . "<img border=\"0\" width=\"16\" heigth=\"16\" src=\"" . DP_BASE_URL . "/modules/files/images/{$file_icon}\" />&nbsp;" . $file_row['file_name'] . '
	                </a></td>
	                <td width="20%">' . $file_row['file_description'] . '</td>
	                <td width="5%" nowrap="nowrap" align="center">' . $file_row['file_version'] . '</td>
	                <td width="10%" nowrap="nowrap" align="center"><a href="./index.php?m=' . $m . '&a=' . $a . '&tab=' . ($file_row['file_category'] + 1) . '">' . $file_types[$file_row['file_category'] + 1] . '</a></td>
	                <td width="5%" align="center"><a href="./index.php?m=tasks&a=view&task_id=' . $file_row["file_task"] . '">' . $row["task_name"] . '</a></td>
	                <td width="15%" nowrap="nowrap">' . $row["contact_first_name"] . ' ' . $row["contact_last_name"] . '</td>
	                <td width="5%" nowrap="nowrap" align="right">' . intval($file_row['file_size'] / 1024) . 'kb </td>
	                <td width="15%" nowrap="nowrap">' . $file_row['file_type'] . '</td>
	                <td width="15%" nowrap="nowrap" align="right">' . $file_date->format("{$df} {$tf}") . '</td>
        			<td width="10%">' . $row['file_co_reason'] . '</td>
        			<td nowrap="nowrap" align="center">';
                    if ($canEdit && empty($file_row['file_checkout'])) {
                        $hidden_table .= '<a href="?m=files&a=co&file_id=' . $file_row['file_id'] . '">' . dPshowImage('./modules/files/images/up.png', '16', '16', 'checkout', 'checkout file') . '</a>';
                    } else {
                        if ($row['file_checkout'] == $AppUI->user_id) {
                            $hidden_table .= '<a href="?m=files&a=addedit&ci=1&file_id=' . $file_row['file_id'] . '">' . dPshowImage('./modules/files/images/down.png', '16', '16', 'checkin', 'checkin file') . '</a>';
                        } else {
                            if ($file_row['file_checkout'] == 'final') {
                                $hidden_table .= 'final';
                            } else {
                                $q4 = new DBQuery();
                                $q4->addQuery("file_id, file_checkout, user_username as co_user, contact_first_name, contact_last_name");
                                $q4->addTable('files');
                                $q4->leftJoin('users', 'cu', 'cu.user_id = file_checkout');
                                $q4->leftJoin('contacts', 'co', 'co.contact_id = cu.user_contact');
                                $q4->addWhere('file_id = ' . $file_row['file_id']);
                                $co_user = array();
                                $co_user = $q4->loadList();
                                $co_user = $co_user[0];
                                $q4->clear();
                                $hidden_table .= $co_user['contact_first_name'] . ' ' . $co_user['contact_last_name'] . '<br>(' . $co_user['co_user'] . ')';
                            }
                        }
                    }
                    $hidden_table .= '</td>';
                    $hidden_table .= '<td nowrap="nowrap" align="right" width="48">';
                    if ($canEdit && (empty($file_row['file_checkout']) || $file_row['file_checkout'] == 'final' && ($canEdit || $row['project_owner'] == $AppUI->user_id))) {
                        $hidden_table .= '<a href="./index.php?m=files&a=addedit&file_id=' . $file_row["file_id"] . '">' . dPshowImage('./modules/files/images/kedit.png', '16', '16', 'edit file', 'edit file') . "</a>" . '<a href="#" onclick="document.frm_duplicate_sub_file_' . $file_row['file_id'] . '.submit()">' . dPshowImage('./modules/files/images/duplicate.png', '16', '16', 'duplicate file', 'duplicate file') . "</a>" . '<a href="#" onclick="if (confirm(\'Are you sure you want to delete this file?\')) {document.frm_delete_sub_file_' . $file_row['file_id'] . '.submit()}">' . dPshowImage('./modules/files/images/remove.png', '16', '16', 'delete file', 'delete file') . "</a>";
                    }
                    $hidden_table .= '</td>';
                    $hidden_table .= '<td nowrap="nowrap" align="right" width="1">';
                    if ($canEdit && (empty($row['file_checkout']) || $row['file_checkout'] == 'final' && ($canEdit || $row['project_owner'] == $AppUI->user_id))) {
                        $bulk_op = 'onchange="(this.checked) ? addBulkComponent(' . $file_row['file_id'] . ') : removeBulkComponent(' . $file_row['file_id'] . ')"';
                        $hidden_table .= '<input type="checkbox" ' . $bulk_op . ' name="chk_sub_sel_file_' . $file_row['file_id'] . '" />';
                    }
                    $hidden_table .= '</td>';
                    $hidden_table .= '</tr>';
                }
            }
            $hidden_table .= '</table>';
            //$hidden_table .= '</span>';
        }
        ?>
	        </td>
	        <td width="10%" nowrap="nowrap" align="center"><a href="./index.php?m=<?php 
        echo $m;
        ?>
&a=<?php 
        echo $a;
        ?>
&view=categories&tab=<?php 
        echo $file['file_category'];
        ?>
"><?php 
        echo $file_types[$file["file_category"]];
        ?>
</a></td> 
		<td width="5%" align="center"><a href="./index.php?m=tasks&a=view&task_id=<?php 
        echo $file["task_id"];
        ?>
"><?php 
        echo $file["task_name"];
        ?>
</a></td>
		<td width="15%" nowrap="nowrap"><?php 
        echo $file["contact_first_name"] . ' ' . $file["contact_last_name"];
        ?>
</td>
		<td width="5%" nowrap="nowrap" align="right"><?php 
        echo intval($file["file_size"] / 1024);
        ?>
 kb</td>
		<td width="15%" nowrap="nowrap"><?php 
        echo $file["file_type"];
        ?>
</td>
		<td width="15%" nowrap="nowrap" align="right"><?php 
        echo $file_date->format("{$df} {$tf}");
        ?>
</td>
        <td width="10%"><?php 
        echo $file['file_co_reason'];
        ?>
</td>
        <td nowrap="nowrap" align="center">
        <?php 
        if ($canEdit && empty($row['file_checkout'])) {
            ?>
                <a href="?m=files&a=co&file_id=<?php 
            echo $file['file_id'];
            ?>
"><?php 
            echo dPshowImage('./modules/files/images/up.png', '16', '16', 'checkout', 'checkout file');
            ?>
</a>
        <?php 
        } else {
            if ($row['file_checkout'] == $AppUI->user_id) {
                ?>
                <a href="?m=files&a=addedit&ci=1&file_id=<?php 
                echo $file['file_id'];
                ?>
"><?php 
                echo dPshowImage('./modules/files/images/down.png', '16', '16', 'checkin', 'checkin file');
                ?>
</a>
        <?php 
            } else {
                if ($file['file_checkout'] == 'final') {
                    echo 'final';
                } else {
                    $q4 = new DBQuery();
                    $q4->addQuery("file_id, file_checkout, user_username as co_user, contact_first_name, contact_last_name");
                    $q4->addTable('files');
                    $q4->leftJoin('users', 'cu', 'cu.user_id = file_checkout');
                    $q4->leftJoin('contacts', 'co', 'co.contact_id = cu.user_contact');
                    $q4->addWhere('file_id = ' . $file['file_id']);
                    $co_user = array();
                    $co_user = $q4->loadList();
                    $co_user = $co_user[0];
                    $q4->clear();
                    echo $co_user['contact_first_name'] . ' ' . $co_user['contact_last_name'] . '<br>(' . $co_user['co_user'] . ')';
                }
            }
        }
        ?>
                
        </td>
		<td nowrap="nowrap" align="center" width="48">
		<?php 
        if ($canEdit && (empty($file['file_checkout']) || $file['file_checkout'] == 'final' && ($canEdit || $file['project_owner'] == $AppUI->user_id))) {
            echo '<a href="./index.php?m=files&a=addedit&file_id=' . $file["file_id"] . '">';
            echo dPshowImage('./modules/files/images/kedit.png', '16', '16', 'edit file', 'edit file');
            echo "</a>";
            echo '<a href="#" onclick="document.frm_duplicate_file_' . $file['file_id'] . '.submit()">' . dPshowImage('./modules/files/images/duplicate.png', '16', '16', 'duplicate file', 'duplicate file') . '</a>';
            echo '<a href="#" onclick="if (confirm(\'Are you sure you want to delete this file?\')) {document.frm_remove_file_' . $file['file_id'] . '.submit()}">' . dPshowImage('./modules/files/images/remove.png', '16', '16', 'delete file', 'delete file') . '</a>';
        }
        ?>
		<td nowrap="nowrap" align="center" width="1">
		<?php 
        if ($canEdit && (empty($file['file_checkout']) || $file['file_checkout'] == 'final' && ($canEdit || $file['project_owner'] == $AppUI->user_id))) {
            $bulk_op = 'onchange="(this.checked) ? addBulkComponent(' . $file['file_id'] . ') : removeBulkComponent(' . $file['file_id'] . ')"';
            echo '<input type="checkbox" ' . $bulk_op . ' name="chk_sel_file_' . $file['file_id'] . '" />';
        }
        ?>
		
		</td>
	</tr>
	<?php 
        echo $hidden_table;
        ?>
	<?php 
        $hidden_table = '';
    }
    ?>
	</table>
	<?php 
    if ($xpg_totalrecs > $xpg_pagesize) {
        showfnavbar($xpg_totalrecs, $xpg_pagesize, $xpg_total_pages, $page, $folder);
    }
    echo "<br />";
}
Ejemplo n.º 15
0
<?php

$AppUI->savePlace();
$canEdit = !getDenyEdit($m);
$canRead = !getDenyRead($m);
if (!$canRead) {
    $AppUI->setMsg('Access denied', UI_MSG_ERROR);
    $AppUI->redirect();
}
$sql_table = 'contacts';
//Modify this mapping to match your LDAP->contact structure
//For instance, of you want the contact_phone2 field to be populated out of, say telephonenumber2 then you would just modify
//	'physicaldeliveryofficename' => 'contact_phone2',
// ro
//	'telephonenumber2' => 'contact_phone2',
$sql_ldap_mapping = array('givenname' => 'contact_first_name', 'sn' => 'contact_last_name', 'title' => 'contact_title', 'companyname' => 'contact_company', 'department' => 'contact_department', 'employeeid' => 'contact_type', 'mail' => 'contact_email', 'telephonenumber' => 'contact_phone', 'physicaldeliveryofficename' => 'contact_phone2', 'postaladdress' => 'contact_address1', 'l' => 'contact_city', 'st' => 'contact_state', 'postalcode' => 'contact_zip', 'c' => 'contact_country');
$titleBlock = new CTitleBlock('Import Contacts from LDAP Directory');
$titleBlock->addButton('Main page', '?m=system');
$titleBlock->show();
if (isset($_POST['server'])) {
    $AppUI->setState('LDAPServer', $_POST['server']);
}
$server = $AppUI->getState('LDAPServer', '');
if (isset($_POST['bind_name'])) {
    $AppUI->setState('LDAPBindName', $_POST['bind_name']);
}
$bind_name = $AppUI->getState('LDAPBindName', '');
$bind_password = dPgetParam($_POST, 'bind_password', '');
if (isset($_POST['port'])) {
    $AppUI->setState('LDAPPort', $_POST['port']);
}
Ejemplo n.º 16
0
<?php

/* DEPARTMENTS $Id: addedit.php,v 1.24 2005/04/08 13:41:51 gregorerhardt Exp $ */
// Add / Edit Company
$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();
Ejemplo n.º 17
0
<?php

global $TIMECARD_CONFIG;
$m = $AppUI->checkFileName(dPgetParam($_GET, 'm', getReadableModule()));
$denyEdit = getDenyEdit($m);
if ($denyEdit) {
    $AppUI->setMsg('Access denied', UI_MSG_ERROR);
    $AppUI->redirect();
}
//grab hours per day from config
$min_hours_day = $AppUI->cfg['daily_working_hours'];
$can_edit_other_timesheets = $TIMECARD_CONFIG['minimum_edit_level'] >= $AppUI->user_type;
$show_other_worksheets = $TIMECARD_CONFIG['minimum_see_level'] >= $AppUI->user_type;
$show_possible_hours_worked = $TIMECARD_CONFIG['show_possible_hours_worked'];
//print "<pre>";
//print_r($AppUI);
//print "</pre>";
//compute hours/week from config
$min_hours_week = count(explode(",", dPgetConfig("cal_working_days"))) * $min_hours_day;
// get date format
$df = $AppUI->getPref('SHDATEFORMAT');
if (isset($_GET['user_id'])) {
    $sql = "SELECT user_company FROM users WHERE user_id = " . $_GET['user_id'];
    $company_id = db_loadResult($sql);
    if (getDenyRead("companies", $company_id)) {
        $AppUI->setMsg('Access denied', UI_MSG_ERROR);
        $AppUI->redirect();
    }
    $AppUI->setState('TimecardSelectedUser', $_GET['user_id']);
}
$user_id = $AppUI->getState('TimecardSelectedUser') ? $AppUI->getState('TimecardSelectedUser') : $AppUI->user_id;
Ejemplo n.º 18
0
<?php

// deny all but system admins
$canEdit = !getDenyEdit('system');
if (!$canEdit) {
    $AppUI->redirect("m=public&a=access_denied");
}
$AppUI->savePlace();
$q = new DBQuery();
if (isset($_POST['forcewatch']) && isset($_POST['forcesubmit'])) {
    // insert row into forum_watch for forcing Watch
    $q->addTable('forum_watch');
    $q->addInsert('watch_user', 0);
    $q->addInsert('watch_forum', 0);
    $q->addInsert('watch_topic', 0);
    if (!$q->exec()) {
        $AppUI->setMsg(db_error(), UI_MSG_ERROR);
    } else {
        $AppUI->setMsg("Watch Forced", UI_MSG_OK);
    }
    $q->clear();
    $AppUI->redirect('m=forums&a=configure');
} elseif (isset($_POST['forcesubmit']) && !isset($_POST['forcewatch'])) {
    // delete row from forum_watch for unorcing Watch
    $q->setDelete('forum_watch');
    $q->addWhere('watch_user = 0');
    $q->addWhere('watch_forum = 0');
    $q->addWhere('watch_topic = 0');
    if (!$q->exec()) {
        $AppUI->setMsg(db_error(), UI_MSG_ERROR);
    } else {
Ejemplo n.º 19
0
<?php

/* This file will write a php config file to be included during execution of
 * all helpdesk files which require the configuration options. */
// Deny all but system admins
if (getDenyEdit('system')) {
    $AppUI->redirect("m=public&a=access_denied");
}
@(include_once "./functions/admin_func.php");
$CONFIG_FILE = "./modules/helpdesk/config.php";
$AppUI->savePlace();
// Get a list of companies
$sql = "SELECT company_id, company_name\n        FROM companies\n        ORDER BY company_name";
$res = db_exec($sql);
// Add "No Company"
$companies['-1'] = '';
while ($row = db_fetch_assoc($res)) {
    $companies[$row['company_id']] = $row['company_name'];
}
//define user type list
$user_types = arrayMerge($utypes, array('9' => $AppUI->_('None')));
/* All config options, their descriptions and their default values are defined
* here. Add new config options here. Type can be "checkbox", "text", "radio" or
* "select". If the type is "radio," it must include a set of buttons. If it's
* "select" then be sure to include a 'list' entry with the options.  if the key
* starts with headingXXX then it will just display the contents on the value.
* This is used for grouping.
*/
$config_options = array("heading1" => $AppUI->_('Paging Options'), "items_per_page" => array("description" => $AppUI->_('helpdeskItemsPerPage'), "value" => 30, 'type' => 'text'), "status_log_items_per_page" => array("description" => $AppUI->_('helpdeskLogsPerPage'), "value" => 15, 'type' => 'text'), "pages_per_side" => array("description" => $AppUI->_('helpdeskPagesPerSide'), "value" => 5, 'type' => 'text'), "heading2" => $AppUI->_('Permission Options'), "the_company" => array("description" => $AppUI->_('helpdeskHDCompany'), "value" => '', 'type' => 'select', 'list' => $companies), "no_company_editable" => array("description" => $AppUI->_('helpdeskItemsNoCompany'), "value" => '0', 'type' => 'radio', 'buttons' => array(1 => $AppUI->_('Yes'), 0 => $AppUI->_('No'))), 'minimum_edit_level' => array('description' => $AppUI->_('helpdeskMinLevel'), 'value' => 9, 'type' => 'select', 'list' => @$user_types), "use_project_perms" => array("description" => $AppUI->_('helpdeskUseProjectPerms'), "value" => '0', 'type' => 'radio', 'buttons' => array(1 => $AppUI->_('Yes'), 0 => $AppUI->_('No'))), 'minimum_report_level' => array('description' => $AppUI->_('helpdeskMinRepLevel'), 'value' => 9, 'type' => 'select', 'list' => @$user_types), "heading3" => $AppUI->_('New Item Default Selections'), "default_assigned_to_current_user" => array("description" => $AppUI->_('helpdeskDefCurUser'), "value" => 1, 'type' => 'radio', 'buttons' => array(1 => $AppUI->_('Yes'), 0 => $AppUI->_('No'))), "default_notify_by_email" => array("description" => $AppUI->_('helpdeskDefNotify'), "value" => 1, 'type' => 'radio', 'buttons' => array(1 => $AppUI->_('Yes'), 0 => $AppUI->_('No'))), "default_company_current_company" => array("description" => $AppUI->_('helpdeskDefCompany'), "value" => 1, 'type' => 'radio', 'buttons' => array(1 => $AppUI->_('Yes'), 0 => $AppUI->_('No'))), "heading4" => $AppUI->_('Search Fields On Item List'), "search_criteria_search" => array("description" => $AppUI->_('Title/Summary Search'), "value" => 1, 'type' => 'checkbox'), "search_criteria_call_type" => array("description" => $AppUI->_('Call Type'), "value" => 1, 'type' => 'checkbox'), "search_criteria_company" => array("description" => $AppUI->_('Company'), "value" => 1, 'type' => 'checkbox'), "search_criteria_status" => array("description" => $AppUI->_('Status'), "value" => 1, 'type' => 'checkbox'), "search_criteria_call_source" => array("description" => $AppUI->_('Call Source'), "value" => 1, 'type' => 'checkbox'), "search_criteria_project" => array("description" => $AppUI->_('Project'), "value" => 1, 'type' => 'checkbox'), "search_criteria_assigned_to" => array("description" => $AppUI->_('Assigned To'), "value" => 1, 'type' => 'checkbox'), "search_criteria_priority" => array("description" => $AppUI->_('Priority'), "value" => 1, 'type' => 'checkbox'), "search_criteria_application" => array("description" => $AppUI->_('Application'), "value" => 1, 'type' => 'checkbox'), "search_criteria_requestor" => array("description" => $AppUI->_('Requestor'), "value" => 1, 'type' => 'checkbox'), "search_criteria_severity" => array("description" => $AppUI->_('Severity'), "value" => 1, 'type' => 'checkbox'), "search_criteria_os" => array("description" => $AppUI->_('Operating System'), "value" => 1, 'type' => 'checkbox'));
//if this is a submitted page, overwrite the config file.
if (dPgetParam($_POST, "Save", '') != '') {