/** * Assigns $this->access_level according to whether the user is logged * in or not. */ private function check_login() { $this->access_level = pdUser::check_login($this->db); }
/** * Returns the HTML text to display the icons to link to the PDF, view, * edit, or delete the publication entry. * * @param object $pub pdPublication object to display the icons for. * @param integer $flags the icons to display. 0x1 for the PDF/PS file, * 0x2 for the view icon, 0x4 for the edit icon, 0x8 for the delete icon. * @param string $url_prefix the prefix to use for URLs. * @return HTML text. */ function getPubIcons(&$db, &$pub, $flags = 0xf, $url_prefix = NULL) { $html = ''; $access_level = pdUser::check_login($db); if (!isset($url_prefix)) { // get url_prefix from script's name $url_prefix = ''; if (strstr(relativeUrlGet(), '/')) { $url_prefix = '../'; } } if ($flags & 0x1 && strtolower($pub->paper) != 'no paper') { $html .= '<a href="' . $pub->paperAttGetUrl() . '">'; if (preg_match("/\\.(pdf|PDF)\$/", $pub->paper)) { $html .= '<img src="' . $url_prefix . 'images/pdf.gif" alt="PDF" ' . 'height="18" width="17" border="0" align="top" />'; } else { if (preg_match("/\\.(ppt|PPT)\$/", $pub->paper)) { $html .= '<img src="' . $url_prefix . 'images/ppt.gif" alt="PPT" height="18" ' . 'width="17" border="0" align="top" />'; } else { if (preg_match("/\\.(ps|PS)\$/", $pub->paper)) { $html .= '<img src="' . $url_prefix . 'images/ps.gif" alt="PS" height="18" ' . 'width="17" border="0" align="top" />'; } } } $html .= '</a>'; } if ($flags & 0x2) { $html .= '<a href="' . $url_prefix . 'view_publication.php?pub_id=' . $pub->pub_id . '">' . '<img src="' . $url_prefix . 'images/viewmag.gif" title="view" alt="view" ' . ' height="16" width="16" border="0" align="top" /></a>'; } if ($flags & 0x4 && $access_level > 0) { $html .= '<a href="' . $url_prefix . 'Admin/add_pub1.php?pub_id=' . $pub->pub_id . '">' . '<img src="' . $url_prefix . 'images/pencil.gif" title="edit" alt="edit" ' . ' height="16" width="16" border="0" align="top" />' . '</a>'; } if ($flags & 0x8 && $access_level > 0) { $html .= '<a href="' . $url_prefix . 'Admin/delete_publication.php?pub_id=' . $pub->pub_id . '">' . '<img src="' . $url_prefix . 'images/kill.gif" title="delete" alt="delete" ' . 'height="16" width="16" border="0" align="top" /></a>'; } return $html; }