예제 #1
0
    $res = Reminder_Condition::update();
    Misc::mapMessages($res, array(1 => array(ev_gettext('Thank you, the condition was updated successfully.'), Misc::MSG_INFO), -1 => array(ev_gettext('An error occurred while trying to update the condition.'), Misc::MSG_ERROR), -2 => array(ev_gettext('Please enter the title for this condition.'), Misc::MSG_ERROR)));
} elseif (@$_POST['cat'] == 'delete') {
    Reminder_Condition::remove();
}
if (@$_GET['cat'] == 'edit') {
    $info = Reminder_Condition::getDetails($_GET['id']);
    if (!empty($_GET['field'])) {
        $info['rlc_rmf_id'] = $_GET['field'];
    } else {
        $_GET['field'] = $info['rlc_rmf_id'];
    }
    $tpl->assign('info', $info);
}
if (!empty($_GET['field'])) {
    $field_title = Reminder_Condition::getFieldTitle($_GET['field']);
    if (Reminder_Condition::canFieldBeCompared($_GET['field'])) {
        $tpl->assign(array('show_field_options' => 'yes', 'comparable_fields' => Reminder_Condition::getFieldAdminList(true)));
    } elseif (strtolower($field_title) == 'status') {
        $prj_id = Reminder::getProjectID($rem_id);
        $tpl->assign(array('show_status_options' => 'yes', 'statuses' => Status::getAssocStatusList($prj_id)));
    } elseif (strtolower($field_title) == 'category') {
        $prj_id = Reminder::getProjectID($rem_id);
        $tpl->assign(array('show_category_options' => 'yes', 'categories' => Category::getAssocList($prj_id)));
    } elseif (strtolower($field_title) == 'group' || strtolower($field_title) == 'active group') {
        $prj_id = Reminder::getProjectID($rem_id);
        $tpl->assign(array('show_group_options' => 'yes', 'groups' => Group::getAssocList($prj_id)));
    } else {
        $tpl->assign('show_status_options', 'no');
    }
    if (@$_GET['cat'] != 'edit') {
 } elseif (@$HTTP_POST_VARS["cat"] == "update") {
     $tpl->assign("result", Reminder_Condition::update());
 } elseif (@$HTTP_POST_VARS["cat"] == "delete") {
     Reminder_Condition::remove();
 }
 if (@$HTTP_GET_VARS["cat"] == "edit") {
     $info = Reminder_Condition::getDetails($HTTP_GET_VARS["id"]);
     if (!empty($HTTP_GET_VARS['field'])) {
         $info['rlc_rmf_id'] = $HTTP_GET_VARS['field'];
     } else {
         $HTTP_GET_VARS['field'] = $info['rlc_rmf_id'];
     }
     $tpl->assign("info", $info);
 }
 if (!empty($HTTP_GET_VARS['field'])) {
     $field_title = Reminder_Condition::getFieldTitle($HTTP_GET_VARS['field']);
     if (Reminder_Condition::canFieldBeCompared($HTTP_GET_VARS['field'])) {
         $tpl->assign(array('show_field_options' => 'yes', 'comparable_fields' => Reminder_Condition::getFieldAdminList(true)));
     } elseif (strtolower($field_title) == 'status') {
         $prj_id = Reminder::getProjectID($rem_id);
         $tpl->assign(array('show_status_options' => 'yes', 'statuses' => Status::getAssocStatusList($prj_id)));
     } elseif (strtolower($field_title) == 'category') {
         $prj_id = Reminder::getProjectID($rem_id);
         $tpl->assign(array('show_category_options' => 'yes', 'categories' => Category::getAssocList($prj_id)));
     } else {
         $tpl->assign('show_status_options', 'no');
     }
     if (@$HTTP_GET_VARS["cat"] != "edit") {
         $tpl->assign('info', array('rlc_rmf_id' => $HTTP_GET_VARS['field'], 'rlc_rmo_id' => '', 'rlc_value' => ''));
     }
 }
 /**
  * Method used to get the list of reminder conditions to be displayed in the
  * administration section.
  *
  * @access  public
  * @param   integer $rma_id The reminder action ID
  * @return  array The list of reminder conditions
  */
 function getAdminList($rma_id)
 {
     $stmt = "SELECT\n                    rlc_id,\n                    rlc_value,\n                    rlc_comparison_rmf_id,\n                    rmf_title,\n                    rmo_title\n                 FROM\n                    " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "reminder_level_condition,\n                    " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "reminder_field,\n                    " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "reminder_operator\n                 WHERE\n                    rlc_rmf_id=rmf_id AND\n                    rlc_rmo_id=rmo_id AND\n                    rlc_rma_id=" . Misc::escapeInteger($rma_id) . "\n                 ORDER BY\n                    rlc_id ASC";
     $res = $GLOBALS["db_api"]->dbh->getAll($stmt, DB_FETCHMODE_ASSOC);
     if (PEAR::isError($res)) {
         Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__);
         return array();
     } else {
         for ($i = 0; $i < count($res); $i++) {
             if (!empty($res[$i]['rlc_comparison_rmf_id'])) {
                 $res[$i]['rlc_value'] = 'Field: ' . Reminder_Condition::getFieldTitle($res[$i]['rlc_comparison_rmf_id']);
             } elseif (strtolower($res[$i]['rmf_title']) == 'status') {
                 $res[$i]['rlc_value'] = Status::getStatusTitle($res[$i]['rlc_value']);
             } elseif (strtolower($res[$i]['rmf_title']) == 'category') {
                 $res[$i]['rlc_value'] = Category::getTitle($res[$i]['rlc_value']);
             } elseif (strtoupper($res[$i]['rlc_value']) != 'NULL') {
                 $res[$i]['rlc_value'] .= ' hours';
             }
         }
         return $res;
     }
 }