Пример #1
0
function hook_project_management_adminticketinfo($vars)
{
    global $aInt;
    global $jscode;
    global $jquerycode;
    $ticketid = $vars['ticketid'];
    $ticketdata = get_query_vals("tbltickets", "userid,title,tid", array("id" => $ticketid));
    $tid = $ticketdata['tid'];
    require ROOTDIR . "/modules/addons/project_management/project_management.php";
    $projectrows = "";
    $result = select_query("mod_project", "mod_project.*,(SELECT CONCAT(firstname,' ',lastname) FROM tbladmins WHERE id=mod_project.adminid) AS adminname", "ticketids LIKE '%" . mysql_real_escape_string($tid) . "%'");
    while ($data = mysql_fetch_array($result)) {
        $timerid = get_query_val("mod_projecttimes", "id", array("projectid" => $data['id'], "end" => "", "adminid" => $_SESSION['adminid']), "start", "DESC");
        $timetrackinglink = $timerid ? "<a href=\"#\" onclick=\"projectendtimer('" . $data['id'] . "');return false\"><img src=\"../modules/addons/project_management/images/notimes.png\" align=\"absmiddle\" border=\"0\" /> Stop Tracking Time</a>" : "<a href=\"#\" onclick=\"projectstarttimer('" . $data['id'] . "');return false\"><img src=\"../modules/addons/project_management/images/starttimer.png\" align=\"absmiddle\" border=\"0\" /> Start Tracking Time</a>";
        $projectrows .= "<tr><td><a href=\"addonmodules.php?module=project_management&m=view&projectid=" . $data['id'] . "\">" . $data['id'] . "</a></td><td><a href=\"addonmodules.php?module=project_management&m=view&projectid=" . $data['id'] . "\">" . $data['title'] . "</a> <span id=\"projecttimercontrol" . $data['id'] . "\" class=\"tickettimer\">" . $timetrackinglink . "</span></td><td>" . $data['adminname'] . "</td><td>" . fromMySQLDate($data['created']) . "</td><td>" . fromMySQLDate($data['duedate']) . "</td><td>" . fromMySQLDate($data['lastmodified']) . "</td><td>" . $data['status'] . "</td></tr>";
    }
    $code = "<link href=\"../modules/addons/project_management/css/style.css\" rel=\"stylesheet\" type=\"text/css\" />\n\n<div id=\"projectscont\" style=\"margin:0 0 10px 0;padding:5px;border:2px dashed #e0e0e0;background-color:#fff;-moz-border-radius: 6px;-webkit-border-radius: 6px;-o-border-radius: 6px;border-radius: 6px;" . ($projectrows ? "" : "display:none;") . "\">\n\n<h2 style=\"margin:0 0 5px 0;text-align:center;background-color:#f2f2f2;-moz-border-radius: 6px;-webkit-border-radius: 6px;-o-border-radius: 6px;border-radius: 6px;\">Projects</h2>\n\n<div class=\"tablebg\" style=\"padding:0 20px;\">\n<table class=\"datatable\" width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"3\" id=\"ticketprojectstbl\">\n<tr><th>Project ID</th><th>Title</th><th>Assigned To</th><th>Created</th><th>Due Date</th><th>Last Updated</th><th>Status</th></tr>\n" . $projectrows . "\n</table>\n</div>\n\n</div>\n\n";
    if (project_management_checkperm("Create New Projects")) {
        $code .= "<span style=\"float:right;padding:0 50px 15px 0;\"><a href=\"#\" onclick=\"createnewproject();return false\" class=\"create\"><img src=\"images/icons/add.png\" align=\"top\" border=\"0\" /> <b>Create New Project</b></a></span>";
    }
    $code .= "\n<script>\n\$(document).on(\"keyup\",\"#cpclientname\",function () {\n\tvar ticketuseridsearchlength = \$(\"#cpclientname\").val().length;\n\tif (ticketuseridsearchlength>2) {\n\t\$.post(\"search.php\", { ticketclientsearch: 1, value: \$(\"#cpclientname\").val() },\n\t    function(data){\n            if (data) {\n                \$(\"#cpticketclientsearchresults\").html(data.replace(\"searchselectclient(\",\"projectsearchselectclient(\"));\n                \$(\"#cpticketclientsearchresults\").slideDown(\"slow\");\n                \$(\"#cpclientsearchcancel\").fadeIn();\n            }\n        });\n\t}\n});\nfunction projectsearchselectclient(userid,name,email) {\n    \$(\"#cpclientname\").val(name);\n    \$(\"#cpuserid\").val(userid);\n    \$(\"#cpclientsearchcancel\").fadeOut();\n\t\$(\"#cpticketclientsearchresults\").slideUp(\"slow\");\n}\n\nfunction createnewproject() {\n\t\$(\"#popupcreatenew\").show();\n\t\$(\"#popupstarttimer\").hide();\n\t\$(\"#popupendtimer\").hide();\n\t\$(\"#createnewcont\").slideDown();\n}\nfunction createproject() {\n\tinputs = \$(\"#ajaxcreateprojectform\").serializeArray();\n\t\$.post(\"addonmodules.php?module=project_management&createproj=1&ajax=1\", { input : inputs },\n\t\tfunction (data) {\n\t\t\tif(data == \"0\"){\n\t\t\t\talert(\"You do not have permission to create project\");\n\t\t\t} else {\n\t\t\t\t\$(\"#createnewcont\").slideUp();\n                \$(\"#ticketprojectstbl\").append(data);\n\t\t\t\t\$(\"#projectscont\").slideDown();\n\t\t\t}\n\t\t});\n}\n\nfunction projectstarttimer(projectid) {\n    \$(\"#ajaxstarttimerformprojectid\").val(projectid);\n\t\$(\"#popupcreatenew\").hide();\n\t\$(\"#popupstarttimer\").show();\n\t\$(\"#popupendtimer\").hide();\n\t\$(\"#createnewcont\").slideDown();\n}\n\nfunction projectendtimer(projectid) {\n\t\$(\"#popupcreatenew\").hide();\n\t\$(\"#popupstarttimer\").hide();\n\t\$(\"#popupendtimer\").show();\n\t\$(\"#createnewcont\").slideDown();\n}\n\nfunction projectstarttimersubmit() {\n\t\$.post(\"addonmodules.php?module=project_management&m=view\", \"a=hookstarttimer&\"+\$(\"#ajaxstarttimerform\").serialize(),\n\t\tfunction (data) {\n\t\t\tif(data == \"0\"){\n\t\t\t\talert(\"Could not start timer.\");\n\t\t\t} else {\n\t\t\t\t\$(\"#createnewcont\").slideUp();\n                var projid = \$(\"#ajaxstarttimerformprojectid\").val();\n\t\t\t\t\$(\"#projecttimercontrol\"+projid).html(\"<a href=\"//\" onclick=\"projectendtimer('\"+projid+\"');return false\"><img src=\"../modules/addons/project_management/images/notimes.png\" align=\"absmiddle\" border=\"0\" /> Stop Tracking Time</a>\");\n\t\$(\"#activetimers\").html(data);\n\t\t\t}\n\t\t});\n}\nfunction projectendtimersubmit(projectid,timerid) {\n\t\$.post(\"addonmodules.php?module=project_management&m=view\", \"a=hookendtimer&timerid=\"+timerid+\"&ticketnum=" . $tid . "\",\n\t\tfunction (data) {\n\t\t\tif (data == \"0\") {\n\t\t\t\talert(\"Could not stop timer.\");\n\t\t\t} else {\n\t\t\t\t\$(\"#createnewcont\").slideUp();\n\t\t\t\t\$(\"#projecttimercontrol\"+projectid).html(\"<a href=\"//\" onclick=\"projectstarttimer('\"+projectid+\"');return false\"><img src=\"../modules/addons/project_management/images/starttimer.png\" align=\"absmiddle\" border=\"0\" /> Start Tracking Time</a>\");\n\t\t\$(\"#activetimers\").html(data);\n\t\t\t}\n\t\t});\n}\n\nfunction projectpopupcancel() {\n\t\$(\"#createnewcont\").slideUp();\n}\n\n</script>\n\n<div class=\"projectmanagement\">\n\n<div id=\"createnewcont\" style=\"display:none;\">\n\n<div class=\"createnewcont2\">\n\n<div class=\"createnewproject\" id=\"popupcreatenew\" style=\"display:none\">\n<div class=\"title\">Create New Project</div>\n<form id=\"ajaxcreateprojectform\">\n<div class=\"label\">Title</div>\n<input type=\"text\" name=\"title\" class=\"title\" />\n<div class=\"float\">\n<div class=\"label\">Created</div>\n<input type=\"text\" name=\"created\" class=\"datepick\" value=\"" . getTodaysDate() . "\" />\n</div>\n<div class=\"float\">\n<div class=\"label\">Due Date</div>\n<input type=\"text\" name=\"duedate\" class=\"datepick\" value=\"" . getTodaysDate() . "\" />\n</div>\n<div class=\"float\">\n<div class=\"label\">Assigned To</div>\n<select class=\"title\" name=\"adminid\">";
    $code .= "<option value=\"0\">None</option>";
    $result = select_query("tbladmins", "id,firstname,lastname", "", "firstname` ASC,`lastname", "ASC");
    while ($data = mysql_fetch_array($result)) {
        $aid = $data['id'];
        $adminfirstname = $data['firstname'];
        $adminlastname = $data['lastname'];
        $code .= "<option value=\"" . $aid . "\"";
        if ($aid == $adminid) {
            $code .= " selected";
        }
        $code .= ">" . $adminfirstname . " " . $adminlastname . "</option>";
    }
    $code .= "</select>\n</div>\n<div class=\"float\">\n<div class=\"label\">Ticket #</div>\n<input type=\"text\" name=\"ticketnum\" class=\"ticketnum\" value=\"" . $tid . "\" />\n</div>\n<div class=\"clear\"></div>\n<div class=\"float\">\n<div class=\"label\">Associated Client</div>\n<input type=\"hidden\" name=\"userid\" id=\"cpuserid\" /><input type=\"text\" id=\"cpclientname\" value=\"" . $clientname . "\" class=\"title\" onfocus=\"if(this.value=='" . addslashes($clientname) . "')this.value=''\" /> <img src=\"images/icons/delete.png\" alt=\"" . $vars['_lang']['cancel'] . "\" align=\"right\" id=\"clientsearchcancel\" height=\"16\" width=\"16\"><div id=\"cpticketclientsearchresults\" style=\"z-index:2000;\"></div>\n</div>\n<br /><br />\n<div align=\"center\"><input type=\"button\" value=\"Create\" onclick=\"createproject()\" class=\"create\" /> <input type=\"button\" value=\"Cancel\" class=\"create\" onclick=\"projectpopupcancel();return false\" /></div>\n</form>\n</div>\n\n<div class=\"createnewproject\" id=\"popupstarttimer\" style=\"display:none\">\n<div class=\"title\">Start Time Tracking</div>\n<form id=\"ajaxstarttimerform\">\n<input type=\"hidden\" id=\"ajaxstarttimerformprojectid\" name=\"projectid\">\n<input type=\"hidden\" name=\"ticketnum\" value=\"" . $tid . "\" />\n<div class=\"label\">Select Existing Task</div>\n<select class=\"title\" style=\"min-width:450px\" name=\"taskid\">";
    $code .= "<option value=\"\">Choose one...</option>";
    $result = select_query("mod_projecttasks", "mod_project.title, mod_projecttasks.id, mod_projecttasks.projectid, mod_projecttasks.task", array("mod_project.ticketids" => array("sqltype" => "LIKE", "value" => (int) $tid)), "", "", "", "mod_project ON mod_projecttasks.projectid=mod_project.id", "", "", "", "mod_project ON mod_projecttasks.projectid=mod_project.id");
    while ($data = mysql_fetch_array($result)) {
        $code .= "<option value=\"" . $data['id'] . "\"";
        $code .= ">" . $data['projectid'] . " - " . $data['title'] . " - " . $data['task'] . "</option>";
    }
    $code .= "</select><br />\n<div class=\"label\">Or Create New Task</div>\n<input type=\"text\" name=\"title\" class=\"title\" />\n<br />\n<div align=\"center\"><input type=\"button\" value=\"Start\" onclick=\"projectstarttimersubmit();return false\" class=\"create\" /> <input type=\"button\" value=\"Cancel\" class=\"create\" onclick=\"projectpopupcancel();return false\" /></div>\n</form>\n</div>\n</div>\n\n<div class=\"createnewproject\" id=\"popupendtimer\" style=\"display:none\">\n<div class=\"title\">Stop Time Tracking</div>\n<form id=\"ajaxendtimerform\">\n<input type=\"hidden\" id=\"ajaxendtimerformprojectid\" name=\"projectid\">\n<br />\n<b>Active Timers</b>:<br /><br />\n<div id=\"activetimers\">\n";
    $result = select_query("mod_projecttimes", "mod_projecttimes.id, mod_projecttimes.projectid, mod_project.title, mod_projecttimes.taskid, mod_projecttasks.task, mod_projecttimes.start", array("mod_projecttimes.adminid" => $_SESSION['adminid'], "mod_projecttimes.end" => "", "mod_project.ticketids" => array("sqltype" => "LIKE", "value" => (int) $tid)), "", "", "", "mod_projecttasks ON mod_projecttimes.taskid=mod_projecttasks.id INNER JOIN mod_project ON mod_projecttimes.projectid=mod_project.id");
    while ($data = mysql_fetch_array($result)) {
        $code .= "<div class=\"stoptimer" . $data['id'] . "\" style=\"padding-bottom:10px;\"><em>" . $data['title'] . " - Project ID " . $data['projectid'] . "</em><br />&nbsp;&raquo; " . $data['task'] . "<br />Started at " . fromMySQLDate(date("Y-m-d H:i:s", $data['start']), 1) . ":" . date("s", $data['start']) . " - <a href=\"#\" onclick=\"projectendtimersubmit('" . $data['projectid'] . "','" . $data['id'] . "');return false\"><strong>Stop Timer</strong></a></div>";
    }
    $code .= "\n</div>\n<br />\n<div align=\"center\"><input type=\"button\" value=\"Cancel\" class=\"create\" onclick=\"projectpopupcancel();return false\" /></div>\n</form>\n</div>\n\n</div>\n\n</div>\n\n";
    return $code;
}
Пример #2
0
/**
 *
 * @ WHMCS FULL DECODED & NULLED
 *
 * @ Version  : 5.2.15
 * @ Author   : MTIMER
 * @ Release on : 2013-12-24
 * @ Website  : http://www.mtimer.cn
 *
 * */
