Skip to content

Commit 885d088

Browse files
Merge pull request #3 from fahadadeel/master
Aspose Tasks Java for PHP
2 parents 215477b + 67fa8b7 commit 885d088

File tree

163 files changed

+16870
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

163 files changed

+16870
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Aspose.Tasks Java for PHP
2+
Aspose Tasks Java for PHP is a PHP project that demonstrates / provides the Aspose.Tasks for Java API usage examples in PHP by using PHP/JAVA Bridge.
3+
4+
You will need to configure PHP/Java Bridge before using any of the Aspose provided Java APIs in PHP e.g Aspose.Words, Aspose.Cells and Aspose.Tasks etc.
5+
6+
For the configuration/setup of PHP/Java Bridge, please see:
7+
8+
http://php-java-bridge.sourceforge.net/pjb/index.php
9+
10+
To download Aspose.Tasks for Java API to be used with these examples through PHP/Java Bridge
11+
Please navigate to:
12+
13+
http://www.aspose.com/community/files/72/java-components/aspose.tasks-for-java/
14+
15+
For most complete documentation of the project, check Aspose.Tasks Java for PHP confluence wiki link:
16+
17+
http://www.aspose.com/docs/display/tasksjava/2.+Aspose.Tasks+Java+For+PHPB
18+
19+
20+
## Download Latest Versions?
21+
22+
* [Latest Releases on Codeplex](https://asposetasksjavaphp.codeplex.com/releases/view/618018)
23+
24+
## Clone Plugin SourceCodes?
25+
26+
This project is also hosted and maintained at CodePlex. To clone navigate to:
27+
28+
* [Aspose.Tasks Java for PHP - click here](https://asposetasksjavaphp.codeplex.com/SourceControl/latest)
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"name": "asposetasks/aspose_tasks_java_for_php",
3+
"description": "Aspose Tasks Java Examples for PHP Developers. Helps you understand how to use Aspose.Tasks Java classes in your PHP Projects.",
4+
"type": "library",
5+
"license": "MIT",
6+
"authors": [
7+
{
8+
"name": "Fahad Adeel",
9+
"email": "fahadadeel@gmail.com"
10+
}
11+
],
12+
"minimum-stability": "dev",
13+
"require": {
14+
"php": ">=5.3.0"
15+
},
16+
"autoload": {
17+
"psr-4": {
18+
"Aspose\\Tasks\\": "src/aspose/tasks"
19+
}
20+
}
21+
}

Plugins/Aspose_Tasks_Java_for_PHP/composer.lock

Lines changed: 20 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
namespace Aspose\Tasks\WorkingWithCalendarExceptions;
3+
4+
use com\aspose\tasks\Project as Project;
5+
use com\aspose\tasks\CalendarException as CalendarException;
6+
7+
use java\util\Calendar as Calendar;
8+
class AddCalendarException{
9+
10+
public static function run($dataDir=null){
11+
12+
# Instantiate project object
13+
$project = new Project($dataDir . 'test_tasks.mpp');
14+
15+
$cal = $project->getCalendars()->toList()->get(0);
16+
17+
# Add an exception
18+
$calExc = new CalendarException();
19+
$calendar=new Calendar();
20+
$calObject = $calendar->getInstance();
21+
$calObject->set(2009, 1, 1, 0, 0, 0);
22+
$calExc->setFromDate($calObject->getTime());
23+
$calObject->set(2009, 1, 3, 0, 0, 0);
24+
$calExc->setToDate($calObject->getTime());
25+
$cal->getExceptions()->add($calExc);
26+
print "Added calendar excpetion.".PHP_EOL;
27+
}
28+
}
29+
?>
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?php
2+
namespace Aspose\Tasks\WorkingWithCalendarExceptions;
3+
4+
use com\aspose\tasks\Project as Project;
5+
use com\aspose\tasks\CalendarException as CalendarException;
6+
use com\aspose\tasks\CalendarExceptionType as CalendarExceptionType;
7+
8+
use java\util\Calendar as Calendar;
9+
class DefineWeekdaysForExceptions{
10+
11+
public static function run($dataDir=null){
12+
13+
# Instantiate project object
14+
$project = new Project($dataDir . 'test_tasks.mpp');
15+
16+
#Define Calendar
17+
$cal = $project->getCalendars()->add("Calendar1");
18+
19+
# Define week days exception for christmis
20+
$except = new CalendarException();
21+
$except->setEnteredByOccurrences(false);
22+
23+
$calendar=new Calendar();
24+
$calendarExceptionType=new CalendarExceptionType();
25+
$cal_object = $calendar->getInstance();
26+
$cal_object->set(2009, 12, 24, 0, 0, 0);
27+
$except->setFromDate($cal_object->getTime());
28+
$cal_object->set(2009, 12, 31, 23, 59, 0);
29+
$except->setToDate($cal_object->getTime());
30+
$except->setType($calendarExceptionType->Daily);
31+
$except->setDayWorking(false);
32+
$cal->getExceptions()->add($except);
33+
34+
print "Defined weekdays for exceptions.".PHP_EOL;
35+
36+
}
37+
38+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
namespace Aspose\Tasks\WorkingWithCalendarExceptions;
3+
4+
use com\aspose\tasks\Project as Project;
5+
class GetCalendarExceptions{
6+
7+
public static function run($dataDir=null){
8+
9+
# Instantiate project object
10+
$project = new Project($dataDir . 'test_tasks.mpp');
11+
$calendars = $project->getCalendars()->toList();
12+
13+
$i=0;
14+
while ($i<sizeof($calendars)) {
15+
$cal = $calendars->get($i);
16+
$calexc = $cal->getExceptions()->getCount();
17+
if (sizeof($calexc)>0){
18+
print "From: " .(string)$calexc->getFromDate().PHP_EOL;// -> toString();
19+
print "To: " .(string)$calexc->getToDate().PHP_EOL;// -> toString();
20+
}
21+
$i += 1;
22+
}
23+
}
24+
}
25+
?>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
namespace Aspose\Tasks\WorkingWithCalendarExceptions;
3+
4+
use com\aspose\tasks\CalendarException as CalendarException;
5+
use com\aspose\tasks\CalendarExceptionType as CalendarExceptionType;
6+
7+
class HandleOccurrencesForExceptions{
8+
9+
public static function run($dataDir=null){
10+
11+
$except = new CalendarException();
12+
$except->setEnteredByOccurrences(true);
13+
$except->setOccurrences(5);
14+
15+
$calendarExceptionType=new CalendarExceptionType();
16+
$except->setType($calendarExceptionType->YearlyByDay);
17+
18+
print "Set Occurences for exeptions".PHP_EOL;
19+
}
20+
}
21+
?>
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
namespace Aspose\Tasks\WorkingWithCalendarExceptions;
3+
4+
use com\aspose\tasks\Project as Project;
5+
6+
class RemoveCalendarException{
7+
public static function run($dataDir=null){
8+
9+
# Instantiate project object
10+
$project = new Project($dataDir . 'test_tasks.mpp');
11+
12+
# Remove an exception
13+
$cal = $project->getCalendars()->toList()->get(0);
14+
if((int)(string)($cal->getExceptions()->getCount()) > 1) {
15+
$exc = $cal -> getExceptions() -> toList() -> get(0);
16+
$cal -> getExceptions() -> remove($exc);
17+
print "Removed calendar exception.".PHP_EOL;
18+
}
19+
20+
}
21+
22+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
namespace Aspose\Tasks\WorkingWithCalendars;
3+
4+
use com\aspose\tasks\Project as Project;
5+
6+
class CalendarProperties{
7+
8+
public static function run($dataDir=null)
9+
{
10+
11+
# Instantiate project object
12+
$project = new Project($dataDir . 'test_tasks.mpp');
13+
14+
$calendars = $project->getCalendars()->toList();
15+
16+
$i = 0;
17+
while ($i < sizeof($calendars)) {
18+
$cal = $calendars->get($i);
19+
if ($cal->getName() != null) {
20+
print "Base Calendar : ";
21+
if ($cal -> isBaseCalendar()) {
22+
print "Self";
23+
} else {
24+
$cal->getBaseCalendar()->getName();
25+
}
26+
print "UID : " . (string)$cal->getUid();//.to_s
27+
print "Name : " . (string)$cal->getName();//.to_s
28+
}
29+
$i += 1;
30+
}
31+
}
32+
}
33+
34+
?>
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
namespace Aspose\Tasks\WorkingWithCalendars;
3+
4+
use com\aspose\tasks\Project as Project;
5+
use com\aspose\tasks\SaveFileFormat as SaveFileFormat;
6+
7+
class CreateCalendar{
8+
9+
public static function run($dataDir=null){
10+
11+
# Instantiate project object
12+
$project = new Project($dataDir . 'test_tasks.mpp');
13+
14+
# Define Calendar
15+
$cal1 = $project->getCalendars()->add("no info");
16+
$cal2 = $project->getCalendars()->add("no name");
17+
$cal3 = $project->getCalendars()->add("cal3");
18+
19+
# Save the Project
20+
$saveFileFormat=new SaveFileFormat();
21+
$project->save($dataDir . "CreateCalendar.xml", $saveFileFormat->XML);
22+
print "Created calendar, please check the output file.".PHP_EOL;
23+
}
24+
25+
}
26+
?>

0 commit comments

Comments
 (0)