コード例 #1
0
 function UseModule($Identifer, $Parameters)
 {
     $Parameters = explode('&', $Parameters);
     $all = false;
     $count = 6;
     $location = '%';
     foreach ($Parameters as $parameter) {
         $parameter = explode('=', $parameter, 2);
         if (empty($parameter[1])) {
             $parameter[1] = true;
         }
         ${$parameter}[0] = $parameter[1];
     }
     $dates = new Dates($this->_SqlConnection, $this->_ComaLib, $this->_User, $this->_Config);
     if ($all) {
         $count = -1;
     }
     $datesArray = array();
     if ($location != '%') {
         $datesArray = $dates->ExtendedFillArray($location, $count);
     } else {
         $datesArray = $dates->FillArray($count);
     }
     $this->_ComaLate->SetReplacement('DATES', $datesArray);
     return "</p><table class=\"text_table full_width\">\r\n\t\t\t\t<thead>\r\n\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t<th class=\"table_date_width\">\r\n\t\t\t\t\t\t\t{$this->_Lang['date']}\r\n\t\t\t\t\t\t</th>\r\n\t\t\t\t\t\t<th class=\"small_width\">\r\n\t\t\t\t\t\t\t{$this->_Lang['location']}\r\n\t\t\t\t\t\t</th>\r\n\t\t\t\t\t\t<th>\r\n\t\t\t\t\t\t\t{$this->_Lang['topic']}\r\n\t\t\t\t\t\t</th>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t</thead>\r\n\t\t\t\t<tbody>\r\n\t\t\t\t\t<DATES:loop>\r\n\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t<td>\r\n\t\t\t\t\t\t\t{DATE_DATE}\r\n\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t<td>\r\n\t\t\t\t\t\t\t{DATE_LOCATION}\r\n\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t<td>\r\n\t\t\t\t\t\t\t{DATE_TOPIC}\r\n\t\t\t\t\t\t</td>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t\t</DATES>\r\n\t\t\t\t</tbody>\r\n \t\t\t</table><p>";
 }
コード例 #2
0
    function UseModule($Identifer, $Parameters)
    {
        $Parameters = explode('&', $Parameters);
        $all = false;
        $count = 6;
        $location = '%';
        // parse all parameters
        foreach ($Parameters as $parameter) {
            $parameter = explode('=', $parameter, 2);
            if (empty($parameter[1])) {
                $parameter[1] = true;
            }
            ${$parameter}[0] = $parameter[1];
        }
        $dates = new Dates($this->_SqlConnection, $this->_ComaLib, $this->_User, $this->_Config);
        // we want to get "all" dates
        if ($all) {
            $count = -1;
        }
        $datesArray = array();
        $found = 0;
        // get the count of all possible matches
        // if location is set, it is a conditional request
        if ($location != '%') {
            $found = $dates->GetExtendedCount($location);
        } else {
            $found = $dates->GetCount();
        }
        $start = 0;
        $linksArray = array();
        $linksTemplate = '';
        $links = uniqid('LINKS_');
        // it is usefull to use "page links"
        if ($found > $count && $count > 1) {
            $parts = $found / $count;
            $max = round($parts, 0);
            $max = $max >= $parts ? $max : $max + 1;
            $linksTemplate = '<' . $links . ':loop>
 						<a href="?page={PAGE_ID}&amp;page_nr={LINK_NR}">{LINK_TEXT}</a> {LINK_MINUS} 
 					</' . $links . '>';
            $pageNr = GetPostOrGet('page_nr');
            if (!is_numeric($pageNr)) {
                $pageNr = 0;
            }
            if ($pageNr > 0) {
                $linksTemplate = '<a href="?page={PAGE_ID}&amp;page_nr=' . ($pageNr - 1) . '">{LANG_PREVIOUS}</a> -' . $linksTemplate;
            }
            if ($pageNr < $max - 1) {
                $linksTemplate .= ' - <a href="?page={PAGE_ID}&amp;page_nr=' . ($pageNr + 1) . '">{LANG_NEXT}</a>';
            }
            for ($i = 0; $i < $parts; $i++) {
                $linksArray[$i] = array('LINK_NR' => $i, 'LINK_TEXT' => $i + 1, 'LINK_MINUS' => '-');
            }
            $linksArray[$max - 1]['LINK_MINUS'] = '';
            $this->_ComaLate->SetReplacement($links, $linksArray);
            $this->_ComaLate->SetReplacement('LANG_NEXT', $this->_Translation->GetTranslation('next'));
            $this->_ComaLate->SetReplacement('LANG_PREVIOUS', $this->_Translation->GetTranslation('previous'));
            $linksTemplate = '<div>' . $linksTemplate . '</div>';
            $start = $count * $pageNr;
            if ($start > $found) {
                $start = ($max - 1) * $count;
            }
        }
        // Get the array with the dates
        if ($location != '%') {
            $datesArray = $dates->ExtendedFillArray($location, $count, $start);
        } else {
            $datesArray = $dates->FillArray($count, $start);
        }
        $name = uniqid('EVENTS_');
        $this->_ComaLate->SetReplacement($name, $datesArray);
        $this->_ComaLate->SetReplacement('PAGE_ID', GetPostOrGet('page'));
        $this->_ComaLate->SetReplacement('LANG_DATE', $this->_Translation->GetTranslation('date'));
        $this->_ComaLate->SetReplacement('LANG_LOCATION', $this->_Translation->GetTranslation('location'));
        $this->_ComaLate->SetReplacement('LANG_TOPIC', $this->_Translation->GetTranslation('topic'));
        $template = '</p>' . $linksTemplate . '
 					<table class="full_width">
				<thead>
					<tr>
						<th class="table_date_width">
							{LANG_DATE}
						</th>
						<th class="small_width">
							{LANG_LOCATION}
						</th>
						<th>
							{LANG_TOPIC}
						</th>
					</tr>
				</thead>
				<tbody>
					<' . $name . ':loop>
					<tr>
						<td>
							{EVENT_DATE}
						</td>
						<td>
							{EVENT_LOCATION}
						</td>
						<td>
							{EVENT_TOPIC_HTML}
						</td>
					</tr>
					</' . $name . '>
				</tbody>
 			</table>' . $linksTemplate . '<p>';
        return $template;
    }