if (!defined("WHMCS")) {
    exit("This file cannot be accessed directly");
}
echo $headeroutput;
echo "<h2>Reports</h2>";
if (!project_management_checkperm("View Reports")) {
    echo "<p>You do not have permission to view reports.</p>";
    return false;
}
$text_reports = array();
$dh = opendir("../modules/reports/");
while (false !== ($file = readdir($dh))) {
    if ($file != "index.php" && is_file("../modules/reports/" . $file)) {
        $file = str_replace(".php", "", $file);
        if (substr($file, 0, 5) != "graph" && substr($file, 0, 8) == "project_") {
            $nicename = str_replace("_", " ", $file);
            $nicename = titleCase($nicename);
            $text_reports[$file] = $nicename;
        }
    }
}
Пример #3
0
    }
    echo $aInt->sortableTable(array(array("title", $vars['_lang']['projectname']), $vars['_lang']['assignedto'], array("status", $vars['_lang']['status']), array("created", $vars['_lang']['created']), array("duedate", $vars['_lang']['duedate']), array("progress", $vars['_lang']['projectprogress']), array("duedate", $vars['_lang']['daysleft']), array("lastmodified", $vars['_lang']['lastmodified']), "", ""), $tabledata);
}
echo "\n</td><td width=\"1%\"></td><td width=\"19%\" valign=\"top\">";
if (project_management_checkperm("View Recent Activity")) {
    echo "<div align=\"center\"><b>" . $vars['_lang']['recentactivity'] . "</b></div>";
    $result = select_query("mod_projectlog", "mod_projectlog.*,(SELECT CONCAT(firstname,' ',lastname) FROM tbladmins WHERE tbladmins.id=mod_projectlog.adminid) AS admin,(SELECT title FROM mod_project WHERE mod_project.id=mod_projectlog.projectid) AS projectname, (SELECT adminid FROM mod_project WHERE mod_project.id=mod_projectlog.projectid) as assignedadminid", "", "id", "DESC", "0,10");
    $projectid = "";
    while ($data = mysql_fetch_array($result)) {
        $date = $data['date'];
        $projectid = $data['projectid'];
        $projectname = project_management_check_viewproject($projectid) ? "<a href=\"" . $modulelink . "&m=view&projectid=" . $projectid . "\">" . $data['projectname'] . "</a>" : $data['projectname'];
        $msg = $data['msg'];
        $admin = $data['admin'];
        $date = fromMySQLDate($date, true);
        if (project_management_checkperm("View Projects")) {
            echo "<div class=\"recentactivity\" onclick=\"window.location='" . $modulelink . "&m=view&projectid=" . $projectid . "'\"><div class=\"title\"><a href=\"" . $modulelink . "&m=view&projectid=" . $projectid . "\">" . $projectname . "</a></div><div class=\"desc\">" . $msg . "</div><div style=\"float:left;\" class=\"small\">" . $admin . "</div><div style=\"float:right;\" class=\"small\">" . $date . "</div><div style=\"clear:both;\"></div></div>";
        }
        echo "<div class=\"recentactivity\"><div class=\"title\">" . $projectname . "</div><div class=\"desc\">" . $msg . "</div><div style=\"float:left;\" class=\"small\">" . $admin . "</div><div style=\"float:right;\" class=\"small\">" . $date . "</div><div style=\"clear:both;\"></div></div>";
    }
    echo "<div align=\"right\"><a href=\"" . $modulelink . "&m=activity\">View More &raquo;</a> &nbsp;&nbsp;&nbsp;</div>";
} else {
    if (!project_management_checkperm("View Recent Activity")) {
        echo "<div class=\"recentactivity\"><div class=\"desc\" align=\"center\"><br />Welcome to the<br /><strong>Project Management Addon</strong> for WHMCS!<br /><br />Please click on <strong>Create New Project</strong> on the menu bar above to begin creating your ";
    }
    if (!$projectid) {
        echo "first ";
    }
    echo "project...<br /><br /><br /></div></div>";
}
echo "</td></tr></table>";
Пример #4
0
function project_management_check_viewproject($projectid, $adminid = "")
{
    if (!$adminid) {
        $adminid = $_SESSION['adminid'];
    }
    if (project_management_checkperm("View All Projects")) {
        return true;
    }
    $projectid = get_query_val("mod_project", "id", array("id" => $projectid));
    if (!$projectid) {
        return false;
    }
    if (project_management_checkperm("View Only Assigned Projects")) {
        $projectadminid = get_query_val("mod_project", "adminid", array("id" => $projectid));
        if ($adminid == $projectadminid) {
            return true;
        }
        $tasksresult = select_query("mod_projecttasks", "adminid", array("projectid" => $projectid));
        while ($tasksdata = mysql_fetch_assoc($tasksresult)) {
            if ($adminid == $tasksdata['adminid']) {
                return true;
            }
        }
    }
    return false;
}
Пример #5
0
/**
 *
 * @ WHMCS FULL DECODED & NULLED
 *
 * @ Version  : 5.2.15
 * @ Author   : MTIMER
 * @ Release on : 2013-12-24
 * @ Website  : http://www.mtimer.cn
 *
 **/
