phpScheduleIt
May 23, 2013, 12:01:58 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: phpScheduleIt 2.4.2 has been released!
 
   Home   Help Login Register  
Pages: [1]
  Print  
Author Topic: export based on resource  (Read 4323 times)
seankoo
Jr. Member
**

Karma: 0
Posts: 55


« on: December 15, 2006, 02:34:46 PM »

Hi Nick,

I am trying to export to ical/vcal based on the resource.  Currently, I am able to pull export based on my reservation only.
As an administrator, I want to pull all the reservations who made a schedule with me.
Could you please help me to give me some direction where I can add the feature in sql side?

Thank you!!
Logged
Nick
Administrator
Hero Member
*****

Karma: 15
Posts: 5419


WWW
« Reply #1 on: December 17, 2006, 10:53:48 PM »

This wouldn't be too hard if you know a bit of PHP.  Basically, you'll want add a checkbox or something to exports.template.php, modify the exportSearch() function in functions.js to read your new setting, then modify exports/ical.php (and the other files that are used from there) to pull all reservations that you want.

This sounds like it would be a nice feature to have in a future version.  I'll add it to the list.
Logged
barh0002
Jr. Member
**

Karma: 0
Posts: 63


« Reply #2 on: February 23, 2007, 09:45:02 PM »

Hey Nick:

This would be a very useful feature for me too.  In the meantime I have been trying to do this by adding certain text identifiers inthe summary box and then going to do a reservation search using those text identifiers.  

Problem is that this might leave out instances where my search term didn't pull up misstypes or neglected text identifiers.  So, if there a hack that you know of that could help me add the summary field to the search results?
Logged
Nick
Administrator
Hero Member
*****

Karma: 15
Posts: 5419


WWW
« Reply #3 on: February 26, 2007, 10:02:50 AM »

Change line 211 of usage.php to:

Code:
print_reservation_data($type, $link, $resNo++, $start_date, $end_date, $created, $modified, $starttime, $endtime, $totTime, $rs['resid'], $rs['fname'], $rs['lname'], $rs['name'], $rs['memberid'], $rs['scheduletitle'], $rs['summary']);


Line 452 of templates/usage.template.php to:
Code:

