/** * Class for managing activities * * @author Sandy Pleyte <*****@*****.**> * @package achievo * @subpackage crm * @since 1.3.0 */ function smarty_function_crmlastviewed($params, &$smarty) { $eventlog =& atkGetNode("crm.eventlog"); $userid = atkGetUserId(); $items = $eventlog->getRecentlyViewed($userid); $theme =& atkinstance("atk.ui.atktheme"); $tpl = $theme->tplPath("crm_lastviewed.tpl"); if ($theme->tplPath("crm_lastviewed.tpl")) { $ui =& atkinstance("atk.ui.atkui"); return $ui->render('crm_lastviewed.tpl', array("items" => $items)); } return "no template ?"; }
function getSearchPiece() { $theme =& atkinstance("atk.ui.atktheme"); if ($theme->getAttribute('useframes', true)) { $target = 'main'; } else { $target = ""; } $node = atkconfig("top_search_node") ? atkconfig("top_search_node") : "search.search"; $searchnode =& atkGetNode($node); $searchpiece = $searchnode->simpleSearchForm("", $target, SESSION_NEW); return $searchpiece; }
// Note: we don't check the existance of the database or its tables yet, since // the installer can install the database if needed. Here, we just check if PHP // was compiled with the correct database support. $dbs = array("mysqli" => "mysqli_connect", "oci8" => "OCILogon", "oci9" => "OCILogin", "pgsql" => "pg_connect"); $dbconfig = atkconfig("db"); if (!function_exists($dbs[$dbconfig["default"]["driver"]])) { $errors[] = "Your PHP installation seems to be compiled without <b>" . $dbconfig["default"]["driver"] . "</b>\n database support.\n <br>Please recompile PHP with support for " . $dbconfig["default"]["driver"] . ", or, if you\n installed from rpm, install the php rpm for this database.\n <br>Alternatively, select a different database in the config.inc.php file (<b>\$config_database</b>)."; } // If there are any errors when we reach this point, it's no use continuing because // we don't have a correct database setup, so we can't continue setup. if (count($errors) > 0) { displayErrors($errors); exit; } // Create node $obj =& atkGetNode("setup.setup"); if ($ATK_VARS["atkaction"] == "") { $ATK_VARS["atkaction"] = "intro"; } if (is_object($obj)) { $obj->dispatch($ATK_VARS); } else { $errors[] = "Achievo will not run for a (yet) unkown reason. The install-script will dump\n some information below.\n <br>Please e-mail this entire page to bugs@achievo.org for analysis, so we might\n be able to help you, or fix Achievo to work with your setup.\n <br><br>PHP version: " . phpversion() . "\n <br><br>Please mention which operating system, which webserver, and\n which database you are using.\n <br>If possible, include their version numbers as well."; // Something went wrong, but it is uncertain what it is. To investigate these // kinds of issues, we force $config_debug to 'on' and ask the user politely // to mail us the debugoutput. displayErrors($errors, false); $config_debug = 1; } $output =& atkOutput::getInstance(); $output->outputFlush();
require_once $config_atkroot . "atk/atknodetools.inc"; // start the session - we just might need it later on atksession(); // register all nodes from all modules foreach (array_keys(atkGetModules()) as $modulename) { $module = atkGetModule($modulename); if (is_object($module) && method_exists($module, "getNodes")) { $module->getNodes(); } } //reset some counters $i = $j = $k = $l = 0; // instantiate all nodes from all modules and parse attributes that hold a relation foreach (array_keys($g_nodes) as $modulename) { foreach (array_keys($g_nodes[$modulename]) as $nodename) { $node = atkGetNode("{$modulename}.{$nodename}"); $attributes = $node->getAttributes(); foreach ($attributes as $attribute) { if ($attribute instanceof atkOneToOneRelation) { $i++; $oneToOneRelations .= "A:" . $attribute . "->" . $attribute->getDestination() . "\n"; $oneToOneRelations .= "D:" . $node->getTable() . '.' . $node->primaryKeyField() . "->" . $attribute->getDestination()->getTable() . "." . $attribute->getDestination()->primaryKeyField() . "\n\n"; } elseif ($attribute instanceof atkOneToManyRelation) { $j++; $oneToManyRelations .= "A:" . $attribute . "->" . $attribute->getDestination() . "\n"; $oneToManyRelations .= "D:" . $node->getTable() . '.' . $node->primaryKeyField() . "->" . $attribute->getDestination()->getTable() . "." . $attribute->getDestination()->primaryKeyField() . "\n\n"; } elseif ($attribute instanceof atkManyToOneRelation) { $k++; $manyToOneRelations .= "A:" . $attribute . "->" . $attribute->getDestination() . "\n"; $manyToOneRelations .= "D:" . $node->getTable() . '.' . $node->primaryKeyField() . "->" . $attribute->getDestination()->getTable() . "." . $attribute->getDestination()->primaryKeyField() . "\n\n"; } elseif ($attribute instanceof atkManyToManyRelation) {
usort($gant, "cmp"); $graph = new GanttGraph(0, 0, "auto"); $graph->SetBox(); $graph->SetShadow(); // Show day, week and month scale $graph->ShowHeaders(GANTT_HDAY | GANTT_HWEEK | GANTT_HMONTH); // Use the short name of the month together with a 2 digit year // on the month scale $graph->scale->month->SetStyle(MONTHSTYLE_SHORTNAMEYEAR2); $graph->scale->month->SetFontColor("white"); $graph->scale->month->SetBackgroundColor("blue"); // 0 % vertical label margin $graph->SetLabelVMarginFactor(1); $i = 0; $activity = array(); $colornode =& atkGetNode("project.mastergantt_colorconfig"); foreach ($gant as $id => $gantphase) { // Projects that extent the selected period should be cut off. if ($gantphase['startdate'] < $from) { $gantphase['startdate'] = $from; } if ($gantphase['enddate'] > $to || $gantphase['enddate'] == '') { $gantphase['enddate'] = $to; } $caption = "[" . time_format($gantphase[$plannedbooked], true) . "]"; $activity[$i] = new GanttBar($i, $gantphase['name'], $gantphase['startdate'], $gantphase['enddate'], $caption); $colorbase = $gantphase[$plannedbooked]; $color = $colornode->getColor($colorbase / 60); $activity[$i]->SetPattern(BAND_SOLID, $color); $activity[$i]->SetHeight(10); $activity[$i]->SetFillColor($color);
$ui =& atkinstance("atk.ui.atkui"); $theme =& atkTheme::getInstance(); $page->register_style($theme->stylePath("style.css")); $destination = "index.php?atklogout=true"; if (isset($ATK_VARS["atknodetype"]) && isset($ATK_VARS["atkaction"])) { $destination .= "&atknodetype=" . $ATK_VARS["atknodetype"] . "&atkaction=" . $ATK_VARS["atkaction"]; if (isset($ATK_VARS["atkselector"])) { $destination .= "&atkselector=" . $ATK_VARS["atkselector"]; } } $title = atktext("title_session_expired"); $contenttpl = '<br>%s<br><br><input type="button" onclick="top.location=\'%s\';" value="%s"><br><br>'; $content = sprintf($contenttpl, atktext("explain_session_expired"), str_replace("'", "\\'", $destination), atktext("relogin")); $box = $ui->renderBox(array("title" => $title, "content" => $content)); $page->addContent($box); $output->output($page->render(atktext("title_session_expired"), true)); } else { atksecure(); include "theme.inc"; $lockType = atkconfig("lock_type"); if (!empty($lockType)) { atklock(); } // Create node $obj =& atkGetNode($ATK_VARS["atknodetype"]); $flags = array_key_exists("atkpartial", $ATK_VARS) ? HTML_PARTIAL : HTML_STRICT; //Handle http request $controller =& atkinstance("atk.atkcontroller"); $controller->dispatch($ATK_VARS, $flags); } $output->outputFlush();
if (!empty($gantphase['planned']) && $gantphase["maxhours"] > 0) { $tempp = $gantphase['planned'] / ($gantphase['maxhours'] * 60); $activity[$i]->progress->Set(1.0E-10, $tempp); $caption .= '[0/' . round($gantphase['planned'] / 60) . ']'; } } } else { $activity[$i]->SetPattern(BAND_RDIAG, "red"); } $activity[$i]->caption->Set($caption); //$graph->Add($activity[$i]); $i++; } atkimport("module.utils.dateutil"); // milestones $milestonenode =& atkGetNode("project.deliverable"); $deliverables = $milestonenode->selectDb("project_id=" . $projectid, "duedate"); for ($i = 0, $_i = count($deliverables); $i < $_i; $i++) { $due = date("Y-m-d", dateutil::arr2stamp($deliverables[$i]["duedate"])); $ms = new MileStone(count($gant) + $i, $deliverables[$i]["name"], $due, $due . " (" . $deliverables[$i]["name"] . ")"); $graph->Add($ms); } // dependencies for ($i = 0, $_i = count($dbrecordsdep); $i < $_i; $i++) { $activity[$reverselookup[$dbrecordsdep[$i]["dependency_phaseid_row"]]]->SetConstrain($reverselookup[$dbrecordsdep[$i]["dependency_phaseid_col"]], CONSTRAIN_ENDSTART); } for ($i = 0, $_i = count($activity); $i < $_i; $i++) { $graph->Add($activity[$i]); } //TO DO: find a good solution for errorhandling //here you can set a subtitle