コード例 #3
0
 /**
  * @access private
  * @return string
  */
 function _homePage()
 {
     $dates = new Dates($this->_SqlConnection, $this->_ComaLib, $this->_User, $this->_Config);
     $datesArray = $dates->FillArray(-1, false);
     $out = "<h2>{$this->_Lang['dates']}</h2>\r\n \t\t\t\t<a href=\"admin.php?page=module_dates&amp;action=new\" class=\"button\">{$this->_Lang['add_a_new_date']}</a>\r\n\t\t\t\t<table class=\"text_table full_width\">\r\n\t\t\t\t\t<thead>\r\n\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t\t<th>{$this->_Lang['date']}</th>\r\n\t\t\t\t\t\t\t<th>{$this->_Lang['location']}</th>\r\n\t\t\t\t\t\t\t<th>{$this->_Lang['topic']}</th>\r\n\t\t\t\t\t\t\t<th>{$this->_Lang['creator']}</th>\r\n\t\t\t\t\t\t\t<th>{$this->_Lang['actions']}</th>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t</thead>\r\n\t\t\t\t\t<tbody>\r\n";
     foreach ($datesArray as $dateEntry) {
         $out .= "\t\t\t\t\t<tr ID=\"dateid{$dateEntry['DATE_ID']}\">\r\n\t\t\t\t\t\t<td>\r\n\t\t\t\t\t\t\t" . date("d.m.Y H:i", $dateEntry['DATE_DATE']) . "\r\n\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t<td>\r\n\t\t\t\t\t\t\t{$dateEntry['DATE_LOCATION']}\r\n\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t<td>\r\n\t\t\t\t\t\t\t{$dateEntry['DATE_TOPIC']}\r\n\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t<td>\r\n\t\t\t\t\t\t\t" . getUserByID($dateEntry['DATE_CREATOR']) . "\r\n\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t<td colspan=\"2\">\r\n\t\t\t\t\t\t\t<a href=\"admin.php?page=module_dates&amp;action=edit&amp;dateID={$dateEntry['DATE_ID']}\" title=\"{$this->_Lang['edit']}\"><img src=\"./img/edit.png\" height=\"16\" width=\"16\" alt=\"{$this->_Lang['edit']}\" title=\"" . $this->_Lang['edit'] . "\"/></a>\r\n\t\t\t\t\t\t\t&nbsp;<a href=\"admin.php?page=module_dates&amp;action=delete&amp;dateID={$dateEntry['DATE_ID']}\" title=\"{$this->_Lang['delete']}\"><img src=\"./img/del.png\" height=\"16\" width=\"16\" alt=\"{ {$this->_Lang}['delete']}\" title=\"" . $this->_Lang['delete'] . "\"/></a>\r\n\t\t\t\t\t\t</td>\r\n\t\t\t\t\t</tr>\r\n";
     }
     $out .= "</tbody>\r\n\t\t\t\t</table>";
     return $out;
 }
