|
From: <be...@us...> - 2015-01-16 11:44:55
|
Revision: 12936
http://sourceforge.net/p/xoops/svn/12936
Author: beckmi
Date: 2015-01-16 10:54:08 +0000 (Fri, 16 Jan 2015)
Log Message:
-----------
xBootstrap compatibility
Modified Paths:
--------------
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/extcal/admin/menu.php
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/extcal/class/cat.php
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/extcal/class/config.php
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/extcal/class/etablissement.php
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/extcal/class/event.php
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/extcal/class/eventmember.php
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/extcal/class/eventnotmember.php
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/extcal/class/file.php
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/extcal/class/pear/Calendar/Engine/PearDate.php
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/extcal/class/pear/Calendar/Week.php
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/extcal/class/perm.php
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/extcal/class/time.php
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/extcal/docs/changelog.txt
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/extcal/include/constantes.php
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/extcal/include/notification.inc.php
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/extcal/include/search.inc.php
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/extcal/view_agenda-day.php
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/extcal/view_agenda-week.php
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/extcal/view_calendar-month.php
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/extcal/view_calendar-week.php
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/extcal/view_day.php
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/extcal/view_month.php
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/extcal/view_new-event.php
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/extcal/view_search.php
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/extcal/view_week.php
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/extcal/view_year.php
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/extcal/xoops_version.php
Modified: XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/extcal/admin/menu.php
===================================================================
--- XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/extcal/admin/menu.php 2015-01-12 12:30:54 UTC (rev 12935)
+++ XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/extcal/admin/menu.php 2015-01-16 10:54:08 UTC (rev 12936)
@@ -1,53 +1,53 @@
-<?php
-
-// defined("XOOPS_ROOT_PATH") || die("XOOPS root path not defined");
-
-$path = dirname(dirname(dirname(__DIR__)));
-include_once $path . '/mainfile.php';
-
-$dirname = basename(dirname(__DIR__));
-$module_handler = xoops_gethandler('module');
-$module = $module_handler->getByDirname($dirname);
-$pathIcon32 = $module->getInfo('icons32');
-$pathModuleAdmin = $module->getInfo('dirmoduleadmin');
-$pathLanguage = $path . $pathModuleAdmin;
-
-if (!file_exists($fileinc = $pathLanguage . '/language/' . $GLOBALS['xoopsConfig']['language'] . '/' . 'main.php')) {
- $fileinc = $pathLanguage . '/language/english/main.php';
-}
-
-include_once $fileinc;
-
-$adminmenu = array();
-
-$i = 1;
-$adminmenu[$i]['title'] = _MI_EXTCAL_INDEX;
-$adminmenu[$i]['link'] = "admin/index.php";
-$adminmenu[$i]["icon"] = $pathIcon32 . '/home.png';
-++$i;
-$adminmenu[$i]['title'] = _MI_EXTCAL_CATEGORY;
-$adminmenu[$i]['link'] = "admin/cat.php";
-$adminmenu[$i]["icon"] = $pathIcon32 . '/category.png';
-++$i;
-$adminmenu[$i]['title'] = _MI_EXTCAL_EVENT;
-$adminmenu[$i]['link'] = "admin/event.php";
-$adminmenu[$i]["icon"] = $pathIcon32 . '/event.png';
-++$i;
-$adminmenu[$i]['title'] = _MI_EXTCAL_ETABLISSEMENTS;
-$adminmenu[$i]['link'] = "admin/etablissement.php";
-//$adminmenu[$i]["icon"] = '../../'.$pathImageAdmin.'/etablissement.png';
-$adminmenu[$i]["icon"] = 'assets/images/icons/32/etablissement.png';
-//echo $adminmenu[$i]["icon"]."<br>";
-
-++$i;
-$adminmenu[$i]['title'] = _MI_EXTCAL_PERMISSIONS;
-$adminmenu[$i]['link'] = "admin/permissions.php";
-$adminmenu[$i]["icon"] = $pathIcon32 . '/permissions.png';
-//++$i;
-//$adminmenu[$i]['title'] = _MI_EXTCAL_PRUNING;
-//$adminmenu[$i]['link'] = "admin/prune.php";
-//$adminmenu[$i]["icon"] = "assets/images/admin/about.png";
-++$i;
-$adminmenu[$i]["title"] = _MI_EXTCAL_ABOUT;
-$adminmenu[$i]["link"] = "admin/about.php";
-$adminmenu[$i]["icon"] = $pathIcon32 . '/about.png';
+<?php
+
+// defined("XOOPS_ROOT_PATH") || exit("XOOPS root path not defined");
+
+$path = dirname(dirname(dirname(__DIR__)));
+include_once $path . '/mainfile.php';
+
+$dirname = basename(dirname(__DIR__));
+$module_handler = xoops_gethandler('module');
+$module = $module_handler->getByDirname($dirname);
+$pathIcon32 = $module->getInfo('icons32');
+$pathModuleAdmin = $module->getInfo('dirmoduleadmin');
+$pathLanguage = $path . $pathModuleAdmin;
+
+if (!file_exists($fileinc = $pathLanguage . '/language/' . $GLOBALS['xoopsConfig']['language'] . '/' . 'main.php')) {
+ $fileinc = $pathLanguage . '/language/english/main.php';
+}
+
+include_once $fileinc;
+
+$adminmenu = array();
+
+$i = 1;
+$adminmenu[$i]['title'] = _MI_EXTCAL_INDEX;
+$adminmenu[$i]['link'] = "admin/index.php";
+$adminmenu[$i]["icon"] = $pathIcon32 . '/home.png';
+++$i;
+$adminmenu[$i]['title'] = _MI_EXTCAL_CATEGORY;
+$adminmenu[$i]['link'] = "admin/cat.php";
+$adminmenu[$i]["icon"] = $pathIcon32 . '/category.png';
+++$i;
+$adminmenu[$i]['title'] = _MI_EXTCAL_EVENT;
+$adminmenu[$i]['link'] = "admin/event.php";
+$adminmenu[$i]["icon"] = $pathIcon32 . '/event.png';
+++$i;
+$adminmenu[$i]['title'] = _MI_EXTCAL_ETABLISSEMENTS;
+$adminmenu[$i]['link'] = "admin/etablissement.php";
+//$adminmenu[$i]["icon"] = '../../'.$pathImageAdmin.'/etablissement.png';
+$adminmenu[$i]["icon"] = 'assets/images/icons/32/etablissement.png';
+//echo $adminmenu[$i]["icon"]."<br>";
+
+++$i;
+$adminmenu[$i]['title'] = _MI_EXTCAL_PERMISSIONS;
+$adminmenu[$i]['link'] = "admin/permissions.php";
+$adminmenu[$i]["icon"] = $pathIcon32 . '/permissions.png';
+//++$i;
+//$adminmenu[$i]['title'] = _MI_EXTCAL_PRUNING;
+//$adminmenu[$i]['link'] = "admin/prune.php";
+//$adminmenu[$i]["icon"] = "assets/images/admin/about.png";
+++$i;
+$adminmenu[$i]["title"] = _MI_EXTCAL_ABOUT;
+$adminmenu[$i]["link"] = "admin/about.php";
+$adminmenu[$i]["icon"] = $pathIcon32 . '/about.png';
Modified: XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/extcal/class/cat.php
===================================================================
--- XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/extcal/class/cat.php 2015-01-12 12:30:54 UTC (rev 12935)
+++ XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/extcal/class/cat.php 2015-01-16 10:54:08 UTC (rev 12936)
@@ -1,216 +1,216 @@
-<?php
-
-// defined("XOOPS_ROOT_PATH") || die("XOOPS root path not defined");
-
-include_once XOOPS_ROOT_PATH . '/modules/extcal/class/ExtcalPersistableObjectHandler.php';
-include_once XOOPS_ROOT_PATH . '/modules/extcal/class/perm.php';
-include_once XOOPS_ROOT_PATH . '/modules/extcal/class/time.php';
-
-/**
- * Class ExtcalCat
- */
-class ExtcalCat extends XoopsObject
-{
-
- var $externalKey = array();
-
- function ExtcalCat()
- {
- $this->initVar('cat_id', XOBJ_DTYPE_INT, null, false);
- $this->initVar('cat_name', XOBJ_DTYPE_TXTBOX, null, true, 255);
- $this->initVar('cat_desc', XOBJ_DTYPE_TXTAREA, null, false);
- $this->initVar('cat_color', XOBJ_DTYPE_TXTBOX, '000000', false, 255);
- $this->initVar('cat_weight', XOBJ_DTYPE_INT, 0, false);
- $this->initVar('cat_icone', XOBJ_DTYPE_TXTBOX, '', false, 50);
- }
-
-}
-
-/**
- * Class ExtcalCatHandler
- */
-class ExtcalCatHandler extends ExtcalPersistableObjectHandler
-{
-
- var $_extcalPerm;
-
- /**
- * @param $db
- */
- function __construct(&$db)
- {
- $this->_extcalPerm = ExtcalPerm::getHandler();
- parent::__construct($db, 'extcal_cat', _EXTCAL_CLN_CAT, 'cat_id');
- }
-
- /**
- * @param $data
- *
- * @return bool
- */
- function createCat($data)
- {
- $cat = $this->create();
- $cat->setVars($data);
- $this->insert($cat);
-
- $catId = $this->getInsertId();
-
- // Retriving permission mask
- $groupPermissionHandler =& xoops_gethandler('groupperm');
- $moduleId = $GLOBALS['xoopsModule']->getVar('mid');
-
- $criteria = new CriteriaCompo();
- $criteria->add(new Criteria('gperm_name', 'extcal_perm_mask'));
- $criteria->add(new Criteria('gperm_modid', $moduleId));
- $permMask = $groupPermissionHandler->getObjects($criteria);
-
- // Retriving group list
- $memberHandler =& xoops_gethandler('member');
- $glist = $memberHandler->getGroupList();
-
- // Applying permission mask
- foreach (
- $permMask as $perm
- ) {
- if ($perm->getVar('gperm_itemid') == 1
- ) {
- $groupPermissionHandler->addRight('extcal_cat_view', $cat->getVar('cat_id'), $perm->getVar('gperm_groupid'), $moduleId);
- }
- if ($perm->getVar('gperm_itemid') == 2
- ) {
- $groupPermissionHandler->addRight('extcal_cat_submit', $cat->getVar('cat_id'), $perm->getVar('gperm_groupid'), $moduleId);
- }
- if ($perm->getVar('gperm_itemid') == 4
- ) {
- $groupPermissionHandler->addRight('extcal_cat_autoapprove', $cat->getVar('cat_id'), $perm->getVar('gperm_groupid'), $moduleId);
- }
- if ($perm->getVar('gperm_itemid') == 8
- ) {
- $groupPermissionHandler->addRight('extcal_cat_edit', $cat->getVar('cat_id'), $perm->getVar('gperm_groupid'), $moduleId);
- }
- }
-
- return true;
- }
-
- /**
- * @param $catId
- * @param $data
- *
- * @return bool
- */
- function modifyCat($catId, $data)
- {
- $cat = $this->get($catId);
- $cat->setVars($data);
-
- return $this->insert($cat);
- }
-
- /**
- * @param $catId
- */
- function deleteCat($catId)
- {
- /* TODO :
- - Delete all event in this category
- */
- $this->delete($catId);
- }
-
- // Return one cat selected by his id
- /**
- * @param $catId
- * @param bool $skipPerm
- *
- * @return bool
- */
- function getCat($catId, $skipPerm = false)
- {
- $criteriaCompo = new CriteriaCompo();
- $criteriaCompo->add(new Criteria('cat_id', $catId));
- if (!$skipPerm) {
- $this->_addCatPermCriteria($criteriaCompo, $GLOBALS['xoopsUser']);
- }
- $ret = $this->getObjects($criteriaCompo);
- if (isset($ret[0])) {
- return $ret[0];
- } else {
- return false;
- }
- }
-
- /**
- * @param $user
- * @param string $perm
- *
- * @return array
- */
- function getAllCat($user, $perm = 'extcal_cat_view')
- {
- $criteriaCompo = new CriteriaCompo();
- if ($perm != 'all') {
- $this->_addCatPermCriteria($criteriaCompo, $user, $perm);
- }
-
- return $this->getObjects($criteriaCompo);
- }
-
- /**
- * @param $user
- * @param string $perm
- *
- * @return array
- */
- function getAllCatById($user, $perm = 'all')
- {
- $criteriaCompo = new CriteriaCompo();
- if ($perm != 'all') {
- $this->_addCatPermCriteria($criteriaCompo, $user, $perm);
- }
-
- $t = $this->objectToArray($this->getObjects($criteriaCompo));
- $r = array();
- while (list($k, $v) = each($t)) {
- $r[$v['cat_id']] = $v;
- }
-
- return $r;
- }
-
- /**
- * @param $criteria
- * @param $user
- * @param string $perm
- */
- function _addCatPermCriteria(&$criteria, &$user, $perm = 'extcal_cat_view')
- {
- $authorizedAccessCats = $this->_extcalPerm->getAuthorizedCat($user, 'extcal_cat_view');
- $count = count($authorizedAccessCats);
- if ($count > 0) {
- $in = '(' . $authorizedAccessCats[0];
- array_shift($authorizedAccessCats);
- foreach (
- $authorizedAccessCats as $authorizedAccessCat
- ) {
- $in .= ',' . $authorizedAccessCat;
- }
- $in .= ')';
- $criteria->add(new Criteria('cat_id', $in, 'IN'));
- } else {
- $criteria->add(new Criteria('cat_id', '(0)', 'IN'));
- }
- }
-
- /**
- * @param $xoopsUser
- *
- * @return bool
- */
- function haveSubmitRight(&$xoopsUser)
- {
- return count($this->_extcalPerm->getAuthorizedCat($xoopsUser, 'extcal_cat_submit')) > 0;
- }
-
-}
+<?php
+
+// defined("XOOPS_ROOT_PATH") || exit("XOOPS root path not defined");
+
+include_once XOOPS_ROOT_PATH . '/modules/extcal/class/ExtcalPersistableObjectHandler.php';
+include_once XOOPS_ROOT_PATH . '/modules/extcal/class/perm.php';
+include_once XOOPS_ROOT_PATH . '/modules/extcal/class/time.php';
+
+/**
+ * Class ExtcalCat
+ */
+class ExtcalCat extends XoopsObject
+{
+
+ var $externalKey = array();
+
+ function ExtcalCat()
+ {
+ $this->initVar('cat_id', XOBJ_DTYPE_INT, null, false);
+ $this->initVar('cat_name', XOBJ_DTYPE_TXTBOX, null, true, 255);
+ $this->initVar('cat_desc', XOBJ_DTYPE_TXTAREA, null, false);
+ $this->initVar('cat_color', XOBJ_DTYPE_TXTBOX, '000000', false, 255);
+ $this->initVar('cat_weight', XOBJ_DTYPE_INT, 0, false);
+ $this->initVar('cat_icone', XOBJ_DTYPE_TXTBOX, '', false, 50);
+ }
+
+}
+
+/**
+ * Class ExtcalCatHandler
+ */
+class ExtcalCatHandler extends ExtcalPersistableObjectHandler
+{
+
+ var $_extcalPerm;
+
+ /**
+ * @param $db
+ */
+ function __construct(&$db)
+ {
+ $this->_extcalPerm = ExtcalPerm::getHandler();
+ parent::__construct($db, 'extcal_cat', _EXTCAL_CLN_CAT, 'cat_id');
+ }
+
+ /**
+ * @param $data
+ *
+ * @return bool
+ */
+ function createCat($data)
+ {
+ $cat = $this->create();
+ $cat->setVars($data);
+ $this->insert($cat);
+
+ $catId = $this->getInsertId();
+
+ // Retriving permission mask
+ $groupPermissionHandler =& xoops_gethandler('groupperm');
+ $moduleId = $GLOBALS['xoopsModule']->getVar('mid');
+
+ $criteria = new CriteriaCompo();
+ $criteria->add(new Criteria('gperm_name', 'extcal_perm_mask'));
+ $criteria->add(new Criteria('gperm_modid', $moduleId));
+ $permMask = $groupPermissionHandler->getObjects($criteria);
+
+ // Retriving group list
+ $memberHandler =& xoops_gethandler('member');
+ $glist = $memberHandler->getGroupList();
+
+ // Applying permission mask
+ foreach (
+ $permMask as $perm
+ ) {
+ if ($perm->getVar('gperm_itemid') == 1
+ ) {
+ $groupPermissionHandler->addRight('extcal_cat_view', $cat->getVar('cat_id'), $perm->getVar('gperm_groupid'), $moduleId);
+ }
+ if ($perm->getVar('gperm_itemid') == 2
+ ) {
+ $groupPermissionHandler->addRight('extcal_cat_submit', $cat->getVar('cat_id'), $perm->getVar('gperm_groupid'), $moduleId);
+ }
+ if ($perm->getVar('gperm_itemid') == 4
+ ) {
+ $groupPermissionHandler->addRight('extcal_cat_autoapprove', $cat->getVar('cat_id'), $perm->getVar('gperm_groupid'), $moduleId);
+ }
+ if ($perm->getVar('gperm_itemid') == 8
+ ) {
+ $groupPermissionHandler->addRight('extcal_cat_edit', $cat->getVar('cat_id'), $perm->getVar('gperm_groupid'), $moduleId);
+ }
+ }
+
+ return true;
+ }
+
+ /**
+ * @param $catId
+ * @param $data
+ *
+ * @return bool
+ */
+ function modifyCat($catId, $data)
+ {
+ $cat = $this->get($catId);
+ $cat->setVars($data);
+
+ return $this->insert($cat);
+ }
+
+ /**
+ * @param $catId
+ */
+ function deleteCat($catId)
+ {
+ /* TODO :
+ - Delete all event in this category
+ */
+ $this->delete($catId);
+ }
+
+ // Return one cat selected by his id
+ /**
+ * @param $catId
+ * @param bool $skipPerm
+ *
+ * @return bool
+ */
+ function getCat($catId, $skipPerm = false)
+ {
+ $criteriaCompo = new CriteriaCompo();
+ $criteriaCompo->add(new Criteria('cat_id', $catId));
+ if (!$skipPerm) {
+ $this->_addCatPermCriteria($criteriaCompo, $GLOBALS['xoopsUser']);
+ }
+ $ret = $this->getObjects($criteriaCompo);
+ if (isset($ret[0])) {
+ return $ret[0];
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * @param $user
+ * @param string $perm
+ *
+ * @return array
+ */
+ function getAllCat($user, $perm = 'extcal_cat_view')
+ {
+ $criteriaCompo = new CriteriaCompo();
+ if ($perm != 'all') {
+ $this->_addCatPermCriteria($criteriaCompo, $user, $perm);
+ }
+
+ return $this->getObjects($criteriaCompo);
+ }
+
+ /**
+ * @param $user
+ * @param string $perm
+ *
+ * @return array
+ */
+ function getAllCatById($user, $perm = 'all')
+ {
+ $criteriaCompo = new CriteriaCompo();
+ if ($perm != 'all') {
+ $this->_addCatPermCriteria($criteriaCompo, $user, $perm);
+ }
+
+ $t = $this->objectToArray($this->getObjects($criteriaCompo));
+ $r = array();
+ while (list($k, $v) = each($t)) {
+ $r[$v['cat_id']] = $v;
+ }
+
+ return $r;
+ }
+
+ /**
+ * @param $criteria
+ * @param $user
+ * @param string $perm
+ */
+ function _addCatPermCriteria(&$criteria, &$user, $perm = 'extcal_cat_view')
+ {
+ $authorizedAccessCats = $this->_extcalPerm->getAuthorizedCat($user, 'extcal_cat_view');
+ $count = count($authorizedAccessCats);
+ if ($count > 0) {
+ $in = '(' . $authorizedAccessCats[0];
+ array_shift($authorizedAccessCats);
+ foreach (
+ $authorizedAccessCats as $authorizedAccessCat
+ ) {
+ $in .= ',' . $authorizedAccessCat;
+ }
+ $in .= ')';
+ $criteria->add(new Criteria('cat_id', $in, 'IN'));
+ } else {
+ $criteria->add(new Criteria('cat_id', '(0)', 'IN'));
+ }
+ }
+
+ /**
+ * @param $xoopsUser
+ *
+ * @return bool
+ */
+ function haveSubmitRight(&$xoopsUser)
+ {
+ return count($this->_extcalPerm->getAuthorizedCat($xoopsUser, 'extcal_cat_submit')) > 0;
+ }
+
+}
Modified: XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/extcal/class/config.php
===================================================================
--- XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/extcal/class/config.php 2015-01-12 12:30:54 UTC (rev 12935)
+++ XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/extcal/class/config.php 2015-01-16 10:54:08 UTC (rev 12936)
@@ -1,43 +1,43 @@
-<?php
-
-// defined("XOOPS_ROOT_PATH") || die("XOOPS root path not defined");
-
-/**
- * Class ExtcalConfig
- */
-class ExtcalConfig
-{
-
- /**
- * @return ExtcalConfig
- */
- static function &getHandler()
- {
- static $configHandler;
- if (!isset($configHandler[0])) {
- $configHandler[0] = new ExtcalConfig();
- }
-
- return $configHandler[0];
- }
-
- function getModuleConfig()
- {
- global $xoopsModule;
- static $moduleConfig;
- $dirname = (isset($xoopsModule) ? $xoopsModule->getVar('dirname') : 'system');
- if ($dirname == 'extcal') {
- $moduleConfig = $GLOBALS['xoopsModuleConfig'];
- } else {
- if (!isset($moduleConfig)) {
- $moduleHandler =& xoops_gethandler('module');
- $module = $moduleHandler->getByDirname('extcal');
- $configHandler =& xoops_gethandler('config');
- $moduleConfig = $configHandler->getConfigList($module->getVar("mid"));
- }
- }
-
- return $moduleConfig;
- }
-
-}
+<?php
+
+// defined("XOOPS_ROOT_PATH") || exit("XOOPS root path not defined");
+
+/**
+ * Class ExtcalConfig
+ */
+class ExtcalConfig
+{
+
+ /**
+ * @return ExtcalConfig
+ */
+ static function &getHandler()
+ {
+ static $configHandler;
+ if (!isset($configHandler[0])) {
+ $configHandler[0] = new ExtcalConfig();
+ }
+
+ return $configHandler[0];
+ }
+
+ function getModuleConfig()
+ {
+ global $xoopsModule;
+ static $moduleConfig;
+ $dirname = (isset($xoopsModule) ? $xoopsModule->getVar('dirname') : 'system');
+ if ($dirname == 'extcal') {
+ $moduleConfig = $GLOBALS['xoopsModuleConfig'];
+ } else {
+ if (!isset($moduleConfig)) {
+ $moduleHandler =& xoops_gethandler('module');
+ $module = $moduleHandler->getByDirname('extcal');
+ $configHandler =& xoops_gethandler('config');
+ $moduleConfig = $configHandler->getConfigList($module->getVar("mid"));
+ }
+ }
+
+ return $moduleConfig;
+ }
+
+}
Modified: XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/extcal/class/etablissement.php
===================================================================
--- XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/extcal/class/etablissement.php 2015-01-12 12:30:54 UTC (rev 12935)
+++ XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/extcal/class/etablissement.php 2015-01-16 10:54:08 UTC (rev 12936)
@@ -1,171 +1,171 @@
-<?php
-//Kraven 30
-// defined("XOOPS_ROOT_PATH") || die("XOOPS root path not defined");
-
-include_once XOOPS_ROOT_PATH . '/kernel/object.php';
-
-//class ExtcalEvent extends XoopsObject
-//class extcal_etablissement extends XoopsObject
-/**
- * Class ExtcalEtablissement
- */
-class ExtcalEtablissement extends XoopsObject
-{
- /**
- *
- */
- function __construct()
- {
- //Toutes les attributs de la table
- $this->initVar("id", XOBJ_DTYPE_INT, null, false, 5);
- $this->initVar("nom", XOBJ_DTYPE_TXTBOX, null, false);
- $this->initVar("description", XOBJ_DTYPE_TXTAREA, '', false);
- $this->initVar("logo", XOBJ_DTYPE_TXTBOX, null, false);
- $this->initVar("categorie", XOBJ_DTYPE_TXTBOX, null, false);
- $this->initVar("adresse", XOBJ_DTYPE_TXTBOX, null, false);
- $this->initVar("adresse2", XOBJ_DTYPE_TXTBOX, null, false);
- $this->initVar("cp", XOBJ_DTYPE_TXTBOX, null, false);
- $this->initVar("ville", XOBJ_DTYPE_TXTBOX, null, false);
- $this->initVar("tel_fixe", XOBJ_DTYPE_TXTBOX, null, false);
- $this->initVar("tel_portable", XOBJ_DTYPE_TXTBOX, null, false);
- $this->initVar("mail", XOBJ_DTYPE_TXTBOX, null, false);
- $this->initVar("site", XOBJ_DTYPE_TXTBOX, null, false);
- $this->initVar("horaires", XOBJ_DTYPE_TXTAREA, '', false);
- $this->initVar("divers", XOBJ_DTYPE_TXTBOX, null, false);
- $this->initVar("tarifs", XOBJ_DTYPE_TXTAREA, '', false);
- $this->initVar("map", XOBJ_DTYPE_URL, false);
- }
-
- function ExtcalEtablissement()
- {
- $this->__construct();
- }
-
- /**
- * @param bool $action
- *
- * @return XoopsThemeForm
- */
- function getForm($action = false)
- {
- global $xoopsDB, $extcalConfig;
-
- if ($action === false) {
- $action = $_SERVER["REQUEST_URI"];
- }
-
- $title = $this->isNew() ? sprintf(_MD_EXTCAL_ETABLISSEMENT_ADD) : sprintf(_MD_EXTCAL_ETABLISSEMENT_EDIT);
-
- include_once(XOOPS_ROOT_PATH . "/class/xoopsformloader.php");
-
- $form = new XoopsThemeForm($title, "form", $action, "post", true);
- $form->setExtra('enctype="multipart/form-data"');
-
- $form->addElement(new XoopsFormText(_MD_EXTCAL_ETABLISSEMENT_NOM, "nom", 50, 255, $this->getVar("nom")), true);
- $form->addElement(new XoopsFormDhtmlTextArea(_MD_EXTCAL_ETABLISSEMENT_DESCRIPTION, 'description', $this->getVar("description"), 10), false);
- $form->addElement(new XoopsFormText(_MD_EXTCAL_ETABLISSEMENT_CATEGORIE, "categorie", 40, 255, $this->getVar("categorie")), false);
- $form->addElement(new XoopsFormText(_MD_EXTCAL_ETABLISSEMENT_ADRESSE, "adresse", 50, 255, $this->getVar("adresse")), false);
- $form->addElement(new XoopsFormText(_MD_EXTCAL_ETABLISSEMENT_ADRESSE2, "adresse2", 50, 255, $this->getVar("adresse2")), false);
- $form->addElement(new XoopsFormText(_MD_EXTCAL_ETABLISSEMENT_CP, "cp", 10, 10, $this->getVar("cp")), false);
- $form->addElement(new XoopsFormText(_MD_EXTCAL_ETABLISSEMENT_VILLE, "ville", 20, 255, $this->getVar("ville")), false);
- $form->addElement(new XoopsFormText(_MD_EXTCAL_ETABLISSEMENT_TEL_FIXE, "tel_fixe", 20, 20, $this->getVar("tel_fixe")), false);
- $form->addElement(new XoopsFormText(_MD_EXTCAL_ETABLISSEMENT_TEL_PORTABLE, "tel_portable", 20, 20, $this->getVar("tel_portable")), false);
- $form->addElement(new XoopsFormText(_MD_EXTCAL_ETABLISSEMENT_MAIL, "mail", 50, 255, $this->getVar("mail")), false);
- $form->addElement(new XoopsFormText(_MD_EXTCAL_ETABLISSEMENT_SITE, "site", 50, 255, $this->getVar("site")), false);
- $form->addElement(new XoopsFormTextArea(_MD_EXTCAL_ETABLISSEMENT_HORAIRES, 'horaires', $this->getVar("horaires"), 3, 40));
- $form->addElement(new XoopsFormTextArea(_MD_EXTCAL_ETABLISSEMENT_DIVERS, 'divers', $this->getVar("divers"), 5, 40));
- //$form->addElement(new XoopsFormTextArea(_MD_EXTCAL_ETABLISSEMENT_TARIFS, 'tarifs', $this->getVar("tarifs"), 5, 40));
- $form->addElement(new XoopsFormText(_MD_EXTCAL_ETABLISSEMENT_TARIFS . ' ( ' . _MD_EXTCAL_DEVISE2 . ' )', "tarifs", 20, 20, $this->getVar("tarifs")), false);
-
- //$form->addElement(new XoopsFormTextArea(_MD_EXTCAL_ETABLISSEMENT_MAP, 'map', $this->getVar("map"), 5, 40));
- $form->addElement(new XoopsFormText(_MD_EXTCAL_ETABLISSEMENT_MAP, "map", 150, 255, $this->getVar("map")), false);
-
- //Logo
- $file_tray = new XoopsFormElementTray(sprintf(_MD_EXTCAL_FORM_IMG, 2), '');
- if ($this->getVar("logo") != '') {
- $file_tray->addElement(new XoopsFormLabel('', "<img src='" . XOOPS_URL . "/uploads/extcal/etablissement/" . $this->getVar("logo") . "' name='image' id='image' alt=''/><br /><br />"));
- $check_del_img = new XoopsFormCheckBox('', 'delimg');
- $check_del_img->addOption(1, _MD_EXTCAL_DEL_IMG);
- $file_tray->addElement($check_del_img);
- $file_img = new XoopsFormFile(_MD_EXTCAL_IMG, 'attachedimage', 3145728);
- unset($check_del_img);
- } else {
- $file_img = new XoopsFormFile('', 'attachedimage', 3145728);
- }
- $file_img->setExtra("size ='40'");
- $file_tray->addElement($file_img);
- $msg = sprintf(_MD_EXTCAL_IMG_CONFIG, intval(3145728 / 1000), 500, 500);
- $file_label = new XoopsFormLabel('', '<br />' . $msg);
- $file_tray->addElement($file_label);
- $form->addElement($file_tray);
- $form->addElement(new XoopsFormHidden('file', $this->getVar("logo")));
- unset($file_img);
- unset($file_tray);
-
- $form->addElement(new XoopsFormHidden("op", "save_etablissement"));
- $form->addElement(new XoopsFormButton("", "submit", _SUBMIT, "submit"));
- $form->display();
-
- return $form;
- }
-
-}
-
-/**************************************************************************/
-
-/**
- * Class ExtcalEtablissementHandler
- */
-class ExtcalEtablissementHandler extends ExtcalPersistableObjectHandler
-{
- /**
- * @param $db
- */
- function __construct(&$db)
- {
- parent::__construct($db, "extcal_etablissement", _EXTCAL_CLN_ETABLISSEMENT, "id", 'nom');
- }
-
- /**
- * @param $etablissementId
- * @param bool $skipPerm
- *
- * @return bool
- */
- function getEtablissement($etablissementId, $skipPerm = false)
- {
-
- $user = $GLOBALS['xoopsUser'];
-
- $criteriaCompo = new CriteriaCompo();
- $criteriaCompo->add(new Criteria('id', $etablissementId));
-
- if (!$skipPerm) {
- $this->_addCatPermCriteria($criteriaCompo, $user);
- }
- $ret = $this->getObjects($criteriaCompo);
- if (isset($ret[0])) {
- return $ret[0];
- } else {
- return false;
- }
- }
-
- /**
- * @param null $criteria
- * @param bool $asObject
- *
- * @return array
- */
- function getAll($criteria = null, $asObject = false)
- {
-
- $rst = $this->getObjects($criteria, $asObject);
- if ($asObject) {
- return $rst;
- } else {
- return $this->objectToArray($rst);
- }
- }
-
-}
+<?php
+//Kraven 30
+// defined("XOOPS_ROOT_PATH") || exit("XOOPS root path not defined");
+
+include_once XOOPS_ROOT_PATH . '/kernel/object.php';
+
+//class ExtcalEvent extends XoopsObject
+//class extcal_etablissement extends XoopsObject
+/**
+ * Class ExtcalEtablissement
+ */
+class ExtcalEtablissement extends XoopsObject
+{
+ /**
+ *
+ */
+ function __construct()
+ {
+ //Toutes les attributs de la table
+ $this->initVar("id", XOBJ_DTYPE_INT, null, false, 5);
+ $this->initVar("nom", XOBJ_DTYPE_TXTBOX, null, false);
+ $this->initVar("description", XOBJ_DTYPE_TXTAREA, '', false);
+ $this->initVar("logo", XOBJ_DTYPE_TXTBOX, null, false);
+ $this->initVar("categorie", XOBJ_DTYPE_TXTBOX, null, false);
+ $this->initVar("adresse", XOBJ_DTYPE_TXTBOX, null, false);
+ $this->initVar("adresse2", XOBJ_DTYPE_TXTBOX, null, false);
+ $this->initVar("cp", XOBJ_DTYPE_TXTBOX, null, false);
+ $this->initVar("ville", XOBJ_DTYPE_TXTBOX, null, false);
+ $this->initVar("tel_fixe", XOBJ_DTYPE_TXTBOX, null, false);
+ $this->initVar("tel_portable", XOBJ_DTYPE_TXTBOX, null, false);
+ $this->initVar("mail", XOBJ_DTYPE_TXTBOX, null, false);
+ $this->initVar("site", XOBJ_DTYPE_TXTBOX, null, false);
+ $this->initVar("horaires", XOBJ_DTYPE_TXTAREA, '', false);
+ $this->initVar("divers", XOBJ_DTYPE_TXTBOX, null, false);
+ $this->initVar("tarifs", XOBJ_DTYPE_TXTAREA, '', false);
+ $this->initVar("map", XOBJ_DTYPE_URL, false);
+ }
+
+ function ExtcalEtablissement()
+ {
+ $this->__construct();
+ }
+
+ /**
+ * @param bool $action
+ *
+ * @return XoopsThemeForm
+ */
+ function getForm($action = false)
+ {
+ global $xoopsDB, $extcalConfig;
+
+ if ($action === false) {
+ $action = $_SERVER["REQUEST_URI"];
+ }
+
+ $title = $this->isNew() ? sprintf(_MD_EXTCAL_ETABLISSEMENT_ADD) : sprintf(_MD_EXTCAL_ETABLISSEMENT_EDIT);
+
+ include_once(XOOPS_ROOT_PATH . "/class/xoopsformloader.php");
+
+ $form = new XoopsThemeForm($title, "form", $action, "post", true);
+ $form->setExtra('enctype="multipart/form-data"');
+
+ $form->addElement(new XoopsFormText(_MD_EXTCAL_ETABLISSEMENT_NOM, "nom", 50, 255, $this->getVar("nom")), true);
+ $form->addElement(new XoopsFormDhtmlTextArea(_MD_EXTCAL_ETABLISSEMENT_DESCRIPTION, 'description', $this->getVar("description"), 10), false);
+ $form->addElement(new XoopsFormText(_MD_EXTCAL_ETABLISSEMENT_CATEGORIE, "categorie", 40, 255, $this->getVar("categorie")), false);
+ $form->addElement(new XoopsFormText(_MD_EXTCAL_ETABLISSEMENT_ADRESSE, "adresse", 50, 255, $this->getVar("adresse")), false);
+ $form->addElement(new XoopsFormText(_MD_EXTCAL_ETABLISSEMENT_ADRESSE2, "adresse2", 50, 255, $this->getVar("adresse2")), false);
+ $form->addElement(new XoopsFormText(_MD_EXTCAL_ETABLISSEMENT_CP, "cp", 10, 10, $this->getVar("cp")), false);
+ $form->addElement(new XoopsFormText(_MD_EXTCAL_ETABLISSEMENT_VILLE, "ville", 20, 255, $this->getVar("ville")), false);
+ $form->addElement(new XoopsFormText(_MD_EXTCAL_ETABLISSEMENT_TEL_FIXE, "tel_fixe", 20, 20, $this->getVar("tel_fixe")), false);
+ $form->addElement(new XoopsFormText(_MD_EXTCAL_ETABLISSEMENT_TEL_PORTABLE, "tel_portable", 20, 20, $this->getVar("tel_portable")), false);
+ $form->addElement(new XoopsFormText(_MD_EXTCAL_ETABLISSEMENT_MAIL, "mail", 50, 255, $this->getVar("mail")), false);
+ $form->addElement(new XoopsFormText(_MD_EXTCAL_ETABLISSEMENT_SITE, "site", 50, 255, $this->getVar("site")), false);
+ $form->addElement(new XoopsFormTextArea(_MD_EXTCAL_ETABLISSEMENT_HORAIRES, 'horaires', $this->getVar("horaires"), 3, 40));
+ $form->addElement(new XoopsFormTextArea(_MD_EXTCAL_ETABLISSEMENT_DIVERS, 'divers', $this->getVar("divers"), 5, 40));
+ //$form->addElement(new XoopsFormTextArea(_MD_EXTCAL_ETABLISSEMENT_TARIFS, 'tarifs', $this->getVar("tarifs"), 5, 40));
+ $form->addElement(new XoopsFormText(_MD_EXTCAL_ETABLISSEMENT_TARIFS . ' ( ' . _MD_EXTCAL_DEVISE2 . ' )', "tarifs", 20, 20, $this->getVar("tarifs")), false);
+
+ //$form->addElement(new XoopsFormTextArea(_MD_EXTCAL_ETABLISSEMENT_MAP, 'map', $this->getVar("map"), 5, 40));
+ $form->addElement(new XoopsFormText(_MD_EXTCAL_ETABLISSEMENT_MAP, "map", 150, 255, $this->getVar("map")), false);
+
+ //Logo
+ $file_tray = new XoopsFormElementTray(sprintf(_MD_EXTCAL_FORM_IMG, 2), '');
+ if ($this->getVar("logo") != '') {
+ $file_tray->addElement(new XoopsFormLabel('', "<img src='" . XOOPS_URL . "/uploads/extcal/etablissement/" . $this->getVar("logo") . "' name='image' id='image' alt=''/><br /><br />"));
+ $check_del_img = new XoopsFormCheckBox('', 'delimg');
+ $check_del_img->addOption(1, _MD_EXTCAL_DEL_IMG);
+ $file_tray->addElement($check_del_img);
+ $file_img = new XoopsFormFile(_MD_EXTCAL_IMG, 'attachedimage', 3145728);
+ unset($check_del_img);
+ } else {
+ $file_img = new XoopsFormFile('', 'attachedimage', 3145728);
+ }
+ $file_img->setExtra("size ='40'");
+ $file_tray->addElement($file_img);
+ $msg = sprintf(_MD_EXTCAL_IMG_CONFIG, intval(3145728 / 1000), 500, 500);
+ $file_label = new XoopsFormLabel('', '<br />' . $msg);
+ $file_tray->addElement($file_label);
+ $form->addElement($file_tray);
+ $form->addElement(new XoopsFormHidden('file', $this->getVar("logo")));
+ unset($file_img);
+ unset($file_tray);
+
+ $form->addElement(new XoopsFormHidden("op", "save_etablissement"));
+ $form->addElement(new XoopsFormButton("", "submit", _SUBMIT, "submit"));
+ $form->display();
+
+ return $form;
+ }
+
+}
+
+/**************************************************************************/
+
+/**
+ * Class ExtcalEtablissementHandler
+ */
+class ExtcalEtablissementHandler extends ExtcalPersistableObjectHandler
+{
+ /**
+ * @param $db
+ */
+ function __construct(&$db)
+ {
+ parent::__construct($db, "extcal_etablissement", _EXTCAL_CLN_ETABLISSEMENT, "id", 'nom');
+ }
+
+ /**
+ * @param $etablissementId
+ * @param bool $skipPerm
+ *
+ * @return bool
+ */
+ function getEtablissement($etablissementId, $skipPerm = false)
+ {
+
+ $user = $GLOBALS['xoopsUser'];
+
+ $criteriaCompo = new CriteriaCompo();
+ $criteriaCompo->add(new Criteria('id', $etablissementId));
+
+ if (!$skipPerm) {
+ $this->_addCatPermCriteria($criteriaCompo, $user);
+ }
+ $ret = $this->getObjects($criteriaCompo);
+ if (isset($ret[0])) {
+ return $ret[0];
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * @param null $criteria
+ * @param bool $asObject
+ *
+ * @return array
+ */
+ function getAll($criteria = null, $asObject = false)
+ {
+
+ $rst = $this->getObjects($criteria, $asObject);
+ if ($asObject) {
+ return $rst;
+ } else {
+ return $this->objectToArray($rst);
+ }
+ }
+
+}
Modified: XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/extcal/class/event.php
===================================================================
--- XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/extcal/class/event.php 2015-01-12 12:30:54 UTC (rev 12935)
+++ XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/extcal/class/event.php 2015-01-16 10:54:08 UTC (rev 12936)
@@ -1,2862 +1,2862 @@
-<?php
-
-// defined("XOOPS_ROOT_PATH") || die("XOOPS root path not defined");
-
-include_once XOOPS_ROOT_PATH . '/modules/extcal/class/ExtcalPersistableObjectHandler.php';
-include_once XOOPS_ROOT_PATH . '/modules/extcal/class/perm.php';
-include_once XOOPS_ROOT_PATH . '/modules/extcal/class/time.php';
-include_once XOOPS_ROOT_PATH . '/modules/extcal/class/config.php';
-include_once XOOPS_ROOT_PATH . '/modules/extcal/class/extDateTime.php';
-
-include_once XOOPS_ROOT_PATH . '/modules/extcal/include/constantes.php';
-
-/**
- * Class ExtcalEvent
- */
-class ExtcalEvent extends XoopsObject
-{
-
- var $externalKey = array();
-
- /**
- *
- */
- function __construct()
- {
- $this->initVar('event_id', XOBJ_DTYPE_INT, null, false);
- $this->initVar('cat_id', XOBJ_DTYPE_INT, null, true);
- $this->initVar('event_title', XOBJ_DTYPE_TXTBOX, null, true, 255);
- $this->initVar('event_desc', XOBJ_DTYPE_TXTAREA, '', false);
- $this->initVar('event_organisateur', XOBJ_DTYPE_TXTBOX, '', false);
- $this->initVar('event_contact', XOBJ_DTYPE_TXTBOX, '', false);
- $this->initVar('event_url', XOBJ_DTYPE_URL, '', false);
- $this->initVar('event_email', XOBJ_DTYPE_TXTBOX, '', false);
- $this->initVar('event_address', XOBJ_DTYPE_TXTAREA, '', false);
- $this->initVar('event_approved', XOBJ_DTYPE_INT, 0, false);
- $this->initVar('event_start', XOBJ_DTYPE_INT, null, true);
- $this->initVar('event_end', XOBJ_DTYPE_INT, 0, false);
- $this->initVar('event_submitter', XOBJ_DTYPE_INT, 0, false);
- $this->initVar('event_submitdate', XOBJ_DTYPE_INT, 0, false);
- $this->initVar('event_nbmember', XOBJ_DTYPE_INT, 0, false);
- $this->initVar('event_isrecur', XOBJ_DTYPE_INT, 0, false);
- $this->initVar('event_recur_rules', XOBJ_DTYPE_TXTBOX, null, false);
- $this->initVar('event_recur_start', XOBJ_DTYPE_INT, 0, false);
- $this->initVar('event_recur_end', XOBJ_DTYPE_INT, 0, false);
- $this->initVar('dohtml', XOBJ_DTYPE_INT, 0, false);
- $this->initVar('event_picture1', XOBJ_DTYPE_TXTBOX, null, false);
- $this->initVar('event_picture2', XOBJ_DTYPE_TXTBOX, null, false);
- //$this->initVar("event_price",XOBJ_DTYPE_OTHER,null,false,10);
- $this->initVar('event_price', XOBJ_DTYPE_TXTBOX, '', false);
- $this->initVar('event_etablissement', XOBJ_DTYPE_INT, 5, false);
- $this->initVar('event_icone', XOBJ_DTYPE_TXTBOX, '', false);
-
- $this->externalKey['cat_id'] = array(
- 'className' => 'cat',
- 'getMethodeName' => 'getCat',
- 'keyName' => 'cat',
- 'core' => false
- );
- $this->externalKey['event_submitter'] = array(
- 'className' => 'user',
- 'getMethodeName' => 'get',
- 'keyName' => 'user',
- 'core' => true
- );
- }
-
- /**
- * @param $key
- *
- * @return mixed
- */
- function getExternalKey($key)
- {
- return $this->externalKey[$key];
- }
-
-}
-
-/**
- * Class ExtcalEventHandler
- */
-class ExtcalEventHandler extends ExtcalPersistableObjectHandler
-{
-
- private $_extcalPerm;
- private $_extcalTime;
- private $_extcalConfig;
-
- /**
- * @param $db
- */
- function __construct(&$db)
- {
- $this->_extcalPerm = ExtcalPerm::getHandler();
- $this->_extcalTime = ExtcalTime::getHandler();
- // $extcalConfig = ExtcalConfig::getHandler();
- // $this->_extcalConfig = $extcalConfig->getModuleConfig();
- parent::__construct($db, 'extcal_event', _EXTCAL_CLN_EVENT, 'event_id');
- }
-
- /**
- * @param $data
- *
- * @return bool
- */
- function createEvent($data)
- {
- $event = $this->create();
- $this->_checkDate($data);
- $this->_userTimeToServerTime($data);
- $this->_addRecurValue($data);
- $event->setVars($data);
-
- return $this->insert($event, true);
- }
-
- /**
- * @param $data
- *
- * @return object
- */
- function createEventForPreview($data)
- {
- $event = $this->create();
- $this->_checkDate($data);
- $this->_addRecurValue($data);
- $event->setVars($data);
-
- return $event;
- }
-
- /**
- * @param $eventId
- * @param $data
- *
- * @return bool
- */
- function modifyEvent($eventId, $data)
- {
- $event = $this->get($eventId);
- $this->_checkDate($data);
- $this->_userTimeToServerTime($data);
- $this->_addRecurValue($data);
- $event->setVars($data);
-
- return $this->insert($event);
- }
-
- /**
- * @param $eventId
- */
- function deleteEvent($eventId)
- {
- /* TODO :
- - Delete who's going
- - Delete who's not going
- - Delete comment
- - Delete notifications
- */
- $this->delete($eventId, true);
- }
-
- /**
- * @param null $criteria
- * @param bool $force
- * @param bool $asObject
- */
- function deleteAllEvents($criteria = null, $force = true, $asObject = false)
- {
- /* TODO :
- - Delete who's going
- - Delete who's not going
- - Delete comment
- - Delete notifications
- */
- $this->deleteAll($criteria, $force, $asObject);
- }
-
- /**
- * @param null $criteria
- * @param bool $asObject
- *
- * @return array
- */
- function getAllEvents($criteria = null, $asObject = false)
- {
-
- $rst = $this->getObjects($criteria, $asObject);
- if ($asObject) {
- return $rst;
- } else {
- return $this->objectToArray($rst);
- }
- }
-
- // Return one approved event selected by his id
- /**
- * @param $eventId
- * @param bool $skipPerm
- *
- * @return bool
- */
- function getEvent($eventId, $skipPerm = false)
- {
-
- $user = $GLOBALS['xoopsUser'];
-
- $criteriaCompo = new CriteriaCompo();
- $criteriaCompo->add(new Criteria('event_id', $eventId));
- $criteriaCompo->add(new Criteria('event_approved', 1));
- if (!$skipPerm) {
- $this->_addCatPermCriteria($criteriaCompo, $user);
- }
- $ret = $this->getObjects($criteriaCompo);
- if (isset($ret[0])) {
- return $ret[0];
- } else {
- return false;
- }
- }
-
- // Return one event selected by his id (approve or not)
- /**
- * @param $eventId
- * @param bool $skipPerm
- *
- * @return bool
- */
- function getEventWithNotApprove($eventId, $skipPerm = false)
- {
-
- $user = $GLOBALS['xoopsUser'];
-
- $criteriaCompo = new CriteriaCompo();
- $criteriaCompo->add(new Criteria('event_id', $eventId));
- if (!$skipPerm) {
- $this->_addCatPermCriteria($criteriaCompo, $user);
- }
- $ret = $this->getObjects($criteriaCompo);
- if (isset($ret[0])) {
- return $ret[0];
- } else {
- return false;
- }
- }
-
- /**
- * @param $events
- * @param $pattern
- */
- function formatEventsDate(&$events, $pattern)
- {
- $max = count($events);
- for (
- $i = 0; $i < $max; ++$i
- ) {
- $this->formatEventDate($events[$i], $pattern);
- }
- }
-
-// function getPicture1(&$event) {
-// return $event['event_picture1'];
-// }
-// function getPicture2(&$event) {
-// return $event['event_picture2'];
-// }
-// function getDesc(&$event) {
-// return $event['event_desc'];
-// }
-
- /**
- * @param $event
- * @param $pattern
- */
- function formatEventDate(&$event, $pattern)
- {
- if (!$event['event_isrecur']) {
- $event['formated_event_start'] = $this->_extcalTime->getFormatedDate($pattern, $event['event_start']);
- $event['formated_event_end'] = $this->_extcalTime->getFormatedDate($pattern, $event['event_end']);
- } else {
- $event['formated_event_start'] = $this->_extcalTime->getFormatedDate($pattern, $event['event_start']);
- $event['formated_event_end'] = $this->_extcalTime->getFormatedDate($pattern, $event['event_end']);
- $event['formated_reccur_rule'] = $this->_extcalTime->getFormatedReccurRule($event['event_recur_rules']);
- }
- $event['formated_event_submitdate'] = $this->_extcalTime->getFormatedDate($pattern, $event['event_submitdate']);
- }
-
-//JJD - to valid modif
-// function _checkDate(&$data)
-// {
-//
-// list($year, $month, $day) = explode("-", $data['event_start']['date']);
-// $data['event_start']
-// =
-// mktime(0, 0, 0, $month, $day, $year) + $data['event_start']['time'];
-// list($year, $month, $day) = explode("-", $data['event_end']['date']);
-// $data['event_end']
-// = mktime(0, 0, 0, $month, $day, $year) + $data['event_end']['time'];
-//
-// if ($data['have_end'] == 0 || $data['event_start'] > $data['event_end']
-//) {
-// $data['event_end'] = $data['event_start'];
-// }
-//
-// }
-
- /**
- * @param $data
- */
- function _checkDate(&$data)
- {
-
- $data['event_start'] = strtotime($data['event_start']['date']) + $data['event_start']['time'];
- $data['event_end'] = strtotime($data['event_end']['date']) + $data['event_end']['time'];
-
- if ($data['have_end'] == 0 || $data['event_start'] > $data['event_end']
- ) {
- $data['event_end'] = $data['event_start'];
- }
-
- }
-
- /**
- * @param $data
- */
- function _userTimeToServerTime(&$data)
- {
-
- $user = $GLOBALS['xoopsUser'];
-
- $data['event_start'] = userTimeToServerTime($data['event_start'], $this->_extcalTime->_getUserTimeZone($user));
- $data['event_end'] = userTimeToServerTime($data['event_end'], $this->_extcalTime->_getUserTimeZone($user));
-
- }
-
- /**
- * @param $data
- */
- function serverTimeToUserTime(&$data)
- {
-
- $user = $GLOBALS['xoopsUser'];
-
- $data['event_start'] = xoops_getUserTimestamp($data['event_start'], $this->_extcalTime->_getUserTimeZone($user));
- $data['event_end'] = xoops_getUserTimestamp($data['event_end'], $this->_extcalTime->_getUserTimeZone($user));
- $data['event_submitdate'] = xoops_getUserTimestamp($data['event_submitdate'], $this->_extcalTime->_getUserTimeZone($user));
-
- }
-
- /**
- * @param $events
- */
- function serverTimeToUserTimes(&$events)
- {
- $max = count($events);
-
- for (
- $i = 0; $i < $max; ++$i
- ) {
- $this->serverTimeToUserTime($events[$i]);
- }
- }
-
- /**
- * @param $data
- */
- function _addRecurValue(&$data)
- {
- $data['event_isrecur'] = $this->getIsRecur($_POST);
- $data['event_recur_rules'] = $this->getRecurRules($_POST);
- $data['event_recur_start'] = $this->getRecurStart($data, $_POST);
- $data['event_recur_end'] = $this->getRecurEnd($data, $_POST);
- }
-
- /***************************************************************
- * Return events on perioe
- **************************************************************
- *
- * @param $criteres
- *
- * @return array
- */
- function getEventsOnPeriode($criteres)
- {
- //ext_echoArray($criteres);
- global $extcalConfig;
- $myts =& MyTextSanitizer::getInstance(); // MyTextSanitizer object
-
- $eventsU = $this->getEventsUniques($criteres);
- $eventsR = $this->getEventsRecurents($criteres);
- $events = array_merge($eventsU, $eventsR);
-
- // $events = $eventsU;
-
- //ext_echoArray($events);
-
- //Tri des evennement par date ascendante
- $ordre = array();
- $eventArray = array();
-
- while (list($k, $v) = each($events)) {
- $ordre[] = intval($v['event_start']);
- $this->formatEventDate($v, $extcalConfig['event_date_week']);
- //$v['cat']['cat_light_color'] = $v['cat']['cat_color'];
- $v['cat']['cat_light_color'] = eclaircirCouleur($v['cat']['cat_color'], _EXTCAL_INFOBULLE_RGB_MIN, _EXTCAL_INFOBULLE_RGB_MAX);
- if ($v['event_icone'] == '') {
- $v['event_icone'] = $v['cat']['cat_icone'];
- }
- $v['event_desc'] = html_entity_decode($v['event_desc']);
- $eventArray[] = $v;
- }
- array_multisort($eventArray, SORT_ASC, SORT_NUMERIC, $ordre, SORT_ASC, SORT_NUMERIC);
-
- return $eventArray;
- }
-
- /*****************************************************************
- *
- ****************************************************************
- * @param $criteres
- * @return array
-*/
- function getEventsUniques($criteres)
- {
- global $extcalConfig;
- while (list($k, $v) = each($criteres)) {
- $$k = $v;
-
- }
- if (!isset($nbDays)) {
- $nbDays = 7;
- }
- if (!isset($sens)) {
- $sens = 'ASC';
- }
- if (!isset($externalKeys)) {
- $externalKeys = array('cat_id');
- }
- //------------------------------------------------------
- switch ($periode) {
-
- case _EXTCAL_EVENTS_CALENDAR_WEEK:
- $criteriaCompo = $this->_getEventWeekCriteria($day, $month, $year, $cat, $nbDays);
- if (!$extcalConfig['diplay_past_event_cal']) {
- $criteriaCompo->add(new Criteria('event_end', time(), '>'));
- }
- break;
-
- case _EXTCAL_EVENTS_WEEK:
- case _EXTCAL_EVENTS_AGENDA_WEEK:
- $criteriaCompo = $this->_getEventWeekCriteria($day, $month, $year, $cat, $nbDays);
- if (!$extcalConfig['diplay_past_event_list']) {
- $criteriaCompo->add(new Criteria('event_end', time(), '>'));
- }
- break;
-
- case _EXTCAL_EVENTS_CALENDAR_MONTH:
- $criteriaCompo = $this->_getEventMonthCriteria($month, $year, $cat);
-
- if (!$extcalConfig['diplay_past_event_cal']) {
- $criteriaCompo->add(new Criteria('event_end', time(), '>'));
- }
- break;
-
- case _EXTCAL_EVENTS_MONTH:
- $criteriaCompo = $this->_getEventMonthCriteria($month, $year, $cat);
-
- if (!$extcalConfig['diplay_past_event_list']) {
- $criteriaCompo->add(new Criteria('event_end', time(), '>'));
- }
- break;
-
- case _EXTCAL_EVENTS_DAY:
- $criteriaCompo = $this->_getEventDayCriteria($day, $month, $year, $cat);
-
- break;
-
- case _EXTCAL_EVENTS_YEAR:
- $criteriaCompo = $this->_getEventYearCriteria($year, $cat);
- break;
-
- case _EXTCAL_EVENTS_UPCOMING:
- $criteriaCompo = $this->_getEventWeekCriteria($day, $month, $year, $cat, $nbDays);
- break;
-
- }
- //--------------------------------------------------------------------------
- $criteriaCompo->add(new Criteria('event_isrecur', 0, '='));
- $criteriaCompo->setOrder($sens);
-
- $result = $this->getObjects($criteriaCompo);
- $events = $this->objectToArray($result, $externalKeys);
- $this->serverTimeToUserTimes($events);
-
- return $events;
-
- }
-
- /*****************************************************************
- * evennement récurents
- ****************************************************************
- * @param $criteres
- * @return array
-*/
-
- function getEventsRecurents($criteres)
- {
- global $extcalConfig;
-
- while (list($k, $v) = each($criteres)) {
- $$k = $v;
- }
- if (!isset($nbDays)) {
- $nbDays = 7;
- }
- if (!isset($sens)) {
- $sens = 'ASC';
- }
- if (!isset($externalKeys)) {
- $externalKeys = array('cat_id');
- }
- $user = $GLOBALS['xoopsUser'];
- //------------------------------------------------------
-
- $criteriaCompo = new CriteriaCompo();
-
- switch ($periode) {
- case _EXTCAL_EVENTS_WEEK:
- case _EXTCAL_EVENTS_CALENDAR_WEEK:
- case _EXTCAL_EVENTS_AGENDA_WEEK:
- case _EXTCAL_EVENTS_UPCOMING:
- $start = userTimeToServerTime(mktime(0, 0, 0, $month, $day, $year), $this->_extcalTime->_getUserTimeZone($user));
- $end = userTimeToServerTime(
- mktime(
- 0,
- 0,
- 0,
- $month,
- $day + $nbDays + 1,
- $year
- ),
- $this->_extcalTime->_getUserTimeZone($user)
- );
- //$end = $start + (($nbDays + 1 )* _EXTCAL_TS_DAY);
- //$end = userTimeToServerTime(mktime(0, 0, 0, $month, $day+(($nbJours)+1 * _EXTCAL_TS_DAY), $year), $this->_extcalTime->_getUserTimeZone($user));;
- break;
-
- case _EXTCAL_EVENTS_MONTH:
- case _EXTCAL_EVENTS_CALENDAR_MONTH:
- $start = userTimeToServerTime(mktime(0, 0, 0, $month, 1, $year), $this->_extcalTime->_getUserTimeZone($user));
- $end = userTimeToServerTime(
- mktime(23, 59, 59, $month + 1, 1, $year) - _EXTCAL_TS_DAY,
- $this->_extcalTime->_getUserTimeZone($user)
- );
-
- $criteriaCompo->add(new Criteria('event_start', $end, '<='));
- //$criteriaCompo->add(new Criteria('event_end', $start, '>='));
-
- break;
-
- case _EXTCAL_EVENTS_DAY:
- $start = userTimeToServerTime(mktime(0, 0, 0, $month, $day, $year), $this->_extcalTime->_getUserTimeZone($user));
- $end = userTimeToServerTime(
- mktime(
- 0,
- 0,
- 0,
- $month,
- $day + 1,
- $year
- ),
- $this->_extcalTime->_getUserTimeZone($user)
- );;
- //$criteriaCompo->add(new Criteria('event_start', $end, '<='));
-
- break;
-
- case _EXTCAL_EVENTS_YEAR:
- $start = userTimeToServerTime(mktime(0, 0, 0, 1, 1, $year), $this->_extcalTime->_getUserTimeZone($user));
- $end = userTimeToServerTime(mktime(0, 0, 0, 12, 31, $year), $this->_extcalTime->_getUserTimeZone($user));
- break;
-
- }
- $formatDate = $extcalConfig['event_date_week'];
- //--------------------------------------------------------------------------
- $criteriaCompo->add(new Criteria('event_isrecur', 1, '='));
- $criteriaCompo->setOrder($sens);
-
- $result = $this->getObjects($criteriaCompo);
- $events = $this->objectToArray($result, $externalKeys);
- $this->serverTimeToUserTimes($events);
-
- //Balyage de tous les evennements récurrents et creation de toutes le events
- $eventsR = array();
- while (list($k, $event) = each($events)) {
- //$te = $this->GetInterval($event, $start, $end);
- //$eventsR = array_merge($eventsR, $te);
- //echo 'event : ' . $event['event_id'] . '<br>';
- //ext_echoArray($event);
- $recurEvents = $this->getRecurEventToDisplay($event, $start, $end);
- if (count($recurEvents) > 0) {
- $eventsR = array_merge($eventsR, $recurEvents);
- }
-
- // Formating date
- //$eventsR = array_merge($eventsArray, $recurEvents);
-
- }
-
- return $eventsR;
-
- }
-
- /*****************************************************************
- *
- ****************************************************************
- * @param $period
- * @param string $caption
-*/
- function echoDateArray($period, $caption = '')
- {
- if ($caption != '') {
- echo "<hr>echoDateArray -> {$caption}<br>";
- } else {
- echo "<hr>echoDateArray<br>";
- }
-
- reset($period);
- foreach (
- $period as $dt
- ) {
- echo $dt->format("l d-m-Y H:i:s\n") . '<br>';
- }
-
- }
-
- /*****************************************************************
- * Criteria
- ****************************************************************
- * @param $day
- * @param $month
- * @param $year
- * @param int $cat
- * @return \CriteriaCompo
-*/
- // Return the criteria compo object for a day
- function _getEventDayCriteria($day, $month, $year, $cat = 0)
- {
-
- $user = $GLOBALS['xoopsUser'];
-
- $dayStart = userTimeToServerTime(mktime(0, 0, 0, $month, $day, $year), $this->_extcalTime->_getUserTimeZone($user));
- $dayEnd = userTimeToServerTime(mktime(23, 59, 59, $month, $day, $year), $this->_extcalTime->_getUserTimeZone($user));
- $criteriaCompo = $this->_getListCriteriaCompo($dayStart, $dayEnd, $cat, $user);
-
- return $criteriaCompo;
- }
-
- // Return the criteria compo object for a week
- /**
- * @param $day
- * @param $month
- * @param $year
- * @param $cat
- * @param int $nbDays
- *
- * @return CriteriaCompo
- */
- function _getEventWeekCriteria($day, $month, $year, $cat, $nbDays = 7)
- {
-
- $user = $GLOBALS['xoopsUser'];
-
- $userStartTime = mktime(0, 0, 0, $month, $day, $year);
- $userEndTime = $userStartTime + (_EXTCAL_TS_DAY * $nbDays);
- $weekStart = userTimeToServerTime($userStartTime, $this->_extcalTime->_getUserTimeZone($user));
- $weekEnd = userTimeToServerTime($userEndTime, $this->_extcalTime->_getUserTimeZone($user));
- $criteriaCompo = $this->_getCriteriaCompo($weekStart, $weekEnd, $cat, $user);
-
- ...
[truncated message content] |