function load($id) { $res = parent::load($id); $sql = '( SELECT rvrm.order_num as order_num, rr.id as role_id, rr.title as role_title, NULL as service_field, rr.congregationid as congregationid, rrc.name as congregation_name, rr.volunteer_group as volunteer_group FROM roster_view_role_membership rvrm JOIN ( roster_role rr LEFT JOIN congregation rrc ON rr.congregationid = rrc.id ) ON rvrm.roster_role_id = rr.id WHERE rvrm.roster_view_id = ' . (int) $this->id . ' ) UNION ( SELECT rvdi.order_num as order_num, NULL as role_id, NULL as role_title, rvdi.service_field as service_field, rvdi.congregationid as congregationid, dic.name as congregation_name, NULL as volunteer_group FROM roster_view_service_field rvdi JOIN congregation dic ON rvdi.congregationid = dic.id WHERE rvdi.roster_view_id = ' . (int) $this->id . ' ) ORDER BY order_num'; $this->_members = $GLOBALS['db']->queryAll($sql, null, null, true); check_db_result($this->_members); }
function load($id) { $res = parent::load($id); if (!$this->getValue('is_public') && !$GLOBALS['user_system']->getCurrentUser('id')) { trigger_error("Roster view #{$this->id} is only available to logged in users", E_USER_ERROR); // exits; } $sql = '( SELECT rvrm.order_num as order_num, rr.id as role_id, rr.title as role_title, NULL as service_field, rr.congregationid as congregationid, rrc.name as congregation_name, rr.volunteer_group as volunteer_group FROM roster_view_role_membership rvrm JOIN ( roster_role rr LEFT JOIN congregation rrc ON rr.congregationid = rrc.id ) ON rvrm.roster_role_id = rr.id WHERE rvrm.roster_view_id = ' . (int) $this->id . ' ) UNION ( SELECT rvdi.order_num as order_num, NULL as role_id, NULL as role_title, rvdi.service_field as service_field, rvdi.congregationid as congregationid, dic.name as congregation_name, NULL as volunteer_group FROM roster_view_service_field rvdi JOIN congregation dic ON rvdi.congregationid = dic.id WHERE rvdi.roster_view_id = ' . (int) $this->id . ' ) ORDER BY order_num'; $this->_members = $GLOBALS['db']->queryAll($sql, null, null, true); check_db_result($this->_members); }
function load($id) { $res = parent::load($id); if (!$this->getValue('is_public') && !$GLOBALS['user_system']->getCurrentUser('id')) { // We don't use trigger_error here because sysadmins don't really care. header($_SERVER["SERVER_PROTOCOL"] . " 401 Not Authorised"); print_message("Roster view #{$this->id} is only available to logged in users", 'error'); exit; } $sql = '( SELECT rvrm.order_num as order_num, rr.id as role_id, rr.title as role_title, NULL as service_field, rr.congregationid as congregationid, rrc.name as congregation_name, rr.volunteer_group as volunteer_group FROM roster_view_role_membership rvrm JOIN ( roster_role rr LEFT JOIN congregation rrc ON rr.congregationid = rrc.id ) ON rvrm.roster_role_id = rr.id WHERE rvrm.roster_view_id = ' . (int) $this->id . ' ) UNION ( SELECT rvdi.order_num as order_num, NULL as role_id, NULL as role_title, rvdi.service_field as service_field, rvdi.congregationid as congregationid, dic.name as congregation_name, NULL as volunteer_group FROM roster_view_service_field rvdi JOIN congregation dic ON rvdi.congregationid = dic.id WHERE rvdi.roster_view_id = ' . (int) $this->id . ' ) ORDER BY order_num'; $this->_members = $GLOBALS['db']->queryAll($sql, null, null, true); check_db_result($this->_members); }
function load($id) { $res = parent::load($id); $this->__loadBibleReadings(); return $res; }
public function load($id) { $res = parent::load($id); if ($this->id) { $SQL = 'SELECT congregationid FROM congregation_service_component WHERE componentid = ' . (int) $this->id; $this->values['congregationids'] = $GLOBALS['db']->queryCol($SQL); $SQL = 'SELECT t.id FROM service_component_tagging tt JOIN service_component_tag t ON tt.tagid = t.id WHERE componentid = ' . (int) $this->id . ' ORDER BY tag'; $this->values['tags'] = $GLOBALS['db']->queryCol($SQL); } return $res; }