@@ -76,6 +76,11 @@ |
||
| 76 | 76 | return PENSRequestFactory::createPENSRequest($myargs); |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | + /** |
|
| 80 | + * @param string $key |
|
| 81 | + * @param string|null $value |
|
| 82 | + * @param integer $code |
|
| 83 | + */ |
|
| 79 | 84 | public function exceptionTestForValue($key, $value, $code) { |
| 80 | 85 | try { |
| 81 | 86 | $myargs = $this->args; |
@@ -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 | } |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | /** |
| 58 | 58 | * Handle the subscribe action. |
| 59 | 59 | * |
| 60 | - * @return bool |
|
| 60 | + * @return null|boolean |
|
| 61 | 61 | */ |
| 62 | 62 | function action_subscribe_user() |
| 63 | 63 | { |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | |
| 152 | 152 | /** |
| 153 | 153 | * |
| 154 | - * @param type $course_code |
|
| 154 | + * @param string $course_code |
|
| 155 | 155 | * @return type |
| 156 | 156 | */ |
| 157 | 157 | function retrieve_course($course_code) |
@@ -40,11 +40,19 @@ |
||
| 40 | 40 | return isset($_GET[$key]) ? $_GET[$key] : $default; |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | + /** |
|
| 44 | + * @param string $key |
|
| 45 | + * |
|
| 46 | + * @return string |
|
| 47 | + */ |
|
| 43 | 48 | public static function server($key, $default = '') |
| 44 | 49 | { |
| 45 | 50 | return isset($_SERVER[$key]) ? $_SERVER[$key] : $default; |
| 46 | 51 | } |
| 47 | 52 | |
| 53 | + /** |
|
| 54 | + * @param string $name |
|
| 55 | + */ |
|
| 48 | 56 | public static function get_lang($name) |
| 49 | 57 | { |
| 50 | 58 | return SearchCoursePlugin::create()->get_lang($name); |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -require_once dirname(__FILE__) . '/register_course_widget.class.php'; |
|
| 3 | +require_once dirname(__FILE__).'/register_course_widget.class.php'; |
|
| 4 | 4 | |
| 5 | 5 | /** |
| 6 | 6 | * Search course widget. |
@@ -60,12 +60,12 @@ discard block |
||
| 60 | 60 | $url = self::server('REQUEST_URI'); |
| 61 | 61 | $url = explode('?', $url); |
| 62 | 62 | $url = reset($url); |
| 63 | - $url = self::server('SERVER_NAME') . $url; |
|
| 63 | + $url = self::server('SERVER_NAME').$url; |
|
| 64 | 64 | |
| 65 | 65 | $root = api_get_path('WEB_PATH'); |
| 66 | 66 | $root = str_replace('https://', '', $root); |
| 67 | 67 | $root = str_replace('http://', '', $root); |
| 68 | - $index_url = $root . 'index.php'; |
|
| 68 | + $index_url = $root.'index.php'; |
|
| 69 | 69 | |
| 70 | 70 | return $url == $index_url || $url == $root; |
| 71 | 71 | } |
@@ -80,12 +80,12 @@ discard block |
||
| 80 | 80 | $url = self::server('REQUEST_URI'); |
| 81 | 81 | $url = explode('?', $url); |
| 82 | 82 | $url = reset($url); |
| 83 | - $url = self::server('SERVER_NAME') . $url; |
|
| 83 | + $url = self::server('SERVER_NAME').$url; |
|
| 84 | 84 | |
| 85 | 85 | $root = api_get_path('WEB_PATH'); |
| 86 | 86 | $root = str_replace('https://', '', $root); |
| 87 | 87 | $root = str_replace('http://', '', $root); |
| 88 | - $index_url = $root . 'user_portal.php'; |
|
| 88 | + $index_url = $root.'user_portal.php'; |
|
| 89 | 89 | |
| 90 | 90 | return $url == $index_url || $url == $root; |
| 91 | 91 | } |
@@ -153,8 +153,8 @@ discard block |
||
| 153 | 153 | $parameters[self::PARAM_ACTION] = $action; |
| 154 | 154 | } |
| 155 | 155 | $parameters = implode('&', $parameters); |
| 156 | - $parameters = $parameters ? '?' . $parameters : ''; |
|
| 157 | - return $self . $parameters; |
|
| 156 | + $parameters = $parameters ? '?'.$parameters : ''; |
|
| 157 | + return $self.$parameters; |
|
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | /** |
@@ -241,8 +241,8 @@ discard block |
||
| 241 | 241 | $details = implode(' - ', $details); |
| 242 | 242 | $title = $course['title']; |
| 243 | 243 | |
| 244 | - $href = api_get_path(WEB_COURSE_PATH).$course['code'] .'/index.php'; |
|
| 245 | - echo '<tr><td><b><a href="' . $href . '">' . "$title</a></b><br/>$details</td><td>"; |
|
| 244 | + $href = api_get_path(WEB_COURSE_PATH).$course['code'].'/index.php'; |
|
| 245 | + echo '<tr><td><b><a href="'.$href.'">'."$title</a></b><br/>$details</td><td>"; |
|
| 246 | 246 | if (!api_is_anonymous()) { |
| 247 | 247 | if ($course['registration_code']) { |
| 248 | 248 | Display::display_icon( |
@@ -336,13 +336,13 @@ discard block |
||
| 336 | 336 | |
| 337 | 337 | if (api_is_anonymous()) |
| 338 | 338 | { |
| 339 | - $course_fiter = 'visibility = ' . COURSE_VISIBILITY_OPEN_WORLD; |
|
| 339 | + $course_fiter = 'visibility = '.COURSE_VISIBILITY_OPEN_WORLD; |
|
| 340 | 340 | } |
| 341 | 341 | else |
| 342 | 342 | { |
| 343 | - $course_fiter = 'visibility = ' . COURSE_VISIBILITY_OPEN_WORLD . ' OR '; |
|
| 344 | - $course_fiter .= 'visibility = ' . COURSE_VISIBILITY_OPEN_PLATFORM . ' OR '; |
|
| 345 | - $course_fiter .= '(visibility = ' . COURSE_VISIBILITY_REGISTERED . ' AND subscribe = 1)'; |
|
| 343 | + $course_fiter = 'visibility = '.COURSE_VISIBILITY_OPEN_WORLD.' OR '; |
|
| 344 | + $course_fiter .= 'visibility = '.COURSE_VISIBILITY_OPEN_PLATFORM.' OR '; |
|
| 345 | + $course_fiter .= '(visibility = '.COURSE_VISIBILITY_REGISTERED.' AND subscribe = 1)'; |
|
| 346 | 346 | } |
| 347 | 347 | |
| 348 | 348 | $sql = <<<EOT |
@@ -123,8 +123,7 @@ discard block |
||
| 123 | 123 | if ($has_content) |
| 124 | 124 | { |
| 125 | 125 | echo '<div class="list">'; |
| 126 | - } |
|
| 127 | - else |
|
| 126 | + } else |
|
| 128 | 127 | { |
| 129 | 128 | echo '<div>'; |
| 130 | 129 | } |
@@ -132,8 +131,7 @@ discard block |
||
| 132 | 131 | if (RegisterCourseWidget::factory()->run()) |
| 133 | 132 | { |
| 134 | 133 | $result = true; |
| 135 | - } |
|
| 136 | - else |
|
| 134 | + } else |
|
| 137 | 135 | { |
| 138 | 136 | $result = $this->action_display(); |
| 139 | 137 | } |
@@ -337,8 +335,7 @@ discard block |
||
| 337 | 335 | if (api_is_anonymous()) |
| 338 | 336 | { |
| 339 | 337 | $course_fiter = 'visibility = ' . COURSE_VISIBILITY_OPEN_WORLD; |
| 340 | - } |
|
| 341 | - else |
|
| 338 | + } else |
|
| 342 | 339 | { |
| 343 | 340 | $course_fiter = 'visibility = ' . COURSE_VISIBILITY_OPEN_WORLD . ' OR '; |
| 344 | 341 | $course_fiter .= 'visibility = ' . COURSE_VISIBILITY_OPEN_PLATFORM . ' OR '; |
@@ -94,7 +94,7 @@ |
||
| 94 | 94 | /** |
| 95 | 95 | * @param array $templates |
| 96 | 96 | * |
| 97 | - * @return null |
|
| 97 | + * @return null|string |
|
| 98 | 98 | */ |
| 99 | 99 | public function formatTemplates($templates) |
| 100 | 100 | { |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | public function createHtmlStyle() |
| 56 | 56 | { |
| 57 | 57 | $style = ''; |
| 58 | - if (trim($this->value) == '<html><head><title></title></head><body></body></html>' || $this->value == '' ) { |
|
| 58 | + if (trim($this->value) == '<html><head><title></title></head><body></body></html>' || $this->value == '') { |
|
| 59 | 59 | $cssFile = api_get_path(SYS_CSS_PATH).'themes/'.api_get_visual_theme().'/editor.css'; |
| 60 | 60 | if (!is_file($cssFile)) { |
| 61 | 61 | $cssFile = api_get_path(WEB_CSS_PATH).'editor.css'; |
@@ -147,14 +147,14 @@ discard block |
||
| 147 | 147 | return [[ |
| 148 | 148 | 'title' => get_lang('EmptyTemplate'), |
| 149 | 149 | 'description' => null, |
| 150 | - 'image' => api_get_path(WEB_APP_PATH) . 'home/default_platform_document/template_thumb/empty.gif', |
|
| 150 | + 'image' => api_get_path(WEB_APP_PATH).'home/default_platform_document/template_thumb/empty.gif', |
|
| 151 | 151 | 'html' => ' |
| 152 | 152 | <!DOCYTPE html> |
| 153 | 153 | <html> |
| 154 | 154 | <head> |
| 155 | - <meta charset="' . api_get_system_encoding() . '" /> |
|
| 155 | + <meta charset="' . api_get_system_encoding().'" /> |
|
| 156 | 156 | </head> |
| 157 | - <body dir="' . api_get_text_direction() . '"> |
|
| 157 | + <body dir="' . api_get_text_direction().'"> |
|
| 158 | 158 | <p> |
| 159 | 159 | <br/> |
| 160 | 160 | </p> |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | $search = array('{CSS}', '{IMG_DIR}', '{REL_PATH}', '{COURSE_DIR}'); |
| 178 | 178 | $replace = array( |
| 179 | 179 | '', |
| 180 | - api_get_path(REL_CODE_PATH) . 'img/', |
|
| 180 | + api_get_path(REL_CODE_PATH).'img/', |
|
| 181 | 181 | api_get_path(REL_PATH), |
| 182 | 182 | api_get_path(REL_DEFAULT_COURSE_DOCUMENT_PATH), |
| 183 | 183 | api_get_path(REL_DEFAULT_COURSE_DOCUMENT_PATH) |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | foreach ($systemTemplates as $template) { |
| 189 | 189 | $image = $template->getImage(); |
| 190 | 190 | $image = !empty($image) ? $image : 'empty.gif'; |
| 191 | - $image = api_get_path(WEB_APP_PATH) . 'home/default_platform_document/template_thumb/' . $image; |
|
| 191 | + $image = api_get_path(WEB_APP_PATH).'home/default_platform_document/template_thumb/'.$image; |
|
| 192 | 192 | |
| 193 | 193 | /*$image = $this->urlGenerator->generate( |
| 194 | 194 | 'get_document_template_action', |
@@ -240,12 +240,12 @@ discard block |
||
| 240 | 240 | $templateItem['image'] = api_get_path(WEB_APP_PATH) |
| 241 | 241 | . 'home/default_platform_document/template_thumb/noimage.gif'; |
| 242 | 242 | $templateItem['html'] = file_get_contents(api_get_path(SYS_COURSE_PATH) |
| 243 | - . $courseDirectory . '/document' . $templateData['path']); |
|
| 243 | + . $courseDirectory.'/document'.$templateData['path']); |
|
| 244 | 244 | |
| 245 | 245 | $image = $template->getImage(); |
| 246 | 246 | if (!empty($image)) { |
| 247 | 247 | $templateItem['image'] = api_get_path(WEB_COURSE_PATH) |
| 248 | - . $courseDirectory . '/upload/template_thumbnails/' . $template->getImage(); |
|
| 248 | + . $courseDirectory.'/upload/template_thumbnails/'.$template->getImage(); |
|
| 249 | 249 | } |
| 250 | 250 | |
| 251 | 251 | $templateList[] = $templateItem; |
@@ -84,7 +84,7 @@ |
||
| 84 | 84 | |
| 85 | 85 | /** |
| 86 | 86 | * Available driver list. |
| 87 | - * @return array |
|
| 87 | + * @return string[] |
|
| 88 | 88 | */ |
| 89 | 89 | private function getDefaultDriverList() |
| 90 | 90 | { |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | 'root_sys' => api_get_path(SYS_PATH), |
| 52 | 52 | 'sys_root' => api_get_path(SYS_PATH), // just an alias |
| 53 | 53 | 'sys_course_path' => api_get_path(SYS_COURSE_PATH), |
| 54 | - // 'sys_config_path' => $app['path.config'], |
|
| 54 | + // 'sys_config_path' => $app['path.config'], |
|
| 55 | 55 | 'path.temp' => api_get_path(SYS_ARCHIVE_PATH), |
| 56 | 56 | //'sys_log_path' => $app['path.logs'] |
| 57 | 57 | ); |
@@ -325,9 +325,9 @@ discard block |
||
| 325 | 325 | **/ |
| 326 | 326 | public function access($attr, $path, $data, $volume) |
| 327 | 327 | { |
| 328 | - return strpos(basename($path), '.') === 0 // if file/folder begins with '.' (dot) |
|
| 329 | - ? !($attr == 'read' || $attr == 'write') // set read+write to false, other (locked+hidden) set to true |
|
| 330 | - : null; // else elFinder decide it itself |
|
| 328 | + return strpos(basename($path), '.') === 0 // if file/folder begins with '.' (dot) |
|
| 329 | + ? !($attr == 'read' || $attr == 'write') // set read+write to false, other (locked+hidden) set to true |
|
| 330 | + : null; // else elFinder decide it itself |
|
| 331 | 331 | } |
| 332 | 332 | |
| 333 | 333 | /** |
@@ -327,7 +327,7 @@ |
||
| 327 | 327 | { |
| 328 | 328 | return strpos(basename($path), '.') === 0 // if file/folder begins with '.' (dot) |
| 329 | 329 | ? !($attr == 'read' || $attr == 'write') // set read+write to false, other (locked+hidden) set to true |
| 330 | - : null; // else elFinder decide it itself |
|
| 330 | + : null; // else elFinder decide it itself |
|
| 331 | 331 | } |
| 332 | 332 | |
| 333 | 333 | /** |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | /** |
| 134 | 134 | * Close connection |
| 135 | 135 | * |
| 136 | - * @return void |
|
| 136 | + * @return boolean |
|
| 137 | 137 | * @author Dmitry (dio) Levashov |
| 138 | 138 | **/ |
| 139 | 139 | public function umount() { |
@@ -488,7 +488,7 @@ discard block |
||
| 488 | 488 | * Close opened file |
| 489 | 489 | * |
| 490 | 490 | * @param resource $fp file pointer |
| 491 | - * @return bool |
|
| 491 | + * @return boolean|null |
|
| 492 | 492 | * @author Dmitry (dio) Levashov |
| 493 | 493 | **/ |
| 494 | 494 | protected function _fclose($fp, $path='') { |
@@ -505,7 +505,7 @@ discard block |
||
| 505 | 505 | * |
| 506 | 506 | * @param string $path parent dir path |
| 507 | 507 | * @param string $name new directory name |
| 508 | - * @return string|bool |
|
| 508 | + * @return string|false |
|
| 509 | 509 | * @author Dmitry (dio) Levashov |
| 510 | 510 | **/ |
| 511 | 511 | protected function _mkdir($path, $name) { |
@@ -633,8 +633,8 @@ |
||
| 633 | 633 | } |
| 634 | 634 | |
| 635 | 635 | /** |
| 636 | - * {@inheritdoc} |
|
| 637 | - */ |
|
| 636 | + * {@inheritdoc} |
|
| 637 | + */ |
|
| 638 | 638 | protected function _archive($dir, $files, $name, $arc) { |
| 639 | 639 | return false; |
| 640 | 640 | } |
@@ -464,7 +464,7 @@ discard block |
||
| 464 | 464 | * @return resource|false |
| 465 | 465 | * @author Dmitry (dio) Levashov |
| 466 | 466 | **/ |
| 467 | - protected function _fopen($path, $mode='rb') { |
|
| 467 | + protected function _fopen($path, $mode = 'rb') { |
|
| 468 | 468 | $fp = $this->tmbPath |
| 469 | 469 | ? @fopen($this->tmpname($path), 'w+') |
| 470 | 470 | : @tmpfile(); |
@@ -491,7 +491,7 @@ discard block |
||
| 491 | 491 | * @return bool |
| 492 | 492 | * @author Dmitry (dio) Levashov |
| 493 | 493 | **/ |
| 494 | - protected function _fclose($fp, $path='') { |
|
| 494 | + protected function _fclose($fp, $path = '') { |
|
| 495 | 495 | @fclose($fp); |
| 496 | 496 | if ($path) { |
| 497 | 497 | @unlink($this->tmpname($path)); |
@@ -532,7 +532,6 @@ discard block |
||
| 532 | 532 | /** |
| 533 | 533 | * Set sslPubKey |
| 534 | 534 | * |
| 535 | - * @param string $sslPubKey |
|
| 536 | 535 | * @return BranchSync |
| 537 | 536 | */ |
| 538 | 537 | public function setBranchType($branchType) |
@@ -714,7 +713,7 @@ discard block |
||
| 714 | 713 | } |
| 715 | 714 | |
| 716 | 715 | /** |
| 717 | - * @return mixed |
|
| 716 | + * @return null|BranchSync |
|
| 718 | 717 | */ |
| 719 | 718 | public function getParent() |
| 720 | 719 | { |
@@ -136,11 +136,11 @@ discard block |
||
| 136 | 136 | */ |
| 137 | 137 | private $lastSyncType; |
| 138 | 138 | |
| 139 | - /** |
|
| 140 | - * @var string |
|
| 141 | - * |
|
| 142 | - * @ORM\Column(name="ssl_pub_key", type="string", length=250, nullable=true, unique=false) |
|
| 143 | - */ |
|
| 139 | + /** |
|
| 140 | + * @var string |
|
| 141 | + * |
|
| 142 | + * @ORM\Column(name="ssl_pub_key", type="string", length=250, nullable=true, unique=false) |
|
| 143 | + */ |
|
| 144 | 144 | private $sslPubKey; |
| 145 | 145 | |
| 146 | 146 | /** |
@@ -529,12 +529,12 @@ discard block |
||
| 529 | 529 | return $this->sslPubKey; |
| 530 | 530 | } |
| 531 | 531 | |
| 532 | - /** |
|
| 533 | - * Set sslPubKey |
|
| 534 | - * |
|
| 535 | - * @param string $sslPubKey |
|
| 536 | - * @return BranchSync |
|
| 537 | - */ |
|
| 532 | + /** |
|
| 533 | + * Set sslPubKey |
|
| 534 | + * |
|
| 535 | + * @param string $sslPubKey |
|
| 536 | + * @return BranchSync |
|
| 537 | + */ |
|
| 538 | 538 | public function setBranchType($branchType) |
| 539 | 539 | { |
| 540 | 540 | $this->branchType = $branchType; |
@@ -139,7 +139,7 @@ |
||
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | /** |
| 142 | - * @param $user |
|
| 142 | + * @param User $user |
|
| 143 | 143 | * @return $this |
| 144 | 144 | */ |
| 145 | 145 | public function setUser($user) |
@@ -22,8 +22,8 @@ |
||
| 22 | 22 | * @param $tool learnpath | document | etc |
| 23 | 23 | * @param $itemId |
| 24 | 24 | * @param Course $course |
| 25 | - * @param int $sessionId |
|
| 26 | - * @param int $groupId |
|
| 25 | + * @param int $session |
|
| 26 | + * @param int $group |
|
| 27 | 27 | * |
| 28 | 28 | * @return \Doctrine\ORM\QueryBuilder |
| 29 | 29 | */ |
@@ -196,7 +196,7 @@ |
||
| 196 | 196 | $users = \GroupManager::getStudentsAndTutors($groupId); |
| 197 | 197 | $newUserList = array(); |
| 198 | 198 | if (!empty($users)) { |
| 199 | - foreach($users as $user) { |
|
| 199 | + foreach ($users as $user) { |
|
| 200 | 200 | $newUserList[] = $user['user_id']; |
| 201 | 201 | } |
| 202 | 202 | $this->unsubcribeUsersToItem( |