コード例 #4
0
    /**
     * @access private
     * @return string
     */
    function _mainPage()
    {
        $dates = new Dates($this->_SqlConnection, $this->_ComaLib, $this->_User, $this->_Config);
        $showOld = false;
        if (GetPostOrGet('showOld') == '1') {
            $showOld = true;
        }
        // get all dates with readable dates and usernames
        $eventsArray = $dates->FillArray(-1, 0, true, true, !$showOld);
        $this->_ComaLate->SetReplacement('EVENT_EVENTS', $eventsArray);
        $this->_ComaLate->SetReplacement('DATES_MODULE_TITLE', $this->_Translation->GetTranslation('events'));
        $this->_ComaLate->SetReplacement('ADD_A_NEW_EVENT', $this->_Translation->GetTranslation('add_a_new_event'));
        $this->_ComaLate->SetReplacement('EVENT_TITLE_DATE', $this->_Translation->GetTranslation('date'));
        $this->_ComaLate->SetReplacement('EVENT_TITLE_LOCATION', $this->_Translation->GetTranslation('location'));
        $this->_ComaLate->SetReplacement('EVENT_TITLE_TOPIC', $this->_Translation->GetTranslation('topic'));
        $this->_ComaLate->SetReplacement('EVENT_TITLE_CREATOR', $this->_Translation->GetTranslation('creator'));
        $this->_ComaLate->SetReplacement('EVENT_TITLE_ACTIONS', $this->_Translation->GetTranslation('actions'));
        $this->_ComaLate->SetReplacement('EVENT_LANG_EDIT', sprintf($this->_Translation->GetTranslation('edit_the_date_%date%'), '{EVENT_TOPIC}'));
        $this->_ComaLate->SetReplacement('EVENT_LANG_DELETE', sprintf($this->_Translation->GetTranslation('delete_the_date_%date%'), '{EVENT_TOPIC}'));
        $this->_ComaLate->SetReplacement('SHOW_OLD', $this->_Translation->GetTranslation($showOld ? 'hide_old_events' : 'show_old_events'));
        $this->_ComaLate->SetReplacement('SHOW_OLD_VAR', $showOld ? 0 : 1);
        $template = '<h2>{DATES_MODULE_TITLE}</h2>
						<a href="admin.php?page=module_dates&amp;action=new" class="button">{ADD_A_NEW_EVENT}</a>
						<a href="admin.php?page=module_dates&amp;showOld={SHOW_OLD_VAR}" class="button">{SHOW_OLD}</a>
						<table  class="full_width">
							<tr>
								<th>{EVENT_TITLE_DATE}</th>
								<th>{EVENT_TITLE_LOCATION}</th>
								<th>{EVENT_TITLE_TOPIC}</th>
								<th>{EVENT_TITLE_CREATOR}</th>
								<th class="actions">{EVENT_TITLE_ACTIONS}</th>
							</tr>
							<EVENT_EVENTS:loop>
							<tr>
								<td>{EVENT_DATE}</td>
								<td>{EVENT_LOCATION}</td>
								<td>{EVENT_TOPIC_HTML}</td>
								<td>{EVENT_CREATOR}</td>
								<td>
									<a href="admin.php?page=module_dates&amp;action=edit&amp;eventID={EVENT_ID}" title="{EVENT_LANG_EDIT}"><img src="./img/edit.png" height="16" width="16" alt="{EVENT_LANG_EDIT}" title="{EVENT_LANG_EDIT}" /></a>
									<a href="admin.php?page=module_dates&amp;action=delete&amp;eventID={EVENT_ID}" title="{EVENT_LANG_DELETE}"><img src="./img/del.png" height="16" width="16" alt="{EVENT_LANG_DELETE}" title="{EVENT_LANG_DELETE}" /></a></td>
							</tr>
							</EVENT_EVENTS>
							
						</table>';
        return $template;
    }