本文整理汇总了PHP中Problem类的典型用法代码示例。如果您正苦于以下问题:PHP Problem类的具体用法?PHP Problem怎么用?PHP Problem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Problem类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: submit
public function submit($problem_id)
{
try {
$problem = new Problem($problem_id);
$language = fRequest::get('language', 'integer');
if (!array_key_exists($language, static::$languages)) {
throw new fValidationException('Invalid language.');
}
fSession::set('last_language', $language);
$code = trim(fRequest::get('code', 'string'));
if (strlen($code) == 0) {
throw new fValidationException('Code cannot be empty.');
}
if ($problem->isSecretNow()) {
if (!User::can('view-any-problem')) {
throw new fAuthorizationException('Problem is secret now. You are not allowed to submit this problem.');
}
}
$record = new Record();
$record->setOwner(fAuthorization::getUserToken());
$record->setProblemId($problem->getId());
$record->setSubmitCode($code);
$record->setCodeLanguage($language);
$record->setSubmitDatetime(Util::currentTime());
$record->setJudgeStatus(JudgeStatus::PENDING);
$record->setJudgeMessage('Judging... PROB=' . $problem->getId() . ' LANG=' . static::$languages[$language]);
$record->setVerdict(Verdict::UNKNOWN);
$record->store();
Util::redirect('/status');
} catch (fException $e) {
fMessaging::create('error', $e->getMessage());
fMessaging::create('code', '/submit', fRequest::get('code', 'string'));
Util::redirect("/submit?problem={$problem_id}");
}
}
开发者ID:daerduoCarey,项目名称:oj,代码行数:35,代码来源:SubmitController.php
示例2: fetchTimestamp
public function fetchTimestamp()
{
try {
$p = new Problem(fRequest::get('pid', 'integer'));
echo $p->getLastModified();
} catch (fException $e) {
echo -1;
}
}
开发者ID:daerduoCarey,项目名称:oj,代码行数:9,代码来源:PollingController.php
示例3: canCreateItem
/**
* Is the current user have right to create the current task ?
*
* @return boolean
**/
function canCreateItem()
{
if (!parent::canReadITILItem()) {
return false;
}
$problem = new Problem();
if ($problem->getFromDB($this->fields['problems_id'])) {
return Session::haveRight("edit_all_problem", "1") || Session::haveRight("show_my_problem", "1") && ($problem->isUser(CommonITILActor::ASSIGN, Session::getLoginUserID()) || isset($_SESSION["glpigroups"]) && $problem->haveAGroup(CommonITILActor::ASSIGN, $_SESSION['glpigroups']));
}
return false;
}
开发者ID:geldarr,项目名称:hack-space,代码行数:16,代码来源:problemtask.class.php
示例4: checkAuthor
private function checkAuthor($username)
{
foreach ($this->getProblems() as $problem_id) {
try {
$problem = new Problem($problem_id);
if ($problem->getAuthor() == $username) {
return TRUE;
}
} catch (Exception $e) {
continue;
}
}
return FALSE;
}
开发者ID:daerduoCarey,项目名称:oj,代码行数:14,代码来源:Report.php
示例5: save
public function save()
{
if (UserSession::getInstance()->getAccessLevel() < 3) {
die("<h1>Forbidden resource for you.</h1>");
}
$model = new Problem();
$model->setFields($this->params);
$modelId = $model->get("prb_id");
if (!isset($modelId)) {
$status = $this->saveNew($model);
return $status;
} else {
$status = $this->update($model);
return $status;
}
}
开发者ID:renatorroliveira,项目名称:algod,代码行数:16,代码来源:ProblemBS.php
示例6: beforeUpdate
static function beforeUpdate(Problem $problem)
{
if (!is_array($problem->input) || !count($problem->input)) {
// Already cancel by another plugin
return false;
}
// Toolbox::logDebug("PluginBehaviorsProblem::beforeUpdate(), Problem=", $problem);
$config = PluginBehaviorsConfig::getInstance();
// Check is the connected user is a tech
if (!is_numeric(Session::getLoginUserID(false)) || !Session::haveRight('problem', UPDATE)) {
return false;
// No check
}
$soltyp = isset($problem->input['solutiontypes_id']) ? $problem->input['solutiontypes_id'] : $problem->fields['solutiontypes_id'];
// Wand to solve/close the problem
if (isset($problem->input['solutiontypes_id']) && $problem->input['solutiontypes_id'] || isset($problem->input['solution']) && $problem->input['solution'] || isset($problem->input['status']) && in_array($problem->input['status'], array_merge(Problem::getSolvedStatusArray(), Problem::getClosedStatusArray()))) {
if ($config->getField('is_problemsolutiontype_mandatory')) {
if (!$soltyp) {
unset($problem->input['status']);
unset($problem->input['solution']);
unset($problem->input['solutiontypes_id']);
Session::addMessageAfterRedirect(__('You cannot close a problem without solution type', 'behaviors'), true, ERROR);
}
}
}
}
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:26,代码来源:problem.class.php
示例7: index
public function index()
{
$data = array();
$data['rain_problems'] = Problem::recentByBasin('RAIN', 'OR');
$data['water_problems'] = Problem::recentByBasin('WATER', 'OR');
$data['stats'] = Problem::todayStat();
return View::make('home/index', $data);
}
开发者ID:withlovee,项目名称:HAII,代码行数:8,代码来源:HomeController.php
示例8: index
/**
* View all problems
* @param string $status status of problem ("all", "marked", "unmarked")
* @param string $data_type WATER / RAIN
* @return mixed
*/
public function index($status, $data_type)
{
$params = $this->getParams($status, $data_type);
$data = $this->dataForForm($status, $data_type);
$data['selectDate'] = true;
$data['title'] = 'Error Log';
Log::info($params);
$data['problems'] = Problem::allForTable($params);
return View::make('errorlog/index', $data);
}
开发者ID:withlovee,项目名称:HAII,代码行数:16,代码来源:ErrorLogController.php
示例9: index
public function index($status, $data_type)
{
$params = $this->getParams($status, $data_type);
$data = $this->dataForForm($status, $data_type);
// $params['start_date'] = date('Y-m-d', getTime());
// $params['start_time'] = '07:01';
$params['end_date_after'] = date('Y-m-d', getTime());
$params['end_time_after'] = '07:01';
$data['selectDate'] = false;
$data['title'] = 'Daily Operations';
$data['problems'] = Problem::allForTable($params);
return View::make('dailyop/index', $data);
}
开发者ID:withlovee,项目名称:HAII,代码行数:13,代码来源:DailyOpController.php
示例10: generateDailyReport
public function generateDailyReport()
{
/*
{
"key": "HAIIEMAILKEY",
"num": 6,
"date": "2014-10-14 20:43",
"rain": [
{
"name": "Out of Ranges",
"stations": [
"TPTN",
"PUAA",
"PPCH"
]
},
{
"name": "Missing Pattern",
"stations": [
"ABCD"
]
}
],
"water": [
{
"name": "Out of Ranges",
"stations": [
"WATER"
]
}
]
}
*/
$data = Problem::yesterdayReport();
$num = count($data["water"]["OR"]["stations"]) + count($data["water"]["MG"]["stations"]) + count($data["water"]["FV"]["stations"]) + count($data["rain"]["OR"]["stations"]) + count($data["rain"]["MG"]["stations"]) + count($data["rain"]["FV"]["stations"]);
$input = array("key" => "HAIIEMAILKEY", "num" => $num, "date" => self::getStartDate('Y-m-d 07:00'), "rain" => $data["rain"], "water" => $data["water"]);
return APIEmailController::sendEmail($input, 'daily');
}
开发者ID:withlovee,项目名称:HAII,代码行数:38,代码来源:DailyReportController.php
示例11: index
public function index()
{
$this->cache_control('private', 5);
if ($pid = fRequest::get('id', 'integer')) {
Util::redirect('/problem/' . $pid);
}
$view_any = User::can('view-any-problem');
$this->page = fRequest::get('page', 'integer', 1);
$this->title = trim(fRequest::get('title', 'string'));
$this->author = trim(fRequest::get('author', 'string'));
$this->problems = Problem::find($view_any, $this->page, $this->title, $this->author);
$this->page_url = SITE_BASE . '/problems?';
if (!empty($this->title)) {
$this->page_url .= 'title=' . fHTML::encode($this->title) . '&';
}
if (!empty($this->author)) {
$this->page_url .= 'author=' . fHTML::encode($this->author) . '&';
}
$this->page_url .= 'page=';
$this->page_records = $this->problems;
$this->nav_class = 'problems';
$this->render('problem/index');
}
开发者ID:daerduoCarey,项目名称:oj,代码行数:23,代码来源:ProblemController.php
示例12: Problem
<?php
global $user;
if (isset($mo_request[1]) && is_numeric($mo_request[1])) {
$problem = new Problem($mo_request[1]);
$problem->load();
if (!$problem->getPID()) {
require_once $mo_theme_floder . '404.php';
}
if (isset($_POST['lang']) && isset($_POST['code']) && $user->getUID()) {
// 提交solution
if (!b_check_code()) {
echo '提交错误!请检查格式以及是否已经登录!';
} else {
$new_sid = mo_add_new_solution($mo_request[1], $_POST['lang'], $_POST['code']);
echo '提交成功!<a href="/?r=solution/' . $new_sid . '">点此</a>查看详情!';
}
}
echo '<h2>' . $problem->getInfo('title') . '</h2>';
echo '<em>标签:' . $problem->getInfo('tag') . '<br>';
echo '时间限制:' . $problem->getInfo('time_limit') . 'MS 内存限制:' . $problem->getInfo('memory_limit') . 'MB</em>';
echo '<h3>问题描述</h3>';
echo $problem->getInfo('description');
echo '<br>提交人数:' . $problem->getInfo('try') . ' AC人数:' . $problem->getInfo('solved') . '<br>';
echo '<h3>提交代码</h3>';
echo '<form name="form1" method="post" action="">
语言:
<p>
<label>
<input name="lang" type="radio" required id="lang-1" value="1" checked>
C/C++</label>
</p>
开发者ID:KarlZeo,项目名称:MoyOJ,代码行数:31,代码来源:problem.php
示例13: showForm
function showForm($ID, $options = array())
{
global $CFG_GLPI, $DB;
if (!static::canView()) {
return false;
}
// In percent
$colsize1 = '13';
$colsize2 = '37';
$default_use_notif = Entity::getUsedConfig('is_notif_enable_default', $_SESSION['glpiactive_entity'], '', 1);
// Set default options
if (!$ID) {
$values = array('_users_id_requester' => Session::getLoginUserID(), '_users_id_requester_notif' => array('use_notification' => $default_use_notif, 'alternative_email' => ''), '_groups_id_requester' => 0, '_users_id_assign' => 0, '_users_id_assign_notif' => array('use_notification' => $default_use_notif, 'alternative_email' => ''), '_groups_id_assign' => 0, '_users_id_observer' => 0, '_users_id_observer_notif' => array('use_notification' => $default_use_notif, 'alternative_email' => ''), '_suppliers_id_assign_notif' => array('use_notification' => $default_use_notif, 'alternative_email' => ''), '_groups_id_observer' => 0, '_suppliers_id_assign' => 0, 'priority' => 3, 'urgency' => 3, 'impact' => 3, 'content' => '', 'entities_id' => $_SESSION['glpiactive_entity'], 'name' => '', 'itilcategories_id' => 0);
foreach ($values as $key => $val) {
if (!isset($options[$key])) {
$options[$key] = $val;
}
}
if (isset($options['tickets_id'])) {
$ticket = new Ticket();
if ($ticket->getFromDB($options['tickets_id'])) {
$options['content'] = $ticket->getField('content');
$options['name'] = $ticket->getField('name');
$options['impact'] = $ticket->getField('impact');
$options['urgency'] = $ticket->getField('urgency');
$options['priority'] = $ticket->getField('priority');
$options['itilcategories_id'] = $ticket->getField('itilcategories_id');
$options['due_date'] = $ticket->getField('due_date');
}
}
if (isset($options['problems_id'])) {
$problem = new Problem();
if ($problem->getFromDB($options['problems_id'])) {
$options['content'] = $problem->getField('content');
$options['name'] = $problem->getField('name');
$options['impact'] = $problem->getField('impact');
$options['urgency'] = $problem->getField('urgency');
$options['priority'] = $problem->getField('priority');
$options['itilcategories_id'] = $problem->getField('itilcategories_id');
$options['due_date'] = $problem->getField('due_date');
}
}
}
if ($ID > 0) {
$this->check($ID, READ);
} else {
// Create item
$this->check(-1, CREATE, $options);
}
$showuserlink = 0;
if (User::canView()) {
$showuserlink = 1;
}
$this->showFormHeader($options);
echo "<tr class='tab_bg_1'>";
echo "<th class='left' width='{$colsize1}%'>" . __('Opening date') . "</th>";
echo "<td class='left' width='{$colsize2}%'>";
if (isset($options['tickets_id'])) {
echo "<input type='hidden' name='_tickets_id' value='" . $options['tickets_id'] . "'>";
}
if (isset($options['problems_id'])) {
echo "<input type='hidden' name='_problems_id' value='" . $options['problems_id'] . "'>";
}
$date = $this->fields["date"];
if (!$ID) {
$date = date("Y-m-d H:i:s");
}
Html::showDateTimeField("date", array('value' => $date, 'timestep' => 1, 'maybeempty' => false));
echo "</td>";
echo "<th width='{$colsize1}%'>" . __('Due date') . "</th>";
echo "<td width='{$colsize2}%' class='left'>";
if ($this->fields["due_date"] == 'NULL') {
$this->fields["due_date"] = '';
}
Html::showDateTimeField("due_date", array('value' => $this->fields["due_date"], 'timestep' => 1));
echo "</td></tr>";
if ($ID) {
echo "<tr class='tab_bg_1'><th>" . __('By') . "</th><td>";
User::dropdown(array('name' => 'users_id_recipient', 'value' => $this->fields["users_id_recipient"], 'entity' => $this->fields["entities_id"], 'right' => 'all'));
echo "</td>";
echo "<th>" . __('Last update') . "</th>";
echo "<td>" . Html::convDateTime($this->fields["date_mod"]) . "\n";
if ($this->fields['users_id_lastupdater'] > 0) {
printf(__('%1$s: %2$s'), __('By'), getUserName($this->fields["users_id_lastupdater"], $showuserlink));
}
echo "</td></tr>";
}
if ($ID && (in_array($this->fields["status"], $this->getSolvedStatusArray()) || in_array($this->fields["status"], $this->getClosedStatusArray()))) {
echo "<tr class='tab_bg_1'>";
echo "<th>" . __('Date of solving') . "</th>";
echo "<td>";
Html::showDateTimeField("solvedate", array('value' => $this->fields["solvedate"], 'timestep' => 1, 'maybeempty' => false));
echo "</td>";
if (in_array($this->fields["status"], $this->getClosedStatusArray())) {
echo "<th>" . __('Closing date') . "</th>";
echo "<td>";
Html::showDateTimeField("closedate", array('value' => $this->fields["closedate"], 'timestep' => 1, 'maybeempty' => false));
echo "</td>";
} else {
echo "<td colspan='2'> </td>";
//.........这里部分代码省略.........
开发者ID:jose-martins,项目名称:glpi,代码行数:101,代码来源:change.class.php
示例14: Problem
$prob = new Problem($cleaned["id"]);
$prob->remove();
break;
case "addToLog":
$prob = new Problem($cleaned["id"]);
$prob->addToLog($cleaned["msg"]);
break;
case "getLog":
$prob = new Problem($cleaned["id"]);
$log = $prob->getLog();
header("Content-type: application/json");
echo json_encode($log);
break;
case "getLocation":
header("Content-type: application/json");
$prob = new Problem($cleaned["id"]);
echo json_encode($prob->getLocation());
break;
}
pg_close($conn);
function prob_output($problems, $format, $outProj)
{
if ($format == "xml") {
header("Content-type: text/xml");
$xml = "";
$xml .= "<freemap><projection>{$outProj}</projection>";
foreach ($problems as $prob) {
$xml .= $prob->output("xml", $outProj);
}
$xml .= "</freemap>";
echo $xml;
开发者ID:Huertix,项目名称:Freemap,代码行数:31,代码来源:Problem.php
示例15: giveItem
//.........这里部分代码省略.........
return $out;
}
break;
case "glpi_documenttypes.icon":
if (!empty($data[$num][0]['name'])) {
return "<img class='middle' alt='' src='" . $CFG_GLPI["typedoc_icon_dir"] . "/" . $data[$num][0]['name'] . "'>";
}
return " ";
case "glpi_documents.filename":
$doc = new Document();
if ($doc->getFromDB($data['id'])) {
return $doc->getDownloadLink();
}
return NOT_AVAILABLE;
case "glpi_tickets_tickets.tickets_id_1":
$out = "";
$displayed = array();
for ($k = 0; $k < $data[$num]['count']; $k++) {
$linkid = $data[$num][$k]['tickets_id_2'] == $data['id'] ? $data[$num][$k]['name'] : $data[$num][$k]['tickets_id_2'];
if ($linkid > 0 && !isset($displayed[$linkid])) {
$text = "<a ";
$text .= "href=\"" . $CFG_GLPI["root_doc"] . "/front/ticket.form.php?id={$linkid}\">";
$text .= Dropdown::getDropdownName('glpi_tickets', $linkid) . "</a>";
if (count($displayed)) {
$out .= self::LBBR;
}
$displayed[$linkid] = $linkid;
$out .= $text;
}
}
return $out;
case "glpi_problems.id":
if ($searchopt[$ID]["datatype"] == 'count') {
if ($data[$num][0]['name'] > 0 && Session::haveRight("problem", Problem::READALL)) {
if ($itemtype == 'ITILCategory') {
$options['criteria'][0]['field'] = 7;
$options['criteria'][0]['searchtype'] = 'equals';
$options['criteria'][0]['value'] = $data['id'];
$options['criteria'][0]['link'] = 'AND';
} else {
$options['criteria'][0]['field'] = 12;
$options['criteria'][0]['searchtype'] = 'equals';
$options['criteria'][0]['value'] = 'all';
$options['criteria'][0]['link'] = 'AND';
$options['metacriteria'][0]['itemtype'] = $itemtype;
$options['metacriteria'][0]['field'] = self::getOptionNumber($itemtype, 'name');
$options['metacriteria'][0]['searchtype'] = 'equals';
$options['metacriteria'][0]['value'] = $data['id'];
$options['metacriteria'][0]['link'] = 'AND';
}
$options['reset'] = 'reset';
$out = "<a id='problem{$itemtype}" . $data['id'] . "' ";
$out .= "href=\"" . $CFG_GLPI["root_doc"] . "/front/problem.php?" . Toolbox::append_params($options, '&') . "\">";
$out .= $data[$num][0]['name'] . "</a>";
return $out;
}
}
break;
case "glpi_tickets.id":
if ($searchopt[$ID]["datatype"] == 'count') {
if ($data[$num][0]['name'] > 0 && Session::haveRight("ticket", Ticket::READALL)) {
if ($itemtype == 'User') {
// Requester
if ($ID == 60) {
$options['criteria'][0]['field'] = 4;
$options['criteria'][0]['searchtype'] = 'equals';
开发者ID:jose-martins,项目名称:glpi,代码行数:67,代码来源:search.class.php
示例16: showForm
function showForm($ID, $options = array())
{
global $CFG_GLPI, $DB;
if (!static::canView()) {
return false;
}
// Set default options
if (!$ID) {
$values = array('_users_id_requester' => Session::getLoginUserID(), '_users_id_requester_notif' => array('use_notification' => 1), '_groups_id_requester' => 0, '_users_id_assign' => 0, '_users_id_assign_notif' => array('use_notification' => 1), '_groups_id_assign' => 0, '_users_id_observer' => 0, '_users_id_observer_notif' => array('use_notification' => 1), '_groups_id_observer' => 0, '_suppliers_id_assign' => 0, 'priority' => 3, 'urgency' => 3, 'impact' => 3, 'content' => '', 'entities_id' => $_SESSION['glpiactive_entity'], 'name' => '', 'itilcategories_id' => 0);
foreach ($values as $key => $val) {
if (!isset($options[$key])) {
$options[$key] = $val;
}
}
if (isset($options['tickets_id'])) {
$ticket = new Ticket();
if ($ticket->getFromDB($options['tickets_id'])) {
$options['content'] = $ticket->getField('content');
$options['name'] = $ticket->getField('name');
$options['impact'] = $ticket->getField('impact');
$options['urgency'] = $ticket->getField('urgency');
$options['priority'] = $ticket->getField('priority');
$options['itilcategories_id'] = $ticket->getField('itilcategories_id');
}
}
if (isset($options['problems_id'])) {
$problem = new Problem();
if ($problem->getFromDB($options['problems_id'])) {
$options['content'] = $problem->getField('content');
$options['name'] = $problem->getField('name');
$options['impact'] = $problem->getField('impact');
$options['urgency'] = $problem->getField('urgency');
$options['priority'] = $problem->getField('priority');
$options['itilcategories_id'] = $problem->getField('itilcategories_id');
}
}
}
if ($ID > 0) {
$this->check($ID, 'r');
} else {
// Create item
$this->check(-1, 'w', $options);
}
$showuserlink = 0;
if (Session::haveRight('user', 'r')) {
$showuserlink = 1;
}
$this->showTabs($options);
$this->showFormHeader($options);
echo "<tr>";
echo "<th class='left' colspan='2'>";
if (isset($options['tickets_id'])) {
echo "<input type='hidden' name='_tickets_id' value='" . $options['tickets_id'] . "'>";
}
if (isset($options['problems_id'])) {
echo "<input type='hidden' name='_problems_id' value='" . $options['problems_id'] . "'>";
}
echo "<table>";
echo "<tr>";
echo "<td><span class='tracking_small'>" . __('Opening date') . "</span></td>";
echo "<td>";
$date = $this->fields["date"];
if (!$ID) {
$date = date("Y-m-d H:i:s");
}
Html::showDateTimeFormItem("date", $date, 1, false);
echo "</td></tr>";
if ($ID) {
echo "<tr><td><span class='tracking_small'>" . __('By') . "</span></td><td>";
User::dropdown(array('name' => 'users_id_recipient', 'value' => $this->fields["users_id_recipient"], 'entity' => $this->fields["entities_id"], 'right' => 'all'));
echo "</td></tr>";
}
echo "</table>";
echo "</th>";
echo "<th class='left' colspan='2'>";
echo "<table>";
if ($ID) {
echo "<tr><td><span class='tracking_small'>" . __('Last update') . "</span></td>";
echo "<td><span class='tracking_small'>" . Html::convDateTime($this->fields["date_mod"]) . "\n";
if ($this->fields['users_id_lastupdater'] > 0) {
//TRANS: %s is the user name
printf(__('By %s'), getUserName($this->fields["users_id_lastupdater"], $showuserlink));
}
echo "</span>";
echo "</td></tr>";
}
// SLA
echo "<tr>";
echo "<td><span class='tracking_small'>" . __('Due date') . "</span></td>";
echo "<td>";
if ($this->fields["due_date"] == 'NULL') {
$this->fields["due_date"] = '';
}
Html::showDateTimeFormItem("due_date", $this->fields["due_date"], 1, true);
echo "</td></tr>";
if ($ID) {
switch ($this->fields["status"]) {
case self::CLOSED:
echo "<tr>";
echo "<td><span class='tracking_small'>" . __('Close date') . "</span></td>";
//.........这里部分代码省略.........
开发者ID:geldarr,项目名称:hack-space,代码行数:101,代码来源:change.class.php
示例17: getSearchOptions
//.........这里部分代码省略.........
$tab[27]['joinparams'] = array('jointype' => 'child', 'condition' => $followup_condition);
$tab[29]['table'] = 'glpi_requesttypes';
$tab[29]['field'] = 'name';
$tab[29]['name'] = __('Request source');
$tab[29]['datatype'] = 'dropdown';
$tab[29]['forcegroupby'] = true;
$tab[29]['massiveaction'] = false;
$tab[29]['joinparams'] = array('beforejoin' => array('table' => 'glpi_ticketfollowups', 'joinparams' => array('jointype' => 'child', 'condition' => $followup_condition)));
$tab[91]['table'] = 'glpi_ticketfollowups';
$tab[91]['field'] = 'is_private';
$tab[91]['name'] = __('Private followup');
$tab[91]['datatype'] = 'bool';
$tab[91]['forcegroupby'] = true;
$tab[91]['splititems'] = true;
$tab[91]['massiveaction'] = false;
$tab[91]['joinparams'] = array('jointype' => 'child', 'condition' => $followup_condition);
$tab[93]['table'] = 'glpi_users';
$tab[93]['field'] = 'name';
$tab[93]['name'] = __('Writer');
$tab[93]['datatype'] = 'itemlink';
$tab[93]['right'] = 'all';
$tab[93]['forcegroupby'] = true;
$tab[93]['massiveaction'] = false;
$tab[93]['joinparams'] = array('beforejoin' => array('table' => 'glpi_ticketfollowups', 'joinparams' => array('jointype' => 'child', 'condition' => $followup_condition)));
$tab += $this->getSearchOptionsStats();
$tab[150]['table'] = $this->getTable();
$tab[150]['field'] = 'takeintoaccount_delay_stat';
$tab[150]['name'] = __('Take into account time');
$tab[150]['datatype'] = 'timestamp';
$tab[150]['forcegroupby'] = true;
$tab[150]['massiveaction'] = false;
if (Session::haveRightsOr(self::$rightname, array(self::READALL, self::READASSIGN, self::OWN))) {
$tab['linktickets'] = _n('Linked ticket', 'Linked tickets', Session::getPluralNumber());
$tab[40]['table'] = 'glpi_tickets_tickets';
$tab[40]['field'] = 'tickets_id_1';
$tab[40]['name'] = __('All linked tickets');
$tab[40]['massiveaction'] = false;
$tab[40]['forcegroupby'] = true;
$tab[40]['searchtype'] = 'equals';
$tab[40]['joinparams'] = array('jointype' => 'item_item');
$tab[40]['additionalfields'] = array('tickets_id_2');
$tab[47]['table'] = 'glpi_tickets_tickets';
$tab[47]['field'] = 'tickets_id_1';
$tab[47]['name'] = __('Duplicated tickets');
$tab[47]['massiveaction'] = false;
$tab[47]['searchtype'] = 'equals';
$tab[47]['joinparams'] = array('jointype' => 'item_item', 'condition' => "AND NEWTABLE.`link` = " . Ticket_Ticket::DUPLICATE_WITH);
$tab[47]['additionalfields'] = array('tickets_id_2');
$tab[47]['forcegroupby'] = true;
$tab[41]['table'] = 'glpi_tickets_tickets';
$tab[41]['field'] = 'id';
$tab[41]['name'] = __('Number of all linked tickets');
$tab[41]['massiveaction'] = false;
$tab[41]['datatype'] = 'count';
$tab[41]['usehaving'] = true;
$tab[41]['joinparams'] = array('jointype' => 'item_item');
$tab[46]['table'] = 'glpi_tickets_tickets';
$tab[46]['field'] = 'id';
$tab[46]['name'] = __('Number of duplicated tickets');
$tab[46]['massiveaction'] = false;
$tab[46]['datatype'] = 'count';
$tab[46]['usehaving'] = true;
$tab[46]['joinparams'] = array('jointype' => 'item_item', 'condition' => "AND NEWTABLE.`link` = " . Ticket_Ticket::DUPLICATE_WITH);
$tab += TicketTask::getSearchOptionsToAdd();
$tab += $this->getSearchOptionsSolution();
if (Session::haveRight('ticketcost', READ)) {
$tab += TicketCost::getSearchOptionsToAdd();
}
$tab['problem'] = Problem::getTypeName(Session::getPluralNumber());
$tab[141]['table'] = 'glpi_problems_tickets';
$tab[141]['field'] = 'id';
$tab[141]['name'] = _x('quantity', 'Number of problems');
$tab[141]['forcegroupby'] = true;
$tab[141]['usehaving'] = true;
$tab[141]['datatype'] = 'count';
$tab[141]['massiveaction'] = false;
$tab[141]['joinparams'] = array('jointype' => 'child');
}
// Filter search fields for helpdesk
if (!Session::isCron() && (!isset($_SESSION['glpiactiveprofile']['interface']) || $_SESSION['glpiactiveprofile']['interface'] == 'helpdesk')) {
$tokeep = array('common', 'requester', 'satisfaction');
if (Session::haveRightsOr('ticketvalidation', array_merge(TicketValidation::getValidateRights(), TicketValidation::getCreateRights()))) {
$tokeep[] = 'validation';
}
$keep = false;
foreach ($tab as $key => $val) {
if (!is_array($val)) {
$keep = in_array($key, $tokeep);
}
if (!$keep) {
if (is_array($val)) {
$tab[$key]['nosearch'] = true;
}
}
}
// last updater no search
$tab[64]['nosearch'] = true;
}
return $tab;
}
开发者ID:glpi-project,项目名称:glpi,代码行数:101,代码来源:ticket.class.php
示例18: Problem_User
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 GLPI. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
/** @file
* @brief
* @since version 0.83
*/
if (!defined('GLPI_ROOT')) {
include '../inc/includes.php';
}
$link = new Problem_User();
$item = new Problem();
Session::checkLoginUser();
Html::popHeader(__('Email followup'), $_SERVER['PHP_SELF']);
if (isset($_POST["update"])) {
$link->check($_POST["id"], UPDATE);
$link->update($_POST);
} else {
if (isset($_POST['delete'])) {
$link->check($_POST['id'], DELETE);
$link->delete($_POST);
Event::log($link->fields['problems_id'], "problem", 4, "maintain", sprintf(__('%s deletes an actor'), $_SESSION["glpiname"]));
if ($item->can($link->fields["problems_id"], READ)) {
Html::redirect($CFG_GLPI["root_doc"] . "/front/problem.form.php?id=" . $link->fields['problems_id']);
}
Session::addMessageAfterRedirect(__('You have been redirected because you no longer have access to this item'), true, ERROR);
Html::redirect($CFG_GLPI["root_doc"] . "/front/problem.php");
开发者ID:glpi-project,项目名称:glpi,代码行数:31,代码来源:problem_user.form.php
示例19: Problem
<?php
try {
include "problemdata.php";
$database = new Problem();
$result = $database->checkAnswer($_POST["problem_no"] * 1, $_POST["answer"]);
$checkpast = $database->checkRepeatSolve($_POST["user_id"], $_POST["problem_no"] * 1);
$ret = "problem.php?case=" . $_POST["case"] * 1;
if ($result == 'good') {
if ($_POST["user_id"] != 'null' && $checkpast == 0) {
$database->insertAnswer($_POST["user_id"], $_POST["problem_no"] * 1, $_POST["answer"], 1);
} else {
}
?>
<script> alert("정답");location.replace("<?php
echo $ret;
?>
")</script><?php
} else {
if ($_POST["user_id"] != 'null' && $checkpast == 0) {
$database->insertAnswer($_POST["user_id"], $_POST["problem_no"] * 1, $_POST["answer"], 0);
} else {
}
?>
<script> alert("틀렸어");location.replace("<?php
echo $ret;
?>
")</script><?php
}
} catch (Exception $e) {
header("Loaction:error.php");
开发者ID:KeoSeong,项目名称:project,代码行数:31,代码来源:check_answer.php
示例20: die
require_once "api.php";
if (!$app->user->isLogin()) {
die('<center><a href=\'admin/status.php?action=login&url=../index.php\'>Please login or register first!</a></center>');
}
require_once "classes/Problem.php";
$start = $app->setting->get("startTime", time() + 10);
if ($start > time()) {
die('<center><h1><a href="index.php" style="color: #000000;">Contest not start !</a></h1></center></body></html>');
}
$end = $app->setting->get("endTime", time() + 10);
if ($end < time()) {
die('<center><h1><a href="index.php" style="color: #000000;">Contest have finished !</a></h1></center></body></html>');
}
$db = new MySQL();
$info = $db->from("Problem")->where("`id` = '" . $_GET['id'] . "'")->select()->fetch_one();
$pro = new Problem($info['pid'], $info['oj'])
|
请发表评论