Commits

caedes  committed 28cf2ca

initial commit.

  • Participants

Comments (0)

Files changed (6)

File languages/en.php

+<?php
+/**
+ *      Tasks Plugin
+ *      @package Tasks
+ *      @author Liran Tal <liran@enginx.com>
+ *      @license GNU General Public License (GPL) version 2
+ *      @copyright (c) Liran Tal of Enginx 2009
+ *      @link http://www.enginx.com
+ **/
+
+        $english = array(
+                  'dmmdb:channel' => 'dmmdb channel',
+                  'dmmdb:embed_id' => 'channel id',
+                  'dmmdb:widget:configure' => 'configure id for channel',
+                  'dmmdb:widget:description' => 'Widget for embedding a dmmdb channel.'
+                  );
+        add_translation("en",$english);
+?>

File languages/es.php

+<?php
+/**
+ *      Tasks Plugin
+ *      @package Tasks
+ *      @author Liran Tal <liran@enginx.com>
+ *      @license GNU General Public License (GPL) version 2
+ *      @copyright (c) Liran Tal of Enginx 2009
+ *      @link http://www.enginx.com
+ **/
+
+        $spanish = array(
+                  'dmmdb:channel' => 'Canal Giss.tv',
+                  'dmmdb:embed_id' => 'ID del canal',
+                  'dmmdb:widget:configure' => 'configurar ID para el canal',
+                  'dmmdb:widget:description' => 'Modulo para embeber un canal de giss.tv'
+
+                  );
+        add_translation("es",$spanish);
+?>

File manifest.xml

