Skip to content
Browse files

* first commit for feb242012.

* update for conf. xml
  • Loading branch information...
1 parent 989fbee commit 9c7b7c48677f6adfc6c7ebd22c422733377bd795 sdk_john committed Feb 24, 2012
View
2 class/admin/adminExecSave.php
@@ -8,7 +8,7 @@ protected function run($aArgs)
usbuilder()->init($this, $aArgs);
$sUrlSettings = usbuilder()->getUrl('adminPageSettings');
$oModel = common()->modelAdmin();
- $aResult = $oModel->execGetSettings();
+ $aResult = $oModel->execGetSettings($aArgs);
$bResult = false;
if($aResult)
View
20 class/admin/adminPageManage.php
@@ -0,0 +1,20 @@
+<?php
+
+require_once('builder/builderInterface.php');
+class adminPageManage extends Controller_Admin
+{
+ protected function run($aArgs)
+ {
+ usbuilder()->init($this, $aArgs);
+ usbuilder()->getAppInfo('seq');
+ $aOption = array(
+ 'module_name' => 'Google Calendar',
+ 'default_class' => 'adminPageSettings'
+ );
+
+ $sHtml = usbuilder()->helper('sequence')->get($aOption)->getManageUI();
+ $this->assign('manage_ui', $sHtml);
+
+ $this->view(__CLASS__);
+ }
+}
View
3 class/admin/adminPageSettings.php
@@ -15,11 +15,12 @@ protected function run($aArgs)
usbuilder()->getFormAction($this->_sPrefix . 'settings_form','adminExecSave');
usbuilder()->validator(array('form' => $this->_sPrefix . 'settings_form'));
- $aResult = common()->modelAdmin()->execGetSettings();
+ $aResult = common()->modelAdmin()->execGetSettings($aArgs);
$this->assign('sPrefix',$this->_sPrefix);
$this->assign('sImagePath',$this->_sImagePath);
/** for settings value.**/
+ $this->assign('iSequence',$aArgs['seq']);
$this->assign('iIdx',$aResult['idx']);
$this->assign('sFeedUrl',ltrim($aResult['feed_url']));
$this->assign('sStartDate',($aResult['ut_startdate'] > 0) ? $aResult['sdate'] : '' );
View
4 class/api/apiFrontCalendarData.php
@@ -12,8 +12,8 @@ public function post($aArgs)
$aEvent = array();
$oGcParser = new gcParser();
-
- $aResult = common()->modelFront()->execGetSettings();
+ $aArgs['seq'] = 1;
+ $aResult = common()->modelFront()->execGetSettings($aArgs);
$this->_sEndTime = $aResult['ut_enddate'];
$oGcParser->setMaxResult($aResult['max_event']);
$oGcParser->setStartTime($aResult['ut_startdate']);
View
4 class/front/frontPageGooglecalendar.php
@@ -10,8 +10,10 @@ protected function run($aArgs)
$sHtml = "";
usbuilder()->init($this, $aArgs);
$this->_sPrefix = $this->Request->getAppID() . '_';
+ $iSequence = $this->getSequence();
+
$this->_sImagePath = '/_sdk/img/' . $this->Request->getAppID() . '/';
- $sHtml .= "<div class='{$this->_sPrefix}wrapper' id='{$this->_sPrefix}content'></div><div class='event_details'></div>";
+ $sHtml .= "<div class='{$this->_sPrefix}wrapper' id='{$this->_sPrefix}content'></div><div class='event_details'></div><input type='hidden' value='$iSequence' id='{$this->_sPrefix}'>";
$this->importCss(__CLASS__);
$this->importJs('jquery.qtip-1.0.0-rc3.min');
View
9 class/install/installSequenceCreate.php
@@ -0,0 +1,9 @@
+<?php
+
+class installSequenceCreate
+{
+ public function run($aArgs)
+ {
+ return true;
+ }
+}
View
13 class/install/installSequenceDelete.php
@@ -0,0 +1,13 @@
+<?php
+class installSequenceDelete
+{
+ function run($aArgs)
+ {
+ $bResult = common()->modelAdmin()->deleteContentsBySeq($aArgs['seq']);
+ if ($bResult !== false) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+}
View
18 class/model/modelAdmin.php
@@ -5,7 +5,7 @@
class modelAdmin extends Model
{
- public function execGetSettings()
+ public function execGetSettings($aArgs)
{
$sSql = "SELECT *,
DATE_FORMAT(FROM_UNIXTIME(start_date),'%Y/%m/%d') as sdate,
@@ -14,16 +14,17 @@ public function execGetSettings()
DATE_FORMAT(FROM_UNIXTIME(end_date),'%H') as end_time,
start_date AS ut_startdate,
end_date AS ut_enddate
- FROM " . GOOGLECALENDAR_SETTINGS;
+ FROM " . GOOGLECALENDAR_SETTINGS . " WHERE seq = ". $aArgs['seq'];
return $this->query($sSql,'row');
}
public function execSave($aArgs)
{
$sSql = "INSERT INTO " . GOOGLECALENDAR_SETTINGS .
- "(feed_url,start_date,end_date,max_event,event_style,date_created)
+ "(seq,feed_url,start_date,end_date,max_event,event_style,date_created)
VALUES
(
+ {$aArgs['seq']},
'" .trim($aArgs['feed_url']) . "',
UNIX_TIMESTAMP('{$aArgs['start_date']} {$aArgs['start_time']}:00'),
UNIX_TIMESTAMP('{$aArgs['end_date']} {$aArgs['end_time']}:00'),
@@ -32,7 +33,6 @@ public function execSave($aArgs)
UNIX_TIMESTAMP(NOW())
)
";
- usbuilder()->vd($sSql);
return $this->query($sSql);
}
@@ -45,7 +45,17 @@ public function execUpdate($aArgs)
max_event = '{$aArgs['max_event']}',
event_style ='{$aArgs['event_style']}'
WHERE idx = {$aArgs['idx']}
+ AND seq = {$aArgs['seq']}
";
return $this->query($sSql);
}
+
+ public function deleteContentsBySeq($aSeq)
+ {
+ $sSeqs = implode(',', $aSeq);
+ $sQuery = "DELETE FROM " . GOOGLECALENDAR_SETTINGS . " WHERE seq in($sSeqs)";
+ $mResult = $this->query($sQuery);
+ return $mResult;
+ }
+
}
View
4 class/model/modelFront.php
@@ -6,7 +6,7 @@
class modelFront extends Model
{
- public function execGetSettings()
+ public function execGetSettings($aArgs)
{
$sSql = "SELECT *,
DATE_FORMAT(FROM_UNIXTIME(start_date),'%Y/%d/%m') as sdate,
@@ -15,7 +15,7 @@ public function execGetSettings()
DATE_FORMAT(FROM_UNIXTIME(end_date),'%H') as end_time,
start_date AS ut_startdate,
end_date AS ut_enddate
- FROM " . GOOGLECALENDAR_SETTINGS;
+ FROM " . GOOGLECALENDAR_SETTINGS . " WHERE seq = " . $aArgs['seq'] ;
return $this->query($sSql,'row');
}
}
View
4 conf/conf.admin.menu.xml
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<adminmenus>
- <menu name="Google Calendar" param="GooglecalendarPageSettings"/>
-</adminmenus>
+ <menu lang="googlecalendar" />
+</adminmenus>
View
4 conf/conf.admin.seqmenu.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<adminmenus>
+ <menu lang="menu_contents" param="GooglecalendarPageSettings" />
+</adminmenus>
View
12 install/install.sql
@@ -0,0 +1,12 @@
+CREATE TABLE IF NOT EXISTS `googlecalendar_settings` (
+ `idx` int(11) NOT NULL AUTO_INCREMENT,
+ `seq` int(11) NOT NULL,
+ `feed_url` blob ,
+ `start_date` int (11),
+ `end_date` int (11),
+ `max_event` varchar (270),
+ `event_style` blob ,
+ `date_created` int (90),
+ PRIMARY KEY (`idx`)
+);
+
View
1 install/uninstall.sql
@@ -0,0 +1 @@
+DROP TABLE IF EXISTS `googlecalendar_settings`;
View
9 resource/js/frontPageGooglecalendar.js
@@ -4,6 +4,7 @@ $(document).ready(function(){
var frontPageGooglecalendar = {
aLoopDate : [],
+ iSequence : 0,
init : function(iMonth,iYear){
var sCalendar = "";
var sEventInfo = "";
@@ -12,6 +13,8 @@ var frontPageGooglecalendar = {
var aDaysTitle = ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'];
var data;
+ var seq = $("#googlecalendar_sequence");
+ this.iSequence = seq.val();
$('.left,.right').css({'visibility':'hidden'});
$('.googlecalendar_event_count').qtip('hide');
var options = {
@@ -20,10 +23,12 @@ var frontPageGooglecalendar = {
type : 'post',
data : {
month : iMonth,
- year : iYear
+ year : iYear,
+ seq : frontPageGooglecalendar.iSequence
},success : function(server_response){
- data = server_response.Data;
+ data = server_response.Data;
+ console.log(data)
console.log(data.event_info);
today = data.today;
View
10 resource/lang/en/common.xml
@@ -1,5 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<lang>
- <var name="l.lang">Language</var>
- <var name="l.name">English</var>
-</lang>
+ <menu>
+ <var name="googlecalendar">Google Calendar</var>
+ <var name="menu_contents">Google Calendar Settings</var>
+ </menu>
+ <var name="lang">subject</var>
+ <var name="name">Subject</var>
+</lang>
View
1 resource/tpl/adminPageManage.tpl
@@ -0,0 +1 @@
+<?php echo $manage_ui; ?>
View
2 resource/tpl/adminPageSettings.tpl
@@ -1,7 +1,9 @@
<div id="sdk_message_box"></div>
<form method="post" name='<?php echo $sPrefix?>settings_form' class='<?php echo $sPrefix?>settings_form'>
+ <input type='hidden' id='seq' name='seq' value='<?php echo $iSequence;?>'>
<input type='hidden' id="idx" name='idx' value="<?php echo $iIdx;?>">
+
<p class="require"><span class="neccesary">*</span> Required</p>
<br />
<!-- input area -->

0 comments on commit 9c7b7c4

Please sign in to comment.
Something went wrong with that request. Please try again.