function print_reservation_data($type, &$link, $resNo, $start_date, $end_date, $created, $modified, $starttime, $endtime, $totTime, $resid, $fname, $lname, $name, $memberid, $schedule, $summary) {


Then just change that function to print out $summary wherever you want.
Logged
barh0002
Jr. Member
**

Karma: 0
Posts: 63


« Reply #4 on: February 27, 2007, 11:54:20 AM »

Will give it a try this weekend and tell you how it works...
Logged
barh0002
Jr. Member
**

Karma: 0
Posts: 63


« Reply #5 on: March 01, 2007, 11:55:04 PM »

Made the changes you suggested above. Then changed the HTML and XML output in templates/usage.template so that it would display the summary text.

For HTML Changed lines 368-380 to:
Code:
<tr class="rowHeaders" align="center">
        <td width="4%">#</td>
        <td width="9%"><?php echo translate&#40;'Start Date'&#41;?></td>
<td width="9%"><?php echo translate&#40;'End Date'&#41;?></td>
        <td width="19%"><?php echo translate&#40;'Created'&#41;?></td>
        <td width="19%"><?php echo translate&#40;'Last Modified'&#41;?></td>
        <td width="8%"><?php echo translate&#40;'Start Time'&#41;?></td>
        <td width="8%"><?php echo translate&#40;'End Time'&#41;?></td>
        <td width="8%"><?php echo translate&#40;'Manage'&#41;?></td>
        [color=red]<td width="8%"><?php echo translate&#40;'Summary'&#41;?></td>[/color]
<td width="8%"><?php echo translate&#40;'Total Time'&#41;?></td>

  </tr>


Then changes the print function to:

Code:
. '<td>' . $resNo . "</td>\n"
. '<td>' . $start_date . "</td>\n"
. '<td>' . $end_date . "</td>\n"
. '<td>' . $created . "</td>\n"
. '<td>' . $modified . "</td>\n"
. '<td>' . $starttime . "</td>\n"
. '<td>' . $endtime . "</td>\n"
. '<td>' . $link->getLink("javascript: reserve('m','','','" . $resid. "');", translate('Edit'), '', '', translate('Edit this reservation')) . "</td>\n"
[color=red]. '<td>' . $summary . "</td>\n"[/color]
. '<td>' . $totTime . "</td>\n</tr>\n";


For XML added:
Code:

. "\t&lt;summary&gt;$summary&lt;/summary&gt;\r\n"


That worked great with one kinda biggish problem - the summary text that it prints is actually the schedule name and not the summary text from the reservation....

Also when I view the HTML printout and click on the "Edit" link (. '<td>' . $link->getLink("javascript: reserve('m','','','" . $resid. "');", translate('Edit'), '', '', translate('Edit this reservation'))  nearly all of the reservation data is missing (when I go to the scheduler that information is in tact).

So two problems:
1 - Summary text that appears using $summary is actually the schedule name and not the summary text
2 - The changes I made apparently affects the way the HTML printout retrieves the reservation data and the resulting reservation popup when I click the "Edit" link is almost totally devoid of reservation specific information.

HELP!
 
Logged
Nick
Administrator
Hero Member
*****

Karma: 15
Posts: 5419


WWW
« Reply #6 on: March 02, 2007, 09:41:43 AM »

Can you go back and make sure the 2 functions that you changed in usage.php and usage.template.php are correct?  It sounds like the order for $schedule and $summary may have been reversed.
Logged
barh0002
Jr. Member
**

Karma: 0
Posts: 63


« Reply #7 on: March 03, 2007, 07:43:37 PM »

Yep, Nick, that worked, so here are the steps I took in case other beginner/hacks like me want to make the change:

usage.php

Replaced line 211
Code:
print_reservation_data($type, $link, $resNo++, $start_date, $end_date, $created, $modified, $starttime, $endtime, $totTime, $rs['resid'], $rs['fname'], $rs['lname'], $rs['name'], $rs['memberid'], $rs['scheduletitle'], $rs['summary']);


templates/usage.template.php

Replaced line 452 with
Code:
function print_reservation_data($type, &$link, $resNo, $start_date, $end_date, $created, $modified, $starttime, $endtime, $totTime, $resid, $fname, $lname, $name, $memberid, $schedule, $summary) {


Replaced lines 368 -378 with
Code:
<tr class="rowHeaders" align="center">
        <td width="4%">#</td>
        <td width="9%"><?php echo translate&#40;'Start Date'&#41;?></td>
 <td width="9%"><?php echo translate&#40;'End Date'&#41;?></td>
        <td width="10%"><?php echo translate&#40;'Created'&#41;?></td>
        <td width="10%"><?php echo translate&#40;'Last Modified'&#41;?></td>
        <td width="10%"><?php echo translate&#40;'Start Time'&#41;?></td>
        <td width="10%"><?php echo translate&#40;'End Time'&#41;?></td>
        <td width="20%"><?php echo translate&#40;'Summary'&#41;?></td>
 <td width="8%"><?php echo translate&#40;'Manage'&#41;?></td>
        <td width="10%"><?php echo translate&#40;'Total Time'&#41;?></td>
 
  </tr>




Added

Code:
. '<td>' . $summary . "</td>\n";
to HTML print function on line 469
Code:
. $summary . "\n";
to line 489 to txt print function on line 491
Code:
. "\t&lt;summary&gt;$summary&lt;/summary&gt;\r\n"
to xml print function on line 507
Code:
. "\"$summary\"\r\n";
to csv print function line 524

And now for another couple questions:
1 - Are there already hacks that would enable a user to export the txt or csv outputs to Excel?
2 - Is there any way in the "Select Search Criteria" function to add a radio button to the "summary" criteria line that would allow the serach to exclude records with certain text ( i.e. right now you can choose - "contains" or "begins with" but what about adding a button for "does not contain")
Logged
Nick
Administrator
Hero Member
*****

Karma: 15
Posts: 5419


WWW
« Reply #8 on: March 05, 2007, 09:58:15 AM »

1) You can open a csv file with excel and resave as xls.  Not the optimal solution, but it is a workaround until excel integration is built.

2) This change would be a little more advanced.  If it's a feature that you're looking for, please add it to the New Features forum and I'll get it on my list.
Logged
tacfit
Newbie
*

Karma: 0
Posts: 7


« Reply #9 on: April 19, 2007, 05:07:26 PM »

Great mod!

Works like a charm.
Logged
barh0002
Jr. Member
**

Karma: 0
Posts: 63


« Reply #10 on: April 27, 2007, 12:03:08 PM »

Yes csv to excel will work for our needs of tallying and for a better visual presentation we print out the standard old HTML report  .pdf and email - in any case it is an easy visual way to track.  I will add the .csv to .xls to new features suggestions.  Thanks, Nick.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2006-2007, Simple Machines Valid XHTML 1.0! Valid CSS!