+<?xml version="1.0" encoding="UTF-8"?>
+<plugin_manifest>
+        <field key="author" value="Liran Tal &lt;liran@enginx.com&gt;" />
+        <field key="version" value="1.1" />
+        <field key="description" value="Dmmdb widget Plugin" />
+        <field key="website" value="http://www.enginx.com/" />
+        <field key="copyright" value="Liran Tal (C) Enginx 2009" />
+        <field key="licence" value="GNU Public License version 2" />
+        <field key="elgg_version" value="2009030101" />
+</plugin_manifest>
+<?php
+/**
+ *	Tasks Plugin
+ *	@package Tasks
+ *	@author Liran Tal <liran@enginx.com>
+ *	@license GNU General Public License (GPL) version 2
+ *	@copyright (c) Liran Tal of Enginx 2009
+ *	@link http://www.enginx.com
+ **/
+ 
+global $CONFIG;
+
+/**
+ * Tasks page handler
+ *
+ * @param array $page Array of page elements, forwarded by the page handling mechanism
+ */
+function dmmdb_page_handler($page) {
+	global $CONFIG;
+	
+	// URLs $page array:
+	//		0 = <username>
+	//		1 = <action>
+	//		2 = <entityId>
+	//		3 = <entityTitle>
+	// URLs Syntax Format:  /pg/dmmdb/<user>/<action>
+	// URLs Syntax Example: /pg/dmmdb/lirantal/viewdmmdb
+	
+	// The first component of the URL is the username
+	if (isset($page[0]) && $page[0]) {
+		set_input('username',$page[0]);
+	}
+	
+	// The second component of the URL is the action
+	if (isset($page[1]) && $page[1]) {
+		switch ($page[1]) {
+			case "createtask":
+				include(dirname(__FILE__) . "/createtask.php");
+				break;
+			case "deletetask":
+				set_input('username', $page[0]);
+				set_input('taskId', $page[2]);
+				set_input('taskTitle', $page[3]);
+				include(dirname(__FILE__) . "/deletetask.php");
+				break;
+			case "viewdmmdb":
+				include(dirname(__FILE__) . "/viewdmmdb.php");
+				break;
+			case "edittask":
+				set_input('username', $page[0]);
+				set_input('taskId', $page[2]);
+				set_input('taskTitle', $page[3]);			
+				include(dirname(__FILE__) . "/edittask.php");
+				break;
+			case "viewtask":
+				set_input('username', $page[0]);
+				set_input('taskId', $page[2]);
+				set_input('taskTitle', $page[3]);
+				include(dirname(__FILE__) . "/viewtask.php");
+				break;				
+			default:
+				include(dirname(__FILE__) . "/viewdmmdb.php");
+				break;
+		}
+	} else {
+		include(dirname(__FILE__) . "/viewdmmdb.php");
+	}
+	
+	return true;
+}
+
+
+
+function dmmdb_url($entity) {
+
+	global $CONFIG;
+
+	// causes hebrew problems
+	//$title = friendly_title($entity->question);
+	$title = $entity->title;
+
+	$userObj = get_entity($entity->owner_guid);
+	$username = $userObj->username;
+	$id = $entity->guid;
+	return $CONFIG->url . "pg/dmmdb/".$username."/viewtask/".$id."/".$title."/";
+	
+}
+
+
+/**
+ * This hooks into the getIcon API and provides nice user icons for users where possible.
+ *
+ * @param unknown_type $hook
+ * @param unknown_type $entity_type
+ * @param unknown_type $returnvalue
+ * @param unknown_type $params
+ * @return unknown
+ */
+function dmmdb_dmmdbicon_hook($hook, $entity_type, $returnvalue, $params)
+{
+	global $CONFIG;
+	
+	if ((!$returnvalue) && ($hook == 'entity:icon:url'))
+	{
+		$entity = $params['entity'];
+		$type = $entity->type;
+		$viewtype = $params['viewtype'];
+		$size = $params['size'];
+		
+		if ($icontime = $entity->icontime) {
+			$icontime = "{$icontime}";
+		} else {
+			$icontime = "default";
+		}
+		
+		$filehandler = new ElggFile();
+		$filehandler->owner_guid = $entity->owner_guid;
+		$filehandler->setFilename("dmmdb/" . $entity->guid . $size . ".jpg");
+		
+		if ($filehandler->exists()) {
+			$url = $CONFIG->url . "pg/dmmdbicon/{$entity->guid}/$size/$icontime.jpg";
+		
+			return $url;
+		}
+	}
+}
+
+
+/**
+ * Handle object icons view icons.
+ *
+ * @param unknown_type $page
+ */
+function dmmdb_icon_handler($page) {
+		
+	global $CONFIG;
+	
+	// The username should be the file we're getting
+	if (isset($page[0])) {
+		set_input('object_guid',$page[0]);
+	}
+	if (isset($page[1])) {
+		set_input('size',$page[1]);
+	}
+	// Include the standard profile index
+	include($CONFIG->pluginspath . "dmmdb/graphics/icon.php");
+	
+}
+
+
+function dmmdb_init() {
+	global $CONFIG;
+	// register a page handler for the /pg/ urls
+	register_page_handler('dmmdb','dmmdb_page_handler');
+
+        // extend css
+        extend_view('css','dmmdb/css');
+	
+	// sets up the URL handler for the object view 
+	//register_entity_url_handler('dmmdb_url', 'object', 'dmmdb');
+        
+        // Shares widget
+        #add_widget_type('dmmdb',elgg_echo("dmmdb:recent"),elgg_echo("dmmdb:widget:description"),'all',false,"side,main",$CONFIG->url."pg/dmmdb/".$_SESSION['user']->username);
+        add_widget_type('dmmdb',elgg_echo("dmmdb:channel"),elgg_echo("dmmdb:widget:description"),'all',false,"side,main");
+
+//add_widget_type($handler, $name, $description, $context = "all", $multiple = false, $positions = "side,main", $url = "" )
+	// Register an icon handler for this object
+	//register_page_handler('dmmdbicon','dmmdb_icon_handler');
+	
+	// Now override icons
+	//register_plugin_hook('entity:icon:url', 'object', 'dmmdb_dmmdbicon_hook');
+	
+	// extending css with more 
+	//extend_view('css', 'dmmdb/css');
+	
+	//add_menu(elgg_echo('dmmdb:dmmdb'), $CONFIG->wwwroot . "pg/dmmdb/" . $_SESSION['user']->username);
+}
+
+// plugin init hook
+register_elgg_event_handler('init','system','dmmdb_init');
+
+
+?>

