This commit is contained in:
Paminger
2016-06-28 22:11:12 +02:00
4 changed files with 98 additions and 17 deletions
@@ -119,6 +119,28 @@ class Message extends APIv1_Controller
}
}
/**
* @return void
*/
public function postChangeStatus()
{
$person_id = $this->post()['person_id'];
$message_id = $this->post()['message_id'];
$status = $this->post()['status'];
if (isset($person_id) && isset($message_id) && isset($status) &&
in_array($status, array(MSG_STATUS_UNREAD, MSG_STATUS_READ, MSG_STATUS_ARCHIVED, MSG_STATUS_DELETED)))
{
$result = $this->messagelib->updateMessageStatus($message_id, $person_id, $status);
$this->response($result, REST_Controller::HTTP_OK);
}
else
{
$this->response();
}
}
private function _validatePostMessage($message = null)
{
if (!isset($message))
@@ -22,7 +22,7 @@ class Phrase extends APIv1_Controller
public function __construct()
{
parent::__construct();
$this->load->library('PhrasesLib', array('uid' => $this->_getUID()));
$this->load->library('PhrasesLib');
}
/**
+12 -13
View File
@@ -118,31 +118,30 @@ class MessageLib
* @param integer $status_id REQUIRED - should come from config/message.php list of constants
* @return array
*/
function updateMessageStatus($msg_id, $user_id, $status_id )
function updateMessageStatus($message_id, $person_id, $status)
{
if (empty($msg_id))
if (empty($message_id))
{
return $this->_invalid_id(MSG_ERR_INVALID_MSG_ID);
}
if (empty($user_id))
if (empty($person_id))
{
return $this->_invalid_id(MSG_ERR_INVALID_USER_ID);
}
if (empty($status_id))
// Not use empty otherwise if status is 0 it returns an error
if (!isset($status))
{
return $this->_invalid_id(MSG_ERR_INVALID_STATUS_ID);
}
if ($this->ci->message_model->update_message_status($msg_id, $user_id, $status_id))
{
return $this->_success(NULL, MSG_STATUS_UPDATE);
}
// General Error Occurred
return $this->_general_error();
$result = $this->ci->MsgStatusModel->update(
array('message_id' => $message_id, 'person_id' => $person_id),
array('status' => $status)
);
return $result;
}
// ------------------------------------------------------------------------
@@ -343,4 +342,4 @@ class MessageLib
'msg' => lang('message_'.$error)
);
}
}
}
@@ -31,9 +31,69 @@ class Studiengang_model extends DB_Model
studiengangbezeichnung_englisch,
lgartcode,
tbl_lgartcode.bezeichnung
FROM lehre.vw_studienplan LEFT JOIN bis.tbl_lgartcode USING (lgartcode)
WHERE onlinebewerbung IS TRUE
AND aktiv IS TRUE
FROM (SELECT tbl_organisationseinheit.organisationseinheittyp_kurzbz,
tbl_studiengang.oe_kurzbz,
tbl_studienordnung.studiengang_kz,
tbl_studienplan.studienordnung_id,
tbl_studienplan.studienplan_id,
tbl_studienplan.orgform_kurzbz,
tbl_studienplan.version,
tbl_studienplan.bezeichnung,
tbl_studienplan.regelstudiendauer,
tbl_studienplan.sprache,
tbl_studienplan.aktiv,
tbl_studienplan.semesterwochen,
tbl_studienplan.testtool_sprachwahl,
tbl_studienplan.insertamum,
tbl_studienplan.insertvon,
tbl_studienplan.updateamum,
tbl_studienplan.updatevon,
tbl_studienordnung.gueltigvon,
tbl_studienordnung.gueltigbis,
tbl_studienordnung.ects,
tbl_studienordnung.studiengangbezeichnung,
tbl_studienordnung.studiengangbezeichnung_englisch,
tbl_studienordnung.studiengangkurzbzlang,
tbl_studienordnung.akadgrad_id,
tbl_studiengang.kurzbz,
tbl_studiengang.kurzbzlang,
tbl_studiengang.typ,
tbl_studiengang.english,
tbl_studiengang.farbe,
tbl_studiengang.email,
tbl_studiengang.telefon,
tbl_studiengang.max_semester,
tbl_studiengang.max_verband,
tbl_studiengang.max_gruppe,
tbl_studiengang.erhalter_kz,
tbl_studiengang.bescheid,
tbl_studiengang.bescheidbgbl1,
tbl_studiengang.bescheidbgbl2,
tbl_studiengang.bescheidgz,
tbl_studiengang.bescheidvom,
tbl_studiengang.titelbescheidvom,
tbl_studiengang.zusatzinfo_html,
tbl_studiengang.moodle,
tbl_studiengang.studienplaetze,
tbl_studiengang.lgartcode,
tbl_studiengang.mischform,
tbl_studiengang.projektarbeit_note_anzeige,
tbl_studiengang.onlinebewerbung,
tbl_organisationseinheit.oe_parent_kurzbz,
tbl_organisationseinheit.mailverteiler,
tbl_organisationseinheit.freigabegrenze,
tbl_organisationseinheit.kurzzeichen,
tbl_organisationseinheit.lehre,
tbl_organisationseinheittyp.beschreibung,
tbl_organisationseinheit.standort
FROM (((((lehre.tbl_studienplan JOIN lehre.tbl_studienordnung USING (studienordnung_id))
JOIN public.tbl_studiengang USING (studiengang_kz))
JOIN public.tbl_organisationseinheit USING (oe_kurzbz))
JOIN public.tbl_organisationseinheittyp USING (organisationseinheittyp_kurzbz))
LEFT JOIN lehre.tbl_studienplan_semester USING (studienplan_id))
) t1 LEFT JOIN bis.tbl_lgartcode USING (lgartcode)
WHERE t1.onlinebewerbung IS TRUE
AND t1.aktiv IS TRUE
ORDER BY typ, studiengangbezeichnung, tbl_lgartcode.bezeichnung ASC";
$result = $this->db->query($allForBewerbungQuery);