if (!defined("WHMCS")) {
    exit("This file cannot be accessed directly");
}
$projectid = (int) $_REQUEST['projectid'];
if (!project_management_checkperm("Edit Tasks")) {
    redir("module=project_management&m=view&projectid=" . $projectid);
}
require ROOTDIR . "/includes/gatewayfunctions.php";
require ROOTDIR . "/includes/ticketfunctions.php";
$taskid = $_REQUEST['id'];
$modulelink .= "&projectid=" . (int) $projectid;
if ($a == "taskssave") {
    $task = $_REQUEST['task'];
    $taskid = $_REQUEST['taskid'];
    $taskadmin = $_REQUEST['taskadmin'];
    $taskduedate = toMySQLDate($_REQUEST['taskduedate']);
    $tasknotes = $_REQUEST['tasknotes'];
    update_query("mod_projecttasks", array("task" => $task, "adminid" => $taskadmin, "duedate" => $taskduedate, "notes" => $tasknotes), array("id" => $taskid));
    foreach ($_REQUEST['admin'] as $timerid => $adminval) {
        $starttime = $_REQUEST['start'][$timerid];
Пример #6
0
    $date = date("jS F Y @ H:ia", mktime($dates[0], $dates[1], $dates[2], $dates2[1], $dates2[2], $dates2[0]));
    $attachments = explode(",", $attachments);
    $attachment = "";
    foreach ($attachments as $num => $attach) {
        if ($attach) {
            $attachment .= "<img src=\"../images/article.gif\" align=\"absmiddle\" /> <a href=\"../modules/addons/project_management/project_management.php?action=dl&projectid=" . $projectid . "&msg=" . $msgid . "&i=" . $num . "\">" . substr($attach, 7) . "</a>";
            continue;
        }
    }
    if ($attachment) {
        $attachment = "<br /><br /><strong>" . $vars['_lang']['attachments'] . "</strong><br />" . $attachment;
    }
    echo "<div class=\"msg" . $i . "\" id=\"msg" . $msgid . "\"><div class=\"date\">" . $vars['_lang']['postedby'] . " <strong>" . $adminuser . "</strong> " . $vars['_lang']['on'] . " " . $date . "</div><div class=\"msg\"><div class=\"msgholder\" id=\"msgholder" . $msgid . "\">" . nl2br(ticketAutoHyperlinks($message)) . "</div>" . $attachment;
    echo "<div style=\"display:none\" class=\"msgeditorholder" . $i . "\" id=\"msgeditorholder" . $msgid . "\"><textarea class=\"msgeditor\" id=\"msgeditor" . $msgid . "\">" . $message . "</textarea><input type=\"button\" class=\"msgeditorsavechanges\" id=\"msgeditorsavechanges" . $msgid . "\" value=\"" . $vars['_lang']['savechanges'] . "\" /></div>";
    echo "<div class=\"actions\" align=\"right\"><a class=\"editstaffmsg\" id=\"editstaffmsg" . $msgid . "\"><img src=\"images/edit.gif\"></a>";
    if (project_management_checkperm("Delete Messages")) {
        echo "&nbsp;<a class=\"deletestaffmsg\" id=\"deletestaffmsg" . $msgid . "\"><img src=\"images/delete.gif\"></a>";
    }
    echo "</div></div></div><div class=\"clear\"></div>";
    if ($i == 1) {
        $i = 2;
    }
    $i = 1;
}
if (!$msgid) {
    echo "<div class=\"msgnone\">" . $vars['_lang']['nomessagespostedyet'] . "</div>";
}
echo "</div>\n\n</td></tr></table>\n\n<h2>" . $vars['_lang']['activitylog'] . "</h2>\n\n";
$aInt->sortableTableInit("nopagination");
$tabledata = "";
$result = select_query("mod_projectlog", "mod_projectlog.*,(SELECT CONCAT(firstname,' ',lastname) FROM tbladmins WHERE tbladmins.id=mod_projectlog.adminid) AS admin", array("projectid" => $projectid), "id", "DESC", "0,15");