@@ -44,170 +44,170 @@ |
||
| 44 | 44 | */ |
| 45 | 45 | class TestPENSRequest extends UnitTestCase { |
| 46 | 46 | |
| 47 | - /** |
|
| 48 | - * Valid arguments to be used for tests |
|
| 49 | - * |
|
| 50 | - * @var array |
|
| 51 | - */ |
|
| 52 | - private $args = null; |
|
| 53 | - |
|
| 54 | - public function setUp() { |
|
| 55 | - $this->args = array( |
|
| 56 | - "pens-version" => "1.0.0", |
|
| 57 | - "command" => "collect", |
|
| 58 | - "package-type" => "aicc-pkg", |
|
| 59 | - "package-type-version" => "1.0", |
|
| 60 | - "package-format" => "zip", |
|
| 61 | - "package-id" => "http://myurl.com/12345", |
|
| 62 | - "package-url" => "http://myurl.com/mypackage.zip", |
|
| 63 | - "package-url-expiry" => "2006-04-01T06:51:29Z", |
|
| 64 | - "client" => "Authorware7", |
|
| 65 | - "receipt" => "mailto:[email protected]", |
|
| 66 | - "package-url-user-id" => "guillaumev", |
|
| 67 | - "package-url-account" => "toto", |
|
| 68 | - "package-url-password" => "12345", |
|
| 69 | - "system-user-id" => "guillaumev", |
|
| 70 | - "system-password" => "12345", |
|
| 71 | - "alerts" => "http://myurl.com/alerts", |
|
| 72 | - "vendor-data" => "here are my data"); |
|
| 73 | - } |
|
| 74 | - |
|
| 75 | - public function createObject($myargs) { |
|
| 76 | - return PENSRequestFactory::createPENSRequest($myargs); |
|
| 77 | - } |
|
| 78 | - |
|
| 79 | - public function exceptionTestForValue($key, $value, $code) { |
|
| 80 | - try { |
|
| 81 | - $myargs = $this->args; |
|
| 82 | - if($value === null) { |
|
| 83 | - unset($myargs[$key]); |
|
| 84 | - } else { |
|
| 85 | - $myargs[$key] = $value; |
|
| 86 | - } |
|
| 87 | - $object = $this->createObject($myargs); |
|
| 88 | - $this->fail(); |
|
| 89 | - } catch(PENSException $e) { |
|
| 90 | - $this->assertEqual($e->getCode(), $code); |
|
| 91 | - } |
|
| 92 | - } |
|
| 93 | - |
|
| 94 | - public function testPensVersionInvalid() { |
|
| 95 | - $this->exceptionTestForValue("pens-version", "0.8.0", 2001); |
|
| 96 | - } |
|
| 97 | - |
|
| 98 | - public function testPensVersionNull() { |
|
| 99 | - $this->exceptionTestForValue("pens-version", null, 2001); |
|
| 100 | - } |
|
| 101 | - |
|
| 102 | - |
|
| 103 | - public function testCommandInvalid() { |
|
| 104 | - $this->exceptionTestForValue("command", "testing", 2002); |
|
| 105 | - } |
|
| 106 | - |
|
| 107 | - public function testCommandNull() { |
|
| 108 | - $this->exceptionTestForValue("command", null, 2002); |
|
| 109 | - } |
|
| 110 | - |
|
| 111 | - public function testPackageTypeInvalid() { |
|
| 112 | - $this->exceptionTestForValue("package-type", "testing", 2003); |
|
| 113 | - } |
|
| 114 | - |
|
| 115 | - public function testPackageTypeNull() { |
|
| 116 | - $this->exceptionTestForValue("package-type", null, 2003); |
|
| 117 | - } |
|
| 118 | - |
|
| 119 | - public function testPackageTypeVersionNull() { |
|
| 120 | - $this->exceptionTestForValue("package-type-version", null, 2004); |
|
| 121 | - } |
|
| 122 | - |
|
| 123 | - public function testPackageFormatInvalid() { |
|
| 124 | - $this->exceptionTestForValue("package-format", "testing", 2005); |
|
| 125 | - } |
|
| 126 | - |
|
| 127 | - public function testPackageFormatNull() { |
|
| 128 | - $this->exceptionTestForValue("package-format", null, 2005); |
|
| 129 | - } |
|
| 130 | - |
|
| 131 | - public function testPackageIdInvalid() { |
|
| 132 | - $this->exceptionTestForValue("package-id", "testing", 2007); |
|
| 133 | - } |
|
| 134 | - |
|
| 135 | - public function testPackageIdNull() { |
|
| 136 | - $this->exceptionTestForValue("package-id", null, 2007); |
|
| 137 | - } |
|
| 138 | - |
|
| 139 | - public function testPackageUrlInvalid() { |
|
| 140 | - $this->exceptionTestForValue("package-url", "testing", 2008); |
|
| 141 | - } |
|
| 142 | - |
|
| 143 | - public function testPackageUrlInvalid2() { |
|
| 144 | - $this->exceptionTestForValue("package-url", "http://myurl.com/mypackage", 2008); |
|
| 145 | - } |
|
| 146 | - |
|
| 147 | - public function testPackageUrlNull() { |
|
| 148 | - $this->exceptionTestForValue("package-url", null, 2008); |
|
| 149 | - } |
|
| 150 | - |
|
| 151 | - public function testPackageUrlExpiryNull() { |
|
| 152 | - $this->exceptionTestForValue("package-url-expiry", null, 2009); |
|
| 153 | - } |
|
| 154 | - |
|
| 155 | - public function testPackageUrlExpiryInvalid() { |
|
| 156 | - $this->exceptionTestForValue("package-url-expiry", "testing", 2009); |
|
| 157 | - } |
|
| 158 | - |
|
| 159 | - public function testClientNull() { |
|
| 160 | - $this->exceptionTestForValue("client", null, 2010); |
|
| 161 | - } |
|
| 162 | - |
|
| 163 | - public function testReceiptNull() { |
|
| 164 | - $this->exceptionTestForValue("receipt", null, 2011); |
|
| 165 | - } |
|
| 166 | - |
|
| 167 | - public function testReceiptInvalid() { |
|
| 168 | - $this->exceptionTestForValue("receipt", "testing", 2011); |
|
| 169 | - } |
|
| 170 | - |
|
| 171 | - public function testAlertsInvalid() { |
|
| 172 | - $this->exceptionTestForValue("alerts", "testing", 1201); |
|
| 173 | - } |
|
| 174 | - |
|
| 175 | - public function testReceiptValid() { |
|
| 176 | - try { |
|
| 177 | - $myargs = $this->args; |
|
| 178 | - $myargs["receipt"] = "mailto:[email protected],[email protected]"; |
|
| 179 | - $object = $this->createObject($myargs); |
|
| 180 | - $this->pass(); |
|
| 181 | - } catch(PENSException $e) { |
|
| 182 | - $this->fail(); |
|
| 183 | - } |
|
| 184 | - } |
|
| 185 | - |
|
| 186 | - public function testValid() { |
|
| 187 | - try { |
|
| 188 | - $object = $this->createObject($this->args); |
|
| 189 | - $this->assertIsA($object, "PENSRequestCollect"); |
|
| 190 | - $this->assertEqual($object->getPensVersion(), "1.0.0"); |
|
| 191 | - $this->assertEqual($object->getPackageType(), "aicc-pkg"); |
|
| 192 | - $this->assertEqual($object->getPackageTypeVersion(), "1.0"); |
|
| 193 | - $this->assertEqual($object->getPackageFormat(), "zip"); |
|
| 194 | - $this->assertEqual($object->getPackageId(), "http://myurl.com/12345"); |
|
| 195 | - $this->assertEqual($object->getPackageUrl(), "http://myurl.com/mypackage.zip"); |
|
| 196 | - $this->assertIsA($object->getPackageUrlExpiry(), "DateTime"); |
|
| 197 | - $this->assertEqual($object->getClient(), "Authorware7"); |
|
| 198 | - $this->assertEqual($object->getReceipt(), "mailto:[email protected]"); |
|
| 199 | - $this->assertEqual($object->getPackageUrlUserId(), "guillaumev"); |
|
| 200 | - $this->assertEqual($object->getPackageUrlAccount(), "toto"); |
|
| 201 | - $this->assertEqual($object->getPackageUrlPassword(), "12345"); |
|
| 202 | - $this->assertEqual($object->getSystemUserId(), "guillaumev"); |
|
| 203 | - $this->assertEqual($object->getSystemPassword(), "12345"); |
|
| 204 | - $this->assertEqual($object->getAlerts(), "http://myurl.com/alerts"); |
|
| 205 | - $this->assertEqual($object->getVendorData(), "here are my data"); |
|
| 47 | + /** |
|
| 48 | + * Valid arguments to be used for tests |
|
| 49 | + * |
|
| 50 | + * @var array |
|
| 51 | + */ |
|
| 52 | + private $args = null; |
|
| 53 | + |
|
| 54 | + public function setUp() { |
|
| 55 | + $this->args = array( |
|
| 56 | + "pens-version" => "1.0.0", |
|
| 57 | + "command" => "collect", |
|
| 58 | + "package-type" => "aicc-pkg", |
|
| 59 | + "package-type-version" => "1.0", |
|
| 60 | + "package-format" => "zip", |
|
| 61 | + "package-id" => "http://myurl.com/12345", |
|
| 62 | + "package-url" => "http://myurl.com/mypackage.zip", |
|
| 63 | + "package-url-expiry" => "2006-04-01T06:51:29Z", |
|
| 64 | + "client" => "Authorware7", |
|
| 65 | + "receipt" => "mailto:[email protected]", |
|
| 66 | + "package-url-user-id" => "guillaumev", |
|
| 67 | + "package-url-account" => "toto", |
|
| 68 | + "package-url-password" => "12345", |
|
| 69 | + "system-user-id" => "guillaumev", |
|
| 70 | + "system-password" => "12345", |
|
| 71 | + "alerts" => "http://myurl.com/alerts", |
|
| 72 | + "vendor-data" => "here are my data"); |
|
| 73 | + } |
|
| 74 | + |
|
| 75 | + public function createObject($myargs) { |
|
| 76 | + return PENSRequestFactory::createPENSRequest($myargs); |
|
| 77 | + } |
|
| 78 | + |
|
| 79 | + public function exceptionTestForValue($key, $value, $code) { |
|
| 80 | + try { |
|
| 81 | + $myargs = $this->args; |
|
| 82 | + if($value === null) { |
|
| 83 | + unset($myargs[$key]); |
|
| 84 | + } else { |
|
| 85 | + $myargs[$key] = $value; |
|
| 86 | + } |
|
| 87 | + $object = $this->createObject($myargs); |
|
| 88 | + $this->fail(); |
|
| 89 | + } catch(PENSException $e) { |
|
| 90 | + $this->assertEqual($e->getCode(), $code); |
|
| 91 | + } |
|
| 92 | + } |
|
| 93 | + |
|
| 94 | + public function testPensVersionInvalid() { |
|
| 95 | + $this->exceptionTestForValue("pens-version", "0.8.0", 2001); |
|
| 96 | + } |
|
| 97 | + |
|
| 98 | + public function testPensVersionNull() { |
|
| 99 | + $this->exceptionTestForValue("pens-version", null, 2001); |
|
| 100 | + } |
|
| 101 | + |
|
| 102 | + |
|
| 103 | + public function testCommandInvalid() { |
|
| 104 | + $this->exceptionTestForValue("command", "testing", 2002); |
|
| 105 | + } |
|
| 106 | + |
|
| 107 | + public function testCommandNull() { |
|
| 108 | + $this->exceptionTestForValue("command", null, 2002); |
|
| 109 | + } |
|
| 110 | + |
|
| 111 | + public function testPackageTypeInvalid() { |
|
| 112 | + $this->exceptionTestForValue("package-type", "testing", 2003); |
|
| 113 | + } |
|
| 114 | + |
|
| 115 | + public function testPackageTypeNull() { |
|
| 116 | + $this->exceptionTestForValue("package-type", null, 2003); |
|
| 117 | + } |
|
| 118 | + |
|
| 119 | + public function testPackageTypeVersionNull() { |
|
| 120 | + $this->exceptionTestForValue("package-type-version", null, 2004); |
|
| 121 | + } |
|
| 122 | + |
|
| 123 | + public function testPackageFormatInvalid() { |
|
| 124 | + $this->exceptionTestForValue("package-format", "testing", 2005); |
|
| 125 | + } |
|
| 126 | + |
|
| 127 | + public function testPackageFormatNull() { |
|
| 128 | + $this->exceptionTestForValue("package-format", null, 2005); |
|
| 129 | + } |
|
| 130 | + |
|
| 131 | + public function testPackageIdInvalid() { |
|
| 132 | + $this->exceptionTestForValue("package-id", "testing", 2007); |
|
| 133 | + } |
|
| 134 | + |
|
| 135 | + public function testPackageIdNull() { |
|
| 136 | + $this->exceptionTestForValue("package-id", null, 2007); |
|
| 137 | + } |
|
| 138 | + |
|
| 139 | + public function testPackageUrlInvalid() { |
|
| 140 | + $this->exceptionTestForValue("package-url", "testing", 2008); |
|
| 141 | + } |
|
| 142 | + |
|
| 143 | + public function testPackageUrlInvalid2() { |
|
| 144 | + $this->exceptionTestForValue("package-url", "http://myurl.com/mypackage", 2008); |
|
| 145 | + } |
|
| 146 | + |
|
| 147 | + public function testPackageUrlNull() { |
|
| 148 | + $this->exceptionTestForValue("package-url", null, 2008); |
|
| 149 | + } |
|
| 150 | + |
|
| 151 | + public function testPackageUrlExpiryNull() { |
|
| 152 | + $this->exceptionTestForValue("package-url-expiry", null, 2009); |
|
| 153 | + } |
|
| 154 | + |
|
| 155 | + public function testPackageUrlExpiryInvalid() { |
|
| 156 | + $this->exceptionTestForValue("package-url-expiry", "testing", 2009); |
|
| 157 | + } |
|
| 158 | + |
|
| 159 | + public function testClientNull() { |
|
| 160 | + $this->exceptionTestForValue("client", null, 2010); |
|
| 161 | + } |
|
| 162 | + |
|
| 163 | + public function testReceiptNull() { |
|
| 164 | + $this->exceptionTestForValue("receipt", null, 2011); |
|
| 165 | + } |
|
| 166 | + |
|
| 167 | + public function testReceiptInvalid() { |
|
| 168 | + $this->exceptionTestForValue("receipt", "testing", 2011); |
|
| 169 | + } |
|
| 170 | + |
|
| 171 | + public function testAlertsInvalid() { |
|
| 172 | + $this->exceptionTestForValue("alerts", "testing", 1201); |
|
| 173 | + } |
|
| 174 | + |
|
| 175 | + public function testReceiptValid() { |
|
| 176 | + try { |
|
| 177 | + $myargs = $this->args; |
|
| 178 | + $myargs["receipt"] = "mailto:[email protected],[email protected]"; |
|
| 179 | + $object = $this->createObject($myargs); |
|
| 180 | + $this->pass(); |
|
| 181 | + } catch(PENSException $e) { |
|
| 182 | + $this->fail(); |
|
| 183 | + } |
|
| 184 | + } |
|
| 185 | + |
|
| 186 | + public function testValid() { |
|
| 187 | + try { |
|
| 188 | + $object = $this->createObject($this->args); |
|
| 189 | + $this->assertIsA($object, "PENSRequestCollect"); |
|
| 190 | + $this->assertEqual($object->getPensVersion(), "1.0.0"); |
|
| 191 | + $this->assertEqual($object->getPackageType(), "aicc-pkg"); |
|
| 192 | + $this->assertEqual($object->getPackageTypeVersion(), "1.0"); |
|
| 193 | + $this->assertEqual($object->getPackageFormat(), "zip"); |
|
| 194 | + $this->assertEqual($object->getPackageId(), "http://myurl.com/12345"); |
|
| 195 | + $this->assertEqual($object->getPackageUrl(), "http://myurl.com/mypackage.zip"); |
|
| 196 | + $this->assertIsA($object->getPackageUrlExpiry(), "DateTime"); |
|
| 197 | + $this->assertEqual($object->getClient(), "Authorware7"); |
|
| 198 | + $this->assertEqual($object->getReceipt(), "mailto:[email protected]"); |
|
| 199 | + $this->assertEqual($object->getPackageUrlUserId(), "guillaumev"); |
|
| 200 | + $this->assertEqual($object->getPackageUrlAccount(), "toto"); |
|
| 201 | + $this->assertEqual($object->getPackageUrlPassword(), "12345"); |
|
| 202 | + $this->assertEqual($object->getSystemUserId(), "guillaumev"); |
|
| 203 | + $this->assertEqual($object->getSystemPassword(), "12345"); |
|
| 204 | + $this->assertEqual($object->getAlerts(), "http://myurl.com/alerts"); |
|
| 205 | + $this->assertEqual($object->getVendorData(), "here are my data"); |
|
| 206 | 206 | |
| 207 | - } catch(PENSException $e) { |
|
| 208 | - $this->fail(); |
|
| 209 | - } |
|
| 210 | - } |
|
| 207 | + } catch(PENSException $e) { |
|
| 208 | + $this->fail(); |
|
| 209 | + } |
|
| 210 | + } |
|
| 211 | 211 | |
| 212 | 212 | |
| 213 | 213 | } |
@@ -79,14 +79,14 @@ discard block |
||
| 79 | 79 | public function exceptionTestForValue($key, $value, $code) { |
| 80 | 80 | try { |
| 81 | 81 | $myargs = $this->args; |
| 82 | - if($value === null) { |
|
| 82 | + if ($value === null) { |
|
| 83 | 83 | unset($myargs[$key]); |
| 84 | 84 | } else { |
| 85 | 85 | $myargs[$key] = $value; |
| 86 | 86 | } |
| 87 | 87 | $object = $this->createObject($myargs); |
| 88 | 88 | $this->fail(); |
| 89 | - } catch(PENSException $e) { |
|
| 89 | + } catch (PENSException $e) { |
|
| 90 | 90 | $this->assertEqual($e->getCode(), $code); |
| 91 | 91 | } |
| 92 | 92 | } |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | $myargs["receipt"] = "mailto:[email protected],[email protected]"; |
| 179 | 179 | $object = $this->createObject($myargs); |
| 180 | 180 | $this->pass(); |
| 181 | - } catch(PENSException $e) { |
|
| 181 | + } catch (PENSException $e) { |
|
| 182 | 182 | $this->fail(); |
| 183 | 183 | } |
| 184 | 184 | } |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | $this->assertEqual($object->getAlerts(), "http://myurl.com/alerts"); |
| 205 | 205 | $this->assertEqual($object->getVendorData(), "here are my data"); |
| 206 | 206 | |
| 207 | - } catch(PENSException $e) { |
|
| 207 | + } catch (PENSException $e) { |
|
| 208 | 208 | $this->fail(); |
| 209 | 209 | } |
| 210 | 210 | } |
@@ -8,8 +8,8 @@ |
||
| 8 | 8 | /** |
| 9 | 9 | * Init |
| 10 | 10 | */ |
| 11 | -require_once __DIR__ . '/../../../main/inc/global.inc.php'; |
|
| 12 | -require_once __DIR__ . '/../config.php'; |
|
| 11 | +require_once __DIR__.'/../../../main/inc/global.inc.php'; |
|
| 12 | +require_once __DIR__.'/../config.php'; |
|
| 13 | 13 | |
| 14 | 14 | if (!api_is_anonymous()) { |
| 15 | 15 | $currentPageClass = isset($_POST['page_class']) ? $_POST['page_class'] : ''; |
@@ -5,6 +5,6 @@ |
||
| 5 | 5 | * @author Angel Fernando Quiroz Campos <[email protected]> |
| 6 | 6 | * @package chamilo.plugin.tour |
| 7 | 7 | */ |
| 8 | -require_once __DIR__ . '/config.php'; |
|
| 8 | +require_once __DIR__.'/config.php'; |
|
| 9 | 9 | |
| 10 | 10 | Tour::create()->uninstall(); |
@@ -5,6 +5,6 @@ |
||
| 5 | 5 | * @author Angel Fernando Quiroz Campos <[email protected]> |
| 6 | 6 | * @package chamilo.plugin.tour |
| 7 | 7 | */ |
| 8 | -require_once __DIR__ . '/config.php'; |
|
| 8 | +require_once __DIR__.'/config.php'; |
|
| 9 | 9 | |
| 10 | 10 | Tour::create()->install(); |
@@ -1069,7 +1069,7 @@ |
||
| 1069 | 1069 | */ |
| 1070 | 1070 | public function getStatusMessage($status, $isAble = true) |
| 1071 | 1071 | { |
| 1072 | - $message = ''; |
|
| 1072 | + $message = ''; |
|
| 1073 | 1073 | switch ($status) { |
| 1074 | 1074 | case ADVANCED_SUBSCRIPTION_QUEUE_STATUS_NO_QUEUE: |
| 1075 | 1075 | if ($isAble) { |
@@ -106,15 +106,15 @@ discard block |
||
| 106 | 106 | { |
| 107 | 107 | $advancedSubscriptionQueueTable = Database::get_main_table(TABLE_ADVANCED_SUBSCRIPTION_QUEUE); |
| 108 | 108 | |
| 109 | - $sql = "CREATE TABLE IF NOT EXISTS $advancedSubscriptionQueueTable (" . |
|
| 110 | - "id int UNSIGNED NOT NULL AUTO_INCREMENT, " . |
|
| 111 | - "session_id int UNSIGNED NOT NULL, " . |
|
| 112 | - "user_id int UNSIGNED NOT NULL, " . |
|
| 113 | - "status int UNSIGNED NOT NULL, " . |
|
| 114 | - "last_message_id int UNSIGNED NOT NULL, " . |
|
| 115 | - "created_at datetime NOT NULL, " . |
|
| 116 | - "updated_at datetime NULL, " . |
|
| 117 | - "PRIMARY KEY PK_advanced_subscription_queue (id), " . |
|
| 109 | + $sql = "CREATE TABLE IF NOT EXISTS $advancedSubscriptionQueueTable (". |
|
| 110 | + "id int UNSIGNED NOT NULL AUTO_INCREMENT, ". |
|
| 111 | + "session_id int UNSIGNED NOT NULL, ". |
|
| 112 | + "user_id int UNSIGNED NOT NULL, ". |
|
| 113 | + "status int UNSIGNED NOT NULL, ". |
|
| 114 | + "last_message_id int UNSIGNED NOT NULL, ". |
|
| 115 | + "created_at datetime NOT NULL, ". |
|
| 116 | + "updated_at datetime NULL, ". |
|
| 117 | + "PRIMARY KEY PK_advanced_subscription_queue (id), ". |
|
| 118 | 118 | "UNIQUE KEY UK_advanced_subscription_queue (user_id, session_id)); "; |
| 119 | 119 | Database::query($sql); |
| 120 | 120 | } |
@@ -265,11 +265,10 @@ discard block |
||
| 265 | 265 | $now = new DateTime(api_get_utc_datetime()); |
| 266 | 266 | $newYearDate = $plugin->get('course_session_credit_year_start_date'); |
| 267 | 267 | $newYearDate = !empty($newYearDate) ? |
| 268 | - new \DateTime($newYearDate . $now->format('/Y')) : |
|
| 269 | - $now; |
|
| 268 | + new \DateTime($newYearDate.$now->format('/Y')) : $now; |
|
| 270 | 269 | $extra = new ExtraFieldValue('session'); |
| 271 | - $joinSessionTable = Database::get_main_table(TABLE_MAIN_SESSION_USER) . ' su INNER JOIN ' . |
|
| 272 | - Database::get_main_table(TABLE_MAIN_SESSION) . ' s ON s.id = su.session_id'; |
|
| 270 | + $joinSessionTable = Database::get_main_table(TABLE_MAIN_SESSION_USER).' su INNER JOIN '. |
|
| 271 | + Database::get_main_table(TABLE_MAIN_SESSION).' s ON s.id = su.session_id'; |
|
| 273 | 272 | $whereSessionParams = 'su.relation_type = ? AND s.access_start_date >= ? AND su.user_id = ?'; |
| 274 | 273 | $whereSessionParamsValues = array( |
| 275 | 274 | 0, |
@@ -734,14 +733,14 @@ discard block |
||
| 734 | 733 | $tpl->assign('termsContent', $termsAndConditions); |
| 735 | 734 | $termsAndConditions = $tpl->fetch('/advanced_subscription/views/terms_and_conditions_to_pdf.tpl'); |
| 736 | 735 | $pdf = new PDF(); |
| 737 | - $filename = 'terms' . sha1(rand(0,99999)); |
|
| 736 | + $filename = 'terms'.sha1(rand(0, 99999)); |
|
| 738 | 737 | $pdf->content_to_pdf($termsAndConditions, null, $filename, null, 'F'); |
| 739 | 738 | $fileAttachments['file'][] = array( |
| 740 | - 'name' => $filename . '.pdf', |
|
| 741 | - 'application/pdf' => $filename . '.pdf', |
|
| 742 | - 'tmp_name' => api_get_path(SYS_ARCHIVE_PATH) . $filename . '.pdf', |
|
| 739 | + 'name' => $filename.'.pdf', |
|
| 740 | + 'application/pdf' => $filename.'.pdf', |
|
| 741 | + 'tmp_name' => api_get_path(SYS_ARCHIVE_PATH).$filename.'.pdf', |
|
| 743 | 742 | 'error' => UPLOAD_ERR_OK, |
| 744 | - 'size' => filesize(api_get_path(SYS_ARCHIVE_PATH) . $filename . '.pdf'), |
|
| 743 | + 'size' => filesize(api_get_path(SYS_ARCHIVE_PATH).$filename.'.pdf'), |
|
| 745 | 744 | ); |
| 746 | 745 | $fileAttachments['comments'][] = get_lang('TermsAndConditions'); |
| 747 | 746 | } |
@@ -1032,7 +1031,7 @@ discard block |
||
| 1032 | 1031 | |
| 1033 | 1032 | $mergedArray = array_merge(array($sessionId), array_keys($fields)); |
| 1034 | 1033 | |
| 1035 | - $sql = "SELECT * FROM " . Database::get_main_table(TABLE_EXTRA_FIELD_VALUES) ." |
|
| 1034 | + $sql = "SELECT * FROM ".Database::get_main_table(TABLE_EXTRA_FIELD_VALUES)." |
|
| 1036 | 1035 | WHERE item_id = %d AND field_id IN (%d, %d, %d, %d, %d, %d, %d)"; |
| 1037 | 1036 | $sql = vsprintf($sql, $mergedArray); |
| 1038 | 1037 | $sessionFieldValueList = Database::query($sql); |
@@ -1048,10 +1047,10 @@ discard block |
||
| 1048 | 1047 | $sessionArray['description'] = SessionManager::getDescriptionFromSessionId($sessionId); |
| 1049 | 1048 | |
| 1050 | 1049 | if (isset($sessionArray['brochure'])) { |
| 1051 | - $sessionArray['brochure'] = api_get_path(WEB_UPLOAD_PATH) . $sessionArray['brochure']; |
|
| 1050 | + $sessionArray['brochure'] = api_get_path(WEB_UPLOAD_PATH).$sessionArray['brochure']; |
|
| 1052 | 1051 | } |
| 1053 | 1052 | if (isset($sessionArray['banner'])) { |
| 1054 | - $sessionArray['banner'] = api_get_path(WEB_UPLOAD_PATH) . $sessionArray['banner']; |
|
| 1053 | + $sessionArray['banner'] = api_get_path(WEB_UPLOAD_PATH).$sessionArray['banner']; |
|
| 1055 | 1054 | } |
| 1056 | 1055 | |
| 1057 | 1056 | return $sessionArray; |
@@ -1108,7 +1107,7 @@ discard block |
||
| 1108 | 1107 | */ |
| 1109 | 1108 | public function getSessionUrl($sessionId) |
| 1110 | 1109 | { |
| 1111 | - $url = api_get_path(WEB_CODE_PATH) . 'session/?session_id=' . intval($sessionId); |
|
| 1110 | + $url = api_get_path(WEB_CODE_PATH).'session/?session_id='.intval($sessionId); |
|
| 1112 | 1111 | |
| 1113 | 1112 | return $url; |
| 1114 | 1113 | } |
@@ -1157,16 +1156,16 @@ discard block |
||
| 1157 | 1156 | */ |
| 1158 | 1157 | public function getQueueUrl($params) |
| 1159 | 1158 | { |
| 1160 | - $url = api_get_path(WEB_PLUGIN_PATH) . 'advanced_subscription/ajax/advanced_subscription.ajax.php?' . |
|
| 1161 | - 'a=' . Security::remove_XSS($params['action']) . '&' . |
|
| 1162 | - 's=' . intval($params['sessionId']) . '&' . |
|
| 1163 | - 'current_user_id=' . intval($params['currentUserId']) . '&' . |
|
| 1164 | - 'e=' . intval($params['newStatus']) . '&' . |
|
| 1165 | - 'u=' . intval($params['studentUserId']) . '&' . |
|
| 1166 | - 'q=' . intval($params['queueId']) . '&' . |
|
| 1167 | - 'is_connected=' . 1 . '&' . |
|
| 1168 | - 'profile_completed=' . intval($params['profile_completed']) . '&' . |
|
| 1169 | - 'v=' . $this->generateHash($params); |
|
| 1159 | + $url = api_get_path(WEB_PLUGIN_PATH).'advanced_subscription/ajax/advanced_subscription.ajax.php?'. |
|
| 1160 | + 'a='.Security::remove_XSS($params['action']).'&'. |
|
| 1161 | + 's='.intval($params['sessionId']).'&'. |
|
| 1162 | + 'current_user_id='.intval($params['currentUserId']).'&'. |
|
| 1163 | + 'e='.intval($params['newStatus']).'&'. |
|
| 1164 | + 'u='.intval($params['studentUserId']).'&'. |
|
| 1165 | + 'q='.intval($params['queueId']).'&'. |
|
| 1166 | + 'is_connected='.1.'&'. |
|
| 1167 | + 'profile_completed='.intval($params['profile_completed']).'&'. |
|
| 1168 | + 'v='.$this->generateHash($params); |
|
| 1170 | 1169 | |
| 1171 | 1170 | return $url; |
| 1172 | 1171 | } |
@@ -1219,7 +1218,7 @@ discard block |
||
| 1219 | 1218 | } |
| 1220 | 1219 | $queueTable = Database::get_main_table(TABLE_ADVANCED_SUBSCRIPTION_QUEUE); |
| 1221 | 1220 | $userTable = Database::get_main_table(TABLE_MAIN_USER); |
| 1222 | - $userJoinTable = $queueTable . ' q INNER JOIN ' . $userTable . ' u ON q.user_id = u.user_id'; |
|
| 1221 | + $userJoinTable = $queueTable.' q INNER JOIN '.$userTable.' u ON q.user_id = u.user_id'; |
|
| 1223 | 1222 | $where = array( |
| 1224 | 1223 | 'where' => array( |
| 1225 | 1224 | 'q.session_id = ?' => array( |
@@ -1232,7 +1231,7 @@ discard block |
||
| 1232 | 1231 | $students = Database::select($select, $userJoinTable, $where); |
| 1233 | 1232 | foreach ($students as &$student) { |
| 1234 | 1233 | $status = intval($student['status']); |
| 1235 | - switch($status) { |
|
| 1234 | + switch ($status) { |
|
| 1236 | 1235 | case ADVANCED_SUBSCRIPTION_QUEUE_STATUS_NO_QUEUE: |
| 1237 | 1236 | case ADVANCED_SUBSCRIPTION_QUEUE_STATUS_START: |
| 1238 | 1237 | $student['validation'] = ''; |
@@ -1246,7 +1245,7 @@ discard block |
||
| 1246 | 1245 | $student['validation'] = 'Yes'; |
| 1247 | 1246 | break; |
| 1248 | 1247 | default: |
| 1249 | - error_log(__FILE__ . ' ' . __FUNCTION__ . ' Student status no detected'); |
|
| 1248 | + error_log(__FILE__.' '.__FUNCTION__.' Student status no detected'); |
|
| 1250 | 1249 | } |
| 1251 | 1250 | } |
| 1252 | 1251 | $return = array( |
@@ -1295,7 +1294,7 @@ discard block |
||
| 1295 | 1294 | $dataPrepared['queueId'] = intval($data['queueId']); |
| 1296 | 1295 | $dataPrepared['newStatus'] = intval($data['newStatus']); |
| 1297 | 1296 | $dataPrepared = serialize($dataPrepared); |
| 1298 | - return sha1($dataPrepared . $key); |
|
| 1297 | + return sha1($dataPrepared.$key); |
|
| 1299 | 1298 | } |
| 1300 | 1299 | |
| 1301 | 1300 | /** |
@@ -1350,12 +1349,12 @@ discard block |
||
| 1350 | 1349 | break; |
| 1351 | 1350 | } |
| 1352 | 1351 | |
| 1353 | - $url = api_get_path(WEB_PLUGIN_PATH) . "advanced_subscription/src/terms_and_conditions.php?"; |
|
| 1352 | + $url = api_get_path(WEB_PLUGIN_PATH)."advanced_subscription/src/terms_and_conditions.php?"; |
|
| 1354 | 1353 | $url .= http_build_query($urlParams); |
| 1355 | 1354 | |
| 1356 | 1355 | // Launch popup |
| 1357 | 1356 | if ($mode == ADVANCED_SUBSCRIPTION_TERMS_MODE_POPUP) { |
| 1358 | - $url = 'javascript:void(window.open(\'' . $url .'\',\'AdvancedSubscriptionTerms\', \'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=700px,height=600px\', \'100\' ))'; |
|
| 1357 | + $url = 'javascript:void(window.open(\''.$url.'\',\'AdvancedSubscriptionTerms\', \'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=700px,height=600px\', \'100\' ))'; |
|
| 1359 | 1358 | } |
| 1360 | 1359 | return $url; |
| 1361 | 1360 | } |
@@ -1367,9 +1366,9 @@ discard block |
||
| 1367 | 1366 | */ |
| 1368 | 1367 | public function getRenderMailUrl($params) |
| 1369 | 1368 | { |
| 1370 | - $url = api_get_path(WEB_PLUGIN_PATH) . 'advanced_subscription/src/render_mail.php?' . |
|
| 1371 | - 'q=' . $params['queueId'] . '&' . |
|
| 1372 | - 'v=' . $this->generateHash($params); |
|
| 1369 | + $url = api_get_path(WEB_PLUGIN_PATH).'advanced_subscription/src/render_mail.php?'. |
|
| 1370 | + 'q='.$params['queueId'].'&'. |
|
| 1371 | + 'v='.$this->generateHash($params); |
|
| 1373 | 1372 | return $url; |
| 1374 | 1373 | } |
| 1375 | 1374 | |
@@ -1440,7 +1439,7 @@ discard block |
||
| 1440 | 1439 | sf.extra_field_type = $extraFieldType AND |
| 1441 | 1440 | sf.variable = 'is_induction_session' AND |
| 1442 | 1441 | su.relation_type = 0 AND |
| 1443 | - su.user_id = " . intval($userId); |
|
| 1442 | + su.user_id = ".intval($userId); |
|
| 1444 | 1443 | |
| 1445 | 1444 | $result = Database::query($sql); |
| 1446 | 1445 | |
@@ -5,7 +5,7 @@ |
||
| 5 | 5 | * @author Angel Fernando Quiroz Campos <[email protected]> |
| 6 | 6 | * @package chamilo.plugin.advanced_subscription |
| 7 | 7 | */ |
| 8 | -require_once __DIR__ . '/../config.php'; |
|
| 8 | +require_once __DIR__.'/../config.php'; |
|
| 9 | 9 | |
| 10 | 10 | $plugin = AdvancedSubscriptionPlugin::create(); |
| 11 | 11 | |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | if ($data['type'] === HOOK_EVENT_TYPE_PRE) { |
| 68 | 68 | |
| 69 | 69 | } elseif ($data['type'] === HOOK_EVENT_TYPE_POST) { |
| 70 | - /** @var \nusoap_server $server */ |
|
| 70 | + /** @var \nusoap_server $server */ |
|
| 71 | 71 | $server = &$data['server']; |
| 72 | 72 | |
| 73 | 73 | /** WSSessionListInCategory */ |
@@ -424,7 +424,7 @@ discard block |
||
| 424 | 424 | } |
| 425 | 425 | if (!WSHelperVerifyKey($params)) { |
| 426 | 426 | |
| 427 | - //return return_error(WS_ERROR_SECRET_KEY); |
|
| 427 | + //return return_error(WS_ERROR_SECRET_KEY); |
|
| 428 | 428 | } |
| 429 | 429 | // Check if category ID is set |
| 430 | 430 | if (!empty($params['id']) && empty($params['name'])) { |
@@ -6,7 +6,7 @@ discard block |
||
| 6 | 6 | * @package chamilo.plugin.advanced_subscription |
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | -require_once __DIR__ . '/../config.php'; |
|
| 9 | +require_once __DIR__.'/../config.php'; |
|
| 10 | 10 | |
| 11 | 11 | /** |
| 12 | 12 | * Class HookAdvancedSubscription extends the HookObserver to implements |
@@ -420,7 +420,7 @@ discard block |
||
| 420 | 420 | |
| 421 | 421 | if ($debug) { |
| 422 | 422 | error_log(__FUNCTION__); |
| 423 | - error_log('Params ' . print_r($params, 1)); |
|
| 423 | + error_log('Params '.print_r($params, 1)); |
|
| 424 | 424 | } |
| 425 | 425 | if (!WSHelperVerifyKey($params)) { |
| 426 | 426 | |
@@ -471,7 +471,7 @@ discard block |
||
| 471 | 471 | |
| 472 | 472 | if ($debug) { |
| 473 | 473 | error_log('WSUserSubscribedInCourse'); |
| 474 | - error_log('Params ' . print_r($params, 1)); |
|
| 474 | + error_log('Params '.print_r($params, 1)); |
|
| 475 | 475 | } |
| 476 | 476 | if (!WSHelperVerifyKey($params)) { |
| 477 | 477 | return return_error(WS_ERROR_SECRET_KEY); |
@@ -576,7 +576,7 @@ discard block |
||
| 576 | 576 | |
| 577 | 577 | if ($debug) { |
| 578 | 578 | error_log('WSListSessionsDetailsByCategory'); |
| 579 | - error_log('Params ' . print_r($params, 1)); |
|
| 579 | + error_log('Params '.print_r($params, 1)); |
|
| 580 | 580 | } |
| 581 | 581 | $secretKey = $params['secret_key']; |
| 582 | 582 | |
@@ -7,7 +7,7 @@ discard block |
||
| 7 | 7 | /** |
| 8 | 8 | * Init |
| 9 | 9 | */ |
| 10 | -require_once __DIR__ . '/../config.php'; |
|
| 10 | +require_once __DIR__.'/../config.php'; |
|
| 11 | 11 | // protect |
| 12 | 12 | api_protect_admin_script(); |
| 13 | 13 | // start plugin |
@@ -85,8 +85,7 @@ discard block |
||
| 85 | 85 | $data['newStatus'] = ADVANCED_SUBSCRIPTION_QUEUE_STATUS_ADMIN_DISAPPROVED; |
| 86 | 86 | $student['rejectUrl'] = $plugin->getQueueUrl($data); |
| 87 | 87 | $student['complete_name'] = $isWesternNameOrder ? |
| 88 | - $student['firstname'] . ', ' . $student['lastname'] : |
|
| 89 | - $student['lastname'] . ', ' . $student['firstname']; |
|
| 88 | + $student['firstname'].', '.$student['lastname'] : $student['lastname'].', '.$student['firstname']; |
|
| 90 | 89 | } |
| 91 | 90 | $tpl->assign('session', $sessionArray); |
| 92 | 91 | $tpl->assign('students', $studentList['students']); |
@@ -4,7 +4,7 @@ |
||
| 4 | 4 | * This script generates four session categories. |
| 5 | 5 | * @package chamilo.plugin.advanced_subscription |
| 6 | 6 | */ |
| 7 | -require_once __DIR__ . '/../../config.php'; |
|
| 7 | +require_once __DIR__.'/../../config.php'; |
|
| 8 | 8 | |
| 9 | 9 | api_protect_admin_script(); |
| 10 | 10 | |