File views/default/widgets/dmmdb/edit.php

+<?php
+
+?>
+<p>
+    <?php echo elgg_echo("dmmdb:embed_id"); ?>
+    <input type="text" onclick="this.select();" name="params[text]" value="<?php echo $vars['entity']->text; ?>" />
+  </p>
+
+

File views/default/widgets/dmmdb/view.php

+<?php
+
+	    //get the num of shares the user want to display
+         echo "<div class=\"shares_widget_wrapper\">";
+         if ($vars['entity']->text)
+         {
+             $id = $vars['entity']->text;
+             echo "<iframe width=270 height=216 src=http://giss.tv/dmmdb//player.php?ID={$id}&mode_clip&baseurl=http://giss.tv/dmmdb/></iframe>";
+             echo "<a href='http://giss.tv/dmmdb//player.php?ID={$id}&mode_clip&baseurl=http://giss.tv/dmmdb'>pantalla completa</a>";
+         }
+         else
+         {
+             echo elgg_echo('dmmdb:widget:configure');
+         }
+         echo "</div>";
+         echo "<div class=\"clearfloat\"></div>";
+                                //echo "<div class=\"shares_widget_icon\">" . $icon . "</div>";
+                                //echo "<div class=\"shares_widget_content\">";
+             //echo "<p class='shares_title'>".$vars['entity']->text."</p>";
+             /*
+		$num = $vars['entity']->num_display;
+		
+		//if no number has been set, default to 4
+		if(!$num)
+			$num = 4;
+			
+               //grab the users task items
+               $allids = array();
+               $owner_guid = $vars['entity']->owner_guid;
+               array_push($allids, $owner_guid);
+               if ($vars['entity']->scope == "groups") {
+                   $groups = get_entities_from_relationship('member', $owner_guid, false, "group", "", 0, "", 100, 0, false, 0);
+                   foreach($groups as $group){
+                       array_push($allids, $group->getGUID());
+                   }
+                }
+
+ 		$shares = get_entities('object', 'tasks',$allids, "", $num, 0, false);
+ 		
+		if($shares){
+
+			foreach($shares as $s){
+			
+				//get the owner
+                                echo $s->content();
+				$owner = $s->getOwnerEntity();
+
+				//get the time
+				//$friendlytime = friendly_time($s->time_created);
+
+				//get the task icon
+                                $icon = elgg_view(
+                                    "tasks/icon", array(
+                                    'entity' => $s,
+                                    'size' => 'tiny',
+                                    )
+                                );
+				//get the task title
+				$info = "<p class=\"shares_title\"><a href=\"{$s->getURL()}\">{$s->title}</a></p>";
+				
+				//get the user details
+				//$info .= "<p class=\"shares_timestamp\"><small><a href=\"{$owner->getURL()}\">{$owner->name}</a> {$friendlytime}</small></p>";
+
+				//get the task description
+				if($s->long_description)
+					$info .= "<a href=\"javascript:void(0);\" class=\"share_more_info\">".elgg_echo('tasks:more')."</a><br /><div class=\"share_desc\"><p>{$s->long_description}</p></div>";
+		
+				//display 
+				echo "<div class=\"shares_widget_wrapper\">";
+				echo "<div class=\"shares_widget_icon\">" . $icon . "</div>";
+				echo "<div class=\"shares_widget_content\">" . $info . "</div>";
+                                echo "<div class=\"clearfloat\"></div>";
+				echo "</div>";
+
+			}*/
+			/*$user_inbox = $vars['url'] . "pg/tasks/" . page_owner_entity()->username;
+			echo "<div class=\"shares_widget_content\"><a href=\"{$user_inbox}\">".elgg_echo('tasks:inbox')."</a></div>";*/
+
+	
+	
+      ?>