Author: pmacadden
Date: 2010-04-26 04:05:50 +0200 (Mon, 26 Apr 2010)
New Revision: 29255

Added:
   plugins/pmPropelEventCalendarPlugin/trunk/LICENSE
   plugins/pmPropelEventCalendarPlugin/trunk/README
   plugins/pmPropelEventCalendarPlugin/trunk/config/
   plugins/pmPropelEventCalendarPlugin/trunk/config/routing.yml
   plugins/pmPropelEventCalendarPlugin/trunk/modules/
   plugins/pmPropelEventCalendarPlugin/trunk/modules/pm_propel_event_calendar/
   
plugins/pmPropelEventCalendarPlugin/trunk/modules/pm_propel_event_calendar/actions/
   
plugins/pmPropelEventCalendarPlugin/trunk/modules/pm_propel_event_calendar/actions/actions.class.php
   
plugins/pmPropelEventCalendarPlugin/trunk/modules/pm_propel_event_calendar/templates/
   
plugins/pmPropelEventCalendarPlugin/trunk/modules/pm_propel_event_calendar/templates/_assets.php
   
plugins/pmPropelEventCalendarPlugin/trunk/modules/pm_propel_event_calendar/templates/indexSuccess.php
   
plugins/pmPropelEventCalendarPlugin/trunk/modules/pm_propel_event_calendar/templates/searchSuccess.php
Log:
First import



Added: plugins/pmPropelEventCalendarPlugin/trunk/LICENSE
===================================================================
--- plugins/pmPropelEventCalendarPlugin/trunk/LICENSE                           
(rev 0)
+++ plugins/pmPropelEventCalendarPlugin/trunk/LICENSE   2010-04-26 02:05:50 UTC 
(rev 29255)
@@ -0,0 +1,19 @@
+Copyright (c) 2010 Patricio Mac Adden
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is furnished
+to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.

Added: plugins/pmPropelEventCalendarPlugin/trunk/README
===================================================================
--- plugins/pmPropelEventCalendarPlugin/trunk/README                            
(rev 0)
+++ plugins/pmPropelEventCalendarPlugin/trunk/README    2010-04-26 02:05:50 UTC 
(rev 29255)
@@ -0,0 +1,56 @@
+pmPropelEventCalendarPlugin
+===========================
+
+The `pmPropelEventCalendarPlugin` is a symfony plugin that provides an event 
calendar
+based on a Propel class. You can use the provided module for searching events.
+
+Installation
+------------
+
+  * Install the plugin
+
+    * Subversion
+
+        [bash]
+        $ svn co 
http://svn.symfony-project.com/plugins/pmPropelEventCalendarPlugin/trunk 
pmPropelEventCalendarPlugin
+
+  * Download jquery and jqueryui javascripts. Use them in your view.yml file
+
+        [yml]
+        # in apps/<app>/config/view.yml
+        default:
+          stylesheets:    [smoothness/jquery-ui-1.8.custom.css]
+          javascripts:    [jquery-1.4.2.min.js, jquery-ui-1.8.custom.min.js]
+
+  * Enable the pm_propel_event_calendar module
+
+        [yml]
+        # in apps/<app>/config/settings.yml
+        all:
+          enabled_modules: [default, pm_propel_event_calendar]
+
+  * Configure the plugin
+
+        [yml]
+        # in apps/<app>/config/app.yml
+        all:
+          pm_propel_event_calendar:
+            class: Event              # default
+            column: DATE              # default
+            peer_method: doSelect     # default
+            title: Event calendar     # default
+            order: desc               # default, could be 'asc'
+            module: event             # propel admin module, used to present 
the results (not required)
+
+  * Clear your cache
+
+        $ symfony cc
+
+  * Filter by date in /<app>.php/pm_propel_event_calendar
+
+
+TODO
+----
+
+  * Improve documentation
+  * Create a widget and a form that use it (could be useful)

Added: plugins/pmPropelEventCalendarPlugin/trunk/config/routing.yml
===================================================================
--- plugins/pmPropelEventCalendarPlugin/trunk/config/routing.yml                
                (rev 0)
+++ plugins/pmPropelEventCalendarPlugin/trunk/config/routing.yml        
2010-04-26 02:05:50 UTC (rev 29255)
@@ -0,0 +1,7 @@
+pm_propel_event_calendar:
+  url: /pm_propel_event_calendar
+  param: { module: pm_propel_event_calendar, action: index }
+
+pm_propel_event_calendar_search:
+  url: /pm_propel_event_calendar_search
+  param: { module: pm_propel_event_calendar, action: search }

Added: 
plugins/pmPropelEventCalendarPlugin/trunk/modules/pm_propel_event_calendar/actions/actions.class.php
===================================================================
--- 
plugins/pmPropelEventCalendarPlugin/trunk/modules/pm_propel_event_calendar/actions/actions.class.php
                                (rev 0)
+++ 
plugins/pmPropelEventCalendarPlugin/trunk/modules/pm_propel_event_calendar/actions/actions.class.php
        2010-04-26 02:05:50 UTC (rev 29255)
