Events...

Use GitHub to post feature requests for phpwcms.
Locked
Dylan Dog
Posts: 15
Joined: Fri 28. Jan 2005, 17:30
Contact:

Events...

Post by Dylan Dog »

found this in an older thread about planned features
Oliver Georgi wrote: - Content Part Blog
- Content Part Veranstaltung/Termine
(veranstaltung = german word for event)

are this features still planned, oliver?

btw: i really love phpwcms :-)
brans

Post by brans »

see the event calendar mod for events.#
--...--/index.php/topic,28.0.html

and the blog-addon from ionrock for blog-feature:
http://ionrock.umemusic.com/download.php?id=33839,8,2
Dylan Dog
Posts: 15
Joined: Fri 28. Jan 2005, 17:30
Contact:

Post by Dylan Dog »

i already played around with the calendarmod...
i need something, that connects events with more content, the calendar mod does not have the ability to link to other articles.

i'm planning a site for a film-series in a non-commercial cinema. i have an article for every movie, with a short critic, credits, links to imdb and other interesting sites, download of old film critics i've scanned and so on... it would be great just to ad something like "contentpart event" to that ads date,Time and Location to an article...
arkon
Posts: 14
Joined: Mon 8. Mar 2004, 13:27

Post by arkon »

i needed the same functionality. it's not perfectly finished yet and i'm not a good coder but the following works for me.

1.) add a new field to the cal_events table called 'article', type: INT.

2.) add the following code in the main.functions.php underneath the function showCategories:

Code: Select all

function showArticles($loc_art) {
	$result = mysql_query("SELECT * FROM ".DB_PREPEND."phpwcms_article WHERE article_public = 1 AND article_deleted = 0 ")
		or die("There was an error<br /> " . mysql_error() . "<hr />");
	$value_loc .= "<select name=\"article\">";
	while ($row = mysql_fetch_array($result)) {
		$value_loc .= "<option name=\"article\"";
		if ($row[article_id]==$loc_art) {
			$value_loc .= " selected";
		}
		$value_loc .= " value=\"$row[article_id]\">$row[article_title]</option>\n";
	}
	$value_loc .= "</select>\n";
	return $value_loc;
}
3.) in calendar.event.forms.php add underneath

Code: Select all

    <tr> 
        <th align="right"><?php echo $BL['be_cal']['forms']['location']; ?>:</th>
        <td align="left"><input type="text" id="location" name="location" value="<?php echo stripslashes($values['location']); ?>" /></td>
    </tr>
the following code:

Code: Select all

<tr> 
        <th align="right">Article:</th>
        <td align="left"> <?php echo showArticles($values['article']); ?></td>
</tr>
4.) in calendar.classes.php look for the function 'make_events' (around line 262). in this function you add after

Code: Select all

			$event = file_get_contents(PHPWCMS_ROOT."/include/inc_module/mod_calendar/inc_front/templates/".$template);
the following code:

Code: Select all

			$articleresult = mysql_query("SELECT * FROM ".DB_PREPEND."phpwcms_article WHERE article_id = " . $row['article'] . " LIMIT 1")
			or die("There was an error<br /> " . mysql_error());
			while ($articlerow = mysql_fetch_array($articleresult, MYSQL_ASSOC)) {
				$art_id=$articlerow["article_id"];
				$art_cid=$articlerow["article_cid"];
			}
			mysql_free_result($articleresult);
			
			$eventlink = "<a href=\"index.php?id=" . $art_cid . "," . $art_id . ",0,0,1,0\">more</a>";
			$event = str_replace("{EVENTLINK}", $eventlink , $event);
5.) on line 383 in the function 'showEvents' you have to change:

Code: Select all

	  $sql = "SELECT setid, events.id, title, category, name, description, approved, date FROM " 
to

Code: Select all

	  $sql = "SELECT setid, events.id, title, category, name, description, approved, date, article FROM " 
6.) on line 697 in the function 'insert_single_event' you have to change:

Code: Select all

		$sql .= "(date, span, time, title, category, price, location, description, extrainfo, approved, setid, userId) ";
to

Code: Select all

		$sql .= "(date, span, time, title, category, price, location, description, extrainfo, approved, setid, userId, article) ";
and on line 710 change

Code: Select all

		$sql .=  "0)";
to

Code: Select all

		$sql .=  "0, ";
		$sql .=  "$values[article])";
7.) on line 743 in the function 'update_event' you have to change:

Code: Select all

		$extra_sql .= "setid = $setid ";
to

Code: Select all

		$extra_sql .= "setid = $setid, ";
		$extra_sql .= "article = $values[article] ";
8.) on line 767 in the function 'update_event_set' you have to change:

Code: Select all

		$extra_sql .= "setid = $values[setid] ";
to

Code: Select all

		$extra_sql .= "setid = $values[setid], ";
		$extra_sql .= "article = $values[article] ";
9.) for showing the article-link in your event list you have to use the replacement tag {EVENTLINK} within your event template.
the articlelink also can be put directly in the eventtitle-link.
Dylan Dog
Posts: 15
Joined: Fri 28. Jan 2005, 17:30
Contact:

Post by Dylan Dog »

thanks alot, arkon, you helped me a lot :-)
one more question, how do you do this:
arkon wrote: (...) the articlelink also can be put directly in the eventtitle-link.
sorry, my php-knowledge (including all this templatestuff) is rather small...

Found out myself :-)
arkon
Posts: 14
Joined: Mon 8. Mar 2004, 13:27

Post by arkon »

in calendar.classes.php in the function 'make_events' change the code:

Code: Select all

			$row['title'] = "<a href=\"index.php?$alias&month=$month&year=$year\">" . $row['title'] . "</a>"; // make the title a link to the main calendar page. 
to the following:

Code: Select all

			$row['title'] = "<a href=\"index.php?id=" . $art_cid . "," . $art_id . ",0,0,1,0\">" . $row['title'] . "</a>"; // make the title a link to the specified article. 
so you can use the {TITLE} tag within your event template for the title linked to the specified article.
Locked