Jump to content

Kay1021

Members
  • Posts

    50
  • Joined

  • Last visited

    Never

Everything posted by Kay1021

  1. I'm wondering if anyone has any examples of how to make a pdf with my mysql data. I was trying to use FPDF or TCPDF....and i can't find any examples that can work. I want a table where: - the row heights grow to suit the cell with the largest text - the table header appears if a new page has to be created - table is filled with data from my database but the query statement has variables in it like "SELECT * FROM $tableName INNER JOIN category ON $tableName.cat_id = category.cat_id" Trying all the examples i have found....reading all their scripts...nothing works for me! Please help
  2. It's just in the .js page that i need to find what variable is for the result of the time the user has selected. If I have variable then everything will work with what i have....im just not sure what i am suppose to use.
  3. I am using this mootools time picker on my site http://www.consideropen.com/blog/2008/07/mootime-mootools-12-javascript-timepicker/#comment-5594...i already have a date picker...and i have it so once you have chosen the date and click outside the pop up calendar that the information will be sent to the database. I did this by using this bit of code in the javascript file var url = 'page.php?cat_ID=' + this.input.get('id') + '&date=' + this.input.get('value'); var request = new Request({ url:url, method:'POST'//, //onRequest: function() { // alert('making ajax call :: ' + url); //} }).send(); So it would send the variables I needed back to my page.php and there i could insert into the database. Works fine....but now i am attempting to do this with the time picker....this one is a little different set up....but i'm having trouble trying to find the right variables to use doesn't work and i can't find the right combination. I was hoping someone might be able to help me. Thanks
  4. Thanks but im trying to figure the best way to put them in my db
  5. I thought i was all set but now i've been faced with a problem and i'm not sure the best way to solve it. I have a table in my db with the columns cat_name and school In the admin section when you were assigning a school to a category i was using a drop down select having the option of all or choosing one particular school from a list. and when i wanted to show things depending on the school the user chose it would be WHERE school ='All' OR school=$school But now i need to modify it so that when you are assigning a school to a category that instead of a select list i need to have a multi select list....so you could choose all or any combination of schools I've never really used a multi select but i know it puts it into an array The question is what is the best way to put those into my database, and then be able to them in a statement like WHERE school ='All' OR school=$school thanks
  6. I'm wondering if someone might look over my code and see what i might have done wrong I'm trying to have three different select boxes along the top that allow you to choose a school, the month and the year. Then a table is outputted from those results with some javscript that when you check the checkbox, or choose a date, or add a comment that it's automatically added to the database. I've used this code and when I take out the whole choosing a school and it's just present for one school ...removing the $school =$_POST['school']; and such it works perfectly...but i need to be able to change schools Everytime you refresh the page the $school seems to be empty so it reverts to the default and doesn't save anything. I've tried everything i can think of and nothing will make the school not empty when you fresh....choosing schools from the drop down it does show the right schools and everything though Hopefully someone can help...thanks <?php //connect to database $school =$_POST['school']; //determine current school if empty if(empty($school)){ $school='school'; } $yr = $_POST['yr']; //determine current yr if empty if (empty($yr)) { $currYr = date('Y'); $currMonth= date('m'); if ($currMonth<=09 && $currMonth>=12){ $currYr2=date('Y')+1; $yr= $currYr."_". $currYr2; } else { $currYr2=date('Y')-1; $yr= $currYr2."_". $currYr; } } //change yr for looks $year = preg_replace('/_/', ' - ', $yr); //Set date language to french and determine month setlocale (LC_TIME, 'fr_FR'); $month = $_POST['month']; //determine current month if empty if(empty($month)){ $month = strftime ("%B"); $month = ucwords($month); } //creates table name $tableName = $school.$yr; //Updates database with content from editable textarea if(is_numeric($_GET['id']) && isset($_GET['comment'])) { $query = "UPDATE $tableName SET comment = '".mysql_real_escape_string(stripslashes($_GET['comment']))."' WHERE cat_id = ".(int)$_GET['id']; $result = mysql_query($query,$db_link) or die('Error: ' . mysql_error()); } //Updates database with content from checkbox if(isset($_GET['chkmark']) && isset($_GET['catID'])) { $chkmark = $_GET['chkmark']; $catID = $_GET['catID']; if ($chkmark == 'false'){ $chkmark='on'; } else { $chkmark='off'; } $query2 = "UPDATE $tableName SET confirm = '".$chkmark."' WHERE cat_id = ".$catID.""; $result2 = mysql_query($query2,$db_link) or die('Error: ' . mysql_error()); } //Updates database with content from datepicker if(isset($_GET['date']) && isset($_GET['cat_ID'])) { $date = $_GET['date']; $catID = $_GET['cat_ID']; $query2 = "UPDATE $tableName SET date = '".$date."' WHERE cat_id = ".$catID.""; $result2 = mysql_query($query2,$db_link) or die('Error: ' . mysql_error()); } /*--------------------------------------START MENU------------------------------------------------*/ echo ' <div id="centeredmenu"> <ul> <li class="selectBox"> <a> <form method="POST" action="schoolPageAdmin.php" name="form_sch"> <select name="school" value="Choose School" OnChange ="document.form_school.submit();"> <option value="'.$school.'">'.$school.'</option> <option value="'.$schoo2.'">'.$schoo2.'</option> <option value="'.$schoo3.'">'.$schoo3.'</option> <option value="'.$schoo4.'">'.$school4.'</option> <option value="'.$school5.'">'.$school5.'</option> </select> <input type="hidden" name="school" value='.$month.'> <input type="hidden" name="yr" value='.$yr.'> </form> </a> </li>'; $school=$_POST['school']; echo' <li class="selectBox"> <a> <form method="POST" action="schoolPageAdmin.php" name="form_mth"> <select name="month" value="Choose Month" OnChange ="document.form_mth.submit();"> <option value="'.$month.'">'.$month.'</option> <option value="Septembre">Septembre</option> <option value="Octobre">Octobre</option> <option value="Novembre">Novembre</option> <option value="D&#233;cembre">D&#233;cembre</option> <option value="Janvier">Janvier</option> <option value="F&#233;vrier">F&#233;vrier</option> <option value="Mars">Mars</option> <option value="Avril">Avril</option> <option value="Mai">Mai</option> <option value="Juin">Juin</option> </select> <input type="hidden" name="school" value='.$school.'> <input type="hidden" name="yr" value='.$yr.'> </form> </a> </li> <li class="selectBox"> <a> <form method="POST" action="schoolPageAdmin.php" name="form_yr">'; //--SELECT CATEGORIES FOR DROP DOWN $query3="SELECT year FROM years"; $result3 = mysql_query ($query3); echo'<select name="yr" value="Choose Year" OnChange ="document.form_yr.submit();"> '; echo "<option value='$yr'>$yr</option>"; while($nt3=mysql_fetch_array($result3)) { $yr= $nt3['year']; echo '<option value="'.$nt3[year].'">'.$yr.'</option>'; } echo'</select> <input type="hidden" name="month" value='.$month.'> <input type="hidden" name="school" value='.$school.'> </form> </a> </li>'; echo' </ul> </div>'; //TABLE OUTPUTS ?>
  7. cat_id is an int auto_incremented column it joins to another table that contains all the tasks so that it could be used in different tables so my task table is like cat_idcat_name 134Wash Dishes 135Mop Floor and then my other table say Dog looks like this (... means empty) cat_idconfirmdatecomment 134checked06/26/2009Lots of Dirty Dishes! 135......... Throughout all my coding I used the cat_id as a way to know where to save the information For example $query = "UPDATE Dog SET comment = '.$comment."' WHERE cat_id = ".$catID.""; So then i wouldn't be able to have the same tasks every year because i wouldn't be allowed to have duplicate cat_id's The date i'm currently getting from a mootools datepicker so the only thing im worried about is what if the user chooses a yr that isn't the current yr then wouldn't everything get messed up. And the date field is empty until the user chooses the date. Thanks for the help i really appreciate it
  8. sorry i guess i should have specified There are at least 150 but more could be added Basically what i'm creating is like a checklist....so there are 150 different tasks...but the admin can add more. right now the set up is these different columns cat_id - task - checked - date - comment so for every task there is going to be information saved in the checked , and date and comment. And i've been using the cat_id as a kind of way to know where to save the information but then when September comes around i need to reprint those categories...but now allow for new checked,date and comment information to be added but still have the option to go back and look at the previous yr(s) Hope that makes sense
  9. it's kind of a lot that's why i thought it would probably be easier just to make new tables
  10. I'm wondering if someone might be able to help me with some problem solving...i'm getting myself confused. i have tables in my database for example Dogs2009-2010 Cats2009-2010 Birds2009-2010 Now I'm trying to find a way that every September I can add new tables so now i would have Dogs2009-2010 Cats2009-2010 Birds2009-2010 Dogs2010-2011 Cats2010-2011 Birds2010-2011 But i'm getting confused on how I could go about knowing the year changed I know you can use date('Y') to tell the current year but how i compare to tell the year has changed and if it has create a new table my yr goes from Sept -June so right now the tables would have 2008-2009 Hope this makes sense Thanks Because then when calling them i could say Dog.$year Hopefully someone can help me out....maybe there is a better way to do this all together.
  11. i don't have it commented out in my code...i was just making a note
  12. ok my code does work...just not the refresh...i tested it updating my db and it does so when you close the box....however you have to manually refresh the page to see the results if i put the header code in there it doesn't do anything this is my code on the php page (view_category) if(isset($_GET['r'])) { //updating database works here //header("Location: view_category.php"); will not do anything } I can't find anything to work...i just want it to refresh
  13. Thanks that's what i thought i had to use...the header but it wasn't working I guess i just have to try a different approach. It's because i'm using like a lightbox thing...and i wanted the page to refresh after you closed the lightbox...i was using some script i had used other times...that would send a variable through the url in the js and then (in the other cases) i would GET and then update my database....i thought i could do the same thing just GET and then do the refresh if the terms were right. But it doesn't seem to be doing anything....i'll have to try something else thanks for the help
  14. I've been searching and everything i found was about a user clicking....or doing it after a certain period of time. like the meta tag has to go in the head tags so that doesn't help...i was hoping there was another way
  15. Is there a way that i refresh a page depending on circumstance. like if($refresh=='yes'){ //refresh page } thanks
  16. thanks phant0m...that fixed it....i knew it was something simple but i couldn't fix it. Thanks again!
  17. I'm wondering if someone might be able to help me out...i was trying to use squeezebox http://digitarald.de/project/squeezebox/1-1/showcase/iframed/and it works for some of the other types of elements but when i went to use the code for the iFrame content....if I copy it exactly i get an error: Usually i'd know how to fix that but with this bit of code i'm not sure how... echo'<a href="http://mootools.net" class="boxed" rel="{handler:'iframe',size:{x:840,y:550}}"> MooTools.net in a box! </a>'; any suggestions on how i might fix this? Thanks
  18. I'm not the best at javascript and I was wondering if someone might be able help me. I am using this mootools calendar http://www.monkeyphysics.com/mootools/script/2/datepickerand it works if I have a submit button. However for what I am doing I need to have it update to my database without a submit button. I was able to do this with a checkbox and comment box using this bit of code at different parts var url = 'schoolPage.php?catID=' + chk.inputElement.getProperty('id') + '&chk=' + chk.inputElement.getProperty('checked'); var request = new Request({ url:url, method:'POST', onRequest: function() { alert('making ajax call :: ' + url); } }).send(); However with this calendar im having trouble with where I might put this bit of code so that when the user selects a date it will be sent to the database. Any help would be greatly appreciated i'm losing my mind trying to figure it out! JS CODE /** * datepicker.js - MooTools Datepicker class * @version 1.12 * * by MonkeyPhysics.com * * Source/Documentation available at: * http://www.monkeyphysics.com/mootools/script/2/datepicker * * -- * * Smoothly animating, very configurable and easy to install. * No Ajax, pure Javascript. 4 skins available out of the box. * * -- * * Some Rights Reserved * http://creativecommons.org/licenses/by-sa/3.0/ * */ var DatePicker = new Class({ Implements: Options, // working date, which we will keep modifying to render the calendars d: '', // just so that we need not request it over and over today: '', // current user-choice in date object format choice: {}, // size of body, used to animate the sliding bodysize: {}, // to check availability of next/previous buttons limit: {}, // element references: attachTo: null, // selector for target inputs picker: null, // main datepicker container slider: null, // slider that contains both oldContents and newContents, used to animate between 2 different views oldContents: null, // used in animating from-view to new-view newContents: null, // used in animating from-view to new-view input: null, // original input element (used for input/output) visual: null, // visible input (used for rendering) options: { pickerClass: 'datepicker', days: ['Dimanche', 'Lundi', 'Mardi', 'Mercredi', 'Jeudi', 'Vendredi', 'Samedi'], months: ['Janvier', 'Fèvrier', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Août', 'Septembre', 'Octobre', 'Novembre', 'Dècembre'], dayShort: 2, monthShort: 3, startDay: 0, // Sunday (0) through Saturday (6) - be aware that this may affect your layout, since the days on the right might have a different margin timePicker: false, yearPicker: true, yearsPerPage: 20, format: 'd/m/Y', allowEmpty: false, inputOutputFormat: 'U', // default to unix timestamp animationDuration: 400, useFadeInOut: !Browser.Engine.trident, // dont animate fade-in/fade-out for IE startView: 'month', // allowed values: {time, month, year, decades} positionOffset: { x: 0, y: 0 }, minDate: null, // { date: '[date-string]', format: '[date-string-interpretation-format]' } maxDate: null, // same as minDate debug: false, toggleElements: null, // and some event hooks: onShow: $empty, // triggered when the datepicker pops up onClose: $empty, // triggered after the datepicker is closed (destroyed) onSelect: $empty // triggered when a date is selected }, initialize: function(attachTo, options) { this.attachTo = attachTo; this.setOptions(options).attach(); if ($chk(this.options.minDate)) this.options.minDate = this.unformat(this.options.minDate.date, this.options.minDate.format); if ($chk(this.options.maxDate)) this.options.maxDate = this.unformat(this.options.maxDate.date, this.options.maxDate.format); document.addEvent('mousedown', this.close.bind(this)); }, attach: function() { // toggle the datepicker through a separate element? if ($chk(this.options.toggleElements)) { var togglers = $$(this.options.toggleElements); document.addEvents({ 'keydown': function(e) { if (e.key == "tab") { this.close(null, true); } }.bind(this) }); }; // attach functionality to the inputs $$(this.attachTo).each(function(item, index) { // never double attach if (item.retrieve('datepicker')) return; // determine starting value(s) if ($chk(item.get('value'))) { var init_clone_val = this.format(new Date(this.unformat(item.get('value'), this.options.inputOutputFormat)), this.options.format); } else if (!this.options.allowEmpty) { var init_clone_val = this.format(new Date(), this.options.format); } else { var init_clone_val = ''; } // create clone var display = item.getStyle('display'); var clone = item .setStyle('display', this.options.debug ? display : 'none') .store('datepicker', true) // to prevent double attachment... .clone() .store('datepicker', true) // ...even for the clone (!) .removeProperty('name') // secure clean (form)submission .setStyle('display', display) .set('value', init_clone_val) .inject(item, 'after'); // events if ($chk(this.options.toggleElements)) { togglers[index] .setStyle('cursor', 'pointer') .addEvents({ 'click': function(e) { this.onFocus(item, clone); }.bind(this) }); clone.addEvents({ 'blur': function() { item.set('value', clone.get('value')); } }); } else { clone.addEvents({ 'keydown': function(e) { if (this.options.allowEmpty && (e.key == "delete" || e.key == "backspace")) { item.set('value', ''); e.target.set('value', ''); this.close(null, true); } else if (e.key == "tab") { this.close(null, true); } else { e.stop(); } }.bind(this), 'focus': function(e) { this.onFocus(item, clone); }.bind(this) }); } }.bind(this)); }, onFocus: function(original_input, visual_input) { var init_visual_date, d = visual_input.getCoordinates(); if ($chk(original_input.get('value'))) { init_visual_date = this.unformat(original_input.get('value'), this.options.inputOutputFormat).valueOf(); } else { init_visual_date = new Date(); } this.show({ left: d.left + this.options.positionOffset.x, top: d.top + d.height + this.options.positionOffset.y }, init_visual_date); this.input = original_input; this.visual = visual_input; this.options.onShow(); }, dateToObject: function(d) { return { year: d.getFullYear(), month: d.getMonth(), day: d.getDate(), hours: d.getHours(), minutes: d.getMinutes(), seconds: d.getSeconds() }; }, dateFromObject: function(values) { var d = new Date(); ['year', 'month', 'day', 'hours', 'minutes', 'seconds'].each(function(type) { var v = values[type]; if (!$chk(v)) return; switch (type) { case 'day': d.setDate(v); break; case 'month': d.setMonth(v); break; case 'year': d.setFullYear(v); break; case 'hours': d.setHours(v); break; case 'minutes': d.setMinutes(v); break; case 'seconds': d.setSeconds(v); break; } }); return d; }, show: function(position, timestamp) { if ($chk(timestamp)) { this.d = new Date(timestamp); } else { this.d = new Date(); } this.today = new Date(); this.choice = this.dateToObject(this.d); this.mode = (this.options.startView == 'time' && !this.options.timePicker) ? 'month' : this.options.startView; this.render(); this.picker.setStyles(position); }, render: function(fx) { if (!$chk(this.picker)) { this.constructPicker(); } else { // swap contents so we can fill the newContents again and animate var o = this.oldContents; this.oldContents = this.newContents; this.newContents = o; this.newContents.empty(); } // remember current working date var startDate = new Date(this.d.getTime()); // intially assume both left and right are allowed this.limit = { right: false, left: false }; // render! booty! if (this.mode == 'decades') { this.renderDecades(); } else if (this.mode == 'year') { this.renderYear(); } else if (this.mode == 'time') { this.renderTime(); this.limit = { right: true, left: true }; // no left/right in timeview } else { this.renderMonth(); } this.picker.getElement('.previous').setStyle('visibility', this.limit.left ? 'hidden' : 'visible'); this.picker.getElement('.next').setStyle('visibility', this.limit.right ? 'hidden' : 'visible'); this.picker.getElement('.titleText').setStyle('cursor', this.allowZoomOut() ? 'pointer' : 'default'); // restore working date this.d = startDate; // if ever the opacity is set to '0' it was only to have us fade it in here // refer to the constructPicker() function, which instantiates the picker at opacity 0 when fading is desired if (this.picker.getStyle('opacity') == 0) { this.picker.tween('opacity', 0, 1); } // animate if ($chk(fx)) this.fx(fx); }, fx: function(fx) { if (fx == 'right') { this.oldContents.setStyles({ left: 0, opacity: 1 }); this.newContents.setStyles({ left: this.bodysize.x, opacity: 1 }); this.slider.setStyle('left', 0).tween('left', 0, -this.bodysize.x); } else if (fx == 'left') { this.oldContents.setStyles({ left: this.bodysize.x, opacity: 1 }); this.newContents.setStyles({ left: 0, opacity: 1 }); this.slider.setStyle('left', -this.bodysize.x).tween('left', -this.bodysize.x, 0); } else if (fx == 'fade') { this.slider.setStyle('left', 0); this.oldContents.setStyle('left', 0).set('tween', { duration: this.options.animationDuration / 2 }).tween('opacity', 1, 0); this.newContents.setStyles({ opacity: 0, left: 0}).set('tween', { duration: this.options.animationDuration }).tween('opacity', 0, 1); } }, constructPicker: function() { this.picker = new Element('div', { 'class': this.options.pickerClass }).inject(document.body); if (this.options.useFadeInOut) { this.picker.setStyle('opacity', 0).set('tween', { duration: this.options.animationDuration }); } var h = new Element('div', { 'class': 'header' }).inject(this.picker); var titlecontainer = new Element('div', { 'class': 'title' }).inject(h); new Element('div', { 'class': 'previous' }).addEvent('click', this.previous.bind(this)).set('text', '«').inject(h); new Element('div', { 'class': 'next' }).addEvent('click', this.next.bind(this)).set('text', '»').inject(h); new Element('div', { 'class': 'closeButton' }).addEvent('click', this.close.bindWithEvent(this, true)).set('text', 'x').inject(h); new Element('span', { 'class': 'titleText' }).addEvent('click', this.zoomOut.bind(this)).inject(titlecontainer); var b = new Element('div', { 'class': 'body' }).inject(this.picker); this.bodysize = b.getSize(); this.slider = new Element('div', { styles: { position: 'absolute', top: 0, left: 0, width: 2 * this.bodysize.x, height: this.bodysize.y }}) .set('tween', { duration: this.options.animationDuration, transition: Fx.Transitions.Quad.easeInOut }).inject(b); this.oldContents = new Element('div', { styles: { position: 'absolute', top: 0, left: this.bodysize.x, width: this.bodysize.x, height: this.bodysize.y }}).inject(this.slider); this.newContents = new Element('div', { styles: { position: 'absolute', top: 0, left: 0, width: this.bodysize.x, height: this.bodysize.y }}).inject(this.slider); }, renderTime: function() { var container = new Element('div', { 'class': 'time' }).inject(this.newContents); this.picker.getElement('.titleText').set('text', this.format(this.d, 'j M, Y')); new Element('input', { type: 'text', 'class': 'hour' }) .set('value', this.leadZero(this.d.getHours())) .addEvents({ mousewheel: function(e) { var i = e.target; i.focus(); if (e.wheel > 0) { if (i.get('value').toInt() < 23) i.set('value', this.leadZero(i.get('value').toInt() + 1)); } else { if (i.get('value').toInt() > 0) i.set('value', this.leadZero(i.get('value').toInt() -1)); } e.stop(); }.bind(this) }) .set('maxlength', 2) .inject(container); new Element('input', { type: 'text', 'class': 'minutes' }) .set('value', this.leadZero(this.d.getMinutes())) .addEvents({ mousewheel: function(e) { var i = e.target; i.focus(); if (e.wheel > 0) { if (i.get('value').toInt() < 59) i.set('value', this.leadZero(i.get('value').toInt() + 1)); } else { if (i.get('value').toInt() > 0) i.set('value', this.leadZero(i.get('value').toInt() -1)); } e.stop(); }.bind(this) }) .set('maxlength', 2) .inject(container); new Element('div', { 'class': 'separator' }).set('text', ':').inject(container); new Element('input', { type: 'submit', value: 'OK', 'class': 'ok' }) .addEvents({ click: function(e) { e.stop(); this.select($merge(this.dateToObject(this.d), { hours: this.picker.getElement('.hour').get('value').toInt(), minutes: this.picker.getElement('.minutes').get('value').toInt() })); }.bind(this) }) .set('maxlength', 2) .inject(container); }, renderMonth: function() { var month = this.d.getMonth(); this.picker.getElement('.titleText').set('text', this.options.months[month] + ' ' + this.d.getFullYear()); this.d.setDate(1); while (this.d.getDay() != this.options.startDay) { this.d.setDate(this.d.getDate() - 1); } var container = new Element('div', { 'class': 'days' }).inject(this.newContents); var titles = new Element('div', { 'class': 'titles' }).inject(container); var d, i, classes, e, weekcontainer; for (d = this.options.startDay; d < (this.options.startDay + 7); d++) { new Element('div', { 'class': 'title day day' + (d % 7) }).set('text', this.options.days[(d % 7)].substring(0,this.options.dayShort)).inject(titles); } var available = false; var t = this.today.toDateString(); var currentChoice = this.dateFromObject(this.choice).toDateString(); for (i = 0; i < 42; i++) { classes = []; classes.push('day'); classes.push('day'+this.d.getDay()); if (this.d.toDateString() == t) classes.push('today'); if (this.d.toDateString() == currentChoice) classes.push('selected'); if (this.d.getMonth() != month) classes.push('otherMonth'); if (i % 7 == 0) { weekcontainer = new Element('div', { 'class': 'week week'+(Math.floor(i/7)) }).inject(container); } e = new Element('div', { 'class': classes.join(' ') }).set('text', this.d.getDate()).inject(weekcontainer); if (this.limited('date')) { e.addClass('unavailable'); if (this.d.getMonth() == month) { if (available) { this.limit.right = true; } else { this.limit.left = true; } } } else { available = true; e.addEvent('click', function(e, d) { if (this.options.timePicker) { this.d.setDate(d.day); this.d.setMonth(d.month); this.mode = 'time'; this.render('fade'); } else { this.select(d); } }.bindWithEvent(this, { day: this.d.getDate(), month: this.d.getMonth(), year: this.d.getFullYear() })); } this.d.setDate(this.d.getDate() + 1); } if (!available) this.limit.right = true; }, renderYear: function() { var month = this.today.getMonth(); var thisyear = this.d.getFullYear() == this.today.getFullYear(); var selectedyear = this.d.getFullYear() == this.choice.year; this.picker.getElement('.titleText').set('text', this.d.getFullYear()); this.d.setMonth(0); var i, e; var available = false; var container = new Element('div', { 'class': 'months' }).inject(this.newContents); for (i = 0; i <= 11; i++) { e = new Element('div', { 'class': 'month month'+(i+1)+(i == month && thisyear ? ' today' : '')+(i == this.choice.month && selectedyear ? ' selected' : '') }) .set('text', this.options.monthShort ? this.options.months[i].substring(0, this.options.monthShort) : this.options.months[i]).inject(container); if (this.limited('month')) { e.addClass('unavailable'); if (available) { this.limit.right = true; } else { this.limit.left = true; } } else { available = true; e.addEvent('click', function(e, d) { this.d.setMonth(d); this.mode = 'month'; this.render('fade'); }.bindWithEvent(this, this.d.getMonth())); } this.d.setMonth(this.d.getMonth() + 1); } if (!available) this.limit.right = true; }, renderDecades: function() { // start neatly at interval (eg. 1980 instead of 1987) while (this.d.getFullYear() % this.options.yearsPerPage > 0) { this.d.setFullYear(this.d.getFullYear() - 1); } this.picker.getElement('.titleText').set('text', this.d.getFullYear() + '-' + (this.d.getFullYear() + this.options.yearsPerPage - 1)); var i, y, e; var available = false; var container = new Element('div', { 'class': 'years' }).inject(this.newContents); for (i = 0; i < this.options.yearsPerPage; i++) { y = this.d.getFullYear(); e = new Element('div', { 'class': 'year year' + i + (y == this.today.getFullYear() ? ' today' : '') + (y == this.choice.year ? ' selected' : '') }).set('text', y).inject(container); if (this.limited('year')) { e.addClass('unavailable'); if (available) { this.limit.right = true; } else { this.limit.left = true; } } else { available = true; e.addEvent('click', function(e, d) { this.d.setFullYear(d); this.mode = 'year'; this.render('fade'); }.bindWithEvent(this, y)); } this.d.setFullYear(this.d.getFullYear() + 1); } if (!available) this.limit.right = true; }, limited: function(type) { var cs = $chk(this.options.minDate); var ce = $chk(this.options.maxDate); if (!cs && !ce) return false; switch (type) { case 'year': return (cs && this.d.getFullYear() < this.options.minDate.getFullYear()) || (ce && this.d.getFullYear() > this.options.maxDate.getFullYear()); case 'month': // todo: there has got to be an easier way...? var ms = ('' + this.d.getFullYear() + this.leadZero(this.d.getMonth())).toInt(); return cs && ms < ('' + this.options.minDate.getFullYear() + this.leadZero(this.options.minDate.getMonth())).toInt() || ce && ms > ('' + this.options.maxDate.getFullYear() + this.leadZero(this.options.maxDate.getMonth())).toInt() case 'date': return (cs && this.d < this.options.minDate) || (ce && this.d > this.options.maxDate); } }, allowZoomOut: function() { if (this.mode == 'decades') return false; if (this.mode == 'year' && !this.options.yearPicker) return false; return true; }, zoomOut: function() { if (!this.allowZoomOut()) return; if (this.mode == 'year') { this.mode = 'decades'; } else if (this.mode == 'time') { this.mode = 'month'; } else { this.mode = 'year'; } this.render('fade'); }, previous: function() { if (this.mode == 'decades') { this.d.setFullYear(this.d.getFullYear() - this.options.yearsPerPage); } else if (this.mode == 'year') { this.d.setFullYear(this.d.getFullYear() - 1); } else if (this.mode == 'month') { this.d.setMonth(this.d.getMonth() - 1); } this.render('left'); }, next: function() { if (this.mode == 'decades') { this.d.setFullYear(this.d.getFullYear() + this.options.yearsPerPage); } else if (this.mode == 'year') { this.d.setFullYear(this.d.getFullYear() + 1); } else if (this.mode == 'month') { this.d.setMonth(this.d.getMonth() + 1); } this.render('right'); }, close: function(e, force) { if (!$(this.picker)) return; var clickOutside = ($chk(e) && e.target != this.picker && !this.picker.hasChild(e.target) && e.target != this.visual); if (force || clickOutside) { if (this.options.useFadeInOut) { this.picker.set('tween', { duration: this.options.animationDuration / 2, onComplete: this.destroy.bind(this) }).tween('opacity', 1, 0); } else { this.destroy(); } } }, destroy: function() { this.picker.destroy(); this.picker = null; this.options.onClose(); }, select: function(values) { this.choice = $merge(this.choice, values); var d = this.dateFromObject(this.choice); this.input.set('value', this.format(d, this.options.inputOutputFormat)); this.visual.set('value', this.format(d, this.options.format)); this.options.onSelect(); this.close(null, true); }, leadZero: function(v) { return v < 10 ? '0'+v : v; }, format: function(t, format) { var f = ''; var h = t.getHours(); var m = t.getMonth(); for (var i = 0; i < format.length; i++) { switch(format.charAt(i)) { case '\\': i++; f+= format.charAt(i); break; case 'y': f += (100 + t.getYear() + '').substring(1); break case 'Y': f += t.getFullYear(); break; case 'm': f += this.leadZero(m + 1); break; case 'n': f += (m + 1); break; case 'M': f += this.options.months[m].substring(0,this.options.monthShort); break; case 'F': f += this.options.months[m]; break; case 'd': f += this.leadZero(t.getDate()); break; case 'j': f += t.getDate(); break; case 'D': f += this.options.days[t.getDay()].substring(0,this.options.dayShort); break; case 'l': f += this.options.days[t.getDay()]; break; case 'G': f += h; break; case 'H': f += this.leadZero(h); break; case 'g': f += (h % 12 ? h % 12 : 12); break; case 'h': f += this.leadZero(h % 12 ? h % 12 : 12); break; case 'a': f += (h > 11 ? 'pm' : 'am'); break; case 'A': f += (h > 11 ? 'PM' : 'AM'); break; case 'i': f += this.leadZero(t.getMinutes()); break; case 's': f += this.leadZero(t.getSeconds()); break; case 'U': f += Math.floor(t.valueOf() / 1000); break; default: f += format.charAt(i); } } return f; }, unformat: function(t, format) { var d = new Date(); var a = {}; var c, m; for (var i = 0; i < format.length; i++) { c = format.charAt(i); switch(c) { case '\\': r = null; i++; break; case 'y': r = '[0-9]{2}'; break; case 'Y': r = '[0-9]{4}'; break; case 'm': r = '0[1-9]|1[012]'; break; case 'n': r = '[1-9]|1[012]'; break; case 'M': r = '[A-Za-z]{'+this.options.monthShort+'}'; break; case 'F': r = '[A-Za-z]+'; break; case 'd': r = '0[1-9]|[12][0-9]|3[01]'; break; case 'j': r = '[1-9]|[12][0-9]|3[01]'; break; case 'D': r = '[A-Za-z]{'+this.options.dayShort+'}'; break; case 'l': r = '[A-Za-z]+'; break; case 'G': case 'H': case 'g': case 'h': r = '[0-9]{1,2}'; break; case 'a': r = '(am|pm)'; break; case 'A': r = '(AM|PM)'; break; case 'i': case 's': r = '[012345][0-9]'; break; case 'U': r = '-?[0-9]+$'; break; default: r = null; } if ($chk(r)) { m = t.match('^'+r); if ($chk(m)) { a[c] = m[0]; t = t.substring(a[c].length); } else { if (this.options.debug) alert("Fatal Error in DatePicker\n\nUnexpected format at: '"+t+"' expected format character '"+c+"' (pattern '"+r+"')"); return d; } } else { t = t.substring(1); } } for (c in a) { var v = a[c]; switch(c) { case 'y': d.setFullYear(v < 30 ? 2000 + v.toInt() : 1900 + v.toInt()); break; // assume between 1930 - 2029 case 'Y': d.setFullYear(v); break; case 'm': case 'n': d.setMonth(v - 1); break; // FALL THROUGH NOTICE! "M" has no break, because "v" now is the full month (eg. 'February'), which will work with the next format "F": case 'M': v = this.options.months.filter(function(item, index) { return item.substring(0,this.options.monthShort) == v }.bind(this))[0]; case 'F': d.setMonth(this.options.months.indexOf(v)); break; case 'd': case 'j': d.setDate(v); break; case 'G': case 'H': d.setHours(v); break; case 'g': case 'h': if (a['a'] == 'pm' || a['A'] == 'PM') { d.setHours(v == 12 ? 0 : v.toInt() + 12); } else { d.setHours(v); } break; case 'i': d.setMinutes(v); break; case 's': d.setSeconds(v); break; case 'U': d = new Date(v.toInt() * 1000); } }; return d; } }); Thanks
  19. Yes i tried writing it like that and it gets rid of the styles which is the whole point of using the fancy form checkbox. Plus it doesn't do anything anyways...no alert pops up like its suppose to. That's why i thought maybe i was writing it wrong....or there was another way to do it.
  20. I'm kinda a newbie to Javascript but i have seemed to figure out one part of what i am trying to do and need help with the second part. What i am trying to do is this checkbox that has a style from here http://lipidity.com/fancy-form/. But what i wanted was that once you click select or deselect the checkbox that it is automatically updated to the database. I was already doing something like this with a textarea and i finally figured out how to get it to work with my checkbox. I used part of the help the site gave.. FancyForm.start( 0, { onSelect: function(chk){ alert(chk.inputElement.getProperty('name')); } }); and rearranged it and used some of my other code and got it to actually work for what i need. My code: FancyForm.start(0, { onSelect: function(chk) { var url = 'schoolPage.php?catID=' + chk.inputElement.getProperty('id') + '&chk=' + chk.inputElement.getProperty('checked'); var request = new Request({ url:url, method:'POST', onRequest: function() { alert('making sure it works:: ' + url); } }).send(); } }); so that works ....and if change it to onDeselect it works....when you uncheck a box....however i some how need them both in there....and so when you select or deselect the box that it will send the info. Being new to javascript I just can figure out the proper way to do this...if just put both things get messed up and what not. Could someone please help me out?
  21. Is there a way to send the info of a checkbox without submitting a form. I am using an editable text section as well (mootools) and after you click outside it sends the information to the database...i'm wondering if I can do the same with my checkbox. When they click it...the result is sent to the database. I am using this checkbox... http://lipidity.com/fancy-form/ Thanks
  22. opps forgot to put the link http://dev.base86.com/scripts/vista-like_ajax_calendar_version_2.html
  23. I feel like a total noob. But i'm really not understanding this. I'm trying to use a date picker to be in a form. I have a table that looks like this datecomment datecomment datecomment I am using this line of code <input class="datepick" id="datepicker" name="date" type="text" /> every row is connected to an id. Right now i have it so that the calendar does show up. But then i'm lost on how you take the results of what the user has selected so that you save it into the database. I've read over the site a million times and i've looked at the example in the download package...every thing just shows me how to make the calendar show up. But nothing tells me how i obtain that info or how to use it. Maybe i'm missing something completely. I would greatly appreciate if anyone could help me out. Thanks.
  24. Hey has anyone ever used this fancy form mootools check box : http://lipidity.com/fancy-form I was trying to implement into my php but i'm having a little difficulty and it doesn't really give me too many instructions. Could anyone help me with how to set this up i know in the form i think it's just <input type="checkbox">Blah blah blah</input> but then i'm not sure what variable and such i'm suppose to use to know whether it's been checked or not. Thanks
  25. Thanks it was the GET. I was following the example but when i changed all the POST to GET in the php section it immediately worked! Thanks If you know anything about javascript....I wonder if you can help with one other portion. When you double click it lets you edit perfectly...but if you were to click again it puts <textarea></textarea> kinda stuff in it....is there any piece of good to prevent this. Thanks
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.