/** * update event service * * @param array $params * @return array */ public function updateEventService($params) { include_once './' . CHURCHSERVICE . '/churchservice_ajax.php'; return churchservice_updateEventService($params); }
/** * get pending service requests of current user * TODO: rename to getPendingRequests or getPendingRequestsOfUser * * @return string */ function churchservice_getUserOpenServices() { global $user; if ($id = getVar("eventservice_id")) { include_once './' . CHURCHSERVICE . '/churchservice_ajax.php'; $reason = getVar("reason", null); if (getVar("zugesagt_yn") == 1) { churchservice_updateEventService($id, $user->vorname . " " . $user->name, $user->id, 1, $reason); } else { churchservice_updateEventService($id, null, null, 0, $reason); } addInfoMessage(t('"thank.you.for.feedback"')); } include_once './' . CHURCHDB . '/churchdb_db.php'; $txt = $txt1 = $txt2 = ""; // $pid = $user->id; //not used $res = db_query("\n SELECT cal.bezeichnung AS event, e.id AS event_id, es.id AS eventservice_id, allowtonotebyconfirmation_yn,\n DATE_FORMAT(e.startdate, '%d.%m.%Y %H:%i') AS datum, s.bezeichnung AS service, s.id AS service_id,\n sg.bezeichnung AS servicegroup, concat(p.vorname, ' ', p.name) AS modifieduser, p.id AS modified_pid\n FROM {cs_eventservice} es, {cs_event} e, {cs_servicegroup} sg, {cs_service} s, {cdb_person} p, {cc_cal} cal\n WHERE e.valid_yn=1 AND cal.id=e.cc_cal_id AND cdb_person_id=:user_id AND e.startdate>=CURRENT_DATE()\n AND es.modified_pid=p.id AND zugesagt_yn=0 AND es.valid_yn=1 AND es.event_id=e.id\n AND es.service_id=s.id AND sg.id=s.servicegroup_id\n ORDER BY datum", array(':user_id' => $user->id)); $nr = 0; //TODO: not needed? foreach ($res as $arr) { $nr++; $txt2 .= "<div class='service-request' style='display:none;' data-id='{$arr->eventservice_id}'\n data-modified-user='******'"; if ($arr->allowtonotebyconfirmation_yn == 1) { $txt2 .= " data-comment-confirm='{$arr->allowtonotebyconfirmation_yn}'"; } if (user_access('view', 'churchdb')) { $txt2 .= " data-modified-pid='{$arr->modified_pid}'"; } $txt2 .= ">"; $txt2 .= "<a href='?q=churchservice&id={$arr->event_id}'>{$arr->datum} - {$arr->event}</a>:\n <a href='?q=churchservice&id={$arr->event_id}'><b>{$arr->service}</b></a> ({$arr->servicegroup})" . NL; $files = churchcore_getFilesAsDomainIdArr("service", $arr->event_id); $txt .= '<span class="pull-right">'; if (isset($files) && isset($files[$arr->event_id])) { $i = 0; foreach ($files[$arr->event_id] as $file) { $i++; if ($i <= 3) { $txt .= churchcore_renderFile($file) . " "; } else { $txt .= "..."; } } } $txt .= "</span>"; // TODO: add some sort of visual style to yes/no - checkmark/cross, green/red color, ... $txt2 .= ' <div style="margin-left:16px;margin-bottom:10px;" class="service-request-answer"></div> </div>'; } if ($txt2) { $txt .= $txt1 . $txt2 . ' <p align="right"><a href="#" style="display:none" class="service-request-show-all">' . t("show.all") . '</a>'; } return $txt; }
public function updateEventService($params) { return churchservice_updateEventService($params); }
function churchservice_getUserOpenServices() { global $user; if ($id = readVar("eventservice_id")) { include_once './' . CHURCHSERVICE . '/churchservice_ajax.php'; $reason = readVar("reason", null); if (readVar("zugesagt_yn") == 1) { churchservice_updateEventService($id, $user->vorname . " " . $user->name, $user->id, 1, $reason); } else { churchservice_updateEventService($id, null, null, 0, $reason); } addInfoMessage("Danke für deine Rückmeldung!"); } include_once './' . CHURCHDB . '/churchdb_db.php'; $txt = ""; $pid = $user->id; $txt1 = ""; $res = db_query("SELECT cal.bezeichnung event, e.id event_id, es.id eventservice_id, allowtonotebyconfirmation_yn,\n DATE_FORMAT(e.startdate, '%d.%m.%Y %H:%i') datum, s.bezeichnung service, \n s.id service_id, sg.bezeichnung servicegroup, concat(p.vorname, ' ', p.name) as modifieduser, p.id modified_pid\n FROM {cs_eventservice} es, {cs_event} e, {cs_servicegroup} sg, {cs_service} s, {cdb_person} p, {cc_cal} cal \n where e.valid_yn=1 and cal.id=e.cc_cal_id and cdb_person_id={$user->id} and e.startdate>=current_date() and es.modified_pid=p.id and \n zugesagt_yn=0 and es.valid_yn=1 and es.event_id=e.id and es.service_id=s.id \n and sg.id=s.servicegroup_id order by datum "); $nr = 0; $txt2 = ""; foreach ($res as $arr) { $nr = $nr + 1; $txt2 = $txt2 . '<div class="service-request" style="display:none;" ' . 'data-id="' . $arr->eventservice_id . '" data-modified-user="******" '; if ($arr->allowtonotebyconfirmation_yn == 1) { $txt2 .= 'data-comment-confirm="' . $arr->allowtonotebyconfirmation_yn . '" '; } if (user_access("view", "churchdb")) { $txt2 .= 'data-modified-pid="' . $arr->modified_pid . '" '; } $txt2 .= ">"; $txt2 .= '<a href="?q=churchservice&id=' . $arr->event_id . '">'; $txt2 .= $arr->datum . " - " . $arr->event . "</a>: "; $txt2 .= '<a href="?q=churchservice&id=' . $arr->event_id . '"><b>' . $arr->service . "</b></a> (" . $arr->servicegroup . ")"; $files = churchcore_getFilesAsDomainIdArr("service", $arr->event_id); $txt .= '<span class="pull-right">'; if (isset($files) && isset($files[$arr->event_id])) { $i = 0; foreach ($files[$arr->event_id] as $file) { $i++; if ($i <= 3) { $txt .= churchcore_renderFile($file) . " "; } else { $txt .= "..."; } } } $txt .= "</span>"; $txt2 .= '<div style="margin-left:16px;margin-bottom:10px;" class="service-request-answer"></div>'; $txt2 .= '</div>'; } if ($txt2 != "") { $txt = $txt . $txt1 . $txt2 . '<p align="right"><a href="#" style="display:none" class="service-request-show-all">' . t("show.all") . '</a>'; } return $txt; }