@@ -0,0 +1,66 @@
+<?php
+
+/**
+ * pm_propel_event_calendar actions.
+ *
+ * @package pm_event_calendar
+ * @author     Patricio Mac Adden <[email protected]>
+ * @version    SVN: $Id: actions.class.php 12479 2008-10-31 10:54:40Z fabien $
+ */
+class pm_propel_event_calendarActions extends sfActions
+{
+ /**
+  * Executes index action
+  *
+  * @param sfRequest $request A request object
+  */
+  public function executeIndex(sfWebRequest $request)
+  {
+    $this->title = sfConfig::get('app_pm_propel_event_calendar_title', 'Event 
calendar');
+  }
+
+ /**
+  * Executes search action
+  *
+  * @param sfRequest $request A request object
+  */
+  public function executeSearch(sfWebRequest $request)
+  {
+    $selected_date = $request->getParameter('date');
+    $this->class = sfConfig::get('app_pm_propel_event_calendar_class', 
'Event');
+    $peer_class = $this->class.'Peer';
+    $column = sfConfig::get('app_pm_propel_event_calendar_column', 'DATE');
+    $peer_method = sfConfig::get('app_pm_propel_event_calendar_peer_method', 
'doSelect');
+    $order = sfConfig::get('app_pm_propel_event_calendar_order', 'desc');
+    $module = sfConfig::get('app_pm_propel_event_calendar_module');
+
+    $c = new Criteria();
+    $c->add(constant("$peer_class::$column"), $selected_date);
+
+    if ($order == 'desc')
+    {
+      $c->addDescendingOrderByColumn(constant("$peer_class::$column"));
+    }
+    else
+    {
+      $c->addAscendingOrderByColumn(constant("$peer_class::$column"));
+    }
+
+    if (!is_null($module))
+    {
+      $filters = array(
+        sfInflector::underscore($column) => array(
+          "from" => $selected_date,
+          "to" => $selected_date
+        )
+      );
+
+      
$this->getUser()->setAttribute(sfInflector::underscore($this->class).".filters",
 $filters, 'admin_module');
+      $this->redirect(sfInflector::underscore($this->class)."/index");
+    }
+    else
+    {
+      $this->results = call_user_func(array($peer_class, $peer_method), $c);
+    }
+  }
+}

Added: 
plugins/pmPropelEventCalendarPlugin/trunk/modules/pm_propel_event_calendar/templates/_assets.php
===================================================================
--- 
plugins/pmPropelEventCalendarPlugin/trunk/modules/pm_propel_event_calendar/templates/_assets.php
                            (rev 0)
+++ 
plugins/pmPropelEventCalendarPlugin/trunk/modules/pm_propel_event_calendar/templates/_assets.php
    2010-04-26 02:05:50 UTC (rev 29255)
@@ -0,0 +1,2 @@
+<?php use_stylesheet('/sfPropelPlugin/css/global.css', 'first') ?>
+<?php use_stylesheet('/sfPropelPlugin/css/default.css', 'first') ?>

Added: 
plugins/pmPropelEventCalendarPlugin/trunk/modules/pm_propel_event_calendar/templates/indexSuccess.php
===================================================================
--- 
plugins/pmPropelEventCalendarPlugin/trunk/modules/pm_propel_event_calendar/templates/indexSuccess.php
                               (rev 0)
+++ 
plugins/pmPropelEventCalendarPlugin/trunk/modules/pm_propel_event_calendar/templates/indexSuccess.php
       2010-04-26 02:05:50 UTC (rev 29255)
@@ -0,0 +1,30 @@
+<?php use_helper('I18N', 'Date') ?>
+
+<?php include_partial('pm_propel_event_calendar/assets') ?>
+
+<div id="sf_admin_container">
+  <h1><?php echo $title ?></h1>
+
+  <div id="pm_propel_event_calendar"></div>
+
+  <script>
+    $(function()
+    {
+      $('#pm_propel_event_calendar').datepicker({
+        dateFormat: 'yy-mm-dd',
+        onSelect: function(dateText, inst)
+        {
+          $.ajax({
+            url: '<?php echo url_for('@pm_propel_event_calendar_search') 
?>?date='+dateText,
+            success: function(data)
+            {
+              $('#sf_admin_content').html(data);
+            }
+          });
+        }
+      });
+    });
+  </script>
+
+  <div id="sf_admin_content" style="margin-top: 20px;"></div>
+</div>

Added: 
plugins/pmPropelEventCalendarPlugin/trunk/modules/pm_propel_event_calendar/templates/searchSuccess.php
===================================================================
--- 
plugins/pmPropelEventCalendarPlugin/trunk/modules/pm_propel_event_calendar/templates/searchSuccess.php
                              (rev 0)
+++ 
plugins/pmPropelEventCalendarPlugin/trunk/modules/pm_propel_event_calendar/templates/searchSuccess.php
      2010-04-26 02:05:50 UTC (rev 29255)
@@ -0,0 +1,16 @@
+<?php use_helper('I18N') ?>
+
+<?php if (count($results)): ?>
+  <table>
+    <tr>
+      <th><?php echo $class ?></th>
+    </tr>
+    <?php foreach ($results as $result): ?>
+      <tr>
+        <td><?php echo $result ?></td>
+      </tr>
+    <?php endforeach ?>
+  </table>
+<?php else: ?>
+  <?php echo __('No result', array(), 'sf_admin') ?>
+<?php endif ?>

-- 
You received this message because you are subscribed to the Google Groups 
"symfony SVN" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/symfony-svn?hl=en.

Reply via email to